PageSourceSearch

https://u24.gov.ua/45-es5.86fb0fe2a3d8ad6ca0c9.js

js u24.gov.ua collected 2026-09-24 08:26:23 UTC 1,130,748 bytes, 1 lines download raw bytes

1!function(){function e(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function t(){return(t="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=i(e,t);if(n){var a=Object.getOwnPropertyDescriptor(n,t);return a.get?a.get.call(arguments.length<3?e:r):a.value}}).apply(this,arguments)}function i(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=w(e)););return e}function r(e){return function(e){if(Array.isArray(e))return c(e)}(e)||n(e)||u(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function a(e,t){return s(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==i)return;var r,n,a=[],o=!0,s=!1;try{for(i=i.call(e);!(o=(r=i.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(l){s=!0,n=l}finally{try{o||null==i.return||i.return()}finally{if(s)throw n}}return a}(e,t)||u(e,t)||o()}function o(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function s(e){if(Array.isArray(e))return e}function l(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!i){if(Array.isArray(e)||(i=u(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var r=0,n=function(){};return{s:n,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==i.return||i.return()}finally{if(s)throw a}}}}function u(e,t){if(e){if("string"==typeof e)return c(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=new Array(t);i<t;i++)r[i]=e[i];return r}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function d(e,t,i){return t&&f(e.prototype,t),i&&f(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function p(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&b(e,t)}function m(e){var t=x();return function(){var i,r=w(e);if(t){var n=w(this).constructor;i=Reflect.construct(r,arguments,n)}else i=r.apply(this,arguments);return v(this,i)}}function v(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return y(e)}function y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _(e){var t="function"==typeof Map?new Map:void 0;return(_=function(e){if(null===e||(i=e,-1===Function.toString.call(i).indexOf("[native code]")))return e;var i;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return g(e,arguments,w(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),b(r,e)})(e)}function g(e,t,i){return(g=x()?Reflect.construct:function(e,t,i){var r=[null];r.push.apply(r,t);var n=new(Function.bind.apply(e,r));return i&&b(n,i.prototype),n}).apply(null,arguments)}function x(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}
1function w(e){return(w=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}(self.webpackChunkunited24_landing=self.webpackChunkunited24_landing||[]).push([[45],{82958:function(i){i.exports=function(){"use strict";var i,c,f;function x(e,t){if(i)if(c){var r="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 = {}; ("+i+")(sharedChunk); ("+c+")(sharedChunk); self.onerror = null;",n={};i(n),f=t(n),"undefined"!=typeof window&&window&&window.URL&&window.URL.createObjectURL&&(f.workerUrl=window.URL.createObjectURL(new Blob([r],{type:"text/javascript"})))}else c=t;else i=t}return x(0,function(e){var i,c,f,x="undefined"!=typeof self?self:{},b="2.14.1",k={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(null==i){var e=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{i=null!=process.env.API_URL_REGEX?new RegExp(process.env.API_URL_REGEX):e}catch(pp){i=e}}return 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(!k.API_URL)return null;try{var e=new URL(k.API_URL);return"api.mapbox.cn"===e.hostname?"https://events.mapbox.cn/events/v2":"api.mapbox.com"===e.hostname?"https://events.mapbox.com/events/v2":null}catch(e){return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16},T={supported:!1,testSupport:function(e){!E&&f&&(M?S(e):c=e)}},E=!1,M=!1;function S(e){var t=e.createTexture();e.bindTexture(e.TEXTURE_2D,t);try{if(e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,f),e.isContextLost())return;T.supported=!0}
1catch(mp){}e.deleteTexture(t),E=!0}x.document&&((f=x.document.createElement("img")).onload=function(){c&&S(c),c=null,M=!0},f.onerror=function(){E=!0,c=null},f.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");var I="01",C=A;function A(e,t,i,r){this.cx=3*e,this.bx=3*(i-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(r-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=i,this.p2y=r}A.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(void 0===t&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var i=e,r=0;r<8;r++){var n=this.sampleCurveX(i)-e;if(Math.abs(n)<t)return i;var a=this.sampleCurveDerivativeX(i);if(Math.abs(a)<1e-6)break;i-=n/a}var o=0,s=1;for(i=e,r=0;r<20&&(n=this.sampleCurveX(i),!(Math.abs(n-e)<t));r++)e>n?o=i:s=i,i=.5*(s-o)+o;return i},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}};var z=P;function P(e,t){this.x=e,this.y=t}P.prototype={clone:function(){return new P(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,i=e.y-this.y;return t*t+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=t,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),i=Math.sin(e),r=i*this.x+t*this.y;return this.x=t*this.x-i*this.y,this.y=r,this},_rotateAround:function(e,t){var i=Math.cos(e),r=Math.sin(e),n=t.y+r*(this.x-t.x)+i*(this.y-t.y);return this.x=t.x+i*(this.x-t.x)-r*(this.y-t.y),this.y=n,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},P.convert=function(e){return e instanceof P?e:Array.isArray(e)?new P(e[0],e[1]):e};var D=Math.PI/180,L=180/Math.PI;function R(e){return e*D}function B(e){return e*L}var O=[[0,0],[1,0],[1,1],[0,1]];function F(e){if(e<=0)return 0;if(e>=1)return 1;var t=e*e,i=t*e;return 4*(e<.5?i:3*(e-t)+i-.75)}function U(e,t,i,r){var n=new C(e,t,i,r);return function(e){return n.solve(e)}}var V=U(.25,.1,.25,1);function j(e,t,i){return Math.min(i,Math.max(t,e))}function N(e,t,i){return(i=j((i-e)/(t-e),0,1))*i*(3-2*i)}function G(e,t,i){var r=i-t,n=((e-t)%r+r)%r+t;return n===t?i:n}function Z(e,t,i){if(!e.length)return i(null,[]);var r=e.length,n=new Array(e.length),a=null;e.forEach(function(e,o){t(e,function(e,t){e&&(a=e),n[o]=t,0==--r&&i(a,n)})})}function q(e){var t=[];for(var i in e)t.push(e[i]);return t}function W(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];for(var n=0,a=i;n<a.length;n++){var o=a[n];for(var s in o)e[s]=o[s]}return e}var X=1;function H(){return X++}function Y(){return function e(t){return t?(t^Math.random()*(16>>t/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,e)}()}function K(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function J(e){return!!e&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}function $(e,t){e.forEach(function(e){t[e]&&(t[e]=t[e].bind(t))})}function Q(e,t){return-1!==e.indexOf(t,e.length-t.length)}function ee(e,t,i){var r={};for(var n in e)r[n]=t.call(i||this,e[n],n,e);return r}function te(e,t,i){var r={};for(var n in e)t.call(i||this,e[n],n,e)&&(r[n]=e[n]);return r}function ie(e){return Array.isArray(e)?e.map(ie):"object"==typeof e&&e?ee(e,ie):e}var re={};function ne(e){re[e]||("undefined"!=typeof console&&console.warn(e),re[e]=!0)}function ae(e,t,i){return(i.y-e.y)*(t.x-e.x)>(t.y-e.y)*(i.x-e.x)}function oe(e){for(var t,i,r=0,n=0,a=e.length,o=a-1;n<a;o=n++)t=e[n],r+=((i=e[o]).x-t.x)*(t.y+i.y);return r}function se(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function le(e){var t={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,function(e,i,r,n){var a=r||n;return t[i]=!a||a.toLowerCase(),""}),t["max-age"]){var i=parseInt(t["max-age"],10);isNaN(i)?delete t["max-age"]:t["max-age"]=i}return t}var ue=null;function ce(e){if(null==ue){var t=e.navigator?e.navigator.userAgent:null;ue=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return ue}function he(e){try{var t=x[e];return t.setItem("_mapbox_test_",1),t.removeItem("_mapbox_test_"),!0}catch(t){return!1}}function fe(e,t){return[e[4*t],e[4*t+1],e[4*t+2],e[4*t+3]]}var de,pe,me="mapbox-tiles",ve=500,ye=50;function _e(){try{return x.caches}catch(On){}}function ge(){_e()&&!de&&(de=x.caches.open(me))}function xe(e){var t=e.indexOf("?");if(t<0)return e;var i=function(e){var t=e.indexOf("?");return t>0?e.slice(t+1).split("&"):[]}(e).filter(function(e){var t=e.split("=");return"language"===t[0]||"worldview"===t[0]});return i.length?"".concat(e.slice(0,t),"?").concat(i.join("&")):e.slice(0,t)}var be=1/0,we={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(we);var ke=function(e){p(i,e);var t=m(i);function i(e,r,n){var a;return h(this,i),401===r&&De(n)&&(e+=": you may have provided an invali
1d Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),(a=t.call(this,e)).status=r,a.url=n,a}return d(i,[{key:"toString",value:function(){return"".concat(this.name,": ").concat(this.message," (").concat(this.status,"): ").concat(this.url)}}]),i}(_(Error)),Te=se()?function(){return self.worker&&self.worker.referrer}:function(){return("blob:"===x.location.protocol?x.parent:x).location.href},Ee=function(e,t){if(!(/^file:/.test(i=e.url)||/^file:/.test(Te())&&!/^\w+:/.test(i))){if(x.fetch&&x.Request&&x.AbortController&&x.Request.prototype.hasOwnProperty("signal"))return function(e,t){var i,r=new x.AbortController,n=new x.Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,referrer:Te(),referrerPolicy:e.referrerPolicy,signal:r.signal}),a=!1,o=!1,s=(i=n.url).indexOf("sku=")>0&&De(i);"json"===e.type&&n.headers.set("Accept","application/json");var l=function(i,r,a){if(!o){if(i&&"SecurityError"!==i.message&&ne(i),r&&a)return u(r);var l=Date.now();x.fetch(n).then(function(i){if(i.ok){var r=s?i.clone():null;return u(i,r,l)}return t(new ke(i.statusText,i.status,e.url))}).catch(function(i){"AbortError"!==i.name&&t(new Error("".concat(i.message," ").concat(e.url)))})}},u=function(i,r,s){("arrayBuffer"===e.type?i.arrayBuffer():"json"===e.type?i.json():i.text()).then(function(e){o||(r&&s&&function(e,t,i){if(ge(),de){var r={status:t.status,statusText:t.statusText,headers:new x.Headers};t.headers.forEach(function(e,t){return r.headers.set(t,e)});var n=le(t.headers.get("Cache-Control")||"");if(!n["no-store"]){n["max-age"]&&r.headers.set("Expires",new Date(i+1e3*n["max-age"]).toUTCString());var a=r.headers.get("Expires");a&&(new Date(a).getTime()-i<42e4||function(e,t){if(void 0===pe)try{new Response(new ReadableStream),pe=!0}catch(i){pe=!1}pe?t(e.body):e.blob().then(t)}(t,function(t){var i=new x.Response(t,r);ge(),de&&de.then(function(t){return t.put(xe(e.url),i)}).catch(function(e){return ne(e.message)})}))}}}(n,r,s),a=!0,t(null,e,i.headers.get("Cache-Control"),i.headers.get("Expires")))}).catch(function(e){o||t(new Error(e.message))})};return s?function(e,t){if(ge(),!de)return t(null);var i=xe(e.url);de.then(function(e){e.match(i).then(function(r){var n=function(e){if(!e)return!1;var t=new Date(e.headers.get("Expires")||0),i=le(e.headers.get("Cache-Control")||"");return t>Date.now()&&!i["no-cache"]}(r);e.delete(i),n&&e.put(i,r.clone()),t(null,r,n)}).catch(t)}).catch(t)}(n,l):l(null,null),{cancel:function(){o=!0,a||r.abort()}}}(e,t);if(se()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",e,t,void 0,!0)}var i;return function(e,t){var i=new x.XMLHttpRequest;for(var r in i.open(e.method||"GET",e.url,!0),"arrayBuffer"===e.type&&(i.responseType="arraybuffer"),e.headers)i.setRequestHeader(r,e.headers[r]);return"json"===e.type&&(i.responseType="text",i.setRequestHeader("Accept","application/json")),i.withCredentials="include"===e.credentials,i.onerror=function(){t(new Error(i.statusText))},i.onload=function(){if((i.status>=200&&i.status<300||0===i.status)&&null!==i.response){var r=i.response;if("json"===e.type)try{r=JSON.parse(i.response)}catch(xp){return t(xp)}t(null,r,i.getResponseHeader("Cache-Control"),i.getResponseHeader("Expires"))}else t(new ke(i.statusText,i.status,e.url))},i.send(e.body),{cancel:function(){return i.abort()}}}(e,t)},Me=function(e,t){return Ee(W(e,{type:"arrayBuffer"}),t)};function Se(e){var t=x.document.createElement("a");return t.href=e,t.protocol===x.document.location.protocol&&t.host===x.document.location.host}var Ie,Ce,Ae="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";Ie=[],Ce=0;var ze="NO_ACCESS_TOKEN";function Pe(e){return 0===e.indexOf("mapbox:")}function De(e){return k.API_URL_REGEX.test(e)}function Le(e){return k.API_CDN_URL_REGEX.test(e)}function Re(e){return k.API_STYLE_REGEX.test(e)&&!Be(e)}function Be(e){return k.API_SPRITE_REGEX.test(e)}var Oe=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Fe(e){var t=e.match(Oe);if(!t)throw new Error("Unable to parse URL object");return{protocol:t[1],authority:t[2],path:t[3]||"/",params:t[4]?t[4].split("&"):[]}}function Ue(e){var t=e.params.length?"?".concat(e.params.join("&")):"";return"".concat(e.protocol,"://").concat(e.authority).concat(e.path).concat(t)}function Ve(e){if(!e)return null;var t=e.split(".");if(!t||3!==t.length)return null;try{return JSON.parse(decodeURIComponent(x.atob(t[1]).split("").map(function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)}).join("")))}catch(mp){return null}}var je=function(){function e(t){h(this,e),this.type=t,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}return d(e,[{key:"getStorageKey",value:function(e){var t,i=Ve(k.ACCESS_TOKEN);return t=i&&i.u?x.btoa(encodeURIComponent(i.u).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode(Number("0x"+t))})):k.ACCESS_TOKEN||"",e?"mapbox.eventData.".concat(e,":").concat(t):"mapbox.eventData:".concat(t)}},{key:"fetchEventData",value:function(){var e=he("localStorage"),t=this.getStorageKey(),i=this.getStorageKey("uuid");if(e)try{var r=x.localStorage.getItem(t);r&&(this.eventData=JSON.parse(r));var n=x.localStorage.getItem(i);n&&(this.anonId=n)}catch(r){ne("Unable to read from LocalStorage")}}},{key:"saveEventData",value:function(){var e=he("localStorage"),t=this.getStorageKey(),i=this.getStorageKey("uuid");if(e)try{x.localStorage.setItem(i,this.anonId),Object.keys(this.eventData).length>=1&&x.localStorage.setItem(t,JSON.stringify(this.eventData))}catch(yp){ne("Unable to write to LocalStorage")}}},{key:"processRequests",value:function(e){}},{key:"postEvent",value:function(e,t,i,r){var n=this;if(k.EVENTS_URL){var a=Fe(k.EVENTS_URL);a.params.push("access_token=".concat(r||k.ACCESS_TOKEN||""));var o,s={event:this.type,created:new Date(e).toISOString()},l=t?W(s,t):s,u={url:Ue(a),headers:{"Content-Type":"text/plain"},body:JSON.stringify([l])};this.pendingRequest=(o=function(e){n.pendingRequest=null,i(e),n.saveEventData(),n.processRequests(r)},Ee(W(u,{method:"POST"}),o))}}},{key:"queueRequest",value:function(e,t){this.queue.push(e),this.processRequests(t)}}]),e}(),Ne=new(function(e){p(i,e);var t=m(i);function i(e){var r;return h(this,i),(r=t.call(this,"appUserTurnstile"))._customAccessToken=e,r}return d(i,[{key:"postTurnstileEvent",value:function(e,t){k.EVENTS_URL&&k.ACCESS_TOKEN&&Array.isArray(e)&&e.some(function(e){return Pe(e)||De(e)})&&this.queueRequest(Date.now(),t)}},{key:"processRequests",value:function(e){var t=this;if(!this.pendingRequest&&0!==this.queue.length){this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();var i=Ve(k.ACCESS_TOKEN),r=i?i.u:k.ACCESS_TOKEN,n=r!==this.eventData.tokenU;J(this.anonId)||(this.anonId=Y(),n=!0);var a=this.queue.shift();if(this.eventData.lastSuccess){var o=new Date(this.eventData.lastSuccess),s=new Date(a),l=(a-this.eventData.lastSuccess)/864e5;n=n||l>=1||l<-1||o.getDate()!==s.getDate()}else n=!0;n?this.postEvent(a,{sdkIdentifier:"mapbox-gl-js",sdkVersion:b,skuId:I,"enabled.telemetry":!1,userId:this.anonId},function(e){e||(t.eventData.lastSuccess=a,t.eventData.tokenU=r)},e):this.processRequests()}}}]),i}(je)),Ge=Ne.postTurnstileEvent.bind(Ne),Ze=new(function(e){p(i,e);var t=m(i);function i(){var e;return h(this,i),(e=t.call(this,"map.load")).success={},e.skuToken="",e}return d(i,[{key:"postMapLoadEvent",value:function(e,t,i,r){this.skuToken=t,this.errorCb=r,k.EVENTS_URL&&(i||k.ACCESS_TOKEN?this.queueRequest({id:e,timestamp:Date.now()},i):this.errorCb(new Error(ze)))}},{key:"processRequests",value:function(e){var t=this;if(!this.pendingRequest&&0!==this.queue.length){var i=this.queue.shift(),r=i.id,n=i.timestamp;r&&this.success[r]||(this.anonId||this.fetchEventData(),J(this.anonId)||(this.anonId=Y()),this.postEvent(n,{sdkIdentifier:"mapbox-gl-js",sdkVersion:b,skuId:I,skuToken:this.skuToken,userId:this.anonId},function(e){e?t.errorCb(e):r&&(t.success[r]=!0)},e))}}}]),i}(je)),qe=Ze.postMapLoadEvent.bind(Ze),We=new(function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.call(this,"gljs.performance")}return d(i,[{key:"postPerformanceEvent",value:function(e,t){k.EVENTS_URL&&(e||k.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:t},e)}},{key:"processRequests",value:function(e){if(!this.pendingRequest&&0!==this.queue.length){var t,i=this.queue.shift(),r=i.timestamp,n=function(e){var t=x.performance.getEntriesByType("resource"),i=x.performance.getEntriesByType("mark"),r=function(e){var t={};if(e)for(var i in e)if("other"!==i){var r,n=l(e[i]);try{for(n.s();!(r=n.n()).done;){var a=r.value,o="".concat(i,"ResolveRangeMin"),s="".concat(i,"ResolveRangeMax"),u="".concat(i,"RequestCount"),c="".concat(i,"RequestCachedCount");t[o]=Math.min(t[o]||1/0,a.startTime),t[s]=Math.max(t[s]||-1/0,a.responseEnd);var h=function(e){void 0===t[e]&&(t[e]=0),++t[e]};void 0!==a.transferSize&&0===a.transferSize&&h(c),h(u)}}catch(f){n.e(f)}finally{n.f()}}return t}(function(e,t){var i={};if(e){var r,n=l(e);try{for(n.s();!(r=n.n()).done;){var a=r.value,o=t(a);void 0===i[o]&&(i[o]=[]),i[o].push(a)}}catch(s){n.e(s)}finally{n.f()}}return i}(t,Qe)),n=x.devicePixelRatio,a=x.navigator.connection||x.navigator.mozConnection||x.navigator.webkitConnection,o={counters:[],metadata:[],attributes:[]},s=function(e,t,i){null!=i&&e.push({name:t,value:i.toString()})};for(var u in r)s(o.counters,u,r[u]);if(e.interactionRange[0]!==1/0&&e.interactionRange[1]!==-1/0&&(s(o.counters,"interactionRangeMin",e.interactionRange[0]),s(o.counters,"interactionRangeMax",e.interactionRange[1])),i)for(var c=function(){var e=f[h],t=Je[e],r=i.find(function(e){return e.name===t});r&&s(o.counters,t,r.startTime)},h=0,f=Object.keys(Je);h<f.length;h++)c();return s(o.counters,"visibilityHidden",e.visibilityHidden),s(o.attributes,"style",function(e){if(e){var t,i=l(e);try{for(i.s();!(t=i.n()).done;){var r=t.value.name.split("?")[0];if(Re(r)){var n=r.split("/").slice(-2);if(2===n.length)return"mapbox://styles/".concat(n[0],"/").concat(n[1])}}}catch(a){i.e(a)}finally{i.f()}}}(t)),s(o.attributes,"terrainEnabled",e.terrainEnabled?"true":"false"),s(o.attributes,"fogEnabled",e.fogEnabled?"true":"false"),s(o.attributes,"projection",e.projection),s(o.attributes,"zoom",e.zoom),s(o.metadata,"devicePixelRatio",n),s(o.metadata,"connectionEffectiveType",a?a.effectiveType:void 0),s(o.metadata,"navigatorUserAgent",x.navigator.userAgent),s(o.metadata,"screenWidth",x.screen.width),s(o.metadata,"screenHeight",x.screen.height),s(o.metadata,"windowWidth",x.innerWidth),s(o.metadata,"windowHeight",x.innerHeight),s(o.metadata,"mapWidth",e.width/n),s(o.metadata,"mapHeight",e.height/n),s(o.metadata,"webglRenderer",e.renderer),s(o.metadata,"webglVendor",e.vendor),s(o.metadata,"sdkVersion",b),s(o.metadata,"sdkIdentifier","mapbox-gl-js"),o}
1(i.performanceData),a=l(n.metadata);try{for(a.s();!(t=a.n()).done;)t.value}catch(h){a.e(h)}finally{a.f()}var o,s=l(n.counters);try{for(s.s();!(o=s.n()).done;)o.value}catch(h){s.e(h)}finally{s.f()}var u,c=l(n.attributes);try{for(c.s();!(u=c.n()).done;)u.value}catch(h){c.e(h)}finally{c.f()}this.postEvent(r,n,function(){},e)}}}]),i}(je)),Xe=We.postPerformanceEvent.bind(We),He=new(function(e){p(i,e);var t=m(i);function i(){var e;return h(this,i),(e=t.call(this,"map.auth")).success={},e.skuToken="",e}return d(i,[{key:"getSession",value:function(e,t,i,r){var n=this;if(k.API_URL&&k.SESSION_PATH){var a=Fe(k.API_URL+k.SESSION_PATH);a.params.push("sku=".concat(t||"")),a.params.push("access_token=".concat(r||k.ACCESS_TOKEN||""));var o,s={url:Ue(a),headers:{"Content-Type":"text/plain"}};this.pendingRequest=(o=function(e){n.pendingRequest=null,i(e),n.saveEventData(),n.processRequests(r)},Ee(W(s,{method:"GET"}),o))}}},{key:"getSessionAPI",value:function(e,t,i,r){this.skuToken=t,this.errorCb=r,k.SESSION_PATH&&k.API_URL&&(i||k.ACCESS_TOKEN?this.queueRequest({id:e,timestamp:Date.now()},i):this.errorCb(new Error(ze)))}},{key:"processRequests",value:function(e){var t=this;if(!this.pendingRequest&&0!==this.queue.length){var i=this.queue.shift(),r=i.id,n=i.timestamp;r&&this.success[r]||this.getSession(n,this.skuToken,function(e){e?t.errorCb(e):r&&(t.success[r]=!0)},e)}}}]),i}(je)),Ye=He.getSessionAPI.bind(He),Ke=new Set,Je={create:"create",load:"load",fullLoad:"fullLoad"},$e={mark:function(e){x.performance.mark(e)},measure:function(e,t,i){x.performance.measure(e,t,i)}};function Qe(e){var t=e.name.split("?")[0];return Le(t)&&t.includes("mapbox-gl.js")?"javascript":Le(t)&&t.includes("mapbox-gl.css")?"css":k.API_FONTS_REGEX.test(t)?"fontRange":Be(t)?"sprite":Re(t)?"style":k.API_TILEJSON_REGEX.test(t)?"tilejson":"other"}var et,tt,it,rt,nt=x.performance;function at(e){var t=e?e.url.toString():void 0;return nt.getEntriesByName(t)}var ot={now:function(){return void 0!==it?it:x.performance.now()},setNow:function(e){it=e},restoreNow:function(){it=void 0},frame:function(e){var t=x.requestAnimationFrame(e);return{cancel:function(){return x.cancelAnimationFrame(t)}}},getImageData:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=e.width,r=e.height;rt||(rt=x.document.createElement("canvas"));var n=rt.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("failed to create canvas 2d context");return(i>rt.width||r>rt.height)&&(rt.width=i,rt.height=r),n.clearRect(-t,-t,i+2*t,r+2*t),n.drawImage(e,0,0,i,r),n.getImageData(-t,-t,i+2*t,r+2*t)},resolveURL:function(e){return et||(et=x.document.createElement("a")),et.href=e,et.href},get devicePixelRatio(){return x.devicePixelRatio},get prefersReducedMotion(){return!!x.matchMedia&&(null==tt&&(tt=x.matchMedia("(prefers-reduced-motion: reduce)")),tt.matches)}};function st(e,t,i){i[e]&&-1!==i[e].indexOf(t)||(i[e]=i[e]||[],i[e].push(t))}function lt(e,t,i){if(i&&i[e]){var r=i[e].indexOf(t);-1!==r&&i[e].splice(r,1)}}var ut=d(function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};h(this,e),W(this,i),this.type=t}),ct=function(e){p(i,e);var t=m(i);function i(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return h(this,i),t.call(this,"error",W({error:e},r))}return d(i)}(ut),ht=function(){function e(){h(this,e)}return d(e,[{key:"on",value:function(e,t){return this._listeners=this._listeners||{},st(e,t,this._listeners),this}},{key:"off",value:function(e,t){return lt(e,t,this._listeners),lt(e,t,this._oneTimeListeners),this}},{key:"once",value:function(e,t){var i=this;return t?(this._oneTimeListeners=this._oneTimeListeners||{},st(e,t,this._oneTimeListeners),this):new Promise(function(t){return i.once(e,t)})}},{key:"fire",value:function(e,t){"string"==typeof e&&(e=new ut(e,t||{}));var i=e.type;if(this.listens(i)){e.target=this;var r,n=l(this._listeners&&this._listeners[i]?this._listeners[i].slice():[]);try{for(n.s();!(r=n.n()).done;){r.value.call(this,e)}}catch(c){n.e(c)}finally{n.f()}var a,o=l(this._oneTimeListeners&&this._oneTimeListeners[i]?this._oneTimeListeners[i].slice():[]);try{for(o.s();!(a=o.n()).done;){var s=a.value;lt(i,s,this._oneTimeListeners),s.call(this,e)}}catch(c){o.e(c)}finally{o.f()}var u=this._eventedParent;u&&(W(e,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),u.fire(e))}else e instanceof ct&&console.error(e.error);return this}},{key:"listens",value:function(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))}},{key:"setEventedParent",value:function(e,t){return this._eventedParent=e,this._eventedParentData=t,this}}]),e}(),ft=JSON.parse('{"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360,"units":"degrees"},"pitch":{"type":"number","default":0,"units":"degrees"},"light":{"type":"light"},"terrain":{"type":"terrain"},"fog":{"type":"fog"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"type":"array","value":"layer"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],"source_vector":{"type":{"required":true,"type":"enum","values":{"vector":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"scheme":{"type":"enum","values":{"xyz":{},"tms":{}},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"type":"enum","values":{"raster":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"scheme":{"type":"enum","values":{"xyz":{},"tms":{}},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"type":"enum","values":{"raster-dem":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":{},"mapbox":{}},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":{"geojson":{}}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0}
1,"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":{}}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":{}}},"url":{"required":true,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"hillshade":{},"background":{},"sky":{}},"required":true},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"}},"layout":["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background","layout_sky"],"layout_background":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"},"fill-extrusion-edge-radius":{"type":"number","private":true,"default":0,"minimum":0,"maximum":1
vendor: 16,128 bytes, line 1
1,"property-type":"constant"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":{},"round":{},"square":{}},"default":"butt","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":{},"round":{},"miter":{}},"default":"miter","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"requires":[{"line-join":"miter"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-round-limit":{"type":"number","default":1.05,"requires":[{"line-join":"round"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":{},"line":{},"line-center":{}},"default":"point","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"units":"pixels","requires":[{"symbol-placement":"line"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":{},"viewport-y":{},"source":{}},"default":"auto","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-optional":{"type":"boolean","default":false,"requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-size":{"type":"number","default":1,"minimum":0,"units":"factor of the original icon size","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{"type":"enum","values":{"none":{},"width":{},"height":{},"both":{}},"default":"none","requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"units":"pixels","requires":["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{"type":"boolean","default":false,"requires":["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{"type":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"default":"center","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{"type":"number","default":10,"minimum":0,"units":"ems","requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":{},"left":{},"center":{},"right":{}},"default":"center","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","units":"ems","default":0,"requires":["text-field"],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-anchor":{"type":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"default":"center","requires":["text-field",{"!":"text-variable-anchor"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"units":"degrees","requires":["text-field",{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":{},"vertical":{}},"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-keep-upright":{"type":"boolean","default":true,"requires":["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-transform":{"type":"enum","values":{"none":{},"uppercase":{},"lowercase":{}},"default":"none","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","units":"ems","length":2,"default":[0,0],"requires":["text-field",{"!":"text-radial-offset"}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-optional":{"type":"boolean","default":false,"requires":["text-field","icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},"in":{},"!in":{},"all":{},"any":{},"none":{},"has":{},"!has":{},"within":{}}},"geometry_type":{"type":"enum","values":{"Point":{},"LineString":{},"Polygon":{}}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":{},"exponential":{},"interval":{},"categorical":{}},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":{},"lab":{},"hcl":{}},"default":"rgb"},"default":{"type":"*","required":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"high-color":{"type":"color","property-type":"data-constant","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"space-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"star-intensity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":{},"viewport":{}},"property-type":"data-constant","transition":false,"expression":{"interpolated":false,"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":{},"equalEarth":{},"equirectangular":{},"lambertConformalConic":{},"mercator":{},"naturalEarth":{},"winkelTripel":{},"globe":{}},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-180,-90],"maximum":[180,90],"transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-90,-90],"maximum":[90,90],"transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"requires":["source"]}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"requires":[{"!":"fill-pattern"},{"fill-antialias":true}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","transition":
vendor: 3,713 bytes, line 1
1false,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-extrusion-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-extrusion-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"requires":["fill-extrusion-height"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant","type":"number","private":true,"default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant","type":"number","private":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"requires":["fill-extrusion-edge-radius"]}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"line-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["line-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"}
1,"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"transition":false,"units":"line widths","requires":[{"!":"line-pattern"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-gradient":{"type":"color","transition":false,"requires":[{"!":"line-pattern"},{"source":"geojson","has":{"lineMetrics":true}}],"expression":{"interpolated":true,"parameters":["line-progress"]},"property-type":"color-ramp"},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"transition":false,"requires":[{"source":"geojson","has":{"lineMetrics":true}}],"property-type":"constant"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["circle-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"transition":false,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"transition":false,"expression":{"interpolated":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["icon-image","icon-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["text-field","text-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"units":"degrees","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":{},"nearest":{}},"default":"linear","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"transition":false,"units":"milliseconds","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"transition":false,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_background":{"background-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"background-pattern"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":{},"atmosphere":{}},"default":"atmosphere","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"requires":[{"sky-type":"atmosphere"}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","requires":[{"sky-type":"atmosphere"}],"default":10,"minimum":0,"maximum":100,"transition":false,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","requires":[{"sky-type":"gradient"}],"value":"number","default":[0,0],"length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","requires":[{"sky-type":"gradient"}],"default":90,"minimum":0,"maximum":180,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"transition":false,"requires":[{"sky-type":"gradient"}],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"transition":{"duration":{"type":"number","default":300,"minimum":0,"units":"milliseconds"},"delay":{"type":"number","default":0,"minimum":0,"units":"milliseconds"}},"property-type":{"data-driven":{"type":"property-type"},"color-ramp":{"type":"property-type"},"data-constant":{"type":"property-type"},"constant":{"type":"property-type"}},"promoteId":{"*":{"type":"string"}}}');function dt(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];for(var n=0,a=i;n<a.length;n++){var o=a[n];for(var s in o)e[s]=o[s]}return e}function pt(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function mt(e){if(Array.isArray(e))return e.map(mt);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){var t={};for(var i in e)t[i]=mt(e[i]);return t}return pt(e)}var vt=function(e){p(i,e);var t=m(i);function i(e,r){var n;return h(this,i),(n=t.call(this,r)).message=r,n.key=e,n}return d(i)}(_(Error)),yt=function(){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];h(this,e),this.parent=t,this.bindings={};var r,n=l(i);try{for(n.s();!(r=n.n()).done;){var o=a(r.value,2),s=o[0],u=o[1];this.bindings[s]=u}}catch(c){n.e(c)}finally{n.f()}}
1return d(e,[{key:"concat",value:function(t){return new e(this,t)}},{key:"get",value:function(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error("".concat(e," not found in scope."))}},{key:"has",value:function(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}]),e}(),_t={kind:"null"},gt={kind:"number"},xt={kind:"string"},bt={kind:"boolean"},wt={kind:"color"},kt={kind:"object"},Tt={kind:"value"},Et={kind:"collator"},Mt={kind:"formatted"},St={kind:"resolvedImage"};function It(e,t){return{kind:"array",itemType:e,N:t}}function Ct(e){if("array"===e.kind){var t=Ct(e.itemType);return"number"==typeof e.N?"array<".concat(t,", ").concat(e.N,">"):"value"===e.itemType.kind?"array":"array<".concat(t,">")}return e.kind}var At=[_t,gt,xt,bt,wt,Mt,kt,It(Tt),St];function zt(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!zt(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if("value"===e.kind){var i,r=l(At);try{for(r.s();!(i=r.n()).done;){if(!zt(i.value,t))return null}}catch(n){r.e(n)}finally{r.f()}}}return"Expected ".concat(Ct(e)," but found ").concat(Ct(t)," instead.")}function Pt(e,t){return t.some(function(t){return t.kind===e.kind})}function Dt(e,t){return t.some(function(t){return"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e})}var Lt,Rt={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 Bt(e){return(e=Math.round(e))<0?0:e>255?255:e}function Ot(e){return Bt("%"===e[e.length-1]?parseFloat(e)/100*255:parseInt(e))}function Ft(e){return(t="%"===e[e.length-1]?parseFloat(e)/100:parseFloat(e))<0?0:t>1?1:t;var t}function Ut(e,t,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?e+(t-e)*i*6:2*i<1?t:3*i<2?e+(t-e)*(2/3-i)*6:e}try{Lt={}.parseCSSColor=function(e){var t,i=e.replace(/ /g,"").toLowerCase();if(i in Rt)return Rt[i].slice();if("#"===i[0])return 4===i.length?(t=parseInt(i.substr(1),16))>=0&&t<=4095?[(3840&t)>>4|(3840&t)>>8,240&t|(240&t)>>4,15&t|(15&t)<<4,1]:null:7===i.length&&(t=parseInt(i.substr(1),16))>=0&&t<=16777215?[(16711680&t)>>16,(65280&t)>>8,255&t,1]:null;var r=i.indexOf("("),n=i.indexOf(")");if(-1!==r&&n+1===i.length){var a=i.substr(0,r),o=i.substr(r+1,n-(r+1)).split(","),s=1;switch(a){case"rgba":if(4!==o.length)return null;s=Ft(o.pop());case"rgb":return 3!==o.length?null:[Ot(o[0]),Ot(o[1]),Ot(o[2]),s];case"hsla":if(4!==o.length)return null;s=Ft(o.pop());case"hsl":if(3!==o.length)return null;var l=(parseFloat(o[0])%360+360)%360/360,u=Ft(o[1]),c=Ft(o[2]),h=c<=.5?c*(u+1):c+u-c*u,f=2*c-h;return[Bt(255*Ut(f,h,l+1/3)),Bt(255*Ut(f,h,l)),Bt(255*Ut(f,h,l-1/3)),s];default:return null}}return null}}catch(On){}var Vt=function(){function e(t,i,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;h(this,e),this.r=t,this.g=i,this.b=r,this.a=n}return d(e,[{key:"toString",value:function(){var e=a(this.toArray(),4),t=e[0],i=e[1],r=e[2],n=e[3];return"rgba(".concat(Math.round(t),",").concat(Math.round(i),",").concat(Math.round(r),",").concat(n,")")}},{key:"toArray",value:function(){var e=this.r,t=this.g,i=this.b,r=this.a;return 0===r?[0,0,0,0]:[255*e/r,255*t/r,255*i/r,r]}},{key:"toArray01",value:function(){var e=this.r,t=this.g,i=this.b,r=this.a;return 0===r?[0,0,0,0]:[e/r,t/r,i/r,r]}},{key:"toArray01PremultipliedAlpha",value:function(){return[this.r,this.g,this.b,this.a]}}],[{key:"parse",value:function(t){if(t){if(t instanceof e)return t;if("string"==typeof t){var i=Lt(t);return i?new e(i[0]/255*i[3],i[1]/255*i[3],i[2]/255*i[3],i[3]):void 0}}}}]),e}();Vt.black=new Vt(0,0,0,1),Vt.white=new Vt(1,1,1,1),Vt.transparent=new Vt(0,0,0,0),Vt.red=new Vt(1,0,0,1),Vt.blue=new Vt(0,0,1,1);var jt=Vt,Nt=function(){function e(t,i,r){h(this,e),this.sensitivity=t?i?"variant":"case":i?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}
1return d(e,[{key:"compare",value:function(e,t){return this.collator.compare(e,t)}},{key:"resolvedLocale",value:function(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}]),e}(),Gt=d(function e(t,i,r,n,a){h(this,e),this.text=t.normalize?t.normalize():t,this.image=i,this.scale=r,this.fontStack=n,this.textColor=a}),Zt=function(){function e(t){h(this,e),this.sections=t}return d(e,[{key:"isEmpty",value:function(){return 0===this.sections.length||!this.sections.some(function(e){return 0!==e.text.length||e.image&&0!==e.image.name.length})}},{key:"toString",value:function(){return 0===this.sections.length?"":this.sections.map(function(e){return e.text}).join("")}},{key:"serialize",value:function(){var e,t=["format"],i=l(this.sections);try{for(i.s();!(e=i.n()).done;){var r=e.value;if(r.image)t.push(["image",r.image.name]);else{t.push(r.text);var n={};r.fontStack&&(n["text-font"]=["literal",r.fontStack.split(",")]),r.scale&&(n["font-scale"]=r.scale),r.textColor&&(n["text-color"]=["rgba"].concat(r.textColor.toArray())),t.push(n)}}}catch(a){i.e(a)}finally{i.f()}return t}}],[{key:"fromString",value:function(t){return new e([new Gt(t,null,null,null,null)])}},{key:"factory",value:function(t){return t instanceof e?t:e.fromString(t)}}]),e}(),qt=function(){function e(t){h(this,e),this.name=t.name,this.available=t.available}return d(e,[{key:"toString",value:function(){return this.name}},{key:"serialize",value:function(){return["image",this.name]}}],[{key:"fromString",value:function(t){return t?new e({name:t,available:!1}):null}}]),e}();function Wt(e,t,i,r){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof i&&i>=0&&i<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:"Invalid rgba value [".concat([e,t,i,r].join(", "),"]: 'a' must be between 0 and 1."):"Invalid rgba value [".concat(("number"==typeof r?[e,t,i,r]:[e,t,i]).join(", "),"]: 'r', 'g', and 'b' must be between 0 and 255.")}function Xt(e){if(null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||e instanceof jt||e instanceof Nt||e instanceof Zt||e instanceof qt)return!0;if(Array.isArray(e)){var t,i=l(e);try{for(i.s();!(t=i.n()).done;){if(!Xt(t.value))return!1}}catch(n){i.e(n)}finally{i.f()}return!0}if("object"==typeof e){for(var r in e)if(!Xt(e[r]))return!1;return!0}return!1}function Ht(e){if(null===e)return _t;if("string"==typeof e)return xt;if("boolean"==typeof e)return bt;if("number"==typeof e)return gt;if(e instanceof jt)return wt;if(e instanceof Nt)return Et;if(e instanceof Zt)return Mt;if(e instanceof qt)return St;if(Array.isArray(e)){var t,i,r=e.length,n=l(e);try{for(n.s();!(i=n.n()).done;){var a=Ht(i.value);if(t){if(t===a)continue;t=Tt;break}t=a}}catch(o){n.e(o)}finally{n.f()}return It(t||Tt,r)}return kt}function Yt(e){var t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof jt||e instanceof Zt||e instanceof qt?e.toString():JSON.stringify(e)}var Kt=function(){function e(t,i){h(this,e),this.type=t,this.value=i}return d(e,[{key:"evaluate",value:function(){return this.value}},{key:"eachChild",value:function(){}},{key:"outputDefined",value:function(){return!0}},{key:"serialize",value:function(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof jt?["rgba"].concat(this.value.toArray()):this.value instanceof Zt?this.value.serialize():this.value}}],[{key:"parse",value:function(t,i){if(2!==t.length)return i.error("'literal' expression requires exactly one argument, but found ".concat(t.length-1," instead."));if(!Xt(t[1]))return i.error("invalid value");var r=t[1],n=Ht(r),a=i.expectedType;return"array"!==n.kind||0!==n.N||!a||"array"!==a.kind||"number"==typeof a.N&&0!==a.N||(n=a),new e(n,r)}}]),e}(),Jt=function(){function e(t){h(this,e),this.name="ExpressionEvaluationError",this.message=t}return d(e,[{key:"toJSON",value:function(){return this.message}}]),e}(),$t={string:xt,number:gt,boolean:bt,object:kt},Qt=function(){function e(t,i){h(this,e),this.type=t,this.args=i}return d(e,[{key:"evaluate",value:function(e){for(var t=0;t<this.args.length;t++){var i=this.args[t].evaluate(e);if(!zt(this.type,Ht(i)))return i;if(t===this.args.length-1)throw new Jt("Expected value to be of type ".concat(Ct(this.t
1ype),", but found ").concat(Ct(Ht(i))," instead."))}return null}},{key:"eachChild",value:function(e){this.args.forEach(e)}},{key:"outputDefined",value:function(){return this.args.every(function(e){return e.outputDefined()})}},{key:"serialize",value:function(){var e=this.type,t=[e.kind];if("array"===e.kind){var i=e.itemType;if("string"===i.kind||"number"===i.kind||"boolean"===i.kind){t.push(i.kind);var r=e.N;("number"==typeof r||this.args.length>1)&&t.push(r)}}return t.concat(this.args.map(function(e){return e.serialize()}))}}],[{key:"parse",value:function(t,i){if(t.length<2)return i.error("Expected at least one argument.");var r,n=1,a=t[0];if("array"===a){var o,s;if(t.length>2){var l=t[1];if("string"!=typeof l||!(l in $t)||"object"===l)return i.error('The item type argument of "array" must be one of string, number, boolean',1);o=$t[l],n++}else o=Tt;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return i.error('The length argument to "array" must be a positive integer literal',2);s=t[2],n++}r=It(o,s)}else r=$t[a];for(var u=[];n<t.length;n++){var c=i.parse(t[n],n,Tt);if(!c)return null;u.push(c)}return new e(r,u)}}]),e}(),ei=function(){function e(t){h(this,e),this.type=Mt,this.sections=t}return d(e,[{key:"evaluate",value:function(e){return new Zt(this.sections.map(function(t){var i=t.content.evaluate(e);return Ht(i)===St?new Gt("",i,null,null,null):new Gt(Yt(i),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null)}))}},{key:"eachChild",value:function(e){var t,i=l(this.sections);try{for(i.s();!(t=i.n()).done;){var r=t.value;e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor)}}catch(n){i.e(n)}finally{i.f()}}},{key:"outputDefined",value:function(){return!1}},{key:"serialize",value:function(){var e,t=["format"],i=l(this.sections);try{for(i.s();!(e=i.n()).done;){var r=e.value;t.push(r.content.serialize());var n={};r.scale&&(n["font-scale"]=r.scale.serialize()),r.font&&(n["text-font"]=r.font.serialize()),r.textColor&&(n["text-color"]=r.textColor.serialize()),t.push(n)}}catch(a){i.e(a)}finally{i.f()}return t}}],[{key:"parse",value:function(t,i){if(t.length<2)return i.error("Expected at least one argument.");var r=t[1];if(!Array.isArray(r)&&"object"==typeof r)return i.error("First argument must be an image or text section.");for(var n=[],a=!1,o=1;o<=t.length-1;++o){var s=t[o];if(a&&"object"==typeof s&&!Array.isArray(s)){a=!1;var l=null;if(s["font-scale"]&&!(l=i.parse(s["font-scale"],1,gt)))return null;var u=null;if(s["text-font"]&&!(u=i.parse(s["text-font"],1,It(xt))))return null;var c=null;if(s["text-color"]&&!(c=i.parse(s["text-color"],1,wt)))return null;var h=n[n.length-1];h.scale=l,h.font=u,h.textColor=c}else{var f=i.parse(t[o],1,Tt);if(!f)return null;var d=f.type.kind;if("string"!==d&&"value"!==d&&"null"!==d&&"resolvedImage"!==d)return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");a=!0,n.push({content:f,scale:null,font:null,textColor:null})}}return new e(n)}}]),e}(),ti=function(){function e(t){h(this,e),this.type=St,this.input=t}return d(e,[{key:"evaluate",value:function(e){var t=this.input.evaluate(e),i=qt.fromString(t);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(t)>-1),i}},{key:"eachChild",value:function(e){e(this.input)}},{key:"outputDefined",value:function(){return!1}},{key:"serialize",value:function(){return["image",this.input.serialize()]}}],[{key:"parse",value:function(t,i){if(2!==t.length)return i.error("Expected two arguments.");var r=i.parse(t[1],1,xt);return r?new e(r):i.error("No image name provided.")}}]),e}(),ii={"to-boolean":bt,"to-color":wt,"to-number":gt,"to-string":xt},ri=function(){function e(t,i){h(this,e),this.type=t,this.args=i}return d(e,[{key:"evaluate",value:function(e){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(e));if("color"===this.type.kind){var t,i,r,n=l(this.args);try{for(n.s();!(r=n.n()).done;){if(t=r.value.evaluate(e),i=null,t instanceof jt)return t;if("string"==typeof t){var a=e.parseColor(t);if(a)return a}else if(Array.isArray(t)&&!(i=t.length<3||t.length>4?"Invalid rbga value ".concat(JSON.stringify(t),": expected an array containing either three or four numeric values."):Wt(t[0],t[1],t[2],t[3]))
1)return new jt(t[0]/255,t[1]/255,t[2]/255,t[3])}}catch(h){n.e(h)}finally{n.f()}throw new Jt(i||"Could not parse color from value '".concat("string"==typeof t?t:String(JSON.stringify(t)),"'"))}if("number"===this.type.kind){var o,s=null,u=l(this.args);try{for(u.s();!(o=u.n()).done;){if(null===(s=o.value.evaluate(e)))return 0;var c=Number(s);if(!isNaN(c))return c}}catch(h){u.e(h)}finally{u.f()}throw new Jt("Could not convert ".concat(JSON.stringify(s)," to number."))}return"formatted"===this.type.kind?Zt.fromString(Yt(this.args[0].evaluate(e))):"resolvedImage"===this.type.kind?qt.fromString(Yt(this.args[0].evaluate(e))):Yt(this.args[0].evaluate(e))}},{key:"eachChild",value:function(e){this.args.forEach(e)}},{key:"outputDefined",value:function(){return this.args.every(function(e){return e.outputDefined()})}},{key:"serialize",value:function(){if("formatted"===this.type.kind)return new ei([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new ti(this.args[0]).serialize();var e=["to-".concat(this.type.kind)];return this.eachChild(function(t){e.push(t.serialize())}),e}}],[{key:"parse",value:function(t,i){if(t.length<2)return i.error("Expected at least one argument.");var r=t[0];if(("to-boolean"===r||"to-string"===r)&&2!==t.length)return i.error("Expected one argument.");for(var n=ii[r],a=[],o=1;o<t.length;o++){var s=i.parse(t[o],o,Tt);if(!s)return null;a.push(s)}return new e(n,a)}}]),e}(),ni=["Unknown","Point","LineString","Polygon"],ai=function(){function e(){h(this,e),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}return d(e,[{key:"id",value:function(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}},{key:"geometryType",value:function(){return this.feature?"number"==typeof this.feature.type?ni[this.feature.type]:this.feature.type:null}},{key:"geometry",value:function(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}},{key:"canonicalID",value:function(){return this.canonical}},{key:"properties",value:function(){return this.feature&&this.feature.properties||{}}},{key:"distanceFromCenter",value:function(){if(this.featureTileCoord&&this.featureDistanceData){var e=this.featureDistanceData.center,t=this.featureDistanceData.scale,i=this.featureTileCoord,r=i.x,n=i.y;return this.featureDistanceData.bearing[0]*(r*t-e[0])+this.featureDistanceData.bearing[1]*(n*t-e[1])}return 0}},{key:"parseColor",value:function(e){var t=this._parseColorCache[e];return t||(t=this._parseColorCache[e]=jt.parse(e)),t}}]),e}(),oi=function(){function e(t,i,r,n){h(this,e),this.name=t,this.type=i,this._evaluate=r,this.args=n}return d(e,[{key:"evaluate",value:function(e){return this._evaluate(e,this.args)}},{key:"eachChild",value:function(e){this.args.forEach(e)}},{key:"outputDefined",value:function(){return!1}},{key:"serialize",value:function(){return[this.name].concat(this.args.map(function(e){return e.serialize()}))}}],[{key:"parse",value:function(t,i){var n,o=t[0],s=e.definitions[o];if(!s)return i.error('Unknown expression "'.concat(o,'". If you wanted a literal array, use ["literal", [...]].'),0);var u,c=Array.isArray(s)?s[0]:s.type,h=Array.isArray(s)?[[s[1],s[2]]]:s.overloads,f=h.filter(function(e){var i=a(e,1)[0];return!Array.isArray(i)||i.length===t.length-1}),d=null,p=l(f);try{for(p.s();!(u=p.n()).done;){var m=a(u.value,2),v=m[0],y=m[1];d=new Ci(i.registry,i.path,null,i.scope);for(var _=[],g=!1,x=1;x<t.length;x++){var b=t[x],w=Array.isArray(v)?v[x-1]:v.type,k=d.parse(b,1+_.length,w);if(!k){g=!0;break}_.push(k)}if(!g)if(Array.isArray(v)&&v.length!==_.length)d.error("Expected ".concat(v.length," arguments, but found ").concat(_.length," instead."));else{for(var T=0;T<_.length;T++){var E=Array.isArray(v)?v[T]:v.type,M=_[T];d.concat(T+1).checkSubtype(E,M.type)}if(0===d.errors.length)return new e(o,c,y,_)}}}catch(z){p.e(z)}finally{p.f()}if(1===f.length)(n=i.errors).push.apply(n,r(d.errors));else{for(var S=(f.length?f:h).map(function(e){var t;return t=a(e,1)[0],Array.isArray(t)?"(".concat(t.map(Ct).join(", "),")"):"(".concat(Ct(t.type),"...)")}).join(" | "),I=[],C=1;C<t.length;C++){var A=i.parse(t[C],1+I.length);if(!A)return null;I.push(Ct(A.type))}i.error("Expected arguments of type ".concat(S,", but found (").concat(I.join(", "),") instead."))}return null}},{key:"register",value:function(t,i){for(var r in e.definitions=i,i)t[r]=e}}]),e}(),si=function(){function e(t,i,r){h(this,e),this.type=Et,this.locale=r,this.caseSensitive=t,this.diacriticSensitive=i}return d(e,[{key:"evaluate",value:function(e){return new Nt(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}},{key:"eachChild",value:function(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}},{key:"outputDefined",value:function(){return!1}},{key:"serialize",value:function(){var e={};return e["case-sensitive"]=this.caseSensitive.serialize(),e["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(e.locale=this.locale.serialize()),["collator",e]}}],[{key:"parse",value:function(t,i){if(2!==t.length)return i.error("Expected one argument.");var r=t[1];if("object"!=typeof r||Array.isArray(r))return i.error("Collator options argument must be an object.");var n=i.parse(void 0!==r["case-sensitive"]&&r["case-sensitive"],1,bt);if(!n)return null;var a=i.parse(void 0!==r["diacritic-sensitive"]&&r["diacritic-sensitive"],1,bt);if(!a)return null;var o=null;return r.locale&&!(o=i.parse(r.locale,1,xt))?null:new e(n,a,o)}}]),e}(),li=8192;function ui(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function ci(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function hi(e,t){var i=(180+e[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,n=Math.pow(2,t.z);return[Math.round(i*n*li),Math.round(r*n*li)]}function fi(e,t,i){var r=e[0]-t[0],n=e[1]-t[1],a=e[0]-i[0],o=e[1]-i[1];return r*o-a*n==0&&r*a<=0&&n*o<=0}function di(e,t){for(var i,r,n,a=!1,o=0,s=t.length;o<s;o++)for(var l=t[o],u=0,c=l.length;u<c-1;u++){if(fi(e,l[u],l[u+1]))return!1;(r=l[u])[1]>(i=e)[1]!=(n=l[u+1])[1]>i[1]&&i[0]<(n[0]-r[0])*(i[1]-r[1])/(n[1]-r[1])+r[0]&&(a=!a)}return a}function pi(e,t){for(var i=0;i<t.length;i++)if(di(e,t[i]))return!0;return!1}function mi(e,t,i,r){var n=r[0]-i[0],a=r[1]-i[1],o=(e[0]-i[0])*a-n*(e[1]-i[1]),s=(t[0]-i[0])*a-n*(t[1]-i[1]);return o>0&&s<0||o<0&&s>0}function vi(e,t,i){var r,n,a,o,s,u,c,h=l(i);try{for(h.s();!(r=h.n()).done;)for(var f=r.value,d=0;d<f.length-1;++d)if((u=[(s=f[d+1])[0]-(o=f[d])[0],s[1]-o[1]])[0]*(c=[(a=t)[0]-(n=e)[0],a[1]-n[1]])[1]-u[1]*c[0]!=0&&mi(n,a,o,s)&&mi(o,s,n,a))return!0}catch(p){h.e(p)}finally{h.f()}return!1}function yi(e,t){for(var i=0;i<e.length;++i)if(!di(e[i],t))return!1;for(var r=0;r<e.length-1;++r)if(vi(e[r],e[r+1],t))return!1;return!0}function _i(e,t){for(var i=0;i<t.length;i++)if(yi(e,t[i]))return!0;return!1}function gi(e,t,i){for(var r=[],n=0;n<e.length;n++){for(var a=[],o=0;o<e[n].length;o++){var s=hi(e[n][o],i);ui(t,s),a.push(s)}r.push(a)}return r}function xi(e,t,i){for(var r=[],n=0;n<e.length;n++){var a=gi(e[n],t,i);r.push(a)}return r}function bi(e,t,i,r){if(e[0]<i[0]||e[0]>i[2]){var n=.5*r,a=e[0]-i[0]>n?-r:i[0]-e[0]>n?r:0;0===a&&(a=e[0]-i[2]>n?-r:i[2]-e[0]>n?r:0),e[0]+=a}ui(t,e)}function wi(e,t,i,r){var n=Math.pow(2,r.z)*li,a=[r.x*li,r.y*li],o=[];if(!e)return o;var s,u=l(e);try{for(u.s();!(s=u.n()).done;){var c,h=l(s.value);try{for(h.s();!(c=h.n()).done;){var f=c.value,d=[f.x+a[0],f.y+a[1]];bi(d,t,i,n),o.push(d)}}catch(p){h.e(p)}finally{h.f()}}}catch(p){u.e(p)}finally{u.f()}return o}function ki(e,t,i,r){var n=Math.pow(2,r.z)*li,a=[r.x*li,r.y*li],o=[];if(!e)return o;var s,u,c=l(e);try{for(c.s();!(s=c.n()).done;){var h,f=s.value,d=[],p=l(f);try{for(p.s();!(h=p.n()).done;){var m=h.value,v=[m.x+a[0],m.y+a[1]];ui(t,v),d.push(v)}}catch(b){p.e(b)}finally{p.f()}o.push(d)}}catch(b){c.e(b)}finally{c.f()}if(t[2]-t[0]<=n/2){(u=t)[0]=u[1]=1/0,u[2]=u[3]=-1/0;var y,_=l(o);try{for(_.s();!(y=_.n()).done;){var g,x=l(y.value);try{for(x.s();!(g=x.n()).done;){bi(g.value,t,i,n)}}catch(b){x.e(b)}finally{x.f()}}}catch(b){_.e(b)}finally{_.f()}}return o}var Ti=function(){function e(t,i){h(this,e),this.type=bt,this.geojson=t,this.geometries=i}return d(e,[{key:"evaluate",value:function(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){var i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if(!n)return!1;if("Polygon"===t.type){var a=gi(t.coordinates,r,n),o=wi(e.geometry(),i,r,n);if(!ci(i,r))return!1;var s,u=l(o);try{for(u.s();!(s=u.n()).done;){if(!di(s.value,a))return!1}}catch(p){u.e(p)}finally{u.f()}}if("MultiPolygon"===t.type){var c=xi(t.coordinates,r,n),h=wi(e.geometry(),i,r,n);if(!ci(i,r))return!1;var f,d=l(h);try{for(d.s();!(f=d.n()).done;){if(!pi(f.value,c))return!1}}catch(p){d.e(p)}finally{d.f()}}return!0}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){var i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if(!n)return!1;if("Polygon"===t.type){var a=gi(t.coordinates,r,n),o=ki(e.geometry(),i,r,n);if(!ci(i,r))return!1;var s,u=l(o);try{for(u.s();!(s=u.n()).done;){if(!yi(s.value,a))return!1}}catch(p){u.e(p)}finally{u.f()}}if("MultiPolygon"===t.type){var c=xi(t.coordinates,r,n),h=ki(e.geometry(),i,r,n);if(!ci(i,r))return!1;var f,d=l(h);try{for(d.s();!(f=d.n()).done;){if(!_i(f.value,c))return!1}}catch(p){d.e(p)}finally{d.f()}}return!0}(e,this.geometries)}return!1}},{key:"eachChild",value:function(){}},{key:"outputDefined",value:function(){return!0}},{key:"serialize",value:function(){return["within",this.geojson]}}],[{key:"parse",value:function(t,i){if(2!==t.length)return i.error("'within' expression requires exactly one argument, but found ".concat(t.length-1," instead."));if(Xt(t[1])){var r=t[1];if("FeatureCollection"===r.type)for(var n=0;n<r.features.length;++n){var a=r.features[n].geometry.type;if("Polygon"===a||"MultiPolygon"===a)return new e(r,r.features[n].geometry)}else if("Feature"===r.type){var o=r.geometry.type;if("Polygon"===o||"MultiPolygon"===o)return new e(r,r.geometry)}else if("Polygon"===r.type||"MultiPolygon"===r.type)return new e(r,r)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}}]),e}();function Ei(e){if(e instanceof oi&&("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 Ti)return!1;var t=!0;return e.eachChild(function(e){t&&!Ei(e)&&(t=!1)}),t}function Mi(e){if(e instanceof oi&&"feature-state"===e.name)return!1;var t=!0;return e.eachChild(function(e){t&&!Mi(e)&&(t=!1)}),t}function Si(e,t){if(e instanceof oi&&t.indexOf(e.name)>=0)return!1;var i=!0;return e.eachChild(function(e){i&&!Si(e,t)&&(i=!1)}),i}var Ii=function(){function e(t,i){h(this,e),this.type=i.type,this.name=t,this.boundExpression=i}return d(e,[{key:"evaluate",value:function(e){return this.boundExpression.evaluate(e)}},{key:"eachChild",value:function(){}},{key:"outputDefined",value:function(){return!1}},{key:"serialize",value:function(){return["var",this.name]}}],[{key:"parse",value:function(t,i){if(2!==t.length||"string"!=typeof t[1])return i.error("'var' expression requires exactly one string literal argument.");var r=t[1];return i.scope.has(r)?new e(r,i.scope.get(r)):i.error('Unknown variable "'.concat(r,'". Make sure "').concat(r,'" has been bound in an enclosing "let" expression before using it.'),1)}}]),e}(),Ci=function(){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new yt,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];h(this,e),this.registry=t,this.path=i,this.key=i.map(function(e){return"[".concat(e,"]")}).join(""),this.scope=n,this.errors=a,this.expectedType=r}return d(e,[{key:"parse",value:function(e,t,i,r){var n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return t?this.concat(t,i,r)._parse(e,n):this._parse(e,n)}},{key:"_parse",value:function(e,t){function i(e,t,i){return"assert"===i?new Qt(t,[e]):"coerce"===i?new ri(t,[e]):e}if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');var r=e[0];if("string"!=typeof r)return this.error("Expression name must be a string, but found ".concat(typeof r,' instead. If you wanted a literal array, use ["literal", [...]].'),0),null;var n=this.registry[r];if(n){var a=n.parse(e,this);if(!a)return null;if(this.expectedType){var o=this.expectedType,s=a.type;if("string"!==o.kind&&"number"!==o.kind&&"boolean"!==o.kind&&"object"!==o.kind&&"array"!==o.kind||"value"!==s.kind)if("color"!==o.kind&&"formatted"!==o.kind&&"resolvedImage"!==o.kind||"value"!==s.kind&&"string"!==s.kind){if(this.checkSubtype(o,s))return null}else a=i(a,o,t.typeAnnotation||"coerce");else a=i(a,o,t.typeAnnotation||"assert")}if(!(a instanceof Kt)&&"resolvedImage"!==a.type.kind&&Ai(a)){var l=new ai;try{a=new Kt(a.type,a.evaluate(l))}catch(s){return this.error(s.message),null}}return a}return this.error('Unknown expression "'.concat(r,'". If you wanted a literal array, use ["literal", [...]].'),0)}return this.error(void 0===e?"'undefined' value invalid. Use null instead.":"object"==typeof e?'Bare objects invalid. Use ["literal", {...}] instead.':"Expected an array, but found ".concat(typeof e," instead."))}},{key:"concat",value:function(t,i,r){var n="number"==typeof t?this.path.concat(t):this.path,a=r?this.scope.concat(r):this.scope;return new e(this.registry,n,i||null,a,this.errors)}},{key:"error",value:function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];var n="".concat(this.key).concat(i.map(function(e){return"[".concat(e,"]")}).join(""));this.errors.push(new vt(n,e))}},{key:"checkSubtype",value:function(e,t){var i=zt(e,t);return i&&this.error(i),i}}]),e}();function Ai(e){if(e instanceof Ii)return Ai(e.boundExpression);if(e instanceof oi&&"error"===e.name||e instanceof si||e instanceof Ti)return!1;var t=e instanceof ri||e instanceof Qt,i=!0;return e.eachChild(function(e){i=t?i&&Ai(e):i&&e instanceof Kt}),!!i&&Ei(e)&&Si(e,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"])}function zi(e,t){for(var i,r,n=e.length-1,a=0,o=n,s=0;a<=o;
1)if(i=e[s=Math.floor((a+o)/2)],r=e[s+1],i<=t){if(s===n||t<r)return s;a=s+1}else{if(!(i>t))throw new Jt("Input is not a number.");o=s-1}return 0}var Pi=function(){function e(t,i,r){h(this,e),this.type=t,this.input=i,this.labels=[],this.outputs=[];var n,o=l(r);try{for(o.s();!(n=o.n()).done;){var s=a(n.value,2),u=s[0],c=s[1];this.labels.push(u),this.outputs.push(c)}}catch(f){o.e(f)}finally{o.f()}}return d(e,[{key:"evaluate",value:function(e){var t=this.labels,i=this.outputs;if(1===t.length)return i[0].evaluate(e);var r=this.input.evaluate(e);if(r<=t[0])return i[0].evaluate(e);var n=t.length;return r>=t[n-1]?i[n-1].evaluate(e):i[zi(t,r)].evaluate(e)}},{key:"eachChild",value:function(e){e(this.input);var t,i=l(this.outputs);try{for(i.s();!(t=i.n()).done;){e(t.value)}}catch(r){i.e(r)}finally{i.f()}}},{key:"outputDefined",value:function(){return this.outputs.every(function(e){return e.outputDefined()})}},{key:"serialize",value:function(){for(var e=["step",this.input.serialize()],t=0;t<this.labels.length;t++)t>0&&e.push(this.labels[t]),e.push(this.outputs[t].serialize());return e}}],[{key:"parse",value:function(t,i){if(t.length-1<4)return i.error("Expected at least 4 arguments, but found only ".concat(t.length-1,"."));if((t.length-1)%2!=0)return i.error("Expected an even number of arguments.");var r=i.parse(t[1],1,gt);if(!r)return null;var n=[],a=null;i.expectedType&&"value"!==i.expectedType.kind&&(a=i.expectedType);for(var o=1;o<t.length;o+=2){var s=1===o?-1/0:t[o],l=t[o+1],u=o,c=o+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.',u);if(n.length&&n[n.length-1][0]>=s)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',u);var h=i.parse(l,c,a);if(!h)return null;a=a||h.type,n.push([s,h])}return new e(a,r,n)}}]),e}();function Di(e,t,i){return e*(1-i)+t*i}var Li=Object.freeze({__proto__:null,number:Di,color:function(e,t,i){return new jt(Di(e.r,t.r,i),Di(e.g,t.g,i),Di(e.b,t.b,i),Di(e.a,t.a,i))},array:function(e,t,i){return e.map(function(e,r){return Di(e,t[r],i)})}}),Ri=4/29,Bi=6/29,Oi=3*Bi*Bi,Fi=Math.PI/180,Ui=180/Math.PI;function Vi(e){return e>.008856451679035631?Math.pow(e,1/3):e/Oi+Ri}function ji(e){return e>Bi?e*e*e:Oi*(e-Ri)}function Ni(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function Gi(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Zi(e){var t=Gi(e.r),i=Gi(e.g),r=Gi(e.b),n=Vi((.4124564*t+.3575761*i+.1804375*r)/.95047),a=Vi((.2126729*t+.7151522*i+.072175*r)/1);return{l:116*a-16,a:500*(n-a),b:200*(a-Vi((.0193339*t+.119192*i+.9503041*r)/1.08883)),alpha:e.a}}function qi(e){var t=(e.l+16)/116,i=isNaN(e.a)?t:t+e.a/500,r=isNaN(e.b)?t:t-e.b/200;return t=1*ji(t),i=.95047*ji(i),r=1.08883*ji(r),new jt(Ni(3.2404542*i-1.5371385*t-.4985314*r),Ni(-.969266*i+1.8760108*t+.041556*r),Ni(.0556434*i-.2040259*t+1.0572252*r),e.alpha)}function Wi(e,t,i){var r=t-e;return e+i*(r>180||r<-180?r-360*Math.round(r/360):r)}var Xi={forward:Zi,reverse:qi,interpolate:function(e,t,i){return{l:Di(e.l,t.l,i),a:Di(e.a,t.a,i),b:Di(e.b,t.b,i),alpha:Di(e.alpha,t.alpha,i)}}},Hi={forward:function(e){var t=Zi(e),i=t.l,r=t.a,n=t.b,a=Math.atan2(n,r)*Ui;return{h:a<0?a+360:a,c:Math.sqrt(r*r+n*n),l:i,alpha:e.a}},reverse:function(e){var t=e.h*Fi,i=e.c;return qi({l:e.l,a:Math.cos(t)*i,b:Math.sin(t)*i,alpha:e.alpha})},interpolate:function(e,t,i){return{h:Wi(e.h,t.h,i),c:Di(e.c,t.c,i),l:Di(e.l,t.l,i),alpha:Di(e.alpha,t.alpha,i)}}},Yi=Object.freeze({__proto__:null,lab:Xi,hcl:Hi});function Ki(e,t,i,r){var n=r-i,a=e-i;return 0===n?0:1===t?a/n:(Math.pow(t,a)-1)/(Math.pow(t,n)-1)}var Ji=function(){function e(t,i,r,n,o){h(this,e),this.type=t,this.operator=i,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];var s,u=l(o);try{for(u.s();!(s=u.n()).done;){var c=a(s.value,2),f=c[0],d=c[1];this.labels.push(f),this.outputs.push(d)}}catch(p){u.e(p)}finally{u.f()}}return d(e,[{key:"evaluate",value:function(t){var i=this.labels,r=this.outputs;if(1===i.length)return r[0].evaluate(t);var n=this.input.evaluate(t);if(n<=i[0])return r[0].evaluate(t);var a=i.length;if(n>=i[a-1])return r[a-1].evaluate(t);var o=zi(i,n),s=e.interpolationFactor(this.interpolation,n,i[o],i[o+1]),l=r[o].evaluate(t),u=r[o+1].evaluate(t);return"interpolate"===this.operator?Li[this.type.kind.toLowerCase()](l,u,s):"interpolate-hcl"===this.operator?Hi.reverse(Hi.interpolate(Hi.forward(l),Hi.forward(u),s)):Xi.reverse(Xi.interpolate(Xi.forward(l),Xi.forward(u),s))}},{key:"eachChild",value:function(e){e(this.input);var t,i=l(this.outputs);try{for(i.s();!(t=i.n()).done;){e(t.value)}}catch(r){i.e(r)}finally{i.f()}}},{key:"outputDefined",value:function(){return this.outputs.every(function(e){return e.outputDefined()})}},{key:"serialize",value:function(){var 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);for(var t=[this.operator,e,this.input.serialize()],i=0;i<this.labels.length;i++)t.push(this.labels[i],this.outputs[i].serialize());return t}}],[{key:"interpolationFactor",value:function(e,t,i,r){var n=0;if("exponential"===e.name)n=Ki(t,e.base,i,r);else if("linear"===e.name)n=Ki(t,1,i,r);else if("cubic-bezier"===e.name){var a=e.controlPoints;n=new C(a[0],a[1],a[2],a[3]).solve(Ki(t,1,i,r))}return n}},{key:"parse",value:function(t,i){var r,a=s(r=t)||n(r)||u(r)||o(),l=a[0],c=a[1],h=a[2],f=a.slice(3);if(!Array.isArray(c)||0===c.length)return i.error("Expected an interpolation type expression.",1);if("linear"===c[0])c={name:"linear"};else if("exponential"===c[0]){var d=c[1];if("number"!=typeof d)return i.error("Exponential interpolation requires a numeric base.",1,1);c={name:"exponential",base:d}}else{if("cubic-bezier"!==c[0])return i.error("Unknown interpolation type ".concat(String(c[0])),1,0);var p=c.slice(1);if(4!==p.length||p.some(function(e){return"number"!=typeof e||e<0||e>1}))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);c={name:"cubic-bezier",controlPoints:p}}if(t.length-1<4)return i.error("Expected at least 4 arguments, but found only ".concat(t.length-1,"."));if((t.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(!(h=i.parse(h,2,gt)))return null;var m=[],v=null;"interpolate-hcl"===l||"interpolate-lab"===l?v=wt:i.expectedType&&"value"!==i.expectedType.kind&&(v=i.expectedType);for(var y=0;y<f.length;y+=2){var _=f[y],g=f[y+1],x=y+3,b=y+4;if("number"!=typeof _)return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not c
1omputed expressions) for the input values.',x);if(m.length&&m[m.length-1][0]>=_)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',x);var w=i.parse(g,b,v);if(!w)return null;v=v||w.type,m.push([_,w])}return"number"===v.kind||"color"===v.kind||"array"===v.kind&&"number"===v.itemType.kind&&"number"==typeof v.N?new e(v,l,c,h,m):i.error("Type ".concat(Ct(v)," is not interpolatable."))}}]),e}(),$i=function(){function e(t,i){h(this,e),this.type=t,this.args=i}return d(e,[{key:"evaluate",value:function(e){var t,i,r=null,n=0,a=l(this.args);try{for(a.s();!(i=a.n()).done;){var o=i.value;if(n++,(r=o.evaluate(e))&&r instanceof qt&&!r.available&&(t||(t=r),r=null,n===this.args.length))return t;if(null!==r)break}}catch(s){a.e(s)}finally{a.f()}return r}},{key:"eachChild",value:function(e){this.args.forEach(e)}},{key:"outputDefined",value:function(){return this.args.every(function(e){return e.outputDefined()})}},{key:"serialize",value:function(){var e=["coalesce"];return this.eachChild(function(t){e.push(t.serialize())}),e}}],[{key:"parse",value:function(t,i){if(t.length<2)return i.error("Expectected at least one argument.");var r=null,n=i.expectedType;n&&"value"!==n.kind&&(r=n);var a,o=[],s=l(t.slice(1));try{for(s.s();!(a=s.n()).done;){var u=a.value,c=i.parse(u,1+o.length,r,void 0,{typeAnnotation:"omit"});if(!c)return null;r=r||c.type,o.push(c)}}catch(h){s.e(h)}finally{s.f()}return new e(n&&o.some(function(e){return zt(n,e.type)})?Tt:r,o)}}]),e}(),Qi=function(){function e(t,i){h(this,e),this.type=i.type,this.bindings=[].concat(t),this.result=i}return d(e,[{key:"evaluate",value:function(e){return this.result.evaluate(e)}},{key:"eachChild",value:function(e){var t,i=l(this.bindings);try{for(i.s();!(t=i.n()).done;){e(t.value[1])}}catch(r){i.e(r)}finally{i.f()}e(this.result)}},{key:"outputDefined",value:function(){return this.result.outputDefined()}},{key:"serialize",value:function(){var e,t=["let"],i=l(this.bindings);try{for(i.s();!(e=i.n()).done;){var r=a(e.value,2),n=r[0],o=r[1];t.push(n,o.serialize())}}catch(s){i.e(s)}finally{i.f()}return t.push(this.result.serialize()),t}}],[{key:"parse",value:function(t,i){if(t.length<4)return i.error("Expected at least 3 arguments, but found ".concat(t.length-1," instead."));for(var r=[],n=1;n<t.length-1;n+=2){var a=t[n];if("string"!=typeof a)return i.error("Expected string, but found ".concat(typeof a," instead."),n);if(/[^a-zA-Z0-9_]/.test(a))return i.error("Variable names must contain only alphanumeric characters or '_'.",n);var o=i.parse(t[n+1],n+1);if(!o)return null;r.push([a,o])}var s=i.parse(t[t.length-1],t.length-1,i.expectedType,r);return s?new e(r,s):null}}]),e}(),er=function(){function e(t,i,r){h(this,e),this.type=t,this.index=i,this.input=r}return d(e,[{key:"evaluate",value:function(e){var t=this.index.evaluate(e),i=this.input.evaluate(e);if(t<0)throw new Jt("Array index out of bounds: ".concat(t," < 0."));if(t>=i.length)throw new Jt("Array index out of bounds: ".concat(t," > ").concat(i.length-1,"."));if(t!==Math.floor(t))throw new Jt("Array index must be an integer, but found ".concat(t," instead."));return i[t]}},{key:"eachChild",value:function(e){e(this.index),e(this.input)}},{key:"outputDefined",value:function(){return!1}},{key:"serialize",value:function(){return["at",this.index.serialize(),this.input.serialize()]}}],[{key:"parse",value:function(t,i){if(3!==t.length)return i.error("Expected 2 arguments, but found ".concat(t.length-1," instead."));var r=i.parse(t[1],1,gt),n=i.parse(t[2],2,It(i.expectedType||Tt));return r&&n?new e(n.type.itemType,r,n):null}}]),e}(),tr=function(){function e(t,i){h(this,e),this.type=bt,this.needle=t,this.haystack=i}return d(e,[{key:"evaluate",value:function(e){var t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(null==i)return!1;if(!Dt(t,["boolean","string","number","null"]))throw new Jt("Expected first argument to be of type boolean, string, number or null, but found ".concat(Ct(Ht(t))," instead."));if(!Dt(i,["string","array"]))throw new Jt("Expected second argument to be of type array or string, but found ".concat(Ct(Ht(i))," instead."));return i.indexOf(t)>=0}},{key:"eachChild",value:function(e){e(this.needle),e(this.haystack)}},{key:"outputDefined",value:function(){return!0}},{key:"serialize",value:function(){return["in",this.needle.serialize(),this.haystack.serialize()]}}],[{key:"parse",value:function(t,i){if(3!==t.length)return i.error("Expected 2 arguments, but found ".concat(t.length-1," instead."));var r=i.parse(t[1],1,Tt),n=i.parse(t[2],2,Tt);return r&&n?Pt(r.type,[bt,xt,gt,_t,Tt])?new e(r,n):i.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(Ct(r.type)," instead")):null}}]),e}(),ir=function(){function e(t,i,r){h(this,e),this.type=gt,this.needle=t,this.haystack=i,this.fromIndex=r}return d(e,[{key:"evaluate",value:function(e){var t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!Dt(t,["boolean","string","number","null"]))throw new Jt("Expected first argument to be of type boolean, string, number or null, but found ".concat(Ct(Ht(t))," instead."));if(!Dt(i,["string","array"]))throw new Jt("Expected second argument to be of type array or string, but found ".concat(Ct(Ht(i))," instead."));if(this.fromIndex){var r=this.fromIndex.evaluate(e);return i.indexOf(t,r)}return i.indexOf(t)}},{key:"eachChild",value:function(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}},{key:"outputDefined",value:function(){return!1}},{key:"serialize",value:function(){if(null!=this.fromIndex&&void 0!==this.fromIndex){var e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}],[{key:"parse",value:function(t,i){if(t.length<=2||t.length>=5)return i.error("Expected 3 or 4 arguments, but found ".concat(t.length-1," instead."));var r=i.parse(t[1],1,Tt),n=i.parse(t[2],2,Tt);if(!r||!n)return null;if(!Pt(r.type,[bt,xt,gt,_t,Tt]))return i.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(Ct(r.type)," instead"));if(4===t.length){var a=i.parse(t[3],3,gt);return a?new e(r,n,a):null}return new e(r,n)}}]),e}(),rr=function(){function e(t,i,r,n,a,o){h(this,e),this.inputType=t,this.type=i,this.input=r,this.cases=n,this.outputs=a,this.otherwise=o}return d(e,[{key:"evaluate",value:function(e){var t=this.input.evaluate(e);return(Ht(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}},{key:"eachChild",value:function(e){e(this.input),this.outputs.forEac
1h(e),e(this.otherwise)}},{key:"outputDefined",value:function(){return this.outputs.every(function(e){return e.outputDefined()})&&this.otherwise.outputDefined()}},{key:"serialize",value:function(){var e,t=this,i=["match",this.input.serialize()],r=[],n={},o=l(Object.keys(this.cases).sort());try{for(o.s();!(e=o.n()).done;){var s=e.value,u=n[this.cases[s]];void 0===u?(n[this.cases[s]]=r.length,r.push([this.cases[s],[s]])):r[u][1].push(s)}}catch(v){o.e(v)}finally{o.f()}for(var c=function(e){return"number"===t.inputType.kind?Number(e):e},h=0,f=r;h<f.length;h++){var d=a(f[h],2),p=d[0],m=d[1];i.push(1===m.length?c(m[0]):m.map(c)),i.push(this.outputs[p].serialize())}return i.push(this.otherwise.serialize()),i}}],[{key:"parse",value:function(t,i){if(t.length<5)return i.error("Expected at least 4 arguments, but found only ".concat(t.length-1,"."));if(t.length%2!=1)return i.error("Expected an even number of arguments.");var r,n;i.expectedType&&"value"!==i.expectedType.kind&&(n=i.expectedType);for(var a={},o=[],s=2;s<t.length-1;s+=2){var u=t[s],c=t[s+1];Array.isArray(u)||(u=[u]);var h=i.concat(s);if(0===u.length)return h.error("Expected at least one branch label.");var f,d=l(u);try{for(d.s();!(f=d.n()).done;){var p=f.value;if("number"!=typeof p&&"string"!=typeof p)return h.error("Branch labels must be numbers or strings.");if("number"==typeof p&&Math.abs(p)>Number.MAX_SAFE_INTEGER)return h.error("Branch labels must be integers no larger than ".concat(Number.MAX_SAFE_INTEGER,"."));if("number"==typeof p&&Math.floor(p)!==p)return h.error("Numeric branch labels must be integer values.");if(r){if(h.checkSubtype(r,Ht(p)))return null}else r=Ht(p);if(void 0!==a[String(p)])return h.error("Branch labels must be unique.");a[String(p)]=o.length}}catch(_){d.e(_)}finally{d.f()}var m=i.parse(c,s,n);if(!m)return null;n=n||m.type,o.push(m)}var v=i.parse(t[1],1,Tt);if(!v)return null;var y=i.parse(t[t.length-1],t.length-1,n);return y?"value"!==v.type.kind&&i.concat(1).checkSubtype(r,v.type)?null:new e(r,n,v,a,o,y):null}}]),e}(),nr=function(){function e(t,i,r){h(this,e),this.type=t,this.branches=i,this.otherwise=r}return d(e,[{key:"evaluate",value:function(e){var t,i=l(this.branches);try{for(i.s();!(t=i.n()).done;){var r=a(t.value,2),n=r[0],o=r[1];if(n.evaluate(e))return o.evaluate(e)}}catch(s){i.e(s)}finally{i.f()}return this.otherwise.evaluate(e)}},{key:"eachChild",value:function(e){var t,i=l(this.branches);try{for(i.s();!(t=i.n()).done;){var r=a(t.value,2),n=r[0],o=r[1];e(n),e(o)}}catch(s){i.e(s)}finally{i.f()}e(this.otherwise)}},{key:"outputDefined",value:function(){return this.branches.every(function(e){var t=a(e,2);t[0];return t[1].outputDefined()})&&this.otherwise.outputDefined()}},{key:"serialize",value:function(){var e=["case"];return this.eachChild(function(t){e.push(t.serialize())}),e}}],[{key:"parse",value:function(t,i){if(t.length<4)return i.error("Expected at least 3 arguments, but found only ".concat(t.length-1,"."));if(t.length%2!=0)return i.error("Expected an odd number of arguments.");var r;i.expectedType&&"value"!==i.expectedType.kind&&(r=i.expectedType);for(var n=[],a=1;a<t.length-1;a+=2){var o=i.parse(t[a],a,bt);if(!o)return null;var s=i.parse(t[a+1],a+1,r);if(!s)return null;n.push([o,s]),r=r||s.type}var l=i.parse(t[t.length-1],t.length-1,r);return l?new e(r,n,l):null}}]),e}(),ar=function(){function e(t,i,r,n){h(this,e),this.type=t,this.input=i,this.beginIndex=r,this.endIndex=n}return d(e,[{key:"evaluate",value:function(e){var t=this.input.evaluate(e),i=this.beginIndex.evaluate(e);if(!Dt(t,["string","array"]))throw new Jt("Expected first argument to be of type array or string, but found ".concat(Ct(Ht(t))," instead."));if(this.endIndex){var r=this.endIndex.evaluate(e);return t.slice(i,r)}return t.slice(i)}},{key:"eachChild",value:function(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}},{key:"outputDefined",value:function(){return!1}},{key:"serialize",value:function(){if(null!=this.endIndex&&void 0!==this.endIndex){var e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}],[{key:"parse",value:function(t,i){if(t.length<=2||t.length>=5)return i.error("Expected 3 or 4 arguments, but found ".concat(t.length-1," instead."));var r=i.parse(t[1],1,Tt),n=i.parse(t[2],2,gt);if(!r||!n)return null;if(!Pt(r.type,[It(Tt),xt,Tt]))return i.error("Expected first argument to be of type array or string, but found ".concat(Ct(r.type)," instead"));if(4===t.length){var a=i.parse(t[3],3,gt);return a?new e(r.type,r,n,a):null}return new e(r.type,r,n)}}]),e}();function or(e,t){return"=="===e||"!="===e?"boolean"===t.kind||"string"===t.kind||"number"===t.kind||"null"===t.kind||"value"===t.kind:"string"===t.kind||"number"===t.kind||"value"===t.kind}function sr(e,t,i,r){return 0===r.compare(t,i)}function lr(e,t,i){var r="=="!==e&&"!="!==e;return function(){function n(e,t,i){h(this,n),this.type=bt,this.lhs=e,this.rhs=t,this.collator=i,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}return d(n,[{key:"evaluate",value:function(n){var a=this.lhs.evaluate(n),o=this.rhs.evaluate(n);if(r&&this.hasUntypedArgument){var s=Ht(a),l=Ht(o);if(s.kind!==l.kind||"string"!==s.kind&&"number"!==s.kind)throw new Jt('Expected arguments for "'.concat(e,'" to be (string, string) or (number, number), but found (').concat(s.kind,", ").concat(l.kind,") instead."))}if(this.collator&&!r&&this.hasUntypedArgument){var u=Ht(a),c=Ht(o);if("string"!==u.kind||"string"!==c.kind)return t(n,a,o)}return this.collator?i(n,a,o,this.collator.evaluate(n)):t(n,a,o)}},{key:"eachChild",value:function(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}},{key:"outputDefined",value:function(){return!0}},{key:"serialize",value:function(){var t=[e];return this.eachChild(function(e){t.push(e.serialize())}),t}}],[{key:"parse",value:function(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");var i=e[0],a=t.parse(e[1],1,Tt);if(!a)return null;if(!or(i,a.type))return t.concat(1).error('"'.concat(i,"\" comparisons are not supported for type '").concat(Ct(a.type),"'."));var o=t.parse(e[2],2,Tt);if(!o)return null;if(!or(i,o.type))return t.concat(2).error('"'.concat(i,"\" comparisons are not supported for type '").concat(Ct(o.type),"'."));if(a.type.kind!==o.type.kind&&"value"!==a.type.kind&&"value"!==o.type.kind)return t.error("Cannot compare types '".concat(Ct(a.type),"' and '").concat(Ct(o.type),"'."));r&&("value"===a.type.kind&&"value"!==o.type.kind?a=new Qt(o.type,[a]):"value"!==a.type.kind&&"value"===o.type.kind&&(o=new Qt(a.type,[o])));var s=null;if(4===e.length){if("string"!==a.type.kind&&"string"!==o.type.kind&&"value"!==a.type.kind&&"value"!==o.type.kind)return t.error("Cannot use collator to compare non-string types.");if(!(s=t.parse(e[3],3,Et)))return null}return new n(a,o,s)}}]),n}()}var ur=lr("==",function(e,t,i){return t===i},sr),cr=lr("!=",function(e,t,i){return t!==i},function(e,t,i,r){return!sr(0,t,i,r)}),hr=lr("<",function(e,t,i){return t<i},function(e,t,i,r){return r.compare(t,i)<0}),fr=lr(">",function(e,t,i){return t>i},function(e,t,i,r){return r.compare(t,i)>0}
1),dr=lr("<=",function(e,t,i){return t<=i},function(e,t,i,r){return r.compare(t,i)<=0}),pr=lr(">=",function(e,t,i){return t>=i},function(e,t,i,r){return r.compare(t,i)>=0}),mr=function(){function e(t,i,r,n,a,o){h(this,e),this.type=xt,this.number=t,this.locale=i,this.currency=r,this.unit=n,this.minFractionDigits=a,this.maxFractionDigits=o}return d(e,[{key:"evaluate",value:function(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))}},{key:"eachChild",value:function(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)}},{key:"outputDefined",value:function(){return!1}},{key:"serialize",value:function(){var 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]}}],[{key:"parse",value:function(t,i){if(3!==t.length)return i.error("Expected two arguments.");var r=i.parse(t[1],1,gt);if(!r)return null;var n=t[2];if("object"!=typeof n||Array.isArray(n))return i.error("NumberFormat options argument must be an object.");var a=null;if(n.locale&&!(a=i.parse(n.locale,1,xt)))return null;var o=null;if(n.currency&&!(o=i.parse(n.currency,1,xt)))return null;var s=null;if(n.unit&&!(s=i.parse(n.unit,1,xt)))return null;var l=null;if(n["min-fraction-digits"]&&!(l=i.parse(n["min-fraction-digits"],1,gt)))return null;var u=null;return n["max-fraction-digits"]&&!(u=i.parse(n["max-fraction-digits"],1,gt))?null:new e(r,a,o,s,l,u)}}]),e}(),vr={"==":ur,"!=":cr,">":fr,"<":hr,">=":pr,"<=":dr,array:Qt,at:er,boolean:Qt,case:nr,coalesce:$i,collator:si,format:ei,image:ti,in:tr,"index-of":ir,interpolate:Ji,"interpolate-hcl":Ji,"interpolate-lab":Ji,length:function(){function e(t){h(this,e),this.type=gt,this.input=t}return d(e,[{key:"evaluate",value:function(e){var t=this.input.evaluate(e);if("string"==typeof t||Array.isArray(t))return t.length;throw new Jt("Expected value to be of type string or array, but found ".concat(Ct(Ht(t))," instead."))}},{key:"eachChild",value:function(e){e(this.input)}},{key:"outputDefined",value:function(){return!1}},{key:"serialize",value:function(){var e=["length"];return this.eachChild(function(t){e.push(t.serialize())}),e}}],[{key:"parse",value:function(t,i){if(2!==t.length)return i.error("Expected 1 argument, but found ".concat(t.length-1," instead."));var r=i.parse(t[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 ".concat(Ct(r.type)," instead.")):new e(r):null}}]),e}(),let:Qi,literal:Kt,match:rr,number:Qt,"number-format":mr,object:Qt,slice:ar,step:Pi,string:Qt,"to-boolean":ri,"to-color":ri,"to-number":ri,"to-string":ri,var:Ii,within:Ti};function yr(e,t){var i=a(t,4),r=i[0],n=i[1],o=i[2],s=i[3];r=r.evaluate(e),n=n.evaluate(e),o=o.evaluate(e);var l=s?s.evaluate(e):1,u=Wt(r,n,o,l);if(u)throw new Jt(u);return new jt(r/255*l,n/255*l,o/255*l,l)}function _r(e,t){return e in t}function gr(e,t){var i=t[e];return void 0===i?null:i}function xr(e){return{type:e}}oi.register(vr,{error:[{kind:"error"},[xt],function(e,t){var i=a(t,1)[0];throw new Jt(i.evaluate(e))}],typeof:[xt,[Tt],function(e,t){return Ct(Ht(a(t,1)[0].evaluate(e)))}],"to-rgba":[It(gt,4),[wt],function(e,t){return a(t,1)[0].evaluate(e).toArray()}],rgb:[wt,[gt,gt,gt],yr],rgba:[wt,[gt,gt,gt,gt],yr],has:{type:bt,overloads:[[[xt],function(e,t){return _r(a(t,1)[0].evaluate(e),e.properties())}],[[xt,kt],function(e,t){var i=a(t,2),r=i[0],n=i[1];return _r(r.evaluate(e),n.evaluate(e))}]]},get:{type:Tt,overloads:[[[xt],function(e,t){return gr(a(t,1)[0].evaluate(e),e.properties())}],[[xt,kt],function(e,t){var i=a(t,2),r=i[0],n=i[1];return gr(r.evaluate(e),n.evaluate(e))}]]},"feature-state":[Tt,[xt],function(e,t){return gr(a(t,1)[0].evaluate(e),e.featureState||{})}],properties:[kt,[],function(e){return e.properties()}],"geometry-type":[xt,[],function(e){return e.geometryType()}],id:[Tt,[],function(e){return e.id()}],zoom:[gt,[],function(e){return e.globals.zoom}],pitch:[gt,[],function(e){return e.globals.pitch||0}],"distance-from-center":[gt,[],function(e){return e.distanceFromCenter()}],"heatmap-density":[gt,[],function(e){return e.globals.heatmapDensity||0}],"line-progress":[gt,[],function(e){return e.globals.lineProgress||0}],"sky-radial-progress":[gt,[],function(e){return e.globals.skyRadialProgress||0}],accumulated:[Tt,[],function(e){return void 0===e.globals.accumulated?null:e.globals.accumulated}],"+":[gt,xr(gt),function(e,t){var i,r=0,n=l(t);try{for(n.s();!(i=n.n()).done;){r+=i.value.evaluate(e)}}catch(a){n.e(a)}finally{n.f()}return r}],"*":[gt,xr(gt),function(e,t){var i,r=1,n=l(t);try{for(n.s();!(i=n.n()).done;){r*=i.value.evaluate(e)}}catch(a){n.e(a)}finally{n.f()}return r}],"-":{type:gt,overloads:[[[gt,gt],function(e,t){var i=a(t,2),r=i[0],n=i[1];return r.evaluate(e)-n.evaluate(e)}],[[gt],function(e,t){return-a(t,1)[0].evaluate(e)}]]},"/":[gt,[gt,gt],function(e,t){var i=a(t,2),r=i[0],n=i[1];return r.evaluate(e)/n.evaluate(e)}],"%":[gt,[gt,gt],function(e,t){var i=a(t,2),r=i[0],n=i[1];return r.evaluate(e)%n.evaluate(e)}],ln2:[gt,[],function(){return Math.LN2}],pi:[gt,[],function(){return Math.PI}],e:[gt,[],function(){return Math.E}],"^":[gt,[gt,gt],function(e,t){var i=a(t,2),r=i[0],n=i[1];return Math.pow(r.evaluate(e),n.evaluate(e))}],sqrt:[gt,[gt],function(e,t){var i=a(t,1)[0];return Math.sqrt(i.evaluate(e))}],log10:[gt,[gt],function(e,t){var i=a(t,1)[0];return Math.log(i.evaluate(e))/Math.LN10}],ln:[gt,[gt],function(e,t){var i=a(t,1)[0];return Math.log(i.evaluate(e))}],log2:[gt,[gt],function(e,t){var i=a(t,1)[0];return Math.log(i.evaluate(e))/Math.LN2}],sin:[gt,[gt],function(e,t){var i=a(t,1)[0];return Math.sin(i.evaluate(e))}],cos:[gt,[gt],function(e,t){var i=a(t,1)[0];return Math.cos(i.evaluate(e))}],tan:[gt,[gt],function(e,t){var i=a(t,1)[0];return Math.tan(i.evaluate(e))}],asin:[gt,[gt],function(e,t){var i=a(t,1)[0];return Math.asin(i.evaluate(e))}],acos:[gt,[gt],function(e,t){var i=a(t,1)[0];return Math.acos(i.evaluate(e))}],atan:[gt,[gt],function(e,t){var i=a(t,1)[0];return Math.atan(i.evaluate(e))}],min:[gt,xr(gt),function(e,t){return Math.min.apply(Math,r(t.map(function(t){return t.evaluate(e)})))}],max:[gt,xr(gt),function(e,t){return Math.max.apply(Math,r(t.map(function(t){return t.evaluate(e)})))}],abs:[gt,[gt],function(e,t){var i=a(t,1)[0];return Math.abs(i.evaluate(e))}],round:[gt,[gt],function(e,t){var i=a(t,1)[0].evaluate(e);return i<0?-Math.round(-i):Math.round(i)}],floor:[gt,[gt],function(e,t){var i=a(t,1)[0];return Math.floor(i.evaluate(e))}],ceil:[gt,[gt],function(e,t){var i=a(t,1)[0];return Math.ceil(i.evaluate(e))}],"filter-==":[bt,[xt,Tt],function(e,t){var i=a(t,2),r=i[0],n=i[1];return e.properties()[r.value]===n.value}],"filter-id-==":[bt,[Tt],function(e,t){var i=a(t,1)[0];return e.id()===i.value}],"filter-type-==":[bt,[xt],function(e,t){var i=a(t,1)[0];return e.geometryType()===i.value}],"filter-<":[bt,[xt,Tt],function(e,t){var i=a(t,2),r=i[0],n=i[1],o=e.properties()[r.value],s=n.value;return typeof o==typeof s&&o<s}],"filter-id-<":[bt,[Tt],function(e,t){var i=a(t,1)[0],r=e.id(),n=i.value;return typeof r==typeof n&&r<n}],"filter->":[bt,[xt,Tt],function(e,t){var i=a(t,2),r=i[0],n=i[1],o=e.properties()[r.value],s=n.value;return typeof o==typeof s&&o>s}],"filter-id->":[bt,[Tt],function(e,t){var i=a(t,1)[0],r=e.id(),n=i.value;return typeof r==typeof n&&r>n}],"filter-<=":[bt,[xt,Tt],function(e,t){var i=a(t,2),r=i[0],n=i[1],o=e.properties()[r.value],s=n.value;return typeof o==typeof s&&o<=s}],"filter-id-<=":[bt,[Tt],function(e,t){var i=a(t,1)[0],r=e.id(),n=i.value;return typeof r==typeof n&&r<=n}],"filter->=":[bt,[xt,Tt],function(e,t){var i=a(t,2),r=i[0],n=i[1],o=e.properties()[r.value],s=n.value;return typeof o==typeof s&&o>=s}],"filter-id->=":[bt,[Tt],function(e,t){var i=a(t,1)[0],r=e.id(),n=i.value;return typeof r==typeof n&&r>=n}],"filter-has":[bt,[Tt],function(e,t){return a(t,1)[0].value in e.properties()}],"filter-has-id":[bt,[],function(e){return null!==e.id()&&void 0!==e.id()}],"filter-type-in":[bt,[It(xt)],function(e,t){return a(t,1)[0].value.indexOf(e.geometryType())>=0}],"filter-id-in":[bt,[It(Tt)],function(e,t){return a(t,1)[0].value.indexOf(e.id())>=0}],"filter-in-small":[bt,[xt,It(Tt)],function(e,t){var i=a(t,2),r=i[0];return i[1].value.indexOf(e.properties()[r.value])>=0}],"filter-in-large":[bt,[xt,It(Tt)],function(e,t){var i=a(t,2),r=i[0],n=i[1];return function(e,t,i,r){for(;i<=r;){var n=i+r>>1;if(t[n]===e)return!0;t[n]>e?r=n-1:i=n+1}return!1}(e.properties()[r.value],n.value,0,n.value.length-1)}],all:{type:bt,overloads:[[[bt,bt],function(e,t){var i=a(t,2),r=i[0],n=i[1];return r.evaluate(e)&&n.evaluate(e)}],[xr(bt),function(e,t){var i,r=l(t);try{for(r.s();!(i=r.n()).done;){if(!i.value.evaluate(e))return!1}}catch(n){r.e(n)}finally{r.f()}return!0}]]},any:{type:bt,overloads:[[[bt,bt],function(e,t){var i=a(t,2),r=i[0],n=i[1];return r.evaluate(e)||n.evaluate(e)}],[xr(bt),function(e,t){var i,r=l(t);try{for(r.s();!(i=r.n()).done;){if(i.value.evaluate(e))return!0}}catch(n){r.e(n)}finally{r.f()}return!1}]]},"!":[bt,[bt],function(e,t){return!a(t,1)[0].evaluate(e)}],"is-supported-script":[bt,[xt],function(e,t){var i=a(t,1)[0],r=e.globals&&e.globals.isSupportedScript;return!r||r(i.evaluate(e))}],upcase:[xt,[xt],function(e,t){return a(t,1)[0].evaluate(e).toUpperCase()}],downcase:[xt,[xt],function(e,t){return a(t,1)[0].evaluate(e).toLowerCase()}],concat:[xt,xr(Tt),function(e,t){return t.map(function(t){return Yt(t.evaluate(e))}).join("")}],"resolved-locale":[xt,[Et],function(e,t){return a(t,1)[0].evaluate(e).resolvedLocale()}]});var br=vr;function wr(e){return{result:"success",value:e}}function kr(e){return{result:"error",value:e}}function Tr(e){return"data-driven"===e["property-type"]}function Er(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function Mr(e){return!!e.expression&&e.expression.interpolated}function Sr(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}function Ir(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function Cr(e){return e}function Ar(e,t){var i,r,n,a="color"===t.type,o=e.stops&&"object"==typeof e.stops[0][0],s=o||!(o||void 0!==e.property),u=e.type||(Mr(t)?"exponential":"interval");
1if(a&&((e=dt({},e)).stops&&(e.stops=e.stops.map(function(e){return[e[0],jt.parse(e[1])]})),e.default=jt.parse(e.default?e.default:t.default)),e.colorSpace&&"rgb"!==e.colorSpace&&!Yi[e.colorSpace])throw new Error("Unknown color space: ".concat(e.colorSpace));if("exponential"===u)i=Lr;else if("interval"===u)i=Dr;else if("categorical"===u){i=Pr,r=Object.create(null);var c,h=l(e.stops);try{for(h.s();!(c=h.n()).done;){var f=c.value;r[f[0]]=f[1]}}catch(T){h.e(T)}finally{h.f()}n=typeof e.stops[0][0]}else{if("identity"!==u)throw new Error('Unknown function type "'.concat(u,'"'));i=Rr}if(o){for(var d={},p=[],m=0;m<e.stops.length;m++){var v=e.stops[m],y=v[0].zoom;void 0===d[y]&&(d[y]={zoom:y,type:e.type,property:e.property,default:e.default,stops:[]},p.push(y)),d[y].stops.push([v[0].value,v[1]])}for(var _=[],g=0,x=p;g<x.length;g++){var b=x[g];_.push([d[b].zoom,Ar(d[b],t)])}var w={name:"linear"};return{kind:"composite",interpolationType:w,interpolationFactor:Ji.interpolationFactor.bind(void 0,w),zoomStops:_.map(function(e){return e[0]}),evaluate:function(i,r){var n=i.zoom;return Lr({stops:_,base:e.base},t,n).evaluate(n,r)}}}if(s){var k="exponential"===u?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:k,interpolationFactor:Ji.interpolationFactor.bind(void 0,k),zoomStops:e.stops.map(function(e){return e[0]}),evaluate:function(a){var o=a.zoom;return i(e,t,o,r,n)}}}return{kind:"source",evaluate:function(a,o){var s=o&&o.properties?o.properties[e.property]:void 0;return void 0===s?zr(e.default,t.default):i(e,t,s,r,n)}}}function zr(e,t,i){return void 0!==e?e:void 0!==t?t:void 0!==i?i:void 0}function Pr(e,t,i,r,n){return zr(typeof i===n?r[i]:void 0,e.default,t.default)}function Dr(e,t,i){if("number"!==Sr(i))return zr(e.default,t.default);var r=e.stops.length;if(1===r||i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[r-1][0])return e.stops[r-1][1];var n=zi(e.stops.map(function(e){return e[0]}),i);return e.stops[n][1]}function Lr(e,t,i){var r=void 0!==e.base?e.base:1;if("number"!==Sr(i))return zr(e.default,t.default);var n=e.stops.length;if(1===n||i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[n-1][0])return e.stops[n-1][1];var a=zi(e.stops.map(function(e){return e[0]}),i),o=function(e,t,i,r){var n=r-i,a=e-i;return 0===n?0:1===t?a/n:(Math.pow(t,a)-1)/(Math.pow(t,n)-1)}(i,r,e.stops[a][0],e.stops[a+1][0]),s=e.stops[a][1],l=e.stops[a+1][1],u=Li[t.type]||Cr;if(e.colorSpace&&"rgb"!==e.colorSpace){var c=Yi[e.colorSpace];u=function(e,t){return c.reverse(c.interpolate(c.forward(e),c.forward(t),o))}}return"function"==typeof s.evaluate?{evaluate:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];var r=s.evaluate.apply(void 0,t),n=l.evaluate.apply(void 0,t);if(void 0!==r&&void 0!==n)return u(r,n,o)}}:u(s,l,o)}function Rr(e,t,i){return"color"===t.type?i=jt.parse(i):"formatted"===t.type?i=Zt.fromString(i.toString()):"resolvedImage"===t.type?i=qt.fromString(i.toString()):Sr(i)===t.type||"enum"===t.type&&t.values[i]||(i=void 0),zr(i,e.default,t.default)}var Br=function(){function e(t,i){var r;h(this,e),this.expression=t,this._warningHistory={},this._evaluator=new ai,this._defaultValue=i?"color"===(r=i).type&&(Ir(r.default)||Array.isArray(r.default))?new jt(0,0,0,0):"color"===r.type?jt.parse(r.default)||null:void 0===r.default?null:r.default:null,this._enumValues=i&&"enum"===i.type?i.values:null}return d(e,[{key:"evaluateWithoutErrorHandling",value:function(e,t,i,r,n,a,o,s){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=i,this._evaluator.canonical=r||null,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=a,this._evaluator.featureTileCoord=o||null,this._evaluator.featureDistanceData=s||null,this.expression.evaluate(this._evaluator)}},{key:"evaluate",value:function(e,t,i,r,n,a,o,s){this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=i||null,this._evaluator.canonical=r||null,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=a||null,this._evaluator.featureTileCoord=o||null,this._evaluator.featureDistanceData=s||null;try{var l=this.expression.evaluate(this._evaluator);if(null==l||"number"==typeof l&&l!=l)return this._defaultValue;if(this._enumValues&&!(l in this._enumValues))throw new Jt("Expected value to be one of ".concat(Object.keys(this._enumValues).map(function(e){return JSON.stringify(e)}).join(", "),", but found ").concat(JSON.stringify(l)," instead."));return l}catch(l){return this._warningHistory[l.message]||(this._warningHistory[l.message]=!0,"undefined"!=typeof console&&console.warn(l.message)),this._defaultValue}}}]),e}();function Or(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in br}function Fr(e,t){var i=new Ci(br,[],t?function(e){var t={color:wt,string:xt,number:gt,enum:xt,boolean:bt,formatted:Mt,resolvedImage:St};return"array"===e.type?It(t[e.value]||Tt,e.length):t[e.type]}(t):void 0),r=i.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return r?wr(new Br(r,t)):kr(i.errors)}var Ur=function(){function e(t,i){h(this,e),this.kind=t,this._styleExpression=i,this.isStateDependent="constant"!==t&&!Mi(i.expression)}return d(e,[{key:"evaluateWithoutErrorHandling",value:function(e,t,i,r,n,a){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,a)}},{key:"evaluate",value:function(e,t,i,r,n,a){return this._styleExpression.evaluate(e,t,i,r,n,a)}}]),e}(),Vr=function(){function e(t,i,r,n){h(this,e),this.kind=t,this.zoomStops=r,this._styleExpression=i,this.isStateDependent="camera"!==t&&!Mi(i.expression),this.interpolationType=n}return d(e,[{key:"evaluateWithoutErrorHandling",value:function(e,t,i,r,n,a){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,n,a)}},{key:"evaluate",value:function(e,t,i,r,n,a){return this._styleExpression.evaluate(e,t,i,r,n,a)}},{key:"interpolationFactor",value:function(e,t,i){return this.interpolationType?Ji.interpolationFactor(this.interpolationType,e,t,i):0}}]),e}();function jr(e,t){if("error"===(e=Fr(e,t)).result)return e;var i=e.value.expression,r=Ei(i);if(!r&&!Tr(t))return kr([new vt("","data expressions not supported")]);var n=Si(i,["zoom","pitch","distance-from-center"]);if(!n&&!Er(t))return kr([new vt("","zoom expressions not supported")]);var a=Gr(i);return a||n?a instanceof vt?kr([a]):a instanceof Ji&&!Mr(t)?kr([new vt("",'"interpolate" expressions cannot be used with this property')]):wr(a?new Vr(r?"camera":"composite",e.value,a.labels,a 
1instanceof Ji?a.interpolation:void 0):new Ur(r?"constant":"source",e.value)):kr([new vt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}var Nr=function(){function e(t,i){h(this,e),this._parameters=t,this._specification=i,dt(this,Ar(this._parameters,this._specification))}return d(e,null,[{key:"deserialize",value:function(t){return new e(t._parameters,t._specification)}},{key:"serialize",value:function(e){return{_parameters:e._parameters,_specification:e._specification}}}]),e}();function Gr(e){var t=null;if(e instanceof Qi)t=Gr(e.result);else if(e instanceof $i){var i,r=l(e.args);try{for(r.s();!(i=r.n()).done;){var n=i.value;if(t=Gr(n))break}}catch(a){r.e(a)}finally{r.f()}}else(e instanceof Pi||e instanceof Ji)&&e.input instanceof oi&&"zoom"===e.input.name&&(t=e);return t instanceof vt||e.eachChild(function(e){var i=Gr(e);i instanceof vt?t=i:!t&&i?t=new vt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&i&&t!==i&&(t=new vt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}var Zr=d(function e(t,i,r,n){h(this,e),this.message=(t?"".concat(t,": "):"")+r,n&&(this.identifier=n),null!=i&&i.__line__&&(this.line=i.__line__)});function qr(e){var t=e.key,i=e.value,r=e.valueSpec||{},n=e.objectElementValidators||{},a=e.style,o=e.styleSpec,s=[],l=Sr(i);if("object"!==l)return[new Zr(t,i,"object expected, ".concat(l," found"))];for(var u in i){var c=u.split(".")[0],h=r[c]||r["*"],f=void 0;n[c]?f=n[c]:r[c]?f=Mn:n["*"]?f=n["*"]:r["*"]&&(f=Mn),f?s=s.concat(f({key:(t&&"".concat(t,"."))+u,value:i[u],valueSpec:h,style:a,styleSpec:o,object:i,objectKey:u},i)):s.push(new Zr(t,i[u],'unknown property "'.concat(u,'"')))}for(var d in r)n[d]||r[d].required&&void 0===r[d].default&&void 0===i[d]&&s.push(new Zr(t,i,'missing required property "'.concat(d,'"')));return s}function Wr(e){var t=e.value,i=e.valueSpec,r=e.style,n=e.styleSpec,a=e.key,o=e.arrayElementValidator||Mn;if("array"!==Sr(t))return[new Zr(a,t,"array expected, ".concat(Sr(t)," found"))];if(i.length&&t.length!==i.length)return[new Zr(a,t,"array length ".concat(i.length," expected, length ").concat(t.length," found"))];if(i["min-length"]&&t.length<i["min-length"])return[new Zr(a,t,"array length at least ".concat(i["min-length"]," expected, length ").concat(t.length," found"))];var s={type:i.value,values:i.values,minimum:i.minimum,maximum:i.maximum,function:void 0};n.$version<7&&(s.function=i.function),"object"===Sr(i.value)&&(s=i.value);for(var l=[],u=0;u<t.length;u++)l=l.concat(o({array:t,arrayIndex:u,value:t[u],valueSpec:s,style:r,styleSpec:n,key:"".concat(a,"[").concat(u,"]")}));return l}function Xr(e){var t=e.key,i=e.value,r=e.valueSpec,n=Sr(i);if("number"===n&&i!=i&&(n="NaN"),"number"!==n)return[new Zr(t,i,"number expected, ".concat(n," found"))];if("minimum"in r){var a=r.minimum;if("array"===Sr(r.minimum)&&(a=r.minimum[e.arrayIndex]),i<a)return[new Zr(t,i,"".concat(i," is less than the minimum value ").concat(a))]}if("maximum"in r){var o=r.maximum;if("array"===Sr(r.maximum)&&(o=r.maximum[e.arrayIndex]),i>o)return[new Zr(t,i,"".concat(i," is greater than the maximum value ").concat(o))]}return[]}function Hr(e){var t,i,r,n=e.valueSpec,a=pt(e.value.type),o={},s="categorical"!==a&&void 0===e.value.property,l=!s,u="array"===Sr(e.value.stops)&&"array"===Sr(e.value.stops[0])&&"object"===Sr(e.value.stops[0][0]),c=qr({key:e.key,value:e.value,valueSpec:e.styleSpec.function,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:function(e){if("identity"===a)return[new Zr(e.key,e.value,'identity function may not have a "stops" property')];var t=[],i=e.value;return t=t.concat(Wr({key:e.key,value:i,valueSpec:e.valueSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:h})),"array"===Sr(i)&&0===i.length&&t.push(new Zr(e.key,i,"array must have at least one stop")),t},default:function(e){return Mn({key:e.key,value:e.value,valueSpec:n,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===a&&s&&c.push(new Zr(e.key,e.value,'missing required property "property"')),"identity"===a||e.value.stops||c.push(new Zr(e.key,e.value,'missing required property "stops"')),"exponential"===a&&e.valueSpec.expression&&!Mr(e.valueSpec)&&c.push(new Zr(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!Tr(e.valueSpec)?c.push(new Zr(e.key,e.value,"property functions not supported")):s&&!Er(e.valueSpec)&&c.push(new Zr(e.key,e.value,"zoom functions not supported"))),"categorical"!==a&&!u||void 0!==e.value.property||c.push(new Zr(e.key,e.value,'"property" property is required')),c;function h(e){var t=[],a=e.value,s=e.key;if("array"!==Sr(a))return[new Zr(s,a,"array expected, ".concat(Sr(a)," found"))];if(2!==a.length)return[new Zr(s,a,"array length 2 expected, length ".concat(a.length," found"))];if(u){if("object"!==Sr(a[0]))return[new Zr(s,a,"object expected, ".concat(Sr(a[0])," found"))];if(void 0===a[0].zoom)return[new Zr(s,a,"object stop key must have zoom")];if(void 0===a[0].value)return[new Zr(s,a,"object stop key must have value")];var l=pt(a[0].zoom);if("number"!=typeof l)return[new Zr(s,a[0].zoom,"stop zoom values must be numbers")];if(r&&r>l)return[new Zr(s,a[0].zoom,"stop zoom values must appear in ascending order")];l!==r&&(r=l,i=void 0,o={}),t=t.concat(qr({key:"".concat(s,"[0]"),value:a[0],valueSpec:{zoom:{}},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:Xr,value:f}}))}else t=t.concat(f({key:"".concat(s,"[0]"),value:a[0],valueSpec:{},style:e.style,styleSpec:e.styleSpec},a));
1return Or(mt(a[1]))?t.concat([new Zr("".concat(s,"[1]"),a[1],"expressions are not allowed in function stops.")]):t.concat(Mn({key:"".concat(s,"[1]"),value:a[1],valueSpec:n,style:e.style,styleSpec:e.styleSpec}))}function f(e,r){var s=Sr(e.value),l=pt(e.value),u=null!==e.value?e.value:r;if(t){if(s!==t)return[new Zr(e.key,u,"".concat(s," stop domain type must match previous stop domain type ").concat(t))]}else t=s;if("number"!==s&&"string"!==s&&"boolean"!==s&&"number"!=typeof l&&"string"!=typeof l&&"boolean"!=typeof l)return[new Zr(e.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==a){var c="number expected, ".concat(s," found");return Tr(n)&&void 0===a&&(c+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Zr(e.key,u,c)]}return"categorical"!==a||"number"!==s||"number"==typeof l&&isFinite(l)&&Math.floor(l)===l?"categorical"!==a&&"number"===s&&"number"==typeof l&&"number"==typeof i&&void 0!==i&&l<i?[new Zr(e.key,u,"stop domain values must appear in ascending order")]:(i=l,"categorical"===a&&l in o?[new Zr(e.key,u,"stop domain values must be unique")]:(o[l]=!0,[])):[new Zr(e.key,u,"integer expected, found ".concat(String(l)))]}}function Yr(e){var t=("property"===e.expressionContext?jr:Fr)(mt(e.value),e.valueSpec);if("error"===t.result)return t.value.map(function(t){return new Zr("".concat(e.key).concat(t.key),e.value,t.message)});var i=t.value.expression||t.value._styleExpression.expression;if("property"===e.expressionContext&&"text-font"===e.propertyKey&&!i.outputDefined())return[new Zr(e.key,e.value,'Invalid data expression for "'.concat(e.propertyKey,'". Output values must be contained as literals within the expression.'))];if("property"===e.expressionContext&&"layout"===e.propertyType&&!Mi(i))return[new Zr(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===e.expressionContext)return Kr(i,e);if(e.expressionContext&&0===e.expressionContext.indexOf("cluster")){if(!Si(i,["zoom","feature-state"]))return[new Zr(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===e.expressionContext&&!Ei(i))return[new Zr(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Kr(e,t){var i=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(t.valueSpec&&t.valueSpec.expression){var n,a=l(t.valueSpec.expression.parameters);try{for(a.s();!(n=a.n()).done;){var o=n.value;i.delete(o)}}catch(u){a.e(u)}finally{a.f()}}if(0===i.size)return[];var s=[];return e instanceof oi&&i.has(e.name)?[new Zr(t.key,t.value,'["'.concat(e.name,'"] expression is not supported in a filter for a ').concat(t.object.type," layer with id: ").concat(t.object.id))]:(e.eachChild(function(e){s.push.apply(s,r(Kr(e,t)))}),s)}function Jr(e){var t=e.key,i=e.value,r=e.valueSpec,n=[];return Array.isArray(r.values)?-1===r.values.indexOf(pt(i))&&n.push(new Zr(t,i,"expected one of [".concat(r.values.join(", "),"], ").concat(JSON.stringify(i)," found"))):-1===Object.keys(r.values).indexOf(pt(i))&&n.push(new Zr(t,i,"expected one of [".concat(Object.keys(r.values).join(", "),"], ").concat(JSON.stringify(i)," found"))),n}function $r(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":var t,i=l(e.slice(1));try{for(i.s();!(t=i.n()).done;){var r=t.value;if(!$r(r)&&"boolean"!=typeof r)return!1}}catch(n){i.e(n)}finally{i.f()}return!0;default:return!0}}function Qr(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"fill";if(null==e)return{filter:function(){return!0},needGeometry:!1,needFeature:!1};$r(e)||(e=sn(e));var i=e,r=!0;try{r=function(e){if(!rn(e))return e;var t=mt(e);return tn(t),t=en(t)}(i)}catch(u){console.warn("Failed to extract static filter. Filter will c
1ontinue working, but at higher memory usage and slower framerate.\nThis is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md\nand paste the contents of this message in the report.\nThank you!\nFilter Expression:\n".concat(JSON.stringify(i,null,2),"\n        "))}var n=ft["filter_".concat(t)],a=Fr(r,n),o=null;if("error"===a.result)throw new Error(a.value.map(function(e){return"".concat(e.key,": ").concat(e.message)}).join(", "));o=function(e,t,i){return a.value.evaluate(e,t,{},i)};var s=null,l=null;if(r!==i){var u=Fr(i,n);if("error"===u.result)throw new Error(u.value.map(function(e){return"".concat(e.key,": ").concat(e.message)}).join(", "));s=function(e,t,i,r,n){return u.value.evaluate(e,t,{},i,void 0,void 0,r,n)},l=!Ei(u.value.expression)}return{filter:o,dynamicFilter:s||void 0,needGeometry:on(r),needFeature:!!l}}function en(e){if(!Array.isArray(e))return e;var t=function(e){if(nn.has(e[0]))for(var t=1;t<e.length;t++)if(rn(e[t]))return!0;return e}(e);return!0===t?t:t.map(function(e){return en(e)})}function tn(e){var t=!1,i=[];if("case"===e[0]){for(var r=1;r<e.length-1;r+=2)t=t||rn(e[r]),i.push(e[r+1]);i.push(e[e.length-1])}else if("match"===e[0]){t=t||rn(e[1]);for(var n=2;n<e.length-1;n+=2)i.push(e[n+1]);i.push(e[e.length-1])}else if("step"===e[0]){t=t||rn(e[1]);for(var a=1;a<e.length-1;a+=2)i.push(e[a+1])}t&&(e.length=0,e.push.apply(e,["any"].concat(i)));for(var o=1;o<e.length;o++)tn(e[o])}function rn(e){if(!Array.isArray(e))return!1;if("pitch"===(t=e[0])||"distance-from-center"===t)return!0;for(var t,i=1;i<e.length;i++)if(rn(e[i]))return!0;return!1}var nn=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function an(e,t){return e<t?-1:e>t?1:0}function on(e){if(!Array.isArray(e))return!1;if("within"===e[0])return!0;for(var t=1;t<e.length;t++)if(on(e[t]))return!0;return!1}function sn(e){if(!e)return!0;var t,i=e[0];return e.length<=1?"any"!==i:"=="===i?ln(e[1],e[2],"=="):"!="===i?hn(ln(e[1],e[2],"==")):"<"===i||">"===i||"<="===i||">="===i?ln(e[1],e[2],i):"any"===i?(t=e.slice(1),["any"].concat(t.map(sn))):"all"===i?["all"].concat(e.slice(1).map(sn)):"none"===i?["all"].concat(e.slice(1).map(sn).map(hn)):"in"===i?un(e[1],e.slice(2)):"!in"===i?hn(un(e[1],e.slice(2))):"has"===i?cn(e[1]):"!has"===i?hn(cn(e[1])):"within"!==i||e}function ln(e,t,i){switch(e){case"$type":return["filter-type-".concat(i),t];case"$id":return["filter-id-".concat(i),t];default:return["filter-".concat(i),e,t]}}function un(e,t){if(0===t.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(function(e){return typeof e!=typeof t[0]})?["filter-in-large",e,["literal",t.sort(an)]]:["filter-in-small",e,["literal",t]]}}function cn(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function hn(e){return["!",e]}function fn(e){return $r(mt(e.value))?Yr(dt({},e,{expressionContext:"filter",valueSpec:e.styleSpec["filter_".concat(e.layerType||"fill")]})):dn(e)}function dn(e){var t=e.value,i=e.key;if("array"!==Sr(t))return[new Zr(i,t,"array expected, ".concat(Sr(t)," found"))];var r,n=e.styleSpec,a=[];if(t.length<1)return[new Zr(i,t,"filter array must have at least 1 element")];switch(a=a.concat(Jr({key:"".concat(i,"[0]"),value:t[0],valueSpec:n.filter_operator,style:e.style,styleSpec:e.styleSpec})),pt(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&"$type"===pt(t[1])&&a.push(new Zr(i,t,'"$type" cannot be use with operator "'.concat(t[0],'"')));case"==":case"!=":3!==t.length&&a.push(new Zr(i,t,'filter array for operator "'.concat(t[0],'" must have 3 elements')));case"in":case"!in":t.length>=2&&("string"!==(r=Sr(t[1]))&&a.push(new Zr("".concat(i,"[1]"),t[1],"string expected, ".concat(r," found"))));for(var o=2;o<t.length;o++)r=Sr(t[o]),"$type"===pt(t[1])?a=a.concat(Jr({key:"".concat(i,"[").concat(o,"]"),value:t[o],valueSpec:n.geometry_type,style:e.style,styleSpec:e.styleSpec})):"string"!==r&&"number"!==r&&"boolean"!==r&&a.push(new Zr("".concat(i,"[").concat(o,"]"),t[o],"string, number, or boolean expected, ".concat(r," found")));break;case"any":case"all":case"none":for(var s=1;s<t.length;s++)a=a.concat(dn({key:"".concat(i,"[").concat(s,"]"),value:t[s],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":r=Sr(t[1]),2!==t.length?a.push(new Zr(i,t,'filter array for "'.concat(t[0],'" operator must have 2 elements'))):"string"!==r&&a.push(new Zr("".concat(i,"[1]"),t[1],"string expected, ".concat(r," found")));break;case"within":r=Sr(t[1]),2!==t.length?a.push(new Zr(i,t,'filter array for "'.concat(t[0],'" operator must have 2 elements'))):"object"!==r&&a.push(new Zr("".concat(i,"[1]"),t[1],"object expected, ".concat(r," found")))}return a}function pn(e,t){var i=e.key,r=e.style,n=e.styleSpec,a=e.value,o=e.objectKey,s=n["".concat(t,"_").concat(e.layerType)];if(!s)return[];var l=o.match(/^(.*)-transition$/);if("paint"===t&&l&&s[l[1]]&&s[l[1]].transition)return Mn({key:i,value:a,valueSpec:n.transition,style:r,styleSpec:n});var u,c=e.valueSpec||s[o];if(!c)return[new Zr(i,a,'unknown property "'.concat(o,'"'))];if("string"===Sr(a)&&Tr(c)&&!c.tokens&&(u=/^{([^}]+)}$/.exec(a))){var h='`{ "type": "identity", "property": '.concat(u?JSON.stringify(u[1]):'"_"'," }`");return[new Zr(i,a,'"'.concat(o,'" does not support interpolation syntax\nUse an identity property function instead: ').concat(h,"."))]}var f=[];return"symbol"===e.layerType&&("text-field"===o&&r&&!r.glyphs&&f.push(new Zr(i,a,'use of "text-field" requires a style "glyphs" property')),"text-font"===o&&Ir(mt(a))&&"identity"===pt(a.type)&&f.push(new Zr(i,a,'"text-font" does not support identity functions'))),f.concat(Mn({key:e.key,value:a,valueSpec:c,style:r,styleSpec:n,expressionContext:"property",propertyType:t,propertyKey:o}))}function mn(e){return pn(e,"paint")}function vn(e){return pn(e,"layout")}function yn(e){var t=[],i=e.value,r=e.key,n=e.style,a=e.styleSpec;i.type||i.ref||t.push(new Zr(r,i,'either "type" or "ref" is required'));var o,s=pt(i.type),l=pt(i.ref);
1if(i.id)for(var u=pt(i.id),c=0;c<e.arrayIndex;c++){var h=n.layers[c];pt(h.id)===u&&t.push(new Zr(r,i.id,'duplicate layer id "'.concat(i.id,'", previously used at line ').concat(h.id.__line__)))}if("ref"in i)["type","source","source-layer","filter","layout"].forEach(function(e){e in i&&t.push(new Zr(r,i[e],'"'.concat(e,'" is prohibited for ref layers')))}),n.layers.forEach(function(e){pt(e.id)===l&&(o=e)}),o?o.ref?t.push(new Zr(r,i.ref,"ref cannot reference another ref layer")):s=pt(o.type):"string"==typeof l&&t.push(new Zr(r,i.ref,'ref layer "'.concat(l,'" not found')));else if("background"!==s&&"sky"!==s)if(i.source){var f=n.sources&&n.sources[i.source],d=f&&pt(f.type);f?"vector"===d&&"raster"===s?t.push(new Zr(r,i.source,'layer "'.concat(i.id,'" requires a raster source'))):"raster"===d&&"raster"!==s?t.push(new Zr(r,i.source,'layer "'.concat(i.id,'" requires a vector source'))):"vector"!==d||i["source-layer"]?"raster-dem"===d&&"hillshade"!==s?t.push(new Zr(r,i.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==s||!i.paint||!i.paint["line-gradient"]&&!i.paint["line-trim-offset"]||"geojson"===d&&f.lineMetrics||t.push(new Zr(r,i,'layer "'.concat(i.id,'" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.'))):t.push(new Zr(r,i,'layer "'.concat(i.id,'" must specify a "source-layer"'))):t.push(new Zr(r,i.source,'source "'.concat(i.source,'" not found')))}else t.push(new Zr(r,i,'missing required property "source"'));return t=t.concat(qr({key:r,value:i,valueSpec:a.layer,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":function(){return[]},type:function(){return Mn({key:"".concat(r,".type"),value:i.type,valueSpec:a.layer.type,style:e.style,styleSpec:e.styleSpec,object:i,objectKey:"type"})},filter:function(e){return fn(dt({layerType:s},e))},layout:function(e){return qr({layer:i,key:e.key,value:e.value,valueSpec:{},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":function(e){return vn(dt({layerType:s},e))}}})},paint:function(e){return qr({layer:i,key:e.key,value:e.value,valueSpec:{},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":function(e){return mn(dt({layerType:s},e))}}})}}}))}function _n(e){var t=e.value,i=e.key,r=Sr(t);return"string"!==r?[new Zr(i,t,"string expected, ".concat(r," found"))]:[]}var gn={promoteId:function(e){var t=e.key,i=e.value;if("string"===Sr(i))return _n({key:t,value:i});var n=[];for(var a in i)n.push.apply(n,r(_n({key:"".concat(t,".").concat(a),value:i[a]})));return n}};function xn(e){var t=e.value,i=e.key,n=e.styleSpec,o=e.style;if(!t.type)return[new Zr(i,t,'"type" is required')];var s,l=pt(t.type);switch(l){case"vector":case"raster":case"raster-dem":return s=qr({key:i,value:t,valueSpec:n["source_".concat(l.replace("-","_"))],style:e.style,styleSpec:n,objectElementValidators:gn});case"geojson":if(s=qr({key:i,value:t,valueSpec:n.source_geojson,style:o,styleSpec:n,objectElementValidators:gn}),t.cluster)for(var u in t.clusterProperties){var c,h,f=a(t.clusterProperties[u],2),d=f[0],p=f[1],m="string"==typeof d?[d,["accumulated"],["get",u]]:d;(c=s).push.apply(c,r(Yr({key:"".concat(i,".").concat(u,".map"),value:p,expressionContext:"cluster-map"}))),(h=s).push.apply(h,r(Yr({key:"".concat(i,".").concat(u,".reduce"),value:m,expressionContext:"cluster-reduce"})))}return s;case"video":return qr({key:i,value:t,valueSpec:n.source_video,style:o,styleSpec:n});case"image":return qr({key:i,value:t,valueSpec:n.source_image,style:o,styleSpec:n});case"canvas":return[new Zr(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Jr({key:"".concat(i,".type"),value:t.type,valueSpec:{values:bn(n)},style:o,styleSpec:n})}}function bn(e){return e.source.reduce(function(t,i){var r=e[i];return"enum"===r.type.type&&(t=t.concat(Object.keys(r.type.values))),t},[])}function wn(e){var t=e.value,i=e.styleSpec,r=i.light,n=e.style,a=[],o=Sr(t);if(void 0===t)return a;
1if("object"!==o)return a=a.concat([new Zr("light",t,"object expected, ".concat(o," found"))]);for(var s in t){var l=s.match(/^(.*)-transition$/);a=a.concat(l&&r[l[1]]&&r[l[1]].transition?Mn({key:s,value:t[s],valueSpec:i.transition,style:n,styleSpec:i}):r[s]?Mn({key:s,value:t[s],valueSpec:r[s],style:n,styleSpec:i}):[new Zr(s,t[s],'unknown property "'.concat(s,'"'))])}return a}function kn(e){var t=e.value,i=e.key,r=e.style,n=e.styleSpec,a=n.terrain,o=[],s=Sr(t);if(void 0===t)return o;if("object"!==s)return o=o.concat([new Zr("terrain",t,"object expected, ".concat(s," found"))]);for(var l in t){var u=l.match(/^(.*)-transition$/);o=o.concat(u&&a[u[1]]&&a[u[1]].transition?Mn({key:l,value:t[l],valueSpec:n.transition,style:r,styleSpec:n}):a[l]?Mn({key:l,value:t[l],valueSpec:a[l],style:r,styleSpec:n}):[new Zr(l,t[l],'unknown property "'.concat(l,'"'))])}if(t.source){var c=r.sources&&r.sources[t.source],h=c&&pt(c.type);c?"raster-dem"!==h&&o.push(new Zr(i,t.source,"terrain cannot be used with a source of type ".concat(String(h),', it only be used with a "raster-dem" source type'))):o.push(new Zr(i,t.source,'source "'.concat(t.source,'" not found')))}else o.push(new Zr(i,t,'terrain is missing required property "source"'));return o}function Tn(e){var t=e.value,i=e.style,r=e.styleSpec,n=r.fog,a=[],o=Sr(t);if(void 0===t)return a;
1if("object"!==o)return a=a.concat([new Zr("fog",t,"object expected, ".concat(o," found"))]);for(var s in t){var l=s.match(/^(.*)-transition$/);a=a.concat(l&&n[l[1]]&&n[l[1]].transition?Mn({key:s,value:t[s],valueSpec:r.transition,style:i,styleSpec:r}):n[s]?Mn({key:s,value:t[s],valueSpec:n[s],style:i,styleSpec:r}):[new Zr(s,t[s],'unknown property "'.concat(s,'"'))])}return a}var En={"*":function(){return[]},array:Wr,boolean:function(e){var t=e.value,i=e.key,r=Sr(t);return"boolean"!==r?[new Zr(i,t,"boolean expected, ".concat(r," found"))]:[]},number:Xr,color:function(e){var t=e.key,i=e.value,r=Sr(i);return"string"!==r?[new Zr(t,i,"color expected, ".concat(r," found"))]:null===Lt(i)?[new Zr(t,i,'color expected, "'.concat(i,'" found'))]:[]},enum:Jr,filter:fn,function:Hr,layer:yn,object:qr,source:xn,light:wn,terrain:kn,fog:Tn,string:_n,formatted:function(e){return 0===_n(e).length?[]:Yr(e)},resolvedImage:function(e){return 0===_n(e).length?[]:Yr(e)},projection:function(e){var t=e.value,i=e.styleSpec,r=i.projection,n=e.style,a=[],o=Sr(t);if("object"===o)for(var s in t)a=a.concat(Mn({key:s,value:t[s],valueSpec:r[s],style:n,styleSpec:i}));else"string"!==o&&(a=a.concat([new Zr("projection",t,"object or string expected, ".concat(o," found"))]));return a}};function Mn(e){var t=e.value,i=e.valueSpec,r=e.styleSpec;return i.expression&&Ir(pt(t))?Hr(e):i.expression&&Or(mt(t))?Yr(e):i.type&&En[i.type]?En[i.type](e):qr(dt({},e,{valueSpec:i.type?r[i.type]:i}))}function Sn(e){var t=e.value,i=e.key,r=_n(e);return r.length||(-1===t.indexOf("{fontstack}")&&r.push(new Zr(i,t,'"glyphs" url must include a "{fontstack}" token')),-1===t.indexOf("{range}")&&r.push(new Zr(i,t,'"glyphs" url must include a "{range}" token'))),r}function In(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ft;return zn(Mn({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,objectElementValidators:{glyphs:Sn,"*":function(){return[]}}}))}var Cn=function(e){return zn(mn(e))},An=function(e){return zn(vn(e))};function zn(e){return e.slice().sort(function(e,t){return e.line&&t.line?e.line-t.line:0})}function Pn(e,t){var i=!1;if(t&&t.length){var r,n=l(t);try{for(n.s();!(r=n.n()).done;){var a=r.value;e.fire(new ct(new Error(a.message))),i=!0}}catch(o){n.e(o)}finally{n.f()}}return i}var Dn=Ln;function Ln(e,t,i){var r=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;var n=new Int32Array(this.arrayBuffer);e=n[0],this.d=(t=n[1])+2*(i=n[2]);for(var a=0;a<this.d*this.d;a++){var o=n[3+a],s=n[3+a+1];r.push(o===s?null:n.subarray(o,s))}var l=n[3+r.length+1];this.keys=n.subarray(n[3+r.length],l),this.bboxes=n.subarray(l),this.insert=this._insertReadonly}else{this.d=t+2*i;for(var u=0;u<this.d*this.d;u++)r.push([]);this.keys=[],this.bboxes=[]}this.n=t,this.extent=e,this.padding=i,this.scale=t/e,this.uid=0;var c=i/t*e;this.min=-c,this.max=e+c}Ln.prototype.insert=function(e,t,i,r,n){this._forEachCell(t,i,r,n,this._insertCell,this.uid++),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)},Ln.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},Ln.prototype._insertCell=function(e,t,i,r,n,a){this.cells[n].push(a)},Ln.prototype.query=function(e,t,i,r,n){var a=this.min,o=this.max;if(e<=a&&t<=a&&o<=i&&o<=r&&!n)return Array.prototype.slice.call(this.keys);var s=[];return this._forEachCell(e,t,i,r,this._queryCell,s,{},n),s},Ln.prototype._queryCell=function(e,t,i,r,n,a,o,s){var l=this.cells[n];if(null!==l)for(var u=this.keys,c=this.bboxes,h=0;h<l.length;h++){var f=l[h];if(void 0===o[f]){var d=4*f;(s?s(c[d+0],c[d+1],c[d+2],c[d+3]):e<=c[d+2]&&t<=c[d+3]&&i>=c[d+0]&&r>=c[d+1])?(o[f]=!0,a.push(u[f])):o[f]=!1}}},Ln.prototype._forEachCell=function(e,t,i,r,n,a,o,s){for(var l=this._convertToCellCoord(e),u=this._convertToCellCoord(t),c=this._convertToCellCoord(i),h=this._convertToCellCoord(r),f=l;f<=c;f++)for(var d=u;d<=h;d++){var p=this.d*d+f;if((!s||s(this._convertFromCellCoord(f),this._convertFromCellCoord(d),this._convertFromCellCoord(f+1),this._convertFromCellCoord(d+1)))&&n.call(this,e,t,i,r,p,a,o,s))return}},Ln.prototype._convertFromCellCoord=function(e){return(e-this.padding)/this.scale},Ln.prototype._convertToCellCoord=function(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))},Ln.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var e=this.cells,t=3+this.cells.length+1+1,i=0,r=0;r<this.cells.length;r++)i+=this.cells[r].length;var n=new Int32Array(t+i+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;
1for(var a=t,o=0;o<e.length;o++){var s=e[o];n[3+o]=a,n.set(s,a),a+=s.length}return n[3+e.length]=a,n.set(this.keys,a),n[3+e.length+1]=a+=this.keys.length,n.set(this.bboxes,a),a+=this.bboxes.length,n.buffer};var Rn={};function Bn(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),Rn[t]={klass:e,omit:i.omit||[]}}for(var On in Bn(Object,"Object"),Dn.serialize=function(e,t){var i=e.toArrayBuffer();return t&&t.push(i),{buffer:i}},Dn.deserialize=function(e){return new Dn(e.buffer)},Object.defineProperty(Dn,"name",{value:"Grid"}),Bn(Dn,"Grid"),Bn(jt,"Color"),Bn(Error,"Error"),Bn(ke,"AJAXError"),Bn(qt,"ResolvedImage"),Bn(Nr,"StylePropertyFunction"),Bn(Br,"StyleExpression",{omit:["_evaluator"]}),Bn(Vr,"ZoomDependentExpression"),Bn(Ur,"ZoomConstantExpression"),Bn(oi,"CompoundExpression",{omit:["_evaluate"]}),br)Rn[br[On]._classRegistryKey]||Bn(br[On],"Expression".concat(On));function Fn(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}function Un(e){return x.ImageBitmap&&e instanceof x.ImageBitmap}function Vn(e,t){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(Fn(e)||Un(e))return t&&t.push(e),e;if(ArrayBuffer.isView(e)){var i=e;return t&&t.push(i.buffer),i}if(e instanceof x.ImageData)return t&&t.push(e.data.buffer),e;if(Array.isArray(e)){var r,n=[],a=l(e);try{for(a.s();!(r=a.n()).done;){var o=r.value;n.push(Vn(o,t))}}catch(f){a.e(f)}finally{a.f()}return n}if("object"==typeof e){var s=e.constructor,u=s._classRegistryKey;if(!u)throw new Error("can't serialize object of unregistered class ".concat(u));var c=s.serialize?s.serialize(e,t):{};if(!s.serialize){for(var h in e)e.hasOwnProperty(h)&&(Rn[u].omit.indexOf(h)>=0||(c[h]=Vn(e[h],t)));e instanceof Error&&(c.message=e.message)}if(c.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==u&&(c.$name=u),c}throw new Error("can't serialize object of type "+typeof e)}function jn(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||Fn(e)||Un(e)||ArrayBuffer.isView(e)||e instanceof x.ImageData)return e;if(Array.isArray(e))return e.map(jn);if("object"==typeof e){var t=e.$name||"Object",i=Rn[t].klass;if(!i)throw new Error("can't deserialize unregistered class ".concat(t));if(i.deserialize)return i.deserialize(e);for(var r=Object.create(i.prototype),n=0,a=Object.keys(e);n<a.length;n++){var o=a[n];"$name"!==o&&(r[o]=jn(e[o]))}return r}throw new Error("can't deserialize object of type "+typeof e)}var Nn=function(e){return e>=1536&&e<=1791},Gn=function(e){return e>=1872&&e<=1919},Zn=function(e){return e>=2208&&e<=2303},qn=function(e){return e>=11904&&e<=12031},Wn=function(e){return e>=12032&&e<=12255},Xn=function(e){return e>=12272&&e<=12287},Hn=function(e){return e>=12288&&e<=12351},Yn=function(e){return e>=12352&&e<=12447},Kn=function(e){return e>=12448&&e<=12543},Jn=function(e){return e>=12544&&e<=12591},$n=function(e){return e>=12704&&e<=12735},Qn=function(e){return e>=12736&&e<=12783},ea=function(e){return e>=12784&&e<=12799},ta=function(e){return e>=12800&&e<=13055},ia=function(e){return e>=13056&&e<=13311},ra=function(e){return e>=13312&&e<=19903},na=function(e){return e>=19968&&e<=40959},aa=function(e){return e>=40960&&e<=42127},oa=function(e){return e>=42128&&e<=42191},sa=function(e){return e>=44032&&e<=55215},la=function(e){return e>=63744&&e<=64255},ua=function(e){return e>=64336&&e<=65023},ca=function(e){return e>=65040&&e<=65055},ha=function(e){return e>=65072&&e<=65103},fa=function(e){return e>=65104&&e<=65135},da=function(e){return e>=65136&&e<=65279},pa=function(e){return e>=65280&&e<=65519};function ma(e){var t,i=l(e);try{for(i.s();!(t=i.n()).done;){if(ya(t.value.charCodeAt(0)))return!0}}catch(r){i.e(r)}finally{i.f()}return!1}function va(e){return!(Nn(e)||Gn(e)||Zn(e)||ua(e)||da(e))}function ya(e){return!(746!==e&&747!==e&&(e<4352||!($n(e)||Jn(e)||ha(e)&&!(e>=65097&&e<=65103)||la(e)||ia(e)||qn(e)||Qn(e)||!(!Hn(e)||e>=12296&&e<=12305||e>=12308&&e<=12319||12336===e)||ra(e)||na(e)||ta(e)||(t=e,t>=12592&&t<=12687)||function(e){return e>=43360&&e<=43391}(e)||function(e){return e>=55216&&e<=55295}(e)||function(e){return e>
1=4352&&e<=4607}(e)||sa(e)||Yn(e)||Xn(e)||function(e){return e>=12688&&e<=12703}(e)||Wn(e)||ea(e)||Kn(e)&&12540!==e||!(!pa(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)||!(!fa(e)||e>=65112&&e<=65118||e>=65123&&e<=65126)||function(e){return e>=5120&&e<=5759}(e)||function(e){return e>=6320&&e<=6399}(e)||ca(e)||function(e){return e>=19904&&e<=19967}(e)||aa(e)||oa(e))));var t}function _a(e){return!(ya(e)||(t=e,(i=t)>=128&&i<=255&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||function(e){return e>=8192&&e<=8303}(t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||function(e){return e>=8448&&e<=8527}(t)||function(e){return e>=8528&&e<=8591}(t)||function(e){return e>=8960&&e<=9215}(t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||function(e){return e>=9216&&e<=9279}(t)&&9251!==t||function(e){return e>=9280&&e<=9311}(t)||function(e){return e>=9312&&e<=9471}(t)||function(e){return e>=9632&&e<=9727}(t)||function(e){return e>=9728&&e<=9983}(t)&&!(t>=9754&&t<=9759)||function(e){return e>=11008&&e<=11263}(t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Hn(t)||Kn(t)||function(e){return e>=57344&&e<=63743}(t)||ha(t)||fa(t)||pa(t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t));var t,i}function ga(e){return e>=1424&&e<=2303||ua(e)||da(e)}function xa(e,t){return!(!t&&ga(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||(i=e,i>=6016&&i<=6143));var i}function ba(e){var t,i=l(e);try{for(i.s();!(t=i.n()).done;){if(ga(t.value.charCodeAt(0)))return!0}}catch(r){i.e(r)}finally{i.f()}return!1}var wa="deferred",ka="loading",Ta="loaded",Ea=null,Ma="unavailable",Sa=null,Ia=function(e){e&&"string"==typeof e&&e.indexOf("NetworkError")>-1&&(Ma="error"),Ea&&Ea(e)};function Ca(){Aa.fire(new ut("pluginStateChange",{pluginStatus:Ma,pluginURL:Sa}))}var Aa=new ht,za=function(){return Ma},Pa=function(){if(Ma!==wa||!Sa)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Ma=ka,Ca(),Sa&&Me({url:Sa},function(e){e?Ia(e):(Ma=Ta,Ca())})},Da={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:function(){return Ma===Ta||null!=Da.applyArabicShaping},isLoading:function(){return Ma===ka},setState:function(e){Ma=e.pluginStatus,Sa=e.pluginURL},isParsed:function(){return null!=Da.applyArabicShaping&&null!=Da.processBidirectionalText&&null!=Da.processStyledBidirectionalText},getPluginURL:function(){return Sa}},La=function(){function e(t,i){h(this,e),this.zoom=t,i?(this.now=i.now,this.fadeDuration=i.fadeDuration,this.transition=i.transition,this.pitch=i.pitch):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0)}return d(e,[{key:"isSupportedScript",value:function(e){return function(e,t){var i,r=l(e);try{for(r.s();!(i=r.n()).done;){if(!xa(i.value.charCodeAt(0),t))return!1}}catch(n){r.e(n)}finally{r.f()}return!0}(e,Da.isLoaded())}}]),e}(),Ra=function(){function e(t,i){h(this,e),this.property=t,this.value=i,this.expression=function(e,t){if(Ir(e))return new Nr(e,t);if(Or(e)){var i=jr(e,t);if("error"===i.result)throw new Error(i.value.map(function(e){return"".concat(e.key,": ").concat(e.message)}).join(", "));return i.value}var r=e;return"string"==typeof e&&"color"===t.type&&(r=jt.parse(e)),{kind:"constant",evaluate:function(){return r}}}(void 0===i?t.specification.default:i,t.specification)}return d(e,[{key:"isDataDriven",value:function(){return"source"===this.expression.kind||"composite"===this.expression.kind}},{key:"possiblyEvaluate",value:function(e,t,i){return this.property.possiblyEvaluate(this,e,t,i)}}]),e}(),Ba=function(){function e(t){h(this,e),this.property=t,this.value=new Ra(t,void 0)}return d(e,[{key:"transitioned",value:function(e,t){return new Fa(this.property,this.value,t,W({},e.transition,this.transition),e.now)}},{key:"untransitioned",value:function(){return new Fa(this.property,this.value,
1null,{},0)}}]),e}(),Oa=function(){function e(t){h(this,e),this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}return d(e,[{key:"getValue",value:function(e){return ie(this._values[e].value.value)}},{key:"setValue",value:function(e,t){this._values.hasOwnProperty(e)||(this._values[e]=new Ba(this._values[e].property)),this._values[e].value=new Ra(this._values[e].property,null===t?void 0:ie(t))}},{key:"getTransition",value:function(e){return ie(this._values[e].transition)}},{key:"setTransition",value:function(e,t){this._values.hasOwnProperty(e)||(this._values[e]=new Ba(this._values[e].property)),this._values[e].transition=ie(t)||void 0}},{key:"serialize",value:function(){for(var e={},t=0,i=Object.keys(this._values);t<i.length;t++){var r=i[t],n=this.getValue(r);void 0!==n&&(e[r]=n);var a=this.getTransition(r);void 0!==a&&(e["".concat(r,"-transition")]=a)}return e}},{key:"transitioned",value:function(e,t){for(var i=new Ua(this._properties),r=0,n=Object.keys(this._values);r<n.length;r++){var a=n[r];i._values[a]=this._values[a].transitioned(e,t._values[a])}return i}},{key:"untransitioned",value:function(){for(var e=new Ua(this._properties),t=0,i=Object.keys(this._values);t<i.length;t++){var r=i[t];e._values[r]=this._values[r].untransitioned()}return e}}]),e}(),Fa=function(){function e(t,i,r,n,a){h(this,e);var o=n.delay||0,s=n.duration||0;a=a||0,this.property=t,this.value=i,this.begin=a+o,this.end=this.begin+s,t.specification.transition&&(n.delay||n.duration)&&(this.prior=r)}return d(e,[{key:"possiblyEvaluate",value:function(e,t,i){var r=e.now||0,n=this.value.possiblyEvaluate(e,t,i),a=this.prior;if(a){if(r>this.end)return this.prior=null,n;if(this.value.isDataDriven())return this.prior=null,n;if(r<this.begin)return a.possiblyEvaluate(e,t,i);var o=(r-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(e,t,i),n,F(o))}return n}}]),e}(),Ua=function(){function e(t){h(this,e),this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}return d(e,[{key:"possiblyEvaluate",value:function(e,t,i){for(var r=new Na(this._properties),n=0,a=Object.keys(this._values);n<a.length;n++){var o=a[n];r._values[o]=this._values[o].possiblyEvaluate(e,t,i)}return r}},{key:"hasTransition",value:function(){for(var e=0,t=Object.keys(this._values);e<t.length;e++){var i=t[e];if(this._values[i].prior)return!0}return!1}}]),e}(),Va=function(){function e(t){h(this,e),this._properties=t,this._values=Object.create(t.defaultPropertyValues)}return d(e,[{key:"getValue",value:function(e){return ie(this._values[e].value)}},{key:"setValue",value:function(e,t){this._values[e]=new Ra(this._values[e].property,null===t?void 0:ie(t))}},{key:"serialize",value:function(){for(var e={},t=0,i=Object.keys(this._values);t<i.length;t++){var r=i[t],n=this.getValue(r);void 0!==n&&(e[r]=n)}return e}},{key:"possiblyEvaluate",value:function(e,t,i){for(var r=new Na(this._properties),n=0,a=Object.keys(this._values);n<a.length;n++){var o=a[n];r._values[o]=this._values[o].possiblyEvaluate(e,t,i)}return r}}]),e}(),ja=function(){function e(t,i,r){h(this,e),this.property=t,this.value=i,this.parameters=r}return d(e,[{key:"isConstant",value:function(){return"constant"===this.value.kind}},{key:"constantOr",value:function(e){return"constant"===this.value.kind?this.value.value:e}},{key:"evaluate",value:function(e,t,i,r){return this.property.evaluate(this.value,this.parameters,e,t,i,r)}}]),e}(),Na=function(){function e(t){h(this,e),this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}return d(e,[{key:"get",value:function(e){return this._values[e]}}]),e}(),Ga=function(){function e(t){h(this,e),this.specification=t}return d(e,[{key:"possiblyEvaluate",value:function(e,t){return e.expression.evaluate(t)}},{key:"interpolate",value:function(e,t,i){var r=Li[this.specification.type];return r?r(e,t,i):e}}]),e}(),Za=function(){function e(t,i){h(this,e),this.specification=t,this.overrides=i}return d(e,[{key:"possiblyEvaluate",value:function(e,t,i,r){return new ja(this,"constant"===e.expression.kind||"camera"===e.expression.kind?{kind:"constant",value:e.expression.evaluate(t,null,{},i,r)}:e.expression,t)}},{key:"interpolate",value:function(e,t,i){if("constant"!==e.value.kind||"constant"!==t.value.kind)return e;if(void 0===e.value.value||void 0===t.value.value)return new ja(this,{kind:"constant",value:void 0},e.parameters);var r=Li[this.specification.type];
1return r?new ja(this,{kind:"constant",value:r(e.value.value,t.value.value,i)},e.parameters):e}},{key:"evaluate",value:function(e,t,i,r,n,a){return"constant"===e.kind?e.value:e.evaluate(t,i,r,n,a)}}]),e}(),qa=function(){function e(t){h(this,e),this.specification=t}return d(e,[{key:"possiblyEvaluate",value:function(e,t,i,r){return!!e.expression.evaluate(t,null,{},i,r)}},{key:"interpolate",value:function(){return!1}}]),e}(),Wa=d(function e(t){h(this,e),this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];var i=new La(0,{});for(var r in t){var n=t[r];n.specification.overridable&&this.overridableProperties.push(r);var a=this.defaultPropertyValues[r]=new Ra(n,void 0),o=this.defaultTransitionablePropertyValues[r]=new Ba(n);this.defaultTransitioningPropertyValues[r]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=a.possiblyEvaluate(i)}});function Xa(e,t){return 256*(e=j(Math.floor(e),0,255))+j(Math.floor(t),0,255)}Bn(Za,"DataDrivenProperty"),Bn(Ga,"DataConstantProperty"),Bn(qa,"ColorRampProperty");var Ha={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},Ya=d(function e(t,i){h(this,e),this._structArray=t,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}),Ka=function(){function e(){h(this,e),this.isTransferred=!1,this.capacity=-1,this.resize(0)}return d(e,[{key:"_trim",value:function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}},{key:"clear",value:function(){this.length=0}},{key:"resize",value:function(e){this.reserve(e),this.length=e}},{key:"reserve",value:function(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}},{key:"_refreshViews",value:function(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}},{key:"destroy",value:function(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}],[{key:"serialize",value:function(e,t){return e._trim(),t&&(e.isTransferred=!0,t.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}},{key:"deserialize",value:function(e){var t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement,t._refreshViews(),t}}]),e}();function Ja(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=0,r=0;return{members:e.map(function(e){var n=Ha[e.type].BYTES_PER_ELEMENT,a=i=$a(i,Math.max(t,n)),o=e.components||1;return r=Math.max(r,n),i+=n*o,{name:e.name,type:e.type,components:o,offset:a}}),size:$a(i,Math.max(r,t)),alignment:t}}function $a(e,t){return Math.ceil(e/t)*t}var Qa=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t){var i=this.length;return this.resize(i+1),this.emplace(i,e,t)}},{key:"emplace",value:function(e,t,i){var r=2*e;return this.int16[r+0]=t,this.int16[r+1]=i,e}}]),i}(Ka);Qa.prototype.bytesPerElement=4,Bn(Qa,"StructArrayLayout2i4");var eo=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i){var r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}},{key:"emplace",value:function(e,t,i,r){var n=3*e;return this.int16[n+0]=t,this.int16[n+1]=i,this.int16[n+2]=r,e}}]),i}(Ka);eo.prototype.bytesPerElement=6,Bn(eo,"StructArrayLayout3i6");var to=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i,r){var n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}},{key:"emplace",value:function(e,t,i,r,n){var a=4*e;return this.int16[a+0]=t,this.int16[a+1]=i,this.int16[a+2]=r,this.int16[a+3]=n,e}}]),i}(Ka);to.prototype.bytesPerElement=8,Bn(to,"StructArrayLayout4i8");var io=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i,r,n,a,o){var s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,a,o)}},{key:"emplace",value:function(e,t,i,r,n,a,o,s){var l=6*e,u=12*e,c=3*e;return this.int16[l+0]=t,this.int16[l+1]=i,this.uint8[u+4]=r,this.uint8[u+5]=n,this.uint8[u+6]=a,this.uint8[u+7]=o,this.float32[c+2]=s,e}}]),i}(Ka);io.prototype.bytesPerElement=12,Bn(io,"StructArrayLayout2i4ub1f12");var ro=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i,r){var n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}},{key:"emplace",value:function(e,t,i,r,n){var a=4*e;return this.float32[a+0]=t,this.float32[a+1]=i,this.float32[a+2]=r,this.float32[a+3]=n,e}}]),i}(Ka);ro.prototype.bytesPerElement=16,Bn(ro,"StructArrayLayout4f16");var no=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i,r,n){var a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r,n)}},{key:"emplace",value:function(e,t,i,r,n,a){var o=6*e,s=3*e;return this.uint16[o+0]=t,this.uint16[o+1]=i,this.uint16[o+2]=r,this.uint16[o+3]=n,this.float32[s+2]=a,e}}]),i}(Ka);
1no.prototype.bytesPerElement=12,Bn(no,"StructArrayLayout4ui1f12");var ao=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i,r){var n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}},{key:"emplace",value:function(e,t,i,r,n){var a=4*e;return this.uint16[a+0]=t,this.uint16[a+1]=i,this.uint16[a+2]=r,this.uint16[a+3]=n,e}}]),i}(Ka);ao.prototype.bytesPerElement=8,Bn(ao,"StructArrayLayout4ui8");var oo=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i,r,n,a){var o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n,a)}},{key:"emplace",value:function(e,t,i,r,n,a,o){var s=6*e;return this.int16[s+0]=t,this.int16[s+1]=i,this.int16[s+2]=r,this.int16[s+3]=n,this.int16[s+4]=a,this.int16[s+5]=o,e}}]),i}(Ka);oo.prototype.bytesPerElement=12,Bn(oo,"StructArrayLayout6i12");var so=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i,r,n,a,o,s,l,u,c,h){var f=this.length;return this.resize(f+1),this.emplace(f,e,t,i,r,n,a,o,s,l,u,c,h)}},{key:"emplace",value:function(e,t,i,r,n,a,o,s,l,u,c,h,f){var d=12*e;return this.int16[d+0]=t,this.int16[d+1]=i,this.int16[d+2]=r,this.int16[d+3]=n,this.uint16[d+4]=a,this.uint16[d+5]=o,this.uint16[d+6]=s,this.uint16[d+7]=l,this.int16[d+8]=u,this.int16[d+9]=c,this.int16[d+10]=h,this.int16[d+11]=f,e}}]),i}(Ka);so.prototype.bytesPerElement=24,Bn(so,"StructArrayLayout4i4ui4i24");var lo=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i,r,n,a){var o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,n,a)}},{key:"emplace",value:function(e,t,i,r,n,a,o){var s=10*e,l=5*e;return this.int16[s+0]=t,this.int16[s+1]=i,this.int16[s+2]=r,this.float32[l+2]=n,this.float32[l+3]=a,this.float32[l+4]=o,e}}]),i}(Ka);lo.prototype.bytesPerElement=20,Bn(lo,"StructArrayLayout3i3f20");var uo=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e){var t=this.length;return this.resize(t+1),this.emplace(t,e)}},{key:"emplace",value:function(e,t){return this.uint32[1*e+0]=t,e}}]),i}(Ka);uo.prototype.bytesPerElement=4,Bn(uo,"StructArrayLayout1ul4");var co=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"_refreshViews",value:function(){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)}},{key:"emplaceBack",value:function(e,t,i,r,n,a,o,s,l,u,c,h,f){var d=this.length;return this.resize(d+1),this.emplace(d,e,t,i,r,n,a,o,s,l,u,c,h,f)}},{key:"emplace",value:function(e,t,i,r,n,a,o,s,l,u,c,h,f,d){var p=20*e,m=10*e;return this.int16[p+0]=t,this.int16[p+1]=i,this.int16[p+2]=r,this.int16[p+3]=n,this.int16[p+4]=a,this.float32[m+3]=o,this.float32[m+4]=s,this.float32[m+5]=l,this.float32[m+6]=u,this.int16[p+14]=c,this.uint32[m+8]=h,this.uint16[p+18]=f,this.uint16[p+19]=d,e}}]),i}(Ka);co.prototype.bytesPerElement=40,Bn(co,"StructArrayLayout5i4f1i1ul2ui40");var ho=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i,r,n,a,o){var s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,r,n,a,o)}},{key:"emplace",value:function(e,t,i,r,n,a,o,s){var l=8*e;return this.int16[l+0]=t,this.int16[l+1]=i,this.int16[l+2]=r,this.int16[l+4]=n,this.int16[l+5]=a,this.int16[l+6]=o,this.int16[l+7]=s,e}}]),i}(Ka);ho.prototype.bytesPerElement=16,Bn(ho,"StructArrayLayout3i2i2i16");var fo=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i,r,n){var a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r,n)}},{key:"emplace",value:function(e,t,i,r,n,a){var o=4*e,s=8*e;return this.float32[o+0]=t,this.float32[o+1]=i,this.float32[o+2]=r,this.int16[s+6]=n,this.int16[s+7]=a,e}}]),i}(Ka);fo.prototype.bytesPerElement=16,Bn(fo,"StructArrayLayout2f1f2i16");var po=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i,r){var n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}},{key:"emplace",value:function(e,t,i,r,n){var a=12*e,o=3*e;return this.uint8[a+0]=t,this.uint8[a+1]=i,this.float32[o+1]=r,this.float32[o+2]=n,e}}]),i}(Ka);po.prototype.bytesPerElement=12,Bn(po,"StructArrayLayout2ub2f12");var mo=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i){var r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}},{key:"emplace",value:function(e,t,i,r){var n=3*e;return this.float32[n+0]=t,this.float32[n+1]=i,this.float32[n+2]=r,e}}]),i}(Ka);mo.prototype.bytesPerElement=12,Bn(mo,"StructArrayLayout3f12");var vo=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i){var r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}},{key:"emplace",value:function(e,t,i,r){var n=3*e;return this.uint16[n+0]=t,this.uint16[n+1]=i,this.uint16[n+2]=r,e}}]),i}(Ka);vo.prototype.bytesPerElement=6,Bn(vo,"StructArrayLayout3ui6");var yo=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"_refreshViews",value:function(){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)}},{key:"emplaceBack",value:function(e,t,i,r,n,a,o,s,l,u,c,h,f,d,p,m,v,y,_,g,x){var b=this.length;return this.resize(b+1),this.emplace(b,e,t,i,r,n,a,o,s,l,u,c,h,f,d,p,m,v,y,_,g,x)}},{key:"emplace",value:function(e,t,i,r,n,a,o,s,l,u,c,h,f,d,p,m,v,y,_,g,x,b){var w=30*e,k=15*e,T=60*e;return this.int16[w+0]=t,this.int16[w+1]=i,this.int16[w+2]=r,this.float32[k+2]=n,this.float32[k+3]=a,this.uint16[w+8]=o,this.uint16[w+9]=s,this.uint32[k+5]=l,this.uint32[k+6]=u,this.uint32[k+7]=c,this.uint16[w+16]=h,this.uint16[w+17]=f,this.uint16[w+18]=d,this.float32[k+10]=p,this.float32[k+11]=m,this.uint8[T+48]=v,this.uint8[T+49]=y,this.uint8[T+50]=_,this.uint32[k+13]=g,this.int16[w+28]=x,this.uint8[T+58]=b,e}}]),i}(Ka);yo.prototype.bytesPerElement=60,Bn(yo,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");var _o=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"_refreshViews",value:function(){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)}},{key:"emplaceBack",value:function(e,t,i,r,n,a,o,s,l,u,c,h,f,d,p,m,v,y,_,g,x,b,w,k,T,E,M,S,I,C){var A=this.length;return this.resize(A+1),this.emplace(A,e,t,i,r,n,a,o,s,l,u,c,h,f,d,p,m,v,y,_,g,x,b,w,k,T,E,M,S,I,C)}},{key:"emplace",value:function(e,t,i,r,n,a,o,s,l,u,c,h,f,d,p,m,v,y,_,g,x,b,w,k,T,E,M,S,I,C,A){var z=38*e,P=19*e;return this.int16[z+0]=t,this.int16[z+1]=i,this.int16[z+2]=r,this.float32[P+2]=n,this.float32[P+3]=a,this.int16[z+8]=o,this.int16[z+9]=s,this.int16[z+10]=l,this.int16[z+11]=u,this.int16[z+12]=c,this.int16[z+13]=h,this.uint16[z+14]=f,this.uint16[z+15]=d,this.uint16[z+16]=p,this.uint16[z+17]=m,this.uint16[z+18]=v,this.uint16[z+19]=y,this.uint16[z+20]=_,this.uint16[z+21]=g,this.uint16[z+22]=x,this.uint16[z+23]=b,this.uint16[z+24]=w,this.uint16[z+25]=k,this.uint16[z+26]=T,this.uint16[z+27]=E,this.uint16[z+28]=M,this.uint32[P+15]=S,this.float32[P+16]=I,this.float32[P+17]=C,this.float32[P+18]=A,e}}]),i}(Ka);_o.prototype.bytesPerElement=76,Bn(_o,"StructArrayLayout3i2f6i15ui1ul3f76");var go=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e){var t=this.length;return this.resize(t+1),this.emplace(t,e)}},{key:"emplace",value:function(e,t){return this.float32[1*e+0]=t,e}}]),i}(Ka);go.prototype.bytesPerElement=4,Bn(go,"StructArrayLayout1f4");var xo=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i,r,n){var a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r,n)}},{key:"emplace",value:function(e,t,i,r,n,a){var o=5*e;return this.float32[o+0]=t,this.float32[o+1]=i,this.float32[o+2]=r,this.float32[o+3]=n,this.float32[o+4]=a,e}}]),i}(Ka);xo.prototype.bytesPerElement=20,Bn(xo,"StructArrayLayout5f20");var bo=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t,i,r){var n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r)}},{key:"emplace",value:function(e,t,i,r,n){var a=6*e;
1return this.uint32[3*e+0]=t,this.uint16[a+2]=i,this.uint16[a+3]=r,this.uint16[a+4]=n,e}}]),i}(Ka);bo.prototype.bytesPerElement=12,Bn(bo,"StructArrayLayout1ul3ui12");var wo=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t){var i=this.length;return this.resize(i+1),this.emplace(i,e,t)}},{key:"emplace",value:function(e,t,i){var r=2*e;return this.uint16[r+0]=t,this.uint16[r+1]=i,e}}]),i}(Ka);wo.prototype.bytesPerElement=4,Bn(wo,"StructArrayLayout2ui4");var ko=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e){var t=this.length;return this.resize(t+1),this.emplace(t,e)}},{key:"emplace",value:function(e,t){return this.uint16[1*e+0]=t,e}}]),i}(Ka);ko.prototype.bytesPerElement=2,Bn(ko,"StructArrayLayout1ui2");var To=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"_refreshViews",value:function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}},{key:"emplaceBack",value:function(e,t){var i=this.length;return this.resize(i+1),this.emplace(i,e,t)}},{key:"emplace",value:function(e,t,i){var r=2*e;return this.float32[r+0]=t,this.float32[r+1]=i,e}}]),i}(Ka);To.prototype.bytesPerElement=8,Bn(To,"StructArrayLayout2f8");var Eo=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"projectedAnchorX",get:function(){return this._structArray.int16[this._pos2+0]}},{key:"projectedAnchorY",get:function(){return this._structArray.int16[this._pos2+1]}},{key:"projectedAnchorZ",get:function(){return this._structArray.int16[this._pos2+2]}},{key:"tileAnchorX",get:function(){return this._structArray.int16[this._pos2+3]}},{key:"tileAnchorY",get:function(){return this._structArray.int16[this._pos2+4]}},{key:"x1",get:function(){return this._structArray.float32[this._pos4+3]}},{key:"y1",get:function(){return this._structArray.float32[this._pos4+4]}},{key:"x2",get:function(){return this._structArray.float32[this._pos4+5]}},{key:"y2",get:function(){return this._structArray.float32[this._pos4+6]}},{key:"padding",get:function(){return this._structArray.int16[this._pos2+14]}},{key:"featureIndex",get:function(){return this._structArray.uint32[this._pos4+8]}},{key:"sourceLayerIndex",get:function(){return this._structArray.uint16[this._pos2+18]}},{key:"bucketIndex",get:function(){return this._structArray.uint16[this._pos2+19]}}]),i}(Ya);Eo.prototype.size=40;var Mo=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"get",value:function(e){return new Eo(this,e)}}]),i}(co);Bn(Mo,"CollisionBoxArray");var So=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"projectedAnchorX",get:function(){return this._structArray.int16[this._pos2+0]}},{key:"projectedAnchorY",get:function(){return this._structArray.int16[this._pos2+1]}},{key:"projectedAnchorZ",get:function(){return this._structArray.int16[this._pos2+2]}},{key:"tileAnchorX",get:function(){return this._structArray.float32[this._pos4+2]}},{key:"tileAnchorY",get:function(){return this._structArray.float32[this._pos4+3]}},{key:"glyphStartIndex",get:function(){return this._structArray.uint16[this._pos2+8]}},{key:"numGlyphs",get:function(){return this._structArray.uint16[this._pos2+9]}},{key:"vertexStartIndex",get:function(){return this._structArray.uint32[this._pos4+5]}},{key:"lineStartIndex",get:function(){return this._structArray.uint32[this._pos4+6]}},{key:"lineLength",get:function(){return this._structArray.uint32[this._pos4+7]}},{key:"segment",get:function(){return this._structArray.uint16[this._pos2+16]}},{key:"lowerSize",get:function(){return this._structArray.uint16[this._pos2+17]}},{key:"upperSize",get:function(){return this._structArray.uint16[this._pos2+18]}},{key:"lineOffsetX",get:function(){return this._structArray.float32[this._pos4+10]}},{key:"lineOffsetY",get:function(){return this._structArray.float32[this._pos4+11]}},{key:"writingMode",get:function(){return this._structArray.uint8[this._pos1+48]}},{key:"placedOrientation",get:function(){return this._structArray.uint8[this._pos1+49]}
1,set:function(e){this._structArray.uint8[this._pos1+49]=e}},{key:"hidden",get:function(){return this._structArray.uint8[this._pos1+50]},set:function(e){this._structArray.uint8[this._pos1+50]=e}},{key:"crossTileID",get:function(){return this._structArray.uint32[this._pos4+13]},set:function(e){this._structArray.uint32[this._pos4+13]=e}},{key:"associatedIconIndex",get:function(){return this._structArray.int16[this._pos2+28]}},{key:"flipState",get:function(){return this._structArray.uint8[this._pos1+58]},set:function(e){this._structArray.uint8[this._pos1+58]=e}}]),i}(Ya);So.prototype.size=60;var Io=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"get",value:function(e){return new So(this,e)}}]),i}(yo);Bn(Io,"PlacedSymbolArray");var Co=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"projectedAnchorX",get:function(){return this._structArray.int16[this._pos2+0]}},{key:"projectedAnchorY",get:function(){return this._structArray.int16[this._pos2+1]}},{key:"projectedAnchorZ",get:function(){return this._structArray.int16[this._pos2+2]}},{key:"tileAnchorX",get:function(){return this._structArray.float32[this._pos4+2]}},{key:"tileAnchorY",get:function(){return this._structArray.float32[this._pos4+3]}},{key:"rightJustifiedTextSymbolIndex",get:function(){return this._structArray.int16[this._pos2+8]}},{key:"centerJustifiedTextSymbolIndex",get:function(){return this._structArray.int16[this._pos2+9]}},{key:"leftJustifiedTextSymbolIndex",get:function(){return this._structArray.int16[this._pos2+10]}},{key:"verticalPlacedTextSymbolIndex",get:function(){return this._structArray.int16[this._pos2+11]}},{key:"placedIconSymbolIndex",get:function(){return this._structArray.int16[this._pos2+12]}},{key:"verticalPlacedIconSymbolIndex",get:function(){return this._structArray.int16[this._pos2+13]}},{key:"key",get:function(){return this._structArray.uint16[this._pos2+14]}},{key:"textBoxStartIndex",get:function(){return this._structArray.uint16[this._pos2+15]}},{key:"textBoxEndIndex",get:function(){return this._structArray.uint16[this._pos2+16]}},{key:"verticalTextBoxStartIndex",get:function(){return this._structArray.uint16[this._pos2+17]}},{key:"verticalTextBoxEndIndex",get:function(){return this._structArray.uint16[this._pos2+18]}},{key:"iconBoxStartIndex",get:function(){return this._structArray.uint16[this._pos2+19]}},{key:"iconBoxEndIndex",get:function(){return this._structArray.uint16[this._pos2+20]}},{key:"verticalIconBoxStartIndex",get:function(){return this._structArray.uint16[this._pos2+21]}},{key:"verticalIconBoxEndIndex",get:function(){return this._structArray.uint16[this._pos2+22]}},{key:"featureIndex",get:function(){return this._structArray.uint16[this._pos2+23]}},{key:"numHorizontalGlyphVertices",get:function(){return this._structArray.uint16[this._pos2+24]}},{key:"numVerticalGlyphVertices",get:function(){return this._structArray.uint16[this._pos2+25]}},{key:"numIconVertices",get:function(){return this._structArray.uint16[this._pos2+26]}},{key:"numVerticalIconVertices",get:function(){return this._structArray.uint16[this._pos2+27]}},{key:"useRuntimeCollisionCircles",get:function(){return this._structArray.uint16[this._pos2+28]}},{key:"crossTileID",get:function(){return this._structArray.uint32[this._pos4+15]},set:function(e){this._structArray.uint32[this._pos4+15]=e}},{key:"textOffset0",get:function(){return this._structArray.float32[this._pos4+16]}},{key:"textOffset1",get:function(){return this._structArray.float32[this._pos4+17]}},{key:"collisionCircleDiameter",get:function(){return this._structArray.float32[this._pos4+18]}}]),i}(Ya);Co.prototype.size=76;var Ao=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"get",value:function(e){return new Co(this,e)}}]),i}(_o);Bn(Ao,"SymbolInstanceArray");var zo=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"getoffsetX",value:function(e){return this.float32[1*e+0]}}]),i}(go);Bn(zo,"GlyphOffsetArray");var Po=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"getx",value:function(e){return this.int16[2*e+0]}}
1,{key:"gety",value:function(e){return this.int16[2*e+1]}}]),i}(Qa);Bn(Po,"SymbolLineVertexArray");var Do=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"featureIndex",get:function(){return this._structArray.uint32[this._pos4+0]}},{key:"sourceLayerIndex",get:function(){return this._structArray.uint16[this._pos2+2]}},{key:"bucketIndex",get:function(){return this._structArray.uint16[this._pos2+3]}},{key:"layoutVertexArrayOffset",get:function(){return this._structArray.uint16[this._pos2+4]}}]),i}(Ya);Do.prototype.size=12;var Lo=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"get",value:function(e){return new Do(this,e)}}]),i}(bo);Bn(Lo,"FeatureIndexArray");var Ro=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"geta_centroid_pos0",value:function(e){return this.uint16[2*e+0]}},{key:"geta_centroid_pos1",value:function(e){return this.uint16[2*e+1]}}]),i}(wo);Bn(Ro,"FillExtrusionCentroidArray");var Bo=Ja([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),Oo=Ja([{name:"a_dash",components:4,type:"Uint16"}]),Fo={},Uo={get exports(){return Fo},set exports(e){Fo=e}},Vo={};({get exports(){return Vo},set exports(e){Vo=e}}).exports=function(e,t){var i,r,n,a,o,s,l,u;for(r=e.length-(i=3&e.length),n=t,o=3432918353,s=461845907,u=0;u<r;)l=255&e.charCodeAt(u)|(255&e.charCodeAt(++u))<<8|(255&e.charCodeAt(++u))<<16|(255&e.charCodeAt(++u))<<24,++u,n=27492+(65535&(a=5*(65535&(n=(n^=l=(6
15535&(l=(l=(65535&l)*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<13|n>>>19))+((5*(n>>>16)&65535)<<16)&4294967295))+((58964+(a>>>16)&65535)<<16);switch(l=0,i){case 3:l^=(255&e.charCodeAt(u+2))<<16;case 2:l^=(255&e.charCodeAt(u+1))<<8;case 1:n^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(u)))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295}return n^=e.length,n=2246822507*(65535&(n^=n>>>16))+((2246822507*(n>>>16)&65535)<<16)&4294967295,n=3266489909*(65535&(n^=n>>>13))+((3266489909*(n>>>16)&65535)<<16)&4294967295,(n^=n>>>16)>>>0};var jo={};({get exports(){return jo},set exports(e){jo=e}}).exports=function(e,t){for(var i,r=e.length,n=t^r,a=0;r>=4;)i=1540483477*(65535&(i=255&e.charCodeAt(a)|(255&e.charCodeAt(++a))<<8|(255&e.charCodeAt(++a))<<16|(255&e.charCodeAt(++a))<<24))+((1540483477*(i>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),r-=4,++a;switch(r){case 3:n^=(255&e.charCodeAt(a+2))<<16;case 2:n^=(255&e.charCodeAt(a+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(a)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0};var No=Vo,Go=jo;Uo.exports=No,Fo.murmur3=No,Fo.murmur2=Go;var Zo=function(){function e(){h(this,e),this.ids=[],this.positions=[],this.indexed=!1}return d(e,[{key:"add",value:function(e,t,i,r){this.ids.push(qo(e)),this.positions.push(t,i,r)}},{key:"getPositions",value:function(e){for(var t=qo(e),i=0,r=this.ids.length-1;i<r;){var n=i+r>>1;this.ids[n]>=t?r=n:i=n+1}for(var a=[];this.ids[i]===t;)a.push({index:this.positions[3*i],start:this.positions[3*i+1],end:this.positions[3*i+2]}),i++;return a}}],[{key:"serialize",value:function(e,t){var i=new Float64Array(e.ids),r=new Uint32Array(e.positions);return Wo(i,r,0,i.length-1),t&&t.push(i.buffer,r.buffer),{ids:i,positions:r}}},{key:"deserialize",value:function(t){var i=new e;return i.ids=t.ids,i.positions=t.positions,i.indexed=!0,i}}]),e}();function qo(e){var t=+e;return!isNaN(t)&&Number.MIN_SAFE_INTEGER<=t&&t<=Number.MAX_SAFE_INTEGER?t:Fo(String(e))}function Wo(e,t,i,r){for(;i<r;){for(var n=e[i+r>>1],a=i-1,o=r+1;;){do{a++}while(e[a]<n);do{o--}while(e[o]>n);if(a>=o)break;Xo(e,a,o),Xo(t,3*a,3*o),Xo(t,3*a+1,3*o+1),Xo(t,3*a+2,3*o+2)}o-i<r-o?(Wo(e,t,i,o),i=o+1):(Wo(e,t,o+1,r),r=o)}}function Xo(e,t,i){var r=e[t];e[t]=e[i],e[i]=r}Bn(Zo,"FeaturePositionMap");var Ho=function(){function e(t){h(this,e),this.gl=t.gl,this.initialized=!1}return d(e,[{key:"fetchUniformLocation",value:function(e,t){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(e,t),this.initialized=!0),!!this.location}}]),e}(),Yo=function(e){p(i,e);var t=m(i);function i(e){var r;return h(this,i),(r=t.call(this,e)).current=0,r}return d(i,[{key:"set",value:function(e,t,i){this.fetchUniformLocation(e,t)&&this.current!==i&&(this.current=i,this.gl.uniform1f(this.location,i))}}]),i}(Ho),Ko=function(e){p(i,e);var t=m(i);function i(e){var r;return h(this,i),(r=t.call(this,e)).current=[0,0,0,0],r}return d(i,[{key:"set",value:function(e,t,i){this.fetchUniformLocation(e,t)&&(i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]&&i[3]===this.current[3]||(this.current=i,this.gl.uniform4f(this.location,i[0],i[1],i[2],i[3])))}}]),i}(Ho),Jo=function(e){p(i,e);var t=m(i);function i(e){var r;return h(this,i),(r=t.call(this,e)).current=jt.transparent,r}return d(i,[{key:"set",value:function(e,t,i){this.fetchUniformLocation(e,t)&&(i.r===this.current.r&&i.g===this.current.g&&i.b===this.current.b&&i.a===this.current.a||(this.current=i,this.gl.uniform4f(this.location,i.r,i.g,i.b,i.a)))}}]),i}(Ho),$o=new Float32Array(16),Qo=new Float32Array(9),es=new Float32Array(4);function ts(e){return[Xa(255*e.r,255*e.g),Xa(255*e.b,255*e.a)]}var is=function(){function e(t,i,r){h(this,e),this.value=t,this.uniformNames=i.map(function(e){return"u_".concat(e)}),this.type=r}return d(e,[{key:"setUniform",value:function(e,t,i,r,n){t.set(e,n,r.constantOr(this.value))}},{key:"getBinding",value:function(e,t){return"color"===this.type?new Jo(e):new Yo(e)}}]),e}(),rs=function(){function e(t,i){h(this,e),this.uniformNames=i.map(function(e){return"u_".concat(e)}),this.pattern=null,this.pixelRatio=1}return d(e,[{key:"setConstantPatternPositions",value:function(e){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br)}},{key:"setUniform",value:function(e,t,i,r,n){var a="u_pattern"===n||"u_dash"===n?this.pattern:"u_pixel_ratio"===n?this.pixelRatio:null;a&&t.set(e,n,a)}},{key:"getBinding",value:function(e,t){return"u_pattern"===t||"u_dash"===t?new Ko(e):new Yo(e)}}]),e}(),ns=function(){function e(t,i,r,n){h(this,e),this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=i.map(function(e){return{name:"a_".concat(e),type:"Float32",components:"color"===r?2:1,offset:0}}),this.paintVertexArray=new n}return d(e,[{key:"populatePaintArray",value:function(e,t,i,r,n,a){var o=this.paintVertexArray.length,s=this.expression.evaluate(new La(0),t,{},n,r,a);this.paintVertexArray.resize(e),this._setPaintValue(o,e,s)}},{key:"updatePaintArray",value:function(e,t,i,r,n){var a=this.expression.evaluate({zoom:0},i,r,void 0,n);this._setPaintValue(e,t,a)}},{key:"_setPaintValue",value:function(e,t,i){if("color"===this.type)for(var r=ts(i),n=e;n<t;n++)this.paintVertexArray.emplace(n,r[0],r[1]);else{for(var a=e;a<t;a++)this.paintVertexArray.emplace(a,i);this.maxValue=Math.max(this.maxValue,Math.abs(i))}}},{key:"upload",value:function(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))}},{key:"destroy",value:function(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}]),e}(),as=function(){function e(t,i,r,n,a,o){h(this,e),this.expression=t,this.uniformNames=i.map(function(e){return"u_".concat(e,"_t")}),this.type=r,this.useIntegerZoom=n,this.zoom=a,this.maxValue=0,this.paintVertexAttributes=i.map(function(e){return{name:"a_".concat(e),type:"Float32",components:"color"===r?4:2,offset:0}}),this.paintVertexArray=new o}return d(e,[{key:"populatePaintArray",value:function(e,t,i,r,n,a){var o=this.expression.evaluate(new La(this.zoom),t,{},n,r,a),s=this.expression.evaluate(new La(this.zoom+1),t,{},n,r,a),l=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(l,e,o,s)}},{key:"updatePaintArray",value:function(e,t,i,r,n){var a=this.expression.evaluate({zoom:this.zoom},i,r,void 0,n),o=this.expression.evaluate({zoom:this.zoom+1},i,r,void 0,n);this._setPaintValue(e,t,a,o)}},{key:"_setPaintValue",value:function(e,t,i,r){if("color"===this.type)for(var n=ts(i),a=ts(r),o=e;o<t;o++)this.paintVertexArray.emplace(o,n[0],n[1],a[0],a[1]);else{for(var s=e;s<t;s++)this.paintVertexArray.emplace(s,i,r);this.maxValue=Math.max(this.maxValue,Math.abs(i),Math.abs(r))}}},{key:"upload",value:function(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))}},{key:"destroy",value:function(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}},{key:"setUniform",value:function(e,t,i,r,n){var a=this.useIntegerZoom?Math.floor(i.zoom):i.zoom,o=j(this.expression.interpolationFactor(a,this.zoom,this.zoom+1),0,1);t.set(e,n,o)}},{key:"getBinding",value:function(e,t){return new Yo(e)}}]),e}(),os=function(){function e(t,i,r,n,a){h(this,e),this.expression=t,this.layerId=a,this.paintVertexAttributes=("array"===r?Oo:Bo).members;for(var o=0;o<i.length;++o);this.paintVertexArray=new n}return d(e,[{key:"populatePaintArray",value:function(e,t,i){var r=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValues(r,e,t.patterns&&t.patterns[this.layerId],i)}},{key:"updatePaintArray",value:function(e,t,i,r,n,a){this._setPaintValues(e,t,i.patterns&&i.patterns[this.layerId],a)}},{key:"_setPaintValues",value:function(e,t,i,r){if(r&&i){var n=r[i];if(n)for(var a=n.tl,o=n.br,s=n.pixelRatio,l=e;l<t;l++)this.paintVertexArray.emplace(l,a[0],a[1],o[0],o[1],s)}}},{key:"upload",value:function(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}},{key:"destroy",value:function(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}]),e}(),ss=function(){function e(t,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){return!0};h(this,e),this.binders={},this._buffers=[];var n=[];for(var a in t.paint._values)if(r(a)){var o=t.paint.get(a);if(o instanceof ja&&Tr(o.property.specification)){var s=cs(a,t.type),l=o.value,u=o.property.specification.type,c=!!o.property.useIntegerZoom,f="line-dasharray"===a||a.endsWith("pattern"),d="line-dasharray"===a&&"constant"!==t.layout.get("line-cap").value.kind;if("constant"!==l.kind||d)if("source"===l.kind||d||f){var p=ds(a,u,"source");this.binders[a]=f?new os(l,s,u,p,t.id):new ns(l,s,u,p),n.push("/a_".concat(a))}else{var m=ds(a,u,"composite");this.binders[a]=new as(l,s,u,c,i,m),n.push("/z_".concat(a))}else this.binders[a]=f?new rs(l.value,s):new is(l.value,s,u),n.push("/u_".concat(a))}}this.cacheKey=n.sort().join("")}return d(e,[{key:"getMaxValue",value:function(e){var t=this.binders[e];return t instanceof ns||t instanceof as?t.maxValue:0}},{key:"populatePaintArrays",value:function(e,t,i,r,n,a){for(var o in this.binders){var s=this.binders[o];(s instanceof ns||s instanceof as||s instanceof os)&&s.populatePaintArray(e,t,i,r,n,a)}}},{key:"setConstantPatternPositions",value:function(e){for(var t in this.binders){var i=this.binders[t];i instanceof rs&&i.setConstantPatternPositions(e)}}},{key:"updatePaintArrays",value:function(e,t,i,r,n,a){var o=!1;for(var s in e){var u,c=l(t.getPositions(s));try{for(c.s();!(u=c.n()).done;){var h=u.value,f=i.feature(h.index);for(var d in this.binders){var p=this.binders[d];if((p instanceof ns||p instanceof as||p instanceof os)&&!0===p.expression.isStateDependent){var m=r.paint.get(d);p.expression=m.value,p.updatePaintArray(h.start,h.end,f,e[s],n,a),o=!0}}}}catch(v){c.e(v)}finally{c.f()}}return o}},{key:"defines",value:function(){var e=[];for(var t in this.binders){var i=this.binders[t];(i instanceof is||i instanceof rs)&&e.push.apply(e,r(i.uniformNames.map(function(e){return"#define HAS_UNIFORM_".concat(e)})))}return e}},{key:"getBinderAttributes",value:function(){var e=[];for(var t in this.binders){var i=this.binders[t];if(i instanceof ns||i instanceof as||i instanceof os)for(var r=0;r<i.paintVertexAttributes.length;r++)e.push(i.paintVertexAttributes[r].name)}return e}},{key:"getBinderUniforms",value:function(){var e=[];for(var t in this.binders){var i=this.binders[t];if(i instanceof is||i instanceof rs||i instanceof as){var r,n=l(i.uniformNames);try{for(n.s();!(r=n.n()).done;){var a=r.value;e.push(a)}}catch(o){n.e(o)}finally{n.f()}}}return e}},{key:"getPaintVertexBuffers",value:function(){return this._buffers}},{key:"getUniforms",value:function(e){var t=[];for(var i in this.binders){var r=this.binders[i];if(r instanceof is||r instanceof rs||r instanceof as){var n,a=l(r.uniformNames);try{for(a.s();!(n=a.n()).done;){var o=n.value;t.push({name:o,property:i,binding:r.getBinding(e,o)})}}catch(s){a.e(s)}finally{a.f()}}}return t}},{key:"setUniforms",value:function(e,t,i,r,n){var a,o=l(i);try{for(o.s();!(a=o.n()).done;){var s=a.value,u=s.name,c=s.property,h=s.binding;this.binders[c].setUniform(e,h,n,r.get(c),u)}}catch(f){o.e(f)}finally{o.f()}}},{key:"updatePaintBuffers",value:function(){for(var e in this._buffers=[],this.binders){var t=this.binders[e];(t instanceof ns||t instanceof as||t instanceof os)&&t.paintVertexBuffer&&this._buffers.push(t.paintVertexBuffer)}}},{key:"upload",value:function(e){for(var t in this.binders){var i=this.binders[t];(i instanceof ns||i instanceof as||i instanceof os)&&i.upload(e)}this.updatePaintBuffers()}},{key:"destroy",value:function(){for(var e in this.binders){var t=this.binders[e];(t instanceof ns||t instanceof as||t instanceof os)&&t.destroy()}}}]),e}(),ls=function(){function e(t,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){return!0};h(this,e),this.programConfigurations={};var n,a=l(t);try{for(a.s();!(n=a.n()).done;){var o=n.value;this.programConfigurations[o.id]=new ss(o,i,r)}}catch(s){a.e(s)}finally{a.f()}this.needsUpload=!1,this._featureMap=new Zo,this._bufferOffset=0}return d(e,[{key:"populatePaintArrays",value:function(e,t,i,r,n,a,o){for(var s in this.programConfigurations)this.programConfigurations[s].populatePaintArrays(e,t,r,n,a,o);void 0!==t.id&&this._featureMap.add(t.id,i,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}},{key:"updatePaintArrays",value:function(e,t,i,r,n){var a,o=l(i);try{for(o.s();!(a=o.n()).done;){var s=a.value;this.needsUpload=this.programConfigurations[s.id].updatePaintArrays(e,this._featureMap,t,s,r,n)||this.needsUpload}}catch(u){o.e(u)}finally{o.f()}}},{key:"get",value:function(e){return this.programConfigurations[e]}},{key:"upload",value:function(e){if(this.needsUpload){for(var t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}},{key:"destroy",value:function(){for(var e in this.programConfigurations)this.programConfigurations[e].destroy()}}]),e}(),us={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["ga
1pwidth"],"line-pattern":["pattern","pixel_ratio"],"fill-pattern":["pattern","pixel_ratio"],"fill-extrusion-pattern":["pattern","pixel_ratio"],"line-dasharray":["dash"]};function cs(e,t){return us[e]||[e.replace("".concat(t,"-"),"").replace(/-/g,"_")]}var hs={"line-pattern":{source:no,composite:no},"fill-pattern":{source:no,composite:no},"fill-extrusion-pattern":{source:no,composite:no},"line-dasharray":{source:ao,composite:ao}},fs={color:{source:To,composite:ro},number:{source:go,composite:To}};function ds(e,t,i){var r=hs[e];return r&&r[i]||fs[t][i]}Bn(is,"ConstantBinder"),Bn(rs,"PatternConstantBinder"),Bn(ns,"SourceExpressionBinder"),Bn(os,"PatternCompositeBinder"),Bn(as,"CompositeExpressionBinder"),Bn(ss,"ProgramConfiguration",{omit:["_buffers"]}),Bn(ls,"ProgramConfigurationSet");var ps="-transition",ms=function(e){p(i,e);var t=m(i);function i(e,r){var n;if(h(this,i),(n=t.call(this)).id=e.id,n.type=e.type,n._featureFilter={filter:function(){return!0},needGeometry:!1,needFeature:!1},n._filterCompiled=!1,"custom"!==e.type&&(n.metadata=e.metadata,n.minzoom=e.minzoom,n.maxzoom=e.maxzoom,"background"!==e.type&&"sky"!==e.type&&(n.source=e.source,n.sourceLayer=e["source-layer"],n.filter=e.filter),r.layout&&(n._unevaluatedLayout=new Va(r.layout)),r.paint)){for(var a in n._transitionablePaint=new Oa(r.paint),e.paint)n.setPaintProperty(a,e.paint[a],{validate:!1});for(var o in e.layout)n.setLayoutProperty(o,e.layout[o],{validate:!1});n._transitioningPaint=n._transitionablePaint.untransitioned(),n.paint=new Na(r.paint)}return v(n)}return d(i,[{key:"getLayoutProperty",value:function(e){return"visibility"===e?this.visibility:this._unevaluatedLayout.getValue(e)}},{key:"setLayoutProperty",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};null!=t&&this._validate(An,"layers.".concat(this.id,".layout.").concat(e),e,t,i)||("visibility"!==e?this._unevaluatedLayout.setValue(e,t):this.visibility=t)}},{key:"getPaintProperty",value:function(e){return Q(e,ps)?this._transitionablePaint.getTransition(e.slice(0,-ps.length)):this._transitionablePaint.getValue(e)}},{key:"setPaintProperty",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null!=t&&this._validate(Cn,"layers.".concat(this.id,".paint.").concat(e),e,t,i))return!1;if(Q(e,ps))return this._transitionablePaint.setTransition(e.slice(0,-ps.length),t||void 0),!1;var r=this._transitionablePaint._values[e],n=r.value.isDataDriven(),a=r.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);var o=this._transitionablePaint._values[e].value,s=o.isDataDriven(),l=Q(e,"pattern")||"line-dasharray"===e;return s||n||l||this._handleOverridablePaintPropertyUpdate(e,a,o)}},{key:"_handleSpecialPaintPropertyUpdate",value:function(e){}},{key:"getProgramIds",value:function(){return null}},{key:"getProgramConfiguration",value:function(e){return null}},{key:"_handleOverridablePaintPropertyUpdate",value:function(e,t,i){return!1}},{key:"isHidden",value:function(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||"none"===this.visibility}},{key:"updateTransitions",value:function(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}},{key:"hasTransition",value:function(){return this._transitioningPaint.hasTransition()}},{key:"recalculate",value:function(e,t){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}},{key:"serialize",value:function(){var e={id:this.id,type:this.t
1ype,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),te(e,function(e,t){return!(void 0===e||"layout"===t&&!Object.keys(e).length||"paint"===t&&!Object.keys(e).length)})}},{key:"_validate",value:function(e,t,i,r){var n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return(!n||!1!==n.validate)&&Pn(this,e.call(In,{key:t,layerType:this.type,objectKey:i,value:r,styleSpec:ft,style:{glyphs:!0,sprite:!0}}))}},{key:"is3D",value:function(){return!1}},{key:"isSky",value:function(){return!1}},{key:"isTileClipped",value:function(){return!1}},{key:"hasOffscreenPass",value:function(){return!1}},{key:"resize",value:function(){}},{key:"isStateDependent",value:function(){for(var e in this.paint._values){var t=this.paint.get(e);if(t instanceof ja&&Tr(t.property.specification)&&("source"===t.value.kind||"composite"===t.value.kind)&&t.value.isStateDependent)return!0}return!1}},{key:"compileFilter",value:function(){this._filterCompiled||(this._featureFilter=Qr(this.filter),this._filterCompiled=!0)}},{key:"invalidateCompiledFilter",value:function(){this._filterCompiled=!1}},{key:"dynamicFilter",value:function(){return this._featureFilter.dynamicFilter}},{key:"dynamicFilterNeedsFeature",value:function(){return this._featureFilter.needFeature}}]),i}(ht),vs=Ja([{name:"a_pos",components:2,type:"Int16"}],4),ys=Ja([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),_s=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];h(this,e),this.segments=t}return d(e,[{key:"prepareSegment",value:function(t,i,r,n){var a=this.segments[this.segments.length-1];return t>e.MAX_VERTEX_ARRAY_LENGTH&&ne("Max vertices per segment is ".concat(e.MAX_VERTEX_ARRAY_LENGTH,": bucket requested ").concat(t)),(!a||a.vertexLength+t>e.MAX_VERTEX_ARRAY_LENGTH||a.sortKey!==n)&&(a={vertexOffset:i.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0},void 0!==n&&(a.sortKey=n),this.segments.push(a)),a}},{key:"get",value:function(){return this.segments}},{key:"destroy",value:function(){var e,t=l(this.segments);try{for(t.s();!(e=t.n()).done;){var i=e.value;for(var r in i.vaos)i.vaos[r].destroy()}}catch(n){t.e(n)}finally{t.f()}}}],[{key:"simpleSegment",value:function(t,i,r,n){return new e([{vertexOffset:t,primitiveOffset:i,vertexLength:r,primitiveLength:n,vaos:{},sortKey:0}])}}]),e}();_s.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Bn(_s,"SegmentVector");var gs=8192,xs=function(){function e(t,i){h(this,e),t&&(i?this.setSouthWest(t).setNorthEast(i):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))}return d(e,[{key:"setNorthEast",value:function(e){return this._ne=e instanceof Xl?new Xl(e.lng,e.lat):Xl.convert(e),this}},{key:"setSouthWest",value:function(e){return this._sw=e instanceof Xl?new Xl(e.lng,e.lat):Xl.convert(e),this}},{key:"extend",value:function(t){var i,r,n=this._sw,a=this._ne;if(t instanceof Xl)i=t,r=t;else{if(!(t instanceof e))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(e.convert(t)):this.extend(Xl.convert(t)):"object"==typeof t&&null!==t&&t.hasOwnProperty("lat")&&(t.hasOwnProperty("lon")||t.hasOwnProperty("lng"))?this.extend(Xl.convert(t)):this;if(i=t._sw,r=t._ne,!i||!r)return this}return n||a?(n.lng=Math.min(i.lng,n.lng),n.lat=Math.min(i.lat,n.lat),a.lng=Math.max(r.lng,a.lng),a.lat=Math.max(r.lat,a.lat)):(this._sw=new Xl(i.lng,i.lat),this._ne=new Xl(r.lng,r.lat)),this}},{key:"getCenter",value:function(){return new Xl((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}},{key:"getSouthWest",value:function(){return this._sw}},{key:"getNorthEast",value:function(){return this._ne}},{key:"getNorthWest",value:function(){return new Xl(this.getWest(),this.getNorth())}},{key:"getSouthEast",value:function(){return new Xl(this.getEast(),this.get
1South())}},{key:"getWest",value:function(){return this._sw.lng}},{key:"getSouth",value:function(){return this._sw.lat}},{key:"getEast",value:function(){return this._ne.lng}},{key:"getNorth",value:function(){return this._ne.lat}},{key:"toArray",value:function(){return[this._sw.toArray(),this._ne.toArray()]}},{key:"toString",value:function(){return"LngLatBounds(".concat(this._sw.toString(),", ").concat(this._ne.toString(),")")}},{key:"isEmpty",value:function(){return!(this._sw&&this._ne)}},{key:"contains",value:function(e){var t=Xl.convert(e),i=t.lng,r=t.lat,n=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&n}}],[{key:"convert",value:function(t){return!t||t instanceof e?t:new e(t)}}]),e}(),bs=1e-6,ws="undefined"!=typeof Float32Array?Float32Array:Array;function ks(){var e=new ws(9);return ws!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function Ts(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],f=i[0],d=i[1],p=i[2],m=i[3],v=i[4],y=i[5],_=i[6],g=i[7],x=i[8];return e[0]=f*r+d*o+p*u,e[1]=f*n+d*s+p*c,e[2]=f*a+d*l+p*h,e[3]=m*r+v*o+y*u,e[4]=m*n+v*s+y*c,e[5]=m*a+v*l+y*h,e[6]=_*r+g*o+x*u,e[7]=_*n+g*s+x*c,e[8]=_*a+g*l+x*h,e}function Es(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Ms(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],c=t[8],h=t[9],f=t[10],d=t[11],p=t[12],m=t[13],v=t[14],y=t[15],_=i*s-r*o,g=i*l-n*o,x=i*u-a*o,b=r*l-n*s,w=r*u-a*s,k=n*u-a*l,T=c*m-h*p,E=c*v-f*p,M=c*y-d*p,S=h*v-f*m,I=h*y-d*m,C=f*y-d*v,A=_*C-g*I+x*S+b*M-w*E+k*T;return A?(e[0]=(s*C-l*I+u*S)*(A=1/A),e[1]=(n*I-r*C-a*S)*A,e[2]=(m*k-v*w+y*b)*A,e[3]=(f*w-h*k-d*b)*A,e[4]=(l*M-o*C-u*E)*A,e[5]=(i*C-n*M+a*E)*A,e[6]=(v*x-p*k-y*g)*A,e[7]=(c*k-f*x+d*g)*A,e[8]=(o*I-s*M+u*T)*A,e[9]=(r*M-i*I-a*T)*A,e[10]=(p*w-m*x+y*_)*A,e[11]=(h*x-c*w-d*_)*A,e[12]=(s*E-o*S-l*T)*A,e[13]=(i*S-r*E+n*T)*A,e[14]=(m*g-p*b-v*_)*A,e[15]=(c*b-h*g+f*_)*A,e):null}function Ss(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],f=t[9],d=t[10],p=t[11],m=t[12],v=t[13],y=t[14],_=t[15],g=i[0],x=i[1],b=i[2],w=i[3];return e[0]=g*r+x*s+b*h+w*m,e[1]=g*n+x*l+b*f+w*v,e[2]=g*a+x*u+b*d+w*y,e[3]=g*o+x*c+b*p+w*_,e[4]=(g=i[4])*r+(x=i[5])*s+(b=i[6])*h+(w=i[7])*m,e[5]=g*n+x*l+b*f+w*v,e[6]=g*a+x*u+b*d+w*y,e[7]=g*o+x*c+b*p+w*_,e[8]=(g=i[8])*r+(x=i[9])*s+(b=i[10])*h+(w=i[11])*m,e[9]=g*n+x*l+b*f+w*v,e[10]=g*a+x*u+b*d+w*y,e[11]=g*o+x*c+b*p+w*_,e[12]=(g=i[12])*r+(x=i[13])*s+(b=i[14])*h+(w=i[15])*m,e[13]=g*n+x*l+b*f+w*v,e[14]=g*a+x*u+b*d+w*y,e[15]=g*o+x*c+b*p+w*_,e}function Is(e,t,i){var r,n,a,o,s,l,u,c,h,f,d,p,m=i[0],v=i[1],y=i[2];return t===e?(e[12]=t[0]*m+t[4]*v+t[8]*y+t[12],e[13]=t[1]*m+t[5]*v+t[9]*y+t[13],e[14]=t[2]*m+t[6]*v+t[10]*y+t[14],e[15]=t[3]*m+t[7]*v+t[11]*y+t[15]):(n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],f=t[9],d=t[10],p=t[11],e[0]=r=t[0],e[1]=n,e[2]=a,e[3]=o,e[4]=s,e[5]=l,e[6]=u,e[7]=c,e[8]=h,e[9]=f,e[10]=d,e[11]=p,e[12]=r*m+s*v+h*y+t[12],e[13]=n*m+l*v+f*y+t[13],e[14]=a*m+u*v+d*y+t[14],e[15]=o*m+c*v+p*y+t[15]),e}function Cs(e,t,i){var r=i[0],n=i[1],a=i[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function As(e,t,i){var r=Math.sin(i),n=Math.cos(i),a=t[4],o=t[5],s=t[6],l=t[7],u=t[8],c=t[9],h=t[10],f=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=a*n+u*r,e[5]=o*n+c*r,e[6]=s*n+h*r,e[7]=l*n+f*r,e[8]=u*n-a*r,e[9]=c*n-o*r,e[10]=h*n-s*r,e[11]=f*n-l*r,e}function zs(e,t,i){var r=Math.sin(i),n=Math.cos(i),a=t[0],o=t[1],s=t[2],l=t[3],u=t[8],c=t[9],h=t[10],f=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*n-u*r,e[1]=o*n-c*r,e[2]=s*n-h*r,e[3]=l*n-f*r,e[8]=a*r+u*n,e[9]=o*r+c*n,e[10]=s*r+h*n,e[11]=l*r+f*n,e}function Ps(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10
1]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Ds(e,t,i){var r,n,a,o=i[0],s=i[1],l=i[2],u=Math.hypot(o,s,l);return u<bs?null:(o*=u=1/u,s*=u,l*=u,r=Math.sin(t),n=Math.cos(t),e[0]=o*o*(a=1-n)+n,e[1]=s*o*a+l*r,e[2]=l*o*a-s*r,e[3]=0,e[4]=o*s*a-l*r,e[5]=s*s*a+n,e[6]=l*s*a+o*r,e[7]=0,e[8]=o*l*a+s*r,e[9]=s*l*a-o*r,e[10]=l*l*a+n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var Ls=Ss;function Rs(){var e=new ws(3);return ws!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Bs(e){var t=new ws(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Os(e){return Math.hypot(e[0],e[1],e[2])}function Fs(e,t,i){var r=new ws(3);return r[0]=e,r[1]=t,r[2]=i,r}function Us(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e}function Vs(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e}function js(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e}function Ns(e,t,i){return e[0]=Math.min(t[0],i[0]),e[1]=Math.min(t[1],i[1]),e[2]=Math.min(t[2],i[2]),e}function Gs(e,t,i){return e[0]=Math.max(t[0],i[0]),e[1]=Math.max(t[1],i[1]),e[2]=Math.max(t[2],i[2]),e}function Zs(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function qs(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e}function Ws(e,t){var i=t[0],r=t[1],n=t[2],a=i*i+r*r+n*n;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e}function Xs(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Hs(e,t,i){var r=t[0],n=t[1],a=t[2],o=i[0],s=i[1],l=i[2];return e[0]=n*l-a*s,e[1]=a*o-r*l,e[2]=r*s-n*o,e}function Ys(e,t,i){var r=t[0],n=t[1],a=t[2],o=i[3]*r+i[7]*n+i[11]*a+i[15];return e[0]=(i[0]*r+i[4]*n+i[8]*a+i[12])/(o=o||1),e[1]=(i[1]*r+i[5]*n+i[9]*a+i[13])/o,e[2]=(i[2]*r+i[6]*n+i[10]*a+i[14])/o,e}function Ks(e,t,i){var r=i[0],n=i[1],a=i[2],o=t[0],s=t[1],l=t[2],u=n*l-a*s,c=a*o-r*l,h=r*s-n*o,f=n*h-a*c,d=a*u-r*h,p=r*c-n*u,m=2*i[3];return c*=m,h*=m,d*=2,p*=2,e[0]=o+(u*=m)+(f*=2),e[1]=s+c+d,e[2]=l+h+p,e}var Js,$s=Vs,Qs=js,el=Os;function tl(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e}function il(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=i*i+r*r+n*n+a*a;return o>0&&(o=1/Math.sqrt(o)),e[0]=i*o,e[1]=r*o,e[2]=n*o,e[3]=a*o,e}function rl(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3];return e[0]=i[0]*r+i[4]*n+i[8]*a+i[12]*o,e[1]=i[1]*r+i[5]*n+i[9]*a+i[13]*o,e[2]=i[2]*r+i[6]*n+i[10]*a+i[14]*o,e[3]=i[3]*r+i[7]*n+i[11]*a+i[15]*o,e}function nl(){var e=new ws(4);return ws!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function al(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function ol(e,t,i){i*=.5;var r=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(i),l=Math.cos(i);return e[0]=r*l+o*s,e[1]=n*l+a*s,e[2]=a*l-n*s,e[3]=o*l-r*s,e}function sl(e,t,i){i*=.5;var r=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(i),l=Math.cos(i);return e[0]=r*l-a*s,e[1]=n*l+o*s,e[2]=a*l+r*s,e[3]=o*l-n*s,e}Rs(),Js=new ws(4),ws!=Float32Array&&(Js[0]=0,Js[1]=0,Js[2]=0,Js[3]=0);var ll=il;Rs(),Fs(1,0,0),Fs(0,1,0),nl(),nl(),ks();var ul=Ja([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]).members,cl=Ja([{name:"a_pos_3",components:3,type:"Int16"}]),hl=Ja([{name:"a_pos",type:"Int16",components:2}]),fl=function(){function e(t,i){h(this,e),this.pos=t,this.dir=i}return d(e,[{key:"intersectsPlane",value:function(e,t,i){var r=Xs(t,this.dir);if(Math.abs(r)<1e-6)return!1;var n=((e[0]-this.pos[0])*t[0]+(e[1]-this.pos[1])*t[1]+(e[2]-this.pos[2])*t[2])/r;return i[0]=this.pos[0]+this.dir[0]*n,i[1]=this.pos[1]+this.dir[1]*n,i[2]=this.pos[2]+this.dir[2]*n,!0}},{key:"closestPointOnSphere",value:function(e,t,i){if(o=(r=this.pos)[0],s=r[1],l=r[2],u=(n=e)[0],c=n[1],h=n[2],Math.abs(o-u)<=bs*Math.max(1,Math.abs(o),Math.abs(u))&&Math.abs(s-c)<=bs*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(l-h)<=bs*Math.max(1,Math.abs(l),Math.abs(h))||0===t)return i[0]=i[1]=i[2]=0,!1;var r,n,o,s,l,u,c,h,f=a(this.dir,3),d=f[0],p=f[1],m=f[2],v=this.pos[0]-e[0],y=this.pos[1]-e[1],_=this.pos[2]-e[2],g=d*d+p*p+m*m,x=2*(v*d+y*p+_*m),b=x*x-4*g*(v*v+y*y+_*_-t*t);if(b<0){var w=Math.max(-x/2,0),k=v+d*w,T=y+p*w,E=_+m*w,M=Math.hypot(k,T,E);return i[0]=k*t/M,i[1]=T*t/M,i[2]=E*t/M,!1}var S=(-x-Math.sqrt(b))/(2*g);if(S<0){var I=Math.hypot(v,y,_);return i[0]=v*t/I,i[1]=y*t/I,i[2]=_*t/I,!1}return i[0]=v+d*S,i[1]=y+p*S,i[2]=_+m*S,!0}}]),e}(),dl=function(){function e(t,i,r,n,a){h(this,e),this.TL=t,this.TR=i,this.BR=r,this.BL=n,this.horizon=a}return d(e,null,[{key:"fromInvProjectionMatrix",value:function(t,i,r){var n=[-1,1,1],a=[1,1,1],o=[1,-1,1],s=[-1,-1,1];return new e(Ys(n,n,t),Ys(a,a,t),Ys(o,o,t),Ys(s,s,t),i/r)}}]),e}(),pl=function(){function e(t,i){h(this,e),this.points=t,this.planes=i}return d(e,null,[{key:"fromInvProjectionMatrix",value:function(t,i,r,n){var a=Math.pow(2,r),o=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(function(e){var r,o,s,l=rl([],e,t),u=1/l[3]/i*a;return(r=l)[0]=(o=l)[0]*(s=[u,u,n?1/l[3]:u,u])[0],r[1]=o[1]*s[1],r[2]=o[2]*s[2],r[3]=o[3]*s[3],r}),s=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(function(e){var t=Ws([],Hs([],$s([],o[e[0]],o[e[1]]),$s([],o[e[2]],o[e[1]]))),i=-Xs(t,o[e[1]]);return t.concat(i)});return new e(o,s)}}]),e}(),ml=function(){function e(t,i){h(this,e),this.min=t,this.max=i,this.center=Zs([],Us([],this.min,this.max),.5)}return d(e,[{key:"quadrant",value:function(t){for(var i=[t%2==0,t<2],r=Bs(this.min),n=Bs(this.max),a=0;a<i.length;a++)r[a]=i[a]?this.min[a]:this.center[a],n[a]=i[a]?this.center[a]:this.max[a];return n[2]=this.max[2],new e(r,n)}},{key:"distanceX",value:function(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}},{key:"distanceY",value:function(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}},{key:"distanceZ",value:function(e){return Math.max(Math.min(this.max[2],e[2]),this.min[2])-e[2]}},{key:"getCorners",value:function(){var e=this.min,t=this.max;return[[e[0],e[1],e[2]],[t[0],e[1],e[2]],[t[0],t[1],e[2]],[e[0],t[1],e[2]],[e[0],e[1],t[2]],[t[0],e[1],t[2]],[t[0],t[1],t[2]],[e[0],t[1],t[2]]]}},{key:"intersects",value:function(e){for(var t=this.getCorners(),i=!0,r=0;r<e.planes.length;
1r++){for(var n=e.planes[r],a=0,o=0;o<t.length;o++)a+=Xs(n,t[o])+n[3]>=0;if(0===a)return 0;a!==t.length&&(i=!1)}if(i)return 2;for(var s=0;s<3;s++){for(var l=Number.MAX_VALUE,u=-Number.MAX_VALUE,c=0;c<e.points.length;c++){var h=e.points[c][s]-this.min[s];l=Math.min(l,h),u=Math.max(u,h)}if(u<0||l>this.max[s]-this.min[s])return 0}return 1}}],[{key:"fromPoints",value:function(t){var i,r=[1/0,1/0,1/0],n=[-1/0,-1/0,-1/0],a=l(t);try{for(a.s();!(i=a.n()).done;){var o=i.value;Ns(r,r,o),Gs(n,n,o)}}catch(s){a.e(s)}finally{a.f()}return new e(r,n)}},{key:"applyTransform",value:function(t,i){for(var r=t.getCorners(),n=0;n<r.length;++n)Ys(r[n],r[n],i);return e.fromPoints(r)}}]),e}(),vl=gs/Math.PI/2,yl=[64,32,16],_l=-vl,gl=vl,xl=[new ml([_l,_l,_l],[gl,gl,gl]),new ml([_l,_l,_l],[0,0,gl]),new ml([0,_l,_l],[gl,0,gl]),new ml([_l,0,_l],[0,gl,gl]),new ml([0,0,_l],[gl,gl,gl])];function bl(e){return e*vl/ql}function wl(e,t,i){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],n=Zs([],e._camera.position,e.worldSize),a=[t,i,1,1];rl(a,a,e.pixelMatrixInverse),tl(a,a,1/a[3]);var o=Ws([],$s([],a,n)),s=e.globeMatrix,l=[s[12],s[13],s[14]],u=$s([],l,n),c=Os(u),h=Ws([],u),f=e.worldSize/(2*Math.PI),d=Xs(h,o),p=Math.asin(f/c);if(p<Math.acos(d)){if(!r)return null;var m=[],v=[];Zs(m,o,c/d),Ws(v,$s(v,m,u)),Ws(o,Us(o,u,Zs(o,v,Math.tan(p)*c)))}var y=[];new fl(n,o).closestPointOnSphere(l,f,y);var _=Ws([],fe(s,0)),g=Ws([],fe(s,1)),x=Ws([],fe(s,2)),b=Xs(_,y),w=Xs(g,y),k=Xs(x,y),T=B(Math.asin(-w/f)),E=B(Math.atan2(b,k)),M=Yl(E=e.center.lng+function(e,t){var i=(t-e+180)%360-180;return i<-180?i+360:i}(e.center.lng,E)),S=j(Kl(T),0,1);return new ru(M,S)}var kl=d(function e(t,i,r){h(this,e),this.a=$s([],t,r),this.b=$s([],i,r),this.center=r;var n=Ws([],this.a),a=Ws([],this.b);this.angle=Math.acos(Xs(n,a))});function Tl(e,t){return 0===e.angle?null:(i=0===e.a[t]?1/e.angle*.5*Math.PI:1/e.angle*Math.atan(e.b[t]/e.a[t]/Math.sin(e.angle)-1/Math.tan(e.angle)))<0||i>1?null:function(e,t,i,r){var n=Math.sin(i);return e*(Math.sin((1-r)*i)/n)+t*(Math.sin(r*i)/n)}(e.a[t],e.b[t],e.angle,j(i,0,1))+e.center[t];var i}function El(e){if(e.z<=1)return xl[e.z+2*e.y+e.x];var t=Al(Cl(e));return ml.fromPoints(t)}function Ml(e,t,i){return Zs(e,e,1-i),qs(e,e,t,i)}function Sl(e,t){var i=Ul(t.zoom);if(0===i)return El(e);var r=Cl(e),n=Al(r),a=Yl(r.getWest())*t.worldSize,o=Yl(r.getEast())*t.worldSize,s=Kl(r.getNorth())*t.worldSize,l=Kl(r.getSouth())*t.worldSize,u=[a,s,0],c=[o,s,0],h=[a,l,0],f=[o,l,0],d=Ms([],t.globeMatrix);return Ys(u,u,d),Ys(c,c,d),Ys(h,h,d),Ys(f,f,d),n[0]=Ml(n[0],h,i),n[1]=Ml(n[1],f,i),n[2]=Ml(n[2],c,i),n[3]=Ml(n[3],u,i),ml.fromPoints(n)}function Il(e,t,i){var r,n=l(e);try{for(n.s();!(r=n.n()).done;){var a=r.value;Ys(a,a,t),Zs(a,a,i)}}catch(o){n.e(o)}finally{n.f()}}function Cl(e){var t=e.x,i=e.y,r=1/(1<<e.z),n=new Xl($l(t*r),Ql((i+1)*r)),a=new Xl($l((t+1)*r),Ql(i*r));return new xs(n,a)}function Al(e){var t=R(e.getNorth()),i=R(e.getSouth()),r=Math.cos(t),n=Math.cos(i),a=Math.sin(t),o=Math.sin(i),s=e.getWest(),l=e.getEast();return[zl(n,o,s),zl(n,o,l),zl(r,a,l),zl(r,a,s)]}function zl(e,t,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:vl;return i=R(i),[e*Math.sin(i)*r,-t*r,e*Math.cos(i)*r]}
1function Pl(e,t,i){return zl(Math.cos(R(e)),Math.sin(R(e)),t,i)}function Dl(e,t,i,r){var n=1<<i.z,a=(e/gs+i.x)/n;return Pl(Ql((t/gs+i.y)/n),$l(a),r)}function Ll(e){var t=e.min,i=e.max;return 16383/Math.max(i[0]-t[0],i[1]-t[1],i[2]-t[2])}var Rl=new Float64Array(16);function Bl(e){var t,i,r=Ll(e),n=Ps(Rl,[r,r,r]);return Is(n,n,((t=[])[0]=-(i=e.min)[0],t[1]=-i[1],t[2]=-i[2],t))}function Ol(e){var t,i,r=(i=e.min,(t=Rl)[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=i[0],t[13]=i[1],t[14]=i[2],t[15]=1,t),n=1/Ll(e);return Cs(r,r,[n,n,n])}function Fl(e,t,i,r,n){var a=function(e){var t=gs/(2*Math.PI);return e/(2*Math.PI)/t}(i),o=[e,t,-i/(2*Math.PI)],s=Es(new Float64Array(16));return Is(s,s,o),Cs(s,s,[a,a,a]),As(s,s,R(-n)),zs(s,s,R(-r)),s}function Ul(e){return N(5,6,e)}function Vl(e,t){var i,r,n,a,o,s,l,u,c,h,f=Pl(t.lat,t.lng);return n=(i=Vs([],function(e){var t=Pl(e._center.lat,e._center.lng),i=Hs([],Fs(0,1,0),t),r=Ds([],-e.angle,t);i=Ys(i,i,r),Ds(r,-e._pitch,i);var n=Ws([],t);return Zs(n,n,bl(e.cameraToCenterDistance/e.pixelsPerMeter)),Ys(n,n,r),Us([],t,n)}(e),f))[0],a=i[1],o=i[2],s=(r=f)[0],l=r[1],u=r[2],h=(c=Math.sqrt(n*n+a*a+o*o)*Math.sqrt(s*s+l*l+u*u))&&Xs(i,r)/c,Math.acos(Math.min(Math.max(h,-1),1))}function jl(e,t){return Vl(e,t)>Math.PI/2*1.01}var Nl=R(85),Gl=Math.cos(Nl),Zl=Math.sin(Nl),ql=6371008.8,Wl=2*Math.PI*ql,Xl=function(){function e(t,i){if(h(this,e),isNaN(t)||isNaN(i))throw new Error("Invalid LngLat object: (".concat(t,", ").concat(i,")"));if(this.lng=+t,this.lat=+i,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}return d(e,[{key:"wrap",value:function(){return new e(G(this.lng,-180,180),this.lat)}},{key:"toArray",value:function(){return[this.lng,this.lat]}},{key:"toString",value:function(){return"LngLat(".concat(this.lng,", ").concat(this.lat,")")}},{key:"distanceTo",value:function(e){var t=Math.PI/180,i=this.lat*t,r=e.lat*t,n=Math.sin(i)*Math.sin(r)+Math.cos(i)*Math.cos(r)*Math.cos((e.lng-this.lng)*t);return ql*Math.acos(Math.min(n,1))}},{key:"toBounds",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=360*t/40075017,r=i/Math.cos(Math.PI/180*this.lat);return new xs(new e(this.lng-r,this.lat-i),new e(this.lng+r,this.lat+i))}},{key:"toEcef",value:function(e){var t=bl(e);return Pl(this.lat,this.lng,vl+t)}}],[{key:"convert",value:function(t){if(t instanceof e)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new e(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new e(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}]),e}();function Hl(e){return Wl*Math.cos(e*Math.PI/180)}function Yl(e){return(180+e)/360}function Kl(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Jl(e,t){return e/Hl(t)}function $l(e){return 360*e-180}function Ql(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function eu(e,t){return e*Hl(Ql(t))}var tu=85.051129;function iu(e){return 1/Math.cos(e*Math.PI/180)}var ru=function(){function e(t,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;h(this,e),this.x=+t,this.y=+i,this.z=+r}return d(e,[{key:"toLngLat",value:function(){return new Xl($l(this.x),Ql(this.y))}},{key:"toAltitude",value:function(){return eu(this.z,this.y)}},{key:"meterInMercatorCoordinateUnits",value:function(){return 1/Wl*iu(Ql(this.y))}}],[{key:"fromLngLat",value:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=Xl.convert(t);return new e(Yl(r.lng),Kl(r.lat),Jl(i,r.lat))}}]),e}();function nu(e,t,i,r,n,a,o,s,l){var u,c,h,f,d,p,m,v,y=(t+r)/2,_=(i+n)/2,g=new z(y,_);s(g),u=g.x,c=g.y,h=a.x,f=a.y,d=o.x,p=o.y,m=h-d,v=f-p,Math.abs((f-c)*m-(h-u)*v)/Math.hypot(m,v)>=l?(nu(e,t,i,y,_,a,g,s,l),nu(e,y,_,r,n,g,o,s,l)):e.push(o)}function au(e,t,i){var r=e[0],n=r.x,a=r.y;t(r);for(var o=[r],s=1;s<e.length;s++){var l=e[s],u=l.x,c=l.y;t(l),nu(o,n,a,u,c,r,l,t,i),n=u,a=c,r=l}return o}function ou(e,t,i,r){if(r(t,i)){var n=t.add(i)._mult(.5);ou(e,t,n,r),ou(e,n,i,r)}else e.push(i)}function su(e,t){for(var i=e[0],r=[i],n=1;n<e.length;n++){var a=e[n];ou(r,i,a,t),i=a}return r}var lu=Math.pow(2,14)-1,uu=-lu-1;function cu(e,t){var i=Math.round(e.x*t),r=Math.round(e.y*t);return e.x=j(i,uu,lu),e.y=j(r,uu,lu),(i<e.x||i>e.x+1||r<e.y||r>e.y+1)&&ne("Geometry exceeds allowed extent, reduce your vector tile buffer size"),e}function hu(e,t,i){var r=e.loadGeometry(),n=e.extent,a=gs/n;if(t&&i&&i.projection.isReprojectedInTileSpace)for(var o=1<<t.z,s=i.scale,u=i.x,c=i.y,h=i.projection,f=function(e){var i=$l((t.x+e.x/n)/o),r=Ql((t.y+e.y/n)/o),a=h.project(i,r);e.x=(a.x*s-u)*n,e.y=(a.y*s-c)*n},d=0;d<r.length;d++)if(1!==e.type)r[d]=au(r[d],f,1);else{var p,m=[],v=l(r[d]);try{for(v.s();!(p=v.n()).done;){var y=p.value;y.x<0||y.x>=n||y.y<0||y.y>=n||(f(y),m.push(y))}}catch(w){v.e(w)}finally{v.f()}r[d]=m}var _,g=l(r);try{for(g.s();!(_=g.n()).done;){var x,b=l(_.value);try{for(b.s();!(x=b.n()).done;){cu(x.value,a)}}catch(w){b.e(w)}finally{b.f()}}}catch(w){g.e(w)}finally{g.f()}return r}function fu(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?hu(e):[]}}function du(e,t,i,r,n){e.emplaceBack(2*t+(r+1)/2,2*i+(n+1)/2)}function pu(e,t,i){var r=16384;e.emplaceBack(t.x,t.y,t.z,i[0]*r,i[1]*r,i[2]*r)}var mu=function(){function e(t){h(this,e),this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(e){return e.id}),this.index=t.index,this.hasPattern=!1,this.projection=t.projection,this.layoutVertexArray=new Qa,this.indexArray=new vo,this.segments=new _s,this.programConfigurations=new ls(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(function(e){return e.isStateDependent()}).map(function(e){return e.id})}return d(e,[{key:"populate",value:function(e,t,i,r){var n=this.layers[0],a=[],o=null;
1"circle"===n.type&&(o=n.layout.get("circle-sort-key"));var s,u=l(e);try{for(u.s();!(s=u.n()).done;){var c=s.value,h=c.feature,f=c.id,d=c.index,p=c.sourceLayerIndex,m=this.layers[0]._featureFilter.needGeometry,v=fu(h,m);if(this.layers[0]._featureFilter.filter(new La(this.zoom),v,i)){var y=o?o.evaluate(v,{},i):void 0,_={id:f,properties:h.properties,type:h.type,sourceLayerIndex:p,index:d,geometry:m?v.geometry:hu(h,i,r),patterns:{},sortKey:y};a.push(_)}}}catch(S){u.e(S)}finally{u.f()}o&&a.sort(function(e,t){return e.sortKey-t.sortKey});var g=null;"globe"===r.projection.name&&(this.globeExtVertexArray=new oo,g=r.projection);for(var x=0,b=a;x<b.length;x++){var w=b[x],k=w.geometry,T=w.index,E=w.sourceLayerIndex,M=e[T].feature;this.addFeature(w,k,T,t.availableImages,i,g),t.featureIndex.insert(M,k,T,E,this.index)}}},{key:"update",value:function(e,t,i,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i,r)}},{key:"isEmpty",value:function(){return 0===this.layoutVertexArray.length}},{key:"uploadPending",value:function(){return!this.uploaded||this.programConfigurations.needsUpload}},{key:"upload",value:function(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,vs.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,ys.members))),this.programConfigurations.upload(e),this.uploaded=!0}},{key:"destroy",value:function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}},{key:"addFeature",value:function(e,t,i,r,n,a){var o,s=l(t);try{for(s.s();!(o=s.n()).done;){var u,c=l(o.value);try{for(c.s();!(u=c.n()).done;){var h=u.value,f=h.x,d=h.y;if(!(f<0||f>=gs||d<0||d>=gs)){if(a){var p=a.projectTilePoint(f,d,n),m=a.upVector(n,f,d),v=this.globeExtVertexArray;pu(v,p,m),pu(v,p,m),pu(v,p,m),pu(v,p,m)}var y=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),_=y.vertexLength;du(this.layoutVertexArray,f,d,-1,-1),du(this.layoutVertexArray,f,d,1,-1),du(this.layoutVertexArray,f,d,1,1),du(this.layoutVertexArray,f,d,-1,1),this.indexArray.emplaceBack(_,_+1,_+2),this.indexArray.emplaceBack(_,_+2,_+3),y.vertexLength+=4,y.primitiveLength+=2}}}catch(g){c.e(g)}finally{c.f()}}}catch(g){s.e(g)}finally{s.f()}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{},r,n)}}]),e}();function vu(e,t){for(var i=0;i<e.length;i++)if(Eu(t,e[i]))return!0;for(var r=0;r<t.length;r++)if(Eu(e,t[r]))return!0;return!!xu(e,t)}function yu(e,t,i){return!!Eu(e,t)||!!wu(t,e,i)}function _u(e,t){if(1===e.length)return Tu(t,e[0]);for(var i=0;i<t.length;i++)for(var r=t[i],n=0;n<r.length;n++)if(Eu(e,r[n]))return!0;for(var a=0;a<e.length;a++)if(Tu(t,e[a]))return!0;for(var o=0;o<t.length;o++)if(xu(e,t[o]))return!0;return!1}function gu(e,t,i){if(e.length>1){if(xu(e,t))return!0;for(var r=0;r<t.length;r++)if(wu(t[r],e,i))return!0}for(var n=0;n<e.length;n++)if(wu(e[n],t,i))return!0;return!1}function xu(e,t){if(0===e.length||0===t.length)return!1;for(var i=0;i<e.length-1;i++)for(var r=e[i],n=e[i+1],a=0;a<t.length-1;a++)if(bu(r,n,t[a],t[a+1]))return!0;return!1}function bu(e,t,i,r){return ae(e,i,r)!==ae(t,i,r)&&ae(e,t,i)!==ae(e,t,r)}function wu(e,t,i){var r=i*i;if(1===t.length)return e.distSqr(t[0])<r;for(var n=1;n<t.length;n++)if(ku(e,t[n-1],t[n])<r)return!0;return!1}function ku(e,t,i){var r=t.distSqr(i);if(0===r)return e.distSqr(t);var n=((e.x-t.x)*(i.x-t.x)+(e.y-t.y)*(i.y-t.y))/r;return e.distSqr(n<0?t:n>1?i:i.sub(t)._mult(n)._add(t))}function Tu(e,t){for(var i,r,n,a=!1,o=0;o<e.length;o++)for(var s=0,l=(i=e[o]).length-1;s<i.length;l=s++)r=i[s],n=i[l],r.y>t.y!=n.y>t.y&&t.x<(n.x-r.x)*(t.y-r.y)/(n.y-r.y)+r.x&&(a=!a);return a}function Eu(e,t){for(var i=!1,r=0,n=e.length-1;r<e.length;n=r++){var a=e[r],o=e[n];a.y>t.y!=o.y>t.y&&t.x<(o.x-a.x)*(t.y-a.y)/(o.y-a.y)+a.x&&(i=!i)}return i}function Mu(e,t,i,r,n){var a,o=l(e);try{for(o.s();!(a=o.n()).done;){var s=a.value;if(t<=s.x&&i<=s.y&&r>=s.x&&n>=s.y)return!0}}catch(d){o.e(d)}finally{o.f()}
1var u=[new z(t,i),new z(t,n),new z(r,n),new z(r,i)];if(e.length>2){var c,h=l(u);try{for(h.s();!(c=h.n()).done;){if(Eu(e,c.value))return!0}}catch(d){h.e(d)}finally{h.f()}}for(var f=0;f<e.length-1;f++)if(Su(e[f],e[f+1],u))return!0;return!1}function Su(e,t,i){var r=i[0],n=i[2];if(e.x<r.x&&t.x<r.x||e.x>n.x&&t.x>n.x||e.y<r.y&&t.y<r.y||e.y>n.y&&t.y>n.y)return!1;var a=ae(e,t,i[0]);return a!==ae(e,t,i[1])||a!==ae(e,t,i[2])||a!==ae(e,t,i[3])}function Iu(e,t,i){var r=t.paint.get(e).value;return"constant"===r.kind?r.value:i.programConfigurations.get(t.id).getMaxValue(e)}function Cu(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function Au(e,t,i,r,n){if(!t[0]&&!t[1])return e;var a=z.convert(t)._mult(n);"viewport"===i&&a._rotate(-r);for(var o=[],s=0;s<e.length;s++)o.push(e[s].sub(a));return o}function zu(e,t,i,r){var n=z.convert(e)._mult(r);return"viewport"===t&&n._rotate(-i),n}Bn(mu,"CircleBucket",{omit:["layers"]});var Pu=new Wa({"circle-sort-key":new Za(ft.layout_circle["circle-sort-key"])}),Du={paint:new Wa({"circle-radius":new Za(ft.paint_circle["circle-radius"]),"circle-color":new Za(ft.paint_circle["circle-color"]),"circle-blur":new Za(ft.paint_circle["circle-blur"]),"circle-opacity":new Za(ft.paint_circle["circle-opacity"]),"circle-translate":new Ga(ft.paint_circle["circle-translate"]),"circle-translate-anchor":new Ga(ft.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ga(ft.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ga(ft.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Za(ft.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Za(ft.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Za(ft.paint_circle["circle-stroke-opacity"])}),layout:Pu};function Lu(e,t,i,r,n,a,o,s,u){if(a&&e.queryGeometry.isAboveHorizon)return!1;a&&(u*=e.pixelToTileUnitsFactor);var c,h=e.tileID.canonical,f=i.projection.upVectorScale(h,i.center.lat,i.worldSize).metersToTile,d=l(t);try{for(d.s();!(c=d.n()).done;){var p,m=l(c.value);try{var v=function(){var t=p.value,l=t.add(s),c=n&&i.elevation?i.elevation.exaggeration()*n.getElevationAt(l.x,l.y,!0):0,d=i.projection.projectTilePoint(l.x,l.y,h);if(c>0){var m=i.projection.upVector(h,l.x,l.y);d.x+=m[0]*f*c,d.y+=m[1]*f*c,d.z+=m[2]*f*c}var v=a?l:Ru(d.x,d.y,d.z,r),y=a?e.tilespaceRays.map(function(e){return Fu(e,c)}):e.queryGeometry.screenGeometry,_=rl([],[d.x,d.y,d.z,1],r);if(!o&&a?u*=_[3]/i.cameraToCenterDistance:o&&!a&&(u*=i.cameraToCenterDistance/_[3]),a){var g=Ql((t.y/gs+h.y)/(1<<h.z));u/=i.projection.pixelsPerMeter(g,1)/Jl(1,g)}if(yu(y,v,u))return{v:!0}};for(m.s();!(p=m.n()).done;){var y=v();if("object"==typeof y)return y.v}}catch(_){m.e(_)}finally{m.f()}}}catch(_){d.e(_)}finally{d.f()}return!1}function Ru(e,t,i,r){var n=rl([],[e,t,i,1],r);return new z(n[0]/n[3],n[1]/n[3])}var Bu=Fs(0,0,0),Ou=Fs(0,0,1);function Fu(e,t){var i=Rs();return Bu[2]=t,e.intersectsPlane(Bu,Ou,i),new z(i[0],i[1])}var Uu=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i)}(mu);function Vu(e,t,i,r){var n=t.width,a=t.height;if(r){if(r instanceof Uint8ClampedArray)r=new Uint8Array(r.buffer);else if(r.length!==n*a*i)throw new RangeError("mismatched image size")}else r=new Uint8Array(n*a*i);return e.width=n,e.height=a,e.data=r,e}function ju(e,t,i){var r=t.width,n=t.height;r===e.width&&n===e.height||(Nu(e,t,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,r),height:Math.min(e.height,n)},i),e.width=r,e.height=n,e.data=t.data)}function Nu(e,t,i,r,n,a){if(0===n.width||0===n.height)return t;if(n.width>e.width||n.height>e.height||i.x>e.width-n.width||i.y>e.height-n.height)throw new RangeError("out of range source coordinates for image copy");if(n.width>t.width||n.height>t.height||r.x>t.width-n.width||r.y>t.height-n.height)throw new RangeError("out of range destination coordinates for image copy");for(var o=e.data,s=t.data,l=0;l<n.height;l++)for(var u=((i.y+l)*e.width+i.x)*a,c=((r.y+l)*t.width+r.x)*a,h=0;h<n.width*a;h++)s[c+h]=o[u+h];return t}Bn(Uu,"HeatmapBucket",{omit:["layers"]});var Gu=function(){function e(t,i){h(this,e),Vu(this,t,1,i)}return d(e,[{key:"resize",value:function(t){ju(this,new e(t),1)}},{key:"clone",value:function(){return new e({width:this.width,height:this.height},new Uint8Array(this.data))}}
1],[{key:"copy",value:function(e,t,i,r,n){Nu(e,t,i,r,n,1)}}]),e}(),Zu=function(){function e(t,i){h(this,e),Vu(this,t,4,i)}return d(e,[{key:"resize",value:function(t){ju(this,new e(t),4)}},{key:"replace",value:function(e,t){t?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}},{key:"clone",value:function(){return new e({width:this.width,height:this.height},new Uint8Array(this.data))}}],[{key:"copy",value:function(e,t,i,r,n){Nu(e,t,i,r,n,4)}}]),e}();Bn(Gu,"AlphaImage"),Bn(Zu,"RGBAImage");var qu={paint:new Wa({"heatmap-radius":new Za(ft.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Za(ft.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ga(ft.paint_heatmap["heatmap-intensity"]),"heatmap-color":new qa(ft.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ga(ft.paint_heatmap["heatmap-opacity"])})};function Wu(e){var t={},i=e.resolution||256,r=e.clips?e.clips.length:1,n=e.image||new Zu({width:i,height:r}),a=function(i,r,a){t[e.evaluationKey]=a;var o=e.expression.evaluate(t);n.data[i+r+0]=Math.floor(255*o.r/o.a),n.data[i+r+1]=Math.floor(255*o.g/o.a),n.data[i+r+2]=Math.floor(255*o.b/o.a),n.data[i+r+3]=Math.floor(255*o.a)};if(e.clips)for(var o=0,s=0;o<r;++o,s+=4*i)for(var l=0,u=0;l<i;l++,u+=4){var c=l/(i-1),h=e.clips[o];a(s,u,h.start*(1-c)+h.end*c)}else for(var f=0,d=0;f<i;f++,d+=4)a(0,d,f/(i-1));return n}var Xu={paint:new Wa({"hillshade-illumination-direction":new Ga(ft.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ga(ft.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ga(ft.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ga(ft.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ga(ft.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ga(ft.paint_hillshade["hillshade-accent-color"])})},Hu=Ja([{name:"a_pos",components:2,type:"Int16"}],4).members,Yu={};function Ku(e,t,i){i=i||2;var r,n,a,o,s,l,u,c=t&&t.length,h=c?t[0]*i:e.length,f=Ju(e,0,h,i,!0),d=[];if(!f||f.next===f.prev)return d;if(c&&(f=function(e,t,i,r){var n,a,o,s=[];for(n=0,a=t.length;n<a;n++)(o=Ju(e,t[n]*r,n<a-1?t[n+1]*r:e.length,r,!1))===o.next&&(o.steiner=!0),s.push(lc(o));for(s.sort(nc),n=0;n<s.length;n++)i=ac(s[n],i);return i}(e,t,f,i)),e.length>80*i){r=a=e[0],n=o=e[1];for(var p=i;p<h;p+=i)(s=e[p])<r&&(r=s),(l=e[p+1])<n&&(n=l),s>a&&(a=s),l>o&&(o=l);u=0!==(u=Math.max(a-r,o-n))?32767/u:0}return Qu(f,d,i,r,n,u,0),d}function Ju(e,t,i,r,n){var a,o;if(n===bc(e,t,i,r)>0)for(a=t;a<i;a+=r)o=_c(a,e[a],e[a+1],o);else for(a=i-r;a>=t;a-=r)o=_c(a,e[a],e[a+1],o);return o&&fc(o,o.next)&&(gc(o),o=o.next),o}function $u(e,t){if(!e)return e;t||(t=e);var i,r=e;do{if(i=!1,r.steiner||!fc(r,r.next)&&0!==hc(r.prev,r,r.next))r=r.next;else{if(gc(r),(r=t=r.prev)===r.next)break;i=!0}}while(i||r!==t);return t}function Qu(e,t,i,r,n,a,o){if(e){!o&&a&&function(e,t,i,r){var n=e;do{0===n.z&&(n.z=sc(n.x,n.y,t,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){var t,i,r,n,a,o,s,l,u=1;do{for(i=e,e=null,a=null,o=0;i;){for(o++,r=i,s=0,t=0;t<u&&(s++,r=r.nextZ);t++);for(l=u;s>0||l>0&&r;)0!==s&&(0===l||!r||i.z<=r.z)?(n=i,i=i.nextZ,s--):(n=r,r=r.nextZ,l--),a?a.nextZ=n:e=n,n.prevZ=a,a=n;i=r}a.nextZ=null,u*=2}while(o>1)}(n)}(e,r,n,a);for(var s,l,u=e;e.prev!==e.next;)if(s=e.prev,l=e.next,a?tc(e,r,n,a):ec(e))t.push(s.i/i|0),t.push(e.i/i|0),t.push(l.i/i|0),gc(e),e=l.next,u=l.next;else if((e=l)===u){o?1===o?Qu(e=ic($u(e),t,i),t,i,r,n,a,2):2===o&&rc(e,t,i,r,n,a):Qu($u(e),t,i,r,n,a,1);break}}}function ec(e){var t=e.prev,i=e,r=e.next;if(hc(t,i,r)>=0)return!1;for(var n=t.x,a=i.x,o=r.x,s=t.y,l=i.y,u=r.y,c=n<a?n<o?n:o:a<o?a:o,h=s<l?s<u?s:u:l<u?l:u,f=n>a?n>o?n:o:a>o?a:o,d=s>l?s>u?s:u:l>u?l:u,p=r.next;p!==t;){if(p.x>=c&&p.x<=f&&p.y>=h&&p.y<=d&&uc(n,s,a,l,o,u,p.x,p.y)&&hc(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function tc(e,t,i,r){var n=e.prev,a=e,o=e.next;if(hc(n,a,o)>=0)return!1;for(var s=n.x,l=a.x,u=o.x,c=n.y,h=a.y,f=o.y,d=s<l?s<u?s:u:l<u?l:u,p=c<h?c<f?c:f:h<f?h:f,m=s>l?s>u?s:u:l>u?l:u,v=c>h?c>f?c:f:h>f?h:f,y=sc(d,p,t,i,r),_=sc(m,v,t,i,r),g=e.prevZ,x=e.nextZ;g&&g.z>=y&&x&&x.z<=_;){if(g.x>=d&&g.x<=m&&g.y>=p&&g.y<=v&&g!==n&&g!==o&&uc(s,c,l,h,u,f,g.x,g.y)&&hc(g.prev,g,g.next)>=0||(g=g.prevZ,x.x>=d&&x.x<=m&&x.y>=p&&x.y<=v&&x!==n&&x!==o&&uc(s,c,l,h,u,f,x.x,x.y)&&hc(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;g&&g.z>=y;){if(g.x>=d&&g.x<=m&&g.y>=p&&g.y<=v&&g!==n&&g!==o&&uc(s,c,l,h,u,f,g.x,g.y)&&hc(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;x&&x.z<=_;){if(x.x>=d&&x.x<=m&&x.y>=p&&x.y<=v&&x!==n&&x!==o&&uc(s,c,l,h,u,f,x.x,x.y)&&hc(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function ic(e,t,i){var r=e;do{var n=r.prev,a=r.next.next;!fc(n,a)&&dc(n,r,r.next,a)&&vc(n,a)&&vc(a,n)&&(t.push(n.i/i|0),t.push(r.i/i|0),t.push(a.i/i|0),gc(r),gc(r.next),r=e=a),r=r.next}
1while(r!==e);return $u(r)}function rc(e,t,i,r,n,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&cc(o,s)){var l=yc(o,s);return o=$u(o,o.next),l=$u(l,l.next),Qu(o,t,i,r,n,a,0),void Qu(l,t,i,r,n,a,0)}s=s.next}o=o.next}while(o!==e)}function nc(e,t){return e.x-t.x}function ac(e,t){var i=function(e,t){var i,r=t,n=e.x,a=e.y,o=-1/0;do{if(a<=r.y&&a>=r.next.y&&r.next.y!==r.y){var s=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=n&&s>o&&(o=s,i=r.x<r.next.x?r:r.next,s===n))return i}r=r.next}while(r!==t);if(!i)return null;var l,u=i,c=i.x,h=i.y,f=1/0;r=i;do{n>=r.x&&r.x>=c&&n!==r.x&&uc(a<h?n:o,a,c,h,a<h?o:n,a,r.x,r.y)&&(l=Math.abs(a-r.y)/(n-r.x),vc(r,e)&&(l<f||l===f&&(r.x>i.x||r.x===i.x&&oc(i,r)))&&(i=r,f=l)),r=r.next}while(r!==u);return i}(e,t);if(!i)return t;var r=yc(i,e);return $u(r,r.next),$u(i,i.next)}function oc(e,t){return hc(e.prev,e,t.prev)<0&&hc(t.next,e,e.next)<0}function sc(e,t,i,r,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function lc(e){var t=e,i=e;do{(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next}while(t!==e);return i}function uc(e,t,i,r,n,a,o,s){return(n-o)*(t-s)>=(e-o)*(a-s)&&(e-o)*(r-s)>=(i-o)*(t-s)&&(i-o)*(a-s)>=(n-o)*(r-s)}function cc(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&dc(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(vc(e,t)&&vc(t,e)&&function(e,t){var i=e,r=!1,n=(e.x+t.x)/2,a=(e.y+t.y)/2;do{i.y>a!=i.next.y>a&&i.next.y!==i.y&&n<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==e);return r}(e,t)&&(hc(e.prev,e,t.prev)||hc(e,t.prev,t))||fc(e,t)&&hc(e.prev,e,e.next)>0&&hc(t.prev,t,t.next)>0)}function hc(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function fc(e,t){return e.x===t.x&&e.y===t.y}function dc(e,t,i,r){var n=mc(hc(e,t,i)),a=mc(hc(e,t,r)),o=mc(hc(i,r,e)),s=mc(hc(i,r,t));return n!==a&&o!==s||!(0!==n||!pc(e,i,t))||!(0!==a||!pc(e,r,t))||!(0!==o||!pc(i,e,r))||!(0!==s||!pc(i,t,r))}function pc(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function mc(e){return e>0?1:e<0?-1:0}function vc(e,t){return hc(e.prev,e,e.next)<0?hc(e,t,e.next)>=0&&hc(e,e.prev,t)>=0:hc(e,t,e.prev)<0||hc(e,e.next,t)<0}function yc(e,t){var i=new xc(e.i,e.x,e.y),r=new xc(t.i,t.x,t.y),n=e.next,a=t.prev;return e.next=t,t.prev=e,i.next=n,n.prev=i,r.next=i,i.prev=r,a.next=r,r.prev=a,r}function _c(e,t,i,r){var n=new xc(e,t,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function gc(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 xc(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function bc(e,t,i,r){for(var n=0,a=t,o=i-r;a<i;a+=r)n+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return n}function wc(e,t,i,r,n){kc(e,t,i||0,r||e.length-1,n||Ec)}function kc(e,t,i,r,n){for(;r>i;){if(r-i>600){var a=r-i+1,o=t-i+1,s=Math.log(a),l=.5*Math.exp(2*s/3),u=.5*Math.sqrt(s*l*(a-l)/a)*(o-a/2<0?-1:1);kc(e,t,Math.max(i,Math.floor(t-o*l/a+u)),Math.min(r,Math.floor(t+(a-o)*l/a+u)),n)}var c=e[t],h=i,f=r;for(Tc(e,i,t),n(e[r],c)>0&&Tc(e,i,r);h<f;){for(Tc(e,h,f),h++,f--;n(e[h],c)<0;)h++;for(;n(e[f],c)>0;)f--}0===n(e[i],c)?Tc(e,i,f):Tc(e,++f,r),f<=t&&(i=f+1),t<=f&&(r=f-1)}}function Tc(e,t,i){var r=e[t];e[t]=e[i],e[i]=r}function Ec(e,t){return e<t?-1:e>t?1:0}function Mc(e,t){var i=e.length;if(i<=1)return[e];for(var r,n,a=[],o=0;o<i;o++){var s=oe(e[o]);0!==s&&(e[o].area=Math.abs(s),void 0===n&&(n=s<0),n===s<0?(r&&a.push(r),r=[e[o]]):r.push(e[o]))}if(r&&a.push(r),t>1)for(var l=0;l<a.length;l++)a[l].length<=t||(wc(a[l],t,1,a[l].length-1,Sc),a[l]=a[l].slice(0,t));return a}function Sc(e,t){return t.area-e.area}function Ic(e,t,i){var r,n=i.patternDependencies,a=!1,o=l(t);try{for(o.s();!(r=o.n()).done;){var s=r.value.paint.get("".concat(e,"-pattern"));s.isConstant()||(a=!0);var u=s.constantOr(null);u&&(a=!0,n[u]=!0)}}catch(c){o.e(c)}finally{o.f()}return a}function Cc(e,t,i,r,n){var a,o=n.patternDependencies,s=l(t);try{for(s.s();!(a=s.n()).done;){var u=a.value,c=u.paint.get("".concat(e,"-pattern")).value;if("constant"!==c.kind){var h=c.evaluate({zoom:r},i,{},n.availableImages);o[h=h&&h.name?h.name:h]=!0,i.patterns[u.id]=h}}}catch(f){s.e(f)}finally{s.f()}return i}({get exports(){return Yu},set exports(e){Yu=e}}).exports=Ku,Yu.default=Ku,Ku.deviation=function(e,t,i,r){var n=t&&t.length,a=Math.abs(bc(e,0,n?t[0]*i:e.length,i));if(n)for(var o=0,s=t.length;o<s;o++)a-=Math.abs(bc(e,t[o]*i,o<s-1?t[o+1]*i:e.length,i));var l=0;for(o=0;o<r.length;o+=3){var u=r[o]*i,c=r[o+1]*i,h=r[o+2]*i;l+=Math.abs((e[u]-e[h])*(e[c+1]-e[u+1])-(e[u]-e[c])*(e[h+1]-e[u+1]))}return 0===a&&0===l?0:Math.abs((l-a)/a)},Ku.flatten=function(e){for(var t=e[0][0].length,i={vertices:[],holes:[],dimensions:t},r=0,n=0;n<e.length;n++){for(var a=0;a<e[n].length;a++)for(var o=0;o<t;o++)i.vertices.push(e[n][a][o]);n>0&&i.holes.push(r+=e[n-1].length)}return i};var Ac=function(){function e(t){h(this,e),this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(e){return e.id}),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Qa,this.indexArray=new vo,this.indexArray2=new wo,this.programConfigurations=new ls(t.layers,t.zoom),this.segments=new _s,this.segments2=new _s,this.stateDependentLayerIds=this.layers.filter(function(e){return e.isStateDependent()}).map(function(e){return e.id}),this.projection=t.projection}return d(e,[{key:"populate",value:function(e,t,i,r){this.hasPattern=Ic("fill",this.layers,t);var n,a=this.layers[0].layout.get("fill-sort-key"),o=[],s=l(e);try{for(s.s();!(n=s.n()).done;){var u=n.value,c=u.feature,h=u.id,f=u.index,d=u.sourceLayerIndex,p=this.layers[0]._featureFilter.needGeometry,m=fu(c,p);if(this.layers[0]._featureFilter.filter(new La(this.zoom),m,i)){var v=a?a.evaluate(m,{},i,t.availableImages):void 0,y={id:h,properties:c.properties,type:c.type,sourceLayerIndex:d,index:f,geometry:p?m.geometry:hu(c,i,r),patterns:{},sortKey:v};o.push(y)}}}catch(E){s.e(E)}finally{s.f()}a&&o.sort(function(e,t){return e.sortKey-t.sortKey});for(var _=0,g=o;_<g.length;_++){var x=g[_],b=x.geometry,w=x.index,k=x.sourceLayerIndex;if(this.hasPattern){var T=Cc("fill",this.layers,x,this.zoom,t);this.patternFeatures.push(T)}else this.addFeature(x,b,w,i,{},t.availableImages);t.featureIndex.insert(e[w].feature,b,w,k,this.index)}}},{key:"update",value:function(e,t,i,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i,r)}},{key:"addFeatures",value:function(e,t,i,r,n){var a,o=l(this.patternFeatures);try{for(o.s();!(a=o.n()).done;){var s=a.value;this.addFeature(s,s.geometry,s.index,t,i,r)}}catch(u){o.e(u)}finally{o.f()}}},{key:"isEmpty",value:function(){return 0===this.layoutVertexArray.length}},{key:"uploadPending",value:function(){return!this.uploaded||this.programConfigurations.needsUpload}},{key:"upload",value:function(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Hu),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}},{key:"destroy",value:function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}},{key:"addFeature",value:function(e,t,i,r,n){var a,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:[],s=l(Mc(t,500));try{for(s.s();!(a=s.n()).done;){var u,c=a.value,h=0,f=l(c);try{for(f.s();!(u=f.n()).done;){var d=u.value;h+=d.length}}catch(M){f.e(M)}finally{f.f()}var p,m=this.segments.prepareSegment(h,this.layoutVertexArray,this.indexArray),v=m.vertexLength,y=[],_=[],g=l(c);try{for(g.s();!(p=g.n()).done;){var x=p.value;if(0!==x.length){x!==c[0]&&_.push(y.length/2);var b=this.segments2.prepareSegment(x.length,this.layoutVertexArray,this.indexArray2),w=b.vertexLength;this.layoutVertexArray.emplaceBack(x[0].x,x[0].y),this.indexArray2.emplaceBack(w+x.length-1,w),y.push(x[0].x),y.push(x[0].y);for(var k=1;k<x.length;k++)this.layoutVertexArray.emplaceBack(x[k].x,x[k].y),this.indexArray2.emplaceBack(w+k-1,w+k),y.push(x[k].x),y.push(x[k].y);b.vertexLength+=x.length,b.primitiveLength+=x.length}}}catch(M){g.e(M)}finally{g.f()}for(var T=Yu(y,_),E=0;E<T.length;E+=3)this.indexArray.emplaceBack(v+T[E],v+T[E+1],v+T[E+2]);m.vertexLength+=h,m.primitiveLength+=T.length/3}}catch(M){s.e(M)}finally{s.f()}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,n,o,r)}}]),e}();Bn(Ac,"FillBucket",{omit:["layers","patternFeatures"]});var zc=new Wa({"fill-sort-key":new Za(ft.layout_fill["fill-sort-key"])}),Pc={paint:new Wa({"fill-antialias":new Ga(ft.paint_fill["fill-antialias"]),"fill-opacity":new Za(ft.paint_fill["fill-opacity"]),"fill-color":new Za(ft.paint_fill["fill-color"]),"fill-outline-color":new Za(ft.paint_fill["fill-outline-color"]),"fill-translate":new Ga(ft.paint_fill["fill-translate"]),"fill-translate-anchor":new Ga(ft.paint_fill["fill-translate-anchor"]),"fill-pattern":new Za(ft.paint_fill["fill-pattern"])}),layout:zc},Dc=Ja([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),Lc=Ja([{name:"a_centroid_pos",components:2,type:"Uint16"}]),Rc=Ja([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),Bc=Dc.members,Oc={},Fc=z,Uc=Vc;function Vc(e,t,i,r,n){this.properties={},this.extent=i,this.type=0,this._pbf=e,this._geometry=-1,this._keys=r,this._values=n,e.readFields(jc,this,t)}function jc(e,t,i){1==e?t.id=i.readVarint():2==e?function(e,t){for(var i=e.readVarint()+e.pos;e.pos<i;){var r=t._keys[e.readVarint()],n=t._values[e.readVarint()];t.properties[r]=n}}(i,t):3==e?t.type=i.readVarint():4==e&&(t._geometry=i.pos)}function Nc(e){for(var t,i,r=0,n=0,a=e.length,o=a-1;n<a;o=n++)r+=((i=e[o]).x-(t=e[n]).x)*(t.y+i.y);return r}Vc.types=["Unknown","Point","LineString","Polygon"],Vc.prototype.loadGeometry=function(){var e=this._pbf;e.pos=this._geometry;for(var t,i=e.readVarint()+e.pos,r=1,n=0,a=0,o=0,s=[];e.pos<i;){if(n<=0){var l=e.readVarint();r=7&l,n=l>>3}if(n--,1===r||2===r)a+=e.readSVarint(),o+=e.readSVarint(),1===r&&(t&&s.push(t),t=[]),t.push(new Fc(a,o));else{if(7!==r)throw new Error("unknown command "+r);t&&t.push(t[0].clone())}}return t&&s.push(t),s},Vc.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,i=1,r=0,n=0,a=0,o=1/0,s=-1/0,l=1/0,u=-1/0;e.pos<t;){if(r<=0){var c=e.readVarint();i=7&c,r=c>>3}if(r--,1===i||2===i)(n+=e.readSVarint())<o&&(o=n),n>
1s&&(s=n),(a+=e.readSVarint())<l&&(l=a),a>u&&(u=a);else if(7!==i)throw new Error("unknown command "+i)}return[o,l,s,u]},Vc.prototype.toGeoJSON=function(e,t,i){var r,n,a=this.extent*Math.pow(2,i),o=this.extent*e,s=this.extent*t,l=this.loadGeometry(),u=Vc.types[this.type];function c(e){for(var t=0;t<e.length;t++){var i=e[t];e[t]=[360*(i.x+o)/a-180,360/Math.PI*Math.atan(Math.exp((180-360*(i.y+s)/a)*Math.PI/180))-90]}}switch(this.type){case 1:var h=[];for(r=0;r<l.length;r++)h[r]=l[r][0];c(l=h);break;case 2:for(r=0;r<l.length;r++)c(l[r]);break;case 3:for(l=function(e){var t=e.length;if(t<=1)return[e];for(var i,r,n=[],a=0;a<t;a++){var o=Nc(e[a]);0!==o&&(void 0===r&&(r=o<0),r===o<0?(i&&n.push(i),i=[e[a]]):i.push(e[a]))}return i&&n.push(i),n}(l),r=0;r<l.length;r++)for(n=0;n<l[r].length;n++)c(l[r][n])}1===l.length?l=l[0]:u="Multi"+u;var f={type:"Feature",geometry:{type:u,coordinates:l},properties:this.properties};return"id"in this&&(f.id=this.id),f};var Gc=Uc,Zc=qc;function qc(e,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(Wc,this,t),this.length=this._features.length}function Wc(e,t,i){15===e?t.version=i.readVarint():1===e?t.name=i.readString():5===e?t.extent=i.readVarint():2===e?t._features.push(i.pos):3===e?t._keys.push(i.readString()):4===e&&t._values.push(function(e){for(var t=null,i=e.readVarint()+e.pos;e.pos<i;){var r=e.readVarint()>>3;t=1===r?e.readString():2===r?e.readFloat():3===r?e.readDouble():4===r?e.readVarint64():5===r?e.readVarint():6===r?e.readSVarint():7===r?e.readBoolean():null}return t}(i))}qc.prototype.feature=function(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];var t=this._pbf.readVarint()+this._pbf.pos;return new Gc(this._pbf,t,this.extent,this._keys,this._values)};var Xc=Zc;function Hc(e,t,i){if(3===e){var r=new Xc(i,i.readVarint()+i.pos);r.length&&(t[r.name]=r)}}var Yc=Oc.VectorTile=function(e,t){this.layers=e.readFields(Hc,{},t)},Kc=Oc.VectorTileFeature=Uc;function Jc(e,t,i,r){var n,a=[],o=0===r?function(e,t,i,r,n,a){e.push(new z(a,i+(a-t)/(r-t)*(n-i)))}:function(e,t,i,r,n,a){e.push(new z(t+(a-i)/(n-i)*(r-t),a))},s=l(e);try{for(s.s();!(n=s.n()).done;){var u,c=n.value,h=[],f=l(c);try{for(f.s();!(u=f.n()).done;){var d=u.value;if(!(d.length<=2)){for(var p=[],m=0;m<d.length-1;m++){var v=d[m].x,y=d[m].y,_=d[m+1].x,g=d[m+1].y,x=0===r?v:y,b=0===r?_:g;x<t?b>t&&o(p,v,y,_,g,t):x>i?b<i&&o(p,v,y,_,g,i):p.push(d[m]),b<t&&x>=t&&o(p,v,y,_,g,t),b>i&&x<=i&&o(p,v,y,_,g,i)}var w=d[d.length-1],k=0===r?w.x:w.y;k>=t&&k<=i&&p.push(w),p.length&&(w=p[p.length-1],p[0].x===w.x&&p[0].y===w.y||p.push(p[0]),h.push(p))}}}catch(T){f.e(T)}finally{f.f()}h.length&&a.push(h)}}catch(T){s.e(T)}finally{s.f()}return a}Oc.VectorTileLayer=Zc;var $c=Kc.types,Qc=Math.pow(2,13);function eh(e,t,i,r,n,a,o,s){e.emplaceBack((t<<1)+o,(i<<1)+a,(Math.floor(r*Qc)<<1)+n,Math.round(s))}function th(e,t,i){var r=16384;e.emplaceBack(t.x,t.y,t.z,i[0]*r,i[1]*r,i[2]*r)}var ih=function(){function e(){h(this,e),this.acc=new z(0,0),this.polyCount=[]}return d(e,[{key:"startRing",value:function(e){this.currentPolyCount={edges:0,top:0},this.polyCount.push(this.currentPolyCount),this.min||(this.min=new z(e.x,e.y),this.max=new z(e.x,e.y))}},{key:"append",value:function(e,t){this.currentPolyCount.edges++,this.acc._add(e);var i=this.min,r=this.max;e.x<i.x?i.x=e.x:e.x>r.x&&(r.x=e.x),e.y<i.y?i.y=e.y:e.y>r.y&&(r.y=e.y),((0===e.x||e.x===gs)&&e.x===t.x)!=((0===e.y||e.y===gs)&&e.y===t.y)&&this.processBorderOverlap(e,t),t.x<0!=e.x<0&&this.addBorderIntersection(0,Di(t.y,e.y,(0-t.x)/(e.x-t.x))),t.x>gs!=e.x>gs&&this.addBorderIntersection(1,Di(t.y,e.y,(gs-t.x)/(e.x-t.x))),t.y<0!=e.y<0&&this.addBorderIntersection(2,Di(t.x,e.x,(0-t.y)/(e.y-t.y))),t.y>gs!=e.y>gs&&this.addBorderIntersection(3,Di(t.x,e.x,(gs-t.y)/(e.y-t.y)))}},{key:"addBorderIntersection",value:function(e,t){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);var i=this.borders[e];t<i[0]&&(i[0]=t),t>i[1]&&(i[1]=t)}},{key:"processBorderOverlap",value:function(e,t){if(e.x===t.x){if(e.y===t.y)return;var i=0===e.x?0:1;this.addBorderIntersection(i,t.y),this.addBorderIntersection(i,e.y)}else{var r=0===e.y?2:3;this.addBorderIntersection(r,t.x),this.addBorderIntersection(r,e.x)}}},{key:"centroid",value:function(){var e=this.polyCount.reduce(function(e,t){return e+t.edges},0);return 0!==e?this.acc.div(e)._round():new z(0,0)}},{key:"span",value:function(){return new z(this.max.x-this.min.x,this.max.y-this.min.y)}},{key:"intersectsCount",value:function(){return this.borders.reduce(function(e,t){return e+ +(t[0]!==Number.MAX_VALUE)},0)}}]),e}(),rh=function(){function e(t){h(this,e),this.zoom=t.zoom,this.canonical=t.canonical,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(e){return e.id}),this.index=t.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=t.projection,this.layoutVertexArray=new to,this.centroidVertexArray=new Ro,this.indexArray=new vo,this.programConfigurations=new ls(t.layers,t.zoom),this.segments=new _s,this.stateDependentLayerIds=this.layers.filter(function(e){return e.isStateDependent()}).map(function(e){return e.id}),this.enableTerrain=t.enableTerrain}return d(e,[{key:"populate",value:function(e,t,i,r){this.features=[],this.hasPattern=Ic("fill-extrusion",this.layers,t),this.featuresOnBorder=[],this.borders=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.tileToMeter=function(e){var t=Math.exp(Math.PI*(1-e.y/(1<<e.z)*2));return 80150034*t/(t*t+1)/gs/(1<<e.z)}(i),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter;var n,a=l(e);try{for(a.s();!(n=a.n()).done;){var o=n.value,s=o.feature,u=o.id,c=o.index,h=o.sourceLayerIndex,f=this.layers[0]._featureFilter.needGeometry,d=fu(s,f);if(this.layers[0]._featureFilter.filter(new La(this.zoom),d,i)){var p={id:u,sourceLayerIndex:h,index:c,geometry:f?d.geometry:hu(s,i,r),properties:s.properties,type:s.type,patterns:{}},m=this.layoutVertexArray.length;this.hasPattern?this.features.push(Cc("fill-extrusion",this.layers,p,this.zoom,t)):this.addFeature(p,p.geometry,c,i,{},t.availableImages,r),t.featureIndex.insert(s,p.geometry,c,h,this.index,m)}}}catch(v){a.e(v)}finally{a.f()}this.sortBorders()}},{key:"addFeatures",value:function(e,t,i,r,n){var a,o=l(this.features);try{for(o.s();!(a=o.n()).done;){var s=a.value,u=s.geometry;this.addFeature(s,u,s.index,t,i,r,n)}}catch(c){o.e(c)}finally{o.f()}this.sortBorders()}},{key:"update",value:function(e,t,i,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i,r)}},{key:"isEmpty",value:function(){return 0===this.layoutVertexArray.length}},{key:"uploadPending",value:function(){return!this.uploaded||this.programConfigurations.needsUpload}},{key:"upload",value:function(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Bc),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,Rc.members,!0))),this.programConfigurations.upload(e),this.uploaded=!0}},{key:"uploadCentroid",value:function(e){0!==this.centroidVertexArray.length&&(this.centroidVertexBuffer?this.needsCentroidUpdate&&this.centroidVertexBuffer.updateData(this.centroidVertexArray):this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Lc.members,!0),this.needsCentroidUpdate=!1)}},{key:"destroy",value:function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}},{key:"addFeature",value:function(e,t,i,r,n,a,o){var s=[new z(0,0),new z(gs,gs)],u=o.projection,c="globe"===u.name,h=this.enableTerrain&&!c?
1new ih:null,f="Polygon"===$c[e.type];c&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new oo);for(var d,p,m=Mc(t,500),v=m.length-1;v>=0;v--){var y=m[v];(0===y.length||(d=y[0]).every(function(e){return e.x<=0})||d.every(function(e){return e.x>=gs})||d.every(function(e){return e.y<=0})||d.every(function(e){return e.y>=gs}))&&m.splice(v,1)}if(c)p=hh(m,s,r);else{p=[];var _,g=l(m);try{for(g.s();!(_=g.n()).done;){var x=_.value;p.push({polygon:x,bounds:s})}}catch(Ae){g.e(Ae)}finally{g.f()}}var b,w=f?this.edgeRadius:0,k=l(p);try{for(k.s();!(b=k.n()).done;){var T,E=b.value,M=E.polygon,S=E.bounds,I=0,C=0,A=l(M);try{for(A.s();!(T=A.n()).done;){var P=T.value;f&&!P[0].equals(P[P.length-1])&&P.push(P[0]),C+=f?P.length-1:P.length}}catch(Ae){A.e(Ae)}finally{A.f()}var D=this.segments.prepareSegment((f?5:4)*C,this.layoutVertexArray,this.indexArray);if(f){var L=[],R=[];I=D.vertexLength;var B,O=l(M);try{for(O.s();!(B=O.n()).done;){var F=B.value,U=void 0,V=void 0;F.length&&F!==M[0]&&R.push(L.length/2),U=F[1].sub(F[0])._perp()._unit();for(var j=1;j<F.length;j++){var N=F[j],G=F[j===F.length-1?1:j+1],Z=N.x,q=N.y;if(w){V=G.sub(N)._perp()._unit();var W=U.add(V)._unit(),X=w*Math.min(4,1/(U.x*W.x+U.y*W.y));Z+=X*W.x,q+=X*W.y,U=V}eh(this.layoutVertexArray,Z,q,0,0,1,1,0),D.vertexLength++,L.push(N.x,N.y),c&&th(this.layoutVertexExtArray,u.projectTilePoint(Z,q,r),u.upVector(r,Z,q))}}}catch(Ae){O.e(Ae)}finally{O.f()}for(var H=Yu(L,R),Y=0;Y<H.length;Y+=3)this.indexArray.emplaceBack(I+H[Y],I+H[Y+2],I+H[Y+1]),D.primitiveLength++}var K,J=l(M);try{for(J.s();!(K=J.n()).done;){var $=K.value;h&&$.length&&h.startRing($[0]);var Q=void 0,ee=void 0,te=void 0,ie=$.length>4&&lh($[$.length-2],$[0],$[1]),re=w?ah($[$.length-2],$[0],$[1],w):0;ee=$[1].sub($[0])._perp()._unit();for(var ne=!0,ae=1,oe=0;ae<$.length;ae++){var se=$[ae-1],le=$[ae],ue=$[ae===$.length-1?1:ae+1];if(h&&f&&h.currentPolyCount.top++,sh(le,se,S))w&&(ee=ue.sub(le)._perp()._unit(),ne=!ne);else{h&&h.append(le,se);var ce=le.sub(se)._perp(),he=ce.x/(Math.abs(ce.x)+Math.abs(ce.y)),fe=ce.y>0?1:0,de=se.dist(le);if(oe+de>32768&&(oe=0),w){te=ue.sub(le)._perp()._unit();var pe=oh(se,le,ue,nh(ee,te),w);isNaN(pe)&&(pe=0);var me=le.sub(se)._unit();se=se.add(me.mult(re))._round(),le=le.add(me.mult(-pe))._round(),re=pe,ee=te}var ve=D.vertexLength,ye=$.length>4&&lh(se,le,ue),_e=uh(oe,ie,ne);if(eh(this.layoutVertexArray,se.x,se.y,he,fe,0,0,_e),eh(this.layoutVertexArray,se.x,se.y,he,fe,0,1,_e),_e=uh(oe+=de,ye,!ne),ie=ye,eh(this.layoutVertexArray,le.x,le.y,he,fe,0,0,_e),eh(this.layoutVertexArray,le.x,le.y,he,fe,0,1,_e),D.vertexLength+=4,this.indexArray.emplaceBack(ve+0,ve+1,ve+2),this.indexArray.emplaceBack(ve+1,ve+3,ve+2),D.primitiveLength+=2,w){var ge=I+(1===ae?$.length-2:ae-2),xe=1===ae?I:ge+1;if(this.indexArray.emplaceBack(ve+1,ge,ve+3),this.indexArray.emplaceBack(ge,xe,ve+3),D.primitiveLength+=2,void 0===Q&&(Q=ve),!sh(ue,$[ae],S)){var be=ae===$.length-1?Q:D.vertexLength;this.indexArray.emplaceBack(ve+2,ve+3,be),this.indexArray.emplaceBack(ve+3,be+1,be),this.indexArray.emplaceBack(ve+3,xe,be+1),D.primitiveLength+=3}ne=!ne}if(c){var we=this.layoutVertexExtArray,ke=u.projectTilePoint(se.x,se.y,r),Te=u.projectTilePoint(le.x,le.y,r),Ee=u.upVector(r,se.x,se.y),Me=u.upVector(r,le.x,le.y);th(we,ke,Ee),th(we,ke,Ee),th(we,Te,Me),th(we,Te,Me)}}}f&&(I+=$.length-1)}}catch(Ae){J.e(Ae)}finally{J.f()}}}catch(Ae){k.e(Ae)}finally{k.f()}if(h&&h.polyCount.length>0){if(h.borders){h.vertexArrayOffset=this.centroidVertexArray.length;for(var Se=h.borders,Ie=this.featuresOnBorder.push(h)-1,Ce=0;Ce<4;Ce++)Se[Ce][0]!==Number.MAX_VALUE&&this.borders[Ce].push(Ie)}this.encodeCentroid(h.borders?void 0:h.centroid(),h)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,n,a,r)}},{key:"sortBorders",value:function(){for(var e=this,t=function(t){e.borders[t].sort(function(i,r){return e.featuresOnBorder[i].borders[t][0]-e.featuresOnBorder[r].borders[t][0]})},i=0;i<4;i++)t(i)}},{key:"encodeCentroid",value:function(e,t){var i,r,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(e)if(0!==e.y){var a=t.span()._mult(this.tileToMeter);i=(Math.max(e.x,1)<<3)+Math.min(7,Math.round(a.x/10)),r=(Math.max(e.y,1)<<3)+Math.min(7,Math.round(a.y/10))}else i=Math.ceil(7*(e.x+450)),r=0;else i=0,r=+n;var o,s=n?this.centroidVertexArray.length:t.vertexArrayOffset,u=l(t.polyCount);try{for(u.s();!(o=u.n()).done;){var c=o.value;n&&this.centroidVertexArray.resize(this.centroidVertexArray.length+4*c.edges+c.top);for(var h=0;h<c.top;h++)this.centroidVertexArray.emplace(s++,i,r);for(var f=0;f<2*c.edges;f++)this.centroidVertexArray.emplace(s++,0,r),this.centroidVertexArray.emplace(s++,i,r)}}catch(d){u.e(d)}finally{u.f()}}}]),e}();function nh(e,t){var i=e.add(t)._unit();return e.x*i.x+e.y*i.y}function ah(e,t,i,r){var n=t.sub(e)._perp()._unit(),a=i.sub(t)._perp()._unit();return oh(e,t,i,nh(n,a),r)}function oh(e,t,i,r,n){var a=Math.sqrt(1-r*r);return Math.min(e.dist(t)/3,t.dist(i)/3,n*a/r)}function sh(e,t,i){return e.x<i[0].x&&t.x<i[0].x||e.x>i[1].x&&t.x>i[1].x||e.y<i[0].y&&t.y<i[0].y||e.y>i[1].y&&t.y>i[1].y}function lh(e,t,i){if(e.x<0||e.x>=gs||t.x<0||t.x>=gs||i.x<0||i.x>=gs)return!1;var r=i.sub(t),n=r.perp(),a=e.sub(t);return(r.x*a.x+r.y*a.y)/Math.sqrt((r.x*r.x+r.y*r.y)*(a.x*a.x+a.y*a.y))>-.866&&n.x*a.x+n.y*a.y<0}function uh(e,t,i){var r=t?2|e:-3&e;return i?1|r:-2&r}
1function ch(){var e=Math.PI/32,t=Math.tan(e),i=ql;return i*Math.sqrt(1+2*t*t)-i}function hh(e,t,i){var r=1<<i.z,n=$l(i.x/r),a=$l((i.x+1)/r),o=Ql(i.y/r),s=Ql((i.y+1)/r);return function(e,t,i,r){var n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=arguments.length>5?arguments[5]:void 0,o=[];if(!e.length||!i||!r)return o;for(var s=function(e,t){var i,r=l(e);try{for(r.s();!(i=r.n()).done;){var n=i.value;o.push({polygon:n,bounds:t})}}catch(a){r.e(a)}finally{r.f()}},u=Math.ceil(Math.log2(i)),c=Math.ceil(Math.log2(r)),h=u-c,f=[],d=0;d<Math.abs(h);d++)f.push(h>0?0:1);for(var p=0;p<Math.min(u,c);p++)f.push(0),f.push(1);var m=e;if(m=Jc(m,t[0].y-n,t[1].y+n,1),!(m=Jc(m,t[0].x-n,t[1].x+n,0)).length)return o;var v=[];for(f.length?v.push({polygons:m,bounds:t,depth:0}):s(m,t);v.length;){var y=v.pop(),_=y.depth,g=f[_],x=y.bounds[0],b=y.bounds[1],w=0===g?x.x:x.y,k=0===g?b.x:b.y,T=a?a(g,w,k):.5*(w+k),E=Jc(y.polygons,w-n,T+n,g),M=Jc(y.polygons,T-n,k+n,g);if(E.length){var S=[x,new z(0===g?T:b.x,1===g?T:b.y)];f.length>_+1?v.push({polygons:E,bounds:S,depth:_+1}):s(E,S)}if(M.length){var I=[new z(0===g?T:x.x,1===g?T:x.y),b];f.length>_+1?v.push({polygons:M,bounds:I,depth:_+1}):s(M,I)}}return o}(e,t,Math.ceil((a-n)/11.25),Math.ceil((o-s)/11.25),1,function(e,t,n){if(0===e)return.5*(t+n);var a=Ql((i.y+t/gs)/r);return(Kl(.5*(Ql((i.y+n/gs)/r)+a))*r-i.y)*gs})}Bn(rh,"FillExtrusionBucket",{omit:["layers","features"]}),Bn(ih,"PartMetadata");var fh=new Wa({"fill-extrusion-edge-radius":new Ga(ft["layout_fill-extrusion"]["fill-extrusion-edge-radius"])}),dh={paint:new Wa({"fill-extrusion-opacity":new Ga(ft["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Za(ft["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ga(ft["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ga(ft["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Za(ft["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Za(ft["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Za(ft["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ga(ft["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new Ga(ft["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new Ga(ft["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"])}),layout:fh};function ph(e,t,i){var r=2*Math.PI*6378137/256/Math.pow(2,i);return[e*r-2*Math.PI*6378137/2,t*r-2*Math.PI*6378137/2]}var mh=function(){function e(t,i,r){h(this,e),this.z=t,this.x=i,this.y=r,this.key=_h(0,t,t,i,r)}return d(e,[{key:"equals",value:function(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}},{key:"url",value:function(e,t){var i,r,n,a,o,s=(r=this.y,n=this.z,a=ph(256*(i=this.x),256*(r=Math.pow(2,n)-r-1),n),o=ph(256*(i+1),256*(r+1),n),a[0]+","+a[1]+","+o[0]+","+o[1]),l=function(e,t,i){for(var r,n="",a=e;a>0;a--)n+=(t&(r=1<<a-1)?1:0)+(i&r?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"===t?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",l).replace("{bbox-epsg-3857}",s)}},{key:"toString",value:function(){return"".concat(this.z,"/").concat(this.x,"/").concat(this.y)}}]),e}(),vh=d(function e(t,i){h(this,e),this.wrap=t,this.canonical=i,this.key=_h(t,i.z,i.z,i.x,i.y)}),yh=function(){function e(t,i,r,n,a){h(this,e),this.overscaledZ=t,this.wrap=i,this.canonical=new mh(r,+n,+a),this.key=0===i&&t===r?this.canonical.key:_h(i,t,r,n,a)}return d(e,[{key:"equals",value:function(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}},{key:"scaledTo",value:function(t){var i=this.canonical.z-t;return t>this.canonical.z?new e(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new e(t,this.wrap,t,this.canonical.x>>i,this.canonical.y>>i)}},{key:"calculateScaledKey",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.overscaledZ===e&&t)return this.key;if(e>this.canonical.z)return _h(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y);var i=this.canonical.z-e;return _h(this.wrap*+t,e,e,this.canonical.x>>i,this.canonical.y>>i)}},{key:"isChildOf",value:function(e){if(e.wrap!==this.wrap)return!1;var t=this.canonical.z-e.canonical.z;return 0===e.overscaledZ||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>t&&e.canonical.y===this.canonical.y>>t}},{key:"children",value:function(t){if(this.overscaledZ>=t)return[new e(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];var i=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return[new e(i,this.wrap,i,r,n),new e(i,this.wrap,i,r+1,n),new e(i,this.wrap,i,r,n+1),new e(i,this.wrap,i,r+1,n+1)]}},{key:"isLessThan",value:function(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>
1e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}},{key:"wrapped",value:function(){return new e(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}},{key:"unwrapTo",value:function(t){return new e(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}},{key:"overscaleFactor",value:function(){return Math.pow(2,this.overscaledZ-this.canonical.z)}},{key:"toUnwrapped",value:function(){return new vh(this.wrap,this.canonical)}},{key:"toString",value:function(){return"".concat(this.overscaledZ,"/").concat(this.canonical.x,"/").concat(this.canonical.y)}}]),e}();function _h(e,t,i,r,n){var a=1<<Math.min(i,22),o=a*(n%a)+r%a;return e&&i<22&&(o+=a*a*((e<0?-2*e-1:2*e)%(1<<2*(22-i)))),16*(32*o+i)+(t-i)}Bn(mh,"CanonicalTileID"),Bn(yh,"OverscaledTileID",{omit:["projMatrix"]});var gh=function(e){p(i,e);var t=m(i);function i(e,r,n){var a;return h(this,i),(a=t.call(this,e,r)).z=n,a}return d(i)}(z);function xh(e,t){return e.x*t.x+e.y*t.y}function bh(e,t){if(1===e.length){for(var i,r=0,n=t[r++];!i||n.equals(i);)if(!(i=t[r++]))return 1/0;for(;r<t.length;r++){var a=t[r],o=e[0],s=i.sub(n),u=a.sub(n),c=o.sub(n),h=xh(s,s),f=xh(s,u),d=xh(u,u),p=xh(c,s),m=xh(c,u),v=h*d-f*f,y=(d*p-f*m)/v,_=(h*m-f*p)/v,g=n.z*(1-y-_)+i.z*y+a.z*_;if(isFinite(g))return g}return 1/0}var x,b=1/0,w=l(t);try{for(w.s();!(x=w.n()).done;){var k=x.value;b=Math.min(b,k.z)}}catch(T){w.e(T)}finally{w.f()}return b}function wh(e,t,i,r,n,a,o,s){var l,u,c,h,f,d,p,m,v,y,_,g,x,b,w,k,T,E,M,S,I,C,A,z,P,D=o*n.getElevationAt(e,t,!0,!0),L=0!==a[0],R=L?0===a[1]?o*(a[0]/7-450):o*(l=n,u=a,c=s,v=Math.floor(u[0]/8),y=Math.floor(u[1]/8),_=10*(u[0]-8*v),g=10*(u[1]-8*y),x=l.getElevationAt(v,y,!0,!0),b=l.getMeterToDEM(c),w=Math.floor(.5*(_*b-1)),k=Math.floor(.5*(g*b-1)),T=l.tileCoordToPixel(v,y),p=E=2*w+1,m=M=2*k+1,S=[(h=l).getElevationAtPixel(f=T.x-w,d=T.y-k,!0),h.getElevationAtPixel(f+m,d,!0),h.getElevationAtPixel(f,d+m,!0),h.getElevationAtPixel(f+p,d+m,!0)],I=Math.abs(S[0]-S[1]),C=Math.abs(S[2]-S[3]),A=Math.abs(S[0]-S[2])+Math.abs(S[1]-S[3]),z=Math.min(.25,.5*b*(I+C)/E),P=Math.min(.25,.5*b*A/M),x+Math.max(z*_,P*g)):D;return{base:D+(0===i)?-1:i,top:L?Math.max(R+r,D+i+2):D+r}}var kh=Ja([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4).members,Th=Ja([{name:"a_packed",components:4,type:"Float32"}]).members,Eh=Kc.types,Mh=Math.cos(Math.PI/180*37.5),Sh=function(){function e(t){var i=this;h(this,e),this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(e){return e.id}),this.index=t.index,this.projection=t.projection,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(function(e){i.gradients[e.id]={}}),this.layoutVertexArray=new io,this.layoutVertexArray2=new ro,this.indexArray=new vo,this.programConfigurations=new ls(t.layers,t.zoom),this.segments=new _s,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(function(e){return e.isStateDependent()}).map(function(e){return e.id})}return d(e,[{key:"populate",value:function(e,t,i,r){this.hasPattern=Ic("line",this.layers,t);var n,a=this.layers[0].layout.get("line-sort-key"),o=[],s=l(e);try{for(s.s();!(n=s.n()).done;){var u=n.value,c=u.feature,h=u.id,f=u.index,d=u.sourceLayerIndex,p=this.layers[0]._featureFilter.needGeometry,m=fu(c,p);if(this.layers[0]._featureFilter.filter(new La(this.zoom),m,i)){var v=a?a.evaluate(m,{},i):void 0,y={id:h,properties:c.properties,type:c.type,sourceLayerIndex:d,index:f,geometry:p?m.geometry:hu(c,i,r),patterns:{},sortKey:v};o.push(y)}}}catch(I){s.e(I)}finally{s.f()}a&&o.sort(function(e,t){return e.sortKey-t.sortKey});for(var _=t.lineAtlas,g=t.featureIndex,x=this.addConstantDashes(_),b=0,w=o;b<w.length;b++){var k=w[b],T=k.geometry,E=k.index,M=k.sourceLayerIndex;if(x&&this.addFeatureDashes(k,_),this.hasPattern){var S=Cc("line",this.layers,k,this.zoom,t);this.patternFeatures.push(S)}else this.addFeature(k,T,E,i,_.positions,t.availableImages);g.insert(e[E].feature,T,E,M,this.index)}}},{key:"addConstantDashes",value:function(e){var t,i=!1,r=l(this.layers);try{for(r.s();!(t=r.n()).done;){var n=t.value,a=n.paint.get("line-dasharray").value,o=n.layout.get("line-cap").value;if("constant"!==a.kind||"constant"!==o.kind)i=!0;else{var s=o.value,u=a.value;if(!u)continue;e.addDash(u,s)}}}catch(c){r.e(c)}finally{r.f()}return i}},{key:"addFeatureDashes",value:function(e,t){var i,r=this.zoom,n=l(this.layers);try{for(n.s();!(i=n.n()).done;){var a=i.value,o=a.paint.get("line-dasharray").value,s=a.layout.get("line-cap").value;if("constant"!==o.kind||"constant"!==s.kind){var u,c=void 0;if("constant"===o.kind){if(!(c=o.value))continue}else c=o.evaluate({zoom:r},e);u="constant"===s.kind?s.value:s.evaluate({zoom:r},e),t.addDash(c,u),e.patterns[a.id]=t.getKey(c,u)}}}catch(h){n.e(h)}finally{n.f()}}},{key:"update",value:function(e,t,i,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i,r)}},{key:"addFeatures",value:function(e,t,i,r,n){var a,o=l(this.patternFeatures);try{for(o.s();!(a=o.n()).done;){var s=a.value;this.addFeature(s,s.geometry,s.index,t,i,r)}}catch(u){o.e(u)}finally{o.f()}}},{key:"isEmpty",value:function(){return 0===this.layoutVertexArray.length}},{key:"uploadPending",value:function(){return!this.uploaded||this.programConfigurations.needsUpload}},{key:"upload",value:function(e){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,Th)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,kh),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}},{key:"destroy",value:function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}},{key:"lineFeatureClips",value:function(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}}},{key:"addFeature",value:function(e,t,i,r,n,a){var o=this.layers[0].layout,s=o.get("line-join").evaluate(e,{}),u=o.get("line-cap").evaluate(e,{}),c=o.get("line-miter-limit"),h=o.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);var f,d=l(t);try{for(d.s();!(f=d.n()).done;){var p=f.value;this.addLine(p,e,s,u,c,h)}}catch(m){d.e(m)}finally{d.f()}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,n,a,r)}},{key:"addLine",value:function(e,t,i,r,n,a){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineS
1oFar=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(var o=0;o<e.length-1;o++)this.totalDistance+=e[o].dist(e[o+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}for(var s="Polygon"===Eh[t.type],l=e.length;l>=2&&e[l-1].equals(e[l-2]);)l--;for(var u=0;u<l-1&&e[u].equals(e[u+1]);)u++;if(!(l<(s?3:2))){"bevel"===i&&(n=1.05);var c,h,f,d,p,m=this.overscaling<=16?122880/(512*this.overscaling):0,v=this.segments.prepareSegment(10*l,this.layoutVertexArray,this.indexArray);this.e1=this.e2=-1,s&&(c=e[l-2],p=e[u].sub(c)._unit()._perp());for(var y=u;y<l;y++)if(!(f=y===l-1?s?e[u+1]:void 0:e[y+1])||!e[y].equals(f)){p&&(d=p),c&&(h=c),c=e[y],p=f?f.sub(c)._unit()._perp():d;var _=(d=d||p).add(p);0===_.x&&0===_.y||_._unit();var g=d.x*p.x+d.y*p.y,x=_.x*p.x+_.y*p.y,b=0!==x?1/x:1/0,w=2*Math.sqrt(2-2*x),k=x<Mh&&h&&f,T=d.x*p.y-d.y*p.x>0;if(k&&y>u){var E=c.dist(h);if(E>2*m){var M=c.sub(c.sub(h)._mult(m/E)._round());this.updateDistance(h,M),this.addCurrentVertex(M,d,0,0,v),h=M}}var S=h&&f,I=S?i:s?"butt":r;if(S&&"round"===I&&(b<a?I="miter":b<=2&&(I="fakeround")),"miter"===I&&b>n&&(I="bevel"),"bevel"===I&&(b>2&&(I="flipbevel"),b<n&&(I="miter")),h&&this.updateDistance(h,c),"miter"
1===I)_._mult(b),this.addCurrentVertex(c,_,0,0,v);else if("flipbevel"===I){if(b>100)_=p.mult(-1);else{var C=b*d.add(p).mag()/d.sub(p).mag();_._perp()._mult(C*(T?-1:1))}this.addCurrentVertex(c,_,0,0,v),this.addCurrentVertex(c,_.mult(-1),0,0,v)}else if("bevel"===I||"fakeround"===I){var A=-Math.sqrt(b*b-1),z=T?A:0,P=T?0:A;if(h&&this.addCurrentVertex(c,d,z,P,v),"fakeround"===I)for(var D=Math.round(180*w/Math.PI/20),L=1;L<D;L++){var R=L/D;if(.5!==R){var B=R-.5;R+=R*B*(R-1)*((1.0904+g*(g*(3.55645-1.43519*g)-3.2452))*B*B+(.848013+g*(.215638*g-1.06021)))}var O=p.sub(d)._mult(R)._add(d)._unit()._mult(T?-1:1);this.addHalfVertex(c,O.x,O.y,!1,T,0,v)}f&&this.addCurrentVertex(c,p,-z,-P,v)}else if("butt"===I)this.addCurrentVertex(c,_,0,0,v);else if("square"===I){var F=h?1:-1;h||this.addCurrentVertex(c,_,F,F,v),this.addCurrentVertex(c,_,0,0,v),h&&this.addCurrentVertex(c,_,F,F,v)}else"round"===I&&(h&&(this.addCurrentVertex(c,d,0,0,v),this.addCurrentVertex(c,d,1,1,v,!0)),f&&(this.addCurrentVertex(c,p,-1,-1,v,!0),this.addCurrentVertex(c,p,0,0,v)));if(k&&y<l-1){var U=c.dist(f);if(U>2*m){var V=c.add(f.sub(c)._mult(m/U)._round());this.updateDistance(c,V),this.addCurrentVertex(V,p,0,0,v),c=V}}}}}},{key:"addCurrentVertex",value:function(e,t,i,r,n){var a=arguments.length>5&&void 0!==arguments[5]&&arguments[5],o=t.y*r-t.x,s=-t.y-t.x*r;this.addHalfVertex(e,t.x+t.y*i,t.y-t.x*i,a,!1,i,n),this.addHalfVertex(e,o,s,a,!0,-r,n)}},{key:"addHalfVertex",value:function(e,t,i,r,n,a,o){var s=e.x,l=e.y;this.layoutVertexArray.emplaceBack((s<<1)+(r?1:0),(l<<1)+(n?1:0),Math.round(63*t)+128,Math.round(63*i)+128,1+(0===a?0:a<0?-1:1),0,this.lineSoFar),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineClips.start,this.lineClips.end);var u=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,u),o.primitiveLength++),n?this.e2=u:this.e1=u}},{key:"updateScaledDistance",value:function(){if(this.lineClips){var e=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=e*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}},{key:"updateDistance",value:function(e,t){this.distance+=e.dist(t),this.updateScaledDistance()}}]),e}();Bn(Sh,"LineBucket",{omit:["layers","patternFeatures"]});var Ih=new Wa({"line-cap":new Za(ft.layout_line["line-cap"]),"line-join":new Za(ft.layout_line["line-join"]),"line-miter-limit":new Ga(ft.layout_line["line-miter-limit"]),"line-round-limit":new Ga(ft.layout_line["line-round-limit"]),"line-sort-key":new Za(ft.layout_line["line-sort-key"])}),Ch={paint:new Wa({"line-opacity":new Za(ft.paint_line["line-opacity"]),"line-color":new Za(ft.paint_line["line-color"]),"line-translate":new Ga(ft.paint_line["line-translate"]),"line-translate-anchor":new Ga(ft.paint_line["line-translate-anchor"]),"line-width":new Za(ft.paint_line["line-width"]),"line-gap-width":new Za(ft.paint_line["line-gap-width"]),"line-offset":new Za(ft.paint_line["line-offset"]),"line-blur":new Za(ft.paint_line["line-blur"]),"line-dasharray":new Za(ft.paint_line["line-dasharray"]),"line-pattern":new Za(ft.paint_line["line-pattern"]),"line-gradient":new qa(ft.paint_line["line-gradient"]),"line-trim-offset":new Ga(ft.paint_line["line-trim-offset"])}),layout:Ih},Ah=new(function(e){p(r,e);var i=m(r);function r(){return h(this,r),i.apply(this,arguments)}return d(r,[{key:"possiblyEvaluate",value:function(e,i){return i=new La(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,transition:i.transition}),t(w(r.prototype),"possiblyEvaluate",this).call(this,e,i)}},{key:"evaluate",value:function(e,i,n,a){return i=W({},i,{zoom:Math.floor(i.zoom)}),t(w(r.prototype),"evaluate",this).call(this,e,i,n,a)}}]),r}(Za))(Ch.paint.properties["line-width"].specification);function zh(e,t){return t>0?t+2*e:e}Ah.useIntegerZoom=!0;var Ph=Ja([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Dh=Ja([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),Lh=Ja([{name:"a_projected_pos",components:4,type:"Float32"}],4);Ja([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);var Rh=Ja([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),Bh=Ja([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"}]);Ja([{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"}]);var Oh=Ja([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Fh=Ja([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Ja([{name:"triangle",components:3,type:"Uint16"}
1]),Ja([{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"}]),Ja([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}
1]),Ja([{type:"Float32",name:"offsetX"}]),Ja([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var Uh=128;function Vh(e,t){var i=t.expression;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new La(e+1))};if("source"===i.kind)return{kind:"source"};for(var r=i.zoomStops,n=i.interpolationType,a=0;a<r.length&&r[a]<=e;)a++;for(var o=a=Math.max(0,a-1);o<r.length&&r[o]<e+1;)o++;o=Math.min(r.length-1,o);var s=r[a],l=r[o];return"composite"===i.kind?{kind:"composite",minZoom:s,maxZoom:l,interpolationType:n}:{kind:"camera",minZoom:s,maxZoom:l,minSize:i.evaluate(new La(s)),maxSize:i.evaluate(new La(l)),interpolationType:n}}function jh(e,t,i){var r=t.uSize,n=t.uSizeT,a=i.lowerSize,o=i.upperSize;return"source"===e.kind?a/Uh:"composite"===e.kind?Di(a/Uh,o/Uh,n):r}function Nh(e,t){var i=0,r=0;if("constant"===e.kind)r=e.layoutSize;else if("source"!==e.kind){var n=e.interpolationType,a=e.minZoom,o=e.maxZoom,s=n?j(Ji.interpolationFactor(n,t,a,o),0,1):0;"camera"===e.kind?r=Di(e.minSize,e.maxSize,s):i=s}return{uSizeT:i,uSize:r}}var Gh=Object.freeze({__proto__:null,getSizeData:Vh,evaluateSizeForFeature:jh,evaluateSizeForZoom:Nh,SIZE_PACK_FACTOR:Uh});function Zh(e,t,i){return e.sections.forEach(function(e){e.text=function(e,t,i){var r=t.layout.get("text-transform").evaluate(i,{});return"uppercase"===r?e=e.toLocaleUpperCase():"lowercase"===r&&(e=e.toLocaleLowerCase()),Da.applyArabicShaping&&(e=Da.applyArabicShaping(e)),e}(e.text,t,i)}),e}var qh={"!":"\ufe15","#":"\uff03",$:"\uff04","%":"\uff05","&":"\uff06","(":"\ufe35",")":"\ufe36","*":"\uff0a","+":"\uff0b",",":"\ufe10","-":"\ufe32",".":"\u30fb","/":"\uff0f",":":"\ufe13",";":"\ufe14","<":"\ufe3f","=":"\uff1d",">":"\ufe40","?":"\ufe16","@":"\uff20","[":"\ufe47","\\":"\uff3c","]":"\ufe48","^":"\uff3e",_:"\ufe33","`":"\uff40","{":"\ufe37","|":"\u2015","}":"\ufe38","~":"\uff5e","\xa2":"\uffe0","\xa3":"\uffe1","\xa5":"\uffe5","\xa6":"\uffe4","\xac":"\uffe2","\xaf":"\uffe3","\u2013":"\ufe32","\u2014":"\ufe31","\u2018":"\ufe43","\u2019":"\ufe44","\u201c":"\ufe41","\u201d":"\ufe42","\u2026":"\ufe19","\u2027":"\u30fb","\u20a9":"\uffe6","\u3001":"\ufe11","\u3002":"\ufe12","\u3008":"\ufe3f","\u3009":"\ufe40","\u300a":"\ufe3d","\u300b":"\ufe3e","\u300c":"\ufe41","\u300d":"\ufe42","\u300e":"\ufe43","\u300f":"\ufe44","\u3010":"\ufe3b","\u3011":"\ufe3c","\u3014":"\ufe39","\u3015":"\ufe3a","\u3016":"\ufe17","\u3017":"\ufe18","\uff01":"\ufe15","\uff08":"\ufe35","\uff09":"\ufe36","\uff0c":"\ufe10","\uff0d":"\ufe32","\uff0e":"\u30fb","\uff1a":"\ufe13","\uff1b":"\ufe14","\uff1c":"\ufe3f","\uff1e":"\ufe40","\uff1f":"\ufe16","\uff3b":"\ufe47","\uff3d":"\ufe48","\uff3f":"\ufe33","\uff5b":"\ufe37","\uff5c":"\u2015","\uff5d":"\ufe38","\uff5f":"\ufe35","\uff60":"\ufe36","\uff61":"\ufe12","\uff62":"\ufe41","\uff63":"\ufe42","\u2190":"\u2191","\u2192":"\u2193"};function Wh(e){return"\ufe36"===e||"\ufe48"===e||"\ufe38"===e||"\ufe44"===e||"\ufe42"===e||"\ufe3e"===e||"\ufe3c"===e||"\ufe3a"===e||"\ufe18"===e||"\ufe40"===e||"\ufe10"===e||"\ufe13"===e||"\ufe14"===e||"\uff40"===e||"\uffe3"===e||"\ufe11"===e||"\ufe12"===e}function Xh(e){return"\ufe35"===e||"\ufe47"===e||"\ufe37"===e||"\ufe43"===e||"\ufe41"===e||"\ufe3d"===e||"\ufe3b"===e||"\ufe39"===e||"\ufe17"===e||"\ufe3f"===e}var Hh=Jh,Yh=function(e,t,i,r,n){var a,o,s=8*n-r-1,l=(1<<s)-1,u=l>>1,c=-7,h=i?n-1:0,f=i?-1:1,d=e[t+h];for(h+=f,a=d&(1<<-c)-1,d>>=-c,c+=s;c>0;a=256*a+e[t+h],h+=f,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=r;c>0;o=256*o+e[t+h],h+=f,c-=8);if(0===a)a=1-u;else{if(a===l)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,r),a-=u}return(d?-1:1)*o*Math.pow(2,a-r)},Kh=function(e,t,i,r,n,a){var o,s,l,u=8*a-n-1,c=(1<<u)-1,h=c>>1,f=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:a-1,p=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),(t+=o+h>=1?f/l:f*Math.pow(2,1-h))*l>=2&&(o++,l/=2),o+h>=c?(s=0,o=c):o+h>=1?(s=(t*l-1)*Math.pow(2,n),o+=h):(s=t*Math.pow(2,h-1)*Math.pow(2,n),o=0));n>=8;e[i+d]=255&s,d+=p,s/=256,n-=8);for(o=o<<n|s,u+=n;u>0;e[i+d]=255&o,d+=p,o/=256,u-=8);e[i+d-p]|=128*m};function Jh(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}Jh.Varint=0,Jh.Fixed64=1,Jh.Bytes=2,Jh.Fixed32=5;var $h=4294967296,Qh=1/$h,ef="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function tf(e){return e.type===Jh.Bytes?e.readVarint()+e.pos:e.pos+1}function rf(e,t,i){var r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));i.realloc(r);for(var n=i.pos-1;n>=e;n--)i.buf[n+r]=i.buf[n]}function nf(e,t){for(var i=0;i<e.length;i++)t.writeVarint(e[i])}function af(e,t){for(var i=0;i<e.length;i++)t.writeSVarint(e[i])}function of(e,t){for(var i=0;i<e.length;i++)t.writeFloat(e[i])}function sf(e,t){for(var i=0;i<e.length;i++)t.writeDouble(e[i])}function lf(e,t){for(var i=0;i<e.length;i++)t.writeBoolean(e[i])}function uf(e,t){for(var i=0;i<e.length;i++)t.writeFixed32(e[i])}function cf(e,t){for(var i=0;i<e.length;i++)t.writeSFixed32(e[i])}function hf(e,t){for(var i=0;i<e.length;
1i++)t.writeFixed64(e[i])}function ff(e,t){for(var i=0;i<e.length;i++)t.writeSFixed64(e[i])}function df(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+16777216*e[t+3]}function pf(e,t,i){e[i]=t,e[i+1]=t>>>8,e[i+2]=t>>>16,e[i+3]=t>>>24}function mf(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function vf(e,t,i){t.glyphs=[],1===e&&i.readMessage(yf,t)}function yf(e,t,i){if(3===e){var r=i.readMessage(_f,{}),n=r.id,a=r.bitmap,o=r.width,s=r.height,l=r.left,u=r.top,c=r.advance;t.glyphs.push({id:n,bitmap:new Gu({width:o+6,height:s+6},a),metrics:{width:o,height:s,left:l,top:u,advance:c}})}else 4===e?t.ascender=i.readSVarint():5===e&&(t.descender=i.readSVarint())}function _f(e,t,i){1===e?t.id=i.readVarint():2===e?t.bitmap=i.readBytes():3===e?t.width=i.readVarint():4===e?t.height=i.readVarint():5===e?t.left=i.readSVarint():6===e?t.top=i.readSVarint():7===e&&(t.advance=i.readVarint())}function gf(e){var t,i=0,r=0,n=l(e);try{for(n.s();!(t=n.n()).done;){var a=t.value;i+=a.w*a.h,r=Math.max(r,a.w)}}catch(v){n.e(v)}finally{n.f()}e.sort(function(e,t){return t.h-e.h});var o,s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(i/.95)),r),h:1/0}],u=0,c=0,h=l(e);try{for(h.s();!(o=h.n()).done;)for(var f=o.value,d=s.length-1;d>=0;d--){var p=s[d];if(!(f.w>p.w||f.h>p.h)){if(f.x=p.x,f.y=p.y,c=Math.max(c,f.y+f.h),u=Math.max(u,f.x+f.w),f.w===p.w&&f.h===p.h){var m=s.pop();d<s.length&&(s[d]=m)}else f.h===p.h?(p.x+=f.w,p.w-=f.w):f.w===p.w?(p.y+=f.h,p.h-=f.h):(s.push({x:p.x+f.w,y:p.y,w:p.w-f.w,h:f.h}),p.y+=f.h,p.h-=f.h);break}}}catch(v){h.e(v)}finally{h.f()}return{w:u,h:c,fill:i/(u*c)||0}}Jh.prototype={destroy:function(){this.buf=null},readFields:function(e,t,i){for(i=i||this.length;this.pos<i;){var r=this.readVarint(),n=r>>3,a=this.pos;this.type=7&r,e(n,t,this),this.pos===a&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=df(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=mf(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=df(this.buf,this.pos)+df(this.buf,this.pos+4)*$h;return this.pos+=8,e},readSFixed64:function(){var e=df(this.buf,this.pos)+mf(this.buf,this.pos+4)*$h;return this.pos+=8,e},readFloat:function(){var e=Yh(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=Yh(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t,i,r=this.buf;return t=127&(i=r[this.pos++]),i<128?t:(t|=(127&(i=r[this.pos++]))<<7,i<128?t:(t|=(127&(i=r[this.pos++]))<<14,i<128?t:(t|=(127&(i=r[this.pos++]))<<21,i<128?t:function(e,t,i){var r,n,a=i.buf;if(r=(112&(n=a[i.pos++]))>>4,n<128||(r|=(127&(n=a[i.pos++]))<<3,n<128)||(r|=(127&(n=a[i.pos++]))<<10,n<128)||(r|=(127&(n=a[i.pos++]))<<17,n<128)||(r|=(127&(n=a[i.pos++]))<<24,n<128)||(r|=(1&(n=a[i.pos++]))<<31,n<128))return function(e,t,i){return i?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}(e,r,t);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(i=r[this.pos]))<<28,e,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2==1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&ef?ef.decode(this.buf.subarray(t,e)):function(e,t,i){for(var r="",n=t;n<i;){var a,o,s,l=e[n],u=null,c=l>239?4:l>223?3:l>191?2:1;if(n+c>i)break;
vendor: 6,238 bytes, line 1
11===c?l<128&&(u=l):2===c?128==(192&(a=e[n+1]))&&(u=(31&l)<<6|63&a)<=127&&(u=null):3===c?(o=e[n+2],128==(192&(a=e[n+1]))&&128==(192&o)&&((u=(15&l)<<12|(63&a)<<6|63&o)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(o=e[n+2],s=e[n+3],128==(192&(a=e[n+1]))&&128==(192&o)&&128==(192&s)&&((u=(15&l)<<18|(63&a)<<12|(63&o)<<6|63&s)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,r+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),r+=String.fromCharCode(u),n+=c}return r}(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==Jh.Bytes)return e.push(this.readVarint(t));var i=tf(this);for(e=e||[];this.pos<i;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==Jh.Bytes)return e.push(this.readSVarint());var t=tf(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==Jh.Bytes)return e.push(this.readBoolean());var t=tf(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==Jh.Bytes)return e.push(this.readFloat());var t=tf(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==Jh.Bytes)return e.push(this.readDouble());var t=tf(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==Jh.Bytes)return e.push(this.readFixed32());var t=tf(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==Jh.Bytes)return e.push(this.readSFixed32());var t=tf(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==Jh.Bytes)return e.push(this.readFixed64());var t=tf(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==Jh.Bytes)return e.push(this.readSFixed64());var t=tf(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=7&e;if(t===Jh.Varint)for(;this.buf[this.pos++]>127;);else if(t===Jh.Bytes)this.pos=this.readVarint()+this.pos;else if(t===Jh.Fixed32)this.pos+=4;else{if(t!==Jh.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var i=new Uint8Array(t);i.set(this.buf),this.buf=i,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),pf(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),pf(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),pf(this.buf,-1&e,this.pos),pf(this.buf,Math.floor(e*Qh),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),pf(this.buf,-1&e,this.pos),pf(this.buf,Math.floor(e*Qh),this.pos+4),this.pos+=8},writeVarint:function(e){(e=+e||0)>268435455||e<0?function(e,t){var i,r,n,a;if(e>=0?(i=e%4294967296|0,r=e/4294967296|0):(r=~(-e/4294967296),4294967295^(i=~(-e%4294967296))?i=i+1|0:(i=0,r=r+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),n=i,(a=t).buf[a.pos++]=127&n|128,n>>>=7,a.buf[a.pos++]=127&n|128,n>>>=7,a.buf[a.pos++]=127&n|128,n>>>=7,a.buf[a.pos++]=127&n|128,a.buf[a.pos]=127&(n>>>=7),function(e,t){var i=(7&e)<<4;t.buf[t.pos++]|=i|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(r,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,i){for(var r,n,a=0;a<t.length;a++){if((r=t.charCodeAt(a))>55295&&r<57344){if(!n){r>56319||a+1===t.length?(e[i++]=239,e[i++]=191,e[i++]=189):n=r;continue}if(r<56320){e[i++]=239,e[i++]=191,e[i++]=189,n=r;continue}r=n-55296<<10|r-56320|65536,n=null}else n&&(e[i++]=239,e[i++]=191,e[i++]=189,n=null);r<128?e[i++]=r:(r<2048?e[i++]=r>>6|192:(r<65536?e[i++]=r>>12|224:(e[i++]=r>>18|240,e[i++]=r>>12&63|128),e[i++]=r>>6&63|128),e[i++]=63&r|128)}return i}(this.buf,e,this.pos);var i=this.pos-t;i>=128&&rf(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i},writeFloat:function(e){this.realloc(4),Kh(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),Kh(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var i=0;i<t;i++)this.buf[this.pos++]=e[i]},writeRawMessage:function(e,t){this.pos++;var i=this.pos;e(t,this);var r=this.pos-i;r>=128&&rf(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,t,i){this.writeTag(e,Jh.Bytes),this.writeRawMessage(t,i)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,nf,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,af,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,lf,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,of,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,sf,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,uf,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,cf,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,hf,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,ff,t)},writeBytesField:function(e,t){this.writeTag(e,Jh.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,Jh.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,Jh.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,Jh.Fixed64),this.writeFixed64
1(t)},writeSFixed64Field:function(e,t){this.writeTag(e,Jh.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,Jh.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,Jh.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,Jh.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,Jh.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,Jh.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};var xf=function(){function e(t,i){var r=i.pixelRatio,n=i.version,a=i.stretchX,o=i.stretchY,s=i.content;h(this,e),this.paddedRect=t,this.pixelRatio=r,this.stretchX=a,this.stretchY=o,this.content=s,this.version=n}return d(e,[{key:"tl",get:function(){return[this.paddedRect.x+1,this.paddedRect.y+1]}},{key:"br",get:function(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}},{key:"displaySize",get:function(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}]),e}(),bf=function(){function e(t,i){h(this,e);var r={},n={};this.haveRenderCallbacks=[];var a=[];this.addImages(t,r,a),this.addImages(i,n,a);var o=gf(a),s=o.w,l=o.h,u=new Zu({width:s||1,height:l||1});for(var c in t){var f=t[c],d=r[c].paddedRect;Zu.copy(f.data,u,{x:0,y:0},{x:d.x+1,y:d.y+1},f.data)}for(var p in i){var m=i[p],v=n[p].paddedRect,y=v.x+1,_=v.y+1,g=m.data.width,x=m.data.height;Zu.copy(m.data,u,{x:0,y:0},{x:y,y:_},m.data),Zu.copy(m.data,u,{x:0,y:x-1},{x:y,y:_-1},{width:g,height:1}),Zu.copy(m.data,u,{x:0,y:0},{x:y,y:_+x},{width:g,height:1}),Zu.copy(m.data,u,{x:g-1,y:0},{x:y-1,y:_},{width:1,height:x}),Zu.copy(m.data,u,{x:0,y:0},{x:y+g,y:_},{width:1,height:x})}this.image=u,this.iconPositions=r,this.patternPositions=n}return d(e,[{key:"addImages",value:function(e,t,i){for(var r in e){var n=e[r],a={x:0,y:0,w:n.data.width+2,h:n.data.height+2};i.push(a),t[r]=new xf(a,n),n.hasRenderCallback&&this.haveRenderCallbacks.push(r)}}},{key:"patchUpdatedImages",value:function(e,t){for(var i in this.haveRenderCallbacks=this.haveRenderCallbacks.filter(function(t){return e.hasImage(t)}),e.dispatchRenderCallbacks(this.haveRenderCallbacks),e.updatedImages)this.patchUpdatedImage(this.iconPositions[i],e.getImage(i),t),this.patchUpdatedImage(this.patternPositions[i],e.getImage(i),t)}},{key:"patchUpdatedImage",value:function(e,t,i){if(e&&t&&e.version!==t.version){e.version=t.version;var r=a(e.tl,2),n=r[0],o=r[1];i.update(t.data,void 0,{x:n,y:o})}}}]),e}();Bn(xf,"ImagePosition"),Bn(bf,"ImageAtlas");var wf={horizontal:1,vertical:2,horizontalOnly:3},kf=function(){function e(){h(this,e),this.scale=1,this.fontStack="",this.imageName=null}return d(e,null,[{key:"forText",value:function(t,i){var r=new e;return r.scale=t||1,r.fontStack=i,r}},{key:"forImage",value:function(t){var i=new e;return i.imageName=t,i}}]),e}(),Tf=function(){function e(){h(this,e),this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}return d(e,[{key:"length",value:function(){return this.text.length}},{key:"getSection",value:function(e){return this.sections[this.sectionIndex[e]]}},{key:"getSections",value:function(){return this.sections}},{key:"getSectionIndex",value:function(e){return this.sectionIndex[e]}},{key:"getCharCode",value:function(e){return this.text.charCodeAt(e)}},{key:"verticalizePunctuation",value:function(e){this.text=function(e,t){for(var i="",r=0;r<e.length;r++){var n=e.charCodeAt(r+1)||null,a=e.charCodeAt(r-1)||null;i+=!t&&(n&&_a(n)&&!qh[e[r+1]]||a&&_a(a)&&!qh[e[r-1]])||!qh[e[r]]?e[r]:qh[e[r]]}return i}(this.text,e)}},{key:"trim",value:function(){for(var e=0,t=0;t<this.text.length&&Mf[this.text.charCodeAt(t)];t++)e++;for(var i=this.text.length,r=this.text.length-1;r>=0&&r>=e&&Mf[this.text.charCodeAt(r)];r--)i--;this.text=this.text.substring(e,i),this.sectionIndex=this.sectionIndex.slice(e,i)}},{key:"substring",value:function(t,i){var r=new e;return r.text=this.text.substring(t,i),r.sectionIndex=this.sectionIndex.slice(t,i),r.sections=this.sections,r}},{key:"toString",value:function(){return this.text}},{key:"getMaxScale",value:function(){var e=this;return this.sectionIndex.reduce(function(t,i){return Math.max(t,e.sections[i].scale)}
1,0)}},{key:"addTextSection",value:function(e,t){this.text+=e.text,this.sections.push(kf.forText(e.scale,e.fontStack||t));for(var i=this.sections.length-1,r=0;r<e.text.length;++r)this.sectionIndex.push(i)}},{key:"addImageSection",value:function(e){var t=e.image?e.image.name:"";if(0!==t.length){var i=this.getNextImageSectionCharCode();i?(this.text+=String.fromCharCode(i),this.sections.push(kf.forImage(t)),this.sectionIndex.push(this.sections.length-1)):ne("Reached maximum number of images 6401")}else ne("Can't add FormattedSection with an empty image.")}},{key:"getNextImageSectionCharCode",value:function(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}],[{key:"fromFeature",value:function(t,i){for(var r=new e,n=0;n<t.sections.length;n++){var a=t.sections[n];a.image?r.addImageSection(a):r.addTextSection(a,i)}return r}}]),e}();function Ef(e,t,i,r,n,a,o,s,u,c,h,f,d,p,m){var v=Tf.fromFeature(e,n);f===wf.vertical&&v.verticalizePunctuation(d);var y=[],_=function(e,t,i,r,n,a){if(!e)return[];for(var o,s=[],l=function(e,t,i,r,n,a){for(var o=0,s=0;s<e.length();s++){var l=e.getSection(s);o+=If(e.getCharCode(s),l,r,n,t,a)}return o/Math.max(1,Math.ceil(o/i))}(e,t,i,r,n,a),u=e.text.indexOf("\u200b")>=0,c=0,h=0;h<e.length();h++){var f=e.getSection(h),d=e.getCharCode(h);if(Mf[d]||(c+=If(d,f,r,n,t,a)),h<e.length()-1){var p=!((o=d)<11904||!($n(o)||Jn(o)||ha(o)||la(o)||ia(o)||qn(o)||Qn(o)||Hn(o)||ra(o)||na(o)||ta(o)||pa(o)||Yn(o)||Xn(o)||Wn(o)||ea(o)||Kn(o)||ca(o)||oa(o)||aa(o)));(Sf[d]||p||f.imageName)&&s.push(zf(h+1,c,l,s,Af(d,e.getCharCode(h+1),p&&u),!1))}}return Pf(zf(e.length(),c,l,s,0,!0))}(v,c,a,t,r,p),g=Da.processBidirectionalText,x=Da.processStyledBidirectionalText;if(g&&1===v.sections.length){var b,w=l(g(v.toString(),_));try{for(w.s();!(b=w.n()).done;){var k=b.value,T=new Tf;T.text=k,T.sections=v.sections;for(var E=0;E<k.length;E++)T.sectionIndex.push(0);y.push(T)}}catch(P){w.e(P)}finally{w.f()}}else if(x){var M,S=l(x(v.text,v.sectionIndex,_));try{for(S.s();!(M=S.n()).done;){var I=M.value,C=new Tf;C.text=I[0],C.sectionIndex=I[1],C.sections=v.sections,y.push(C)}}catch(P){S.e(P)}finally{S.f()}}else y=function(e,t){var i,r=[],n=e.text,a=0,o=l(t);try{for(o.s();!(i=o.n()).done;){var s=i.value;r.push(e.substring(a,s)),a=s}}catch(P){o.e(P)}finally{o.f()}return a<n.length&&r.push(e.substring(a,n.length)),r}(v,_);var A=[],z={positionedLines:A,text:v.toString(),top:h[1],bottom:h[1],left:h[0],right:h[0],writingMode:f,iconsInText:!1,verticalizable:!1,hasBaseline:!1};return function(e,t,i,r,n,a,o,s,u,c,h,f){var d,p=0,m=0,v=0,y="right"===s?1:"left"===s?0:.5,_=!1,g=l(n);try{for(g.s();!(d=g.n()).done;){var x,b=l(d.value.getSections());try{for(b.s();!(x=b.n()).done;){var w=x.value;if(!w.imageName){var k=t[w.fontStack];if(k&&!(_=void 0!==k.ascender&&void 0!==k.descender))break}}}catch(P){b.e(P)}finally{b.f()}if(!_)break}}catch(P){g.e(P)}finally{g.f()}var T,E,M=0,S=l(n);try{for(S.s();!(T=S.n()).done;){var I=T.value;I.trim();var C=I.getMaxScale(),A=24*(C-1),z={positionedGlyphs:[],lineOffset:0};e.positionedLines[M]=z;var D=z.positionedGlyphs,L=0;if(I.length()){for(var R=0,B=0,O=0;O<I.length();O++){var F=I.getSection(O),U=I.getSectionIndex(O),V=I.getCharCode(O),j=F.scale,N=null,G=null,Z=null,q=24,W=0,X=!(u===wf.horizontal||!h&&!ya(V)||h&&(Mf[V]||(E=V,Nn(E)||Gn(E)||Zn(E)||ua(E)||da(E))));if(F.imageName){var H=r[F.imageName];if(!H)continue;Z=F.imageName,e.iconsInText=e.iconsInText||!0,G=H.paddedRect;var Y=H.displaySize;j=24*j/f,N={width:Y[0],height:Y[1],left:1,top:-3,advance:X?Y[1]:Y[0],localGlyph:!1},W=_?-N.height*j:24*C-17-Y[1]*j,q=N.advance;var K=(X?Y[0]:Y[1])*j-24*C;K>0&&K>L&&(L=K)}else{var J=i[F.fontStack];if(!J)continue;J[V]&&(G=J[V]);var $=t[F.fontStack];if(!$)continue;var Q=$.glyphs[V];if(!Q)continue;if(N=Q.metrics,q=8203!==V?24:0,_){var ee=void 0!==$.ascender?Math.abs($.ascender):0,te=void 0!==$.descender?Math.abs($.descender):0,ie=(ee+te)*j;R<ie&&(R=ie,B=(ee-te)/2*j),W=-ee*j}else W=24*(C-j)-17}X?(e.verticalizable=!0,D.push({glyph:V,imageName:Z,x:p,y:m+W,vertical:X,scale:j,localGlyph:N.localGlyph,fontStack:F.fontStack,sectionIndex:U,metrics:N,rect:G}),p+=q*j+c):(D.push({glyph:V,imageName:Z,x:p,y:m+W,vertical:X,scale:j,localGlyph:N.localGlyph,fontStack:F.fontStack,sectionIndex:U,metrics:N,rect:G}),p+=N.advance*j+c)}0!==D.length&&(v=Math.max(p-c,v),_?Lf(D,y,L,B,a*C/2):Lf(D,y,L,0,a/2)),p=0;var re=a*C+L;z.lineOffset=Math.max(L,A),m+=re,++M}
1else m+=a,++M}}catch(P){S.e(P)}finally{S.f()}var ne=m,ae=Df(o),oe=ae.horizontalAlign,se=ae.verticalAlign;(function(e,t,i,r,n,a){var o,s=(t-i)*n,u=-a*r,c=l(e);try{for(c.s();!(o=c.n()).done;){var h,f=l(o.value.positionedGlyphs);try{for(f.s();!(h=f.n()).done;){var d=h.value;d.x+=s,d.y+=u}}catch(P){f.e(P)}finally{f.f()}}}catch(P){c.e(P)}finally{c.f()}})(e.positionedLines,y,oe,se,v,ne),e.top+=-se*ne,e.bottom=e.top+ne,e.left+=-oe*v,e.right=e.left+v,e.hasBaseline=_}(z,t,i,r,y,o,s,u,f,c,d,m),!function(e){var t,i=l(e);try{for(i.s();!(t=i.n()).done;){if(0!==t.value.positionedGlyphs.length)return!1}}catch(P){i.e(P)}finally{i.f()}return!0}(A)&&z}var Mf={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Sf={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 If(e,t,i,r,n,a){if(t.imageName){var o=r[t.imageName];return o?o.displaySize[0]*t.scale*24/a+n:0}var s=i[t.fontStack],l=s&&s.glyphs[e];return l?l.metrics.advance*t.scale+n:0}function Cf(e,t,i,r){var n=Math.pow(e-t,2);return r?e<t?n/2:2*n:n+Math.abs(i)*i}function Af(e,t,i){var r=0;return 10===e&&(r-=1e4),i&&(r+=150),40!==e&&65288!==e||(r+=50),41!==t&&65289!==t||(r+=50),r}function zf(e,t,i,r,n,a){var o,s=null,u=Cf(t,i,n,a),c=l(r);try{for(c.s();!(o=c.n()).done;){var h=o.value,f=Cf(t-h.x,i,n,a)+h.badness;f<=u&&(s=h,u=f)}
1}catch(d){c.e(d)}finally{c.f()}return{index:e,x:t,priorBreak:s,badness:u}}function Pf(e){return e?Pf(e.priorBreak).concat(e.index):[]}function Df(e){var t=.5,i=.5;switch(e){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(e){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:t,verticalAlign:i}}function Lf(e,t,i,r,n){if(t||i||r||n)for(var a=e.length-1,o=e[a],s=(o.x+o.metrics.advance*o.scale)*t,l=0;l<=a;l++)e[l].x-=s,e[l].y+=i+r+n}function Rf(e,t,i,r,n,a){var o,s=e.image;if(s.content){var l=s.content,u=s.pixelRatio||1;o=[l[0]/u,l[1]/u,s.displaySize[0]-l[2]/u,s.displaySize[1]-l[3]/u]}var c,h,f,d,p=t.left*a,m=t.right*a;"width"===i||"both"===i?(d=n[0]+p-r[3],h=n[0]+m+r[1]):h=(d=n[0]+(p+m-s.displaySize[0])/2)+s.displaySize[0];var v=t.top*a,y=t.bottom*a;return"height"===i||"both"===i?(c=n[1]+v-r[0],f=n[1]+y+r[2]):f=(c=n[1]+(v+y-s.displaySize[1])/2)+s.displaySize[1],{image:s,top:c,right:h,bottom:f,left:d,collisionPadding:o}}var Bf=function(e){p(i,e);var t=m(i);function i(e,r,n,a,o){var s;return h(this,i),(s=t.call(this,e,r)).angle=a,s.z=n,void 0!==o&&(s.segment=o),s}return d(i,[{key:"clone",value:function(){return new i(this.x,this.y,this.z,this.angle,this.segment)}}]),i}(z);function Of(e,t,i,r,n){if(void 0===t.segment)return!0;for(var a=t,o=t.segment+1,s=0;s>-i/2;){if(--o<0)return!1;s-=e[o].dist(a),a=e[o]}s+=e[o].dist(e[o+1]),o++;for(var l=[],u=0;s<i/2;){var c=e[o],h=e[o+1];if(!h)return!1;var f=e[o-1].angleTo(c)-c.angleTo(h);for(f=Math.abs((f+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:s,angleDelta:f}),u+=f;s-l[0].distance>r;)u-=l.shift().angleDelta;if(u>n)return!1;o++,s+=c.dist(h)}return!0}function Ff(e){for(var t=0,i=0;i<e.length-1;i++)t+=e[i].dist(e[i+1]);return t}function Uf(e,t,i){return e?.6*t*i:0}function Vf(e,t){return Math.max(e?e.right-e.left:0,t?t.right-t.left:0)}function jf(e,t,i,r,n,a){for(var o=Uf(i,n,a),s=Vf(i,r)*a,l=0,u=Ff(e)/2,c=0;c<e.length-1;c++){var h=e[c],f=e[c+1],d=h.dist(f);if(l+d>u){var p=(u-l)/d,m=Di(h.x,f.x,p),v=Di(h.y,f.y,p),y=new Bf(m,v,0,f.angleTo(h),c);return!o||Of(e,y,s,o,t)?y:void 0}l+=d}}function Nf(e,t,i,r,n,a,o,s,l){var u=Uf(r,a,o),c=Vf(r,n),h=c*o,f=0===e[0].x||e[0].x===l||0===e[0].y||e[0].y===l;return t-h<t/4&&(t=h+t/4),Gf(e,f?t/2*s%t:(c/2+2*a)*o*s%t,t,u,i,h,f,!1,l)}function Gf(e,t,i,r,n,a,o,s,l){for(var u=a/2,c=Ff(e),h=0,f=t-i,d=[],p=0;p<e.length-1;p++){for(var m=e[p],v=e[p+1],y=m.dist(v),_=v.angleTo(m);f+i<h+y;){var g=((f+=i)-h)/y,x=Di(m.x,v.x,g),b=Di(m.y,v.y,g);if(x>=0&&x<l&&b>=0&&b<l&&f-u>=0&&f+u<=c){var w=new Bf(x,b,0,_,p);w._round(),r&&!Of(e,w,a,r,n)||d.push(w)}}h+=y}return s||d.length||o||(d=Gf(e,h/2,i,r,n,a,o,!0,l)),d}function Zf(e,t,i,r,n){for(var a=[],o=0;o<e.length;o++)for(var s=e[o],l=void 0,u=0;u<s.length-1;u++){var c=s[u],h=s[u+1];c.x<t&&h.x<t||(c.x<t?c=new z(t,c.y+(t-c.x)/(h.x-c.x)*(h.y-c.y))._round():h.x<t&&(h=new z(t,c.y+(t-c.x)/(h.x-c.x)*(h.y-c.y))._round()),c.y<i&&h.y<i||(c.y<i?c=new z(c.x+(i-c.y)/(h.y-c.y)*(h.x-c.x),i)._round():h.y<i&&(h=new z(c.x+(i-c.y)/(h.y-c.y)*(h.x-c.x),i)._round()),c.x>=r&&h.x>=r||(c.x>=r?c=new z(r,c.y+(r-c.x)/(h.x-c.x)*(h.y-c.y))._round():h.x>=r&&(h=new z(r,c.y+(r-c.x)/(h.x-c.x)*(h.y-c.y))._round()),c.y>=n&&h.y>=n||(c.y>=n?c=new z(c.x+(n-c.y)/(h.y-c.y)*(h.x-c.x),n)._round():h.y>=n&&(h=new z(c.x+(n-c.y)/(h.y-c.y)*(h.x-c.x),n)._round()),l&&c.equals(l[l.length-1])||(l=[c],a.push(l)),l.push(h)))))}return a}Bn(Bf,"Anchor");var qf=1e20;function Wf(e,t,i,r,n,a,o,s,l){for(var u=t;u<t+r;u++)Xf(e,i*a+u,a,n,o,s,l);for(var c=i;c<i+n;c++)Xf(e,c*a+t,1,r,o,s,l)}function Xf(e,t,i,r,n,a,o){a[0]=0,o[0]=-qf,o[1]=qf,n[0]=e[t];for(var s=1,l=0,u=0;s<r;s++){n[s]=e[t+s*i];var c=s*s;do{var h=a[l];u=(n[s]-n[h]+c-h*h)/(s-h)/2}while(u<=o[l]&&--l>-1);a[++l]=s,o[l]=u,o[l+1]=qf}for(var f=0,d=0;f<r;f++){for(;o[d+1]<f;)d++;var p=a[d],m=f-p;e[t+f*i]=n[p]+m*m}}var Hf={none:0,ideographs:1,all:2},Yf=function(){function e(t,i,r){h(this,e),this.requestManager=t,this.localGlyphMode=i,this.localFontFamily=r,this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}return d(e,[{key:"setURL",value:function(e){this.url=e}},{key:"getGlyphs",value:function(t,i){var r=this,n=[];for(var a in t){var o,s=l(t[a]);try{for(s.s();!(o=s.n()).done;){var u=o.value;n.push({stack:a,id:u})}}catch(c){s.e(c)}finally{s.f()}}Z(n,function(t,i){var n=t.stack,a=t.id,o=r.entries[n];o||(o=r.entries[n]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});var s=o.glyphs[a];if(void 0===s){if(s=r._tinySDF(o,n,a))return o.glyphs[a]=s,void i(null,{stack:n,id:a,glyph:s});var u=Math.floor(a/256);if(256*u>65535)i(new Error("glyphs > 65535 not supported"));else if(o.ranges[u])i(null,{stack:n,id:a,glyph:s});else{var h=o.requests[u];h||(h=o.requests[u]=[],e.loadGlyphRange(n,u,r.url,r.requestManager,function(e,t){if(t){for(var i in o.ascender=t.ascender,o.descender=t.descender,t.glyphs)r._doesCharSupportLocalGlyph(+i)||(o.glyphs[+i]=t.glyphs[+i]);o.ranges[u]=!0}var n,a=l(h);try{for(a.s();!(n=a.n()).done;){(0,n.value)(e,t)}}catch(c){a.e(c)}finally{a.f()}delete o.requests[u]})),h.push(function(e,t){e?i(e):t&&i(null,{stack:n,id:a,glyph:t.glyphs[a]||null})})}}else i(null,{stack:n,id:a,glyph:s})},function(e,t){if(e)i(e);else if(t){var n,a={},o=l(t);try{for(o.s();!(n=o.n()).done;){var s=n.value,u=s.stack,h=s.id,f=s.glyph;void 0===a[u]&&(a[u]={}),void 0===a[u].glyphs&&(a[u].glyphs={}),a[u].glyphs[h]=f&&{id:f.id,bitmap:f.bitmap.clone(),metrics:f.metrics},a[u].ascender=r.entries[u].ascender,a[u].descender=r.entries[u].descender}}catch(c){o.e(c)}finally{o.f()}i(null,a)}})}},{key:"_doesCharSupportLocalGlyph",value:function(e){return this.localGlyphMode!==Hf.none&&(this.localGlyphMode===Hf.all?!!this.localFontFamily:!!this.localFontFamily&&
1(na(e)||sa(e)||Yn(e)||Kn(e)||Hn(e)))}},{key:"_tinySDF",value:function(t,i,r){var n=this.localFontFamily;if(n&&this._doesCharSupportLocalGlyph(r)){var a=t.tinySDF;if(!a){var o="400";/bold/i.test(i)?o="900":/medium/i.test(i)?o="500":/light/i.test(i)&&(o="200"),(a=t.tinySDF=new e.TinySDF({fontFamily:n,fontWeight:o,fontSize:48,buffer:6,radius:16})).fontWeight=o}if(this.localGlyphs[a.fontWeight][r])return this.localGlyphs[a.fontWeight][r];var s=String.fromCharCode(r),l=a.draw(s),u=l.data,c=l.width,h=l.height,f=l.glyphWidth,d=l.glyphHeight,p=l.glyphLeft,m=l.glyphTop,v=l.glyphAdvance;return this.localGlyphs[a.fontWeight][r]={id:r,bitmap:new Gu({width:c,height:h},u),metrics:{width:f/2,height:d/2,left:p/2,top:m/2-27,advance:v/2,localGlyph:!0}}}}}]),e}();function Kf(e,t,i,r){var n=[],a=e.image,o=a.pixelRatio,s=a.paddedRect.w-2,l=a.paddedRect.h-2,u=e.right-e.left,c=e.bottom-e.top,h=a.stretchX||[[0,s]],f=a.stretchY||[[0,l]],d=function(e,t){return e+t[1]-t[0]},p=h.reduce(d,0),m=f.reduce(d,0),v=s-p,y=l-m,_=0,g=p,x=0,b=m,w=0,k=v,T=0,E=y;if(a.content&&r){var M=a.content;_=Jf(h,0,M[0]),x=Jf(f,0,M[1]),g=Jf(h,M[0],M[2]),b=Jf(f,M[1],M[3]),w=M[0]-_,T=M[1]-x,k=M[2]-M[0]-g,E=M[3]-M[1]-b}var S=function(r,n,s,l){var h=Qf(r.stretch-_,g,u,e.left),f=ed(r.fixed-w,k,r.stretch,p),d=Qf(n.stretch-x,b,c,e.top),v=ed(n.fixed-T,E,n.stretch,m),y=Qf(s.stretch-_,g,u,e.left),M=ed(s.fixed-w,k,s.stretch,p),S=Qf(l.stretch-x,b,c,e.top),I=ed(l.fixed-T,E,l.stretch,m),C=new z(h,d),A=new z(y,d),P=new z(y,S),D=new z(h,S),L=new z(f/o,v/o),R=new z(M/o,I/o),B=t*Math.PI/180;if(B){var O=Math.sin(B),F=Math.cos(B),U=[F,-O,O,F];C._matMult(U),A._matMult(U),D._matMult(U),P._matMult(U)}var V=r.stretch+r.fixed,j=n.stretch+n.fixed;return{tl:C,tr:A,bl:D,br:P,tex:{x:a.paddedRect.x+1+V,y:a.paddedRect.y+1+j,w:s.stretch+s.fixed-V,h:l.stretch+l.fixed-j},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:L,pixelOffsetBR:R,minFontScaleX:k/o/u,minFontScaleY:E/o/c,isSDF:i}};if(r&&(a.stretchX||a.stretchY))for(var I=$f(h,v,p),C=$f(f,y,m),A=0;A<I.length-1;A++)for(var P=I[A],D=I[A+1],L=0;L<C.length-1;L++)n.push(S(P,C[L],D,C[L+1]));else n.push(S({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:s+1},{fixed:0,stretch:l+1}));return n}function Jf(e,t,i){var r,n=0,a=l(e);try{for(a.s();!(r=a.n()).done;){var o=r.value;n+=Math.max(t,Math.min(i,o[1]))-Math.max(t,Math.min(i,o[0]))}}catch(s){a.e(s)}finally{a.f()}return n}function $f(e,t,i){var r,n=[{fixed:-1,stretch:0}],o=l(e);try{for(o.s();!(r=o.n()).done;){var s=a(r.value,2),u=s[0],c=s[1],h=n[n.length-1];n.push({fixed:u-h.stretch,stretch:h.stretch}),n.push({fixed:u-h.stretch,stretch:h.stretch+(c-u)})}}catch(f){o.e(f)}finally{o.f()}return n.push({fixed:t+1,stretch:i}),n}function Qf(e,t,i,r){return e/t*i+r}function ed(e,t,i,r){return e-t*i/r}function td(e,t,i,r){var n=t+e.positionedLines[r].lineOffset;return 0===r?i+n/2:i+(n+(t+e.positionedLines[r-1].lineOffset))/2}Yf.loadGlyphRange=function(e,t,i,r,n){var a=256*t,o=a+255,s=r.transformRequest(r.normalizeGlyphsURL(i).replace("{fontstack}",e).replace("{range}","".concat(a,"-").concat(o)),we.Glyphs);Me(s,function(e,t){if(e)n(e);else if(t){var i,r={},a=new Hh(t).readFields(vf,{}),o=l(a.glyphs);try{for(o.s();!(i=o.n()).done;){var s=i.value;r[s.id]=s}}catch(u){o.e(u)}finally{o.f()}n(null,{glyphs:r,ascender:a.ascender,descender:a.descender})}})},Yf.TinySDF=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.fontSize,r=void 0===i?24:i,n=t.buffer,a=void 0===n?3:n,o=t.radius,s=void 0===o?8:o,l=t.cutoff,u=void 0===l?.25:l,c=t.fontFamily,f=void 0===c?"sans-serif":c,d=t.fontWeight,p=void 0===d?"normal":d,m=t.fontStyle,v=void 0===m?"normal":m;h(this,e),this.buffer=a,this.cutoff=u,this.radius=s;var y=this.size=r+4*a,_=this._createCanvas(y),g=this.ctx=_.getContext("2d",{willReadFrequently:!0});g.font="".concat(v," ").concat(p," ").concat(r,"px ").concat(f),g.textBaseline="alphabetic",g.textAlign="left",g.fillStyle="black",this.gridOuter=new Float64Array(y*y),this.gridInner=new Float64Array(y*y),this.f=new Float64Array(y),this.z=new Float64Array(y+1),this.v=new Uint16Array(y)}return d(e,[{key:"_createCanvas",value:function(e){var t=document.createElement("canvas");return t.width=t.height=e,t}},{key:"draw",value:function(e){var t=this.ctx.measureText(e),i=t.width,r=t.actualBoundingBoxAscent,n=t.actualBoundingBoxDescent,a=t.actualBoundingBoxLeft,o=t.actualBoundingBoxRight,s=Math.ceil(r),l=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o-a))),u=Math.min(this.size-this.buffer,s+Math.ceil(n)),c=l+2*this.buffer,h=u+2*this.buffer,f=Math.max(c*h,0),d=new Uint8ClampedArray(f),p={data:d,width:c,height:h,glyphWidth:l,glyphHeight:u,glyphTop:s,glyphLeft:0,glyphAdvance:i};if(0===l||0===u)return p;var m=this.ctx,v=this.buffer,y=this.gridInner,_=this.gridOuter;m.clearRect(v,v,l,u),m.fillText(e,v,v+s);var g=m.getImageData(v,v,l,u);_.fill(qf,0,f),y.fill(0,0,f);for(var x=0;x<u;x++)for(var b=0;b<l;b++){var w=g.data[4*(x*l+b)+3]/255;if(0!==w){var k=(x+v)*c+b+v;if(1===w)_[k]=0,y[k]=qf;else{var T=.5-w;_[k]=T>0?T*T:0,y[k]=T<0?T*T:0}}}Wf(_,0,0,c,h,c,this.f,this.v,this.z),Wf(y,v,v,l,u,c,this.f,this.v,this.z);for(var E=0;E<f;E++){var M=Math.sqrt(_[E])-Math.sqrt(y[E]);d[E]=Math.round(255-255*(M/this.radius+this.cutoff))}return p}}]),e}();var id=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:rd;if(h(this,e),this.data=t,this.length=this.data.length,this.compare=i,this.length>0)for(var r=(this.length>>1)-1;r>=0;r--)this._down(r)}return d(e,[{key:"push",value:function(e){this.data.push(e),this.length++,this._up(this.length-1)}},{key:"pop",value:function(){if(0!==this.length){var e=this.data[0],t=this.data.pop();return this.length--,this.length>0&&(this.data[0]=t,this._down(0)),e}}},{key:"peek",value:function(){return this.data[0]}},{key:"_up",value:function(e){for(var t=this.data,i=this.compare,r=t[e];e>0;){var n=e-1>>1,a=t[n];if(i(r,a)>=0)break;t[e]=a,e=n}t[e]=r}},{key:"_down",value:function(e){for(var t=this.data,i=this.compare,r=this.length>>1,n=t[e];e<r;){var a=1+(e<<1),o=t[a],s=a+1;if(s<this.length&&i(t[s],o)<0&&(a=s,o=t[s]),i(o,n)>=0)break;t[e]=o,e=a}t[e]=n}}]),e}();function rd(e,t){return e<t?-1:e>t?1:0}
1function nd(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=1/0,n=1/0,a=-1/0,o=-1/0,s=e[0],l=0;l<s.length;l++){var u=s[l];(!l||u.x<r)&&(r=u.x),(!l||u.y<n)&&(n=u.y),(!l||u.x>a)&&(a=u.x),(!l||u.y>o)&&(o=u.y)}var c=Math.min(a-r,o-n),h=c/2,f=new id([],ad);if(0===c)return new z(r,n);for(var d=r;d<a;d+=c)for(var p=n;p<o;p+=c)f.push(new od(d+h,p+h,h,e));for(var m=function(e){for(var t=0,i=0,r=0,n=e[0],a=0,o=n.length,s=o-1;a<o;s=a++){var l=n[a],u=n[s],c=l.x*u.y-u.x*l.y;i+=(l.x+u.x)*c,r+=(l.y+u.y)*c,t+=3*c}return new od(i/t,r/t,0,e)}(e),v=f.length;f.length;){var y=f.pop();(y.d>m.d||!m.d)&&(m=y,i&&console.log("found best %d after %d probes",Math.round(1e4*y.d)/1e4,v)),y.max-m.d<=t||(h=y.h/2,f.push(new od(y.p.x-h,y.p.y-h,h,e)),f.push(new od(y.p.x+h,y.p.y-h,h,e)),f.push(new od(y.p.x-h,y.p.y+h,h,e)),f.push(new od(y.p.x+h,y.p.y+h,h,e)),v+=4)}return i&&(console.log("num probes: ".concat(v)),console.log("best distance: ".concat(m.d))),m.p}function ad(e,t){return t.max-e.max}var od=d(function e(t,i,r,n){h(this,e),this.p=new z(t,i),this.h=r,this.d=function(e,t){for(var i=!1,r=1/0,n=0;n<t.length;n++)for(var a=t[n],o=0,s=a.length,l=s-1;o<s;l=o++){var u=a[o],c=a[l];u.y>e.y!=c.y>e.y&&e.x<(c.x-u.x)*(e.y-u.y)/(c.y-u.y)+u.x&&(i=!i),r=Math.min(r,ku(e,u,c))}return(i?1:-1)*Math.sqrt(r)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}),sd=Number.POSITIVE_INFINITY,ld=Math.sqrt(2);function ud(e,t){var i=a(t,2),r=i[0],n=i[1],o=0,s=0;if(n===sd){r<0&&(r=0);var l=r/ld;switch(e){case"top-right":case"top-left":s=l-7;break;case"bottom-right":case"bottom-left":s=7-l;break;case"bottom":s=7-r;break;case"top":s=r-7}switch(e){case"top-right":case"bottom-right":o=-l;break;case"top-left":case"bottom-left":o=l;break;case"left":o=r;break;case"right":o=-r}}else{switch(r=Math.abs(r),n=Math.abs(n),e){case"top-right":case"top-left":case"top":s=n-7;break;case"bottom-right":case"bottom-left":case"bottom":s=7-n}switch(e){case"top-right":case"bottom-right":case"right":o=-r;break;case"top-left":case"bottom-left":case"left":o=r}}return[o,s]}function cd(e,t,i,r,n,o,s,u,c,h){e.createArrays(),e.tilePixelRatio=gs/(512*e.overscaling),e.compareText={},e.iconsNeedLinear=!1;var f=e.layers[0].layout,d=e.layers[0]._unevaluatedLayout._values,p={};if("composite"===e.textSizeData.kind){var m=e.textSizeData,v=m.minZoom,y=m.maxZoom;p.compositeTextSizes=[d["text-size"].possiblyEvaluate(new La(v),u),d["text-size"].possiblyEvaluate(new La(y),u)]}if("composite"===e.iconSizeData.kind){var _=e.iconSizeData,g=_.minZoom,x=_.maxZoom;p.compositeIconSizes=[d["icon-size"].possiblyEvaluate(new La(g),u),d["icon-size"].possiblyEvaluate(new La(x),u)]}p.layoutTextSize=d["text-size"].possiblyEvaluate(new La(c+1),u),p.layoutIconSize=d["icon-size"].possiblyEvaluate(new La(c+1),u),p.textMaxSize=d["text-size"].possiblyEvaluate(new La(18),u);var b,w="map"===f.get("text-rotation-alignment")&&"point"!==f.get("symbol-placement"),k=f.get("text-size"),T=l(e.features);try{var E=function(){var o=b.value,c=f.get("text-font").evaluate(o,{},u).join(","),d=k.evaluate(o,{},u),m=p.layoutTextSize.evaluate(o,{},u),v=(p.layoutIconSize.evaluate(o,{},u),{horizontal:{},vertical:void 0}),y=o.text,_=void 0,g=[0,0];if(y){var x=y.toString(),T=24*f.get("text-letter-spacing").evaluate(o,{},u),E=24*f.get("text-line-height").evaluate(o,{},u),M=function(e){var t,i=l(e);try{for(i.s();!(t=i.n()).done;)if(!va(t.value.charCodeAt(0)))return!1}catch(r){i.e(r)}finally{i.f()}return!0}(x)?T:0,S=f.get("text-anchor").evaluate(o,{},u),I=f.get("text-variable-anchor");if(!I){var C=f.get("text-radial-offset").evaluate(o,{},u);g=C?ud(S,[24*C,sd]):f.get("text-offset").evaluate(o,{},u).map(function(e){return 24*e})}var A=w?"center":f.get("text-justify").evaluate(o,{},u),z="point"===f.get("symbol-placement"),P=z?24*f.get("text-max-width").evaluate(o,{},u):1/0,D=function(r){e.allowVerticalPlacement&&ma(x)&&(v.vertical=Ef(y,t,i,n,c,P,E,S,r,M,g,wf.vertical,!0,m,d))};if(!w&&I){for(var L="auto"===A?I.map(function(e){return hd(e)}):[A],B=!1,O=0;O<L.length;O++){var F=L[O];if(!v.horizontal[F])if(B)v.horizontal[F]=v.horizontal[0];else{var U=Ef(y,t,i,n,c,P,E,"center",F,M,g,wf.horizontal,!1,m,d);
1U&&(v.horizontal[F]=U,B=1===U.positionedLines.length)}}D("left")}else{if("auto"===A&&(A=hd(S)),z||f.get("text-writing-mode").indexOf("horizontal")>=0||!ma(x)){var V=Ef(y,t,i,n,c,P,E,S,A,M,g,wf.horizontal,!1,m,d);V&&(v.horizontal[A]=V)}D(z?"left":A)}}var j=!1;if(o.icon&&o.icon.name){var N=r[o.icon.name];N&&(_=function(e,t,i){var r=Df(i),n=r.horizontalAlign,a=r.verticalAlign,o=t[0]-e.displaySize[0]*n,s=t[1]-e.displaySize[1]*a;return{image:e,top:s,bottom:s+e.displaySize[1],left:o,right:o+e.displaySize[0]}}(n[o.icon.name],f.get("icon-offset").evaluate(o,{},u),f.get("icon-anchor").evaluate(o,{},u)),j=N.sdf,void 0===e.sdfIcons?e.sdfIcons=N.sdf:e.sdfIcons!==N.sdf&&ne("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(N.pixelRatio!==e.pixelRatio||0!==f.get("icon-rotate").constantOr(1))&&(e.iconsNeedLinear=!0))}var G=pd(v.horizontal)||v.vertical;e.iconsInText||(e.iconsInText=!!G&&G.iconsInText),(G||_)&&function(e,t,i,r,n,o,s,u,c,h,f,d,p){var m=o.textMaxSize.evaluate(t,{},d);void 0===m&&(m=s);var v,y,_=e.layers[0].layout,g=_.get("icon-offset").evaluate(t,{},d),x=pd(i.horizontal)||i.vertical,b="globe"===p.name,w=s/24,k=e.tilePixelRatio*m/24,T=(v=e.overscaling,e.zoom>18&&v>2&&(v>>=1),Math.max(gs/(512*v),1)*_.get("symbol-spacing")),E=_.get("text-padding")*e.tilePixelRatio,M=_.get("icon-padding")*e.tilePixelRatio,S=R(_.get("text-max-angle")),I="map"===_.get("text-rotation-alignment")&&"point"!==_.get("symbol-placement"),C="map"===_.get("icon-rotation-alignment")&&"point"!==_.get("symbol-placement"),A=_.get("symbol-placement"),z=T/2,P=_.get("icon-text-fit");r&&"none"!==P&&(e.allowVerticalPlacement&&i.vertical&&(y=Rf(r,i.vertical,P,_.get("icon-text-fit-padding"),g,w)),x&&(r=Rf(r,x,P,_.get("icon-text-fit-padding"),g,w)));var D=function(s,l,u){if(!(l.x<0||l.x>=gs||l.y<0||l.y>=gs)){var m=null;if(b){var v=p.projectTilePoint(l.x,l.y,u),_=v.x,x=v.y,w=v.z;m={anchor:new Bf(_,x,w,0,void 0),up:p.upVector(u,l.x,l.y)}}!function(e,t,i,r,n,o,s,l,u,c,h,f,d,p,m,v,y,_,g,x,b,w,k,T,E){var M,S,I,C,A,z,P,D,L=e.addToLineVertexArray(t,r),R=0,B=0,O=0,F=0,U=-1,V=-1,j={},N=Fo(""),G=i?i.anchor:t,Z=0,q=0;if(void 0===u._unevaluatedLayout.getValue("text-radial-offset")?(Z=(M=a(u.layout.get("text-offset").evaluate(b,{},E).map(function(e){return 24*e}),2))[0],q=M[1]):(Z=24*u.layout.get("text-radial-offset").evaluate(b,{},E),q=sd),e.allowVerticalPlacement&&n.vertical){var W=n.vertical;if(m)P=vd(W),l&&(D=vd(l));else{var X=u.layout.get("text-rotate").evaluate(b,{},E)+90;C=md(c,G,t,h,f,d,W,p,X,v),l&&(A=md(c,G,t,h,f,d,l,_,X))}}if(o){var H=u.layout.get("icon-rotate").evaluate(b,{},E),Y="none"!==u.layout.get("icon-text-fit"),K=Kf(o,H,k,Y),J=l?Kf(l,H,k,Y):void 0;I=md(c,G,t,h,f,d,o,_,H),R=4*K.length;var $=e.iconSizeData,Q=null;"source"===$.kind?(Q=[Uh*u.layout.get("icon-size").evaluate(b,{},E)])[0]>fd&&ne("".concat(e.layerIds[0],': Value for "icon-size" is >= 255. Reduce your "icon-size".')):"composite"===$.kind&&(((Q=[Uh*w.compositeIconSizes[0].evaluate(b,{},E),Uh*w.compositeIconSizes[1].evaluate(b,{},E)])[0]>fd||Q[1]>fd)&&ne("".concat(e.layerIds[0],': Value for "icon-size" is >= 255. Reduce your "icon-size".'))),e.addSymbols(e.icon,K,Q,x,g,b,!1,i,t,L.lineStartIndex,L.lineLength,-1,T,E),U=e.icon.placedSymbolArray.length-1,J&&(B=4*J.length,e.addSymbols(e.icon,J,Q,x,g,b,wf.vertical,i,t,L.lineStartIndex,L.lineLength,-1,T,E),V=e.icon.placedSymbolArray.length-1)}for(var ee in n.horizontal){var te=n.horizontal[ee];S||(N=Fo(te.text),m?z=vd(te):S=md(c,G,t,h,f,d,te,p,u.layout.get("text-rotate").evaluate(b,{},E),v));var ie=1===te.positionedLines.length;if(O+=dd(e,i,t,te,s,u,m,b,v,L,n.vertical?wf.horizontal:wf.horizontalOnly,ie?Object.keys(n.horizontal):[ee],j,U,w,T,E),ie)break}n.vertical&&(F+=dd(e,i,t,n.vertical,s,u,m,b,v,L,wf.vertical,["vertical"],j,V,w,T,E));var re=-1,ae=function(e,t){return e?Math.max(e,t):t};re=ae(z,re),re=ae(P,re);var oe=(re=ae(D,re))>-1?1:0;e.glyphOffsetArray.length>=Yd.MAX_GLYPHS&&ne("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==b.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,b.sort
1Key),e.symbolInstances.emplaceBack(G.x,G.y,G.z,t.x,t.y,j.right>=0?j.right:-1,j.center>=0?j.center:-1,j.left>=0?j.left:-1,j.vertical>=0?j.vertical:-1,U,V,N,void 0!==S?S:e.collisionBoxArray.length,void 0!==S?S+1:e.collisionBoxArray.length,void 0!==C?C:e.collisionBoxArray.length,void 0!==C?C+1:e.collisionBoxArray.length,void 0!==I?I:e.collisionBoxArray.length,void 0!==I?I+1:e.collisionBoxArray.length,A||e.collisionBoxArray.length,A?A+1:e.collisionBoxArray.length,h,O,F,R,B,oe,0,Z,q,re)}(e,l,m,s,i,r,n,y,e.layers[0],e.collisionBoxArray,t.index,t.sourceLayerIndex,e.index,E,I,c,0,M,C,g,t,o,h,f,d)}};if("line"===A){var L,B=l(Zf(t.geometry,0,0,gs,gs));try{for(B.s();!(L=B.n()).done;){var O,F=L.value,U=l(Nf(F,T,S,i.vertical||x,r,24,k,e.overscaling,gs));try{for(U.s();!(O=U.n()).done;){var V=O.value;x&&yd(e,x.text,z,V)||D(F,V,d)}}catch(re){U.e(re)}finally{U.f()}}}catch(re){B.e(re)}finally{B.f()}}else if("line-center"===A){var j,N=l(t.geometry);try{for(N.s();!(j=N.n()).done;){var G=j.value;if(G.length>1){var Z=jf(G,S,i.vertical||x,r,24,k);Z&&D(G,Z,d)}}}catch(re){N.e(re)}finally{N.f()}}else if("Polygon"===t.type){var q,W=l(Mc(t.geometry,0));try{for(W.s();!(q=W.n()).done;){var X=q.value,H=nd(X,16);D(X[0],new Bf(H.x,H.y,0,0,void 0),d)}}catch(re){W.e(re)}finally{W.f()}}else if("LineString"===t.type){var Y,K=l(t.geometry);try{for(K.s();!(Y=K.n()).done;){var J=Y.value;D(J,new Bf(J[0].x,J[0].y,0,0,void 0),d)}}catch(re){K.e(re)}finally{K.f()}}else if("Point"===t.type){var $,Q=l(t.geometry);try{for(Q.s();!($=Q.n()).done;){var ee,te=l($.value);try{for(te.s();!(ee=te.n()).done;){var ie=ee.value;D([ie],new Bf(ie.x,ie.y,0,0,void 0),d)}}catch(re){te.e(re)}finally{te.f()}}}catch(re){Q.e(re)}finally{Q.f()}}}(e,o,v,_,r,p,m,0,g,j,s,u,h)};for(T.s();!(b=T.n()).done;)E()}
1catch(M){T.e(M)}finally{T.f()}o&&e.generateCollisionDebugBuffers(c,e.collisionBoxArray)}function hd(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"}var fd=32640;function dd(e,t,i,n,a,o,s,u,c,h,f,d,p,m,v,y,_){var x=function(e,t,i,n,a,o,s,u){var c=[];if(0===t.positionedLines.length)return c;var h,f=n.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,d=function(e){var t=e[0],i=e[1],r=t*i;return r>0?[t,-i]:r<0?[-t,i]:0===t?[i,t]:[i,-t]}(i),p=Math.abs(t.top-t.bottom),m=l(t.positionedLines);try{for(m.s();!(h=m.n()).done;){p-=h.value.lineOffset}}catch(oe){m.e(oe)}finally{m.f()}for(var v=t.positionedLines.length,y=p/v,_=t.top-i[1],x=0;x<v;++x){var b=t.positionedLines[x];_=td(t,y,_,x);var w,k=l(b.positionedGlyphs);try{for(k.s();!(w=k.n()).done;){var T=w.value;if(T.rect){var E=T.rect||{},M=4,S=!0,I=1,C=0;if(T.imageName){var A=s[T.imageName];if(!A)continue;if(A.sdf){ne("SDF images are not supported in formatted text and will be ignored.");continue}S=!1,M=1/(I=A.pixelRatio)}var P=(a||u)&&T.vertical,D=T.metrics.advance*T.scale/2,L=T.metrics,R=T.rect;if(null!==R){u&&t.verticalizable&&(C=T.imageName?D-T.metrics.width*T.scale/2:0);var B=a?[T.x+D,T.y]:[0,0],O=[0,0],F=[0,0],U=!1;a||(P?(F=[T.x+D+d[0],T.y+d[1]-C],U=!0):O=[T.x+D+i[0],T.y+i[1]-C]);var V=R.w*T.scale/(I*(T.localGlyph?2:1)),j=R.h*T.scale/(I*(T.localGlyph?2:1)),N=void 0,G=void 0,Z=void 0,q=void 0;if(P){var W=T.y-_,X=new z(-D,D-W),H=-Math.PI/2,Y=g(z,r(F));(N=new z(-D+O[0],O[1]))._rotateAround(H,X)._add(Y),N.x+=-W+D,N.y-=(L.left-M)*T.scale;var K=T.imageName?L.advance*T.scale:24*T.scale,J=String.fromCharCode(T.glyph);Wh(J)?N.x+=(1-M)*T.scale:Xh(J)?N.x+=K-L.height*T.scale+(-M-1)*T.scale:N.x+=T.imageName||L.width+2*M===R.w&&L.height+2*M===R.h?(K-j)/2:(K-(L.height+2*M)*T.scale)/2,G=new z(N.x,N.y-V),Z=new z(N.x+j,N.y),q=new z(N.x+j,N.y-V)}else{var $=(L.left-M)*T.scale-D+O[0],Q=(-L.top-M)*T.scale+O[1],ee=$+V,te=Q+j;N=new z($,Q),G=new z(ee,Q),Z=new z($,te),q=new z(ee,te)}if(f){var ie;ie=a?new z(0,0):U?new z(d[0],d[1]):new z(i[0],i[1]),N._rotateAround(f,ie),G._rotateAround(f,ie),Z._rotateAround(f,ie),q._rotateAround(f,ie)}var re=new z(0,0),ae=new z(0,0);c.push({tl:N,tr:G,bl:Z,br:q,tex:E,writingMode:t.writingMode,glyphOffset:B,sectionIndex:T.sectionIndex,isSDF:S,pixelOffsetTL:re,pixelOffsetBR:ae,minFontScaleX:0,minFontScaleY:0})}}}}catch(oe){k.e(oe)}finally{k.f()}}return c}(0,n,c,o,s,u,a,e.allowVerticalPlacement),b=e.textSizeData,w=null;"source"===b.kind?(w=[Uh*o.layout.get("text-size").evaluate(u,{},_)])[0]>fd&&ne("".concat(e.layerIds[0],': Value for "text-size" is >= 255. Reduce your "text-size".')):"composite"===b.kind&&(((w=[Uh*v.compositeTextSizes[0].evaluate(u,{},_),Uh*v.compositeTextSizes[1].evaluate(u,{},_)])[0]>fd||w[1]>fd)&&ne("".concat(e.layerIds[0],': Value for "text-size" is >= 255. Reduce your "text-size".'))),e.addSymbols(e.text,x,w,c,s,u,f,t,i,h.lineStartIndex,h.lineLength,m,y,_);var k,T=l(d);try{for(T.s();!(k=T.n()).done;){p[k.value]=e.text.placedSymbolArray.length-1}}catch(E){T.e(E)}finally{T.f()}return 4*x.length}function pd(e){for(var t in e)return e[t];return null}function md(e,t,i,r,n,a,o,s,l,u){var c=o.top,h=o.bottom,f=o.left,d=o.right,p=o.collisionPadding;if(p&&(f-=p[0],c-=p[1],d+=p[2],h+=p[3]),l){var m=new z(f,c),v=new z(d,c),y=new z(f,h),_=new z(d,h),g=R(l),x=new z(0,0);u&&(x=new z(u[0],u[1])),m._rotateAround(g,x),v._rotateAround(g,x),y._rotateAround(g,x),_._rotateAround(g,x),f=Math.min(m.x,v.x,y.x,_.x),d=Math.max(m.x,v.x,y.x,_.x),c=Math.min(m.y,v.y,y.y,_.y),h=Math.max(m.y,v.y,y.y,_.y)}return e.emplaceBack(t.x,t.y,t.z,i.x,i.y,f,c,d,h,s,r,n,a),e.length-1}function vd(e){e.collisionPadding&&(e.top-=e.collisionPadding[1],e.bottom+=e.collisionPadding[3]);var t=e.bottom-e.top;return t>0?Math.max(10,t):null}function yd(e,t,i,r){var n=e.compareText;if(t in n){for(var a=n[t],o=a.length-1;o>=0;o--)if(r.dist(a[o])<i)return!0}else n[t]=[];return n[t].push(r),!1}function _d(e,t){var i=e.fovAboveCenter,r=e.elevation?e.elevation.getMinElevationBelowMSL()*t:0,n=(e._camera.position[2]*e.worldSize-r)/Math.cos(e._pitch),a=Math.sin(i)*n/Math.sin(Math.max(Math.PI/2-e._pitch-i,.01)),o=Math.sin(e._pitch)*a+n;return Math.min(1.01*o,n*(1/e._horizonShift))}function gd(e,t){if(!t.isReprojectedInTileSpace)return{scale:1<<e.z,x:e.x,y:e.y,x2:e.x+1,y2:e.y+1,projection:t};var i=Math.pow(2,-e.z),r=e.x*i,n=(e.x+1)*i,a=e.y*i,o=(e.y+1)*i,s=$l(r),l=$l(n),u=Ql(a),c=Ql(o),h=t.project(s,u),f=t.project(l,u),d=t.project(l,c),p=t.project(s,c),m=Math.min(h.x,f.x,d.x,p.x),v=Math.min(h.y,f.y,d.y,p.y),y=Math.max(h.x,f.x,d.x,p.x),_=Math.max(h.y,f.y,d.y,p.y),g=i/16;function x(e,i,r,n,a,o){var s=(r+a)/2,l=(n+o)/2,u=t.project($l(s),Ql(l)),c=Math.max(0,m-u.x,v-u.y,u.x-y,u.y-_);m=Math.min(m,u.x),y=Math.max(y,u.x),v=Math.min(v,u.y),_=Math.max(_,u.y),c>g&&(x(e,u,r,n,s,l),x(u,i,s,l,a,o))}x(h,f,r,a,n,a),x(f,d,n,a,n,o),x(d,p,n,o,r,o),x(p,h,r,o,r,a),m-=g,v-=g,y+=g,_+=g;var b=1/Math.max(y-m,_-v);return{scale:b,x:m*b,y:v*b,x2:y*b,y2:_*b,projection:t}}var xd=Es(new Float32Array(16)),bd=function(){function e(t){h(this,e),this.spec=t,this.name=t.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]}return d(e,[{key:"project",value:function(e,t){return{x:0,y:0,z:0}}},{key:"unproject",value:function(e,t){return new Xl(0,0)}},{key:"projectTilePoint",value:function(e,t,i){return{x:e,y:t,z:0}}},{key:"locationPoint",value:function(e,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return e._coordinatePoint(e.locationCoordinate(t),i)}},{key:"pixelsPerMeter",value:function(e,t){return Jl(1,e)*t}},{key:"pixelSpaceConversion",value:function(e,t,i){return 1}},{key:"farthestPixelDistance",value:function(e){return _d(e,e.pixelsPerMeter)}},{key:"pointCoordinate",value:function(e,t,i,r){var n=e.horizonLineFromTop(!1),a=new z(t,Math.max(n,i));return e.rayIntersectionCoordinate(e.pointRayIntersection(a,r))}},{key:"pointCoordinate3D",value:function(e,t,i){var r=new z(t,i);if(e.elevation)return e.elevation.pointCoordinate(r);var n=this.pointCoordinate(e,r.x,r.y,0);return[n.x,n.y,n.z]}},{key:"isPointAboveHorizon",value:function(e,t){if(e.elevation)return!this.pointCoordinate3D(e,t.x,t.y);var i=e.horizonLineFromTop();return t.y<i}},{key:"createInversionMatrix",value:function(e,t){return xd}},{key:"createTileMatrix",value:function(e,t,i){var r,n,a,o=i.canonical,s=Es(new Float64Array(16));if(this.isReprojectedInTileSpace){var l=gd(o,this);r=1,n=l.x+i.wrap*l.scale,a=l.y,Cs(s,s,[r/l.scale,r/l.scale,e.pixelsPerMeter/t])}else r=t/e.zoomScale(o.z),n=(o.x+Math.pow(2,o.z)*i.wrap)*r,a=o.y
1*r;return Is(s,s,[n,a,0]),Cs(s,s,[r/gs,r/gs,1]),s}},{key:"upVector",value:function(e,t,i){return[0,0,1]}},{key:"upVectorScale",value:function(e,t,i){return{metersToTile:1}}}]),e}(),wd=function(e){p(i,e);var t=m(i);function i(e){var r;h(this,i),(r=t.call(this,e)).range=[4,7],r.center=e.center||[-96,37.5];var n=a(r.parallels=e.parallels||[29.5,45.5],2),o=n[0],s=n[1],l=Math.sin(R(o));return r.n=(l+Math.sin(R(s)))/2,r.c=1+l*(2*r.n-l),r.r0=Math.sqrt(r.c)/r.n,r}return d(i,[{key:"project",value:function(e,t){var i=this.n,r=this.c,n=this.r0,a=R(e-this.center[0]),o=R(t),s=Math.sqrt(r-2*i*Math.sin(o))/i;return{x:s*Math.sin(a*i),y:s*Math.cos(a*i)-n,z:0}}},{key:"unproject",value:function(e,t){var i=this.n,r=this.c,n=this.r0+t,a=Math.atan2(e,Math.abs(n))*Math.sign(n);n*i<0&&(a-=Math.PI*Math.sign(e)*Math.sign(n));var o=R(this.center[0])*i,s=j(B((a=G(a,-Math.PI-o,Math.PI-o))/i)+this.center[0],-180,180),l=Math.asin(j((r-(e*e+n*n)*i*i)/(2*i),-1,1)),u=j(B(l),-tu,tu);return new Xl(s,u)}}]),i}(bd),kd=1.340264,Td=-.081106,Ed=893e-6,Md=.003796,Sd=Math.sqrt(3)/2,Id=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"project",value:function(e,t){t=t/180*Math.PI,e=e/180*Math.PI;var i=Math.asin(Sd*Math.sin(t)),r=i*i,n=r*r*r;return{x:.5*(e*Math.cos(i)/(Sd*(kd+3*Td*r+n*(7*Ed+9*Md*r)))/Math.PI+.5),y:1-.5*(i*(kd+Td*r+n*(Ed+Md*r))/Math.PI+1),z:0}}},{key:"unproject",value:function(e,t){e=(2*e-.5)*Math.PI;for(var i,r=t=(2*(1-t)-1)*Math.PI,n=r*r,a=n*n*n,o=0;o<12&&(a=(n=(r=j(r-(i=(r*(kd+Td*n+a*(Ed+Md*n))-t)/(kd+3*Td*n+a*(7*Ed+9*Md*n))),-Math.PI/3,Math.PI/3))*r)*n*n,!(Math.abs(i)<1e-12));++o);var s=Sd*e*(kd+3*Td*n+a*(7*Ed+9*Md*n))/Math.cos(r),l=Math.asin(Math.sin(r)/Sd),u=j(180*s/Math.PI,-180,180),c=j(180*l/Math.PI,-tu,tu);return new Xl(u,c)}}]),i}(bd),Cd=function(e){p(i,e);var t=m(i);function i(e){var r;return h(this,i),(r=t.call(this,e)).wrap=!0,r.supportsWorldCopies=!0,r}return d(i,[{key:"project",value:function(e,t){return{x:.5+e/360,y:.5-t/360,z:0}}},{key:"unproject",value:function(e,t){var i=360*(e-.5),r=j(360*(.5-t),-tu,tu);return new Xl(i,r)}}]),i}(bd),Ad=Math.PI/2;function zd(e){return Math.tan((Ad+e)/2)}var Pd=function(e){p(i,e);var t=m(i);function i(e){var r;h(this,i),(r=t.call(this,e)).center=e.center||[0,30];var n=a(r.parallels=e.parallels||[30,30],2),o=n[0],s=n[1],l=R(o),u=R(s);r.southernCenter=l+u<0,r.southernCenter&&(l=-l,u=-u);var c=Math.cos(l),f=zd(l);return r.n=l===u?Math.sin(l):Math.log(c/Math.cos(u))/Math.log(zd(u)/f),r.f=c*Math.pow(zd(l),r.n)/r.n,r}return d(i,[{key:"project",value:function(e,t){t=R(t),this.southernCenter&&(t=-t),e=R(e-this.center[0]);var i=1e-6,r=this.n,n=this.f;n>0?t<-Ad+i&&(t=-Ad+i):t>Ad-i&&(t=Ad-i);var a=n/Math.pow(zd(t),r),o=a*Math.sin(r*e),s=n-a*Math.cos(r*e);return o=.5*(o/Math.PI+.5),s=.5*(s/Math.PI+.5),{x:o,y:this.southernCenter?s:1-s,z:0}}},{key:"unproject",value:function(e,t){e=(2*e-.5)*Math.PI,this.southernCenter&&(t=1-t),t=(2*(1-t)-.5)*Math.PI;var i=this.n,r=this.f,n=r-t,a=Math.sign(n),o=Math.sign(i)*Math.sqrt(e*e+n*n),s=Math.atan2(e,Math.abs(n))*a;n*i<0&&(s-=Math.PI*Math.sign(e)*a);var l=j(B(s/i)+this.center[0],-180,180),u=j(B(2*Math.atan(Math.pow(r/o,1/i))-Ad),-tu,tu);return new Xl(l,this.southernCenter?-u:u)}}]),i}(bd),Dd=function(e){p(i,e);var t=m(i);function i(e){var r;return h(this,i),(r=t.call(this,e)).wrap=!0,r.supportsWorldCopies=!0,r.supportsTerrain=!0,r.supportsFog=!0,r.supportsFreeCamera=!0,r.isReprojectedInTileSpace=!1,r.unsupportedLayers=[],r.range=null,r}return d(i,[{key:"project",value:function(e,t){return{x:Yl(e),y:Kl(t),z:0}}},{key:"unproject",value:function(e,t){var i=$l(e),r=Ql(t);return new Xl(i,r)}}]),i}(bd),Ld=R(tu),Rd=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"project",value:function(e,t){var i=(t=R(t))*t,r=i*i;return{x:.5*((e=R(e))*(.8707-.131979*i+r*(r*(.003971*i-.001529*r)-.013791))/Math.PI+.5),y:1-.5*(t*(1.007226+i*(.015085+r*(.028874*i-.044475-.005916*r)))/Math.PI+1),z:0}}},{key:"unproject",value:function(e,t){e=(2*e-.5)*Math.PI;var i=t=(2*(1-t)-1)*Math.PI,r=25,n=0,a=i*i;do{var o=(a=i*i)*a;i=j(i-(n=(i*(1.007226+a*(.015085+o*(.028874*a-.044475-.005916*o)))-t)/(1.007226+a*(.045255+o*(.259866*a-.311325-.005916*11*o)))),-Ld,Ld)}while(Math.abs(n)>1e-6&&--r>0);var s=j(B(e/(.8707+(a=i*i)*(a*(a*a*a*(.003971-.001529*a)-.013791)-.131979))),-180,180),l=B(i);return new Xl(s,l)}}]),i}(bd),Bd=R(tu),Od=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"project",value:function(e,t){t=R(t),e=R(e);var i=Math.cos(t),r=2/Math.PI,n=Math.acos(i*Math.cos(e/2)),a=Math.sin(n)/n,o=.5*(e*r+2*i*Math.sin(e/2)/a)||0,s=.5*(t+Math.sin(t)/a)||0;return{x:.5*(o/Math.PI+.5),y:1-.5*(s/Math.PI+1),z:0}}},{key:"unproject",value:function(e,t){var i=e=(2*e-.5)*Math.PI,r=t=(2*(1-t)-1)*Math.PI,n=25,a=1e-6,o=0,s=0;do{var l=Math.cos(r),u=Math.sin(r),c=2*u*l,h=u*u,f=l*l,d=Math.cos(i/2),p=Math.sin(i/2),m=2*d*p,v=p*p,y=1-f*d*d,_=y?1/y:0,g=y?Math.acos(l*d)*Math.sqrt(1/y):0,x=.5*(2*g*l*p+2*i/Math.PI)-e,b=.5*(g*u+r)-t,w=.5*_*(f*v+g*l*d*h)+1/Math.PI,k=_*(m*c/4-g*u*p),T=.125*_*(c*p-g*u*f*m),E=.5*_*(h*d+g*v*l)+.5,M=k*T-E*w;s=(x*T-b*w)/M,i=j(i-(o=(b*k-x*E)/M),-Math.PI,Math.PI),r=j(r-s,-Bd,Bd)}while((Math.abs(o)>a||Math.abs(s)>a)&&--n>0);return new Xl(B(i),B(r))}}]),i}(bd),Fd=function(e){p(i,e);var t=m(i);function i(e){var r;return h(this,i),(r=t.call(this,e)).center=e.center||[0,0],r.parallels=e.parallels||[0,0],r.cosPhi=Math.max(.01,Math.cos(R(r.parallels[0]))),r.scale=1/(2*Math.max(Math.PI*r.cosPhi,1/r.cosPhi)),r.wrap=!0,r.supportsWorldCopies=!0,r}return d(i,[{key:"project",value:function(e,t){var i=this.scale,r=this.cosPhi;return{x:R(e)*r*i+.5,y:-Math.sin(R(t))/r*i+.5,z:0}}},{key:"unproject",value:function(e,t){var i=this.scale,r=this.cosPhi,n=-(t-.5)/i,a=j(B((e-.5)/i)/r,-180,180),o=Math.asin(j(n*r,-1,1)),s=j(B(o),-tu,tu);return new Xl(a,s)}}]),i}(bd),Ud=function(e){p(i,e);var t=m(i);function i(e){var r;return h(this,i),(r=t.call(this,e)).requiresDraping=!0,r.supportsWorldCopies=!1,r.supportsFog=!0,r.zAxisUnit="pixels",r.unsupportedLayers=["debug"],r.range=[3,5],r}return d(i,[{key:"projectTilePoint",value:function(e,t,i){var r=Dl(e,t,i);return Ys(r,r,Bl(El(i))),{x:r[0],y:r[1],z:r[2]}}},{key:"locationPoint",value:function(e,t){var i=Pl(t.lat,t.lng),r=Ws([],i),n=e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(t),e._centerAltitude):e._centerAltitude;qs(i,i,r,Jl(1,0)*gs*n);var a=Es(new Float64Array(16));return Ss(a,e.pixelMatrix,e.globeMatrix),Ys(i,i,a),new z(i[0],i[1])}},{key:"pixelsPerMeter",value:function(e,t){return Jl(1,0)*t}},{key:"pixelSpaceConversion",value:function(e,t,i){var r=Jl(1,e)*t,n=Di(Jl(1,45)*t,r,i);return this.pixelsPerMeter(e,t)/n}},{key:"createTileMatrix",value:function(e,t,i){var r=Ol(El(i.canonical));return Ss(new Float64Array(16),e.globeMatrix,r)}},{key:"createInversionMatrix",value:function(e,t){var i=e.center,r=Bl(El(t));return zs(r,r,R(i.lng)),As(r,r,R(i.lat)),Cs(r,r,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(r)}},{key:"pointCoordinate",value:function(e,t,i,r){return wl(e,t,i,!0)||new ru(0,0)}},{key:"pointCoordinate3D",value:function(e,t,i){var r=this.pointCoordinate(e,t,i,0);return[r.x,r.y,r.z]}},{key:"isPointAboveHorizon",value:function(e,t){return!wl(e,t.x,t.y,!1)}},{key:"farthestPixelDistance",value:function(e){var t=function(e,t){var i,r=e.cameraToCenterDistance,n=e._centerAltitude*t,a=e._camera,o=e._camera.forward(),s=Us([],Zs([],o,-r),[0,0,n]),l=e.worldSize/(2*Math.PI),u=[0,0,-l],c=e.width/e.height,h=Math.tan(e.fovAboveCenter),f=Zs([],a.up(),h),d=Zs([],a.right(),h*c),p=Ws([],Us([],Us([],o,f),d)),m=[];
1if(new fl(s,p).closestPointOnSphere(u,l,m)){var v=Us([],m,u),y=$s([],v,s);i=Math.cos(e.fovAboveCenter)*Os(y)}else{var _=$s([],s,u),g=$s([],u,s);Ws(g,g);var x=Os(_)-l;i=Math.sqrt(x*(x+2*l));var b=Math.acos(i/(l+x))-Math.acos(Xs(o,g));i*=Math.cos(b)}return 1.01*i}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),i=Ul(e.zoom);if(i>0){var r=_d(e,Jl(1,e.center.lat)*e.worldSize),n=e.worldSize/(2*Math.PI),a=Math.max(e.width,e.height)/e.worldSize*Math.PI;return Di(t,r+n*(1-Math.cos(a)),Math.pow(i,10))}return t}},{key:"upVector",value:function(e,t,i){return Dl(t,i,e,1)}},{key:"upVectorScale",value:function(e){return{metersToTile:bl(Ll(El(e)))}}}]),i}(Dd);function Vd(e){var t=e.parallels,i=!!t&&Math.abs(t[0]+t[1])<.01;switch(e.name){case"mercator":return new Dd(e);case"equirectangular":return new Cd(e);case"naturalEarth":return new Rd(e);case"equalEarth":return new Id(e);case"winkelTripel":return new Od(e);case"albers":return i?new Fd(e):new wd(e);case"lambertConformalConic":return i?new Fd(e):new Pd(e);case"globe":return new Ud(e)}throw new Error("Invalid projection name: ".concat(e.name))}var jd=Kc.types,Nd=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Gd(e,t,i,r,n,a,o,s,l,u,c,h,f){var d=s?Math.min(fd,Math.round(s[0])):0,p=s?Math.min(fd,Math.round(s[1])):0;e.emplaceBack(t,i,Math.round(32*r),Math.round(32*n),a,o,(d<<1)+(l?1:0),p,16*u,16*c,256*h,256*f)}function Zd(e,t,i,r,n,a,o){e.emplaceBack(t,i,r,n,a,o)}function qd(e,t,i,r,n){e.emplaceBack(t,i,r,n),e.emplaceBack(t,i,r,n),e.emplaceBack(t,i,r,n),e.emplaceBack(t,i,r,n)}function Wd(e){var t,i=l(e.sections);try{for(i.s();!(t=i.n()).done;){if(ba(t.value.text))return!0}}catch(r){i.e(r)}finally{i.f()}return!1}var Xd=function(){function e(t){h(this,e),this.layoutVertexArray=new so,this.indexArray=new vo,this.programConfigurations=t,this.segments=new _s,this.dynamicLayoutVertexArray=new ro,this.opacityVertexArray=new uo,this.placedSymbolArray=new Io,this.globeExtVertexArray=new lo}return d(e,[{key:"isEmpty",value:function(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}},{key:"upload",value:function(e,t,i,r){this.isEmpty()||(i&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ph.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Lh.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Nd,!0),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Dh.members,!0)),this.opacityVertexBuffer.itemSize=1),(i||r)&&this.programConfigurations.upload(e))}},{key:"destroy",value:function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}}]),e}();Bn(Xd,"SymbolBuffers");var Hd=function(){function e(t,i,r){h(this,e),this.layoutVertexArray=new t,this.layoutAttributes=i,this.indexArray=new r,this.segments=new _s,this.collisionVertexArray=new po,this.collisionVertexArrayExt=new mo}return d(e,[{key:"upload",value:function(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Rh.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,Bh.members,!0)}},{key:"destroy",value:function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.de
1stroy())}}]),e}();Bn(Hd,"CollisionBuffers");var Yd=function(){function e(t){h(this,e),this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(e){return e.id}),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Es([]),this.placementViewportMatrix=Es([]);var i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Vh(this.zoom,i["text-size"]),this.iconSizeData=Vh(this.zoom,i["icon-size"]);var r=this.layers[0].layout,n=r.get("symbol-sort-key"),a=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"!==a&&void 0!==n.constantOr(1),this.sortFeaturesByY=("viewport-y"===a||"auto"===a&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=r.get("text-writing-mode").map(function(e){return wf[e]}),this.stateDependentLayerIds=this.layers.filter(function(e){return e.isStateDependent()}).map(function(e){return e.id}),this.sourceID=t.sourceID,this.projection=t.projection}return d(e,[{key:"createArrays",value:function(){this.text=new Xd(new ls(this.layers,this.zoom,function(e){return/^text/.test(e)})),this.icon=new Xd(new ls(this.layers,this.zoom,function(e){return/^icon/.test(e)})),this.glyphOffsetArray=new zo,this.lineVertexArray=new Po,this.symbolInstances=new Ao}},{key:"calculateGlyphDependencies",value:function(e,t,i,r,n){for(var a=0;a<e.length;a++)if(t[e.charCodeAt(a)]=!0,r&&n){var o=qh[e.charAt(a)];o&&(t[o.charCodeAt(0)]=!0)}}},{key:"populate",value:function(e,t,i,r){var n=this.layers[0],a=n.layout,o="globe"===this.projection.name,s=a.get("text-font"),u=a.get("text-field"),c=a.get("icon-image"),h=("constant"!==u.value.kind||u.value.value instanceof Zt&&!u.value.value.isEmpty()||u.value.value.toString().length>0)&&("constant"!==s.value.kind||s.value.value.length>0),f="constant"!==c.value.kind||!!c.value.value||Object.keys(c.parameters).length>0,d=a.get("symbol-sort-key");if(this.features=[],h||f){var p,m=t.iconDependencies,v=t.glyphDependencies,y=t.availableImages,_=new La(this.zoom),g=l(e);try{for(g.s();!(p=g.n()).done;){var x=p.value,b=x.feature,w=x.id,k=x.index,T=x.sourceLayerIndex,E=n._featureFilter.needGeometry,M=fu(b,E);if(n._featureFilter.filter(_,M,i)){E||(M.geometry=hu(b,i,r)),o&&1!==b.type&&i.z<=5&&function(){for(var e=M.geometry,t=function(e,t){return Xs(Dl(e.x,e.y,i,1),Dl(t.x,t.y,i,1))<.98078528056},r=0;r<e.length;r++)e[r]=su(e[r],t)}();var S=void 0,I=void 0;if(h){var C=n.getValueAndResolveTokens("text-field",M,i,y),A=Zt.factory(C);Wd(A)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===za()||this.hasRTLText&&Da.isParsed())&&(S=Zh(A,n,M))}if(f){var z=n.getValueAndResolveTokens("icon-image",M,i,y);I=z instanceof qt?z:qt.fromString(z)}if(S||I){var P=this.sortFeaturesByKey?d.evaluate(M,{},i):void 0;if(this.features.push({id:w,text:S,icon:I,index:k,sourceLayerIndex:T,geometry:M.geometry,properties:b.properties,type:jd[b.type],sortKey:P}),I&&(m[I.name]=!0),S){var D=s.evaluate(M,{},i).join(","),L="map"===a.get("text-rotation-alignment")&&"point"!==a.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(wf.vertical)>=0;var R,B=l(S.sections);try{for(B.s();!(R=B.n()).done;){var O=R.value;if(O.image)m[O.image.name]=!0;else{var F=ma(S.toString()),U=O.fontStack||D,V=v[U]=v[U]||{};this.calculateGlyphDependencies(O.text,V,L,this.allowVerticalPlacement,F)}}}catch(j){B.e(j)}finally{B.f()}}}}}}catch(j){g.e(j)}finally{g.f()}"line"===a.get("symbol-placement")&&(this.features=function(e){var t={},i={},r=[],n=0;function a(t){r.push(e[t]),n++}function o(e,t,n){var a=i[e];return delete i[e],i[t]=a,r[a].geometry[0].pop(),r[a].geometry[0]=r[a].geometry[0].concat(n[0]),a}function s(e,i,n){var a=t[i];return delete t[i],t[e]=a,r[a].geometry[0].shift(),r[a].geometry[0]=n[0].concat(r[a].geometry[0]),a}function l(e,t,i){var r=i?t[0][t[0].length-1]:t[0][0];return"".concat(e,":").concat(r.x,":").concat(r.y)}for(var u=0;u<e.length;u++){var c=e[u],h=c.geometry,f=c.text?c.text.toString():null;if(f){var d=l(f,h),p=l(f,h,!0);if(d in i&&p in t&&i[d]!==t[p]){var m=s(d,p,h),v=o(d,p,r[m].geometry);delete t[d],delete i[p],i[l(f,r[v].geometry,!0)]=v,r[m].geometry=null}else d in i?o(d,p,h):p in t?s(d,p,h):(a(u),t[d]=n-1,i[p]=n-1)}else a(u)}return r.filter(function(e){return e.geometry})}(this.features)),this.sortFeaturesByKey&&this.features.sort(function(e,t){return e.sortKey-t.sortKey})}}},{key:"update",value:function(e,t,i,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,i,r),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,i,r))}},{key:"isEmpty",value:function(){return 0===this.symbolInstances.length&&!this.hasRTLText}},{key:"uploadPending",value:function(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}},{key:"upload",value:function(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}},{key:"destroyDebugData",value:function(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}},{key:"getProjection",value:function(){return this.projectionInstance||(this.projectionInstance=Vd(this.projection)),this.projectionInstance}},{key:"destroy",value:function(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}},{key:"addToLineVertexArray",value:function(e,t){var i=this.lineVertexArray.length;if(void 0!==e.segment){var r,n=l(t);try{for(n.s();!(r=n.n()).done;){var a=r.value,o=a.x,s=a.y;this.lineVertexArray.emplaceBack(o,s)}}catch(u){n.e(u)}finally{n.f()}}return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}},{key:"addSymbols",value:function(e,t,i,r,n,o,s,l,u,c,h,f,d,p){for(var m=e.indexArray,v=e.layoutVertexArray,y=e.globeExtVertexArray,_=e.segments.prepareSegment(4*t.length,v,m,this.canOverlap?o.sortKey:void 0),g=this.glyphOffsetArray.length,x=_.vertexLength,b=this.allowVerticalPlacement&&s===wf.vertical?Math.PI/2:0,w=o.text&&o.text.sections,k=0;k<t.length;k++){var T=t[k],E=T.tl,M=T.tr,S=T.bl,I=T.br,C=T.tex,A=T.pixelOffsetTL,z=T.pixelOffsetBR,P=T.minFontScaleX,D=T.minFontScaleY,L=T.glyphOffset,R=T.isSDF,B=T.sectionIndex,O=_.vertexLength,F=L[1];if(Gd(v,u.x,u.y,E.x,F+E.y,C.x,C.y,i,R,A.x,A.y,P,D),Gd(v,u.x,u.y,M.x,F+M.y,C.x+C.w,C.y,i,R,z.x,A.y,P,D),Gd(v,u.x,u.y,S.x,F+S.y,C.x,C.y+C.h,i,R,A.x,z.y,P,D),Gd(v,u.x,u.y,I.x,F+I.y,C.x+C.w,C.y+C.h,i,R,z.x,z.y,P,D),l){var U=l.anchor,V=U.x,j=U.y,N=U.z,G=a(l.up,3),Z=G[0],q=G[1],W=G[2];
1Zd(y,V,j,N,Z,q,W),Zd(y,V,j,N,Z,q,W),Zd(y,V,j,N,Z,q,W),Zd(y,V,j,N,Z,q,W),qd(e.dynamicLayoutVertexArray,V,j,N,b)}else qd(e.dynamicLayoutVertexArray,u.x,u.y,u.z,b);m.emplaceBack(O,O+1,O+2),m.emplaceBack(O+1,O+2,O+3),_.vertexLength+=4,_.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(L[0]),k!==t.length-1&&B===t[k+1].sectionIndex||e.programConfigurations.populatePaintArrays(v.length,o,o.index,{},d,p,w&&w[B])}var X=l?l.anchor:u;e.placedSymbolArray.emplaceBack(X.x,X.y,X.z,u.x,u.y,g,this.glyphOffsetArray.length-g,x,c,h,u.segment,i?i[0]:0,i?i[1]:0,r[0],r[1],s,0,!1,0,f,0)}},{key:"_commitLayoutVertex",value:function(e,t,i,r,n,a,o){e.emplaceBack(t,i,r,n,a,Math.round(o.x),Math.round(o.y))}},{key:"_addCollisionDebugVertices",value:function(e,t,i,r,n,a,o){for(var s=i.segments.prepareSegment(4,i.layoutVertexArray,i.indexArray),l=s.vertexLength,u=o.tileAnchorX,c=o.tileAnchorY,h=0;h<4;h++)i.collisionVertexArray.emplaceBack(0,0,0,0);i.collisionVertexArrayExt.emplaceBack(t,-e.padding,-e.padding),i.collisionVertexArrayExt.emplaceBack(t,e.padding,-e.padding),i.collisionVertexArrayExt.emplaceBack(t,e.padding,e.padding),i.collisionVertexArrayExt.emplaceBack(t,-e.padding,e.padding),this._commitLayoutVertex(i.layoutVertexArray,r,n,a,u,c,new z(e.x1,e.y1)),this._commitLayoutVertex(i.layoutVertexArray,r,n,a,u,c,new z(e.x2,e.y1)),this._commitLayoutVertex(i.layoutVertexArray,r,n,a,u,c,new z(e.x2,e.y2)),this._commitLayoutVertex(i.layoutVertexArray,r,n,a,u,c,new z(e.x1,e.y2)),s.vertexLength+=4;var f=i.indexArray;f.emplaceBack(l,l+1),f.emplaceBack(l+1,l+2),f.emplaceBack(l+2,l+3),f.emplaceBack(l+3,l),s.primitiveLength+=4}},{key:"_addTextDebugCollisionBoxes",value:function(e,t,i,r,n,a){for(var o=r;o<n;o++){var s=i.get(o),l=this.getSymbolInstanceTextSize(e,a,t,o);this._addCollisionDebugVertices(s,l,this.textCollisionBox,s.projectedAnchorX,s.projectedAnchorY,s.projectedAnchorZ,a)}}},{key:"_addIconDebugCollisionBoxes",value:function(e,t,i,r,n,a){for(var o=r;o<n;o++){var s=i.get(o),l=this.getSymbolInstanceIconSize(e,t,a.placedIconSymbolIndex);this._addCollisionDebugVertices(s,l,this.iconCollisionBox,s.projectedAnchorX,s.projectedAnchorY,s.projectedAnchorZ,a)}}},{key:"generateCollisionDebugBuffers",value:function(e,t){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Hd(ho,Oh.members,wo),this.iconCollisionBox=new Hd(ho,Oh.members,wo);for(var i=Nh(this.iconSizeData,e),r=Nh(this.textSizeData,e),n=0;n<this.symbolInstances.length;n++){var a=this.symbolInstances.get(n);this._addTextDebugCollisionBoxes(r,e,t,a.textBoxStartIndex,a.textBoxEndIndex,a),this._addTextDebugCollisionBoxes(r,e,t,a.verticalTextBoxStartIndex,a.verticalTextBoxEndIndex,a),this._addIconDebugCollisionBoxes(i,e,t,a.iconBoxStartIndex,a.iconBoxEndIndex,a),this._addIconDebugCollisionBoxes(i,e,t,a.verticalIconBoxStartIndex,a.verticalIconBoxEndIndex,a)}}},{key:"getSymbolInstanceTextSize",value:function(e,t,i,r){var n=this.text.placedSymbolArray.get(t.rightJustifiedTextSymbolIndex>=0?t.rightJustifiedTextSymbolIndex:t.centerJustifiedTextSymbolIndex>=0?t.centerJustifiedTextSymbolIndex:t.leftJustifiedTextSymbolIndex>=0?t.leftJustifiedTextSymbolIndex:t.verticalPlacedTextSymbolIndex>=0?t.verticalPlacedTextSymbolIndex:r),a=jh(this.textSizeData,e,n)/24;return this.tilePixelRatio*a}},{key:"getSymbolInstanceIconSize",value:function(e,t,i){var r=this.icon.placedSymbolArray.get(i),n=jh(this.iconSizeData,e,r);return this.tilePixelRatio*n}},{key:"_commitDebugCollisionVertexUpdate",value:function(e,t,i){e.emplaceBack(t,-i,-i),e.emplaceBack(t,i,-i),e.emplaceBack(t,i,i),e.emplaceBack(t,-i,i)}},{key:"_updateTextDebugCollisionBoxes",value:function(e,t,i,r,n,a){for(var o=r;o<n;o++){var s=i.get(o),l=this.getSymbolInstanceTextSize(e,a,t,o);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,l,s.padding)}}},{key:"_updateIconDebugCollisionBoxes",value:function(e,t,i,r,n,a){for(var o=r;o<n;o++){var s=i.get(o),l=this.getSymbolInstanceIconSize(e,t,a);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,l,s.padding)}}},{key:"updateCollisionDebugBuffers",value:function(e,t){if(this.hasDebugData()){this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();for(var i=Nh(this.iconSizeData,e),r=Nh(this.textSizeData,e),n=0;n<this.symbolInstances.length;n++){var a=this.symbolInstances.get(n);this._updateTextDebugCollisionBoxes(r,e,t,a.textBoxStartIndex,a.textBoxEndIndex,a),this._updateTextDebugCollisionBoxes(r,e,t,a.verticalTextBoxStartIndex,a.verticalTextBoxEndIndex,a),this._updateIconDebugCollisionBoxes(i,e,t,a.iconBoxStartIndex,a.iconBoxEndIndex,a.placedIconSymbolIndex),this._updateIconDebugCollisionBoxes(i,e,t,a.verticalIconBoxStartIndex,a.verticalIconBoxEndIndex,a.placedIconSymbolIndex)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}}},{key:"_deserializeCollisionBoxesForSymbol",value:function(e,t,i,r,n,a,o,s,l){var u={};if(t<i){var c=e.get(t),h=c.x1,f=c.y1,d=c.x2,p=c.y2,m=c.padding,v=c.projectedAnchorX,y=c.projectedAnchorY,_=c.projectedAnchorZ,g=c.tileAnchorX,x=c.tileAnchorY,b=c.featureIndex;u.textBox={x1:h,y1:f,x2:d,y2:p,padding:m,projectedAnchorX:v,projectedAnchorY:y,projectedAnchorZ:_,tileAnchorX:g,tileAnchorY:x},u.textFeatureIndex=b}if(r<n){var w=e.get(r),k=w.x1,T=w.y1,E=w.x2,M=w.y2,S=w.padding,I=w.projectedAnchorX,C=w.projectedAnchorY,A=w.projectedAnchorZ,z=w.tileAnchorX,P=w.tileAnchorY,D=w.featureIndex;u.verticalTextBox={x1:k,y1:T,x2:E,y2:M,padding:S,projectedAnchorX:I,projectedAnchorY:C,projectedAnchorZ:A,tileAnchorX:z,tileAnchorY:P},u.verticalTextFeatureIndex=D}if(a<o){var L=e.get(a),R=L.x1,B=L.y1,O=L.x2,F=L.y2,U=L.padding,V=L.projectedAnchorX,j=L.projectedAnchorY,N=L.projectedAnchorZ,G=L.tileAnchorX,Z=L.tileAnchorY,q=L.featureIndex;u.iconBox={x1:R,y1:B,x2:O,y2:F,padding:U,projectedAnchorX:V,projectedAnchorY:j,projectedAnchorZ:N,tileAnchorX:G,tileAnchorY:Z},u.iconFeatureIndex=q}if(s<l){var W=e.get(s),X=W.x1,H=W.y1,Y=W.x2,K=W.y2,J=W.padding,$=W.projectedAnchorX,Q=W.projectedAnchorY,ee=W.projectedAnchorZ,te=W.tileAnchorX,ie=W.tileAnchorY,re=W.featureIndex;u.verticalIconBox={x1:X,y1:H,x2:Y,y2:K,padding:J,projectedAnchorX:$,projectedAnchorY:Q,projectedAnchorZ:ee,tileAnchorX:te,tileAnchorY:ie},u.verticalIconFeatureIndex=re}return u}},{key:"deserializeCollisionBoxes",value:function(e){this.collisionArrays=[];for(var t=0;t<this.symbolInstances.length;t++){var i=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,i.textBoxStartIndex,i.textBoxEndIndex,i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i.iconBoxStartIndex,i.iconBoxEndIndex,i.verticalIconBoxStartIndex,i.verticalIconBoxEndIndex))}}},{key:"hasTextData",value:function(){return this.text.segments.get().length>0}},{key:"hasIconData",value:function(){return this.icon.segments.get().length>0}},{key:"hasDebugData",value:function(){return this.textCollisionBox&&this.iconCollisionBox}},{key:"hasTextCollisionBoxData",value:function(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}},{key:"hasIconCollisionBoxData",value:function(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}},{key:"addIndicesForPlacedSymbol",value:function(e,t){for(var i=e.placedSymbolArray.get(t),r=i.vertexStartIndex+4*i.numGlyphs,n=i.vertexStartIndex;n<r;n+=4)e.indexArray.emplaceBack(n,n+1,n+2),e.indexArray.emplaceBack(n+1,n+2,n+3)}}
1,{key:"getSortedSymbolIndexes",value:function(e){if(this.sortedAngle===e&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;for(var t=Math.sin(e),i=Math.cos(e),r=[],n=[],a=[],o=0;o<this.symbolInstances.length;++o){a.push(o);var s=this.symbolInstances.get(o);r.push(0|Math.round(t*s.tileAnchorX+i*s.tileAnchorY)),n.push(s.featureIndex)}return a.sort(function(e,t){return r[e]-r[t]||n[t]-n[e]}),a}},{key:"addToSortKeyRanges",value:function(e,t){var i=this.sortKeyRanges[this.sortKeyRanges.length-1];i&&i.sortKey===t?i.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}},{key:"sortFeatures",value:function(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];var t,i=l(this.symbolInstanceIndexes);try{for(i.s();!(t=i.n()).done;){var r=t.value,n=this.symbolInstances.get(r);this.featureSortOrder.push(n.featureIndex);var a=n.rightJustifiedTextSymbolIndex,o=n.centerJustifiedTextSymbolIndex,s=n.leftJustifiedTextSymbolIndex,u=n.verticalPlacedTextSymbolIndex,c=n.placedIconSymbolIndex,h=n.verticalPlacedIconSymbolIndex;a>=0&&this.addIndicesForPlacedSymbol(this.text,a),o>=0&&o!==a&&this.addIndicesForPlacedSymbol(this.text,o),s>=0&&s!==o&&s!==a&&this.addIndicesForPlacedSymbol(this.text,s),u>=0&&this.addIndicesForPlacedSymbol(this.text,u),c>=0&&this.addIndicesForPlacedSymbol(this.icon,c),h>=0&&this.addIndicesForPlacedSymbol(this.icon,h)}}catch(f){i.e(f)}finally{i.f()}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}]),e}();Bn(Yd,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),Yd.MAX_GLYPHS=65535,Yd.addDynamicAttributes=qd;var Kd=new Wa({"symbol-placement":new Ga(ft.layout_symbol["symbol-placement"]),"symbol-spacing":new Ga(ft.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ga(ft.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Za(ft.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ga(ft.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ga(ft.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Ga(ft.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ga(ft.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ga(ft.layout_symbol["icon-rotation-alignment"]),"icon-size":new Za(ft.layout_symbol["icon-size"]),"icon-text-fit":new Ga(ft.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ga(ft.layout_symbol["icon-text-fit-padding"]),"icon-image":new Za(ft.layout_symbol["icon-image"]),"icon-rotate":new Za(ft.layout_symbol["icon-rotate"]),"icon-padding":new Ga(ft.layout_symbol["icon-padding"]),"icon-keep-upright":new Ga(ft.layout_symbol["icon-keep-upright"]),"icon-offset":new Za(ft.layout_symbol["icon-offset"]),"icon-anchor":new Za(ft.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ga(ft.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ga(ft.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ga(ft.layout_symbol["text-rotation-alignment"]),"text-field":new Za(ft.layout_symbol["text-field"]),"text-font":new Za(ft.layout_symbol["text-font"]),"text-size":new Za(ft.layout_symbol["text-size"]),"text-max-width":new Za(ft.layout_symbol["text-max-width"]),"text-line-height":new Za(ft.layout_symbol["text-line-height"]),"text-letter-spacing":new Za(ft.layout_symbol["text-letter-spacing"]),"text-justify":new Za(ft.layout_symbol["text-justify"]),"text-radial-offset":new Za(ft.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ga(ft.layout_symbol["text-variable-anchor"]),"text-anchor":new Za(ft.layout_symbol["text-anchor"]),"text-max-angle":new Ga(ft.layout_symbol["text-max-angle"]),"text-writing-mode":new Ga(ft.layout_symbol["text-writing-mode"]),"text-rotate":new Za(ft.layout_symbol["text-rotate"]),"text-padding":new Ga(ft.layout_symbol["text-padding"]),"text-keep-upright":new Ga(ft.layout_symbol["text-keep-upright"]),"text-transform":new Za(ft.layout_symbol["text-transform"]),"text-offset":new Za(ft.layout_symbol["text-offset"]),"text-allow-overlap":new Ga(ft.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Ga(ft.layout_symbol["text-ignore-placement"]),"text-optional":new Ga(ft.layout_symbol["text-optional"])}),Jd={paint:new Wa({"icon-opacity":new Za(ft.paint_symbol["icon-opacity"]),"icon-color":new Za(ft.paint_symbol["icon-color"]),"icon-halo-color":new Za(ft.paint_symbol["icon-halo-color"]),"icon-halo-width":new Za(ft.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Za(ft.paint_symbol["icon-halo-blur"]),"icon-translate":new Ga(ft.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ga(ft.paint_symbol["icon-translate-anchor"]),"text-opacity":new Za(ft.paint_symbol["text-opacity"]),"text-color":new Za(ft.paint_symbol["text-color"],{runtimeType:wt,getOverride:function(e){return e.textColor},hasOverride:function(e){return!!e.textColor}}),"text-halo-color":new Za(ft.paint_symbol["text-halo-color"]),"text-halo-width":new Za(ft.paint_symbol["text-halo-width"]),"text-halo-blur":new Za(ft.paint_symbol["text-halo-blur"]),"text-translate":new Ga(ft.paint_symbol["text-translate"]),"text-translate-anchor":new Ga(ft.paint_symbol["text-translate-anchor"])}),layout:Kd},$d=function(){function e(t){h(this,e),this.type=t.property.overrides?t.property.overrides.runtimeType:_t,this.defaultValue=t}return d(e,[{key:"evaluate",value:function(e){if(e.formattedSection){var t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}},{key:"eachChild",value:function(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}},{key:"outputDefined",value:function(){return!1}},{key:"serialize",value:function(){return null}}]),e}();Bn($d,"FormatSectionOverride",{omit:["defaultValue"]});var Qd=function(e){p(r,e);var i=m(r);function r(e){return h(this,r),i.call(this,e,Jd)}return d(r,[{key:"recalculate",value:function(e,i){t(w(r.prototype),"recalculate",this).call(this,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"));var n=this.layout.get("text-writing-mode");if(n){var a,o=[],s=l(n);try{for(s.s();!(a=s.n()).done;){var u=a.value;o.indexOf(u)<0&&o.push(u)}}catch(c){s.e(c)}finally{s.f()}this.layout._values["text-writing-mode"]=o}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}},{key:"getValueAndResolveTokens",value:function(e,t,i,r){var n,a=this.layout.get(e).evaluate(t,{},i,r),o=this._unevaluatedLayout._values[e];return o.isDataDriven()||Or(o.value)||!a?a:(n=t.properties,a.replace(/{([^{}]+)}/g,function(e,t){return t in n?String(n[t]):""}))}},{key:"createBucket",value:function(e){return new Yd(e)}},{key:"queryRadius",value:function(){return 0}},{key:"queryIntersectsFeature",value:function(){return!1}},{key:"_setPaintOverrides",value:function(){var e,t=l(Jd.paint.overridableProperties);try{for(t.s();!(e=t.n()).done;){var i=e.value;if(r.hasPaintOverride(this.layout,i)){var n,a=this.paint.get(i),o=new $d(a),s=new Br(o,a.property.specification);n="constant"===a.value.kind||"source"===a.value.kind?new Ur("source",s):new Vr("composite",s,a.value.zoomStops,a.value._interpolationType),this.paint._values[i]=new ja(a.property,n,a.parameters)}}}catch(u){t.e(u)}finally{t.f()}}},{key:"_handleOverridablePaintPropertyUpdate",value:function(e,t,i){return!(!this.layout||t.isDataDriven()||i.isDataDriven())&&r.hasPaintOverride(this.layout,e)}},{key:"getProgramConfiguration",value:function(e){return new ss(this,e)}}],[{key:"hasPaintOverride",value:function(e,t){var i=e.get("text-field"),r=Jd.paint.properties[t],n=!1,a=function(e){var t,i=l(e);try{for(i.s();!(t=i.n()).done;){var a=t.value;if(r.overrides&&r.overrides.hasOverride(a))return void(n=!0)}}catch(o){i.e(o)}finally{i.f()}};if("constant"===i.value.kind&&i.value.value instanceof Zt)a(i.value.value.sections);else if("source"===i.value.kind){var o=i.value;o._styleExpression&&function e(t){n||(t instanceof Kt&&Ht(t.value)===Mt?a(t.value.sections):t instanceof ei?a(t.sections):t.eachChild(e))}(o._styleExpression.expression)}return n}}]),r}(ms),ep={paint:new Wa({"background-color":new Ga(ft.paint_background["background-color"]),"background-pattern":new Ga(ft.paint_background["background-pattern"]),"background-opacity":new Ga(ft.paint_background["background-opacity"])})},tp={paint:new Wa({"raster-opacity":new Ga(ft.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ga(ft.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ga(ft.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ga(ft.paint_raster["raster-brightness-max"]),"raster-saturation":new Ga(ft.paint_raster["raster-saturation"]),"raster-contrast":new Ga(ft.paint_raster["raster-contrast"]),"raster-resampling":new Ga(ft.paint_raster["raster-resampling"]),"raster-fade-duration":new Ga(ft.paint_raster["raster-fade-duration"])})},ip=function(e){p(i,e);var t=m(i);function i(e){var r;return h(this,i),(r=t.call(this,e,{})).implementation=e,r}return d(i,[{key:"is3D",value:function(){return"3d"===this.implementation.renderingMode}},{key:"hasOffscreenPass",value:function(){return void 0!==this.implementation.prerender}},{key:"isLayerDraped",value:function(){return void 0!==this.implementation.renderToTile}},{key:"shouldRedrape",value:function(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}},{key:"recalculate",value:function(){}},{key:"updateTransitions",value:function(){}},{key:"hasTransition",value:function(){return!1}},{key:"serialize",value:function(){}},{key:"onAdd",value:function(e){this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)}},{key:"onRemove",value:function(e){this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)}}]),i}(ms),rp={paint:new Wa({"sky-type":new Ga(ft.paint_sky["sky-type"]),"sky-atmosphere-sun":new Ga(ft.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new Ga(ft.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new Ga(ft.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new Ga(ft.paint_sky["sky-gradient-radius"]),"sky-gradient":new qa(ft.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new Ga(ft.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new Ga(ft.paint_sky["sky-atmosphere-color"]),"sky-opacity":new Ga(ft.paint_sky["sky-opacity"])})};function np(e,t,i){var r=[0,0,1],n=al([]);return sl(n,n,i?-R(e)+Math.PI:R(e)),ol(n,n,-R(t)),Ks(r,r,n),Ws(r,r)}
1for(var ap={circle:function(e){p(i,e);var t=m(i);function i(e){return h(this,i),t.call(this,e,Du)}return d(i,[{key:"createBucket",value:function(e){return new mu(e)}},{key:"queryRadius",value:function(e){var t=e;return Iu("circle-radius",this,t)+Iu("circle-stroke-width",this,t)+Cu(this.paint.get("circle-translate"))}},{key:"queryIntersectsFeature",value:function(e,t,i,r,n,a,o,s){var l=zu(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),a.angle,e.pixelToTileUnitsFactor),u=this.paint.get("circle-radius").evaluate(t,i)+this.paint.get("circle-stroke-width").evaluate(t,i);return Lu(e,r,a,o,s,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),l,u)}},{key:"getProgramIds",value:function(){return["circle"]}},{key:"getProgramConfiguration",value:function(e){return new ss(this,e)}}]),i}(ms),heatmap:function(e){p(i,e);var t=m(i);function i(e){var r;return h(this,i),(r=t.call(this,e,qu))._updateColorRamp(),r}return d(i,[{key:"createBucket",value:function(e){return new Uu(e)}},{key:"_handleSpecialPaintPropertyUpdate",value:function(e){"heatmap-color"===e&&this._updateColorRamp()}},{key:"_updateColorRamp",value:function(){this.colorRamp=Wu({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}},{key:"resize",value:function(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}},{key:"queryRadius",value:function(e){return Iu("heatmap-radius",this,e)}},{key:"queryIntersectsFeature",value:function(e,t,i,r,n,a,o,s){var l=this.paint.get("heatmap-radius").evaluate(t,i);return Lu(e,r,a,o,s,!0,!0,new z(0,0),l)}},{key:"hasOffscreenPass",value:function(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}},{key:"getProgramIds",value:function(){return["heatmap","heatmapTexture"]}},{key:"getProgramConfiguration",value:function(e){return new ss(this,e)}}]),i}(ms),hillshade:function(e){p(i,e);var t=m(i);function i(e){return h(this,i),t.call(this,e,Xu)}return d(i,[{key:"hasOffscreenPass",value:function(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}},{key:"getProgramIds",value:function(){return["hillshade","hillshadePrepare"]}}]),i}(ms),fill:function(e){p(r,e);var i=m(r);function r(e){return h(this,r),i.call(this,e,Pc)}return d(r,[{key:"getProgramIds",value:function(){var e=this.paint.get("fill-pattern"),t=e&&e.constantOr(1),i=[t?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&i.push(t&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),i}},{key:"getProgramConfiguration",value:function(e){return new ss(this,e)}},{key:"recalculate",value:function(e,i){t(w(r.prototype),"recalculate",this).call(this,e,i);var n=this.paint._values["fill-outline-color"];"constant"===n.value.kind&&void 0===n.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}},{key:"createBucket",value:function(e){return new Ac(e)}},{key:"queryRadius",value:function(){return Cu(this.paint.get("fill-translate"))}},{key:"queryIntersectsFeature",value:function(e,t,i,r,n,a){return!e.queryGeometry.isAboveHorizon&&_u(Au(e.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),a.angle,e.pixelToTileUnitsFactor),r)}},{key:"isTileClipped",value:function(){return!0}}]),r}(ms),"fill-extrusion":function(e){p(i,e);var t=m(i);function i(e){return h(this,i),t.call(this,e,dh)}return d(i,[{key:"createBucket",value:function(e){return new rh(e)}},{key:"queryRadius",value:function(){return Cu(this.paint.get("fill-extrusion-translate"))}},{key:"is3D",value:function(){return!0}},{key:"getProgramIds",value:function(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}},{key:"getProgramConfiguration",value:function(e){return new ss(this,e)}},{key:"queryIntersectsFeature",value:function(e,t,i,r,n,o,s,u,c){var h=zu(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),o.angle,e.pixelToTileUnitsFactor),f=this.paint.get("fill-extrusion-height").evaluate(t,i),d=this.paint.get("fill-extrusion-base").evaluate(t,i),p=[0,0],m=u&&o.elevation,v=o.elevation?o.elevation.exaggeration():1,y=e.tile.getBucket(this);if(m&&y instanceof rh){var _=y.centroidVertexArray,g=c+1;g<_.length&&(p[0]=_.geta_centroid_pos0(g),p[1]=_.geta_centroid_pos1(g))}if(0===p[0]&&1===p[1])return!1;"globe"===o.projection.name&&(r=hh([r],[new z(0,0),new z(gs,gs)],e.tileID.canonical).map(function(e){return e.polygon}).flat());var x,b,w,k,T,E,M,S,I,C,A=a((b=r,w=d,k=f,T=h,E=s,M=m?u:null,S=p,I=v,C=o.center.lat,"globe"===(x=o).projection.name?function(e,t,i,r,n,a,o,s,u,c,h){var f=[],d=[],p=e.projection.upVectorScale(h,e.center.lat,e.worldSize).metersToTile,m=[0,0,0,1],v=[0,0,0,1],y=function(e,t,i,r){e[0]=t,e[1]=i,e[2]=r,e[3]=1},_=ch();i>0&&(i+=_),r+=_;var g,x=l(t);try{for(x.s();!(g=x.n()).done;){var b,w=g.value,k=[],T=[],E=l(w);try{for(E.s();!(b=E.n()).done;){var M=b.value,S=M.x+n.x,I=M.y+n.y,C=e.projection.projectTilePoint(S,I,h),A=e.projection.upVector(h,M.x,M.y),z=i,P=r;
1if(o){var D=wh(S,I,i,r,o,s,u,c);z+=D.base,P+=D.top}0!==i?y(m,C.x+A[0]*p*z,C.y+A[1]*p*z,C.z+A[2]*p*z):y(m,C.x,C.y,C.z),y(v,C.x+A[0]*p*P,C.y+A[1]*p*P,C.z+A[2]*p*P),Ys(m,m,a),Ys(v,v,a),k.push(new gh(m[0],m[1],m[2])),T.push(new gh(v[0],v[1],v[2]))}}catch(L){E.e(L)}finally{E.f()}f.push(k),d.push(T)}}catch(L){x.e(L)}finally{x.f()}return[f,d]}(x,b,w,k,T,E,M,S,I,C,e.tileID.canonical):M?function(e,t,i,r,n,a,o,s,u){var c,h=[],f=[],d=[0,0,0,1],p=l(e);try{for(p.s();!(c=p.n()).done;){var m,v=c.value,y=[],_=[],g=l(v);try{for(g.s();!(m=g.n()).done;){var x=m.value,b=x.x+r.x,w=x.y+r.y,k=wh(b,w,t,i,a,o,s,u);d[0]=b,d[1]=w,d[2]=k.base,d[3]=1,rl(d,d,n),d[3]=Math.max(d[3],1e-5);var T=new gh(d[0]/d[3],d[1]/d[3],d[2]/d[3]);d[0]=b,d[1]=w,d[2]=k.top,d[3]=1,rl(d,d,n),d[3]=Math.max(d[3],1e-5);var E=new gh(d[0]/d[3],d[1]/d[3],d[2]/d[3]);y.push(T),_.push(E)}}catch(M){g.e(M)}finally{g.f()}h.push(y),f.push(_)}}catch(M){p.e(M)}finally{p.f()}return[h,f]}(b,w,k,T,E,M,S,I,C):function(e,t,i,r,n){var a,o=[],s=[],u=n[8]*t,c=n[9]*t,h=n[10]*t,f=n[11]*t,d=n[8]*i,p=n[9]*i,m=n[10]*i,v=n[11]*i,y=l(e);try{for(y.s();!(a=y.n()).done;){var _,g=a.value,x=[],b=[],w=l(g);try{for(w.s();!(_=w.n()).done;){var k=_.value,T=k.x+r.x,E=k.y+r.y,M=n[0]*T+n[4]*E+n[12],S=n[1]*T+n[5]*E+n[13],I=n[2]*T+n[6]*E+n[14],C=n[3]*T+n[7]*E+n[15],A=M+u,z=S+c,P=I+h,D=Math.max(C+f,1e-5),L=M+d,R=S+p,B=I+m,O=Math.max(C+v,1e-5);x.push(new gh(A/D,z/D,P/D)),b.push(new gh(L/O,R/O,B/O))}}catch(F){w.e(F)}finally{w.f()}o.push(x),s.push(b)}}catch(F){y.e(F)}finally{y.f()}return[o,s]}(b,w,k,T,E)),2),P=A[0],D=A[1],L=e.queryGeometry;return function(e,t,i){var r=1/0;_u(i,t)&&(r=bh(i,t[0]));for(var n=0;n<t.length;n++)for(var a=t[n],o=e[n],s=0;s<a.length-1;s++){var l=a[s],u=[l,a[s+1],o[s+1],o[s],l];vu(i,u)&&(r=Math.min(r,bh(i,u)))}return r!==1/0&&r}(P,D,L.isPointQuery()?L.screenBounds:L.screenGeometry)}}]),i}(ms),line:function(e){p(r,e);var i=m(r);function r(e){var t;return h(this,r),(t=i.call(this,e,Ch)).gradientVersion=0,t}return d(r,[{key:"_handleSpecialPaintPropertyUpdate",value:function(e){if("line-gradient"===e){var t=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=t._styleExpression&&t._styleExpression.expression instanceof Pi,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}},{key:"gradientExpression",value:function(){return this._transitionablePaint._values["line-gradient"].value.expression}},{key:"widthExpression",value:function(){return this._transitionablePaint._values["line-width"].value.expression}},{key:"recalculate",value:function(e,i){t(w(r.prototype),"recalculate",this).call(this,e,i),this.paint._values["line-floorwidth"]=Ah.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}},{key:"createBucket",value:function(e){return new Sh(e)}},{key:"getProgramIds",value:function(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}},{key:"getProgramConfiguration",value:function(e){return new ss(this,e)}},{key:"queryRadius",value:function(e){var t=e,i=zh(Iu("line-width",this,t),Iu("line-gap-width",this,t)),r=Iu("line-offset",this,t);return i/2+Math.abs(r)+Cu(this.paint.get("line-translate"))}},{key:"queryIntersectsFeature",value:function(e,t,i,r,n,a){if(e.queryGeometry.isAboveHorizon)return!1;var o=Au(e.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),a.angle,e.pixelToTileUnitsFactor),s=e.pixelToTileUnitsFactor/2*zh(this.paint.get("line-width").evaluate(t,i),this.paint.get("line-gap-width").evaluate(t,i)),l=this.paint.get("line-offset").evaluate(t,i);return l&&(r=function(e,t){for(var i=[],r=new z(0,0),n=0;n<e.length;n++){for(var a=e[n],o=[],s=0;s<a.length;s++){var l=a[s-1],u=a[s],c=a[s+1],h=0===s?r:u.sub(l)._unit()._perp(),f=s===a.length-1?r:c.sub(u)._unit()._perp(),d=h._add(f)._unit();d._mult(1/(d.x*f.x+d.y*f.y)),o.push(d._mult(t)._add(u))}i.push(o)}return i}(r,l*e.pixelToTileUnitsFactor)),function(e,t,i){for(var r=0;r<t.length;r++){var n=t[r];if(e.length>=3)for(var a=0;a<n.length;a++)if(Eu(e,n[a]))return!0;if(gu(e,n,i))return!0}return!1}(o,r,s)}},{key:"isTileClipped",value:function(){return!0}}]),r}(ms),symbol:Qd,background:function(e){p(i,e);var t=m(i);function i(e){return h(this,i),t.call(this,e,ep)}return d(i,[{key:"getProgramIds",value:function(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}}]),i}(ms),raster:function(e){p(i,e);var t=m(i);function i(e){return h(this,i),t.call(this,e,tp)}return d(i,[{key:"getProgramIds",value:function(){return["raster"]}}]),i}(ms),sky:function(e){p(i,e);var t=m(i);function i(e){var r;return h(this,i),(r=t.call(this,e,rp))._updateColorRamp(),r}return d(i,[{key:"_handleSpecialPaintPropertyUpdate",value:function(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._skyboxInvali
1dated=!0)}},{key:"_updateColorRamp",value:function(){this.colorRamp=Wu({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}},{key:"needsSkyboxCapture",value:function(e){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){var t=e.style.light.properties.get("position");return this._lightPosition.azimuthal!==t.azimuthal||this._lightPosition.polar!==t.polar}return!1}},{key:"getCenter",value:function(e,t){if("atmosphere"===this.paint.get("sky-type")){var i=this.paint.get("sky-atmosphere-sun"),r=!i,n=e.style.light,a=n.properties.get("position");return r&&"viewport"===n.properties.get("anchor")&&ne("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),r?np(a.azimuthal,90-a.polar,t):np(i[0],90-i[1],t)}var o=this.paint.get("sky-gradient-center");return np(o[0],90-o[1],t)}},{key:"is3D",value:function(){return!1}},{key:"isSky",value:function(){return!0}},{key:"markSkyboxValid",value:function(e){this._skyboxInvalidated=!1,this._lightPosition=e.style.light.properties.get("position")}},{key:"hasOffscreenPass",value:function(){return!0}},{key:"getProgramIds",value:function(){var e=this.paint.get("sky-type");return"atmosphere"===e?["skyboxCapture","skybox"]:"gradient"===e?["skyboxGradient"]:null}}]),i}(ms)},op=function(){function e(t,i,r,n){h(this,e),this.context=t,this.format=r,this.texture=t.gl.createTexture(),this.update(i,n)}return d(e,[{key:"update",value:function(e,t,i){var r=e.width,n=e.height,a=this.context,o=a.gl,s=x.HTMLImageElement,l=x.HTMLCanvasElement,u=x.HTMLVideoElement,c=x.ImageData,h=x.ImageBitmap;if(o.bindTexture(o.TEXTURE_2D,this.texture),a.pixelStoreUnpackFlipY.set(!1),a.pixelStoreUnpack.set(1),a.pixelStoreUnpackPremultiplyAlpha.set(this.format===o.RGBA&&(!t||!1!==t.premultiply)),i||this.size&&this.size[0]===r&&this.size[1]===n){var f=i||{x:0,y:0},d=f.x,p=f.y;e instanceof s||e instanceof l||e instanceof u||e instanceof c||h&&e instanceof h?o.texSubImage2D(o.TEXTURE_2D,0,d,p,o.RGBA,o.UNSIGNED_BYTE,e):o.texSubImage2D(o.TEXTURE_2D,0,d,p,r,n,o.RGBA,o.UNSIGNED_BYTE,e.data)}else this.size=[r,n],e instanceof s||e instanceof l||e instanceof u||e instanceof c||h&&e instanceof h?o.texImage2D(o.TEXTURE_2D,0,this.format,this.format,o.UNSIGNED_BYTE,e):o.texImage2D(o.TEXTURE_2D,0,this.format,r,n,0,this.format,o.UNSIGNED_BYTE,e.data);this.useMipmap=Boolean(t&&t.useMipmap&&this.isSizePowerOfTwo()),this.useMipmap&&o.generateMipmap(o.TEXTURE_2D)}},{key:"bind",value:function(e,t){var i=this.context.gl;i.bindTexture(i.TEXTURE_2D,this.texture),e!==this.filter&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,this.useMipmap?e===i.NEAREST?i.NEAREST_MIPMAP_NEAREST:i.LINEAR_MIPMAP_NEAREST:e),this.filter=e),t!==this.wrap&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,t),this.wrap=t)}},{key:"isSizePowerOfTwo",value:function(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}},{key:"destroy",value:function(){this.context.gl.deleteTexture(this.texture),this.texture=null}}]),e}(),sp=function(){function e(t){var i=this;h(this,e),this._callback=t,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=function(){i._triggered=!1,i._callback()})}return d(e,[{key:"trigger",value:function(){var e=this;this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(function(){e._triggered=!1,e._callback()},0))}},{key:"remove",value:function(){this._channel=void 0,this._callback=function(){}}}]),e}(),lp=function(){function e(){h(this,e),this.tasks={},this.taskQueue=[],$(["process"],this),this.invoker=new sp(this.process),this.nextId=0}return d(e,[{key:"add",value:function(e,t){var i=this,r=this.nextId++,n=function(e){var t=e.type,i=e.isSymbolTile,r=e.zoom;return r=r||0,"message"===t?0:"maybePrepare"!==t||i?"parseTile"!==t||i?"parseTile"===t&&i?300-r:"maybePrepare"===t&&i?400-r:500:200-r:100-r}(t);if(0===n){se();try{e()}finally{}return{cancel:function(){}}}return this.tasks[r]={fn:e,metadata:t,priority:n,id:r},this.taskQueue.push(r),this.invoker.trigger(),{cancel:function(){delete i.tasks[r]}}}},{key:"process",value:function(){var e=this;se();try{if(this.taskQueue=this.taskQueue.filter(function(t){return!!e.tasks[t]}),!this.taskQueue.length)return;var t=this.pick();if(null===t)return;var i=this.tasks[t];if(delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),!i)return;i.fn()}finally{}}},{key:"pick",value:function(){for(var e=null,t=1/0,i=0;i<this.taskQueue.length;i++){var r=this.tasks[this.taskQueue[i]];r.priority<t&&(t=r.priority,e=i)}if(null===e)return null;var n=this.taskQueue[e];return this.taskQueue.splice(e,1),n}},{key:"remove",value:function(){this.invoker.remove()}}]),e}(),up=function(){function e(t){h(this,e),this._stringToNumber={},this._numberToString=[];for(var i=0;i<t.length;i++){var r=t[i];this._stringToNumber[r]=i,this._numberToString[i]=r}}return d(e,[{key:"encode",value:function(e){return this._stringToNumber[e]}},{key:"decode",value:function(e){return this._numberToString[e]}}]),e}(),cp=["tile","layer","source","sourceLayer","state"],hp=function(){function e(t,i,r,n,a){h(this,e),this.type="Feature",this._vectorTileFeature=t,this._z=i,this._x=r,this._y=n,this.properties=t.properties,this.id=a}return d(e,[{key:"geometry",get:function(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry},set:function(e){this._geometry=e}},{key:"toJSON",value:function(){var e={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};void 0!==this.id&&(e.id=this.id);var t,i=l(cp);try{for(i.s();!(t=i.n()).done;){var r=t.value;void 0!==this[r]&&(e[r]=this[r])}}catch(n){i.e(n)}finally{i.f()}return e}}]),e}(),fp=new Uint16Array(8184),dp=0;dp<2046;dp++){var pp=dp+2,mp=0,vp=0,yp=0,_p=0,gp=0,xp=0;for(1&pp?yp=_p=gp=32:mp=vp=xp=32;(pp>>=1)>1;){var bp=mp+yp>>1,wp=vp+_p>>1;1&pp?(yp=mp,_p=vp,mp=gp,vp=xp):(mp=yp,vp=_p,yp=gp,_p=xp),gp=bp,xp=wp}var kp=4*dp;fp[kp+0]=mp,fp[kp+1]=vp,fp[kp+2]=yp,fp[kp+3]=_p}
1var Tp=new Uint16Array(2178),Ep=new Uint8Array(1089),Mp=new Uint16Array(1089);function Sp(e){return 0===e?-.03125:32===e?.03125:0}var Ip=Ja([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),Cp={type:2,extent:gs,loadGeometry:function(){return[[new z(0,0),new z(8193,0),new z(8193,8193),new z(0,8193),new z(0,0)]]}},Ap=function(){function e(t,i,r,n,a){h(this,e),this.tileID=t,this.uid=H(),this.uses=0,this.tileSize=i,this.tileZoom=r,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=a,this.expiredRequestCount=0,this.state="loading",n&&n.transform&&(this.projection=n.transform.projection)}return d(e,[{key:"registerFadeDuration",value:function(e){var t=e+this.timeAdded;t<ot.now()||this.fadeEndTime&&t<this.fadeEndTime||(this.fadeEndTime=t)}},{key:"wasRequested",value:function(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}},{key:"tileTransform",get:function(){return this._tileTransform||(this._tileTransform=gd(this.tileID.canonical,this.projection)),this._tileTransform}},{key:"loadVectorData",value:function(e,t,i){if(this.unloadVectorData(),this.state="loaded",e){for(var r in e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(e,t){var i={};if(!t)return i;var r,n=l(e);try{var a=function(){var e=r.value,n=e.layerIds.map(function(e){return t.getLayer(e)}).filter(Boolean);if(0!==n.length){e.layers=n,e.stateDependentLayerIds&&(e.stateDependentLayers=e.stateDependentLayerIds.map(function(e){return n.filter(function(t){return t.id===e})[0]}));var a,o=l(n);try{for(o.s();!(a=o.n()).done;){var s=a.value;i[s.id]=e}}catch(u){o.e(u)}finally{o.f()}}};for(n.s();!(r=n.n()).done;)a()}catch(o){n.e(o)}finally{n.f()}return i}(e.buckets,t.style),this.hasSymbolBuckets=!1,this.buckets){var n=this.buckets[r];if(n instanceof Yd){if(this.hasSymbolBuckets=!0,!i)break;n.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(var a in this.buckets){var o=this.buckets[a];if(o instanceof Yd&&o.hasRTLText){this.hasRTLText=!0,Da.isLoading()||Da.isLoaded()||"deferred"!==za()||Pa();break}}for(var s in this.queryPadding=0,this.buckets){var u=this.buckets[s];this.queryPadding=Math.max(this.queryPadding,t.style.getLayer(s).queryRadius(u))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage),e.lineAtlas&&(this.lineAtlas=e.lineAtlas)}else this.collisionBoxArray=new Mo}},{key:"unloadVectorData",value:function(){if(this.hasData()){for(var 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"}}},{key:"getBucket",value:function(e){return this.buckets[e.id]}},{key:"upload",value:function(e){for(var t in this.buckets){var i=this.buckets[t];i.uploadPending()&&i.upload(e)}var r=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new op(e,this.imageAtlas.image,r.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new op(e,this.glyphAtlasImage,r.ALPHA),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new op(e,this.lineAtlas.image,r.ALPHA),this.lineAtlas.uploaded=!0)}},{key:"prepare",value:function(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}},{key:"queryRenderedFeatures",value:function(e,t,i,r,n,a,o,s){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({tileResult:r,pixelPosMatrix:o,transform:a,params:n,tileTransform:this.tileTransform},e,t,i):{}}},{key:"querySourceFeatures",value:function(e,t){var i=this.latestFeatureIndex;if(i&&i.rawTileData){var r=i.loadVTLayers(),n=t?t.sourceLayer:"",a=r._geojsonTileLayer||r[n];if(a)for(var o=Qr(t&&t.filter),s=this.tileID.canonical,l=s.z,u=s.x,c=s.y,h={z:l,x:u,y:c},f=0;f<a.length;f++){var d=a.feature(f);if(o.needGeometry){var p=fu(d,!0);
1if(!o.filter(new La(this.tileID.overscaledZ),p,this.tileID.canonical))continue}else if(!o.filter(new La(this.tileID.overscaledZ),d))continue;var m=i.getId(d,n),v=new hp(d,l,u,c,m);v.tile=h,e.push(v)}}}},{key:"hasData",value:function(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}},{key:"patternsLoaded",value:function(){return!!this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}},{key:"setExpiryData",value:function(e){var t=this.expirationTime;if(e.cacheControl){var i=le(e.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+1e3*i["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){var r=Date.now(),n=!1;if(this.expirationTime>r)n=!1;else if(t)if(this.expirationTime<t)n=!0;else{var a=this.expirationTime-t;a?this.expirationTime=r+Math.max(a,3e4):n=!0}else n=!0;n?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}},{key:"getExpiryTimeout",value:function(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),Math.pow(2,31)-1)}},{key:"setFeatureState",value:function(e,t){if(this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData&&0!==Object.keys(e).length&&t){var i=this.latestFeatureIndex.loadVTLayers(),r=t.style.listImages();for(var n in this.buckets)if(t.style.hasLayer(n)){var a=this.buckets[n],o=a.layers[0].sourceLayer||"_geojsonTileLayer",s=i[o],l=e[o];if(s&&l&&0!==Object.keys(l).length){if(a.update(l,s,r,this.imageAtlas&&this.imageAtlas.patternPositions||{}),a instanceof Sh||a instanceof Ac){var u=t.style._getSourceCache(a.layers[0].source);t._terrain&&t._terrain.enabled&&u&&a.programConfigurations.needsUpload&&t._terrain._clearRenderCacheForTile(u.id,this.tileID)}var c=t&&t.style&&t.style.getLayer(n);c&&(this.queryPadding=Math.max(this.queryPadding,c.queryRadius(a)))}}}}},{key:"holdingForFade",value:function(){return void 0!==this.symbolFadeHoldUntil}},{key:"symbolFadeFinished",value:function(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<ot.now()}},{key:"clearFadeHold",value:function(){this.symbolFadeHoldUntil=void 0}},{key:"setHoldDuration",value:function(e){this.symbolFadeHoldUntil=ot.now()+e}},{key:"setTexture",value:function(e,t){var i=t.context,r=i.gl;this.texture=this.texture||t.getTileTexture(e.width),this.texture?this.texture.update(e,{useMipmap:!0}):(this.texture=new op(i,e,r.RGBA,{useMipmap:!0}),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE))}},{key:"setDependencies",value:function(e,t){var i,r={},n=l(t);try{for(n.s();!(i=n.n()).done;){r[i.value]=!0}}catch(a){n.e(a)}finally{n.f()}this.dependencies[e]=r}},{key:"hasDependency",value:function(e,t){var i,r=l(e);try{for(r.s();!(i=r.n()).done;){var n=i.value,a=this.dependencies[n];if(a){var o,s=l(t);try{for(s.s();!(o=s.n()).done;){if(a[o.value])return!0}}catch(u){s.e(u)}finally{s.f()}}}}catch(u){r.e(u)}finally{r.f()}return!1}},{key:"clearQueryDebugViz",value:function(){}},{key:"_makeDebugTileBoundsBuffers",value:function(e,t){if(t&&"mercator"!==t.name&&!this._tileDebugBuffer){for(var i=hu(Cp,this.tileID.canonical,this.tileTransform)[0],r=new Qa,n=new ko,a=0;a<i.length;a++){var o=i[a],s=o.x,l=o.y;r.emplaceBack(s,l),n.emplaceBack(a)}n.emplaceBack(0),this._tileDebugIndexBuffer=e.createIndexBuffer(n),this._tileDebugBuffer=e.createVertexBuffer(r,hl.members),this._tileDebugSegments=_s.simpleSegment(0,0,r.length,n.length)}}},{key:"_makeTileBoundsBuffers",value:function(e,t){if(!this._tileBoundsBuffer&&t&&"mercator"!==t.name){var i,r,n=hu(Cp,this.tileID.canonical,this.tileTransform)[0];if(this.isRaster){var a=function(e,t){for(var i=gd(e,t),r=Math.pow(2,e.z),n=0;n<33;n++)for(var a=0;a<33;a++){var o=$l((e.x+(a+Sp(a))/32)/r),s=Ql((e.y+(n+Sp(n))/32)/r),l=t.project(o,s),u=33*n+a;Tp[2*u+0]=Math.round((l.x*i.scale-i.x)*gs),Tp[2*u+1]=Math.round((l.y*i.scale-i.y)*gs)}Ep.fill(0),Mp.fill(0);for(var c=2045;c>=0;c--){var h=4*c,f=fp[h+0],d=fp[h+1],p=fp[h+2],m=fp[h+3],v=f+p>>1,y=d+m>>1,_=v+y-d,g=y+f-v,x=33*d+f,b=33*m+p,w=33*y+v,k=Math.hypot((Tp[2*x+0]+Tp[2*b+0])/2-Tp[2*w+0],(Tp[2*x+1]+Tp[2*b+1])/2-Tp[2*w+1])>=16;if(Ep[w]=Ep[w]||(k?1:0),c<1022){var T=33*(d+g>>1)+(f+_>>1),E=33*(m+g>>1)+(p+_>>1);Ep[w]=Ep[w]||Ep[T]||Ep[E]}}var M=new to,S=new vo,I=0;function C(e,t){var i=33*t+e;return 0===Mp[i]&&(M.emplaceBack(Tp[2*i+0],Tp[2*i+1],e*gs/32,t*gs/32),Mp[i]=++I),Mp[i]-1}function A(e,t,i,r,n,a){var o=e+i>>1,s=t+r>>1;if(Math.abs(e-n)+Math.abs(t-a)>1&&Ep[33*s+o])A(n,a,e,t,o,s),A(i,r,n,a,o,s);else{var l=C(e,t),u=C(i,r),c=C(n,a);S.emplaceBack(l,u,c)}}return A(0,0,32,32,32,0),A(32,32,0,0,0,32),{vertices:M,indices:S}}(this.tileID.canonical,t);i=a.vertices,r=a.indices}else{i=new to,r=new vo;var o,s=l(n);try{for(s.s();!(o=s.n()).done;){var u=o.value,c=u.x,h=u.y;i.emplaceBack(c,h,0,0)}}
1catch(p){s.e(p)}finally{s.f()}for(var f=Yu(i.int16,void 0,4),d=0;d<f.length;d+=3)r.emplaceBack(f[d],f[d+1],f[d+2])}this._tileBoundsBuffer=e.createVertexBuffer(i,Ip.members),this._tileBoundsIndexBuffer=e.createIndexBuffer(r),this._tileBoundsSegments=_s.simpleSegment(0,0,i.length,r.length)}}},{key:"_makeGlobeTileDebugBuffers",value:function(e,t){var i=t.projection;if(i&&"globe"===i.name&&!t.freezeTileCoverage){var r,n=this.tileID.canonical,a=Bl(Sl(n,t)),o=Ul(t.zoom);o>0&&(r=Ms(new Float64Array(16),t.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(e,n,t,a,r,o),this._makeGlobeTileDebugTextBuffer(e,n,t,a,r,o)}}},{key:"_globePoint",value:function(e,t,i,r,n,a,o){var s=Dl(e,t,i);if(a){var l=1<<i.z,u=Yl(r.center.lng),c=Kl(r.center.lat),h=(i.x+.5)/l-u,f=0;h>.5?f=-1:h<-.5&&(f=1);var d=(e/gs+i.x)/l+f,p=(t/gs+i.y)/l;d=(d-u)*r._pixelsPerMercatorPixel+u,p=(p-c)*r._pixelsPerMercatorPixel+c;var m=[d*r.worldSize,p*r.worldSize,0];Ys(m,m,a),s=Ml(s,m,o)}return Ys(s,s,n)}},{key:"_makeGlobeTileDebugBorderBuffer",value:function(e,t,i,r,n,a){var o=this,s=new Qa,l=new ko,u=new eo,c=function(e,c,h,f,d){for(var p=(h-e)/(d-1),m=(f-c)/(d-1),v=s.length,y=0;y<d;y++){var _=e+y*p,g=c+y*m;s.emplaceBack(_,g);var x=o._globePoint(_,g,t,i,r,n,a);u.emplaceBack(x[0],x[1],x[2]),l.emplaceBack(v+y)}},h=gs;c(0,0,h,0,16),c(h,0,h,h,16),c(h,h,0,h,16),c(0,h,0,0,16),this._tileDebugIndexBuffer=e.createIndexBuffer(l),this._tileDebugBuffer=e.createVertexBuffer(s,hl.members),this._globeTileDebugBorderBuffer=e.createVertexBuffer(u,cl.members),this._tileDebugSegments=_s.simpleSegment(0,0,s.length,l.length)}},{key:"_makeGlobeTileDebugTextBuffer",value:function(e,t,i,r,n,a){var o=new Qa,s=new vo,l=new eo,u=25;s.reserve(32),o.reserve(u),l.reserve(u);for(var c=function(e,t){return u*e+t},h=0;h<u;h++)for(var f=2048*h,d=0;d<u;d++){var p=2048*d;o.emplaceBack(p,f);var m=this._globePoint(p,f,t,i,r,n,a);l.emplaceBack(m[0],m[1],m[2])}for(var v=0;v<4;v++)for(var y=0;y<4;y++){var _=c(v,y),g=c(v,y+1),x=c(v+1,y),b=c(v+1,y+1);s.emplaceBack(_,g,x),s.emplaceBack(x,g,b)}this._tileDebugTextIndexBuffer=e.createIndexBuffer(s),this._tileDebugTextBuffer=e.createVertexBuffer(o,hl.members),this._globeTileDebugTextBuffer=e.createVertexBuffer(l,cl.members),this._tileDebugTextSegments=_s.simpleSegment(0,0,u,32)}}]),e}(),zp=function(){function e(){h(this,e),this.state={},this.stateChanges={},this.deletedStates={}}return d(e,[{key:"updateState",value:function(e,t,i){var r=String(t);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][r]=this.stateChanges[e][r]||{},W(this.stateChanges[e][r],i),null===this.deletedStates[e])for(var n in this.deletedStates[e]={},this.state[e])n!==r&&(this.deletedStates[e][n]=null);else if(this.deletedStates[e]&&null===this.deletedStates[e][r])for(var a in this.deletedStates[e][r]={},this.state[e][r])i[a]||(this.deletedStates[e][r][a]=null);else for(var o in i)this.deletedStates[e]&&this.deletedStates[e][r]&&null===this.deletedStates[e][r][o]&&delete this.deletedStates[e][r][o]}},{key:"removeFeatureState",value:function(e,t,i){if(null!==this.deletedStates[e]){var r=String(t);if(this.deletedStates[e]=this.deletedStates[e]||{},i&&void 0!==t)null!==this.deletedStates[e][r]&&(this.deletedStates[e][r]=this.deletedStates[e][r]||{},this.deletedStates[e][r][i]=null);else if(void 0!==t)if(this.stateChanges[e]&&this.stateChanges[e][r])for(i in this.deletedStates[e][r]={},this.stateChanges[e][r])this.deletedStates[e][r][i]=null;else this.deletedStates[e][r]=null;else this.deletedStates[e]=null}}},{key:"getState",value:function(e,t){var i=String(t),r=W({},(this.state[e]||{})[i],(this.stateChanges[e]||{})[i]);if(null===this.deletedStates[e])return{};if(this.deletedStates[e]){var n=this.deletedStates[e][t];if(null===n)return{};for(var a in n)delete r[a]}return r}},{key:"initializeTileState",value:function(e,t){e.setFeatureState(this.state,t)}},{key:"coalesceChanges",value:function(e,t){var i={};for(var r in this.stateChanges){this.state[r]=this.state[r]||{};var n={};for(var a in this.stateChanges[r])this.state[r][a]||(this.state[r][a]={}),W(this.state[r][a],this.stateChanges[r][a]),n[a]=this.state[r][a];i[r]=n}for(var o in this.deletedStates){this.state[o]=this.state[o]||{};var s={};if(null===this.deletedStates[o])for(var l in this.state[o])s[l]={},this.state[o][l]={};else for(var u in this.deletedStates[o]){if(null===this.deletedStates[o][u])this.state[o][u]={};else if(this.state[o][u])for(var c=0,h=Object.keys(this.deletedStates[o][u]);c<h.length;c++){var f=h[c];delete this.state[o][u][f]}s[u]=this.state[o][u]}i[o]=i[o]||{},W(i[o],s)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(i).length)for(var d in e)e[d].setFeatureState(i,t)}}]),e}(),Pp=function(){function e(t){h(this,e),this.size=t,this.minimums=[],this.maximums=[],this.leaves=[]}return d(e,[{key:"getElevation",value:function(e,t){var i=this.toIdx(e,t);return{min:this.minimums[i],max:this.maximums[i]}}},{key:"isLeaf",value:function(e,t){return this.leaves[this.toIdx(e,t)]}},{key:"toIdx",value:function(e,t){return t*this.size+e}}]),e}();function Dp(e,t,i,r){for(var n=0,a=Number.MAX_VALUE,o=0;o<3;o++)if(Math.abs(r[o])<1e-15){if(i[o]<e[o]||i[o]>t[o])return null}else{var s=1/r[o],l=(e[o]-i[o])*s,u=(t[o]-i[o])*s;if(l>u){var c=l;l=u,u=c}if(l>n&&(n=l),u<a&&(a=u),n>a)return null}return n}function Lp(e,t,i,r,n,a,o,s,l,u,c){var h=r-e,f=n-t,d=a-i,p=o-e,m=s-t,v=l-i,y=c[1]*v-c[2]*m,_=c[2]*p-c[0]*v,g=c[0]*m-c[1]*p,x=h*y+f*_+d*g;if(Math.abs(x)<1e-15)return null;var b=1/x,w=u[0]-e,k=u[1]-t,T=u[2]-i,E=(w*y+k*_+T*g)*b;if(E<0||E>1)return null;var M=k*d-T*f,S=T*h-w*d,I=w*f-k*h,C=(c[0]*M+c[1]*S+c[2]*I)*b;return C<0||E+C>1?null:(p*M+m*S+v*I)*b}function Rp(e,t,i){return(e-t)/(i-t)}function Bp(e,t,i,r,n,a,o,s,l){var u=1<<i,c=a-r,h=o-n,f=(e+1)/u*c+r,d=(t+0)/u*h+n,p=(t+1)/u*h+n;s[0]=(e+0)/u*c+r,s[1]=d,l[0]=f,l[1]=p}var Op=function(){function e(t){if(h(this,e),this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=t,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],this.dem){var i=function(e){for(var t=Math.ceil(Math.log2(e.dim/8)),i=[],r=Math.ceil(Math.pow(2,t)),n=1/r,a=function(e,t,i,r,n){var a=r?1:0,o=(e+1)*i-a,s=t*i,l=(t+1)*i-a;n[0]=e*i,n[1]=s,n[2]=o,n[3]=l},o=new Pp(r),s=[],l=0;l<r*r;l++){a(l%r,Math.floor(l/r),n,!1,s);var u=Up(s[0],s[1],e),c=Up(s[2],s[1],e),h=Up(s[2],s[3],e),f=Up(s[0],s[3],e);o.minimums.push(Math.min(u,c,h,f)),o.maximums.push(Math.max(u,c,h,f)),o.leaves.push(1)}for(i.push(o),r/=2;r>=1;r/=2){var d=i[i.length-1];o=new Pp(r);for(var p=0;p<r*r;p++){a(p%r,Math.floor(p/r),2,!0,s);var m=d.getElevation(s[0],s[1]),v=d.getElevation(s[2],s[1]),y=d.getElevation(s[2],s[3]),_=d.getElevation(s[0],s[3]),g=d.isLeaf(s[0],s[1]),x=d.isLeaf(s[2],s[1]),b=d.isLeaf(s[2],s[3]),w=d.isLeaf(s[0],s[3]),k=Math.min(m.min,v.min,y.min,_.min),T=
1Math.max(m.max,v.max,y.max,_.max),E=g&&x&&b&&w;o.maximums.push(T),o.minimums.push(k),o.leaves.push(T-k<=5&&E?1:0)}i.push(o)}return i}(this.dem),r=i.length-1,n=i[r];this._addNode(n.minimums[0],n.maximums[0],n.leaves[0]),this._construct(i,0,0,r,0)}}return d(e,[{key:"raycastRoot",value:function(e,t,i,r,n,a){var o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1;return Dp([e,t,-100],[i,r,this.maximums[0]*o],n,a)}},{key:"raycast",value:function(e,t,i,r,n,a){var o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1;if(!this.nodeCount)return null;var s=this.raycastRoot(e,t,i,r,n,a,o);if(null==s)return null;for(var l=[],u=[],c=[],h=[],f=[{idx:0,t:s,nodex:0,nodey:0,depth:0}];f.length>0;){var d=f.pop(),p=d.idx,m=d.t,v=d.nodex,y=d.nodey,_=d.depth;if(this.leaves[p]){Bp(v,y,_,e,t,i,r,c,h);var g=1<<_,x=(v+0)/g,b=(v+1)/g,w=(y+0)/g,k=(y+1)/g,T=Up(x,w,this.dem)*o,E=Up(b,w,this.dem)*o,M=Up(b,k,this.dem)*o,S=Up(x,k,this.dem)*o,I=Lp(c[0],c[1],T,h[0],c[1],E,h[0],h[1],M,n,a),C=Lp(h[0],h[1],M,c[0],h[1],S,c[0],c[1],T,n,a),A=Math.min(null!==I?I:Number.MAX_VALUE,null!==C?C:Number.MAX_VALUE);if(A!==Number.MAX_VALUE)return A;var z=qs([],n,a,m);if(Fp(T,E,S,M,Rp(z[0],c[0],h[0]),Rp(z[1],c[1],h[1]))>=z[2])return m}else{for(var P=0,D=0;D<this._siblingOffset.length;D++){Bp((v<<1)+this._siblingOffset[D][0],(y<<1)+this._siblingOffset[D][1],_+1,e,t,i,r,c,h),c[2]=-100,h[2]=this.maximums[this.childOffsets[p]+D]*o;var L=Dp(c,h,n,a);if(null!=L){var R=L;l[D]=R;for(var B=!1,O=0;O<P&&!B;O++)R>=l[u[O]]&&(u.splice(O,0,D),B=!0);B||(u[P]=D),P++}}for(var F=0;F<P;F++){var U=u[F];f.push({idx:this.childOffsets[p]+U,t:l[U],nodex:(v<<1)+this._siblingOffset[U][0],nodey:(y<<1)+this._siblingOffset[U][1],depth:_+1})}}}return null}},{key:"_addNode",value:function(e,t,i){return this.minimums.push(e),this.maximums.push(t),this.leaves.push(i),this.childOffsets.push(0),this.nodeCount++}},{key:"_construct",value:function(e,t,i,r,n){if(1!==e[r].isLeaf(t,i)){this.childOffsets[n]||(this.childOffsets[n]=this.nodeCount);for(var a=r-1,o=e[a],s=0,l=0,u=0;u<this._siblingOffset.length;u++){var c=2*t+this._siblingOffset[u][0],h=2*i+this._siblingOffset[u][1],f=o.getElevation(c,h),d=o.isLeaf(c,h),p=this._addNode(f.min,f.max,d);d&&(s|=1<<u),l||(l=p)}for(var m=0;m<this._siblingOffset.length;m++)s&1<<m||this._construct(e,2*t+this._siblingOffset[m][0],2*i+this._siblingOffset[m][1],a,l+m)}}}]),e}();function Fp(e,t,i,r,n,a){return Di(Di(e,i,a),Di(t,r,a),n)}function Up(e,t,i){var r=i.dim,n=j(e*r-.5,0,r-1),a=j(t*r-.5,0,r-1),o=Math.floor(n),s=Math.floor(a),l=Math.min(o+1,r-1),u=Math.min(s+1,r-1);return Fp(i.get(o,s),i.get(l,s),i.get(o,u),i.get(l,u),n-o,a-s)}var Vp={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function jp(e,t,i){return(256*e*256+256*t+i)/10-1e4}function Np(e,t,i){return 256*e+t+i/256-32768}var Gp=function(){function e(t,i,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(h(this,e),this.uid=t,i.height!==i.width)throw new RangeError("DEM tiles must be square");if(r&&"mapbox"!==r&&"terrarium"!==r)return ne('"'.concat(r,'" is not a valid encoding type. Valid types include "mapbox" and "terrarium".'));this.stride=i.height;var o=this.dim=i.height-2,s=new Uint32Array(i.data.buffer);if(this.pixels=new Uint8Array(i.data.buffer),this.encoding=r||"mapbox",this.borderReady=n,!n){for(var l=0;l<o;l++)s[this._idx(-1,l)]=s[this._idx(0,l)],s[this._idx(o,l)]=s[this._idx(o-1,l)],s[this._idx(l,-1)]=s[this._idx(l,0)],s[this._idx(l,o)]=s[this._idx(l,o-1)];s[this._idx(-1,-1)]=s[this._idx(0,0)],s[this._idx(o,-1)]=s[this._idx(o-1,0)],s[this._idx(-1,o)]=s[this._idx(0,o-1)],s[this._idx(o,o)]=s[this._idx(o-1,o-1)],a&&this._buildQuadTree()}}return d(e,[{key:"tree",get:function(){return this._tree||this._buildQuadTree(),this._tree}},{key:"_buildQuadTree",value:function(){this._tree=new Op(this)}},{key:"get",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];i&&(e=j(e,-1,this.dim),t=j(t,-1,this.dim));var r=4*this._idx(e,t);return("terrarium"===this.encoding?Np:jp)(this.pixels[r],this.pixels[r+1],this.pixels[r+2])}},{key:"unpackVector",get:function(){return Vp[this.encoding]}},{key:"_idx",value:function(e,t){if(e<-1||e>=this.dim+1||t<-1||t>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(t+1)*this.stride+(e+1)}},{key:"getPixels",value:function(){return new Zu({width:this.stride,height:this.stride},this.pixels)}},{key:"backfillBorder",value:function(e,t,i){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");var r=t*this.dim,n=t*this.dim+this.dim,a=i*this.dim,o=i*this.dim+this.dim;switch(t){case-1:r=n-1;break;case 1:n=r+1}switch(i){case-1:a=o-1;break;case 1:o=a+1}for(var s=-t*this.dim,l=-i*this.dim,u=a;u<o;u++)for(var c=r;c<n;c++){var h=4*this._idx(c,u),f=4*this._idx(c+s,u+l);this.pixels[h+0]=e.pixels[f+0],this.pixels[h+1]=e.pixels[f+1],this.pixels[h+2]=e.pixels[f+2],this.pixels[h+3]=e.pixels[f+3]}}},{key:"onDeserialize",value:function(){this._tree&&(this._tree.dem=this)}}],[{key:"getUnpackVector",value:function(e){return Vp[e]}},{key:"pack",value:function(t,i){var r=[0,0,0,0],n=e.getUnpackVector(i),a=Math.floor((t+n[3])/n[2]);return r[2]=a%256,a=Math.floor(a/256),r[1]=a%256,a=Math.floor(a/256),r[0]=a,r}}]),e}();Bn(Gp,"DEMData"),Bn(Op,"DemMinMaxQuadTree",{omit:["dem"]});var Zp=function(){function e(t,i){h(this,e),this.max=t,this.onRemove=i,this.reset()}return d(e,[{key:"reset",value:function(){for(var e in this.data){var t,i=l(this.data[e]);try{for(i.s();!(t=i.n()).done;){var r=t.value;r.timeout&&clearTimeout(r.timeout),this.onRemove(r.value)}}catch(n){i.e(n)}finally{i.f()}}return this.data={},this.order=[],this}},{key:"add",value:function(e,t,i){var r=this,n=e.wrapped().key;void 0===this.data[n]&&(this.data[n]=[]);var a={value:t,timeout:void 0};if(void 0!==i&&(a.timeout=setTimeout(function(){r.remove(e,a)},i)),this.data[n].push(a),this.order.push(n),this.order.length>this.max){var o=this._getAndRemoveByKey(this.order[0]);o&&this.onRemove(o)}return this}},{key:"has",value:function(e){return e.wrapped().key in this.data}},{key:"getAndRemove",value:function(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}},{key:"_getAndRemoveByKey",value:function(e){var t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),0===this.data[e].length&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}},{key:"getByKey",value:function(e){var t=this.data[e];return t?t[0].value:null}}
1,{key:"get",value:function(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}},{key:"remove",value:function(e,t){if(!this.has(e))return this;var i=e.wrapped().key,r=void 0===t?0:this.data[i].indexOf(t),n=this.data[i][r];return this.data[i].splice(r,1),n.timeout&&clearTimeout(n.timeout),0===this.data[i].length&&delete this.data[i],this.onRemove(n.value),this.order.splice(this.order.indexOf(i),1),this}},{key:"setMaxSize",value:function(e){for(this.max=e;this.order.length>this.max;){var t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}},{key:"filter",value:function(e){var t=[];for(var i in this.data){var r,n=l(this.data[i]);try{for(n.s();!(r=n.n()).done;){var a=r.value;e(a.value)||t.push(a)}}catch(c){n.e(c)}finally{n.f()}}for(var o=0,s=t;o<s.length;o++){var u=s[o];this.remove(u.value.tileID,u)}}}]),e}(),qp=d(function e(t,i,r){h(this,e),this.func=t,this.mask=i,this.range=r});qp.ReadOnly=!1,qp.ReadWrite=!0,qp.disabled=new qp(519,qp.ReadOnly,[0,1]);var Wp=d(function e(t,i,r,n,a,o){h(this,e),this.test=t,this.ref=i,this.mask=r,this.fail=n,this.depthFail=a,this.pass=o});Wp.disabled=new Wp({func:519,mask:0},0,0,7680,7680,7680);var Xp=d(function e(t,i,r){h(this,e),this.blendFunction=t,this.blendColor=i,this.mask=r});Xp.Replace=[1,0],Xp.disabled=new Xp(Xp.Replace,jt.transparent,[!1,!1,!1,!1]),Xp.unblended=new Xp(Xp.Replace,jt.transparent,[!0,!0,!0,!0]),Xp.alphaBlended=new Xp([1,771],jt.transparent,[!0,!0,!0,!0]);var Hp=d(function e(t,i,r){h(this,e),this.enable=t,this.mode=i,this.frontFace=r});Hp.disabled=new Hp(!1,1029,2305),Hp.backCCW=new Hp(!0,1029,2305),Hp.backCW=new Hp(!0,1029,2304),Hp.frontCW=new Hp(!0,1028,2304),Hp.frontCCW=new Hp(!0,1028,2305);var Yp=function(e){p(i,e);var t=m(i);function i(e,r,n){var a;return h(this,i),(a=t.call(this)).id=e,a._onlySymbols=n,r.on("data",function(e){"source"===e.dataType&&"metadata"===e.sourceDataType&&(a._sourceLoaded=!0),a._sourceLoaded&&!a._paused&&"source"===e.dataType&&"content"===e.sourceDataType&&(a.reload(),a.transform&&a.update(a.transform))}),r.on("error",function(){a._sourceErrored=!0}),a._source=r,a._tiles={},a._cache=new Zp(0,a._unloadTile.bind(y(a))),a._timers={},a._cacheTimers={},a._minTileCacheSize=r.minTileCacheSize,a._maxTileCacheSize=r.maxTileCacheSize,a._loadedParentTiles={},a._coveredTiles={},a._state=new zp,a._isRaster="raster"===a._source.type||"raster-dem"===a._source.type||"custom"===a._source.type&&"raster"===a._source._dataType,a}return d(i,[{key:"onAdd",value:function(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}},{key:"loaded",value:function(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(var e in this._tiles){var t=this._tiles[e];if("loaded"!==t.state&&"errored"!==t.state)return!1}return!0}},{key:"getSource",value:function(){return this._source}},{key:"pause",value:function(){this._paused=!0}},{key:"resume",value:function(){if(this._paused){var e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform)}}},{key:"_loadTile",value:function(e,t){return e.isSymbolTile=this._onlySymbols,this._source.loadTile(e,t)}},{key:"_unloadTile",value:function(e){if(this._source.unloadTile)return this._source.unloadTile(e,function(){})}},{key:"_abortTile",value:function(e){if(this._source.abortTile)return this._source.abortTile(e,function(){})}},{key:"serialize",value:function(){return this._source.serialize()}},{key:"prepare",value:function(e){for(var t in this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null),this._tiles){var i=this._tiles[t];i.upload(e),i.prepare(this.map.style.imageManager)}}},{key:"getIds",value:function(){return q(this._tiles).map(function(e){return e.tileID}).sort(Kp).map(function(e){return e.key})}},{key:"getRenderableIds",value:function(e){var t=this,i=[];for(var r in this._tiles)this._isIdRenderable(+r,e)&&i.push(this._tiles[r]);return e?i.sort(function(e,i){var r=e.tileID,n=i.tileID,a=new z(r.canonical.x,r.canonical.y)._rotate(t.transform.angle),o=new z(n.canonical.x,n.canonical.y)._rotate(t.transform.angle);return r.overscaledZ-n.overscaledZ||o.y-a.y||o.x-a.x}).map(function(e){return e.tileID.key}):i.map(function(e){return e.tileID}).sort(Kp).map(function(e){return e.key})}},{key:"hasRenderableParent",value:function(e){var t=this.findLoadedParent(e,0);return!!t&&this._isIdRenderable(t.tileID.key)}},{key:"_isIdRenderable",value:function(e,t){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(t||!this._tiles[e].holdingForFade())}},{key:"reload",value:function(){if(this._paused)this._shouldReloadOnResume=!0;else for(var e in this._cache.reset(),this._tiles)"errored"!==this._tiles[e].state&&this._reloadTile(+e,"reloading")}},{key:"_reloadTile",value:function(e,t){var i=this._tiles[e];i&&("loading"!==i.state&&(i.state=t),this._loadTile(i,this._tileLoaded.bind(this,i,e,t)))}},{key:"_tileLoaded",value:function(e,t,i,r){if(r)if(e.state="errored",404!==r.status)this._source.fire(new ct(r,{tile:e}));else if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){var n=this.map.painter.terrain;this.update(this.transform,n.getScaledDemTileSize(),!0),n.resetTileLookupCache(this.id
1)}else this.update(this.transform);else e.timeAdded=ot.now(),"expired"===i&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(t,e),"raster-dem"===this._source.type&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),this._source.fire(new ut("data",{dataType:"source",tile:e,coord:e.tileID,sourceCacheId:this.id}))}},{key:"_backfillDEM",value:function(e){for(var t=this.getRenderableIds(),i=0;i<t.length;i++){var r=t[i];if(e.neighboringTiles&&e.neighboringTiles[r]){var n=this.getTileByID(r);a(e,n),a(n,e)}}function a(e,t){if(e.dem&&!e.dem.borderReady){e.needsHillshadePrepare=!0,e.needsDEMTextureUpload=!0;var i=t.tileID.canonical.x-e.tileID.canonical.x,r=t.tileID.canonical.y-e.tileID.canonical.y,n=Math.pow(2,e.tileID.canonical.z),a=t.tileID.key;0===i&&0===r||Math.abs(r)>1||(Math.abs(i)>1&&(1===Math.abs(i+n)?i+=n:1===Math.abs(i-n)&&(i-=n)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,i,r),e.neighboringTiles&&e.neighboringTiles[a]&&(e.neighboringTiles[a].backfilled=!0)))}}}},{key:"getTile",value:function(e){return this.getTileByID(e.key)}},{key:"getTileByID",value:function(e){return this._tiles[e]}},{key:"_retainLoadedChildren",value:function(e,t,i,r){for(var n in this._tiles){var a=this._tiles[n];if(!(r[n]||!a.hasData()||a.tileID.overscaledZ<=t||a.tileID.overscaledZ>i)){for(var o=a.tileID;a&&a.tileID.overscaledZ>t+1;){var s=a.tileID.scaledTo(a.tileID.overscaledZ-1);(a=this._tiles[s.key])&&a.hasData()&&(o=s)}for(var l=o;l.overscaledZ>t;)if(e[(l=l.scaledTo(l.overscaledZ-1)).key]){r[o.key]=o;break}}}}},{key:"findLoadedParent",value:function(e,t){if(e.key in this._loadedParentTiles){var i=this._loadedParentTiles[e.key];return i&&i.tileID.overscaledZ>=t?i:null}for(var r=e.overscaledZ-1;r>=t;r--){var n=e.scaledTo(r),a=this._getLoadedTile(n);if(a)return a}}},{key:"_getLoadedTile",value:function(e){var t=this._tiles[e.key];return t&&t.hasData()?t:this._cache.getByKey(this._source.reparseOverscaled?e.wrapped().key:e.canonical.key)}},{key:"updateCacheSize",value:function(e,t){t=t||this._source.tileSize;var i=Math.ceil(e.width/t)+1,r=Math.ceil(e.height/t)+1,n=Math.floor(i*r*5),a="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,n):n,o="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,a):a;this._cache.setMaxSize(o)}},{key:"handleWrapJump",value:function(e){var t=Math.round((e-(void 0===this._prevLng?e:this._prevLng))/360);if(this._prevLng=e,t){var i={};for(var r in this._tiles){var n=this._tiles[r];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+t),i[n.tileID.key]=n}for(var a in this._tiles=i,this._timers)clearTimeout(this._timers[a]),delete this._timers[a];for(var o in this._tiles)this._setTileReloadTimer(+o,this._tiles[o])}}},{key:"update",value:function(e,t,r){var n=this;if(this.transform=e,!(!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!r)){var a;this.updateCacheSize(e,t),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?a=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(function(e){return new yh(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)}):(a=e.coveringTiles({tileSize:t||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!r,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.hasTile&&(a=a.filter(function(e){return n._source.hasTile(e)}))):a=[];var o=this._updateRetainedTiles(a);if(Jp(this._source.type)&&0!==a.length){for(var s={},u={},c=0,h=Object.keys(o);c<h.length;c++){var f=h[c],d=o[f],p=this._tiles[f];if(p&&!(p.fadeEndTime&&p.fadeEndTime<=ot.now())){var m=this.findLoadedParent(d,Math.max(d.overscaledZ-i.maxOverzooming,this._source.minzoom));m&&(this._addTile(m.tileID),s[m.tileID.key]=m.tileID),u[f]=d}}var v=a[a.length-1].overscaledZ;for(var y in this._tiles){var _=this._tiles[y];if(!o[y]&&_.hasData())for(var g=_.tileID;g.overscaledZ>v;){g=g.scaledTo(g.overscaledZ-1);var x=this._tiles[g.key];if(x&&x.hasData()&&u[g.key]){o[y]=_.tileID;break}}}for(var b in s)o[b]||(this._coveredTiles[b]=!0,o[b]=s[b])}for(var w in o)this._tiles[w].clearFadeHold();var k,T=l(function(e,t){var i=[];for(var r in e)r in t||i.push(r);return i}(this._tiles,o));try{for(T.s();!(k=T.n()).done;){var E=k.value,M=this._tiles[E];M.hasSymbolBuckets&&!M.holdingForFade()?M.setHoldDuration(this.map._fadeDuration):M.hasSymbolBuckets&&!M.symbolFadeFinished()||this._removeTile(+E)}}catch(S){T.e(S)}finally{T.f()}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}}},{key:"releaseSymbolFadeTiles",value:function(){for(var e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(+e)}},{key:"_updateRetainedTiles",value:function(e){var t={};if(0===e.length)return t;var r,n={}
1,a=e.reduce(function(e,t){return Math.min(e,t.overscaledZ)},1/0),o=e[0].overscaledZ,s=Math.max(o-i.maxOverzooming,this._source.minzoom),u=Math.max(o+i.maxUnderzooming,this._source.minzoom),c={},h=l(e);try{for(h.s();!(r=h.n()).done;){var f=r.value,d=this._addTile(f);t[f.key]=f,d.hasData()||a<this._source.maxzoom&&(c[f.key]=f)}}catch(T){h.e(T)}finally{h.f()}this._retainLoadedChildren(c,a,u,t);var p,m=l(e);try{for(m.s();!(p=m.n()).done;){var v=p.value,y=this._tiles[v.key];if(!y.hasData()){if(v.canonical.z>=this._source.maxzoom){var _=v.children(this._source.maxzoom)[0],g=this.getTile(_);if(g&&g.hasData()){t[_.key]=_;continue}}else{var x=v.children(this._source.maxzoom);if(t[x[0].key]&&t[x[1].key]&&t[x[2].key]&&t[x[3].key])continue}for(var b=y.wasRequested(),w=v.overscaledZ-1;w>=s;--w){var k=v.scaledTo(w);if(n[k.key]||(n[k.key]=!0,!(y=this.getTile(k))&&b&&(y=this._addTile(k)),y&&(t[k.key]=k,b=y.wasRequested(),y.hasData())))break}}}}catch(T){m.e(T)}finally{m.f()}return t}},{key:"_updateLoadedParentTileCache",value:function(){for(var e in this._loadedParentTiles={},this._tiles){for(var t=[],i=void 0,r=this._tiles[e].tileID;r.overscaledZ>0;){if(r.key in this._loadedParentTiles){i=this._loadedParentTiles[r.key];break}t.push(r.key);var n=r.scaledTo(r.overscaledZ-1);if(i=this._getLoadedTile(n))break;r=n}for(var a=0,o=t;a<o.length;a++){var s=o[a];this._loadedParentTiles[s]=i}}}},{key:"_addTile",value:function(e){var t=this._tiles[e.key];if(t)return t;(t=this._cache.getAndRemove(e))&&(this._setTileReloadTimer(e.key,t),t.tileID=e,this._state.initializeTileState(t,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,t)));var i=Boolean(t);if(!i){var r=this.map?this.map.painter:null;t=new Ap(e,this._source.tileSize*e.overscaleFactor(),this.transform.tileZoom,r,this._isRaster),this._loadTile(t,this._tileLoaded.bind(this,t,e.key,t.state))}return t?(t.uses++,this._tiles[e.key]=t,i||this._source.fire(new ut("dataloading",{tile:t,coord:t.tileID,dataType:"source"})),t):null}},{key:"_setTileReloadTimer",value:function(e,t){var i=this;e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);var r=t.getExpiryTimeout();r&&(this._timers[e]=setTimeout(function(){i._reloadTile(e,"expired"),delete i._timers[e]},r))}},{key:"_removeTile",value:function(e){var t=this._tiles[e];t&&(t.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),t.uses>0||(t.hasData()&&"reloading"!==t.state?this._cache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}},{key:"clearTiles",value:function(){for(var 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)}},{key:"tilesIn",value:function(e,t,i){var n=[],a=this.transform;if(!a)return n;var o="globe"===a.projection.name,s=Yl(a.center.lng);for(var u in this._tiles){var c=this._tiles[u];if(i&&c.clearQueryDebugViz(),!c.holdingForFade()){var h=void 0;if(o){var f=c.tileID.canonical;if(0===f.z){var d=[Math.abs(j.apply(void 0,[s].concat(r($p(f,-1))))-s),Math.abs(j.apply(void 0,[s].concat(r($p(f,1))))-s)];h=[0,2*d.indexOf(Math.min.apply(Math,d))-1]}else{var p=[Math.abs(j.apply(void 0,[s].concat(r($p(f,-1))))-s),Math.abs(j.apply(void 0,[s].concat(r($p(f,0))))-s),Math.abs(j.apply(void 0,[s].concat(r($p(f,1))))-s)];h=[p.indexOf(Math.min.apply(Math,p))-1]}}else h=[0];var m,v=l(h);try{for(v.s();!(m=v.n()).done;){var y=m.value,_=e.containsTile(c,a,t,y);_&&n.push(_)}}catch(g){v.e(g)}finally{v.f()}}}return n}},{key:"getVisibleCoordinates",value:function(e){var t,i=this,r=this.getRenderableIds(e).map(function(e){return i._tiles[e].tileID}),n=l(r);try{for(n.s();!(t=n.n()).done;){var a=t.value;a.projMatrix=this.transform.calculateProjMatrix(a.toUnwrapped())}}catch(o){n.e(o)}finally{n.f()}return r}},{key:"hasTransition",value:function(){if(this._source.hasTransition())return!0;
1if(Jp(this._source.type))for(var e in this._tiles){var t=this._tiles[e];if(void 0!==t.fadeEndTime&&t.fadeEndTime>=ot.now())return!0}return!1}},{key:"setFeatureState",value:function(e,t,i){this._state.updateState(e=e||"_geojsonTileLayer",t,i)}},{key:"removeFeatureState",value:function(e,t,i){this._state.removeFeatureState(e=e||"_geojsonTileLayer",t,i)}},{key:"getFeatureState",value:function(e,t){return this._state.getState(e=e||"_geojsonTileLayer",t)}},{key:"setDependencies",value:function(e,t,i){var r=this._tiles[e];r&&r.setDependencies(t,i)}},{key:"reloadTilesForDependencies",value:function(e,t){for(var i in this._tiles)this._tiles[i].hasDependency(e,t)&&this._reloadTile(+i,"reloading");this._cache.filter(function(i){return!i.hasDependency(e,t)})}},{key:"_preloadTiles",value:function(e,t){var i,r=this,n=new Map,a=Array.isArray(e)?e:[e],o=this.map.painter.terrain,s=this.usedForTerrain&&o?o.getScaledDemTileSize():this._source.tileSize,u=l(a);try{for(u.s();!(i=u.n()).done;){var c,h=i.value,f=l(h.coveringTiles({tileSize:s,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}));try{for(f.s();!(c=f.n()).done;){var d=c.value;n.set(d.key,d)}}catch(p){f.e(p)}finally{f.f()}this.usedForTerrain&&h.updateElevation(!1)}}catch(p){u.e(p)}finally{u.f()}Z(Array.from(n.values()),function(e,t){var i=new Ap(e,r._source.tileSize*e.overscaleFactor(),r.transform.tileZoom,r.map.painter,r._isRaster);r._loadTile(i,function(e){"raster-dem"===r._source.type&&i.dem&&r._backfillDEM(i),t(e,i)})},t)}}]),i}(ht);function Kp(e,t){var i=Math.abs(2*e.wrap)-+(e.wrap<0),r=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||r-i||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}function Jp(e){return"raster"===e||"image"===e||"video"===e||"custom"===e}function $p(e,t){var i=1<<e.z;return[e.x/i+t,(e.x+1)/i+t]}Yp.maxOverzooming=10,Yp.maxUnderzooming=3;var Qp=function(){function e(t,i,r){h(this,e),this._demTile=t,this._dem=this._demTile.dem,this._scale=i,this._offset=r}return d(e,[{key:"tileCoordToPixel",value:function(e,t){var i=t*this._scale+this._offset[1],r=Math.floor(e*this._scale+this._offset[0]),n=Math.floor(i);return new z(r,n)}},{key:"getElevationAt",value:function(e,t,i,r){var n=e*this._scale+this._offset[0],a=t*this._scale+this._offset[1],o=Math.floor(n),s=Math.floor(a),l=this._dem;return r=!!r,i?Di(Di(l.get(o,s,r),l.get(o,s+1,r),a-s),Di(l.get(o+1,s,r),l.get(o+1,s+1,r),a-s),n-o):l.get(o,s,r)}},{key:"getElevationAtPixel",value:function(e,t,i){return this._dem.get(e,t,!!i)}},{key:"getMeterToDEM",value:function(e){return(1<<this._demTile.tileID.canonical.z)*Jl(1,e)*this._dem.stride}}],[{key:"create",value:function(t,i,r){var n=r||t.findDEMTileFor(i);if(n&&n.dem){var a=n.dem,o=n.tileID,s=1<<i.canonical.z-o.canonical.z;return new e(n,n.tileSize/gs/s,[(i.canonical.x/s-o.canonical.x)*a.dim,(i.canonical.y/s-o.canonical.y)*a.dim])}}}]),e}(),em=function(){function e(t,i){h(this,e),this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Dn(gs,16,0),this.featureIndexArray=new Lo,this.promoteId=i}return d(e,[{key:"insert",value:function(e,t,i,r,n){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,o=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,r,n,a);for(var s=this.grid,l=0;l<t.length;l++){for(var u=t[l],c=[1/0,1/0,-1/0,-1/0],h=0;h<u.length;h++){var f=u[h];c[0]=Math.min(c[0],f.x),c[1]=Math.min(c[1],f.y),c[2]=Math.max(c[2],f.x),c[3]=Math.max(c[3],f.y)}c[0]<gs&&c[1]<gs&&c[2]>=0&&c[3]>=0&&s.insert(o,c[0],c[1],c[2],c[3])}}},{key:"loadVTLayers",value:function(){if(!this.vtLayers)for(var e in this.vtLayers=new Yc(new Hh(this.rawTileData)).layers,this.sourceLayerCoder=new up(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={},this.vtLayers)this.vtFeatures[e]=[];return this.vtLayers}},{key:"query",value:function(e,t,i,r){var n=this;this.loadVTLayers();var a=e.params||{},o=Qr(a.filter),s=e.tileResult,l=e.transform,u=s.bufferedTilespaceBounds,c=this.grid.query(u.min.x,u.min.y,u.max.x,u.max.y,function(e,t,i,r){return Mu(s.bufferedTilespaceGeometry,e,t,i,r)});c.sort(im);var h=null;l.elevation&&c.length>0&&(h=Qp.create(l.elevation,this.tileID));for(var f,d={},p=function(l){var u=c[l];if(u===f)return"continue";f=u;var p=n.featureIndexArray.get(u),m=null;
1n.loadMatchingFeature(d,p,o,a.layers,a.availableImages,t,i,r,function(t,i,r){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return m||(m=hu(t,n.tileID.canonical,e.tileTransform)),i.queryIntersectsFeature(s,t,r,m,n.z,e.transform,e.pixelPosMatrix,h,a)})},m=0;m<c.length;m++)p(m);return d}},{key:"loadMatchingFeature",value:function(e,t,i,r,n,a,o,s,l){var u=t.featureIndex,c=t.bucketIndex,h=t.sourceLayerIndex,f=t.layoutVertexArrayOffset,d=this.bucketLayerIDs[c];if(!r||function(e,t){for(var i=0;i<e.length;i++)if(t.indexOf(e[i])>=0)return!0;return!1}(r,d)){var p=this.sourceLayerCoder.decode(h),m=this.vtLayers[p].feature(u);if(i.needGeometry){var v=fu(m,!0);if(!i.filter(new La(this.tileID.overscaledZ),v,this.tileID.canonical))return}else if(!i.filter(new La(this.tileID.overscaledZ),m))return;for(var y=this.getId(m,p),_=0;_<d.length;_++){var g=d[_];if(!(r&&r.indexOf(g)<0)){var x=a[g];if(x){var b={};void 0!==y&&s&&(b=s.getState(x.sourceLayer||"_geojsonTileLayer",y));var w=W({},o[g]);w.paint=tm(w.paint,x.paint,m,b,n),w.layout=tm(w.layout,x.layout,m,b,n);var k=!l||l(m,x,b,f);if(k){var T=new hp(m,this.z,this.x,this.y,y);T.layer=w;var E=e[g];void 0===E&&(E=e[g]=[]),E.push({featureIndex:u,feature:T,intersectionZ:k})}}}}}}},{key:"lookupSymbolFeatures",value:function(e,t,i,r,n,a,o,s){var u={};this.loadVTLayers();var c,h=Qr(n),f=l(e);try{for(f.s();!(c=f.n()).done;){var d=c.value;this.loadMatchingFeature(u,{bucketIndex:i,sourceLayerIndex:r,featureIndex:d,layoutVertexArrayOffset:0},h,a,o,s,t)}}catch(p){f.e(p)}finally{f.f()}return u}},{key:"loadFeature",value:function(e){var t=e.featureIndex,i=e.sourceLayerIndex;this.loadVTLayers();var r=this.sourceLayerCoder.decode(i),n=this.vtFeatures[r];if(n[t])return n[t];var a=this.vtLayers[r].feature(t);return n[t]=a,a}},{key:"hasLayer",value:function(e){var t,i=l(this.bucketLayerIDs);try{for(i.s();!(t=i.n()).done;){var r,n=l(t.value);try{for(n.s();!(r=n.n()).done;){if(e===r.value)return!0}}catch(a){n.e(a)}finally{n.f()}}}catch(a){i.e(a)}finally{i.f()}return!1}},{key:"getId",value:function(e,t){var i=e.id;if(this.promoteId){var r="string"==typeof this.promoteId?this.promoteId:this.promoteId[t];null!=r&&(i=e.properties[r]),"boolean"==typeof i&&(i=Number(i))}return i}}]),e}();function tm(e,t,i,r,n){return ee(e,function(e,a){var o=t instanceof Na?t.get(a):null;return o&&o.evaluate?o.evaluate(i,r,n):o})}function im(e,t){return t-e}Bn(em,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});var rm=function(){function e(t,i){h(this,e),this.width=t,this.height=i,this.nextRow=0,this.image=new Gu({width:t,height:i}),this.positions={},this.uploaded=!1}return d(e,[{key:"getDash",value:function(e,t){var i=this.getKey(e,t);return this.positions[i]}},{key:"trim",value:function(){var e=this.width,t=this.height=K(this.nextRow);this.image.resize({width:e,height:t})}},{key:"getKey",value:function(e,t){return e.join(",")+t}},{key:"getDashRanges",value:function(e,t,i){var r=[],n=e.length%2==1?-e[e.length-1]*i:0,a=e[0]*i,o=!0;r.push({left:n,right:a,isDash:o,zeroLength:0===e[0]});for(var s=e[0],l=1;l<e.length;l++){o=!o;var u=e[l];n=s*i,a=(s+=u)*i,r.push({left:n,right:a,isDash:o,zeroLength:0===u})}return r}},{key:"addRoundDash",value:function(e,t,i){for(var r=t/2,n=-i;n<=i;n++)for(var a=this.width*(this.nextRow+i+n),o=0,s=e[o],l=0;l<this.width;l++){l/s.right>1&&(s=e[++o]);var u=Math.abs(l-s.left),c=Math.abs(l-s.right),h=Math.min(u,c),f=void 0,d=n/i*(r+1);if(s.isDash){var p=r-Math.abs(d);f=Math.sqrt(h*h+p*p)}else f=r-Math.sqrt(h*h+d*d);this.image.data[a+l]=Math.max(0,Math.min(255,f+128))}}},{key:"addRegularDash",value:function(e,t){for(var i=e.length-1;i>=0;--i){var r=e[i],n=e[i+1];r.zeroLength?e.splice(i,1):n&&n.isDash===r.isDash&&(n.left=r.left,e.splice(i,1))}var a=e[0],o=e[e.length-1];a.isDash===o.isDash&&(a.left=o.left-this.width,o.right=a.right+this.width);for(var s=this.width*this.nextRow,l=0,u=e[l],c=0;c<this.width;c++){c/u.right>1&&(u=e[++l]);var h=Math.abs(c-u.left),f=Math.abs(c-u.right),d=Math.min(h,f);this.image.data[s+c]=Math.max(0,Math.min(255,(u.isDash?d:-d)+t+128))}}},{key:"addDash",value:function(e,t){var i=this.getKey(e,t);if(this.positions[i])return this.positions[i];var r="round"===t,n=r?7:0,a=2*n+1;if(this.nextRow+a>this.height)return ne("LineAtlas out of space"),null;0===e.length&&e.push(1);for(var o=0,s=0;s<e.length;s++)e[s]<0&&(ne("Negative value is found in line dasharray, replacing values with 0"),e[s]=0),o+=e[s];if(0!==o){var l=this.width/o,u=this.getDashRanges(e,this.width,l);r?this.addRoundDash(u,l,n):this.addRegularDash(u,"square"===t?.5*l:0)}var c=this.nextRow+n;this.nextRow+=a;var h={tl:[c,n],br:[o,0]};return this.positions[i]=h,h}}]),e}();Bn(rm,"LineAtlas");var nm=d(function e(t){h(this,e);var i={},r=[];for(var n in t){var a=t[n],o=i[n]={};for(var s in a.glyphs){var l=a.glyphs[+s];if(l&&0!==l.bitmap.width&&0!==l.bitmap.height){var u=l.metrics.localGlyph?2:1,c={x:0,y:0,w:l.bitmap.width+2*u,h:l.bitmap.height+2*u};r.push(c),o[s]=c}}}var f=gf(r),d=f.w,p=f.h,m=new Gu({width:d||1,height:p||1});for(var v in t){var y=t[v];for(var _ in y.glyphs){var g=y.glyphs[+_];if(g&&0!==g.bitmap.width&&0!==g.bitmap.height){var x=i[v][_],b=g.metrics.localGlyph?2:1;Gu.copy(g.bitmap,m,{x:0,y:0},{x:x.x+b,y:x.y+b},g.bitmap)}}}this.image=m,this.positions=i});Bn(nm,"GlyphAtlas");var am=function(){function e(t){h(this,e),this.tileID=new yh(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.tileZoom=t.tileZoom,this.uid=t.uid,this.zoom=t.zoom,this.canonical=t.tileID.canonical,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId,this.enableTerrain=!!t.enableTerrain,this.isSymbolTile=t.isSymbolTile,this.tileTransform=gd(t.tileID.canonical,t.projection),this.projection=t.projection}return d(e,[{key:"parse",value:function(e,t,i,r,n){var a=this;this.status="parsing",this.data=e,this.collisionBoxArray=new Mo;
1var o=new up(Object.keys(e.layers).sort()),s=new em(this.tileID,this.promoteId);s.bucketLayerIDs=[];var u,c,h,f,d={},p=new rm(256,256),m={featureIndex:s,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:p,availableImages:i},v=t.familiesBySource[this.source];for(var y in v){var _=e.layers[y];if(_){var g,x=!1,b=!1,w=l(v[y]);try{for(w.s();!(g=w.n()).done;){"symbol"===g.value[0].type?x=!0:b=!0}}catch(O){w.e(O)}finally{w.f()}if((!0!==this.isSymbolTile||x)&&(!1!==this.isSymbolTile||b)){1===_.version&&ne('Vector tile source "'.concat(this.source,'" layer "').concat(y,'" does not use vector tile spec v2 and therefore may have some rendering errors.'));for(var k=o.encode(y),T=[],E=0;E<_.length;E++){var M=_.feature(E),S=s.getId(M,y);T.push({feature:M,id:S,index:E,sourceLayerIndex:k})}var I,C=l(v[y]);try{for(C.s();!(I=C.n()).done;){var A=I.value,z=A[0];void 0!==this.isSymbolTile&&"symbol"===z.type!==this.isSymbolTile||z.minzoom&&this.zoom<Math.floor(z.minzoom)||z.maxzoom&&this.zoom>=z.maxzoom||"none"!==z.visibility&&(om(A,this.zoom,i),(d[z.id]=z.createBucket({index:s.bucketLayerIDs.length,layers:A,zoom:this.zoom,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:k,sourceID:this.source,enableTerrain:this.enableTerrain,projection:this.projection.spec,availableImages:i})).populate(T,m,this.tileID.canonical,this.tileTransform),s.bucketLayerIDs.push(A.map(function(e){return e.id})))}}catch(O){C.e(O)}finally{C.f()}}}}p.trim();var P={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},D=ee(m.glyphDependencies,function(e){return Object.keys(e).map(Number)});Object.keys(D).length?r.send("getGlyphs",{uid:this.uid,stacks:D},function(e,t){u||(u=e,c=t,B.call(a))},void 0,!1,P):c={};var L=Object.keys(m.iconDependencies);L.length?r.send("getImages",{icons:L,source:this.source,tileID:this.tileID,type:"icons"},function(e,t){u||(u=e,h=t,B.call(a))},void 0,!1,P):h={};var R=Object.keys(m.patternDependencies);function B(){if(u)return n(u);if(c&&h&&f){var e=new nm(c),t=new bf(h,f);for(var r in d){var a=d[r];a instanceof Yd?(om(a.layers,this.zoom,i),cd(a,c,e.positions,h,t.iconPositions,this.showCollisionBoxes,i,this.tileID.canonical,this.tileZoom,this.projection)):a.hasPattern&&(a instanceof Sh||a instanceof Ac||a instanceof rh)&&(om(a.layers,this.zoom,i),a.addFeatures(m,this.tileID.canonical,t.patternPositions,i,this.tileTransform))}this.status="done",n(null,{buckets:q(d).filter(function(e){return!e.isEmpty()}),featureIndex:s,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,lineAtlas:p,imageAtlas:t,glyphMap:this.returnDependencies?c:null,iconMap:this.returnDependencies?h:null,glyphPositions:this.returnDependencies?e.positions:null})}}R.length?r.send("getImages",{icons:R,source:this.source,tileID:this.tileID,type:"patterns"},function(e,t){u||(u=e,f=t,B.call(a))},void 0,!1,P):f={},B.call(this)}}]),e}();function om(e,t,i){var r,n=new La(t),a=l(e);try{for(a.s();!(r=a.n()).done;){r.value.recalculate(n,i)}}catch(o){a.e(o)}finally{a.f()}}var sm=function(){function e(t){h(this,e),this.entries={},this.scheduler=t}return d(e,[{key:"request",value:function(e,t,i,r){var n=this,o=this.entries[e]=this.entries[e]||{callbacks:[]};if(o.result){var s=a(o.result,2),u=s[0],c=s[1];return this.scheduler?this.scheduler.add(function(){r(u,c)},t):r(u,c),function(){}}return o.callbacks.push(r),o.cancel||(o.cancel=i(function(i,r){o.result=[i,r];var a,s=l(o.callbacks);try{var u=function(){var e=a.value;n.scheduler?n.scheduler.add(function(){e(i,r)},t):e(i,r)};for(s.s();!(a=s.n()).done;)u()}catch(c){s.e(c)}finally{s.f()}setTimeout(function(){return delete n.entries[e]},3e3)})),function(){o.result||(o.callbacks=o.callbacks.filter(function(e){return e!==r}),o.callbacks.length||(o.cancel(),delete n.entries[e]))}}}]),e}();function lm(e,t,i){var r=JSON.stringify(e.request);return e.data&&(this.deduped.entries[r]={result:[null,e.data]}),this.deduped.request(r,{type:"parseTile",isSymbolTile:e.isSymbolTile,zoom:e.tileZoom},function(t){var r=Me(e.request,function(e,r,n,a){e?t(e):r&&t(null,{vectorTile:i?void 0:new Yc(new Hh(r)),rawData:r,cacheControl:n,expires:a})});return function(){r.cancel(),t()}},t)}e.ARRAY_TYPE=ws,e.AUTH_ERR_MSG=ze,e.Aabb=ml,e.Actor=function(){function e(t,i,r){h(this,e),this.target=t,this.parent=i,this.mapId=r,this.callbacks={},this.cancelCallbacks={},$(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.globalScope=se()?t:x,this.scheduler
1=new lp}return d(e,[{key:"send",value:function(e,t,i,r){var n=this,a=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o=arguments.length>5?arguments[5]:void 0,s=Math.round(1e18*Math.random()).toString(36).substring(0,10);i&&(i.metadata=o,this.callbacks[s]=i);var l=ce(this.globalScope)?void 0:[];return this.target.postMessage({id:s,type:e,hasCallback:!!i,targetMapId:r,mustQueue:a,sourceMapId:this.mapId,data:Vn(t,l)},l),{cancel:function(){i&&delete n.callbacks[s],n.target.postMessage({id:s,type:"<cancel>",targetMapId:r,sourceMapId:n.mapId})}}}},{key:"receive",value:function(e){var t=this,i=e.data,r=i.id;if(r&&(!i.targetMapId||this.mapId===i.targetMapId))if("<cancel>"===i.type){var n=this.cancelCallbacks[r];delete this.cancelCallbacks[r],n&&n.cancel()}else if(i.mustQueue||se()){var a=this.callbacks[r];this.cancelCallbacks[r]=this.scheduler.add(function(){return t.processTask(r,i)},a&&a.metadata||{type:"message"})}else this.processTask(r,i)}},{key:"processTask",value:function(e,t){var i=this;if("<response>"===t.type){var r=this.callbacks[e];delete this.callbacks[e],r&&(t.error?r(jn(t.error)):r(null,jn(t.data)))}else{var n=ce(this.globalScope)?void 0:[],a=t.hasCallback?function(t,r){delete i.cancelCallbacks[e],i.target.postMessage({id:e,type:"<response>",sourceMapId:i.mapId,error:t?Vn(t):null,data:Vn(r,n)},n)}:function(e){},o=jn(t.data);if(this.parent[t.type])this.parent[t.type](t.sourceMapId,o,a);else if(this.parent.getWorkerSource){var s=t.type.split(".");this.parent.getWorkerSource(t.sourceMapId,s[0],o.source)[s[1]](o,a)}else a(new Error("Could not find function ".concat(t.type)))}}},{key:"remove",value:function(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}]),e}(),e.CanonicalTileID=mh,e.Color=jt,e.ColorMode=Xp,e.CullFaceMode=Hp,e.DEMData=Gp,e.DataConstantProperty=Ga,e.DedupedRequest=sm,e.DepthMode=qp,e.EXTENT=gs,e.Elevation=function(){function e(){h(this,e)}return d(e,[{key:"isDataAvailableAtPoint",value:function(e){var t=this._source();if(this.isUsingMockSource()||!t||e.y<0||e.y>1)return!1;var i=t.getSource().maxzoom,r=1<<i,n=Math.floor(e.x),a=Math.floor((e.x-n)*r),o=Math.floor(e.y*r),s=this.findDEMTileFor(new yh(i,n,i,a,o));return!(!s||!s.dem)}},{key:"getAtPointOrZero",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.getAtPoint(e,t)||0}},{key:"getAtPoint",value:function(e,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(this.isUsingMockSource())return null;null==t&&(t=null);var r=this._source();if(!r||e.y<0||e.y>1)return t;var n=r.getSource().maxzoom,a=1<<n,o=Math.floor(e.x),s=e.x-o,l=new yh(n,o,n,Math.floor(s*a),Math.floor(e.y*a)),u=this.findDEMTileFor(l);if(!u||!u.dem)return t;var c=u.dem,h=1<<u.tileID.canonical.z,f=(s*h-u.tileID.canonical.x)*c.dim,d=(e.y*h-u.tileID.canonical.y)*c.dim,p=Math.floor(f),m=Math.floor(d);return(i?this.exaggeration():1)*Di(Di(c.get(p,m),c.get(p,m+1),d-m),Di(c.get(p+1,m),c.get(p+1,m+1),d-m),f-p)}},{key:"getAtTileOffset",value:function(e,t,i){var r=1<<e.canonical.z;return this.getAtPointOrZero(new ru(e.wrap+(e.canonical.x+t/gs)/r,(e.canonical.y+i/gs)/r))}},{key:"getAtTileOffsetFunc",value:function(e,t,i,r){var n=this;return function(a){var o=n.getAtTileOffset(e,a.x,a.y),s=r.upVector(e.canonical,a.x,a.y);return Zs(s,s,o*r.upVectorScale(e.canonical,t,i).metersToTile),s}}},{key:"getForTilePoints",value:function(e,t,i,r){var n=this;if(this.isUsingMockSource())return!1;var a=Qp.create(this,e,r);return!!a&&(t.forEach(function(e){e[2]=n.exaggeration()*a.getElevationAt(e[0],e[1],i)}),!0)}},{key:"getMinMaxForTile",value:function(e){if(this.isUsingMockSource())return null;var t=this.findDEMTileFor(e);if(!t||!t.dem)return null;for(var i=t.dem.tree,r=t.tileID,n=1<<e.canonical.z-r.canonical.z,a=e.canonical.x/n-r.canonical.x,o=e.canonical.y/n-r.canonical.y,s=0,l=0;l<e.canonical.z-r.canonical.z&&!i.leaves[s];l++){a*=2,o*=2;var u=2*Math.floor(o)+Math.floor(a);s=i.childOffsets[s]+u,a%=1,o%=1}return{min:this.exaggeration()*i.minimums[s],max:this.exaggeration()*i.maximums[s]}}},{key:"getMinElevationBelowMSL",value:function(){throw new Error("Pure virtual method called.")}},{key:"raycast",value:function(e,t,i){throw new Error("Pure virtual method called.")}},{key:"pointCoordinate",value:function(e){throw new Error("Pure virtual method called.")}},{key:"_source",value:function(){throw new Error("Pure virtual method called.")}},{key:"isUsingMockSource",value:function(){throw new Error("Pure virtual method called.")}},{key:"exaggeration",value:function(){throw new Error("Pure virtual method called.")}},{key:"findDEMTileFor",value:function(e){throw new Error("Pure virtual method called.")}},{key:"visibleDemTiles",get:function(){throw new Error("Getter must be implemented in subclass.")}}]),e}(),e.ErrorEvent=ct,e.EvaluationParameters=La,e.Event=ut,e.Evented=ht,e.FillExtrusionBucket=rh,e.Frustum=pl,e.FrustumCorners=dl,e.GLOBE_RADIUS=vl,e.GLOBE_SCALE_MATCH_LATITUDE=45,e.GLOBE_ZOOM_THRESHOLD_MAX=6,e.GLOBE_ZOOM_THRESHOLD_MIN=5,e.GlobeSharedBuffers=function(){function e(t){h(this,e),this._createGrid(t),this._createPoles(t)}return d(e,[{key:"destroy",value:function(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();var e,t=l(this._poleSegments);try{for(t.s();!(e=t.n()).done;){e.value.destroy()}}catch(s){t.e(s)}finally{t.f()}var i,r=l(this._gridSegments);try{for(r.s();!(i=r.n()).done;){var n=i.value;n.withSkirts.destroy(),n.withoutSkirts.destroy()}}catch(s){r.e(s)}finally{r.f()}if(this._wireframeIndexBuffer){this._wireframeIndexBuffer.destroy();var a,o=l(this._wireframeSegments);try{for(o.s();!(a=o.n()).done;){a.value.destroy()}}catch(s){o.e(s)}finally{o.f()}}}},{key:"_fillGridMeshWithLods",value:function(e,t){for(var i=new Qa,n=new vo,a=[],o=e+1+2,s=t[0]+1,l=t[0]+1+(1+t.length),u=function(e,t,i){var r=e===o-1?e-2:0===e?e:e-1;return[r+=i?24575:0,t]},c=0;c<o;++c)i.emplaceBack.apply(i,r(u(c,0,!0)));for(var h=0;h<s;++h)for(var f=0;f<o;++f)i.emplaceBack.apply(i,r(u(f,h,(0===f||f===o-1)&&!0)));for(var d=0;d<t.length;++d)for(var p=t[d],m=0;m<o;++m)i.emplaceBack.apply(i,r(u(m,p,!0)));for(var v=0;v<t.length;++v){for(var y=n.length,_=t[v]+1+2,g=new vo,x=0;x<_-1;x++)for(var b=x===_-2,w=b?o*(l-t.length+v-x):o,k=0;k<o-1;k++){var T=x*o+k;0===x||b||0===k||k===o-2?(g.emplaceBack(T+1,T,T+w),g.emplaceBack(T+w,T+w+1,T+1)):(n.emplaceBack(T+1,T,T+w),n.emplaceBack(T+w,T+w+1,T+1))}for(var E=_s.simpleSegment(0,y,i.length,n.length-y),M=0;M<g.uint16.length;M+=3)n.emplaceBack(g.uint16[M],g.uint16[M+1],g.uint16[M+2]);var S=_s.simpleSegment(0,y,i.length,n.length-y);a.push({withoutSkirts:E,withSkirts:S})}return{vertices:i,indices:n,segments:a}}},{key:"_createGrid",value:function(e){var t=this._fillGridMeshWithLods(64,yl);this._gridSegments=t.segments,this._gridBuffer=e.createVertexBuffer(t.vertices,hl.members),this._gridIndexBuffer=e.createIndexBuffer(t.indices,!0)}},{key:"_createPoles",value:function(e){for(var t=new vo,i=0;i<=64;i++)t.emplaceBack(0,i+1,i+2);this._poleIndexBuffer=e.createIndexBuffer(t,!0);var r=new xo,n=new xo;this._poleSegments=[];for(var o=0,s=0;o<5;o++){var l=360/(1<<o);r.emplaceBack(0,-vl,0,.5,0),n.emplaceBack(0,-vl,0,.5,1);for(var u=0;u<=64;u++){var c=u/64,h=Di(0,l,c),f=a(zl(Gl,Zl,h,vl),3),d=f[0],p=f[1],m=f[2];r.emplaceBack(d,p,m,c,0),n.emplaceBack(d,p,m,c,1)}this._poleSegments.push(_s.simpleSegment(s,0,66,64)),s+=66}this._poleNorthVertexBuffer=e.createVertexBuffer(r,ul,!1),this._poleSouthVertexBuffer=e.createVertexBuffer(n,ul,!1)}},{key:"getGridBuffers",value:function(e,t){return[this._gridBuffer,this._gridIndexBuffer,t?this._gridSegments[e].withSkirts:this._gridSegments[e].withoutSkirts]}},{key:"getPoleBuffers",value:function(e){return[this._poleNorthVertexBuffer,this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[e]]}},{key:"getWirefameBuffers",value:function(e,t){if(!this._wireframeSegments){var i=new wo;this._wireframeSegments=[];for(var r=0,n=0;r<yl.length;r++){for(var a=yl[r],o=1;o<a+1;o++)for(var s=1;
1s<65;s++){var l=67*o+s;i.emplaceBack(l,l+1),i.emplaceBack(l,l+67),i.emplaceBack(l,l+67+1)}var u=64*a*3;this._wireframeSegments.push(_s.simpleSegment(0,n,67*(a+1),u)),n+=u}this._wireframeIndexBuffer=e.createIndexBuffer(i)}return[this._gridBuffer,this._wireframeIndexBuffer,this._wireframeSegments[t]]}}]),e}(),e.GlyphManager=Yf,e.ImagePosition=xf,e.LivePerformanceUtils=$e,e.LngLat=Xl,e.LngLatBounds=xs,e.LocalGlyphMode=Hf,e.MAX_MERCATOR_LATITUDE=tu,e.MercatorCoordinate=ru,e.ONE_EM=24,e.OverscaledTileID=yh,e.PerformanceMarkers=Je,e.Properties=Wa,e.RGBAImage=Zu,e.Ray=fl,e.RequestManager=function(){function e(t,i,r){h(this,e),this._transformRequestFn=t,this._customAccessToken=i,this._silenceAuthErrors=!!r,this._createSkuToken()}return d(e,[{key:"_createSkuToken",value:function(){var e=function(){for(var e="",t=0;t<10;t++)e+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",I,e].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=e.token,this._skuTokenExpiresAt=e.tokenExpiresAt}},{key:"_isSkuTokenExpired",value:function(){return Date.now()>this._skuTokenExpiresAt}},{key:"transformRequest",value:function(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}},{key:"normalizeStyleURL",value:function(e,t){if(!Pe(e))return e;var i=Fe(e);return i.path="/styles/v1".concat(i.path),this._makeAPIURL(i,this._customAccessToken||t)}},{key:"normalizeGlyphsURL",value:function(e,t){if(!Pe(e))return e;var i=Fe(e);return i.path="/fonts/v1".concat(i.path),this._makeAPIURL(i,this._customAccessToken||t)}},{key:"normalizeSourceURL",value:function(e,t,i,r){if(!Pe(e))return e;var n=Fe(e);return n.path="/v4/".concat(n.authority,".json"),n.params.push("secure"),i&&n.params.push("language=".concat(i)),r&&n.params.push("worldview=".concat(r)),this._makeAPIURL(n,this._customAccessToken||t)}},{key:"normalizeSpriteURL",value:function(e,t,i,r){var n=Fe(e);return Pe(e)?(n.path="/styles/v1".concat(n.path,"/sprite").concat(t).concat(i),this._makeAPIURL(n,this._customAccessToken||r)):(n.path+="".concat(t).concat(i),Ue(n))}},{key:"normalizeTileURL",value:function(e,t,i){if(this._isSkuTokenExpired()&&this._createSkuToken(),e&&!Pe(e))return e;var r=Fe(e);r.path=r.path.replace(/(\.(png|jpg)\d*)(?=$)/,"".concat(t||i&&"raster"!==r.authority&&512===i?"@2x":"").concat(T.supported?".webp":"$1")),"raster"===r.authority?r.path="/".concat(k.RASTER_URL_PREFIX).concat(r.path):(r.path=r.path.replace(/^.+\/v4\//,"/"),r.path="/".concat(k.TILE_URL_VERSION).concat(r.path));var n=this._customAccessToken||function(e){var t,i=l(e);try{for(i.s();!(t=i.n()).done;){var r=t.value.match(/^access_token=(.*)$/);if(r)return r[1]}}catch(n){i.e(n)}finally{i.f()}return null}(r.params)||k.ACCESS_TOKEN;return k.REQUIRE_ACCESS_TOKEN&&n&&this._skuToken&&r.params.push("sku=".concat(this._skuToken)),this._makeAPIURL(r,n)}},{key:"canonicalizeTileURL",value:function(e,t){var i=Fe(e);if(!i.path.match(/^(\/v4\/|\/raster\/v1\/)/)||!i.path.match(/\.[\w]+$/))return e;var r="mapbox://";i.path.match(/^\/raster\/v1\//)?r+="raster/".concat(i.path.replace("/".concat(k.RASTER_URL_PREFIX,"/"),"")):r+="tiles/".concat(i.path.replace("/".concat(k.TILE_URL_VERSION,"/"),""));var n=i.params;return t&&(n=n.filter(function(e){return!e.match(/^access_token=/)})),n.length&&(r+="?".concat(n.join("&"))),r}},{key:"canonicalizeTileset",value:function(e,t){var i,r=!!t&&Pe(t),n=[],a=l(e.tiles||[]);try{for(a.s();!(i=a.n()).done;){var o=i.value;De(o)?n.push(this.canonicalizeTileURL(o,r)):n.push(o)}}catch(s){a.e(s)}finally{a.f()}return n}},{key:"_makeAPIURL",value:function(e,t){var i="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",r=Fe(k.API_URL);if(e.protocol=r.protocol,e.authority=r.authority,"http"===e.protocol){var n=e.params.indexOf("secure");n>=0&&e.params.splice(n,1)}if("/"!==r.path&&(e.path="".concat(r.path).concat(e.path)),!k.REQUIRE_ACCESS_TOKEN)return Ue(e);if(t=t||k.ACCESS_TOKEN,!this._silenceAuthErrors){if(!t)throw new Error("An API access token is required to use Mapbox GL. ".concat(i));if("s"===t[0])throw new Error("Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ".concat(i))}return e.params=e.params.filter(function(e){return-1===e.indexOf("access_token")}),e.params.push("access_token=".concat(t||"")),Ue(e)}}]),e}(),e.ResourceType=we,e.SegmentVector=_s,e.SourceCache=Yp,e.StencilMode=Wp,e.StructArrayLayout1ui2=ko,e.StructArrayLayout2f1f2i16=fo,e.StructArrayLayout2i4=Qa,e.StructArrayLayout2ui4=wo,e.StructArrayLayout3f12=mo,e.StructArrayLayout3ui6=vo,e.StructArrayLayout4i8=to,e.StructArrayLayout5f20=xo,e.Texture=op,e.Tile=Ap,e.Transitionable=Oa,e.Uniform1f=Yo,e.Uniform1i=function(e){p(i,e);var t=m(i);function i(e){var r;return h(this,i),(r=t.call(this,e)).current=0,r}return d(i,[{key:"set",value:function(e,t,i){this.fetchUniformLocation(e,t)&&this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}}]),i}
1(Ho),e.Uniform2f=function(e){p(i,e);var t=m(i);function i(e){var r;return h(this,i),(r=t.call(this,e)).current=[0,0],r}return d(i,[{key:"set",value:function(e,t,i){this.fetchUniformLocation(e,t)&&(i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1])))}}]),i}(Ho),e.Uniform3f=function(e){p(i,e);var t=m(i);function i(e){var r;return h(this,i),(r=t.call(this,e)).current=[0,0,0],r}return d(i,[{key:"set",value:function(e,t,i){this.fetchUniformLocation(e,t)&&(i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2])))}}]),i}(Ho),e.Uniform4f=Ko,e.UniformColor=Jo,e.UniformMatrix2f=function(e){p(i,e);var t=m(i);function i(e){var r;return h(this,i),(r=t.call(this,e)).current=es,r}return d(i,[{key:"set",value:function(e,t,i){if(this.fetchUniformLocation(e,t))for(var r=0;r<4;r++)if(i[r]!==this.current[r]){this.current=i,this.gl.uniformMatrix2fv(this.location,!1,i);break}}}]),i}(Ho),e.UniformMatrix3f=function(e){p(i,e);var t=m(i);function i(e){var r;return h(this,i),(r=t.call(this,e)).current=Qo,r}return d(i,[{key:"set",value:function(e,t,i){if(this.fetchUniformLocation(e,t))for(var r=0;r<9;r++)if(i[r]!==this.current[r]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}}]),i}(Ho),e.UniformMatrix4f=function(e){p(i,e);var t=m(i);function i(e){var r;return h(this,i),(r=t.call(this,e)).current=$o,r}return d(i,[{key:"set",value:function(e,t,i){if(this.fetchUniformLocation(e,t)){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(var r=1;r<16;r++)if(i[r]!==this.current[r]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}}}]),i}(Ho),e.UnwrappedTileID=vh,e.ValidationError=Zr,e.VectorTileFeature=Kc,e.VectorTileWorkerSource=function(e){p(i,e);var t=m(i);function i(e,r,n,a,o){var s;return h(this,i),(s=t.call(this)).actor=e,s.layerIndex=r,s.availableImages=n,s.loadVectorData=o||lm,s.loading={},s.loaded={},s.deduped=new sm(e.scheduler),s.isSpriteLoaded=a,s.scheduler=e.scheduler,s}return d(i,[{key:"loadTile",value:function(e,t){var i=this,r=e.uid,n=e&&e.request,a=n&&n.collectResourceTiming,o=this.loading[r]=new am(e);o.abort=this.loadVectorData(e,function(s,l){var u=!i.loading[r];if(delete i.loading[r],u||s||!l)return o.status="done",u||(i.loaded[r]=o),t(s);var c=l.rawData,h={};l.expires&&(h.expires=l.expires),l.cacheControl&&(h.cacheControl=l.cacheControl),o.vectorTile=l.vectorTile||new Yc(new Hh(c));var f=function(){o.parse(o.vectorTile,i.layerIndex,i.availableImages,i.actor,function(e,i){if(e||!i)return t(e);var r={};if(a){var o=at(n);o.length>0&&(r.resourceTiming=JSON.parse(JSON.stringify(o)))}t(null,W({rawTileData:c.slice(0)},i,h,r))})};i.isSpriteLoaded?f():i.once("isSpriteLoaded",function(){i.scheduler?i.scheduler.add(f,{type:"parseTile",isSymbolTile:e.isSymbolTile,zoom:e.tileZoom}
1):f()}),i.loaded=i.loaded||{},i.loaded[r]=o})}},{key:"reloadTile",value:function(e,t){var i=this,r=this.loaded,n=e.uid,a=this;if(r&&r[n]){var o=r[n];o.showCollisionBoxes=e.showCollisionBoxes,o.enableTerrain=!!e.enableTerrain,o.projection=e.projection,o.tileTransform=gd(e.tileID.canonical,e.projection);var s=function(e,r){var n=o.reloadCallback;n&&(delete o.reloadCallback,o.parse(o.vectorTile,a.layerIndex,i.availableImages,a.actor,n)),t(e,r)};"parsing"===o.status?o.reloadCallback=s:"done"===o.status&&(o.vectorTile?o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.actor,s):s())}}},{key:"abortTile",value:function(e,t){var i=e.uid,r=this.loading[i];r&&(r.abort&&r.abort(),delete this.loading[i]),t()}},{key:"removeTile",value:function(e,t){var i=this.loaded,r=e.uid;i&&i[r]&&delete i[r],t()}}]),i}(ht),e.WritingMode=wf,e.ZoomDependentExpression=Vr,e.add=Us,e.addDynamicAttributes=qd,e.adjoint=function(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],c=t[8];return e[0]=o*c-s*u,e[1]=n*u-r*c,e[2]=r*s-n*o,e[3]=s*l-a*c,e[4]=i*c-n*l,e[5]=n*a-i*s,e[6]=a*u-o*l,e[7]=r*l-i*u,e[8]=i*o-r*a,e},e.asyncAll=Z,e.bezier=U,e.bindAll=$,e.boundsAttributes=Ip,e.bufferConvexPolygon=function(e,t){for(var i=[],r=0;r<e.length;r++){var n=G(r-1,-1,e.length-1),a=G(r+1,-1,e.length-1),o=e[r],s=e[a],l=e[n].sub(o).unit(),u=s.sub(o).unit(),c=u.angleWithSep(l.x,l.y),h=l.add(u).unit().mult(-1*t/Math.sin(c/2));i.push(o.add(h))}return i},e.cacheEntryPossiblyAdded=function(e){++be>ye&&(e.getActor().send("enforceCacheSizeLimit",ve),be=0)},e.calculateGlobeLabelMatrix=function(e,t){var i=e.point,r=Fl(i.x,i.y,e.worldSize/e._pixelsPerMercatorPixel,0,0);return Ss(r,r,Ol(El(t)))},e.calculateGlobeMatrix=function(e){var t=e.point,i=t.x,r=t.y,n=e._center,a=n.lng,o=n.lat;return Fl(i,r,e.worldSize,a,o)},e.calculateGlobeMercatorMatrix=function(e){var t=e.pixelsPerMeter,i=t/Jl(1,e.center.lat),r=Es(new Float64Array(16));return Is(r,r,[e.point.x,e.point.y,0]),Cs(r,r,[i,i,t]),Float32Array.from(r)},e.circumferenceAtLatitude=Hl,e.clamp=j,e.clearTileCache=function(e){if(_e()){var t=x.caches.delete(me);e&&t.catch(e).then(function(){return e()})}},e.clipLine=Zf,e.clone=function(e){var t=new ws(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},e.clone$1=ie,e.collisionCircleLayout=Fh,e.config=k,e.conjugate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e},e.create=function(){var e=new ws(16);return ws!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},e.create$1=ks,e.createExpression=Fr,e.createLayout=Ja,e.createStyleLayer=function(e){return"custom"===e.type?new ip(e):new ap[e.type](e)},e.cross=Hs,e.degToRad=R,e.distance=function(e,t){return Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2])},e.div=function(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e[2]=t[2]/i[2],e},e.dot=Xs,e.earthRadius=ql,e.ease=V,e.easeCubicInOut=F,e.ecefToLatLng=function(e){var t=a(e,3),i=t[0],r=t[1],n=t[2],o=Math.hypot(i,r,n),s=Math.atan2(i,n),l=.5*Math.PI-Math.acos(-r/o);return new Xl(B(s),B(l))},e.emitValidationErrors=Pn,e.endsWith=Q,e.enforceCacheSizeLimit=function(e){ge(),de&&de.then(function(t){t.keys().then(function(i){for(var r=0;r<i.length-e;r++)t.delete(i[r])})})},e.evaluateSizeForFeature=jh,e.evaluateSizeForZoom=Nh,e.evaluateVariableOffset=ud,e.evented=Aa,e.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]},e.exactEquals$1=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]},e.exported=ot,e.exported$1=T,e.extend=W,e.extend$1=dt,e.fillExtrusionHeightLift=ch,e.filterObject=te,e.fromMat4=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e},e.fromQuat=function(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=i+i,s=r+r,l=n+n,u=i*o,c=r*o,h=r*s,f=n*o,d=n*s,p=n*l,m=a*o,v=a*s,y=a*l;return e[0]=1-h-p,e[1]=c+y,e[2]=f-v,e[3]=0,e[4]=c-y,e[5]=1-u-p,e[6]=d+m,e[7]=0,e[8]=f+v,e[9]=d-m,e[10]=1-u-h,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},e.fromRotation=function(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=i,e[2]=0,e[3]=-i,e[4]=r,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},e.fromScaling=Ps,e.furthestTileCorner=function(e){var t=Math.round((e+45+360)%360/90)%4;return O[t]},e.getAABBPointSquareDist=function(e,t,i){for(var r=0,n=0;n<2;++n){var a=i?i[n]:0;e[n]>a&&(r+=(e[n]-a)*(e[n]-a)),t[n]<a&&(r+=(a-t[n])*(a-t[n]))}return r},e.getAnchorAlignment=Df,e.getAnchorJustification=hd,e.getBounds=function(e){var t,i=1/0,r=1/0,n=-1/0,a=-1/0,o=l(e);try{for(o.s();!(t=o.n()).done;){var s=t.value;i=Math.min(i,s.x),r=Math.min(r,s.y),n=Math.max(n,s.x),a=Math.max(a,s.y)}}catch(u){o.e(u)}finally{o.f()}return{min:new z(i,r),max:new z(n,a)}},e.getColumn=fe,e.getGridMatrix=function(e,t,i,r){var n=t.getNorth(),a=t.getSouth(),o=t.getWest(),s=t.getEast(),l=1<<e.z,u=s-o,c=n-a,h=u/64,f=-c/yl[i],d=[0,h,0,f,0,0,n,o,0];if(e.z>0){var p=180/r;Ts(d,d,[p/u+1,0,0,0,p/c+1,0,-.5*p/h,.5*p/f,1])}return d[2]=l,d[5]=e.x,d[8]=e.y,d},e.getImage=function e(t,i){if(T.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),Ce>=k.MAX_PARALLEL_IMAGE_REQUESTS){var r={requestParameters:t,callback:i,cancelled:!1,cancel:function(){this.cancelled=!0}};return Ie.push(r),r}Ce++;var n=!1,a=function(){if(!n)for(n=!0,Ce--;Ie.length&&Ce<k.MAX_PARALLEL_IMAGE_REQUESTS;){var t=Ie.shift(),i=t.requestParameters,r=t.callback;t.cancelled||(t.cancel=e(i,r).cancel)}},o=Me(t,function(e,t,r,n){a(),e?i(e):t&&(x.createImageBitmap?function(e,t){var i=new x.Blob([new Uint8Array(e)],{type:"image/png"});x.createImageBitmap(i).then(function(e){t(null,e)}).catch(function(e){t(new Error("Could not load image because of ".concat(e.message,". Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.")))})}(t,function(e,t){return i(e,t,r,n)}):function(e,t){var i=new x.Image,r=x.URL;i.onload=function(){t(null,i),r.revokeObjectURL(i.src),i.onload=null,x.requestAnimationFrame(function(){i.src=Ae})},i.onerror=function(){return t(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))};var n=new x.Blob([new Uint8Array(e)],{type:"image/png"});i.src=e.byteLength?r.createObjectURL(n):Ae}(t,function(e,t){return i(e,t,r,n)}))});return{cancel:function(){o.cancel(),a()}}},e.getJSON=function(e,t){return Ee(W(e,{type:"json"}),t)},e.getLatitudinalLod=function(e){var t=tu-5;e=j(e,-t,t)/t*90;var i=Math.pow(Math.abs(Math.sin(R(e))),3);return Math.round(i*(yl.length-1))},e.getMapSessionAPI=Ye,e.getPerformanceMeasurement=at,e.getProjection=Vd,e.getRTLTextPluginStatus=za,e.getReferrer=Te,e.getTilePoint=function(e,t){var i=t.x,r=t.y,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return new z(((i-n)*e.scale-e.x)*gs,(r*e.scale-e.y)*gs)},e.getTileVec3=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Fs(((t.x-i)*e.scale-e.x)*gs,(t.y*e.scale-e.y)*gs,eu(t.z,t.y))},e.getVideo=function(e,t){var i=x.document.createElement("video");i.muted=!0,i.onloadstart=function(){t(null,i)};for(var r=0;r<e.length;r++){var n=x.document.createElement("source");Se(e[r])||(i.crossOrigin="Anonymous"),n.src=e[r],i.appendChild(n)}return{cancel:function(){}}},e.globeCenterToScreenPoint=function(e){var t=[0,0,0],i=Es(new Float64Array(16));return Ss(i,e.pixelMatrix,e.globeMatrix),Ys(t,t,i),new z(t[0],t[1])},e.globeDenormalizeECEF=Ol,e.globeECEFOrigin=function(e,t){var i=[0,0,0];return Ys(i,i,Bl(El(t.canonical))),Ys(i,i,e),i},e.globeMetersToEcef=bl,e.globeNormalizeECEF=Bl,e.globePixelsToTileUnits=function(e,t){return gs/(512*Math.pow(2,e))*Ll(El(t))},e.globePoleMatrixForTile=function(e,t,i){var r=Es(new Float64Array(16)),n=(t/(1<<e)-.5)*Math.PI*2;return zs(r,i.globeMatrix,n),Float32Array.from(r)},e.globeTileBounds=El,e.globeTiltAtLngLat=Vl,e.globeToMercatorTransition=Ul,e.globeUseCustomAntiAliasing=function(e,t,i){var r=Ul(i.zoom),n=e.style.map._antialias,a=!!t.extStandardDerivatives,o=t.extStandardDerivativesForceOff||e.terrain&&e.terrain.exaggeration()>0;return 0===r&&!n&&!o&&a},e.identity=Es,e.identity$1=al,e.invert=Ms,e.isFullscreen=function(){return!!x.document.fullscreenElement||!!x.document.webkitFullscreenElement},e.isLngLatBehindGlobe=jl,e.isMapAuthenticated=function(e){return Ke.has(e)},e.isMapboxURL=Pe,e.isSafariWithAntialiasingBug=function(e){var t=e.navigator?e.navigator.userAgent:null;return!!ce(e)&&t&&(t.match("Version/15.4")||t.match("Version/15.5")||t.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))},e.latFromMercatorY=Ql,e.latLngToECEF=Pl,e.len=el,e.length=Os,e.length$1=function(e){return Math.hypot(e[0],e[1],e[2],e[3])},e.lngFromMercatorX=$l,e.loadVectorTile=lm,e.makeRequest=Ee,e.mapValue=function(e,t,i,r,n){return j((e-t)/(i-t)*(n-r)+r,r,n)},e.mercatorScale=iu,e.mercatorXfromLng=Yl,e.mercatorYfromLat=Kl,e.mercatorZfromAltitude=Jl,e.mul=Ls,e.mul$1=Qs,e.multiply=Ss,e.multiply$1=Ts,e.multiply$2=js,e.nextPowerOfTwo=K,e.normalize=Ws,e.normalize$1=ll,e.normalize$2
1=il,e.number=Di,e.ortho=function(e,t,i,r,n,a,o){var s=1/(t-i),l=1/(r-n),u=1/(a-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(t+i)*s,e[13]=(n+r)*l,e[14]=(o+a)*u,e[15]=1,e},e.pbf=Hh,e.perspective=function(e,t,i,r,n){var a,o=1/Math.tan(t/2);return e[0]=o/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=n&&n!==1/0?(e[10]=(n+r)*(a=1/(r-n)),e[14]=2*n*r*a):(e[10]=-1,e[14]=-2*r),e},e.pick=function(e,t){for(var i={},r=0;r<t.length;r++){var n=t[r];n in e&&(i[n]=e[n])}return i},e.plugin=Da,e.pointGeometry=z,e.polesInViewport=function(e){var t=Es(new Float64Array(16));Ss(t,e.pixelMatrix,e.globeMatrix);var i=[0,_l,0],r=[0,gl,0];return Ys(i,i,t),Ys(r,r,t),[i[0]>0&&i[0]<=e.width&&i[1]>0&&i[1]<=e.height&&!jl(e,new Xl(e.center.lat,90)),r[0]>0&&r[0]<=e.width&&r[1]>0&&r[1]<=e.height&&!jl(e,new Xl(e.center.lat,-90))]},e.polygonContainsPoint=Eu,e.polygonIntersectsBox=Mu,e.polygonIntersectsPolygon=vu,e.polygonizeBounds=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],n=new z(i,i),a=e.sub(n),o=t.add(n),s=[a,new z(o.x,a.y),o,new z(a.x,o.y)];return r&&s.push(a.clone()),s},e.posAttributes=hl,e.postMapLoadEvent=qe,e.postPerformanceEvent=Xe,e.postTurnstileEvent=Ge,e.potpack=gf,e.prevPowerOfTwo=function(e){return e<=1?1:Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},e.radToDeg=B,e.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],e.registerForPluginStateChange=function(e){return e({pluginStatus:Ma,pluginURL:Sa}),Aa.on("pluginStateChange",e),e},e.removeAuthState=function(e){Ke.delete(e)},e.renderColorRamp=Wu,e.resample=au,e.rotateX=As,e.rotateX$1=ol,e.rotateY=zs,e.rotateY$1=sl,e.rotateZ=function(e,t,i){var r=Math.sin(i),n=Math.cos(i),a=t[0],o=t[1],s=t[2],l=t[3],u=t[4],c=t[5],h=t[6],f=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*n+u*r,e[1]=o*n+c*r,e[2]=s*n+h*r,e[3]=l*n+f*r,e[4]=u*n-a*r,e[5]=c*n-o*r,e[6]=h*n-s*r,e[7]=f*n-l*r,e},e.rotateZ$1=function(e,t,i){i*=.5;var r=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(i),l=Math.cos(i);return e[0]=r*l+n*s,e[1]=n*l-r*s,e[2]=a*l+o*s,e[3]=o*l-a*s,e},e.scale=Cs,e.scale$1=tl,e.scale$2=Zs,e.scaleAndAdd=qs,e.set=function(e,t,i,r){return e[0]=t,e[1]=i,e[2]=r,e},e.setCacheLimits=function(e,t){ve=e,ye=t},e.setColumn=function(e,t,i){e[4*t+0]=i[0],e[4*t+1]=i[1],e[4*t+2]=i[2],e[4*t+3]=i[3]},e.setRTLTextPlugin=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(Ma===wa||Ma===ka||Ma===Ta)throw new Error("setRTLTextPlugin cannot be called multiple times.");Sa=ot.resolveURL(e),Ma=wa,Ea=t,Ca(),i||Pa()},e.smoothstep=N,e.spec=ft,e.squaredLength=function(e){var t=e[0],i=e[1],r=e[2];return t*t+i*i+r*r},e.storeAuthState=function(e,t){t?Ke.add(e):Ke.delete(e)},e.sub=$s,e.subtract=Vs,e.symbolSize=Gh,e.tileAABB=function(e,t,i,r,n,a,o,s,u){if("globe"===u.name)return function(e,t,i){var r=t/e.worldSize,n=e.globeMatrix;if(i.z<=1){var a=El(i).getCorners();return Il(a,n,r),ml.fromPoints(a)}var o=Cl(i),s=Al(o);Il(s,n,r);var u=Number.MAX_VALUE,c=[-u,-u,-u],h=[u,u,u];if(o.contains(e.center)){var f,d=l(s);try{for(d.s();!(f=d.n()).done;){var p=f.value;Ns(h,h,p),Gs(c,c,p)}}catch(F){d.e(F)}finally{d.f()}c[2]=0;var m=e.point,v=[m.x*r,m.y*r,0];return Ns(h,h,v),Gs(c,c,v),new ml(h,c)}var y=[n[12]*r,n[13]*r,n[14]*r],_=o.getCenter(),g=j(e.center.lat,-tu,tu),x=j(_.lat,-tu,tu),b=Yl(e.center.lng),w=Kl(g),k=b-Yl(_.lng),T=w-Kl(x);k>.5?k-=1:k<-.5&&(k+=1);var E=0;Math.abs(k)>Math.abs(T)?E=k>=0?1:3:(E=T>=0?0:2,qs(y,y,[n[4]*r,n[5]*r,n[6]*r],-Math.sin(R(T>=0?o.getSouth():o.getNorth()))*vl));var M=s[E],S=s[(E+1)%4],I=new kl(M,S,y),C=[Tl(I,0)||M[0],Tl(I,1)||M[1],Tl(I,2)||M[2]],A=Ul(e.zoom);if(A>0){for(var z=function(e,t,i,r,n){var a=e.x,o=e.y,s=1/(1<<e.z),l=a*s,u=l+s,c=o*s,h=c+s,f=0,d=(l+u)/2-r;return d>.5?f=-1:d<-.5&&(f=1),c=(c*t-(n*=t))*i+n,[[l=((l+f)*t-(r*=t))*i+r,h=(h*t-n)*i+n,0],[u=((u+f)*t-r)*i+r,h,0],[u,c,0],[l,c,0]]}(i,t,e._pixelsPerMercatorPixel,b,w),P=0;P<s.length;P++)Ml(s[P],z[P],A);var D=Us([],z[E],z[(E+1)%4]);Zs(D,D,.5),Ml(C,D,A)}var L,B=l(s);try{for(B.s();!(L=B.n()).done;){var O=L.value;Ns(h,h,O),Gs(c,c,O)}}catch(F){B.e(F)}finally{B.f()}return h[2]=Math.min(M[2],S[2]),Ns(h,h,C),Gs(c,c,C),new ml(h,c)}(e,t,new mh(i,r,n));var c=gd({z:i,x:r,y:n},u);return new ml([(a+c.x/c.scale)*t,t*(c.y/c.scale),o],[(a+c.x2/c.scale)*t,t*(c.y2/c.scale),s])}
1,e.tileCornersToBounds=Cl,e.tileTransform=gd,e.transformMat3=function(e,t,i){var r=t[0],n=t[1],a=t[2];return e[0]=r*i[0]+n*i[3]+a*i[6],e[1]=r*i[1]+n*i[4]+a*i[7],e[2]=r*i[2]+n*i[5]+a*i[8],e},e.transformMat4=Ys,e.transformMat4$1=rl,e.transformQuat=Ks,e.transitionTileAABBinECEF=Sl,e.translate=Is,e.transpose=function(e,t){if(e===t){var i=t[1],r=t[2],n=t[5];e[1]=t[3],e[2]=t[6],e[3]=i,e[5]=t[7],e[6]=r,e[7]=n}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e},e.triggerPluginCompletionEvent=Ia,e.uniqueId=H,e.updateGlobeVertexNormal=function(e,t,i,r,n){var a=5*t+2;e.float32[a+0]=i,e.float32[a+1]=r,e.float32[a+2]=n},e.validateCustomStyleLayer=function(e){var t=[],i=e.id;return void 0===i&&t.push({message:"layers.".concat(i,': missing required property "id"')}),void 0===e.render&&t.push({message:"layers.".concat(i,': missing required method "render"')}),e.renderingMode&&"2d"!==e.renderingMode&&"3d"!==e.renderingMode&&t.push({message:"layers.".concat(i,': property "renderingMode" must be either "2d" or "3d"')}),t},e.validateFilter=function(e){return zn(fn(e))},e.validateFog=function(e){return zn(Tn(e))},e.validateLayer=function(e){return zn(yn(e))},e.validateLight=function(e){return zn(wn(e))},e.validateSource=function(e){return zn(xn(e))},e.validateStyle=In,e.validateTerrain=function(e){return zn(kn(e))},e.values=q,e.vectorTile=Oc,e.version=b,e.warnOnce=ne,e.window=x,e.wrap=G}),x(0,function(e){function i(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e||null==e)return JSON.stringify(e);if(Array.isArray(e)){var t,r="[",n=l(e);try{for(n.s();!(t=n.n()).done;){var a=t.value;r+="".concat(i(a),",")}}catch(h){n.e(h)}finally{n.f()}return"".concat(r,"]")}var o,s="{",u=l(Object.keys(e).sort());try{for(u.s();!(o=u.n()).done;){var c=o.value;s+="".concat(c,":").concat(i(e[c]),",")}}catch(h){u.e(h)}finally{u.f()}return"".concat(s,"}")}function r(t){var r,n="",a=l(e.refProperties);try{for(a.s();!(r=a.n()).done;){var o=r.value;n+="/".concat(i(t[o]))}}catch(s){a.e(s)}finally{a.f()}return n}var n=function(){function t(e){h(this,t),this.keyCache={},e&&this.replace(e)}return d(t,[{key:"replace",value:function(e){this._layerConfigs={},this._layers={},this.update(e,[])}},{key:"update",value:function(t,i){var n,a=this,o=l(t);try{for(o.s();!(n=o.n()).done;){var s=n.value;this._layerConfigs[s.id]=s,(this._layers[s.id]=e.createStyleLayer(s)).compileFilter(),this.keyCache[s.id]&&delete this.keyCache[s.id]}}catch(x){o.e(x)}finally{o.f()}var u,c=l(i);try{for(c.s();!(u=c.n()).done;){var h=u.value;delete this.keyCache[h],delete this._layerConfigs[h],delete this._layers[h]}}catch(x){c.e(x)}finally{c.f()}this.familiesBySource={};var f,d=l(function(e,t){for(var i={},n=0;n<e.length;n++){var a=t&&t[e[n].id]||r(e[n]);t&&(t[e[n].id]=a);var o=i[a];o||(o=i[a]=[]),o.push(e[n])}var s=[];for(var l in i)s.push(i[l]);return s}(e.values(this._layerConfigs),this.keyCache));try{for(d.s();!(f=d.n()).done;){var p=f.value.map(function(e){return a._layers[e.id]}),m=p[0];if("none"!==m.visibility){var v=m.source||"",y=this.familiesBySource[v];y||(y=this.familiesBySource[v]={});var _=m.sourceLayer||"_geojsonTileLayer",g=y[_];g||(g=y[_]=[]),g.push(p)}}}catch(x){d.e(x)}finally{d.f()}}}]),t}(),o=function(){function t(){h(this,t)}return d(t,[{key:"loadTile",value:function(t,i){var r=t.uid,n=t.encoding,a=t.rawImageData,o=t.padding,s=t.buildQuadTree,l=e.window.ImageBitmap&&a instanceof e.
1window.ImageBitmap?this.getImageData(a,o):a;i(null,new e.DEMData(r,l,n,o<1,s))}},{key:"getImageData",value:function(e,t){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);var i=this.offscreenCanvasContext.getImageData(-t,-t,e.width+2*t,e.height+2*t);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),i}}]),t}(),s=function e(t,i){var r,n=t&&t.type;if("FeatureCollection"===n)for(r=0;r<t.features.length;r++)e(t.features[r],i);else if("GeometryCollection"===n)for(r=0;r<t.geometries.length;r++)e(t.geometries[r],i);else if("Feature"===n)e(t.geometry,i);else if("Polygon"===n)u(t.coordinates,i);else if("MultiPolygon"===n)for(r=0;r<t.coordinates.length;r++)u(t.coordinates[r],i);return t};function u(e,t){if(0!==e.length){c(e[0],t);for(var i=1;i<e.length;i++)c(e[i],!t)}}function c(e,t){for(var i=0,r=0,n=0,a=e.length,o=a-1;n<a;o=n++){var s=(e[n][0]-e[o][0])*(e[o][1]+e[n][1]),l=i+s;r+=Math.abs(i)>=Math.abs(s)?i-l+s:s-l+i,i=l}i+r>=0!=!!t&&e.reverse()}var f=e.VectorTileFeature.prototype.toGeoJSON,v=function(){function t(i){h(this,t),this._feature=i,this.extent=e.EXTENT,this.type=i.type,this.properties=i.tags,"id"in i&&!isNaN(i.id)&&(this.id=parseInt(i.id,10))}return d(t,[{key:"loadGeometry",value:function(){if(1===this._feature.type){var t,i=[],r=l(this._feature.geometry);try{for(r.s();!(t=r.n()).done;){var n=t.value;i.push([new e.pointGeometry(n[0],n[1])])}}catch(p){r.e(p)}finally{r.f()}return i}var a,o=[],s=l(this._feature.geometry);try{for(s.s();!(a=s.n()).done;){var u,c=a.value,h=[],f=l(c);try{for(f.s();!(u=f.n()).done;){var d=u.value;h.push(new e.pointGeometry(d[0],d[1]))}}catch(p){f.e(p)}finally{f.f()}o.push(h)}}catch(p){s.e(p)}finally{s.f()}return o}},{key:"toGeoJSON",value:function(e,t,i){return f.call(this,e,t,i)}}]),t}(),y=function(){function t(i){h(this,t),this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=e.EXTENT,this.length=i.length,this._features=i}return d(t,[{key:"feature",value:function(e){return new v(this._features[e])}}]),t}(),_={},g={get exports(){return _},set exports(e){_=e}},x=e.pointGeometry,b=e.vectorTile.VectorTileFeature,k=T;function T(e,t){this.options=t||{},this.features=e,this.length=e.length}function E(e,t){this.id="number"==typeof e.id?e.id:void 0,this.type=e.type,this.rawGeometry=1===e.type?[e.geometry]:e.geometry,this.properties=e.tags,this.extent=t||4096}T.prototype.feature=function(e){return new E(this.features[e],this.options.extent)},E.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var t=0;t<e.length;t++){for(var i=e[t],r=[],n=0;n<i.length;n++)r.push(new x(i[n][0],i[n][1]));this.geometry.push(r)}return this.geometry},E.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var e=this.geometry,t=1/0,i=-1/0,r=1/0,n=-1/0,a=0;a<e.length;a++)for(var o=e[a],s=0;s<o.length;s++){var l=o[s];t=Math.min(t,l.x),i=Math.max(i,l.x),r=Math.min(r,l.y),n=Math.max(n,l.y)}return[t,r,i,n]},E.prototype.toGeoJSON=b.prototype.toGeoJSON;var M=e.pbf,S=k;function I(e){var t=new M;return function(e,t){for(var i in e.layers)t.writeMessage(3,C,e.layers[i])}(e,t),t.finish()}function C(e,t){var i;t.writeVarintField(15,e.version||1),t.writeStringField(1,e.name||""),t.writeVarintField(5,e.extent||4096);var r={keys:[],values:[],keycache:{},valuecache:{}};for(i=0;i<e.length;i++)r.feature=e.feature(i),t.writeMessage(2,A,r);var n=r.keys;for(i=0;i<n.length;i++)t.writeStringField(3,n[i]);var a=r.values;for(i=0;i<a.length;i++)t.writeMessage(4,R,a[i])}function A(e,t){var i=e.feature;void 0!==i.id&&t.writeVarintField(1,i.id),t.writeMessage(2,z,e),t.writeVarintField(3,i.type),t.writeMessage(4,L,i)}function z(e,t){var i=e.feature,r=e.keys,n=e.values,a=e.keycache,o=e.valuecache;for(var s in i.properties){var l=i.properties[s],u=a[s];if(null!==l){void 0===u&&(r.push(s),a[s]=u=r.length-1),t.writeVarint(u);var c=typeof l;"string"!==c&&"boolean"!==c&&"number"!==c&&(l=JSON.stringify(l));var h=c+":"+l,f=o[h];void 0===f&&(n.push(l),o[h]=f=n.length-1),t.writeVarint(f)}}}function P(e,t){return(t<<3)+(7&e)}function D(e){return e<<1^e>>31}function L(e,t){for(var i=e.loadGeometry(),r=e.type,n=0,a=0,o=i.length,s=0;s<o;s++){var l=i[s],u=1;1===r&&(u=l.length),t.writeVarint(P(1,u));for(var c=3===r?l.length-1:l.length,h=0;h<c;h++){1===h&&1!==r&&t.writeVarint(P(2,c-1));var f=l[h].x-n,d=l[h].y-a;t.writeVarint(D(f)),t.writeVarint(D(d)),n+=f,a+=d}3===r&&t.writeVarint(P(7,1))}}function R(e,t){var i=typeof e;"string"===i?t.writeStringField(1,e):"boolean"===i?t.writeBooleanField(7,e):"number"===i&&(e%1!=0?t.writeDoubleField(3,e):e<0?t.writeSVarintField(6,e):t.writeVarintField(5,e))}function B(e,t,i,r,n,a){if(!(n-r<=i)){var o=r+n>>1;O(e,t,o,r,n,a%2),B(e,t,i,r,o-1,a+1),B(e,t,i,o+1,n,a+1)}}function O(e,t,i,r,n,a){for(;n>r;){if(n-r>600){var o=n-r+1,s=i-r+1,l=Math.log(o),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(o-u)/o)*(s-o/2<0?-1:1);O(e,t,i,Math.max(r,Math.floor(i-s*u/o+c)),Math.min(n,Math.floor(i+(o-s)*u/o+c)),a)}var h=t[2*i+a],f=r,d=n;for(F(e,t,r,i),t[2*n+a]>h&&F(e,t,r,n);f<d;){for(F(e,t,f,d),f++,d--;t[2*f+a]<h;)f++;for(;t[2*d+a]>h;)d--}t[2*r+a]===h?F(e,t,r,d):F(e,t,++d,n),d<=i&&(r=d+1),i<=d&&(n=d-1)}}function F(e,t,i,r){U(e,i,r),U(t,2*i,2*r),U(t,2*i+1,2*r+1)}function U(e,t,i){var r=e[t];e[t]=e[i],e[i]=r}function V(e,t,i,r){var n=e-i,a=t-r;return n*n+a*a}g.exports=I,_.fromVectorTileJs=I,_.fromGeojsonVt=function(e,t){t=t||{};var i={};for(var r in e)i[r]=new S(e[r].features,t),i[r].name=r,i[r].version=t.version,i[r].extent=t.extent;return I({layers:i})},_.GeoJSONWrapper=S;var j,N=function(e){return e[0]},G=function(e){return e[1]},Z=function(){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:N,r=arguments.length>
12&&void 0!==arguments[2]?arguments[2]:G,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:64,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Float64Array;h(this,e),this.nodeSize=n,this.points=t;for(var o=t.length<65536?Uint16Array:Uint32Array,s=this.ids=new o(t.length),l=this.coords=new a(2*t.length),u=0;u<t.length;u++)s[u]=u,l[2*u]=i(t[u]),l[2*u+1]=r(t[u]);B(s,l,n,0,s.length-1,0)}return d(e,[{key:"range",value:function(e,t,i,r){return function(e,t,i,r,n,a,o){for(var s,l,u=[0,e.length-1,0],c=[];u.length;){var h=u.pop(),f=u.pop(),d=u.pop();if(f-d<=o)for(var p=d;p<=f;p++)s=t[2*p],l=t[2*p+1],s>=i&&s<=n&&l>=r&&l<=a&&c.push(e[p]);else{var m=Math.floor((d+f)/2);s=t[2*m],l=t[2*m+1],s>=i&&s<=n&&l>=r&&l<=a&&c.push(e[m]);var v=(h+1)%2;(0===h?i<=s:r<=l)&&(u.push(d),u.push(m-1),u.push(v)),(0===h?n>=s:a>=l)&&(u.push(m+1),u.push(f),u.push(v))}}return c}(this.ids,this.coords,e,t,i,r,this.nodeSize)}},{key:"within",value:function(e,t,i){return function(e,t,i,r,n,a){for(var o=[0,e.length-1,0],s=[],l=n*n;o.length;){var u=o.pop(),c=o.pop(),h=o.pop();if(c-h<=a)for(var f=h;f<=c;f++)V(t[2*f],t[2*f+1],i,r)<=l&&s.push(e[f]);else{var d=Math.floor((h+c)/2),p=t[2*d],m=t[2*d+1];V(p,m,i,r)<=l&&s.push(e[d]);var v=(u+1)%2;(0===u?i-n<=p:r-n<=m)&&(o.push(h),o.push(d-1),o.push(v)),(0===u?i+n>=p:r+n>=m)&&(o.push(d+1),o.push(c),o.push(v))}}return s}(this.ids,this.coords,e,t,i,this.nodeSize)}}]),e}(),q={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:function(e){return e}},W=Math.fround||(j=new Float32Array(1),function(e){return j[0]=+e,j[0]}),X=function(){function e(t){h(this,e),this.options=te(Object.create(q),t),this.trees=new Array(this.options.maxZoom+1)}return d(e,[{key:"load",value:function(e){var t=this.options,i=t.log,r=t.minZoom,n=t.maxZoom,a=t.nodeSize;i&&console.time("total time");var o="prepare ".concat(e.length," points");i&&console.time(o),this.points=e;for(var s=[],l=0;l<e.length;l++)e[l].geometry&&s.push(Y(e[l],l));this.trees[n+1]=new Z(s,ie,re,a,Float32Array),i&&console.timeEnd(o);for(var u=n;u>=r;u--){var c=+Date.now();s=this._cluster(s,u),this.trees[u]=new Z(s,ie,re,a,Float32Array),i&&console.log("z%d: %d clusters in %dms",u,s.length,+Date.now()-c)}return i&&console.timeEnd("total time"),this}},{key:"getClusters",value:function(e,t){var i=((e[0]+180)%360+360)%360-180,r=Math.max(-90,Math.min(90,e[1])),n=180===e[2]?180:((e[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)i=-180,n=180;else if(i>n){var o=this.getClusters([i,r,180,a],t),s=this.getClusters([-180,r,n,a],t);return o.concat(s)}var u,c=this.trees[this._limitZoom(t)],h=[],f=l(c.range($(i),Q(a),$(n),Q(r)));try{for(f.s();!(u=f.n()).done;){var d=u.value,p=c.points[d];h.push(p.numPoints?K(p):this.points[p.index])}}catch(m){f.e(m)}finally{f.f()}return h}},{key:"getChildren",value:function(e){var t=this._getOriginId(e),i=this._getOriginZoom(e),r="No cluster with the specified id.",n=this.trees[i];if(!n)throw new Error(r);var a=n.points[t];if(!a)throw new Error(r);var o,s=this.options.radius/(this.options.extent*Math.pow(2,i-1)),u=[],c=l(n.within(a.x,a.y,s));try{for(c.s();!(o=c.n()).done;){var h=o.value,f=n.points[h];f.parentId===e&&u.push(f.numPoints?K(f):this.points[f.index])}}catch(d){c.e(d)}finally{c.f()}if(0===u.length)throw new Error(r);return u}},{key:"getLeaves",value:function(e,t,i){var r=[];return this._appendLeaves(r,e,t=t||10,i=i||0,0),r}},{key:"getTile",value:function(e,t,i){var r=this.trees[this._limitZoom(e)],n=Math.pow(2,e),a=this.options,o=a.extent,s=a.radius/o,l=(i-s)/n,u=(i+1+s)/n,c={features:[]};return this._addTileFeatures(r.range((t-s)/n,l,(t+1+s)/n,u),r.points,t,i,n,c),0===t&&this._addTileFeatures(r.range(1-s/n,l,1,u),r.points,n,i,n,c),t===n-1&&this._addTileFeatures(r.range(0,l,s/n,u),r.points,-1,i,n,c),c.features.length?c:null}},{key:"getClusterExpansionZoom",value:function(e){for(var t=this._getOriginZoom(e)-1;t<=this.options.maxZoom;){var i=this.getChildren(e);if(t++,1!==i.length)break;e=i[0].properties.cluster_id}return t}},{key:"_appendLeaves",value:function(e,t,i,r,n){var a,o=l(this.getChildren(t));try{for(o.s();!(a=o.n()).done;){var s=a.value,u=s.properties;if(u&&u.cluster?n+u.point_count<=r?n+=u.point_count:n=this._appendLeaves(e,u.cluster_id,i,r,n):n<r?n++:e.push(s),e.length===i)break}}catch(c){o.e(c)}finally{o.f()}return n}},{key:"_addTileFeatures",value:function(e,t,i,r,n,a){var o,s=l(e);try{for(s.s();!(o=s.n()).done;){var u=t[o.value],c=u.numPoints,h=void 0,f=void 0,d=void 0;if(c)h=J(u),f=u.x,d=u.y;else{var p=this.points[u.index];h=p.properties,f=$(p.geometry.coordinates[0]),d=Q(p.geometry.coordinates[1])}var m={type:1,geometry:[[Math.round(this.options.extent*(f*n-i)),Math.round(this.options.extent*(d*n-r))]],tags:h},v=void 0;c?v=u.id:this.options.generateId?v=u.index:this.points[u.index].id&&(v=this.points[u.index].id),void 0!==v&&(m.id=v),a.features.push(m)}}catch(y){s.e(y)}finally{s.f()}}},{key:"_limitZoom",value:function(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}},{key:"_cluster",value:function(e,t){for(var i=[],r=this.options,n=r.radius,a=r.extent,o=r.reduce,s=r.minPoints,u=n/(a*Math.pow(2,t)),c=0;c<e.length;c++){var h=e[c];if(!(h.zoom<=t)){h.zoom=t;var f,d=this.trees[t+1],p=d.within(h.x,h.y,u),m=h.numPoints||1,v=m,y=l(p);try{for(y.s();!(f=y.n()).done;){var _=f.value,g=d.points[_];g.zoom>t&&(v+=g.numPoints||1)}}catch(D){y.e(D)}finally{y.f()}if(v>m&&v>=s){var x,b=h.x*m,w=h.y*m,k=o&&m>1?this._map(h,!0):null,T=(c<<5)+(t+1)+this.points.length,E=l(p);try{for(E.s();!(x=E.n()).done;){var M=x.value,S=d.points[M];if(!(S.zoom<=t)){S.zoom=t;var I=S.numPoints||1;b+=S.x*I,w+=S.y*I,S.parentId=T,o&&(k||(k=this._map(h,!0)),o(k,this._map(S)))}}}catch(D){E.e(D)}finally{E.f()}h.parentId=T,i.push(H(b/v,w/v,T,v,k))}else if(i.push(h),v>1){var C,A=l(p);try{for(A.s();!(C=A.n()).done;){var z=C.value,P=d.points[z];P.zoom<=t||(P.zoom=t,i.push(P))}}catch(D){A.e(D)}finally{A.f()}}}}return i}},{key:"_getOriginId",value:function(e){return e-this.points.length>>5}},{key:"_getOriginZoom",value:function(e){return(e-this.points.length)%32}},{key:"_map",value:function(e,t){if(e.numPoints)return t?te({},e.properties):e.properties;var i=this.points[e.index].properties,r=this.options.map(i);return t&&r===i?te({},r):r}}]),e}();function H(e,t,i,r,n){return{x:W(e),y:W(t),zoom:1/0,id:i,parentId:-1,numPoints:r,properties:n}}function Y(e,t){var i=a(e.geometry.coordinates,2),r=i[0],n=i[1];return{x:W($(r)),y:W(Q(n)),zoom:1/0,index:t,parentId:-1}}function K(e){return{type:"Feature",id:e.id,properties:J(e),geometry:{type:"Point",coordinates:[(t=e.x,360*(t-.5)),ee(e.y)]}};var t}function J(e){var t=e.numPoints,i=t>=1e4?"".concat(Math.round(t/1e3),"k"):t>=1e3?Math.round(t/100)/10+"k":t;return te(te({},e.properties),{cluster:!0,cluster_id:e.id,point_count:t,point_count_abbreviated:i})}function $(e){return e/360+.5}function Q(e){var t=Math.sin(e*Math.PI/180),i=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:i>1?1:i}function ee(e){var t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function te(e,t){for(var i in t)e[i]=t[i];return e}function ie(e){return e.x}function re(e){return e.y}function ne(e,t,i,r){for(var n,a=r,o=i-t>>
vendor: 9,987 bytes, line 1
11,s=i-t,l=e[t],u=e[t+1],c=e[i],h=e[i+1],f=t+3;f<i;f+=3){var d=ae(e[f],e[f+1],l,u,c,h);if(d>a)n=f,a=d;else if(d===a){var p=Math.abs(f-o);p<s&&(n=f,s=p)}}a>r&&(n-t>3&&ne(e,t,n,r),e[n+2]=a,i-n>3&&ne(e,n,i,r))}function ae(e,t,i,r,n,a){var o=n-i,s=a-r;if(0!==o||0!==s){var l=((e-i)*o+(t-r)*s)/(o*o+s*s);l>1?(i=n,r=a):l>0&&(i+=o*l,r+=s*l)}return(o=e-i)*o+(s=t-r)*s}function oe(e,t,i,r){var n={id:void 0===e?null:e,type:t,geometry:i,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(e){var t=e.geometry,i=e.type;if("Point"===i||"MultiPoint"===i||"LineString"===i)se(e,t);else if("Polygon"===i||"MultiLineString"===i)for(var r=0;r<t.length;r++)se(e,t[r]);else if("MultiPolygon"===i)for(r=0;r<t.length;r++)for(var n=0;n<t[r].length;n++)se(e,t[r][n])}(n),n}function se(e,t){for(var i=0;i<t.length;i+=3)e.minX=Math.min(e.minX,t[i]),e.minY=Math.min(e.minY,t[i+1]),e.maxX=Math.max(e.maxX,t[i]),e.maxY=Math.max(e.maxY,t[i+1])}function le(e,t,i,r){if(t.geometry){var n=t.geometry.coordinates,a=t.geometry.type,o=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2),s=[],l=t.id;if(i.promoteId?l=t.properties[i.promoteId]:i.generateId&&(l=r||0),"Point"===a)ue(n,s);else if("MultiPoint"===a)for(var u=0;u<n.length;u++)ue(n[u],s);else if("LineString"===a)ce(n,s,o,!1);else if("MultiLineString"===a){if(i.lineMetrics){for(u=0;u<n.length;u++)ce(n[u],s=[],o,!1),e.push(oe(l,"LineString",s,t.properties));return}he(n,s,o,!1)}else if("Polygon"===a)he(n,s,o,!0);else{if("MultiPolygon"!==a){if("GeometryCollection"===a){for(u=0;u<t.geometry.geometries.length;u++)le(e,{id:l,geometry:t.geometry.geometries[u],properties:t.properties},i,r);return}throw new Error("Input data is not a valid GeoJSON object.")}for(u=0;u<n.length;u++){var c=[];he(n[u],c,o,!0),s.push(c)}}e.push(oe(l,a,s,t.properties))}}function ue(e,t){t.push(fe(e[0])),t.push(de(e[1])),t.push(0)}function ce(e,t,i,r){for(var n,a,o=0,s=0;s<e.length;s++){var l=fe(e[s][0]),u=de(e[s][1]);t.push(l),t.push(u),t.push(0),s>0&&(o+=r?(n*u-l*a)/2:Math.sqrt(Math.pow(l-n,2)+Math.pow(u-a,2))),n=l,a=u}var c=t.length-3;t[2]=1,ne(t,0,c,i),t[c+2]=1,t.size=Math.abs(o),t.start=0,t.end=t.size}function he(e,t,i,r){for(var n=0;n<e.length;n++){var a=[];ce(e[n],a,i,r),t.push(a)}}function fe(e){return e/360+.5}function de(e){var t=Math.sin(e*Math.PI/180),i=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:i>1?1:i}function pe(e,t,i,r,n,a,o,s){if(r/=t,a>=(i/=t)&&o<r)return e;if(o<i||a>=r)return null;for(var l=[],u=0;u<e.length;u++){var c=e[u],h=c.geometry,f=c.type,d=0===n?c.minX:c.minY,p=0===n?c.maxX:c.maxY;if(d>=i&&p<r)l.push(c);else if(!(p<i||d>=r)){var m=[];if("Point"===f||"MultiPoint"===f)me(h,m,i,r,n);else if("LineString"===f)ve(h,m,i,r,n,!1,s.lineMetrics);else if("MultiLineString"===f)_e(h,m,i,r,n,!1);else if("Polygon"===f)_e(h,m,i,r,n,!0);else if("MultiPolygon"===f)for(var v=0;v<h.length;v++){var y=[];_e(h[v],y,i,r,n,!0),y.length&&m.push(y)}if(m.length){if(s.lineMetrics&&"LineString"===f){for(v=0;v<m.length;v++)l.push(oe(c.id,f,m[v],c.tags));continue}"LineString"!==f&&"MultiLineString"!==f||(1===m.length?(f="LineString",m=m[0]):f="MultiLineString"),"Point"!==f&&"MultiPoint"!==f||(f=3===m.length?"Point":"MultiPoint"),l.push(oe(c.id,f,m,c.tags))}}}return l.length?l:null}function me(e,t,i,r,n){for(var a=0;a<e.length;a+=3){var o=e[a+n];o>=i&&o<=r&&(t.push(e[a]),t.push(e[a+1]),t.push(e[a+2]))}}function ve(e,t,i,r,n,a,o){for(var s,l,u=ye(e),c=0===n?xe:be,h=e.start,f=0;f<e.length-3;f+=3){var d=e[f],p=e[f+1],m=e[f+2],v=e[f+3],y=e[f+4],_=0===n?d:p,g=0===n?v:y,x=!1;o&&(s=Math.sqrt(Math.pow(d-v,2)+Math.pow(p-y,2))),_<i?g>i&&(l=c(u,d,p,v,y,i),o&&(u.start=h+s*l)):_>r?g<r&&(l=c(u,d,p,v,y,r),o&&(u.start=h+s*l)):ge(u,d,p,m),g<i&&_>=i&&(l=c(u,d,p,v,y,i),x=!0),g>r&&_<=r&&(l=c(u,d,p,v,y,r),x=!0),!a&&x&&(o&&(u.end=h+s*l),t.push(u),u=ye(e)),o&&(h+=s)}var b=e.length-3;d=e[b],p=e[b+1],m=e[b+2],(_=0===n?d:p)>=i&&_<=r&&ge(u,d,p,m),b=u.length-3,a&&b>=3&&(u[b]!==u[0]||u[b+1]!==u[1])&&ge(u,u[0],u[1],u[2]),u.length&&t.push(u)}function ye(e){var t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function _e(e,t,i,r,n,a){for(var o=0;o<e.length;o++)ve(e[o],t,i,r,n,a,!1)}function ge(e,t,i,r){e.push(t),e.push(i),e.push(r)}function xe(e,t,i,r,n,a){var o=(a-t)/(r-t);return e.push(a),e.push(i+(n-i)*o),e.push(1),o}function be(e,t,i,r,n,a){var o=(a-i)/(n-i);return e.push(t+(r-t)*o),e.push(a),e.push(1),o}function we(e,t){for(var i=[],r=0;r<e.length;r++){var n,a=e[r],o=a.type;if("Point"===o||"MultiPoint"===o||"LineString"===o)n=ke(a.geometry,t);else if("MultiLineString"===o||"Polygon"===o){n=[];for(var s=0;s<a.geometry.length;s++)n.push(ke(a.geometry[s],t))}else if("MultiPolygon"===o)for(n=[],s=0;s<a.geometry.length;s++){for(var l=[],u=0;u<a.geometry[s].length;u++)l.push(ke(a.geometry[s][u],t));n.push(l)}i.push(oe(a.id,o,n,a.tags))}return i}function ke(e,t){var i=[];i.size=e.size,void 0!==e.start&&(i.start=e.start,i.end=e.end);for(var r=0;r<e.length;r+=3)i.push(e[r]+t,e[r+1],e[r+2]);return i}function Te(e,t){if(e.transformed)return e;var i,r,n,a=1<<e.z,o=e.x,s=e.y;for(i=0;i<e.features.length;i++){var l=e.features[i],u=l.geometry,c=l.type;if(l.geometry=[],1===c)for(r=0;r<u.length;r+=2)l.geometry.push(Ee(u[r],u[r+1],t,a,o,s));else for(r=0;r<u.length;r++){var h=[];for(n=0;n<u[r].length;n+=2)h.push(Ee(u[r][n],u[r][n+1],t,a,o,s));l.geometry.push(h)}}return e.transformed=!0,e}function Ee(e,t,i,r,n,a){return[Math.round(i*(e*r-n)),Math.round(i*(t*r-a))]}function Me(e,t,i,r,n){for(var a=t===n.maxZoom?0:n.tolerance/((1<<t)*n.extent),o={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:i,y:r,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},s=0;s<e.length;s++){o.numFeatures++,Se(o,e[s],a,n);var l=e[s].minX,u=e[s].minY,c=e[s].maxX,h=e[s].maxY;l<o.minX&&(o.minX=l),u<o.minY&&(o.minY=u),c>o.maxX&&(o.maxX=c),h>o.maxY&&(o.maxY=h)}return o}function Se(e,t,i,r){var n=t.geometry,a=t.type,o=[];if("Point"===a||"MultiPoint"===a)for(var s=0;s<n.length;s+=3)o.push(n[s]),o.push(n[s+1]),e.numPoints++,e.numSimplified++;else if("LineString"===a)Ie(o,n,e,i,!1,!1);else if("MultiLineString"===a||"Polygon"===a)for(s=0;s<n.length;s++)Ie(o,n[s],e,i,"Polygon"===a,0===s);else if("MultiPolygon"===a)for(var l=0;l<n.length;l++){var u=n[l];for(s=0;s<u.length;s++)Ie(o,u[s],e,i,!0,0===s)}if(o.length){var c=t.tags||null;if("LineString"===a&&r.lineMetrics){for(var h in c={},t.tags)c[h]=t.tags[h];c.mapbox_clip_start=n.start/n.size,c.mapbox_clip_end=n.end/n.size}var f={geometry:o,type:"Polygon"===a||"MultiPolygon"===a?3:"LineString"===a||"MultiLineString"===a?2:1,tags:c};null!==t.id&&(f.id=t.id),e.features.push(f)}}function Ie(e,t,i,r,n,a){var o=r*r;if(r>0&&t.size<(n?o:r))i.numPoints+=t.length/3;else{for(var s=[],l=0;l<t.length;l+=3)(0===r||t[l+2]>o)&&(i.numSimplified++,s.push(t[l]),s.push(t[l+1])),i.numPoints++;n&&function(e,t){for(var i=0,r=0,n=e.length,a=n-2;r<n;a=r,r+=2)i+=(e[r]-e[a])*(e[r+1]+e[a+1]);if(i>0===t)for(r=0,n=e.length;r<n/2;r+=2){var o=e[r],s=e[r+1];e[r]=e[n-2-r],e[r+1]=e[n-1-r],e[n-2-r]=o,e[n-1-r]=s}}(s,a),e.push(s)}}function Ce(e,t){var i=(t=this.options=function(e,t){for(var i in t)e[i]=t[i];return e}(Object.create(this.options),t)).debug;if(i&&console.time("preprocess data"),t.maxZoom<0||t.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");var r,n,a,o,s,l,u=function(e,t){var i=[];if("FeatureCollection"===e.type)for(var r=0;r<e.features.length;r++)le(i,e.features[r],t,r);else le(i,"Feature"===e.type?e:{geometry:e},t);return i}(e,t);this.tiles={},this.tileCoords=[],i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),o=r=u,s=pe(r,1,-1-(a=(n=t).buffer/n.extent),a,0,-1,2,n),l=pe(r,1,1-a,2+a,0,-1,2,n),(s||l)&&(o=pe(r,1,-a,1+a,0,-1,2,n)||[],s&&(o=we(s,1).concat(o)),l&&(o=o.concat(we(l,-1)))),(u=o).length&&this.splitTile(u,0,0,0),i&&(u.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)))}function Ae(e,t,i){return 32*((1<<e)*i+t)+e}function ze(e,t){var i=e.tileID.canonical;if(!this._geoJSONIndex)return t(null,null);var r=this._geoJSONIndex.getTile(i.z,i.x,i.y);if(!r)return t(null,null);var n=new y(r.features),a=_(n);0===a.byteOffset&&a.byteLength===a.buffer.byteLength||(a=new Uint8Array(a)),t(null,{vectorTile:n,rawData:a.buffer})}Ce.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},Ce.prototype.splitTile=function(e,t,i,r,n,a,o){for(var s=[e,t,i,r],l=this.options,u=l.debug;s.length;){r=s.pop(),i=s.pop(),t=s.pop(),e=s.pop();var c=1<<t,h=Ae(t,i,r),f=this.tiles[h];if(!f&&(u>1&&console.time("creation"),f=this.tiles[h]=Me(e,t,i,r,l),this.tileCoords.push({z:t,x:i,y:r}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,i,r,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));var d="z"+t;this.stats[d]=(this.stats[d]||0)+1,this.total++}if(f.source=e,n){if(t===l.maxZoom||t===n)continue;var p=1<<n-t;if(i!==Math.floor(a/p)||r!==Math.floor(o/p))continue}else if(t===l.indexMaxZoom||f.numPoints<=l.indexMaxPoints)continue;if(f.source=null,0!==e.length){u>1&&console.time("clipping");var m,v,y,_,g,x,b=.5*l.buffer/l.extent,w=.5-b,k=.5+b,T=1+b;m=v=y=_=null,g=pe(e,c,i-b,i+k,0,f.minX,f.maxX,l),x=pe(e,c,i+w,i+T,0,f.minX,f.maxX,l),e=null,g&&(m=pe(g,c,r-b,r+k,1,f.minY,f.maxY,l),v=pe(g,c,r+w,r+T,1,f.minY,f.maxY,l),g=null),x&&(y=pe(x,c,r-b,r+k,1,f.minY,f.maxY,l),_=pe(x,c,r+w,r+T,1,f.minY,f.maxY,l),x=null),u>1&&console.timeEnd("clipping"),s.push(m||[],t+1,2*i,2*r),s.push(v||[],t+1,2*i,2*r+1),s.push(y||[],t+1,2*i+1,2*r),s.push(_||[],t+1,2*i+1,2*r+1)}}},Ce.prototype.getTile=function(e,t,i){var r=this.options,n=r.extent,a=r.debug;if(e<0||e>24)return null;
1var o=1<<e,s=Ae(e,t=(t%o+o)%o,i);if(this.tiles[s])return Te(this.tiles[s],n);a>1&&console.log("drilling down to z%d-%d-%d",e,t,i);for(var l,u=e,c=t,h=i;!l&&u>0;)u--,c=Math.floor(c/2),h=Math.floor(h/2),l=this.tiles[Ae(u,c,h)];return l&&l.source?(a>1&&console.log("found parent tile z%d-%d-%d",u,c,h),a>1&&console.time("drilling down"),this.splitTile(l.source,u,c,h,e,t,i),a>1&&console.timeEnd("drilling down"),this.tiles[s]?Te(this.tiles[s],n):null):null};var Pe=function(i){p(n,i);var r=m(n);function n(e,t,i,a,o){var s;return h(this,n),s=r.call(this,e,t,i,a,ze),o&&(s.loadGeoJSON=o),s}return d(n,[{key:"loadData",value:function(t,i){var r=this,n=t&&t.request,o=n&&n.collectResourceTiming;this.loadGeoJSON(t,function(u,c){if(u||!c)return i(u);if("object"!=typeof c)return i(new Error("Input data given to '".concat(t.source,"' is not a valid GeoJSON object.")));s(c,!0);try{if(t.filter){var h=e.createExpression(t.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===h.result)throw new Error(h.value.map(function(e){return"".concat(e.key,": ").concat(e.message)}).join(", "));var f=c.features.filter(function(e){return h.value.evaluate({zoom:0},e)});c={type:"FeatureCollection",features:f}}r._geoJSONIndex=t.cluster?new X(function(t){var i=t.superclusterOptions,r=t.clusterProperties;if(!r||!i)return i;for(var n={},o={},s={accumulated:null,zoom:0},u={properties:null},c=Object.keys(r),h=0,f=c;h<f.length;h++){var d=f[h],p=a(r[d],2),m=p[0],v=p[1],y=e.createExpression(v),_=e.createExpression("string"==typeof m?[m,["accumulated"],["get",d]]:m);n[d]=y.value,o[d]=_.value}return i.map=function(e){u.properties=e;var t,i={},r=l(c);try{for(r.s();!(t=r.n()).done;){var a=t.value;i[a]=n[a].evaluate(s,u)}}catch(o){r.e(o)}finally{r.f()}return i},i.reduce=function(e,t){u.properties=t;var i,r=l(c);try{for(r.s();!(i=r.n()).done;){var n=i.value;s.accumulated=e[n],e[n]=o[n].evaluate(s,u)}}catch(a){r.e(a)}finally{r.f()}},i}(t)).load(c.features):new Ce(d=c,t.geojsonVtOptions)}catch(d){return i(d)}r.loaded={};var d,p={};if(o){var m=e.getPerformanceMeasurement(n);m&&(p.resourceTiming={},p.resourceTiming[t.source]=JSON.parse(JSON.stringify(m)))}i(null,p)})}},{key:"reloadTile",value:function(e,i){var r=this.loaded;return r&&r[e.uid]?t(w(n.prototype),"reloadTile",this).call(this,e,i):this.loadTile(e,i)}},{key:"loadGeoJSON",value:function(t,i){if(t.request)e.getJSON(t.request,i);else{if("string"!=typeof t.data)return i(new Error("Input data given to '".concat(t.source,"' is not a valid GeoJSON object.")));try{return i(null,JSON.parse(t.data))}catch(r){return i(new Error("Input data given to '".concat(t.source,"' is not a valid GeoJSON object.")))}}}},{key:"getClusterExpansionZoom",value:function(e,t){try{t(null,this._geoJSONIndex.getClusterExpansionZoom(e.clusterId))}catch(i){t(i)}}},{key:"getClusterChildren",value:function(e,t){try{t(null,this._geoJSONIndex.getChildren(e.clusterId))}catch(i){t(i)}}},{key:"getClusterLeaves",value:function(e,t){try{t(null,this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset))}catch(i){t(i)}}}]),n}(e.VectorTileWorkerSource),De=function(){function t(i){var r=this;h(this,t),this.self=i,this.actor=new e.Actor(i,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=e.getProjection({name:"mercator"}),this.workerSourceTypes={vector:e.VectorTileWorkerSource,geojson:Pe},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=function(e,t){if(r.workerSourceTypes[e])throw new Error('Worker source with name "'.concat(e,'" already registered.'));r.workerSourceTypes[e]=t},this.self.registerRTLTextPlugin=function(t){if(e.plugin.isParsed())throw new Error("RTL text plugin already registered.");e.plugin.applyArabicShaping=t.applyArabicShaping,e.plugin.processBidirectionalText=t.processBidirectionalText,e.plugin.processStyledBidirectionalText=t.processStyledBidirectionalText}}return d(t,[{key:"clearCaches",value:function(e,t,i){delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],delete this.demWorkerSources[e],i()}},{key:"checkIfReady",value:function(e,t,i){i()}},{key:"setReferrer",value:function(e,t){this.referrer=t}},{key:"spriteLoaded",value:function(t,i){for(var r in this.isSpriteLoaded[t]=i,this.workerSources[t]){var n=this.workerSources[t][r];for(var a in n)n[a]instanceof e.VectorTileWorkerSource&&(n[a].isSpriteLoaded=i,n[a].fire(new e.Event("isSpriteLoaded")))}}},{key:"setImages",value:function(e,t,i){for(var r in this.availableImages[e]=t,this.workerSources[e]){var n=this.workerSources[e][r];for(var a in n)n[a].availableImages=t}i()}},{key:"enableTerrain",value:function(e,t,i){this.terrain=t,i()}},{key:"setProjection",value:function(t,i){this.projections[t]=e.getProjection(i)}},{key:"setLayers",value:function(e,t,i){this.getLayerIndex(e).replace(t),i()}},{key:"updateLayers",value:function(e,t,i){this.getLayerIndex(e).update(t.layers,t.removedIds),i()}},{key:"loadTile",value:function(t,i,r){var n=this.enableTerrain?e.extend({enableTerrain:this.terrain},i):i;n.projection=this.projections[t]||this.defaultProjection,this.getWorkerSource(t,i.type,i.source).loadTile(n,r)}},{key:"loadDEMTile",value:function(t,i,r){var n=this.enableTerrain?e.extend({buildQuadTree:this.terrain},i):i;this.getDEMWorkerSource(t,i.source).loadTile(n,r)}},{key:"reloadTile",value:function(t,i,r){var n=this.enableTerrain?e.extend({enableTerrain:this.terrain},i):i;n.projection=this.projections[t]||this.defaultProjection,this.getWorkerSource(t,i.type,i.source).reloadTile(n,r)}},{key:"abortTile",value:function(e,t,i){this.getWorkerSource(e,t.type,t.source).abortTile(t,i)}},{key:"removeTile",value:function(e,t,i){this.getWorkerSource(e,t.type,t.source).removeTile(t,i)}},{key:"removeSource",value:function(e,t,i){if(this.workerSources[e]&&this.workerSources[e][t.type]&&this.workerSources[e][t.type][t.source]){var r=this.workerSources[e][t.type][t.source];delete this.workerSources[e][t.type][t.source],void 0!==r.removeSource?r.removeSource(t,i):i()}}},{key:"loadWorkerSource",value:function(e,t,i){try{this.self.importScripts(t.url),i()}catch(r){i(r.toString())}}},{key:"syncRTLPluginState",value:function(t,i,r){try{e.plugin.setState(i);var n=e.plugin.getPluginURL();if(e.plugin.isLoaded()&&!e.plugin.isParsed()&&null!=n){this.self.importScripts(n);var a=e.plugin.isParsed();r(a?void 0:new Error("RTL Text Plugin failed to import scripts from ".concat(n)),a)}}catch(n){r(n.toString())}}},{key:"getAvailableImages",value:function(e){var t=this.availableImages[e];return t||(t=[]),t}},{key:"getLayerIndex",value:function(e){var t=this.layerIndexes[e];return t||(t=this.layerIndexes[e]=new n),t}}
1,{key:"getWorkerSource",value:function(e,t,i){var r=this;return this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][t]||(this.workerSources[e][t]={}),this.workerSources[e][t][i]||(this.workerSources[e][t][i]=new this.workerSourceTypes[t]({send:function(t,i,n,a,o,s){r.actor.send(t,i,n,e,o,s)},scheduler:this.actor.scheduler},this.getLayerIndex(e),this.getAvailableImages(e),this.isSpriteLoaded[e])),this.workerSources[e][t][i]}},{key:"getDEMWorkerSource",value:function(e,t){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][t]||(this.demWorkerSources[e][t]=new o),this.demWorkerSources[e][t]}},{key:"enforceCacheSizeLimit",value:function(t,i){e.enforceCacheSizeLimit(i)}},{key:"getWorkerPerformanceMetrics",value:function(e,t,i){i(void 0,void 0)}}]),t}();return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new De(self)),De}),x(0,function(i){function n(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(var i=0;i<e.length;i++)if(!n(e[i],t[i]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==t){if("object"!=typeof t||Object.keys(e).length!==Object.keys(t).length)return!1;for(var r in e)if(!n(e[r],t[r]))return!1;return!0}return e===t}var o=s;function s(e){return t=e,!("undefined"==typeof window||"undefined"==typeof document||!(Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray)||!Function.prototype||!Function.prototype.bind||!(Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions)||!("JSON"in window&&"parse"in JSON&&"stringify"in JSON)||!function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var e,t,i=new Blob([""],{type:"text/javascript"}),r=URL.createObjectURL(i);try{t=new Worker(r),e=!0}catch(n){e=!1}return t&&t.terminate(),URL.revokeObjectURL(r),e}()||!("Uint8ClampedArray"in window)||!ArrayBuffer.isView||!function(){var e=document.createElement("canvas");e.width=e.height=1;var t=e.getContext("2d");if(!t)return!1;var i=t.getImageData(0,0,1,1);return i&&i.width===e.width}()||(void 0===u[i=t&&t.failIfMajorPerformanceCaveat]&&(u[i]=function(e){var t,i,r,n,a=(i=e,r=document.createElement("canvas"),(n=Object.create(s.webGLContextAttributes)).failIfMajorPerformanceCaveat=i,r.getContext("webgl",n)||r.getContext("experimental-webgl",n));if(!a)return!1;try{t=a.createShader(a.VERTEX_SHADER)}catch(i){return!1}return!(!t||a.isContextLost())&&(a.shaderSource(t,"void main() {}"),a.compileShader(t),!0===a.getShaderParameter(t,a.COMPILE_STATUS))}(i)),!u[i]||document.documentMode));var t,i}var u={};function c(e,t,r){var n=i.window.document.createElement(e);return void 0!==t&&(n.className=t),r&&r.appendChild(n),n}function f(e,t,r){for(var n=i.window.document.createElementNS("http://www.w3.org/2000/svg",e),a=0,o=Object.keys(t);a<o.length;a++){var s=o[a];n.setAttributeNS(null,s,t[s])}return r&&r.appendChild(n),n}s.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};var _,x=i.window.document&&i.window.document.documentElement.style,b=x&&void 0!==x.userSelect?"userSelect":"WebkitUserSelect";function k(){x&&b&&(_=x[b],x[b]="none")}function T(){x&&b&&(x[b]=_)}function E(e){e.preventDefault(),e.stopPropagation(),i.window.removeEventListener("click",E,!0)}function M(){i.window.addEventListener("click",E,!0),i.window.setTimeout(function(){i.window.removeEventListener("click",E,!0)},0)}function S(e,t){var i=e.getBoundingClientRect();return A(e,i,t)}function I(e,t){for(var i=e.getBoundingClientRect(),r=[],n=0;n<t.length;n++)r.push(A(e,i,t[n]));return r}function C(e){return void 0!==i.window.InstallTrigger&&2===e.button&&e.ctrlKey&&i.window.navigator.platform.toUpperCase().indexOf("MAC")>=0?0:e.button}function A(e,t,r){var n=e.offsetWidth===t.width?1:e.offsetWidth/t.width;return new i.pointGeometry((r.clientX-t.left)*n,(r.clientY-t.top)*n)}function z(e,t){var i=t[0],r=t[1],n=t[2],a=t[3],o=i*a-n*r;return o?(e[0]=a*(o=1/o),e[1]=-r*o,e[2]=-n*o,e[3]=i*o,e):null}function P(e){var t=e.userImage;return!!(t&&t.render&&t.render())&&(e.data.replace(new Uint8Array(t.data.buffer)),!0)}var D=function(e){p(r,e);var t=m(r);function r(){var e;return h(this,r),(e=t.call(this)).images={},e.updatedImages={},e.callbackDispatchedThisFrame={},e.loaded=!1,e.requestors=[],e.patterns={},e.atlasImage=new i.RGBAImage({width:1,height:1}),e.dirty=!0,e}return d(r,[{key:"isLoaded",value:function(){return this.loaded}}
1,{key:"setLoaded",value:function(e){if(this.loaded!==e&&(this.loaded=e,e)){var t,i=l(this.requestors);try{for(i.s();!(t=i.n()).done;){var r=t.value,n=r.ids,a=r.callback;this._notify(n,a)}}catch(o){i.e(o)}finally{i.f()}this.requestors=[]}}},{key:"hasImage",value:function(e){return!!this.getImage(e)}},{key:"getImage",value:function(e){return this.images[e]}},{key:"addImage",value:function(e,t){this._validate(e,t)&&(this.images[e]=t)}},{key:"_validate",value:function(e,t){var r=!0;return this._validateStretch(t.stretchX,t.data&&t.data.width)||(this.fire(new i.ErrorEvent(new Error('Image "'.concat(e,'" has invalid "stretchX" value')))),r=!1),this._validateStretch(t.stretchY,t.data&&t.data.height)||(this.fire(new i.ErrorEvent(new Error('Image "'.concat(e,'" has invalid "stretchY" value')))),r=!1),this._validateContent(t.content,t)||(this.fire(new i.ErrorEvent(new Error('Image "'.concat(e,'" has invalid "content" value')))),r=!1),r}},{key:"_validateStretch",value:function(e,t){if(!e)return!0;var i,r=0,n=l(e);try{for(n.s();!(i=n.n()).done;){var a=i.value;if(a[0]<r||a[1]<a[0]||t<a[1])return!1;r=a[1]}}catch(o){n.e(o)}finally{n.f()}return!0}},{key:"_validateContent",value:function(e,t){return!(e&&(4!==e.length||e[0]<0||t.data.width<e[0]||e[1]<0||t.data.height<e[1]||e[2]<0||t.data.width<e[2]||e[3]<0||t.data.height<e[3]||e[2]<e[0]||e[3]<e[1]))}},{key:"updateImage",value:function(e,t){t.version=this.images[e].version+1,this.images[e]=t,this.updatedImages[e]=!0}},{key:"removeImage",value:function(e){var t=this.images[e];delete this.images[e],delete this.patterns[e],t.userImage&&t.userImage.onRemove&&t.userImage.onRemove()}},{key:"listImages",value:function(){return Object.keys(this.images)}},{key:"getImages",value:function(e,t){var i=!0;if(!this.isLoaded()){var r,n=l(e);try{for(n.s();!(r=n.n()).done;){var a=r.value;this.images[a]||(i=!1)}}catch(o){n.e(o)}finally{n.f()}}this.isLoaded()||i?this._notify(e,t):this.requestors.push({ids:e,callback:t})}},{key:"_notify",value:function(e,t){var r,n={},a=l(e);try{for(a.s();!(r=a.n()).done;){var o=r.value;this.images[o]||this.fire(new i.Event("styleimagemissing",{id:o}));var s=this.images[o];s?n[o]={data:s.data.clone(),pixelRatio:s.pixelRatio,sdf:s.sdf,version:s.version,stretchX:s.stretchX,stretchY:s.stretchY,content:s.content,hasRenderCallback:Boolean(s.userImage&&s.userImage.render)}:i.warnOnce('Image "'.concat(o,'" 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.'))}}catch(u){a.e(u)}finally{a.f()}t(null,n)}},{key:"getPixelSize",value:function(){var e=this.atlasImage;return{width:e.width,height:e.height}}},{key:"getPattern",value:function(e){var t=this.patterns[e],r=this.getImage(e);if(!r)return null;if(t&&t.position.version===r.version)return t.position;if(t)t.position.version=r.version;else{var n={w:r.data.width+2,h:r.data.height+2,x:0,y:0},a=new i.ImagePosition(n,r);this.patterns[e]={bin:n,position:a}}return this._updatePatternAtlas(),this.patterns[e].position}},{key:"bind",value:function(e){var t=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new i.Texture(e,this.atlasImage,t.RGBA),this.atlasTexture&&this.atlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE)}},{key:"_updatePatternAtlas",value:function(){var e=[];for(var t in this.patterns)e.push(this.patterns[t].bin);var r=i.potpack(e),n=r.w,a=r.h,o=this.atlasImage;for(var s in o.resize({width:n||1,height:a||1}),this.patterns){var l=this.patterns[s].bin,u=l.x+1,c=l.y+1,h=this.images[s].data,f=h.width,d=h.height;i.RGBAImage.copy(h,o,{x:0,y:0},{x:u,y:c},{width:f,height:d}),i.RGBAImage.copy(h,o,{x:0,y:d-1},{x:u,y:c-1},{width:f,height:1}),i.RGBAImage.copy(h,o,{x:0,y:0},{x:u,y:c+d},{width:f,height:1}),i.RGBAImage.copy(h,o,{x:f-1,y:0},{x:u-1,y:c},{width:1,height:d}),i.RGBAImage.copy(h,o,{x:0,y:0},{x:u+f,y:c},{width:1,height:d})}this.dirty=!0}},{key:"beginFrame",value:function(){this.callbackDispatchedThisFrame={}}},{key:"dispatchRenderCallbacks",value:function(e){var t,i=l(e);try{for(i.s();!(t=i.n()).done;){var r=t.value;if(!this.callbackDispatchedThisFrame[r]){this.callbackDispatchedThisFrame[r]=!0;var n=this.images[r];P(n)&&this.updateImage(r,n)}}}catch(a){i.e(a)}finally{i.f()}}}]),r}(i.Evented),L=new i.Properties({anchor:new i.DataConstantProperty(i.spec.light.anchor),position:new(function(){function e(){h(this,e),this.specification=i.spec.light.position}return d(e,[{key:"possiblyEvaluate",value:function(e,t){return r=e.expression.evaluate(t),n=a(r,3),o=n[0],s=n[1],l=n[2],u=i.degToRad(s+90),c=i.degToRad(l),{x:o*Math.cos(u)*Math.sin(c),y:o*M
1ath.sin(u)*Math.sin(c),z:o*Math.cos(c),azimuthal:s,polar:l};var r,n,o,s,l,u,c}},{key:"interpolate",value:function(e,t,r){return{x:i.number(e.x,t.x,r),y:i.number(e.y,t.y,r),z:i.number(e.z,t.z,r),azimuthal:i.number(e.azimuthal,t.azimuthal,r),polar:i.number(e.polar,t.polar,r)}}}]),e}()),color:new i.DataConstantProperty(i.spec.light.color),intensity:new i.DataConstantProperty(i.spec.light.intensity)}),R="-transition",B=function(e){p(r,e);var t=m(r);function r(e){var n;return h(this,r),(n=t.call(this))._transitionable=new i.Transitionable(L),n.setLight(e),n._transitioning=n._transitionable.untransitioned(),n}return d(r,[{key:"getLight",value:function(){return this._transitionable.serialize()}},{key:"setLight",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this._validate(i.validateLight,e,t))for(var r in e){var n=e[r];i.endsWith(r,R)?this._transitionable.setTransition(r.slice(0,-R.length),n):this._transitionable.setValue(r,n)}}},{key:"updateTransitions",value:function(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}},{key:"hasTransition",value:function(){return this._transitioning.hasTransition()}},{key:"recalculate",value:function(e){this.properties=this._transitioning.possiblyEvaluate(e)}},{key:"_validate",value:function(e,t,r){return(!r||!1!==r.validate)&&i.emitValidationErrors(this,e.call(i.validateStyle,i.extend({value:t,style:{glyphs:!0,sprite:!0},styleSpec:i.spec})))}}]),r}(i.Evented),O=new i.Properties({source:new i.DataConstantProperty(i.spec.terrain.source),exaggeration:new i.DataConstantProperty(i.spec.terrain.exaggeration)}),F="-transition",U=function(e){p(r,e);var t=m(r);function r(e,n){var a;return h(this,r),(a=t.call(this))._transitionable=new i.Transitionable(O),a.set(e),a._transitioning=a._transitionable.untransitioned(),a.drapeRenderMode=n,a}return d(r,[{key:"get",value:function(){return this._transitionable.serialize()}},{key:"set",value:function(e){for(var t in e){var r=e[t];i.endsWith(t,F)?this._transitionable.setTransition(t.slice(0,-F.length),r):this._transitionable.setValue(t,r)}}},{key:"updateTransitions",value:function(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}},{key:"hasTransition",value:function(){return this._transitioning.hasTransition()}},{key:"recalculate",value:function(e){this.properties=this._transitioning.possiblyEvaluate(e)}}]),r}(i.Evented);function V(e,t,r,n){var o=i.smoothstep(45,65,r),s=a(j(e,n),2),l=s[0],u=s[1],c=i.length(t),h=1-Math.min(1,Math.exp((c-l)/(u-l)*-6));return h*=h*h,(h=Math.min(1,1.00747*h))*o*e.alpha}function j(e,t){var i=.5/Math.tan(.5*t);return[e.range[0]+i,e.range[1]+i]}var N=new i.Properties({range:new i.DataConstantProperty(i.spec.fog.range),color:new i.DataConstantProperty(i.spec.fog.color),"high-color":new i.DataConstantProperty(i.spec.fog["high-color"]),"space-color":new i.DataConstantProperty(i.spec.fog["space-color"]),"horizon-blend":new i.DataConstantProperty(i.spec.fog["horizon-blend"]),"star-intensity":new i.DataConstantProperty(i.spec.fog["star-intensity"])}),G="-transition",Z=function(e){p(r,e);var t=m(r);function r(e,n){var a;return h(this,r),(a=t.call(this))._transitionable=new i.Transitionable(N),a.set(e),a._transitioning=a._transitionable.untransitioned(),a._transform=n,a}return d(r,[{key:"state",get:function(){var e=this._transform,t="globe"===e.projection.name,r=i.globeToMercatorTransition(e.zoom),n=this.properties.get("range"),a=[.5,3];return{range:t?[i.number(a[0],n[0],r),i.number(a[1],n[1],r)]:n,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}},{key:"get",value:function(){return this._transitionable.serialize()}},{key:"set",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this._validate(i.validateFog,e,t)){for(var r=0,n=Object.keys(i.spec.fog);r<n.length;r++){var a=n[r];e&&void 0===e[a]&&(e[a]=i.spec.fog[a].default)}for(var o in e){var s=e[o];i.endsWith(o,G)?this._transitionable.setTransition(o.slice(0,-G.length),s):this._transitionable.setValue(o,s)}}}},{key:"getOpacity",value:function(e){if(!this._transform.projection.supportsFog)return 0;var t=this.properties&&this.properties.get("color")||1;return("globe"===this._transform.projection.name?1:i.smoothstep(45,65,e))*t.a}},{key:"getOpacityAtLatLng",value:function(e,t){return this._transform.projection.supportsFog?(r=this.state,n=e,a=t,o=i.MercatorCoordinate.fromLngLat(n),s=a.elevation?a.elevation.getAtPointOrZero(o):0,l=[o.x,o.y,s],i.transformMat4(l,l,a.mercatorFogMatrix),V(r,l,a.pitch,a._fov)):0;var r,n,a,o,s,l}},{key:"getFovAdjustedRange",value:function(e){return this._transform.projection.supportsFog?j(this.state,e):[0,1]}},{key:"updateTransitions",value:function(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}},{key:"hasTransition",value:function(){return this._transitioning.hasTransition()}},{key:"recalculate",value:function(e){this.properties=this._transitioning.possiblyEvaluate(e)}},{key:"_validate",value:function(e,t,r){return(!r||!1!==r.validate)&&i.emitValidationErrors(this,e.call(i.validateStyle,i.extend({value:t,style:{glyphs:!0,sprite:!0},styleSpec:i.spec})))}}]),r}(i.Evented),q=function(){function e(t,r){var n=this;h(this,e),this.workerPool=t,this.actors=[],this.currentActor=0,this.id=i.uniqueId();
1for(var a=this.workerPool.acquire(this.id),o=0;o<a.length;o++){var s=new e.Actor(a[o],r,this.id);s.name="Worker ".concat(o),this.actors.push(s)}this.ready=!1,this.broadcast("checkIfReady",null,function(){n.ready=!0})}return d(e,[{key:"broadcast",value:function(e,t,r){i.asyncAll(this.actors,function(i,r){i.send(e,t,r)},r=r||function(){})}},{key:"getActor",value:function(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}},{key:"remove",value:function(){this.actors.forEach(function(e){e.remove()}),this.actors=[],this.workerPool.release(this.id)}}]),e}();function W(e,t,r){return t*(i.EXTENT/(e.tileSize*Math.pow(2,r-e.tileID.overscaledZ)))}q.Actor=i.Actor;var X=function(){function e(t,i,r,n){h(this,e),this.screenBounds=t,this.cameraPoint=i,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=r,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,n)}return d(e,[{key:"isPointQuery",value:function(){return 1===this.screenBounds.length}},{key:"bufferedScreenGeometry",value:function(e){return i.polygonizeBounds(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],e)}},{key:"bufferedCameraGeometry",value:function(e){var t=this.screenBounds[0],r=1===this.screenBounds.length?this.screenBounds[0].add(new i.pointGeometry(1,1)):this.screenBounds[1],n=i.polygonizeBounds(t,r,0,!1);return this.cameraPoint.y>r.y&&(this.cameraPoint.x>t.x&&this.cameraPoint.x<r.x?n.splice(3,0,this.cameraPoint):this.cameraPoint.x>=r.x?n[2]=this.cameraPoint:this.cameraPoint.x<=t.x&&(n[3]=this.cameraPoint)),i.bufferConvexPolygon(n,e)}},{key:"bufferedCameraGeometryGlobe",value:function(e){var t=this.screenBounds[0],r=1===this.screenBounds.length?this.screenBounds[0].add(new i.pointGeometry(1,1)):this.screenBounds[1],n=i.polygonizeBounds(t,r,e),a=this.cameraPoint.clone();switch(3*((a.y>t.y)+(a.y>r.y))+((a.x>t.x)+(a.x>r.x))){case 0:n[0]=a,n[4]=a.clone();break;case 1:n.splice(1,0,a);break;case 2:n[1]=a;break;case 3:n.splice(4,0,a);break;case 5:n.splice(2,0,a);break;case 6:n[3]=a;break;case 7:n.splice(3,0,a);break;case 8:n[2]=a}return n}},{key:"containsTile",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=e.queryPadding/t._pixelsPerMercatorPixel+1,o=r?this._bufferedCameraMercator(a,t):this._bufferedScreenMercator(a,t),s=e.tileID.wrap+(o.unwrapped?n:0),l=o.polygon.map(function(t){return i.getTilePoint(e.tileTransform,t,s)});if(i.polygonIntersectsBox(l,0,0,i.EXTENT,i.EXTENT)){s=e.tileID.wrap+(this.screenGeometryMercator.unwrapped?n:0);var u,c=this.screenGeometryMercator.polygon.map(function(t){return i.getTileVec3(e.tileTransform,t,s)}),h=c.map(function(e){return new i.pointGeometry(e[0],e[1])}),f=t.getFreeCameraOptions().position||new i.MercatorCoordinate(0,0,0),d=i.getTileVec3(e.tileTransform,f,s),p=c.map(function(e){var t=i.sub(e,e,d);return i.normalize(t,t),new i.Ray(d,t)}),m=W(e,1,t.zoom)*t._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:h,tilespaceRays:p,bufferedTilespaceGeometry:l,bufferedTilespaceBounds:(u=i.getBounds(l),u.min.x=i.clamp(u.min.x,0,i.EXTENT),u.min.y=i.clamp(u.min.y,0,i.EXTENT),u.max.x=i.clamp(u.max.x,0,i.EXTENT),u.max.y=i.clamp(u.max.y,0,i.EXTENT),u),tile:e,tileID:e.tileID,pixelToTileUnitsFactor:m}}}},{key:"_bufferedScreenMercator",value:function(e,t){var i,r=K(e);return this._screenRaycastCache[r]?this._screenRaycastCache[r]:(i="globe"===t.projection.name?this._projectAndResample(this.bufferedScreenGeometry(e),t):{polygon:this.bufferedScreenGeometry(e).map(function(e){return t.pointCoordinate3D(e)}),unwrapped:!0},this._screenRaycastCache[r]=i,i)}},{key:"_bufferedCameraMercator",value:function(e,t){var i,r=K(e);return this._cameraRaycastCache[r]?this._cameraRaycastCache[r]:(i="globe"===t.projection.name?this._projectAndResample(this.bufferedCameraGeometryGlobe(e),t):{polygon:this.bufferedCameraGeometry(e).map(function(e){return t.pointCoordinate3D(e)}),unwrapped:!0},this._cameraRaycastCache[r]=i,i)}},{key:"_projectAndResample",value:function(e,t){var n=function(e,t){var n=i.multiply([],t.pixelMatrix,t.globeMatrix),a=[0,-i.GLOBE_RADIUS,0,1],o=[0,i.GLOBE_RADIUS,0,1],s=[0,0,0,1];i.transformMat4$1(a,a,n),i.transformMat4$1(o,o,n),i.transformMat4$1(s,s,n);var l=new i.pointGeometry(a[0]/a[3],a[1]/a[3]),u=new i.pointGeometry(o[0]/o[3],o[1]/o[3]),c=i.polygonContainsPoint(e,l)&&a[3]<s[3],h=i.polygonContainsPoint(e,u)&&o[3]<s[3];if(!c&&!h)return null;var f=function(e,t,i){for(var r=1;r<e.length;r++){var n=Y(t.pointCoordinate3D(e[r-1]).x),a=Y(t.pointCoordinate3D(e[r]).x);if(i<0){if(n<a)return{idx:r,t:-n/(a-1-n)}}else if(a<n)return{idx:r,t:(1-n)/(a+1-n)}}return null}(e,t,c?-1:1);if(!f)return null;var d=f.idx,p=f.t,m=d>1?H(e.slice(0,d),t):[],v=d<e.length?H(e.slice(d),t):[];m=m.map(function(e){return new i.pointGeometry(Y(e.x),e.y)}),v=v.map(function(e){return new i.pointGeometry(Y(e.x),e.y)});var y=r(m);0===y.length&&y.push(v[v.length-1]);var _,g=i.number(y[y.length-1].y,(0===v.length?m[0]:v[0]).y,p);return _=c?[new i.pointGeometry(0,g),new i.pointGeometry(0,0),new i.pointGeometry(1,0),new i.pointGeometry(1,g)]:[new i.pointGeometry(1,g),new i.pointGeometry(1,1),new i.pointGeometry(0,1),new i.pointGeometry(0,g)],y.push.apply(y,r(_)),0===v.length?y.push(m[0]):y.push.apply(y,r(v)),{polygon:y.map(function(e){return new i.MercatorCoordinate(e.x,e.y)}),unwrapped:!1}}(e,t);if(n)return n;var a=function(e,t){for(var r=!1,n=-1/0,a=0,o=0;o<e.length-1;o++)e[o].x>n&&(n=e[o].x,a=o);for(var s=0;s<e.length-1;s++){var l=(a+s)%(e.length-1),u=e[l],c=e[l+1];Math.abs(u.x-c.x)>.5&&(u.x<c.x?(u.x+=1,0===l&&(e[e.length-1].x+=1)):(c.x+=1,l+1===e.length-1&&(e[0].x+=1)),r=!0)}var h=i.mercatorXfromLng(t.center.lng);return r&&h<Math.abs(h-1)&&e.forEach(function(e){e.x-=1}),{polygon:e,unwrapped:r}}(H(e,t).map(function(e){return new i.pointGeometry(Y(e.x),e.y)}),t);return{polygon:a.polygon.map(function(e){return new i.MercatorCoordinate(e.x,e.y)}),unwrapped:a.unwrapped}}}],[{key:"createFromScreenPoints",value:function(t,r){var n,a;if(t instanceof i.pointGeometry||"number"==typeof t[0]){var o=i.pointGeometry.convert(t);n=[o],a=r.isPointAboveHorizon(o)}else{var s=i.pointGeometry.convert(t[0]),l=i.pointGeometry.convert(t[1]);n=[s,l],a=i.polygonizeBounds(s,l).every(function(e){return r.isPointAboveHorizon(e)})}return new e(n,r.getCameraPoint(),a,r)}}]),e}();function H(e,t){return i.resample(e,function(e){var i=t.pointCoordinate3D(e);e.x=i.x,e.y=i.y},1/256)}function Y(e){return e<0?1+e%1:e%1}function K(e){return 100*e|0}function J(e,t,r,n,a){var o=function(r,n){if(r)return a(r);if(n){e.url&&n.tiles&&e.tiles&&delete e.tiles;var o=i.pick(i.extend(n,e),["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);n.vector_layers&&(o.vectorLayers=n.vector_layers,o.vectorLayerIds=o.vectorLayers.map(function(e){return e.id})),o.tiles=t.canonicalizeTileset(o,e.url),a(null,o)}};return e.url?i.getJSON(t.transformRequest(t.normalizeSourceURL(e.url,null,r,n),i.ResourceType.Source),o):i.exported.frame(function(){return o(null,e)})}var $,Q=function(){function e(t,r,n){h(this,e),this.bounds=i.LngLatBounds.convert(this.validateBounds(t)),this.minzoom=r||0,this.maxzoom=n||24}return d(e,[{key:"validateBounds",value:function(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]}},{key:"contains",value:function(e){var t=Math.pow(2,e.z),r=Math.floor(i.mercatorXfromLng(this.bounds.getWest())*t),n=Math.floor(i.mercatorYfromLat(this.bounds.getNorth())*t),a=Math.ceil(i.mercatorXfromLng(this.bounds.getE
1ast())*t),o=Math.ceil(i.mercatorYfromLat(this.bounds.getSouth())*t);return e.x>=r&&e.x<a&&e.y>=n&&e.y<o}}]),e}(),ee=function(){function e(t,i,r){h(this,e),this.context=t;var n=t.gl;this.buffer=n.createBuffer(),this.dynamicDraw=Boolean(r),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||i.destroy()}return d(e,[{key:"bind",value:function(){this.context.bindElementBuffer.set(this.buffer)}},{key:"updateData",value:function(e){var t=this.context.gl;this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}},{key:"destroy",value:function(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}]),e}(),te={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},ie=function(){function e(t,i,r,n){h(this,e),this.length=i.length,this.attributes=r,this.itemSize=i.bytesPerElement,this.dynamicDraw=n,this.context=t;var a=t.gl;this.buffer=a.createBuffer(),t.bindVertexBuffer.set(this.buffer),a.bufferData(a.ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||i.destroy()}return d(e,[{key:"bind",value:function(){this.context.bindVertexBuffer.set(this.buffer)}},{key:"updateData",value:function(e){var t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}},{key:"enableAttributes",value:function(e,t){for(var i=0;i<this.attributes.length;i++){var r=t.attributes[this.attributes[i].name];void 0!==r&&e.enableVertexAttribArray(r)}}},{key:"setVertexAttribPointers",value:function(e,t,i){for(var r=0;r<this.attributes.length;r++){var n=this.attributes[r],a=t.attributes[n.name];void 0!==a&&e.vertexAttribPointer(a,n.components,e[te[n.type]],!1,this.itemSize,n.offset+this.itemSize*(i||0))}}},{key:"destroy",value:function(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}]),e}(),re=function(){function e(t){h(this,e),this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}return d(e,[{key:"get",value:function(){return this.current}},{key:"set",value:function(e){}},{key:"getDefault",value:function(){return this.default}},{key:"setDefault",value:function(){this.set(this.default)}}]),e}(),ne=function(e){p(r,e);var t=m(r);function r(){return h(this,r),t.apply(this,arguments)}return d(r,[{key:"getDefault",value:function(){return i.Color.transparent}},{key:"set",value:function(e){var t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}]),r}(re),ae=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"getDefault",value:function(){return 1}},{key:"set",value:function(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}]),i}(re),oe=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"getDefault",value:function(){return 0}},{key:"set",value:function(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}]),i}(re),se=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"getDefault",value:function(){return[!0,!0,!0,!0]}},{key:"set",value:function(e){var t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}]),i}(re),le=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"getDefault",value:function(){return!0}},{key:"set",value:function(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}]),i}(re),ue=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"getDefault",value:function(){return 255}},{key:"set",value:function(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}]),i}(re),ce=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"getDefault",value:function(){return{func:this.gl.ALWAYS,ref:0,mask:255}}},{key:"set",value:function(e){var t=this.current;(e.func!==t.func||e.ref!==t.ref||e.mask!==t.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}]),i}(re),he=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"getDefault",value:function(){var e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}},{key:"set",value:function(e){var t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}]),i}(re),fe=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"getDefault",value:function(){return!1}},{key:"set",value:function(e){if(e!==this.current||this.dirty){var t=this.gl;e?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.current=e,this.dirty=!1}}}]),i}(re),de=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"getDefault",value:function(){return[0,1]}},{key:"set",value:function(e){var t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}]),i}(re),pe=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"getDefault",value:function(){return!1}},{key:"set",value:function(e){if(e!==this.current||this.dirty){var t=this.gl;e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),this.current=e,this.dirty=!1}}}]),i}(re),me=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"getDefault",value:function(){return this.gl.LESS}},{key:"set",value:function(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}]),i}(re),ve=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"getDefault",value:function(){return!1}},{key:"set",value:function(e){if(e!==this.current||this.dirty){var t=this.gl;e?t.enable(t.BLEND):t.disable(t.BLEND),this.current=e,this.dirty=!1}}}]),i}(re),ye=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"getDefault",value:function(){var e=this.gl;return[e.ONE,e.ZERO]}},{key:"set",value:function(e){var t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}}]),i}(re),_e=function(e){p(r,e);var t=m(r);function r(){return h(this,r),t.apply(this,arguments)}return d(r,[{key:"getDefault",value:function(){return i.Color.transparent}},{key:"set",value:function(e){var t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.blendColor
1(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}]),r}(re),ge=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"getDefault",value:function(){return this.gl.FUNC_ADD}},{key:"set",value:function(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}]),i}(re),xe=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"getDefault",value:function(){return!1}},{key:"set",value:function(e){if(e!==this.current||this.dirty){var t=this.gl;e?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),this.current=e,this.dirty=!1}}}]),i}(re),be=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"getDefault",value:function(){return this.gl.BACK}},{key:"set",value:function(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}]),i}(re),we=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"getDefault",value:function(){return this.gl.CCW}},{key:"set",value:function(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}]),i}(re),ke=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"getDefault",value:function(){return null}},{key:"set",value:function(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}]),i}(re),Te=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"getDefault",value:function(){return this.gl.TEXTURE0}},{key:"set",value:function(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}]),i}(re),Ee=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"getDefault",value:function(){var e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}},{key:"set",value:function(e){var t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}]),i}(re),Me=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"getDefault",value:function(){return null}},{key:"set",value:function(e){if(e!==this.current||this.dirty){var t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}}]),i}(re),Se=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"getDefault",value:function(){return null}},{key:"set",value:function(e){if(e!==this.current||this.dirty){var t=this.gl;t.bindRenderbuffer(t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}}]),i}(re),Ie=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"getDefault",value:function(){return null}},{key:"set",value:function(e){if(e!==this.current||this.dirty){var t=this.gl;t.bindTexture(t.TEXTURE_2D,e),this.current=e,this.dirty=!1}}}]),i}(re),Ce=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"getDefault",value:function(){return null}},{key:"set",value:function(e){if(e!==this.current||this.dirty){var t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}}]),i}(re),Ae=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"getDefault",value:function(){return null}},{key:"set",value:function(e){var t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}]),i}(re),ze=function(e){p(i,e);var t=m(i);function i(e){var r;return h(this,i),(r=t.call(this,e)).vao=e.extVertexArrayObject,r}return d(i,[{key:"getDefault",value:function(){return null}},{key:"set",value:function(e){this.vao&&(e!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(e),this.current=e,this.dirty=!1)}}]),i}(re),Pe=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"getDefault",value:function(){return 4}},{key:"set",value:function(e){if(e!==this.current||this.dirty){var t=this.gl;t.pixelStorei(t.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}}]),i}(re),De=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"getDefault",value:function(){return!1}},{key:"set",value:function(e){if(e!==this.current||this.dirty){var t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}}]),i}(re),Le=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"getDefault",value:function(){return!1}},{key:"set",value:function(e){if(e!==this.current||this.dirty){var t=this.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}}]),i}(re),Re=function(e){p(i,e);var t=m(i);function i(e,r){var n;return h(this,i),(n=t.call(this,e)).context=e,n.parent=r,n}return d(i,[{key:"getDefault",value:function(){return null}}]),i}(re),Be=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"setDirty",value:function(){this.dirty=!0}},{key:"set",value:function(e){if(e!==this.current||this.dirty){this.context.bindFramebuffer.set(this.parent);var t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}}]),i}(Re),Oe=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"attachment",value:function(){return this.gl.DEPTH_ATTACHMENT}},{key:"set",value:function(e){if(e!==this.current||this.dirty){this.context.bindFramebuffer.set(this.parent);var t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,this.attachment(),t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}}]),i}(Re),Fe=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"attachment",value:function(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}]),i}(Oe),Ue=function(){function e(t,i,r,n){h(this,e),this.context=t,this.width=i,this.height=r;var a=this.framebuffer=t.gl.createFramebuffer();
1this.colorAttachment=new Be(t,a),n&&(this.depthAttachment=new Oe(t,a))}return d(e,[{key:"destroy",value:function(){var e=this.context.gl,t=this.colorAttachment.get();if(t&&e.deleteTexture(t),this.depthAttachment){var i=this.depthAttachment.get();i&&e.deleteRenderbuffer(i)}e.deleteFramebuffer(this.framebuffer)}}]),e}(),Ve=function(){function e(t){var i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(h(this,e),this.gl=t,this.isWebGL2=i,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),i){var r=t;this.extVertexArrayObject={createVertexArrayOES:r.createVertexArray.bind(t),deleteVertexArrayOES:r.deleteVertexArray.bind(t),bindVertexArrayOES:r.bindVertexArray.bind(t)}}this.clearColor=new ne(this),this.clearDepth=new ae(this),this.clearStencil=new oe(this),this.colorMask=new se(this),this.depthMask=new le(this),this.stencilMask=new ue(this),this.stencilFunc=new ce(this),this.stencilOp=new he(this),this.stencilTest=new fe(this),this.depthRange=new de(this),this.depthTest=new pe(this),this.depthFunc=new me(this),this.blend=new ve(this),this.blendFunc=new ye(this),this.blendColor=new _e(this),this.blendEquation=new ge(this),this.cullFace=new xe(this),this.cullFaceSide=new be(this),this.frontFace=new we(this),this.program=new ke(this),this.activeTexture=new Te(this),this.viewport=new Ee(this),this.bindFramebuffer=new Me(this),this.bindRenderbuffer=new Se(this),this.bindTexture=new Ie(this),this.bindVertexBuffer=new Ce(this),this.bindElementBuffer=new Ae(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new ze(this),this.pixelStoreUnpack=new Pe(this),this.pixelStoreUnpackPremultiplyAlpha=new De(this),this.pixelStoreUnpackFlipY=new Le(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureFilterAnisotropicForceOff=!1,this.extStandardDerivativesForceOff=!1,this.extDebugRendererInfo=t.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=t.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=t.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),i||(this.extTextureHalfFloat=t.getExtension("OES_texture_half_float")),(i||this.extTextureHalfFloat&&t.getExtension("OES_texture_half_float_linear"))&&(this.extRenderToTextureHalfFloat=t.getExtension("EXT_color_buffer_half_float")),this.extStandardDerivatives=i||t.getExtension("OES_standard_derivatives"),this.extTimerQuery=t.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE)}return d(e,[{key:"setDefault",value:function(){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()}},{key:"setDirty",value:function(){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.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}},{key:"createIndexBuffer",value:function(e,t){return new ee(this,e,t)}},{key:"createVertexBuffer",value:function(e,t,i){return new ie(this,e,t,i)}},{key:"createRenderbuffer",value:function(e,t,i){var r=this.gl,n=r.createRenderbuffer();return this.bindRenderbuffer.set(n),r.renderbufferStorage(r.RENDERBUFFER,e,t,i),this.bindRenderbuffer.set(null),n}},{key:"createFramebuffer",value:function(e,t,i){return new Ue(this,e,t,i)}}
1,{key:"clear",value:function(e){var t=e.color,i=e.depth,r=e.stencil,n=this.gl,a=0;t&&(a|=n.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),void 0!==i&&(a|=n.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(i),this.depthMask.set(!0)),void 0!==r&&(a|=n.STENCIL_BUFFER_BIT,this.clearStencil.set(r),this.stencilMask.set(255)),n.clear(a)}},{key:"setCullFace",value:function(e){!1===e.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}},{key:"setDepthMode",value:function(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)}},{key:"setStencilMode",value:function(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)}},{key:"setColorMode",value:function(e){n(e.blendFunction,i.ColorMode.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}},{key:"unbindVAO",value:function(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)}}]),e}(),je=function(e){p(r,e);var t=m(r);function r(e,n,a,o){var s;if(h(this,r),(s=t.call(this)).id=e,s.dispatcher=a,s.type="vector",s.minzoom=0,s.maxzoom=22,s.scheme="xyz",s.tileSize=512,s.reparseOverscaled=!0,s.isTileClipped=!0,s._loaded=!1,i.extend(y(s),i.pick(n,["url","scheme","tileSize","promoteId"])),s._options=i.extend({type:"vector"},n),s._collectResourceTiming=n.collectResourceTiming,512!==s.tileSize)throw new Error("vector tile sources must have a tileSize of 512");return s.setEventedParent(o),s._tileWorkers={},s._deduped=new i.DedupedRequest,v(s)}return d(r,[{key:"load",value:function(e){var t=this;this._loaded=!1,this.fire(new i.Event("dataloading",{dataType:"source"}));var r=Array.isArray(this.map._language)?this.map._language.join():this.map._language,n=this.map._worldview;this._tileJSONRequest=J(this._options,this.map._requestManager,r,n,function(a,o){t._tileJSONRequest=null,t._loaded=!0,a?(r&&console.warn("Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ".concat(r)),n&&2!==n.length&&console.warn("Requested worldview strings must be a valid ISO alpha-2 code. Found: ".concat(n)),t.fire(new i.ErrorEvent(a))):o&&(i.extend(t,o),o.bounds&&(t.tileBounds=new Q(o.bounds,t.minzoom,t.maxzoom)),i.postTurnstileEvent(o.tiles,t.map._requestManager._customAccessToken),t.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})),t.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"}))),e&&e(a)})}},{key:"loaded",value:function(){return this._loaded}},{key:"hasTile",value:function(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}},{key:"onAdd",value:function(e){this.map=e,this.load()}},{key:"reload",value:function(){var e=this;this.cancelTileJSONRequest(),this.load(function(){return e.map.style._clearSource(e.id)})}},{key:"setTiles",value:function(e){return this._options.tiles=e,this.reload(),this}},{key:"setUrl",value:function(e){return this.url=e,this._options.url=e,this.reload(),this}},{key:"onRemove",value:function(){this.cancelTileJSONRequest()}},{key:"serialize",value:function(){return i.extend({},this._options)}},{key:"loadTile",value:function(e,t){var r=this,n=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme)),a={request:this.map._requestManager.transformRequest(n,i.ResourceType.Tile),data:void 0,uid:e.uid,tileID:e.tileID,tileZoom:e.tileZoom,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.t
1ype,source:this.id,pixelRatio:i.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:e.isSymbolTile};if(a.request.collectResourceTiming=this._collectResourceTiming,e.actor&&"expired"!==e.state)"loading"===e.state?e.reloadCallback=t:e.request=e.actor.send("reloadTile",a,s.bind(this));else if(e.actor=this._tileWorkers[n]=this._tileWorkers[n]||this.dispatcher.getActor(),this.dispatcher.ready)e.request=e.actor.send("loadTile",a,s.bind(this),void 0,!0);else{var o=i.loadVectorTile.call({deduped:this._deduped},a,function(t,i){t||!i?s.call(r,t):(a.data={cacheControl:i.cacheControl,expires:i.expires,rawData:i.rawData.slice(0)},e.actor&&e.actor.send("loadTile",a,s.bind(r),void 0,!0))},!0);e.request={cancel:o}}function s(r,n){return delete e.request,e.aborted?t(null):r&&404!==r.status?t(r):(n&&n.resourceTiming&&(e.resourceTiming=n.resourceTiming),this.map._refreshExpiredTiles&&n&&e.setExpiryData(n),e.loadVectorData(n,this.map.painter),i.cacheEntryPossiblyAdded(this.dispatcher),t(null),void(e.reloadCallback&&(this.loadTile(e,e.reloadCallback),e.reloadCallback=null)))}}},{key:"abortTile",value:function(e){e.request&&(e.request.cancel(),delete e.request),e.actor&&e.actor.send("abortTile",{uid:e.uid,type:this.t
1ype,source:this.id})}},{key:"unloadTile",value:function(e){e.unloadVectorData(),e.actor&&e.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id})}},{key:"hasTransition",value:function(){return!1}},{key:"afterUpdate",value:function(){this._tileWorkers={}}},{key:"cancelTileJSONRequest",value:function(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}]),r}(i.Evented),Ne=function(e){p(r,e);var t=m(r);function r(e,n,a,o){var s;return h(this,r),(s=t.call(this)).id=e,s.dispatcher=a,s.setEventedParent(o),s.type="raster",s.minzoom=0,s.maxzoom=22,s.roundZoom=!0,s.scheme="xyz",s.tileSize=512,s._loaded=!1,s._options=i.extend({type:"raster"},n),i.extend(y(s),i.pick(n,["url","scheme","tileSize"])),s}return d(r,[{key:"load",value:function(e){var t=this;this._loaded=!1,this.fire(new i.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=J(this._options,this.map._requestManager,null,null,function(r,n){t._tileJSONRequest=null,t._loaded=!0,r?t.fire(new i.ErrorEvent(r)):n&&(i.extend(t,n),n.bounds&&(t.tileBounds=new Q(n.bounds,t.minzoom,t.maxzoom)),i.postTurnstileEvent(n.tiles),t.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})),t.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"}))),e&&e(r)})}},{key:"loaded",value:function(){return this._loaded}},{key:"onAdd",value:function(e){this.map=e,this.load()}},{key:"reload",value:function(){var e=this;this.cancelTileJSONRequest(),this.load(function(){return e.map.style._clearSource(e.id)})}},{key:"setTiles",value:function(e){return this._options.tiles=e,this.reload(),this}},{key:"setUrl",value:function(e){return this.url=e,this._options.url=e,this.reload(),this}},{key:"onRemove",value:function(){this.cancelTileJSONRequest()}},{key:"serialize",value:function(){return i.extend({},this._options)}},{key:"hasTile",value:function(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}},{key:"loadTile",value:function(e,t){var r=this,n=i.exported.devicePixelRatio>=2,a=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme),n,this.tileSize);e.request=i.getImage(this.map._requestManager.transformRequest(a,i.ResourceType.Tile),function(n,a,o,s){return delete e.request,e.aborted?(e.state="unloaded",t(null)):n?(e.state="errored",t(n)):a?(r.map._refreshExpiredTiles&&e.setExpiryData({cacheControl:o,expires:s}),e.setTexture(a,r.map.painter),e.state="loaded",i.cacheEntryPossiblyAdded(r.dispatcher),void t(null)):t(null)})}},{key:"abortTile",value:function(e,t){e.request&&(e.request.cancel(),delete e.request),t()}},{key:"unloadTile",value:function(e,t){e.texture&&this.map.painter.saveTileTexture(e.texture),t()}},{key:"hasTransition",value:function(){return!1}},{key:"cancelTileJSONRequest",value:function(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}],[{key:"loadTileData",value:function(e,t,i){e.setTexture(t,i)}},{key:"unloadTileData",value:function(e,t){e.texture&&t.saveTileTexture(e.texture)}}]),r}(i.Evented);function Ge(e,t,r,n,o,s,l,u){var c=[e,r,o,t,n,s,1,1,1],h=[l,u,1],f=i.adjoint([],c),d=a(i.transformMat3(h,h,i.transpose(f,f)),3),p=d[0],m=d[1],v=d[2];return i.multiply$1(c,[p,0,0,0,m,0,0,0,v],c)}var Ze=function(e){p(r,e);var t=m(r);function r(e,i,n,a){var o;return h(this,r),(o=t.call(this)).id=e,o.dispatcher=n,o.coordinates=i.coordinates,o.type="image",o.minzoom=0,o.maxzoom=22,o.tileSize=512,o.tiles={},o._loaded=!1,o.setEventedParent(a),o.options=i,o._dirty=!1,o}return d(r,[{key:"load",value:function(e,t){var r=this;this._loaded=t||!1,this.fire(new i.Event("dataloading",{dataType:"source"})),this.url=this.options.url,this._imageRequest=i.getImage(this.map._requestManager.transformRequest(this.url,i.ResourceType.Image),function(t,n){if(r._imageRequest=null,r._loaded=!0,t)r.fire(new i.ErrorEvent(t));else if(n){var a=i.window.HTMLImageElement;r.image=n instanceof a?i.exported.getImageData(n):n,r._dirty=!0,r.width=r.image.width,r.height=r.image.height,e&&(r.coordinates=e),r._finishLoading()}})}},{key:"loaded",value:function(){return this._loaded}},{key:"updateImage",value:function(e){return this.image&&e.url?(this._imageRequest&&e.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=e.url,this.load(e.coordinates,this._loaded),this):this}},{key:"_finishLoading",value:function(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})))}},{key:"onAdd",value:function(e){this.map=e,this.load()}},{key:"onRemove",value:function(){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),this.texture&&this.texture.destroy()}},{key:"setCoordinates",value:function(e){this.coordinates=e,this._boundsArray=void 0;var t=e.map(i.MercatorCoordinate.fromLngLat);return this.tileID=function(e){var t,r=1/0,n=1/0,a=-1/0,o=-1/0,s=l(e);try{for(s.s();!(t=s.n()).done;){var u=t.value;r=Math.min(r,u.x),n=Math.min(n,u.y),a=Math.max(a,u.x),o=Math.max(o,u.y)}}catch(d){s.e(d)}finally{s.f()}var c=Math.max(a-r,o-n),h=Math.max(0,Math.floor(-Math.log(c)/Math.LN2)),f=Math.pow(2,h);return new i.CanonicalTileID(h,Math.floor((r+a)/2*f),Math.floor((n+o)/2*f))}(t),this.minzoom=this.maxzoom=this.tileID.z,this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"})),this}},{key:"_clear",value:function(){this._boundsArray=void 0}},{key:"_prepareData",value:function(e){for(var t in this.tiles){var r=this.tiles[t];"loaded"!==r.state&&(r.state="loaded",r.texture=this.texture)}if(!this._boundsArray){var n=i.tileTransform(this.tileID,this.map.transform.projection),o=a(this.coordinates.map(function(e){var t=n.projection.project(e[0],e[1]);return i.getTilePoint(n,t)._round()}),4),s=o[0],l=o[1],u=o[2],c=o[3];this.perspectiveTransform=function(e,t,r,n,a,o,s,l,u,c){var h=Ge(0,0,e,0,0,t,e,t),f=Ge(r,n,a,o,s,l,u,c);return i.multiply$1(f,i.adjoint(h,h),f),[f[6]/f[8]*e/i.EXTENT,f[7]/f[8]*t/i.EXTENT]}(this.width,this.height,s.x,s.y,l.x,l.y,c.x,c.y,u.x,u.y);var h=this._boundsArray=new i.StructArrayLayout4i8;h.emplaceBack(s.x,s.y,0,0),h.emplaceBack(l.x,l.y,i.EXTENT,0),h.emplaceBack(c.x,c.y,0,i.EXTENT),h.emplaceBack(u.x,u.y,i.EXTENT,i.EXTENT),this.boundsBuffer&&this.boundsBuffer.destroy(),this.boundsBuffer=e.createVertexBuffer(h,i.boundsAttributes.members),this.boundsSegments=i.SegmentVector.simpleSegment(0,0,4,2)}}},{key:"prepare",value:function(){if(0!==Object.keys(this.tiles).length&&this.image){var e=this.map.painter.context,t=e.gl;this._dirty&&(this.texture?this.texture.update(this.image):(this.texture=new i.Texture(e,this.image,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE)),this._dirty=!1),this._prepareData(e)}}},{key:"loadTile",value:function(e,t){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},t(null)):(e.state="errored",t(null))}},{key:"serialize",value:function(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}},{key:"hasTransition",value:function(){return!1}}]),r}(i.Evented),qe={vector:je,raster:Ne,"raster-dem":function(e){p(r,e);var t=m(r);function r(e,n,a,o){var s;return h(this,r),(s=t.call(this,e,n,a,o)).type="raster-dem",s.maxzoom=22,s._options=i.extend({type:"raster-dem"},n),s.encoding=n.encoding||"mapbox",s}return d(r,[{key:"loadTile",value:function(e,t){var r=this.map._requestManager.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function n(i,r){i&&(e.state="errored",t(i)),r&&(e.dem=r,e.dem.onDeserialize(),e.needsHillshadePrepare=!0,e.needsDEMTextureUpload=!0,e.state="loaded",t(null))}e.request=i.getImage(this.map._requestManager.transformRequest(r,i.ResourceType.Tile),(function(r,a,o,s){if
1(delete e.request,e.aborted)e.state="unloaded",t(null);else if(r)e.state="errored",t(r);else if(a){this.map._refreshExpiredTiles&&e.setExpiryData({cacheControl:o,expires:s});var l=i.window.ImageBitmap&&a instanceof i.window.ImageBitmap&&(null==$&&($=i.window.OffscreenCanvas&&new i.window.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof i.window.createImageBitmap),$),u=1-(a.width-i.prevPowerOfTwo(a.width))/2;u<1||e.neighboringTiles||(e.neighboringTiles=this._getNeighboringTiles(e.tileID));var c=l?a:i.exported.getImageData(a,u),h={uid:e.uid,coord:e.tileID,source:this.id,rawImageData:c,encoding:this.encoding,padding:u};e.actor&&"expired"!==e.state||(e.actor=this.dispatcher.getActor(),e.actor.send("loadDEMTile",h,n.bind(this),void 0,!0))}}).bind(this))}},{key:"_getNeighboringTiles",value:function(e){var t=e.canonical,r=Math.pow(2,t.z),n=(t.x-1+r)%r,a=0===t.x?e.wrap-1:e.wrap,o=(t.x+1+r)%r,s=t.x+1===r?e.wrap+1:e.wrap,l={};return l[new i.OverscaledTileID(e.overscaledZ,a,t.z,n,t.y).key]={backfilled:!1},l[new i.OverscaledTileID(e.overscaledZ,s,t.z,o,t.y).key]={backfilled:!1},t.y>0&&(l[new i.OverscaledTileID(e.overscaledZ,a,t.z,n,t.y-1).key]={backfilled:!1},l[new i.OverscaledTileID(e.overscaledZ,e.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},l[new i.OverscaledTileID(e.overscaledZ,s,t.z,o,t.y-1).key]={backfilled:!1}),t.y+1<r&&(l[new i.OverscaledTileID(e.overscaledZ,a,t.z,n,t.y+1).key]={backfilled:!1},l[new i.OverscaledTileID(e.overscaledZ,e.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},l[new i.OverscaledTileID(e.overscaledZ,s,t.z,o,t.y+1).key]={backfilled:!1}),l}},{key:"unloadTile",value:function(e){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded"}}]),r}(Ne),geojson:function(e){p(r,e);var t=m(r);function r(e,n,a,o){var s;h(this,r),(s=t.call(this)).id=e,s.type="geojson",s.minzoom=0,s.maxzoom=18,s.tileSize=512,s.isTileClipped=!0,s.reparseOverscaled=!0,s._loaded=!1,s.actor=a.getActor(),s.setEventedParent(o),s._data=n.data,s._options=i.extend({},n),s._collectResourceTiming=n.collectResourceTiming,void 0!==n.maxzoom&&(s.maxzoom=n.maxzoom),n.type&&(s.type=n.type),n.attribution&&(s.attribution=n.attribution),s.promoteId=n.promoteId;var l=i.EXTENT/s.tileSize;return s.workerOptions=i.extend({source:s.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(void 0!==n.buffer?n.buffer:128)*l,tolerance:(void 0!==n.tolerance?n.tolerance:.375)*l,extent:i.EXTENT,maxZoom:s.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:void 0!==n.clusterMaxZoom?n.clusterMaxZoom:s.maxzoom-1,minPoints:Math.max(2,n.clusterMinPoints||2),extent:i.EXTENT,radius:(void 0!==n.clusterRadius?n.clusterRadius:50)*l,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions),s}return d(r,[{key:"onAdd",value:function(e){this.map=e,this.setData(this._data)}},{key:"setData",value:function(e){return this._data=e,this._updateWorkerData(),this}},{key:"getClusterExpansionZoom",value:function(e,t){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:e,source:this.id},t),this}},{key:"getClusterChildren",value:function(e,t){return this.actor.send("geojson.getClusterChildren",{clusterId:e,source:this.id},t),this}},{key:"getClusterLeaves",value:function(e,t,i,r){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:e,limit:t,offset:i},r),this}},{key:"_updateWorkerData",value:function(){var e=this;if(this._pendingLoad)this._coalesce=!0;else{this.fire(new i.Event("dataloading",{dataType:"source"})),this._loaded=!1;var t=i.extend({},this.workerOptions),r=this._data;"string"==typeof r?(t.request=this.map._requestManager.transformRequest(i.exported.resolveURL(r),i.ResourceType.Source),t.request.collectResourceTiming=this._collectResourceTiming):t.data=JSON.stringify(r),this._pendingLoad=this.actor.send("".concat(this.type,".loadData"),t,function(t,r){if(e._loaded=!0,e._pendingLoad=null,t)e.fire(new i.ErrorEvent(t));else{var n={dataType:"source",sourceDataType:e._metadataFired?"content":"metadata"};e._collectResourceTiming&&r&&r.resourceTiming&&r.resourceTiming[e.id]&&(n.resourceTiming=r.resourceTiming[e.id]),e.fire(new i.Event("data",n)),e._metadataFired=!0}e._coalesce&&(e._updateWorkerData(),e._coalesce=!1)})}}},{key:"loaded",value:function(){return this._loaded}},{key:"loadTile",value:function(e,t){var r=this,n=e.actor?"reloadTile":"loadTile";
1e.actor=this.actor,e.request=this.actor.send(n,{type:this.type,uid:e.uid,tileID:e.tileID,tileZoom:e.tileZoom,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:i.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},function(i,a){return delete e.request,e.unloadVectorData(),e.aborted?t(null):i?t(i):(e.loadVectorData(a,r.map.painter,"reloadTile"===n),t(null))},void 0,"loadTile"===n)}},{key:"abortTile",value:function(e){e.request&&(e.request.cancel(),delete e.request),e.aborted=!0}},{key:"unloadTile",value:function(e){e.unloadVectorData(),this.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id})}},{key:"onRemove",value:function(){this._pendingLoad&&this._pendingLoad.cancel()}},{key:"serialize",value:function(){return i.extend({},this._options,{type:this.type,data:this._data})}},{key:"hasTransition",value:function(){return!1}}]),r}(i.Evented),video:function(e){p(r,e);var t=m(r);function r(e,i,n,a){var o;return h(this,r),(o=t.call(this,e,i,n,a)).roundZoom=!0,o.type="video",o.options=i,o}return d(r,[{key:"load",value:function(){var e=this;this._loaded=!1;var t=this.options;this.urls=[];var r,n=l(t.urls);try{for(n.s();!(r=n.n()).done;){var a=r.value;this.urls.push(this.map._requestManager.transformRequest(a,i.ResourceType.Source).url)}}catch(o){n.e(o)}finally{n.f()}i.getVideo(this.urls,function(t,r){e._loaded=!0,t?e.fire(new i.ErrorEvent(t)):r&&(e.video=r,e.video.loop=!0,e.video.setAttribute("playsinline",""),e.video.addEventListener("playing",function(){e.map.triggerRepaint()}),e.map&&e.video.play(),e._finishLoading())})}},{key:"pause",value:function(){this.video&&this.video.pause()}},{key:"play",value:function(){this.video&&this.video.play()}},{key:"seek",value:function(e){if(this.video){var t=this.video.seekable;e<t.start(0)||e>t.end(0)?this.fire(new i.ErrorEvent(new i.ValidationError("sources.".concat(this.id),null,"Playback for this video can be set only between the ".concat(t.start(0)," and ").concat(t.end(0),"-second mark.")))):this.video.currentTime=e}}},{key:"getVideo",value:function(){return this.video}},{key:"onAdd",value:function(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}},{key:"prepare",value:function(){if(!(0===Object.keys(this.tiles).length||this.video.readyState<2)){var e=this.map.painter.context,t=e.gl;this.texture?this.video.paused||(this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.texture=new i.Texture(e,this.video,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(e)}}},{key:"serialize",value:function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}},{key:"hasTransition",value:function(){return this.video&&!this.video.paused}}]),r}(Ze),image:Ze,canvas:function(e){p(r,e);var t=m(r);function r(e,n,a,o){var s;return h(this,r),s=t.call(this,e,n,a,o),n.coordinates?Array.isArray(n.coordinates)&&4===n.coordinates.length&&!n.coordinates.some(function(e){return!Array.isArray(e)||2!==e.length||e.some(function(e){return"number"!=typeof e})})||s.fire(new i.ErrorEvent(new i.ValidationError("sources.".concat(e),null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):s.fire(new i.ErrorEvent(new i.ValidationError("sources.".concat(e),null,'missing required property "coordinates"'))),n.animate&&"boolean"!=typeof n.animate&&s.fire(new i.ErrorEvent(new i.ValidationError("sources.".concat(e),null,'optional "animate" property must be a boolean value'))),n.canvas?"string"==typeof n.canvas||n.canvas instanceof i.window.HTMLCanvasElement||s.fire(new i.ErrorEvent(new i.ValidationError("sources.".concat(e),null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):s.fire(new i.ErrorEvent(new i.ValidationError("sources.".concat(e),null,'missing required property "canvas"'))),s.options=n,s.animate=void 0===n.animate||n.animate,s}return d(r,[{key:"load",value:function(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof i.window.HTMLCanvasElement?this.options.canvas:i.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new i.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}},{key:"getCanvas",value:function(){return this.canvas}},{key:"onAdd",value:function(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}},{key:"onRemove",value:function(){this.pause()}},{key:"prepare",value:function(){var e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),!this._hasInvalidDimensions()&&0!==Object.keys(this.tiles).length){var t=this.map.painter.context;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new i.Texture(t,this.canvas,t.gl.RGBA,{premultiply:!0}),this._prepareData(t)}}},{key:"serialize",value:function(){return{type:"canvas",coordinates:this.coordinates}}},{key:"hasTransition",value:function(){return this._playing}},{key:"_hasInvalidDimensions",value:function(){for(var e=0,t=[this.canvas.width,this.canvas.height];e<t.length;e++){var i=t[e];if(isNaN(i)||i<=0)return!0}return!1}}]),r}(Ze),custom:function(e){p(r,e);var t=m(r);function r(e,n,a,o){var s;return h(this,r),(s=t.call(this)).id=e,s.type="custom",s._dataType="raster",s._dispatcher=a,s._implementation=n,s.setEventedParent(o),s.scheme="xyz",s.minzoom=0,s.maxzoom=22,s.tileSize=512,s._loaded=!1,s.roun
1dZoom=!0,s._implementation||s.fire(new i.ErrorEvent(new Error("Missing implementation for ".concat(s.id," custom source")))),s._implementation.loadTile||s.fire(new i.ErrorEvent(new Error("Missing loadTile implementation for ".concat(s.id," custom source")))),s._implementation.bounds&&(s.tileBounds=new Q(s._implementation.bounds,s.minzoom,s.maxzoom)),n.update=s._update.bind(y(s)),n.clearTiles=s._clearTiles.bind(y(s)),n.coveringTiles=s._coveringTiles.bind(y(s)),i.extend(y(s),i.pick(n,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"])),s}return d(r,[{key:"serialize",value:function(){return i.pick(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}},{key:"load",value:function(){this._loaded=!0,this.fire(new i.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"}))}},{key:"loaded",value:function(){return this._loaded}},{key:"onAdd",value:function(e){this._map=e,this._loaded=!1,this.fire(new i.Event("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(e),this.load()}},{key:"onRemove",value:function(e){this._implementation.onRemove&&this._implementation.onRemove(e)}},{key:"hasTile",value:function(e){if(this._implementation.hasTile){var t=e.canonical,i=t.x,r=t.y,n=t.z;return this._implementation.hasTile({x:i,y:r,z:n})}return!this.tileBounds||this.tileBounds.contains(e.canonical)}},{key:"loadTile",value:function(e,t){var r=e.tileID.canonical,n=r.x,a=r.y,o=r.z,s=new i.window.AbortController;e.request=Promise.resolve(this._implementation.loadTile({x:n,y:a,z:o},{signal:s.signal})).then((function(r){return delete e.request,e.aborted?(e.state="unloaded",t(null)):void 0===r?(e.state="errored",t(null)):null===r?(this.loadTileData(e,{width:this.tileSize,height:this.tileSize,data:null}),e.state="loaded",t(null)):(n=r)instanceof i.window.ImageData||n instanceof i.window.HTMLCanvasElement||n instanceof i.window.ImageBitmap||n instanceof i.window.HTMLImageElement?(this.loadTileData(e,r),e.state="loaded",void t(null)):(e.state="errored",t(new Error("Can't infer data type for ".concat(this.id,", only raster data supported at the moment"))));var n}).bind(this)).catch(function(i){20!==i.code&&(e.state="errored",t(i))}),e.request.cancel=function(){return s.abort()}}},{key:"loadTileData",value:function(e,t){Ne.loadTileData(e,t,this._map.painter)}},{key:"unloadTileData",value:function(e){Ne.unloadTileData(e,this._map.painter)}},{key:"unloadTile",value:function(e,t){if(this.unloadTileData(e),this._implementation.unloadTile){var i=e.tileID.canonical,r=i.x,n=i.y,a=i.z;this._implementation.unloadTile({x:r,y:n,z:a})}t()}},{key:"abortTile",value:function(e,t){e.request&&e.request.cancel&&(e.request.cancel(),delete e.request),t()}},{key:"hasTransition",value:function(){return!1}},{key:"_coveringTiles",value:function(){return this._map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(function(e){return{x:e.canonical.x,y:e.canonical.y,z:e.canonical.z}})}},{key:"_clearTiles",value:function(){this._map.style._clearSource(this.id)}},{key:"_update",value:function(){this.fire(new i.Event("data",{dataType:"source",sourceDataType:"content"}))}}]),r}(i.Evented)},We=function(e,t,r,n){var a=new qe[t.type](e,t,r,n);if(a.id!==e)throw new Error("Expected Source id to be ".concat(e," instead of ").concat(a.id));return i.bindAll(["load","abort","unload","serialize","prepare"],a),a};function Xe(e,t){var r=i.identity([]);return i.scale(r,r,[.5*e.width,.5*-e.height,1]),i.translate(r,r,[1,-1,0]),i.multiply(r,r,e.calculateProjMatrix(t.toUnwrapped())),Float32Array.from(r)}function He(e,t,i,r,n,a,o){var s=arguments.length>7&&void 0!==arguments[7]&&arguments[7],u=e.tilesIn(r,o,s);u.sort(Ke);var c,h=[],f=l(u);try{for(f.s();!(c=f.n()).done;){var d=c.value;h.push({wrappedTileID:d.tile.tileID.wrapped().key,queryResults:d.tile.queryRenderedFeatures(t,i,e._state,d,n,a,Xe(e.transform,d.tile.tileID),s)})}}catch(v){f.e(v)}finally{f.f()}var p=function(e){var t,i={},r={},n=l(e);try{for(n.s();!(t=n.n()).done;){var a=t.value,o=a.queryResults,s=a.wrappedTileID,u=r[s]=r[s]||{};for(var c in o){var h,f=o[c],d=u[c]=u[c]||{},p=i[c]=i[c]||[],m=l(f);try{for(m.s();!(h=m.n()).done;){var y=h.value;d[y.featureIndex]||(d[y.featureIndex]=!0,p.push(y))}}catch(v){m.e(v)}finally{m.f()}}}}catch(v){n.e(v)}finally{n.f()}return i}(h);for(var m in p)p[m].forEach(function(t){var i=t.feature,r=i.layer;r&&"background"!==r.type&&"sky"!==r.type&&(i.source=r.source,r["source-layer"]&&(i.sourceLayer=r["source-layer"]),i.state=void 0!==i.id?e.getFeatureState(r["source-layer"],i.id):{})});return p}function Ye(e,t){for(var i=e.getRenderableIds().map(function(t){return e.getTileByID(t)}),r=[],n={},a=0;a<i.length;a++){var o=i[a],s=o.tileID.canonical.key;n[s]||(n[s]=!0,o.querySourceFeatures(r,t))}return r}function Ke(e,t){var i=e.tileID,r=t.tileID;return i.overscaledZ-r.overscaledZ||i.canonical.y-r.canonical.y||i.wrap-r.wrap||i.canonical.x-r.canonical.x}function Je(){return null!=Ea.workerClass?new Ea.workerClass:new i.window.Worker(Ea.workerUrl)}var $e,Qe="mapboxgl_preloaded_worker_pool",et=function(){function e(){h(this,e),this.active={}}return d(e,[{key:"acquire",value:function(t){if(!this.workers)for(this.workers=[];this.workers.length<e.workerCount;)this.workers.push(new Je);return this.active[t]=!0,this.workers.slice()}},{key:"release",value:function(e){delete this.active[e],0===this.numActive()&&(this.workers.forEac
1h(function(e){e.terminate()}),this.workers=null)}},{key:"isPreloaded",value:function(){return!!this.active[Qe]}},{key:"numActive",value:function(){return Object.keys(this.active).length}}]),e}();function tt(){return $e||($e=new et),$e}function it(e,t){var r={};for(var n in e)"ref"!==n&&(r[n]=e[n]);return i.refProperties.forEach(function(e){e in t&&(r[e]=t[e])}),r}function rt(e){e=e.slice();for(var t=Object.create(null),i=0;i<e.length;i++)t[e[i].id]=e[i];for(var r=0;r<e.length;r++)"ref"in e[r]&&(e[r]=it(e[r],t[e[r].ref]));return e}et.workerCount=2;var nt={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",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",setProjection:"setProjection"};function at(e,t,i){i.push({command:nt.addSource,args:[e,t[e]]})}function ot(e,t,i){t.push({command:nt.removeSource,args:[e]}),i[e]=!0}function st(e,t,i,r){ot(e,i,r),at(e,t,i)}function lt(e,t,i){var r;for(r in e[i])if(e[i].hasOwnProperty(r)&&"data"!==r&&!n(e[i][r],t[i][r]))return!1;for(r in t[i])if(t[i].hasOwnProperty(r)&&"data"!==r&&!n(e[i][r],t[i][r]))return!1;return!0}function ut(e,t,i,r,a,o){var s;for(s in t=t||{},e=e||{})e.hasOwnProperty(s)&&(n(e[s],t[s])||i.push({command:o,args:[r,s,t[s],a]}));for(s in t)t.hasOwnProperty(s)&&!e.hasOwnProperty(s)&&(n(e[s],t[s])||i.push({command:o,args:[r,s,t[s],a]}))}function ct(e){return e.id}function ht(e,t){return e[t.id]=t,e}var ft=function(){function e(t,i){h(this,e),this.reset(t,i)}return d(e,[{key:"reset",value:function(e,t){this.points=e||[],this._distances=[0];for(var i=1;i<this.points.length;i++)this._distances[i]=this._distances[i-1]+this.points[i].dist(this.points[i-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t||0,.5*this.length),this.paddedLength=this.length-2*this.padding}},{key:"lerp",value:function(e){if(1===this.points.length)return this.points[0];e=i.clamp(e,0,1);for(var t=1,r=this._distances[t],n=e*this.paddedLength+this.padding;r<n&&t<this._distances.length;)r=this._distances[++t];var a=t-1,o=this._distances[a],s=r-o,l=s>0?(n-o)/s:0;return this.points[a].mult(1-l).add(this.points[t].mult(l))}}]),e}(),dt=function(){function e(t,i,r){h(this,e);var n=this.boxCells=[],a=this.circleCells=[];this.xCellCount=Math.ceil(t/r),this.yCellCount=Math.ceil(i/r);for(var o=0;o<this.xCellCount*this.yCellCount;o++)n.push([]),a.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=i,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/i,this.boxUid=0,this.circleUid=0}return d(e,[{key:"keysLength",value:function(){return this.boxKeys.length+this.circleKeys.length}},{key:"insert",value:function(e,t,i,r,n){this._forEachCell(t,i,r,n,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)}},{key:"insertCircle",value:function(e,t,i,r){this._forEachCell(t-r,i-r,t+r,i+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(i),this.circles.push(r)}},{key:"_insertBoxCell",value:function(e,t,i,r,n,a){this.boxCells[n].push(a)}},{key:"_insertCircleCell",value:function(e,t,i,r,n,a){this.circleCells[n].push(a)}},{key:"_query",value:function(e,t,i,r,n,a){if(i<0||e>this.width||r<0||t>this.height)return!n&&[];var o=[];if(e<=0&&t<=0&&this.width<=i&&this.height<=r){if(n)return!0;for(var s=0;s<this.boxKeys.length;s++)o.push({key:this.boxKeys[s],x1:this.bboxes[4*s],y1:this.bboxes[4*s+1],x2:this.bboxes[4*s+2],y2:this.bboxes[4*s+3]});for(var l=0;l<this.circleKeys.length;l++){var u=this.circles[3*l],c=this.circles[3*l+1],h=this.circles[3*l+2];o.push({key:this.circleKeys[l],x1:u-h,y1:c-h,x2:u+h,y2:c+h})}return a?o.filter(a):o}
1return this._forEachCell(e,t,i,r,this._queryCell,o,{hitTest:n,seenUids:{box:{},circle:{}}},a),n?o.length>0:o}},{key:"_queryCircle",value:function(e,t,i,r,n){var a=e-i,o=e+i,s=t-i,l=t+i;if(o<0||a>this.width||l<0||s>this.height)return!r&&[];var u=[];return this._forEachCell(a,s,o,l,this._queryCellCircle,u,{hitTest:r,circle:{x:e,y:t,radius:i},seenUids:{box:{},circle:{}}},n),r?u.length>0:u}},{key:"query",value:function(e,t,i,r,n){return this._query(e,t,i,r,!1,n)}},{key:"hitTest",value:function(e,t,i,r,n){return this._query(e,t,i,r,!0,n)}},{key:"hitTestCircle",value:function(e,t,i,r){return this._queryCircle(e,t,i,!0,r)}},{key:"_queryCell",value:function(e,t,i,r,n,a,o,s){var u=o.seenUids,c=this.boxCells[n];if(null!==c){var h,f=this.bboxes,d=l(c);try{for(d.s();!(h=d.n()).done;){var p=h.value;if(!u.box[p]){u.box[p]=!0;var m=4*p;if(e<=f[m+2]&&t<=f[m+3]&&i>=f[m+0]&&r>=f[m+1]&&(!s||s(this.boxKeys[p]))){if(o.hitTest)return a.push(!0),!0;a.push({key:this.boxKeys[p],x1:f[m],y1:f[m+1],x2:f[m+2],y2:f[m+3]})}}}}catch(E){d.e(E)}finally{d.f()}}var v=this.circleCells[n];if(null!==v){var y,_=this.circles,g=l(v);try{for(g.s();!(y=g.n()).done;){var x=y.value;if(!u.circle[x]){u.circle[x]=!0;var b=3*x;if(this._circleAndRectCollide(_[b],_[b+1],_[b+2],e,t,i,r)&&(!s||s(this.circleKeys[x]))){if(o.hitTest)return a.push(!0),!0;var w=_[b],k=_[b+1],T=_[b+2];a.push({key:this.circleKeys[x],x1:w-T,y1:k-T,x2:w+T,y2:k+T})}}}}catch(E){g.e(E)}finally{g.f()}}}},{key:"_queryCellCircle",value:function(e,t,i,r,n,a,o,s){var u=o.circle,c=o.seenUids,h=this.boxCells[n];if(null!==h){var f,d=this.bboxes,p=l(h);try{for(p.s();!(f=p.n()).done;){var m=f.value;if(!c.box[m]){c.box[m]=!0;var v=4*m;if(this._circleAndRectCollide(u.x,u.y,u.radius,d[v+0],d[v+1],d[v+2],d[v+3])&&(!s||s(this.boxKeys[m])))return a.push(!0),!0}}}catch(k){p.e(k)}finally{p.f()}}var y=this.circleCells[n];if(null!==y){var _,g=this.circles,x=l(y);try{for(x.s();!(_=x.n()).done;){var b=_.value;if(!c.circle[b]){c.circle[b]=!0;var w=3*b;if(this._circlesCollide(g[w],g[w+1],g[w+2],u.x,u.y,u.radius)&&(!s||s(this.circleKeys[b])))return a.push(!0),!0}}}catch(k){x.e(k)}finally{x.f()}}}},{key:"_forEachCell",value:function(e,t,i,r,n,a,o,s){for(var l=this._convertToXCellCoord(e),u=this._convertToYCellCoord(t),c=this._convertToXCellCoord(i),h=this._convertToYCellCoord(r),f=l;f<=c;f++)for(var d=u;d<=h;d++)if(n.call(this,e,t,i,r,this.xCellCount*d+f,a,o,s))return}},{key:"_convertToXCellCoord",value:function(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}},{key:"_convertToYCellCoord",value:function(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}},{key:"_circlesCollide",value:function(e,t,i,r,n,a){var o=r-e,s=n-t,l=i+a;return l*l>o*o+s*s}},{key:"_circleAndRectCollide",value:function(e,t,i,r,n,a,o){var s=(a-r)/2,l=Math.abs(e-(r+s));if(l>s+i)return!1;var u=(o-n)/2,c=Math.abs(t-(n+u));if(c>u+i)return!1;if(l<=s||c<=u)return!0;var h=l-s,f=c-u;return h*h+f*f<=i*i}}]),e}(),pt=Math.tan(85*Math.PI/180);function mt(e,t,r,n,a,o,s){var l=i.create();if(r)if("globe"===o.name){var u=i.calculateGlobeLabelMatrix(a,t);i.multiply(l,l,u)}else{var c=z([],s);l[0]=c[0],l[1]=c[1],l[4]=c[2],l[5]=c[3],n||i.rotateZ(l,l,a.angle)}else i.multiply(l,a.labelPlaneMatrix,e);return l}function vt(e,t,i,r,n,a,o){var s=mt(e,t,i,r,n,a,o);return"globe"===a.name&&i||(s[2]=s[6]=s[10]=s[14]=0),s}function yt(e,t,r,n,a,o,s){if(r){if("globe"===o.name){var l=mt(e,t,r,n,a,o,s);return i.invert(l,l),i.multiply(l,e,l),l}var u=i.clone(e),c=i.identity([]);return c[0]=s[0],c[1]=s[1],c[4]=s[2],c[5]=s[3],i.multiply(u,u,c),n||i.rotateZ(u,u,-a.angle),u}return a.glCoordMatrix}function _t(e,t,r,n){var a=[e,t,r,1];r?i.transformMat4$1(a,a,n):Ct(a,a,n);var o=a[3];return a[0]/=o,a[1]/=o,a[2]/=o,a}function gt(e,t){return Math.min(.5+e/t*.5,1.5)}function xt(e,t){var i=e[0]/e[3],r=e[1]/e[3];return i>=-t[0]&&i<=t[0]&&r>=-t[1]&&r<=t[1]}function bt(e,t,r,n,o,s,l,u,c,h){var f=r.transform,d=n?e.textSizeData:e.iconSizeData,p=i.evaluateSizeForZoom(d,r.transform.zoom),m="globe"===f.projection.name,v=[256/r.width*2+1,256/r.height*2+1],y=n?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;y.clear();var _=null;m&&(_=n?e.text.globeExtVertexArray:e.icon.globeExtVertexArray);for(var g,x=e.lineVertexArray,b=n?e.text.placedSymbolArray:e.icon.placedSymbolArray,w=r.transform.width/r.transform.height,k=!1,T=0;T<b.length;T++){var E=b.get(T),M=E.numGlyphs,S=E.writingMode;if(S!==i.WritingMode.vertical||k||g===i.WritingMode.horizontal||(k=!0),g=S,!E.hidden&&S!==i.WritingMode.vertical||k){k=!1;var I=new i.pointGeometry(E.tileAnchorX,E.tileAnchorY),C=f.projection.projectTilePoint(I.x,I.y,h.canonical),A=C.x,z=C.y,P=C.z;if(c){var D=a(c(I),3);A+=D[0],z+=D[1],P+=D[2]}var L=[A,z,P,1];if(i.transformMat4$1(L,L,t),xt(L,v)){var R=gt(r.transform.cameraToCenterDistance,L[3]),B=i.evaluateSizeForFeature
1(d,p,E),O=l?B/R:B*R,F=_t(A,z,P,o);if(F[3]<=0)It(M,y);else{var U={},V=l?null:c,j=Tt(E,O,!1,u,t,o,s,e.glyphOffsetArray,x,y,_,F,I,U,w,V,f.projection,h,l);k=j.useVertical,V&&j.needsFlipping&&(U={}),(j.notEnoughRoom||k||j.needsFlipping&&Tt(E,O,!0,u,t,o,s,e.glyphOffsetArray,x,y,_,F,I,U,w,V,f.projection,h,l).notEnoughRoom)&&It(M,y)}}else It(M,y)}else It(M,y)}n?(e.text.dynamicLayoutVertexBuffer.updateData(y),_&&e.text.globeExtVertexBuffer.updateData(_)):(e.icon.dynamicLayoutVertexBuffer.updateData(y),_&&e.icon.globeExtVertexBuffer.updateData(_))}function wt(e,t,i,r,n,a,o,s,l,u,c,h,f,d,p,m){var v=s.lineStartIndex,y=s.glyphStartIndex,_=s.segment,g=y+s.numGlyphs,x=v+s.lineLength,b=t.getoffsetX(y),w=t.getoffsetX(g-1),k=St(e*b,i,r,n,a,o,_,v,x,l,u,c,h,f,!0,d,p,m);if(!k)return null;var T=St(e*w,i,r,n,a,o,_,v,x,l,u,c,h,f,!0,d,p,m);return T?{first:k,last:T}:null}function kt(e,t,r,n){return e===i.WritingMode.horizontal&&Math.abs(n)>Math.abs(r)?{useVertical:!0}:e===i.WritingMode.vertical?n>0?{needsFlipping:!0}:null:0!==t&&(0===(a=r)||Math.abs(n/a)>pt)?1===t?{needsFlipping:!0}:null:r<0?{needsFlipping:!0}:null;var a}function Tt(e,t,r,n,o,s,l,u,c,h,f,d,p,m,v,y,_,g,x){var b=t/24,w=e.lineOffsetX*b,k=e.lineOffsetY*b,T=e.lineStartIndex,E=e.glyphStartIndex,M=e.numGlyphs,S=e.segment,I=e.writingMode,C=e.flipState,A=T+e.lineLength,z=function(e){if(f){var t=a(e.up,3),r=t[0],n=t[1],o=t[2],s=h.length;i.updateGlobeVertexNormal(f,s+0,r,n,o),i.updateGlobeVertexNormal(f,s+1,r,n,o),i.updateGlobeVertexNormal(f,s+2,r,n,o),i.updateGlobeVertexNormal(f,s+3,r,n,o)}var l=a(e.point,3),u=l[0],c=l[1],d=l[2];i.addDynamicAttributes(h,u,c,d,e.angle)};if(M>1){var P=wt(b,u,w,k,r,d,p,e,c,s,m,y,!1,_,g,x);if(!P)return{notEnoughRoom:!0};if(n&&!r){var D,L,R=a(P.first.point,3),B=R[0],O=R[1],F=R[2],U=a(P.last.point,3),V=U[0],j=U[1],N=U[2];B=(D=a(_t(B,O,F,l),2))[0],O=D[1];var G=kt(I,C,((V=(L=a(_t(V,j,N,l),2))[0])-B)*v,(j=L[1])-O);if(e.flipState=G&&G.needsFlipping?1:2,G)return G}z(P.first);for(var Z=E+1;Z<E+M-1;Z++){var q=St(b*u.getoffsetX(Z),w,k,r,d,p,S,T,A,c,s,m,y,!1,!1,_,g,x);if(!q)return h.length-=4*(Z-E),{notEnoughRoom:!0};z(q)}z(P.last)}else{if(n&&!r){var W=_t(p.x,p.y,0,o),X=T+S+1,H=new i.pointGeometry(c.getx(X),c.gety(X)),Y=_t(H.x,H.y,0,o),K=Y[3]>0?Y:Mt(p,H,W,1,o,void 0,_,g.canonical),J=kt(I,C,(K[0]-W[0])*v,K[1]-W[1]);if(e.flipState=J&&J.needsFlipping?1:2,J)return J}var $=St(b*u.getoffsetX(E),w,k,r,d,p,S,T,A,c,s,m,y,!1,!1,_,g,x);if(!$)return{notEnoughRoom:!0};z($)}return{}}function Et(e,t,i,r,n){var o=r.projectTilePoint(e.x,e.y,t),s=o.x,l=o.y,u=o.z;if(!n)return _t(s,l,u,i);var c=a(n(e),3);return _t(s+c[0],l+c[1],u+c[2],i)}function Mt(e,t,r,n,a,o,s,l){var u=Et(e.sub(t)._unit()._add(e),l,a,s,o);return i.sub(u,r,u),i.normalize(u,u),i.scaleAndAdd(u,r,u,n)}function St(e,t,r,n,a,o,s,l,u,c,h,f,d,p,m,v,y,_){var g=n?e-t:e+t,x=g>0?1:-1,b=0;n&&(x*=-1,b=Math.PI),x<0&&(b+=Math.PI);for(var w=l+s+(x>0?0:1)|0,k=a,T=a,E=0,M=0,S=Math.abs(g),I=[],C=[],A=o,z=A,P=function(){return Mt(z,A,T,S-E+1,h,d,v,y.canonical)};E+M<=S;){if((w+=x)<l||w>=u)return null;if(T=k,z=A,I.push(T),p&&C.push(z),A=new i.pointGeometry(c.getx(w),c.gety(w)),!(k=f[w])){var D=Et(A,y.canonical,h,v,d);k=D[3]>0?f[w]=D:P()}E+=M,M=i.distance(T,k)}m&&d&&(f[w]&&(k=P(),M=i.distance(T,k)),f[w]=k);var L=(S-E)/M,R=A.sub(z)._mult(L)._add(z),B=i.sub([],k,T),O=i.scaleAndAdd([],T,B,L),F=[0,0,1],U=B[0],V=B[1];if(_&&(0!==(F=v.upVector(y.canonical,R.x,R.y))[0]||0!==F[1]||1!==F[2])){var j=[F[2],0,-F[0]],N=i.cross([],F,j);i.normalize(j,j),i.normalize(N,N),U=i.dot(B,j),V=i.dot(B,N)}if(r){var G=i.cross([],F,B);i.normalize(G,G),i.scaleAndAdd(O,O,G,r*x)}var Z=b+Math.atan2(V,U);return I.push(O),p&&C.push(R),{point:O,angle:Z,path:I,tilePath:C,up:F}}function It(e,t){var i=t.length,r=i+4*e;t.resize(r),t.float32.fill(-1/0,4*i,4*r)}function Ct(e,t,i){var r=t[0],n=t[1];return e[0]=i[0]*r+i[4]*n+i[12],e[1]=i[1]*r+i[5]*n+i[13],e[3]=i[3]*r+i[7]*n+i[15],e}var At=100,zt=function(){function e(t,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new dt(t.width+200,t.height+200,25),n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new dt(t.width+200,t.height+200,25);h(this,e),this.transform=t,this.grid=r,this.ignoredGrid=n,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+At,this.screenBottomBoundary=t.height+At,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.fogState=i}return d(e,[{key:"placeCollisionBox",value:function(e,t,i,r,n,o,s,l){var u=i.projectedAnchorX,c=i.projectedAnchorY,h=i.projectedAnchorZ,f=i.elevation,d=i.tileID,p=e.getProjection();if(f&&d){var m=a(p.upVector(d.canonical,i.tileAnchorX,i.tileAnchorY),3),v=m[0],y=m[1],_=m[2],g=p.upVectorScale(d.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;u+=v*f*g,c+=y*f*g,h+=_*f*g}var x=this.projectAndGetPerspectiveRatio(s,u,c,h,i.tileID,"globe"===p.name||!!f||this.transform.pitch>0,p),b=o*x.perspectiveRatio,w=(i.x1*t+r.x-i.padding)*b+x.point.x,k=(i.y1*t+r.y-i.padding)*b+x.point.y,T=(i.x2*t+r.x+i.padding)*b+x.point.x,E=(i.y2*t+r.y+i.padding)*b+x.point.y,M=x.perspectiveRatio<=.55||x.occluded;return!this.isInsideGrid(w,k,T,E)||!n&&this.grid.hitTest(w,k,T,E,l)||M?{box:[],offscreen:!1,occluded:x.occluded}:{box:[w,k,T,E],offscreen:this.isOffscreen(w,k,T,E),occluded:!1}}},{key:"placeCollisionCircles",value:function(e,t,r,n,o,s,u,c,h,f,d,p,m,v,y){var _=[],g=this.transform.elevation,x=e.getProjection(),b=g?g.getAtTileOffsetFunc(y,this.transform.center.lat,this.transform.worldSize,x):null,w=new i.pointGeometry(r.tileAnchorX,r.tileAnchorY),k=x.projectTilePoint(w.x,w.y,y.canonical),T=k.x,E=k.y,M=k.z;if(b){var S=a(b(w),3);T+=S[0],E+=S[1],M+=S[2]}var I="globe"===x.name,C=this.projectAndGetPerspectiveRatio(u,T,E,M,y,I||!!g||this.transform.pitch>0,x),A=C.perspectiveRatio,z=(d?s/A:s*A)/i.ONE_EM,P=_t(T,E,M,c),D=C.signedDistanceFromCamera>0?wt(z,o,r.lineOffsetX*z,r.lineOffsetY*z,!1,P,w,r,n,c,{},g&&!d?b:null,d&&!!g,x,y,d):null,L=!1,R=!1,B=!0;if(D&&!C.occluded){for(var O=.5*m*A+v,F=new i.pointGeometry(-100,-100),U=new i.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),V=new ft,j=D.first,N=D.last,G=j.path.length,Z=[],q=G-1;q>=1;q--)Z.push(j.path[q]);for(var W=1;W<N.path.length;W++)Z.push(N.path[W]);var X=2.5*O;
1h&&((Z=Z.map(function(e,t){var i=a(e,3),r=i[0],n=i[1],o=i[2];return b&&!I&&(o=b(t<G-1?j.tilePath[G-1-t]:N.tilePath[t-G+2])[2]),_t(r,n,o,h)})).some(function(e){return e[3]<=0})&&(Z=[]));var H=[];if(Z.length>0){var Y,K=1/0,J=-1/0,$=1/0,Q=-1/0,ee=l(Z);try{for(ee.s();!(Y=ee.n()).done;){var te=Y.value;K=Math.min(K,te[0]),$=Math.min($,te[1]),J=Math.max(J,te[0]),Q=Math.max(Q,te[1])}}catch(me){ee.e(me)}finally{ee.f()}J>=F.x&&K<=U.x&&Q>=F.y&&$<=U.y&&(H=[Z.map(function(e){return new i.pointGeometry(e[0],e[1])})],(K<F.x||J>U.x||$<F.y||Q>U.y)&&(H=i.clipLine(H,F.x,F.y,U.x,U.y)))}var ie,re=l(H);try{for(re.s();!(ie=re.n()).done;){var ne=ie.value;V.reset(ne,.25*O);var ae;ae=V.length<=.5*O?1:Math.ceil(V.paddedLength/X)+1;for(var oe=0;oe<ae;oe++){var se=oe/Math.max(ae-1,1),le=V.lerp(se),ue=le.x+At,ce=le.y+At;_.push(ue,ce,O,0);var he=ue-O,fe=ce-O,de=ue+O,pe=ce+O;if(B=B&&this.isOffscreen(he,fe,de,pe),R=R||this.isInsideGrid(he,fe,de,pe),!t&&this.grid.hitTestCircle(ue,ce,O,p)&&(L=!0,!f))return{circles:[],offscreen:!1,collisionDetected:L,occluded:!1}}}}catch(me){re.e(me)}finally{re.f()}}return{circles:!f&&L||!R?[]:_,offscreen:B,collisionDetected:L,occluded:C.occluded}}},{key:"queryRenderedSymbols",value:function(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};var t,r=[],n=1/0,a=1/0,o=-1/0,s=-1/0,u=l(e);try{for(u.s();!(t=u.n()).done;){var c=t.value,h=new i.pointGeometry(c.x+At,c.y+At);n=Math.min(n,h.x),a=Math.min(a,h.y),o=Math.max(o,h.x),s=Math.max(s,h.y),r.push(h)}}catch(g){u.e(g)}finally{u.f()}var f,d={},p={},m=l(this.grid.query(n,a,o,s).concat(this.ignoredGrid.query(n,a,o,s)));try{for(m.s();!(f=m.n()).done;){var v=f.value,y=v.key;if(void 0===d[y.bucketInstanceId]&&(d[y.bucketInstanceId]={}),!d[y.bucketInstanceId][y.featureIndex]){var _=[new i.pointGeometry(v.x1,v.y1),new i.pointGeometry(v.x2,v.y1),new i.pointGeometry(v.x2,v.y2),new i.pointGeometry(v.x1,v.y2)];i.polygonIntersectsPolygon(r,_)&&(d[y.bucketInstanceId][y.featureIndex]=!0,void 0===p[y.bucketInstanceId]&&(p[y.bucketInstanceId]=[]),p[y.bucketInstanceId].push(y.featureIndex))}}}catch(g){m.e(g)}finally{m.f()}return p}},{key:"insertCollisionBox",value:function(e,t,i,r,n){(t?this.ignoredGrid:this.grid).insert({bucketInstanceId:i,featureIndex:r,collisionGroupID:n},e[0],e[1],e[2],e[3])}},{key:"insertCollisionCircles",value:function(e,t,i,r,n){for(var a=t?this.ignoredGrid:this.grid,o={bucketInstanceId:i,featureIndex:r,collisionGroupID:n},s=0;s<e.length;s+=4)a.insertCircle(o,e[s],e[s+1],e[s+2])}},{key:"projectAndGetPerspectiveRatio",value:function(e,t,r,n,a,o,s){var l,u,c,h,f,d,p,m,v=[t,r,n,1],y=!1;if(n||this.transform.pitch>0){i.transformMat4$1(v,v,e);var _="globe"===s.name;this.fogState&&a&&!_&&(l=this.fogState,u=t,c=r,h=n,f=a.toUnwrapped(),d=this.transform,p=d.calculateFogTileMatrix(f),m=[u,c,h],i.transformMat4(m,m,p),y=V(l,m,d.pitch,d._fov)>.9)}else Ct(v,v,e);var g=v[3];return{point:new i.pointGeometry((v[0]/g+1)/2*this.transform.width+At,(-v[1]/g+1)/2*this.transform.height+At),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(s)/g*.5,1.5),signedDistanceFromCamera:g,occluded:o&&v[2]>g||y}}},{key:"isOffscreen",value:function(e,t,i,r){return i<At||e>=this.screenRightBoundary||r<At||t>this.screenBottomBoundary}},{key:"isInsideGrid",value:function(e,t,i,r){return i>=0&&e<this.gridRightBoundary&&r>=0&&t<this.gridBottomBoundary}},{key:"getViewportMatrix",value:function(){var e=i.identity([]);return i.translate(e,e,[-100,-100,0]),e}}]),e}();function Pt(e,t,r){var n=t.createTileMatrix(e,e.worldSize,r.toUnwrapped());return i.multiply(new Float32Array(16),e.projMatrix,n)}function Dt(e,t,i){if(t.projection.name===i.projection.name)return e.projMatrix;var r=i.clone();return r.setProjection(t.projection),Pt(r,t.getProjection(),e)}function Lt(e,t,i){return t.name===i.projection.name?e.projMatrix:Pt(i,t,e)}var Rt=function(){function e(t,i,r,n){h(this,e),this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?i:-i))):n&&r?1:0,this.placed=r}return d(e,[{key:"isHidden",value:function(){return 0===this.opacity&&!this.placed}}]),e}(),Bt=function(){function e(t,i,r,n,a){var o=arguments.length>5&&void 0!==arguments[5]&&arguments[5];h(this,e),this.text=new Rt(t?t.text:null,i,r,a),this.icon=new Rt(t?t.icon:null,i,n,a),this.clipped=o}return d(e,[{key:"isHidden",value:function(){return this.text.isHidden()&&this.icon.isHidden()}}]),e}(),Ot=d(function e(t,i,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];h(this,e),this.text=t,this.icon=i,this.skipFade=r,this.clipped=n}),Ft=d(function e(){h(this,e),this.invProjMatrix=i.create(),this.viewportMatrix=i.create(),this.circles=[]}),Ut=d(function e(t,i,r,n,a){h(this,e),this.bucketInstanceId=t,this.featureIndex=i,this.sourceLayerIndex=r,this.bucketIndex=n,this.tileID=a}),Vt=function(){function e(t){h(this,e),this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}return d(e,[{key:"get",value:function(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){var t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:function(e){return e.collisionGroupID===t}}}return this.collisionGroups[e]}}]),e}();function jt(e,t,r,n,a){var o=i.getAnchorAlignment(e),s=-(o.horizontalAlign-.5)*t,l=-(o.verticalAlign-.5)*r,u=i.evaluateVariableOffset(e,n);return new i.pointGeometry(s+u[0]*a,l+u[1]*a)}function Nt(e,t,r,n,a){var o=new i.pointGeometry(e,t);return r&&o._rotate(n?a:-a),o}var Gt=function(){function e(t,i,r,n,a){h(this,e),this.transform=t.clone(),this.projection=t.projection.name,this.collisionIndex=new zt(this.transform,a),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new Vt(r),this.collisionCircleArrays={},this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}return d(e,[{key:"getBucketParts",value:function(e,t,r,n){var a=r.getBucket(t),o=r.latestFeatureIndex;if(a&&o&&t.id===a.layerIds[0]){var s=a.layers[0].layout,u=r.collisionBoxArray,c=Math.pow(2,this.transform.zoom-r.tileID.overscaledZ
1),h=r.tileSize/i.EXTENT,f=r.tileID.toUnwrapped();this.transform.setProjection(a.projection);var d,p,m,v=(d=r.tileID,p=a.getProjection(),m=this.transform,p.name===this.projection?m.calculateProjMatrix(d.toUnwrapped()):Pt(m,p,d)),y="map"===s.get("text-pitch-alignment"),_="map"===s.get("text-rotation-alignment");t.compileFilter();var g=t.dynamicFilter(),x=t.dynamicFilterNeedsFeature(),b=this.transform.calculatePixelsToTileUnitsMatrix(r),w=vt(v,r.tileID.canonical,y,_,this.transform,a.getProjection(),b),k=null;if(y){var T=yt(v,r.tileID.canonical,y,_,this.transform,a.getProjection(),b);k=i.multiply([],this.transform.labelPlaneMatrix,T)}var E=null;g&&r.latestFeatureIndex&&(E={unwrappedTileID:f,dynamicFilter:g,dynamicFilterNeedsFeature:x,featureIndex:r.latestFeatureIndex}),this.retainedQueryData[a.bucketInstanceId]=new Ut(a.bucketInstanceId,o,a.sourceLayerIndex,a.index,r.tileID);var M={bucket:a,layout:s,posMatrix:v,textLabelPlaneMatrix:w,labelToScreenMatrix:k,clippingData:E,scale:c,textPixelRatio:h,holdingForFade:r.holdingForFade(),collisionBoxArray:u,partiallyEvaluatedTextSize:i.evaluateSizeForZoom(a.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:i.evaluateSizeForZoom(a.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(a.sourceID)};if(n){var S,I=l(a.sortKeyRanges);try{for(I.s();!(S=I.n()).done;){var C=S.value,A=C.sortKey,z=C.symbolInstanceStart,P=C.symbolInstanceEnd;e.push({sortKey:A,symbolInstanceStart:z,symbolInstanceEnd:P,parameters:M})}}catch(D){I.e(D)}finally{I.f()}}else e.push({symbolInstanceStart:0,symbolInstanceEnd:a.symbolInstances.length,parameters:M})}}},{key:"attemptAnchorPlacement",value:function(e,t,i,r,n,a,o,s,l,u,c,h,f,d,p,m,v,y){var _,g=h.textOffset0,x=h.textOffset1,b=h.crossTileID,w=[g,x],k=jt(e,i,r,w,n),T=this.collisionIndex.placeCollisionBox(d,n,t,Nt(k.x,k.y,a,o,this.transform.angle),c,s,l,u.predicate);if(m){var E=d.getSymbolInstanceIconSize(y,this.transform.zoom,h.placedIconSymbolIndex);if(0===this.collisionIndex.placeCollisionBox(d,E,m,Nt(k.x,k.y,a,o,this.transform.angle),c,s,l,u.predicate).box.length)return}if(T.box.length>0)return this.prevPlacement&&this.prevPlacement.variableOffsets[b]&&this.prevPlacement.placements[b]&&this.prevPlacement.placements[b].text&&(_=this.prevPlacement.variableOffsets[b].anchor),this.variableOffsets[b]={textOffset:w,width:i,height:r,anchor:e,textScale:n,prevAnchor:_},this.markUsedJustification(d,e,h,p),d.allowVerticalPlacement&&(this.markUsedOrientation(d,p,h),this.placedOrientations[b]=p),{shift:k,placedGlyphBoxes:T}}},{key:"placeLayerBucketPart",value:function(e,t,r,n){var a=this,o=e.parameters,s=o.bucket,u=o.layout,c=o.posMatrix,h=o.textLabelPlaneMatrix,f=o.labelToScreenMatrix,d=o.clippingData,p=o.textPixelRatio,m=o.holdingForFade,v=o.collisionBoxArray,y=o.partiallyEvaluatedTextSize,_=o.partiallyEvaluatedIconSize,g=o.collisionGroup,x=u.get("text-optional"),b=u.get("icon-optional"),w=u.get("text-allow-overlap"),k=u.get("icon-allow-overlap"),T="map"===u.get("text-rotation-alignment"),E="map"===u.get("text-pitch-alignment"),M="none"!==u.get("icon-text-fit"),S="viewport-y"===u.get("symbol-z-order");this.transform.setProjection(s.projection);var I=w&&(k||!s.hasIconData()||b),C=k&&(w||!s.hasTextData()||x);!s.collisionArrays&&v&&s.deserializeCollisionBoxes(v),r&&n&&s.updateCollisionDebugBuffers(this.transform.zoom,v);var A=function(e,n,o){var v=e.crossTileID,S=e.numVerticalGlyphVertices;if(d){var A={zoom:a.transform.zoom,pitch:a.transform.pitch},z=null;if(d.dynamicFilterNeedsFeature){var P=a.retainedQueryData[s.bucketInstanceId];z=d.featureIndex.loadFeature({featureIndex:e.featureIndex,bucketIndex:P.bucketIndex,sourceLayerIndex:P.sourceLayerIndex,layoutVertexArrayOffset:0})}if(!(0,d.dynamicFilter)(A,z,a.retainedQueryData[s.bucketInstanceId].tileID.canonical,new i.pointGeometry(e.tileAnchorX,e.tileAnchorY),a.transform.calculateDistanceTileData(d.unwrappedTileID)))return a.placements[v]=new Ot(!1,!1,!1,!0),void(t[v]=!0)}if(!t[v])if(m)a.placements[v]=new Ot(!1,!1,!1);else{var D,L=!1,R=!1,B=!0,O=!1,F=!1,U=null,V={box:null,offscreen:null,occluded:null},j={box:null,offscreen:null,occluded:null},N=null,G=null,Z=0,q=0,W=0;o.textFeatureIndex?Z=o.textFeatureIndex:e.useRuntimeCollisionCircles&&(Z=e.featureIndex),o.verticalTextFeatureIndex&&(q=o.verticalTextFeatureIndex);var X=function(e){e.tileID=a.retainedQueryData[s.bucketInstanceId].tileID;var t=a.transform.elevation;
1(t||e.elevation)&&(e.elevation=t?t.getAtTileOffset(e.tileID,e.tileAnchorX,e.tileAnchorY):0)},H=o.textBox;if(H){X(H);var Y=function(t){var r=i.WritingMode.horizontal;if(s.allowVerticalPlacement&&!t&&a.prevPlacement){var n=a.prevPlacement.placedOrientations[v];n&&(a.placedOrientations[v]=n,r=n,a.markUsedOrientation(s,r,e))}return r},K=function(e,t){if(s.allowVerticalPlacement&&S>0&&o.verticalTextBox){var r,n=l(s.writingModes);try{for(n.s();!(r=n.n()).done;){if(r.value===i.WritingMode.vertical?(V=t(),j=V):V=e(),V&&V.box&&V.box.length)break}}catch(a){n.e(a)}finally{n.f()}}else V=e()};if(u.get("text-variable-anchor")){var J=u.get("text-variable-anchor");if(a.prevPlacement&&a.prevPlacement.variableOffsets[v]){var $=a.prevPlacement.variableOffsets[v];J.indexOf($.anchor)>0&&(J=J.filter(function(e){return e!==$.anchor})).unshift($.anchor)}var Q=function(t,i,r){var o=s.getSymbolInstanceTextSize(y,e,a.transform.zoom,n),l=(t.x2-t.x1)*o+2*t.padding,u=(t.y2-t.y1)*o+2*t.padding,h=M&&!k?i:null;h&&X(h);for(var f={box:[],offscreen:!1,occluded:!1},d=w?2*J.length:J.length,m=0;m<d;++m){var v=a.attemptAnchorPlacement(J[m%J.length],t,l,u,o,T,E,p,c,g,m>=J.length,e,n,s,r,h,y,_);if(v&&((f=v.placedGlyphBoxes)&&f.box&&f.box.length)){L=!0,U=v.shift;break}}return f};K(function(){return Q(H,o.iconBox,i.WritingMode.horizontal)},function(){var e=o.verticalTextBox;return e&&X(e),s.allowVerticalPlacement&&!(V&&V.box&&V.box.length)&&S>0&&e?Q(e,o.verticalIconBox,i.WritingMode.vertical):{box:null,offscreen:null,occluded:null}}),V&&(L=V.box,B=V.offscreen,O=V.occluded);var ee=Y(V&&V.box);if(!L&&a.prevPlacement){var te=a.prevPlacement.variableOffsets[v];te&&(a.variableOffsets[v]=te,a.markUsedJustification(s,te.anchor,e,ee))}}else{var ie=function(t,r){var o=s.getSymbolInstanceTextSize(y,e,a.transform.zoom,n),l=a.collisionIndex.placeCollisionBox(s,o,t,new i.pointGeometry(0,0),w,p,c,g.predicate);return l&&l.box&&l.box.length&&(a.markUsedOrientation(s,r,e),a.placedOrientations[v]=r),l};K(function(){return ie(H,i.WritingMode.horizontal)},function(){var e=o.verticalTextBox;return s.allowVerticalPlacement&&S>0&&e?(X(e),ie(e,i.WritingMode.vertical)):{box:null,offscreen:null,occluded:null}}),Y(V&&V.box&&V.box.length)}}if(L=(D=V)&&D.box&&D.box.length>0,B=D&&D.offscreen,O=D&&D.occluded,e.useRuntimeCollisionCircles){var re=s.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex>=0?e.centerJustifiedTextSymbolIndex:e.verticalPlacedTextSymbolIndex),ne=i.evaluateSizeForFeature(s.textSizeData,y,re),ae=u.get("text-padding");N=a.collisionIndex.placeCollisionCircles(s,w,re,s.lineVertexArray,s.glyphOffsetArray,ne,c,h,f,r,E,g.predicate,e.collisionCircleDiameter*ne/i.ONE_EM,ae,a.retainedQueryData[s.bucketInstanceId].tileID),L=w||N.circles.length>0&&!N.collisionDetected,B=B&&N.offscreen,O=N.occluded}if(o.iconFeatureIndex&&(W=o.iconFeatureIndex),o.iconBox){var oe=function(t){X(t);var r=M&&U?Nt(U.x,U.y,T,E,a.transform.angle):new i.pointGeometry(0,0),n=s.getSymbolInstanceIconSize(_,a.transform.zoom,e.placedIconSymbolIndex);return a.collisionIndex.placeCollisionBox(s,n,t,r,k,p,c,g.predicate)};j&&j.box&&j.box.length&&o.verticalIconBox?R=(G=oe(o.verticalIconBox)).box.length>0:R=(G=oe(o.iconBox)).box.length>0,B=B&&G.offscreen,F=G.occluded}var se=x||0===e.numHorizontalGlyphVertices&&0===S,le=b||0===e.numIconVertices;if(se||le?le?se||(R=R&&L):L=R&&L:R=L=R&&L,L&&D&&D.box&&a.collisionIndex.insertCollisionBox(D.box,u.get("text-ignore-placement"),s.bucketInstanceId,j&&j.box&&q?q:Z,g.ID),R&&G&&a.collisionIndex.insertCollisionBox(G.box,u.get("icon-ignore-placement"),s.bucketInstanceId,W,g.ID),N&&(L&&a.collisionIndex.insertCollisionCircles(N.circles,u.get("text-ignore-placement"),s.bucketInstanceId,Z,g.ID),r)){var ue=s.bucketInstanceId,ce=a.collisionCircleArrays[ue];void 0===ce&&(ce=a.collisionCircleArrays[ue]=new Ft);for(var he=0;he<N.circles.length;he+=4)ce.circles.push(N.circles[he+0]),ce.circles.push(N.circles[he+1]),ce.circles.push(N.circles[he+2]),ce.circles.push(N.collisionDetected?1:0)}var fe="globe"!==s.projection.name;I=I&&(fe||!O),C=C&&(fe||!F),a.placements[v]=new Ot(L||I,R||C,B||s.justReloaded),t[v]=!0}};
1if(S)for(var z=s.getSortedSymbolIndexes(this.transform.angle),P=z.length-1;P>=0;--P){var D=z[P];A(s.symbolInstances.get(D),D,s.collisionArrays[D])}else for(var L=e.symbolInstanceStart;L<e.symbolInstanceEnd;L++)A(s.symbolInstances.get(L),L,s.collisionArrays[L]);if(r&&s.bucketInstanceId in this.collisionCircleArrays){var R=this.collisionCircleArrays[s.bucketInstanceId];i.invert(R.invProjMatrix,c),R.viewportMatrix=this.collisionIndex.getViewportMatrix()}s.justReloaded=!1}},{key:"markUsedJustification",value:function(e,t,r,n){var a=r.leftJustifiedTextSymbolIndex,o=r.centerJustifiedTextSymbolIndex,s=r.rightJustifiedTextSymbolIndex,l=r.verticalPlacedTextSymbolIndex,u=r.crossTileID,c=i.getAnchorJustification(t),h=n===i.WritingMode.vertical?l:"left"===c?a:"center"===c?o:"right"===c?s:-1;a>=0&&(e.text.placedSymbolArray.get(a).crossTileID=h>=0&&a!==h?0:u),o>=0&&(e.text.placedSymbolArray.get(o).crossTileID=h>=0&&o!==h?0:u),s>=0&&(e.text.placedSymbolArray.get(s).crossTileID=h>=0&&s!==h?0:u),l>=0&&(e.text.placedSymbolArray.get(l).crossTileID=h>=0&&l!==h?0:u)}},{key:"markUsedOrientation",value:function(e,t,r){var n=t===i.WritingMode.horizontal||t===i.WritingMode.horizontalOnly?t:0,a=t===i.WritingMode.vertical?t:0,o=r.leftJustifiedTextSymbolIndex,s=r.centerJustifiedTextSymbolIndex,l=r.rightJustifiedTextSymbolIndex,u=r.verticalPlacedTextSymbolIndex,c=e.text.placedSymbolArray;o>=0&&(c.get(o).placedOrientation=n),s>=0&&(c.get(s).placedOrientation=n),l>=0&&(c.get(l).placedOrientation=n),u>=0&&(c.get(u).placedOrientation=a)}},{key:"commit",value:function(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;var t=this.prevPlacement,i=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;var r=t?t.symbolFadeChange(e):1,n=t?t.opacities:{},a=t?t.variableOffsets:{},o=t?t.placedOrientations:{};for(var s in this.placements){var l=this.placements[s],u=n[s];u?(this.opacities[s]=new Bt(u,r,l.text,l.icon,null,l.clipped),i=i||l.text!==u.text.placed||l.icon!==u.icon.placed):(this.opacities[s]=new Bt(null,r,l.text,l.icon,l.skipFade,l.clipped),i=i||l.text||l.icon)}for(var c in n){var h=n[c];if(!this.opacities[c]){var f=new Bt(h,r,!1,!1);f.isHidden()||(this.opacities[c]=f,i=i||h.text.placed||h.icon.placed)}}for(var d in a)this.variableOffsets[d]||!this.opacities[d]||this.opacities[d].isHidden()||(this.variableOffsets[d]=a[d]);for(var p in o)this.placedOrientations[p]||!this.opacities[p]||this.opacities[p].isHidden()||(this.placedOrientations[p]=o[p]);i?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}},{key:"updateLayerOpacities",value:function(e,t){var i,r={},n=l(t);try{for(n.s();!(i=n.n()).done;){var a=i.value,o=a.getBucket(e);o&&a.latestFeatureIndex&&e.id===o.layerIds[0]&&this.updateBucketOpacities(o,r,a.collisionBoxArray)}}catch(s){n.e(s)}finally{n.f()}}},{key:"updateBucketOpacities",value:function(e,t,r){e.hasTextData()&&e.text.opacityVertexArray.clear(),e.hasIconData()&&e.icon.opacityVertexArray.clear(),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();var n=e.layers[0].layout,a=!!e.layers[0].dynamicFilter(),o=new Bt(null,0,!1,!1,!0),s=n.get("text-allow-overlap"),l=n.get("icon-allow-overlap"),u=n.get("text-variable-anchor"),c="map"===n.get("text-rotation-alignment"),h="map"===n.get("text-pitch-alignment"),f="none"!==n.get("icon-text-fit"),d=new Bt(null,0,s&&(l||!e.hasIconData()||n.get("icon-optional")),l&&(s||!e.hasTextData()||n.get("text-optional")),!0);!e.collisionArrays&&r&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(r);for(var p=function(e,t,i){for(var r=0;r<t/4;r++)e.opacityVertexArray.emplaceBack(i)},m=0,v=0;v<e.symbolInstances.length;v++){var y=e.symbolInstances.get(v),_=y.numHorizontalGlyphVertices,g=y.numVerticalGlyphVertices,x=y.crossTileID,b=y.numIconVertices,w=this.opacities[x];t[x]?w=o:w||(w=d,this.opacities[x]=w),t[x]=!0;var k=_>0||g>0,T=b>0,E=this.placedOrientations[x],M=E===i.WritingMode.vertical,S=E===i.WritingMode.horizontal||E===i.WritingMode.horizontalOnly;if(!k&&!T||w.isHidden()||m++,k){var I=$t(w.text);p(e.text,_,M?Qt:I),p(e.text,g,S?Qt:I);var C=w.text.isHidden(),A=y.leftJustifiedTextSymbolIndex,z=y.centerJustifiedTextSymbolIndex,P=y.rightJustifiedTextSymbolIndex,D=y.verticalPlacedTextSymbolIndex,L=e.text.placedSymbolArray,R=C||M?1:0;A>=0&&(L.get(A).hidden=R),z>=0&&(L.get(z).hidden=R),P>=0&&(L.get(P).hidden=R),D>=0&&(L.get(D).hidden=C||S?1:0);var B=this.variableOffsets[x];B&&this.markUsedJustification(e,B.anchor,y,E);var O=this.placedOrientations[x];O&&(this.markUsedJustification(e,"left",y,O),this.markUsedOrientation(e,O,y))}if(T){var F=$t(w.icon),U=y.placedIconSymbolIndex,V=y.verticalPlacedIconSymbolIndex,j=e.icon.placedSymbolArray,N=w.icon.isHidden()?1:0;U>=0&&(p(e.icon,b,M?Qt:F),j.get(U).hidden=N),V>
1=0&&(p(e.icon,y.numVerticalIconVertices,S?Qt:F),j.get(V).hidden=N)}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){var G=e.collisionArrays[v];if(G){var Z=new i.pointGeometry(0,0),q=!0;if(G.textBox||G.verticalTextBox){if(u){var W=this.variableOffsets[x];W?(Z=jt(W.anchor,W.width,W.height,W.textOffset,W.textScale),c&&Z._rotate(h?this.transform.angle:-this.transform.angle)):q=!1}a&&(q=!w.clipped),G.textBox&&Zt(e.textCollisionBox.collisionVertexArray,w.text.placed,!q||M,Z.x,Z.y),G.verticalTextBox&&Zt(e.textCollisionBox.collisionVertexArray,w.text.placed,!q||S,Z.x,Z.y)}var X=q&&Boolean(!S&&G.verticalIconBox);G.iconBox&&Zt(e.iconCollisionBox.collisionVertexArray,w.icon.placed,X,f?Z.x:0,f?Z.y:0),G.verticalIconBox&&Zt(e.iconCollisionBox.collisionVertexArray,w.icon.placed,!X,f?Z.x:0,f?Z.y:0)}}}if(e.fullyClipped=0===m,e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.bucketInstanceId in this.collisionCircleArrays){var H=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=H.invProjMatrix,e.placementViewportMatrix=H.viewportMatrix,e.collisionCircleArray=H.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}}},{key:"symbolFadeChange",value:function(e){return 0===this.fadeDuration?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}},{key:"zoomAdjustment",value:function(e){return Math.max(0,(this.transform.zoom-e)/1.5)}},{key:"hasTransitions",value:function(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}},{key:"stillRecent",value:function(e,t){var i=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*i>e}},{key:"setStale",value:function(){this.stale=!0}}]),e}();function Zt(e,t,i,r,n){e.emplaceBack(t?1:0,i?1:0,r||0,n||0),e.emplaceBack(t?1:0,i?1:0,r||0,n||0),e.emplaceBack(t?1:0,i?1:0,r||0,n||0),e.emplaceBack(t?1:0,i?1:0,r||0,n||0)}var qt=Math.pow(2,25),Wt=Math.pow(2,24),Xt=Math.pow(2,17),Ht=Math.pow(2,16),Yt=Math.pow(2,9),Kt=Math.pow(2,8),Jt=Math.pow(2,1);function $t(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 4294967295;var t=e.placed?1:0,i=Math.floor(127*e.opacity);return i*qt+t*Wt+i*Xt+t*Ht+i*Yt+t*Kt+i*Jt+t}var Qt=0,ei=function(){function e(t){h(this,e),this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&void 0!==t.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}return d(e,[{key:"continuePlacement",value:function(e,t,i,r,n){for(var a=this._bucketParts;this._currentTileIndex<e.length;)if(t.getBucketParts(a,r,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,n())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,a.sort(function(e,t){return e.sortKey-t.sortKey}));this._currentPartIndex<a.length;){var o=a[this._currentPartIndex];if(t.placeLayerBucketPart(o,this._seenCrossTileIDs,i,0===o.symbolInstanceStart),this._currentPartIndex++,n())return!0}return!1}}]),e}(),ti=function(){function e(t,i,r,n,a,o,s,l){h(this,e),this.placement=new Gt(t,a,o,s,l),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=n,this._done=!1}return d(e,[{key:"isDone",value:function(){return this._done}},{key:"continuePlacement",value:function(e,t,r){for(var n=this,a=i.exported.now(),o=function(){var e=i.exported.now()-a;return!n._forceFullPlacement&&e>2};this._currentPlacementIndex>=0;){var s=t[e[this._currentPlacementIndex]],l=this.placement.collisionIndex.transform.zoom;if("symbol"===s.type&&(!s.minzoom||s.minzoom<=l)&&(!s.maxzoom||s.maxzoom>l)){if(this._inProgressLayer||(this._inProgressLayer=new ei(s)),this._inProgressLayer.continuePlacement(r[s.source],this.placement,this._showCollisionBoxes,s,o))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}},{key:"commit",value:function(e){return this.placement.commit(e),this.placement}}]),e}(),ii=512/i.EXTENT/2,ri=function(){function e(t,i,r){h(this,e),this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=r;for(var n=0;n<i.length;n++){var a=i.get(n),o=a.key;
1this.indexedSymbolInstances[o]||(this.indexedSymbolInstances[o]=[]),this.indexedSymbolInstances[o].push({crossTileID:a.crossTileID,coord:this.getScaledCoordinates(a,t)})}}return d(e,[{key:"getScaledCoordinates",value:function(e,t){var r=ii/Math.pow(2,t.canonical.z-this.tileID.canonical.z);return{x:Math.floor((t.canonical.x*i.EXTENT+e.tileAnchorX)*r),y:Math.floor((t.canonical.y*i.EXTENT+e.tileAnchorY)*r)}}},{key:"findMatches",value:function(e,t,i){for(var r=this.tileID.canonical.z<t.canonical.z?1:Math.pow(2,this.tileID.canonical.z-t.canonical.z),n=0;n<e.length;n++){var a=e.get(n);if(!a.crossTileID){var o=this.indexedSymbolInstances[a.key];if(o){var s,u=this.getScaledCoordinates(a,t),c=l(o);try{for(c.s();!(s=c.n()).done;){var h=s.value;if(Math.abs(h.coord.x-u.x)<=r&&Math.abs(h.coord.y-u.y)<=r&&!i[h.crossTileID]){i[h.crossTileID]=!0,a.crossTileID=h.crossTileID;break}}}catch(f){c.e(f)}finally{c.f()}}}}}}]),e}(),ni=function(){function e(){h(this,e),this.maxCrossTileID=0}return d(e,[{key:"generate",value:function(){return++this.maxCrossTileID}}]),e}(),ai=function(){function e(){h(this,e),this.indexes={},this.usedCrossTileIDs={},this.lng=0}return d(e,[{key:"handleWrapJump",value:function(e){var t=Math.round((e-this.lng)/360);if(0!==t)for(var i in this.indexes){var r=this.indexes[i],n={};for(var a in r){var o=r[a];o.tileID=o.tileID.unwrapTo(o.tileID.wrap+t),n[o.tileID.key]=o}this.indexes[i]=n}this.lng=e}},{key:"addBucket",value:function(e,t,i){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(var r=0;r<t.symbolInstances.length;r++)t.symbolInstances.get(r).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});var n=this.usedCrossTileIDs[e.overscaledZ];for(var a in this.indexes){var o=this.indexes[a];if(Number(a)>e.overscaledZ)for(var s in o){var l=o[s];l.tileID.isChildOf(e)&&l.findMatches(t.symbolInstances,e,n)}else{var u=o[e.scaledTo(Number(a)).key];u&&u.findMatches(t.symbolInstances,e,n)}}for(var c=0;c<t.symbolInstances.length;c++){var h=t.symbolInstances.get(c);h.crossTileID||(h.crossTileID=i.generate(),n[h.crossTileID]=!0)}return void 0===this.indexes[e.overscaledZ]&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new ri(e,t.symbolInstances,t.bucketInstanceId),!0}},{key:"removeBucketCrossTileIDs",value:function(e,t){for(var i in t.indexedSymbolInstances){var r,n=l(t.indexedSymbolInstances[i]);try{for(n.s();!(r=n.n()).done;){var a=r.value;delete this.usedCrossTileIDs[e][a.crossTileID]}}catch(o){n.e(o)}finally{n.f()}}}},{key:"removeStaleBuckets",value:function(e){var t=!1;for(var i in this.indexes){var r=this.indexes[i];for(var n in r)e[r[n].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,r[n]),delete r[n],t=!0)}return t}}]),e}(),oi=function(){function e(){h(this,e),this.layerIndexes={},this.crossTileIDs=new ni,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}return d(e,[{key:"addLayer",value:function(e,t,i,r){var n=this.layerIndexes[e.id];void 0===n&&(n=this.layerIndexes[e.id]=new ai);var a=!1,o={};"globe"!==r.name&&n.handleWrapJump(i);var s,u=l(t);try{for(u.s();!(s=u.n()).done;){var c=s.value,h=c.getBucket(e);h&&e.id===h.layerIds[0]&&(h.bucketInstanceId||(h.bucketInstanceId=++this.maxBucketInstanceId),n.addBucket(c.tileID,h,this.crossTileIDs)&&(a=!0),o[h.bucketInstanceId]=!0)}}catch(f){u.e(f)}finally{u.f()}return n.removeStaleBuckets(o)&&(a=!0),a}},{key:"pruneUnusedLayers",value:function(e){var t={};for(var i in e.forEach(function(e){t[e]=!0}),this.layerIndexes)t[i]||delete this.layerIndexes[i]}}]),e}(),si=function(e,t){return i.emitValidationErrors(e,t&&t.filter(function(e){return"source.canvas"!==e.identifier}))},li=i.pick(nt,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection"]),ui=i.pick(nt,["setCenter","setZoom","setBearing","setP
1itch"]),ci={version:8,layers:[],sources:{}},hi={fill:!0,line:!0,background:!0,hillshade:!0,raster:!0},fi=function(e){p(a,e);var t=m(a);function a(e){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};h(this,a),(r=t.call(this)).map=e,r.dispatcher=new q(tt(),y(r)),r.imageManager=new D,r.imageManager.setEventedParent(y(r)),r.glyphManager=new i.GlyphManager(e._requestManager,n.localFontFamily?i.LocalGlyphMode.all:n.localIdeographFontFamily?i.LocalGlyphMode.ideographs:i.LocalGlyphMode.none,n.localFontFamily||n.localIdeographFontFamily),r.crossTileSymbolIndex=new oi,r._layers={},r._num3DLayers=0,r._numSymbolLayers=0,r._numCircleLayers=0,r._serializedLayers={},r._sourceCaches={},r._otherSourceCaches={},r._symbolSourceCaches={},r._loaded=!1,r._availableImages=[],r._order=[],r._drapedFirstOrder=[],r._markersNeedUpdate=!1,r._resetUpdates(),r.dispatcher.broadcast("setReferrer",i.getReferrer());var o=y(r);return r._rtlTextPluginCallback=a.registerForPluginStateChange(function(e){o.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:e.pluginStatus,pluginURL:e.pluginURL},function(e,t){if(i.triggerPluginCompletionEvent(e),t&&t.every(function(e){return e}))for(var r in o._sourceCaches){var n=o._sourceCaches[r],a=n.getSource().type;"vector"!==a&&"geojson"!==a||n.reload()}})}),r.on("data",function(e){if("source"===e.dataType&&"metadata"===e.sourceDataType){var t=r.getSource(e.sourceId);if(t&&t.vectorLayerIds)for(var i in r._layers){var n=r._layers[i];n.source===t.id&&r._validateLayer(n)}}}),r}return d(a,[{key:"loadURL",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.fire(new i.Event("dataloading",{dataType:"style"}));var n="boolean"==typeof r.validate?r.validate:!i.isMapboxURL(e);e=this.map._requestManager.normalizeStyleURL(e,r.accessToken);var a=this.map._requestManager.transformRequest(e,i.ResourceType.Style);this._request=i.getJSON(a,function(e,r){t._request=null,e?t.fire(new i.ErrorEvent(e)):r&&t._load(r,n)})}},{key:"loadJSON",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.fire(new i.Event("dataloading",{dataType:"style"})),this._request=i.exported.frame(function(){t._request=null,t._load(e,!1!==r.validate)})}},{key:"loadEmpty",value:function(){this.fire(new i.Event("dataloading",{dataType:"style"})),this._load(ci,!1)}},{key:"_updateLayerCount",value:function(e,t){var i=t?1:-1;e.is3D()&&(this._num3DLayers+=i),"circle"===e.type&&(this._numCircleLayers+=i),"symbol"===e.type&&(this._numSymbolLayers+=i)}},{key:"_load",value:function(e,t){if(!t||!si(this,i.validateStyle(e))){for(var r in this._loaded=!0,this.stylesheet=i.clone$1(e),this._updateMapProjection(),e.sources)this.addSource(r,e.sources[r],{validate:!1});this._changed=!1,e.sprite?this._loadSprite(e.sprite):(this.imageManager.setLoaded(!0),this.dispatcher.broadcast("spriteLoaded",!0)),this.glyphManager.setURL(e.glyphs);var n=rt(this.stylesheet.layers);this._order=n.map(function(e){return e.id}),this._layers={},this._serializedLayers={};var a,o=l(n);try{for(o.s();!(a=o.n()).done;){var s=a.value,u=i.createStyleLayer(s);u.setEventedParent(this,{layer:{id:u.id}}),this._layers[u.id]=u,this._serializedLayers[u.id]=u.serialize(),this._updateLayerCount(u,!0)}}catch(c){o.e(c)}finally{o.f()}this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new B(this.stylesheet.light),this.stylesheet.terrain&&!this.terrainSetForDrapingOnly()&&this._createTerrain(this.stylesheet.terrain,1),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this._updateDrapeFirstLayers(),this.fire(new i.Event("data",{dataType:"style"})),this.fire(new i.Event("style.load"))}}},{key:"terrainSetForDrapingOnly",value:function(){return!!this.terrain&&0===this.terrain.drapeRenderMode}},{key:"setProjection",value:function(e){e?this.stylesheet.projection=e:delete this.stylesheet.projection,this._updateMapProjection()}},{key:"applyProjectionUpdate",value:function(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?this.getTerrain()||this.stylesheet.terrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null))}},{key:"_updateMapProjection",value:function(){this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.stylesheet.projection)}},{key:"_loadSprite",value:function(e){var t=this;this._spriteRequest=function(e,t,r){var n,a,o,s=i.exported.devicePixelRatio>1?"@2x":"",l=i.getJSON(t.transformRequest(t.normalizeSpriteURL(e,s,".json"),i.ResourceType.SpriteJSON),function(e,t){l=null,o||(o=e,n=t,c())}),u=i.getImage(t.transformRequest(t.normalizeSpriteURL(e,s,".png"),i.ResourceType.SpriteImage),function(e,t){u=null,o||(o=e,a=t,c())});function c(){if(o)r(o);else if(n&&a){var e=i.exported.getImageData(a),t={};for(var s in n){var l=n[s],u=l.width,c=l.height,h=l.x,f=l.y,d=l.sdf,p=l.pixelRatio,m=l.stretchX,v=l.stretchY,y=l.content,_=ne
1w i.RGBAImage({width:u,height:c});i.RGBAImage.copy(e,_,{x:h,y:f},{x:0,y:0},{width:u,height:c}),t[s]={data:_,pixelRatio:p,sdf:d,stretchX:m,stretchY:v,content:y}}r(null,t)}}return{cancel:function(){l&&(l.cancel(),l=null),u&&(u.cancel(),u=null)}}}(e,this.map._requestManager,function(e,r){if(t._spriteRequest=null,e)t.fire(new i.ErrorEvent(e));else if(r)for(var n in r)t.imageManager.addImage(n,r[n]);t.imageManager.setLoaded(!0),t._availableImages=t.imageManager.listImages(),t.dispatcher.broadcast("setImages",t._availableImages),t.dispatcher.broadcast("spriteLoaded",!0),t.fire(new i.Event("data",{dataType:"style"}))})}},{key:"_validateLayer",value:function(e){var t=this.getSource(e.source);if(t){var r=e.sourceLayer;r&&("geojson"===t.type||t.vectorLayerIds&&-1===t.vectorLayerIds.indexOf(r))&&this.fire(new i.ErrorEvent(new Error('Source layer "'.concat(r,'" does not exist on source "').concat(t.id,'" as specified by style layer "').concat(e.id,'"'))))}}},{key:"loaded",value:function(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(var e in this._sourceCaches)if(!this._sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}},{key:"_serializeLayers",value:function(e){var t,i=[],r=l(e);try{for(r.s();!(t=r.n()).done;){var n=t.value,a=this._layers[n];"custom"!==a.type&&i.push(a.serialize())}}catch(o){r.e(o)}finally{r.f()}return i}},{key:"hasTransitions",value:function(){if(this.light&&this.light.hasTransition()||this.fog&&this.fog.hasTransition())return!0;for(var e in this._sourceCaches)if(this._sourceCaches[e].hasTransition())return!0;for(var t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}},{key:"order",get:function(){return this.map._optimizeForTerrain&&this.terrain?this._drapedFirstOrder:this._order}},{key:"isLayerDraped",value:function(e){return!!this.terrain&&("function"==typeof e.isLayerDraped?e.isLayerDraped():hi[e.type])}},{key:"_checkLoaded",value:function(){if(!this._loaded)throw new Error("Style is not done loading")}},{key:"update",value:function(e){if(this._loaded){var t=this._changed;if(this._changed){var r=Object.keys(this._updatedLayers),n=Object.keys(this._removedLayers);for(var a in(r.length||n.length)&&this._updateWorkerLayers(r,n),this._updatedSources){var o=this._updatedSources[a];"reload"===o?this._reloadSource(a):"clear"===o&&this._clearSource(a)}for(var s in this._updateTilesForChangedImages(),this._updatedPaintProps)this._layers[s].updateTransitions(e);this.light.updateTransitions(e),this.fog&&this.fog.updateTransitions(e),this._resetUpdates()}var u={};for(var c in this._sourceCaches){var h=this._sourceCaches[c];u[c]=h.used,h.used=!1}var f,d=l(this._order);try{for(d.s();!(f=d.n()).done;){var p=f.value,m=this._layers[p];if(m.recalculate(e,this._availableImages),!m.isHidden(e.zoom)){var v=this._getLayerSourceCache(m);v&&(v.used=!0)}var y=this.map.painter;if(y){var _=m.getProgramIds();if(!_)continue;var g,x=m.getProgramConfiguration(e.zoom),b=l(_);try{for(b.s();!(g=b.n()).done;){var w=g.value;y.useProgram(w,x)}}catch(E){b.e(E)}finally{b.f()}}}}catch(E){d.e(E)}finally{d.f()}for(var k in u){var T=this._sourceCaches[k];u[k]!==T.used&&T.getSource().fire(new i.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:T.getSource().id}))}this.light.recalculate(e),this.terrain&&this.terrain.recalculate(e),this.fog&&this.fog.recalculate(e),this.z=e.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),t&&this.fire(new i.Event("data",{dataType:"style"}))}}},{key:"_updateTilesForChangedImages",value:function(){var e=Object.keys(this._changedImages);if(e.length){for(var t in this._sourceCaches)this._sourceCaches[t].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}},{key:"_updateWorkerLayers",value:function(e,t){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(e),removedIds:t})}},{key:"_resetUpdates",value:function(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}},{key:"setState",value:function(e){var t=this;if(this._checkLoaded(),si(this,i.validateStyle(e)))return!1;
1(e=i.clone$1(e)).layers=rt(e.layers);var r=function(e,t){if(!e)return[{command:nt.setStyle,args:[t]}];var i=[];try{if(!n(e.version,t.version))return[{command:nt.setStyle,args:[t]}];n(e.center,t.center)||i.push({command:nt.setCenter,args:[t.center]}),n(e.zoom,t.zoom)||i.push({command:nt.setZoom,args:[t.zoom]}),n(e.bearing,t.bearing)||i.push({command:nt.setBearing,args:[t.bearing]}),n(e.pitch,t.pitch)||i.push({command:nt.setPitch,args:[t.pitch]}),n(e.sprite,t.sprite)||i.push({command:nt.setSprite,args:[t.sprite]}),n(e.glyphs,t.glyphs)||i.push({command:nt.setGlyphs,args:[t.glyphs]}),n(e.transition,t.transition)||i.push({command:nt.setTransition,args:[t.transition]}),n(e.light,t.light)||i.push({command:nt.setLight,args:[t.light]}),n(e.fog,t.fog)||i.push({command:nt.setFog,args:[t.fog]}),n(e.projection,t.projection)||i.push({command:nt.setProjection,args:[t.projection]});var r={},a=[];!function(e,t,i,r){var a;for(a in t=t||{},e=e||{})e.hasOwnProperty(a)&&(t.hasOwnProperty(a)||ot(a,i,r));for(a in t)if(t.hasOwnProperty(a)){var o=t[a];e.hasOwnProperty(a)?n(e[a],o)||("geojson"===e[a].type&&"geojson"===o.type&&lt(e,t,a)?i.push({command:nt.setGeoJSONSourceData,args:[a,o.data]}):st(a,t,i,r)):at(a,t,i)}}(e.sources,t.sources,a,r);var o=[];e.layers&&e.layers.forEach(function(e){e.source&&r[e.source]?i.push({command:nt.removeLayer,args:[e.id]}):o.push(e)});var s=e.terrain;s&&r[s.source]&&(i.push({command:nt.setTerrain,args:[void 0]}),s=void 0),i=i.concat(a),n(s,t.terrain)||i.push({command:nt.setTerrain,args:[t.terrain]}),function(e,t,i){t=t||[];var r,a,o,s,l,u,c,h=(e=e||[]).map(ct),f=t.map(ct),d=e.reduce(ht,{}),p=t.reduce(ht,{}),m=h.slice(),v=Object.create(null);for(r=0,a=0;r<h.length;r++)o=h[r],p.hasOwnProperty(o)?a++:(i.push({command:nt.removeLayer,args:[o]}),m.splice(m.indexOf(o,a),1));for(r=0,a=0;r<f.length;r++)o=f[f.length-1-r],m[m.length-1-r]!==o&&(d.hasOwnProperty(o)?(i.push({command:nt.removeLayer,args:[o]}),m.splice(m.lastIndexOf(o,m.length-a),1)):a++,u=m[m.length-r],i.push({command:nt.addLayer,args:[p[o],u]}),m.splice(m.length-r,0,o),v[o]=!0);for(r=0;r<f.length;r++)if(s=d[o=f[r]],l=p[o],!v[o]&&!n(s,l))if(n(s.source,l.source)&&n(s["source-layer"],l["source-layer"])&&n(s.type,l.type)){for(c in ut(s.layout,l.layout,i,o,null,nt.setLayoutProperty),ut(s.paint,l.paint,i,o,null,nt.setPaintProperty),n(s.filter,l.filter)||i.push({command:nt.setFilter,args:[o,l.filter]}),n(s.minzoom,l.minzoom)&&n(s.maxzoom,l.maxzoom)||i.push({command:nt.setLayerZoomRange,args:[o,l.minzoom,l.maxzoom]}),s)s.hasOwnProperty(c)&&"layout"!==c&&"paint"!==c&&"filter"!==c&&"metadata"!==c&&"minzoom"!==c&&"maxzoom"!==c&&(0===c.indexOf("paint.")?ut(s[c],l[c],i,o,c.slice(6),nt.setPaintProperty):n(s[c],l[c])||i.push({command:nt.setLayerProperty,args:[o,c,l[c]]}));for(c in l)l.hasOwnProperty(c)&&!s.hasOwnProperty(c)&&"layout"!==c&&"paint"!==c&&"filter"!==c&&"metadata"!==c&&"minzoom"!==c&&"maxzoom"!==c&&(0===c.indexOf("paint.")?ut(s[c],l[c],i,o,c.slice(6),nt.setPaintProperty):n(s[c],l[c])||i.push({command:nt.setLayerProperty,args:[o,c,l[c]]}))}else i.push({command:nt.removeLayer,args:[o]}),u=m[m.lastIndexOf(o)+1],i.push({command:nt.addLayer,args:[l,u]})}(o,t.layers,i)}catch(r){console.warn("Unable to compute style diff:",r),i=[{command:nt.setStyle,args:[t]}]}return i}(this.serialize(),e).filter(function(e){return!(e.command in ui)});if(0===r.length)return!1;var a=r.filter(function(e){return!(e.command in li)});if(a.length>0)throw new Error("Unimplemented: ".concat(a.map(function(e){return e.command}).join(", "),"."));return r.forEach(function(e){"setTransition"!==e.command&&"setProjection"!==e.command&&t[e.command].apply(t,e.args)}),this.stylesheet=e,this._updateMapProjection(),!0}},{key:"addImage",value:function(e,t){return this.getImage(e)?this.fire(new i.ErrorEvent(new Error("An image with this name already exists."))):(this.imageManager.addImage(e,t),this._afterImageUpdated(e),this)}},{key:"updateImage",value:function(e,t){this.imageManager.updateImage(e,t)}},{key:"getImage",value:function(e){return this.imageManager.getImage(e)}},{key:"removeImage",value:function(e){return this.getImage(e)?(this.imageManager.removeImage(e),this._afterImageUpdated(e),this):this.fire(new i.ErrorEvent(new Error("No image with this name exists.")))}},{key:"_afterImageUpdated",value:function(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new i.Event("data",{dataType:"style"}))}},{key:"listImages",value:function(){return this._checkLoaded(),this._availableImages.slice()}},{key:"addSource",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(this._checkLoaded(),void 0!==this.getSource(e))throw new Error("There is already a source with this ID");if(!t.type)throw new Error("The type property must be defined, but only the following properties were given: ".concat(Object.keys(t).join(", "),"."));if(!(["vector","raster","geojson","video","image"].indexOf(t.type)>
1=0&&this._validate(i.validateSource,"sources.".concat(e),t,null,n))){this.map&&this.map._collectResourceTiming&&(t.collectResourceTiming=!0);var a=We(e,t,this.dispatcher,this);a.setEventedParent(this,function(){return{isSourceLoaded:r._isSourceCacheLoaded(e),source:a.serialize(),sourceId:e}});var o=function(t){var n=(t?"symbol:":"other:")+e,o=r._sourceCaches[n]=new i.SourceCache(n,a,t);(t?r._symbolSourceCaches:r._otherSourceCaches)[e]=o,o.style=r,o.onAdd(r.map)};o(!1),"vector"!==t.type&&"geojson"!==t.type||o(!0),a.onAdd&&a.onAdd(this.map),this._changed=!0}}},{key:"removeSource",value:function(e){this._checkLoaded();var t=this.getSource(e);if(!t)throw new Error("There is no source with this ID");for(var r in this._layers)if(this._layers[r].source===e)return this.fire(new i.ErrorEvent(new Error('Source "'.concat(e,'" cannot be removed while layer "').concat(r,'" is using it.'))));if(this.terrain&&this.terrain.get().source===e)return this.fire(new i.ErrorEvent(new Error('Source "'.concat(e,'" cannot be removed while terrain is using it.'))));var n,a=l(this._getSourceCaches(e));try{for(a.s();!(n=a.n()).done;){var o=n.value;delete this._sourceCaches[o.id],delete this._updatedSources[o.id],o.fire(new i.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:o.getSource().id})),o.setEventedParent(null),o.clearTiles()}}catch(s){a.e(s)}finally{a.f()}return delete this._otherSourceCaches[e],delete this._symbolSourceCaches[e],t.setEventedParent(null),t.onRemove&&t.onRemove(this.map),this._changed=!0,this}},{key:"setGeoJSONSourceData",value:function(e,t){this._checkLoaded(),this.get
1Source(e).setData(t),this._changed=!0}},{key:"getSource",value:function(e){var t=this._getSourceCache(e);return t&&t.getSource()}},{key:"_getSources",value:function(){var e=[];for(var t in this._otherSourceCaches){var i=this._getSourceCache(t);i&&e.push(i.getSource())}return e}},{key:"addLayer",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this._checkLoaded();var n=e.id;if(this.getLayer(n))this.fire(new i.ErrorEvent(new Error('Layer with id "'.concat(n,'" already exists on this map'))));else{var a;if("custom"===e.type){if(si(this,i.validateCustomStyleLayer(e)))return;a=i.createStyleLayer(e)}else{if("object"==typeof e.source&&(this.addSource(n,e.source),e=i.clone$1(e),e=i.extend(e,{source:n})),this._validate(i.validateLayer,"layers.".concat(n),e,{arrayIndex:-1},r))return;a=i.createStyleLayer(e),this._validateLayer(a),a.setEventedParent(this,{layer:{id:n}}),this._serializedLayers[a.id]=a.serialize(),this._updateLayerCount(a,!0)}var o=t?this._order.indexOf(t):this._order.length;
1if(t&&-1===o)this.fire(new i.ErrorEvent(new Error('Layer with id "'.concat(t,'" does not exist on this map.'))));else{this._order.splice(o,0,n),this._layerOrderChanged=!0,this._layers[n]=a;var s=this._getLayerSourceCache(a);if(this._removedLayers[n]&&a.source&&s&&"custom"!==a.type){var l=this._removedLayers[n];delete this._removedLayers[n],l.type!==a.type?this._updatedSources[a.source]="clear":(this._updatedSources[a.source]="reload",s.pause())}this._updateLayer(a),a.onAdd&&a.onAdd(this.map),this._updateDrapeFirstLayers()}}}},{key:"moveLayer",value:function(e,t){if(this._checkLoaded(),this._changed=!0,this._layers[e]){if(e!==t){var r=this._order.indexOf(e);this._order.splice(r,1);var n=t?this._order.indexOf(t):this._order.length;t&&-1===n?this.fire(new i.ErrorEvent(new Error('Layer with id "'.concat(t,'" does not exist on this map.')))):(this._order.splice(n,0,e),this._layerOrderChanged=!0,this._updateDrapeFirstLayers())}}else this.fire(new i.ErrorEvent(new Error("The layer '".concat(e,"' does not exist in the map's style and cannot be moved."))))}},{key:"removeLayer",value:function(e){this._checkLoaded();var t=this._layers[e];if(t){t.setEventedParent(null),this._updateLayerCount(t,!1);var r=this._order.indexOf(e);this._order.splice(r,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=t,delete this._layers[e],delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],t.onRemove&&t.onRemove(this.map),this._updateDrapeFirstLayers()}else this.fire(new i.ErrorEvent(new Error("The layer '".concat(e,"' does not exist in the map's style and cannot be removed."))))}},{key:"getLayer",value:function(e){return this._layers[e]}},{key:"hasLayer",value:function(e){return e in this._layers}},{key:"hasLayerType",value:function(e){for(var t in this._layers)if(this._layers[t].type===e)return!0;return!1}},{key:"setLayerZoomRange",value:function(e,t,r){this._checkLoaded();var n=this.getLayer(e);n?n.minzoom===t&&n.maxzoom===r||(null!=t&&(n.minzoom=t),null!=r&&(n.maxzoom=r),this._updateLayer(n)):this.fire(new i.ErrorEvent(new Error("The layer '".concat(e,"' does not exist in the map's style and cannot have zoom extent."))))}},{key:"setFilter",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this._checkLoaded();var a=this.getLayer(e);if(a){if(!n(a.filter,t))return null==t?(a.filter=void 0,void this._updateLayer(a)):void(this._validate(i.validateFilter,"layers.".concat(a.id,".filter"),t,{layerType:a.type},r)||(a.filter=i.clone$1(t),this._updateLayer(a)))}else this.fire(new i.ErrorEvent(new Error("The layer '".concat(e,"' does not exist in the map's style and cannot be filtered."))))}},{key:"getFilter",value:function(e){var t=this.getLayer(e);return t&&i.clone$1(t.filter)}},{key:"setLayoutProperty",value:function(e,t,r){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};this._checkLoaded();var o=this.getLayer(e);o?n(o.getLayoutProperty(t),r)||(o.setLayoutProperty(t,r,a),this._updateLayer(o)):this.fire(new i.ErrorEvent(new Error("The layer '".concat(e,"' does not exist in the map's style and cannot be styled."))))}},{key:"getLayoutProperty",value:function(e,t){var r=this.getLayer(e);if(r)return r.getLayoutProperty(t);this.fire(new i.ErrorEvent(new Error("The layer '".concat(e,"' does not exist in the map's style."))))}},{key:"setPaintProperty",value:function(e,t,r){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};this._checkLoaded();var o=this.getLayer(e);o?n(o.getPaintProperty(t),r)||(o.setPaintProperty(t,r,a)&&this._updateLayer(o),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new i.ErrorEvent(new Error("The layer '".concat(e,"' does not exist in the map's style and cannot be styled."))))}},{key:"getPaintProperty",value:function(e,t){var i=this.getLayer(e);return i&&i.getPaintProperty(t)}},{key:"setFeatureState",value:function(e,t){this._checkLoaded();var r=e.source,n=e.sourceLayer,a=this.getSource(r);if(a){var o=a.type;if("geojson"===o&&n)this.fire(new i.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));else if("vector"!==o||n){void 0===e.id&&this.fire(new i.ErrorEvent(new Error("The feature id parameter must be provided.")));var s,u=l(this._getSourceCaches(r));try{for(u.s();!(s=u.n()).done;){s.value.setFeatureState(n,e.id,t)}}catch(c){u.e(c)}finally{u.f()}}else this.fire(new i.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new i.ErrorEvent(new Error("The source '".concat(r,"' does not exist in the map's style."))))}},{key:"removeFeatureState",value:function(e,t){this._checkLoaded();var r=e.source,n=this.getSource(r);if(n){var a=n.type,o="vector"===a?e.sourceLayer:void 0;if("vector"!==a||o)if(t&&"string"!=typeof e.id&&"number"!=typeof e.id)this.fire(new i.ErrorEvent(new Error("A feature id is required to remove its specific state property.")));else{var s,u=l(this._getSourceCaches(r));try{for(u.s();!(s=u.n()).done;
1){s.value.removeFeatureState(o,e.id,t)}}catch(c){u.e(c)}finally{u.f()}}else this.fire(new i.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new i.ErrorEvent(new Error("The source '".concat(r,"' does not exist in the map's style."))))}},{key:"getFeatureState",value:function(e){this._checkLoaded();var t=e.source,r=e.sourceLayer,n=this.getSource(t);if(n){if("vector"!==n.type||r)return void 0===e.id&&this.fire(new i.ErrorEvent(new Error("The feature id parameter must be provided."))),this._getSourceCaches(t)[0].getFeatureState(r,e.id);this.fire(new i.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new i.ErrorEvent(new Error("The source '".concat(t,"' does not exist in the map's style."))))}},{key:"getTransition",value:function(){return i.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}},{key:"serialize",value:function(){var e={};for(var t in this._sourceCaches){var r=this._sourceCaches[t].getSource();e[r.id]||(e[r.id]=r.serialize())}return i.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,terrain:this.getTerrain()||void 0,fog:this.stylesheet.fog,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:e,layers:this._serializeLayers(this._order)},function(e){return void 0!==e})}},{key:"_updateLayer",value:function(e){this._updatedLayers[e.id]=!0;var t=this._getLayerSourceCache(e);e.source&&!this._updatedSources[e.source]&&t&&"raster"!==t.getSource().type&&(this._updatedSources[e.source]="reload",t.pause()),this._changed=!0,e.invalidateCompiledFilter()}},{key:"_flattenAndSortRenderedFeatures",value:function(e){for(var t=this,i=function(e){return"fill-extrusion"===t._layers[e].type},r={},n=[],a=this._order.length-1;a>=0;a--){var o=this._order[a];if(i(o)){r[o]=a;var s,u=l(e);try{for(u.s();!(s=u.n()).done;){var c=s.value[o];if(c){var h,f=l(c);try{for(f.s();!(h=f.n()).done;){var d=h.value;n.push(d)}}catch(E){f.e(E)}finally{f.f()}}}}catch(E){u.e(E)}finally{u.f()}}}n.sort(function(e,t){return t.intersectionZ-e.intersectionZ});for(var p=[],m=this._order.length-1;m>=0;m--){var v=this._order[m];if(i(v))for(var y=n.length-1;y>=0;y--){var _=n[y].feature;if(r[_.layer.id]<m)break;p.push(_),n.pop()}else{var g,x=l(e);try{for(x.s();!(g=x.n()).done;){var b=g.value[v];if(b){var w,k=l(b);try{for(k.s();!(w=k.n()).done;){var T=w.value;p.push(T.feature)}}catch(E){k.e(E)}finally{k.f()}}}}catch(E){x.e(E)}finally{x.f()}}}return p}},{key:"queryRenderedFeatures",value:function(e,t,r){var n=this;t&&t.filter&&this._validate(i.validateFilter,"queryRenderedFeatures.filter",t.filter,null,t);var a={};if(t&&t.layers){if(!Array.isArray(t.layers))return this.fire(new i.ErrorEvent(new Error("parameters.layers must be an Array."))),[];var o,s=l(t.layers);try{for(s.s();!(o=s.n()).done;){var u=o.value,c=this._layers[u];if(!c)return this.fire(new i.ErrorEvent(new Error("The layer '".concat(u,"' does not exist in the map's style and cannot be queried for features.")))),[];a[c.source]=!0}}catch(v){s.e(v)}finally{s.f()}}var h=[];t.availableImages=this._availableImages;var f=t&&t.layers?t.layers.some(function(e){var t=n.getLayer(e);return t&&t.is3D()}):this.has3DLayers(),d=X.createFromScreenPoints(e,r);for(var p in this._sourceCaches){var m=this._sourceCaches[p].getSource().id;t.layers&&!a[m]||h.push(He(this._sourceCaches[p],this._layers,this._serializedLayers,d,t,r,f,!!this.map._showQueryGeometry))}return this.placement&&h.push(function(e,t,i,r,n,a,o){var s,u={},c=a.queryRenderedSymbols(r),h=[],f=l(Object.keys(c).map(Number));try{for(f.s();!(s=f.n()).done;){var d=s.value;h.push(o[d])}}catch(v){f.e(v)}finally{f.f()}h.sort(Ke);for(var p=function(){var i=y[m],r=i.featureIndex.lookupSymbolFeatures(c[i.bucketInstanceId],t,i.bucketIndex,i.sourceLayerIndex,n.filter,n.layers,n.availableImages,e);for(var a in r){var o=u[a]=u[a]||[],s=r[a];s.sort(function(e,t){var r=i.featureSortOrder;if(r){var n=r.indexOf(e.featureIndex);return r.indexOf(t.featureIndex)-n}return t.featureIndex-e.featureIndex});var h,f=l(s);try{for(f.s();!(h=f.n()).done;){var d=h.value;o.push(d)}}catch(v){f.e(v)}finally{f.f()}}},m=0,y=h;m<y.length;m++)p();var _=function(t){u[t].forEach(function(r){var n=r.feature,a=i(e[t]);if(a){var o=a.getFeatureState(n.layer["source-layer"],n.id);n.source=n.layer.source,n.layer["source-layer"]&&(n.sourceLayer=n.layer["source-layer"]),n.state=o}})};for(var g in u)_(g);return u}(this._layers,this._serializedLayers,this._getLayerSourceCache.bind(this),d.screenGeometry,t,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(h)}},{key:"querySourceFeatures",value:function(e,t){t&&t.filter&&this._val
1idate(i.validateFilter,"querySourceFeatures.filter",t.filter,null,t);var r,n=[],a=l(this._getSourceCaches(e));try{for(a.s();!(r=a.n()).done;){var o=r.value;n=n.concat(Ye(o,t))}}catch(s){a.e(s)}finally{a.f()}return n}},{key:"addSourceType",value:function(e,t,i){return a.getSourceType(e)?i(new Error('A source type called "'.concat(e,'" already exists.'))):(a.setSourceType(e,t),t.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:e,url:t.workerSourceURL},i):i(null,null))}},{key:"getLight",value:function(){return this.light.getLight()}},{key:"setLight",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this._checkLoaded();var i=this.light.getLight(),r=!1;for(var a in e)if(!n(e[a],i[a])){r=!0;break}if(r){var o=this._setTransitionParameters({duration:300,delay:0});this.light.setLight(e,t),this.light.updateTransitions(o)}}},{key:"getTerrain",value:function(){return this.terrain&&1===this.terrain.drapeRenderMode?this.terrain.get():null}},{key:"setTerrainForDraping",value:function(){this.setTerrain({source:"",exaggeration:0},0)}},{key:"setTerrain",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(this._checkLoaded(),!e)return delete this.terrain,delete this.stylesheet.terrain,this.dispatcher.broadcast("enableTerrain",!1),this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);var r=e;if(1===t){if("object"==typeof r.source){var a="terrain-dem-src";this.addSource(a,r.source),r=i.clone$1(r),r=i.extend(r,{source:a})}if(this._validate(i.validateTerrain,"terrain",r))return}if(!this.terrain||this.terrain&&t!==this.terrain.drapeRenderMode){if(!r)return;this._createTerrain(r,t)}else{for(var o=this.terrain,s=o.get(),l=0,u=Object.keys(i.spec.terrain);l<u.length;l++){var c=u[l];!r.hasOwnProperty(c)&&i.spec.terrain[c].default&&(r[c]=i.spec.terrain[c].default)}for(var h in r)if(!n(r[h],s[h])){o.set(r),this.stylesheet.terrain=r;var f=this._setTransitionParameters({duration:0});o.updateTransitions(f);break}}this._updateDrapeFirstLayers(),this._markersNeedUpdate=!0}},{key:"_createFog",value:function(e){var t=this.fog=new Z(e,this.map.transform);this.stylesheet.fog=e;var i=this._setTransitionParameters({duration:0});t.updateTransitions(i)}},{key:"_updateMarkersOpacity",value:function(){var e=this;0!==this.map._markers.length&&this.map._requestDomTask(function(){var t,i=l(e.map._markers);try{for(i.s();!(t=i.n()).done;){t.value._evaluateOpacity()}}catch(r){i.e(r)}finally{i.f()}})}},{key:"getFog",value:function(){return this.fog?this.fog.get():null}},{key:"setFog",value:function(e){if(this._checkLoaded(),!e)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){var t=this.fog,i=t.get();for(var r in 0===Object.keys(e).length&&t.set(e),e)if(!n(e[r],i[r])){t.set(e),this.stylesheet.fog=e;var a=this._setTransitionParameters({duration:0});t.updateTransitions(a);break}}else this._createFog(e);this._markersNeedUpdate=!0}},{key:"_setTransitionParameters",value:function(e){return{now:i.exported.now(),transition:i.extend(e,this.stylesheet.transition)}}},{key:"_updateDrapeFirstLayers",value:function(){var e,t,i=this;if(this.map._optimizeForTerrain&&this.terrain){var n=this._order.filter(function(e){return i.isLayerDraped(i._layers[e])}),a=this._order.filter(function(e){return!i.isLayerDraped(i._layers[e])});this._drapedFirstOrder=[],(e=this._drapedFirstOrder).push.apply(e,r(n)),(t=this._drapedFirstOrder).push.apply(t,r(a))}}},{key:"_createTerrain",value:function(e,t){var i=this.terrain=new U(e,t);this.stylesheet.terrain=e,this.dispatcher.broadcast("enableTerrain",!this.terrainSetForDrapingOnly()),this._force3DLayerUpdate();var r=this._setTransitionParameters({duration:0});i.updateTransitions(r)}},{key:"_force3DLayerUpdate",value:function(){for(var e in this._layers){var t=this._layers[e];"fill-extrusion"===t.type&&this._updateLayer(t)}}},{key:"_forceSymbolLayerUpdate",value:function(){for(var e in this._layers){var t=this._layers[e];"symbol"===t.type&&this._updateLayer(t)}}},{key:"_validate",value:function(e,t,r,n){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};
1return(!a||!1!==a.validate)&&si(this,e.call(i.validateStyle,i.extend({key:t,style:this.serialize(),value:r,styleSpec:i.spec},n)))}},{key:"_remove",value:function(){for(var e in this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),i.evented.off("pluginStateChange",this._rtlTextPluginCallback),this._layers)this._layers[e].setEventedParent(null);for(var t in this._sourceCaches)this._sourceCaches[t].clearTiles(),this._sourceCaches[t].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}},{key:"_clearSource",value:function(e){var t,i=l(this._getSourceCaches(e));try{for(i.s();!(t=i.n()).done;){t.value.clearTiles()}}catch(r){i.e(r)}finally{i.f()}}},{key:"_reloadSource",value:function(e){var t,i=l(this._getSourceCaches(e));try{for(i.s();!(t=i.n()).done;){var r=t.value;r.resume(),r.reload()}}catch(n){i.e(n)}finally{i.f()}}},{key:"_reloadSources",value:function(){var e,t=l(this._getSources());try{for(t.s();!(e=t.n()).done;){var i=e.value;i.reload&&i.reload()}}catch(r){t.e(r)}finally{t.f()}}},{key:"_updateSources",value:function(e){for(var t in this._sourceCaches)this._sourceCaches[t].update(e)}},{key:"_generateCollisionBoxes",value:function(){for(var e in this._sourceCaches){var t=this._sourceCaches[e];t.resume(),t.reload()}}},{key:"_updatePlacement",value:function(e,t,r,n){var a,o=this,s=arguments.length>4&&void 0!==arguments[4]&&arguments[4],u=!1,c=!1,h={},f=l(this._order);try{for(f.s();!(a=f.n()).done;){var d=a.value,p=this._layers[d];if("symbol"===p.type){if(!h[p.source]){var m=function(){var e=o._getLayerSourceCache(p);if(!e)return"continue";h[p.source]=e.getRenderableIds(!0).map(function(t){return e.getTileByID(t)}).sort(function(e,t){return t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1)})}();if("continue"===m)continue}var v=this.crossTileSymbolIndex.addLayer(p,h[p.source],e.center.lng,e.projection);u=u||v}}}catch(b){f.e(b)}finally{f.f()}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),s=s||this._layerOrderChanged||0===r,this._layerOrderChanged&&this.fire(new i.Event("neworder")),(s||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(i.exported.now(),e.zoom))&&(this.pauseablePlacement=new ti(e,this._order,s,t,r,n,this.placement,this.fog&&e.projection.supportsFog?this.fog.state:null),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,h),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(i.exported.now()),c=!0),u&&this.pauseablePlacement.placement.setStale()),c||u){var y,_=l(this._order);try{for(_.s();!(y=_.n()).done;){var g=y.value,x=this._layers[g];"symbol"===x.type&&this.placement.updateLayerOpacities(x,h[x.source])}}catch(b){_.e(b)}finally{_.f()}}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(i.exported.now())}},{key:"_releaseSymbolFadeTiles",value:function(){for(var e in this._sourceCaches)this._sourceCaches[e].releaseSymbolFadeTiles()}},{key:"getImages",value:function(e,t,i){this.imageManager.getImages(t.icons,i),this._updateTilesForChangedImages();var r=function(e){e&&e.setDependencies(t.tileID.key,t.type,t.icons)};r(this._otherSourceCaches[t.source]),r(this._symbolSourceCaches[t.source])}},{key:"getGlyphs",value:function(e,t,i){this.glyphManager.getGlyphs(t.stacks,i)}},{key:"getResource",value:function(e,t,r){return i.makeRequest(t,r)}},{key:"_getSourceCache",value:function(e){return this._otherSourceCaches[e]}},{key:"_getLayerSourceCache",value:function(e){return"symbol"===e.type?this._symbolSourceCaches[e.source]:this._otherSourceCaches[e.source]}},{key:"_getSourceCaches",value:function(e){var t=[];return this._otherSourceCaches[e]&&t.push(this._otherSourceCaches[e]),this._symbolSourceCaches[e]&&t.push(this._symbolSourceCaches[e]),t}},{key:"_isSourceCacheLoaded",value:function(e){var t=this._getSourceCaches(e);return 0===t.length?(this.fire(new i.ErrorEvent(new Error("There is no source with ID '".concat(e,"'")))),!1):t.every(function(e){return e.loaded()})}},{key:"has3DLayers",value:function(){return this._num3DLayers>0}},{key:"hasSymbolLayers",value:function(){return this._numSymbolLayers>0}},{key:"hasCircleLayers",value:function(){return this._numCircleLayers>0}},{key:"_clearWorkerCaches",value:function(){this.dispatcher.broadcast("clearCaches")}},{key:"destroy",value:function(){this._clearWorkerCaches(),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}]),a}(i.Evented);fi.getSourceType=function(e){return qe[e]},fi.setSourceType=function(e,t){qe[e]=t},fi.registerForPluginStateChange=i.registerForPluginStateChange;var di,pi,mi="\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#define EXTENT 8192.0\n#define HALF_PI PI/2.0\n#define QUARTER_PI PI/4.0\n#define RAD_TO_DEG 180.0/PI\n#define DEG_TO_RAD PI/180.0\n#define GLOBE_RADIUS EXTENT/PI/2.0",vi="attribute highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;varying highp vec3 v_uv;
1void 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;}",yi="\n#define ELEVATION_SCALE 7.0\n#define ELEVATION_OFFSET 450.0\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(\nmix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}\n#else\nvec3 elevationVector(vec2 pos) { return vec3(0,0,1); }\n#endif\nconst float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt)\n{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}\n#ifdef TERRAIN\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nuniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;\n#else\nuniform sampler2D u_dem;uniform sampler2D u_dem_prev;\n#endif\nuniform vec4 u_dem_unpack;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;uniform sampler2D u_depth;uniform vec2 u_depth_size_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float decodeElevation(vec4 v) {return dot(vec4(v.xyz*255.0,-1.0),u_dem_unpack);}float currentElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem,pos).a;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem,pos));\n#ifdef TERRAIN_DEM_NEAREST_FILTER\nreturn u_exaggeration*tl;\n#endif\nfloat tr=decodeElevation(texture2D(u_dem,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}float prevElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem_prev,pos).a;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem_prev,pos));float tr=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem_prev,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}\n#ifdef TERRAIN_VERTEX_MORPHING\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nfloat nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}\n#else\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nreturn currentElevation(apos);}\n#endif\nhighp float unpack_depth(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;float depth=unpack_depth(texture2D(u_depth,(coord.xy+1.0)*0.5));return coord.z > depth+0.0005;}float occlusionFade(vec4 frag) {vec3 coord=frag.xyz/frag.w;vec3 df=vec3(5.0*u_depth_size_inv,0.0);vec2 uv=0.5*coord.xy+0.5;vec4 depth=vec4(\nunpack_depth(texture2D(u_depth,uv-df.xz)),unpack_depth(texture2D(u_depth,uv+df.xz)),unpack_depth(texture2D(u_depth,uv-df.zy)),unpack_depth(texture2D(u_depth,uv+df.zy))\n);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z-0.001)-depth),0.0,1.0));}vec4 fourSample(vec2 pos,vec2 off) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nfloat tl=texture2D(u_dem,pos).a;float tr=texture2D(u_dem,pos+vec2(off.x,0.0)).a;float bl=texture2D(u_dem,pos+vec2(0.0,off.y)).a;float br=texture2D(u_dem,pos+off).a;\n#else\nvec4 demtl=vec4(texture2D(u_dem,pos).xyz*255.0,-1.0);float tl=dot(demtl,u_dem_unpack);
1vec4 demtr=vec4(texture2D(u_dem,pos+vec2(off.x,0.0)).xyz*255.0,-1.0);float tr=dot(demtr,u_dem_unpack);vec4 dembl=vec4(texture2D(u_dem,pos+vec2(0.0,off.y)).xyz*255.0,-1.0);float bl=dot(dembl,u_dem_unpack);vec4 dembr=vec4(texture2D(u_dem,pos+off).xyz*255.0,-1.0);float br=dot(dembr,u_dem_unpack);\n#endif\nreturn vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}\n#else\nfloat elevation(vec2 pos) { return 0.0; }bool isOccluded(vec4 frag) { return false; }float occlusionFade(vec4 frag) { return 1.0; }\n#endif",_i="#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;varying vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}\n#endif",gi="#ifdef FOG\nuniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump float u_fog_temporal_offset;varying vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,opacity);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec3 fog_dither(vec3 color) {vec2 dither_seed=gl_FragCoord.xy+u_fog_temporal_offset;return dither(color,dither_seed);}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}\n#endif",xi=[];Ei(mi,xi),Ei(yi,xi),Ei(_i,xi),Ei(gi,xi),di=Mi("",yi),pi=Mi(gi,_i);var bi=Mi("\n#if __VERSION__ >=300\n#define varying in\n#define gl_FragColor glFragColor\n#define texture2D texture\n#define textureCube texture\nout vec4 glFragColor;\n#endif\nhighp vec3 hash(highp vec2 p) {highp vec3 p3=fract(p.xyx*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract((p3.xxy+p3.yzz)*p3.zyx);}
1vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;return color+rnd/255.0;}highp float unpack_depth(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}","\n#if __VERSION__ >=300\n#define attribute in\n#define varying out\n#define texture2D texture\n#endif\nfloat wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\n#ifndef PROJECTED_POS_ON_VIEWPORT\nfloat tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;\n#else\nreturn vec3(0.0);\n#endif\n}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(\nunpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);//Normalized device coordinate that is not rendered."),wi=mi,ki="\n#ifdef GL_ES\nprecision mediump float;\n#else\n\n#if !defined(lowp)\n#define lowp\n#endif\n\n#if !defined(mediump)\n#define mediump\n#endif\n\n#if !defined(highp)\n#define highp\n#endif\n\n#endif",Ti={background:Mi("uniform vec4 u_color;uniform float u_opacity;\n#ifdef LIGHTING_3D_MODE\nvarying vec4 v_color;\n#endif\nvoid main() {vec4 out_color;\n#ifdef LIGHTING_3D_MODE\nout_color=v_color;\n#else\nout_color=u_color;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#ifdef LIGHTING_3D_MODE\nuniform vec4 u_color;varying vec4 v_color;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef LIGHTING_3D_MODE\nv_color=apply_lighting(u_color);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),backgroundPattern:Mi("uniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos;void main() {vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=texture2D(u_image,pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_tile_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),circle:Mi("varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(\nantialiased_blur,0.0,extrude_length-radius
1/(radius+stroke_width)\n);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\n#endif\ngl_FragColor=out_color*(v_visibility*opacity_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","#define NUM_VISIBILITY_RINGS 2\n#define INV_SQRT2 0.70710678\n#define ELEVATION_BIAS 0.0001\n#define NUM_SAMPLES_PER_RING 16\nuniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nvarying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {\n#if defined(TERRAIN)\nreturn elevation(pos)+ELEVATION_BIAS;\n#else\nreturn 0.0;\n#endif\n}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);\n#ifdef PITCH_WITH_MAP\n#ifdef PROJECTION_GLOBE_VIEW\nreturn u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );\n#else\nreturn u_matrix*( world_center+vec4(sample_offset,0,0) );\n#endif\n#else\nreturn projected_center+vec4(sample_offset,0,0);\n#endif\n}float get_sample_step() {\n#ifdef PITCH_WITH_MAP\nreturn 2.0*PI/float(NUM_SAMPLES_PER_RING);\n#else\nreturn PI/float(NUM_SAMPLES_PER_RING);\n#endif\n}void main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1);\n#else \nsurface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1);\n#endif\nvec4 projected_center=u_matrix*world_center;float view_scale=0.0;\n#ifdef PITCH_WITH_MAP\n#ifdef SCALE_WITH_MAP\nview_scale=1.0;\n#else\nview_scale=projected_center.w/u_camera_to_center_distance;\n#endif\n#else\n#ifdef SCALE_WITH_MAP\nview_scale=u_camera_to_center_distance;\n#else\nview_scale=projected_center.w;\n#endif\n#endif\ngl_Position=project_vertex(extrude,world_center,projected_center,radiu
1s,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:Mi("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:Mi("uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef FOG\nif (u_is_globe==0) {gl_FragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nvarying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(a_pos*0.5);vec3 pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#else\npos=vec3(tilePos+extrude,elevation(tilePos));\n#endif\ngl_Position=u_matrix*vec4(pos,1);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),heatmapTexture:Mi("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}","attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:Mi("varying float v_placed;varying float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);gl_FragColor =mix(red,blue,step(0.5,v_placed))*0.5;gl_FragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}","attribute vec3 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;attribute float a_size_scale;attribute vec2 a_padding;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_pos+elevationVector(a_anchor_pos)*elevation(a_anchor_pos),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:Mi("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos_2f;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd  =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz  /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(\nmix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(\n0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:Mi("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;\n#endif\nvarying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;\n#ifdef PROJECTION_GLOBE_VIEW\ngl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1
1);\n#else\ngl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);\n#endif\n}"),fill:Mi("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nvec4 out_color=color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillOutline:Mi("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillOutlinePattern:Mi("uniform vec2 u_texsize;uniform sampler2D u_image;varying vec2 v_pos;varying vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=texture2D(u_image,pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos;varying vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillPattern:Mi("uniform vec2 u_texsize;uniform sampler2D u_image;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec4 out_color=texture2D(u_image,pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),fillExtrusion:Mi("varying vec4 v_color;\n#ifdef RENDER_SHADOWS\nvarying highp vec4 v_pos_light_view_0;varying highp vec4 v_pos_light_view_1;varying float v_depth;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\n#ifdef ZERO_ROOF_RADIUS\nvarying vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)\nvarying highp vec3 v_normal;\n#endif\nvoid main() {\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)\nvec3 normal=v_normal;\n#endif\nfloat z;vec4 color;\n#ifdef ZERO_ROOF_RADIUS\nz=float(normal.z > 0.00001);color=mix(v_color,v_roof_color,z);\n#else\ncolor=v_color;\n#endif\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0
1),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;\n#ifdef ZERO_ROOF_RADIUS\nconcave*=(1.0-z);\n#endif\nfloat x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);color.rgb=color.rgb*shade;\n#endif\n#ifdef RENDER_SHADOWS\n#ifdef ZERO_ROOF_RADIUS\nnormal=mix(normal,vec3(0.0,0.0,1.0),z);\n#endif\ncolor.xyz=shadowed_color_normal(color.xyz,normalize(normal),v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\nvarying vec4 v_color;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;varying highp vec4 v_pos_light_view_0;varying highp vec4 v_pos_light_view_1;varying float v_depth;\n#endif\n#ifdef ZERO_ROOF_RADIUS\nvarying vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)\nvarying highp vec3 v_normal;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)\nv_normal=normal;\n#endif\nbase=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=0.0;float c_ele;vec3 pos;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);pos=vec3(pos_nx.xy,h);\n#else\nh=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);\n#ifdef RENDER_SHADOWS\nv_pos_light_view_0=u_light_matrix_0*vec4(pos,1);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1);v_depth=gl_Position.w;\n#endif\nfloat NdotL=0.0;float colorvalue=0.0;\n#ifdef LIGHTING_3D_MODE\nNdotL=calculate_NdotL(normal);\n#else\ncolorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);\n#endif\nif (normal.y !=0.0) {float r=0.84;\n#ifndef LIGHTING_3D_MODE\nr=mix(0.7,0.98,1.0-u_lightintensity);
1\n#endif\nNdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}v_color=vec4(0.0,0.0,0.0,1.0);\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\nv_color=apply_lighting(color,NdotL);\n#else\nv_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));\n#endif\nv_color*=u_opacity;\n#ifdef ZERO_ROOF_RADIUS\nv_roof_color=vec4(0.0,0.0,0.0,1.0);\n#ifdef LIGHTING_3D_MODE\nv_roof_color=apply_lighting(color,calculate_NdotL(vec3(0.0,0.0,1.0)));\n#else\nfloat roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));\n#endif\nv_roof_color*=u_opacity;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),fillExtrusionPattern:Mi("uniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nvarying float v_NdotL;\n#endif\nvarying vec2 v_pos;varying vec4 v_lighting;uniform lowp float u_opacity;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec4 out_color=texture2D(u_image,pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color,v_NdotL)*u_opacity;\n#else\nout_color=out_color*v_lighting;\n#endif\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\nvarying vec2 v_pos;varying vec4 v_lighting;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nvarying float v_NdotL;\n#endif\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;
1base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=z;vec3 p;float c_ele;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);p=vec3(pos_nx.xy,h);\n#else\np=vec3(pos_nx.xy,z);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0\n? pos_nx.xy\n: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0;\n#ifdef LIGHTING_3D_MODE\nNdotL=calculate_NdotL(normal);\n#else\nNdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);\n#endif\nif (normal.y !=0.0) {float r=0.84;\n#ifndef LIGHTING_3D_MODE\nr=mix(0.7,0.98,1.0-u_lightintensity);\n#endif\nNdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(ce
1ntroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\nv_NdotL=NdotL;\n#else\nv_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#endif \n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}"),hillshadePrepare:Mi("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nreturn texture2D(u_image,coord).a/4.0;\n#else\nvec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;\n#endif\n}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2(\n(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)\n)/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(\nderiv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:Mi("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef LIGHTING_3D_MODE\ngl_FragColor=apply_lighting(gl_FragColor);\n#endif\n#ifdef FOG\ngl_FragColor=fog_dither(fog_apply_premultiplied(gl_FragColor,v_fog_pos));\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),line:Mi("uniform lowp float u_device_pixel_ratio;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec4 v_uv;\n#ifdef RENDER_LINE_DASH\nuniform sampler2D u_dash_image;varying vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;\n#endif\nuniform float u_border_width;uniform vec4 u_border_color;float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nfloat linearstep(float edge0,float edge1,float x) {return  
1clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);\n#ifdef RENDER_LINE_DASH\nfloat sdfdist=texture2D(u_dash_image,v_tex).a;float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;alpha*=linearstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);\n#endif\nhighp vec4 out_color;\n#ifdef RENDER_LINE_GRADIENT\nout_color=texture2D(u_gradient_image,v_uv.xy);\n#else\nout_color=color;\n#endif\nfloat trimmed=1.0;\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {if (line_progress <=trim_end && line_progress >=trim_start) {out_color=vec4(0,0,0,0);trimmed=0.0;}}\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef RENDER_LINE_ALPHA_DISCARD\nif (alpha < u_alpha_discard_threshold) {discard;}\n#endif\n#ifdef RENDER_LINE_BORDER\nfloat edgeBlur=(u_border_width+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);\n#ifdef RENDER_LINE_BORDER_AUTO\nfloat Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}\n#else\nout_color.rgb=mix(u_border_color.rgb*u_border_color.a*trimmed,out_color.rgb,smoothAlpha);\n#endif\n}\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define EXTRUDE_SCALE 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nattribute highp vec4 a_packed;\n#endif\n#ifdef RENDER_LINE_DASH\nattribute float a_linesofar;\n#endif\nuniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec4 v_uv;\n#ifdef RENDER_LINE_DASH\nuniform vec2 u_texsize;uniform float u_tile_units_to_pixels;varying vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform float u_image_height;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nfloat a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];\n#ifdef RENDER_LINE_GRADIENT\nhighp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec4(a_uv_x,a_split_index*texel_height-half_texel_height,a_clip_start,a_clip_end);\n#else\nv_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end);\n#endif\n#endif\n#ifdef RENDER_LINE_DASH\nfloat scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/floorwidth,(-normal.y*height+dash.x+0.5)/u_texsize.y);\n#endif\nv_width2=vec2(outset,inset);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),linePattern:Mi("uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;vec2 pattern_size=vec2(display_size.x/u_tile_units_to_pixels,display_size.y);float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x=mod(v_linesofar/pattern_size.x*aspect,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));vec4 color=texture2D(u_image,pos);\n#ifdef LIGHTING_3D_MODE\ncolor=apply_lighting(color);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_linesofar;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),raster:Mi("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(\ndot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply(out_color,v_fog_pos));\n#endif\ngl_FragColor=vec4(out_color*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {float w=1.0+dot(a_texture_pos,u_perspective_transform);gl_Position=u_matrix*vec4(a_pos*w,0,w);v_pos0=a_texture_pos/8192.0;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;\n#ifdef FOG\nv_fog_pos=fog_position(a_pos);\n#endif\n}"),symbolIcon:Mi("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_projected_pos;attribute float a_fade_opacity;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform vec3 u_up_vector;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nvarying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjected_point;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetProjected_point=u_matrix*vec4(a_globe_anchor+displacement,1);\n#else\noffsetProjected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);\n#endif\nvec2 a=projected_point.xy/projected_point.w;vec2 b=offsetProjected_point.xy/offsetProjected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#endif\nfloat projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nv_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change))*projection_transition_fade;}"),symbolSDF:Mi("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;u
1niform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_projected_pos;attribute float a_fade_opacity;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nvarying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);\n#else\noffsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);\n#endif\nvec2 a=projected_point.xy/projected_point.w;vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#endif\nfloat gamma_scale=gl_Position.w;float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nvec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade);}"),symbolTextAndIcon:Mi("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;
1gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_projected_pos;attribute float a_fade_opacity;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nvarying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offset_projected_point=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projected_point.xy/projected_point.w;vec2 b=offset_projected_point.xy/offset_projected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*font_scale);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#endif\nfloat gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nv_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade,is_s
1df);}"),terrainRaster:Mi("uniform sampler2D u_image0;varying vec2 v_pos0;\n#ifdef FOG\nvarying float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nvarying vec4 v_pos_light_view_0;varying vec4 v_pos_light_view_1;varying float v_depth;\n#endif\nvoid main() {vec4 color=texture2D(u_image0,v_pos0);\n#ifdef RENDER_SHADOWS\ncolor.xyz=shadowed_color(color.xyz,v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#endif\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#else\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\n#endif\n#endif\ngl_FragColor=color;\n#ifdef TERRAIN_WIREFRAME\ngl_FragColor=vec4(1.0,0.0,0.0,0.8);\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform float u_skirt_height;attribute vec2 a_pos;varying vec2 v_pos0;\n#ifdef FOG\nvarying float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;varying vec4 v_pos_light_view_0;varying vec4 v_pos_light_view_1;varying float v_depth;\n#endif\nconst float wireframeOffset=0.00015;void main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;\n#ifdef TERRAIN_WIREFRAME\nelevation+=wireframeOffset;\n#endif\nv_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\nv_fog_pos=fog_position(decodedPos);\n#else\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);v_depth=gl_Position.w;\n#endif\n}"),terrainDepth:Mi("#ifdef GL_ES\nprecision highp float;\n#endif\nvarying float v_depth;void main() {gl_FragColor=pack_depth(v_depth);}","uniform mat4 u_matrix;attribute vec2 a_pos;varying float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}"),skybox:Mi("\nvarying lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(\ncos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(e
1nd-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=textureCube(u_cubemap,uv).rgb;\n#ifdef FOG\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\n#endif\nsky_color.rgb=dither(sky_color.rgb,gl_FragCoord.xy+u_temporal_offset);sky_color+=0.1*sun_disk(v_uv,u_sun_direction);gl_FragColor=vec4(sky_color*u_opacity,u_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}",vi),skyboxGradient:Mi("varying highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture2D(u_color_ramp,vec2(progress,0.5));\n#ifdef FOG\ncolor.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;\n#endif\ncolor*=u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}",vi),skyboxCapture:M
vendor: 3,852 bytes, line 1
1i("\nvarying highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;\n#ifdef GL_ES\nprecision highp float;\n#endif\n#define BETA_R                  vec3(5.5e-6,13.0e-6,22.4e-6)\n#define BETA_M                  vec3(21e-6,21e-6,21e-6)\n#define MIE_G                   0.76\n#define DENSITY_HEIGHT_SCALE_R  8000.0\n#define DENSITY_HEIGHT_SCALE_M  1200.0\n#define PLANET_RADIUS           6360e3\n#define ATMOSPHERE_RADIUS       6420e3\n#define SAMPLE_STEPS            10\n#define DENSITY_STEPS           4\nfloat ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;gl_FragColor=vec4(color,1.0);}","attribute highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;varying highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:
1Mi("uniform sampler2D u_image0;varying vec2 v_pos0;\n#ifndef FOG\nuniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport;\n#endif\nvoid main() {vec4 color;\n#ifdef CUSTOM_ANTIALIASING\nvec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);vec3 dir=normalize(ray_dir);vec3 closest_point=dot(u_globe_pos,dir)*dir;float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture2D(u_image0,v_pos0);color=vec4(raster.rgb*antialias,raster.a*antialias);\n#else\ncolor=texture2D(u_image0,v_pos0);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color;\n#ifdef TERRAIN_WIREFRAME\ngl_FragColor=vec4(1.0,0.0,0.0,0.8);\n#endif\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height;\n#ifdef GLOBE_POLES\nattribute vec3 a_globe_pos;attribute vec2 a_uv;\n#else\nattribute vec2 a_pos;\n#endif\nvarying vec2 v_pos0;const float wireframeOffset=1e3;float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(QUARTER_PI+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}void main() {\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;vec2 uv=a_uv;\n#else\nfloat tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);\n#endif\nv_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;\n#ifdef GLOBE_POLES\nvec3 up_vector=globe_derived_up_vector;\n#else\nvec3 up_vector=elevationVector(tile_pos);\n#endif\nfloat height=elevation(tile_pos);\n#ifdef TERRAIN_WIREFRAME\nheight+=wireframeOffset;\n#endif\nglobe_pos+=up_vector*height;\n#ifndef GLOBE_POLES\nglobe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;\n#endif\n#ifdef GLOBE_POLES\nvec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);\n#else\nvec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);\n#endif\ngl_Position=u_proj_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n}"),globeAtmosphere:Mi("uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec3 u_start_color;uniform vec4 u_color;uniform vec4 u_space_color;uniform vec4 u_high_color;uniform float u_star_intensity;uniform float u_star_size;uniform float u_star_density;uniform float u_horizon_angle;uniform mat4 u_rotation_matrix;varying highp vec3 v_ray_dir;varying highp vec3 v_horizon_dir;
1highp float random(highp vec3 p) {p=fract(p*vec3(23.2342,97.1231,91.2342));p+=dot(p.zxy,p.yxz+123.1234);return fract(p.x*p.y);}float stars(vec3 p,float scale,vec2 offset) {vec2 uv_scale=(u_viewport/u_star_size)*scale;vec3 position=vec3(p.xy*uv_scale+offset*u_viewport,p.z);vec3 q=fract(position)-0.5;vec3 id=floor(position);float random_visibility=step(random(id),u_star_density);float circle=smoothstep(0.5+u_star_intensity,0.5,length(q));return circle*random_visibility;}void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;\n#ifdef PROJECTION_GLOBE_VIEW\nglobe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {discard;return;}\n#endif\nhighp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?\n0.0 : max(acos(dot(dir,horizon_dir)),0.0);float horizon_angle;\n#ifdef PROJECTION_GLOBE_VIEW\nhighp vec3 closest_point=globe_pos_dot_dir*dir;float closest_point_to_center=length(closest_point-u_globe_pos);float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ?\nPI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);\n#else\nhorizon_angle=horizon_angle_mercator;\n#endif\nhorizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;vec3 color_stop_2=u_space_color.rgb;vec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c =mix(color_stop_2,c2,t);float a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);vec2 uv=gl_FragCoord.xy/u_viewport-0.5;float aspect_ratio=u_viewport.x/u_viewport.y;vec4 uv_dir=vec4(normalize(vec3(uv.x*aspect_ratio,uv.y,1.0)),1.0);uv_dir=u_rotation_matrix*uv_dir;vec3 n=abs(uv_dir.xyz);vec2 uv_remap=(n.x > n.y && n.x > n.z) ? uv_dir.yz/uv_dir.x:\n(n.y > n.x && n.y > n.z) ? uv_dir.zx/uv_dir.y:\nuv_dir.xy/uv_dir.z;uv_remap.x/=aspect_ratio;vec3 D=vec3(uv_remap,1.0);highp float star_field=0.0;if (u_star_intensity > 0.0) {star_field+=stars(D,1.2,vec2(0.0,0.0));star_field+=stars(D,1.0,vec2(1.0,0.0));star_field+=stars(D,0.8,vec2(0.0,1.0));star_field+=stars(D,0.6,vec2(1.0,1.0));star_field*=(1.0-pow(t,0.25+(1.0-u_high_color.a)*0.75));c+=star_field*alpha_2;}c=dither(c,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=vec4(c,a);}","attribute vec3 a_pos;attribute vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;varying highp vec3 v_ray_dir;varying highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(\nmix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}")};function Ei(e,t){var i,r=l(e.replace(/\s*\/\/[^\n]*\n/g,"\n").split("\n"));try{for(r.s();!(i=r.n()).done;){var n=i.value;if("#"===(n=n.trim())[0]&&n.includes("if")&&!n.includes("endif")){var a,o=l((n=n.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim()).split(" "));try{for(o.s();!(a=o.n()).done;){var s=a.value;t.includes(s)||t.push(s)}}catch(u){o.e(u)}finally{o.f()}}}}catch(u){r.e(u)}finally{r.f()}}function Mi(e,t){var i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=t.match(/attribute (highp |mediump |lowp )?([\w]+) ([\w]+)/g),n={},a=[].concat(xi);return Ei(e,a),Ei(t,a),{fragmentSource:e=e.replace(i,function(e,t,i,r,a){return n[a]=!0,"define"===t?"\n#ifndef HAS_UNIFORM_u_".concat(a,"\nvarying ").concat(i," ").concat(r," ").concat(a,";\n#else\nuniform ").concat(i," ").concat(r," u_").concat(a,";\n#endif\n"):"\n#ifdef HAS_UNIFORM_u_".concat(a,"\n    ").concat(i," ").concat(r," ").concat(a," = u_").concat(a,";\n#endif\n")}),vertexSource:t=t.replace(i,function(e,t,i,r,a){var o="float"===r?"vec2":"vec4",s=a.match(/color/)?"color":o;return n[a]?"define"===t?"\n#ifndef HAS_UNIFORM_u_".concat(a,"\nuniform lowp float u_").concat(a,"_t;
1\nattribute ").concat(i," ").concat(o," a_").concat(a,";\nvarying ").concat(i," ").concat(r," ").concat(a,";\n#else\nuniform ").concat(i," ").concat(r," u_").concat(a,";\n#endif\n"):"vec4"===s?"\n#ifndef HAS_UNIFORM_u_".concat(a,"\n    ").concat(a," = a_").concat(a,";\n#else\n    ").concat(i," ").concat(r," ").concat(a," = u_").concat(a,";\n#endif\n"):"\n#ifndef HAS_UNIFORM_u_".concat(a,"\n    ").concat(a," = unpack_mix_").concat(s,"(a_").concat(a,", u_").concat(a,"_t);\n#else\n    ").concat(i," ").concat(r," ").concat(a," = u_").concat(a,";\n#endif\n"):"define"===t?"\n#ifndef HAS_UNIFORM_u_".concat(a,"\nuniform lowp float u_").concat(a,"_t;\nattribute ").concat(i," ").concat(o," a_").concat(a,";\n#else\nuniform ").concat(i," ").concat(r," u_").concat(a,";\n#endif\n"):"vec4"===s?"\n#ifndef HAS_UNIFORM_u_".concat(a,"\n    ").concat(i," ").concat(r," ").concat(a," = a_").concat(a,";\n#else\n    ").concat(i," ").concat(r," ").concat(a," = u_").concat(a,";\n#endif\n"):"\n#ifndef HAS_UNIFORM_u_".concat(a,"\n    ").concat(i," ").concat(r," ").concat(a," = unpack_mix_").concat(s,"(a_").concat(a,", u_").concat(a,"_t);\n#else\n    ").concat(i," ").concat(r," ").concat(a," = u_").concat(a,";\n#endif\n")}),staticAttributes:r,usedDefines:a}}var Si=function(){function e(){h(this,e),this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}return d(e,[{key:"bind",value:function(e,t,i,r,n,a,o){this.context=e;for(var s=this.boundPaintVertexBuffers.length!==r.length,u=0;!s&&u<r.length;u++)this.boundPaintVertexBuffers[u]!==r[u]&&(s=!0);for(var c=this.boundDynamicVertexBuffers.length!==o.length,h=0;!c&&h<o.length;h++)this.boundDynamicVertexBuffers[h]!==o[h]&&(c=!0);if(!e.extVertexArrayObject||!this.vao||this.boundProgram!==t||this.boundLayoutVertexBuffer!==i||s||c||this.boundIndexBuffer!==n||this.boundVertexOffset!==a)this.freshBind(t,i,r,n,a,o);else{e.bindVertexArrayOES.set(this.vao);var f,d=l(o);try{for(d.s();!(f=d.n()).done;){var p=f.value;p&&p.bind()}}catch(m){d.e(m)}finally{d.f()}n&&n.dynamicDraw&&n.bind()}}},{key:"freshBind",value:function(e,t,i,r,n,a){var o,s=e.numAttributes,u=this.context,c=u.gl;if(u.extVertexArrayObject)this.vao&&this.destroy(),this.vao=u.extVertexArrayObject.createVertexArrayOES(),u.bindVertexArrayOES.set(this.vao),o=0,this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=r,this.boundVertexOffset=n,this.boundDynamicVertexBuffers=a;else{o=u.currentNumAttributes||0;for(var h=s;h<o;h++)c.disableVertexAttribArray(h)}t.enableAttributes(c,e),t.bind(),t.setVertexAttribPointers(c,e,n);var f,d=l(i);try{for(d.s();!(f=d.n()).done;){var p=f.value;p.enableAttributes(c,e),p.bind(),p.setVertexAttribPointers(c,e,n)}}catch(_){d.e(_)}finally{d.f()}var m,v=l(a);try{for(v.s();!(m=v.n()).done;){var y=m.value;y&&(y.enableAttributes(c,e),y.bind(),y.setVertexAttribPointers(c,e,n))}}catch(_){v.e(_)}finally{v.f()}r&&r.bind(),u.currentNumAttributes=s}},{key:"destroy",value:function(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)}}]),e}();function Ii(e,t){var r=Math.pow(2,t.canonical.z),n=t.canonical.y;return[new i.MercatorCoordinate(0,n/r).toLngLat().lat,new i.MercatorCoordinate(0,(n+1)/r).toLngLat().lat]}function Ci(e,t,r,n,a,o,s){var l=e.context,u=l.gl,c=r.fbo;if(c){e.prepareDrawTile();var h=e.useProgram("hillshade");l.activeTexture.set(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,c.colorAttachment.get());var f=function(e,t,i,r){var n=i.paint.get("hillshade-shadow-color"),a=i.paint.get("hillshade-highlight-color"),o=i.paint.get("hillshade-accent-color"),s=i.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===i.paint.get("hillshade-illumination-anchor")&&(s-=e.transform.angle);var l=!e.options.moving;return{u_matrix:r||e.transform.calculateProjMatrix(t.tileID.toUnwrapped(),l),u_image:0,u_latrange:Ii(0,t.tileID),u_light:[i.paint.get("hillshade-exaggeration"),s],u_shadow:n,u_highlight:a,u_accent:o}}(e,r,n,e.terrain?t.projMatrix:null);e.prepareDrawProgram(l,h,t.toUnwrapped());var d=e.getTileBoundsBuffers(r),p=d.tileBoundsBuffer,m=d.tileBoundsIndexBuffer,v=d.tileBoundsSegments;h.draw(l,u.TRIANGLES,a,o,s,i.CullFaceMode.disabled,f,n.id,p,m,v)}}function Ai(e,t,r){if(t.needsDEMTextureUpload){var n=e.context,a=n.gl;n.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||e.getTileTexture(r.stride);var o=r.getPixels();t.demTexture?t.demTexture.update(o,{premultiply:!1}):t.demTexture=new i.Texture(n,o,a.RGBA,{premultiply:!1}),t.needsDEMTextureUpload=!1}}function zi(e,t,r,n,a,o){var s=e.context,l=s.gl;if(t.dem){var u=t.dem;if(s.activeTexture.set(l.TEXTURE1),Ai(e,t,u),t.demTexture){t.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);var c=u.dim;s.activeTexture.set(l.TEXTURE0);var h=t.fbo;if(!h){var f=new i.Texture(s,{width:c,height:c,data:null},l.RGBA);f.bind(l.LINEAR,l.CLAMP_TO_EDGE),(h=t.fbo=s.createFramebuffer(c,c,!0)).colorAttachment.set(f.texture)}s.bindFramebuffer.set(h.framebuffer),s.viewport.set([0,0,c,c]);var d=e.getMercatorTileBoundsBuffers(),p=d.tileBoundsBuffer,m=d.tileBoundsIndexBuffer,v=d.tileBoundsSegments;e.useProgram("hillshadePrepare").draw(s,l.TRIANGLES,n,a,o,i.CullFaceMode.disabled,function(e,t){var r=t.stride,n=i.create();return i.ortho(n,0,i.EXTENT,-i.EXTENT,0,0,1),i.translate(n,n,[0,-i.EXTENT,0]),{u_matrix:n,u_image:1,u_dimension:[r,r],u_zoom:e.overscaledZ,u_unpack:t.unpackVector}}
1(t.tileID,u),r.id,p,m,v),t.needsHillshadePrepare=!1}}}var Pi=function(e){return{u_matrix:new i.UniformMatrix4f(e),u_image0:new i.Uniform1i(e),u_skirt_height:new i.Uniform1f(e)}},Di=function(e,t){return{u_matrix:e,u_image0:0,u_skirt_height:t}},Li=function(e,t,i,r,n,a,o,s,l,u,c,h,f,d,p){return{u_proj_matrix:Float32Array.from(e),u_globe_matrix:t,u_normalize_matrix:Float32Array.from(r),u_merc_matrix:i,u_zoom_transition:n,u_merc_center:a,u_image0:0,u_frustum_tl:o,u_frustum_tr:s,u_frustum_br:l,u_frustum_bl:u,u_globe_pos:c,u_globe_radius:h,u_viewport:f,u_grid_matrix:p?Float32Array.from(p):new Float32Array(9),u_skirt_height:d}};function Ri(e,t){return null!=e&&null!=t&&!(!e.hasData()||!t.hasData())&&null!=e.demTexture&&null!=t.demTexture&&e.tileID.key!==t.tileID.key}var Bi=new(function(){function e(){h(this,e),this.operations={}}return d(e,[{key:"newMorphing",value:function(e,t,i,r,n){if(e in this.operations){var a=this.operations[e];a.to.tileID.key!==i.tileID.key&&(a.queued=i)}else this.operations[e]={startTime:r,phase:0,duration:n,from:t,to:i,queued:null}}},{key:"getMorphValuesForProxy",value:function(e){if(!(e in this.operations))return null;var t=this.operations[e];return{from:t.from,to:t.to,phase:t.phase}}},{key:"update",value:function(e){for(var t in this.operations){var i=this.operations[t];for(i.phase=(e-i.startTime)/i.duration;i.phase>=1||!this._validOp(i);)if(!this._nextOp(i,e)){delete this.operations[t];break}}}},{key:"_nextOp",value:function(e,t){return!!e.queued&&(e.from=e.to,e.to=e.queued,e.queued=null,e.phase=0,e.startTime=t,!0)}},{key:"_validOp",value:function(e){return e.from.hasData()&&e.to.hasData()}}]),e}()),Oi={0:null,1:"TERRAIN_VERTEX_MORPHING",2:"TERRAIN_WIREFRAME"};function Fi(e){return 6*Math.pow(1.5,22-e)}function Ui(e,t){var i=1<<e.z;return!t&&(0===e.x||e.x===i-1)||0===e.y||e.y===i-1}var Vi=function(e){return{u_matrix:e}};function ji(e,t,r,n,a){if(a>0){var o=i.exported.now(),s=(o-e.timeAdded)/a,l=t?(o-t.timeAdded)/a:-1,u=r.getSource(),c=n.coveringZoomLevel({tileSize:u.tileSize,roundZoom:u.roundZoom}),h=!t||Math.abs(t.tileID.overscaledZ-c)>Math.abs(e.tileID.overscaledZ-c),f=h&&e.refreshedUponExpiration?1:i.clamp(h?s:1-l,0,1);return e.refreshedUponExpiration&&s>=1&&(e.refreshedUponExpiration=!1),t?{opacity:1,mix:1-f}:{opacity:f,mix:0}}return{opacity:1,mix:0}}var Ni=function(e){p(i,e);var t=m(i);function i(e){var r;h(this,i);var n={type:"raster-dem",maxzoom:e.transform.maxZoom},a=new q(tt(),null),o=We("mock-dem",n,a,e.style);return r=t.call(this,"mock-dem",o,!1),o.setEventedParent(y(r)),r._sourceLoaded=!0,r}return d(i,[{key:"_loadTile",value:function(e,t){e.state="loaded",t(null)}}]),i}(i.SourceCache),Gi=function(e){p(n,e);var t=m(n);function n(e){var i;h(this,n);var r=We("proxy",{type:"geojson",maxzoom:e.transform.maxZoom},new q(tt(),null),e.style);return i=t.call(this,"proxy",r,!1),r.setEventedParent(y(i)),i.map=i.getSource().map=e,i.used=i._sourceLoaded=!0,i.renderCache=[],i.renderCachePool=[],i.proxyCachedFBO={},i}return d(n,[{key:"update",value:function(e,t,r){var n=this;if(!e.freezeTileCoverage){this.transform=e;var a=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce(function(t,r){if(t[r.key]="",!n._tiles[r.key]){var a=new i.Tile(r,n._source.tileSize*r.overscaleFactor(),e.tileZoom);a.state="loaded",n._tiles[r.key]=a}return t},{});for(var o in this._tiles)o in a||(this.freeFBO(o),this._tiles[o].unloadVectorData(),delete this._tiles[o])}}},{key:"freeFBO",value:function(e){var t=this.proxyCachedFBO[e];if(void 0!==t){var i,n=Object.values(t);(i=this.renderCachePool).push.apply(i,r(n)),delete this.proxyCachedFBO[e]}}},{key:"deallocRenderCache",value:function(){this.renderCache.forEach(function(e){return e.fb.destroy()}),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}]),n}(i.SourceCache),Zi=function(e){p(i,e);var t=m(i);function i(e,r,n){var a;return h(this,i),(a=t.call(this,e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)).proxyTileKey=r,a.projMatrix=n,a}return d(i)}(i.OverscaledTileID),qi=function(e){p(n,e);var t=m(n);function n(e,r){var o;h(this,n),(o=t.call(this)).painter=e,o.terrainTileForTile={},o.prevTerrainTileForTile={};var s=a(function(e){var t=new i.StructArrayLayout2i4,r=new i.StructArrayLayout3ui6,n=131;
1t.reserve(17161),r.reserve(33800);for(var a=i.EXTENT/128,o=i.EXTENT+a/2,s=o+a,l=-a;l<s;l+=a)for(var u=-a;u<s;u+=a){var c=u<0||u>o||l<0||l>o?24575:0,h=i.clamp(Math.round(u),0,i.EXTENT),f=i.clamp(Math.round(l),0,i.EXTENT);t.emplaceBack(h+c,f)}for(var d=function(e,t){var i=t*n+e;r.emplaceBack(i+1,i,i+n),r.emplaceBack(i+n,i+n+1,i+1)},p=1;p<129;p++)for(var m=1;m<129;m++)d(m,p);return[0,129].forEach(function(e){for(var t=0;t<130;t++)d(t,e),d(e,t)}),[t,r,32768]}(),3),l=s[0],u=s[1],c=s[2],f=e.context;o.gridBuffer=f.createVertexBuffer(l,i.posAttributes.members),o.gridIndexBuffer=f.createIndexBuffer(u),o.gridSegments=i.SegmentVector.simpleSegment(0,0,l.length,u.length),o.gridNoSkirtSegments=i.SegmentVector.simpleSegment(0,0,l.length,c),o.proxyCoords=[],o.proxiedCoords={},o._visibleDemTiles=[],o._drapedRenderBatches=[],o._sourceTilesOverlap={},o.proxySourceCache=new Gi(r.map),o.orthoMatrix=i.create(),i.ortho(o.orthoMatrix,"globe"===o.painter.transform.projection.name?.015:0,i.EXTENT,0,i.EXTENT,0,1);var d=f.gl;return o._overlapStencilMode=new i.StencilMode({func:d.GEQUAL,mask:255},0,255,d.KEEP,d.KEEP,d.REPLACE),o._previousZoom=e.transform.zoom,o.pool=[],o._findCoveringTileCache={},o._tilesDirty={},o.style=r,o._useVertexMorphing=!0,o._exaggeration=1,o._mockSourceCache=new Ni(r.map),o}return d(n,[{key:"style",set:function(e){var t=this;e.on("data",this._onStyleDataEvent.bind(this)),e.on("neworder",this._checkRenderCacheEfficiency.bind(this)),this._style=e,this._checkRenderCacheEfficiency(),this._style.map.on("moveend",function(){t._clearLineLayersFromRenderCache()})}},{key:"update",value:function(e,t,r){var n=this;if(e&&e.terrain){this._style!==e&&(this.style=e),this.enabled=!0;var a=e.terrain.properties;this.sourceCache=0===e.terrain.drapeRenderMode?this._mockSourceCache:e._getSourceCache(a.get("source")),this._exaggeration=a.get("exaggeration");var o=function(){n.sourceCache.used&&i.warnOnce("Raster DEM source '".concat(n.sourceCache.id,"' is used both for terrain and as layer source.\nThis leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source."));var e=n.getScaledDemTileSize();n.sourceCache.update(t,e,!0),n.resetTileLookupCache(n.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,o(),this._initializing=!0),o(),t.updateElevation(!0,r),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(t),this._emptyDEMTextureDirty=!0}else this._disable()}},{key:"resetTileLookupCache",value:function(e){this._findCoveringTileCache[e]={}}},{key:"getScaledDemTileSize",value:function(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}},{key:"_checkRenderCacheEfficiency",value:function(){var e=this.renderCacheEfficiency(this._style);this._style.map._optimizeForTerrain||100!==e.efficiency&&i.warnOnce("Terrain render cache efficiency is not optimal (".concat(e.efficiency,"%) and performance\n                may be affected negatively, consider placing all background, fill and line layers before layer\n                with id '").concat(e.firstUndrapedLayer,"' or create a map using optimizeForTerrain: true option."))}},{key:"_onStyleDataEvent",value:function(e){e.coord&&"source"===e.dataType?this._clearRenderCacheForTile(e.sourceCacheId,e.coord):"style"===e.dataType&&(this._invalidateRenderCache=!0)}},{key:"_disable",value:function(){if(this.enabled&&(this.enabled=!1,this._sharedDepthStencil=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(var e in this._style._sourceCaches)this._style._sourceCaches[e].usedForTerrain=!1}},{key:"destroy",value:function(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this._emptyDepthBufferTexture&&this._emptyDepthBufferTexture.destroy(),this.pool.forEach(function(e){return e.fb.destroy()}),this.pool=[],this._depthFBO&&(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0)}},{key:"_source",value:function(){return this.enabled?this.sourceCache:null}},{key:"isUsingMockSource",value:function(){return this.sourceCache===this._mockSourceCache}},{key:"exaggeration",value:function(){return this._exaggeration}},{key:"visibleDemTiles",get:function(){return this._visibleDemTiles}},{key:"drapeBufferSize",get:function(){var e=2*this.proxySourceCache.getSource().tileSize;return[e,e]}},{key:"useVertexMorphing",set:function(e){this._useVertexMorphing=e}},{key:"updateTileBinding",value:function(e){var t=this;if(this.enabled){this.prevTerrainTileForTile=this.terrainTileForTile;var r=this.proxySourceCache,n=this.painter.transform;this._initializing&&(this._initializing=0===n._centerAltitude&&-1===this.getAtPointOrZero(i.MercatorCoordinate.fromLngLat(n.center),-1),this._emptyDEMTextureDirty=!this._initializing);var a=this.proxyCoords=r.getIds().map(function(e){var t=r.getTileByID(e).tileID;return t.projMatrix=n.calculateProjMatrix(t.toUnwrapped()),t});(function(e,t){var r=t.transform.pointCoordinate(t.transform.getCameraPoint()),n=new i.pointGeometry(r.x,r.y);
1e.sort(function(e,t){if(t.overscaledZ-e.overscaledZ)return t.overscaledZ-e.overscaledZ;var r=new i.pointGeometry(e.canonical.x+(1<<e.canonical.z)*e.wrap,e.canonical.y),a=new i.pointGeometry(t.canonical.x+(1<<t.canonical.z)*t.wrap,t.canonical.y),o=n.mult(1<<e.canonical.z);return o.x-=.5,o.y-=.5,o.distSqr(r)-o.distSqr(a)})})(a,this.painter),this._previousZoom=n.zoom;var o=this.proxyToSource||{};this.proxyToSource={},a.forEach(function(e){t.proxyToSource[e.key]={}}),this.terrainTileForTile={};var s=this._style._sourceCaches;for(var u in s){var c=s[u];if(c.used&&(c!==this.sourceCache&&this.resetTileLookupCache(c.id),this._setupProxiedCoordsForOrtho(c,e[u],o),!c.usedForTerrain)){var h=e[u];c.getSource().reparseOverscaled&&this._assignTerrainTiles(h)}}this.proxiedCoords[r.id]=a.map(function(e){return new Zi(e,e.key,t.orthoMatrix)}),this._assignTerrainTiles(a),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(o),this.renderingToTexture=!1,this._updateTimestamp=i.exported.now();var f={};this._visibleDemTiles=[];var d,p=l(this.proxyCoords);try{for(p.s();!(d=p.n()).done;){var m=d.value,v=this.terrainTileForTile[m.key];if(v){var y=v.tileID.key;y in f||(this._visibleDemTiles.push(v),f[y]=y)}}}catch(_){p.e(_)}finally{p.f()}}}},{key:"_assignTerrainTiles",value:function(e){var t=this;this._initializing||e.forEach(function(e){if(!t.terrainTileForTile[e.key]){var i=t._findTileCoveringTileID(e,t.sourceCache);i&&(t.terrainTileForTile[e.key]=i)}})}},{key:"_prepareDEMTextures",value:function(){var e=this.painter.context,t=e.gl;for(var i in this.terrainTileForTile){var r=this.terrainTileForTile[i],n=r.dem;!n||r.demTexture&&!r.needsDEMTextureUpload||(e.activeTexture.set(t.TEXTURE1),Ai(this.painter,r,n))}}},{key:"_prepareDemTileUniforms",value:function(e,t,i,r){if(!t||null==t.demTexture)return!1;var n=e.tileID.canonical,a=Math.pow(2,t.tileID.canonical.z-n.z),o=r||"";return i["u_dem_tl".concat(o)]=[n.x*a%1,n.y*a%1],i["u_dem_scale".concat(o)]=a,!0}},{key:"emptyDEMTexture",get:function(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}},{key:"emptyDepthBufferTexture",get:function(){var e=this.painter.context,t=e.gl;if(!this._emptyDepthBufferTexture){var r=new i.RGBAImage({width:1,height:1},Uint8Array.of(255,255,255,255));this._emptyDepthBufferTexture=new i.Texture(e,r,t.RGBA,{premultiply:!1})}return this._emptyDepthBufferTexture}},{key:"_getLoadedAreaMinimum",value:function(){var e=0,t=this._visibleDemTiles.reduce(function(t,i){if(!i.dem)return t;var r=i.dem.tree.minimums[0];return r>0&&e++,t+r},0);return e?t/e:0}},{key:"_updateEmptyDEMTexture",value:function(){var e=this.painter.context,t=e.gl;e.activeTexture.set(t.TEXTURE2);var r=this._getLoadedAreaMinimum(),n=new i.RGBAImage({width:1,height:1},new Uint8Array(i.DEMData.pack(r,this.sourceCache.getSource().encoding)));this._emptyDEMTextureDirty=!1;var a=this._emptyDEMTexture;return a?a.update(n,{premultiply:!1}):a=this._emptyDEMTexture=new i.Texture(e,n,t.RGBA,{premultiply:!1}),a}},{key:"setupElevationDraw",value:function(e,t,r){var n,a=this.painter.context,o=a.gl,s=(n=this.sourceCache.getSource().encoding,{u_dem:2,u_dem_prev:4,u_dem_unpack:i.DEMData.getUnpackVector(n),u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_exaggeration:0});s.u_dem_size=this.sourceCache.getSource().tileSize,s.u_exaggeration=this.exaggeration();var l=null,u=null,c=1;if(r&&r.morphing&&this._useVertexMorphing){var h=r.morphing.srcDemTile,f=r.morphing.dstDemTile;c=r.morphing.phase,h&&f&&(this._prepareDemTileUniforms(e,h,s,"_prev")&&(u=h),this._prepareDemTileUniforms(e,f,s)&&(l=f))}if(u&&l?(a.activeTexture.set(o.TEXTURE2),l.demTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE,o.NEAREST),a.activeTexture.set(o.TEXTURE4),u.demTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE,o.NEAREST),s.u_dem_lerp=c):(l=this.terrainTileForTile[e.tileID.key],a.activeTexture.set(o.TEXTURE2),(this._prepareDemTileUniforms(e,l,s)?l.demTexture:this.emptyDEMTexture).bind(o.NEAREST,o.CLAMP_TO_EDGE)),a.activeTexture.set(o.TEXTURE3),r&&r.useDepthForOcclusion?(this._depthTexture&&this._depthTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE),this._depthFBO&&(s.u_depth_size_inv=[1/this._depthFBO.width,1/this._depthFBO.height])):(this.empty
1DepthBufferTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE),s.u_depth_size_inv=[1,1]),r&&r.useMeterToDem&&l){var d=(1<<l.tileID.canonical.z)*i.mercatorZfromAltitude(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;s.u_meter_to_dem=d}if(r&&r.labelPlaneMatrixInv&&(s.u_label_plane_matrix_inv=r.labelPlaneMatrixInv),t.setTerrainUniformValues(a,s),"globe"===this.painter.transform.projection.name){var p=this.globeUniformValues(this.painter.transform,e.tileID.canonical,r&&r.useDenormalizedUpVectorScale);t.setGlobeUniformValues(a,p)}}},{key:"globeUniformValues",value:function(e,t,r){var n=e.projection;return{u_tile_tl_up:n.upVector(t,0,0),u_tile_tr_up:n.upVector(t,i.EXTENT,0),u_tile_br_up:n.upVector(t,i.EXTENT,i.EXTENT),u_tile_bl_up:n.upVector(t,0,i.EXTENT),u_tile_up_scale:r?i.globeMetersToEcef(1):n.upVectorScale(t,e.center.lat,e.worldSize).metersToTile}}},{key:"renderToBackBuffer",value:function(e){var t=this.painter,r=this.painter.context;0!==e.length&&(r.bindFramebuffer.set(null),r.viewport.set([0,0,t.width,t.height]),t.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(e,t,r,n,o){if("globe"===e.transform.projection.name)!function(e,t,r,n,o){var s,u,c=e.context,h=c.gl,f=e.options.showTerrainWireframe?2:0,d=e.transform,p=i.globeUseCustomAntiAliasing(e,c,d),m=function(t,i){if(u!==t){var r=[Oi[t],"PROJECTION_GLOBE_VIEW"];p&&r.push("CUSTOM_ANTIALIASING"),i&&r.push(Oi[f]),s=e.useProgram("globeRaster",null,r),u=t}},v=e.colorModeForRenderPass(),y=new i.DepthMode(h.LEQUAL,i.DepthMode.ReadWrite,e.depthRangeFor3D);Bi.update(o);var _=i.calculateGlobeMercatorMatrix(d),g=[i.mercatorXfromLng(d.center.lng),i.mercatorYfromLat(d.center.lat)],x=f?[!1,!0]:[!1],b=e.globeSharedBuffers,w=[d.width*i.exported.devicePixelRatio,d.height*i.exported.devicePixelRatio],k=Float32Array.from(d.globeMatrix),T={useDenormalizedUpVectorScale:!0};if(x.forEach(function(f){var d=e.transform,p=Fi(d.zoom)*t.exaggeration();u=-1;var x,E=f?h.LINES:h.TRIANGLES,M=l(n);try{for(M.s();!(x=M.n()).done;){var S=x.value,I=r.getTile(S),C=i.StencilMode.disabled,A=t.prevTerrainTileForTile[S.key],z=t.terrainTileForTile[S.key];Ri(A,z)&&Bi.newMorphing(S.key,A,z,o,250),c.activeTexture.set(h.TEXTURE0),I.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE);var P=Bi.getMorphValuesForProxy(S.key),D=P?1:0;P&&i.extend$1(T,{morphing:{srcDemTile:P.from,dstDemTile:P.to,phase:i.easeCubicInOut(P.phase)}});var L=i.tileCornersToBounds(S.canonical),R=i.getLatitudinalLod(L.getCenter().lat),B=i.getGridMatrix(S.canonical,L,R,d.worldSize/d._pixelsPerMercatorPixel),O=i.globeNormalizeECEF(i.globeTileBounds(S.canonical)),F=Li(d.projMatrix,k,_,O,i.globeToMercatorTransition(d.zoom),g,d.frustumCorners.TL,d.frustumCorners.TR,d.frustumCorners.BR,d.frustumCorners.BL,d.globeCenterInViewSpace,d.globeRadius,w,p,B);if(m(D,f),t.setupElevationDraw(I,s,T),e.prepareDrawProgram(c,s,S.toUnwrapped()),b){var U=a(f?b.getWirefameBuffers(e.context,R):b.getGridBuffers(R,0!==p),3),V=U[0],j=U[1],N=U[2];s.draw(c,E,y,C,v,i.CullFaceMode.backCCW,F,"globe_raster",V,j,N)}}}catch(G){M.e(G)}finally{M.f()}}),b){var E=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];p&&E.push("CUSTOM_ANTIALIASING"),s=e.useProgram("globeRaster",null,E);var M,S=l(n);try{var I=function(){var n=M.value,o=n.canonical,l=o.x,u=o.y,f=o.z,p=0===u,m=u===(1<<f)-1,_=a(b.getPoleBuffers(f),4),x=_[0],k=_[1],E=_[2],S=_[3];if(S&&(p||m)){var I=r.getTile(n);c.activeTexture.set(h.TEXTURE0),I.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE);var C=i.globePoleMatrixForTile(f,l,d),A=i.globeNormalizeECEF(i.globeTileBounds(n.canonical)),z=function(e,t){return e.draw(c,h.TRIANGLES,y,i.StencilMode.disabled,v,i.CullFaceMode.disabled,Li(d.projMatrix,C,C,A,0,g,d.frustumCorners.TL,d.frustumCorners.TR,d.frustumCorners.BR,d.frustumCorners.BL,d.globeCenterInViewSpace,d.globeRadius,w,0),"globe_pole_raster",t,E,S)};t.setupElevationDraw(I,s,T),e.prepareDrawProgram(c,s,n.toUnwrapped()),p&&z(s,x),m&&(C=i.scale(i.create(),C,[1,-1,1]),z(s,k))}};for(S.s();!(M=S.n()).done;)I()}catch(C){S.e(C)}finally{S.f()}}}(e,t,r,n,o);else{var s,u,c=e.context,h=c.gl,f=e.options.showTerrainWireframe?2:0,d=function(t,i){if(u!==t){var r=[Oi[t]];i&&r.push(Oi[f]),s=e.useProgram("terrainRaster",null,r),u=t}},p=e.colorModeForRenderPass(),m=new i.DepthMode(h.LEQUAL,i.DepthMode.ReadWrite,e.depthRangeFor3D);Bi.update(o);var v=e.transform,y=Fi(v.zoom)*t.exaggeration();
1(f?[!1,!0]:[!1]).forEach(function(f){u=-1;var _,g=f?h.LINES:h.TRIANGLES,x=a(f?t.getWirefameBuffer():[t.gridIndexBuffer,t.gridSegments],2),b=x[0],w=x[1],k=l(n);try{for(k.s();!(_=k.n()).done;){var T=_.value,E=r.getTile(T),M=i.StencilMode.disabled,S=t.prevTerrainTileForTile[T.key],I=t.terrainTileForTile[T.key];Ri(S,I)&&Bi.newMorphing(T.key,S,I,o,250),c.activeTexture.set(h.TEXTURE0),E.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE,h.LINEAR_MIPMAP_NEAREST);var C=Bi.getMorphValuesForProxy(T.key),A=C?1:0,z=void 0;C&&(z={morphing:{srcDemTile:C.from,dstDemTile:C.to,phase:i.easeCubicInOut(C.phase)}});var P=Di(T.projMatrix,Ui(T.canonical,v.renderWorldCopies)?y/10:y);d(A,f),t.setupElevationDraw(E,s,z),e.prepareDrawProgram(c,s,T.toUnwrapped()),s.draw(c,g,m,M,p,i.CullFaceMode.backCCW,P,"terrain_raster",t.gridBuffer,b,w)}}catch(D){k.e(D)}finally{k.f()}})}}(t,this,this.proxySourceCache,e,this._updateTimestamp),this.renderingToTexture=!0,t.gpuTimingDeferredRenderEnd(),e.splice(0,e.length))}},{key:"renderBatch",value:function(e){if(0===this._drapedRenderBatches.length)return e+1;this.renderingToTexture=!0;var t,r=this.painter,n=this.painter.context,a=this.proxySourceCache,o=this.proxiedCoords[a.id],s=this._drapedRenderBatches.shift(),u=[],c=r.style.order,h=0,f=l(o);try{for(f.s();!(t=f.n()).done;){var d=t.value,p=a.getTileByID(d.proxyTileKey),m=a.proxyCachedFBO[d.key]?a.proxyCachedFBO[d.key][e]:void 0,v=void 0!==m?a.renderCache[m]:this.pool[h++],y=void 0!==m;if(p.texture=v.tex,!y||v.dirty){var _=void 0;n.bindFramebuffer.set(v.fb.framebuffer),this.renderedToTile=!1,v.dirty&&(n.clear({color:i.Color.transparent,stencil:0}),v.dirty=!1);for(var g=s.start;g<=s.end;++g){var x=r.style._layers[c[g]];if(!x.isHidden(r.transform.zoom)){var b=r.style._getLayerSourceCache(x),w=b?this.proxyToSource[d.key][b.id]:[d];if(w){var k=w;n.viewport.set([0,0,v.fb.width,v.fb.height]),_!==(b?b.id:null)&&(this._setupStencil(v,w,x,b),_=b?b.id:null),r.renderLayer(r,b,x,k)}}}this.renderedToTile?(v.dirty=!0,u.push(p.tileID)):y||--h,5===h&&(h=0,this.renderToBackBuffer(u))}else u.push(p.tileID)}}catch(T){f.e(T)}finally{f.f()}return this.renderToBackBuffer(u),this.renderingToTexture=!1,n.bindFramebuffer.set(null),n.viewport.set([0,0,r.width,r.height]),s.end+1}},{key:"postRender",value:function(){}},{key:"renderCacheEfficiency",value:function(e){var t=e.order.length;if(0===t)return{efficiency:100};for(var i,r=0,n=0,a=!1,o=0;o<t;++o){var s=e._layers[e.order[o]];this._style.isLayerDraped(s)?(a&&++r,++n):a||(a=!0,i=s.id)}return 0===n?{efficiency:100}:{efficiency:100*(1-r/n),firstUndrapedLayer:i}}},{key:"getMinElevationBelowMSL",value:function(){var e=0;return this._visibleDemTiles.filter(function(e){return e.dem}).forEach(function(t){e=Math.min(e,t.dem.tree.minimums[0])}),0===e?e:(e-30)*this._exaggeration}},{key:"raycast",value:function(e,t,i){if(!this._visibleDemTiles)return null;var r=this._visibleDemTiles.filter(function(e){return e.dem}).map(function(r){var n=r.tileID,a=1<<n.overscaledZ,o=n.canonical,s=o.x,l=o.y,u=s/a,c=(s+1)/a,h=l/a,f=(l+1)/a;return{minx:u,miny:h,maxx:c,maxy:f,t:r.dem.tree.raycastRoot(u,h,c,f,e,t,i),tile:r}});r.sort(function(e,t){return(null!==e.t?e.t:Number.MAX_VALUE)-(null!==t.t?t.t:Number.MAX_VALUE)});var n,a=l(r);try{for(a.s();!(n=a.n()).done;){var o=n.value;if(null==o.t)return null;var s=o.tile.dem.tree.raycast(o.minx,o.miny,o.maxx,o.maxy,e,t,i);if(null!=s)return s}}catch(u){a.e(u)}finally{a.f()}return null}},{key:"_createFBO",value:function(){var e=this.painter.context,t=e.gl,r=this.drapeBufferSize;e.activeTexture.set(t.TEXTURE0);var n=new i.Texture(e,{width:r[0],height:r[1],data:null},t.RGBA);n.bind(t.LINEAR,t.CLAMP_TO_EDGE);var a=e.createFramebuffer(r[0],r[1],!1);return a.colorAttachment.set(n.texture),a.depthAttachment=new Fe(e,a.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=e.createRenderbuffer(e.gl.DEPTH_STENCIL,r[0],r[1]),this._stencilRef=0,a.depthAttachment.set(this._sharedDepthStencil),e.clear({stencil:0})):a.depthAttachment.set(this._sharedDepthStencil),e.extTextureFilterAnisotropic&&!e.extTextureFilterAnisotropicForceOff&&t.texParameterf(t.TEXTURE_2D,e.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,e.extTextureFilterAnisotropicMax),{fb:a,tex:n,dirty:!1}}},{key:"_initFBOPool",value:function(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}},{key:"_shouldDisableRenderCache",value:function(){var e=this;if(this._style.light&&this._style.light.hasTransition())return!0;for(var t in this._style._sourceCaches)if(this._style._sourceCaches[t].hasTransition())return!0;return this._style.order.some(function(t){var i=e._style._layers[t],r=i.isHidden(e.painter.transform.zoom);return"custom"===i.type?!r&&i.shouldRedrape():!r&&i.hasTransition()})}},{key:"_clearLineLayersFromRenderCache",value:function(){var e,t=!1,r=l(this._style._getSources());try{for(r.s();!(e=r.n()).done;){if(e.value instanceof je){t=!0;break}}}catch(v){r.e(v)}finally{r.f()}if(t)for(var n={},a=0;a<this._style.order.length;++a){var o=this._style._layers[this._style.order[a]],s=this._style._getLayerSourceCache(o);if(s&&!n[s.id]&&!o.isHidden(this.painter.transform.zoom)&&"line"===o.type&&o.widthExpression()instanceof i.ZoomDependentExpression){n[s.id]=!0;var u,c=l(this.proxyCoords);try{for(c.s();!(u=c.n()).done;){var h=u.value,f=this.proxyToSource[h.key][s.id];if(f){var d,p=l(f);try{for(p.s();!(d=p.n()).done;){var m=d.value;this._clearRenderCacheForTile(s.id,m)}}catch(v){p.e(v)}finally{p.f()}}}}catch(v){c.e(v)}finally{c.f()}}}}},{key:"_clearRasterLayersFromRenderCache",value:function(){var e=!1;for(var t in this._style._sourceCaches)if(this._style._sourceCaches[t]._source instanceof Ne){e=!0;break}if(e)for(var i={},r=0;r<this._style.order.length;++r){var n=this._style._layers[this._style.order[r]],a=this._style._getLayerSourceCache(n);if(a&&!i[a.id]&&!n.isHidden(this.painter.transform.zoom)&&"raster"===n.type){var o,s=n.paint.get("raster-fade-duration"),u=l(this.proxyCoords);try{for(u.s();!(o=u.n()).done;){var c=o.value,h=this.proxyToSource[c.key][a.id];if(h){var f,d=l(h);try{for(d.s();!(f=d.n()).done;){var p=f.value,m=ji(a.getTile(p),a.findLoadedParent(p,0),a,this.painter.transform,s);(1!==m.opacity||0!==m.mix)&&this._clearRenderCacheForTile(a.id,p)}}catch(v){d.e(v)}finally{d.f()}}}}catch(v){u.e(v)}finally{u.f()}}}}},{key:"_setupDrapedRenderBatches",value:function(){var e=this._style.order,t=e.length;if(0!==t){for(var i,r=[],n=0,a=this._style._layers[e[n]];!this._style.isLayerDraped(a)&&a.isHidden(this.painter.transform.zoom)&&++n<t;)a=this._style._layers[e[n]];for(;n<t;++n){var o=this._style._layers[e[n]];o.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(o)?void 0===i&&(i=n):void 0!==i&&(r.push({start:i,end:n-1}),i=void 0))}void 0!==i&&r.push({start:i,end:n-1}),this._drapedRenderBatches=r}}},{key:"_setupRenderCache",value:function(e){var t=this.proxySourceCache;if(this._shouldDisableRenderCache()||this._invalidateRenderCache){if(this._invalidateRenderCache=!1,t.renderCache.length>t.renderCachePool.length){var i=Object.values(t.proxyCachedFBO);t.proxyCachedFBO={};for(var n=0;n<i.length;++n){var a,o=Object.values(i[n]);(a=t.renderCachePool).push.apply(a,r(o))}}}else{this._clearRasterLayersFromRenderCache();for(var s=this.proxyCoords,u=this._tilesDirty,c=s.length-1;c>=0;c--){var h=s[c];if(t.getTileByID(h.key),void 0!==t.proxyCachedFBO[h.key]){var f=e[h.key],d=this.proxyToSource[h.key],p=0,m=function(e){var t=d[e],i=f[e];if(!i||i.length!==t.length||t.some(function(t,r){return t!==i[r]||u[e]&&u[e].hasOwnProperty(t.key)}))return p=-1,"break";++p};for(var v in d){if("break"===m(v))break}for(var y in t.proxyCachedFBO[h.key])t.renderCache[t.proxyCachedFBO[h.key][y]].dirty=p<0||p!==Object.values(f).length}}var _=r(this._drapedRenderBatches);_.sort(function(e,t){return t.end-t.start-(e.end-e.start)});var g,x=l(_);try{for(x.s();!(g=x.n()).done;){var b,w=g.value,k=l(s);try{for(k.s();!(b=k.n()).done;){var T=b.value;if(!t.proxyCachedFBO[T.key]){var E=t.renderCachePool.pop();void 0===E&&t.renderCache.length<50&&(E=t.renderCache.length,t.renderCache.push(this._createFBO())),void 0!==E&&(t.proxyCachedFBO[T.key]={},t.proxyCachedFBO[T.key][w.start]=E,t.renderCache[E].dirty=!0)}}}catch(M){k.e(M)}finally{k.f()}}}catch(M){x.e(M)}finally{x.f()}this._tilesDirty={}}}},{key:"_setupStencil",value:function(e,t,i,r){if(r&&this._sourceTilesOverlap[r.id]){var n=this.painter.context,a=n.gl;if(t.length<=1)this._overlapStencilType=!1;else{var o;
1if(i.isTileClipped())o=t.length,this._overlapStencilMode.test={func:a.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(t[0].overscaledZ>t[t.length-1].overscaledZ))return void(this._overlapStencilType=!1);o=1,this._overlapStencilMode.test={func:a.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+o>255&&(n.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=o,this._overlapStencilMode.ref=this._stencilRef,i.isTileClipped()&&this._renderTileClippingMasks(t,this._overlapStencilMode.ref)}}else this._overlapStencilType&&(this._overlapStencilType=!1)}},{key:"clipOrMaskOverlapStencilType",value:function(){return"Clip"===this._overlapStencilType||"Mask"===this._overlapStencilType}},{key:"stencilModeForRTTOverlap",value:function(e){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[e.key]),this._overlapStencilMode):i.StencilMode.disabled}},{key:"_renderTileClippingMasks",value:function(e,t){var r=this.painter,n=this.painter.context,a=n.gl;r._tileClippingMaskIDs={},n.setColorMode(i.ColorMode.disabled),n.setDepthMode(i.DepthMode.disabled);var o,s=r.useProgram("clippingMask"),u=l(e);try{for(u.s();!(o=u.n()).done;){var c=o.value,h=r._tileClippingMaskIDs[c.key]=--t;s.draw(n,a.TRIANGLES,i.DepthMode.disabled,new i.StencilMode({func:a.ALWAYS,mask:0},h,255,a.KEEP,a.KEEP,a.REPLACE),i.ColorMode.disabled,i.CullFaceMode.disabled,Vi(c.projMatrix),"$clipping",r.tileExtentBuffer,r.quadTriangleIndexBuffer,r.tileExtentSegments)}}catch(f){u.e(f)}finally{u.f()}}},{key:"pointCoordinate",value:function(e){var t=this.painter.transform;if(e.x<0||e.x>t.width||e.y<0||e.y>t.height)return null;var r=[e.x,e.y,1,1];i.transformMat4$1(r,r,t.pixelMatrixInverse),i.scale$1(r,r,1/r[3]),r[0]/=t.worldSize,r[1]/=t.worldSize;var n=t._camera.position,a=i.mercatorZfromAltitude(1,t.center.lat),o=[n[0],n[1],n[2]/a,0],s=i.subtract([],r.slice(0,3),o);i.normalize(s,s);var l=this.raycast(o,s,this._exaggeration);return null!==l&&l?(i.scaleAndAdd(o,o,s,l),o[3]=o[2],o[2]*=a,o):null}},{key:"drawDepth",value:function(){var e=this.painter,t=e.context,r=this.proxySourceCache,n=Math.ceil(e.width),a=Math.ceil(e.height);if(!this._depthFBO||this._depthFBO.width===n&&this._depthFBO.height===a||(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0),!this._depthFBO){var o=t.gl,s=t.createFramebuffer(n,a,!0);t.activeTexture.set(o.TEXTURE0);var u=new i.Texture(t,{width:n,height:a,data:null},o.RGBA);u.bind(o.NEAREST,o.CLAMP_TO_EDGE),s.colorAttachment.set(u.texture);var c=t.createRenderbuffer(t.gl.DEPTH_COMPONENT16,n,a);s.depthAttachment.set(c),this._depthFBO=s,this._depthTexture=u}t.bindFramebuffer.set(this._depthFBO.framebuffer),t.viewport.set([0,0,n,a]),function(e,t,r,n){if("globe"!==e.transform.projection.name){var a=e.context,o=a.gl;a.clear({depth:1});var s,u=e.useProgram("terrainDepth"),c=new i.DepthMode(o.LESS,i.DepthMode.ReadWrite,e.depthRangeFor3D),h=l(n);try{for(h.s();!(s=h.n()).done;){var f=s.value,d=r.getTile(f),p=Di(f.projMatrix,0);t.setupElevationDraw(d,u),u.draw(a,o.TRIANGLES,c,i.StencilMode.disabled,i.ColorMode.unblended,i.CullFaceMode.backCCW,p,"terrain_depth",t.gridBuffer,t.gridIndexBuffer,t.gridNoSkirtSegments)}}catch(m){h.e(m)}finally{h.f()}}}(e,this,r,this.proxyCoords)}},{key:"_setupProxiedCoordsForOrtho",value:function(e,t,i){if(e.getSource()instanceof Ze)return this._setupProxiedCoordsForImageSource(e,t,i);this._findCoveringTileCache[e.id]=this._findCoveringTileCache[e.id]||{};for(var r=this.proxiedCoords[e.id]=[],n=this.proxyCoords,a=0;a<n.length;a++){var o=n[a],s=this._findTileCoveringTileID(o,e);if(s){var l=this._createProxiedId(o,s,i[o.key]&&i[o.key][e.id]);r.push(l),this.proxyToSource[o.key][e.id]=[l]}}for(var u=!1,c=0;c<t.length;c++){var h=e.getTile(t[c]);if(h&&h.hasData()){var f=this._findTileCoveringTileID(h.tileID,this.proxySourceCache);if(f&&f.tileID.canonical.z!==h.tileID.canonical.z){var d=this.proxyToSource[f.tileID.key][e.id],p=this._createProxiedId(f.tileID,h,i[f.tileID.key]&&i[f.tileID.key][e.id]);d?d.splice(d.length-1,0,p):this.proxyToSource[f.tileID.key][e.id]=[p],r.push(p),u=!0}}}this._sourceTilesOverlap[e.id]=u}},{key:"_setupProxiedCoordsForImageSource",value:function(e,t,r){if(e.getSource().loaded())for(var n=this.proxiedCoords[e.id]=[],a=this.proxyCoords,o=e.getSource(),s=new i.pointGeometry(o.tileID.x,o.tileID.y)._div(1<<o.tileID.z),l=o.coordinates.map(i.MercatorCoordinate.fromLngLat).reduce(function(e,t){return e.min.x=Math.min(e.min.x,t.x-s.x),e.min.y=Math.min(e.min.y,t.y-s.y),e.max.x=Math.max(e.max.x,t.x-s.x),e.max.y=Math.max(e.max.y,t.y-s.y),e},{min:new i.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE),max:new i.pointGeometry(-Number.MAX_VALUE,-Number.MAX_VALUE)}),u=function(e,t){var r=e.wrap+e.canonical.x/(1<<e.canonical.z),n=e.canonical.y/(1<<e.canonical.z),a=i.EXTENT/(1<<e.canonical.z),o=t.wrap+t.canonical.x/(1<<t.canonical.z),s=t.canonical.y/(1<<t.canonical.z);return r+a<o+l.min.x||r>o+l.max.x||n+a<s+l.min.y||n>s+l.max.y},c=0;c<a.length;c++)for(var h=a[c],f=0;f<t.length;f++){var d=e.getTile(t[f]);if(d&&d.hasData()&&!u(h,d.tileID)){var p=this._createProxiedId(h,d,r[h.key]&&r[h.key][e.id]),m=this.proxyToSource[h.key][e.id];m?m.push(p):this.proxyToSource[h.key][e.id]=[p],n.push(p)}}}},{key:"_createProxiedId",value:function(e,t,r){var n=this.orthoMatrix;if(r){var a=r.find(function(e){return e.key===t.tileID.key});if(a)return a}
1if(t.tileID.key!==e.key){var o,s,l,u=e.canonical.z-t.tileID.canonical.z;n=i.create();var c=t.tileID.wrap-e.wrap<<e.overscaledZ;u>0?(s=(o=i.EXTENT>>u)*((t.tileID.canonical.x<<u)-e.canonical.x+c),l=o*((t.tileID.canonical.y<<u)-e.canonical.y)):(o=i.EXTENT<<-u,s=i.EXTENT*(t.tileID.canonical.x-(e.canonical.x+c<<-u)),l=i.EXTENT*(t.tileID.canonical.y-(e.canonical.y<<-u))),i.ortho(n,0,o,0,o,0,1),i.translate(n,n,[s,l,0])}return new Zi(t.tileID,e.key,n)}},{key:"_findTileCoveringTileID",value:function(e,t){var r=t.getTile(e);if(r&&r.hasData())return r;var n=this._findCoveringTileCache[t.id],a=n[e.key];if((r=a?t.getTileByID(a):null)&&r.hasData()||null===a)return r;var o=r?r.tileID:e,s=o.overscaledZ,l=t.getSource().minzoom,u=[];if(!a){var c=t.getSource().maxzoom;if(e.canonical.z>=c){var h=e.canonical.z-c;t.getSource().reparseOverscaled?(s=Math.max(e.canonical.z+2,t.transform.tileZoom),o=new i.OverscaledTileID(s,e.wrap,c,e.canonical.x>>h,e.canonical.y>>h)):0!==h&&(s=c,o=new i.OverscaledTileID(s,e.wrap,c,e.canonical.x>>h,e.canonical.y>>h))}o.key!==e.key&&(u.push(o.key),r=t.getTile(o))}var f=function(e){u.forEach(function(t){n[t]=e}),u.length=0};for(s-=1;s>=l&&(!r||!r.hasData());s--){r&&f(r.tileID.key);var d=o.calculateScaledKey(s);if((r=t.getTileByID(d))&&r.hasData())break;var p=n[d];if(null===p)break;void 0===p?u.push(d):r=t.getTileByID(p)}return f(r?r.tileID.key:null),r&&r.hasData()?r:null}},{key:"findDEMTileFor",value:function(e){return this.enabled?this._findTileCoveringTileID(e,this.sourceCache):null}},{key:"prepareDrawTile",value:function(){this.renderedToTile=!0}},{key:"_clearRenderCacheForTile",value:function(e,t){var i=this._tilesDirty[e];i||(i=this._tilesDirty[e]={}),i[t.key]=!0}},{key:"getWirefameBuffer",value:function(){if(!this.wireframeSegments){var e=function(e){for(var t=0,r=new i.StructArrayLayout2ui4,n=131,a=1;a<129;a++){for(var o=1;o<129;o++)t=a*n+o,r.emplaceBack(t,t+1),r.emplaceBack(t,t+n),r.emplaceBack(t+1,t+n),128===a&&r.emplaceBack(t+n,t+n+1);r.emplaceBack(t+1,t+1+n)}return r}();this.wireframeIndexBuffer=this.painter.context.createIndexBuffer(e),this.wireframeSegments=i.SegmentVector.simpleSegment(0,0,this.gridBuffer.length,e.length)}return[this.wireframeIndexBuffer,this.wireframeSegments]}}]),n}(i.Elevation),Wi=function(){function t(e,r,n,a,o,s){h(this,t);var l=e.gl;this.program=l.createProgram();var u=function(e){for(var t=[],i=0;i<e.length;i++)if(null!==e[i]){var r=e[i].split(" ");t.push(r.pop())}return t}(n.staticAttributes),c=a?a.getBinderAttributes():[],f=u.concat(c),d=a?a.defines():[];d=d.concat(s.map(function(e){return"#define ".concat(e)}));var p=e.isWebGL2?"#version 300 es\n":"",m=p+d.concat(e.extStandardDerivatives&&0===p.length?"#extension GL_OES_standard_derivatives : enable\n".concat(ki):ki,ki,wi,bi.fragmentSource,pi.fragmentSource,n.fragmentSource).join("\n"),v=p+d.concat("\n#ifdef GL_ES\nprecision highp float;\n#else\n\n#if !defined(lowp)\n#define lowp\n#endif\n\n#if !defined(mediump)\n#define mediump\n#endif\n\n#if !defined(highp)\n#define highp\n#endif\n\n#endif",wi,bi.vertexSource,pi.vertexSource,di.vertexSource,n.vertexSource).join("\n"),y=l.createShader(l.FRAGMENT_SHADER);if(l.isContextLost())this.failedToCreate=!0;else{l.shaderSource(y,m),l.compileShader(y),l.attachShader(this.program,y);var _,g=l.createShader(l.VERTEX_SHADER);if(l.isContextLost())this.failedToCreate=!0;else{l.shaderSource(g,v),l.compileShader(g),l.attachShader(this.program,g),this.attributes={},this.numAttributes=f.length;for(var x=0;x<this.numAttributes;x++)f[x]&&(l.bindAttribLocation(this.program,x,f[x]),this.attributes[f[x]]=x);l.linkProgram(this.program),l.deleteShader(g),l.deleteShader(y),this.fixedUniforms=o(e),this.binderUniforms=a?a.getUniforms(e):[],s.includes("TERRAIN")&&(this.terrainUniforms={u_dem:new i.Uniform1i(_=e),u_dem_prev:new i.Uniform1i(_),u_dem_unpack:new i.Uniform4f(_),u_dem_tl:new i.Uniform2f(_),u_dem_scale:new i.Uniform1f(_),u_dem_tl_prev:new i.Uniform2f(_),u_dem_scale_prev:new i.Uniform1f(_),u_dem_size:new i.Uniform1f(_),u_dem_lerp:new i.Uniform1f(_),u_exaggeration:new i.Uniform1f(_),u_depth:new i.Uniform1i(_),u_depth_size_inv:new i.Uniform2f(_),u_meter_to_dem:new i.Uniform1f(_),u_label_plane_matrix_inv:new i.UniformMatrix4f(_)}),s.includes("GLOBE")&&(this.globeUniforms=function(e){return{u_tile_tl_up:new i.Uniform3f(e),u_tile_tr_up:new i.Uniform3f(e),u_tile_br_up:new i.Uniform3f(e),u_tile_bl_up:new i.Uniform3f(e),u_tile_up_scale:new i.Uniform1f(e)}}(e)),s.includes("FOG")&&(this.fogUniforms=function(e){return{u_fog_matrix:new i.UniformMatrix4f(e),u_fog_range:new i.Uniform2f(e),u_fog_color:new i.Uniform4f(e),u_fog_horizon_blend:new i.Uniform1f(e),u_fog_temporal_offset:new i.Uniform1f(e),u_frustum_tl:new i.Uniform3f(e),u_frustum_tr:new i.Uniform3f(e),u_frustum_br:new i.Uniform3f(e),u_frustum_bl:new i.Uniform3f(e),u_globe_pos:new i.Uniform3f(e),u_globe_radius:new i.Uniform1f(e),u_globe_transition:new i.Uniform1f(e),u_is_globe:new i.Uniform1i(e),u_viewport:new i.Uniform2f(e)}}(e))}}}return d(t,[{key:"setTerrainUniformValues",value:function(e,t){if(this.terrainUniforms){var i=this.terrainUniforms;if(!this.failedToCreate)for(var r in e.program.set(this.program),t)i[r]&&i[r].set(this.program,r,t[r])}}},{key:"setGlobeUniformValues",value:function(e,t){if(this.globeUniforms){var i=this.globeUniforms;if(!this.failedToCreate)for(var r in e.program.set(this.program),t)i[r]&&i[r].set(this.program,r,t[r])}}},{key:"setFogUniformValues",value:function(e,t){if(this.fogUniforms){var i=this.fogUniforms;if(!this.failedToCreate)for(var r in e.program.set(this.program),t)i[r].set(this.program,r,t[r])}}},{key:"draw",value:function(t,i,r,n,a,o,s,u,c,h,f,d,p,m,v){var y,_=t.gl;if(!this.failedToCreate){t.program.set(this.program),t.setDepthMode(r),t.setStencilMode(n),t.setColorMode(a),t.setCullFace(o);for(var g=0,x=Object.keys(this.fixedUniforms);
1g<x.length;g++){var b=x[g];this.fixedUniforms[b].set(this.program,b,s[b])}m&&m.setUniforms(this.program,t,this.binderUniforms,d,{zoom:p});var w,k=(y={},e(y,_.LINES,2),e(y,_.TRIANGLES,3),e(y,_.LINE_STRIP,1),y)[i],T=l(f.get());try{for(T.s();!(w=T.n()).done;){var E=w.value,M=E.vaos||(E.vaos={});(M[u]||(M[u]=new Si)).bind(t,this,c,m?m.getPaintVertexBuffers():[],h,E.vertexOffset,v||[]),_.drawElements(i,E.primitiveLength*k,_.UNSIGNED_SHORT,E.primitiveOffset*k*2)}}catch(S){T.e(S)}finally{T.f()}}}}],[{key:"cacheKey",value:function(e,t,i,r){var n,a="".concat(t).concat(r?r.cacheKey:""),o=l(i);try{for(o.s();!(n=o.n()).done;){var s=n.value;e.usedDefines.includes(s)&&(a+="/".concat(s))}}catch(u){o.e(u)}finally{o.f()}return a}}]),t}();function Xi(e,t){var i=Math.pow(2,t.tileID.overscaledZ),r=t.tileSize*Math.pow(2,e.transform.tileZoom)/i,n=r*(t.tileID.canonical.x+t.tileID.wrap*i),a=r*t.tileID.canonical.y;return{u_image:0,u_texsize:t.imageAtlasTexture.size,u_tile_units_to_pixels:1/W(t,1,e.transform.tileZoom),u_pixel_coord_upper:[n>>16,a>>16],u_pixel_coord_lower:[65535&n,65535&a]}}var Hi=i.create(),Yi=function(e,t,r,n,a,o,s,l,u,c,h){var f=t.style.light,d=f.properties.get("position"),p=[d.x,d.y,d.z],m=i.create$1();"viewport"===f.properties.get("anchor")&&(i.fromRotation(m,-t.transform.angle),i.transformMat3(p,p,m));var v=f.properties.get("color"),y=t.transform,_={u_matrix:e,u_lightpos:p,u_lightintensity:f.properties.get("intensity"),u_lightcolor:[v.r,v.g,v.b],u_vertical_gradient:+r,u_opacity:n,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Hi,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_ao:a,u_edge_radius:o};return"globe"===y.projection.name&&(_.u_tile_id=[s.canonical.x,s.canonical.y,1<<s.canonical.z],_.u_zoom_transition=u,_.u_inv_rot_matrix=h,_.u_merc_center=c,_.u_up_dir=y.projection.upVector(new i.CanonicalTileID(0,0,0),c[0]*i.EXTENT,c[1]*i.EXTENT),_.u_height_lift=l),_},Ki=function(e,t,r,n,a,o,s,l,u,c,h,f){var d=Yi(e,t,r,n,a,o,s,u,c,h,f),p={u_height_factor:-Math.pow(2,s.overscaledZ)/l.tileSize/8};return i.extend(d,Xi(t,l),p)},Ji=function(e){return{u_matrix:e}},$i=function(e,t,r){return i.extend(Ji(e),Xi(t,r))},Qi=function(e,t){return{u_matrix:e,u_world:t}},er=function(e,t,r,n){return i.extend($i(e,t,r),{u_world:n})},tr=i.create(),ir=function(e,t,r,n,a,o){var s,l=e.transform,u="globe"===l.projection.name;if("map"===o.paint.get("circle-pitch-alignment"))if(u){var c=i.globePixelsToTileUnits(l.zoom,t.canonical)*l._pixelsPerMercatorPixel;s=Float32Array.from([c,0,0,c])}else s=l.calculatePixelsToTileUnitsMatrix(r);else s=new Float32Array([l.pixelsToGLUnits[0],0,0,l.pixelsToGLUnits[1]]);var h={u_camera_to_center_distance:l.cameraToCenterDistance,u_matrix:e.translatePosMatrix(t.projMatrix,r,o.paint.get("circle-translate"),o.paint.get("circle-translate-anchor")),u_device_pixel_ratio:i.exported.devicePixelRatio,u_extrude_scale:s,u_inv_rot_matrix:tr,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(u){h.u_inv_rot_matrix=n,h.u_merc_center=a,h.u_tile_id=[t.canonical.x,t.canonical.y,1<<t.canonical.z],h.u_zoom_transition=i.globeToMercatorTransition(l.zoom);var f=a[0]*i.EXTENT,d=a[1]*i.EXTENT;h.u_up_dir=l.projection.upVector(new i.CanonicalTileID(0,0,0),f,d)}return h},rr=function(e){var t=[];return"map"===e.paint.get("circle-pitch-alignment")&&t.push("PITCH_WITH_MAP"),"map"===e.paint.get("circle-pitch-scale")&&t.push("SCALE_WITH_MAP"),t},nr=function(e,t,r,n){var a=i.EXTENT/r.tileSize;return{u_matrix:e,u_camera_to_center_distance:t.getCameraToCenterDistance(n),u_extrude_scale:[t.pixelsToGLUnits[0]/a,t.pixelsToGLUnits[1]/a]}},ar=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return{u_matrix:e,u_color:t,u_overlay:0,u_overlay_scale:i}},or=i.create(),sr=function(e,t,r,n,a,o,s){var l=e.transform,u="globe"===l.projection.name,c=u?i.globePixelsToTileUnits(l.zoom,t.canonical)*l._pixelsPerMercatorPixel:W(r,1,o),h={u_matrix:t.projMatrix,u_extrude_scale:c,u_intensity:s,u_inv_rot_matrix:or,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(u){h.u_inv_rot_matrix=n,h.u_merc_center=a,h.u_tile_id=[t.canonical.x,t.canonical.y,1<<t.canonical.z],h.u_zoom_transition=i.globeToMercatorTransition(l.zoom);var f=a[0]*i.EXTENT,d=a[1]*i.EXTENT;h.u_up_dir=l.projection.upVector(new i.CanonicalTileID(0,0,0),f,d)}return h};function lr(e,t){return 1/W(e,1,t.tileZoom)}function ur(e,t,i,r){return e.translatePosMatrix(r||t.tileID.projMatrix,t,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}function cr(e){var t=e.paint.get("line-dasharray").value;return t.value||"constant"!==t.kind}var hr=function(e,t,i,r,n,a){return{u_matrix:e,u_tl_parent:t,u_scale_parent:i,u_fade_t:r.mix,u_opacity:r.opacity*n.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:n.paint.get("raster-brightness-min"),u_brightness_high:n.paint.get("raster-brightness-max"),u_saturation_factor:(s=n.paint.get("raster-saturation"),s>0?1-1/(1.001-s):-s),u_contrast_factor:(o=n.paint.get("raster-contrast"),o>0?1/(1-o):1+o),u_spin_weights:fr(n.paint.get("raster-hue-rotate")),u_perspective_transform:a};var o,s};function fr(e){e*=Math.PI/180;var t=Math.sin(e),i=Math.cos(e);return[(2*i+1)/3,(-Math.sqrt(3)*t-i+1)/3,(Math.sqrt(3)*t-i+1)/3]}var dr,pr=i.create(),mr=function(e,t,r,n,a,o,s,l,u,c,h,f,d,p,m,v){var y=a.transform,_={u_is_size_zoom_constant:+("constant"===e||"source"===e),u_is_size_feature_constant:+("constant"===e||"camera"===e),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:y.cameraToCenterDistance,u_rotate_symbol:+r,u_aspect_ratio:y.width/y.height,u_fade_change:a.options.fadeDuration?a.symbolFadeChange:1,u_matrix:o,u_label_plane_matrix:s,u_coord_matrix:l,u_is_text:+u,u_pitch_with_map:+n,u_texsize:c,u_texture:0,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:pr,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:pr,u_up_vector:[0,-1,0]};return"globe"===v.name&&(_.u_tile_id=[h.canonical.x,h.canonical.y,1<<h.canonical.z],_.u_zoom_transition=f,_.u_inv_rot_matrix=p,_.u_merc_center=d,_.u_camera_forward=y._camera.forward(),_.u_ecef_origin=i.globeECEFOrigin(y.globeMatrix,h.toUnwrapped()),_.u_tile_matrix=Float32Array.from(y.globeMatrix),_.u_up_vector=m),_},vr=function(e,t,r,n,a,o,s,l,u,c,h,f,d,p,m,v,y){return i.extend(mr(e,t,r,n,a,o,s,l,u,c,f,d,p,m,v,y),{u_gamma_scale:n?a.transform.cameraToCenterDistance*Math.cos(a.terrain?0:a.transform._pitch):1,u_device_pixel_ratio:i.exported.devicePixelRatio,u_is_halo:+h})},yr=function(e,t,r,n,a,o,s,l,u,c,h,f,d,p,m,v){return i.extend(vr(e,t,r,n,a,o,s,l,!0,u,!0,h,f,d,p,m,v),{u_texsize_icon:c,u_texture_icon:1})},_r=function(e,t,i){return{u_matrix:e,u_opacity:t,u_color:i}},gr=function(e,t,r,n,a){return i.extend((o=n,l=a,u=(s=r).imageManager.getPattern(o.toString()),c=s.imageManager.getPixelSize(),h=c.width,f=c.height,d=Math.pow(2,l.tileID.overscaledZ
1),p=l.tileSize*Math.pow(2,s.transform.tileZoom)/d,m=p*(l.tileID.canonical.x+l.tileID.wrap*d),v=p*l.tileID.canonical.y,{u_image:0,u_pattern_tl:u.tl,u_pattern_br:u.br,u_texsize:[h,f],u_pattern_size:u.displaySize,u_tile_units_to_pixels:1/W(l,1,s.transform.tileZoom),u_pixel_coord_upper:[m>>16,v>>16],u_pixel_coord_lower:[65535&m,65535&v]}),{u_matrix:e,u_opacity:t});var o,s,l,u,c,h,f,d,p,m,v},xr={fillExtrusion:function(e){return{u_matrix:new i.UniformMatrix4f(e),u_lightpos:new i.Uniform3f(e),u_lightintensity:new i.Uniform1f(e),u_lightcolor:new i.Uniform3f(e),u_vertical_gradient:new i.Uniform1f(e),u_opacity:new i.Uniform1f(e),u_edge_radius:new i.Uniform1f(e),u_ao:new i.Uniform2f(e),u_tile_id:new i.Uniform3f(e),u_zoom_transition:new i.Uniform1f(e),u_inv_rot_matrix:new i.UniformMatrix4f(e),u_merc_center:new i.Uniform2f(e),u_up_dir:new i.Uniform3f(e),u_height_lift:new i.Uniform1f(e)}},fillExtrusionPattern:function(e){return{u_matrix:new i.UniformMatrix4f(e),u_lightpos:new i.Uniform3f(e),u_lightintensity:new i.Uniform1f(e),u_lightcolor:new i.Uniform3f(e),u_vertical_gradient:new i.Uniform1f(e),u_height_factor:new i.Uniform1f(e),u_edge_radius:new i.Uniform1f(e),u_ao:new i.Uniform2f(e),u_tile_id:new i.Uniform3f(e),u_zoom_transition:new i.Uniform1f(e),u_inv_rot_matrix:new i.UniformMatrix4f(e),u_merc_center:new i.Uniform2f(e),u_up_dir:new i.Uniform3f(e),u_height_lift:new i.Uniform1f(e),u_image:new i.Uniform1i(e),u_texsize:new i.Uniform2f(e),u_pixel_coord_upper:new i.Uniform2f(e),u_pixel_coord_lower:new i.Uniform2f(e),u_tile_units_to_pixels:new i.Uniform1f(e),u_opacity:new i.Uniform1f(e)}},fill:function(e){return{u_matrix:new i.UniformMatrix4f(e)}},fillPattern:function(e){return{u_matrix:new i.UniformMatrix4f(e),u_image:new i.Uniform1i(e),u_texsize:new i.Uniform2f(e),u_pixel_coord_upper:new i.Uniform2f(e),u_pixel_coord_lower:new i.Uniform2f(e),u_tile_units_to_pixels:new i.Uniform1f(e)}},fillOutline:function(e){return{u_matrix:new i.UniformMatrix4f(e),u_world:new i.Uniform2f(e)}},fillOutlinePattern:function(e){return{u_matrix:new i.UniformMatrix4f(e),u_world:new i.Uniform2f(e),u_image:new i.Uniform1i(e),u_texsize:new i.Uniform2f(e),u_pixel_coord_upper:new i.Uniform2f(e),u_pixel_coord_lower:new i.Uniform2f(e),u_tile_units_to_pixels:new i.Uniform1f(e)}},circle:function(e){return{u_camera_to_center_distance:new i.Uniform1f(e),u_extrude_scale:new i.UniformMatrix2f(e),u_device_pixel_ratio:new i.Uniform1f(e),u_matrix:new i.UniformMatrix4f(e),u_inv_rot_matrix:new i.UniformMatrix4f(e),u_merc_center:new i.Uniform2f(e),u_tile_id:new i.Uniform3f(e),u_zoom_transition:new i.Uniform1f(e),u_up_dir:new i.Uniform3f(e)}},collisionBox:function(e){return{u_matrix:new i.UniformMatrix4f(e),u_camera_to_center_distance:new i.Uniform1f(e),u_extrude_scale:new i.Uniform2f(e)}},collisionCircle:function(e){return{u_matrix:new i.UniformMatrix4f(e),u_inv_matrix:new i.UniformMatrix4f(e),u_camera_to_center_distance:new i.Uniform1f(e),u_viewport_size:new i.Uniform2f(e)}},debug:function(e){return{u_color:new i.UniformColor(e),u_matrix:new i.UniformMatrix4f(e),u_overlay:new i.Uniform1i(e),u_overlay_scale:new i.Uniform1f(e)}},clippingMask:function(e){return{u_matrix:new i.UniformMatrix4f(e)}},heatmap:function(e){return{u_extrude_scale:new i.Uniform1f(e),u_intensity:new i.Uniform1f(e),u_matrix:new i.UniformMatrix4f(e),u_inv_rot_matrix:new i.UniformMatrix4f(e),u_merc_center:new i.Uniform2f(e),u_tile_id:new i.Uniform3f(e),u_zoom_transition:new i.Uniform1f(e),u_up_dir:new i.Uniform3f(e)}},heatmapTexture:function(e){return{u_image:new i.Uniform1i(e),u_color_ramp:new i.Uniform1i(e),u_opacity:new i.Uniform1f(e)}},hillshade:function(e){return{u_matrix:new i.UniformMatrix4f(e),u_image:new i.Uniform1i(e),u_latrange:new i.Uniform2f(e),u_light:new i.Uniform2f(e),u_shadow:new i.UniformColor(e),u_highlight:new i.UniformColor(e),u_accent:new i.UniformColor(e)}},hillshadePrepare:function(e){return{u_matrix:new i.UniformMatrix4f(e),u_image:new i.Uniform1i(e),u_dimension:new i.Uniform2f(e),u_zoom:new i.Uniform1f(e),u_unpack:new i.Uniform4f(e)}},line:function(e){return{u_matrix:new i.UniformMatrix4f(e),u_pixels_to_tile_units:new i.UniformMatrix2f(e),u_device_pixel_ratio:new i.Uniform1f(e),u_units_to_pixels:new i.Uniform2f(e),u_dash_image:new i.Uniform1i(e),u_gradient_image:new i.Uniform1i(e),u_image_height:new i.Uniform1f(e),u_texsize:new i.Uniform2f(e),u_tile_units_to_pixels:new i.Uniform1f(e),u_alpha_discard_threshold:new i.Uniform1f(e),u_trim_offset:new i.Uniform2f(e)}},linePattern:function(e){return{u_matrix:new i.UniformMatrix4f(e),u_texsize:new i.Uniform2f(e),u_pixels_to_tile_units:new i.UniformMatrix2f(e),u_device_pixel_ratio:new i.Uniform1f(e),u_image:new i.Uniform1i(e),u_units_to_pixels:new i.Uniform2f(e),u_tile_units_to_pixels:new i.Uniform1f(e),u_alpha_discard_threshold:new i.Uniform1f(e)}},raster:function(e){return{u_matrix:new i.UniformMatrix4f(e),u_tl_parent:new i.Uniform2f(e),u_scale_parent:new i.Uniform1f(e),u_fade_t:new i.Uniform1f(e),u_opacity:new i.Uniform1f(e),u_image0:new i.Uniform1i(e),u_image1:new i.Uniform1i(e),u_brightness_low:new i.Uniform1f(e),u_brightness_high:new i.Uniform1f(e),u_saturation_factor:new i.Uniform1f(e),u_contrast_factor:new i.Uniform1f(e),u_spin_weights:new i.Uniform3f(e),u_perspective_transform:new i.Uniform2f(e)}},symbolIcon:function(e){return{u_is_size_zoom_constant:new i.Uniform1i(e),u_is_size_feature_constant:new i.Uniform1i(e),u_size_t:new i.Uniform1f(e),u_size:new i.Uniform1f(e),u_camera_to_center_distance:new i.Uniform1f(e),u_rotate_symbol:new i.Uniform1i(e),u_aspect_ratio:new i.Uniform1f(e),u_fade_change:new i.Uniform1f(e),u_matrix:new i.UniformMatrix4f(e),u_label_plane_matrix:new i.UniformMatrix4f(e),u_coord_matrix:new i.UniformMatrix4f(e),u_is_text:new i.Uniform1i(e),u_pitch_with_map:new i.Uniform1i(e),u_texsize:new i.Uniform2f(e),u_tile_id:new i.Uniform3f(e),u_zoom_transition:new i.Uniform1f(e),u_inv_rot_matrix:new i.UniformMatrix4f(e),u_merc_center:new i.Uniform2f(e),u_camera_forward:new i.Uniform3f(e),u_tile_matrix:new i.UniformMatrix4f(e),u_up_vector:new i.Uniform3f(e),u_ecef_origin:new i.Uniform3f(e),u_texture:new i.Uniform1i(e)}},symbolSDF:function(e){return{u_is_size_zoom_constant:new i.Uniform1i(e),u_is_size_feature_constant:new i.Uniform1i(e),u_size_t:new i.Uniform1f(e),u_size:new i.Uniform1f(e),u_camera_to_center_distance:new i.Uniform1f(e),u_rotate_symbol:new i.Uniform1i(e),u_aspect_ratio:new i.Uniform1f(e),u_fade_change:new i.Uniform1f(e),u_matrix:new i.UniformMatrix4f(e),u_label_plane_matrix:new i.UniformMatrix4f(e),u_coord_matrix:new i.UniformMatrix4f(e),u_is_text:new i.Uniform1i(e),u_pitch_with_map:new i.Uniform1i(e),u_texsize:new i.Uniform2f(e),u_texture:new i.Uniform1i(e),u_gamma_scale:new i.Uniform1f(e),u_device_pixel_ratio:new i.Uniform1f(e),u_tile_id:new i.Uniform3f(e),u_zoom_transition:new i.Uniform1f(e),u_inv_rot_matrix:new i.UniformMatrix4f(e),u_merc_center:new i.Uniform2f(e),u_camera_forward:new i.Uniform3f(e),u_tile_matrix:new i.UniformMatrix4f(e),u_up_vector:new i.Uniform3f(e),u_ecef_origin:new i.Uniform3f(e),u_is_halo:new i.Uniform1i(e)}},symbolTextAndIcon:function(e){return{u_is_size_zoom_constant:new i.Uniform1i(e),u_is_size_feature_constant:new i.Uniform1i(e),u_size_t:new i.Uniform1f(e),u_size:new i.Uniform1f(e),u_camera_to_center_distance:new i.Uniform1f(e),u_rotate_symbol:new i.Uniform1i(e),u_aspect_ratio:new i.Uniform1f(e),u_fade_change:new i.Uniform1f(e),u_matrix:new i.UniformMatrix4f(e),u_label_plane_matrix:new i.UniformMatrix4f(e),u_coord_matrix:new i.UniformMatrix4f(e),u_is_text:new i.Uniform1i(e),u_pitch_with_map:new i.Uniform1i(e),u_texsize:new i.Uniform2f(e),u_texsize_icon:new i.Uniform2f(e),u_texture:new i.Uniform1i(e),u_texture_icon:new i.Uniform1i(e),u_gamma_scale:new i.Uniform1f(e),u_device_pixel_ratio:new i.Uniform1f(e),u_is_halo:new i.Uniform1i(e)}},background:function(e){return{u_matrix:new i.UniformMatrix4f(e),u_opacity:new i.Uniform1f(e),u_color:new i.UniformColor(e)}},backgroundPattern:function(e){return{u_matrix:new i.UniformMatrix4f(e),u_opacity:new i.Uniform1f(e),u_image:new i.Uniform1i(e),u_pattern_tl:new i.Uniform2f(e),u_pattern_br:new i.Uniform2f(e),u_texsize:new i.Uniform2f(e),u_pattern_size:new i.Uniform2f(e),u_pixel_coord_upper:new i.Uniform2f(e),u_pixel_coord_lower:new i.Uniform2f(e),u_tile_units_to_pixels:new i.Uniform1f(e)}},terrainRaster:Pi,terrainDepth:Pi,skybox:function(e){return{u_matrix:new i.UniformMatrix4f(e),u_sun_direction:new i.Uniform3f(e),u_cubemap:new i.Uniform1i(e),u_opacity:new i.Uniform1f(e),u_temporal_offset:new i.Uniform1f(e)}},skyboxGradient:function(e){return{u_matrix:new i.UniformMatrix4f(e),u_color_ramp:new i.Uniform1i(e),u_center_direction:new i.Uniform3f(e),u_radius:new i.Uniform1f(e),u_opacity:new i.Uniform1f(e),u_temporal_offset:new i.Uniform1f(e)}},skyboxCapture:function(e){return{u_matrix_3f:new i.UniformMatrix3f(e),u_sun_direction:new i.Uniform3f(e),u_sun_intensity:new i.Uniform1f(e),u_color_tint_r:new i.Uniform4f(e),u_color_tint_m:new i.Uniform4f(e),u_luminance:new i.Uniform1f(e)}},globeRaster:function(e){return{u_proj_matrix:new i.UniformMatrix4f(e),u_globe_matrix:new i.UniformMatrix4f(e),u_normalize_matrix:new i.UniformMatrix4f(e),u_merc_matrix:new i.UniformMatrix4f(e),u_zoom_transition:new i.Uniform1f(e),u_merc_center:new i.Uniform2f(e),u_image0:new i.Uniform1i(e),u_grid_matrix:new i.UniformMatrix3f(e),u_skirt_height:new i.Uniform1f(e),u_frustum_tl:new i.Uniform3f(e),u_frustum_tr:new i.Uniform3f(e),u_frustum_br:new i.Uniform3f(e),u_frustum_bl:new i.Uniform3f(e),u_globe_pos:new i.Uniform3f(e),u_globe_radius:new i.Uniform1f(e),u_viewport:new i.Uniform2f(e)}},globeAtmosphere:function(e){return{u_frustum_tl:new i.Uniform3f(e),u_frustum_tr:new i.Uniform3f(e),u_frustum_br:new i.Uniform3f(e),u_frustum_bl:new i.Uniform3f(e),u_horizon:new i.Uniform1f(e),u_transition:new i.Uniform1f(e),u_fadeout_range:new i.Uniform1f(e),u_color:new i.Uniform4f(e),u_high_color:new i.Uniform4f(e),u_space_color:new i.Uniform4f(e),u_star_intensity:new i.Uniform1f(e),u_star_density:new i.Uniform1f(e),u_star_size:new i.Uniform1f(e),u_temporal_offset:new i.Uniform1f(e),u_horizon_angle:new i.Uniform1f(e),u_rotation_matrix:new i.UniformMatrix4f(e)}}};function br(e,t,r,n,a,o,s){for(var l=e.context,u=l.gl,c=e.transform,h=e.useProgram("collisionBox"),f=[],d=0,p=0,m=0;m<n.length;m++){var v=n[m],y=t.getTile(v),_=y.getBucket(r);
1if(_){var g=Dt(v,_,c),x=g;0===a[0]&&0===a[1]||(x=e.translatePosMatrix(g,y,a,o));var b=s?_.textCollisionBox:_.iconCollisionBox,w=_.collisionCircleArray;if(w.length>0){var k=i.create(),T=x;i.mul(k,_.placementInvProjMatrix,c.glCoordMatrix),i.mul(k,k,_.placementViewportMatrix),f.push({circleArray:w,circleOffset:p,transform:T,invTransform:k,projection:_.getProjection()}),p=d+=w.length/4}b&&(e.terrain&&e.terrain.setupElevationDraw(y,h),h.draw(l,u.LINES,i.DepthMode.disabled,i.StencilMode.disabled,e.colorModeForRenderPass(),i.CullFaceMode.disabled,nr(x,c,y,_.getProjection()),r.id,b.layoutVertexBuffer,b.indexBuffer,b.segments,null,c.zoom,null,[b.collisionVertexBuffer,b.collisionVertexBufferExt]))}}if(s&&f.length){var E=e.useProgram("collisionCircle"),M=new i.StructArrayLayout2f1f2i16;M.resize(4*d),M._trim();for(var S=0,I=0,C=f;I<C.length;I++)for(var A=C[I],z=0;z<A.circleArray.length/4;z++){var P=4*z,D=A.circleArray[P+0],L=A.circleArray[P+1],R=A.circleArray[P+2],B=A.circleArray[P+3];M.emplace(S++,D,L,R,B,0),M.emplace(S++,D,L,R,B,1),M.emplace(S++,D,L,R,B,2),M.emplace(S++,D,L,R,B,3)}(!dr||dr.length<2*d)&&(dr=function(e){var t=2*e,r=new i.StructArrayLayout3ui6;r.resize(t),r._trim();for(var n=0;n<t;n++){var a=6*n;r.uint16[a+0]=4*n+0,r.uint16[a+1]=4*n+1,r.uint16[a+2]=4*n+2,r.uint16[a+3]=4*n+2,r.uint16[a+4]=4*n+3,r.uint16[a+5]=4*n+0}return r}(d));for(var O,F=l.createIndexBuffer(dr,!0),U=l.createVertexBuffer(M,i.collisionCircleLayout.members,!0),V=0,j=f;V<j.length;V++){var N=j[V],G={u_matrix:N.transform,u_inv_matrix:N.invTransform,u_camera_to_center_distance:(O=c).getCameraToCenterDistance(N.projection),u_viewport_size:[O.width,O.height]};E.draw(l,u.TRIANGLES,i.DepthMode.disabled,i.StencilMode.disabled,e.colorModeForRenderPass(),i.CullFaceMode.disabled,G,r.id,U,F,i.SegmentVector.simpleSegment(0,2*N.circleOffset,N.circleArray.length,N.circleArray.length/2),null,c.zoom)}U.destroy(),F.destroy()}}var wr=i.create();function kr(e,t){var r=e.width,n=e.height,a=e.anchor,o=e.textOffset,s=e.textScale,l=i.getAnchorAlignment(a),u=-(l.horizontalAlign-.5)*r,c=-(l.verticalAlign-.5)*n,h=i.evaluateVariableOffset(a,o);return new i.pointGeometry((u/s+h[0])*t,(c/s+h[1])*t)}function Tr(e,t,r,n,o,s,l,u,c,h,f){var d=e.text.placedSymbolArray,p=e.text.dynamicLayoutVertexArray,m=e.icon.dynamicLayoutVertexArray,v={},y=e.getProjection(),_=Lt(u,y,s),g=s.elevation,x=y.upVectorScale(u.canonical,s.center.lat,s.worldSize).metersToTile;p.clear();for(var b=0;b<d.length;b++){var w=d.get(b),k=w.tileAnchorX,T=w.tileAnchorY,E=w.numGlyphs,M=e.allowVerticalPlacement&&!w.placedOrientation,S=w.hidden||!w.crossTileID||M?null:n[w.crossTileID];if(S){var I,C,A=0,z=0,P=0;if(g){var D=g?g.getAtTileOffset(u,k,T):0,L=a(y.upVector(u.canonical,k,T),3);A=D*L[0]*x,z=D*L[1]*x,P=D*L[2]*x}var R=a(_t(w.projectedAnchorX+A,w.projectedAnchorY+z,w.projectedAnchorZ+P,r?_:l),4),B=R[0],O=R[1],F=R[2],U=R[3],V=gt(s.getCameraToCenterDistance(y),U),j=o.evaluateSizeForFeature(e.textSizeData,h,w)*V/i.ONE_EM;r&&(j*=e.tilePixelRatio/c);var N=kr(S,j);r?(B=(C=a(_t((B=(I=y.projectTilePoint(k+N.x,T+N.y,u.canonical)).x)+A,(O=I.y)+z,(F=I.z)+P,l),3))[0],O=C[1],F=C[2]):(t&&N._rotate(-s.angle),B+=N.x,O+=N.y,F=0);for(var G=e.allowVerticalPlacement&&w.placedOrientation===i.WritingMode.vertical?Math.PI/2:0,Z=0;Z<E;Z++)i.addDynamicAttributes(p,B,O,F,G);f&&w.associatedIconIndex>=0&&(v[w.associatedIconIndex]={x:B,y:O,z:F,angle:G})}else It(E,p)}if(f){m.clear();for(var q=e.icon.placedSymbolArray,W=0;W<q.length;W++){var X=q.get(W),H=X.numGlyphs,Y=v[W];if(X.hidden||!Y)It(H,m);else for(var K=Y.x,J=Y.y,$=Y.z,Q=Y.angle,ee=0;ee<H;ee++)i.addDynamicAttributes(m,K,J,$,Q)}e.icon.dynamicLayoutVertexBuffer.updateData(m)}e.text.dynamicLayoutVertexBuffer.updateData(p)}function Er(e,t,i){return i.iconsInText&&t?"symbolTextAndIcon":e?"symbolSDF":"symbolIcon"}function Mr(e,t,r,n,a,o,s,u,c,h,f,d){var p=e.context,m=p.gl,v=e.transform,y="map"===u,_="map"===c,g=y&&"point"!==r.layout.get("symbol-placement"),x=y&&!_&&!g,b=void 0!==r.layout.get("symbol-sort-key").constantOr(1),w=!1,k=e.depthModeForSublayer(0,i.DepthMode.ReadOnly),T=[i.mercatorXfromLng(v.center.lng),i.mercatorYfromLat(v.center.lat)],E=r.layout.get("text-variable-anchor"),M="globe"===v.projection.name,S=[],I=[0,-1,0],C=I;!M&&!v.mercatorFromTransition||y||(C=function(e){var t=e._camera.getWorldToCamera(e.worldSize,1),r=i.multiply([],t,e.globeMatrix);i.invert(r,r);var n=[0,0,0],a=[0,1,0,0];return i.transformMat4$1(a,a,r),n[0]=a[0],n[1]=a[1],n[2]=a[2],i.normalize(n,n),n}(v));var A,z=l(n);try{for(z.s();!(A=z.n()).done;){var P=A.value,D=t.getTile(P),L=D.getBucket(r);
1if(L&&("mercator"!==L.projection.name||!M)){var R=a?L.text:L.icon;if(R&&!L.fullyClipped&&R.segments.get().length){var B=R.programConfigurations.get(r.id),O=a||L.sdfIcons,F=a?L.textSizeData:L.iconSizeData,U=_||0!==v.pitch,V=i.evaluateSizeForZoom(F,v.zoom),j=void 0,N=void 0,G=void 0,Z=void 0,q=[0,0],W=null;if(a){if(N=D.glyphAtlasTexture,G=m.LINEAR,j=D.glyphAtlasTexture.size,L.iconsInText){q=D.imageAtlasTexture.size,W=D.imageAtlasTexture;var X="composite"===F.kind||"camera"===F.kind;Z=U||e.options.rotating||e.options.zooming||X?m.LINEAR:m.NEAREST}}else{var H=1!==r.layout.get("icon-size").constantOr(0)||L.iconsNeedLinear;N=D.imageAtlasTexture,G=O||e.options.rotating||e.options.zooming||H||U?m.LINEAR:m.NEAREST,j=D.imageAtlasTexture.size}var Y="globe"===L.projection.name,K=Y?C:I,J=Y?i.globeToMercatorTransition(v.zoom):0,$=Lt(P,L.getProjection(),v),Q=v.calculatePixelsToTileUnitsMatrix(D),ee=mt($,D.tileID.canonical,_,y,v,L.getProjection(),Q),te=e.terrain&&_&&g?i.invert(i.create(),ee):wr,ie=yt($,D.tileID.canonical,_,y,v,L.getProjection(),Q),re=E&&L.hasTextData(),ne="none"!==r.layout.get("icon-text-fit")&&re&&L.hasIconData();if(g){var ae=v.elevation,oe=ae?ae.getAtTileOffsetFunc(P,v.center.lat,v.worldSize,L.getProjection()):null,
1se=vt($,D.tileID.canonical,_,y,v,L.getProjection(),Q);bt(L,$,e,a,se,ie,_,h,oe,P)}var le=g||a&&E||ne,ue=e.translatePosMatrix($,D,o,s),ce=le?wr:ee,he=e.translatePosMatrix(ie,D,o,s,!0),fe=L.getProjection().createInversionMatrix(v,P.canonical),de=[];e.terrainRenderModeElevated()&&_&&de.push("PITCH_WITH_MAP_TERRAIN"),Y&&de.push("PROJECTION_GLOBE_VIEW"),le&&de.push("PROJECTED_POS_ON_VIEWPORT");var pe,me=O&&0!==r.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(1);pe=O?L.iconsInText?yr(F.kind,V,x,_,e,ue,ce,he,j,q,P,J,T,fe,K,L.getProjection()):vr(F.kind,V,x,_,e,ue,ce,he,a,j,!0,P,J,T,fe,K,L.getProjection()):mr(F.kind,V,x,_,e,ue,ce,he,a,j,P,J,T,fe,K,L.getProjection());var ve={program:e.useProgram(Er(O,a,L),B,de),buffers:R,uniformValues:pe,atlasTexture:N,atlasTextureIcon:W,atlasInterpolation:G,atlasInterpolationIcon:Z,isSDF:O,hasHalo:me,tile:D,labelPlaneMatrixInv:te};if(b&&L.canOverlap){w=!0;var ye,_e=l(R.segments.get());try{for(_e.s();!(ye=_e.n()).done;){var ge=ye.value;S.push({segments:new i.SegmentVector([ge]),sortKey:ge.sortKey,state:ve})}}catch(Ee){_e.e(Ee)}finally{_e.f()}}else S.push({segments:R.segments,sortKey:0,state:ve})}}}}catch(Ee){z.e(Ee)}finally{z.f()}w&&S.sort(function(e,t){return e.sortKey-t.sortKey});for(var xe=0,be=S;xe<be.length;xe++){var we=be[xe],ke=we.state;if(e.terrain&&e.terrain.setupElevationDraw(ke.tile,ke.program,{useDepthForOcclusion:!M,labelPlaneMatrixInv:ke.labelPlaneMatrixInv}),p.activeTexture.set(m.TEXTURE0),ke.atlasTexture.bind(ke.atlasInterpolation,m.CLAMP_TO_EDGE),ke.atlasTextureIcon&&(p.activeTexture.set(m.TEXTURE1),ke.atlasTextureIcon&&ke.atlasTextureIcon.bind(ke.atlasInterpolationIcon,m.CLAMP_TO_EDGE)),ke.isSDF){var Te=ke.uniformValues;ke.hasHalo&&(Te.u_is_halo=1,Sr(ke.buffers,we.segments,r,e,ke.program,k,f,d,Te)),Te.u_is_halo=0}Sr(ke.buffers,we.segments,r,e,ke.program,k,f,d,ke.uniformValues)}}function Sr(e,t,r,n,a,o,s,l,u){var c=n.context,h=[e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer,e.globeExtVertexBuffer];a.draw(c,c.gl.TRIANGLES,o,s,l,i.CullFaceMode.disabled,u,r.id,e.layoutVertexBuffer,e.indexBuffer,t,r.paint,n.transform.zoom,e.programConfigurations.get(r.id),h)}function Ir(e,t,r,n,a,o,s){var u,c,h,f,d,p=e.context.gl,m=r.paint.get("fill-pattern"),v=m&&m.constantOr(1);s?(c=v&&!r.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",u=p.LINES):(c=v?"fillPattern":"fill",u=p.TRIANGLES);var y,_=l(n);try{for(_.s();!(y=_.n()).done;){var g=y.value,x=t.getTile(g);if(!v||x.patternsLoaded()){var b=x.getBucket(r);if(b){e.prepareDrawTile();var w=b.programConfigurations.get(r.id),k=e.useProgram(c,w);v&&(e.context.activeTexture.set(p.TEXTURE0),x.imageAtlasTexture.bind(p.LINEAR,p.CLAMP_TO_EDGE),w.updatePaintBuffers());var T=m.constantOr(null);if(T&&x.imageAtlas){var E=x.imageAtlas.patternPositions[T.toString()];E&&w.setConstantPatternPositions(E)}var M=e.translatePosMatrix(g.projMatrix,x,r.paint.get("fill-translate"),r.paint.get("fill-translate-anchor"));if(s){f=b.indexBuffer2,d=b.segments2;var S=e.terrain&&e.terrain.renderingToTexture?e.terrain.drapeBufferSize:[p.drawingBufferWidth,p.drawingBufferHeight];h="fillOutlinePattern"===c&&v?er(M,e,x,S):Qi(M,S)}else f=b.indexBuffer,d=b.segments,h=v?$i(M,e,x):Ji(M);e.prepareDrawProgram(e.context,k,g.toUnwrapped()),k.draw(e.context,u,a,e.stencilModeForClipping(g),o,i.CullFaceMode.disabled,h,r.id,b.layoutVertexBuffer,f,d,r.paint,e.transform.zoom,w)}}}}catch(I){_.e(I)}finally{_.f()}}function Cr(e,t,r,n,a,o,s){var u=e.context,c=u.gl,h=e.transform,f=r.paint.get("fill-extrusion-pattern"),d=f.constantOr(1),p=r.paint.get("fill-extrusion-opacity"),m=[r.paint.get("fill-extrusion-ambient-occlusion-intensity"),r.paint.get("fill-extrusion-ambient-occlusion-radius")],v=r.layout.get("fill-extrusion-edge-radius"),y="globe"===h.projection.name?i.fillExtrusionHeightLift():0,_="globe"===h.projection.name,g=_?i.globeToMercatorTransition(h.zoom):0,x=[i.mercatorXfromLng(h.center.lng),i.mercatorYfromLat(h.center.lat)],b=[];_&&b.push("PROJECTION_GLOBE_VIEW"),m[0]>0&&b.push("FAUX_AO");var w,k=l(n);try{for(k.s();!(w=k.n()).done;){var T=w.value,E=t.getTile(T),M=E.getBucket(r);
1if(M&&M.projection.name===h.projection.name){var S=M.programConfigurations.get(r.id),I=e.useProgram(d?"fillExtrusionPattern":"fillExtrusion",S,b);if(e.terrain){var C=e.terrain;if(e.style.terrainSetForDrapingOnly())C.setupElevationDraw(E,I,{useMeterToDem:!0});else{if(!M.enableTerrain)continue;if(C.setupElevationDraw(E,I,{useMeterToDem:!0}),Ar(u,t,T,M,r,C),!M.centroidVertexBuffer){var A=I.attributes.a_centroid_pos;void 0!==A&&c.vertexAttrib2f(A,0,0)}}}d&&(e.context.activeTexture.set(c.TEXTURE0),E.imageAtlasTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE),S.updatePaintBuffers());var z=f.constantOr(null);if(z&&E.imageAtlas){var P=E.imageAtlas.patternPositions[z.toString()];P&&S.setConstantPatternPositions(P)}var D=e.translatePosMatrix(T.projMatrix,E,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),L=h.projection.createInversionMatrix(h,T.canonical),R=r.paint.get("fill-extrusion-vertical-gradient"),B=d?Ki(D,e,R,p,m,v,T,E,y,g,x,L):Yi(D,e,R,p,m,v,T,y,g,x,L);e.prepareDrawProgram(u,I,T.toUnwrapped());var O=[];e.terrain&&O.push(M.centroidVertexBuffer),_&&O.push(M.layoutVertexExtBuffer),I.draw(u,u.gl.TRIANGLES,a,o,s,i.CullFaceMode.backCCW,B,r.id,M.layoutVertexBuffer,M.indexBuffer,M.segments,r.paint,e.transform.zoom,S,O)}}}catch(F){k.e(F)}finally{k.f()}}function Ar(e,t,r,n,a,o){for(var s,u,c,h=[function(e){var t=e.canonical.x-1,r=e.wrap;return t<0&&(t=(1<<e.canonical.z)-1,r--),new i.OverscaledTileID(e.overscaledZ,r,e.canonical.z,t,e.canonical.y)},function(e){var t=e.canonical.x+1,r=e.wrap;return t===1<<e.canonical.z&&(t=0,r++),new i.OverscaledTileID(e.overscaledZ,r,e.canonical.z,t,e.canonical.y)},function(e){return new i.OverscaledTileID(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,(0===e.canonical.y?1<<e.canonical.z:e.canonical.y)-1)},function(e){return new i.OverscaledTileID(e.overscaledZ,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y===(1<<e.canonical.z)-1?0:e.canonical.y+1)}],f=function(e){for(var i=t.getSource().minzoom,r=function(e){var i=t.getTileByID(e);if(i&&i.hasData())return i.getBucket(a)},n=0,o=[0,-1,1];n<o.length;n++){var s=o[n];if(!(e.overscaledZ+s<i)){var l=r(e.calculateScaledKey(e.overscaledZ+s));if(l)return l}}},d=[0,0,0],p=function(e,t){return d[0]=Math.min(e.min.y,t.min.y),d[1]=Math.max(e.max.y,t.max.y),d[2]=i.EXTENT-t.min.x>e.max.x?t.min.x-i.EXTENT:e.max.x,d},m=function(e,t){return d[0]=Math.min(e.min.x,t.min.x),d[1]=Math.max(e.max.x,t.max.x),d[2]=i.EXTENT-t.min.y>e.max.y?t.min.y-i.EXTENT:e.max.y,d},v=[function(e,t){return p(e,t)},function(e,t){return p(t,e)},function(e,t){return m(e,t)},function(e,t){return m(t,e)}],y=new i.pointGeometry(0,0),_=function(e,t,n,a,l){var h=[[a?n:e,a?e:n,0],[a?n:t,a?t:n,0]],f=l<0?i.EXTENT+l:l,d=[a?f:(e+t)/2,a?(e+t)/2:f,0];return 0===n&&l<0||0!==n&&l>0?o.getForTilePoints(c,[d],!0,u):h.push(d),o.getForTilePoints(r,h,!0,s),Math.max(h[0][2],h[1][2],d[2])/o.exaggeration()},g=0;g<4;g++){var x=(g<2?1:5)-g,b=n.borders[g];if(0!==b.length){var w=c=h[g](r),k=f(w);if(k&&k instanceof i.FillExtrusionBucket&&k.enableTerrain&&(n.borderDoneWithNeighborZ[g]!==k.canonical.z||k.borderDoneWithNeighborZ[x]!==n.canonical.z)&&((u=o.findDEMTileFor(w))&&u.dem)){if(!s){var T=o.findDEMTileFor(r);if(!T||!T.dem)return;s=T}var E=k.borders[x],M=0,S=k.borderDoneWithNeighborZ[x]!==n.canonical.z;if(n.canonical.z===k.canonical.z){for(var I=0;I<b.length;I++){for(var C=n.featuresOnBorder[b[I]],A=C.borders[g],z=void 0;M<E.length&&!((z=k.featuresOnBorder[E[M]]).borders[x][1]>A[0]+3);)S&&k.encodeCentroid(void 0,z,!1),M++;if(z&&M<E.length){for(var P=M,D=0;!(z.borders[x][0]>A[1]-3)&&(D++,++M!==E.length);)z=k.featuresOnBorder[E[M]];if(z=k.featuresOnBorder[E[P]],C.intersectsCount()>1||z.intersectsCount()>1||1!==D){1!==D&&(M=P),n.encodeCentroid(void 0,C,!1),S&&k.encodeCentroid(void 0,z,!1);continue}var L=v[g](C,z),R=g%2?i.EXTENT-1:0;y.x=_(L[0],Math.min(i.EXTENT-1,L[1]),R,g<2,L[2]),y.y=0,n.encodeCentroid(y,C,!1),S&&k.encodeCentroid(y,z,!1)}else n.encodeCentroid(void 0,C,!1)}n.borderDoneWithNeighborZ[g]=k.canonical.z,n.needsCentroidUpdate=!0,S&&(k.borderDoneWithNeighborZ[x]=n.canonical.z,k.needsCentroidUpdate=!0)}else{var B,O=l(b);try{for(O.s();!(B=O.n()).done;){var F=B.value;n.encodeCentroid(void 0,n.featuresOnBorder[F],!1)}}catch(N){O.e(N)}finally{O.f()}if(S){var U,V=l(E);try{for(V.s();!(U=V.n()).done;){var j=U.value;k.encodeCentroid(void 0,k.featuresOnBorder[j],!1)}}catch(N){V.e(N)}finally{V.f()}k.borderDoneWithNeighborZ[x]=n.canonical.z,k.needsCentroidUpdate=!0}n.borderDoneWithNeighborZ[g]=k.canonical.z,n.needsCentroidUpdate=!0}}}}(n.needsCentroidUpdate||!n.centroidVertexBuffer&&0!==n.centroidVertexArray.length)&&n.uploadCentroid(e)}var zr=new i.Color(1,0,0,1),Pr=new i.Color(0,1,0,1),Dr=new i.Color(0,0,1,1),Lr=new i.Color(1,0,1,1),Rr=new i.Color(0,1,1,1);function Br(e,t,r){var n=e.context,a=e.transform,o=n.gl,s="globe"===a.projection.name,l=s?["PROJECTION_GLOBE_VIEW"]:null,u=r.projMatrix;if(s&&i.globeToMercatorTransition(a.zoom)>0){var c=i.transitionTileAABBinECEF(r.canonical,a),h=i.globeDenormalizeECEF(c);u=i.multiply(new Float32Array(16),a.globeMatrix,h),i.multiply(u,a.projMatrix,u)}var f=e.useProgram("debug",null,l),d=t.getTileByID(r.key);e.terrain&&e.terrain.setupElevationDraw(d,f);var p=i.DepthMode.disabled,m=i.StencilMode.disabled,v=e.colorModeForRenderPass(),y="$debug";n.activeTexture.set(o.TEXTURE0),e.emptyTexture.bind(o.LINEAR,o.CLAMP_TO_EDGE),s?d._makeGlobeTileDebugBuffers(e.context,a):d._makeDebugTileBoundsBuffers(e.context,a.projection);var _=d._tileDebugBuffer||e.debugBuffer,g=d._tileDebugIndexBuffer||e.debugIndexBuffer,x=d._tileDebugSegments||e.debugSegments;f.draw(n,o.LINE_STRIP,p,m,v,i.CullFaceMode.disabled,ar(u,i.Color.red),y,_,g,x,null,null,null,[d._globeTileDebugBorderBuffer]);var b=d.latestRawTileData,w=Math.floor((b&&b.byteLength||0)/1024),k=t.getTile(r).tileSize,T=512/Math.min(k,512)*(r.overscaledZ/a.zoom)*.5,E=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(E+=" =>
1 ".concat(r.overscaledZ)),function(e,t){e.initDebugOverlayCanvas();var i=e.debugOverlayCanvas,r=e.context.gl,n=e.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,i.width,i.height),n.shadowColor="white",n.shadowBlur=2,n.lineWidth=1.5,n.strokeStyle="white",n.textBaseline="top",n.font="bold 36px Open Sans, sans-serif",n.fillText(t,5,5),n.strokeText(t,5,5),e.debugOverlayTexture.update(i),e.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}(e,E+=" ".concat(w,"kb"));var M=d._tileDebugTextBuffer||e.debugBuffer,S=d._tileDebugTextIndexBuffer||e.quadTriangleIndexBuffer,I=d._tileDebugTextSegments||e.debugSegments;f.draw(n,o.TRIANGLES,p,m,i.ColorMode.alphaBlended,i.CullFaceMode.disabled,ar(u,i.Color.transparent,T),y,M,S,I,null,null,null,[d._globeTileDebugTextBuffer])}function Or(e,t,i,r){Ur(e,0,t+i/2,e.transform.width,i,r)}function Fr(e,t,i,r){Ur(e,t-i/2,0,i,e.transform.height,r)}function Ur(e,t,r,n,a,o){var s=e.context,l=s.gl;l.enable(l.SCISSOR_TEST),l.scissor(t*i.exported.devicePixelRatio,r*i.exported.devicePixelRatio,n*i.exported.devicePixelRatio,a*i.exported.devicePixelRatio),s.clear({color:o}),l.disable(l.SCISSOR_TEST)}var Vr=i.createLayout([{name:"a_pos_3f",components:3,type:"Float32"}]).members;function jr(e,t,i,r){e.emplaceBack(t,i,r)}var Nr=d(function e(t){h(this,e),this.vertexArray=new i.StructArrayLayout3f12,this.indices=new i.StructArrayLayout3ui6,jr(this.vertexArray,-1,-1,1),jr(this.vertexArray,1,-1,1),jr(this.vertexArray,-1,1,1),jr(this.vertexArray,1,1,1),jr(this.vertexArray,-1,-1,-1),jr(this.vertexArray,1,-1,-1),jr(this.vertexArray,-1,1,-1),jr(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=t.createVertexBuffer(this.vertexArray,Vr),this.indexBuffer=t.createIndexBuffer(this.indices),this.segment=i.SegmentVector.simpleSegment(0,0,36,12)});function Gr(e,t,r,n,a,o){var s,l,u=e.gl,c=t.paint.get("sky-atmosphere-color"),h=t.paint.get("sky-atmosphere-halo-color"),f=t.paint.get("sky-atmosphere-sun-intensity"),d={u_matrix_3f:i.fromMat4(i.create$1(),n),u_sun_direction:a,u_sun_intensity:f,u_color_tint_r:[(s=c).r,s.g,s.b,s.a],u_color_tint_m:[(l=h).r,l.g,l.b,l.a],u_luminance:5e-5};u.framebufferTexture2D(u.FRAMEBUFFER,u.COLOR_ATTACHMENT0,u.TEXTURE_CUBE_MAP_POSITIVE_X+o,t.skyboxTexture,0),r.draw(e,u.TRIANGLES,i.DepthMode.disabled,i.StencilMode.disabled,i.ColorMode.unblended,i.CullFaceMode.frontCW,d,"skyboxCapture",t.skyboxGeometry.vertexBuffer,t.skyboxGeometry.indexBuffer,t.skyboxGeometry.segment)}var Zr=i.createLayout([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),qr=function(){function e(t){h(this,e);var r=new i.StructArrayLayout5f20;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);var n=new i.StructArrayLayout3ui6;n.emplaceBack(0,1,2),n.emplaceBack(2,3,0),this.vertexBuffer=t.createVertexBuffer(r,Zr.members),this.indexBuffer=t.createIndexBuffer(n),this.segments=i.SegmentVector.simpleSegment(0,0,4,2)}return d(e,[{key:"destroy",value:function(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}]),e}(),Wr={symbol:function(e,t,r,n,a){if("translucent"===e.renderPass){var o=i.StencilMode.disabled,s=e.colorModeForRenderPass();r.layout.get("text-variable-anchor")&&function(e,t,r,n,a,o,s){var u,c=t.transform,h="map"===a,f="map"===o,d=l(e);try{for(d.s();!(u=d.n()).done;){var p=u.value,m=n.getTile(p),v=m.getBucket(r);if(v&&v.text&&v.text.segments.get().length){var y=i.evaluateSizeForZoom(v.textSizeData,c.zoom),_=Lt(p,v.getProjection(),c),g=c.calculatePixelsToTileUnitsMatrix(m),x=mt(_,m.tileID.canonical,f,h,c,v.getProjection(),g),b="none"!==r.layout.get("icon-text-fit")&&v.hasIconData();if(y){var w=Math.pow(2,c.zoom-m.tileID.overscaledZ);Tr(v,h,f,s,i.symbolSize,c,x,p,w,y,b)}}}}catch(k){d.e(k)}finally{d.f()}}(n,e,r,t,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),a),0!==r.paint.get("icon-opacity").constantOr(1)&&Mr(e,t,r,n,!1,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),r.layout.get("icon-rotation-alignment"),r.layout.get("icon-pitch-alignment"),r.layout.get("icon-keep-upright"),o,s),0!==r.paint.get("text-opacity").constantOr(1)&&Mr(e,t,r,n,!0,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.layout.get("text-keep-upright"),o,s),t.map.showCollisionBoxes&&(br(e,t,r,n,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),!0),br(e,t,r,n,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),!1))}},circle:function(e,t,r,n){if("translucent"===e.renderPass){var a=r.paint.get("circle-opacity"),o=r.paint.get("circle-stroke-width"),s=r.paint.get("circle-stroke-opacity"),u=void 0!==r.layout.get("
1circle-sort-key").constantOr(1);if(0!==a.constantOr(1)||0!==o.constantOr(1)&&0!==s.constantOr(1)){for(var c=e.context,h=c.gl,f=e.transform,d=e.depthModeForSublayer(0,i.DepthMode.ReadOnly),p=i.StencilMode.disabled,m=e.colorModeForRenderPass(),v="globe"===f.projection.name,y=[i.mercatorXfromLng(f.center.lng),i.mercatorYfromLat(f.center.lat)],_=[],g=0;g<n.length;g++){var x=n[g],b=t.getTile(x),w=b.getBucket(r);if(w&&w.projection.name===f.projection.name){var k=w.programConfigurations.get(r.id),T=rr(r);v&&T.push("PROJECTION_GLOBE_VIEW");var E=e.useProgram("circle",k,T),M=w.layoutVertexBuffer,S=w.globeExtVertexBuffer,I=w.indexBuffer,C=f.projection.createInversionMatrix(f,x.canonical),A={programConfiguration:k,program:E,layoutVertexBuffer:M,globeExtVertexBuffer:S,indexBuffer:I,uniformValues:ir(e,x,b,C,y,r),tile:b};if(u){var z,P=l(w.segments.get());try{for(P.s();!(z=P.n()).done;){var D=z.value;_.push({segments:new i.SegmentVector([D]),sortKey:D.sortKey,state:A})}}catch(X){P.e(X)}finally{P.f()}}else _.push({segments:w.segments,sortKey:0,state:A})}}u&&_.sort(function(e,t){return e.sortKey-t.sortKey});for(var L={useDepthForOcclusion:!v},R=0,B=_;R<B.length;R++){var O=B[R],F=O.state,U=F.programConfiguration,V=F.program,j=F.layoutVertexBuffer,N=F.globeExtVertexBuffer,G=F.indexBuffer,Z=F.uniformValues,q=F.tile,W=O.segments;e.terrain&&e.terrain.setupElevationDraw(q,V,L),e.prepareDrawProgram(c,V,q.tileID.toUnwrapped()),V.draw(c,h.TRIANGLES,d,p,m,i.CullFaceMode.disabled,Z,r.id,j,G,W,r.paint,f.zoom,U,[N])}}}},heatmap:function(e,t,r,n){if(0!==r.paint.get("heatmap-opacity"))if("offscreen"===e.renderPass){var a=e.context,o=a.gl,s=i.StencilMode.disabled,l=new i.ColorMode([o.ONE,o.ONE],i.Color.transparent,[!0,!0,!0,!0]);(function(e,t,i,r){var n=e.gl,a=t.width*r,o=t.height*r;e.activeTexture.set(n.TEXTURE1),e.viewport.set([0,0,a,o]);var s,l,u,c,h,f,d=i.heatmapFbo;if(!d||d&&(d.width!==a||d.height!==o)){d&&d.destroy();var p=n.createTexture();n.bindTexture(n.TEXTURE_2D,p),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
1INEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),d=i.heatmapFbo=e.createFramebuffer(a,o,!1),l=p,u=d,c=a,h=o,(f=(s=e).gl).texImage2D(f.TEXTURE_2D,0,s.isWebGL2&&s.extRenderToTextureHalfFloat?f.RGBA16F:f.RGBA,c,h,0,f.RGBA,s.extRenderToTextureHalfFloat?s.isWebGL2?f.HALF_FLOAT:s.extTextureHalfFloat.HALF_FLOAT_OES:f.UNSIGNED_BYTE,null),u.colorAttachment.set(l)}else n.bindTexture(n.TEXTURE_2D,d.colorAttachment.get()),e.bindFramebuffer.set(d.framebuffer)})(a,e,r,"globe"===e.transform.projection.name?.5:.25),a.clear({color:i.Color.transparent});for(var u=e.transform,c="globe"===u.projection.name,h=c?["PROJECTION_GLOBE_VIEW"]:null,f=c?i.CullFaceMode.frontCCW:i.CullFaceMode.disabled,d=[i.mercatorXfromLng(u.center.lng),i.mercatorYfromLat(u.center.lat)],p=0;p<n.length;p++){var m=n[p];if(!t.hasRenderableParent(m)){var v=t.getTile(m),y=v.getBucket(r);if(y&&y.projection.name===u.projection.name){var _=y.programConfigurations.get(r.id),g=e.useProgram("heatmap",_,h),x=e.transform.zoom;e.terrain&&e.terrain.setupElevationDraw(v,g),e.prepareDrawProgram(a,g,m.toUnwrapped());var b=u.projection.createInversionMatrix(u,m.canonical);g.draw(a,o.TRIANGLES,i.DepthMode.disabled,s,l,f,sr(e,m,v,b,d,x,r.paint.get("heatmap-intensity")),r.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,r.paint,e.transform.zoom,_,c?[y.globeExtVertexBuffer]:null)}}}a.viewport.set([0,0,e.width,e.height])}else"translucent"===e.renderPass&&(e.context.setColorMode(e.colorModeForRenderPass()),function(e,t){var r=e.context,n=r.gl,a=t.heatmapFbo;if(a){r.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,a.colorAttachment.get()),r.activeTexture.set(n.TEXTURE1);var o=t.colorRampTexture;o||(o=t.colorRampTexture=new i.Texture(r,t.colorRamp,n.RGBA)),o.bind(n.LINEAR,n.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(r,n.TRIANGLES,i.DepthMode.disabled,i.StencilMode.disabled,e.colorModeForRenderPass(),i.CullFaceMode.disabled,{u_image:0,u_color_ramp:1,u_opacity:t.paint.get("heatmap-opacity")},t.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,t.paint,e.transform.zoom)}}(e,r))},line:function(e,t,r,n){if("translucent"===e.renderPass){var o=r.paint.get("line-opacity"),s=r.paint.get("line-width");if(0!==o.constantOr(1)&&0!==s.constantOr(1)){var u=e.depthModeForSublayer(0,i.DepthMode.ReadOnly),c=e.colorModeForRenderPass(),h=e.terrain&&e.terrain.renderingToTexture?1:i.exported.devicePixelRatio,f=r.paint.get("line-dasharray"),d=f.constantOr(1),p=r.layout.get("line-cap"),m=r.paint.get("line-pattern"),v=m.constantOr(1),y=r.paint.get("line-gradient"),_=v?"linePattern":"line",g=e.context,x=g.gl,b=function(e){var t=[];cr(e)&&t.push("RENDER_LINE_DASH"),e.paint.get("line-gradient")&&t.push("RENDER_LINE_GRADIENT");var i=e.paint.get("line-trim-offset");0===i[0]&&0===i[1]||t.push("RENDER_LINE_TRIM_OFFSET");var r=e.paint.get("line-pattern").constantOr(1),n=1!==e.paint.get("line-opacity").constantOr(1);return!r&&n&&t.push("RENDER_LINE_ALPHA_DISCARD"),t}(r),w=b.includes("RENDER_LINE_ALPHA_DISCARD");e.terrain&&e.terrain.clipOrMaskOverlapStencilType()&&(w=!1);var k,T=l(n);try{var E=function(){var n=k.value,o=t.getTile(n);if(v&&!o.patternsLoaded())return"continue";var s=o.getBucket(r);if(!s)return"continue";e.prepareDrawTile();var l=s.programConfigurations.get(r.id),T=e.useProgram(_,l,b),E=m.constantOr(null);if(E&&o.imageAtlas){var M=o.imageAtlas.patternPositions[E.toString()];M&&l.setConstantPatternPositions(M)}var S=f.constantOr(null),I=p.constantOr(null);if(!v&&S&&I&&o.lineAtlas){var C=o.lineAtlas.getDash(S,I);C&&l.setConstantPatternPositions(C)}var A=a(r.paint.get("line-trim-offset"),2),z=A[0],P=A[1];if("round"===I||"square"===I){z!==P&&(0===z&&(z-=1),1===P&&(P+=1))}var D=e.terrain?n.projMatrix:null,L=v?function(e,t,i,r,n){var a=e.transform;return{u_matrix:ur(e,t,i,r),u_texsize:t.imageAtlasTexture.size,u_pixels_to_tile_units:a.calculatePixelsToTileUnitsMatrix(t),u_device_pixel_ratio:n,u_image:0,u_tile_units_to_pixels:lr(t,a),u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]],u_alpha_discard_threshold:0}}(e,o,r,D,h):function(e,t,i,r,n,a,o){var s=e.transform,l=s.calculatePixelsToTileUnitsMatrix(t);return{u_matrix:ur(e,t,i,r),u_pixels_to_tile_units:l,u_device_pixel_ratio:a,u_units_to_pixels:[1/s.pixelsToGLUnits[0],1/s.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:n,u_texsize:cr(i)?t.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:lr(t,e.transform),u_alpha_discard_threshold:0,u_trim_offset:o}}(e,o,r,D,s.lineClipsArray.length,h,[z,P]);if(y){var R=s.gradients[r.id],B=R.texture;if(r.gradientVersion!==R.version){var O=256;
1if(r.stepInterpolant){var F=t.getSource().maxzoom,U=n.canonical.z===F?Math.ceil(1<<e.transform.maxZoom-n.canonical.z):1;O=i.clamp(i.nextPowerOfTwo(s.maxLineLength/i.EXTENT*1024*U),256,g.maxTextureSize)}R.gradient=i.renderColorRamp({expression:r.gradientExpression(),evaluationKey:"lineProgress",resolution:O,image:R.gradient||void 0,clips:s.lineClipsArray}),R.texture?R.texture.update(R.gradient):R.texture=new i.Texture(g,R.gradient,x.RGBA),R.version=r.gradientVersion,B=R.texture}g.activeTexture.set(x.TEXTURE1),B.bind(r.stepInterpolant?x.NEAREST:x.LINEAR,x.CLAMP_TO_EDGE)}d&&(g.activeTexture.set(x.TEXTURE0),o.lineAtlasTexture.bind(x.LINEAR,x.REPEAT),l.updatePaintBuffers()),v&&(g.activeTexture.set(x.TEXTURE0),o.imageAtlasTexture.bind(x.LINEAR,x.CLAMP_TO_EDGE),l.updatePaintBuffers()),e.prepareDrawProgram(g,T,n.toUnwrapped());var V=function(t){T.draw(g,x.TRIANGLES,u,t,c,i.CullFaceMode.disabled,L,r.id,s.layoutVertexBuffer,s.indexBuffer,s.segments,r.paint,e.transform.zoom,l,[s.layoutVertexBuffer2])};if(w){var j=e.stencilModeForClipping(n).ref;0===j&&e.terrain&&g.clear({stencil:0});var N={func:x.EQUAL,mask:255};L.u_alpha_discard_threshold=.8,V(new i.StencilMode(N,j,255,x.KEEP,x.KEEP,x.INVERT)),L.u_alpha_discard_threshold=0,V(new i.StencilMode(N,j,255,x.KEEP,x.KEEP,x.KEEP))}else V(e.stencilModeForClipping(n))};for(T.s();!(k=T.n()).done;)E()}
1catch(M){T.e(M)}finally{T.f()}w&&(e.resetStencilClippingMasks(),e.terrain&&g.clear({stencil:0}))}}},fill:function(e,t,r,n){var a=r.paint.get("fill-color"),o=r.paint.get("fill-opacity");if(0!==o.constantOr(1)){var s=e.colorModeForRenderPass(),l=r.paint.get("fill-pattern"),u=e.opaquePassEnabledForLayer()&&!l.constantOr(1)&&1===a.constantOr(i.Color.transparent).a&&1===o.constantOr(0)?"opaque":"translucent";if(e.renderPass===u){var c=e.depthModeForSublayer(1,"opaque"===e.renderPass?i.DepthMode.ReadWrite:i.DepthMode.ReadOnly);Ir(e,t,r,n,c,s,!1)}if("translucent"===e.renderPass&&r.paint.get("fill-antialias")){var h=e.depthModeForSublayer(r.getPaintProperty("fill-outline-color")?2:0,i.DepthMode.ReadOnly);Ir(e,t,r,n,h,s,!0)}}},"fill-extrusion":function(e,t,r,n){var a=r.paint.get("fill-extrusion-opacity");if(0!==a&&"translucent"===e.renderPass){var o=new i.DepthMode(e.context.gl.LEQUAL,i.DepthMode.ReadWrite,e.depthRangeFor3D);if(1!==a||r.paint.get("fill-extrusion-pattern").constantOr(1))Cr(e,t,r,n,o,i.StencilMode.disabled,i.ColorMode.disabled),Cr(e,t,r,n,o,e.stencilModeFor3D(),e.colorModeForRenderPass()),e.resetStencilClippingMasks();else{var s=e.colorModeForRenderPass();Cr(e,t,r,n,o,i.StencilMode.disabled,s)}}},hillshade:function(e,t,r,n){if("offscreen"===e.renderPass||"translucent"===e.renderPass){var o,s=e.context,u=e.depthModeForSublayer(0,i.DepthMode.ReadOnly),c=e.colorModeForRenderPass(),h=e.terrain&&e.terrain.renderingToTexture,f=a("translucent"!==e.renderPass||h?[{},n]:e.stencilConfigForOverlap(n),2),d=f[0],p=l(f[1]);try{for(p.s();!(o=p.n()).done;){var m=o.value,v=t.getTile(m);
1if(v.needsHillshadePrepare&&"offscreen"===e.renderPass)zi(e,v,r,u,i.StencilMode.disabled,c);else if("translucent"===e.renderPass){var y=h&&e.terrain?e.terrain.stencilModeForRTTOverlap(m):d[m.overscaledZ];Ci(e,m,v,r,u,y,c)}}}catch(_){p.e(_)}finally{p.f()}s.viewport.set([0,0,e.width,e.height]),e.resetStencilClippingMasks()}},raster:function(e,t,r,n,o,s){if("translucent"===e.renderPass&&0!==r.paint.get("raster-opacity")&&n.length){var u,c=e.context,h=c.gl,f=t.getSource(),d=e.useProgram("raster"),p=e.colorModeForRenderPass(),m=e.terrain&&e.terrain.renderingToTexture,v=a(f instanceof Ze||m?[{},n]:e.stencilConfigForOverlap(n),2),y=v[0],_=v[1],g=_[_.length-1].overscaledZ,x=!e.options.moving,b=l(_);try{for(b.s();!(u=b.n()).done;){var w=u.value,k=m?i.DepthMode.disabled:e.depthModeForSublayer(w.overscaledZ-g,1===r.paint.get("raster-opacity")?i.DepthMode.ReadWrite:i.DepthMode.ReadOnly,h.LESS),T=w.toUnwrapped(),E=t.getTile(w);if(!m||E&&E.hasData()){var M=m?w.projMatrix:e.transform.calculateProjMatrix(T,x),S=e.terrain&&m?e.terrain.stencilModeForRTTOverlap(w):y[w.overscaledZ],I=s?0:r.paint.get("raster-fade-duration");E.registerFadeDuration(I);var C=t.findLoadedParent(w,0),A=ji(E,C,t,e.transform,I),z=void 0,P=void 0;e.terrain&&e.terrain.prepareDrawTile();var D="nearest"===r.paint.get("raster-resampling")?h.NEAREST:h.LINEAR;c.activeTexture.set(h.TEXTURE0),E.texture.bind(D,h.CLAMP_TO_EDGE),c.activeTexture.set(h.TEXTURE1),C?(C.texture.bind(D,h.CLAMP_TO_EDGE),z=Math.pow(2,C.tileID.overscaledZ-E.tileID.overscaledZ),P=[E.tileID.canonical.x*z%1,E.tileID.canonical.y*z%1]):E.texture.bind(D,h.CLAMP_TO_EDGE),E.texture.useMipmap&&c.extTextureFilterAnisotropic&&e.transform.pitch>20&&h.texParameterf(h.TEXTURE_2D,c.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,c.extTextureFilterAnisotropicMax);var L=hr(M,P||[0,0],z||1,A,r,f instanceof Ze?f.perspectiveTransform:[0,0]);if(e.prepareDrawProgram(c,d,T),f instanceof Ze)f.boundsBuffer&&f.boundsSegments&&d.draw(c,h.TRIANGLES,k,i.StencilMode.disabled,p,i.CullFaceMode.disabled,L,r.id,f.boundsBuffer,e.quadTriangleIndexBuffer,f.boundsSegments);else{var R=e.getTileBoundsBuffers(E),B=R.tileBoundsBuffer,O=R.tileBoundsIndexBuffer,F=R.tileBoundsSegments;d.draw(c,h.TRIANGLES,k,S,p,i.CullFaceMode.disabled,L,r.id,B,O,F)}}}}catch(U){b.e(U)}finally{b.f()}e.resetStencilClippingMasks()}},background:function(e,t,r,n){var a=r.paint.get("background-color"),o=r.paint.get("background-opacity");if(0!==o){var s=e.context,u=s.gl,c=e.transform,h=c.tileSize,f=r.paint.get("background-pattern");if(!e.isPatternMissing(f)){var d=!f&&1===a.a&&1===o&&e.opaquePassEnabledForLayer()?"opaque":"translucent";if(e.renderPass===d){var p,m=i.StencilMode.disabled,v=e.depthModeForSublayer(0,"opaque"===d?i.DepthMode.ReadWrite:i.DepthMode.ReadOnly),y=e.colorModeForRenderPass(),_=e.useProgram(f?"backgroundPattern":"background"),g=n;g||(p=e.getBackgroundTiles(),g=Object.values(p).map(function(e){return e.tileID})),f&&(s.activeTexture.set(u.TEXTURE0),e.imageManager.bind(e.context));var x,b=l(g);try{for(b.s();!(x=b.n()).done;){var w=x.value,k=w.toUnwrapped(),T=n?w.projMatrix:e.transform.calculateProjMatrix(k);e.prepareDrawTile();var E=t?t.getTile(w):p?p[w.key]:new i.Tile(w,h,c.zoom,e),M=f?gr(T,o,e,f,{tileID:w,tileSize:h}):_r(T,o,a);e.prepareDrawProgram(s,_,k);var S=e.getTileBoundsBuffers(E),I=S.tileBoundsBuffer,C=S.tileBoundsIndexBuffer,A=S.tileBoundsSegments;_.draw(s,u.TRIANGLES,v,m,y,i.CullFaceMode.disabled,M,r.id,I,C,A)}}catch(z){b.e(z)}finally{b.f()}}}}},sky:function(e,t,r){var n=e.transform,a="mercator"===n.projection.name||"globe"===n.projection.name?1:i.smoothstep(7,8,n.zoom),o=r.paint.get("sky-opacity")*a;if(0!==o){var s=e.context,l=r.paint.get("sky-type"),u=new i.DepthMode(s.gl.LEQUAL,i.DepthMode.ReadOnly,[0,1]),c=e.frameCounter/1e3%1;"atmosphere"===l?"offscreen"===e.renderPass?r.needsSkyboxCapture(e)&&(function(e,t,r,n){var a=e.context,o=a.gl,s=t.skyboxFbo;if(!s){s=t.skyboxFbo=a.createFramebuffer(32,32,!1),t.skyboxGeometry=new Nr(a),t.skyboxTexture=a.gl.createTexture(),o.bindTexture(o.TEXTURE_CUBE_MAP,t.skyboxTexture),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_MAG_FILTER,o.LINEAR);for(var l=0;l<6;++l)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,o.RGBA,32,32,0,o.RGBA,o.UNSIGNED_BYTE,null)}a.bindFramebuffer.set(s.framebuffer),a.viewport.set([0,0,32,32]);var u=t.getCenter(e,!0),c=e.useProgram("skyboxCapture"),h=new Float64Array(16);i.identity(h),i.rotateY(h,h,.5*-Math.PI),Gr(a,t,c,h,u,0),i.identity(h),i.rotateY(h,h,.5*Math.PI),Gr(a,t,c,h,u,1),i.identity(h),i.rotateX(h,h,.5*-Math.PI),Gr(a,t,c,h,u,2),i.identity(h),i.rotateX(h,h,.5*Math.PI),Gr(a,t,c,h,u,3),i.identity(h),Gr(a,t,c,h,u,4),i.identity(h),i.rotateY(h,h,Math.PI),Gr(a,t,c,h,u,5),a.viewport.set([0,0,e.width,e.height])}(e,r),r.markSkyboxValid(e)):"sky"===e.renderPass&&function(e,t,r,n,a){var o=e.context,s=o.gl,l=e.transform,u=e.useProgram("skybox");o.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_CUBE_MAP,t.skyboxTexture);var c={u_matrix:l.skyboxMatrix,u_sun_direction:t.getCenter(e,!1),u_cubemap:0,u_opacity:n,u_temporal_offset:a};e.prepareDrawProgram(o,u),u.draw(o,s.TRIANGLES,r,i.StencilMode.disabled,e.colorModeForRenderPass(),i.CullFaceMode.backCW,c,"skybox",t.skyboxGeometry.vertexBuffer,t.skyboxGeometry.indexBuffer,t.skyboxGeometry.segment)}(e,r,u,o,c):"gradient"===l&&"sky"===e.renderPass&&function(e,t,r,n,a){var o=e.context,s=o.gl,l=e.transform,u=e.useProgram("skyboxGradient");t.skyboxGeometry||(t.skyboxGeometry=new Nr(o)),o.activeTexture.set(s.TEXTURE0);var c=t.colorRampTexture;c||(c=t.colorRampTexture=new i.Texture(o,t.colorRamp,s.RGBA)),c.bind(s.LINEAR,s.CLAMP_TO_EDGE);var h,f,d,p,m,v=(h=l.skyboxMatrix,f=t.getCenter(e,!1),d=t.paint.get("sky-gradient-radius"),p=n,m=a,{u_matrix:h,u_color_ramp:0,u_center_direction:f,u_radius:i.degToRad(d),u_opacity:p,u_temporal_offset:m});e.prepareDrawProgram(o,u),u.draw(o,s.TRIANGLES,r,i.StencilMode.disabled,e.colorModeForRenderPass(),i.CullFaceMode.backCW,v,"skyboxGradient",t.skyboxGeometry.vertexBuffer,t.skyboxGeometry.indexBuffer,t.skyboxGeometry.segment)}(e,r,u,o,c)}},debug:function(e,t,i){for(var r=0;r<i.length;r++)Br(e,t,i[r])},custom:function(e,t,r,n){var a=e.context,o=r.implementation;if(!e.transform.projection.unsupportedLayers||!e.transform.projection.unsupportedLayers.includes("custom")||e.terrain&&(e.terrain.renderingToTexture||"offscreen"===e.renderPass)&&r.isLayerDraped()){if("offscreen"===e.renderPass){var s=o.prerender;if(s){if(e.setCustomLayerDefaults(),a.setColorMode(e.colorModeForRenderPass()),"globe"===e.transform.projection.name){var l=e.transform.pointMerc;s.call(o,a.gl,e.transform.customLayerMatrix(),e.transform.getProjection(),e.transform.globeToMercatorMatrix(),i.globeToMercatorTransition(e.transform.zoom),[l.x,l.y],e.transform.pixelsPerMeterRatio)}else s.call(o,a.gl,e.transform.customLayerMatrix());a.setDirty(),e.setBaseState()}}else if("translucent"===e.renderPass){if(e.terrain&&e.terrain.renderingToTexture){var u=o.renderToTile;if(u){var c=n[0].canonical,h=new i.MercatorCoordinate(c.x+n[0].wrap*(1<<c.z),c.y,c.z);a.setDepthMode(i.DepthMode.disabled),a.setStencilMode(i.StencilMode.disabled),a.setColorMode(e.colorModeForRenderPass()),e.setCustomLayerDefaults(),u.call(o,a.gl,h),a.setDirty(),e.setBaseState()}return}e.setCustomLayerDefaults(),a.setColorMode(e.colorModeForRenderPass()),a.setStencilMode(i.StencilMode.disabled);var f="3d"===o.renderingMode?new i.DepthMode(e.context.gl.LEQUAL,i.DepthMode.ReadWrite,e.depthRangeFor3D):e.depthModeForSublayer(0,i.DepthMode.ReadOnly);if(a.setDepthMode(f),"globe"===e.transform.projection.name){var d=e.transform.pointMerc;o.render(a.gl,e.transform.customLayerMatrix(),e.transform.getProjection(),e.transform.globeToMercatorMatrix(),i.globeToMercatorTransition(e.transform.zoom),[d.x,d.y],e.transform.pixelsPerMeterRatio)}else o.render(a.gl,e.transform.customLayerMatrix());a.setDirty(),e.setBaseState(),a.bindFramebuffer.set(null)}}else i.warnOnce("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")}},Xr=function(){function t(e,r){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];h(this,t),this.context=new Ve(e,n),this.transform=r,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.setup(),this.numSublayers=i.SourceCache.maxUnderzooming+i.SourceCache.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new oi,this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={}}return d(t,[{key:"updateTerrain",value:function(e,t){var i=!!e&&!!e.terrain&&this.transform.projection.supportsTerrain;if(i||this._terrain&&this._terrain.enabled){this._terrain||(this._terrain=new qi(this,e));var r=this._terrain;this.transform.elevation=i?r:null,r.update(e,this.transform,t)}}},{key:"_updateFog",value:function(e){var t=e.fog;if(!t||"globe"===this.transform.projection.name||t.getOpacity(this.transform.pitch)<1||t.properties.get("horizon-blend")<.03)this.transform.fogCullDistSq=null;else{var i=a(t.getFovAdjustedRange(this.transform._fov),2),r=i[0],n=i[1];if(r>n)this.transform.fogCullDistSq=null;else{var o=r+.78*(n-r);this.transform.fogCullDistSq=o*o}}}},{key:"terrain",get:function(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled?this._terrain:null}},{key:"resize",value:function(e,t){if(this.width=e*i.exported.devicePixelRatio,this.height=t*i.exported.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style){var r,n=l(this.style.order);try{for(n.s();!(r=n.n()).done;){var a=r.value;this.style._layers[a].resize()}}catch(o){n.e(o)}finally{n.f()}}}},{key:"setup",value:function(){var e=this.context,t=new i.StructArrayLayout2i4;t.emplaceBack(0,0),t.emplaceBack(i.EXTENT,0),t.emplaceBack(0,i.EXTENT),t.emplaceBack(i.EXTENT,i.EXTENT),this.tileExtentBuffer=e.createVertexBuffer(t,i.posAttributes.members),this.tileExtentSegments=i.SegmentVector.simpleSegment(0,0,4,2);var r=new i.StructArrayLayout2i4;r.emplaceBack(0,0),r.emplaceBack(i.EXTENT,0),r.emplaceBack(0,i.EXTENT),r.emplaceBack(i.EXTENT,i.EXTENT),this.debugBuffer=e.createVertexBuffer(r,i.posAttributes.members),this.debugSegments=i.SegmentVector.simpleSegment(0,0,4,5);var n=new i.StructArrayLayout2i4;n.emplaceBack(-1,-1),n.emplaceBack(1,-1),n.emplaceBack(-1,1),n.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(n,i.posAttributes.members),this.viewportSegments=i.SegmentVector.simpleSegment(0,0,4,2);var a=new i.StructArrayLayout4i8;a.emplaceBack(0,0,0,0),a.emplaceBack(i.EXTENT,0,i.EXTENT,0),a.emplaceBack(0,i.EXTENT,0,i.EXTENT),a.emplaceBack(i.EXTENT,i.EXTENT,i.EXTENT,i.EXTENT),this.mercatorBoundsBuffer=e.createVertexBuffer(a,i.boundsAttributes.members),this.mercatorBoundsSegments=i.SegmentVector.simpleSegment(0,0,4,2);var o=new i.StructArrayLayout3ui6;o.emplaceBack(0,1,2),o.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(o);for(var s=new i.StructArrayLayout1ui2,l=0,u=[0,1,3,2,0];l<u.length;l++){var c=u[l];s.emplaceBack(c)}this.debugIndexBuffer=e.createIndexBuffer(s),this.emptyTexture=new i.Texture(e,new i.RGBAImage({width:1,height:1},Uint8Array.of(0,0,0,0)),e.gl.RGBA),this.identityMat=i.create();var h=this.context.gl;this.stencilClearMode=new i.StencilMode({func:h.ALWAYS,mask:0},0,255,h.ZERO,h.ZERO,h.ZERO),this.loadTimeStamps.push(i.window.performance.now()),this.atmosphereBuffer=new qr(this.context)}},{key:"getMercatorTileBoundsBuffers",value:function(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}},{key:"getTileBoundsBuffers",value:function(e){return e._makeTileBoundsBuffers(this.context,this.transform.projection),e._tileBoundsBuffer?{tileBoundsBuffer:e._tileBoundsBuffer,tileBoundsIndexBuffer:e._tileBoundsIndexBuffer,tileBoundsSegments:e._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}},{key:"clearStencil",value:function(){var e=this.context,t=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.useProgram("clippingMask").draw(e,t.TRIANGLES,i.DepthMode.disabled,this.stencilClearMode,i.ColorMode.disabled,i.CullFaceMode.disabled,Vi(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}},{key:"resetStencilClippingMasks",value:function(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}},{key:"_renderTileClippingMasks",value:function(e,t,r){if(t&&this.currentStencilSource!==t.id&&e.isTileClipped()&&r&&0!==r.length){if(this._tileClippingMaskIDs&&!this.terrain){var n,a=!1,o=l(r);try{for(o.s();!(n=o.n()).done;){var s=n.value;if(void 0===this._tileClippingMaskIDs[s.key]){a=!0;break}}}catch(b){o.e(b)}finally{o.f()}if(!a)return}this.currentStencilSource=t.id;var u=this.context,c=u.gl;this.nextStencilID+r.length>256&&this.clearStencil(),u.setColorMode(i.ColorMode.disabled),u.setDepthMode(i.DepthMode.disabled);var h=this.useProgram("clippingMask");this._tileClippingMaskIDs={};var f,d=l(r);try{for(d.s();!(f=d.n()).done;){var p=f.value,m=t.getTile(p),v=this._tileClippingMaskIDs[p.key]=this.nextStencilID++,y=this.getTileBoundsBuffers(m),_=y.tileBoundsBuffer,g=y.tileBoundsIndexBuffer,x=y.tileBoundsSegments;h.draw(u,c.TRIANGLES,i.DepthMode.disabled,new i.StencilMode({func:c.ALWAYS,mask:0}
1,v,255,c.KEEP,c.KEEP,c.REPLACE),i.ColorMode.disabled,i.CullFaceMode.disabled,Vi(p.projMatrix),"$clipping",_,g,x)}}catch(b){d.e(b)}finally{d.f()}}}},{key:"stencilModeFor3D",value:function(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();var e=this.nextStencilID++,t=this.context.gl;return new i.StencilMode({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}},{key:"stencilModeForClipping",value:function(e){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(e);var t=this.context.gl;return new i.StencilMode({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}},{key:"stencilConfigForOverlap",value:function(t){var r=this.context.gl,n=t.sort(function(e,t){return t.overscaledZ-e.overscaledZ}),a=n[n.length-1].overscaledZ,o=n[0].overscaledZ-a+1;if(o>1){this.currentStencilSource=void 0,this.nextStencilID+o>256&&this.clearStencil();for(var s={},l=0;l<o;l++)s[l+a]=new i.StencilMode({func:r.GEQUAL,mask:255},l+this.nextStencilID,255,r.KEEP,r.KEEP,r.REPLACE);return this.nextStencilID+=o,[s,n]}return[e({},a,i.StencilMode.disabled),n]}},{key:"colorModeForRenderPass",value:function(){var e=this.context.gl;if(this._showOverdrawInspector){var t=1/8;return new i.ColorMode([e.CONSTANT_COLOR,e.ONE],new i.Color(t,t,t,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?i.ColorMode.unblended:i.ColorMode.alphaBlended}},{key:"depthModeForSublayer",value:function(e,t,r){if(!this.opaquePassEnabledForLayer())return i.DepthMode.disabled;var n=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new i.DepthMode(r||this.context.gl.LEQUAL,t,[n,n])}},{key:"opaquePassEnabledForLayer",value:function(){return this.currentLayer<this.opaquePassCutoff}},{key:"render",value:function(e,t){var r=this;this.style=e,this.options=t,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(i.exported.now()),this.imageManager.beginFrame();var n=this.style.order,a=this.style._sourceCaches;for(var o in a){var s=a[o];s.used&&s.prepare(this.context)}var u={},c={},h={};for(var f in a){var d=a[f];u[f]=d.getVisibleCoordinates(),c[f]=u[f].slice().reverse(),h[f]=d.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(var p=0;p<n.length;p++)if(this.style._layers[n[p]].is3D()){this.opaquePassCutoff=p;break}if(this.terrain&&(this.terrain.updateTileBinding(h),this.opaquePassCutoff=0),"globe"!==this.transform.projection.name||this.globeSharedBuffers||(this.globeSharedBuffers=new i.GlobeSharedBuffers(this.context)),i.isMapAuthenticated(this.context.gl)){this.renderPass="offscreen";var m,v=l(n);try{for(v.s();!(m=v.n()).done;){var y=m.value,_=this.style._layers[y],g=e._getLayerSourceCache(_);if(_.hasOffscreenPass()&&!_.isHidden(this.transform.zoom)){var x=g?c[g.id]:void 0;("custom"===_.type||_.isSky()||x&&x.length)&&this.renderLayer(this,g,_,x)}}}catch(z){v.e(z)}finally{v.f()}this.depthRangeFor3D=[0,1-(e.order.length+2)*this.numSublayers*this.depthEpsilon];var b=this.terrain;if(b&&(this.style.hasSymbolLayers()||this.style.hasCircleLayers())&&b.drawDepth(),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]),this.context.clear({color:t.showOverdrawInspector?i.Color.black:i.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=t.showOverdrawInspector,this.renderPass="opaque",!this.terrain)for(this.currentLayer=n.length-1;this.currentLayer>=0;this.currentLayer--){var w=this.style._layers[n[this.currentLayer]],k=e._getLayerSourceCache(w);if(!w.isSky()){var T=k?c[k.id]:void 0;this._renderTileClippingMasks(w,k,T),this.renderLayer(this,k,w,T)}}if(this.style.fog&&this.transform.projection.supportsFog&&function(e,t){var r=e.context,n=r.gl,a=e.transform,o=new i.DepthMode(n.LEQUAL,i.DepthMode.ReadOnly,[0,1]),s=e.useProgram("globeAtmosphere",null,"globe"===a.projection.name?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"]),l=i.globeToMercatorTransition(a.zoom),u=t.properties.get("color").toArray01(),c=t.properties.get("high-color").toArray01(),h=t.properties.get("space-color").toArray01PremultipliedAlpha(),f=i.identity$1([]);i.rotateY$1(f,f,-i.degToRad(a._center.lng)),i.rotateX$1(f,f,i.degToRad(a._center.lat)),i.rotateZ$1(f,f,a.angle),i.rotateX$1(f,f,-a._pitch);var d=i.fromQuat(new Float32Array(16),f),p=i.mapValue(t.properties.get("star-intensity"),0,1,0,.25),m=i.mapValue(t.properties.get("horizon-blend"),0,1,5e-4,.25),v=i.globeUseCustomAntiAliasing(e,r,a)&&5e-4===m?a.worldSize/(2*Math.PI*1.025)-1:a.globeRadius,y=e.frameCounter/1e3%1,_=i.length(a.globeCenterInViewSpace),g=Math.sqrt(Math.pow(_,2)-Math.pow(v,2)),x=Math.acos(g/_),b={u_frustum_tl:a.frustumCorners.TL,u_frustum_tr:a.frustumCorners.TR,u_frustum_br:a.frustumCorners.BR,u_frustum_bl:a.frustumCorners.BL,u_horizon:a.frustumCorners.horizon,u_transition:l,u_fadeout_range:m,u_color:u,u_high_color:c,u_space_color:h,u_star_intensity:p,u_star_size:5*i.exported.devicePixelRatio,u_star_density:0,u_temporal_offset:y,u_horizon_angle:x,u_rotation_matrix:d};e.prepareDrawProgram(r,s);var w=e.atmosphereBuffer;w&&s.draw(r,n.TRIANGLES,o,i.StencilMode.disabled,i.ColorMode.alphaBlended,i.CullFaceMode.backCW,b,"skybox",w.vertexBuffer,w.indexBuffer,w.segments)}(this,this.style.fog),this.renderPass="sky",(i.globeToMercatorTransition(this.transform.zoom)>0||"globe"!==this.transform.projection.name)&&this.transform.isH
1orizonVisible())for(this.currentLayer=0;this.currentLayer<n.length;this.currentLayer++){var E=this.style._layers[n[this.currentLayer]],M=e._getLayerSourceCache(E);E.isSky()&&this.renderLayer(this,M,E,M?c[M.id]:void 0)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<n.length;){var S=this.style._layers[n[this.currentLayer]],I=e._getLayerSourceCache(S);if(S.isSky())++this.currentLayer;else if(this.terrain&&this.style.isLayerDraped(S)){if(S.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer)}else{var C=I?("symbol"===S.type?h:c)[I.id]:void 0;this._renderTileClippingMasks(S,I,I?u[I.id]:void 0),this.renderLayer(this,I,S,C),++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){var A=null;i.values(this.style._layers).forEach(function(t){var i=e._getLayerSourceCache(t);i&&!t.isHidden(r.transform.zoom)&&(!A||A.getSource().maxzoom<i.getSource().maxzoom)&&(A=i)}),A&&this.options.showTileBoundaries&&Wr.debug(this,A,A.getVisibleCoordinates())}this.options.showPadding&&function(e){var t=e.transform.padding;Or(e,e.transform.height-(t.top||0),3,zr),Or(e,t.bottom||0,3,Pr),Fr(e,t.left||0,3,Dr),Fr(e,e.transform.width-(t.right||0),3,Lr);var i,r,n,a,o=e.transform.centerPoint;Ur(i=e,(r=o.x)-1,(n=e.transform.height-o.y)-10,2,20,a=Rr),Ur(i,r-10,n-1,20,2,a)}(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(i.window.performance.now()),this.saveC
1anvasCopy())}}},{key:"renderLayer",value:function(e,t,i,r){i.isHidden(this.transform.zoom)||("background"===i.type||"sky"===i.type||"custom"===i.type||r&&r.length)&&(this.id=i.id,this.gpuTimingStart(i),(!e.transform.projection.unsupportedLayers||!e.transform.projection.unsupportedLayers.includes(i.type)||e.terrain&&"custom"===i.type)&&Wr[i.type](e,t,i,r,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}},{key:"gpuTimingStart",value:function(e){if(this.options.gpuTiming){var t=this.context.extTimerQuery,i=this.gpuTimers[e.id];i||(i=this.gpuTimers[e.id]={calls:0,cpuTime:0,query:t.createQueryEXT()}),i.calls++,t.beginQueryEXT(t.TIME_ELAPSED_EXT,i.query)}}},{key:"gpuTimingDeferredRenderStart",value:function(){if(this.options.gpuTimingDeferredRender){var e=this.context.extTimerQuery,t=e.createQueryEXT();this.deferredRenderGpuTimeQueries.push(t),e.beginQueryEXT(e.TIME_ELAPSED_EXT,t)}}},{key:"gpuTimingDeferredRenderEnd",value:function(){if(this.options.gpuTimingDeferredRender){var e=this.context.extTimerQuery;e.endQueryEXT(e.TIME_ELAPSED_EXT)}}},{key:"gpuTimingEnd",value:function(){if(this.options.gpuTiming){var e=this.context.extTimerQuery;e.endQueryEXT(e.TIME_ELAPSED_EXT)}}},{key:"collectGpuTimers",value:function(){var e=this.gpuTimers;return this.gpuTimers={},e}},{key:"collectDeferredRenderGpuQueries",value:function(){var e=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],e}},{key:"queryGpuTimers",value:function(e){var t={};for(var i in e){var r=e[i],n=this.context.extTimerQuery,a=n.getQueryObjectEXT(r.query,n.QUERY_RESULT_EXT)/1e6;n.deleteQueryEXT(r.query),t[i]=a}return t}},{key:"queryGpuTimeDeferredRender",value:function(e){if(!this.options.gpuTimingDeferredRender)return 0;var t,i=this.context.extTimerQuery,r=0,n=l(e);try{for(n.s();!(t=n.n()).done;){var a=t.value;r+=i.getQueryObjectEXT(a,i.QUERY_RESULT_EXT)/1e6,i.deleteQueryEXT(a)}}catch(o){n.e(o)}finally{n.f()}return r}},{key:"translatePosMatrix",value:function(e,t,r,n,a){if(!r[0]&&!r[1])return e;var o=a?"map"===n?this.transform.angle:0:"viewport"===n?-this.transform.angle:0;if(o){var s=Math.sin(o),l=Math.cos(o);r=[r[0]*l-r[1]*s,r[0]*s+r[1]*l]}var u=[a?r[0]:W(t,r[0],this.transform.zoom),a?r[1]:W(t,r[1],this.transform.zoom),0],c=new Float32Array(16);return i.translate(c,e,u),c}},{key:"saveTileTexture",value:function(e){var t=this._tileTextures[e.size[0]];t?t.push(e):this._tileTextures[e.size[0]]=[e]}},{key:"getTileTexture",value:function(e){var t=this._tileTextures[e];return t&&t.length>0?t.pop():null}},{key:"isPatternMissing",value:function(e){return null===e||void 0!==e&&!this.imageManager.getPattern(e.toString())}},{key:"terrainRenderModeElevated",value:function(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture}},{key:"currentGlobalDefines",value:function(){var e=this.terrain&&this.terrain.renderingToTexture,t=this.terrain&&0===this.terrain.exaggeration(),i=this.style&&this.style.fog,r=[];return this.terrainRenderModeElevated()&&r.push("TERRAIN"),"globe"===this.transform.projection.name&&r.push("GLOBE"),t&&r.push("ZERO_EXAGGERATION"),i&&!e&&0!==i.getOpacity(this.transform.pitch)&&r.push("FOG"),e&&r.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&r.push("OVERDRAW_INSPECTOR"),r}},{key:"useProgram",value:function(e,t,i){this.cache=this.cache||{};var r=i||[],n=this.currentGlobalDefines().concat(r),a=Wi.cacheKey(Ti[e],e,n,t);return this.cache[a]||(this.cache[a]=new Wi(this.context,e,Ti[e],t,xr[e],n)),this.cache[a]}},{key:"setCustomLayerDefaults",value:function(){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()}},{key:"setBaseState",value:function(){var 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)}},{key:"initDebugOverlayCanvas",value:function(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=i.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new i.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}},{key:"destroy",value:function(){this._terrain&&this._terrain.destroy(),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.atmosphereBuffer&&this.atmosphereBuffer.destroy()}},{key:"prepareDrawTile",value:function(){this.terrain&&this.terrain.prepareDrawTile()}},{key:"prepareDrawProgram",value:function(e,t,r){if(!this.terrain||!this.terrain.renderingToTexture){var n=this.style.fog;if(n){var a=n.getOpacity(this.transform.pitch),o=function(e,t,r,n,a,o,s,l,u,c,h){var f=e.transform,d=t.properties.get("color").toArray01();d[3]=n;var p=e.frameCounter/1e3%1;return{u_fog_matrix:r?f.calculateFogTileMatrix(r):e.identityMat,u_fog_range:t.getFovAdjustedRange(f._fov),u_fog_color:d,u_fog_horizon_blend:t.properties.get("horizon-blend"),u_fog_temporal_offset:p,u_frustum_tl:a,u_frustum_tr:o,u_frustum_br:s,u_frustum_bl:l,u_globe_pos:u,u_globe_radius:c,u_viewport:h,u_globe_transition:i.globeToMercatorTransition(f.zoom),u_is_globe:+("globe"===f.projection.name)}}(this,n,r,a,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*i.exported.devicePixelRatio,this.transform.height*i.exported.devicePixelRatio]);t.setFogUniformValues(e,o)}}}},{key:"setTileLoadedFlag",value:function(e){this.tileLoaded=e}},{key:"saveCanvasCopy",value:function(){var e=this.canvasCopy();e&&(this.frameCopies.push(e),this.tileLoaded=!1)}},{key:"canvasCopy",value:function(){var e=this.context.gl,t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA,0,0,e.drawingBufferWidth,e.drawingBufferHeight,0),t}},{key:"getCanvasCopiesAndTimestamps",value:function(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}},{key:"averageElevationNeedsEasing",value:function(){if(!this.transform._elevation)return!1;var e=this.style&&this.style.fog;return!!e&&0!==e.getOpacity(this.transform.pitch)}}
1,{key:"getBackgroundTiles",value:function(){var e,t=this._backgroundTiles,r=this._backgroundTiles={},n=l(this.transform.coveringTiles({tileSize:512}));try{for(n.s();!(e=n.n()).done;){var a=e.value;r[a.key]=t[a.key]||new i.Tile(a,512,this.transform.tileZoom,this)}}catch(o){n.e(o)}finally{n.f()}return r}},{key:"clearBackgroundTiles",value:function(){this._backgroundTiles={}}}]),t}(),Hr=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(h(this,e),isNaN(t)||t<0||isNaN(i)||i<0||isNaN(r)||r<0||isNaN(n)||n<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=i,this.left=r,this.right=n}return d(e,[{key:"interpolate",value:function(e,t,r){return null!=t.top&&null!=e.top&&(this.top=i.number(e.top,t.top,r)),null!=t.bottom&&null!=e.bottom&&(this.bottom=i.number(e.bottom,t.bottom,r)),null!=t.left&&null!=e.left&&(this.left=i.number(e.left,t.left,r)),null!=t.right&&null!=e.right&&(this.right=i.number(e.right,t.right,r)),this}},{key:"getCenter",value:function(e,t){var r=i.clamp((this.left+e-this.right)/2,0,e),n=i.clamp((this.top+t-this.bottom)/2,0,t);return new i.pointGeometry(r,n)}},{key:"equals",value:function(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}},{key:"clone",value:function(){return new e(this.top,this.bottom,this.left,this.right)}},{key:"toJSON",value:function(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}]),e}();function Yr(e,t){var r=i.getColumn(e,3);i.fromQuat(e,t),i.setColumn(e,3,r)}function Kr(e,t){var r=i.identity$1([]);return i.rotateZ$1(r,r,-t),i.rotateX$1(r,r,-e),r}function Jr(e,t){var r=[e[0],e[1],0],n=[t[0],t[1],0];if(i.length(r)>=1e-15){var a=i.normalize([],r);i.scale$2(n,a,i.dot(n,a)),t[0]=n[0],t[1]=n[1]}var o=i.cross([],t,e);if(i.len(o)<1e-15)return null;var s=Math.atan2(-o[1],o[0]);return Kr(Math.atan2(Math.sqrt(e[0]*e[0]+e[1]*e[1]),-e[2]),s)}var $r=function(){function e(t,i){h(this,e),this.position=t,this.orientation=i}return d(e,[{key:"position",get:function(){return this._position},set:function(e){if(e){var t=e instanceof i.MercatorCoordinate?e:new i.MercatorCoordinate(e[0],e[1],e[2]);
1this._renderWorldCopies&&(t.x=i.wrap(t.x,0,1)),this._position=t}else this._position=null}},{key:"lookAtPoint",value:function(e,t){if(this.orientation=null,this.position){var r=this.position,n=this._elevation?this._elevation.getAtPointOrZero(i.MercatorCoordinate.fromLngLat(e)):0,a=i.MercatorCoordinate.fromLngLat(e,n),o=[a.x-r.x,a.y-r.y,a.z-r.z];t||(t=[0,0,1]),t[2]=Math.abs(t[2]),this.orientation=Jr(o,t)}}},{key:"setPitchBearing",value:function(e,t){this.orientation=Kr(i.degToRad(e),i.degToRad(-t))}}]),e}(),Qr=function(){function e(t,r){h(this,e),this._transform=i.identity([]),this.orientation=r,this.position=t}return d(e,[{key:"mercatorPosition",get:function(){var e=this.position;return new i.MercatorCoordinate(e[0],e[1],e[2])}},{key:"position",get:function(){var e=i.getColumn(this._transform,3);return[e[0],e[1],e[2]]},set:function(e){var t;e&&i.setColumn(this._transform,3,[(t=e)[0],t[1],t[2],1])}},{key:"orientation",get:function(){return this._orientation},set:function(e){this._orientation=e||i.identity$1([]),e&&Yr(this._transform,this._orientation)}},{key:"getPitchBearing",value:function(){var e=this.forward(),t=this.right();return{bearing:Math.atan2(-t[1],t[0]),pitch:Math.atan2(Math.sqrt(e[0]*e[0]+e[1]*e[1]),-e[2])}}},{key:"setPitchBearing",value:function(e,t){this._orientation=Kr(e,t),Yr(this._transform,this._orientation)}},{key:"forward",value:function(){var e=i.getColumn(this._transform,2);return[-e[0],-e[1],-e[2]]}},{key:"up",value:function(){var e=i.getColumn(this._transform,1);return[-e[0],-e[1],-e[2]]}},{key:"right",value:function(){var e=i.getColumn(this._transform,0);return[e[0],e[1],e[2]]}},{key:"getCameraToWorld",value:function(e,t){var r=new Float64Array(16);return i.invert(r,this.getWorldToCamera(e,t)),r}},{key:"getWorldToCameraPosition",value:function(e,t,r){var n=this.position;i.scale$2(n,n,-e);var a=new Float64Array(16);return i.fromScaling(a,[r,r,r]),i.translate(a,a,n),a[10]*=t,a}},{key:"getWorldToCamera",value:function(e,t){var r=new Float64Array(16),n=new Float64Array(4),a=this.position;return i.conjugate(n,this._orientation),i.scale$2(a,a,-e),i.fromQuat(r,n),i.translate(r,r,a),r[1]*=-1,r[5]*=-1,r[9]*=-1,r[13]*=-1,r[8]*=t,r[9]*=t,r[10]*=t,r[11]*=t,r}},{key:"getCameraToClipPerspective",value:function(e,t,r,n){var a=new Float64Array(16);return i.perspective(a,e,t,r,n),a}},{key:"getDistanceToElevation",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=0===e?0:i.mercatorZfromAltitude(e,t?i.latFromMercatorY(this.position[1]):this.position[1]),n=this.forward();return(r-this.position[2])/n[2]}},{key:"clone",value:function(){return new e(r(this.position),r(this.orientation))}}]),e}();function en(e,t){var r=rn(e.projection,e.zoom,e.width,e.height),n=function(e,t,r,n,a){var o=new i.LngLat(r.lng-180*nn,r.lat),s=new i.LngLat(r.lng+180*nn,r.lat),l=e.project(o.lng,o.lat),u=e.project(s.lng,s.lat),c=-Math.atan2(u.y-l.y,u.x-l.x),h=i.MercatorCoordinate.fromLngLat(r);h.y=i.clamp(h.y,-.999975,.999975);var f=h.toLngLat(),d=e.project(f.lng,f.lat),p=i.MercatorCoordinate.fromLngLat(f);p.x+=nn;var m=p.toLngLat(),v=e.project(m.lng,m.lat),y=on(v.x-d.x,v.y-d.y,c),_=i.MercatorCoordinate.fromLngLat(f);_.y+=nn;var g=_.toLngLat(),x=e.project(g.lng,g.lat),b=on(x.x-d.x,x.y-d.y,c),w=Math.abs(y.x)/Math.abs(b.y),k=i.identity([]);i.rotateZ(k,k,-c*(1-(a?0:n)));var T=i.identity([]);return i.scale(T,T,[1,1-(1-w)*n,1]),T[4]=-b.x/b.y*n,i.rotateZ(T,T,c),i.multiply(T,k,T),T}(e.projection,0,e.center,r,t),a=tn(e);return i.scale(n,n,[a,a,1]),n}function tn(e){var t=e.projection,r=rn(e.projection,e.zoom,e.width,e.height),n=an(t,e.center),a=an(t,i.LngLat.convert(t.center));return Math.pow(2,n*r+(1-r)*a)}function rn(e,t,r,n){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=e.range;if(!o)return 0;var s=Math.min(a,Math.max(r,n)),l=Math.log(s/1024)/Math.LN2;return i.smoothstep(o[0]+l,o[1]+l,t)}var nn=1/4e4;function an(e,t){var r=i.clamp(t.lat,-i.MAX_MERCATOR_LATITUDE,i.MAX_MERCATOR_LATITUDE),n=new i.LngLat(t.lng-180*nn,r),a=new i.LngLat(t.lng+180*nn,r),o=e.project(n.lng,r),s=e.project(a.lng,r),l=i.MercatorCoordinate.fromLngLat(n),u=i.MercatorCoordinate.fromLngLat(a),c=s.x-o.x,h=s.y-o.y,f=u.x-l.x,d=u.y-l.y,p=Math.sqrt((f*f+
1d*d)/(c*c+h*h));return Math.log(p)/Math.LN2}function on(e,t,i){var r=Math.cos(i),n=Math.sin(i);return{x:e*r-t*n,y:e*n+t*r}}var sn=function(){function e(t,r,n,a,o,s,l){h(this,e),this.tileSize=512,this._renderWorldCopies=void 0===o||o,this._minZoom=t||0,this._maxZoom=r||22,this._minPitch=null==n?0:n,this._maxPitch=null==a?60:a,this.setProjection(s),this.setMaxBounds(l),this.width=0,this.height=0,this._center=new i.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new Hr,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._distanceTileDataCache={},this._camera=new Qr,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._horizonShift=.1}return d(e,[{key:"clone",value:function(){var t=new e(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection());return t._elevation=this._elevation,t._centerAltitude=this._centerAltitude,t._centerAltitudeValidForE
1xaggeration=this._centerAltitudeValidForExaggeration,t.tileSize=this.tileSize,t.mercatorFromTransition=this.mercatorFromTransition,t.width=this.width,t.height=this.height,t.cameraElevationReference=this.cameraElevationReference,t._center=this._center,t._setZoom(this.zoom),t._seaLevelZoom=this._seaLevelZoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._nearZ=this._nearZ,t._farZ=this._farZ,t._averageElevation=this._averageElevation,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._camera=this._camera.clone(),t._calcMatrices(),t.freezeTileCoverage=this.freezeTileCoverage,t.frustumCorners=this.frustumCorners,t}},{key:"elevation",get:function(){return this._elevation},set:function(e){this._elevation!==e&&(this._elevation=e,this._updateCameraOnTerrain(),this._calcMatrices())}},{key:"updateElevation",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForExaggeration;(null==this._seaLevelZoom||i)&&this._updateCameraOnTerrain(),(e||i)&&this._constrainCamera(t),this._calcMatrices()}},{key:"getProjection",value:function(){return i.pick(this.projection,["name","center","parallels"])}},{key:"setProjection",value:function(e){this.projectionOptions=e||{name:"mercator"};var t=this.projection?this.getProjection():void 0;this.projection=i.getProjection(this.projectionOptions);var r=!n(t,this.getProjection());return r&&this._calcMatrices(),this.mercatorFromTransition=!1,r}},{key:"setMercatorFromTransition",value:function(){var e=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=i.getProjection({name:"mercator"});var t=e!==this.projection.name;return t&&this._calcMatrices(),t}},{key:"minZoom",get:function(){return this._minZoom},set:function(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}},{key:"maxZoom",get:function(){return this._maxZoom},set:function(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}},{key:"minPitch",get:function(){return this._minPitch},set:function(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}},{key:"maxPitch",get:function(){return this._maxPitch},set:function(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}},{key:"renderWorldCopies",get:function(){return this._renderWorldCopies&&!0===this.projection.supportsWorldCopies},set:function(e){void 0===e?e=!0:null===e&&(e=!1),this._renderWorldCopies=e}},{key:"worldSize",get:function(){return this.tileSize*this.scale}},{key:"cameraWorldSizeForFog",get:function(){var e=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(e))}},{key:"cameraWorldSize",get:function(){var e=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(e))}},{key:"pixelsPerMeter",get:function(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}},{key:"cameraPixelsPerMeter",get:function(){return i.mercatorZfromAltitude(this.center.lat,this.cameraWorldSizeForFog)}},{key:"centerOffset",get:function(){return this.centerPoint._sub(this.size._div(2))}},{key:"size",get:function(){return new i.pointGeometry(this.width,this.height)}},{key:"bearing",get:function(){return i.wrap(this.rotation,-180,180)},set:function(e){this.rotation=e}},{key:"rotation",get:function(){return-this.angle/Math.PI*180},set:function(e){var t,r,n,a,o,s,l,u,c,h,f=-e*Math.PI/180;this.angle!==f&&(this._unmodified=!1,this.angle=f,this._calcMatrices(),this.rotationMatrix=(t=new i.ARRAY_TYPE(4),i.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t),r=this.rotationMatrix,a=this.angle,o=(n=this.rotationMatrix)[0],s=n[1],l=n[2],u=n[3],c=Math.sin(a),h=Math.cos(a),r[0]=o*h+l*c,r[1]=s*h+u*c,r[2]=o*-c+l*h,r[3]=s*-c+u*h)}},{key:"pitch",get:function(){return this._pitch/Math.PI*180},set:function(e){var t=i.clamp(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==t&&(this._unmodified=!1,this._pitch=t,this._calcMatrices())}},{key:"aspect",get:function(){return this.width/this.height}},{key:"fov",get:function(){return this._fov/Math.PI*180},set:function(e){e=Math.max(.01,Math.min(60,e)),this._fov!==e&&(this._unmodified=!1,this._fov=i.degToRad(e),this._calcMatrices())}},{key:"fovX",get:function(){return this._fov}},{key:"fovY",get:function(){var e=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/e)}},{key:"averageElevation",get:function(){return this._averageElevation},set:function(e){this._averageElevation=e,this._calcFogMatrices(),this._distanceTileDataCache={}}},{key:"zoom",get:function(){return this._zoom},set:function(e){var t=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==t&&(this._unmodified=!1,this._setZoom(t),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}},{key:"_setZoom",value:function(e){this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom}},{key:"_updateCameraOnTerrain",value:function(){if(!this._elevation||!this._elevation.isDataAvailableAtPoint(this.locationCoordinate(this.center)))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForE
1xaggeration=void 0);var e=this._elevation;this._centerAltitude=e.getAtPointOrZero(this.locationCoordinate(this.center)),this._centerAltitudeValidForExaggeration=e.exaggeration(),this._updateSeaLevelZoom()}},{key:"_updateSeaLevelZoom",value:function(){void 0!==this._centerAltitudeValidForExaggeration&&(this._seaLevelZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize))}},{key:"sampleAverageElevation",value:function(){if(!this._elevation)return 0;for(var e=this._elevation,t=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],r=this.horizonLineFromTop(),n=0,a=0,o=0;o<t.length;o++){var s=new i.pointGeometry(t[o][0]*this.width,r+t[o][1]*(this.height-r)),l=e.pointCoordinate(s);if(l){var u=1/Math.hypot(l[0]-this._camera.position[0],l[1]-this._camera.position[1]);n+=l[3]*u,a+=u}}return 0===a?NaN:n/a}},{key:"center",get:function(){return this._center},set:function(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())}},{key:"_updateZoomFromElevation",value:function(){if(null!=this._seaLevelZoom&&this._elevation){var e=this._seaLevelZoom,t=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),i=this.pixelsPerMeter/this.worldSize*t,r=this._mercatorZfromZoom(e),n=this._mercatorZfromZoom(this._maxZoom),a=Math.max(r-i,n);this._setZoom(this._zoomFromMercatorZ(a))}}},{key:"padding",get:function(){return this._edgeInsets.toJSON()},set:function(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}},{key:"computeZoomRelativeTo",value:function(e){var t,r=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,e.toAltitude()));t=e.z<this._camera.position[2]?[r.x,r.y,r.z]:[e.x,e.y,e.z];var n=i.length(i.sub([],this._camera.position,t));return i.clamp(this._zoomFromMercatorZ(n),this._minZoom,this._maxZoom)}},{key:"setFreeCameraOptions",value:function(e){if(this.height&&(e.position||e.orientation)){this._updateCameraState();var t=!1;if(e.orientation&&!i.exactEquals(e.orientation,this._camera.orientation)&&(t=this._setCameraOrientation(e.orientation)),e.position){var r=[e.position.x,e.position.y,e.position.z];i.exactEquals$1(r,this._camera.position)||(this._setCameraPosition(r),t=!0)}t&&(this._updateStateFromCamera(),this.recenterOnTerrain())}}},{key:"getFreeCameraOptions",value:function(){this._updateCameraState();var e=this._camera.position,t=new $r;return t.position=new i.MercatorCoordinate(e[0],e[1],e[2]),t.orientation=this._camera.orientation,t._elevation=this.elevation,t._renderWorldCopies=this.renderWorldCopies,t}},{key:"_setCameraOrientation",value:function(e){if(!i.length$1(e))return!1;i.normalize$1(e,e);var t=i.transformQuat([],[0,0,-1],e),r=i.transformQuat([],[0,-1,0],e);if(r[2]<0)return!1;var n=Jr(t,r);return!!n&&(this._camera.orientation=n,!0)}},{key:"_setCameraPosition",value:function(e){var t=this.zoomScale(this.minZoom)*this.tileSize,r=this.zoomScale(this.maxZoom)*this.tileSize,n=this.cameraToCenterDistance;e[2]=i.clamp(e[2],n/r,n/t),this._camera.position=e}},{key:"centerPoint",get:function(){return this._edgeInsets.getCenter(this.width,this.height)}},{key:"fovAboveCenter",get:function(){return this._fov*(.5+this.centerOffset.y/this.height)}},{key:"isPaddingEqual",value:function(e){return this._edgeInsets.equals(e)}},{key:"interpolatePadding",value:function(e,t,i){this._unmodified=!1,this._edgeInsets.interpolate(e,t,i),this._constrain(),this._calcMatrices()}},{key:"coveringZoomLevel",value:function(e){var t=(e.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/e.tileSize));return Math.max(0,t)}},{key:"getVisibleUnwrappedCoordinates",value:function(e){var t=[new i.UnwrappedTileID(0,e)];if(this.renderWorldCopies)for(var r=this.pointCoordinate(new i.pointGeometry(0,0)),n=this.pointCoordinate(new i.pointGeometry(this.width,0)),a=this.pointCoordinate(new i.pointGeometry(this.width,this.height)),o=this.pointCoordinate(new i.pointGeometry(0,this.height)),s=Math.floor(Math.min(r.x,n.x,a.x,o.x)),l=Math.floor(Math.max(r.x,n.x,a.x,o.x)),u=s-1;u<=l+1;u++)0!==u&&t.push(new i.UnwrappedTileID(u,e));return t}},{key:"coveringTiles",value:function(e){var t=this,r=this.coveringZoomLevel(e),n=r,a=this.elevation&&!e.isTerrainDEM,o="mercator"===this.projection.name;if(void 0!==e.minzoom&&r<e.minzoom)return[];void 0!==e.maxzoom&&r>e.maxzoom&&(r=e.maxzoom);var s=this.locationCoordinate(this.center),l=this.center.lat,u=1<<r,c=[u*s.x,u*s.y,0],h="globe"===this.projection.name,f=!h,d=i.Frustum.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,r,f),p=h?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),m=u*i.mercatorZfromAltitude(1,this.center.lat),v=this._camera.position[2]/i.mercatorZfromAltitude(1,this.center.lat),y=[u*p.x,u*p.y,v*(f?1:m)],_=this.cameraToCenterDistance/e.tileSize*(e.roundZoom?1:.502),g=this.pitch<=60&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace?r:0,x=e.isTerrainDEM&&this._elevation?1e4*this._elevation.exaggeration():this._centerAltitude,b=e.isTerrainDEM?-x:this._elevation?this._elevation.getMinElevationBelowMSL():0,w=this.projection.isReprojectedInTileSpace?tn(this):1,k=function(e){var r=x,n=b;return{aabb:i.tileAABB(t,u,0,0,0,e,n,r,t.projection),zoom:0,x:0,y:0,minZ:n,maxZ:r,wrap:e,fullyVisible:!1}},T=[],E=[],M=r,S=e.reparseOverscaled?n:r,I=function(e){return e*e},C=I((v-this._centerAltitude)*m),A=function(e){if(t._elevation&&e.tileID&&o){var i=t._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=z(e),e.shouldSplit||(r.min[2]=r.max[2]=r.center[2]=t._centerAltitude))}},z=function(e){if(e.zoom<g)return!0;
1if(e.zoom===M)return!1;if(null!=e.shouldSplit)return e.shouldSplit;var r=e.aabb.distanceX(y),o=e.aabb.distanceY(y),s=C,u=1;if(h){s=I(e.aabb.distanceZ(y));var c=Math.pow(2,e.zoom),f=i.latFromMercatorY((e.y+1)/c),d=i.latFromMercatorY(e.y/c),p=Math.min(Math.max(l,f),d),v=i.circumferenceAtLatitude(p)/i.circumferenceAtLatitude(l);if(u=p===l?1/Math.max(1,t._mercatorScaleRatio-.3):Math.min(1,v/t._mercatorScaleRatio),t.zoom<=i.GLOBE_ZOOM_THRESHOLD_MIN&&e.zoom===M-1&&v>=.9)return!0}else if(a&&(s=I(e.aabb.distanceZ(y)*m)),t.projection.isReprojectedInTileSpace&&n<=5){var x=Math.pow(2,e.zoom),b=function(e){var r=1/4e4,n=new i.MercatorCoordinate(e.x+r,e.y,e.z),a=new i.MercatorCoordinate(e.x,e.y+r,e.z),o=e.toLngLat(),s=n.toLngLat(),l=a.toLngLat(),u=t.locationCoordinate(o),c=t.locationCoordinate(s),h=t.locationCoordinate(l),f=Math.hypot(c.x-u.x,c.y-u.y),d=Math.hypot(h.x-u.x,h.y-u.y);return Math.sqrt(f*d)*w/r}(new i.MercatorCoordinate((e.x+.5)/x,(e.y+.5)/x));u=b>.85?1:b}var k=r*r+o*o+s;return k<I((1<<M-e.zoom)*_*u*function(e,t){if(t*I(.707)<e)return 1;var i=Math.sqrt(t/e);return i/(1.4144271570014144+(Math.pow(1.1,i-1.4144271570014144+1)-1)/(1.1-1)-1)}(Math.max(s,C),k))};if(this.renderWorldCopies)for(var P=1;P<=3;P++)T.push(k(-P)),T.push(k(P));for(T.push(k(0));T.length>0;){var D=T.pop(),L=D.x,R=D.y,B=D.fullyVisible;if(!B){var O=D.aabb.intersects(d);if(0===O)continue;B=2===O}if(D.zoom!==M&&z(D))for(var F=0;F<4;F++){var U=(L<<1)+F%2,V=(R<<1)+(F>>1),j={aabb:o?D.aabb.quadrant(F):i.tileAABB(this,u,D.zoom+1,U,V,D.wrap,D.minZ,D.maxZ,this.projection),zoom:D.zoom+1,x:U,y:V,wrap:D.wrap,fullyVisible:B,tileID:void 0,shouldSplit:void 0,minZ:D.minZ,maxZ:D.maxZ};a&&!h&&(j.tileID=new i.OverscaledTileID(D.zoom+1===M?S:D.zoom+1,D.wrap,D.zoom+1,U,V),A(j)),T.push(j)}else{var N=D.zoom===M?S:D.zoom;if(e.minzoom&&e.minzoom>N)continue;var G=c[0]-(.5+L+(D.wrap<<D.zoom))*(1<<r-D.zoom),Z=c[1]-.5-R,q=D.tileID?D.tileID:new i.OverscaledTileID(N,D.wrap,D.zoom,L,R);E.push({tileID:q,distanceSq:G*G+Z*Z})}}if(this.fogCullDistSq){var W=this.fogCullDistSq,X=this.horizonLineFromTop();E=E.filter(function(r){var n=[0,0,0,1],a=[i.EXTENT,i.EXTENT,0,1],o=t.calculateFogTileMatrix(r.tileID.toUnwrapped());i.transformMat4$1(n,n,o),i.transformMat4$1(a,a,o);var s=i.getAABBPointSquareDist(n,a);if(0===s)return!0;var l=!1,u=t._elevation;if(u&&s>W&&0!==X){var c,h=t.calculateProjMatrix(r.tileID.toUnwrapped());e.isTerrainDEM||(c=u.getMinMaxForTile(r.tileID)),c||(c={min:b,max:x});var f=i.furthestTileCorner(t.rotation),d=[f[0]*i.EXTENT,f[1]*i.EXTENT,c.max];i.transformMat4(d,d,h),l=(1-d[1])*t.height*.5<X}return s<W||l})}return E.sort(function(e,t){return e.distanceSq-t.distanceSq}).map(function(e){return e.tileID})}},{key:"resize",value:function(e,t){this.width=e,this.height=t,this.pixelsToGLUnits=[2/e,-2/t],this._constrain(),this._calcMatrices()}},{key:"unmodified",get:function(){return this._unmodified}},{key:"zoomScale",value:function(e){return Math.pow(2,e)}},{key:"scaleZoom",value:function(e){return Math.log(e)/Math.LN2}},{key:"project",value:function(e){var t=i.clamp(e.lat,-i.MAX_MERCATOR_LATITUDE,i.MAX_MERCATOR_LATITUDE),r=this.projection.project(e.lng,t);return new i.pointGeometry(r.x*this.worldSize,r.y*this.worldSize)}},{key:"unproject",value:function(e){return this.projection.unproject(e.x/this.worldSize,e.y/this.worldSize)}},{key:"point",get:function(){return this.project(this.center)}},{key:"pointMerc",get:function(){return this.point._div(this.worldSize)}},{key:"pixelsPerMeterRatio",get:function(){return this.pixelsPerMeter/i.mercatorZfromAltitude(1,this.center.lat)/this.worldSize}},{key:"setLocationAtPoint",value:function(e,t){var r,n,a=this.centerPoint;if("globe"===this.projection.name){var o=this.worldSize;r=(t.x-a.x)/o,n=(t.y-a.y)/o}else{var s=this.pointCoordinate(t),l=this.pointCoordinate(a);r=s.x-l.x,n=s.y-l.y}var u=this.locationCoordinate(e);this.setLocation(new i.MercatorCoordinate(u.x-r,u.y-n))}},{key:"setLocation",value:function(e){this.center=this.coordinateLocation(e),this.projection.wrap&&(this.center=this.center.wrap())}},{key:"locationPoint",value:function(e){return this.projection.locationPoint(this,e)}},{key:"locationPoint3D",value:function(e){return this.projection.locationPoint(this,e,!0)}},{key:"pointLocation",value:function(e){return this.coordinateLocation(this.pointCoordinate(e))}},{key:"pointLocation3D",value:function(e){return this.coordinateLocation(this.pointCoordinate3D(e))}},{key:"locationCoordinate",value:function(e,t){var r=t?i.mercatorZfromAltitude(t,e.lat):void 0,n=this.projection.project(e.lng,e.lat);return new i.MercatorCoordinate(n.x,n.y,r)}},{key:"coordinateLocation",value:function(e){return this.projection.unproject(e.x,e.y)}},{key:"pointRayIntersection",value:function(e,t){var r=null!=t?t:this._centerAltitude,n=[e.x,e.y,0,1],a=[e.x,e.y,1,1];i.transformMat4$1(n,n,this.pixelMatrixInverse),i.transformMat4$1(a,a,this.pixelMatrixInverse);var o=a[3];i.scale$1(n,n,1/n[3]),i.scale$1(a,a,1/o);var s=n[2],l=a[2];return{p0:n,p1:a,t:s===l?0:(r-s)/(l-s)}}},{key:"screenPointToMercatorRay",value:function(e){var t=[e.x,e.y,0,1],r=[e.x,e.y,1,1];return i.transformMat4$1(t,t,this.pixelMatrixInverse),i.transformMat4$1(r,r,this.pixelMatrixInverse),i.scale$1(t,t,1/t[3]),i.scale$1(r,r,1/r[3]),t[2]=i.mercatorZfromAltitude(t[2],this._center.lat)*this.worldSize,r[2]=i.mercatorZfromAltitude(r[2],this._center.lat)*this.worldSize,i.scale$1(t,t,1/this.worldSize),i.scale$1(r,r,1/this.worldSize),new i.Ray([t[0],t[1],t[2]],i.normalize([],i.sub([],r,t)))}},{key:"rayIntersectionCoordinate",value:function(e){var t=e.p0,r=e.p1,n=e.t,a=i.mercatorZfromAltitude(t[2],this._center.lat),o=i.mercatorZfromAltitude(r[2],this._center.lat);return new i.MercatorCoordinate(i.number(t[0],r[0],n)/this.worldSize,i.number(t[1],r[1],n)/this.worldSize,i.number(a,o,n))}},{key:"pointCoordinate",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._centerAltitude;return this.projection.pointCoordinate(this,e.x,e.y,t)}},{key:"pointCoordinate3D",value:function(e){if(!this.elevation)return this.pointCoordinate(e);var t=this.projection.pointCoordinate3D(this,e.x,e.y);if(t)return new i.MercatorCoordinate(t[0],t[1],t[2]);var r=0,n=this.horizonLineFromTop();if(e.y>n)return this.pointCoordinate(e);for(var a=.02*n,o=e.clone(),s=0;s<10&&n-r>a;s++){o.y=i.number(r,n,.66);var l=this.projection.pointCoordinate3D(this,o.x,o.y);l?(n=o.y,t=l):r=o.y}return t?new i.MercatorCoordinate(t[0],t[1],t[2]):this.pointCoordinate(e)}},{key:"isPointAboveHorizon",value:function(e){return this.projection.isPointAboveHorizon(this,e)}},{key:"_coordinatePoint",value:function(e,t){var r=t&&this.elevation?this.elevation.getAtPointOrZero(e,this._centerAltitude):this._centerAltitude,n=[e.x*this.worldSize,e.y*this.worldSize,r+e.toAltitude(),1];return i.transformMat4$1(n,n,this.pixelMatrix),n[3]>
10?new i.pointGeometry(n[0]/n[3],n[1]/n[3]):new i.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE)}},{key:"_getBoundsNonRectangular",value:function(){var e=this,t=this._edgeInsets,r=t.top,n=t.left,o=this.height-this._edgeInsets.bottom,s=this.width-this._edgeInsets.right,l=this.pointLocation3D(new i.pointGeometry(n,r)),u=this.pointLocation3D(new i.pointGeometry(s,r)),c=this.pointLocation3D(new i.pointGeometry(s,o)),h=this.pointLocation3D(new i.pointGeometry(n,o)),f=Math.min(l.lng,u.lng,c.lng,h.lng),d=Math.max(l.lng,u.lng,c.lng,h.lng),p=Math.min(l.lat,u.lat,c.lat,h.lat),m=Math.max(l.lat,u.lat,c.lat,h.lat),v=Math.pow(2,-this.zoom)/16*270,y="globe"===this.projection.name?1:4,_=function t(r,n,a,o,s){var l=(r+a)/2,u=(n+o)/2,c=new i.pointGeometry(l,u),h=e.pointLocation3D(c),_=h.lng,g=h.lat,x=Math.max(0,f-_,p-g,_-d,g-m);f=Math.min(f,_),d=Math.max(d,_),p=Math.min(p,g),m=Math.max(m,g),(s<y||x>v)&&(t(r,n,l,u,s+1),t(l,u,a,o,s+1))};if(_(n,r,s,r,1),_(s,r,s,o,1),_(s,o,n,o,1),_(n,o,n,r,1),"globe"===this.projection.name){var g=a(i.polesInViewport(this),2),x=g[0],b=g[1];x?(m=90,d=180,f=-180):b&&(p=-90,d=180,f=-180)}return new i.LngLatBounds(new i.LngLat(f,p),new i.LngLat(d,m))}},{key:"_getBoundsRectangular",value:function(e,t){var r=this._edgeInsets,n=r.top,a=r.left,o=this.height-this._edgeInsets.bottom,s=this.width-this._edgeInsets.right,l=new i.pointGeometry(a,n),u=new i.pointGeometry(s,n),c=new i.pointGeometry(s,o),h=new i.pointGeometry(a,o),f=this.pointCoordinate(l,e),d=this.pointCoordinate(u,e),p=this.pointCoordinate(c,t),m=this.pointCoordinate(h,t),v=function(e,t){return(t.y-e.y)/(t.x-e.x)};return f.y>1&&d.y>=0?f=new i.MercatorCoordinate((1-m.y)/v(m,f)+m.x,1):f.y<0&&d.y<=1&&(f=new i.MercatorCoordinate(-m.y/v(m,f)+m.x,0)),d.y>1&&f.y>=0?d=new i.MercatorCoordinate((1-p.y)/v(p,d)+p.x,1):d.y<0&&f.y<=1&&(d=new i.MercatorCoordinate(-p.y/v(p,d)+p.x,0)),(new i.LngLatBounds).extend(this.coordinateLocation(f)).extend(this.coordinateLocation(d)).extend(this.coordinateLocation(m)).extend(this.coordinateLocation(p))}},{key:"_getBoundsRectangularTerrain",value:function(){var e=this.elevation;if(!e.visibleDemTiles.length||e.isUsingMockSource())return this._getBoundsRectangular(0,0);var t=e.visibleDemTiles.reduce(function(e,t){if(t.dem){var i=t.dem.tree;e.min=Math.min(e.min,i.minimums[0]),e.max=Math.max(e.max,i.maximums[0])}return e},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(t.min*e.exaggeration(),t.max*e.exaggeration())}},{key:"getBounds",value:function(){return"mercator"===this.projection.name||"equirectangular"===this.projection.name?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}},{key:"horizonLineFromTop",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))+this.centerOffset.y,i=this.height/2-t*(1-this._horizonShift);return e?Math.max(0,i):i}},{key:"getMaxBounds",value:function(){return this.maxBounds}},{key:"setMaxBounds",value:function(e){this.maxBounds=e,this.minLat=-i.MAX_MERCATOR_LATITUDE,this.maxLat=i.MAX_MERCATOR_LATITUDE,this.minLng=-180,this.maxLng=180,e&&(this.minLat=e.getSouth(),this.maxLat=e.getNorth(),this.minLng=e.getWest(),this.maxLng=e.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=i.mercatorXfromLng(this.minLng)*this.tileSize,this.worldMaxX=i.mercatorXfromLng(this.maxLng)*this.tileSize,this.worldMinY=i.mercatorYfromLat(this.maxLat)*this.tileSize,this.worldMaxY=i.mercatorYfromLat(this.minLat)*this.tileSize,this._constrain()}},{key:"calculatePosMatrix",value:function(e,t){return this.projection.createTileMatrix(this,t,e)}},{key:"calculateDistanceTileData",value:function(e){var t=e.key,r=this._distanceTileDataCache;if(r[t])return r[t];var n=e.canonical,a=1/this.height,o=this.cameraWorldSize,s=o/this.zoomScale(n.z),l=(n.x+Math.pow(2,n.z)*e.wrap)*s,u=n.y*s,c=this.point;c.x*=o/this.worldSize,c.y*=o/this.worldSize;var h=this.angle,f=Math.sin(-h),d=-Math.cos(-h);return r[t]={bearing:[f,d],center:[(c.x-l)*a,(c.y-u)*a],scale:s/i.EXTENT*a},r[t]}},{key:"calculateFogTileMatrix",value:function(e){var t=e.key,r=this._fogTileMatrixCache;if(r[t])return r[t];var n=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,e);return i.multiply(n,this.worldToFogMatrix,n),r[t]=new Float32Array(n),r[t]}},{key:"calculateProjMatrix",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=e.key,n=t?this._alignedProjMatrixCache:this._projMatrixCache;if(n[r])return n[r];var a=this.calculatePosMatrix(e,this.worldSize);return i.multiply(a,this.projection.isReprojectedInTileSpace?this.mercatorMatrix:t?this.alignedProjMatrix:this.projMatrix,a),n[r]=new Float32Array(a),n[r]}},{key:"calculatePixelsToTileUnitsMatrix",value:function(e){var t=e.tileID.key,r=this._pixelsToTileUnitsCache;if(r[t])return r[t];var n,a,o,s,l,u,c,h,f,d,p,m=(a=this,p=(n=e).tileTransform.scale*i.EXTENT/(n.tileSize*Math.pow(2,a.zoom-n.tileID.overscaledZ+n.tileID.canonical.z)),o=new Float32Array(4),u=(s=a.inverseAdjustmentMatrix)[1],c=s[2],h=s[3],d=(l=[p,p])[1],o[0]=s[0]*(f=l[0]),o[1]=u*f,o[2]=c*d,o[3]=h*d,o);return r[t]=m,r[t]}},{key:"customLayerMatrix",value:function(){return this.mercatorMatrix.slice()}},{key:"globeToMercatorMatrix",value:function(){if("globe"===this.projection.name){var e=1/this.worldSize,t=i.fromScaling([],[e,e,e]);return i.multiply(t,t,this.globeMatrix),t}}
1},{key:"recenterOnTerrain",value:function(){if(this._elevation&&"globe"!==this.projection.name){var e=this._elevation;this._updateCameraState();var t=i.mercatorZfromAltitude(1,this._center.lat)*this.worldSize,r=this._computeCameraPosition(t),n=this._camera.forward(),a=i.mercatorZfromAltitude(1,this._center.lat);r[2]/=a,n[2]/=a,i.normalize(n,n);var o=e.raycast(r,n,e.exaggeration());if(o){var s=i.scaleAndAdd([],r,n,o),l=new i.MercatorCoordinate(s[0],s[1],i.mercatorZfromAltitude(s[2],i.latFromMercatorY(s[1]))),u=(l.z+i.length([l.x-r[0],l.y-r[1],l.z-r[2]*a]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(u),this._centerAltitude=l.toAltitude(),this._center=this.coordinateLocation(l),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}}},{key:"_constrainCamera",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this._elevation){var t=this._elevation,n=i.mercatorZfromAltitude(1,this._center.lat)*this.worldSize,a=this._computeCameraPosition(n),o=t.getAtPointOrZero(g(i.MercatorCoordinate,r(a))),s=this.pixelsPerMeter/this.worldSize*o,l=this._minimumHeightOverTerrain(),u=a[2]-s;if(u<=l)if(u<0||e){var c=this.locationCoordinate(this._center,this._centerAltitude),h=[a[0],a[1],c.z-a[2]],f=i.length(h);h[2]-=(l-u)/this._pixelsPerMercatorPixel;var d=i.length(h);if(0===d)return;i.scale$2(h,h,f/d*this._pixelsPerMercatorPixel),this._camera.position=[a[0],a[1],c.z*this._pixelsPerMercatorPixel-h[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}}},{key:"_constrain",value:function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var e="globe"===this.projection.name||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||e){var t=this.center;return t.lat=i.clamp(t.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!e)&&(t.lng=i.clamp(t.lng,this.minLng,this.maxLng)),this.center=t,void(this._constraining=!1)}var r=this._unmodified,n=this.point,a=n.x,o=n.y,s=0,l=a,u=o,c=this.width/2,h=this.height/2,f=this.worldMinY*this.scale,d=this.worldMaxY*this.scale;if(o-h<f&&(u=f+h),o+h>d&&(u=d-h),d-f<this.height&&(s=Math.max(s,this.height/(d-f)),u=(d+f)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){var p=this.worldMinX*this.scale,m=this.worldMaxX*this.scale,v=this.worldSize/2-(p+m)/2;(l=(a+v+this.worldSize)%this.worldSize-v)-c<p&&(l=p+c),l+c>m&&(l=m-c),m-p<this.width&&(s=Math.max(s,this.width/(m-p)),l=(m+p)/2)}l===a&&u===o||(this.center=this.unproject(new i.pointGeometry(l,u))),s&&(this.zoom+=this.scaleZoom(s)),this._constrainCamera(),this._unmodified=r,this._constraining=!1}}},{key:"_minZoomForBounds",value:function(){var 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}},{key:"_maxCameraBoundsDistance",value:function(){return this._mercatorZfromZoom(this._minZoomForBounds())}},{key:"_calcMatrices",value:function(){if(this.height){var e=this.centerOffset,t=this.pixelsPerMeter;"globe"===this.projection.name&&(this._mercatorScaleRatio=i.mercatorZfromAltitude(1,this.center.lat)/i.mercatorZfromAltitude(1,i.GLOBE_SCALE_MATCH_LATITUDE));var r=rn(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,r),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;var n="meters"===this.projection.zAxisUnit?t:1,a=this._camera.getWorldToCamera(this.worldSize,n),o=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);o[8]=2*-e.x/this.width,o[9]=2*e.y/this.height;var s,l=i.mul([],o,a);if(this.projection.isReprojectedInTileSpace){var u=this.locationCoordinate(this.center),c=i.identity([]);i.translate(c,c,[u.x*this.worldSize,u.y*this.worldSize,0]),i.multiply(c,c,en(this)),i.translate(c,c,[-u.x*this.worldSize,-u.y*this.worldSize,0]),i.multiply(l,l,c),this.inverseAdjustmentMatrix=z([],[(s=en(this,!0))[0],s[1],s[4],s[5]])}else this.inverseAdjustmentMatrix=[1,0,0,1];this.mercatorMatrix=i.scale([],l,[this.worldSize,this.worldSize,this.worldSize/n,1]),this.projMatrix=l,this.invProjMatrix=i.invert(new Float64Array(16),this.projMatrix);var h=i.invert([],o);this.frustumCorners=i.FrustumCorners.fromInvProjectionMatrix(h,this.horizonLineFromTop(),this.height);var f=new Float32Array(16);i.identity(f),i.scale(f,f,[1,-1,1]),i.rotateX(f,f,this._pitch),i.rotateZ(f,f,this.angle);var d=i.perspective(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ),p=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;d[8]=2*-e.x/this.width,d[9]=2*(e.y+p)/this.height,this.skyboxMatrix=i.multiply(f,d,f);
1var m=this.point,v=m.x,y=m.y,_=this.width%2/2,g=this.height%2/2,x=Math.cos(this.angle),b=Math.sin(this.angle),w=v-Math.round(v)+x*_+b*g,k=y-Math.round(y)+x*g+b*_,T=new Float64Array(l);if(i.translate(T,T,[w>.5?w-1:w,k>.5?k-1:k,0]),this.alignedProjMatrix=T,l=i.create(),i.scale(l,l,[this.width/2,-this.height/2,1]),i.translate(l,l,[1,-1,0]),this.labelPlaneMatrix=l,l=i.create(),i.scale(l,l,[1,-1,1]),i.translate(l,l,[-1,-1,0]),i.scale(l,l,[2/this.width,2/this.height,1]),this.glCoordMatrix=l,this.pixelMatrix=i.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),this._calcFogMatrices(),this._distanceTileDataCache={},!(l=i.invert(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=l,"globe"===this.projection.name||this.mercatorFromTransition){this.globeMatrix=i.calculateGlobeMatrix(this);var E=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=i.transformMat4(E,E,a),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=l;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={}}}},{key:"_calcFogMatrices",value:function(){this._fogTileMatrixCache={};var e=this.cameraWorldSizeForFog,t=this.cameraPixelsPerMeter,r=this._camera.position,n=1/this.height/this._pixelsPerMercatorPixel,a=[e,e,t];i.scale$2(a,a,n),i.scale$2(r,r,-1),i.multiply$2(r,r,a);var o=i.create();i.translate(o,o,r),i.scale(o,o,a),this.mercatorFogMatrix=o,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(e,t,n)}},{key:"_computeCameraPosition",value:function(e){var t=(e=e||this.pixelsPerMeter)/this.pixelsPerMeter,i=this._camera.forward(),r=this.point,n=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*t-e/this.worldSize*this._centerAltitude;return[r.x/this.worldSize-i[0]*n,r.y/this.worldSize-i[1]*n,e/this.worldSize*this._centerAltitude-i[2]*n]}},{key:"_updateCameraState",value:function(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}},{key:"_translateCameraConstrained",value:function(e){var t=this._maxCameraBoundsDistance()*Math.cos(this._pitch),r=this._camera.position[2],n=e[2],a=1;this.projection.wrap&&(this.center=this.center.wrap()),n>0&&(a=Math.min((t-r)/n,1)),this._camera.position=i.scaleAndAdd([],this._camera.position,e,a),this._updateStateFromCamera()}},{key:"_updateStateFromCamera",value:function(){var e=this._camera.position,t=this._camera.forward(),r=this._camera.getPitchBearing(),n=r.pitch,a=r.bearing,o=i.mercatorZfromAltitude(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,s=this._mercatorZfromZoom(this._maxZoom)*Math.cos(i.degToRad(this._maxPitch)),l=Math.max((e[2]-o)/Math.cos(n),s),u=this._zoomFromMercatorZ(l);i.scaleAndAdd(e,e,t,l),this._pitch=i.clamp(n,i.degToRad(this.minPitch),i.degToRad(this.maxPitch)),this.angle=i.wrap(a,-Math.PI,Math.PI),this._setZoom(i.clamp(u,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new i.MercatorCoordinate(e[0],e[1],e[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}},{key:"_worldSizeFromZoom",value:function(e){return Math.pow(2,e)*this.tileSize}},{key:"_mercatorZfromZoom",value:function(e){return this.cameraToCenterDistance/this._worldSizeFromZoom(e)}},{key:"_minimumHeightOverTerrain",value:function(){var e=Math.min((null!=this._seaLevelZoom?this._seaLevelZoom:this._zoom)+4,this._maxZoom);return this._mercatorZfromZoom(e)}},{key:"_zoomFromMercatorZ",value:function(e){return this.scaleZoom(this.cameraToCenterDistance/(e*this.tileSize))}},{key:"zoomFromMercatorZAdjusted",value:function(e){for(var t=0,r=i.GLOBE_ZOOM_THRESHOLD_MAX,n=0,a=1/0;r-t>1e-6&&r>t;){var o=t+.5*(r-t),s=this.tileSize*Math.pow(2,o),l=this.getCameraToCenterDistance(this.projection,o,s),u=this.scaleZoom(l/(e*this.tileSize)),c=Math.abs(o-u);c<a&&(a=c,n=o),o<u?t=o:r=o}return n}},{key:"_terrainEnabled",value:function(){return!(!this._elevation||!this.projection.supportsTerrain&&(i.warnOnce("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}},{key:"anyCornerOffEdge",value:function(e,t){var r=Math.min(e.x,t.x),n=Math.max(e.x,t.x),a=Math.min(e.y,t.y),o=Math.max(e.y,t.y);if(a<this.horizonLineFromTop(!1))return!0;
1if("mercator"!==this.projection.name)return!1;for(var s=[new i.pointGeometry(r,a),new i.pointGeometry(n,o),new i.pointGeometry(r,o),new i.pointGeometry(n,a)],l=this.renderWorldCopies?-3:0,u=this.renderWorldCopies?4:1,c=0,h=s;c<h.length;c++){var f=h[c],d=this.pointRayIntersection(f);if(d.t<0)return!0;var p=this.rayIntersectionCoordinate(d);if(p.x<l||p.y<0||p.x>u||p.y>1)return!0}return!1}},{key:"isHorizonVisible",value:function(){return this.pitch+i.radToDeg(this.fovAboveCenter)>88||this.anyCornerOffEdge(new i.pointGeometry(0,0),new i.pointGeometry(this.width,this.height))}},{key:"zoomDeltaToMovement",value:function(e,t){var r=i.length(i.sub([],this._camera.position,e)),n=this._zoomFromMercatorZ(r)+t;return r-this._mercatorZfromZoom(n)}},{key:"getCameraPoint",value:function(){if("globe"===this.projection.name){var e=function(e,t){var r=a(e,3),n=[r[0],r[1],r[2],1];i.transformMat4$1(n,n,t);var o=n[3]=Math.max(n[3],1e-6);return n[0]/=o,n[1]/=o,n[2]/=o,n}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new i.pointGeometry(e[0],e[1])}var t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new i.pointGeometry(0,t))}},{key:"getCameraToCenterDistance",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.zoom,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.worldSize,r=rn(e,t,this.width,this.height,1024),n=e.pixelSpaceConversion(this.center.lat,i,r);return.5/Math.tan(.5*this._fov)*this.height*n}},{key:"getWorldToCameraMatrix",value:function(){var e=this._camera.getWorldToCamera(this.worldSize,"meters"===this.projection.zAxisUnit?this.pixelsPerMeter:1);return"globe"===this.projection.name&&i.multiply(e,e,this.globeMatrix),e}}]),e}();function ln(e,t){var i=!1,r=null,n=function n(){r=null,i&&(e(),r=setTimeout(n,t),i=!1)};return function(){return i=!0,r||n(),r}}var un=function(){function e(t){h(this,e),this._hashName=t&&encodeURIComponent(t),i.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=ln(this._updateHashUnthrottled.bind(this),300)}return d(e,[{key:"addTo",value:function(e){return this._map=e,i.window.addEventListener("hashchange",this._onHashChange,!1),e.on("moveend",this._updateHash),this}},{key:"remove",value:function(){return this._map?(this._map.off("moveend",this._updateHash),i.window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}},{key:"getHashString",value:function(){var e=this._map;if(!e)return"";var t=cn(e);if(this._hashName){var r=this._hashName,n=!1,a=i.window.location.hash.slice(1).split("&").map(function(e){var i=e.split("=")[0];return i===r?(n=!0,"".concat(i,"=").concat(t)):e}).filter(function(e){return e});return n||a.push("".concat(r,"=").concat(t)),"#".concat(a.join("&"))}return"#".concat(t)}},{key:"_getCurrentHash",value:function(){var e,t=this,r=i.window.location.hash.replace("#","");return this._hashName?(r.split("&").map(function(e){return e.split("=")}).forEach(function(i){i[0]===t._hashName&&(e=i)}),(e&&e[1]||"").split("/")):r.split("/")}},{key:"_onHashChange",value:function(){var e=this._map;if(!e)return!1;var t=this._getCurrentHash();if(t.length>=3&&!t.some(function(e){return isNaN(e)})){var i=e.dragRotate.isEnabled()&&e.touchZoomRotate.isEnabled()?+(t[3]||0):e.getBearing();return e.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:i,pitch:+(t[4]||0)}),!0}return!1}},{key:"_updateHashUnthrottled",value:function(){var e=i.window.location.href.replace(/(#.+)?$/,this.getHashString());i.window.history.replaceState(i.window.history.state,null,e)}}]),e}();function cn(e,t){var i=e.getCenter(),r=Math.round(100*e.getZoom())/100,n=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),a=Math.pow(10,n),o=Math.round(i.lng*a)/a,s=Math.round(i.lat*a)/a,l=e.getBearing(),u=e.getPitch(),c=t?"/".concat(o,"/").concat(s,"/").concat(r):"".concat(r,"/").concat(s,"/").concat(o);return(l||u)&&(c+="/"+Math.round(10*l)/10),u&&(c+="/".concat(Math.round(u))),c}var hn={linearity:.3,easing:i.bezier(0,0,.3,1)},fn=i.extend({deceleration:2500,maxSpeed:1400},hn),dn=i.extend({deceleration:20,maxSpeed:1400},hn),pn=i.extend({deceleration:1e3,maxSpeed:360},hn),mn=i.extend({deceleration:1e3,maxSpeed:90},hn),vn=function(){function e(t){h(this,e),this._map=t,this.clear()}return d(e,[{key:"clear",value:function(){this._inertiaBuffer=[]}},{key:"record",value:function(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:i.exported.now(),settings:e})}},{key:"_drainInertiaBuffer",value:function(){for(var e=this._inertiaBuffer,t=i.exported.now();e.length>0&&t-e[0].time>160;)e.shift()}},{key:"_onMoveEnd",value:function(e){if(!(i.exported.prefersReducedMotion||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))){var t,r={zoom:0,bearing:0,pitch:0,pan:new i.pointGeometry(0,0),pinchAround:void 0,around:void 0},n=l(this._inertiaBuffer);try{for(n.s();!(t=n.n()).done;){var a=t.value.settings;r.zoom+=a.zoomDelta||0,r.bearing+=a.bearingDelta||0,r.pitch+=a.pitchDelta||0,a.panDelta&&r.pan._add(a.panDelta),a.around&&(r.around=a.around),a.pinchAround&&(r.pinchAround=a.pinchAround)}}catch(p){n.e(p)}finally{n.f()}var o=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,s={};if(r.pan.mag()){var u=_n(r.pan.mag(),o,i.extend({},fn,e||{}));s.offset=r.pan.mult(u.amount/r.pan.mag()),s.center=this._map.transform.center,yn(s,u)}if(r.zoom){var c=_n(r.zoom,o,dn);s.zoom=this._map.transform.zoom+c.amount,yn(s,c)}if(r.bearing){var h=_n(r.bearing,o,pn);
1s.bearing=this._map.transform.bearing+i.clamp(h.amount,-179,179),yn(s,h)}if(r.pitch){var f=_n(r.pitch,o,mn);s.pitch=this._map.transform.pitch+f.amount,yn(s,f)}if(s.zoom||s.bearing){var d=void 0===r.pinchAround?r.around:r.pinchAround;s.around=d?this._map.unproject(d):this._map.getCenter()}return this.clear(),s.noMoveStart=!0,s}}}]),e}();function yn(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function _n(e,t,r){var n=r.maxSpeed,a=r.linearity,o=r.deceleration,s=i.clamp(e*a/(t/1e3),-n,n),l=Math.abs(s)/(o*a);return{easing:r.easing,duration:1e3*l,amount:s*(l/2)}}var gn=function(e){p(r,e);var t=m(r);function r(e,n,a){var o,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};h(this,r);var l=S(n.getCanvasContainer(),a),u=n.unproject(l);return(o=t.call(this,e,i.extend({point:l,lngLat:u,originalEvent:a},s)))._defaultPrevented=!1,o.target=n,o}return d(r,[{key:"preventDefault",value:function(){this._defaultPrevented=!0}},{key:"defaultPrevented",get:function(){return this._defaultPrevented}}]),r}(i.Event),xn=function(e){p(r,e);var t=m(r);function r(e,n,a){var o;h(this,r);var s="touchend"===e?a.changedTouches:a.touches,l=I(n.getCanvasContainer(),s),u=l.map(function(e){return n.unproject(e)}),c=l.reduce(function(e,t,i,r){return e.add(t.div(r.length))},new i.pointGeometry(0,0));return(o=t.call(this,e,{points:l,point:c,lngLats:u,lngLat:n.unproject(c),originalEvent:a}))._defaultPrevented=!1,o}return d(r,[{key:"preventDefault",value:function(){this._defaultPrevented=!0}},{key:"defaultPrevented",get:function(){return this._defaultPrevented}}]),r}(i.Event),bn=function(e){p(i,e);var t=m(i);function i(e,r,n){var a;return h(this,i),(a=t.call(this,e,{originalEvent:n}))._defaultPrevented=!1,a}return d(i,[{key:"preventDefault",value:function(){this._defaultPrevented=!0}},{key:"defaultPrevented",get:function(){return this._defaultPrevented}}]),i}(i.Event),wn=function(){function e(t,i){h(this,e),this._map=t,this._clickTolerance=i.clickTolerance}return d(e,[{key:"reset",value:function(){this._mousedownPos=void 0}},{key:"wheel",value:function(e){return this._firePreventable(new bn(e.type,this._map,e))}},{key:"mousedown",value:function(e,t){return this._mousedownPos=t,this._firePreventable(new gn(e.type,this._map,e))}},{key:"mouseup",value:function(e){this._map.fire(new gn(e.type,this._map,e))}},{key:"preclick",value:function(e){var t=i.extend({},e);t.type="preclick",this._map.fire(new gn(t.type,this._map,t))}},{key:"click",value:function(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||(this.preclick(e),this._map.fire(new gn(e.type,this._map,e)))}},{key:"dblclick",value:function(e){return this._firePreventable(new gn(e.type,this._map,e))}},{key:"mouseover",value:function(e){this._map.fire(new gn(e.type,this._map,e))}},{key:"mouseout",value:function(e){this._map.fire(new gn(e.type,this._map,e))}},{key:"touchstart",value:function(e){return this._firePreventable(new xn(e.type,this._map,e))}},{key:"touchmove",value:function(e){this._map.fire(new xn(e.type,this._map,e))}},{key:"touchend",value:function(e){this._map.fire(new xn(e.type,this._map,e))}},{key:"touchcancel",value:function(e){this._map.fire(new xn(e.type,this._map,e))}},{key:"_firePreventable",value:function(e){if(this._map.fire(e),e.defaultPrevented)return{}}},{key:"isEnabled",value:function(){return!0}},{key:"isActive",value:function(){return!1}},{key:"enable",value:function(){}},{key:"disable",value:function(){}}]),e}(),kn=function(){function e(t){h(this,e),this._map=t}return d(e,[{key:"reset",value:function(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}},{key:"mousemove",value:function(e){this._map.fire(new gn(e.type,this._map,e))}},{key:"mousedown",value:function(){this._delayContextMenu=!0}},{key:"mouseup",value:function(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new gn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}},{key:"contextmenu",value:function(e){this._delayContextMenu?this._contextMenuEvent=e:this._map.fire(new gn(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}},{key:"isEnabled",value:function(){return!0}},{key:"isActive",value:function(){return!1}},{key:"enable",value:function(){}},{key:"disable",value:function(){}}]),e}(),Tn=function(){function e(t,i){h(this,e),this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=i.clickTolerance||1}return d(e,[{key:"isEnabled",value:function(){return!!this._enabled}},{key:"isActive",value:function(){return!!this._active}},{key:"enable",value:function(){this.isEnabled()||(this._enabled=!0)}},{key:"disable",value:function(){this.isEnabled()&&(this._enabled=!1)}},{key:"mousedown",value:function(e,t){this.isEnabled()&&e.shiftKey&&0===e.button&&(k(),this._startPos=this._lastPos=t,this._active=!0)}},{key:"mousemoveWindow",value:function(e,t){var i=this;if(this._active){var r=t,n=this._startPos,a=this._lastPos;if(!(!n||!a||a.equals(r)||!this._box&&r.dist(n)<this._clickTolerance)){this._lastPos=r,this._box||(this._box=c("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",e));var o=Math.min(n.x,r.x),s=Math.max(n.x,r.x),l=Math.min(n.y,r.y),u=Math.max(n.y,r.y);this._map._requestDomTask(function(){i._box&&(i._box.style.transform="translate(".concat(o,"px,").concat(l,"px)"),i._box.style.width=s-o+"px",i._box.style.height=u-l+"px")})}}}},{key:"mouseupWindow",value:function(e,t){var r=this;if(this._active){var n=this._startPos,a=t;if(n&&0===e.button){if(this.reset(),M(),n.x!==a.x||n.y!==a.y)return this._map.fire(new i.Event("boxzoomend",{originalEvent:e})),{cameraAnimation:function(e){return e.fitScreenCoordinates(n,a,r._map.getBearing(),{linear:!1})}};this._fireEvent("boxzoomcancel",e)}}}}
1,{key:"keydown",value:function(e){this._active&&27===e.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",e))}},{key:"blur",value:function(){this.reset()}},{key:"reset",value:function(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),T(),delete this._startPos,delete this._lastPos}},{key:"_fireEvent",value:function(e,t){return this._map.fire(new i.Event(e,{originalEvent:t}))}}]),e}();function En(e,t){for(var i={},r=0;r<e.length;r++)i[e[r].identifier]=t[r];return i}var Mn=function(){function e(t){h(this,e),this.reset(),this.numTouches=t.numTouches}return d(e,[{key:"reset",value:function(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}},{key:"touchstart",value:function(e,t,r){(this.centroid||r.length>this.numTouches)&&(this.aborted=!0),this.aborted||(0===this.startTime&&(this.startTime=e.timeStamp),r.length===this.numTouches&&(this.centroid=function(e){var t,r=new i.pointGeometry(0,0),n=l(e);try{for(n.s();!(t=n.n()).done;){var a=t.value;r._add(a)}}catch(o){n.e(o)}finally{n.f()}return r.div(e.length)}(t),this.touches=En(r,t)))}},{key:"touchmove",value:function(e,t,i){if(!this.aborted&&this.centroid){var r=En(i,t);for(var n in this.touches){var a=this.touches[n],o=r[n];(!o||o.dist(a)>30)&&(this.aborted=!0)}}}},{key:"touchend",value:function(e,t,i){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){var r=!this.aborted&&this.centroid;if(this.reset(),r)return r}}}]),e}(),Sn=function(){function e(t){h(this,e),this.singleTap=new Mn(t),this.numTaps=t.numTaps,this.reset()}return d(e,[{key:"reset",value:function(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}},{key:"touchstart",value:function(e,t,i){this.singleTap.touchstart(e,t,i)}},{key:"touchmove",value:function(e,t,i){this.singleTap.touchmove(e,t,i)}},{key:"touchend",value:function(e,t,i){var r=this.singleTap.touchend(e,t,i);if(r){var n=e.timeStamp-this.lastTime<500,a=!this.lastTap||this.lastTap.dist(r)<30;if(n&&a||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}}]),e}(),In=function(){function e(){h(this,e),this._zoomIn=new Sn({numTouches:1,numTaps:2}),this._zoomOut=new Sn({numTouches:2,numTaps:1}),this.reset()}return d(e,[{key:"reset",value:function(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}},{key:"touchstart",value:function(e,t,i){this._zoomIn.touchstart(e,t,i),this._zoomOut.touchstart(e,t,i)}},{key:"touchmove",value:function(e,t,i){this._zoomIn.touchmove(e,t,i),this._zoomOut.touchmove(e,t,i)}},{key:"touchend",value:function(e,t,i){var r=this,n=this._zoomIn.touchend(e,t,i),a=this._zoomOut.touchend(e,t,i);return n?(this._active=!0,e.preventDefault(),setTimeout(function(){return r.reset()},0),{cameraAnimation:function(t){return t.easeTo({duration:300,zoom:t.getZoom()+1,around:t.unproject(n)},{originalEvent:e})}}):a?(this._active=!0,e.preventDefault(),setTimeout(function(){return r.reset()},0),{cameraAnimation:function(t){return t.easeTo({duration:300,zoom:t.getZoom()-1,around:t.unproject(a)},{originalEvent:e})}}):void 0}},{key:"touchcancel",value:function(){this.reset()}},{key:"enable",value:function(){this._enabled=!0}},{key:"disable",value:function(){this._enabled=!1,this.reset()}},{key:"isEnabled",value:function(){return this._enabled}},{key:"isActive",value:function(){return this._active}}]),e}(),Cn={0:1,2:2},An=function(){function e(t){h(this,e),this.reset(),this._clickTolerance=t.clickTolerance||1}return d(e,[{key:"blur",value:function(){this.reset()}},{key:"reset",value:function(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}},{key:"_correctButton",value:function(e,t){return!1}},{key:"_move",value:function(e,t){return{}}},{key:"mousedown",value:function(e,t){if(!this._lastPoint){var i=C(e);this._correctButton(e,i)&&(this._lastPoint=t,this._eventButton=i)}}},{key:"mousemoveWindow",value:function(e,t){var i,r,n,a=this._lastPoint;if(a)if(e.preventDefault(),null!=this._eventButton&&(i=e,r=this._eventButton,n=Cn[r],void 0===i.buttons||(i.buttons&n)!==n))this.reset();else if(this._moved||!(t.dist(a)<this._clickTolerance))return this._moved=!0,this._lastPoint=t,this._move(a,t)}},{key:"mouseupWindow",value:function(e){this._lastPoint&&C(e)===this._eventButton&&(this._moved&&M(),this.reset())}},{key:"enable",value:function(){this._enabled=!0}},{key:"disable",value:function(){this._enabled=!1,this.reset()}},{key:"isEnabled",value:function(){return this._enabled}},{key:"isActive",value:function(){return this._active}}]),e}(),zn=function(e){p(r,e);var i=m(r);function r(){return h(this,r),i.apply(this,arguments)}return d(r,[{key:"mousedown",value:function(e,i){t(w(r.prototype),"mousedown",this).call(this,e,i),this._lastPoint&&(this._active=!0)}},{key:"_correctButton",value:function(e,t){return 0===t&&!e.ctrlKey}},{key:"_move",value:function(e,t){return{around:t,panDelta:t.sub(e)}}}]),r}(An),Pn=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"_correctButton",value:function(e,t){return 0===t&&e.ctrlKey||2===t}},{key:"_move",value:function(e,t){var i=.8*(t.x-e.x);if(i)return this._active=!0,{bearingDelta:i}}},{key:"contextmenu",value:function(e){e.preventDefault()}}]),i}(An),Dn=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i,[{key:"_correctButton",value:function(e,t){return 0===t&&e.ctrlKey||2===t}},{key:"_move",value:function(e,t){var i=-.5*(t.y-e.y);if(i)return this._active=!0,{pitchDelta:i}}},{key:"contextmenu",value:function(e){e.preventDefault()}}]),i}(An),Ln=function(){function e(t,r){h(this,e),this._map=t,this._el=t.getCanvasContainer(),this._minTouches=1,this._clickTolerance=r.clickTolerance||1,this.reset(),i.bindAll(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}return d(e,[{key:"reset",value:function(){this._active=!1,this._touches={},this._sum=new i.pointGeometry(0,0)}},{key:"touchstart",value:function(e,t,i){return this._calculateTransform(e,t,i)}},{key:"touchmove",value:function(e,t,r){if(this._active&&!(r.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(1===r.length&&!i.isFullscreen())return void this._showTouchPanBlockerAlert();
1"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return e.cancelable&&e.preventDefault(),this._calculateTransform(e,t,r)}}},{key:"touchend",value:function(e,t,i){this._calculateTransform(e,t,i),this._active&&i.length<this._minTouches&&this.reset()}},{key:"touchcancel",value:function(){this.reset()}},{key:"_calculateTransform",value:function(e,t,r){r.length>0&&(this._active=!0);var n=En(r,t),a=new i.pointGeometry(0,0),o=new i.pointGeometry(0,0),s=0;for(var l in n){var u=n[l],c=this._touches[l];c&&(a._add(u),o._add(u.sub(c)),s++,n[l]=u)}if(this._touches=n,!(s<this._minTouches)&&o.mag()){var h=o.div(s);return this._sum._add(h),this._sum.mag()<this._clickTolerance?void 0:{around:a.div(s),panDelta:h}}}},{key:"enable",value:function(){this._enabled=!0,this._map._cooperativeGestures&&(this._addTouchPanBlocker(),this._el.classList.add("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page"))}},{key:"disable",value:function(){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()}},{key:"isEnabled",value:function(){return!!this._enabled}},{key:"isActive",value:function(){return!!this._active}},{key:"_addTouchPanBlocker",value:function(){this._map&&!this._alertContainer&&(this._alertContainer=c("div","mapboxgl-touch-pan-blocker",this._map._container),this._alertContainer.textContent=this._map._getUIString("TouchPanBlocker.Message"),this._alertContainer.style.fontSize="".concat(Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth))),"px"))}},{key:"_showTouchPanBlockerAlert",value:function(){var e=this;this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=setTimeout(function(){e._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),e._alertContainer.setAttribute("role","null")},500)}}]),e}(),Rn=function(){function e(){h(this,e),this.reset()}return d(e,[{key:"reset",value:function(){this._active=!1,this._firstTwoTouches=void 0}},{key:"_start",value:function(e){}},{key:"_move",value:function(e,t,i){return{}}},{key:"touchstart",value:function(e,t,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([t[0],t[1]]))}},{key:"touchmove",value:function(e,t,i){var r=this._firstTwoTouches;if(r){e.preventDefault();var n=a(r,2),o=n[0],s=n[1],l=Bn(i,t,o),u=Bn(i,t,s);if(l&&u){var c=this._aroundCenter?null:l.add(u).div(2);return this._move([l,u],c,e)}}}},{key:"touchend",value:function(e,t,i){if(this._firstTwoTouches){var r=a(this._firstTwoTouches,2),n=r[0],o=r[1],s=Bn(i,t,n),l=Bn(i,t,o);s&&l||(this._active&&M(),this.reset())}}},{key:"touchcancel",value:function(){this.reset()}},{key:"enable",value:function(e){this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around}},{key:"disable",value:function(){this._enabled=!1,this.reset()}},{key:"isEnabled",value:function(){return this._enabled}},{key:"isActive",value:function(){return this._active}}]),e}();function Bn(e,t,i){for(var r=0;r<e.length;r++)if(e[r].identifier===i)return t[r]}function On(e,t){return Math.log(e/t)/Math.LN2}var Fn=function(e){p(r,e);var i=m(r);function r(){return h(this,r),i.apply(this,arguments)}return d(r,[{key:"reset",value:function(){t(w(r.prototype),"reset",this).call(this),this._distance=0,this._startDistance=0}},{key:"_start",value:function(e){this._startDistance=this._distance=e[0].dist(e[1])}},{key:"_move",value:function(e,t){var i=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(On(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:On(this._distance,i),pinchAround:t}}}]),r}(Rn);function Un(e,t){return 180*e.angleWith(t)/Math.PI}var Vn=function(e){p(r,e);var i=m(r);function r(){return h(this,r),i.apply(this,arguments)}return d(r,[{key:"reset",value:function(){t(w(r.prototype),"reset",this).call(this),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}},{key:"_start",value:function(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}},{key:"_move",value:function(e,t){var i=this._vector;if(this._vector=e[0].sub(e[1]),i&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:Un(this._vector,i),pinchAround:t}}},{key:"_isBelowThreshold",value:function(e){this._minDiameter=Math.min(this._minDiameter,e.mag());var t=25/(Math.PI*this._minDiameter)*360,i=this._startVector;if(!i)return!1;var r=Un(e,i);return Math.abs(r)<t}}]),r}(Rn);function jn(e){return Math.abs(e.y)>Math.abs(e.x)}var Nn=function(e){p(n,e);var r=m(n);function n(e){var t;return h(this,n),(t=r.call(this))._map=e,t}return d(n,[{key:"reset",value:function(){t(w(n.prototype),"reset",this).call(this),this._val
1id=void 0,this._firstMove=void 0,this._lastPoints=void 0}},{key:"_start",value:function(e){this._lastPoints=e,jn(e[0].sub(e[1]))&&(this._valid=!1)}},{key:"_move",value:function(e,t,r){var n=this._lastPoints;if(n){var a=e[0].sub(n[0]),o=e[1].sub(n[1]);return this._map._cooperativeGestures&&!i.isFullscreen()&&r.touches.length<3||(this._valid=this.gestureBeginsVertically(a,o,r.timeStamp),!this._valid)?void 0:(this._lastPoints=e,this._active=!0,{pitchDelta:(a.y+o.y)/2*-.5})}}},{key:"gestureBeginsVertically",value:function(e,t,i){if(void 0!==this._valid)return this._valid;var r=e.mag()>=2,n=t.mag()>=2;if(r||n){if(!r||!n)return null==this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;var a=e.y>0==t.y>0;return jn(e)&&jn(t)&&a}}}]),n}(Rn),Gn={panStep:100,bearingStep:15,pitchStep:10},Zn=function(){function e(){h(this,e);var t=Gn;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}return d(e,[{key:"blur",value:function(){this.reset()}},{key:"reset",value:function(){this._active=!1}},{key:"keydown",value:function(e){var t=this;if(!(e.altKey||e.ctrlKey||e.metaKey)){var i=0,r=0,n=0,a=0,o=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(),a=-1);break;case 39:e.shiftKey?r=1:(e.preventDefault(),a=1);break;case 38:e.shiftKey?n=1:(e.preventDefault(),o=-1);break;case 40:e.shiftKey?n=-1:(e.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(r=0,n=0),{cameraAnimation:function(s){var l=s.getZoom();s.easeTo({duration:300,easeId:"keyboardHandler",easing:qn,zoom:i?Math.round(l)+i*(e.shiftKey?2:1):l,bearing:s.getBearing()+r*t._bearingStep,pitch:s.getPitch()+n*t._pitchStep,offset:[-a*t._panStep,-o*t._panStep],center:s.getCenter()},{originalEvent:e})}}}}},{key:"enable",value:function(){this._enabled=!0}},{key:"disable",value:function(){this._enabled=!1,this.reset()}},{key:"isEnabled",value:function(){return this._enabled}},{key:"isActive",value:function(){return this._active}},{key:"disableRotation",value:function(){this._rotationDisabled=!0}},{key:"enableRotation",value:function(){this._rotationDisabled=!1}}]),e}();function qn(e){return e*(2-e)}var Wn=4.000244140625,Xn=function(){function e(t,r){h(this,e),this._map=t,this._el=t.getCanvasContainer(),this._handler=r,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,i.bindAll(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}return d(e,[{key:"setZoomRate",value:function(e){this._defaultZoomRate=e}},{key:"setWheelZoomRate",value:function(e){this._wheelZoomRate=e}},{key:"isEnabled",value:function(){return!!this._enabled}},{key:"isActive",value:function(){return this._active||void 0!==this._finishTimeout}},{key:"isZooming",value:function(){return!!this._zooming}},{key:"enable",value:function(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around,this._map._cooperativeGestures&&this._addScrollZoomBlocker())}},{key:"disable",value:function(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}},{key:"wheel",value:function(e){if(this.isEnabled()){if(this._map._cooperativeGestures){if(!(e.ctrlKey||e.metaKey||this.isZooming()||i.isFullscreen()))return void this._showBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}var t=e.deltaMode===i.window.WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,r=i.exported.now(),n=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,0!==t&&t%Wn==0?this._type="wheel":0!==t&&Math.abs(t)<4?this._type="trackpad":n>400?(this._type=null,this._lastValue=t,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(n*t)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,t+=this._lastValue)),e.shiftKey&&t&&(t/=4),this._type&&(this._lastWheelEvent=e,this._delta-=t,this._active||this._start(e)),e.preventDefault()}}},{key:"_onTimeout",value:function(e){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)}},{key:"_start",value:function(e){if(this._delta){this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);var t=S(this._el,e);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:t,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRe
1nderFrame())}}},{key:"renderFrame",value:function(){var e=this;if(this._frameId&&(this._frameId=null,this.isActive())){var t=this._map.transform;"wheel"===this._type&&t.projection.wrap&&(t._center.lng>=180||t._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);var r=function(){return t._terrainEnabled()&&e._aroundCoord?t.computeZoomRelativeTo(e._aroundCoord):t.zoom};if(0!==this._delta){var n="wheel"===this._type&&Math.abs(this._delta)>Wn?this._wheelZoomRate:this._defaultZoomRate,a=2/(1+Math.exp(-Math.abs(this._delta*n)));this._delta<0&&0!==a&&(a=1/a);var o=r(),s=Math.pow(2,o),l="number"==typeof this._targetZoom?t.zoomScale(this._targetZoom):s;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(l*a))),"wheel"===this._type&&(this._startZoom=o,this._easing=this._smoothOutEasing(200)),this._delta=0}var u,c="number"==typeof this._targetZoom?this._targetZoom:r(),h=this._startZoom,f=this._easing,d=!1;if("wheel"===this._type&&h&&f){var p=Math.min((i.exported.now()-this._lastWheelEventTime)/200,1),m=f(p);u=i.number(h,c,m),p<1?this._frameId||(this._frameId=!0):d=!0}else u=c,d=!0;return this._active=!0,d&&(this._active=!1,this._finishTimeout=setTimeout(function(){e._zooming=!1,e._handler._triggerRenderFrame(),delete e._targetZoom,delete e._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!d,zoomDelta:u-r(),around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}}},{key:"_smoothOutEasing",value:function(e){var t=i.ease;if(this._prevEase){var r=this._prevEase,n=(i.exported.now()-r.start)/r.duration,a=r.easing(n+.01)-r.easing(n),o=.27/Math.sqrt(a*a+1e-4)*.01,s=Math.sqrt(.0729-o*o);t=i.bezier(o,s,.25,1)}return this._prevEase={start:i.exported.now(),duration:e,easing:t},t}},{key:"blur",value:function(){this.reset()}},{key:"reset",value:function(){this._active=!1}},{key:"_addScrollZoomBlocker",value:function(){this._map&&!this._alertContainer&&(this._alertContainer=c("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(i.window.navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize="".concat(Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth))),"px"))}},{key:"_showBlockerAlert",value:function(){var e=this;this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=setTimeout(function(){e._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),e._alertContainer.setAttribute("role","null")},200)}}]),e}(),Hn=function(){function e(t,i){h(this,e),this._clickZoom=t,this._tapZoom=i}return d(e,[{key:"enable",value:function(){this._clickZoom.enable(),this._tapZoom.enable()}},{key:"disable",value:function(){this._clickZoom.disable(),this._tapZoom.disable()}},{key:"isEnabled",value:function(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}},{key:"isActive",value:function(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}]),e}(),Yn=function(){function e(){h(this,e),this.reset()}return d(e,[{key:"reset",value:function(){this._active=!1}},{key:"blur",value:function(){this.reset()}},{key:"dblclick",value:function(e,t){return e.preventDefault(),{cameraAnimation:function(i){i.easeTo({duration:300,zoom:i.getZoom()+(e.shiftKey?-1:1),around:i.unproject(t)},{originalEvent:e})}}}},{key:"enable",value:function(){this._enabled=!0}},{key:"disable",value:function(){this._enabled=!1,this.reset()}},{key:"isEnabled",value:function(){return this._enabled}},{key:"isActive",value:function(){return this._active}}]),e}(),Kn=function(){function e(){h(this,e),this._tap=new Sn({numTouches:1,numTaps:1}),this.reset()}return d(e,[{key:"reset",value:function(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}},{key:"touchstart",value:function(e,t,i){this._swipePoint||(this._tapTime&&e.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?i.length>0&&(this._swipePoint=t[0],this._swipeTouch=i[0].identifier):this._tap.touchstart(e,t,i))}},{key:"touchmove",value:function(e,t,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;var r=t[0],n=r.y-this._swipePoint.y;return this._swipePoint=r,e.preventDefault(),this._active=!0,{zoomDelta:n/128}}}else this._tap.touchmove(e,t,i)}},{key:"touchend",value:function(e,t,i){this._tapTime?this._swipePoint&&0===i.length&&this.reset():this._tap.touchend(e,t,i)&&(this._tapTime=e.timeStamp)}},{key:"touchcancel",value:function(){this.reset()}},{key:"enable",value:function(){this._enabled=!0}},{key:"disable",value:function(){this._enabled=!1,this.reset()}},{key:"isEnabled",value:function(){return this._enabled}},{key:"isActive",value:function(){return this._active}}]),e}(),Jn=function(){function e(t,i,r){h(this,e),this._el=t,this._mousePan=i,this._touchPan=r}return d(e,[{key:"enable",value:function(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}},{key:"disable",value:function(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}},{key:"isEnabled",value:function(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}},{key:"isActive",value:function(){return this._mousePan.isActive()||this._touchPan.isActive()}}]),e}(),$n=function(){function e(t,i,r){h(this,e),this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=i,this._mousePitch=r}return d(e,[{key:"enable",value:function(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}},{key:"disable",value:function(){this._mouseRotate.disable(),this._mousePitch.disable()}},{key:"isEnabled",value:function(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}},{key:"isActive",value:function(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}]),e}(),Qn=function(){function e(t,i,r,n){h(this,e),this._el=t,this._touchZoom=i,this._touchRotate=r,this._tapDragZoom=n,this._rotationDisabled=!1,this._enabled=!0}return d(e,[{key:"enable",value:function(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}},{key:"disable",value:function(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}},{key:"isEnabled",value:function(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}},{key:"isActive",value:function(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}},{key:"disableRotation",value:function(){this._rotationDisabled=!0,this._touchRotate.disable()}},{key:"enableRotation",value:function(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}]),e}(),ea=function(e){return e.zoom||e.drag||e.pitch||e.rotate},ta=function(e){p(i,e);var t=m(i);function i(){return h(this,i),t.apply(this,arguments)}return d(i)}(i.Event),ia=function(){function e(){h(this,e),this.constants=[1,1,.01],this.radius=0}return d(e,[{key:"setup",value:function(e,t){var r=i.sub([],t,e);this.radius=i.length(r[2]<0?i.div([],r,this.constants):[r[0],r[1],0])}},{key:"projectRay",value:function(e){i.div(e,e,this.constants),i.normalize(e,e),i.mul$1(e,e,this.constants);var t=i.scale$2([],e,this.radius);if(t[2]>0){var r=i.scale$2([],[0,0,1],i.dot(t,[0,0,1])),n=i.scale$2([],i.normalize([],[t[0],t[1],0]),this.radius),a=i.add([],t,i.scale$2([],i.sub([],i.add([],n,r),t),2));t[0]=a[0],t[1]=a[1]}return t}}]),e}();function ra(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta}var na=function(){function e(t,r){h(this,e),this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new vn(t),this._bearingSnap=r.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new ia,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(r),i.bindAll(["handleEvent","handleWindowEvent"],this);var n=this._el;this._listeners=[[n,"touchstart",{passive:!0}],[n,"touchmove",{passive:!1}],[n,"touchend",void 0],[n,"touchcancel",void 0],[n,"mousedown",void 0],[n,"mousemove",void 0],[n,"mouseup",void 0],[i.window.document,"mousemove",{capture:!0}],[i.window.document,"mouseup",void 0],[n,"mouseover",void 0],[n,"mouseout",void 0],[n,"dblclick",void 0],[n,"click",void 0],[n,"keydown",{capture:!1}],[n,"keyup",void 0],[n,"wheel",{passive:!1}],[n,"contextmenu",void 0],[i.window,"blur",void 0]];var o,s=l(this._listeners);try{for(s.s();!(o=s.n()).done;){var u=a(o.value,3),c=u[0],f=u[1],d=u[2];c.addEventListener(f,c===i.window.document?this.handleWindowEvent:this.handleEvent,d)}}
1catch(p){s.e(p)}finally{s.f()}}return d(e,[{key:"destroy",value:function(){var e,t=l(this._listeners);try{for(t.s();!(e=t.n()).done;){var r=a(e.value,3),n=r[0],o=r[1],s=r[2];n.removeEventListener(o,n===i.window.document?this.handleWindowEvent:this.handleEvent,s)}}catch(u){t.e(u)}finally{t.f()}}},{key:"_addDefaultHandlers",value:function(e){var t=this._map,i=t.getCanvasContainer();this._add("mapEvent",new wn(t,e));var r=t.boxZoom=new Tn(t,e);this._add("boxZoom",r);var n=new In,a=new Yn;t.doubleClickZoom=new Hn(a,n),this._add("tapZoom",n),this._add("clickZoom",a);var o=new Kn;this._add("tapDragZoom",o);var s=t.touchPitch=new Nn(t);this._add("touchPitch",s);var l=new Pn(e),u=new Dn(e);t.dragRotate=new $n(e,l,u),this._add("mouseRotate",l,["mousePitch"]),this._add("mousePitch",u,["mouseRotate"]);var c=new zn(e),h=new Ln(t,e);t.dragPan=new Jn(i,c,h),this._add("mousePan",c),this._add("touchPan",h,["touchZoom","touchRotate"]);var f=new Vn,d=new Fn;t.touchZoomRotate=new Qn(i,d,f,o),this._add("touchRotate",f,["touchPan","touchZoom"]),this._add("touchZoom",d,["touchPan","touchRotate"]),this._add("blockableMapEvent",new kn(t));var p=t.scrollZoom=new Xn(t,this);this._add("scrollZoom",p,["mousePan"]);var m=t.keyboard=new Zn;this._add("keyboard",m);for(var v=0,y=["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"];v<y.length;v++){var _=y[v];e.interactive&&e[_]&&t[_].enable(e[_])}}},{key:"_add",value:function(e,t,i){this._handlers.push({handlerName:e,handler:t,allowed:i}),this._handlersById[e]=t}},{key:"stop",value:function(e){if(!this._updatingCamera){var t,i=l(this._handlers);try{for(i.s();!(t=i.n()).done;){t.value.handler.reset()}}catch(r){i.e(r)}finally{i.f()}this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}},{key:"isActive",value:function(){var e,t=l(this._handlers);try{for(t.s();!(e=t.n()).done;){if(e.value.handler.isActive())return!0}}catch(i){t.e(i)}finally{t.f()}return!1}},{key:"isZooming",value:function(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}},{key:"isRotating",value:function(){return!!this._eventsInProgress.rotate}},{key:"isMoving",value:function(){return!!ea(this._eventsInProgress)||this.isZooming()}},{key:"_isDragging",value:function(){return!!this._eventsInProgress.drag}},{key:"_blockedByActive",value:function(e,t,i){for(var r in e)if(r!==i&&(!t||t.indexOf(r)<0))return!0;return!1}},{key:"handleWindowEvent",value:function(e){this.handleEvent(e,"".concat(e.type,"Window"))}},{key:"_getMapTouches",value:function(e){var t,i=[],r=l(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;this._el.contains(n.target)&&i.push(n)}}catch(a){r.e(a)}finally{r.f()}return i}},{key:"handleEvent",value:function(e,t){this._updatingCamera=!0;var i,r="renderFrame"===e.type,n=r?void 0:e,a={needsRenderFrame:!1},o={},s={},u=e.touches?this._getMapTouches(e.touches):void 0,c=u?I(this._el,u):r?void 0:S(this._el,e),h=l(this._handlers);try{for(h.s();!(i=h.n()).done;){var f=i.value,d=f.handlerName,p=f.handler,m=f.allowed;if(p.isEnabled()){var v=void 0;this._blockedByActive(s,m,d)?p.reset():p[t||e.type]&&(v=p[t||e.type](e,c,u),this.mergeHandlerResult(a,o,v,d,n),v&&v.needsRenderFrame&&this._triggerRenderFrame()),(v||p.isActive())&&(s[d]=p)}}}catch(x){h.e(x)}finally{h.f()}var y={};for(var _ in this._previousActiveHandlers)s[_]||(y[_]=n);this._previousActiveHandlers=s,(Object.keys(y).length||ra(a))&&(this._changes.push([a,o,y]),this._triggerRenderFrame()),(Object.keys(s).length||ra(a))&&this._map._stop(!0),this._updatingCamera=!1;var g=a.cameraAnimation;g&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],g(this._map))}},{key:"mergeHandlerResult",value:function(e,t,r,n,a){if(r){i.extend(e,r);var o={handlerName:n,originalEvent:r.originalEvent||a};void 0!==r.zoomDelta&&(t.zoom=o),void 0!==r.panDelta&&(t.drag=o),void 0!==r.pitchDelta&&(t.pitch=o),void 0!==r.bearingDelta&&(t.rotate=o)}}},{key:"_applyChanges",value:function(){var e,t={},r={},n={},o=l(this._changes);try{for(o.s();!(e=o.n()).done;){var s=a(e.value,3),u=s[0],c=s[1],h=s[2];u.panDelta&&(t.panDelta=(t.panDelta||new i.pointGeometry(0,0))._add(u.panDelta)),u.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+u.zoomDelta),u.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+u.bearingDelta),u.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+u.pitchDelta),void 0!==u.around&&(t.around=u.around),void 0!==u.aroundCoord&&(t.aroundCoord=u.aroundCoord),void 0!==u.pinchAround&&(t.pinchAround=u.pinchAround),u.noInertia&&(t.noInertia=u.n
1oInertia),i.extend(r,c),i.extend(n,h)}}catch(f){o.e(f)}finally{o.f()}this._updateMapTransform(t,r,n),this._changes=[]}},{key:"_updateMapTransform",value:function(e,t,r){var n=this,a=this._map,o=a.transform,s=function(e){return[e.x,e.y,e.z]};if(function(e){var t=n._eventsInProgress.drag;return t&&!n._handlersById[t.handlerName].isActive()}()&&!ra(e)){var l=o.zoom;o.cameraElevationReference="sea",o.recenterOnTerrain(),o.cameraElevationReference="ground",l!==o.zoom&&this._map._update(!0)}if(o._isCameraConstrained&&a._stop(!0),ra(e)){var u=e.panDelta,c=e.zoomDelta,h=e.bearingDelta,f=e.pitchDelta,d=e.around,p=e.aroundCoord,m=e.pinchAround;o._isCameraConstrained&&(c>0&&(c=0),o._isCameraConstrained=!1),void 0!==m&&(d=m),(c||t.drag&&!n._eventsInProgress.drag)&&d&&(this._dragOrigin=s(o.pointCoordinate3D(d)),this._trackingEllipsoid.setup(o._camera.position,this._dragOrigin)),o.cameraElevationReference="sea",a._stop(!0),d=d||a.transform.centerPoint,h&&(o.bearing+=h),f&&(o.pitch+=f),o._updateCameraState();var v=[0,0,0];if(u)if("mercator"===o.projection.name){var y=this._trackingEllipsoid.projectRay(o.screenPointToMercatorRay(d).dir),_=this._trackingEllipsoid.projectRay(o.screenPointToMercatorRay(d.sub(u)).dir);v[0]=_[0]-y[0],v[1]=_[1]-y[1]}else{var g=o.pointCoordinate(d);if("globe"===o.projection.name){u=u.rotate(-o.angle);var x=o._pixelsPerMercatorPixel/o.worldSize;v[0]=-u.x*i.mercatorScale(i.latFromMercatorY(g.y))*x,v[1]=-u.y*i.mercatorScale(o.center.lat)*x}else{var b=o.pointCoordinate(d.sub(u));g&&b&&(v[0]=b.x-g.x,v[1]=b.y-g.y)}}var w=o.zoom,k=[0,0,0];if(c){var T=s(p||o.pointCoordinate3D(d)),E={dir:i.normalize([],i.sub([],T,o._camera.position))};if(E.dir[2]<0){var M=o.zoomDeltaToMovement(T,c);i.scale$2(k,E.dir,M)}}var S=i.add(v,v,k);o._translateCameraConstrained(S),c&&Math.abs(o.zoom-w)>1e-4&&o.recenterOnTerrain(),o.cameraElevationReference="ground",this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t,r,!0)}else this._fireEvents(t,r,!0)}},{key:"_fireEvents",value:function(e,t,r){var n=this,a=ea(this._eventsInProgress),o=ea(e),s={};for(var l in e){var u=e[l].originalEvent;this._eventsInProgress[l]||(s["".concat(l,"start")]=u),this._eventsInProgress[l]=e[l]}for(var c in!a&&o&&this._fireEvent("movestart",o.originalEvent),s)this._fireEvent(c,s[c]);for(var h in o&&this._fireEvent("move",o.originalEvent),e){var f=e[h].originalEvent;this._fireEvent(h,f)}var d,p={};for(var m in this._eventsInProgress){var v=this._eventsInProgress[m],y=v.handlerName,_=v.originalEvent;this._handlersById[y].isActive()||(delete this._eventsInProgress[m],d=t[y]||_,p["".concat(m,"end")]=d)}for(var g in p)this._fireEvent(g,p[g]);var x=ea(this._eventsInProgress);if(r&&(a||o)&&!x){this._updatingCamera=!0;var b=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),w=function(e){return 0!==e&&-n._bearingSnap<e&&e<n._bearingSnap};b?(w(b.bearing||this._map.getBearing())&&(b.bearing=0),this._map.easeTo(b,{originalEvent:d})):(this._map.fire(new i.Event("moveend",{originalEvent:d})),w(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}},{key:"_fireEvent",value:function(e,t){this._map.fire(new i.Event(e,t?{originalEvent:t}:{}))}},{key:"_requestFrame",value:function(){var e=this;return this._map.triggerRepaint(),this._map._renderTaskQueue.add(function(t){e._frameId=void 0,e.handleEvent(new ta("renderFrame",{timeStamp:t})),e._applyChanges()})}},{key:"_triggerRenderFrame",value:function(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}]),e}(),aa="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.",oa=function(e){p(r,e);var t=m(r);function r(e,n){var a;return h(this,r),(a=t.call(this))._moving=!1,a._zooming=!1,a.transform=e,a._bearingSnap=n.bearingSnap,i.bindAll(["_renderFrameCallback"],y(a)),a}return d(r,[{key:"getCenter",value:function(){return new i.LngLat(this.transform.center.lng,this.transform.center.lat)}},{key:"setCenter",value:function(e,t){return this.jumpTo({center:e},t)}},{key:"panBy",value:function(e,t,r){return e=i.pointGeometry.convert(e).mult(-1),this.panTo(this.transform.center,i.extend({offset:e},t),r)}},{key:"panTo",value:function(e,t,r){return this.easeTo(i.extend({center:e},t),r)}},{key:"getZoom",value:function(){return this.transform.zoom}},{key:"setZoom",value:function(e,t){return this.jumpTo({zoom:e},t),this}},{key:"zoomTo",value:function(e,t,r){return this.easeTo(i.extend({zoom:e},t),r)}},{key:"zoomIn",value:function(e,t){return this.zoomTo(this.getZoom()+1,e,t),this}},{key:"zoomOut",value:function(e,t){return this.zoomTo(this.getZoom()-1,e,t),this}},{key:"getBearing",value:function(){return this.transform.bearing}},{key:"setBearing",value:function(e,t){return this.jumpTo({bearing:e},t),this}},{key:"getPadding",value:function(){return this.transform.padding}},{key:"setPadding",value:function(e,t){return this.jumpTo({padding:e},t),this}},{key:"rotateTo",value:function(e,t,r){return this.easeTo(i.extend({bearing:e},t),r)}},{key:"resetNorth",value:function(e,t){return this.rotateTo(0,i.extend({duration:1e3},e),t),this}},{key:"resetNorthPitch",value:function(e,t){return this.easeTo(i.extend({bearing:0,pitch:0,duration:1e3},e),t),this}},{key:"snapToNorth",value:function(e,t){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,t):this}},{key:"getPitch",value:function(){return this.transform.pitch}},{key:"setPitch",value:function(e,t){return this.jumpTo({pitch:e},t),this}},{key:"cameraForBounds",value:function(e,t){e=i.LngLatBounds.convert(e);var r=t&&t.bearing||0,n=t&&t.pitch||0,a=e.getNorthWest(),o=e.getSouthEast();return this._cameraForBounds(this.transform,a,o,r,n,t)}},{key:"_extendCameraOptions",value:function(e){var t={top:0,bottom:0,right:0,left:0};if("number"==typeof(e=i.extend({padding:t,offset:[0,0],maxZoom:this.transform.maxZoom},e)).padding){var r=e.padding;e.padding={top:r,bottom:r,right:r,left:r}}return e.padding=i.extend(t,e.padding),e}},{key:"_minimumAABBFrustumDistance",value:function(e,t){var i=t.max[0]-t.min[0],r=t.max[1]-t.min[1];return i/r>e.aspect?i/(2*Math.tan(.5*e.fovX)*e.aspect):r/(2*Math.tan(.5*e.fovY)*e.aspect)}},{key:"_cameraForBoundsOnGlobe",value:function(e,t,r,n,a,o){var s=e.clone(),l=this._extendCameraOptions(o);s.bearing=n,s.pitch=a;var u=i.LngLat.convert(t),c=i.LngLat.convert(r),h=.5*(u.lat+c.lat),f=.5*(u.lng+c.lng),d=i.latLngToECEF(h,f),p=i.normalize([],d),m=i.normalize([],i.cross([],p,[0,1,0])),v=i.cross([],m,p),y=[m[0],m[1],m[2],0,v[0],v[1],v[2],0,p[0],p[1],p[2],0,0,0,0,1],_=[d,i.latLngToECEF(u.lat,u.lng),i.latLngToECEF(c.lat,u.lng),i.latLngToECEF(c.lat,c.lng),i.latLngToECEF(u.lat,c.lng),i.latLngToECEF(h,u.lng),i.latLngToECEF(h,c.lng),i.latLngToECEF(u.lat,f),i.latLngToECEF(c.lat,f)],g=i.Aabb.fromPoints(_.map(function(e){return[i.dot(m,e),i.dot(v,e),i.dot(p,e)]})),x=i.transformMat4([],g.center,y);0===i.squaredLength(x)&&i.set(x,0,0,1),i.normalize(x,x),i.scale$2(x,x,i.GLOBE_RADIUS),s.center=i.ecefToLatLng(x);var b=s.getWorldToCameraMatrix(),w=i.invert(new Float64Array(16),b);g=i.Aabb.applyTransform(g,i.multiply([],b,y)),i.transformMat4(x,x,b);var k=.5*(g.max[2]-g.min[2]),T=this._minimumAABBFrustumDistance(s,g),E=i.scale$2([],[0,0,1],k),M=i.add(E,x,E),S=T+(0===s.pitch?0:i.distance(x,M)),I=s.globeCenterInViewSpace,C=i.sub([],x,[I[0],I[1],I[2]]);i.normalize(C,C),i.scale$2(C,C,S);var A=i.add([],x,C);i.transformMat4(A,A,w);var z=i.earthRadius/i.GLOBE_RADIUS,P=i.length(A),D=i.mercatorZfromAltitude(Math.max(P*z-i.earthRadius,Number.EPSILON),0),L=Math.min(s.zoomFromMercatorZAdjusted(D),l.maxZoom);return L>.5*(i.GLOBE_ZOOM_THRESHOLD_MIN+i.GLOBE_ZOOM_THRESHOLD_MAX)?(s.setProjection({name:"mercator"}),s.zoom=L,this._cameraForBounds(s,t,r,n,a,o)):{center:s.center,zoom:L,bearing:n,pitch:a}}},{key:"queryTerrainElevation",value:function(e,t){var r=this.transform.elevation;return r?(t=i.extend({},{exaggerated:!0},t),r.getAtPoint(i.MercatorCoordinate.fromLngLat(e),null,t.exaggerated)):null}},{key:"_cameraForBounds",value:function(e,t,r,n,a,o){if("globe"===e.projection.name)return this._cameraForBoundsOnGlobe(e,t,r,n,a,o);var s=e.clone(),l=this._extendCameraOptions(o),u=s.padding;s.bearing=n,s.pitch=a;var c=i.LngLat.convert(t),h=i.LngLat.convert(r),f=new i.LngLat(c.lng,h.lat),d=new i.LngLat(h.lng,c.lat),p=s.project(c),m=s.project(h),v=this.queryTerrainElevation(c),y=this.queryTerrainElevation(h),_=this.queryTerrainElevation(f),g=this.queryTerrainElevation(d),x=[[p.x,p.y,Math.min(v||0,y||0,_||0,g||0)],[m.x,m.y,Math.max(v||0,y||0,_||0,g||0)]],b=i.Aabb.fromPoints(x),w=s.getWorldToCameraMatrix(),k=i.invert(new Float64Array(16),w);b=i.Aabb.applyTransform(b,w);var T=i.sub([],b.max,b.min),E=u.left||0,M=u.right||0,S=u.bottom||0,I=u.top||0,
1C=l.padding,A=C.left,z=C.right,P=C.top,D=C.bottom,L=.5*(E+M),R=.5*(I+S),B=Math.min(s.scaleZoom(s.scale*Math.min((s.width-(E+M+A+z))/T[0],(s.height-(S+I+D+P))/T[1])),l.maxZoom),O=s.scale/s.zoomScale(B);b=new i.Aabb([b.min[0]-(A+L)*O,b.min[1]-(D+R)*O,b.min[2]],[b.max[0]+(z+L)*O,b.max[1]+(P+R)*O,b.max[2]]);var F=.5*T[2],U=this._minimumAABBFrustumDistance(s,b),V=[0,0,1,0];i.transformMat4$1(V,V,w),i.normalize$2(V,V);var j=i.scale$2([],V,U+F),N=i.add([],b.center,j),G=("number"==typeof l.offset.x&&"number"==typeof l.offset.y?new i.pointGeometry(l.offset.x,l.offset.y):i.pointGeometry.convert(l.offset)).rotate(-i.degToRad(n));b.center[0]-=G.x*O,b.center[1]+=G.y*O,i.transformMat4(b.center,b.center,k),i.transformMat4(N,N,k);var Z=[b.center[0],b.center[1],N[2]*s.pixelsPerMeter];i.scale$2(Z,Z,1/s.worldSize);var q=i.lngFromMercatorX(Z[0]),W=i.latFromMercatorY(Z[1]),X=Math.min(s._zoomFromMercatorZ(Z[2]),l.maxZoom),H=new i.LngLat(q,W);return s.mercatorFromTransition&&X<.5*(i.GLOBE_ZOOM_THRESHOLD_MIN+i.GLOBE_ZOOM_THRESHOLD_MAX)?(s.setProjection({name:"globe"}),s.zoom=X,this._cameraForBounds(s,t,r,n,a,o)):{center:H,zoom:X,bearing:n,pitch:a}}},{key:"fitBounds",value:function(e,t,i){var r=this.cameraForBounds(e,t);return this._fitInternal(r,t,i)}},{key:"fitScreenCoordinates",value:function(e,t,r,n,a){var o=i.pointGeometry.convert(e),s=i.pointGeometry.convert(t),l=new i.pointGeometry(Math.min(o.x,s.x),Math.min(o.y,s.y)),u=new i.pointGeometry(Math.max(o.x,s.x),Math.max(o.y,s.y));if("mercator"===this.transform.projection.name&&this.transform.anyCornerOffEdge(o,s))return this;var c=this.transform.pointLocation3D(l),h=this.transform.pointLocation3D(u),f=this.transform.pointLocation3D(new i.pointGeometry(l.x,u.y)),d=this.transform.pointLocation3D(new i.pointGeometry(u.x,l.y)),p=[Math.min(c.lng,h.lng,f.lng,d.lng),Math.min(c.lat,h.lat,f.lat,d.lat)],m=[Math.max(c.lng,h.lng,f.lng,d.lng),Math.max(c.lat,h.lat,f.lat,d.lat)],v=n&&n.pitch?n.pitch:this.getPitch(),y=this._cameraForBounds(this.transform,p,m,r,v,n);return this._fitInternal(y,n,a)}},{key:"_fitInternal",value:function(e,t,r){return e?(delete(t=i.extend(e,t)).padding,t.linear?this.easeTo(t,r):this.flyTo(t,r)):this}},{key:"jumpTo",value:function(e,t){this.stop();var r=e.preloadOnly?this.transform.clone():this.transform,n=!1,a=!1,o=!1;return"zoom"in e&&r.zoom!==+e.zoom&&(n=!0,r.zoom=+e.zoom),void 0!==e.center&&(r.center=i.LngLat.convert(e.center)),"bearing"in e&&r.bearing!==+e.bearing&&(a=!0,r.bearing=+e.bearing),"pitch"in e&&r.pitch!==+e.pitch&&(o=!0,r.pitch=+e.pitch),null==e.padding||r.isPaddingEqual(e.padding)||(r.padding=e.padding),e.preloadOnly?(this._preloadTiles(r),this):(this.fire(new i.Event("movestart",t)).fire(new i.Event("move",t)),n&&this.fire(new i.Event("zoomstart",t)).fire(new i.Event("zoom",t)).fire(new i.Event("zoomend",t)),a&&this.fire(new i.Event("rotatestart",t)).fire(new i.Event("rotate",t)).fire(new i.Event("rotateend",t)),o&&this.fire(new i.Event("pitchstart",t)).fire(new i.Event("pitch",t)).fire(new i.Event("pitchend",t)),this.fire(new i.Event("moveend",t)))}},{key:"getFreeCameraOptions",value:function(){return this.transform.projection.supportsFreeCamera||i.warnOnce(aa),this.transform.getFreeCameraOptions()}},{key:"setFreeCameraOptions",value:function(e,t){var r=this.transform;if(!r.projection.supportsFreeCamera)return i.warnOnce(aa),this;this.stop();var n=r.zoom,a=r.pitch,o=r.bearing;r.setFreeCameraOptions(e);var s=n!==r.zoom,l=a!==r.pitch,u=o!==r.bearing;return this.fire(new i.Event("movestart",t)).fire(new i.Event("move",t)),s&&this.fire(new i.Event("zoomstart",t)).fire(new i.Event("zoom",t)).fire(new i.Event("zoomend",t)),u&&this.fire(new i.Event("rotatestart",t)).fire(new i.Event("rotate",t)).fire(new i.Event("rotateend",t)),l&&this.fire(new i.Event("pitchstart",t)).fire(new i.Event("pitch",t)).fire(new i.Event("pitchend",t)),this.fire(new i.Event("moveend",t)),this}},{key:"easeTo",value:function(e,t){var r=this;this._stop(!1,e.easeId),(!1===(e=i.extend({offset:[0,0],duration:500,easing:i.ease},e)).animate||!e.essential&&i.exported.prefersReducedMotion)&&(e.duration=0);var n,a,o,s=this.transform,l=this.getZoom(),u=this.getBearing(),c=this.getPitch(),h=this.getPadding(),f="zoom"in e?+e.zoom:l,d="bearing"in e?this._normalizeBearing(e.bearing,u):u,p="pitch"in e?+e.pitch:c,m="padding"in e?e.padding:s.padding,v=i.pointGeometry.convert(e.offset);if("globe"===s.projection.name){var y=i.MercatorCoordinate.fromLngLat(s.center),_=v.rotate(-s.angle);
1y.x+=_.x/s.worldSize,y.y+=_.y/s.worldSize;var g=y.toLngLat(),x=i.LngLat.convert(e.center||g);this._normalizeCenter(x),n=s.centerPoint.add(_),a=new i.pointGeometry(y.x,y.y).mult(s.worldSize),o=new i.pointGeometry(i.mercatorXfromLng(x.lng),i.mercatorYfromLat(x.lat)).mult(s.worldSize).sub(a)}else{n=s.centerPoint.add(v);var b=s.pointLocation(n),w=i.LngLat.convert(e.center||b);this._normalizeCenter(w),a=s.project(b),o=s.project(w).sub(a)}var k,T,E=s.zoomScale(f-l);e.around&&(k=i.LngLat.convert(e.around),T=s.locationPoint(k));var M=this._zooming||f!==l,S=this._rotating||u!==d,I=this._pitching||p!==c,C=!s.isPaddingEqual(m),A=function(s){return function(y){if(M&&(s.zoom=i.number(l,f,y)),S&&(s.bearing=i.number(u,d,y)),I&&(s.pitch=i.number(c,p,y)),C&&(s.interpolatePadding(h,m,y),n=s.centerPoint.add(v)),k)s.setLocationAtPoint(k,T);else{var _=s.zoomScale(s.zoom-l),g=f>l?Math.min(2,E):Math.max(.5,E),x=Math.pow(g,1-y),b=s.unproject(a.add(o.mult(y*x)).mult(_));s.setLocationAtPoint(s.renderWorldCopies?b.wrap():b,n)}return e.preloadOnly||r._fireMoveEvents(t),s}};if(e.preloadOnly){var z=this._emulate(A,e.duration,s);return this._preloadTiles(z),this}var P={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=M,this._rotating=S,this._pitching=I,this._padding=C,this._easeId=e.easeId,this._prepareEase(t,e.noMoveStart,P),this._ease(A(s),function(e){s.recenterOnTerrain(),r._afterEase(t,e)},e),this}},{key:"_prepareEase",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this._moving=!0,this.transform.cameraElevationReference="sea",t||r.moving||this.fire(new i.Event("movestart",e)),this._zooming&&!r.zooming&&this.fire(new i.Event("zoomstart",e)),this._rotating&&!r.rotating&&this.fire(new i.Event("rotatestart",e)),this._pitching&&!r.pitching&&this.fire(new i.Event("pitchstart",e))}},{key:"_fireMoveEvents",value:function(e){this.fire(new i.Event("move",e)),this._zooming&&this.fire(new i.Event("zoom",e)),this._rotating&&this.fire(new i.Event("rotate",e)),this._pitching&&this.fire(new i.Event("pitch",e))}},{key:"_afterEase",value:function(e,t){if(!this._easeId||!t||this._easeId!==t){this._easeId=void 0,this.transform.cameraElevationReference="ground";var r=this._zooming,n=this._rotating,a=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,r&&this.fire(new i.Event("zoomend",e)),n&&this.fire(new i.Event("rotateend",e)),a&&this.fire(new i.Event("pitchend",e)),this.fire(new i.Event("moveend",e))}}},{key:"flyTo",value:function(e,t){var r=this;if(!e.essential&&i.exported.prefersReducedMotion){var n=i.pick(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(n,t)}this.stop(),e=i.extend({offset:[0,0],speed:1.2,curve:1.42,easing:i.ease},e);var a=this.transform,o=this.getZoom(),s=this.getBearing(),l=this.getPitch(),u=this.getPadding(),c="zoom"in e?i.clamp(+e.zoom,a.minZoom,a.maxZoom):o,h="bearing"in e?this._normalizeBearing(e.bearing,s):s,f="pitch"in e?+e.pitch:l,d="padding"in e?e.padding:a.padding,p=a.zoomScale(c-o),m=i.pointGeometry.convert(e.offset),v=a.centerPoint.add(m),y=a.pointLocation(v),_=i.LngLat.convert(e.center||y);this._normalizeCenter(_);var g=a.project(y),x=a.project(_).sub(g),b=e.curve,w=Math.max(a.width,a.height),k=w/p,T=x.mag();
1if("minZoom"in e){var E=i.clamp(Math.min(e.minZoom,o,c),a.minZoom,a.maxZoom),M=w/a.zoomScale(E-o);b=Math.sqrt(M/T*2)}var S=b*b;function I(e){var t=(k*k-w*w+(e?-1:1)*S*S*T*T)/(2*(e?k:w)*S*T);return Math.log(Math.sqrt(t*t+1)-t)}function C(e){return(Math.exp(e)-Math.exp(-e))/2}function A(e){return(Math.exp(e)+Math.exp(-e))/2}var z=I(0),P=function(e){return A(z)/A(z+b*e)},D=function(e){return w*((A(z)*(C(t=z+b*e)/A(t))-C(z))/S)/T;var t},L=(I(1)-z)/b;if(Math.abs(T)<1e-6||!isFinite(L)){if(Math.abs(w-k)<1e-6)return this.easeTo(e,t);var R=k<w?-1:1;L=Math.abs(Math.log(k/w))/b,D=function(){return 0},P=function(e){return Math.exp(R*b*e)}}e.duration="duration"in e?+e.duration:1e3*L/("screenSpeed"in e?+e.screenSpeed/b:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0);var B=s!==h,O=f!==l,F=!a.isPaddingEqual(d),U=function(n){return function(a){var p=a*L,y=1/P(p);n.zoom=1===a?c:o+n.scaleZoom(y),B&&(n.bearing=i.number(s,h,a)),O&&(n.pitch=i.number(l,f,a)),F&&(n.interpolatePadding(u,d,a),v=n.centerPoint.add(m));var b=1===a?_:n.unproject(g.add(x.mult(D(p))).mult(y));return n.setLocationAtPoint(n.renderWorldCopies?b.wrap():b,v),n._updateCameraOnTerrain(),e.preloadOnly||r._fireMoveEvents(t),n}};if(e.preloadOnly){var V=this._emulate(U,e.duration,a);return this._preloadTiles(V),this}return this._zooming=!0,this._rotating=B,this._pitching=O,this._padding=F,this._prepareEase(t,!1),this._ease(U(a),function(){return r._afterEase(t)},e),this}},{key:"isEasing",value:function(){return!!this._easeFrameId}},{key:"stop",value:function(){return this._stop()}},{key:"_stop",value:function(e,t){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){var i=this._onEaseEnd;this._onEaseEnd=void 0,i.call(this,t)}if(!e){var r=this.handlers;r&&r.stop(!1)}return this}},{key:"_ease",value:function(e,t,r){!1===r.animate||0===r.duration?(e(1),t()):(this._easeStart=i.exported.now(),this._easeOptions=r,this._onEaseFrame=e,this._onEaseEnd=t,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}},{key:"_renderFrameCallback",value:function(){var e=Math.min((i.exported.now()-this._easeStart)/this._easeOptions.duration,1),t=this._onEaseFrame;t&&t(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}},{key:"_normalizeBearing",value:function(e,t){e=i.wrap(e,-180,180);var r=Math.abs(e-t);return Math.abs(e-360-t)<r&&(e-=360),Math.abs(e+360-t)<r&&(e+=360),e}},{key:"_normalizeCenter",value:function(e){var t=this.transform;if(t.renderWorldCopies&&!t.maxBounds){var i=e.lng-t.center.lng;e.lng+=i>180?-360:i<-180?360:0}}},{key:"_emulate",value:function(e,t,i){for(var r=Math.ceil(15*t/1e3),n=[],a=e(i.clone()),o=0;o<=r;o++){var s=a(o/r);n.push(s.clone())}return n}}]),r}(i.Evented),sa=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};h(this,e),this.options=t,i.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}return d(e,[{key:"getDefaultPosition",value:function(){return"bottom-right"}},{key:"onAdd",value:function(e){var t=this.options&&this.options.compact;return this._map=e,this._container=c("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=c("button","mapboxgl-ctrl-attrib-button",this._container),c("span","mapboxgl-ctrl-icon",this._compactButton).setAttribute("aria-hidden","true"),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=c("div","mapboxgl-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),t&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===t&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}},{key:"onRemove",value:function(){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}},{key:"_setElementTitle",value:function(e,t){var i=this._map._getUIString("AttributionControl.".concat(t));e.setAttribute("aria-label",i),e.removeAttribute("title"),e.firstElementChild&&e.firstElementChild.setAttribute("title",i)}},{key:"_toggleAttribution",value:function(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","fal
1se")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}},{key:"_updateEditLink",value:function(){var e=this._editLink;e||(e=this._editLink=this._container.querySelector(".mapbox-improve-map"));var t=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||i.config.ACCESS_TOKEN}];if(e){var r=t.reduce(function(e,i,r){return i.value&&(e+="".concat(i.key,"=").concat(i.value).concat(r<t.length-1?"&":"")),e},"?");e.href="".concat(i.config.FEEDBACK_URL,"/").concat(r,"#").concat(cn(this._map,!0)),e.rel="noopener nofollow",this._setElementTitle(e,"MapFeedback")}}},{key:"_updateData",value:function(e){!e||"metadata"!==e.sourceDataType&&"visibility"!==e.sourceDataType&&"style"!==e.dataType||(this._updateAttributions(),this._updateEditLink())}},{key:"_updateAttributions",value:function(){if(this._map.style){var e=[];if(this._map.style.stylesheet){var t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id}var i=this._map.style._sourceCaches;for(var n in i){var a=i[n];if(a.used){var o=a.getSource();o.attribution&&e.indexOf(o.attribution)<0&&e.push(o.attribution)}}e.sort(function(e,t){return e.length-t.length}),e=e.filter(function(t,i){for(var r=i+1;r<e.length;r++)if(e[r].indexOf(t)>=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=[].concat(r(this.options.customAttribution),r(e)):e.unshift(this.options.customAttribution));var s=e.join(" | ");s!==this._attribHTML&&(this._attribHTML=s,e.length?(this._innerContainer.innerHTML=s,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}}},{key:"_updateCompact",value:function(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}]),e}(),la=function(){function e(){h(this,e),i.bindAll(["_updateLogo","_updateCompact"],this)}return d(e,[{key:"onAdd",value:function(e){this._map=e,this._container=c("div","mapboxgl-ctrl");var t=c("a","mapboxgl-ctrl-logo");return t.target="_blank",t.rel="noopener nofollow",t.href="https://www.mapbox.com/",t.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),t.setAttribute("rel","noopener nofollow"),this._container.appendChild(t),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}},{key:"onRemove",value:function(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}},{key:"getDefaultPosition",value:function(){return"bottom-left"}},{key:"_updateLogo",value:function(e){e&&"metadata"!==e.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")}},{key:"_logoRequired",value:function(){if(!this._map.style)return!0;var e=this._map.style._sourceCaches;if(0===Object.entries(e).length)return!0;for(var t in e){var i=e[t].getSource();if(i.hasOwnProperty("mapbox_logo")&&!i.mapbox_logo)return!1}return!0}},{key:"_updateCompact",value:function(){var e=this._container.children;if(e.length){var t=e[0];this._map.getCanvasContainer().offsetWidth<250?t.classList.add("mapboxgl-compact"):t.classList.remove("mapboxgl-compact")}}}]),e}(),ua=function(){function e(){h(this,e),this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}return d(e,[{key:"add",value:function(e){var t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}},{key:"remove",value:function(e){var t,i=this._currentlyRunning,r=l(i?this._queue.concat(i):this._queue);try{for(r.s();!(t=r.n()).done;){var n=t.value;if(n.id===e)return void(n.cancelled=!0)}}catch(a){r.e(a)}finally{r.f()}}},{key:"run",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=this._currentlyRunning=this._queue;this._queue=[];var i,r=l(t);try{for(r.s();!(i=r.n()).done;){var n=i.value;if(!n.cancelled&&(n.callback(e),this._cleared))break}}catch(a){r.e(a)}finally{r.f()}this._cleared=!1,this._currentlyRunning=!1}},{key:"clear",value:function(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}]),e}();function ca(e,t,r){if(e=new i.LngLat(e.lng,e.lat),t){var n=new i.LngLat(e.lng-360,e.lat),a=new i.LngLat(e.lng+360,e.lat),o=360*Math.ceil(Math.abs(e.lng-r.center.lng)/360),s=r.locationPoint(e).distSqr(t),l=t.x<0||t.y<0||t.x>r.width||t.y>r.height;r.locationPoint(n).distSqr(t)<s&&(l||Math.abs(n.lng-r.center.lng)<o)?e=n:r.locationPoint(a).distSqr(t)<s&&(l||Math.abs(a.lng-r.center.lng)<o)&&(e=a)}for(;Math.abs(e.lng-r.center.lng)>180;){var u=r.locationPoint(e);if(u.x>=0&&u.y>=0&&u.x<=r.width&&u.y<=r.height)break;e.lng>r.center.lng?e.lng-=360:e.lng+=360}return e}
1var ha={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%)"},fa=function(e){p(r,e);var t=m(r);function r(e,n){var a;if(h(this,r),a=t.call(this),(e instanceof i.window.HTMLElement||n)&&(e=i.extend({element:e},n)),i.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],y(a)),a._anchor=e&&e.anchor||"center",a._color=e&&e.color||"#3FB1CE",a._scale=e&&e.scale||1,a._draggable=e&&e.draggable||!1,a._clickTolerance=e&&e.clickTolerance||0,a._isDragging=!1,a._state="inactive",a._rotation=e&&e.rotation||0,a._rotationAlignment=e&&e.rotationAlignment||"auto",a._pitchAlignment=e&&e.pitchAlignment&&e.pitchAlignment||"auto",a._updateMoving=function(){return a._update(!0)},a._occludedOpacity=e&&e.occludedOpacity||.2,e&&e.element)a._element=e.element,a._offset=i.pointGeometry.convert(e&&e.offset||[0,0]);else{a._defaultMarker=!0,a._element=c("div");var o=f("svg",{display:"block",height:41*a._scale+"px",width:27*a._scale+"px",viewBox:"0 0 ".concat(27," ").concat(41)},a._element),s=f("radialGradient",{id:"shadowGradient"},f("defs",{},o));f("stop",{offset:"10%","stop-opacity":.4},s),f("stop",{offset:"100%","stop-opacity":.05},s),f("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},o),f("path",{fill:a._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},o),f("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},o),f("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},o),a._offset=i.pointGeometry.convert(e&&e.offset||[0,-14])}a._element.hasAttribute("aria-label")||a._element.setAttribute("aria-label","Map marker"),a._element.classList.add("mapboxgl-marker"),a._element.addEventListener("dragstart",function(e){e.preventDefault()}),a._element.addEventListener("mousedown",function(e){e.preventDefault()});var l=a._element.classList;for(var u in ha)l.remove("mapboxgl-marker-anchor-".concat(u));return l.add("mapboxgl-marker-anchor-".concat(a._anchor)),a._popup=null,v(a)}return d(r,[{key:"addTo",value:function(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}},{key:"remove",value:function(){var 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}},{key:"getLngLat",value:function(){return this._lngLat}},{key:"setLngLat",value:function(e){return this._lngLat=i.LngLat.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}},{key:"getElement",value:function(){return this._element}},{key:"setPopup",value:function(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)){var t=38.1,i=13.5,r=Math.sqrt(Math.pow(i,2)/2);e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
10,-t],"bottom-left":[r,-1*(t-i+r)],"bottom-right":[-r,-1*(t-i+r)],left:[i,-24.6],right:[-i,-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}},{key:"_onKeyPress",value:function(e){var t=e.code,i=e.charCode||e.keyCode;"Space"!==t&&"Enter"!==t&&32!==i&&13!==i||this.togglePopup()}},{key:"_onMapClick",value:function(e){var t=e.originalEvent.target,i=this._element;this._popup&&(t===i||i.contains(t))&&this.togglePopup()}},{key:"getPopup",value:function(){return this._popup}},{key:"togglePopup",value:function(){var e=this._popup;return e?(e.isOpen()?(e.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(e.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}},{key:"_behindTerrain",value:function(){var e=this._map,t=this._pos;if(!e||!t)return!1;var i=e.unproject(t),r=e.getFreeCameraOptions();if(!r.position)return!1;var n=r.position.toLngLat();return n.distanceTo(i)<.9*n.distanceTo(this._lngLat)}},{key:"_evaluateOpacity",value:function(){var e=this._map;if(e){var t=this._pos;if(!t||t.x<0||t.x>e.transform.width||t.y<0||t.y>e.transform.height)this._clearFadeTimer();else{var r,n=e.unproject(t);e._showingGlobe()&&i.isLngLatBehindGlobe(e.transform,this._lngLat)?r=0:(r=1-e._queryFogOpacity(n),e.transform._terrainEnabled()&&e.getTerrain()&&this._behindTerrain()&&(r*=this._occludedOpacity)),this._element.style.opacity="".concat(r),this._element.style.pointerEvents=r>0?"auto":"none",this._popup&&this._popup._setOpacity(r),this._fadeTimer=null}}}},{key:"_clearFadeTimer",value:function(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}},{key:"_updateDOM",value:function(){var e=this._pos;if(e&&this._map){var t=this._offset.mult(this._scale);this._element.style.transform="\n            translate(".concat(e.x,"px,").concat(e.y,"px)\n            ").concat(ha[this._anchor],"\n            ").concat(this._calculateXYTransform()," ").concat(this._calculateZTransform(),"\n            translate(").concat(t.x,"px,").concat(t.y,"px)\n        ")}}},{key:"_calculateXYTransform",value:function(){var e=this._pos,t=this._map,r=this.getPitchAlignment();if(!t||!e||"map"!==r)return"";if(!t._showingGlobe()){var n=t.getPitch();return n?"rotateX(".concat(n,"deg)"):""}var a=i.radToDeg(i.globeTiltAtLngLat(t.transform,this._lngLat)),o=e.sub(i.globeCenterToScreenPoint(t.transform)),s=Math.abs(o.x)+Math.abs(o.y);if(0===s)return"";var l=a/s;return"rotateX(".concat(-o.y*l,"deg) rotateY(").concat(o.x*l,"deg)")}},{key:"_calculateZTransform",value:function(){var e=this._pos,t=this._map;if(!t||!e)return"";var r=0,n=this.getRotationAlignment();if("map"===n)if(t._showingGlobe()){var a=t.project(new i.LngLat(this._lngLat.lng,this._lngLat.lat+.001)),o=t.project(new i.LngLat(this._lngLat.lng,this._lngLat.lat-.001)).sub(a);r=i.radToDeg(Math.atan2(o.y,o.x))-90}else r=-t.getBearing();else if("horizon"===n){var s=i.smoothstep(4,6,t.getZoom()),l=i.globeCenterToScreenPoint(t.transform);l.y+=s*t.transform.height;var u=e.sub(l),c=i.radToDeg(Math.atan2(u.y,u.x));r=(c>90?c-270:c+90)*(1-s)}return(r+=this._rotation)?"rotateZ(".concat(r,"deg)"):""}},{key:"_update",value:function(e){var t=this;i.window.cancelAnimationFrame(this._updateFrameId);var r=this._map;
1r&&(r.transform.renderWorldCopies&&(this._lngLat=ca(this._lngLat,this._pos,r.transform)),this._pos=r.project(this._lngLat),!0===e?this._updateFrameId=i.window.requestAnimationFrame(function(){t._element&&t._pos&&t._anchor&&(t._pos=t._pos.round(),t._updateDOM())}):this._pos=this._pos.round(),r._requestDomTask(function(){t._map&&(t._element&&t._pos&&t._anchor&&t._updateDOM(),(r._showingGlobe()||r.getTerrain()||r.getFog())&&!t._fadeTimer&&(t._fadeTimer=setTimeout(t._evaluateOpacity.bind(t),60)))}))}},{key:"getOffset",value:function(){return this._offset}},{key:"setOffset",value:function(e){return this._offset=i.pointGeometry.convert(e),this._update(),this}},{key:"_onMove",value:function(e){var t=this._map;if(t){var r=this._pointerdownPos,n=this._positionDelta;if(r&&n){if(!this._isDragging){var a=this._clickTolerance||t._clickTolerance;if(e.point.dist(r)<a)return;this._isDragging=!0}this._pos=e.point.sub(n),this._lngLat=t.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new i.Event("dragstart"))),this.fire(new i.Event("drag"))}}}},{key:"_onUp",value:function(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;var e=this._map;e&&(e.off("mousemove",this._onMove),e.off("touchmove",this._onMove)),"active"===this._state&&this.fire(new i.Event("dragend")),this._state="inactive"}},{key:"_addDragHandler",value:function(e){var t=this._map,i=this._pos;t&&i&&this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(i),this._pointerdownPos=e.point,this._state="pending",t.on("mousemove",this._onMove),t.on("touchmove",this._onMove),t.once("mouseup",this._onUp),t.once("touchend",this._onUp))}},{key:"setDraggable",value:function(e){this._draggable=!!e;var t=this._map;return t&&(e?(t.on("mousedown",this._addDragHandler),t.on("touchstart",this._addDragHandler)):(t.off("mousedown",this._addDragHandler),t.off("touchstart",this._addDragHandler))),this}},{key:"isDraggable",value:function(){return this._draggable}},{key:"setRotation",value:function(e){return this._rotation=e||0,this._update(),this}},{key:"getRotation",value:function(){return this._rotation}},{key:"setRotationAlignment",value:function(e){return this._rotationAlignment=e||"auto",this._update(),this}},{key:"getRotationAlignment",value:function(){return"auto"===this._rotationAlignment||"horizon"===this._rotationAlignment&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}},{key:"setPitchAlignment",value:function(e){return this._pitchAlignment=e||"auto",this._update(),this}},{key:"getPitchAlignment",value:function(){return"auto"===this._pitchAlignment?this.getRotationAlignment():this._pitchAlignment}},{key:"setOccludedOpacity",value:function(e){return this._occludedOpacity=e||.2,this._update(),this}},{key:"getOccludedOpacity",value:function(){return this._occludedOpacity}}]),r}(i.Evented),da={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},pa=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function ma(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new i.pointGeometry(0,0),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"bottom";if("number"==typeof e){var r=Math.round(Math.sqrt(.5*Math.pow(e,2)));switch(t){case"top":return new i.pointGeometry(0,e);case"top-left":return new i.pointGeometry(r,r);case"top-right":return new i.pointGeometry(-r,r);case"bottom":return new i.pointGeometry(0,-e);case"bottom-left":return new i.pointGeometry(r,-r);case"bottom-right":return new i.pointGeometry(-r,-r);case"left":return new i.pointGeometry(e,0);case"right":return new i.pointGeometry(-e,0)}return new i.pointGeometry(0,0)}return e instanceof i.pointGeometry||Array.isArray(e)?i.pointGeometry.convert(e):i.pointGeometry.convert(e[t]||[0,0])}var va=function(){function e(t){h(this,e),this.jumpTo(t)}return d(e,[{key:"getValue",value:function(e){if(e<=this._startTime)return this._start;if(e>=this._endTime)return this._end;var t=i.easeCubicInOut((e-this._startTime)/(this._endTime-this._startTime));return this._start*(1-t)+this._end*t}},{key:"isEasing",value:function(e){return e>=this._startTime&&e<=this._endTime}},{key:"jumpTo",value:function(e){this._startTime=-1/0,this._endTime=-1/0,this._start=e,this._end=e}},{key:"easeTo",value:function(e,t,i){this._start=this.getValue(t),this._end=e,this._startTime=t,this._endTime=t+i}}]),e}(),ya={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use \u2318 + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"},_a={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,optimizeForTerrain:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileC
1acheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,crossSourceCollisions:!0},ga={showCompass:!0,showZoom:!0,visualizePitch:!1},xa=function(){function e(t,r){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];h(this,e),this._clickTolerance=10,this.element=r,this.mouseRotate=new Pn({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,n&&(this.mousePitch=new Dn({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),i.bindAll(["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)}return d(e,[{key:"down",value:function(e,t){this.mouseRotate.mousedown(e,t),this.mousePitch&&this.mousePitch.mousedown(e,t),k()}},{key:"move",value:function(e,t){var i=this.map,r=this.mouseRotate.mousemoveWindow(e,t),n=r&&r.bearingDelta;if(n&&i.setBearing(i.getBearing()+n),this.mousePitch){var a=this.mousePitch.mousemoveWindow(e,t),o=a&&a.pitchDelta;o&&i.setPitch(i.getPitch()+o)}}},{key:"off",value:function(){var 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()}},{key:"offTemp",value:function(){T(),i.window.removeEventListener("mousemove",this.mousemove),i.window.removeEventListener("mouseup",this.mouseup)}},{key:"mousedown",value:function(e){this.down(i.extend({},e,{ctrlKey:!0,preventDefault:function(){return e.preventDefault()}}),S(this.element,e)),i.window.addEventListener("mousemove",this.mousemove),i.window.addEventListener("mouseup",this.mouseup)}},{key:"mousemove",value:function(e){this.move(e,S(this.element,e))}},{key:"mouseup",value:function(e){this.mouseRotate.mouseupWindow(e),this.mousePitch&&this.mousePitch.mouseupWindow(e),this.offTemp()}},{key:"touchstart",value:function(e){1!==e.targetTouches.length?this.reset():(this._startPos=this._lastPos=I(this.element,e.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:function(){return e.preventDefault()}},this._startPos))}},{key:"touchmove",value:function(e){1!==e.targetTouches.length?this.reset():(this._lastPos=I(this.element,e.targetTouches)[0],this.move({preventDefault:function(){return e.preventDefault()}},this._lastPos))}},{key:"touchend",value:function(e){0===e.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}},{key:"reset",value:function(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}]),e}(),ba={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},wa={maxWidth:100,unit:"metric"};function ka(e,t,i){var r=this,n=Ta(t),a=n/t,o={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"}[i];this._map._requestDomTask(function(){r._container.style.width=e*a+"px",r._container.innerHTML="".concat(n,"&nbsp;").concat(o)})}function Ta(e){var t,i,r=Math.pow(10,"".concat(Math.floor(e)).length-1),n=e/r;return r*(n=n>=10?10:n>=5?5:n>=3?3:n>=2?2:n>=1?1:(t=n,i=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10)),Math.round(t*i)/i))}var Ea={version:i.version,supported:o,setRTLTextPlugin:i.setRTLTextPlugin,getRTLTextPluginStatus:i.getRTLTextPluginStatus,Map:function(r){p(a,r);var n=m(a);function a(e){var t;if(h(this,a),i.LivePerformanceUtils.mark(i.PerformanceMarkers.create),null!=(e=i.extend({},_a,e)).minZoom&&null!=e.maxZoom&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=e.minPitch&&null!=e.maxPitch&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=e.minPitch&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=e.maxPitch&&e.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(e.antialias&&i.isSafariWithAntialiasingBug(i.window)&&(e.antialias=!1,i.warnOnce("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),(t=n.call(this,new sn(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies),e))._interactive=e.interactive,t._minTileCacheSize=e.minTileCacheSize,t._maxTileC
1acheSize=e.maxTileCacheSize,t._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,t._preserveDrawingBuffer=e.preserveDrawingBuffer,t._antialias=e.antialias,t._useWebGL2=e.useWebGL2,t._trackResize=e.trackResize,t._bearingSnap=e.bearingSnap,t._refreshExpiredTiles=e.refreshExpiredTiles,t._fadeDuration=e.fadeDuration,t._isInitialLoad=!0,t._crossSourceCollisions=e.crossSourceCollisions,t._collectResourceTiming=e.collectResourceTiming,t._optimizeForTerrain=e.optimizeForTerrain,t._language=t._parseLanguage(e.language),t._worldview=e.worldview,t._renderTaskQueue=new ua,t._domRenderTaskQueue=new ua,t._controls=[],t._markers=[],t._popups=[],t._mapId=i.uniqueId(),t._locale=i.extend({},ya,e.locale),t._clickTolerance=e.clickTolerance,t._cooperativeGestures=e.cooperativeGestures,t._performanceMetricsCollection=e.performanceMetricsCollection,t._containerWidth=0,t._containerHeight=0,t._averageElevationLastSampledAt=-1/0,t._averageElevationExaggeration=0,t._averageElevation=new va(0),t._interactionRange=[1/0,-1/0],t._visibilityHidden=0,t._useExplicitProjection=!1,t._requestManager=new i.RequestManager(e.transformRequest,e.accessToken,e.testMode),t._silenceAuthErrors=!!e.testMode,"string"==typeof e.container){if(t._container=i.window.document.getElementById(e.container),!t._container)throw new Error("Container '".concat(e.container,"' not found."))}else{if(!(e.container instanceof i.window.HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");t._container=e.container}if(t._container.childNodes.length>0&&i.warnOnce("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),e.maxBounds&&t.setMaxBounds(e.maxBounds),i.bindAll(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],y(t)),t._setupContainer(),t._setupPainter(),void 0===t.painter)throw new Error("Failed to initialize WebGL.");return t.on("move",function(){return t._update(!1)}),t.on("moveend",function(){return t._update(!1)}),t.on("zoom",function(){return t._update(!0)}),void 0!==i.window&&(i.window.addEventListener("online",t._onWindowOnline,!1),i.window.addEventListener("resize",t._onWindowResize,!1),i.window.addEventListener("orientationchange",t._onWindowResize,!1),i.window.addEventListener("webkitfullscreenchange",t._onWindowResize,!1),i.window.addEventListener("visibilitychange",t._onVisibilityChange,!1)),t.handlers=new na(y(t),e),t._localFontFamily=e.localFontFamily,t._localIdeographFontFamily=e.localIdeographFontFamily,e.style&&t.setStyle(e.style,{localFontFamily:t._localFontFamily,localIdeographFontFamily:t._localIdeographFontFamily}),e.projection&&t.setProjection(e.projection),t._hash=e.hash&&new un("string"==typeof e.hash&&e.hash||void 0).addTo(y(t)),t._hash&&t._hash._onHashChange()||(t.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(t.resize(),t.fitBounds(e.bounds,i.extend({},e.fitBoundsOptions,{duration:0})))),t.resize(),e.attributionControl&&t.addControl(new sa({customAttribution:e.customAttribution})),t._logoControl=new la,t.addControl(t._logoControl,e.logoPosition),t.on("style.load",function(){t.transform.unmodified&&t.jumpTo(t.style.stylesheet)}),t.on("data",function(e){t._update("style"===e.dataType),t.fire(new i.Event("".concat(e.dataType,"data"),e))}),t.on("dataloading",function(e){t.fire(new i.Event("".concat(e.dataType,"dataloading"),e))}),v(t)}return d(a,[{key:"_getMapId",value:function(){return this._mapId}},{key:"addControl",value:function(e,t){if(void 0===t&&(t=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!e||!e.onAdd)return this.fire(new i.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));var r=e.onAdd(this);this._controls.push(e);var n=this._controlPositions[t];return-1!==t.indexOf("bottom")?n.insertBefore(r,n.firstChild):n.appendChild(r),this}},{key:"removeControl",value:function(e){if(!e||!e.onRemove)return this.fire(new i.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));var t=this._controls.indexOf(e);return t>-1&&this._controls.splice(t,1),e.onRemove(this),this}},{key:"hasControl",value:function(e){return this._controls.indexOf(e)>-1}},{key:"getContainer",value:function(){return this._container}}
1,{key:"getCanvasContainer",value:function(){return this._canvasContainer}},{key:"getCanvas",value:function(){return this._canvas}},{key:"resize",value:function(e){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));var t=!this._moving;return t&&this.fire(new i.Event("movestart",e)).fire(new i.Event("move",e)),this.fire(new i.Event("resize",e)),t&&this.fire(new i.Event("moveend",e)),this}},{key:"getBounds",value:function(){return this.transform.getBounds()}},{key:"getMaxBounds",value:function(){return this.transform.getMaxBounds()||null}},{key:"setMaxBounds",value:function(e){return this.transform.setMaxBounds(i.LngLatBounds.convert(e)),this._update()}},{key:"setMinZoom",value:function(e){if((e=null==e?-2:e)>=-2&&e<=this.transform.maxZoom)return this.transform.minZoom=e,this._update(),this.getZoom()<e?this.setZoom(e):this.fire(new i.Event("zoomstart")).fire(new i.Event("zoom")).fire(new i.Event("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}},{key:"getMinZoom",value:function(){return this.transform.minZoom}},{key:"setMaxZoom",value:function(e){if((e=null==e?22:e)>=this.transform.minZoom)return this.transform.maxZoom=e,this._update(),this.getZoom()>e?this.setZoom(e):this.fire(new i.Event("zoomstart")).fire(new i.Event("zoom")).fire(new i.Event("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}},{key:"getMaxZoom",value:function(){return this.transform.maxZoom}},{key:"setMinPitch",value:function(e){if((e=null==e?0:e)<0)throw new Error("minPitch must be greater than or equal to 0");if(e>=0&&e<=this.transform.maxPitch)return this.transform.minPitch=e,this._update(),this.getPitch()<e?this.setPitch(e):this.fire(new i.Event("pitchstart")).fire(new i.Event("pitch")).fire(new i.Event("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}},{key:"getMinPitch",value:function(){return this.transform.minPitch}},{key:"setMaxPitch",value:function(e){if((e=null==e?85:e)>85)throw new Error("maxPitch must be less than or equal to 85");if(e>=this.transform.minPitch)return this.transform.maxPitch=e,this._update(),this.getPitch()>e?this.setPitch(e):this.fire(new i.Event("pitchstart")).fire(new i.Event("pitch")).fire(new i.Event("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}},{key:"getMaxPitch",value:function(){return this.transform.maxPitch}},{key:"getRenderWorldCopies",value:function(){return this.transform.renderWorldCopies}},{key:"setRenderWorldCopies",value:function(e){return this.transform.renderWorldCopies=e,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}},{key:"getLanguage",value:function(){return this._language}},{key:"_parseLanguage",value:function(e){return"auto"===e?i.window.navigator.language:Array.isArray(e)?0===e.length?void 0:e.map(function(e){return"auto"===e?i.window.navigator.language:e}):e}},{key:"setLanguage",value:function(e){var t=this._parseLanguage(e);if(!this.style||t===this._language)return this;this._language=t,this.style._reloadSources();var i,r=l(this._controls);try{for(r.s();!(i=r.n()).done;){var n=i.value;n._setLanguage&&n._setLanguage(this._language)}}catch(a){r.e(a)}finally{r.f()}return this}},{key:"getWorldview",value:function(){return this._worldview}},{key:"setWorldview",value:function(e){return this.style&&e!==this._worldview?(this._worldview=e,this.style._reloadSources(),this):this}},{key:"getProjection",value:function(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}},{key:"_showingGlobe",value:function(){return"globe"===this.transform.projection.name}},{key:"setProjection",value:function(e){return this._lazyInitEmptyStyle(),e?"string"==typeof e&&(e={name:e}):e=null,this._useExplicitProjection=!!e,this._prioritizeAndUpdateProjection(e,this.style.stylesheet?this.style.stylesheet.projection:null)}},{key:"_updateProjectionTransition",value:function(){if("globe"===this.getProjection().name){var e,t=this.transform,r=t.projection.name;"globe"===r&&t.zoom>=i.GLOBE_ZOOM_THRESHOLD_MAX?(t.setMercatorFromTransition(),e=!0):"mercator"===r&&t.zoom<i.GLOBE_ZOOM_THRESHOLD_MAX&&(t.setProjection({name:"globe"}),e=!0),e&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayer
1Update())}}},{key:"_prioritizeAndUpdateProjection",value:function(e,t){return this._updateProjection(e||t||{name:"mercator"})}},{key:"_updateProjection",value:function(e){var t;if(t="globe"===e.name&&this.transform.zoom>=i.GLOBE_ZOOM_THRESHOLD_MAX?this.transform.setMercatorFromTransition():this.transform.setProjection(e),this.style.applyProjectionUpdate(),t){for(var r in this.painter.clearBackgroundTiles(),this.style._sourceCaches)this.style._sourceCaches[r].clearTiles();this._update(!0),this._forceMarkerAndPopupUpdate(!0)}return this}},{key:"project",value:function(e){return this.transform.locationPoint3D(i.LngLat.convert(e))}},{key:"unproject",value:function(e){return this.transform.pointLocation3D(i.pointGeometry.convert(e))}},{key:"isMoving",value:function(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}},{key:"isZooming",value:function(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}},{key:"isRotating",value:function(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}},{key:"_isDragging",value:function(){return this.handlers&&this.handlers._isDragging()||!1}},{key:"_createDelegatedListener",value:function(t,i,r){var n=this;if("mouseenter"===t||"mouseover"===t){var a=!1;return{layers:new Set(i),listener:r,delegates:{mousemove:function(e){var o=i.filter(function(e){return n.getLayer(e)}),s=o.length?n.queryRenderedFeatures(e.point,{layers:o}):[];s.length?a||(a=!0,r.call(n,new gn(t,n,e.originalEvent,{features:s}))):a=!1},mouseout:function(){a=!1}}}}if("mouseleave"===t||"mouseout"===t){var o=!1;return{layers:new Set(i),listener:r,delegates:{mousemove:function(e){var a=i.filter(function(e){return n.getLayer(e)});(a.length?n.queryRenderedFeatures(e.point,{layers:a}):[]).length?o=!0:o&&(o=!1,r.call(n,new gn(t,n,e.originalEvent)))},mouseout:function(e){o&&(o=!1,r.call(n,new gn(t,n,e.originalEvent)))}}}}return{layers:new Set(i),listener:r,delegates:e({},t,function(e){var t=i.filter(function(e){return n.getLayer(e)}),a=t.length?n.queryRenderedFeatures(e.point,{layers:t}):[];a.length&&(e.features=a,r.call(n,e),delete e.features)})}}},{key:"on",value:function(e,i,r){if(void 0===r)return t(w(a.prototype),"on",this).call(this,e,i);Array.isArray(i)||(i=[i]);var n=this._createDelegatedListener(e,i,r);for(var o in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(n),n.delegates)this.on(o,n.delegates[o]);return this}},{key:"once",value:function(e,i,r){if(void 0===r)return t(w(a.prototype),"once",this).call(this,e,i);Array.isArray(i)||(i=[i]);var n=this._createDelegatedListener(e,i,r);for(var o in n.delegates)this.once(o,n.delegates[o]);return this}},{key:"off",value:function(e,i,r){var n=this;if(void 0===r)return t(w(a.prototype),"off",this).call(this,e,i);i=new Set(Array.isArray(i)?i:[i]);var o=function(e,t){if(e.size!==t.size)return!1;var i,r=l(e);try{for(r.s();!(i=r.n()).done;){var n=i.value;if(!t.has(n))return!1}}catch(a){r.e(a)}finally{r.f()}return!0},s=this._delegatedListeners?this._delegatedListeners[e]:void 0;return s&&function(e){for(var t=0;t<e.length;t++){var a=e[t];if(a.listener===r&&o(a.layers,i)){for(var s in a.delegates)n.off(s,a.delegates[s]);return e.splice(t,1),n}}}(s),this}},{key:"queryRenderedFeatures",value:function(e,t){return this.style?(void 0!==t||void 0===e||e instanceof i.pointGeometry||Array.isArray(e)||(t=e,e=void 0),this.style.queryRenderedFeatures(e=e||[[0,0],[this.transform.width,this.transform.height]],t=t||{},this.transform)):[]}},{key:"querySourceFeatures",value:function(e,t){return this.style.querySourceFeatures(e,t)}},{key:"setStyle",value:function(e,t){return!1!==(t=i.extend({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},t)).diff&&t.localIdeographFontFamily===this._localIdeographFontFamily&&t.localFontFamily===this._localFontFamily&&this.style&&e?(this._diffStyle(e,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._localFontFamily=t.localFontFamily,this._updateStyle(e,t))}},{key:"_getUIString",value:function(e){var t=this._locale[e];if(null==t)throw new Error("Missing UI string '".concat(e,"'"));return t}},{key:"_updateStyle",value:function(e,t){return this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),e&&(this.style=new fi(this,t||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof e?this.style.loadURL(e):this.style.loadJSON(e)),this._updateTerrain(),this}},{key:"_lazyInitEmptyStyle",value:function(){this.style||(this.style=new fi(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}},{key:"_diffStyle",value:function(e,t){var r=this;if("string"==typeof e){var n=this._requestManager.normalizeStyleURL(e),a=this._requestManager.transformRequest(n,i.ResourceType.Style);i.getJSON(a,function(e,n){e?r.fire(new i.ErrorEvent(e)):n&&r._updateDiff(n,t)})}else"object"==typeof e&&this._updateDiff(e,t)}},{key:"_updateDiff",value:function(e,t){try{this.style.setState(e)&&this._update(!0)}catch(r){i.warnOnce("Unable to perform style diff: ".concat(r.message||r.error||r,".  Rebuilding the style from scratch.")),this._updateStyle(e,t)}}},{key:"getStyle",value:function(){if(this.style)return this.style.serialize()}},{key:"isStyleLoaded",value:function(){return this.style?this.style.loaded():(i.warnOnce("There is no style added to the map."),!1)}},{key:"addSource",value:function(e,t){return this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)}},{key:"isSourceLoaded",value:function(e){return!!this.style&&this.style._isSourceCacheLoaded(e)}},{key:"areTilesLoaded",value:function(){var e=this.style&&this.style._sourceCaches;for(var t in e){var i=e[t]._tiles;for(var r in i){var n=i[r];if("loaded"!==n.state&&"errored"!==n.state)return!1}}return!0}},{key:"addSourceType",value:function(e,t,i){this._lazyInitEmptyStyle(),this.style.addSourceType(e,t,i)}},{key:"removeSource",value:function(e){return this.style.removeSource(e),this._updateTerrain(),this._update(!0)}},{key:"getSource",value:function(e){return this.style.getSource(e)}},{key:"addImage",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.pixelRatio,a=void 0===n?1:n,o=r.sdf,s=void 0!==o&&o,l=r.stretchX,u=r.stretchY,c=r.content;if(this._lazyInitEmptyStyle(),t instanceof i.window.HTMLImageElement||i.window.ImageBitmap&&t instanceof i.window.ImageBitmap){var h=i.exported.getImageData(t),f=h.width,d=h.height,p=h.data;this.style.addImage(e,{data:new i.RGBAImage({width:f,height:d},p),pixelRatio:a,stretchX:l,stretchY:u,content:c,sdf:s,version:0})}else if(void 0===t.width||void 0===t.height)this.fire(new i.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{var m=t.width,v=t.height,y=t;this.style.addImage(e,{data:new i.RGBAImage({width:m,height:v},new Uint8Array(y.data)),pixelRatio:a,stretchX:l,stretchY:u,content:c,sdf:s,version:0,userImage:y}),y.onAdd&&y.onAdd(this,e)}}},{key:"updateImage",value:function(e,t){var r=this.style.getImage(e);if(r){var n=t instanceof i.window.HTMLImageElement||i.window.ImageBitmap&&t instanceof i.window.ImageBitmap?i.exported.getImageData(t):t,a=n.width,o=n.height;void 0!==a&&void 0!==o?a===r.data.width&&o===r.data.height?(r.data.replace(n.data,!(t instanceof i.window.HTMLImageElement||i.window.ImageBitmap&&t instanceof i.window.ImageBitmap)),this.style.updateImage(e,r)):this.fire(new i.ErrorEvent(new Error("The width and height of the updated image (".concat(a,", ").concat(o,")\n                must be that same as the previous version of the image\n                (").concat(r.data.width,", ").concat(r.data.height,")")))):this.fire(new i.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")))}else this.fire(new i.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")))}},{key:"hasImage",value:function(e){return e?!!this.style.getImage(e):(this.fire(new i.ErrorEvent(new Error("Missing required image id"))),!1)}},{key:"removeImage",value:function(e){this.style.removeImage(e)}},{key:"loadImage",value:function(e,t){i.getImage(this._requestManager.transformRequest(e,i.ResourceType.Image),function(e,r){t(e,r instanceof i.window.HTMLImageElement?i.exported.getImageData(r):r)})}},{key:"listImages",value:function(){return this.style.listImages()}},{key:"addLayer",value:function(e,t){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)}},{key:"moveLayer",value:function(e,t){return this.style.moveLayer(e,t),this._update(!0)}},{key:"removeLayer",value:function(e){return this.style.removeLayer(e),this._update(!0)}},{key:"getLayer",value:function(e){return this.style.getLayer(e)}},{key:"setLayerZoomRange",value:function(e,t,i){return this.style.setLayerZoomRange(e,t,i),this._update(!0)}},{key:"setFilter",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.style.setFilter(e,t,i),this._update(!0)}},{key:"getFilter",value:function(e){return this.style.getFilter(e)}},{key:"setPaintProperty",value:function(e,t,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.style.setPaintProperty(e,t,i,r),this._update(!0)}},{key:"getPaintProperty",value:function(e,t){return this.style.getPaintProperty(e,t)}},{key:"setLayoutProperty",value:function(e,t,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.style.setLayoutProperty(e,t,i,r),this._update(!0)}},{key:"getLayoutProperty",value:function(e,t){return this.style.getLayoutProperty(e,t)}},{key:"setLight",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this._lazyInitEmptyStyle(),this.style.setLight(e,t),this._update(!0)}},{key:"getLight",value:function(){return this.style.getLight()}},{key:"setTerrain",value:function(e){return this._lazyInitEmptyStyle(),!e&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(e),this._averageElevationLastSampledAt=-1/0,this._update(!0)}},{key:"getTerrain",value:function(){return this.style?this.style.getTerrain():null}},{key:"setFog",value:function(e){return this._lazyInitEmptyStyle(),this.style.setFog(e),this._update(!0)}},{key:"getFog",value:function(){return this.style?this.style.getFog():null}},{key:"_queryFogOpacity",value:function(e){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(i.LngLat.convert(e),this.transform):0}},{key:"setFeatureState",value:function(e,t){return this.style.setFeatureState(e,t),this._update()}},{key:"removeFeatureState",value:function(e,t){return this.style.removeFeatureState(e,t),this._update()}},{key:"getFeatureState",value:function(e){return this.style.getFeatureState(e)}},{key:"_updateContainerDimensions",value:function(){if(this._container){for(var e,t,r,n=this._container.getBoundingClientRect().width||400,a=this._container.getBoundingClientRect().height||300,o=this._container;o&&(!t||!r);){var s=i.window.getComputedStyle(o).transform;s&&"none"!==s&&((e=s.match(/matrix.*\((.+)\)/)[1].split(", "))[0]&&"0"!==e[0]&&"1"!==e[0]&&(t=e[0]),e[3]&&"0"!==e[3]&&"1"!==e[3]&&(r=e[3])),o=o.parentElement}this._containerWidth=t?Math.abs(n/t):n,this._containerHeight=r?Math.abs(a/r):a}}},{key:"_detectMissingCSS",value:function(){"rgb(250, 128, 114)"!==i.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&i.warnOnce("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described 
1in https://www.mapbox.com/mapbox-gl-js/api/.")}},{key:"_setupContainer",value:function(){var e=this._container;e.classList.add("mapboxgl-map"),(this._missingCSSCanary=c("div","mapboxgl-canary",e)).style.visibility="hidden",this._detectMissingCSS();var t=this._canvasContainer=c("div","mapboxgl-canvas-container",e);this._interactive&&t.classList.add("mapboxgl-interactive"),this._canvas=c("canvas","mapboxgl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);var i=this._controlContainer=c("div","mapboxgl-control-container",e),r=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(function(e){r[e]=c("div","mapboxgl-ctrl-".concat(e),i)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}},{key:"_resizeCanvas",value:function(e,t){var r=i.exported.devicePixelRatio||1;this._canvas.width=r*Math.ceil(e),this._canvas.height=r*Math.ceil(t),this._canvas.style.width="".concat(e,"px"),this._canvas.style.height="".concat(t,"px")}},{key:"_addMarker",value:function(e){this._markers.push(e)}},{key:"_removeMarker",value:function(e){var t=this._markers.indexOf(e);-1!==t&&this._markers.splice(t,1)}},{key:"_addPopup",value:function(e){this._popups.push(e)}},{key:"_removePopup",value:function(e){var t=this._popups.indexOf(e);-1!==t&&this._popups.splice(t,1)}},{key:"_setupPainter",value:function(){var e=this,t=i.extend({},o.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),r=this._useWebGL2&&this._canvas.getContext("webgl2",t),n=r||this._canvas.getContext("webgl",t)||this._canvas.getContext("experimental-webgl",t);n?(this._useWebGL2&&!r&&i.warnOnce("Failed to create WebGL 2 context. Using WebGL 1."),i.storeAuthState(n,!0),this.painter=new Xr(n,this.transform,!!r),this.on("data",function(t){"source"===t.dataType&&e.painter.setTileLoadedFlag(!0)}),i.exported$1.testSupport(n)):this.fire(new i.ErrorEvent(new Error("Failed to initialize WebGL")))}},{key:"_contextLost",value:function(e){e.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new i.Event("webglcontextlost",{originalEvent:e}))}},{key:"_contextRestored",value:function(e){this._setupPainter(),this.resize(),this._update(),this.fire(new i.Event("webglcontextrestored",{originalEvent:e}))}},{key:"_onMapScroll",value:function(e){if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}},{key:"loaded",value:function(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}},{key:"_update",value:function(e){return this.style?(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint(),this):this}},{key:"_requestRenderFrame",value:function(e){return this._update(),this._renderTaskQueue.add(e)}},{key:"_cancelRenderFrame",value:function(e){this._renderTaskQueue.remove(e)}},{key:"_requestDomTask",value:function(e){!this.loaded()||this.loaded()&&!this.isMoving()?e():this._domRenderTaskQueue.add(e)}},{key:"_render",value:function(e){var t,r=this,n=this.painter.context.extTimerQuery,a=i.exported.now();if(this.listens("gpu-timing-frame")&&(t=n.createQueryEXT(),n.beginQueryEXT(n.TIME_ELAPSED_EXT,t)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&(this._interactionRange[0]=Math.min(this._interactionRange[0],i.window.performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],i.window.performance.now())),this._renderTaskQueue.run(e),this._domRenderTaskQueue.run(e),!this._removed){this._updateProjectionTransition();var o=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;var s=this.transform.zoom,l=this.transform.pitch,u=i.exported.now(),c=new i.EvaluationParameters(s,{now:u,fadeDuration:o,pitch:l,transition:this.style.getTransition()});this.style.update(c)}this.style&&this.style.fog&&this.style.fog.hasTransition()&&(this.style._markersNeedU
1pdate=!0,this._sourcesDirty=!0);var h=!1;if(this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),h=this._updateAverageElevation(a),this.style._updateSources(this.transform),this._forceMarkerAndPopupUpdate()):h=this._updateAverageElevation(a),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,o,this._crossSourceCollisions),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showTerrainWireframe:this.showTerrainWireframe,showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:o,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new i.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new i.Event("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),t){var f=i.exported.now()-a;n.endQueryEXT(n.TIME_ELAPSED_EXT,t),setTimeout(function(){var e=n.getQueryObjectEXT(t,n.QUERY_RESULT_EXT)/1e6;n.deleteQueryEXT(t),r.fire(new i.Event("gpu-timing-frame",{cpuTime:f,gpuTime:e})),i.window.performance.mark("frame-gpu",{startTime:a,detail:{gpuTime:e}})},50)}if(this.listens("gpu-timing-layer")){var d=this.painter.collectGpuTimers();setTimeout(function(){var e=r.painter.queryGpuTimers(d);r.fire(new i.Event("gpu-timing-layer",{layerTimes:e}))},50)}if(this.listens("gpu-timing-deferred-render")){var p=this.painter.collectDeferredRenderGpuQueries();setTimeout(function(){var e=r.painter.queryGpuTimeDeferredRender(p);r.fire(new i.Event("gpu-timing-deferred-render",{gpuTime:e}))},50)}var m=this._sourcesDirty||this._styleDirty||this._placementDirty||h;if(m||this._repaint)this.triggerRepaint();else{var v=!this.isMoving()&&this.loaded();if(v&&(h=this._updateAverageElevation(a,!0)),h)this.triggerRepaint();else if(this._triggerFrame(!1),v&&(this.fire(new i.Event("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){var y=this._calculateSpeedIndex();this.fire(new i.Event("speedindexcompleted",{speedIndex:y})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||m||(this._fullyLoaded=!0,i.LivePerformanceUtils.mark(i.PerformanceMarkers.fullLoad),this._performanceMetricsCollection&&i.postPerformanceEvent(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}}},{key:"_forceMarkerAndPopupUpdate",value:function(e){var t,i=l(this._markers);try{for(i.s();!(t=i.n()).done;){var r=t.value;e&&!this.getRenderWorldCopies()&&(r._lngLat=r._lngLat.wrap()),r._update()}}catch(s){i.e(s)}finally{i.f()}var n,a=l(this._popups);try{for(a.s();!(n=a.n()).done;){var o=n.value;!e||this.getRenderWorldCopies()||o._trackPointer||(o._lngLat=o._lngLat.wrap()),o._update()}}catch(s){a.e(s)}finally{a.f()}}},{key:"_updateAverageElevation",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=function(e){return t.transform.averageElevation=e,t._update(!1),!0};if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&r(0);if((i||e-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(e)){var n=this.transform.averageElevation,a=this.transform.sampleAverageElevation(),o=!1;this.transform.elevation&&(o=this.transform.elevation.exaggeration()!==this._averageElevationExaggeration,this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(a)?a=0:this._averageElevationLastSampledAt=e;var s=Math.abs(n-a);if(s>
11){if(this._isInitialLoad||o)return this._averageElevation.jumpTo(a),r(a);this._averageElevation.easeTo(a,e,300)}else if(s>1e-4)return this._averageElevation.jumpTo(a),r(a)}return!!this._averageElevation.isEasing(e)&&r(this._averageElevation.getValue(e))}},{key:"_authenticate",value:function(){var e=this;i.getMapSessionAPI(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,function(t){if(t&&(t.message===i.AUTH_ERR_MSG||401===t.status)){var r=e.painter.context.gl;i.storeAuthState(r,!1),e._logoControl instanceof la&&e._logoControl._updateLogo(),r&&r.clear(r.DEPTH_BUFFER_BIT|r.COLOR_BUFFER_BIT|r.STENCIL_BUFFER_BIT),e._silenceAuthErrors||e.fire(new i.ErrorEvent(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),i.postMapLoadEvent(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,function(){})}},{key:"_updateTerrain",value:function(){var e=this._isDragging();this.painter.updateTerrain(this.style,e)}},{key:"_calculateSpeedIndex",value:function(){var e=this.painter.canvasCopy(),t=this.painter.getCanvasCopiesAndTimestamps();t.timeStamps.push(performance.now());var i=this.painter.context.gl,r=i.createFramebuffer();function n(e){i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e,0);var t=new Uint8Array(i.drawingBufferWidth*i.drawingBufferHeight*4);return i.readPixels(0,0,i.drawingBufferWidth,i.drawingBufferHeight,i.RGBA,i.UNSIGNED_BYTE,t),t}return i.bindFramebuffer(i.FRAMEBUFFER,r),this._canvasPixelComparison(n(e),t.canvasCopies.map(n),t.timeStamps)}},{key:"_canvasPixelComparison",value:function(e,t,i){for(var r=i[1]-i[0],n=e.length/4,a=0;a<t.length;a++){for(var o=t[a],s=0,l=0;l<o.length;
1l+=4)o[l]===e[l]&&o[l+1]===e[l+1]&&o[l+2]===e[l+2]&&o[l+3]===e[l+3]&&(s+=1);r+=(i[a+2]-i[a+1])*(1-s/n)}return r}},{key:"remove",value:function(){this._hash&&this._hash.remove();var e,t=l(this._controls);try{for(t.s();!(e=t.n()).done;){e.value.onRemove(this)}}catch(n){t.e(n)}finally{t.f()}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),void 0!==i.window&&(i.window.removeEventListener("resize",this._onWindowResize,!1),i.window.removeEventListener("orientationchange",this._onWindowResize,!1),i.window.removeEventListener("webkitfullscreenchange",this._onWindowResize,!1),i.window.removeEventListener("online",this._onWindowOnline,!1),i.window.removeEventListener("visibilitychange",this._onVisibilityChange,!1));var r=this.painter.context.gl.getExtension("WEBGL_lose_context");r&&r.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),i.removeAuthState(this.painter.context.gl),this._removed=!0,this.fire(new i.Event("remove"))}},{key:"triggerRepaint",value:function(){this._triggerFrame(!0)}},{key:"_triggerFrame",value:function(e){var t=this;this._renderNextFrame=this._renderNextFrame||e,this.style&&!this._frame&&(this._frame=i.exported.frame(function(e){var i=!!t._renderNextFrame;t._frame=null,t._renderNextFrame=null,i&&t._render(e)}))}},{key:"_preloadTiles",value:function(e){var t=this,r=this.style?Object.values(this.style._sourceCaches):[];return i.asyncAll(r,function(t,i){return t._preloadTiles(e,i)},function(){t.triggerRepaint()}),this}},{key:"_onWindowOnline",value:function(){this._update()}},{key:"_onWindowResize",value:function(e){this._trackResize&&this.resize({originalEvent:e})._update()}},{key:"_onVisibilityChange",value:function(){"hidden"===i.window.document.visibilityState&&this._visibilityHidden++}},{key:"showTileBoundaries",get:function(){return!!this._showTileBoundaries},set:function(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}},{key:"showTerrainWireframe",get:function(){return!!this._showTerrainWireframe},set:function(e){this._showTerrainWireframe!==e&&(this._showTerrainWireframe=e,this._update())}},{key:"speedIndexTiming",get:function(){return!!this._speedIndexTiming},set:function(e){this._speedIndexTiming!==e&&(this._speedIndexTiming=e,this._update())}},{key:"showPadding",get:function(){return!!this._showPadding},set:function(e){this._showPadding!==e&&(this._showPadding=e,this._update())}},{key:"showCollisionBoxes",get:function(){return!!this._showCollisionBoxes},set:function(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}},{key:"showOverdrawInspector",get:function(){return!!this._showOverdrawInspector},set:function(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}},{key:"repaint",get:function(){return!!this._repaint},set:function(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}},{key:"vertices",get:function(){return!!this._vertices},set:function(e){this._vertices=e,this._update()}},{key:"showTileAABBs",get:function(){return!!this._showTileAABBs},set:function(e){this._showTileAABBs!==e&&(this._showTileAABBs=e,e&&this._update())}},{key:"_setCacheLimits",value:function(e,t){i.setCacheLimits(e,t)}},{key:"version",get:function(){return i.version}}]),a}(oa),NavigationControl:function(){function e(t){var r=this;h(this,e),this.options=i.extend({},ga,t),this._container=c("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",function(e){return e.preventDefault()}),this.options.showZoom&&(i.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",function(e){r._map&&r._map.zoomIn({},{originalEvent:e})}),c("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",function(e){r._map&&r._map.zoomOut({},{originalEvent:e})}),c("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(i.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",function(e){var t=r._map;t&&(r.options.visualizePitch?t.resetNorthPitch({},{originalEvent:e}):t.resetNorth({},{originalEvent:e}))}),this._compassIcon=c("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}return d(e,[{key:"_updateZoomButtons",value:function(){var e=this._map;
1if(e){var t=e.getZoom(),i=t===e.getMaxZoom(),r=t===e.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=r,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",r.toString())}}},{key:"_rotateCompassArrow",value:function(){var e=this,t=this._map;if(t){var i=this.options.visualizePitch?"scale(".concat(1/Math.pow(Math.cos(t.transform.pitch*(Math.PI/180)),.5),") rotateX(").concat(t.transform.pitch,"deg) rotateZ(").concat(t.transform.angle*(180/Math.PI),"deg)"):"rotate(".concat(t.transform.angle*(180/Math.PI),"deg)");t._requestDomTask(function(){e._compassIcon&&(e._compassIcon.style.transform=i)})}}},{key:"onAdd",value:function(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 xa(e,this._compass,this.options.visualizePitch)),this._container}},{key:"onRemove",value:function(){var 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)}},{key:"_createButton",value:function(e,t){var i=c("button",e,this._container);return i.type="button",i.addEventListener("click",t),i}},{key:"_setButtonTitle",value:function(e,t){if(this._map){var i=this._map._getUIString("NavigationControl.".concat(t));e.setAttribute("aria-label",i),e.firstElementChild&&e.firstElementChild.setAttribute("title",i)}}}]),e}(),GeolocateControl:function(e){p(r,e);var t=m(r);function r(e){var n;return h(this,r),(n=t.call(this)).options=i.extend({geolocation:i.window.navigator.geolocation},ba,e),i.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],y(n)),n._updateMarkerRotationThrottled=ln(n._updateMarkerRotation,20),n._numberOfWatches=0,n}return d(r,[{key:"onAdd",value:function(e){return this._map=e,this._container=c("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}},{key:"onRemove",value:function(){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}},{key:"_checkGeolocationSupport",value:function(e){var t=this,r=function(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:!!t.options.geolocation;t._supportsGeolocation=i,e(i)};void 0!==this._supportsGeolocation?e(this._supportsGeolocation):void 0!==i.window.navigator.permissions?i.window.navigator.permissions.query({name:"geolocation"}).then(function(e){return r("denied"!==e.state)}).catch(function(){return r()}):r()}},{key:"_isOutOfMapMaxBounds",value:function(e){var t=this._map.getMaxBounds(),i=e.coords;return!!t&&(i.longitude<t.getWest()||i.longitude>t.getEast()||i.latitude<t.getSouth()||i.latitude>t.getNorth())}},{key:"_setErrorState",value:function(){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")}}},{key:"_onSuccess",value:function(e){if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new i.Event("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_E
1RROR":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(e),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new i.Event("geolocate",e)),this._finish()}}},{key:"_updateCamera",value:function(e){var t=new i.LngLat(e.coords.longitude,e.coords.latitude),r=e.coords.accuracy,n=this._map.getBearing(),a=i.extend({bearing:n},this.options.fitBoundsOptions);this._map.fitBounds(t.toBounds(r),a,{geolocateSource:!0})}},{key:"_updateMarker",value:function(e){if(e){var t=new i.LngLat(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}},{key:"_updateCircleRadius",value:function(){var e=this._map.transform,t=i.mercatorZfromAltitude(1,e._center.lat)*e.worldSize,r=Math.ceil(2*this._accuracy*t);this._circleElement.style.width="".concat(r,"px"),this._circleElement.style.height="".concat(r,"px")}},{key:"_onZoom",value:function(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}},{key:"_updateMarkerRotation",value:function(){this._userLocationDotMarker&&"number"==typeof this._heading?(this._userLocationDotMarker.setRotation(this._heading),this._dotElement.classList.add("mapboxgl-user-location-show-heading")):(this._dotElement.classList.remove("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}},{key:"_onError",value:function(e){if(this._map){if(this.options.trackUserLocation)if(1===e.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;var t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===e.code&&this._noTimeout)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new i.Event("error",e)),this._finish()}}},{key:"_finish",value:function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}},{key:"_setupUI",value:function(e){var t=this;if(void 0!==this._map){if(this._container.addEventListener("contextmenu",function(e){return e.preventDefault()}),this._geolocateButton=c("button","mapboxgl-ctrl-geolocate",this._container),c("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===e){i.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");var r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",r),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",r)}else{var n=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",n),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",n)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
1se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=c("div","mapboxgl-user-location"),this._dotElement.appendChild(c("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(c("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new fa({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=c("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new fa({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",function(e){e.geolocateSource||"ACTIVE_LOCK"!==t._watchState||e.originalEvent&&"resize"===e.originalEvent.type||(t._watchState="BACKGROUND",t._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),t._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),t.fire(new i.Event("trackuserlocationend")))})}}},{key:"_onDeviceOrientation",value:function(e){this._userLocationDotMarker&&(e.webkitCompassHeading?this._heading=e.webkitCompassHeading:!0===e.absolute&&(this._heading=-1*e.alpha),this._updateMarkerRotationThrottled())}},{key:"trigger",value:function(){if(!this._setup)return i.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new i.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new i.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new i.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){var e;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(e={maximumAge:6e5,timeout:0},this._noTimeout=!0):(e=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,e),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}},{key:"_addDeviceOrientationListener",value:function(){var e=this,t=function(){i.window.addEventListener("ondeviceorientationabsolute"in i.window?"deviceorientationabsolute":"deviceorientation",e._onDeviceOrientation)};void 0!==i.window.DeviceMotionEvent&&"function"==typeof i.window.DeviceMotionEvent.requestPermission?DeviceOrientationEvent.requestPermission().then(function(e){"granted"===e&&t()}).catch(console.error):t()}},{key:"_clearWatch",value:function(){this.options.geolocation.clearWatch(this._geolocationWatchID),i.window.removeEventListener("deviceorientation",this._onDeviceOrientation),i.window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","fal
1se"),this.options.showUserLocation&&this._updateMarker(null)}}]),r}(i.Evented),AttributionControl:sa,ScaleControl:function(){function e(t){h(this,e),this.options=i.extend({},wa,t),function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"narrow",unit:"meter"}),!0}catch(e){return!1}}()||(this._setScale=ka.bind(this)),i.bindAll(["_update","_setScale","setUnit"],this)}return d(e,[{key:"getDefaultPosition",value:function(){return"bottom-left"}},{key:"_update",value:function(){var e=this.options.maxWidth||100,t=this._map,i=t._containerHeight/2,r=t._containerWidth/2-e/2,n=t.unproject([r,i]),a=t.unproject([r+e,i]),o=n.distanceTo(a);if("imperial"===this.options.unit){var s=3.2808*o;s>5280?this._setScale(e,s/5280,"mile"):this._setScale(e,s,"foot")}else"nautical"===this.options.unit?this._setScale(e,o/1852,"nautical-mile"):o>=1e3?this._setScale(e,o/1e3,"kilometer"):this._setScale(e,o,"meter")}},{key:"_setScale",value:function(e,t,i){var r=this,n=Ta(t),a=n/t;this._map._requestDomTask(function(){r._container.style.width=e*a+"px",r._container.innerHTML="nautical-mile"!==i?new Intl.NumberFormat(r._language,{style:"unit",unitDisplay:"narrow",unit:i}).format(n):"".concat(n,"&nbsp;nm")})}},{key:"onAdd",value:function(e){return this._map=e,this._language=e.getLanguage(),this._container=c("div","mapboxgl-ctrl mapboxgl-ctrl-scale",e.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}},{key:"onRemove",value:function(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}},{key:"_setLanguage",value:function(e){this._language=e,this._update()}},{key:"setUnit",value:function(e){this.options.unit=e,this._update()}}]),e}(),FullscreenControl:function(){function e(t){h(this,e),this._fullscreen=!1,t&&t.container&&(t.container instanceof i.window.HTMLElement?this._container=t.container:i.warnOnce("Full screen control 'container' must be a DOM element.")),i.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in i.window.document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in i.window.document&&(this._fullscreenchange="webkitfullscreenchange")}return d(e,[{key:"onAdd",value:function(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=c("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",i.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}},{key:"onRemove",value:function(){this._controlContainer.remove(),this._map=null,i.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}},{key:"_checkFullscreenSupport",value:function(){return!(!i.window.document.fullscreenEnabled&&!i.window.document.webkitFullscreenEnabled)}},{key:"_setupUI",value:function(){var e=this._fullscreenButton=c("button","mapboxgl-ctrl-fullscreen",this._controlContainer);c("span","mapboxgl-ctrl-icon",e).setAttribute("aria-hidden","true"),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),i.window.document.addEventListener(this._fullscreenchange,this._changeIcon)}},{key:"_updateTitle",value:function(){var e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",e)}},{key:"_getTitle",value:function(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}},{key:"_isFullscreen",value:function(){return this._fullscreen}},{key:"_changeIcon",value:function(){(i.window.document.fullscreenElement||i.window.document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}},{key:"_onClickFullscreen",value:function(){this._isFullscreen()?i.window.document.exitFullscreen?i.window.document.exitFullscreen():i.window.document.webkitCancelFullScreen&&i.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}}]),e}(),Popup:function(e){p(n,e);var t=m(n);function n(e){var r;return h(this,n),(r=t.call(this)).options=i.extend(Object.create(da),e),i.bindAll(["_update","_onClose","remove","_onMouseEvent"],y(r)),r._classList=new Set(e&&e.className?e.className.trim().split(/\s+/):[]),r}return d(n,[{key:"addTo",value:function(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&e.on("preclick",this._onClose),this.options.closeOnMove&&e.on("move",this._onClose),e.on("remove",this.remove),this._update(),e._addPopup(this),this._focusFirstElement(),this._trackPointer?(e.on("mousemove",this._onMouseEvent),e.on("mouseup",this._onMouseEvent),e._canvasContainer.classList.add("mapboxgl-track-pointer")):e.on("move",this._update),this.fire(new i.Event("open")),this}},{key:"isOpen",value:function(){return!!this._map}},{key:"remove",value:function(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);var e=this._map;return e&&(e.off("move",this._update),e.off("move",this._onClose),e.off("preclick",this._onClose),e.off("click",this._onClose),e.off("remove",this.remove),e.off("mousemove",this._onMouseEvent),e.off("mouseup",this._onMouseEvent),e.off("drag",this._onMouseEvent),e._canvasContainer&&e._canvasContainer.classList.remove("mapboxgl-track-pointer"),e._removePopup(this),this._map=void 0),this.fire(new i.Event("close")),this}},{key:"getLngLat",value:function(){return this._lngLat}},{key:"setLngLat",value:function(e){this._lngLat=i.LngLat.convert(e),this._pos=null,this._trackPointer=!1,this._update();var t=this._map;return t&&(t.on("move",this._update),t.off("mousemove",this._onMouseEvent),t._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}},{key:"trackPointer",value:function(){this._trackPointer=!0,this._pos=null,this._update();var 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}},{key:"getElement",value:function(){return this._container}}
1,{key:"setText",value:function(e){return this.setDOMContent(i.window.document.createTextNode(e))}},{key:"setHTML",value:function(e){var t,r=i.window.document.createDocumentFragment(),n=i.window.document.createElement("body");for(n.innerHTML=e;t=n.firstChild;)r.appendChild(t);return this.setDOMContent(r)}},{key:"getMaxWidth",value:function(){return this._container&&this._container.style.maxWidth}},{key:"setMaxWidth",value:function(e){return this.options.maxWidth=e,this._update(),this}},{key:"setDOMContent",value:function(e){var t=this._content;if(t)for(;t.hasChildNodes();)t.firstChild&&t.removeChild(t.firstChild);else t=this._content=c("div","mapboxgl-popup-content",this._container||void 0);if(t.appendChild(e),this.options.closeButton){var i=this._closeButton=c("button","mapboxgl-popup-close-button",t);i.type="button",i.setAttribute("aria-label","Close popup"),i.setAttribute("aria-hidden","true"),i.innerHTML="&#215;",i.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}},{key:"addClassName",value:function(e){return this._classList.add(e),this._updateClassList(),this}},{key:"removeClassName",value:function(e){return this._classList.delete(e),this._updateClassList(),this}},{key:"setOffset",value:function(e){return this.options.offset=e,this._update(),this}},{key:"toggleClassName",value:function(e){var t;return this._classList.delete(e)?t=!1:(this._classList.add(e),t=!0),this._updateClassList(),t}}
1,{key:"_onMouseEvent",value:function(e){this._update(e.point)}},{key:"_getAnchor",value:function(e){if(this.options.anchor)return this.options.anchor;var t=this._map,i=this._container,r=this._pos;if(!t||!i||!r)return"bottom";var n=i.offsetWidth,a=i.offsetHeight,o=r.x<n/2,s=r.x>t.transform.width-n/2;if(r.y+e<a)return o?"top-left":s?"top-right":"top";if(r.y>t.transform.height-a){if(o)return"bottom-left";if(s)return"bottom-right"}return o?"left":s?"right":"bottom"}},{key:"_updateClassList",value:function(){var e=this._container;if(e){var t=r(this._classList);t.push("mapboxgl-popup"),this._anchor&&t.push("mapboxgl-popup-anchor-".concat(this._anchor)),this._trackPointer&&t.push("mapboxgl-popup-track-pointer"),e.className=t.join(" ")}}},{key:"_update",value:function(e){var t=this,r=this._map,n=this._content;if(r&&(this._lngLat||this._trackPointer)&&n){var a=this._container;if(a||(a=this._container=c("div","mapboxgl-popup",r.getContainer()),this._tip=c("div","mapboxgl-popup-tip",a),a.appendChild(n)),this.options.maxWidth&&a.style.maxWidth!==this.options.maxWidth&&(a.style.maxWidth=this.options.maxWidth),r.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=ca(this._lngLat,this._pos,r.transform)),!this._trackPointer||e){var o=this._pos=this._trackPointer&&e?e:r.project(this._lngLat),s=ma(this.options.offset),l=this._anchor=this._getAnchor(s.y),u=ma(this.options.offset,l),h=o.add(u).round();r._requestDomTask(function(){t._container&&l&&(t._container.style.transform="".concat(ha[l]," translate(").concat(h.x,"px,").concat(h.y,"px)"))})}if(!this._marker&&r._showingGlobe()){var f=i.isLngLatBehindGlobe(r.transform,this._lngLat)?0:1;this._setOpacity(f)}this._updateClassList()}}},{key:"_focusFirstElement",value:function(){if(this.options.focusAfterOpen&&this._container){var e=this._container.querySelector(pa);e&&e.focus()}}},{key:"_onClose",value:function(){this.remove()}},{key:"_setOpacity",value:function(e){this._container&&(this._container.style.opacity="".concat(e)),this._content&&(this._content.style.pointerEvents=e?"auto":"none")}}]),n}(i.Evented),Marker:fa,Style:fi,LngLat:i.LngLat,LngLatBounds:i.LngLatBounds,Point:i.pointGeometry,MercatorCoordinate:i.MercatorCoordinate,FreeCameraOptions:$r,Evented:i.Evented,config:i.config,prewarm:function(){tt().acquire(Qe)},clearPrewarmedResources:function(){var e=$e;e&&(e.isPreloaded()&&1===e.numActive()?(e.release(Qe),$e=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get accessToken(){return i.config.ACCESS_TOKEN},set accessToken(e){i.config.ACCESS_TOKEN=e},get baseApiUrl(){return i.config.API_URL},set baseApiUrl(e){i.config.API_URL=e},get workerCount(){return et.workerCount},set workerCount(e){et.workerCount=e},get maxParallelImageRequests(){return i.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(e){i.config.MAX_PARALLEL_IMAGE_REQUESTS=e},clearStorage:function(e){i.clearTileCache(e)},workerUrl:"",workerClass:null,setNow:i.exported.setNow,restoreNow:i.exported.restoreNow};return Ea}),f}()},32164:function(e,i,r){"use strict";r.d(i,{TT:function(){return P},Gd:function(){return D},Wm:function(){return B},RX:function(){return L}});var n,a=r(38583),o=r(37716),s=r(82958),u=r(97582),c=r(79765),f=r(75319),v=function(e){p(r,e);var i=m(r);function r(){var e;return h(this,r),(e=i.apply(this,arguments)).value=null,e.hasNext=!1,e.hasCompleted=!1,e}return d(r,[{key:"_subscribe",value:function(e){return this.hasError?(e.error(this.thrownError),f.w.EMPTY):this.hasCompleted&&this.hasNext?(e.next(this.value),e.complete(),f.w.EMPTY):t(w(r.prototype),"_subscribe",this).call(this,e)}},{key:"next",value:function(e){this.hasCompleted||(this.value=e,this.hasNext=!0)}},{key:"error",value:function(e){this.hasCompleted||t(w(r.prototype),"error",this).call(this,e)}},{key:"complete",value:function(){this.hasCompleted=!0,this.hasNext&&t(w(r.prototype),"next",this).call(this,this.value),t(w(r.prototype),"complete",this).call(this)}}]),r}(c.xQ),y=r(22759),_=r(77393),g=function(){function e(t){h(this,e),this.value=t}return d(e,[{key:"call",value:function(e,t){return t.subscribe(new x(e,this.value))}}]),e}(),x=function(e){p(i,e);var t=m(i);function i(e,r){var n;return h(this,i),(n=t.call(this,e)).value=r,n}return d(i,[{key:"_next",value:function(e){this.destination.next(this.value)}}]),i}(_.L),b=r(28049),k=r(43190),T=r(45435),E=r(39761),M=["content"],S=["*"],I=["container"],C=new o.OlP("MapboxApiKey"),A=((n=function(){function e(t,i){h(this,e),this.zone=t,this.MAPBOX_API_KEY=i,this.mapCreated=new v,this.mapLoaded=new v,this.markersToRemove=[],this.popupsToRemove=[],this.imageIdsToRemove=[],this.subscription=new f.w,this.mapCreated$=this.mapCreated.asObservable(),this.mapLoaded$=this.mapLoaded.asObservable()}return d(e,[{key:"setup",value:function(e){var t=this;this.zone.onStable.pipe((0,b.P)()).subscribe(function(){t.assign(s,"accessToken",e.accessToken||t.MAPBOX_API_KEY),e.customMapboxApiUrl&&t.assign(s,"config.API_URL",e.customMapboxApiUrl),t.createMap(e.mapOptions),t.hookEvents(e.mapEvents),t.mapEvents=e.mapEvents,t.mapCreated.next(void 0),t.mapCreated.complete()})}},{key:"destroyMap",value:function(){this.mapInstance&&(this.subscription.unsubscribe(),this.mapInstance.remove())}},{key:"updateMinZoom",value:function(e){var t=this;return this.zone.runOutsideAngular(function(){t.mapInstance.setMinZoom(e)})}},{key:"updateMaxZoom",value:function(e){var t=this;return this.zone.runOutsideAngular(function(){t.mapInstance.setMaxZoom(e)})}},{key:"updateMinPitch",value:function(e){var t=this;return this.zone.runOutsideAngular(function(){t.mapInstance.setMinPitch(e)})}},{key:"updateMaxPitch",value:function(e){var t=this;return this.zone.runOutsideAngular(function(){t.mapInstance.setMaxPitch(e)})}},{key:"updateRenderWorldCopies",value:function(e){var t=this;return this.zone.runOutsideAngular(function(){t.mapInstance.setRenderWorldCopies(e)})}},{key:"updateScrollZoom",value:function(e){var t=this;return this.zone.runOutsideAngular(function(){e?t.mapInstance.scrollZoom.enable():t.mapInstance.scrollZoom.disable()})}},{key:"updateDragRotate",value:function(e){var t=this;return this.zone.runOutsideAngular(function(){e?t.mapInstance.dragRotate.enable():t.mapInstance.dragRotate.disable()})}},{key:"updateTouchPitch",value:function(e){var t=this;return this.zone.runOutsideAngular(function(){e?t.mapInstance.touchPitch.enable():t.mapInstance.touchPitch.disable()})}},{key:"updateTouchZoomRotate",value:function(e){var t=this;return this.zone.runOutsideAngular(function(){e?t.mapInstance.touchZoomRotate.enable():t.mapInstance.touchZoomRotate.disable()})}},{key:"updateDoubleClickZoom",value:function(e){var t=this;return this.zone.runOutsideAngular(function(){e?t.mapInstance.doubleClickZoom.enable():t.mapInstance.doubleClickZoom.disable()})}},{key:"updateKeyboard",value:function(e){var t=this;return this.zone.runOutsideAngular(function(){e?t.mapInstance.keyboard.enable():t.mapInstance.keyboard.disable()})}},{key:"updateDragPan",value:function(e){var t=this;return this.zone.runOutsideAngular(function(){e?t.mapInstance.dragPan.enable():t.mapInstance.dragPan.disable()})}},{key:"updateBoxZoom",value:function(e){var t=this;return this.zone.runOutsideAngular(function(){e?t.mapInstance.boxZoom.enable():t.mapInstance.boxZoom.disable()})}},{key:"updateStyle",value:function(e){var t=this;return this.zone.runOutsideAngular(function(){t.mapInstance.setStyle(e)})}},{key:"updateMaxBounds",value:function(e){var t=this;return this.zone.runOutsideAngular(function(){t.mapInstance.setMaxBounds(e)})}},{key:"changeCanvasCursor",value:function(e){this.mapInstance.getCanvasContainer().style.cursor=e}},{key:"queryRenderedFeatures",value:function(e,t){return this.mapInstance.queryRenderedFeatures(e,t)}},{key:"panTo",value:function(e,t){var i=this;return this.zone.runOutsideAngular(function(){i.mapInstance.panTo(e,t)})}},{key:"move",value:function(e,t,i,r,n,a){var o=this;return this.zone.runOutsideAngular(function(){o.mapInstance[e](Object.assign(Object.assign({},t),{zoom:null!=i?i:o.mapInstance.getZoom(),center:null!=r?r:o.mapInstance.getCenter(),bearing:null!=n?n:o.mapInstance.getBearing(),pitch:null!=a?a:o.mapInstance.getPitch()}))})}},{key:"addLayer",value:function(e,t,i){var r=this;this.zone.runOutsideAngular(function(){Object.keys(e.layerOptions).forEac
1h(function(t){void 0===e.layerOptions[t]&&delete e.layerOptions[t]}),r.mapInstance.addLayer(e.layerOptions,i),t&&((e.layerEvents.layerClick.observers.length||e.layerEvents.click.observers.length)&&r.mapInstance.on("click",e.layerOptions.id,function(t){r.zone.run(function(){e.layerEvents.layerClick.emit(t),e.layerEvents.click.emit(t)})}),(e.layerEvents.layerDblClick.observers.length||e.layerEvents.dblClick.observers.length)&&r.mapInstance.on("dblclick",e.layerOptions.id,function(t){r.zone.run(function(){e.layerEvents.layerDblClick.emit(t),e.layerEvents.dblClick.emit(t)})}),(e.layerEvents.layerMouseDown.observers.length||e.layerEvents.mouseDown.observers.length)&&r.mapInstance.on("mousedown",e.layerOptions.id,function(t){r.zone.run(function(){e.layerEvents.layerMouseDown.emit(t),e.layerEvents.mouseDown.emit(t)})}),(e.layerEvents.layerMouseUp.observers.length||e.layerEvents.mouseUp.observers.length)&&r.mapInstance.on("mouseup",e.layerOptions.id,function(t){r.zone.run(function(){e.layerEvents.layerMouseUp.emit(t),e.layerEvents.mouseUp.emit(t)})}),(e.layerEvents.layerMouseEnter.observers.length||e.layerEvents.mouseEnter.observers.length)&&r.mapInstance.on("mouseenter",e.layerOptions.id,function(t){r.zone.run(function(){e.layerEvents.layerMouseEnter.emit(t),e.layerEvents.mouseEnter.emit(t)})}),(e.layerEvents.layerMouseLeave.observers.length||e.layerEvents.mouseLeave.observers.length)&&r.mapInstance.on("mouseleave",e.layerOptions.id,function(t){r.zone.run(function(){e.layerEvents.layerMouseLeave.emit(t),e.layerEvents.mouseLeave.emit(t)})}),(e.layerEvents.layerMouseMove.observers.length||e.layerEvents.mouseMove.observers.length)&&r.mapInstance.on("mousemove",e.layerOptions.id,function(t){r.zone.run(function(){e.layerEvents.layerMouseMove.emit(t),e.layerEvents.mouseMove.emit(t)})}),(e.layerEvents.layerMouseOver.observers.length||e.layerEvents.mouseOver.observers.length)&&r.mapInstance.on("mouseover",e.layerOptions.id,function(t){r.zone.run(function(){e.layerEvents.layerMouseOver.emit(t),e.layerEvents.mouseOver.emit(t)})}),(e.layerEvents.layerMouseOut.observers.length||e.layerEvents.mouseOut.observers.length)&&r.mapInstance.on("mouseout",e.layerOptions.id,function(t){r.zone.run(function(){e.layerEvents.layerMouseOut.emit(t),e.layerEvents.mouseOut.emit(t)})}),(e.layerEvents.layerContextMenu.observers.length||e.layerEvents.contextMenu.observers.length)&&r.mapInstance.on("contextmenu",e.layerOptions.id,function(t){r.zone.run(function(){e.layerEvents.layerContextMenu.emit(t),e.layerEvents.contextMenu.emit(t)})}),(e.layerEvents.layerTouchStart.observers.length||e.layerEvents.touchStart.observers.length)&&r.mapInstance.on("touchstart",e.layerOptions.id,function(t){r.zone.run(function(){e.layerEvents.layerTouchStart.emit(t),e.layerEvents.touchStart.emit(t)})}),(e.layerEvents.layerTouchEnd.observers.length||e.layerEvents.touchEnd.observers.length)&&r.mapInstance.on("touchend",e.layerOptions.id,function(t){r.zone.run(function(){e.layerEvents.layerTouchEnd.emit(t),e.layerEvents.touchEnd.emit(t)})}),(e.layerEvents.layerTouchCancel.observers.length||e.layerEvents.touchCancel.observers.length)&&r.mapInstance.on("touchcancel",e.layerOptions.id,function(t){r.zone.run(function(){e.layerEvents.layerTouchCancel.emit(t),e.layerEvents.touchCancel.emit(t)})}))})}},{key:"removeLayer",value:function(e){var t=this;this.zone.runOutsideAngular(function(){null!=t.mapInstance.getLayer(e)&&t.mapInstance.removeLayer(e)})}},{key:"addMarker",value:function(e){var t=this,i={offset:e.markersOptions.offset,anchor:e.markersOptions.anchor,draggable:!!e.markersOptions.draggable,rotationAlignment:e.markersOptions.rotationAlignment,pitchAlignment:e.markersOptions.pitchAlignment,clickTolerance:e.markersOptions.clickTolerance};e.markersOptions.element.childNodes.length>0&&(i.element=e.markersOptions.element);var r=new s.Marker(i);return(e.markersEvents.markerDragStart.observers.length||e.markersEvents.dragStart.observers.length)&&r.on("dragstart",function(i){if(i){var r=i.target;t.zone.run(function(){e.markersEvents.markerDragStart.emit(r),e.markersEvents.dragStart.emit(r)})}}),(e.markersEvents.markerDrag.observers.length||e.markersEvents.drag.observers.length)&&r.on("drag",function(i){if(i){var r=i.target;t.zone.run(function(){e.markersEvents.markerDrag.emit(r),e.markersEvents.drag.emit(r)})}}),(e.markersEvents.markerDragEnd.observers.length||e.markersEvents.dragEnd.observers.length)&&r.on("dragend",function(i){if(i){var r=i.target;t.zone.run(function(){e.markersEvents.markerDragEnd.emit(r),e.markersEvents.dragEnd.emit(r)})}}),r.setLngLat(e.markersOptions.feature?e.markersOptions.feature.geometry.coordinates:e.markersOptions.lngLat),this.zone.runOutsideAngular(function(){return r.addTo(t.mapInstance),r})}},{key:"removeMarker",value:function(e){this.markersToRemove.push(e)}},{key:"createPopup",value:function(e,t){var i=this;return this.zone.runOutsideAngular(function(){Object.keys(e.popupOptions).forEac
1h(function(t){return void 0===e.popupOptions[t]&&delete e.popupOptions[t]});var r=new s.Popup(e.popupOptions);return r.setDOMContent(t),(e.popupEvents.popupClose.observers.length||e.popupEvents.close.observers.length)&&r.on("close",function(){i.zone.run(function(){e.popupEvents.popupClose.emit(),e.popupEvents.close.emit()})}),(e.popupEvents.popupOpen.observers.length||e.popupEvents.open.observers.length)&&r.on("open",function(){i.zone.run(function(){e.popupEvents.popupOpen.emit(),e.popupEvents.open.emit()})}),r})}},{key:"addPopupToMap",value:function(e,t){var i=this,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.zone.runOutsideAngular(function(){r&&e._listeners&&delete e._listeners.open,e.setLngLat(t),e.addTo(i.mapInstance)})}},{key:"addPopupToMarker",value:function(e,t){return this.zone.runOutsideAngular(function(){e.setPopup(t)})}},{key:"removePopupFromMap",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t&&e._listeners&&delete e._listeners.close,this.popupsToRemove.push(e)}},{key:"removePopupFromMarker",value:function(e){return this.zone.runOutsideAngular(function(){e.setPopup(void 0)})}},{key:"addControl",value:function(e,t){var i=this;return this.zone.runOutsideAngular(function(){i.mapInstance.addControl(e,t)})}},{key:"removeControl",value:function(e){var t=this;return this.zone.runOutsideAngular(function(){t.mapInstance.removeControl(e)})}},{key:"loadAndAddImage",value:function(e,t,i){return(0,u.mG)(this,void 0,void 0,regeneratorRuntime.mark(function r(){var n=this;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",this.zone.runOutsideAngular(function(){return new Promise(function(r,a){n.mapInstance.loadImage(t,function(t,o){t?a(t):(n.addImage(e,o,i),r())})})}));case 1:case"end":return r.stop()}},r,this)}))}},{key:"addImage",value:function(e,t,i){var r=this;return this.zone.runOutsideAngular(function(){r.mapInstance.addImage(e,t,i)})}},{key:"removeImage",value:function(e){this.imageIdsToRemove.push(e)}},{key:"addSource",value:function(e,t){var i=this;return this.zone.runOutsideAngular(function(){Object.keys(t).forEach(function(e){return void 0===t[e]&&delete t[e]}),i.mapInstance.addSource(e,t)})}},{key:"getSource",value:function(e){return this.mapInstance.getSource(e)}},{key:"removeSource",value:function(e){var t=this;this.zone.runOutsideAngular(function(){t.findLayersBySourceId(e).forEach(function(e){return t.mapInstance.removeLayer(e.id)}),t.mapInstance.removeSource(e)})}},{key:"setAllLayerPaintProperty",value:function(e,t){var i=this;return this.zone.runOutsideAngular(function(){Object.keys(t).forEach(function(r){i.mapInstance.setPaintProperty(e,r,t[r])})})}},{key:"setAllLayerLayoutProperty",value:function(e,t){var i=this;return this.zone.runOutsideAngular(function(){Object.keys(t).forEach(function(r){i.mapInstance.setLayoutProperty(e,r,t[r])})})}},{key:"setLayerFilter",value:function(e,t){var i=this;return this.zone.runOutsideAngular(function(){i.mapInstance.setFilter(e,t)})}},{key:"setLayerBefore",value:function(e,t){var i=this;return this.zone.runOutsideAngular(function(){i.mapInstance.moveLayer(e,t)})}},{key:"setLayerZoomRange",value:function(e,t,i){var r=this;return this.zone.runOutsideAngular(function(){r.mapInstance.setLayerZoomRange(e,t||0,i||20)})}},{key:"fitBounds",value:function(e,t){var i=this;return this.zone.runOutsideAngular(function(){i.mapInstance.fitBounds(e,t)})}},{key:"fitScreenCoordinates",value:function(e,t,i){var r=this;return this.zone.runOutsideAngular(function(){r.mapInstance.fitScreenCoordinates(e[0],e[1],t,i)})}},{key:"applyChanges",value:function(){var e=this;this.zone.runOutsideAngular(function(){e.removeMarkers(),e.removePopups(),e.removeImages()})}},{key:"createMap",value:function(e){var t=this;o.R0b.assertNotInAngularZone(),Object.keys(e).forEach(function(t){void 0===e[t]&&delete e[t]}),this.mapInstance=new s.Map(e),window&&/msie\s|trident\/|edge\//i.test(window.navigator.userAgent)&&this.mapInstance.setStyle(e.style),this.subscription.add(this.zone.onMicrotaskEmpty.subscribe(function(){return t.applyChanges()}))}},{key:"removeMarkers",value:function(){var e,t=l(this.markersToRemove);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(i){t.e(i)}finally{t.f()}this.markersToRemove=[]}},{key:"removePopups",value:function(){var e,t=l(this.popupsToRemove);try{for(t.s();!(e=t.n()).done;)e.value.remove()}catch(i){t.e(i)}finally{t.f()}this.popupsToRemove=[]}},{key:"removeImages",value:function(){var e,t=l(this.imageIdsToRemove);try{for(t.s();!(e=t.n()).done;){var i=e.value;this.mapInstance.removeImage(i)}}catch(r){t.e(r)}finally{t.f()}this.imageIdsToRemove=[]}},{key:"findLayersBySourceId",value:function(e){var t=this.mapInstance.getStyle().layers;return null==t?[]:t.filter(function(t){return"source"in t&&t.source===e})}},{key:"hookEvents",value:function(e){var t=this;this.mapInstance.on("load",function(i){t.mapLoaded.next(void 0),t.mapLoaded.complete(),t.zone.run(function(){e.mapLoad.emit(i.target),e.load.emit(i.target)})}),(e.mapResize.observers.length||e.resize.observers.length)&&this.mapInstance.on("resize",function(i){return t.zone.run(function(){e.mapResize.emit(i),e.resize.emit(i)})}),(e.mapRemove.observers.length||e.remove.observers.length)&&this.mapInstance.on("remove",function(i){return t.zone.run(function(){e.mapRemove.emit(i),e.remove.emit(i)})}),(e.mapMouseDown.observers.length||e.mouseDown.observers.length)&&this.mapInstance.on("mousedown",function(i){return t.zone.run(function(){e.mapMouseDown.emit(i),e.mouseDown.emit(i)})}),(e.mapMouseUp.observers.length||e.mouseUp.observers.length)&&this.mapInstance.on("mouseup",function(i){return t.zone.run(function(){e.mapMouseUp.emit(i),e.mouseUp.emit(i)})}),(e.mapMouseMove.observers.length||e.mouseMove.observers.length)&&this.mapInstance.on("mousemove",function(i){return t.zone.run(function(){e.mapMouseMove.emit(i),e.mouseMove.emit(i)})}),(e.mapClick.observers.length||e.click.observers.length)&&this.mapInstance.on("click",function(i){return t.zone.run(function(){e.mapClick.emit(i),e.click.emit(i)})}),(e.mapDblClick.observers.length||e.dblClick.observers.length)&&this.mapInstance.on("dblclick",function(i){return t.zone.run(function(){e.mapDblClick.emit(i),e.dblClick.emit(i)})}),(e.mapMouseOver.observers.length||e.mouseOver.observers.length)&&this.mapInstance.on("mouseover",function(i){return t.zone.run(function(){e.mapMouseOver.emit(i),e.mouseOver.emit(i)})}),(e.mapMouseOut.observers.length||e.mouseOut.observers.length)&&this.mapInstance.on("mouseout",function(i){return t.zone.run(function(){e.mapMouseOut.emit(i),e.mouseOut.emit(i)})}),(e.mapContextMenu.observers.length||e.contextMenu.observers.length)&&this.mapInstance.on("contextmenu",function(i){return t.zone.run(function(){e.mapContextMenu.emit(i),e.contextMenu.emit(i)})}),(e.mapTouchStart.observers.length||e.touchStart.observers.length)&&this.mapInstance.on("touchstart",function(i){return t.zone.run(function(){e.mapTouchStart.emit(i),e.touchStart.emit(i)})}),(e.mapTouchEnd.observers.length||e.touchEnd.observers.length)&&this.mapInstance.on("touchend",function(i){return t.zone.run(function(){e.mapTouchEnd.emit(i),e.touchEnd.emit(i)})}),(e.mapTouchMove.observers.length||e.touchMove.observers.length)&&this.mapInstance.on("touchmove",function(i){return t.zone.run(function(){e.mapTouchMove.emit(i),e.touchMove.emit(i)})}),(e.mapTouchCancel.observers.length||e.touchCancel.observers.length)&&this.mapInstance.on("touchcancel",function(i){return t.zone.run(function(){e.mapTouchCancel.emit(i),e.touchCancel.emit(i)})}),(e.mapWheel.observers.length||e.wheel.observers.length)&&this.mapInstance.on("wheel",function(i){return t.zone.run(function(){e.mapWheel.emit(i),e.wheel.emit(i)})}),e.moveStart.observers.length&&this.mapInstance.on("movestart",function(i){return t.zone.run(function(){return e.moveStart.emit(i)})}),e.move.observers.length&&this.mapInstance.on("move",function(i){return t.zone.run(function(){return e.move.emit(i)})}),e.moveEnd.observers.length&&this.mapInstance.on("moveend",function(i){return t.zone.run(function(){return e.moveEnd.emit(i)})}),(e.mapDragStart.observers.length||e.dragStart.observers.length)&&this.mapInstance.on("dragstart",function(i){return t.zone.run(function(){e.mapDragStart.emit(i),e.dragStart.emit(i)})}),(e.mapDrag.observers.length||e.drag.observers.length)&&this.mapInstance.on("drag",function(i){return t.zone.run(function(){e.mapDrag.emit(i),e.drag.emit(i)})}),(e.mapDragEnd.observers.length||e.dragEnd.observers.length)&&this.mapInstance.on("dragend",function(i){return t.zone.run(function(){e.mapDragEnd.emit(i),e.dragEnd.emit(i)})}),e.zoomStart.observers.length&&this.mapInstance.on("zoomstart",function(i){return t.zone.run(function(){return e.zoomStart.emit(i)})}),e.zoomEvt.observers.length&&this.mapInstance.on("zoom",function(i){return t.zone.run(function(){return e.zoomEvt.emit(i)})}),e.zoomEnd.observers.length&&this.mapInstance.on("zoomend",function(i){return t.zone.run(function(){return e.zoomEnd.emit(i)})}),e.rotateStart.observers.length&&this.mapInstance.on("rotatestart",function(i){return t.zone.run(function(){return e.rotateStart.emit(i)})}),e.rotate.observers.length&&this.mapInstance.on("rotate",function(i){return t.zone.run(function(){return e.rotate.emit(i)})}),e.rotateEnd.observers.length&&this.mapInstance.on("rotateend",function(i){return t.zone.run(function(){return e.rotateEnd.emit(i)})}),e.pitchStart.observers.length&&this.mapInstance.on("pitchstart",function(i){return t.zone.run(function(){return e.pitchStart.emit(i)})}),e.pitchEvt.observers.length&&this.mapInstance.on("pitch",function(i){return t.zone.run(function(){return e.pitchEvt.emit(i)})}),e.pitchEnd.observers.length&&this.mapInstance.on("pitchend",function(i){return t.zone.run(function(){return e.pitchEnd.emit(i)})}),e.boxZoomStart.observers.length&&this.mapInstance.on("boxzoomstart",function(i){return t.zone.run(function(){return e.boxZoomStart.emit(i)})}),e.boxZoomEnd.observers.length&&this.mapInstance.on("boxzoomend",function(i){return t.zone.run(function(){return e.boxZoomEnd.emit(i)})}),e.boxZoomCancel.observers.length&&this.mapInstance.on("boxzoomcancel",function(i){return t.zone.run(function(){return e.boxZoomCancel.emit(i)})}),e.webGlContextLost.observers.length&&this.mapInstance.on("webglcontextlost",function(i){return t.zone.run(function(){return e.webGlContextLost.emit(i)})}),e.webGlContextRestored.observers.length&&this.mapInstance.on("webglcontextrestored",function(i){return t.zone.run(function(){return e.webGlContextRestored.emit(i)})}),e.render.observers.length&&this.mapInstance.on("render",function(i){return t.zone.run(function(){return e.render.emit(i)})}),(e.mapError.observers.length||e.error.observers.length)&&this.mapInstance.on("error",function(i){return t.zone.run(function(){e.mapError.emit(i),e.error.emit(i)})}),e.data.observers.length&&this.mapInstance.on("data",function(i){return t.zone.run(function(){return e.data.emit(i)})}),e.styleData.observers.length&&this.mapInstance.on("styledata",function(i){return t.zone.run(function(){return e.styleData.emit(i)})}),e.sourceData.observers.length&&this.mapInstance.on("sourcedata",function(i){return t.zone.run(function(){return e.sourceData.emit(i)})}),e.dataLoading.observers.length&&this.mapInstance.on("dataloading",function(i){return t.zone.run(function(){return e.dataLoading.emit(i)})}),e.styleDataLoading.observers.length&&this.mapInstance.on("styledataloading",function(i){return t.zone.run(function(){return e.styleDataLoading.emit(i)})}),e.sourceDataLoading.observers.length&&this.mapInstance.on("sourcedataloading",function(i){return t.zone.run(function(){return e.sourceDataLoading.emit(i)})}),e.styleImageMissing.observers.length&&this.mapInstance.on("styleimagemissing",function(i){return t.zone.run(function(){return e.styleImageMissing.emit(i)})}),e.idle.observers.length&&this.mapInstance.on("idle",function(i){return t.zone.run(function(){return e.idle.emit(i)})})}},{key:"assign",value:function(e,t,i){if("string"==typeof t&&(t=t.split(".")),t.length>1){var r=t.shift();this.assign(e[r]="[object Object]"===Object.prototype.toString.call(e[r])?e[r]:{},t,i)}else e[t[0]]=i}}]),e}()).\u0275fac=function(e){return new(e||n)(o.LFG(o.R0b),o.LFG(C,8))},n.\u0275prov=o.Yz7({token:n,factory:n.\u0275fac}),n);function z(e,t,i){console.warn("[ngx-mapbox-gl]: ".concat(e,": ").concat(t," is deprecated, please use ").concat(i," instead."))}var P=function(){var e=function(){function e(t){h(this,e),this.MapService=t,this.layerClick=new o.vpe,this.layerDblClick=new o.vpe,this.layerMouseDown=new o.vpe,this.layerMouseUp=new o.vpe,this.layerMouseEnter=new o.vpe,this.layerMouseLeave=new o.vpe,this.layerMouseMove=new o.vpe,this.layerMouseOver=new o.vpe,this.layerMouseOut=new o.vpe,this.layerContextMenu=new o.vpe,this.layerTouchStart=new o.vpe,this.layerTouchEnd=new o.vpe,this.layerTouchCancel=ne
1w o.vpe,this.click=new o.vpe,this.dblClick=new o.vpe,this.mouseDown=new o.vpe,this.mouseUp=new o.vpe,this.mouseEnter=new o.vpe,this.mouseLeave=new o.vpe,this.mouseMove=new o.vpe,this.mouseOver=new o.vpe,this.mouseOut=new o.vpe,this.contextMenu=new o.vpe,this.touchStart=new o.vpe,this.touchEnd=new o.vpe,this.touchCancel=new o.vpe,this.layerAdded=!1}return d(e,[{key:"ngOnInit",value:function(){var e=this;this.warnDeprecatedOutputs(),this.sub=this.MapService.mapLoaded$.pipe((0,k.w)(function(){return(0,y.R)(e.MapService.mapInstance,"styledata").pipe(function(e){return e.lift(new g(!1))},(0,T.h)(function(){return!e.MapService.mapInstance.getLayer(e.id)}),(0,E.O)(!0))})).subscribe(function(t){return e.init(t)})}},{key:"ngOnChanges",value:function(e){!this.layerAdded||(e.paint&&!e.paint.isFirstChange()&&this.MapService.setAllLayerPaintProperty(this.id,e.paint.currentValue),e.layout&&!e.layout.isFirstChange()&&this.MapService.setAllLayerLayoutProperty(this.id,e.layout.currentValue),e.filter&&!e.filter.isFirstChange()&&this.MapService.setLayerFilter(this.id,e.filter.currentValue),e.before&&!e.before.isFirstChange()&&this.MapService.setLayerBefore(this.id,e.before.currentValue),(e.minzoom&&!e.minzoom.isFirstChange()||e.maxzoom&&!e.maxzoom.isFirstChange())&&this.MapService.setLayerZoomRange(this.id,this.minzoom,this.maxzoom))}},{key:"ngOnDestroy",value:function(){this.layerAdded&&this.MapService.removeLayer(this.id),this.sub&&this.sub.unsubscribe()}},{key:"init",value:function(e){this.MapService.addLayer({layerOptions:{id:this.id,type:this.t
1ype,source:this.source,metadata:this.metadata,"source-layer":this.sourceLayer,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this.layout,paint:this.paint},layerEvents:{layerClick:this.layerClick,layerDblClick:this.layerDblClick,layerMouseDown:this.layerMouseDown,layerMouseUp:this.layerMouseUp,layerMouseEnter:this.layerMouseEnter,layerMouseLeave:this.layerMouseLeave,layerMouseMove:this.layerMouseMove,layerMouseOver:this.layerMouseOver,layerMouseOut:this.layerMouseOut,layerContextMenu:this.layerContextMenu,layerTouchStart:this.layerTouchStart,layerTouchEnd:this.layerTouchEnd,layerTouchCancel:this.layerTouchCancel,click:this.click,dblClick:this.dblClick,mouseDown:this.mouseDown,mouseUp:this.mouseUp,mouseEnter:this.mouseEnter,mouseLeave:this.mouseLeave,mouseMove:this.mouseMove,mouseOver:this.mouseOver,mouseOut:this.mouseOut,contextMenu:this.contextMenu,touchStart:this.touchStart,touchEnd:this.touchEnd,touchCancel:this.touchCancel}},e,this.before),this.layerAdded=!0}},{key:"warnDeprecatedOutputs",value:function(){var t=z.bind(void 0,e.name);this.click.observers.length&&t("click","layerClick"),this.dblClick.observers.length&&t("dblClick","layerDblClick"),this.mouseDown.observers.length&&t("mouseDown","layerMouseDown"),this.mouseUp.observers.length&&t("mouseUp","layerMouseUp"),this.mouseEnter.observers.length&&t("mouseEnter","layerMouseEnter"),this.mouseLeave.observers.length&&t("mouseLeave","layerMouseLeave"),this.mouseMove.observers.length&&t("mouseMove","layerMouseMove"),this.mouseOver.observers.length&&t("mouseOver","layerMouseOver"),this.mouseOut.observers.length&&t("mouseOut","layerMouseOut"),this.contextMenu.observers.length&&t("contextMenu","layerContextMenu"),this.touchStart.observers.length&&t("touchStart","layerTouchStart"),this.touchEnd.observers.length&&t("touchEnd","layerTouchEnd"),this.touchCancel.observers.length&&t("touchCancel","layerTouchCancel")}}]),e}();return e.\u0275fac=function(t){return new(t||e)(o.Y36(A))},e.\u0275cmp=o.Xpm({type:e,selectors:[["mgl-layer"]],inputs:{id:"id",source:"source",type:"type",metadata:"metadata",sourceLayer:"sourceLayer",filter:"filter",layout:"layout",paint:"paint",before:"before",minzoom:"minzoom",maxzoom:"maxzoom"},outputs:{layerClick:"layerClick",layerDblClick:"layerDblClick",layerMouseDown:"layerMouseDown",layerMouseUp:"layerMouseUp",layerMouseEnter:"layerMouseEnter",layerMouseLeave:"layerMouseLeave",layerMouseMove:"layerMouseMove",layerMouseOver:"layerMouseOver",layerMouseOut:"layerMouseOut",layerContextMenu:"layerContextMenu",layerTouchStart:"layerTouchStart",layerTouchEnd:"layerTouchEnd",layerTouchCancel:"layerTouchCancel",click:"click",dblClick:"dblClick",mouseDown:"mouseDown",mouseUp:"mouseUp",mouseEnter:"mouseEnter",mouseLeave:"mouseLeave",mouseMove:"mouseMove",mouseOver:"mouseOver",mouseOut:"mouseOut",contextMenu:"contextMenu",touchStart:"touchStart",touchEnd:"touchEnd",touchCancel:"touchCancel"},features:[o.TTD],decls:0,vars:0,template:function(e,t){},encapsulation:2}),e}(),D=function(){var e=function(){function e(t){h(this,e),this.MapService=t,this.movingMethod="flyTo",this.mapResize=new o.vpe,this.mapRemove=new o.vpe,this.mapMouseDown=new o.vpe,this.mapMouseUp=new o.vpe,this.mapMouseMove=new o.vpe,this.mapClick=new o.vpe,this.mapDblClick=new o.vpe,this.mapMouseOver=new o.vpe,this.mapMouseOut=new o.vpe,this.mapContextMenu=new o.vpe,this.mapTouchStart=new o.vpe,this.mapTouchEnd=new o.vpe,this.mapTouchMove=new o.vpe,this.mapTouchCancel=new o.vpe,this.mapWheel=new o.vpe,this.moveStart=new o.vpe,this.move=new o.vpe,this.moveEnd=new o.vpe,this.mapDragStart=new o.vpe,this.mapDrag=new o.vpe,this.mapDragEnd=new o.vpe,this.zoomStart=new o.vpe,this.zoomEvt=new o.vpe,this.zoomEnd=new o.vpe,this.rotateStart=new o.vpe,this.rotate=new o.vpe,this.rotateEnd=new o.vpe,this.pitchStart=new o.vpe,this.pitchEvt=new o.vpe,this.pitchEnd=new o.vpe,this.boxZoomStart=new o.vpe,this.boxZoomEnd=new o.vpe,this.boxZoomCancel=new o.vpe,this.webGlContextLost=new o.vpe,this.webGlContextRestored=new o.vpe,this.mapLoad=new o.vpe,this.idle=new o.vpe,this.render=new o.vpe,this.mapError=ne
1w o.vpe,this.data=new o.vpe,this.styleData=new o.vpe,this.sourceData=new o.vpe,this.dataLoading=new o.vpe,this.styleDataLoading=new o.vpe,this.sourceDataLoading=new o.vpe,this.styleImageMissing=new o.vpe,this.resize=new o.vpe,this.remove=new o.vpe,this.mouseDown=new o.vpe,this.mouseUp=new o.vpe,this.mouseMove=new o.vpe,this.click=new o.vpe,this.dblClick=new o.vpe,this.mouseOver=new o.vpe,this.mouseOut=new o.vpe,this.contextMenu=new o.vpe,this.touchStart=new o.vpe,this.touchEnd=new o.vpe,this.touchMove=new o.vpe,this.touchCancel=new o.vpe,this.wheel=new o.vpe,this.dragStart=new o.vpe,this.drag=new o.vpe,this.dragEnd=new o.vpe,this.load=new o.vpe,this.error=new o.vpe}return d(e,[{key:"mapInstance",get:function(){return this.MapService.mapInstance}},{key:"ngAfterViewInit",value:function(){this.warnDeprecatedOutputs(),this.MapService.setup({accessToken:this.accessToken,customMapboxApiUrl:this.customMapboxApiUrl,mapOptions:{collectResourceTiming:this.collectResourceTiming,container:this.mapContainer.nativeElement,crossSourceCollisions:this.crossSourceCollisions,fadeDuration:this.fadeDuration,minZoom:this.minZoom,maxZoom:this.maxZoom,minPitch:this.minPitch,maxPitch:this.maxPitch,style:this.style,hash:this.hash,interactive:this.interactive,bearingSnap:this.bearingSnap,pitchWithRotate:this.pitchWithRotate,clickTolerance:this.clickTolerance,attributionControl:this.attributionControl,logoPosition:this.logoPosition,failIfMajorPerformanceCaveat:this.failIfMajorPerformanceCaveat,preserveDrawingBuffer:this.preserveDrawingBuffer,refreshExpiredTiles:this.refreshExpiredTiles,maxBounds:this.maxBounds,scrollZoom:this.scrollZoom,boxZoom:this.boxZoom,dragRotate:this.dragRotate,dragPan:this.dragPan,keyboard:this.keyboard,doubleClickZoom:this.doubleClickZoom,touchPitch:this.touchPitch,touchZoomRotate:this.touchZoomRotate,trackResize:this.trackResize,center:this.center,zoom:this.zoom,bearing:this.bearing,pitch:this.pitch,renderWorldCopies:this.renderWorldCopies,maxTileCacheSize:this.maxTileCacheSize,localIdeographFontFamily:this.localIdeographFontFamily,transformRequest:this.transformRequest,bounds:this.bounds?this.bounds:this.fitBounds,fitBoundsOptions:this.fitBoundsOptions,antialias:this.antialias,locale:this.locale},mapEvents:this}),this.cursorStyle&&this.MapService.changeCanvasCursor(this.cursorStyle)}},{key:"ngOnDestroy",value:function(){this.MapService.destroyMap()}},{key:"ngOnChanges",value:function(e){return(0,u.mG)(this,void 0,void 0,regeneratorRuntime.mark(function t(){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.MapService.mapCreated$.toPromise();case 2:e.cursorStyle&&!e.cursorStyle.isFirstChange()&&this.MapService.changeCanvasCursor(e.cursorStyle.currentValue),e.minZoom&&!e.minZoom.isFirstChange()&&this.MapService.updateMinZoom(e.minZoom.currentValue),e.maxZoom&&!e.maxZoom.isFirstChange()&&this.MapService.updateMaxZoom(e.maxZoom.currentValue),e.minPitch&&!e.minPitch.isFirstChange()&&this.MapService.updateMinPitch(e.minPitch.currentValue),e.maxPitch&&!e.maxPitch.isFirstChange()&&this.MapService.updateMaxPitch(e.maxPitch.currentValue),e.renderWorldCopies&&!e.renderWorldCopies.isFirstChange()&&this.MapService.updateRenderWorldCopies(e.renderWorldCopies.currentValue),e.scrollZoom&&!e.scrollZoom.isFirstChange()&&this.MapService.updateScrollZoom(e.scrollZoom.currentValue),e.dragRotate&&!e.dragRotate.isFirstChange()&&this.MapService.updateDragRotate(e.dragRotate.currentValue),e.touchPitch&&!e.touchPitch.isFirstChange()&&this.MapService.updateTouchPitch(e.touchPitch.currentValue),e.touchZoomRotate&&!e.touchZoomRotate.isFirstChange()&&this.MapService.updateTouchZoomRotate(e.touchZoomRotate.currentValue),e.doubleClickZoom&&!e.doubleClickZoom.isFirstChange()&&this.MapService.updateDoubleClickZoom(e.doubleClickZoom.currentValue),e.keyboard&&!e.keyboard.isFirstChange()&&this.MapService.updateKeyboard(e.keyboard.currentValue),e.dragPan&&!e.dragPan.isFirstChange()&&this.MapService.updateDragPan(e.dragPan.currentValue),e.boxZoom&&!e.boxZoom.isFirstChange()&&this.MapService.updateBoxZoom(e.boxZoom.currentValue),e.style&&!e.style.isFirstChange()&&this.MapService.updateStyle(e.style.currentValue),e.maxBounds&&!e.maxBounds.isFirstChange()&&this.MapService.updateMaxBounds(e.maxBounds.currentValue),e.fitBounds&&e.fitBounds.currentValue&&!e.fitBounds.isFirstChange()&&this.MapService.fitBounds(e.fitBounds.currentValue,this.fitBoundsOptions),e.fitScreenCoordinates&&e.fitScreenCoordinates.currentValue&&((this.center||this.zoom||this.pitch||this.fitBounds)&&e.fitScreenCoordinates.isFirstChange()&&console.warn("[ngx-mapbox-gl] center / zoom / pitch / fitBounds inputs are being overridden by fitScreenCoordinates input"),this.MapService.fitScreenCoordinates(e.fitScreenCoordinates.currentValue,this.bearing?this.bearing[0]:0,this.movingOptions)),!this.centerWithPanTo||!e.center||e.center.isFirstChange()||e.zoom||e.bearing||e.pitch?(e.center&&!e.center.isFirstChange()||e.zoom&&!e.zoom.isFirstChange()||e.bearing&&!e.bearing.isFirstChange()&&!e.fitScreenCoordinates||e.pitch&&
1!e.pitch.isFirstChange())&&this.MapService.move(this.movingMethod,this.movingOptions,e.zoom&&this.zoom?this.zoom[0]:void 0,e.center?this.center:void 0,e.bearing&&this.bearing?this.bearing[0]:void 0,e.pitch&&this.pitch?this.pitch[0]:void 0):this.MapService.panTo(this.center,this.panToOptions);case 21:case"end":return t.stop()}},t,this)}))}},{key:"warnDeprecatedOutputs",value:function(){var t=z.bind(void 0,e.name);this.resize.observers.length&&t("resize","mapResize"),this.remove.observers.length&&t("remove","mapRemove"),this.mouseDown.observers.length&&t("mouseDown","mapMouseDown"),this.mouseUp.observers.length&&t("mouseUp","mapMouseUp"),this.mouseMove.observers.length&&t("mouseMove","mapMouseMove"),this.click.observers.length&&t("click","mapClick"),this.dblClick.observers.length&&t("dblClick","mapDblClick"),this.mouseOver.observers.length&&t("mouseOver","mapMouseOver"),this.mouseOut.observers.length&&t("mouseOut","mapMouseOut"),this.contextMenu.observers.length&&t("contextMenu","mapContextMenu"),this.touchStart.observers.length&&t("touchStart","mapTouchStart"),this.touchEnd.observers.length&&t("touchEnd","mapTouchEnd"),this.touchMove.observers.length&&t("touchMove","mapTouchMove"),this.touchCancel.observers.length&&t("touchCancel","mapTouchCancel"),this.wheel.observers.length&&t("wheel","mapWheel"),this.dragStart.observers.length&&t("dragStart","mapDragStart"),this.drag.observers.length&&t("drag","mapDrag"),this.dragEnd.observers.length&&t("dragEnd","mapDragEnd"),this.load.observers.length&&t("load","mapLoad"),this.error.observers.length&&t("error","mapError")}}]),e}();return e.\u0275fac=function(t){return new(t||e)(o.Y36(A))},e.\u0275cmp=o.Xpm({type:e,selectors:[["mgl-map"]],viewQuery:function(e,t){var i;(1&e&&o.Gf(I,7),2&e)&&(o.iGM(i=o.CRH())&&(t.mapContainer=i.first))},inputs:{accessToken:"accessToken",collectResourceTiming:"collectResourceTiming",crossSourceCollisions:"crossSourceCollisions",customMapboxApiUrl:"customMapboxApiUrl",fadeDuration:"fadeDuration",hash:"hash",refreshExpiredTiles:"refreshExpiredTiles",failIfMajorPerformanceCaveat:"failIfMajorPerformanceCaveat",bearingSnap:"bearingSnap",interactive:"interactive",pitchWithRotate:"pitchWithRotate",clickTolerance:"clickTolerance",attributionControl:"attributionControl",logoPosition:"logoPosition",maxTileCacheSize:"maxTileCacheSize",localIdeographFontFamily:"localIdeographFontFamily",preserveDrawingBuffer:"preserveDrawingBuffer",trackResize:"trackResize",transformRequest:"transformRequest",bounds:"bounds",antialias:"antialias",locale:"locale",minZoom:"minZoom",maxZoom:"maxZoom",minPitch:"minPitch",maxPitch:"maxPitch",scrollZoom:"scrollZoom",dragRotate:"dragRotate",touchPitch:"touchPitch",touchZoomRotate:"touchZoomRotate",doubleClickZoom:"doubleClickZoom",keyboard:"keyboard",dragPan:"dragPan",boxZoom:"boxZoom",style:"style",center:"center",maxBounds:"maxBounds",zoom:"zoom",bearing:"bearing",pitch:"pitch",fitBoundsOptions:"fitBoundsOptions",renderWorldCopies:"renderWorldCopies",movingMethod:"movingMethod",movingOptions:"movingOptions",fitBounds:"fitBounds",fitScreenCoordinates:"fitScreenCoordinates",centerWithPanTo:"centerWithPanTo",panToOptions:"panToOptions",cursorStyle:"cursorStyle"},outputs:{mapResize:"mapResize",mapRemove:"mapRemove",mapMouseDown:"mapMouseDown",mapMouseUp:"mapMouseUp",mapMouseMove:"mapMouseMove",mapClick:"mapClick",mapDblClick:"mapDblClick",mapMouseOver:"mapMouseOver",mapMouseOut:"mapMouseOut",mapContextMenu:"mapContextMenu",mapTouchStart:"mapTouchStart",mapTouchEnd:"mapTouchEnd",mapTouchMove:"mapTouchMove",mapTouchCancel:"mapTouchCancel",mapWheel:"mapWheel",moveStart:"moveStart",move:"move",moveEnd:"moveEnd",mapDragStart:"mapDragStart",mapDrag:"mapDrag",mapDragEnd:"mapDragEnd",zoomStart:"zoomStart",zoomEvt:"zoomEvt",zoomEnd:"zoomEnd",rotateStart:"rotateStart",rotate:"rotate",rotateEnd:"rotateEnd",pitchStart:"pitchStart",pitchEvt:"pitchEvt",pitchEnd:"pitchEnd",boxZoomStart:"boxZoomStart",boxZoomEnd:"boxZoomEnd",boxZoomCancel:"boxZoomCancel",webGlContextLost:"webGlContextLost",webGlContextRestored:"webGlContextRestored",mapLoad:"mapLoad",idle:"idle",render:"render",mapError:"mapError",data:"data",styleData:"styleData",sourceData:"sourceData",dataLoading:"dataLoading",styleDataLoading:"styleDataLoading",sourceDataLoading:"sourceDataLoading",styleImageMissing:"styleImageMissing",resize:"resize",remove:"remove",mouseDown:"mouseDown",mouseUp:"mouseUp",mouseMove:"mouseMove",click:"click",dblClick:"dblClick",mouseOver:"mouseOver",mouseOut:"mouseOut",contextMenu:"contextMenu",touchStart:"touchStart",touchEnd:"touchEnd",touchMove:"touchMove",touchCancel:"touchCancel",wheel:"wheel",dragStart:"dragStart",drag:"drag",dragEnd:"dragEnd",load:"load",error:"error"},features:[o._Bn([A]),o.TTD],decls:2,vars:0,consts:[["container",""]],template:function(e,t){1&e&&o._UZ(0,"div",null,0)},styles:["[_nghost-%COMP%] {\n        display: block;\n      }\n      div[_ngcontent-%COMP%] {\n        height: 100%;\n        width: 100%;\n      }"],changeDetection:0}),e}(),L=function(){var e=function(){function e(t){h(this,e),this.MapService=t,this.popupClose=new o.vpe,this.popupOpen=new o.vpe,this.close=new o.vpe,this.open=new o.vpe}return d(e,[{key:"ngOnInit",value:function(){if(this.warnDeprecatedOutputs(),this.lngLat&&this.marker||this.feature&&this.lngLat||this.feature&&this.marker)throw new Error("marker, lngLat, feature input are mutually exclusive")}},{key:"ngOnChanges",value:function(e){if(e.lngLat&&!e.lngLat.isFirstChange()||e.feature&&!e.feature.is
1FirstChange()){var t=e.lngLat?this.lngLat:this.feature.geometry.coordinates;this.MapService.removePopupFromMap(this.popupInstance,!0);var i=this.createPopup();this.MapService.addPopupToMap(i,t,this.popupInstance.isOpen()),this.popupInstance=i}if(e.marker&&!e.marker.isFirstChange()){var r=e.marker.previousValue;r.markerInstance&&this.MapService.removePopupFromMarker(r.markerInstance),this.marker&&this.marker.markerInstance&&this.popupInstance&&this.MapService.addPopupToMarker(this.marker.markerInstance,this.popupInstance)}e.offset&&!e.offset.isFirstChange()&&this.popupInstance&&this.popupInstance.setOffset(this.offset)}},{key:"ngAfterViewInit",value:function(){this.popupInstance=this.createPopup(),this.addPopup(this.popupInstance)}},{key:"ngOnDestroy",value:function(){this.popupInstance&&(this.lngLat||this.feature?this.MapService.removePopupFromMap(this.popupInstance):this.marker&&this.marker.markerInstance&&this.MapService.removePopupFromMarker(this.marker.markerInstance)),this.popupInstance=void 0}},{key:"createPopup",value:function(){return this.MapService.createPopup({popupOptions:{closeButton:this.closeButton,closeOnClick:this.closeOnClick,closeOnMove:this.closeOnMove,focusAfterOpen:this.focusAfterOpen,anchor:this.anchor,offset:this.offset,className:this.className,maxWidth:this.maxWidth},popupEvents:{open:this.open,close:this.close,popupOpen:this.popupOpen,popupClose:this.popupClose}},this.content.nativeElement)}},{key:"addPopup",value:function(e){var t=this;this.MapService.mapCreated$.subscribe(function(){if(t.lngLat||t.feature)t.MapService.addPopupToMap(e,t.lngLat?t.lngLat:t.feature.geometry.coordinates);else{if(!t.marker||!t.marker.markerInstance)throw new Error("mgl-popup need either lngLat/marker/feature to be set");t.MapService.addPopupToMarker(t.marker.markerInstance,e)}})}},{key:"warnDeprecatedOutputs",value:function(){var t=z.bind(void 0,e.name);this.close.observers.length&&t("close","popupClose"),this.open.observers.length&&t("open","popupOpen")}}]),e}();return e.\u0275fac=function(t){return new(t||e)(o.Y36(A))},e.\u0275cmp=o.Xpm({type:e,selectors:[["mgl-popup"]],viewQuery:function(e,t){var i;(1&e&&o.Gf(M,7),2&e)&&(o.iGM(i=o.CRH())&&(t.content=i.first))},inputs:{closeButton:"closeButton",closeOnClick:"closeOnClick",closeOnMove:"closeOnMove",focusAfterOpen:"focusAfterOpen",anchor:"anchor",className:"className",maxWidth:"maxWidth",feature:"feature",lngLat:"lngLat",marker:"marker",offset:"offset"},outputs:{popupClose:"popupClose",popupOpen:"popupOpen",close:"close",open:"open"},features:[o.TTD],ngContentSelectors:S,decls:3,vars:0,consts:[["content",""]],template:function(e,t){1&e&&(o.F$t(),o.TgZ(0,"div",null,0),o.Hsn(2),o.qZA())},encapsulation:2,changeDetection:0}),e}(),R=new o.OlP("MapboxApiKey"),B=function(){var e=function(){function e(){h(this,e)}return d(e,null,[{key:"withConfig",value:function(t){return{ngModule:e,providers:[{provide:C,useValue:t.accessToken},{provide:R,useValue:t.geocoderAccessToken||t.accessToken}]}}}]),e}();return e.\u0275fac=function(t){return new(t||e)},e.\u0275mod=o.oAB({type:e}),e.\u0275inj=o.cJS({imports:[[a.ez]]}),e}()},84960:function(e,t,i){"use strict";i.d(t,{I:function(){return o}});var r,n=i(37716),a=i(24953),o=((r=function(){function e(t){h(this,e),this.ssrService=t,this.isActive=!1}return d(e,[{key:"start",value:function(){!this.ssrService.isBrowser||(this.isActive=!0)}},{key:"stop",value:function(){!this.ssrService.isBrowser||(this.isActive=!1)}}]),e}()).\u0275fac=function(e){return new(e||r)(n.Y36(a.o))},r.\u0275cmp=n.Xpm({type:r,selectors:[["app-loader-united24"]],decls:23,vars:2,consts:[[1,"loader"],[1,"elements"],["width","422","height","40","viewBox","0 0 422 40","fill","none","xmlns","http://www.w3.org/2000/svg"],["d","M124.578 6.14598H145.731V38.7599H124.578V6.14598ZM37.2698 19.9366C37.2698 24.5953 34.7007 26.7877 29.2112 26.7877C23.7218 26.7877 21.1498 24.5982 21.1498 19.9366V6.14598H0V20.7302C0 34.3809 7.63894 39.2252 29.2112 39.2252C50.7835 39.2252 58.4225 34.3724 58.4225 20.7302V6.14598H37.2698V19.9366ZM147.966 18.261H165.664V38.7599H186.817V18.261H204.516V6.14598H147.966V18.261ZM101.005 23.0596L84.4651 6.14598H61.1343V38.7599H82.0044V21.8463L98.5298 38.7599H121.872V6.14598H101.005V23.0596ZM368.379 
113.0456C368.379 4.14775 360.506 0 343.921 0C326.031 0 318.483 4.75294 318.483 16.12H335.114C335.114 12.2063 337.863 10.8076 343.316 10.8076C348.625 10.8076 350.304 11.741 350.304 13.1854C350.304 15.0952 349.698 15.0952 336.316 18.2153C321.503 21.7093 316.905 28.6061 316.905 35.2687V38.7628H367.174V28.175H337.772C339.545 26.4965 344.574 26.0312 355.71 23.8931C363.115 22.5 368.379 19.9366 368.379 13.0456ZM206.762 38.7599H254.888V29.0314H226.987V26.2824H246.835V18.6321H226.987V15.8831H254.894V6.14598H206.762V38.7599ZM422 21.4296V32.3313H414.452V38.7599H397.265V32.3313H368.893V21.3239L389.252 1.29029H414.455V21.4182L422 21.4296ZM397.262 10.7134L386.414 21.4296H397.262V10.7134ZM317.598 22.4658C317.598 33.4132 310.702 38.7713 296.491 38.7713H257.592V6.14598H296.491C310.702 6.14598 317.598 11.5041 317.598 22.4658ZM296.959 22.4658C296.959 18.7833 294.907 17.0592 290.622 17.0592H278.23V27.8696H290.622C294.907 27.8582 296.959 26.134 296.959 22.4658Z","fill","white"],["x","0","y","0","width","422","height","40"],[1,"bars"],[1,"animated-bar"]],template:function(e,t){1&e&&(n.TgZ(0,"div",0),n.TgZ(1,"div",1),n.O4$(),n.TgZ(2,"svg",2),n._UZ(3,"path",3),n.TgZ(4,"foreignObject",4),n.kcU(),n.TgZ(5,"div",5),n._UZ(6,"div",6),n._UZ(7,"div",6),n._UZ(8,"div",6),n._UZ(9,"div",6),n._UZ(10,"div",6),n._UZ(11,"div",6),n._UZ(12,"div",6),n._UZ(13,"div",6),n._UZ(14,"div",6),n._UZ(15,"div",6),n._UZ(16,"div",6),n._UZ(17,"div",6),n._UZ(18,"div",6),n._UZ(19,"div",6),n._UZ(20,"div",6),n._UZ(21,"div",6),n._UZ(22,"div",6),n.qZA(),n.qZA(),n.qZA(),n.qZA(),n.qZA()),2&e&&n.ekj("shown",t.isActive)},styles:[".loader[_ngcontent-%COMP%]{position:absolute;display:block;top:0;left:0;right:0;bottom:0;width:100%;height:100%;transition:opacity ease 1s,visibility ease 1s;z-index:20000;overflow:hidden;display:flex;justify-content:space-around;align-items:center;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.loader[_ngcontent-%COMP%]:not(.shown){opacity:0;visibility:hidden}.elements[_ngcontent-%COMP%]{position:relative;max-width:80%}.elements[_ngcontent-%COMP%]   svg[_ngcontent-%COMP%]{max-width:100%}.elements[_ngcontent-%COMP%]   .bars[_ngcontent-%COMP%]{position:absolute;top:0;bottom:0;left:0;right:0}.elements[_ngcontent-%COMP%]   .animated-bar[_ngcontent-%COMP%]{position:absolute;display:block;background-color:#000;-webkit-animation-duration:1s;animation-duration:1s;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-direction:alternate;animation-direction:alternate;-webkit-animation-timing-function:ease-in;animation-timing-function:ease-in;-webkit-backface-visibility:hidden;backface-visibility:hidden;transform-style:preserve-3d}.elements[_ngcontent-%COMP%]   .animated-bar[_ngcontent-%COMP%]:nth-child(1){bottom:0;left:30px;height:0;width:0;-webkit-animation-name:bar1;animation-name:bar1;-webkit-animation-delay:.1s;animation-delay:.1s}@-webkit-keyframes bar1{0%{left:30px;height:0;width:0}60%{left:30px;height:0;width:0}to{left:0;height:40px;width:30px}}@keyframes bar1{0%{left:30px;height:0;width:0}60%{left:30px;height:0;width:0}to{left:0;height:40px;width:30px}}.elements[_ngcontent-%COMP%]   .animated-bar[_ngcontent-%COMP%]:nth-child(2){bottom:0;left:30px;height:0;width:30px;-webkit-animation-name:bar2;animation-name:bar2;-webkit-animation-delay:.2s;animation-delay:.2s}@-webkit-keyframes bar2{0%{height:0}60%{height:0}to{height:40px}}@keyframes bar2{0%{height:0}60%{height:0}to{height:40px}}.elements[_ngcontent-%COMP%]   .animated-bar[_ngcontent-%COMP%]:nth-child(3){bottom:0;left:90px;height:40px;width:0;-webkit-animation-name:bar3;animation-name:bar3;-webkit-animation-delay:.3s;animation-delay:.3s}@-webkit-keyframes bar3{0%{left:90px;width:0}60%{left:90px;width:0}to{left:60px;width:30px}}@keyframes bar3{0%{left:90px;width:0}60%{left:90px;width:0}to{left:60px;width:30px}}.elements[_ngcontent-%COMP%]   .animated-bar[_ngcontent-%COMP%]:nth-child(4){top:0;left:90px;height:0;width:32px;-webkit-animation-name:bar4;animation-name:bar4;-webkit-animation-delay:.4s;animation-delay:.4s}@-webkit-keyframes bar4{0%{height:0}60%{height:0}to{height:40px}}@keyframes bar4{0%{height:0}60%{height:0}to{height:40px}}
1.elements[_ngcontent-%COMP%]   .animated-bar[_ngcontent-%COMP%]:nth-child(5){bottom:0;left:122px;height:0;width:24px;-webkit-animation-name:bar5;animation-name:bar5;-webkit-animation-delay:.5s;animation-delay:.5s}@-webkit-keyframes bar5{0%{height:0}60%{height:0}to{height:40px}}@keyframes bar5{0%{height:0}60%{height:0}to{height:40px}}.elements[_ngcontent-%COMP%]   .animated-bar[_ngcontent-%COMP%]:nth-child(6){top:0;height:0;left:174px;width:0;-webkit-animation-name:bar6;animation-name:bar6;-webkit-animation-delay:.6s;animation-delay:.6s}@-webkit-keyframes bar6{0%{height:0;left:174px;width:0}60%{height:0;left:174px;width:0}to{height:40px;left:146px;width:28px}}@keyframes bar6{0%{height:0;left:174px;width:0}60%{height:0;left:174px;width:0}to{height:40px;left:146px;width:28px}}.elements[_ngcontent-%COMP%]   .animated-bar[_ngcontent-%COMP%]:nth-child(7){bottom:0;height:0;left:174px;width:32px;-webkit-animation-name:bar7;animation-name:bar7;-webkit-animation-delay:.7s;animation-delay:.7s}@-webkit-keyframes bar7{0%{height:0}60%{height:0}to{height:40px}}@keyframes bar7{0%{height:0}60%{height:0}to{height:40px}}.elements[_ngcontent-%COMP%]   .animated-bar[_ngcontent-%COMP%]:nth-child(8){top:0;height:0;left:206px;width:24px;-webkit-animation-name:bar8;animation-name:bar8;-webkit-animation-delay:.8s;animation-delay:.8s}@-webkit-keyframes bar8{0%{height:0}60%{height:0}to{height:40px}}@keyframes bar8{0%{height:0}60%{height:0}to{height:40px}}.elements[_ngcontent-%COMP%]   .animated-bar[_ngcontent-%COMP%]:nth-child(9){bottom:0;height:0;left:256px;width:0;-webkit-animation-name:bar9;animation-name:bar9;-webkit-animation-delay:.9s;animation-delay:.9s}@-webkit-keyframes bar9{0%{left:256px;width:0;height:0}60%{left:256px;width:0;height:0}to{left:230px;width:26px;height:40px}}@keyframes bar9{0%{left:256px;width:0;height:0}60%{left:256px;width:0;height:0}to{left:230px;width:26px;height:40px}}.elements[_ngcontent-%COMP%]   .animated-bar[_ngcontent-%COMP%]:nth-child(10){top:0;height:0;left:256px;width:24px;-webkit-animation-name:bar10;animation-name:bar10;-webkit-animation-delay:1s;animation-delay:1s}@-webkit-keyframes bar10{0%{height:0}60%{height:0}to{height:40px}}@keyframes bar10{0%{height:0}60%{height:0}to{height:40px}}.elements[_ngcontent-%COMP%]   .animated-bar[_ngcontent-%COMP%]:nth-child(11){bottom:0;left:280px;height:0;width:0;-webkit-animation-name:bar11;animation-name:bar11;-webkit-animation-delay:1.1s;animation-delay:1.1s}@-webkit-keyframes bar11{0%{height:0;width:0}60%{height:0;width:0}to{height:40px;width:40px}}@keyframes bar11{0%{height:0;width:0}60%{height:0;width:0}to{height:40px;width:40px}}.elements[_ngcontent-%COMP%]   .animated-bar[_ngcontent-%COMP%]:nth-child(12){left:318px;width:52px;top:20px;height:0;-webkit-animation-name:bar12;animation-name:bar12;-webkit-animation-delay:1.2s;animation-delay:1.2s}@-webkit-keyframes bar12{0%{top:20px;height:0}40%{top:20px;height:0}to{top:0;height:40px}}@keyframes bar12{0%{top:20px;height:0}40%{top:20px;height:0}to{top:0;height:40px}}.elements[_ngcontent-%COMP%]   .animated-bar[_ngcontent-%COMP%]:nth-child(13){bottom:0;left:422px;width:0;height:0;-webkit-animation-name:bar13;animation-name:bar13;-webkit-animation-delay:1.3s;animation-delay:1.3s}@-webkit-keyframes bar13{0%{left:422px;width:0;height:0}60%{left:422px;width:0;height:0}to{left:370px;width:52px;height:40px}}@keyframes bar13{0%{left:422px;width:0;height:0}60%{left:422px;width:0;height:0}to{left:370px;width:52px;height:40px}}"]}),r)},89239:function(e,t,i){"use strict";i.d(t,{K:function(){return s}});var r,n=i(38583),a=i(52948),o=i(37716),s=((r=d(function e(){h(this,e)})).\u0275fac=function(e){return new(e||r)},r.\u0275mod=o.oAB({type:r}),r.\u0275inj=o.cJS({imports:[[n.ez,a.I]]}),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.