From fa0aa3793d384f6c21aace4adebf40b2cb20e4cb Mon Sep 17 00:00:00 2001 From: Tech2Serve Date: Tue, 5 Jan 2021 14:36:39 -0600 Subject: [PATCH] fix: Check and convert types to string if not already Some sites have trouble displaying meetings when the 11th Step Meditation type, being sanitized to create css classes, throws an error because the 11 is an integer instead of a string. It remains unclear why this only affects a small set of sites. closes #257 --- assets/js/public.min.js | 2 +- assets/src/public.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/assets/js/public.min.js b/assets/js/public.min.js index 69e06801..ad6237f5 100644 --- a/assets/js/public.min.js +++ b/assets/js/public.min.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],e):t.Mark=e(t.jQuery)}(this,function(t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},n=function(){function t(t,e){for(var r=0;r1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5e3;r(this,t),this.ctx=e,this.iframes=n,this.exclude=i,this.iframesTimeout=o}return n(t,[{key:"getContexts",value:function(){var t=[];return(void 0!==this.ctx&&this.ctx?NodeList.prototype.isPrototypeOf(this.ctx)?Array.prototype.slice.call(this.ctx):Array.isArray(this.ctx)?this.ctx:"string"==typeof this.ctx?Array.prototype.slice.call(document.querySelectorAll(this.ctx)):[this.ctx]:[]).forEach(function(e){var r=t.filter(function(t){return t.contains(e)}).length>0;-1!==t.indexOf(e)||r||t.push(e)}),t}},{key:"getIframeContents",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},n=void 0;try{var i=t.contentWindow;if(n=i.document,!i||!n)throw new Error("iframe inaccessible")}catch(t){r()}n&&e(n)}},{key:"isIframeBlank",value:function(t){var e="about:blank",r=t.getAttribute("src").trim();return t.contentWindow.location.href===e&&r!==e&&r}},{key:"observeIframeLoad",value:function(t,e,r){var n=this,i=!1,o=null,a=function a(){if(!i){i=!0,clearTimeout(o);try{n.isIframeBlank(t)||(t.removeEventListener("load",a),n.getIframeContents(t,e,r))}catch(t){r()}}};t.addEventListener("load",a),o=setTimeout(a,this.iframesTimeout)}},{key:"onIframeReady",value:function(t,e,r){try{"complete"===t.contentWindow.document.readyState?this.isIframeBlank(t)?this.observeIframeLoad(t,e,r):this.getIframeContents(t,e,r):this.observeIframeLoad(t,e,r)}catch(t){r()}}},{key:"waitForIframes",value:function(t,e){var r=this,n=0;this.forEachIframe(t,function(){return!0},function(t){n++,r.waitForIframes(t.querySelector("html"),function(){--n||e()})},function(t){t||e()})}},{key:"forEachIframe",value:function(e,r,n){var i=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){},a=e.querySelectorAll("iframe"),s=a.length,l=0;a=Array.prototype.slice.call(a);var u=function(){--s<=0&&o(l)};s||u(),a.forEach(function(e){t.matches(e,i.exclude)?u():i.onIframeReady(e,function(t){r(e)&&(l++,n(t)),u()},u)})}},{key:"createIterator",value:function(t,e,r){return document.createNodeIterator(t,e,r,!1)}},{key:"createInstanceOnIframe",value:function(e){return new t(e.querySelector("html"),this.iframes)}},{key:"compareNodeIframe",value:function(t,e,r){if(t.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_PRECEDING){if(null===e)return!0;if(e.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_FOLLOWING)return!0}return!1}},{key:"getIteratorNode",value:function(t){var e=t.previousNode();return{prevNode:e,node:null===e?t.nextNode():t.nextNode()&&t.nextNode()}}},{key:"checkIframeFilter",value:function(t,e,r,n){var i=!1,o=!1;return n.forEach(function(t,e){t.val===r&&(i=e,o=t.handled)}),this.compareNodeIframe(t,e,r)?(!1!==i||o?!1===i||o||(n[i].handled=!0):n.push({val:r,handled:!0}),!0):(!1===i&&n.push({val:r,handled:!1}),!1)}},{key:"handleOpenIframes",value:function(t,e,r,n){var i=this;t.forEach(function(t){t.handled||i.getIframeContents(t.val,function(t){i.createInstanceOnIframe(t).forEachNode(e,r,n)})})}},{key:"iterateThroughNodes",value:function(t,e,r,n,i){for(var o,a=this,s=this.createIterator(e,t,n),l=[],u=[],c=void 0,h=void 0;o=void 0,o=a.getIteratorNode(s),h=o.prevNode,c=o.node;)this.iframes&&this.forEachIframe(e,function(t){return a.checkIframeFilter(c,h,t,l)},function(e){a.createInstanceOnIframe(e).forEachNode(t,function(t){return u.push(t)},n)}),u.push(c);u.forEach(function(t){r(t)}),this.iframes&&this.handleOpenIframes(l,t,r,n),i()}},{key:"forEachNode",value:function(t,e,r){var n=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){},o=this.getContexts(),a=o.length;a||i(),o.forEach(function(o){var s=function(){n.iterateThroughNodes(t,o,e,r,function(){--a<=0&&i()})};n.iframes?n.waitForIframes(o,s):s()})}}],[{key:"matches",value:function(t,e){var r="string"==typeof e?[e]:e,n=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.webkitMatchesSelector;if(n){var i=!1;return r.every(function(e){return!n.call(t,e)||(i=!0,!1)}),i}return!1}}]),t}(),a=function(){function t(e){r(this,t),this.ctx=e,this.ie=!1;var n=window.navigator.userAgent;(n.indexOf("MSIE")>-1||n.indexOf("Trident")>-1)&&(this.ie=!0)}return n(t,[{key:"log",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"debug",n=this.opt.log;this.opt.debug&&"object"===(void 0===n?"undefined":e(n))&&"function"==typeof n[r]&&n[r]("mark.js: "+t)}},{key:"escapeStr",value:function(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}},{key:"createRegExp",value:function(t){return"disabled"!==this.opt.wildcards&&(t=this.setupWildcardsRegExp(t)),t=this.escapeStr(t),Object.keys(this.opt.synonyms).length&&(t=this.createSynonymsRegExp(t)),(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(t=this.setupIgnoreJoinersRegExp(t)),this.opt.diacritics&&(t=this.createDiacriticsRegExp(t)),t=this.createMergedBlanksRegExp(t),(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(t=this.createJoinersRegExp(t)),"disabled"!==this.opt.wildcards&&(t=this.createWildcardsRegExp(t)),t=this.createAccuracyRegExp(t)}},{key:"createSynonymsRegExp",value:function(t){var e=this.opt.synonyms,r=this.opt.caseSensitive?"":"i",n=this.opt.ignoreJoiners||this.opt.ignorePunctuation.length?"\0":"";for(var i in e)if(e.hasOwnProperty(i)){var o=e[i],a="disabled"!==this.opt.wildcards?this.setupWildcardsRegExp(i):this.escapeStr(i),s="disabled"!==this.opt.wildcards?this.setupWildcardsRegExp(o):this.escapeStr(o);""!==a&&""!==s&&(t=t.replace(new RegExp("("+this.escapeStr(a)+"|"+this.escapeStr(s)+")","gm"+r),n+"("+this.processSynomyms(a)+"|"+this.processSynomyms(s)+")"+n))}return t}},{key:"processSynomyms",value:function(t){return(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(t=this.setupIgnoreJoinersRegExp(t)),t}},{key:"setupWildcardsRegExp",value:function(t){return(t=t.replace(/(?:\\)*\?/g,function(t){return"\\"===t.charAt(0)?"?":""})).replace(/(?:\\)*\*/g,function(t){return"\\"===t.charAt(0)?"*":""})}},{key:"createWildcardsRegExp",value:function(t){var e="withSpaces"===this.opt.wildcards;return t.replace(/\u0001/g,e?"[\\S\\s]?":"\\S?").replace(/\u0002/g,e?"[\\S\\s]*?":"\\S*")}},{key:"setupIgnoreJoinersRegExp",value:function(t){return t.replace(/[^(|)\\]/g,function(t,e,r){var n=r.charAt(e+1);return/[(|)\\]/.test(n)||""===n?t:t+"\0"})}},{key:"createJoinersRegExp",value:function(t){var e=[],r=this.opt.ignorePunctuation;return Array.isArray(r)&&r.length&&e.push(this.escapeStr(r.join(""))),this.opt.ignoreJoiners&&e.push("\\u00ad\\u200b\\u200c\\u200d"),e.length?t.split(/\u0000+/).join("["+e.join("")+"]*"):t}},{key:"createDiacriticsRegExp",value:function(t){var e=this.opt.caseSensitive?"":"i",r=this.opt.caseSensitive?["aàáảãạăằắẳẵặâầấẩẫậäåāą","AÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÄÅĀĄ","cçćč","CÇĆČ","dđď","DĐĎ","eèéẻẽẹêềếểễệëěēę","EÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ","iìíỉĩịîïī","IÌÍỈĨỊÎÏĪ","lł","LŁ","nñňń","NÑŇŃ","oòóỏõọôồốổỗộơởỡớờợöøō","OÒÓỎÕỌÔỒỐỔỖỘƠỞỠỚỜỢÖØŌ","rř","RŘ","sšśșş","SŠŚȘŞ","tťțţ","TŤȚŢ","uùúủũụưừứửữựûüůū","UÙÚỦŨỤƯỪỨỬỮỰÛÜŮŪ","yýỳỷỹỵÿ","YÝỲỶỸỴŸ","zžżź","ZŽŻŹ"]:["aàáảãạăằắẳẵặâầấẩẫậäåāąAÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÄÅĀĄ","cçćčCÇĆČ","dđďDĐĎ","eèéẻẽẹêềếểễệëěēęEÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ","iìíỉĩịîïīIÌÍỈĨỊÎÏĪ","lłLŁ","nñňńNÑŇŃ","oòóỏõọôồốổỗộơởỡớờợöøōOÒÓỎÕỌÔỒỐỔỖỘƠỞỠỚỜỢÖØŌ","rřRŘ","sšśșşSŠŚȘŞ","tťțţTŤȚŢ","uùúủũụưừứửữựûüůūUÙÚỦŨỤƯỪỨỬỮỰÛÜŮŪ","yýỳỷỹỵÿYÝỲỶỸỴŸ","zžżźZŽŻŹ"],n=[];return t.split("").forEach(function(i){r.every(function(r){if(-1!==r.indexOf(i)){if(n.indexOf(r)>-1)return!1;t=t.replace(new RegExp("["+r+"]","gm"+e),"["+r+"]"),n.push(r)}return!0})}),t}},{key:"createMergedBlanksRegExp",value:function(t){return t.replace(/[\s]+/gim,"[\\s]+")}},{key:"createAccuracyRegExp",value:function(t){var e=this,r=this.opt.accuracy,n="string"==typeof r?r:r.value,i="string"==typeof r?[]:r.limiters,o="";switch(i.forEach(function(t){o+="|"+e.escapeStr(t)}),n){case"partially":default:return"()("+t+")";case"complementary":return"()([^"+(o="\\s"+(o||this.escapeStr("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~¡¿")))+"]*"+t+"[^"+o+"]*)";case"exactly":return"(^|\\s"+o+")("+t+")(?=$|\\s"+o+")"}}},{key:"getSeparatedKeywords",value:function(t){var e=this,r=[];return t.forEach(function(t){e.opt.separateWordSearch?t.split(" ").forEach(function(t){t.trim()&&-1===r.indexOf(t)&&r.push(t)}):t.trim()&&-1===r.indexOf(t)&&r.push(t)}),{keywords:r.sort(function(t,e){return e.length-t.length}),length:r.length}}},{key:"isNumeric",value:function(t){return Number(parseFloat(t))==t}},{key:"checkRanges",value:function(t){var e=this;if(!Array.isArray(t)||"[object Object]"!==Object.prototype.toString.call(t[0]))return this.log("markRanges() will only accept an array of objects"),this.opt.noMatch(t),[];var r=[],n=0;return t.sort(function(t,e){return t.start-e.start}).forEach(function(t){var i=e.callNoMatchOnInvalidRanges(t,n),o=i.start,a=i.end;i.valid&&(t.start=o,t.length=a-o,r.push(t),n=a)}),r}},{key:"callNoMatchOnInvalidRanges",value:function(t,e){var r=void 0,n=void 0,i=!1;return t&&void 0!==t.start?(n=(r=parseInt(t.start,10))+parseInt(t.length,10),this.isNumeric(t.start)&&this.isNumeric(t.length)&&n-e>0&&n-r>0?i=!0:(this.log("Ignoring invalid or overlapping range: "+JSON.stringify(t)),this.opt.noMatch(t))):(this.log("Ignoring invalid range: "+JSON.stringify(t)),this.opt.noMatch(t)),{start:r,end:n,valid:i}}},{key:"checkWhitespaceRanges",value:function(t,e,r){var n=void 0,i=!0,o=r.length,a=e-o,s=parseInt(t.start,10)-a;return(n=(s=s>o?o:s)+parseInt(t.length,10))>o&&(n=o,this.log("End range automatically set to the max value of "+o)),s<0||n-s<0||s>o||n>o?(i=!1,this.log("Invalid range: "+JSON.stringify(t)),this.opt.noMatch(t)):""===r.substring(s,n).replace(/\s+/g,"")&&(i=!1,this.log("Skipping whitespace only range: "+JSON.stringify(t)),this.opt.noMatch(t)),{start:s,end:n,valid:i}}},{key:"getTextNodes",value:function(t){var e=this,r="",n=[];this.iterator.forEachNode(NodeFilter.SHOW_TEXT,function(t){n.push({start:r.length,end:(r+=t.textContent).length,node:t})},function(t){return e.matchesExclude(t.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},function(){t({value:r,nodes:n})})}},{key:"matchesExclude",value:function(t){return o.matches(t,this.opt.exclude.concat(["script","style","title","head","html"]))}},{key:"wrapRangeInTextNode",value:function(t,e,r){var n=this.opt.element?this.opt.element:"mark",i=t.splitText(e),o=i.splitText(r-e),a=document.createElement(n);return a.setAttribute("data-markjs","true"),this.opt.className&&a.setAttribute("class",this.opt.className),a.textContent=i.textContent,i.parentNode.replaceChild(a,i),o}},{key:"wrapRangeInMappedTextNode",value:function(t,e,r,n,i){var o=this;t.nodes.every(function(a,s){var l=t.nodes[s+1];if(void 0===l||l.start>e){if(!n(a.node))return!1;var u=e-a.start,c=(r>a.end?a.end:r)-a.start,h=t.value.substr(0,a.start),p=t.value.substr(c+a.start);if(a.node=o.wrapRangeInTextNode(a.node,u,c),t.value=h+p,t.nodes.forEach(function(e,r){r>=s&&(t.nodes[r].start>0&&r!==s&&(t.nodes[r].start-=c),t.nodes[r].end-=c)}),r-=c,i(a.node.previousSibling,a.start),!(r>a.end))return!1;e=a.end}return!0})}},{key:"wrapMatches",value:function(t,e,r,n,i){var o=this,a=0===e?0:e+1;this.getTextNodes(function(e){e.nodes.forEach(function(e){e=e.node;for(var i=void 0;null!==(i=t.exec(e.textContent))&&""!==i[a];)if(r(i[a],e)){var s=i.index;if(0!==a)for(var l=1;l(n=1))return n;for(;ro?r=i:n=i,i=.5*(n-r)+r}return i},c.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var h=function(t,e,r){this.column=t,this.row=e,this.zoom=r};h.prototype.clone=function(){return new h(this.column,this.row,this.zoom)},h.prototype.zoomTo=function(t){return this.clone()._zoomTo(t)},h.prototype.sub=function(t){return this.clone()._sub(t)},h.prototype._zoomTo=function(t){var e=Math.pow(2,t-this.zoom);return this.column*=e,this.row*=e,this.zoom=t,this},h.prototype._sub=function(t){return t=t.zoomTo(this.zoom),this.column-=t.column,this.row-=t.row,this};var p=f;function f(t,e){this.x=t,this.y=e}function d(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(var r=0;r0;)e[r]=arguments[r+1];for(var n=0,i=e;n(e.y-t.y)*(r.x-t.x)}function z(t){for(var e=0,r=0,n=t.length,i=n-1,o=void 0,a=void 0;r=200&&r.status<300&&r.response?e(null,{data:n,cacheControl:r.getResponseHeader("Cache-Control"),expires:r.getResponseHeader("Expires")}):e(new M(r.statusText,r.status,t.url))},r.send(),r};function D(t,e,r){r[t]&&-1!==r[t].indexOf(e)||(r[t]=r[t]||[],r[t].push(e))}function R(t,e,r){if(r&&r[t]){var n=r[t].indexOf(e);-1!==n&&r[t].splice(n,1)}}var B=function(t,e){void 0===e&&(e={}),v(this,e),this.type=t},O=function(t){function e(e,r){void 0===r&&(r={}),t.call(this,"error",v({error:e},r))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(B),F=function(){};F.prototype.on=function(t,e){return this._listeners=this._listeners||{},D(t,e,this._listeners),this},F.prototype.off=function(t,e){return R(t,e,this._listeners),R(t,e,this._oneTimeListeners),this},F.prototype.once=function(t,e){return this._oneTimeListeners=this._oneTimeListeners||{},D(t,e,this._oneTimeListeners),this},F.prototype.fire=function(t){"string"==typeof t&&(t=new B(t,arguments[1]||{}));var e=t.type;if(this.listens(e)){t.target=this;for(var r=0,n=this._listeners&&this._listeners[e]?this._listeners[e].slice():[];r0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)},F.prototype.setEventedParent=function(t,e){return this._eventedParent=t,this._eventedParentData=e,this};var V={$version:8,$root:{version:{required:!0,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"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.0511,180,85.0511]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.0511,180,85.0511]},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"},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.0511,180,85.0511]},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"},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},lineMetrics:{type:"boolean",default:!1}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{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_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"string",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":"line"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"string",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":"line"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function_stop:{type:"array",minimum:0,maximum:22,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},expression_name:{type:"enum",values:{let:{group:"Variable binding"},var:{group:"Variable binding"},literal:{group:"Types"},array:{group:"Types"},at:{group:"Lookup"},case:{group:"Decision"},match:{group:"Decision"},coalesce:{group:"Decision"},step:{group:"Ramps, scales, curves"},interpolate:{group:"Ramps, scales, curves"},ln2:{group:"Math"},pi:{group:"Math"},e:{group:"Math"},typeof:{group:"Types"},string:{group:"Types"},number:{group:"Types"},boolean:{group:"Types"},object:{group:"Types"},collator:{group:"Types"},"to-string":{group:"Types"},"to-number":{group:"Types"},"to-boolean":{group:"Types"},"to-rgba":{group:"Color"},"to-color":{group:"Types"},rgb:{group:"Color"},rgba:{group:"Color"},get:{group:"Lookup"},has:{group:"Lookup"},length:{group:"Lookup"},properties:{group:"Feature data"},"feature-state":{group:"Feature data"},"geometry-type":{group:"Feature data"},id:{group:"Feature data"},zoom:{group:"Zoom"},"heatmap-density":{group:"Heatmap"},"line-progress":{group:"Heatmap"},"+":{group:"Math"},"*":{group:"Math"},"-":{group:"Math"},"/":{group:"Math"},"%":{group:"Math"},"^":{group:"Math"},sqrt:{group:"Math"},log10:{group:"Math"},ln:{group:"Math"},log2:{group:"Math"},sin:{group:"Math"},cos:{group:"Math"},tan:{group:"Math"},asin:{group:"Math"},acos:{group:"Math"},atan:{group:"Math"},min:{group:"Math"},max:{group:"Math"},round:{group:"Math"},abs:{group:"Math"},ceil:{group:"Math"},floor:{group:"Math"},"==":{group:"Decision"},"!=":{group:"Decision"},">":{group:"Decision"},"<":{group:"Decision"},">=":{group:"Decision"},"<=":{group:"Decision"},all:{group:"Decision"},any:{group:"Decision"},"!":{group:"Decision"},"is-supported-script":{group:"String"},upcase:{group:"String"},downcase:{group:"String"},concat:{group:"String"},"resolved-locale":{group:"String"}}},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"string",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"string",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"string",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"string",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}}},N=function(t,e,r,n){this.message=(t?t+": ":"")+r,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__)};function j(t){var e=t.key,r=t.value;return r?[new N(e,r,"constants have been deprecated as of v8")]:[]}function U(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];for(var n=0,i=e;n":"value"===t.itemType.kind?"array":"array<"+e+">"}return t.kind}var nt=[W,X,H,K,J,Y,et(Q)];function it(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&!it(t.itemType,e.itemType)&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(var r=0,n=nt;r255?255:t}function i(t){return t<0?0:t>1?1:t}function o(t){return"%"===t[t.length-1]?n(parseFloat(t)/100*255):n(parseInt(t))}function a(t){return"%"===t[t.length-1]?i(parseFloat(t)/100):i(parseFloat(t))}function s(t,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?t+(e-t)*r*6:2*r<1?e:3*r<2?t+(e-t)*(2/3-r)*6:t}try{e.parseCSSColor=function(t){var e,i=t.replace(/ /g,"").toLowerCase();if(i in r)return r[i].slice();if("#"===i[0])return 4===i.length?(e=parseInt(i.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===i.length&&(e=parseInt(i.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var l=i.indexOf("("),u=i.indexOf(")");if(-1!==l&&u+1===i.length){var c=i.substr(0,l),h=i.substr(l+1,u-(l+1)).split(","),p=1;switch(c){case"rgba":if(4!==h.length)return null;p=a(h.pop());case"rgb":return 3!==h.length?null:[o(h[0]),o(h[1]),o(h[2]),p];case"hsla":if(4!==h.length)return null;p=a(h.pop());case"hsl":if(3!==h.length)return null;var f=(parseFloat(h[0])%360+360)%360/360,d=a(h[1]),m=a(h[2]),y=m<=.5?m*(d+1):m+d-m*d,g=2*m-y;return[n(255*s(g,y,f+1/3)),n(255*s(g,y,f)),n(255*s(g,y,f-1/3)),p];default:return null}}return null}}catch(t){}}).parseCSSColor,at=function(t,e,r,n){void 0===n&&(n=1),this.r=t,this.g=e,this.b=r,this.a=n};at.parse=function(t){if(t){if(t instanceof at)return t;if("string"==typeof t){var e=ot(t);if(e)return new at(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3])}}},at.prototype.toString=function(){var t=this.toArray(),e=t[0],r=t[1],n=t[2],i=t[3];return"rgba("+Math.round(e)+","+Math.round(r)+","+Math.round(n)+","+i+")"},at.prototype.toArray=function(){var t=this.r,e=this.g,r=this.b,n=this.a;return 0===n?[0,0,0,0]:[255*t/n,255*e/n,255*r/n,n]},at.black=new at(0,0,0,1),at.white=new at(1,1,1,1),at.transparent=new at(0,0,0,0);var st=function(t,e,r){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})};st.prototype.compare=function(t,e){return this.collator.compare(t,e)},st.prototype.resolvedLocale=function(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale};var lt=function(t,e,r){this.type=tt,this.locale=r,this.caseSensitive=t,this.diacriticSensitive=e};function ut(t,e,r,n){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:"Invalid rgba value ["+[t,e,r,n].join(", ")+"]: 'a' must be between 0 and 1.":"Invalid rgba value ["+("number"==typeof n?[t,e,r,n]:[t,e,r]).join(", ")+"]: 'r', 'g', and 'b' must be between 0 and 255."}function ct(t){if(null===t)return W;if("string"==typeof t)return H;if("boolean"==typeof t)return K;if("number"==typeof t)return X;if(t instanceof at)return J;if(t instanceof st)return tt;if(Array.isArray(t)){for(var e,r=t.length,n=0,i=t;n4)return e.error("Expected 1, 2, or 3 arguments, but found "+(t.length-1)+" instead.");var r,n;if(t.length>2){var i=t[1];if("string"!=typeof i||!(i in mt))return e.error('The item type argument of "array" must be one of string, number, boolean',1);r=mt[i]}else r=Q;if(t.length>3){if("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2]))return e.error('The length argument to "array" must be a positive integer literal',2);n=t[2]}var o=et(r,n),a=e.parse(t[t.length-1],t.length-1,Q);return a?new yt(o,a):null},yt.prototype.evaluate=function(t){var e=this.input.evaluate(t);if(it(this.type,ct(e)))throw new pt("Expected value to be of type "+rt(this.type)+", but found "+rt(ct(e))+" instead.");return e},yt.prototype.eachChild=function(t){t(this.input)},yt.prototype.possibleOutputs=function(){return this.input.possibleOutputs()},yt.prototype.serialize=function(){var t=["array"],e=this.type.itemType;if("string"===e.kind||"number"===e.kind||"boolean"===e.kind){t.push(e.kind);var r=this.type.N;"number"==typeof r&&t.push(r)}return t.push(this.input.serialize()),t};var gt={"to-number":X,"to-color":J},vt=function(t,e){this.type=t,this.args=e};vt.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");for(var r=t[0],n=gt[r],i=[],o=1;o4?"Invalid rbga value "+JSON.stringify(e)+": expected an array containing either three or four numeric values.":ut(e[0],e[1],e[2],e[3])))return new at(e[0]/255,e[1]/255,e[2]/255,e[3]);throw new pt(r||"Could not parse color from value '"+("string"==typeof e?e:JSON.stringify(e))+"'")}for(var a=null,s=0,l=this.args;s=0)return!1;var r=!0;return t.eachChild(function(t){r&&!St(t,e)&&(r=!1)}),r}bt.prototype.evaluate=function(t){return this._evaluate(t,this.args)},bt.prototype.eachChild=function(t){this.args.forEach(t)},bt.prototype.possibleOutputs=function(){return[void 0]},bt.prototype.serialize=function(){return[this.name].concat(this.args.map(function(t){return t.serialize()}))},bt.parse=function(t,e){var r=t[0],n=bt.definitions[r];if(!n)return e.error('Unknown expression "'+r+'". If you wanted a literal array, use ["literal", [...]].',0);for(var i=Array.isArray(n)?n[0]:n.type,o=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,a=o.filter(function(e){var r=e[0];return!Array.isArray(r)||r.length===t.length-1}),s=[],l=1;lr&&ee))throw new pt("Input is not a number.");o=a-1}}return Math.max(a-1,0)}kt.prototype.parse=function(t,e,r,n,i){return void 0===i&&(i={}),e?this.concat(e,r,n)._parse(t,i):this._parse(t,i)},kt.prototype._parse=function(t,e){if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');var r=t[0];if("string"!=typeof r)return this.error("Expression name must be a string, but found "+typeof r+' instead. If you wanted a literal array, use ["literal", [...]].',0),null;var n=this.registry[r];if(n){var i=n.parse(t,this);if(!i)return null;if(this.expectedType){var o=this.expectedType,a=i.type;if("string"!==o.kind&&"number"!==o.kind&&"boolean"!==o.kind&&"object"!==o.kind||"value"!==a.kind)if("array"===o.kind&&"value"===a.kind)e.omitTypeAnnotations||(i=new yt(o,i));else if("color"!==o.kind||"value"!==a.kind&&"string"!==a.kind){if(this.checkSubtype(this.expectedType,i.type))return null}else e.omitTypeAnnotations||(i=new vt(o,[i]));else e.omitTypeAnnotations||(i=new dt(o,[i]))}if(!(i instanceof ht)&&function t(e){if(e instanceof Tt)return t(e.boundExpression);if(e instanceof bt&&"error"===e.name)return!1;if(e instanceof lt)return!1;var r=e instanceof vt||e instanceof dt||e instanceof yt,n=!0;return e.eachChild(function(e){n=r?n&&t(e):n&&e instanceof ht}),!!n&&(wt(e)&&St(e,["zoom","heatmap-density","line-progress","is-supported-script"]))}(i)){var s=new xt;try{i=new ht(i.type,i.evaluate(s))}catch(t){return this.error(t.message),null}}return i}return this.error('Unknown expression "'+r+'". If you wanted a literal array, use ["literal", [...]].',0)}return void 0===t?this.error("'undefined' value invalid. Use null instead."):"object"==typeof t?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error("Expected an array, but found "+typeof t+" instead.")},kt.prototype.concat=function(t,e,r){var n="number"==typeof t?this.path.concat(t):this.path,i=r?this.scope.concat(r):this.scope;return new kt(this.registry,n,e||null,i,this.errors)},kt.prototype.error=function(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];var n=""+this.key+e.map(function(t){return"["+t+"]"}).join("");this.errors.push(new Z(n,t))},kt.prototype.checkSubtype=function(t,e){var r=it(t,e);return r&&this.error(r),r};var It=function(t,e,r){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(var n=0,i=r;n=s)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',u);var h=e.parse(l,c,o);if(!h)return null;o=o||h.type,i.push([s,h])}return new It(o,r,i)},It.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);var i=e.length;return n>=e[i-1]?r[i-1].evaluate(t):r[At(e,n)].evaluate(t)},It.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t};var zt=Ct;function Ct(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=r,this.p2y=n}function Mt(t,e,r){return t*(1-r)+e*r}Ct.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},Ct.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},Ct.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},Ct.prototype.solveCurveX=function(t,e){var r,n,i,o,a;for(void 0===e&&(e=1e-6),i=t,a=0;a<8;a++){if(o=this.sampleCurveX(i)-t,Math.abs(o)(n=1))return n;for(;ro?r=i:n=i,i=.5*(n-r)+r}return i},Ct.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var Pt=Object.freeze({number:Mt,color:function(t,e,r){return new at(Mt(t.r,e.r,r),Mt(t.g,e.g,r),Mt(t.b,e.b,r),Mt(t.a,e.a,r))},array:function(t,e,r){return t.map(function(t,n){return Mt(t,e[n],r)})}}),Lt=function(t,e,r,n){this.type=t,this.interpolation=e,this.input=r,this.labels=[],this.outputs=[];for(var i=0,o=n;i1}))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:a}}if(t.length-1<4)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(!(n=e.parse(n,2,X)))return null;var s=[],l=null;e.expectedType&&"value"!==e.expectedType.kind&&(l=e.expectedType);for(var u=0;u=c)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',p);var d=e.parse(h,f,l);if(!d)return null;l=l||d.type,s.push([c,d])}return"number"===l.kind||"color"===l.kind||"array"===l.kind&&"number"===l.itemType.kind&&"number"==typeof l.N?new Lt(l,r,n,s):e.error("Type "+rt(l)+" is not interpolatable.")},Lt.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);var i=e.length;if(n>=e[i-1])return r[i-1].evaluate(t);var o=At(e,n),a=e[o],s=e[o+1],l=Lt.interpolationFactor(this.interpolation,n,a,s),u=r[o].evaluate(t),c=r[o+1].evaluate(t);return Pt[this.type.kind.toLowerCase()](u,c,l)},Lt.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e=r.length)throw new pt("Array index out of bounds: "+e+" > "+(r.length-1)+".");if(e!==Math.floor(e))throw new pt("Array index must be an integer, but found "+e+" instead.");return r[e]},Ot.prototype.eachChild=function(t){t(this.index),t(this.input)},Ot.prototype.possibleOutputs=function(){return[void 0]},Ot.prototype.serialize=function(){return["at",this.index.serialize(),this.input.serialize()]};var Ft=function(t,e,r,n,i,o){this.inputType=t,this.type=e,this.input=r,this.cases=n,this.outputs=i,this.otherwise=o};Ft.parse=function(t,e){if(t.length<5)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if(t.length%2!=1)return e.error("Expected an even number of arguments.");var r,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);for(var i={},o=[],a=2;aNumber.MAX_SAFE_INTEGER)return u.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if("number"==typeof p&&Math.floor(p)!==p)return u.error("Numeric branch labels must be integer values.");if(r){if(u.checkSubtype(r,ct(p)))return null}else r=ct(p);if(void 0!==i[String(p)])return u.error("Branch labels must be unique.");i[String(p)]=o.length}var f=e.parse(l,a,n);if(!f)return null;n=n||f.type,o.push(f)}var d=e.parse(t[1],1,Q);if(!d)return null;var m=e.parse(t[t.length-1],t.length-1,n);return m?"value"!==d.type.kind&&e.concat(1).checkSubtype(r,d.type)?null:new Ft(r,n,d,i,o,m):null},Ft.prototype.evaluate=function(t){var e=this.input.evaluate(t);return(ct(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)},Ft.prototype.eachChild=function(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)},Ft.prototype.possibleOutputs=function(){return(t=[]).concat.apply(t,this.outputs.map(function(t){return t.possibleOutputs()})).concat(this.otherwise.possibleOutputs());var t},Ft.prototype.serialize=function(){for(var t=this,e=["match",this.input.serialize()],r=[],n={},i=0,o=Object.keys(this.cases).sort();in.evaluate(t)}function Jt(t,e){var r=e[0],n=e[1];return r.evaluate(t)<=n.evaluate(t)}function Yt(t,e){var r=e[0],n=e[1];return r.evaluate(t)>=n.evaluate(t)}function Qt(t){return{type:t}}function te(t){return{result:"success",value:t}}function ee(t){return{result:"error",value:t}}function re(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function ne(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function ie(t){return!!t.expression&&t.expression.interpolated}bt.register(Zt,{error:[{kind:"error"},[H],function(t,e){var r=e[0];throw new pt(r.evaluate(t))}],typeof:[H,[Q],function(t,e){return rt(ct(e[0].evaluate(t)))}],"to-string":[H,[Q],function(t,e){var r=e[0],n=typeof(r=r.evaluate(t));return null===r?"":"string"===n||"number"===n||"boolean"===n?String(r):r instanceof at?r.toString():JSON.stringify(r)}],"to-boolean":[K,[Q],function(t,e){var r=e[0];return Boolean(r.evaluate(t))}],"to-rgba":[et(X,4),[J],function(t,e){return e[0].evaluate(t).toArray()}],rgb:[J,[X,X,X],Gt],rgba:[J,[X,X,X,X],Gt],has:{type:K,overloads:[[[H],function(t,e){return Wt(e[0].evaluate(t),t.properties())}],[[H,Y],function(t,e){var r=e[0],n=e[1];return Wt(r.evaluate(t),n.evaluate(t))}]]},get:{type:Q,overloads:[[[H],function(t,e){return Xt(e[0].evaluate(t),t.properties())}],[[H,Y],function(t,e){var r=e[0],n=e[1];return Xt(r.evaluate(t),n.evaluate(t))}]]},"feature-state":[Q,[H],function(t,e){return Xt(e[0].evaluate(t),t.featureState||{})}],properties:[Y,[],function(t){return t.properties()}],"geometry-type":[H,[],function(t){return t.geometryType()}],id:[Q,[],function(t){return t.id()}],zoom:[X,[],function(t){return t.globals.zoom}],"heatmap-density":[X,[],function(t){return t.globals.heatmapDensity||0}],"line-progress":[X,[],function(t){return t.globals.lineProgress||0}],"+":[X,Qt(X),function(t,e){for(var r=0,n=0,i=e;n":[K,[H,Q],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],o=n.value;return typeof i==typeof o&&i>o}],"filter-id->":[K,[Q],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n>i}],"filter-<=":[K,[H,Q],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],o=n.value;return typeof i==typeof o&&i<=o}],"filter-id-<=":[K,[Q],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n<=i}],"filter->=":[K,[H,Q],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],o=n.value;return typeof i==typeof o&&i>=o}],"filter-id->=":[K,[Q],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n>=i}],"filter-has":[K,[Q],function(t,e){return e[0].value in t.properties()}],"filter-has-id":[K,[],function(t){return null!==t.id()}],"filter-type-in":[K,[et(H)],function(t,e){return e[0].value.indexOf(t.geometryType())>=0}],"filter-id-in":[K,[et(Q)],function(t,e){return e[0].value.indexOf(t.id())>=0}],"filter-in-small":[K,[H,et(Q)],function(t,e){var r=e[0];return e[1].value.indexOf(t.properties()[r.value])>=0}],"filter-in-large":[K,[H,et(Q)],function(t,e){var r=e[0],n=e[1];return function(t,e,r,n){for(;r<=n;){var i=r+n>>1;if(e[i]===t)return!0;e[i]>t?n=i-1:r=i+1}return!1}(t.properties()[r.value],n.value,0,n.value.length-1)}],">":{type:K,overloads:[[[X,X],Kt],[[H,H],Kt],[[H,H,tt],function(t,e){var r=e[0],n=e[1];return e[2].evaluate(t).compare(r.evaluate(t),n.evaluate(t))>0}]]},"<":{type:K,overloads:[[[X,X],Ht],[[H,H],Ht],[[H,H,tt],function(t,e){var r=e[0],n=e[1];return e[2].evaluate(t).compare(r.evaluate(t),n.evaluate(t))<0}]]},">=":{type:K,overloads:[[[X,X],Yt],[[H,H],Yt],[[H,H,tt],function(t,e){var r=e[0],n=e[1];return e[2].evaluate(t).compare(r.evaluate(t),n.evaluate(t))>=0}]]},"<=":{type:K,overloads:[[[X,X],Jt],[[H,H],Jt],[[H,H,tt],function(t,e){var r=e[0],n=e[1];return e[2].evaluate(t).compare(r.evaluate(t),n.evaluate(t))<=0}]]},all:{type:K,overloads:[[[K,K],function(t,e){var r=e[0],n=e[1];return r.evaluate(t)&&n.evaluate(t)}],[Qt(K),function(t,e){for(var r=0,n=e;rhe?Math.pow(t,1/3):t/ce+le}function me(t){return t>ue?t*t*t:ce*(t-le)}function ye(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function ge(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function ve(t){var e=ge(t.r),r=ge(t.g),n=ge(t.b),i=de((.4124564*e+.3575761*r+.1804375*n)/oe),o=de((.2126729*e+.7151522*r+.072175*n)/ae);return{l:116*o-16,a:500*(i-o),b:200*(o-de((.0193339*e+.119192*r+.9503041*n)/se)),alpha:t.a}}function _e(t){var e=(t.l+16)/116,r=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=ae*me(e),r=oe*me(r),n=se*me(n),new at(ye(3.2404542*r-1.5371385*e-.4985314*n),ye(-.969266*r+1.8760108*e+.041556*n),ye(.0556434*r-.2040259*e+1.0572252*n),t.alpha)}var xe={forward:ve,reverse:_e,interpolate:function(t,e,r){return{l:Mt(t.l,e.l,r),a:Mt(t.a,e.a,r),b:Mt(t.b,e.b,r),alpha:Mt(t.alpha,e.alpha,r)}}},be={forward:function(t){var e=ve(t),r=e.l,n=e.a,i=e.b,o=Math.atan2(i,n)*fe;return{h:o<0?o+360:o,c:Math.sqrt(n*n+i*i),l:r,alpha:t.a}},reverse:function(t){var e=t.h*pe,r=t.c;return _e({l:t.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:t.alpha})},interpolate:function(t,e,r){return{h:function(t,e,r){var n=e-t;return t+r*(n>180||n<-180?n-360*Math.round(n/360):n)}(t.h,e.h,r),c:Mt(t.c,e.c,r),l:Mt(t.l,e.l,r),alpha:Mt(t.alpha,e.alpha,r)}}},we=Object.freeze({lab:xe,hcl:be});function Ee(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function Se(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function Te(t){return t}function ke(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function Ae(t,e,r,n,i){return ke(typeof r===i?n[r]:void 0,t.default,e.default)}function Ie(t,e,r){if("number"!==Ee(r))return ke(t.default,e.default);var n=t.stops.length;if(1===n)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];var i=Me(t.stops,r);return t.stops[i][1]}function ze(t,e,r){var n=void 0!==t.base?t.base:1;if("number"!==Ee(r))return ke(t.default,e.default);var i=t.stops.length;if(1===i)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];var o=Me(t.stops,r),a=function(t,e,r,n){var i=n-r,o=t-r;return 0===i?0:1===e?o/i:(Math.pow(e,o)-1)/(Math.pow(e,i)-1)}(r,n,t.stops[o][0],t.stops[o+1][0]),s=t.stops[o][1],l=t.stops[o+1][1],u=Pt[e.type]||Te;if(t.colorSpace&&"rgb"!==t.colorSpace){var c=we[t.colorSpace];u=function(t,e){return c.reverse(c.interpolate(c.forward(t),c.forward(e),a))}}return"function"==typeof s.evaluate?{evaluate:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];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,a)}}:u(s,l,a)}function Ce(t,e,r){return"color"===e.type?r=at.parse(r):Ee(r)===e.type||"enum"===e.type&&e.values[r]||(r=void 0),ke(r,t.default,e.default)}function Me(t,e){for(var r,n,i=0,o=t.length-1,a=0;i<=o;){if(r=t[a=Math.floor((i+o)/2)][0],n=t[a+1][0],e===r||e>r&&ee&&(o=a-1)}return Math.max(a-1,0)}var Pe=function(t,e){var r;this.expression=t,this._warningHistory={},this._defaultValue="color"===(r=e).type&&Se(r.default)?new at(0,0,0,0):"color"===r.type?at.parse(r.default)||null:void 0===r.default?null:r.default,"enum"===e.type&&(this._enumValues=e.values)};function Le(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in Zt}function De(t,e){var r=new kt(Zt,[],function(t){var e={color:J,string:H,number:X,enum:H,boolean:K};return"array"===t.type?et(e[t.value]||Q,t.length):e[t.type]||null}(e)),n=r.parse(t);return n?te(new Pe(n,e)):ee(r.errors)}Pe.prototype.evaluateWithoutErrorHandling=function(t,e,r){return this._evaluator||(this._evaluator=new xt),this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this.expression.evaluate(this._evaluator)},Pe.prototype.evaluate=function(t,e,r){this._evaluator||(this._evaluator=new xt),this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r;try{var n=this.expression.evaluate(this._evaluator);if(null==n)return this._defaultValue;if(this._enumValues&&!(n in this._enumValues))throw new pt("Expected value to be one of "+Object.keys(this._enumValues).map(function(t){return JSON.stringify(t)}).join(", ")+", but found "+JSON.stringify(n)+" instead.");return n}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}};var Re=function(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Et(e.expression)};Re.prototype.evaluateWithoutErrorHandling=function(t,e,r){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r)},Re.prototype.evaluate=function(t,e,r){return this._styleExpression.evaluate(t,e,r)};var Be=function(t,e,r){this.kind=t,this.zoomStops=r.labels,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Et(e.expression),r instanceof Lt&&(this._interpolationType=r.interpolation)};function Oe(t,e){if("error"===(t=De(t,e)).result)return t;var r=t.value.expression,n=wt(r);if(!n&&!re(e))return ee([new Z("","data expressions not supported")]);var i=St(r,["zoom"]);if(!i&&!ne(e))return ee([new Z("","zoom expressions not supported")]);var o=function t(e){var r=null;if(e instanceof Bt)r=t(e.result);else if(e instanceof Rt)for(var n=0,i=e.args;nn.maximum?[new N(e,r,r+" is greater than the maximum value "+n.maximum)]:[]}function $e(t){var e,r,n,i=t.valueSpec,o=$(t.value.type),a={},s="categorical"!==o&&void 0===t.value.property,l=!s,u="array"===Ee(t.value.stops)&&"array"===Ee(t.value.stops[0])&&"object"===Ee(t.value.stops[0][0]),c=Ne({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===o)return[new N(t.key,t.value,'identity function may not have a "stops" property')];var e=[],r=t.value;return e=e.concat(je({key:t.key,value:r,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),"array"===Ee(r)&&0===r.length&&e.push(new N(t.key,r,"array must have at least one stop")),e},default:function(t){return cr({key:t.key,value:t.value,valueSpec:i,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===o&&s&&c.push(new N(t.key,t.value,'missing required property "property"')),"identity"===o||t.value.stops||c.push(new N(t.key,t.value,'missing required property "stops"')),"exponential"===o&&t.valueSpec.expression&&!ie(t.valueSpec)&&c.push(new N(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!re(t.valueSpec)?c.push(new N(t.key,t.value,"property functions not supported")):s&&!ne(t.valueSpec)&&c.push(new N(t.key,t.value,"zoom functions not supported"))),"categorical"!==o&&!u||void 0!==t.value.property||c.push(new N(t.key,t.value,'"property" property is required')),c;function h(t){var e=[],o=t.value,s=t.key;if("array"!==Ee(o))return[new N(s,o,"array expected, "+Ee(o)+" found")];if(2!==o.length)return[new N(s,o,"array length 2 expected, length "+o.length+" found")];if(u){if("object"!==Ee(o[0]))return[new N(s,o,"object expected, "+Ee(o[0])+" found")];if(void 0===o[0].zoom)return[new N(s,o,"object stop key must have zoom")];if(void 0===o[0].value)return[new N(s,o,"object stop key must have value")];if(n&&n>$(o[0].zoom))return[new N(s,o[0].zoom,"stop zoom values must appear in ascending order")];$(o[0].zoom)!==n&&(n=$(o[0].zoom),r=void 0,a={}),e=e.concat(Ne({key:s+"[0]",value:o[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Ue,value:p}}))}else e=e.concat(p({key:s+"[0]",value:o[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},o));return e.concat(cr({key:s+"[1]",value:o[1],valueSpec:i,style:t.style,styleSpec:t.styleSpec}))}function p(t,n){var s=Ee(t.value),l=$(t.value),u=null!==t.value?t.value:n;if(e){if(s!==e)return[new N(t.key,u,s+" stop domain type must match previous stop domain type "+e)]}else e=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new N(t.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==o){var c="number expected, "+s+" found";return re(i)&&void 0===o&&(c+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new N(t.key,u,c)]}return"categorical"!==o||"number"!==s||isFinite(l)&&Math.floor(l)===l?"categorical"!==o&&"number"===s&&void 0!==r&&l=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3===t.length&&(Array.isArray(t[1])||Array.isArray(t[2]));case"any":case"all":for(var e=0,r=t.slice(1);ee?1:0}function Ke(t){if(!t)return!0;var e,r=t[0];return t.length<=1?"any"!==r:"=="===r?Je(t[1],t[2],"=="):"!="===r?tr(Je(t[1],t[2],"==")):"<"===r||">"===r||"<="===r||">="===r?Je(t[1],t[2],r):"any"===r?(e=t.slice(1),["any"].concat(e.map(Ke))):"all"===r?["all"].concat(t.slice(1).map(Ke)):"none"===r?["all"].concat(t.slice(1).map(Ke).map(tr)):"in"===r?Ye(t[1],t.slice(2)):"!in"===r?tr(Ye(t[1],t.slice(2))):"has"===r?Qe(t[1]):"!has"!==r||tr(Qe(t[1]))}function Je(t,e,r){switch(t){case"$type":return["filter-type-"+r,e];case"$id":return["filter-id-"+r,e];default:return["filter-"+r,t,e]}}function Ye(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(function(t){return typeof t!=typeof e[0]})?["filter-in-large",t,["literal",e.sort(He)]]:["filter-in-small",t,["literal",e]]}}function Qe(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function tr(t){return["!",t]}function er(t){return Ge(q(t.value))?qe(U({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):function t(e){var r=e.value,n=e.key;if("array"!==Ee(r))return[new N(n,r,"array expected, "+Ee(r)+" found")];var i,o=e.styleSpec,a=[];if(r.length<1)return[new N(n,r,"filter array must have at least 1 element")];switch(a=a.concat(Ze({key:n+"[0]",value:r[0],valueSpec:o.filter_operator,style:e.style,styleSpec:e.styleSpec})),$(r[0])){case"<":case"<=":case">":case">=":r.length>=2&&"$type"===$(r[1])&&a.push(new N(n,r,'"$type" cannot be use with operator "'+r[0]+'"'));case"==":case"!=":3!==r.length&&a.push(new N(n,r,'filter array for operator "'+r[0]+'" must have 3 elements'));case"in":case"!in":r.length>=2&&"string"!==(i=Ee(r[1]))&&a.push(new N(n+"[1]",r[1],"string expected, "+i+" found"));for(var s=2;s=u[p+0]&&n>=u[p+1]?(a[h]=!0,o.push(l[h])):a[h]=!1}}},wr.prototype._forEachCell=function(t,e,r,n,i,o,a){for(var s=this._convertToCellCoord(t),l=this._convertToCellCoord(e),u=this._convertToCellCoord(r),c=this._convertToCellCoord(n),h=s;h<=u;h++)for(var p=l;p<=c;p++){var f=this.d*p+h;if(i.call(this,t,e,r,n,f,o,a))return}},wr.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},wr.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=br+this.cells.length+1+1,r=0,n=0;n=0)){var h=t[c];u[c]=Sr[l].shallow.indexOf(c)>=0?h:Ar(h,e)}t instanceof Error&&(u.message=t.message)}return{name:l,properties:u}}throw new Error("can't serialize object of type "+typeof t)}function Ir(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof ArrayBuffer||ArrayBuffer.isView(t)||t instanceof Er)return t;if(Array.isArray(t))return t.map(function(t){return Ir(t)});if("object"==typeof t){var e=t,r=e.name,n=e.properties;if(!r)throw new Error("can't deserialize object of anonymous class");var i=Sr[r].klass;if(!i)throw new Error("can't deserialize unregistered class "+r);if(i.deserialize)return i.deserialize(n._serialized);for(var o=Object.create(i.prototype),a=0,s=Object.keys(n);a=0?n[l]:Ir(n[l])}return o}throw new Error("can't deserialize object of type "+typeof t)}var zr=function(){this.first=!0};zr.prototype.update=function(t,e){var r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoom=128&&t<=255},Arabic:function(t){return t>=1536&&t<=1791},"Arabic Supplement":function(t){return t>=1872&&t<=1919},"Arabic Extended-A":function(t){return t>=2208&&t<=2303},"Hangul Jamo":function(t){return t>=4352&&t<=4607},"Unified Canadian Aboriginal Syllabics":function(t){return t>=5120&&t<=5759},Khmer:function(t){return t>=6016&&t<=6143},"Unified Canadian Aboriginal Syllabics Extended":function(t){return t>=6320&&t<=6399},"General Punctuation":function(t){return t>=8192&&t<=8303},"Letterlike Symbols":function(t){return t>=8448&&t<=8527},"Number Forms":function(t){return t>=8528&&t<=8591},"Miscellaneous Technical":function(t){return t>=8960&&t<=9215},"Control Pictures":function(t){return t>=9216&&t<=9279},"Optical Character Recognition":function(t){return t>=9280&&t<=9311},"Enclosed Alphanumerics":function(t){return t>=9312&&t<=9471},"Geometric Shapes":function(t){return t>=9632&&t<=9727},"Miscellaneous Symbols":function(t){return t>=9728&&t<=9983},"Miscellaneous Symbols and Arrows":function(t){return t>=11008&&t<=11263},"CJK Radicals Supplement":function(t){return t>=11904&&t<=12031},"Kangxi Radicals":function(t){return t>=12032&&t<=12255},"Ideographic Description Characters":function(t){return t>=12272&&t<=12287},"CJK Symbols and Punctuation":function(t){return t>=12288&&t<=12351},Hiragana:function(t){return t>=12352&&t<=12447},Katakana:function(t){return t>=12448&&t<=12543},Bopomofo:function(t){return t>=12544&&t<=12591},"Hangul Compatibility Jamo":function(t){return t>=12592&&t<=12687},Kanbun:function(t){return t>=12688&&t<=12703},"Bopomofo Extended":function(t){return t>=12704&&t<=12735},"CJK Strokes":function(t){return t>=12736&&t<=12783},"Katakana Phonetic Extensions":function(t){return t>=12784&&t<=12799},"Enclosed CJK Letters and Months":function(t){return t>=12800&&t<=13055},"CJK Compatibility":function(t){return t>=13056&&t<=13311},"CJK Unified Ideographs Extension A":function(t){return t>=13312&&t<=19903},"Yijing Hexagram Symbols":function(t){return t>=19904&&t<=19967},"CJK Unified Ideographs":function(t){return t>=19968&&t<=40959},"Yi Syllables":function(t){return t>=40960&&t<=42127},"Yi Radicals":function(t){return t>=42128&&t<=42191},"Hangul Jamo Extended-A":function(t){return t>=43360&&t<=43391},"Hangul Syllables":function(t){return t>=44032&&t<=55215},"Hangul Jamo Extended-B":function(t){return t>=55216&&t<=55295},"Private Use Area":function(t){return t>=57344&&t<=63743},"CJK Compatibility Ideographs":function(t){return t>=63744&&t<=64255},"Arabic Presentation Forms-A":function(t){return t>=64336&&t<=65023},"Vertical Forms":function(t){return t>=65040&&t<=65055},"CJK Compatibility Forms":function(t){return t>=65072&&t<=65103},"Small Form Variants":function(t){return t>=65104&&t<=65135},"Arabic Presentation Forms-B":function(t){return t>=65136&&t<=65279},"Halfwidth and Fullwidth Forms":function(t){return t>=65280&&t<=65519}};function Mr(t){for(var e=0,r=t;e=65097&&t<=65103)||Cr["CJK Compatibility Ideographs"](t)||Cr["CJK Compatibility"](t)||Cr["CJK Radicals Supplement"](t)||Cr["CJK Strokes"](t)||!(!Cr["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||Cr["CJK Unified Ideographs Extension A"](t)||Cr["CJK Unified Ideographs"](t)||Cr["Enclosed CJK Letters and Months"](t)||Cr["Hangul Compatibility Jamo"](t)||Cr["Hangul Jamo Extended-A"](t)||Cr["Hangul Jamo Extended-B"](t)||Cr["Hangul Jamo"](t)||Cr["Hangul Syllables"](t)||Cr.Hiragana(t)||Cr["Ideographic Description Characters"](t)||Cr.Kanbun(t)||Cr["Kangxi Radicals"](t)||Cr["Katakana Phonetic Extensions"](t)||Cr.Katakana(t)&&12540!==t||!(!Cr["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!Cr["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||Cr["Unified Canadian Aboriginal Syllabics"](t)||Cr["Unified Canadian Aboriginal Syllabics Extended"](t)||Cr["Vertical Forms"](t)||Cr["Yijing Hexagram Symbols"](t)||Cr["Yi Syllables"](t)||Cr["Yi Radicals"](t)))}function Dr(t){return!(Lr(t)||function(t){return!!(Cr["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||Cr["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||Cr["Letterlike Symbols"](t)||Cr["Number Forms"](t)||Cr["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||Cr["Control Pictures"](t)&&9251!==t||Cr["Optical Character Recognition"](t)||Cr["Enclosed Alphanumerics"](t)||Cr["Geometric Shapes"](t)||Cr["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||Cr["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Cr["CJK Symbols and Punctuation"](t)||Cr.Katakana(t)||Cr["Private Use Area"](t)||Cr["CJK Compatibility Forms"](t)||Cr["Small Form Variants"](t)||Cr["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Rr(t,e){return!(!e&&(t>=1424&&t<=2303||Cr["Arabic Presentation Forms-A"](t)||Cr["Arabic Presentation Forms-B"](t))||t>=2304&&t<=3583||t>=3840&&t<=4255||Cr.Khmer(t))}var Br,Or=!1,Fr=null,Vr=!1,Nr=new F,jr={applyArabicShaping:null,processBidirectionalText:null,isLoaded:function(){return Vr||null!=jr.applyArabicShaping}},Ur=function(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new zr,this.transition={})};Ur.prototype.isSupportedScript=function(t){return function(t,e){for(var r=0,n=t;rthis.end)return this.prior=null,r;if(this.value.isDataDriven())return this.prior=null,r;if(e=1)return 1;var e=i*i,r=e*i;return 4*(i<.5?r:3*(i-e)+r-.75)}())}return r};var Wr=function(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)};Wr.prototype.possiblyEvaluate=function(t){for(var e=new Kr(this._properties),r=0,n=Object.keys(this._values);rn.zoomHistory.lastIntegerZoom?{from:t,to:e,fromScale:2,toScale:1,t:o+(1-o)*a}:{from:r,to:e,fromScale:.5,toScale:1,t:1-(1-a)*o}},Qr.prototype.interpolate=function(t){return t};var tn=function(t){this.specification=t};tn.prototype.possiblyEvaluate=function(t,e){return!!t.expression.evaluate(e)},tn.prototype.interpolate=function(){return!1};var en=function(t){for(var e in this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},t){var r=t[e],n=this.defaultPropertyValues[e]=new $r(r,void 0),i=this.defaultTransitionablePropertyValues[e]=new qr(r);this.defaultTransitioningPropertyValues[e]=i.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=n.possiblyEvaluate({})}};Tr("DataDrivenProperty",Yr),Tr("DataConstantProperty",Jr),Tr("CrossFadedProperty",Qr),Tr("ColorRampProperty",tn);var rn=function(t){function e(e,r){for(var n in t.call(this),this.id=e.id,this.metadata=e.metadata,this.type=e.type,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,this.visibility="visible","background"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),this._featureFilter=function(){return!0},r.layout&&(this._unevaluatedLayout=new Xr(r.layout)),this._transitionablePaint=new Zr(r.paint),e.paint)this.setPaintProperty(n,e.paint[n],{validate:!1});for(var i in e.layout)this.setLayoutProperty(i,e.layout[i],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getLayoutProperty=function(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)},e.prototype.setLayoutProperty=function(t,e,r){if(null!=e){var n="layers."+this.id+".layout."+t;if(this._validate(vr,n,t,e,r))return}"visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility="none"===e?e:"visible"},e.prototype.getPaintProperty=function(t){return w(t,"-transition")?this._transitionablePaint.getTransition(t.slice(0,-"-transition".length)):this._transitionablePaint.getValue(t)},e.prototype.setPaintProperty=function(t,e,r){if(null!=e){var n="layers."+this.id+".paint."+t;if(this._validate(gr,n,t,e,r))return!1}if(w(t,"-transition"))return this._transitionablePaint.setTransition(t.slice(0,-"-transition".length),e||void 0),!1;var i=this._transitionablePaint._values[t].value.isDataDriven();this._transitionablePaint.setValue(t,e);var o=this._transitionablePaint._values[t].value.isDataDriven();return this._handleSpecialPaintPropertyUpdate(t),o||i},e.prototype._handleSpecialPaintPropertyUpdate=function(t){},e.prototype.isHidden=function(t){return!!(this.minzoom&&t=this.maxzoom)||"none"===this.visibility},e.prototype.updateTransitions=function(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)},e.prototype.hasTransition=function(){return this._transitioningPaint.hasTransition()},e.prototype.recalculate=function(t){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t)),this.paint=this._transitioningPaint.possiblyEvaluate(t)},e.prototype.serialize=function(){var t={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"none"===this.visibility&&(t.layout=t.layout||{},t.layout.visibility="none"),S(t,function(t,e){return!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)})},e.prototype._validate=function(t,e,r,n,i){return(!i||!1!==i.validate)&&_r(this,t.call(mr,{key:e,layerType:this.type,objectKey:r,value:n,styleSpec:V,style:{glyphs:!0,sprite:!0}}))},e.prototype.hasOffscreenPass=function(){return!1},e.prototype.resize=function(){},e.prototype.isStateDependent=function(){for(var t in this.paint._values){var e=this.paint.get(t);if(e instanceof Hr&&re(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1},e}(F),nn={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},on=function(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8},an=function(){this.isTransferred=!1,this.capacity=-1,this.resize(0)};function sn(t,e){void 0===e&&(e=1);var r=0,n=0;return{members:t.map(function(t){var i,o=(i=t.type,nn[i].BYTES_PER_ELEMENT),a=r=ln(r,Math.max(e,o)),s=t.components||1;return n=Math.max(n,o),r+=o*s,{name:t.name,type:t.type,components:s,offset:a}}),size:ln(r,Math.max(n,e)),alignment:e}}function ln(t,e){return Math.ceil(t/e)*e}an.serialize=function(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}},an.deserialize=function(t){var e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e},an.prototype._trim=function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())},an.prototype.clear=function(){this.length=0},an.prototype.resize=function(t){this.reserve(t),this.length=t},an.prototype.reserve=function(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}},an.prototype._refreshViews=function(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")};var un=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;this.resize(r+1);var n=2*r;return this.int16[n+0]=t,this.int16[n+1]=e,r},e.prototype.emplace=function(t,e,r){var n=2*t;return this.int16[n+0]=e,this.int16[n+1]=r,t},e}(an);un.prototype.bytesPerElement=4,Tr("StructArrayLayout2i4",un);var cn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n){var i=this.length;this.resize(i+1);var o=4*i;return this.int16[o+0]=t,this.int16[o+1]=e,this.int16[o+2]=r,this.int16[o+3]=n,i},e.prototype.emplace=function(t,e,r,n,i){var o=4*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=n,this.int16[o+3]=i,t},e}(an);cn.prototype.bytesPerElement=8,Tr("StructArrayLayout4i8",cn);var hn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o){var a=this.length;this.resize(a+1);var s=6*a;return this.int16[s+0]=t,this.int16[s+1]=e,this.int16[s+2]=r,this.int16[s+3]=n,this.int16[s+4]=i,this.int16[s+5]=o,a},e.prototype.emplace=function(t,e,r,n,i,o,a){var s=6*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=i,this.int16[s+4]=o,this.int16[s+5]=a,t},e}(an);hn.prototype.bytesPerElement=12,Tr("StructArrayLayout2i4i12",hn);var pn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o,a,s){var l=this.length;this.resize(l+1);var u=6*l,c=12*l;return this.int16[u+0]=t,this.int16[u+1]=e,this.int16[u+2]=r,this.int16[u+3]=n,this.uint8[c+8]=i,this.uint8[c+9]=o,this.uint8[c+10]=a,this.uint8[c+11]=s,l},e.prototype.emplace=function(t,e,r,n,i,o,a,s,l){var u=6*t,c=12*t;return this.int16[u+0]=e,this.int16[u+1]=r,this.int16[u+2]=n,this.int16[u+3]=i,this.uint8[c+8]=o,this.uint8[c+9]=a,this.uint8[c+10]=s,this.uint8[c+11]=l,t},e}(an);pn.prototype.bytesPerElement=12,Tr("StructArrayLayout4i4ub12",pn);var fn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o,a,s){var l=this.length;this.resize(l+1);var u=8*l;return this.int16[u+0]=t,this.int16[u+1]=e,this.int16[u+2]=r,this.int16[u+3]=n,this.uint16[u+4]=i,this.uint16[u+5]=o,this.uint16[u+6]=a,this.uint16[u+7]=s,l},e.prototype.emplace=function(t,e,r,n,i,o,a,s,l){var u=8*t;return this.int16[u+0]=e,this.int16[u+1]=r,this.int16[u+2]=n,this.int16[u+3]=i,this.uint16[u+4]=o,this.uint16[u+5]=a,this.uint16[u+6]=s,this.uint16[u+7]=l,t},e}(an);fn.prototype.bytesPerElement=16,Tr("StructArrayLayout4i4ui16",fn);var dn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;this.resize(n+1);var i=3*n;return this.float32[i+0]=t,this.float32[i+1]=e,this.float32[i+2]=r,n},e.prototype.emplace=function(t,e,r,n){var i=3*t;return this.float32[i+0]=e,this.float32[i+1]=r,this.float32[i+2]=n,t},e}(an);dn.prototype.bytesPerElement=12,Tr("StructArrayLayout3f12",dn);var mn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;this.resize(e+1);var r=1*e;return this.uint32[r+0]=t,e},e.prototype.emplace=function(t,e){var r=1*t;return this.uint32[r+0]=e,t},e}(an);mn.prototype.bytesPerElement=4,Tr("StructArrayLayout1ul4",mn);var yn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o,a,s,l,u,c){var h=this.length;this.resize(h+1);var p=12*h,f=6*h;return this.int16[p+0]=t,this.int16[p+1]=e,this.int16[p+2]=r,this.int16[p+3]=n,this.int16[p+4]=i,this.int16[p+5]=o,this.uint32[f+3]=a,this.uint16[p+8]=s,this.uint16[p+9]=l,this.int16[p+10]=u,this.int16[p+11]=c,h},e.prototype.emplace=function(t,e,r,n,i,o,a,s,l,u,c,h){var p=12*t,f=6*t;return this.int16[p+0]=e,this.int16[p+1]=r,this.int16[p+2]=n,this.int16[p+3]=i,this.int16[p+4]=o,this.int16[p+5]=a,this.uint32[f+3]=s,this.uint16[p+8]=l,this.uint16[p+9]=u,this.int16[p+10]=c,this.int16[p+11]=h,t},e}(an);yn.prototype.bytesPerElement=24,Tr("StructArrayLayout6i1ul2ui2i24",yn);var gn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o){var a=this.length;this.resize(a+1);var s=6*a;return this.int16[s+0]=t,this.int16[s+1]=e,this.int16[s+2]=r,this.int16[s+3]=n,this.int16[s+4]=i,this.int16[s+5]=o,a},e.prototype.emplace=function(t,e,r,n,i,o,a){var s=6*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=i,this.int16[s+4]=o,this.int16[s+5]=a,t},e}(an);gn.prototype.bytesPerElement=12,Tr("StructArrayLayout2i2i2i12",gn);var vn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;this.resize(r+1);var n=4*r;return this.uint8[n+0]=t,this.uint8[n+1]=e,r},e.prototype.emplace=function(t,e,r){var n=4*t;return this.uint8[n+0]=e,this.uint8[n+1]=r,t},e}(an);vn.prototype.bytesPerElement=4,Tr("StructArrayLayout2ub4",vn);var _n=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o,a,s,l,u,c,h,p,f){var d=this.length;this.resize(d+1);var m=20*d,y=10*d,g=40*d;return this.int16[m+0]=t,this.int16[m+1]=e,this.uint16[m+2]=r,this.uint16[m+3]=n,this.uint32[y+2]=i,this.uint32[y+3]=o,this.uint32[y+4]=a,this.uint16[m+10]=s,this.uint16[m+11]=l,this.uint16[m+12]=u,this.float32[y+7]=c,this.float32[y+8]=h,this.uint8[g+36]=p,this.uint8[g+37]=f,d},e.prototype.emplace=function(t,e,r,n,i,o,a,s,l,u,c,h,p,f,d){var m=20*t,y=10*t,g=40*t;return this.int16[m+0]=e,this.int16[m+1]=r,this.uint16[m+2]=n,this.uint16[m+3]=i,this.uint32[y+2]=o,this.uint32[y+3]=a,this.uint32[y+4]=s,this.uint16[m+10]=l,this.uint16[m+11]=u,this.uint16[m+12]=c,this.float32[y+7]=h,this.float32[y+8]=p,this.uint8[g+36]=f,this.uint8[g+37]=d,t},e}(an);_n.prototype.bytesPerElement=40,Tr("StructArrayLayout2i2ui3ul3ui2f2ub40",_n);var xn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;this.resize(e+1);var r=1*e;return this.float32[r+0]=t,e},e.prototype.emplace=function(t,e){var r=1*t;return this.float32[r+0]=e,t},e}(an);xn.prototype.bytesPerElement=4,Tr("StructArrayLayout1f4",xn);var bn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;this.resize(n+1);var i=3*n;return this.int16[i+0]=t,this.int16[i+1]=e,this.int16[i+2]=r,n},e.prototype.emplace=function(t,e,r,n){var i=3*t;return this.int16[i+0]=e,this.int16[i+1]=r,this.int16[i+2]=n,t},e}(an);bn.prototype.bytesPerElement=6,Tr("StructArrayLayout3i6",bn);var wn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;this.resize(n+1);var i=2*n,o=4*n;return this.uint32[i+0]=t,this.uint16[o+2]=e,this.uint16[o+3]=r,n},e.prototype.emplace=function(t,e,r,n){var i=2*t,o=4*t;return this.uint32[i+0]=e,this.uint16[o+2]=r,this.uint16[o+3]=n,t},e}(an);wn.prototype.bytesPerElement=8,Tr("StructArrayLayout1ul2ui8",wn);var En=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;this.resize(n+1);var i=3*n;return this.uint16[i+0]=t,this.uint16[i+1]=e,this.uint16[i+2]=r,n},e.prototype.emplace=function(t,e,r,n){var i=3*t;return this.uint16[i+0]=e,this.uint16[i+1]=r,this.uint16[i+2]=n,t},e}(an);En.prototype.bytesPerElement=6,Tr("StructArrayLayout3ui6",En);var Sn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;this.resize(r+1);var n=2*r;return this.uint16[n+0]=t,this.uint16[n+1]=e,r},e.prototype.emplace=function(t,e,r){var n=2*t;return this.uint16[n+0]=e,this.uint16[n+1]=r,t},e}(an);Sn.prototype.bytesPerElement=4,Tr("StructArrayLayout2ui4",Sn);var Tn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;this.resize(r+1);var n=2*r;return this.float32[n+0]=t,this.float32[n+1]=e,r},e.prototype.emplace=function(t,e,r){var n=2*t;return this.float32[n+0]=e,this.float32[n+1]=r,t},e}(an);Tn.prototype.bytesPerElement=8,Tr("StructArrayLayout2f8",Tn);var kn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n){var i=this.length;this.resize(i+1);var o=4*i;return this.float32[o+0]=t,this.float32[o+1]=e,this.float32[o+2]=r,this.float32[o+3]=n,i},e.prototype.emplace=function(t,e,r,n,i){var o=4*t;return this.float32[o+0]=e,this.float32[o+1]=r,this.float32[o+2]=n,this.float32[o+3]=i,t},e}(an);kn.prototype.bytesPerElement=16,Tr("StructArrayLayout4f16",kn);var An=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={anchorPointX:{configurable:!0},anchorPointY:{configurable:!0},x1:{configurable:!0},y1:{configurable:!0},x2:{configurable:!0},y2:{configurable:!0},featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0},radius:{configurable:!0},signedDistanceFromAnchor:{configurable:!0},anchorPoint:{configurable:!0}};return r.anchorPointX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorPointX.set=function(t){this._structArray.int16[this._pos2+0]=t},r.anchorPointY.get=function(){return this._structArray.int16[this._pos2+1]},r.anchorPointY.set=function(t){this._structArray.int16[this._pos2+1]=t},r.x1.get=function(){return this._structArray.int16[this._pos2+2]},r.x1.set=function(t){this._structArray.int16[this._pos2+2]=t},r.y1.get=function(){return this._structArray.int16[this._pos2+3]},r.y1.set=function(t){this._structArray.int16[this._pos2+3]=t},r.x2.get=function(){return this._structArray.int16[this._pos2+4]},r.x2.set=function(t){this._structArray.int16[this._pos2+4]=t},r.y2.get=function(){return this._structArray.int16[this._pos2+5]},r.y2.set=function(t){this._structArray.int16[this._pos2+5]=t},r.featureIndex.get=function(){return this._structArray.uint32[this._pos4+3]},r.featureIndex.set=function(t){this._structArray.uint32[this._pos4+3]=t},r.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+8]},r.sourceLayerIndex.set=function(t){this._structArray.uint16[this._pos2+8]=t},r.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+9]},r.bucketIndex.set=function(t){this._structArray.uint16[this._pos2+9]=t},r.radius.get=function(){return this._structArray.int16[this._pos2+10]},r.radius.set=function(t){this._structArray.int16[this._pos2+10]=t},r.signedDistanceFromAnchor.get=function(){return this._structArray.int16[this._pos2+11]},r.signedDistanceFromAnchor.set=function(t){this._structArray.int16[this._pos2+11]=t},r.anchorPoint.get=function(){return new p(this.anchorPointX,this.anchorPointY)},Object.defineProperties(e.prototype,r),e}(on);An.prototype.size=24;var In=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t){return new An(this,t)},e}(yn);Tr("CollisionBoxArray",In);var zn=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={anchorX:{configurable:!0},anchorY:{configurable:!0},glyphStartIndex:{configurable:!0},numGlyphs:{configurable:!0},vertexStartIndex:{configurable:!0},lineStartIndex:{configurable:!0},lineLength:{configurable:!0},segment:{configurable:!0},lowerSize:{configurable:!0},upperSize:{configurable:!0},lineOffsetX:{configurable:!0},lineOffsetY:{configurable:!0},writingMode:{configurable:!0},hidden:{configurable:!0}};return r.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorX.set=function(t){this._structArray.int16[this._pos2+0]=t},r.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},r.anchorY.set=function(t){this._structArray.int16[this._pos2+1]=t},r.glyphStartIndex.get=function(){return this._structArray.uint16[this._pos2+2]},r.glyphStartIndex.set=function(t){this._structArray.uint16[this._pos2+2]=t},r.numGlyphs.get=function(){return this._structArray.uint16[this._pos2+3]},r.numGlyphs.set=function(t){this._structArray.uint16[this._pos2+3]=t},r.vertexStartIndex.get=function(){return this._structArray.uint32[this._pos4+2]},r.vertexStartIndex.set=function(t){this._structArray.uint32[this._pos4+2]=t},r.lineStartIndex.get=function(){return this._structArray.uint32[this._pos4+3]},r.lineStartIndex.set=function(t){this._structArray.uint32[this._pos4+3]=t},r.lineLength.get=function(){return this._structArray.uint32[this._pos4+4]},r.lineLength.set=function(t){this._structArray.uint32[this._pos4+4]=t},r.segment.get=function(){return this._structArray.uint16[this._pos2+10]},r.segment.set=function(t){this._structArray.uint16[this._pos2+10]=t},r.lowerSize.get=function(){return this._structArray.uint16[this._pos2+11]},r.lowerSize.set=function(t){this._structArray.uint16[this._pos2+11]=t},r.upperSize.get=function(){return this._structArray.uint16[this._pos2+12]},r.upperSize.set=function(t){this._structArray.uint16[this._pos2+12]=t},r.lineOffsetX.get=function(){return this._structArray.float32[this._pos4+7]},r.lineOffsetX.set=function(t){this._structArray.float32[this._pos4+7]=t},r.lineOffsetY.get=function(){return this._structArray.float32[this._pos4+8]},r.lineOffsetY.set=function(t){this._structArray.float32[this._pos4+8]=t},r.writingMode.get=function(){return this._structArray.uint8[this._pos1+36]},r.writingMode.set=function(t){this._structArray.uint8[this._pos1+36]=t},r.hidden.get=function(){return this._structArray.uint8[this._pos1+37]},r.hidden.set=function(t){this._structArray.uint8[this._pos1+37]=t},Object.defineProperties(e.prototype,r),e}(on);zn.prototype.size=40;var Cn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t){return new zn(this,t)},e}(_n);Tr("PlacedSymbolArray",Cn);var Mn=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={offsetX:{configurable:!0}};return r.offsetX.get=function(){return this._structArray.float32[this._pos4+0]},r.offsetX.set=function(t){this._structArray.float32[this._pos4+0]=t},Object.defineProperties(e.prototype,r),e}(on);Mn.prototype.size=4;var Pn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getoffsetX=function(t){return this.float32[1*t+0]},e.prototype.get=function(t){return new Mn(this,t)},e}(xn);Tr("GlyphOffsetArray",Pn);var Ln=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={x:{configurable:!0},y:{configurable:!0},tileUnitDistanceFromAnchor:{configurable:!0}};return r.x.get=function(){return this._structArray.int16[this._pos2+0]},r.x.set=function(t){this._structArray.int16[this._pos2+0]=t},r.y.get=function(){return this._structArray.int16[this._pos2+1]},r.y.set=function(t){this._structArray.int16[this._pos2+1]=t},r.tileUnitDistanceFromAnchor.get=function(){return this._structArray.int16[this._pos2+2]},r.tileUnitDistanceFromAnchor.set=function(t){this._structArray.int16[this._pos2+2]=t},Object.defineProperties(e.prototype,r),e}(on);Ln.prototype.size=6;var Dn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getx=function(t){return this.int16[3*t+0]},e.prototype.gety=function(t){return this.int16[3*t+1]},e.prototype.gettileUnitDistanceFromAnchor=function(t){return this.int16[3*t+2]},e.prototype.get=function(t){return new Ln(this,t)},e}(bn);Tr("SymbolLineVertexArray",Dn);var Rn=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0}};return r.featureIndex.get=function(){return this._structArray.uint32[this._pos4+0]},r.featureIndex.set=function(t){this._structArray.uint32[this._pos4+0]=t},r.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+2]},r.sourceLayerIndex.set=function(t){this._structArray.uint16[this._pos2+2]=t},r.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+3]},r.bucketIndex.set=function(t){this._structArray.uint16[this._pos2+3]=t},Object.defineProperties(e.prototype,r),e}(on);Rn.prototype.size=8;var Bn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t){return new Rn(this,t)},e}(wn);Tr("FeatureIndexArray",Bn);var On=sn([{name:"a_pos",components:2,type:"Int16"}],4).members,Fn=function(t){void 0===t&&(t=[]),this.segments=t};Fn.prototype.prepareSegment=function(t,e,r){var n=this.segments[this.segments.length-1];return t>Fn.MAX_VERTEX_ARRAY_LENGTH&&A("Max vertices per segment is "+Fn.MAX_VERTEX_ARRAY_LENGTH+": bucket requested "+t),(!n||n.vertexLength+t>Fn.MAX_VERTEX_ARRAY_LENGTH)&&(n={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0},this.segments.push(n)),n},Fn.prototype.get=function(){return this.segments},Fn.prototype.destroy=function(){for(var t=0,e=this.segments;tXn.max||a.yXn.max)&&A("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return r}function Kn(t,e,r,n,i){t.emplaceBack(2*e+(n+1)/2,2*r+(i+1)/2)}var Jn=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(t){return t.id}),this.index=t.index,this.layoutVertexArray=new un,this.indexArray=new En,this.segments=new Fn,this.programConfigurations=new Zn(On,t.layers,t.zoom)};function Yn(t,e,r){for(var n=0;n=3)for(var s=0;s1){if(ri(t,e))return!0;for(var n=0;n1?t.distSqr(r):t.distSqr(r.sub(e)._mult(i)._add(e))}function ai(t,e){for(var r,n,i,o=!1,a=0;ae.y!=i.y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(o=!o);return o}function si(t,e){for(var r=!1,n=0,i=t.length-1;ne.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(r=!r)}return r}function li(t,e,r){var n=e.paint.get(t).value;return"constant"===n.kind?n.value:r.programConfigurations.get(e.id).binders[t].statistics.max}function ui(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function ci(t,e,r,n,i){if(!e[0]&&!e[1])return t;var o=p.convert(e);"viewport"===r&&o._rotate(-n);for(var a=[],s=0;s=Wn||u<0||u>=Wn)){var c=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray),h=c.vertexLength;Kn(this.layoutVertexArray,l,u,-1,-1),Kn(this.layoutVertexArray,l,u,1,-1),Kn(this.layoutVertexArray,l,u,1,1),Kn(this.layoutVertexArray,l,u,-1,1),this.indexArray.emplaceBack(h,h+1,h+2),this.indexArray.emplaceBack(h,h+3,h+2),c.vertexLength+=4,c.primitiveLength+=2}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r)},Tr("CircleBucket",Jn,{omit:["layers"]});var hi={paint:new en({"circle-radius":new Yr(V.paint_circle["circle-radius"]),"circle-color":new Yr(V.paint_circle["circle-color"]),"circle-blur":new Yr(V.paint_circle["circle-blur"]),"circle-opacity":new Yr(V.paint_circle["circle-opacity"]),"circle-translate":new Jr(V.paint_circle["circle-translate"]),"circle-translate-anchor":new Jr(V.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Jr(V.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Jr(V.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Yr(V.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Yr(V.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Yr(V.paint_circle["circle-stroke-opacity"])})},pi="undefined"!=typeof Float32Array?Float32Array:Array;function fi(){var t=new pi(9);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function di(){var t=new pi(3);return t[0]=0,t[1]=0,t[2]=0,t}function mi(t){var e=t[0],r=t[1],n=t[2];return Math.sqrt(e*e+r*r+n*n)}function yi(t,e,r){var n=new pi(3);return n[0]=t,n[1]=e,n[2]=r,n}Math.PI;var gi,vi=mi,_i=(gi=di(),function(t,e,r,n,i,o){var a,s;for(e||(e=3),r||(r=0),s=n?Math.min(n*e+r,t.length):t.length,a=r;a0&&(a=1/Math.sqrt(a),t[0]=r*a,t[1]=n*a,t[2]=i*a,t[3]=o*a),t}function wi(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*a,t}var Ei=function(){var t=xi();return function(e,r,n,i,o,a){var s,l;for(r||(r=4),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;st.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");for(var a=t.data,s=e.data,l=0;l80*r){n=o=t[0],i=a=t[1];for(var d=r;do&&(o=s),l>a&&(a=l);u=0!==(u=Math.max(o-n,a-i))?1/u:0}return qi(p,f,r,n,i,u),f}function Ui(t,e,r,n,i){var o,a;if(i===uo(t,e,r,n)>0)for(o=e;o=e;o-=n)a=ao(o,t[o],t[o+1],a);return a&&ro(a,a.next)&&(so(a),a=a.next),a}function $i(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!ro(n,n.next)&&0!==eo(n.prev,n,n.next))n=n.next;else{if(so(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function qi(t,e,r,n,i,o,a){if(t){!a&&o&&function(t,e,r,n){var i=t;do{null===i.z&&(i.z=Ji(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,o,a,s,l,u=1;do{for(r=t,t=null,o=null,a=0;r;){for(a++,n=r,s=0,e=0;e0||l>0&&n;)0!==s&&(0===l||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,l--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;r=n}o.nextZ=null,u*=2}while(a>1)}(i)}(t,n,i,o);for(var s,l,u=t;t.prev!==t.next;)if(s=t.prev,l=t.next,o?Gi(t,n,i,o):Zi(t))e.push(s.i/r),e.push(t.i/r),e.push(l.i/r),so(t),t=l.next,u=l.next;else if((t=l)===u){a?1===a?qi(t=Wi(t,e,r),e,r,n,i,o,2):2===a&&Xi(t,e,r,n,i,o):qi($i(t),e,r,n,i,o,1);break}}}function Zi(t){var e=t.prev,r=t,n=t.next;if(eo(e,r,n)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(Qi(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&eo(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function Gi(t,e,r,n){var i=t.prev,o=t,a=t.next;if(eo(i,o,a)>=0)return!1;for(var s=i.xo.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,c=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,h=Ji(s,l,e,r,n),p=Ji(u,c,e,r,n),f=t.prevZ,d=t.nextZ;f&&f.z>=h&&d&&d.z<=p;){if(f!==t.prev&&f!==t.next&&Qi(i.x,i.y,o.x,o.y,a.x,a.y,f.x,f.y)&&eo(f.prev,f,f.next)>=0)return!1;if(f=f.prevZ,d!==t.prev&&d!==t.next&&Qi(i.x,i.y,o.x,o.y,a.x,a.y,d.x,d.y)&&eo(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;f&&f.z>=h;){if(f!==t.prev&&f!==t.next&&Qi(i.x,i.y,o.x,o.y,a.x,a.y,f.x,f.y)&&eo(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;d&&d.z<=p;){if(d!==t.prev&&d!==t.next&&Qi(i.x,i.y,o.x,o.y,a.x,a.y,d.x,d.y)&&eo(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function Wi(t,e,r){var n=t;do{var i=n.prev,o=n.next.next;!ro(i,o)&&no(i,n,n.next,o)&&io(i,o)&&io(o,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(o.i/r),so(n),so(n.next),n=t=o),n=n.next}while(n!==t);return n}function Xi(t,e,r,n,i,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&to(a,s)){var l=oo(a,s);return a=$i(a,a.next),l=$i(l,l.next),qi(a,e,r,n,i,o),void qi(l,e,r,n,i,o)}s=s.next}a=a.next}while(a!==t)}function Hi(t,e){return t.x-e.x}function Ki(t,e){if(e=function(t,e){var r,n=e,i=t.x,o=t.y,a=-1/0;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var s=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&s>a){if(a=s,s===i){if(o===n.y)return n;if(o===n.next.y)return n.next}r=n.x=n.x&&n.x>=c&&i!==n.x&&Qi(or.x)&&io(n,t)&&(r=n,p=l),n=n.next;return r}(t,e)){var r=oo(e,t);$i(r,r.next)}}function Ji(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Yi(t){var e=t,r=t;do{e.x=0&&(t-a)*(n-s)-(r-a)*(e-s)>=0&&(r-a)*(o-s)-(i-a)*(n-s)>=0}function to(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&no(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&io(t,e)&&io(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)}function eo(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function ro(t,e){return t.x===e.x&&t.y===e.y}function no(t,e,r,n){return!!(ro(t,e)&&ro(r,n)||ro(t,n)&&ro(r,e))||eo(t,e,r)>0!=eo(t,e,n)>0&&eo(r,n,t)>0!=eo(r,n,e)>0}function io(t,e){return eo(t.prev,t,t.next)<0?eo(t,e,t.next)>=0&&eo(t,t.prev,e)>=0:eo(t,e,t.prev)<0||eo(t,t.next,e)<0}function oo(t,e){var r=new lo(t.i,t.x,t.y),n=new lo(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function ao(t,e,r,n){var i=new lo(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function so(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function lo(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function uo(t,e,r,n){for(var i=0,o=e,a=r-n;o0&&(n+=t[i-1].length,r.holes.push(n))}return r},Vi.default=Ni;var co=po,ho=po;function po(t,e,r,n,i){!function t(e,r,n,i,o){for(;i>n;){if(i-n>600){var a=i-n+1,s=r-n+1,l=Math.log(a),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(a-u)/a)*(s-a/2<0?-1:1);t(e,r,Math.max(n,Math.floor(r-s*u/a+c)),Math.min(i,Math.floor(r+(a-s)*u/a+c)),o)}var h=e[r],p=n,f=i;for(fo(e,n,r),o(e[i],h)>0&&fo(e,n,i);p0;)f--}0===o(e[n],h)?fo(e,n,f):fo(e,++f,i),f<=r&&(n=f+1),r<=f&&(i=f-1)}}(t,e,r||0,n||t.length-1,i||mo)}function fo(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function mo(t,e){return te?1:0}function yo(t,e){var r=t.length;if(r<=1)return[t];for(var n,i,o=[],a=0;a1)for(var l=0;lWn)||t.y===e.y&&(t.y<0||t.y>Wn)}function ko(t){return t.every(function(t){return t.x<0})||t.every(function(t){return t.x>Wn})||t.every(function(t){return t.y<0})||t.every(function(t){return t.y>Wn})}So.prototype.populate=function(t,e){for(var r=0,n=t;r=1){var y=p[d-1];if(!To(m,y)){u.vertexLength+4>Fn.MAX_VERTEX_ARRAY_LENGTH&&(u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));var g=m.sub(y)._perp()._unit(),v=y.dist(m);f+v>32768&&(f=0),Eo(this.layoutVertexArray,m.x,m.y,g.x,g.y,0,0,f),Eo(this.layoutVertexArray,m.x,m.y,g.x,g.y,0,1,f),f+=v,Eo(this.layoutVertexArray,y.x,y.y,g.x,g.y,0,0,f),Eo(this.layoutVertexArray,y.x,y.y,g.x,g.y,0,1,f);var _=u.vertexLength;this.indexArray.emplaceBack(_,_+1,_+2),this.indexArray.emplaceBack(_+1,_+2,_+3),u.vertexLength+=4,u.primitiveLength+=2}}}}u.vertexLength+a>Fn.MAX_VERTEX_ARRAY_LENGTH&&(u=this.segments.prepareSegment(a,this.layoutVertexArray,this.indexArray));for(var x=[],b=[],w=u.vertexLength,E=0,S=o;E>3}if(i--,1===n||2===n)o+=t.readSVarint(),a+=t.readSVarint(),1===n&&(e&&s.push(e),e=[]),e.push(new p(o,a));else{if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&s.push(e),s},Mo.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,o=0,a=1/0,s=-1/0,l=1/0,u=-1/0;t.pos>3}if(n--,1===r||2===r)(i+=t.readSVarint())s&&(s=i),(o+=t.readSVarint())u&&(u=o);else if(7!==r)throw new Error("unknown command "+r)}return[a,l,s,u]},Mo.prototype.toGeoJSON=function(t,e,r){var n,i,o=this.extent*Math.pow(2,r),a=this.extent*t,s=this.extent*e,l=this.loadGeometry(),u=Mo.types[this.type];function c(t){for(var e=0;e>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null}return e}(r))}function Oo(t,e,r){if(3===t){var n=new Do(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}Ro.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new Co(this._pbf,e,this.extent,this._keys,this._values)};var Fo={VectorTile:function(t,e){this.layers=t.readFields(Oo,{},e)},VectorTileFeature:Co,VectorTileLayer:Do},Vo=Fo.VectorTileFeature.types,No=63,jo=Math.cos(Math.PI/180*37.5),Uo=.5,$o=Math.pow(2,14)/Uo;function qo(t,e,r,n,i,o,a){t.emplaceBack(e.x,e.y,n?1:0,i?1:-1,Math.round(No*r.x)+128,Math.round(No*r.y)+128,1+(0===o?0:o<0?-1:1)|(a*Uo&63)<<2,a*Uo>>6)}var Zo=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(t){return t.id}),this.index=t.index,this.layoutVertexArray=new pn,this.indexArray=new En,this.programConfigurations=new Zn(zo,t.layers,t.zoom),this.segments=new Fn};function Go(t,e){return(t/e.tileTotal*(e.end-e.start)+e.start)*($o-1)}Zo.prototype.populate=function(t,e){for(var r=0,n=t;r=2&&t[u-1].equals(t[u-2]);)u--;for(var c=0;cc){var z=d.dist(x);if(z>2*h){var C=d.sub(d.sub(x)._mult(h/z)._round());this.distance+=C.dist(x),this.addCurrentVertex(C,this.distance,w.mult(1),0,0,!1,f,s),x=C}}var M=x&&b,P=M?r:b?g:v;if(M&&"round"===P&&(Ai&&(P="bevel"),"bevel"===P&&(A>2&&(P="flipbevel"),A100)T=E.clone().mult(-1);else{var L=w.x*E.y-w.y*E.x>0?-1:1,D=A*w.add(E).mag()/w.sub(E).mag();T._perp()._mult(D*L)}this.addCurrentVertex(d,this.distance,T,0,0,!1,f,s),this.addCurrentVertex(d,this.distance,T.mult(-1),0,0,!1,f,s)}else if("bevel"===P||"fakeround"===P){var R=w.x*E.y-w.y*E.x>0,B=-Math.sqrt(A*A-1);if(R?(y=0,m=B):(m=0,y=B),_||this.addCurrentVertex(d,this.distance,w,m,y,!1,f,s),"fakeround"===P){for(var O=Math.floor(8*(.5-(k-.5))),F=void 0,V=0;V=0;N--)F=w.mult((N+1)/(O+1))._add(E)._unit(),this.addPieSliceVertex(d,this.distance,F,R,f,s)}b&&this.addCurrentVertex(d,this.distance,E,-m,-y,!1,f,s)}else"butt"===P?(_||this.addCurrentVertex(d,this.distance,w,0,0,!1,f,s),b&&this.addCurrentVertex(d,this.distance,E,0,0,!1,f,s)):"square"===P?(_||(this.addCurrentVertex(d,this.distance,w,1,1,!1,f,s),this.e1=this.e2=-1),b&&this.addCurrentVertex(d,this.distance,E,-1,-1,!1,f,s)):"round"===P&&(_||(this.addCurrentVertex(d,this.distance,w,0,0,!1,f,s),this.addCurrentVertex(d,this.distance,w,1,1,!0,f,s),this.e1=this.e2=-1),b&&(this.addCurrentVertex(d,this.distance,E,-1,-1,!0,f,s),this.addCurrentVertex(d,this.distance,E,0,0,!1,f,s)));if(I&&S2*h){var U=d.add(b.sub(d)._mult(h/j)._round());this.distance+=U.dist(d),this.addCurrentVertex(U,this.distance,E.mult(1),0,0,!1,f,s),d=U}}_=!1}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,a)}},Zo.prototype.addCurrentVertex=function(t,e,r,n,i,o,a,s){var l,u=this.layoutVertexArray,c=this.indexArray;s&&(e=Go(e,s)),l=r.clone(),n&&l._sub(r.perp()._mult(n)),qo(u,t,l,o,!1,n,e),this.e3=a.vertexLength++,this.e1>=0&&this.e2>=0&&(c.emplaceBack(this.e1,this.e2,this.e3),a.primitiveLength++),this.e1=this.e2,this.e2=this.e3,l=r.mult(-1),i&&l._sub(r.perp()._mult(i)),qo(u,t,l,o,!0,-i,e),this.e3=a.vertexLength++,this.e1>=0&&this.e2>=0&&(c.emplaceBack(this.e1,this.e2,this.e3),a.primitiveLength++),this.e1=this.e2,this.e2=this.e3,e>$o/2&&!s&&(this.distance=0,this.addCurrentVertex(t,this.distance,r,n,i,o,a))},Zo.prototype.addPieSliceVertex=function(t,e,r,n,i,o){r=r.mult(n?-1:1);var a=this.layoutVertexArray,s=this.indexArray;o&&(e=Go(e,o)),qo(a,t,r,!1,n,0,e),this.e3=i.vertexLength++,this.e1>=0&&this.e2>=0&&(s.emplaceBack(this.e1,this.e2,this.e3),i.primitiveLength++),n?this.e2=this.e3:this.e1=this.e3},Tr("LineBucket",Zo,{omit:["layers"]});var Wo=new en({"line-cap":new Jr(V.layout_line["line-cap"]),"line-join":new Yr(V.layout_line["line-join"]),"line-miter-limit":new Jr(V.layout_line["line-miter-limit"]),"line-round-limit":new Jr(V.layout_line["line-round-limit"])}),Xo={paint:new en({"line-opacity":new Yr(V.paint_line["line-opacity"]),"line-color":new Yr(V.paint_line["line-color"]),"line-translate":new Jr(V.paint_line["line-translate"]),"line-translate-anchor":new Jr(V.paint_line["line-translate-anchor"]),"line-width":new Yr(V.paint_line["line-width"]),"line-gap-width":new Yr(V.paint_line["line-gap-width"]),"line-offset":new Yr(V.paint_line["line-offset"]),"line-blur":new Yr(V.paint_line["line-blur"]),"line-dasharray":new Qr(V.paint_line["line-dasharray"]),"line-pattern":new Qr(V.paint_line["line-pattern"]),"line-gradient":new tn(V.paint_line["line-gradient"])}),layout:Wo},Ho=new(function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.possiblyEvaluate=function(e,r){return r=new Ur(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),t.prototype.possiblyEvaluate.call(this,e,r)},e.prototype.evaluate=function(e,r,n,i){return r=v({},r,{zoom:Math.floor(r.zoom)}),t.prototype.evaluate.call(this,e,r,n,i)},e}(Yr))(Xo.paint.properties["line-width"].specification);Ho.useIntegerZoom=!0;var Ko=function(t){function e(e){t.call(this,e,Xo)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._handleSpecialPaintPropertyUpdate=function(t){"line-gradient"===t&&this._updateGradient()},e.prototype._updateGradient=function(){var t=this._transitionablePaint._values["line-gradient"].value.expression;this.gradient=Di(t,"lineProgress"),this.gradientTexture=null},e.prototype.recalculate=function(e){t.prototype.recalculate.call(this,e),this.paint._values["line-floorwidth"]=Ho.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)},e.prototype.createBucket=function(t){return new Zo(t)},e.prototype.queryRadius=function(t){var e=t,r=Jo(li("line-width",this,e),li("line-gap-width",this,e)),n=li("line-offset",this,e);return r/2+Math.abs(n)+ui(this.paint.get("line-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,i,o,a){var s=ci(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),o.angle,a),l=a/2*Jo(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),u=this.paint.get("line-offset").evaluate(e,r);return u&&(n=function(t,e){for(var r=[],n=new p(0,0),i=0;i0?e+2*t:t}var Yo=sn([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"}]),Qo=sn([{name:"a_projected_pos",components:3,type:"Float32"}],4),ta=(sn([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),sn([{name:"a_placed",components:2,type:"Uint8"}],4)),ea=(sn([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"},{type:"Int16",name:"radius"},{type:"Int16",name:"signedDistanceFromAnchor"}]),sn([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4)),ra=sn([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4);function na(t,e,r){var n=e.layout.get("text-transform").evaluate(r,{});return"uppercase"===n?t=t.toLocaleUpperCase():"lowercase"===n&&(t=t.toLocaleLowerCase()),jr.applyArabicShaping&&(t=jr.applyArabicShaping(t)),t}sn([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"hidden"}]),sn([{type:"Float32",name:"offsetX"}]),sn([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var ia={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},oa=function(t){function e(e,r,n,i){t.call(this,e,r),this.angle=n,void 0!==i&&(this.segment=i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.clone=function(){return new e(this.x,this.y,this.angle,this.segment)},e}(p);function aa(t,e){var r=e.expression;if("constant"===r.kind)return{functionType:"constant",layoutSize:r.evaluate(new Ur(t+1))};if("source"===r.kind)return{functionType:"source"};for(var n=r.zoomStops,i=0;i0)&&("constant"!==i.value.kind||i.value.value.length>0),l="constant"!==a.value.kind||a.value.value&&a.value.value.length>0;if(this.features=[],s||l){for(var u=e.iconDependencies,c=e.glyphDependencies,h=new Ur(this.zoom),p=0,f=t;p=0;s--)o[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:i},s>0&&(i+=e[s-1].dist(e[s]));for(var l=0;l0;this.addCollisionDebugVertices(s,l,u,c,h?this.collisionCircle:this.collisionBox,a.anchorPoint,r,h)}}}},fa.prototype.deserializeCollisionBoxes=function(t,e,r,n,i){for(var o={},a=e;a0},fa.prototype.hasIconData=function(){return this.icon.segments.get().length>0},fa.prototype.hasCollisionBoxData=function(){return this.collisionBox.segments.get().length>0},fa.prototype.hasCollisionCircleData=function(){return this.collisionCircle.segments.get().length>0},fa.prototype.sortFeatures=function(t){var e=this;if(this.sortFeaturesByY&&this.sortedAngle!==t&&(this.sortedAngle=t,!(this.text.segments.get().length>1||this.icon.segments.get().length>1))){for(var r=[],n=0;ni.maxh||t>i.maxw||r<=i.maxh&&t<=i.maxw&&(a=i.maxw*i.maxh-t*r)o.free)){if(r===o.h)return this.allocShelf(s,t,r,n);r>o.h||rc)&&(h=2*Math.max(t,c)),(ll)&&(u=2*Math.max(r,l)),this.resize(h,u),this.packOne(t,r,n)):null},t.prototype.allocFreebin=function(t,e,r,n){var i=this.freebins.splice(t,1)[0];return i.id=n,i.w=e,i.h=r,i.refcount=0,this.bins[n]=i,this.ref(i),i},t.prototype.allocShelf=function(t,e,r,n){var i=this.shelves[t].alloc(e,r,n);return this.bins[n]=i,this.ref(i),i},t.prototype.shrink=function(){if(this.shelves.length>0){for(var t=0,e=0,r=0;rthis.free||e>this.h)return null;var n=this.x;return this.x+=t,this.free-=t,new function(t,e,r,n,i,o,a){this.id=t,this.x=e,this.y=r,this.w=n,this.h=i,this.maxw=o||n,this.maxh=a||i,this.refcount=0}(r,n,this.y,t,e,t,this.h)},e.prototype.resize=function(t){return this.free+=t-this.w,this.w=t,!0},t}()}),wa=function(t,e){var r=e.pixelRatio;this.paddedRect=t,this.pixelRatio=r},Ea={tl:{configurable:!0},br:{configurable:!0},displaySize:{configurable:!0}};Ea.tl.get=function(){return[this.paddedRect.x+1,this.paddedRect.y+1]},Ea.br.get=function(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]},Ea.displaySize.get=function(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]},Object.defineProperties(wa.prototype,Ea);var Sa=function(t){var e=new Pi({width:0,height:0}),r={},n=new ba(0,0,{autoResize:!0});for(var i in t){var o=t[i],a=n.packOne(o.data.width+2,o.data.height+2);e.resize({width:n.w,height:n.h}),Pi.copy(o.data,e,{x:0,y:0},{x:a.x+1,y:a.y+1},o.data),r[i]=new wa(a,o)}n.shrink(),e.resize({width:n.w,height:n.h}),this.image=e,this.positions=r};Tr("ImagePosition",wa),Tr("ImageAtlas",Sa);var Ta=self.HTMLImageElement,ka=self.HTMLCanvasElement,Aa=self.HTMLVideoElement,Ia=self.ImageData,za=function(t,e,r,n){this.context=t,this.format=r,this.texture=t.gl.createTexture(),this.update(e,n)};za.prototype.update=function(t,e){var r=t.width,n=t.height,i=!this.size||this.size[0]!==r||this.size[1]!==n,o=this.context,a=o.gl;this.useMipmap=Boolean(e&&e.useMipmap),a.bindTexture(a.TEXTURE_2D,this.texture),i?(this.size=[r,n],o.pixelStoreUnpack.set(1),this.format!==a.RGBA||e&&!1===e.premultiply||o.pixelStoreUnpackPremultiplyAlpha.set(!0),t instanceof Ta||t instanceof ka||t instanceof Aa||t instanceof Ia?a.texImage2D(a.TEXTURE_2D,0,this.format,this.format,a.UNSIGNED_BYTE,t):a.texImage2D(a.TEXTURE_2D,0,this.format,r,n,0,this.format,a.UNSIGNED_BYTE,t.data)):t instanceof Ta||t instanceof ka||t instanceof Aa||t instanceof Ia?a.texSubImage2D(a.TEXTURE_2D,0,0,0,a.RGBA,a.UNSIGNED_BYTE,t):a.texSubImage2D(a.TEXTURE_2D,0,0,0,r,n,a.RGBA,a.UNSIGNED_BYTE,t.data),this.useMipmap&&this.isSizePowerOfTwo()&&a.generateMipmap(a.TEXTURE_2D)},za.prototype.bind=function(t,e,r){var n=this.context.gl;n.bindTexture(n.TEXTURE_2D,this.texture),r!==n.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(r=n.LINEAR),t!==this.filter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,r||t),this.filter=t),e!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,e),this.wrap=e)},za.prototype.isSizePowerOfTwo=function(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0},za.prototype.destroy=function(){this.context.gl.deleteTexture(this.texture),this.texture=null};var Ca=function(t,e,r,n,i){var o,a,s=8*i-n-1,l=(1<>1,c=-7,h=r?i-1:0,p=r?-1:1,f=t[e+h];for(h+=p,o=f&(1<<-c)-1,f>>=-c,c+=s;c>0;o=256*o+t[e+h],h+=p,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=256*a+t[e+h],h+=p,c-=8);if(0===o)o=1-u;else{if(o===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,n),o-=u}return(f?-1:1)*a*Math.pow(2,o-n)},Ma=function(t,e,r,n,i,o){var a,s,l,u=8*o-i-1,c=(1<>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,d=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),(e+=a+h>=1?p/l:p*Math.pow(2,1-h))*l>=2&&(a++,l/=2),a+h>=c?(s=0,a=c):a+h>=1?(s=(e*l-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+f]=255&s,f+=d,s/=256,i-=8);for(a=a<0;t[r+f]=255&a,f+=d,a/=256,u-=8);t[r+f-d]|=128*m},Pa=La;function La(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}function Da(t){return t.type===La.Bytes?t.readVarint()+t.pos:t.pos+1}function Ra(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Ba(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.ceil(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function Oa(t,e){for(var r=0;r>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function Xa(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}La.Varint=0,La.Fixed64=1,La.Bytes=2,La.Fixed32=5,La.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos>3,o=this.pos;this.type=7&n,t(i,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=Ga(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Xa(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Ga(this.buf,this.pos)+4294967296*Ga(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=Ga(this.buf,this.pos)+4294967296*Xa(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=Ca(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Ca(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,i,o=r.buf;if(n=(112&(i=o[r.pos++]))>>4,i<128)return Ra(t,n,e);if(n|=(127&(i=o[r.pos++]))<<3,i<128)return Ra(t,n,e);if(n|=(127&(i=o[r.pos++]))<<10,i<128)return Ra(t,n,e);if(n|=(127&(i=o[r.pos++]))<<17,i<128)return Ra(t,n,e);if(n|=(127&(i=o[r.pos++]))<<24,i<128)return Ra(t,n,e);if(n|=(1&(i=o[r.pos++]))<<31,i<128)return Ra(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=function(t,e,r){for(var n="",i=e;i239?4:l>223?3:l>191?2:1;if(i+c>r)break;1===c?l<128&&(u=l):2===c?128==(192&(o=t[i+1]))&&(u=(31&l)<<6|63&o)<=127&&(u=null):3===c?(o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&((u=(15&l)<<12|(63&o)<<6|63&a)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&((u=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,n+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),n+=String.fromCharCode(u),i+=c}return n}(this.buf,this.pos,t);return this.pos=t,e},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){var r=Da(this);for(t=t||[];this.pos127;);else if(e===La.Bytes)this.pos=this.readVarint()+this.pos;else if(e===La.Fixed32)this.pos+=4;else{if(e!==La.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455||t<0?function(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos]=127&t}(r,0,e),function(t,e){var r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,r){for(var n,i,o=0;o55295&&n<57344){if(!i){n>56319||o+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128)}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&Ba(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),Ma(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Ma(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r=128&&Ba(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,La.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){this.writeMessage(t,Oa,e)},writePackedSVarint:function(t,e){this.writeMessage(t,Fa,e)},writePackedBoolean:function(t,e){this.writeMessage(t,ja,e)},writePackedFloat:function(t,e){this.writeMessage(t,Va,e)},writePackedDouble:function(t,e){this.writeMessage(t,Na,e)},writePackedFixed32:function(t,e){this.writeMessage(t,Ua,e)},writePackedSFixed32:function(t,e){this.writeMessage(t,$a,e)},writePackedFixed64:function(t,e){this.writeMessage(t,qa,e)},writePackedSFixed64:function(t,e){this.writeMessage(t,Za,e)},writeBytesField:function(t,e){this.writeTag(t,La.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,La.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,La.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,La.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,La.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,La.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,La.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,La.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,La.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,La.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var Ha=3;function Ka(t,e,r){1===t&&r.readMessage(Ja,e)}function Ja(t,e,r){if(3===t){var n=r.readMessage(Ya,{}),i=n.id,o=n.bitmap,a=n.width,s=n.height,l=n.left,u=n.top,c=n.advance;e.push({id:i,bitmap:new Mi({width:a+2*Ha,height:s+2*Ha},o),metrics:{width:a,height:s,left:l,top:u,advance:c}})}}function Ya(t,e,r){1===t?e.id=r.readVarint():2===t?e.bitmap=r.readBytes():3===t?e.width=r.readVarint():4===t?e.height=r.readVarint():5===t?e.left=r.readSVarint():6===t?e.top=r.readSVarint():7===t&&(e.advance=r.readVarint())}var Qa=Ha,ts=function(t,e,r){this.target=t,this.parent=e,this.mapId=r,this.callbacks={},this.callbackID=0,b(["receive"],this),this.target.addEventListener("message",this.receive,!1)};ts.prototype.send=function(t,e,r,n){var i=r?this.mapId+":"+this.callbackID++:null;r&&(this.callbacks[i]=r);var o=[];this.target.postMessage({targetMapId:n,sourceMapId:this.mapId,type:t,id:String(i),data:Ar(e,o)},o)},ts.prototype.receive=function(t){var e,r=this,n=t.data,i=n.id;if(!n.targetMapId||this.mapId===n.targetMapId){var o=function(t,e){var n=[];r.target.postMessage({sourceMapId:r.mapId,type:"",id:String(i),error:t?Ar(t):null,data:Ar(e,n)},n)};if(""===n.type)e=this.callbacks[n.id],delete this.callbacks[n.id],e&&n.error?e(Ir(n.error)):e&&e(null,Ir(n.data));else if(void 0!==n.id&&this.parent[n.type])this.parent[n.type](n.sourceMapId,Ir(n.data),o);else if(void 0!==n.id&&this.parent.getWorkerSource){var a=n.type.split("."),s=Ir(n.data);this.parent.getWorkerSource(n.sourceMapId,a[0],s.source)[a[1]](s,o)}else this.parent[n.type](Ir(n.data))}},ts.prototype.remove=function(){this.target.removeEventListener("message",this.receive,!1)};var es=n(function(t,e){!function(t){function e(t,e,n){var i=r(256*t,256*(e=Math.pow(2,n)-e-1),n),o=r(256*(t+1),256*(e+1),n);return i[0]+","+i[1]+","+o[0]+","+o[1]}function r(t,e,r){var n=2*Math.PI*6378137/256/Math.pow(2,r);return[t*n-2*Math.PI*6378137/2,e*n-2*Math.PI*6378137/2]}t.getURL=function(t,r,n,i,o,a){return a=a||{},t+"?"+["bbox="+e(n,i,o),"format="+(a.format||"image/png"),"service="+(a.service||"WMS"),"version="+(a.version||"1.1.1"),"request="+(a.request||"GetMap"),"srs="+(a.srs||"EPSG:3857"),"width="+(a.width||256),"height="+(a.height||256),"layers="+r].join("&")},t.getTileBBox=e,t.getMercCoords=r,Object.defineProperty(t,"__esModule",{value:!0})}(e)});r(es);var rs=es.getTileBBox,ns=function(t,e,r){this.z=t,this.x=e,this.y=r,this.key=as(0,t,e,r)};ns.prototype.equals=function(t){return this.z===t.z&&this.x===t.x&&this.y===t.y},ns.prototype.url=function(t,e){var r=rs(this.x,this.y,this.z),n=function(t,e,r){for(var n,i="",o=t;o>0;o--)i+=(e&(n=1<this.canonical.z?new os(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new os(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)},os.prototype.isChildOf=function(t){var e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ>e&&t.canonical.y===this.canonical.y>>e},os.prototype.children=function(t){if(this.overscaledZ>=t)return[new os(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];var e=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return[new os(e,this.wrap,e,r,n),new os(e,this.wrap,e,r+1,n),new os(e,this.wrap,e,r,n+1),new os(e,this.wrap,e,r+1,n+1)]},os.prototype.isLessThan=function(t){return this.wrapt.wrap)&&(this.overscaledZt.overscaledZ)&&(this.canonical.xt.canonical.x)&&this.canonical.y=this.dim+this.border||e<-this.border||e>=this.dim+this.border)throw new RangeError("out of range source coordinates for DEM data");return(e+this.border)*this.stride+(t+this.border)},Tr("Level",ss);var ls=function(t,e,r){this.uid=t,this.scale=e||1,this.level=r||new ss(256,512),this.loaded=!!r};ls.prototype.loadFromImage=function(t,e){if(t.height!==t.width)throw new RangeError("DEM tiles must be square");if(e&&"mapbox"!==e&&"terrarium"!==e)return A('"'+e+'" is not a valid encoding type. Valid types include "mapbox" and "terrarium".');var r=this.level=new ss(t.width,t.width/2),n=t.data;this._unpackData(r,n,e||"mapbox");for(var i=0;i=0&&l[3]>=0&&this.grid.insert(o,l[0],l[1],l[2],l[3])}},ds.prototype.loadVTLayers=function(){return this.vtLayers||(this.vtLayers=new Fo.VectorTile(new Pa(this.rawTileData)).layers,this.sourceLayerCoder=new cs(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers},ds.prototype.query=function(t,e,r){var n=this;this.loadVTLayers();for(var i=t.params||{},o=Wn/t.tileSize/t.scale,a=Xe(i.filter),s=t.queryGeometry,l=t.queryPadding*o,u=1/0,c=1/0,h=-1/0,p=-1/0,f=0;f=0)return!0;return!1}(o,l)){var u=this.sourceLayerCoder.decode(r),c=this.vtLayers[u].feature(n);if(i(new Ur(this.tileID.overscaledZ),c))for(var h=0;h>a.z,l=new p(a.x*s,a.y*s),u=new p(l.x+s,l.y+s),c=this.segments.prepareSegment(4,r,n);r.emplaceBack(l.x,l.y,l.x,l.y),r.emplaceBack(u.x,l.y,u.x,l.y),r.emplaceBack(l.x,u.y,l.x,u.y),r.emplaceBack(u.x,u.y,u.x,u.y);var h=c.vertexLength;n.emplaceBack(h,h+1,h+2),n.emplaceBack(h+1,h+2,h+3),c.vertexLength+=4,c.primitiveLength+=2}this.maskedBoundsBuffer=e.createVertexBuffer(r,us.members),this.maskedIndexBuffer=e.createIndexBuffer(n)}},ys.prototype.hasData=function(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state},ys.prototype.setExpiryData=function(t){var e=this.expirationTime;if(t.cacheControl){var r=function(t){var e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,function(t,r,n,i){var o=n||i;return e[r]=!o||o.toLowerCase(),""}),e["max-age"]){var r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e}(t.cacheControl);r["max-age"]&&(this.expirationTime=Date.now()+1e3*r["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){var n=Date.now(),i=!1;if(this.expirationTime>n)i=!1;else if(e)if(this.expirationTime=200&&r.status<300&&r.response){var n;try{n=JSON.parse(r.response)}catch(t){return e(t)}e(null,n)}else 401===r.status&&t.url.match(/mapbox.com/)?e(new M(r.statusText+": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens",r.status,t.url)):e(new M(r.statusText,r.status,t.url))},r.send(),r},t.getImage=function(t,e){return L(t,function(t,r){if(t)e(t);else if(r){var n=new self.Image,i=self.URL||self.webkitURL;n.onload=function(){e(null,n),i.revokeObjectURL(n.src)};var o=new self.Blob([new Uint8Array(r.data)],{type:"image/png"});n.cacheControl=r.cacheControl,n.expires=r.expires,n.src=r.data.byteLength?i.createObjectURL(o):"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII="}})},t.ResourceType=C,t.RGBAImage=Pi,t.default$3=ba,t.ImagePosition=wa,t.default$4=za,t.getArrayBuffer=L,t.default$5=function(t){return new Pa(t).readFields(Ka,[])},t.default$6=Cr,t.asyncAll=function(t,e,r){if(!t.length)return r(null,[]);var n=t.length,i=new Array(t.length),o=null;t.forEach(function(t,a){e(t,function(t,e){t&&(o=t),i[a]=e,0==--n&&r(o,i)})})},t.AlphaImage=Mi,t.default$7=V,t.endsWith=w,t.extend=v,t.sphericalToCartesian=function(t){var e=t[0],r=t[1],n=t[2];return r+=90,r*=Math.PI/180,n*=Math.PI/180,{x:e*Math.cos(r)*Math.sin(n),y:e*Math.sin(r)*Math.sin(n),z:e*Math.cos(n)}},t.Evented=F,t.validateStyle=mr,t.validateLight=yr,t.emitValidationErrors=_r,t.default$8=at,t.number=Mt,t.Properties=en,t.Transitionable=Zr,t.Transitioning=Wr,t.PossiblyEvaluated=Kr,t.DataConstantProperty=Jr,t.warnOnce=A,t.uniqueId=x,t.default$9=ts,t.pick=function(t,e){for(var r={},n=0;n0&&(o=1/Math.sqrt(o),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o),t},t.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},t.cross=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[0],s=r[1],l=r[2];return t[0]=i*l-o*s,t[1]=o*a-n*l,t[2]=n*s-i*a,t},t.transformMat3=function(t,e,r){var n=e[0],i=e[1],o=e[2];return t[0]=n*r[0]+i*r[3]+o*r[6],t[1]=n*r[1]+i*r[4]+o*r[7],t[2]=n*r[2]+i*r[5]+o*r[8],t},t.len=vi,t.forEach$1=_i,t.PosArray=un,t.UnwrappedTileID=is,t.create$4=function(){var t=new pi(4);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},t.rotate=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l+o*s,t[1]=i*l+a*s,t[2]=n*-s+o*l,t[3]=i*-s+a*l,t},t.ease=y,t.bezier=m,t.default$23=Ur,t.setRTLTextPlugin=function(t,e){if(Or)throw new Error("setRTLTextPlugin cannot be called multiple times.");Or=!0,Fr=s.resolveURL(t),Br=function(t){t?(Or=!1,Fr=null,e&&e(t)):Vr=!0},Nr.fire(new B("pluginAvailable",{pluginURL:Fr,completionCallback:Br}))},t.values=function(t){var e=[];for(var r in t)e.push(t[r]);return e},t.default$24=Xe,t.default$25=oa,t.register=Tr,t.GLYPH_PBF_BORDER=Qa,t.shapeText=function(t,e,r,n,i,o,a,s,l,u){var c=t.trim();u===gs.vertical&&(c=function(t){for(var e="",r=0;r-r/2;){if(--a<0)return!1;s-=t[a].dist(o),o=t[a]}s+=t[a].dist(t[a+1]),a++;for(var l=[],u=0;sn;)u-=l.shift().angleDelta;if(u>i)return!1;a++,s+=h.dist(p)}return!0}function o(e,r,n,o,a,s,l,u,c){var h=o?.6*s*l:0,p=Math.max(o?o.right-o.left:0,a?a.right-a.left:0),f=0===e[0].x||e[0].x===c||0===e[0].y||e[0].y===c;return r-p*l=0&&S=0&&T=0&&y+p<=f){var k=new t.default$25(S,T,w,v);k._round(),a&&!i(r,k,l,a,s)||g.push(k)}}m+=b}return c||g.length||u||(g=e(r,m/2,o,a,s,l,u,!0,h)),g}(e,f?r/2*u%r:(p/2+2*s)*l*u%r,r,h,n,p*l,f,!1,c)}n.prototype.replace=function(t){this._layerConfigs={},this._layers={},this.update(t,[])},n.prototype.update=function(e,n){for(var i=this,o=0,a=e;o0&&(g=Math.max(10*l,g),this._addLineCollisionCircles(e,r,n,n.segment,v,g,i,o,a,h))}else{if(p){var _=new t.default(m,f),x=new t.default(y,f),b=new t.default(m,d),w=new t.default(y,d),E=p*Math.PI/180;_._rotate(E),x._rotate(E),b._rotate(E),w._rotate(E),m=Math.min(_.x,x.x,b.x,w.x),y=Math.max(_.x,x.x,b.x,w.x),f=Math.min(_.y,x.y,b.y,w.y),d=Math.max(_.y,x.y,b.y,w.y)}e.emplaceBack(n.x,n.y,m,f,y,d,i,o,a,0,0)}this.boxEndIndex=e.length};s.prototype._addLineCollisionCircles=function(t,e,r,n,i,o,a,s,l,u){var c=o/2,h=Math.floor(i/c),p=1+.4*Math.log(u)/Math.LN2,f=Math.floor(h*p/2),d=-o/2,m=r,y=n+1,g=d,v=-i/2,_=v-i/4;do{if(--y<0){if(g>v)return;y=0;break}g-=e[y].dist(m),m=e[y]}while(g>_);for(var x=e[y].dist(e[y+1]),b=-f;bi&&(E+=w-i),!(E=e.length)return;x=e[y].dist(e[y+1])}var S=E-g,T=e[y],k=e[y+1].sub(T)._unit()._mult(S)._add(T)._round(),A=Math.abs(E-d)0)for(var r=(this.length>>1)-1;r>=0;r--)this._down(r)}function h(t,e){return te?1:0}function p(e,r,n){void 0===r&&(r=1),void 0===n&&(n=!1);for(var i=1/0,o=1/0,a=-1/0,s=-1/0,u=e[0],c=0;ca)&&(a=h.x),(!c||h.y>s)&&(s=h.y)}var p=a-i,m=s-o,y=Math.min(p,m),g=y/2,v=new l(null,f);if(0===y)return new t.default(i,o);for(var _=i;_b.d||!b.d)&&(b=E,n&&console.log("found best %d after %d probes",Math.round(1e4*E.d)/1e4,w)),E.max-b.d<=r||(g=E.h/2,v.push(new d(E.p.x-g,E.p.y-g,g,e)),v.push(new d(E.p.x+g,E.p.y-g,g,e)),v.push(new d(E.p.x-g,E.p.y+g,g,e)),v.push(new d(E.p.x+g,E.p.y+g,g,e)),w+=4)}return n&&(console.log("num probes: "+w),console.log("best distance: "+b.d)),b.p}function f(t,e){return e.max-t.max}function d(e,r,n,i){this.p=new t.default(e,r),this.h=n,this.d=function(e,r){for(var n=!1,i=1/0,o=0;oe.y!=h.y>e.y&&e.x<(h.x-c.x)*(e.y-c.y)/(h.y-c.y)+c.x&&(n=!n),i=Math.min(i,t.distToSegmentSquared(e,c,h))}return(n?1:-1)*Math.sqrt(i)}(this.p,i),this.max=this.d+this.h*Math.SQRT2}function m(e,r,n,i,o,a){e.createArrays(),e.symbolInstances=[];var s=512*e.overscaling;e.tilePixelRatio=t.default$10/s,e.compareText={},e.iconsNeedLinear=!1;var l=e.layers[0].layout,u=e.layers[0]._unevaluatedLayout._values,c={};if("composite"===e.textSizeData.functionType){var h=e.textSizeData.zoomRange,p=h.min,f=h.max;c.compositeTextSizes=[u["text-size"].possiblyEvaluate(new t.default$23(p)),u["text-size"].possiblyEvaluate(new t.default$23(f))]}if("composite"===e.iconSizeData.functionType){var d=e.iconSizeData.zoomRange,m=d.min,g=d.max;c.compositeIconSizes=[u["icon-size"].possiblyEvaluate(new t.default$23(m)),u["icon-size"].possiblyEvaluate(new t.default$23(g))]}c.layoutTextSize=u["text-size"].possiblyEvaluate(new t.default$23(e.zoom+1)),c.layoutIconSize=u["icon-size"].possiblyEvaluate(new t.default$23(e.zoom+1)),c.textMaxSize=u["text-size"].possiblyEvaluate(new t.default$23(18));for(var v=24*l.get("text-line-height"),_="map"===l.get("text-rotation-alignment")&&"line"===l.get("symbol-placement"),x=l.get("text-keep-upright"),b=0,w=e.features;b=t.default$10||c.y<0||c.y>=t.default$10||e.symbolInstances.push(function(e,r,n,i,o,l,u,c,h,p,f,d,m,y,v,_,x,b,w,E,S){var T,k,A=e.addToLineVertexArray(r,n),I=0,z=0,C=0,M=i.horizontal?i.horizontal.text:"",P=[];if(i.horizontal){var L=l.layout.get("text-rotate").evaluate(w,{});T=new s(u,n,r,c,h,p,i.horizontal,f,d,m,e.overscaling,L),z+=g(e,r,i.horizontal,l,m,w,y,A,i.vertical?t.WritingMode.horizontal:t.WritingMode.horizontalOnly,P,E,S),i.vertical&&(C+=g(e,r,i.vertical,l,m,w,y,A,t.WritingMode.vertical,P,E,S))}var D=T?T.boxStartIndex:e.collisionBoxArray.length,R=T?T.boxEndIndex:e.collisionBoxArray.length;if(o){var B=function(e,r,n,i,o,a){var s,l,u,c,h=r.image,p=n.layout,f=r.top-1/h.pixelRatio,d=r.left-1/h.pixelRatio,m=r.bottom+1/h.pixelRatio,y=r.right+1/h.pixelRatio;if("none"!==p.get("icon-text-fit")&&o){var g=y-d,v=m-f,_=p.get("text-size").evaluate(a,{})/24,x=o.left*_,b=o.right*_,w=o.top*_,E=b-x,S=o.bottom*_-w,T=p.get("icon-text-fit-padding")[0],k=p.get("icon-text-fit-padding")[1],A=p.get("icon-text-fit-padding")[2],I=p.get("icon-text-fit-padding")[3],z="width"===p.get("icon-text-fit")?.5*(S-v):0,C="height"===p.get("icon-text-fit")?.5*(E-g):0,M="width"===p.get("icon-text-fit")||"both"===p.get("icon-text-fit")?E:g,P="height"===p.get("icon-text-fit")||"both"===p.get("icon-text-fit")?S:v;s=new t.default(x+C-I,w+z-T),l=new t.default(x+C+k+M,w+z-T),u=new t.default(x+C+k+M,w+z+A+P),c=new t.default(x+C-I,w+z+A+P)}else s=new t.default(d,f),l=new t.default(y,f),u=new t.default(y,m),c=new t.default(d,m);var L=n.layout.get("icon-rotate").evaluate(a,{})*Math.PI/180;if(L){var D=Math.sin(L),R=Math.cos(L),B=[R,-D,D,R];s._matMult(B),l._matMult(B),c._matMult(B),u._matMult(B)}return[{tl:s,tr:l,bl:c,br:u,tex:h.paddedRect,writingMode:void 0,glyphOffset:[0,0]}]}(0,o,l,0,i.horizontal,w),O=l.layout.get("icon-rotate").evaluate(w,{});k=new s(u,n,r,c,h,p,o,v,_,!1,e.overscaling,O),I=4*B.length;var F=e.iconSizeData,V=null;"source"===F.functionType?V=[10*l.layout.get("icon-size").evaluate(w,{})]:"composite"===F.functionType&&(V=[10*S.compositeIconSizes[0].evaluate(w,{}),10*S.compositeIconSizes[1].evaluate(w,{})]),e.addSymbols(e.icon,B,V,b,x,w,!1,r,A.lineStartIndex,A.lineLength)}var N=k?k.boxStartIndex:e.collisionBoxArray.length,j=k?k.boxEndIndex:e.collisionBoxArray.length;return e.glyphOffsetArray.length>=t.default$27.MAX_GLYPHS&&t.warnOnce("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),{key:M,textBoxStartIndex:D,textBoxEndIndex:R,iconBoxStartIndex:N,iconBoxEndIndex:j,textOffset:y,iconOffset:b,anchor:r,line:n,featureIndex:c,feature:w,numGlyphVertices:z,numVerticalGlyphVertices:C,numIconVertices:I,textOpacityState:new a,iconOpacityState:new a,isDuplicate:!1,placedTextSymbolIndices:P,crossTileID:0}}(e,c,o,n,i,e.layers[0],e.collisionBoxArray,r.index,r.sourceLayerIndex,e.index,x,S,A,m,w,T,I,y,r,l,u))};if("line"===d.get("symbol-placement"))for(var M=0,P=function(e,r,n,i,o){for(var a=[],s=0;s=i&&p.x>=i||(h.x>=i?h=new t.default(i,h.y+(p.y-h.y)*((i-h.x)/(p.x-h.x)))._round():p.x>=i&&(p=new t.default(i,h.y+(p.y-h.y)*((i-h.x)/(p.x-h.x)))._round()),h.y>=o&&p.y>=o||(h.y>=o?h=new t.default(h.x+(p.x-h.x)*((o-h.y)/(p.y-h.y)),o)._round():p.y>=o&&(p=new t.default(h.x+(p.x-h.x)*((o-h.y)/(p.y-h.y)),o)._round()),u&&h.equals(u[u.length-1])||(u=[h],a.push(u)),u.push(p)))))}return a}(r.geometry,0,0,t.default$10,t.default$10);M=0;a--)if(n.dist(o[a])0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),t}},peek:function(){return this.data[0]},_up:function(t){for(var e=this.data,r=this.compare,n=e[t];t>0;){var i=t-1>>1,o=e[i];if(r(n,o)>=0)break;e[t]=o,t=i}e[t]=n},_down:function(t){for(var e=this.data,r=this.compare,n=this.length>>1,i=e[t];t=0)break;e[t]=s,t=o}e[t]=i}},l.default=u;var _=function(e){var r=new t.AlphaImage({width:0,height:0}),n={},i=new t.default$3(0,0,{autoResize:!0});for(var o in e){var a=e[o],s=n[o]={};for(var l in a){var u=a[+l];if(u&&0!==u.bitmap.width&&0!==u.bitmap.height){var c=i.packOne(u.bitmap.width+2,u.bitmap.height+2);r.resize({width:i.w,height:i.h}),t.AlphaImage.copy(u.bitmap,r,{x:0,y:0},{x:c.x+1,y:c.y+1},u.bitmap),s[l]={rect:c,metrics:u.metrics}}}}i.shrink(),r.resize({width:i.w,height:i.h}),this.image=r,this.positions=n};t.register("GlyphAtlas",_);var x=function(e){this.tileID=new t.OverscaledTileID(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.uid=e.uid,this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.collectResourceTiming=!!e.collectResourceTiming};function b(e,r){for(var n=new t.default$23(r),i=0,o=e;i=k.maxzoom||"none"!==k.visibility&&(b(T,o.zoom),(h[k.id]=k.createBucket({index:s.bucketLayerIDs.length,layers:T,zoom:o.zoom,pixelRatio:o.pixelRatio,overscaling:o.overscaling,collisionBoxArray:o.collisionBoxArray,sourceLayerIndex:g,sourceID:o.source})).populate(v,p),s.bucketLayerIDs.push(T.map(function(t){return t.id})))}}}var A=t.mapObject(p.glyphDependencies,function(t){return Object.keys(t).map(Number)});Object.keys(A).length?n.send("getGlyphs",{uid:this.uid,stacks:A},function(t,e){l||(l=t,u=e,z.call(o))}):u={};var I=Object.keys(p.iconDependencies);function z(){if(l)return i(l);if(u&&c){var e=new _(u),r=new t.default$30(c);for(var n in h){var o=h[n];o instanceof t.default$27&&(b(o.layers,this.zoom),m(o,u,e.positions,c,r.positions,this.showCollisionBoxes))}this.status="done",i(null,{buckets:t.values(h).filter(function(t){return!t.isEmpty()}),featureIndex:s,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,iconAtlasImage:r.image})}}I.length?n.send("getImages",{icons:I},function(t,e){l||(l=t,c=e,z.call(o))}):c={},z.call(this)};var w="undefined"!=typeof performance,E={getEntriesByName:function(t){return!!(w&&performance&&performance.getEntriesByName)&&performance.getEntriesByName(t)},mark:function(t){return!!(w&&performance&&performance.mark)&&performance.mark(t)},measure:function(t,e,r){return!!(w&&performance&&performance.measure)&&performance.measure(t,e,r)},clearMarks:function(t){return!!(w&&performance&&performance.clearMarks)&&performance.clearMarks(t)},clearMeasures:function(t){return!!(w&&performance&&performance.clearMeasures)&&performance.clearMeasures(t)}},S=function(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},E.mark(this._marks.start)};function T(e,r){var n=t.getArrayBuffer(e.request,function(e,n){e?r(e):n&&r(null,{vectorTile:new t.default$31.VectorTile(new t.default$32(n.data)),rawData:n.data,cacheControl:n.cacheControl,expires:n.expires})});return function(){n.abort(),r()}}S.prototype.finish=function(){E.mark(this._marks.end);var t=E.getEntriesByName(this._marks.measure);return 0===t.length&&(E.measure(this._marks.measure,this._marks.start,this._marks.end),t=E.getEntriesByName(this._marks.measure),E.clearMarks(this._marks.start),E.clearMarks(this._marks.end),E.clearMeasures(this._marks.measure)),t},E.Performance=S;var k=function(t,e,r){this.actor=t,this.layerIndex=e,this.loadVectorData=r||T,this.loading={},this.loaded={}};k.prototype.loadTile=function(e,r){var n=this,i=e.uid;this.loading||(this.loading={});var o=!!(e&&e.request&&e.request.collectResourceTiming)&&new E.Performance(e.request),a=this.loading[i]=new x(e);a.abort=this.loadVectorData(e,function(e,s){if(delete n.loading[i],e||!s)return r(e);var l=s.rawData,u={};s.expires&&(u.expires=s.expires),s.cacheControl&&(u.cacheControl=s.cacheControl);var c={};if(o){var h=o.finish();h&&(c.resourceTiming=JSON.parse(JSON.stringify(h)))}a.vectorTile=s.vectorTile,a.parse(s.vectorTile,n.layerIndex,n.actor,function(e,n){if(e||!n)return r(e);r(null,t.extend({rawTileData:l.slice(0)},n,u,c))}),n.loaded=n.loaded||{},n.loaded[i]=a})},k.prototype.reloadTile=function(t,e){var r=this.loaded,n=t.uid,i=this;if(r&&r[n]){var o=r[n];o.showCollisionBoxes=t.showCollisionBoxes;var a=function(t,r){var n=o.reloadCallback;n&&(delete o.reloadCallback,o.parse(o.vectorTile,i.layerIndex,i.actor,n)),e(t,r)};"parsing"===o.status?o.reloadCallback=a:"done"===o.status&&o.parse(o.vectorTile,this.layerIndex,this.actor,a)}},k.prototype.abortTile=function(t,e){var r=this.loading,n=t.uid;r&&r[n]&&r[n].abort&&(r[n].abort(),delete r[n]),e()},k.prototype.removeTile=function(t,e){var r=this.loaded,n=t.uid;r&&r[n]&&delete r[n],e()};var A=function(){this.loading={},this.loaded={}};A.prototype.loadTile=function(e,r){var n=e.uid,i=e.encoding,o=new t.default$33(n);this.loading[n]=o,o.loadFromImage(e.rawImageData,i),delete this.loading[n],this.loaded=this.loaded||{},this.loaded[n]=o,r(null,o)},A.prototype.removeTile=function(t){var e=this.loaded,r=t.uid;e&&e[r]&&delete e[r]};var I={RADIUS:6378137,FLATTENING:1/298.257223563,POLAR_RADIUS:6356752.3142};function z(t){var e=0;if(t&&t.length>0){e+=Math.abs(C(t[0]));for(var r=1;r2){for(a=0;a=0}(t)===e?t:t.reverse()}var B=t.default$31.VectorTileFeature.prototype.toGeoJSON,O=function(e){this._feature=e,this.extent=t.default$10,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))};O.prototype.loadGeometry=function(){if(1===this._feature.type){for(var e=[],r=0,n=this._feature.geometry;r>31}function Y(t,e){for(var r=t.loadGeometry(),n=t.type,i=0,o=0,a=r.length,s=0;si;){if(o-i>600){var s=o-i+1,l=n-i+1,u=Math.log(s),c=.5*Math.exp(2*u/3),h=.5*Math.sqrt(u*c*(s-c)/s)*(l-s/2<0?-1:1);t(e,r,n,Math.max(i,Math.floor(n-l*c/s+h)),Math.min(o,Math.floor(n+(s-l)*c/s+h)),a)}var p=r[2*n+a],f=i,d=o;for(et(e,r,i,n),r[2*o+a]>p&&et(e,r,i,o);fp;)d--}r[2*i+a]===p?et(e,r,i,d):et(e,r,++d,o),d<=n&&(i=d+1),n<=d&&(o=d-1)}}(e,r,s,i,o,a%2),t(e,r,n,i,s-1,a+1),t(e,r,n,s+1,o,a+1)}};function et(t,e,r,n){rt(t,r,n),rt(e,2*r,2*n),rt(e,2*r+1,2*n+1)}function rt(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function nt(t,e,r,n){var i=t-r,o=e-n;return i*i+o*o}var it=function(t,e,r,n,i){return new ot(t,e,r,n,i)};function ot(t,e,r,n,i){e=e||at,r=r||st,i=i||Array,this.nodeSize=n||64,this.points=t,this.ids=new i(t.length),this.coords=new i(2*t.length);for(var o=0;o=r&&s<=i&&l>=n&&l<=o&&c.push(t[d]);else{var m=Math.floor((f+p)/2);s=e[2*m],l=e[2*m+1],s>=r&&s<=i&&l>=n&&l<=o&&c.push(t[m]);var y=(h+1)%2;(0===h?r<=s:n<=l)&&(u.push(f),u.push(m-1),u.push(y)),(0===h?i>=s:o>=l)&&(u.push(m+1),u.push(p),u.push(y))}}return c}(this.ids,this.coords,t,e,r,n,this.nodeSize)},within:function(t,e,r){return function(t,e,r,n,i,o){for(var a=[0,t.length-1,0],s=[],l=i*i;a.length;){var u=a.pop(),c=a.pop(),h=a.pop();if(c-h<=o)for(var p=h;p<=c;p++)nt(e[2*p],e[2*p+1],r,n)<=l&&s.push(t[p]);else{var f=Math.floor((h+c)/2),d=e[2*f],m=e[2*f+1];nt(d,m,r,n)<=l&&s.push(t[f]);var y=(u+1)%2;(0===u?r-i<=d:n-i<=m)&&(a.push(h),a.push(f-1),a.push(y)),(0===u?r+i>=d:n+i>=m)&&(a.push(f+1),a.push(c),a.push(y))}}return s}(this.ids,this.coords,t,e,r,this.nodeSize)}};function lt(t){this.options=mt(Object.create(this.options),t),this.trees=new Array(this.options.maxZoom+1)}function ut(t,e,r,n,i){return{x:t,y:e,zoom:1/0,id:n,properties:i,parentId:-1,numPoints:r}}function ct(t,e){var r=t.geometry.coordinates;return{x:ft(r[0]),y:dt(r[1]),zoom:1/0,id:e,parentId:-1}}function ht(t){return{type:"Feature",properties:pt(t),geometry:{type:"Point",coordinates:[(n=t.x,360*(n-.5)),(e=t.y,r=(180-360*e)*Math.PI/180,360*Math.atan(Math.exp(r))/Math.PI-90)]}};var e,r,n}function pt(t){var e=t.numPoints,r=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return mt(mt({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:r})}function ft(t){return t/360+.5}function dt(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function mt(t,e){for(var r in e)t[r]=e[r];return t}function yt(t){return t.x}function gt(t){return t.y}function vt(t,e,r,n,i,o){var a=i-r,s=o-n;if(0!==a||0!==s){var l=((t-r)*a+(e-n)*s)/(a*a+s*s);l>1?(r=i,n=o):l>0&&(r+=a*l,n+=s*l)}return(a=t-r)*a+(s=e-n)*s}function _t(t,e,r,n){var i={id:t||null,type:e,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,r=t.type;if("Point"===r||"MultiPoint"===r||"LineString"===r)xt(t,e);else if("Polygon"===r||"MultiLineString"===r)for(var n=0;n0&&(a+=n?(i*u-l*o)/2:Math.sqrt(Math.pow(l-i,2)+Math.pow(u-o,2))),i=l,o=u}var c=e.length-3;e[2]=1,function t(e,r,n,i){for(var o,a=i,s=e[r],l=e[r+1],u=e[n],c=e[n+1],h=r+3;ha&&(o=h,a=p)}a>i&&(o-r>3&&t(e,r,o,i),e[o+2]=a,n-o>3&&t(e,o,n,i))}(e,0,c,r),e[c+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function St(t,e,r,n){for(var i=0;i1?1:r}function At(t,e,r,n,i,o,a,s){if(n/=e,o>=(r/=e)&&a=n)return null;for(var l=[],u=0;u=r&&d=n)){var m=[];if("Point"===p||"MultiPoint"===p)It(h,m,r,n,i);else if("LineString"===p)zt(h,m,r,n,i,!1,s.lineMetrics);else if("MultiLineString"===p)Mt(h,m,r,n,i,!1);else if("Polygon"===p)Mt(h,m,r,n,i,!0);else if("MultiPolygon"===p)for(var y=0;y=r&&a<=n&&(e.push(t[o]),e.push(t[o+1]),e.push(t[o+2]))}}function zt(t,e,r,n,i,o,a){for(var s,l,u=Ct(t),c=0===i?Lt:Dt,h=t.start,p=0;p=r&&(l=c(u,f,d,y,g,r),a&&(u.start=h+s*l)):v>=n?_=r&&(l=c(u,f,d,y,g,r),x=!0),_>n&&v<=n&&(l=c(u,f,d,y,g,n),x=!0),!o&&x&&(a&&(u.end=h+s*l),e.push(u),u=Ct(t)),a&&(h+=s)}var b=t.length-3;f=t[b],d=t[b+1],m=t[b+2],(v=0===i?f:d)>=r&&v<=n&&Pt(u,f,d,m),b=u.length-3,o&&b>=3&&(u[b]!==u[0]||u[b+1]!==u[1])&&Pt(u,u[0],u[1],u[2]),u.length&&e.push(u)}function Ct(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function Mt(t,e,r,n,i,o){for(var a=0;aa.maxX&&(a.maxX=c),h>a.maxY&&(a.maxY=h)}return a}function Nt(t,e,r,n){var i=e.geometry,o=e.type,a=[];if("Point"===o||"MultiPoint"===o)for(var s=0;s0&&e.size<(i?a:n))r.numPoints+=e.length/3;else{for(var s=[],l=0;la)&&(r.numSimplified++,s.push(e[l]),s.push(e[l+1])),r.numPoints++;i&&function(t,e){for(var r=0,n=0,i=t.length,o=i-2;n0===e)for(n=0,i=t.length;n24)throw new Error("maxZoom should be in the 0-24 range");var n=function(t,e){var r=[];if("FeatureCollection"===t.type)for(var n=0;n=this.options.minZoom;i--){var o=+Date.now();this.trees[i+1]=it(n,yt,gt,this.options.nodeSize,Float32Array),n=this._cluster(n,i),e&&console.log("z%d: %d clusters in %dms",i,n.length,+Date.now()-o)}return this.trees[this.options.minZoom]=it(n,yt,gt,this.options.nodeSize,Float32Array),e&&console.timeEnd("total time"),this},getClusters:function(t,e){for(var r=this.trees[this._limitZoom(e)],n=r.range(ft(t[0]),dt(t[3]),ft(t[2]),dt(t[1])),i=[],o=0;o1&&console.time("creation"),p=this.tiles[h]=Vt(t,e,r,n,l),this.tileCoords.push({z:e,x:r,y:n}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,n,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));var f="z"+e;this.stats[f]=(this.stats[f]||0)+1,this.total++}if(p.source=t,i){if(e===l.maxZoom||e===i)continue;var d=1<1&&console.time("clipping");var m,y,g,v,_,x,b=.5*l.buffer/l.extent,w=.5-b,E=.5+b,S=1+b;m=y=g=v=null,_=At(t,c,r-b,r+E,0,p.minX,p.maxX,l),x=At(t,c,r+w,r+S,0,p.minX,p.maxX,l),t=null,_&&(m=At(_,c,n-b,n+E,1,p.minY,p.maxY,l),y=At(_,c,n+w,n+S,1,p.minY,p.maxY,l),_=null),x&&(g=At(x,c,n-b,n+E,1,p.minY,p.maxY,l),v=At(x,c,n+w,n+S,1,p.minY,p.maxY,l),x=null),u>1&&console.timeEnd("clipping"),s.push(m||[],e+1,2*r,2*n),s.push(y||[],e+1,2*r,2*n+1),s.push(g||[],e+1,2*r+1,2*n),s.push(v||[],e+1,2*r+1,2*n+1)}}},Ut.prototype.getTile=function(t,e,r){var n=this.options,i=n.extent,o=n.debug;if(t<0||t>24)return null;var a=1<1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var l,u=t,c=e,h=r;!l&&u>0;)u--,c=Math.floor(c/2),h=Math.floor(h/2),l=this.tiles[$t(u,c,h)];return l&&l.source?(o>1&&console.log("found parent tile z%d-%d-%d",u,c,h),o>1&&console.time("drilling down"),this.splitTile(l.source,u,c,h,t,e,r),o>1&&console.timeEnd("drilling down"),this.tiles[s]?Ot(this.tiles[s],i):null):null};var Zt=function(e){function r(t,r,n){e.call(this,t,r,qt),n&&(this.loadGeoJSON=n)}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.loadData=function(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=e,this._pendingLoadDataParams=t,this._state&&"Idle"!==this._state?this._state="NeedsLoadData":(this._state="Coalescing",this._loadData())},r.prototype._loadData=function(){var t=this;if(this._pendingCallback&&this._pendingLoadDataParams){var e=this._pendingCallback,r=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams;var n=!!(r&&r.request&&r.request.collectResourceTiming)&&new E.Performance(r.request);this.loadGeoJSON(r,function(i,o){if(i||!o)return e(i);if("object"!=typeof o)return e(new Error("Input data is not a valid GeoJSON object."));!function t(e,r){switch(e&&e.type||null){case"FeatureCollection":return e.features=e.features.map(L(t,r)),e;case"Feature":return e.geometry=t(e.geometry,r),e;case"Polygon":case"MultiPolygon":return function(t,e){return"Polygon"===t.type?t.coordinates=D(t.coordinates,e):"MultiPolygon"===t.type&&(t.coordinates=t.coordinates.map(L(D,e))),t}(e,r);default:return e}}(o,!0);try{t._geoJSONIndex=r.cluster?function(t){return new lt(t)}(r.superclusterOptions).load(o.features):new Ut(o,r.geojsonVtOptions)}catch(i){return e(i)}t.loaded={};var a={};if(n){var s=n.finish();s&&(a.resourceTiming={},a.resourceTiming[r.source]=JSON.parse(JSON.stringify(s)))}e(null,a)})}},r.prototype.coalesce=function(){"Coalescing"===this._state?this._state="Idle":"NeedsLoadData"===this._state&&(this._state="Coalescing",this._loadData())},r.prototype.reloadTile=function(t,r){var n=this.loaded,i=t.uid;return n&&n[i]?e.prototype.reloadTile.call(this,t,r):this.loadTile(t,r)},r.prototype.loadGeoJSON=function(e,r){if(e.request)t.getJSON(e.request,r);else{if("string"!=typeof e.data)return r(new Error("Input data is not a valid GeoJSON object."));try{return r(null,JSON.parse(e.data))}catch(t){return r(new Error("Input data is not a valid GeoJSON object."))}}},r.prototype.removeSource=function(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),e()},r}(k),Gt=function(e){var r=this;this.self=e,this.actor=new t.default$9(e,this),this.layerIndexes={},this.workerSourceTypes={vector:k,geojson:Zt},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=function(t,e){if(r.workerSourceTypes[t])throw new Error('Worker source with name "'+t+'" already registered.');r.workerSourceTypes[t]=e},this.self.registerRTLTextPlugin=function(e){if(t.plugin.isLoaded())throw new Error("RTL text plugin already registered.");t.plugin.applyArabicShaping=e.applyArabicShaping,t.plugin.processBidirectionalText=e.processBidirectionalText}};return Gt.prototype.setLayers=function(t,e,r){this.getLayerIndex(t).replace(e),r()},Gt.prototype.updateLayers=function(t,e,r){this.getLayerIndex(t).update(e.layers,e.removedIds),r()},Gt.prototype.loadTile=function(t,e,r){this.getWorkerSource(t,e.type,e.source).loadTile(e,r)},Gt.prototype.loadDEMTile=function(t,e,r){this.getDEMWorkerSource(t,e.source).loadTile(e,r)},Gt.prototype.reloadTile=function(t,e,r){this.getWorkerSource(t,e.type,e.source).reloadTile(e,r)},Gt.prototype.abortTile=function(t,e,r){this.getWorkerSource(t,e.type,e.source).abortTile(e,r)},Gt.prototype.removeTile=function(t,e,r){this.getWorkerSource(t,e.type,e.source).removeTile(e,r)},Gt.prototype.removeDEMTile=function(t,e){this.getDEMWorkerSource(t,e.source).removeTile(e)},Gt.prototype.removeSource=function(t,e,r){if(this.workerSources[t]&&this.workerSources[t][e.type]&&this.workerSources[t][e.type][e.source]){var n=this.workerSources[t][e.type][e.source];delete this.workerSources[t][e.type][e.source],void 0!==n.removeSource?n.removeSource(e,r):r()}},Gt.prototype.loadWorkerSource=function(t,e,r){try{this.self.importScripts(e.url),r()}catch(t){r(t.toString())}},Gt.prototype.loadRTLTextPlugin=function(e,r,n){try{t.plugin.isLoaded()||(this.self.importScripts(r),n(t.plugin.isLoaded()?null:new Error("RTL Text Plugin failed to import scripts from "+r)))}catch(t){n(t.toString())}},Gt.prototype.getLayerIndex=function(t){var e=this.layerIndexes[t];return e||(e=this.layerIndexes[t]=new n),e},Gt.prototype.getWorkerSource=function(t,e,r){var n=this;if(this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),!this.workerSources[t][e][r]){var i={send:function(e,r,i){n.actor.send(e,r,i,t)}};this.workerSources[t][e][r]=new this.workerSourceTypes[e](i,this.getLayerIndex(t))}return this.workerSources[t][e][r]},Gt.prototype.getDEMWorkerSource=function(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new A),this.demWorkerSources[t][e]},"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&new Gt(self),Gt}),n(0,function(t){var e=t.createCommonjsModule(function(t){function e(t){return!!("undefined"!=typeof window&&"undefined"!=typeof document&&Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray&&Function.prototype&&Function.prototype.bind&&Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions&&"JSON"in window&&"parse"in JSON&&"stringify"in JSON&&function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var t,e,r=new Blob([""],{type:"text/javascript"}),n=URL.createObjectURL(r);try{e=new Worker(n),t=!0}catch(e){t=!1}return e&&e.terminate(),URL.revokeObjectURL(n),t}()&&"Uint8ClampedArray"in window&&ArrayBuffer.isView&&function(t){return void 0===r[t]&&(r[t]=function(t){var r=document.createElement("canvas"),n=Object.create(e.webGLContextAttributes);return n.failIfMajorPerformanceCaveat=t,r.probablySupportsContext?r.probablySupportsContext("webgl",n)||r.probablySupportsContext("experimental-webgl",n):r.supportsContext?r.supportsContext("webgl",n)||r.supportsContext("experimental-webgl",n):r.getContext("webgl",n)||r.getContext("experimental-webgl",n)}(t)),r[t]}(t&&t.failIfMajorPerformanceCaveat))}t.exports?t.exports=e:window&&(window.mapboxgl=window.mapboxgl||{},window.mapboxgl.supported=e);var r={};e.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0}}),r={create:function(e,r,n){var i=t.default$1.document.createElement(e);return r&&(i.className=r),n&&n.appendChild(i),i},createNS:function(e,r){return t.default$1.document.createElementNS(e,r)}},n=t.default$1.document?t.default$1.document.documentElement.style:null;function i(t){if(!n)return null;for(var e=0;e=0?0:e.button},r.remove=function(t){t.parentNode&&t.parentNode.removeChild(t)};var h={API_URL:"https://api.mapbox.com",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null},p="See https://www.mapbox.com/api-documentation/#access-tokens";function f(t,e){var r=x(h.API_URL);if(t.protocol=r.protocol,t.authority=r.authority,"/"!==r.path&&(t.path=""+r.path+t.path),!h.REQUIRE_ACCESS_TOKEN)return b(t);if(!(e=e||h.ACCESS_TOKEN))throw new Error("An API access token is required to use Mapbox GL. "+p);if("s"===e[0])throw new Error("Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). "+p);return t.params.push("access_token="+e),b(t)}function d(t){return 0===t.indexOf("mapbox:")}var m=function(t,e){if(!d(t))return t;var r=x(t);return r.path="/v4/"+r.authority+".json",r.params.push("secure"),f(r,e)},y=function(t,e,r,n){var i=x(t);return d(t)?(i.path="/styles/v1"+i.path+"/sprite"+e+r,f(i,n)):(i.path+=""+e+r,b(i))},g=/(\.(png|jpg)\d*)(?=$)/,v=function(e,r,n){if(!r||!d(r))return e;var i=x(e),o=t.default$2.devicePixelRatio>=2||512===n?"@2x":"",a=t.default$2.supportsWebp?".webp":"$1";return i.path=i.path.replace(g,""+o+a),function(t){for(var e=0;e=0?1.2:1))}function k(t,e,r,n,i,o,a){for(var s=0;s65535)e(new Error("glyphs > 65535 not supported"));else{var l=o.requests[s];l||(l=o.requests[s]=[],I.loadGlyphRange(r,s,n.url,n.requestTransform,function(t,e){if(e)for(var r in e)o.glyphs[+r]=e[+r];for(var n=0,i=l;nthis.height)return t.warnOnce("LineAtlas out of space"),null;for(var o=0,a=0;a90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")};R.prototype.wrap=function(){return new R(t.wrap(this.lng,-180,180),this.lat)},R.prototype.toArray=function(){return[this.lng,this.lat]},R.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},R.prototype.toBounds=function(t){var e=360*t/40075017,r=e/Math.cos(Math.PI/180*this.lat);return new B(new R(this.lng-r,this.lat-e),new R(this.lng+r,this.lat+e))},R.convert=function(t){if(t instanceof R)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new R(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new R(Number(t.lng),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, or an array of [, ]")};var B=function(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))};B.prototype.setNorthEast=function(t){return this._ne=t instanceof R?new R(t.lng,t.lat):R.convert(t),this},B.prototype.setSouthWest=function(t){return this._sw=t instanceof R?new R(t.lng,t.lat):R.convert(t),this},B.prototype.extend=function(t){var e,r,n=this._sw,i=this._ne;if(t instanceof R)e=t,r=t;else{if(!(t instanceof B))return Array.isArray(t)?t.every(Array.isArray)?this.extend(B.convert(t)):this.extend(R.convert(t)):this;if(e=t._sw,r=t._ne,!e||!r)return this}return n||i?(n.lng=Math.min(e.lng,n.lng),n.lat=Math.min(e.lat,n.lat),i.lng=Math.max(r.lng,i.lng),i.lat=Math.max(r.lat,i.lat)):(this._sw=new R(e.lng,e.lat),this._ne=new R(r.lng,r.lat)),this},B.prototype.getCenter=function(){return new R((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},B.prototype.getSouthWest=function(){return this._sw},B.prototype.getNorthEast=function(){return this._ne},B.prototype.getNorthWest=function(){return new R(this.getWest(),this.getNorth())},B.prototype.getSouthEast=function(){return new R(this.getEast(),this.getSouth())},B.prototype.getWest=function(){return this._sw.lng},B.prototype.getSouth=function(){return this._sw.lat},B.prototype.getEast=function(){return this._ne.lng},B.prototype.getNorth=function(){return this._ne.lat},B.prototype.toArray=function(){return[this._sw.toArray(),this._ne.toArray()]},B.prototype.toString=function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"},B.prototype.isEmpty=function(){return!(this._sw&&this._ne)},B.convert=function(t){return!t||t instanceof B?t:new B(t)};var O=function(t,e,r){this.bounds=B.convert(this.validateBounds(t)),this.minzoom=e||0,this.maxzoom=r||24};O.prototype.validateBounds=function(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]},O.prototype.contains=function(t){var e=Math.floor(this.lngX(this.bounds.getWest(),t.z)),r=Math.floor(this.latY(this.bounds.getNorth(),t.z)),n=Math.ceil(this.lngX(this.bounds.getEast(),t.z)),i=Math.ceil(this.latY(this.bounds.getSouth(),t.z));return t.x>=e&&t.x=r&&t.y0&&(l[new t.OverscaledTileID(e.overscaledZ,o,r.z,i,r.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,r.z,a,r.y-1).key]={backfilled:!1}),r.y+10&&(n.resourceTiming=e._resourceTiming,e._resourceTiming=[]),e.fire(new t.Event("data",n))}})},r.prototype.onAdd=function(t){this.map=t,this.load()},r.prototype.setData=function(e){var r=this;return this._data=e,this.fire(new t.Event("dataloading",{dataType:"source"})),this._updateWorkerData(function(e){if(e)return r.fire(new t.ErrorEvent(e));var n={dataType:"source",sourceDataType:"content"};r._collectResourceTiming&&r._resourceTiming&&r._resourceTiming.length>0&&(n.resourceTiming=r._resourceTiming,r._resourceTiming=[]),r.fire(new t.Event("data",n))}),this},r.prototype._updateWorkerData=function(e){var r=this,n=t.extend({},this.workerOptions),i=this._data;"string"==typeof i?(n.request=this.map._transformRequest(t.default$2.resolveURL(i),t.ResourceType.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(i),this.workerID=this.dispatcher.send(this.type+".loadData",n,function(t,i){r._removed||i&&i.abandoned||(r._loaded=!0,i&&i.resourceTiming&&i.resourceTiming[r.id]&&(r._resourceTiming=i.resourceTiming[r.id].slice(0)),r.dispatcher.send(r.type+".coalesce",{source:n.source},null,r.workerID),e(t))},this.workerID)},r.prototype.loadTile=function(e,r){var n=this,i=void 0===e.workerID?"loadTile":"reloadTile",o={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:t.default$2.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes};e.workerID=this.dispatcher.send(i,o,function(t,o){return e.unloadVectorData(),e.aborted?r(null):t?r(t):(e.loadVectorData(o,n.map.painter,"reloadTile"===i),r(null))},this.workerID)},r.prototype.abortTile=function(t){t.aborted=!0},r.prototype.unloadTile=function(t){t.unloadVectorData(),this.dispatcher.send("removeTile",{uid:t.uid,type:this.type,source:this.id},null,t.workerID)},r.prototype.onRemove=function(){this._removed=!0,this.dispatcher.send("removeSource",{type:this.type,source:this.id},null,this.workerID)},r.prototype.serialize=function(){return t.extend({},this._options,{type:this.type,data:this._data})},r.prototype.hasTransition=function(){return!1},r}(t.Evented),U=function(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null};U.prototype.bind=function(t,e,r,n,i,o,a,s){this.context=t;for(var l=this.boundPaintVertexBuffers.length!==n.length,u=0;!l&&uthis.max){var a=this._getAndRemoveByKey(this.order[0]);a&&this.onRemove(a)}return this},K.prototype.has=function(t){return t.wrapped().key in this.data},K.prototype.getAndRemove=function(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null},K.prototype._getAndRemoveByKey=function(t){var e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value},K.prototype.get=function(t){return this.has(t)?this.data[t.wrapped().key][0].value:null},K.prototype.remove=function(t,e){if(!this.has(t))return this;var r=t.wrapped().key,n=void 0===e?0:this.data[r].indexOf(e),i=this.data[r][n];return this.data[r].splice(n,1),i.timeout&&clearTimeout(i.timeout),0===this.data[r].length&&delete this.data[r],this.onRemove(i.value),this.order.splice(this.order.indexOf(r),1),this},K.prototype.setMaxSize=function(t){for(this.max=t;this.order.length>this.max;){var e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this};var J=function(t,e,r){this.context=t;var n=t.gl;this.buffer=n.createBuffer(),this.dynamicDraw=Boolean(r),this.unbindVAO(),t.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer};J.prototype.unbindVAO=function(){this.context.extVertexArrayObject&&this.context.bindVertexArrayOES.set(null)},J.prototype.bind=function(){this.context.bindElementBuffer.set(this.buffer)},J.prototype.updateData=function(t){var e=this.context.gl;this.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)},J.prototype.destroy=function(){var t=this.context.gl;this.buffer&&(t.deleteBuffer(this.buffer),delete this.buffer)};var Y={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},Q=function(t,e,r,n){this.length=e.length,this.attributes=r,this.itemSize=e.bytesPerElement,this.dynamicDraw=n,this.context=t;var i=t.gl;this.buffer=i.createBuffer(),t.bindVertexBuffer.set(this.buffer),i.bufferData(i.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?i.DYNAMIC_DRAW:i.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer};Q.prototype.bind=function(){this.context.bindVertexBuffer.set(this.buffer)},Q.prototype.updateData=function(t){var e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)},Q.prototype.enableAttributes=function(t,e){for(var r=0;r1||(Math.abs(r)>1&&(1===Math.abs(r+i)?r+=i:1===Math.abs(r-i)&&(r-=i)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,r,n),t.neighboringTiles&&t.neighboringTiles[o]&&(t.neighboringTiles[o].backfilled=!0)))}},r.prototype.getTile=function(t){return this.getTileByID(t.key)},r.prototype.getTileByID=function(t){return this._tiles[t]},r.prototype.getZoom=function(t){return t.zoom+t.scaleZoom(t.tileSize/this._source.tileSize)},r.prototype._findLoadedChildren=function(t,e,r){var n=!1;for(var i in this._tiles){var o=this._tiles[i];if(!(r[i]||!o.hasData()||o.tileID.overscaledZ<=t.overscaledZ||o.tileID.overscaledZ>e)){var a=Math.pow(2,o.tileID.canonical.z-t.canonical.z);if(Math.floor(o.tileID.canonical.x/a)===t.canonical.x&&Math.floor(o.tileID.canonical.y/a)===t.canonical.y)for(r[i]=o.tileID,n=!0;o&&o.tileID.overscaledZ-1>t.overscaledZ;){var s=o.tileID.scaledTo(o.tileID.overscaledZ-1);if(!s)break;(o=this._tiles[s.key])&&o.hasData()&&(delete r[i],r[s.key]=s)}}}return n},r.prototype.findLoadedParent=function(t,e,r){for(var n=t.overscaledZ-1;n>=e;n--){var i=t.scaledTo(n);if(!i)return;var o=String(i.key),a=this._tiles[o];if(a&&a.hasData())return r[o]=i,a;if(this._cache.has(i))return r[o]=i,this._cache.get(i)}},r.prototype.updateCacheSize=function(t){var e=(Math.ceil(t.width/this._source.tileSize)+1)*(Math.ceil(t.height/this._source.tileSize)+1),r=Math.floor(5*e),n="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,r):r;this._cache.setMaxSize(n)},r.prototype.handleWrapJump=function(t){var e=(t-(void 0===this._prevLng?t:this._prevLng))/360,r=Math.round(e);if(this._prevLng=t,r){var n={};for(var i in this._tiles){var o=this._tiles[i];o.tileID=o.tileID.unwrapTo(o.tileID.wrap+r),n[o.tileID.key]=o}for(var a in this._tiles=n,this._timers)clearTimeout(this._timers[a]),delete this._timers[a];for(var s in this._tiles){var l=this._tiles[s];this._setTileReloadTimer(s,l)}}},r.prototype.update=function(e){var n=this;if(this.transform=e,this._sourceLoaded&&!this._paused){var i;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used?this._source.tileID?i=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(function(e){return new t.OverscaledTileID(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)}):(i=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}),this._source.hasTile&&(i=i.filter(function(t){return n._source.hasTile(t)}))):i=[];var o,a=(this._source.roundZoom?Math.round:Math.floor)(this.getZoom(e)),s=Math.max(a-r.maxOverzooming,this._source.minzoom),l=Math.max(a+r.maxUnderzooming,this._source.minzoom),u=this._updateRetainedTiles(i,a),c={};if(Bt(this._source.type))for(var h=Object.keys(u),p=0;p=t.default$2.now())){n._findLoadedChildren(d,l,u)&&(u[f]=d);var y=n.findLoadedParent(d,s,c);y&&n._addTile(y.tileID)}}for(o in c)u[o]||(n._coveredTiles[o]=!0);for(o in c)u[o]=c[o];for(var g=t.keysDifference(this._tiles,u),v=0;vthis._source.maxzoom){var p=l.children(this._source.maxzoom)[0],f=this.getTile(p);f&&f.hasData()?n[p.key]=p:h=!1}else{this._findLoadedChildren(l,a,n);for(var d=l.children(this._source.maxzoom),m=0;m=o;--y){var g=l.scaledTo(y);if(i[g.key])break;if(i[g.key]=!0,!(u=this.getTile(g))&&c&&(u=this._addTile(g)),u&&(n[g.key]=g,c=u.wasRequested(),u.hasData()))break}}}return n},r.prototype._addTile=function(e){var r=this._tiles[e.key];if(r)return r;(r=this._cache.getAndRemove(e))&&(this._setTileReloadTimer(e.key,r),r.tileID=e,this._state.initializeTileState(r,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,r)));var n=Boolean(r);return n||(r=new t.default$14(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(r,this._tileLoaded.bind(this,r,e.key,r.state))),r?(r.uses++,this._tiles[e.key]=r,n||this._source.fire(new t.Event("dataloading",{tile:r,coord:r.tileID,dataType:"source"})),r):null},r.prototype._setTileReloadTimer=function(t,e){var r=this;t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);var n=e.getExpiryTimeout();n&&(this._timers[t]=setTimeout(function(){r._reloadTile(t,"expired"),delete r._timers[t]},n))},r.prototype._removeTile=function(t){var e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))},r.prototype.clearTiles=function(){for(var t in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(t);this._cache.reset()},r.prototype.tilesIn=function(e,r){for(var n=[],i=this.getIds(),o=1/0,a=1/0,s=-1/0,l=-1/0,u=e[0].zoom,c=0;c=0&&g[1].y+y>=0){for(var v=[],_=0;_=t.default$2.now())return!0}return!1},r.prototype.setFeatureState=function(t,e,r){t=t||"_geojsonTileLayer",this._state.updateState(t,e,r)},r.prototype.getFeatureState=function(t,e){return t=t||"_geojsonTileLayer",this._state.getState(t,e)},r}(t.Evented);function Rt(e,r){var n=r.zoomTo(e.canonical.z);return new t.default((n.column-(e.canonical.x+e.wrap*Math.pow(2,e.canonical.z)))*t.default$10,(n.row-e.canonical.y)*t.default$10)}function Bt(t){return"raster"===t||"image"===t||"video"===t}function Ot(){return new t.default$1.Worker(cn.workerUrl)}Dt.maxOverzooming=10,Dt.maxUnderzooming=3;var Ft,Vt=function(){this.active={}};function Nt(e,r){var n={};for(var i in e)"ref"!==i&&(n[i]=e[i]);return t.default$17.forEach(function(t){t in r&&(n[t]=r[t])}),n}function jt(t){t=t.slice();for(var e=Object.create(null),r=0;rthis.width||n<0||e>this.height)return!i&&[];var a=[];if(t<=0&&e<=0&&this.width<=r&&this.height<=n){if(i)return!0;for(var s=0;s0:a},Kt.prototype._queryCircle=function(t,e,r,n,i){var o=t-r,a=t+r,s=e-r,l=e+r;if(a<0||o>this.width||l<0||s>this.height)return!n&&[];var u=[],c={hitTest:n,circle:{x:t,y:e,radius:r},seenUids:{box:{},circle:{}}};return this._forEachCell(o,s,a,l,this._queryCellCircle,u,c,i),n?u.length>0:u},Kt.prototype.query=function(t,e,r,n,i){return this._query(t,e,r,n,!1,i)},Kt.prototype.hitTest=function(t,e,r,n,i){return this._query(t,e,r,n,!0,i)},Kt.prototype.hitTestCircle=function(t,e,r,n){return this._queryCircle(t,e,r,!0,n)},Kt.prototype._queryCell=function(t,e,r,n,i,o,a,s){var l=a.seenUids,u=this.boxCells[i];if(null!==u)for(var c=this.bboxes,h=0,p=u;h=c[d+0]&&n>=c[d+1]&&(!s||s(this.boxKeys[f]))){if(a.hitTest)return o.push(!0),!0;o.push({key:this.boxKeys[f],x1:c[d],y1:c[d+1],x2:c[d+2],y2:c[d+3]})}}}var m=this.circleCells[i];if(null!==m)for(var y=this.circles,g=0,v=m;ga*a+s*s},Kt.prototype._circleAndRectCollide=function(t,e,r,n,i,o,a){var s=(o-n)/2,l=Math.abs(t-(n+s));if(l>s+r)return!1;var u=(a-i)/2,c=Math.abs(e-(i+u));if(c>u+r)return!1;if(l<=s||c<=u)return!0;var h=l-s,p=c-u;return h*h+p*p<=r*r};var Jt=t.default$18.layout;function Yt(e,r,n,i,o){var a=t.identity(new Float32Array(16));return r?(t.identity(a),t.scale(a,a,[1/o,1/o,1]),n||t.rotateZ(a,a,i.angle)):(t.scale(a,a,[i.width/2,-i.height/2,1]),t.translate(a,a,[1,-1,0]),t.multiply(a,a,e)),a}function Qt(e,r,n,i,o){var a=t.identity(new Float32Array(16));return r?(t.multiply(a,a,e),t.scale(a,a,[o,o,1]),n||t.rotateZ(a,a,-i.angle)):(t.scale(a,a,[1,-1,1]),t.translate(a,a,[-1,-1,0]),t.scale(a,a,[2/i.width,2/i.height,1])),a}function te(e,r){var n=[e.x,e.y,0,1];ce(n,n,r);var i=n[3];return{point:new t.default(n[0]/i,n[1]/i),signedDistanceFromCamera:i}}function ee(t,e){var r=t[0]/t[3],n=t[1]/t[3];return r>=-e[0]&&r<=e[0]&&n>=-e[1]&&n<=e[1]}function re(e,r,n,i,o,a,s,l){var u=i?e.textSizeData:e.iconSizeData,c=t.evaluateSizeForZoom(u,n.transform.zoom,Jt.properties[i?"text-size":"icon-size"]),h=[256/n.width*2+1,256/n.height*2+1],p=i?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;p.clear();for(var f=e.lineVertexArray,d=i?e.text.placedSymbolArray:e.icon.placedSymbolArray,m=n.transform.width/n.transform.height,y=!1,g=0;gMath.abs(n.x-r.x)*i?{useVertical:!0}:(e===t.WritingMode.vertical?r.yn.x)?{needsFlipping:!0}:null}function oe(e,r,n,i,o,a,s,l,u,c,h,p,f,d){var m,y=r/24,g=e.lineOffsetX*r,v=e.lineOffsetY*r;if(e.numGlyphs>1){var _=e.glyphStartIndex+e.numGlyphs,x=e.lineStartIndex,b=e.lineStartIndex+e.lineLength,w=ne(y,l,g,v,n,h,p,e,u,a,f,!1);if(!w)return{notEnoughRoom:!0};var E=te(w.first.point,s).point,S=te(w.last.point,s).point;if(i&&!n){var T=ie(e.writingMode,E,S,d);if(T)return T}m=[w.first];for(var k=e.glyphStartIndex+1;k<_-1;k++)m.push(se(y*l.getoffsetX(k),g,v,n,h,p,e.segment,x,b,u,a,f,!1));m.push(w.last)}else{if(i&&!n){var A=te(p,o).point,I=e.lineStartIndex+e.segment+1,z=new t.default(u.getx(I),u.gety(I)),C=te(z,o),M=C.signedDistanceFromCamera>0?C.point:ae(p,z,A,1,o),P=ie(e.writingMode,A,M,d);if(P)return P}var L=se(y*l.getoffsetX(e.glyphStartIndex),g,v,n,h,p,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,u,a,f,!1);if(!L)return{notEnoughRoom:!0};m=[L]}for(var D=0,R=m;D0?1:-1,y=0;i&&(m*=-1,y=Math.PI),m<0&&(y+=Math.PI);for(var g=m>0?l+s:l+s+1,v=g,_=o,x=o,b=0,w=0,E=Math.abs(d);b+w<=E;){if((g+=m)=u)return null;if(x=_,void 0===(_=p[g])){var S=new t.default(c.getx(g),c.gety(g)),T=te(S,h);if(T.signedDistanceFromCamera>0)_=p[g]=T.point;else{var k=g-m;_=ae(0===b?a:new t.default(c.getx(k),c.gety(k)),S,x,E-b+1,h)}}b+=w,w=x.dist(_)}var A=(E-b)/w,I=_.sub(x),z=I.mult(A)._add(x);return z._add(I._unit()._perp()._mult(n*m)),{point:z,angle:y+Math.atan2(_.y-x.y,_.x-x.x),tileDistance:f?{prevTileDistance:g-m===v?0:c.gettileUnitDistanceFromAnchor(g-m),lastSegmentViewportDistance:E-b}:null}}var le=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ue(t,e){for(var r=0;rI)pe(e,z,!1);else{var D=this.projectPoint(c,C,M),R=P*T;if(m.length>0){var B=D.x-m[m.length-4],O=D.y-m[m.length-3];if(R*R*2>B*B+O*O&&z+8-A&&F=this.screenRightBoundary||n<100||e>this.screenBottomBoundary},he.prototype.isInsideGrid=function(t,e,r,n){return r>=0&&t=0&&e0,x=x&&b.offscreen);var k=g.collisionArrays.textCircles;if(k){var A=e.text.placedSymbolArray.get(g.placedTextSymbolIndices[0]),I=t.evaluateSizeForFeature(e.textSizeData,h,A);w=this.collisionIndex.placeCollisionCircles(k,c.get("text-allow-overlap"),o,a,g.key,A,e.lineVertexArray,e.glyphOffsetArray,I,r,n,s,"map"===c.get("text-pitch-alignment"),d.predicate),v=c.get("text-allow-overlap")||w.circles.length>0,x=x&&w.offscreen}g.collisionArrays.iconFeatureIndex&&(T=g.collisionArrays.iconFeatureIndex),g.collisionArrays.iconBox&&(_=(E=this.collisionIndex.placeCollisionBox(g.collisionArrays.iconBox,c.get("icon-allow-overlap"),a,r,d.predicate)).box.length>0,x=x&&E.offscreen),p||f?f?p||(_=_&&v):v=_&&v:_=v=_&&v,v&&b&&this.collisionIndex.insertCollisionBox(b.box,c.get("text-ignore-placement"),e.bucketInstanceId,S,d.ID),_&&E&&this.collisionIndex.insertCollisionBox(E.box,c.get("icon-ignore-placement"),e.bucketInstanceId,T,d.ID),v&&w&&this.collisionIndex.insertCollisionCircles(w.circles,c.get("text-ignore-placement"),e.bucketInstanceId,S,d.ID),this.placements[g.crossTileID]=new ge(v,_,x||e.justReloaded),l[g.crossTileID]=!0}}e.justReloaded=!1},_e.prototype.commit=function(t,e){this.commitTime=e;var r=!1,n=t&&0!==this.fadeDuration?(this.commitTime-t.commitTime)/this.fadeDuration:1,i=t?t.opacities:{};for(var o in this.placements){var a=this.placements[o],s=i[o];s?(this.opacities[o]=new ye(s,n,a.text,a.icon),r=r||a.text!==s.text.placed||a.icon!==s.icon.placed):(this.opacities[o]=new ye(null,n,a.text,a.icon,a.skipFade),r=r||a.text||a.icon)}for(var l in i){var u=i[l];if(!this.opacities[l]){var c=new ye(u,n,!1,!1);c.isHidden()||(this.opacities[l]=c,r=r||u.text.placed||u.icon.placed)}}r?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)},_e.prototype.updateLayerOpacities=function(t,e){for(var r={},n=0,i=e;n0||s.numVerticalGlyphVertices>0,h=s.numIconVertices>0;if(c){for(var p=Ie(u.text),f=(s.numGlyphVertices+s.numVerticalGlyphVertices)/4,d=0;dt},_e.prototype.setStale=function(){this.stale=!0};var be=Math.pow(2,25),we=Math.pow(2,24),Ee=Math.pow(2,17),Se=Math.pow(2,16),Te=Math.pow(2,9),ke=Math.pow(2,8),Ae=Math.pow(2,1);function Ie(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;var e=t.placed?1:0,r=Math.floor(127*t.opacity);return r*be+e*we+r*Ee+e*Se+r*Te+e*ke+r*Ae+e}var ze=function(){this._currentTileIndex=0,this._seenCrossTileIDs={}};ze.prototype.continuePlacement=function(t,e,r,n,i){for(;this._currentTileIndex2};this._currentPlacementIndex>=0;){var s=r[e[i._currentPlacementIndex]],l=i.placement.collisionIndex.transform.zoom;if("symbol"===s.type&&(!s.minzoom||s.minzoom<=l)&&(!s.maxzoom||s.maxzoom>l)){if(i._inProgressLayer||(i._inProgressLayer=new ze),i._inProgressLayer.continuePlacement(n[s.source],i.placement,i._showCollisionBoxes,s,a))return;delete i._inProgressLayer}i._currentPlacementIndex--}this._done=!0},Ce.prototype.commit=function(t,e){return this.placement.commit(t,e),this.placement};var Me=512/t.default$10/2,Pe=function(t,e,r){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=r;for(var n=0,i=e;nt.overscaledZ)for(var l in s){var u=s[l];u.tileID.isChildOf(t)&&u.findMatches(e.symbolInstances,t,o)}else{var c=s[t.scaledTo(Number(a)).key];c&&c.findMatches(e.symbolInstances,t,o)}}for(var h=0,p=e.symbolInstances;h1?"@2x":"";function l(){if(a)n(a);else if(i&&o){var e=t.default$2.getImageData(o),r={};for(var s in i){var l=i[s],u=l.width,c=l.height,h=l.x,p=l.y,f=l.sdf,d=l.pixelRatio,m=new t.RGBAImage({width:u,height:c});t.RGBAImage.copy(e,m,{x:h,y:p},{x:0,y:0},{width:u,height:c}),r[s]={data:m,pixelRatio:d,sdf:f}}n(null,r)}}t.getJSON(r(y(e,s,".json"),t.ResourceType.SpriteJSON),function(t,e){a||(a=t,i=e,l())}),t.getImage(r(y(e,s,".png"),t.ResourceType.SpriteImage),function(t,e){a||(a=t,o=e,l())})}(e.sprite,this.map._transformRequest,function(e,r){if(e)n.fire(new t.ErrorEvent(e));else if(r)for(var i in r)n.imageManager.addImage(i,r[i]);n.imageManager.setLoaded(!0),n.fire(new t.Event("data",{dataType:"style"}))}):this.imageManager.setLoaded(!0),this.glyphManager.setURL(e.glyphs);var o=jt(this.stylesheet.layers);this._order=o.map(function(t){return t.id}),this._layers={};for(var a=0,s=o;a0)throw new Error("Unimplemented: "+i.map(function(t){return t.command}).join(", ")+".");return n.forEach(function(t){"setTransition"!==t.command&&r[t.command].apply(r,t.args)}),this.stylesheet=e,!0},r.prototype.addImage=function(e,r){if(this.getImage(e))return this.fire(new t.ErrorEvent(new Error("An image with this name already exists.")));this.imageManager.addImage(e,r),this.fire(new t.Event("data",{dataType:"style"}))},r.prototype.getImage=function(t){return this.imageManager.getImage(t)},r.prototype.removeImage=function(e){if(!this.getImage(e))return this.fire(new t.ErrorEvent(new Error("No image with this name exists.")));this.imageManager.removeImage(e),this.fire(new t.Event("data",{dataType:"style"}))},r.prototype.listImages=function(){return this._checkLoaded(),this.imageManager.listImages()},r.prototype.addSource=function(e,r,n){var i=this;if(this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error("There is already a source with this ID");if(!r.type)throw new Error("The type property must be defined, but the only the following properties were given: "+Object.keys(r).join(", ")+".");if(!(["vector","raster","geojson","video","image"].indexOf(r.type)>=0&&this._validate(t.validateStyle.source,"sources."+e,r,null,n))){this.map&&this.map._collectResourceTiming&&(r.collectResourceTiming=!0);var o=this.sourceCaches[e]=new Dt(e,r,this.dispatcher);o.style=this,o.setEventedParent(this,function(){return{isSourceLoaded:i.loaded(),source:o.serialize(),sourceId:e}}),o.onAdd(this.map),this._changed=!0}},r.prototype.removeSource=function(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(var r in this._layers)if(this._layers[r].source===e)return this.fire(new t.ErrorEvent(new Error('Source "'+e+'" cannot be removed while layer "'+r+'" is using it.')));var n=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],n.fire(new t.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),n.setEventedParent(null),n.clearTiles(),n.onRemove&&n.onRemove(this.map),this._changed=!0},r.prototype.setGeoJSONSourceData=function(t,e){this._checkLoaded(),this.sourceCaches[t].getSource().setData(e),this._changed=!0},r.prototype.getSource=function(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()},r.prototype.addLayer=function(e,r,n){this._checkLoaded();var i=e.id;if(this.getLayer(i))this.fire(new t.ErrorEvent(new Error('Layer with id "'+i+'" already exists on this map')));else if("object"==typeof e.source&&(this.addSource(i,e.source),e=t.clone(e),e=t.extend(e,{source:i})),!this._validate(t.validateStyle.layer,"layers."+i,e,{arrayIndex:-1},n)){var o=t.default$20(e);this._validateLayer(o),o.setEventedParent(this,{layer:{id:i}});var a=r?this._order.indexOf(r):this._order.length;if(r&&-1===a)this.fire(new t.ErrorEvent(new Error('Layer with id "'+r+'" does not exist on this map.')));else{if(this._order.splice(a,0,i),this._layerOrderChanged=!0,this._layers[i]=o,this._removedLayers[i]&&o.source){var s=this._removedLayers[i];delete this._removedLayers[i],s.type!==o.type?this._updatedSources[o.source]="clear":(this._updatedSources[o.source]="reload",this.sourceCaches[o.source].pause())}this._updateLayer(o)}}},r.prototype.moveLayer=function(e,r){if(this._checkLoaded(),this._changed=!0,this._layers[e]){if(e!==r){var n=this._order.indexOf(e);this._order.splice(n,1);var i=r?this._order.indexOf(r):this._order.length;r&&-1===i?this.fire(new t.ErrorEvent(new Error('Layer with id "'+r+'" does not exist on this map.'))):(this._order.splice(i,0,e),this._layerOrderChanged=!0)}}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be moved.")))},r.prototype.removeLayer=function(e){this._checkLoaded();var r=this._layers[e];if(r){r.setEventedParent(null);var n=this._order.indexOf(e);this._order.splice(n,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=r,delete this._layers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e]}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be removed.")))},r.prototype.getLayer=function(t){return this._layers[t]},r.prototype.setLayerZoomRange=function(e,r,n){this._checkLoaded();var i=this.getLayer(e);i?i.minzoom===r&&i.maxzoom===n||(null!=r&&(i.minzoom=r),null!=n&&(i.maxzoom=n),this._updateLayer(i)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot have zoom extent.")))},r.prototype.setFilter=function(e,r){this._checkLoaded();var n=this.getLayer(e);if(n){if(!t.default$13(n.filter,r))return null==r?(n.filter=void 0,void this._updateLayer(n)):void(this._validate(t.validateStyle.filter,"layers."+n.id+".filter",r)||(n.filter=t.clone(r),this._updateLayer(n)))}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be filtered.")))},r.prototype.getFilter=function(e){return t.clone(this.getLayer(e).filter)},r.prototype.setLayoutProperty=function(e,r,n){this._checkLoaded();var i=this.getLayer(e);i?t.default$13(i.getLayoutProperty(r),n)||(i.setLayoutProperty(r,n),this._updateLayer(i)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")))},r.prototype.getLayoutProperty=function(t,e){return this.getLayer(t).getLayoutProperty(e)},r.prototype.setPaintProperty=function(e,r,n){this._checkLoaded();var i=this.getLayer(e);i?t.default$13(i.getPaintProperty(r),n)||(i.setPaintProperty(r,n)&&this._updateLayer(i),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")))},r.prototype.getPaintProperty=function(t,e){return this.getLayer(t).getPaintProperty(e)},r.prototype.setFeatureState=function(e,r){this._checkLoaded();var n=e.source,i=e.sourceLayer,o=this.sourceCaches[n];void 0!==o?"vector"!==o.getSource().type||i?o.setFeatureState(i,e.id,r):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types."))):this.fire(new t.ErrorEvent(new Error("The source '"+n+"' does not exist in the map's style.")))},r.prototype.getFeatureState=function(e){this._checkLoaded();var r=e.source,n=e.sourceLayer,i=this.sourceCaches[r];if(void 0!==i){if("vector"!==i.getSource().type||n)return i.getFeatureState(n,e.id);this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '"+r+"' does not exist in the map's style.")))},r.prototype.getTransition=function(){return t.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)},r.prototype.serialize=function(){var e=this;return t.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,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,sources:t.mapObject(this.sourceCaches,function(t){return t.serialize()}),layers:this._order.map(function(t){return e._layers[t].serialize()})},function(t){return void 0!==t})},r.prototype._updateLayer=function(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0},r.prototype._flattenRenderedFeatures=function(t){for(var e=[],r=this._order.length-1;r>=0;r--)for(var n=this._order[r],i=0,o=t;i 0.5) {\n gl_FragColor = vec4(0.0, 0.0, 1.0, 0.5) * alpha;\n }\n\n if (v_notUsed > 0.5) {\n // This box not used, fade it out\n gl_FragColor *= .1;\n }\n}",vertexSource:"attribute vec2 a_pos;\nattribute vec2 a_anchor_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_placed;\n\nuniform mat4 u_matrix;\nuniform vec2 u_extrude_scale;\nuniform float u_camera_to_center_distance;\n\nvarying float v_placed;\nvarying float v_notUsed;\n\nvoid main() {\n vec4 projectedPoint = u_matrix * vec4(a_anchor_pos, 0, 1);\n highp float camera_to_anchor_distance = projectedPoint.w;\n highp float collision_perspective_ratio = clamp(\n 0.5 + 0.5 * (u_camera_to_center_distance / camera_to_anchor_distance),\n 0.0, // Prevents oversized near-field boxes in pitched/overzoomed tiles\n 4.0);\n\n gl_Position = u_matrix * vec4(a_pos, 0.0, 1.0);\n gl_Position.xy += a_extrude * u_extrude_scale * gl_Position.w * collision_perspective_ratio;\n\n v_placed = a_placed.x;\n v_notUsed = a_placed.y;\n}\n"},collisionCircle:{fragmentSource:"uniform float u_overscale_factor;\n\nvarying float v_placed;\nvarying float v_notUsed;\nvarying float v_radius;\nvarying vec2 v_extrude;\nvarying vec2 v_extrude_scale;\n\nvoid main() {\n float alpha = 0.5;\n\n // Red = collision, hide label\n vec4 color = vec4(1.0, 0.0, 0.0, 1.0) * alpha;\n\n // Blue = no collision, label is showing\n if (v_placed > 0.5) {\n color = vec4(0.0, 0.0, 1.0, 0.5) * alpha;\n }\n\n if (v_notUsed > 0.5) {\n // This box not used, fade it out\n color *= .2;\n }\n\n float extrude_scale_length = length(v_extrude_scale);\n float extrude_length = length(v_extrude) * extrude_scale_length;\n float stroke_width = 15.0 * extrude_scale_length / u_overscale_factor;\n float radius = v_radius * extrude_scale_length;\n\n float distance_to_edge = abs(extrude_length - radius);\n float opacity_t = smoothstep(-stroke_width, 0.0, -distance_to_edge);\n\n gl_FragColor = opacity_t * color;\n}\n",vertexSource:"attribute vec2 a_pos;\nattribute vec2 a_anchor_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_placed;\n\nuniform mat4 u_matrix;\nuniform vec2 u_extrude_scale;\nuniform float u_camera_to_center_distance;\n\nvarying float v_placed;\nvarying float v_notUsed;\nvarying float v_radius;\n\nvarying vec2 v_extrude;\nvarying vec2 v_extrude_scale;\n\nvoid main() {\n vec4 projectedPoint = u_matrix * vec4(a_anchor_pos, 0, 1);\n highp float camera_to_anchor_distance = projectedPoint.w;\n highp float collision_perspective_ratio = clamp(\n 0.5 + 0.5 * (u_camera_to_center_distance / camera_to_anchor_distance),\n 0.0, // Prevents oversized near-field circles in pitched/overzoomed tiles\n 4.0);\n\n gl_Position = u_matrix * vec4(a_pos, 0.0, 1.0);\n\n highp float padding_factor = 1.2; // Pad the vertices slightly to make room for anti-alias blur\n gl_Position.xy += a_extrude * u_extrude_scale * padding_factor * gl_Position.w * collision_perspective_ratio;\n\n v_placed = a_placed.x;\n v_notUsed = a_placed.y;\n v_radius = abs(a_extrude.y); // We don't pitch the circles, so both units of the extrusion vector are equal in magnitude to the radius\n\n v_extrude = a_extrude * padding_factor;\n v_extrude_scale = u_extrude_scale * u_camera_to_center_distance * collision_perspective_ratio;\n}\n"},debug:{fragmentSource:"uniform highp vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n}\n",vertexSource:"attribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n"},fill:{fragmentSource:"#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float opacity\n\n gl_FragColor = color * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"attribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n"},fillOutline:{fragmentSource:"#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_pos;\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = 1.0 - smoothstep(0.0, 1.0, dist);\n gl_FragColor = outline_color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"attribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},fillOutlinePattern:{fragmentSource:"uniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform vec2 u_texsize;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b / u_texsize, u_pattern_br_b / u_texsize, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n // find distance to outline for alpha interpolation\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = 1.0 - smoothstep(0.0, 1.0, dist);\n\n\n gl_FragColor = mix(color1, color2, u_mix) * alpha * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_world;\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n\n v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_a * u_pattern_size_a, u_tile_units_to_pixels, a_pos);\n v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_b * u_pattern_size_b, u_tile_units_to_pixels, a_pos);\n\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},fillPattern:{fragmentSource:"uniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform vec2 u_texsize;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b / u_texsize, u_pattern_br_b / u_texsize, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n gl_FragColor = mix(color1, color2, u_mix) * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n\n v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_a * u_pattern_size_a, u_tile_units_to_pixels, a_pos);\n v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_b * u_pattern_size_b, u_tile_units_to_pixels, a_pos);\n}\n"},fillExtrusion:{fragmentSource:"varying vec4 v_color;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define highp vec4 color\n\nvoid main() {\n #pragma mapbox: initialize lowp float base\n #pragma mapbox: initialize lowp float height\n #pragma mapbox: initialize highp vec4 color\n\n gl_FragColor = v_color;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec3 u_lightcolor;\nuniform lowp vec3 u_lightpos;\nuniform lowp float u_lightintensity;\n\nattribute vec2 a_pos;\nattribute vec4 a_normal_ed;\n\nvarying vec4 v_color;\n\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n\n#pragma mapbox: define highp vec4 color\n\nvoid main() {\n #pragma mapbox: initialize lowp float base\n #pragma mapbox: initialize lowp float height\n #pragma mapbox: initialize highp vec4 color\n\n vec3 normal = a_normal_ed.xyz;\n\n base = max(0.0, base);\n height = max(0.0, height);\n\n float t = mod(normal.x, 2.0);\n\n gl_Position = u_matrix * vec4(a_pos, t > 0.0 ? height : base, 1);\n\n // Relative luminance (how dark/bright is the surface color?)\n float colorvalue = color.r * 0.2126 + color.g * 0.7152 + color.b * 0.0722;\n\n v_color = vec4(0.0, 0.0, 0.0, 1.0);\n\n // Add slight ambient lighting so no extrusions are totally black\n vec4 ambientlight = vec4(0.03, 0.03, 0.03, 1.0);\n color += ambientlight;\n\n // Calculate cos(theta), where theta is the angle between surface normal and diffuse light ray\n float directional = clamp(dot(normal / 16384.0, u_lightpos), 0.0, 1.0);\n\n // Adjust directional so that\n // the range of values for highlight/shading is narrower\n // with lower light intensity\n // and with lighter/brighter surface colors\n directional = mix((1.0 - u_lightintensity), max((1.0 - colorvalue + u_lightintensity), 1.0), directional);\n\n // Add gradient along z axis of side surfaces\n if (normal.y != 0.0) {\n directional *= clamp((t + base) * pow(height / 150.0, 0.5), mix(0.7, 0.98, 1.0 - u_lightintensity), 1.0);\n }\n\n // Assign final color based on surface + ambient light color, diffuse light directional, and light color\n // with lower bounds adjusted to hue of light\n // so that shading is tinted with the complementary (opposite) color to the light color\n v_color.r += clamp(color.r * directional * u_lightcolor.r, mix(0.0, 0.3, 1.0 - u_lightcolor.r), 1.0);\n v_color.g += clamp(color.g * directional * u_lightcolor.g, mix(0.0, 0.3, 1.0 - u_lightcolor.g), 1.0);\n v_color.b += clamp(color.b * directional * u_lightcolor.b, mix(0.0, 0.3, 1.0 - u_lightcolor.b), 1.0);\n}\n"},fillExtrusionPattern:{fragmentSource:"uniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform vec2 u_texsize;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec4 v_lighting;\n\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n\nvoid main() {\n #pragma mapbox: initialize lowp float base\n #pragma mapbox: initialize lowp float height\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b / u_texsize, u_pattern_br_b / u_texsize, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n vec4 mixedColor = mix(color1, color2, u_mix);\n\n gl_FragColor = mixedColor * v_lighting;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\nuniform float u_height_factor;\n\nuniform vec3 u_lightcolor;\nuniform lowp vec3 u_lightpos;\nuniform lowp float u_lightintensity;\n\nattribute vec2 a_pos;\nattribute vec4 a_normal_ed;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec4 v_lighting;\nvarying float v_directional;\n\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n\nvoid main() {\n #pragma mapbox: initialize lowp float base\n #pragma mapbox: initialize lowp float height\n\n vec3 normal = a_normal_ed.xyz;\n float edgedistance = a_normal_ed.w;\n\n base = max(0.0, base);\n height = max(0.0, height);\n\n float t = mod(normal.x, 2.0);\n float z = t > 0.0 ? height : base;\n\n gl_Position = u_matrix * vec4(a_pos, z, 1);\n\n vec2 pos = normal.x == 1.0 && normal.y == 0.0 && normal.z == 16384.0\n ? a_pos // extrusion top\n : vec2(edgedistance, z * u_height_factor); // extrusion side\n\n v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_a * u_pattern_size_a, u_tile_units_to_pixels, pos);\n v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_b * u_pattern_size_b, u_tile_units_to_pixels, pos);\n\n v_lighting = vec4(0.0, 0.0, 0.0, 1.0);\n float directional = clamp(dot(normal / 16383.0, u_lightpos), 0.0, 1.0);\n directional = mix((1.0 - u_lightintensity), max((0.5 + u_lightintensity), 1.0), directional);\n\n if (normal.y != 0.0) {\n directional *= clamp((t + base) * pow(height / 150.0, 0.5), mix(0.7, 0.98, 1.0 - u_lightintensity), 1.0);\n }\n\n v_lighting.rgb += clamp(directional * u_lightcolor, mix(vec3(0.0), vec3(0.3), 1.0 - u_lightcolor), vec3(1.0));\n}\n"},extrusionTexture:{fragmentSource:"uniform sampler2D u_image;\nuniform float u_opacity;\nvarying vec2 v_pos;\n\nvoid main() {\n gl_FragColor = texture2D(u_image, v_pos) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(0.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_world;\nattribute vec2 a_pos;\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos * u_world, 0, 1);\n\n v_pos.x = a_pos.x;\n v_pos.y = 1.0 - a_pos.y;\n}\n"},hillshadePrepare:{fragmentSource:"#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform sampler2D u_image;\nvarying vec2 v_pos;\nuniform vec2 u_dimension;\nuniform float u_zoom;\nuniform float u_maxzoom;\n\nfloat getElevation(vec2 coord, float bias) {\n // Convert encoded elevation value to meters\n vec4 data = texture2D(u_image, coord) * 255.0;\n return (data.r + data.g * 256.0 + data.b * 256.0 * 256.0) / 4.0;\n}\n\nvoid main() {\n vec2 epsilon = 1.0 / u_dimension;\n\n // queried pixels:\n // +-----------+\n // | | | |\n // | a | b | c |\n // | | | |\n // +-----------+\n // | | | |\n // | d | e | f |\n // | | | |\n // +-----------+\n // | | | |\n // | g | h | i |\n // | | | |\n // +-----------+\n\n float a = getElevation(v_pos + vec2(-epsilon.x, -epsilon.y), 0.0);\n float b = getElevation(v_pos + vec2(0, -epsilon.y), 0.0);\n float c = getElevation(v_pos + vec2(epsilon.x, -epsilon.y), 0.0);\n float d = getElevation(v_pos + vec2(-epsilon.x, 0), 0.0);\n float e = getElevation(v_pos, 0.0);\n float f = getElevation(v_pos + vec2(epsilon.x, 0), 0.0);\n float g = getElevation(v_pos + vec2(-epsilon.x, epsilon.y), 0.0);\n float h = getElevation(v_pos + vec2(0, epsilon.y), 0.0);\n float i = getElevation(v_pos + vec2(epsilon.x, epsilon.y), 0.0);\n\n // here we divide the x and y slopes by 8 * pixel size\n // where pixel size (aka meters/pixel) is:\n // circumference of the world / (pixels per tile * number of tiles)\n // which is equivalent to: 8 * 40075016.6855785 / (512 * pow(2, u_zoom))\n // which can be reduced to: pow(2, 19.25619978527 - u_zoom)\n // we want to vertically exaggerate the hillshading though, because otherwise\n // it is barely noticeable at low zooms. to do this, we multiply this by some\n // scale factor pow(2, (u_zoom - u_maxzoom) * a) where a is an arbitrary value\n // Here we use a=0.3 which works out to the expression below. see \n // nickidlugash's awesome breakdown for more info\n // https://github.com/mapbox/mapbox-gl-js/pull/5286#discussion_r148419556\n float exaggeration = u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;\n\n vec2 deriv = vec2(\n (c + f + f + i) - (a + d + d + g),\n (g + h + h + i) - (a + b + b + c)\n ) / pow(2.0, (u_zoom - u_maxzoom) * exaggeration + 19.2562 - u_zoom);\n\n gl_FragColor = clamp(vec4(\n deriv.x / 2.0 + 0.5,\n deriv.y / 2.0 + 0.5,\n 1.0,\n 1.0), 0.0, 1.0);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (a_texture_pos / 8192.0) / 2.0 + 0.25;\n}\n"},hillshade:{fragmentSource:"uniform sampler2D u_image;\nvarying vec2 v_pos;\n\nuniform vec2 u_latrange;\nuniform vec2 u_light;\nuniform vec4 u_shadow;\nuniform vec4 u_highlight;\nuniform vec4 u_accent;\n\n#define PI 3.141592653589793\n\nvoid main() {\n vec4 pixel = texture2D(u_image, v_pos);\n\n vec2 deriv = ((pixel.rg * 2.0) - 1.0);\n\n // We divide the slope by a scale factor based on the cosin of the pixel's approximate latitude\n // to account for mercator projection distortion. see #4807 for details\n float scaleFactor = cos(radians((u_latrange[0] - u_latrange[1]) * (1.0 - v_pos.y) + u_latrange[1]));\n // We also multiply the slope by an arbitrary z-factor of 1.25\n float slope = atan(1.25 * length(deriv) / scaleFactor);\n float aspect = deriv.x != 0.0 ? atan(deriv.y, -deriv.x) : PI / 2.0 * (deriv.y > 0.0 ? 1.0 : -1.0);\n\n float intensity = u_light.x;\n // We add PI to make this property match the global light object, which adds PI/2 to the light's azimuthal\n // position property to account for 0deg corresponding to north/the top of the viewport in the style spec\n // and the original shader was written to accept (-illuminationDirection - 90) as the azimuthal.\n float azimuth = u_light.y + PI;\n\n // We scale the slope exponentially based on intensity, using a calculation similar to\n // the exponential interpolation function in the style spec:\n // https://github.com/mapbox/mapbox-gl-js/blob/master/src/style-spec/expression/definitions/interpolate.js#L217-L228\n // so that higher intensity values create more opaque hillshading.\n float base = 1.875 - intensity * 1.75;\n float maxValue = 0.5 * PI;\n float scaledSlope = intensity != 0.5 ? ((pow(base, slope) - 1.0) / (pow(base, maxValue) - 1.0)) * maxValue : slope;\n\n // The accent color is calculated with the cosine of the slope while the shade color is calculated with the sine\n // so that the accent color's rate of change eases in while the shade color's eases out.\n float accent = cos(scaledSlope);\n // We multiply both the accent and shade color by a clamped intensity value\n // so that intensities >= 0.5 do not additionally affect the color values\n // while intensity values < 0.5 make the overall color more transparent.\n vec4 accent_color = (1.0 - accent) * u_accent * clamp(intensity * 2.0, 0.0, 1.0);\n float shade = abs(mod((aspect + azimuth) / PI + 0.5, 2.0) - 1.0);\n vec4 shade_color = mix(u_shadow, u_highlight, shade) * sin(scaledSlope) * clamp(intensity * 2.0, 0.0, 1.0);\n gl_FragColor = accent_color * (1.0 - shade_color.a) + shade_color;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = a_texture_pos / 8192.0;\n}\n"},line:{fragmentSource:"#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_width2;\nvarying vec2 v_normal;\nvarying float v_gamma_scale;\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_width2.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_width2.t) or when fading out\n // (v_width2.s)\n float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;\n float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);\n\n gl_FragColor = color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"\n\n// the distance over which the line edge fades out.\n// Retina devices need a smaller distance to avoid aliasing.\n#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\nattribute vec4 a_pos_normal;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform vec2 u_gl_units_to_pixels;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying float v_gamma_scale;\nvarying highp float v_linesofar;\n\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize mediump float gapwidth\n #pragma mapbox: initialize lowp float offset\n #pragma mapbox: initialize mediump float width\n\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n\n v_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * 2.0;\n\n vec2 pos = a_pos_normal.xy;\n\n // x is 1 if it's a round cap, 0 otherwise\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = a_pos_normal.zw;\n v_normal = normal;\n\n // these transformations used to be applied in the JS and native code bases.\n // moved them into the shader for clarity and simplicity.\n gapwidth = gapwidth / 2.0;\n float halfwidth = width / 2.0;\n offset = -1.0 * offset;\n\n float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);\n float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + (halfwidth == 0.0 ? 0.0 : ANTIALIASING);\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);\n gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;\n\n // calculate how much the perspective view squishes or stretches the extrude\n float extrude_length_without_perspective = length(dist);\n float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels);\n v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;\n\n v_width2 = vec2(outset, inset);\n}\n"},lineGradient:{fragmentSource:"\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n\nuniform sampler2D u_image;\n\nvarying vec2 v_width2;\nvarying vec2 v_normal;\nvarying float v_gamma_scale;\nvarying highp float v_lineprogress;\n\nvoid main() {\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_width2.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_width2.t) or when fading out\n // (v_width2.s)\n float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;\n float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);\n\n // For gradient lines, v_lineprogress is the ratio along the entire line,\n // scaled to [0, 2^15), and the gradient ramp is stored in a texture.\n vec4 color = texture2D(u_image, vec2(v_lineprogress, 0.5));\n\n gl_FragColor = color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"\n// the attribute conveying progress along a line is scaled to [0, 2^15)\n#define MAX_LINE_DISTANCE 32767.0\n\n// the distance over which the line edge fades out.\n// Retina devices need a smaller distance to avoid aliasing.\n#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\nattribute vec4 a_pos_normal;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform vec2 u_gl_units_to_pixels;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying float v_gamma_scale;\nvarying highp float v_lineprogress;\n\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n\nvoid main() {\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize mediump float gapwidth\n #pragma mapbox: initialize lowp float offset\n #pragma mapbox: initialize mediump float width\n\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n\n v_lineprogress = (floor(a_data.z / 4.0) + a_data.w * 64.0) * 2.0 / MAX_LINE_DISTANCE;\n\n vec2 pos = a_pos_normal.xy;\n\n // x is 1 if it's a round cap, 0 otherwise\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = a_pos_normal.zw;\n v_normal = normal;\n\n // these transformations used to be applied in the JS and native code bases.\n // moved them into the shader for clarity and simplicity.\n gapwidth = gapwidth / 2.0;\n float halfwidth = width / 2.0;\n offset = -1.0 * offset;\n\n float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);\n float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + (halfwidth == 0.0 ? 0.0 : ANTIALIASING);\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);\n gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;\n\n // calculate how much the perspective view squishes or stretches the extrude\n float extrude_length_without_perspective = length(dist);\n float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels);\n v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;\n\n v_width2 = vec2(outset, inset);\n}\n"},linePattern:{fragmentSource:"uniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform vec2 u_texsize;\nuniform float u_fade;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_width2.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_width2.t) or when fading out\n // (v_width2.s)\n float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;\n float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);\n\n float x_a = mod(v_linesofar / u_pattern_size_a.x, 1.0);\n float x_b = mod(v_linesofar / u_pattern_size_b.x, 1.0);\n\n // v_normal.y is 0 at the midpoint of the line, -1 at the lower edge, 1 at the upper edge\n // we clamp the line width outset to be between 0 and half the pattern height plus padding (2.0)\n // to ensure we don't sample outside the designated symbol on the sprite sheet.\n // 0.5 is added to shift the component to be bounded between 0 and 1 for interpolation of\n // the texture coordinate\n float y_a = 0.5 + (v_normal.y * clamp(v_width2.s, 0.0, (u_pattern_size_a.y + 2.0) / 2.0) / u_pattern_size_a.y);\n float y_b = 0.5 + (v_normal.y * clamp(v_width2.s, 0.0, (u_pattern_size_b.y + 2.0) / 2.0) / u_pattern_size_b.y);\n vec2 pos_a = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, vec2(x_a, y_a));\n vec2 pos_b = mix(u_pattern_tl_b / u_texsize, u_pattern_br_b / u_texsize, vec2(x_b, y_b));\n\n vec4 color = mix(texture2D(u_image, pos_a), texture2D(u_image, pos_b), u_fade);\n\n gl_FragColor = color * alpha * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\n// the distance over which the line edge fades out.\n// Retina devices need a smaller distance to avoid aliasing.\n#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0\n\nattribute vec4 a_pos_normal;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform vec2 u_gl_units_to_pixels;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\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\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\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n vec2 pos = a_pos_normal.xy;\n\n // x is 1 if it's a round cap, 0 otherwise\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = a_pos_normal.zw;\n v_normal = normal;\n\n // these transformations used to be applied in the JS and native code bases.\n // moved them into the shader for clarity and simplicity.\n gapwidth = gapwidth / 2.0;\n float halfwidth = width / 2.0;\n offset = -1.0 * offset;\n\n float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);\n float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + (halfwidth == 0.0 ? 0.0 : ANTIALIASING);\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);\n gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;\n\n // calculate how much the perspective view squishes or stretches the extrude\n float extrude_length_without_perspective = length(dist);\n float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels);\n v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;\n\n v_linesofar = a_linesofar;\n v_width2 = vec2(outset, inset);\n}\n"},lineSDF:{fragmentSource:"\nuniform sampler2D u_image;\nuniform float u_sdfgamma;\nuniform float u_mix;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize mediump float width\n #pragma mapbox: initialize lowp float floorwidth\n\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_width2.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_width2.t) or when fading out\n // (v_width2.s)\n float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;\n float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);\n\n float sdfdist_a = texture2D(u_image, v_tex_a).a;\n float sdfdist_b = texture2D(u_image, v_tex_b).a;\n float sdfdist = mix(sdfdist_a, sdfdist_b, u_mix);\n alpha *= smoothstep(0.5 - u_sdfgamma / floorwidth, 0.5 + u_sdfgamma / floorwidth, sdfdist);\n\n gl_FragColor = color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\n// the distance over which the line edge fades out.\n// Retina devices need a smaller distance to avoid aliasing.\n#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0\n\nattribute vec4 a_pos_normal;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform vec2 u_patternscale_a;\nuniform float u_tex_y_a;\nuniform vec2 u_patternscale_b;\nuniform float u_tex_y_b;\nuniform vec2 u_gl_units_to_pixels;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize mediump float gapwidth\n #pragma mapbox: initialize lowp float offset\n #pragma mapbox: initialize mediump float width\n #pragma mapbox: initialize lowp float floorwidth\n\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n vec2 pos = a_pos_normal.xy;\n\n // x is 1 if it's a round cap, 0 otherwise\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = a_pos_normal.zw;\n v_normal = normal;\n\n // these transformations used to be applied in the JS and native code bases.\n // moved them into the shader for clarity and simplicity.\n gapwidth = gapwidth / 2.0;\n float halfwidth = width / 2.0;\n offset = -1.0 * offset;\n\n float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);\n float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + (halfwidth == 0.0 ? 0.0 : ANTIALIASING);\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist =outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);\n gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;\n\n // calculate how much the perspective view squishes or stretches the extrude\n float extrude_length_without_perspective = length(dist);\n float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels);\n v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;\n\n v_tex_a = vec2(a_linesofar * u_patternscale_a.x / floorwidth, normal.y * u_patternscale_a.y + u_tex_y_a);\n v_tex_b = vec2(a_linesofar * u_patternscale_b.x / floorwidth, normal.y * u_patternscale_b.y + u_tex_y_b);\n\n v_width2 = vec2(outset, inset);\n}\n"},raster:{fragmentSource:"uniform float u_fade_t;\nuniform float u_opacity;\nuniform sampler2D u_image0;\nuniform sampler2D u_image1;\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nuniform float u_brightness_low;\nuniform float u_brightness_high;\n\nuniform float u_saturation_factor;\nuniform float u_contrast_factor;\nuniform vec3 u_spin_weights;\n\nvoid main() {\n\n // read and cross-fade colors from the main and parent tiles\n vec4 color0 = texture2D(u_image0, v_pos0);\n vec4 color1 = texture2D(u_image1, v_pos1);\n if (color0.a > 0.0) {\n color0.rgb = color0.rgb / color0.a;\n }\n if (color1.a > 0.0) {\n color1.rgb = color1.rgb / color1.a;\n }\n vec4 color = mix(color0, color1, u_fade_t);\n color.a *= u_opacity;\n vec3 rgb = color.rgb;\n\n // spin\n rgb = vec3(\n dot(rgb, u_spin_weights.xyz),\n dot(rgb, u_spin_weights.zxy),\n dot(rgb, u_spin_weights.yzx));\n\n // saturation\n float average = (color.r + color.g + color.b) / 3.0;\n rgb += (average - rgb) * u_saturation_factor;\n\n // contrast\n rgb = (rgb - 0.5) * u_contrast_factor + 0.5;\n\n // brightness\n vec3 u_high_vec = vec3(u_brightness_low, u_brightness_low, u_brightness_low);\n vec3 u_low_vec = vec3(u_brightness_high, u_brightness_high, u_brightness_high);\n\n gl_FragColor = vec4(mix(u_high_vec, u_low_vec, rgb) * color.a, color.a);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_tl_parent;\nuniform float u_scale_parent;\nuniform float u_buffer_scale;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n // We are using Int16 for texture position coordinates to give us enough precision for\n // fractional coordinates. We use 8192 to scale the texture coordinates in the buffer\n // as an arbitrarily high number to preserve adequate precision when rendering.\n // This is also the same value as the EXTENT we are using for our tile buffer pos coordinates,\n // so math for modifying either is consistent.\n v_pos0 = (((a_texture_pos / 8192.0) - 0.5) / u_buffer_scale ) + 0.5;\n v_pos1 = (v_pos0 * u_scale_parent) + u_tl_parent;\n}\n"},symbolIcon:{fragmentSource:"uniform sampler2D u_texture;\n\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_tex;\nvarying float v_fade_opacity;\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n lowp float alpha = opacity * v_fade_opacity;\n gl_FragColor = texture2D(u_texture, v_tex) * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"const float PI = 3.141592653589793;\n\nattribute vec4 a_pos_offset;\nattribute vec4 a_data;\nattribute vec3 a_projected_pos;\nattribute float a_fade_opacity;\n\nuniform bool u_is_size_zoom_constant;\nuniform bool u_is_size_feature_constant;\nuniform highp float u_size_t; // used to interpolate between zoom stops when size is a composite function\nuniform highp float u_size; // used when size is both zoom and feature constant\nuniform highp float u_camera_to_center_distance;\nuniform highp float u_pitch;\nuniform bool u_rotate_symbol;\nuniform highp float u_aspect_ratio;\nuniform float u_fade_change;\n\n#pragma mapbox: define lowp float opacity\n\nuniform mat4 u_matrix;\nuniform mat4 u_label_plane_matrix;\nuniform mat4 u_gl_coord_matrix;\n\nuniform bool u_is_text;\nuniform bool u_pitch_with_map;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying float v_fade_opacity;\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n vec2 a_pos = a_pos_offset.xy;\n vec2 a_offset = a_pos_offset.zw;\n\n vec2 a_tex = a_data.xy;\n vec2 a_size = a_data.zw;\n\n highp float segment_angle = -a_projected_pos[2];\n\n float size;\n if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {\n size = mix(a_size[0], a_size[1], u_size_t) / 10.0;\n } else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {\n size = a_size[0] / 10.0;\n } else if (!u_is_size_zoom_constant && u_is_size_feature_constant) {\n size = u_size;\n } else {\n size = u_size;\n }\n\n vec4 projectedPoint = u_matrix * vec4(a_pos, 0, 1);\n highp float camera_to_anchor_distance = projectedPoint.w;\n // See comments in symbol_sdf.vertex\n highp float distance_ratio = u_pitch_with_map ?\n camera_to_anchor_distance / u_camera_to_center_distance :\n u_camera_to_center_distance / camera_to_anchor_distance;\n highp float perspective_ratio = clamp(\n 0.5 + 0.5 * distance_ratio,\n 0.0, // Prevents oversized near-field symbols in pitched/overzoomed tiles\n 4.0);\n\n size *= perspective_ratio;\n\n float fontScale = u_is_text ? size / 24.0 : size;\n\n highp float symbol_rotation = 0.0;\n if (u_rotate_symbol) {\n // See comments in symbol_sdf.vertex\n vec4 offsetProjectedPoint = u_matrix * vec4(a_pos + vec2(1, 0), 0, 1);\n\n vec2 a = projectedPoint.xy / projectedPoint.w;\n vec2 b = offsetProjectedPoint.xy / offsetProjectedPoint.w;\n\n symbol_rotation = atan((b.y - a.y) / u_aspect_ratio, b.x - a.x);\n }\n\n highp float angle_sin = sin(segment_angle + symbol_rotation);\n highp float angle_cos = cos(segment_angle + symbol_rotation);\n mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);\n\n vec4 projected_pos = u_label_plane_matrix * vec4(a_projected_pos.xy, 0.0, 1.0);\n gl_Position = u_gl_coord_matrix * vec4(projected_pos.xy / projected_pos.w + rotation_matrix * (a_offset / 32.0 * fontScale), 0.0, 1.0);\n\n v_tex = a_tex / u_texsize;\n vec2 fade_opacity = unpack_opacity(a_fade_opacity);\n float fade_change = fade_opacity[1] > 0.5 ? u_fade_change : -u_fade_change;\n v_fade_opacity = max(0.0, min(1.0, fade_opacity[0] + fade_change));\n}\n"},symbolSDF:{fragmentSource:"#define SDF_PX 8.0\n#define EDGE_GAMMA 0.105/DEVICE_PIXEL_RATIO\n\nuniform bool u_is_halo;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n\nuniform sampler2D u_texture;\nuniform highp float u_gamma_scale;\nuniform bool u_is_text;\n\nvarying vec2 v_data0;\nvarying vec3 v_data1;\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 fill_color\n #pragma mapbox: initialize highp vec4 halo_color\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize lowp float halo_width\n #pragma mapbox: initialize lowp float halo_blur\n\n vec2 tex = v_data0.xy;\n float gamma_scale = v_data1.x;\n float size = v_data1.y;\n float fade_opacity = v_data1[2];\n\n float fontScale = u_is_text ? size / 24.0 : size;\n\n lowp vec4 color = fill_color;\n highp float gamma = EDGE_GAMMA / (fontScale * u_gamma_scale);\n lowp float buff = (256.0 - 64.0) / 256.0;\n if (u_is_halo) {\n color = halo_color;\n gamma = (halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (fontScale * u_gamma_scale);\n buff = (6.0 - halo_width / fontScale) / SDF_PX;\n }\n\n lowp float dist = texture2D(u_texture, tex).a;\n highp float gamma_scaled = gamma * gamma_scale;\n highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);\n\n gl_FragColor = color * (alpha * opacity * fade_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"const float PI = 3.141592653589793;\n\nattribute vec4 a_pos_offset;\nattribute vec4 a_data;\nattribute vec3 a_projected_pos;\nattribute float a_fade_opacity;\n\n// contents of a_size vary based on the type of property value\n// used for {text,icon}-size.\n// For constants, a_size is disabled.\n// For source functions, we bind only one value per vertex: the value of {text,icon}-size evaluated for the current feature.\n// For composite functions:\n// [ text-size(lowerZoomStop, feature),\n// text-size(upperZoomStop, feature) ]\nuniform bool u_is_size_zoom_constant;\nuniform bool u_is_size_feature_constant;\nuniform highp float u_size_t; // used to interpolate between zoom stops when size is a composite function\nuniform highp float u_size; // used when size is both zoom and feature constant\n\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n\nuniform mat4 u_matrix;\nuniform mat4 u_label_plane_matrix;\nuniform mat4 u_gl_coord_matrix;\n\nuniform bool u_is_text;\nuniform bool u_pitch_with_map;\nuniform highp float u_pitch;\nuniform bool u_rotate_symbol;\nuniform highp float u_aspect_ratio;\nuniform highp float u_camera_to_center_distance;\nuniform float u_fade_change;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_data0;\nvarying vec3 v_data1;\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 fill_color\n #pragma mapbox: initialize highp vec4 halo_color\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize lowp float halo_width\n #pragma mapbox: initialize lowp float halo_blur\n\n vec2 a_pos = a_pos_offset.xy;\n vec2 a_offset = a_pos_offset.zw;\n\n vec2 a_tex = a_data.xy;\n vec2 a_size = a_data.zw;\n\n highp float segment_angle = -a_projected_pos[2];\n float size;\n\n if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {\n size = mix(a_size[0], a_size[1], u_size_t) / 10.0;\n } else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {\n size = a_size[0] / 10.0;\n } else if (!u_is_size_zoom_constant && u_is_size_feature_constant) {\n size = u_size;\n } else {\n size = u_size;\n }\n\n vec4 projectedPoint = u_matrix * vec4(a_pos, 0, 1);\n highp float camera_to_anchor_distance = projectedPoint.w;\n // If the label is pitched with the map, layout is done in pitched space,\n // which makes labels in the distance smaller relative to viewport space.\n // We counteract part of that effect by multiplying by the perspective ratio.\n // If the label isn't pitched with the map, we do layout in viewport space,\n // which makes labels in the distance larger relative to the features around\n // them. We counteract part of that effect by dividing by the perspective ratio.\n highp float distance_ratio = u_pitch_with_map ?\n camera_to_anchor_distance / u_camera_to_center_distance :\n u_camera_to_center_distance / camera_to_anchor_distance;\n highp float perspective_ratio = clamp(\n 0.5 + 0.5 * distance_ratio,\n 0.0, // Prevents oversized near-field symbols in pitched/overzoomed tiles\n 4.0);\n\n size *= perspective_ratio;\n\n float fontScale = u_is_text ? size / 24.0 : size;\n\n highp float symbol_rotation = 0.0;\n if (u_rotate_symbol) {\n // Point labels with 'rotation-alignment: map' are horizontal with respect to tile units\n // To figure out that angle in projected space, we draw a short horizontal line in tile\n // space, project it, and measure its angle in projected space.\n vec4 offsetProjectedPoint = u_matrix * vec4(a_pos + vec2(1, 0), 0, 1);\n\n vec2 a = projectedPoint.xy / projectedPoint.w;\n vec2 b = offsetProjectedPoint.xy / offsetProjectedPoint.w;\n\n symbol_rotation = atan((b.y - a.y) / u_aspect_ratio, b.x - a.x);\n }\n\n highp float angle_sin = sin(segment_angle + symbol_rotation);\n highp float angle_cos = cos(segment_angle + symbol_rotation);\n mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);\n\n vec4 projected_pos = u_label_plane_matrix * vec4(a_projected_pos.xy, 0.0, 1.0);\n gl_Position = u_gl_coord_matrix * vec4(projected_pos.xy / projected_pos.w + rotation_matrix * (a_offset / 32.0 * fontScale), 0.0, 1.0);\n float gamma_scale = gl_Position.w;\n\n vec2 tex = a_tex / u_texsize;\n vec2 fade_opacity = unpack_opacity(a_fade_opacity);\n float fade_change = fade_opacity[1] > 0.5 ? u_fade_change : -u_fade_change;\n float interpolated_fade_opacity = max(0.0, min(1.0, fade_opacity[0] + fade_change));\n\n v_data0 = vec2(tex.x, tex.y);\n v_data1 = vec3(gamma_scale, size, interpolated_fade_opacity);\n}\n"}},Ue=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,$e=function(t){var e=je[t],r={};e.fragmentSource=e.fragmentSource.replace(Ue,function(t,e,n,i,o){return r[o]=!0,"define"===e?"\n#ifndef HAS_UNIFORM_u_"+o+"\nvarying "+n+" "+i+" "+o+";\n#else\nuniform "+n+" "+i+" u_"+o+";\n#endif\n":"\n#ifdef HAS_UNIFORM_u_"+o+"\n "+n+" "+i+" "+o+" = u_"+o+";\n#endif\n"}),e.vertexSource=e.vertexSource.replace(Ue,function(t,e,n,i,o){var a="float"===i?"vec2":"vec4";return r[o]?"define"===e?"\n#ifndef HAS_UNIFORM_u_"+o+"\nuniform lowp float a_"+o+"_t;\nattribute "+n+" "+a+" a_"+o+";\nvarying "+n+" "+i+" "+o+";\n#else\nuniform "+n+" "+i+" u_"+o+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+o+"\n "+o+" = unpack_mix_"+a+"(a_"+o+", a_"+o+"_t);\n#else\n "+n+" "+i+" "+o+" = u_"+o+";\n#endif\n":"define"===e?"\n#ifndef HAS_UNIFORM_u_"+o+"\nuniform lowp float a_"+o+"_t;\nattribute "+n+" "+a+" a_"+o+";\n#else\nuniform "+n+" "+i+" u_"+o+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+o+"\n "+n+" "+i+" "+o+" = unpack_mix_"+a+"(a_"+o+", a_"+o+"_t);\n#else\n "+n+" "+i+" "+o+" = u_"+o+";\n#endif\n"})};for(var qe in je)$e(qe);var Ze=je,Ge=function(e,r,n,i){var o=e.gl;this.program=o.createProgram();var a=n.defines().concat("#define DEVICE_PIXEL_RATIO "+t.default$2.devicePixelRatio.toFixed(1));i&&a.push("#define OVERDRAW_INSPECTOR;");var s=a.concat(Ze.prelude.fragmentSource,r.fragmentSource).join("\n"),l=a.concat(Ze.prelude.vertexSource,r.vertexSource).join("\n"),u=o.createShader(o.FRAGMENT_SHADER);o.shaderSource(u,s),o.compileShader(u),o.attachShader(this.program,u);var c=o.createShader(o.VERTEX_SHADER);o.shaderSource(c,l),o.compileShader(c),o.attachShader(this.program,c);for(var h=n.layoutAttributes||[],p=0;p>16,s>>16),n.uniform2f(r.uniforms.u_pixel_coord_lower,65535&a,65535&s)};function or(t,e,r,n,i){if(!rr(r.paint.get("fill-pattern"),t))for(var o=!0,a=0,s=n;a0){var s=t.default$2.now(),l=(s-e.timeAdded)/a,u=r?(s-r.timeAdded)/a:-1,c=n.getSource(),h=o.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),p=!r||Math.abs(r.tileID.overscaledZ-h)>Math.abs(e.tileID.overscaledZ-h),f=p&&e.refreshedUponExpiration?1:t.clamp(p?l:1-u,0,1);return e.refreshedUponExpiration&&l>=1&&(e.refreshedUponExpiration=!1),r?{opacity:1,mix:1-f}:{opacity:f,mix:0}}return{opacity:1,mix:0}}function fr(e,r,n){var i=e.context,o=i.gl,a=n.posMatrix,s=e.useProgram("debug");i.setDepthMode(Ct.disabled),i.setStencilMode(Mt.disabled),i.setColorMode(e.colorModeForRenderPass()),o.uniformMatrix4fv(s.uniforms.u_matrix,!1,a),o.uniform4f(s.uniforms.u_color,1,0,0,1),e.debugVAO.bind(i,s,e.debugBuffer,[]),o.drawArrays(o.LINE_STRIP,0,e.debugBuffer.length);for(var l=function(t,e,r,n){n=n||1;var i,o,a,s,l,u,c,h,p=[];for(i=0,o=t.length;i":[24,[4,18,20,9,4,0]],"?":[18,[3,16,3,17,4,19,5,20,7,21,11,21,13,20,14,19,15,17,15,15,14,13,13,12,9,10,9,7,-1,-1,9,2,8,1,9,0,10,1,9,2]],"@":[27,[18,13,17,15,15,16,12,16,10,15,9,14,8,11,8,8,9,6,11,5,14,5,16,6,17,8,-1,-1,12,16,10,14,9,11,9,8,10,6,11,5,-1,-1,18,16,17,8,17,6,19,5,21,5,23,7,24,10,24,12,23,15,22,17,20,19,18,20,15,21,12,21,9,20,7,19,5,17,4,15,3,12,3,9,4,6,5,4,7,2,9,1,12,0,15,0,18,1,20,2,21,3,-1,-1,19,16,18,8,18,6,19,5]],A:[18,[9,21,1,0,-1,-1,9,21,17,0,-1,-1,4,7,14,7]],B:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,-1,-1,4,11,13,11,16,10,17,9,18,7,18,4,17,2,16,1,13,0,4,0]],C:[21,[18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5]],D:[21,[4,21,4,0,-1,-1,4,21,11,21,14,20,16,18,17,16,18,13,18,8,17,5,16,3,14,1,11,0,4,0]],E:[19,[4,21,4,0,-1,-1,4,21,17,21,-1,-1,4,11,12,11,-1,-1,4,0,17,0]],F:[18,[4,21,4,0,-1,-1,4,21,17,21,-1,-1,4,11,12,11]],G:[21,[18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,18,8,-1,-1,13,8,18,8]],H:[22,[4,21,4,0,-1,-1,18,21,18,0,-1,-1,4,11,18,11]],I:[8,[4,21,4,0]],J:[16,[12,21,12,5,11,2,10,1,8,0,6,0,4,1,3,2,2,5,2,7]],K:[21,[4,21,4,0,-1,-1,18,21,4,7,-1,-1,9,12,18,0]],L:[17,[4,21,4,0,-1,-1,4,0,16,0]],M:[24,[4,21,4,0,-1,-1,4,21,12,0,-1,-1,20,21,12,0,-1,-1,20,21,20,0]],N:[22,[4,21,4,0,-1,-1,4,21,18,0,-1,-1,18,21,18,0]],O:[22,[9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21]],P:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,14,17,12,16,11,13,10,4,10]],Q:[22,[9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21,-1,-1,12,4,18,-2]],R:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,4,11,-1,-1,11,11,18,0]],S:[20,[17,18,15,20,12,21,8,21,5,20,3,18,3,16,4,14,5,13,7,12,13,10,15,9,16,8,17,6,17,3,15,1,12,0,8,0,5,1,3,3]],T:[16,[8,21,8,0,-1,-1,1,21,15,21]],U:[22,[4,21,4,6,5,3,7,1,10,0,12,0,15,1,17,3,18,6,18,21]],V:[18,[1,21,9,0,-1,-1,17,21,9,0]],W:[24,[2,21,7,0,-1,-1,12,21,7,0,-1,-1,12,21,17,0,-1,-1,22,21,17,0]],X:[20,[3,21,17,0,-1,-1,17,21,3,0]],Y:[18,[1,21,9,11,9,0,-1,-1,17,21,9,11]],Z:[20,[17,21,3,0,-1,-1,3,21,17,21,-1,-1,3,0,17,0]],"[":[14,[4,25,4,-7,-1,-1,5,25,5,-7,-1,-1,4,25,11,25,-1,-1,4,-7,11,-7]],"\\":[14,[0,21,14,-3]],"]":[14,[9,25,9,-7,-1,-1,10,25,10,-7,-1,-1,3,25,10,25,-1,-1,3,-7,10,-7]],"^":[16,[6,15,8,18,10,15,-1,-1,3,12,8,17,13,12,-1,-1,8,17,8,0]],_:[16,[0,-2,16,-2]],"`":[10,[6,21,5,20,4,18,4,16,5,15,6,16,5,17]],a:[19,[15,14,15,0,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],b:[19,[4,21,4,0,-1,-1,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3]],c:[18,[15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],d:[19,[15,21,15,0,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],e:[18,[3,8,15,8,15,10,14,12,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],f:[12,[10,21,8,21,6,20,5,17,5,0,-1,-1,2,14,9,14]],g:[19,[15,14,15,-2,14,-5,13,-6,11,-7,8,-7,6,-6,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],h:[19,[4,21,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0]],i:[8,[3,21,4,20,5,21,4,22,3,21,-1,-1,4,14,4,0]],j:[10,[5,21,6,20,7,21,6,22,5,21,-1,-1,6,14,6,-3,5,-6,3,-7,1,-7]],k:[17,[4,21,4,0,-1,-1,14,14,4,4,-1,-1,8,8,15,0]],l:[8,[4,21,4,0]],m:[30,[4,14,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0,-1,-1,15,10,18,13,20,14,23,14,25,13,26,10,26,0]],n:[19,[4,14,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0]],o:[19,[8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3,16,6,16,8,15,11,13,13,11,14,8,14]],p:[19,[4,14,4,-7,-1,-1,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3]],q:[19,[15,14,15,-7,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],r:[13,[4,14,4,0,-1,-1,4,8,5,11,7,13,9,14,12,14]],s:[17,[14,11,13,13,10,14,7,14,4,13,3,11,4,9,6,8,11,7,13,6,14,4,14,3,13,1,10,0,7,0,4,1,3,3]],t:[12,[5,21,5,4,6,1,8,0,10,0,-1,-1,2,14,9,14]],u:[19,[4,14,4,4,5,1,7,0,10,0,12,1,15,4,-1,-1,15,14,15,0]],v:[16,[2,14,8,0,-1,-1,14,14,8,0]],w:[22,[3,14,7,0,-1,-1,11,14,7,0,-1,-1,11,14,15,0,-1,-1,19,14,15,0]],x:[17,[3,14,14,0,-1,-1,14,14,3,0]],y:[16,[2,14,8,0,-1,-1,14,14,8,0,6,-4,4,-6,2,-7,1,-7]],z:[17,[14,14,3,0,-1,-1,3,14,14,14,-1,-1,3,0,14,0]],"{":[14,[9,25,7,24,6,23,5,21,5,19,6,17,7,16,8,14,8,12,6,10,-1,-1,7,24,6,22,6,20,7,18,8,17,9,15,9,13,8,11,4,9,8,7,9,5,9,3,8,1,7,0,6,-2,6,-4,7,-6,-1,-1,6,8,8,6,8,4,7,2,6,1,5,-1,5,-3,6,-5,7,-6,9,-7]],"|":[8,[4,25,4,-7]],"}":[14,[5,25,7,24,8,23,9,21,9,19,8,17,7,16,6,14,6,12,8,10,-1,-1,7,24,8,22,8,20,7,18,6,17,5,15,5,13,6,11,10,9,6,7,5,5,5,3,6,1,7,0,8,-2,8,-4,7,-6,-1,-1,8,8,6,6,6,4,7,2,8,1,9,-1,9,-3,8,-5,7,-6,5,-7]],"~":[24,[3,6,3,8,4,11,6,12,8,12,10,11,14,8,16,7,18,7,20,8,21,10,-1,-1,3,8,4,10,6,11,8,11,10,10,14,7,16,6,18,6,20,7,21,10,21,12]]},mr={symbol:function(t,e,r,n){if("translucent"===t.renderPass){var i=t.context;i.setStencilMode(Mt.disabled),i.setColorMode(t.colorModeForRenderPass()),0!==r.paint.get("icon-opacity").constantOr(1)&&Je(t,e,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")),0!==r.paint.get("text-opacity").constantOr(1)&&Je(t,e,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")),e.map.showCollisionBoxes&&function(t,e,r,n){Xe(t,e,r,n,!1),Xe(t,e,r,n,!0)}(t,e,r,n)}},circle:function(t,e,r,n){if("translucent"===t.renderPass){var i=r.paint.get("circle-opacity"),o=r.paint.get("circle-stroke-width"),a=r.paint.get("circle-stroke-opacity");if(0!==i.constantOr(1)||0!==o.constantOr(1)&&0!==a.constantOr(1)){var s=t.context,l=s.gl;s.setDepthMode(t.depthModeForSublayer(0,Ct.ReadOnly)),s.setStencilMode(Mt.disabled),s.setColorMode(t.colorModeForRenderPass());for(var u=!0,c=0;c0?1-1/(1.001-i):-i),s.uniform1f(u.uniforms.u_contrast_factor,(o=r.paint.get("raster-contrast"))>0?1/(1-o):1+o),s.uniform3fv(u.uniforms.u_spin_weights,function(t){t*=Math.PI/180;var e=Math.sin(t),r=Math.cos(t);return[(2*r+1)/3,(-Math.sqrt(3)*e-r+1)/3,(Math.sqrt(3)*e-r+1)/3]}(r.paint.get("raster-hue-rotate"))),s.uniform1f(u.uniforms.u_buffer_scale,1),s.uniform1i(u.uniforms.u_image0,0),s.uniform1i(u.uniforms.u_image1,1);for(var c=n.length&&n[0].overscaledZ,h=0,p=n;he.row){var r=t;t=e,e=r}return{x0:t.column,y0:t.row,x1:e.column,y1:e.row,dx:e.column-t.column,dy:e.row-t.row}}function vr(t,e,r,n,i){var o=Math.max(r,Math.floor(e.y0)),a=Math.min(n,Math.ceil(e.y1));if(t.x0===e.x0&&t.y0===e.y0?t.x0+e.dy/t.dy*t.dx0,h=e.dx<0,p=o;pl.dy&&(a=s,s=l,l=a),s.dy>u.dy&&(a=s,s=u,u=a),l.dy>u.dy&&(a=l,l=u,u=a),s.dy&&vr(u,s,n,i,o),l.dy&&vr(u,l,n,i,o)}yr.prototype.resize=function(e,r){var n=this.context.gl;if(this.width=e*t.default$2.devicePixelRatio,this.height=r*t.default$2.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(var i=0,o=this.style._order;i=0;this.currentLayer--){var y=n.style._layers[a[n.currentLayer]];y.source!==(d&&d.id)&&(m=[],(d=n.style.sourceCaches[y.source])&&(n.clearStencil(),m=d.getVisibleCoordinates(),d.getSource().isTileClipped&&n._renderTileClippingMasks(m))),n.renderLayer(n,d,y,m)}this.renderPass="translucent";var g,v=[];for(this.currentLayer=0,this.currentLayer;this.currentLayer0?e.pop():null},yr.prototype._createProgramCached=function(t,e){this.cache=this.cache||{};var r=""+t+(e.cacheKey||"")+(this._showOverdrawInspector?"/overdraw":"");return this.cache[r]||(this.cache[r]=new Ge(this.context,Ze[t],e,this._showOverdrawInspector)),this.cache[r]},yr.prototype.useProgram=function(t,e){var r=this._createProgramCached(t,e||this.emptyProgramConfiguration);return this.context.program.set(r.program),r};var xr=function(t,e,r){this.tileSize=512,this._renderWorldCopies=void 0===r||r,this._minZoom=t||0,this._maxZoom=e||22,this.latRange=[-85.05113,85.05113],this.width=0,this.height=0,this._center=new R(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._posMatrixCache={},this._alignedPosMatrixCache={}},br={minZoom:{configurable:!0},maxZoom:{configurable:!0},renderWorldCopies:{configurable:!0},worldSize:{configurable:!0},centerPoint:{configurable:!0},size:{configurable:!0},bearing:{configurable:!0},pitch:{configurable:!0},fov:{configurable:!0},zoom:{configurable:!0},center:{configurable:!0},unmodified:{configurable:!0},x:{configurable:!0},y:{configurable:!0},point:{configurable:!0}};xr.prototype.clone=function(){var t=new xr(this._minZoom,this._maxZoom,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._calcMatrices(),t},br.minZoom.get=function(){return this._minZoom},br.minZoom.set=function(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},br.maxZoom.get=function(){return this._maxZoom},br.maxZoom.set=function(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},br.renderWorldCopies.get=function(){return this._renderWorldCopies},br.renderWorldCopies.set=function(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t},br.worldSize.get=function(){return this.tileSize*this.scale},br.centerPoint.get=function(){return this.size._div(2)},br.size.get=function(){return new t.default(this.width,this.height)},br.bearing.get=function(){return-this.angle/Math.PI*180},br.bearing.set=function(e){var r=-t.wrap(e,-180,180)*Math.PI/180;this.angle!==r&&(this._unmodified=!1,this.angle=r,this._calcMatrices(),this.rotationMatrix=t.create$4(),t.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},br.pitch.get=function(){return this._pitch/Math.PI*180},br.pitch.set=function(e){var r=t.clamp(e,0,60)/180*Math.PI;this._pitch!==r&&(this._unmodified=!1,this._pitch=r,this._calcMatrices())},br.fov.get=function(){return this._fov/Math.PI*180},br.fov.set=function(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())},br.zoom.get=function(){return this._zoom},br.zoom.set=function(t){var e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom,this._constrain(),this._calcMatrices())},br.center.get=function(){return this._center},br.center.set=function(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())},xr.prototype.coveringZoomLevel=function(t){return(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize))},xr.prototype.getVisibleUnwrappedCoordinates=function(e){var r=this.pointCoordinate(new t.default(0,0),0),n=this.pointCoordinate(new t.default(this.width,0),0),i=Math.floor(r.column),o=Math.floor(n.column),a=[new t.UnwrappedTileID(0,e)];if(this._renderWorldCopies)for(var s=i;s<=o;s++)0!==s&&a.push(new t.UnwrappedTileID(s,e));return a},xr.prototype.coveringTiles=function(e){var r=this.coveringZoomLevel(e),n=r;if(void 0!==e.minzoom&&re.maxzoom&&(r=e.maxzoom);var i=this.pointCoordinate(this.centerPoint,r),o=new t.default(i.column-.5,i.row-.5);return function(e,r,n,i){void 0===i&&(i=!0);var o=1<=0&&l<=o)for(u=r;ua&&(i=a-m)}if(this.lngRange){var y=this.x,g=u.x/2;y-gl&&(n=l-g)}void 0===n&&void 0===i||(this.center=this.unproject(new t.default(void 0!==n?n:this.x,void 0!==i?i:this.y))),this._unmodified=c,this._constraining=!1}},xr.prototype._calcMatrices=function(){if(this.height){this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;var e=this._fov/2,r=Math.PI/2+this._pitch,n=Math.sin(e)*this.cameraToCenterDistance/Math.sin(Math.PI-r-e),i=this.x,o=this.y,a=1.01*(Math.cos(Math.PI/2-this._pitch)*n+this.cameraToCenterDistance),s=new Float64Array(16);t.perspective(s,this._fov,this.width/this.height,1,a),t.scale(s,s,[1,-1,1]),t.translate(s,s,[0,0,-this.cameraToCenterDistance]),t.rotateX(s,s,this._pitch),t.rotateZ(s,s,this.angle),t.translate(s,s,[-i,-o,0]);var l=this.worldSize/(2*Math.PI*6378137*Math.abs(Math.cos(this.center.lat*(Math.PI/180))));t.scale(s,s,[1,1,l,1]),this.projMatrix=s;var u=this.width%2/2,c=this.height%2/2,h=Math.cos(this.angle),p=Math.sin(this.angle),f=i-Math.round(i)+h*u+p*c,d=o-Math.round(o)+h*c+p*u,m=new Float64Array(s);if(t.translate(m,m,[f>.5?f-1:f,d>.5?d-1:d,0]),this.alignedProjMatrix=m,s=t.create(),t.scale(s,s,[this.width/2,-this.height/2,1]),t.translate(s,s,[1,-1,0]),this.pixelMatrix=t.multiply(new Float64Array(16),s,this.projMatrix),!(s=t.invert(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");this.pixelMatrixInverse=s,this._posMatrixCache={},this._alignedPosMatrixCache={}}},xr.prototype.maxPitchScaleFactor=function(){if(!this.pixelMatrixInverse)return 1;var e=this.pointCoordinate(new t.default(0,0)).zoomTo(this.zoom),r=[e.column*this.tileSize,e.row*this.tileSize,0,1];return t.transformMat4(r,r,this.pixelMatrix)[3]/this.cameraToCenterDistance},Object.defineProperties(xr.prototype,br);var wr=function(){var e,r,n,i;t.bindAll(["_onHashChange","_updateHash"],this),this._updateHash=(e=this._updateHashUnthrottled.bind(this),300,r=!1,n=0,i=function(){n=0,r&&(e(),n=setTimeout(i,300),r=!1)},function(){return r=!0,n||i(),n})};wr.prototype.addTo=function(e){return this._map=e,t.default$1.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},wr.prototype.remove=function(){return t.default$1.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this},wr.prototype.getHashString=function(t){var e=this._map.getCenter(),r=Math.round(100*this._map.getZoom())/100,n=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),i=Math.pow(10,n),o=Math.round(e.lng*i)/i,a=Math.round(e.lat*i)/i,s=this._map.getBearing(),l=this._map.getPitch(),u="";return u+=t?"#/"+o+"/"+a+"/"+r:"#"+r+"/"+a+"/"+o,(s||l)&&(u+="/"+Math.round(10*s)/10),l&&(u+="/"+Math.round(l)),u},wr.prototype._onHashChange=function(){var e=t.default$1.location.hash.replace("#","").split("/");return e.length>=3&&(this._map.jumpTo({center:[+e[2],+e[1]],zoom:+e[0],bearing:+(e[3]||0),pitch:+(e[4]||0)}),!0)},wr.prototype._updateHashUnthrottled=function(){var e=this.getHashString();t.default$1.history.replaceState(t.default$1.history.state,"",e)};var Er=function(e){function n(n,i,o,a){void 0===a&&(a={});var s=r.mousePos(i.getCanvasContainer(),o),l=i.unproject(s);e.call(this,n,t.extend({point:s,lngLat:l,originalEvent:o},a)),this._defaultPrevented=!1,this.target=i}e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n;var i={defaultPrevented:{configurable:!0}};return n.prototype.preventDefault=function(){this._defaultPrevented=!0},i.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(n.prototype,i),n}(t.Event),Sr=function(e){function n(n,i,o){var a=r.touchPos(i.getCanvasContainer(),o),s=a.map(function(t){return i.unproject(t)}),l=a.reduce(function(t,e,r,n){return t.add(e.div(n.length))},new t.default(0,0)),u=i.unproject(l);e.call(this,n,{points:a,point:l,lngLats:s,lngLat:u,originalEvent:o}),this._defaultPrevented=!1}e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n;var i={defaultPrevented:{configurable:!0}};return n.prototype.preventDefault=function(){this._defaultPrevented=!0},i.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(n.prototype,i),n}(t.Event),Tr=function(t){function e(e,r,n){t.call(this,e,{originalEvent:n}),this._defaultPrevented=!1}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={defaultPrevented:{configurable:!0}};return e.prototype.preventDefault=function(){this._defaultPrevented=!0},r.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(e.prototype,r),e}(t.Event),kr=function(e){this._map=e,this._el=e.getCanvasContainer(),this._delta=0,t.bindAll(["_onWheel","_onTimeout","_onScrollFrame","_onScrollFinished"],this)};kr.prototype.isEnabled=function(){return!!this._enabled},kr.prototype.isActive=function(){return!!this._active},kr.prototype.enable=function(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&"center"===t.around)},kr.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},kr.prototype.onWheel=function(e){if(this.isEnabled()){var r=e.deltaMode===t.default$1.WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,n=t.default$2.now(),i=n-(this._lastWheelEventTime||0);this._lastWheelEventTime=n,0!==r&&r%4.000244140625==0?this._type="wheel":0!==r&&Math.abs(r)<4?this._type="trackpad":i>400?(this._type=null,this._lastValue=r,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(i*r)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,r+=this._lastValue)),e.shiftKey&&r&&(r/=4),this._type&&(this._lastWheelEvent=e,this._delta-=r,this.isActive()||this._start(e)),e.preventDefault()}},kr.prototype._onTimeout=function(t){this._type="wheel",this._delta-=this._lastValue,this.isActive()||this._start(t)},kr.prototype._start=function(e){if(this._delta){this._frameId&&(this._map._cancelRenderFrame(this._frameId),this._frameId=null),this._active=!0,this._map.fire(new t.Event("movestart",{originalEvent:e})),this._map.fire(new t.Event("zoomstart",{originalEvent:e})),this._finishTimeout&&clearTimeout(this._finishTimeout);var n=r.mousePos(this._el,e);this._around=R.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(n)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=this._map._requestRenderFrame(this._onScrollFrame))}},kr.prototype._onScrollFrame=function(){var e=this;if(this._frameId=null,this.isActive()){var r=this._map.transform;if(0!==this._delta){var n="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?1/450:.01,i=2/(1+Math.exp(-Math.abs(this._delta*n)));this._delta<0&&0!==i&&(i=1/i);var o="number"==typeof this._targetZoom?r.zoomScale(this._targetZoom):r.scale;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom(o*i))),"wheel"===this._type&&(this._startZoom=r.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}var a=!1;if("wheel"===this._type){var s=Math.min((t.default$2.now()-this._lastWheelEventTime)/200,1),l=this._easing(s);r.zoom=t.number(this._startZoom,this._targetZoom,l),s<1?this._frameId||(this._frameId=this._map._requestRenderFrame(this._onScrollFrame)):a=!0}else r.zoom=this._targetZoom,a=!0;r.setLocationAtPoint(this._around,this._aroundPoint),this._map.fire(new t.Event("move",{originalEvent:this._lastWheelEvent})),this._map.fire(new t.Event("zoom",{originalEvent:this._lastWheelEvent})),a&&(this._active=!1,this._finishTimeout=setTimeout(function(){e._map.fire(new t.Event("zoomend",{originalEvent:e._lastWheelEvent})),e._map.fire(new t.Event("moveend",{originalEvent:e._lastWheelEvent})),delete e._targetZoom},200))}},kr.prototype._smoothOutEasing=function(e){var r=t.ease;if(this._prevEase){var n=this._prevEase,i=(t.default$2.now()-n.start)/n.duration,o=n.easing(i+.01)-n.easing(i),a=.27/Math.sqrt(o*o+1e-4)*.01,s=Math.sqrt(.0729-a*a);r=t.bezier(a,s,.25,1)}return this._prevEase={start:t.default$2.now(),duration:e,easing:r},r};var Ar=function(e){this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),t.bindAll(["_onMouseMove","_onMouseUp","_onKeyDown"],this)};Ar.prototype.isEnabled=function(){return!!this._enabled},Ar.prototype.isActive=function(){return!!this._active},Ar.prototype.enable=function(){this.isEnabled()||(this._enabled=!0)},Ar.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},Ar.prototype.onMouseDown=function(e){this.isEnabled()&&e.shiftKey&&0===e.button&&(t.default$1.document.addEventListener("mousemove",this._onMouseMove,!1),t.default$1.document.addEventListener("keydown",this._onKeyDown,!1),t.default$1.document.addEventListener("mouseup",this._onMouseUp,!1),r.disableDrag(),this._startPos=this._lastPos=r.mousePos(this._el,e),this._active=!0)},Ar.prototype._onMouseMove=function(t){var e=r.mousePos(this._el,t);if(!this._lastPos.equals(e)){var n=this._startPos;this._lastPos=e,this._box||(this._box=r.create("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));var i=Math.min(n.x,e.x),o=Math.max(n.x,e.x),a=Math.min(n.y,e.y),s=Math.max(n.y,e.y);r.setTransform(this._box,"translate("+i+"px,"+a+"px)"),this._box.style.width=o-i+"px",this._box.style.height=s-a+"px"}},Ar.prototype._onMouseUp=function(e){if(0===e.button){var n=this._startPos,i=r.mousePos(this._el,e),o=(new B).extend(this._map.unproject(n)).extend(this._map.unproject(i));this._finish(),r.suppressClick(),n.x===i.x&&n.y===i.y?this._fireEvent("boxzoomcancel",e):this._map.fitBounds(o,{linear:!0}).fire(new t.Event("boxzoomend",{originalEvent:e,boxZoomBounds:o}))}},Ar.prototype._onKeyDown=function(t){27===t.keyCode&&(this._finish(),this._fireEvent("boxzoomcancel",t))},Ar.prototype._finish=function(){this._active=!1,t.default$1.document.removeEventListener("mousemove",this._onMouseMove,!1),t.default$1.document.removeEventListener("keydown",this._onKeyDown,!1),t.default$1.document.removeEventListener("mouseup",this._onMouseUp,!1),this._container.classList.remove("mapboxgl-crosshair"),this._box&&(r.remove(this._box),this._box=null),r.enableDrag(),delete this._startPos,delete this._lastPos},Ar.prototype._fireEvent=function(e,r){return this._map.fire(new t.Event(e,{originalEvent:r}))};var Ir=t.bezier(0,0,.25,1),zr=function(e,r){this._map=e,this._el=r.element||e.getCanvasContainer(),this._state="disabled",this._button=r.button||"right",this._bearingSnap=r.bearingSnap||0,this._pitchWithRotate=!1!==r.pitchWithRotate,t.bindAll(["onMouseDown","_onMouseMove","_onMouseUp","_onBlur","_onDragFrame"],this)};zr.prototype.isEnabled=function(){return"disabled"!==this._state},zr.prototype.isActive=function(){return"active"===this._state},zr.prototype.enable=function(){this.isEnabled()||(this._state="enabled")},zr.prototype.disable=function(){if(this.isEnabled())switch(this._state){case"active":this._state="disabled",this._unbind(),this._deactivate(),this._fireEvent("rotateend"),this._pitchWithRotate&&this._fireEvent("pitchend"),this._fireEvent("moveend");break;case"pending":this._state="disabled",this._unbind();break;default:this._state="disabled"}},zr.prototype.onMouseDown=function(e){if("enabled"===this._state){if("right"===this._button){if(this._eventButton=r.mouseButton(e),this._eventButton!==(e.ctrlKey?0:2))return}else{if(e.ctrlKey||0!==r.mouseButton(e))return;this._eventButton=0}r.disableDrag(),t.default$1.document.addEventListener("mousemove",this._onMouseMove,{capture:!0}),t.default$1.document.addEventListener("mouseup",this._onMouseUp),t.default$1.addEventListener("blur",this._onBlur),this._state="pending",this._inertia=[[t.default$2.now(),this._map.getBearing()]],this._startPos=this._lastPos=r.mousePos(this._el,e),this._center=this._map.transform.centerPoint,e.preventDefault()}},zr.prototype._onMouseMove=function(t){var e=r.mousePos(this._el,t);this._lastPos.equals(e)||(this._lastMoveEvent=t,this._lastPos=e,"pending"===this._state&&(this._state="active",this._fireEvent("rotatestart",t),this._fireEvent("movestart",t),this._pitchWithRotate&&this._fireEvent("pitchstart",t)),this._frameId||(this._frameId=this._map._requestRenderFrame(this._onDragFrame)))},zr.prototype._onDragFrame=function(){this._frameId=null;var e=this._lastMoveEvent;if(e){var r=this._map.transform,n=this._startPos,i=this._lastPos,o=.8*(n.x-i.x),a=-.5*(n.y-i.y),s=r.bearing-o,l=r.pitch-a,u=this._inertia,c=u[u.length-1];this._drainInertiaBuffer(),u.push([t.default$2.now(),this._map._normalizeBearing(s,c[1])]),r.bearing=s,this._pitchWithRotate&&(this._fireEvent("pitch",e),r.pitch=l),this._fireEvent("rotate",e),this._fireEvent("move",e),delete this._lastMoveEvent,this._startPos=this._lastPos}},zr.prototype._onMouseUp=function(t){if(r.mouseButton(t)===this._eventButton)switch(this._state){case"active":this._state="enabled",r.suppressClick(),this._unbind(),this._deactivate(),this._inertialRotate(t);break;case"pending":this._state="enabled",this._unbind()}},zr.prototype._onBlur=function(t){switch(this._state){case"active":this._state="enabled",this._unbind(),this._deactivate(),this._fireEvent("rotateend",t),this._pitchWithRotate&&this._fireEvent("pitchend",t),this._fireEvent("moveend",t);break;case"pending":this._state="enabled",this._unbind()}},zr.prototype._unbind=function(){t.default$1.document.removeEventListener("mousemove",this._onMouseMove,{capture:!0}),t.default$1.document.removeEventListener("mouseup",this._onMouseUp),t.default$1.removeEventListener("blur",this._onBlur),r.enableDrag()},zr.prototype._deactivate=function(){this._frameId&&(this._map._cancelRenderFrame(this._frameId),this._frameId=null),delete this._lastMoveEvent,delete this._startPos,delete this._lastPos},zr.prototype._inertialRotate=function(t){var e=this;this._fireEvent("rotateend",t),this._drainInertiaBuffer();var r=this._map,n=r.getBearing(),i=this._inertia,o=function(){Math.abs(n)180&&(f=180);var d=f/180;u+=h*f*(d/2),Math.abs(r._normalizeBearing(u,0))0&&r-e[0][0]>160;)e.shift()};var Cr=t.bezier(0,0,.3,1),Mr=function(e){this._map=e,this._el=e.getCanvasContainer(),this._state="disabled",t.bindAll(["_onMove","_onMouseUp","_onTouchEnd","_onBlur","_onDragFrame"],this)};Mr.prototype.isEnabled=function(){return"disabled"!==this._state},Mr.prototype.isActive=function(){return"active"===this._state},Mr.prototype.enable=function(){this.isEnabled()||(this._el.classList.add("mapboxgl-touch-drag-pan"),this._state="enabled")},Mr.prototype.disable=function(){if(this.isEnabled())switch(this._el.classList.remove("mapboxgl-touch-drag-pan"),this._state){case"active":this._state="disabled",this._unbind(),this._deactivate(),this._fireEvent("dragend"),this._fireEvent("moveend");break;case"pending":this._state="disabled",this._unbind();break;default:this._state="disabled"}},Mr.prototype.onMouseDown=function(e){"enabled"===this._state&&(e.ctrlKey||0!==r.mouseButton(e)||(r.addEventListener(t.default$1.document,"mousemove",this._onMove,{capture:!0}),r.addEventListener(t.default$1.document,"mouseup",this._onMouseUp),this._start(e)))},Mr.prototype.onTouchStart=function(e){"enabled"===this._state&&(e.touches.length>1||(r.addEventListener(t.default$1.document,"touchmove",this._onMove,{capture:!0,passive:!1}),r.addEventListener(t.default$1.document,"touchend",this._onTouchEnd),this._start(e)))},Mr.prototype._start=function(e){t.default$1.addEventListener("blur",this._onBlur),this._state="pending",this._startPos=this._lastPos=r.mousePos(this._el,e),this._inertia=[[t.default$2.now(),this._startPos]]},Mr.prototype._onMove=function(e){e.preventDefault();var n=r.mousePos(this._el,e);this._lastPos.equals(n)||(this._lastMoveEvent=e,this._lastPos=n,this._drainInertiaBuffer(),this._inertia.push([t.default$2.now(),this._lastPos]),"pending"===this._state&&(this._state="active",this._fireEvent("dragstart",e),this._fireEvent("movestart",e)),this._frameId||(this._frameId=this._map._requestRenderFrame(this._onDragFrame)))},Mr.prototype._onDragFrame=function(){this._frameId=null;var t=this._lastMoveEvent;if(t){var e=this._map.transform;e.setLocationAtPoint(e.pointLocation(this._startPos),this._lastPos),this._fireEvent("drag",t),this._fireEvent("move",t),this._startPos=this._lastPos,delete this._lastMoveEvent}},Mr.prototype._onMouseUp=function(t){if(0===r.mouseButton(t))switch(this._state){case"active":this._state="enabled",r.suppressClick(),this._unbind(),this._deactivate(),this._inertialPan(t);break;case"pending":this._state="enabled",this._unbind()}},Mr.prototype._onTouchEnd=function(t){switch(this._state){case"active":this._state="enabled",this._unbind(),this._deactivate(),this._inertialPan(t);break;case"pending":this._state="enabled",this._unbind()}},Mr.prototype._onBlur=function(t){switch(this._state){case"active":this._state="enabled",this._unbind(),this._deactivate(),this._fireEvent("dragend",t),this._fireEvent("moveend",t);break;case"pending":this._state="enabled",this._unbind()}},Mr.prototype._unbind=function(){r.removeEventListener(t.default$1.document,"touchmove",this._onMove,{capture:!0,passive:!1}),r.removeEventListener(t.default$1.document,"touchend",this._onTouchEnd),r.removeEventListener(t.default$1.document,"mousemove",this._onMove,{capture:!0}),r.removeEventListener(t.default$1.document,"mouseup",this._onMouseUp),r.removeEventListener(t.default$1,"blur",this._onBlur)},Mr.prototype._deactivate=function(){this._frameId&&(this._map._cancelRenderFrame(this._frameId),this._frameId=null),delete this._lastMoveEvent,delete this._startPos,delete this._lastPos},Mr.prototype._inertialPan=function(t){this._fireEvent("dragend",t),this._drainInertiaBuffer();var e=this._inertia;if(e.length<2)this._fireEvent("moveend",t);else{var r=e[e.length-1],n=e[0],i=r[1].sub(n[1]),o=(r[0]-n[0])/1e3;if(0===o||r[1].equals(n[1]))this._fireEvent("moveend",t);else{var a=i.mult(.3/o),s=a.mag();s>1400&&(s=1400,a._unit()._mult(s));var l=s/750,u=a.mult(-l/2);this._map.panBy(u,{duration:1e3*l,easing:Cr,noMoveStart:!0},{originalEvent:t})}}},Mr.prototype._fireEvent=function(e,r){return this._map.fire(new t.Event(e,r?{originalEvent:r}:{}))},Mr.prototype._drainInertiaBuffer=function(){for(var e=this._inertia,r=t.default$2.now();e.length>0&&r-e[0][0]>160;)e.shift()};var Pr=function(e){this._map=e,this._el=e.getCanvasContainer(),t.bindAll(["_onKeyDown"],this)};function Lr(t){return t*(2-t)}Pr.prototype.isEnabled=function(){return!!this._enabled},Pr.prototype.enable=function(){this.isEnabled()||(this._el.addEventListener("keydown",this._onKeyDown,!1),this._enabled=!0)},Pr.prototype.disable=function(){this.isEnabled()&&(this._el.removeEventListener("keydown",this._onKeyDown),this._enabled=!1)},Pr.prototype._onKeyDown=function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e=0,r=0,n=0,i=0,o=0;switch(t.keyCode){case 61:case 107:case 171:case 187:e=1;break;case 189:case 109:case 173:e=-1;break;case 37:t.shiftKey?r=-1:(t.preventDefault(),i=-1);break;case 39:t.shiftKey?r=1:(t.preventDefault(),i=1);break;case 38:t.shiftKey?n=1:(t.preventDefault(),o=-1);break;case 40:t.shiftKey?n=-1:(o=1,t.preventDefault());break;default:return}var a=this._map,s=a.getZoom(),l={duration:300,delayEndEvents:500,easing:Lr,zoom:e?Math.round(s)+e*(t.shiftKey?2:1):s,bearing:a.getBearing()+15*r,pitch:a.getPitch()+10*n,offset:[100*-i,100*-o],center:a.getCenter()};a.easeTo(l,{originalEvent:t})}};var Dr=function(e){this._map=e,t.bindAll(["_onDblClick","_onZoomEnd"],this)};Dr.prototype.isEnabled=function(){return!!this._enabled},Dr.prototype.isActive=function(){return!!this._active},Dr.prototype.enable=function(){this.isEnabled()||(this._enabled=!0)},Dr.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},Dr.prototype.onTouchStart=function(t){var e=this;this.isEnabled()&&(t.points.length>1||(this._tapped?(clearTimeout(this._tapped),this._tapped=null,this._zoom(t)):this._tapped=setTimeout(function(){e._tapped=null},300)))},Dr.prototype.onDblClick=function(t){this.isEnabled()&&(t.originalEvent.preventDefault(),this._zoom(t))},Dr.prototype._zoom=function(t){this._active=!0,this._map.on("zoomend",this._onZoomEnd),this._map.zoomTo(this._map.getZoom()+(t.originalEvent.shiftKey?-1:1),{around:t.lngLat},t)},Dr.prototype._onZoomEnd=function(){this._active=!1,this._map.off("zoomend",this._onZoomEnd)};var Rr=t.bezier(0,0,.15,1),Br=function(e){this._map=e,this._el=e.getCanvasContainer(),t.bindAll(["_onMove","_onEnd","_onTouchFrame"],this)};Br.prototype.isEnabled=function(){return!!this._enabled},Br.prototype.enable=function(t){this.isEnabled()||(this._el.classList.add("mapboxgl-touch-zoom-rotate"),this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around)},Br.prototype.disable=function(){this.isEnabled()&&(this._el.classList.remove("mapboxgl-touch-zoom-rotate"),this._enabled=!1)},Br.prototype.disableRotation=function(){this._rotationDisabled=!0},Br.prototype.enableRotation=function(){this._rotationDisabled=!1},Br.prototype.onStart=function(e){if(this.isEnabled()&&2===e.touches.length){var n=r.mousePos(this._el,e.touches[0]),i=r.mousePos(this._el,e.touches[1]);this._startVec=n.sub(i),this._gestureIntent=void 0,this._inertia=[],r.addEventListener(t.default$1.document,"touchmove",this._onMove,{passive:!1}),r.addEventListener(t.default$1.document,"touchend",this._onEnd)}},Br.prototype._getTouchEventData=function(t){var e=r.mousePos(this._el,t.touches[0]),n=r.mousePos(this._el,t.touches[1]),i=e.sub(n);return{vec:i,center:e.add(n).div(2),scale:i.mag()/this._startVec.mag(),bearing:this._rotationDisabled?0:180*i.angleWith(this._startVec)/Math.PI}},Br.prototype._onMove=function(e){if(2===e.touches.length){var r=this._getTouchEventData(e),n=r.vec,i=r.scale,o=r.bearing;if(!this._gestureIntent){var a=Math.abs(1-i)>.15;Math.abs(o)>10?this._gestureIntent="rotate":a&&(this._gestureIntent="zoom"),this._gestureIntent&&(this._map.fire(new t.Event(this._gestureIntent+"start",{originalEvent:e})),this._map.fire(new t.Event("movestart",{originalEvent:e})),this._startVec=n)}this._lastTouchEvent=e,this._frameId||(this._frameId=this._map._requestRenderFrame(this._onTouchFrame)),e.preventDefault()}},Br.prototype._onTouchFrame=function(){this._frameId=null;var e=this._gestureIntent;if(e){var r=this._map.transform;this._startScale||(this._startScale=r.scale,this._startBearing=r.bearing);var n=this._getTouchEventData(this._lastTouchEvent),i=n.center,o=n.bearing,a=n.scale,s=r.pointLocation(i),l=r.locationPoint(s);"rotate"===e&&(r.bearing=this._startBearing+o),r.zoom=r.scaleZoom(this._startScale*a),r.setLocationAtPoint(s,l),this._map.fire(new t.Event(e,{originalEvent:this._lastTouchEvent})),this._map.fire(new t.Event("move",{originalEvent:this._lastTouchEvent})),this._drainInertiaBuffer(),this._inertia.push([t.default$2.now(),a,i])}},Br.prototype._onEnd=function(e){r.removeEventListener(t.default$1.document,"touchmove",this._onMove,{passive:!1}),r.removeEventListener(t.default$1.document,"touchend",this._onEnd);var n=this._gestureIntent,i=this._startScale;if(this._frameId&&(this._map._cancelRenderFrame(this._frameId),this._frameId=null),delete this._gestureIntent,delete this._startScale,delete this._startBearing,delete this._lastTouchEvent,n){this._map.fire(new t.Event(n+"end",{originalEvent:e})),this._drainInertiaBuffer();var o=this._inertia,a=this._map;if(o.length<2)a.snapToNorth({},{originalEvent:e});else{var s=o[o.length-1],l=o[0],u=a.transform.scaleZoom(i*s[1]),c=a.transform.scaleZoom(i*l[1]),h=u-c,p=(s[0]-l[0])/1e3,f=s[2];if(0!==p&&u!==c){var d=.15*h/p;Math.abs(d)>2.5&&(d=d>0?2.5:-2.5);var m=1e3*Math.abs(d/(12*.15)),y=u+d*m/2e3;y<0&&(y=0),a.easeTo({zoom:y,duration:m,easing:Rr,around:this._aroundCenter?a.getCenter():a.unproject(f),noMoveStart:!0},{originalEvent:e})}else a.snapToNorth({},{originalEvent:e})}}},Br.prototype._drainInertiaBuffer=function(){for(var e=this._inertia,r=t.default$2.now();e.length>2&&r-e[0][0]>160;)e.shift()};var Or={scrollZoom:kr,boxZoom:Ar,dragRotate:zr,dragPan:Mr,keyboard:Pr,doubleClickZoom:Dr,touchZoomRotate:Br},Fr=function(e){function r(r,n){e.call(this),this._moving=!1,this._zooming=!1,this.transform=r,this._bearingSnap=n.bearingSnap,t.bindAll(["_renderFrameCallback"],this)}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.getCenter=function(){return this.transform.center},r.prototype.setCenter=function(t,e){return this.jumpTo({center:t},e)},r.prototype.panBy=function(e,r,n){return e=t.default.convert(e).mult(-1),this.panTo(this.transform.center,t.extend({offset:e},r),n)},r.prototype.panTo=function(e,r,n){return this.easeTo(t.extend({center:e},r),n)},r.prototype.getZoom=function(){return this.transform.zoom},r.prototype.setZoom=function(t,e){return this.jumpTo({zoom:t},e),this},r.prototype.zoomTo=function(e,r,n){return this.easeTo(t.extend({zoom:e},r),n)},r.prototype.zoomIn=function(t,e){return this.zoomTo(this.getZoom()+1,t,e),this},r.prototype.zoomOut=function(t,e){return this.zoomTo(this.getZoom()-1,t,e),this},r.prototype.getBearing=function(){return this.transform.bearing},r.prototype.setBearing=function(t,e){return this.jumpTo({bearing:t},e),this},r.prototype.rotateTo=function(e,r,n){return this.easeTo(t.extend({bearing:e},r),n)},r.prototype.resetNorth=function(e,r){return this.rotateTo(0,t.extend({duration:1e3},e),r),this},r.prototype.snapToNorth=function(t,e){return Math.abs(this.getBearing())e?1:0}),["bottom","left","right","top"])){e=B.convert(e);var i=[(r.padding.left-r.padding.right)/2,(r.padding.top-r.padding.bottom)/2],o=Math.min(r.padding.right,r.padding.left),a=Math.min(r.padding.top,r.padding.bottom);r.offset=[r.offset[0]+i[0],r.offset[1]+i[1]];var s=t.default.convert(r.offset),l=this.transform,u=l.project(e.getNorthWest()),c=l.project(e.getSouthEast()),h=c.sub(u),p=(l.width-2*o-2*Math.abs(s.x))/h.x,f=(l.height-2*a-2*Math.abs(s.y))/h.y;if(!(f<0||p<0))return r.center=l.unproject(u.add(c).div(2)),r.zoom=Math.min(l.scaleZoom(l.scale*Math.min(p,f)),r.maxZoom),r.bearing=0,r;t.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}else t.warnOnce("options.padding must be a positive number, or an Object with keys 'bottom', 'left', 'right', 'top'")},r.prototype.fitBounds=function(e,r,n){var i=this.cameraForBounds(e,r);return i?(r=t.extend(i,r)).linear?this.easeTo(r,n):this.flyTo(r,n):this},r.prototype.jumpTo=function(e,r){this.stop();var n=this.transform,i=!1,o=!1,a=!1;return"zoom"in e&&n.zoom!==+e.zoom&&(i=!0,n.zoom=+e.zoom),void 0!==e.center&&(n.center=R.convert(e.center)),"bearing"in e&&n.bearing!==+e.bearing&&(o=!0,n.bearing=+e.bearing),"pitch"in e&&n.pitch!==+e.pitch&&(a=!0,n.pitch=+e.pitch),this.fire(new t.Event("movestart",r)).fire(new t.Event("move",r)),i&&this.fire(new t.Event("zoomstart",r)).fire(new t.Event("zoom",r)).fire(new t.Event("zoomend",r)),o&&this.fire(new t.Event("rotatestart",r)).fire(new t.Event("rotate",r)).fire(new t.Event("rotateend",r)),a&&this.fire(new t.Event("pitchstart",r)).fire(new t.Event("pitch",r)).fire(new t.Event("pitchend",r)),this.fire(new t.Event("moveend",r))},r.prototype.easeTo=function(e,r){var n=this;this.stop(),!1===(e=t.extend({offset:[0,0],duration:500,easing:t.ease},e)).animate&&(e.duration=0);var i=this.transform,o=this.getZoom(),a=this.getBearing(),s=this.getPitch(),l="zoom"in e?+e.zoom:o,u="bearing"in e?this._normalizeBearing(e.bearing,a):a,c="pitch"in e?+e.pitch:s,h=i.centerPoint.add(t.default.convert(e.offset)),p=i.pointLocation(h),f=R.convert(e.center||p);this._normalizeCenter(f);var d,m,y=i.project(p),g=i.project(f).sub(y),v=i.zoomScale(l-o);return e.around&&(d=R.convert(e.around),m=i.locationPoint(d)),this._zooming=l!==o,this._rotating=a!==u,this._pitching=c!==s,this._prepareEase(r,e.noMoveStart),clearTimeout(this._easeEndTimeoutID),this._ease(function(e){if(n._zooming&&(i.zoom=t.number(o,l,e)),n._rotating&&(i.bearing=t.number(a,u,e)),n._pitching&&(i.pitch=t.number(s,c,e)),d)i.setLocationAtPoint(d,m);else{var p=i.zoomScale(i.zoom-o),f=l>o?Math.min(2,v):Math.max(.5,v),_=Math.pow(f,1-e),x=i.unproject(y.add(g.mult(e*_)).mult(p));i.setLocationAtPoint(i.renderWorldCopies?x.wrap():x,h)}n._fireMoveEvents(r)},function(){e.delayEndEvents?n._easeEndTimeoutID=setTimeout(function(){return n._afterEase(r)},e.delayEndEvents):n._afterEase(r)},e),this},r.prototype._prepareEase=function(e,r){this._moving=!0,r||this.fire(new t.Event("movestart",e)),this._zooming&&this.fire(new t.Event("zoomstart",e)),this._rotating&&this.fire(new t.Event("rotatestart",e)),this._pitching&&this.fire(new t.Event("pitchstart",e))},r.prototype._fireMoveEvents=function(e){this.fire(new t.Event("move",e)),this._zooming&&this.fire(new t.Event("zoom",e)),this._rotating&&this.fire(new t.Event("rotate",e)),this._pitching&&this.fire(new t.Event("pitch",e))},r.prototype._afterEase=function(e){var r=this._zooming,n=this._rotating,i=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,r&&this.fire(new t.Event("zoomend",e)),n&&this.fire(new t.Event("rotateend",e)),i&&this.fire(new t.Event("pitchend",e)),this.fire(new t.Event("moveend",e))},r.prototype.flyTo=function(e,r){var n=this;this.stop(),e=t.extend({offset:[0,0],speed:1.2,curve:1.42,easing:t.ease},e);var i=this.transform,o=this.getZoom(),a=this.getBearing(),s=this.getPitch(),l="zoom"in e?t.clamp(+e.zoom,i.minZoom,i.maxZoom):o,u="bearing"in e?this._normalizeBearing(e.bearing,a):a,c="pitch"in e?+e.pitch:s,h=i.zoomScale(l-o),p=i.centerPoint.add(t.default.convert(e.offset)),f=i.pointLocation(p),d=R.convert(e.center||f);this._normalizeCenter(d);var m=i.project(f),y=i.project(d).sub(m),g=e.curve,v=Math.max(i.width,i.height),_=v/h,x=y.mag();if("minZoom"in e){var b=t.clamp(Math.min(e.minZoom,o,l),i.minZoom,i.maxZoom),w=v/i.zoomScale(b-o);g=Math.sqrt(w/x*2)}var E=g*g;function S(t){var e=(_*_-v*v+(t?-1:1)*E*E*x*x)/(2*(t?_:v)*E*x);return Math.log(Math.sqrt(e*e+1)-e)}function T(t){return(Math.exp(t)-Math.exp(-t))/2}function k(t){return(Math.exp(t)+Math.exp(-t))/2}var A=S(0),I=function(t){return k(A)/k(A+g*t)},z=function(t){return v*((k(A)*(T(e=A+g*t)/k(e))-T(A))/E)/x;var e},C=(S(1)-A)/g;if(Math.abs(x)<1e-6||!isFinite(C)){if(Math.abs(v-_)<1e-6)return this.easeTo(e,r);var M=_e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=a!==u,this._pitching=c!==s,this._prepareEase(r,!1),this._ease(function(e){var l=e*C,h=1/I(l);i.zoom=o+i.scaleZoom(h),n._rotating&&(i.bearing=t.number(a,u,e)),n._pitching&&(i.pitch=t.number(s,c,e));var f=i.unproject(m.add(y.mult(z(l))).mult(h));i.setLocationAtPoint(i.renderWorldCopies?f.wrap():f,p),n._fireMoveEvents(r)},function(){return n._afterEase(r)},e),this},r.prototype.isEasing=function(){return!!this._easeFrameId},r.prototype.stop=function(){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){var t=this._onEaseEnd;delete this._onEaseEnd,t.call(this)}return this},r.prototype._ease=function(e,r,n){!1===n.animate||0===n.duration?(e(1),r()):(this._easeStart=t.default$2.now(),this._easeOptions=n,this._onEaseFrame=e,this._onEaseEnd=r,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))},r.prototype._renderFrameCallback=function(){var e=Math.min((t.default$2.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},r.prototype._normalizeBearing=function(e,r){e=t.wrap(e,-180,180);var n=Math.abs(e-r);return Math.abs(e-360-r)180?-360:r<-180?360:0}},r}(t.Evented),Vr=function(e){void 0===e&&(e={}),this.options=e,t.bindAll(["_updateEditLink","_updateData","_updateCompact"],this)};Vr.prototype.getDefaultPosition=function(){return"bottom-right"},Vr.prototype.onAdd=function(t){var e=this.options&&this.options.compact;return this._map=t,this._container=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),e&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===e&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container},Vr.prototype.onRemove=function(){r.remove(this._container),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0},Vr.prototype._updateEditLink=function(){var t=this._editLink;t||(t=this._editLink=this._container.querySelector(".mapbox-improve-map"));var e=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:h.ACCESS_TOKEN}];if(t){var r=e.reduce(function(t,r,n){return r.value&&(t+=r.key+"="+r.value+(n=0)return!1;return!0})).length?(this._container.innerHTML=t.join(" | "),this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null}},Vr.prototype._updateCompact=function(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact")};var Nr=function(){t.bindAll(["_updateLogo"],this),t.bindAll(["_updateCompact"],this)};Nr.prototype.onAdd=function(t){this._map=t,this._container=r.create("div","mapboxgl-ctrl");var e=r.create("a","mapboxgl-ctrl-logo");return e.target="_blank",e.href="https://www.mapbox.com/",e.setAttribute("aria-label","Mapbox logo"),e.setAttribute("rel","noopener"),this._container.appendChild(e),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container},Nr.prototype.onRemove=function(){r.remove(this._container),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)},Nr.prototype.getDefaultPosition=function(){return"bottom-left"},Nr.prototype._updateLogo=function(t){t&&"metadata"!==t.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")},Nr.prototype._logoRequired=function(){if(this._map.style){var t=this._map.style.sourceCaches;for(var e in t)if(t[e].getSource().mapbox_logo)return!0;return!1}},Nr.prototype._updateCompact=function(){var t=this._container.children;if(t.length){var e=t[0];this._map.getCanvasContainer().offsetWidth<250?e.classList.add("mapboxgl-compact"):e.classList.remove("mapboxgl-compact")}};var jr=function(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1};jr.prototype.add=function(t){var e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e},jr.prototype.remove=function(t){for(var e=this._currentlyRunning,r=0,n=e?this._queue.concat(e):this._queue;re.maxZoom)throw new Error("maxZoom must be greater than minZoom");var i=new xr(e.minZoom,e.maxZoom,e.renderWorldCopies);n.call(this,i,e),this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._renderTaskQueue=new jr;var o=e.transformRequest;if(this._transformRequest=o?function(t,e){return o(t,e)||{url:t}}:function(t){return{url:t}},"string"==typeof e.container){var a=t.default$1.document.getElementById(e.container);if(!a)throw new Error("Container '"+e.container+"' not found.");this._container=a}else{if(!(e.container instanceof $r))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),t.bindAll(["_onWindowOnline","_onWindowResize","_contextLost","_contextRestored","_update","_render","_onData","_onDataLoading"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");this.on("move",this._update.bind(this,!1)),this.on("zoom",this._update.bind(this,!0)),void 0!==t.default$1&&(t.default$1.addEventListener("online",this._onWindowOnline,!1),t.default$1.addEventListener("resize",this._onWindowResize,!1)),function(t,e){var n=t.getCanvasContainer(),i=null,o=!1,a=null;for(var s in Or)t[s]=new Or[s](t,e),e.interactive&&e[s]&&t[s].enable(e[s]);r.addEventListener(n,"mouseout",function(e){t.fire(new Er("mouseout",t,e))}),r.addEventListener(n,"mousedown",function(i){o=!0,a=r.mousePos(n,i);var s=new Er("mousedown",t,i);t.fire(s),s.defaultPrevented||(e.interactive&&!t.doubleClickZoom.isActive()&&t.stop(),t.boxZoom.onMouseDown(i),t.boxZoom.isActive()||t.dragPan.isActive()||t.dragRotate.onMouseDown(i),t.boxZoom.isActive()||t.dragRotate.isActive()||t.dragPan.onMouseDown(i))}),r.addEventListener(n,"mouseup",function(e){var r=t.dragRotate.isActive();i&&!r&&t.fire(new Er("contextmenu",t,i)),i=null,o=!1,t.fire(new Er("mouseup",t,e))}),r.addEventListener(n,"mousemove",function(e){if(!t.dragPan.isActive()&&!t.dragRotate.isActive()){for(var r=e.target;r&&r!==n;)r=r.parentNode;r===n&&t.fire(new Er("mousemove",t,e))}}),r.addEventListener(n,"mouseover",function(e){for(var r=e.target;r&&r!==n;)r=r.parentNode;r===n&&t.fire(new Er("mouseover",t,e))}),r.addEventListener(n,"touchstart",function(r){var n=new Sr("touchstart",t,r);t.fire(n),n.defaultPrevented||(e.interactive&&t.stop(),t.boxZoom.isActive()||t.dragRotate.isActive()||t.dragPan.onTouchStart(r),t.touchZoomRotate.onStart(r),t.doubleClickZoom.onTouchStart(n))},{passive:!1}),r.addEventListener(n,"touchmove",function(e){t.fire(new Sr("touchmove",t,e))},{passive:!1}),r.addEventListener(n,"touchend",function(e){t.fire(new Sr("touchend",t,e))}),r.addEventListener(n,"touchcancel",function(e){t.fire(new Sr("touchcancel",t,e))}),r.addEventListener(n,"click",function(e){r.mousePos(n,e).equals(a)&&t.fire(new Er("click",t,e))}),r.addEventListener(n,"dblclick",function(e){var r=new Er("dblclick",t,e);t.fire(r),r.defaultPrevented||t.doubleClickZoom.onDblClick(r)}),r.addEventListener(n,"contextmenu",function(e){var r=t.dragRotate.isActive();o||r?o&&(i=e):t.fire(new Er("contextmenu",t,e)),e.preventDefault()}),r.addEventListener(n,"wheel",function(e){var r=new Tr("wheel",t,e);t.fire(r),r.defaultPrevented||t.scrollZoom.onWheel(e)},{passive:!1})}(this,e),this._hash=e.hash&&(new wr).addTo(this),this._hash&&this._hash._onHashChange()||this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),this.resize(),e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new Vr),this.addControl(new Nr,e.logoPosition),this.on("style.load",function(){this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",this._onData),this.on("dataloading",this._onDataLoading)}n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i;var o={showTileBoundaries:{configurable:!0},showCollisionBoxes:{configurable:!0},showOverdrawInspector:{configurable:!0},repaint:{configurable:!0},vertices:{configurable:!0}};return i.prototype.addControl=function(t,e){void 0===e&&t.getDefaultPosition&&(e=t.getDefaultPosition()),void 0===e&&(e="top-right");var r=t.onAdd(this),n=this._controlPositions[e];return-1!==e.indexOf("bottom")?n.insertBefore(r,n.firstChild):n.appendChild(r),this},i.prototype.removeControl=function(t){return t.onRemove(this),this},i.prototype.resize=function(e){var r=this._containerDimensions(),n=r[0],i=r[1];return this._resizeCanvas(n,i),this.transform.resize(n,i),this.painter.resize(n,i),this.fire(new t.Event("movestart",e)).fire(new t.Event("move",e)).fire(new t.Event("resize",e)).fire(new t.Event("moveend",e))},i.prototype.getBounds=function(){var e=new B(this.transform.pointLocation(new t.default(0,this.transform.height)),this.transform.pointLocation(new t.default(this.transform.width,0)));return(this.transform.angle||this.transform.pitch)&&(e.extend(this.transform.pointLocation(new t.default(this.transform.size.x,0))),e.extend(this.transform.pointLocation(new t.default(0,this.transform.size.y)))),e},i.prototype.getMaxBounds=function(){return this.transform.latRange&&2===this.transform.latRange.length&&this.transform.lngRange&&2===this.transform.lngRange.length?new B([this.transform.lngRange[0],this.transform.latRange[0]],[this.transform.lngRange[1],this.transform.latRange[1]]):null},i.prototype.setMaxBounds=function(t){if(t){var e=B.convert(t);this.transform.lngRange=[e.getWest(),e.getEast()],this.transform.latRange=[e.getSouth(),e.getNorth()],this.transform._constrain(),this._update()}else null==t&&(this.transform.lngRange=null,this.transform.latRange=null,this._update());return this},i.prototype.setMinZoom=function(t){if((t=null==t?0:t)>=0&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")},i.prototype.getRenderWorldCopies=function(){return this.transform.renderWorldCopies},i.prototype.setRenderWorldCopies=function(t){return this.transform.renderWorldCopies=t,this._update(),this},i.prototype.getMaxZoom=function(){return this.transform.maxZoom},i.prototype.project=function(t){return this.transform.locationPoint(R.convert(t))},i.prototype.unproject=function(e){return this.transform.pointLocation(t.default.convert(e))},i.prototype.isMoving=function(){return this._moving||this.dragPan.isActive()||this.dragRotate.isActive()||this.scrollZoom.isActive()},i.prototype.isZooming=function(){return this._zooming||this.scrollZoom.isActive()},i.prototype.isRotating=function(){return this._rotating||this.dragRotate.isActive()},i.prototype.on=function(t,e,r){var i,o=this;if(void 0===r)return n.prototype.on.call(this,t,e);var a=function(){if("mouseenter"===t||"mouseover"===t){var n=!1;return{layer:e,listener:r,delegates:{mousemove:function(i){var a=o.getLayer(e)?o.queryRenderedFeatures(i.point,{layers:[e]}):[];a.length?n||(n=!0,r.call(o,new Er(t,o,i.originalEvent,{features:a}))):n=!1},mouseout:function(){n=!1}}}}if("mouseleave"===t||"mouseout"===t){var a=!1;return{layer:e,listener:r,delegates:{mousemove:function(n){(o.getLayer(e)?o.queryRenderedFeatures(n.point,{layers:[e]}):[]).length?a=!0:a&&(a=!1,r.call(o,new Er(t,o,n.originalEvent)))},mouseout:function(e){a&&(a=!1,r.call(o,new Er(t,o,e.originalEvent)))}}}}return{layer:e,listener:r,delegates:(i={},i[t]=function(t){var n=o.getLayer(e)?o.queryRenderedFeatures(t.point,{layers:[e]}):[];n.length&&(t.features=n,r.call(o,t),delete t.features)},i)}}();for(var s in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(a),a.delegates)o.on(s,a.delegates[s]);return this},i.prototype.off=function(t,e,r){if(void 0===r)return n.prototype.off.call(this,t,e);if(this._delegatedListeners&&this._delegatedListeners[t])for(var i=this._delegatedListeners[t],o=0;o180;){var a=r.locationPoint(t);if(a.x>=0&&a.y>=0&&a.x<=r.width&&a.y<=r.height)break;t.lng>r.center.lng?t.lng-=360:t.lng+=360}return t}Xr.prototype._rotateCompassArrow=function(){var t="rotate("+this._map.transform.angle*(180/Math.PI)+"deg)";this._compassArrow.style.transform=t},Xr.prototype.onAdd=function(t){return this._map=t,this.options.showCompass&&(this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new zr(t,{button:"left",element:this._compass}),r.addEventListener(this._compass,"mousedown",this._handler.onMouseDown),this._handler.enable()),this._container},Xr.prototype.onRemove=function(){r.remove(this._container),this.options.showCompass&&(this._map.off("rotate",this._rotateCompassArrow),r.removeEventListener(this._compass,"mousedown",this._handler.onMouseDown),this._handler.disable(),delete this._handler),delete this._map},Xr.prototype._createButton=function(t,e,n){var i=r.create("button",t,this._container);return i.type="button",i.setAttribute("aria-label",e),i.addEventListener("click",n),i};var Kr={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function Jr(t,e,r){var n=t.classList;for(var i in Kr)n.remove("mapboxgl-"+r+"-anchor-"+i);n.add("mapboxgl-"+r+"-anchor-"+e)}var Yr,Qr=function(e){function n(n){if(e.call(this),(arguments[0]instanceof t.default$1.HTMLElement||2===arguments.length)&&(n=t.extend({element:n},arguments[1])),t.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick"],this),this._anchor=n&&n.anchor||"center",this._color=n&&n.color||"#3FB1CE",this._draggable=n&&n.draggable||!1,this._state="inactive",n&&n.element)this._element=n.element,this._offset=t.default.convert(n&&n.offset||[0,0]);else{this._defaultMarker=!0,this._element=r.create("div");var i=r.createNS("http://www.w3.org/2000/svg","svg");i.setAttributeNS(null,"height","41px"),i.setAttributeNS(null,"width","27px"),i.setAttributeNS(null,"viewBox","0 0 27 41");var o=r.createNS("http://www.w3.org/2000/svg","g");o.setAttributeNS(null,"stroke","none"),o.setAttributeNS(null,"stroke-width","1"),o.setAttributeNS(null,"fill","none"),o.setAttributeNS(null,"fill-rule","evenodd");var a=r.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"fill-rule","nonzero");var s=r.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"transform","translate(3.0, 29.0)"),s.setAttributeNS(null,"fill","#000000");for(var l=0,u=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];l5280?an(e,u,p/5280,"mi"):an(e,u,p,"ft")}else r&&"nautical"===r.unit?an(e,u,h/1852,"nm"):an(e,u,h,"m")}function an(t,e,r,n){var i,o,a,s=(i=r,(o=Math.pow(10,(""+Math.floor(i)).length-1))*(a=(a=i/o)>=10?10:a>=5?5:a>=3?3:a>=2?2:1)),l=s/r;"m"===n&&s>=1e3&&(s/=1e3,n="km"),t.style.width=e*l+"px",t.innerHTML=s+n}nn.prototype.getDefaultPosition=function(){return"bottom-left"},nn.prototype._onMove=function(){on(this._map,this._container,this.options)},nn.prototype.onAdd=function(t){return this._map=t,this._container=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container},nn.prototype.onRemove=function(){r.remove(this._container),this._map.off("move",this._onMove),this._map=void 0},nn.prototype.setUnit=function(t){this.options.unit=t,on(this._map,this._container,this.options)};var sn=function(){this._fullscreen=!1,t.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in t.default$1.document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in t.default$1.document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in t.default$1.document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in t.default$1.document&&(this._fullscreenchange="MSFullscreenChange"),this._className="mapboxgl-ctrl"};sn.prototype.onAdd=function(e){return this._map=e,this._mapContainer=this._map.getContainer(),this._container=r.create("div",this._className+" mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._container.style.display="none",t.warnOnce("This device does not support fullscreen mode.")),this._container},sn.prototype.onRemove=function(){r.remove(this._container),this._map=null,t.default$1.document.removeEventListener(this._fullscreenchange,this._changeIcon)},sn.prototype._checkFullscreenSupport=function(){return!!(t.default$1.document.fullscreenEnabled||t.default$1.document.mozFullScreenEnabled||t.default$1.document.msFullscreenEnabled||t.default$1.document.webkitFullscreenEnabled)},sn.prototype._setupUI=function(){var e=this._fullscreenButton=r.create("button",this._className+"-icon "+this._className+"-fullscreen",this._container);e.setAttribute("aria-label","Toggle fullscreen"),e.type="button",this._fullscreenButton.addEventListener("click",this._onClickFullscreen),t.default$1.document.addEventListener(this._fullscreenchange,this._changeIcon)},sn.prototype._isFullscreen=function(){return this._fullscreen},sn.prototype._changeIcon=function(){(t.default$1.document.fullscreenElement||t.default$1.document.mozFullScreenElement||t.default$1.document.webkitFullscreenElement||t.default$1.document.msFullscreenElement)===this._mapContainer!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle(this._className+"-shrink"),this._fullscreenButton.classList.toggle(this._className+"-fullscreen"))},sn.prototype._onClickFullscreen=function(){this._isFullscreen()?t.default$1.document.exitFullscreen?t.default$1.document.exitFullscreen():t.default$1.document.mozCancelFullScreen?t.default$1.document.mozCancelFullScreen():t.default$1.document.msExitFullscreen?t.default$1.document.msExitFullscreen():t.default$1.document.webkitCancelFullScreen&&t.default$1.document.webkitCancelFullScreen():this._mapContainer.requestFullscreen?this._mapContainer.requestFullscreen():this._mapContainer.mozRequestFullScreen?this._mapContainer.mozRequestFullScreen():this._mapContainer.msRequestFullscreen?this._mapContainer.msRequestFullscreen():this._mapContainer.webkitRequestFullscreen&&this._mapContainer.webkitRequestFullscreen()};var ln={closeButton:!0,closeOnClick:!0,className:""},un=function(e){function n(r){e.call(this),this.options=t.extend(Object.create(ln),r),t.bindAll(["_update","_onClickClose"],this)}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.addTo=function(e){return this._map=e,this._map.on("move",this._update),this.options.closeOnClick&&this._map.on("click",this._onClickClose),this._update(),this.fire(new t.Event("open")),this},n.prototype.isOpen=function(){return!!this._map},n.prototype.remove=function(){return this._content&&r.remove(this._content),this._container&&(r.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("click",this._onClickClose),delete this._map),this.fire(new t.Event("close")),this},n.prototype.getLngLat=function(){return this._lngLat},n.prototype.setLngLat=function(t){return this._lngLat=R.convert(t),this._pos=null,this._update(),this},n.prototype.setText=function(e){return this.setDOMContent(t.default$1.document.createTextNode(e))},n.prototype.setHTML=function(e){var r,n=t.default$1.document.createDocumentFragment(),i=t.default$1.document.createElement("body");for(i.innerHTML=e;r=i.firstChild;)n.appendChild(r);return this.setDOMContent(n)},n.prototype.setDOMContent=function(t){return this._createContent(),this._content.appendChild(t),this._update(),this},n.prototype._createContent=function(){this._content&&r.remove(this._content),this._content=r.create("div","mapboxgl-popup-content",this._container),this.options.closeButton&&(this._closeButton=r.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClickClose))},n.prototype._update=function(){var e=this;if(this._map&&this._lngLat&&this._content){this._container||(this._container=r.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=r.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(function(t){return e._container.classList.add(t)})),this._map.transform.renderWorldCopies&&(this._lngLat=Hr(this._lngLat,this._pos,this._map.transform));var n=this._pos=this._map.project(this._lngLat),i=this.options.anchor,o=function e(r){if(r){if("number"==typeof r){var n=Math.round(Math.sqrt(.5*Math.pow(r,2)));return{center:new t.default(0,0),top:new t.default(0,r),"top-left":new t.default(n,n),"top-right":new t.default(-n,n),bottom:new t.default(0,-r),"bottom-left":new t.default(n,-n),"bottom-right":new t.default(-n,-n),left:new t.default(r,0),right:new t.default(-r,0)}}if(r instanceof t.default||Array.isArray(r)){var i=t.default.convert(r);return{center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return{center:t.default.convert(r.center||[0,0]),top:t.default.convert(r.top||[0,0]),"top-left":t.default.convert(r["top-left"]||[0,0]),"top-right":t.default.convert(r["top-right"]||[0,0]),bottom:t.default.convert(r.bottom||[0,0]),"bottom-left":t.default.convert(r["bottom-left"]||[0,0]),"bottom-right":t.default.convert(r["bottom-right"]||[0,0]),left:t.default.convert(r.left||[0,0]),right:t.default.convert(r.right||[0,0])}}return e(new t.default(0,0))}(this.options.offset);if(!i){var a,s=this._container.offsetWidth,l=this._container.offsetHeight;a=n.y+o.bottom.ythis._map.transform.height-l?["bottom"]:[],n.xthis._map.transform.width-s/2&&a.push("right"),i=0===a.length?"bottom":a.join("-")}var u=n.add(o[i]).round();r.setTransform(this._container,Kr[i]+" translate("+u.x+"px,"+u.y+"px)"),Jr(this._container,i,"popup")}},n.prototype._onClickClose=function(){this.remove()},n}(t.Evented),cn={version:"0.46.0",supported:e,workerCount:Math.max(Math.floor(t.default$2.hardwareConcurrency/2),1),setRTLTextPlugin:t.setRTLTextPlugin,Map:Zr,NavigationControl:Xr,GeolocateControl:en,AttributionControl:Vr,ScaleControl:nn,FullscreenControl:sn,Popup:un,Marker:Qr,Style:Ve,LngLat:R,LngLatBounds:B,Point:t.default,Evented:t.Evented,config:h,get accessToken(){return h.ACCESS_TOKEN},set accessToken(t){h.ACCESS_TOKEN=t},workerUrl:""};return cn}),r}),function(t){"use strict";var e=".dropdown-backdrop",r='[data-toggle="tsml-dropdown"]',n=function(e){t(e).on("click.bs.dropdown",this.toggle)};function i(e){var r=e.attr("data-target");r||(r=(r=e.attr("href"))&&/#[A-Za-z]/.test(r)&&r.replace(/.*(?=#[^\s]*$)/,""));var n=r&&t(r);return n&&n.length?n:e.parent()}function o(n){n&&3===n.which||(t(e).remove(),t(r).each(function(){var e=t(this),r=i(e),o={relatedTarget:this};r.hasClass("open")&&(n&&"click"==n.type&&/input|textarea/i.test(n.target.tagName)&&t.contains(r[0],n.target)||(r.trigger(n=t.Event("hide.bs.dropdown",o)),n.isDefaultPrevented()||(e.attr("aria-expanded","false"),r.removeClass("open").trigger(t.Event("hidden.bs.dropdown",o)))))}))}n.VERSION="3.3.7",n.prototype.toggle=function(e){var r=t(this);if(!r.is(".disabled, :disabled")){var n=i(r),a=n.hasClass("open");if(o(),!a){"ontouchstart"in document.documentElement&&!n.closest(".navbar-nav").length&&t(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(t(this)).on("click",o);var s={relatedTarget:this};if(n.trigger(e=t.Event("show.bs.dropdown",s)),e.isDefaultPrevented())return;r.trigger("focus").attr("aria-expanded","true"),n.toggleClass("open").trigger(t.Event("shown.bs.dropdown",s))}return!1}},n.prototype.keydown=function(e){if(/(38|40|27|32)/.test(e.which)&&!/input|textarea/i.test(e.target.tagName)){var n=t(this);if(e.preventDefault(),e.stopPropagation(),!n.is(".disabled, :disabled")){var o=i(n),a=o.hasClass("open");if(!a&&27!=e.which||a&&27==e.which)return 27==e.which&&o.find(r).trigger("focus"),n.trigger("click");var s=o.find(".dropdown-menu li:not(.disabled):visible a");if(s.length){var l=s.index(e.target);38==e.which&&l>0&&l--,40==e.which&&l'),searchIcon=window.btoa('');else if(tsml.google_maps_key){if("object"!=typeof google)return void console.warn("google key present but google script not ready");mapMode="google",tsmlmap||(tsmlmap=new google.maps.Map(document.getElementById("map"),{disableDefaultUI:!0,scrollwheel:t,zoomControl:!0})),infowindow=new google.maps.InfoWindow,bounds=new google.maps.LatLngBounds}setMapMarkers(e,r)}function formatAddress(t,e){if(!t)return"";if(t=t.split(", "),e)return t[0];if("USA"==t[t.length-1]){t.pop();var r=t.pop();t[t.length-1]+=", "+r}return t.join("
")}function formatLink(t,e,r){if(!t)return e;if(location.search){for(var n=location.search.substr(1).split("&"),i=[],o=0;o'+e+""}function removeSearchMarker(){searchLocation=null,"object"==typeof searchMarker&&searchMarker&&(searchMarker.setMap(null),searchMarker=null)}function setMapBounds(){if("google"==mapMode){if(markers.length>1)tsmlmap.fitBounds(bounds);else if(1==markers.length){var t=bounds.getCenter();markers[0].getClickable()?(tsmlmap.setCenter({lat:t.lat()+.0025,lng:t.lng()}),google.maps.event.trigger(markers[0],"click")):tsmlmap.setCenter({lat:t.lat(),lng:t.lng()}),tsmlmap.setZoom(15)}}else"mapbox"==mapMode&&(markers.length>1?tsmlmap.fitBounds([[bounds.west,bounds.south],[bounds.east,bounds.north]],{duration:0,padding:100}):1==markers.length&&(markers[0].getPopup()?(tsmlmap.setZoom(14).setCenter([bounds.east,bounds.north+.0025]),markers[0].togglePopup()):tsmlmap.setZoom(14).setCenter([bounds.east,bounds.north])))}function setMapMarker(t,e,r){if(e.lat||e.lng){var n;if("google"==mapMode)n=new google.maps.Marker({position:e,map:tsmlmap,title:t,icon:{path:"M20.5,0.5 c11.046,0,20,8.656,20,19.333c0,10.677-12.059,21.939-20,38.667c-5.619-14.433-20-27.989-20-38.667C0.5,9.156,9.454,0.5,20.5,0.5z",fillColor:"#f76458",fillOpacity:1,anchor:new google.maps.Point(40,50),strokeWeight:2,strokeColor:"#b3382c",scale:.6}}),r?google.maps.event.addListener(n,"click",function(t){return function(){infowindow.setContent('
'+r+"
"),infowindow.open(tsmlmap,t)}}(n)):n.setClickable(!1);else if("mapbox"==mapMode){var i=document.createElement("div");if(i.className="marker",i.style.backgroundImage="url(data:image/svg+xml;base64,"+locationIcon+")",i.style.width="26px",i.style.height="38.4px",n=new mapboxgl.Marker(i).setLngLat(e),r){var o=new mapboxgl.Popup({offset:25});o.setHTML(r),n.setPopup(o)}n.addTo(tsmlmap)}return n}}function setMapMarkers(t,e){if(markers.length){for(var r=0;r
"+formatAddress(o.formatted_address)+"
",o.directions&&o.directions_url&&(i+=''+o.directions+""),o.meetings&&o.meetings.length)){for(var a=null,s=0;s"),a=l.day,void 0!==tsml.days[a]&&(i+="
"+tsml.days[a]+"
"),i+="
"),i+="
"+l.time+"
"+formatLink(l.url,l.name,"post_type")+"
"}i+="
"}var u={lat:parseFloat(o.latitude),lng:parseFloat(o.longitude)},c=setMapMarker(o.name,u,i);"object"==typeof c&&c&&("google"==mapMode?(bounds.extend(c.position),"yes"===o.approximate&&c.setVisible(!1)):"mapbox"==mapMode&&((!bounds.north||u.lat>bounds.north)&&(bounds.north=u.lat),(!bounds.south||u.latbounds.east)&&(bounds.east=u.lng),(!bounds.west||u.lng-1&&(a=a+(a.indexOf("?")>-1?"&":"?")+"post_type=tsml_meeting"),window.history.pushState({path:a},"",a)}t("#meetings").attr("data-mode",i.mode),"search"==i.mode?(g(),removeSearchMarker(),c(i)):"location"==i.mode?(!function(){if(!r)return;r=!1,t('#meetings #search input[name="query"]').autocomplete("destroy")}(),i.query?(t("#search button i").removeClass().addClass("glyphicon glyphicon-refresh spinning"),t.getJSON(tsml.ajaxurl,{action:"tsml_geocode",address:i.query,nonce:tsml.nonce},function(e){tsml.debug&&console.log("doSearch() location geocoded",e),t("#search button i").removeClass().addClass("glyphicon glyphicon-map-marker"),"error"==e.status?(removeSearchMarker(),f("loc_error")):(n.val(e.formatted_address),i.latitude=e.latitude,i.longitude=e.longitude,i.query="",searchLocation={latitude:i.latitude,longitude:i.longitude},c(i))})):f("loc_empty")):"me"==i.mode&&(i.query&&(t("#meetings #search input[name=query]").val(""),i.query=""),t("#search button i").removeClass().addClass("glyphicon glyphicon-refresh spinning"),navigator.geolocation?navigator.geolocation.getCurrentPosition(function(e){t("#search button i").removeClass().addClass("glyphicon glyphicon-user"),i.latitude=e.coords.latitude,i.longitude=e.coords.longitude,searchLocation={latitude:i.latitude,longitude:i.longitude},c(i)},function(){tsml.debug&&console.log("doSearch() didnt get location"),t("#search button i").removeClass().addClass("glyphicon glyphicon-user"),removeSearchMarker(),f("geo_error")},{enableHighAccuracy:!0,timeout:1e4,maximumAge:6e5}):(tsml.debug&&console.log("doSearch() no browser support for geo"),t("#search button i").removeClass().addClass("glyphicon glyphicon-user"),removeSearchMarker(),f("geo_error_browser")))}function c(e){for(var r in e.distance_units=tsml.distance_units,e.nonce=tsml.nonce,e)null!==e[r]&&void 0!==e[r]&&e[r].toString().length||delete e[r];tsml.debug&&console.log("getMeetings()",tsml.ajaxurl+"?"+t.param(e)),t.post(tsml.ajaxurl,e,function(r){if(tsml.debug&&console.log("getMeetings() received",r),"object"!=typeof r||null==r)t("#meetings").addClass("empty"),f("data_error");else if(r.length){t("#meetings").removeClass("empty"),f(),locations=[];var n=t("#meetings_tbody").html("");t.each(r,function(t,r){if(r.types||(r.types=[]),"object"==typeof tsml.flags)for(var i=-1!==r.types.indexOf("TC")&&-1!==r.types.indexOf("ONL"),o=0;o"+tsml.types[tsml.flags[o]]+"")}var s=[];for(o=0;o';for(o=0;o'+(void 0!==e.day||void 0===r.day?r.time_formatted:tsml.days[r.day]+""+r.time_formatted)+"";break;case"distance":u+=''+r.distance+" "+tsml.distance_units+"";break;case"name":u+=''+formatLink(r.url,r.name,"post_type")+"";break;case"location":u+=''+r.location+"";break;case"address":u+=''+formatAddress(r.formatted_address,tsml.street_only)+"";break;case"region":u+=''+(r.sub_region||r.region||"")+"";break;case"district":u+=''+(r.sub_district||r.district||"")+"";break;case"types":u+=''+s+""}n.append(u+"")}),d(),e.query&&"search"==e.mode&&t("#tsml td").not(".time").mark(e.query),"map"==e.view&&createMap(!0,locations,searchLocation),n.trigger("tsml_meetings_updated",{meetings:r,tbody:n})}else{if(e.query&&(void 0!==e.day||void 0!==e.region||void 0!==e.time||void 0!==e.type))return t("#day li").removeClass("active").first().addClass("active"),t("#time li").removeClass("active").first().addClass("active"),t("#region li").removeClass("active").first().addClass("active"),t("#type li").removeClass("active").first().addClass("active"),t("#day span.selected").html(t("#day li:first-child a").html()),t("#time span.selected").html(t("#time li:first-child a").html()),t("#region span.selected").html(t("#region li:first-child a").html()),t("#type span.selected").html(t("#type li:first-child a").html()),u();t("#meetings").addClass("empty"),f("no_meetings")}},"json")}function h(t){if(null==t)return"";t=(t=t.replace(/^\s+|\s+$/g,"")).toLowerCase();for(var e="àáäâèéëêìíïîòóöôùúüûñç·/_,:;",r=0,n=e.length;r]+>/gi,""],[/[&'"<>]+/g,""],[new RegExp("[\\/\\.    -    \\-֊־᐀᠆‐-―⸗⸚⸺⸻⹀〜〰゠︱︲﹘﹣-]","g"),"-"],[new RegExp("[^A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࢽऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛱ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢄᢇ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〆〱-〵〻〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿯ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞿꟂ-Ᶎꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭧꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ0-9²³¹¼-¾٠-٩۰-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൘-൞൦-൸෦-෯๐-๙໐-໙༠-༳၀-၉႐-႙፩-፼ᛮ-ᛰ០-៩៰-៹᠐-᠙᥆-᥏᧐-᧚᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙⁰⁴-⁹₀-₉⅐-ↂↅ-↉①-⒛⓪-⓿❶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-㉏㉑-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-꠵꣐-꣙꤀-꤉꧐-꧙꧰-꧹꩐-꩙꯰-꯹0-9̀-ͯ҃-҉֑-ׇֽֿׁׂׅׄؐ-ًؚ-ٰٟۖ-ۜ۟-۪ۤۧۨ-ܑۭܰ-݊ަ-ް߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣঁ-ঃ়া-ৄেৈো-্ৗৢৣ৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑੰੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣஂா-ூெ-ைொ-்ௗఀ-ఄా-ౄె-ైొ-్ౕౖౢౣಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣංඃ්ා-ුූෘ-ෟෲෳัิ-ฺ็-๎ັິ-ຼ່-ໍ༹༘༙༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏႚ-ႝ፝-፟ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝᠋-᠍ᢅᢆᢩᤠ-ᤫᤰ-᤻ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼᪰-᪾ᬀ-ᬄ᬴-᭄᭫-᭳ᮀ-ᮂᮡ-ᮭ᯦-᯳ᰤ-᰷᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷹᷻-᷿⃐-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꙯-꙲ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-ꣅ꣠-꣱ꣿꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀ꧥꨩ-ꨶꩃꩌꩍꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭ﬞ︀-️︠-︯-]+","g"),""],[/\-+/g,"-"],[/^\-|\-$/g,""]]);var e=document.createElement("textarea");e.innerHTML=t,t=e.value,a=window.tsml_sanitize_data;for(var r=0;re[0]?"asc"==i?1:-1:t[0]'+t+"")}).fail(function(t){r.removeClass("running"),n.find(".list-group").html('
  • '+tsml.strings.email_not_sent+"
  • ")}),r.addClass("running"),!1}}),t("#meetings table thead").on("click","th",function(){var e,r=t(this).attr("class");e=t(this).attr("data-sort")&&"asc"==t(this).attr("data-sort")?"desc":"asc",t("#meetings table thead th").removeAttr("data-sort"),t("#meetings table thead th."+r).attr("data-sort",e),d()}),t("#meetings .controls").on("submit","#search",function(){return y("search",n.val()),u(),!1}).on("click","div.expand",function(e){e.preventDefault(),e.stopPropagation(),t(this).next("ul.children").toggleClass("expanded"),t(this).toggleClass("expanded")}).on("click",".dropdown-menu a",function(e){e.preventDefault();var r=t(this).closest("div").attr("id");if("mode"==r)tsml.debug&&console.log("dropdown click search mode"),t("#mode li").removeClass("active"),t("#meetings").addClass("empty"),"search"==t(this).attr("data-id")?(n.prop("disabled",!1),t("#search button i").removeClass().addClass("glyphicon glyphicon-search")):"location"==t(this).attr("data-id")?(n.prop("disabled",!1),t("#search button i").removeClass().addClass("glyphicon glyphicon-map-marker"),f("loc_thinking")):"me"==t(this).attr("data-id")&&(n.prop("disabled",!0),t("#search button i").removeClass().addClass("glyphicon glyphicon-user"),f("geo_thinking")),n.attr("placeholder",t(this).text());else if("distance"==r)tsml.debug&&console.log("dropdown click distance"),t("#distance li").removeClass("active"),t("#distance span.selected").html(t(this).html()),y("distance",t(this).text());else if("region"==r){if(t(this).hasClass("switch")){tsml.debug&&console.log("dropdown click switching between region and district");var i=t(this).parent().hasClass("region")?"district":"region";return t(this).closest("#meetings").attr("tax-mode",i),void e.stopPropagation()}tsml.debug&&console.log("dropdown click region or district"),t("#region li").removeClass("active"),t("#region span.selected").html(t(this).html()),y("region",t(this).text())}else"day"==r?(tsml.debug&&console.log("dropdown click day"),t("#day li").removeClass("active"),t("#day span.selected").html(t(this).html()),y("day",t(this).text())):"time"==r?(tsml.debug&&console.log("dropdown click time"),t("#time li").removeClass("active"),t("#time span.selected").html(t(this).html()),y("time",t(this).text())):"type"==r&&(tsml.debug&&console.log("dropdown click type"),e.metaKey||t("#type li").removeClass("active"),y("type",t(this).text()));if(t(this).parent().toggleClass("active"),"type"==r)if(t("#type li.active a[data-id]").length){tsml.debug&&console.log("dropdown click "+t("#type li.active a[data-id]").length+" types selected");var o=[];t("#type li.active a[data-id]").each(function(){o.push(t(this).text())}),t("#type span.selected").html(o.join(" + "))}else tsml.debug&&console.log("dropdown click no types selected"),t("#type span.selected").html(t(this).text());var a="";t("#meetings #day li.active").index()&&(a+=t("#meetings #day span.selected").text()),t("#meetings #time li.active").index()&&(a+=" "+t("#meetings #time span.selected").text()),t("#meetings #type li.active").index()&&(a+=" "+t("#meetings #type span.selected").text()),a+=" "+tsml.program+" Meetings",t("#meetings #region li.active").index()&&(a+=" in "+t("#meetings #region span.selected").text()),document.title=a,t("#tsml #meetings .title h1").text(a),m(),u()}),t("#meetings #action .toggle-view").click(function(e){e.preventDefault();var r=t(this).attr("data-id");if(r!=t("#meetings").attr("data-view")&&(t("#meetings #action .toggle-view").toggleClass("active"),t("#meetings").attr("data-view",r),"map"==r&&createMap(!0,locations,searchLocation),history.pushState)){if(r==tsml.defaults.view)var n=v("tsml-view");else n=v("tsml-view",r);window.history.pushState({path:n},"",n)}}),t(window).resize(function(r){if(t("#meetings").hasClass("tsml_fullscreen")){var n=map.getCenter(),i=t(window).height()-79;e.hasClass("admin-bar")&&(i-=32),t("#map").css("height",i),google.maps.event.trigger(map,"resize"),map.setCenter(n)}}),t.widget("custom.autocomplete",t.ui.autocomplete,{_create:function(){this._super(),this.widget().menu("option","items","> :not(.ui-autocomplete-category)")},_renderItem:function(e,r){var n=new RegExp(t.ui.autocomplete.escapeRegex(this.term),"ig"),i=r.label.replace(n,""+this.term+"");return t("
  • ").attr("data-value",r.value).append(i).appendTo(e)},_renderMenu:function(e,r){var n=this,i="";t.each(r,function(t,r){var o;if(r.type!=i){const t=`${r.type}s`;e.append("
  • "+tsml.strings[t]+"
  • "),i=r.type}o=n._renderItemData(e,r),r.type&&o.attr("aria-label",r.type+" : "+r.value)})}})}); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],e):t.Mark=e(t.jQuery)}(this,function(t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},n=function(){function t(t,e){for(var r=0;r1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5e3;r(this,t),this.ctx=e,this.iframes=n,this.exclude=i,this.iframesTimeout=o}return n(t,[{key:"getContexts",value:function(){var t=[];return(void 0!==this.ctx&&this.ctx?NodeList.prototype.isPrototypeOf(this.ctx)?Array.prototype.slice.call(this.ctx):Array.isArray(this.ctx)?this.ctx:"string"==typeof this.ctx?Array.prototype.slice.call(document.querySelectorAll(this.ctx)):[this.ctx]:[]).forEach(function(e){var r=t.filter(function(t){return t.contains(e)}).length>0;-1!==t.indexOf(e)||r||t.push(e)}),t}},{key:"getIframeContents",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},n=void 0;try{var i=t.contentWindow;if(n=i.document,!i||!n)throw new Error("iframe inaccessible")}catch(t){r()}n&&e(n)}},{key:"isIframeBlank",value:function(t){var e="about:blank",r=t.getAttribute("src").trim();return t.contentWindow.location.href===e&&r!==e&&r}},{key:"observeIframeLoad",value:function(t,e,r){var n=this,i=!1,o=null,a=function a(){if(!i){i=!0,clearTimeout(o);try{n.isIframeBlank(t)||(t.removeEventListener("load",a),n.getIframeContents(t,e,r))}catch(t){r()}}};t.addEventListener("load",a),o=setTimeout(a,this.iframesTimeout)}},{key:"onIframeReady",value:function(t,e,r){try{"complete"===t.contentWindow.document.readyState?this.isIframeBlank(t)?this.observeIframeLoad(t,e,r):this.getIframeContents(t,e,r):this.observeIframeLoad(t,e,r)}catch(t){r()}}},{key:"waitForIframes",value:function(t,e){var r=this,n=0;this.forEachIframe(t,function(){return!0},function(t){n++,r.waitForIframes(t.querySelector("html"),function(){--n||e()})},function(t){t||e()})}},{key:"forEachIframe",value:function(e,r,n){var i=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){},a=e.querySelectorAll("iframe"),s=a.length,l=0;a=Array.prototype.slice.call(a);var u=function(){--s<=0&&o(l)};s||u(),a.forEach(function(e){t.matches(e,i.exclude)?u():i.onIframeReady(e,function(t){r(e)&&(l++,n(t)),u()},u)})}},{key:"createIterator",value:function(t,e,r){return document.createNodeIterator(t,e,r,!1)}},{key:"createInstanceOnIframe",value:function(e){return new t(e.querySelector("html"),this.iframes)}},{key:"compareNodeIframe",value:function(t,e,r){if(t.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_PRECEDING){if(null===e)return!0;if(e.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_FOLLOWING)return!0}return!1}},{key:"getIteratorNode",value:function(t){var e=t.previousNode();return{prevNode:e,node:null===e?t.nextNode():t.nextNode()&&t.nextNode()}}},{key:"checkIframeFilter",value:function(t,e,r,n){var i=!1,o=!1;return n.forEach(function(t,e){t.val===r&&(i=e,o=t.handled)}),this.compareNodeIframe(t,e,r)?(!1!==i||o?!1===i||o||(n[i].handled=!0):n.push({val:r,handled:!0}),!0):(!1===i&&n.push({val:r,handled:!1}),!1)}},{key:"handleOpenIframes",value:function(t,e,r,n){var i=this;t.forEach(function(t){t.handled||i.getIframeContents(t.val,function(t){i.createInstanceOnIframe(t).forEachNode(e,r,n)})})}},{key:"iterateThroughNodes",value:function(t,e,r,n,i){for(var o,a=this,s=this.createIterator(e,t,n),l=[],u=[],c=void 0,h=void 0;o=void 0,o=a.getIteratorNode(s),h=o.prevNode,c=o.node;)this.iframes&&this.forEachIframe(e,function(t){return a.checkIframeFilter(c,h,t,l)},function(e){a.createInstanceOnIframe(e).forEachNode(t,function(t){return u.push(t)},n)}),u.push(c);u.forEach(function(t){r(t)}),this.iframes&&this.handleOpenIframes(l,t,r,n),i()}},{key:"forEachNode",value:function(t,e,r){var n=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){},o=this.getContexts(),a=o.length;a||i(),o.forEach(function(o){var s=function(){n.iterateThroughNodes(t,o,e,r,function(){--a<=0&&i()})};n.iframes?n.waitForIframes(o,s):s()})}}],[{key:"matches",value:function(t,e){var r="string"==typeof e?[e]:e,n=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.webkitMatchesSelector;if(n){var i=!1;return r.every(function(e){return!n.call(t,e)||(i=!0,!1)}),i}return!1}}]),t}(),a=function(){function t(e){r(this,t),this.ctx=e,this.ie=!1;var n=window.navigator.userAgent;(n.indexOf("MSIE")>-1||n.indexOf("Trident")>-1)&&(this.ie=!0)}return n(t,[{key:"log",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"debug",n=this.opt.log;this.opt.debug&&"object"===(void 0===n?"undefined":e(n))&&"function"==typeof n[r]&&n[r]("mark.js: "+t)}},{key:"escapeStr",value:function(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}},{key:"createRegExp",value:function(t){return"disabled"!==this.opt.wildcards&&(t=this.setupWildcardsRegExp(t)),t=this.escapeStr(t),Object.keys(this.opt.synonyms).length&&(t=this.createSynonymsRegExp(t)),(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(t=this.setupIgnoreJoinersRegExp(t)),this.opt.diacritics&&(t=this.createDiacriticsRegExp(t)),t=this.createMergedBlanksRegExp(t),(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(t=this.createJoinersRegExp(t)),"disabled"!==this.opt.wildcards&&(t=this.createWildcardsRegExp(t)),t=this.createAccuracyRegExp(t)}},{key:"createSynonymsRegExp",value:function(t){var e=this.opt.synonyms,r=this.opt.caseSensitive?"":"i",n=this.opt.ignoreJoiners||this.opt.ignorePunctuation.length?"\0":"";for(var i in e)if(e.hasOwnProperty(i)){var o=e[i],a="disabled"!==this.opt.wildcards?this.setupWildcardsRegExp(i):this.escapeStr(i),s="disabled"!==this.opt.wildcards?this.setupWildcardsRegExp(o):this.escapeStr(o);""!==a&&""!==s&&(t=t.replace(new RegExp("("+this.escapeStr(a)+"|"+this.escapeStr(s)+")","gm"+r),n+"("+this.processSynomyms(a)+"|"+this.processSynomyms(s)+")"+n))}return t}},{key:"processSynomyms",value:function(t){return(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(t=this.setupIgnoreJoinersRegExp(t)),t}},{key:"setupWildcardsRegExp",value:function(t){return(t=t.replace(/(?:\\)*\?/g,function(t){return"\\"===t.charAt(0)?"?":""})).replace(/(?:\\)*\*/g,function(t){return"\\"===t.charAt(0)?"*":""})}},{key:"createWildcardsRegExp",value:function(t){var e="withSpaces"===this.opt.wildcards;return t.replace(/\u0001/g,e?"[\\S\\s]?":"\\S?").replace(/\u0002/g,e?"[\\S\\s]*?":"\\S*")}},{key:"setupIgnoreJoinersRegExp",value:function(t){return t.replace(/[^(|)\\]/g,function(t,e,r){var n=r.charAt(e+1);return/[(|)\\]/.test(n)||""===n?t:t+"\0"})}},{key:"createJoinersRegExp",value:function(t){var e=[],r=this.opt.ignorePunctuation;return Array.isArray(r)&&r.length&&e.push(this.escapeStr(r.join(""))),this.opt.ignoreJoiners&&e.push("\\u00ad\\u200b\\u200c\\u200d"),e.length?t.split(/\u0000+/).join("["+e.join("")+"]*"):t}},{key:"createDiacriticsRegExp",value:function(t){var e=this.opt.caseSensitive?"":"i",r=this.opt.caseSensitive?["aàáảãạăằắẳẵặâầấẩẫậäåāą","AÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÄÅĀĄ","cçćč","CÇĆČ","dđď","DĐĎ","eèéẻẽẹêềếểễệëěēę","EÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ","iìíỉĩịîïī","IÌÍỈĨỊÎÏĪ","lł","LŁ","nñňń","NÑŇŃ","oòóỏõọôồốổỗộơởỡớờợöøō","OÒÓỎÕỌÔỒỐỔỖỘƠỞỠỚỜỢÖØŌ","rř","RŘ","sšśșş","SŠŚȘŞ","tťțţ","TŤȚŢ","uùúủũụưừứửữựûüůū","UÙÚỦŨỤƯỪỨỬỮỰÛÜŮŪ","yýỳỷỹỵÿ","YÝỲỶỸỴŸ","zžżź","ZŽŻŹ"]:["aàáảãạăằắẳẵặâầấẩẫậäåāąAÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÄÅĀĄ","cçćčCÇĆČ","dđďDĐĎ","eèéẻẽẹêềếểễệëěēęEÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ","iìíỉĩịîïīIÌÍỈĨỊÎÏĪ","lłLŁ","nñňńNÑŇŃ","oòóỏõọôồốổỗộơởỡớờợöøōOÒÓỎÕỌÔỒỐỔỖỘƠỞỠỚỜỢÖØŌ","rřRŘ","sšśșşSŠŚȘŞ","tťțţTŤȚŢ","uùúủũụưừứửữựûüůūUÙÚỦŨỤƯỪỨỬỮỰÛÜŮŪ","yýỳỷỹỵÿYÝỲỶỸỴŸ","zžżźZŽŻŹ"],n=[];return t.split("").forEach(function(i){r.every(function(r){if(-1!==r.indexOf(i)){if(n.indexOf(r)>-1)return!1;t=t.replace(new RegExp("["+r+"]","gm"+e),"["+r+"]"),n.push(r)}return!0})}),t}},{key:"createMergedBlanksRegExp",value:function(t){return t.replace(/[\s]+/gim,"[\\s]+")}},{key:"createAccuracyRegExp",value:function(t){var e=this,r=this.opt.accuracy,n="string"==typeof r?r:r.value,i="string"==typeof r?[]:r.limiters,o="";switch(i.forEach(function(t){o+="|"+e.escapeStr(t)}),n){case"partially":default:return"()("+t+")";case"complementary":return"()([^"+(o="\\s"+(o||this.escapeStr("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~¡¿")))+"]*"+t+"[^"+o+"]*)";case"exactly":return"(^|\\s"+o+")("+t+")(?=$|\\s"+o+")"}}},{key:"getSeparatedKeywords",value:function(t){var e=this,r=[];return t.forEach(function(t){e.opt.separateWordSearch?t.split(" ").forEach(function(t){t.trim()&&-1===r.indexOf(t)&&r.push(t)}):t.trim()&&-1===r.indexOf(t)&&r.push(t)}),{keywords:r.sort(function(t,e){return e.length-t.length}),length:r.length}}},{key:"isNumeric",value:function(t){return Number(parseFloat(t))==t}},{key:"checkRanges",value:function(t){var e=this;if(!Array.isArray(t)||"[object Object]"!==Object.prototype.toString.call(t[0]))return this.log("markRanges() will only accept an array of objects"),this.opt.noMatch(t),[];var r=[],n=0;return t.sort(function(t,e){return t.start-e.start}).forEach(function(t){var i=e.callNoMatchOnInvalidRanges(t,n),o=i.start,a=i.end;i.valid&&(t.start=o,t.length=a-o,r.push(t),n=a)}),r}},{key:"callNoMatchOnInvalidRanges",value:function(t,e){var r=void 0,n=void 0,i=!1;return t&&void 0!==t.start?(n=(r=parseInt(t.start,10))+parseInt(t.length,10),this.isNumeric(t.start)&&this.isNumeric(t.length)&&n-e>0&&n-r>0?i=!0:(this.log("Ignoring invalid or overlapping range: "+JSON.stringify(t)),this.opt.noMatch(t))):(this.log("Ignoring invalid range: "+JSON.stringify(t)),this.opt.noMatch(t)),{start:r,end:n,valid:i}}},{key:"checkWhitespaceRanges",value:function(t,e,r){var n=void 0,i=!0,o=r.length,a=e-o,s=parseInt(t.start,10)-a;return(n=(s=s>o?o:s)+parseInt(t.length,10))>o&&(n=o,this.log("End range automatically set to the max value of "+o)),s<0||n-s<0||s>o||n>o?(i=!1,this.log("Invalid range: "+JSON.stringify(t)),this.opt.noMatch(t)):""===r.substring(s,n).replace(/\s+/g,"")&&(i=!1,this.log("Skipping whitespace only range: "+JSON.stringify(t)),this.opt.noMatch(t)),{start:s,end:n,valid:i}}},{key:"getTextNodes",value:function(t){var e=this,r="",n=[];this.iterator.forEachNode(NodeFilter.SHOW_TEXT,function(t){n.push({start:r.length,end:(r+=t.textContent).length,node:t})},function(t){return e.matchesExclude(t.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},function(){t({value:r,nodes:n})})}},{key:"matchesExclude",value:function(t){return o.matches(t,this.opt.exclude.concat(["script","style","title","head","html"]))}},{key:"wrapRangeInTextNode",value:function(t,e,r){var n=this.opt.element?this.opt.element:"mark",i=t.splitText(e),o=i.splitText(r-e),a=document.createElement(n);return a.setAttribute("data-markjs","true"),this.opt.className&&a.setAttribute("class",this.opt.className),a.textContent=i.textContent,i.parentNode.replaceChild(a,i),o}},{key:"wrapRangeInMappedTextNode",value:function(t,e,r,n,i){var o=this;t.nodes.every(function(a,s){var l=t.nodes[s+1];if(void 0===l||l.start>e){if(!n(a.node))return!1;var u=e-a.start,c=(r>a.end?a.end:r)-a.start,h=t.value.substr(0,a.start),p=t.value.substr(c+a.start);if(a.node=o.wrapRangeInTextNode(a.node,u,c),t.value=h+p,t.nodes.forEach(function(e,r){r>=s&&(t.nodes[r].start>0&&r!==s&&(t.nodes[r].start-=c),t.nodes[r].end-=c)}),r-=c,i(a.node.previousSibling,a.start),!(r>a.end))return!1;e=a.end}return!0})}},{key:"wrapMatches",value:function(t,e,r,n,i){var o=this,a=0===e?0:e+1;this.getTextNodes(function(e){e.nodes.forEach(function(e){e=e.node;for(var i=void 0;null!==(i=t.exec(e.textContent))&&""!==i[a];)if(r(i[a],e)){var s=i.index;if(0!==a)for(var l=1;l(n=1))return n;for(;ro?r=i:n=i,i=.5*(n-r)+r}return i},c.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var h=function(t,e,r){this.column=t,this.row=e,this.zoom=r};h.prototype.clone=function(){return new h(this.column,this.row,this.zoom)},h.prototype.zoomTo=function(t){return this.clone()._zoomTo(t)},h.prototype.sub=function(t){return this.clone()._sub(t)},h.prototype._zoomTo=function(t){var e=Math.pow(2,t-this.zoom);return this.column*=e,this.row*=e,this.zoom=t,this},h.prototype._sub=function(t){return t=t.zoomTo(this.zoom),this.column-=t.column,this.row-=t.row,this};var p=f;function f(t,e){this.x=t,this.y=e}function d(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(var r=0;r0;)e[r]=arguments[r+1];for(var n=0,i=e;n(e.y-t.y)*(r.x-t.x)}function z(t){for(var e=0,r=0,n=t.length,i=n-1,o=void 0,a=void 0;r=200&&r.status<300&&r.response?e(null,{data:n,cacheControl:r.getResponseHeader("Cache-Control"),expires:r.getResponseHeader("Expires")}):e(new M(r.statusText,r.status,t.url))},r.send(),r};function D(t,e,r){r[t]&&-1!==r[t].indexOf(e)||(r[t]=r[t]||[],r[t].push(e))}function R(t,e,r){if(r&&r[t]){var n=r[t].indexOf(e);-1!==n&&r[t].splice(n,1)}}var B=function(t,e){void 0===e&&(e={}),v(this,e),this.type=t},O=function(t){function e(e,r){void 0===r&&(r={}),t.call(this,"error",v({error:e},r))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(B),F=function(){};F.prototype.on=function(t,e){return this._listeners=this._listeners||{},D(t,e,this._listeners),this},F.prototype.off=function(t,e){return R(t,e,this._listeners),R(t,e,this._oneTimeListeners),this},F.prototype.once=function(t,e){return this._oneTimeListeners=this._oneTimeListeners||{},D(t,e,this._oneTimeListeners),this},F.prototype.fire=function(t){"string"==typeof t&&(t=new B(t,arguments[1]||{}));var e=t.type;if(this.listens(e)){t.target=this;for(var r=0,n=this._listeners&&this._listeners[e]?this._listeners[e].slice():[];r0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)},F.prototype.setEventedParent=function(t,e){return this._eventedParent=t,this._eventedParentData=e,this};var V={$version:8,$root:{version:{required:!0,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"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.0511,180,85.0511]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.0511,180,85.0511]},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"},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.0511,180,85.0511]},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"},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},lineMetrics:{type:"boolean",default:!1}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{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_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"string",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":"line"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"string",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":"line"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function_stop:{type:"array",minimum:0,maximum:22,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},expression_name:{type:"enum",values:{let:{group:"Variable binding"},var:{group:"Variable binding"},literal:{group:"Types"},array:{group:"Types"},at:{group:"Lookup"},case:{group:"Decision"},match:{group:"Decision"},coalesce:{group:"Decision"},step:{group:"Ramps, scales, curves"},interpolate:{group:"Ramps, scales, curves"},ln2:{group:"Math"},pi:{group:"Math"},e:{group:"Math"},typeof:{group:"Types"},string:{group:"Types"},number:{group:"Types"},boolean:{group:"Types"},object:{group:"Types"},collator:{group:"Types"},"to-string":{group:"Types"},"to-number":{group:"Types"},"to-boolean":{group:"Types"},"to-rgba":{group:"Color"},"to-color":{group:"Types"},rgb:{group:"Color"},rgba:{group:"Color"},get:{group:"Lookup"},has:{group:"Lookup"},length:{group:"Lookup"},properties:{group:"Feature data"},"feature-state":{group:"Feature data"},"geometry-type":{group:"Feature data"},id:{group:"Feature data"},zoom:{group:"Zoom"},"heatmap-density":{group:"Heatmap"},"line-progress":{group:"Heatmap"},"+":{group:"Math"},"*":{group:"Math"},"-":{group:"Math"},"/":{group:"Math"},"%":{group:"Math"},"^":{group:"Math"},sqrt:{group:"Math"},log10:{group:"Math"},ln:{group:"Math"},log2:{group:"Math"},sin:{group:"Math"},cos:{group:"Math"},tan:{group:"Math"},asin:{group:"Math"},acos:{group:"Math"},atan:{group:"Math"},min:{group:"Math"},max:{group:"Math"},round:{group:"Math"},abs:{group:"Math"},ceil:{group:"Math"},floor:{group:"Math"},"==":{group:"Decision"},"!=":{group:"Decision"},">":{group:"Decision"},"<":{group:"Decision"},">=":{group:"Decision"},"<=":{group:"Decision"},all:{group:"Decision"},any:{group:"Decision"},"!":{group:"Decision"},"is-supported-script":{group:"String"},upcase:{group:"String"},downcase:{group:"String"},concat:{group:"String"},"resolved-locale":{group:"String"}}},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"string",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"string",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"string",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"string",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}}},N=function(t,e,r,n){this.message=(t?t+": ":"")+r,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__)};function j(t){var e=t.key,r=t.value;return r?[new N(e,r,"constants have been deprecated as of v8")]:[]}function U(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];for(var n=0,i=e;n":"value"===t.itemType.kind?"array":"array<"+e+">"}return t.kind}var nt=[W,X,H,K,J,Y,et(Q)];function it(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&!it(t.itemType,e.itemType)&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(var r=0,n=nt;r255?255:t}function i(t){return t<0?0:t>1?1:t}function o(t){return"%"===t[t.length-1]?n(parseFloat(t)/100*255):n(parseInt(t))}function a(t){return"%"===t[t.length-1]?i(parseFloat(t)/100):i(parseFloat(t))}function s(t,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?t+(e-t)*r*6:2*r<1?e:3*r<2?t+(e-t)*(2/3-r)*6:t}try{e.parseCSSColor=function(t){var e,i=t.replace(/ /g,"").toLowerCase();if(i in r)return r[i].slice();if("#"===i[0])return 4===i.length?(e=parseInt(i.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===i.length&&(e=parseInt(i.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var l=i.indexOf("("),u=i.indexOf(")");if(-1!==l&&u+1===i.length){var c=i.substr(0,l),h=i.substr(l+1,u-(l+1)).split(","),p=1;switch(c){case"rgba":if(4!==h.length)return null;p=a(h.pop());case"rgb":return 3!==h.length?null:[o(h[0]),o(h[1]),o(h[2]),p];case"hsla":if(4!==h.length)return null;p=a(h.pop());case"hsl":if(3!==h.length)return null;var f=(parseFloat(h[0])%360+360)%360/360,d=a(h[1]),m=a(h[2]),y=m<=.5?m*(d+1):m+d-m*d,g=2*m-y;return[n(255*s(g,y,f+1/3)),n(255*s(g,y,f)),n(255*s(g,y,f-1/3)),p];default:return null}}return null}}catch(t){}}).parseCSSColor,at=function(t,e,r,n){void 0===n&&(n=1),this.r=t,this.g=e,this.b=r,this.a=n};at.parse=function(t){if(t){if(t instanceof at)return t;if("string"==typeof t){var e=ot(t);if(e)return new at(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3])}}},at.prototype.toString=function(){var t=this.toArray(),e=t[0],r=t[1],n=t[2],i=t[3];return"rgba("+Math.round(e)+","+Math.round(r)+","+Math.round(n)+","+i+")"},at.prototype.toArray=function(){var t=this.r,e=this.g,r=this.b,n=this.a;return 0===n?[0,0,0,0]:[255*t/n,255*e/n,255*r/n,n]},at.black=new at(0,0,0,1),at.white=new at(1,1,1,1),at.transparent=new at(0,0,0,0);var st=function(t,e,r){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})};st.prototype.compare=function(t,e){return this.collator.compare(t,e)},st.prototype.resolvedLocale=function(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale};var lt=function(t,e,r){this.type=tt,this.locale=r,this.caseSensitive=t,this.diacriticSensitive=e};function ut(t,e,r,n){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:"Invalid rgba value ["+[t,e,r,n].join(", ")+"]: 'a' must be between 0 and 1.":"Invalid rgba value ["+("number"==typeof n?[t,e,r,n]:[t,e,r]).join(", ")+"]: 'r', 'g', and 'b' must be between 0 and 255."}function ct(t){if(null===t)return W;if("string"==typeof t)return H;if("boolean"==typeof t)return K;if("number"==typeof t)return X;if(t instanceof at)return J;if(t instanceof st)return tt;if(Array.isArray(t)){for(var e,r=t.length,n=0,i=t;n4)return e.error("Expected 1, 2, or 3 arguments, but found "+(t.length-1)+" instead.");var r,n;if(t.length>2){var i=t[1];if("string"!=typeof i||!(i in mt))return e.error('The item type argument of "array" must be one of string, number, boolean',1);r=mt[i]}else r=Q;if(t.length>3){if("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2]))return e.error('The length argument to "array" must be a positive integer literal',2);n=t[2]}var o=et(r,n),a=e.parse(t[t.length-1],t.length-1,Q);return a?new yt(o,a):null},yt.prototype.evaluate=function(t){var e=this.input.evaluate(t);if(it(this.type,ct(e)))throw new pt("Expected value to be of type "+rt(this.type)+", but found "+rt(ct(e))+" instead.");return e},yt.prototype.eachChild=function(t){t(this.input)},yt.prototype.possibleOutputs=function(){return this.input.possibleOutputs()},yt.prototype.serialize=function(){var t=["array"],e=this.type.itemType;if("string"===e.kind||"number"===e.kind||"boolean"===e.kind){t.push(e.kind);var r=this.type.N;"number"==typeof r&&t.push(r)}return t.push(this.input.serialize()),t};var gt={"to-number":X,"to-color":J},vt=function(t,e){this.type=t,this.args=e};vt.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");for(var r=t[0],n=gt[r],i=[],o=1;o4?"Invalid rbga value "+JSON.stringify(e)+": expected an array containing either three or four numeric values.":ut(e[0],e[1],e[2],e[3])))return new at(e[0]/255,e[1]/255,e[2]/255,e[3]);throw new pt(r||"Could not parse color from value '"+("string"==typeof e?e:JSON.stringify(e))+"'")}for(var a=null,s=0,l=this.args;s=0)return!1;var r=!0;return t.eachChild(function(t){r&&!St(t,e)&&(r=!1)}),r}bt.prototype.evaluate=function(t){return this._evaluate(t,this.args)},bt.prototype.eachChild=function(t){this.args.forEach(t)},bt.prototype.possibleOutputs=function(){return[void 0]},bt.prototype.serialize=function(){return[this.name].concat(this.args.map(function(t){return t.serialize()}))},bt.parse=function(t,e){var r=t[0],n=bt.definitions[r];if(!n)return e.error('Unknown expression "'+r+'". If you wanted a literal array, use ["literal", [...]].',0);for(var i=Array.isArray(n)?n[0]:n.type,o=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,a=o.filter(function(e){var r=e[0];return!Array.isArray(r)||r.length===t.length-1}),s=[],l=1;lr&&ee))throw new pt("Input is not a number.");o=a-1}}return Math.max(a-1,0)}kt.prototype.parse=function(t,e,r,n,i){return void 0===i&&(i={}),e?this.concat(e,r,n)._parse(t,i):this._parse(t,i)},kt.prototype._parse=function(t,e){if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');var r=t[0];if("string"!=typeof r)return this.error("Expression name must be a string, but found "+typeof r+' instead. If you wanted a literal array, use ["literal", [...]].',0),null;var n=this.registry[r];if(n){var i=n.parse(t,this);if(!i)return null;if(this.expectedType){var o=this.expectedType,a=i.type;if("string"!==o.kind&&"number"!==o.kind&&"boolean"!==o.kind&&"object"!==o.kind||"value"!==a.kind)if("array"===o.kind&&"value"===a.kind)e.omitTypeAnnotations||(i=new yt(o,i));else if("color"!==o.kind||"value"!==a.kind&&"string"!==a.kind){if(this.checkSubtype(this.expectedType,i.type))return null}else e.omitTypeAnnotations||(i=new vt(o,[i]));else e.omitTypeAnnotations||(i=new dt(o,[i]))}if(!(i instanceof ht)&&function t(e){if(e instanceof Tt)return t(e.boundExpression);if(e instanceof bt&&"error"===e.name)return!1;if(e instanceof lt)return!1;var r=e instanceof vt||e instanceof dt||e instanceof yt,n=!0;return e.eachChild(function(e){n=r?n&&t(e):n&&e instanceof ht}),!!n&&(wt(e)&&St(e,["zoom","heatmap-density","line-progress","is-supported-script"]))}(i)){var s=new xt;try{i=new ht(i.type,i.evaluate(s))}catch(t){return this.error(t.message),null}}return i}return this.error('Unknown expression "'+r+'". If you wanted a literal array, use ["literal", [...]].',0)}return void 0===t?this.error("'undefined' value invalid. Use null instead."):"object"==typeof t?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error("Expected an array, but found "+typeof t+" instead.")},kt.prototype.concat=function(t,e,r){var n="number"==typeof t?this.path.concat(t):this.path,i=r?this.scope.concat(r):this.scope;return new kt(this.registry,n,e||null,i,this.errors)},kt.prototype.error=function(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];var n=""+this.key+e.map(function(t){return"["+t+"]"}).join("");this.errors.push(new Z(n,t))},kt.prototype.checkSubtype=function(t,e){var r=it(t,e);return r&&this.error(r),r};var It=function(t,e,r){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(var n=0,i=r;n=s)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',u);var h=e.parse(l,c,o);if(!h)return null;o=o||h.type,i.push([s,h])}return new It(o,r,i)},It.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);var i=e.length;return n>=e[i-1]?r[i-1].evaluate(t):r[At(e,n)].evaluate(t)},It.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t};var zt=Ct;function Ct(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=r,this.p2y=n}function Mt(t,e,r){return t*(1-r)+e*r}Ct.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},Ct.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},Ct.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},Ct.prototype.solveCurveX=function(t,e){var r,n,i,o,a;for(void 0===e&&(e=1e-6),i=t,a=0;a<8;a++){if(o=this.sampleCurveX(i)-t,Math.abs(o)(n=1))return n;for(;ro?r=i:n=i,i=.5*(n-r)+r}return i},Ct.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var Pt=Object.freeze({number:Mt,color:function(t,e,r){return new at(Mt(t.r,e.r,r),Mt(t.g,e.g,r),Mt(t.b,e.b,r),Mt(t.a,e.a,r))},array:function(t,e,r){return t.map(function(t,n){return Mt(t,e[n],r)})}}),Lt=function(t,e,r,n){this.type=t,this.interpolation=e,this.input=r,this.labels=[],this.outputs=[];for(var i=0,o=n;i1}))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:a}}if(t.length-1<4)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(!(n=e.parse(n,2,X)))return null;var s=[],l=null;e.expectedType&&"value"!==e.expectedType.kind&&(l=e.expectedType);for(var u=0;u=c)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',p);var d=e.parse(h,f,l);if(!d)return null;l=l||d.type,s.push([c,d])}return"number"===l.kind||"color"===l.kind||"array"===l.kind&&"number"===l.itemType.kind&&"number"==typeof l.N?new Lt(l,r,n,s):e.error("Type "+rt(l)+" is not interpolatable.")},Lt.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);var i=e.length;if(n>=e[i-1])return r[i-1].evaluate(t);var o=At(e,n),a=e[o],s=e[o+1],l=Lt.interpolationFactor(this.interpolation,n,a,s),u=r[o].evaluate(t),c=r[o+1].evaluate(t);return Pt[this.type.kind.toLowerCase()](u,c,l)},Lt.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e=r.length)throw new pt("Array index out of bounds: "+e+" > "+(r.length-1)+".");if(e!==Math.floor(e))throw new pt("Array index must be an integer, but found "+e+" instead.");return r[e]},Ot.prototype.eachChild=function(t){t(this.index),t(this.input)},Ot.prototype.possibleOutputs=function(){return[void 0]},Ot.prototype.serialize=function(){return["at",this.index.serialize(),this.input.serialize()]};var Ft=function(t,e,r,n,i,o){this.inputType=t,this.type=e,this.input=r,this.cases=n,this.outputs=i,this.otherwise=o};Ft.parse=function(t,e){if(t.length<5)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if(t.length%2!=1)return e.error("Expected an even number of arguments.");var r,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);for(var i={},o=[],a=2;aNumber.MAX_SAFE_INTEGER)return u.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if("number"==typeof p&&Math.floor(p)!==p)return u.error("Numeric branch labels must be integer values.");if(r){if(u.checkSubtype(r,ct(p)))return null}else r=ct(p);if(void 0!==i[String(p)])return u.error("Branch labels must be unique.");i[String(p)]=o.length}var f=e.parse(l,a,n);if(!f)return null;n=n||f.type,o.push(f)}var d=e.parse(t[1],1,Q);if(!d)return null;var m=e.parse(t[t.length-1],t.length-1,n);return m?"value"!==d.type.kind&&e.concat(1).checkSubtype(r,d.type)?null:new Ft(r,n,d,i,o,m):null},Ft.prototype.evaluate=function(t){var e=this.input.evaluate(t);return(ct(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)},Ft.prototype.eachChild=function(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)},Ft.prototype.possibleOutputs=function(){return(t=[]).concat.apply(t,this.outputs.map(function(t){return t.possibleOutputs()})).concat(this.otherwise.possibleOutputs());var t},Ft.prototype.serialize=function(){for(var t=this,e=["match",this.input.serialize()],r=[],n={},i=0,o=Object.keys(this.cases).sort();in.evaluate(t)}function Jt(t,e){var r=e[0],n=e[1];return r.evaluate(t)<=n.evaluate(t)}function Yt(t,e){var r=e[0],n=e[1];return r.evaluate(t)>=n.evaluate(t)}function Qt(t){return{type:t}}function te(t){return{result:"success",value:t}}function ee(t){return{result:"error",value:t}}function re(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function ne(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function ie(t){return!!t.expression&&t.expression.interpolated}bt.register(Zt,{error:[{kind:"error"},[H],function(t,e){var r=e[0];throw new pt(r.evaluate(t))}],typeof:[H,[Q],function(t,e){return rt(ct(e[0].evaluate(t)))}],"to-string":[H,[Q],function(t,e){var r=e[0],n=typeof(r=r.evaluate(t));return null===r?"":"string"===n||"number"===n||"boolean"===n?String(r):r instanceof at?r.toString():JSON.stringify(r)}],"to-boolean":[K,[Q],function(t,e){var r=e[0];return Boolean(r.evaluate(t))}],"to-rgba":[et(X,4),[J],function(t,e){return e[0].evaluate(t).toArray()}],rgb:[J,[X,X,X],Gt],rgba:[J,[X,X,X,X],Gt],has:{type:K,overloads:[[[H],function(t,e){return Wt(e[0].evaluate(t),t.properties())}],[[H,Y],function(t,e){var r=e[0],n=e[1];return Wt(r.evaluate(t),n.evaluate(t))}]]},get:{type:Q,overloads:[[[H],function(t,e){return Xt(e[0].evaluate(t),t.properties())}],[[H,Y],function(t,e){var r=e[0],n=e[1];return Xt(r.evaluate(t),n.evaluate(t))}]]},"feature-state":[Q,[H],function(t,e){return Xt(e[0].evaluate(t),t.featureState||{})}],properties:[Y,[],function(t){return t.properties()}],"geometry-type":[H,[],function(t){return t.geometryType()}],id:[Q,[],function(t){return t.id()}],zoom:[X,[],function(t){return t.globals.zoom}],"heatmap-density":[X,[],function(t){return t.globals.heatmapDensity||0}],"line-progress":[X,[],function(t){return t.globals.lineProgress||0}],"+":[X,Qt(X),function(t,e){for(var r=0,n=0,i=e;n":[K,[H,Q],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],o=n.value;return typeof i==typeof o&&i>o}],"filter-id->":[K,[Q],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n>i}],"filter-<=":[K,[H,Q],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],o=n.value;return typeof i==typeof o&&i<=o}],"filter-id-<=":[K,[Q],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n<=i}],"filter->=":[K,[H,Q],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],o=n.value;return typeof i==typeof o&&i>=o}],"filter-id->=":[K,[Q],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n>=i}],"filter-has":[K,[Q],function(t,e){return e[0].value in t.properties()}],"filter-has-id":[K,[],function(t){return null!==t.id()}],"filter-type-in":[K,[et(H)],function(t,e){return e[0].value.indexOf(t.geometryType())>=0}],"filter-id-in":[K,[et(Q)],function(t,e){return e[0].value.indexOf(t.id())>=0}],"filter-in-small":[K,[H,et(Q)],function(t,e){var r=e[0];return e[1].value.indexOf(t.properties()[r.value])>=0}],"filter-in-large":[K,[H,et(Q)],function(t,e){var r=e[0],n=e[1];return function(t,e,r,n){for(;r<=n;){var i=r+n>>1;if(e[i]===t)return!0;e[i]>t?n=i-1:r=i+1}return!1}(t.properties()[r.value],n.value,0,n.value.length-1)}],">":{type:K,overloads:[[[X,X],Kt],[[H,H],Kt],[[H,H,tt],function(t,e){var r=e[0],n=e[1];return e[2].evaluate(t).compare(r.evaluate(t),n.evaluate(t))>0}]]},"<":{type:K,overloads:[[[X,X],Ht],[[H,H],Ht],[[H,H,tt],function(t,e){var r=e[0],n=e[1];return e[2].evaluate(t).compare(r.evaluate(t),n.evaluate(t))<0}]]},">=":{type:K,overloads:[[[X,X],Yt],[[H,H],Yt],[[H,H,tt],function(t,e){var r=e[0],n=e[1];return e[2].evaluate(t).compare(r.evaluate(t),n.evaluate(t))>=0}]]},"<=":{type:K,overloads:[[[X,X],Jt],[[H,H],Jt],[[H,H,tt],function(t,e){var r=e[0],n=e[1];return e[2].evaluate(t).compare(r.evaluate(t),n.evaluate(t))<=0}]]},all:{type:K,overloads:[[[K,K],function(t,e){var r=e[0],n=e[1];return r.evaluate(t)&&n.evaluate(t)}],[Qt(K),function(t,e){for(var r=0,n=e;rhe?Math.pow(t,1/3):t/ce+le}function me(t){return t>ue?t*t*t:ce*(t-le)}function ye(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function ge(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function ve(t){var e=ge(t.r),r=ge(t.g),n=ge(t.b),i=de((.4124564*e+.3575761*r+.1804375*n)/oe),o=de((.2126729*e+.7151522*r+.072175*n)/ae);return{l:116*o-16,a:500*(i-o),b:200*(o-de((.0193339*e+.119192*r+.9503041*n)/se)),alpha:t.a}}function _e(t){var e=(t.l+16)/116,r=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=ae*me(e),r=oe*me(r),n=se*me(n),new at(ye(3.2404542*r-1.5371385*e-.4985314*n),ye(-.969266*r+1.8760108*e+.041556*n),ye(.0556434*r-.2040259*e+1.0572252*n),t.alpha)}var xe={forward:ve,reverse:_e,interpolate:function(t,e,r){return{l:Mt(t.l,e.l,r),a:Mt(t.a,e.a,r),b:Mt(t.b,e.b,r),alpha:Mt(t.alpha,e.alpha,r)}}},be={forward:function(t){var e=ve(t),r=e.l,n=e.a,i=e.b,o=Math.atan2(i,n)*fe;return{h:o<0?o+360:o,c:Math.sqrt(n*n+i*i),l:r,alpha:t.a}},reverse:function(t){var e=t.h*pe,r=t.c;return _e({l:t.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:t.alpha})},interpolate:function(t,e,r){return{h:function(t,e,r){var n=e-t;return t+r*(n>180||n<-180?n-360*Math.round(n/360):n)}(t.h,e.h,r),c:Mt(t.c,e.c,r),l:Mt(t.l,e.l,r),alpha:Mt(t.alpha,e.alpha,r)}}},we=Object.freeze({lab:xe,hcl:be});function Ee(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function Se(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function Te(t){return t}function ke(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function Ae(t,e,r,n,i){return ke(typeof r===i?n[r]:void 0,t.default,e.default)}function Ie(t,e,r){if("number"!==Ee(r))return ke(t.default,e.default);var n=t.stops.length;if(1===n)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];var i=Me(t.stops,r);return t.stops[i][1]}function ze(t,e,r){var n=void 0!==t.base?t.base:1;if("number"!==Ee(r))return ke(t.default,e.default);var i=t.stops.length;if(1===i)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];var o=Me(t.stops,r),a=function(t,e,r,n){var i=n-r,o=t-r;return 0===i?0:1===e?o/i:(Math.pow(e,o)-1)/(Math.pow(e,i)-1)}(r,n,t.stops[o][0],t.stops[o+1][0]),s=t.stops[o][1],l=t.stops[o+1][1],u=Pt[e.type]||Te;if(t.colorSpace&&"rgb"!==t.colorSpace){var c=we[t.colorSpace];u=function(t,e){return c.reverse(c.interpolate(c.forward(t),c.forward(e),a))}}return"function"==typeof s.evaluate?{evaluate:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];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,a)}}:u(s,l,a)}function Ce(t,e,r){return"color"===e.type?r=at.parse(r):Ee(r)===e.type||"enum"===e.type&&e.values[r]||(r=void 0),ke(r,t.default,e.default)}function Me(t,e){for(var r,n,i=0,o=t.length-1,a=0;i<=o;){if(r=t[a=Math.floor((i+o)/2)][0],n=t[a+1][0],e===r||e>r&&ee&&(o=a-1)}return Math.max(a-1,0)}var Pe=function(t,e){var r;this.expression=t,this._warningHistory={},this._defaultValue="color"===(r=e).type&&Se(r.default)?new at(0,0,0,0):"color"===r.type?at.parse(r.default)||null:void 0===r.default?null:r.default,"enum"===e.type&&(this._enumValues=e.values)};function Le(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in Zt}function De(t,e){var r=new kt(Zt,[],function(t){var e={color:J,string:H,number:X,enum:H,boolean:K};return"array"===t.type?et(e[t.value]||Q,t.length):e[t.type]||null}(e)),n=r.parse(t);return n?te(new Pe(n,e)):ee(r.errors)}Pe.prototype.evaluateWithoutErrorHandling=function(t,e,r){return this._evaluator||(this._evaluator=new xt),this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this.expression.evaluate(this._evaluator)},Pe.prototype.evaluate=function(t,e,r){this._evaluator||(this._evaluator=new xt),this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r;try{var n=this.expression.evaluate(this._evaluator);if(null==n)return this._defaultValue;if(this._enumValues&&!(n in this._enumValues))throw new pt("Expected value to be one of "+Object.keys(this._enumValues).map(function(t){return JSON.stringify(t)}).join(", ")+", but found "+JSON.stringify(n)+" instead.");return n}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}};var Re=function(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Et(e.expression)};Re.prototype.evaluateWithoutErrorHandling=function(t,e,r){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r)},Re.prototype.evaluate=function(t,e,r){return this._styleExpression.evaluate(t,e,r)};var Be=function(t,e,r){this.kind=t,this.zoomStops=r.labels,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Et(e.expression),r instanceof Lt&&(this._interpolationType=r.interpolation)};function Oe(t,e){if("error"===(t=De(t,e)).result)return t;var r=t.value.expression,n=wt(r);if(!n&&!re(e))return ee([new Z("","data expressions not supported")]);var i=St(r,["zoom"]);if(!i&&!ne(e))return ee([new Z("","zoom expressions not supported")]);var o=function t(e){var r=null;if(e instanceof Bt)r=t(e.result);else if(e instanceof Rt)for(var n=0,i=e.args;nn.maximum?[new N(e,r,r+" is greater than the maximum value "+n.maximum)]:[]}function $e(t){var e,r,n,i=t.valueSpec,o=$(t.value.type),a={},s="categorical"!==o&&void 0===t.value.property,l=!s,u="array"===Ee(t.value.stops)&&"array"===Ee(t.value.stops[0])&&"object"===Ee(t.value.stops[0][0]),c=Ne({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===o)return[new N(t.key,t.value,'identity function may not have a "stops" property')];var e=[],r=t.value;return e=e.concat(je({key:t.key,value:r,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),"array"===Ee(r)&&0===r.length&&e.push(new N(t.key,r,"array must have at least one stop")),e},default:function(t){return cr({key:t.key,value:t.value,valueSpec:i,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===o&&s&&c.push(new N(t.key,t.value,'missing required property "property"')),"identity"===o||t.value.stops||c.push(new N(t.key,t.value,'missing required property "stops"')),"exponential"===o&&t.valueSpec.expression&&!ie(t.valueSpec)&&c.push(new N(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!re(t.valueSpec)?c.push(new N(t.key,t.value,"property functions not supported")):s&&!ne(t.valueSpec)&&c.push(new N(t.key,t.value,"zoom functions not supported"))),"categorical"!==o&&!u||void 0!==t.value.property||c.push(new N(t.key,t.value,'"property" property is required')),c;function h(t){var e=[],o=t.value,s=t.key;if("array"!==Ee(o))return[new N(s,o,"array expected, "+Ee(o)+" found")];if(2!==o.length)return[new N(s,o,"array length 2 expected, length "+o.length+" found")];if(u){if("object"!==Ee(o[0]))return[new N(s,o,"object expected, "+Ee(o[0])+" found")];if(void 0===o[0].zoom)return[new N(s,o,"object stop key must have zoom")];if(void 0===o[0].value)return[new N(s,o,"object stop key must have value")];if(n&&n>$(o[0].zoom))return[new N(s,o[0].zoom,"stop zoom values must appear in ascending order")];$(o[0].zoom)!==n&&(n=$(o[0].zoom),r=void 0,a={}),e=e.concat(Ne({key:s+"[0]",value:o[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Ue,value:p}}))}else e=e.concat(p({key:s+"[0]",value:o[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},o));return e.concat(cr({key:s+"[1]",value:o[1],valueSpec:i,style:t.style,styleSpec:t.styleSpec}))}function p(t,n){var s=Ee(t.value),l=$(t.value),u=null!==t.value?t.value:n;if(e){if(s!==e)return[new N(t.key,u,s+" stop domain type must match previous stop domain type "+e)]}else e=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new N(t.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==o){var c="number expected, "+s+" found";return re(i)&&void 0===o&&(c+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new N(t.key,u,c)]}return"categorical"!==o||"number"!==s||isFinite(l)&&Math.floor(l)===l?"categorical"!==o&&"number"===s&&void 0!==r&&l=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3===t.length&&(Array.isArray(t[1])||Array.isArray(t[2]));case"any":case"all":for(var e=0,r=t.slice(1);ee?1:0}function Ke(t){if(!t)return!0;var e,r=t[0];return t.length<=1?"any"!==r:"=="===r?Je(t[1],t[2],"=="):"!="===r?tr(Je(t[1],t[2],"==")):"<"===r||">"===r||"<="===r||">="===r?Je(t[1],t[2],r):"any"===r?(e=t.slice(1),["any"].concat(e.map(Ke))):"all"===r?["all"].concat(t.slice(1).map(Ke)):"none"===r?["all"].concat(t.slice(1).map(Ke).map(tr)):"in"===r?Ye(t[1],t.slice(2)):"!in"===r?tr(Ye(t[1],t.slice(2))):"has"===r?Qe(t[1]):"!has"!==r||tr(Qe(t[1]))}function Je(t,e,r){switch(t){case"$type":return["filter-type-"+r,e];case"$id":return["filter-id-"+r,e];default:return["filter-"+r,t,e]}}function Ye(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(function(t){return typeof t!=typeof e[0]})?["filter-in-large",t,["literal",e.sort(He)]]:["filter-in-small",t,["literal",e]]}}function Qe(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function tr(t){return["!",t]}function er(t){return Ge(q(t.value))?qe(U({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):function t(e){var r=e.value,n=e.key;if("array"!==Ee(r))return[new N(n,r,"array expected, "+Ee(r)+" found")];var i,o=e.styleSpec,a=[];if(r.length<1)return[new N(n,r,"filter array must have at least 1 element")];switch(a=a.concat(Ze({key:n+"[0]",value:r[0],valueSpec:o.filter_operator,style:e.style,styleSpec:e.styleSpec})),$(r[0])){case"<":case"<=":case">":case">=":r.length>=2&&"$type"===$(r[1])&&a.push(new N(n,r,'"$type" cannot be use with operator "'+r[0]+'"'));case"==":case"!=":3!==r.length&&a.push(new N(n,r,'filter array for operator "'+r[0]+'" must have 3 elements'));case"in":case"!in":r.length>=2&&"string"!==(i=Ee(r[1]))&&a.push(new N(n+"[1]",r[1],"string expected, "+i+" found"));for(var s=2;s=u[p+0]&&n>=u[p+1]?(a[h]=!0,o.push(l[h])):a[h]=!1}}},wr.prototype._forEachCell=function(t,e,r,n,i,o,a){for(var s=this._convertToCellCoord(t),l=this._convertToCellCoord(e),u=this._convertToCellCoord(r),c=this._convertToCellCoord(n),h=s;h<=u;h++)for(var p=l;p<=c;p++){var f=this.d*p+h;if(i.call(this,t,e,r,n,f,o,a))return}},wr.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},wr.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=br+this.cells.length+1+1,r=0,n=0;n=0)){var h=t[c];u[c]=Sr[l].shallow.indexOf(c)>=0?h:Ar(h,e)}t instanceof Error&&(u.message=t.message)}return{name:l,properties:u}}throw new Error("can't serialize object of type "+typeof t)}function Ir(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof ArrayBuffer||ArrayBuffer.isView(t)||t instanceof Er)return t;if(Array.isArray(t))return t.map(function(t){return Ir(t)});if("object"==typeof t){var e=t,r=e.name,n=e.properties;if(!r)throw new Error("can't deserialize object of anonymous class");var i=Sr[r].klass;if(!i)throw new Error("can't deserialize unregistered class "+r);if(i.deserialize)return i.deserialize(n._serialized);for(var o=Object.create(i.prototype),a=0,s=Object.keys(n);a=0?n[l]:Ir(n[l])}return o}throw new Error("can't deserialize object of type "+typeof t)}var zr=function(){this.first=!0};zr.prototype.update=function(t,e){var r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoom=128&&t<=255},Arabic:function(t){return t>=1536&&t<=1791},"Arabic Supplement":function(t){return t>=1872&&t<=1919},"Arabic Extended-A":function(t){return t>=2208&&t<=2303},"Hangul Jamo":function(t){return t>=4352&&t<=4607},"Unified Canadian Aboriginal Syllabics":function(t){return t>=5120&&t<=5759},Khmer:function(t){return t>=6016&&t<=6143},"Unified Canadian Aboriginal Syllabics Extended":function(t){return t>=6320&&t<=6399},"General Punctuation":function(t){return t>=8192&&t<=8303},"Letterlike Symbols":function(t){return t>=8448&&t<=8527},"Number Forms":function(t){return t>=8528&&t<=8591},"Miscellaneous Technical":function(t){return t>=8960&&t<=9215},"Control Pictures":function(t){return t>=9216&&t<=9279},"Optical Character Recognition":function(t){return t>=9280&&t<=9311},"Enclosed Alphanumerics":function(t){return t>=9312&&t<=9471},"Geometric Shapes":function(t){return t>=9632&&t<=9727},"Miscellaneous Symbols":function(t){return t>=9728&&t<=9983},"Miscellaneous Symbols and Arrows":function(t){return t>=11008&&t<=11263},"CJK Radicals Supplement":function(t){return t>=11904&&t<=12031},"Kangxi Radicals":function(t){return t>=12032&&t<=12255},"Ideographic Description Characters":function(t){return t>=12272&&t<=12287},"CJK Symbols and Punctuation":function(t){return t>=12288&&t<=12351},Hiragana:function(t){return t>=12352&&t<=12447},Katakana:function(t){return t>=12448&&t<=12543},Bopomofo:function(t){return t>=12544&&t<=12591},"Hangul Compatibility Jamo":function(t){return t>=12592&&t<=12687},Kanbun:function(t){return t>=12688&&t<=12703},"Bopomofo Extended":function(t){return t>=12704&&t<=12735},"CJK Strokes":function(t){return t>=12736&&t<=12783},"Katakana Phonetic Extensions":function(t){return t>=12784&&t<=12799},"Enclosed CJK Letters and Months":function(t){return t>=12800&&t<=13055},"CJK Compatibility":function(t){return t>=13056&&t<=13311},"CJK Unified Ideographs Extension A":function(t){return t>=13312&&t<=19903},"Yijing Hexagram Symbols":function(t){return t>=19904&&t<=19967},"CJK Unified Ideographs":function(t){return t>=19968&&t<=40959},"Yi Syllables":function(t){return t>=40960&&t<=42127},"Yi Radicals":function(t){return t>=42128&&t<=42191},"Hangul Jamo Extended-A":function(t){return t>=43360&&t<=43391},"Hangul Syllables":function(t){return t>=44032&&t<=55215},"Hangul Jamo Extended-B":function(t){return t>=55216&&t<=55295},"Private Use Area":function(t){return t>=57344&&t<=63743},"CJK Compatibility Ideographs":function(t){return t>=63744&&t<=64255},"Arabic Presentation Forms-A":function(t){return t>=64336&&t<=65023},"Vertical Forms":function(t){return t>=65040&&t<=65055},"CJK Compatibility Forms":function(t){return t>=65072&&t<=65103},"Small Form Variants":function(t){return t>=65104&&t<=65135},"Arabic Presentation Forms-B":function(t){return t>=65136&&t<=65279},"Halfwidth and Fullwidth Forms":function(t){return t>=65280&&t<=65519}};function Mr(t){for(var e=0,r=t;e=65097&&t<=65103)||Cr["CJK Compatibility Ideographs"](t)||Cr["CJK Compatibility"](t)||Cr["CJK Radicals Supplement"](t)||Cr["CJK Strokes"](t)||!(!Cr["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||Cr["CJK Unified Ideographs Extension A"](t)||Cr["CJK Unified Ideographs"](t)||Cr["Enclosed CJK Letters and Months"](t)||Cr["Hangul Compatibility Jamo"](t)||Cr["Hangul Jamo Extended-A"](t)||Cr["Hangul Jamo Extended-B"](t)||Cr["Hangul Jamo"](t)||Cr["Hangul Syllables"](t)||Cr.Hiragana(t)||Cr["Ideographic Description Characters"](t)||Cr.Kanbun(t)||Cr["Kangxi Radicals"](t)||Cr["Katakana Phonetic Extensions"](t)||Cr.Katakana(t)&&12540!==t||!(!Cr["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!Cr["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||Cr["Unified Canadian Aboriginal Syllabics"](t)||Cr["Unified Canadian Aboriginal Syllabics Extended"](t)||Cr["Vertical Forms"](t)||Cr["Yijing Hexagram Symbols"](t)||Cr["Yi Syllables"](t)||Cr["Yi Radicals"](t)))}function Dr(t){return!(Lr(t)||function(t){return!!(Cr["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||Cr["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||Cr["Letterlike Symbols"](t)||Cr["Number Forms"](t)||Cr["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||Cr["Control Pictures"](t)&&9251!==t||Cr["Optical Character Recognition"](t)||Cr["Enclosed Alphanumerics"](t)||Cr["Geometric Shapes"](t)||Cr["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||Cr["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Cr["CJK Symbols and Punctuation"](t)||Cr.Katakana(t)||Cr["Private Use Area"](t)||Cr["CJK Compatibility Forms"](t)||Cr["Small Form Variants"](t)||Cr["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Rr(t,e){return!(!e&&(t>=1424&&t<=2303||Cr["Arabic Presentation Forms-A"](t)||Cr["Arabic Presentation Forms-B"](t))||t>=2304&&t<=3583||t>=3840&&t<=4255||Cr.Khmer(t))}var Br,Or=!1,Fr=null,Vr=!1,Nr=new F,jr={applyArabicShaping:null,processBidirectionalText:null,isLoaded:function(){return Vr||null!=jr.applyArabicShaping}},Ur=function(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new zr,this.transition={})};Ur.prototype.isSupportedScript=function(t){return function(t,e){for(var r=0,n=t;rthis.end)return this.prior=null,r;if(this.value.isDataDriven())return this.prior=null,r;if(e=1)return 1;var e=i*i,r=e*i;return 4*(i<.5?r:3*(i-e)+r-.75)}())}return r};var Wr=function(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)};Wr.prototype.possiblyEvaluate=function(t){for(var e=new Kr(this._properties),r=0,n=Object.keys(this._values);rn.zoomHistory.lastIntegerZoom?{from:t,to:e,fromScale:2,toScale:1,t:o+(1-o)*a}:{from:r,to:e,fromScale:.5,toScale:1,t:1-(1-a)*o}},Qr.prototype.interpolate=function(t){return t};var tn=function(t){this.specification=t};tn.prototype.possiblyEvaluate=function(t,e){return!!t.expression.evaluate(e)},tn.prototype.interpolate=function(){return!1};var en=function(t){for(var e in this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},t){var r=t[e],n=this.defaultPropertyValues[e]=new $r(r,void 0),i=this.defaultTransitionablePropertyValues[e]=new qr(r);this.defaultTransitioningPropertyValues[e]=i.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=n.possiblyEvaluate({})}};Tr("DataDrivenProperty",Yr),Tr("DataConstantProperty",Jr),Tr("CrossFadedProperty",Qr),Tr("ColorRampProperty",tn);var rn=function(t){function e(e,r){for(var n in t.call(this),this.id=e.id,this.metadata=e.metadata,this.type=e.type,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,this.visibility="visible","background"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),this._featureFilter=function(){return!0},r.layout&&(this._unevaluatedLayout=new Xr(r.layout)),this._transitionablePaint=new Zr(r.paint),e.paint)this.setPaintProperty(n,e.paint[n],{validate:!1});for(var i in e.layout)this.setLayoutProperty(i,e.layout[i],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getLayoutProperty=function(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)},e.prototype.setLayoutProperty=function(t,e,r){if(null!=e){var n="layers."+this.id+".layout."+t;if(this._validate(vr,n,t,e,r))return}"visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility="none"===e?e:"visible"},e.prototype.getPaintProperty=function(t){return w(t,"-transition")?this._transitionablePaint.getTransition(t.slice(0,-"-transition".length)):this._transitionablePaint.getValue(t)},e.prototype.setPaintProperty=function(t,e,r){if(null!=e){var n="layers."+this.id+".paint."+t;if(this._validate(gr,n,t,e,r))return!1}if(w(t,"-transition"))return this._transitionablePaint.setTransition(t.slice(0,-"-transition".length),e||void 0),!1;var i=this._transitionablePaint._values[t].value.isDataDriven();this._transitionablePaint.setValue(t,e);var o=this._transitionablePaint._values[t].value.isDataDriven();return this._handleSpecialPaintPropertyUpdate(t),o||i},e.prototype._handleSpecialPaintPropertyUpdate=function(t){},e.prototype.isHidden=function(t){return!!(this.minzoom&&t=this.maxzoom)||"none"===this.visibility},e.prototype.updateTransitions=function(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)},e.prototype.hasTransition=function(){return this._transitioningPaint.hasTransition()},e.prototype.recalculate=function(t){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t)),this.paint=this._transitioningPaint.possiblyEvaluate(t)},e.prototype.serialize=function(){var t={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"none"===this.visibility&&(t.layout=t.layout||{},t.layout.visibility="none"),S(t,function(t,e){return!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)})},e.prototype._validate=function(t,e,r,n,i){return(!i||!1!==i.validate)&&_r(this,t.call(mr,{key:e,layerType:this.type,objectKey:r,value:n,styleSpec:V,style:{glyphs:!0,sprite:!0}}))},e.prototype.hasOffscreenPass=function(){return!1},e.prototype.resize=function(){},e.prototype.isStateDependent=function(){for(var t in this.paint._values){var e=this.paint.get(t);if(e instanceof Hr&&re(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1},e}(F),nn={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},on=function(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8},an=function(){this.isTransferred=!1,this.capacity=-1,this.resize(0)};function sn(t,e){void 0===e&&(e=1);var r=0,n=0;return{members:t.map(function(t){var i,o=(i=t.type,nn[i].BYTES_PER_ELEMENT),a=r=ln(r,Math.max(e,o)),s=t.components||1;return n=Math.max(n,o),r+=o*s,{name:t.name,type:t.type,components:s,offset:a}}),size:ln(r,Math.max(n,e)),alignment:e}}function ln(t,e){return Math.ceil(t/e)*e}an.serialize=function(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}},an.deserialize=function(t){var e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e},an.prototype._trim=function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())},an.prototype.clear=function(){this.length=0},an.prototype.resize=function(t){this.reserve(t),this.length=t},an.prototype.reserve=function(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}},an.prototype._refreshViews=function(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")};var un=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;this.resize(r+1);var n=2*r;return this.int16[n+0]=t,this.int16[n+1]=e,r},e.prototype.emplace=function(t,e,r){var n=2*t;return this.int16[n+0]=e,this.int16[n+1]=r,t},e}(an);un.prototype.bytesPerElement=4,Tr("StructArrayLayout2i4",un);var cn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n){var i=this.length;this.resize(i+1);var o=4*i;return this.int16[o+0]=t,this.int16[o+1]=e,this.int16[o+2]=r,this.int16[o+3]=n,i},e.prototype.emplace=function(t,e,r,n,i){var o=4*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=n,this.int16[o+3]=i,t},e}(an);cn.prototype.bytesPerElement=8,Tr("StructArrayLayout4i8",cn);var hn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o){var a=this.length;this.resize(a+1);var s=6*a;return this.int16[s+0]=t,this.int16[s+1]=e,this.int16[s+2]=r,this.int16[s+3]=n,this.int16[s+4]=i,this.int16[s+5]=o,a},e.prototype.emplace=function(t,e,r,n,i,o,a){var s=6*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=i,this.int16[s+4]=o,this.int16[s+5]=a,t},e}(an);hn.prototype.bytesPerElement=12,Tr("StructArrayLayout2i4i12",hn);var pn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o,a,s){var l=this.length;this.resize(l+1);var u=6*l,c=12*l;return this.int16[u+0]=t,this.int16[u+1]=e,this.int16[u+2]=r,this.int16[u+3]=n,this.uint8[c+8]=i,this.uint8[c+9]=o,this.uint8[c+10]=a,this.uint8[c+11]=s,l},e.prototype.emplace=function(t,e,r,n,i,o,a,s,l){var u=6*t,c=12*t;return this.int16[u+0]=e,this.int16[u+1]=r,this.int16[u+2]=n,this.int16[u+3]=i,this.uint8[c+8]=o,this.uint8[c+9]=a,this.uint8[c+10]=s,this.uint8[c+11]=l,t},e}(an);pn.prototype.bytesPerElement=12,Tr("StructArrayLayout4i4ub12",pn);var fn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o,a,s){var l=this.length;this.resize(l+1);var u=8*l;return this.int16[u+0]=t,this.int16[u+1]=e,this.int16[u+2]=r,this.int16[u+3]=n,this.uint16[u+4]=i,this.uint16[u+5]=o,this.uint16[u+6]=a,this.uint16[u+7]=s,l},e.prototype.emplace=function(t,e,r,n,i,o,a,s,l){var u=8*t;return this.int16[u+0]=e,this.int16[u+1]=r,this.int16[u+2]=n,this.int16[u+3]=i,this.uint16[u+4]=o,this.uint16[u+5]=a,this.uint16[u+6]=s,this.uint16[u+7]=l,t},e}(an);fn.prototype.bytesPerElement=16,Tr("StructArrayLayout4i4ui16",fn);var dn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;this.resize(n+1);var i=3*n;return this.float32[i+0]=t,this.float32[i+1]=e,this.float32[i+2]=r,n},e.prototype.emplace=function(t,e,r,n){var i=3*t;return this.float32[i+0]=e,this.float32[i+1]=r,this.float32[i+2]=n,t},e}(an);dn.prototype.bytesPerElement=12,Tr("StructArrayLayout3f12",dn);var mn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;this.resize(e+1);var r=1*e;return this.uint32[r+0]=t,e},e.prototype.emplace=function(t,e){var r=1*t;return this.uint32[r+0]=e,t},e}(an);mn.prototype.bytesPerElement=4,Tr("StructArrayLayout1ul4",mn);var yn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o,a,s,l,u,c){var h=this.length;this.resize(h+1);var p=12*h,f=6*h;return this.int16[p+0]=t,this.int16[p+1]=e,this.int16[p+2]=r,this.int16[p+3]=n,this.int16[p+4]=i,this.int16[p+5]=o,this.uint32[f+3]=a,this.uint16[p+8]=s,this.uint16[p+9]=l,this.int16[p+10]=u,this.int16[p+11]=c,h},e.prototype.emplace=function(t,e,r,n,i,o,a,s,l,u,c,h){var p=12*t,f=6*t;return this.int16[p+0]=e,this.int16[p+1]=r,this.int16[p+2]=n,this.int16[p+3]=i,this.int16[p+4]=o,this.int16[p+5]=a,this.uint32[f+3]=s,this.uint16[p+8]=l,this.uint16[p+9]=u,this.int16[p+10]=c,this.int16[p+11]=h,t},e}(an);yn.prototype.bytesPerElement=24,Tr("StructArrayLayout6i1ul2ui2i24",yn);var gn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o){var a=this.length;this.resize(a+1);var s=6*a;return this.int16[s+0]=t,this.int16[s+1]=e,this.int16[s+2]=r,this.int16[s+3]=n,this.int16[s+4]=i,this.int16[s+5]=o,a},e.prototype.emplace=function(t,e,r,n,i,o,a){var s=6*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=i,this.int16[s+4]=o,this.int16[s+5]=a,t},e}(an);gn.prototype.bytesPerElement=12,Tr("StructArrayLayout2i2i2i12",gn);var vn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;this.resize(r+1);var n=4*r;return this.uint8[n+0]=t,this.uint8[n+1]=e,r},e.prototype.emplace=function(t,e,r){var n=4*t;return this.uint8[n+0]=e,this.uint8[n+1]=r,t},e}(an);vn.prototype.bytesPerElement=4,Tr("StructArrayLayout2ub4",vn);var _n=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o,a,s,l,u,c,h,p,f){var d=this.length;this.resize(d+1);var m=20*d,y=10*d,g=40*d;return this.int16[m+0]=t,this.int16[m+1]=e,this.uint16[m+2]=r,this.uint16[m+3]=n,this.uint32[y+2]=i,this.uint32[y+3]=o,this.uint32[y+4]=a,this.uint16[m+10]=s,this.uint16[m+11]=l,this.uint16[m+12]=u,this.float32[y+7]=c,this.float32[y+8]=h,this.uint8[g+36]=p,this.uint8[g+37]=f,d},e.prototype.emplace=function(t,e,r,n,i,o,a,s,l,u,c,h,p,f,d){var m=20*t,y=10*t,g=40*t;return this.int16[m+0]=e,this.int16[m+1]=r,this.uint16[m+2]=n,this.uint16[m+3]=i,this.uint32[y+2]=o,this.uint32[y+3]=a,this.uint32[y+4]=s,this.uint16[m+10]=l,this.uint16[m+11]=u,this.uint16[m+12]=c,this.float32[y+7]=h,this.float32[y+8]=p,this.uint8[g+36]=f,this.uint8[g+37]=d,t},e}(an);_n.prototype.bytesPerElement=40,Tr("StructArrayLayout2i2ui3ul3ui2f2ub40",_n);var xn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;this.resize(e+1);var r=1*e;return this.float32[r+0]=t,e},e.prototype.emplace=function(t,e){var r=1*t;return this.float32[r+0]=e,t},e}(an);xn.prototype.bytesPerElement=4,Tr("StructArrayLayout1f4",xn);var bn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;this.resize(n+1);var i=3*n;return this.int16[i+0]=t,this.int16[i+1]=e,this.int16[i+2]=r,n},e.prototype.emplace=function(t,e,r,n){var i=3*t;return this.int16[i+0]=e,this.int16[i+1]=r,this.int16[i+2]=n,t},e}(an);bn.prototype.bytesPerElement=6,Tr("StructArrayLayout3i6",bn);var wn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;this.resize(n+1);var i=2*n,o=4*n;return this.uint32[i+0]=t,this.uint16[o+2]=e,this.uint16[o+3]=r,n},e.prototype.emplace=function(t,e,r,n){var i=2*t,o=4*t;return this.uint32[i+0]=e,this.uint16[o+2]=r,this.uint16[o+3]=n,t},e}(an);wn.prototype.bytesPerElement=8,Tr("StructArrayLayout1ul2ui8",wn);var En=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;this.resize(n+1);var i=3*n;return this.uint16[i+0]=t,this.uint16[i+1]=e,this.uint16[i+2]=r,n},e.prototype.emplace=function(t,e,r,n){var i=3*t;return this.uint16[i+0]=e,this.uint16[i+1]=r,this.uint16[i+2]=n,t},e}(an);En.prototype.bytesPerElement=6,Tr("StructArrayLayout3ui6",En);var Sn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;this.resize(r+1);var n=2*r;return this.uint16[n+0]=t,this.uint16[n+1]=e,r},e.prototype.emplace=function(t,e,r){var n=2*t;return this.uint16[n+0]=e,this.uint16[n+1]=r,t},e}(an);Sn.prototype.bytesPerElement=4,Tr("StructArrayLayout2ui4",Sn);var Tn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;this.resize(r+1);var n=2*r;return this.float32[n+0]=t,this.float32[n+1]=e,r},e.prototype.emplace=function(t,e,r){var n=2*t;return this.float32[n+0]=e,this.float32[n+1]=r,t},e}(an);Tn.prototype.bytesPerElement=8,Tr("StructArrayLayout2f8",Tn);var kn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n){var i=this.length;this.resize(i+1);var o=4*i;return this.float32[o+0]=t,this.float32[o+1]=e,this.float32[o+2]=r,this.float32[o+3]=n,i},e.prototype.emplace=function(t,e,r,n,i){var o=4*t;return this.float32[o+0]=e,this.float32[o+1]=r,this.float32[o+2]=n,this.float32[o+3]=i,t},e}(an);kn.prototype.bytesPerElement=16,Tr("StructArrayLayout4f16",kn);var An=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={anchorPointX:{configurable:!0},anchorPointY:{configurable:!0},x1:{configurable:!0},y1:{configurable:!0},x2:{configurable:!0},y2:{configurable:!0},featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0},radius:{configurable:!0},signedDistanceFromAnchor:{configurable:!0},anchorPoint:{configurable:!0}};return r.anchorPointX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorPointX.set=function(t){this._structArray.int16[this._pos2+0]=t},r.anchorPointY.get=function(){return this._structArray.int16[this._pos2+1]},r.anchorPointY.set=function(t){this._structArray.int16[this._pos2+1]=t},r.x1.get=function(){return this._structArray.int16[this._pos2+2]},r.x1.set=function(t){this._structArray.int16[this._pos2+2]=t},r.y1.get=function(){return this._structArray.int16[this._pos2+3]},r.y1.set=function(t){this._structArray.int16[this._pos2+3]=t},r.x2.get=function(){return this._structArray.int16[this._pos2+4]},r.x2.set=function(t){this._structArray.int16[this._pos2+4]=t},r.y2.get=function(){return this._structArray.int16[this._pos2+5]},r.y2.set=function(t){this._structArray.int16[this._pos2+5]=t},r.featureIndex.get=function(){return this._structArray.uint32[this._pos4+3]},r.featureIndex.set=function(t){this._structArray.uint32[this._pos4+3]=t},r.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+8]},r.sourceLayerIndex.set=function(t){this._structArray.uint16[this._pos2+8]=t},r.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+9]},r.bucketIndex.set=function(t){this._structArray.uint16[this._pos2+9]=t},r.radius.get=function(){return this._structArray.int16[this._pos2+10]},r.radius.set=function(t){this._structArray.int16[this._pos2+10]=t},r.signedDistanceFromAnchor.get=function(){return this._structArray.int16[this._pos2+11]},r.signedDistanceFromAnchor.set=function(t){this._structArray.int16[this._pos2+11]=t},r.anchorPoint.get=function(){return new p(this.anchorPointX,this.anchorPointY)},Object.defineProperties(e.prototype,r),e}(on);An.prototype.size=24;var In=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t){return new An(this,t)},e}(yn);Tr("CollisionBoxArray",In);var zn=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={anchorX:{configurable:!0},anchorY:{configurable:!0},glyphStartIndex:{configurable:!0},numGlyphs:{configurable:!0},vertexStartIndex:{configurable:!0},lineStartIndex:{configurable:!0},lineLength:{configurable:!0},segment:{configurable:!0},lowerSize:{configurable:!0},upperSize:{configurable:!0},lineOffsetX:{configurable:!0},lineOffsetY:{configurable:!0},writingMode:{configurable:!0},hidden:{configurable:!0}};return r.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorX.set=function(t){this._structArray.int16[this._pos2+0]=t},r.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},r.anchorY.set=function(t){this._structArray.int16[this._pos2+1]=t},r.glyphStartIndex.get=function(){return this._structArray.uint16[this._pos2+2]},r.glyphStartIndex.set=function(t){this._structArray.uint16[this._pos2+2]=t},r.numGlyphs.get=function(){return this._structArray.uint16[this._pos2+3]},r.numGlyphs.set=function(t){this._structArray.uint16[this._pos2+3]=t},r.vertexStartIndex.get=function(){return this._structArray.uint32[this._pos4+2]},r.vertexStartIndex.set=function(t){this._structArray.uint32[this._pos4+2]=t},r.lineStartIndex.get=function(){return this._structArray.uint32[this._pos4+3]},r.lineStartIndex.set=function(t){this._structArray.uint32[this._pos4+3]=t},r.lineLength.get=function(){return this._structArray.uint32[this._pos4+4]},r.lineLength.set=function(t){this._structArray.uint32[this._pos4+4]=t},r.segment.get=function(){return this._structArray.uint16[this._pos2+10]},r.segment.set=function(t){this._structArray.uint16[this._pos2+10]=t},r.lowerSize.get=function(){return this._structArray.uint16[this._pos2+11]},r.lowerSize.set=function(t){this._structArray.uint16[this._pos2+11]=t},r.upperSize.get=function(){return this._structArray.uint16[this._pos2+12]},r.upperSize.set=function(t){this._structArray.uint16[this._pos2+12]=t},r.lineOffsetX.get=function(){return this._structArray.float32[this._pos4+7]},r.lineOffsetX.set=function(t){this._structArray.float32[this._pos4+7]=t},r.lineOffsetY.get=function(){return this._structArray.float32[this._pos4+8]},r.lineOffsetY.set=function(t){this._structArray.float32[this._pos4+8]=t},r.writingMode.get=function(){return this._structArray.uint8[this._pos1+36]},r.writingMode.set=function(t){this._structArray.uint8[this._pos1+36]=t},r.hidden.get=function(){return this._structArray.uint8[this._pos1+37]},r.hidden.set=function(t){this._structArray.uint8[this._pos1+37]=t},Object.defineProperties(e.prototype,r),e}(on);zn.prototype.size=40;var Cn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t){return new zn(this,t)},e}(_n);Tr("PlacedSymbolArray",Cn);var Mn=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={offsetX:{configurable:!0}};return r.offsetX.get=function(){return this._structArray.float32[this._pos4+0]},r.offsetX.set=function(t){this._structArray.float32[this._pos4+0]=t},Object.defineProperties(e.prototype,r),e}(on);Mn.prototype.size=4;var Pn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getoffsetX=function(t){return this.float32[1*t+0]},e.prototype.get=function(t){return new Mn(this,t)},e}(xn);Tr("GlyphOffsetArray",Pn);var Ln=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={x:{configurable:!0},y:{configurable:!0},tileUnitDistanceFromAnchor:{configurable:!0}};return r.x.get=function(){return this._structArray.int16[this._pos2+0]},r.x.set=function(t){this._structArray.int16[this._pos2+0]=t},r.y.get=function(){return this._structArray.int16[this._pos2+1]},r.y.set=function(t){this._structArray.int16[this._pos2+1]=t},r.tileUnitDistanceFromAnchor.get=function(){return this._structArray.int16[this._pos2+2]},r.tileUnitDistanceFromAnchor.set=function(t){this._structArray.int16[this._pos2+2]=t},Object.defineProperties(e.prototype,r),e}(on);Ln.prototype.size=6;var Dn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getx=function(t){return this.int16[3*t+0]},e.prototype.gety=function(t){return this.int16[3*t+1]},e.prototype.gettileUnitDistanceFromAnchor=function(t){return this.int16[3*t+2]},e.prototype.get=function(t){return new Ln(this,t)},e}(bn);Tr("SymbolLineVertexArray",Dn);var Rn=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0}};return r.featureIndex.get=function(){return this._structArray.uint32[this._pos4+0]},r.featureIndex.set=function(t){this._structArray.uint32[this._pos4+0]=t},r.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+2]},r.sourceLayerIndex.set=function(t){this._structArray.uint16[this._pos2+2]=t},r.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+3]},r.bucketIndex.set=function(t){this._structArray.uint16[this._pos2+3]=t},Object.defineProperties(e.prototype,r),e}(on);Rn.prototype.size=8;var Bn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t){return new Rn(this,t)},e}(wn);Tr("FeatureIndexArray",Bn);var On=sn([{name:"a_pos",components:2,type:"Int16"}],4).members,Fn=function(t){void 0===t&&(t=[]),this.segments=t};Fn.prototype.prepareSegment=function(t,e,r){var n=this.segments[this.segments.length-1];return t>Fn.MAX_VERTEX_ARRAY_LENGTH&&A("Max vertices per segment is "+Fn.MAX_VERTEX_ARRAY_LENGTH+": bucket requested "+t),(!n||n.vertexLength+t>Fn.MAX_VERTEX_ARRAY_LENGTH)&&(n={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0},this.segments.push(n)),n},Fn.prototype.get=function(){return this.segments},Fn.prototype.destroy=function(){for(var t=0,e=this.segments;tXn.max||a.yXn.max)&&A("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return r}function Kn(t,e,r,n,i){t.emplaceBack(2*e+(n+1)/2,2*r+(i+1)/2)}var Jn=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(t){return t.id}),this.index=t.index,this.layoutVertexArray=new un,this.indexArray=new En,this.segments=new Fn,this.programConfigurations=new Zn(On,t.layers,t.zoom)};function Yn(t,e,r){for(var n=0;n=3)for(var s=0;s1){if(ri(t,e))return!0;for(var n=0;n1?t.distSqr(r):t.distSqr(r.sub(e)._mult(i)._add(e))}function ai(t,e){for(var r,n,i,o=!1,a=0;ae.y!=i.y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(o=!o);return o}function si(t,e){for(var r=!1,n=0,i=t.length-1;ne.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(r=!r)}return r}function li(t,e,r){var n=e.paint.get(t).value;return"constant"===n.kind?n.value:r.programConfigurations.get(e.id).binders[t].statistics.max}function ui(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function ci(t,e,r,n,i){if(!e[0]&&!e[1])return t;var o=p.convert(e);"viewport"===r&&o._rotate(-n);for(var a=[],s=0;s=Wn||u<0||u>=Wn)){var c=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray),h=c.vertexLength;Kn(this.layoutVertexArray,l,u,-1,-1),Kn(this.layoutVertexArray,l,u,1,-1),Kn(this.layoutVertexArray,l,u,1,1),Kn(this.layoutVertexArray,l,u,-1,1),this.indexArray.emplaceBack(h,h+1,h+2),this.indexArray.emplaceBack(h,h+3,h+2),c.vertexLength+=4,c.primitiveLength+=2}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r)},Tr("CircleBucket",Jn,{omit:["layers"]});var hi={paint:new en({"circle-radius":new Yr(V.paint_circle["circle-radius"]),"circle-color":new Yr(V.paint_circle["circle-color"]),"circle-blur":new Yr(V.paint_circle["circle-blur"]),"circle-opacity":new Yr(V.paint_circle["circle-opacity"]),"circle-translate":new Jr(V.paint_circle["circle-translate"]),"circle-translate-anchor":new Jr(V.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Jr(V.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Jr(V.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Yr(V.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Yr(V.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Yr(V.paint_circle["circle-stroke-opacity"])})},pi="undefined"!=typeof Float32Array?Float32Array:Array;function fi(){var t=new pi(9);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function di(){var t=new pi(3);return t[0]=0,t[1]=0,t[2]=0,t}function mi(t){var e=t[0],r=t[1],n=t[2];return Math.sqrt(e*e+r*r+n*n)}function yi(t,e,r){var n=new pi(3);return n[0]=t,n[1]=e,n[2]=r,n}Math.PI;var gi,vi=mi,_i=(gi=di(),function(t,e,r,n,i,o){var a,s;for(e||(e=3),r||(r=0),s=n?Math.min(n*e+r,t.length):t.length,a=r;a0&&(a=1/Math.sqrt(a),t[0]=r*a,t[1]=n*a,t[2]=i*a,t[3]=o*a),t}function wi(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*a,t}var Ei=function(){var t=xi();return function(e,r,n,i,o,a){var s,l;for(r||(r=4),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;st.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");for(var a=t.data,s=e.data,l=0;l80*r){n=o=t[0],i=a=t[1];for(var d=r;do&&(o=s),l>a&&(a=l);u=0!==(u=Math.max(o-n,a-i))?1/u:0}return qi(p,f,r,n,i,u),f}function Ui(t,e,r,n,i){var o,a;if(i===uo(t,e,r,n)>0)for(o=e;o=e;o-=n)a=ao(o,t[o],t[o+1],a);return a&&ro(a,a.next)&&(so(a),a=a.next),a}function $i(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!ro(n,n.next)&&0!==eo(n.prev,n,n.next))n=n.next;else{if(so(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function qi(t,e,r,n,i,o,a){if(t){!a&&o&&function(t,e,r,n){var i=t;do{null===i.z&&(i.z=Ji(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,o,a,s,l,u=1;do{for(r=t,t=null,o=null,a=0;r;){for(a++,n=r,s=0,e=0;e0||l>0&&n;)0!==s&&(0===l||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,l--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;r=n}o.nextZ=null,u*=2}while(a>1)}(i)}(t,n,i,o);for(var s,l,u=t;t.prev!==t.next;)if(s=t.prev,l=t.next,o?Gi(t,n,i,o):Zi(t))e.push(s.i/r),e.push(t.i/r),e.push(l.i/r),so(t),t=l.next,u=l.next;else if((t=l)===u){a?1===a?qi(t=Wi(t,e,r),e,r,n,i,o,2):2===a&&Xi(t,e,r,n,i,o):qi($i(t),e,r,n,i,o,1);break}}}function Zi(t){var e=t.prev,r=t,n=t.next;if(eo(e,r,n)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(Qi(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&eo(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function Gi(t,e,r,n){var i=t.prev,o=t,a=t.next;if(eo(i,o,a)>=0)return!1;for(var s=i.xo.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,c=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,h=Ji(s,l,e,r,n),p=Ji(u,c,e,r,n),f=t.prevZ,d=t.nextZ;f&&f.z>=h&&d&&d.z<=p;){if(f!==t.prev&&f!==t.next&&Qi(i.x,i.y,o.x,o.y,a.x,a.y,f.x,f.y)&&eo(f.prev,f,f.next)>=0)return!1;if(f=f.prevZ,d!==t.prev&&d!==t.next&&Qi(i.x,i.y,o.x,o.y,a.x,a.y,d.x,d.y)&&eo(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;f&&f.z>=h;){if(f!==t.prev&&f!==t.next&&Qi(i.x,i.y,o.x,o.y,a.x,a.y,f.x,f.y)&&eo(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;d&&d.z<=p;){if(d!==t.prev&&d!==t.next&&Qi(i.x,i.y,o.x,o.y,a.x,a.y,d.x,d.y)&&eo(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function Wi(t,e,r){var n=t;do{var i=n.prev,o=n.next.next;!ro(i,o)&&no(i,n,n.next,o)&&io(i,o)&&io(o,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(o.i/r),so(n),so(n.next),n=t=o),n=n.next}while(n!==t);return n}function Xi(t,e,r,n,i,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&to(a,s)){var l=oo(a,s);return a=$i(a,a.next),l=$i(l,l.next),qi(a,e,r,n,i,o),void qi(l,e,r,n,i,o)}s=s.next}a=a.next}while(a!==t)}function Hi(t,e){return t.x-e.x}function Ki(t,e){if(e=function(t,e){var r,n=e,i=t.x,o=t.y,a=-1/0;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var s=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&s>a){if(a=s,s===i){if(o===n.y)return n;if(o===n.next.y)return n.next}r=n.x=n.x&&n.x>=c&&i!==n.x&&Qi(or.x)&&io(n,t)&&(r=n,p=l),n=n.next;return r}(t,e)){var r=oo(e,t);$i(r,r.next)}}function Ji(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Yi(t){var e=t,r=t;do{e.x=0&&(t-a)*(n-s)-(r-a)*(e-s)>=0&&(r-a)*(o-s)-(i-a)*(n-s)>=0}function to(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&no(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&io(t,e)&&io(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)}function eo(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function ro(t,e){return t.x===e.x&&t.y===e.y}function no(t,e,r,n){return!!(ro(t,e)&&ro(r,n)||ro(t,n)&&ro(r,e))||eo(t,e,r)>0!=eo(t,e,n)>0&&eo(r,n,t)>0!=eo(r,n,e)>0}function io(t,e){return eo(t.prev,t,t.next)<0?eo(t,e,t.next)>=0&&eo(t,t.prev,e)>=0:eo(t,e,t.prev)<0||eo(t,t.next,e)<0}function oo(t,e){var r=new lo(t.i,t.x,t.y),n=new lo(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function ao(t,e,r,n){var i=new lo(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function so(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function lo(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function uo(t,e,r,n){for(var i=0,o=e,a=r-n;o0&&(n+=t[i-1].length,r.holes.push(n))}return r},Vi.default=Ni;var co=po,ho=po;function po(t,e,r,n,i){!function t(e,r,n,i,o){for(;i>n;){if(i-n>600){var a=i-n+1,s=r-n+1,l=Math.log(a),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(a-u)/a)*(s-a/2<0?-1:1);t(e,r,Math.max(n,Math.floor(r-s*u/a+c)),Math.min(i,Math.floor(r+(a-s)*u/a+c)),o)}var h=e[r],p=n,f=i;for(fo(e,n,r),o(e[i],h)>0&&fo(e,n,i);p0;)f--}0===o(e[n],h)?fo(e,n,f):fo(e,++f,i),f<=r&&(n=f+1),r<=f&&(i=f-1)}}(t,e,r||0,n||t.length-1,i||mo)}function fo(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function mo(t,e){return te?1:0}function yo(t,e){var r=t.length;if(r<=1)return[t];for(var n,i,o=[],a=0;a1)for(var l=0;lWn)||t.y===e.y&&(t.y<0||t.y>Wn)}function ko(t){return t.every(function(t){return t.x<0})||t.every(function(t){return t.x>Wn})||t.every(function(t){return t.y<0})||t.every(function(t){return t.y>Wn})}So.prototype.populate=function(t,e){for(var r=0,n=t;r=1){var y=p[d-1];if(!To(m,y)){u.vertexLength+4>Fn.MAX_VERTEX_ARRAY_LENGTH&&(u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));var g=m.sub(y)._perp()._unit(),v=y.dist(m);f+v>32768&&(f=0),Eo(this.layoutVertexArray,m.x,m.y,g.x,g.y,0,0,f),Eo(this.layoutVertexArray,m.x,m.y,g.x,g.y,0,1,f),f+=v,Eo(this.layoutVertexArray,y.x,y.y,g.x,g.y,0,0,f),Eo(this.layoutVertexArray,y.x,y.y,g.x,g.y,0,1,f);var _=u.vertexLength;this.indexArray.emplaceBack(_,_+1,_+2),this.indexArray.emplaceBack(_+1,_+2,_+3),u.vertexLength+=4,u.primitiveLength+=2}}}}u.vertexLength+a>Fn.MAX_VERTEX_ARRAY_LENGTH&&(u=this.segments.prepareSegment(a,this.layoutVertexArray,this.indexArray));for(var x=[],b=[],w=u.vertexLength,E=0,S=o;E>3}if(i--,1===n||2===n)o+=t.readSVarint(),a+=t.readSVarint(),1===n&&(e&&s.push(e),e=[]),e.push(new p(o,a));else{if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&s.push(e),s},Mo.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,o=0,a=1/0,s=-1/0,l=1/0,u=-1/0;t.pos>3}if(n--,1===r||2===r)(i+=t.readSVarint())s&&(s=i),(o+=t.readSVarint())u&&(u=o);else if(7!==r)throw new Error("unknown command "+r)}return[a,l,s,u]},Mo.prototype.toGeoJSON=function(t,e,r){var n,i,o=this.extent*Math.pow(2,r),a=this.extent*t,s=this.extent*e,l=this.loadGeometry(),u=Mo.types[this.type];function c(t){for(var e=0;e>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null}return e}(r))}function Oo(t,e,r){if(3===t){var n=new Do(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}Ro.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new Co(this._pbf,e,this.extent,this._keys,this._values)};var Fo={VectorTile:function(t,e){this.layers=t.readFields(Oo,{},e)},VectorTileFeature:Co,VectorTileLayer:Do},Vo=Fo.VectorTileFeature.types,No=63,jo=Math.cos(Math.PI/180*37.5),Uo=.5,$o=Math.pow(2,14)/Uo;function qo(t,e,r,n,i,o,a){t.emplaceBack(e.x,e.y,n?1:0,i?1:-1,Math.round(No*r.x)+128,Math.round(No*r.y)+128,1+(0===o?0:o<0?-1:1)|(a*Uo&63)<<2,a*Uo>>6)}var Zo=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(t){return t.id}),this.index=t.index,this.layoutVertexArray=new pn,this.indexArray=new En,this.programConfigurations=new Zn(zo,t.layers,t.zoom),this.segments=new Fn};function Go(t,e){return(t/e.tileTotal*(e.end-e.start)+e.start)*($o-1)}Zo.prototype.populate=function(t,e){for(var r=0,n=t;r=2&&t[u-1].equals(t[u-2]);)u--;for(var c=0;cc){var z=d.dist(x);if(z>2*h){var C=d.sub(d.sub(x)._mult(h/z)._round());this.distance+=C.dist(x),this.addCurrentVertex(C,this.distance,w.mult(1),0,0,!1,f,s),x=C}}var M=x&&b,P=M?r:b?g:v;if(M&&"round"===P&&(Ai&&(P="bevel"),"bevel"===P&&(A>2&&(P="flipbevel"),A100)T=E.clone().mult(-1);else{var L=w.x*E.y-w.y*E.x>0?-1:1,D=A*w.add(E).mag()/w.sub(E).mag();T._perp()._mult(D*L)}this.addCurrentVertex(d,this.distance,T,0,0,!1,f,s),this.addCurrentVertex(d,this.distance,T.mult(-1),0,0,!1,f,s)}else if("bevel"===P||"fakeround"===P){var R=w.x*E.y-w.y*E.x>0,B=-Math.sqrt(A*A-1);if(R?(y=0,m=B):(m=0,y=B),_||this.addCurrentVertex(d,this.distance,w,m,y,!1,f,s),"fakeround"===P){for(var O=Math.floor(8*(.5-(k-.5))),F=void 0,V=0;V=0;N--)F=w.mult((N+1)/(O+1))._add(E)._unit(),this.addPieSliceVertex(d,this.distance,F,R,f,s)}b&&this.addCurrentVertex(d,this.distance,E,-m,-y,!1,f,s)}else"butt"===P?(_||this.addCurrentVertex(d,this.distance,w,0,0,!1,f,s),b&&this.addCurrentVertex(d,this.distance,E,0,0,!1,f,s)):"square"===P?(_||(this.addCurrentVertex(d,this.distance,w,1,1,!1,f,s),this.e1=this.e2=-1),b&&this.addCurrentVertex(d,this.distance,E,-1,-1,!1,f,s)):"round"===P&&(_||(this.addCurrentVertex(d,this.distance,w,0,0,!1,f,s),this.addCurrentVertex(d,this.distance,w,1,1,!0,f,s),this.e1=this.e2=-1),b&&(this.addCurrentVertex(d,this.distance,E,-1,-1,!0,f,s),this.addCurrentVertex(d,this.distance,E,0,0,!1,f,s)));if(I&&S2*h){var U=d.add(b.sub(d)._mult(h/j)._round());this.distance+=U.dist(d),this.addCurrentVertex(U,this.distance,E.mult(1),0,0,!1,f,s),d=U}}_=!1}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,a)}},Zo.prototype.addCurrentVertex=function(t,e,r,n,i,o,a,s){var l,u=this.layoutVertexArray,c=this.indexArray;s&&(e=Go(e,s)),l=r.clone(),n&&l._sub(r.perp()._mult(n)),qo(u,t,l,o,!1,n,e),this.e3=a.vertexLength++,this.e1>=0&&this.e2>=0&&(c.emplaceBack(this.e1,this.e2,this.e3),a.primitiveLength++),this.e1=this.e2,this.e2=this.e3,l=r.mult(-1),i&&l._sub(r.perp()._mult(i)),qo(u,t,l,o,!0,-i,e),this.e3=a.vertexLength++,this.e1>=0&&this.e2>=0&&(c.emplaceBack(this.e1,this.e2,this.e3),a.primitiveLength++),this.e1=this.e2,this.e2=this.e3,e>$o/2&&!s&&(this.distance=0,this.addCurrentVertex(t,this.distance,r,n,i,o,a))},Zo.prototype.addPieSliceVertex=function(t,e,r,n,i,o){r=r.mult(n?-1:1);var a=this.layoutVertexArray,s=this.indexArray;o&&(e=Go(e,o)),qo(a,t,r,!1,n,0,e),this.e3=i.vertexLength++,this.e1>=0&&this.e2>=0&&(s.emplaceBack(this.e1,this.e2,this.e3),i.primitiveLength++),n?this.e2=this.e3:this.e1=this.e3},Tr("LineBucket",Zo,{omit:["layers"]});var Wo=new en({"line-cap":new Jr(V.layout_line["line-cap"]),"line-join":new Yr(V.layout_line["line-join"]),"line-miter-limit":new Jr(V.layout_line["line-miter-limit"]),"line-round-limit":new Jr(V.layout_line["line-round-limit"])}),Xo={paint:new en({"line-opacity":new Yr(V.paint_line["line-opacity"]),"line-color":new Yr(V.paint_line["line-color"]),"line-translate":new Jr(V.paint_line["line-translate"]),"line-translate-anchor":new Jr(V.paint_line["line-translate-anchor"]),"line-width":new Yr(V.paint_line["line-width"]),"line-gap-width":new Yr(V.paint_line["line-gap-width"]),"line-offset":new Yr(V.paint_line["line-offset"]),"line-blur":new Yr(V.paint_line["line-blur"]),"line-dasharray":new Qr(V.paint_line["line-dasharray"]),"line-pattern":new Qr(V.paint_line["line-pattern"]),"line-gradient":new tn(V.paint_line["line-gradient"])}),layout:Wo},Ho=new(function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.possiblyEvaluate=function(e,r){return r=new Ur(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),t.prototype.possiblyEvaluate.call(this,e,r)},e.prototype.evaluate=function(e,r,n,i){return r=v({},r,{zoom:Math.floor(r.zoom)}),t.prototype.evaluate.call(this,e,r,n,i)},e}(Yr))(Xo.paint.properties["line-width"].specification);Ho.useIntegerZoom=!0;var Ko=function(t){function e(e){t.call(this,e,Xo)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._handleSpecialPaintPropertyUpdate=function(t){"line-gradient"===t&&this._updateGradient()},e.prototype._updateGradient=function(){var t=this._transitionablePaint._values["line-gradient"].value.expression;this.gradient=Di(t,"lineProgress"),this.gradientTexture=null},e.prototype.recalculate=function(e){t.prototype.recalculate.call(this,e),this.paint._values["line-floorwidth"]=Ho.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)},e.prototype.createBucket=function(t){return new Zo(t)},e.prototype.queryRadius=function(t){var e=t,r=Jo(li("line-width",this,e),li("line-gap-width",this,e)),n=li("line-offset",this,e);return r/2+Math.abs(n)+ui(this.paint.get("line-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,i,o,a){var s=ci(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),o.angle,a),l=a/2*Jo(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),u=this.paint.get("line-offset").evaluate(e,r);return u&&(n=function(t,e){for(var r=[],n=new p(0,0),i=0;i0?e+2*t:t}var Yo=sn([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"}]),Qo=sn([{name:"a_projected_pos",components:3,type:"Float32"}],4),ta=(sn([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),sn([{name:"a_placed",components:2,type:"Uint8"}],4)),ea=(sn([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"},{type:"Int16",name:"radius"},{type:"Int16",name:"signedDistanceFromAnchor"}]),sn([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4)),ra=sn([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4);function na(t,e,r){var n=e.layout.get("text-transform").evaluate(r,{});return"uppercase"===n?t=t.toLocaleUpperCase():"lowercase"===n&&(t=t.toLocaleLowerCase()),jr.applyArabicShaping&&(t=jr.applyArabicShaping(t)),t}sn([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"hidden"}]),sn([{type:"Float32",name:"offsetX"}]),sn([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var ia={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},oa=function(t){function e(e,r,n,i){t.call(this,e,r),this.angle=n,void 0!==i&&(this.segment=i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.clone=function(){return new e(this.x,this.y,this.angle,this.segment)},e}(p);function aa(t,e){var r=e.expression;if("constant"===r.kind)return{functionType:"constant",layoutSize:r.evaluate(new Ur(t+1))};if("source"===r.kind)return{functionType:"source"};for(var n=r.zoomStops,i=0;i0)&&("constant"!==i.value.kind||i.value.value.length>0),l="constant"!==a.value.kind||a.value.value&&a.value.value.length>0;if(this.features=[],s||l){for(var u=e.iconDependencies,c=e.glyphDependencies,h=new Ur(this.zoom),p=0,f=t;p=0;s--)o[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:i},s>0&&(i+=e[s-1].dist(e[s]));for(var l=0;l0;this.addCollisionDebugVertices(s,l,u,c,h?this.collisionCircle:this.collisionBox,a.anchorPoint,r,h)}}}},fa.prototype.deserializeCollisionBoxes=function(t,e,r,n,i){for(var o={},a=e;a0},fa.prototype.hasIconData=function(){return this.icon.segments.get().length>0},fa.prototype.hasCollisionBoxData=function(){return this.collisionBox.segments.get().length>0},fa.prototype.hasCollisionCircleData=function(){return this.collisionCircle.segments.get().length>0},fa.prototype.sortFeatures=function(t){var e=this;if(this.sortFeaturesByY&&this.sortedAngle!==t&&(this.sortedAngle=t,!(this.text.segments.get().length>1||this.icon.segments.get().length>1))){for(var r=[],n=0;ni.maxh||t>i.maxw||r<=i.maxh&&t<=i.maxw&&(a=i.maxw*i.maxh-t*r)o.free)){if(r===o.h)return this.allocShelf(s,t,r,n);r>o.h||rc)&&(h=2*Math.max(t,c)),(ll)&&(u=2*Math.max(r,l)),this.resize(h,u),this.packOne(t,r,n)):null},t.prototype.allocFreebin=function(t,e,r,n){var i=this.freebins.splice(t,1)[0];return i.id=n,i.w=e,i.h=r,i.refcount=0,this.bins[n]=i,this.ref(i),i},t.prototype.allocShelf=function(t,e,r,n){var i=this.shelves[t].alloc(e,r,n);return this.bins[n]=i,this.ref(i),i},t.prototype.shrink=function(){if(this.shelves.length>0){for(var t=0,e=0,r=0;rthis.free||e>this.h)return null;var n=this.x;return this.x+=t,this.free-=t,new function(t,e,r,n,i,o,a){this.id=t,this.x=e,this.y=r,this.w=n,this.h=i,this.maxw=o||n,this.maxh=a||i,this.refcount=0}(r,n,this.y,t,e,t,this.h)},e.prototype.resize=function(t){return this.free+=t-this.w,this.w=t,!0},t}()}),wa=function(t,e){var r=e.pixelRatio;this.paddedRect=t,this.pixelRatio=r},Ea={tl:{configurable:!0},br:{configurable:!0},displaySize:{configurable:!0}};Ea.tl.get=function(){return[this.paddedRect.x+1,this.paddedRect.y+1]},Ea.br.get=function(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]},Ea.displaySize.get=function(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]},Object.defineProperties(wa.prototype,Ea);var Sa=function(t){var e=new Pi({width:0,height:0}),r={},n=new ba(0,0,{autoResize:!0});for(var i in t){var o=t[i],a=n.packOne(o.data.width+2,o.data.height+2);e.resize({width:n.w,height:n.h}),Pi.copy(o.data,e,{x:0,y:0},{x:a.x+1,y:a.y+1},o.data),r[i]=new wa(a,o)}n.shrink(),e.resize({width:n.w,height:n.h}),this.image=e,this.positions=r};Tr("ImagePosition",wa),Tr("ImageAtlas",Sa);var Ta=self.HTMLImageElement,ka=self.HTMLCanvasElement,Aa=self.HTMLVideoElement,Ia=self.ImageData,za=function(t,e,r,n){this.context=t,this.format=r,this.texture=t.gl.createTexture(),this.update(e,n)};za.prototype.update=function(t,e){var r=t.width,n=t.height,i=!this.size||this.size[0]!==r||this.size[1]!==n,o=this.context,a=o.gl;this.useMipmap=Boolean(e&&e.useMipmap),a.bindTexture(a.TEXTURE_2D,this.texture),i?(this.size=[r,n],o.pixelStoreUnpack.set(1),this.format!==a.RGBA||e&&!1===e.premultiply||o.pixelStoreUnpackPremultiplyAlpha.set(!0),t instanceof Ta||t instanceof ka||t instanceof Aa||t instanceof Ia?a.texImage2D(a.TEXTURE_2D,0,this.format,this.format,a.UNSIGNED_BYTE,t):a.texImage2D(a.TEXTURE_2D,0,this.format,r,n,0,this.format,a.UNSIGNED_BYTE,t.data)):t instanceof Ta||t instanceof ka||t instanceof Aa||t instanceof Ia?a.texSubImage2D(a.TEXTURE_2D,0,0,0,a.RGBA,a.UNSIGNED_BYTE,t):a.texSubImage2D(a.TEXTURE_2D,0,0,0,r,n,a.RGBA,a.UNSIGNED_BYTE,t.data),this.useMipmap&&this.isSizePowerOfTwo()&&a.generateMipmap(a.TEXTURE_2D)},za.prototype.bind=function(t,e,r){var n=this.context.gl;n.bindTexture(n.TEXTURE_2D,this.texture),r!==n.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(r=n.LINEAR),t!==this.filter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,r||t),this.filter=t),e!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,e),this.wrap=e)},za.prototype.isSizePowerOfTwo=function(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0},za.prototype.destroy=function(){this.context.gl.deleteTexture(this.texture),this.texture=null};var Ca=function(t,e,r,n,i){var o,a,s=8*i-n-1,l=(1<>1,c=-7,h=r?i-1:0,p=r?-1:1,f=t[e+h];for(h+=p,o=f&(1<<-c)-1,f>>=-c,c+=s;c>0;o=256*o+t[e+h],h+=p,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=256*a+t[e+h],h+=p,c-=8);if(0===o)o=1-u;else{if(o===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,n),o-=u}return(f?-1:1)*a*Math.pow(2,o-n)},Ma=function(t,e,r,n,i,o){var a,s,l,u=8*o-i-1,c=(1<>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,d=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),(e+=a+h>=1?p/l:p*Math.pow(2,1-h))*l>=2&&(a++,l/=2),a+h>=c?(s=0,a=c):a+h>=1?(s=(e*l-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+f]=255&s,f+=d,s/=256,i-=8);for(a=a<0;t[r+f]=255&a,f+=d,a/=256,u-=8);t[r+f-d]|=128*m},Pa=La;function La(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}function Da(t){return t.type===La.Bytes?t.readVarint()+t.pos:t.pos+1}function Ra(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Ba(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.ceil(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function Oa(t,e){for(var r=0;r>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function Xa(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}La.Varint=0,La.Fixed64=1,La.Bytes=2,La.Fixed32=5,La.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos>3,o=this.pos;this.type=7&n,t(i,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=Ga(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Xa(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Ga(this.buf,this.pos)+4294967296*Ga(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=Ga(this.buf,this.pos)+4294967296*Xa(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=Ca(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Ca(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,i,o=r.buf;if(n=(112&(i=o[r.pos++]))>>4,i<128)return Ra(t,n,e);if(n|=(127&(i=o[r.pos++]))<<3,i<128)return Ra(t,n,e);if(n|=(127&(i=o[r.pos++]))<<10,i<128)return Ra(t,n,e);if(n|=(127&(i=o[r.pos++]))<<17,i<128)return Ra(t,n,e);if(n|=(127&(i=o[r.pos++]))<<24,i<128)return Ra(t,n,e);if(n|=(1&(i=o[r.pos++]))<<31,i<128)return Ra(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=function(t,e,r){for(var n="",i=e;i239?4:l>223?3:l>191?2:1;if(i+c>r)break;1===c?l<128&&(u=l):2===c?128==(192&(o=t[i+1]))&&(u=(31&l)<<6|63&o)<=127&&(u=null):3===c?(o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&((u=(15&l)<<12|(63&o)<<6|63&a)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&((u=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,n+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),n+=String.fromCharCode(u),i+=c}return n}(this.buf,this.pos,t);return this.pos=t,e},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){var r=Da(this);for(t=t||[];this.pos127;);else if(e===La.Bytes)this.pos=this.readVarint()+this.pos;else if(e===La.Fixed32)this.pos+=4;else{if(e!==La.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455||t<0?function(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos]=127&t}(r,0,e),function(t,e){var r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,r){for(var n,i,o=0;o55295&&n<57344){if(!i){n>56319||o+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128)}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&Ba(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),Ma(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Ma(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r=128&&Ba(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,La.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){this.writeMessage(t,Oa,e)},writePackedSVarint:function(t,e){this.writeMessage(t,Fa,e)},writePackedBoolean:function(t,e){this.writeMessage(t,ja,e)},writePackedFloat:function(t,e){this.writeMessage(t,Va,e)},writePackedDouble:function(t,e){this.writeMessage(t,Na,e)},writePackedFixed32:function(t,e){this.writeMessage(t,Ua,e)},writePackedSFixed32:function(t,e){this.writeMessage(t,$a,e)},writePackedFixed64:function(t,e){this.writeMessage(t,qa,e)},writePackedSFixed64:function(t,e){this.writeMessage(t,Za,e)},writeBytesField:function(t,e){this.writeTag(t,La.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,La.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,La.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,La.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,La.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,La.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,La.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,La.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,La.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,La.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var Ha=3;function Ka(t,e,r){1===t&&r.readMessage(Ja,e)}function Ja(t,e,r){if(3===t){var n=r.readMessage(Ya,{}),i=n.id,o=n.bitmap,a=n.width,s=n.height,l=n.left,u=n.top,c=n.advance;e.push({id:i,bitmap:new Mi({width:a+2*Ha,height:s+2*Ha},o),metrics:{width:a,height:s,left:l,top:u,advance:c}})}}function Ya(t,e,r){1===t?e.id=r.readVarint():2===t?e.bitmap=r.readBytes():3===t?e.width=r.readVarint():4===t?e.height=r.readVarint():5===t?e.left=r.readSVarint():6===t?e.top=r.readSVarint():7===t&&(e.advance=r.readVarint())}var Qa=Ha,ts=function(t,e,r){this.target=t,this.parent=e,this.mapId=r,this.callbacks={},this.callbackID=0,b(["receive"],this),this.target.addEventListener("message",this.receive,!1)};ts.prototype.send=function(t,e,r,n){var i=r?this.mapId+":"+this.callbackID++:null;r&&(this.callbacks[i]=r);var o=[];this.target.postMessage({targetMapId:n,sourceMapId:this.mapId,type:t,id:String(i),data:Ar(e,o)},o)},ts.prototype.receive=function(t){var e,r=this,n=t.data,i=n.id;if(!n.targetMapId||this.mapId===n.targetMapId){var o=function(t,e){var n=[];r.target.postMessage({sourceMapId:r.mapId,type:"",id:String(i),error:t?Ar(t):null,data:Ar(e,n)},n)};if(""===n.type)e=this.callbacks[n.id],delete this.callbacks[n.id],e&&n.error?e(Ir(n.error)):e&&e(null,Ir(n.data));else if(void 0!==n.id&&this.parent[n.type])this.parent[n.type](n.sourceMapId,Ir(n.data),o);else if(void 0!==n.id&&this.parent.getWorkerSource){var a=n.type.split("."),s=Ir(n.data);this.parent.getWorkerSource(n.sourceMapId,a[0],s.source)[a[1]](s,o)}else this.parent[n.type](Ir(n.data))}},ts.prototype.remove=function(){this.target.removeEventListener("message",this.receive,!1)};var es=n(function(t,e){!function(t){function e(t,e,n){var i=r(256*t,256*(e=Math.pow(2,n)-e-1),n),o=r(256*(t+1),256*(e+1),n);return i[0]+","+i[1]+","+o[0]+","+o[1]}function r(t,e,r){var n=2*Math.PI*6378137/256/Math.pow(2,r);return[t*n-2*Math.PI*6378137/2,e*n-2*Math.PI*6378137/2]}t.getURL=function(t,r,n,i,o,a){return a=a||{},t+"?"+["bbox="+e(n,i,o),"format="+(a.format||"image/png"),"service="+(a.service||"WMS"),"version="+(a.version||"1.1.1"),"request="+(a.request||"GetMap"),"srs="+(a.srs||"EPSG:3857"),"width="+(a.width||256),"height="+(a.height||256),"layers="+r].join("&")},t.getTileBBox=e,t.getMercCoords=r,Object.defineProperty(t,"__esModule",{value:!0})}(e)});r(es);var rs=es.getTileBBox,ns=function(t,e,r){this.z=t,this.x=e,this.y=r,this.key=as(0,t,e,r)};ns.prototype.equals=function(t){return this.z===t.z&&this.x===t.x&&this.y===t.y},ns.prototype.url=function(t,e){var r=rs(this.x,this.y,this.z),n=function(t,e,r){for(var n,i="",o=t;o>0;o--)i+=(e&(n=1<this.canonical.z?new os(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new os(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)},os.prototype.isChildOf=function(t){var e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ>e&&t.canonical.y===this.canonical.y>>e},os.prototype.children=function(t){if(this.overscaledZ>=t)return[new os(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];var e=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return[new os(e,this.wrap,e,r,n),new os(e,this.wrap,e,r+1,n),new os(e,this.wrap,e,r,n+1),new os(e,this.wrap,e,r+1,n+1)]},os.prototype.isLessThan=function(t){return this.wrapt.wrap)&&(this.overscaledZt.overscaledZ)&&(this.canonical.xt.canonical.x)&&this.canonical.y=this.dim+this.border||e<-this.border||e>=this.dim+this.border)throw new RangeError("out of range source coordinates for DEM data");return(e+this.border)*this.stride+(t+this.border)},Tr("Level",ss);var ls=function(t,e,r){this.uid=t,this.scale=e||1,this.level=r||new ss(256,512),this.loaded=!!r};ls.prototype.loadFromImage=function(t,e){if(t.height!==t.width)throw new RangeError("DEM tiles must be square");if(e&&"mapbox"!==e&&"terrarium"!==e)return A('"'+e+'" is not a valid encoding type. Valid types include "mapbox" and "terrarium".');var r=this.level=new ss(t.width,t.width/2),n=t.data;this._unpackData(r,n,e||"mapbox");for(var i=0;i=0&&l[3]>=0&&this.grid.insert(o,l[0],l[1],l[2],l[3])}},ds.prototype.loadVTLayers=function(){return this.vtLayers||(this.vtLayers=new Fo.VectorTile(new Pa(this.rawTileData)).layers,this.sourceLayerCoder=new cs(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers},ds.prototype.query=function(t,e,r){var n=this;this.loadVTLayers();for(var i=t.params||{},o=Wn/t.tileSize/t.scale,a=Xe(i.filter),s=t.queryGeometry,l=t.queryPadding*o,u=1/0,c=1/0,h=-1/0,p=-1/0,f=0;f=0)return!0;return!1}(o,l)){var u=this.sourceLayerCoder.decode(r),c=this.vtLayers[u].feature(n);if(i(new Ur(this.tileID.overscaledZ),c))for(var h=0;h>a.z,l=new p(a.x*s,a.y*s),u=new p(l.x+s,l.y+s),c=this.segments.prepareSegment(4,r,n);r.emplaceBack(l.x,l.y,l.x,l.y),r.emplaceBack(u.x,l.y,u.x,l.y),r.emplaceBack(l.x,u.y,l.x,u.y),r.emplaceBack(u.x,u.y,u.x,u.y);var h=c.vertexLength;n.emplaceBack(h,h+1,h+2),n.emplaceBack(h+1,h+2,h+3),c.vertexLength+=4,c.primitiveLength+=2}this.maskedBoundsBuffer=e.createVertexBuffer(r,us.members),this.maskedIndexBuffer=e.createIndexBuffer(n)}},ys.prototype.hasData=function(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state},ys.prototype.setExpiryData=function(t){var e=this.expirationTime;if(t.cacheControl){var r=function(t){var e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,function(t,r,n,i){var o=n||i;return e[r]=!o||o.toLowerCase(),""}),e["max-age"]){var r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e}(t.cacheControl);r["max-age"]&&(this.expirationTime=Date.now()+1e3*r["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){var n=Date.now(),i=!1;if(this.expirationTime>n)i=!1;else if(e)if(this.expirationTime=200&&r.status<300&&r.response){var n;try{n=JSON.parse(r.response)}catch(t){return e(t)}e(null,n)}else 401===r.status&&t.url.match(/mapbox.com/)?e(new M(r.statusText+": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens",r.status,t.url)):e(new M(r.statusText,r.status,t.url))},r.send(),r},t.getImage=function(t,e){return L(t,function(t,r){if(t)e(t);else if(r){var n=new self.Image,i=self.URL||self.webkitURL;n.onload=function(){e(null,n),i.revokeObjectURL(n.src)};var o=new self.Blob([new Uint8Array(r.data)],{type:"image/png"});n.cacheControl=r.cacheControl,n.expires=r.expires,n.src=r.data.byteLength?i.createObjectURL(o):"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII="}})},t.ResourceType=C,t.RGBAImage=Pi,t.default$3=ba,t.ImagePosition=wa,t.default$4=za,t.getArrayBuffer=L,t.default$5=function(t){return new Pa(t).readFields(Ka,[])},t.default$6=Cr,t.asyncAll=function(t,e,r){if(!t.length)return r(null,[]);var n=t.length,i=new Array(t.length),o=null;t.forEach(function(t,a){e(t,function(t,e){t&&(o=t),i[a]=e,0==--n&&r(o,i)})})},t.AlphaImage=Mi,t.default$7=V,t.endsWith=w,t.extend=v,t.sphericalToCartesian=function(t){var e=t[0],r=t[1],n=t[2];return r+=90,r*=Math.PI/180,n*=Math.PI/180,{x:e*Math.cos(r)*Math.sin(n),y:e*Math.sin(r)*Math.sin(n),z:e*Math.cos(n)}},t.Evented=F,t.validateStyle=mr,t.validateLight=yr,t.emitValidationErrors=_r,t.default$8=at,t.number=Mt,t.Properties=en,t.Transitionable=Zr,t.Transitioning=Wr,t.PossiblyEvaluated=Kr,t.DataConstantProperty=Jr,t.warnOnce=A,t.uniqueId=x,t.default$9=ts,t.pick=function(t,e){for(var r={},n=0;n0&&(o=1/Math.sqrt(o),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o),t},t.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},t.cross=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[0],s=r[1],l=r[2];return t[0]=i*l-o*s,t[1]=o*a-n*l,t[2]=n*s-i*a,t},t.transformMat3=function(t,e,r){var n=e[0],i=e[1],o=e[2];return t[0]=n*r[0]+i*r[3]+o*r[6],t[1]=n*r[1]+i*r[4]+o*r[7],t[2]=n*r[2]+i*r[5]+o*r[8],t},t.len=vi,t.forEach$1=_i,t.PosArray=un,t.UnwrappedTileID=is,t.create$4=function(){var t=new pi(4);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},t.rotate=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l+o*s,t[1]=i*l+a*s,t[2]=n*-s+o*l,t[3]=i*-s+a*l,t},t.ease=y,t.bezier=m,t.default$23=Ur,t.setRTLTextPlugin=function(t,e){if(Or)throw new Error("setRTLTextPlugin cannot be called multiple times.");Or=!0,Fr=s.resolveURL(t),Br=function(t){t?(Or=!1,Fr=null,e&&e(t)):Vr=!0},Nr.fire(new B("pluginAvailable",{pluginURL:Fr,completionCallback:Br}))},t.values=function(t){var e=[];for(var r in t)e.push(t[r]);return e},t.default$24=Xe,t.default$25=oa,t.register=Tr,t.GLYPH_PBF_BORDER=Qa,t.shapeText=function(t,e,r,n,i,o,a,s,l,u){var c=t.trim();u===gs.vertical&&(c=function(t){for(var e="",r=0;r-r/2;){if(--a<0)return!1;s-=t[a].dist(o),o=t[a]}s+=t[a].dist(t[a+1]),a++;for(var l=[],u=0;sn;)u-=l.shift().angleDelta;if(u>i)return!1;a++,s+=h.dist(p)}return!0}function o(e,r,n,o,a,s,l,u,c){var h=o?.6*s*l:0,p=Math.max(o?o.right-o.left:0,a?a.right-a.left:0),f=0===e[0].x||e[0].x===c||0===e[0].y||e[0].y===c;return r-p*l=0&&S=0&&T=0&&y+p<=f){var k=new t.default$25(S,T,w,v);k._round(),a&&!i(r,k,l,a,s)||g.push(k)}}m+=b}return c||g.length||u||(g=e(r,m/2,o,a,s,l,u,!0,h)),g}(e,f?r/2*u%r:(p/2+2*s)*l*u%r,r,h,n,p*l,f,!1,c)}n.prototype.replace=function(t){this._layerConfigs={},this._layers={},this.update(t,[])},n.prototype.update=function(e,n){for(var i=this,o=0,a=e;o0&&(g=Math.max(10*l,g),this._addLineCollisionCircles(e,r,n,n.segment,v,g,i,o,a,h))}else{if(p){var _=new t.default(m,f),x=new t.default(y,f),b=new t.default(m,d),w=new t.default(y,d),E=p*Math.PI/180;_._rotate(E),x._rotate(E),b._rotate(E),w._rotate(E),m=Math.min(_.x,x.x,b.x,w.x),y=Math.max(_.x,x.x,b.x,w.x),f=Math.min(_.y,x.y,b.y,w.y),d=Math.max(_.y,x.y,b.y,w.y)}e.emplaceBack(n.x,n.y,m,f,y,d,i,o,a,0,0)}this.boxEndIndex=e.length};s.prototype._addLineCollisionCircles=function(t,e,r,n,i,o,a,s,l,u){var c=o/2,h=Math.floor(i/c),p=1+.4*Math.log(u)/Math.LN2,f=Math.floor(h*p/2),d=-o/2,m=r,y=n+1,g=d,v=-i/2,_=v-i/4;do{if(--y<0){if(g>v)return;y=0;break}g-=e[y].dist(m),m=e[y]}while(g>_);for(var x=e[y].dist(e[y+1]),b=-f;bi&&(E+=w-i),!(E=e.length)return;x=e[y].dist(e[y+1])}var S=E-g,T=e[y],k=e[y+1].sub(T)._unit()._mult(S)._add(T)._round(),A=Math.abs(E-d)0)for(var r=(this.length>>1)-1;r>=0;r--)this._down(r)}function h(t,e){return te?1:0}function p(e,r,n){void 0===r&&(r=1),void 0===n&&(n=!1);for(var i=1/0,o=1/0,a=-1/0,s=-1/0,u=e[0],c=0;ca)&&(a=h.x),(!c||h.y>s)&&(s=h.y)}var p=a-i,m=s-o,y=Math.min(p,m),g=y/2,v=new l(null,f);if(0===y)return new t.default(i,o);for(var _=i;_b.d||!b.d)&&(b=E,n&&console.log("found best %d after %d probes",Math.round(1e4*E.d)/1e4,w)),E.max-b.d<=r||(g=E.h/2,v.push(new d(E.p.x-g,E.p.y-g,g,e)),v.push(new d(E.p.x+g,E.p.y-g,g,e)),v.push(new d(E.p.x-g,E.p.y+g,g,e)),v.push(new d(E.p.x+g,E.p.y+g,g,e)),w+=4)}return n&&(console.log("num probes: "+w),console.log("best distance: "+b.d)),b.p}function f(t,e){return e.max-t.max}function d(e,r,n,i){this.p=new t.default(e,r),this.h=n,this.d=function(e,r){for(var n=!1,i=1/0,o=0;oe.y!=h.y>e.y&&e.x<(h.x-c.x)*(e.y-c.y)/(h.y-c.y)+c.x&&(n=!n),i=Math.min(i,t.distToSegmentSquared(e,c,h))}return(n?1:-1)*Math.sqrt(i)}(this.p,i),this.max=this.d+this.h*Math.SQRT2}function m(e,r,n,i,o,a){e.createArrays(),e.symbolInstances=[];var s=512*e.overscaling;e.tilePixelRatio=t.default$10/s,e.compareText={},e.iconsNeedLinear=!1;var l=e.layers[0].layout,u=e.layers[0]._unevaluatedLayout._values,c={};if("composite"===e.textSizeData.functionType){var h=e.textSizeData.zoomRange,p=h.min,f=h.max;c.compositeTextSizes=[u["text-size"].possiblyEvaluate(new t.default$23(p)),u["text-size"].possiblyEvaluate(new t.default$23(f))]}if("composite"===e.iconSizeData.functionType){var d=e.iconSizeData.zoomRange,m=d.min,g=d.max;c.compositeIconSizes=[u["icon-size"].possiblyEvaluate(new t.default$23(m)),u["icon-size"].possiblyEvaluate(new t.default$23(g))]}c.layoutTextSize=u["text-size"].possiblyEvaluate(new t.default$23(e.zoom+1)),c.layoutIconSize=u["icon-size"].possiblyEvaluate(new t.default$23(e.zoom+1)),c.textMaxSize=u["text-size"].possiblyEvaluate(new t.default$23(18));for(var v=24*l.get("text-line-height"),_="map"===l.get("text-rotation-alignment")&&"line"===l.get("symbol-placement"),x=l.get("text-keep-upright"),b=0,w=e.features;b=t.default$10||c.y<0||c.y>=t.default$10||e.symbolInstances.push(function(e,r,n,i,o,l,u,c,h,p,f,d,m,y,v,_,x,b,w,E,S){var T,k,A=e.addToLineVertexArray(r,n),I=0,z=0,C=0,M=i.horizontal?i.horizontal.text:"",P=[];if(i.horizontal){var L=l.layout.get("text-rotate").evaluate(w,{});T=new s(u,n,r,c,h,p,i.horizontal,f,d,m,e.overscaling,L),z+=g(e,r,i.horizontal,l,m,w,y,A,i.vertical?t.WritingMode.horizontal:t.WritingMode.horizontalOnly,P,E,S),i.vertical&&(C+=g(e,r,i.vertical,l,m,w,y,A,t.WritingMode.vertical,P,E,S))}var D=T?T.boxStartIndex:e.collisionBoxArray.length,R=T?T.boxEndIndex:e.collisionBoxArray.length;if(o){var B=function(e,r,n,i,o,a){var s,l,u,c,h=r.image,p=n.layout,f=r.top-1/h.pixelRatio,d=r.left-1/h.pixelRatio,m=r.bottom+1/h.pixelRatio,y=r.right+1/h.pixelRatio;if("none"!==p.get("icon-text-fit")&&o){var g=y-d,v=m-f,_=p.get("text-size").evaluate(a,{})/24,x=o.left*_,b=o.right*_,w=o.top*_,E=b-x,S=o.bottom*_-w,T=p.get("icon-text-fit-padding")[0],k=p.get("icon-text-fit-padding")[1],A=p.get("icon-text-fit-padding")[2],I=p.get("icon-text-fit-padding")[3],z="width"===p.get("icon-text-fit")?.5*(S-v):0,C="height"===p.get("icon-text-fit")?.5*(E-g):0,M="width"===p.get("icon-text-fit")||"both"===p.get("icon-text-fit")?E:g,P="height"===p.get("icon-text-fit")||"both"===p.get("icon-text-fit")?S:v;s=new t.default(x+C-I,w+z-T),l=new t.default(x+C+k+M,w+z-T),u=new t.default(x+C+k+M,w+z+A+P),c=new t.default(x+C-I,w+z+A+P)}else s=new t.default(d,f),l=new t.default(y,f),u=new t.default(y,m),c=new t.default(d,m);var L=n.layout.get("icon-rotate").evaluate(a,{})*Math.PI/180;if(L){var D=Math.sin(L),R=Math.cos(L),B=[R,-D,D,R];s._matMult(B),l._matMult(B),c._matMult(B),u._matMult(B)}return[{tl:s,tr:l,bl:c,br:u,tex:h.paddedRect,writingMode:void 0,glyphOffset:[0,0]}]}(0,o,l,0,i.horizontal,w),O=l.layout.get("icon-rotate").evaluate(w,{});k=new s(u,n,r,c,h,p,o,v,_,!1,e.overscaling,O),I=4*B.length;var F=e.iconSizeData,V=null;"source"===F.functionType?V=[10*l.layout.get("icon-size").evaluate(w,{})]:"composite"===F.functionType&&(V=[10*S.compositeIconSizes[0].evaluate(w,{}),10*S.compositeIconSizes[1].evaluate(w,{})]),e.addSymbols(e.icon,B,V,b,x,w,!1,r,A.lineStartIndex,A.lineLength)}var N=k?k.boxStartIndex:e.collisionBoxArray.length,j=k?k.boxEndIndex:e.collisionBoxArray.length;return e.glyphOffsetArray.length>=t.default$27.MAX_GLYPHS&&t.warnOnce("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),{key:M,textBoxStartIndex:D,textBoxEndIndex:R,iconBoxStartIndex:N,iconBoxEndIndex:j,textOffset:y,iconOffset:b,anchor:r,line:n,featureIndex:c,feature:w,numGlyphVertices:z,numVerticalGlyphVertices:C,numIconVertices:I,textOpacityState:new a,iconOpacityState:new a,isDuplicate:!1,placedTextSymbolIndices:P,crossTileID:0}}(e,c,o,n,i,e.layers[0],e.collisionBoxArray,r.index,r.sourceLayerIndex,e.index,x,S,A,m,w,T,I,y,r,l,u))};if("line"===d.get("symbol-placement"))for(var M=0,P=function(e,r,n,i,o){for(var a=[],s=0;s=i&&p.x>=i||(h.x>=i?h=new t.default(i,h.y+(p.y-h.y)*((i-h.x)/(p.x-h.x)))._round():p.x>=i&&(p=new t.default(i,h.y+(p.y-h.y)*((i-h.x)/(p.x-h.x)))._round()),h.y>=o&&p.y>=o||(h.y>=o?h=new t.default(h.x+(p.x-h.x)*((o-h.y)/(p.y-h.y)),o)._round():p.y>=o&&(p=new t.default(h.x+(p.x-h.x)*((o-h.y)/(p.y-h.y)),o)._round()),u&&h.equals(u[u.length-1])||(u=[h],a.push(u)),u.push(p)))))}return a}(r.geometry,0,0,t.default$10,t.default$10);M=0;a--)if(n.dist(o[a])0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),t}},peek:function(){return this.data[0]},_up:function(t){for(var e=this.data,r=this.compare,n=e[t];t>0;){var i=t-1>>1,o=e[i];if(r(n,o)>=0)break;e[t]=o,t=i}e[t]=n},_down:function(t){for(var e=this.data,r=this.compare,n=this.length>>1,i=e[t];t=0)break;e[t]=s,t=o}e[t]=i}},l.default=u;var _=function(e){var r=new t.AlphaImage({width:0,height:0}),n={},i=new t.default$3(0,0,{autoResize:!0});for(var o in e){var a=e[o],s=n[o]={};for(var l in a){var u=a[+l];if(u&&0!==u.bitmap.width&&0!==u.bitmap.height){var c=i.packOne(u.bitmap.width+2,u.bitmap.height+2);r.resize({width:i.w,height:i.h}),t.AlphaImage.copy(u.bitmap,r,{x:0,y:0},{x:c.x+1,y:c.y+1},u.bitmap),s[l]={rect:c,metrics:u.metrics}}}}i.shrink(),r.resize({width:i.w,height:i.h}),this.image=r,this.positions=n};t.register("GlyphAtlas",_);var x=function(e){this.tileID=new t.OverscaledTileID(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.uid=e.uid,this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.collectResourceTiming=!!e.collectResourceTiming};function b(e,r){for(var n=new t.default$23(r),i=0,o=e;i=k.maxzoom||"none"!==k.visibility&&(b(T,o.zoom),(h[k.id]=k.createBucket({index:s.bucketLayerIDs.length,layers:T,zoom:o.zoom,pixelRatio:o.pixelRatio,overscaling:o.overscaling,collisionBoxArray:o.collisionBoxArray,sourceLayerIndex:g,sourceID:o.source})).populate(v,p),s.bucketLayerIDs.push(T.map(function(t){return t.id})))}}}var A=t.mapObject(p.glyphDependencies,function(t){return Object.keys(t).map(Number)});Object.keys(A).length?n.send("getGlyphs",{uid:this.uid,stacks:A},function(t,e){l||(l=t,u=e,z.call(o))}):u={};var I=Object.keys(p.iconDependencies);function z(){if(l)return i(l);if(u&&c){var e=new _(u),r=new t.default$30(c);for(var n in h){var o=h[n];o instanceof t.default$27&&(b(o.layers,this.zoom),m(o,u,e.positions,c,r.positions,this.showCollisionBoxes))}this.status="done",i(null,{buckets:t.values(h).filter(function(t){return!t.isEmpty()}),featureIndex:s,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,iconAtlasImage:r.image})}}I.length?n.send("getImages",{icons:I},function(t,e){l||(l=t,c=e,z.call(o))}):c={},z.call(this)};var w="undefined"!=typeof performance,E={getEntriesByName:function(t){return!!(w&&performance&&performance.getEntriesByName)&&performance.getEntriesByName(t)},mark:function(t){return!!(w&&performance&&performance.mark)&&performance.mark(t)},measure:function(t,e,r){return!!(w&&performance&&performance.measure)&&performance.measure(t,e,r)},clearMarks:function(t){return!!(w&&performance&&performance.clearMarks)&&performance.clearMarks(t)},clearMeasures:function(t){return!!(w&&performance&&performance.clearMeasures)&&performance.clearMeasures(t)}},S=function(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},E.mark(this._marks.start)};function T(e,r){var n=t.getArrayBuffer(e.request,function(e,n){e?r(e):n&&r(null,{vectorTile:new t.default$31.VectorTile(new t.default$32(n.data)),rawData:n.data,cacheControl:n.cacheControl,expires:n.expires})});return function(){n.abort(),r()}}S.prototype.finish=function(){E.mark(this._marks.end);var t=E.getEntriesByName(this._marks.measure);return 0===t.length&&(E.measure(this._marks.measure,this._marks.start,this._marks.end),t=E.getEntriesByName(this._marks.measure),E.clearMarks(this._marks.start),E.clearMarks(this._marks.end),E.clearMeasures(this._marks.measure)),t},E.Performance=S;var k=function(t,e,r){this.actor=t,this.layerIndex=e,this.loadVectorData=r||T,this.loading={},this.loaded={}};k.prototype.loadTile=function(e,r){var n=this,i=e.uid;this.loading||(this.loading={});var o=!!(e&&e.request&&e.request.collectResourceTiming)&&new E.Performance(e.request),a=this.loading[i]=new x(e);a.abort=this.loadVectorData(e,function(e,s){if(delete n.loading[i],e||!s)return r(e);var l=s.rawData,u={};s.expires&&(u.expires=s.expires),s.cacheControl&&(u.cacheControl=s.cacheControl);var c={};if(o){var h=o.finish();h&&(c.resourceTiming=JSON.parse(JSON.stringify(h)))}a.vectorTile=s.vectorTile,a.parse(s.vectorTile,n.layerIndex,n.actor,function(e,n){if(e||!n)return r(e);r(null,t.extend({rawTileData:l.slice(0)},n,u,c))}),n.loaded=n.loaded||{},n.loaded[i]=a})},k.prototype.reloadTile=function(t,e){var r=this.loaded,n=t.uid,i=this;if(r&&r[n]){var o=r[n];o.showCollisionBoxes=t.showCollisionBoxes;var a=function(t,r){var n=o.reloadCallback;n&&(delete o.reloadCallback,o.parse(o.vectorTile,i.layerIndex,i.actor,n)),e(t,r)};"parsing"===o.status?o.reloadCallback=a:"done"===o.status&&o.parse(o.vectorTile,this.layerIndex,this.actor,a)}},k.prototype.abortTile=function(t,e){var r=this.loading,n=t.uid;r&&r[n]&&r[n].abort&&(r[n].abort(),delete r[n]),e()},k.prototype.removeTile=function(t,e){var r=this.loaded,n=t.uid;r&&r[n]&&delete r[n],e()};var A=function(){this.loading={},this.loaded={}};A.prototype.loadTile=function(e,r){var n=e.uid,i=e.encoding,o=new t.default$33(n);this.loading[n]=o,o.loadFromImage(e.rawImageData,i),delete this.loading[n],this.loaded=this.loaded||{},this.loaded[n]=o,r(null,o)},A.prototype.removeTile=function(t){var e=this.loaded,r=t.uid;e&&e[r]&&delete e[r]};var I={RADIUS:6378137,FLATTENING:1/298.257223563,POLAR_RADIUS:6356752.3142};function z(t){var e=0;if(t&&t.length>0){e+=Math.abs(C(t[0]));for(var r=1;r2){for(a=0;a=0}(t)===e?t:t.reverse()}var B=t.default$31.VectorTileFeature.prototype.toGeoJSON,O=function(e){this._feature=e,this.extent=t.default$10,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))};O.prototype.loadGeometry=function(){if(1===this._feature.type){for(var e=[],r=0,n=this._feature.geometry;r>31}function Y(t,e){for(var r=t.loadGeometry(),n=t.type,i=0,o=0,a=r.length,s=0;si;){if(o-i>600){var s=o-i+1,l=n-i+1,u=Math.log(s),c=.5*Math.exp(2*u/3),h=.5*Math.sqrt(u*c*(s-c)/s)*(l-s/2<0?-1:1);t(e,r,n,Math.max(i,Math.floor(n-l*c/s+h)),Math.min(o,Math.floor(n+(s-l)*c/s+h)),a)}var p=r[2*n+a],f=i,d=o;for(et(e,r,i,n),r[2*o+a]>p&&et(e,r,i,o);fp;)d--}r[2*i+a]===p?et(e,r,i,d):et(e,r,++d,o),d<=n&&(i=d+1),n<=d&&(o=d-1)}}(e,r,s,i,o,a%2),t(e,r,n,i,s-1,a+1),t(e,r,n,s+1,o,a+1)}};function et(t,e,r,n){rt(t,r,n),rt(e,2*r,2*n),rt(e,2*r+1,2*n+1)}function rt(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function nt(t,e,r,n){var i=t-r,o=e-n;return i*i+o*o}var it=function(t,e,r,n,i){return new ot(t,e,r,n,i)};function ot(t,e,r,n,i){e=e||at,r=r||st,i=i||Array,this.nodeSize=n||64,this.points=t,this.ids=new i(t.length),this.coords=new i(2*t.length);for(var o=0;o=r&&s<=i&&l>=n&&l<=o&&c.push(t[d]);else{var m=Math.floor((f+p)/2);s=e[2*m],l=e[2*m+1],s>=r&&s<=i&&l>=n&&l<=o&&c.push(t[m]);var y=(h+1)%2;(0===h?r<=s:n<=l)&&(u.push(f),u.push(m-1),u.push(y)),(0===h?i>=s:o>=l)&&(u.push(m+1),u.push(p),u.push(y))}}return c}(this.ids,this.coords,t,e,r,n,this.nodeSize)},within:function(t,e,r){return function(t,e,r,n,i,o){for(var a=[0,t.length-1,0],s=[],l=i*i;a.length;){var u=a.pop(),c=a.pop(),h=a.pop();if(c-h<=o)for(var p=h;p<=c;p++)nt(e[2*p],e[2*p+1],r,n)<=l&&s.push(t[p]);else{var f=Math.floor((h+c)/2),d=e[2*f],m=e[2*f+1];nt(d,m,r,n)<=l&&s.push(t[f]);var y=(u+1)%2;(0===u?r-i<=d:n-i<=m)&&(a.push(h),a.push(f-1),a.push(y)),(0===u?r+i>=d:n+i>=m)&&(a.push(f+1),a.push(c),a.push(y))}}return s}(this.ids,this.coords,t,e,r,this.nodeSize)}};function lt(t){this.options=mt(Object.create(this.options),t),this.trees=new Array(this.options.maxZoom+1)}function ut(t,e,r,n,i){return{x:t,y:e,zoom:1/0,id:n,properties:i,parentId:-1,numPoints:r}}function ct(t,e){var r=t.geometry.coordinates;return{x:ft(r[0]),y:dt(r[1]),zoom:1/0,id:e,parentId:-1}}function ht(t){return{type:"Feature",properties:pt(t),geometry:{type:"Point",coordinates:[(n=t.x,360*(n-.5)),(e=t.y,r=(180-360*e)*Math.PI/180,360*Math.atan(Math.exp(r))/Math.PI-90)]}};var e,r,n}function pt(t){var e=t.numPoints,r=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return mt(mt({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:r})}function ft(t){return t/360+.5}function dt(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function mt(t,e){for(var r in e)t[r]=e[r];return t}function yt(t){return t.x}function gt(t){return t.y}function vt(t,e,r,n,i,o){var a=i-r,s=o-n;if(0!==a||0!==s){var l=((t-r)*a+(e-n)*s)/(a*a+s*s);l>1?(r=i,n=o):l>0&&(r+=a*l,n+=s*l)}return(a=t-r)*a+(s=e-n)*s}function _t(t,e,r,n){var i={id:t||null,type:e,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,r=t.type;if("Point"===r||"MultiPoint"===r||"LineString"===r)xt(t,e);else if("Polygon"===r||"MultiLineString"===r)for(var n=0;n0&&(a+=n?(i*u-l*o)/2:Math.sqrt(Math.pow(l-i,2)+Math.pow(u-o,2))),i=l,o=u}var c=e.length-3;e[2]=1,function t(e,r,n,i){for(var o,a=i,s=e[r],l=e[r+1],u=e[n],c=e[n+1],h=r+3;ha&&(o=h,a=p)}a>i&&(o-r>3&&t(e,r,o,i),e[o+2]=a,n-o>3&&t(e,o,n,i))}(e,0,c,r),e[c+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function St(t,e,r,n){for(var i=0;i1?1:r}function At(t,e,r,n,i,o,a,s){if(n/=e,o>=(r/=e)&&a=n)return null;for(var l=[],u=0;u=r&&d=n)){var m=[];if("Point"===p||"MultiPoint"===p)It(h,m,r,n,i);else if("LineString"===p)zt(h,m,r,n,i,!1,s.lineMetrics);else if("MultiLineString"===p)Mt(h,m,r,n,i,!1);else if("Polygon"===p)Mt(h,m,r,n,i,!0);else if("MultiPolygon"===p)for(var y=0;y=r&&a<=n&&(e.push(t[o]),e.push(t[o+1]),e.push(t[o+2]))}}function zt(t,e,r,n,i,o,a){for(var s,l,u=Ct(t),c=0===i?Lt:Dt,h=t.start,p=0;p=r&&(l=c(u,f,d,y,g,r),a&&(u.start=h+s*l)):v>=n?_=r&&(l=c(u,f,d,y,g,r),x=!0),_>n&&v<=n&&(l=c(u,f,d,y,g,n),x=!0),!o&&x&&(a&&(u.end=h+s*l),e.push(u),u=Ct(t)),a&&(h+=s)}var b=t.length-3;f=t[b],d=t[b+1],m=t[b+2],(v=0===i?f:d)>=r&&v<=n&&Pt(u,f,d,m),b=u.length-3,o&&b>=3&&(u[b]!==u[0]||u[b+1]!==u[1])&&Pt(u,u[0],u[1],u[2]),u.length&&e.push(u)}function Ct(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function Mt(t,e,r,n,i,o){for(var a=0;aa.maxX&&(a.maxX=c),h>a.maxY&&(a.maxY=h)}return a}function Nt(t,e,r,n){var i=e.geometry,o=e.type,a=[];if("Point"===o||"MultiPoint"===o)for(var s=0;s0&&e.size<(i?a:n))r.numPoints+=e.length/3;else{for(var s=[],l=0;la)&&(r.numSimplified++,s.push(e[l]),s.push(e[l+1])),r.numPoints++;i&&function(t,e){for(var r=0,n=0,i=t.length,o=i-2;n0===e)for(n=0,i=t.length;n24)throw new Error("maxZoom should be in the 0-24 range");var n=function(t,e){var r=[];if("FeatureCollection"===t.type)for(var n=0;n=this.options.minZoom;i--){var o=+Date.now();this.trees[i+1]=it(n,yt,gt,this.options.nodeSize,Float32Array),n=this._cluster(n,i),e&&console.log("z%d: %d clusters in %dms",i,n.length,+Date.now()-o)}return this.trees[this.options.minZoom]=it(n,yt,gt,this.options.nodeSize,Float32Array),e&&console.timeEnd("total time"),this},getClusters:function(t,e){for(var r=this.trees[this._limitZoom(e)],n=r.range(ft(t[0]),dt(t[3]),ft(t[2]),dt(t[1])),i=[],o=0;o1&&console.time("creation"),p=this.tiles[h]=Vt(t,e,r,n,l),this.tileCoords.push({z:e,x:r,y:n}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,n,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));var f="z"+e;this.stats[f]=(this.stats[f]||0)+1,this.total++}if(p.source=t,i){if(e===l.maxZoom||e===i)continue;var d=1<1&&console.time("clipping");var m,y,g,v,_,x,b=.5*l.buffer/l.extent,w=.5-b,E=.5+b,S=1+b;m=y=g=v=null,_=At(t,c,r-b,r+E,0,p.minX,p.maxX,l),x=At(t,c,r+w,r+S,0,p.minX,p.maxX,l),t=null,_&&(m=At(_,c,n-b,n+E,1,p.minY,p.maxY,l),y=At(_,c,n+w,n+S,1,p.minY,p.maxY,l),_=null),x&&(g=At(x,c,n-b,n+E,1,p.minY,p.maxY,l),v=At(x,c,n+w,n+S,1,p.minY,p.maxY,l),x=null),u>1&&console.timeEnd("clipping"),s.push(m||[],e+1,2*r,2*n),s.push(y||[],e+1,2*r,2*n+1),s.push(g||[],e+1,2*r+1,2*n),s.push(v||[],e+1,2*r+1,2*n+1)}}},Ut.prototype.getTile=function(t,e,r){var n=this.options,i=n.extent,o=n.debug;if(t<0||t>24)return null;var a=1<1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var l,u=t,c=e,h=r;!l&&u>0;)u--,c=Math.floor(c/2),h=Math.floor(h/2),l=this.tiles[$t(u,c,h)];return l&&l.source?(o>1&&console.log("found parent tile z%d-%d-%d",u,c,h),o>1&&console.time("drilling down"),this.splitTile(l.source,u,c,h,t,e,r),o>1&&console.timeEnd("drilling down"),this.tiles[s]?Ot(this.tiles[s],i):null):null};var Zt=function(e){function r(t,r,n){e.call(this,t,r,qt),n&&(this.loadGeoJSON=n)}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.loadData=function(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=e,this._pendingLoadDataParams=t,this._state&&"Idle"!==this._state?this._state="NeedsLoadData":(this._state="Coalescing",this._loadData())},r.prototype._loadData=function(){var t=this;if(this._pendingCallback&&this._pendingLoadDataParams){var e=this._pendingCallback,r=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams;var n=!!(r&&r.request&&r.request.collectResourceTiming)&&new E.Performance(r.request);this.loadGeoJSON(r,function(i,o){if(i||!o)return e(i);if("object"!=typeof o)return e(new Error("Input data is not a valid GeoJSON object."));!function t(e,r){switch(e&&e.type||null){case"FeatureCollection":return e.features=e.features.map(L(t,r)),e;case"Feature":return e.geometry=t(e.geometry,r),e;case"Polygon":case"MultiPolygon":return function(t,e){return"Polygon"===t.type?t.coordinates=D(t.coordinates,e):"MultiPolygon"===t.type&&(t.coordinates=t.coordinates.map(L(D,e))),t}(e,r);default:return e}}(o,!0);try{t._geoJSONIndex=r.cluster?function(t){return new lt(t)}(r.superclusterOptions).load(o.features):new Ut(o,r.geojsonVtOptions)}catch(i){return e(i)}t.loaded={};var a={};if(n){var s=n.finish();s&&(a.resourceTiming={},a.resourceTiming[r.source]=JSON.parse(JSON.stringify(s)))}e(null,a)})}},r.prototype.coalesce=function(){"Coalescing"===this._state?this._state="Idle":"NeedsLoadData"===this._state&&(this._state="Coalescing",this._loadData())},r.prototype.reloadTile=function(t,r){var n=this.loaded,i=t.uid;return n&&n[i]?e.prototype.reloadTile.call(this,t,r):this.loadTile(t,r)},r.prototype.loadGeoJSON=function(e,r){if(e.request)t.getJSON(e.request,r);else{if("string"!=typeof e.data)return r(new Error("Input data is not a valid GeoJSON object."));try{return r(null,JSON.parse(e.data))}catch(t){return r(new Error("Input data is not a valid GeoJSON object."))}}},r.prototype.removeSource=function(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),e()},r}(k),Gt=function(e){var r=this;this.self=e,this.actor=new t.default$9(e,this),this.layerIndexes={},this.workerSourceTypes={vector:k,geojson:Zt},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=function(t,e){if(r.workerSourceTypes[t])throw new Error('Worker source with name "'+t+'" already registered.');r.workerSourceTypes[t]=e},this.self.registerRTLTextPlugin=function(e){if(t.plugin.isLoaded())throw new Error("RTL text plugin already registered.");t.plugin.applyArabicShaping=e.applyArabicShaping,t.plugin.processBidirectionalText=e.processBidirectionalText}};return Gt.prototype.setLayers=function(t,e,r){this.getLayerIndex(t).replace(e),r()},Gt.prototype.updateLayers=function(t,e,r){this.getLayerIndex(t).update(e.layers,e.removedIds),r()},Gt.prototype.loadTile=function(t,e,r){this.getWorkerSource(t,e.type,e.source).loadTile(e,r)},Gt.prototype.loadDEMTile=function(t,e,r){this.getDEMWorkerSource(t,e.source).loadTile(e,r)},Gt.prototype.reloadTile=function(t,e,r){this.getWorkerSource(t,e.type,e.source).reloadTile(e,r)},Gt.prototype.abortTile=function(t,e,r){this.getWorkerSource(t,e.type,e.source).abortTile(e,r)},Gt.prototype.removeTile=function(t,e,r){this.getWorkerSource(t,e.type,e.source).removeTile(e,r)},Gt.prototype.removeDEMTile=function(t,e){this.getDEMWorkerSource(t,e.source).removeTile(e)},Gt.prototype.removeSource=function(t,e,r){if(this.workerSources[t]&&this.workerSources[t][e.type]&&this.workerSources[t][e.type][e.source]){var n=this.workerSources[t][e.type][e.source];delete this.workerSources[t][e.type][e.source],void 0!==n.removeSource?n.removeSource(e,r):r()}},Gt.prototype.loadWorkerSource=function(t,e,r){try{this.self.importScripts(e.url),r()}catch(t){r(t.toString())}},Gt.prototype.loadRTLTextPlugin=function(e,r,n){try{t.plugin.isLoaded()||(this.self.importScripts(r),n(t.plugin.isLoaded()?null:new Error("RTL Text Plugin failed to import scripts from "+r)))}catch(t){n(t.toString())}},Gt.prototype.getLayerIndex=function(t){var e=this.layerIndexes[t];return e||(e=this.layerIndexes[t]=new n),e},Gt.prototype.getWorkerSource=function(t,e,r){var n=this;if(this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),!this.workerSources[t][e][r]){var i={send:function(e,r,i){n.actor.send(e,r,i,t)}};this.workerSources[t][e][r]=new this.workerSourceTypes[e](i,this.getLayerIndex(t))}return this.workerSources[t][e][r]},Gt.prototype.getDEMWorkerSource=function(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new A),this.demWorkerSources[t][e]},"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&new Gt(self),Gt}),n(0,function(t){var e=t.createCommonjsModule(function(t){function e(t){return!!("undefined"!=typeof window&&"undefined"!=typeof document&&Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray&&Function.prototype&&Function.prototype.bind&&Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions&&"JSON"in window&&"parse"in JSON&&"stringify"in JSON&&function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var t,e,r=new Blob([""],{type:"text/javascript"}),n=URL.createObjectURL(r);try{e=new Worker(n),t=!0}catch(e){t=!1}return e&&e.terminate(),URL.revokeObjectURL(n),t}()&&"Uint8ClampedArray"in window&&ArrayBuffer.isView&&function(t){return void 0===r[t]&&(r[t]=function(t){var r=document.createElement("canvas"),n=Object.create(e.webGLContextAttributes);return n.failIfMajorPerformanceCaveat=t,r.probablySupportsContext?r.probablySupportsContext("webgl",n)||r.probablySupportsContext("experimental-webgl",n):r.supportsContext?r.supportsContext("webgl",n)||r.supportsContext("experimental-webgl",n):r.getContext("webgl",n)||r.getContext("experimental-webgl",n)}(t)),r[t]}(t&&t.failIfMajorPerformanceCaveat))}t.exports?t.exports=e:window&&(window.mapboxgl=window.mapboxgl||{},window.mapboxgl.supported=e);var r={};e.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0}}),r={create:function(e,r,n){var i=t.default$1.document.createElement(e);return r&&(i.className=r),n&&n.appendChild(i),i},createNS:function(e,r){return t.default$1.document.createElementNS(e,r)}},n=t.default$1.document?t.default$1.document.documentElement.style:null;function i(t){if(!n)return null;for(var e=0;e=0?0:e.button},r.remove=function(t){t.parentNode&&t.parentNode.removeChild(t)};var h={API_URL:"https://api.mapbox.com",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null},p="See https://www.mapbox.com/api-documentation/#access-tokens";function f(t,e){var r=x(h.API_URL);if(t.protocol=r.protocol,t.authority=r.authority,"/"!==r.path&&(t.path=""+r.path+t.path),!h.REQUIRE_ACCESS_TOKEN)return b(t);if(!(e=e||h.ACCESS_TOKEN))throw new Error("An API access token is required to use Mapbox GL. "+p);if("s"===e[0])throw new Error("Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). "+p);return t.params.push("access_token="+e),b(t)}function d(t){return 0===t.indexOf("mapbox:")}var m=function(t,e){if(!d(t))return t;var r=x(t);return r.path="/v4/"+r.authority+".json",r.params.push("secure"),f(r,e)},y=function(t,e,r,n){var i=x(t);return d(t)?(i.path="/styles/v1"+i.path+"/sprite"+e+r,f(i,n)):(i.path+=""+e+r,b(i))},g=/(\.(png|jpg)\d*)(?=$)/,v=function(e,r,n){if(!r||!d(r))return e;var i=x(e),o=t.default$2.devicePixelRatio>=2||512===n?"@2x":"",a=t.default$2.supportsWebp?".webp":"$1";return i.path=i.path.replace(g,""+o+a),function(t){for(var e=0;e=0?1.2:1))}function k(t,e,r,n,i,o,a){for(var s=0;s65535)e(new Error("glyphs > 65535 not supported"));else{var l=o.requests[s];l||(l=o.requests[s]=[],I.loadGlyphRange(r,s,n.url,n.requestTransform,function(t,e){if(e)for(var r in e)o.glyphs[+r]=e[+r];for(var n=0,i=l;nthis.height)return t.warnOnce("LineAtlas out of space"),null;for(var o=0,a=0;a90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")};R.prototype.wrap=function(){return new R(t.wrap(this.lng,-180,180),this.lat)},R.prototype.toArray=function(){return[this.lng,this.lat]},R.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},R.prototype.toBounds=function(t){var e=360*t/40075017,r=e/Math.cos(Math.PI/180*this.lat);return new B(new R(this.lng-r,this.lat-e),new R(this.lng+r,this.lat+e))},R.convert=function(t){if(t instanceof R)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new R(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new R(Number(t.lng),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, or an array of [, ]")};var B=function(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))};B.prototype.setNorthEast=function(t){return this._ne=t instanceof R?new R(t.lng,t.lat):R.convert(t),this},B.prototype.setSouthWest=function(t){return this._sw=t instanceof R?new R(t.lng,t.lat):R.convert(t),this},B.prototype.extend=function(t){var e,r,n=this._sw,i=this._ne;if(t instanceof R)e=t,r=t;else{if(!(t instanceof B))return Array.isArray(t)?t.every(Array.isArray)?this.extend(B.convert(t)):this.extend(R.convert(t)):this;if(e=t._sw,r=t._ne,!e||!r)return this}return n||i?(n.lng=Math.min(e.lng,n.lng),n.lat=Math.min(e.lat,n.lat),i.lng=Math.max(r.lng,i.lng),i.lat=Math.max(r.lat,i.lat)):(this._sw=new R(e.lng,e.lat),this._ne=new R(r.lng,r.lat)),this},B.prototype.getCenter=function(){return new R((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},B.prototype.getSouthWest=function(){return this._sw},B.prototype.getNorthEast=function(){return this._ne},B.prototype.getNorthWest=function(){return new R(this.getWest(),this.getNorth())},B.prototype.getSouthEast=function(){return new R(this.getEast(),this.getSouth())},B.prototype.getWest=function(){return this._sw.lng},B.prototype.getSouth=function(){return this._sw.lat},B.prototype.getEast=function(){return this._ne.lng},B.prototype.getNorth=function(){return this._ne.lat},B.prototype.toArray=function(){return[this._sw.toArray(),this._ne.toArray()]},B.prototype.toString=function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"},B.prototype.isEmpty=function(){return!(this._sw&&this._ne)},B.convert=function(t){return!t||t instanceof B?t:new B(t)};var O=function(t,e,r){this.bounds=B.convert(this.validateBounds(t)),this.minzoom=e||0,this.maxzoom=r||24};O.prototype.validateBounds=function(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]},O.prototype.contains=function(t){var e=Math.floor(this.lngX(this.bounds.getWest(),t.z)),r=Math.floor(this.latY(this.bounds.getNorth(),t.z)),n=Math.ceil(this.lngX(this.bounds.getEast(),t.z)),i=Math.ceil(this.latY(this.bounds.getSouth(),t.z));return t.x>=e&&t.x=r&&t.y0&&(l[new t.OverscaledTileID(e.overscaledZ,o,r.z,i,r.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,r.z,a,r.y-1).key]={backfilled:!1}),r.y+10&&(n.resourceTiming=e._resourceTiming,e._resourceTiming=[]),e.fire(new t.Event("data",n))}})},r.prototype.onAdd=function(t){this.map=t,this.load()},r.prototype.setData=function(e){var r=this;return this._data=e,this.fire(new t.Event("dataloading",{dataType:"source"})),this._updateWorkerData(function(e){if(e)return r.fire(new t.ErrorEvent(e));var n={dataType:"source",sourceDataType:"content"};r._collectResourceTiming&&r._resourceTiming&&r._resourceTiming.length>0&&(n.resourceTiming=r._resourceTiming,r._resourceTiming=[]),r.fire(new t.Event("data",n))}),this},r.prototype._updateWorkerData=function(e){var r=this,n=t.extend({},this.workerOptions),i=this._data;"string"==typeof i?(n.request=this.map._transformRequest(t.default$2.resolveURL(i),t.ResourceType.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(i),this.workerID=this.dispatcher.send(this.type+".loadData",n,function(t,i){r._removed||i&&i.abandoned||(r._loaded=!0,i&&i.resourceTiming&&i.resourceTiming[r.id]&&(r._resourceTiming=i.resourceTiming[r.id].slice(0)),r.dispatcher.send(r.type+".coalesce",{source:n.source},null,r.workerID),e(t))},this.workerID)},r.prototype.loadTile=function(e,r){var n=this,i=void 0===e.workerID?"loadTile":"reloadTile",o={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:t.default$2.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes};e.workerID=this.dispatcher.send(i,o,function(t,o){return e.unloadVectorData(),e.aborted?r(null):t?r(t):(e.loadVectorData(o,n.map.painter,"reloadTile"===i),r(null))},this.workerID)},r.prototype.abortTile=function(t){t.aborted=!0},r.prototype.unloadTile=function(t){t.unloadVectorData(),this.dispatcher.send("removeTile",{uid:t.uid,type:this.type,source:this.id},null,t.workerID)},r.prototype.onRemove=function(){this._removed=!0,this.dispatcher.send("removeSource",{type:this.type,source:this.id},null,this.workerID)},r.prototype.serialize=function(){return t.extend({},this._options,{type:this.type,data:this._data})},r.prototype.hasTransition=function(){return!1},r}(t.Evented),U=function(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null};U.prototype.bind=function(t,e,r,n,i,o,a,s){this.context=t;for(var l=this.boundPaintVertexBuffers.length!==n.length,u=0;!l&&uthis.max){var a=this._getAndRemoveByKey(this.order[0]);a&&this.onRemove(a)}return this},K.prototype.has=function(t){return t.wrapped().key in this.data},K.prototype.getAndRemove=function(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null},K.prototype._getAndRemoveByKey=function(t){var e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value},K.prototype.get=function(t){return this.has(t)?this.data[t.wrapped().key][0].value:null},K.prototype.remove=function(t,e){if(!this.has(t))return this;var r=t.wrapped().key,n=void 0===e?0:this.data[r].indexOf(e),i=this.data[r][n];return this.data[r].splice(n,1),i.timeout&&clearTimeout(i.timeout),0===this.data[r].length&&delete this.data[r],this.onRemove(i.value),this.order.splice(this.order.indexOf(r),1),this},K.prototype.setMaxSize=function(t){for(this.max=t;this.order.length>this.max;){var e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this};var J=function(t,e,r){this.context=t;var n=t.gl;this.buffer=n.createBuffer(),this.dynamicDraw=Boolean(r),this.unbindVAO(),t.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer};J.prototype.unbindVAO=function(){this.context.extVertexArrayObject&&this.context.bindVertexArrayOES.set(null)},J.prototype.bind=function(){this.context.bindElementBuffer.set(this.buffer)},J.prototype.updateData=function(t){var e=this.context.gl;this.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)},J.prototype.destroy=function(){var t=this.context.gl;this.buffer&&(t.deleteBuffer(this.buffer),delete this.buffer)};var Y={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},Q=function(t,e,r,n){this.length=e.length,this.attributes=r,this.itemSize=e.bytesPerElement,this.dynamicDraw=n,this.context=t;var i=t.gl;this.buffer=i.createBuffer(),t.bindVertexBuffer.set(this.buffer),i.bufferData(i.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?i.DYNAMIC_DRAW:i.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer};Q.prototype.bind=function(){this.context.bindVertexBuffer.set(this.buffer)},Q.prototype.updateData=function(t){var e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)},Q.prototype.enableAttributes=function(t,e){for(var r=0;r1||(Math.abs(r)>1&&(1===Math.abs(r+i)?r+=i:1===Math.abs(r-i)&&(r-=i)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,r,n),t.neighboringTiles&&t.neighboringTiles[o]&&(t.neighboringTiles[o].backfilled=!0)))}},r.prototype.getTile=function(t){return this.getTileByID(t.key)},r.prototype.getTileByID=function(t){return this._tiles[t]},r.prototype.getZoom=function(t){return t.zoom+t.scaleZoom(t.tileSize/this._source.tileSize)},r.prototype._findLoadedChildren=function(t,e,r){var n=!1;for(var i in this._tiles){var o=this._tiles[i];if(!(r[i]||!o.hasData()||o.tileID.overscaledZ<=t.overscaledZ||o.tileID.overscaledZ>e)){var a=Math.pow(2,o.tileID.canonical.z-t.canonical.z);if(Math.floor(o.tileID.canonical.x/a)===t.canonical.x&&Math.floor(o.tileID.canonical.y/a)===t.canonical.y)for(r[i]=o.tileID,n=!0;o&&o.tileID.overscaledZ-1>t.overscaledZ;){var s=o.tileID.scaledTo(o.tileID.overscaledZ-1);if(!s)break;(o=this._tiles[s.key])&&o.hasData()&&(delete r[i],r[s.key]=s)}}}return n},r.prototype.findLoadedParent=function(t,e,r){for(var n=t.overscaledZ-1;n>=e;n--){var i=t.scaledTo(n);if(!i)return;var o=String(i.key),a=this._tiles[o];if(a&&a.hasData())return r[o]=i,a;if(this._cache.has(i))return r[o]=i,this._cache.get(i)}},r.prototype.updateCacheSize=function(t){var e=(Math.ceil(t.width/this._source.tileSize)+1)*(Math.ceil(t.height/this._source.tileSize)+1),r=Math.floor(5*e),n="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,r):r;this._cache.setMaxSize(n)},r.prototype.handleWrapJump=function(t){var e=(t-(void 0===this._prevLng?t:this._prevLng))/360,r=Math.round(e);if(this._prevLng=t,r){var n={};for(var i in this._tiles){var o=this._tiles[i];o.tileID=o.tileID.unwrapTo(o.tileID.wrap+r),n[o.tileID.key]=o}for(var a in this._tiles=n,this._timers)clearTimeout(this._timers[a]),delete this._timers[a];for(var s in this._tiles){var l=this._tiles[s];this._setTileReloadTimer(s,l)}}},r.prototype.update=function(e){var n=this;if(this.transform=e,this._sourceLoaded&&!this._paused){var i;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used?this._source.tileID?i=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(function(e){return new t.OverscaledTileID(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)}):(i=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}),this._source.hasTile&&(i=i.filter(function(t){return n._source.hasTile(t)}))):i=[];var o,a=(this._source.roundZoom?Math.round:Math.floor)(this.getZoom(e)),s=Math.max(a-r.maxOverzooming,this._source.minzoom),l=Math.max(a+r.maxUnderzooming,this._source.minzoom),u=this._updateRetainedTiles(i,a),c={};if(Bt(this._source.type))for(var h=Object.keys(u),p=0;p=t.default$2.now())){n._findLoadedChildren(d,l,u)&&(u[f]=d);var y=n.findLoadedParent(d,s,c);y&&n._addTile(y.tileID)}}for(o in c)u[o]||(n._coveredTiles[o]=!0);for(o in c)u[o]=c[o];for(var g=t.keysDifference(this._tiles,u),v=0;vthis._source.maxzoom){var p=l.children(this._source.maxzoom)[0],f=this.getTile(p);f&&f.hasData()?n[p.key]=p:h=!1}else{this._findLoadedChildren(l,a,n);for(var d=l.children(this._source.maxzoom),m=0;m=o;--y){var g=l.scaledTo(y);if(i[g.key])break;if(i[g.key]=!0,!(u=this.getTile(g))&&c&&(u=this._addTile(g)),u&&(n[g.key]=g,c=u.wasRequested(),u.hasData()))break}}}return n},r.prototype._addTile=function(e){var r=this._tiles[e.key];if(r)return r;(r=this._cache.getAndRemove(e))&&(this._setTileReloadTimer(e.key,r),r.tileID=e,this._state.initializeTileState(r,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,r)));var n=Boolean(r);return n||(r=new t.default$14(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(r,this._tileLoaded.bind(this,r,e.key,r.state))),r?(r.uses++,this._tiles[e.key]=r,n||this._source.fire(new t.Event("dataloading",{tile:r,coord:r.tileID,dataType:"source"})),r):null},r.prototype._setTileReloadTimer=function(t,e){var r=this;t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);var n=e.getExpiryTimeout();n&&(this._timers[t]=setTimeout(function(){r._reloadTile(t,"expired"),delete r._timers[t]},n))},r.prototype._removeTile=function(t){var e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))},r.prototype.clearTiles=function(){for(var t in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(t);this._cache.reset()},r.prototype.tilesIn=function(e,r){for(var n=[],i=this.getIds(),o=1/0,a=1/0,s=-1/0,l=-1/0,u=e[0].zoom,c=0;c=0&&g[1].y+y>=0){for(var v=[],_=0;_=t.default$2.now())return!0}return!1},r.prototype.setFeatureState=function(t,e,r){t=t||"_geojsonTileLayer",this._state.updateState(t,e,r)},r.prototype.getFeatureState=function(t,e){return t=t||"_geojsonTileLayer",this._state.getState(t,e)},r}(t.Evented);function Rt(e,r){var n=r.zoomTo(e.canonical.z);return new t.default((n.column-(e.canonical.x+e.wrap*Math.pow(2,e.canonical.z)))*t.default$10,(n.row-e.canonical.y)*t.default$10)}function Bt(t){return"raster"===t||"image"===t||"video"===t}function Ot(){return new t.default$1.Worker(cn.workerUrl)}Dt.maxOverzooming=10,Dt.maxUnderzooming=3;var Ft,Vt=function(){this.active={}};function Nt(e,r){var n={};for(var i in e)"ref"!==i&&(n[i]=e[i]);return t.default$17.forEach(function(t){t in r&&(n[t]=r[t])}),n}function jt(t){t=t.slice();for(var e=Object.create(null),r=0;rthis.width||n<0||e>this.height)return!i&&[];var a=[];if(t<=0&&e<=0&&this.width<=r&&this.height<=n){if(i)return!0;for(var s=0;s0:a},Kt.prototype._queryCircle=function(t,e,r,n,i){var o=t-r,a=t+r,s=e-r,l=e+r;if(a<0||o>this.width||l<0||s>this.height)return!n&&[];var u=[],c={hitTest:n,circle:{x:t,y:e,radius:r},seenUids:{box:{},circle:{}}};return this._forEachCell(o,s,a,l,this._queryCellCircle,u,c,i),n?u.length>0:u},Kt.prototype.query=function(t,e,r,n,i){return this._query(t,e,r,n,!1,i)},Kt.prototype.hitTest=function(t,e,r,n,i){return this._query(t,e,r,n,!0,i)},Kt.prototype.hitTestCircle=function(t,e,r,n){return this._queryCircle(t,e,r,!0,n)},Kt.prototype._queryCell=function(t,e,r,n,i,o,a,s){var l=a.seenUids,u=this.boxCells[i];if(null!==u)for(var c=this.bboxes,h=0,p=u;h=c[d+0]&&n>=c[d+1]&&(!s||s(this.boxKeys[f]))){if(a.hitTest)return o.push(!0),!0;o.push({key:this.boxKeys[f],x1:c[d],y1:c[d+1],x2:c[d+2],y2:c[d+3]})}}}var m=this.circleCells[i];if(null!==m)for(var y=this.circles,g=0,v=m;ga*a+s*s},Kt.prototype._circleAndRectCollide=function(t,e,r,n,i,o,a){var s=(o-n)/2,l=Math.abs(t-(n+s));if(l>s+r)return!1;var u=(a-i)/2,c=Math.abs(e-(i+u));if(c>u+r)return!1;if(l<=s||c<=u)return!0;var h=l-s,p=c-u;return h*h+p*p<=r*r};var Jt=t.default$18.layout;function Yt(e,r,n,i,o){var a=t.identity(new Float32Array(16));return r?(t.identity(a),t.scale(a,a,[1/o,1/o,1]),n||t.rotateZ(a,a,i.angle)):(t.scale(a,a,[i.width/2,-i.height/2,1]),t.translate(a,a,[1,-1,0]),t.multiply(a,a,e)),a}function Qt(e,r,n,i,o){var a=t.identity(new Float32Array(16));return r?(t.multiply(a,a,e),t.scale(a,a,[o,o,1]),n||t.rotateZ(a,a,-i.angle)):(t.scale(a,a,[1,-1,1]),t.translate(a,a,[-1,-1,0]),t.scale(a,a,[2/i.width,2/i.height,1])),a}function te(e,r){var n=[e.x,e.y,0,1];ce(n,n,r);var i=n[3];return{point:new t.default(n[0]/i,n[1]/i),signedDistanceFromCamera:i}}function ee(t,e){var r=t[0]/t[3],n=t[1]/t[3];return r>=-e[0]&&r<=e[0]&&n>=-e[1]&&n<=e[1]}function re(e,r,n,i,o,a,s,l){var u=i?e.textSizeData:e.iconSizeData,c=t.evaluateSizeForZoom(u,n.transform.zoom,Jt.properties[i?"text-size":"icon-size"]),h=[256/n.width*2+1,256/n.height*2+1],p=i?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;p.clear();for(var f=e.lineVertexArray,d=i?e.text.placedSymbolArray:e.icon.placedSymbolArray,m=n.transform.width/n.transform.height,y=!1,g=0;gMath.abs(n.x-r.x)*i?{useVertical:!0}:(e===t.WritingMode.vertical?r.yn.x)?{needsFlipping:!0}:null}function oe(e,r,n,i,o,a,s,l,u,c,h,p,f,d){var m,y=r/24,g=e.lineOffsetX*r,v=e.lineOffsetY*r;if(e.numGlyphs>1){var _=e.glyphStartIndex+e.numGlyphs,x=e.lineStartIndex,b=e.lineStartIndex+e.lineLength,w=ne(y,l,g,v,n,h,p,e,u,a,f,!1);if(!w)return{notEnoughRoom:!0};var E=te(w.first.point,s).point,S=te(w.last.point,s).point;if(i&&!n){var T=ie(e.writingMode,E,S,d);if(T)return T}m=[w.first];for(var k=e.glyphStartIndex+1;k<_-1;k++)m.push(se(y*l.getoffsetX(k),g,v,n,h,p,e.segment,x,b,u,a,f,!1));m.push(w.last)}else{if(i&&!n){var A=te(p,o).point,I=e.lineStartIndex+e.segment+1,z=new t.default(u.getx(I),u.gety(I)),C=te(z,o),M=C.signedDistanceFromCamera>0?C.point:ae(p,z,A,1,o),P=ie(e.writingMode,A,M,d);if(P)return P}var L=se(y*l.getoffsetX(e.glyphStartIndex),g,v,n,h,p,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,u,a,f,!1);if(!L)return{notEnoughRoom:!0};m=[L]}for(var D=0,R=m;D0?1:-1,y=0;i&&(m*=-1,y=Math.PI),m<0&&(y+=Math.PI);for(var g=m>0?l+s:l+s+1,v=g,_=o,x=o,b=0,w=0,E=Math.abs(d);b+w<=E;){if((g+=m)=u)return null;if(x=_,void 0===(_=p[g])){var S=new t.default(c.getx(g),c.gety(g)),T=te(S,h);if(T.signedDistanceFromCamera>0)_=p[g]=T.point;else{var k=g-m;_=ae(0===b?a:new t.default(c.getx(k),c.gety(k)),S,x,E-b+1,h)}}b+=w,w=x.dist(_)}var A=(E-b)/w,I=_.sub(x),z=I.mult(A)._add(x);return z._add(I._unit()._perp()._mult(n*m)),{point:z,angle:y+Math.atan2(_.y-x.y,_.x-x.x),tileDistance:f?{prevTileDistance:g-m===v?0:c.gettileUnitDistanceFromAnchor(g-m),lastSegmentViewportDistance:E-b}:null}}var le=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ue(t,e){for(var r=0;rI)pe(e,z,!1);else{var D=this.projectPoint(c,C,M),R=P*T;if(m.length>0){var B=D.x-m[m.length-4],O=D.y-m[m.length-3];if(R*R*2>B*B+O*O&&z+8-A&&F=this.screenRightBoundary||n<100||e>this.screenBottomBoundary},he.prototype.isInsideGrid=function(t,e,r,n){return r>=0&&t=0&&e0,x=x&&b.offscreen);var k=g.collisionArrays.textCircles;if(k){var A=e.text.placedSymbolArray.get(g.placedTextSymbolIndices[0]),I=t.evaluateSizeForFeature(e.textSizeData,h,A);w=this.collisionIndex.placeCollisionCircles(k,c.get("text-allow-overlap"),o,a,g.key,A,e.lineVertexArray,e.glyphOffsetArray,I,r,n,s,"map"===c.get("text-pitch-alignment"),d.predicate),v=c.get("text-allow-overlap")||w.circles.length>0,x=x&&w.offscreen}g.collisionArrays.iconFeatureIndex&&(T=g.collisionArrays.iconFeatureIndex),g.collisionArrays.iconBox&&(_=(E=this.collisionIndex.placeCollisionBox(g.collisionArrays.iconBox,c.get("icon-allow-overlap"),a,r,d.predicate)).box.length>0,x=x&&E.offscreen),p||f?f?p||(_=_&&v):v=_&&v:_=v=_&&v,v&&b&&this.collisionIndex.insertCollisionBox(b.box,c.get("text-ignore-placement"),e.bucketInstanceId,S,d.ID),_&&E&&this.collisionIndex.insertCollisionBox(E.box,c.get("icon-ignore-placement"),e.bucketInstanceId,T,d.ID),v&&w&&this.collisionIndex.insertCollisionCircles(w.circles,c.get("text-ignore-placement"),e.bucketInstanceId,S,d.ID),this.placements[g.crossTileID]=new ge(v,_,x||e.justReloaded),l[g.crossTileID]=!0}}e.justReloaded=!1},_e.prototype.commit=function(t,e){this.commitTime=e;var r=!1,n=t&&0!==this.fadeDuration?(this.commitTime-t.commitTime)/this.fadeDuration:1,i=t?t.opacities:{};for(var o in this.placements){var a=this.placements[o],s=i[o];s?(this.opacities[o]=new ye(s,n,a.text,a.icon),r=r||a.text!==s.text.placed||a.icon!==s.icon.placed):(this.opacities[o]=new ye(null,n,a.text,a.icon,a.skipFade),r=r||a.text||a.icon)}for(var l in i){var u=i[l];if(!this.opacities[l]){var c=new ye(u,n,!1,!1);c.isHidden()||(this.opacities[l]=c,r=r||u.text.placed||u.icon.placed)}}r?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)},_e.prototype.updateLayerOpacities=function(t,e){for(var r={},n=0,i=e;n0||s.numVerticalGlyphVertices>0,h=s.numIconVertices>0;if(c){for(var p=Ie(u.text),f=(s.numGlyphVertices+s.numVerticalGlyphVertices)/4,d=0;dt},_e.prototype.setStale=function(){this.stale=!0};var be=Math.pow(2,25),we=Math.pow(2,24),Ee=Math.pow(2,17),Se=Math.pow(2,16),Te=Math.pow(2,9),ke=Math.pow(2,8),Ae=Math.pow(2,1);function Ie(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;var e=t.placed?1:0,r=Math.floor(127*t.opacity);return r*be+e*we+r*Ee+e*Se+r*Te+e*ke+r*Ae+e}var ze=function(){this._currentTileIndex=0,this._seenCrossTileIDs={}};ze.prototype.continuePlacement=function(t,e,r,n,i){for(;this._currentTileIndex2};this._currentPlacementIndex>=0;){var s=r[e[i._currentPlacementIndex]],l=i.placement.collisionIndex.transform.zoom;if("symbol"===s.type&&(!s.minzoom||s.minzoom<=l)&&(!s.maxzoom||s.maxzoom>l)){if(i._inProgressLayer||(i._inProgressLayer=new ze),i._inProgressLayer.continuePlacement(n[s.source],i.placement,i._showCollisionBoxes,s,a))return;delete i._inProgressLayer}i._currentPlacementIndex--}this._done=!0},Ce.prototype.commit=function(t,e){return this.placement.commit(t,e),this.placement};var Me=512/t.default$10/2,Pe=function(t,e,r){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=r;for(var n=0,i=e;nt.overscaledZ)for(var l in s){var u=s[l];u.tileID.isChildOf(t)&&u.findMatches(e.symbolInstances,t,o)}else{var c=s[t.scaledTo(Number(a)).key];c&&c.findMatches(e.symbolInstances,t,o)}}for(var h=0,p=e.symbolInstances;h1?"@2x":"";function l(){if(a)n(a);else if(i&&o){var e=t.default$2.getImageData(o),r={};for(var s in i){var l=i[s],u=l.width,c=l.height,h=l.x,p=l.y,f=l.sdf,d=l.pixelRatio,m=new t.RGBAImage({width:u,height:c});t.RGBAImage.copy(e,m,{x:h,y:p},{x:0,y:0},{width:u,height:c}),r[s]={data:m,pixelRatio:d,sdf:f}}n(null,r)}}t.getJSON(r(y(e,s,".json"),t.ResourceType.SpriteJSON),function(t,e){a||(a=t,i=e,l())}),t.getImage(r(y(e,s,".png"),t.ResourceType.SpriteImage),function(t,e){a||(a=t,o=e,l())})}(e.sprite,this.map._transformRequest,function(e,r){if(e)n.fire(new t.ErrorEvent(e));else if(r)for(var i in r)n.imageManager.addImage(i,r[i]);n.imageManager.setLoaded(!0),n.fire(new t.Event("data",{dataType:"style"}))}):this.imageManager.setLoaded(!0),this.glyphManager.setURL(e.glyphs);var o=jt(this.stylesheet.layers);this._order=o.map(function(t){return t.id}),this._layers={};for(var a=0,s=o;a0)throw new Error("Unimplemented: "+i.map(function(t){return t.command}).join(", ")+".");return n.forEach(function(t){"setTransition"!==t.command&&r[t.command].apply(r,t.args)}),this.stylesheet=e,!0},r.prototype.addImage=function(e,r){if(this.getImage(e))return this.fire(new t.ErrorEvent(new Error("An image with this name already exists.")));this.imageManager.addImage(e,r),this.fire(new t.Event("data",{dataType:"style"}))},r.prototype.getImage=function(t){return this.imageManager.getImage(t)},r.prototype.removeImage=function(e){if(!this.getImage(e))return this.fire(new t.ErrorEvent(new Error("No image with this name exists.")));this.imageManager.removeImage(e),this.fire(new t.Event("data",{dataType:"style"}))},r.prototype.listImages=function(){return this._checkLoaded(),this.imageManager.listImages()},r.prototype.addSource=function(e,r,n){var i=this;if(this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error("There is already a source with this ID");if(!r.type)throw new Error("The type property must be defined, but the only the following properties were given: "+Object.keys(r).join(", ")+".");if(!(["vector","raster","geojson","video","image"].indexOf(r.type)>=0&&this._validate(t.validateStyle.source,"sources."+e,r,null,n))){this.map&&this.map._collectResourceTiming&&(r.collectResourceTiming=!0);var o=this.sourceCaches[e]=new Dt(e,r,this.dispatcher);o.style=this,o.setEventedParent(this,function(){return{isSourceLoaded:i.loaded(),source:o.serialize(),sourceId:e}}),o.onAdd(this.map),this._changed=!0}},r.prototype.removeSource=function(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(var r in this._layers)if(this._layers[r].source===e)return this.fire(new t.ErrorEvent(new Error('Source "'+e+'" cannot be removed while layer "'+r+'" is using it.')));var n=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],n.fire(new t.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),n.setEventedParent(null),n.clearTiles(),n.onRemove&&n.onRemove(this.map),this._changed=!0},r.prototype.setGeoJSONSourceData=function(t,e){this._checkLoaded(),this.sourceCaches[t].getSource().setData(e),this._changed=!0},r.prototype.getSource=function(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()},r.prototype.addLayer=function(e,r,n){this._checkLoaded();var i=e.id;if(this.getLayer(i))this.fire(new t.ErrorEvent(new Error('Layer with id "'+i+'" already exists on this map')));else if("object"==typeof e.source&&(this.addSource(i,e.source),e=t.clone(e),e=t.extend(e,{source:i})),!this._validate(t.validateStyle.layer,"layers."+i,e,{arrayIndex:-1},n)){var o=t.default$20(e);this._validateLayer(o),o.setEventedParent(this,{layer:{id:i}});var a=r?this._order.indexOf(r):this._order.length;if(r&&-1===a)this.fire(new t.ErrorEvent(new Error('Layer with id "'+r+'" does not exist on this map.')));else{if(this._order.splice(a,0,i),this._layerOrderChanged=!0,this._layers[i]=o,this._removedLayers[i]&&o.source){var s=this._removedLayers[i];delete this._removedLayers[i],s.type!==o.type?this._updatedSources[o.source]="clear":(this._updatedSources[o.source]="reload",this.sourceCaches[o.source].pause())}this._updateLayer(o)}}},r.prototype.moveLayer=function(e,r){if(this._checkLoaded(),this._changed=!0,this._layers[e]){if(e!==r){var n=this._order.indexOf(e);this._order.splice(n,1);var i=r?this._order.indexOf(r):this._order.length;r&&-1===i?this.fire(new t.ErrorEvent(new Error('Layer with id "'+r+'" does not exist on this map.'))):(this._order.splice(i,0,e),this._layerOrderChanged=!0)}}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be moved.")))},r.prototype.removeLayer=function(e){this._checkLoaded();var r=this._layers[e];if(r){r.setEventedParent(null);var n=this._order.indexOf(e);this._order.splice(n,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=r,delete this._layers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e]}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be removed.")))},r.prototype.getLayer=function(t){return this._layers[t]},r.prototype.setLayerZoomRange=function(e,r,n){this._checkLoaded();var i=this.getLayer(e);i?i.minzoom===r&&i.maxzoom===n||(null!=r&&(i.minzoom=r),null!=n&&(i.maxzoom=n),this._updateLayer(i)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot have zoom extent.")))},r.prototype.setFilter=function(e,r){this._checkLoaded();var n=this.getLayer(e);if(n){if(!t.default$13(n.filter,r))return null==r?(n.filter=void 0,void this._updateLayer(n)):void(this._validate(t.validateStyle.filter,"layers."+n.id+".filter",r)||(n.filter=t.clone(r),this._updateLayer(n)))}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be filtered.")))},r.prototype.getFilter=function(e){return t.clone(this.getLayer(e).filter)},r.prototype.setLayoutProperty=function(e,r,n){this._checkLoaded();var i=this.getLayer(e);i?t.default$13(i.getLayoutProperty(r),n)||(i.setLayoutProperty(r,n),this._updateLayer(i)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")))},r.prototype.getLayoutProperty=function(t,e){return this.getLayer(t).getLayoutProperty(e)},r.prototype.setPaintProperty=function(e,r,n){this._checkLoaded();var i=this.getLayer(e);i?t.default$13(i.getPaintProperty(r),n)||(i.setPaintProperty(r,n)&&this._updateLayer(i),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")))},r.prototype.getPaintProperty=function(t,e){return this.getLayer(t).getPaintProperty(e)},r.prototype.setFeatureState=function(e,r){this._checkLoaded();var n=e.source,i=e.sourceLayer,o=this.sourceCaches[n];void 0!==o?"vector"!==o.getSource().type||i?o.setFeatureState(i,e.id,r):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types."))):this.fire(new t.ErrorEvent(new Error("The source '"+n+"' does not exist in the map's style.")))},r.prototype.getFeatureState=function(e){this._checkLoaded();var r=e.source,n=e.sourceLayer,i=this.sourceCaches[r];if(void 0!==i){if("vector"!==i.getSource().type||n)return i.getFeatureState(n,e.id);this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '"+r+"' does not exist in the map's style.")))},r.prototype.getTransition=function(){return t.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)},r.prototype.serialize=function(){var e=this;return t.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,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,sources:t.mapObject(this.sourceCaches,function(t){return t.serialize()}),layers:this._order.map(function(t){return e._layers[t].serialize()})},function(t){return void 0!==t})},r.prototype._updateLayer=function(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0},r.prototype._flattenRenderedFeatures=function(t){for(var e=[],r=this._order.length-1;r>=0;r--)for(var n=this._order[r],i=0,o=t;i 0.5) {\n gl_FragColor = vec4(0.0, 0.0, 1.0, 0.5) * alpha;\n }\n\n if (v_notUsed > 0.5) {\n // This box not used, fade it out\n gl_FragColor *= .1;\n }\n}",vertexSource:"attribute vec2 a_pos;\nattribute vec2 a_anchor_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_placed;\n\nuniform mat4 u_matrix;\nuniform vec2 u_extrude_scale;\nuniform float u_camera_to_center_distance;\n\nvarying float v_placed;\nvarying float v_notUsed;\n\nvoid main() {\n vec4 projectedPoint = u_matrix * vec4(a_anchor_pos, 0, 1);\n highp float camera_to_anchor_distance = projectedPoint.w;\n highp float collision_perspective_ratio = clamp(\n 0.5 + 0.5 * (u_camera_to_center_distance / camera_to_anchor_distance),\n 0.0, // Prevents oversized near-field boxes in pitched/overzoomed tiles\n 4.0);\n\n gl_Position = u_matrix * vec4(a_pos, 0.0, 1.0);\n gl_Position.xy += a_extrude * u_extrude_scale * gl_Position.w * collision_perspective_ratio;\n\n v_placed = a_placed.x;\n v_notUsed = a_placed.y;\n}\n"},collisionCircle:{fragmentSource:"uniform float u_overscale_factor;\n\nvarying float v_placed;\nvarying float v_notUsed;\nvarying float v_radius;\nvarying vec2 v_extrude;\nvarying vec2 v_extrude_scale;\n\nvoid main() {\n float alpha = 0.5;\n\n // Red = collision, hide label\n vec4 color = vec4(1.0, 0.0, 0.0, 1.0) * alpha;\n\n // Blue = no collision, label is showing\n if (v_placed > 0.5) {\n color = vec4(0.0, 0.0, 1.0, 0.5) * alpha;\n }\n\n if (v_notUsed > 0.5) {\n // This box not used, fade it out\n color *= .2;\n }\n\n float extrude_scale_length = length(v_extrude_scale);\n float extrude_length = length(v_extrude) * extrude_scale_length;\n float stroke_width = 15.0 * extrude_scale_length / u_overscale_factor;\n float radius = v_radius * extrude_scale_length;\n\n float distance_to_edge = abs(extrude_length - radius);\n float opacity_t = smoothstep(-stroke_width, 0.0, -distance_to_edge);\n\n gl_FragColor = opacity_t * color;\n}\n",vertexSource:"attribute vec2 a_pos;\nattribute vec2 a_anchor_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_placed;\n\nuniform mat4 u_matrix;\nuniform vec2 u_extrude_scale;\nuniform float u_camera_to_center_distance;\n\nvarying float v_placed;\nvarying float v_notUsed;\nvarying float v_radius;\n\nvarying vec2 v_extrude;\nvarying vec2 v_extrude_scale;\n\nvoid main() {\n vec4 projectedPoint = u_matrix * vec4(a_anchor_pos, 0, 1);\n highp float camera_to_anchor_distance = projectedPoint.w;\n highp float collision_perspective_ratio = clamp(\n 0.5 + 0.5 * (u_camera_to_center_distance / camera_to_anchor_distance),\n 0.0, // Prevents oversized near-field circles in pitched/overzoomed tiles\n 4.0);\n\n gl_Position = u_matrix * vec4(a_pos, 0.0, 1.0);\n\n highp float padding_factor = 1.2; // Pad the vertices slightly to make room for anti-alias blur\n gl_Position.xy += a_extrude * u_extrude_scale * padding_factor * gl_Position.w * collision_perspective_ratio;\n\n v_placed = a_placed.x;\n v_notUsed = a_placed.y;\n v_radius = abs(a_extrude.y); // We don't pitch the circles, so both units of the extrusion vector are equal in magnitude to the radius\n\n v_extrude = a_extrude * padding_factor;\n v_extrude_scale = u_extrude_scale * u_camera_to_center_distance * collision_perspective_ratio;\n}\n"},debug:{fragmentSource:"uniform highp vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n}\n",vertexSource:"attribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n"},fill:{fragmentSource:"#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float opacity\n\n gl_FragColor = color * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"attribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n"},fillOutline:{fragmentSource:"#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_pos;\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = 1.0 - smoothstep(0.0, 1.0, dist);\n gl_FragColor = outline_color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"attribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},fillOutlinePattern:{fragmentSource:"uniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform vec2 u_texsize;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b / u_texsize, u_pattern_br_b / u_texsize, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n // find distance to outline for alpha interpolation\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = 1.0 - smoothstep(0.0, 1.0, dist);\n\n\n gl_FragColor = mix(color1, color2, u_mix) * alpha * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_world;\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n\n v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_a * u_pattern_size_a, u_tile_units_to_pixels, a_pos);\n v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_b * u_pattern_size_b, u_tile_units_to_pixels, a_pos);\n\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},fillPattern:{fragmentSource:"uniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform vec2 u_texsize;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b / u_texsize, u_pattern_br_b / u_texsize, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n gl_FragColor = mix(color1, color2, u_mix) * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n\n v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_a * u_pattern_size_a, u_tile_units_to_pixels, a_pos);\n v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_b * u_pattern_size_b, u_tile_units_to_pixels, a_pos);\n}\n"},fillExtrusion:{fragmentSource:"varying vec4 v_color;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define highp vec4 color\n\nvoid main() {\n #pragma mapbox: initialize lowp float base\n #pragma mapbox: initialize lowp float height\n #pragma mapbox: initialize highp vec4 color\n\n gl_FragColor = v_color;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec3 u_lightcolor;\nuniform lowp vec3 u_lightpos;\nuniform lowp float u_lightintensity;\n\nattribute vec2 a_pos;\nattribute vec4 a_normal_ed;\n\nvarying vec4 v_color;\n\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n\n#pragma mapbox: define highp vec4 color\n\nvoid main() {\n #pragma mapbox: initialize lowp float base\n #pragma mapbox: initialize lowp float height\n #pragma mapbox: initialize highp vec4 color\n\n vec3 normal = a_normal_ed.xyz;\n\n base = max(0.0, base);\n height = max(0.0, height);\n\n float t = mod(normal.x, 2.0);\n\n gl_Position = u_matrix * vec4(a_pos, t > 0.0 ? height : base, 1);\n\n // Relative luminance (how dark/bright is the surface color?)\n float colorvalue = color.r * 0.2126 + color.g * 0.7152 + color.b * 0.0722;\n\n v_color = vec4(0.0, 0.0, 0.0, 1.0);\n\n // Add slight ambient lighting so no extrusions are totally black\n vec4 ambientlight = vec4(0.03, 0.03, 0.03, 1.0);\n color += ambientlight;\n\n // Calculate cos(theta), where theta is the angle between surface normal and diffuse light ray\n float directional = clamp(dot(normal / 16384.0, u_lightpos), 0.0, 1.0);\n\n // Adjust directional so that\n // the range of values for highlight/shading is narrower\n // with lower light intensity\n // and with lighter/brighter surface colors\n directional = mix((1.0 - u_lightintensity), max((1.0 - colorvalue + u_lightintensity), 1.0), directional);\n\n // Add gradient along z axis of side surfaces\n if (normal.y != 0.0) {\n directional *= clamp((t + base) * pow(height / 150.0, 0.5), mix(0.7, 0.98, 1.0 - u_lightintensity), 1.0);\n }\n\n // Assign final color based on surface + ambient light color, diffuse light directional, and light color\n // with lower bounds adjusted to hue of light\n // so that shading is tinted with the complementary (opposite) color to the light color\n v_color.r += clamp(color.r * directional * u_lightcolor.r, mix(0.0, 0.3, 1.0 - u_lightcolor.r), 1.0);\n v_color.g += clamp(color.g * directional * u_lightcolor.g, mix(0.0, 0.3, 1.0 - u_lightcolor.g), 1.0);\n v_color.b += clamp(color.b * directional * u_lightcolor.b, mix(0.0, 0.3, 1.0 - u_lightcolor.b), 1.0);\n}\n"},fillExtrusionPattern:{fragmentSource:"uniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform vec2 u_texsize;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec4 v_lighting;\n\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n\nvoid main() {\n #pragma mapbox: initialize lowp float base\n #pragma mapbox: initialize lowp float height\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b / u_texsize, u_pattern_br_b / u_texsize, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n vec4 mixedColor = mix(color1, color2, u_mix);\n\n gl_FragColor = mixedColor * v_lighting;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\nuniform float u_height_factor;\n\nuniform vec3 u_lightcolor;\nuniform lowp vec3 u_lightpos;\nuniform lowp float u_lightintensity;\n\nattribute vec2 a_pos;\nattribute vec4 a_normal_ed;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec4 v_lighting;\nvarying float v_directional;\n\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n\nvoid main() {\n #pragma mapbox: initialize lowp float base\n #pragma mapbox: initialize lowp float height\n\n vec3 normal = a_normal_ed.xyz;\n float edgedistance = a_normal_ed.w;\n\n base = max(0.0, base);\n height = max(0.0, height);\n\n float t = mod(normal.x, 2.0);\n float z = t > 0.0 ? height : base;\n\n gl_Position = u_matrix * vec4(a_pos, z, 1);\n\n vec2 pos = normal.x == 1.0 && normal.y == 0.0 && normal.z == 16384.0\n ? a_pos // extrusion top\n : vec2(edgedistance, z * u_height_factor); // extrusion side\n\n v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_a * u_pattern_size_a, u_tile_units_to_pixels, pos);\n v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_b * u_pattern_size_b, u_tile_units_to_pixels, pos);\n\n v_lighting = vec4(0.0, 0.0, 0.0, 1.0);\n float directional = clamp(dot(normal / 16383.0, u_lightpos), 0.0, 1.0);\n directional = mix((1.0 - u_lightintensity), max((0.5 + u_lightintensity), 1.0), directional);\n\n if (normal.y != 0.0) {\n directional *= clamp((t + base) * pow(height / 150.0, 0.5), mix(0.7, 0.98, 1.0 - u_lightintensity), 1.0);\n }\n\n v_lighting.rgb += clamp(directional * u_lightcolor, mix(vec3(0.0), vec3(0.3), 1.0 - u_lightcolor), vec3(1.0));\n}\n"},extrusionTexture:{fragmentSource:"uniform sampler2D u_image;\nuniform float u_opacity;\nvarying vec2 v_pos;\n\nvoid main() {\n gl_FragColor = texture2D(u_image, v_pos) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(0.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_world;\nattribute vec2 a_pos;\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos * u_world, 0, 1);\n\n v_pos.x = a_pos.x;\n v_pos.y = 1.0 - a_pos.y;\n}\n"},hillshadePrepare:{fragmentSource:"#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform sampler2D u_image;\nvarying vec2 v_pos;\nuniform vec2 u_dimension;\nuniform float u_zoom;\nuniform float u_maxzoom;\n\nfloat getElevation(vec2 coord, float bias) {\n // Convert encoded elevation value to meters\n vec4 data = texture2D(u_image, coord) * 255.0;\n return (data.r + data.g * 256.0 + data.b * 256.0 * 256.0) / 4.0;\n}\n\nvoid main() {\n vec2 epsilon = 1.0 / u_dimension;\n\n // queried pixels:\n // +-----------+\n // | | | |\n // | a | b | c |\n // | | | |\n // +-----------+\n // | | | |\n // | d | e | f |\n // | | | |\n // +-----------+\n // | | | |\n // | g | h | i |\n // | | | |\n // +-----------+\n\n float a = getElevation(v_pos + vec2(-epsilon.x, -epsilon.y), 0.0);\n float b = getElevation(v_pos + vec2(0, -epsilon.y), 0.0);\n float c = getElevation(v_pos + vec2(epsilon.x, -epsilon.y), 0.0);\n float d = getElevation(v_pos + vec2(-epsilon.x, 0), 0.0);\n float e = getElevation(v_pos, 0.0);\n float f = getElevation(v_pos + vec2(epsilon.x, 0), 0.0);\n float g = getElevation(v_pos + vec2(-epsilon.x, epsilon.y), 0.0);\n float h = getElevation(v_pos + vec2(0, epsilon.y), 0.0);\n float i = getElevation(v_pos + vec2(epsilon.x, epsilon.y), 0.0);\n\n // here we divide the x and y slopes by 8 * pixel size\n // where pixel size (aka meters/pixel) is:\n // circumference of the world / (pixels per tile * number of tiles)\n // which is equivalent to: 8 * 40075016.6855785 / (512 * pow(2, u_zoom))\n // which can be reduced to: pow(2, 19.25619978527 - u_zoom)\n // we want to vertically exaggerate the hillshading though, because otherwise\n // it is barely noticeable at low zooms. to do this, we multiply this by some\n // scale factor pow(2, (u_zoom - u_maxzoom) * a) where a is an arbitrary value\n // Here we use a=0.3 which works out to the expression below. see \n // nickidlugash's awesome breakdown for more info\n // https://github.com/mapbox/mapbox-gl-js/pull/5286#discussion_r148419556\n float exaggeration = u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;\n\n vec2 deriv = vec2(\n (c + f + f + i) - (a + d + d + g),\n (g + h + h + i) - (a + b + b + c)\n ) / pow(2.0, (u_zoom - u_maxzoom) * exaggeration + 19.2562 - u_zoom);\n\n gl_FragColor = clamp(vec4(\n deriv.x / 2.0 + 0.5,\n deriv.y / 2.0 + 0.5,\n 1.0,\n 1.0), 0.0, 1.0);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (a_texture_pos / 8192.0) / 2.0 + 0.25;\n}\n"},hillshade:{fragmentSource:"uniform sampler2D u_image;\nvarying vec2 v_pos;\n\nuniform vec2 u_latrange;\nuniform vec2 u_light;\nuniform vec4 u_shadow;\nuniform vec4 u_highlight;\nuniform vec4 u_accent;\n\n#define PI 3.141592653589793\n\nvoid main() {\n vec4 pixel = texture2D(u_image, v_pos);\n\n vec2 deriv = ((pixel.rg * 2.0) - 1.0);\n\n // We divide the slope by a scale factor based on the cosin of the pixel's approximate latitude\n // to account for mercator projection distortion. see #4807 for details\n float scaleFactor = cos(radians((u_latrange[0] - u_latrange[1]) * (1.0 - v_pos.y) + u_latrange[1]));\n // We also multiply the slope by an arbitrary z-factor of 1.25\n float slope = atan(1.25 * length(deriv) / scaleFactor);\n float aspect = deriv.x != 0.0 ? atan(deriv.y, -deriv.x) : PI / 2.0 * (deriv.y > 0.0 ? 1.0 : -1.0);\n\n float intensity = u_light.x;\n // We add PI to make this property match the global light object, which adds PI/2 to the light's azimuthal\n // position property to account for 0deg corresponding to north/the top of the viewport in the style spec\n // and the original shader was written to accept (-illuminationDirection - 90) as the azimuthal.\n float azimuth = u_light.y + PI;\n\n // We scale the slope exponentially based on intensity, using a calculation similar to\n // the exponential interpolation function in the style spec:\n // https://github.com/mapbox/mapbox-gl-js/blob/master/src/style-spec/expression/definitions/interpolate.js#L217-L228\n // so that higher intensity values create more opaque hillshading.\n float base = 1.875 - intensity * 1.75;\n float maxValue = 0.5 * PI;\n float scaledSlope = intensity != 0.5 ? ((pow(base, slope) - 1.0) / (pow(base, maxValue) - 1.0)) * maxValue : slope;\n\n // The accent color is calculated with the cosine of the slope while the shade color is calculated with the sine\n // so that the accent color's rate of change eases in while the shade color's eases out.\n float accent = cos(scaledSlope);\n // We multiply both the accent and shade color by a clamped intensity value\n // so that intensities >= 0.5 do not additionally affect the color values\n // while intensity values < 0.5 make the overall color more transparent.\n vec4 accent_color = (1.0 - accent) * u_accent * clamp(intensity * 2.0, 0.0, 1.0);\n float shade = abs(mod((aspect + azimuth) / PI + 0.5, 2.0) - 1.0);\n vec4 shade_color = mix(u_shadow, u_highlight, shade) * sin(scaledSlope) * clamp(intensity * 2.0, 0.0, 1.0);\n gl_FragColor = accent_color * (1.0 - shade_color.a) + shade_color;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = a_texture_pos / 8192.0;\n}\n"},line:{fragmentSource:"#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_width2;\nvarying vec2 v_normal;\nvarying float v_gamma_scale;\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_width2.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_width2.t) or when fading out\n // (v_width2.s)\n float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;\n float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);\n\n gl_FragColor = color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"\n\n// the distance over which the line edge fades out.\n// Retina devices need a smaller distance to avoid aliasing.\n#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\nattribute vec4 a_pos_normal;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform vec2 u_gl_units_to_pixels;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying float v_gamma_scale;\nvarying highp float v_linesofar;\n\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize mediump float gapwidth\n #pragma mapbox: initialize lowp float offset\n #pragma mapbox: initialize mediump float width\n\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n\n v_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * 2.0;\n\n vec2 pos = a_pos_normal.xy;\n\n // x is 1 if it's a round cap, 0 otherwise\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = a_pos_normal.zw;\n v_normal = normal;\n\n // these transformations used to be applied in the JS and native code bases.\n // moved them into the shader for clarity and simplicity.\n gapwidth = gapwidth / 2.0;\n float halfwidth = width / 2.0;\n offset = -1.0 * offset;\n\n float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);\n float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + (halfwidth == 0.0 ? 0.0 : ANTIALIASING);\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);\n gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;\n\n // calculate how much the perspective view squishes or stretches the extrude\n float extrude_length_without_perspective = length(dist);\n float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels);\n v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;\n\n v_width2 = vec2(outset, inset);\n}\n"},lineGradient:{fragmentSource:"\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n\nuniform sampler2D u_image;\n\nvarying vec2 v_width2;\nvarying vec2 v_normal;\nvarying float v_gamma_scale;\nvarying highp float v_lineprogress;\n\nvoid main() {\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_width2.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_width2.t) or when fading out\n // (v_width2.s)\n float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;\n float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);\n\n // For gradient lines, v_lineprogress is the ratio along the entire line,\n // scaled to [0, 2^15), and the gradient ramp is stored in a texture.\n vec4 color = texture2D(u_image, vec2(v_lineprogress, 0.5));\n\n gl_FragColor = color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"\n// the attribute conveying progress along a line is scaled to [0, 2^15)\n#define MAX_LINE_DISTANCE 32767.0\n\n// the distance over which the line edge fades out.\n// Retina devices need a smaller distance to avoid aliasing.\n#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\nattribute vec4 a_pos_normal;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform vec2 u_gl_units_to_pixels;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying float v_gamma_scale;\nvarying highp float v_lineprogress;\n\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n\nvoid main() {\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize mediump float gapwidth\n #pragma mapbox: initialize lowp float offset\n #pragma mapbox: initialize mediump float width\n\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n\n v_lineprogress = (floor(a_data.z / 4.0) + a_data.w * 64.0) * 2.0 / MAX_LINE_DISTANCE;\n\n vec2 pos = a_pos_normal.xy;\n\n // x is 1 if it's a round cap, 0 otherwise\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = a_pos_normal.zw;\n v_normal = normal;\n\n // these transformations used to be applied in the JS and native code bases.\n // moved them into the shader for clarity and simplicity.\n gapwidth = gapwidth / 2.0;\n float halfwidth = width / 2.0;\n offset = -1.0 * offset;\n\n float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);\n float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + (halfwidth == 0.0 ? 0.0 : ANTIALIASING);\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);\n gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;\n\n // calculate how much the perspective view squishes or stretches the extrude\n float extrude_length_without_perspective = length(dist);\n float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels);\n v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;\n\n v_width2 = vec2(outset, inset);\n}\n"},linePattern:{fragmentSource:"uniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform vec2 u_texsize;\nuniform float u_fade;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_width2.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_width2.t) or when fading out\n // (v_width2.s)\n float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;\n float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);\n\n float x_a = mod(v_linesofar / u_pattern_size_a.x, 1.0);\n float x_b = mod(v_linesofar / u_pattern_size_b.x, 1.0);\n\n // v_normal.y is 0 at the midpoint of the line, -1 at the lower edge, 1 at the upper edge\n // we clamp the line width outset to be between 0 and half the pattern height plus padding (2.0)\n // to ensure we don't sample outside the designated symbol on the sprite sheet.\n // 0.5 is added to shift the component to be bounded between 0 and 1 for interpolation of\n // the texture coordinate\n float y_a = 0.5 + (v_normal.y * clamp(v_width2.s, 0.0, (u_pattern_size_a.y + 2.0) / 2.0) / u_pattern_size_a.y);\n float y_b = 0.5 + (v_normal.y * clamp(v_width2.s, 0.0, (u_pattern_size_b.y + 2.0) / 2.0) / u_pattern_size_b.y);\n vec2 pos_a = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, vec2(x_a, y_a));\n vec2 pos_b = mix(u_pattern_tl_b / u_texsize, u_pattern_br_b / u_texsize, vec2(x_b, y_b));\n\n vec4 color = mix(texture2D(u_image, pos_a), texture2D(u_image, pos_b), u_fade);\n\n gl_FragColor = color * alpha * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\n// the distance over which the line edge fades out.\n// Retina devices need a smaller distance to avoid aliasing.\n#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0\n\nattribute vec4 a_pos_normal;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform vec2 u_gl_units_to_pixels;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\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\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\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n vec2 pos = a_pos_normal.xy;\n\n // x is 1 if it's a round cap, 0 otherwise\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = a_pos_normal.zw;\n v_normal = normal;\n\n // these transformations used to be applied in the JS and native code bases.\n // moved them into the shader for clarity and simplicity.\n gapwidth = gapwidth / 2.0;\n float halfwidth = width / 2.0;\n offset = -1.0 * offset;\n\n float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);\n float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + (halfwidth == 0.0 ? 0.0 : ANTIALIASING);\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);\n gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;\n\n // calculate how much the perspective view squishes or stretches the extrude\n float extrude_length_without_perspective = length(dist);\n float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels);\n v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;\n\n v_linesofar = a_linesofar;\n v_width2 = vec2(outset, inset);\n}\n"},lineSDF:{fragmentSource:"\nuniform sampler2D u_image;\nuniform float u_sdfgamma;\nuniform float u_mix;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize mediump float width\n #pragma mapbox: initialize lowp float floorwidth\n\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_width2.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_width2.t) or when fading out\n // (v_width2.s)\n float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;\n float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);\n\n float sdfdist_a = texture2D(u_image, v_tex_a).a;\n float sdfdist_b = texture2D(u_image, v_tex_b).a;\n float sdfdist = mix(sdfdist_a, sdfdist_b, u_mix);\n alpha *= smoothstep(0.5 - u_sdfgamma / floorwidth, 0.5 + u_sdfgamma / floorwidth, sdfdist);\n\n gl_FragColor = color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\n// the distance over which the line edge fades out.\n// Retina devices need a smaller distance to avoid aliasing.\n#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0\n\nattribute vec4 a_pos_normal;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform vec2 u_patternscale_a;\nuniform float u_tex_y_a;\nuniform vec2 u_patternscale_b;\nuniform float u_tex_y_b;\nuniform vec2 u_gl_units_to_pixels;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize mediump float gapwidth\n #pragma mapbox: initialize lowp float offset\n #pragma mapbox: initialize mediump float width\n #pragma mapbox: initialize lowp float floorwidth\n\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n vec2 pos = a_pos_normal.xy;\n\n // x is 1 if it's a round cap, 0 otherwise\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = a_pos_normal.zw;\n v_normal = normal;\n\n // these transformations used to be applied in the JS and native code bases.\n // moved them into the shader for clarity and simplicity.\n gapwidth = gapwidth / 2.0;\n float halfwidth = width / 2.0;\n offset = -1.0 * offset;\n\n float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);\n float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + (halfwidth == 0.0 ? 0.0 : ANTIALIASING);\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist =outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);\n gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;\n\n // calculate how much the perspective view squishes or stretches the extrude\n float extrude_length_without_perspective = length(dist);\n float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels);\n v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;\n\n v_tex_a = vec2(a_linesofar * u_patternscale_a.x / floorwidth, normal.y * u_patternscale_a.y + u_tex_y_a);\n v_tex_b = vec2(a_linesofar * u_patternscale_b.x / floorwidth, normal.y * u_patternscale_b.y + u_tex_y_b);\n\n v_width2 = vec2(outset, inset);\n}\n"},raster:{fragmentSource:"uniform float u_fade_t;\nuniform float u_opacity;\nuniform sampler2D u_image0;\nuniform sampler2D u_image1;\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nuniform float u_brightness_low;\nuniform float u_brightness_high;\n\nuniform float u_saturation_factor;\nuniform float u_contrast_factor;\nuniform vec3 u_spin_weights;\n\nvoid main() {\n\n // read and cross-fade colors from the main and parent tiles\n vec4 color0 = texture2D(u_image0, v_pos0);\n vec4 color1 = texture2D(u_image1, v_pos1);\n if (color0.a > 0.0) {\n color0.rgb = color0.rgb / color0.a;\n }\n if (color1.a > 0.0) {\n color1.rgb = color1.rgb / color1.a;\n }\n vec4 color = mix(color0, color1, u_fade_t);\n color.a *= u_opacity;\n vec3 rgb = color.rgb;\n\n // spin\n rgb = vec3(\n dot(rgb, u_spin_weights.xyz),\n dot(rgb, u_spin_weights.zxy),\n dot(rgb, u_spin_weights.yzx));\n\n // saturation\n float average = (color.r + color.g + color.b) / 3.0;\n rgb += (average - rgb) * u_saturation_factor;\n\n // contrast\n rgb = (rgb - 0.5) * u_contrast_factor + 0.5;\n\n // brightness\n vec3 u_high_vec = vec3(u_brightness_low, u_brightness_low, u_brightness_low);\n vec3 u_low_vec = vec3(u_brightness_high, u_brightness_high, u_brightness_high);\n\n gl_FragColor = vec4(mix(u_high_vec, u_low_vec, rgb) * color.a, color.a);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_tl_parent;\nuniform float u_scale_parent;\nuniform float u_buffer_scale;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n // We are using Int16 for texture position coordinates to give us enough precision for\n // fractional coordinates. We use 8192 to scale the texture coordinates in the buffer\n // as an arbitrarily high number to preserve adequate precision when rendering.\n // This is also the same value as the EXTENT we are using for our tile buffer pos coordinates,\n // so math for modifying either is consistent.\n v_pos0 = (((a_texture_pos / 8192.0) - 0.5) / u_buffer_scale ) + 0.5;\n v_pos1 = (v_pos0 * u_scale_parent) + u_tl_parent;\n}\n"},symbolIcon:{fragmentSource:"uniform sampler2D u_texture;\n\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_tex;\nvarying float v_fade_opacity;\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n lowp float alpha = opacity * v_fade_opacity;\n gl_FragColor = texture2D(u_texture, v_tex) * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"const float PI = 3.141592653589793;\n\nattribute vec4 a_pos_offset;\nattribute vec4 a_data;\nattribute vec3 a_projected_pos;\nattribute float a_fade_opacity;\n\nuniform bool u_is_size_zoom_constant;\nuniform bool u_is_size_feature_constant;\nuniform highp float u_size_t; // used to interpolate between zoom stops when size is a composite function\nuniform highp float u_size; // used when size is both zoom and feature constant\nuniform highp float u_camera_to_center_distance;\nuniform highp float u_pitch;\nuniform bool u_rotate_symbol;\nuniform highp float u_aspect_ratio;\nuniform float u_fade_change;\n\n#pragma mapbox: define lowp float opacity\n\nuniform mat4 u_matrix;\nuniform mat4 u_label_plane_matrix;\nuniform mat4 u_gl_coord_matrix;\n\nuniform bool u_is_text;\nuniform bool u_pitch_with_map;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying float v_fade_opacity;\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n vec2 a_pos = a_pos_offset.xy;\n vec2 a_offset = a_pos_offset.zw;\n\n vec2 a_tex = a_data.xy;\n vec2 a_size = a_data.zw;\n\n highp float segment_angle = -a_projected_pos[2];\n\n float size;\n if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {\n size = mix(a_size[0], a_size[1], u_size_t) / 10.0;\n } else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {\n size = a_size[0] / 10.0;\n } else if (!u_is_size_zoom_constant && u_is_size_feature_constant) {\n size = u_size;\n } else {\n size = u_size;\n }\n\n vec4 projectedPoint = u_matrix * vec4(a_pos, 0, 1);\n highp float camera_to_anchor_distance = projectedPoint.w;\n // See comments in symbol_sdf.vertex\n highp float distance_ratio = u_pitch_with_map ?\n camera_to_anchor_distance / u_camera_to_center_distance :\n u_camera_to_center_distance / camera_to_anchor_distance;\n highp float perspective_ratio = clamp(\n 0.5 + 0.5 * distance_ratio,\n 0.0, // Prevents oversized near-field symbols in pitched/overzoomed tiles\n 4.0);\n\n size *= perspective_ratio;\n\n float fontScale = u_is_text ? size / 24.0 : size;\n\n highp float symbol_rotation = 0.0;\n if (u_rotate_symbol) {\n // See comments in symbol_sdf.vertex\n vec4 offsetProjectedPoint = u_matrix * vec4(a_pos + vec2(1, 0), 0, 1);\n\n vec2 a = projectedPoint.xy / projectedPoint.w;\n vec2 b = offsetProjectedPoint.xy / offsetProjectedPoint.w;\n\n symbol_rotation = atan((b.y - a.y) / u_aspect_ratio, b.x - a.x);\n }\n\n highp float angle_sin = sin(segment_angle + symbol_rotation);\n highp float angle_cos = cos(segment_angle + symbol_rotation);\n mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);\n\n vec4 projected_pos = u_label_plane_matrix * vec4(a_projected_pos.xy, 0.0, 1.0);\n gl_Position = u_gl_coord_matrix * vec4(projected_pos.xy / projected_pos.w + rotation_matrix * (a_offset / 32.0 * fontScale), 0.0, 1.0);\n\n v_tex = a_tex / u_texsize;\n vec2 fade_opacity = unpack_opacity(a_fade_opacity);\n float fade_change = fade_opacity[1] > 0.5 ? u_fade_change : -u_fade_change;\n v_fade_opacity = max(0.0, min(1.0, fade_opacity[0] + fade_change));\n}\n"},symbolSDF:{fragmentSource:"#define SDF_PX 8.0\n#define EDGE_GAMMA 0.105/DEVICE_PIXEL_RATIO\n\nuniform bool u_is_halo;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n\nuniform sampler2D u_texture;\nuniform highp float u_gamma_scale;\nuniform bool u_is_text;\n\nvarying vec2 v_data0;\nvarying vec3 v_data1;\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 fill_color\n #pragma mapbox: initialize highp vec4 halo_color\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize lowp float halo_width\n #pragma mapbox: initialize lowp float halo_blur\n\n vec2 tex = v_data0.xy;\n float gamma_scale = v_data1.x;\n float size = v_data1.y;\n float fade_opacity = v_data1[2];\n\n float fontScale = u_is_text ? size / 24.0 : size;\n\n lowp vec4 color = fill_color;\n highp float gamma = EDGE_GAMMA / (fontScale * u_gamma_scale);\n lowp float buff = (256.0 - 64.0) / 256.0;\n if (u_is_halo) {\n color = halo_color;\n gamma = (halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (fontScale * u_gamma_scale);\n buff = (6.0 - halo_width / fontScale) / SDF_PX;\n }\n\n lowp float dist = texture2D(u_texture, tex).a;\n highp float gamma_scaled = gamma * gamma_scale;\n highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);\n\n gl_FragColor = color * (alpha * opacity * fade_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"const float PI = 3.141592653589793;\n\nattribute vec4 a_pos_offset;\nattribute vec4 a_data;\nattribute vec3 a_projected_pos;\nattribute float a_fade_opacity;\n\n// contents of a_size vary based on the type of property value\n// used for {text,icon}-size.\n// For constants, a_size is disabled.\n// For source functions, we bind only one value per vertex: the value of {text,icon}-size evaluated for the current feature.\n// For composite functions:\n// [ text-size(lowerZoomStop, feature),\n// text-size(upperZoomStop, feature) ]\nuniform bool u_is_size_zoom_constant;\nuniform bool u_is_size_feature_constant;\nuniform highp float u_size_t; // used to interpolate between zoom stops when size is a composite function\nuniform highp float u_size; // used when size is both zoom and feature constant\n\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n\nuniform mat4 u_matrix;\nuniform mat4 u_label_plane_matrix;\nuniform mat4 u_gl_coord_matrix;\n\nuniform bool u_is_text;\nuniform bool u_pitch_with_map;\nuniform highp float u_pitch;\nuniform bool u_rotate_symbol;\nuniform highp float u_aspect_ratio;\nuniform highp float u_camera_to_center_distance;\nuniform float u_fade_change;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_data0;\nvarying vec3 v_data1;\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 fill_color\n #pragma mapbox: initialize highp vec4 halo_color\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize lowp float halo_width\n #pragma mapbox: initialize lowp float halo_blur\n\n vec2 a_pos = a_pos_offset.xy;\n vec2 a_offset = a_pos_offset.zw;\n\n vec2 a_tex = a_data.xy;\n vec2 a_size = a_data.zw;\n\n highp float segment_angle = -a_projected_pos[2];\n float size;\n\n if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {\n size = mix(a_size[0], a_size[1], u_size_t) / 10.0;\n } else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {\n size = a_size[0] / 10.0;\n } else if (!u_is_size_zoom_constant && u_is_size_feature_constant) {\n size = u_size;\n } else {\n size = u_size;\n }\n\n vec4 projectedPoint = u_matrix * vec4(a_pos, 0, 1);\n highp float camera_to_anchor_distance = projectedPoint.w;\n // If the label is pitched with the map, layout is done in pitched space,\n // which makes labels in the distance smaller relative to viewport space.\n // We counteract part of that effect by multiplying by the perspective ratio.\n // If the label isn't pitched with the map, we do layout in viewport space,\n // which makes labels in the distance larger relative to the features around\n // them. We counteract part of that effect by dividing by the perspective ratio.\n highp float distance_ratio = u_pitch_with_map ?\n camera_to_anchor_distance / u_camera_to_center_distance :\n u_camera_to_center_distance / camera_to_anchor_distance;\n highp float perspective_ratio = clamp(\n 0.5 + 0.5 * distance_ratio,\n 0.0, // Prevents oversized near-field symbols in pitched/overzoomed tiles\n 4.0);\n\n size *= perspective_ratio;\n\n float fontScale = u_is_text ? size / 24.0 : size;\n\n highp float symbol_rotation = 0.0;\n if (u_rotate_symbol) {\n // Point labels with 'rotation-alignment: map' are horizontal with respect to tile units\n // To figure out that angle in projected space, we draw a short horizontal line in tile\n // space, project it, and measure its angle in projected space.\n vec4 offsetProjectedPoint = u_matrix * vec4(a_pos + vec2(1, 0), 0, 1);\n\n vec2 a = projectedPoint.xy / projectedPoint.w;\n vec2 b = offsetProjectedPoint.xy / offsetProjectedPoint.w;\n\n symbol_rotation = atan((b.y - a.y) / u_aspect_ratio, b.x - a.x);\n }\n\n highp float angle_sin = sin(segment_angle + symbol_rotation);\n highp float angle_cos = cos(segment_angle + symbol_rotation);\n mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);\n\n vec4 projected_pos = u_label_plane_matrix * vec4(a_projected_pos.xy, 0.0, 1.0);\n gl_Position = u_gl_coord_matrix * vec4(projected_pos.xy / projected_pos.w + rotation_matrix * (a_offset / 32.0 * fontScale), 0.0, 1.0);\n float gamma_scale = gl_Position.w;\n\n vec2 tex = a_tex / u_texsize;\n vec2 fade_opacity = unpack_opacity(a_fade_opacity);\n float fade_change = fade_opacity[1] > 0.5 ? u_fade_change : -u_fade_change;\n float interpolated_fade_opacity = max(0.0, min(1.0, fade_opacity[0] + fade_change));\n\n v_data0 = vec2(tex.x, tex.y);\n v_data1 = vec3(gamma_scale, size, interpolated_fade_opacity);\n}\n"}},Ue=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,$e=function(t){var e=je[t],r={};e.fragmentSource=e.fragmentSource.replace(Ue,function(t,e,n,i,o){return r[o]=!0,"define"===e?"\n#ifndef HAS_UNIFORM_u_"+o+"\nvarying "+n+" "+i+" "+o+";\n#else\nuniform "+n+" "+i+" u_"+o+";\n#endif\n":"\n#ifdef HAS_UNIFORM_u_"+o+"\n "+n+" "+i+" "+o+" = u_"+o+";\n#endif\n"}),e.vertexSource=e.vertexSource.replace(Ue,function(t,e,n,i,o){var a="float"===i?"vec2":"vec4";return r[o]?"define"===e?"\n#ifndef HAS_UNIFORM_u_"+o+"\nuniform lowp float a_"+o+"_t;\nattribute "+n+" "+a+" a_"+o+";\nvarying "+n+" "+i+" "+o+";\n#else\nuniform "+n+" "+i+" u_"+o+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+o+"\n "+o+" = unpack_mix_"+a+"(a_"+o+", a_"+o+"_t);\n#else\n "+n+" "+i+" "+o+" = u_"+o+";\n#endif\n":"define"===e?"\n#ifndef HAS_UNIFORM_u_"+o+"\nuniform lowp float a_"+o+"_t;\nattribute "+n+" "+a+" a_"+o+";\n#else\nuniform "+n+" "+i+" u_"+o+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+o+"\n "+n+" "+i+" "+o+" = unpack_mix_"+a+"(a_"+o+", a_"+o+"_t);\n#else\n "+n+" "+i+" "+o+" = u_"+o+";\n#endif\n"})};for(var qe in je)$e(qe);var Ze=je,Ge=function(e,r,n,i){var o=e.gl;this.program=o.createProgram();var a=n.defines().concat("#define DEVICE_PIXEL_RATIO "+t.default$2.devicePixelRatio.toFixed(1));i&&a.push("#define OVERDRAW_INSPECTOR;");var s=a.concat(Ze.prelude.fragmentSource,r.fragmentSource).join("\n"),l=a.concat(Ze.prelude.vertexSource,r.vertexSource).join("\n"),u=o.createShader(o.FRAGMENT_SHADER);o.shaderSource(u,s),o.compileShader(u),o.attachShader(this.program,u);var c=o.createShader(o.VERTEX_SHADER);o.shaderSource(c,l),o.compileShader(c),o.attachShader(this.program,c);for(var h=n.layoutAttributes||[],p=0;p>16,s>>16),n.uniform2f(r.uniforms.u_pixel_coord_lower,65535&a,65535&s)};function or(t,e,r,n,i){if(!rr(r.paint.get("fill-pattern"),t))for(var o=!0,a=0,s=n;a0){var s=t.default$2.now(),l=(s-e.timeAdded)/a,u=r?(s-r.timeAdded)/a:-1,c=n.getSource(),h=o.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),p=!r||Math.abs(r.tileID.overscaledZ-h)>Math.abs(e.tileID.overscaledZ-h),f=p&&e.refreshedUponExpiration?1:t.clamp(p?l:1-u,0,1);return e.refreshedUponExpiration&&l>=1&&(e.refreshedUponExpiration=!1),r?{opacity:1,mix:1-f}:{opacity:f,mix:0}}return{opacity:1,mix:0}}function fr(e,r,n){var i=e.context,o=i.gl,a=n.posMatrix,s=e.useProgram("debug");i.setDepthMode(Ct.disabled),i.setStencilMode(Mt.disabled),i.setColorMode(e.colorModeForRenderPass()),o.uniformMatrix4fv(s.uniforms.u_matrix,!1,a),o.uniform4f(s.uniforms.u_color,1,0,0,1),e.debugVAO.bind(i,s,e.debugBuffer,[]),o.drawArrays(o.LINE_STRIP,0,e.debugBuffer.length);for(var l=function(t,e,r,n){n=n||1;var i,o,a,s,l,u,c,h,p=[];for(i=0,o=t.length;i":[24,[4,18,20,9,4,0]],"?":[18,[3,16,3,17,4,19,5,20,7,21,11,21,13,20,14,19,15,17,15,15,14,13,13,12,9,10,9,7,-1,-1,9,2,8,1,9,0,10,1,9,2]],"@":[27,[18,13,17,15,15,16,12,16,10,15,9,14,8,11,8,8,9,6,11,5,14,5,16,6,17,8,-1,-1,12,16,10,14,9,11,9,8,10,6,11,5,-1,-1,18,16,17,8,17,6,19,5,21,5,23,7,24,10,24,12,23,15,22,17,20,19,18,20,15,21,12,21,9,20,7,19,5,17,4,15,3,12,3,9,4,6,5,4,7,2,9,1,12,0,15,0,18,1,20,2,21,3,-1,-1,19,16,18,8,18,6,19,5]],A:[18,[9,21,1,0,-1,-1,9,21,17,0,-1,-1,4,7,14,7]],B:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,-1,-1,4,11,13,11,16,10,17,9,18,7,18,4,17,2,16,1,13,0,4,0]],C:[21,[18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5]],D:[21,[4,21,4,0,-1,-1,4,21,11,21,14,20,16,18,17,16,18,13,18,8,17,5,16,3,14,1,11,0,4,0]],E:[19,[4,21,4,0,-1,-1,4,21,17,21,-1,-1,4,11,12,11,-1,-1,4,0,17,0]],F:[18,[4,21,4,0,-1,-1,4,21,17,21,-1,-1,4,11,12,11]],G:[21,[18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,18,8,-1,-1,13,8,18,8]],H:[22,[4,21,4,0,-1,-1,18,21,18,0,-1,-1,4,11,18,11]],I:[8,[4,21,4,0]],J:[16,[12,21,12,5,11,2,10,1,8,0,6,0,4,1,3,2,2,5,2,7]],K:[21,[4,21,4,0,-1,-1,18,21,4,7,-1,-1,9,12,18,0]],L:[17,[4,21,4,0,-1,-1,4,0,16,0]],M:[24,[4,21,4,0,-1,-1,4,21,12,0,-1,-1,20,21,12,0,-1,-1,20,21,20,0]],N:[22,[4,21,4,0,-1,-1,4,21,18,0,-1,-1,18,21,18,0]],O:[22,[9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21]],P:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,14,17,12,16,11,13,10,4,10]],Q:[22,[9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21,-1,-1,12,4,18,-2]],R:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,4,11,-1,-1,11,11,18,0]],S:[20,[17,18,15,20,12,21,8,21,5,20,3,18,3,16,4,14,5,13,7,12,13,10,15,9,16,8,17,6,17,3,15,1,12,0,8,0,5,1,3,3]],T:[16,[8,21,8,0,-1,-1,1,21,15,21]],U:[22,[4,21,4,6,5,3,7,1,10,0,12,0,15,1,17,3,18,6,18,21]],V:[18,[1,21,9,0,-1,-1,17,21,9,0]],W:[24,[2,21,7,0,-1,-1,12,21,7,0,-1,-1,12,21,17,0,-1,-1,22,21,17,0]],X:[20,[3,21,17,0,-1,-1,17,21,3,0]],Y:[18,[1,21,9,11,9,0,-1,-1,17,21,9,11]],Z:[20,[17,21,3,0,-1,-1,3,21,17,21,-1,-1,3,0,17,0]],"[":[14,[4,25,4,-7,-1,-1,5,25,5,-7,-1,-1,4,25,11,25,-1,-1,4,-7,11,-7]],"\\":[14,[0,21,14,-3]],"]":[14,[9,25,9,-7,-1,-1,10,25,10,-7,-1,-1,3,25,10,25,-1,-1,3,-7,10,-7]],"^":[16,[6,15,8,18,10,15,-1,-1,3,12,8,17,13,12,-1,-1,8,17,8,0]],_:[16,[0,-2,16,-2]],"`":[10,[6,21,5,20,4,18,4,16,5,15,6,16,5,17]],a:[19,[15,14,15,0,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],b:[19,[4,21,4,0,-1,-1,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3]],c:[18,[15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],d:[19,[15,21,15,0,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],e:[18,[3,8,15,8,15,10,14,12,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],f:[12,[10,21,8,21,6,20,5,17,5,0,-1,-1,2,14,9,14]],g:[19,[15,14,15,-2,14,-5,13,-6,11,-7,8,-7,6,-6,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],h:[19,[4,21,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0]],i:[8,[3,21,4,20,5,21,4,22,3,21,-1,-1,4,14,4,0]],j:[10,[5,21,6,20,7,21,6,22,5,21,-1,-1,6,14,6,-3,5,-6,3,-7,1,-7]],k:[17,[4,21,4,0,-1,-1,14,14,4,4,-1,-1,8,8,15,0]],l:[8,[4,21,4,0]],m:[30,[4,14,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0,-1,-1,15,10,18,13,20,14,23,14,25,13,26,10,26,0]],n:[19,[4,14,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0]],o:[19,[8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3,16,6,16,8,15,11,13,13,11,14,8,14]],p:[19,[4,14,4,-7,-1,-1,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3]],q:[19,[15,14,15,-7,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],r:[13,[4,14,4,0,-1,-1,4,8,5,11,7,13,9,14,12,14]],s:[17,[14,11,13,13,10,14,7,14,4,13,3,11,4,9,6,8,11,7,13,6,14,4,14,3,13,1,10,0,7,0,4,1,3,3]],t:[12,[5,21,5,4,6,1,8,0,10,0,-1,-1,2,14,9,14]],u:[19,[4,14,4,4,5,1,7,0,10,0,12,1,15,4,-1,-1,15,14,15,0]],v:[16,[2,14,8,0,-1,-1,14,14,8,0]],w:[22,[3,14,7,0,-1,-1,11,14,7,0,-1,-1,11,14,15,0,-1,-1,19,14,15,0]],x:[17,[3,14,14,0,-1,-1,14,14,3,0]],y:[16,[2,14,8,0,-1,-1,14,14,8,0,6,-4,4,-6,2,-7,1,-7]],z:[17,[14,14,3,0,-1,-1,3,14,14,14,-1,-1,3,0,14,0]],"{":[14,[9,25,7,24,6,23,5,21,5,19,6,17,7,16,8,14,8,12,6,10,-1,-1,7,24,6,22,6,20,7,18,8,17,9,15,9,13,8,11,4,9,8,7,9,5,9,3,8,1,7,0,6,-2,6,-4,7,-6,-1,-1,6,8,8,6,8,4,7,2,6,1,5,-1,5,-3,6,-5,7,-6,9,-7]],"|":[8,[4,25,4,-7]],"}":[14,[5,25,7,24,8,23,9,21,9,19,8,17,7,16,6,14,6,12,8,10,-1,-1,7,24,8,22,8,20,7,18,6,17,5,15,5,13,6,11,10,9,6,7,5,5,5,3,6,1,7,0,8,-2,8,-4,7,-6,-1,-1,8,8,6,6,6,4,7,2,8,1,9,-1,9,-3,8,-5,7,-6,5,-7]],"~":[24,[3,6,3,8,4,11,6,12,8,12,10,11,14,8,16,7,18,7,20,8,21,10,-1,-1,3,8,4,10,6,11,8,11,10,10,14,7,16,6,18,6,20,7,21,10,21,12]]},mr={symbol:function(t,e,r,n){if("translucent"===t.renderPass){var i=t.context;i.setStencilMode(Mt.disabled),i.setColorMode(t.colorModeForRenderPass()),0!==r.paint.get("icon-opacity").constantOr(1)&&Je(t,e,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")),0!==r.paint.get("text-opacity").constantOr(1)&&Je(t,e,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")),e.map.showCollisionBoxes&&function(t,e,r,n){Xe(t,e,r,n,!1),Xe(t,e,r,n,!0)}(t,e,r,n)}},circle:function(t,e,r,n){if("translucent"===t.renderPass){var i=r.paint.get("circle-opacity"),o=r.paint.get("circle-stroke-width"),a=r.paint.get("circle-stroke-opacity");if(0!==i.constantOr(1)||0!==o.constantOr(1)&&0!==a.constantOr(1)){var s=t.context,l=s.gl;s.setDepthMode(t.depthModeForSublayer(0,Ct.ReadOnly)),s.setStencilMode(Mt.disabled),s.setColorMode(t.colorModeForRenderPass());for(var u=!0,c=0;c0?1-1/(1.001-i):-i),s.uniform1f(u.uniforms.u_contrast_factor,(o=r.paint.get("raster-contrast"))>0?1/(1-o):1+o),s.uniform3fv(u.uniforms.u_spin_weights,function(t){t*=Math.PI/180;var e=Math.sin(t),r=Math.cos(t);return[(2*r+1)/3,(-Math.sqrt(3)*e-r+1)/3,(Math.sqrt(3)*e-r+1)/3]}(r.paint.get("raster-hue-rotate"))),s.uniform1f(u.uniforms.u_buffer_scale,1),s.uniform1i(u.uniforms.u_image0,0),s.uniform1i(u.uniforms.u_image1,1);for(var c=n.length&&n[0].overscaledZ,h=0,p=n;he.row){var r=t;t=e,e=r}return{x0:t.column,y0:t.row,x1:e.column,y1:e.row,dx:e.column-t.column,dy:e.row-t.row}}function vr(t,e,r,n,i){var o=Math.max(r,Math.floor(e.y0)),a=Math.min(n,Math.ceil(e.y1));if(t.x0===e.x0&&t.y0===e.y0?t.x0+e.dy/t.dy*t.dx0,h=e.dx<0,p=o;pl.dy&&(a=s,s=l,l=a),s.dy>u.dy&&(a=s,s=u,u=a),l.dy>u.dy&&(a=l,l=u,u=a),s.dy&&vr(u,s,n,i,o),l.dy&&vr(u,l,n,i,o)}yr.prototype.resize=function(e,r){var n=this.context.gl;if(this.width=e*t.default$2.devicePixelRatio,this.height=r*t.default$2.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(var i=0,o=this.style._order;i=0;this.currentLayer--){var y=n.style._layers[a[n.currentLayer]];y.source!==(d&&d.id)&&(m=[],(d=n.style.sourceCaches[y.source])&&(n.clearStencil(),m=d.getVisibleCoordinates(),d.getSource().isTileClipped&&n._renderTileClippingMasks(m))),n.renderLayer(n,d,y,m)}this.renderPass="translucent";var g,v=[];for(this.currentLayer=0,this.currentLayer;this.currentLayer0?e.pop():null},yr.prototype._createProgramCached=function(t,e){this.cache=this.cache||{};var r=""+t+(e.cacheKey||"")+(this._showOverdrawInspector?"/overdraw":"");return this.cache[r]||(this.cache[r]=new Ge(this.context,Ze[t],e,this._showOverdrawInspector)),this.cache[r]},yr.prototype.useProgram=function(t,e){var r=this._createProgramCached(t,e||this.emptyProgramConfiguration);return this.context.program.set(r.program),r};var xr=function(t,e,r){this.tileSize=512,this._renderWorldCopies=void 0===r||r,this._minZoom=t||0,this._maxZoom=e||22,this.latRange=[-85.05113,85.05113],this.width=0,this.height=0,this._center=new R(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._posMatrixCache={},this._alignedPosMatrixCache={}},br={minZoom:{configurable:!0},maxZoom:{configurable:!0},renderWorldCopies:{configurable:!0},worldSize:{configurable:!0},centerPoint:{configurable:!0},size:{configurable:!0},bearing:{configurable:!0},pitch:{configurable:!0},fov:{configurable:!0},zoom:{configurable:!0},center:{configurable:!0},unmodified:{configurable:!0},x:{configurable:!0},y:{configurable:!0},point:{configurable:!0}};xr.prototype.clone=function(){var t=new xr(this._minZoom,this._maxZoom,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._calcMatrices(),t},br.minZoom.get=function(){return this._minZoom},br.minZoom.set=function(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},br.maxZoom.get=function(){return this._maxZoom},br.maxZoom.set=function(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},br.renderWorldCopies.get=function(){return this._renderWorldCopies},br.renderWorldCopies.set=function(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t},br.worldSize.get=function(){return this.tileSize*this.scale},br.centerPoint.get=function(){return this.size._div(2)},br.size.get=function(){return new t.default(this.width,this.height)},br.bearing.get=function(){return-this.angle/Math.PI*180},br.bearing.set=function(e){var r=-t.wrap(e,-180,180)*Math.PI/180;this.angle!==r&&(this._unmodified=!1,this.angle=r,this._calcMatrices(),this.rotationMatrix=t.create$4(),t.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},br.pitch.get=function(){return this._pitch/Math.PI*180},br.pitch.set=function(e){var r=t.clamp(e,0,60)/180*Math.PI;this._pitch!==r&&(this._unmodified=!1,this._pitch=r,this._calcMatrices())},br.fov.get=function(){return this._fov/Math.PI*180},br.fov.set=function(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())},br.zoom.get=function(){return this._zoom},br.zoom.set=function(t){var e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom,this._constrain(),this._calcMatrices())},br.center.get=function(){return this._center},br.center.set=function(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())},xr.prototype.coveringZoomLevel=function(t){return(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize))},xr.prototype.getVisibleUnwrappedCoordinates=function(e){var r=this.pointCoordinate(new t.default(0,0),0),n=this.pointCoordinate(new t.default(this.width,0),0),i=Math.floor(r.column),o=Math.floor(n.column),a=[new t.UnwrappedTileID(0,e)];if(this._renderWorldCopies)for(var s=i;s<=o;s++)0!==s&&a.push(new t.UnwrappedTileID(s,e));return a},xr.prototype.coveringTiles=function(e){var r=this.coveringZoomLevel(e),n=r;if(void 0!==e.minzoom&&re.maxzoom&&(r=e.maxzoom);var i=this.pointCoordinate(this.centerPoint,r),o=new t.default(i.column-.5,i.row-.5);return function(e,r,n,i){void 0===i&&(i=!0);var o=1<=0&&l<=o)for(u=r;ua&&(i=a-m)}if(this.lngRange){var y=this.x,g=u.x/2;y-gl&&(n=l-g)}void 0===n&&void 0===i||(this.center=this.unproject(new t.default(void 0!==n?n:this.x,void 0!==i?i:this.y))),this._unmodified=c,this._constraining=!1}},xr.prototype._calcMatrices=function(){if(this.height){this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;var e=this._fov/2,r=Math.PI/2+this._pitch,n=Math.sin(e)*this.cameraToCenterDistance/Math.sin(Math.PI-r-e),i=this.x,o=this.y,a=1.01*(Math.cos(Math.PI/2-this._pitch)*n+this.cameraToCenterDistance),s=new Float64Array(16);t.perspective(s,this._fov,this.width/this.height,1,a),t.scale(s,s,[1,-1,1]),t.translate(s,s,[0,0,-this.cameraToCenterDistance]),t.rotateX(s,s,this._pitch),t.rotateZ(s,s,this.angle),t.translate(s,s,[-i,-o,0]);var l=this.worldSize/(2*Math.PI*6378137*Math.abs(Math.cos(this.center.lat*(Math.PI/180))));t.scale(s,s,[1,1,l,1]),this.projMatrix=s;var u=this.width%2/2,c=this.height%2/2,h=Math.cos(this.angle),p=Math.sin(this.angle),f=i-Math.round(i)+h*u+p*c,d=o-Math.round(o)+h*c+p*u,m=new Float64Array(s);if(t.translate(m,m,[f>.5?f-1:f,d>.5?d-1:d,0]),this.alignedProjMatrix=m,s=t.create(),t.scale(s,s,[this.width/2,-this.height/2,1]),t.translate(s,s,[1,-1,0]),this.pixelMatrix=t.multiply(new Float64Array(16),s,this.projMatrix),!(s=t.invert(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");this.pixelMatrixInverse=s,this._posMatrixCache={},this._alignedPosMatrixCache={}}},xr.prototype.maxPitchScaleFactor=function(){if(!this.pixelMatrixInverse)return 1;var e=this.pointCoordinate(new t.default(0,0)).zoomTo(this.zoom),r=[e.column*this.tileSize,e.row*this.tileSize,0,1];return t.transformMat4(r,r,this.pixelMatrix)[3]/this.cameraToCenterDistance},Object.defineProperties(xr.prototype,br);var wr=function(){var e,r,n,i;t.bindAll(["_onHashChange","_updateHash"],this),this._updateHash=(e=this._updateHashUnthrottled.bind(this),300,r=!1,n=0,i=function(){n=0,r&&(e(),n=setTimeout(i,300),r=!1)},function(){return r=!0,n||i(),n})};wr.prototype.addTo=function(e){return this._map=e,t.default$1.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},wr.prototype.remove=function(){return t.default$1.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this},wr.prototype.getHashString=function(t){var e=this._map.getCenter(),r=Math.round(100*this._map.getZoom())/100,n=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),i=Math.pow(10,n),o=Math.round(e.lng*i)/i,a=Math.round(e.lat*i)/i,s=this._map.getBearing(),l=this._map.getPitch(),u="";return u+=t?"#/"+o+"/"+a+"/"+r:"#"+r+"/"+a+"/"+o,(s||l)&&(u+="/"+Math.round(10*s)/10),l&&(u+="/"+Math.round(l)),u},wr.prototype._onHashChange=function(){var e=t.default$1.location.hash.replace("#","").split("/");return e.length>=3&&(this._map.jumpTo({center:[+e[2],+e[1]],zoom:+e[0],bearing:+(e[3]||0),pitch:+(e[4]||0)}),!0)},wr.prototype._updateHashUnthrottled=function(){var e=this.getHashString();t.default$1.history.replaceState(t.default$1.history.state,"",e)};var Er=function(e){function n(n,i,o,a){void 0===a&&(a={});var s=r.mousePos(i.getCanvasContainer(),o),l=i.unproject(s);e.call(this,n,t.extend({point:s,lngLat:l,originalEvent:o},a)),this._defaultPrevented=!1,this.target=i}e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n;var i={defaultPrevented:{configurable:!0}};return n.prototype.preventDefault=function(){this._defaultPrevented=!0},i.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(n.prototype,i),n}(t.Event),Sr=function(e){function n(n,i,o){var a=r.touchPos(i.getCanvasContainer(),o),s=a.map(function(t){return i.unproject(t)}),l=a.reduce(function(t,e,r,n){return t.add(e.div(n.length))},new t.default(0,0)),u=i.unproject(l);e.call(this,n,{points:a,point:l,lngLats:s,lngLat:u,originalEvent:o}),this._defaultPrevented=!1}e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n;var i={defaultPrevented:{configurable:!0}};return n.prototype.preventDefault=function(){this._defaultPrevented=!0},i.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(n.prototype,i),n}(t.Event),Tr=function(t){function e(e,r,n){t.call(this,e,{originalEvent:n}),this._defaultPrevented=!1}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={defaultPrevented:{configurable:!0}};return e.prototype.preventDefault=function(){this._defaultPrevented=!0},r.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(e.prototype,r),e}(t.Event),kr=function(e){this._map=e,this._el=e.getCanvasContainer(),this._delta=0,t.bindAll(["_onWheel","_onTimeout","_onScrollFrame","_onScrollFinished"],this)};kr.prototype.isEnabled=function(){return!!this._enabled},kr.prototype.isActive=function(){return!!this._active},kr.prototype.enable=function(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&"center"===t.around)},kr.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},kr.prototype.onWheel=function(e){if(this.isEnabled()){var r=e.deltaMode===t.default$1.WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,n=t.default$2.now(),i=n-(this._lastWheelEventTime||0);this._lastWheelEventTime=n,0!==r&&r%4.000244140625==0?this._type="wheel":0!==r&&Math.abs(r)<4?this._type="trackpad":i>400?(this._type=null,this._lastValue=r,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(i*r)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,r+=this._lastValue)),e.shiftKey&&r&&(r/=4),this._type&&(this._lastWheelEvent=e,this._delta-=r,this.isActive()||this._start(e)),e.preventDefault()}},kr.prototype._onTimeout=function(t){this._type="wheel",this._delta-=this._lastValue,this.isActive()||this._start(t)},kr.prototype._start=function(e){if(this._delta){this._frameId&&(this._map._cancelRenderFrame(this._frameId),this._frameId=null),this._active=!0,this._map.fire(new t.Event("movestart",{originalEvent:e})),this._map.fire(new t.Event("zoomstart",{originalEvent:e})),this._finishTimeout&&clearTimeout(this._finishTimeout);var n=r.mousePos(this._el,e);this._around=R.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(n)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=this._map._requestRenderFrame(this._onScrollFrame))}},kr.prototype._onScrollFrame=function(){var e=this;if(this._frameId=null,this.isActive()){var r=this._map.transform;if(0!==this._delta){var n="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?1/450:.01,i=2/(1+Math.exp(-Math.abs(this._delta*n)));this._delta<0&&0!==i&&(i=1/i);var o="number"==typeof this._targetZoom?r.zoomScale(this._targetZoom):r.scale;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom(o*i))),"wheel"===this._type&&(this._startZoom=r.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}var a=!1;if("wheel"===this._type){var s=Math.min((t.default$2.now()-this._lastWheelEventTime)/200,1),l=this._easing(s);r.zoom=t.number(this._startZoom,this._targetZoom,l),s<1?this._frameId||(this._frameId=this._map._requestRenderFrame(this._onScrollFrame)):a=!0}else r.zoom=this._targetZoom,a=!0;r.setLocationAtPoint(this._around,this._aroundPoint),this._map.fire(new t.Event("move",{originalEvent:this._lastWheelEvent})),this._map.fire(new t.Event("zoom",{originalEvent:this._lastWheelEvent})),a&&(this._active=!1,this._finishTimeout=setTimeout(function(){e._map.fire(new t.Event("zoomend",{originalEvent:e._lastWheelEvent})),e._map.fire(new t.Event("moveend",{originalEvent:e._lastWheelEvent})),delete e._targetZoom},200))}},kr.prototype._smoothOutEasing=function(e){var r=t.ease;if(this._prevEase){var n=this._prevEase,i=(t.default$2.now()-n.start)/n.duration,o=n.easing(i+.01)-n.easing(i),a=.27/Math.sqrt(o*o+1e-4)*.01,s=Math.sqrt(.0729-a*a);r=t.bezier(a,s,.25,1)}return this._prevEase={start:t.default$2.now(),duration:e,easing:r},r};var Ar=function(e){this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),t.bindAll(["_onMouseMove","_onMouseUp","_onKeyDown"],this)};Ar.prototype.isEnabled=function(){return!!this._enabled},Ar.prototype.isActive=function(){return!!this._active},Ar.prototype.enable=function(){this.isEnabled()||(this._enabled=!0)},Ar.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},Ar.prototype.onMouseDown=function(e){this.isEnabled()&&e.shiftKey&&0===e.button&&(t.default$1.document.addEventListener("mousemove",this._onMouseMove,!1),t.default$1.document.addEventListener("keydown",this._onKeyDown,!1),t.default$1.document.addEventListener("mouseup",this._onMouseUp,!1),r.disableDrag(),this._startPos=this._lastPos=r.mousePos(this._el,e),this._active=!0)},Ar.prototype._onMouseMove=function(t){var e=r.mousePos(this._el,t);if(!this._lastPos.equals(e)){var n=this._startPos;this._lastPos=e,this._box||(this._box=r.create("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));var i=Math.min(n.x,e.x),o=Math.max(n.x,e.x),a=Math.min(n.y,e.y),s=Math.max(n.y,e.y);r.setTransform(this._box,"translate("+i+"px,"+a+"px)"),this._box.style.width=o-i+"px",this._box.style.height=s-a+"px"}},Ar.prototype._onMouseUp=function(e){if(0===e.button){var n=this._startPos,i=r.mousePos(this._el,e),o=(new B).extend(this._map.unproject(n)).extend(this._map.unproject(i));this._finish(),r.suppressClick(),n.x===i.x&&n.y===i.y?this._fireEvent("boxzoomcancel",e):this._map.fitBounds(o,{linear:!0}).fire(new t.Event("boxzoomend",{originalEvent:e,boxZoomBounds:o}))}},Ar.prototype._onKeyDown=function(t){27===t.keyCode&&(this._finish(),this._fireEvent("boxzoomcancel",t))},Ar.prototype._finish=function(){this._active=!1,t.default$1.document.removeEventListener("mousemove",this._onMouseMove,!1),t.default$1.document.removeEventListener("keydown",this._onKeyDown,!1),t.default$1.document.removeEventListener("mouseup",this._onMouseUp,!1),this._container.classList.remove("mapboxgl-crosshair"),this._box&&(r.remove(this._box),this._box=null),r.enableDrag(),delete this._startPos,delete this._lastPos},Ar.prototype._fireEvent=function(e,r){return this._map.fire(new t.Event(e,{originalEvent:r}))};var Ir=t.bezier(0,0,.25,1),zr=function(e,r){this._map=e,this._el=r.element||e.getCanvasContainer(),this._state="disabled",this._button=r.button||"right",this._bearingSnap=r.bearingSnap||0,this._pitchWithRotate=!1!==r.pitchWithRotate,t.bindAll(["onMouseDown","_onMouseMove","_onMouseUp","_onBlur","_onDragFrame"],this)};zr.prototype.isEnabled=function(){return"disabled"!==this._state},zr.prototype.isActive=function(){return"active"===this._state},zr.prototype.enable=function(){this.isEnabled()||(this._state="enabled")},zr.prototype.disable=function(){if(this.isEnabled())switch(this._state){case"active":this._state="disabled",this._unbind(),this._deactivate(),this._fireEvent("rotateend"),this._pitchWithRotate&&this._fireEvent("pitchend"),this._fireEvent("moveend");break;case"pending":this._state="disabled",this._unbind();break;default:this._state="disabled"}},zr.prototype.onMouseDown=function(e){if("enabled"===this._state){if("right"===this._button){if(this._eventButton=r.mouseButton(e),this._eventButton!==(e.ctrlKey?0:2))return}else{if(e.ctrlKey||0!==r.mouseButton(e))return;this._eventButton=0}r.disableDrag(),t.default$1.document.addEventListener("mousemove",this._onMouseMove,{capture:!0}),t.default$1.document.addEventListener("mouseup",this._onMouseUp),t.default$1.addEventListener("blur",this._onBlur),this._state="pending",this._inertia=[[t.default$2.now(),this._map.getBearing()]],this._startPos=this._lastPos=r.mousePos(this._el,e),this._center=this._map.transform.centerPoint,e.preventDefault()}},zr.prototype._onMouseMove=function(t){var e=r.mousePos(this._el,t);this._lastPos.equals(e)||(this._lastMoveEvent=t,this._lastPos=e,"pending"===this._state&&(this._state="active",this._fireEvent("rotatestart",t),this._fireEvent("movestart",t),this._pitchWithRotate&&this._fireEvent("pitchstart",t)),this._frameId||(this._frameId=this._map._requestRenderFrame(this._onDragFrame)))},zr.prototype._onDragFrame=function(){this._frameId=null;var e=this._lastMoveEvent;if(e){var r=this._map.transform,n=this._startPos,i=this._lastPos,o=.8*(n.x-i.x),a=-.5*(n.y-i.y),s=r.bearing-o,l=r.pitch-a,u=this._inertia,c=u[u.length-1];this._drainInertiaBuffer(),u.push([t.default$2.now(),this._map._normalizeBearing(s,c[1])]),r.bearing=s,this._pitchWithRotate&&(this._fireEvent("pitch",e),r.pitch=l),this._fireEvent("rotate",e),this._fireEvent("move",e),delete this._lastMoveEvent,this._startPos=this._lastPos}},zr.prototype._onMouseUp=function(t){if(r.mouseButton(t)===this._eventButton)switch(this._state){case"active":this._state="enabled",r.suppressClick(),this._unbind(),this._deactivate(),this._inertialRotate(t);break;case"pending":this._state="enabled",this._unbind()}},zr.prototype._onBlur=function(t){switch(this._state){case"active":this._state="enabled",this._unbind(),this._deactivate(),this._fireEvent("rotateend",t),this._pitchWithRotate&&this._fireEvent("pitchend",t),this._fireEvent("moveend",t);break;case"pending":this._state="enabled",this._unbind()}},zr.prototype._unbind=function(){t.default$1.document.removeEventListener("mousemove",this._onMouseMove,{capture:!0}),t.default$1.document.removeEventListener("mouseup",this._onMouseUp),t.default$1.removeEventListener("blur",this._onBlur),r.enableDrag()},zr.prototype._deactivate=function(){this._frameId&&(this._map._cancelRenderFrame(this._frameId),this._frameId=null),delete this._lastMoveEvent,delete this._startPos,delete this._lastPos},zr.prototype._inertialRotate=function(t){var e=this;this._fireEvent("rotateend",t),this._drainInertiaBuffer();var r=this._map,n=r.getBearing(),i=this._inertia,o=function(){Math.abs(n)180&&(f=180);var d=f/180;u+=h*f*(d/2),Math.abs(r._normalizeBearing(u,0))0&&r-e[0][0]>160;)e.shift()};var Cr=t.bezier(0,0,.3,1),Mr=function(e){this._map=e,this._el=e.getCanvasContainer(),this._state="disabled",t.bindAll(["_onMove","_onMouseUp","_onTouchEnd","_onBlur","_onDragFrame"],this)};Mr.prototype.isEnabled=function(){return"disabled"!==this._state},Mr.prototype.isActive=function(){return"active"===this._state},Mr.prototype.enable=function(){this.isEnabled()||(this._el.classList.add("mapboxgl-touch-drag-pan"),this._state="enabled")},Mr.prototype.disable=function(){if(this.isEnabled())switch(this._el.classList.remove("mapboxgl-touch-drag-pan"),this._state){case"active":this._state="disabled",this._unbind(),this._deactivate(),this._fireEvent("dragend"),this._fireEvent("moveend");break;case"pending":this._state="disabled",this._unbind();break;default:this._state="disabled"}},Mr.prototype.onMouseDown=function(e){"enabled"===this._state&&(e.ctrlKey||0!==r.mouseButton(e)||(r.addEventListener(t.default$1.document,"mousemove",this._onMove,{capture:!0}),r.addEventListener(t.default$1.document,"mouseup",this._onMouseUp),this._start(e)))},Mr.prototype.onTouchStart=function(e){"enabled"===this._state&&(e.touches.length>1||(r.addEventListener(t.default$1.document,"touchmove",this._onMove,{capture:!0,passive:!1}),r.addEventListener(t.default$1.document,"touchend",this._onTouchEnd),this._start(e)))},Mr.prototype._start=function(e){t.default$1.addEventListener("blur",this._onBlur),this._state="pending",this._startPos=this._lastPos=r.mousePos(this._el,e),this._inertia=[[t.default$2.now(),this._startPos]]},Mr.prototype._onMove=function(e){e.preventDefault();var n=r.mousePos(this._el,e);this._lastPos.equals(n)||(this._lastMoveEvent=e,this._lastPos=n,this._drainInertiaBuffer(),this._inertia.push([t.default$2.now(),this._lastPos]),"pending"===this._state&&(this._state="active",this._fireEvent("dragstart",e),this._fireEvent("movestart",e)),this._frameId||(this._frameId=this._map._requestRenderFrame(this._onDragFrame)))},Mr.prototype._onDragFrame=function(){this._frameId=null;var t=this._lastMoveEvent;if(t){var e=this._map.transform;e.setLocationAtPoint(e.pointLocation(this._startPos),this._lastPos),this._fireEvent("drag",t),this._fireEvent("move",t),this._startPos=this._lastPos,delete this._lastMoveEvent}},Mr.prototype._onMouseUp=function(t){if(0===r.mouseButton(t))switch(this._state){case"active":this._state="enabled",r.suppressClick(),this._unbind(),this._deactivate(),this._inertialPan(t);break;case"pending":this._state="enabled",this._unbind()}},Mr.prototype._onTouchEnd=function(t){switch(this._state){case"active":this._state="enabled",this._unbind(),this._deactivate(),this._inertialPan(t);break;case"pending":this._state="enabled",this._unbind()}},Mr.prototype._onBlur=function(t){switch(this._state){case"active":this._state="enabled",this._unbind(),this._deactivate(),this._fireEvent("dragend",t),this._fireEvent("moveend",t);break;case"pending":this._state="enabled",this._unbind()}},Mr.prototype._unbind=function(){r.removeEventListener(t.default$1.document,"touchmove",this._onMove,{capture:!0,passive:!1}),r.removeEventListener(t.default$1.document,"touchend",this._onTouchEnd),r.removeEventListener(t.default$1.document,"mousemove",this._onMove,{capture:!0}),r.removeEventListener(t.default$1.document,"mouseup",this._onMouseUp),r.removeEventListener(t.default$1,"blur",this._onBlur)},Mr.prototype._deactivate=function(){this._frameId&&(this._map._cancelRenderFrame(this._frameId),this._frameId=null),delete this._lastMoveEvent,delete this._startPos,delete this._lastPos},Mr.prototype._inertialPan=function(t){this._fireEvent("dragend",t),this._drainInertiaBuffer();var e=this._inertia;if(e.length<2)this._fireEvent("moveend",t);else{var r=e[e.length-1],n=e[0],i=r[1].sub(n[1]),o=(r[0]-n[0])/1e3;if(0===o||r[1].equals(n[1]))this._fireEvent("moveend",t);else{var a=i.mult(.3/o),s=a.mag();s>1400&&(s=1400,a._unit()._mult(s));var l=s/750,u=a.mult(-l/2);this._map.panBy(u,{duration:1e3*l,easing:Cr,noMoveStart:!0},{originalEvent:t})}}},Mr.prototype._fireEvent=function(e,r){return this._map.fire(new t.Event(e,r?{originalEvent:r}:{}))},Mr.prototype._drainInertiaBuffer=function(){for(var e=this._inertia,r=t.default$2.now();e.length>0&&r-e[0][0]>160;)e.shift()};var Pr=function(e){this._map=e,this._el=e.getCanvasContainer(),t.bindAll(["_onKeyDown"],this)};function Lr(t){return t*(2-t)}Pr.prototype.isEnabled=function(){return!!this._enabled},Pr.prototype.enable=function(){this.isEnabled()||(this._el.addEventListener("keydown",this._onKeyDown,!1),this._enabled=!0)},Pr.prototype.disable=function(){this.isEnabled()&&(this._el.removeEventListener("keydown",this._onKeyDown),this._enabled=!1)},Pr.prototype._onKeyDown=function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e=0,r=0,n=0,i=0,o=0;switch(t.keyCode){case 61:case 107:case 171:case 187:e=1;break;case 189:case 109:case 173:e=-1;break;case 37:t.shiftKey?r=-1:(t.preventDefault(),i=-1);break;case 39:t.shiftKey?r=1:(t.preventDefault(),i=1);break;case 38:t.shiftKey?n=1:(t.preventDefault(),o=-1);break;case 40:t.shiftKey?n=-1:(o=1,t.preventDefault());break;default:return}var a=this._map,s=a.getZoom(),l={duration:300,delayEndEvents:500,easing:Lr,zoom:e?Math.round(s)+e*(t.shiftKey?2:1):s,bearing:a.getBearing()+15*r,pitch:a.getPitch()+10*n,offset:[100*-i,100*-o],center:a.getCenter()};a.easeTo(l,{originalEvent:t})}};var Dr=function(e){this._map=e,t.bindAll(["_onDblClick","_onZoomEnd"],this)};Dr.prototype.isEnabled=function(){return!!this._enabled},Dr.prototype.isActive=function(){return!!this._active},Dr.prototype.enable=function(){this.isEnabled()||(this._enabled=!0)},Dr.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},Dr.prototype.onTouchStart=function(t){var e=this;this.isEnabled()&&(t.points.length>1||(this._tapped?(clearTimeout(this._tapped),this._tapped=null,this._zoom(t)):this._tapped=setTimeout(function(){e._tapped=null},300)))},Dr.prototype.onDblClick=function(t){this.isEnabled()&&(t.originalEvent.preventDefault(),this._zoom(t))},Dr.prototype._zoom=function(t){this._active=!0,this._map.on("zoomend",this._onZoomEnd),this._map.zoomTo(this._map.getZoom()+(t.originalEvent.shiftKey?-1:1),{around:t.lngLat},t)},Dr.prototype._onZoomEnd=function(){this._active=!1,this._map.off("zoomend",this._onZoomEnd)};var Rr=t.bezier(0,0,.15,1),Br=function(e){this._map=e,this._el=e.getCanvasContainer(),t.bindAll(["_onMove","_onEnd","_onTouchFrame"],this)};Br.prototype.isEnabled=function(){return!!this._enabled},Br.prototype.enable=function(t){this.isEnabled()||(this._el.classList.add("mapboxgl-touch-zoom-rotate"),this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around)},Br.prototype.disable=function(){this.isEnabled()&&(this._el.classList.remove("mapboxgl-touch-zoom-rotate"),this._enabled=!1)},Br.prototype.disableRotation=function(){this._rotationDisabled=!0},Br.prototype.enableRotation=function(){this._rotationDisabled=!1},Br.prototype.onStart=function(e){if(this.isEnabled()&&2===e.touches.length){var n=r.mousePos(this._el,e.touches[0]),i=r.mousePos(this._el,e.touches[1]);this._startVec=n.sub(i),this._gestureIntent=void 0,this._inertia=[],r.addEventListener(t.default$1.document,"touchmove",this._onMove,{passive:!1}),r.addEventListener(t.default$1.document,"touchend",this._onEnd)}},Br.prototype._getTouchEventData=function(t){var e=r.mousePos(this._el,t.touches[0]),n=r.mousePos(this._el,t.touches[1]),i=e.sub(n);return{vec:i,center:e.add(n).div(2),scale:i.mag()/this._startVec.mag(),bearing:this._rotationDisabled?0:180*i.angleWith(this._startVec)/Math.PI}},Br.prototype._onMove=function(e){if(2===e.touches.length){var r=this._getTouchEventData(e),n=r.vec,i=r.scale,o=r.bearing;if(!this._gestureIntent){var a=Math.abs(1-i)>.15;Math.abs(o)>10?this._gestureIntent="rotate":a&&(this._gestureIntent="zoom"),this._gestureIntent&&(this._map.fire(new t.Event(this._gestureIntent+"start",{originalEvent:e})),this._map.fire(new t.Event("movestart",{originalEvent:e})),this._startVec=n)}this._lastTouchEvent=e,this._frameId||(this._frameId=this._map._requestRenderFrame(this._onTouchFrame)),e.preventDefault()}},Br.prototype._onTouchFrame=function(){this._frameId=null;var e=this._gestureIntent;if(e){var r=this._map.transform;this._startScale||(this._startScale=r.scale,this._startBearing=r.bearing);var n=this._getTouchEventData(this._lastTouchEvent),i=n.center,o=n.bearing,a=n.scale,s=r.pointLocation(i),l=r.locationPoint(s);"rotate"===e&&(r.bearing=this._startBearing+o),r.zoom=r.scaleZoom(this._startScale*a),r.setLocationAtPoint(s,l),this._map.fire(new t.Event(e,{originalEvent:this._lastTouchEvent})),this._map.fire(new t.Event("move",{originalEvent:this._lastTouchEvent})),this._drainInertiaBuffer(),this._inertia.push([t.default$2.now(),a,i])}},Br.prototype._onEnd=function(e){r.removeEventListener(t.default$1.document,"touchmove",this._onMove,{passive:!1}),r.removeEventListener(t.default$1.document,"touchend",this._onEnd);var n=this._gestureIntent,i=this._startScale;if(this._frameId&&(this._map._cancelRenderFrame(this._frameId),this._frameId=null),delete this._gestureIntent,delete this._startScale,delete this._startBearing,delete this._lastTouchEvent,n){this._map.fire(new t.Event(n+"end",{originalEvent:e})),this._drainInertiaBuffer();var o=this._inertia,a=this._map;if(o.length<2)a.snapToNorth({},{originalEvent:e});else{var s=o[o.length-1],l=o[0],u=a.transform.scaleZoom(i*s[1]),c=a.transform.scaleZoom(i*l[1]),h=u-c,p=(s[0]-l[0])/1e3,f=s[2];if(0!==p&&u!==c){var d=.15*h/p;Math.abs(d)>2.5&&(d=d>0?2.5:-2.5);var m=1e3*Math.abs(d/(12*.15)),y=u+d*m/2e3;y<0&&(y=0),a.easeTo({zoom:y,duration:m,easing:Rr,around:this._aroundCenter?a.getCenter():a.unproject(f),noMoveStart:!0},{originalEvent:e})}else a.snapToNorth({},{originalEvent:e})}}},Br.prototype._drainInertiaBuffer=function(){for(var e=this._inertia,r=t.default$2.now();e.length>2&&r-e[0][0]>160;)e.shift()};var Or={scrollZoom:kr,boxZoom:Ar,dragRotate:zr,dragPan:Mr,keyboard:Pr,doubleClickZoom:Dr,touchZoomRotate:Br},Fr=function(e){function r(r,n){e.call(this),this._moving=!1,this._zooming=!1,this.transform=r,this._bearingSnap=n.bearingSnap,t.bindAll(["_renderFrameCallback"],this)}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.getCenter=function(){return this.transform.center},r.prototype.setCenter=function(t,e){return this.jumpTo({center:t},e)},r.prototype.panBy=function(e,r,n){return e=t.default.convert(e).mult(-1),this.panTo(this.transform.center,t.extend({offset:e},r),n)},r.prototype.panTo=function(e,r,n){return this.easeTo(t.extend({center:e},r),n)},r.prototype.getZoom=function(){return this.transform.zoom},r.prototype.setZoom=function(t,e){return this.jumpTo({zoom:t},e),this},r.prototype.zoomTo=function(e,r,n){return this.easeTo(t.extend({zoom:e},r),n)},r.prototype.zoomIn=function(t,e){return this.zoomTo(this.getZoom()+1,t,e),this},r.prototype.zoomOut=function(t,e){return this.zoomTo(this.getZoom()-1,t,e),this},r.prototype.getBearing=function(){return this.transform.bearing},r.prototype.setBearing=function(t,e){return this.jumpTo({bearing:t},e),this},r.prototype.rotateTo=function(e,r,n){return this.easeTo(t.extend({bearing:e},r),n)},r.prototype.resetNorth=function(e,r){return this.rotateTo(0,t.extend({duration:1e3},e),r),this},r.prototype.snapToNorth=function(t,e){return Math.abs(this.getBearing())e?1:0}),["bottom","left","right","top"])){e=B.convert(e);var i=[(r.padding.left-r.padding.right)/2,(r.padding.top-r.padding.bottom)/2],o=Math.min(r.padding.right,r.padding.left),a=Math.min(r.padding.top,r.padding.bottom);r.offset=[r.offset[0]+i[0],r.offset[1]+i[1]];var s=t.default.convert(r.offset),l=this.transform,u=l.project(e.getNorthWest()),c=l.project(e.getSouthEast()),h=c.sub(u),p=(l.width-2*o-2*Math.abs(s.x))/h.x,f=(l.height-2*a-2*Math.abs(s.y))/h.y;if(!(f<0||p<0))return r.center=l.unproject(u.add(c).div(2)),r.zoom=Math.min(l.scaleZoom(l.scale*Math.min(p,f)),r.maxZoom),r.bearing=0,r;t.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}else t.warnOnce("options.padding must be a positive number, or an Object with keys 'bottom', 'left', 'right', 'top'")},r.prototype.fitBounds=function(e,r,n){var i=this.cameraForBounds(e,r);return i?(r=t.extend(i,r)).linear?this.easeTo(r,n):this.flyTo(r,n):this},r.prototype.jumpTo=function(e,r){this.stop();var n=this.transform,i=!1,o=!1,a=!1;return"zoom"in e&&n.zoom!==+e.zoom&&(i=!0,n.zoom=+e.zoom),void 0!==e.center&&(n.center=R.convert(e.center)),"bearing"in e&&n.bearing!==+e.bearing&&(o=!0,n.bearing=+e.bearing),"pitch"in e&&n.pitch!==+e.pitch&&(a=!0,n.pitch=+e.pitch),this.fire(new t.Event("movestart",r)).fire(new t.Event("move",r)),i&&this.fire(new t.Event("zoomstart",r)).fire(new t.Event("zoom",r)).fire(new t.Event("zoomend",r)),o&&this.fire(new t.Event("rotatestart",r)).fire(new t.Event("rotate",r)).fire(new t.Event("rotateend",r)),a&&this.fire(new t.Event("pitchstart",r)).fire(new t.Event("pitch",r)).fire(new t.Event("pitchend",r)),this.fire(new t.Event("moveend",r))},r.prototype.easeTo=function(e,r){var n=this;this.stop(),!1===(e=t.extend({offset:[0,0],duration:500,easing:t.ease},e)).animate&&(e.duration=0);var i=this.transform,o=this.getZoom(),a=this.getBearing(),s=this.getPitch(),l="zoom"in e?+e.zoom:o,u="bearing"in e?this._normalizeBearing(e.bearing,a):a,c="pitch"in e?+e.pitch:s,h=i.centerPoint.add(t.default.convert(e.offset)),p=i.pointLocation(h),f=R.convert(e.center||p);this._normalizeCenter(f);var d,m,y=i.project(p),g=i.project(f).sub(y),v=i.zoomScale(l-o);return e.around&&(d=R.convert(e.around),m=i.locationPoint(d)),this._zooming=l!==o,this._rotating=a!==u,this._pitching=c!==s,this._prepareEase(r,e.noMoveStart),clearTimeout(this._easeEndTimeoutID),this._ease(function(e){if(n._zooming&&(i.zoom=t.number(o,l,e)),n._rotating&&(i.bearing=t.number(a,u,e)),n._pitching&&(i.pitch=t.number(s,c,e)),d)i.setLocationAtPoint(d,m);else{var p=i.zoomScale(i.zoom-o),f=l>o?Math.min(2,v):Math.max(.5,v),_=Math.pow(f,1-e),x=i.unproject(y.add(g.mult(e*_)).mult(p));i.setLocationAtPoint(i.renderWorldCopies?x.wrap():x,h)}n._fireMoveEvents(r)},function(){e.delayEndEvents?n._easeEndTimeoutID=setTimeout(function(){return n._afterEase(r)},e.delayEndEvents):n._afterEase(r)},e),this},r.prototype._prepareEase=function(e,r){this._moving=!0,r||this.fire(new t.Event("movestart",e)),this._zooming&&this.fire(new t.Event("zoomstart",e)),this._rotating&&this.fire(new t.Event("rotatestart",e)),this._pitching&&this.fire(new t.Event("pitchstart",e))},r.prototype._fireMoveEvents=function(e){this.fire(new t.Event("move",e)),this._zooming&&this.fire(new t.Event("zoom",e)),this._rotating&&this.fire(new t.Event("rotate",e)),this._pitching&&this.fire(new t.Event("pitch",e))},r.prototype._afterEase=function(e){var r=this._zooming,n=this._rotating,i=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,r&&this.fire(new t.Event("zoomend",e)),n&&this.fire(new t.Event("rotateend",e)),i&&this.fire(new t.Event("pitchend",e)),this.fire(new t.Event("moveend",e))},r.prototype.flyTo=function(e,r){var n=this;this.stop(),e=t.extend({offset:[0,0],speed:1.2,curve:1.42,easing:t.ease},e);var i=this.transform,o=this.getZoom(),a=this.getBearing(),s=this.getPitch(),l="zoom"in e?t.clamp(+e.zoom,i.minZoom,i.maxZoom):o,u="bearing"in e?this._normalizeBearing(e.bearing,a):a,c="pitch"in e?+e.pitch:s,h=i.zoomScale(l-o),p=i.centerPoint.add(t.default.convert(e.offset)),f=i.pointLocation(p),d=R.convert(e.center||f);this._normalizeCenter(d);var m=i.project(f),y=i.project(d).sub(m),g=e.curve,v=Math.max(i.width,i.height),_=v/h,x=y.mag();if("minZoom"in e){var b=t.clamp(Math.min(e.minZoom,o,l),i.minZoom,i.maxZoom),w=v/i.zoomScale(b-o);g=Math.sqrt(w/x*2)}var E=g*g;function S(t){var e=(_*_-v*v+(t?-1:1)*E*E*x*x)/(2*(t?_:v)*E*x);return Math.log(Math.sqrt(e*e+1)-e)}function T(t){return(Math.exp(t)-Math.exp(-t))/2}function k(t){return(Math.exp(t)+Math.exp(-t))/2}var A=S(0),I=function(t){return k(A)/k(A+g*t)},z=function(t){return v*((k(A)*(T(e=A+g*t)/k(e))-T(A))/E)/x;var e},C=(S(1)-A)/g;if(Math.abs(x)<1e-6||!isFinite(C)){if(Math.abs(v-_)<1e-6)return this.easeTo(e,r);var M=_e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=a!==u,this._pitching=c!==s,this._prepareEase(r,!1),this._ease(function(e){var l=e*C,h=1/I(l);i.zoom=o+i.scaleZoom(h),n._rotating&&(i.bearing=t.number(a,u,e)),n._pitching&&(i.pitch=t.number(s,c,e));var f=i.unproject(m.add(y.mult(z(l))).mult(h));i.setLocationAtPoint(i.renderWorldCopies?f.wrap():f,p),n._fireMoveEvents(r)},function(){return n._afterEase(r)},e),this},r.prototype.isEasing=function(){return!!this._easeFrameId},r.prototype.stop=function(){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){var t=this._onEaseEnd;delete this._onEaseEnd,t.call(this)}return this},r.prototype._ease=function(e,r,n){!1===n.animate||0===n.duration?(e(1),r()):(this._easeStart=t.default$2.now(),this._easeOptions=n,this._onEaseFrame=e,this._onEaseEnd=r,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))},r.prototype._renderFrameCallback=function(){var e=Math.min((t.default$2.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},r.prototype._normalizeBearing=function(e,r){e=t.wrap(e,-180,180);var n=Math.abs(e-r);return Math.abs(e-360-r)180?-360:r<-180?360:0}},r}(t.Evented),Vr=function(e){void 0===e&&(e={}),this.options=e,t.bindAll(["_updateEditLink","_updateData","_updateCompact"],this)};Vr.prototype.getDefaultPosition=function(){return"bottom-right"},Vr.prototype.onAdd=function(t){var e=this.options&&this.options.compact;return this._map=t,this._container=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),e&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===e&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container},Vr.prototype.onRemove=function(){r.remove(this._container),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0},Vr.prototype._updateEditLink=function(){var t=this._editLink;t||(t=this._editLink=this._container.querySelector(".mapbox-improve-map"));var e=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:h.ACCESS_TOKEN}];if(t){var r=e.reduce(function(t,r,n){return r.value&&(t+=r.key+"="+r.value+(n=0)return!1;return!0})).length?(this._container.innerHTML=t.join(" | "),this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null}},Vr.prototype._updateCompact=function(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact")};var Nr=function(){t.bindAll(["_updateLogo"],this),t.bindAll(["_updateCompact"],this)};Nr.prototype.onAdd=function(t){this._map=t,this._container=r.create("div","mapboxgl-ctrl");var e=r.create("a","mapboxgl-ctrl-logo");return e.target="_blank",e.href="https://www.mapbox.com/",e.setAttribute("aria-label","Mapbox logo"),e.setAttribute("rel","noopener"),this._container.appendChild(e),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container},Nr.prototype.onRemove=function(){r.remove(this._container),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)},Nr.prototype.getDefaultPosition=function(){return"bottom-left"},Nr.prototype._updateLogo=function(t){t&&"metadata"!==t.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")},Nr.prototype._logoRequired=function(){if(this._map.style){var t=this._map.style.sourceCaches;for(var e in t)if(t[e].getSource().mapbox_logo)return!0;return!1}},Nr.prototype._updateCompact=function(){var t=this._container.children;if(t.length){var e=t[0];this._map.getCanvasContainer().offsetWidth<250?e.classList.add("mapboxgl-compact"):e.classList.remove("mapboxgl-compact")}};var jr=function(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1};jr.prototype.add=function(t){var e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e},jr.prototype.remove=function(t){for(var e=this._currentlyRunning,r=0,n=e?this._queue.concat(e):this._queue;re.maxZoom)throw new Error("maxZoom must be greater than minZoom");var i=new xr(e.minZoom,e.maxZoom,e.renderWorldCopies);n.call(this,i,e),this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._renderTaskQueue=new jr;var o=e.transformRequest;if(this._transformRequest=o?function(t,e){return o(t,e)||{url:t}}:function(t){return{url:t}},"string"==typeof e.container){var a=t.default$1.document.getElementById(e.container);if(!a)throw new Error("Container '"+e.container+"' not found.");this._container=a}else{if(!(e.container instanceof $r))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),t.bindAll(["_onWindowOnline","_onWindowResize","_contextLost","_contextRestored","_update","_render","_onData","_onDataLoading"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");this.on("move",this._update.bind(this,!1)),this.on("zoom",this._update.bind(this,!0)),void 0!==t.default$1&&(t.default$1.addEventListener("online",this._onWindowOnline,!1),t.default$1.addEventListener("resize",this._onWindowResize,!1)),function(t,e){var n=t.getCanvasContainer(),i=null,o=!1,a=null;for(var s in Or)t[s]=new Or[s](t,e),e.interactive&&e[s]&&t[s].enable(e[s]);r.addEventListener(n,"mouseout",function(e){t.fire(new Er("mouseout",t,e))}),r.addEventListener(n,"mousedown",function(i){o=!0,a=r.mousePos(n,i);var s=new Er("mousedown",t,i);t.fire(s),s.defaultPrevented||(e.interactive&&!t.doubleClickZoom.isActive()&&t.stop(),t.boxZoom.onMouseDown(i),t.boxZoom.isActive()||t.dragPan.isActive()||t.dragRotate.onMouseDown(i),t.boxZoom.isActive()||t.dragRotate.isActive()||t.dragPan.onMouseDown(i))}),r.addEventListener(n,"mouseup",function(e){var r=t.dragRotate.isActive();i&&!r&&t.fire(new Er("contextmenu",t,i)),i=null,o=!1,t.fire(new Er("mouseup",t,e))}),r.addEventListener(n,"mousemove",function(e){if(!t.dragPan.isActive()&&!t.dragRotate.isActive()){for(var r=e.target;r&&r!==n;)r=r.parentNode;r===n&&t.fire(new Er("mousemove",t,e))}}),r.addEventListener(n,"mouseover",function(e){for(var r=e.target;r&&r!==n;)r=r.parentNode;r===n&&t.fire(new Er("mouseover",t,e))}),r.addEventListener(n,"touchstart",function(r){var n=new Sr("touchstart",t,r);t.fire(n),n.defaultPrevented||(e.interactive&&t.stop(),t.boxZoom.isActive()||t.dragRotate.isActive()||t.dragPan.onTouchStart(r),t.touchZoomRotate.onStart(r),t.doubleClickZoom.onTouchStart(n))},{passive:!1}),r.addEventListener(n,"touchmove",function(e){t.fire(new Sr("touchmove",t,e))},{passive:!1}),r.addEventListener(n,"touchend",function(e){t.fire(new Sr("touchend",t,e))}),r.addEventListener(n,"touchcancel",function(e){t.fire(new Sr("touchcancel",t,e))}),r.addEventListener(n,"click",function(e){r.mousePos(n,e).equals(a)&&t.fire(new Er("click",t,e))}),r.addEventListener(n,"dblclick",function(e){var r=new Er("dblclick",t,e);t.fire(r),r.defaultPrevented||t.doubleClickZoom.onDblClick(r)}),r.addEventListener(n,"contextmenu",function(e){var r=t.dragRotate.isActive();o||r?o&&(i=e):t.fire(new Er("contextmenu",t,e)),e.preventDefault()}),r.addEventListener(n,"wheel",function(e){var r=new Tr("wheel",t,e);t.fire(r),r.defaultPrevented||t.scrollZoom.onWheel(e)},{passive:!1})}(this,e),this._hash=e.hash&&(new wr).addTo(this),this._hash&&this._hash._onHashChange()||this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),this.resize(),e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new Vr),this.addControl(new Nr,e.logoPosition),this.on("style.load",function(){this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",this._onData),this.on("dataloading",this._onDataLoading)}n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i;var o={showTileBoundaries:{configurable:!0},showCollisionBoxes:{configurable:!0},showOverdrawInspector:{configurable:!0},repaint:{configurable:!0},vertices:{configurable:!0}};return i.prototype.addControl=function(t,e){void 0===e&&t.getDefaultPosition&&(e=t.getDefaultPosition()),void 0===e&&(e="top-right");var r=t.onAdd(this),n=this._controlPositions[e];return-1!==e.indexOf("bottom")?n.insertBefore(r,n.firstChild):n.appendChild(r),this},i.prototype.removeControl=function(t){return t.onRemove(this),this},i.prototype.resize=function(e){var r=this._containerDimensions(),n=r[0],i=r[1];return this._resizeCanvas(n,i),this.transform.resize(n,i),this.painter.resize(n,i),this.fire(new t.Event("movestart",e)).fire(new t.Event("move",e)).fire(new t.Event("resize",e)).fire(new t.Event("moveend",e))},i.prototype.getBounds=function(){var e=new B(this.transform.pointLocation(new t.default(0,this.transform.height)),this.transform.pointLocation(new t.default(this.transform.width,0)));return(this.transform.angle||this.transform.pitch)&&(e.extend(this.transform.pointLocation(new t.default(this.transform.size.x,0))),e.extend(this.transform.pointLocation(new t.default(0,this.transform.size.y)))),e},i.prototype.getMaxBounds=function(){return this.transform.latRange&&2===this.transform.latRange.length&&this.transform.lngRange&&2===this.transform.lngRange.length?new B([this.transform.lngRange[0],this.transform.latRange[0]],[this.transform.lngRange[1],this.transform.latRange[1]]):null},i.prototype.setMaxBounds=function(t){if(t){var e=B.convert(t);this.transform.lngRange=[e.getWest(),e.getEast()],this.transform.latRange=[e.getSouth(),e.getNorth()],this.transform._constrain(),this._update()}else null==t&&(this.transform.lngRange=null,this.transform.latRange=null,this._update());return this},i.prototype.setMinZoom=function(t){if((t=null==t?0:t)>=0&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")},i.prototype.getRenderWorldCopies=function(){return this.transform.renderWorldCopies},i.prototype.setRenderWorldCopies=function(t){return this.transform.renderWorldCopies=t,this._update(),this},i.prototype.getMaxZoom=function(){return this.transform.maxZoom},i.prototype.project=function(t){return this.transform.locationPoint(R.convert(t))},i.prototype.unproject=function(e){return this.transform.pointLocation(t.default.convert(e))},i.prototype.isMoving=function(){return this._moving||this.dragPan.isActive()||this.dragRotate.isActive()||this.scrollZoom.isActive()},i.prototype.isZooming=function(){return this._zooming||this.scrollZoom.isActive()},i.prototype.isRotating=function(){return this._rotating||this.dragRotate.isActive()},i.prototype.on=function(t,e,r){var i,o=this;if(void 0===r)return n.prototype.on.call(this,t,e);var a=function(){if("mouseenter"===t||"mouseover"===t){var n=!1;return{layer:e,listener:r,delegates:{mousemove:function(i){var a=o.getLayer(e)?o.queryRenderedFeatures(i.point,{layers:[e]}):[];a.length?n||(n=!0,r.call(o,new Er(t,o,i.originalEvent,{features:a}))):n=!1},mouseout:function(){n=!1}}}}if("mouseleave"===t||"mouseout"===t){var a=!1;return{layer:e,listener:r,delegates:{mousemove:function(n){(o.getLayer(e)?o.queryRenderedFeatures(n.point,{layers:[e]}):[]).length?a=!0:a&&(a=!1,r.call(o,new Er(t,o,n.originalEvent)))},mouseout:function(e){a&&(a=!1,r.call(o,new Er(t,o,e.originalEvent)))}}}}return{layer:e,listener:r,delegates:(i={},i[t]=function(t){var n=o.getLayer(e)?o.queryRenderedFeatures(t.point,{layers:[e]}):[];n.length&&(t.features=n,r.call(o,t),delete t.features)},i)}}();for(var s in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(a),a.delegates)o.on(s,a.delegates[s]);return this},i.prototype.off=function(t,e,r){if(void 0===r)return n.prototype.off.call(this,t,e);if(this._delegatedListeners&&this._delegatedListeners[t])for(var i=this._delegatedListeners[t],o=0;o180;){var a=r.locationPoint(t);if(a.x>=0&&a.y>=0&&a.x<=r.width&&a.y<=r.height)break;t.lng>r.center.lng?t.lng-=360:t.lng+=360}return t}Xr.prototype._rotateCompassArrow=function(){var t="rotate("+this._map.transform.angle*(180/Math.PI)+"deg)";this._compassArrow.style.transform=t},Xr.prototype.onAdd=function(t){return this._map=t,this.options.showCompass&&(this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new zr(t,{button:"left",element:this._compass}),r.addEventListener(this._compass,"mousedown",this._handler.onMouseDown),this._handler.enable()),this._container},Xr.prototype.onRemove=function(){r.remove(this._container),this.options.showCompass&&(this._map.off("rotate",this._rotateCompassArrow),r.removeEventListener(this._compass,"mousedown",this._handler.onMouseDown),this._handler.disable(),delete this._handler),delete this._map},Xr.prototype._createButton=function(t,e,n){var i=r.create("button",t,this._container);return i.type="button",i.setAttribute("aria-label",e),i.addEventListener("click",n),i};var Kr={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function Jr(t,e,r){var n=t.classList;for(var i in Kr)n.remove("mapboxgl-"+r+"-anchor-"+i);n.add("mapboxgl-"+r+"-anchor-"+e)}var Yr,Qr=function(e){function n(n){if(e.call(this),(arguments[0]instanceof t.default$1.HTMLElement||2===arguments.length)&&(n=t.extend({element:n},arguments[1])),t.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick"],this),this._anchor=n&&n.anchor||"center",this._color=n&&n.color||"#3FB1CE",this._draggable=n&&n.draggable||!1,this._state="inactive",n&&n.element)this._element=n.element,this._offset=t.default.convert(n&&n.offset||[0,0]);else{this._defaultMarker=!0,this._element=r.create("div");var i=r.createNS("http://www.w3.org/2000/svg","svg");i.setAttributeNS(null,"height","41px"),i.setAttributeNS(null,"width","27px"),i.setAttributeNS(null,"viewBox","0 0 27 41");var o=r.createNS("http://www.w3.org/2000/svg","g");o.setAttributeNS(null,"stroke","none"),o.setAttributeNS(null,"stroke-width","1"),o.setAttributeNS(null,"fill","none"),o.setAttributeNS(null,"fill-rule","evenodd");var a=r.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"fill-rule","nonzero");var s=r.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"transform","translate(3.0, 29.0)"),s.setAttributeNS(null,"fill","#000000");for(var l=0,u=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];l5280?an(e,u,p/5280,"mi"):an(e,u,p,"ft")}else r&&"nautical"===r.unit?an(e,u,h/1852,"nm"):an(e,u,h,"m")}function an(t,e,r,n){var i,o,a,s=(i=r,(o=Math.pow(10,(""+Math.floor(i)).length-1))*(a=(a=i/o)>=10?10:a>=5?5:a>=3?3:a>=2?2:1)),l=s/r;"m"===n&&s>=1e3&&(s/=1e3,n="km"),t.style.width=e*l+"px",t.innerHTML=s+n}nn.prototype.getDefaultPosition=function(){return"bottom-left"},nn.prototype._onMove=function(){on(this._map,this._container,this.options)},nn.prototype.onAdd=function(t){return this._map=t,this._container=r.create("div","mapboxgl-ctrl mapboxgl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container},nn.prototype.onRemove=function(){r.remove(this._container),this._map.off("move",this._onMove),this._map=void 0},nn.prototype.setUnit=function(t){this.options.unit=t,on(this._map,this._container,this.options)};var sn=function(){this._fullscreen=!1,t.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in t.default$1.document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in t.default$1.document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in t.default$1.document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in t.default$1.document&&(this._fullscreenchange="MSFullscreenChange"),this._className="mapboxgl-ctrl"};sn.prototype.onAdd=function(e){return this._map=e,this._mapContainer=this._map.getContainer(),this._container=r.create("div",this._className+" mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._container.style.display="none",t.warnOnce("This device does not support fullscreen mode.")),this._container},sn.prototype.onRemove=function(){r.remove(this._container),this._map=null,t.default$1.document.removeEventListener(this._fullscreenchange,this._changeIcon)},sn.prototype._checkFullscreenSupport=function(){return!!(t.default$1.document.fullscreenEnabled||t.default$1.document.mozFullScreenEnabled||t.default$1.document.msFullscreenEnabled||t.default$1.document.webkitFullscreenEnabled)},sn.prototype._setupUI=function(){var e=this._fullscreenButton=r.create("button",this._className+"-icon "+this._className+"-fullscreen",this._container);e.setAttribute("aria-label","Toggle fullscreen"),e.type="button",this._fullscreenButton.addEventListener("click",this._onClickFullscreen),t.default$1.document.addEventListener(this._fullscreenchange,this._changeIcon)},sn.prototype._isFullscreen=function(){return this._fullscreen},sn.prototype._changeIcon=function(){(t.default$1.document.fullscreenElement||t.default$1.document.mozFullScreenElement||t.default$1.document.webkitFullscreenElement||t.default$1.document.msFullscreenElement)===this._mapContainer!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle(this._className+"-shrink"),this._fullscreenButton.classList.toggle(this._className+"-fullscreen"))},sn.prototype._onClickFullscreen=function(){this._isFullscreen()?t.default$1.document.exitFullscreen?t.default$1.document.exitFullscreen():t.default$1.document.mozCancelFullScreen?t.default$1.document.mozCancelFullScreen():t.default$1.document.msExitFullscreen?t.default$1.document.msExitFullscreen():t.default$1.document.webkitCancelFullScreen&&t.default$1.document.webkitCancelFullScreen():this._mapContainer.requestFullscreen?this._mapContainer.requestFullscreen():this._mapContainer.mozRequestFullScreen?this._mapContainer.mozRequestFullScreen():this._mapContainer.msRequestFullscreen?this._mapContainer.msRequestFullscreen():this._mapContainer.webkitRequestFullscreen&&this._mapContainer.webkitRequestFullscreen()};var ln={closeButton:!0,closeOnClick:!0,className:""},un=function(e){function n(r){e.call(this),this.options=t.extend(Object.create(ln),r),t.bindAll(["_update","_onClickClose"],this)}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.addTo=function(e){return this._map=e,this._map.on("move",this._update),this.options.closeOnClick&&this._map.on("click",this._onClickClose),this._update(),this.fire(new t.Event("open")),this},n.prototype.isOpen=function(){return!!this._map},n.prototype.remove=function(){return this._content&&r.remove(this._content),this._container&&(r.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("click",this._onClickClose),delete this._map),this.fire(new t.Event("close")),this},n.prototype.getLngLat=function(){return this._lngLat},n.prototype.setLngLat=function(t){return this._lngLat=R.convert(t),this._pos=null,this._update(),this},n.prototype.setText=function(e){return this.setDOMContent(t.default$1.document.createTextNode(e))},n.prototype.setHTML=function(e){var r,n=t.default$1.document.createDocumentFragment(),i=t.default$1.document.createElement("body");for(i.innerHTML=e;r=i.firstChild;)n.appendChild(r);return this.setDOMContent(n)},n.prototype.setDOMContent=function(t){return this._createContent(),this._content.appendChild(t),this._update(),this},n.prototype._createContent=function(){this._content&&r.remove(this._content),this._content=r.create("div","mapboxgl-popup-content",this._container),this.options.closeButton&&(this._closeButton=r.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClickClose))},n.prototype._update=function(){var e=this;if(this._map&&this._lngLat&&this._content){this._container||(this._container=r.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=r.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(function(t){return e._container.classList.add(t)})),this._map.transform.renderWorldCopies&&(this._lngLat=Hr(this._lngLat,this._pos,this._map.transform));var n=this._pos=this._map.project(this._lngLat),i=this.options.anchor,o=function e(r){if(r){if("number"==typeof r){var n=Math.round(Math.sqrt(.5*Math.pow(r,2)));return{center:new t.default(0,0),top:new t.default(0,r),"top-left":new t.default(n,n),"top-right":new t.default(-n,n),bottom:new t.default(0,-r),"bottom-left":new t.default(n,-n),"bottom-right":new t.default(-n,-n),left:new t.default(r,0),right:new t.default(-r,0)}}if(r instanceof t.default||Array.isArray(r)){var i=t.default.convert(r);return{center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return{center:t.default.convert(r.center||[0,0]),top:t.default.convert(r.top||[0,0]),"top-left":t.default.convert(r["top-left"]||[0,0]),"top-right":t.default.convert(r["top-right"]||[0,0]),bottom:t.default.convert(r.bottom||[0,0]),"bottom-left":t.default.convert(r["bottom-left"]||[0,0]),"bottom-right":t.default.convert(r["bottom-right"]||[0,0]),left:t.default.convert(r.left||[0,0]),right:t.default.convert(r.right||[0,0])}}return e(new t.default(0,0))}(this.options.offset);if(!i){var a,s=this._container.offsetWidth,l=this._container.offsetHeight;a=n.y+o.bottom.ythis._map.transform.height-l?["bottom"]:[],n.xthis._map.transform.width-s/2&&a.push("right"),i=0===a.length?"bottom":a.join("-")}var u=n.add(o[i]).round();r.setTransform(this._container,Kr[i]+" translate("+u.x+"px,"+u.y+"px)"),Jr(this._container,i,"popup")}},n.prototype._onClickClose=function(){this.remove()},n}(t.Evented),cn={version:"0.46.0",supported:e,workerCount:Math.max(Math.floor(t.default$2.hardwareConcurrency/2),1),setRTLTextPlugin:t.setRTLTextPlugin,Map:Zr,NavigationControl:Xr,GeolocateControl:en,AttributionControl:Vr,ScaleControl:nn,FullscreenControl:sn,Popup:un,Marker:Qr,Style:Ve,LngLat:R,LngLatBounds:B,Point:t.default,Evented:t.Evented,config:h,get accessToken(){return h.ACCESS_TOKEN},set accessToken(t){h.ACCESS_TOKEN=t},workerUrl:""};return cn}),r}),function(t){"use strict";var e=".dropdown-backdrop",r='[data-toggle="tsml-dropdown"]',n=function(e){t(e).on("click.bs.dropdown",this.toggle)};function i(e){var r=e.attr("data-target");r||(r=(r=e.attr("href"))&&/#[A-Za-z]/.test(r)&&r.replace(/.*(?=#[^\s]*$)/,""));var n=r&&t(r);return n&&n.length?n:e.parent()}function o(n){n&&3===n.which||(t(e).remove(),t(r).each(function(){var e=t(this),r=i(e),o={relatedTarget:this};r.hasClass("open")&&(n&&"click"==n.type&&/input|textarea/i.test(n.target.tagName)&&t.contains(r[0],n.target)||(r.trigger(n=t.Event("hide.bs.dropdown",o)),n.isDefaultPrevented()||(e.attr("aria-expanded","false"),r.removeClass("open").trigger(t.Event("hidden.bs.dropdown",o)))))}))}n.VERSION="3.3.7",n.prototype.toggle=function(e){var r=t(this);if(!r.is(".disabled, :disabled")){var n=i(r),a=n.hasClass("open");if(o(),!a){"ontouchstart"in document.documentElement&&!n.closest(".navbar-nav").length&&t(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(t(this)).on("click",o);var s={relatedTarget:this};if(n.trigger(e=t.Event("show.bs.dropdown",s)),e.isDefaultPrevented())return;r.trigger("focus").attr("aria-expanded","true"),n.toggleClass("open").trigger(t.Event("shown.bs.dropdown",s))}return!1}},n.prototype.keydown=function(e){if(/(38|40|27|32)/.test(e.which)&&!/input|textarea/i.test(e.target.tagName)){var n=t(this);if(e.preventDefault(),e.stopPropagation(),!n.is(".disabled, :disabled")){var o=i(n),a=o.hasClass("open");if(!a&&27!=e.which||a&&27==e.which)return 27==e.which&&o.find(r).trigger("focus"),n.trigger("click");var s=o.find(".dropdown-menu li:not(.disabled):visible a");if(s.length){var l=s.index(e.target);38==e.which&&l>0&&l--,40==e.which&&l'),searchIcon=window.btoa('');else if(tsml.google_maps_key){if("object"!=typeof google)return void console.warn("google key present but google script not ready");mapMode="google",tsmlmap||(tsmlmap=new google.maps.Map(document.getElementById("map"),{disableDefaultUI:!0,scrollwheel:t,zoomControl:!0})),infowindow=new google.maps.InfoWindow,bounds=new google.maps.LatLngBounds}setMapMarkers(e,r)}function formatAddress(t,e){if(!t)return"";if(t=t.split(", "),e)return t[0];if("USA"==t[t.length-1]){t.pop();var r=t.pop();t[t.length-1]+=", "+r}return t.join("
    ")}function formatLink(t,e,r){if(!t)return e;if(location.search){for(var n=location.search.substr(1).split("&"),i=[],o=0;o'+e+""}function removeSearchMarker(){searchLocation=null,"object"==typeof searchMarker&&searchMarker&&(searchMarker.setMap(null),searchMarker=null)}function setMapBounds(){if("google"==mapMode){if(markers.length>1)tsmlmap.fitBounds(bounds);else if(1==markers.length){var t=bounds.getCenter();markers[0].getClickable()?(tsmlmap.setCenter({lat:t.lat()+.0025,lng:t.lng()}),google.maps.event.trigger(markers[0],"click")):tsmlmap.setCenter({lat:t.lat(),lng:t.lng()}),tsmlmap.setZoom(15)}}else"mapbox"==mapMode&&(markers.length>1?tsmlmap.fitBounds([[bounds.west,bounds.south],[bounds.east,bounds.north]],{duration:0,padding:100}):1==markers.length&&(markers[0].getPopup()?(tsmlmap.setZoom(14).setCenter([bounds.east,bounds.north+.0025]),markers[0].togglePopup()):tsmlmap.setZoom(14).setCenter([bounds.east,bounds.north])))}function setMapMarker(t,e,r){if(e.lat||e.lng){var n;if("google"==mapMode)n=new google.maps.Marker({position:e,map:tsmlmap,title:t,icon:{path:"M20.5,0.5 c11.046,0,20,8.656,20,19.333c0,10.677-12.059,21.939-20,38.667c-5.619-14.433-20-27.989-20-38.667C0.5,9.156,9.454,0.5,20.5,0.5z",fillColor:"#f76458",fillOpacity:1,anchor:new google.maps.Point(40,50),strokeWeight:2,strokeColor:"#b3382c",scale:.6}}),r?google.maps.event.addListener(n,"click",function(t){return function(){infowindow.setContent('
    '+r+"
    "),infowindow.open(tsmlmap,t)}}(n)):n.setClickable(!1);else if("mapbox"==mapMode){var i=document.createElement("div");if(i.className="marker",i.style.backgroundImage="url(data:image/svg+xml;base64,"+locationIcon+")",i.style.width="26px",i.style.height="38.4px",n=new mapboxgl.Marker(i).setLngLat(e),r){var o=new mapboxgl.Popup({offset:25});o.setHTML(r),n.setPopup(o)}n.addTo(tsmlmap)}return n}}function setMapMarkers(t,e){if(markers.length){for(var r=0;r
    "+formatAddress(o.formatted_address)+"
    ",o.directions&&o.directions_url&&(i+=''+o.directions+""),o.meetings&&o.meetings.length)){for(var a=null,s=0;s"),a=l.day,void 0!==tsml.days[a]&&(i+="
    "+tsml.days[a]+"
    "),i+="
    "),i+="
    "+l.time+"
    "+formatLink(l.url,l.name,"post_type")+"
    "}i+="
    "}var u={lat:parseFloat(o.latitude),lng:parseFloat(o.longitude)},c=setMapMarker(o.name,u,i);"object"==typeof c&&c&&("google"==mapMode?(bounds.extend(c.position),"yes"===o.approximate&&c.setVisible(!1)):"mapbox"==mapMode&&((!bounds.north||u.lat>bounds.north)&&(bounds.north=u.lat),(!bounds.south||u.latbounds.east)&&(bounds.east=u.lng),(!bounds.west||u.lng-1&&(a=a+(a.indexOf("?")>-1?"&":"?")+"post_type=tsml_meeting"),window.history.pushState({path:a},"",a)}t("#meetings").attr("data-mode",i.mode),"search"==i.mode?(g(),removeSearchMarker(),c(i)):"location"==i.mode?(!function(){if(!r)return;r=!1,t('#meetings #search input[name="query"]').autocomplete("destroy")}(),i.query?(t("#search button i").removeClass().addClass("glyphicon glyphicon-refresh spinning"),t.getJSON(tsml.ajaxurl,{action:"tsml_geocode",address:i.query,nonce:tsml.nonce},function(e){tsml.debug&&console.log("doSearch() location geocoded",e),t("#search button i").removeClass().addClass("glyphicon glyphicon-map-marker"),"error"==e.status?(removeSearchMarker(),f("loc_error")):(n.val(e.formatted_address),i.latitude=e.latitude,i.longitude=e.longitude,i.query="",searchLocation={latitude:i.latitude,longitude:i.longitude},c(i))})):f("loc_empty")):"me"==i.mode&&(i.query&&(t("#meetings #search input[name=query]").val(""),i.query=""),t("#search button i").removeClass().addClass("glyphicon glyphicon-refresh spinning"),navigator.geolocation?navigator.geolocation.getCurrentPosition(function(e){t("#search button i").removeClass().addClass("glyphicon glyphicon-user"),i.latitude=e.coords.latitude,i.longitude=e.coords.longitude,searchLocation={latitude:i.latitude,longitude:i.longitude},c(i)},function(){tsml.debug&&console.log("doSearch() didnt get location"),t("#search button i").removeClass().addClass("glyphicon glyphicon-user"),removeSearchMarker(),f("geo_error")},{enableHighAccuracy:!0,timeout:1e4,maximumAge:6e5}):(tsml.debug&&console.log("doSearch() no browser support for geo"),t("#search button i").removeClass().addClass("glyphicon glyphicon-user"),removeSearchMarker(),f("geo_error_browser")))}function c(e){for(var r in e.distance_units=tsml.distance_units,e.nonce=tsml.nonce,e)null!==e[r]&&void 0!==e[r]&&e[r].toString().length||delete e[r];tsml.debug&&console.log("getMeetings()",tsml.ajaxurl+"?"+t.param(e)),t.post(tsml.ajaxurl,e,function(r){if(tsml.debug&&console.log("getMeetings() received",r),"object"!=typeof r||null==r)t("#meetings").addClass("empty"),f("data_error");else if(r.length){t("#meetings").removeClass("empty"),f(),locations=[];var n=t("#meetings_tbody").html("");t.each(r,function(t,r){if(r.types||(r.types=[]),"object"==typeof tsml.flags)for(var i=-1!==r.types.indexOf("TC")&&-1!==r.types.indexOf("ONL"),o=0;o"+tsml.types[tsml.flags[o]]+"")}var s=[];for(o=0;o';for(o=0;o'+(void 0!==e.day||void 0===r.day?r.time_formatted:tsml.days[r.day]+""+r.time_formatted)+"";break;case"distance":u+=''+r.distance+" "+tsml.distance_units+"";break;case"name":u+=''+formatLink(r.url,r.name,"post_type")+"";break;case"location":u+=''+r.location+"";break;case"address":u+=''+formatAddress(r.formatted_address,tsml.street_only)+"";break;case"region":u+=''+(r.sub_region||r.region||"")+"";break;case"district":u+=''+(r.sub_district||r.district||"")+"";break;case"types":u+=''+s+""}n.append(u+"")}),d(),e.query&&"search"==e.mode&&t("#tsml td").not(".time").mark(e.query),"map"==e.view&&createMap(!0,locations,searchLocation),n.trigger("tsml_meetings_updated",{meetings:r,tbody:n})}else{if(e.query&&(void 0!==e.day||void 0!==e.region||void 0!==e.time||void 0!==e.type))return t("#day li").removeClass("active").first().addClass("active"),t("#time li").removeClass("active").first().addClass("active"),t("#region li").removeClass("active").first().addClass("active"),t("#type li").removeClass("active").first().addClass("active"),t("#day span.selected").html(t("#day li:first-child a").html()),t("#time span.selected").html(t("#time li:first-child a").html()),t("#region span.selected").html(t("#region li:first-child a").html()),t("#type span.selected").html(t("#type li:first-child a").html()),u();t("#meetings").addClass("empty"),f("no_meetings")}},"json")}function h(t){if(null==t)return"";t=(t=t.replace(/^\s+|\s+$/g,"")).toLowerCase();for(var e="àáäâèéëêìíïîòóöôùúüûñç·/_,:;",r=0,n=e.length;r]+>/gi,""],[/[&'"<>]+/g,""],[new RegExp("[\\/\\.    -    \\-֊־᐀᠆‐-―⸗⸚⸺⸻⹀〜〰゠︱︲﹘﹣-]","g"),"-"],[new RegExp("[^A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࢽऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛱ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢄᢇ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〆〱-〵〻〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿯ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞿꟂ-Ᶎꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭧꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ0-9²³¹¼-¾٠-٩۰-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൘-൞൦-൸෦-෯๐-๙໐-໙༠-༳၀-၉႐-႙፩-፼ᛮ-ᛰ០-៩៰-៹᠐-᠙᥆-᥏᧐-᧚᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙⁰⁴-⁹₀-₉⅐-ↂↅ-↉①-⒛⓪-⓿❶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-㉏㉑-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-꠵꣐-꣙꤀-꤉꧐-꧙꧰-꧹꩐-꩙꯰-꯹0-9̀-ͯ҃-҉֑-ׇֽֿׁׂׅׄؐ-ًؚ-ٰٟۖ-ۜ۟-۪ۤۧۨ-ܑۭܰ-݊ަ-ް߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣঁ-ঃ়া-ৄেৈো-্ৗৢৣ৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑੰੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣஂா-ூெ-ைொ-்ௗఀ-ఄా-ౄె-ైొ-్ౕౖౢౣಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣංඃ්ා-ුූෘ-ෟෲෳัิ-ฺ็-๎ັິ-ຼ່-ໍ༹༘༙༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏႚ-ႝ፝-፟ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝᠋-᠍ᢅᢆᢩᤠ-ᤫᤰ-᤻ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼᪰-᪾ᬀ-ᬄ᬴-᭄᭫-᭳ᮀ-ᮂᮡ-ᮭ᯦-᯳ᰤ-᰷᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷹᷻-᷿⃐-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꙯-꙲ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-ꣅ꣠-꣱ꣿꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀ꧥꨩ-ꨶꩃꩌꩍꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭ﬞ︀-️︠-︯-]+","g"),""],[/\-+/g,"-"],[/^\-|\-$/g,""]]);var e=document.createElement("textarea");e.innerHTML=t,t=e.value,a=window.tsml_sanitize_data;for(var r=0;re[0]?"asc"==i?1:-1:t[0]'+t+"")}).fail(function(t){r.removeClass("running"),n.find(".list-group").html('
  • '+tsml.strings.email_not_sent+"
  • ")}),r.addClass("running"),!1}}),t("#meetings table thead").on("click","th",function(){var e,r=t(this).attr("class");e=t(this).attr("data-sort")&&"asc"==t(this).attr("data-sort")?"desc":"asc",t("#meetings table thead th").removeAttr("data-sort"),t("#meetings table thead th."+r).attr("data-sort",e),d()}),t("#meetings .controls").on("submit","#search",function(){return y("search",n.val()),u(),!1}).on("click","div.expand",function(e){e.preventDefault(),e.stopPropagation(),t(this).next("ul.children").toggleClass("expanded"),t(this).toggleClass("expanded")}).on("click",".dropdown-menu a",function(e){e.preventDefault();var r=t(this).closest("div").attr("id");if("mode"==r)tsml.debug&&console.log("dropdown click search mode"),t("#mode li").removeClass("active"),t("#meetings").addClass("empty"),"search"==t(this).attr("data-id")?(n.prop("disabled",!1),t("#search button i").removeClass().addClass("glyphicon glyphicon-search")):"location"==t(this).attr("data-id")?(n.prop("disabled",!1),t("#search button i").removeClass().addClass("glyphicon glyphicon-map-marker"),f("loc_thinking")):"me"==t(this).attr("data-id")&&(n.prop("disabled",!0),t("#search button i").removeClass().addClass("glyphicon glyphicon-user"),f("geo_thinking")),n.attr("placeholder",t(this).text());else if("distance"==r)tsml.debug&&console.log("dropdown click distance"),t("#distance li").removeClass("active"),t("#distance span.selected").html(t(this).html()),y("distance",t(this).text());else if("region"==r){if(t(this).hasClass("switch")){tsml.debug&&console.log("dropdown click switching between region and district");var i=t(this).parent().hasClass("region")?"district":"region";return t(this).closest("#meetings").attr("tax-mode",i),void e.stopPropagation()}tsml.debug&&console.log("dropdown click region or district"),t("#region li").removeClass("active"),t("#region span.selected").html(t(this).html()),y("region",t(this).text())}else"day"==r?(tsml.debug&&console.log("dropdown click day"),t("#day li").removeClass("active"),t("#day span.selected").html(t(this).html()),y("day",t(this).text())):"time"==r?(tsml.debug&&console.log("dropdown click time"),t("#time li").removeClass("active"),t("#time span.selected").html(t(this).html()),y("time",t(this).text())):"type"==r&&(tsml.debug&&console.log("dropdown click type"),e.metaKey||t("#type li").removeClass("active"),y("type",t(this).text()));if(t(this).parent().toggleClass("active"),"type"==r)if(t("#type li.active a[data-id]").length){tsml.debug&&console.log("dropdown click "+t("#type li.active a[data-id]").length+" types selected");var o=[];t("#type li.active a[data-id]").each(function(){o.push(t(this).text())}),t("#type span.selected").html(o.join(" + "))}else tsml.debug&&console.log("dropdown click no types selected"),t("#type span.selected").html(t(this).text());var a="";t("#meetings #day li.active").index()&&(a+=t("#meetings #day span.selected").text()),t("#meetings #time li.active").index()&&(a+=" "+t("#meetings #time span.selected").text()),t("#meetings #type li.active").index()&&(a+=" "+t("#meetings #type span.selected").text()),a+=" "+tsml.program+" Meetings",t("#meetings #region li.active").index()&&(a+=" in "+t("#meetings #region span.selected").text()),document.title=a,t("#tsml #meetings .title h1").text(a),m(),u()}),t("#meetings #action .toggle-view").click(function(e){e.preventDefault();var r=t(this).attr("data-id");if(r!=t("#meetings").attr("data-view")&&(t("#meetings #action .toggle-view").toggleClass("active"),t("#meetings").attr("data-view",r),"map"==r&&createMap(!0,locations,searchLocation),history.pushState)){if(r==tsml.defaults.view)var n=v("tsml-view");else n=v("tsml-view",r);window.history.pushState({path:n},"",n)}}),t(window).resize(function(r){if(t("#meetings").hasClass("tsml_fullscreen")){var n=map.getCenter(),i=t(window).height()-79;e.hasClass("admin-bar")&&(i-=32),t("#map").css("height",i),google.maps.event.trigger(map,"resize"),map.setCenter(n)}}),t.widget("custom.autocomplete",t.ui.autocomplete,{_create:function(){this._super(),this.widget().menu("option","items","> :not(.ui-autocomplete-category)")},_renderItem:function(e,r){var n=new RegExp(t.ui.autocomplete.escapeRegex(this.term),"ig"),i=r.label.replace(n,""+this.term+"");return t("
  • ").attr("data-value",r.value).append(i).appendTo(e)},_renderMenu:function(e,r){var n=this,i="";t.each(r,function(t,r){var o;if(r.type!=i){const t=`${r.type}s`;e.append("
  • "+tsml.strings[t]+"
  • "),i=r.type}o=n._renderItemData(e,r),r.type&&o.attr("aria-label",r.type+" : "+r.value)})}})}); diff --git a/assets/src/public.js b/assets/src/public.js index 1efd7132..338f4d0f 100644 --- a/assets/src/public.js +++ b/assets/src/public.js @@ -655,7 +655,8 @@ jQuery(function($) { classes.push('notes'); } for (var i = 0; i < obj.types.length; i++) { - classes.push('type-' + sanitizeTitle(obj.types[i])); + typeClass = typeof obj.types[i] === 'string' ? obj.types[i] : obj.types[i].toString(); + classes.push('type-' + sanitizeTitle(typeClass)); } //add new table row