task-17-lct.github.io/static/js/483.cfd1db64.chunk.js
2023-05-29 01:03:19 +03:00

3 lines
1.0 MiB

/*! For license information please see 483.cfd1db64.chunk.js.LICENSE.txt */
(self.webpackChunkfrontend1=self.webpackChunkfrontend1||[]).push([[483],{5483:function(e,t,i){var r=i(8416).default,n=i(6115).default,a=i(3515).default,o=i(1588).default,s=i(3808).default,l=i(4993).default,u=i(1589).default,c=i(861).default,h=i(7424).default,f=i(4704).default,d=i(6690).default,p=i(9728).default,v=i(1655).default,m=i(6389).default,y=i(3496).default;e.exports=function(){"use strict";var e,t,i;function _(r,n){if(e)if(t){var a="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+e+")(sharedChunk); ("+t+")(sharedChunk); self.onerror = null;",o={};e(o),i=n(o),"undefined"!==typeof window&&window&&window.URL&&window.URL.createObjectURL&&(i.workerUrl=window.URL.createObjectURL(new Blob([a],{type:"text/javascript"})))}else t=n;else e=n}return _(["exports"],(function(e){var t,i,r,_="undefined"!=typeof self?self:{},g="2.14.1",x={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(null==t){var e=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{t=null!={NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0}.API_URL_REGEX?new RegExp({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0}.API_URL_REGEX):e}catch(_){t=e}}return t},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(!x.API_URL)return null;try{var t=new URL(x.API_URL);return"api.mapbox.cn"===t.hostname?"https://events.mapbox.cn/events/v2":"api.mapbox.com"===t.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},b={supported:!1,testSupport:function(e){!w&&r&&(k?T(e):i=e)}},w=!1,k=!1;function T(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,r),e.isContextLost())return;b.supported=!0}catch(e){}e.deleteTexture(t),w=!0}_.document&&((r=_.document.createElement("img")).onload=function(){i&&T(i),i=null,k=!0},r.onerror=function(){w=!0,i=null},r.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");var E="01",S=M;function M(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}M.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 A=I;function I(e,t){this.x=e,this.y=t}I.prototype={clone:function(){return new I(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}},I.convert=function(e){return e instanceof I?e:Array.isArray(e)?new I(e[0],e[1]):e};var C=Math.PI/180,z=180/Math.PI;function P(e){return e*C}function D(e){return e*z}var L=[[0,0],[1,0],[1,1],[0,1]];function R(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 B(e,t,i,r){var n=new S(e,t,i,r);return function(e){return n.solve(e)}}var O=B(.25,.1,.25,1);function F(e,t,i){return Math.min(i,Math.max(t,e))}function U(e,t,i){return(i=F((i-e)/(t-e),0,1))*i*(3-2*i)}function V(e,t,i){var r=i-t,n=((e-t)%r+r)%r+t;return n===t?i:n}function N(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 j(e){var t=[];for(var i in e)t.push(e[i]);return t}function G(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 Z=1;function q(){return Z++}function W(){return function e(t){return t?(t^Math.random()*(16>>t/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,e)}()}function X(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function H(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 Y(e,t){e.forEach((function(e){t[e]&&(t[e]=t[e].bind(t))}))}function K(e,t){return-1!==e.indexOf(t,e.length-t.length)}function J(e,t,i){var r={};for(var n in e)r[n]=t.call(i||this,e[n],n,e);return r}function $(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 Q(e){return Array.isArray(e)?e.map(Q):"object"==typeof e&&e?J(e,Q):e}var ee={};function te(e){ee[e]||("undefined"!=typeof console&&console.warn(e),ee[e]=!0)}function ie(e,t,i){return(i.y-e.y)*(t.x-e.x)>(t.y-e.y)*(i.x-e.x)}function re(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 ne(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function ae(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 oe=null;function se(e){if(null==oe){var t=e.navigator?e.navigator.userAgent:null;oe=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return oe}function le(e){try{var t=_[e];return t.setItem("_mapbox_test_",1),t.removeItem("_mapbox_test_"),!0}catch(e){return!1}}function ue(e,t){return[e[4*t],e[4*t+1],e[4*t+2],e[4*t+3]]}var ce,he,fe="mapbox-tiles",de=500,pe=50;function ve(){try{return _.caches}catch(e){}}function me(){ve()&&!ce&&(ce=_.caches.open(fe))}function ye(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),r=i.filter((function(e){var t=e.split("=");return"language"===t[0]||"worldview"===t[0]}));return r.length?"".concat(e.slice(0,t),"?").concat(r.join("&")):e.slice(0,t)}var _e=1/0,ge={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(ge);var xe=function(e){v(i,e);var t=m(i);function i(e,r,n){var a;return d(this,i),401===r&&ze(n)&&(e+=": you may have provided an invalid 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 p(i,[{key:"toString",value:function(){return"".concat(this.name,": ").concat(this.message," (").concat(this.status,"): ").concat(this.url)}}]),i}(y(Error)),be=ne()?function(){return self.worker&&self.worker.referrer}:function(){return("blob:"===_.location.protocol?_.parent:_).location.href},we=function(e,t){if(!(/^file:/.test(i=e.url)||/^file:/.test(be())&&!/^\w+:/.test(i))){if(_.fetch&&_.Request&&_.AbortController&&_.Request.prototype.hasOwnProperty("signal"))return function(e,t){var i,r=new _.AbortController,n=new _.Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,referrer:be(),referrerPolicy:e.referrerPolicy,signal:r.signal}),a=!1,o=!1,s=(i=n.url).indexOf("sku=")>0&&ze(i);"json"===e.type&&n.headers.set("Accept","application/json");var l=function(i,r,a){if(!o){if(i&&"SecurityError"!==i.message&&te(i),r&&a)return u(r);var l=Date.now();_.fetch(n).then((function(i){if(i.ok){var r=s?i.clone():null;return u(i,r,l)}return t(new xe(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(me(),ce){var r={status:t.status,statusText:t.statusText,headers:new _.Headers};t.headers.forEach((function(e,t){return r.headers.set(t,e)}));var n=ae(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===he)try{new Response(new ReadableStream),he=!0}catch(e){he=!1}he?t(e.body):e.blob().then(t)}(t,(function(t){var i=new _.Response(t,r);me(),ce&&ce.then((function(t){return t.put(ye(e.url),i)})).catch((function(e){return te(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(me(),!ce)return t(null);var i=ye(e.url);ce.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=ae(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(ne()&&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 _.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(e){return t(e)}t(null,r,i.getResponseHeader("Cache-Control"),i.getResponseHeader("Expires"))}else t(new xe(i.statusText,i.status,e.url))},i.send(e.body),{cancel:function(){return i.abort()}}}(e,t)},ke=function(e,t){return we(G(e,{type:"arrayBuffer"}),t)};function Te(e){var t=_.document.createElement("a");return t.href=e,t.protocol===_.document.location.protocol&&t.host===_.document.location.host}var Ee,Se,Me="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";Ee=[],Se=0;var Ae=function e(t,i){if(b.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),Se>=x.MAX_PARALLEL_IMAGE_REQUESTS){var r={requestParameters:t,callback:i,cancelled:!1,cancel:function(){this.cancelled=!0}};return Ee.push(r),r}Se++;var n=!1,a=function(){if(!n)for(n=!0,Se--;Ee.length&&Se<x.MAX_PARALLEL_IMAGE_REQUESTS;){var t=Ee.shift(),i=t.requestParameters,r=t.callback;t.cancelled||(t.cancel=e(i,r).cancel)}},o=ke(t,(function(e,t,r,n){a(),e?i(e):t&&(_.createImageBitmap?function(e,t){var i=new _.Blob([new Uint8Array(e)],{type:"image/png"});_.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 _.Image,r=_.URL;i.onload=function(){t(null,i),r.revokeObjectURL(i.src),i.onload=null,_.requestAnimationFrame((function(){i.src=Me}))},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 _.Blob([new Uint8Array(e)],{type:"image/png"});i.src=e.byteLength?r.createObjectURL(n):Me}(t,(function(e,t){return i(e,t,r,n)})))}));return{cancel:function(){o.cancel(),a()}}},Ie="NO_ACCESS_TOKEN";function Ce(e){return 0===e.indexOf("mapbox:")}function ze(e){return x.API_URL_REGEX.test(e)}function Pe(e){return x.API_CDN_URL_REGEX.test(e)}function De(e){return x.API_STYLE_REGEX.test(e)&&!Le(e)}function Le(e){return x.API_SPRITE_REGEX.test(e)}var Re=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Be(e){var t=e.match(Re);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 Oe(e){var t=e.params.length?"?".concat(e.params.join("&")):"";return"".concat(e.protocol,"://").concat(e.authority).concat(e.path).concat(t)}function Fe(e){if(!e)return null;var t=e.split(".");if(!t||3!==t.length)return null;try{return JSON.parse(decodeURIComponent(_.atob(t[1]).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join("")))}catch(e){return null}}var Ue=function(){function e(t){d(this,e),this.type=t,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}return p(e,[{key:"getStorageKey",value:function(e){var t=Fe(x.ACCESS_TOKEN),i="";return i=t&&t.u?_.btoa(encodeURIComponent(t.u).replace(/%([0-9A-F]{2})/g,(function(e,t){return String.fromCharCode(Number("0x"+t))}))):x.ACCESS_TOKEN||"",e?"mapbox.eventData.".concat(e,":").concat(i):"mapbox.eventData:".concat(i)}},{key:"fetchEventData",value:function(){var e=le("localStorage"),t=this.getStorageKey(),i=this.getStorageKey("uuid");if(e)try{var r=_.localStorage.getItem(t);r&&(this.eventData=JSON.parse(r));var n=_.localStorage.getItem(i);n&&(this.anonId=n)}catch(e){te("Unable to read from LocalStorage")}}},{key:"saveEventData",value:function(){var e=le("localStorage"),t=this.getStorageKey(),i=this.getStorageKey("uuid");if(e)try{_.localStorage.setItem(i,this.anonId),Object.keys(this.eventData).length>=1&&_.localStorage.setItem(t,JSON.stringify(this.eventData))}catch(e){te("Unable to write to LocalStorage")}}},{key:"processRequests",value:function(e){}},{key:"postEvent",value:function(e,t,i,r){var n=this;if(x.EVENTS_URL){var a=Be(x.EVENTS_URL);a.params.push("access_token=".concat(r||x.ACCESS_TOKEN||""));var o={event:this.type,created:new Date(e).toISOString()},s=t?G(o,t):o,l={url:Oe(a),headers:{"Content-Type":"text/plain"},body:JSON.stringify([s])};this.pendingRequest=function(e,t){return we(G(e,{method:"POST"}),t)}(l,(function(e){n.pendingRequest=null,i(e),n.saveEventData(),n.processRequests(r)}))}}},{key:"queueRequest",value:function(e,t){this.queue.push(e),this.processRequests(t)}}]),e}(),Ve=new(function(e){v(i,e);var t=m(i);function i(e){var r;return d(this,i),(r=t.call(this,"appUserTurnstile"))._customAccessToken=e,r}return p(i,[{key:"postTurnstileEvent",value:function(e,t){x.EVENTS_URL&&x.ACCESS_TOKEN&&Array.isArray(e)&&e.some((function(e){return Ce(e)||ze(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=Fe(x.ACCESS_TOKEN),r=i?i.u:x.ACCESS_TOKEN,n=r!==this.eventData.tokenU;H(this.anonId)||(this.anonId=W(),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:g,skuId:E,"enabled.telemetry":!1,userId:this.anonId},(function(e){e||(t.eventData.lastSuccess=a,t.eventData.tokenU=r)}),e):this.processRequests()}}}]),i}(Ue)),Ne=Ve.postTurnstileEvent.bind(Ve),je=new(function(e){v(i,e);var t=m(i);function i(){var e;return d(this,i),(e=t.call(this,"map.load")).success={},e.skuToken="",e}return p(i,[{key:"postMapLoadEvent",value:function(e,t,i,r){this.skuToken=t,this.errorCb=r,x.EVENTS_URL&&(i||x.ACCESS_TOKEN?this.queueRequest({id:e,timestamp:Date.now()},i):this.errorCb(new Error(Ie)))}},{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(),H(this.anonId)||(this.anonId=W()),this.postEvent(n,{sdkIdentifier:"mapbox-gl-js",sdkVersion:g,skuId:E,skuToken:this.skuToken,userId:this.anonId},(function(e){e?t.errorCb(e):r&&(t.success[r]=!0)}),e))}}}]),i}(Ue)),Ge=je.postMapLoadEvent.bind(je),Ze=new(function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.call(this,"gljs.performance")}return p(i,[{key:"postPerformanceEvent",value:function(e,t){x.EVENTS_URL&&(e||x.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=_.performance.getEntriesByType("resource"),i=_.performance.getEntriesByType("mark"),r=function(e){var t={};if(e)for(var i in e)if("other"!==i){var r,n=f(e[i]);try{for(n.s();!(r=n.n()).done;){var a=r.value,o="".concat(i,"ResolveRangeMin"),s="".concat(i,"ResolveRangeMax"),l="".concat(i,"RequestCount"),u="".concat(i,"RequestCachedCount");t[o]=Math.min(t[o]||1/0,a.startTime),t[s]=Math.max(t[s]||-1/0,a.responseEnd);var c=function(e){void 0===t[e]&&(t[e]=0),++t[e]};void 0!==a.transferSize&&0===a.transferSize&&c(u),c(l)}}catch(h){n.e(h)}finally{n.f()}}return t}(function(e,t){var i={};if(e){var r,n=f(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,Je)),n=_.devicePixelRatio,a=_.navigator.connection||_.navigator.mozConnection||_.navigator.webkitConnection,o={counters:[],metadata:[],attributes:[]},s=function(e,t,i){null!=i&&e.push({name:t,value:i.toString()})};for(var l in r)s(o.counters,l,r[l]);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 u=function(){var e=h[c],t=Ye[e],r=i.find((function(e){return e.name===t}));r&&s(o.counters,t,r.startTime)},c=0,h=Object.keys(Ye);c<h.length;c++)u();return s(o.counters,"visibilityHidden",e.visibilityHidden),s(o.attributes,"style",function(e){if(e){var t,i=f(e);try{for(i.s();!(t=i.n()).done;){var r=t.value.name.split("?")[0];if(De(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",_.navigator.userAgent),s(o.metadata,"screenWidth",_.screen.width),s(o.metadata,"screenHeight",_.screen.height),s(o.metadata,"windowWidth",_.innerWidth),s(o.metadata,"windowHeight",_.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",g),s(o.metadata,"sdkIdentifier","mapbox-gl-js"),o}(i.performanceData),a=f(n.metadata);try{for(a.s();!(t=a.n()).done;)t.value}catch(c){a.e(c)}finally{a.f()}var o,s=f(n.counters);try{for(s.s();!(o=s.n()).done;)o.value}catch(c){s.e(c)}finally{s.f()}var l,u=f(n.attributes);try{for(u.s();!(l=u.n()).done;)l.value}catch(c){u.e(c)}finally{u.f()}this.postEvent(r,n,(function(){}),e)}}}]),i}(Ue)),qe=Ze.postPerformanceEvent.bind(Ze),We=new(function(e){v(i,e);var t=m(i);function i(){var e;return d(this,i),(e=t.call(this,"map.auth")).success={},e.skuToken="",e}return p(i,[{key:"getSession",value:function(e,t,i,r){var n=this;if(x.API_URL&&x.SESSION_PATH){var a=Be(x.API_URL+x.SESSION_PATH);a.params.push("sku=".concat(t||"")),a.params.push("access_token=".concat(r||x.ACCESS_TOKEN||""));var o={url:Oe(a),headers:{"Content-Type":"text/plain"}};this.pendingRequest=function(e,t){return we(G(e,{method:"GET"}),t)}(o,(function(e){n.pendingRequest=null,i(e),n.saveEventData(),n.processRequests(r)}))}}},{key:"getSessionAPI",value:function(e,t,i,r){this.skuToken=t,this.errorCb=r,x.SESSION_PATH&&x.API_URL&&(i||x.ACCESS_TOKEN?this.queueRequest({id:e,timestamp:Date.now()},i):this.errorCb(new Error(Ie)))}},{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}(Ue)),Xe=We.getSessionAPI.bind(We),He=new Set,Ye={create:"create",load:"load",fullLoad:"fullLoad"},Ke={mark:function(e){_.performance.mark(e)},measure:function(e,t,i){_.performance.measure(e,t,i)}};function Je(e){var t=e.name.split("?")[0];return Pe(t)&&t.includes("mapbox-gl.js")?"javascript":Pe(t)&&t.includes("mapbox-gl.css")?"css":function(e){return x.API_FONTS_REGEX.test(e)}(t)?"fontRange":Le(t)?"sprite":De(t)?"style":function(e){return x.API_TILEJSON_REGEX.test(e)}(t)?"tilejson":"other"}var $e,Qe,et,tt,it=_.performance;function rt(e){var t=e?e.url.toString():void 0;return it.getEntriesByName(t)}var nt={now:function(){return void 0!==et?et:_.performance.now()},setNow:function(e){et=e},restoreNow:function(){et=void 0},frame:function(e){var t=_.requestAnimationFrame(e);return{cancel:function(){return _.cancelAnimationFrame(t)}}},getImageData:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=e.width,r=e.height;tt||(tt=_.document.createElement("canvas"));var n=tt.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("failed to create canvas 2d context");return(i>tt.width||r>tt.height)&&(tt.width=i,tt.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 $e||($e=_.document.createElement("a")),$e.href=e,$e.href},get devicePixelRatio(){return _.devicePixelRatio},get prefersReducedMotion(){return!!_.matchMedia&&(null==Qe&&(Qe=_.matchMedia("(prefers-reduced-motion: reduce)")),Qe.matches)}};function at(e,t,i){i[e]&&-1!==i[e].indexOf(t)||(i[e]=i[e]||[],i[e].push(t))}function ot(e,t,i){if(i&&i[e]){var r=i[e].indexOf(t);-1!==r&&i[e].splice(r,1)}}var st=p((function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};d(this,e),G(this,i),this.type=t})),lt=function(e){v(i,e);var t=m(i);function i(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return d(this,i),t.call(this,"error",G({error:e},r))}return p(i)}(st),ut=function(){function e(){d(this,e)}return p(e,[{key:"on",value:function(e,t){return this._listeners=this._listeners||{},at(e,t,this._listeners),this}},{key:"off",value:function(e,t){return ot(e,t,this._listeners),ot(e,t,this._oneTimeListeners),this}},{key:"once",value:function(e,t){var i=this;return t?(this._oneTimeListeners=this._oneTimeListeners||{},at(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 st(e,t||{}));var i=e.type;if(this.listens(i)){e.target=this;var r,n=this._listeners&&this._listeners[i]?this._listeners[i].slice():[],a=f(n);try{for(a.s();!(r=a.n()).done;)r.value.call(this,e)}catch(h){a.e(h)}finally{a.f()}var o,s=this._oneTimeListeners&&this._oneTimeListeners[i]?this._oneTimeListeners[i].slice():[],l=f(s);try{for(l.s();!(o=l.n()).done;){var u=o.value;ot(i,u,this._oneTimeListeners),u.call(this,e)}}catch(h){l.e(h)}finally{l.f()}var c=this._eventedParent;c&&(G(e,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),c.fire(e))}else e instanceof lt&&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}(),ct=JSON.parse('{"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360,"units":"degrees"},"pitch":{"type":"number","default":0,"units":"degrees"},"light":{"type":"light"},"terrain":{"type":"terrain"},"fog":{"type":"fog"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"type":"array","value":"layer"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],"source_vector":{"type":{"required":true,"type":"enum","values":{"vector":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"scheme":{"type":"enum","values":{"xyz":{},"tms":{}},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"type":"enum","values":{"raster":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"scheme":{"type":"enum","values":{"xyz":{},"tms":{}},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"type":"enum","values":{"raster-dem":{}}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512,"units":"pixels"},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":{},"mapbox":{}},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":{"geojson":{}}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":{}}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":{}}},"url":{"required":true,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"hillshade":{},"background":{},"sky":{}},"required":true},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"}},"layout":["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background","layout_sky"],"layout_background":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"},"fill-extrusion-edge-radius":{"type":"number","private":true,"default":0,"minimum":0,"maximum":1,"property-type":"constant"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":{},"round":{},"square":{}},"default":"butt","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":{},"round":{},"miter":{}},"default":"miter","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"requires":[{"line-join":"miter"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-round-limit":{"type":"number","default":1.05,"requires":[{"line-join":"round"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":{},"line":{},"line-center":{}},"default":"point","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"units":"pixels","requires":[{"symbol-placement":"line"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{"type":"number","expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":{},"viewport-y":{},"source":{}},"default":"auto","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{"type":"boolean","default":false,"requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-optional":{"type":"boolean","default":false,"requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-size":{"type":"number","default":1,"minimum":0,"units":"factor of the original icon size","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{"type":"enum","values":{"none":{},"width":{},"height":{},"both":{}},"default":"none","requires":["icon-image","text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"units":"pixels","requires":["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{"type":"boolean","default":false,"requires":["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{"type":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"default":"center","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{"type":"enum","values":{"map":{},"viewport":{},"auto":{}},"default":"auto","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{"type":"number","default":10,"minimum":0,"units":"ems","requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"units":"ems","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":{},"left":{},"center":{},"right":{}},"default":"center","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","units":"ems","default":0,"requires":["text-field"],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"requires":["text-field",{"symbol-placement":["point"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-anchor":{"type":"enum","values":{"center":{},"left":{},"right":{},"top":{},"bottom":{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},"default":"center","requires":["text-field",{"!":"text-variable-anchor"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"units":"degrees","requires":["text-field",{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":{},"vertical":{}},"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-rotate":{"type":"number","default":0,"period":360,"units":"degrees","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-keep-upright":{"type":"boolean","default":true,"requires":["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-transform":{"type":"enum","values":{"none":{},"uppercase":{},"lowercase":{}},"default":"none","requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","units":"ems","length":2,"default":[0,0],"requires":["text-field",{"!":"text-radial-offset"}],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{"type":"boolean","default":false,"requires":["text-field"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-optional":{"type":"boolean","default":false,"requires":["text-field","icon-image"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":{},"none":{}},"default":"visible","property-type":"constant"}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"transition":false,"property-type":"data-driven","expression":{"interpolated":false,"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},"in":{},"!in":{},"all":{},"any":{},"none":{},"has":{},"!has":{},"within":{}}},"geometry_type":{"type":"enum","values":{"Point":{},"LineString":{},"Polygon":{}}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":{},"exponential":{},"interval":{},"categorical":{}},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":{},"lab":{},"hcl":{}},"default":"rgb"},"default":{"type":"*","required":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"high-color":{"type":"color","property-type":"data-constant","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"space-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"star-intensity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":{},"viewport":{}},"property-type":"data-constant","transition":false,"expression":{"interpolated":false,"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":{},"equalEarth":{},"equirectangular":{},"lambertConformalConic":{},"mercator":{},"naturalEarth":{},"winkelTripel":{},"globe":{}},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-180,-90],"maximum":[180,90],"transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-90,-90],"maximum":[90,90],"transition":false,"requires":[{"name":["albers","lambertConformalConic"]}]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"requires":["source"]}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"requires":[{"!":"fill-pattern"},{"fill-antialias":true}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"fill-extrusion-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["fill-extrusion-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"units":"meters","transition":true,"requires":["fill-extrusion-height"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant","type":"number","private":true,"default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant","type":"number","private":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"requires":["fill-extrusion-edge-radius"]}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"line-pattern"}],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["line-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"transition":false,"units":"line widths","requires":[{"!":"line-pattern"}],"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-gradient":{"type":"color","transition":false,"requires":[{"!":"line-pattern"},{"source":"geojson","has":{"lineMetrics":true}}],"expression":{"interpolated":true,"parameters":["line-progress"]},"property-type":"color-ramp"},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"transition":false,"requires":[{"source":"geojson","has":{"lineMetrics":true}}],"property-type":"constant"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["circle-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"units":"pixels","expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"transition":false,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"transition":false,"expression":{"interpolated":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["icon-image"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["icon-image","icon-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"units":"pixels","requires":["text-field"],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"map","requires":["text-field","text-translate"],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"units":"degrees","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":{},"nearest":{}},"default":"linear","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"transition":false,"units":"milliseconds","expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"transition":false,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":{},"viewport":{}},"default":"viewport","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_background":{"background-color":{"type":"color","default":"#000000","transition":true,"requires":[{"!":"background-pattern"}],"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":{},"atmosphere":{}},"default":"atmosphere","expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"requires":[{"sky-type":"atmosphere"}],"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","requires":[{"sky-type":"atmosphere"}],"default":10,"minimum":0,"maximum":100,"transition":false,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","requires":[{"sky-type":"gradient"}],"value":"number","default":[0,0],"length":2,"units":"degrees","minimum":[0,0],"maximum":[360,180],"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","requires":[{"sky-type":"gradient"}],"default":90,"minimum":0,"maximum":180,"transition":false,"expression":{"interpolated":false,"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"transition":false,"requires":[{"sky-type":"gradient"}],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","transition":false,"requires":[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"transition":{"duration":{"type":"number","default":300,"minimum":0,"units":"milliseconds"},"delay":{"type":"number","default":0,"minimum":0,"units":"milliseconds"}},"property-type":{"data-driven":{"type":"property-type"},"color-ramp":{"type":"property-type"},"data-constant":{"type":"property-type"},"constant":{"type":"property-type"}},"promoteId":{"*":{"type":"string"}}}');function ht(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 ft(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function dt(e){if(Array.isArray(e))return e.map(dt);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){var t={};for(var i in e)t[i]=dt(e[i]);return t}return ft(e)}var pt=function(e){v(i,e);var t=m(i);function i(e,r){var n;return d(this,i),(n=t.call(this,r)).message=r,n.key=e,n}return p(i)}(y(Error)),vt=pt,mt=function(){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];d(this,e),this.parent=t,this.bindings={};var r,n=f(i);try{for(n.s();!(r=n.n()).done;){var a=h(r.value,2),o=a[0],s=a[1];this.bindings[o]=s}}catch(l){n.e(l)}finally{n.f()}}return p(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}(),yt=mt,_t={kind:"null"},gt={kind:"number"},xt={kind:"string"},bt={kind:"boolean"},wt={kind:"color"},kt={kind:"object"},Tt={kind:"value"},Et={kind:"collator"},St={kind:"formatted"},Mt={kind:"resolvedImage"};function At(e,t){return{kind:"array",itemType:e,N:t}}function It(e){if("array"===e.kind){var t=It(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 Ct=[_t,gt,xt,bt,wt,St,kt,At(Tt),Mt];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)for(var i=0,r=Ct;i<r.length;i++)if(!zt(r[i],t))return null}return"Expected ".concat(It(e)," but found ").concat(It(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(e){}var Vt=function(){function e(t,i,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;d(this,e),this.r=t,this.g=i,this.b=r,this.a=n}return p(e,[{key:"toString",value:function(){var e=this.toArray(),t=h(e,4),i=t[0],r=t[1],n=t[2],a=t[3];return"rgba(".concat(Math.round(i),",").concat(Math.round(r),",").concat(Math.round(n),",").concat(a,")")}},{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 Nt=Vt,jt=function(){function e(t,i,r){d(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"})}return p(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=p((function e(t,i,r,n,a){d(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){d(this,e),this.sections=t}return p(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=f(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){d(this,e),this.name=t.name,this.available=t.available}return p(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)return!0;if("string"==typeof e)return!0;if("boolean"==typeof e)return!0;if("number"==typeof e)return!0;if(e instanceof Nt)return!0;if(e instanceof jt)return!0;if(e instanceof Zt)return!0;if(e instanceof qt)return!0;if(Array.isArray(e)){var t,i=f(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 Nt)return wt;if(e instanceof jt)return Et;if(e instanceof Zt)return St;if(e instanceof qt)return Mt;if(Array.isArray(e)){var t,i,r=e.length,n=f(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 At(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 Nt||e instanceof Zt||e instanceof qt?e.toString():JSON.stringify(e)}var Kt=function(){function e(t,i){d(this,e),this.type=t,this.value=i}return p(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 Nt?["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=Kt,$t=function(){function e(t){d(this,e),this.name="ExpressionEvaluationError",this.message=t}return p(e,[{key:"toJSON",value:function(){return this.message}}]),e}(),Qt={string:xt,number:gt,boolean:bt,object:kt},ei=function(){function e(t,i){d(this,e),this.type=t,this.args=i}return p(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 $t("Expected value to be of type ".concat(It(this.type),", but found ").concat(It(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 Qt)||"object"===l)return i.error('The item type argument of "array" must be one of string, number, boolean',1);o=Qt[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=At(o,s)}else r=Qt[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}(),ti=ei,ii=function(){function e(t){d(this,e),this.type=St,this.sections=t}return p(e,[{key:"evaluate",value:function(e){return new Zt(this.sections.map((function(t){var i=t.content.evaluate(e);return Ht(i)===Mt?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=f(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=f(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,At(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}(),ri=function(){function e(t){d(this,e),this.type=Mt,this.input=t}return p(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}(),ni={"to-boolean":bt,"to-color":wt,"to-number":gt,"to-string":xt},ai=function(){function e(t,i){d(this,e),this.type=t,this.args=i}return p(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=f(this.args);try{for(n.s();!(r=n.n()).done;){if(t=r.value.evaluate(e),i=null,t instanceof Nt)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])))return new Nt(t[0]/255,t[1]/255,t[2]/255,t[3])}}catch(c){n.e(c)}finally{n.f()}throw new $t(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,l=f(this.args);try{for(l.s();!(o=l.n()).done;){if(null===(s=o.value.evaluate(e)))return 0;var u=Number(s);if(!isNaN(u))return u}}catch(c){l.e(c)}finally{l.f()}throw new $t("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 ii([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new ri(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=ni[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}(),oi=ai,si=["Unknown","Point","LineString","Polygon"],li=function(){function e(){d(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 p(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?si[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]=Nt.parse(e)),t}}]),e}(),ui=function(){function e(t,i,r,n){d(this,e),this.name=t,this.type=i,this._evaluate=r,this.args=n}return p(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 r,n=t[0],a=e.definitions[n];if(!a)return i.error('Unknown expression "'.concat(n,'". If you wanted a literal array, use ["literal", [...]].'),0);var o,s=Array.isArray(a)?a[0]:a.type,l=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,u=l.filter((function(e){var i=h(e,1)[0];return!Array.isArray(i)||i.length===t.length-1})),d=null,p=f(u);try{for(p.s();!(o=p.n()).done;){var v=h(o.value,2),m=v[0],y=v[1];d=new Bi(i.registry,i.path,null,i.scope);for(var _=[],g=!1,x=1;x<t.length;x++){var b=t[x],w=Array.isArray(m)?m[x-1]:m.type,k=d.parse(b,1+_.length,w);if(!k){g=!0;break}_.push(k)}if(!g)if(Array.isArray(m)&&m.length!==_.length)d.error("Expected ".concat(m.length," arguments, but found ").concat(_.length," instead."));else{for(var T=0;T<_.length;T++){var E=Array.isArray(m)?m[T]:m.type,S=_[T];d.concat(T+1).checkSubtype(E,S.type)}if(0===d.errors.length)return new e(n,s,y,_)}}}catch(z){p.e(z)}finally{p.f()}if(1===u.length)(r=i.errors).push.apply(r,c(d.errors));else{for(var M=(u.length?u:l).map((function(e){var t;return t=h(e,1)[0],Array.isArray(t)?"(".concat(t.map(It).join(", "),")"):"(".concat(It(t.type),"...)")})).join(" | "),A=[],I=1;I<t.length;I++){var C=i.parse(t[I],1+A.length);if(!C)return null;A.push(It(C.type))}i.error("Expected arguments of type ".concat(M,", but found (").concat(A.join(", "),") instead."))}return null}},{key:"register",value:function(t,i){for(var r in e.definitions=i,i)t[r]=e}}]),e}(),ci=ui,hi=function(){function e(t,i,r){d(this,e),this.type=Et,this.locale=r,this.caseSensitive=t,this.diacriticSensitive=i}return p(e,[{key:"evaluate",value:function(e){return new jt(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}(),fi=8192;function di(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 pi(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function vi(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*fi),Math.round(r*n*fi)]}function mi(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 yi(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(mi(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 _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,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 xi(e,t,i){var r,n,a,o,s,l,u,c=f(i);try{for(c.s();!(r=c.n()).done;)for(var h=r.value,d=0;d<h.length-1;++d)if(0!=(l=[(s=h[d+1])[0]-(o=h[d])[0],s[1]-o[1]])[0]*(u=[(a=t)[0]-(n=e)[0],a[1]-n[1]])[1]-l[1]*u[0]&&gi(n,a,o,s)&&gi(o,s,n,a))return!0}catch(p){c.e(p)}finally{c.f()}return!1}function bi(e,t){for(var i=0;i<e.length;++i)if(!yi(e[i],t))return!1;for(var r=0;r<e.length-1;++r)if(xi(e[r],e[r+1],t))return!1;return!0}function wi(e,t){for(var i=0;i<t.length;i++)if(bi(e,t[i]))return!0;return!1}function ki(e,t,i){for(var r=[],n=0;n<e.length;n++){for(var a=[],o=0;o<e[n].length;o++){var s=vi(e[n][o],i);di(t,s),a.push(s)}r.push(a)}return r}function Ti(e,t,i){for(var r=[],n=0;n<e.length;n++){var a=ki(e[n],t,i);r.push(a)}return r}function Ei(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}di(t,e)}function Si(e,t,i,r){var n=Math.pow(2,r.z)*fi,a=[r.x*fi,r.y*fi],o=[];if(!e)return o;var s,l=f(e);try{for(l.s();!(s=l.n()).done;){var u,c=s.value,h=f(c);try{for(h.s();!(u=h.n()).done;){var d=u.value,p=[d.x+a[0],d.y+a[1]];Ei(p,t,i,n),o.push(p)}}catch(v){h.e(v)}finally{h.f()}}}catch(v){l.e(v)}finally{l.f()}return o}function Mi(e,t,i,r){var n=Math.pow(2,r.z)*fi,a=[r.x*fi,r.y*fi],o=[];if(!e)return o;var s,l,u=f(e);try{for(u.s();!(s=u.n()).done;){var c,h=s.value,d=[],p=f(h);try{for(p.s();!(c=p.n()).done;){var v=c.value,m=[v.x+a[0],v.y+a[1]];di(t,m),d.push(m)}}catch(w){p.e(w)}finally{p.f()}o.push(d)}}catch(w){u.e(w)}finally{u.f()}if(t[2]-t[0]<=n/2){(l=t)[0]=l[1]=1/0,l[2]=l[3]=-1/0;var y,_=f(o);try{for(_.s();!(y=_.n()).done;){var g,x=y.value,b=f(x);try{for(b.s();!(g=b.n()).done;)Ei(g.value,t,i,n)}catch(w){b.e(w)}finally{b.f()}}}catch(w){_.e(w)}finally{_.f()}}return o}var Ai=function(){function e(t,i){d(this,e),this.type=bt,this.geojson=t,this.geometries=i}return p(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=ki(t.coordinates,r,n),o=Si(e.geometry(),i,r,n);if(!pi(i,r))return!1;var s,l=f(o);try{for(l.s();!(s=l.n()).done;)if(!yi(s.value,a))return!1}catch(p){l.e(p)}finally{l.f()}}if("MultiPolygon"===t.type){var u=Ti(t.coordinates,r,n),c=Si(e.geometry(),i,r,n);if(!pi(i,r))return!1;var h,d=f(c);try{for(d.s();!(h=d.n()).done;)if(!_i(h.value,u))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=ki(t.coordinates,r,n),o=Mi(e.geometry(),i,r,n);if(!pi(i,r))return!1;var s,l=f(o);try{for(l.s();!(s=l.n()).done;)if(!bi(s.value,a))return!1}catch(p){l.e(p)}finally{l.f()}}if("MultiPolygon"===t.type){var u=Ti(t.coordinates,r,n),c=Mi(e.geometry(),i,r,n);if(!pi(i,r))return!1;var h,d=f(c);try{for(d.s();!(h=d.n()).done;)if(!wi(h.value,u))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}(),Ii=Ai;function Ci(e){if(e instanceof ci){if("get"===e.name&&1===e.args.length)return!1;if("feature-state"===e.name)return!1;if("has"===e.name&&1===e.args.length)return!1;if("properties"===e.name||"geometry-type"===e.name||"id"===e.name)return!1;if(/^filter-/.test(e.name))return!1}if(e instanceof Ii)return!1;var t=!0;return e.eachChild((function(e){t&&!Ci(e)&&(t=!1)})),t}function zi(e){if(e instanceof ci&&"feature-state"===e.name)return!1;var t=!0;return e.eachChild((function(e){t&&!zi(e)&&(t=!1)})),t}function Pi(e,t){if(e instanceof ci&&t.indexOf(e.name)>=0)return!1;var i=!0;return e.eachChild((function(e){i&&!Pi(e,t)&&(i=!1)})),i}var Di=function(){function e(t,i){d(this,e),this.type=i.type,this.name=t,this.boundExpression=i}return p(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}(),Li=Di,Ri=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]:[];d(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 p(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 ti(t,[e]):"coerce"===i?new oi(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 Jt)&&"resolvedImage"!==a.type.kind&&Oi(a)){var l=new li;try{a=new Jt(a.type,a.evaluate(l))}catch(e){return this.error(e.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}(),Bi=Ri;function Oi(e){if(e instanceof Li)return Oi(e.boundExpression);if(e instanceof ci&&"error"===e.name)return!1;if(e instanceof hi)return!1;if(e instanceof Ii)return!1;var t=e instanceof oi||e instanceof ti,i=!0;return e.eachChild((function(e){i=t?i&&Oi(e):i&&e instanceof Jt})),!!i&&Ci(e)&&Pi(e,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"])}function Fi(e,t){for(var i,r,n=e.length-1,a=0,o=n,s=0;a<=o;)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 $t("Input is not a number.");o=s-1}return 0}var Ui=function(){function e(t,i,r){d(this,e),this.type=t,this.input=i,this.labels=[],this.outputs=[];var n,a=f(r);try{for(a.s();!(n=a.n()).done;){var o=h(n.value,2),s=o[0],l=o[1];this.labels.push(s),this.outputs.push(l)}}catch(u){a.e(u)}finally{a.f()}}return p(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[Fi(t,r)].evaluate(e)}},{key:"eachChild",value:function(e){e(this.input);var t,i=f(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}(),Vi=Ui;function Ni(e,t,i){return e*(1-i)+t*i}var ji=Object.freeze({__proto__:null,number:Ni,color:function(e,t,i){return new Nt(Ni(e.r,t.r,i),Ni(e.g,t.g,i),Ni(e.b,t.b,i),Ni(e.a,t.a,i))},array:function(e,t,i){return e.map((function(e,r){return Ni(e,t[r],i)}))}}),Gi=.95047,Zi=1.08883,qi=4/29,Wi=6/29,Xi=3*Wi*Wi,Hi=Math.PI/180,Yi=180/Math.PI;function Ki(e){return e>.008856451679035631?Math.pow(e,1/3):e/Xi+qi}function Ji(e){return e>Wi?e*e*e:Xi*(e-qi)}function $i(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function Qi(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function er(e){var t=Qi(e.r),i=Qi(e.g),r=Qi(e.b),n=Ki((.4124564*t+.3575761*i+.1804375*r)/Gi),a=Ki((.2126729*t+.7151522*i+.072175*r)/1);return{l:116*a-16,a:500*(n-a),b:200*(a-Ki((.0193339*t+.119192*i+.9503041*r)/Zi)),alpha:e.a}}function tr(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=Gi*Ji(i),r=Zi*Ji(r),new Nt($i(3.2404542*i-1.5371385*t-.4985314*r),$i(-.969266*i+1.8760108*t+.041556*r),$i(.0556434*i-.2040259*t+1.0572252*r),e.alpha)}function ir(e,t,i){var r=t-e;return e+i*(r>180||r<-180?r-360*Math.round(r/360):r)}var rr={forward:er,reverse:tr,interpolate:function(e,t,i){return{l:Ni(e.l,t.l,i),a:Ni(e.a,t.a,i),b:Ni(e.b,t.b,i),alpha:Ni(e.alpha,t.alpha,i)}}},nr={forward:function(e){var t=er(e),i=t.l,r=t.a,n=t.b,a=Math.atan2(n,r)*Yi;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*Hi,i=e.c;return tr({l:e.l,a:Math.cos(t)*i,b:Math.sin(t)*i,alpha:e.alpha})},interpolate:function(e,t,i){return{h:ir(e.h,t.h,i),c:Ni(e.c,t.c,i),l:Ni(e.l,t.l,i),alpha:Ni(e.alpha,t.alpha,i)}}},ar=Object.freeze({__proto__:null,lab:rr,hcl:nr}),or=function(){function e(t,i,r,n,a){d(this,e),this.type=t,this.operator=i,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];var o,s=f(a);try{for(s.s();!(o=s.n()).done;){var l=h(o.value,2),u=l[0],c=l[1];this.labels.push(u),this.outputs.push(c)}}catch(p){s.e(p)}finally{s.f()}}return p(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=Fi(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?ji[this.type.kind.toLowerCase()](l,u,s):"interpolate-hcl"===this.operator?nr.reverse(nr.interpolate(nr.forward(l),nr.forward(u),s)):rr.reverse(rr.interpolate(rr.forward(l),rr.forward(u),s))}},{key:"eachChild",value:function(e){e(this.input);var t,i=f(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=sr(t,e.base,i,r);else if("linear"===e.name)n=sr(t,1,i,r);else if("cubic-bezier"===e.name){var a=e.controlPoints;n=new S(a[0],a[1],a[2],a[3]).solve(sr(t,1,i,r))}return n}},{key:"parse",value:function(t,i){var r=u(t),n=r[0],a=r[1],o=r[2],s=r.slice(3);if(!Array.isArray(a)||0===a.length)return i.error("Expected an interpolation type expression.",1);if("linear"===a[0])a={name:"linear"};else if("exponential"===a[0]){var l=a[1];if("number"!=typeof l)return i.error("Exponential interpolation requires a numeric base.",1,1);a={name:"exponential",base:l}}else{if("cubic-bezier"!==a[0])return i.error("Unknown interpolation type ".concat(String(a[0])),1,0);var c=a.slice(1);if(4!==c.length||c.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);a={name:"cubic-bezier",controlPoints:c}}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(!(o=i.parse(o,2,gt)))return null;var h=[],f=null;"interpolate-hcl"===n||"interpolate-lab"===n?f=wt:i.expectedType&&"value"!==i.expectedType.kind&&(f=i.expectedType);for(var d=0;d<s.length;d+=2){var p=s[d],v=s[d+1],m=d+3,y=d+4;if("number"!=typeof p)return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',m);if(h.length&&h[h.length-1][0]>=p)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',m);var _=i.parse(v,y,f);if(!_)return null;f=f||_.type,h.push([p,_])}return"number"===f.kind||"color"===f.kind||"array"===f.kind&&"number"===f.itemType.kind&&"number"==typeof f.N?new e(f,n,a,o,h):i.error("Type ".concat(It(f)," is not interpolatable."))}}]),e}();function sr(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 lr=or,ur=function(){function e(t,i){d(this,e),this.type=t,this.args=i}return p(e,[{key:"evaluate",value:function(e){var t,i,r=null,n=0,a=f(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=f(t.slice(1));try{for(s.s();!(a=s.n()).done;){var l=a.value,u=i.parse(l,1+o.length,r,void 0,{typeAnnotation:"omit"});if(!u)return null;r=r||u.type,o.push(u)}}catch(h){s.e(h)}finally{s.f()}var c=n&&o.some((function(e){return zt(n,e.type)}));return new e(c?Tt:r,o)}}]),e}(),cr=ur,hr=function(){function e(t,i){d(this,e),this.type=i.type,this.bindings=[].concat(t),this.result=i}return p(e,[{key:"evaluate",value:function(e){return this.result.evaluate(e)}},{key:"eachChild",value:function(e){var t,i=f(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=f(this.bindings);try{for(i.s();!(e=i.n()).done;){var r=h(e.value,2),n=r[0],a=r[1];t.push(n,a.serialize())}}catch(o){i.e(o)}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}(),fr=hr,dr=function(){function e(t,i,r){d(this,e),this.type=t,this.index=i,this.input=r}return p(e,[{key:"evaluate",value:function(e){var t=this.index.evaluate(e),i=this.input.evaluate(e);if(t<0)throw new $t("Array index out of bounds: ".concat(t," < 0."));if(t>=i.length)throw new $t("Array index out of bounds: ".concat(t," > ").concat(i.length-1,"."));if(t!==Math.floor(t))throw new $t("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,At(i.expectedType||Tt));return r&&n?new e(n.type.itemType,r,n):null}}]),e}(),pr=dr,vr=function(){function e(t,i){d(this,e),this.type=bt,this.needle=t,this.haystack=i}return p(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 $t("Expected first argument to be of type boolean, string, number or null, but found ".concat(It(Ht(t))," instead."));if(!Dt(i,["string","array"]))throw new $t("Expected second argument to be of type array or string, but found ".concat(It(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(It(r.type)," instead")):null}}]),e}(),mr=vr,yr=function(){function e(t,i,r){d(this,e),this.type=gt,this.needle=t,this.haystack=i,this.fromIndex=r}return p(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 $t("Expected first argument to be of type boolean, string, number or null, but found ".concat(It(Ht(t))," instead."));if(!Dt(i,["string","array"]))throw new $t("Expected second argument to be of type array or string, but found ".concat(It(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(It(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}(),_r=yr,gr=function(){function e(t,i,r,n,a,o){d(this,e),this.inputType=t,this.type=i,this.input=r,this.cases=n,this.outputs=a,this.otherwise=o}return p(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.forEach(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=Object.keys(this.cases).sort(),n=[],a={},o=f(r);try{for(o.s();!(e=o.n()).done;){var s=e.value,l=a[this.cases[s]];void 0===l?(a[this.cases[s]]=n.length,n.push([this.cases[s],[s]])):n[l][1].push(s)}}catch(y){o.e(y)}finally{o.f()}for(var u=function(e){return"number"===t.inputType.kind?Number(e):e},c=0,d=n;c<d.length;c++){var p=h(d[c],2),v=p[0],m=p[1];i.push(1===m.length?u(m[0]):m.map(u)),i.push(this.outputs[v].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 l=t[s],u=t[s+1];Array.isArray(l)||(l=[l]);var c=i.concat(s);if(0===l.length)return c.error("Expected at least one branch label.");var h,d=f(l);try{for(d.s();!(h=d.n()).done;){var p=h.value;if("number"!=typeof p&&"string"!=typeof p)return c.error("Branch labels must be numbers or strings.");if("number"==typeof p&&Math.abs(p)>Number.MAX_SAFE_INTEGER)return c.error("Branch labels must be integers no larger than ".concat(Number.MAX_SAFE_INTEGER,"."));if("number"==typeof p&&Math.floor(p)!==p)return c.error("Numeric branch labels must be integer values.");if(r){if(c.checkSubtype(r,Ht(p)))return null}else r=Ht(p);if(void 0!==a[String(p)])return c.error("Branch labels must be unique.");a[String(p)]=o.length}}catch(_){d.e(_)}finally{d.f()}var v=i.parse(u,s,n);if(!v)return null;n=n||v.type,o.push(v)}var m=i.parse(t[1],1,Tt);if(!m)return null;var y=i.parse(t[t.length-1],t.length-1,n);return y?"value"!==m.type.kind&&i.concat(1).checkSubtype(r,m.type)?null:new e(r,n,m,a,o,y):null}}]),e}(),xr=gr,br=function(){function e(t,i,r){d(this,e),this.type=t,this.branches=i,this.otherwise=r}return p(e,[{key:"evaluate",value:function(e){var t,i=f(this.branches);try{for(i.s();!(t=i.n()).done;){var r=h(t.value,2),n=r[0],a=r[1];if(n.evaluate(e))return a.evaluate(e)}}catch(o){i.e(o)}finally{i.f()}return this.otherwise.evaluate(e)}},{key:"eachChild",value:function(e){var t,i=f(this.branches);try{for(i.s();!(t=i.n()).done;){var r=h(t.value,2),n=r[0],a=r[1];e(n),e(a)}}catch(o){i.e(o)}finally{i.f()}e(this.otherwise)}},{key:"outputDefined",value:function(){return this.branches.every((function(e){var t=h(e,2);return t[0],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}(),wr=br,kr=function(){function e(t,i,r,n){d(this,e),this.type=t,this.input=i,this.beginIndex=r,this.endIndex=n}return p(e,[{key:"evaluate",value:function(e){var t=this.input.evaluate(e),i=this.beginIndex.evaluate(e);if(!Dt(t,["string","array"]))throw new $t("Expected first argument to be of type array or string, but found ".concat(It(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,[At(Tt),xt,Tt]))return i.error("Expected first argument to be of type array or string, but found ".concat(It(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}(),Tr=kr;function Er(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 Mr(e,t,i){var r="=="!==e&&"!="!==e;return function(){function n(e,t,i){d(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 p(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 $t('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(!Er(i,a.type))return t.concat(1).error('"'.concat(i,"\" comparisons are not supported for type '").concat(It(a.type),"'."));var o=t.parse(e[2],2,Tt);if(!o)return null;if(!Er(i,o.type))return t.concat(2).error('"'.concat(i,"\" comparisons are not supported for type '").concat(It(o.type),"'."));if(a.type.kind!==o.type.kind&&"value"!==a.type.kind&&"value"!==o.type.kind)return t.error("Cannot compare types '".concat(It(a.type),"' and '").concat(It(o.type),"'."));r&&("value"===a.type.kind&&"value"!==o.type.kind?a=new ti(o.type,[a]):"value"!==a.type.kind&&"value"===o.type.kind&&(o=new ti(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 Ar=Mr("==",(function(e,t,i){return t===i}),Sr),Ir=Mr("!=",(function(e,t,i){return t!==i}),(function(e,t,i,r){return!Sr(0,t,i,r)})),Cr=Mr("<",(function(e,t,i){return t<i}),(function(e,t,i,r){return r.compare(t,i)<0})),zr=Mr(">",(function(e,t,i){return t>i}),(function(e,t,i,r){return r.compare(t,i)>0})),Pr=Mr("<=",(function(e,t,i){return t<=i}),(function(e,t,i,r){return r.compare(t,i)<=0})),Dr=Mr(">=",(function(e,t,i){return t>=i}),(function(e,t,i,r){return r.compare(t,i)>=0})),Lr=function(){function e(t,i,r,n,a,o){d(this,e),this.type=xt,this.number=t,this.locale=i,this.currency=r,this.unit=n,this.minFractionDigits=a,this.maxFractionDigits=o}return p(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}(),Rr=function(){function e(t){d(this,e),this.type=gt,this.input=t}return p(e,[{key:"evaluate",value:function(e){var t=this.input.evaluate(e);if("string"==typeof t)return t.length;if(Array.isArray(t))return t.length;throw new $t("Expected value to be of type string or array, but found ".concat(It(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(It(r.type)," instead.")):new e(r):null}}]),e}(),Br={"==":Ar,"!=":Ir,">":zr,"<":Cr,">=":Dr,"<=":Pr,array:ti,at:pr,boolean:ti,case:wr,coalesce:cr,collator:hi,format:ii,image:ri,in:mr,"index-of":_r,interpolate:lr,"interpolate-hcl":lr,"interpolate-lab":lr,length:Rr,let:fr,literal:Jt,match:xr,number:ti,"number-format":Lr,object:ti,slice:Tr,step:Vi,string:ti,"to-boolean":oi,"to-color":oi,"to-number":oi,"to-string":oi,var:Li,within:Ii};function Or(e,t){var i=h(t,4),r=i[0],n=i[1],a=i[2],o=i[3];r=r.evaluate(e),n=n.evaluate(e),a=a.evaluate(e);var s=o?o.evaluate(e):1,l=Wt(r,n,a,s);if(l)throw new $t(l);return new Nt(r/255*s,n/255*s,a/255*s,s)}function Fr(e,t){return e in t}function Ur(e,t){var i=t[e];return void 0===i?null:i}function Vr(e){return{type:e}}ci.register(Br,{error:[{kind:"error"},[xt],function(e,t){var i=h(t,1)[0];throw new $t(i.evaluate(e))}],typeof:[xt,[Tt],function(e,t){return It(Ht(h(t,1)[0].evaluate(e)))}],"to-rgba":[At(gt,4),[wt],function(e,t){return h(t,1)[0].evaluate(e).toArray()}],rgb:[wt,[gt,gt,gt],Or],rgba:[wt,[gt,gt,gt,gt],Or],has:{type:bt,overloads:[[[xt],function(e,t){return Fr(h(t,1)[0].evaluate(e),e.properties())}],[[xt,kt],function(e,t){var i=h(t,2),r=i[0],n=i[1];return Fr(r.evaluate(e),n.evaluate(e))}]]},get:{type:Tt,overloads:[[[xt],function(e,t){return Ur(h(t,1)[0].evaluate(e),e.properties())}],[[xt,kt],function(e,t){var i=h(t,2),r=i[0],n=i[1];return Ur(r.evaluate(e),n.evaluate(e))}]]},"feature-state":[Tt,[xt],function(e,t){return Ur(h(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,Vr(gt),function(e,t){var i,r=0,n=f(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,Vr(gt),function(e,t){var i,r=1,n=f(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=h(t,2),r=i[0],n=i[1];return r.evaluate(e)-n.evaluate(e)}],[[gt],function(e,t){return-h(t,1)[0].evaluate(e)}]]},"/":[gt,[gt,gt],function(e,t){var i=h(t,2),r=i[0],n=i[1];return r.evaluate(e)/n.evaluate(e)}],"%":[gt,[gt,gt],function(e,t){var i=h(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=h(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=h(t,1)[0];return Math.sqrt(i.evaluate(e))}],log10:[gt,[gt],function(e,t){var i=h(t,1)[0];return Math.log(i.evaluate(e))/Math.LN10}],ln:[gt,[gt],function(e,t){var i=h(t,1)[0];return Math.log(i.evaluate(e))}],log2:[gt,[gt],function(e,t){var i=h(t,1)[0];return Math.log(i.evaluate(e))/Math.LN2}],sin:[gt,[gt],function(e,t){var i=h(t,1)[0];return Math.sin(i.evaluate(e))}],cos:[gt,[gt],function(e,t){var i=h(t,1)[0];return Math.cos(i.evaluate(e))}],tan:[gt,[gt],function(e,t){var i=h(t,1)[0];return Math.tan(i.evaluate(e))}],asin:[gt,[gt],function(e,t){var i=h(t,1)[0];return Math.asin(i.evaluate(e))}],acos:[gt,[gt],function(e,t){var i=h(t,1)[0];return Math.acos(i.evaluate(e))}],atan:[gt,[gt],function(e,t){var i=h(t,1)[0];return Math.atan(i.evaluate(e))}],min:[gt,Vr(gt),function(e,t){return Math.min.apply(Math,c(t.map((function(t){return t.evaluate(e)}))))}],max:[gt,Vr(gt),function(e,t){return Math.max.apply(Math,c(t.map((function(t){return t.evaluate(e)}))))}],abs:[gt,[gt],function(e,t){var i=h(t,1)[0];return Math.abs(i.evaluate(e))}],round:[gt,[gt],function(e,t){var i=h(t,1)[0].evaluate(e);return i<0?-Math.round(-i):Math.round(i)}],floor:[gt,[gt],function(e,t){var i=h(t,1)[0];return Math.floor(i.evaluate(e))}],ceil:[gt,[gt],function(e,t){var i=h(t,1)[0];return Math.ceil(i.evaluate(e))}],"filter-==":[bt,[xt,Tt],function(e,t){var i=h(t,2),r=i[0],n=i[1];return e.properties()[r.value]===n.value}],"filter-id-==":[bt,[Tt],function(e,t){var i=h(t,1)[0];return e.id()===i.value}],"filter-type-==":[bt,[xt],function(e,t){var i=h(t,1)[0];return e.geometryType()===i.value}],"filter-<":[bt,[xt,Tt],function(e,t){var i=h(t,2),r=i[0],n=i[1],a=e.properties()[r.value],o=n.value;return typeof a==typeof o&&a<o}],"filter-id-<":[bt,[Tt],function(e,t){var i=h(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=h(t,2),r=i[0],n=i[1],a=e.properties()[r.value],o=n.value;return typeof a==typeof o&&a>o}],"filter-id->":[bt,[Tt],function(e,t){var i=h(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=h(t,2),r=i[0],n=i[1],a=e.properties()[r.value],o=n.value;return typeof a==typeof o&&a<=o}],"filter-id-<=":[bt,[Tt],function(e,t){var i=h(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=h(t,2),r=i[0],n=i[1],a=e.properties()[r.value],o=n.value;return typeof a==typeof o&&a>=o}],"filter-id->=":[bt,[Tt],function(e,t){var i=h(t,1)[0],r=e.id(),n=i.value;return typeof r==typeof n&&r>=n}],"filter-has":[bt,[Tt],function(e,t){return h(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,[At(xt)],function(e,t){return h(t,1)[0].value.indexOf(e.geometryType())>=0}],"filter-id-in":[bt,[At(Tt)],function(e,t){return h(t,1)[0].value.indexOf(e.id())>=0}],"filter-in-small":[bt,[xt,At(Tt)],function(e,t){var i=h(t,2),r=i[0];return i[1].value.indexOf(e.properties()[r.value])>=0}],"filter-in-large":[bt,[xt,At(Tt)],function(e,t){var i=h(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=h(t,2),r=i[0],n=i[1];return r.evaluate(e)&&n.evaluate(e)}],[Vr(bt),function(e,t){var i,r=f(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=h(t,2),r=i[0],n=i[1];return r.evaluate(e)||n.evaluate(e)}],[Vr(bt),function(e,t){var i,r=f(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!h(t,1)[0].evaluate(e)}],"is-supported-script":[bt,[xt],function(e,t){var i=h(t,1)[0],r=e.globals&&e.globals.isSupportedScript;return!r||r(i.evaluate(e))}],upcase:[xt,[xt],function(e,t){return h(t,1)[0].evaluate(e).toUpperCase()}],downcase:[xt,[xt],function(e,t){return h(t,1)[0].evaluate(e).toLowerCase()}],concat:[xt,Vr(Tt),function(e,t){return t.map((function(t){return Yt(t.evaluate(e))})).join("")}],"resolved-locale":[xt,[Et],function(e,t){return h(t,1)[0].evaluate(e).resolvedLocale()}]});var Nr=Br;function jr(e){return{result:"success",value:e}}function Gr(e){return{result:"error",value:e}}function Zr(e){return"data-driven"===e["property-type"]}function qr(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function Wr(e){return!!e.expression&&e.expression.interpolated}function Xr(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}function Hr(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function Yr(e){return e}function Kr(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),l=e.type||(Wr(t)?"exponential":"interval");if(a&&((e=ht({},e)).stops&&(e.stops=e.stops.map((function(e){return[e[0],Nt.parse(e[1])]}))),e.default=Nt.parse(e.default?e.default:t.default)),e.colorSpace&&"rgb"!==e.colorSpace&&!ar[e.colorSpace])throw new Error("Unknown color space: ".concat(e.colorSpace));if("exponential"===l)i=en;else if("interval"===l)i=Qr;else if("categorical"===l){i=$r,r=Object.create(null);var u,c=f(e.stops);try{for(c.s();!(u=c.n()).done;){var h=u.value;r[h[0]]=h[1]}}catch(T){c.e(T)}finally{c.f()}n=typeof e.stops[0][0]}else{if("identity"!==l)throw new Error('Unknown function type "'.concat(l,'"'));i=tn}if(o){for(var d={},p=[],v=0;v<e.stops.length;v++){var m=e.stops[v],y=m[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([m[0].value,m[1]])}for(var _=[],g=0,x=p;g<x.length;g++){var b=x[g];_.push([d[b].zoom,Kr(d[b],t)])}var w={name:"linear"};return{kind:"composite",interpolationType:w,interpolationFactor:lr.interpolationFactor.bind(void 0,w),zoomStops:_.map((function(e){return e[0]})),evaluate:function(i,r){var n=i.zoom;return en({stops:_,base:e.base},t,n).evaluate(n,r)}}}if(s){var k="exponential"===l?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:k,interpolationFactor:lr.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?Jr(e.default,t.default):i(e,t,s,r,n)}}}function Jr(e,t,i){return void 0!==e?e:void 0!==t?t:void 0!==i?i:void 0}function $r(e,t,i,r,n){return Jr(typeof i===n?r[i]:void 0,e.default,t.default)}function Qr(e,t,i){if("number"!==Xr(i))return Jr(e.default,t.default);var r=e.stops.length;if(1===r)return e.stops[0][1];if(i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[r-1][0])return e.stops[r-1][1];var n=Fi(e.stops.map((function(e){return e[0]})),i);return e.stops[n][1]}function en(e,t,i){var r=void 0!==e.base?e.base:1;if("number"!==Xr(i))return Jr(e.default,t.default);var n=e.stops.length;if(1===n)return e.stops[0][1];if(i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[n-1][0])return e.stops[n-1][1];var a=Fi(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=ji[t.type]||Yr;if(e.colorSpace&&"rgb"!==e.colorSpace){var c=ar[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 tn(e,t,i){return"color"===t.type?i=Nt.parse(i):"formatted"===t.type?i=Zt.fromString(i.toString()):"resolvedImage"===t.type?i=qt.fromString(i.toString()):Xr(i)===t.type||"enum"===t.type&&t.values[i]||(i=void 0),Jr(i,e.default,t.default)}var rn=function(){function e(t,i){d(this,e),this.expression=t,this._warningHistory={},this._evaluator=new li,this._defaultValue=i?function(e){return"color"===e.type&&(Hr(e.default)||Array.isArray(e.default))?new Nt(0,0,0,0):"color"===e.type?Nt.parse(e.default)||null:void 0===e.default?null:e.default}(i):null,this._enumValues=i&&"enum"===i.type?i.values:null}return p(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 $t("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(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,"undefined"!=typeof console&&console.warn(e.message)),this._defaultValue}}}]),e}();function nn(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in Nr}function an(e,t){var i=new Bi(Nr,[],t?function(e){var t={color:wt,string:xt,number:gt,enum:xt,boolean:bt,formatted:St,resolvedImage:Mt};return"array"===e.type?At(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?jr(new rn(r,t)):Gr(i.errors)}var on=function(){function e(t,i){d(this,e),this.kind=t,this._styleExpression=i,this.isStateDependent="constant"!==t&&!zi(i.expression)}return p(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}(),sn=function(){function e(t,i,r,n){d(this,e),this.kind=t,this.zoomStops=r,this._styleExpression=i,this.isStateDependent="camera"!==t&&!zi(i.expression),this.interpolationType=n}return p(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?lr.interpolationFactor(this.interpolationType,e,t,i):0}}]),e}();function ln(e,t){if("error"===(e=an(e,t)).result)return e;var i=e.value.expression,r=Ci(i);if(!r&&!Zr(t))return Gr([new vt("","data expressions not supported")]);var n=Pi(i,["zoom","pitch","distance-from-center"]);if(!n&&!qr(t))return Gr([new vt("","zoom expressions not supported")]);var a=cn(i);return a||n?a instanceof vt?Gr([a]):a instanceof lr&&!Wr(t)?Gr([new vt("",'"interpolate" expressions cannot be used with this property')]):jr(a?new sn(r?"camera":"composite",e.value,a.labels,a instanceof lr?a.interpolation:void 0):new on(r?"constant":"source",e.value)):Gr([new vt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}var un=function(){function e(t,i){d(this,e),this._parameters=t,this._specification=i,ht(this,Kr(this._parameters,this._specification))}return p(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 cn(e){var t=null;if(e instanceof fr)t=cn(e.result);else if(e instanceof cr){var i,r=f(e.args);try{for(r.s();!(i=r.n()).done;){var n=i.value;if(t=cn(n))break}}catch(a){r.e(a)}finally{r.f()}}else(e instanceof Vi||e instanceof lr)&&e.input instanceof ci&&"zoom"===e.input.name&&(t=e);return t instanceof vt||e.eachChild((function(e){var i=cn(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 hn=p((function e(t,i,r,n){d(this,e),this.message=(t?"".concat(t,": "):"")+r,n&&(this.identifier=n),null!=i&&i.__line__&&(this.line=i.__line__)}));function fn(e){var t=e.key,i=e.value,r=e.valueSpec||{},n=e.objectElementValidators||{},a=e.style,o=e.styleSpec,s=[],l=Xr(i);if("object"!==l)return[new hn(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=Wn:n["*"]?f=n["*"]:r["*"]&&(f=Wn),f?s=s.concat(f({key:(t?"".concat(t,"."):t)+u,value:i[u],valueSpec:h,style:a,styleSpec:o,object:i,objectKey:u},i)):s.push(new hn(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 hn(t,i,'missing required property "'.concat(d,'"')));return s}function dn(e){var t=e.value,i=e.valueSpec,r=e.style,n=e.styleSpec,a=e.key,o=e.arrayElementValidator||Wn;if("array"!==Xr(t))return[new hn(a,t,"array expected, ".concat(Xr(t)," found"))];if(i.length&&t.length!==i.length)return[new hn(a,t,"array length ".concat(i.length," expected, length ").concat(t.length," found"))];if(i["min-length"]&&t.length<i["min-length"])return[new hn(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"===Xr(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 pn(e){var t=e.key,i=e.value,r=e.valueSpec,n=Xr(i);if("number"===n&&i!=i&&(n="NaN"),"number"!==n)return[new hn(t,i,"number expected, ".concat(n," found"))];if("minimum"in r){var a=r.minimum;if("array"===Xr(r.minimum)&&(a=r.minimum[e.arrayIndex]),i<a)return[new hn(t,i,"".concat(i," is less than the minimum value ").concat(a))]}if("maximum"in r){var o=r.maximum;if("array"===Xr(r.maximum)&&(o=r.maximum[e.arrayIndex]),i>o)return[new hn(t,i,"".concat(i," is greater than the maximum value ").concat(o))]}return[]}function vn(e){var t,i,r,n=e.valueSpec,a=ft(e.value.type),o={},s="categorical"!==a&&void 0===e.value.property,l=!s,u="array"===Xr(e.value.stops)&&"array"===Xr(e.value.stops[0])&&"object"===Xr(e.value.stops[0][0]),c=fn({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 hn(e.key,e.value,'identity function may not have a "stops" property')];var t=[],i=e.value;return t=t.concat(dn({key:e.key,value:i,valueSpec:e.valueSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:h})),"array"===Xr(i)&&0===i.length&&t.push(new hn(e.key,i,"array must have at least one stop")),t},default:function(e){return Wn({key:e.key,value:e.value,valueSpec:n,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===a&&s&&c.push(new hn(e.key,e.value,'missing required property "property"')),"identity"===a||e.value.stops||c.push(new hn(e.key,e.value,'missing required property "stops"')),"exponential"===a&&e.valueSpec.expression&&!Wr(e.valueSpec)&&c.push(new hn(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!Zr(e.valueSpec)?c.push(new hn(e.key,e.value,"property functions not supported")):s&&!qr(e.valueSpec)&&c.push(new hn(e.key,e.value,"zoom functions not supported"))),"categorical"!==a&&!u||void 0!==e.value.property||c.push(new hn(e.key,e.value,'"property" property is required')),c;function h(e){var t=[],a=e.value,s=e.key;if("array"!==Xr(a))return[new hn(s,a,"array expected, ".concat(Xr(a)," found"))];if(2!==a.length)return[new hn(s,a,"array length 2 expected, length ".concat(a.length," found"))];if(u){if("object"!==Xr(a[0]))return[new hn(s,a,"object expected, ".concat(Xr(a[0])," found"))];if(void 0===a[0].zoom)return[new hn(s,a,"object stop key must have zoom")];if(void 0===a[0].value)return[new hn(s,a,"object stop key must have value")];var l=ft(a[0].zoom);if("number"!=typeof l)return[new hn(s,a[0].zoom,"stop zoom values must be numbers")];if(r&&r>l)return[new hn(s,a[0].zoom,"stop zoom values must appear in ascending order")];l!==r&&(r=l,i=void 0,o={}),t=t.concat(fn({key:"".concat(s,"[0]"),value:a[0],valueSpec:{zoom:{}},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:pn,value:f}}))}else t=t.concat(f({key:"".concat(s,"[0]"),value:a[0],valueSpec:{},style:e.style,styleSpec:e.styleSpec},a));return nn(dt(a[1]))?t.concat([new hn("".concat(s,"[1]"),a[1],"expressions are not allowed in function stops.")]):t.concat(Wn({key:"".concat(s,"[1]"),value:a[1],valueSpec:n,style:e.style,styleSpec:e.styleSpec}))}function f(e,r){var s=Xr(e.value),l=ft(e.value),u=null!==e.value?e.value:r;if(t){if(s!==t)return[new hn(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 hn(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 Zr(n)&&void 0===a&&(c+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new hn(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 hn(e.key,u,"stop domain values must appear in ascending order")]:(i=l,"categorical"===a&&l in o?[new hn(e.key,u,"stop domain values must be unique")]:(o[l]=!0,[])):[new hn(e.key,u,"integer expected, found ".concat(String(l)))]}}function mn(e){var t=("property"===e.expressionContext?ln:an)(dt(e.value),e.valueSpec);if("error"===t.result)return t.value.map((function(t){return new hn("".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 hn(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&&!zi(i))return[new hn(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===e.expressionContext)return yn(i,e);if(e.expressionContext&&0===e.expressionContext.indexOf("cluster")){if(!Pi(i,["zoom","feature-state"]))return[new hn(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===e.expressionContext&&!Ci(i))return[new hn(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function yn(e,t){var i=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(t.valueSpec&&t.valueSpec.expression){var r,n=f(t.valueSpec.expression.parameters);try{for(n.s();!(r=n.n()).done;){var a=r.value;i.delete(a)}}catch(s){n.e(s)}finally{n.f()}}if(0===i.size)return[];var o=[];return e instanceof ci&&i.has(e.name)?[new hn(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){o.push.apply(o,c(yn(e,t)))})),o)}function _n(e){var t=e.key,i=e.value,r=e.valueSpec,n=[];return Array.isArray(r.values)?-1===r.values.indexOf(ft(i))&&n.push(new hn(t,i,"expected one of [".concat(r.values.join(", "),"], ").concat(JSON.stringify(i)," found"))):-1===Object.keys(r.values).indexOf(ft(i))&&n.push(new hn(t,i,"expected one of [".concat(Object.keys(r.values).join(", "),"], ").concat(JSON.stringify(i)," found"))),n}function gn(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=f(e.slice(1));try{for(i.s();!(t=i.n()).done;){var r=t.value;if(!gn(r)&&"boolean"!=typeof r)return!1}}catch(n){i.e(n)}finally{i.f()}return!0;default:return!0}}function xn(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};gn(e)||(e=Mn(e));var i=e,r=!0;try{r=function(e){if(!kn(e))return e;var t=dt(e);return wn(t),t=bn(t)}(i)}catch(e){console.warn("Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.\nThis is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md\nand paste the contents of this message in the report.\nThank you!\nFilter Expression:\n".concat(JSON.stringify(i,null,2),"\n "))}var n=ct["filter_".concat(t)],a=an(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=an(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=!Ci(u.value.expression)}return{filter:o,dynamicFilter:s||void 0,needGeometry:Sn(r),needFeature:!!l}}function bn(e){if(!Array.isArray(e))return e;var t=function(e){if(Tn.has(e[0]))for(var t=1;t<e.length;t++)if(kn(e[t]))return!0;return e}(e);return!0===t?t:t.map((function(e){return bn(e)}))}function wn(e){var t=!1,i=[];if("case"===e[0]){for(var r=1;r<e.length-1;r+=2)t=t||kn(e[r]),i.push(e[r+1]);i.push(e[e.length-1])}else if("match"===e[0]){t=t||kn(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||kn(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++)wn(e[o])}function kn(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(kn(e[i]))return!0;return!1}var Tn=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function En(e,t){return e<t?-1:e>t?1:0}function Sn(e){if(!Array.isArray(e))return!1;if("within"===e[0])return!0;for(var t=1;t<e.length;t++)if(Sn(e[t]))return!0;return!1}function Mn(e){if(!e)return!0;var t,i=e[0];return e.length<=1?"any"!==i:"=="===i?An(e[1],e[2],"=="):"!="===i?zn(An(e[1],e[2],"==")):"<"===i||">"===i||"<="===i||">="===i?An(e[1],e[2],i):"any"===i?(t=e.slice(1),["any"].concat(t.map(Mn))):"all"===i?["all"].concat(e.slice(1).map(Mn)):"none"===i?["all"].concat(e.slice(1).map(Mn).map(zn)):"in"===i?In(e[1],e.slice(2)):"!in"===i?zn(In(e[1],e.slice(2))):"has"===i?Cn(e[1]):"!has"===i?zn(Cn(e[1])):"within"!==i||e}function An(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 In(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(En)]]:["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 zn(e){return["!",e]}function Pn(e){return gn(dt(e.value))?mn(ht({},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"!==Xr(t))return[new hn(i,t,"array expected, ".concat(Xr(t)," found"))];var r,n=e.styleSpec,a=[];if(t.length<1)return[new hn(i,t,"filter array must have at least 1 element")];switch(a=a.concat(_n({key:"".concat(i,"[0]"),value:t[0],valueSpec:n.filter_operator,style:e.style,styleSpec:e.styleSpec})),ft(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&"$type"===ft(t[1])&&a.push(new hn(i,t,'"$type" cannot be use with operator "'.concat(t[0],'"')));case"==":case"!=":3!==t.length&&a.push(new hn(i,t,'filter array for operator "'.concat(t[0],'" must have 3 elements')));case"in":case"!in":t.length>=2&&"string"!==(r=Xr(t[1]))&&a.push(new hn("".concat(i,"[1]"),t[1],"string expected, ".concat(r," found")));for(var o=2;o<t.length;o++)r=Xr(t[o]),"$type"===ft(t[1])?a=a.concat(_n({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 hn("".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=Xr(t[1]),2!==t.length?a.push(new hn(i,t,'filter array for "'.concat(t[0],'" operator must have 2 elements'))):"string"!==r&&a.push(new hn("".concat(i,"[1]"),t[1],"string expected, ".concat(r," found")));break;case"within":r=Xr(t[1]),2!==t.length?a.push(new hn(i,t,'filter array for "'.concat(t[0],'" operator must have 2 elements'))):"object"!==r&&a.push(new hn("".concat(i,"[1]"),t[1],"object expected, ".concat(r," found")))}return a}function Ln(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 Wn({key:i,value:a,valueSpec:n.transition,style:r,styleSpec:n});var u,c=e.valueSpec||s[o];if(!c)return[new hn(i,a,'unknown property "'.concat(o,'"'))];if("string"===Xr(a)&&Zr(c)&&!c.tokens&&(u=/^{([^}]+)}$/.exec(a))){var h='`{ "type": "identity", "property": '.concat(u?JSON.stringify(u[1]):'"_"'," }`");return[new hn(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 hn(i,a,'use of "text-field" requires a style "glyphs" property')),"text-font"===o&&Hr(dt(a))&&"identity"===ft(a.type)&&f.push(new hn(i,a,'"text-font" does not support identity functions'))),f.concat(Wn({key:e.key,value:a,valueSpec:c,style:r,styleSpec:n,expressionContext:"property",propertyType:t,propertyKey:o}))}function Rn(e){return Ln(e,"paint")}function Bn(e){return Ln(e,"layout")}function On(e){var t=[],i=e.value,r=e.key,n=e.style,a=e.styleSpec;i.type||i.ref||t.push(new hn(r,i,'either "type" or "ref" is required'));var o,s=ft(i.type),l=ft(i.ref);if(i.id)for(var u=ft(i.id),c=0;c<e.arrayIndex;c++){var h=n.layers[c];ft(h.id)===u&&t.push(new hn(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 hn(r,i[e],'"'.concat(e,'" is prohibited for ref layers')))})),n.layers.forEach((function(e){ft(e.id)===l&&(o=e)})),o?o.ref?t.push(new hn(r,i.ref,"ref cannot reference another ref layer")):s=ft(o.type):"string"==typeof l&&t.push(new hn(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&&ft(f.type);f?"vector"===d&&"raster"===s?t.push(new hn(r,i.source,'layer "'.concat(i.id,'" requires a raster source'))):"raster"===d&&"raster"!==s?t.push(new hn(r,i.source,'layer "'.concat(i.id,'" requires a vector source'))):"vector"!==d||i["source-layer"]?"raster-dem"===d&&"hillshade"!==s?t.push(new hn(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 hn(r,i,'layer "'.concat(i.id,'" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.'))):t.push(new hn(r,i,'layer "'.concat(i.id,'" must specify a "source-layer"'))):t.push(new hn(r,i.source,'source "'.concat(i.source,'" not found')))}else t.push(new hn(r,i,'missing required property "source"'));return t=t.concat(fn({key:r,value:i,valueSpec:a.layer,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":function(){return[]},type:function(){return Wn({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 Pn(ht({layerType:s},e))},layout:function(e){return fn({layer:i,key:e.key,value:e.value,valueSpec:{},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":function(e){return Bn(ht({layerType:s},e))}}})},paint:function(e){return fn({layer:i,key:e.key,value:e.value,valueSpec:{},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{"*":function(e){return Rn(ht({layerType:s},e))}}})}}})),t}function Fn(e){var t=e.value,i=e.key,r=Xr(t);return"string"!==r?[new hn(i,t,"string expected, ".concat(r," found"))]:[]}var Un={promoteId:function(e){var t=e.key,i=e.value;if("string"===Xr(i))return Fn({key:t,value:i});var r=[];for(var n in i)r.push.apply(r,c(Fn({key:"".concat(t,".").concat(n),value:i[n]})));return r}};function Vn(e){var t=e.value,i=e.key,r=e.styleSpec,n=e.style;if(!t.type)return[new hn(i,t,'"type" is required')];var a,o=ft(t.type);switch(o){case"vector":case"raster":case"raster-dem":return a=fn({key:i,value:t,valueSpec:r["source_".concat(o.replace("-","_"))],style:e.style,styleSpec:r,objectElementValidators:Un});case"geojson":if(a=fn({key:i,value:t,valueSpec:r.source_geojson,style:n,styleSpec:r,objectElementValidators:Un}),t.cluster)for(var s in t.clusterProperties){var l,u,f=h(t.clusterProperties[s],2),d=f[0],p=f[1],v="string"==typeof d?[d,["accumulated"],["get",s]]:d;(l=a).push.apply(l,c(mn({key:"".concat(i,".").concat(s,".map"),value:p,expressionContext:"cluster-map"}))),(u=a).push.apply(u,c(mn({key:"".concat(i,".").concat(s,".reduce"),value:v,expressionContext:"cluster-reduce"})))}return a;case"video":return fn({key:i,value:t,valueSpec:r.source_video,style:n,styleSpec:r});case"image":return fn({key:i,value:t,valueSpec:r.source_image,style:n,styleSpec:r});case"canvas":return[new hn(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return _n({key:"".concat(i,".type"),value:t.type,valueSpec:{values:Nn(r)},style:n,styleSpec:r})}}function Nn(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 jn(e){var t=e.value,i=e.styleSpec,r=i.light,n=e.style,a=[],o=Xr(t);if(void 0===t)return a;if("object"!==o)return a=a.concat([new hn("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?Wn({key:s,value:t[s],valueSpec:i.transition,style:n,styleSpec:i}):r[s]?Wn({key:s,value:t[s],valueSpec:r[s],style:n,styleSpec:i}):[new hn(s,t[s],'unknown property "'.concat(s,'"'))])}return a}function Gn(e){var t=e.value,i=e.key,r=e.style,n=e.styleSpec,a=n.terrain,o=[],s=Xr(t);if(void 0===t)return o;if("object"!==s)return o=o.concat([new hn("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?Wn({key:l,value:t[l],valueSpec:n.transition,style:r,styleSpec:n}):a[l]?Wn({key:l,value:t[l],valueSpec:a[l],style:r,styleSpec:n}):[new hn(l,t[l],'unknown property "'.concat(l,'"'))])}if(t.source){var c=r.sources&&r.sources[t.source],h=c&&ft(c.type);c?"raster-dem"!==h&&o.push(new hn(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 hn(i,t.source,'source "'.concat(t.source,'" not found')))}else o.push(new hn(i,t,'terrain is missing required property "source"'));return o}function Zn(e){var t=e.value,i=e.style,r=e.styleSpec,n=r.fog,a=[],o=Xr(t);if(void 0===t)return a;if("object"!==o)return a=a.concat([new hn("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?Wn({key:s,value:t[s],valueSpec:r.transition,style:i,styleSpec:r}):n[s]?Wn({key:s,value:t[s],valueSpec:n[s],style:i,styleSpec:r}):[new hn(s,t[s],'unknown property "'.concat(s,'"'))])}return a}var qn={"*":function(){return[]},array:dn,boolean:function(e){var t=e.value,i=e.key,r=Xr(t);return"boolean"!==r?[new hn(i,t,"boolean expected, ".concat(r," found"))]:[]},number:pn,color:function(e){var t=e.key,i=e.value,r=Xr(i);return"string"!==r?[new hn(t,i,"color expected, ".concat(r," found"))]:null===Lt(i)?[new hn(t,i,'color expected, "'.concat(i,'" found'))]:[]},enum:_n,filter:Pn,function:vn,layer:On,object:fn,source:Vn,light:jn,terrain:Gn,fog:Zn,string:Fn,formatted:function(e){return 0===Fn(e).length?[]:mn(e)},resolvedImage:function(e){return 0===Fn(e).length?[]:mn(e)},projection:function(e){var t=e.value,i=e.styleSpec,r=i.projection,n=e.style,a=[],o=Xr(t);if("object"===o)for(var s in t)a=a.concat(Wn({key:s,value:t[s],valueSpec:r[s],style:n,styleSpec:i}));else"string"!==o&&(a=a.concat([new hn("projection",t,"object or string expected, ".concat(o," found"))]));return a}};function Wn(e){var t=e.value,i=e.valueSpec,r=e.styleSpec;return i.expression&&Hr(ft(t))?vn(e):i.expression&&nn(dt(t))?mn(e):i.type&&qn[i.type]?qn[i.type](e):fn(ht({},e,{valueSpec:i.type?r[i.type]:i}))}function Xn(e){var t=e.value,i=e.key,r=Fn(e);return r.length||(-1===t.indexOf("{fontstack}")&&r.push(new hn(i,t,'"glyphs" url must include a "{fontstack}" token')),-1===t.indexOf("{range}")&&r.push(new hn(i,t,'"glyphs" url must include a "{range}" token'))),r}function Hn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ct;return Jn(Wn({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,objectElementValidators:{glyphs:Xn,"*":function(){return[]}}}))}var Yn=function(e){return Jn(Rn(e))},Kn=function(e){return Jn(Bn(e))};function Jn(e){return e.slice().sort((function(e,t){return e.line&&t.line?e.line-t.line:0}))}function $n(e,t){var i=!1;if(t&&t.length){var r,n=f(t);try{for(n.s();!(r=n.n()).done;){var a=r.value;e.fire(new lt(new Error(a.message))),i=!0}}catch(o){n.e(o)}finally{n.f()}}return i}var Qn=ea;function ea(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}ea.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)},ea.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},ea.prototype._insertCell=function(e,t,i,r,n,a){this.cells[n].push(a)},ea.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},ea.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}}},ea.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}},ea.prototype._convertFromCellCoord=function(e){return(e-this.padding)/this.scale},ea.prototype._convertToCellCoord=function(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))},ea.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;for(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 ta={};function ia(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),ta[t]={klass:e,omit:i.omit||[]}}for(var ra in ia(Object,"Object"),Qn.serialize=function(e,t){var i=e.toArrayBuffer();return t&&t.push(i),{buffer:i}},Qn.deserialize=function(e){return new Qn(e.buffer)},Object.defineProperty(Qn,"name",{value:"Grid"}),ia(Qn,"Grid"),ia(Nt,"Color"),ia(Error,"Error"),ia(xe,"AJAXError"),ia(qt,"ResolvedImage"),ia(un,"StylePropertyFunction"),ia(rn,"StyleExpression",{omit:["_evaluator"]}),ia(sn,"ZoomDependentExpression"),ia(on,"ZoomConstantExpression"),ia(ci,"CompoundExpression",{omit:["_evaluate"]}),Nr)ta[Nr[ra]._classRegistryKey]||ia(Nr[ra],"Expression".concat(ra));function na(e){return e&&"undefined"!=typeof ArrayBuffer&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}function aa(e){return _.ImageBitmap&&e instanceof _.ImageBitmap}function oa(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(na(e)||aa(e))return t&&t.push(e),e;if(ArrayBuffer.isView(e)){var i=e;return t&&t.push(i.buffer),i}if(e instanceof _.ImageData)return t&&t.push(e.data.buffer),e;if(Array.isArray(e)){var r,n=[],a=f(e);try{for(a.s();!(r=a.n()).done;){var o=r.value;n.push(oa(o,t))}}catch(h){a.e(h)}finally{a.f()}return n}if("object"==typeof e){var s=e.constructor,l=s._classRegistryKey;if(!l)throw new Error("can't serialize object of unregistered class ".concat(l));var u=s.serialize?s.serialize(e,t):{};if(!s.serialize){for(var c in e)e.hasOwnProperty(c)&&(ta[l].omit.indexOf(c)>=0||(u[c]=oa(e[c],t)));e instanceof Error&&(u.message=e.message)}if(u.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==l&&(u.$name=l),u}throw new Error("can't serialize object of type "+typeof e)}function sa(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||na(e)||aa(e)||ArrayBuffer.isView(e)||e instanceof _.ImageData)return e;if(Array.isArray(e))return e.map(sa);if("object"==typeof e){var t=e.$name||"Object",i=ta[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]=sa(e[o]))}return r}throw new Error("can't deserialize object of type "+typeof e)}var la=function(e){return e>=1536&&e<=1791},ua=function(e){return e>=1872&&e<=1919},ca=function(e){return e>=2208&&e<=2303},ha=function(e){return e>=11904&&e<=12031},fa=function(e){return e>=12032&&e<=12255},da=function(e){return e>=12272&&e<=12287},pa=function(e){return e>=12288&&e<=12351},va=function(e){return e>=12352&&e<=12447},ma=function(e){return e>=12448&&e<=12543},ya=function(e){return e>=12544&&e<=12591},_a=function(e){return e>=12704&&e<=12735},ga=function(e){return e>=12736&&e<=12783},xa=function(e){return e>=12784&&e<=12799},ba=function(e){return e>=12800&&e<=13055},wa=function(e){return e>=13056&&e<=13311},ka=function(e){return e>=13312&&e<=19903},Ta=function(e){return e>=19968&&e<=40959},Ea=function(e){return e>=40960&&e<=42127},Sa=function(e){return e>=42128&&e<=42191},Ma=function(e){return e>=44032&&e<=55215},Aa=function(e){return e>=63744&&e<=64255},Ia=function(e){return e>=64336&&e<=65023},Ca=function(e){return e>=65040&&e<=65055},za=function(e){return e>=65072&&e<=65103},Pa=function(e){return e>=65104&&e<=65135},Da=function(e){return e>=65136&&e<=65279},La=function(e){return e>=65280&&e<=65519};function Ra(e){var t,i=f(e);try{for(i.s();!(t=i.n()).done;)if(Fa(t.value.charCodeAt(0)))return!0}catch(r){i.e(r)}finally{i.f()}return!1}function Ba(e){var t,i=f(e);try{for(i.s();!(t=i.n()).done;)if(!Oa(t.value.charCodeAt(0)))return!1}catch(r){i.e(r)}finally{i.f()}return!0}function Oa(e){return!(la(e)||ua(e)||ca(e)||Ia(e)||Da(e))}function Fa(e){return!(746!==e&&747!==e&&(e<4352||!(_a(e)||ya(e)||za(e)&&!(e>=65097&&e<=65103)||Aa(e)||wa(e)||ha(e)||ga(e)||!(!pa(e)||e>=12296&&e<=12305||e>=12308&&e<=12319||12336===e)||ka(e)||Ta(e)||ba(e)||function(e){return e>=12592&&e<=12687}(e)||function(e){return e>=43360&&e<=43391}(e)||function(e){return e>=55216&&e<=55295}(e)||function(e){return e>=4352&&e<=4607}(e)||Ma(e)||va(e)||da(e)||function(e){return e>=12688&&e<=12703}(e)||fa(e)||xa(e)||ma(e)&&12540!==e||!(!La(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)||!(!Pa(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)||Ea(e)||Sa(e))))}function Ua(e){return!(Fa(e)||function(e){return!!(function(e){return e>=128&&e<=255}(e)&&(167===e||169===e||174===e||177===e||188===e||189===e||190===e||215===e||247===e)||function(e){return e>=8192&&e<=8303}(e)&&(8214===e||8224===e||8225===e||8240===e||8241===e||8251===e||8252===e||8258===e||8263===e||8264===e||8265===e||8273===e)||function(e){return e>=8448&&e<=8527}(e)||function(e){return e>=8528&&e<=8591}(e)||function(e){return e>=8960&&e<=9215}(e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||9003===e||e>=9085&&e<=9114||e>=9150&&e<=9165||9167===e||e>=9169&&e<=9179||e>=9186&&e<=9215)||function(e){return e>=9216&&e<=9279}(e)&&9251!==e||function(e){return e>=9280&&e<=9311}(e)||function(e){return e>=9312&&e<=9471}(e)||function(e){return e>=9632&&e<=9727}(e)||function(e){return e>=9728&&e<=9983}(e)&&!(e>=9754&&e<=9759)||function(e){return e>=11008&&e<=11263}(e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||pa(e)||ma(e)||function(e){return e>=57344&&e<=63743}(e)||za(e)||Pa(e)||La(e)||8734===e||8756===e||8757===e||e>=9984&&e<=10087||e>=10102&&e<=10131||65532===e||65533===e)}(e))}function Va(e){return e>=1424&&e<=2303||Ia(e)||Da(e)}function Na(e,t){return!(!t&&Va(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||function(e){return e>=6016&&e<=6143}(e))}function ja(e){var t,i=f(e);try{for(i.s();!(t=i.n()).done;)if(Va(t.value.charCodeAt(0)))return!0}catch(r){i.e(r)}finally{i.f()}return!1}var Ga="deferred",Za="loading",qa="loaded",Wa=null,Xa="unavailable",Ha=null,Ya=function(e){e&&"string"==typeof e&&e.indexOf("NetworkError")>-1&&(Xa="error"),Wa&&Wa(e)};function Ka(){Ja.fire(new st("pluginStateChange",{pluginStatus:Xa,pluginURL:Ha}))}var Ja=new ut,$a=function(){return Xa},Qa=function(){if(Xa!==Ga||!Ha)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Xa=Za,Ka(),Ha&&ke({url:Ha},(function(e){e?Ya(e):(Xa=qa,Ka())}))},eo={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:function(){return Xa===qa||null!=eo.applyArabicShaping},isLoading:function(){return Xa===Za},setState:function(e){Xa=e.pluginStatus,Ha=e.pluginURL},isParsed:function(){return null!=eo.applyArabicShaping&&null!=eo.processBidirectionalText&&null!=eo.processStyledBidirectionalText},getPluginURL:function(){return Ha}},to=function(){function e(t,i){d(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 p(e,[{key:"isSupportedScript",value:function(e){return function(e,t){var i,r=f(e);try{for(r.s();!(i=r.n()).done;)if(!Na(i.value.charCodeAt(0),t))return!1}catch(n){r.e(n)}finally{r.f()}return!0}(e,eo.isLoaded())}}]),e}(),io=function(){function e(t,i){d(this,e),this.property=t,this.value=i,this.expression=function(e,t){if(Hr(e))return new un(e,t);if(nn(e)){var i=ln(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=Nt.parse(e)),{kind:"constant",evaluate:function(){return r}}}(void 0===i?t.specification.default:i,t.specification)}return p(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}(),ro=function(){function e(t){d(this,e),this.property=t,this.value=new io(t,void 0)}return p(e,[{key:"transitioned",value:function(e,t){return new ao(this.property,this.value,t,G({},e.transition,this.transition),e.now)}},{key:"untransitioned",value:function(){return new ao(this.property,this.value,null,{},0)}}]),e}(),no=function(){function e(t){d(this,e),this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}return p(e,[{key:"getValue",value:function(e){return Q(this._values[e].value.value)}},{key:"setValue",value:function(e,t){this._values.hasOwnProperty(e)||(this._values[e]=new ro(this._values[e].property)),this._values[e].value=new io(this._values[e].property,null===t?void 0:Q(t))}},{key:"getTransition",value:function(e){return Q(this._values[e].transition)}},{key:"setTransition",value:function(e,t){this._values.hasOwnProperty(e)||(this._values[e]=new ro(this._values[e].property)),this._values[e].transition=Q(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 oo(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 oo(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}(),ao=function(){function e(t,i,r,n,a){d(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 p(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,R(o))}return n}}]),e}(),oo=function(){function e(t){d(this,e),this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}return p(e,[{key:"possiblyEvaluate",value:function(e,t,i){for(var r=new uo(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}(),so=function(){function e(t){d(this,e),this._properties=t,this._values=Object.create(t.defaultPropertyValues)}return p(e,[{key:"getValue",value:function(e){return Q(this._values[e].value)}},{key:"setValue",value:function(e,t){this._values[e]=new io(this._values[e].property,null===t?void 0:Q(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 uo(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}(),lo=function(){function e(t,i,r){d(this,e),this.property=t,this.value=i,this.parameters=r}return p(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}(),uo=function(){function e(t){d(this,e),this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}return p(e,[{key:"get",value:function(e){return this._values[e]}}]),e}(),co=function(){function e(t){d(this,e),this.specification=t}return p(e,[{key:"possiblyEvaluate",value:function(e,t){return e.expression.evaluate(t)}},{key:"interpolate",value:function(e,t,i){var r=ji[this.specification.type];return r?r(e,t,i):e}}]),e}(),ho=function(){function e(t,i){d(this,e),this.specification=t,this.overrides=i}return p(e,[{key:"possiblyEvaluate",value:function(e,t,i,r){return new lo(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 lo(this,{kind:"constant",value:void 0},e.parameters);var r=ji[this.specification.type];return r?new lo(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}(),fo=function(){function e(t){d(this,e),this.specification=t}return p(e,[{key:"possiblyEvaluate",value:function(e,t,i,r){return!!e.expression.evaluate(t,null,{},i,r)}},{key:"interpolate",value:function(){return!1}}]),e}(),po=p((function e(t){d(this,e),this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];var i=new to(0,{});for(var r in t){var n=t[r];n.specification.overridable&&this.overridableProperties.push(r);var a=this.defaultPropertyValues[r]=new io(n,void 0),o=this.defaultTransitionablePropertyValues[r]=new ro(n);this.defaultTransitioningPropertyValues[r]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=a.possiblyEvaluate(i)}}));function vo(e,t){return 256*(e=F(Math.floor(e),0,255))+F(Math.floor(t),0,255)}ia(ho,"DataDrivenProperty"),ia(co,"DataConstantProperty"),ia(fo,"ColorRampProperty");var mo={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},yo=p((function e(t,i){d(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})),_o=function(){function e(){d(this,e),this.isTransferred=!1,this.capacity=-1,this.resize(0)}return p(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 go(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=mo[e.type].BYTES_PER_ELEMENT,a=i=xo(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:xo(i,Math.max(r,t)),alignment:t}}function xo(e,t){return Math.ceil(e/t)*t}var bo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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}(_o);bo.prototype.bytesPerElement=4,ia(bo,"StructArrayLayout2i4");var wo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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}(_o);wo.prototype.bytesPerElement=6,ia(wo,"StructArrayLayout3i6");var ko=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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}(_o);ko.prototype.bytesPerElement=8,ia(ko,"StructArrayLayout4i8");var To=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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}(_o);To.prototype.bytesPerElement=12,ia(To,"StructArrayLayout2i4ub1f12");var Eo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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}(_o);Eo.prototype.bytesPerElement=16,ia(Eo,"StructArrayLayout4f16");var So=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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}(_o);So.prototype.bytesPerElement=12,ia(So,"StructArrayLayout4ui1f12");var Mo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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}(_o);Mo.prototype.bytesPerElement=8,ia(Mo,"StructArrayLayout4ui8");var Ao=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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}(_o);Ao.prototype.bytesPerElement=12,ia(Ao,"StructArrayLayout6i12");var Io=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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}(_o);Io.prototype.bytesPerElement=24,ia(Io,"StructArrayLayout4i4ui4i24");var Co=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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}(_o);Co.prototype.bytesPerElement=20,ia(Co,"StructArrayLayout3i3f20");var zo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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}(_o);zo.prototype.bytesPerElement=4,ia(zo,"StructArrayLayout1ul4");var Po=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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,v=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[v+3]=o,this.float32[v+4]=s,this.float32[v+5]=l,this.float32[v+6]=u,this.int16[p+14]=c,this.uint32[v+8]=h,this.uint16[p+18]=f,this.uint16[p+19]=d,e}}]),i}(_o);Po.prototype.bytesPerElement=40,ia(Po,"StructArrayLayout5i4f1i1ul2ui40");var Do=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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}(_o);Do.prototype.bytesPerElement=16,ia(Do,"StructArrayLayout3i2i2i16");var Lo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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}(_o);Lo.prototype.bytesPerElement=16,ia(Lo,"StructArrayLayout2f1f2i16");var Ro=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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}(_o);Ro.prototype.bytesPerElement=12,ia(Ro,"StructArrayLayout2ub2f12");var Bo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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}(_o);Bo.prototype.bytesPerElement=12,ia(Bo,"StructArrayLayout3f12");var Oo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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}(_o);Oo.prototype.bytesPerElement=6,ia(Oo,"StructArrayLayout3ui6");var Fo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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,v,m,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,v,m,y,_,g,x)}},{key:"emplace",value:function(e,t,i,r,n,a,o,s,l,u,c,h,f,d,p,v,m,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]=v,this.uint8[T+48]=m,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}(_o);Fo.prototype.bytesPerElement=60,ia(Fo,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");var Uo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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,v,m,y,_,g,x,b,w,k,T,E,S,M,A,I){var C=this.length;return this.resize(C+1),this.emplace(C,e,t,i,r,n,a,o,s,l,u,c,h,f,d,p,v,m,y,_,g,x,b,w,k,T,E,S,M,A,I)}},{key:"emplace",value:function(e,t,i,r,n,a,o,s,l,u,c,h,f,d,p,v,m,y,_,g,x,b,w,k,T,E,S,M,A,I,C){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]=v,this.uint16[z+18]=m,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]=S,this.uint32[P+15]=M,this.float32[P+16]=A,this.float32[P+17]=I,this.float32[P+18]=C,e}}]),i}(_o);Uo.prototype.bytesPerElement=76,ia(Uo,"StructArrayLayout3i2f6i15ui1ul3f76");var Vo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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}(_o);Vo.prototype.bytesPerElement=4,ia(Vo,"StructArrayLayout1f4");var No=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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}(_o);No.prototype.bytesPerElement=20,ia(No,"StructArrayLayout5f20");var jo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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;return this.uint32[3*e+0]=t,this.uint16[a+2]=i,this.uint16[a+3]=r,this.uint16[a+4]=n,e}}]),i}(_o);jo.prototype.bytesPerElement=12,ia(jo,"StructArrayLayout1ul3ui12");var Go=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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}(_o);Go.prototype.bytesPerElement=4,ia(Go,"StructArrayLayout2ui4");var Zo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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}(_o);Zo.prototype.bytesPerElement=2,ia(Zo,"StructArrayLayout1ui2");var qo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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}(_o);qo.prototype.bytesPerElement=8,ia(qo,"StructArrayLayout2f8");var Wo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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}(yo);Wo.prototype.size=40;var Xo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"get",value:function(e){return new Wo(this,e)}}]),i}(Po);ia(Xo,"CollisionBoxArray");var Ho=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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]},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}(yo);Ho.prototype.size=60;var Yo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"get",value:function(e){return new Ho(this,e)}}]),i}(Fo);ia(Yo,"PlacedSymbolArray");var Ko=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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}(yo);Ko.prototype.size=76;var Jo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"get",value:function(e){return new Ko(this,e)}}]),i}(Uo);ia(Jo,"SymbolInstanceArray");var $o=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"getoffsetX",value:function(e){return this.float32[1*e+0]}}]),i}(Vo);ia($o,"GlyphOffsetArray");var Qo=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"getx",value:function(e){return this.int16[2*e+0]}},{key:"gety",value:function(e){return this.int16[2*e+1]}}]),i}(bo);ia(Qo,"SymbolLineVertexArray");var es=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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}(yo);es.prototype.size=12;var ts=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"get",value:function(e){return new es(this,e)}}]),i}(jo);ia(ts,"FeatureIndexArray");var is=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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}(Go);ia(is,"FillExtrusionCentroidArray");var rs=go([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),ns=go([{name:"a_dash",components:4,type:"Uint16"}]),as={},os={get exports(){return as},set exports(e){as=e}},ss={};({get exports(){return ss},set exports(e){ss=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=(65535&(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 ls={};({get exports(){return ls},set exports(e){ls=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 us=ss,cs=ls;os.exports=us,as.murmur3=us,as.murmur2=cs;var hs=function(){function e(){d(this,e),this.ids=[],this.positions=[],this.indexed=!1}return p(e,[{key:"add",value:function(e,t,i,r){this.ids.push(fs(e)),this.positions.push(t,i,r)}},{key:"getPositions",value:function(e){for(var t=fs(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 ds(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 fs(e){var t=+e;return!isNaN(t)&&Number.MIN_SAFE_INTEGER<=t&&t<=Number.MAX_SAFE_INTEGER?t:as(String(e))}function ds(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;ps(e,a,o),ps(t,3*a,3*o),ps(t,3*a+1,3*o+1),ps(t,3*a+2,3*o+2)}o-i<r-o?(ds(e,t,i,o),i=o+1):(ds(e,t,o+1,r),r=o)}}function ps(e,t,i){var r=e[t];e[t]=e[i],e[i]=r}ia(hs,"FeaturePositionMap");var vs=function(){function e(t){d(this,e),this.gl=t.gl,this.initialized=!1}return p(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}(),ms=function(e){v(i,e);var t=m(i);function i(e){var r;return d(this,i),(r=t.call(this,e)).current=0,r}return p(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}(vs),ys=function(e){v(i,e);var t=m(i);function i(e){var r;return d(this,i),(r=t.call(this,e)).current=[0,0,0,0],r}return p(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}(vs),_s=function(e){v(i,e);var t=m(i);function i(e){var r;return d(this,i),(r=t.call(this,e)).current=Nt.transparent,r}return p(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}(vs),gs=new Float32Array(16),xs=new Float32Array(9),bs=new Float32Array(4);function ws(e){return[vo(255*e.r,255*e.g),vo(255*e.b,255*e.a)]}var ks=function(){function e(t,i,r){d(this,e),this.value=t,this.uniformNames=i.map((function(e){return"u_".concat(e)})),this.type=r}return p(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 _s(e):new ms(e)}}]),e}(),Ts=function(){function e(t,i){d(this,e),this.uniformNames=i.map((function(e){return"u_".concat(e)})),this.pattern=null,this.pixelRatio=1}return p(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 ys(e):new ms(e)}}]),e}(),Es=function(){function e(t,i,r,n){d(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 p(e,[{key:"populatePaintArray",value:function(e,t,i,r,n,a){var o=this.paintVertexArray.length,s=this.expression.evaluate(new to(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=ws(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}(),Ss=function(){function e(t,i,r,n,a,o){d(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 p(e,[{key:"populatePaintArray",value:function(e,t,i,r,n,a){var o=this.expression.evaluate(new to(this.zoom),t,{},n,r,a),s=this.expression.evaluate(new to(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=ws(i),a=ws(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=F(this.expression.interpolationFactor(a,this.zoom,this.zoom+1),0,1);t.set(e,n,o)}},{key:"getBinding",value:function(e,t){return new ms(e)}}]),e}(),Ms=function(){function e(t,i,r,n,a){d(this,e),this.expression=t,this.layerId=a,this.paintVertexAttributes=("array"===r?ns:rs).members;for(var o=0;o<i.length;++o);this.paintVertexArray=new n}return p(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}(),As=function(){function e(t,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){return!0};d(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 lo&&Zr(o.property.specification)){var s=zs(a,t.type),l=o.value,u=o.property.specification.type,c=!!o.property.useIntegerZoom,h="line-dasharray"===a||a.endsWith("pattern"),f="line-dasharray"===a&&"constant"!==t.layout.get("line-cap").value.kind;if("constant"!==l.kind||f)if("source"===l.kind||f||h){var p=Ls(a,u,"source");this.binders[a]=h?new Ms(l,s,u,p,t.id):new Es(l,s,u,p),n.push("/a_".concat(a))}else{var v=Ls(a,u,"composite");this.binders[a]=new Ss(l,s,u,c,i,v),n.push("/z_".concat(a))}else this.binders[a]=h?new Ts(l.value,s):new ks(l.value,s,u),n.push("/u_".concat(a))}}this.cacheKey=n.sort().join("")}return p(e,[{key:"getMaxValue",value:function(e){var t=this.binders[e];return t instanceof Es||t instanceof Ss?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 Es||s instanceof Ss||s instanceof Ms)&&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 Ts&&i.setConstantPatternPositions(e)}}},{key:"updatePaintArrays",value:function(e,t,i,r,n,a){var o=!1;for(var s in e){var l,u=t.getPositions(s),c=f(u);try{for(c.s();!(l=c.n()).done;){var h=l.value,d=i.feature(h.index);for(var p in this.binders){var v=this.binders[p];if((v instanceof Es||v instanceof Ss||v instanceof Ms)&&!0===v.expression.isStateDependent){var m=r.paint.get(p);v.expression=m.value,v.updatePaintArray(h.start,h.end,d,e[s],n,a),o=!0}}}}catch(y){c.e(y)}finally{c.f()}}return o}},{key:"defines",value:function(){var e=[];for(var t in this.binders){var i=this.binders[t];(i instanceof ks||i instanceof Ts)&&e.push.apply(e,c(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 Es||i instanceof Ss||i instanceof Ms)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 ks||i instanceof Ts||i instanceof Ss){var r,n=f(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 ks||r instanceof Ts||r instanceof Ss){var n,a=f(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=f(i);try{for(o.s();!(a=o.n()).done;){var s=a.value,l=s.name,u=s.property,c=s.binding;this.binders[u].setUniform(e,c,n,r.get(u),l)}}catch(h){o.e(h)}finally{o.f()}}},{key:"updatePaintBuffers",value:function(){for(var e in this._buffers=[],this.binders){var t=this.binders[e];(t instanceof Es||t instanceof Ss||t instanceof Ms)&&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 Es||i instanceof Ss||i instanceof Ms)&&i.upload(e)}this.updatePaintBuffers()}},{key:"destroy",value:function(){for(var e in this.binders){var t=this.binders[e];(t instanceof Es||t instanceof Ss||t instanceof Ms)&&t.destroy()}}}]),e}(),Is=function(){function e(t,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){return!0};d(this,e),this.programConfigurations={};var n,a=f(t);try{for(a.s();!(n=a.n()).done;){var o=n.value;this.programConfigurations[o.id]=new As(o,i,r)}}catch(s){a.e(s)}finally{a.f()}this.needsUpload=!1,this._featureMap=new hs,this._bufferOffset=0}return p(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=f(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(l){o.e(l)}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}(),Cs={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern","pixel_ratio"],"fill-pattern":["pattern","pixel_ratio"],"fill-extrusion-pattern":["pattern","pixel_ratio"],"line-dasharray":["dash"]};function zs(e,t){return Cs[e]||[e.replace("".concat(t,"-"),"").replace(/-/g,"_")]}var Ps={"line-pattern":{source:So,composite:So},"fill-pattern":{source:So,composite:So},"fill-extrusion-pattern":{source:So,composite:So},"line-dasharray":{source:Mo,composite:Mo}},Ds={color:{source:qo,composite:Eo},number:{source:Vo,composite:qo}};function Ls(e,t,i){var r=Ps[e];return r&&r[i]||Ds[t][i]}ia(ks,"ConstantBinder"),ia(Ts,"PatternConstantBinder"),ia(Es,"SourceExpressionBinder"),ia(Ms,"PatternCompositeBinder"),ia(Ss,"CompositeExpressionBinder"),ia(As,"ProgramConfiguration",{omit:["_buffers"]}),ia(Is,"ProgramConfigurationSet");var Rs="-transition",Bs=function(e){v(i,e);var t=m(i);function i(e,r){var n;if(d(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 so(r.layout)),r.paint)){for(var a in n._transitionablePaint=new no(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 uo(r.paint)}return l(n)}return p(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(Kn,"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 K(e,Rs)?this._transitionablePaint.getTransition(e.slice(0,-Rs.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(Yn,"layers.".concat(this.id,".paint.").concat(e),e,t,i))return!1;if(K(e,Rs))return this._transitionablePaint.setTransition(e.slice(0,-Rs.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=K(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.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),$(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)&&$n(this,e.call(Hn,{key:t,layerType:this.type,objectKey:i,value:r,styleSpec:ct,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 lo&&Zr(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=xn(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}(ut),Os=go([{name:"a_pos",components:2,type:"Int16"}],4),Fs=go([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),Us=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];d(this,e),this.segments=t}return p(e,[{key:"prepareSegment",value:function(t,i,r,n){var a=this.segments[this.segments.length-1];return t>e.MAX_VERTEX_ARRAY_LENGTH&&te("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=f(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}();Us.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,ia(Us,"SegmentVector");var Vs=8192,Ns=function(){function e(t,i){d(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 p(e,[{key:"setNorthEast",value:function(e){return this._ne=e instanceof mu?new mu(e.lng,e.lat):mu.convert(e),this}},{key:"setSouthWest",value:function(e){return this._sw=e instanceof mu?new mu(e.lng,e.lat):mu.convert(e),this}},{key:"extend",value:function(t){var i,r,n=this._sw,a=this._ne;if(t instanceof mu)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(mu.convert(t)):"object"==typeof t&&null!==t&&t.hasOwnProperty("lat")&&(t.hasOwnProperty("lon")||t.hasOwnProperty("lng"))?this.extend(mu.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 mu(i.lng,i.lat),this._ne=new mu(r.lng,r.lat)),this}},{key:"getCenter",value:function(){return new mu((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 mu(this.getWest(),this.getNorth())}},{key:"getSouthEast",value:function(){return new mu(this.getEast(),this.getSouth())}},{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=mu.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}(),js=1e-6,Gs="undefined"!=typeof Float32Array?Float32Array:Array;function Zs(){var e=new Gs(9);return Gs!=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 qs(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],v=i[3],m=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]=v*r+m*o+y*u,e[4]=v*n+m*s+y*c,e[5]=v*a+m*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 Ws(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 Xs(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],v=t[13],m=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*v-h*p,E=c*m-f*p,S=c*y-d*p,M=h*m-f*v,A=h*y-d*v,I=f*y-d*m,C=_*I-g*A+x*M+b*S-w*E+k*T;return C?(e[0]=(s*I-l*A+u*M)*(C=1/C),e[1]=(n*A-r*I-a*M)*C,e[2]=(v*k-m*w+y*b)*C,e[3]=(f*w-h*k-d*b)*C,e[4]=(l*S-o*I-u*E)*C,e[5]=(i*I-n*S+a*E)*C,e[6]=(m*x-p*k-y*g)*C,e[7]=(c*k-f*x+d*g)*C,e[8]=(o*A-s*S+u*T)*C,e[9]=(r*S-i*A-a*T)*C,e[10]=(p*w-v*x+y*_)*C,e[11]=(h*x-c*w-d*_)*C,e[12]=(s*E-o*M-l*T)*C,e[13]=(i*M-r*E+n*T)*C,e[14]=(v*g-p*b-m*_)*C,e[15]=(c*b-h*g+f*_)*C,e):null}function Hs(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],v=t[12],m=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*v,e[1]=g*n+x*l+b*f+w*m,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])*v,e[5]=g*n+x*l+b*f+w*m,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])*v,e[9]=g*n+x*l+b*f+w*m,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])*v,e[13]=g*n+x*l+b*f+w*m,e[14]=g*a+x*u+b*d+w*y,e[15]=g*o+x*c+b*p+w*_,e}function Ys(e,t,i){var r,n,a,o,s,l,u,c,h,f,d,p,v=i[0],m=i[1],y=i[2];return t===e?(e[12]=t[0]*v+t[4]*m+t[8]*y+t[12],e[13]=t[1]*v+t[5]*m+t[9]*y+t[13],e[14]=t[2]*v+t[6]*m+t[10]*y+t[14],e[15]=t[3]*v+t[7]*m+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*v+s*m+h*y+t[12],e[13]=n*v+l*m+f*y+t[13],e[14]=a*v+u*m+d*y+t[14],e[15]=o*v+c*m+p*y+t[15]),e}function Ks(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 Js(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 $s(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 Qs(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function el(e,t,i){var r,n,a,o=i[0],s=i[1],l=i[2],u=Math.hypot(o,s,l);return u<js?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 tl=Hs;function il(){var e=new Gs(3);return Gs!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function rl(e){var t=new Gs(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function nl(e){return Math.hypot(e[0],e[1],e[2])}function al(e,t,i){var r=new Gs(3);return r[0]=e,r[1]=t,r[2]=i,r}function ol(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e}function sl(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e}function ll(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e}function ul(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 cl(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 hl(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function fl(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 dl(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 pl(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function vl(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 ml(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 yl(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,v=2*i[3];return c*=v,h*=v,d*=2,p*=2,e[0]=o+(u*=v)+(f*=2),e[1]=s+c+d,e[2]=l+h+p,e}var _l,gl=sl,xl=ll,bl=nl;function wl(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 kl(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 Tl(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 El(){var e=new Gs(4);return Gs!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function Sl(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function Ml(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 Al(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}il(),_l=new Gs(4),Gs!=Float32Array&&(_l[0]=0,_l[1]=0,_l[2]=0,_l[3]=0);var Il=kl;il(),al(1,0,0),al(0,1,0),El(),El(),Zs();var Cl=go([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]).members,zl=go([{name:"a_pos_3",components:3,type:"Int16"}]),Pl=go([{name:"a_pos",type:"Int16",components:2}]),Dl=function(){function e(t,i){d(this,e),this.pos=t,this.dir=i}return p(e,[{key:"intersectsPlane",value:function(e,t,i){var r=pl(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(function(e,t){var i=e[0],r=e[1],n=e[2],a=t[0],o=t[1],s=t[2];return Math.abs(i-a)<=js*Math.max(1,Math.abs(i),Math.abs(a))&&Math.abs(r-o)<=js*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(n-s)<=js*Math.max(1,Math.abs(n),Math.abs(s))}(this.pos,e)||0===t)return i[0]=i[1]=i[2]=0,!1;var r=h(this.dir,3),n=r[0],a=r[1],o=r[2],s=this.pos[0]-e[0],l=this.pos[1]-e[1],u=this.pos[2]-e[2],c=n*n+a*a+o*o,f=2*(s*n+l*a+u*o),d=f*f-4*c*(s*s+l*l+u*u-t*t);if(d<0){var p=Math.max(-f/2,0),v=s+n*p,m=l+a*p,y=u+o*p,_=Math.hypot(v,m,y);return i[0]=v*t/_,i[1]=m*t/_,i[2]=y*t/_,!1}var g=(-f-Math.sqrt(d))/(2*c);if(g<0){var x=Math.hypot(s,l,u);return i[0]=s*t/x,i[1]=l*t/x,i[2]=u*t/x,!1}return i[0]=s+n*g,i[1]=l+a*g,i[2]=u+o*g,!0}}]),e}(),Ll=function(){function e(t,i,r,n,a){d(this,e),this.TL=t,this.TR=i,this.BR=r,this.BL=n,this.horizon=a}return p(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(ml(n,n,t),ml(a,a,t),ml(o,o,t),ml(s,s,t),i/r)}}]),e}(),Rl=function(){function e(t,i){d(this,e),this.points=t,this.planes=i}return p(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=Tl([],e,t),o=1/r[3]/i*a;return function(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e[3]=t[3]*i[3],e}(r,r,[o,o,n?1/r[3]:o,o])})),s=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((function(e){var t=dl([],vl([],gl([],o[e[0]],o[e[1]]),gl([],o[e[2]],o[e[1]]))),i=-pl(t,o[e[1]]);return t.concat(i)}));return new e(o,s)}}]),e}(),Bl=function(){function e(t,i){d(this,e),this.min=t,this.max=i,this.center=hl([],ol([],this.min,this.max),.5)}return p(e,[{key:"quadrant",value:function(t){for(var i=[t%2==0,t<2],r=rl(this.min),n=rl(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;r++){for(var n=e.planes[r],a=0,o=0;o<t.length;o++)a+=pl(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=f(t);try{for(a.s();!(i=a.n()).done;){var o=i.value;ul(r,r,o),cl(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)ml(r[n],r[n],i);return e.fromPoints(r)}}]),e}(),Ol=Vs/Math.PI/2,Fl=64,Ul=[Fl,32,16],Vl=-Ol,Nl=Ol,jl=[new Bl([Vl,Vl,Vl],[Nl,Nl,Nl]),new Bl([Vl,Vl,Vl],[0,0,Nl]),new Bl([0,Vl,Vl],[Nl,0,Nl]),new Bl([Vl,0,Vl],[0,Nl,Nl]),new Bl([0,0,Vl],[Nl,Nl,Nl])];function Gl(e){return e*Ol/pu}function Zl(e,t,i){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],n=hl([],e._camera.position,e.worldSize),a=[t,i,1,1];Tl(a,a,e.pixelMatrixInverse),wl(a,a,1/a[3]);var o=dl([],gl([],a,n)),s=e.globeMatrix,l=[s[12],s[13],s[14]],u=gl([],l,n),c=nl(u),h=dl([],u),f=e.worldSize/(2*Math.PI),d=pl(h,o),p=Math.asin(f/c);if(p<Math.acos(d)){if(!r)return null;var v=[],m=[];hl(v,o,c/d),dl(m,gl(m,v,u)),dl(o,ol(o,u,hl(o,m,Math.tan(p)*c)))}var y=[];new Dl(n,o).closestPointOnSphere(l,f,y);var _=dl([],ue(s,0)),g=dl([],ue(s,1)),x=dl([],ue(s,2)),b=pl(_,y),w=pl(g,y),k=pl(x,y),T=D(Math.asin(-w/f)),E=D(Math.atan2(b,k));E=e.center.lng+function(e,t){var i=(t-e+180)%360-180;return i<-180?i+360:i}(e.center.lng,E);var S=_u(E),M=F(gu(T),0,1);return new Su(S,M)}var ql=p((function e(t,i,r){d(this,e),this.a=gl([],t,r),this.b=gl([],i,r),this.center=r;var n=dl([],this.a),a=dl([],this.b);this.angle=Math.acos(pl(n,a))}));function Wl(e,t){return 0===e.angle||(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,F(i,0,1))+e.center[t];var i}function Xl(e){if(e.z<=1)return jl[e.z+2*e.y+e.x];var t=Ql($l(e));return Bl.fromPoints(t)}function Hl(e,t,i){return hl(e,e,1-i),fl(e,e,t,i)}function Yl(e,t){var i=lu(t.zoom);if(0===i)return Xl(e);var r=$l(e),n=Ql(r),a=_u(r.getWest())*t.worldSize,o=_u(r.getEast())*t.worldSize,s=gu(r.getNorth())*t.worldSize,l=gu(r.getSouth())*t.worldSize,u=[a,s,0],c=[o,s,0],h=[a,l,0],f=[o,l,0],d=Xs([],t.globeMatrix);return ml(u,u,d),ml(c,c,d),ml(h,h,d),ml(f,f,d),n[0]=Hl(n[0],h,i),n[1]=Hl(n[1],f,i),n[2]=Hl(n[2],c,i),n[3]=Hl(n[3],u,i),Bl.fromPoints(n)}function Kl(e,t,i){var r,n=f(e);try{for(n.s();!(r=n.n()).done;){var a=r.value;ml(a,a,t),hl(a,a,i)}}catch(o){n.e(o)}finally{n.f()}}function Jl(e,t,i){var r=t/e.worldSize,n=e.globeMatrix;if(i.z<=1){var a=Xl(i).getCorners();return Kl(a,n,r),Bl.fromPoints(a)}var o=$l(i),s=Ql(o);Kl(s,n,r);var l=Number.MAX_VALUE,u=[-l,-l,-l],c=[l,l,l];if(o.contains(e.center)){var h,d=f(s);try{for(d.s();!(h=d.n()).done;){var p=h.value;ul(c,c,p),cl(u,u,p)}}catch(U){d.e(U)}finally{d.f()}u[2]=0;var v=e.point,m=[v.x*r,v.y*r,0];return ul(c,c,m),cl(u,u,m),new Bl(c,u)}var y=[n[12]*r,n[13]*r,n[14]*r],_=o.getCenter(),g=F(e.center.lat,-Tu,Tu),x=F(_.lat,-Tu,Tu),b=_u(e.center.lng),w=gu(g),k=b-_u(_.lng),T=w-gu(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,fl(y,y,[n[4]*r,n[5]*r,n[6]*r],-Math.sin(P(T>=0?o.getSouth():o.getNorth()))*Ol));var S=s[E],M=s[(E+1)%4],A=new ql(S,M,y),I=[Wl(A,0)||S[0],Wl(A,1)||S[1],Wl(A,2)||S[2]],C=lu(e.zoom);if(C>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),D=0;D<s.length;D++)Hl(s[D],z[D],C);var L=ol([],z[E],z[(E+1)%4]);hl(L,L,.5),Hl(I,L,C)}var R,B=f(s);try{for(B.s();!(R=B.n()).done;){var O=R.value;ul(c,c,O),cl(u,u,O)}}catch(U){B.e(U)}finally{B.f()}return c[2]=Math.min(S[2],M[2]),ul(c,c,I),cl(u,u,I),new Bl(c,u)}function $l(e){var t=e.x,i=e.y,r=1/(1<<e.z),n=new mu(bu(t*r),wu((i+1)*r)),a=new mu(bu((t+1)*r),wu(i*r));return new Ns(n,a)}function Ql(e){var t=P(e.getNorth()),i=P(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[eu(n,o,s),eu(n,o,l),eu(r,a,l),eu(r,a,s)]}function eu(e,t,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Ol;return i=P(i),[e*Math.sin(i)*r,-t*r,e*Math.cos(i)*r]}function tu(e,t,i){return eu(Math.cos(P(e)),Math.sin(P(e)),t,i)}function iu(e,t,i,r){var n=1<<i.z,a=(e/Vs+i.x)/n;return tu(wu((t/Vs+i.y)/n),bu(a),r)}function ru(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 nu=new Float64Array(16);function au(e){var t,i,r=ru(e),n=Qs(nu,[r,r,r]);return Ys(n,n,((t=[])[0]=-(i=e.min)[0],t[1]=-i[1],t[2]=-i[2],t))}function ou(e){var t,i,r=(i=e.min,(t=nu)[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/ru(e);return Ks(r,r,[n,n,n])}function su(e,t,i,r,n){var a=function(e){var t=Vs/(2*Math.PI);return e/(2*Math.PI)/t}(i),o=[e,t,-i/(2*Math.PI)],s=Ws(new Float64Array(16));return Ys(s,s,o),Ks(s,s,[a,a,a]),Js(s,s,P(-n)),$s(s,s,P(-r)),s}function lu(e){return U(5,6,e)}function uu(e,t){var i,r,n,a,o,s,l,u,c,h,f=tu(t.lat,t.lng),d=function(e){var t=tu(e._center.lat,e._center.lng),i=vl([],al(0,1,0),t),r=el([],-e.angle,t);i=ml(i,i,r),el(r,-e._pitch,i);var n=dl([],t);return hl(n,n,Gl(e.cameraToCenterDistance/e.pixelsPerMeter)),ml(n,n,r),ol([],t,n)}(e);return n=(i=sl([],d,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))&&pl(i,r)/c,Math.acos(Math.min(Math.max(h,-1),1))}function cu(e,t){return uu(e,t)>Math.PI/2*1.01}var hu=P(85),fu=Math.cos(hu),du=Math.sin(hu),pu=6371008.8,vu=2*Math.PI*pu,mu=function(){function e(t,i){if(d(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 p(e,[{key:"wrap",value:function(){return new e(V(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 pu*Math.acos(Math.min(n,1))}},{key:"toBounds",value:function(){var t=360*(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)/40075017,i=t/Math.cos(Math.PI/180*this.lat);return new Ns(new e(this.lng-i,this.lat-t),new e(this.lng+i,this.lat+t))}},{key:"toEcef",value:function(e){var t=Gl(e);return tu(this.lat,this.lng,Ol+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 yu(e){return vu*Math.cos(e*Math.PI/180)}function _u(e){return(180+e)/360}function gu(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function xu(e,t){return e/yu(t)}function bu(e){return 360*e-180}function wu(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function ku(e,t){return e*yu(wu(t))}var Tu=85.051129;function Eu(e){return 1/Math.cos(e*Math.PI/180)}var Su=function(){function e(t,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;d(this,e),this.x=+t,this.y=+i,this.z=+r}return p(e,[{key:"toLngLat",value:function(){return new mu(bu(this.x),wu(this.y))}},{key:"toAltitude",value:function(){return ku(this.z,this.y)}},{key:"meterInMercatorCoordinateUnits",value:function(){return 1/vu*Eu(wu(this.y))}}],[{key:"fromLngLat",value:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=mu.convert(t);return new e(_u(r.lng),gu(r.lat),xu(i,r.lat))}}]),e}();function Mu(e,t,i,r,n,a,o,s,l){var u=(t+r)/2,c=(i+n)/2,h=new A(u,c);s(h),function(e,t,i,r,n,a){var o=i-n,s=r-a;return Math.abs((r-t)*o-(i-e)*s)/Math.hypot(o,s)}(h.x,h.y,a.x,a.y,o.x,o.y)>=l?(Mu(e,t,i,u,c,a,h,s,l),Mu(e,u,c,r,n,h,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),Mu(o,n,a,u,c,r,l,t,i),n=u,a=c,r=l}return o}function Iu(e,t,i,r){if(r(t,i)){var n=t.add(i)._mult(.5);Iu(e,t,n,r),Iu(e,n,i,r)}else e.push(i)}function Cu(e,t){for(var i=e[0],r=[i],n=1;n<e.length;n++){var a=e[n];Iu(r,i,a,t),i=a}return r}var zu=Math.pow(2,14)-1,Pu=-zu-1;function Du(e,t){var i=Math.round(e.x*t),r=Math.round(e.y*t);return e.x=F(i,Pu,zu),e.y=F(r,Pu,zu),(i<e.x||i>e.x+1||r<e.y||r>e.y+1)&&te("Geometry exceeds allowed extent, reduce your vector tile buffer size"),e}function Lu(e,t,i){var r=e.loadGeometry(),n=e.extent,a=Vs/n;if(t&&i&&i.projection.isReprojectedInTileSpace)for(var o=1<<t.z,s=i.scale,l=i.x,u=i.y,c=i.projection,h=function(e){var i=bu((t.x+e.x/n)/o),r=wu((t.y+e.y/n)/o),a=c.project(i,r);e.x=(a.x*s-l)*n,e.y=(a.y*s-u)*n},d=0;d<r.length;d++)if(1!==e.type)r[d]=Au(r[d],h,1);else{var p,v=[],m=f(r[d]);try{for(m.s();!(p=m.n()).done;){var y=p.value;y.x<0||y.x>=n||y.y<0||y.y>=n||(h(y),v.push(y))}}catch(k){m.e(k)}finally{m.f()}r[d]=v}var _,g=f(r);try{for(g.s();!(_=g.n()).done;){var x,b=_.value,w=f(b);try{for(w.s();!(x=w.n()).done;)Du(x.value,a)}catch(k){w.e(k)}finally{w.f()}}}catch(k){g.e(k)}finally{g.f()}return r}function Ru(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?Lu(e):[]}}function Bu(e,t,i,r,n){e.emplaceBack(2*t+(r+1)/2,2*i+(n+1)/2)}function Ou(e,t,i){var r=16384;e.emplaceBack(t.x,t.y,t.z,i[0]*r,i[1]*r,i[2]*r)}var Fu=function(){function e(t){d(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 bo,this.indexArray=new Oo,this.segments=new Us,this.programConfigurations=new Is(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((function(e){return e.isStateDependent()})).map((function(e){return e.id}))}return p(e,[{key:"populate",value:function(e,t,i,r){var n=this.layers[0],a=[],o=null;"circle"===n.type&&(o=n.layout.get("circle-sort-key"));var s,l=f(e);try{for(l.s();!(s=l.n()).done;){var u=s.value,c=u.feature,h=u.id,d=u.index,p=u.sourceLayerIndex,v=this.layers[0]._featureFilter.needGeometry,m=Ru(c,v);if(this.layers[0]._featureFilter.filter(new to(this.zoom),m,i)){var y=o?o.evaluate(m,{},i):void 0,_={id:h,properties:c.properties,type:c.type,sourceLayerIndex:p,index:d,geometry:v?m.geometry:Lu(c,i,r),patterns:{},sortKey:y};a.push(_)}}}catch(M){l.e(M)}finally{l.f()}o&&a.sort((function(e,t){return e.sortKey-t.sortKey}));var g=null;"globe"===r.projection.name&&(this.globeExtVertexArray=new Ao,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,S=e[T].feature;this.addFeature(w,k,T,t.availableImages,i,g),t.featureIndex.insert(S,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,Os.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Fs.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=f(t);try{for(s.s();!(o=s.n()).done;){var l,u=o.value,c=f(u);try{for(c.s();!(l=c.n()).done;){var h=l.value,d=h.x,p=h.y;if(!(d<0||d>=Vs||p<0||p>=Vs)){if(a){var v=a.projectTilePoint(d,p,n),m=a.upVector(n,d,p),y=this.globeExtVertexArray;Ou(y,v,m),Ou(y,v,m),Ou(y,v,m),Ou(y,v,m)}var _=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),g=_.vertexLength;Bu(this.layoutVertexArray,d,p,-1,-1),Bu(this.layoutVertexArray,d,p,1,-1),Bu(this.layoutVertexArray,d,p,1,1),Bu(this.layoutVertexArray,d,p,-1,1),this.indexArray.emplaceBack(g,g+1,g+2),this.indexArray.emplaceBack(g,g+2,g+3),_.vertexLength+=4,_.primitiveLength+=2}}}catch(x){c.e(x)}finally{c.f()}}}catch(x){s.e(x)}finally{s.f()}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{},r,n)}}]),e}();function Uu(e,t){for(var i=0;i<e.length;i++)if(Hu(t,e[i]))return!0;for(var r=0;r<t.length;r++)if(Hu(e,t[r]))return!0;return!!Gu(e,t)}function Vu(e,t,i){return!!Hu(e,t)||!!qu(t,e,i)}function Nu(e,t){if(1===e.length)return Xu(t,e[0]);for(var i=0;i<t.length;i++)for(var r=t[i],n=0;n<r.length;n++)if(Hu(e,r[n]))return!0;for(var a=0;a<e.length;a++)if(Xu(t,e[a]))return!0;for(var o=0;o<t.length;o++)if(Gu(e,t[o]))return!0;return!1}function ju(e,t,i){if(e.length>1){if(Gu(e,t))return!0;for(var r=0;r<t.length;r++)if(qu(t[r],e,i))return!0}for(var n=0;n<e.length;n++)if(qu(e[n],t,i))return!0;return!1}function Gu(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(Zu(r,n,t[a],t[a+1]))return!0;return!1}function Zu(e,t,i,r){return ie(e,i,r)!==ie(t,i,r)&&ie(e,t,i)!==ie(e,t,r)}function qu(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(Wu(e,t[n-1],t[n])<r)return!0;return!1}function Wu(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 Xu(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 Hu(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 Yu(e,t,i,r,n){var a,o=f(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()}var l=[new A(t,i),new A(t,n),new A(r,n),new A(r,i)];if(e.length>2){var u,c=f(l);try{for(c.s();!(u=c.n()).done;)if(Hu(e,u.value))return!0}catch(d){c.e(d)}finally{c.f()}}for(var h=0;h<e.length-1;h++)if(Ku(e[h],e[h+1],l))return!0;return!1}function Ku(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=ie(e,t,i[0]);return a!==ie(e,t,i[1])||a!==ie(e,t,i[2])||a!==ie(e,t,i[3])}function Ju(e,t,i){var r=t.paint.get(e).value;return"constant"===r.kind?r.value:i.programConfigurations.get(t.id).getMaxValue(e)}function $u(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function Qu(e,t,i,r,n){if(!t[0]&&!t[1])return e;var a=A.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 ec(e,t,i,r){var n=A.convert(e)._mult(r);return"viewport"===t&&n._rotate(-i),n}ia(Fu,"CircleBucket",{omit:["layers"]});var tc=new po({"circle-sort-key":new ho(ct.layout_circle["circle-sort-key"])}),ic={paint:new po({"circle-radius":new ho(ct.paint_circle["circle-radius"]),"circle-color":new ho(ct.paint_circle["circle-color"]),"circle-blur":new ho(ct.paint_circle["circle-blur"]),"circle-opacity":new ho(ct.paint_circle["circle-opacity"]),"circle-translate":new co(ct.paint_circle["circle-translate"]),"circle-translate-anchor":new co(ct.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new co(ct.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new co(ct.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new ho(ct.paint_circle["circle-stroke-width"]),"circle-stroke-color":new ho(ct.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new ho(ct.paint_circle["circle-stroke-opacity"])}),layout:tc};function rc(e,t,i,r,n,a,o,s,l){if(a&&e.queryGeometry.isAboveHorizon)return!1;a&&(l*=e.pixelToTileUnitsFactor);var u,c=e.tileID.canonical,h=i.projection.upVectorScale(c,i.center.lat,i.worldSize).metersToTile,d=f(t);try{for(d.s();!(u=d.n()).done;){var p,v=u.value,m=f(v);try{var y=function(){var t=p.value,u=t.add(s),f=n&&i.elevation?i.elevation.exaggeration()*n.getElevationAt(u.x,u.y,!0):0,d=i.projection.projectTilePoint(u.x,u.y,c);if(f>0){var v=i.projection.upVector(c,u.x,u.y);d.x+=v[0]*h*f,d.y+=v[1]*h*f,d.z+=v[2]*h*f}var m=a?u:nc(d.x,d.y,d.z,r),y=a?e.tilespaceRays.map((function(e){return sc(e,f)})):e.queryGeometry.screenGeometry,_=Tl([],[d.x,d.y,d.z,1],r);if(!o&&a?l*=_[3]/i.cameraToCenterDistance:o&&!a&&(l*=i.cameraToCenterDistance/_[3]),a){var g=wu((t.y/Vs+c.y)/(1<<c.z));l/=i.projection.pixelsPerMeter(g,1)/xu(1,g)}if(Vu(y,m,l))return{v:!0}};for(m.s();!(p=m.n()).done;){var _=y();if("object"===typeof _)return _.v}}catch(g){m.e(g)}finally{m.f()}}}catch(g){d.e(g)}finally{d.f()}return!1}function nc(e,t,i,r){var n=Tl([],[e,t,i,1],r);return new A(n[0]/n[3],n[1]/n[3])}var ac=al(0,0,0),oc=al(0,0,1);function sc(e,t){var i=il();return ac[2]=t,e.intersectsPlane(ac,oc,i),new A(i[0],i[1])}var lc=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i)}(Fu);function uc(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 cc(e,t,i){var r=t.width,n=t.height;r===e.width&&n===e.height||(hc(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 hc(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}ia(lc,"HeatmapBucket",{omit:["layers"]});var fc=function(){function e(t,i){d(this,e),uc(this,t,1,i)}return p(e,[{key:"resize",value:function(t){cc(this,new e(t),1)}},{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){hc(e,t,i,r,n,1)}}]),e}(),dc=function(){function e(t,i){d(this,e),uc(this,t,4,i)}return p(e,[{key:"resize",value:function(t){cc(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){hc(e,t,i,r,n,4)}}]),e}();ia(fc,"AlphaImage"),ia(dc,"RGBAImage");var pc={paint:new po({"heatmap-radius":new ho(ct.paint_heatmap["heatmap-radius"]),"heatmap-weight":new ho(ct.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new co(ct.paint_heatmap["heatmap-intensity"]),"heatmap-color":new fo(ct.paint_heatmap["heatmap-color"]),"heatmap-opacity":new co(ct.paint_heatmap["heatmap-opacity"])})};function vc(e){var t={},i=e.resolution||256,r=e.clips?e.clips.length:1,n=e.image||new dc({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 mc={paint:new po({"hillshade-illumination-direction":new co(ct.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new co(ct.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new co(ct.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new co(ct.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new co(ct.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new co(ct.paint_hillshade["hillshade-accent-color"])})},yc=go([{name:"a_pos",components:2,type:"Int16"}],4).members,_c={};function gc(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=xc(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=xc(e,t[n]*r,n<a-1?t[n+1]*r:e.length,r,!1))===o.next&&(o.steiner=!0),s.push(zc(o));for(s.sort(Mc),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 wc(f,d,i,r,n,u,0),d}function xc(e,t,i,r,n){var a,o;if(n===Zc(e,t,i,r)>0)for(a=t;a<i;a+=r)o=Nc(a,e[a],e[a+1],o);else for(a=i-r;a>=t;a-=r)o=Nc(a,e[a],e[a+1],o);return o&&Rc(o,o.next)&&(jc(o),o=o.next),o}function bc(e,t){if(!e)return e;t||(t=e);var i,r=e;do{if(i=!1,r.steiner||!Rc(r,r.next)&&0!==Lc(r.prev,r,r.next))r=r.next;else{if(jc(r),(r=t=r.prev)===r.next)break;i=!0}}while(i||r!==t);return t}function wc(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=Cc(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):kc(e))t.push(s.i/i|0),t.push(e.i/i|0),t.push(l.i/i|0),jc(e),e=l.next,u=l.next;else if((e=l)===u){o?1===o?wc(e=Ec(bc(e),t,i),t,i,r,n,a,2):2===o&&Sc(e,t,i,r,n,a):wc(bc(e),t,i,r,n,a,1);break}}}function kc(e){var t=e.prev,i=e,r=e.next;if(Lc(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&&Pc(n,s,a,l,o,u,p.x,p.y)&&Lc(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(Lc(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,v=s>l?s>u?s:u:l>u?l:u,m=c>h?c>f?c:f:h>f?h:f,y=Cc(d,p,t,i,r),_=Cc(v,m,t,i,r),g=e.prevZ,x=e.nextZ;g&&g.z>=y&&x&&x.z<=_;){if(g.x>=d&&g.x<=v&&g.y>=p&&g.y<=m&&g!==n&&g!==o&&Pc(s,c,l,h,u,f,g.x,g.y)&&Lc(g.prev,g,g.next)>=0)return!1;if(g=g.prevZ,x.x>=d&&x.x<=v&&x.y>=p&&x.y<=m&&x!==n&&x!==o&&Pc(s,c,l,h,u,f,x.x,x.y)&&Lc(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;g&&g.z>=y;){if(g.x>=d&&g.x<=v&&g.y>=p&&g.y<=m&&g!==n&&g!==o&&Pc(s,c,l,h,u,f,g.x,g.y)&&Lc(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;x&&x.z<=_;){if(x.x>=d&&x.x<=v&&x.y>=p&&x.y<=m&&x!==n&&x!==o&&Pc(s,c,l,h,u,f,x.x,x.y)&&Lc(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function Ec(e,t,i){var r=e;do{var n=r.prev,a=r.next.next;!Rc(n,a)&&Bc(n,r,r.next,a)&&Uc(n,a)&&Uc(a,n)&&(t.push(n.i/i|0),t.push(r.i/i|0),t.push(a.i/i|0),jc(r),jc(r.next),r=e=a),r=r.next}while(r!==e);return bc(r)}function Sc(e,t,i,r,n,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Dc(o,s)){var l=Vc(o,s);return o=bc(o,o.next),l=bc(l,l.next),wc(o,t,i,r,n,a,0),void wc(l,t,i,r,n,a,0)}s=s.next}o=o.next}while(o!==e)}function Mc(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&&Pc(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),Uc(r,e)&&(l<f||l===f&&(r.x>i.x||r.x===i.x&&Ic(i,r)))&&(i=r,f=l)),r=r.next}while(r!==u);return i}(e,t);if(!i)return t;var r=Vc(i,e);return bc(r,r.next),bc(i,i.next)}function Ic(e,t){return Lc(e.prev,e,t.prev)<0&&Lc(t.next,e,e.next)<0}function Cc(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 zc(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 Pc(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 Dc(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&&Bc(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&(Uc(e,t)&&Uc(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)&&(Lc(e.prev,e,t.prev)||Lc(e,t.prev,t))||Rc(e,t)&&Lc(e.prev,e,e.next)>0&&Lc(t.prev,t,t.next)>0)}function Lc(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function Rc(e,t){return e.x===t.x&&e.y===t.y}function Bc(e,t,i,r){var n=Fc(Lc(e,t,i)),a=Fc(Lc(e,t,r)),o=Fc(Lc(i,r,e)),s=Fc(Lc(i,r,t));return n!==a&&o!==s||!(0!==n||!Oc(e,i,t))||!(0!==a||!Oc(e,r,t))||!(0!==o||!Oc(i,e,r))||!(0!==s||!Oc(i,t,r))}function Oc(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 Fc(e){return e>0?1:e<0?-1:0}function Uc(e,t){return Lc(e.prev,e,e.next)<0?Lc(e,t,e.next)>=0&&Lc(e,e.prev,t)>=0:Lc(e,t,e.prev)<0||Lc(e,e.next,t)<0}function Vc(e,t){var i=new Gc(e.i,e.x,e.y),r=new Gc(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 Nc(e,t,i,r){var n=new Gc(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 jc(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 Gc(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 Zc(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 qc(e,t,i,r,n){Wc(e,t,i||0,r||e.length-1,n||Hc)}function Wc(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);Wc(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(Xc(e,i,t),n(e[r],c)>0&&Xc(e,i,r);h<f;){for(Xc(e,h,f),h++,f--;n(e[h],c)<0;)h++;for(;n(e[f],c)>0;)f--}0===n(e[i],c)?Xc(e,i,f):Xc(e,++f,r),f<=t&&(i=f+1),t<=f&&(r=f-1)}}function Xc(e,t,i){var r=e[t];e[t]=e[i],e[i]=r}function Hc(e,t){return e<t?-1:e>t?1:0}function Yc(e,t){var i=e.length;if(i<=1)return[e];for(var r,n,a=[],o=0;o<i;o++){var s=re(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||(qc(a[l],t,1,a[l].length-1,Kc),a[l]=a[l].slice(0,t));return a}function Kc(e,t){return t.area-e.area}function Jc(e,t,i){var r,n=i.patternDependencies,a=!1,o=f(t);try{for(o.s();!(r=o.n()).done;){var s=r.value.paint.get("".concat(e,"-pattern"));s.isConstant()||(a=!0);var l=s.constantOr(null);l&&(a=!0,n[l]=!0)}}catch(u){o.e(u)}finally{o.f()}return a}function $c(e,t,i,r,n){var a,o=n.patternDependencies,s=f(t);try{for(s.s();!(a=s.n()).done;){var l=a.value,u=l.paint.get("".concat(e,"-pattern")).value;if("constant"!==u.kind){var c=u.evaluate({zoom:r},i,{},n.availableImages);o[c=c&&c.name?c.name:c]=!0,i.patterns[l.id]=c}}}catch(h){s.e(h)}finally{s.f()}return i}({get exports(){return _c},set exports(e){_c=e}}).exports=gc,_c.default=gc,gc.deviation=function(e,t,i,r){var n=t&&t.length,a=Math.abs(Zc(e,0,n?t[0]*i:e.length,i));if(n)for(var o=0,s=t.length;o<s;o++)a-=Math.abs(Zc(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)},gc.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 Qc=function(){function e(t){d(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 bo,this.indexArray=new Oo,this.indexArray2=new Go,this.programConfigurations=new Is(t.layers,t.zoom),this.segments=new Us,this.segments2=new Us,this.stateDependentLayerIds=this.layers.filter((function(e){return e.isStateDependent()})).map((function(e){return e.id})),this.projection=t.projection}return p(e,[{key:"populate",value:function(e,t,i,r){this.hasPattern=Jc("fill",this.layers,t);var n,a=this.layers[0].layout.get("fill-sort-key"),o=[],s=f(e);try{for(s.s();!(n=s.n()).done;){var l=n.value,u=l.feature,c=l.id,h=l.index,d=l.sourceLayerIndex,p=this.layers[0]._featureFilter.needGeometry,v=Ru(u,p);if(this.layers[0]._featureFilter.filter(new to(this.zoom),v,i)){var m=a?a.evaluate(v,{},i,t.availableImages):void 0,y={id:c,properties:u.properties,type:u.type,sourceLayerIndex:d,index:h,geometry:p?v.geometry:Lu(u,i,r),patterns:{},sortKey:m};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=$c("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=f(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(l){o.e(l)}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,yc),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=f(Yc(t,500));try{for(s.s();!(a=s.n()).done;){var l,u=a.value,c=0,h=f(u);try{for(h.s();!(l=h.n()).done;)c+=l.value.length}catch(E){h.e(E)}finally{h.f()}var d,p=this.segments.prepareSegment(c,this.layoutVertexArray,this.indexArray),v=p.vertexLength,m=[],y=[],_=f(u);try{for(_.s();!(d=_.n()).done;){var g=d.value;if(0!==g.length){g!==u[0]&&y.push(m.length/2);var x=this.segments2.prepareSegment(g.length,this.layoutVertexArray,this.indexArray2),b=x.vertexLength;this.layoutVertexArray.emplaceBack(g[0].x,g[0].y),this.indexArray2.emplaceBack(b+g.length-1,b),m.push(g[0].x),m.push(g[0].y);for(var w=1;w<g.length;w++)this.layoutVertexArray.emplaceBack(g[w].x,g[w].y),this.indexArray2.emplaceBack(b+w-1,b+w),m.push(g[w].x),m.push(g[w].y);x.vertexLength+=g.length,x.primitiveLength+=g.length}}}catch(E){_.e(E)}finally{_.f()}for(var k=_c(m,y),T=0;T<k.length;T+=3)this.indexArray.emplaceBack(v+k[T],v+k[T+1],v+k[T+2]);p.vertexLength+=c,p.primitiveLength+=k.length/3}}catch(E){s.e(E)}finally{s.f()}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,n,o,r)}}]),e}();ia(Qc,"FillBucket",{omit:["layers","patternFeatures"]});var eh=new po({"fill-sort-key":new ho(ct.layout_fill["fill-sort-key"])}),th={paint:new po({"fill-antialias":new co(ct.paint_fill["fill-antialias"]),"fill-opacity":new ho(ct.paint_fill["fill-opacity"]),"fill-color":new ho(ct.paint_fill["fill-color"]),"fill-outline-color":new ho(ct.paint_fill["fill-outline-color"]),"fill-translate":new co(ct.paint_fill["fill-translate"]),"fill-translate-anchor":new co(ct.paint_fill["fill-translate-anchor"]),"fill-pattern":new ho(ct.paint_fill["fill-pattern"])}),layout:eh},ih=go([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),rh=go([{name:"a_centroid_pos",components:2,type:"Uint16"}]),nh=go([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),ah=ih.members,oh={},sh=A,lh=uh;function uh(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(ch,this,t)}function ch(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 hh(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}uh.types=["Unknown","Point","LineString","Polygon"],uh.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 sh(a,o));else{if(7!==r)throw new Error("unknown command "+r);t&&t.push(t[0].clone())}}return t&&s.push(t),s},uh.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>s&&(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]},uh.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=uh.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=hh(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 fh=lh,dh=ph;function ph(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(vh,this,t),this.length=this._features.length}function vh(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))}ph.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 fh(this._pbf,t,this.extent,this._keys,this._values)};var mh=dh;function yh(e,t,i){if(3===e){var r=new mh(i,i.readVarint()+i.pos);r.length&&(t[r.name]=r)}}var _h=oh.VectorTile=function(e,t){this.layers=e.readFields(yh,{},t)},gh=oh.VectorTileFeature=lh;function xh(e,t,i,r){var n,a=[],o=0===r?function(e,t,i,r,n,a){e.push(new A(a,i+(a-t)/(r-t)*(n-i)))}:function(e,t,i,r,n,a){e.push(new A(t+(a-i)/(n-i)*(r-t),a))},s=f(e);try{for(s.s();!(n=s.n()).done;){var l,u=n.value,c=[],h=f(u);try{for(h.s();!(l=h.n()).done;){var d=l.value;if(!(d.length<=2)){for(var p=[],v=0;v<d.length-1;v++){var m=d[v].x,y=d[v].y,_=d[v+1].x,g=d[v+1].y,x=0===r?m:y,b=0===r?_:g;x<t?b>t&&o(p,m,y,_,g,t):x>i?b<i&&o(p,m,y,_,g,i):p.push(d[v]),b<t&&x>=t&&o(p,m,y,_,g,t),b>i&&x<=i&&o(p,m,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]),c.push(p))}}}catch(T){h.e(T)}finally{h.f()}c.length&&a.push(c)}}catch(T){s.e(T)}finally{s.f()}return a}oh.VectorTileLayer=dh;var bh=gh.types,wh=Math.pow(2,13);function kh(e,t,i,r,n,a,o,s){e.emplaceBack((t<<1)+o,(i<<1)+a,(Math.floor(r*wh)<<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 Eh=function(){function e(){d(this,e),this.acc=new A(0,0),this.polyCount=[]}return p(e,[{key:"startRing",value:function(e){this.currentPolyCount={edges:0,top:0},this.polyCount.push(this.currentPolyCount),this.min||(this.min=new A(e.x,e.y),this.max=new A(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===Vs)&&e.x===t.x)!=((0===e.y||e.y===Vs)&&e.y===t.y)&&this.processBorderOverlap(e,t),t.x<0!=e.x<0&&this.addBorderIntersection(0,Ni(t.y,e.y,(0-t.x)/(e.x-t.x))),t.x>Vs!=e.x>Vs&&this.addBorderIntersection(1,Ni(t.y,e.y,(Vs-t.x)/(e.x-t.x))),t.y<0!=e.y<0&&this.addBorderIntersection(2,Ni(t.x,e.x,(0-t.y)/(e.y-t.y))),t.y>Vs!=e.y>Vs&&this.addBorderIntersection(3,Ni(t.x,e.x,(Vs-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 A(0,0)}},{key:"span",value:function(){return new A(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}(),Sh=function(){function e(t){d(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 ko,this.centroidVertexArray=new is,this.indexArray=new Oo,this.programConfigurations=new Is(t.layers,t.zoom),this.segments=new Us,this.stateDependentLayerIds=this.layers.filter((function(e){return e.isStateDependent()})).map((function(e){return e.id})),this.enableTerrain=t.enableTerrain}return p(e,[{key:"populate",value:function(e,t,i,r){this.features=[],this.hasPattern=Jc("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)/Vs/(1<<e.z)}(i),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter;var n,a=f(e);try{for(a.s();!(n=a.n()).done;){var o=n.value,s=o.feature,l=o.id,u=o.index,c=o.sourceLayerIndex,h=this.layers[0]._featureFilter.needGeometry,d=Ru(s,h);if(this.layers[0]._featureFilter.filter(new to(this.zoom),d,i)){var p={id:l,sourceLayerIndex:c,index:u,geometry:h?d.geometry:Lu(s,i,r),properties:s.properties,type:s.type,patterns:{}},v=this.layoutVertexArray.length;this.hasPattern?this.features.push($c("fill-extrusion",this.layers,p,this.zoom,t)):this.addFeature(p,p.geometry,u,i,{},t.availableImages,r),t.featureIndex.insert(s,p.geometry,u,c,this.index,v)}}}catch(m){a.e(m)}finally{a.f()}this.sortBorders()}},{key:"addFeatures",value:function(e,t,i,r,n){var a,o=f(this.features);try{for(o.s();!(a=o.n()).done;){var s=a.value,l=s.geometry;this.addFeature(s,l,s.index,t,i,r,n)}}catch(u){o.e(u)}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,ah),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,nh.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,rh.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 A(0,0),new A(Vs,Vs)],l=o.projection,u="globe"===l.name,c=this.enableTerrain&&!u?new Eh:null,h="Polygon"===bh[e.type];u&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new Ao);for(var d,p,v=Yc(t,500),m=v.length-1;m>=0;m--){var y=v[m];(0===y.length||(d=y[0]).every((function(e){return e.x<=0}))||d.every((function(e){return e.x>=Vs}))||d.every((function(e){return e.y<=0}))||d.every((function(e){return e.y>=Vs})))&&v.splice(m,1)}if(u)p=Lh(v,s,r);else{p=[];var _,g=f(v);try{for(g.s();!(_=g.n()).done;){var x=_.value;p.push({polygon:x,bounds:s})}}catch(Ce){g.e(Ce)}finally{g.f()}}var b,w=h?this.edgeRadius:0,k=f(p);try{for(k.s();!(b=k.n()).done;){var T,E=b.value,S=E.polygon,M=E.bounds,I=0,C=0,z=f(S);try{for(z.s();!(T=z.n()).done;){var P=T.value;h&&!P[0].equals(P[P.length-1])&&P.push(P[0]),C+=h?P.length-1:P.length}}catch(Ce){z.e(Ce)}finally{z.f()}var D=this.segments.prepareSegment((h?5:4)*C,this.layoutVertexArray,this.indexArray);if(h){var L=[],R=[];I=D.vertexLength;var B,O=f(S);try{for(O.s();!(B=O.n()).done;){var F=B.value,U=void 0,V=void 0;F.length&&F!==S[0]&&R.push(L.length/2),U=F[1].sub(F[0])._perp()._unit();for(var N=1;N<F.length;N++){var j=F[N],G=F[N===F.length-1?1:N+1],Z=j.x,q=j.y;if(w){V=G.sub(j)._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}kh(this.layoutVertexArray,Z,q,0,0,1,1,0),D.vertexLength++,L.push(j.x,j.y),u&&Th(this.layoutVertexExtArray,l.projectTilePoint(Z,q,r),l.upVector(r,Z,q))}}}catch(Ce){O.e(Ce)}finally{O.f()}for(var H=_c(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=f(S);try{for(J.s();!(K=J.n()).done;){var $=K.value;c&&$.length&&c.startRing($[0]);var Q=void 0,ee=void 0,te=void 0,ie=$.length>4&&zh($[$.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(c&&h&&c.currentPolyCount.top++,Ch(le,se,M))w&&(ee=ue.sub(le)._perp()._unit(),ne=!ne);else{c&&c.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=Ih(se,le,ue,Mh(ee,te),w);isNaN(pe)&&(pe=0);var ve=le.sub(se)._unit();se=se.add(ve.mult(re))._round(),le=le.add(ve.mult(-pe))._round(),re=pe,ee=te}var me=D.vertexLength,ye=$.length>4&&zh(se,le,ue),_e=Ph(oe,ie,ne);if(kh(this.layoutVertexArray,se.x,se.y,he,fe,0,0,_e),kh(this.layoutVertexArray,se.x,se.y,he,fe,0,1,_e),_e=Ph(oe+=de,ye,!ne),ie=ye,kh(this.layoutVertexArray,le.x,le.y,he,fe,0,0,_e),kh(this.layoutVertexArray,le.x,le.y,he,fe,0,1,_e),D.vertexLength+=4,this.indexArray.emplaceBack(me+0,me+1,me+2),this.indexArray.emplaceBack(me+1,me+3,me+2),D.primitiveLength+=2,w){var ge=I+(1===ae?$.length-2:ae-2),xe=1===ae?I:ge+1;if(this.indexArray.emplaceBack(me+1,ge,me+3),this.indexArray.emplaceBack(ge,xe,me+3),D.primitiveLength+=2,void 0===Q&&(Q=me),!Ch(ue,$[ae],M)){var be=ae===$.length-1?Q:D.vertexLength;this.indexArray.emplaceBack(me+2,me+3,be),this.indexArray.emplaceBack(me+3,be+1,be),this.indexArray.emplaceBack(me+3,xe,be+1),D.primitiveLength+=3}ne=!ne}if(u){var we=this.layoutVertexExtArray,ke=l.projectTilePoint(se.x,se.y,r),Te=l.projectTilePoint(le.x,le.y,r),Ee=l.upVector(r,se.x,se.y),Se=l.upVector(r,le.x,le.y);Th(we,ke,Ee),Th(we,ke,Ee),Th(we,Te,Se),Th(we,Te,Se)}}}h&&(I+=$.length-1)}}catch(Ce){J.e(Ce)}finally{J.f()}}}catch(Ce){k.e(Ce)}finally{k.f()}if(c&&c.polyCount.length>0){if(c.borders){c.vertexArrayOffset=this.centroidVertexArray.length;for(var Me=c.borders,Ae=this.featuresOnBorder.push(c)-1,Ie=0;Ie<4;Ie++)Me[Ie][0]!==Number.MAX_VALUE&&this.borders[Ie].push(Ae)}this.encodeCentroid(c.borders?void 0:c.centroid(),c)}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,l=f(t.polyCount);try{for(l.s();!(o=l.n()).done;){var u=o.value;n&&this.centroidVertexArray.resize(this.centroidVertexArray.length+4*u.edges+u.top);for(var c=0;c<u.top;c++)this.centroidVertexArray.emplace(s++,i,r);for(var h=0;h<2*u.edges;h++)this.centroidVertexArray.emplace(s++,0,r),this.centroidVertexArray.emplace(s++,i,r)}}catch(d){l.e(d)}finally{l.f()}}}]),e}();function Mh(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 Ih(e,t,i,Mh(n,a),r)}function Ih(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 Ch(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 zh(e,t,i){if(e.x<0||e.x>=Vs||t.x<0||t.x>=Vs||i.x<0||i.x>=Vs)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 Ph(e,t,i){var r=t?2|e:-3&e;return i?1|r:-2&r}function Dh(){var e=Math.PI/32,t=Math.tan(e),i=pu;return i*Math.sqrt(1+2*t*t)-i}function Lh(e,t,i){var r=1<<i.z,n=bu(i.x/r),a=bu((i.x+1)/r),o=wu(i.y/r),s=wu((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=f(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()}},l=Math.ceil(Math.log2(i)),u=Math.ceil(Math.log2(r)),c=l-u,h=[],d=0;d<Math.abs(c);d++)h.push(c>0?0:1);for(var p=0;p<Math.min(l,u);p++)h.push(0),h.push(1);var v=e;if(v=xh(v,t[0].y-n,t[1].y+n,1),!(v=xh(v,t[0].x-n,t[1].x+n,0)).length)return o;var m=[];for(h.length?m.push({polygons:v,bounds:t,depth:0}):s(v,t);m.length;){var y=m.pop(),_=y.depth,g=h[_],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=xh(y.polygons,w-n,T+n,g),S=xh(y.polygons,T-n,k+n,g);if(E.length){var M=[x,new A(0===g?T:b.x,1===g?T:b.y)];h.length>_+1?m.push({polygons:E,bounds:M,depth:_+1}):s(E,M)}if(S.length){var I=[new A(0===g?T:x.x,1===g?T:x.y),b];h.length>_+1?m.push({polygons:S,bounds:I,depth:_+1}):s(S,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=wu((i.y+t/Vs)/r);return(gu(.5*(wu((i.y+n/Vs)/r)+a))*r-i.y)*Vs}))}ia(Sh,"FillExtrusionBucket",{omit:["layers","features"]}),ia(Eh,"PartMetadata");var Rh=new po({"fill-extrusion-edge-radius":new co(ct["layout_fill-extrusion"]["fill-extrusion-edge-radius"])}),Bh={paint:new po({"fill-extrusion-opacity":new co(ct["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new ho(ct["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new co(ct["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new co(ct["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ho(ct["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new ho(ct["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new ho(ct["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new co(ct["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new co(ct["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new co(ct["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"])}),layout:Rh};function Oh(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 Fh=function(){function e(t,i,r){d(this,e),this.z=t,this.x=i,this.y=r,this.key=Nh(0,t,t,i,r)}return p(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=function(e,t,i){var r=Oh(256*e,256*(t=Math.pow(2,i)-t-1),i),n=Oh(256*(e+1),256*(t+1),i);return r[0]+","+r[1]+","+n[0]+","+n[1]}(this.x,this.y,this.z),r=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}",r).replace("{bbox-epsg-3857}",i)}},{key:"toString",value:function(){return"".concat(this.z,"/").concat(this.x,"/").concat(this.y)}}]),e}(),Uh=p((function e(t,i){d(this,e),this.wrap=t,this.canonical=i,this.key=Nh(t,i.z,i.z,i.x,i.y)})),Vh=function(){function e(t,i,r,n,a){d(this,e),this.overscaledZ=t,this.wrap=i,this.canonical=new Fh(r,+n,+a),this.key=0===i&&t===r?this.canonical.key:Nh(i,t,r,n,a)}return p(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 Nh(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y);var i=this.canonical.z-e;return Nh(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>e.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 Uh(this.wrap,this.canonical)}},{key:"toString",value:function(){return"".concat(this.overscaledZ,"/").concat(this.canonical.x,"/").concat(this.canonical.y)}}]),e}();function Nh(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)}ia(Fh,"CanonicalTileID"),ia(Vh,"OverscaledTileID",{omit:["projMatrix"]});var jh=function(e){v(i,e);var t=m(i);function i(e,r,n){var a;return d(this,i),(a=t.call(this,e,r)).z=n,a}return p(i)}(A);function Gh(e,t){return e.x*t.x+e.y*t.y}function Zh(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),l=a.sub(n),u=o.sub(n),c=Gh(s,s),h=Gh(s,l),d=Gh(l,l),p=Gh(u,s),v=Gh(u,l),m=c*d-h*h,y=(d*p-h*v)/m,_=(c*v-h*p)/m,g=n.z*(1-y-_)+i.z*y+a.z*_;if(isFinite(g))return g}return 1/0}var x,b=1/0,w=f(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 qh(e,t,i,r,n,a,o,s){var l=o*n.getElevationAt(e,t,!0,!0),u=0!==a[0],c=u?0===a[1]?o*(a[0]/7-450):o*function(e,t,i){var r=Math.floor(t[0]/8),n=Math.floor(t[1]/8),a=10*(t[0]-8*r),o=10*(t[1]-8*n),s=e.getElevationAt(r,n,!0,!0),l=e.getMeterToDEM(i),u=Math.floor(.5*(a*l-1)),c=Math.floor(.5*(o*l-1)),h=e.tileCoordToPixel(r,n),f=2*u+1,d=2*c+1,p=function(e,t,i,r,n){return[e.getElevationAtPixel(t,i,!0),e.getElevationAtPixel(t+n,i,!0),e.getElevationAtPixel(t,i+n,!0),e.getElevationAtPixel(t+r,i+n,!0)]}(e,h.x-u,h.y-c,f,d),v=Math.abs(p[0]-p[1]),m=Math.abs(p[2]-p[3]),y=Math.abs(p[0]-p[2])+Math.abs(p[1]-p[3]),_=Math.min(.25,.5*l*(v+m)/f),g=Math.min(.25,.5*l*y/d);return s+Math.max(_*a,g*o)}(n,a,s):l;return{base:l+(0===i)?-1:i,top:u?Math.max(c+r,l+i+2):l+r}}var Wh=go([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4).members,Xh=go([{name:"a_packed",components:4,type:"Float32"}]).members,Hh=gh.types,Yh=Math.cos(Math.PI/180*37.5),Kh=function(){function e(t){var i=this;d(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 To,this.layoutVertexArray2=new Eo,this.indexArray=new Oo,this.programConfigurations=new Is(t.layers,t.zoom),this.segments=new Us,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((function(e){return e.isStateDependent()})).map((function(e){return e.id}))}return p(e,[{key:"populate",value:function(e,t,i,r){this.hasPattern=Jc("line",this.layers,t);var n,a=this.layers[0].layout.get("line-sort-key"),o=[],s=f(e);try{for(s.s();!(n=s.n()).done;){var l=n.value,u=l.feature,c=l.id,h=l.index,d=l.sourceLayerIndex,p=this.layers[0]._featureFilter.needGeometry,v=Ru(u,p);if(this.layers[0]._featureFilter.filter(new to(this.zoom),v,i)){var m=a?a.evaluate(v,{},i):void 0,y={id:c,properties:u.properties,type:u.type,sourceLayerIndex:d,index:h,geometry:p?v.geometry:Lu(u,i,r),patterns:{},sortKey:m};o.push(y)}}}catch(A){s.e(A)}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,S=k.sourceLayerIndex;if(x&&this.addFeatureDashes(k,_),this.hasPattern){var M=$c("line",this.layers,k,this.zoom,t);this.patternFeatures.push(M)}else this.addFeature(k,T,E,i,_.positions,t.availableImages);g.insert(e[E].feature,T,E,S,this.index)}}},{key:"addConstantDashes",value:function(e){var t,i=!1,r=f(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,l=a.value;if(!l)continue;e.addDash(l,s)}}}catch(u){r.e(u)}finally{r.f()}return i}},{key:"addFeatureDashes",value:function(e,t){var i,r=this.zoom,n=f(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 l=void 0,u=void 0;if("constant"===o.kind){if(!(l=o.value))continue}else l=o.evaluate({zoom:r},e);u="constant"===s.kind?s.value:s.evaluate({zoom:r},e),t.addDash(l,u),e.patterns[a.id]=t.getKey(l,u)}}}catch(c){n.e(c)}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=f(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(l){o.e(l)}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,Xh)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Wh),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,{}),l=o.get("line-cap").evaluate(e,{}),u=o.get("line-miter-limit"),c=o.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);var h,d=f(t);try{for(d.s();!(h=d.n()).done;){var p=h.value;this.addLine(p,e,s,l,u,c)}}catch(v){d.e(v)}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.lineSoFar=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"===Hh[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,v=this.overscaling<=16?122880/(512*this.overscaling):0,m=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<Yh&&h&&f,T=d.x*p.y-d.y*p.x>0;if(k&&y>u){var E=c.dist(h);if(E>2*v){var S=c.sub(c.sub(h)._mult(v/E)._round());this.updateDistance(h,S),this.addCurrentVertex(S,d,0,0,m),h=S}}var M=h&&f,A=M?i:s?"butt":r;if(M&&"round"===A&&(b<a?A="miter":b<=2&&(A="fakeround")),"miter"===A&&b>n&&(A="bevel"),"bevel"===A&&(b>2&&(A="flipbevel"),b<n&&(A="miter")),h&&this.updateDistance(h,c),"miter"===A)_._mult(b),this.addCurrentVertex(c,_,0,0,m);else if("flipbevel"===A){if(b>100)_=p.mult(-1);else{var I=b*d.add(p).mag()/d.sub(p).mag();_._perp()._mult(I*(T?-1:1))}this.addCurrentVertex(c,_,0,0,m),this.addCurrentVertex(c,_.mult(-1),0,0,m)}else if("bevel"===A||"fakeround"===A){var C=-Math.sqrt(b*b-1),z=T?C:0,P=T?0:C;if(h&&this.addCurrentVertex(c,d,z,P,m),"fakeround"===A)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,m)}f&&this.addCurrentVertex(c,p,-z,-P,m)}else if("butt"===A)this.addCurrentVertex(c,_,0,0,m);else if("square"===A){var F=h?1:-1;h||this.addCurrentVertex(c,_,F,F,m),this.addCurrentVertex(c,_,0,0,m),h&&this.addCurrentVertex(c,_,F,F,m)}else"round"===A&&(h&&(this.addCurrentVertex(c,d,0,0,m),this.addCurrentVertex(c,d,1,1,m,!0)),f&&(this.addCurrentVertex(c,p,-1,-1,m,!0),this.addCurrentVertex(c,p,0,0,m)));if(k&&y<l-1){var U=c.dist(f);if(U>2*v){var V=c.add(f.sub(c)._mult(v/U)._round());this.updateDistance(c,V),this.addCurrentVertex(V,p,0,0,m),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}();ia(Kh,"LineBucket",{omit:["layers","patternFeatures"]});var Jh=new po({"line-cap":new ho(ct.layout_line["line-cap"]),"line-join":new ho(ct.layout_line["line-join"]),"line-miter-limit":new co(ct.layout_line["line-miter-limit"]),"line-round-limit":new co(ct.layout_line["line-round-limit"]),"line-sort-key":new ho(ct.layout_line["line-sort-key"])}),$h={paint:new po({"line-opacity":new ho(ct.paint_line["line-opacity"]),"line-color":new ho(ct.paint_line["line-color"]),"line-translate":new co(ct.paint_line["line-translate"]),"line-translate-anchor":new co(ct.paint_line["line-translate-anchor"]),"line-width":new ho(ct.paint_line["line-width"]),"line-gap-width":new ho(ct.paint_line["line-gap-width"]),"line-offset":new ho(ct.paint_line["line-offset"]),"line-blur":new ho(ct.paint_line["line-blur"]),"line-dasharray":new ho(ct.paint_line["line-dasharray"]),"line-pattern":new ho(ct.paint_line["line-pattern"]),"line-gradient":new fo(ct.paint_line["line-gradient"]),"line-trim-offset":new co(ct.paint_line["line-trim-offset"])}),layout:Jh},Qh=new(function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"possiblyEvaluate",value:function(e,t){return t=new to(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,transition:t.transition}),o(s(i.prototype),"possiblyEvaluate",this).call(this,e,t)}},{key:"evaluate",value:function(e,t,r,n){return t=G({},t,{zoom:Math.floor(t.zoom)}),o(s(i.prototype),"evaluate",this).call(this,e,t,r,n)}}]),i}(ho))($h.paint.properties["line-width"].specification);function ef(e,t){return t>0?t+2*e:e}Qh.useIntegerZoom=!0;var tf=go([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),rf=go([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),nf=go([{name:"a_projected_pos",components:4,type:"Float32"}],4);go([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);var af=go([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),of=go([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"}]);go([{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 sf=go([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),lf=go([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);go([{name:"triangle",components:3,type:"Uint16"}]),go([{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"}]),go([{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"}]),go([{type:"Float32",name:"offsetX"}]),go([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var uf=24,cf=128;function hf(e,t){var i=t.expression;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new to(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 to(s)),maxSize:i.evaluate(new to(l)),interpolationType:n}}function ff(e,t,i){var r=t.uSize,n=t.uSizeT,a=i.lowerSize,o=i.upperSize;return"source"===e.kind?a/cf:"composite"===e.kind?Ni(a/cf,o/cf,n):r}function df(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?F(lr.interpolationFactor(n,t,a,o),0,1):0;"camera"===e.kind?r=Ni(e.minSize,e.maxSize,s):i=s}return{uSizeT:i,uSize:r}}var pf=Object.freeze({__proto__:null,getSizeData:hf,evaluateSizeForFeature:ff,evaluateSizeForZoom:df,SIZE_PACK_FACTOR:cf});function vf(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()),eo.applyArabicShaping&&(e=eo.applyArabicShaping(e)),e}(e.text,t,i)})),e}var mf={"!":"\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 yf(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 _f(e){return"\ufe35"===e||"\ufe47"===e||"\ufe37"===e||"\ufe43"===e||"\ufe41"===e||"\ufe3d"===e||"\ufe3b"===e||"\ufe39"===e||"\ufe17"===e||"\ufe3f"===e}var gf=wf,xf=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)},bf=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,v=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*v};function wf(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}wf.Varint=0,wf.Fixed64=1,wf.Bytes=2,wf.Fixed32=5;var kf=4294967296,Tf=1/kf,Ef="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function Sf(e){return e.type===wf.Bytes?e.readVarint()+e.pos:e.pos+1}function Mf(e,t,i){return i?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function Af(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 If(e,t){for(var i=0;i<e.length;i++)t.writeVarint(e[i])}function Cf(e,t){for(var i=0;i<e.length;i++)t.writeSVarint(e[i])}function zf(e,t){for(var i=0;i<e.length;i++)t.writeFloat(e[i])}function Pf(e,t){for(var i=0;i<e.length;i++)t.writeDouble(e[i])}function Df(e,t){for(var i=0;i<e.length;i++)t.writeBoolean(e[i])}function Lf(e,t){for(var i=0;i<e.length;i++)t.writeFixed32(e[i])}function Rf(e,t){for(var i=0;i<e.length;i++)t.writeSFixed32(e[i])}function Bf(e,t){for(var i=0;i<e.length;i++)t.writeFixed64(e[i])}function Of(e,t){for(var i=0;i<e.length;i++)t.writeSFixed64(e[i])}function Ff(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+16777216*e[t+3]}function Uf(e,t,i){e[i]=t,e[i+1]=t>>>8,e[i+2]=t>>>16,e[i+3]=t>>>24}function Vf(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function Nf(e,t,i){t.glyphs=[],1===e&&i.readMessage(jf,t)}function jf(e,t,i){if(3===e){var r=i.readMessage(Gf,{}),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 fc({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 Gf(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 Zf(e){var t,i=0,r=0,n=f(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(m){n.e(m)}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}],l=0,u=0,c=f(e);try{for(c.s();!(o=c.n()).done;)for(var h=o.value,d=s.length-1;d>=0;d--){var p=s[d];if(!(h.w>p.w||h.h>p.h)){if(h.x=p.x,h.y=p.y,u=Math.max(u,h.y+h.h),l=Math.max(l,h.x+h.w),h.w===p.w&&h.h===p.h){var v=s.pop();d<s.length&&(s[d]=v)}else h.h===p.h?(p.x+=h.w,p.w-=h.w):h.w===p.w?(p.y+=h.h,p.h-=h.h):(s.push({x:p.x+h.w,y:p.y,w:p.w-h.w,h:h.h}),p.y+=h.h,p.h-=h.h);break}}}catch(m){c.e(m)}finally{c.f()}return{w:l,h:u,fill:i/(l*u)||0}}wf.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=Ff(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=Vf(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=Ff(this.buf,this.pos)+Ff(this.buf,this.pos+4)*kf;return this.pos+=8,e},readSFixed64:function(){var e=Ff(this.buf,this.pos)+Vf(this.buf,this.pos+4)*kf;return this.pos+=8,e},readFloat:function(){var e=xf(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=xf(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)return Mf(e,r,t);if(r|=(127&(n=a[i.pos++]))<<3,n<128)return Mf(e,r,t);if(r|=(127&(n=a[i.pos++]))<<10,n<128)return Mf(e,r,t);if(r|=(127&(n=a[i.pos++]))<<17,n<128)return Mf(e,r,t);if(r|=(127&(n=a[i.pos++]))<<24,n<128)return Mf(e,r,t);if(r|=(1&(n=a[i.pos++]))<<31,n<128)return Mf(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?function(e,t,i){return Ef.decode(e.subarray(t,i))}(this.buf,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;1===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!==wf.Bytes)return e.push(this.readVarint(t));var i=Sf(this);for(e=e||[];this.pos<i;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==wf.Bytes)return e.push(this.readSVarint());var t=Sf(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==wf.Bytes)return e.push(this.readBoolean());var t=Sf(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==wf.Bytes)return e.push(this.readFloat());var t=Sf(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==wf.Bytes)return e.push(this.readDouble());var t=Sf(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==wf.Bytes)return e.push(this.readFixed32());var t=Sf(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==wf.Bytes)return e.push(this.readSFixed32());var t=Sf(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==wf.Bytes)return e.push(this.readFixed64());var t=Sf(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==wf.Bytes)return e.push(this.readSFixed64());var t=Sf(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=7&e;if(t===wf.Varint)for(;this.buf[this.pos++]>127;);else if(t===wf.Bytes)this.pos=this.readVarint()+this.pos;else if(t===wf.Fixed32)this.pos+=4;else{if(t!==wf.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),Uf(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),Uf(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),Uf(this.buf,-1&e,this.pos),Uf(this.buf,Math.floor(e*Tf),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),Uf(this.buf,-1&e,this.pos),Uf(this.buf,Math.floor(e*Tf),this.pos+4),this.pos+=8},writeVarint:function(e){(e=+e||0)>268435455||e<0?function(e,t){var i,r;if(e>=0?(i=e%4294967296|0,r=e/4294967296|0):(r=~(-e/4294967296),4294967295^(i=~(-e%4294967296))?i=i+1|0:(i=0,r=r+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,i){i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,e>>>=7,i.buf[i.pos++]=127&e|128,i.buf[i.pos]=127&(e>>>=7)}(i,0,t),function(e,t){var i=(7&e)<<4;t.buf[t.pos++]|=i|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(r,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))},writeSVarint:function(e){this.writeVarint(e<0?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=function(e,t,i){for(var r,n,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&&Af(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i},writeFloat:function(e){this.realloc(4),bf(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),bf(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&&Af(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,t,i){this.writeTag(e,wf.Bytes),this.writeRawMessage(t,i)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,If,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,Cf,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,Df,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,zf,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,Pf,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,Lf,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,Rf,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,Bf,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,Of,t)},writeBytesField:function(e,t){this.writeTag(e,wf.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,wf.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,wf.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,wf.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,wf.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,wf.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,wf.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,wf.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,wf.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,wf.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};var qf=function(){function e(t,i){var r=i.pixelRatio,n=i.version,a=i.stretchX,o=i.stretchY,s=i.content;d(this,e),this.paddedRect=t,this.pixelRatio=r,this.stretchX=a,this.stretchY=o,this.content=s,this.version=n}return p(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}(),Wf=function(){function e(t,i){d(this,e);var r={},n={};this.haveRenderCallbacks=[];var a=[];this.addImages(t,r,a),this.addImages(i,n,a);var o=Zf(a),s=o.w,l=o.h,u=new dc({width:s||1,height:l||1});for(var c in t){var h=t[c],f=r[c].paddedRect;dc.copy(h.data,u,{x:0,y:0},{x:f.x+1,y:f.y+1},h.data)}for(var p in i){var v=i[p],m=n[p].paddedRect,y=m.x+1,_=m.y+1,g=v.data.width,x=v.data.height;dc.copy(v.data,u,{x:0,y:0},{x:y,y:_},v.data),dc.copy(v.data,u,{x:0,y:x-1},{x:y,y:_-1},{width:g,height:1}),dc.copy(v.data,u,{x:0,y:0},{x:y,y:_+x},{width:g,height:1}),dc.copy(v.data,u,{x:g-1,y:0},{x:y-1,y:_},{width:1,height:x}),dc.copy(v.data,u,{x:0,y:0},{x:y+g,y:_},{width:1,height:x})}this.image=u,this.iconPositions=r,this.patternPositions=n}return p(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 qf(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=h(e.tl,2),n=r[0],a=r[1];i.update(t.data,void 0,{x:n,y:a})}}}]),e}();ia(qf,"ImagePosition"),ia(Wf,"ImageAtlas");var Xf={horizontal:1,vertical:2,horizontalOnly:3},Hf=function(){function e(){d(this,e),this.scale=1,this.fontStack="",this.imageName=null}return p(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}(),Yf=function(){function e(){d(this,e),this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}return p(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&&Ua(n)&&!mf[e[r+1]]||a&&Ua(a)&&!mf[e[r-1]])||!mf[e[r]]?e[r]:mf[e[r]]}return i}(this.text,e)}},{key:"trim",value:function(){for(var e=0,t=0;t<this.text.length&&Jf[this.text.charCodeAt(t)];t++)e++;for(var i=this.text.length,r=this.text.length-1;r>=0&&r>=e&&Jf[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)}),0)}},{key:"addTextSection",value:function(e,t){this.text+=e.text,this.sections.push(Hf.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(Hf.forImage(t)),this.sectionIndex.push(this.sections.length-1)):te("Reached maximum number of images 6401")}else te("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 Kf(e,t,i,r,n,a,o,s,l,u,c,h,d,p,v){var m=Yf.fromFeature(e,n);h===Xf.vertical&&m.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+=Qf(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(Jf[d]||(c+=Qf(d,f,r,n,t,a)),h<e.length()-1){var p=!((o=d)<11904||!(_a(o)||ya(o)||za(o)||Aa(o)||wa(o)||ha(o)||ga(o)||pa(o)||ka(o)||Ta(o)||ba(o)||La(o)||va(o)||da(o)||fa(o)||xa(o)||ma(o)||Ca(o)||Sa(o)||Ea(o)));($f[d]||p||f.imageName)&&s.push(id(h+1,c,l,s,td(d,e.getCharCode(h+1),p&&u),!1))}}return rd(id(e.length(),c,l,s,0,!0))}(m,u,a,t,r,p),g=eo.processBidirectionalText,x=eo.processStyledBidirectionalText;if(g&&1===m.sections.length){var b,w=g(m.toString(),_),k=f(w);try{for(k.s();!(b=k.n()).done;){var T=b.value,E=new Yf;E.text=T,E.sections=m.sections;for(var S=0;S<T.length;S++)E.sectionIndex.push(0);y.push(E)}}catch(L){k.e(L)}finally{k.f()}}else if(x){var M,A=x(m.text,m.sectionIndex,_),I=f(A);try{for(I.s();!(M=I.n()).done;){var C=M.value,z=new Yf;z.text=C[0],z.sectionIndex=C[1],z.sections=m.sections,y.push(z)}}catch(L){I.e(L)}finally{I.f()}}else y=function(e,t){var i,r=[],n=e.text,a=0,o=f(t);try{for(o.s();!(i=o.n()).done;){var s=i.value;r.push(e.substring(a,s)),a=s}}catch(L){o.e(L)}finally{o.f()}return a<n.length&&r.push(e.substring(a,n.length)),r}(m,_);var P=[],D={positionedLines:P,text:m.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:h,iconsInText:!1,verticalizable:!1,hasBaseline:!1};return function(e,t,i,r,n,a,o,s,l,u,c,h){var d,p=0,v=0,m=0,y="right"===s?1:"left"===s?0:.5,_=!1,g=f(n);try{for(g.s();!(d=g.n()).done;){var x,b=d.value.getSections(),w=f(b);try{for(w.s();!(x=w.n()).done;){var k=x.value;if(!k.imageName){var T=t[k.fontStack];if(T&&!(_=void 0!==T.ascender&&void 0!==T.descender))break}}}catch(L){w.e(L)}finally{w.f()}if(!_)break}}catch(L){g.e(L)}finally{g.f()}var E,S,M=0,A=f(n);try{for(A.s();!(E=A.n()).done;){var I=E.value;I.trim();var C=I.getMaxScale(),z=(C-1)*uf,P={positionedGlyphs:[],lineOffset:0};e.positionedLines[M]=P;var D=P.positionedGlyphs,R=0;if(I.length()){for(var B=0,O=0,F=0;F<I.length();F++){var U=I.getSection(F),V=I.getSectionIndex(F),N=I.getCharCode(F),j=U.scale,G=null,Z=null,q=null,W=uf,X=0,H=!(l===Xf.horizontal||!c&&!Fa(N)||c&&(Jf[N]||(S=N,la(S)||ua(S)||ca(S)||Ia(S)||Da(S))));if(U.imageName){var Y=r[U.imageName];if(!Y)continue;q=U.imageName,e.iconsInText=e.iconsInText||!0,Z=Y.paddedRect;var K=Y.displaySize;j=j*uf/h,G={width:K[0],height:K[1],left:1,top:-3,advance:H?K[1]:K[0],localGlyph:!1},X=_?-G.height*j:C*uf-17-K[1]*j,W=G.advance;var J=(H?K[0]:K[1])*j-uf*C;J>0&&J>R&&(R=J)}else{var $=i[U.fontStack];if(!$)continue;$[N]&&(Z=$[N]);var Q=t[U.fontStack];if(!Q)continue;var ee=Q.glyphs[N];if(!ee)continue;if(G=ee.metrics,W=8203!==N?uf:0,_){var te=void 0!==Q.ascender?Math.abs(Q.ascender):0,ie=void 0!==Q.descender?Math.abs(Q.descender):0,re=(te+ie)*j;B<re&&(B=re,O=(te-ie)/2*j),X=-te*j}else X=(C-j)*uf-17}H?(e.verticalizable=!0,D.push({glyph:N,imageName:q,x:p,y:v+X,vertical:H,scale:j,localGlyph:G.localGlyph,fontStack:U.fontStack,sectionIndex:V,metrics:G,rect:Z}),p+=W*j+u):(D.push({glyph:N,imageName:q,x:p,y:v+X,vertical:H,scale:j,localGlyph:G.localGlyph,fontStack:U.fontStack,sectionIndex:V,metrics:G,rect:Z}),p+=G.advance*j+u)}0!==D.length&&(m=Math.max(p-u,m),_?ad(D,y,R,O,a*C/2):ad(D,y,R,0,a/2)),p=0;var ne=a*C+R;P.lineOffset=Math.max(R,z),v+=ne,++M}else v+=a,++M}}catch(L){A.e(L)}finally{A.f()}var ae=v,oe=nd(o),se=oe.horizontalAlign,le=oe.verticalAlign;(function(e,t,i,r,n,a){var o,s=(t-i)*n,l=-a*r,u=f(e);try{for(u.s();!(o=u.n()).done;){var c,h=o.value,d=f(h.positionedGlyphs);try{for(d.s();!(c=d.n()).done;){var p=c.value;p.x+=s,p.y+=l}}catch(L){d.e(L)}finally{d.f()}}}catch(L){u.e(L)}finally{u.f()}})(e.positionedLines,y,se,le,m,ae),e.top+=-le*ae,e.bottom=e.top+ae,e.left+=-se*m,e.right=e.left+m,e.hasBaseline=_}(D,t,i,r,y,o,s,l,h,u,d,v),!function(e){var t,i=f(e);try{for(i.s();!(t=i.n()).done;)if(0!==t.value.positionedGlyphs.length)return!1}catch(L){i.e(L)}finally{i.f()}return!0}(P)&&D}var Jf={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},$f={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 Qf(e,t,i,r,n,a){if(t.imageName){var o=r[t.imageName];return o?o.displaySize[0]*t.scale*uf/a+n:0}var s=i[t.fontStack],l=s&&s.glyphs[e];return l?l.metrics.advance*t.scale+n:0}function ed(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 td(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 id(e,t,i,r,n,a){var o,s=null,l=ed(t,i,n,a),u=f(r);try{for(u.s();!(o=u.n()).done;){var c=o.value,h=ed(t-c.x,i,n,a)+c.badness;h<=l&&(s=c,l=h)}}catch(d){u.e(d)}finally{u.f()}return{index:e,x:t,priorBreak:s,badness:l}}function rd(e){return e?rd(e.priorBreak).concat(e.index):[]}function nd(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 ad(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 od(e,t,i){var r=nd(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]}}function sd(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,v=t.right*a;"width"===i||"both"===i?(d=n[0]+p-r[3],h=n[0]+v+r[1]):h=(d=n[0]+(p+v-s.displaySize[0])/2)+s.displaySize[0];var m=t.top*a,y=t.bottom*a;return"height"===i||"both"===i?(c=n[1]+m-r[0],f=n[1]+y+r[2]):f=(c=n[1]+(m+y-s.displaySize[1])/2)+s.displaySize[1],{image:s,top:c,right:h,bottom:f,left:d,collisionPadding:o}}var ld=function(e){v(i,e);var t=m(i);function i(e,r,n,a,o){var s;return d(this,i),(s=t.call(this,e,r)).angle=a,s.z=n,void 0!==o&&(s.segment=o),s}return p(i,[{key:"clone",value:function(){return new i(this.x,this.y,this.z,this.angle,this.segment)}}]),i}(A);function ud(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 cd(e){for(var t=0,i=0;i<e.length-1;i++)t+=e[i].dist(e[i+1]);return t}function hd(e,t,i){return e?.6*t*i:0}function fd(e,t){return Math.max(e?e.right-e.left:0,t?t.right-t.left:0)}function dd(e,t,i,r,n,a){for(var o=hd(i,n,a),s=fd(i,r)*a,l=0,u=cd(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,v=Ni(h.x,f.x,p),m=Ni(h.y,f.y,p),y=new ld(v,m,0,f.angleTo(h),c);return!o||ud(e,y,s,o,t)?y:void 0}l+=d}}function pd(e,t,i,r,n,a,o,s,l){var u=hd(r,a,o),c=fd(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),vd(e,f?t/2*s%t:(c/2+2*a)*o*s%t,t,u,i,h,f,!1,l)}function vd(e,t,i,r,n,a,o,s,l){for(var u=a/2,c=cd(e),h=0,f=t-i,d=[],p=0;p<e.length-1;p++){for(var v=e[p],m=e[p+1],y=v.dist(m),_=m.angleTo(v);f+i<h+y;){var g=((f+=i)-h)/y,x=Ni(v.x,m.x,g),b=Ni(v.y,m.y,g);if(x>=0&&x<l&&b>=0&&b<l&&f-u>=0&&f+u<=c){var w=new ld(x,b,0,_,p);w._round(),r&&!ud(e,w,a,r,n)||d.push(w)}}h+=y}return s||d.length||o||(d=vd(e,h/2,i,r,n,a,o,!0,l)),d}function md(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 A(t,c.y+(t-c.x)/(h.x-c.x)*(h.y-c.y))._round():h.x<t&&(h=new A(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 A(c.x+(i-c.y)/(h.y-c.y)*(h.x-c.x),i)._round():h.y<i&&(h=new A(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 A(r,c.y+(r-c.x)/(h.x-c.x)*(h.y-c.y))._round():h.x>=r&&(h=new A(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 A(c.x+(n-c.y)/(h.y-c.y)*(h.x-c.x),n)._round():h.y>=n&&(h=new A(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}ia(ld,"Anchor");var yd=1e20;function _d(e,t,i,r,n,a,o,s,l){for(var u=t;u<t+r;u++)gd(e,i*a+u,a,n,o,s,l);for(var c=i;c<i+n;c++)gd(e,c*a+t,1,r,o,s,l)}function gd(e,t,i,r,n,a,o){a[0]=0,o[0]=-yd,o[1]=yd,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]=yd}for(var f=0,d=0;f<r;f++){for(;o[d+1]<f;)d++;var p=a[d],v=f-p;e[t+f*i]=n[p]+v*v}}var xd={none:0,ideographs:1,all:2},bd=function(){function e(t,i,r){d(this,e),this.requestManager=t,this.localGlyphMode=i,this.localFontFamily=r,this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}return p(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=f(t[a]);try{for(s.s();!(o=s.n()).done;){var l=o.value;n.push({stack:a,id:l})}}catch(u){s.e(u)}finally{s.f()}}N(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 l=Math.floor(a/256);if(256*l>65535)i(new Error("glyphs > 65535 not supported"));else if(o.ranges[l])i(null,{stack:n,id:a,glyph:s});else{var c=o.requests[l];c||(c=o.requests[l]=[],e.loadGlyphRange(n,l,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[l]=!0}var n,a=f(c);try{for(a.s();!(n=a.n()).done;)(0,n.value)(e,t)}catch(u){a.e(u)}finally{a.f()}delete o.requests[l]}))),c.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=f(t);try{for(o.s();!(n=o.n()).done;){var s=n.value,l=s.stack,c=s.id,h=s.glyph;void 0===a[l]&&(a[l]={}),void 0===a[l].glyphs&&(a[l].glyphs={}),a[l].glyphs[c]=h&&{id:h.id,bitmap:h.bitmap.clone(),metrics:h.metrics},a[l].ascender=r.entries[l].ascender,a[l].descender=r.entries[l].descender}}catch(u){o.e(u)}finally{o.f()}i(null,a)}}))}},{key:"_doesCharSupportLocalGlyph",value:function(e){return this.localGlyphMode!==xd.none&&(this.localGlyphMode===xd.all?!!this.localFontFamily:!!this.localFontFamily&&(Ta(e)||Ma(e)||va(e)||ma(e)||pa(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,v=l.glyphTop,m=l.glyphAdvance;return this.localGlyphs[a.fontWeight][r]={id:r,bitmap:new fc({width:c,height:h},u),metrics:{width:f/2,height:d/2,left:p/2,top:v/2-27,advance:m/2,localGlyph:!0}}}}}]),e}();function wd(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),v=f.reduce(d,0),m=s-p,y=l-v,_=0,g=p,x=0,b=v,w=0,k=m,T=0,E=y;if(a.content&&r){var S=a.content;_=kd(h,0,S[0]),x=kd(f,0,S[1]),g=kd(h,S[0],S[2]),b=kd(f,S[1],S[3]),w=S[0]-_,T=S[1]-x,k=S[2]-S[0]-g,E=S[3]-S[1]-b}var M=function(r,n,s,l){var h=Ed(r.stretch-_,g,u,e.left),f=Sd(r.fixed-w,k,r.stretch,p),d=Ed(n.stretch-x,b,c,e.top),m=Sd(n.fixed-T,E,n.stretch,v),y=Ed(s.stretch-_,g,u,e.left),S=Sd(s.fixed-w,k,s.stretch,p),M=Ed(l.stretch-x,b,c,e.top),I=Sd(l.fixed-T,E,l.stretch,v),C=new A(h,d),z=new A(y,d),P=new A(y,M),D=new A(h,M),L=new A(f/o,m/o),R=new A(S/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),z._matMult(U),D._matMult(U),P._matMult(U)}var V=r.stretch+r.fixed,N=n.stretch+n.fixed;return{tl:C,tr:z,bl:D,br:P,tex:{x:a.paddedRect.x+1+V,y:a.paddedRect.y+1+N,w:s.stretch+s.fixed-V,h:l.stretch+l.fixed-N},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=Td(h,m,p),C=Td(f,y,v),z=0;z<I.length-1;z++)for(var P=I[z],D=I[z+1],L=0;L<C.length-1;L++)n.push(M(P,C[L],D,C[L+1]));else n.push(M({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:s+1},{fixed:0,stretch:l+1}));return n}function kd(e,t,i){var r,n=0,a=f(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 Td(e,t,i){var r,n=[{fixed:-1,stretch:0}],a=f(e);try{for(a.s();!(r=a.n()).done;){var o=h(r.value,2),s=o[0],l=o[1],u=n[n.length-1];n.push({fixed:s-u.stretch,stretch:u.stretch}),n.push({fixed:s-u.stretch,stretch:u.stretch+(l-s)})}}catch(c){a.e(c)}finally{a.f()}return n.push({fixed:t+1,stretch:i}),n}function Ed(e,t,i,r){return e/t*i+r}function Sd(e,t,i,r){return e-t*i/r}function Md(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}bd.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)),ge.Glyphs);ke(s,(function(e,t){if(e)n(e);else if(t){var i,r={},a=function(e){return new gf(e).readFields(Nf,{})}(t),o=f(a.glyphs);try{for(o.s();!(i=o.n()).done;){var s=i.value;r[s.id]=s}}catch(l){o.e(l)}finally{o.f()}n(null,{glyphs:r,ascender:a.ascender,descender:a.descender})}}))},bd.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,h=void 0===c?"sans-serif":c,f=t.fontWeight,p=void 0===f?"normal":f,v=t.fontStyle,m=void 0===v?"normal":v;d(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(m," ").concat(p," ").concat(r,"px ").concat(h),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 p(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 v=this.ctx,m=this.buffer,y=this.gridInner,_=this.gridOuter;v.clearRect(m,m,l,u),v.fillText(e,m,m+s);var g=v.getImageData(m,m,l,u);_.fill(yd,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+m)*c+b+m;if(1===w)_[k]=0,y[k]=yd;else{var T=.5-w;_[k]=T>0?T*T:0,y[k]=T<0?T*T:0}}}_d(_,0,0,c,h,c,this.f,this.v,this.z),_d(y,m,m,l,u,c,this.f,this.v,this.z);for(var E=0;E<f;E++){var S=Math.sqrt(_[E])-Math.sqrt(y[E]);d[E]=Math.round(255-255*(S/this.radius+this.cutoff))}return p}}]),e}();var Ad=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Id;if(d(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 p(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 Id(e,t){return e<t?-1:e>t?1:0}function Cd(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 Ad([],zd);if(0===c)return new A(r,n);for(var d=r;d<a;d+=c)for(var p=n;p<o;p+=c)f.push(new Pd(d+h,p+h,h,e));for(var v=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 Pd(i/t,r/t,0,e)}(e),m=f.length;f.length;){var y=f.pop();(y.d>v.d||!v.d)&&(v=y,i&&console.log("found best %d after %d probes",Math.round(1e4*y.d)/1e4,m)),y.max-v.d<=t||(h=y.h/2,f.push(new Pd(y.p.x-h,y.p.y-h,h,e)),f.push(new Pd(y.p.x+h,y.p.y-h,h,e)),f.push(new Pd(y.p.x-h,y.p.y+h,h,e)),f.push(new Pd(y.p.x+h,y.p.y+h,h,e)),m+=4)}return i&&(console.log("num probes: ".concat(m)),console.log("best distance: ".concat(v.d))),v.p}function zd(e,t){return t.max-e.max}var Pd=p((function e(t,i,r,n){d(this,e),this.p=new A(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,Wu(e,u,c))}return(i?1:-1)*Math.sqrt(r)}(this.p,n),this.max=this.d+this.h*Math.SQRT2})),Dd=Number.POSITIVE_INFINITY,Ld=Math.sqrt(2);function Rd(e,t){var i=h(t,2),r=i[0],n=i[1],a=0,o=0;if(n===Dd){r<0&&(r=0);var s=r/Ld;switch(e){case"top-right":case"top-left":o=s-7;break;case"bottom-right":case"bottom-left":o=7-s;break;case"bottom":o=7-r;break;case"top":o=r-7}switch(e){case"top-right":case"bottom-right":a=-s;break;case"top-left":case"bottom-left":a=s;break;case"left":a=r;break;case"right":a=-r}}else{switch(r=Math.abs(r),n=Math.abs(n),e){case"top-right":case"top-left":case"top":o=n-7;break;case"bottom-right":case"bottom-left":case"bottom":o=7-n}switch(e){case"top-right":case"bottom-right":case"right":a=-r;break;case"top-left":case"bottom-left":case"left":a=r}}return[a,o]}function Bd(e,t,i,r,n,a,o,s,l,u){e.createArrays(),e.tilePixelRatio=Vs/(512*e.overscaling),e.compareText={},e.iconsNeedLinear=!1;var c=e.layers[0].layout,h=e.layers[0]._unevaluatedLayout._values,d={};if("composite"===e.textSizeData.kind){var p=e.textSizeData,v=p.minZoom,m=p.maxZoom;d.compositeTextSizes=[h["text-size"].possiblyEvaluate(new to(v),s),h["text-size"].possiblyEvaluate(new to(m),s)]}if("composite"===e.iconSizeData.kind){var y=e.iconSizeData,_=y.minZoom,g=y.maxZoom;d.compositeIconSizes=[h["icon-size"].possiblyEvaluate(new to(_),s),h["icon-size"].possiblyEvaluate(new to(g),s)]}d.layoutTextSize=h["text-size"].possiblyEvaluate(new to(l+1),s),d.layoutIconSize=h["icon-size"].possiblyEvaluate(new to(l+1),s),d.textMaxSize=h["text-size"].possiblyEvaluate(new to(18),s);var x,b="map"===c.get("text-rotation-alignment")&&"point"!==c.get("symbol-placement"),w=c.get("text-size"),k=f(e.features);try{var T=function(){var a,l=x.value,h=c.get("text-font").evaluate(l,{},s).join(","),f=w.evaluate(l,{},s),p=d.layoutTextSize.evaluate(l,{},s),v=(d.layoutIconSize.evaluate(l,{},s),{horizontal:{},vertical:void 0}),m=l.text,y=[0,0];if(m){var _=m.toString(),g=c.get("text-letter-spacing").evaluate(l,{},s)*uf,k=c.get("text-line-height").evaluate(l,{},s)*uf,T=Ba(_)?g:0,E=c.get("text-anchor").evaluate(l,{},s),S=c.get("text-variable-anchor");if(!S){var M=c.get("text-radial-offset").evaluate(l,{},s);y=M?Rd(E,[M*uf,Dd]):c.get("text-offset").evaluate(l,{},s).map((function(e){return e*uf}))}var A=b?"center":c.get("text-justify").evaluate(l,{},s),I="point"===c.get("symbol-placement"),C=I?c.get("text-max-width").evaluate(l,{},s)*uf:1/0,z=function(r){e.allowVerticalPlacement&&Ra(_)&&(v.vertical=Kf(m,t,i,n,h,C,k,E,r,T,y,Xf.vertical,!0,p,f))};if(!b&&S){for(var P="auto"===A?S.map((function(e){return Od(e)})):[A],D=!1,L=0;L<P.length;L++){var R=P[L];if(!v.horizontal[R])if(D)v.horizontal[R]=v.horizontal[0];else{var B=Kf(m,t,i,n,h,C,k,"center",R,T,y,Xf.horizontal,!1,p,f);B&&(v.horizontal[R]=B,D=1===B.positionedLines.length)}}z("left")}else{if("auto"===A&&(A=Od(E)),I||c.get("text-writing-mode").indexOf("horizontal")>=0||!Ra(_)){var O=Kf(m,t,i,n,h,C,k,E,A,T,y,Xf.horizontal,!1,p,f);O&&(v.horizontal[A]=O)}z(I?"left":A)}}var F=!1;if(l.icon&&l.icon.name){var U=r[l.icon.name];U&&(a=od(n[l.icon.name],c.get("icon-offset").evaluate(l,{},s),c.get("icon-anchor").evaluate(l,{},s)),F=U.sdf,void 0===e.sdfIcons?e.sdfIcons=U.sdf:e.sdfIcons!==U.sdf&&te("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(U.pixelRatio!==e.pixelRatio||0!==c.get("icon-rotate").constantOr(1))&&(e.iconsNeedLinear=!0))}var V=Nd(v.horizontal)||v.vertical;e.iconsInText||(e.iconsInText=!!V&&V.iconsInText),(V||a)&&Fd(e,l,v,a,r,d,p,0,y,F,o,s,u)};for(k.s();!(x=k.n()).done;)T()}catch(E){k.e(E)}finally{k.f()}a&&e.generateCollisionDebugBuffers(l,e.collisionBoxArray)}function Od(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Fd(e,t,i,r,n,a,o,s,l,u,c,d,p){var v=a.textMaxSize.evaluate(t,{},d);void 0===v&&(v=o);var m,y,_=e.layers[0].layout,g=_.get("icon-offset").evaluate(t,{},d),x=Nd(i.horizontal)||i.vertical,b="globe"===p.name,w=o/24,k=e.tilePixelRatio*v/24,T=(m=e.overscaling,e.zoom>18&&m>2&&(m>>=1),Math.max(Vs/(512*m),1)*_.get("symbol-spacing")),E=_.get("text-padding")*e.tilePixelRatio,S=_.get("icon-padding")*e.tilePixelRatio,M=P(_.get("text-max-angle")),A="map"===_.get("text-rotation-alignment")&&"point"!==_.get("symbol-placement"),I="map"===_.get("icon-rotation-alignment")&&"point"!==_.get("symbol-placement"),C=_.get("symbol-placement"),z=T/2,D=_.get("icon-text-fit");r&&"none"!==D&&(e.allowVerticalPlacement&&i.vertical&&(y=sd(r,i.vertical,D,_.get("icon-text-fit-padding"),g,w)),x&&(r=sd(r,x,D,_.get("icon-text-fit-padding"),g,w)));var L=function(o,s,f){if(!(s.x<0||s.x>=Vs||s.y<0||s.y>=Vs)){var v=null;if(b){var m=p.projectTilePoint(s.x,s.y,f),_=m.x,x=m.y,w=m.z;v={anchor:new ld(_,x,w,0,void 0),up:p.upVector(f,s.x,s.y)}}!function(e,t,i,r,n,a,o,s,l,u,c,f,d,p,v,m,y,_,g,x,b,w,k,T,E){var S,M,A,I,C,z,P,D,L,R=e.addToLineVertexArray(t,r),B=0,O=0,F=0,U=0,V=-1,N=-1,j={},G=as(""),Z=i?i.anchor:t,q=0,W=0;if(void 0===l._unevaluatedLayout.getValue("text-radial-offset")?(S=l.layout.get("text-offset").evaluate(b,{},E).map((function(e){return e*uf})),q=(M=h(S,2))[0],W=M[1]):(q=l.layout.get("text-radial-offset").evaluate(b,{},E)*uf,W=Dd),e.allowVerticalPlacement&&n.vertical){var X=n.vertical;if(v)D=Gd(X),s&&(L=Gd(s));else{var H=l.layout.get("text-rotate").evaluate(b,{},E)+90;C=jd(u,Z,t,c,f,d,X,p,H,m),s&&(z=jd(u,Z,t,c,f,d,s,_,H))}}if(a){var Y=l.layout.get("icon-rotate").evaluate(b,{},E),K="none"!==l.layout.get("icon-text-fit"),J=wd(a,Y,k,K),$=s?wd(s,Y,k,K):void 0;I=jd(u,Z,t,c,f,d,a,_,Y),B=4*J.length;var Q=e.iconSizeData,ee=null;"source"===Q.kind?(ee=[cf*l.layout.get("icon-size").evaluate(b,{},E)])[0]>Ud&&te("".concat(e.layerIds[0],': Value for "icon-size" is >= 255. Reduce your "icon-size".')):"composite"===Q.kind&&((ee=[cf*w.compositeIconSizes[0].evaluate(b,{},E),cf*w.compositeIconSizes[1].evaluate(b,{},E)])[0]>Ud||ee[1]>Ud)&&te("".concat(e.layerIds[0],': Value for "icon-size" is >= 255. Reduce your "icon-size".')),e.addSymbols(e.icon,J,ee,x,g,b,!1,i,t,R.lineStartIndex,R.lineLength,-1,T,E),V=e.icon.placedSymbolArray.length-1,$&&(O=4*$.length,e.addSymbols(e.icon,$,ee,x,g,b,Xf.vertical,i,t,R.lineStartIndex,R.lineLength,-1,T,E),N=e.icon.placedSymbolArray.length-1)}for(var ie in n.horizontal){var re=n.horizontal[ie];A||(G=as(re.text),v?P=Gd(re):A=jd(u,Z,t,c,f,d,re,p,l.layout.get("text-rotate").evaluate(b,{},E),m));var ne=1===re.positionedLines.length;if(F+=Vd(e,i,t,re,o,l,v,b,m,R,n.vertical?Xf.horizontal:Xf.horizontalOnly,ne?Object.keys(n.horizontal):[ie],j,V,w,T,E),ne)break}n.vertical&&(U+=Vd(e,i,t,n.vertical,o,l,v,b,m,R,Xf.vertical,["vertical"],j,N,w,T,E));var ae=-1,oe=function(e,t){return e?Math.max(e,t):t};ae=oe(P,ae),ae=oe(D,ae);var se=(ae=oe(L,ae))>-1?1:0;e.glyphOffsetArray.length>=wp.MAX_GLYPHS&&te("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.sortKey),e.symbolInstances.emplaceBack(Z.x,Z.y,Z.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,V,N,G,void 0!==A?A:e.collisionBoxArray.length,void 0!==A?A+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,z||e.collisionBoxArray.length,z?z+1:e.collisionBoxArray.length,c,F,U,B,O,se,0,q,W,ae)}(e,s,v,o,i,r,n,y,e.layers[0],e.collisionBoxArray,t.index,t.sourceLayerIndex,e.index,E,A,l,0,S,I,g,t,a,u,c,d)}};if("line"===C){var R,B=f(md(t.geometry,0,0,Vs,Vs));try{for(B.s();!(R=B.n()).done;){var O,F=R.value,U=pd(F,T,M,i.vertical||x,r,24,k,e.overscaling,Vs),V=f(U);try{for(V.s();!(O=V.n()).done;){var N=O.value;x&&Zd(e,x.text,z,N)||L(F,N,d)}}catch(oe){V.e(oe)}finally{V.f()}}}catch(oe){B.e(oe)}finally{B.f()}}else if("line-center"===C){var j,G=f(t.geometry);try{for(G.s();!(j=G.n()).done;){var Z=j.value;if(Z.length>1){var q=dd(Z,M,i.vertical||x,r,24,k);q&&L(Z,q,d)}}}catch(oe){G.e(oe)}finally{G.f()}}else if("Polygon"===t.type){var W,X=f(Yc(t.geometry,0));try{for(X.s();!(W=X.n()).done;){var H=W.value,Y=Cd(H,16);L(H[0],new ld(Y.x,Y.y,0,0,void 0),d)}}catch(oe){X.e(oe)}finally{X.f()}}else if("LineString"===t.type){var K,J=f(t.geometry);try{for(J.s();!(K=J.n()).done;){var $=K.value;L($,new ld($[0].x,$[0].y,0,0,void 0),d)}}catch(oe){J.e(oe)}finally{J.f()}}else if("Point"===t.type){var Q,ee=f(t.geometry);try{for(ee.s();!(Q=ee.n()).done;){var ie,re=Q.value,ne=f(re);try{for(ne.s();!(ie=ne.n()).done;){var ae=ie.value;L([ae],new ld(ae.x,ae.y,0,0,void 0),d)}}catch(oe){ne.e(oe)}finally{ne.f()}}}catch(oe){ee.e(oe)}finally{ee.f()}}}var Ud=32640;function Vd(e,t,i,r,n,o,s,l,u,h,d,p,v,m,y,_,g){var x=function(e,t,i,r,n,o,s,l){var u=[];if(0===t.positionedLines.length)return u;var h,d=r.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,p=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),v=Math.abs(t.top-t.bottom),m=f(t.positionedLines);try{for(m.s();!(h=m.n()).done;)v-=h.value.lineOffset}catch(oe){m.e(oe)}finally{m.f()}for(var y=t.positionedLines.length,_=v/y,g=t.top-i[1],x=0;x<y;++x){var b=t.positionedLines[x];g=Md(t,_,g,x);var w,k=f(b.positionedGlyphs);try{for(k.s();!(w=k.n()).done;){var T=w.value;if(T.rect){var E=T.rect||{},S=4,M=!0,I=1,C=0;if(T.imageName){var z=s[T.imageName];if(!z)continue;if(z.sdf){te("SDF images are not supported in formatted text and will be ignored.");continue}M=!1,S=1/(I=z.pixelRatio)}var P=(n||l)&&T.vertical,D=T.metrics.advance*T.scale/2,L=T.metrics,R=T.rect;if(null!==R){l&&t.verticalizable&&(C=T.imageName?D-T.metrics.width*T.scale/2:0);var B=n?[T.x+D,T.y]:[0,0],O=[0,0],F=[0,0],U=!1;n||(P?(F=[T.x+D+p[0],T.y+p[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)),N=R.h*T.scale/(I*(T.localGlyph?2:1)),j=void 0,G=void 0,Z=void 0,q=void 0;if(P){var W=T.y-g,X=new A(-D,D-W),H=-Math.PI/2,Y=a(A,c(F));(j=new A(-D+O[0],O[1]))._rotateAround(H,X)._add(Y),j.x+=-W+D,j.y-=(L.left-S)*T.scale;var K=T.imageName?L.advance*T.scale:uf*T.scale,J=String.fromCharCode(T.glyph);yf(J)?j.x+=(1-S)*T.scale:_f(J)?j.x+=K-L.height*T.scale+(-S-1)*T.scale:j.x+=T.imageName||L.width+2*S===R.w&&L.height+2*S===R.h?(K-N)/2:(K-(L.height+2*S)*T.scale)/2,G=new A(j.x,j.y-V),Z=new A(j.x+N,j.y),q=new A(j.x+N,j.y-V)}else{var $=(L.left-S)*T.scale-D+O[0],Q=(-L.top-S)*T.scale+O[1],ee=$+V,ie=Q+N;j=new A($,Q),G=new A(ee,Q),Z=new A($,ie),q=new A(ee,ie)}if(d){var re=void 0;re=n?new A(0,0):U?new A(p[0],p[1]):new A(i[0],i[1]),j._rotateAround(d,re),G._rotateAround(d,re),Z._rotateAround(d,re),q._rotateAround(d,re)}var ne=new A(0,0),ae=new A(0,0);u.push({tl:j,tr:G,bl:Z,br:q,tex:E,writingMode:t.writingMode,glyphOffset:B,sectionIndex:T.sectionIndex,isSDF:M,pixelOffsetTL:ne,pixelOffsetBR:ae,minFontScaleX:0,minFontScaleY:0})}}}}catch(oe){k.e(oe)}finally{k.f()}}return u}(0,r,u,o,s,l,n,e.allowVerticalPlacement),b=e.textSizeData,w=null;"source"===b.kind?(w=[cf*o.layout.get("text-size").evaluate(l,{},g)])[0]>Ud&&te("".concat(e.layerIds[0],': Value for "text-size" is >= 255. Reduce your "text-size".')):"composite"===b.kind&&((w=[cf*y.compositeTextSizes[0].evaluate(l,{},g),cf*y.compositeTextSizes[1].evaluate(l,{},g)])[0]>Ud||w[1]>Ud)&&te("".concat(e.layerIds[0],': Value for "text-size" is >= 255. Reduce your "text-size".')),e.addSymbols(e.text,x,w,u,s,l,d,t,i,h.lineStartIndex,h.lineLength,m,_,g);var k,T=f(p);try{for(T.s();!(k=T.n()).done;)v[k.value]=e.text.placedSymbolArray.length-1}catch(E){T.e(E)}finally{T.f()}return 4*x.length}function Nd(e){for(var t in e)return e[t];return null}function jd(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 v=new A(f,c),m=new A(d,c),y=new A(f,h),_=new A(d,h),g=P(l),x=new A(0,0);u&&(x=new A(u[0],u[1])),v._rotateAround(g,x),m._rotateAround(g,x),y._rotateAround(g,x),_._rotateAround(g,x),f=Math.min(v.x,m.x,y.x,_.x),d=Math.max(v.x,m.x,y.x,_.x),c=Math.min(v.y,m.y,y.y,_.y),h=Math.max(v.y,m.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 Gd(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 Zd(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 qd(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 Wd(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=bu(r),l=bu(n),u=wu(a),c=wu(o),h=t.project(s,u),f=t.project(l,u),d=t.project(l,c),p=t.project(s,c),v=Math.min(h.x,f.x,d.x,p.x),m=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(bu(s),wu(l)),c=Math.max(0,v-u.x,m-u.y,u.x-y,u.y-_);v=Math.min(v,u.x),y=Math.max(y,u.x),m=Math.min(m,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),v-=g,m-=g,y+=g,_+=g;var b=1/Math.max(y-v,_-m);return{scale:b,x:v*b,y:m*b,x2:y*b,y2:_*b,projection:t}}var Xd=Ws(new Float32Array(16)),Hd=function(){function e(t){d(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 p(e,[{key:"project",value:function(e,t){return{x:0,y:0,z:0}}},{key:"unproject",value:function(e,t){return new mu(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 xu(1,e)*t}},{key:"pixelSpaceConversion",value:function(e,t,i){return 1}},{key:"farthestPixelDistance",value:function(e){return qd(e,e.pixelsPerMeter)}},{key:"pointCoordinate",value:function(e,t,i,r){var n=e.horizonLineFromTop(!1),a=new A(t,Math.max(n,i));return e.rayIntersectionCoordinate(e.pointRayIntersection(a,r))}},{key:"pointCoordinate3D",value:function(e,t,i){var r=new A(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=Ws(new Float64Array(16));if(this.isReprojectedInTileSpace){var l=Wd(o,this);r=1,n=l.x+i.wrap*l.scale,a=l.y,Ks(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*r;return Ys(s,s,[n,a,0]),Ks(s,s,[r/Vs,r/Vs,1]),s}},{key:"upVector",value:function(e,t,i){return[0,0,1]}},{key:"upVectorScale",value:function(e,t,i){return{metersToTile:1}}}]),e}(),Yd=function(e){v(i,e);var t=m(i);function i(e){var r;d(this,i),(r=t.call(this,e)).range=[4,7],r.center=e.center||[-96,37.5];var n=r.parallels=e.parallels||[29.5,45.5],a=h(n,2),o=a[0],s=a[1],l=Math.sin(P(o));return r.n=(l+Math.sin(P(s)))/2,r.c=1+l*(2*r.n-l),r.r0=Math.sqrt(r.c)/r.n,r}return p(i,[{key:"project",value:function(e,t){var i=this.n,r=this.c,n=this.r0,a=P(e-this.center[0]),o=P(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=P(this.center[0])*i,s=F(D((a=V(a,-Math.PI-o,Math.PI-o))/i)+this.center[0],-180,180),l=Math.asin(F((r-(e*e+n*n)*i*i)/(2*i),-1,1)),u=F(D(l),-Tu,Tu);return new mu(s,u)}}]),i}(Hd),Kd=1.340264,Jd=-.081106,$d=893e-6,Qd=.003796,ep=Math.sqrt(3)/2,tp=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"project",value:function(e,t){t=t/180*Math.PI,e=e/180*Math.PI;var i=Math.asin(ep*Math.sin(t)),r=i*i,n=r*r*r;return{x:.5*(e*Math.cos(i)/(ep*(Kd+3*Jd*r+n*(7*$d+9*Qd*r)))/Math.PI+.5),y:1-.5*(i*(Kd+Jd*r+n*($d+Qd*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=F(r-(i=(r*(Kd+Jd*n+a*($d+Qd*n))-t)/(Kd+3*Jd*n+a*(7*$d+9*Qd*n))),-Math.PI/3,Math.PI/3))*r)*n*n,!(Math.abs(i)<1e-12));++o);var s=ep*e*(Kd+3*Jd*n+a*(7*$d+9*Qd*n))/Math.cos(r),l=Math.asin(Math.sin(r)/ep),u=F(180*s/Math.PI,-180,180),c=F(180*l/Math.PI,-Tu,Tu);return new mu(u,c)}}]),i}(Hd),ip=function(e){v(i,e);var t=m(i);function i(e){var r;return d(this,i),(r=t.call(this,e)).wrap=!0,r.supportsWorldCopies=!0,r}return p(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=F(360*(.5-t),-Tu,Tu);return new mu(i,r)}}]),i}(Hd),rp=Math.PI/2;function np(e){return Math.tan((rp+e)/2)}var ap=function(e){v(i,e);var t=m(i);function i(e){var r;d(this,i),(r=t.call(this,e)).center=e.center||[0,30];var n=r.parallels=e.parallels||[30,30],a=h(n,2),o=a[0],s=a[1],l=P(o),u=P(s);r.southernCenter=l+u<0,r.southernCenter&&(l=-l,u=-u);var c=Math.cos(l),f=np(l);return r.n=l===u?Math.sin(l):Math.log(c/Math.cos(u))/Math.log(np(u)/f),r.f=c*Math.pow(np(l),r.n)/r.n,r}return p(i,[{key:"project",value:function(e,t){t=P(t),this.southernCenter&&(t=-t),e=P(e-this.center[0]);var i=1e-6,r=this.n,n=this.f;n>0?t<-rp+i&&(t=-rp+i):t>rp-i&&(t=rp-i);var a=n/Math.pow(np(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=F(D(s/i)+this.center[0],-180,180),u=F(D(2*Math.atan(Math.pow(r/o,1/i))-rp),-Tu,Tu);return new mu(l,this.southernCenter?-u:u)}}]),i}(Hd),op=function(e){v(i,e);var t=m(i);function i(e){var r;return d(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 p(i,[{key:"project",value:function(e,t){return{x:_u(e),y:gu(t),z:0}}},{key:"unproject",value:function(e,t){var i=bu(e),r=wu(t);return new mu(i,r)}}]),i}(Hd),sp=P(Tu),lp=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"project",value:function(e,t){var i=(t=P(t))*t,r=i*i;return{x:.5*((e=P(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=F(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)))),-sp,sp)}while(Math.abs(n)>1e-6&&--r>0);var s=F(D(e/(.8707+(a=i*i)*(a*(a*a*a*(.003971-.001529*a)-.013791)-.131979))),-180,180),l=D(i);return new mu(s,l)}}]),i}(Hd),up=P(Tu),cp=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"project",value:function(e,t){t=P(t),e=P(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),v=2*d*p,m=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*m+g*l*d*h)+1/Math.PI,k=_*(v*c/4-g*u*p),T=.125*_*(c*p-g*u*f*v),E=.5*_*(h*d+g*m*l)+.5,S=k*T-E*w;s=(x*T-b*w)/S,i=F(i-(o=(b*k-x*E)/S),-Math.PI,Math.PI),r=F(r-s,-up,up)}while((Math.abs(o)>a||Math.abs(s)>a)&&--n>0);return new mu(D(i),D(r))}}]),i}(Hd),hp=function(e){v(i,e);var t=m(i);function i(e){var r;return d(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(P(r.parallels[0]))),r.scale=1/(2*Math.max(Math.PI*r.cosPhi,1/r.cosPhi)),r.wrap=!0,r.supportsWorldCopies=!0,r}return p(i,[{key:"project",value:function(e,t){var i=this.scale,r=this.cosPhi;return{x:P(e)*r*i+.5,y:-Math.sin(P(t))/r*i+.5,z:0}}},{key:"unproject",value:function(e,t){var i=this.scale,r=this.cosPhi,n=-(t-.5)/i,a=F(D((e-.5)/i)/r,-180,180),o=Math.asin(F(n*r,-1,1)),s=F(D(o),-Tu,Tu);return new mu(a,s)}}]),i}(Hd),fp=function(e){v(i,e);var t=m(i);function i(e){var r;return d(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 p(i,[{key:"projectTilePoint",value:function(e,t,i){var r=iu(e,t,i);return ml(r,r,au(Xl(i))),{x:r[0],y:r[1],z:r[2]}}},{key:"locationPoint",value:function(e,t){var i=tu(t.lat,t.lng),r=dl([],i),n=e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(t),e._centerAltitude):e._centerAltitude;fl(i,i,r,xu(1,0)*Vs*n);var a=Ws(new Float64Array(16));return Hs(a,e.pixelMatrix,e.globeMatrix),ml(i,i,a),new A(i[0],i[1])}},{key:"pixelsPerMeter",value:function(e,t){return xu(1,0)*t}},{key:"pixelSpaceConversion",value:function(e,t,i){var r=xu(1,e)*t,n=Ni(xu(1,45)*t,r,i);return this.pixelsPerMeter(e,t)/n}},{key:"createTileMatrix",value:function(e,t,i){var r=ou(Xl(i.canonical));return Hs(new Float64Array(16),e.globeMatrix,r)}},{key:"createInversionMatrix",value:function(e,t){var i=e.center,r=au(Xl(t));return $s(r,r,P(i.lng)),Js(r,r,P(i.lat)),Ks(r,r,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(r)}},{key:"pointCoordinate",value:function(e,t,i,r){return Zl(e,t,i,!0)||new Su(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!Zl(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=ol([],hl([],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=hl([],a.up(),h),d=hl([],a.right(),h*c),p=dl([],ol([],ol([],o,f),d)),v=[];if(new Dl(s,p).closestPointOnSphere(u,l,v)){var m=ol([],v,u),y=gl([],m,s);i=Math.cos(e.fovAboveCenter)*nl(y)}else{var _=gl([],s,u),g=gl([],u,s);dl(g,g);var x=nl(_)-l;i=Math.sqrt(x*(x+2*l));var b=Math.acos(i/(l+x))-Math.acos(pl(o,g));i*=Math.cos(b)}return 1.01*i}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),i=lu(e.zoom);if(i>0){var r=qd(e,xu(1,e.center.lat)*e.worldSize),n=e.worldSize/(2*Math.PI),a=Math.max(e.width,e.height)/e.worldSize*Math.PI;return Ni(t,r+n*(1-Math.cos(a)),Math.pow(i,10))}return t}},{key:"upVector",value:function(e,t,i){return iu(t,i,e,1)}},{key:"upVectorScale",value:function(e){return{metersToTile:Gl(ru(Xl(e)))}}}]),i}(op);function dp(e){var t=e.parallels,i=!!t&&Math.abs(t[0]+t[1])<.01;switch(e.name){case"mercator":return new op(e);case"equirectangular":return new ip(e);case"naturalEarth":return new lp(e);case"equalEarth":return new tp(e);case"winkelTripel":return new cp(e);case"albers":return i?new hp(e):new Yd(e);case"lambertConformalConic":return i?new hp(e):new ap(e);case"globe":return new fp(e)}throw new Error("Invalid projection name: ".concat(e.name))}var pp=gh.types,vp=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function mp(e,t,i,r,n,a,o,s,l,u,c,h,f){var d=s?Math.min(Ud,Math.round(s[0])):0,p=s?Math.min(Ud,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 yp(e,t,i,r,n,a,o){e.emplaceBack(t,i,r,n,a,o)}function _p(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 gp(e){var t,i=f(e.sections);try{for(i.s();!(t=i.n()).done;)if(ja(t.value.text))return!0}catch(r){i.e(r)}finally{i.f()}return!1}var xp=function(){function e(t){d(this,e),this.layoutVertexArray=new Io,this.indexArray=new Oo,this.programConfigurations=t,this.segments=new Us,this.dynamicLayoutVertexArray=new Eo,this.opacityVertexArray=new zo,this.placedSymbolArray=new Yo,this.globeExtVertexArray=new Co}return p(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,tf.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,nf.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,vp,!0),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,rf.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}();ia(xp,"SymbolBuffers");var bp=function(){function e(t,i,r){d(this,e),this.layoutVertexArray=new t,this.layoutAttributes=i,this.indexArray=new r,this.segments=new Us,this.collisionVertexArray=new Ro,this.collisionVertexArrayExt=new Bo}return p(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,af.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,of.members,!0)}},{key:"destroy",value:function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}]),e}();ia(bp,"CollisionBuffers");var wp=function(){function e(t){d(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=Ws([]),this.placementViewportMatrix=Ws([]);var i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=hf(this.zoom,i["text-size"]),this.iconSizeData=hf(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 Xf[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 p(e,[{key:"createArrays",value:function(){this.text=new xp(new Is(this.layers,this.zoom,(function(e){return/^text/.test(e)}))),this.icon=new xp(new Is(this.layers,this.zoom,(function(e){return/^icon/.test(e)}))),this.glyphOffsetArray=new $o,this.lineVertexArray=new Qo,this.symbolInstances=new Jo}},{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=mf[e.charAt(a)];o&&(t[o.charCodeAt(0)]=!0)}}},{key:"populate",value:function(e,t,i,r){var n=this,a=this.layers[0],o=a.layout,s="globe"===this.projection.name,l=o.get("text-font"),u=o.get("text-field"),c=o.get("icon-image"),h=("constant"!==u.value.kind||u.value.value instanceof Zt&&!u.value.value.isEmpty()||u.value.value.toString().length>0)&&("constant"!==l.value.kind||l.value.value.length>0),d="constant"!==c.value.kind||!!c.value.value||Object.keys(c.parameters).length>0,p=o.get("symbol-sort-key");if(this.features=[],h||d){var v,m=t.iconDependencies,y=t.glyphDependencies,_=t.availableImages,g=new to(this.zoom),x=f(e);try{var b=function(){var e,t,u=v.value,c=u.feature,x=u.id,b=u.index,w=u.sourceLayerIndex,k=a._featureFilter.needGeometry,T=Ru(c,k);if(!a._featureFilter.filter(g,T,i))return"continue";if(k||(T.geometry=Lu(c,i,r)),s&&1!==c.type&&i.z<=5)for(var E=T.geometry,S=.98078528056,M=function(e,t){return pl(iu(e.x,e.y,i,1),iu(t.x,t.y,i,1))<S},A=0;A<E.length;A++)E[A]=Cu(E[A],M);if(h){var I=a.getValueAndResolveTokens("text-field",T,i,_),C=Zt.factory(I);gp(C)&&(n.hasRTLText=!0),(!n.hasRTLText||"unavailable"===$a()||n.hasRTLText&&eo.isParsed())&&(e=vf(C,a,T))}if(d){var z=a.getValueAndResolveTokens("icon-image",T,i,_);t=z instanceof qt?z:qt.fromString(z)}if(!e&&!t)return"continue";var P=n.sortFeaturesByKey?p.evaluate(T,{},i):void 0;if(n.features.push({id:x,text:e,icon:t,index:b,sourceLayerIndex:w,geometry:T.geometry,properties:c.properties,type:pp[c.type],sortKey:P}),t&&(m[t.name]=!0),e){var D=l.evaluate(T,{},i).join(","),L="map"===o.get("text-rotation-alignment")&&"point"!==o.get("symbol-placement");n.allowVerticalPlacement=n.writingModes&&n.writingModes.indexOf(Xf.vertical)>=0;var R,B=f(e.sections);try{for(B.s();!(R=B.n()).done;){var O=R.value;if(O.image)m[O.image.name]=!0;else{var F=Ra(e.toString()),U=O.fontStack||D,V=y[U]=y[U]||{};n.calculateGlyphDependencies(O.text,V,L,n.allowVerticalPlacement,F)}}}catch(N){B.e(N)}finally{B.f()}}};for(x.s();!(v=x.n()).done;)b()}catch(w){x.e(w)}finally{x.f()}"line"===o.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 v=s(d,p,h),m=o(d,p,r[v].geometry);delete t[d],delete i[p],i[l(f,r[m].geometry,!0)]=m,r[v].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=dp(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=f(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(l){n.e(l)}finally{n.f()}}return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}},{key:"addSymbols",value:function(e,t,i,r,n,a,o,s,l,u,c,f,d,p){for(var v=e.indexArray,m=e.layoutVertexArray,y=e.globeExtVertexArray,_=e.segments.prepareSegment(4*t.length,m,v,this.canOverlap?a.sortKey:void 0),g=this.glyphOffsetArray.length,x=_.vertexLength,b=this.allowVerticalPlacement&&o===Xf.vertical?Math.PI/2:0,w=a.text&&a.text.sections,k=0;k<t.length;k++){var T=t[k],E=T.tl,S=T.tr,M=T.bl,A=T.br,I=T.tex,C=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(mp(m,l.x,l.y,E.x,F+E.y,I.x,I.y,i,R,C.x,C.y,P,D),mp(m,l.x,l.y,S.x,F+S.y,I.x+I.w,I.y,i,R,z.x,C.y,P,D),mp(m,l.x,l.y,M.x,F+M.y,I.x,I.y+I.h,i,R,C.x,z.y,P,D),mp(m,l.x,l.y,A.x,F+A.y,I.x+I.w,I.y+I.h,i,R,z.x,z.y,P,D),s){var U=s.anchor,V=U.x,N=U.y,j=U.z,G=h(s.up,3),Z=G[0],q=G[1],W=G[2];yp(y,V,N,j,Z,q,W),yp(y,V,N,j,Z,q,W),yp(y,V,N,j,Z,q,W),yp(y,V,N,j,Z,q,W),_p(e.dynamicLayoutVertexArray,V,N,j,b)}else _p(e.dynamicLayoutVertexArray,l.x,l.y,l.z,b);v.emplaceBack(O,O+1,O+2),v.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(m.length,a,a.index,{},d,p,w&&w[B])}var X=s?s.anchor:l;e.placedSymbolArray.emplaceBack(X.x,X.y,X.z,l.x,l.y,g,this.glyphOffsetArray.length-g,x,u,c,l.segment,i?i[0]:0,i?i[1]:0,r[0],r[1],o,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 A(e.x1,e.y1)),this._commitLayoutVertex(i.layoutVertexArray,r,n,a,u,c,new A(e.x2,e.y1)),this._commitLayoutVertex(i.layoutVertexArray,r,n,a,u,c,new A(e.x2,e.y2)),this._commitLayoutVertex(i.layoutVertexArray,r,n,a,u,c,new A(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 bp(Do,sf.members,Go),this.iconCollisionBox=new bp(Do,sf.members,Go);for(var i=df(this.iconSizeData,e),r=df(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=ff(this.textSizeData,e,n)/uf;return this.tilePixelRatio*a}},{key:"getSymbolInstanceIconSize",value:function(e,t,i){var r=this.icon.placedSymbolArray.get(i),n=ff(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=df(this.iconSizeData,e),r=df(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,v=c.padding,m=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:v,projectedAnchorX:m,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,S=w.y2,M=w.padding,A=w.projectedAnchorX,I=w.projectedAnchorY,C=w.projectedAnchorZ,z=w.tileAnchorX,P=w.tileAnchorY,D=w.featureIndex;u.verticalTextBox={x1:k,y1:T,x2:E,y2:S,padding:M,projectedAnchorX:A,projectedAnchorY:I,projectedAnchorZ:C,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,N=L.projectedAnchorY,j=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:N,projectedAnchorZ:j,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)}},{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=f(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,l=n.verticalPlacedTextSymbolIndex,u=n.placedIconSymbolIndex,c=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),l>=0&&this.addIndicesForPlacedSymbol(this.text,l),u>=0&&this.addIndicesForPlacedSymbol(this.icon,u),c>=0&&this.addIndicesForPlacedSymbol(this.icon,c)}}catch(h){i.e(h)}finally{i.f()}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}]),e}();ia(wp,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),wp.MAX_GLYPHS=65535,wp.addDynamicAttributes=_p;var kp=new po({"symbol-placement":new co(ct.layout_symbol["symbol-placement"]),"symbol-spacing":new co(ct.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new co(ct.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new ho(ct.layout_symbol["symbol-sort-key"]),"symbol-z-order":new co(ct.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new co(ct.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new co(ct.layout_symbol["icon-ignore-placement"]),"icon-optional":new co(ct.layout_symbol["icon-optional"]),"icon-rotation-alignment":new co(ct.layout_symbol["icon-rotation-alignment"]),"icon-size":new ho(ct.layout_symbol["icon-size"]),"icon-text-fit":new co(ct.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new co(ct.layout_symbol["icon-text-fit-padding"]),"icon-image":new ho(ct.layout_symbol["icon-image"]),"icon-rotate":new ho(ct.layout_symbol["icon-rotate"]),"icon-padding":new co(ct.layout_symbol["icon-padding"]),"icon-keep-upright":new co(ct.layout_symbol["icon-keep-upright"]),"icon-offset":new ho(ct.layout_symbol["icon-offset"]),"icon-anchor":new ho(ct.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new co(ct.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new co(ct.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new co(ct.layout_symbol["text-rotation-alignment"]),"text-field":new ho(ct.layout_symbol["text-field"]),"text-font":new ho(ct.layout_symbol["text-font"]),"text-size":new ho(ct.layout_symbol["text-size"]),"text-max-width":new ho(ct.layout_symbol["text-max-width"]),"text-line-height":new ho(ct.layout_symbol["text-line-height"]),"text-letter-spacing":new ho(ct.layout_symbol["text-letter-spacing"]),"text-justify":new ho(ct.layout_symbol["text-justify"]),"text-radial-offset":new ho(ct.layout_symbol["text-radial-offset"]),"text-variable-anchor":new co(ct.layout_symbol["text-variable-anchor"]),"text-anchor":new ho(ct.layout_symbol["text-anchor"]),"text-max-angle":new co(ct.layout_symbol["text-max-angle"]),"text-writing-mode":new co(ct.layout_symbol["text-writing-mode"]),"text-rotate":new ho(ct.layout_symbol["text-rotate"]),"text-padding":new co(ct.layout_symbol["text-padding"]),"text-keep-upright":new co(ct.layout_symbol["text-keep-upright"]),"text-transform":new ho(ct.layout_symbol["text-transform"]),"text-offset":new ho(ct.layout_symbol["text-offset"]),"text-allow-overlap":new co(ct.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new co(ct.layout_symbol["text-ignore-placement"]),"text-optional":new co(ct.layout_symbol["text-optional"])}),Tp={paint:new po({"icon-opacity":new ho(ct.paint_symbol["icon-opacity"]),"icon-color":new ho(ct.paint_symbol["icon-color"]),"icon-halo-color":new ho(ct.paint_symbol["icon-halo-color"]),"icon-halo-width":new ho(ct.paint_symbol["icon-halo-width"]),"icon-halo-blur":new ho(ct.paint_symbol["icon-halo-blur"]),"icon-translate":new co(ct.paint_symbol["icon-translate"]),"icon-translate-anchor":new co(ct.paint_symbol["icon-translate-anchor"]),"text-opacity":new ho(ct.paint_symbol["text-opacity"]),"text-color":new ho(ct.paint_symbol["text-color"],{runtimeType:wt,getOverride:function(e){return e.textColor},hasOverride:function(e){return!!e.textColor}}),"text-halo-color":new ho(ct.paint_symbol["text-halo-color"]),"text-halo-width":new ho(ct.paint_symbol["text-halo-width"]),"text-halo-blur":new ho(ct.paint_symbol["text-halo-blur"]),"text-translate":new co(ct.paint_symbol["text-translate"]),"text-translate-anchor":new co(ct.paint_symbol["text-translate-anchor"])}),layout:kp},Ep=function(){function e(t){d(this,e),this.type=t.property.overrides?t.property.overrides.runtimeType:_t,this.defaultValue=t}return p(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}();ia(Ep,"FormatSectionOverride",{omit:["defaultValue"]});var Sp=function(e){v(i,e);var t=m(i);function i(e){return d(this,i),t.call(this,e,Tp)}return p(i,[{key:"recalculate",value:function(e,t){o(s(i.prototype),"recalculate",this).call(this,e,t),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));var r=this.layout.get("text-writing-mode");if(r){var n,a=[],l=f(r);try{for(l.s();!(n=l.n()).done;){var u=n.value;a.indexOf(u)<0&&a.push(u)}}catch(c){l.e(c)}finally{l.f()}this.layout._values["text-writing-mode"]=a}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=this.layout.get(e).evaluate(t,{},i,r),a=this._unevaluatedLayout._values[e];return a.isDataDriven()||nn(a.value)||!n?n:function(e,t){return t.replace(/{([^{}]+)}/g,(function(t,i){return i in e?String(e[i]):""}))}(t.properties,n)}},{key:"createBucket",value:function(e){return new wp(e)}},{key:"queryRadius",value:function(){return 0}},{key:"queryIntersectsFeature",value:function(){return!1}},{key:"_setPaintOverrides",value:function(){var e,t=f(Tp.paint.overridableProperties);try{for(t.s();!(e=t.n()).done;){var r=e.value;if(i.hasPaintOverride(this.layout,r)){var n=this.paint.get(r),a=new Ep(n),o=new rn(a,n.property.specification),s=null;s="constant"===n.value.kind||"source"===n.value.kind?new on("source",o):new sn("composite",o,n.value.zoomStops,n.value._interpolationType),this.paint._values[r]=new lo(n.property,s,n.parameters)}}}catch(l){t.e(l)}finally{t.f()}}},{key:"_handleOverridablePaintPropertyUpdate",value:function(e,t,r){return!(!this.layout||t.isDataDriven()||r.isDataDriven())&&i.hasPaintOverride(this.layout,e)}},{key:"getProgramConfiguration",value:function(e){return new As(this,e)}}],[{key:"hasPaintOverride",value:function(e,t){var i=e.get("text-field"),r=Tp.paint.properties[t],n=!1,a=function(e){var t,i=f(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=function e(t){n||(t instanceof Jt&&Ht(t.value)===St?a(t.value.sections):t instanceof ii?a(t.sections):t.eachChild(e))},s=i.value;s._styleExpression&&o(s._styleExpression.expression)}return n}}]),i}(Bs),Mp={paint:new po({"background-color":new co(ct.paint_background["background-color"]),"background-pattern":new co(ct.paint_background["background-pattern"]),"background-opacity":new co(ct.paint_background["background-opacity"])})},Ap={paint:new po({"raster-opacity":new co(ct.paint_raster["raster-opacity"]),"raster-hue-rotate":new co(ct.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new co(ct.paint_raster["raster-brightness-min"]),"raster-brightness-max":new co(ct.paint_raster["raster-brightness-max"]),"raster-saturation":new co(ct.paint_raster["raster-saturation"]),"raster-contrast":new co(ct.paint_raster["raster-contrast"]),"raster-resampling":new co(ct.paint_raster["raster-resampling"]),"raster-fade-duration":new co(ct.paint_raster["raster-fade-duration"])})},Ip=function(e){v(i,e);var t=m(i);function i(e){var r;return d(this,i),(r=t.call(this,e,{})).implementation=e,r}return p(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}(Bs),Cp={paint:new po({"sky-type":new co(ct.paint_sky["sky-type"]),"sky-atmosphere-sun":new co(ct.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new co(ct.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new co(ct.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new co(ct.paint_sky["sky-gradient-radius"]),"sky-gradient":new fo(ct.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new co(ct.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new co(ct.paint_sky["sky-atmosphere-color"]),"sky-opacity":new co(ct.paint_sky["sky-opacity"])})};function zp(e,t,i){var r=[0,0,1],n=Sl([]);return Al(n,n,i?-P(e)+Math.PI:P(e)),Ml(n,n,-P(t)),yl(r,r,n),dl(r,r)}for(var Pp={circle:function(e){v(i,e);var t=m(i);function i(e){return d(this,i),t.call(this,e,ic)}return p(i,[{key:"createBucket",value:function(e){return new Fu(e)}},{key:"queryRadius",value:function(e){var t=e;return Ju("circle-radius",this,t)+Ju("circle-stroke-width",this,t)+$u(this.paint.get("circle-translate"))}},{key:"queryIntersectsFeature",value:function(e,t,i,r,n,a,o,s){var l=ec(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 rc(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 As(this,e)}}]),i}(Bs),heatmap:function(e){v(i,e);var t=m(i);function i(e){var r;return d(this,i),(r=t.call(this,e,pc))._updateColorRamp(),r}return p(i,[{key:"createBucket",value:function(e){return new lc(e)}},{key:"_handleSpecialPaintPropertyUpdate",value:function(e){"heatmap-color"===e&&this._updateColorRamp()}},{key:"_updateColorRamp",value:function(){this.colorRamp=vc({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 Ju("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 rc(e,r,a,o,s,!0,!0,new A(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 As(this,e)}}]),i}(Bs),hillshade:function(e){v(i,e);var t=m(i);function i(e){return d(this,i),t.call(this,e,mc)}return p(i,[{key:"hasOffscreenPass",value:function(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}},{key:"getProgramIds",value:function(){return["hillshade","hillshadePrepare"]}}]),i}(Bs),fill:function(e){v(i,e);var t=m(i);function i(e){return d(this,i),t.call(this,e,th)}return p(i,[{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 As(this,e)}},{key:"recalculate",value:function(e,t){o(s(i.prototype),"recalculate",this).call(this,e,t);var r=this.paint._values["fill-outline-color"];"constant"===r.value.kind&&void 0===r.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}},{key:"createBucket",value:function(e){return new Qc(e)}},{key:"queryRadius",value:function(){return $u(this.paint.get("fill-translate"))}},{key:"queryIntersectsFeature",value:function(e,t,i,r,n,a){return!e.queryGeometry.isAboveHorizon&&Nu(Qu(e.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),a.angle,e.pixelToTileUnitsFactor),r)}},{key:"isTileClipped",value:function(){return!0}}]),i}(Bs),"fill-extrusion":function(e){v(i,e);var t=m(i);function i(e){return d(this,i),t.call(this,e,Bh)}return p(i,[{key:"createBucket",value:function(e){return new Sh(e)}},{key:"queryRadius",value:function(){return $u(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 As(this,e)}},{key:"queryIntersectsFeature",value:function(e,t,i,r,n,a,o,s,l){var u=ec(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),a.angle,e.pixelToTileUnitsFactor),c=this.paint.get("fill-extrusion-height").evaluate(t,i),d=this.paint.get("fill-extrusion-base").evaluate(t,i),p=[0,0],v=s&&a.elevation,m=a.elevation?a.elevation.exaggeration():1,y=e.tile.getBucket(this);if(v&&y instanceof Sh){var _=y.centroidVertexArray,g=l+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"===a.projection.name&&(r=Lh([r],[new A(0,0),new A(Vs,Vs)],e.tileID.canonical).map((function(e){return e.polygon})).flat());var x=function(e,t,i,r,n,a,o,s,l,u,c){return"globe"===e.projection.name?function(e,t,i,r,n,a,o,s,l,u,c){var h=[],d=[],p=e.projection.upVectorScale(c,e.center.lat,e.worldSize).metersToTile,v=[0,0,0,1],m=[0,0,0,1],y=function(e,t,i,r){e[0]=t,e[1]=i,e[2]=r,e[3]=1},_=Dh();i>0&&(i+=_),r+=_;var g,x=f(t);try{for(x.s();!(g=x.n()).done;){var b,w=g.value,k=[],T=[],E=f(w);try{for(E.s();!(b=E.n()).done;){var S=b.value,M=S.x+n.x,A=S.y+n.y,I=e.projection.projectTilePoint(M,A,c),C=e.projection.upVector(c,S.x,S.y),z=i,P=r;if(o){var D=qh(M,A,i,r,o,s,l,u);z+=D.base,P+=D.top}0!==i?y(v,I.x+C[0]*p*z,I.y+C[1]*p*z,I.z+C[2]*p*z):y(v,I.x,I.y,I.z),y(m,I.x+C[0]*p*P,I.y+C[1]*p*P,I.z+C[2]*p*P),ml(v,v,a),ml(m,m,a),k.push(new jh(v[0],v[1],v[2])),T.push(new jh(m[0],m[1],m[2]))}}catch(L){E.e(L)}finally{E.f()}h.push(k),d.push(T)}}catch(L){x.e(L)}finally{x.f()}return[h,d]}(e,t,i,r,n,a,o,s,l,u,c):o?function(e,t,i,r,n,a,o,s,l){var u,c=[],h=[],d=[0,0,0,1],p=f(e);try{for(p.s();!(u=p.n()).done;){var v,m=u.value,y=[],_=[],g=f(m);try{for(g.s();!(v=g.n()).done;){var x=v.value,b=x.x+r.x,w=x.y+r.y,k=qh(b,w,t,i,a,o,s,l);d[0]=b,d[1]=w,d[2]=k.base,d[3]=1,Tl(d,d,n),d[3]=Math.max(d[3],1e-5);var T=new jh(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,Tl(d,d,n),d[3]=Math.max(d[3],1e-5);var E=new jh(d[0]/d[3],d[1]/d[3],d[2]/d[3]);y.push(T),_.push(E)}}catch(S){g.e(S)}finally{g.f()}c.push(y),h.push(_)}}catch(S){p.e(S)}finally{p.f()}return[c,h]}(t,i,r,n,a,o,s,l,u):function(e,t,i,r,n){var a,o=[],s=[],l=n[8]*t,u=n[9]*t,c=n[10]*t,h=n[11]*t,d=n[8]*i,p=n[9]*i,v=n[10]*i,m=n[11]*i,y=f(e);try{for(y.s();!(a=y.n()).done;){var _,g=a.value,x=[],b=[],w=f(g);try{for(w.s();!(_=w.n()).done;){var k=_.value,T=k.x+r.x,E=k.y+r.y,S=n[0]*T+n[4]*E+n[12],M=n[1]*T+n[5]*E+n[13],A=n[2]*T+n[6]*E+n[14],I=n[3]*T+n[7]*E+n[15],C=S+l,z=M+u,P=A+c,D=Math.max(I+h,1e-5),L=S+d,R=M+p,B=A+v,O=Math.max(I+m,1e-5);x.push(new jh(C/D,z/D,P/D)),b.push(new jh(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]}(t,i,r,n,a)}(a,r,d,c,u,o,v?s:null,p,m,a.center.lat,e.tileID.canonical),b=h(x,2),w=b[0],k=b[1],T=e.queryGeometry;return function(e,t,i){var r=1/0;Nu(i,t)&&(r=Zh(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];Uu(i,u)&&(r=Math.min(r,Zh(i,u)))}return r!==1/0&&r}(w,k,T.isPointQuery()?T.screenBounds:T.screenGeometry)}}]),i}(Bs),line:function(e){v(i,e);var t=m(i);function i(e){var r;return d(this,i),(r=t.call(this,e,$h)).gradientVersion=0,r}return p(i,[{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 Vi,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,t){o(s(i.prototype),"recalculate",this).call(this,e,t),this.paint._values["line-floorwidth"]=Qh.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}},{key:"createBucket",value:function(e){return new Kh(e)}},{key:"getProgramIds",value:function(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}},{key:"getProgramConfiguration",value:function(e){return new As(this,e)}},{key:"queryRadius",value:function(e){var t=e,i=ef(Ju("line-width",this,t),Ju("line-gap-width",this,t)),r=Ju("line-offset",this,t);return i/2+Math.abs(r)+$u(this.paint.get("line-translate"))}},{key:"queryIntersectsFeature",value:function(e,t,i,r,n,a){if(e.queryGeometry.isAboveHorizon)return!1;var o=Qu(e.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),a.angle,e.pixelToTileUnitsFactor),s=e.pixelToTileUnitsFactor/2*ef(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 A(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(Hu(e,n[a]))return!0;if(ju(e,n,i))return!0}return!1}(o,r,s)}},{key:"isTileClipped",value:function(){return!0}}]),i}(Bs),symbol:Sp,background:function(e){v(i,e);var t=m(i);function i(e){return d(this,i),t.call(this,e,Mp)}return p(i,[{key:"getProgramIds",value:function(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}}]),i}(Bs),raster:function(e){v(i,e);var t=m(i);function i(e){return d(this,i),t.call(this,e,Ap)}return p(i,[{key:"getProgramIds",value:function(){return["raster"]}}]),i}(Bs),sky:function(e){v(i,e);var t=m(i);function i(e){var r;return d(this,i),(r=t.call(this,e,Cp))._updateColorRamp(),r}return p(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._skyboxInvalidated=!0)}},{key:"_updateColorRamp",value:function(){this.colorRamp=vc({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")&&te("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),r?zp(a.azimuthal,90-a.polar,t):zp(i[0],90-i[1],t)}var o=this.paint.get("sky-gradient-center");return zp(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}(Bs)},Dp=function(){function e(t,i,r,n){d(this,e),this.context=t,this.format=r,this.texture=t.gl.createTexture(),this.update(i,n)}return p(e,[{key:"update",value:function(e,t,i){var r=e.width,n=e.height,a=this.context,o=a.gl,s=_.HTMLImageElement,l=_.HTMLCanvasElement,u=_.HTMLVideoElement,c=_.ImageData,h=_.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}(),Lp=function(){function e(t){var i=this;d(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 p(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}(),Rp=function(){function e(){d(this,e),this.tasks={},this.taskQueue=[],Y(["process"],this),this.invoker=new Lp(this.process),this.nextId=0}return p(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){ne();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;ne();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}(),Bp=function(){function e(t){d(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 p(e,[{key:"encode",value:function(e){return this._stringToNumber[e]}},{key:"decode",value:function(e){return this._numberToString[e]}}]),e}(),Op=["tile","layer","source","sourceLayer","state"],Fp=function(){function e(t,i,r,n,a){d(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 p(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);for(var t=0,i=Op;t<i.length;t++){var r=i[t];void 0!==this[r]&&(e[r]=this[r])}return e}}]),e}(),Up=32,Vp=33,Np=new Uint16Array(8184),jp=0;jp<2046;jp++){var Gp=jp+2,Zp=0,qp=0,Wp=0,Xp=0,Hp=0,Yp=0;for(1&Gp?Wp=Xp=Hp=Up:Zp=qp=Yp=Up;(Gp>>=1)>1;){var Kp=Zp+Wp>>1,Jp=qp+Xp>>1;1&Gp?(Wp=Zp,Xp=qp,Zp=Hp,qp=Yp):(Zp=Wp,qp=Xp,Wp=Hp,Xp=Yp),Hp=Kp,Yp=Jp}var $p=4*jp;Np[$p+0]=Zp,Np[$p+1]=qp,Np[$p+2]=Wp,Np[$p+3]=Xp}var Qp=new Uint16Array(2178),ev=new Uint8Array(1089),tv=new Uint16Array(1089);function iv(e){return 0===e?-.03125:32===e?.03125:0}var rv=go([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),nv={type:2,extent:Vs,loadGeometry:function(){return[[new A(0,0),new A(8193,0),new A(8193,8193),new A(0,8193),new A(0,0)]]}},av=function(){function e(t,i,r,n,a){d(this,e),this.tileID=t,this.uid=q(),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 p(e,[{key:"registerFadeDuration",value:function(e){var t=e+this.timeAdded;t<nt.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=Wd(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=f(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=f(n);try{for(o.s();!(a=o.n()).done;){var s=a.value;i[s.id]=e}}catch(l){o.e(l)}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 wp){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 wp&&o.hasRTLText){this.hasRTLText=!0,eo.isLoading()||eo.isLoaded()||"deferred"!==$a()||Qa();break}}for(var s in this.queryPadding=0,this.buckets){var l=this.buckets[s];this.queryPadding=Math.max(this.queryPadding,t.style.getLayer(s).queryRadius(l))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage),e.lineAtlas&&(this.lineAtlas=e.lineAtlas)}else this.collisionBoxArray=new Xo}},{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 Dp(e,this.imageAtlas.image,r.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Dp(e,this.glyphAtlasImage,r.ALPHA),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new Dp(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=xn(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=Ru(d,!0);if(!o.filter(new to(this.tileID.overscaledZ),p,this.tileID.canonical))continue}else if(!o.filter(new to(this.tileID.overscaledZ),d))continue;var v=i.getId(d,n),m=new Fp(d,l,u,c,v);m.tile=h,e.push(m)}}}},{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=ae(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 Kh||a instanceof Qc){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<nt.now()}},{key:"clearFadeHold",value:function(){this.symbolFadeHoldUntil=void 0}},{key:"setHoldDuration",value:function(e){this.symbolFadeHoldUntil=nt.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 Dp(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=f(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=f(e);try{for(r.s();!(i=r.n()).done;){var n=i.value,a=this.dependencies[n];if(a){var o,s=f(t);try{for(s.s();!(o=s.n()).done;)if(a[o.value])return!0}catch(l){s.e(l)}finally{s.f()}}}}catch(l){r.e(l)}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=Lu(nv,this.tileID.canonical,this.tileTransform)[0],r=new bo,n=new Zo,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,Pl.members),this._tileDebugSegments=Us.simpleSegment(0,0,r.length,n.length)}}},{key:"_makeTileBoundsBuffers",value:function(e,t){if(!this._tileBoundsBuffer&&t&&"mercator"!==t.name){var i,r,n=Lu(nv,this.tileID.canonical,this.tileTransform)[0];if(this.isRaster){var a=function(e,t){for(var i=Wd(e,t),r=Math.pow(2,e.z),n=0;n<Vp;n++)for(var a=0;a<Vp;a++){var o=bu((e.x+(a+iv(a))/Up)/r),s=wu((e.y+(n+iv(n))/Up)/r),l=t.project(o,s),u=n*Vp+a;Qp[2*u+0]=Math.round((l.x*i.scale-i.x)*Vs),Qp[2*u+1]=Math.round((l.y*i.scale-i.y)*Vs)}ev.fill(0),tv.fill(0);for(var c=2045;c>=0;c--){var h=4*c,f=Np[h+0],d=Np[h+1],p=Np[h+2],v=Np[h+3],m=f+p>>1,y=d+v>>1,_=m+y-d,g=y+f-m,x=d*Vp+f,b=v*Vp+p,w=y*Vp+m,k=Math.hypot((Qp[2*x+0]+Qp[2*b+0])/2-Qp[2*w+0],(Qp[2*x+1]+Qp[2*b+1])/2-Qp[2*w+1])>=16;if(ev[w]=ev[w]||(k?1:0),c<1022){var T=(d+g>>1)*Vp+(f+_>>1),E=(v+g>>1)*Vp+(p+_>>1);ev[w]=ev[w]||ev[T]||ev[E]}}var S=new ko,M=new Oo,A=0;function I(e,t){var i=t*Vp+e;return 0===tv[i]&&(S.emplaceBack(Qp[2*i+0],Qp[2*i+1],e*Vs/Up,t*Vs/Up),tv[i]=++A),tv[i]-1}function C(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&&ev[s*Vp+o])C(n,a,e,t,o,s),C(i,r,n,a,o,s);else{var l=I(e,t),u=I(i,r),c=I(n,a);M.emplaceBack(l,u,c)}}return C(0,0,Up,Up,Up,0),C(Up,Up,0,0,0,Up),{vertices:S,indices:M}}(this.tileID.canonical,t);i=a.vertices,r=a.indices}else{i=new ko,r=new Oo;var o,s=f(n);try{for(s.s();!(o=s.n()).done;){var l=o.value,u=l.x,c=l.y;i.emplaceBack(u,c,0,0)}}catch(p){s.e(p)}finally{s.f()}for(var h=_c(i.int16,void 0,4),d=0;d<h.length;d+=3)r.emplaceBack(h[d],h[d+1],h[d+2])}this._tileBoundsBuffer=e.createVertexBuffer(i,rv.members),this._tileBoundsIndexBuffer=e.createIndexBuffer(r),this._tileBoundsSegments=Us.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=au(Yl(n,t)),o=lu(t.zoom);o>0&&(r=Xs(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=iu(e,t,i);if(a){var l=1<<i.z,u=_u(r.center.lng),c=gu(r.center.lat),h=(i.x+.5)/l-u,f=0;h>.5?f=-1:h<-.5&&(f=1);var d=(e/Vs+i.x)/l+f,p=(t/Vs+i.y)/l;d=(d-u)*r._pixelsPerMercatorPixel+u,p=(p-c)*r._pixelsPerMercatorPixel+c;var v=[d*r.worldSize,p*r.worldSize,0];ml(v,v,a),s=Hl(s,v,o)}return ml(s,s,n)}},{key:"_makeGlobeTileDebugBorderBuffer",value:function(e,t,i,r,n,a){var o=this,s=new bo,l=new Zo,u=new wo,c=function(e,c,h,f,d){for(var p=(h-e)/(d-1),v=(f-c)/(d-1),m=s.length,y=0;y<d;y++){var _=e+y*p,g=c+y*v;s.emplaceBack(_,g);var x=o._globePoint(_,g,t,i,r,n,a);u.emplaceBack(x[0],x[1],x[2]),l.emplaceBack(m+y)}},h=Vs;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,Pl.members),this._globeTileDebugBorderBuffer=e.createVertexBuffer(u,zl.members),this._tileDebugSegments=Us.simpleSegment(0,0,s.length,l.length)}},{key:"_makeGlobeTileDebugTextBuffer",value:function(e,t,i,r,n,a){var o=new bo,s=new Oo,l=new wo,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 v=this._globePoint(p,f,t,i,r,n,a);l.emplaceBack(v[0],v[1],v[2])}for(var m=0;m<4;m++)for(var y=0;y<4;y++){var _=c(m,y),g=c(m,y+1),x=c(m+1,y),b=c(m+1,y+1);s.emplaceBack(_,g,x),s.emplaceBack(x,g,b)}this._tileDebugTextIndexBuffer=e.createIndexBuffer(s),this._tileDebugTextBuffer=e.createVertexBuffer(o,Pl.members),this._globeTileDebugTextBuffer=e.createVertexBuffer(l,zl.members),this._tileDebugTextSegments=Us.simpleSegment(0,0,u,32)}}]),e}(),ov=function(){function e(){d(this,e),this.state={},this.stateChanges={},this.deletedStates={}}return p(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]||{},G(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=G({},(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]={}),G(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]||{},G(i[o],s)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(i).length)for(var d in e)e[d].setFeatureState(i,t)}}]),e}(),sv=function(){function e(t){d(this,e),this.size=t,this.minimums=[],this.maximums=[],this.leaves=[]}return p(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 lv(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 uv(e,t,i,r,n,a,o,s,l,u,c){var h=r-e,f=n-t,d=a-i,p=o-e,v=s-t,m=l-i,y=c[1]*m-c[2]*v,_=c[2]*p-c[0]*m,g=c[0]*v-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 S=k*d-T*f,M=T*h-w*d,A=w*f-k*h,I=(c[0]*S+c[1]*M+c[2]*A)*b;return I<0||E+I>1?null:(p*S+v*M+m*A)*b}function cv(e,t,i){return(e-t)/(i-t)}function hv(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 fv=function(){function e(t){if(d(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 sv(r),s=[],l=0;l<r*r;l++){a(l%r,Math.floor(l/r),n,!1,s);var u=pv(s[0],s[1],e),c=pv(s[2],s[1],e),h=pv(s[2],s[3],e),f=pv(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 sv(r);for(var p=0;p<r*r;p++){a(p%r,Math.floor(p/r),2,!0,s);var v=d.getElevation(s[0],s[1]),m=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(v.min,m.min,y.min,_.min),T=Math.max(v.max,m.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 p(e,[{key:"raycastRoot",value:function(e,t,i,r,n,a){var o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1;return lv([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,v=d.t,m=d.nodex,y=d.nodey,_=d.depth;if(this.leaves[p]){hv(m,y,_,e,t,i,r,c,h);var g=1<<_,x=(m+0)/g,b=(m+1)/g,w=(y+0)/g,k=(y+1)/g,T=pv(x,w,this.dem)*o,E=pv(b,w,this.dem)*o,S=pv(b,k,this.dem)*o,M=pv(x,k,this.dem)*o,A=uv(c[0],c[1],T,h[0],c[1],E,h[0],h[1],S,n,a),I=uv(h[0],h[1],S,c[0],h[1],M,c[0],c[1],T,n,a),C=Math.min(null!==A?A:Number.MAX_VALUE,null!==I?I:Number.MAX_VALUE);if(C!==Number.MAX_VALUE)return C;var z=fl([],n,a,v);if(dv(T,E,M,S,cv(z[0],c[0],h[0]),cv(z[1],c[1],h[1]))>=z[2])return v}else{for(var P=0,D=0;D<this._siblingOffset.length;D++){hv((m<<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=lv(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:(m<<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 v=0;v<this._siblingOffset.length;v++)s&1<<v||this._construct(e,2*t+this._siblingOffset[v][0],2*i+this._siblingOffset[v][1],a,l+v)}}}]),e}();function dv(e,t,i,r,n,a){return Ni(Ni(e,i,a),Ni(t,r,a),n)}function pv(e,t,i){var r=i.dim,n=F(e*r-.5,0,r-1),a=F(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 dv(i.get(o,s),i.get(l,s),i.get(o,u),i.get(l,u),n-o,a-s)}var vv={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function mv(e,t,i){return(256*e*256+256*t+i)/10-1e4}function yv(e,t,i){return 256*e+t+i/256-32768}var _v=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(d(this,e),this.uid=t,i.height!==i.width)throw new RangeError("DEM tiles must be square");if(r&&"mapbox"!==r&&"terrarium"!==r)return te('"'.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 p(e,[{key:"tree",get:function(){return this._tree||this._buildQuadTree(),this._tree}},{key:"_buildQuadTree",value:function(){this._tree=new fv(this)}},{key:"get",value:function(e,t){arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&(e=F(e,-1,this.dim),t=F(t,-1,this.dim));var i=4*this._idx(e,t);return("terrarium"===this.encoding?yv:mv)(this.pixels[i],this.pixels[i+1],this.pixels[i+2])}},{key:"unpackVector",get:function(){return vv[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 dc({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 vv[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}();ia(_v,"DEMData"),ia(fv,"DemMinMaxQuadTree",{omit:["dem"]});var gv=function(){function e(t,i){d(this,e),this.max=t,this.onRemove=i,this.reset()}return p(e,[{key:"reset",value:function(){for(var e in this.data){var t,i=f(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}},{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=f(this.data[i]);try{for(n.s();!(r=n.n()).done;){var a=r.value;e(a.value)||t.push(a)}}catch(u){n.e(u)}finally{n.f()}}for(var o=0,s=t;o<s.length;o++){var l=s[o];this.remove(l.value.tileID,l)}}}]),e}(),xv=p((function e(t,i,r){d(this,e),this.func=t,this.mask=i,this.range=r}));xv.ReadOnly=!1,xv.ReadWrite=!0,xv.disabled=new xv(519,xv.ReadOnly,[0,1]);var bv=7680,wv=p((function e(t,i,r,n,a,o){d(this,e),this.test=t,this.ref=i,this.mask=r,this.fail=n,this.depthFail=a,this.pass=o}));wv.disabled=new wv({func:519,mask:0},0,0,bv,bv,bv);var kv=p((function e(t,i,r){d(this,e),this.blendFunction=t,this.blendColor=i,this.mask=r}));kv.Replace=[1,0],kv.disabled=new kv(kv.Replace,Nt.transparent,[!1,!1,!1,!1]),kv.unblended=new kv(kv.Replace,Nt.transparent,[!0,!0,!0,!0]),kv.alphaBlended=new kv([1,771],Nt.transparent,[!0,!0,!0,!0]);var Tv=1029,Ev=2305,Sv=p((function e(t,i,r){d(this,e),this.enable=t,this.mode=i,this.frontFace=r}));Sv.disabled=new Sv(!1,Tv,Ev),Sv.backCCW=new Sv(!0,Tv,Ev),Sv.backCW=new Sv(!0,Tv,2304),Sv.frontCW=new Sv(!0,1028,2304),Sv.frontCCW=new Sv(!0,1028,Ev);var Mv=function(e){v(i,e);var t=m(i);function i(e,r,a){var o;return d(this,i),(o=t.call(this)).id=e,o._onlySymbols=a,r.on("data",(function(e){"source"===e.dataType&&"metadata"===e.sourceDataType&&(o._sourceLoaded=!0),o._sourceLoaded&&!o._paused&&"source"===e.dataType&&"content"===e.sourceDataType&&(o.reload(),o.transform&&o.update(o.transform))})),r.on("error",(function(){o._sourceErrored=!0})),o._source=r,o._tiles={},o._cache=new gv(0,o._unloadTile.bind(n(o))),o._timers={},o._cacheTimers={},o._minTileCacheSize=r.minTileCacheSize,o._maxTileCacheSize=r.maxTileCacheSize,o._loadedParentTiles={},o._coveredTiles={},o._state=new ov,o._isRaster="raster"===o._source.type||"raster-dem"===o._source.type||"custom"===o._source.type&&"raster"===o._source._dataType,o}return p(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)return!1;if(!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 j(this._tiles).map((function(e){return e.tileID})).sort(Av).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 A(r.canonical.x,r.canonical.y)._rotate(t.transform.angle),o=new A(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(Av).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 lt(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)}else this.update(this.transform);else e.timeAdded=nt.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 st("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 Vh(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(Iv(this._source.type)&&0!==a.length){for(var s={},l={},u=0,c=Object.keys(o);u<c.length;u++){var h=c[u],d=o[h],p=this._tiles[h];if(p&&!(p.fadeEndTime&&p.fadeEndTime<=nt.now())){var v=this.findLoadedParent(d,Math.max(d.overscaledZ-i.maxOverzooming,this._source.minzoom));v&&(this._addTile(v.tileID),s[v.tileID.key]=v.tileID),l[h]=d}}var m=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>m;){g=g.scaledTo(g.overscaledZ-1);var x=this._tiles[g.key];if(x&&x.hasData()&&l[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=function(e,t){var i=[];for(var r in e)r in t||i.push(r);return i}(this._tiles,o),E=f(T);try{for(E.s();!(k=E.n()).done;){var S=k.value,M=this._tiles[S];M.hasSymbolBuckets&&!M.holdingForFade()?M.setHoldDuration(this.map._fadeDuration):M.hasSymbolBuckets&&!M.symbolFadeFinished()||this._removeTile(+S)}}catch(A){E.e(A)}finally{E.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={},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),l=Math.max(o+i.maxUnderzooming,this._source.minzoom),u={},c=f(e);try{for(c.s();!(r=c.n()).done;){var h=r.value,d=this._addTile(h);t[h.key]=h,d.hasData()||a<this._source.maxzoom&&(u[h.key]=h)}}catch(T){c.e(T)}finally{c.f()}this._retainLoadedChildren(u,a,l,t);var p,v=f(e);try{for(v.s();!(p=v.n()).done;){var m=p.value,y=this._tiles[m.key];if(!y.hasData()){if(m.canonical.z>=this._source.maxzoom){var _=m.children(this._source.maxzoom)[0],g=this.getTile(_);if(g&&g.hasData()){t[_.key]=_;continue}}else{var x=m.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=m.overscaledZ-1;w>=s;--w){var k=m.scaledTo(w);if(n[k.key])break;if(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){v.e(T)}finally{v.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 av(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 st("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 r=[],n=this.transform;if(!n)return r;var a="globe"===n.projection.name,o=_u(n.center.lng);for(var s in this._tiles){var l=this._tiles[s];if(i&&l.clearQueryDebugViz(),!l.holdingForFade()){var u=void 0;if(a){var h=l.tileID.canonical;if(0===h.z){var d=[Math.abs(F.apply(void 0,[o].concat(c(Cv(h,-1))))-o),Math.abs(F.apply(void 0,[o].concat(c(Cv(h,1))))-o)];u=[0,2*d.indexOf(Math.min.apply(Math,d))-1]}else{var p=[Math.abs(F.apply(void 0,[o].concat(c(Cv(h,-1))))-o),Math.abs(F.apply(void 0,[o].concat(c(Cv(h,0))))-o),Math.abs(F.apply(void 0,[o].concat(c(Cv(h,1))))-o)];u=[p.indexOf(Math.min.apply(Math,p))-1]}}else u=[0];var v,m=f(u);try{for(m.s();!(v=m.n()).done;){var y=v.value,_=e.containsTile(l,n,t,y);_&&r.push(_)}}catch(g){m.e(g)}finally{m.f()}}}return r}},{key:"getVisibleCoordinates",value:function(e){var t,i=this,r=this.getRenderableIds(e).map((function(e){return i._tiles[e].tileID})),n=f(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;if(Iv(this._source.type))for(var e in this._tiles){var t=this._tiles[e];if(void 0!==t.fadeEndTime&&t.fadeEndTime>=nt.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,l=f(a);try{for(l.s();!(i=l.n()).done;){var u,c=i.value,h=c.coveringTiles({tileSize:s,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),d=f(h);try{for(d.s();!(u=d.n()).done;){var p=u.value;n.set(p.key,p)}}catch(v){d.e(v)}finally{d.f()}this.usedForTerrain&&c.updateElevation(!1)}}catch(v){l.e(v)}finally{l.f()}N(Array.from(n.values()),(function(e,t){var i=new av(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}(ut);function Av(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 Iv(e){return"raster"===e||"image"===e||"video"===e||"custom"===e}function Cv(e,t){var i=1<<e.z;return[e.x/i+t,(e.x+1)/i+t]}Mv.maxOverzooming=10,Mv.maxUnderzooming=3;var zv=function(){function e(t,i,r){d(this,e),this._demTile=t,this._dem=this._demTile.dem,this._scale=i,this._offset=r}return p(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 A(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?Ni(Ni(l.get(o,s,r),l.get(o,s+1,r),a-s),Ni(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)*xu(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/Vs/s,[(i.canonical.x/s-o.canonical.x)*a.dim,(i.canonical.y/s-o.canonical.y)*a.dim])}}}]),e}(),Pv=function(){function e(t,i){d(this,e),this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Qn(Vs,16,0),this.featureIndexArray=new ts,this.promoteId=i}return p(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]<Vs&&c[1]<Vs&&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 _h(new gf(this.rawTileData)).layers,this.sourceLayerCoder=new Bp(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=xn(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 Yu(s.bufferedTilespaceGeometry,e,t,i,r)}));c.sort(Lv);var h=null;l.elevation&&c.length>0&&(h=zv.create(l.elevation,this.tileID));for(var f,d={},p=function(){var l=c[v];if(l===f)return"continue";f=l;var u=n.featureIndexArray.get(l),p=null;n.loadMatchingFeature(d,u,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 p||(p=Lu(t,n.tileID.canonical,e.tileTransform)),i.queryIntersectsFeature(s,t,r,p,n.z,e.transform,e.pixelPosMatrix,h,a)}))},v=0;v<c.length;v++)p();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),v=this.vtLayers[p].feature(u);if(i.needGeometry){var m=Ru(v,!0);if(!i.filter(new to(this.tileID.overscaledZ),m,this.tileID.canonical))return}else if(!i.filter(new to(this.tileID.overscaledZ),v))return;for(var y=this.getId(v,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=G({},o[g]);w.paint=Dv(w.paint,x.paint,v,b,n),w.layout=Dv(w.layout,x.layout,v,b,n);var k=!l||l(v,x,b,f);if(k){var T=new Fp(v,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 l={};this.loadVTLayers();var u,c=xn(n),h=f(e);try{for(h.s();!(u=h.n()).done;){var d=u.value;this.loadMatchingFeature(l,{bucketIndex:i,sourceLayerIndex:r,featureIndex:d,layoutVertexArrayOffset:0},c,a,o,s,t)}}catch(p){h.e(p)}finally{h.f()}return l}},{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=f(this.bucketLayerIDs);try{for(i.s();!(t=i.n()).done;){var r,n=t.value,a=f(n);try{for(a.s();!(r=a.n()).done;)if(e===r.value)return!0}catch(o){a.e(o)}finally{a.f()}}}catch(o){i.e(o)}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 Dv(e,t,i,r,n){return J(e,(function(e,a){var o=t instanceof uo?t.get(a):null;return o&&o.evaluate?o.evaluate(i,r,n):o}))}function Lv(e,t){return t-e}ia(Pv,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});var Rv=function(){function e(t,i){d(this,e),this.width=t,this.height=i,this.nextRow=0,this.image=new fc({width:t,height:i}),this.positions={},this.uploaded=!1}return p(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=X(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 te("LineAtlas out of space"),null;0===e.length&&e.push(1);for(var o=0,s=0;s<e.length;s++)e[s]<0&&(te("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}();ia(Rv,"LineAtlas");var Bv=p((function e(t){d(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 h=Zf(r),f=h.w,p=h.h,v=new fc({width:f||1,height:p||1});for(var m in t){var y=t[m];for(var _ in y.glyphs){var g=y.glyphs[+_];if(g&&0!==g.bitmap.width&&0!==g.bitmap.height){var x=i[m][_],b=g.metrics.localGlyph?2:1;fc.copy(g.bitmap,v,{x:0,y:0},{x:x.x+b,y:x.y+b},g.bitmap)}}}this.image=v,this.positions=i}));ia(Bv,"GlyphAtlas");var Ov=function(){function e(t){d(this,e),this.tileID=new Vh(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=Wd(t.tileID.canonical,t.projection),this.projection=t.projection}return p(e,[{key:"parse",value:function(e,t,i,r,n){var a=this;this.status="parsing",this.data=e,this.collisionBoxArray=new Xo;var o=new Bp(Object.keys(e.layers).sort()),s=new Pv(this.tileID,this.promoteId);s.bucketLayerIDs=[];var l,u,c,h,d={},p=new Rv(256,256),v={featureIndex:s,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:p,availableImages:i},m=t.familiesBySource[this.source];for(var y in m){var _=e.layers[y];if(_){var g,x=!1,b=!1,w=f(m[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&&te('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 S=_.feature(E),M=s.getId(S,y);T.push({feature:S,id:M,index:E,sourceLayerIndex:k})}var A,I=f(m[y]);try{for(I.s();!(A=I.n()).done;){var C=A.value,z=C[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&&(Fv(C,this.zoom,i),(d[z.id]=z.createBucket({index:s.bucketLayerIDs.length,layers:C,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,v,this.tileID.canonical,this.tileTransform),s.bucketLayerIDs.push(C.map((function(e){return e.id}))))}}catch(O){I.e(O)}finally{I.f()}}}}p.trim();var P={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},D=J(v.glyphDependencies,(function(e){return Object.keys(e).map(Number)}));Object.keys(D).length?r.send("getGlyphs",{uid:this.uid,stacks:D},(function(e,t){l||(l=e,u=t,B.call(a))}),void 0,!1,P):u={};var L=Object.keys(v.iconDependencies);L.length?r.send("getImages",{icons:L,source:this.source,tileID:this.tileID,type:"icons"},(function(e,t){l||(l=e,c=t,B.call(a))}),void 0,!1,P):c={};var R=Object.keys(v.patternDependencies);function B(){if(l)return n(l);if(u&&c&&h){var e=new Bv(u),t=new Wf(c,h);for(var r in d){var a=d[r];a instanceof wp?(Fv(a.layers,this.zoom,i),Bd(a,u,e.positions,c,t.iconPositions,this.showCollisionBoxes,i,this.tileID.canonical,this.tileZoom,this.projection)):a.hasPattern&&(a instanceof Kh||a instanceof Qc||a instanceof Sh)&&(Fv(a.layers,this.zoom,i),a.addFeatures(v,this.tileID.canonical,t.patternPositions,i,this.tileTransform))}this.status="done",n(null,{buckets:j(d).filter((function(e){return!e.isEmpty()})),featureIndex:s,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,lineAtlas:p,imageAtlas:t,glyphMap:this.returnDependencies?u:null,iconMap:this.returnDependencies?c: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){l||(l=e,h=t,B.call(a))}),void 0,!1,P):h={},B.call(this)}}]),e}();function Fv(e,t,i){var r,n=new to(t),a=f(e);try{for(a.s();!(r=a.n()).done;)r.value.recalculate(n,i)}catch(o){a.e(o)}finally{a.f()}}var Uv=function(){function e(t){d(this,e),this.entries={},this.scheduler=t}return p(e,[{key:"request",value:function(e,t,i,r){var n=this,a=this.entries[e]=this.entries[e]||{callbacks:[]};if(a.result){var o=h(a.result,2),s=o[0],l=o[1];return this.scheduler?this.scheduler.add((function(){r(s,l)}),t):r(s,l),function(){}}return a.callbacks.push(r),a.cancel||(a.cancel=i((function(i,r){a.result=[i,r];var o,s=f(a.callbacks);try{var l=function(){var e=o.value;n.scheduler?n.scheduler.add((function(){e(i,r)}),t):e(i,r)};for(s.s();!(o=s.n()).done;)l()}catch(u){s.e(u)}finally{s.f()}setTimeout((function(){return delete n.entries[e]}),3e3)}))),function(){a.result||(a.callbacks=a.callbacks.filter((function(e){return e!==r})),a.callbacks.length||(a.cancel(),delete n.entries[e]))}}}]),e}();function Vv(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=ke(e.request,(function(e,r,n,a){e?t(e):r&&t(null,{vectorTile:i?void 0:new _h(new gf(r)),rawData:r,cacheControl:n,expires:a})}));return function(){r.cancel(),t()}}),t)}e.ARRAY_TYPE=Gs,e.AUTH_ERR_MSG=Ie,e.Aabb=Bl,e.Actor=function(){function e(t,i,r){d(this,e),this.target=t,this.parent=i,this.mapId=r,this.callbacks={},this.cancelCallbacks={},Y(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.globalScope=ne()?t:_,this.scheduler=new Rp}return p(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=se(this.globalScope)?void 0:[];return this.target.postMessage({id:s,type:e,hasCallback:!!i,targetMapId:r,mustQueue:a,sourceMapId:this.mapId,data:oa(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||ne()){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(sa(t.error)):r(null,sa(t.data)))}else{var n=se(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?oa(t):null,data:oa(r,n)},n)}:function(e){},o=sa(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=Fh,e.Color=Nt,e.ColorMode=kv,e.CullFaceMode=Sv,e.DEMData=_v,e.DataConstantProperty=co,e.DedupedRequest=Uv,e.DepthMode=xv,e.EXTENT=Vs,e.Elevation=function(){function e(){d(this,e)}return p(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 Vh(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)return t;if(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 Vh(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),v=Math.floor(d);return(i?this.exaggeration():1)*Ni(Ni(c.get(p,v),c.get(p,v+1),d-v),Ni(c.get(p+1,v),c.get(p+1,v+1),d-v),f-p)}},{key:"getAtTileOffset",value:function(e,t,i){var r=1<<e.canonical.z;return this.getAtPointOrZero(new Su(e.wrap+(e.canonical.x+t/Vs)/r,(e.canonical.y+i/Vs)/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 hl(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=zv.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=lt,e.EvaluationParameters=to,e.Event=st,e.Evented=ut,e.FillExtrusionBucket=Sh,e.Frustum=Rl,e.FrustumCorners=Ll,e.GLOBE_RADIUS=Ol,e.GLOBE_SCALE_MATCH_LATITUDE=45,e.GLOBE_ZOOM_THRESHOLD_MAX=6,e.GLOBE_ZOOM_THRESHOLD_MIN=5,e.GlobeSharedBuffers=function(){function e(t){d(this,e),this._createGrid(t),this._createPoles(t)}return p(e,[{key:"destroy",value:function(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();var e,t=f(this._poleSegments);try{for(t.s();!(e=t.n()).done;)e.value.destroy()}catch(s){t.e(s)}finally{t.f()}var i,r=f(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=f(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 bo,r=new Oo,n=[],a=e+1+2,o=t[0]+1,s=t[0]+1+(1+t.length),l=function(e,t,i){var r=e===a-1?e-2:0===e?e:e-1;return[r+=i?24575:0,t]},u=0;u<a;++u)i.emplaceBack.apply(i,c(l(u,0,!0)));for(var h=0;h<o;++h)for(var f=0;f<a;++f)i.emplaceBack.apply(i,c(l(f,h,(0===f||f===a-1)&&!0)));for(var d=0;d<t.length;++d)for(var p=t[d],v=0;v<a;++v)i.emplaceBack.apply(i,c(l(v,p,!0)));for(var m=0;m<t.length;++m){for(var y=r.length,_=t[m]+1+2,g=new Oo,x=0;x<_-1;x++)for(var b=x===_-2,w=b?a*(s-t.length+m-x):a,k=0;k<a-1;k++){var T=x*a+k;0===x||b||0===k||k===a-2?(g.emplaceBack(T+1,T,T+w),g.emplaceBack(T+w,T+w+1,T+1)):(r.emplaceBack(T+1,T,T+w),r.emplaceBack(T+w,T+w+1,T+1))}for(var E=Us.simpleSegment(0,y,i.length,r.length-y),S=0;S<g.uint16.length;S+=3)r.emplaceBack(g.uint16[S],g.uint16[S+1],g.uint16[S+2]);var M=Us.simpleSegment(0,y,i.length,r.length-y);n.push({withoutSkirts:E,withSkirts:M})}return{vertices:i,indices:r,segments:n}}},{key:"_createGrid",value:function(e){var t=this._fillGridMeshWithLods(Fl,Ul);this._gridSegments=t.segments,this._gridBuffer=e.createVertexBuffer(t.vertices,Pl.members),this._gridIndexBuffer=e.createIndexBuffer(t.indices,!0)}},{key:"_createPoles",value:function(e){for(var t=new Oo,i=0;i<=Fl;i++)t.emplaceBack(0,i+1,i+2);this._poleIndexBuffer=e.createIndexBuffer(t,!0);var r=new No,n=new No;this._poleSegments=[];for(var a=0,o=0;a<5;a++){var s=360/(1<<a);r.emplaceBack(0,-Ol,0,.5,0),n.emplaceBack(0,-Ol,0,.5,1);for(var l=0;l<=Fl;l++){var u=l/Fl,c=Ni(0,s,u),f=eu(fu,du,c,Ol),d=h(f,3),p=d[0],v=d[1],m=d[2];r.emplaceBack(p,v,m,u,0),n.emplaceBack(p,v,m,u,1)}this._poleSegments.push(Us.simpleSegment(o,0,66,64)),o+=66}this._poleNorthVertexBuffer=e.createVertexBuffer(r,Cl,!1),this._poleSouthVertexBuffer=e.createVertexBuffer(n,Cl,!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 Go,r=Fl,n=r+1+2,a=1;this._wireframeSegments=[];for(var o=0,s=0;o<Ul.length;o++){for(var l=Ul[o],u=a;u<l+a;u++)for(var c=a;c<r+a;c++){var h=u*n+c;i.emplaceBack(h,h+1),i.emplaceBack(h,h+n),i.emplaceBack(h,h+n+1)}var f=l*r*3;this._wireframeSegments.push(Us.simpleSegment(0,s,(l+1)*n,f)),s+=f}this._wireframeIndexBuffer=e.createIndexBuffer(i)}return[this._gridBuffer,this._wireframeIndexBuffer,this._wireframeSegments[t]]}}]),e}(),e.GlyphManager=bd,e.ImagePosition=qf,e.LivePerformanceUtils=Ke,e.LngLat=mu,e.LngLatBounds=Ns,e.LocalGlyphMode=xd,e.MAX_MERCATOR_LATITUDE=Tu,e.MercatorCoordinate=Su,e.ONE_EM=uf,e.OverscaledTileID=Vh,e.PerformanceMarkers=Ye,e.Properties=po,e.RGBAImage=dc,e.Ray=Dl,e.RequestManager=function(){function e(t,i,r){d(this,e),this._transformRequestFn=t,this._customAccessToken=i,this._silenceAuthErrors=!!r,this._createSkuToken()}return p(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",E,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(!Ce(e))return e;var i=Be(e);return i.path="/styles/v1".concat(i.path),this._makeAPIURL(i,this._customAccessToken||t)}},{key:"normalizeGlyphsURL",value:function(e,t){if(!Ce(e))return e;var i=Be(e);return i.path="/fonts/v1".concat(i.path),this._makeAPIURL(i,this._customAccessToken||t)}},{key:"normalizeSourceURL",value:function(e,t,i,r){if(!Ce(e))return e;var n=Be(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=Be(e);return Ce(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),Oe(n))}},{key:"normalizeTileURL",value:function(e,t,i){if(this._isSkuTokenExpired()&&this._createSkuToken(),e&&!Ce(e))return e;var r=Be(e);r.path=r.path.replace(/(\.(png|jpg)\d*)(?=$)/,"".concat(t||i&&"raster"!==r.authority&&512===i?"@2x":"").concat(b.supported?".webp":"$1")),"raster"===r.authority?r.path="/".concat(x.RASTER_URL_PREFIX).concat(r.path):(r.path=r.path.replace(/^.+\/v4\//,"/"),r.path="/".concat(x.TILE_URL_VERSION).concat(r.path));var n=this._customAccessToken||function(e){var t,i=f(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)||x.ACCESS_TOKEN;return x.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=Be(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(x.RASTER_URL_PREFIX,"/"),"")):r+="tiles/".concat(i.path.replace("/".concat(x.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&&Ce(t),n=[],a=f(e.tiles||[]);try{for(a.s();!(i=a.n()).done;){var o=i.value;ze(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=Be(x.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)),!x.REQUIRE_ACCESS_TOKEN)return Oe(e);if(t=t||x.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||"")),Oe(e)}}]),e}(),e.ResourceType=ge,e.SegmentVector=Us,e.SourceCache=Mv,e.StencilMode=wv,e.StructArrayLayout1ui2=Zo,e.StructArrayLayout2f1f2i16=Lo,e.StructArrayLayout2i4=bo,e.StructArrayLayout2ui4=Go,e.StructArrayLayout3f12=Bo,e.StructArrayLayout3ui6=Oo,e.StructArrayLayout4i8=ko,e.StructArrayLayout5f20=No,e.Texture=Dp,e.Tile=av,e.Transitionable=no,e.Uniform1f=ms,e.Uniform1i=function(e){v(i,e);var t=m(i);function i(e){var r;return d(this,i),(r=t.call(this,e)).current=0,r}return p(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}(vs),e.Uniform2f=function(e){v(i,e);var t=m(i);function i(e){var r;return d(this,i),(r=t.call(this,e)).current=[0,0],r}return p(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}(vs),e.Uniform3f=function(e){v(i,e);var t=m(i);function i(e){var r;return d(this,i),(r=t.call(this,e)).current=[0,0,0],r}return p(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}(vs),e.Uniform4f=ys,e.UniformColor=_s,e.UniformMatrix2f=function(e){v(i,e);var t=m(i);function i(e){var r;return d(this,i),(r=t.call(this,e)).current=bs,r}return p(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}(vs),e.UniformMatrix3f=function(e){v(i,e);var t=m(i);function i(e){var r;return d(this,i),(r=t.call(this,e)).current=xs,r}return p(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}(vs),e.UniformMatrix4f=function(e){v(i,e);var t=m(i);function i(e){var r;return d(this,i),(r=t.call(this,e)).current=gs,r}return p(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}(vs),e.UnwrappedTileID=Uh,e.ValidationError=hn,e.VectorTileFeature=gh,e.VectorTileWorkerSource=function(e){v(i,e);var t=m(i);function i(e,r,n,a,o){var s;return d(this,i),(s=t.call(this)).actor=e,s.layerIndex=r,s.availableImages=n,s.loadVectorData=o||Vv,s.loading={},s.loaded={},s.deduped=new Uv(e.scheduler),s.isSpriteLoaded=a,s.scheduler=e.scheduler,s}return p(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 Ov(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 _h(new gf(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=rt(n);o.length>0&&(r.resourceTiming=JSON.parse(JSON.stringify(o)))}t(null,G({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}):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=Wd(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}(ut),e.WritingMode=Xf,e.ZoomDependentExpression=sn,e.add=ol,e.addDynamicAttributes=_p,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=N,e.bezier=B,e.bindAll=Y,e.boundsAttributes=rv,e.bufferConvexPolygon=function(e,t){for(var i=[],r=0;r<e.length;r++){var n=V(r-1,-1,e.length-1),a=V(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){++_e>pe&&(e.getActor().send("enforceCacheSizeLimit",de),_e=0)},e.calculateGlobeLabelMatrix=function(e,t){var i=e.point,r=su(i.x,i.y,e.worldSize/e._pixelsPerMercatorPixel,0,0);return Hs(r,r,ou(Xl(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 su(i,r,e.worldSize,a,o)},e.calculateGlobeMercatorMatrix=function(e){var t=e.pixelsPerMeter,i=t/xu(1,e.center.lat),r=Ws(new Float64Array(16));return Ys(r,r,[e.point.x,e.point.y,0]),Ks(r,r,[i,i,t]),Float32Array.from(r)},e.circumferenceAtLatitude=yu,e.clamp=F,e.clearTileCache=function(e){if(ve()){var t=_.caches.delete(fe);e&&t.catch(e).then((function(){return e()}))}},e.clipLine=md,e.clone=function(e){var t=new Gs(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=Q,e.collisionCircleLayout=lf,e.config=x,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 Gs(16);return Gs!=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=Zs,e.createExpression=an,e.createLayout=go,e.createStyleLayer=function(e){return"custom"===e.type?new Ip(e):new Pp[e.type](e)},e.cross=vl,e.degToRad=P,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=pl,e.earthRadius=pu,e.ease=O,e.easeCubicInOut=R,e.ecefToLatLng=function(e){var t=h(e,3),i=t[0],r=t[1],n=t[2],a=Math.hypot(i,r,n),o=Math.atan2(i,n),s=.5*Math.PI-Math.acos(-r/a);return new mu(D(o),D(s))},e.emitValidationErrors=$n,e.endsWith=K,e.enforceCacheSizeLimit=function(e){me(),ce&&ce.then((function(t){t.keys().then((function(i){for(var r=0;r<i.length-e;r++)t.delete(i[r])}))}))},e.evaluateSizeForFeature=ff,e.evaluateSizeForZoom=df,e.evaluateVariableOffset=Rd,e.evented=Ja,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=nt,e.exported$1=b,e.extend=G,e.extend$1=ht,e.fillExtrusionHeightLift=Dh,e.filterObject=$,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,v=a*o,m=a*s,y=a*l;return e[0]=1-h-p,e[1]=c+y,e[2]=f-m,e[3]=0,e[4]=c-y,e[5]=1-u-p,e[6]=d+v,e[7]=0,e[8]=f+m,e[9]=d-v,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=Qs,e.furthestTileCorner=function(e){var t=Math.round((e+45+360)%360/90)%4;return L[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=nd,e.getAnchorJustification=Od,e.getBounds=function(e){var t,i=1/0,r=1/0,n=-1/0,a=-1/0,o=f(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(l){o.e(l)}finally{o.f()}return{min:new A(i,r),max:new A(n,a)}},e.getColumn=ue,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/Fl,f=-c/Ul[i],d=[0,h,0,f,0,0,n,o,0];if(e.z>0){var p=180/r;qs(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=Ae,e.getJSON=function(e,t){return we(G(e,{type:"json"}),t)},e.getLatitudinalLod=function(e){var t=Tu-5;e=F(e,-t,t)/t*90;var i=Math.pow(Math.abs(Math.sin(P(e))),3);return Math.round(i*(Ul.length-1))},e.getMapSessionAPI=Xe,e.getPerformanceMeasurement=rt,e.getProjection=dp,e.getRTLTextPluginStatus=$a,e.getReferrer=be,e.getTilePoint=function(e,t){var i=t.x,r=t.y;return new A(((i-(arguments.length>2&&void 0!==arguments[2]?arguments[2]:0))*e.scale-e.x)*Vs,(r*e.scale-e.y)*Vs)},e.getTileVec3=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return al(((t.x-i)*e.scale-e.x)*Vs,(t.y*e.scale-e.y)*Vs,ku(t.z,t.y))},e.getVideo=function(e,t){var i=_.document.createElement("video");i.muted=!0,i.onloadstart=function(){t(null,i)};for(var r=0;r<e.length;r++){var n=_.document.createElement("source");Te(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=Ws(new Float64Array(16));return Hs(i,e.pixelMatrix,e.globeMatrix),ml(t,t,i),new A(t[0],t[1])},e.globeDenormalizeECEF=ou,e.globeECEFOrigin=function(e,t){var i=[0,0,0];return ml(i,i,au(Xl(t.canonical))),ml(i,i,e),i},e.globeMetersToEcef=Gl,e.globeNormalizeECEF=au,e.globePixelsToTileUnits=function(e,t){return Vs/(512*Math.pow(2,e))*ru(Xl(t))},e.globePoleMatrixForTile=function(e,t,i){var r=Ws(new Float64Array(16)),n=(t/(1<<e)-.5)*Math.PI*2;return $s(r,i.globeMatrix,n),Float32Array.from(r)},e.globeTileBounds=Xl,e.globeTiltAtLngLat=uu,e.globeToMercatorTransition=lu,e.globeUseCustomAntiAliasing=function(e,t,i){var r=lu(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=Ws,e.identity$1=Sl,e.invert=Xs,e.isFullscreen=function(){return!!_.document.fullscreenElement||!!_.document.webkitFullscreenElement},e.isLngLatBehindGlobe=cu,e.isMapAuthenticated=function(e){return He.has(e)},e.isMapboxURL=Ce,e.isSafariWithAntialiasingBug=function(e){var t=e.navigator?e.navigator.userAgent:null;return!!se(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=wu,e.latLngToECEF=tu,e.len=bl,e.length=nl,e.length$1=function(e){return Math.hypot(e[0],e[1],e[2],e[3])},e.lngFromMercatorX=bu,e.loadVectorTile=Vv,e.makeRequest=we,e.mapValue=function(e,t,i,r,n){return F((e-t)/(i-t)*(n-r)+r,r,n)},e.mercatorScale=Eu,e.mercatorXfromLng=_u,e.mercatorYfromLat=gu,e.mercatorZfromAltitude=xu,e.mul=tl,e.mul$1=xl,e.multiply=Hs,e.multiply$1=qs,e.multiply$2=ll,e.nextPowerOfTwo=X,e.normalize=dl,e.normalize$1=Il,e.normalize$2=kl,e.number=Ni,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=gf,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=eo,e.pointGeometry=A,e.polesInViewport=function(e){var t=Ws(new Float64Array(16));Hs(t,e.pixelMatrix,e.globeMatrix);var i=[0,Vl,0],r=[0,Nl,0];return ml(i,i,t),ml(r,r,t),[i[0]>0&&i[0]<=e.width&&i[1]>0&&i[1]<=e.height&&!cu(e,new mu(e.center.lat,90)),r[0]>0&&r[0]<=e.width&&r[1]>0&&r[1]<=e.height&&!cu(e,new mu(e.center.lat,-90))]},e.polygonContainsPoint=Hu,e.polygonIntersectsBox=Yu,e.polygonIntersectsPolygon=Uu,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 A(i,i),a=e.sub(n),o=t.add(n),s=[a,new A(o.x,a.y),o,new A(a.x,o.y)];return r&&s.push(a.clone()),s},e.posAttributes=Pl,e.postMapLoadEvent=Ge,e.postPerformanceEvent=qe,e.postTurnstileEvent=Ne,e.potpack=Zf,e.prevPowerOfTwo=function(e){return e<=1?1:Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},e.radToDeg=D,e.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],e.registerForPluginStateChange=function(e){return e({pluginStatus:Xa,pluginURL:Ha}),Ja.on("pluginStateChange",e),e},e.removeAuthState=function(e){He.delete(e)},e.renderColorRamp=vc,e.resample=Au,e.rotateX=Js,e.rotateX$1=Ml,e.rotateY=$s,e.rotateY$1=Al,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=Ks,e.scale$1=wl,e.scale$2=hl,e.scaleAndAdd=fl,e.set=function(e,t,i,r){return e[0]=t,e[1]=i,e[2]=r,e},e.setCacheLimits=function(e,t){de=e,pe=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(Xa===Ga||Xa===Za||Xa===qa)throw new Error("setRTLTextPlugin cannot be called multiple times.");Ha=nt.resolveURL(e),Xa=Ga,Wa=t,Ka(),i||Qa()},e.smoothstep=U,e.spec=ct,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?He.add(e):He.delete(e)},e.sub=gl,e.subtract=sl,e.symbolSize=pf,e.tileAABB=function(e,t,i,r,n,a,o,s,l){if("globe"===l.name)return Jl(e,t,new Fh(i,r,n));var u=Wd({z:i,x:r,y:n},l);return new Bl([(a+u.x/u.scale)*t,t*(u.y/u.scale),o],[(a+u.x2/u.scale)*t,t*(u.y2/u.scale),s])},e.tileCornersToBounds=$l,e.tileTransform=Wd,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=ml,e.transformMat4$1=Tl,e.transformQuat=yl,e.transitionTileAABBinECEF=Yl,e.translate=Ys,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=Ya,e.uniqueId=q,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 Jn(Pn(e))},e.validateFog=function(e){return Jn(Zn(e))},e.validateLayer=function(e){return Jn(On(e))},e.validateLight=function(e){return Jn(jn(e))},e.validateSource=function(e){return Jn(Vn(e))},e.validateStyle=Hn,e.validateTerrain=function(e){return Jn(Gn(e))},e.values=j,e.vectorTile=oh,e.version=g,e.warnOnce=te,e.window=_,e.wrap=V})),_(["./shared"],(function(e){function t(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e||null==e)return JSON.stringify(e);if(Array.isArray(e)){var i,r="[",n=f(e);try{for(n.s();!(i=n.n()).done;){var a=i.value;r+="".concat(t(a),",")}}catch(c){n.e(c)}finally{n.f()}return"".concat(r,"]")}var o,s="{",l=f(Object.keys(e).sort());try{for(l.s();!(o=l.n()).done;){var u=o.value;s+="".concat(u,":").concat(t(e[u]),",")}}catch(c){l.e(c)}finally{l.f()}return"".concat(s,"}")}function i(i){var r,n="",a=f(e.refProperties);try{for(a.s();!(r=a.n()).done;){var o=r.value;n+="/".concat(t(i[o]))}}catch(s){a.e(s)}finally{a.f()}return n}var r=function(){function t(e){d(this,t),this.keyCache={},e&&this.replace(e)}return p(t,[{key:"replace",value:function(e){this._layerConfigs={},this._layers={},this.update(e,[])}},{key:"update",value:function(t,r){var n,a=this,o=f(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(b){o.e(b)}finally{o.f()}var l,u=f(r);try{for(u.s();!(l=u.n()).done;){var c=l.value;delete this.keyCache[c],delete this._layerConfigs[c],delete this._layers[c]}}catch(b){u.e(b)}finally{u.f()}this.familiesBySource={};var h,d=function(e,t){for(var r={},n=0;n<e.length;n++){var a=t&&t[e[n].id]||i(e[n]);t&&(t[e[n].id]=a);var o=r[a];o||(o=r[a]=[]),o.push(e[n])}var s=[];for(var l in r)s.push(r[l]);return s}(e.values(this._layerConfigs),this.keyCache),p=f(d);try{for(p.s();!(h=p.n()).done;){var v=h.value.map((function(e){return a._layers[e.id]})),m=v[0];if("none"!==m.visibility){var y=m.source||"",_=this.familiesBySource[y];_||(_=this.familiesBySource[y]={});var g=m.sourceLayer||"_geojsonTileLayer",x=_[g];x||(x=_[g]=[]),x.push(v)}}}catch(b){p.e(b)}finally{p.f()}}}]),t}(),n=function(){function t(){d(this,t)}return p(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.window.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}(),a=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)l(t.coordinates,i);else if("MultiPolygon"===n)for(r=0;r<t.coordinates.length;r++)l(t.coordinates[r],i);return t};function l(e,t){if(0!==e.length){u(e[0],t);for(var i=1;i<e.length;i++)u(e[i],!t)}}function u(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 c=e.VectorTileFeature.prototype.toGeoJSON,y=function(){function t(i){d(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 p(t,[{key:"loadGeometry",value:function(){if(1===this._feature.type){var t,i=[],r=f(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=f(this._feature.geometry);try{for(s.s();!(a=s.n()).done;){var l,u=a.value,c=[],h=f(u);try{for(h.s();!(l=h.n()).done;){var d=l.value;c.push(new e.pointGeometry(d[0],d[1]))}}catch(p){h.e(p)}finally{h.f()}o.push(c)}}catch(p){s.e(p)}finally{s.f()}return o}},{key:"toGeoJSON",value:function(e,t,i){return c.call(this,e,t,i)}}]),t}(),_=function(){function t(i){d(this,t),this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=e.EXTENT,this.length=i.length,this._features=i}return p(t,[{key:"feature",value:function(e){return new y(this._features[e])}}]),t}(),g={},x={get exports(){return g},set exports(e){g=e}},b=e.pointGeometry,w=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 b(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=w.prototype.toGeoJSON;var S=e.pbf,M=k;function A(e){var t=new S;return function(e,t){for(var i in e.layers)t.writeMessage(3,I,e.layers[i])}(e,t),t.finish()}function I(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,C,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 C(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}x.exports=A,g.fromVectorTileJs=A,g.fromGeojsonVt=function(e,t){t=t||{};var i={};for(var r in e)i[r]=new M(e[r].features,t),i[r].name=r,i[r].version=t.version,i[r].extent=t.extent;return A({layers:i})},g.GeoJSONWrapper=M;var N,j=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]:j,r=arguments.length>2&&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;d(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 p(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 v=Math.floor((d+f)/2);s=t[2*v],l=t[2*v+1],s>=i&&s<=n&&l>=r&&l<=a&&c.push(e[v]);var m=(h+1)%2;(0===h?i<=s:r<=l)&&(u.push(d),u.push(v-1),u.push(m)),(0===h?n>=s:a>=l)&&(u.push(v+1),u.push(f),u.push(m))}}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],v=t[2*d+1];V(p,v,i,r)<=l&&s.push(e[d]);var m=(u+1)%2;(0===u?i-n<=p:r-n<=v)&&(o.push(h),o.push(d-1),o.push(m)),(0===u?i+n>=p:r+n>=v)&&(o.push(d+1),o.push(c),o.push(m))}}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||(N=new Float32Array(1),function(e){return N[0]=+e,N[0]}),X=function(){function e(t){d(this,e),this.options=te(Object.create(q),t),this.trees=new Array(this.options.maxZoom+1)}return p(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 l,u=this.trees[this._limitZoom(t)],c=u.range($(i),Q(a),$(n),Q(r)),h=[],d=f(c);try{for(d.s();!(l=d.n()).done;){var p=l.value,v=u.points[p];h.push(v.numPoints?K(v):this.points[v.index])}}catch(m){d.e(m)}finally{d.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)),l=n.within(a.x,a.y,s),u=[],c=f(l);try{for(c.s();!(o=c.n()).done;){var h=o.value,d=n.points[h];d.parentId===e&&u.push(d.numPoints?K(d):this.points[d.index])}}catch(p){c.e(p)}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=this.getChildren(t),s=f(o);try{for(s.s();!(a=s.n()).done;){var l=a.value,u=l.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(l),e.length===i)break}}catch(c){s.e(c)}finally{s.f()}return n}},{key:"_addTileFeatures",value:function(e,t,i,r,n,a){var o,s=f(e);try{for(s.s();!(o=s.n()).done;){var l=t[o.value],u=l.numPoints,c=void 0,h=void 0,d=void 0;if(u)c=J(l),h=l.x,d=l.y;else{var p=this.points[l.index];c=p.properties,h=$(p.geometry.coordinates[0]),d=Q(p.geometry.coordinates[1])}var v={type:1,geometry:[[Math.round(this.options.extent*(h*n-i)),Math.round(this.options.extent*(d*n-r))]],tags:c},m=void 0;u?m=l.id:this.options.generateId?m=l.index:this.points[l.index].id&&(m=this.points[l.index].id),void 0!==m&&(v.id=m),a.features.push(v)}}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,l=n/(a*Math.pow(2,t)),u=0;u<e.length;u++){var c=e[u];if(!(c.zoom<=t)){c.zoom=t;var h,d=this.trees[t+1],p=d.within(c.x,c.y,l),v=c.numPoints||1,m=v,y=f(p);try{for(y.s();!(h=y.n()).done;){var _=h.value,g=d.points[_];g.zoom>t&&(m+=g.numPoints||1)}}catch(D){y.e(D)}finally{y.f()}if(m>v&&m>=s){var x,b=c.x*v,w=c.y*v,k=o&&v>1?this._map(c,!0):null,T=(u<<5)+(t+1)+this.points.length,E=f(p);try{for(E.s();!(x=E.n()).done;){var S=x.value,M=d.points[S];if(!(M.zoom<=t)){M.zoom=t;var A=M.numPoints||1;b+=M.x*A,w+=M.y*A,M.parentId=T,o&&(k||(k=this._map(c,!0)),o(k,this._map(M)))}}}catch(D){E.e(D)}finally{E.f()}c.parentId=T,i.push(H(b/m,w/m,T,m,k))}else if(i.push(c),m>1){var I,C=f(p);try{for(C.s();!(I=C.n()).done;){var z=I.value,P=d.points[z];P.zoom<=t||(P.zoom=t,i.push(P))}}catch(D){C.e(D)}finally{C.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=h(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>>1,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 v=[];if("Point"===f||"MultiPoint"===f)ve(h,v,i,r,n);else if("LineString"===f)me(h,v,i,r,n,!1,s.lineMetrics);else if("MultiLineString"===f)_e(h,v,i,r,n,!1);else if("Polygon"===f)_e(h,v,i,r,n,!0);else if("MultiPolygon"===f)for(var m=0;m<h.length;m++){var y=[];_e(h[m],y,i,r,n,!0),y.length&&v.push(y)}if(v.length){if(s.lineMetrics&&"LineString"===f){for(m=0;m<v.length;m++)l.push(oe(c.id,f,v[m],c.tags));continue}"LineString"!==f&&"MultiLineString"!==f||(1===v.length?(f="LineString",v=v[0]):f="MultiLineString"),"Point"!==f&&"MultiPoint"!==f||(f=3===v.length?"Point":"MultiPoint"),l.push(oe(c.id,f,v,c.tags))}}}return l.length?l:null}function ve(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 me(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],v=e[f+2],m=e[f+3],y=e[f+4],_=0===n?d:p,g=0===n?m:y,x=!1;o&&(s=Math.sqrt(Math.pow(d-m,2)+Math.pow(p-y,2))),_<i?g>i&&(l=c(u,d,p,m,y,i),o&&(u.start=h+s*l)):_>r?g<r&&(l=c(u,d,p,m,y,r),o&&(u.start=h+s*l)):ge(u,d,p,v),g<i&&_>=i&&(l=c(u,d,p,m,y,i),x=!0),g>r&&_<=r&&(l=c(u,d,p,m,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],v=e[b+2],(_=0===n?d:p)>=i&&_<=r&&ge(u,d,p,v),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++)me(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 Se(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++,Me(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 Me(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)Ae(o,n,e,i,!1,!1);else if("MultiLineString"===a||"Polygon"===a)for(s=0;s<n.length;s++)Ae(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++)Ae(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 Ae(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 Ie(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=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),r=function(e,t){var i=t.buffer/t.extent,r=e,n=pe(e,1,-1-i,i,0,-1,2,t),a=pe(e,1,1-i,2+i,0,-1,2,t);return(n||a)&&(r=pe(e,1,-i,1+i,0,-1,2,t)||[],n&&(r=we(n,1).concat(r)),a&&(r=r.concat(we(a,-1)))),r}(r,t),r.length&&this.splitTile(r,0,0,0),i&&(r.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 Ce(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 _(r.features),a=g(n);0===a.byteOffset&&a.byteLength===a.buffer.byteLength||(a=new Uint8Array(a)),t(null,{vectorTile:n,rawData:a.buffer})}Ie.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},Ie.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=Ce(t,i,r),f=this.tiles[h];if(!f&&(u>1&&console.time("creation"),f=this.tiles[h]=Se(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 v,m,y,_,g,x,b=.5*l.buffer/l.extent,w=.5-b,k=.5+b,T=1+b;v=m=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&&(v=pe(g,c,r-b,r+k,1,f.minY,f.maxY,l),m=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(v||[],t+1,2*i,2*r),s.push(m||[],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)}}},Ie.prototype.getTile=function(e,t,i){var r=this.options,n=r.extent,a=r.debug;if(e<0||e>24)return null;var o=1<<e,s=Ce(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[Ce(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(t){v(r,t);var i=m(r);function r(e,t,n,a,o){var s;return d(this,r),s=i.call(this,e,t,n,a,ze),o&&(s.loadGeoJSON=o),s}return p(r,[{key:"loadData",value:function(t,i){var r=this,n=t&&t.request,o=n&&n.collectResourceTiming;this.loadGeoJSON(t,(function(s,l){if(s||!l)return i(s);if("object"!=typeof l)return i(new Error("Input data given to '".concat(t.source,"' is not a valid GeoJSON object.")));a(l,!0);try{if(t.filter){var u=e.createExpression(t.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===u.result)throw new Error(u.value.map((function(e){return"".concat(e.key,": ").concat(e.message)})).join(", "));var c=l.features.filter((function(e){return u.value.evaluate({zoom:0},e)}));l={type:"FeatureCollection",features:c}}r._geoJSONIndex=t.cluster?new X(function(t){var i=t.superclusterOptions,r=t.clusterProperties;if(!r||!i)return i;for(var n={},a={},o={accumulated:null,zoom:0},s={properties:null},l=Object.keys(r),u=0,c=l;u<c.length;u++){var f=c[u],d=h(r[f],2),p=d[0],v=d[1],m=e.createExpression(v),y=e.createExpression("string"==typeof p?[p,["accumulated"],["get",f]]:p);n[f]=m.value,a[f]=y.value}return i.map=function(e){s.properties=e;for(var t={},i=0,r=l;i<r.length;i++){var a=r[i];t[a]=n[a].evaluate(o,s)}return t},i.reduce=function(e,t){s.properties=t;for(var i=0,r=l;i<r.length;i++){var n=r[i];o.accumulated=e[n],e[n]=a[n].evaluate(o,s)}},i}(t)).load(l.features):function(e,t){return new Ie(e,t)}(l,t.geojsonVtOptions)}catch(s){return i(s)}r.loaded={};var f={};if(o){var d=e.getPerformanceMeasurement(n);d&&(f.resourceTiming={},f.resourceTiming[t.source]=JSON.parse(JSON.stringify(d)))}i(null,f)}))}},{key:"reloadTile",value:function(e,t){var i=this.loaded;return i&&i[e.uid]?o(s(r.prototype),"reloadTile",this).call(this,e,t):this.loadTile(e,t)}},{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(e){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(e){t(e)}}},{key:"getClusterChildren",value:function(e,t){try{t(null,this._geoJSONIndex.getChildren(e.clusterId))}catch(e){t(e)}}},{key:"getClusterLeaves",value:function(e,t){try{t(null,this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset))}catch(e){t(e)}}}]),r}(e.VectorTileWorkerSource),De=function(){function t(i){var r=this;d(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 p(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(e){i(e.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(e){r(e.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 r),t}},{key:"getWorkerSource",value:function(e,t,i){var r=this;if(this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][t]||(this.workerSources[e][t]={}),!this.workerSources[e][t][i]){var n={send:function(t,i,n,a,o,s){r.actor.send(t,i,n,e,o,s)},scheduler:this.actor.scheduler};this.workerSources[e][t][i]=new this.workerSourceTypes[t](n,this.getLayerIndex(e),this.getAvailableImages(e),this.isSpriteLoaded[e])}return this.workerSources[e][t][i]}},{key:"getDEMWorkerSource",value:function(e,t){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][t]||(this.demWorkerSources[e][t]=new n),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})),_(["./shared"],(function(e){function t(e,i){if(Array.isArray(e)){if(!Array.isArray(i)||e.length!==i.length)return!1;for(var r=0;r<e.length;r++)if(!t(e[r],i[r]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==i){if("object"!=typeof i)return!1;if(Object.keys(e).length!==Object.keys(i).length)return!1;for(var n in e)if(!t(e[n],i[n]))return!1;return!0}return e===i}var i=u;function u(e){return!function(e){return"undefined"==typeof window||"undefined"==typeof document?"not a browser":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(t){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===y[t=e&&e.failIfMajorPerformanceCaveat]&&(y[t]=function(e){var t,i=function(e){var t=document.createElement("canvas"),i=Object.create(u.webGLContextAttributes);return i.failIfMajorPerformanceCaveat=e,t.getContext("webgl",i)||t.getContext("experimental-webgl",i)}(e);if(!i)return!1;try{t=i.createShader(i.VERTEX_SHADER)}catch(e){return!1}return!(!t||i.isContextLost())&&(i.shaderSource(t,"void main() {}"),i.compileShader(t),!0===i.getShaderParameter(t,i.COMPILE_STATUS))}(t)),y[t]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var t}(e)}var y={};function _(t,i,r){var n=e.window.document.createElement(t);return void 0!==i&&(n.className=i),r&&r.appendChild(n),n}function g(t,i,r){for(var n=e.window.document.createElementNS("http://www.w3.org/2000/svg",t),a=0,o=Object.keys(i);a<o.length;a++){var s=o[a];n.setAttributeNS(null,s,i[s])}return r&&r.appendChild(n),n}u.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};var x,b=e.window.document&&e.window.document.documentElement.style,w=b&&void 0!==b.userSelect?"userSelect":"WebkitUserSelect";function k(){b&&w&&(x=b[w],b[w]="none")}function T(){b&&w&&(b[w]=x)}function E(t){t.preventDefault(),t.stopPropagation(),e.window.removeEventListener("click",E,!0)}function S(){e.window.addEventListener("click",E,!0),e.window.setTimeout((function(){e.window.removeEventListener("click",E,!0)}),0)}function M(e,t){var i=e.getBoundingClientRect();return C(e,i,t)}function A(e,t){for(var i=e.getBoundingClientRect(),r=[],n=0;n<t.length;n++)r.push(C(e,i,t[n]));return r}function I(t){return void 0!==e.window.InstallTrigger&&2===t.button&&t.ctrlKey&&e.window.navigator.platform.toUpperCase().indexOf("MAC")>=0?0:t.button}function C(t,i,r){var n=t.offsetWidth===i.width?1:t.offsetWidth/i.width;return new e.pointGeometry((r.clientX-i.left)*n,(r.clientY-i.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(t){v(r,t);var i=m(r);function r(){var t;return d(this,r),(t=i.call(this)).images={},t.updatedImages={},t.callbackDispatchedThisFrame={},t.loaded=!1,t.requestors=[],t.patterns={},t.atlasImage=new e.RGBAImage({width:1,height:1}),t.dirty=!0,t}return p(r,[{key:"isLoaded",value:function(){return this.loaded}},{key:"setLoaded",value:function(e){if(this.loaded!==e&&(this.loaded=e,e)){var t,i=f(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(t,i){var r=!0;return this._validateStretch(i.stretchX,i.data&&i.data.width)||(this.fire(new e.ErrorEvent(new Error('Image "'.concat(t,'" has invalid "stretchX" value')))),r=!1),this._validateStretch(i.stretchY,i.data&&i.data.height)||(this.fire(new e.ErrorEvent(new Error('Image "'.concat(t,'" has invalid "stretchY" value')))),r=!1),this._validateContent(i.content,i)||(this.fire(new e.ErrorEvent(new Error('Image "'.concat(t,'" has invalid "content" value')))),r=!1),r}},{key:"_validateStretch",value:function(e,t){if(!e)return!0;var i,r=0,n=f(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=f(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(t,i){var r,n={},a=f(t);try{for(a.s();!(r=a.n()).done;){var o=r.value;this.images[o]||this.fire(new e.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)}:e.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(l){a.e(l)}finally{a.f()}i(null,n)}},{key:"getPixelSize",value:function(){var e=this.atlasImage;return{width:e.width,height:e.height}}},{key:"getPattern",value:function(t){var i=this.patterns[t],r=this.getImage(t);if(!r)return null;if(i&&i.position.version===r.version)return i.position;if(i)i.position.version=r.version;else{var n={w:r.data.width+2,h:r.data.height+2,x:0,y:0},a=new e.ImagePosition(n,r);this.patterns[t]={bin:n,position:a}}return this._updatePatternAtlas(),this.patterns[t].position}},{key:"bind",value:function(t){var i=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new e.Texture(t,this.atlasImage,i.RGBA),this.atlasTexture&&this.atlasTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}},{key:"_updatePatternAtlas",value:function(){var t=[];for(var i in this.patterns)t.push(this.patterns[i].bin);var r=e.potpack(t),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;e.RGBAImage.copy(h,o,{x:0,y:0},{x:u,y:c},{width:f,height:d}),e.RGBAImage.copy(h,o,{x:0,y:d-1},{x:u,y:c-1},{width:f,height:1}),e.RGBAImage.copy(h,o,{x:0,y:0},{x:u,y:c+d},{width:f,height:1}),e.RGBAImage.copy(h,o,{x:f-1,y:0},{x:u-1,y:c},{width:1,height:d}),e.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=f(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}(e.Evented),L=new e.Properties({anchor:new e.DataConstantProperty(e.spec.light.anchor),position:new(function(){function t(){d(this,t),this.specification=e.spec.light.position}return p(t,[{key:"possiblyEvaluate",value:function(t,i){return function(t){var i=h(t,3),r=i[0],n=i[1],a=i[2],o=e.degToRad(n+90),s=e.degToRad(a);return{x:r*Math.cos(o)*Math.sin(s),y:r*Math.sin(o)*Math.sin(s),z:r*Math.cos(s),azimuthal:n,polar:a}}(t.expression.evaluate(i))}},{key:"interpolate",value:function(t,i,r){return{x:e.number(t.x,i.x,r),y:e.number(t.y,i.y,r),z:e.number(t.z,i.z,r),azimuthal:e.number(t.azimuthal,i.azimuthal,r),polar:e.number(t.polar,i.polar,r)}}}]),t}()),color:new e.DataConstantProperty(e.spec.light.color),intensity:new e.DataConstantProperty(e.spec.light.intensity)}),R="-transition",B=function(t){v(r,t);var i=m(r);function r(t){var n;return d(this,r),(n=i.call(this))._transitionable=new e.Transitionable(L),n.setLight(t),n._transitioning=n._transitionable.untransitioned(),n}return p(r,[{key:"getLight",value:function(){return this._transitionable.serialize()}},{key:"setLight",value:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this._validate(e.validateLight,t,i))for(var r in t){var n=t[r];e.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(t,i,r){return(!r||!1!==r.validate)&&e.emitValidationErrors(this,t.call(e.validateStyle,e.extend({value:i,style:{glyphs:!0,sprite:!0},styleSpec:e.spec})))}}]),r}(e.Evented),O=new e.Properties({source:new e.DataConstantProperty(e.spec.terrain.source),exaggeration:new e.DataConstantProperty(e.spec.terrain.exaggeration)}),F="-transition",U=function(t){v(r,t);var i=m(r);function r(t,n){var a;return d(this,r),(a=i.call(this))._transitionable=new e.Transitionable(O),a.set(t),a._transitioning=a._transitionable.untransitioned(),a.drapeRenderMode=n,a}return p(r,[{key:"get",value:function(){return this._transitionable.serialize()}},{key:"set",value:function(t){for(var i in t){var r=t[i];e.endsWith(i,F)?this._transitionable.setTransition(i.slice(0,-F.length),r):this._transitionable.setValue(i,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}(e.Evented);function V(t,i,r,n){var a=e.smoothstep(45,65,r),o=N(t,n),s=h(o,2),l=s[0],u=s[1],c=e.length(i),f=1-Math.min(1,Math.exp((c-l)/(u-l)*-6));return f*=f*f,(f=Math.min(1,1.00747*f))*a*t.alpha}function N(e,t){var i=.5/Math.tan(.5*t);return[e.range[0]+i,e.range[1]+i]}var j=new e.Properties({range:new e.DataConstantProperty(e.spec.fog.range),color:new e.DataConstantProperty(e.spec.fog.color),"high-color":new e.DataConstantProperty(e.spec.fog["high-color"]),"space-color":new e.DataConstantProperty(e.spec.fog["space-color"]),"horizon-blend":new e.DataConstantProperty(e.spec.fog["horizon-blend"]),"star-intensity":new e.DataConstantProperty(e.spec.fog["star-intensity"])}),G="-transition",Z=function(t){v(r,t);var i=m(r);function r(t,n){var a;return d(this,r),(a=i.call(this))._transitionable=new e.Transitionable(j),a.set(t),a._transitioning=a._transitionable.untransitioned(),a._transform=n,a}return p(r,[{key:"state",get:function(){var t=this._transform,i="globe"===t.projection.name,r=e.globeToMercatorTransition(t.zoom),n=this.properties.get("range"),a=[.5,3];return{range:i?[e.number(a[0],n[0],r),e.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(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this._validate(e.validateFog,t,i)){for(var r=0,n=Object.keys(e.spec.fog);r<n.length;r++){var a=n[r];t&&void 0===t[a]&&(t[a]=e.spec.fog[a].default)}for(var o in t){var s=t[o];e.endsWith(o,G)?this._transitionable.setTransition(o.slice(0,-G.length),s):this._transitionable.setValue(o,s)}}}},{key:"getOpacity",value:function(t){if(!this._transform.projection.supportsFog)return 0;var i=this.properties&&this.properties.get("color")||1;return("globe"===this._transform.projection.name?1:e.smoothstep(45,65,t))*i.a}},{key:"getOpacityAtLatLng",value:function(t,i){return this._transform.projection.supportsFog?function(t,i,r){var n=e.MercatorCoordinate.fromLngLat(i),a=r.elevation?r.elevation.getAtPointOrZero(n):0,o=[n.x,n.y,a];return e.transformMat4(o,o,r.mercatorFogMatrix),V(t,o,r.pitch,r._fov)}(this.state,t,i):0}},{key:"getFovAdjustedRange",value:function(e){return this._transform.projection.supportsFog?N(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(t,i,r){return(!r||!1!==r.validate)&&e.emitValidationErrors(this,t.call(e.validateStyle,e.extend({value:i,style:{glyphs:!0,sprite:!0},styleSpec:e.spec})))}}]),r}(e.Evented),q=function(){function t(i,r){var n=this;d(this,t),this.workerPool=i,this.actors=[],this.currentActor=0,this.id=e.uniqueId();for(var a=this.workerPool.acquire(this.id),o=0;o<a.length;o++){var s=new t.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 p(t,[{key:"broadcast",value:function(t,i,r){e.asyncAll(this.actors,(function(e,r){e.send(t,i,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)}}]),t}();function W(t,i,r){return i*(e.EXTENT/(t.tileSize*Math.pow(2,r-t.tileID.overscaledZ)))}q.Actor=e.Actor;var X=function(){function t(e,i,r,n){d(this,t),this.screenBounds=e,this.cameraPoint=i,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=r,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,n)}return p(t,[{key:"isPointQuery",value:function(){return 1===this.screenBounds.length}},{key:"bufferedScreenGeometry",value:function(t){return e.polygonizeBounds(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],t)}},{key:"bufferedCameraGeometry",value:function(t){var i=this.screenBounds[0],r=1===this.screenBounds.length?this.screenBounds[0].add(new e.pointGeometry(1,1)):this.screenBounds[1],n=e.polygonizeBounds(i,r,0,!1);return this.cameraPoint.y>r.y&&(this.cameraPoint.x>i.x&&this.cameraPoint.x<r.x?n.splice(3,0,this.cameraPoint):this.cameraPoint.x>=r.x?n[2]=this.cameraPoint:this.cameraPoint.x<=i.x&&(n[3]=this.cameraPoint)),e.bufferConvexPolygon(n,t)}},{key:"bufferedCameraGeometryGlobe",value:function(t){var i=this.screenBounds[0],r=1===this.screenBounds.length?this.screenBounds[0].add(new e.pointGeometry(1,1)):this.screenBounds[1],n=e.polygonizeBounds(i,r,t),a=this.cameraPoint.clone();switch(3*((a.y>i.y)+(a.y>r.y))+((a.x>i.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(t,i,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=t.queryPadding/i._pixelsPerMercatorPixel+1,o=r?this._bufferedCameraMercator(a,i):this._bufferedScreenMercator(a,i),s=t.tileID.wrap+(o.unwrapped?n:0),l=o.polygon.map((function(i){return e.getTilePoint(t.tileTransform,i,s)}));if(e.polygonIntersectsBox(l,0,0,e.EXTENT,e.EXTENT)){s=t.tileID.wrap+(this.screenGeometryMercator.unwrapped?n:0);var u,c=this.screenGeometryMercator.polygon.map((function(i){return e.getTileVec3(t.tileTransform,i,s)})),h=c.map((function(t){return new e.pointGeometry(t[0],t[1])})),f=i.getFreeCameraOptions().position||new e.MercatorCoordinate(0,0,0),d=e.getTileVec3(t.tileTransform,f,s),p=c.map((function(t){var i=e.sub(t,t,d);return e.normalize(i,i),new e.Ray(d,i)})),v=W(t,1,i.zoom)*i._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:h,tilespaceRays:p,bufferedTilespaceGeometry:l,bufferedTilespaceBounds:(u=e.getBounds(l),u.min.x=e.clamp(u.min.x,0,e.EXTENT),u.min.y=e.clamp(u.min.y,0,e.EXTENT),u.max.x=e.clamp(u.max.x,0,e.EXTENT),u.max.y=e.clamp(u.max.y,0,e.EXTENT),u),tile:t,tileID:t.tileID,pixelToTileUnitsFactor:v}}}},{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(t,i){var r=function(t,i){var r=e.multiply([],i.pixelMatrix,i.globeMatrix),n=[0,-e.GLOBE_RADIUS,0,1],a=[0,e.GLOBE_RADIUS,0,1],o=[0,0,0,1];e.transformMat4$1(n,n,r),e.transformMat4$1(a,a,r),e.transformMat4$1(o,o,r);var s=new e.pointGeometry(n[0]/n[3],n[1]/n[3]),l=new e.pointGeometry(a[0]/a[3],a[1]/a[3]),u=e.polygonContainsPoint(t,s)&&n[3]<o[3],h=e.polygonContainsPoint(t,l)&&a[3]<o[3];if(!u&&!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}(t,i,u?-1:1);if(!f)return null;var d=f.idx,p=f.t,v=d>1?H(t.slice(0,d),i):[],m=d<t.length?H(t.slice(d),i):[];v=v.map((function(t){return new e.pointGeometry(Y(t.x),t.y)})),m=m.map((function(t){return new e.pointGeometry(Y(t.x),t.y)}));var y=c(v);0===y.length&&y.push(m[m.length-1]);var _,g=e.number(y[y.length-1].y,(0===m.length?v[0]:m[0]).y,p);return _=u?[new e.pointGeometry(0,g),new e.pointGeometry(0,0),new e.pointGeometry(1,0),new e.pointGeometry(1,g)]:[new e.pointGeometry(1,g),new e.pointGeometry(1,1),new e.pointGeometry(0,1),new e.pointGeometry(0,g)],y.push.apply(y,c(_)),0===m.length?y.push(v[0]):y.push.apply(y,c(m)),{polygon:y.map((function(t){return new e.MercatorCoordinate(t.x,t.y)})),unwrapped:!1}}(t,i);if(r)return r;var n=function(t,i){for(var r=!1,n=-1/0,a=0,o=0;o<t.length-1;o++)t[o].x>n&&(n=t[o].x,a=o);for(var s=0;s<t.length-1;s++){var l=(a+s)%(t.length-1),u=t[l],c=t[l+1];Math.abs(u.x-c.x)>.5&&(u.x<c.x?(u.x+=1,0===l&&(t[t.length-1].x+=1)):(c.x+=1,l+1===t.length-1&&(t[0].x+=1)),r=!0)}var h=e.mercatorXfromLng(i.center.lng);return r&&h<Math.abs(h-1)&&t.forEach((function(e){e.x-=1})),{polygon:t,unwrapped:r}}(H(t,i).map((function(t){return new e.pointGeometry(Y(t.x),t.y)})),i);return{polygon:n.polygon.map((function(t){return new e.MercatorCoordinate(t.x,t.y)})),unwrapped:n.unwrapped}}}],[{key:"createFromScreenPoints",value:function(i,r){var n,a;if(i instanceof e.pointGeometry||"number"==typeof i[0]){var o=e.pointGeometry.convert(i);n=[o],a=r.isPointAboveHorizon(o)}else{var s=e.pointGeometry.convert(i[0]),l=e.pointGeometry.convert(i[1]);n=[s,l],a=e.polygonizeBounds(s,l).every((function(e){return r.isPointAboveHorizon(e)}))}return new t(n,r.getCameraPoint(),a,r)}}]),t}();function H(t,i){return e.resample(t,(function(e){var t=i.pointCoordinate3D(e);e.x=t.x,e.y=t.y}),1/256)}function Y(e){return e<0?1+e%1:e%1}function K(e){return 100*e|0}function J(t,i,r,n,a){var o=function(r,n){if(r)return a(r);if(n){t.url&&n.tiles&&t.tiles&&delete t.tiles;var o=e.pick(e.extend(n,t),["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=i.canonicalizeTileset(o,t.url),a(null,o)}};return t.url?e.getJSON(i.transformRequest(i.normalizeSourceURL(t.url,null,r,n),e.ResourceType.Source),o):e.exported.frame((function(){return o(null,t)}))}var $,Q=function(){function t(i,r,n){d(this,t),this.bounds=e.LngLatBounds.convert(this.validateBounds(i)),this.minzoom=r||0,this.maxzoom=n||24}return p(t,[{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(t){var i=Math.pow(2,t.z),r=Math.floor(e.mercatorXfromLng(this.bounds.getWest())*i),n=Math.floor(e.mercatorYfromLat(this.bounds.getNorth())*i),a=Math.ceil(e.mercatorXfromLng(this.bounds.getEast())*i),o=Math.ceil(e.mercatorYfromLat(this.bounds.getSouth())*i);return t.x>=r&&t.x<a&&t.y>=n&&t.y<o}}]),t}(),ee=function(){function e(t,i,r){d(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 p(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){d(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 p(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){d(this,e),this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}return p(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(t){v(r,t);var i=m(r);function r(){return d(this,r),i.apply(this,arguments)}return p(r,[{key:"getDefault",value:function(){return e.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){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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),ve=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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),me=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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(t){v(r,t);var i=m(r);function r(){return d(this,r),i.apply(this,arguments)}return p(r,[{key:"getDefault",value:function(){return e.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(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}]),r}(re),ge=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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),Se=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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),Me=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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),Ae=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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),Ie=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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),Ce=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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){v(i,e);var t=m(i);function i(e){var r;return d(this,i),(r=t.call(this,e)).vao=e.extVertexArrayObject,r}return p(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){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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){v(i,e);var t=m(i);function i(e,r){var n;return d(this,i),(n=t.call(this,e)).context=e,n.parent=r,n}return p(i,[{key:"getDefault",value:function(){return null}}]),i}(re),Be=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"attachment",value:function(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}]),i}(Oe),Ue=function(){function e(t,i,r,n){d(this,e),this.context=t,this.width=i,this.height=r;var a=this.framebuffer=t.gl.createFramebuffer();this.colorAttachment=new Be(t,a),n&&(this.depthAttachment=new Oe(t,a))}return p(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 i(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(d(this,i),this.gl=e,this.isWebGL2=t,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),t){var r=e;this.extVertexArrayObject={createVertexArrayOES:r.createVertexArray.bind(e),deleteVertexArrayOES:r.deleteVertexArray.bind(e),bindVertexArrayOES:r.bindVertexArray.bind(e)}}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 ve(this),this.blend=new me(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 Se(this),this.bindRenderbuffer=new Me(this),this.bindTexture=new Ae(this),this.bindVertexBuffer=new Ie(this),this.bindElementBuffer=new Ce(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=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureFilterAnisotropicForceOff=!1,this.extStandardDerivativesForceOff=!1,this.extDebugRendererInfo=e.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=e.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=e.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),t||(this.extTextureHalfFloat=e.getExtension("OES_texture_half_float")),(t||this.extTextureHalfFloat&&e.getExtension("OES_texture_half_float_linear"))&&(this.extRenderToTextureHalfFloat=e.getExtension("EXT_color_buffer_half_float")),this.extStandardDerivatives=t||e.getExtension("OES_standard_derivatives"),this.extTimerQuery=e.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE)}return p(i,[{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)}},{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(i){t(i.blendFunction,e.ColorMode.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(i.blendFunction),this.blendColor.set(i.blendColor)),this.colorMask.set(i.mask)}},{key:"unbindVAO",value:function(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)}}]),i}(),Ne=function(t){v(r,t);var i=m(r);function r(t,a,o,s){var u;if(d(this,r),(u=i.call(this)).id=t,u.dispatcher=o,u.type="vector",u.minzoom=0,u.maxzoom=22,u.scheme="xyz",u.tileSize=512,u.reparseOverscaled=!0,u.isTileClipped=!0,u._loaded=!1,e.extend(n(u),e.pick(a,["url","scheme","tileSize","promoteId"])),u._options=e.extend({type:"vector"},a),u._collectResourceTiming=a.collectResourceTiming,512!==u.tileSize)throw new Error("vector tile sources must have a tileSize of 512");return u.setEventedParent(s),u._tileWorkers={},u._deduped=new e.DedupedRequest,l(u)}return p(r,[{key:"load",value:function(t){var i=this;this._loaded=!1,this.fire(new e.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){i._tileJSONRequest=null,i._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)),i.fire(new e.ErrorEvent(a))):o&&(e.extend(i,o),o.bounds&&(i.tileBounds=new Q(o.bounds,i.minzoom,i.maxzoom)),e.postTurnstileEvent(o.tiles,i.map._requestManager._customAccessToken),i.fire(new e.Event("data",{dataType:"source",sourceDataType:"metadata"})),i.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"}))),t&&t(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 e.extend({},this._options)}},{key:"loadTile",value:function(t,i){var r=this,n=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme)),a={request:this.map._requestManager.transformRequest(n,e.ResourceType.Tile),data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:e.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:t.isSymbolTile};if(a.request.collectResourceTiming=this._collectResourceTiming,t.actor&&"expired"!==t.state)"loading"===t.state?t.reloadCallback=i:t.request=t.actor.send("reloadTile",a,s.bind(this));else if(t.actor=this._tileWorkers[n]=this._tileWorkers[n]||this.dispatcher.getActor(),this.dispatcher.ready)t.request=t.actor.send("loadTile",a,s.bind(this),void 0,!0);else{var o=e.loadVectorTile.call({deduped:this._deduped},a,(function(e,i){e||!i?s.call(r,e):(a.data={cacheControl:i.cacheControl,expires:i.expires,rawData:i.rawData.slice(0)},t.actor&&t.actor.send("loadTile",a,s.bind(r),void 0,!0))}),!0);t.request={cancel:o}}function s(r,n){return delete t.request,t.aborted?i(null):r&&404!==r.status?i(r):(n&&n.resourceTiming&&(t.resourceTiming=n.resourceTiming),this.map._refreshExpiredTiles&&n&&t.setExpiryData(n),t.loadVectorData(n,this.map.painter),e.cacheEntryPossiblyAdded(this.dispatcher),i(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.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.type,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}(e.Evented),je=function(t){v(r,t);var i=m(r);function r(t,a,o,s){var l;return d(this,r),(l=i.call(this)).id=t,l.dispatcher=o,l.setEventedParent(s),l.type="raster",l.minzoom=0,l.maxzoom=22,l.roundZoom=!0,l.scheme="xyz",l.tileSize=512,l._loaded=!1,l._options=e.extend({type:"raster"},a),e.extend(n(l),e.pick(a,["url","scheme","tileSize"])),l}return p(r,[{key:"load",value:function(t){var i=this;this._loaded=!1,this.fire(new e.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=J(this._options,this.map._requestManager,null,null,(function(r,n){i._tileJSONRequest=null,i._loaded=!0,r?i.fire(new e.ErrorEvent(r)):n&&(e.extend(i,n),n.bounds&&(i.tileBounds=new Q(n.bounds,i.minzoom,i.maxzoom)),e.postTurnstileEvent(n.tiles),i.fire(new e.Event("data",{dataType:"source",sourceDataType:"metadata"})),i.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"}))),t&&t(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 e.extend({},this._options)}},{key:"hasTile",value:function(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}},{key:"loadTile",value:function(t,i){var r=this,n=e.exported.devicePixelRatio>=2,a=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),n,this.tileSize);t.request=e.getImage(this.map._requestManager.transformRequest(a,e.ResourceType.Tile),(function(n,a,o,s){return delete t.request,t.aborted?(t.state="unloaded",i(null)):n?(t.state="errored",i(n)):a?(r.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:o,expires:s}),t.setTexture(a,r.map.painter),t.state="loaded",e.cacheEntryPossiblyAdded(r.dispatcher),void i(null)):i(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}(e.Evented);function Ge(t,i,r,n,a,o,s,l){var u=[t,r,a,i,n,o,1,1,1],c=[s,l,1],f=e.adjoint([],u),d=e.transformMat3(c,c,e.transpose(f,f)),p=h(d,3),v=p[0],m=p[1],y=p[2];return e.multiply$1(u,[v,0,0,0,m,0,0,0,y],u)}var Ze=function(t){v(r,t);var i=m(r);function r(e,t,n,a){var o;return d(this,r),(o=i.call(this)).id=e,o.dispatcher=n,o.coordinates=t.coordinates,o.type="image",o.minzoom=0,o.maxzoom=22,o.tileSize=512,o.tiles={},o._loaded=!1,o.setEventedParent(a),o.options=t,o._dirty=!1,o}return p(r,[{key:"load",value:function(t,i){var r=this;this._loaded=i||!1,this.fire(new e.Event("dataloading",{dataType:"source"})),this.url=this.options.url,this._imageRequest=e.getImage(this.map._requestManager.transformRequest(this.url,e.ResourceType.Image),(function(i,n){if(r._imageRequest=null,r._loaded=!0,i)r.fire(new e.ErrorEvent(i));else if(n){var a=e.window.HTMLImageElement;r.image=n instanceof a?e.exported.getImageData(n):n,r._dirty=!0,r.width=r.image.width,r.height=r.image.height,t&&(r.coordinates=t),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 e.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(t){this.coordinates=t,this._boundsArray=void 0;var i=t.map(e.MercatorCoordinate.fromLngLat);return this.tileID=function(t){var i,r=1/0,n=1/0,a=-1/0,o=-1/0,s=f(t);try{for(s.s();!(i=s.n()).done;){var l=i.value;r=Math.min(r,l.x),n=Math.min(n,l.y),a=Math.max(a,l.x),o=Math.max(o,l.y)}}catch(d){s.e(d)}finally{s.f()}var u=Math.max(a-r,o-n),c=Math.max(0,Math.floor(-Math.log(u)/Math.LN2)),h=Math.pow(2,c);return new e.CanonicalTileID(c,Math.floor((r+a)/2*h),Math.floor((n+o)/2*h))}(i),this.minzoom=this.maxzoom=this.tileID.z,this.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"})),this}},{key:"_clear",value:function(){this._boundsArray=void 0}},{key:"_prepareData",value:function(t){for(var i in this.tiles){var r=this.tiles[i];"loaded"!==r.state&&(r.state="loaded",r.texture=this.texture)}if(!this._boundsArray){var n=e.tileTransform(this.tileID,this.map.transform.projection),a=this.coordinates.map((function(t){var i=n.projection.project(t[0],t[1]);return e.getTilePoint(n,i)._round()})),o=h(a,4),s=o[0],l=o[1],u=o[2],c=o[3];this.perspectiveTransform=function(t,i,r,n,a,o,s,l,u,c){var h=Ge(0,0,t,0,0,i,t,i),f=Ge(r,n,a,o,s,l,u,c);return e.multiply$1(f,e.adjoint(h,h),f),[f[6]/f[8]*t/e.EXTENT,f[7]/f[8]*i/e.EXTENT]}(this.width,this.height,s.x,s.y,l.x,l.y,c.x,c.y,u.x,u.y);var f=this._boundsArray=new e.StructArrayLayout4i8;f.emplaceBack(s.x,s.y,0,0),f.emplaceBack(l.x,l.y,e.EXTENT,0),f.emplaceBack(c.x,c.y,0,e.EXTENT),f.emplaceBack(u.x,u.y,e.EXTENT,e.EXTENT),this.boundsBuffer&&this.boundsBuffer.destroy(),this.boundsBuffer=t.createVertexBuffer(f,e.boundsAttributes.members),this.boundsSegments=e.SegmentVector.simpleSegment(0,0,4,2)}}},{key:"prepare",value:function(){if(0!==Object.keys(this.tiles).length&&this.image){var t=this.map.painter.context,i=t.gl;this._dirty&&(this.texture?this.texture.update(this.image):(this.texture=new e.Texture(t,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE)),this._dirty=!1),this._prepareData(t)}}},{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}(e.Evented),qe={vector:Ne,raster:je,"raster-dem":function(t){v(r,t);var i=m(r);function r(t,n,a,o){var s;return d(this,r),(s=i.call(this,t,n,a,o)).type="raster-dem",s.maxzoom=22,s._options=e.extend({type:"raster-dem"},n),s.encoding=n.encoding||"mapbox",s}return p(r,[{key:"loadTile",value:function(t,i){var r=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function n(e,r){e&&(t.state="errored",i(e)),r&&(t.dem=r,t.dem.onDeserialize(),t.needsHillshadePrepare=!0,t.needsDEMTextureUpload=!0,t.state="loaded",i(null))}t.request=e.getImage(this.map._requestManager.transformRequest(r,e.ResourceType.Tile),function(r,a,o,s){if(delete t.request,t.aborted)t.state="unloaded",i(null);else if(r)t.state="errored",i(r);else if(a){this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:o,expires:s});var l=e.window.ImageBitmap&&a instanceof e.window.ImageBitmap&&(null==$&&($=e.window.OffscreenCanvas&&new e.window.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof e.window.createImageBitmap),$),u=1-(a.width-e.prevPowerOfTwo(a.width))/2;u<1||t.neighboringTiles||(t.neighboringTiles=this._getNeighboringTiles(t.tileID));var c=l?a:e.exported.getImageData(a,u),h={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:c,encoding:this.encoding,padding:u};t.actor&&"expired"!==t.state||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",h,n.bind(this),void 0,!0))}}.bind(this))}},{key:"_getNeighboringTiles",value:function(t){var i=t.canonical,r=Math.pow(2,i.z),n=(i.x-1+r)%r,a=0===i.x?t.wrap-1:t.wrap,o=(i.x+1+r)%r,s=i.x+1===r?t.wrap+1:t.wrap,l={};return l[new e.OverscaledTileID(t.overscaledZ,a,i.z,n,i.y).key]={backfilled:!1},l[new e.OverscaledTileID(t.overscaledZ,s,i.z,o,i.y).key]={backfilled:!1},i.y>0&&(l[new e.OverscaledTileID(t.overscaledZ,a,i.z,n,i.y-1).key]={backfilled:!1},l[new e.OverscaledTileID(t.overscaledZ,t.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},l[new e.OverscaledTileID(t.overscaledZ,s,i.z,o,i.y-1).key]={backfilled:!1}),i.y+1<r&&(l[new e.OverscaledTileID(t.overscaledZ,a,i.z,n,i.y+1).key]={backfilled:!1},l[new e.OverscaledTileID(t.overscaledZ,t.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},l[new e.OverscaledTileID(t.overscaledZ,s,i.z,o,i.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}(je),geojson:function(t){v(r,t);var i=m(r);function r(t,n,a,o){var s;d(this,r),(s=i.call(this)).id=t,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=e.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=e.EXTENT/s.tileSize;return s.workerOptions=e.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:e.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:e.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 p(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 t=this;if(this._pendingLoad)this._coalesce=!0;else{this.fire(new e.Event("dataloading",{dataType:"source"})),this._loaded=!1;var i=e.extend({},this.workerOptions),r=this._data;"string"==typeof r?(i.request=this.map._requestManager.transformRequest(e.exported.resolveURL(r),e.ResourceType.Source),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(r),this._pendingLoad=this.actor.send("".concat(this.type,".loadData"),i,(function(i,r){if(t._loaded=!0,t._pendingLoad=null,i)t.fire(new e.ErrorEvent(i));else{var n={dataType:"source",sourceDataType:t._metadataFired?"content":"metadata"};t._collectResourceTiming&&r&&r.resourceTiming&&r.resourceTiming[t.id]&&(n.resourceTiming=r.resourceTiming[t.id]),t.fire(new e.Event("data",n)),t._metadataFired=!0}t._coalesce&&(t._updateWorkerData(),t._coalesce=!1)}))}}},{key:"loaded",value:function(){return this._loaded}},{key:"loadTile",value:function(t,i){var r=this,n=t.actor?"reloadTile":"loadTile";t.actor=this.actor,t.request=this.actor.send(n,{type:this.type,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:e.exported.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},(function(e,a){return delete t.request,t.unloadVectorData(),t.aborted?i(null):e?i(e):(t.loadVectorData(a,r.map.painter,"reloadTile"===n),i(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 e.extend({},this._options,{type:this.type,data:this._data})}},{key:"hasTransition",value:function(){return!1}}]),r}(e.Evented),video:function(t){v(r,t);var i=m(r);function r(e,t,n,a){var o;return d(this,r),(o=i.call(this,e,t,n,a)).roundZoom=!0,o.type="video",o.options=t,o}return p(r,[{key:"load",value:function(){var t=this;this._loaded=!1;var i=this.options;this.urls=[];var r,n=f(i.urls);try{for(n.s();!(r=n.n()).done;){var a=r.value;this.urls.push(this.map._requestManager.transformRequest(a,e.ResourceType.Source).url)}}catch(o){n.e(o)}finally{n.f()}e.getVideo(this.urls,(function(i,r){t._loaded=!0,i?t.fire(new e.ErrorEvent(i)):r&&(t.video=r,t.video.loop=!0,t.video.setAttribute("playsinline",""),t.video.addEventListener("playing",(function(){t.map.triggerRepaint()})),t.map&&t.video.play(),t._finishLoading())}))}},{key:"pause",value:function(){this.video&&this.video.pause()}},{key:"play",value:function(){this.video&&this.video.play()}},{key:"seek",value:function(t){if(this.video){var i=this.video.seekable;t<i.start(0)||t>i.end(0)?this.fire(new e.ErrorEvent(new e.ValidationError("sources.".concat(this.id),null,"Playback for this video can be set only between the ".concat(i.start(0)," and ").concat(i.end(0),"-second mark.")))):this.video.currentTime=t}}},{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 t=this.map.painter.context,i=t.gl;this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new e.Texture(t,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(t)}}},{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(t){v(r,t);var i=m(r);function r(t,n,a,o){var s;return d(this,r),s=i.call(this,t,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 e.ErrorEvent(new e.ValidationError("sources.".concat(t),null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):s.fire(new e.ErrorEvent(new e.ValidationError("sources.".concat(t),null,'missing required property "coordinates"'))),n.animate&&"boolean"!=typeof n.animate&&s.fire(new e.ErrorEvent(new e.ValidationError("sources.".concat(t),null,'optional "animate" property must be a boolean value'))),n.canvas?"string"==typeof n.canvas||n.canvas instanceof e.window.HTMLCanvasElement||s.fire(new e.ErrorEvent(new e.ValidationError("sources.".concat(t),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 e.ErrorEvent(new e.ValidationError("sources.".concat(t),null,'missing required property "canvas"'))),s.options=n,s.animate=void 0===n.animate||n.animate,s}return p(r,[{key:"load",value:function(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof e.window.HTMLCanvasElement?this.options.canvas:e.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new e.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}},{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 t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),!this._hasInvalidDimensions()&&0!==Object.keys(this.tiles).length){var i=this.map.painter.context;this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new e.Texture(i,this.canvas,i.gl.RGBA,{premultiply:!0}),this._prepareData(i)}}},{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(t){v(r,t);var i=m(r);function r(t,a,o,s){var l;return d(this,r),(l=i.call(this)).id=t,l.type="custom",l._dataType="raster",l._dispatcher=o,l._implementation=a,l.setEventedParent(s),l.scheme="xyz",l.minzoom=0,l.maxzoom=22,l.tileSize=512,l._loaded=!1,l.roundZoom=!0,l._implementation||l.fire(new e.ErrorEvent(new Error("Missing implementation for ".concat(l.id," custom source")))),l._implementation.loadTile||l.fire(new e.ErrorEvent(new Error("Missing loadTile implementation for ".concat(l.id," custom source")))),l._implementation.bounds&&(l.tileBounds=new Q(l._implementation.bounds,l.minzoom,l.maxzoom)),a.update=l._update.bind(n(l)),a.clearTiles=l._clearTiles.bind(n(l)),a.coveringTiles=l._coveringTiles.bind(n(l)),e.extend(n(l),e.pick(a,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"])),l}return p(r,[{key:"serialize",value:function(){return e.pick(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}},{key:"load",value:function(){this._loaded=!0,this.fire(new e.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new e.Event("data",{dataType:"source",sourceDataType:"content"}))}},{key:"loaded",value:function(){return this._loaded}},{key:"onAdd",value:function(t){this._map=t,this._loaded=!1,this.fire(new e.Event("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(t),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(t,i){var r=t.tileID.canonical,n=r.x,a=r.y,o=r.z,s=new e.window.AbortController;t.request=Promise.resolve(this._implementation.loadTile({x:n,y:a,z:o},{signal:s.signal})).then(function(r){return delete t.request,t.aborted?(t.state="unloaded",i(null)):void 0===r?(t.state="errored",i(null)):null===r?(this.loadTileData(t,{width:this.tileSize,height:this.tileSize,data:null}),t.state="loaded",i(null)):function(t){return t instanceof e.window.ImageData||t instanceof e.window.HTMLCanvasElement||t instanceof e.window.ImageBitmap||t instanceof e.window.HTMLImageElement}(r)?(this.loadTileData(t,r),t.state="loaded",void i(null)):(t.state="errored",i(new Error("Can't infer data type for ".concat(this.id,", only raster data supported at the moment"))))}.bind(this)).catch((function(e){20!==e.code&&(t.state="errored",i(e))})),t.request.cancel=function(){return s.abort()}}},{key:"loadTileData",value:function(e,t){je.loadTileData(e,t,this._map.painter)}},{key:"unloadTileData",value:function(e){je.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 e.Event("data",{dataType:"source",sourceDataType:"content"}))}}]),r}(e.Evented)},We=function(t,i,r,n){var a=new qe[i.type](t,i,r,n);if(a.id!==t)throw new Error("Expected Source id to be ".concat(t," instead of ").concat(a.id));return e.bindAll(["load","abort","unload","serialize","prepare"],a),a};function Xe(t,i){var r=e.identity([]);return e.scale(r,r,[.5*t.width,.5*-t.height,1]),e.translate(r,r,[1,-1,0]),e.multiply(r,r,t.calculateProjMatrix(i.toUnwrapped())),Float32Array.from(r)}function He(e,t,i,r,n,a,o){var s=arguments.length>7&&void 0!==arguments[7]&&arguments[7],l=e.tilesIn(r,o,s);l.sort(Ke);var u,c=[],h=f(l);try{for(h.s();!(u=h.n()).done;){var d=u.value;c.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(m){h.e(m)}finally{h.f()}var p=function(e){var t,i={},r={},n=f(e);try{for(n.s();!(t=n.n()).done;){var a=t.value,o=a.queryResults,s=a.wrappedTileID,l=r[s]=r[s]||{};for(var u in o){var c,h=o[u],d=l[u]=l[u]||{},p=i[u]=i[u]||[],v=f(h);try{for(v.s();!(c=v.n()).done;){var y=c.value;d[y.featureIndex]||(d[y.featureIndex]=!0,p.push(y))}}catch(m){v.e(m)}finally{v.f()}}}}catch(m){n.e(m)}finally{n.f()}return i}(c);for(var v in p)p[v].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!=Ma.workerClass?new Ma.workerClass:new e.window.Worker(Ma.workerUrl)}var $e,Qe="mapboxgl_preloaded_worker_pool",et=function(){function e(){d(this,e),this.active={}}return p(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.forEach((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(t,i){var r={};for(var n in t)"ref"!==n&&(r[n]=t[n]);return e.refProperties.forEach((function(e){e in i&&(r[e]=i[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,i,r){var n;for(n in e[r])if(e[r].hasOwnProperty(n)&&"data"!==n&&!t(e[r][n],i[r][n]))return!1;for(n in i[r])if(i[r].hasOwnProperty(n)&&"data"!==n&&!t(e[r][n],i[r][n]))return!1;return!0}function ut(e,i,r,n,a,o){var s;for(s in i=i||{},e=e||{})e.hasOwnProperty(s)&&(t(e[s],i[s])||r.push({command:o,args:[n,s,i[s],a]}));for(s in i)i.hasOwnProperty(s)&&!e.hasOwnProperty(s)&&(t(e[s],i[s])||r.push({command:o,args:[n,s,i[s],a]}))}function ct(e){return e.id}function ht(e,t){return e[t.id]=t,e}var ft=function(){function t(e,i){d(this,t),this.reset(e,i)}return p(t,[{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(t){if(1===this.points.length)return this.points[0];t=e.clamp(t,0,1);for(var i=1,r=this._distances[i],n=t*this.paddedLength+this.padding;r<n&&i<this._distances.length;)r=this._distances[++i];var a=i-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[i].mult(l))}}]),t}(),dt=function(){function e(t,i,r){d(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 p(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}return 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 l=o.seenUids,u=this.boxCells[n];if(null!==u){var c,h=this.bboxes,d=f(u);try{for(d.s();!(c=d.n()).done;){var p=c.value;if(!l.box[p]){l.box[p]=!0;var v=4*p;if(e<=h[v+2]&&t<=h[v+3]&&i>=h[v+0]&&r>=h[v+1]&&(!s||s(this.boxKeys[p]))){if(o.hitTest)return a.push(!0),!0;a.push({key:this.boxKeys[p],x1:h[v],y1:h[v+1],x2:h[v+2],y2:h[v+3]})}}}}catch(E){d.e(E)}finally{d.f()}}var m=this.circleCells[n];if(null!==m){var y,_=this.circles,g=f(m);try{for(g.s();!(y=g.n()).done;){var x=y.value;if(!l.circle[x]){l.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 l=o.circle,u=o.seenUids,c=this.boxCells[n];if(null!==c){var h,d=this.bboxes,p=f(c);try{for(p.s();!(h=p.n()).done;){var v=h.value;if(!u.box[v]){u.box[v]=!0;var m=4*v;if(this._circleAndRectCollide(l.x,l.y,l.radius,d[m+0],d[m+1],d[m+2],d[m+3])&&(!s||s(this.boxKeys[v])))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=f(y);try{for(x.s();!(_=x.n()).done;){var b=_.value;if(!u.circle[b]){u.circle[b]=!0;var w=3*b;if(this._circlesCollide(g[w],g[w+1],g[w+2],l.x,l.y,l.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 vt(t,i,r,n,a,o,s){var l=e.create();if(r)if("globe"===o.name){var u=e.calculateGlobeLabelMatrix(a,i);e.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||e.rotateZ(l,l,a.angle)}else e.multiply(l,a.labelPlaneMatrix,t);return l}function mt(e,t,i,r,n,a,o){var s=vt(e,t,i,r,n,a,o);return"globe"===a.name&&i||(s[2]=s[6]=s[10]=s[14]=0),s}function yt(t,i,r,n,a,o,s){if(r){if("globe"===o.name){var l=vt(t,i,r,n,a,o,s);return e.invert(l,l),e.multiply(l,t,l),l}var u=e.clone(t),c=e.identity([]);return c[0]=s[0],c[1]=s[1],c[4]=s[2],c[5]=s[3],e.multiply(u,u,c),n||e.rotateZ(u,u,-a.angle),u}return a.glCoordMatrix}function _t(t,i,r,n){var a=[t,i,r,1];r?e.transformMat4$1(a,a,n):It(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(t,i,r,n,a,o,s,l,u,c){var f=r.transform,d=n?t.textSizeData:t.iconSizeData,p=e.evaluateSizeForZoom(d,r.transform.zoom),v="globe"===f.projection.name,m=[256/r.width*2+1,256/r.height*2+1],y=n?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;y.clear();var _=null;v&&(_=n?t.text.globeExtVertexArray:t.icon.globeExtVertexArray);for(var g,x=t.lineVertexArray,b=n?t.text.placedSymbolArray:t.icon.placedSymbolArray,w=r.transform.width/r.transform.height,k=!1,T=0;T<b.length;T++){var E=b.get(T),S=E.numGlyphs,M=E.writingMode;if(M!==e.WritingMode.vertical||k||g===e.WritingMode.horizontal||(k=!0),g=M,!E.hidden&&M!==e.WritingMode.vertical||k){k=!1;var A=new e.pointGeometry(E.tileAnchorX,E.tileAnchorY),I=f.projection.projectTilePoint(A.x,A.y,c.canonical),C=I.x,z=I.y,P=I.z;if(u){var D=u(A),L=h(D,3);C+=L[0],z+=L[1],P+=L[2]}var R=[C,z,P,1];if(e.transformMat4$1(R,R,i),xt(R,m)){var B=gt(r.transform.cameraToCenterDistance,R[3]),O=e.evaluateSizeForFeature(d,p,E),F=s?O/B:O*B,U=_t(C,z,P,a);if(U[3]<=0)At(S,y);else{var V={},N=s?null:u,j=Tt(E,F,!1,l,i,a,o,t.glyphOffsetArray,x,y,_,U,A,V,w,N,f.projection,c,s);k=j.useVertical,N&&j.needsFlipping&&(V={}),(j.notEnoughRoom||k||j.needsFlipping&&Tt(E,F,!0,l,i,a,o,t.glyphOffsetArray,x,y,_,U,A,V,w,N,f.projection,c,s).notEnoughRoom)&&At(S,y)}}else At(S,y)}else At(S,y)}n?(t.text.dynamicLayoutVertexBuffer.updateData(y),_&&t.text.globeExtVertexBuffer.updateData(_)):(t.icon.dynamicLayoutVertexBuffer.updateData(y),_&&t.icon.globeExtVertexBuffer.updateData(_))}function wt(e,t,i,r,n,a,o,s,l,u,c,h,f,d,p,v){var m=s.lineStartIndex,y=s.glyphStartIndex,_=s.segment,g=y+s.numGlyphs,x=m+s.lineLength,b=t.getoffsetX(y),w=t.getoffsetX(g-1),k=Mt(e*b,i,r,n,a,o,_,m,x,l,u,c,h,f,!0,d,p,v);if(!k)return null;var T=Mt(e*w,i,r,n,a,o,_,m,x,l,u,c,h,f,!0,d,p,v);return T?{first:k,last:T}:null}function kt(t,i,r,n){return t===e.WritingMode.horizontal&&Math.abs(n)>Math.abs(r)?{useVertical:!0}:t===e.WritingMode.vertical?n>0?{needsFlipping:!0}:null:0!==i&&function(e,t){return 0===e||Math.abs(t/e)>pt}(r,n)?1===i?{needsFlipping:!0}:null:r<0?{needsFlipping:!0}:null}function Tt(t,i,r,n,a,o,s,l,u,c,f,d,p,v,m,y,_,g,x){var b=i/24,w=t.lineOffsetX*b,k=t.lineOffsetY*b,T=t.lineStartIndex,E=t.glyphStartIndex,S=t.numGlyphs,M=t.segment,A=t.writingMode,I=t.flipState,C=T+t.lineLength,z=function(t){if(f){var i=h(t.up,3),r=i[0],n=i[1],a=i[2],o=c.length;e.updateGlobeVertexNormal(f,o+0,r,n,a),e.updateGlobeVertexNormal(f,o+1,r,n,a),e.updateGlobeVertexNormal(f,o+2,r,n,a),e.updateGlobeVertexNormal(f,o+3,r,n,a)}var s=h(t.point,3),l=s[0],u=s[1],d=s[2];e.addDynamicAttributes(c,l,u,d,t.angle)};if(S>1){var P=wt(b,l,w,k,r,d,p,t,u,o,v,y,!1,_,g,x);if(!P)return{notEnoughRoom:!0};if(n&&!r){var D,L,R,B,O=h(P.first.point,3),F=O[0],U=O[1],V=O[2],N=h(P.last.point,3),j=N[0],G=N[1],Z=N[2];D=_t(F,U,V,s),F=(L=h(D,2))[0],U=L[1],R=_t(j,G,Z,s);var q=kt(A,I,((j=(B=h(R,2))[0])-F)*m,(G=B[1])-U);if(t.flipState=q&&q.needsFlipping?1:2,q)return q}z(P.first);for(var W=E+1;W<E+S-1;W++){var X=Mt(b*l.getoffsetX(W),w,k,r,d,p,M,T,C,u,o,v,y,!1,!1,_,g,x);if(!X)return c.length-=4*(W-E),{notEnoughRoom:!0};z(X)}z(P.last)}else{if(n&&!r){var H=_t(p.x,p.y,0,a),Y=T+M+1,K=new e.pointGeometry(u.getx(Y),u.gety(Y)),J=_t(K.x,K.y,0,a),$=J[3]>0?J:St(p,K,H,1,a,void 0,_,g.canonical),Q=kt(A,I,($[0]-H[0])*m,$[1]-H[1]);if(t.flipState=Q&&Q.needsFlipping?1:2,Q)return Q}var ee=Mt(b*l.getoffsetX(E),w,k,r,d,p,M,T,C,u,o,v,y,!1,!1,_,g,x);if(!ee)return{notEnoughRoom:!0};z(ee)}return{}}function Et(e,t,i,r,n){var a=r.projectTilePoint(e.x,e.y,t),o=a.x,s=a.y,l=a.z;if(!n)return _t(o,s,l,i);var u=n(e),c=h(u,3);return _t(o+c[0],s+c[1],l+c[2],i)}function St(t,i,r,n,a,o,s,l){var u=Et(t.sub(i)._unit()._add(t),l,a,s,o);return e.sub(u,r,u),e.normalize(u,u),e.scaleAndAdd(u,r,u,n)}function Mt(t,i,r,n,a,o,s,l,u,c,h,f,d,p,v,m,y,_){var g=n?t-i:t+i,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,S=0,M=Math.abs(g),A=[],I=[],C=o,z=C,P=function(){return St(z,C,T,M-E+1,h,d,m,y.canonical)};E+S<=M;){if((w+=x)<l||w>=u)return null;if(T=k,z=C,A.push(T),p&&I.push(z),C=new e.pointGeometry(c.getx(w),c.gety(w)),!(k=f[w])){var D=Et(C,y.canonical,h,m,d);k=D[3]>0?f[w]=D:P()}E+=S,S=e.distance(T,k)}v&&d&&(f[w]&&(k=P(),S=e.distance(T,k)),f[w]=k);var L=(M-E)/S,R=C.sub(z)._mult(L)._add(z),B=e.sub([],k,T),O=e.scaleAndAdd([],T,B,L),F=[0,0,1],U=B[0],V=B[1];if(_&&(0!==(F=m.upVector(y.canonical,R.x,R.y))[0]||0!==F[1]||1!==F[2])){var N=[F[2],0,-F[0]],j=e.cross([],F,N);e.normalize(N,N),e.normalize(j,j),U=e.dot(B,N),V=e.dot(B,j)}if(r){var G=e.cross([],F,B);e.normalize(G,G),e.scaleAndAdd(O,O,G,r*x)}var Z=b+Math.atan2(V,U);return A.push(O),p&&I.push(R),{point:O,angle:Z,path:A,tilePath:I,up:F}}function At(e,t){var i=t.length,r=i+4*e;t.resize(r),t.float32.fill(-1/0,4*i,4*r)}function It(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 Ct=100,zt=function(){function t(e,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new dt(e.width+200,e.height+200,25),n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new dt(e.width+200,e.height+200,25);d(this,t),this.transform=e,this.grid=r,this.ignoredGrid=n,this.pitchfactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+Ct,this.screenBottomBoundary=e.height+Ct,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.fogState=i}return p(t,[{key:"placeCollisionBox",value:function(e,t,i,r,n,a,o,s){var l=i.projectedAnchorX,u=i.projectedAnchorY,c=i.projectedAnchorZ,f=i.elevation,d=i.tileID,p=e.getProjection();if(f&&d){var v=p.upVector(d.canonical,i.tileAnchorX,i.tileAnchorY),m=h(v,3),y=m[0],_=m[1],g=m[2],x=p.upVectorScale(d.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;l+=y*f*x,u+=_*f*x,c+=g*f*x}var b=this.projectAndGetPerspectiveRatio(o,l,u,c,i.tileID,"globe"===p.name||!!f||this.transform.pitch>0,p),w=a*b.perspectiveRatio,k=(i.x1*t+r.x-i.padding)*w+b.point.x,T=(i.y1*t+r.y-i.padding)*w+b.point.y,E=(i.x2*t+r.x+i.padding)*w+b.point.x,S=(i.y2*t+r.y+i.padding)*w+b.point.y,M=b.perspectiveRatio<=.55||b.occluded;return!this.isInsideGrid(k,T,E,S)||!n&&this.grid.hitTest(k,T,E,S,s)||M?{box:[],offscreen:!1,occluded:b.occluded}:{box:[k,T,E,S],offscreen:this.isOffscreen(k,T,E,S),occluded:!1}}},{key:"placeCollisionCircles",value:function(t,i,r,n,a,o,s,l,u,c,d,p,v,m,y){var _=[],g=this.transform.elevation,x=t.getProjection(),b=g?g.getAtTileOffsetFunc(y,this.transform.center.lat,this.transform.worldSize,x):null,w=new e.pointGeometry(r.tileAnchorX,r.tileAnchorY),k=x.projectTilePoint(w.x,w.y,y.canonical),T=k.x,E=k.y,S=k.z;if(b){var M=b(w),A=h(M,3);T+=A[0],E+=A[1],S+=A[2]}var I="globe"===x.name,C=this.projectAndGetPerspectiveRatio(s,T,E,S,y,I||!!g||this.transform.pitch>0,x),z=C.perspectiveRatio,P=(d?o/z:o*z)/e.ONE_EM,D=_t(T,E,S,l),L=C.signedDistanceFromCamera>0?wt(P,a,r.lineOffsetX*P,r.lineOffsetY*P,!1,D,w,r,n,l,{},g&&!d?b:null,d&&!!g,x,y,d):null,R=!1,B=!1,O=!0;if(L&&!C.occluded){for(var F=.5*v*z+m,U=new e.pointGeometry(-100,-100),V=new e.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),N=new ft,j=L.first,G=L.last,Z=j.path.length,q=[],W=Z-1;W>=1;W--)q.push(j.path[W]);for(var X=1;X<G.path.length;X++)q.push(G.path[X]);var H=2.5*F;u&&(q=q.map((function(e,t){var i=h(e,3),r=i[0],n=i[1],a=i[2];return b&&!I&&(a=b(t<Z-1?j.tilePath[Z-1-t]:G.tilePath[t-Z+2])[2]),_t(r,n,a,u)})),q.some((function(e){return e[3]<=0}))&&(q=[]));var Y=[];if(q.length>0){var K,J=1/0,$=-1/0,Q=1/0,ee=-1/0,te=f(q);try{for(te.s();!(K=te.n()).done;){var ie=K.value;J=Math.min(J,ie[0]),Q=Math.min(Q,ie[1]),$=Math.max($,ie[0]),ee=Math.max(ee,ie[1])}}catch(me){te.e(me)}finally{te.f()}$>=U.x&&J<=V.x&&ee>=U.y&&Q<=V.y&&(Y=[q.map((function(t){return new e.pointGeometry(t[0],t[1])}))],(J<U.x||$>V.x||Q<U.y||ee>V.y)&&(Y=e.clipLine(Y,U.x,U.y,V.x,V.y)))}var re,ne=f(Y);try{for(ne.s();!(re=ne.n()).done;){var ae=re.value;N.reset(ae,.25*F);var oe=0;oe=N.length<=.5*F?1:Math.ceil(N.paddedLength/H)+1;for(var se=0;se<oe;se++){var le=se/Math.max(oe-1,1),ue=N.lerp(le),ce=ue.x+Ct,he=ue.y+Ct;_.push(ce,he,F,0);var fe=ce-F,de=he-F,pe=ce+F,ve=he+F;if(O=O&&this.isOffscreen(fe,de,pe,ve),B=B||this.isInsideGrid(fe,de,pe,ve),!i&&this.grid.hitTestCircle(ce,he,F,p)&&(R=!0,!c))return{circles:[],offscreen:!1,collisionDetected:R,occluded:!1}}}}catch(me){ne.e(me)}finally{ne.f()}}return{circles:!c&&R||!B?[]:_,offscreen:O,collisionDetected:R,occluded:C.occluded}}},{key:"queryRenderedSymbols",value:function(t){if(0===t.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};var i,r=[],n=1/0,a=1/0,o=-1/0,s=-1/0,l=f(t);try{for(l.s();!(i=l.n()).done;){var u=i.value,c=new e.pointGeometry(u.x+Ct,u.y+Ct);n=Math.min(n,c.x),a=Math.min(a,c.y),o=Math.max(o,c.x),s=Math.max(s,c.y),r.push(c)}}catch(x){l.e(x)}finally{l.f()}var h,d=this.grid.query(n,a,o,s).concat(this.ignoredGrid.query(n,a,o,s)),p={},v={},m=f(d);try{for(m.s();!(h=m.n()).done;){var y=h.value,_=y.key;if(void 0===p[_.bucketInstanceId]&&(p[_.bucketInstanceId]={}),!p[_.bucketInstanceId][_.featureIndex]){var g=[new e.pointGeometry(y.x1,y.y1),new e.pointGeometry(y.x2,y.y1),new e.pointGeometry(y.x2,y.y2),new e.pointGeometry(y.x1,y.y2)];e.polygonIntersectsPolygon(r,g)&&(p[_.bucketInstanceId][_.featureIndex]=!0,void 0===v[_.bucketInstanceId]&&(v[_.bucketInstanceId]=[]),v[_.bucketInstanceId].push(_.featureIndex))}}}catch(x){m.e(x)}finally{m.f()}return v}},{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(t,i,r,n,a,o,s){var l=[i,r,n,1],u=!1;if(n||this.transform.pitch>0){e.transformMat4$1(l,l,t);var c="globe"===s.name;if(this.fogState&&a&&!c){var h=function(t,i,r,n,a,o){var s=o.calculateFogTileMatrix(a),l=[i,r,n];return e.transformMat4(l,l,s),V(t,l,o.pitch,o._fov)}(this.fogState,i,r,n,a.toUnwrapped(),this.transform);u=h>.9}}else It(l,l,t);var f=l[3];return{point:new e.pointGeometry((l[0]/f+1)/2*this.transform.width+Ct,(-l[1]/f+1)/2*this.transform.height+Ct),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(s)/f*.5,1.5),signedDistanceFromCamera:f,occluded:o&&l[2]>f||u}}},{key:"isOffscreen",value:function(e,t,i,r){return i<Ct||e>=this.screenRightBoundary||r<Ct||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 t=e.identity([]);return e.translate(t,t,[-100,-100,0]),t}}]),t}();function Pt(t,i,r){var n=i.createTileMatrix(t,t.worldSize,r.toUnwrapped());return e.multiply(new Float32Array(16),t.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){d(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 p(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];d(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 p(e,[{key:"isHidden",value:function(){return this.text.isHidden()&&this.icon.isHidden()}}]),e}(),Ot=p((function e(t,i,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];d(this,e),this.text=t,this.icon=i,this.skipFade=r,this.clipped=n})),Ft=p((function t(){d(this,t),this.invProjMatrix=e.create(),this.viewportMatrix=e.create(),this.circles=[]})),Ut=p((function e(t,i,r,n,a){d(this,e),this.bucketInstanceId=t,this.featureIndex=i,this.sourceLayerIndex=r,this.bucketIndex=n,this.tileID=a})),Vt=function(){function e(t){d(this,e),this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}return p(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 Nt(t,i,r,n,a){var o=e.getAnchorAlignment(t),s=-(o.horizontalAlign-.5)*i,l=-(o.verticalAlign-.5)*r,u=e.evaluateVariableOffset(t,n);return new e.pointGeometry(s+u[0]*a,l+u[1]*a)}function jt(t,i,r,n,a){var o=new e.pointGeometry(t,i);return r&&o._rotate(n?a:-a),o}var Gt=function(){function t(e,i,r,n,a){d(this,t),this.transform=e.clone(),this.projection=e.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 p(t,[{key:"getBucketParts",value:function(t,i,r,n){var a=r.getBucket(i),o=r.latestFeatureIndex;if(a&&o&&i.id===a.layerIds[0]){var s=a.layers[0].layout,l=r.collisionBoxArray,u=Math.pow(2,this.transform.zoom-r.tileID.overscaledZ),c=r.tileSize/e.EXTENT,h=r.tileID.toUnwrapped();this.transform.setProjection(a.projection);var d,p,v,m=(d=r.tileID,p=a.getProjection(),v=this.transform,p.name===this.projection?v.calculateProjMatrix(d.toUnwrapped()):Pt(v,p,d)),y="map"===s.get("text-pitch-alignment"),_="map"===s.get("text-rotation-alignment");i.compileFilter();var g=i.dynamicFilter(),x=i.dynamicFilterNeedsFeature(),b=this.transform.calculatePixelsToTileUnitsMatrix(r),w=mt(m,r.tileID.canonical,y,_,this.transform,a.getProjection(),b),k=null;if(y){var T=yt(m,r.tileID.canonical,y,_,this.transform,a.getProjection(),b);k=e.multiply([],this.transform.labelPlaneMatrix,T)}var E=null;g&&r.latestFeatureIndex&&(E={unwrappedTileID:h,dynamicFilter:g,dynamicFilterNeedsFeature:x,featureIndex:r.latestFeatureIndex}),this.retainedQueryData[a.bucketInstanceId]=new Ut(a.bucketInstanceId,o,a.sourceLayerIndex,a.index,r.tileID);var S={bucket:a,layout:s,posMatrix:m,textLabelPlaneMatrix:w,labelToScreenMatrix:k,clippingData:E,scale:u,textPixelRatio:c,holdingForFade:r.holdingForFade(),collisionBoxArray:l,partiallyEvaluatedTextSize:e.evaluateSizeForZoom(a.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:e.evaluateSizeForZoom(a.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(a.sourceID)};if(n){var M,A=f(a.sortKeyRanges);try{for(A.s();!(M=A.n()).done;){var I=M.value,C=I.sortKey,z=I.symbolInstanceStart,P=I.symbolInstanceEnd;t.push({sortKey:C,symbolInstanceStart:z,symbolInstanceEnd:P,parameters:S})}}catch(D){A.e(D)}finally{A.f()}}else t.push({symbolInstanceStart:0,symbolInstanceEnd:a.symbolInstances.length,parameters:S})}}},{key:"attemptAnchorPlacement",value:function(e,t,i,r,n,a,o,s,l,u,c,h,f,d,p,v,m,y){var _,g=h.textOffset0,x=h.textOffset1,b=h.crossTileID,w=[g,x],k=Nt(e,i,r,w,n),T=this.collisionIndex.placeCollisionBox(d,n,t,jt(k.x,k.y,a,o,this.transform.angle),c,s,l,u.predicate);if(v){var E=d.getSymbolInstanceIconSize(y,this.transform.zoom,h.placedIconSymbolIndex);if(0===this.collisionIndex.placeCollisionBox(d,E,v,jt(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(t,i,r,n){var a=this,o=t.parameters,s=o.bucket,l=o.layout,u=o.posMatrix,c=o.textLabelPlaneMatrix,h=o.labelToScreenMatrix,d=o.clippingData,p=o.textPixelRatio,v=o.holdingForFade,m=o.collisionBoxArray,y=o.partiallyEvaluatedTextSize,_=o.partiallyEvaluatedIconSize,g=o.collisionGroup,x=l.get("text-optional"),b=l.get("icon-optional"),w=l.get("text-allow-overlap"),k=l.get("icon-allow-overlap"),T="map"===l.get("text-rotation-alignment"),E="map"===l.get("text-pitch-alignment"),S="none"!==l.get("icon-text-fit"),M="viewport-y"===l.get("symbol-z-order");this.transform.setProjection(s.projection);var A=w&&(k||!s.hasIconData()||b),I=k&&(w||!s.hasTextData()||x);!s.collisionArrays&&m&&s.deserializeCollisionBoxes(m),r&&n&&s.updateCollisionDebugBuffers(this.transform.zoom,m);var C=function(t,n,o){var m=t.crossTileID,M=t.numVerticalGlyphVertices;if(d){var C={zoom:a.transform.zoom,pitch:a.transform.pitch},z=null;if(d.dynamicFilterNeedsFeature){var P=a.retainedQueryData[s.bucketInstanceId];z=d.featureIndex.loadFeature({featureIndex:t.featureIndex,bucketIndex:P.bucketIndex,sourceLayerIndex:P.sourceLayerIndex,layoutVertexArrayOffset:0})}if(!(0,d.dynamicFilter)(C,z,a.retainedQueryData[s.bucketInstanceId].tileID.canonical,new e.pointGeometry(t.tileAnchorX,t.tileAnchorY),a.transform.calculateDistanceTileData(d.unwrappedTileID)))return a.placements[m]=new Ot(!1,!1,!1,!0),void(i[m]=!0)}if(!i[m])if(v)a.placements[m]=new Ot(!1,!1,!1);else{var D=!1,L=!1,R=!0,B=!1,O=!1,F=null,U={box:null,offscreen:null,occluded:null},V={box:null,offscreen:null,occluded:null},N=null,j=null,G=null,Z=0,q=0,W=0;o.textFeatureIndex?Z=o.textFeatureIndex:t.useRuntimeCollisionCircles&&(Z=t.featureIndex),o.verticalTextFeatureIndex&&(q=o.verticalTextFeatureIndex);var X=function(e){e.tileID=a.retainedQueryData[s.bucketInstanceId].tileID;var t=a.transform.elevation;(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(i){var r=e.WritingMode.horizontal;if(s.allowVerticalPlacement&&!i&&a.prevPlacement){var n=a.prevPlacement.placedOrientations[m];n&&(a.placedOrientations[m]=n,r=n,a.markUsedOrientation(s,r,t))}return r},K=function(t,i){if(s.allowVerticalPlacement&&M>0&&o.verticalTextBox){var r,n=f(s.writingModes);try{for(n.s();!(r=n.n()).done&&(r.value===e.WritingMode.vertical?(U=i(),V=U):U=t(),!(U&&U.box&&U.box.length)););}catch(a){n.e(a)}finally{n.f()}}else U=t()};if(l.get("text-variable-anchor")){var J=l.get("text-variable-anchor");if(a.prevPlacement&&a.prevPlacement.variableOffsets[m]){var $=a.prevPlacement.variableOffsets[m];J.indexOf($.anchor)>0&&(J=J.filter((function(e){return e!==$.anchor})),J.unshift($.anchor))}var Q=function(e,i,r){var o=s.getSymbolInstanceTextSize(y,t,a.transform.zoom,n),l=(e.x2-e.x1)*o+2*e.padding,c=(e.y2-e.y1)*o+2*e.padding,h=S&&!k?i:null;h&&X(h);for(var f={box:[],offscreen:!1,occluded:!1},d=w?2*J.length:J.length,v=0;v<d;++v){var m=a.attemptAnchorPlacement(J[v%J.length],e,l,c,o,T,E,p,u,g,v>=J.length,t,n,s,r,h,y,_);if(m&&(f=m.placedGlyphBoxes)&&f.box&&f.box.length){D=!0,F=m.shift;break}}return f};K((function(){return Q(H,o.iconBox,e.WritingMode.horizontal)}),(function(){var t=o.verticalTextBox;return t&&X(t),s.allowVerticalPlacement&&!(U&&U.box&&U.box.length)&&M>0&&t?Q(t,o.verticalIconBox,e.WritingMode.vertical):{box:null,offscreen:null,occluded:null}})),U&&(D=U.box,R=U.offscreen,B=U.occluded);var ee=Y(U&&U.box);if(!D&&a.prevPlacement){var te=a.prevPlacement.variableOffsets[m];te&&(a.variableOffsets[m]=te,a.markUsedJustification(s,te.anchor,t,ee))}}else{var ie=function(i,r){var o=s.getSymbolInstanceTextSize(y,t,a.transform.zoom,n),l=a.collisionIndex.placeCollisionBox(s,o,i,new e.pointGeometry(0,0),w,p,u,g.predicate);return l&&l.box&&l.box.length&&(a.markUsedOrientation(s,r,t),a.placedOrientations[m]=r),l};K((function(){return ie(H,e.WritingMode.horizontal)}),(function(){var t=o.verticalTextBox;return s.allowVerticalPlacement&&M>0&&t?(X(t),ie(t,e.WritingMode.vertical)):{box:null,offscreen:null,occluded:null}})),Y(U&&U.box&&U.box.length)}}if(D=(N=U)&&N.box&&N.box.length>0,R=N&&N.offscreen,B=N&&N.occluded,t.useRuntimeCollisionCircles){var re=s.text.placedSymbolArray.get(t.centerJustifiedTextSymbolIndex>=0?t.centerJustifiedTextSymbolIndex:t.verticalPlacedTextSymbolIndex),ne=e.evaluateSizeForFeature(s.textSizeData,y,re),ae=l.get("text-padding");j=a.collisionIndex.placeCollisionCircles(s,w,re,s.lineVertexArray,s.glyphOffsetArray,ne,u,c,h,r,E,g.predicate,t.collisionCircleDiameter*ne/e.ONE_EM,ae,a.retainedQueryData[s.bucketInstanceId].tileID),D=w||j.circles.length>0&&!j.collisionDetected,R=R&&j.offscreen,B=j.occluded}if(o.iconFeatureIndex&&(W=o.iconFeatureIndex),o.iconBox){var oe=function(i){X(i);var r=S&&F?jt(F.x,F.y,T,E,a.transform.angle):new e.pointGeometry(0,0),n=s.getSymbolInstanceIconSize(_,a.transform.zoom,t.placedIconSymbolIndex);return a.collisionIndex.placeCollisionBox(s,n,i,r,k,p,u,g.predicate)};L=V&&V.box&&V.box.length&&o.verticalIconBox?(G=oe(o.verticalIconBox)).box.length>0:(G=oe(o.iconBox)).box.length>0,R=R&&G.offscreen,O=G.occluded}var se=x||0===t.numHorizontalGlyphVertices&&0===M,le=b||0===t.numIconVertices;if(se||le?le?se||(L=L&&D):D=L&&D:L=D=L&&D,D&&N&&N.box&&a.collisionIndex.insertCollisionBox(N.box,l.get("text-ignore-placement"),s.bucketInstanceId,V&&V.box&&q?q:Z,g.ID),L&&G&&a.collisionIndex.insertCollisionBox(G.box,l.get("icon-ignore-placement"),s.bucketInstanceId,W,g.ID),j&&(D&&a.collisionIndex.insertCollisionCircles(j.circles,l.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<j.circles.length;he+=4)ce.circles.push(j.circles[he+0]),ce.circles.push(j.circles[he+1]),ce.circles.push(j.circles[he+2]),ce.circles.push(j.collisionDetected?1:0)}var fe="globe"!==s.projection.name;A=A&&(fe||!B),I=I&&(fe||!O),a.placements[m]=new Ot(D||A,L||I,R||s.justReloaded),i[m]=!0}};if(M)for(var z=s.getSortedSymbolIndexes(this.transform.angle),P=z.length-1;P>=0;--P){var D=z[P];C(s.symbolInstances.get(D),D,s.collisionArrays[D])}else for(var L=t.symbolInstanceStart;L<t.symbolInstanceEnd;L++)C(s.symbolInstances.get(L),L,s.collisionArrays[L]);if(r&&s.bucketInstanceId in this.collisionCircleArrays){var R=this.collisionCircleArrays[s.bucketInstanceId];e.invert(R.invProjMatrix,u),R.viewportMatrix=this.collisionIndex.getViewportMatrix()}s.justReloaded=!1}},{key:"markUsedJustification",value:function(t,i,r,n){var a=r.leftJustifiedTextSymbolIndex,o=r.centerJustifiedTextSymbolIndex,s=r.rightJustifiedTextSymbolIndex,l=r.verticalPlacedTextSymbolIndex,u=r.crossTileID,c=e.getAnchorJustification(i),h=n===e.WritingMode.vertical?l:"left"===c?a:"center"===c?o:"right"===c?s:-1;a>=0&&(t.text.placedSymbolArray.get(a).crossTileID=h>=0&&a!==h?0:u),o>=0&&(t.text.placedSymbolArray.get(o).crossTileID=h>=0&&o!==h?0:u),s>=0&&(t.text.placedSymbolArray.get(s).crossTileID=h>=0&&s!==h?0:u),l>=0&&(t.text.placedSymbolArray.get(l).crossTileID=h>=0&&l!==h?0:u)}},{key:"markUsedOrientation",value:function(t,i,r){var n=i===e.WritingMode.horizontal||i===e.WritingMode.horizontalOnly?i:0,a=i===e.WritingMode.vertical?i:0,o=r.leftJustifiedTextSymbolIndex,s=r.centerJustifiedTextSymbolIndex,l=r.rightJustifiedTextSymbolIndex,u=r.verticalPlacedTextSymbolIndex,c=t.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=f(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(t,i,r){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();var n=t.layers[0].layout,a=!!t.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||!t.hasIconData()||n.get("icon-optional")),l&&(s||!t.hasTextData()||n.get("text-optional")),!0);!t.collisionArrays&&r&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(r);for(var p=function(e,t,i){for(var r=0;r<t/4;r++)e.opacityVertexArray.emplaceBack(i)},v=0,m=0;m<t.symbolInstances.length;m++){var y=t.symbolInstances.get(m),_=y.numHorizontalGlyphVertices,g=y.numVerticalGlyphVertices,x=y.crossTileID,b=y.numIconVertices,w=this.opacities[x];i[x]?w=o:w||(w=d,this.opacities[x]=w),i[x]=!0;var k=_>0||g>0,T=b>0,E=this.placedOrientations[x],S=E===e.WritingMode.vertical,M=E===e.WritingMode.horizontal||E===e.WritingMode.horizontalOnly;if(!k&&!T||w.isHidden()||v++,k){var A=$t(w.text);p(t.text,_,S?Qt:A),p(t.text,g,M?Qt:A);var I=w.text.isHidden(),C=y.leftJustifiedTextSymbolIndex,z=y.centerJustifiedTextSymbolIndex,P=y.rightJustifiedTextSymbolIndex,D=y.verticalPlacedTextSymbolIndex,L=t.text.placedSymbolArray,R=I||S?1:0;C>=0&&(L.get(C).hidden=R),z>=0&&(L.get(z).hidden=R),P>=0&&(L.get(P).hidden=R),D>=0&&(L.get(D).hidden=I||M?1:0);var B=this.variableOffsets[x];B&&this.markUsedJustification(t,B.anchor,y,E);var O=this.placedOrientations[x];O&&(this.markUsedJustification(t,"left",y,O),this.markUsedOrientation(t,O,y))}if(T){var F=$t(w.icon),U=y.placedIconSymbolIndex,V=y.verticalPlacedIconSymbolIndex,N=t.icon.placedSymbolArray,j=w.icon.isHidden()?1:0;U>=0&&(p(t.icon,b,S?Qt:F),N.get(U).hidden=j),V>=0&&(p(t.icon,y.numVerticalIconVertices,M?Qt:F),N.get(V).hidden=j)}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){var G=t.collisionArrays[m];if(G){var Z=new e.pointGeometry(0,0),q=!0;if(G.textBox||G.verticalTextBox){if(u){var W=this.variableOffsets[x];W?(Z=Nt(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(t.textCollisionBox.collisionVertexArray,w.text.placed,!q||S,Z.x,Z.y),G.verticalTextBox&&Zt(t.textCollisionBox.collisionVertexArray,w.text.placed,!q||M,Z.x,Z.y)}var X=q&&Boolean(!M&&G.verticalIconBox);G.iconBox&&Zt(t.iconCollisionBox.collisionVertexArray,w.icon.placed,X,f?Z.x:0,f?Z.y:0),G.verticalIconBox&&Zt(t.iconCollisionBox.collisionVertexArray,w.icon.placed,!X,f?Z.x:0,f?Z.y:0)}}}if(t.fullyClipped=0===v,t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.bucketInstanceId in this.collisionCircleArrays){var H=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=H.invProjMatrix,t.placementViewportMatrix=H.viewportMatrix,t.collisionCircleArray=H.circles,delete this.collisionCircleArrays[t.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}}]),t}();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){d(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 p(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 t(e,i,r,n,a,o,s,l){d(this,t),this.placement=new Gt(e,a,o,s,l),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=n,this._done=!1}return p(t,[{key:"isDone",value:function(){return this._done}},{key:"continuePlacement",value:function(t,i,r){for(var n=this,a=e.exported.now(),o=function(){var t=e.exported.now()-a;return!n._forceFullPlacement&&t>2};this._currentPlacementIndex>=0;){var s=i[t[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}}]),t}(),ii=512/e.EXTENT/2,ri=function(){function t(e,i,r){d(this,t),this.tileID=e,this.indexedSymbolInstances={},this.bucketInstanceId=r;for(var n=0;n<i.length;n++){var a=i.get(n),o=a.key;this.indexedSymbolInstances[o]||(this.indexedSymbolInstances[o]=[]),this.indexedSymbolInstances[o].push({crossTileID:a.crossTileID,coord:this.getScaledCoordinates(a,e)})}}return p(t,[{key:"getScaledCoordinates",value:function(t,i){var r=ii/Math.pow(2,i.canonical.z-this.tileID.canonical.z);return{x:Math.floor((i.canonical.x*e.EXTENT+t.tileAnchorX)*r),y:Math.floor((i.canonical.y*e.EXTENT+t.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,l=this.getScaledCoordinates(a,t),u=f(o);try{for(u.s();!(s=u.n()).done;){var c=s.value;if(Math.abs(c.coord.x-l.x)<=r&&Math.abs(c.coord.y-l.y)<=r&&!i[c.crossTileID]){i[c.crossTileID]=!0,a.crossTileID=c.crossTileID;break}}}catch(h){u.e(h)}finally{u.f()}}}}}}]),t}(),ni=function(){function e(){d(this,e),this.maxCrossTileID=0}return p(e,[{key:"generate",value:function(){return++this.maxCrossTileID}}]),e}(),ai=function(){function e(){d(this,e),this.indexes={},this.usedCrossTileIDs={},this.lng=0}return p(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=f(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(){d(this,e),this.layerIndexes={},this.crossTileIDs=new ni,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}return p(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,l=f(t);try{for(l.s();!(s=l.n()).done;){var u=s.value,c=u.getBucket(e);c&&e.id===c.layerIds[0]&&(c.bucketInstanceId||(c.bucketInstanceId=++this.maxBucketInstanceId),n.addBucket(u.tileID,c,this.crossTileIDs)&&(a=!0),o[c.bucketInstanceId]=!0)}}catch(h){l.e(h)}finally{l.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(t,i){return e.emitValidationErrors(t,i&&i.filter((function(e){return"source.canvas"!==e.identifier})))},li=e.pick(nt,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection"]),ui=e.pick(nt,["setCenter","setZoom","setBearing","setPitch"]),ci={version:8,layers:[],sources:{}},hi={fill:!0,line:!0,background:!0,hillshade:!0,raster:!0},fi=function(i){v(a,i);var r=m(a);function a(t){var i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};d(this,a),(i=r.call(this)).map=t,i.dispatcher=new q(tt(),n(i)),i.imageManager=new D,i.imageManager.setEventedParent(n(i)),i.glyphManager=new e.GlyphManager(t._requestManager,o.localFontFamily?e.LocalGlyphMode.all:o.localIdeographFontFamily?e.LocalGlyphMode.ideographs:e.LocalGlyphMode.none,o.localFontFamily||o.localIdeographFontFamily),i.crossTileSymbolIndex=new oi,i._layers={},i._num3DLayers=0,i._numSymbolLayers=0,i._numCircleLayers=0,i._serializedLayers={},i._sourceCaches={},i._otherSourceCaches={},i._symbolSourceCaches={},i._loaded=!1,i._availableImages=[],i._order=[],i._drapedFirstOrder=[],i._markersNeedUpdate=!1,i._resetUpdates(),i.dispatcher.broadcast("setReferrer",e.getReferrer());var s=n(i);return i._rtlTextPluginCallback=a.registerForPluginStateChange((function(t){s.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:t.pluginStatus,pluginURL:t.pluginURL},(function(t,i){if(e.triggerPluginCompletionEvent(t),i&&i.every((function(e){return e})))for(var r in s._sourceCaches){var n=s._sourceCaches[r],a=n.getSource().type;"vector"!==a&&"geojson"!==a||n.reload()}}))})),i.on("data",(function(e){if("source"===e.dataType&&"metadata"===e.sourceDataType){var t=i.getSource(e.sourceId);if(t&&t.vectorLayerIds)for(var r in i._layers){var n=i._layers[r];n.source===t.id&&i._validateLayer(n)}}})),i}return p(a,[{key:"loadURL",value:function(t){var i=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.fire(new e.Event("dataloading",{dataType:"style"}));var n="boolean"==typeof r.validate?r.validate:!e.isMapboxURL(t);t=this.map._requestManager.normalizeStyleURL(t,r.accessToken);var a=this.map._requestManager.transformRequest(t,e.ResourceType.Style);this._request=e.getJSON(a,(function(t,r){i._request=null,t?i.fire(new e.ErrorEvent(t)):r&&i._load(r,n)}))}},{key:"loadJSON",value:function(t){var i=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.fire(new e.Event("dataloading",{dataType:"style"})),this._request=e.exported.frame((function(){i._request=null,i._load(t,!1!==r.validate)}))}},{key:"loadEmpty",value:function(){this.fire(new e.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(t,i){if(!i||!si(this,e.validateStyle(t))){for(var r in this._loaded=!0,this.stylesheet=e.clone$1(t),this._updateMapProjection(),t.sources)this.addSource(r,t.sources[r],{validate:!1});this._changed=!1,t.sprite?this._loadSprite(t.sprite):(this.imageManager.setLoaded(!0),this.dispatcher.broadcast("spriteLoaded",!0)),this.glyphManager.setURL(t.glyphs);var n=rt(this.stylesheet.layers);this._order=n.map((function(e){return e.id})),this._layers={},this._serializedLayers={};var a,o=f(n);try{for(o.s();!(a=o.n()).done;){var s=a.value,l=e.createStyleLayer(s);l.setEventedParent(this,{layer:{id:l.id}}),this._layers[l.id]=l,this._serializedLayers[l.id]=l.serialize(),this._updateLayerCount(l,!0)}}catch(u){o.e(u)}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 e.Event("data",{dataType:"style"})),this.fire(new e.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(t){var i=this;this._spriteRequest=function(t,i,r){var n,a,o,s=e.exported.devicePixelRatio>1?"@2x":"",l=e.getJSON(i.transformRequest(i.normalizeSpriteURL(t,s,".json"),e.ResourceType.SpriteJSON),(function(e,t){l=null,o||(o=e,n=t,c())})),u=e.getImage(i.transformRequest(i.normalizeSpriteURL(t,s,".png"),e.ResourceType.SpriteImage),(function(e,t){u=null,o||(o=e,a=t,c())}));function c(){if(o)r(o);else if(n&&a){var t=e.exported.getImageData(a),i={};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,v=l.stretchX,m=l.stretchY,y=l.content,_=new e.RGBAImage({width:u,height:c});e.RGBAImage.copy(t,_,{x:h,y:f},{x:0,y:0},{width:u,height:c}),i[s]={data:_,pixelRatio:p,sdf:d,stretchX:v,stretchY:m,content:y}}r(null,i)}}return{cancel:function(){l&&(l.cancel(),l=null),u&&(u.cancel(),u=null)}}}(t,this.map._requestManager,(function(t,r){if(i._spriteRequest=null,t)i.fire(new e.ErrorEvent(t));else if(r)for(var n in r)i.imageManager.addImage(n,r[n]);i.imageManager.setLoaded(!0),i._availableImages=i.imageManager.listImages(),i.dispatcher.broadcast("setImages",i._availableImages),i.dispatcher.broadcast("spriteLoaded",!0),i.fire(new e.Event("data",{dataType:"style"}))}))}},{key:"_validateLayer",value:function(t){var i=this.getSource(t.source);if(i){var r=t.sourceLayer;r&&("geojson"===i.type||i.vectorLayerIds&&-1===i.vectorLayerIds.indexOf(r))&&this.fire(new e.ErrorEvent(new Error('Source layer "'.concat(r,'" does not exist on source "').concat(i.id,'" as specified by style layer "').concat(t.id,'"'))))}}},{key:"loaded",value:function(){if(!this._loaded)return!1;if(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=f(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())return!0;if(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(t){if(this._loaded){var i=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(t);this.light.updateTransitions(t),this.fog&&this.fog.updateTransitions(t),this._resetUpdates()}var l={};for(var u in this._sourceCaches){var c=this._sourceCaches[u];l[u]=c.used,c.used=!1}var h,d=f(this._order);try{for(d.s();!(h=d.n()).done;){var p=h.value,v=this._layers[p];if(v.recalculate(t,this._availableImages),!v.isHidden(t.zoom)){var m=this._getLayerSourceCache(v);m&&(m.used=!0)}var y=this.map.painter;if(y){var _=v.getProgramIds();if(!_)continue;var g,x=v.getProgramConfiguration(t.zoom),b=f(_);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 l){var T=this._sourceCaches[k];l[k]!==T.used&&T.getSource().fire(new e.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:T.getSource().id}))}this.light.recalculate(t),this.terrain&&this.terrain.recalculate(t),this.fog&&this.fog.recalculate(t),this.z=t.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),i&&this.fire(new e.Event("data",{dataType:"style"}))}}},{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(i){var r=this;if(this._checkLoaded(),si(this,e.validateStyle(i)))return!1;(i=e.clone$1(i)).layers=rt(i.layers);var n=function(e,i){if(!e)return[{command:nt.setStyle,args:[i]}];var r=[];try{if(!t(e.version,i.version))return[{command:nt.setStyle,args:[i]}];t(e.center,i.center)||r.push({command:nt.setCenter,args:[i.center]}),t(e.zoom,i.zoom)||r.push({command:nt.setZoom,args:[i.zoom]}),t(e.bearing,i.bearing)||r.push({command:nt.setBearing,args:[i.bearing]}),t(e.pitch,i.pitch)||r.push({command:nt.setPitch,args:[i.pitch]}),t(e.sprite,i.sprite)||r.push({command:nt.setSprite,args:[i.sprite]}),t(e.glyphs,i.glyphs)||r.push({command:nt.setGlyphs,args:[i.glyphs]}),t(e.transition,i.transition)||r.push({command:nt.setTransition,args:[i.transition]}),t(e.light,i.light)||r.push({command:nt.setLight,args:[i.light]}),t(e.fog,i.fog)||r.push({command:nt.setFog,args:[i.fog]}),t(e.projection,i.projection)||r.push({command:nt.setProjection,args:[i.projection]});var n={},a=[];!function(e,i,r,n){var a;for(a in i=i||{},e=e||{})e.hasOwnProperty(a)&&(i.hasOwnProperty(a)||ot(a,r,n));for(a in i)if(i.hasOwnProperty(a)){var o=i[a];e.hasOwnProperty(a)?t(e[a],o)||("geojson"===e[a].type&&"geojson"===o.type&&lt(e,i,a)?r.push({command:nt.setGeoJSONSourceData,args:[a,o.data]}):st(a,i,r,n)):at(a,i,r)}}(e.sources,i.sources,a,n);var o=[];e.layers&&e.layers.forEach((function(e){e.source&&n[e.source]?r.push({command:nt.removeLayer,args:[e.id]}):o.push(e)}));var s=e.terrain;s&&n[s.source]&&(r.push({command:nt.setTerrain,args:[void 0]}),s=void 0),r=r.concat(a),t(s,i.terrain)||r.push({command:nt.setTerrain,args:[i.terrain]}),function(e,i,r){i=i||[];var n,a,o,s,l,u,c,h=(e=e||[]).map(ct),f=i.map(ct),d=e.reduce(ht,{}),p=i.reduce(ht,{}),v=h.slice(),m=Object.create(null);for(n=0,a=0;n<h.length;n++)o=h[n],p.hasOwnProperty(o)?a++:(r.push({command:nt.removeLayer,args:[o]}),v.splice(v.indexOf(o,a),1));for(n=0,a=0;n<f.length;n++)o=f[f.length-1-n],v[v.length-1-n]!==o&&(d.hasOwnProperty(o)?(r.push({command:nt.removeLayer,args:[o]}),v.splice(v.lastIndexOf(o,v.length-a),1)):a++,u=v[v.length-n],r.push({command:nt.addLayer,args:[p[o],u]}),v.splice(v.length-n,0,o),m[o]=!0);for(n=0;n<f.length;n++)if(s=d[o=f[n]],l=p[o],!m[o]&&!t(s,l))if(t(s.source,l.source)&&t(s["source-layer"],l["source-layer"])&&t(s.type,l.type)){for(c in ut(s.layout,l.layout,r,o,null,nt.setLayoutProperty),ut(s.paint,l.paint,r,o,null,nt.setPaintProperty),t(s.filter,l.filter)||r.push({command:nt.setFilter,args:[o,l.filter]}),t(s.minzoom,l.minzoom)&&t(s.maxzoom,l.maxzoom)||r.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],r,o,c.slice(6),nt.setPaintProperty):t(s[c],l[c])||r.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],r,o,c.slice(6),nt.setPaintProperty):t(s[c],l[c])||r.push({command:nt.setLayerProperty,args:[o,c,l[c]]}))}else r.push({command:nt.removeLayer,args:[o]}),u=v[v.lastIndexOf(o)+1],r.push({command:nt.addLayer,args:[l,u]})}(o,i.layers,r)}catch(e){console.warn("Unable to compute style diff:",e),r=[{command:nt.setStyle,args:[i]}]}return r}(this.serialize(),i).filter((function(e){return!(e.command in ui)}));if(0===n.length)return!1;var a=n.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 n.forEach((function(e){"setTransition"!==e.command&&"setProjection"!==e.command&&r[e.command].apply(r,e.args)})),this.stylesheet=i,this._updateMapProjection(),!0}},{key:"addImage",value:function(t,i){return this.getImage(t)?this.fire(new e.ErrorEvent(new Error("An image with this name already exists."))):(this.imageManager.addImage(t,i),this._afterImageUpdated(t),this)}},{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(t){return this.getImage(t)?(this.imageManager.removeImage(t),this._afterImageUpdated(t),this):this.fire(new e.ErrorEvent(new Error("No image with this name exists.")))}},{key:"_afterImageUpdated",value:function(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new e.Event("data",{dataType:"style"}))}},{key:"listImages",value:function(){return this._checkLoaded(),this._availableImages.slice()}},{key:"addSource",value:function(t,i){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(this._checkLoaded(),void 0!==this.getSource(t))throw new Error("There is already a source with this ID");if(!i.type)throw new Error("The type property must be defined, but only the following properties were given: ".concat(Object.keys(i).join(", "),"."));if(!(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(e.validateSource,"sources.".concat(t),i,null,n))){this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);var a=We(t,i,this.dispatcher,this);a.setEventedParent(this,(function(){return{isSourceLoaded:r._isSourceCacheLoaded(t),source:a.serialize(),sourceId:t}}));var o=function(i){var n=(i?"symbol:":"other:")+t,o=r._sourceCaches[n]=new e.SourceCache(n,a,i);(i?r._symbolSourceCaches:r._otherSourceCaches)[t]=o,o.style=r,o.onAdd(r.map)};o(!1),"vector"!==i.type&&"geojson"!==i.type||o(!0),a.onAdd&&a.onAdd(this.map),this._changed=!0}}},{key:"removeSource",value:function(t){this._checkLoaded();var i=this.getSource(t);if(!i)throw new Error("There is no source with this ID");for(var r in this._layers)if(this._layers[r].source===t)return this.fire(new e.ErrorEvent(new Error('Source "'.concat(t,'" cannot be removed while layer "').concat(r,'" is using it.'))));if(this.terrain&&this.terrain.get().source===t)return this.fire(new e.ErrorEvent(new Error('Source "'.concat(t,'" cannot be removed while terrain is using it.'))));var n,a=this._getSourceCaches(t),o=f(a);try{for(o.s();!(n=o.n()).done;){var s=n.value;delete this._sourceCaches[s.id],delete this._updatedSources[s.id],s.fire(new e.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:s.getSource().id})),s.setEventedParent(null),s.clearTiles()}}catch(l){o.e(l)}finally{o.f()}return delete this._otherSourceCaches[t],delete this._symbolSourceCaches[t],i.setEventedParent(null),i.onRemove&&i.onRemove(this.map),this._changed=!0,this}},{key:"setGeoJSONSourceData",value:function(e,t){this._checkLoaded(),this.getSource(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(t,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this._checkLoaded();var n=t.id;if(this.getLayer(n))this.fire(new e.ErrorEvent(new Error('Layer with id "'.concat(n,'" already exists on this map'))));else{var a;if("custom"===t.type){if(si(this,e.validateCustomStyleLayer(t)))return;a=e.createStyleLayer(t)}else{if("object"==typeof t.source&&(this.addSource(n,t.source),t=e.clone$1(t),t=e.extend(t,{source:n})),this._validate(e.validateLayer,"layers.".concat(n),t,{arrayIndex:-1},r))return;a=e.createStyleLayer(t),this._validateLayer(a),a.setEventedParent(this,{layer:{id:n}}),this._serializedLayers[a.id]=a.serialize(),this._updateLayerCount(a,!0)}var o=i?this._order.indexOf(i):this._order.length;if(i&&-1===o)this.fire(new e.ErrorEvent(new Error('Layer with id "'.concat(i,'" 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(t,i){if(this._checkLoaded(),this._changed=!0,this._layers[t]){if(t!==i){var r=this._order.indexOf(t);this._order.splice(r,1);var n=i?this._order.indexOf(i):this._order.length;i&&-1===n?this.fire(new e.ErrorEvent(new Error('Layer with id "'.concat(i,'" does not exist on this map.')))):(this._order.splice(n,0,t),this._layerOrderChanged=!0,this._updateDrapeFirstLayers())}}else this.fire(new e.ErrorEvent(new Error("The layer '".concat(t,"' does not exist in the map's style and cannot be moved."))))}},{key:"removeLayer",value:function(t){this._checkLoaded();var i=this._layers[t];if(i){i.setEventedParent(null),this._updateLayerCount(i,!1);var r=this._order.indexOf(t);this._order.splice(r,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=i,delete this._layers[t],delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],i.onRemove&&i.onRemove(this.map),this._updateDrapeFirstLayers()}else this.fire(new e.ErrorEvent(new Error("The layer '".concat(t,"' 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(t,i,r){this._checkLoaded();var n=this.getLayer(t);n?n.minzoom===i&&n.maxzoom===r||(null!=i&&(n.minzoom=i),null!=r&&(n.maxzoom=r),this._updateLayer(n)):this.fire(new e.ErrorEvent(new Error("The layer '".concat(t,"' does not exist in the map's style and cannot have zoom extent."))))}},{key:"setFilter",value:function(i,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this._checkLoaded();var a=this.getLayer(i);if(a){if(!t(a.filter,r))return null==r?(a.filter=void 0,void this._updateLayer(a)):void(this._validate(e.validateFilter,"layers.".concat(a.id,".filter"),r,{layerType:a.type},n)||(a.filter=e.clone$1(r),this._updateLayer(a)))}else this.fire(new e.ErrorEvent(new Error("The layer '".concat(i,"' does not exist in the map's style and cannot be filtered."))))}},{key:"getFilter",value:function(t){var i=this.getLayer(t);return i&&e.clone$1(i.filter)}},{key:"setLayoutProperty",value:function(i,r,n){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};this._checkLoaded();var o=this.getLayer(i);o?t(o.getLayoutProperty(r),n)||(o.setLayoutProperty(r,n,a),this._updateLayer(o)):this.fire(new e.ErrorEvent(new Error("The layer '".concat(i,"' does not exist in the map's style and cannot be styled."))))}},{key:"getLayoutProperty",value:function(t,i){var r=this.getLayer(t);if(r)return r.getLayoutProperty(i);this.fire(new e.ErrorEvent(new Error("The layer '".concat(t,"' does not exist in the map's style."))))}},{key:"setPaintProperty",value:function(i,r,n){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};this._checkLoaded();var o=this.getLayer(i);o?t(o.getPaintProperty(r),n)||(o.setPaintProperty(r,n,a)&&this._updateLayer(o),this._changed=!0,this._updatedPaintProps[i]=!0):this.fire(new e.ErrorEvent(new Error("The layer '".concat(i,"' 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(t,i){this._checkLoaded();var r=t.source,n=t.sourceLayer,a=this.getSource(r);if(a){var o=a.type;if("geojson"===o&&n)this.fire(new e.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));else if("vector"!==o||n){void 0===t.id&&this.fire(new e.ErrorEvent(new Error("The feature id parameter must be provided.")));var s,l=this._getSourceCaches(r),u=f(l);try{for(u.s();!(s=u.n()).done;)s.value.setFeatureState(n,t.id,i)}catch(c){u.e(c)}finally{u.f()}}else this.fire(new e.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new e.ErrorEvent(new Error("The source '".concat(r,"' does not exist in the map's style."))))}},{key:"removeFeatureState",value:function(t,i){this._checkLoaded();var r=t.source,n=this.getSource(r);if(n){var a=n.type,o="vector"===a?t.sourceLayer:void 0;if("vector"!==a||o)if(i&&"string"!=typeof t.id&&"number"!=typeof t.id)this.fire(new e.ErrorEvent(new Error("A feature id is required to remove its specific state property.")));else{var s,l=this._getSourceCaches(r),u=f(l);try{for(u.s();!(s=u.n()).done;)s.value.removeFeatureState(o,t.id,i)}catch(c){u.e(c)}finally{u.f()}}else this.fire(new e.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new e.ErrorEvent(new Error("The source '".concat(r,"' does not exist in the map's style."))))}},{key:"getFeatureState",value:function(t){this._checkLoaded();var i=t.source,r=t.sourceLayer,n=this.getSource(i);if(n){if("vector"!==n.type||r)return void 0===t.id&&this.fire(new e.ErrorEvent(new Error("The feature id parameter must be provided."))),this._getSourceCaches(i)[0].getFeatureState(r,t.id);this.fire(new e.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new e.ErrorEvent(new Error("The source '".concat(i,"' does not exist in the map's style."))))}},{key:"getTransition",value:function(){return e.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}},{key:"serialize",value:function(){var t={};for(var i in this._sourceCaches){var r=this._sourceCaches[i].getSource();t[r.id]||(t[r.id]=r.serialize())}return e.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,terrain:this.getTerrain()||void 0,fog:this.stylesheet.fog,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:t,layers:this._serializeLayers(this._order)},(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,l=f(e);try{for(l.s();!(s=l.n()).done;){var u=s.value[o];if(u){var c,h=f(u);try{for(h.s();!(c=h.n()).done;){var d=c.value;n.push(d)}}catch(E){h.e(E)}finally{h.f()}}}}catch(E){l.e(E)}finally{l.f()}}}n.sort((function(e,t){return t.intersectionZ-e.intersectionZ}));for(var p=[],v=this._order.length-1;v>=0;v--){var m=this._order[v];if(i(m))for(var y=n.length-1;y>=0;y--){var _=n[y].feature;if(r[_.layer.id]<v)break;p.push(_),n.pop()}else{var g,x=f(e);try{for(x.s();!(g=x.n()).done;){var b=g.value[m];if(b){var w,k=f(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(t,i,r){var n=this;i&&i.filter&&this._validate(e.validateFilter,"queryRenderedFeatures.filter",i.filter,null,i);var a={};if(i&&i.layers){if(!Array.isArray(i.layers))return this.fire(new e.ErrorEvent(new Error("parameters.layers must be an Array."))),[];var o,s=f(i.layers);try{for(s.s();!(o=s.n()).done;){var l=o.value,u=this._layers[l];if(!u)return this.fire(new e.ErrorEvent(new Error("The layer '".concat(l,"' does not exist in the map's style and cannot be queried for features.")))),[];a[u.source]=!0}}catch(m){s.e(m)}finally{s.f()}}var c=[];i.availableImages=this._availableImages;var h=i&&i.layers?i.layers.some((function(e){var t=n.getLayer(e);return t&&t.is3D()})):this.has3DLayers(),d=X.createFromScreenPoints(t,r);for(var p in this._sourceCaches){var v=this._sourceCaches[p].getSource().id;i.layers&&!a[v]||c.push(He(this._sourceCaches[p],this._layers,this._serializedLayers,d,i,r,h,!!this.map._showQueryGeometry))}return this.placement&&c.push(function(e,t,i,r,n,a,o){var s,l={},u=a.queryRenderedSymbols(r),c=[],h=f(Object.keys(u).map(Number));try{for(h.s();!(s=h.n()).done;){var d=s.value;c.push(o[d])}}catch(m){h.e(m)}finally{h.f()}c.sort(Ke);for(var p=function(){var i=y[v],r=i.featureIndex.lookupSymbolFeatures(u[i.bucketInstanceId],t,i.bucketIndex,i.sourceLayerIndex,n.filter,n.layers,n.availableImages,e);for(var a in r){var o=l[a]=l[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 c,h=f(s);try{for(h.s();!(c=h.n()).done;){var d=c.value;o.push(d)}}catch(m){h.e(m)}finally{h.f()}}},v=0,y=c;v<y.length;v++)p();var _=function(t){l[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 l)_(g);return l}(this._layers,this._serializedLayers,this._getLayerSourceCache.bind(this),d.screenGeometry,i,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(c)}},{key:"querySourceFeatures",value:function(t,i){i&&i.filter&&this._validate(e.validateFilter,"querySourceFeatures.filter",i.filter,null,i);var r,n=this._getSourceCaches(t),a=[],o=f(n);try{for(o.s();!(r=o.n()).done;){var s=r.value;a=a.concat(Ye(s,i))}}catch(l){o.e(l)}finally{o.f()}return a}},{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 i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this._checkLoaded();var r=this.light.getLight(),n=!1;for(var a in e)if(!t(e[a],r[a])){n=!0;break}if(n){var o=this._setTransitionParameters({duration:300,delay:0});this.light.setLight(e,i),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(i){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(this._checkLoaded(),!i)return delete this.terrain,delete this.stylesheet.terrain,this.dispatcher.broadcast("enableTerrain",!1),this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);var n=i;if(1===r){if("object"==typeof n.source){var a="terrain-dem-src";this.addSource(a,n.source),n=e.clone$1(n),n=e.extend(n,{source:a})}if(this._validate(e.validateTerrain,"terrain",n))return}if(!this.terrain||this.terrain&&r!==this.terrain.drapeRenderMode){if(!n)return;this._createTerrain(n,r)}else{for(var o=this.terrain,s=o.get(),l=0,u=Object.keys(e.spec.terrain);l<u.length;l++){var c=u[l];!n.hasOwnProperty(c)&&e.spec.terrain[c].default&&(n[c]=e.spec.terrain[c].default)}for(var h in n)if(!t(n[h],s[h])){o.set(n),this.stylesheet.terrain=n;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=f(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 i=this.fog,r=i.get();for(var n in 0===Object.keys(e).length&&i.set(e),e)if(!t(e[n],r[n])){i.set(e),this.stylesheet.fog=e;var a=this._setTransitionParameters({duration:0});i.updateTransitions(a);break}}else this._createFog(e);this._markersNeedUpdate=!0}},{key:"_setTransitionParameters",value:function(t){return{now:e.exported.now(),transition:e.extend(t,this.stylesheet.transition)}}},{key:"_updateDrapeFirstLayers",value:function(){var e,t,i=this;if(this.map._optimizeForTerrain&&this.terrain){var r=this._order.filter((function(e){return i.isLayerDraped(i._layers[e])})),n=this._order.filter((function(e){return!i.isLayerDraped(i._layers[e])}));this._drapedFirstOrder=[],(e=this._drapedFirstOrder).push.apply(e,c(r)),(t=this._drapedFirstOrder).push.apply(t,c(n))}}},{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(t,i,r,n){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return(!a||!1!==a.validate)&&si(this,t.call(e.validateStyle,e.extend({key:i,style:this.serialize(),value:r,styleSpec:e.spec},n)))}},{key:"_remove",value:function(){for(var t in this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),e.evented.off("pluginStateChange",this._rtlTextPluginCallback),this._layers)this._layers[t].setEventedParent(null);for(var i in this._sourceCaches)this._sourceCaches[i].clearTiles(),this._sourceCaches[i].setEventedParent(null);this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}},{key:"_clearSource",value:function(e){var t,i=this._getSourceCaches(e),r=f(i);try{for(r.s();!(t=r.n()).done;)t.value.clearTiles()}catch(n){r.e(n)}finally{r.f()}}},{key:"_reloadSource",value:function(e){var t,i=this._getSourceCaches(e),r=f(i);try{for(r.s();!(t=r.n()).done;){var n=t.value;n.resume(),n.reload()}}catch(a){r.e(a)}finally{r.f()}}},{key:"_reloadSources",value:function(){var e,t=f(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(t,i,r,n){var a,o=this,s=arguments.length>4&&void 0!==arguments[4]&&arguments[4],l=!1,u=!1,c={},h=f(this._order);try{var d=function(){var e=a.value,i=o._layers[e];if("symbol"!==i.type)return"continue";if(!c[i.source]){var r=o._getLayerSourceCache(i);if(!r)return"continue";c[i.source]=r.getRenderableIds(!0).map((function(e){return r.getTileByID(e)})).sort((function(e,t){return t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1)}))}var n=o.crossTileSymbolIndex.addLayer(i,c[i.source],t.center.lng,t.projection);l=l||n};for(h.s();!(a=h.n()).done;)d()}catch(_){h.e(_)}finally{h.f()}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),s=s||this._layerOrderChanged||0===r,this._layerOrderChanged&&this.fire(new e.Event("neworder")),(s||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(e.exported.now(),t.zoom))&&(this.pauseablePlacement=new ti(t,this._order,s,i,r,n,this.placement,this.fog&&t.projection.supportsFog?this.fog.state:null),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,c),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(e.exported.now()),u=!0),l&&this.pauseablePlacement.placement.setStale()),u||l){var p,v=f(this._order);try{for(v.s();!(p=v.n()).done;){var m=p.value,y=this._layers[m];"symbol"===y.type&&this.placement.updateLayerOpacities(y,c[y.source])}}catch(_){v.e(_)}finally{v.f()}}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(e.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(t,i,r){return e.makeRequest(i,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(t){var i=this._getSourceCaches(t);return 0===i.length?(this.fire(new e.ErrorEvent(new Error("There is no source with ID '".concat(t,"'")))),!1):i.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}(e.Evented);fi.getSourceType=function(e){return qe[e]},fi.setSourceType=function(e,t){qe[e]=t},fi.registerForPluginStateChange=e.registerForPluginStateChange;var di="\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",pi="attribute highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;varying highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",vi="\n#define ELEVATION_SCALE 7.0\n#define ELEVATION_OFFSET 450.0\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(\nmix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}\n#else\nvec3 elevationVector(vec2 pos) { return vec3(0,0,1); }\n#endif\nconst float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt)\n{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}\n#ifdef TERRAIN\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nuniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;\n#else\nuniform sampler2D u_dem;uniform sampler2D u_dem_prev;\n#endif\nuniform vec4 u_dem_unpack;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;uniform sampler2D u_depth;uniform vec2 u_depth_size_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float decodeElevation(vec4 v) {return dot(vec4(v.xyz*255.0,-1.0),u_dem_unpack);}float currentElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem,pos).a;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem,pos));\n#ifdef TERRAIN_DEM_NEAREST_FILTER\nreturn u_exaggeration*tl;\n#endif\nfloat tr=decodeElevation(texture2D(u_dem,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}float prevElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture2D(u_dem_prev,pos).a;\n#else\nfloat dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=decodeElevation(texture2D(u_dem_prev,pos));float tr=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,0.0)));float bl=decodeElevation(texture2D(u_dem_prev,pos+vec2(0.0,dd)));float br=decodeElevation(texture2D(u_dem_prev,pos+vec2(dd,dd)));return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);\n#endif\n}\n#ifdef TERRAIN_VERTEX_MORPHING\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nfloat nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}\n#else\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nreturn currentElevation(apos);}\n#endif\nhighp float unpack_depth(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;float depth=unpack_depth(texture2D(u_depth,(coord.xy+1.0)*0.5));return coord.z > depth+0.0005;}float occlusionFade(vec4 frag) {vec3 coord=frag.xyz/frag.w;vec3 df=vec3(5.0*u_depth_size_inv,0.0);vec2 uv=0.5*coord.xy+0.5;vec4 depth=vec4(\nunpack_depth(texture2D(u_depth,uv-df.xz)),unpack_depth(texture2D(u_depth,uv+df.xz)),unpack_depth(texture2D(u_depth,uv-df.zy)),unpack_depth(texture2D(u_depth,uv+df.zy))\n);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z-0.001)-depth),0.0,1.0));}vec4 fourSample(vec2 pos,vec2 off) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nfloat tl=texture2D(u_dem,pos).a;float tr=texture2D(u_dem,pos+vec2(off.x,0.0)).a;float bl=texture2D(u_dem,pos+vec2(0.0,off.y)).a;float br=texture2D(u_dem,pos+off).a;\n#else\nvec4 demtl=vec4(texture2D(u_dem,pos).xyz*255.0,-1.0);float tl=dot(demtl,u_dem_unpack);vec4 demtr=vec4(texture2D(u_dem,pos+vec2(off.x,0.0)).xyz*255.0,-1.0);float tr=dot(demtr,u_dem_unpack);vec4 dembl=vec4(texture2D(u_dem,pos+vec2(0.0,off.y)).xyz*255.0,-1.0);float bl=dot(dembl,u_dem_unpack);vec4 dembr=vec4(texture2D(u_dem,pos+off).xyz*255.0,-1.0);float br=dot(dembr,u_dem_unpack);\n#endif\nreturn vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}\n#else\nfloat elevation(vec2 pos) { return 0.0; }bool isOccluded(vec4 frag) { return false; }float occlusionFade(vec4 frag) { return 1.0; }\n#endif",mi="#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",yi="#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",_i={},gi={},xi=[];Ei(di,xi),Ei(vi,xi),Ei(mi,xi),Ei(yi,xi),_i=Si("",vi),gi=Si(yi,mi);var bi=Si("\n#if __VERSION__ >=300\n#define varying in\n#define gl_FragColor glFragColor\n#define texture2D texture\n#define textureCube texture\nout vec4 glFragColor;\n#endif\nhighp vec3 hash(highp vec2 p) {highp vec3 p3=fract(p.xyx*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract((p3.xxy+p3.yzz)*p3.zyx);}vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;return color+rnd/255.0;}highp float unpack_depth(highp vec4 rgba_depth)\n{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}","\n#if __VERSION__ >=300\n#define attribute in\n#define varying out\n#define texture2D texture\n#endif\nfloat wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\n#ifndef PROJECTED_POS_ON_VIEWPORT\nfloat tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;\n#else\nreturn vec3(0.0);\n#endif\n}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(\nunpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);//Normalized device coordinate that is not rendered."),wi=di,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:Si("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:Si("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:Si("varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(\nantialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)\n);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\n#endif\ngl_FragColor=out_color*(v_visibility*opacity_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","#define NUM_VISIBILITY_RINGS 2\n#define INV_SQRT2 0.70710678\n#define ELEVATION_BIAS 0.0001\n#define NUM_SAMPLES_PER_RING 16\nuniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;\n#endif\nvarying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {\n#if defined(TERRAIN)\nreturn elevation(pos)+ELEVATION_BIAS;\n#else\nreturn 0.0;\n#endif\n}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);\n#ifdef PITCH_WITH_MAP\n#ifdef PROJECTION_GLOBE_VIEW\nreturn u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );\n#else\nreturn u_matrix*( world_center+vec4(sample_offset,0,0) );\n#endif\n#else\nreturn projected_center+vec4(sample_offset,0,0);\n#endif\n}float get_sample_step() {\n#ifdef PITCH_WITH_MAP\nreturn 2.0*PI/float(NUM_SAMPLES_PER_RING);\n#else\nreturn PI/float(NUM_SAMPLES_PER_RING);\n#endif\n}void main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1);\n#else \nsurface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1);\n#endif\nvec4 projected_center=u_matrix*world_center;float view_scale=0.0;\n#ifdef PITCH_WITH_MAP\n#ifdef SCALE_WITH_MAP\nview_scale=1.0;\n#else\nview_scale=projected_center.w/u_camera_to_center_distance;\n#endif\n#else\n#ifdef SCALE_WITH_MAP\nview_scale=u_camera_to_center_distance;\n#else\nview_scale=projected_center.w;\n#endif\n#endif\ngl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;\n#ifdef TERRAIN\nfloat step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;\n#ifdef PITCH_WITH_MAP\nfloat cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center;\n#else\nocclusion_world_center=world_center;occlusion_projected_center=projected_center;\n#endif\nfor(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);\n#else\nvisibility=1.0;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nvisibility=1.0;\n#endif\nv_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);\n#ifdef FOG\nv_fog_pos=fog_position(world_center.xyz);\n#endif\n}"),clippingMask:Si("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:Si("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:Si("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:Si("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:Si("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:Si("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;\n#endif\nvarying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;\n#ifdef PROJECTION_GLOBE_VIEW\ngl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1);\n#else\ngl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);\n#endif\n}"),fill:Si("#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:Si("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:Si("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:Si("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:Si("varying vec4 v_color;\n#ifdef RENDER_SHADOWS\nvarying highp vec4 v_pos_light_view_0;varying highp vec4 v_pos_light_view_1;varying float v_depth;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\n#ifdef ZERO_ROOF_RADIUS\nvarying vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)\nvarying highp vec3 v_normal;\n#endif\nvoid main() {\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)\nvec3 normal=v_normal;\n#endif\nfloat z;vec4 color;\n#ifdef ZERO_ROOF_RADIUS\nz=float(normal.z > 0.00001);color=mix(v_color,v_roof_color,z);\n#else\ncolor=v_color;\n#endif\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;\n#ifdef ZERO_ROOF_RADIUS\nconcave*=(1.0-z);\n#endif\nfloat x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);color.rgb=color.rgb*shade;\n#endif\n#ifdef RENDER_SHADOWS\n#ifdef ZERO_ROOF_RADIUS\nnormal=mix(normal,vec3(0.0,0.0,1.0),z);\n#endif\ncolor.xyz=shadowed_color_normal(color.xyz,normalize(normal),v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ngl_FragColor=color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\nvarying vec4 v_color;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;varying highp vec4 v_pos_light_view_0;varying highp vec4 v_pos_light_view_1;varying float v_depth;\n#endif\n#ifdef ZERO_ROOF_RADIUS\nvarying vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)\nvarying highp vec3 v_normal;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS)\nv_normal=normal;\n#endif\nbase=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=0.0;float c_ele;vec3 pos;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);pos=vec3(pos_nx.xy,h);\n#else\nh=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);\n#ifdef RENDER_SHADOWS\nv_pos_light_view_0=u_light_matrix_0*vec4(pos,1);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1);v_depth=gl_Position.w;\n#endif\nfloat NdotL=0.0;float colorvalue=0.0;\n#ifdef LIGHTING_3D_MODE\nNdotL=calculate_NdotL(normal);\n#else\ncolorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);\n#endif\nif (normal.y !=0.0) {float r=0.84;\n#ifndef LIGHTING_3D_MODE\nr=mix(0.7,0.98,1.0-u_lightintensity);\n#endif\nNdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}v_color=vec4(0.0,0.0,0.0,1.0);\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\nv_color=apply_lighting(color,NdotL);\n#else\nv_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));\n#endif\nv_color*=u_opacity;\n#ifdef ZERO_ROOF_RADIUS\nv_roof_color=vec4(0.0,0.0,0.0,1.0);\n#ifdef LIGHTING_3D_MODE\nv_roof_color=apply_lighting(color,calculate_NdotL(vec3(0.0,0.0,1.0)));\n#else\nfloat roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));\n#endif\nv_roof_color*=u_opacity;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),fillExtrusionPattern:Si("uniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nvarying float v_NdotL;\n#endif\nvarying vec2 v_pos;varying vec4 v_lighting;uniform lowp float u_opacity;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec4 out_color=texture2D(u_image,pos);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color,v_NdotL)*u_opacity;\n#else\nout_color=out_color*v_lighting;\n#endif\n#ifdef FAUX_AO\nfloat intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\ngl_FragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec4 a_pos_normal_ed;attribute vec2 a_centroid_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_pos_3;attribute vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;\n#endif\nvarying vec2 v_pos;varying vec4 v_lighting;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;varying vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nvarying float v_NdotL;\n#endif\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern\n#pragma mapbox: define lowp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\nvec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=a_centroid_pos;\n#endif\nfloat ele=0.0;float h=z;vec3 p;float c_ele;\n#ifdef TERRAIN\nbool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);p=vec3(pos_nx.xy,h);\n#else\np=vec3(pos_nx.xy,z);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);\n#endif\nfloat hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0\n? pos_nx.xy\n: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0;\n#ifdef LIGHTING_3D_MODE\nNdotL=calculate_NdotL(normal);\n#else\nNdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);\n#endif\nif (normal.y !=0.0) {float r=0.84;\n#ifndef LIGHTING_3D_MODE\nr=mix(0.7,0.98,1.0-u_lightintensity);\n#endif\nNdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#ifdef FAUX_AO\nfloat concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;\n#ifdef TERRAIN\ntop_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);\n#endif\nv_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\nv_NdotL=NdotL;\n#else\nv_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#endif \n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}"),hillshadePrepare:Si("#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:Si("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:Si("uniform lowp float u_device_pixel_ratio;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec4 v_uv;\n#ifdef RENDER_LINE_DASH\nuniform sampler2D u_dash_image;varying vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;\n#endif\nuniform float u_border_width;uniform vec4 u_border_color;float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nfloat linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);\n#ifdef RENDER_LINE_DASH\nfloat sdfdist=texture2D(u_dash_image,v_tex).a;float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;alpha*=linearstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);\n#endif\nhighp vec4 out_color;\n#ifdef RENDER_LINE_GRADIENT\nout_color=texture2D(u_gradient_image,v_uv.xy);\n#else\nout_color=color;\n#endif\nfloat trimmed=1.0;\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {if (line_progress <=trim_end && line_progress >=trim_start) {out_color=vec4(0,0,0,0);trimmed=0.0;}}\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef RENDER_LINE_ALPHA_DISCARD\nif (alpha < u_alpha_discard_threshold) {discard;}\n#endif\n#ifdef RENDER_LINE_BORDER\nfloat edgeBlur=(u_border_width+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);\n#ifdef RENDER_LINE_BORDER_AUTO\nfloat Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}\n#else\nout_color.rgb=mix(u_border_color.rgb*u_border_color.a*trimmed,out_color.rgb,smoothAlpha);\n#endif\n}\n#endif\ngl_FragColor=out_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define EXTRUDE_SCALE 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nattribute highp vec4 a_packed;\n#endif\n#ifdef RENDER_LINE_DASH\nattribute float a_linesofar;\n#endif\nuniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec4 v_uv;\n#ifdef RENDER_LINE_DASH\nuniform vec2 u_texsize;uniform float u_tile_units_to_pixels;varying vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform float u_image_height;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize lowp vec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;\n#ifndef RENDER_TO_TEXTURE\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#else\nv_gamma_scale=1.0;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nfloat a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];\n#ifdef RENDER_LINE_GRADIENT\nhighp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec4(a_uv_x,a_split_index*texel_height-half_texel_height,a_clip_start,a_clip_end);\n#else\nv_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end);\n#endif\n#endif\n#ifdef RENDER_LINE_DASH\nfloat scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/floorwidth,(-normal.y*height+dash.x+0.5)/u_texsize.y);\n#endif\nv_width2=vec2(outset,inset);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}"),linePattern:Si("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:Si("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:Si("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:Si("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_pixeloffset;attribute vec4 a_projected_pos;attribute float a_fade_opacity;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nvarying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);\n#else\noffsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);\n#endif\nvec2 a=projected_point.xy/projected_point.w;vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#endif\nfloat gamma_scale=gl_Position.w;float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nvec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade);}"),symbolTextAndIcon:Si("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec4 a_pos_offset;attribute vec4 a_tex_size;attribute vec4 a_projected_pos;attribute float a_fade_opacity;\n#ifdef PROJECTION_GLOBE_VIEW\nattribute vec3 a_globe_anchor;attribute vec3 a_globe_normal;\n#endif\nuniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;\n#endif\nvarying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;vec3 h=elevationVector(tile_anchor)*elevation(tile_anchor);float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offset_projected_point=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projected_point.xy/projected_point.w;vec2 b=offset_projected_point.xy/offset_projected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*font_scale);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\nfloat occlusion_fade=occlusionFade(projected_point)*globe_occlusion_fade;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#else\ngl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,float(projected_point.w <=0.0 || occlusion_fade==0.0));\n#endif\nfloat gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float projection_transition_fade=1.0;\n#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)\nprojection_transition_fade=1.0-step(EPSILON,u_zoom_transition);\n#endif\nv_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity*projection_transition_fade,is_sdf);}"),terrainRaster:Si("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:Si("#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:Si("\nvarying lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(\ncos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=textureCube(u_cubemap,uv).rgb;\n#ifdef FOG\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\n#endif\nsky_color.rgb=dither(sky_color.rgb,gl_FragCoord.xy+u_temporal_offset);sky_color+=0.1*sun_disk(v_uv,u_sun_direction);gl_FragColor=vec4(sky_color*u_opacity,u_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}",pi),skyboxGradient:Si("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}",pi),skyboxCapture:Si("\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:Si("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:Si("uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec3 u_start_color;uniform vec4 u_color;uniform vec4 u_space_color;uniform vec4 u_high_color;uniform float u_star_intensity;uniform float u_star_size;uniform float u_star_density;uniform float u_horizon_angle;uniform mat4 u_rotation_matrix;varying highp vec3 v_ray_dir;varying highp vec3 v_horizon_dir;highp float random(highp vec3 p) {p=fract(p*vec3(23.2342,97.1231,91.2342));p+=dot(p.zxy,p.yxz+123.1234);return fract(p.x*p.y);}float stars(vec3 p,float scale,vec2 offset) {vec2 uv_scale=(u_viewport/u_star_size)*scale;vec3 position=vec3(p.xy*uv_scale+offset*u_viewport,p.z);vec3 q=fract(position)-0.5;vec3 id=floor(position);float random_visibility=step(random(id),u_star_density);float circle=smoothstep(0.5+u_star_intensity,0.5,length(q));return circle*random_visibility;}void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;\n#ifdef PROJECTION_GLOBE_VIEW\nglobe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {discard;return;}\n#endif\nhighp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?\n0.0 : max(acos(dot(dir,horizon_dir)),0.0);float horizon_angle;\n#ifdef PROJECTION_GLOBE_VIEW\nhighp vec3 closest_point=globe_pos_dot_dir*dir;float closest_point_to_center=length(closest_point-u_globe_pos);float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ?\nPI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);\n#else\nhorizon_angle=horizon_angle_mercator;\n#endif\nhorizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;vec3 color_stop_2=u_space_color.rgb;vec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c =mix(color_stop_2,c2,t);float a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);vec2 uv=gl_FragCoord.xy/u_viewport-0.5;float aspect_ratio=u_viewport.x/u_viewport.y;vec4 uv_dir=vec4(normalize(vec3(uv.x*aspect_ratio,uv.y,1.0)),1.0);uv_dir=u_rotation_matrix*uv_dir;vec3 n=abs(uv_dir.xyz);vec2 uv_remap=(n.x > n.y && n.x > n.z) ? uv_dir.yz/uv_dir.x:\n(n.y > n.x && n.y > n.z) ? uv_dir.zx/uv_dir.y:\nuv_dir.xy/uv_dir.z;uv_remap.x/=aspect_ratio;vec3 D=vec3(uv_remap,1.0);highp float star_field=0.0;if (u_star_intensity > 0.0) {star_field+=stars(D,1.2,vec2(0.0,0.0));star_field+=stars(D,1.0,vec2(1.0,0.0));star_field+=stars(D,0.8,vec2(0.0,1.0));star_field+=stars(D,0.6,vec2(1.0,1.0));star_field*=(1.0-pow(t,0.25+(1.0-u_high_color.a)*0.75));c+=star_field*alpha_2;}c=dither(c,gl_FragCoord.xy+u_temporal_offset);gl_FragColor=vec4(c,a);}","attribute vec3 a_pos;attribute vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;varying highp vec3 v_ray_dir;varying highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(\nmix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(\nmix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}")};function Ei(e,t){var i,r=e.replace(/\s*\/\/[^\n]*\n/g,"\n").split("\n"),n=f(r);try{for(n.s();!(i=n.n()).done;){var a=i.value;if("#"===(a=a.trim())[0]&&a.includes("if")&&!a.includes("endif")){var o,s=(a=a.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim()).split(" "),l=f(s);try{for(l.s();!(o=l.n()).done;){var u=o.value;t.includes(u)||t.push(u)}}catch(c){l.e(c)}finally{l.f()}}}}catch(c){n.e(c)}finally{n.f()}}function Si(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;\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 Mi=function(){function e(){d(this,e),this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}return p(e,[{key:"bind",value:function(e,t,i,r,n,a,o){this.context=e;for(var s=this.boundPaintVertexBuffers.length!==r.length,l=0;!s&&l<r.length;l++)this.boundPaintVertexBuffers[l]!==r[l]&&(s=!0);for(var u=this.boundDynamicVertexBuffers.length!==o.length,c=0;!u&&c<o.length;c++)this.boundDynamicVertexBuffers[c]!==o[c]&&(u=!0);if(!e.extVertexArrayObject||!this.vao||this.boundProgram!==t||this.boundLayoutVertexBuffer!==i||s||u||this.boundIndexBuffer!==n||this.boundVertexOffset!==a)this.freshBind(t,i,r,n,a,o);else{e.bindVertexArrayOES.set(this.vao);var h,d=f(o);try{for(d.s();!(h=d.n()).done;){var p=h.value;p&&p.bind()}}catch(v){d.e(v)}finally{d.f()}n&&n.dynamicDraw&&n.bind()}}},{key:"freshBind",value:function(e,t,i,r,n,a){var o,s=e.numAttributes,l=this.context,u=l.gl;if(l.extVertexArrayObject)this.vao&&this.destroy(),this.vao=l.extVertexArrayObject.createVertexArrayOES(),l.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=l.currentNumAttributes||0;for(var c=s;c<o;c++)u.disableVertexAttribArray(c)}t.enableAttributes(u,e),t.bind(),t.setVertexAttribPointers(u,e,n);var h,d=f(i);try{for(d.s();!(h=d.n()).done;){var p=h.value;p.enableAttributes(u,e),p.bind(),p.setVertexAttribPointers(u,e,n)}}catch(_){d.e(_)}finally{d.f()}var v,m=f(a);try{for(m.s();!(v=m.n()).done;){var y=v.value;y&&(y.enableAttributes(u,e),y.bind(),y.setVertexAttribPointers(u,e,n))}}catch(_){m.e(_)}finally{m.f()}r&&r.bind(),l.currentNumAttributes=s}},{key:"destroy",value:function(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)}}]),e}();function Ai(t,i){var r=Math.pow(2,i.canonical.z),n=i.canonical.y;return[new e.MercatorCoordinate(0,n/r).toLngLat().lat,new e.MercatorCoordinate(0,(n+1)/r).toLngLat().lat]}function Ii(t,i,r,n,a,o,s){var l=t.context,u=l.gl,c=r.fbo;if(c){t.prepareDrawTile();var h=t.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:Ai(0,t.tileID),u_light:[i.paint.get("hillshade-exaggeration"),s],u_shadow:n,u_highlight:a,u_accent:o}}(t,r,n,t.terrain?i.projMatrix:null);t.prepareDrawProgram(l,h,i.toUnwrapped());var d=t.getTileBoundsBuffers(r),p=d.tileBoundsBuffer,v=d.tileBoundsIndexBuffer,m=d.tileBoundsSegments;h.draw(l,u.TRIANGLES,a,o,s,e.CullFaceMode.disabled,f,n.id,p,v,m)}}function Ci(t,i,r){if(i.needsDEMTextureUpload){var n=t.context,a=n.gl;n.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||t.getTileTexture(r.stride);var o=r.getPixels();i.demTexture?i.demTexture.update(o,{premultiply:!1}):i.demTexture=new e.Texture(n,o,a.RGBA,{premultiply:!1}),i.needsDEMTextureUpload=!1}}function zi(t,i,r,n,a,o){var s=t.context,l=s.gl;if(i.dem){var u=i.dem;if(s.activeTexture.set(l.TEXTURE1),Ci(t,i,u),i.demTexture){i.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);var c=u.dim;s.activeTexture.set(l.TEXTURE0);var h=i.fbo;if(!h){var f=new e.Texture(s,{width:c,height:c,data:null},l.RGBA);f.bind(l.LINEAR,l.CLAMP_TO_EDGE),(h=i.fbo=s.createFramebuffer(c,c,!0)).colorAttachment.set(f.texture)}s.bindFramebuffer.set(h.framebuffer),s.viewport.set([0,0,c,c]);var d=t.getMercatorTileBoundsBuffers(),p=d.tileBoundsBuffer,v=d.tileBoundsIndexBuffer,m=d.tileBoundsSegments;t.useProgram("hillshadePrepare").draw(s,l.TRIANGLES,n,a,o,e.CullFaceMode.disabled,function(t,i){var r=i.stride,n=e.create();return e.ortho(n,0,e.EXTENT,-e.EXTENT,0,0,1),e.translate(n,n,[0,-e.EXTENT,0]),{u_matrix:n,u_image:1,u_dimension:[r,r],u_zoom:t.overscaledZ,u_unpack:i.unpackVector}}(i.tileID,u),r.id,p,v,m),i.needsHillshadePrepare=!1}}}var Pi=function(t){return{u_matrix:new e.UniformMatrix4f(t),u_image0:new e.Uniform1i(t),u_skirt_height:new e.Uniform1f(t)}},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(){d(this,e),this.operations={}}return p(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 Ni(t,i,r,n,a){if(a>0){var o=e.exported.now(),s=(o-t.timeAdded)/a,l=i?(o-i.timeAdded)/a:-1,u=r.getSource(),c=n.coveringZoomLevel({tileSize:u.tileSize,roundZoom:u.roundZoom}),h=!i||Math.abs(i.tileID.overscaledZ-c)>Math.abs(t.tileID.overscaledZ-c),f=h&&t.refreshedUponExpiration?1:e.clamp(h?s:1-l,0,1);return t.refreshedUponExpiration&&s>=1&&(t.refreshedUponExpiration=!1),i?{opacity:1,mix:1-f}:{opacity:f,mix:0}}return{opacity:1,mix:0}}var ji=function(e){v(i,e);var t=m(i);function i(e){var r;d(this,i);var a={type:"raster-dem",maxzoom:e.transform.maxZoom},o=new q(tt(),null),s=We("mock-dem",a,o,e.style);return r=t.call(this,"mock-dem",s,!1),s.setEventedParent(n(r)),r._sourceLoaded=!0,r}return p(i,[{key:"_loadTile",value:function(e,t){e.state="loaded",t(null)}}]),i}(e.SourceCache),Gi=function(t){v(r,t);var i=m(r);function r(e){var t;d(this,r);var a=We("proxy",{type:"geojson",maxzoom:e.transform.maxZoom},new q(tt(),null),e.style);return t=i.call(this,"proxy",a,!1),a.setEventedParent(n(t)),t.map=t.getSource().map=e,t.used=t._sourceLoaded=!0,t.renderCache=[],t.renderCachePool=[],t.proxyCachedFBO={},t}return p(r,[{key:"update",value:function(t,i,r){var n=this;if(!t.freezeTileCoverage){this.transform=t;var a=t.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((function(i,r){if(i[r.key]="",!n._tiles[r.key]){var a=new e.Tile(r,n._source.tileSize*r.overscaleFactor(),t.tileZoom);a.state="loaded",n._tiles[r.key]=a}return i}),{});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,r=Object.values(t);(i=this.renderCachePool).push.apply(i,r),delete this.proxyCachedFBO[e]}}},{key:"deallocRenderCache",value:function(){this.renderCache.forEach((function(e){return e.fb.destroy()})),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}]),r}(e.SourceCache),Zi=function(e){v(i,e);var t=m(i);function i(e,r,n){var a;return d(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 p(i)}(e.OverscaledTileID),qi=function(t){v(r,t);var i=m(r);function r(t,n){var a;d(this,r),(a=i.call(this)).painter=t,a.terrainTileForTile={},a.prevTerrainTileForTile={};var o=function(t){var i=new e.StructArrayLayout2i4,r=new e.StructArrayLayout3ui6,n=131;i.reserve(17161),r.reserve(33800);for(var a=e.EXTENT/128,o=e.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=e.clamp(Math.round(u),0,e.EXTENT),f=e.clamp(Math.round(l),0,e.EXTENT);i.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 v=1;v<129;v++)d(v,p);return[0,129].forEach((function(e){for(var t=0;t<130;t++)d(t,e),d(e,t)})),[i,r,32768]}(),s=h(o,3),l=s[0],u=s[1],c=s[2],f=t.context;a.gridBuffer=f.createVertexBuffer(l,e.posAttributes.members),a.gridIndexBuffer=f.createIndexBuffer(u),a.gridSegments=e.SegmentVector.simpleSegment(0,0,l.length,u.length),a.gridNoSkirtSegments=e.SegmentVector.simpleSegment(0,0,l.length,c),a.proxyCoords=[],a.proxiedCoords={},a._visibleDemTiles=[],a._drapedRenderBatches=[],a._sourceTilesOverlap={},a.proxySourceCache=new Gi(n.map),a.orthoMatrix=e.create(),e.ortho(a.orthoMatrix,"globe"===a.painter.transform.projection.name?.015:0,e.EXTENT,0,e.EXTENT,0,1);var p=f.gl;return a._overlapStencilMode=new e.StencilMode({func:p.GEQUAL,mask:255},0,255,p.KEEP,p.KEEP,p.REPLACE),a._previousZoom=t.transform.zoom,a.pool=[],a._findCoveringTileCache={},a._tilesDirty={},a.style=n,a._useVertexMorphing=!0,a._exaggeration=1,a._mockSourceCache=new ji(n.map),a}return p(r,[{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(t,i,r){var n=this;if(t&&t.terrain){this._style!==t&&(this.style=t),this.enabled=!0;var a=t.terrain.properties;this.sourceCache=0===t.terrain.drapeRenderMode?this._mockSourceCache:t._getSourceCache(a.get("source")),this._exaggeration=a.get("exaggeration");var o=function(){n.sourceCache.used&&e.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 t=n.getScaledDemTileSize();n.sourceCache.update(i,t,!0),n.resetTileLookupCache(n.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,o(),this._initializing=!0),o(),i.updateElevation(!0,r),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(i),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 t=this.renderCacheEfficiency(this._style);this._style.map._optimizeForTerrain||100!==t.efficiency&&e.warnOnce("Terrain render cache efficiency is not optimal (".concat(t.efficiency,"%) and performance\n may be affected negatively, consider placing all background, fill and line layers before layer\n with id '").concat(t.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(t){var i=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(e.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(t,i){var r=i.transform.pointCoordinate(i.transform.getCameraPoint()),n=new e.pointGeometry(r.x,r.y);t.sort((function(t,i){if(i.overscaledZ-t.overscaledZ)return i.overscaledZ-t.overscaledZ;var r=new e.pointGeometry(t.canonical.x+(1<<t.canonical.z)*t.wrap,t.canonical.y),a=new e.pointGeometry(i.canonical.x+(1<<i.canonical.z)*i.wrap,i.canonical.y),o=n.mult(1<<t.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){i.proxyToSource[e.key]={}})),this.terrainTileForTile={};var s=this._style._sourceCaches;for(var l in s){var u=s[l];if(u.used&&(u!==this.sourceCache&&this.resetTileLookupCache(u.id),this._setupProxiedCoordsForOrtho(u,t[l],o),!u.usedForTerrain)){var c=t[l];u.getSource().reparseOverscaled&&this._assignTerrainTiles(c)}}this.proxiedCoords[r.id]=a.map((function(e){return new Zi(e,e.key,i.orthoMatrix)})),this._assignTerrainTiles(a),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(o),this.renderingToTexture=!1,this._updateTimestamp=e.exported.now();var h={};this._visibleDemTiles=[];var d,p=f(this.proxyCoords);try{for(p.s();!(d=p.n()).done;){var v=d.value,m=this.terrainTileForTile[v.key];if(m){var y=m.tileID.key;y in h||(this._visibleDemTiles.push(m),h[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),Ci(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 t=this.painter.context,i=t.gl;if(!this._emptyDepthBufferTexture){var r=new e.RGBAImage({width:1,height:1},Uint8Array.of(255,255,255,255));this._emptyDepthBufferTexture=new e.Texture(t,r,i.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 t=this.painter.context,i=t.gl;t.activeTexture.set(i.TEXTURE2);var r=this._getLoadedAreaMinimum(),n=new e.RGBAImage({width:1,height:1},new Uint8Array(e.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 e.Texture(t,n,i.RGBA,{premultiply:!1}),a}},{key:"setupElevationDraw",value:function(t,i,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:e.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(t,h,s,"_prev")&&(u=h),this._prepareDemTileUniforms(t,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[t.tileID.key],a.activeTexture.set(o.TEXTURE2),(this._prepareDemTileUniforms(t,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.emptyDepthBufferTexture.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)*e.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),i.setTerrainUniformValues(a,s),"globe"===this.painter.transform.projection.name){var p=this.globeUniformValues(this.painter.transform,t.tileID.canonical,r&&r.useDenormalizedUpVectorScale);i.setGlobeUniformValues(a,p)}}},{key:"globeUniformValues",value:function(t,i,r){var n=t.projection;return{u_tile_tl_up:n.upVector(i,0,0),u_tile_tr_up:n.upVector(i,e.EXTENT,0),u_tile_br_up:n.upVector(i,e.EXTENT,e.EXTENT),u_tile_bl_up:n.upVector(i,0,e.EXTENT),u_tile_up_scale:r?e.globeMetersToEcef(1):n.upVectorScale(i,t.center.lat,t.worldSize).metersToTile}}},{key:"renderToBackBuffer",value:function(t){var i=this.painter,r=this.painter.context;0!==t.length&&(r.bindFramebuffer.set(null),r.viewport.set([0,0,i.width,i.height]),i.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(t,i,r,n,a){if("globe"===t.transform.projection.name)!function(t,i,r,n,a){var o,s,l=t.context,u=l.gl,c=t.options.showTerrainWireframe?2:0,d=t.transform,p=e.globeUseCustomAntiAliasing(t,l,d),v=function(e,i){if(s!==e){var r=[Oi[e],"PROJECTION_GLOBE_VIEW"];p&&r.push("CUSTOM_ANTIALIASING"),i&&r.push(Oi[c]),o=t.useProgram("globeRaster",null,r),s=e}},m=t.colorModeForRenderPass(),y=new e.DepthMode(u.LEQUAL,e.DepthMode.ReadWrite,t.depthRangeFor3D);Bi.update(a);var _=e.calculateGlobeMercatorMatrix(d),g=[e.mercatorXfromLng(d.center.lng),e.mercatorYfromLat(d.center.lat)],x=c?[!1,!0]:[!1],b=t.globeSharedBuffers,w=[d.width*e.exported.devicePixelRatio,d.height*e.exported.devicePixelRatio],k=Float32Array.from(d.globeMatrix),T={useDenormalizedUpVectorScale:!0};if(x.forEach((function(c){var d=t.transform,p=Fi(d.zoom)*i.exaggeration();s=-1;var x,E=c?u.LINES:u.TRIANGLES,S=f(n);try{for(S.s();!(x=S.n()).done;){var M=x.value,A=r.getTile(M),I=e.StencilMode.disabled,C=i.prevTerrainTileForTile[M.key],z=i.terrainTileForTile[M.key];Ri(C,z)&&Bi.newMorphing(M.key,C,z,a,250),l.activeTexture.set(u.TEXTURE0),A.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE);var P=Bi.getMorphValuesForProxy(M.key),D=P?1:0;P&&e.extend$1(T,{morphing:{srcDemTile:P.from,dstDemTile:P.to,phase:e.easeCubicInOut(P.phase)}});var L=e.tileCornersToBounds(M.canonical),R=e.getLatitudinalLod(L.getCenter().lat),B=e.getGridMatrix(M.canonical,L,R,d.worldSize/d._pixelsPerMercatorPixel),O=e.globeNormalizeECEF(e.globeTileBounds(M.canonical)),F=Li(d.projMatrix,k,_,O,e.globeToMercatorTransition(d.zoom),g,d.frustumCorners.TL,d.frustumCorners.TR,d.frustumCorners.BR,d.frustumCorners.BL,d.globeCenterInViewSpace,d.globeRadius,w,p,B);if(v(D,c),i.setupElevationDraw(A,o,T),t.prepareDrawProgram(l,o,M.toUnwrapped()),b){var U=c?b.getWirefameBuffers(t.context,R):b.getGridBuffers(R,0!==p),V=h(U,3),N=V[0],j=V[1],G=V[2];o.draw(l,E,y,I,m,e.CullFaceMode.backCCW,F,"globe_raster",N,j,G)}}}catch(Z){S.e(Z)}finally{S.f()}})),b){var E=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];p&&E.push("CUSTOM_ANTIALIASING"),o=t.useProgram("globeRaster",null,E);var S,M=f(n);try{var A=function(){var n=S.value,a=n.canonical,s=a.x,c=a.y,f=a.z,p=0===c,v=c===(1<<f)-1,_=b.getPoleBuffers(f),x=h(_,4),k=x[0],E=x[1],M=x[2],A=x[3];if(A&&(p||v)){var I=r.getTile(n);l.activeTexture.set(u.TEXTURE0),I.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE);var C=e.globePoleMatrixForTile(f,s,d),z=e.globeNormalizeECEF(e.globeTileBounds(n.canonical)),P=function(t,i){return t.draw(l,u.TRIANGLES,y,e.StencilMode.disabled,m,e.CullFaceMode.disabled,Li(d.projMatrix,C,C,z,0,g,d.frustumCorners.TL,d.frustumCorners.TR,d.frustumCorners.BR,d.frustumCorners.BL,d.globeCenterInViewSpace,d.globeRadius,w,0),"globe_pole_raster",i,M,A)};i.setupElevationDraw(I,o,T),t.prepareDrawProgram(l,o,n.toUnwrapped()),p&&P(o,k),v&&(C=e.scale(e.create(),C,[1,-1,1]),P(o,E))}};for(M.s();!(S=M.n()).done;)A()}catch(I){M.e(I)}finally{M.f()}}}(t,i,r,n,a);else{var o,s,l=t.context,u=l.gl,c=t.options.showTerrainWireframe?2:0,d=function(e,i){if(s!==e){var r=[Oi[e]];i&&r.push(Oi[c]),o=t.useProgram("terrainRaster",null,r),s=e}},p=t.colorModeForRenderPass(),v=new e.DepthMode(u.LEQUAL,e.DepthMode.ReadWrite,t.depthRangeFor3D);Bi.update(a);var m=t.transform,y=Fi(m.zoom)*i.exaggeration();(c?[!1,!0]:[!1]).forEach((function(c){s=-1;var _,g=c?u.LINES:u.TRIANGLES,x=c?i.getWirefameBuffer():[i.gridIndexBuffer,i.gridSegments],b=h(x,2),w=b[0],k=b[1],T=f(n);try{for(T.s();!(_=T.n()).done;){var E=_.value,S=r.getTile(E),M=e.StencilMode.disabled,A=i.prevTerrainTileForTile[E.key],I=i.terrainTileForTile[E.key];Ri(A,I)&&Bi.newMorphing(E.key,A,I,a,250),l.activeTexture.set(u.TEXTURE0),S.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE,u.LINEAR_MIPMAP_NEAREST);var C=Bi.getMorphValuesForProxy(E.key),z=C?1:0,P=void 0;C&&(P={morphing:{srcDemTile:C.from,dstDemTile:C.to,phase:e.easeCubicInOut(C.phase)}});var D=Di(E.projMatrix,Ui(E.canonical,m.renderWorldCopies)?y/10:y);d(z,c),i.setupElevationDraw(S,o,P),t.prepareDrawProgram(l,o,E.toUnwrapped()),o.draw(l,g,v,M,p,e.CullFaceMode.backCCW,D,"terrain_raster",i.gridBuffer,w,k)}}catch(L){T.e(L)}finally{T.f()}}))}}(i,this,this.proxySourceCache,t,this._updateTimestamp),this.renderingToTexture=!0,i.gpuTimingDeferredRenderEnd(),t.splice(0,t.length))}},{key:"renderBatch",value:function(t){if(0===this._drapedRenderBatches.length)return t+1;this.renderingToTexture=!0;var i,r=this.painter,n=this.painter.context,a=this.proxySourceCache,o=this.proxiedCoords[a.id],s=this._drapedRenderBatches.shift(),l=[],u=r.style.order,c=0,h=f(o);try{for(h.s();!(i=h.n()).done;){var d=i.value,p=a.getTileByID(d.proxyTileKey),v=a.proxyCachedFBO[d.key]?a.proxyCachedFBO[d.key][t]:void 0,m=void 0!==v?a.renderCache[v]:this.pool[c++],y=void 0!==v;if(p.texture=m.tex,!y||m.dirty){var _=void 0;n.bindFramebuffer.set(m.fb.framebuffer),this.renderedToTile=!1,m.dirty&&(n.clear({color:e.Color.transparent,stencil:0}),m.dirty=!1);for(var g=s.start;g<=s.end;++g){var x=r.style._layers[u[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,m.fb.width,m.fb.height]),_!==(b?b.id:null)&&(this._setupStencil(m,w,x,b),_=b?b.id:null),r.renderLayer(r,b,x,k)}}}this.renderedToTile?(m.dirty=!0,l.push(p.tileID)):y||--c,5===c&&(c=0,this.renderToBackBuffer(l))}else l.push(p.tileID)}}catch(T){h.e(T)}finally{h.f()}return this.renderToBackBuffer(l),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=f(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(l){a.e(l)}finally{a.f()}return null}},{key:"_createFBO",value:function(){var t=this.painter.context,i=t.gl,r=this.drapeBufferSize;t.activeTexture.set(i.TEXTURE0);var n=new e.Texture(t,{width:r[0],height:r[1],data:null},i.RGBA);n.bind(i.LINEAR,i.CLAMP_TO_EDGE);var a=t.createFramebuffer(r[0],r[1],!1);return a.colorAttachment.set(n.texture),a.depthAttachment=new Fe(t,a.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=t.createRenderbuffer(t.gl.DEPTH_STENCIL,r[0],r[1]),this._stencilRef=0,a.depthAttachment.set(this._sharedDepthStencil),t.clear({stencil:0})):a.depthAttachment.set(this._sharedDepthStencil),t.extTextureFilterAnisotropic&&!t.extTextureFilterAnisotropicForceOff&&i.texParameterf(i.TEXTURE_2D,t.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,t.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 t,i=!1,r=f(this._style._getSources());try{for(r.s();!(t=r.n()).done;)if(t.value instanceof Ne){i=!0;break}}catch(m){r.e(m)}finally{r.f()}if(i)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 e.ZoomDependentExpression){n[s.id]=!0;var l,u=f(this.proxyCoords);try{for(u.s();!(l=u.n()).done;){var c=l.value,h=this.proxyToSource[c.key][s.id];if(h){var d,p=f(h);try{for(p.s();!(d=p.n()).done;){var v=d.value;this._clearRenderCacheForTile(s.id,v)}}catch(m){p.e(m)}finally{p.f()}}}}catch(m){u.e(m)}finally{u.f()}}}}},{key:"_clearRasterLayersFromRenderCache",value:function(){var e=!1;for(var t in this._style._sourceCaches)if(this._style._sourceCaches[t]._source instanceof je){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"),l=f(this.proxyCoords);try{for(l.s();!(o=l.n()).done;){var u=o.value,c=this.proxyToSource[u.key][a.id];if(c){var h,d=f(c);try{for(d.s();!(h=d.n()).done;){var p=h.value,v=Ni(a.getTile(p),a.findLoadedParent(p,0),a,this.painter.transform,s);(1!==v.opacity||0!==v.mix)&&this._clearRenderCacheForTile(a.id,p)}}catch(m){d.e(m)}finally{d.f()}}}}catch(m){l.e(m)}finally{l.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 r=0;r<i.length;++r){var n,a=Object.values(i[r]);(n=t.renderCachePool).push.apply(n,a)}}}else{this._clearRasterLayersFromRenderCache();for(var o=this.proxyCoords,s=this._tilesDirty,l=o.length-1;l>=0;l--){var u=o[l];if(t.getTileByID(u.key),void 0!==t.proxyCachedFBO[u.key]){var h=e[u.key],d=this.proxyToSource[u.key],p=0,v=function(e){var t=d[e],i=h[e];if(!i||i.length!==t.length||t.some((function(t,r){return t!==i[r]||s[e]&&s[e].hasOwnProperty(t.key)})))return p=-1,"break";++p};for(var m in d)if("break"===v(m))break;for(var y in t.proxyCachedFBO[u.key])t.renderCache[t.proxyCachedFBO[u.key][y]].dirty=p<0||p!==Object.values(h).length}}var _=c(this._drapedRenderBatches);_.sort((function(e,t){return t.end-t.start-(e.end-e.start)}));var g,x=f(_);try{for(x.s();!(g=x.n()).done;){var b,w=g.value,k=f(o);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(S){k.e(S)}finally{k.f()}}}catch(S){x.e(S)}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;if(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(t){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[t.key]),this._overlapStencilMode):e.StencilMode.disabled}},{key:"_renderTileClippingMasks",value:function(t,i){var r=this.painter,n=this.painter.context,a=n.gl;r._tileClippingMaskIDs={},n.setColorMode(e.ColorMode.disabled),n.setDepthMode(e.DepthMode.disabled);var o,s=r.useProgram("clippingMask"),l=f(t);try{for(l.s();!(o=l.n()).done;){var u=o.value,c=r._tileClippingMaskIDs[u.key]=--i;s.draw(n,a.TRIANGLES,e.DepthMode.disabled,new e.StencilMode({func:a.ALWAYS,mask:0},c,255,a.KEEP,a.KEEP,a.REPLACE),e.ColorMode.disabled,e.CullFaceMode.disabled,Vi(u.projMatrix),"$clipping",r.tileExtentBuffer,r.quadTriangleIndexBuffer,r.tileExtentSegments)}}catch(h){l.e(h)}finally{l.f()}}},{key:"pointCoordinate",value:function(t){var i=this.painter.transform;if(t.x<0||t.x>i.width||t.y<0||t.y>i.height)return null;var r=[t.x,t.y,1,1];e.transformMat4$1(r,r,i.pixelMatrixInverse),e.scale$1(r,r,1/r[3]),r[0]/=i.worldSize,r[1]/=i.worldSize;var n=i._camera.position,a=e.mercatorZfromAltitude(1,i.center.lat),o=[n[0],n[1],n[2]/a,0],s=e.subtract([],r.slice(0,3),o);e.normalize(s,s);var l=this.raycast(o,s,this._exaggeration);return null!==l&&l?(e.scaleAndAdd(o,o,s,l),o[3]=o[2],o[2]*=a,o):null}},{key:"drawDepth",value:function(){var t=this.painter,i=t.context,r=this.proxySourceCache,n=Math.ceil(t.width),a=Math.ceil(t.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=i.gl,s=i.createFramebuffer(n,a,!0);i.activeTexture.set(o.TEXTURE0);var l=new e.Texture(i,{width:n,height:a,data:null},o.RGBA);l.bind(o.NEAREST,o.CLAMP_TO_EDGE),s.colorAttachment.set(l.texture);var u=i.createRenderbuffer(i.gl.DEPTH_COMPONENT16,n,a);s.depthAttachment.set(u),this._depthFBO=s,this._depthTexture=l}i.bindFramebuffer.set(this._depthFBO.framebuffer),i.viewport.set([0,0,n,a]),function(t,i,r,n){if("globe"!==t.transform.projection.name){var a=t.context,o=a.gl;a.clear({depth:1});var s,l=t.useProgram("terrainDepth"),u=new e.DepthMode(o.LESS,e.DepthMode.ReadWrite,t.depthRangeFor3D),c=f(n);try{for(c.s();!(s=c.n()).done;){var h=s.value,d=r.getTile(h),p=Di(h.projMatrix,0);i.setupElevationDraw(d,l),l.draw(a,o.TRIANGLES,u,e.StencilMode.disabled,e.ColorMode.unblended,e.CullFaceMode.backCCW,p,"terrain_depth",i.gridBuffer,i.gridIndexBuffer,i.gridNoSkirtSegments)}}catch(v){c.e(v)}finally{c.f()}}}(t,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(t,i,r){if(t.getSource().loaded())for(var n=this.proxiedCoords[t.id]=[],a=this.proxyCoords,o=t.getSource(),s=new e.pointGeometry(o.tileID.x,o.tileID.y)._div(1<<o.tileID.z),l=o.coordinates.map(e.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 e.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE),max:new e.pointGeometry(-Number.MAX_VALUE,-Number.MAX_VALUE)}),u=function(t,i){var r=t.wrap+t.canonical.x/(1<<t.canonical.z),n=t.canonical.y/(1<<t.canonical.z),a=e.EXTENT/(1<<t.canonical.z),o=i.wrap+i.canonical.x/(1<<i.canonical.z),s=i.canonical.y/(1<<i.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<i.length;f++){var d=t.getTile(i[f]);if(d&&d.hasData()&&!u(h,d.tileID)){var p=this._createProxiedId(h,d,r[h.key]&&r[h.key][t.id]),v=this.proxyToSource[h.key][t.id];v?v.push(p):this.proxyToSource[h.key][t.id]=[p],n.push(p)}}}},{key:"_createProxiedId",value:function(t,i,r){var n=this.orthoMatrix;if(r){var a=r.find((function(e){return e.key===i.tileID.key}));if(a)return a}if(i.tileID.key!==t.key){var o,s,l,u=t.canonical.z-i.tileID.canonical.z;n=e.create();var c=i.tileID.wrap-t.wrap<<t.overscaledZ;u>0?(s=(o=e.EXTENT>>u)*((i.tileID.canonical.x<<u)-t.canonical.x+c),l=o*((i.tileID.canonical.y<<u)-t.canonical.y)):(o=e.EXTENT<<-u,s=e.EXTENT*(i.tileID.canonical.x-(t.canonical.x+c<<-u)),l=e.EXTENT*(i.tileID.canonical.y-(t.canonical.y<<-u))),e.ortho(n,0,o,0,o,0,1),e.translate(n,n,[s,l,0])}return new Zi(i.tileID,t.key,n)}},{key:"_findTileCoveringTileID",value:function(t,i){var r=i.getTile(t);if(r&&r.hasData())return r;var n=this._findCoveringTileCache[i.id],a=n[t.key];if((r=a?i.getTileByID(a):null)&&r.hasData()||null===a)return r;var o=r?r.tileID:t,s=o.overscaledZ,l=i.getSource().minzoom,u=[];if(!a){var c=i.getSource().maxzoom;if(t.canonical.z>=c){var h=t.canonical.z-c;i.getSource().reparseOverscaled?(s=Math.max(t.canonical.z+2,i.transform.tileZoom),o=new e.OverscaledTileID(s,t.wrap,c,t.canonical.x>>h,t.canonical.y>>h)):0!==h&&(s=c,o=new e.OverscaledTileID(s,t.wrap,c,t.canonical.x>>h,t.canonical.y>>h))}o.key!==t.key&&(u.push(o.key),r=i.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=i.getTileByID(d))&&r.hasData())break;var p=n[d];if(null===p)break;void 0===p?u.push(d):r=i.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 t=function(t){for(var i=0,r=new e.StructArrayLayout2ui4,n=131,a=1;a<129;a++){for(var o=1;o<129;o++)i=a*n+o,r.emplaceBack(i,i+1),r.emplaceBack(i,i+n),r.emplaceBack(i+1,i+n),128===a&&r.emplaceBack(i+n,i+n+1);r.emplaceBack(i+1,i+1+n)}return r}();this.wireframeIndexBuffer=this.painter.context.createIndexBuffer(t),this.wireframeSegments=e.SegmentVector.simpleSegment(0,0,this.gridBuffer.length,t.length)}return[this.wireframeIndexBuffer,this.wireframeSegments]}}]),r}(e.Elevation),Wi=function(){function t(i,r,n,a,o,s){d(this,t);var l=i.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():[],h=u.concat(c),f=a?a.defines():[];f=f.concat(s.map((function(e){return"#define ".concat(e)})));var p=i.isWebGL2?"#version 300 es\n":"",v=p+f.concat(i.extStandardDerivatives&&0===p.length?"#extension GL_OES_standard_derivatives : enable\n".concat(ki):ki,ki,wi,bi.fragmentSource,gi.fragmentSource,n.fragmentSource).join("\n"),m=p+f.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,gi.vertexSource,_i.vertexSource,n.vertexSource).join("\n"),y=l.createShader(l.FRAGMENT_SHADER);if(l.isContextLost())this.failedToCreate=!0;else{l.shaderSource(y,v),l.compileShader(y),l.attachShader(this.program,y);var _=l.createShader(l.VERTEX_SHADER);if(l.isContextLost())this.failedToCreate=!0;else{l.shaderSource(_,m),l.compileShader(_),l.attachShader(this.program,_),this.attributes={},this.numAttributes=h.length;for(var g=0;g<this.numAttributes;g++)h[g]&&(l.bindAttribLocation(this.program,g,h[g]),this.attributes[h[g]]=g);l.linkProgram(this.program),l.deleteShader(_),l.deleteShader(y),this.fixedUniforms=o(i),this.binderUniforms=a?a.getUniforms(i):[],s.includes("TERRAIN")&&(this.terrainUniforms=function(t){return{u_dem:new e.Uniform1i(t),u_dem_prev:new e.Uniform1i(t),u_dem_unpack:new e.Uniform4f(t),u_dem_tl:new e.Uniform2f(t),u_dem_scale:new e.Uniform1f(t),u_dem_tl_prev:new e.Uniform2f(t),u_dem_scale_prev:new e.Uniform1f(t),u_dem_size:new e.Uniform1f(t),u_dem_lerp:new e.Uniform1f(t),u_exaggeration:new e.Uniform1f(t),u_depth:new e.Uniform1i(t),u_depth_size_inv:new e.Uniform2f(t),u_meter_to_dem:new e.Uniform1f(t),u_label_plane_matrix_inv:new e.UniformMatrix4f(t)}}(i)),s.includes("GLOBE")&&(this.globeUniforms=function(t){return{u_tile_tl_up:new e.Uniform3f(t),u_tile_tr_up:new e.Uniform3f(t),u_tile_br_up:new e.Uniform3f(t),u_tile_bl_up:new e.Uniform3f(t),u_tile_up_scale:new e.Uniform1f(t)}}(i)),s.includes("FOG")&&(this.fogUniforms=function(t){return{u_fog_matrix:new e.UniformMatrix4f(t),u_fog_range:new e.Uniform2f(t),u_fog_color:new e.Uniform4f(t),u_fog_horizon_blend:new e.Uniform1f(t),u_fog_temporal_offset:new e.Uniform1f(t),u_frustum_tl:new e.Uniform3f(t),u_frustum_tr:new e.Uniform3f(t),u_frustum_br:new e.Uniform3f(t),u_frustum_bl:new e.Uniform3f(t),u_globe_pos:new e.Uniform3f(t),u_globe_radius:new e.Uniform1f(t),u_globe_transition:new e.Uniform1f(t),u_is_globe:new e.Uniform1i(t),u_viewport:new e.Uniform2f(t)}}(i))}}}return p(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(e,t,i,n,a,o,s,l,u,c,h,d,p,v,m){var y,_=e.gl;if(!this.failedToCreate){e.program.set(this.program),e.setDepthMode(i),e.setStencilMode(n),e.setColorMode(a),e.setCullFace(o);for(var g=0,x=Object.keys(this.fixedUniforms);g<x.length;g++){var b=x[g];this.fixedUniforms[b].set(this.program,b,s[b])}v&&v.setUniforms(this.program,e,this.binderUniforms,d,{zoom:p});var w,k=(y={},r(y,_.LINES,2),r(y,_.TRIANGLES,3),r(y,_.LINE_STRIP,1),y)[t],T=f(h.get());try{for(T.s();!(w=T.n()).done;){var E=w.value,S=E.vaos||(E.vaos={});(S[l]||(S[l]=new Mi)).bind(e,this,u,v?v.getPaintVertexBuffers():[],c,E.vertexOffset,m||[]),_.drawElements(t,E.primitiveLength*k,_.UNSIGNED_SHORT,E.primitiveOffset*k*2)}}catch(M){T.e(M)}finally{T.f()}}}}],[{key:"cacheKey",value:function(e,t,i,r){var n,a="".concat(t).concat(r?r.cacheKey:""),o=f(i);try{for(o.s();!(n=o.n()).done;){var s=n.value;e.usedDefines.includes(s)&&(a+="/".concat(s))}}catch(l){o.e(l)}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=e.create(),Yi=function(t,i,r,n,a,o,s,l,u,c,h){var f=i.style.light,d=f.properties.get("position"),p=[d.x,d.y,d.z],v=e.create$1();"viewport"===f.properties.get("anchor")&&(e.fromRotation(v,-i.transform.angle),e.transformMat3(p,p,v));var m=f.properties.get("color"),y=i.transform,_={u_matrix:t,u_lightpos:p,u_lightintensity:f.properties.get("intensity"),u_lightcolor:[m.r,m.g,m.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 e.CanonicalTileID(0,0,0),c[0]*e.EXTENT,c[1]*e.EXTENT),_.u_height_lift=l),_},Ki=function(t,i,r,n,a,o,s,l,u,c,h,f){var d=Yi(t,i,r,n,a,o,s,u,c,h,f),p={u_height_factor:-Math.pow(2,s.overscaledZ)/l.tileSize/8};return e.extend(d,Xi(i,l),p)},Ji=function(e){return{u_matrix:e}},$i=function(t,i,r){return e.extend(Ji(t),Xi(i,r))},Qi=function(e,t){return{u_matrix:e,u_world:t}},er=function(t,i,r,n){return e.extend($i(t,i,r),{u_world:n})},tr=e.create(),ir=function(t,i,r,n,a,o){var s,l=t.transform,u="globe"===l.projection.name;if("map"===o.paint.get("circle-pitch-alignment"))if(u){var c=e.globePixelsToTileUnits(l.zoom,i.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:t.translatePosMatrix(i.projMatrix,r,o.paint.get("circle-translate"),o.paint.get("circle-translate-anchor")),u_device_pixel_ratio:e.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=[i.canonical.x,i.canonical.y,1<<i.canonical.z],h.u_zoom_transition=e.globeToMercatorTransition(l.zoom);var f=a[0]*e.EXTENT,d=a[1]*e.EXTENT;h.u_up_dir=l.projection.upVector(new e.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(t,i,r,n){var a=e.EXTENT/r.tileSize;return{u_matrix:t,u_camera_to_center_distance:i.getCameraToCenterDistance(n),u_extrude_scale:[i.pixelsToGLUnits[0]/a,i.pixelsToGLUnits[1]/a]}},ar=function(e,t){return{u_matrix:e,u_color:t,u_overlay:0,u_overlay_scale:arguments.length>2&&void 0!==arguments[2]?arguments[2]:1}},or=e.create(),sr=function(t,i,r,n,a,o,s){var l=t.transform,u="globe"===l.projection.name,c=u?e.globePixelsToTileUnits(l.zoom,i.canonical)*l._pixelsPerMercatorPixel:W(r,1,o),h={u_matrix:i.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=[i.canonical.x,i.canonical.y,1<<i.canonical.z],h.u_zoom_transition=e.globeToMercatorTransition(l.zoom);var f=a[0]*e.EXTENT,d=a[1]*e.EXTENT;h.u_up_dir=l.projection.upVector(new e.CanonicalTileID(0,0,0),f,d)}return h},lr=function(e,t,i,r,n,a,o){var s=e.transform,l=s.calculatePixelsToTileUnitsMatrix(t);return{u_matrix:hr(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:fr(i)?t.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:cr(t,e.transform),u_alpha_discard_threshold:0,u_trim_offset:o}},ur=function(e,t,i,r,n){var a=e.transform;return{u_matrix:hr(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:cr(t,a),u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]],u_alpha_discard_threshold:0}};function cr(e,t){return 1/W(e,1,t.tileZoom)}function hr(e,t,i,r){return e.translatePosMatrix(r||t.tileID.projMatrix,t,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}function fr(e){var t=e.paint.get("line-dasharray").value;return t.value||"constant"!==t.kind}var dr=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:pr(n.paint.get("raster-hue-rotate")),u_perspective_transform:a};var o,s};function pr(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 vr,mr=e.create(),yr=function(t,i,r,n,a,o,s,l,u,c,h,f,d,p,v,m){var y=a.transform,_={u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:i?i.uSizeT:0,u_size:i?i.uSize:0,u_camera_to_center_distance: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:mr,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:mr,u_up_vector:[0,-1,0]};return"globe"===m.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=e.globeECEFOrigin(y.globeMatrix,h.toUnwrapped()),_.u_tile_matrix=Float32Array.from(y.globeMatrix),_.u_up_vector=v),_},_r=function(t,i,r,n,a,o,s,l,u,c,h,f,d,p,v,m,y){return e.extend(yr(t,i,r,n,a,o,s,l,u,c,f,d,p,v,m,y),{u_gamma_scale:n?a.transform.cameraToCenterDistance*Math.cos(a.terrain?0:a.transform._pitch):1,u_device_pixel_ratio:e.exported.devicePixelRatio,u_is_halo:+h})},gr=function(t,i,r,n,a,o,s,l,u,c,h,f,d,p,v,m){return e.extend(_r(t,i,r,n,a,o,s,l,!0,u,!0,h,f,d,p,v,m),{u_texsize_icon:c,u_texture_icon:1})},xr=function(e,t,i){return{u_matrix:e,u_opacity:t,u_color:i}},br=function(t,i,r,n,a){return e.extend(function(e,t,i){var r=t.imageManager.getPattern(e.toString()),n=t.imageManager.getPixelSize(),a=n.width,o=n.height,s=Math.pow(2,i.tileID.overscaledZ),l=i.tileSize*Math.pow(2,t.transform.tileZoom)/s,u=l*(i.tileID.canonical.x+i.tileID.wrap*s),c=l*i.tileID.canonical.y;return{u_image:0,u_pattern_tl:r.tl,u_pattern_br:r.br,u_texsize:[a,o],u_pattern_size:r.displaySize,u_tile_units_to_pixels:1/W(i,1,t.transform.tileZoom),u_pixel_coord_upper:[u>>16,c>>16],u_pixel_coord_lower:[65535&u,65535&c]}}(n,r,a),{u_matrix:t,u_opacity:i})},wr={fillExtrusion:function(t){return{u_matrix:new e.UniformMatrix4f(t),u_lightpos:new e.Uniform3f(t),u_lightintensity:new e.Uniform1f(t),u_lightcolor:new e.Uniform3f(t),u_vertical_gradient:new e.Uniform1f(t),u_opacity:new e.Uniform1f(t),u_edge_radius:new e.Uniform1f(t),u_ao:new e.Uniform2f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_up_dir:new e.Uniform3f(t),u_height_lift:new e.Uniform1f(t)}},fillExtrusionPattern:function(t){return{u_matrix:new e.UniformMatrix4f(t),u_lightpos:new e.Uniform3f(t),u_lightintensity:new e.Uniform1f(t),u_lightcolor:new e.Uniform3f(t),u_vertical_gradient:new e.Uniform1f(t),u_height_factor:new e.Uniform1f(t),u_edge_radius:new e.Uniform1f(t),u_ao:new e.Uniform2f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_up_dir:new e.Uniform3f(t),u_height_lift:new e.Uniform1f(t),u_image:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_pixel_coord_upper:new e.Uniform2f(t),u_pixel_coord_lower:new e.Uniform2f(t),u_tile_units_to_pixels:new e.Uniform1f(t),u_opacity:new e.Uniform1f(t)}},fill:function(t){return{u_matrix:new e.UniformMatrix4f(t)}},fillPattern:function(t){return{u_matrix:new e.UniformMatrix4f(t),u_image:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_pixel_coord_upper:new e.Uniform2f(t),u_pixel_coord_lower:new e.Uniform2f(t),u_tile_units_to_pixels:new e.Uniform1f(t)}},fillOutline:function(t){return{u_matrix:new e.UniformMatrix4f(t),u_world:new e.Uniform2f(t)}},fillOutlinePattern:function(t){return{u_matrix:new e.UniformMatrix4f(t),u_world:new e.Uniform2f(t),u_image:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_pixel_coord_upper:new e.Uniform2f(t),u_pixel_coord_lower:new e.Uniform2f(t),u_tile_units_to_pixels:new e.Uniform1f(t)}},circle:function(t){return{u_camera_to_center_distance:new e.Uniform1f(t),u_extrude_scale:new e.UniformMatrix2f(t),u_device_pixel_ratio:new e.Uniform1f(t),u_matrix:new e.UniformMatrix4f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_up_dir:new e.Uniform3f(t)}},collisionBox:function(t){return{u_matrix:new e.UniformMatrix4f(t),u_camera_to_center_distance:new e.Uniform1f(t),u_extrude_scale:new e.Uniform2f(t)}},collisionCircle:function(t){return{u_matrix:new e.UniformMatrix4f(t),u_inv_matrix:new e.UniformMatrix4f(t),u_camera_to_center_distance:new e.Uniform1f(t),u_viewport_size:new e.Uniform2f(t)}},debug:function(t){return{u_color:new e.UniformColor(t),u_matrix:new e.UniformMatrix4f(t),u_overlay:new e.Uniform1i(t),u_overlay_scale:new e.Uniform1f(t)}},clippingMask:function(t){return{u_matrix:new e.UniformMatrix4f(t)}},heatmap:function(t){return{u_extrude_scale:new e.Uniform1f(t),u_intensity:new e.Uniform1f(t),u_matrix:new e.UniformMatrix4f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_up_dir:new e.Uniform3f(t)}},heatmapTexture:function(t){return{u_image:new e.Uniform1i(t),u_color_ramp:new e.Uniform1i(t),u_opacity:new e.Uniform1f(t)}},hillshade:function(t){return{u_matrix:new e.UniformMatrix4f(t),u_image:new e.Uniform1i(t),u_latrange:new e.Uniform2f(t),u_light:new e.Uniform2f(t),u_shadow:new e.UniformColor(t),u_highlight:new e.UniformColor(t),u_accent:new e.UniformColor(t)}},hillshadePrepare:function(t){return{u_matrix:new e.UniformMatrix4f(t),u_image:new e.Uniform1i(t),u_dimension:new e.Uniform2f(t),u_zoom:new e.Uniform1f(t),u_unpack:new e.Uniform4f(t)}},line:function(t){return{u_matrix:new e.UniformMatrix4f(t),u_pixels_to_tile_units:new e.UniformMatrix2f(t),u_device_pixel_ratio:new e.Uniform1f(t),u_units_to_pixels:new e.Uniform2f(t),u_dash_image:new e.Uniform1i(t),u_gradient_image:new e.Uniform1i(t),u_image_height:new e.Uniform1f(t),u_texsize:new e.Uniform2f(t),u_tile_units_to_pixels:new e.Uniform1f(t),u_alpha_discard_threshold:new e.Uniform1f(t),u_trim_offset:new e.Uniform2f(t)}},linePattern:function(t){return{u_matrix:new e.UniformMatrix4f(t),u_texsize:new e.Uniform2f(t),u_pixels_to_tile_units:new e.UniformMatrix2f(t),u_device_pixel_ratio:new e.Uniform1f(t),u_image:new e.Uniform1i(t),u_units_to_pixels:new e.Uniform2f(t),u_tile_units_to_pixels:new e.Uniform1f(t),u_alpha_discard_threshold:new e.Uniform1f(t)}},raster:function(t){return{u_matrix:new e.UniformMatrix4f(t),u_tl_parent:new e.Uniform2f(t),u_scale_parent:new e.Uniform1f(t),u_fade_t:new e.Uniform1f(t),u_opacity:new e.Uniform1f(t),u_image0:new e.Uniform1i(t),u_image1:new e.Uniform1i(t),u_brightness_low:new e.Uniform1f(t),u_brightness_high:new e.Uniform1f(t),u_saturation_factor:new e.Uniform1f(t),u_contrast_factor:new e.Uniform1f(t),u_spin_weights:new e.Uniform3f(t),u_perspective_transform:new e.Uniform2f(t)}},symbolIcon:function(t){return{u_is_size_zoom_constant:new e.Uniform1i(t),u_is_size_feature_constant:new e.Uniform1i(t),u_size_t:new e.Uniform1f(t),u_size:new e.Uniform1f(t),u_camera_to_center_distance:new e.Uniform1f(t),u_rotate_symbol:new e.Uniform1i(t),u_aspect_ratio:new e.Uniform1f(t),u_fade_change:new e.Uniform1f(t),u_matrix:new e.UniformMatrix4f(t),u_label_plane_matrix:new e.UniformMatrix4f(t),u_coord_matrix:new e.UniformMatrix4f(t),u_is_text:new e.Uniform1i(t),u_pitch_with_map:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_camera_forward:new e.Uniform3f(t),u_tile_matrix:new e.UniformMatrix4f(t),u_up_vector:new e.Uniform3f(t),u_ecef_origin:new e.Uniform3f(t),u_texture:new e.Uniform1i(t)}},symbolSDF:function(t){return{u_is_size_zoom_constant:new e.Uniform1i(t),u_is_size_feature_constant:new e.Uniform1i(t),u_size_t:new e.Uniform1f(t),u_size:new e.Uniform1f(t),u_camera_to_center_distance:new e.Uniform1f(t),u_rotate_symbol:new e.Uniform1i(t),u_aspect_ratio:new e.Uniform1f(t),u_fade_change:new e.Uniform1f(t),u_matrix:new e.UniformMatrix4f(t),u_label_plane_matrix:new e.UniformMatrix4f(t),u_coord_matrix:new e.UniformMatrix4f(t),u_is_text:new e.Uniform1i(t),u_pitch_with_map:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_texture:new e.Uniform1i(t),u_gamma_scale:new e.Uniform1f(t),u_device_pixel_ratio:new e.Uniform1f(t),u_tile_id:new e.Uniform3f(t),u_zoom_transition:new e.Uniform1f(t),u_inv_rot_matrix:new e.UniformMatrix4f(t),u_merc_center:new e.Uniform2f(t),u_camera_forward:new e.Uniform3f(t),u_tile_matrix:new e.UniformMatrix4f(t),u_up_vector:new e.Uniform3f(t),u_ecef_origin:new e.Uniform3f(t),u_is_halo:new e.Uniform1i(t)}},symbolTextAndIcon:function(t){return{u_is_size_zoom_constant:new e.Uniform1i(t),u_is_size_feature_constant:new e.Uniform1i(t),u_size_t:new e.Uniform1f(t),u_size:new e.Uniform1f(t),u_camera_to_center_distance:new e.Uniform1f(t),u_rotate_symbol:new e.Uniform1i(t),u_aspect_ratio:new e.Uniform1f(t),u_fade_change:new e.Uniform1f(t),u_matrix:new e.UniformMatrix4f(t),u_label_plane_matrix:new e.UniformMatrix4f(t),u_coord_matrix:new e.UniformMatrix4f(t),u_is_text:new e.Uniform1i(t),u_pitch_with_map:new e.Uniform1i(t),u_texsize:new e.Uniform2f(t),u_texsize_icon:new e.Uniform2f(t),u_texture:new e.Uniform1i(t),u_texture_icon:new e.Uniform1i(t),u_gamma_scale:new e.Uniform1f(t),u_device_pixel_ratio:new e.Uniform1f(t),u_is_halo:new e.Uniform1i(t)}},background:function(t){return{u_matrix:new e.UniformMatrix4f(t),u_opacity:new e.Uniform1f(t),u_color:new e.UniformColor(t)}},backgroundPattern:function(t){return{u_matrix:new e.UniformMatrix4f(t),u_opacity:new e.Uniform1f(t),u_image:new e.Uniform1i(t),u_pattern_tl:new e.Uniform2f(t),u_pattern_br:new e.Uniform2f(t),u_texsize:new e.Uniform2f(t),u_pattern_size:new e.Uniform2f(t),u_pixel_coord_upper:new e.Uniform2f(t),u_pixel_coord_lower:new e.Uniform2f(t),u_tile_units_to_pixels:new e.Uniform1f(t)}},terrainRaster:Pi,terrainDepth:Pi,skybox:function(t){return{u_matrix:new e.UniformMatrix4f(t),u_sun_direction:new e.Uniform3f(t),u_cubemap:new e.Uniform1i(t),u_opacity:new e.Uniform1f(t),u_temporal_offset:new e.Uniform1f(t)}},skyboxGradient:function(t){return{u_matrix:new e.UniformMatrix4f(t),u_color_ramp:new e.Uniform1i(t),u_center_direction:new e.Uniform3f(t),u_radius:new e.Uniform1f(t),u_opacity:new e.Uniform1f(t),u_temporal_offset:new e.Uniform1f(t)}},skyboxCapture:function(t){return{u_matrix_3f:new e.UniformMatrix3f(t),u_sun_direction:new e.Uniform3f(t),u_sun_intensity:new e.Uniform1f(t),u_color_tint_r:new e.Uniform4f(t),u_color_tint_m:new e.Uniform4f(t),u_luminance:new e.Uniform1f(t)}},globeRaster:function(t){return{u_proj_matrix:new e.UniformMatrix4f(t),u_globe_matrix:new e.UniformMatrix4f(t),u_normalize_matrix:new e.UniformMatrix4f(t),u_merc_matrix:new e.UniformMatrix4f(t),u_zoom_transition:new e.Uniform1f(t),u_merc_center:new e.Uniform2f(t),u_image0:new e.Uniform1i(t),u_grid_matrix:new e.UniformMatrix3f(t),u_skirt_height:new e.Uniform1f(t),u_frustum_tl:new e.Uniform3f(t),u_frustum_tr:new e.Uniform3f(t),u_frustum_br:new e.Uniform3f(t),u_frustum_bl:new e.Uniform3f(t),u_globe_pos:new e.Uniform3f(t),u_globe_radius:new e.Uniform1f(t),u_viewport:new e.Uniform2f(t)}},globeAtmosphere:function(t){return{u_frustum_tl:new e.Uniform3f(t),u_frustum_tr:new e.Uniform3f(t),u_frustum_br:new e.Uniform3f(t),u_frustum_bl:new e.Uniform3f(t),u_horizon:new e.Uniform1f(t),u_transition:new e.Uniform1f(t),u_fadeout_range:new e.Uniform1f(t),u_color:new e.Uniform4f(t),u_high_color:new e.Uniform4f(t),u_space_color:new e.Uniform4f(t),u_star_intensity:new e.Uniform1f(t),u_star_density:new e.Uniform1f(t),u_star_size:new e.Uniform1f(t),u_temporal_offset:new e.Uniform1f(t),u_horizon_angle:new e.Uniform1f(t),u_rotation_matrix:new e.UniformMatrix4f(t)}}};function kr(t,i,r,n,a,o,s){for(var l=t.context,u=l.gl,c=t.transform,h=t.useProgram("collisionBox"),f=[],d=0,p=0,v=0;v<n.length;v++){var m=n[v],y=i.getTile(m),_=y.getBucket(r);if(_){var g=Dt(m,_,c),x=g;0===a[0]&&0===a[1]||(x=t.translatePosMatrix(g,y,a,o));var b=s?_.textCollisionBox:_.iconCollisionBox,w=_.collisionCircleArray;if(w.length>0){var k=e.create(),T=x;e.mul(k,_.placementInvProjMatrix,c.glCoordMatrix),e.mul(k,k,_.placementViewportMatrix),f.push({circleArray:w,circleOffset:p,transform:T,invTransform:k,projection:_.getProjection()}),p=d+=w.length/4}b&&(t.terrain&&t.terrain.setupElevationDraw(y,h),h.draw(l,u.LINES,e.DepthMode.disabled,e.StencilMode.disabled,t.colorModeForRenderPass(),e.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=t.useProgram("collisionCircle"),S=new e.StructArrayLayout2f1f2i16;S.resize(4*d),S._trim();for(var M=0,A=0,I=f;A<I.length;A++)for(var C=I[A],z=0;z<C.circleArray.length/4;z++){var P=4*z,D=C.circleArray[P+0],L=C.circleArray[P+1],R=C.circleArray[P+2],B=C.circleArray[P+3];S.emplace(M++,D,L,R,B,0),S.emplace(M++,D,L,R,B,1),S.emplace(M++,D,L,R,B,2),S.emplace(M++,D,L,R,B,3)}(!vr||vr.length<2*d)&&(vr=function(t){var i=2*t,r=new e.StructArrayLayout3ui6;r.resize(i),r._trim();for(var n=0;n<i;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(vr,!0),U=l.createVertexBuffer(S,e.collisionCircleLayout.members,!0),V=0,N=f;V<N.length;V++){var j=N[V],G={u_matrix:j.transform,u_inv_matrix:j.invTransform,u_camera_to_center_distance:(O=c).getCameraToCenterDistance(j.projection),u_viewport_size:[O.width,O.height]};E.draw(l,u.TRIANGLES,e.DepthMode.disabled,e.StencilMode.disabled,t.colorModeForRenderPass(),e.CullFaceMode.disabled,G,r.id,U,F,e.SegmentVector.simpleSegment(0,2*j.circleOffset,j.circleArray.length,j.circleArray.length/2),null,c.zoom)}U.destroy(),F.destroy()}}var Tr=e.create();function Er(t,i){var r=t.width,n=t.height,a=t.anchor,o=t.textOffset,s=t.textScale,l=e.getAnchorAlignment(a),u=-(l.horizontalAlign-.5)*r,c=-(l.verticalAlign-.5)*n,h=e.evaluateVariableOffset(a,o);return new e.pointGeometry((u/s+h[0])*i,(c/s+h[1])*i)}function Sr(t,i,r,n,a,o,s,l,u,c,f){var d=t.text.placedSymbolArray,p=t.text.dynamicLayoutVertexArray,v=t.icon.dynamicLayoutVertexArray,m={},y=t.getProjection(),_=Lt(l,y,o),g=o.elevation,x=y.upVectorScale(l.canonical,o.center.lat,o.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,S=t.allowVerticalPlacement&&!w.placedOrientation,M=w.hidden||!w.crossTileID||S?null:n[w.crossTileID];if(M){var A,I,C,z=0,P=0,D=0;if(g){var L=g?g.getAtTileOffset(l,k,T):0,R=y.upVector(l.canonical,k,T),B=h(R,3);z=L*B[0]*x,P=L*B[1]*x,D=L*B[2]*x}var O=_t(w.projectedAnchorX+z,w.projectedAnchorY+P,w.projectedAnchorZ+D,r?_:s),F=h(O,4),U=F[0],V=F[1],N=F[2],j=F[3],G=gt(o.getCameraToCenterDistance(y),j),Z=a.evaluateSizeForFeature(t.textSizeData,c,w)*G/e.ONE_EM;r&&(Z*=t.tilePixelRatio/u);var q=Er(M,Z);r?(I=_t((U=(A=y.projectTilePoint(k+q.x,T+q.y,l.canonical)).x)+z,(V=A.y)+P,(N=A.z)+D,s),U=(C=h(I,3))[0],V=C[1],N=C[2]):(i&&q._rotate(-o.angle),U+=q.x,V+=q.y,N=0);for(var W=t.allowVerticalPlacement&&w.placedOrientation===e.WritingMode.vertical?Math.PI/2:0,X=0;X<E;X++)e.addDynamicAttributes(p,U,V,N,W);f&&w.associatedIconIndex>=0&&(m[w.associatedIconIndex]={x:U,y:V,z:N,angle:W})}else At(E,p)}if(f){v.clear();for(var H=t.icon.placedSymbolArray,Y=0;Y<H.length;Y++){var K=H.get(Y),J=K.numGlyphs,$=m[Y];if(K.hidden||!$)At(J,v);else for(var Q=$.x,ee=$.y,te=$.z,ie=$.angle,re=0;re<J;re++)e.addDynamicAttributes(v,Q,ee,te,ie)}t.icon.dynamicLayoutVertexBuffer.updateData(v)}t.text.dynamicLayoutVertexBuffer.updateData(p)}function Mr(e,t,i){return i.iconsInText&&t?"symbolTextAndIcon":e?"symbolSDF":"symbolIcon"}function Ar(t,i,r,n,a,o,s,l,u,c,h,d){var p=t.context,v=p.gl,m=t.transform,y="map"===l,_="map"===u,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=t.depthModeForSublayer(0,e.DepthMode.ReadOnly),T=[e.mercatorXfromLng(m.center.lng),e.mercatorYfromLat(m.center.lat)],E=r.layout.get("text-variable-anchor"),S="globe"===m.projection.name,M=[],A=[0,-1,0],I=A;!S&&!m.mercatorFromTransition||y||(I=function(t){var i=t._camera.getWorldToCamera(t.worldSize,1),r=e.multiply([],i,t.globeMatrix);e.invert(r,r);var n=[0,0,0],a=[0,1,0,0];return e.transformMat4$1(a,a,r),n[0]=a[0],n[1]=a[1],n[2]=a[2],e.normalize(n,n),n}(m));var C,z=f(n);try{for(z.s();!(C=z.n()).done;){var P=C.value,D=i.getTile(P),L=D.getBucket(r);if(L&&("mercator"!==L.projection.name||!S)){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!==m.pitch,V=e.evaluateSizeForZoom(F,m.zoom),N=void 0,j=void 0,G=void 0,Z=void 0,q=[0,0],W=null;if(a){if(j=D.glyphAtlasTexture,G=v.LINEAR,N=D.glyphAtlasTexture.size,L.iconsInText){q=D.imageAtlasTexture.size,W=D.imageAtlasTexture;var X="composite"===F.kind||"camera"===F.kind;Z=U||t.options.rotating||t.options.zooming||X?v.LINEAR:v.NEAREST}}else{var H=1!==r.layout.get("icon-size").constantOr(0)||L.iconsNeedLinear;j=D.imageAtlasTexture,G=O||t.options.rotating||t.options.zooming||H||U?v.LINEAR:v.NEAREST,N=D.imageAtlasTexture.size}var Y="globe"===L.projection.name,K=Y?I:A,J=Y?e.globeToMercatorTransition(m.zoom):0,$=Lt(P,L.getProjection(),m),Q=m.calculatePixelsToTileUnitsMatrix(D),ee=vt($,D.tileID.canonical,_,y,m,L.getProjection(),Q),te=t.terrain&&_&&g?e.invert(e.create(),ee):Tr,ie=yt($,D.tileID.canonical,_,y,m,L.getProjection(),Q),re=E&&L.hasTextData(),ne="none"!==r.layout.get("icon-text-fit")&&re&&L.hasIconData();if(g){var ae=m.elevation,oe=ae?ae.getAtTileOffsetFunc(P,m.center.lat,m.worldSize,L.getProjection()):null,se=mt($,D.tileID.canonical,_,y,m,L.getProjection(),Q);bt(L,$,t,a,se,ie,_,c,oe,P)}var le=g||a&&E||ne,ue=t.translatePosMatrix($,D,o,s),ce=le?Tr:ee,he=t.translatePosMatrix(ie,D,o,s,!0),fe=L.getProjection().createInversionMatrix(m,P.canonical),de=[];t.terrainRenderModeElevated()&&_&&de.push("PITCH_WITH_MAP_TERRAIN"),Y&&de.push("PROJECTION_GLOBE_VIEW"),le&&de.push("PROJECTED_POS_ON_VIEWPORT");var pe=O&&0!==r.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(1),ve=void 0;ve=O?L.iconsInText?gr(F.kind,V,x,_,t,ue,ce,he,N,q,P,J,T,fe,K,L.getProjection()):_r(F.kind,V,x,_,t,ue,ce,he,a,N,!0,P,J,T,fe,K,L.getProjection()):yr(F.kind,V,x,_,t,ue,ce,he,a,N,P,J,T,fe,K,L.getProjection());var me={program:t.useProgram(Mr(O,a,L),B,de),buffers:R,uniformValues:ve,atlasTexture:j,atlasTextureIcon:W,atlasInterpolation:G,atlasInterpolationIcon:Z,isSDF:O,hasHalo:pe,tile:D,labelPlaneMatrixInv:te};if(b&&L.canOverlap){w=!0;var ye,_e=R.segments.get(),ge=f(_e);try{for(ge.s();!(ye=ge.n()).done;){var xe=ye.value;M.push({segments:new e.SegmentVector([xe]),sortKey:xe.sortKey,state:me})}}catch(Se){ge.e(Se)}finally{ge.f()}}else M.push({segments:R.segments,sortKey:0,state:me})}}}}catch(Se){z.e(Se)}finally{z.f()}w&&M.sort((function(e,t){return e.sortKey-t.sortKey}));for(var be=0,we=M;be<we.length;be++){var ke=we[be],Te=ke.state;if(t.terrain&&t.terrain.setupElevationDraw(Te.tile,Te.program,{useDepthForOcclusion:!S,labelPlaneMatrixInv:Te.labelPlaneMatrixInv}),p.activeTexture.set(v.TEXTURE0),Te.atlasTexture.bind(Te.atlasInterpolation,v.CLAMP_TO_EDGE),Te.atlasTextureIcon&&(p.activeTexture.set(v.TEXTURE1),Te.atlasTextureIcon&&Te.atlasTextureIcon.bind(Te.atlasInterpolationIcon,v.CLAMP_TO_EDGE)),Te.isSDF){var Ee=Te.uniformValues;Te.hasHalo&&(Ee.u_is_halo=1,Ir(Te.buffers,ke.segments,r,t,Te.program,k,h,d,Ee)),Ee.u_is_halo=0}Ir(Te.buffers,ke.segments,r,t,Te.program,k,h,d,Te.uniformValues)}}function Ir(t,i,r,n,a,o,s,l,u){var c=n.context,h=[t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer,t.globeExtVertexBuffer];a.draw(c,c.gl.TRIANGLES,o,s,l,e.CullFaceMode.disabled,u,r.id,t.layoutVertexBuffer,t.indexBuffer,i,r.paint,n.transform.zoom,t.programConfigurations.get(r.id),h)}function Cr(t,i,r,n,a,o,s){var l,u,c,h,d,p=t.context.gl,v=r.paint.get("fill-pattern"),m=v&&v.constantOr(1);s?(u=m&&!r.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",l=p.LINES):(u=m?"fillPattern":"fill",l=p.TRIANGLES);var y,_=f(n);try{for(_.s();!(y=_.n()).done;){var g=y.value,x=i.getTile(g);if(!m||x.patternsLoaded()){var b=x.getBucket(r);if(b){t.prepareDrawTile();var w=b.programConfigurations.get(r.id),k=t.useProgram(u,w);m&&(t.context.activeTexture.set(p.TEXTURE0),x.imageAtlasTexture.bind(p.LINEAR,p.CLAMP_TO_EDGE),w.updatePaintBuffers());var T=v.constantOr(null);if(T&&x.imageAtlas){var E=x.imageAtlas.patternPositions[T.toString()];E&&w.setConstantPatternPositions(E)}var S=t.translatePosMatrix(g.projMatrix,x,r.paint.get("fill-translate"),r.paint.get("fill-translate-anchor"));if(s){h=b.indexBuffer2,d=b.segments2;var M=t.terrain&&t.terrain.renderingToTexture?t.terrain.drapeBufferSize:[p.drawingBufferWidth,p.drawingBufferHeight];c="fillOutlinePattern"===u&&m?er(S,t,x,M):Qi(S,M)}else h=b.indexBuffer,d=b.segments,c=m?$i(S,t,x):Ji(S);t.prepareDrawProgram(t.context,k,g.toUnwrapped()),k.draw(t.context,l,a,t.stencilModeForClipping(g),o,e.CullFaceMode.disabled,c,r.id,b.layoutVertexBuffer,h,d,r.paint,t.transform.zoom,w)}}}}catch(A){_.e(A)}finally{_.f()}}function zr(t,i,r,n,a,o,s){var l=t.context,u=l.gl,c=t.transform,h=r.paint.get("fill-extrusion-pattern"),d=h.constantOr(1),p=r.paint.get("fill-extrusion-opacity"),v=[r.paint.get("fill-extrusion-ambient-occlusion-intensity"),r.paint.get("fill-extrusion-ambient-occlusion-radius")],m=r.layout.get("fill-extrusion-edge-radius"),y="globe"===c.projection.name?e.fillExtrusionHeightLift():0,_="globe"===c.projection.name,g=_?e.globeToMercatorTransition(c.zoom):0,x=[e.mercatorXfromLng(c.center.lng),e.mercatorYfromLat(c.center.lat)],b=[];_&&b.push("PROJECTION_GLOBE_VIEW"),v[0]>0&&b.push("FAUX_AO");var w,k=f(n);try{for(k.s();!(w=k.n()).done;){var T=w.value,E=i.getTile(T),S=E.getBucket(r);if(S&&S.projection.name===c.projection.name){var M=S.programConfigurations.get(r.id),A=t.useProgram(d?"fillExtrusionPattern":"fillExtrusion",M,b);if(t.terrain){var I=t.terrain;if(t.style.terrainSetForDrapingOnly())I.setupElevationDraw(E,A,{useMeterToDem:!0});else{if(!S.enableTerrain)continue;if(I.setupElevationDraw(E,A,{useMeterToDem:!0}),Pr(l,i,T,S,r,I),!S.centroidVertexBuffer){var C=A.attributes.a_centroid_pos;void 0!==C&&u.vertexAttrib2f(C,0,0)}}}d&&(t.context.activeTexture.set(u.TEXTURE0),E.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),M.updatePaintBuffers());var z=h.constantOr(null);if(z&&E.imageAtlas){var P=E.imageAtlas.patternPositions[z.toString()];P&&M.setConstantPatternPositions(P)}var D=t.translatePosMatrix(T.projMatrix,E,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),L=c.projection.createInversionMatrix(c,T.canonical),R=r.paint.get("fill-extrusion-vertical-gradient"),B=d?Ki(D,t,R,p,v,m,T,E,y,g,x,L):Yi(D,t,R,p,v,m,T,y,g,x,L);t.prepareDrawProgram(l,A,T.toUnwrapped());var O=[];t.terrain&&O.push(S.centroidVertexBuffer),_&&O.push(S.layoutVertexExtBuffer),A.draw(l,l.gl.TRIANGLES,a,o,s,e.CullFaceMode.backCCW,B,r.id,S.layoutVertexBuffer,S.indexBuffer,S.segments,r.paint,t.transform.zoom,M,O)}}}catch(F){k.e(F)}finally{k.f()}}function Pr(t,i,r,n,a,o){for(var s,l,u,c=[function(t){var i=t.canonical.x-1,r=t.wrap;return i<0&&(i=(1<<t.canonical.z)-1,r--),new e.OverscaledTileID(t.overscaledZ,r,t.canonical.z,i,t.canonical.y)},function(t){var i=t.canonical.x+1,r=t.wrap;return i===1<<t.canonical.z&&(i=0,r++),new e.OverscaledTileID(t.overscaledZ,r,t.canonical.z,i,t.canonical.y)},function(t){return new e.OverscaledTileID(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,(0===t.canonical.y?1<<t.canonical.z:t.canonical.y)-1)},function(t){return new e.OverscaledTileID(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y===(1<<t.canonical.z)-1?0:t.canonical.y+1)}],h=function(e){for(var t=i.getSource().minzoom,r=function(e){var t=i.getTileByID(e);if(t&&t.hasData())return t.getBucket(a)},n=0,o=[0,-1,1];n<o.length;n++){var s=o[n];if(!(e.overscaledZ+s<t)){var l=r(e.calculateScaledKey(e.overscaledZ+s));if(l)return l}}},d=[0,0,0],p=function(t,i){return d[0]=Math.min(t.min.y,i.min.y),d[1]=Math.max(t.max.y,i.max.y),d[2]=e.EXTENT-i.min.x>t.max.x?i.min.x-e.EXTENT:t.max.x,d},v=function(t,i){return d[0]=Math.min(t.min.x,i.min.x),d[1]=Math.max(t.max.x,i.max.x),d[2]=e.EXTENT-i.min.y>t.max.y?i.min.y-e.EXTENT:t.max.y,d},m=[function(e,t){return p(e,t)},function(e,t){return p(t,e)},function(e,t){return v(e,t)},function(e,t){return v(t,e)}],y=new e.pointGeometry(0,0),_=function(t,i,n,a,c){var h=[[a?n:t,a?t:n,0],[a?n:i,a?i:n,0]],f=c<0?e.EXTENT+c:c,d=[a?f:(t+i)/2,a?(t+i)/2:f,0];return 0===n&&c<0||0!==n&&c>0?o.getForTilePoints(u,[d],!0,l):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=u=c[g](r),k=h(w);if(k&&k instanceof e.FillExtrusionBucket&&k.enableTerrain&&(n.borderDoneWithNeighborZ[g]!==k.canonical.z||k.borderDoneWithNeighborZ[x]!==n.canonical.z)&&(l=o.findDEMTileFor(w))&&l.dem){if(!s){var T=o.findDEMTileFor(r);if(!T||!T.dem)return;s=T}var E=k.borders[x],S=0,M=k.borderDoneWithNeighborZ[x]!==n.canonical.z;if(n.canonical.z===k.canonical.z){for(var A=0;A<b.length;A++){for(var I=n.featuresOnBorder[b[A]],C=I.borders[g],z=void 0;S<E.length&&!((z=k.featuresOnBorder[E[S]]).borders[x][1]>C[0]+3);)M&&k.encodeCentroid(void 0,z,!1),S++;if(z&&S<E.length){for(var P=S,D=0;!(z.borders[x][0]>C[1]-3)&&(D++,++S!==E.length);)z=k.featuresOnBorder[E[S]];if(z=k.featuresOnBorder[E[P]],I.intersectsCount()>1||z.intersectsCount()>1||1!==D){1!==D&&(S=P),n.encodeCentroid(void 0,I,!1),M&&k.encodeCentroid(void 0,z,!1);continue}var L=m[g](I,z),R=g%2?e.EXTENT-1:0;y.x=_(L[0],Math.min(e.EXTENT-1,L[1]),R,g<2,L[2]),y.y=0,n.encodeCentroid(y,I,!1),M&&k.encodeCentroid(y,z,!1)}else n.encodeCentroid(void 0,I,!1)}n.borderDoneWithNeighborZ[g]=k.canonical.z,n.needsCentroidUpdate=!0,M&&(k.borderDoneWithNeighborZ[x]=n.canonical.z,k.needsCentroidUpdate=!0)}else{var B,O=f(b);try{for(O.s();!(B=O.n()).done;){var F=B.value;n.encodeCentroid(void 0,n.featuresOnBorder[F],!1)}}catch(j){O.e(j)}finally{O.f()}if(M){var U,V=f(E);try{for(V.s();!(U=V.n()).done;){var N=U.value;k.encodeCentroid(void 0,k.featuresOnBorder[N],!1)}}catch(j){V.e(j)}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(t)}var Dr=new e.Color(1,0,0,1),Lr=new e.Color(0,1,0,1),Rr=new e.Color(0,0,1,1),Br=new e.Color(1,0,1,1),Or=new e.Color(0,1,1,1);function Fr(t,i,r){var n=t.context,a=t.transform,o=n.gl,s="globe"===a.projection.name,l=s?["PROJECTION_GLOBE_VIEW"]:null,u=r.projMatrix;if(s&&e.globeToMercatorTransition(a.zoom)>0){var c=e.transitionTileAABBinECEF(r.canonical,a),h=e.globeDenormalizeECEF(c);u=e.multiply(new Float32Array(16),a.globeMatrix,h),e.multiply(u,a.projMatrix,u)}var f=t.useProgram("debug",null,l),d=i.getTileByID(r.key);t.terrain&&t.terrain.setupElevationDraw(d,f);var p=e.DepthMode.disabled,v=e.StencilMode.disabled,m=t.colorModeForRenderPass(),y="$debug";n.activeTexture.set(o.TEXTURE0),t.emptyTexture.bind(o.LINEAR,o.CLAMP_TO_EDGE),s?d._makeGlobeTileDebugBuffers(t.context,a):d._makeDebugTileBoundsBuffers(t.context,a.projection);var _=d._tileDebugBuffer||t.debugBuffer,g=d._tileDebugIndexBuffer||t.debugIndexBuffer,x=d._tileDebugSegments||t.debugSegments;f.draw(n,o.LINE_STRIP,p,v,m,e.CullFaceMode.disabled,ar(u,e.Color.red),y,_,g,x,null,null,null,[d._globeTileDebugBorderBuffer]);var b=d.latestRawTileData,w=Math.floor((b&&b.byteLength||0)/1024),k=i.getTile(r).tileSize,T=512/Math.min(k,512)*(r.overscaledZ/a.zoom)*.5,E=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(E+=" => ".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)}(t,E+=" ".concat(w,"kb"));var S=d._tileDebugTextBuffer||t.debugBuffer,M=d._tileDebugTextIndexBuffer||t.quadTriangleIndexBuffer,A=d._tileDebugTextSegments||t.debugSegments;f.draw(n,o.TRIANGLES,p,v,e.ColorMode.alphaBlended,e.CullFaceMode.disabled,ar(u,e.Color.transparent,T),y,S,M,A,null,null,null,[d._globeTileDebugTextBuffer])}function Ur(e,t,i,r){Nr(e,0,t+i/2,e.transform.width,i,r)}function Vr(e,t,i,r){Nr(e,t-i/2,0,i,e.transform.height,r)}function Nr(t,i,r,n,a,o){var s=t.context,l=s.gl;l.enable(l.SCISSOR_TEST),l.scissor(i*e.exported.devicePixelRatio,r*e.exported.devicePixelRatio,n*e.exported.devicePixelRatio,a*e.exported.devicePixelRatio),s.clear({color:o}),l.disable(l.SCISSOR_TEST)}var jr=e.createLayout([{name:"a_pos_3f",components:3,type:"Float32"}]).members;function Gr(e,t,i,r){e.emplaceBack(t,i,r)}var Zr=p((function t(i){d(this,t),this.vertexArray=new e.StructArrayLayout3f12,this.indices=new e.StructArrayLayout3ui6,Gr(this.vertexArray,-1,-1,1),Gr(this.vertexArray,1,-1,1),Gr(this.vertexArray,-1,1,1),Gr(this.vertexArray,1,1,1),Gr(this.vertexArray,-1,-1,-1),Gr(this.vertexArray,1,-1,-1),Gr(this.vertexArray,-1,1,-1),Gr(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=i.createVertexBuffer(this.vertexArray,jr),this.indexBuffer=i.createIndexBuffer(this.indices),this.segment=e.SegmentVector.simpleSegment(0,0,36,12)}));function qr(t,i,r,n,a,o){var s=t.gl,l=i.paint.get("sky-atmosphere-color"),u=i.paint.get("sky-atmosphere-halo-color"),c=i.paint.get("sky-atmosphere-sun-intensity"),h=function(e,t,i,r,n){return{u_matrix_3f:e,u_sun_direction:t,u_sun_intensity:i,u_color_tint_r:[r.r,r.g,r.b,r.a],u_color_tint_m:[n.r,n.g,n.b,n.a],u_luminance:5e-5}}(e.fromMat4(e.create$1(),n),a,c,l,u);s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+o,i.skyboxTexture,0),r.draw(t,s.TRIANGLES,e.DepthMode.disabled,e.StencilMode.disabled,e.ColorMode.unblended,e.CullFaceMode.frontCW,h,"skyboxCapture",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}var Wr=e.createLayout([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),Xr=function(){function t(i){d(this,t);var r=new e.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 e.StructArrayLayout3ui6;n.emplaceBack(0,1,2),n.emplaceBack(2,3,0),this.vertexBuffer=i.createVertexBuffer(r,Wr.members),this.indexBuffer=i.createIndexBuffer(n),this.segments=e.SegmentVector.simpleSegment(0,0,4,2)}return p(t,[{key:"destroy",value:function(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}]),t}(),Hr={symbol:function(t,i,r,n,a){if("translucent"===t.renderPass){var o=e.StencilMode.disabled,s=t.colorModeForRenderPass();r.layout.get("text-variable-anchor")&&function(t,i,r,n,a,o,s){var l,u=i.transform,c="map"===a,h="map"===o,d=f(t);try{for(d.s();!(l=d.n()).done;){var p=l.value,v=n.getTile(p),m=v.getBucket(r);if(m&&m.text&&m.text.segments.get().length){var y=e.evaluateSizeForZoom(m.textSizeData,u.zoom),_=Lt(p,m.getProjection(),u),g=u.calculatePixelsToTileUnitsMatrix(v),x=vt(_,v.tileID.canonical,h,c,u,m.getProjection(),g),b="none"!==r.layout.get("icon-text-fit")&&m.hasIconData();if(y){var w=Math.pow(2,u.zoom-v.tileID.overscaledZ);Sr(m,c,h,s,e.symbolSize,u,x,p,w,y,b)}}}}catch(k){d.e(k)}finally{d.f()}}(n,t,r,i,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),a),0!==r.paint.get("icon-opacity").constantOr(1)&&Ar(t,i,r,n,!1,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),r.layout.get("icon-rotation-alignment"),r.layout.get("icon-pitch-alignment"),r.layout.get("icon-keep-upright"),o,s),0!==r.paint.get("text-opacity").constantOr(1)&&Ar(t,i,r,n,!0,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.layout.get("text-keep-upright"),o,s),i.map.showCollisionBoxes&&(kr(t,i,r,n,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),!0),kr(t,i,r,n,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),!1))}},circle:function(t,i,r,n){if("translucent"===t.renderPass){var a=r.paint.get("circle-opacity"),o=r.paint.get("circle-stroke-width"),s=r.paint.get("circle-stroke-opacity"),l=void 0!==r.layout.get("circle-sort-key").constantOr(1);if(0!==a.constantOr(1)||0!==o.constantOr(1)&&0!==s.constantOr(1)){for(var u=t.context,c=u.gl,h=t.transform,d=t.depthModeForSublayer(0,e.DepthMode.ReadOnly),p=e.StencilMode.disabled,v=t.colorModeForRenderPass(),m="globe"===h.projection.name,y=[e.mercatorXfromLng(h.center.lng),e.mercatorYfromLat(h.center.lat)],_=[],g=0;g<n.length;g++){var x=n[g],b=i.getTile(x),w=b.getBucket(r);if(w&&w.projection.name===h.projection.name){var k=w.programConfigurations.get(r.id),T=rr(r);m&&T.push("PROJECTION_GLOBE_VIEW");var E=t.useProgram("circle",k,T),S=w.layoutVertexBuffer,M=w.globeExtVertexBuffer,A=w.indexBuffer,I=h.projection.createInversionMatrix(h,x.canonical),C={programConfiguration:k,program:E,layoutVertexBuffer:S,globeExtVertexBuffer:M,indexBuffer:A,uniformValues:ir(t,x,b,I,y,r),tile:b};if(l){var z,P=w.segments.get(),D=f(P);try{for(D.s();!(z=D.n()).done;){var L=z.value;_.push({segments:new e.SegmentVector([L]),sortKey:L.sortKey,state:C})}}catch(H){D.e(H)}finally{D.f()}}else _.push({segments:w.segments,sortKey:0,state:C})}}l&&_.sort((function(e,t){return e.sortKey-t.sortKey}));for(var R={useDepthForOcclusion:!m},B=0,O=_;B<O.length;B++){var F=O[B],U=F.state,V=U.programConfiguration,N=U.program,j=U.layoutVertexBuffer,G=U.globeExtVertexBuffer,Z=U.indexBuffer,q=U.uniformValues,W=U.tile,X=F.segments;t.terrain&&t.terrain.setupElevationDraw(W,N,R),t.prepareDrawProgram(u,N,W.tileID.toUnwrapped()),N.draw(u,c.TRIANGLES,d,p,v,e.CullFaceMode.disabled,q,r.id,j,Z,X,r.paint,h.zoom,V,[G])}}}},heatmap:function(t,i,r,n){if(0!==r.paint.get("heatmap-opacity"))if("offscreen"===t.renderPass){var a=t.context,o=a.gl,s=e.StencilMode.disabled,l=new e.ColorMode([o.ONE,o.ONE],e.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=i.heatmapFbo;if(!s||s&&(s.width!==a||s.height!==o)){s&&s.destroy();var l=n.createTexture();n.bindTexture(n.TEXTURE_2D,l),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.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),s=i.heatmapFbo=e.createFramebuffer(a,o,!1),function(e,t,i,r,n,a){var o=e.gl;o.texImage2D(o.TEXTURE_2D,0,e.isWebGL2&&e.extRenderToTextureHalfFloat?o.RGBA16F:o.RGBA,n,a,0,o.RGBA,e.extRenderToTextureHalfFloat?e.isWebGL2?o.HALF_FLOAT:e.extTextureHalfFloat.HALF_FLOAT_OES:o.UNSIGNED_BYTE,null),r.colorAttachment.set(i)}(e,0,l,s,a,o)}else n.bindTexture(n.TEXTURE_2D,s.colorAttachment.get()),e.bindFramebuffer.set(s.framebuffer)}(a,t,r,"globe"===t.transform.projection.name?.5:.25),a.clear({color:e.Color.transparent});for(var u=t.transform,c="globe"===u.projection.name,h=c?["PROJECTION_GLOBE_VIEW"]:null,f=c?e.CullFaceMode.frontCCW:e.CullFaceMode.disabled,d=[e.mercatorXfromLng(u.center.lng),e.mercatorYfromLat(u.center.lat)],p=0;p<n.length;p++){var v=n[p];if(!i.hasRenderableParent(v)){var m=i.getTile(v),y=m.getBucket(r);if(y&&y.projection.name===u.projection.name){var _=y.programConfigurations.get(r.id),g=t.useProgram("heatmap",_,h),x=t.transform.zoom;t.terrain&&t.terrain.setupElevationDraw(m,g),t.prepareDrawProgram(a,g,v.toUnwrapped());var b=u.projection.createInversionMatrix(u,v.canonical);g.draw(a,o.TRIANGLES,e.DepthMode.disabled,s,l,f,sr(t,v,m,b,d,x,r.paint.get("heatmap-intensity")),r.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,r.paint,t.transform.zoom,_,c?[y.globeExtVertexBuffer]:null)}}}a.viewport.set([0,0,t.width,t.height])}else"translucent"===t.renderPass&&(t.context.setColorMode(t.colorModeForRenderPass()),function(t,i){var r=t.context,n=r.gl,a=i.heatmapFbo;if(a){r.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,a.colorAttachment.get()),r.activeTexture.set(n.TEXTURE1);var o=i.colorRampTexture;o||(o=i.colorRampTexture=new e.Texture(r,i.colorRamp,n.RGBA)),o.bind(n.LINEAR,n.CLAMP_TO_EDGE),t.useProgram("heatmapTexture").draw(r,n.TRIANGLES,e.DepthMode.disabled,e.StencilMode.disabled,t.colorModeForRenderPass(),e.CullFaceMode.disabled,function(e,t,i,r){return{u_image:0,u_color_ramp:1,u_opacity:t.paint.get("heatmap-opacity")}}(0,i),i.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments,i.paint,t.transform.zoom)}}(t,r))},line:function(t,i,r,n){if("translucent"===t.renderPass){var a=r.paint.get("line-opacity"),o=r.paint.get("line-width");if(0!==a.constantOr(1)&&0!==o.constantOr(1)){var s=t.depthModeForSublayer(0,e.DepthMode.ReadOnly),l=t.colorModeForRenderPass(),u=t.terrain&&t.terrain.renderingToTexture?1:e.exported.devicePixelRatio,c=r.paint.get("line-dasharray"),d=c.constantOr(1),p=r.layout.get("line-cap"),v=r.paint.get("line-pattern"),m=v.constantOr(1),y=r.paint.get("line-gradient"),_=m?"linePattern":"line",g=t.context,x=g.gl,b=function(e){var t=[];fr(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");t.terrain&&t.terrain.clipOrMaskOverlapStencilType()&&(w=!1);var k,T=f(n);try{var E=function(){var n=k.value,a=i.getTile(n);if(m&&!a.patternsLoaded())return"continue";var o=a.getBucket(r);if(!o)return"continue";t.prepareDrawTile();var f=o.programConfigurations.get(r.id),T=t.useProgram(_,f,b),E=v.constantOr(null);if(E&&a.imageAtlas){var S=a.imageAtlas.patternPositions[E.toString()];S&&f.setConstantPatternPositions(S)}var M=c.constantOr(null),A=p.constantOr(null);if(!m&&M&&A&&a.lineAtlas){var I=a.lineAtlas.getDash(M,A);I&&f.setConstantPatternPositions(I)}var C=r.paint.get("line-trim-offset"),z=h(C,2),P=z[0],D=z[1];if("round"===A||"square"===A){var L=1;P!==D&&(0===P&&(P-=L),1===D&&(D+=L))}var R=t.terrain?n.projMatrix:null,B=m?ur(t,a,r,R,u):lr(t,a,r,R,o.lineClipsArray.length,u,[P,D]);if(y){var O=o.gradients[r.id],F=O.texture;if(r.gradientVersion!==O.version){var U=256;if(r.stepInterpolant){var V=i.getSource().maxzoom,N=n.canonical.z===V?Math.ceil(1<<t.transform.maxZoom-n.canonical.z):1;U=e.clamp(e.nextPowerOfTwo(o.maxLineLength/e.EXTENT*1024*N),256,g.maxTextureSize)}O.gradient=e.renderColorRamp({expression:r.gradientExpression(),evaluationKey:"lineProgress",resolution:U,image:O.gradient||void 0,clips:o.lineClipsArray}),O.texture?O.texture.update(O.gradient):O.texture=new e.Texture(g,O.gradient,x.RGBA),O.version=r.gradientVersion,F=O.texture}g.activeTexture.set(x.TEXTURE1),F.bind(r.stepInterpolant?x.NEAREST:x.LINEAR,x.CLAMP_TO_EDGE)}d&&(g.activeTexture.set(x.TEXTURE0),a.lineAtlasTexture.bind(x.LINEAR,x.REPEAT),f.updatePaintBuffers()),m&&(g.activeTexture.set(x.TEXTURE0),a.imageAtlasTexture.bind(x.LINEAR,x.CLAMP_TO_EDGE),f.updatePaintBuffers()),t.prepareDrawProgram(g,T,n.toUnwrapped());var j=function(i){T.draw(g,x.TRIANGLES,s,i,l,e.CullFaceMode.disabled,B,r.id,o.layoutVertexBuffer,o.indexBuffer,o.segments,r.paint,t.transform.zoom,f,[o.layoutVertexBuffer2])};if(w){var G=t.stencilModeForClipping(n).ref;0===G&&t.terrain&&g.clear({stencil:0});var Z={func:x.EQUAL,mask:255};B.u_alpha_discard_threshold=.8,j(new e.StencilMode(Z,G,255,x.KEEP,x.KEEP,x.INVERT)),B.u_alpha_discard_threshold=0,j(new e.StencilMode(Z,G,255,x.KEEP,x.KEEP,x.KEEP))}else j(t.stencilModeForClipping(n))};for(T.s();!(k=T.n()).done;)E()}catch(S){T.e(S)}finally{T.f()}w&&(t.resetStencilClippingMasks(),t.terrain&&g.clear({stencil:0}))}}},fill:function(t,i,r,n){var a=r.paint.get("fill-color"),o=r.paint.get("fill-opacity");if(0!==o.constantOr(1)){var s=t.colorModeForRenderPass(),l=r.paint.get("fill-pattern"),u=t.opaquePassEnabledForLayer()&&!l.constantOr(1)&&1===a.constantOr(e.Color.transparent).a&&1===o.constantOr(0)?"opaque":"translucent";if(t.renderPass===u){var c=t.depthModeForSublayer(1,"opaque"===t.renderPass?e.DepthMode.ReadWrite:e.DepthMode.ReadOnly);Cr(t,i,r,n,c,s,!1)}if("translucent"===t.renderPass&&r.paint.get("fill-antialias")){var h=t.depthModeForSublayer(r.getPaintProperty("fill-outline-color")?2:0,e.DepthMode.ReadOnly);Cr(t,i,r,n,h,s,!0)}}},"fill-extrusion":function(t,i,r,n){var a=r.paint.get("fill-extrusion-opacity");if(0!==a&&"translucent"===t.renderPass){var o=new e.DepthMode(t.context.gl.LEQUAL,e.DepthMode.ReadWrite,t.depthRangeFor3D);if(1!==a||r.paint.get("fill-extrusion-pattern").constantOr(1))zr(t,i,r,n,o,e.StencilMode.disabled,e.ColorMode.disabled),zr(t,i,r,n,o,t.stencilModeFor3D(),t.colorModeForRenderPass()),t.resetStencilClippingMasks();else{var s=t.colorModeForRenderPass();zr(t,i,r,n,o,e.StencilMode.disabled,s)}}},hillshade:function(t,i,r,n){if("offscreen"===t.renderPass||"translucent"===t.renderPass){var a,o=t.context,s=t.depthModeForSublayer(0,e.DepthMode.ReadOnly),l=t.colorModeForRenderPass(),u=t.terrain&&t.terrain.renderingToTexture,c="translucent"!==t.renderPass||u?[{},n]:t.stencilConfigForOverlap(n),d=h(c,2),p=d[0],v=d[1],m=f(v);try{for(m.s();!(a=m.n()).done;){var y=a.value,_=i.getTile(y);if(_.needsHillshadePrepare&&"offscreen"===t.renderPass)zi(t,_,r,s,e.StencilMode.disabled,l);else if("translucent"===t.renderPass){var g=u&&t.terrain?t.terrain.stencilModeForRTTOverlap(y):p[y.overscaledZ];Ii(t,y,_,r,s,g,l)}}}catch(x){m.e(x)}finally{m.f()}o.viewport.set([0,0,t.width,t.height]),t.resetStencilClippingMasks()}},raster:function(t,i,r,n,a,o){if("translucent"===t.renderPass&&0!==r.paint.get("raster-opacity")&&n.length){var s,l=t.context,u=l.gl,c=i.getSource(),d=t.useProgram("raster"),p=t.colorModeForRenderPass(),v=t.terrain&&t.terrain.renderingToTexture,m=c instanceof Ze||v?[{},n]:t.stencilConfigForOverlap(n),y=h(m,2),_=y[0],g=y[1],x=g[g.length-1].overscaledZ,b=!t.options.moving,w=f(g);try{for(w.s();!(s=w.n()).done;){var k=s.value,T=v?e.DepthMode.disabled:t.depthModeForSublayer(k.overscaledZ-x,1===r.paint.get("raster-opacity")?e.DepthMode.ReadWrite:e.DepthMode.ReadOnly,u.LESS),E=k.toUnwrapped(),S=i.getTile(k);if(!v||S&&S.hasData()){var M=v?k.projMatrix:t.transform.calculateProjMatrix(E,b),A=t.terrain&&v?t.terrain.stencilModeForRTTOverlap(k):_[k.overscaledZ],I=o?0:r.paint.get("raster-fade-duration");S.registerFadeDuration(I);var C=i.findLoadedParent(k,0),z=Ni(S,C,i,t.transform,I),P=void 0,D=void 0;t.terrain&&t.terrain.prepareDrawTile();var L="nearest"===r.paint.get("raster-resampling")?u.NEAREST:u.LINEAR;l.activeTexture.set(u.TEXTURE0),S.texture.bind(L,u.CLAMP_TO_EDGE),l.activeTexture.set(u.TEXTURE1),C?(C.texture.bind(L,u.CLAMP_TO_EDGE),P=Math.pow(2,C.tileID.overscaledZ-S.tileID.overscaledZ),D=[S.tileID.canonical.x*P%1,S.tileID.canonical.y*P%1]):S.texture.bind(L,u.CLAMP_TO_EDGE),S.texture.useMipmap&&l.extTextureFilterAnisotropic&&t.transform.pitch>20&&u.texParameterf(u.TEXTURE_2D,l.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,l.extTextureFilterAnisotropicMax);var R=dr(M,D||[0,0],P||1,z,r,c instanceof Ze?c.perspectiveTransform:[0,0]);if(t.prepareDrawProgram(l,d,E),c instanceof Ze)c.boundsBuffer&&c.boundsSegments&&d.draw(l,u.TRIANGLES,T,e.StencilMode.disabled,p,e.CullFaceMode.disabled,R,r.id,c.boundsBuffer,t.quadTriangleIndexBuffer,c.boundsSegments);else{var B=t.getTileBoundsBuffers(S),O=B.tileBoundsBuffer,F=B.tileBoundsIndexBuffer,U=B.tileBoundsSegments;d.draw(l,u.TRIANGLES,T,A,p,e.CullFaceMode.disabled,R,r.id,O,F,U)}}}}catch(V){w.e(V)}finally{w.f()}t.resetStencilClippingMasks()}},background:function(t,i,r,n){var a=r.paint.get("background-color"),o=r.paint.get("background-opacity");if(0!==o){var s=t.context,l=s.gl,u=t.transform,c=u.tileSize,h=r.paint.get("background-pattern");if(!t.isPatternMissing(h)){var d=!h&&1===a.a&&1===o&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass===d){var p,v=e.StencilMode.disabled,m=t.depthModeForSublayer(0,"opaque"===d?e.DepthMode.ReadWrite:e.DepthMode.ReadOnly),y=t.colorModeForRenderPass(),_=t.useProgram(h?"backgroundPattern":"background"),g=n;g||(p=t.getBackgroundTiles(),g=Object.values(p).map((function(e){return e.tileID}))),h&&(s.activeTexture.set(l.TEXTURE0),t.imageManager.bind(t.context));var x,b=f(g);try{for(b.s();!(x=b.n()).done;){var w=x.value,k=w.toUnwrapped(),T=n?w.projMatrix:t.transform.calculateProjMatrix(k);t.prepareDrawTile();var E=i?i.getTile(w):p?p[w.key]:new e.Tile(w,c,u.zoom,t),S=h?br(T,o,t,h,{tileID:w,tileSize:c}):xr(T,o,a);t.prepareDrawProgram(s,_,k);var M=t.getTileBoundsBuffers(E),A=M.tileBoundsBuffer,I=M.tileBoundsIndexBuffer,C=M.tileBoundsSegments;_.draw(s,l.TRIANGLES,m,v,y,e.CullFaceMode.disabled,S,r.id,A,I,C)}}catch(z){b.e(z)}finally{b.f()}}}}},sky:function(t,i,r){var n=t.transform,a="mercator"===n.projection.name||"globe"===n.projection.name?1:e.smoothstep(7,8,n.zoom),o=r.paint.get("sky-opacity")*a;if(0!==o){var s=t.context,l=r.paint.get("sky-type"),u=new e.DepthMode(s.gl.LEQUAL,e.DepthMode.ReadOnly,[0,1]),c=t.frameCounter/1e3%1;"atmosphere"===l?"offscreen"===t.renderPass?r.needsSkyboxCapture(t)&&(function(t,i,r,n){var a=t.context,o=a.gl,s=i.skyboxFbo;if(!s){s=i.skyboxFbo=a.createFramebuffer(32,32,!1),i.skyboxGeometry=new Zr(a),i.skyboxTexture=a.gl.createTexture(),o.bindTexture(o.TEXTURE_CUBE_MAP,i.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=i.getCenter(t,!0),c=t.useProgram("skyboxCapture"),h=new Float64Array(16);e.identity(h),e.rotateY(h,h,.5*-Math.PI),qr(a,i,c,h,u,0),e.identity(h),e.rotateY(h,h,.5*Math.PI),qr(a,i,c,h,u,1),e.identity(h),e.rotateX(h,h,.5*-Math.PI),qr(a,i,c,h,u,2),e.identity(h),e.rotateX(h,h,.5*Math.PI),qr(a,i,c,h,u,3),e.identity(h),qr(a,i,c,h,u,4),e.identity(h),e.rotateY(h,h,Math.PI),qr(a,i,c,h,u,5),a.viewport.set([0,0,t.width,t.height])}(t,r),r.markSkyboxValid(t)):"sky"===t.renderPass&&function(t,i,r,n,a){var o=t.context,s=o.gl,l=t.transform,u=t.useProgram("skybox");o.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_CUBE_MAP,i.skyboxTexture);var c=function(e,t,i,r,n){return{u_matrix:e,u_sun_direction:t,u_cubemap:0,u_opacity:r,u_temporal_offset:n}}(l.skyboxMatrix,i.getCenter(t,!1),0,n,a);t.prepareDrawProgram(o,u),u.draw(o,s.TRIANGLES,r,e.StencilMode.disabled,t.colorModeForRenderPass(),e.CullFaceMode.backCW,c,"skybox",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}(t,r,u,o,c):"gradient"===l&&"sky"===t.renderPass&&function(t,i,r,n,a){var o=t.context,s=o.gl,l=t.transform,u=t.useProgram("skyboxGradient");i.skyboxGeometry||(i.skyboxGeometry=new Zr(o)),o.activeTexture.set(s.TEXTURE0);var c=i.colorRampTexture;c||(c=i.colorRampTexture=new e.Texture(o,i.colorRamp,s.RGBA)),c.bind(s.LINEAR,s.CLAMP_TO_EDGE);var h=function(t,i,r,n,a){return{u_matrix:t,u_color_ramp:0,u_center_direction:i,u_radius:e.degToRad(r),u_opacity:n,u_temporal_offset:a}}(l.skyboxMatrix,i.getCenter(t,!1),i.paint.get("sky-gradient-radius"),n,a);t.prepareDrawProgram(o,u),u.draw(o,s.TRIANGLES,r,e.StencilMode.disabled,t.colorModeForRenderPass(),e.CullFaceMode.backCW,h,"skyboxGradient",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}(t,r,u,o,c)}},debug:function(e,t,i){for(var r=0;r<i.length;r++)Fr(e,t,i[r])},custom:function(t,i,r,n){var a=t.context,o=r.implementation;if(!t.transform.projection.unsupportedLayers||!t.transform.projection.unsupportedLayers.includes("custom")||t.terrain&&(t.terrain.renderingToTexture||"offscreen"===t.renderPass)&&r.isLayerDraped()){if("offscreen"===t.renderPass){var s=o.prerender;if(s){if(t.setCustomLayerDefaults(),a.setColorMode(t.colorModeForRenderPass()),"globe"===t.transform.projection.name){var l=t.transform.pointMerc;s.call(o,a.gl,t.transform.customLayerMatrix(),t.transform.getProjection(),t.transform.globeToMercatorMatrix(),e.globeToMercatorTransition(t.transform.zoom),[l.x,l.y],t.transform.pixelsPerMeterRatio)}else s.call(o,a.gl,t.transform.customLayerMatrix());a.setDirty(),t.setBaseState()}}else if("translucent"===t.renderPass){if(t.terrain&&t.terrain.renderingToTexture){var u=o.renderToTile;if(u){var c=n[0].canonical,h=new e.MercatorCoordinate(c.x+n[0].wrap*(1<<c.z),c.y,c.z);a.setDepthMode(e.DepthMode.disabled),a.setStencilMode(e.StencilMode.disabled),a.setColorMode(t.colorModeForRenderPass()),t.setCustomLayerDefaults(),u.call(o,a.gl,h),a.setDirty(),t.setBaseState()}return}t.setCustomLayerDefaults(),a.setColorMode(t.colorModeForRenderPass()),a.setStencilMode(e.StencilMode.disabled);var f="3d"===o.renderingMode?new e.DepthMode(t.context.gl.LEQUAL,e.DepthMode.ReadWrite,t.depthRangeFor3D):t.depthModeForSublayer(0,e.DepthMode.ReadOnly);if(a.setDepthMode(f),"globe"===t.transform.projection.name){var d=t.transform.pointMerc;o.render(a.gl,t.transform.customLayerMatrix(),t.transform.getProjection(),t.transform.globeToMercatorMatrix(),e.globeToMercatorTransition(t.transform.zoom),[d.x,d.y],t.transform.pixelsPerMeterRatio)}else o.render(a.gl,t.transform.customLayerMatrix());a.setDirty(),t.setBaseState(),a.bindFramebuffer.set(null)}}else e.warnOnce("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")}},Yr=function(){function t(i,r){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];d(this,t),this.context=new Ve(i,n),this.transform=r,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.setup(),this.numSublayers=e.SourceCache.maxUnderzooming+e.SourceCache.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new oi,this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={}}return p(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=t.getFovAdjustedRange(this.transform._fov),r=h(i,2),n=r[0],a=r[1];if(n>a)this.transform.fogCullDistSq=null;else{var o=n+.78*(a-n);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(t,i){if(this.width=t*e.exported.devicePixelRatio,this.height=i*e.exported.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style){var r,n=f(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 t=this.context,i=new e.StructArrayLayout2i4;i.emplaceBack(0,0),i.emplaceBack(e.EXTENT,0),i.emplaceBack(0,e.EXTENT),i.emplaceBack(e.EXTENT,e.EXTENT),this.tileExtentBuffer=t.createVertexBuffer(i,e.posAttributes.members),this.tileExtentSegments=e.SegmentVector.simpleSegment(0,0,4,2);var r=new e.StructArrayLayout2i4;r.emplaceBack(0,0),r.emplaceBack(e.EXTENT,0),r.emplaceBack(0,e.EXTENT),r.emplaceBack(e.EXTENT,e.EXTENT),this.debugBuffer=t.createVertexBuffer(r,e.posAttributes.members),this.debugSegments=e.SegmentVector.simpleSegment(0,0,4,5);var n=new e.StructArrayLayout2i4;n.emplaceBack(-1,-1),n.emplaceBack(1,-1),n.emplaceBack(-1,1),n.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(n,e.posAttributes.members),this.viewportSegments=e.SegmentVector.simpleSegment(0,0,4,2);var a=new e.StructArrayLayout4i8;a.emplaceBack(0,0,0,0),a.emplaceBack(e.EXTENT,0,e.EXTENT,0),a.emplaceBack(0,e.EXTENT,0,e.EXTENT),a.emplaceBack(e.EXTENT,e.EXTENT,e.EXTENT,e.EXTENT),this.mercatorBoundsBuffer=t.createVertexBuffer(a,e.boundsAttributes.members),this.mercatorBoundsSegments=e.SegmentVector.simpleSegment(0,0,4,2);var o=new e.StructArrayLayout3ui6;o.emplaceBack(0,1,2),o.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(o);for(var s=new e.StructArrayLayout1ui2,l=0,u=[0,1,3,2,0];l<u.length;l++){var c=u[l];s.emplaceBack(c)}this.debugIndexBuffer=t.createIndexBuffer(s),this.emptyTexture=new e.Texture(t,new e.RGBAImage({width:1,height:1},Uint8Array.of(0,0,0,0)),t.gl.RGBA),this.identityMat=e.create();var h=this.context.gl;this.stencilClearMode=new e.StencilMode({func:h.ALWAYS,mask:0},0,255,h.ZERO,h.ZERO,h.ZERO),this.loadTimeStamps.push(e.window.performance.now()),this.atmosphereBuffer=new Xr(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 t=this.context,i=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.useProgram("clippingMask").draw(t,i.TRIANGLES,e.DepthMode.disabled,this.stencilClearMode,e.ColorMode.disabled,e.CullFaceMode.disabled,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(t,i,r){if(i&&this.currentStencilSource!==i.id&&t.isTileClipped()&&r&&0!==r.length){if(this._tileClippingMaskIDs&&!this.terrain){var n,a=!1,o=f(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=i.id;var l=this.context,u=l.gl;this.nextStencilID+r.length>256&&this.clearStencil(),l.setColorMode(e.ColorMode.disabled),l.setDepthMode(e.DepthMode.disabled);var c=this.useProgram("clippingMask");this._tileClippingMaskIDs={};var h,d=f(r);try{for(d.s();!(h=d.n()).done;){var p=h.value,v=i.getTile(p),m=this._tileClippingMaskIDs[p.key]=this.nextStencilID++,y=this.getTileBoundsBuffers(v),_=y.tileBoundsBuffer,g=y.tileBoundsIndexBuffer,x=y.tileBoundsSegments;c.draw(l,u.TRIANGLES,e.DepthMode.disabled,new e.StencilMode({func:u.ALWAYS,mask:0},m,255,u.KEEP,u.KEEP,u.REPLACE),e.ColorMode.disabled,e.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 t=this.nextStencilID++,i=this.context.gl;return new e.StencilMode({func:i.NOTEQUAL,mask:255},t,255,i.KEEP,i.KEEP,i.REPLACE)}},{key:"stencilModeForClipping",value:function(t){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(t);var i=this.context.gl;return new e.StencilMode({func:i.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,i.KEEP,i.KEEP,i.REPLACE)}},{key:"stencilConfigForOverlap",value:function(t){var i=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 e.StencilMode({func:i.GEQUAL,mask:255},l+this.nextStencilID,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID+=o,[s,n]}return[r({},a,e.StencilMode.disabled),n]}},{key:"colorModeForRenderPass",value:function(){var t=this.context.gl;if(this._showOverdrawInspector){var i=1/8;return new e.ColorMode([t.CONSTANT_COLOR,t.ONE],new e.Color(i,i,i,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?e.ColorMode.unblended:e.ColorMode.alphaBlended}},{key:"depthModeForSublayer",value:function(t,i,r){if(!this.opaquePassEnabledForLayer())return e.DepthMode.disabled;var n=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new e.DepthMode(r||this.context.gl.LEQUAL,i,[n,n])}},{key:"opaquePassEnabledForLayer",value:function(){return this.currentLayer<this.opaquePassCutoff}},{key:"render",value:function(t,i){var r=this;this.style=t,this.options=i,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(e.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 l={},u={},c={};for(var h in a){var d=a[h];l[h]=d.getVisibleCoordinates(),u[h]=l[h].slice().reverse(),c[h]=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(c),this.opaquePassCutoff=0),"globe"!==this.transform.projection.name||this.globeSharedBuffers||(this.globeSharedBuffers=new e.GlobeSharedBuffers(this.context)),e.isMapAuthenticated(this.context.gl)){this.renderPass="offscreen";var v,m=f(n);try{for(m.s();!(v=m.n()).done;){var y=v.value,_=this.style._layers[y],g=t._getLayerSourceCache(_);if(_.hasOffscreenPass()&&!_.isHidden(this.transform.zoom)){var x=g?u[g.id]:void 0;("custom"===_.type||_.isSky()||x&&x.length)&&this.renderLayer(this,g,_,x)}}}catch(z){m.e(z)}finally{m.f()}this.depthRangeFor3D=[0,1-(t.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:i.showOverdrawInspector?e.Color.black:e.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=i.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=t._getLayerSourceCache(w);if(!w.isSky()){var T=k?u[k.id]:void 0;this._renderTileClippingMasks(w,k,T),this.renderLayer(this,k,w,T)}}if(this.style.fog&&this.transform.projection.supportsFog&&function(t,i){var r=t.context,n=r.gl,a=t.transform,o=new e.DepthMode(n.LEQUAL,e.DepthMode.ReadOnly,[0,1]),s=t.useProgram("globeAtmosphere",null,"globe"===a.projection.name?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"]),l=e.globeToMercatorTransition(a.zoom),u=i.properties.get("color").toArray01(),c=i.properties.get("high-color").toArray01(),h=i.properties.get("space-color").toArray01PremultipliedAlpha(),f=e.identity$1([]);e.rotateY$1(f,f,-e.degToRad(a._center.lng)),e.rotateX$1(f,f,e.degToRad(a._center.lat)),e.rotateZ$1(f,f,a.angle),e.rotateX$1(f,f,-a._pitch);var d=e.fromQuat(new Float32Array(16),f),p=e.mapValue(i.properties.get("star-intensity"),0,1,0,.25),v=5e-4,m=e.mapValue(i.properties.get("horizon-blend"),0,1,v,.25),y=e.globeUseCustomAntiAliasing(t,r,a)&&m===v?a.worldSize/(2*Math.PI*1.025)-1:a.globeRadius,_=t.frameCounter/1e3%1,g=e.length(a.globeCenterInViewSpace),x=Math.sqrt(Math.pow(g,2)-Math.pow(y,2)),b=Math.acos(x/g),w=function(t,i,r,n,a,o,s,l,u,c,h,f,d,p){return{u_frustum_tl:t,u_frustum_tr:i,u_frustum_br:r,u_frustum_bl:n,u_horizon:a,u_transition:o,u_fadeout_range:s,u_color:l,u_high_color:u,u_space_color:c,u_star_intensity:h,u_star_size:5*e.exported.devicePixelRatio,u_star_density:0,u_temporal_offset:f,u_horizon_angle:d,u_rotation_matrix:p}}(a.frustumCorners.TL,a.frustumCorners.TR,a.frustumCorners.BR,a.frustumCorners.BL,a.frustumCorners.horizon,l,m,u,c,h,p,_,b,d);t.prepareDrawProgram(r,s);var k=t.atmosphereBuffer;k&&s.draw(r,n.TRIANGLES,o,e.StencilMode.disabled,e.ColorMode.alphaBlended,e.CullFaceMode.backCW,w,"skybox",k.vertexBuffer,k.indexBuffer,k.segments)}(this,this.style.fog),this.renderPass="sky",(e.globeToMercatorTransition(this.transform.zoom)>0||"globe"!==this.transform.projection.name)&&this.transform.isHorizonVisible())for(this.currentLayer=0;this.currentLayer<n.length;this.currentLayer++){var E=this.style._layers[n[this.currentLayer]],S=t._getLayerSourceCache(E);E.isSky()&&this.renderLayer(this,S,E,S?u[S.id]:void 0)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<n.length;){var M=this.style._layers[n[this.currentLayer]],A=t._getLayerSourceCache(M);if(M.isSky())++this.currentLayer;else if(this.terrain&&this.style.isLayerDraped(M)){if(M.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer)}else{var I=A?("symbol"===M.type?c:u)[A.id]:void 0;this._renderTileClippingMasks(M,A,A?l[A.id]:void 0),this.renderLayer(this,A,M,I),++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){var C=null;e.values(this.style._layers).forEach((function(e){var i=t._getLayerSourceCache(e);i&&!e.isHidden(r.transform.zoom)&&(!C||C.getSource().maxzoom<i.getSource().maxzoom)&&(C=i)})),C&&this.options.showTileBoundaries&&Hr.debug(this,C,C.getVisibleCoordinates())}this.options.showPadding&&function(e){var t=e.transform.padding;Ur(e,e.transform.height-(t.top||0),3,Dr),Ur(e,t.bottom||0,3,Lr),Vr(e,t.left||0,3,Rr),Vr(e,e.transform.width-(t.right||0),3,Br);var i=e.transform.centerPoint;!function(e,t,i,r){Nr(e,t-1,i-10,2,20,r),Nr(e,t-10,i-1,20,2,r)}(e,i.x,e.transform.height-i.y,Or)}(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(e.window.performance.now()),this.saveCanvasCopy())}}},{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)&&Hr[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=f(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(t,i,r,n,a){if(!r[0]&&!r[1])return t;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(i,r[0],this.transform.zoom),a?r[1]:W(i,r[1],this.transform.zoom),0],c=new Float32Array(16);return e.translate(c,t,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,wr[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=e.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new e.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}},{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(t,i,r){if(!this.terrain||!this.terrain.renderingToTexture){var n=this.style.fog;if(n){var a=n.getOpacity(this.transform.pitch),o=function(t,i,r,n,a,o,s,l,u,c,h){var f=t.transform,d=i.properties.get("color").toArray01();d[3]=n;var p=t.frameCounter/1e3%1;return{u_fog_matrix:r?f.calculateFogTileMatrix(r):t.identityMat,u_fog_range:i.getFovAdjustedRange(f._fov),u_fog_color:d,u_fog_horizon_blend:i.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:e.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*e.exported.devicePixelRatio,this.transform.height*e.exported.devicePixelRatio]);i.setFogUniformValues(t,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)}},{key:"getBackgroundTiles",value:function(){var t,i=this._backgroundTiles,r=this._backgroundTiles={},n=this.transform.coveringTiles({tileSize:512}),a=f(n);try{for(a.s();!(t=a.n()).done;){var o=t.value;r[o.key]=i[o.key]||new e.Tile(o,512,this.transform.tileZoom,this)}}catch(s){a.e(s)}finally{a.f()}return r}},{key:"clearBackgroundTiles",value:function(){this._backgroundTiles={}}}]),t}(),Kr=function(){function t(){var e=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(d(this,t),isNaN(e)||e<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=e,this.bottom=i,this.left=r,this.right=n}return p(t,[{key:"interpolate",value:function(t,i,r){return null!=i.top&&null!=t.top&&(this.top=e.number(t.top,i.top,r)),null!=i.bottom&&null!=t.bottom&&(this.bottom=e.number(t.bottom,i.bottom,r)),null!=i.left&&null!=t.left&&(this.left=e.number(t.left,i.left,r)),null!=i.right&&null!=t.right&&(this.right=e.number(t.right,i.right,r)),this}},{key:"getCenter",value:function(t,i){var r=e.clamp((this.left+t-this.right)/2,0,t),n=e.clamp((this.top+i-this.bottom)/2,0,i);return new e.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 t(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}}}]),t}();function Jr(t,i){var r=e.getColumn(t,3);e.fromQuat(t,i),e.setColumn(t,3,r)}function $r(t,i){var r=e.identity$1([]);return e.rotateZ$1(r,r,-i),e.rotateX$1(r,r,-t),r}function Qr(t,i){var r=[t[0],t[1],0],n=[i[0],i[1],0];if(e.length(r)>=1e-15){var a=e.normalize([],r);e.scale$2(n,a,e.dot(n,a)),i[0]=n[0],i[1]=n[1]}var o=e.cross([],i,t);if(e.len(o)<1e-15)return null;var s=Math.atan2(-o[1],o[0]);return $r(Math.atan2(Math.sqrt(t[0]*t[0]+t[1]*t[1]),-t[2]),s)}var en=function(){function t(e,i){d(this,t),this.position=e,this.orientation=i}return p(t,[{key:"position",get:function(){return this._position},set:function(t){if(t){var i=t instanceof e.MercatorCoordinate?t:new e.MercatorCoordinate(t[0],t[1],t[2]);this._renderWorldCopies&&(i.x=e.wrap(i.x,0,1)),this._position=i}else this._position=null}},{key:"lookAtPoint",value:function(t,i){if(this.orientation=null,this.position){var r=this.position,n=this._elevation?this._elevation.getAtPointOrZero(e.MercatorCoordinate.fromLngLat(t)):0,a=e.MercatorCoordinate.fromLngLat(t,n),o=[a.x-r.x,a.y-r.y,a.z-r.z];i||(i=[0,0,1]),i[2]=Math.abs(i[2]),this.orientation=Qr(o,i)}}},{key:"setPitchBearing",value:function(t,i){this.orientation=$r(e.degToRad(t),e.degToRad(-i))}}]),t}(),tn=function(){function t(i,r){d(this,t),this._transform=e.identity([]),this.orientation=r,this.position=i}return p(t,[{key:"mercatorPosition",get:function(){var t=this.position;return new e.MercatorCoordinate(t[0],t[1],t[2])}},{key:"position",get:function(){var t=e.getColumn(this._transform,3);return[t[0],t[1],t[2]]},set:function(t){var i;t&&e.setColumn(this._transform,3,[(i=t)[0],i[1],i[2],1])}},{key:"orientation",get:function(){return this._orientation},set:function(t){this._orientation=t||e.identity$1([]),t&&Jr(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=$r(e,t),Jr(this._transform,this._orientation)}},{key:"forward",value:function(){var t=e.getColumn(this._transform,2);return[-t[0],-t[1],-t[2]]}},{key:"up",value:function(){var t=e.getColumn(this._transform,1);return[-t[0],-t[1],-t[2]]}},{key:"right",value:function(){var t=e.getColumn(this._transform,0);return[t[0],t[1],t[2]]}},{key:"getCameraToWorld",value:function(t,i){var r=new Float64Array(16);return e.invert(r,this.getWorldToCamera(t,i)),r}},{key:"getWorldToCameraPosition",value:function(t,i,r){var n=this.position;e.scale$2(n,n,-t);var a=new Float64Array(16);return e.fromScaling(a,[r,r,r]),e.translate(a,a,n),a[10]*=i,a}},{key:"getWorldToCamera",value:function(t,i){var r=new Float64Array(16),n=new Float64Array(4),a=this.position;return e.conjugate(n,this._orientation),e.scale$2(a,a,-t),e.fromQuat(r,n),e.translate(r,r,a),r[1]*=-1,r[5]*=-1,r[9]*=-1,r[13]*=-1,r[8]*=i,r[9]*=i,r[10]*=i,r[11]*=i,r}},{key:"getCameraToClipPerspective",value:function(t,i,r,n){var a=new Float64Array(16);return e.perspective(a,t,i,r,n),a}},{key:"getDistanceToElevation",value:function(t){var i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=0===t?0:e.mercatorZfromAltitude(t,i?e.latFromMercatorY(this.position[1]):this.position[1]),n=this.forward();return(r-this.position[2])/n[2]}},{key:"clone",value:function(){return new t(c(this.position),c(this.orientation))}}]),t}();function rn(t,i){var r=an(t.projection,t.zoom,t.width,t.height),n=function(t,i,r,n,a){var o=new e.LngLat(r.lng-180*on,r.lat),s=new e.LngLat(r.lng+180*on,r.lat),l=t.project(o.lng,o.lat),u=t.project(s.lng,s.lat),c=-Math.atan2(u.y-l.y,u.x-l.x),h=e.MercatorCoordinate.fromLngLat(r);h.y=e.clamp(h.y,-.999975,.999975);var f=h.toLngLat(),d=t.project(f.lng,f.lat),p=e.MercatorCoordinate.fromLngLat(f);p.x+=on;var v=p.toLngLat(),m=t.project(v.lng,v.lat),y=ln(m.x-d.x,m.y-d.y,c),_=e.MercatorCoordinate.fromLngLat(f);_.y+=on;var g=_.toLngLat(),x=t.project(g.lng,g.lat),b=ln(x.x-d.x,x.y-d.y,c),w=Math.abs(y.x)/Math.abs(b.y),k=e.identity([]);e.rotateZ(k,k,-c*(1-(a?0:n)));var T=e.identity([]);return e.scale(T,T,[1,1-(1-w)*n,1]),T[4]=-b.x/b.y*n,e.rotateZ(T,T,c),e.multiply(T,k,T),T}(t.projection,0,t.center,r,i),a=nn(t);return e.scale(n,n,[a,a,1]),n}function nn(t){var i=t.projection,r=an(t.projection,t.zoom,t.width,t.height),n=sn(i,t.center),a=sn(i,e.LngLat.convert(i.center));return Math.pow(2,n*r+(1-r)*a)}function an(t,i,r,n){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1/0,o=t.range;if(!o)return 0;var s=Math.min(a,Math.max(r,n)),l=Math.log(s/1024)/Math.LN2;return e.smoothstep(o[0]+l,o[1]+l,i)}var on=1/4e4;function sn(t,i){var r=e.clamp(i.lat,-e.MAX_MERCATOR_LATITUDE,e.MAX_MERCATOR_LATITUDE),n=new e.LngLat(i.lng-180*on,r),a=new e.LngLat(i.lng+180*on,r),o=t.project(n.lng,r),s=t.project(a.lng,r),l=e.MercatorCoordinate.fromLngLat(n),u=e.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+d*d)/(c*c+h*h));return Math.log(p)/Math.LN2}function ln(e,t,i){var r=Math.cos(i),n=Math.sin(i);return{x:e*r-t*n,y:e*n+t*r}}var un=function(){function i(t,r,n,a,o,s,l){d(this,i),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 e.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new Kr,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._distanceTileDataCache={},this._camera=new tn,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._horizonShift=.1}return p(i,[{key:"clone",value:function(){var e=new i(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection());return e._elevation=this._elevation,e._centerAltitude=this._centerAltitude,e._centerAltitudeValidForExaggeration=this._centerAltitudeValidForExaggeration,e.tileSize=this.tileSize,e.mercatorFromTransition=this.mercatorFromTransition,e.width=this.width,e.height=this.height,e.cameraElevationReference=this.cameraElevationReference,e._center=this._center,e._setZoom(this.zoom),e._seaLevelZoom=this._seaLevelZoom,e.angle=this.angle,e._fov=this._fov,e._pitch=this._pitch,e._nearZ=this._nearZ,e._farZ=this._farZ,e._averageElevation=this._averageElevation,e._unmodified=this._unmodified,e._edgeInsets=this._edgeInsets.clone(),e._camera=this._camera.clone(),e._calcMatrices(),e.freezeTileCoverage=this.freezeTileCoverage,e.frustumCorners=this.frustumCorners,e}},{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 e.pick(this.projection,["name","center","parallels"])}},{key:"setProjection",value:function(i){this.projectionOptions=i||{name:"mercator"};var r=this.projection?this.getProjection():void 0;this.projection=e.getProjection(this.projectionOptions);var n=!t(r,this.getProjection());return n&&this._calcMatrices(),this.mercatorFromTransition=!1,n}},{key:"setMercatorFromTransition",value:function(){var t=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=e.getProjection({name:"mercator"});var i=t!==this.projection.name;return i&&this._calcMatrices(),i}},{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 e.mercatorZfromAltitude(this.center.lat,this.cameraWorldSizeForFog)}},{key:"centerOffset",get:function(){return this.centerPoint._sub(this.size._div(2))}},{key:"size",get:function(){return new e.pointGeometry(this.width,this.height)}},{key:"bearing",get:function(){return e.wrap(this.rotation,-180,180)},set:function(e){this.rotation=e}},{key:"rotation",get:function(){return-this.angle/Math.PI*180},set:function(t){var i,r=-t*Math.PI/180;this.angle!==r&&(this._unmodified=!1,this.angle=r,this._calcMatrices(),this.rotationMatrix=(i=new e.ARRAY_TYPE(4),e.ARRAY_TYPE!=Float32Array&&(i[1]=0,i[2]=0),i[0]=1,i[3]=1,i),function(e,t,i){var r=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(i),l=Math.cos(i);e[0]=r*l+a*s,e[1]=n*l+o*s,e[2]=r*-s+a*l,e[3]=n*-s+o*l}(this.rotationMatrix,this.rotationMatrix,this.angle))}},{key:"pitch",get:function(){return this._pitch/Math.PI*180},set:function(t){var i=e.clamp(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==i&&(this._unmodified=!1,this._pitch=i,this._calcMatrices())}},{key:"aspect",get:function(){return this.width/this.height}},{key:"fov",get:function(){return this._fov/Math.PI*180},set:function(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=e.degToRad(t),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._centerAltitudeValidForExaggeration=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 t=this._elevation,i=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],r=this.horizonLineFromTop(),n=0,a=0,o=0;o<i.length;o++){var s=new e.pointGeometry(i[o][0]*this.width,r+i[o][1]*(this.height-r)),l=t.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(t){var i,r=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,t.toAltitude()));i=t.z<this._camera.position[2]?[r.x,r.y,r.z]:[t.x,t.y,t.z];var n=e.length(e.sub([],this._camera.position,i));return e.clamp(this._zoomFromMercatorZ(n),this._minZoom,this._maxZoom)}},{key:"setFreeCameraOptions",value:function(t){if(this.height&&(t.position||t.orientation)){this._updateCameraState();var i=!1;if(t.orientation&&!e.exactEquals(t.orientation,this._camera.orientation)&&(i=this._setCameraOrientation(t.orientation)),t.position){var r=[t.position.x,t.position.y,t.position.z];e.exactEquals$1(r,this._camera.position)||(this._setCameraPosition(r),i=!0)}i&&(this._updateStateFromCamera(),this.recenterOnTerrain())}}},{key:"getFreeCameraOptions",value:function(){this._updateCameraState();var t=this._camera.position,i=new en;return i.position=new e.MercatorCoordinate(t[0],t[1],t[2]),i.orientation=this._camera.orientation,i._elevation=this.elevation,i._renderWorldCopies=this.renderWorldCopies,i}},{key:"_setCameraOrientation",value:function(t){if(!e.length$1(t))return!1;e.normalize$1(t,t);var i=e.transformQuat([],[0,0,-1],t),r=e.transformQuat([],[0,-1,0],t);if(r[2]<0)return!1;var n=Qr(i,r);return!!n&&(this._camera.orientation=n,!0)}},{key:"_setCameraPosition",value:function(t){var i=this.zoomScale(this.minZoom)*this.tileSize,r=this.zoomScale(this.maxZoom)*this.tileSize,n=this.cameraToCenterDistance;t[2]=e.clamp(t[2],n/r,n/i),this._camera.position=t}},{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(t){var i=[new e.UnwrappedTileID(0,t)];if(this.renderWorldCopies)for(var r=this.pointCoordinate(new e.pointGeometry(0,0)),n=this.pointCoordinate(new e.pointGeometry(this.width,0)),a=this.pointCoordinate(new e.pointGeometry(this.width,this.height)),o=this.pointCoordinate(new e.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=1,c=s-u;c<=l+u;c++)0!==c&&i.push(new e.UnwrappedTileID(c,t));return i}},{key:"coveringTiles",value:function(t){var i=this,r=this.coveringZoomLevel(t),n=r,a=this.elevation&&!t.isTerrainDEM,o="mercator"===this.projection.name;if(void 0!==t.minzoom&&r<t.minzoom)return[];void 0!==t.maxzoom&&r>t.maxzoom&&(r=t.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=e.Frustum.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,r,f),p=h?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),v=u*e.mercatorZfromAltitude(1,this.center.lat),m=this._camera.position[2]/e.mercatorZfromAltitude(1,this.center.lat),y=[u*p.x,u*p.y,m*(f?1:v)],_=this.cameraToCenterDistance/t.tileSize*(t.roundZoom?1:.502),g=this.pitch<=60&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace?r:0,x=t.isTerrainDEM&&this._elevation?1e4*this._elevation.exaggeration():this._centerAltitude,b=t.isTerrainDEM?-x:this._elevation?this._elevation.getMinElevationBelowMSL():0,w=this.projection.isReprojectedInTileSpace?nn(this):1,k=function(t){var r=1/4e4,n=new e.MercatorCoordinate(t.x+r,t.y,t.z),a=new e.MercatorCoordinate(t.x,t.y+r,t.z),o=t.toLngLat(),s=n.toLngLat(),l=a.toLngLat(),u=i.locationCoordinate(o),c=i.locationCoordinate(s),h=i.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},T=function(t){var r=x,n=b;return{aabb:e.tileAABB(i,u,0,0,0,t,n,r,i.projection),zoom:0,x:0,y:0,minZ:n,maxZ:r,wrap:t,fullyVisible:!1}},E=[],S=[],M=r,A=t.reparseOverscaled?n:r,I=function(e){return e*e},C=I((m-this._centerAltitude)*v),z=function(e){if(i._elevation&&e.tileID&&o){var t=i._elevation.getMinMaxForTile(e.tileID),r=e.aabb;t?(r.min[2]=t.min,r.max[2]=t.max,r.center[2]=(r.min[2]+r.max[2])/2):(e.shouldSplit=P(e),e.shouldSplit||(r.min[2]=r.max[2]=r.center[2]=i._centerAltitude))}},P=function(t){if(t.zoom<g)return!0;if(t.zoom===M)return!1;if(null!=t.shouldSplit)return t.shouldSplit;var r=t.aabb.distanceX(y),o=t.aabb.distanceY(y),s=C,u=1;if(h){s=I(t.aabb.distanceZ(y));var c=Math.pow(2,t.zoom),f=e.latFromMercatorY((t.y+1)/c),d=e.latFromMercatorY(t.y/c),p=Math.min(Math.max(l,f),d),m=e.circumferenceAtLatitude(p)/e.circumferenceAtLatitude(l);if(u=p===l?1/Math.max(1,i._mercatorScaleRatio-.3):Math.min(1,m/i._mercatorScaleRatio),i.zoom<=e.GLOBE_ZOOM_THRESHOLD_MIN&&t.zoom===M-1&&m>=.9)return!0}else if(a&&(s=I(t.aabb.distanceZ(y)*v)),i.projection.isReprojectedInTileSpace&&n<=5){var x=Math.pow(2,t.zoom),b=k(new e.MercatorCoordinate((t.x+.5)/x,(t.y+.5)/x));u=b>.85?1:b}var w=r*r+o*o+s,T=I((1<<M-t.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),w));return w<T};if(this.renderWorldCopies)for(var D=1;D<=3;D++)E.push(T(-D)),E.push(T(D));for(E.push(T(0));E.length>0;){var L=E.pop(),R=L.x,B=L.y,O=L.fullyVisible;if(!O){var F=L.aabb.intersects(d);if(0===F)continue;O=2===F}if(L.zoom!==M&&P(L))for(var U=0;U<4;U++){var V=(R<<1)+U%2,N=(B<<1)+(U>>1),j={aabb:o?L.aabb.quadrant(U):e.tileAABB(this,u,L.zoom+1,V,N,L.wrap,L.minZ,L.maxZ,this.projection),zoom:L.zoom+1,x:V,y:N,wrap:L.wrap,fullyVisible:O,tileID:void 0,shouldSplit:void 0,minZ:L.minZ,maxZ:L.maxZ};a&&!h&&(j.tileID=new e.OverscaledTileID(L.zoom+1===M?A:L.zoom+1,L.wrap,L.zoom+1,V,N),z(j)),E.push(j)}else{var G=L.zoom===M?A:L.zoom;if(t.minzoom&&t.minzoom>G)continue;var Z=c[0]-(.5+R+(L.wrap<<L.zoom))*(1<<r-L.zoom),q=c[1]-.5-B,W=L.tileID?L.tileID:new e.OverscaledTileID(G,L.wrap,L.zoom,R,B);S.push({tileID:W,distanceSq:Z*Z+q*q})}}if(this.fogCullDistSq){var X=this.fogCullDistSq,H=this.horizonLineFromTop();S=S.filter((function(r){var n=[0,0,0,1],a=[e.EXTENT,e.EXTENT,0,1],o=i.calculateFogTileMatrix(r.tileID.toUnwrapped());e.transformMat4$1(n,n,o),e.transformMat4$1(a,a,o);var s=e.getAABBPointSquareDist(n,a);if(0===s)return!0;var l=!1,u=i._elevation;if(u&&s>X&&0!==H){var c,h=i.calculateProjMatrix(r.tileID.toUnwrapped());t.isTerrainDEM||(c=u.getMinMaxForTile(r.tileID)),c||(c={min:b,max:x});var f=e.furthestTileCorner(i.rotation),d=[f[0]*e.EXTENT,f[1]*e.EXTENT,c.max];e.transformMat4(d,d,h),l=(1-d[1])*i.height*.5<H}return s<X||l}))}return S.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(t){var i=e.clamp(t.lat,-e.MAX_MERCATOR_LATITUDE,e.MAX_MERCATOR_LATITUDE),r=this.projection.project(t.lng,i);return new e.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/e.mercatorZfromAltitude(1,this.center.lat)/this.worldSize}},{key:"setLocationAtPoint",value:function(t,i){var r,n,a=this.centerPoint;if("globe"===this.projection.name){var o=this.worldSize;r=(i.x-a.x)/o,n=(i.y-a.y)/o}else{var s=this.pointCoordinate(i),l=this.pointCoordinate(a);r=s.x-l.x,n=s.y-l.y}var u=this.locationCoordinate(t);this.setLocation(new e.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(t,i){var r=i?e.mercatorZfromAltitude(i,t.lat):void 0,n=this.projection.project(t.lng,t.lat);return new e.MercatorCoordinate(n.x,n.y,r)}},{key:"coordinateLocation",value:function(e){return this.projection.unproject(e.x,e.y)}},{key:"pointRayIntersection",value:function(t,i){var r=null!=i?i:this._centerAltitude,n=[t.x,t.y,0,1],a=[t.x,t.y,1,1];e.transformMat4$1(n,n,this.pixelMatrixInverse),e.transformMat4$1(a,a,this.pixelMatrixInverse);var o=a[3];e.scale$1(n,n,1/n[3]),e.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(t){var i=[t.x,t.y,0,1],r=[t.x,t.y,1,1];return e.transformMat4$1(i,i,this.pixelMatrixInverse),e.transformMat4$1(r,r,this.pixelMatrixInverse),e.scale$1(i,i,1/i[3]),e.scale$1(r,r,1/r[3]),i[2]=e.mercatorZfromAltitude(i[2],this._center.lat)*this.worldSize,r[2]=e.mercatorZfromAltitude(r[2],this._center.lat)*this.worldSize,e.scale$1(i,i,1/this.worldSize),e.scale$1(r,r,1/this.worldSize),new e.Ray([i[0],i[1],i[2]],e.normalize([],e.sub([],r,i)))}},{key:"rayIntersectionCoordinate",value:function(t){var i=t.p0,r=t.p1,n=t.t,a=e.mercatorZfromAltitude(i[2],this._center.lat),o=e.mercatorZfromAltitude(r[2],this._center.lat);return new e.MercatorCoordinate(e.number(i[0],r[0],n)/this.worldSize,e.number(i[1],r[1],n)/this.worldSize,e.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(t){if(!this.elevation)return this.pointCoordinate(t);var i=this.projection.pointCoordinate3D(this,t.x,t.y);if(i)return new e.MercatorCoordinate(i[0],i[1],i[2]);var r=0,n=this.horizonLineFromTop();if(t.y>n)return this.pointCoordinate(t);for(var a=.02*n,o=t.clone(),s=0;s<10&&n-r>a;s++){o.y=e.number(r,n,.66);var l=this.projection.pointCoordinate3D(this,o.x,o.y);l?(n=o.y,i=l):r=o.y}return i?new e.MercatorCoordinate(i[0],i[1],i[2]):this.pointCoordinate(t)}},{key:"isPointAboveHorizon",value:function(e){return this.projection.isPointAboveHorizon(this,e)}},{key:"_coordinatePoint",value:function(t,i){var r=i&&this.elevation?this.elevation.getAtPointOrZero(t,this._centerAltitude):this._centerAltitude,n=[t.x*this.worldSize,t.y*this.worldSize,r+t.toAltitude(),1];return e.transformMat4$1(n,n,this.pixelMatrix),n[3]>0?new e.pointGeometry(n[0]/n[3],n[1]/n[3]):new e.pointGeometry(Number.MAX_VALUE,Number.MAX_VALUE)}},{key:"_getBoundsNonRectangular",value:function(){var t=this,i=this._edgeInsets,r=i.top,n=i.left,a=this.height-this._edgeInsets.bottom,o=this.width-this._edgeInsets.right,s=this.pointLocation3D(new e.pointGeometry(n,r)),l=this.pointLocation3D(new e.pointGeometry(o,r)),u=this.pointLocation3D(new e.pointGeometry(o,a)),c=this.pointLocation3D(new e.pointGeometry(n,a)),f=Math.min(s.lng,l.lng,u.lng,c.lng),d=Math.max(s.lng,l.lng,u.lng,c.lng),p=Math.min(s.lat,l.lat,u.lat,c.lat),v=Math.max(s.lat,l.lat,u.lat,c.lat),m=Math.pow(2,-this.zoom)/16*270,y="globe"===this.projection.name?1:4,_=function i(r,n,a,o,s){var l=(r+a)/2,u=(n+o)/2,c=new e.pointGeometry(l,u),h=t.pointLocation3D(c),_=h.lng,g=h.lat,x=Math.max(0,f-_,p-g,_-d,g-v);f=Math.min(f,_),d=Math.max(d,_),p=Math.min(p,g),v=Math.max(v,g),(s<y||x>m)&&(i(r,n,l,u,s+1),i(l,u,a,o,s+1))};if(_(n,r,o,r,1),_(o,r,o,a,1),_(o,a,n,a,1),_(n,a,n,r,1),"globe"===this.projection.name){var g=e.polesInViewport(this),x=h(g,2),b=x[0],w=x[1];b?(v=90,d=180,f=-180):w&&(p=-90,d=180,f=-180)}return new e.LngLatBounds(new e.LngLat(f,p),new e.LngLat(d,v))}},{key:"_getBoundsRectangular",value:function(t,i){var r=this._edgeInsets,n=r.top,a=r.left,o=this.height-this._edgeInsets.bottom,s=this.width-this._edgeInsets.right,l=new e.pointGeometry(a,n),u=new e.pointGeometry(s,n),c=new e.pointGeometry(s,o),h=new e.pointGeometry(a,o),f=this.pointCoordinate(l,t),d=this.pointCoordinate(u,t),p=this.pointCoordinate(c,i),v=this.pointCoordinate(h,i),m=function(e,t){return(t.y-e.y)/(t.x-e.x)};return f.y>1&&d.y>=0?f=new e.MercatorCoordinate((1-v.y)/m(v,f)+v.x,1):f.y<0&&d.y<=1&&(f=new e.MercatorCoordinate(-v.y/m(v,f)+v.x,0)),d.y>1&&f.y>=0?d=new e.MercatorCoordinate((1-p.y)/m(p,d)+p.x,1):d.y<0&&f.y<=1&&(d=new e.MercatorCoordinate(-p.y/m(p,d)+p.x,0)),(new e.LngLatBounds).extend(this.coordinateLocation(f)).extend(this.coordinateLocation(d)).extend(this.coordinateLocation(v)).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(t){this.maxBounds=t,this.minLat=-e.MAX_MERCATOR_LATITUDE,this.maxLat=e.MAX_MERCATOR_LATITUDE,this.minLng=-180,this.maxLng=180,t&&(this.minLat=t.getSouth(),this.maxLat=t.getNorth(),this.minLng=t.getWest(),this.maxLng=t.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=e.mercatorXfromLng(this.minLng)*this.tileSize,this.worldMaxX=e.mercatorXfromLng(this.maxLng)*this.tileSize,this.worldMinY=e.mercatorYfromLat(this.maxLat)*this.tileSize,this.worldMaxY=e.mercatorYfromLat(this.minLat)*this.tileSize,this._constrain()}},{key:"calculatePosMatrix",value:function(e,t){return this.projection.createTileMatrix(this,t,e)}},{key:"calculateDistanceTileData",value:function(t){var i=t.key,r=this._distanceTileDataCache;if(r[i])return r[i];var n=t.canonical,a=1/this.height,o=this.cameraWorldSize,s=o/this.zoomScale(n.z),l=(n.x+Math.pow(2,n.z)*t.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[i]={bearing:[f,d],center:[(c.x-l)*a,(c.y-u)*a],scale:s/e.EXTENT*a},r[i]}},{key:"calculateFogTileMatrix",value:function(t){var i=t.key,r=this._fogTileMatrixCache;if(r[i])return r[i];var n=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,t);return e.multiply(n,this.worldToFogMatrix,n),r[i]=new Float32Array(n),r[i]}},{key:"calculateProjMatrix",value:function(t){var i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=t.key,n=i?this._alignedProjMatrixCache:this._projMatrixCache;if(n[r])return n[r];var a=this.calculatePosMatrix(t,this.worldSize);return e.multiply(a,this.projection.isReprojectedInTileSpace?this.mercatorMatrix:i?this.alignedProjMatrix:this.projMatrix,a),n[r]=new Float32Array(a),n[r]}},{key:"calculatePixelsToTileUnitsMatrix",value:function(t){var i=t.tileID.key,r=this._pixelsToTileUnitsCache;if(r[i])return r[i];var n=function(t,i){var r,n,a,o,s,l,u,c,h=t.tileTransform.scale*e.EXTENT/(t.tileSize*Math.pow(2,i.zoom-t.tileID.overscaledZ+t.tileID.canonical.z));return r=new Float32Array(4),o=(n=i.inverseAdjustmentMatrix)[1],s=n[2],l=n[3],c=(a=[h,h])[1],r[0]=n[0]*(u=a[0]),r[1]=o*u,r[2]=s*c,r[3]=l*c,r}(t,this);return r[i]=n,r[i]}},{key:"customLayerMatrix",value:function(){return this.mercatorMatrix.slice()}},{key:"globeToMercatorMatrix",value:function(){if("globe"===this.projection.name){var t=1/this.worldSize,i=e.fromScaling([],[t,t,t]);return e.multiply(i,i,this.globeMatrix),i}}},{key:"recenterOnTerrain",value:function(){if(this._elevation&&"globe"!==this.projection.name){var t=this._elevation;this._updateCameraState();var i=e.mercatorZfromAltitude(1,this._center.lat)*this.worldSize,r=this._computeCameraPosition(i),n=this._camera.forward(),a=e.mercatorZfromAltitude(1,this._center.lat);r[2]/=a,n[2]/=a,e.normalize(n,n);var o=t.raycast(r,n,t.exaggeration());if(o){var s=e.scaleAndAdd([],r,n,o),l=new e.MercatorCoordinate(s[0],s[1],e.mercatorZfromAltitude(s[2],e.latFromMercatorY(s[1]))),u=(l.z+e.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 t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this._elevation){var i=this._elevation,r=e.mercatorZfromAltitude(1,this._center.lat)*this.worldSize,n=this._computeCameraPosition(r),o=i.getAtPointOrZero(a(e.MercatorCoordinate,c(n))),s=this.pixelsPerMeter/this.worldSize*o,l=this._minimumHeightOverTerrain(),u=n[2]-s;if(u<=l)if(u<0||t){var h=this.locationCoordinate(this._center,this._centerAltitude),f=[n[0],n[1],h.z-n[2]],d=e.length(f);f[2]-=(l-u)/this._pixelsPerMercatorPixel;var p=e.length(f);if(0===p)return;e.scale$2(f,f,d/p*this._pixelsPerMercatorPixel),this._camera.position=[n[0],n[1],h.z*this._pixelsPerMercatorPixel-f[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}}},{key:"_constrain",value:function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var t="globe"===this.projection.name||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||t){var i=this.center;return i.lat=e.clamp(i.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!t)&&(i.lng=e.clamp(i.lng,this.minLng,this.maxLng)),this.center=i,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,v=this.worldMaxX*this.scale,m=this.worldSize/2-(p+v)/2;(l=(a+m+this.worldSize)%this.worldSize-m)-c<p&&(l=p+c),l+c>v&&(l=v-c),v-p<this.width&&(s=Math.max(s,this.width/(v-p)),l=(v+p)/2)}l===a&&u===o||(this.center=this.unproject(new e.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 t=this.centerOffset,i=this.pixelsPerMeter;"globe"===this.projection.name&&(this._mercatorScaleRatio=e.mercatorZfromAltitude(1,this.center.lat)/e.mercatorZfromAltitude(1,e.GLOBE_SCALE_MATCH_LATITUDE));var r=an(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?i: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*-t.x/this.width,o[9]=2*t.y/this.height;var s=e.mul([],o,a);if(this.projection.isReprojectedInTileSpace){var l=this.locationCoordinate(this.center),u=e.identity([]);e.translate(u,u,[l.x*this.worldSize,l.y*this.worldSize,0]),e.multiply(u,u,rn(this)),e.translate(u,u,[-l.x*this.worldSize,-l.y*this.worldSize,0]),e.multiply(s,s,u),this.inverseAdjustmentMatrix=function(e){var t=rn(e,!0);return z([],[t[0],t[1],t[4],t[5]])}(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];this.mercatorMatrix=e.scale([],s,[this.worldSize,this.worldSize,this.worldSize/n,1]),this.projMatrix=s,this.invProjMatrix=e.invert(new Float64Array(16),this.projMatrix);var c=e.invert([],o);this.frustumCorners=e.FrustumCorners.fromInvProjectionMatrix(c,this.horizonLineFromTop(),this.height);var h=new Float32Array(16);e.identity(h),e.scale(h,h,[1,-1,1]),e.rotateX(h,h,this._pitch),e.rotateZ(h,h,this.angle);var f=e.perspective(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ),d=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;f[8]=2*-t.x/this.width,f[9]=2*(t.y+d)/this.height,this.skyboxMatrix=e.multiply(h,f,h);var p=this.point,v=p.x,m=p.y,y=this.width%2/2,_=this.height%2/2,g=Math.cos(this.angle),x=Math.sin(this.angle),b=v-Math.round(v)+g*y+x*_,w=m-Math.round(m)+g*_+x*y,k=new Float64Array(s);if(e.translate(k,k,[b>.5?b-1:b,w>.5?w-1:w,0]),this.alignedProjMatrix=k,s=e.create(),e.scale(s,s,[this.width/2,-this.height/2,1]),e.translate(s,s,[1,-1,0]),this.labelPlaneMatrix=s,s=e.create(),e.scale(s,s,[1,-1,1]),e.translate(s,s,[-1,-1,0]),e.scale(s,s,[2/this.width,2/this.height,1]),this.glCoordMatrix=s,this.pixelMatrix=e.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),this._calcFogMatrices(),this._distanceTileDataCache={},!(s=e.invert(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=s,"globe"===this.projection.name||this.mercatorFromTransition){this.globeMatrix=e.calculateGlobeMatrix(this);var T=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=e.transformMat4(T,T,a),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=s;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={}}}},{key:"_calcFogMatrices",value:function(){this._fogTileMatrixCache={};var t=this.cameraWorldSizeForFog,i=this.cameraPixelsPerMeter,r=this._camera.position,n=1/this.height/this._pixelsPerMercatorPixel,a=[t,t,i];e.scale$2(a,a,n),e.scale$2(r,r,-1),e.multiply$2(r,r,a);var o=e.create();e.translate(o,o,r),e.scale(o,o,a),this.mercatorFogMatrix=o,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(t,i,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(t){var i=this._maxCameraBoundsDistance()*Math.cos(this._pitch),r=this._camera.position[2],n=t[2],a=1;this.projection.wrap&&(this.center=this.center.wrap()),n>0&&(a=Math.min((i-r)/n,1)),this._camera.position=e.scaleAndAdd([],this._camera.position,t,a),this._updateStateFromCamera()}},{key:"_updateStateFromCamera",value:function(){var t=this._camera.position,i=this._camera.forward(),r=this._camera.getPitchBearing(),n=r.pitch,a=r.bearing,o=e.mercatorZfromAltitude(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,s=this._mercatorZfromZoom(this._maxZoom)*Math.cos(e.degToRad(this._maxPitch)),l=Math.max((t[2]-o)/Math.cos(n),s),u=this._zoomFromMercatorZ(l);e.scaleAndAdd(t,t,i,l),this._pitch=e.clamp(n,e.degToRad(this.minPitch),e.degToRad(this.maxPitch)),this.angle=e.wrap(a,-Math.PI,Math.PI),this._setZoom(e.clamp(u,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new e.MercatorCoordinate(t[0],t[1],t[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}},{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(t){for(var i=0,r=e.GLOBE_ZOOM_THRESHOLD_MAX,n=0,a=1/0;r-i>1e-6&&r>i;){var o=i+.5*(r-i),s=this.tileSize*Math.pow(2,o),l=this.getCameraToCenterDistance(this.projection,o,s),u=this.scaleZoom(l/(t*this.tileSize)),c=Math.abs(o-u);c<a&&(a=c,n=o),o<u?i=o:r=o}return n}},{key:"_terrainEnabled",value:function(){return!(!this._elevation||!this.projection.supportsTerrain&&(e.warnOnce("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}},{key:"anyCornerOffEdge",value:function(t,i){var r=Math.min(t.x,i.x),n=Math.max(t.x,i.x),a=Math.min(t.y,i.y),o=Math.max(t.y,i.y);if(a<this.horizonLineFromTop(!1))return!0;if("mercator"!==this.projection.name)return!1;for(var s=[new e.pointGeometry(r,a),new e.pointGeometry(n,o),new e.pointGeometry(r,o),new e.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+e.radToDeg(this.fovAboveCenter)>88||this.anyCornerOffEdge(new e.pointGeometry(0,0),new e.pointGeometry(this.width,this.height))}},{key:"zoomDeltaToMovement",value:function(t,i){var r=e.length(e.sub([],this._camera.position,t)),n=this._zoomFromMercatorZ(r)+i;return r-this._mercatorZfromZoom(n)}},{key:"getCameraPoint",value:function(){if("globe"===this.projection.name){var t=function(t,i){var r=h(t,3),n=[r[0],r[1],r[2],1];e.transformMat4$1(n,n,i);var a=n[3]=Math.max(n[3],1e-6);return n[0]/=a,n[1]/=a,n[2]/=a,n}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new e.pointGeometry(t[0],t[1])}var i=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new e.pointGeometry(0,i))}},{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=an(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 t=this._camera.getWorldToCamera(this.worldSize,"meters"===this.projection.zAxisUnit?this.pixelsPerMeter:1);return"globe"===this.projection.name&&e.multiply(t,t,this.globeMatrix),t}}]),i}();function cn(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 hn=function(){function t(i){d(this,t),this._hashName=i&&encodeURIComponent(i),e.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=cn(this._updateHashUnthrottled.bind(this),300)}return p(t,[{key:"addTo",value:function(t){return this._map=t,e.window.addEventListener("hashchange",this._onHashChange,!1),t.on("moveend",this._updateHash),this}},{key:"remove",value:function(){return this._map?(this._map.off("moveend",this._updateHash),e.window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}},{key:"getHashString",value:function(){var t=this._map;if(!t)return"";var i=fn(t);if(this._hashName){var r=this._hashName,n=!1,a=e.window.location.hash.slice(1).split("&").map((function(e){var t=e.split("=")[0];return t===r?(n=!0,"".concat(t,"=").concat(i)):e})).filter((function(e){return e}));return n||a.push("".concat(r,"=").concat(i)),"#".concat(a.join("&"))}return"#".concat(i)}},{key:"_getCurrentHash",value:function(){var t,i=this,r=e.window.location.hash.replace("#","");return this._hashName?(r.split("&").map((function(e){return e.split("=")})).forEach((function(e){e[0]===i._hashName&&(t=e)})),(t&&t[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 t=e.window.location.href.replace(/(#.+)?$/,this.getHashString());e.window.history.replaceState(e.window.history.state,null,t)}}]),t}();function fn(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 dn={linearity:.3,easing:e.bezier(0,0,.3,1)},pn=e.extend({deceleration:2500,maxSpeed:1400},dn),vn=e.extend({deceleration:20,maxSpeed:1400},dn),mn=e.extend({deceleration:1e3,maxSpeed:360},dn),yn=e.extend({deceleration:1e3,maxSpeed:90},dn),_n=function(){function t(e){d(this,t),this._map=e,this.clear()}return p(t,[{key:"clear",value:function(){this._inertiaBuffer=[]}},{key:"record",value:function(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:e.exported.now(),settings:t})}},{key:"_drainInertiaBuffer",value:function(){for(var t=this._inertiaBuffer,i=e.exported.now();t.length>0&&i-t[0].time>160;)t.shift()}},{key:"_onMoveEnd",value:function(t){if(!e.exported.prefersReducedMotion&&(this._drainInertiaBuffer(),!(this._inertiaBuffer.length<2))){var i,r={zoom:0,bearing:0,pitch:0,pan:new e.pointGeometry(0,0),pinchAround:void 0,around:void 0},n=f(this._inertiaBuffer);try{for(n.s();!(i=n.n()).done;){var a=i.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 l=xn(r.pan.mag(),o,e.extend({},pn,t||{}));s.offset=r.pan.mult(l.amount/r.pan.mag()),s.center=this._map.transform.center,gn(s,l)}if(r.zoom){var u=xn(r.zoom,o,vn);s.zoom=this._map.transform.zoom+u.amount,gn(s,u)}if(r.bearing){var c=xn(r.bearing,o,mn);s.bearing=this._map.transform.bearing+e.clamp(c.amount,-179,179),gn(s,c)}if(r.pitch){var h=xn(r.pitch,o,yn);s.pitch=this._map.transform.pitch+h.amount,gn(s,h)}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}}}]),t}();function gn(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function xn(t,i,r){var n=r.maxSpeed,a=r.linearity,o=r.deceleration,s=e.clamp(t*a/(i/1e3),-n,n),l=Math.abs(s)/(o*a);return{easing:r.easing,duration:1e3*l,amount:s*(l/2)}}var bn=function(t){v(r,t);var i=m(r);function r(t,n,a){var o,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};d(this,r);var l=M(n.getCanvasContainer(),a),u=n.unproject(l);return(o=i.call(this,t,e.extend({point:l,lngLat:u,originalEvent:a},s)))._defaultPrevented=!1,o.target=n,o}return p(r,[{key:"preventDefault",value:function(){this._defaultPrevented=!0}},{key:"defaultPrevented",get:function(){return this._defaultPrevented}}]),r}(e.Event),wn=function(t){v(r,t);var i=m(r);function r(t,n,a){var o;d(this,r);var s="touchend"===t?a.changedTouches:a.touches,l=A(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 e.pointGeometry(0,0));return(o=i.call(this,t,{points:l,point:c,lngLats:u,lngLat:n.unproject(c),originalEvent:a}))._defaultPrevented=!1,o}return p(r,[{key:"preventDefault",value:function(){this._defaultPrevented=!0}},{key:"defaultPrevented",get:function(){return this._defaultPrevented}}]),r}(e.Event),kn=function(e){v(i,e);var t=m(i);function i(e,r,n){var a;return d(this,i),(a=t.call(this,e,{originalEvent:n}))._defaultPrevented=!1,a}return p(i,[{key:"preventDefault",value:function(){this._defaultPrevented=!0}},{key:"defaultPrevented",get:function(){return this._defaultPrevented}}]),i}(e.Event),Tn=function(){function t(e,i){d(this,t),this._map=e,this._clickTolerance=i.clickTolerance}return p(t,[{key:"reset",value:function(){this._mousedownPos=void 0}},{key:"wheel",value:function(e){return this._firePreventable(new kn(e.type,this._map,e))}},{key:"mousedown",value:function(e,t){return this._mousedownPos=t,this._firePreventable(new bn(e.type,this._map,e))}},{key:"mouseup",value:function(e){this._map.fire(new bn(e.type,this._map,e))}},{key:"preclick",value:function(t){var i=e.extend({},t);i.type="preclick",this._map.fire(new bn(i.type,this._map,i))}},{key:"click",value:function(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||(this.preclick(e),this._map.fire(new bn(e.type,this._map,e)))}},{key:"dblclick",value:function(e){return this._firePreventable(new bn(e.type,this._map,e))}},{key:"mouseover",value:function(e){this._map.fire(new bn(e.type,this._map,e))}},{key:"mouseout",value:function(e){this._map.fire(new bn(e.type,this._map,e))}},{key:"touchstart",value:function(e){return this._firePreventable(new wn(e.type,this._map,e))}},{key:"touchmove",value:function(e){this._map.fire(new wn(e.type,this._map,e))}},{key:"touchend",value:function(e){this._map.fire(new wn(e.type,this._map,e))}},{key:"touchcancel",value:function(e){this._map.fire(new wn(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(){}}]),t}(),En=function(){function e(t){d(this,e),this._map=t}return p(e,[{key:"reset",value:function(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}},{key:"mousemove",value:function(e){this._map.fire(new bn(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 bn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}},{key:"contextmenu",value:function(e){this._delayContextMenu?this._contextMenuEvent=e:this._map.fire(new bn(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}(),Sn=function(){function t(e,i){d(this,t),this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=i.clickTolerance||1}return p(t,[{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=_("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(t,i){var r=this;if(this._active){var n=this._startPos,a=i;if(n&&0===t.button){if(this.reset(),S(),n.x!==a.x||n.y!==a.y)return this._map.fire(new e.Event("boxzoomend",{originalEvent:t})),{cameraAnimation:function(e){return e.fitScreenCoordinates(n,a,r._map.getBearing(),{linear:!1})}};this._fireEvent("boxzoomcancel",t)}}}},{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(t,i){return this._map.fire(new e.Event(t,{originalEvent:i}))}}]),t}();function Mn(e,t){for(var i={},r=0;r<e.length;r++)i[e[r].identifier]=t[r];return i}var An=function(){function t(e){d(this,t),this.reset(),this.numTouches=e.numTouches}return p(t,[{key:"reset",value:function(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}},{key:"touchstart",value:function(t,i,r){(this.centroid||r.length>this.numTouches)&&(this.aborted=!0),this.aborted||(0===this.startTime&&(this.startTime=t.timeStamp),r.length===this.numTouches&&(this.centroid=function(t){var i,r=new e.pointGeometry(0,0),n=f(t);try{for(n.s();!(i=n.n()).done;){var a=i.value;r._add(a)}}catch(o){n.e(o)}finally{n.f()}return r.div(t.length)}(i),this.touches=Mn(r,i)))}},{key:"touchmove",value:function(e,t,i){if(!this.aborted&&this.centroid){var r=Mn(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}}}]),t}(),In=function(){function e(t){d(this,e),this.singleTap=new An(t),this.numTaps=t.numTaps,this.reset()}return p(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}(),Cn=function(){function e(){d(this,e),this._zoomIn=new In({numTouches:1,numTaps:2}),this._zoomOut=new In({numTouches:2,numTaps:1}),this.reset()}return p(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}(),zn={0:1,2:2},Pn=function(){function e(t){d(this,e),this.reset(),this._clickTolerance=t.clickTolerance||1}return p(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=I(e);this._correctButton(e,i)&&(this._lastPoint=t,this._eventButton=i)}}},{key:"mousemoveWindow",value:function(e,t){var i=this._lastPoint;if(i)if(e.preventDefault(),null!=this._eventButton&&function(e,t){var i=zn[t];return void 0===e.buttons||(e.buttons&i)!==i}(e,this._eventButton))this.reset();else if(this._moved||!(t.dist(i)<this._clickTolerance))return this._moved=!0,this._lastPoint=t,this._move(i,t)}},{key:"mouseupWindow",value:function(e){this._lastPoint&&I(e)===this._eventButton&&(this._moved&&S(),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}(),Dn=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"mousedown",value:function(e,t){o(s(i.prototype),"mousedown",this).call(this,e,t),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)}}}]),i}(Pn),Ln=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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}(Pn),Rn=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(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}(Pn),Bn=function(){function t(i,r){d(this,t),this._map=i,this._el=i.getCanvasContainer(),this._minTouches=1,this._clickTolerance=r.clickTolerance||1,this.reset(),e.bindAll(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}return p(t,[{key:"reset",value:function(){this._active=!1,this._touches={},this._sum=new e.pointGeometry(0,0)}},{key:"touchstart",value:function(e,t,i){return this._calculateTransform(e,t,i)}},{key:"touchmove",value:function(t,i,r){if(this._active&&!(r.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(1===r.length&&!e.isFullscreen())return void this._showTouchPanBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return t.cancelable&&t.preventDefault(),this._calculateTransform(t,i,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(t,i,r){r.length>0&&(this._active=!0);var n=Mn(r,i),a=new e.pointGeometry(0,0),o=new e.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=_("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)}}]),t}(),On=function(){function e(){d(this,e),this.reset()}return p(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=h(r,2),a=n[0],o=n[1],s=Fn(i,t,a),l=Fn(i,t,o);if(s&&l){var u=this._aroundCenter?null:s.add(l).div(2);return this._move([s,l],u,e)}}}},{key:"touchend",value:function(e,t,i){if(this._firstTwoTouches){var r=h(this._firstTwoTouches,2),n=r[0],a=r[1],o=Fn(i,t,n),s=Fn(i,t,a);o&&s||(this._active&&S(),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 Fn(e,t,i){for(var r=0;r<e.length;r++)if(e[r].identifier===i)return t[r]}function Un(e,t){return Math.log(e/t)/Math.LN2}var Vn=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"reset",value:function(){o(s(i.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(Un(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Un(this._distance,i),pinchAround:t}}}]),i}(On);function Nn(e,t){return 180*e.angleWith(t)/Math.PI}var jn=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i,[{key:"reset",value:function(){o(s(i.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:Nn(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=Nn(e,i);return Math.abs(r)<t}}]),i}(On);function Gn(e){return Math.abs(e.y)>Math.abs(e.x)}var Zn=function(t){v(r,t);var i=m(r);function r(e){var t;return d(this,r),(t=i.call(this))._map=e,t}return p(r,[{key:"reset",value:function(){o(s(r.prototype),"reset",this).call(this),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}},{key:"_start",value:function(e){this._lastPoints=e,Gn(e[0].sub(e[1]))&&(this._valid=!1)}},{key:"_move",value:function(t,i,r){var n=this._lastPoints;if(n){var a=t[0].sub(n[0]),o=t[1].sub(n[1]);return this._map._cooperativeGestures&&!e.isFullscreen()&&r.touches.length<3||(this._valid=this.gestureBeginsVertically(a,o,r.timeStamp),!this._valid)?void 0:(this._lastPoints=t,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 Gn(e)&&Gn(t)&&a}}}]),r}(On),qn={panStep:100,bearingStep:15,pitchStep:10},Wn=function(){function e(){d(this,e);var t=qn;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}return p(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:Xn,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 Xn(e){return e*(2-e)}var Hn=4.000244140625,Yn=function(){function t(i,r){d(this,t),this._map=i,this._el=i.getCanvasContainer(),this._handler=r,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,e.bindAll(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}return p(t,[{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(t){if(this.isEnabled()){if(this._map._cooperativeGestures){if(!(t.ctrlKey||t.metaKey||this.isZooming()||e.isFullscreen()))return void this._showBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}var i=t.deltaMode===e.window.WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY,r=e.exported.now(),n=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,0!==i&&i%Hn==0?this._type="wheel":0!==i&&Math.abs(i)<4?this._type="trackpad":n>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(n*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),t.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=t,this._delta-=i,this._active||this._start(t)),t.preventDefault()}}},{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=M(this._el,e);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:t,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}}},{key:"renderFrame",value:function(){var t=this;if(this._frameId&&(this._frameId=null,this.isActive())){var i=this._map.transform;"wheel"===this._type&&i.projection.wrap&&(i._center.lng>=180||i._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);var r=function(){return i._terrainEnabled()&&t._aroundCoord?i.computeZoomRelativeTo(t._aroundCoord):i.zoom};if(0!==this._delta){var n="wheel"===this._type&&Math.abs(this._delta)>Hn?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?i.zoomScale(this._targetZoom):s;this._targetZoom=Math.min(i.maxZoom,Math.max(i.minZoom,i.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((e.exported.now()-this._lastWheelEventTime)/200,1),v=f(p);u=e.number(h,c,v),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(){t._zooming=!1,t._handler._triggerRenderFrame(),delete t._targetZoom,delete t._finishTimeout}),200)),{noInertia:!0,needsRenderFrame:!d,zoomDelta:u-r(),around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}}},{key:"_smoothOutEasing",value:function(t){var i=e.ease;if(this._prevEase){var r=this._prevEase,n=(e.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);i=e.bezier(o,s,.25,1)}return this._prevEase={start:e.exported.now(),duration:t,easing:i},i}},{key:"blur",value:function(){this.reset()}},{key:"reset",value:function(){this._active=!1}},{key:"_addScrollZoomBlocker",value:function(){this._map&&!this._alertContainer&&(this._alertContainer=_("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(e.window.navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize="".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)}}]),t}(),Kn=function(){function e(t,i){d(this,e),this._clickZoom=t,this._tapZoom=i}return p(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}(),Jn=function(){function e(){d(this,e),this.reset()}return p(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}(),$n=function(){function e(){d(this,e),this._tap=new In({numTouches:1,numTaps:1}),this.reset()}return p(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}(),Qn=function(){function e(t,i,r){d(this,e),this._el=t,this._mousePan=i,this._touchPan=r}return p(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}(),ea=function(){function e(t,i,r){d(this,e),this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=i,this._mousePitch=r}return p(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}(),ta=function(){function e(t,i,r,n){d(this,e),this._el=t,this._touchZoom=i,this._touchRotate=r,this._tapDragZoom=n,this._rotationDisabled=!1,this._enabled=!0}return p(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}(),ia=function(e){return e.zoom||e.drag||e.pitch||e.rotate},ra=function(e){v(i,e);var t=m(i);function i(){return d(this,i),t.apply(this,arguments)}return p(i)}(e.Event),na=function(){function t(){d(this,t),this.constants=[1,1,.01],this.radius=0}return p(t,[{key:"setup",value:function(t,i){var r=e.sub([],i,t);this.radius=e.length(r[2]<0?e.div([],r,this.constants):[r[0],r[1],0])}},{key:"projectRay",value:function(t){e.div(t,t,this.constants),e.normalize(t,t),e.mul$1(t,t,this.constants);var i=e.scale$2([],t,this.radius);if(i[2]>0){var r=e.scale$2([],[0,0,1],e.dot(i,[0,0,1])),n=e.scale$2([],e.normalize([],[i[0],i[1],0]),this.radius),a=e.add([],i,e.scale$2([],e.sub([],e.add([],n,r),i),2));i[0]=a[0],i[1]=a[1]}return i}}]),t}();function aa(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta}var oa=function(){function t(i,r){d(this,t),this._map=i,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new _n(i),this._bearingSnap=r.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new na,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(r),e.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],[e.window.document,"mousemove",{capture:!0}],[e.window.document,"mouseup",void 0],[n,"mouseover",void 0],[n,"mouseout",void 0],[n,"dblclick",void 0],[n,"click",void 0],[n,"keydown",{capture:!1}],[n,"keyup",void 0],[n,"wheel",{passive:!1}],[n,"contextmenu",void 0],[e.window,"blur",void 0]];var a,o=f(this._listeners);try{for(o.s();!(a=o.n()).done;){var s=h(a.value,3),l=s[0],u=s[1],c=s[2];l.addEventListener(u,l===e.window.document?this.handleWindowEvent:this.handleEvent,c)}}catch(p){o.e(p)}finally{o.f()}}return p(t,[{key:"destroy",value:function(){var t,i=f(this._listeners);try{for(i.s();!(t=i.n()).done;){var r=h(t.value,3),n=r[0],a=r[1],o=r[2];n.removeEventListener(a,n===e.window.document?this.handleWindowEvent:this.handleEvent,o)}}catch(s){i.e(s)}finally{i.f()}}},{key:"_addDefaultHandlers",value:function(e){var t=this._map,i=t.getCanvasContainer();this._add("mapEvent",new Tn(t,e));var r=t.boxZoom=new Sn(t,e);this._add("boxZoom",r);var n=new Cn,a=new Jn;t.doubleClickZoom=new Kn(a,n),this._add("tapZoom",n),this._add("clickZoom",a);var o=new $n;this._add("tapDragZoom",o);var s=t.touchPitch=new Zn(t);this._add("touchPitch",s);var l=new Ln(e),u=new Rn(e);t.dragRotate=new ea(e,l,u),this._add("mouseRotate",l,["mousePitch"]),this._add("mousePitch",u,["mouseRotate"]);var c=new Dn(e),h=new Bn(t,e);t.dragPan=new Qn(i,c,h),this._add("mousePan",c),this._add("touchPan",h,["touchZoom","touchRotate"]);var f=new jn,d=new Vn;t.touchZoomRotate=new ta(i,d,f,o),this._add("touchRotate",f,["touchPan","touchZoom"]),this._add("touchZoom",d,["touchPan","touchRotate"]),this._add("blockableMapEvent",new En(t));var p=t.scrollZoom=new Yn(t,this);this._add("scrollZoom",p,["mousePan"]);var v=t.keyboard=new Wn;this._add("keyboard",v);for(var m=0,y=["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"];m<y.length;m++){var _=y[m];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=f(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=f(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!!ia(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=f(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={},l=e.touches?this._getMapTouches(e.touches):void 0,u=l?A(this._el,l):r?void 0:M(this._el,e),c=f(this._handlers);try{for(c.s();!(i=c.n()).done;){var h=i.value,d=h.handlerName,p=h.handler,v=h.allowed;if(p.isEnabled()){var m=void 0;this._blockedByActive(s,v,d)?p.reset():p[t||e.type]&&(m=p[t||e.type](e,u,l),this.mergeHandlerResult(a,o,m,d,n),m&&m.needsRenderFrame&&this._triggerRenderFrame()),(m||p.isActive())&&(s[d]=p)}}}catch(x){c.e(x)}finally{c.f()}var y={};for(var _ in this._previousActiveHandlers)s[_]||(y[_]=n);this._previousActiveHandlers=s,(Object.keys(y).length||aa(a))&&(this._changes.push([a,o,y]),this._triggerRenderFrame()),(Object.keys(s).length||aa(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(t,i,r,n,a){if(r){e.extend(t,r);var o={handlerName:n,originalEvent:r.originalEvent||a};void 0!==r.zoomDelta&&(i.zoom=o),void 0!==r.panDelta&&(i.drag=o),void 0!==r.pitchDelta&&(i.pitch=o),void 0!==r.bearingDelta&&(i.rotate=o)}}},{key:"_applyChanges",value:function(){var t,i={},r={},n={},a=f(this._changes);try{for(a.s();!(t=a.n()).done;){var o=h(t.value,3),s=o[0],l=o[1],u=o[2];s.panDelta&&(i.panDelta=(i.panDelta||new e.pointGeometry(0,0))._add(s.panDelta)),s.zoomDelta&&(i.zoomDelta=(i.zoomDelta||0)+s.zoomDelta),s.bearingDelta&&(i.bearingDelta=(i.bearingDelta||0)+s.bearingDelta),s.pitchDelta&&(i.pitchDelta=(i.pitchDelta||0)+s.pitchDelta),void 0!==s.around&&(i.around=s.around),void 0!==s.aroundCoord&&(i.aroundCoord=s.aroundCoord),void 0!==s.pinchAround&&(i.pinchAround=s.pinchAround),s.noInertia&&(i.noInertia=s.noInertia),e.extend(r,l),e.extend(n,u)}}catch(c){a.e(c)}finally{a.f()}this._updateMapTransform(i,r,n),this._changes=[]}},{key:"_updateMapTransform",value:function(t,i,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()}()&&!aa(t)){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),aa(t)){var u=t.panDelta,c=t.zoomDelta,h=t.bearingDelta,f=t.pitchDelta,d=t.around,p=t.aroundCoord,v=t.pinchAround;o._isCameraConstrained&&(c>0&&(c=0),o._isCameraConstrained=!1),void 0!==v&&(d=v),(c||i.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 m=[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);m[0]=_[0]-y[0],m[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;m[0]=-u.x*e.mercatorScale(e.latFromMercatorY(g.y))*x,m[1]=-u.y*e.mercatorScale(o.center.lat)*x}else{var b=o.pointCoordinate(d.sub(u));g&&b&&(m[0]=b.x-g.x,m[1]=b.y-g.y)}}var w=o.zoom,k=[0,0,0];if(c){var T=s(p||o.pointCoordinate3D(d)),E={dir:e.normalize([],e.sub([],T,o._camera.position))};if(E.dir[2]<0){var S=o.zoomDeltaToMovement(T,c);e.scale$2(k,E.dir,S)}}var M=e.add(m,m,k);o._translateCameraConstrained(M),c&&Math.abs(o.zoom-w)>1e-4&&o.recenterOnTerrain(),o.cameraElevationReference="ground",this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(i,r,!0)}else this._fireEvents(i,r,!0)}},{key:"_fireEvents",value:function(t,i,r){var n=this,a=ia(this._eventsInProgress),o=ia(t),s={};for(var l in t){var u=t[l].originalEvent;this._eventsInProgress[l]||(s["".concat(l,"start")]=u),this._eventsInProgress[l]=t[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),t){var f=t[h].originalEvent;this._fireEvent(h,f)}var d,p={};for(var v in this._eventsInProgress){var m=this._eventsInProgress[v],y=m.handlerName,_=m.originalEvent;this._handlersById[y].isActive()||(delete this._eventsInProgress[v],d=i[y]||_,p["".concat(v,"end")]=d)}for(var g in p)this._fireEvent(g,p[g]);var x=ia(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 e.Event("moveend",{originalEvent:d})),w(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}},{key:"_fireEvent",value:function(t,i){this._map.fire(new e.Event(t,i?{originalEvent:i}:{}))}},{key:"_requestFrame",value:function(){var e=this;return this._map.triggerRepaint(),this._map._renderTaskQueue.add((function(t){e._frameId=void 0,e.handleEvent(new ra("renderFrame",{timeStamp:t})),e._applyChanges()}))}},{key:"_triggerRenderFrame",value:function(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}]),t}(),sa="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.",la=function(t){v(r,t);var i=m(r);function r(t,a){var o;return d(this,r),(o=i.call(this))._moving=!1,o._zooming=!1,o.transform=t,o._bearingSnap=a.bearingSnap,e.bindAll(["_renderFrameCallback"],n(o)),o}return p(r,[{key:"getCenter",value:function(){return new e.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(t,i,r){return t=e.pointGeometry.convert(t).mult(-1),this.panTo(this.transform.center,e.extend({offset:t},i),r)}},{key:"panTo",value:function(t,i,r){return this.easeTo(e.extend({center:t},i),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(t,i,r){return this.easeTo(e.extend({zoom:t},i),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(t,i,r){return this.easeTo(e.extend({bearing:t},i),r)}},{key:"resetNorth",value:function(t,i){return this.rotateTo(0,e.extend({duration:1e3},t),i),this}},{key:"resetNorthPitch",value:function(t,i){return this.easeTo(e.extend({bearing:0,pitch:0,duration:1e3},t),i),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(t,i){t=e.LngLatBounds.convert(t);var r=i&&i.bearing||0,n=i&&i.pitch||0,a=t.getNorthWest(),o=t.getSouthEast();return this._cameraForBounds(this.transform,a,o,r,n,i)}},{key:"_extendCameraOptions",value:function(t){var i={top:0,bottom:0,right:0,left:0};if("number"==typeof(t=e.extend({padding:i,offset:[0,0],maxZoom:this.transform.maxZoom},t)).padding){var r=t.padding;t.padding={top:r,bottom:r,right:r,left:r}}return t.padding=e.extend(i,t.padding),t}},{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(t,i,r,n,a,o){var s=t.clone(),l=this._extendCameraOptions(o);s.bearing=n,s.pitch=a;var u=e.LngLat.convert(i),c=e.LngLat.convert(r),h=.5*(u.lat+c.lat),f=.5*(u.lng+c.lng),d=e.latLngToECEF(h,f),p=e.normalize([],d),v=e.normalize([],e.cross([],p,[0,1,0])),m=e.cross([],v,p),y=[v[0],v[1],v[2],0,m[0],m[1],m[2],0,p[0],p[1],p[2],0,0,0,0,1],_=[d,e.latLngToECEF(u.lat,u.lng),e.latLngToECEF(c.lat,u.lng),e.latLngToECEF(c.lat,c.lng),e.latLngToECEF(u.lat,c.lng),e.latLngToECEF(h,u.lng),e.latLngToECEF(h,c.lng),e.latLngToECEF(u.lat,f),e.latLngToECEF(c.lat,f)],g=e.Aabb.fromPoints(_.map((function(t){return[e.dot(v,t),e.dot(m,t),e.dot(p,t)]}))),x=e.transformMat4([],g.center,y);0===e.squaredLength(x)&&e.set(x,0,0,1),e.normalize(x,x),e.scale$2(x,x,e.GLOBE_RADIUS),s.center=e.ecefToLatLng(x);var b=s.getWorldToCameraMatrix(),w=e.invert(new Float64Array(16),b);g=e.Aabb.applyTransform(g,e.multiply([],b,y)),e.transformMat4(x,x,b);var k=.5*(g.max[2]-g.min[2]),T=this._minimumAABBFrustumDistance(s,g),E=e.scale$2([],[0,0,1],k),S=e.add(E,x,E),M=T+(0===s.pitch?0:e.distance(x,S)),A=s.globeCenterInViewSpace,I=e.sub([],x,[A[0],A[1],A[2]]);e.normalize(I,I),e.scale$2(I,I,M);var C=e.add([],x,I);e.transformMat4(C,C,w);var z=e.earthRadius/e.GLOBE_RADIUS,P=e.length(C),D=e.mercatorZfromAltitude(Math.max(P*z-e.earthRadius,Number.EPSILON),0),L=Math.min(s.zoomFromMercatorZAdjusted(D),l.maxZoom);return L>.5*(e.GLOBE_ZOOM_THRESHOLD_MIN+e.GLOBE_ZOOM_THRESHOLD_MAX)?(s.setProjection({name:"mercator"}),s.zoom=L,this._cameraForBounds(s,i,r,n,a,o)):{center:s.center,zoom:L,bearing:n,pitch:a}}},{key:"queryTerrainElevation",value:function(t,i){var r=this.transform.elevation;return r?(i=e.extend({},{exaggerated:!0},i),r.getAtPoint(e.MercatorCoordinate.fromLngLat(t),null,i.exaggerated)):null}},{key:"_cameraForBounds",value:function(t,i,r,n,a,o){if("globe"===t.projection.name)return this._cameraForBoundsOnGlobe(t,i,r,n,a,o);var s=t.clone(),l=this._extendCameraOptions(o),u=s.padding;s.bearing=n,s.pitch=a;var c=e.LngLat.convert(i),h=e.LngLat.convert(r),f=new e.LngLat(c.lng,h.lat),d=new e.LngLat(h.lng,c.lat),p=s.project(c),v=s.project(h),m=this.queryTerrainElevation(c),y=this.queryTerrainElevation(h),_=this.queryTerrainElevation(f),g=this.queryTerrainElevation(d),x=[[p.x,p.y,Math.min(m||0,y||0,_||0,g||0)],[v.x,v.y,Math.max(m||0,y||0,_||0,g||0)]],b=e.Aabb.fromPoints(x),w=s.getWorldToCameraMatrix(),k=e.invert(new Float64Array(16),w);b=e.Aabb.applyTransform(b,w);var T=e.sub([],b.max,b.min),E=u.left||0,S=u.right||0,M=u.bottom||0,A=u.top||0,I=l.padding,C=I.left,z=I.right,P=I.top,D=I.bottom,L=.5*(E+S),R=.5*(A+M),B=Math.min(s.scaleZoom(s.scale*Math.min((s.width-(E+S+C+z))/T[0],(s.height-(M+A+D+P))/T[1])),l.maxZoom),O=s.scale/s.zoomScale(B);b=new e.Aabb([b.min[0]-(C+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];e.transformMat4$1(V,V,w),e.normalize$2(V,V);var N=e.scale$2([],V,U+F),j=e.add([],b.center,N),G=("number"==typeof l.offset.x&&"number"==typeof l.offset.y?new e.pointGeometry(l.offset.x,l.offset.y):e.pointGeometry.convert(l.offset)).rotate(-e.degToRad(n));b.center[0]-=G.x*O,b.center[1]+=G.y*O,e.transformMat4(b.center,b.center,k),e.transformMat4(j,j,k);var Z=[b.center[0],b.center[1],j[2]*s.pixelsPerMeter];e.scale$2(Z,Z,1/s.worldSize);var q=e.lngFromMercatorX(Z[0]),W=e.latFromMercatorY(Z[1]),X=Math.min(s._zoomFromMercatorZ(Z[2]),l.maxZoom),H=new e.LngLat(q,W);return s.mercatorFromTransition&&X<.5*(e.GLOBE_ZOOM_THRESHOLD_MIN+e.GLOBE_ZOOM_THRESHOLD_MAX)?(s.setProjection({name:"globe"}),s.zoom=X,this._cameraForBounds(s,i,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(t,i,r,n,a){var o=e.pointGeometry.convert(t),s=e.pointGeometry.convert(i),l=new e.pointGeometry(Math.min(o.x,s.x),Math.min(o.y,s.y)),u=new e.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 e.pointGeometry(l.x,u.y)),d=this.transform.pointLocation3D(new e.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)],v=[Math.max(c.lng,h.lng,f.lng,d.lng),Math.max(c.lat,h.lat,f.lat,d.lat)],m=n&&n.pitch?n.pitch:this.getPitch(),y=this._cameraForBounds(this.transform,p,v,r,m,n);return this._fitInternal(y,n,a)}},{key:"_fitInternal",value:function(t,i,r){return t?(delete(i=e.extend(t,i)).padding,i.linear?this.easeTo(i,r):this.flyTo(i,r)):this}},{key:"jumpTo",value:function(t,i){this.stop();var r=t.preloadOnly?this.transform.clone():this.transform,n=!1,a=!1,o=!1;return"zoom"in t&&r.zoom!==+t.zoom&&(n=!0,r.zoom=+t.zoom),void 0!==t.center&&(r.center=e.LngLat.convert(t.center)),"bearing"in t&&r.bearing!==+t.bearing&&(a=!0,r.bearing=+t.bearing),"pitch"in t&&r.pitch!==+t.pitch&&(o=!0,r.pitch=+t.pitch),null==t.padding||r.isPaddingEqual(t.padding)||(r.padding=t.padding),t.preloadOnly?(this._preloadTiles(r),this):(this.fire(new e.Event("movestart",i)).fire(new e.Event("move",i)),n&&this.fire(new e.Event("zoomstart",i)).fire(new e.Event("zoom",i)).fire(new e.Event("zoomend",i)),a&&this.fire(new e.Event("rotatestart",i)).fire(new e.Event("rotate",i)).fire(new e.Event("rotateend",i)),o&&this.fire(new e.Event("pitchstart",i)).fire(new e.Event("pitch",i)).fire(new e.Event("pitchend",i)),this.fire(new e.Event("moveend",i)))}},{key:"getFreeCameraOptions",value:function(){return this.transform.projection.supportsFreeCamera||e.warnOnce(sa),this.transform.getFreeCameraOptions()}},{key:"setFreeCameraOptions",value:function(t,i){var r=this.transform;if(!r.projection.supportsFreeCamera)return e.warnOnce(sa),this;this.stop();var n=r.zoom,a=r.pitch,o=r.bearing;r.setFreeCameraOptions(t);var s=n!==r.zoom,l=a!==r.pitch,u=o!==r.bearing;return this.fire(new e.Event("movestart",i)).fire(new e.Event("move",i)),s&&this.fire(new e.Event("zoomstart",i)).fire(new e.Event("zoom",i)).fire(new e.Event("zoomend",i)),u&&this.fire(new e.Event("rotatestart",i)).fire(new e.Event("rotate",i)).fire(new e.Event("rotateend",i)),l&&this.fire(new e.Event("pitchstart",i)).fire(new e.Event("pitch",i)).fire(new e.Event("pitchend",i)),this.fire(new e.Event("moveend",i)),this}},{key:"easeTo",value:function(t,i){var r=this;this._stop(!1,t.easeId),(!1===(t=e.extend({offset:[0,0],duration:500,easing:e.ease},t)).animate||!t.essential&&e.exported.prefersReducedMotion)&&(t.duration=0);var n,a,o,s=this.transform,l=this.getZoom(),u=this.getBearing(),c=this.getPitch(),h=this.getPadding(),f="zoom"in t?+t.zoom:l,d="bearing"in t?this._normalizeBearing(t.bearing,u):u,p="pitch"in t?+t.pitch:c,v="padding"in t?t.padding:s.padding,m=e.pointGeometry.convert(t.offset);if("globe"===s.projection.name){var y=e.MercatorCoordinate.fromLngLat(s.center),_=m.rotate(-s.angle);y.x+=_.x/s.worldSize,y.y+=_.y/s.worldSize;var g=y.toLngLat(),x=e.LngLat.convert(t.center||g);this._normalizeCenter(x),n=s.centerPoint.add(_),a=new e.pointGeometry(y.x,y.y).mult(s.worldSize),o=new e.pointGeometry(e.mercatorXfromLng(x.lng),e.mercatorYfromLat(x.lat)).mult(s.worldSize).sub(a)}else{n=s.centerPoint.add(m);var b=s.pointLocation(n),w=e.LngLat.convert(t.center||b);this._normalizeCenter(w),a=s.project(b),o=s.project(w).sub(a)}var k,T,E=s.zoomScale(f-l);t.around&&(k=e.LngLat.convert(t.around),T=s.locationPoint(k));var S=this._zooming||f!==l,M=this._rotating||u!==d,A=this._pitching||p!==c,I=!s.isPaddingEqual(v),C=function(s){return function(y){if(S&&(s.zoom=e.number(l,f,y)),M&&(s.bearing=e.number(u,d,y)),A&&(s.pitch=e.number(c,p,y)),I&&(s.interpolatePadding(h,v,y),n=s.centerPoint.add(m)),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 t.preloadOnly||r._fireMoveEvents(i),s}};if(t.preloadOnly){var z=this._emulate(C,t.duration,s);return this._preloadTiles(z),this}var P={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=S,this._rotating=M,this._pitching=A,this._padding=I,this._easeId=t.easeId,this._prepareEase(i,t.noMoveStart,P),this._ease(C(s),(function(e){s.recenterOnTerrain(),r._afterEase(i,e)}),t),this}},{key:"_prepareEase",value:function(t,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this._moving=!0,this.transform.cameraElevationReference="sea",i||r.moving||this.fire(new e.Event("movestart",t)),this._zooming&&!r.zooming&&this.fire(new e.Event("zoomstart",t)),this._rotating&&!r.rotating&&this.fire(new e.Event("rotatestart",t)),this._pitching&&!r.pitching&&this.fire(new e.Event("pitchstart",t))}},{key:"_fireMoveEvents",value:function(t){this.fire(new e.Event("move",t)),this._zooming&&this.fire(new e.Event("zoom",t)),this._rotating&&this.fire(new e.Event("rotate",t)),this._pitching&&this.fire(new e.Event("pitch",t))}},{key:"_afterEase",value:function(t,i){if(!this._easeId||!i||this._easeId!==i){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 e.Event("zoomend",t)),n&&this.fire(new e.Event("rotateend",t)),a&&this.fire(new e.Event("pitchend",t)),this.fire(new e.Event("moveend",t))}}},{key:"flyTo",value:function(t,i){var r=this;if(!t.essential&&e.exported.prefersReducedMotion){var n=e.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(n,i)}this.stop(),t=e.extend({offset:[0,0],speed:1.2,curve:1.42,easing:e.ease},t);var a=this.transform,o=this.getZoom(),s=this.getBearing(),l=this.getPitch(),u=this.getPadding(),c="zoom"in t?e.clamp(+t.zoom,a.minZoom,a.maxZoom):o,h="bearing"in t?this._normalizeBearing(t.bearing,s):s,f="pitch"in t?+t.pitch:l,d="padding"in t?t.padding:a.padding,p=a.zoomScale(c-o),v=e.pointGeometry.convert(t.offset),m=a.centerPoint.add(v),y=a.pointLocation(m),_=e.LngLat.convert(t.center||y);this._normalizeCenter(_);var g=a.project(y),x=a.project(_).sub(g),b=t.curve,w=Math.max(a.width,a.height),k=w/p,T=x.mag();if("minZoom"in t){var E=e.clamp(Math.min(t.minZoom,o,c),a.minZoom,a.maxZoom),S=w/a.zoomScale(E-o);b=Math.sqrt(S/T*2)}var M=b*b;function A(e){var t=(k*k-w*w+(e?-1:1)*M*M*T*T)/(2*(e?k:w)*M*T);return Math.log(Math.sqrt(t*t+1)-t)}function I(e){return(Math.exp(e)-Math.exp(-e))/2}function C(e){return(Math.exp(e)+Math.exp(-e))/2}var z=A(0),P=function(e){return C(z)/C(z+b*e)},D=function(e){return w*((C(z)*(I(t=z+b*e)/C(t))-I(z))/M)/T;var t},L=(A(1)-z)/b;if(Math.abs(T)<1e-6||!isFinite(L)){if(Math.abs(w-k)<1e-6)return this.easeTo(t,i);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)}}t.duration="duration"in t?+t.duration:1e3*L/("screenSpeed"in t?+t.screenSpeed/b:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.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=e.number(s,h,a)),O&&(n.pitch=e.number(l,f,a)),F&&(n.interpolatePadding(u,d,a),m=n.centerPoint.add(v));var b=1===a?_:n.unproject(g.add(x.mult(D(p))).mult(y));return n.setLocationAtPoint(n.renderWorldCopies?b.wrap():b,m),n._updateCameraOnTerrain(),t.preloadOnly||r._fireMoveEvents(i),n}};if(t.preloadOnly){var V=this._emulate(U,t.duration,a);return this._preloadTiles(V),this}return this._zooming=!0,this._rotating=B,this._pitching=O,this._padding=F,this._prepareEase(i,!1),this._ease(U(a),(function(){return r._afterEase(i)}),t),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(t,i,r){!1===r.animate||0===r.duration?(t(1),i()):(this._easeStart=e.exported.now(),this._easeOptions=r,this._onEaseFrame=t,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}},{key:"_renderFrameCallback",value:function(){var t=Math.min((e.exported.now()-this._easeStart)/this._easeOptions.duration,1),i=this._onEaseFrame;i&&i(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}},{key:"_normalizeBearing",value:function(t,i){t=e.wrap(t,-180,180);var r=Math.abs(t-i);return Math.abs(t-360-i)<r&&(t-=360),Math.abs(t+360-i)<r&&(t+=360),t}},{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}(e.Evented),ua=function(){function t(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};d(this,t),this.options=i,e.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}return p(t,[{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=_("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=_("button","mapboxgl-ctrl-attrib-button",this._container),_("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=_("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","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}},{key:"_updateEditLink",value:function(){var t=this._editLink;t||(t=this._editLink=this._container.querySelector(".mapbox-improve-map"));var i=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||e.config.ACCESS_TOKEN}];if(t){var r=i.reduce((function(e,t,r){return t.value&&(e+="".concat(t.key,"=").concat(t.value).concat(r<i.length-1?"&":"")),e}),"?");t.href="".concat(e.config.FEEDBACK_URL,"/").concat(r,"#").concat(fn(this._map,!0)),t.rel="noopener nofollow",this._setElementTitle(t,"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 r in i){var n=i[r];if(n.used){var a=n.getSource();a.attribution&&e.indexOf(a.attribution)<0&&e.push(a.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(c(this.options.customAttribution),c(e)):e.unshift(this.options.customAttribution));var o=e.join(" | ");o!==this._attribHTML&&(this._attribHTML=o,e.length?(this._innerContainer.innerHTML=o,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")}}]),t}(),ca=function(){function t(){d(this,t),e.bindAll(["_updateLogo","_updateCompact"],this)}return p(t,[{key:"onAdd",value:function(e){this._map=e,this._container=_("div","mapboxgl-ctrl");var t=_("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")}}}]),t}(),ha=function(){function e(){d(this,e),this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}return p(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=i?this._queue.concat(i):this._queue,n=f(r);try{for(n.s();!(t=n.n()).done;){var a=t.value;if(a.id===e)return void(a.cancelled=!0)}}catch(o){n.e(o)}finally{n.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=f(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 fa(t,i,r){if(t=new e.LngLat(t.lng,t.lat),i){var n=new e.LngLat(t.lng-360,t.lat),a=new e.LngLat(t.lng+360,t.lat),o=360*Math.ceil(Math.abs(t.lng-r.center.lng)/360),s=r.locationPoint(t).distSqr(i),l=i.x<0||i.y<0||i.x>r.width||i.y>r.height;r.locationPoint(n).distSqr(i)<s&&(l||Math.abs(n.lng-r.center.lng)<o)?t=n:r.locationPoint(a).distSqr(i)<s&&(l||Math.abs(a.lng-r.center.lng)<o)&&(t=a)}for(;Math.abs(t.lng-r.center.lng)>180;){var u=r.locationPoint(t);if(u.x>=0&&u.y>=0&&u.x<=r.width&&u.y<=r.height)break;t.lng>r.center.lng?t.lng-=360:t.lng+=360}return t}var da={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%)"},pa=function(t){v(r,t);var i=m(r);function r(t,a){var o;if(d(this,r),o=i.call(this),(t instanceof e.window.HTMLElement||a)&&(t=e.extend({element:t},a)),e.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],n(o)),o._anchor=t&&t.anchor||"center",o._color=t&&t.color||"#3FB1CE",o._scale=t&&t.scale||1,o._draggable=t&&t.draggable||!1,o._clickTolerance=t&&t.clickTolerance||0,o._isDragging=!1,o._state="inactive",o._rotation=t&&t.rotation||0,o._rotationAlignment=t&&t.rotationAlignment||"auto",o._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment||"auto",o._updateMoving=function(){return o._update(!0)},o._occludedOpacity=t&&t.occludedOpacity||.2,t&&t.element)o._element=t.element,o._offset=e.pointGeometry.convert(t&&t.offset||[0,0]);else{o._defaultMarker=!0,o._element=_("div");var s=41,u=27,c=g("svg",{display:"block",height:s*o._scale+"px",width:u*o._scale+"px",viewBox:"0 0 ".concat(u," ").concat(s)},o._element),h=g("radialGradient",{id:"shadowGradient"},g("defs",{},c));g("stop",{offset:"10%","stop-opacity":.4},h),g("stop",{offset:"100%","stop-opacity":.05},h),g("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},c),g("path",{fill:o._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"},c),g("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"},c),g("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},c),o._offset=e.pointGeometry.convert(t&&t.offset||[0,-14])}o._element.hasAttribute("aria-label")||o._element.setAttribute("aria-label","Map marker"),o._element.classList.add("mapboxgl-marker"),o._element.addEventListener("dragstart",(function(e){e.preventDefault()})),o._element.addEventListener("mousedown",(function(e){e.preventDefault()}));var f=o._element.classList;for(var p in da)f.remove("mapboxgl-marker-anchor-".concat(p));return f.add("mapboxgl-marker-anchor-".concat(o._anchor)),o._popup=null,l(o)}return p(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(t){return this._lngLat=e.LngLat.convert(t),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:[0,-t],"bottom-left":[r,-1*(t-i+r)],"bottom-right":[-r,-1*(t-i+r)],left:[i,-1*(t-i)],right:[-i,-1*(t-i)]}:this._offset}this._popup=e,e._marker=this,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}},{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 t=this._map;if(t){var i=this._pos;if(!i||i.x<0||i.x>t.transform.width||i.y<0||i.y>t.transform.height)this._clearFadeTimer();else{var r,n=t.unproject(i);t._showingGlobe()&&e.isLngLatBehindGlobe(t.transform,this._lngLat)?r=0:(r=1-t._queryFogOpacity(n),t.transform._terrainEnabled()&&t.getTerrain()&&this._behindTerrain()&&(r*=this._occludedOpacity)),this._element.style.opacity="".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(da[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 t=this._pos,i=this._map,r=this.getPitchAlignment();if(!i||!t||"map"!==r)return"";if(!i._showingGlobe()){var n=i.getPitch();return n?"rotateX(".concat(n,"deg)"):""}var a=e.radToDeg(e.globeTiltAtLngLat(i.transform,this._lngLat)),o=t.sub(e.globeCenterToScreenPoint(i.transform)),s=Math.abs(o.x)+Math.abs(o.y);if(0===s)return"";var l=a/s;return"rotateX(".concat(-o.y*l,"deg) rotateY(").concat(o.x*l,"deg)")}},{key:"_calculateZTransform",value:function(){var t=this._pos,i=this._map;if(!i||!t)return"";var r=0,n=this.getRotationAlignment();if("map"===n)if(i._showingGlobe()){var a=i.project(new e.LngLat(this._lngLat.lng,this._lngLat.lat+.001)),o=i.project(new e.LngLat(this._lngLat.lng,this._lngLat.lat-.001)).sub(a);r=e.radToDeg(Math.atan2(o.y,o.x))-90}else r=-i.getBearing();else if("horizon"===n){var s=e.smoothstep(4,6,i.getZoom()),l=e.globeCenterToScreenPoint(i.transform);l.y+=s*i.transform.height;var u=t.sub(l),c=e.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(t){var i=this;e.window.cancelAnimationFrame(this._updateFrameId);var r=this._map;r&&(r.transform.renderWorldCopies&&(this._lngLat=fa(this._lngLat,this._pos,r.transform)),this._pos=r.project(this._lngLat),!0===t?this._updateFrameId=e.window.requestAnimationFrame((function(){i._element&&i._pos&&i._anchor&&(i._pos=i._pos.round(),i._updateDOM())})):this._pos=this._pos.round(),r._requestDomTask((function(){i._map&&(i._element&&i._pos&&i._anchor&&i._updateDOM(),(r._showingGlobe()||r.getTerrain()||r.getFog())&&!i._fadeTimer&&(i._fadeTimer=setTimeout(i._evaluateOpacity.bind(i),60)))})))}},{key:"getOffset",value:function(){return this._offset}},{key:"setOffset",value:function(t){return this._offset=e.pointGeometry.convert(t),this._update(),this}},{key:"_onMove",value:function(t){var i=this._map;if(i){var r=this._pointerdownPos,n=this._positionDelta;if(r&&n){if(!this._isDragging){var a=this._clickTolerance||i._clickTolerance;if(t.point.dist(r)<a)return;this._isDragging=!0}this._pos=t.point.sub(n),this._lngLat=i.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new e.Event("dragstart"))),this.fire(new e.Event("drag"))}}}},{key:"_onUp",value:function(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;var t=this._map;t&&(t.off("mousemove",this._onMove),t.off("touchmove",this._onMove)),"active"===this._state&&this.fire(new e.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}(e.Evented),va={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},ma=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function ya(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new e.pointGeometry(0,0),i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"bottom";if("number"==typeof t){var r=Math.round(Math.sqrt(.5*Math.pow(t,2)));switch(i){case"top":return new e.pointGeometry(0,t);case"top-left":return new e.pointGeometry(r,r);case"top-right":return new e.pointGeometry(-r,r);case"bottom":return new e.pointGeometry(0,-t);case"bottom-left":return new e.pointGeometry(r,-r);case"bottom-right":return new e.pointGeometry(-r,-r);case"left":return new e.pointGeometry(t,0);case"right":return new e.pointGeometry(-t,0)}return new e.pointGeometry(0,0)}return t instanceof e.pointGeometry||Array.isArray(t)?e.pointGeometry.convert(t):e.pointGeometry.convert(t[i]||[0,0])}var _a=function(){function t(e){d(this,t),this.jumpTo(e)}return p(t,[{key:"getValue",value:function(t){if(t<=this._startTime)return this._start;if(t>=this._endTime)return this._end;var i=e.easeCubicInOut((t-this._startTime)/(this._endTime-this._startTime));return this._start*(1-i)+this._end*i}},{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}}]),t}(),ga={"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"},xa={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,optimizeForTerrain:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,crossSourceCollisions:!0},ba={showCompass:!0,showZoom:!0,visualizePitch:!1},wa=function(){function t(i,r){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];d(this,t),this._clickTolerance=10,this.element=r,this.mouseRotate=new Ln({clickTolerance:i.dragRotate._mouseRotate._clickTolerance}),this.map=i,n&&(this.mousePitch=new Rn({clickTolerance:i.dragRotate._mousePitch._clickTolerance})),e.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 p(t,[{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(),e.window.removeEventListener("mousemove",this.mousemove),e.window.removeEventListener("mouseup",this.mouseup)}},{key:"mousedown",value:function(t){this.down(e.extend({},t,{ctrlKey:!0,preventDefault:function(){return t.preventDefault()}}),M(this.element,t)),e.window.addEventListener("mousemove",this.mousemove),e.window.addEventListener("mouseup",this.mouseup)}},{key:"mousemove",value:function(e){this.move(e,M(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=A(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=A(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()}}]),t}(),ka={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},Ta={maxWidth:100,unit:"metric"};function Ea(e,t,i){var r=this,n=Sa(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 Sa(e){var t=Math.pow(10,"".concat(Math.floor(e)).length-1),i=e/t;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:function(e){var t=Math.pow(10,Math.ceil(-Math.log(e)/Math.LN10));return Math.round(e*t)/t}(i),t*i}var Ma={version:e.version,supported:i,setRTLTextPlugin:e.setRTLTextPlugin,getRTLTextPluginStatus:e.getRTLTextPluginStatus,Map:function(t){v(c,t);var a=m(c);function c(t){var i;if(d(this,c),e.LivePerformanceUtils.mark(e.PerformanceMarkers.create),null!=(t=e.extend({},xa,t)).minZoom&&null!=t.maxZoom&&t.minZoom>t.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=t.minPitch&&null!=t.maxPitch&&t.minPitch>t.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=t.minPitch&&t.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=t.maxPitch&&t.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(t.antialias&&e.isSafariWithAntialiasingBug(e.window)&&(t.antialias=!1,e.warnOnce("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),(i=a.call(this,new un(t.minZoom,t.maxZoom,t.minPitch,t.maxPitch,t.renderWorldCopies),t))._interactive=t.interactive,i._minTileCacheSize=t.minTileCacheSize,i._maxTileCacheSize=t.maxTileCacheSize,i._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat,i._preserveDrawingBuffer=t.preserveDrawingBuffer,i._antialias=t.antialias,i._useWebGL2=t.useWebGL2,i._trackResize=t.trackResize,i._bearingSnap=t.bearingSnap,i._refreshExpiredTiles=t.refreshExpiredTiles,i._fadeDuration=t.fadeDuration,i._isInitialLoad=!0,i._crossSourceCollisions=t.crossSourceCollisions,i._collectResourceTiming=t.collectResourceTiming,i._optimizeForTerrain=t.optimizeForTerrain,i._language=i._parseLanguage(t.language),i._worldview=t.worldview,i._renderTaskQueue=new ha,i._domRenderTaskQueue=new ha,i._controls=[],i._markers=[],i._popups=[],i._mapId=e.uniqueId(),i._locale=e.extend({},ga,t.locale),i._clickTolerance=t.clickTolerance,i._cooperativeGestures=t.cooperativeGestures,i._performanceMetricsCollection=t.performanceMetricsCollection,i._containerWidth=0,i._containerHeight=0,i._averageElevationLastSampledAt=-1/0,i._averageElevationExaggeration=0,i._averageElevation=new _a(0),i._interactionRange=[1/0,-1/0],i._visibilityHidden=0,i._useExplicitProjection=!1,i._requestManager=new e.RequestManager(t.transformRequest,t.accessToken,t.testMode),i._silenceAuthErrors=!!t.testMode,"string"==typeof t.container){if(i._container=e.window.document.getElementById(t.container),!i._container)throw new Error("Container '".concat(t.container,"' not found."))}else{if(!(t.container instanceof e.window.HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");i._container=t.container}if(i._container.childNodes.length>0&&e.warnOnce("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),t.maxBounds&&i.setMaxBounds(t.maxBounds),e.bindAll(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],n(i)),i._setupContainer(),i._setupPainter(),void 0===i.painter)throw new Error("Failed to initialize WebGL.");return i.on("move",(function(){return i._update(!1)})),i.on("moveend",(function(){return i._update(!1)})),i.on("zoom",(function(){return i._update(!0)})),void 0!==e.window&&(e.window.addEventListener("online",i._onWindowOnline,!1),e.window.addEventListener("resize",i._onWindowResize,!1),e.window.addEventListener("orientationchange",i._onWindowResize,!1),e.window.addEventListener("webkitfullscreenchange",i._onWindowResize,!1),e.window.addEventListener("visibilitychange",i._onVisibilityChange,!1)),i.handlers=new oa(n(i),t),i._localFontFamily=t.localFontFamily,i._localIdeographFontFamily=t.localIdeographFontFamily,t.style&&i.setStyle(t.style,{localFontFamily:i._localFontFamily,localIdeographFontFamily:i._localIdeographFontFamily}),t.projection&&i.setProjection(t.projection),i._hash=t.hash&&new hn("string"==typeof t.hash&&t.hash||void 0).addTo(n(i)),i._hash&&i._hash._onHashChange()||(i.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}),t.bounds&&(i.resize(),i.fitBounds(t.bounds,e.extend({},t.fitBoundsOptions,{duration:0})))),i.resize(),t.attributionControl&&i.addControl(new ua({customAttribution:t.customAttribution})),i._logoControl=new ca,i.addControl(i._logoControl,t.logoPosition),i.on("style.load",(function(){i.transform.unmodified&&i.jumpTo(i.style.stylesheet)})),i.on("data",(function(t){i._update("style"===t.dataType),i.fire(new e.Event("".concat(t.dataType,"data"),t))})),i.on("dataloading",(function(t){i.fire(new e.Event("".concat(t.dataType,"dataloading"),t))})),l(i)}return p(c,[{key:"_getMapId",value:function(){return this._mapId}},{key:"addControl",value:function(t,i){if(void 0===i&&(i=t.getDefaultPosition?t.getDefaultPosition():"top-right"),!t||!t.onAdd)return this.fire(new e.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));var r=t.onAdd(this);this._controls.push(t);var n=this._controlPositions[i];return-1!==i.indexOf("bottom")?n.insertBefore(r,n.firstChild):n.appendChild(r),this}},{key:"removeControl",value:function(t){if(!t||!t.onRemove)return this.fire(new e.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));var i=this._controls.indexOf(t);return i>-1&&this._controls.splice(i,1),t.onRemove(this),this}},{key:"hasControl",value:function(e){return this._controls.indexOf(e)>-1}},{key:"getContainer",value:function(){return this._container}},{key:"getCanvasContainer",value:function(){return this._canvasContainer}},{key:"getCanvas",value:function(){return this._canvas}},{key:"resize",value:function(t){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));var i=!this._moving;return i&&this.fire(new e.Event("movestart",t)).fire(new e.Event("move",t)),this.fire(new e.Event("resize",t)),i&&this.fire(new e.Event("moveend",t)),this}},{key:"getBounds",value:function(){return this.transform.getBounds()}},{key:"getMaxBounds",value:function(){return this.transform.getMaxBounds()||null}},{key:"setMaxBounds",value:function(t){return this.transform.setMaxBounds(e.LngLatBounds.convert(t)),this._update()}},{key:"setMinZoom",value:function(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()<t?this.setZoom(t):this.fire(new e.Event("zoomstart")).fire(new e.Event("zoom")).fire(new e.Event("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}},{key:"getMinZoom",value:function(){return this.transform.minZoom}},{key:"setMaxZoom",value:function(t){if((t=null==t?22:t)>=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t?this.setZoom(t):this.fire(new e.Event("zoomstart")).fire(new e.Event("zoom")).fire(new e.Event("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}},{key:"getMaxZoom",value:function(){return this.transform.maxZoom}},{key:"setMinPitch",value:function(t){if((t=null==t?0:t)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()<t?this.setPitch(t):this.fire(new e.Event("pitchstart")).fire(new e.Event("pitch")).fire(new e.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(t){if((t=null==t?85:t)>85)throw new Error("maxPitch must be less than or equal to 85");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t?this.setPitch(t):this.fire(new e.Event("pitchstart")).fire(new e.Event("pitch")).fire(new e.Event("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}},{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(t){return"auto"===t?e.window.navigator.language:Array.isArray(t)?0===t.length?void 0:t.map((function(t){return"auto"===t?e.window.navigator.language:t})):t}},{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=f(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 t,i=this.transform,r=i.projection.name;"globe"===r&&i.zoom>=e.GLOBE_ZOOM_THRESHOLD_MAX?(i.setMercatorFromTransition(),t=!0):"mercator"===r&&i.zoom<e.GLOBE_ZOOM_THRESHOLD_MAX&&(i.setProjection({name:"globe"}),t=!0),t&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayerUpdate())}}},{key:"_prioritizeAndUpdateProjection",value:function(e,t){return this._updateProjection(e||t||{name:"mercator"})}},{key:"_updateProjection",value:function(t){var i;if(i="globe"===t.name&&this.transform.zoom>=e.GLOBE_ZOOM_THRESHOLD_MAX?this.transform.setMercatorFromTransition():this.transform.setProjection(t),this.style.applyProjectionUpdate(),i){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(t){return this.transform.locationPoint3D(e.LngLat.convert(t))}},{key:"unproject",value:function(t){return this.transform.pointLocation3D(e.pointGeometry.convert(t))}},{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(e,t,i){var n=this;if("mouseenter"===e||"mouseover"===e){var a=!1,o=function(r){var o=t.filter((function(e){return n.getLayer(e)})),s=o.length?n.queryRenderedFeatures(r.point,{layers:o}):[];s.length?a||(a=!0,i.call(n,new bn(e,n,r.originalEvent,{features:s}))):a=!1},s=function(){a=!1};return{layers:new Set(t),listener:i,delegates:{mousemove:o,mouseout:s}}}if("mouseleave"===e||"mouseout"===e){var l=!1,u=function(r){var a=t.filter((function(e){return n.getLayer(e)}));(a.length?n.queryRenderedFeatures(r.point,{layers:a}):[]).length?l=!0:l&&(l=!1,i.call(n,new bn(e,n,r.originalEvent)))},c=function(t){l&&(l=!1,i.call(n,new bn(e,n,t.originalEvent)))};return{layers:new Set(t),listener:i,delegates:{mousemove:u,mouseout:c}}}var h=function(e){var r=t.filter((function(e){return n.getLayer(e)})),a=r.length?n.queryRenderedFeatures(e.point,{layers:r}):[];a.length&&(e.features=a,i.call(n,e),delete e.features)};return{layers:new Set(t),listener:i,delegates:r({},e,h)}}},{key:"on",value:function(e,t,i){if(void 0===i)return o(s(c.prototype),"on",this).call(this,e,t);Array.isArray(t)||(t=[t]);var r=this._createDelegatedListener(e,t,i);for(var n in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(r),r.delegates)this.on(n,r.delegates[n]);return this}},{key:"once",value:function(e,t,i){if(void 0===i)return o(s(c.prototype),"once",this).call(this,e,t);Array.isArray(t)||(t=[t]);var r=this._createDelegatedListener(e,t,i);for(var n in r.delegates)this.once(n,r.delegates[n]);return this}},{key:"off",value:function(e,t,i){var r=this;if(void 0===i)return o(s(c.prototype),"off",this).call(this,e,t);t=new Set(Array.isArray(t)?t:[t]);var n=function(e,t){if(e.size!==t.size)return!1;var i,r=f(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},a=this._delegatedListeners?this._delegatedListeners[e]:void 0;return a&&function(e){for(var a=0;a<e.length;a++){var o=e[a];if(o.listener===i&&n(o.layers,t)){for(var s in o.delegates)r.off(s,o.delegates[s]);return e.splice(a,1),r}}}(a),this}},{key:"queryRenderedFeatures",value:function(t,i){return this.style?(void 0!==i||void 0===t||t instanceof e.pointGeometry||Array.isArray(t)||(i=t,t=void 0),this.style.queryRenderedFeatures(t=t||[[0,0],[this.transform.width,this.transform.height]],i=i||{},this.transform)):[]}},{key:"querySourceFeatures",value:function(e,t){return this.style.querySourceFeatures(e,t)}},{key:"setStyle",value:function(t,i){return!1!==(i=e.extend({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},i)).diff&&i.localIdeographFontFamily===this._localIdeographFontFamily&&i.localFontFamily===this._localFontFamily&&this.style&&t?(this._diffStyle(t,i),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._localFontFamily=i.localFontFamily,this._updateStyle(t,i))}},{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(t,i){var r=this;if("string"==typeof t){var n=this._requestManager.normalizeStyleURL(t),a=this._requestManager.transformRequest(n,e.ResourceType.Style);e.getJSON(a,(function(t,n){t?r.fire(new e.ErrorEvent(t)):n&&r._updateDiff(n,i)}))}else"object"==typeof t&&this._updateDiff(t,i)}},{key:"_updateDiff",value:function(t,i){try{this.style.setState(t)&&this._update(!0)}catch(u){e.warnOnce("Unable to perform style diff: ".concat(u.message||u.error||u,". Rebuilding the style from scratch.")),this._updateStyle(t,i)}}},{key:"getStyle",value:function(){if(this.style)return this.style.serialize()}},{key:"isStyleLoaded",value:function(){return this.style?this.style.loaded():(e.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(t,i){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(),i instanceof e.window.HTMLImageElement||e.window.ImageBitmap&&i instanceof e.window.ImageBitmap){var h=e.exported.getImageData(i),f=h.width,d=h.height,p=h.data;this.style.addImage(t,{data:new e.RGBAImage({width:f,height:d},p),pixelRatio:a,stretchX:l,stretchY:u,content:c,sdf:s,version:0})}else if(void 0===i.width||void 0===i.height)this.fire(new e.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{var v=i.width,m=i.height,y=i;this.style.addImage(t,{data:new e.RGBAImage({width:v,height:m},new Uint8Array(y.data)),pixelRatio:a,stretchX:l,stretchY:u,content:c,sdf:s,version:0,userImage:y}),y.onAdd&&y.onAdd(this,t)}}},{key:"updateImage",value:function(t,i){var r=this.style.getImage(t);if(r){var n=i instanceof e.window.HTMLImageElement||e.window.ImageBitmap&&i instanceof e.window.ImageBitmap?e.exported.getImageData(i):i,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,!(i instanceof e.window.HTMLImageElement||e.window.ImageBitmap&&i instanceof e.window.ImageBitmap)),this.style.updateImage(t,r)):this.fire(new e.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 e.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")))}else this.fire(new e.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")))}},{key:"hasImage",value:function(t){return t?!!this.style.getImage(t):(this.fire(new e.ErrorEvent(new Error("Missing required image id"))),!1)}},{key:"removeImage",value:function(e){this.style.removeImage(e)}},{key:"loadImage",value:function(t,i){e.getImage(this._requestManager.transformRequest(t,e.ResourceType.Image),(function(t,r){i(t,r instanceof e.window.HTMLImageElement?e.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(t){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(e.LngLat.convert(t),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 t,i,r,n=this._container.getBoundingClientRect().width||400,a=this._container.getBoundingClientRect().height||300,o=this._container;o&&(!i||!r);){var s=e.window.getComputedStyle(o).transform;s&&"none"!==s&&((t=s.match(/matrix.*\((.+)\)/)[1].split(", "))[0]&&"0"!==t[0]&&"1"!==t[0]&&(i=t[0]),t[3]&&"0"!==t[3]&&"1"!==t[3]&&(r=t[3])),o=o.parentElement}this._containerWidth=i?Math.abs(n/i):n,this._containerHeight=r?Math.abs(a/r):a}}},{key:"_detectMissingCSS",value:function(){"rgb(250, 128, 114)"!==e.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&e.warnOnce("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}},{key:"_setupContainer",value:function(){var e=this._container;e.classList.add("mapboxgl-map"),(this._missingCSSCanary=_("div","mapboxgl-canary",e)).style.visibility="hidden",this._detectMissingCSS();var t=this._canvasContainer=_("div","mapboxgl-canvas-container",e);this._interactive&&t.classList.add("mapboxgl-interactive"),this._canvas=_("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=_("div","mapboxgl-control-container",e),r=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((function(e){r[e]=_("div","mapboxgl-ctrl-".concat(e),i)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}},{key:"_resizeCanvas",value:function(t,i){var r=e.exported.devicePixelRatio||1;this._canvas.width=r*Math.ceil(t),this._canvas.height=r*Math.ceil(i),this._canvas.style.width="".concat(t,"px"),this._canvas.style.height="".concat(i,"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 t=this,r=e.extend({},i.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),n=this._useWebGL2&&this._canvas.getContext("webgl2",r),a=n||this._canvas.getContext("webgl",r)||this._canvas.getContext("experimental-webgl",r);a?(this._useWebGL2&&!n&&e.warnOnce("Failed to create WebGL 2 context. Using WebGL 1."),e.storeAuthState(a,!0),this.painter=new Yr(a,this.transform,!!n),this.on("data",(function(e){"source"===e.dataType&&t.painter.setTileLoadedFlag(!0)})),e.exported$1.testSupport(a)):this.fire(new e.ErrorEvent(new Error("Failed to initialize WebGL")))}},{key:"_contextLost",value:function(t){t.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new e.Event("webglcontextlost",{originalEvent:t}))}},{key:"_contextRestored",value:function(t){this._setupPainter(),this.resize(),this._update(),this.fire(new e.Event("webglcontextrestored",{originalEvent:t}))}},{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(t){var i,r=this,n=this.painter.context.extTimerQuery,a=e.exported.now();if(this.listens("gpu-timing-frame")&&(i=n.createQueryEXT(),n.beginQueryEXT(n.TIME_ELAPSED_EXT,i)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&(this._interactionRange[0]=Math.min(this._interactionRange[0],e.window.performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],e.window.performance.now())),this._renderTaskQueue.run(t),this._domRenderTaskQueue.run(t),!this._removed){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=e.exported.now(),c=new e.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._markersNeedUpdate=!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 e.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new e.Event("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),i){var f=e.exported.now()-a;n.endQueryEXT(n.TIME_ELAPSED_EXT,i),setTimeout((function(){var t=n.getQueryObjectEXT(i,n.QUERY_RESULT_EXT)/1e6;n.deleteQueryEXT(i),r.fire(new e.Event("gpu-timing-frame",{cpuTime:f,gpuTime:t})),e.window.performance.mark("frame-gpu",{startTime:a,detail:{gpuTime:t}})}),50)}if(this.listens("gpu-timing-layer")){var d=this.painter.collectGpuTimers();setTimeout((function(){var t=r.painter.queryGpuTimers(d);r.fire(new e.Event("gpu-timing-layer",{layerTimes:t}))}),50)}if(this.listens("gpu-timing-deferred-render")){var p=this.painter.collectDeferredRenderGpuQueries();setTimeout((function(){var t=r.painter.queryGpuTimeDeferredRender(p);r.fire(new e.Event("gpu-timing-deferred-render",{gpuTime:t}))}),50)}var v=this._sourcesDirty||this._styleDirty||this._placementDirty||h;if(v||this._repaint)this.triggerRepaint();else{var m=!this.isMoving()&&this.loaded();if(m&&(h=this._updateAverageElevation(a,!0)),h)this.triggerRepaint();else if(this._triggerFrame(!1),m&&(this.fire(new e.Event("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){var y=this._calculateSpeedIndex();this.fire(new e.Event("speedindexcompleted",{speedIndex:y})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||v||(this._fullyLoaded=!0,e.LivePerformanceUtils.mark(e.PerformanceMarkers.fullLoad),this._performanceMetricsCollection&&e.postPerformanceEvent(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}}},{key:"_forceMarkerAndPopupUpdate",value:function(e){var t,i=f(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=f(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>1){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 t=this;e.getMapSessionAPI(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,(function(i){if(i&&(i.message===e.AUTH_ERR_MSG||401===i.status)){var r=t.painter.context.gl;e.storeAuthState(r,!1),t._logoControl instanceof ca&&t._logoControl._updateLogo(),r&&r.clear(r.DEPTH_BUFFER_BIT|r.COLOR_BUFFER_BIT|r.STENCIL_BUFFER_BIT),t._silenceAuthErrors||t.fire(new e.ErrorEvent(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}})),e.postMapLoadEvent(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,(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;l+=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 t,i=f(this._controls);try{for(i.s();!(t=i.n()).done;)t.value.onRemove(this)}catch(n){i.e(n)}finally{i.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!==e.window&&(e.window.removeEventListener("resize",this._onWindowResize,!1),e.window.removeEventListener("orientationchange",this._onWindowResize,!1),e.window.removeEventListener("webkitfullscreenchange",this._onWindowResize,!1),e.window.removeEventListener("online",this._onWindowOnline,!1),e.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),e.removeAuthState(this.painter.context.gl),this._removed=!0,this.fire(new e.Event("remove"))}},{key:"triggerRepaint",value:function(){this._triggerFrame(!0)}},{key:"_triggerFrame",value:function(t){var i=this;this._renderNextFrame=this._renderNextFrame||t,this.style&&!this._frame&&(this._frame=e.exported.frame((function(e){var t=!!i._renderNextFrame;i._frame=null,i._renderNextFrame=null,t&&i._render(e)})))}},{key:"_preloadTiles",value:function(t){var i=this,r=this.style?Object.values(this.style._sourceCaches):[];return e.asyncAll(r,(function(e,i){return e._preloadTiles(t,i)}),(function(){i.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"===e.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(t,i){e.setCacheLimits(t,i)}},{key:"version",get:function(){return e.version}}]),c}(la),NavigationControl:function(){function t(i){var r=this;d(this,t),this.options=e.extend({},ba,i),this._container=_("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",(function(e){return e.preventDefault()})),this.options.showZoom&&(e.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",(function(e){r._map&&r._map.zoomIn({},{originalEvent:e})})),_("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})})),_("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(e.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=_("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}return p(t,[{key:"_updateZoomButtons",value:function(){var e=this._map;if(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 wa(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=_("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)}}}]),t}(),GeolocateControl:function(t){v(r,t);var i=m(r);function r(t){var a;return d(this,r),(a=i.call(this)).options=e.extend({geolocation:e.window.navigator.geolocation},ka,t),e.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],n(a)),a._updateMarkerRotationThrottled=cn(a._updateMarkerRotation,20),a._numberOfWatches=0,a}return p(r,[{key:"onAdd",value:function(e){return this._map=e,this._container=_("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(t){var i=this,r=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:!!i.options.geolocation;i._supportsGeolocation=e,t(e)};void 0!==this._supportsGeolocation?t(this._supportsGeolocation):void 0!==e.window.navigator.permissions?e.window.navigator.permissions.query({name:"geolocation"}).then((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(t){if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new e.Event("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(t),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new e.Event("geolocate",t)),this._finish()}}},{key:"_updateCamera",value:function(t){var i=new e.LngLat(t.coords.longitude,t.coords.latitude),r=t.coords.accuracy,n=this._map.getBearing(),a=e.extend({bearing:n},this.options.fitBoundsOptions);this._map.fitBounds(i.toBounds(r),a,{geolocateSource:!0})}},{key:"_updateMarker",value:function(t){if(t){var i=new e.LngLat(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}},{key:"_updateCircleRadius",value:function(){var t=this._map.transform,i=e.mercatorZfromAltitude(1,t._center.lat)*t.worldSize,r=Math.ceil(2*this._accuracy*i);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(t){if(this._map){if(this.options.trackUserLocation)if(1===t.code){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;var i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",i),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",i),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===t.code&&this._noTimeout)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new e.Event("error",t)),this._finish()}}},{key:"_finish",value:function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}},{key:"_setupUI",value:function(t){var i=this;if(void 0!==this._map){if(this._container.addEventListener("contextmenu",(function(e){return e.preventDefault()})),this._geolocateButton=_("button","mapboxgl-ctrl-geolocate",this._container),_("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===t){e.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");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","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=_("div","mapboxgl-user-location"),this._dotElement.appendChild(_("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(_("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new pa({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=_("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new pa({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(t){t.geolocateSource||"ACTIVE_LOCK"!==i._watchState||t.originalEvent&&"resize"===t.originalEvent.type||(i._watchState="BACKGROUND",i._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),i._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),i.fire(new e.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 e.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new e.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new e.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new e.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){var t;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(t={maximumAge:6e5,timeout:0},this._noTimeout=!0):(t=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,t),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 t=this,i=function(){e.window.addEventListener("ondeviceorientationabsolute"in e.window?"deviceorientationabsolute":"deviceorientation",t._onDeviceOrientation)};void 0!==e.window.DeviceMotionEvent&&"function"==typeof e.window.DeviceMotionEvent.requestPermission?DeviceOrientationEvent.requestPermission().then((function(e){"granted"===e&&i()})).catch(console.error):i()}},{key:"_clearWatch",value:function(){this.options.geolocation.clearWatch(this._geolocationWatchID),e.window.removeEventListener("deviceorientation",this._onDeviceOrientation),e.window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}}]),r}(e.Evented),AttributionControl:ua,ScaleControl:function(){function t(i){d(this,t),this.options=e.extend({},Ta,i),function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"narrow",unit:"meter"}),!0}catch(e){return!1}}()||(this._setScale=Ea.bind(this)),e.bindAll(["_update","_setScale","setUnit"],this)}return p(t,[{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=Sa(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=_("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()}}]),t}(),FullscreenControl:function(){function t(i){d(this,t),this._fullscreen=!1,i&&i.container&&(i.container instanceof e.window.HTMLElement?this._container=i.container:e.warnOnce("Full screen control 'container' must be a DOM element.")),e.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in e.window.document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in e.window.document&&(this._fullscreenchange="webkitfullscreenchange")}return p(t,[{key:"onAdd",value:function(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=_("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",e.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}},{key:"onRemove",value:function(){this._controlContainer.remove(),this._map=null,e.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}},{key:"_checkFullscreenSupport",value:function(){return!(!e.window.document.fullscreenEnabled&&!e.window.document.webkitFullscreenEnabled)}},{key:"_setupUI",value:function(){var t=this._fullscreenButton=_("button","mapboxgl-ctrl-fullscreen",this._controlContainer);_("span","mapboxgl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),e.window.document.addEventListener(this._fullscreenchange,this._changeIcon)}},{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(){(e.window.document.fullscreenElement||e.window.document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}},{key:"_onClickFullscreen",value:function(){this._isFullscreen()?e.window.document.exitFullscreen?e.window.document.exitFullscreen():e.window.document.webkitCancelFullScreen&&e.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}}]),t}(),Popup:function(t){v(r,t);var i=m(r);function r(t){var a;return d(this,r),(a=i.call(this)).options=e.extend(Object.create(va),t),e.bindAll(["_update","_onClose","remove","_onMouseEvent"],n(a)),a._classList=new Set(t&&t.className?t.className.trim().split(/\s+/):[]),a}return p(r,[{key:"addTo",value:function(t){return this._map&&this.remove(),this._map=t,this.options.closeOnClick&&t.on("preclick",this._onClose),this.options.closeOnMove&&t.on("move",this._onClose),t.on("remove",this.remove),this._update(),t._addPopup(this),this._focusFirstElement(),this._trackPointer?(t.on("mousemove",this._onMouseEvent),t.on("mouseup",this._onMouseEvent),t._canvasContainer.classList.add("mapboxgl-track-pointer")):t.on("move",this._update),this.fire(new e.Event("open")),this}},{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 t=this._map;return t&&(t.off("move",this._update),t.off("move",this._onClose),t.off("preclick",this._onClose),t.off("click",this._onClose),t.off("remove",this.remove),t.off("mousemove",this._onMouseEvent),t.off("mouseup",this._onMouseEvent),t.off("drag",this._onMouseEvent),t._canvasContainer&&t._canvasContainer.classList.remove("mapboxgl-track-pointer"),t._removePopup(this),this._map=void 0),this.fire(new e.Event("close")),this}},{key:"getLngLat",value:function(){return this._lngLat}},{key:"setLngLat",value:function(t){this._lngLat=e.LngLat.convert(t),this._pos=null,this._trackPointer=!1,this._update();var i=this._map;return i&&(i.on("move",this._update),i.off("mousemove",this._onMouseEvent),i._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}},{key:"setText",value:function(t){return this.setDOMContent(e.window.document.createTextNode(t))}},{key:"setHTML",value:function(t){var i,r=e.window.document.createDocumentFragment(),n=e.window.document.createElement("body");for(n.innerHTML=t;i=n.firstChild;)r.appendChild(i);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=_("div","mapboxgl-popup-content",this._container||void 0);if(t.appendChild(e),this.options.closeButton){var i=this._closeButton=_("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}},{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=c(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(t){var i=this,r=this._map,n=this._content;if(r&&(this._lngLat||this._trackPointer)&&n){var a=this._container;if(a||(a=this._container=_("div","mapboxgl-popup",r.getContainer()),this._tip=_("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=fa(this._lngLat,this._pos,r.transform)),!this._trackPointer||t){var o=this._pos=this._trackPointer&&t?t:r.project(this._lngLat),s=ya(this.options.offset),l=this._anchor=this._getAnchor(s.y),u=ya(this.options.offset,l),c=o.add(u).round();r._requestDomTask((function(){i._container&&l&&(i._container.style.transform="".concat(da[l]," translate(").concat(c.x,"px,").concat(c.y,"px)"))}))}if(!this._marker&&r._showingGlobe()){var h=e.isLngLatBehindGlobe(r.transform,this._lngLat)?0:1;this._setOpacity(h)}this._updateClassList()}}},{key:"_focusFirstElement",value:function(){if(this.options.focusAfterOpen&&this._container){var e=this._container.querySelector(ma);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")}}]),r}(e.Evented),Marker:pa,Style:fi,LngLat:e.LngLat,LngLatBounds:e.LngLatBounds,Point:e.pointGeometry,MercatorCoordinate:e.MercatorCoordinate,FreeCameraOptions:en,Evented:e.Evented,config:e.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 e.config.ACCESS_TOKEN},set accessToken(t){e.config.ACCESS_TOKEN=t},get baseApiUrl(){return e.config.API_URL},set baseApiUrl(t){e.config.API_URL=t},get workerCount(){return et.workerCount},set workerCount(e){et.workerCount=e},get maxParallelImageRequests(){return e.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){e.config.MAX_PARALLEL_IMAGE_REQUESTS=t},clearStorage:function(t){e.clearTileCache(t)},workerUrl:"",workerClass:null,setNow:e.exported.setNow,restoreNow:e.exported.restoreNow};return Ma})),i}()},3405:function(e,t,i){var r=i(3897);e.exports=function(e){if(Array.isArray(e))return r(e)},e.exports.__esModule=!0,e.exports.default=e.exports},6115:function(e){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},e.exports.__esModule=!0,e.exports.default=e.exports},6690:function(e){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports},3515:function(e,t,i){var r=i(6015),n=i(9617);function a(t,i,o){return n()?(e.exports=a=Reflect.construct.bind(),e.exports.__esModule=!0,e.exports.default=e.exports):(e.exports=a=function(e,t,i){var n=[null];n.push.apply(n,t);var a=new(Function.bind.apply(e,n));return i&&r(a,i.prototype),a},e.exports.__esModule=!0,e.exports.default=e.exports),a.apply(null,arguments)}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports},9728:function(e,t,i){var r=i(4062);function n(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,r(n.key),n)}}e.exports=function(e,t,i){return t&&n(e.prototype,t),i&&n(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e},e.exports.__esModule=!0,e.exports.default=e.exports},4704:function(e,t,i){var r=i(6116);e.exports=function(e,t){var i="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!i){if(Array.isArray(e)||(i=r(e))||t&&e&&"number"===typeof e.length){i&&(e=i);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,l=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return s=e.done,e},e:function(e){l=!0,o=e},f:function(){try{s||null==i.return||i.return()}finally{if(l)throw o}}}},e.exports.__esModule=!0,e.exports.default=e.exports},6389:function(e,t,i){var r=i(3808),n=i(9617),a=i(4993);e.exports=function(e){var t=n();return function(){var i,n=r(e);if(t){var o=r(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return a(this,i)}},e.exports.__esModule=!0,e.exports.default=e.exports},8416:function(e,t,i){var r=i(4062);e.exports=function(e,t,i){return(t=r(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e},e.exports.__esModule=!0,e.exports.default=e.exports},1588:function(e,t,i){var r=i(1753);function n(){return"undefined"!==typeof Reflect&&Reflect.get?(e.exports=n=Reflect.get.bind(),e.exports.__esModule=!0,e.exports.default=e.exports):(e.exports=n=function(e,t,i){var n=r(e,t);if(n){var a=Object.getOwnPropertyDescriptor(n,t);return a.get?a.get.call(arguments.length<3?e:i):a.value}},e.exports.__esModule=!0,e.exports.default=e.exports),n.apply(this,arguments)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports},3808:function(e){function t(i){return e.exports=t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},e.exports.__esModule=!0,e.exports.default=e.exports,t(i)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},1655:function(e,t,i){var r=i(6015);e.exports=function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&r(e,t)},e.exports.__esModule=!0,e.exports.default=e.exports},6035:function(e){e.exports=function(e){return-1!==Function.toString.call(e).indexOf("[native code]")},e.exports.__esModule=!0,e.exports.default=e.exports},9617:function(e){e.exports=function(){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}},e.exports.__esModule=!0,e.exports.default=e.exports},9498:function(e){e.exports=function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)},e.exports.__esModule=!0,e.exports.default=e.exports},2281:function(e){e.exports=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.")},e.exports.__esModule=!0,e.exports.default=e.exports},4993:function(e,t,i){var r=i(8698).default,n=i(6115);e.exports=function(e,t){if(t&&("object"===r(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return n(e)},e.exports.__esModule=!0,e.exports.default=e.exports},6015:function(e){function t(i,r){return e.exports=t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},e.exports.__esModule=!0,e.exports.default=e.exports,t(i,r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},1753:function(e,t,i){var r=i(3808);e.exports=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=r(e)););return e},e.exports.__esModule=!0,e.exports.default=e.exports},1589:function(e,t,i){var r=i(5372),n=i(9498),a=i(6116),o=i(2218);e.exports=function(e){return r(e)||n(e)||a(e)||o()},e.exports.__esModule=!0,e.exports.default=e.exports},861:function(e,t,i){var r=i(3405),n=i(9498),a=i(6116),o=i(2281);e.exports=function(e){return r(e)||n(e)||a(e)||o()},e.exports.__esModule=!0,e.exports.default=e.exports},5036:function(e,t,i){var r=i(8698).default;e.exports=function(e,t){if("object"!==r(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!==r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},4062:function(e,t,i){var r=i(8698).default,n=i(5036);e.exports=function(e){var t=n(e,"string");return"symbol"===r(t)?t:String(t)},e.exports.__esModule=!0,e.exports.default=e.exports},3496:function(e,t,i){var r=i(3808),n=i(6015),a=i(6035),o=i(3515);function s(t){var i="function"===typeof Map?new Map:void 0;return e.exports=s=function(e){if(null===e||!a(e))return e;if("function"!==typeof e)throw new TypeError("Super expression must either be null or a function");if("undefined"!==typeof i){if(i.has(e))return i.get(e);i.set(e,t)}function t(){return o(e,arguments,r(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),n(t,e)},e.exports.__esModule=!0,e.exports.default=e.exports,s(t)}e.exports=s,e.exports.__esModule=!0,e.exports.default=e.exports}}]);
//# sourceMappingURL=483.cfd1db64.chunk.js.map