From b8a51dda47b09e92520ebf6c54f1d1f3835f20bb Mon Sep 17 00:00:00 2001 From: Nikos Roussos Date: Sat, 24 Mar 2018 15:34:37 +0200 Subject: [PATCH] Update requirements * Django * django-csp * django-allauth * mapbox-gl * pytest * Replace Mysql-python with mysqlclient --- db/static/lib/mapbox-gl/dist/mapbox-gl.css | 89 +- db/static/lib/mapbox-gl/dist/mapbox-gl.js | 921 +++++++++++---------- package.json | 2 +- requirements/dev.txt | 118 +-- requirements/production.txt | 114 +-- yarn.lock | 197 +++-- 6 files changed, 761 insertions(+), 680 deletions(-) diff --git a/db/static/lib/mapbox-gl/dist/mapbox-gl.css b/db/static/lib/mapbox-gl/dist/mapbox-gl.css index d446a03..81c798d 100644 --- a/db/static/lib/mapbox-gl/dist/mapbox-gl.css +++ b/db/static/lib/mapbox-gl/dist/mapbox-gl.css @@ -4,6 +4,10 @@ position: relative; -webkit-tap-highlight-color: rgba(0,0,0,0); } +.mapboxgl-map:-webkit-full-screen { + width: 100%; + height: 100%; +} .mapboxgl-missing-css { display: none; @@ -63,19 +67,19 @@ padding: 0; outline: none; border: none; - border-bottom: 1px solid #ddd; box-sizing: border-box; background-color: rgba(0,0,0,0); cursor: pointer; } + +.mapboxgl-ctrl-group > button + button { + border-top: 1px solid #ddd; +} /* https://bugzilla.mozilla.org/show_bug.cgi?id=140562 */ .mapboxgl-ctrl > button::-moz-focus-inner { border: 0; padding: 0; } -.mapboxgl-ctrl > button:last-child { - border-bottom: 0; -} .mapboxgl-ctrl > button:hover { background-color: rgba(0,0,0,0.05); } @@ -210,6 +214,9 @@ a.mapboxgl-ctrl-logo { font-weight: bold; margin-left: 2px; } +.mapboxgl-attrib-empty { + display: none; +} /*stylelint-enable*/ .mapboxgl-ctrl-scale { background-color: rgba(255,255,255,0.75); @@ -219,6 +226,7 @@ a.mapboxgl-ctrl-logo { border-color: #333; padding: 0 5px; color: #333; + box-sizing: border-box; } .mapboxgl-popup { @@ -349,56 +357,49 @@ a.mapboxgl-ctrl-logo { } .mapboxgl-user-location-dot { - background-color: #1DA1F2; - width: 16px; - height: 16px; + background-color: #1da1f2; + width: 15px; + height: 15px; border-radius: 50%; - box-shadow: 0 0 2px rgba(0,0,0,0.25); - border: 2px solid #fff; + box-shadow: 0 0 2px rgba(0, 0, 0, 0.25); } -.mapboxgl-user-location-dot:after { +.mapboxgl-user-location-dot::before { + background-color: #1da1f2; content: ''; - display: block; - box-shadow: #1DA1F2 0 0 0 2px; - width: 16px; - height: 16px; + width: 15px; + height: 15px; border-radius: 50%; - position: relative; - z-index: -1; - - -webkit-animation: mapboxgl-user-location-dot-pulse 2s; - -moz-animation: mapboxgl-user-location-dot-pulse 2s; - -ms-animation: mapboxgl-user-location-dot-pulse 2s; - animation: mapboxgl-user-location-dot-pulse 2s; - - -webkit-animation-iteration-count: infinite; - -moz-animation-iteration-count: infinite; - -ms-animation-iteration-count: infinite; - animation-iteration-count: infinite; + position: absolute; + -webkit-animation: mapboxgl-user-location-dot-pulse 2s infinite; + -moz-animation: mapboxgl-user-location-dot-pulse 2s infinite; + -ms-animation: mapboxgl-user-location-dot-pulse 2s infinite; + animation: mapboxgl-user-location-dot-pulse 2s infinite; } +.mapboxgl-user-location-dot::after { + border-radius: 50%; + border: 2px solid #fff; + content: ''; + height: 15px; + left: -2px; + position: absolute; + top: -2px; + width: 15px; +} + @-webkit-keyframes mapboxgl-user-location-dot-pulse { - 0% { -webkit-box-shadow: 0 0 0 0 rgba(29, 161, 242, 0.8); } - 70% { -webkit-box-shadow: 0 0 0 15px rgba(29, 161, 242, 0); } - 242% { -webkit-box-shadow: 0 0 0 0 rgba(29, 161, 242, 0); } + 0% { -webkit-transform: scale(1); opacity: 1; } + 70% { -webkit-transform: scale(3); opacity: 0; } + 100% { -webkit-transform: scale(1); opacity: 0; } } @-ms-keyframes mapboxgl-user-location-dot-pulse { - 0% { -ms-box-shadow: 0 0 0 0 rgba(29, 161, 242, 0.8); } - 70% { -ms-box-shadow: 0 0 0 15px rgba(29, 161, 242, 0); } - 242% { -ms-box-shadow: 0 0 0 0 rgba(29, 161, 242, 0); } + 0% { -ms-transform: scale(1); opacity: 1; } + 70% { -ms-transform: scale(3); opacity: 0; } + 100% { -ms-transform: scale(1); opacity: 0; } } @keyframes mapboxgl-user-location-dot-pulse { - 0% { - -moz-box-shadow: 0 0 0 0 rgba(29, 161, 242, 0.8); - box-shadow: 0 0 0 0 rgba(29, 161, 242, 0.4); - } - 70% { - -moz-box-shadow: 0 0 0 15px rgba(29, 161, 242, 0); - box-shadow: 0 0 0 15px rgba(29, 161, 242, 0); - } - 100% { - -moz-box-shadow: 0 0 0 0 rgba(29, 161, 242, 0); - box-shadow: 0 0 0 0 rgba(29, 161, 242, 0); - } + 0% { transform: scale(1); opacity: 1; } + 70% { transform: scale(3); opacity: 0; } + 100% { transform: scale(1); opacity: 0; } } .mapboxgl-user-location-dot-stale { background-color: #aaa; diff --git a/db/static/lib/mapbox-gl/dist/mapbox-gl.js b/db/static/lib/mapbox-gl/dist/mapbox-gl.js index 3ed8fcd..b96e4b4 100644 --- a/db/static/lib/mapbox-gl/dist/mapbox-gl.js +++ b/db/static/lib/mapbox-gl/dist/mapbox-gl.js @@ -1,518 +1,563 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mapboxgl = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o0){r+=Math.abs(ringArea(e[0]));for(var t=1;t2){for(g=0;gh.maxh||t>h.maxw||i<=h.maxh&&t<=h.maxw&&(r=h.maxw*h.maxh-t*i)n.free)){if(i===n.h)return this.allocShelf(f,t,i,s);i>n.h||ic)&&(p=2*Math.max(t,c)),(uu)&&(l=2*Math.max(i,u)),this.resize(p,l),this.packOne(t,i,s)}return null},t.prototype.allocFreebin=function(t,e,i,s){var h=this.freebins.splice(t,1)[0];return h.id=s,h.w=e,h.h=i,h.refcount=0,this.bins[s]=h,this.ref(h),h},t.prototype.allocShelf=function(t,e,i,s){var h=this.shelves[t],n=h.alloc(e,i,s);return this.bins[s]=n,this.ref(n),n},t.prototype.shrink=function(){if(this.shelves.length>0){for(var t=0,e=0,i=0;ithis.free||e>this.h)return null;var h=this.x;return this.x+=t,this.free-=t,new i(s,h,this.y,t,e,t,this.h)},e.prototype.resize=function(t){return this.free+=t-this.w,this.w=t,!0},t}); +"use strict";function isSupported(e){return!!(isBrowser()&&isArraySupported()&&isFunctionSupported()&&isObjectSupported()&&isJSONSupported()&&isWorkerSupported()&&isUint8ClampedArraySupported()&&isWebGLSupportedCached(e&&e.failIfMajorPerformanceCaveat))}function isBrowser(){return"undefined"!=typeof window&&"undefined"!=typeof document}function isArraySupported(){return 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 isFunctionSupported(){return Function.prototype&&Function.prototype.bind}function isObjectSupported(){return 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}function isJSONSupported(){return"JSON"in window&&"parse"in JSON&&"stringify"in JSON}function isWorkerSupported(){if(!("Worker"in window&&"Blob"in window))return!1;var e,t,r=new Blob([""],{type:"text/javascript"}),o=URL.createObjectURL(r);try{t=new Worker(o),e=!0}catch(t){e=!1}return t&&t.terminate(),URL.revokeObjectURL(o),e}function isUint8ClampedArraySupported(){return"Uint8ClampedArray"in window}function isWebGLSupportedCached(e){return void 0===isWebGLSupportedCache[e]&&(isWebGLSupportedCache[e]=isWebGLSupported(e)),isWebGLSupportedCache[e]}function isWebGLSupported(e){var t=document.createElement("canvas"),r=Object.create(isSupported.webGLContextAttributes);return r.failIfMajorPerformanceCaveat=e,t.probablySupportsContext?t.probablySupportsContext("webgl",r)||t.probablySupportsContext("experimental-webgl",r):t.supportsContext?t.supportsContext("webgl",r)||t.supportsContext("experimental-webgl",r):t.getContext("webgl",r)||t.getContext("experimental-webgl",r)}"undefined"!=typeof module&&module.exports?module.exports=isSupported:window&&(window.mapboxgl=window.mapboxgl||{},window.mapboxgl.supported=isSupported);var isWebGLSupportedCache={};isSupported.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0}; },{}],4:[function(_dereq_,module,exports){ -"use strict";function TinySDF(t,i,s,e,h,r){this.fontSize=t||24,this.buffer=void 0===i?3:i,this.cutoff=e||.25,this.fontFamily=h||"sans-serif",this.fontWeight=r||"normal",this.radius=s||8;var a=this.size=this.fontSize+2*this.buffer;this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=a,this.ctx=this.canvas.getContext("2d"),this.ctx.font=this.fontWeight+" "+this.fontSize+"px "+this.fontFamily,this.ctx.textBaseline="middle",this.ctx.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.d=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Int16Array(a),this.middle=Math.round(a/2*(navigator.userAgent.indexOf("Gecko/")>=0?1.2:1))}function edt(t,i,s,e,h,r,a){for(var n=0;nr)return r;for(;eh?e=s:r=s,s=.5*(r-e)+e}return s},UnitBezier.prototype.solve=function(t,i){return this.sampleCurveY(this.solveCurveX(t,i))}; +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.ShelfPack=e()}(this,function(){function t(t,e,i){i=i||{},this.w=t||64,this.h=e||64,this.autoResize=!!i.autoResize,this.shelves=[],this.freebins=[],this.stats={},this.bins={},this.maxId=0}function e(t,e,i){this.x=0,this.y=t,this.w=this.free=e,this.h=i}function i(t,e,i,s,h,n,r){this.id=t,this.x=e,this.y=i,this.w=s,this.h=h,this.maxw=n||s,this.maxh=r||h,this.refcount=0}return t.prototype.pack=function(t,e){t=[].concat(t),e=e||{};for(var i,s,h,n,r=[],f=0;fh.maxh||t>h.maxw||i<=h.maxh&&t<=h.maxw&&(r=h.maxw*h.maxh-t*i)n.free)){if(i===n.h)return this.allocShelf(f,t,i,s);i>n.h||ic)&&(p=2*Math.max(t,c)),(uu)&&(l=2*Math.max(i,u)),this.resize(p,l),this.packOne(t,i,s)}return null},t.prototype.allocFreebin=function(t,e,i,s){var h=this.freebins.splice(t,1)[0];return h.id=s,h.w=e,h.h=i,h.refcount=0,this.bins[s]=h,this.ref(h),h},t.prototype.allocShelf=function(t,e,i,s){var h=this.shelves[t],n=h.alloc(e,i,s);return this.bins[s]=n,this.ref(n),n},t.prototype.shrink=function(){if(this.shelves.length>0){for(var t=0,e=0,i=0;ithis.free||e>this.h)return null;var h=this.x;return this.x+=t,this.free-=t,new i(s,h,this.y,t,e,t,this.h)},e.prototype.resize=function(t){return this.free+=t-this.w,this.w=t,!0},t}); },{}],6:[function(_dereq_,module,exports){ +"use strict";function TinySDF(t,i,s,e,h,r){this.fontSize=t||24,this.buffer=void 0===i?3:i,this.cutoff=e||.25,this.fontFamily=h||"sans-serif",this.fontWeight=r||"normal",this.radius=s||8;var a=this.size=this.fontSize+2*this.buffer;this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=a,this.ctx=this.canvas.getContext("2d"),this.ctx.font=this.fontWeight+" "+this.fontSize+"px "+this.fontFamily,this.ctx.textBaseline="middle",this.ctx.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.d=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Int16Array(a),this.middle=Math.round(a/2*(navigator.userAgent.indexOf("Gecko/")>=0?1.2:1))}function edt(t,i,s,e,h,r,a){for(var n=0;nr)return r;for(;eh?e=s:r=s,s=.5*(r-e)+e}return s},UnitBezier.prototype.solve=function(t,i){return this.sampleCurveY(this.solveCurveX(t,i))}; +},{}],8:[function(_dereq_,module,exports){ module.exports.VectorTile=_dereq_("./lib/vectortile.js"),module.exports.VectorTileFeature=_dereq_("./lib/vectortilefeature.js"),module.exports.VectorTileLayer=_dereq_("./lib/vectortilelayer.js"); -},{"./lib/vectortile.js":7,"./lib/vectortilefeature.js":8,"./lib/vectortilelayer.js":9}],7:[function(_dereq_,module,exports){ +},{"./lib/vectortile.js":9,"./lib/vectortilefeature.js":10,"./lib/vectortilelayer.js":11}],9:[function(_dereq_,module,exports){ "use strict";function VectorTile(e,r){this.layers=e.readFields(readTile,{},r)}function readTile(e,r,i){if(3===e){var t=new VectorTileLayer(i,i.readVarint()+i.pos);t.length&&(r[t.name]=t)}}var VectorTileLayer=_dereq_("./vectortilelayer");module.exports=VectorTile; -},{"./vectortilelayer":9}],8:[function(_dereq_,module,exports){ +},{"./vectortilelayer":11}],10:[function(_dereq_,module,exports){ "use strict";function VectorTileFeature(e,t,r,a,i){this.properties={},this.extent=r,this.type=0,this._pbf=e,this._geometry=-1,this._keys=a,this._values=i,e.readFields(readFeature,this,t)}function readFeature(e,t,r){1==e?t.id=r.readVarint():2==e?readTag(r,t):3==e?t.type=r.readVarint():4==e&&(t._geometry=r.pos)}function readTag(e,t){for(var r=e.readVarint()+e.pos;e.pos>3}if(i--,1===a||2===a)o+=e.readSVarint(),n+=e.readSVarint(),1===a&&(t&&s.push(t),t=[]),t.push(new Point(o,n));else{if(7!==a)throw new Error("unknown command "+a);t&&t.push(t[0].clone())}}return t&&s.push(t),s},VectorTileFeature.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,r=1,a=0,i=0,o=0,n=1/0,s=-1/0,p=1/0,h=-1/0;e.pos>3}if(a--,1===r||2===r)i+=e.readSVarint(),o+=e.readSVarint(),is&&(s=i),oh&&(h=o);else if(7!==r)throw new Error("unknown command "+r)}return[n,p,s,h]},VectorTileFeature.prototype.toGeoJSON=function(e,t,r){function a(e){for(var t=0;t>3;t=1===a?e.readString():2===a?e.readFloat():3===a?e.readDouble():4===a?e.readVarint64():5===a?e.readVarint():6===a?e.readSVarint():7===a?e.readBoolean():null}return t}var VectorTileFeature=_dereq_("./vectortilefeature.js");module.exports=VectorTileLayer,VectorTileLayer.prototype.feature=function(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];var t=this._pbf.readVarint()+this._pbf.pos;return new VectorTileFeature(this._pbf,t,this.extent,this._keys,this._values)}; -},{"./vectortilefeature.js":8}],10:[function(_dereq_,module,exports){ +},{"./vectortilefeature.js":10}],12:[function(_dereq_,module,exports){ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.WhooTS=e.WhooTS||{})}(this,function(e){function t(e,t,r,n,i,s){return s=s||{},e+"?"+["bbox="+o(r,n,i),"format="+(s.format||"image/png"),"service="+(s.service||"WMS"),"version="+(s.version||"1.1.1"),"request="+(s.request||"GetMap"),"srs="+(s.srs||"EPSG:3857"),"width="+(s.width||256),"height="+(s.height||256),"layers="+t].join("&")}function o(e,t,o){t=Math.pow(2,o)-t-1;var n=r(256*e,256*t,o),i=r(256*(e+1),256*(t+1),o);return n[0]+","+n[1]+","+i[0]+","+i[1]}function r(e,t,o){var r=2*Math.PI*6378137/256/Math.pow(2,o);return[e*r-2*Math.PI*6378137/2,t*r-2*Math.PI*6378137/2]}e.getURL=t,e.getTileBBox=o,e.getMercCoords=r,Object.defineProperty(e,"__esModule",{value:!0})}); -},{}],11:[function(_dereq_,module,exports){ -function clamp_css_byte(e){return e=Math.round(e),e<0?0:e>255?255:e}function clamp_css_float(e){return e<0?0:e>1?1:e}function parse_css_int(e){return clamp_css_byte("%"===e[e.length-1]?parseFloat(e)/100*255:parseInt(e))}function parse_css_float(e){return clamp_css_float("%"===e[e.length-1]?parseFloat(e)/100:parseFloat(e))}function css_hue_to_rgb(e,r,l){return l<0?l+=1:l>1&&(l-=1),6*l<1?e+(r-e)*l*6:2*l<1?r:3*l<2?e+(r-e)*(2/3-l)*6:e}function parseCSSColor(e){var r=e.replace(/ /g,"").toLowerCase();if(r in kCSSColorTable)return kCSSColorTable[r].slice();if("#"===r[0]){if(4===r.length){var l=parseInt(r.substr(1),16);return l>=0&&l<=4095?[(3840&l)>>4|(3840&l)>>8,240&l|(240&l)>>4,15&l|(15&l)<<4,1]:null}if(7===r.length){var l=parseInt(r.substr(1),16);return l>=0&&l<=16777215?[(16711680&l)>>16,(65280&l)>>8,255&l,1]:null}return null}var a=r.indexOf("("),t=r.indexOf(")");if(-1!==a&&t+1===r.length){var n=r.substr(0,a),s=r.substr(a+1,t-(a+1)).split(","),o=1;switch(n){case"rgba":if(4!==s.length)return null;o=parse_css_float(s.pop());case"rgb":return 3!==s.length?null:[parse_css_int(s[0]),parse_css_int(s[1]),parse_css_int(s[2]),o];case"hsla":if(4!==s.length)return null;o=parse_css_float(s.pop());case"hsl":if(3!==s.length)return null;var i=(parseFloat(s[0])%360+360)%360/360,u=parse_css_float(s[1]),g=parse_css_float(s[2]),d=g<=.5?g*(u+1):g+u-g*u,c=2*g-d;return[clamp_css_byte(255*css_hue_to_rgb(c,d,i+1/3)),clamp_css_byte(255*css_hue_to_rgb(c,d,i)),clamp_css_byte(255*css_hue_to_rgb(c,d,i-1/3)),o];default:return null}}return null}var kCSSColorTable={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};try{exports.parseCSSColor=parseCSSColor}catch(e){} -},{}],12:[function(_dereq_,module,exports){ -"use strict";function earcut(e,n,r){r=r||2;var t=n&&n.length,i=t?n[0]*r:e.length,x=linkedList(e,0,i,r,!0),a=[];if(!x)return a;var o,l,u,s,v,f,y;if(t&&(x=eliminateHoles(e,n,x,r)),e.length>80*r){o=u=e[0],l=s=e[1];for(var d=r;du&&(u=v),f>s&&(s=f);y=Math.max(u-o,s-l)}return earcutLinked(x,a,r,o,l,y),a}function linkedList(e,n,r,t,i){var x,a;if(i===signedArea(e,n,r,t)>0)for(x=n;x=n;x-=t)a=insertNode(x,e[x],e[x+1],a);return a&&equals(a,a.next)&&(removeNode(a),a=a.next),a}function filterPoints(e,n){if(!e)return e;n||(n=e);var r,t=e;do{if(r=!1,t.steiner||!equals(t,t.next)&&0!==area(t.prev,t,t.next))t=t.next;else{if(removeNode(t),(t=n=t.prev)===t.next)return null;r=!0}}while(r||t!==n);return n}function earcutLinked(e,n,r,t,i,x,a){if(e){!a&&x&&indexCurve(e,t,i,x);for(var o,l,u=e;e.prev!==e.next;)if(o=e.prev,l=e.next,x?isEarHashed(e,t,i,x):isEar(e))n.push(o.i/r),n.push(e.i/r),n.push(l.i/r),removeNode(e),e=l.next,u=l.next;else if((e=l)===u){a?1===a?(e=cureLocalIntersections(e,n,r),earcutLinked(e,n,r,t,i,x,2)):2===a&&splitEarcut(e,n,r,t,i,x):earcutLinked(filterPoints(e),n,r,t,i,x,1);break}}}function isEar(e){var n=e.prev,r=e,t=e.next;if(area(n,r,t)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(pointInTriangle(n.x,n.y,r.x,r.y,t.x,t.y,i.x,i.y)&&area(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function isEarHashed(e,n,r,t){var i=e.prev,x=e,a=e.next;if(area(i,x,a)>=0)return!1;for(var o=i.xx.x?i.x>a.x?i.x:a.x:x.x>a.x?x.x:a.x,s=i.y>x.y?i.y>a.y?i.y:a.y:x.y>a.y?x.y:a.y,v=zOrder(o,l,n,r,t),f=zOrder(u,s,n,r,t),y=e.nextZ;y&&y.z<=f;){if(y!==e.prev&&y!==e.next&&pointInTriangle(i.x,i.y,x.x,x.y,a.x,a.y,y.x,y.y)&&area(y.prev,y,y.next)>=0)return!1;y=y.nextZ}for(y=e.prevZ;y&&y.z>=v;){if(y!==e.prev&&y!==e.next&&pointInTriangle(i.x,i.y,x.x,x.y,a.x,a.y,y.x,y.y)&&area(y.prev,y,y.next)>=0)return!1;y=y.prevZ}return!0}function cureLocalIntersections(e,n,r){var t=e;do{var i=t.prev,x=t.next.next;!equals(i,x)&&intersects(i,t,t.next,x)&&locallyInside(i,x)&&locallyInside(x,i)&&(n.push(i.i/r),n.push(t.i/r),n.push(x.i/r),removeNode(t),removeNode(t.next),t=e=x),t=t.next}while(t!==e);return t}function splitEarcut(e,n,r,t,i,x){var a=e;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&isValidDiagonal(a,o)){var l=splitPolygon(a,o);return a=filterPoints(a,a.next),l=filterPoints(l,l.next),earcutLinked(a,n,r,t,i,x),void earcutLinked(l,n,r,t,i,x)}o=o.next}a=a.next}while(a!==e)}function eliminateHoles(e,n,r,t){var i,x,a,o,l,u=[];for(i=0,x=n.length;i=t.next.y){var o=t.x+(x-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(o<=i&&o>a){if(a=o,o===i){if(x===t.y)return t;if(x===t.next.y)return t.next}r=t.x=t.x&&t.x>=s&&pointInTriangle(xr.x)&&locallyInside(t,e)&&(r=t,f=l),t=t.next;return r}function indexCurve(e,n,r,t){var i=e;do{null===i.z&&(i.z=zOrder(i.x,i.y,n,r,t)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,sortLinked(i)}function sortLinked(e){var n,r,t,i,x,a,o,l,u=1;do{for(r=e,e=null,x=null,a=0;r;){for(a++,t=r,o=0,n=0;n0||l>0&&t;)0===o?(i=t,t=t.nextZ,l--):0!==l&&t?r.z<=t.z?(i=r,r=r.nextZ,o--):(i=t,t=t.nextZ,l--):(i=r,r=r.nextZ,o--),x?x.nextZ=i:e=i,i.prevZ=x,x=i;r=t}x.nextZ=null,u*=2}while(a>1);return e}function zOrder(e,n,r,t,i){return e=32767*(e-r)/i,n=32767*(n-t)/i,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),n=16711935&(n|n<<8),n=252645135&(n|n<<4),n=858993459&(n|n<<2),n=1431655765&(n|n<<1),e|n<<1}function getLeftmost(e){var n=e,r=e;do{n.x=0&&(e-a)*(t-o)-(r-a)*(n-o)>=0&&(r-a)*(x-o)-(i-a)*(t-o)>=0}function isValidDiagonal(e,n){return e.next.i!==n.i&&e.prev.i!==n.i&&!intersectsPolygon(e,n)&&locallyInside(e,n)&&locallyInside(n,e)&&middleInside(e,n)}function area(e,n,r){return(n.y-e.y)*(r.x-n.x)-(n.x-e.x)*(r.y-n.y)}function equals(e,n){return e.x===n.x&&e.y===n.y}function intersects(e,n,r,t){return!!(equals(e,n)&&equals(r,t)||equals(e,t)&&equals(r,n))||area(e,n,r)>0!=area(e,n,t)>0&&area(r,t,e)>0!=area(r,t,n)>0}function intersectsPolygon(e,n){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==n.i&&r.next.i!==n.i&&intersects(r,r.next,e,n))return!0;r=r.next}while(r!==e);return!1}function locallyInside(e,n){return area(e.prev,e,e.next)<0?area(e,n,e.next)>=0&&area(e,e.prev,n)>=0:area(e,n,e.prev)<0||area(e,e.next,n)<0}function middleInside(e,n){var r=e,t=!1,i=(e.x+n.x)/2,x=(e.y+n.y)/2;do{r.y>x!=r.next.y>x&&i<(r.next.x-r.x)*(x-r.y)/(r.next.y-r.y)+r.x&&(t=!t),r=r.next}while(r!==e);return t}function splitPolygon(e,n){var r=new Node(e.i,e.x,e.y),t=new Node(n.i,n.x,n.y),i=e.next,x=n.prev;return e.next=n,n.prev=e,r.next=i,i.prev=r,t.next=r,r.prev=t,x.next=t,t.prev=x,t}function insertNode(e,n,r,t){var i=new Node(e,n,r);return t?(i.next=t.next,i.prev=t,t.next.prev=i,t.next=i):(i.prev=i,i.next=i),i}function removeNode(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Node(e,n,r){this.i=e,this.x=n,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function signedArea(e,n,r,t){for(var i=0,x=n,a=r-t;x0&&(t+=e[i-1].length,r.holes.push(t))}return r}; },{}],13:[function(_dereq_,module,exports){ -function geometry(r){if("Polygon"===r.type)return polygonArea(r.coordinates);if("MultiPolygon"===r.type){for(var e=0,n=0;n0){e+=Math.abs(ringArea(r[0]));for(var n=1;n2){for(var n,t,o=0;o=0}var geojsonArea=_dereq_("geojson-area");module.exports=rewind; -},{"geojson-area":13}],15:[function(_dereq_,module,exports){ -"use strict";function clip(e,r,t,n,u,i,l,s){if(t/=r,n/=r,l>=t&&s<=n)return e;if(l>n||s=t&&c<=n)h.push(o);else if(!(a>n||c=r&&s<=t&&u.push(l)}return u}function clipGeometry(e,r,t,n,u,i){for(var l=[],s=0;st?(d.push(u(h,f,r),u(h,f,t)),i||(d=newSlice(l,d,v,m,w))):o>=r&&d.push(u(h,f,r)):c>t?ot&&(d.push(u(h,f,t)),i||(d=newSlice(l,d,v,m,w))));h=g[S-1],c=h[n],c>=r&&c<=t&&d.push(h),a=d[d.length-1],i&&a&&(d[0][0]!==a[0]||d[0][1]!==a[1])&&d.push(d[0]),newSlice(l,d,v,m,w)}return l}function newSlice(e,r,t,n,u){return r.length&&(r.area=t,r.dist=n,void 0!==u&&(r.outer=u),e.push(r)),[]}module.exports=clip;var createFeature=_dereq_("./feature"); -},{"./feature":17}],16:[function(_dereq_,module,exports){ -"use strict";function convert(e,t){var r=[];if("FeatureCollection"===e.type)for(var o=0;o1?1:o,[r,o,0]}function calcSize(e){for(var t,r,o=0,a=0,i=0;i1)return!1;var r=n.geometry[0].length;if(5!==r)return!1;for(var s=0;s1&&console.time("creation"),m=this.tiles[d]=createTile(e,p,i,o,f,t===a.maxZoom),this.tileCoords.push({z:t,x:i,y:o}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,i,o,m.numFeatures,m.numPoints,m.numSimplified),console.timeEnd("creation"));var h="z"+t;this.stats[h]=(this.stats[h]||0)+1,this.total++}if(m.source=e,n){if(t===a.maxZoom||t===n)continue;var x=1<1&&console.time("clipping");var g,v,M,T,b,y,S=.5*a.buffer/a.extent,Z=.5-S,q=.5+S,w=1+S;g=v=M=T=null,b=clip(e,p,i-S,i+q,0,intersectX,m.min[0],m.max[0]),y=clip(e,p,i+Z,i+w,0,intersectX,m.min[0],m.max[0]),b&&(g=clip(b,p,o-S,o+q,1,intersectY,m.min[1],m.max[1]),v=clip(b,p,o+Z,o+w,1,intersectY,m.min[1],m.max[1])),y&&(M=clip(y,p,o-S,o+q,1,intersectY,m.min[1],m.max[1]),T=clip(y,p,o+Z,o+w,1,intersectY,m.min[1],m.max[1])),u>1&&console.timeEnd("clipping"),e.length&&(l.push(g||[],t+1,2*i,2*o),l.push(v||[],t+1,2*i,2*o+1),l.push(M||[],t+1,2*i+1,2*o),l.push(T||[],t+1,2*i+1,2*o+1))}else n&&(c=t)}return c},GeoJSONVT.prototype.getTile=function(e,t,i){var o=this.options,n=o.extent,r=o.debug,s=1<1&&console.log("drilling down to z%d-%d-%d",e,t,i);for(var a,u=e,c=t,p=i;!a&&u>0;)u--,c=Math.floor(c/2),p=Math.floor(p/2),a=this.tiles[toID(u,c,p)];if(!a||!a.source)return null;if(r>1&&console.log("found parent tile z%d-%d-%d",u,c,p),isClippedSquare(a,n,o.buffer))return transform.tile(a,n);r>1&&console.time("drilling down");var d=this.splitTile(a.source,u,c,p,e,t,i);if(r>1&&console.timeEnd("drilling down"),null!==d){var m=1<p&&(s=e,p=r);p>o?(t[s][2]=p,g.push(u),g.push(s),u=s):(n=g.pop(),u=g.pop())}}function getSqSegDist(t,i,e){var p=i[0],r=i[1],s=e[0],o=e[1],f=t[0],u=t[1],n=s-p,g=o-r;if(0!==n||0!==g){var l=((f-p)*n+(u-r)*g)/(n*n+g*g);l>1?(p=s,r=o):l>0&&(p+=n*l,r+=g*l)}return n=f-p,g=u-r,n*n+g*g}module.exports=simplify; -},{}],20:[function(_dereq_,module,exports){ -"use strict";function createTile(e,n,r,i,t,u){for(var a={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:r,y:i,z2:n,transformed:!1,min:[2,1],max:[-1,0]},m=0;ma.max[0]&&(a.max[0]=l[0]),l[1]>a.max[1]&&(a.max[1]=l[1])}return a}function addFeature(e,n,r,i){var t,u,a,m,s=n.geometry,l=n.type,o=[],f=r*r;if(1===l)for(t=0;tf)&&(d.push(m),e.numSimplified++),e.numPoints++;3===l&&rewind(d,a.outer),o.push(d)}else e.numPoints+=a.length;if(o.length){var g={geometry:o,type:l,tags:n.tags||null};null!==n.id&&(g.id=n.id),e.features.push(g)}}function rewind(e,n){signedArea(e)<0===n&&e.reverse()}function signedArea(e){for(var n,r,i=0,t=0,u=e.length,a=u-1;t255?255:e}function clamp_css_float(e){return e<0?0:e>1?1:e}function parse_css_int(e){return clamp_css_byte("%"===e[e.length-1]?parseFloat(e)/100*255:parseInt(e))}function parse_css_float(e){return clamp_css_float("%"===e[e.length-1]?parseFloat(e)/100:parseFloat(e))}function css_hue_to_rgb(e,r,l){return l<0?l+=1:l>1&&(l-=1),6*l<1?e+(r-e)*l*6:2*l<1?r:3*l<2?e+(r-e)*(2/3-l)*6:e}function parseCSSColor(e){var r=e.replace(/ /g,"").toLowerCase();if(r in kCSSColorTable)return kCSSColorTable[r].slice();if("#"===r[0]){if(4===r.length){var l=parseInt(r.substr(1),16);return l>=0&&l<=4095?[(3840&l)>>4|(3840&l)>>8,240&l|(240&l)>>4,15&l|(15&l)<<4,1]:null}if(7===r.length){var l=parseInt(r.substr(1),16);return l>=0&&l<=16777215?[(16711680&l)>>16,(65280&l)>>8,255&l,1]:null}return null}var a=r.indexOf("("),t=r.indexOf(")");if(-1!==a&&t+1===r.length){var n=r.substr(0,a),s=r.substr(a+1,t-(a+1)).split(","),o=1;switch(n){case"rgba":if(4!==s.length)return null;o=parse_css_float(s.pop());case"rgb":return 3!==s.length?null:[parse_css_int(s[0]),parse_css_int(s[1]),parse_css_int(s[2]),o];case"hsla":if(4!==s.length)return null;o=parse_css_float(s.pop());case"hsl":if(3!==s.length)return null;var i=(parseFloat(s[0])%360+360)%360/360,u=parse_css_float(s[1]),g=parse_css_float(s[2]),d=g<=.5?g*(u+1):g+u-g*u,c=2*g-d;return[clamp_css_byte(255*css_hue_to_rgb(c,d,i+1/3)),clamp_css_byte(255*css_hue_to_rgb(c,d,i)),clamp_css_byte(255*css_hue_to_rgb(c,d,i-1/3)),o];default:return null}}return null}var kCSSColorTable={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};try{exports.parseCSSColor=parseCSSColor}catch(e){} +},{}],14:[function(_dereq_,module,exports){ +"use strict";function earcut(e,n,r){r=r||2;var t=n&&n.length,i=t?n[0]*r:e.length,x=linkedList(e,0,i,r,!0),a=[];if(!x)return a;var o,l,u,s,v,f,y;if(t&&(x=eliminateHoles(e,n,x,r)),e.length>80*r){o=u=e[0],l=s=e[1];for(var p=r;pu&&(u=v),f>s&&(s=f);y=Math.max(u-o,s-l),y=0!==y?1/y:0}return earcutLinked(x,a,r,o,l,y),a}function linkedList(e,n,r,t,i){var x,a;if(i===signedArea(e,n,r,t)>0)for(x=n;x=n;x-=t)a=insertNode(x,e[x],e[x+1],a);return a&&equals(a,a.next)&&(removeNode(a),a=a.next),a}function filterPoints(e,n){if(!e)return e;n||(n=e);var r,t=e;do{if(r=!1,t.steiner||!equals(t,t.next)&&0!==area(t.prev,t,t.next))t=t.next;else{if(removeNode(t),(t=n=t.prev)===t.next)break;r=!0}}while(r||t!==n);return n}function earcutLinked(e,n,r,t,i,x,a){if(e){!a&&x&&indexCurve(e,t,i,x);for(var o,l,u=e;e.prev!==e.next;)if(o=e.prev,l=e.next,x?isEarHashed(e,t,i,x):isEar(e))n.push(o.i/r),n.push(e.i/r),n.push(l.i/r),removeNode(e),e=l.next,u=l.next;else if((e=l)===u){a?1===a?(e=cureLocalIntersections(e,n,r),earcutLinked(e,n,r,t,i,x,2)):2===a&&splitEarcut(e,n,r,t,i,x):earcutLinked(filterPoints(e),n,r,t,i,x,1);break}}}function isEar(e){var n=e.prev,r=e,t=e.next;if(area(n,r,t)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(pointInTriangle(n.x,n.y,r.x,r.y,t.x,t.y,i.x,i.y)&&area(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function isEarHashed(e,n,r,t){var i=e.prev,x=e,a=e.next;if(area(i,x,a)>=0)return!1;for(var o=i.xx.x?i.x>a.x?i.x:a.x:x.x>a.x?x.x:a.x,s=i.y>x.y?i.y>a.y?i.y:a.y:x.y>a.y?x.y:a.y,v=zOrder(o,l,n,r,t),f=zOrder(u,s,n,r,t),y=e.prevZ,p=e.nextZ;y&&y.z>=v&&p&&p.z<=f;){if(y!==e.prev&&y!==e.next&&pointInTriangle(i.x,i.y,x.x,x.y,a.x,a.y,y.x,y.y)&&area(y.prev,y,y.next)>=0)return!1;if(y=y.prevZ,p!==e.prev&&p!==e.next&&pointInTriangle(i.x,i.y,x.x,x.y,a.x,a.y,p.x,p.y)&&area(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;y&&y.z>=v;){if(y!==e.prev&&y!==e.next&&pointInTriangle(i.x,i.y,x.x,x.y,a.x,a.y,y.x,y.y)&&area(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;p&&p.z<=f;){if(p!==e.prev&&p!==e.next&&pointInTriangle(i.x,i.y,x.x,x.y,a.x,a.y,p.x,p.y)&&area(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function cureLocalIntersections(e,n,r){var t=e;do{var i=t.prev,x=t.next.next;!equals(i,x)&&intersects(i,t,t.next,x)&&locallyInside(i,x)&&locallyInside(x,i)&&(n.push(i.i/r),n.push(t.i/r),n.push(x.i/r),removeNode(t),removeNode(t.next),t=e=x),t=t.next}while(t!==e);return t}function splitEarcut(e,n,r,t,i,x){var a=e;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&isValidDiagonal(a,o)){var l=splitPolygon(a,o);return a=filterPoints(a,a.next),l=filterPoints(l,l.next),earcutLinked(a,n,r,t,i,x),void earcutLinked(l,n,r,t,i,x)}o=o.next}a=a.next}while(a!==e)}function eliminateHoles(e,n,r,t){var i,x,a,o,l,u=[];for(i=0,x=n.length;i=t.next.y&&t.next.y!==t.y){var o=t.x+(x-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(o<=i&&o>a){if(a=o,o===i){if(x===t.y)return t;if(x===t.next.y)return t.next}r=t.x=t.x&&t.x>=s&&i!==t.x&&pointInTriangle(xr.x)&&locallyInside(t,e)&&(r=t,f=l),t=t.next;return r}function indexCurve(e,n,r,t){var i=e;do{null===i.z&&(i.z=zOrder(i.x,i.y,n,r,t)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,sortLinked(i)}function sortLinked(e){var n,r,t,i,x,a,o,l,u=1;do{for(r=e,e=null,x=null,a=0;r;){for(a++,t=r,o=0,n=0;n0||l>0&&t;)0!==o&&(0===l||!t||r.z<=t.z)?(i=r,r=r.nextZ,o--):(i=t,t=t.nextZ,l--),x?x.nextZ=i:e=i,i.prevZ=x,x=i;r=t}x.nextZ=null,u*=2}while(a>1);return e}function zOrder(e,n,r,t,i){return e=32767*(e-r)*i,n=32767*(n-t)*i,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),n=16711935&(n|n<<8),n=252645135&(n|n<<4),n=858993459&(n|n<<2),n=1431655765&(n|n<<1),e|n<<1}function getLeftmost(e){var n=e,r=e;do{n.x=0&&(e-a)*(t-o)-(r-a)*(n-o)>=0&&(r-a)*(x-o)-(i-a)*(t-o)>=0}function isValidDiagonal(e,n){return e.next.i!==n.i&&e.prev.i!==n.i&&!intersectsPolygon(e,n)&&locallyInside(e,n)&&locallyInside(n,e)&&middleInside(e,n)}function area(e,n,r){return(n.y-e.y)*(r.x-n.x)-(n.x-e.x)*(r.y-n.y)}function equals(e,n){return e.x===n.x&&e.y===n.y}function intersects(e,n,r,t){return!!(equals(e,n)&&equals(r,t)||equals(e,t)&&equals(r,n))||area(e,n,r)>0!=area(e,n,t)>0&&area(r,t,e)>0!=area(r,t,n)>0}function intersectsPolygon(e,n){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==n.i&&r.next.i!==n.i&&intersects(r,r.next,e,n))return!0;r=r.next}while(r!==e);return!1}function locallyInside(e,n){return area(e.prev,e,e.next)<0?area(e,n,e.next)>=0&&area(e,e.prev,n)>=0:area(e,n,e.prev)<0||area(e,e.next,n)<0}function middleInside(e,n){var r=e,t=!1,i=(e.x+n.x)/2,x=(e.y+n.y)/2;do{r.y>x!=r.next.y>x&&r.next.y!==r.y&&i<(r.next.x-r.x)*(x-r.y)/(r.next.y-r.y)+r.x&&(t=!t),r=r.next}while(r!==e);return t}function splitPolygon(e,n){var r=new Node(e.i,e.x,e.y),t=new Node(n.i,n.x,n.y),i=e.next,x=n.prev;return e.next=n,n.prev=e,r.next=i,i.prev=r,t.next=r,r.prev=t,x.next=t,t.prev=x,t}function insertNode(e,n,r,t){var i=new Node(e,n,r);return t?(i.next=t.next,i.prev=t,t.next.prev=i,t.next=i):(i.prev=i,i.next=i),i}function removeNode(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Node(e,n,r){this.i=e,this.x=n,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function signedArea(e,n,r,t){for(var i=0,x=n,a=r-t;x0&&(t+=e[i-1].length,r.holes.push(t))}return r}; +},{}],15:[function(_dereq_,module,exports){ +function rewind(r,e){switch(r&&r.type||null){case"FeatureCollection":return r.features=r.features.map(curryOuter(rewind,e)),r;case"Feature":return r.geometry=rewind(r.geometry,e),r;case"Polygon":case"MultiPolygon":return correct(r,e);default:return r}}function curryOuter(r,e){return function(n){return r(n,e)}}function correct(r,e){return"Polygon"===r.type?r.coordinates=correctRings(r.coordinates,e):"MultiPolygon"===r.type&&(r.coordinates=r.coordinates.map(curryOuter(correctRings,e))),r}function correctRings(r,e){e=!!e,r[0]=wind(r[0],e);for(var n=1;n=0}var geojsonArea=_dereq_("@mapbox/geojson-area");module.exports=rewind; +},{"@mapbox/geojson-area":1}],16:[function(_dereq_,module,exports){ +"use strict";function clip(i,n,e,t,l,r,u){if(e/=n,t/=n,r>=e&&u<=t)return i;if(r>t||u=e&&g<=t)s.push(h);else if(!(a>t||g=e&&u<=t&&(n.push(i[r]),n.push(i[r+1]),n.push(i[r+2]))}}function clipLine(i,n,e,t,l,r){for(var u=[],s=0===l?intersectX:intersectY,o=0;o=e&&s(u,h,p,a,g,e):f>t?P<=t&&s(u,h,p,a,g,t):addPoint(u,h,p,c),P=e&&(s(u,h,p,a,g,e),L=!0),P>t&&f<=t&&(s(u,h,p,a,g,t),L=!0),!r&&L&&(u.size=i.size,n.push(u),u=[])}var v=i.length-3;h=i[v],p=i[v+1],c=i[v+2],f=0===l?h:p,f>=e&&f<=t&&addPoint(u,h,p,c),v=u.length-3,r&&v>=3&&(u[v]!==u[0]||u[v+1]!==u[1])&&addPoint(u,u[0],u[1],u[2]),u.length&&(u.size=i.size,n.push(u))}function clipLines(i,n,e,t,l,r){for(var u=0;u0&&(a+=o?(n*c-s*i)/2:Math.sqrt(Math.pow(s-n,2)+Math.pow(c-i,2))),n=s,i=c}var p=t.length-3;t[2]=1,simplify(t,0,p,r),t[p+2]=1,t.size=Math.abs(a)}function convertLines(e,t,r,o){for(var n=0;n1?1:r}module.exports=convert;var simplify=_dereq_("./simplify"),createFeature=_dereq_("./feature"); +},{"./feature":18,"./simplify":20}],18:[function(_dereq_,module,exports){ +"use strict";function createFeature(e,n,t,i){var a={id:e||null,type:n,geometry:t,tags:i,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return calcBBox(a),a}function calcBBox(e){var n=e.geometry,t=e.type;if("Point"===t||"MultiPoint"===t||"LineString"===t)calcLineBBox(e,n);else if("Polygon"===t||"MultiLineString"===t)for(var i=0;i24)throw new Error("maxZoom should be in the 0-24 range");var i=1<1&&console.time("creation"),p=this.tiles[c]=createTile(e,m,o,i,d,t===a.maxZoom),this.tileCoords.push({z:t,x:o,y:i}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,o,i,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));var h="z"+t;this.stats[h]=(this.stats[h]||0)+1,this.total++}if(p.source=e,n){if(t===a.maxZoom||t===n)continue;var x=1<1&&console.time("clipping");var f,g,v,Z,T,M,b=.5*a.buffer/a.extent,w=.5-b,Y=.5+b,O=1+b;f=g=v=Z=null,T=clip(e,m,o-b,o+Y,0,p.minX,p.maxX),M=clip(e,m,o+w,o+O,0,p.minX,p.maxX),e=null,T&&(f=clip(T,m,i-b,i+Y,1,p.minY,p.maxY),g=clip(T,m,i+w,i+O,1,p.minY,p.maxY),T=null),M&&(v=clip(M,m,i-b,i+Y,1,p.minY,p.maxY),Z=clip(M,m,i+w,i+O,1,p.minY,p.maxY),M=null),u>1&&console.timeEnd("clipping"),r.push(f||[],t+1,2*o,2*i),r.push(g||[],t+1,2*o,2*i+1),r.push(v||[],t+1,2*o+1,2*i),r.push(Z||[],t+1,2*o+1,2*i+1)}}},GeoJSONVT.prototype.getTile=function(e,t,o){var i=this.options,n=i.extent,s=i.debug;if(e<0||e>24)return null;var l=1<1&&console.log("drilling down to z%d-%d-%d",e,t,o);for(var a,u=e,m=t,c=o;!a&&u>0;)u--,m=Math.floor(m/2),c=Math.floor(c/2),a=this.tiles[toID(u,m,c)];return a&&a.source?(s>1&&console.log("found parent tile z%d-%d-%d",u,m,c),s>1&&console.time("drilling down"),this.splitTile(a.source,u,m,c,e,t,o),s>1&&console.timeEnd("drilling down"),this.tiles[r]?transform.tile(this.tiles[r],n):null):null}; +},{"./clip":16,"./convert":17,"./tile":21,"./transform":22,"./wrap":23}],20:[function(_dereq_,module,exports){ +"use strict";function simplify(i,t,r,s){for(var e,f=s,l=i[t],m=i[t+1],n=i[r],o=i[r+1],p=t+3;pf&&(e=p,f=u)}f>s&&(e-t>3&&simplify(i,t,e,s),i[e+2]=f,r-e>3&&simplify(i,e,r,s))}function getSqSegDist(i,t,r,s,e,f){var l=e-r,m=f-s;if(0!==l||0!==m){var n=((i-r)*l+(t-s)*m)/(l*l+m*m);n>1?(r=e,s=f):n>0&&(r+=l*n,s+=m*n)}return l=i-r,m=t-s,l*l+m*m}module.exports=simplify; },{}],21:[function(_dereq_,module,exports){ -"use strict";function transformTile(r,t){if(r.transformed)return r;var n,e,o,f=r.z2,a=r.x,s=r.y;for(n=0;na.maxX&&(a.maxX=f),s>a.maxY&&(a.maxY=s)}return a}function addFeature(n,e,i,t){var r=e.geometry,u=e.type,a=[];if("Point"===u||"MultiPoint"===u)for(var l=0;ll)&&(i.numSimplified++,o.push(e[m]),o.push(e[m+1])),i.numPoints++;u&&rewind(o,a),n.push(o)}function rewind(n,e){for(var i=0,t=0,r=n.length,u=r-2;t0===e)for(t=0,r=n.length;t=a[u+0]&&s>=a[u+1]?(n[f]=!0,h.push(l[f])):n[f]=!1}}},GridIndex.prototype._forEachCell=function(t,r,e,s,i,h,n){for(var o=this._convertToCellCoord(t),l=this._convertToCellCoord(r),a=this._convertToCellCoord(e),d=this._convertToCellCoord(s),f=o;f<=a;f++)for(var u=l;u<=d;u++){var y=this.d*u+f;if(i.call(this,t,r,e,s,y,h,n))return}},GridIndex.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},GridIndex.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,r=NUM_PARAMS+this.cells.length+1+1,e=0,s=0;s>1,i=-7,N=t?h-1:0,n=t?-1:1,s=a[o+N];for(N+=n,M=s&(1<<-i)-1,s>>=-i,i+=w;i>0;M=256*M+a[o+N],N+=n,i-=8);for(p=M&(1<<-i)-1,M>>=-i,i+=r;i>0;p=256*p+a[o+N],N+=n,i-=8);if(0===M)M=1-e;else{if(M===f)return p?NaN:1/0*(s?-1:1);p+=Math.pow(2,r),M-=e}return(s?-1:1)*p*Math.pow(2,M-r)},exports.write=function(a,o,t,r,h,M){var p,w,f,e=8*M-h-1,i=(1<>1,n=23===h?Math.pow(2,-24)-Math.pow(2,-77):0,s=r?0:M-1,u=r?1:-1,l=o<0||0===o&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(w=isNaN(o)?1:0,p=i):(p=Math.floor(Math.log(o)/Math.LN2),o*(f=Math.pow(2,-p))<1&&(p--,f*=2),o+=p+N>=1?n/f:n*Math.pow(2,1-N),o*f>=2&&(p++,f/=2),p+N>=i?(w=0,p=i):p+N>=1?(w=(o*f-1)*Math.pow(2,h),p+=N):(w=o*Math.pow(2,N-1)*Math.pow(2,h),p=0));h>=8;a[t+s]=255&w,s+=u,w/=256,h-=8);for(p=p<0;a[t+s]=255&p,s+=u,p/=256,e-=8);a[t+s-u]|=128*l}; },{}],25:[function(_dereq_,module,exports){ +exports.read=function(a,o,t,r,h){var M,p,w=8*h-r-1,f=(1<>1,i=-7,N=t?h-1:0,n=t?-1:1,s=a[o+N];for(N+=n,M=s&(1<<-i)-1,s>>=-i,i+=w;i>0;M=256*M+a[o+N],N+=n,i-=8);for(p=M&(1<<-i)-1,M>>=-i,i+=r;i>0;p=256*p+a[o+N],N+=n,i-=8);if(0===M)M=1-e;else{if(M===f)return p?NaN:1/0*(s?-1:1);p+=Math.pow(2,r),M-=e}return(s?-1:1)*p*Math.pow(2,M-r)},exports.write=function(a,o,t,r,h,M){var p,w,f,e=8*M-h-1,i=(1<>1,n=23===h?Math.pow(2,-24)-Math.pow(2,-77):0,s=r?0:M-1,u=r?1:-1,l=o<0||0===o&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(w=isNaN(o)?1:0,p=i):(p=Math.floor(Math.log(o)/Math.LN2),o*(f=Math.pow(2,-p))<1&&(p--,f*=2),o+=p+N>=1?n/f:n*Math.pow(2,1-N),o*f>=2&&(p++,f/=2),p+N>=i?(w=0,p=i):p+N>=1?(w=(o*f-1)*Math.pow(2,h),p+=N):(w=o*Math.pow(2,N-1)*Math.pow(2,h),p=0));h>=8;a[t+s]=255&w,s+=u,w/=256,h-=8);for(p=p<0;a[t+s]=255&p,s+=u,p/=256,e-=8);a[t+s-u]|=128*l}; +},{}],26:[function(_dereq_,module,exports){ "use strict";function kdbush(t,i,e,s,n){return new KDBush(t,i,e,s,n)}function KDBush(t,i,e,s,n){i=i||defaultGetX,e=e||defaultGetY,n=n||Array,this.nodeSize=s||64,this.points=t,this.ids=new n(t.length),this.coords=new n(2*t.length);for(var r=0;r=s&&a<=h&&t>=u&&t<=e&&f.push(p[i]);else{var c=Math.floor((g+v)/2);a=r[2*c],t=r[2*c+1],a>=s&&a<=h&&t>=u&&t<=e&&f.push(p[c]);var d=(l+1)%2;(0===l?s<=a:u<=t)&&(n.push(g),n.push(c-1),n.push(d)),(0===l?h>=a:e>=t)&&(n.push(c+1),n.push(v),n.push(d))}}return f}module.exports=range; -},{}],27:[function(_dereq_,module,exports){ -"use strict";function sortKD(t,a,o,s,r,e){if(!(r-s<=o)){var f=Math.floor((s+r)/2);select(t,a,f,s,r,e%2),sortKD(t,a,o,s,f-1,e+1),sortKD(t,a,o,f+1,r,e+1)}}function select(t,a,o,s,r,e){for(;r>s;){if(r-s>600){var f=r-s+1,p=o-s+1,w=Math.log(f),m=.5*Math.exp(2*w/3),n=.5*Math.sqrt(w*m*(f-m)/f)*(p-f/2<0?-1:1);select(t,a,o,Math.max(s,Math.floor(o-p*m/f+n)),Math.min(r,Math.floor(o+(f-p)*m/f+n)),e)}var c=a[2*o+e],h=s,i=r;for(swapItem(t,a,s,o),a[2*r+e]>c&&swapItem(t,a,s,r);hc;)i--}a[2*s+e]===c?swapItem(t,a,s,i):(i++,swapItem(t,a,i,r)),i<=o&&(s=i+1),o<=i&&(r=i-1)}}function swapItem(t,a,o,s){swap(t,o,s),swap(a,2*o,2*s),swap(a,2*o+1,2*s+1)}function swap(t,a,o){var s=t[a];t[a]=t[o],t[o]=s}module.exports=sortKD; },{}],28:[function(_dereq_,module,exports){ -"use strict";function within(s,p,r,t,u,h){for(var i=[0,s.length-1,0],o=[],n=u*u;i.length;){var e=i.pop(),a=i.pop(),f=i.pop();if(a-f<=h)for(var v=f;v<=a;v++)sqDist(p[2*v],p[2*v+1],r,t)<=n&&o.push(s[v]);else{var l=Math.floor((f+a)/2),c=p[2*l],q=p[2*l+1];sqDist(c,q,r,t)<=n&&o.push(s[l]);var D=(e+1)%2;(0===e?r-u<=c:t-u<=q)&&(i.push(f),i.push(l-1),i.push(D)),(0===e?r+u>=c:t+u>=q)&&(i.push(l+1),i.push(a),i.push(D))}}return o}function sqDist(s,p,r,t){var u=s-r,h=p-t;return u*u+h*h}module.exports=within; +"use strict";function sortKD(t,a,o,s,r,e){if(!(r-s<=o)){var f=Math.floor((s+r)/2);select(t,a,f,s,r,e%2),sortKD(t,a,o,s,f-1,e+1),sortKD(t,a,o,f+1,r,e+1)}}function select(t,a,o,s,r,e){for(;r>s;){if(r-s>600){var f=r-s+1,p=o-s+1,w=Math.log(f),m=.5*Math.exp(2*w/3),n=.5*Math.sqrt(w*m*(f-m)/f)*(p-f/2<0?-1:1);select(t,a,o,Math.max(s,Math.floor(o-p*m/f+n)),Math.min(r,Math.floor(o+(f-p)*m/f+n)),e)}var c=a[2*o+e],h=s,i=r;for(swapItem(t,a,s,o),a[2*r+e]>c&&swapItem(t,a,s,r);hc;)i--}a[2*s+e]===c?swapItem(t,a,s,i):(i++,swapItem(t,a,i,r)),i<=o&&(s=i+1),o<=i&&(r=i-1)}}function swapItem(t,a,o,s){swap(t,o,s),swap(a,2*o,2*s),swap(a,2*o+1,2*s+1)}function swap(t,a,o){var s=t[a];t[a]=t[o],t[o]=s}module.exports=sortKD; },{}],29:[function(_dereq_,module,exports){ -function isObjectLike(r){return!!r&&"object"==typeof r}function arraySome(r,e){for(var a=-1,t=r.length;++as))return!1;for(;++c-1&&t%1==0&&t<=MAX_SAFE_INTEGER}function isObject(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function isObjectLike(t){return!!t&&"object"==typeof t}var MAX_SAFE_INTEGER=9007199254740991,argsTag="[object Arguments]",funcTag="[object Function]",genTag="[object GeneratorFunction]",objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty,objectToString=objectProto.toString,propertyIsEnumerable=objectProto.propertyIsEnumerable;module.exports=isArguments; -},{}],33:[function(_dereq_,module,exports){ -function isObjectLike(t){return!!t&&"object"==typeof t}function getNative(t,r){var e=null==t?void 0:t[r];return isNative(e)?e:void 0}function isLength(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=MAX_SAFE_INTEGER}function isFunction(t){return isObject(t)&&objToString.call(t)==funcTag}function isObject(t){var r=typeof t;return!!t&&("object"==r||"function"==r)}function isNative(t){return null!=t&&(isFunction(t)?reIsNative.test(fnToString.call(t)):isObjectLike(t)&&reIsHostCtor.test(t))}var arrayTag="[object Array]",funcTag="[object Function]",reIsHostCtor=/^\[object .+?Constructor\]$/,objectProto=Object.prototype,fnToString=Function.prototype.toString,hasOwnProperty=objectProto.hasOwnProperty,objToString=objectProto.toString,reIsNative=RegExp("^"+fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),nativeIsArray=getNative(Array,"isArray"),MAX_SAFE_INTEGER=9007199254740991,isArray=nativeIsArray||function(t){return isObjectLike(t)&&isLength(t.length)&&objToString.call(t)==arrayTag};module.exports=isArray; -},{}],34:[function(_dereq_,module,exports){ -function isEqual(a,l,i,e){i="function"==typeof i?bindCallback(i,e,3):void 0;var s=i?i(a,l):void 0;return void 0===s?baseIsEqual(a,l,i):!!s}var baseIsEqual=_dereq_("lodash._baseisequal"),bindCallback=_dereq_("lodash._bindcallback");module.exports=isEqual; -},{"lodash._baseisequal":29,"lodash._bindcallback":30}],35:[function(_dereq_,module,exports){ -function isLength(a){return"number"==typeof a&&a>-1&&a%1==0&&a<=MAX_SAFE_INTEGER}function isObjectLike(a){return!!a&&"object"==typeof a}function isTypedArray(a){return isObjectLike(a)&&isLength(a.length)&&!!typedArrayTags[objectToString.call(a)]}var MAX_SAFE_INTEGER=9007199254740991,argsTag="[object Arguments]",arrayTag="[object Array]",boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",funcTag="[object Function]",mapTag="[object Map]",numberTag="[object Number]",objectTag="[object Object]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag="[object String]",weakMapTag="[object WeakMap]",arrayBufferTag="[object ArrayBuffer]",dataViewTag="[object DataView]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]",typedArrayTags={};typedArrayTags[float32Tag]=typedArrayTags[float64Tag]=typedArrayTags[int8Tag]=typedArrayTags[int16Tag]=typedArrayTags[int32Tag]=typedArrayTags[uint8Tag]=typedArrayTags[uint8ClampedTag]=typedArrayTags[uint16Tag]=typedArrayTags[uint32Tag]=!0,typedArrayTags[argsTag]=typedArrayTags[arrayTag]=typedArrayTags[arrayBufferTag]=typedArrayTags[boolTag]=typedArrayTags[dataViewTag]=typedArrayTags[dateTag]=typedArrayTags[errorTag]=typedArrayTags[funcTag]=typedArrayTags[mapTag]=typedArrayTags[numberTag]=typedArrayTags[objectTag]=typedArrayTags[regexpTag]=typedArrayTags[setTag]=typedArrayTags[stringTag]=typedArrayTags[weakMapTag]=!1;var objectProto=Object.prototype,objectToString=objectProto.toString;module.exports=isTypedArray; -},{}],36:[function(_dereq_,module,exports){ -function baseProperty(e){return function(t){return null==t?void 0:t[e]}}function isArrayLike(e){return null!=e&&isLength(getLength(e))}function isIndex(e,t){return e="number"==typeof e||reIsUint.test(e)?+e:-1,t=null==t?MAX_SAFE_INTEGER:t,e>-1&&e%1==0&&e-1&&e%1==0&&e<=MAX_SAFE_INTEGER}function shimKeys(e){for(var t=keysIn(e),r=t.length,n=r&&e.length,s=!!n&&isLength(n)&&(isArray(e)||isArguments(e)),o=-1,i=[];++o0;++n=c:t+u>=q)&&(i.push(l+1),i.push(a),i.push(D))}}return o}function sqDist(s,p,r,t){var u=s-r,h=p-t;return u*u+h*h}module.exports=within; +},{}],30:[function(_dereq_,module,exports){ "use strict";function Pbf(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 readVarintRemainder(t,i,e){var r,s,n=e.buf;if(s=n[e.pos++],r=(112&s)>>4,s<128)return toNum(t,r,i);if(s=n[e.pos++],r|=(127&s)<<3,s<128)return toNum(t,r,i);if(s=n[e.pos++],r|=(127&s)<<10,s<128)return toNum(t,r,i);if(s=n[e.pos++],r|=(127&s)<<17,s<128)return toNum(t,r,i);if(s=n[e.pos++],r|=(127&s)<<24,s<128)return toNum(t,r,i);if(s=n[e.pos++],r|=(1&s)<<31,s<128)return toNum(t,r,i);throw new Error("Expected varint not more than 10 bytes")}function readPackedEnd(t){return t.type===Pbf.Bytes?t.readVarint()+t.pos:t.pos+1}function toNum(t,i,e){return e?4294967296*i+(t>>>0):4294967296*(i>>>0)+(t>>>0)}function writeBigVarint(t,i){var e,r;if(t>=0?(e=t%4294967296|0,r=t/4294967296|0):(e=~(-t%4294967296),r=~(-t/4294967296),4294967295^e?e=e+1|0:(e=0,r=r+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");i.realloc(10),writeBigVarintLow(e,r,i),writeBigVarintHigh(r,i)}function writeBigVarintLow(t,i,e){e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos++]=127&t|128,t>>>=7,e.buf[e.pos]=127&t}function writeBigVarintHigh(t,i){var e=(7&t)<<4;i.buf[i.pos++]|=e|((t>>>=3)?128:0),t&&(i.buf[i.pos++]=127&t|((t>>>=7)?128:0),t&&(i.buf[i.pos++]=127&t|((t>>>=7)?128:0),t&&(i.buf[i.pos++]=127&t|((t>>>=7)?128:0),t&&(i.buf[i.pos++]=127&t|((t>>>=7)?128:0),t&&(i.buf[i.pos++]=127&t)))))}function makeRoomForExtraLength(t,i,e){var r=i<=16383?1:i<=2097151?2:i<=268435455?3:Math.ceil(Math.log(i)/(7*Math.LN2));e.realloc(r);for(var s=e.pos-1;s>=t;s--)e.buf[s+r]=e.buf[s]}function writePackedVarint(t,i){for(var e=0;e>>8,t[e+2]=i>>>16,t[e+3]=i>>>24}function readInt32(t,i){return(t[i]|t[i+1]<<8|t[i+2]<<16)+(t[i+3]<<24)}function readUtf8(t,i,e){for(var r="",s=i;s239?4:n>223?3:n>191?2:1;if(s+a>e)break;var h,u,f;1===a?n<128&&(o=n):2===a?128==(192&(h=t[s+1]))&&(o=(31&n)<<6|63&h)<=127&&(o=null):3===a?(h=t[s+1],u=t[s+2],128==(192&h)&&128==(192&u)&&((o=(15&n)<<12|(63&h)<<6|63&u)<=2047||o>=55296&&o<=57343)&&(o=null)):4===a&&(h=t[s+1],u=t[s+2],f=t[s+3],128==(192&h)&&128==(192&u)&&128==(192&f)&&((o=(15&n)<<18|(63&h)<<12|(63&u)<<6|63&f)<=65535||o>=1114112)&&(o=null)),null===o?(o=65533,a=1):o>65535&&(o-=65536,r+=String.fromCharCode(o>>>10&1023|55296),o=56320|1023&o),r+=String.fromCharCode(o),s+=a}return r}function writeUtf8(t,i,e){for(var r,s,n=0;n55295&&r<57344){if(!s){r>56319||n+1===i.length?(t[e++]=239,t[e++]=191,t[e++]=189):s=r;continue}if(r<56320){t[e++]=239,t[e++]=191,t[e++]=189,s=r;continue}r=s-55296<<10|r-56320|65536,s=null}else s&&(t[e++]=239,t[e++]=191,t[e++]=189,s=null);r<128?t[e++]=r:(r<2048?t[e++]=r>>6|192:(r<65536?t[e++]=r>>12|224:(t[e++]=r>>18|240,t[e++]=r>>12&63|128),t[e++]=r>>6&63|128),t[e++]=63&r|128)}return e}module.exports=Pbf;var ieee754=_dereq_("ieee754");Pbf.Varint=0,Pbf.Fixed64=1,Pbf.Bytes=2,Pbf.Fixed32=5;var SHIFT_LEFT_32=4294967296,SHIFT_RIGHT_32=1/SHIFT_LEFT_32;Pbf.prototype={destroy:function(){this.buf=null},readFields:function(t,i,e){for(e=e||this.length;this.pos>3,n=this.pos;this.type=7&r,t(s,i,this),this.pos===n&&this.skip(r)}return i},readMessage:function(t,i){return this.readFields(t,i,this.readVarint()+this.pos)},readFixed32:function(){var t=readUInt32(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=readInt32(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=readUInt32(this.buf,this.pos)+readUInt32(this.buf,this.pos+4)*SHIFT_LEFT_32;return this.pos+=8,t},readSFixed64:function(){var t=readUInt32(this.buf,this.pos)+readInt32(this.buf,this.pos+4)*SHIFT_LEFT_32;return this.pos+=8,t},readFloat:function(){var t=ieee754.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=ieee754.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var i,e,r=this.buf;return e=r[this.pos++],i=127&e,e<128?i:(e=r[this.pos++],i|=(127&e)<<7,e<128?i:(e=r[this.pos++],i|=(127&e)<<14,e<128?i:(e=r[this.pos++],i|=(127&e)<<21,e<128?i:(e=r[this.pos],i|=(15&e)<<28,readVarintRemainder(i,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,i=readUtf8(this.buf,this.pos,t);return this.pos=t,i},readBytes:function(){var t=this.readVarint()+this.pos,i=this.buf.subarray(this.pos,t);return this.pos=t,i},readPackedVarint:function(t,i){var e=readPackedEnd(this);for(t=t||[];this.pos127;);else if(i===Pbf.Bytes)this.pos=this.readVarint()+this.pos;else if(i===Pbf.Fixed32)this.pos+=4;else{if(i!==Pbf.Fixed64)throw new Error("Unimplemented type: "+i);this.pos+=8}},writeTag:function(t,i){this.writeVarint(t<<3|i)},realloc:function(t){for(var i=this.length||16;i268435455||t<0)return void writeBigVarint(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 i=this.pos;this.pos=writeUtf8(this.buf,t,this.pos);var e=this.pos-i;e>=128&&makeRoomForExtraLength(i,e,this),this.pos=i-1,this.writeVarint(e),this.pos+=e},writeFloat:function(t){this.realloc(4),ieee754.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),ieee754.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var i=t.length;this.writeVarint(i),this.realloc(i);for(var e=0;e=128&&makeRoomForExtraLength(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeMessage:function(t,i,e){this.writeTag(t,Pbf.Bytes),this.writeRawMessage(i,e)},writePackedVarint:function(t,i){this.writeMessage(t,writePackedVarint,i)},writePackedSVarint:function(t,i){this.writeMessage(t,writePackedSVarint,i)},writePackedBoolean:function(t,i){this.writeMessage(t,writePackedBoolean,i)},writePackedFloat:function(t,i){this.writeMessage(t,writePackedFloat,i)},writePackedDouble:function(t,i){this.writeMessage(t,writePackedDouble,i)},writePackedFixed32:function(t,i){this.writeMessage(t,writePackedFixed32,i)},writePackedSFixed32:function(t,i){this.writeMessage(t,writePackedSFixed32,i)},writePackedFixed64:function(t,i){this.writeMessage(t,writePackedFixed64,i)},writePackedSFixed64:function(t,i){this.writeMessage(t,writePackedSFixed64,i)},writeBytesField:function(t,i){this.writeTag(t,Pbf.Bytes),this.writeBytes(i)},writeFixed32Field:function(t,i){this.writeTag(t,Pbf.Fixed32),this.writeFixed32(i)},writeSFixed32Field:function(t,i){this.writeTag(t,Pbf.Fixed32),this.writeSFixed32(i)},writeFixed64Field:function(t,i){this.writeTag(t,Pbf.Fixed64),this.writeFixed64(i)},writeSFixed64Field:function(t,i){this.writeTag(t,Pbf.Fixed64),this.writeSFixed64(i)},writeVarintField:function(t,i){this.writeTag(t,Pbf.Varint),this.writeVarint(i)},writeSVarintField:function(t,i){this.writeTag(t,Pbf.Varint),this.writeSVarint(i)},writeStringField:function(t,i){this.writeTag(t,Pbf.Bytes),this.writeString(i)},writeFloatField:function(t,i){this.writeTag(t,Pbf.Fixed32),this.writeFloat(i)},writeDoubleField:function(t,i){this.writeTag(t,Pbf.Fixed64),this.writeDouble(i)},writeBooleanField:function(t,i){this.writeVarintField(t,Boolean(i))}}; -},{"ieee754":24}],39:[function(_dereq_,module,exports){ -function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(e){if(cachedSetTimeout===setTimeout)return setTimeout(e,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(e,0);try{return cachedSetTimeout(e,0)}catch(t){try{return cachedSetTimeout.call(null,e,0)}catch(t){return cachedSetTimeout.call(this,e,0)}}}function runClearTimeout(e){if(cachedClearTimeout===clearTimeout)return clearTimeout(e);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(e);try{return cachedClearTimeout(e)}catch(t){try{return cachedClearTimeout.call(null,e)}catch(t){return cachedClearTimeout.call(this,e)}}}function cleanUpNextTick(){draining&¤tQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var e=runTimeout(cleanUpNextTick);draining=!0;for(var t=queue.length;t;){for(currentQueue=queue,queue=[];++queueIndex1)for(var r=1;rr;){if(o-r>600){var f=o-r+1,e=t-r+1,l=Math.log(f),s=.5*Math.exp(2*l/3),i=.5*Math.sqrt(l*s*(f-s)/f)*(e-f/2<0?-1:1);partialSort(a,t,Math.max(r,Math.floor(t-e*s/f+i)),Math.min(o,Math.floor(t+(f-e)*s/f+i)),p)}var n=a[t],h=r,u=o;for(swap(a,r,t),p(a[o],n)>0&&swap(a,r,o);h0;)u--}0===p(a[r],n)?swap(a,r,u):(u++,swap(a,u,o)),u<=t&&(r=u+1),t<=u&&(o=u-1)}}function swap(a,t,r){var o=a[t];a[t]=a[r],a[r]=o}function defaultCompare(a,t){return at?1:0}module.exports=partialSort; -},{}],41:[function(_dereq_,module,exports){ +},{}],32:[function(_dereq_,module,exports){ "use strict";function supercluster(t){return new SuperCluster(t)}function SuperCluster(t){this.options=extend(Object.create(this.options),t),this.trees=new Array(this.options.maxZoom+1)}function createCluster(t,e,n,o,i){return{x:t,y:e,zoom:1/0,id:o,properties:i,parentId:-1,numPoints:n}}function createPointCluster(t,e){var n=t.geometry.coordinates;return{x:lngX(n[0]),y:latY(n[1]),zoom:1/0,id:e,parentId:-1}}function getClusterJSON(t){return{type:"Feature",properties:getClusterProperties(t),geometry:{type:"Point",coordinates:[xLng(t.x),yLat(t.y)]}}}function getClusterProperties(t){var e=t.numPoints,n=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return extend(extend({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:n})}function lngX(t){return t/360+.5}function latY(t){var e=Math.sin(t*Math.PI/180),n=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return n<0?0:n>1?1:n}function xLng(t){return 360*(t-.5)}function yLat(t){var e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function extend(t,e){for(var n in e)t[n]=e[n];return t}function getX(t){return t.x}function getY(t){return t.y}var kdbush=_dereq_("kdbush");module.exports=supercluster,SuperCluster.prototype={options:{minZoom:0,maxZoom:16,radius:40,extent:512,nodeSize:64,log:!1,reduce:null,initial:function(){return{}},map:function(t){return t}},load:function(t){var e=this.options.log;e&&console.time("total time");var n="prepare "+t.length+" points";e&&console.time(n),this.points=t;var o=t.map(createPointCluster);e&&console.timeEnd(n);for(var i=this.options.maxZoom;i>=this.options.minZoom;i--){var r=+Date.now();this.trees[i+1]=kdbush(o,getX,getY,this.options.nodeSize,Float32Array),o=this._cluster(o,i),e&&console.log("z%d: %d clusters in %dms",i,o.length,+Date.now()-r)}return this.trees[this.options.minZoom]=kdbush(o,getX,getY,this.options.nodeSize,Float32Array),e&&console.timeEnd("total time"),this},getClusters:function(t,e){for(var n=this.trees[this._limitZoom(e)],o=n.range(lngX(t[0]),latY(t[3]),lngX(t[2]),latY(t[1])),i=[],r=0;r0)for(var e=this.length>>1;e>=0;e--)this._down(e)}function defaultCompare(t,i){return ti?1:0}module.exports=TinyQueue,TinyQueue.prototype={push:function(t){this.data.push(t),this.length++,this._up(this.length-1)},pop:function(){if(0!==this.length){var t=this.data[0];return this.length--,this.length>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 i=this.data,e=this.compare,h=i[t];t>0;){var n=t-1>>1,a=i[n];if(e(h,a)>=0)break;i[t]=a,t=n}i[t]=h},_down:function(t){for(var i=this.data,e=this.compare,h=this.length,n=h>>1,a=i[t];t=0)break;i[t]=r,t=s}i[t]=a}}; -},{}],43:[function(_dereq_,module,exports){ -"function"==typeof Object.create?module.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:module.exports=function(t,e){t.super_=e;var o=function(){};o.prototype=e.prototype,t.prototype=new o,t.prototype.constructor=t}; -},{}],44:[function(_dereq_,module,exports){ -module.exports=function(o){return o&&"object"==typeof o&&"function"==typeof o.copy&&"function"==typeof o.fill&&"function"==typeof o.readUInt8}; -},{}],45:[function(_dereq_,module,exports){ -(function (process,global){ -function inspect(e,r){var t={seen:[],stylize:stylizeNoColor};return arguments.length>=3&&(t.depth=arguments[2]),arguments.length>=4&&(t.colors=arguments[3]),isBoolean(r)?t.showHidden=r:r&&exports._extend(t,r),isUndefined(t.showHidden)&&(t.showHidden=!1),isUndefined(t.depth)&&(t.depth=2),isUndefined(t.colors)&&(t.colors=!1),isUndefined(t.customInspect)&&(t.customInspect=!0),t.colors&&(t.stylize=stylizeWithColor),formatValue(t,e,t.depth)}function stylizeWithColor(e,r){var t=inspect.styles[r];return t?"["+inspect.colors[t][0]+"m"+e+"["+inspect.colors[t][1]+"m":e}function stylizeNoColor(e,r){return e}function arrayToHash(e){var r={};return e.forEach(function(e,t){r[e]=!0}),r}function formatValue(e,r,t){if(e.customInspect&&r&&isFunction(r.inspect)&&r.inspect!==exports.inspect&&(!r.constructor||r.constructor.prototype!==r)){var n=r.inspect(t,e);return isString(n)||(n=formatValue(e,n,t)),n}var i=formatPrimitive(e,r);if(i)return i;var o=Object.keys(r),s=arrayToHash(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(r)),isError(r)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return formatError(r);if(0===o.length){if(isFunction(r)){var u=r.name?": "+r.name:"";return e.stylize("[Function"+u+"]","special")}if(isRegExp(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(isDate(r))return e.stylize(Date.prototype.toString.call(r),"date");if(isError(r))return formatError(r)}var c="",a=!1,l=["{","}"];if(isArray(r)&&(a=!0,l=["[","]"]),isFunction(r)){c=" [Function"+(r.name?": "+r.name:"")+"]"}if(isRegExp(r)&&(c=" "+RegExp.prototype.toString.call(r)),isDate(r)&&(c=" "+Date.prototype.toUTCString.call(r)),isError(r)&&(c=" "+formatError(r)),0===o.length&&(!a||0==r.length))return l[0]+c+l[1];if(t<0)return isRegExp(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special");e.seen.push(r);var p;return p=a?formatArray(e,r,t,s,o):o.map(function(n){return formatProperty(e,r,t,s,n,a)}),e.seen.pop(),reduceToSingleString(p,c,l)}function formatPrimitive(e,r){if(isUndefined(r))return e.stylize("undefined","undefined");if(isString(r)){var t="'"+JSON.stringify(r).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(t,"string")}return isNumber(r)?e.stylize(""+r,"number"):isBoolean(r)?e.stylize(""+r,"boolean"):isNull(r)?e.stylize("null","null"):void 0}function formatError(e){return"["+Error.prototype.toString.call(e)+"]"}function formatArray(e,r,t,n,i){for(var o=[],s=0,u=r.length;s-1&&(u=o?u.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+u.split("\n").map(function(e){return" "+e}).join("\n"))):u=e.stylize("[Circular]","special")),isUndefined(s)){if(o&&i.match(/^\d+$/))return u;s=JSON.stringify(""+i),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+u}function reduceToSingleString(e,r,t){var n=0;return e.reduce(function(e,r){return n++,r.indexOf("\n")>=0&&n++,e+r.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?t[0]+(""===r?"":r+"\n ")+" "+e.join(",\n ")+" "+t[1]:t[0]+r+" "+e.join(", ")+" "+t[1]}function isArray(e){return Array.isArray(e)}function isBoolean(e){return"boolean"==typeof e}function isNull(e){return null===e}function isNullOrUndefined(e){return null==e}function isNumber(e){return"number"==typeof e}function isString(e){return"string"==typeof e}function isSymbol(e){return"symbol"==typeof e}function isUndefined(e){return void 0===e}function isRegExp(e){return isObject(e)&&"[object RegExp]"===objectToString(e)}function isObject(e){return"object"==typeof e&&null!==e}function isDate(e){return isObject(e)&&"[object Date]"===objectToString(e)}function isError(e){return isObject(e)&&("[object Error]"===objectToString(e)||e instanceof Error)}function isFunction(e){return"function"==typeof e}function isPrimitive(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function objectToString(e){return Object.prototype.toString.call(e)}function pad(e){return e<10?"0"+e.toString(10):e.toString(10)}function timestamp(){var e=new Date,r=[pad(e.getHours()),pad(e.getMinutes()),pad(e.getSeconds())].join(":");return[e.getDate(),months[e.getMonth()],r].join(" ")}function hasOwnProperty(e,r){return Object.prototype.hasOwnProperty.call(e,r)}var formatRegExp=/%[sdj%]/g;exports.format=function(e){if(!isString(e)){for(var r=[],t=0;t=i)return e;switch(e){case"%s":return String(n[t++]);case"%d":return Number(n[t++]);case"%j":try{return JSON.stringify(n[t++])}catch(e){return"[Circular]"}default:return e}}),s=n[t];t>31}function writeGeometry(e,r){for(var t=e.loadGeometry(),i=e.type,a=0,o=0,n=t.length,l=0;l=EXTENT||c<0||c>=EXTENT)){var l=t.segments.prepareSegment(4,t.layoutVertexArray,t.indexArray),p=l.vertexLength;addCircleVertex(t.layoutVertexArray,s,c,-1,-1),addCircleVertex(t.layoutVertexArray,s,c,1,-1),addCircleVertex(t.layoutVertexArray,s,c,1,1),addCircleVertex(t.layoutVertexArray,s,c,-1,1),t.indexArray.emplaceBack(p,p+1,p+2),t.indexArray.emplaceBack(p,p+3,p+2),l.vertexLength+=4,l.primitiveLength+=2}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e)},CircleBucket.programInterface=circleInterface,module.exports=CircleBucket; -},{"../../gl/index_buffer":71,"../../gl/vertex_buffer":72,"../extent":58,"../index_array_type":60,"../load_geometry":61,"../program_configuration":63,"../segment":65,"../vertex_array_type":66}],53:[function(_dereq_,module,exports){ -"use strict";var ref=_dereq_("../segment"),SegmentVector=ref.SegmentVector,VertexBuffer=_dereq_("../../gl/vertex_buffer"),IndexBuffer=_dereq_("../../gl/index_buffer"),ref$1=_dereq_("../program_configuration"),ProgramConfigurationSet=ref$1.ProgramConfigurationSet,createVertexArrayType=_dereq_("../vertex_array_type"),ref$2=_dereq_("../index_array_type"),LineIndexArray=ref$2.LineIndexArray,TriangleIndexArray=ref$2.TriangleIndexArray,loadGeometry=_dereq_("../load_geometry"),earcut=_dereq_("earcut"),classifyRings=_dereq_("../../util/classify_rings"),EARCUT_MAX_RINGS=500,fillInterface={layoutAttributes:[{name:"a_pos",components:2,type:"Int16"}],indexArrayType:TriangleIndexArray,indexArrayType2:LineIndexArray,paintAttributes:[{property:"fill-color"},{property:"fill-outline-color"},{property:"fill-opacity"}]},LayoutVertexArrayType=createVertexArrayType(fillInterface.layoutAttributes),FillBucket=function(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.index=e.index,this.layoutVertexArray=new LayoutVertexArrayType(e.layoutVertexArray),this.indexArray=new TriangleIndexArray(e.indexArray),this.indexArray2=new LineIndexArray(e.indexArray2),this.programConfigurations=new ProgramConfigurationSet(fillInterface,e.layers,e.zoom,e.programConfigurations),this.segments=new SegmentVector(e.segments),this.segments2=new SegmentVector(e.segments2)};FillBucket.prototype.populate=function(e,r){for(var t=this,i=0,a=e;iEXTENT)||e.y===r.y&&(e.y<0||e.y>EXTENT)}var ref=_dereq_("../segment"),SegmentVector=ref.SegmentVector,MAX_VERTEX_ARRAY_LENGTH=ref.MAX_VERTEX_ARRAY_LENGTH,VertexBuffer=_dereq_("../../gl/vertex_buffer"),IndexBuffer=_dereq_("../../gl/index_buffer"),ref$1=_dereq_("../program_configuration"),ProgramConfigurationSet=ref$1.ProgramConfigurationSet,createVertexArrayType=_dereq_("../vertex_array_type"),ref$2=_dereq_("../index_array_type"),TriangleIndexArray=ref$2.TriangleIndexArray,loadGeometry=_dereq_("../load_geometry"),EXTENT=_dereq_("../extent"),earcut=_dereq_("earcut"),classifyRings=_dereq_("../../util/classify_rings"),EARCUT_MAX_RINGS=500,fillExtrusionInterface={layoutAttributes:[{name:"a_pos",components:2,type:"Int16"},{name:"a_normal",components:3,type:"Int16"},{name:"a_edgedistance",components:1,type:"Int16"}],indexArrayType:TriangleIndexArray,paintAttributes:[{property:"fill-extrusion-base"},{property:"fill-extrusion-height"},{property:"fill-extrusion-color"}]},FACTOR=Math.pow(2,13),LayoutVertexArrayType=createVertexArrayType(fillExtrusionInterface.layoutAttributes),FillExtrusionBucket=function(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.index=e.index,this.layoutVertexArray=new LayoutVertexArrayType(e.layoutVertexArray),this.indexArray=new TriangleIndexArray(e.indexArray),this.programConfigurations=new ProgramConfigurationSet(fillExtrusionInterface,e.layers,e.zoom,e.programConfigurations),this.segments=new SegmentVector(e.segments)};FillExtrusionBucket.prototype.populate=function(e,r){for(var t=this,a=0,i=e;a=1){var h=f[p-1];if(!isBoundaryEdge(d,h)){y.vertexLength+4>MAX_VERTEX_ARRAY_LENGTH&&(y=t.segments.prepareSegment(4,t.layoutVertexArray,t.indexArray));var A=d.sub(h)._perp()._unit();addVertex(t.layoutVertexArray,d.x,d.y,A.x,A.y,0,0,g),addVertex(t.layoutVertexArray,d.x,d.y,A.x,A.y,0,1,g),g+=h.dist(d),addVertex(t.layoutVertexArray,h.x,h.y,A.x,A.y,0,0,g),addVertex(t.layoutVertexArray,h.x,h.y,A.x,A.y,0,1,g);var c=y.vertexLength;t.indexArray.emplaceBack(c,c+1,c+2),t.indexArray.emplaceBack(c+1,c+2,c+3),y.vertexLength+=4,y.primitiveLength+=2}}}}y.vertexLength+o>MAX_VERTEX_ARRAY_LENGTH&&(y=t.segments.prepareSegment(o,t.layoutVertexArray,t.indexArray));for(var m=[],V=[],E=y.vertexLength,_=0,v=n;_>6)}var ref=_dereq_("../segment"),SegmentVector=ref.SegmentVector,VertexBuffer=_dereq_("../../gl/vertex_buffer"),IndexBuffer=_dereq_("../../gl/index_buffer"),ref$1=_dereq_("../program_configuration"),ProgramConfigurationSet=ref$1.ProgramConfigurationSet,createVertexArrayType=_dereq_("../vertex_array_type"),ref$2=_dereq_("../index_array_type"),TriangleIndexArray=ref$2.TriangleIndexArray,loadGeometry=_dereq_("../load_geometry"),EXTENT=_dereq_("../extent"),vectorTileFeatureTypes=_dereq_("@mapbox/vector-tile").VectorTileFeature.types,EXTRUDE_SCALE=63,COS_HALF_SHARP_CORNER=Math.cos(Math.PI/180*37.5),SHARP_CORNER_OFFSET=15,LINE_DISTANCE_BUFFER_BITS=15,LINE_DISTANCE_SCALE=.5,MAX_LINE_DISTANCE=Math.pow(2,LINE_DISTANCE_BUFFER_BITS-1)/LINE_DISTANCE_SCALE,lineInterface={layoutAttributes:[{name:"a_pos_normal",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],paintAttributes:[{property:"line-color"},{property:"line-blur"},{property:"line-opacity"},{property:"line-gap-width",name:"gapwidth"},{property:"line-offset"},{property:"line-width"},{property:"line-width",name:"floorwidth",useIntegerZoom:!0}],indexArrayType:TriangleIndexArray},LayoutVertexArrayType=createVertexArrayType(lineInterface.layoutAttributes),LineBucket=function(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.index=e.index,this.layoutVertexArray=new LayoutVertexArrayType(e.layoutVertexArray),this.indexArray=new TriangleIndexArray(e.indexArray),this.programConfigurations=new ProgramConfigurationSet(lineInterface,e.layers,e.zoom,e.programConfigurations),this.segments=new SegmentVector(e.segments)};LineBucket.prototype.populate=function(e,t){for(var r=this,i=0,a=e;i=2&&e[u-1].equals(e[u-2]);)u--;for(var d=0;dd){var T=p.dist(_);if(T>2*l){var B=p.sub(p.sub(_)._mult(l/T)._round());s.distance+=B.dist(_),s.addCurrentVertex(B,s.distance,v.mult(1),0,0,!1,h),_=B}}var b=_&&A,N=b?r:A?x:m;if(b&&"round"===N&&(Sa&&(N="bevel"),"bevel"===N&&(S>2&&(N="flipbevel"),S100)L=V.clone().mult(-1);else{var k=v.x*V.y-v.y*V.x>0?-1:1,R=S*v.add(V).mag()/v.sub(V).mag();L._perp()._mult(R*k)}s.addCurrentVertex(p,s.distance,L,0,0,!1,h),s.addCurrentVertex(p,s.distance,L.mult(-1),0,0,!1,h)}else if("bevel"===N||"fakeround"===N){var F=v.x*V.y-v.y*V.x>0,q=-Math.sqrt(S*S-1);if(F?(f=0,c=q):(c=0,f=q),g||s.addCurrentVertex(p,s.distance,v,c,f,!1,h),"fakeround"===N){for(var P=Math.floor(8*(.5-(E-.5))),z=void 0,w=0;w=0;D--)z=v.mult((D+1)/(P+1))._add(V)._unit(),s.addPieSliceVertex(p,s.distance,z,F,h)}A&&s.addCurrentVertex(p,s.distance,V,-c,-f,!1,h)}else"butt"===N?(g||s.addCurrentVertex(p,s.distance,v,0,0,!1,h),A&&s.addCurrentVertex(p,s.distance,V,0,0,!1,h)):"square"===N?(g||(s.addCurrentVertex(p,s.distance,v,1,1,!1,h),s.e1=s.e2=-1),A&&s.addCurrentVertex(p,s.distance,V,-1,-1,!1,h)):"round"===N&&(g||(s.addCurrentVertex(p,s.distance,v,0,0,!1,h),s.addCurrentVertex(p,s.distance,v,1,1,!0,h),s.e1=s.e2=-1),A&&(s.addCurrentVertex(p,s.distance,V,-1,-1,!0,h),s.addCurrentVertex(p,s.distance,V,0,0,!1,h)));if(I&&C2*l){var O=p.add(A.sub(p)._mult(l/M)._round());s.distance+=O.dist(p),s.addCurrentVertex(O,s.distance,V.mult(1),0,0,!1,h),p=O}}g=!1}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t)}},LineBucket.prototype.addCurrentVertex=function(e,t,r,i,a,n,s){var o,u=this.layoutVertexArray,d=this.indexArray;o=r.clone(),i&&o._sub(r.perp()._mult(i)),addLineVertex(u,e,o,n,!1,i,t),this.e3=s.vertexLength++,this.e1>=0&&this.e2>=0&&(d.emplaceBack(this.e1,this.e2,this.e3),s.primitiveLength++),this.e1=this.e2,this.e2=this.e3,o=r.mult(-1),a&&o._sub(r.perp()._mult(a)),addLineVertex(u,e,o,n,!0,-a,t),this.e3=s.vertexLength++,this.e1>=0&&this.e2>=0&&(d.emplaceBack(this.e1,this.e2,this.e3),s.primitiveLength++),this.e1=this.e2,this.e2=this.e3,t>MAX_LINE_DISTANCE/2&&(this.distance=0,this.addCurrentVertex(e,this.distance,r,i,a,n,s))},LineBucket.prototype.addPieSliceVertex=function(e,t,r,i,a){r=r.mult(i?-1:1);var n=this.layoutVertexArray,s=this.indexArray;addLineVertex(n,e,r,!1,i,0,t),this.e3=a.vertexLength++,this.e1>=0&&this.e2>=0&&(s.emplaceBack(this.e1,this.e2,this.e3),a.primitiveLength++),i?this.e2=this.e3:this.e1=this.e3},LineBucket.programInterface=lineInterface,module.exports=LineBucket; -},{"../../gl/index_buffer":71,"../../gl/vertex_buffer":72,"../extent":58,"../index_array_type":60,"../load_geometry":61,"../program_configuration":63,"../segment":65,"../vertex_array_type":66,"@mapbox/vector-tile":6}],57:[function(_dereq_,module,exports){ -"use strict";function addVertex(e,t,o,r,a,i,n,l){e.emplaceBack(t,o,Math.round(64*r),Math.round(64*a),i,n,l?l[0]:void 0,l?l[1]:void 0)}function addDynamicAttributes(e,t,o,r){var a=2*Math.PI,i=packUint8ToFloat((o+a)%a/a*255,10*r);e.emplaceBack(t.x,t.y,i),e.emplaceBack(t.x,t.y,i),e.emplaceBack(t.x,t.y,i),e.emplaceBack(t.x,t.y,i)}function addCollisionBoxVertex(e,t,o,r,a,i){return e.emplaceBack(t.x,t.y,o.x,o.y,Math.round(r.x),Math.round(r.y),10*a,10*i)}function getSizeVertexData(e,t,o,r,a){if("source"===o.functionType)return[10*e.getLayoutValue(r,{},a)];if("composite"===o.functionType){var i=o.coveringZoomRange;return[10*e.getLayoutValue(r,{zoom:i[0]},a),10*e.getLayoutValue(r,{zoom:i[1]},a)]}return null}var Point=_dereq_("@mapbox/point-geometry"),ref=_dereq_("../segment"),SegmentVector=ref.SegmentVector,VertexBuffer=_dereq_("../../gl/vertex_buffer"),IndexBuffer=_dereq_("../../gl/index_buffer"),ref$1=_dereq_("../program_configuration"),ProgramConfigurationSet=ref$1.ProgramConfigurationSet,createVertexArrayType=_dereq_("../vertex_array_type"),ref$2=_dereq_("../index_array_type"),TriangleIndexArray=ref$2.TriangleIndexArray,LineIndexArray=ref$2.LineIndexArray,EXTENT=_dereq_("../extent"),ref$3=_dereq_("../../shaders/encode_attribute"),packUint8ToFloat=ref$3.packUint8ToFloat,Anchor=_dereq_("../../symbol/anchor"),getAnchors=_dereq_("../../symbol/get_anchors"),resolveTokens=_dereq_("../../util/token"),ref$4=_dereq_("../../symbol/quads"),getGlyphQuads=ref$4.getGlyphQuads,getIconQuads=ref$4.getIconQuads,ref$5=_dereq_("../../symbol/shaping"),shapeText=ref$5.shapeText,shapeIcon=ref$5.shapeIcon,WritingMode=ref$5.WritingMode,transformText=_dereq_("../../symbol/transform_text"),mergeLines=_dereq_("../../symbol/mergelines"),clipLine=_dereq_("../../symbol/clip_line"),util=_dereq_("../../util/util"),scriptDetection=_dereq_("../../util/script_detection"),loadGeometry=_dereq_("../load_geometry"),CollisionFeature=_dereq_("../../symbol/collision_feature"),findPoleOfInaccessibility=_dereq_("../../util/find_pole_of_inaccessibility"),classifyRings=_dereq_("../../util/classify_rings"),vectorTileFeatureTypes=_dereq_("@mapbox/vector-tile").VectorTileFeature.types,createStructArrayType=_dereq_("../../util/struct_array"),verticalizePunctuation=_dereq_("../../util/verticalize_punctuation"),ref$6=_dereq_("../../symbol/symbol_size"),getSizeData=ref$6.getSizeData,PlacedSymbolArray=createStructArrayType({members:[{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{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:"Float32",name:"placementZoom"},{type:"Uint8",name:"vertical"}]}),GlyphOffsetArray=createStructArrayType({members:[{type:"Float32",name:"offsetX"}]}),LineVertexArray=createStructArrayType({members:[{type:"Int16",name:"x"},{type:"Int16",name:"y"}]}),layoutAttributes=[{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"}],dynamicLayoutAttributes=[{name:"a_projected_pos",components:3,type:"Float32"}],symbolInterfaces={text:{layoutAttributes:layoutAttributes,dynamicLayoutAttributes:dynamicLayoutAttributes,indexArrayType:TriangleIndexArray,paintAttributes:[{property:"text-color",name:"fill_color"},{property:"text-halo-color",name:"halo_color"},{property:"text-halo-width",name:"halo_width"},{property:"text-halo-blur",name:"halo_blur"},{property:"text-opacity",name:"opacity"}]},icon:{layoutAttributes:layoutAttributes,dynamicLayoutAttributes:dynamicLayoutAttributes,indexArrayType:TriangleIndexArray,paintAttributes:[{property:"icon-color",name:"fill_color"},{property:"icon-halo-color",name:"halo_color"},{property:"icon-halo-width",name:"halo_width"},{property:"icon-halo-blur",name:"halo_blur"},{property:"icon-opacity",name:"opacity"}]},collisionBox:{layoutAttributes:[{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"},{name:"a_data",components:2,type:"Uint8"}],indexArrayType:LineIndexArray}},SymbolBuffers=function(e,t,o,r){this.programInterface=e;var a=createVertexArrayType(e.layoutAttributes),i=e.indexArrayType;if(this.layoutVertexArray=new a(r&&r.layoutVertexArray),this.indexArray=new i(r&&r.indexArray),this.programConfigurations=new ProgramConfigurationSet(e,t,o,r&&r.programConfigurations),this.segments=new SegmentVector(r&&r.segments),e.dynamicLayoutAttributes){var n=createVertexArrayType(e.dynamicLayoutAttributes);this.dynamicLayoutVertexArray=new n(r&&r.dynamicLayoutVertexArray)}};SymbolBuffers.prototype.serialize=function(e){return{layoutVertexArray:this.layoutVertexArray.serialize(e),indexArray:this.indexArray.serialize(e),programConfigurations:this.programConfigurations.serialize(e),segments:this.segments.get(),dynamicLayoutVertexArray:this.dynamicLayoutVertexArray&&this.dynamicLayoutVertexArray.serialize(e)}},SymbolBuffers.prototype.upload=function(e){this.layoutVertexBuffer=new VertexBuffer(e,this.layoutVertexArray),this.indexBuffer=new IndexBuffer(e,this.indexArray),this.programConfigurations.upload(e),this.programInterface.dynamicLayoutAttributes&&(this.dynamicLayoutVertexBuffer=new VertexBuffer(e,this.dynamicLayoutVertexArray,!0))},SymbolBuffers.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer&&this.dynamicLayoutVertexBuffer.destroy())};var SymbolBucket=function(e){if(this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.index=e.index,this.sdfIcons=e.sdfIcons,this.iconsNeedLinear=e.iconsNeedLinear,this.pixelRatio=e.pixelRatio,e.text)this.text=new SymbolBuffers(symbolInterfaces.text,e.layers,e.zoom,e.text),this.icon=new SymbolBuffers(symbolInterfaces.icon,e.layers,e.zoom,e.icon),this.collisionBox=new SymbolBuffers(symbolInterfaces.collisionBox,e.layers,e.zoom,e.collisionBox),this.textSizeData=e.textSizeData,this.iconSizeData=e.iconSizeData,this.placedGlyphArray=new PlacedSymbolArray(e.placedGlyphArray),this.placedIconArray=new PlacedSymbolArray(e.placedIconArray),this.glyphOffsetArray=new GlyphOffsetArray(e.glyphOffsetArray),this.lineVertexArray=new LineVertexArray(e.lineVertexArray);else{var t=this.layers[0];this.textSizeData=getSizeData(this.zoom,t,"text-size"),this.iconSizeData=getSizeData(this.zoom,t,"icon-size")}};SymbolBucket.prototype.populate=function(e,t){var o=this,r=this.layers[0],a=r.layout,i=a["text-font"],n=(!r.isLayoutValueFeatureConstant("text-field")||a["text-field"])&&i,l=!r.isLayoutValueFeatureConstant("icon-image")||a["icon-image"];if(this.features=[],n||l){for(var s=t.iconDependencies,y=t.glyphDependencies,c=y[i]=y[i]||{},u={zoom:this.zoom},x=0,m=e;xEXTENT||n.y<0||n.y>EXTENT);if(!d||y){var c=y||I;a.addSymbolInstance(n,i,t,o,a.layers[0],c,a.collisionBoxArray,e.index,e.sourceLayerIndex,a.index,x,f,A,l,p,g,v,s,{zoom:a.zoom},e,r)}};if("line"===S)for(var V=0,L=clipLine(e.geometry,0,0,EXTENT,EXTENT);V=0;i--)if(o.dist(a[i])1*Math.PI/4&&v<=3*Math.PI/4||v>5*Math.PI/4&&v<=7*Math.PI/4,S=Boolean(y&WritingMode.vertical)&&I,B=0,z=t;BSymbolBucket.MAX_INSTANCES&&util.warnOnce("Too many symbols being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),M>SymbolBucket.MAX_INSTANCES&&util.warnOnce("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907");var _=(o[WritingMode.vertical]?WritingMode.vertical:0)|(o[WritingMode.horizontal]?WritingMode.horizontal:0);this.symbolInstances.push({textBoxStartIndex:L,textBoxEndIndex:T,iconBoxStartIndex:w,iconBoxEndIndex:M,glyphQuads:B,iconQuads:S,textOffset:m,iconOffset:f,anchor:e,line:t,featureIndex:l,feature:b,writingModes:_})},SymbolBucket.programInterfaces=symbolInterfaces,SymbolBucket.MAX_INSTANCES=65535,SymbolBucket.addDynamicAttributes=addDynamicAttributes,module.exports=SymbolBucket; -},{"../../gl/index_buffer":71,"../../gl/vertex_buffer":72,"../../shaders/encode_attribute":97,"../../symbol/anchor":196,"../../symbol/clip_line":198,"../../symbol/collision_feature":200,"../../symbol/get_anchors":202,"../../symbol/mergelines":203,"../../symbol/quads":205,"../../symbol/shaping":206,"../../symbol/symbol_size":207,"../../symbol/transform_text":208,"../../util/classify_rings":234,"../../util/find_pole_of_inaccessibility":240,"../../util/script_detection":247,"../../util/struct_array":249,"../../util/token":251,"../../util/util":252,"../../util/verticalize_punctuation":254,"../extent":58,"../index_array_type":60,"../load_geometry":61,"../program_configuration":63,"../segment":65,"../vertex_array_type":66,"@mapbox/point-geometry":2,"@mapbox/vector-tile":6}],58:[function(_dereq_,module,exports){ +},{}],38:[function(_dereq_,module,exports){ +module.exports={"version":"0.44.1"} +},{}],39:[function(_dereq_,module,exports){ +"use strict";var ref=_dereq_("../util/struct_array"),StructArray=ref.StructArray,ref$1=_dereq_("../util/struct_array"),Struct=ref$1.Struct,ref$2=_dereq_("../util/web_worker_transfer"),register=ref$2.register,Point=_dereq_("@mapbox/point-geometry"),StructArrayLayout2i4=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},r.prototype.emplaceBack=function(t,r){var i=this.length;this.resize(i+1);var e=2*i;return this.int16[e+0]=t,this.int16[e+1]=r,i},r}(StructArray);StructArrayLayout2i4.prototype.bytesPerElement=4,register("StructArrayLayout2i4",StructArrayLayout2i4);var StructArrayLayout4i8=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},r.prototype.emplaceBack=function(t,r,i,e){var o=this.length;this.resize(o+1);var u=4*o;return this.int16[u+0]=t,this.int16[u+1]=r,this.int16[u+2]=i,this.int16[u+3]=e,o},r}(StructArray);StructArrayLayout4i8.prototype.bytesPerElement=8,register("StructArrayLayout4i8",StructArrayLayout4i8);var StructArrayLayout2i4i12=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},r.prototype.emplaceBack=function(t,r,i,e,o,u){var n=this.length;this.resize(n+1);var a=6*n;return this.int16[a+0]=t,this.int16[a+1]=r,this.int16[a+2]=i,this.int16[a+3]=e,this.int16[a+4]=o,this.int16[a+5]=u,n},r}(StructArray);StructArrayLayout2i4i12.prototype.bytesPerElement=12,register("StructArrayLayout2i4i12",StructArrayLayout2i4i12);var StructArrayLayout4i4ub12=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},r.prototype.emplaceBack=function(t,r,i,e,o,u,n,a){var y=this.length;this.resize(y+1);var s=6*y,c=12*y;return this.int16[s+0]=t,this.int16[s+1]=r,this.int16[s+2]=i,this.int16[s+3]=e,this.uint8[c+8]=o,this.uint8[c+9]=u,this.uint8[c+10]=n,this.uint8[c+11]=a,y},r}(StructArray);StructArrayLayout4i4ub12.prototype.bytesPerElement=12,register("StructArrayLayout4i4ub12",StructArrayLayout4i4ub12);var StructArrayLayout4i4ui16=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},r.prototype.emplaceBack=function(t,r,i,e,o,u,n,a){var y=this.length;this.resize(y+1);var s=8*y;return this.int16[s+0]=t,this.int16[s+1]=r,this.int16[s+2]=i,this.int16[s+3]=e,this.uint16[s+4]=o,this.uint16[s+5]=u,this.uint16[s+6]=n,this.uint16[s+7]=a,y},r}(StructArray);StructArrayLayout4i4ui16.prototype.bytesPerElement=16,register("StructArrayLayout4i4ui16",StructArrayLayout4i4ui16);var StructArrayLayout3f12=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},r.prototype.emplaceBack=function(t,r,i){var e=this.length;this.resize(e+1);var o=3*e;return this.float32[o+0]=t,this.float32[o+1]=r,this.float32[o+2]=i,e},r}(StructArray);StructArrayLayout3f12.prototype.bytesPerElement=12,register("StructArrayLayout3f12",StructArrayLayout3f12);var StructArrayLayout1ul4=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)},r.prototype.emplaceBack=function(t){var r=this.length;this.resize(r+1);var i=1*r;return this.uint32[i+0]=t,r},r}(StructArray);StructArrayLayout1ul4.prototype.bytesPerElement=4,register("StructArrayLayout1ul4",StructArrayLayout1ul4);var StructArrayLayout6i1ul2ui2i24=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.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)},r.prototype.emplaceBack=function(t,r,i,e,o,u,n,a,y,s,c){var p=this.length;this.resize(p+1);var h=12*p,f=6*p;return this.int16[h+0]=t,this.int16[h+1]=r,this.int16[h+2]=i,this.int16[h+3]=e,this.int16[h+4]=o,this.int16[h+5]=u,this.uint32[f+3]=n,this.uint16[h+8]=a,this.uint16[h+9]=y,this.int16[h+10]=s,this.int16[h+11]=c,p},r}(StructArray);StructArrayLayout6i1ul2ui2i24.prototype.bytesPerElement=24,register("StructArrayLayout6i1ul2ui2i24",StructArrayLayout6i1ul2ui2i24);var StructArrayLayout2i2i2i12=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},r.prototype.emplaceBack=function(t,r,i,e,o,u){var n=this.length;this.resize(n+1);var a=6*n;return this.int16[a+0]=t,this.int16[a+1]=r,this.int16[a+2]=i,this.int16[a+3]=e,this.int16[a+4]=o,this.int16[a+5]=u,n},r}(StructArray);StructArrayLayout2i2i2i12.prototype.bytesPerElement=12,register("StructArrayLayout2i2i2i12",StructArrayLayout2i2i2i12);var StructArrayLayout2ub4=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer)},r.prototype.emplaceBack=function(t,r){var i=this.length;this.resize(i+1);var e=4*i;return this.uint8[e+0]=t,this.uint8[e+1]=r,i},r}(StructArray);StructArrayLayout2ub4.prototype.bytesPerElement=4,register("StructArrayLayout2ub4",StructArrayLayout2ub4);var StructArrayLayout2i2ui3ul3ui2f2ub40=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.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)},r.prototype.emplaceBack=function(t,r,i,e,o,u,n,a,y,s,c,p,h,f){var A=this.length;this.resize(A+1);var _=20*A,l=10*A,S=40*A;return this.int16[_+0]=t,this.int16[_+1]=r,this.uint16[_+2]=i,this.uint16[_+3]=e,this.uint32[l+2]=o,this.uint32[l+3]=u,this.uint32[l+4]=n,this.uint16[_+10]=a,this.uint16[_+11]=y,this.uint16[_+12]=s,this.float32[l+7]=c,this.float32[l+8]=p,this.uint8[S+36]=h,this.uint8[S+37]=f,A},r}(StructArray);StructArrayLayout2i2ui3ul3ui2f2ub40.prototype.bytesPerElement=40,register("StructArrayLayout2i2ui3ul3ui2f2ub40",StructArrayLayout2i2ui3ul3ui2f2ub40);var StructArrayLayout1f4=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},r.prototype.emplaceBack=function(t){var r=this.length;this.resize(r+1);var i=1*r;return this.float32[i+0]=t,r},r}(StructArray);StructArrayLayout1f4.prototype.bytesPerElement=4,register("StructArrayLayout1f4",StructArrayLayout1f4);var StructArrayLayout3i6=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},r.prototype.emplaceBack=function(t,r,i){var e=this.length;this.resize(e+1);var o=3*e;return this.int16[o+0]=t,this.int16[o+1]=r,this.int16[o+2]=i,e},r}(StructArray);StructArrayLayout3i6.prototype.bytesPerElement=6,register("StructArrayLayout3i6",StructArrayLayout3i6);var StructArrayLayout1ul2ui8=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},r.prototype.emplaceBack=function(t,r,i){var e=this.length;this.resize(e+1);var o=2*e,u=4*e;return this.uint32[o+0]=t,this.uint16[u+2]=r,this.uint16[u+3]=i,e},r}(StructArray);StructArrayLayout1ul2ui8.prototype.bytesPerElement=8,register("StructArrayLayout1ul2ui8",StructArrayLayout1ul2ui8);var StructArrayLayout3ui6=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},r.prototype.emplaceBack=function(t,r,i){var e=this.length;this.resize(e+1);var o=3*e;return this.uint16[o+0]=t,this.uint16[o+1]=r,this.uint16[o+2]=i,e},r}(StructArray);StructArrayLayout3ui6.prototype.bytesPerElement=6,register("StructArrayLayout3ui6",StructArrayLayout3ui6);var StructArrayLayout2ui4=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},r.prototype.emplaceBack=function(t,r){var i=this.length;this.resize(i+1);var e=2*i;return this.uint16[e+0]=t,this.uint16[e+1]=r,i},r}(StructArray);StructArrayLayout2ui4.prototype.bytesPerElement=4,register("StructArrayLayout2ui4",StructArrayLayout2ui4);var StructArrayLayout2f8=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},r.prototype.emplaceBack=function(t,r){var i=this.length;this.resize(i+1);var e=2*i;return this.float32[e+0]=t,this.float32[e+1]=r,i},r}(StructArray);StructArrayLayout2f8.prototype.bytesPerElement=8,register("StructArrayLayout2f8",StructArrayLayout2f8);var StructArrayLayout4f16=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},r.prototype.emplaceBack=function(t,r,i,e){var o=this.length;this.resize(o+1);var u=4*o;return this.float32[u+0]=t,this.float32[u+1]=r,this.float32[u+2]=i,this.float32[u+3]=e,o},r}(StructArray);StructArrayLayout4f16.prototype.bytesPerElement=16,register("StructArrayLayout4f16",StructArrayLayout4f16);var CollisionBoxStruct=function(t){function r(){t.apply(this,arguments)}t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r;var i={anchorPointX:{},anchorPointY:{},x1:{},y1:{},x2:{},y2:{},featureIndex:{},sourceLayerIndex:{},bucketIndex:{},radius:{},signedDistanceFromAnchor:{},anchorPoint:{}};return i.anchorPointX.get=function(){return this._structArray.int16[this._pos2+0]},i.anchorPointX.set=function(t){this._structArray.int16[this._pos2+0]=t},i.anchorPointY.get=function(){return this._structArray.int16[this._pos2+1]},i.anchorPointY.set=function(t){this._structArray.int16[this._pos2+1]=t},i.x1.get=function(){return this._structArray.int16[this._pos2+2]},i.x1.set=function(t){this._structArray.int16[this._pos2+2]=t},i.y1.get=function(){return this._structArray.int16[this._pos2+3]},i.y1.set=function(t){this._structArray.int16[this._pos2+3]=t},i.x2.get=function(){return this._structArray.int16[this._pos2+4]},i.x2.set=function(t){this._structArray.int16[this._pos2+4]=t},i.y2.get=function(){return this._structArray.int16[this._pos2+5]},i.y2.set=function(t){this._structArray.int16[this._pos2+5]=t},i.featureIndex.get=function(){return this._structArray.uint32[this._pos4+3]},i.featureIndex.set=function(t){this._structArray.uint32[this._pos4+3]=t},i.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+8]},i.sourceLayerIndex.set=function(t){this._structArray.uint16[this._pos2+8]=t},i.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+9]},i.bucketIndex.set=function(t){this._structArray.uint16[this._pos2+9]=t},i.radius.get=function(){return this._structArray.int16[this._pos2+10]},i.radius.set=function(t){this._structArray.int16[this._pos2+10]=t},i.signedDistanceFromAnchor.get=function(){return this._structArray.int16[this._pos2+11]},i.signedDistanceFromAnchor.set=function(t){this._structArray.int16[this._pos2+11]=t},i.anchorPoint.get=function(){return new Point(this.anchorPointX,this.anchorPointY)},Object.defineProperties(r.prototype,i),r}(Struct);CollisionBoxStruct.prototype.size=24;var CollisionBoxArray=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype.get=function(t){return new CollisionBoxStruct(this,t)},r}(StructArrayLayout6i1ul2ui2i24);register("CollisionBoxArray",CollisionBoxArray);var PlacedSymbolStruct=function(t){function r(){t.apply(this,arguments)}t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r;var i={anchorX:{},anchorY:{},glyphStartIndex:{},numGlyphs:{},vertexStartIndex:{},lineStartIndex:{},lineLength:{},segment:{},lowerSize:{},upperSize:{},lineOffsetX:{},lineOffsetY:{},writingMode:{},hidden:{}};return i.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},i.anchorX.set=function(t){this._structArray.int16[this._pos2+0]=t},i.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},i.anchorY.set=function(t){this._structArray.int16[this._pos2+1]=t},i.glyphStartIndex.get=function(){return this._structArray.uint16[this._pos2+2]},i.glyphStartIndex.set=function(t){this._structArray.uint16[this._pos2+2]=t},i.numGlyphs.get=function(){return this._structArray.uint16[this._pos2+3]},i.numGlyphs.set=function(t){this._structArray.uint16[this._pos2+3]=t},i.vertexStartIndex.get=function(){return this._structArray.uint32[this._pos4+2]},i.vertexStartIndex.set=function(t){this._structArray.uint32[this._pos4+2]=t},i.lineStartIndex.get=function(){return this._structArray.uint32[this._pos4+3]},i.lineStartIndex.set=function(t){this._structArray.uint32[this._pos4+3]=t},i.lineLength.get=function(){return this._structArray.uint32[this._pos4+4]},i.lineLength.set=function(t){this._structArray.uint32[this._pos4+4]=t},i.segment.get=function(){return this._structArray.uint16[this._pos2+10]},i.segment.set=function(t){this._structArray.uint16[this._pos2+10]=t},i.lowerSize.get=function(){return this._structArray.uint16[this._pos2+11]},i.lowerSize.set=function(t){this._structArray.uint16[this._pos2+11]=t},i.upperSize.get=function(){return this._structArray.uint16[this._pos2+12]},i.upperSize.set=function(t){this._structArray.uint16[this._pos2+12]=t},i.lineOffsetX.get=function(){return this._structArray.float32[this._pos4+7]},i.lineOffsetX.set=function(t){this._structArray.float32[this._pos4+7]=t},i.lineOffsetY.get=function(){return this._structArray.float32[this._pos4+8]},i.lineOffsetY.set=function(t){this._structArray.float32[this._pos4+8]=t},i.writingMode.get=function(){return this._structArray.uint8[this._pos1+36]},i.writingMode.set=function(t){this._structArray.uint8[this._pos1+36]=t},i.hidden.get=function(){return this._structArray.uint8[this._pos1+37]},i.hidden.set=function(t){this._structArray.uint8[this._pos1+37]=t},Object.defineProperties(r.prototype,i),r}(Struct);PlacedSymbolStruct.prototype.size=40;var PlacedSymbolArray=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype.get=function(t){return new PlacedSymbolStruct(this,t)},r}(StructArrayLayout2i2ui3ul3ui2f2ub40);register("PlacedSymbolArray",PlacedSymbolArray);var GlyphOffsetStruct=function(t){function r(){t.apply(this,arguments)}t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r;var i={offsetX:{}};return i.offsetX.get=function(){return this._structArray.float32[this._pos4+0]},i.offsetX.set=function(t){this._structArray.float32[this._pos4+0]=t},Object.defineProperties(r.prototype,i),r}(Struct);GlyphOffsetStruct.prototype.size=4;var GlyphOffsetArray=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype.getoffsetX=function(t){return this.float32[1*t+0]},r.prototype.get=function(t){return new GlyphOffsetStruct(this,t)},r}(StructArrayLayout1f4);register("GlyphOffsetArray",GlyphOffsetArray);var SymbolLineVertexStruct=function(t){function r(){t.apply(this,arguments)}t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r;var i={x:{},y:{},tileUnitDistanceFromAnchor:{}};return i.x.get=function(){return this._structArray.int16[this._pos2+0]},i.x.set=function(t){this._structArray.int16[this._pos2+0]=t},i.y.get=function(){return this._structArray.int16[this._pos2+1]},i.y.set=function(t){this._structArray.int16[this._pos2+1]=t},i.tileUnitDistanceFromAnchor.get=function(){return this._structArray.int16[this._pos2+2]},i.tileUnitDistanceFromAnchor.set=function(t){this._structArray.int16[this._pos2+2]=t},Object.defineProperties(r.prototype,i),r}(Struct);SymbolLineVertexStruct.prototype.size=6;var SymbolLineVertexArray=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype.getx=function(t){return this.int16[3*t+0]},r.prototype.gety=function(t){return this.int16[3*t+1]},r.prototype.gettileUnitDistanceFromAnchor=function(t){return this.int16[3*t+2]},r.prototype.get=function(t){return new SymbolLineVertexStruct(this,t)},r}(StructArrayLayout3i6);register("SymbolLineVertexArray",SymbolLineVertexArray);var FeatureIndexStruct=function(t){function r(){t.apply(this,arguments)}t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r;var i={featureIndex:{},sourceLayerIndex:{},bucketIndex:{}};return i.featureIndex.get=function(){return this._structArray.uint32[this._pos4+0]},i.featureIndex.set=function(t){this._structArray.uint32[this._pos4+0]=t},i.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+2]},i.sourceLayerIndex.set=function(t){this._structArray.uint16[this._pos2+2]=t},i.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+3]},i.bucketIndex.set=function(t){this._structArray.uint16[this._pos2+3]=t},Object.defineProperties(r.prototype,i),r}(Struct);FeatureIndexStruct.prototype.size=8;var FeatureIndexArray=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype.get=function(t){return new FeatureIndexStruct(this,t)},r}(StructArrayLayout1ul2ui8);register("FeatureIndexArray",FeatureIndexArray),module.exports={StructArrayLayout2i4:StructArrayLayout2i4,StructArrayLayout4i8:StructArrayLayout4i8,StructArrayLayout2i4i12:StructArrayLayout2i4i12,StructArrayLayout4i4ub12:StructArrayLayout4i4ub12,StructArrayLayout4i4ui16:StructArrayLayout4i4ui16,StructArrayLayout3f12:StructArrayLayout3f12,StructArrayLayout1ul4:StructArrayLayout1ul4,StructArrayLayout6i1ul2ui2i24:StructArrayLayout6i1ul2ui2i24,StructArrayLayout2i2i2i12:StructArrayLayout2i2i2i12,StructArrayLayout2ub4:StructArrayLayout2ub4,StructArrayLayout2i2ui3ul3ui2f2ub40:StructArrayLayout2i2ui3ul3ui2f2ub40,StructArrayLayout1f4:StructArrayLayout1f4,StructArrayLayout3i6:StructArrayLayout3i6,StructArrayLayout1ul2ui8:StructArrayLayout1ul2ui8,StructArrayLayout3ui6:StructArrayLayout3ui6,StructArrayLayout2ui4:StructArrayLayout2ui4,StructArrayLayout2f8:StructArrayLayout2f8,StructArrayLayout4f16:StructArrayLayout4f16,PosArray:StructArrayLayout2i4,RasterBoundsArray:StructArrayLayout4i8,CircleLayoutArray:StructArrayLayout2i4,FillLayoutArray:StructArrayLayout2i4,FillExtrusionLayoutArray:StructArrayLayout2i4i12,HeatmapLayoutArray:StructArrayLayout2i4,LineLayoutArray:StructArrayLayout4i4ub12,SymbolLayoutArray:StructArrayLayout4i4ui16,SymbolDynamicLayoutArray:StructArrayLayout3f12,SymbolOpacityArray:StructArrayLayout1ul4,CollisionBoxLayoutArray:StructArrayLayout2i2i2i12,CollisionCircleLayoutArray:StructArrayLayout2i2i2i12,CollisionVertexArray:StructArrayLayout2ub4,TriangleIndexArray:StructArrayLayout3ui6,LineIndexArray:StructArrayLayout2ui4,CollisionBoxArray:CollisionBoxArray,PlacedSymbolArray:PlacedSymbolArray,GlyphOffsetArray:GlyphOffsetArray,SymbolLineVertexArray:SymbolLineVertexArray,FeatureIndexArray:FeatureIndexArray}; +},{"../util/struct_array":271,"../util/web_worker_transfer":278,"@mapbox/point-geometry":4}],40:[function(_dereq_,module,exports){ +"use strict";module.exports={deserialize:function(r,e){var t={};if(!e)return t;for(var n=0,a=r;n=EXTENT||l<0||l>=EXTENT)){var c=t.segments.prepareSegment(4,t.layoutVertexArray,t.indexArray),f=c.vertexLength;addCircleVertex(t.layoutVertexArray,y,l,-1,-1),addCircleVertex(t.layoutVertexArray,y,l,1,-1),addCircleVertex(t.layoutVertexArray,y,l,1,1),addCircleVertex(t.layoutVertexArray,y,l,-1,1),t.indexArray.emplaceBack(f,f+1,f+2),t.indexArray.emplaceBack(f,f+3,f+2),c.vertexLength+=4,c.primitiveLength+=2}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e)},register("CircleBucket",CircleBucket,{omit:["layers"]}),module.exports=CircleBucket; +},{"../../util/web_worker_transfer":278,"../array_types":39,"../extent":53,"../index_array_type":55,"../load_geometry":56,"../program_configuration":58,"../segment":60,"./circle_attributes":41}],43:[function(_dereq_,module,exports){ +arguments[4][41][0].apply(exports,arguments) +},{"../../util/struct_array":271,"dup":41}],44:[function(_dereq_,module,exports){ +"use strict";var ref=_dereq_("../array_types"),FillLayoutArray=ref.FillLayoutArray,layoutAttributes=_dereq_("./fill_attributes").members,ref$1=_dereq_("../segment"),SegmentVector=ref$1.SegmentVector,ref$2=_dereq_("../program_configuration"),ProgramConfigurationSet=ref$2.ProgramConfigurationSet,ref$3=_dereq_("../index_array_type"),LineIndexArray=ref$3.LineIndexArray,TriangleIndexArray=ref$3.TriangleIndexArray,loadGeometry=_dereq_("../load_geometry"),earcut=_dereq_("earcut"),classifyRings=_dereq_("../../util/classify_rings"),EARCUT_MAX_RINGS=500,ref$4=_dereq_("../../util/web_worker_transfer"),register=ref$4.register,FillBucket=function(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(function(e){return e.id}),this.index=e.index,this.layoutVertexArray=new FillLayoutArray,this.indexArray=new TriangleIndexArray,this.indexArray2=new LineIndexArray,this.programConfigurations=new ProgramConfigurationSet(layoutAttributes,e.layers,e.zoom),this.segments=new SegmentVector,this.segments2=new SegmentVector};FillBucket.prototype.populate=function(e,r){for(var t=this,i=0,a=e;iEXTENT)||e.y===r.y&&(e.y<0||e.y>EXTENT)}function isEntirelyOutside(e){return e.every(function(e){return e.x<0})||e.every(function(e){return e.x>EXTENT})||e.every(function(e){return e.y<0})||e.every(function(e){return e.y>EXTENT})}var ref=_dereq_("../array_types"),FillExtrusionLayoutArray=ref.FillExtrusionLayoutArray,layoutAttributes=_dereq_("./fill_extrusion_attributes").members,ref$1=_dereq_("../segment"),SegmentVector=ref$1.SegmentVector,MAX_VERTEX_ARRAY_LENGTH=ref$1.MAX_VERTEX_ARRAY_LENGTH,ref$2=_dereq_("../program_configuration"),ProgramConfigurationSet=ref$2.ProgramConfigurationSet,ref$3=_dereq_("../index_array_type"),TriangleIndexArray=ref$3.TriangleIndexArray,loadGeometry=_dereq_("../load_geometry"),EXTENT=_dereq_("../extent"),earcut=_dereq_("earcut"),classifyRings=_dereq_("../../util/classify_rings"),EARCUT_MAX_RINGS=500,ref$4=_dereq_("../../util/web_worker_transfer"),register=ref$4.register,FACTOR=Math.pow(2,13),FillExtrusionBucket=function(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(function(e){return e.id}),this.index=e.index,this.layoutVertexArray=new FillExtrusionLayoutArray,this.indexArray=new TriangleIndexArray,this.programConfigurations=new ProgramConfigurationSet(layoutAttributes,e.layers,e.zoom),this.segments=new SegmentVector};FillExtrusionBucket.prototype.populate=function(e,r){for(var t=this,i=0,a=e;i=1){var A=f[d-1];if(!isBoundaryEdge(h,A)){y.vertexLength+4>MAX_VERTEX_ARRAY_LENGTH&&(y=t.segments.prepareSegment(4,t.layoutVertexArray,t.indexArray));var c=h.sub(A)._perp()._unit(),p=A.dist(h);g+p>32768&&(g=0),addVertex(t.layoutVertexArray,h.x,h.y,c.x,c.y,0,0,g),addVertex(t.layoutVertexArray,h.x,h.y,c.x,c.y,0,1,g),g+=p,addVertex(t.layoutVertexArray,A.x,A.y,c.x,c.y,0,0,g),addVertex(t.layoutVertexArray,A.x,A.y,c.x,c.y,0,1,g);var E=y.vertexLength;t.indexArray.emplaceBack(E,E+1,E+2),t.indexArray.emplaceBack(E+1,E+2,E+3),y.vertexLength+=4,y.primitiveLength+=2}}}}y.vertexLength+o>MAX_VERTEX_ARRAY_LENGTH&&(y=t.segments.prepareSegment(o,t.layoutVertexArray,t.indexArray));for(var m=[],v=[],V=y.vertexLength,_=0,T=n;_>6)}var ref=_dereq_("../array_types"),LineLayoutArray=ref.LineLayoutArray,layoutAttributes=_dereq_("./line_attributes").members,ref$1=_dereq_("../segment"),SegmentVector=ref$1.SegmentVector,ref$2=_dereq_("../program_configuration"),ProgramConfigurationSet=ref$2.ProgramConfigurationSet,ref$3=_dereq_("../index_array_type"),TriangleIndexArray=ref$3.TriangleIndexArray,loadGeometry=_dereq_("../load_geometry"),EXTENT=_dereq_("../extent"),vectorTileFeatureTypes=_dereq_("@mapbox/vector-tile").VectorTileFeature.types,ref$4=_dereq_("../../util/web_worker_transfer"),register=ref$4.register,EXTRUDE_SCALE=63,COS_HALF_SHARP_CORNER=Math.cos(Math.PI/180*37.5),SHARP_CORNER_OFFSET=15,LINE_DISTANCE_BUFFER_BITS=15,LINE_DISTANCE_SCALE=.5,MAX_LINE_DISTANCE=Math.pow(2,LINE_DISTANCE_BUFFER_BITS-1)/LINE_DISTANCE_SCALE,LineBucket=function(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(function(e){return e.id}),this.index=e.index,this.layoutVertexArray=new LineLayoutArray,this.indexArray=new TriangleIndexArray,this.programConfigurations=new ProgramConfigurationSet(layoutAttributes,e.layers,e.zoom),this.segments=new SegmentVector};LineBucket.prototype.populate=function(e,t){for(var r=this,i=0,a=e;i=2&&e[d-1].equals(e[d-2]);)d--;for(var o=0;oo){var T=c.dist(g);if(T>2*l){var I=c.sub(c.sub(g)._mult(l/T)._round());s.distance+=I.dist(g),s.addCurrentVertex(I,s.distance,L.mult(1),0,0,!1,y),g=I}}var b=g&&v,N=b?r:v?m:p;if(b&&"round"===N&&(Sa&&(N="bevel"),"bevel"===N&&(S>2&&(N="flipbevel"),S100)E=A.clone().mult(-1);else{var k=L.x*A.y-L.y*A.x>0?-1:1,R=S*L.add(A).mag()/L.sub(A).mag();E._perp()._mult(R*k)}s.addCurrentVertex(c,s.distance,E,0,0,!1,y),s.addCurrentVertex(c,s.distance,E.mult(-1),0,0,!1,y)}else if("bevel"===N||"fakeround"===N){var F=L.x*A.y-L.y*A.x>0,q=-Math.sqrt(S*S-1);if(F?(x=0,f=q):(f=0,x=q),_||s.addCurrentVertex(c,s.distance,L,f,x,!1,y),"fakeround"===N){for(var P=Math.floor(8*(.5-(V-.5))),D=void 0,M=0;M=0;O--)D=L.mult((O+1)/(P+1))._add(A)._unit(),s.addPieSliceVertex(c,s.distance,D,F,y)}v&&s.addCurrentVertex(c,s.distance,A,-f,-x,!1,y)}else"butt"===N?(_||s.addCurrentVertex(c,s.distance,L,0,0,!1,y),v&&s.addCurrentVertex(c,s.distance,A,0,0,!1,y)):"square"===N?(_||(s.addCurrentVertex(c,s.distance,L,1,1,!1,y),s.e1=s.e2=-1),v&&s.addCurrentVertex(c,s.distance,A,-1,-1,!1,y)):"round"===N&&(_||(s.addCurrentVertex(c,s.distance,L,0,0,!1,y),s.addCurrentVertex(c,s.distance,L,1,1,!0,y),s.e1=s.e2=-1),v&&(s.addCurrentVertex(c,s.distance,A,-1,-1,!0,y),s.addCurrentVertex(c,s.distance,A,0,0,!1,y)));if(B&&C2*l){var w=c.add(v.sub(c)._mult(l/$)._round());s.distance+=w.dist(c),s.addCurrentVertex(w,s.distance,A.mult(1),0,0,!1,y),c=w}}_=!1}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t)}},LineBucket.prototype.addCurrentVertex=function(e,t,r,i,a,n,s){var u,d=this.layoutVertexArray,o=this.indexArray;u=r.clone(),i&&u._sub(r.perp()._mult(i)),addLineVertex(d,e,u,n,!1,i,t),this.e3=s.vertexLength++,this.e1>=0&&this.e2>=0&&(o.emplaceBack(this.e1,this.e2,this.e3),s.primitiveLength++),this.e1=this.e2,this.e2=this.e3,u=r.mult(-1),a&&u._sub(r.perp()._mult(a)),addLineVertex(d,e,u,n,!0,-a,t),this.e3=s.vertexLength++,this.e1>=0&&this.e2>=0&&(o.emplaceBack(this.e1,this.e2,this.e3),s.primitiveLength++),this.e1=this.e2,this.e2=this.e3,t>MAX_LINE_DISTANCE/2&&(this.distance=0,this.addCurrentVertex(e,this.distance,r,i,a,n,s))},LineBucket.prototype.addPieSliceVertex=function(e,t,r,i,a){r=r.mult(i?-1:1);var n=this.layoutVertexArray,s=this.indexArray;addLineVertex(n,e,r,!1,i,0,t),this.e3=a.vertexLength++,this.e1>=0&&this.e2>=0&&(s.emplaceBack(this.e1,this.e2,this.e3),a.primitiveLength++),i?this.e2=this.e3:this.e1=this.e3},register("LineBucket",LineBucket,{omit:["layers"]}),module.exports=LineBucket; +},{"../../util/web_worker_transfer":278,"../array_types":39,"../extent":53,"../index_array_type":55,"../load_geometry":56,"../program_configuration":58,"../segment":60,"./line_attributes":48,"@mapbox/vector-tile":8}],50:[function(_dereq_,module,exports){ +"use strict";var ref=_dereq_("../../util/struct_array"),createLayout=ref.createLayout,symbolLayoutAttributes=createLayout([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"}]),dynamicLayoutAttributes=createLayout([{name:"a_projected_pos",components:3,type:"Float32"}],4),placementOpacityAttributes=createLayout([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),collisionVertexAttributes=createLayout([{name:"a_placed",components:2,type:"Uint8"}],4),symbolAttributes={symbolLayoutAttributes:symbolLayoutAttributes,dynamicLayoutAttributes:dynamicLayoutAttributes,placementOpacityAttributes:placementOpacityAttributes,collisionVertexAttributes:collisionVertexAttributes,collisionBox:createLayout([{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"}]),collisionBoxLayout:createLayout([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),collisionCircleLayout:createLayout([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),placement:createLayout([{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"}]),glyphOffset:createLayout([{type:"Float32",name:"offsetX"}]),lineVertex:createLayout([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}])};module.exports=symbolAttributes; +},{"../../util/struct_array":271}],51:[function(_dereq_,module,exports){ +"use strict";function addVertex(e,t,r,o,i,a,n,s){e.emplaceBack(t,r,Math.round(64*o),Math.round(64*i),a,n,s?s[0]:0,s?s[1]:0)}function addDynamicAttributes(e,t,r){e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r)}var ref=_dereq_("./symbol_attributes"),symbolLayoutAttributes=ref.symbolLayoutAttributes,collisionVertexAttributes=ref.collisionVertexAttributes,collisionBoxLayout=ref.collisionBoxLayout,collisionCircleLayout=ref.collisionCircleLayout,dynamicLayoutAttributes=ref.dynamicLayoutAttributes,ref$1=_dereq_("../array_types"),SymbolLayoutArray=ref$1.SymbolLayoutArray,SymbolDynamicLayoutArray=ref$1.SymbolDynamicLayoutArray,SymbolOpacityArray=ref$1.SymbolOpacityArray,CollisionBoxLayoutArray=ref$1.CollisionBoxLayoutArray,CollisionCircleLayoutArray=ref$1.CollisionCircleLayoutArray,CollisionVertexArray=ref$1.CollisionVertexArray,PlacedSymbolArray=ref$1.PlacedSymbolArray,GlyphOffsetArray=ref$1.GlyphOffsetArray,SymbolLineVertexArray=ref$1.SymbolLineVertexArray,Point=_dereq_("@mapbox/point-geometry"),ref$2=_dereq_("../segment"),SegmentVector=ref$2.SegmentVector,ref$3=_dereq_("../program_configuration"),ProgramConfigurationSet=ref$3.ProgramConfigurationSet,ref$4=_dereq_("../index_array_type"),TriangleIndexArray=ref$4.TriangleIndexArray,LineIndexArray=ref$4.LineIndexArray,transformText=_dereq_("../../symbol/transform_text"),mergeLines=_dereq_("../../symbol/mergelines"),scriptDetection=_dereq_("../../util/script_detection"),loadGeometry=_dereq_("../load_geometry"),vectorTileFeatureTypes=_dereq_("@mapbox/vector-tile").VectorTileFeature.types,verticalizePunctuation=_dereq_("../../util/verticalize_punctuation"),Anchor=_dereq_("../../symbol/anchor"),ref$5=_dereq_("../../symbol/symbol_size"),getSizeData=ref$5.getSizeData,ref$6=_dereq_("../../util/web_worker_transfer"),register=ref$6.register,shaderOpacityAttributes=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}],SymbolBuffers=function(e){this.layoutVertexArray=new SymbolLayoutArray,this.indexArray=new TriangleIndexArray,this.programConfigurations=e,this.segments=new SegmentVector,this.dynamicLayoutVertexArray=new SymbolDynamicLayoutArray,this.opacityVertexArray=new SymbolOpacityArray,this.placedSymbolArray=new PlacedSymbolArray};SymbolBuffers.prototype.upload=function(e,t){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,symbolLayoutAttributes.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.programConfigurations.upload(e),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,dynamicLayoutAttributes.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,shaderOpacityAttributes,!0),this.opacityVertexBuffer.itemSize=1},SymbolBuffers.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())},register("SymbolBuffers",SymbolBuffers);var CollisionBuffers=function(e,t,r){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new r,this.segments=new SegmentVector,this.collisionVertexArray=new CollisionVertexArray};CollisionBuffers.prototype.upload=function(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,collisionVertexAttributes.members,!0)},CollisionBuffers.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())},register("CollisionBuffers",CollisionBuffers);var SymbolBucket=function(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(function(e){return e.id}),this.index=e.index,this.pixelRatio=e.pixelRatio;var t=this.layers[0],r=t._unevaluatedLayout._values;this.textSizeData=getSizeData(this.zoom,r["text-size"]),this.iconSizeData=getSizeData(this.zoom,r["icon-size"]);var o=this.layers[0].layout;this.sortFeaturesByY=o.get("text-allow-overlap")||o.get("icon-allow-overlap")||o.get("text-ignore-placement")||o.get("icon-ignore-placement")};SymbolBucket.prototype.createArrays=function(){this.text=new SymbolBuffers(new ProgramConfigurationSet(symbolLayoutAttributes.members,this.layers,this.zoom,function(e){return/^text/.test(e)})),this.icon=new SymbolBuffers(new ProgramConfigurationSet(symbolLayoutAttributes.members,this.layers,this.zoom,function(e){return/^icon/.test(e)})),this.collisionBox=new CollisionBuffers(CollisionBoxLayoutArray,collisionBoxLayout.members,LineIndexArray),this.collisionCircle=new CollisionBuffers(CollisionCircleLayoutArray,collisionCircleLayout.members,TriangleIndexArray),this.glyphOffsetArray=new GlyphOffsetArray,this.lineVertexArray=new SymbolLineVertexArray},SymbolBucket.prototype.populate=function(e,t){var r=this,o=this.layers[0],i=o.layout,a=i.get("text-font"),n=i.get("text-field"),s=i.get("icon-image"),l=("constant"!==n.value.kind||n.value.value.length>0)&&("constant"!==a.value.kind||a.value.value.length>0),y="constant"!==s.value.kind||s.value.value&&s.value.value.length>0;if(this.features=[],l||y){for(var c=t.iconDependencies,u=t.glyphDependencies,x={zoom:this.zoom},f=0,h=e;f=0;l--)n[l]={x:t[l].x,y:t[l].y,tileUnitDistanceFromAnchor:a},l>0&&(a+=t[l-1].dist(t[l]));for(var y=0;y0;e.addCollisionDebugVertices(l,y,c,u,x?e.collisionCircle:e.collisionBox,s.anchorPoint,o,x)}}}},SymbolBucket.prototype.deserializeCollisionBoxes=function(e,t,r,o,i){for(var a={},n=t;n0},SymbolBucket.prototype.hasIconData=function(){return this.icon.segments.get().length>0},SymbolBucket.prototype.hasCollisionBoxData=function(){return this.collisionBox.segments.get().length>0},SymbolBucket.prototype.hasCollisionCircleData=function(){return this.collisionCircle.segments.get().length>0},SymbolBucket.prototype.sortFeatures=function(e){var t=this;if(this.sortFeaturesByY&&this.sortedAngle!==e&&(this.sortedAngle=e,!(this.text.segments.get().length>1||this.icon.segments.get().length>1))){for(var r=[],o=0;o=this.dim+this.border||t<-this.border||t>=this.dim+this.border)throw new RangeError("out of range source coordinates for DEM data");return(t+this.border)*this.stride+(e+this.border)},register("Level",Level);var DEMData=function(e,t,i){this.uid=e,this.scale=t||1,this.level=i||new Level(256,512),this.loaded=!!i};DEMData.prototype.loadFromImage=function(e){var t=this;if(e.height!==e.width)throw new RangeError("DEM tiles must be square");for(var i=this.level=new Level(e.width,e.width/2),r=e.data,d=0;dbounds.max||a.ybounds.max)&&util.warnOnce("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return r}; -},{"../util/util":252,"./extent":58}],62:[function(_dereq_,module,exports){ -"use strict";var createStructArrayType=_dereq_("../util/struct_array"),PosArray=createStructArrayType({members:[{name:"a_pos",type:"Int16",components:2}]});module.exports=PosArray; -},{"../util/struct_array":249}],63:[function(_dereq_,module,exports){ -"use strict";function packColor(r){return[packUint8ToFloat(255*r[0],255*r[1]),packUint8ToFloat(255*r[2],255*r[3])]}var createVertexArrayType=_dereq_("./vertex_array_type"),packUint8ToFloat=_dereq_("../shaders/encode_attribute").packUint8ToFloat,VertexBuffer=_dereq_("../gl/vertex_buffer"),ConstantBinder=function(r,t,o,e){this.name=r,this.type=t,this.property=o,this.useIntegerZoom=e};ConstantBinder.prototype.defines=function(){return["#define HAS_UNIFORM_u_"+this.name]},ConstantBinder.prototype.populatePaintArray=function(){},ConstantBinder.prototype.setUniforms=function(r,t,o,e){var n=e.zoom,i=o.getPaintValue(this.property,{zoom:this.useIntegerZoom?Math.floor(n):n});"color"===this.type?r.uniform4fv(t.uniforms["u_"+this.name],i):r.uniform1f(t.uniforms["u_"+this.name],i)};var SourceFunctionBinder=function(r,t,o){this.name=r,this.type=t,this.property=o};SourceFunctionBinder.prototype.defines=function(){return[]},SourceFunctionBinder.prototype.populatePaintArray=function(r,t,o,e,n,i){var a=this,s=r.getPaintValue(this.property,{zoom:0},i);if("color"===this.type)for(var p=packColor(s),u=e;uMAX_VERTEX_ARRAY_LENGTH&&warnOnce("Max vertices per segment is "+MAX_VERTEX_ARRAY_LENGTH+": bucket requested "+e),(!n||n.vertexLength+e>module.exports.MAX_VERTEX_ARRAY_LENGTH)&&(n={vertexOffset:t.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0},this.segments.push(n)),n},SegmentVector.prototype.get=function(){return this.segments},SegmentVector.prototype.destroy=function(){for(var e=this,t=0,r=e.segments;tMAX_VERTEX_ARRAY_LENGTH&&warnOnce("Max vertices per segment is "+MAX_VERTEX_ARRAY_LENGTH+": bucket requested "+e),(!n||n.vertexLength+e>module.exports.MAX_VERTEX_ARRAY_LENGTH)&&(n={vertexOffset:t.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0},this.segments.push(n)),n},SegmentVector.prototype.get=function(){return this.segments},SegmentVector.prototype.destroy=function(){for(var e=this,t=0,r=e.segments;t90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")};LngLat.prototype.wrap=function(){return new LngLat(wrap(this.lng,-180,180),this.lat)},LngLat.prototype.toArray=function(){return[this.lng,this.lat]},LngLat.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},LngLat.prototype.toBounds=function(t){var n=360*t/40075017,r=n/Math.cos(Math.PI/180*this.lat);return new(_dereq_("./lng_lat_bounds"))(new LngLat(this.lng-r,this.lat-n),new LngLat(this.lng+r,this.lat+n))},LngLat.convert=function(t){if(t instanceof LngLat)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new LngLat(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new LngLat(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 [, ]")},module.exports=LngLat; +},{"../util/util":275,"./lng_lat_bounds":63}],63:[function(_dereq_,module,exports){ +"use strict";var LngLat=_dereq_("./lng_lat"),LngLatBounds=function(t,n){t&&(n?this.setSouthWest(t).setNorthEast(n):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))};LngLatBounds.prototype.setNorthEast=function(t){return this._ne=t instanceof LngLat?new LngLat(t.lng,t.lat):LngLat.convert(t),this},LngLatBounds.prototype.setSouthWest=function(t){return this._sw=t instanceof LngLat?new LngLat(t.lng,t.lat):LngLat.convert(t),this},LngLatBounds.prototype.extend=function(t){var n,e,s=this._sw,o=this._ne;if(t instanceof LngLat)n=t,e=t;else{if(!(t instanceof LngLatBounds))return Array.isArray(t)?t.every(Array.isArray)?this.extend(LngLatBounds.convert(t)):this.extend(LngLat.convert(t)):this;if(n=t._sw,e=t._ne,!n||!e)return this}return s||o?(s.lng=Math.min(n.lng,s.lng),s.lat=Math.min(n.lat,s.lat),o.lng=Math.max(e.lng,o.lng),o.lat=Math.max(e.lat,o.lat)):(this._sw=new LngLat(n.lng,n.lat),this._ne=new LngLat(e.lng,e.lat)),this},LngLatBounds.prototype.getCenter=function(){return new LngLat((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},LngLatBounds.prototype.getSouthWest=function(){return this._sw},LngLatBounds.prototype.getNorthEast=function(){return this._ne},LngLatBounds.prototype.getNorthWest=function(){return new LngLat(this.getWest(),this.getNorth())},LngLatBounds.prototype.getSouthEast=function(){return new LngLat(this.getEast(),this.getSouth())},LngLatBounds.prototype.getWest=function(){return this._sw.lng},LngLatBounds.prototype.getSouth=function(){return this._sw.lat},LngLatBounds.prototype.getEast=function(){return this._ne.lng},LngLatBounds.prototype.getNorth=function(){return this._ne.lat},LngLatBounds.prototype.toArray=function(){return[this._sw.toArray(),this._ne.toArray()]},LngLatBounds.prototype.toString=function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"},LngLatBounds.prototype.isEmpty=function(){return!(this._sw&&this._ne)},LngLatBounds.convert=function(t){return!t||t instanceof LngLatBounds?t:new LngLatBounds(t)},module.exports=LngLatBounds; +},{"./lng_lat":62}],64:[function(_dereq_,module,exports){ +"use strict";var LngLat=_dereq_("./lng_lat"),Point=_dereq_("@mapbox/point-geometry"),Coordinate=_dereq_("./coordinate"),util=_dereq_("../util/util"),interp=_dereq_("../style-spec/util/interpolate").number,tileCover=_dereq_("../util/tile_cover"),ref=_dereq_("../source/tile_id"),CanonicalTileID=ref.CanonicalTileID,UnwrappedTileID=ref.UnwrappedTileID,EXTENT=_dereq_("../data/extent"),glmatrix=_dereq_("@mapbox/gl-matrix"),vec4=glmatrix.vec4,mat4=glmatrix.mat4,mat2=glmatrix.mat2,Transform=function(t,i,o){this.tileSize=512,this._renderWorldCopies=void 0===o||o,this._minZoom=t||0,this._maxZoom=i||22,this.latRange=[-85.05113,85.05113],this.width=0,this.height=0,this._center=new LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._posMatrixCache={},this._alignedPosMatrixCache={}},prototypeAccessors={minZoom:{},maxZoom:{},renderWorldCopies:{},worldSize:{},centerPoint:{},size:{},bearing:{},pitch:{},fov:{},zoom:{},center:{},unmodified:{},x:{},y:{},point:{}};Transform.prototype.clone=function(){var t=new Transform(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},prototypeAccessors.minZoom.get=function(){return this._minZoom},prototypeAccessors.minZoom.set=function(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},prototypeAccessors.maxZoom.get=function(){return this._maxZoom},prototypeAccessors.maxZoom.set=function(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},prototypeAccessors.renderWorldCopies.get=function(){return this._renderWorldCopies},prototypeAccessors.worldSize.get=function(){return this.tileSize*this.scale},prototypeAccessors.centerPoint.get=function(){return this.size._div(2)},prototypeAccessors.size.get=function(){return new Point(this.width,this.height)},prototypeAccessors.bearing.get=function(){return-this.angle/Math.PI*180},prototypeAccessors.bearing.set=function(t){var i=-util.wrap(t,-180,180)*Math.PI/180;this.angle!==i&&(this._unmodified=!1,this.angle=i,this._calcMatrices(),this.rotationMatrix=mat2.create(),mat2.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},prototypeAccessors.pitch.get=function(){return this._pitch/Math.PI*180},prototypeAccessors.pitch.set=function(t){var i=util.clamp(t,0,60)/180*Math.PI;this._pitch!==i&&(this._unmodified=!1,this._pitch=i,this._calcMatrices())},prototypeAccessors.fov.get=function(){return this._fov/Math.PI*180},prototypeAccessors.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())},prototypeAccessors.zoom.get=function(){return this._zoom},prototypeAccessors.zoom.set=function(t){var i=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==i&&(this._unmodified=!1,this._zoom=i,this.scale=this.zoomScale(i),this.tileZoom=Math.floor(i),this.zoomFraction=i-this.tileZoom,this._constrain(),this._calcMatrices())},prototypeAccessors.center.get=function(){return this._center},prototypeAccessors.center.set=function(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())},Transform.prototype.coveringZoomLevel=function(t){return(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize))},Transform.prototype.getVisibleUnwrappedCoordinates=function(t){var i=this.pointCoordinate(new Point(0,0),0),o=this.pointCoordinate(new Point(this.width,0),0),e=Math.floor(i.column),r=Math.floor(o.column),n=[new UnwrappedTileID(0,t)];if(this._renderWorldCopies)for(var s=e;s<=r;s++)0!==s&&n.push(new UnwrappedTileID(s,t));return n},Transform.prototype.coveringTiles=function(t){var i=this.coveringZoomLevel(t),o=i;if(void 0!==t.minzoom&&it.maxzoom&&(i=t.maxzoom);var e=this.pointCoordinate(this.centerPoint,i),r=new Point(e.column-.5,e.row-.5),n=[this.pointCoordinate(new Point(0,0),i),this.pointCoordinate(new Point(this.width,0),i),this.pointCoordinate(new Point(this.width,this.height),i),this.pointCoordinate(new Point(0,this.height),i)];return tileCover(i,n,t.reparseOverscaled?o:i,this._renderWorldCopies).sort(function(t,i){return r.dist(t.canonical)-r.dist(i.canonical)})},Transform.prototype.resize=function(t,i){this.width=t,this.height=i,this.pixelsToGLUnits=[2/t,-2/i],this._constrain(),this._calcMatrices()},prototypeAccessors.unmodified.get=function(){return this._unmodified},Transform.prototype.zoomScale=function(t){return Math.pow(2,t)},Transform.prototype.scaleZoom=function(t){return Math.log(t)/Math.LN2},Transform.prototype.project=function(t){return new Point(this.lngX(t.lng),this.latY(t.lat))},Transform.prototype.unproject=function(t){return new LngLat(this.xLng(t.x),this.yLat(t.y))},prototypeAccessors.x.get=function(){return this.lngX(this.center.lng)},prototypeAccessors.y.get=function(){return this.latY(this.center.lat)},prototypeAccessors.point.get=function(){return new Point(this.x,this.y)},Transform.prototype.lngX=function(t){return(180+t)*this.worldSize/360},Transform.prototype.latY=function(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))*this.worldSize/360},Transform.prototype.xLng=function(t){return 360*t/this.worldSize-180},Transform.prototype.yLat=function(t){var i=180-360*t/this.worldSize;return 360/Math.PI*Math.atan(Math.exp(i*Math.PI/180))-90},Transform.prototype.setLocationAtPoint=function(t,i){var o=this.pointCoordinate(i)._sub(this.pointCoordinate(this.centerPoint));this.center=this.coordinateLocation(this.locationCoordinate(t)._sub(o)),this._renderWorldCopies&&(this.center=this.center.wrap())},Transform.prototype.locationPoint=function(t){return this.coordinatePoint(this.locationCoordinate(t))},Transform.prototype.pointLocation=function(t){return this.coordinateLocation(this.pointCoordinate(t))},Transform.prototype.locationCoordinate=function(t){return new Coordinate(this.lngX(t.lng)/this.tileSize,this.latY(t.lat)/this.tileSize,this.zoom).zoomTo(this.tileZoom)},Transform.prototype.coordinateLocation=function(t){var i=t.zoomTo(this.zoom);return new LngLat(this.xLng(i.column*this.tileSize),this.yLat(i.row*this.tileSize))},Transform.prototype.pointCoordinate=function(t,i){void 0===i&&(i=this.tileZoom);var o=[t.x,t.y,0,1],e=[t.x,t.y,1,1];vec4.transformMat4(o,o,this.pixelMatrixInverse),vec4.transformMat4(e,e,this.pixelMatrixInverse);var r=o[3],n=e[3],s=o[0]/r,a=e[0]/n,h=o[1]/r,c=e[1]/n,l=o[2]/r,m=e[2]/n,p=l===m?0:(0-l)/(m-l);return new Coordinate(interp(s,a,p)/this.tileSize,interp(h,c,p)/this.tileSize,this.zoom)._zoomTo(i)},Transform.prototype.coordinatePoint=function(t){var i=t.zoomTo(this.zoom),o=[i.column*this.tileSize,i.row*this.tileSize,0,1];return vec4.transformMat4(o,o,this.pixelMatrix),new Point(o[0]/o[3],o[1]/o[3])},Transform.prototype.calculatePosMatrix=function(t,i){void 0===i&&(i=!1);var o=t.key,e=i?this._alignedPosMatrixCache:this._posMatrixCache;if(e[o])return e[o];var r=t.canonical,n=this.worldSize/this.zoomScale(r.z),s=r.x+Math.pow(2,r.z)*t.wrap,a=mat4.identity(new Float64Array(16));return mat4.translate(a,a,[s*n,r.y*n,0]),mat4.scale(a,a,[n/EXTENT,n/EXTENT,1]),mat4.multiply(a,i?this.alignedProjMatrix:this.projMatrix,a),e[o]=new Float32Array(a),e[o]},Transform.prototype._constrain=function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var t,i,o,e,r=-90,n=90,s=-180,a=180,h=this.size,c=this._unmodified;if(this.latRange){var l=this.latRange;r=this.latY(l[1]),n=this.latY(l[0]),t=n-rn&&(e=n-f)}if(this.lngRange){var d=this.x,g=h.x/2;d-ga&&(o=a-g)}void 0===o&&void 0===e||(this.center=this.unproject(new Point(void 0!==o?o:this.x,void 0!==e?e:this.y))),this._unmodified=c,this._constraining=!1}},Transform.prototype._calcMatrices=function(){if(this.height){this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;var t=this._fov/2,i=Math.PI/2+this._pitch,o=Math.sin(t)*this.cameraToCenterDistance/Math.sin(Math.PI-i-t),e=this.x,r=this.y,n=Math.cos(Math.PI/2-this._pitch)*o+this.cameraToCenterDistance,s=1.01*n,a=new Float64Array(16);mat4.perspective(a,this._fov,this.width/this.height,1,s),mat4.scale(a,a,[1,-1,1]),mat4.translate(a,a,[0,0,-this.cameraToCenterDistance]),mat4.rotateX(a,a,this._pitch),mat4.rotateZ(a,a,this.angle),mat4.translate(a,a,[-e,-r,0]);var h=this.worldSize/(2*Math.PI*6378137*Math.abs(Math.cos(this.center.lat*(Math.PI/180))));mat4.scale(a,a,[1,1,h,1]),this.projMatrix=a;var c=this.width%2/2,l=this.height%2/2,m=Math.cos(this.angle),p=Math.sin(this.angle),u=e-Math.round(e)+m*c+p*l,f=r-Math.round(r)+m*l+p*c,d=new Float64Array(a);if(mat4.translate(d,d,[u>.5?u-1:u,f>.5?f-1:f,0]),this.alignedProjMatrix=d,a=mat4.create(),mat4.scale(a,a,[this.width/2,-this.height/2,1]),mat4.translate(a,a,[1,-1,0]),this.pixelMatrix=mat4.multiply(new Float64Array(16),a,this.projMatrix),!(a=mat4.invert(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");this.pixelMatrixInverse=a,this._posMatrixCache={},this._alignedPosMatrixCache={}}},Object.defineProperties(Transform.prototype,prototypeAccessors),module.exports=Transform; +},{"../data/extent":53,"../source/tile_id":114,"../style-spec/util/interpolate":158,"../util/tile_cover":273,"../util/util":275,"./coordinate":61,"./lng_lat":62,"@mapbox/gl-matrix":2,"@mapbox/point-geometry":4}],65:[function(_dereq_,module,exports){ +"use strict";var Color=_dereq_("../style-spec/util/color"),ZERO=0,ONE=1,ONE_MINUS_SRC_ALPHA=771,ColorMode=function(o,e,l){this.blendFunction=o,this.blendColor=e,this.mask=l};ColorMode.Replace=[ONE,ZERO],ColorMode.disabled=new ColorMode(ColorMode.Replace,Color.transparent,[!1,!1,!1,!1]),ColorMode.unblended=new ColorMode(ColorMode.Replace,Color.transparent,[!0,!0,!0,!0]),ColorMode.alphaBlended=new ColorMode([ONE,ONE_MINUS_SRC_ALPHA],Color.transparent,[!0,!0,!0,!0]),module.exports=ColorMode; +},{"../style-spec/util/color":153}],66:[function(_dereq_,module,exports){ +"use strict";var IndexBuffer=_dereq_("./index_buffer"),VertexBuffer=_dereq_("./vertex_buffer"),Framebuffer=_dereq_("./framebuffer"),DepthMode=_dereq_("./depth_mode"),StencilMode=_dereq_("./stencil_mode"),ColorMode=_dereq_("./color_mode"),util=_dereq_("../util/util"),ref=_dereq_("./value"),ClearColor=ref.ClearColor,ClearDepth=ref.ClearDepth,ClearStencil=ref.ClearStencil,ColorMask=ref.ColorMask,DepthMask=ref.DepthMask,StencilMask=ref.StencilMask,StencilFunc=ref.StencilFunc,StencilOp=ref.StencilOp,StencilTest=ref.StencilTest,DepthRange=ref.DepthRange,DepthTest=ref.DepthTest,DepthFunc=ref.DepthFunc,Blend=ref.Blend,BlendFunc=ref.BlendFunc,BlendColor=ref.BlendColor,Program=ref.Program,LineWidth=ref.LineWidth,ActiveTextureUnit=ref.ActiveTextureUnit,Viewport=ref.Viewport,BindFramebuffer=ref.BindFramebuffer,BindRenderbuffer=ref.BindRenderbuffer,BindTexture=ref.BindTexture,BindVertexBuffer=ref.BindVertexBuffer,BindElementBuffer=ref.BindElementBuffer,BindVertexArrayOES=ref.BindVertexArrayOES,PixelStoreUnpack=ref.PixelStoreUnpack,PixelStoreUnpackPremultiplyAlpha=ref.PixelStoreUnpackPremultiplyAlpha,Context=function(e){this.gl=e,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.lineWidthRange=e.getParameter(e.ALIASED_LINE_WIDTH_RANGE),this.clearColor=new ClearColor(this),this.clearDepth=new ClearDepth(this),this.clearStencil=new ClearStencil(this),this.colorMask=new ColorMask(this),this.depthMask=new DepthMask(this),this.stencilMask=new StencilMask(this),this.stencilFunc=new StencilFunc(this),this.stencilOp=new StencilOp(this),this.stencilTest=new StencilTest(this),this.depthRange=new DepthRange(this),this.depthTest=new DepthTest(this),this.depthFunc=new DepthFunc(this),this.blend=new Blend(this),this.blendFunc=new BlendFunc(this),this.blendColor=new BlendColor(this),this.program=new Program(this),this.lineWidth=new LineWidth(this),this.activeTexture=new ActiveTextureUnit(this),this.viewport=new Viewport(this),this.bindFramebuffer=new BindFramebuffer(this),this.bindRenderbuffer=new BindRenderbuffer(this),this.bindTexture=new BindTexture(this),this.bindVertexBuffer=new BindVertexBuffer(this),this.bindElementBuffer=new BindElementBuffer(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new BindVertexArrayOES(this),this.pixelStoreUnpack=new PixelStoreUnpack(this),this.pixelStoreUnpackPremultiplyAlpha=new PixelStoreUnpackPremultiplyAlpha(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureHalfFloat=e.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&e.getExtension("OES_texture_half_float_linear")};Context.prototype.createIndexBuffer=function(e,t){return new IndexBuffer(this,e,t)},Context.prototype.createVertexBuffer=function(e,t,r){return new VertexBuffer(this,e,t,r)},Context.prototype.createRenderbuffer=function(e,t,r){var i=this.gl,n=i.createRenderbuffer();return this.bindRenderbuffer.set(n),i.renderbufferStorage(i.RENDERBUFFER,e,t,r),this.bindRenderbuffer.set(null),n},Context.prototype.createFramebuffer=function(e,t){return new Framebuffer(this,e,t)},Context.prototype.clear=function(e){var t=e.color,r=e.depth,i=this.gl,n=0;t&&(n|=i.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),void 0!==r&&(n|=i.DEPTH_BUFFER_BIT,this.clearDepth.set(r),this.depthMask.set(!0)),i.clear(n)},Context.prototype.setDepthMode=function(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)},Context.prototype.setStencilMode=function(e){e.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)},Context.prototype.setColorMode=function(e){util.deepEqual(e.blendFunction,ColorMode.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)},module.exports=Context; +},{"../util/util":275,"./color_mode":65,"./depth_mode":67,"./framebuffer":68,"./index_buffer":69,"./stencil_mode":70,"./value":71,"./vertex_buffer":72}],67:[function(_dereq_,module,exports){ +"use strict";var ALWAYS=519,DepthMode=function(e,t,d){this.func=e,this.mask=t,this.range=d};DepthMode.ReadOnly=!1,DepthMode.ReadWrite=!0,DepthMode.disabled=new DepthMode(ALWAYS,DepthMode.ReadOnly,[0,1]),module.exports=DepthMode; },{}],68:[function(_dereq_,module,exports){ -"use strict";var wrap=_dereq_("../util/util").wrap,LngLat=function(t,n){if(isNaN(t)||isNaN(n))throw new Error("Invalid LngLat object: ("+t+", "+n+")");if(this.lng=+t,this.lat=+n,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")};LngLat.prototype.wrap=function(){return new LngLat(wrap(this.lng,-180,180),this.lat)},LngLat.prototype.toArray=function(){return[this.lng,this.lat]},LngLat.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},LngLat.prototype.toBounds=function(t){var n=360*t/40075017,r=n/Math.cos(Math.PI/180*this.lat);return new(_dereq_("./lng_lat_bounds"))(new LngLat(this.lng-r,this.lat-n),new LngLat(this.lng+r,this.lat+n))},LngLat.convert=function(t){if(t instanceof LngLat)return t;if(Array.isArray(t)&&2===t.length)return new LngLat(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new LngLat(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 [, ]")},module.exports=LngLat; -},{"../util/util":252,"./lng_lat_bounds":69}],69:[function(_dereq_,module,exports){ -"use strict";var LngLat=_dereq_("./lng_lat"),LngLatBounds=function(t,n){t&&(n?this.setSouthWest(t).setNorthEast(n):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))};LngLatBounds.prototype.setNorthEast=function(t){return this._ne=t instanceof LngLat?new LngLat(t.lng,t.lat):LngLat.convert(t),this},LngLatBounds.prototype.setSouthWest=function(t){return this._sw=t instanceof LngLat?new LngLat(t.lng,t.lat):LngLat.convert(t),this},LngLatBounds.prototype.extend=function(t){var n,e,s=this._sw,o=this._ne;if(t instanceof LngLat)n=t,e=t;else{if(!(t instanceof LngLatBounds))return Array.isArray(t)?t.every(Array.isArray)?this.extend(LngLatBounds.convert(t)):this.extend(LngLat.convert(t)):this;if(n=t._sw,e=t._ne,!n||!e)return this}return s||o?(s.lng=Math.min(n.lng,s.lng),s.lat=Math.min(n.lat,s.lat),o.lng=Math.max(e.lng,o.lng),o.lat=Math.max(e.lat,o.lat)):(this._sw=new LngLat(n.lng,n.lat),this._ne=new LngLat(e.lng,e.lat)),this},LngLatBounds.prototype.getCenter=function(){return new LngLat((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},LngLatBounds.prototype.getSouthWest=function(){return this._sw},LngLatBounds.prototype.getNorthEast=function(){return this._ne},LngLatBounds.prototype.getNorthWest=function(){return new LngLat(this.getWest(),this.getNorth())},LngLatBounds.prototype.getSouthEast=function(){return new LngLat(this.getEast(),this.getSouth())},LngLatBounds.prototype.getWest=function(){return this._sw.lng},LngLatBounds.prototype.getSouth=function(){return this._sw.lat},LngLatBounds.prototype.getEast=function(){return this._ne.lng},LngLatBounds.prototype.getNorth=function(){return this._ne.lat},LngLatBounds.prototype.toArray=function(){return[this._sw.toArray(),this._ne.toArray()]},LngLatBounds.prototype.toString=function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"},LngLatBounds.convert=function(t){return!t||t instanceof LngLatBounds?t:new LngLatBounds(t)},module.exports=LngLatBounds; -},{"./lng_lat":68}],70:[function(_dereq_,module,exports){ -"use strict";var LngLat=_dereq_("./lng_lat"),Point=_dereq_("@mapbox/point-geometry"),Coordinate=_dereq_("./coordinate"),util=_dereq_("../util/util"),interp=_dereq_("../style-spec/util/interpolate"),TileCoord=_dereq_("../source/tile_coord"),EXTENT=_dereq_("../data/extent"),glmatrix=_dereq_("@mapbox/gl-matrix"),vec4=glmatrix.vec4,mat4=glmatrix.mat4,mat2=glmatrix.mat2,Transform=function(t,o,i){this.tileSize=512,this._renderWorldCopies=void 0===i||i,this._minZoom=t||0,this._maxZoom=o||22,this.latRange=[-85.05113,85.05113],this.width=0,this.height=0,this._center=new LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0},prototypeAccessors={minZoom:{},maxZoom:{},renderWorldCopies:{},worldSize:{},centerPoint:{},size:{},bearing:{},pitch:{},fov:{},zoom:{},center:{},unmodified:{},x:{},y:{},point:{}};prototypeAccessors.minZoom.get=function(){return this._minZoom},prototypeAccessors.minZoom.set=function(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},prototypeAccessors.maxZoom.get=function(){return this._maxZoom},prototypeAccessors.maxZoom.set=function(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},prototypeAccessors.renderWorldCopies.get=function(){return this._renderWorldCopies},prototypeAccessors.worldSize.get=function(){return this.tileSize*this.scale},prototypeAccessors.centerPoint.get=function(){return this.size._div(2)},prototypeAccessors.size.get=function(){return new Point(this.width,this.height)},prototypeAccessors.bearing.get=function(){return-this.angle/Math.PI*180},prototypeAccessors.bearing.set=function(t){var o=-util.wrap(t,-180,180)*Math.PI/180;this.angle!==o&&(this._unmodified=!1,this.angle=o,this._calcMatrices(),this.rotationMatrix=mat2.create(),mat2.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},prototypeAccessors.pitch.get=function(){return this._pitch/Math.PI*180},prototypeAccessors.pitch.set=function(t){var o=util.clamp(t,0,60)/180*Math.PI;this._pitch!==o&&(this._unmodified=!1,this._pitch=o,this._calcMatrices())},prototypeAccessors.fov.get=function(){return this._fov/Math.PI*180},prototypeAccessors.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())},prototypeAccessors.zoom.get=function(){return this._zoom},prototypeAccessors.zoom.set=function(t){var o=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==o&&(this._unmodified=!1,this._zoom=o,this.scale=this.zoomScale(o),this.tileZoom=Math.floor(o),this.zoomFraction=o-this.tileZoom,this._constrain(),this._calcMatrices())},prototypeAccessors.center.get=function(){return this._center},prototypeAccessors.center.set=function(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())},Transform.prototype.coveringZoomLevel=function(t){return(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize))},Transform.prototype.getVisibleWrappedCoordinates=function(t){for(var o=this.pointCoordinate(new Point(0,0),0),i=this.pointCoordinate(new Point(this.width,0),0),e=Math.floor(o.column),r=Math.floor(i.column),n=[t],s=e;s<=r;s++)0!==s&&n.push(new TileCoord(t.z,t.x,t.y,s));return n},Transform.prototype.coveringTiles=function(t){var o=this.coveringZoomLevel(t),i=o;if(void 0!==t.minzoom&&ot.maxzoom&&(o=t.maxzoom);var e=this.pointCoordinate(this.centerPoint,o),r=new Point(e.column-.5,e.row-.5),n=[this.pointCoordinate(new Point(0,0),o),this.pointCoordinate(new Point(this.width,0),o),this.pointCoordinate(new Point(this.width,this.height),o),this.pointCoordinate(new Point(0,this.height),o)];return TileCoord.cover(o,n,t.reparseOverscaled?i:o,this._renderWorldCopies).sort(function(t,o){return r.dist(t)-r.dist(o)})},Transform.prototype.resize=function(t,o){this.width=t,this.height=o,this.pixelsToGLUnits=[2/t,-2/o],this._constrain(),this._calcMatrices()},prototypeAccessors.unmodified.get=function(){return this._unmodified},Transform.prototype.zoomScale=function(t){return Math.pow(2,t)},Transform.prototype.scaleZoom=function(t){return Math.log(t)/Math.LN2},Transform.prototype.project=function(t){return new Point(this.lngX(t.lng),this.latY(t.lat))},Transform.prototype.unproject=function(t){return new LngLat(this.xLng(t.x),this.yLat(t.y))},prototypeAccessors.x.get=function(){return this.lngX(this.center.lng)},prototypeAccessors.y.get=function(){return this.latY(this.center.lat)},prototypeAccessors.point.get=function(){return new Point(this.x,this.y)},Transform.prototype.lngX=function(t){return(180+t)*this.worldSize/360},Transform.prototype.latY=function(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))*this.worldSize/360},Transform.prototype.xLng=function(t){return 360*t/this.worldSize-180},Transform.prototype.yLat=function(t){var o=180-360*t/this.worldSize;return 360/Math.PI*Math.atan(Math.exp(o*Math.PI/180))-90},Transform.prototype.setLocationAtPoint=function(t,o){var i=this.pointCoordinate(o)._sub(this.pointCoordinate(this.centerPoint));this.center=this.coordinateLocation(this.locationCoordinate(t)._sub(i)),this._renderWorldCopies&&(this.center=this.center.wrap())},Transform.prototype.locationPoint=function(t){return this.coordinatePoint(this.locationCoordinate(t))},Transform.prototype.pointLocation=function(t){return this.coordinateLocation(this.pointCoordinate(t))},Transform.prototype.locationCoordinate=function(t){return new Coordinate(this.lngX(t.lng)/this.tileSize,this.latY(t.lat)/this.tileSize,this.zoom).zoomTo(this.tileZoom)},Transform.prototype.coordinateLocation=function(t){var o=t.zoomTo(this.zoom);return new LngLat(this.xLng(o.column*this.tileSize),this.yLat(o.row*this.tileSize))},Transform.prototype.pointCoordinate=function(t,o){void 0===o&&(o=this.tileZoom);var i=[t.x,t.y,0,1],e=[t.x,t.y,1,1];vec4.transformMat4(i,i,this.pixelMatrixInverse),vec4.transformMat4(e,e,this.pixelMatrixInverse);var r=i[3],n=e[3],s=i[0]/r,a=e[0]/n,h=i[1]/r,c=e[1]/n,m=i[2]/r,p=e[2]/n,l=m===p?0:(0-m)/(p-m);return new Coordinate(interp(s,a,l)/this.tileSize,interp(h,c,l)/this.tileSize,this.zoom)._zoomTo(o)},Transform.prototype.coordinatePoint=function(t){var o=t.zoomTo(this.zoom),i=[o.column*this.tileSize,o.row*this.tileSize,0,1];return vec4.transformMat4(i,i,this.pixelMatrix),new Point(i[0]/i[3],i[1]/i[3])},Transform.prototype.calculatePosMatrix=function(t,o){var i=t.toCoordinate(o),e=this.worldSize/this.zoomScale(i.zoom),r=mat4.identity(new Float64Array(16));return mat4.translate(r,r,[i.column*e,i.row*e,0]),mat4.scale(r,r,[e/EXTENT,e/EXTENT,1]),mat4.multiply(r,this.projMatrix,r),new Float32Array(r)},Transform.prototype.cameraToTileDistance=function(t){var o=this.calculatePosMatrix(t.coord,t.sourceMaxZoom),i=[t.tileSize/2,t.tileSize/2,0,1];return vec4.transformMat4(i,i,o),i[3]},Transform.prototype._constrain=function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var t,o,i,e,r=-90,n=90,s=-180,a=180,h=this.size,c=this._unmodified;if(this.latRange){var m=this.latRange;r=this.latY(m[1]),n=this.latY(m[0]),t=n-rn&&(e=n-f)}if(this.lngRange){var d=this.x,g=h.x/2;d-ga&&(i=a-g)}void 0===i&&void 0===e||(this.center=this.unproject(new Point(void 0!==i?i:this.x,void 0!==e?e:this.y))),this._unmodified=c,this._constraining=!1}},Transform.prototype._calcMatrices=function(){if(this.height){this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;var t=this._fov/2,o=Math.PI/2+this._pitch,i=Math.sin(t)*this.cameraToCenterDistance/Math.sin(Math.PI-o-t),e=Math.cos(Math.PI/2-this._pitch)*i+this.cameraToCenterDistance,r=1.01*e,n=new Float64Array(16);mat4.perspective(n,this._fov,this.width/this.height,1,r),mat4.scale(n,n,[1,-1,1]),mat4.translate(n,n,[0,0,-this.cameraToCenterDistance]),mat4.rotateX(n,n,this._pitch),mat4.rotateZ(n,n,this.angle),mat4.translate(n,n,[-this.x,-this.y,0]);var s=this.worldSize/(2*Math.PI*6378137*Math.abs(Math.cos(this.center.lat*(Math.PI/180))));if(mat4.scale(n,n,[1,1,s,1]),this.projMatrix=n,n=mat4.create(),mat4.scale(n,n,[this.width/2,-this.height/2,1]),mat4.translate(n,n,[1,-1,0]),this.pixelMatrix=mat4.multiply(new Float64Array(16),n,this.projMatrix),!(n=mat4.invert(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");this.pixelMatrixInverse=n}},Object.defineProperties(Transform.prototype,prototypeAccessors),module.exports=Transform; -},{"../data/extent":58,"../source/tile_coord":113,"../style-spec/util/interpolate":152,"../util/util":252,"./coordinate":67,"./lng_lat":68,"@mapbox/gl-matrix":1,"@mapbox/point-geometry":2}],71:[function(_dereq_,module,exports){ -"use strict";var IndexBuffer=function(e,r){this.gl=e,this.buffer=e.createBuffer(),void 0===e.extVertexArrayObject&&(e.extVertexArrayObject=e.getExtension("OES_vertex_array_object")),e.extVertexArrayObject&&e.extVertexArrayObject.bindVertexArrayOES(null),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.buffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,r.arrayBuffer,e.STATIC_DRAW),delete r.arrayBuffer};IndexBuffer.prototype.bind=function(){this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.buffer)},IndexBuffer.prototype.destroy=function(){this.buffer&&(this.gl.deleteBuffer(this.buffer),delete this.buffer)},module.exports=IndexBuffer; -},{}],72:[function(_dereq_,module,exports){ -"use strict";var AttributeType={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},VertexBuffer=function(t,e,r){this.length=e.length,this.attributes=e.members,this.itemSize=e.bytesPerElement,this.dynamicDraw=r,this.gl=t,this.buffer=t.createBuffer(),this.gl.bindBuffer(t.ARRAY_BUFFER,this.buffer),this.gl.bufferData(t.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?t.DYNAMIC_DRAW:t.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer};VertexBuffer.prototype.bind=function(){this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.buffer)},VertexBuffer.prototype.updateData=function(t){this.bind(),this.gl.bufferSubData(this.gl.ARRAY_BUFFER,0,t.arrayBuffer)},VertexBuffer.prototype.enableAttributes=function(t,e){for(var r=this,i=0;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]]}; -},{"../data/extent":58,"../data/pos_array":62,"../gl/vertex_buffer":72,"../util/browser":231,"./vertex_array_object":96,"@mapbox/gl-matrix":1}],78:[function(_dereq_,module,exports){ -"use strict";function drawFill(r,t,e,i){if(!e.isOpacityZero(r.transform.zoom)){var a=r.gl;a.enable(a.STENCIL_TEST);var l=!e.paint["fill-pattern"]&&e.isPaintValueFeatureConstant("fill-color")&&e.isPaintValueFeatureConstant("fill-opacity")&&1===e.paint["fill-color"][3]&&1===e.paint["fill-opacity"]?"opaque":"translucent";r.renderPass===l&&(r.setDepthSublayer(1),r.depthMask("opaque"===r.renderPass),drawFillTiles(r,t,e,i,drawFillTile)),"translucent"===r.renderPass&&e.paint["fill-antialias"]&&(r.lineWidth(2),r.depthMask(!1),r.setDepthSublayer(e.getPaintProperty("fill-outline-color")?2:0),drawFillTiles(r,t,e,i,drawStrokeTile))}}function drawFillTiles(r,t,e,i,a){if(!pattern.isPatternMissing(e.paint["fill-pattern"],r))for(var l=!0,n=0,o=i;n0?1/(1-r):1+r}function saturationFactor(r){return r>0?1-1/(1.001-r):-r}function getFadeValues(r,e,t,a,i){var o=a.paint["raster-fade-duration"];if(o>0){var n=Date.now(),s=(n-r.timeAdded)/o,u=e?(n-e.timeAdded)/o:-1,f=t.getSource(),d=i.coveringZoomLevel({tileSize:f.tileSize,roundZoom:f.roundZoom}),m=!e||Math.abs(e.coord.z-d)>Math.abs(r.coord.z-d),c=m&&r.refreshedUponExpiration?1:util.clamp(m?s:1-u,0,1);return r.refreshedUponExpiration&&s>=1&&(r.refreshedUponExpiration=!1),e?{opacity:1,mix:1-c}:{opacity:c,mix:0}}return{opacity:1,mix:0}}var util=_dereq_("../util/util"),ImageSource=_dereq_("../source/image_source");module.exports=drawRaster; -},{"../source/image_source":103,"../util/util":252}],83:[function(_dereq_,module,exports){ -"use strict";function drawSymbols(t,o,i,e){if("translucent"===t.renderPass){var a=!(i.layout["text-allow-overlap"]||i.layout["icon-allow-overlap"]||i.layout["text-ignore-placement"]||i.layout["icon-ignore-placement"]),r=t.gl;a?r.disable(r.STENCIL_TEST):r.enable(r.STENCIL_TEST),t.setDepthSublayer(0),t.depthMask(!1),i.isOpacityZero(t.transform.zoom,"icon-opacity")||drawLayerSymbols(t,o,i,e,!1,i.paint["icon-translate"],i.paint["icon-translate-anchor"],i.layout["icon-rotation-alignment"],i.layout["icon-pitch-alignment"],i.layout["icon-keep-upright"]),i.isOpacityZero(t.transform.zoom,"text-opacity")||drawLayerSymbols(t,o,i,e,!0,i.paint["text-translate"],i.paint["text-translate-anchor"],i.layout["text-rotation-alignment"],i.layout["text-pitch-alignment"],i.layout["text-keep-upright"]),o.map.showCollisionBoxes&&drawCollisionDebug(t,o,i,e)}}function drawLayerSymbols(t,o,i,e,a,r,n,s,u,l){var m=t.gl,f=t.transform,c="map"===s,_="map"===u,y=c&&"line"===i.layout["symbol-placement"],p=c&&!_&&!y,x=_;x?m.enable(m.DEPTH_TEST):m.disable(m.DEPTH_TEST);for(var T,b=0,d=e;bthis.previousZoom;a--)r.changeTimes[a]=e,r.changeOpacities[a]=r.opacities[a];for(a=0;a<256;a++){var s=e-r.changeTimes[a],o=255*(i?s/i:1);r.opacities[a]=a<=t?r.changeOpacities[a]+o:r.changeOpacities[a]-o}this.changed=!0,this.previousZoom=t},FrameHistory.prototype.isVisible=function(e){return 0!==this.opacities[Math.floor(10*e)]},FrameHistory.prototype.bind=function(e){this.texture?(e.bindTexture(e.TEXTURE_2D,this.texture),this.changed&&(e.texSubImage2D(e.TEXTURE_2D,0,0,0,256,1,e.ALPHA,e.UNSIGNED_BYTE,this.array),this.changed=!1)):(this.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),e.texImage2D(e.TEXTURE_2D,0,e.ALPHA,256,1,0,e.ALPHA,e.UNSIGNED_BYTE,this.array))},module.exports=FrameHistory; -},{}],85:[function(_dereq_,module,exports){ -"use strict";function makeGlyphAtlas(a){var e=AlphaImage.create({width:0,height:0}),i={},t=new ShelfPack(0,0,{autoResize:!0});for(var h in a){var p=a[h],r=i[h]={};for(var m in p){var g=p[+m];if(g&&0!==g.bitmap.width&&0!==g.bitmap.height){var l=t.packOne(g.bitmap.width+2*padding,g.bitmap.height+2*padding);AlphaImage.resize(e,{width:t.w,height:t.h}),AlphaImage.copy(g.bitmap,e,{x:0,y:0},{x:l.x+padding,y:l.y+padding},g.bitmap),r[m]={rect:l,metrics:g.metrics}}}}return t.shrink(),AlphaImage.resize(e,{width:t.w,height:t.h}),{image:e,positions:i}}var ShelfPack=_dereq_("@mapbox/shelf-pack"),ref=_dereq_("../util/image"),AlphaImage=ref.AlphaImage,padding=1;module.exports={makeGlyphAtlas:makeGlyphAtlas}; -},{"../util/image":242,"@mapbox/shelf-pack":3}],86:[function(_dereq_,module,exports){ -"use strict";var loadGlyphRange=_dereq_("../style/load_glyph_range"),TinySDF=_dereq_("@mapbox/tiny-sdf"),isChar=_dereq_("../util/is_char_in_unicode_block"),ref=_dereq_("../util/util"),asyncAll=ref.asyncAll,ref$1=_dereq_("../util/image"),AlphaImage=ref$1.AlphaImage,GlyphManager=function(r,e){this.requestTransform=r,this.localIdeographFontFamily=e,this.entries={}};GlyphManager.prototype.setURL=function(r){this.url=r},GlyphManager.prototype.getGlyphs=function(r,e){var t=this,i=[];for(var a in r)for(var l=0,n=r[a];l65535)return void e(new Error("glyphs > 65535 not supported"));var o=l.requests[s];o||(o=l.requests[s]=[],loadGlyphRange(i,s,t.url,t.requestTransform,function(r,e){if(e)for(var t in e)l.glyphs[+t]=e[+t];for(var i=0,a=o;ithis.height)return util.warnOnce("LineAtlas out of space"),null;for(var a=0,r=0;r=0;this.currentLayer--){var E=t.style._layers[s[t.currentLayer]];E.source!==(g&&g.id)&&(g=t.style.sourceCaches[E.source],f=[],g&&(t.clearStencil(),f=g.getVisibleCoordinates(),g.getSource().isTileClipped&&t._renderTileClippingMasks(f))),t.renderLayer(t,g,E,f)}this.renderPass="translucent";var T,_=[];for(this.gl.enable(this.gl.BLEND),this.currentLayer=0,this.currentLayer;this.currentLayer0?r.pop():null},Painter.prototype.lineWidth=function(e){this.gl.lineWidth(util.clamp(e,this.lineWidthRange[0],this.lineWidthRange[1]))},Painter.prototype.showOverdrawInspector=function(e){if(e||this._showOverdrawInspector){this._showOverdrawInspector=e;var r=this.gl;if(e){r.blendFunc(r.CONSTANT_COLOR,r.ONE);r.blendColor(1/8,1/8,1/8,0),r.clearColor(0,0,0,1),r.clear(r.COLOR_BUFFER_BIT)}else r.blendFunc(r.ONE,r.ONE_MINUS_SRC_ALPHA)}},Painter.prototype._createProgramCached=function(e,r){this.cache=this.cache||{};var t=""+e+(r.cacheKey||"")+(this._showOverdrawInspector?"/overdraw":"");return this.cache[t]||(this.cache[t]=new Program(this.gl,shaders[e],r,this._showOverdrawInspector)),this.cache[t]},Painter.prototype.useProgram=function(e,r){var t=this.gl,i=this._createProgramCached(e,r||this.emptyProgramConfiguration);return this.currentProgram!==i&&(t.useProgram(i.program),this.currentProgram=i),i},module.exports=Painter; -},{"../data/extent":58,"../data/pos_array":62,"../data/program_configuration":63,"../data/raster_bounds_array":64,"../gl/vertex_buffer":72,"../shaders":98,"../source/pixels_to_tile_units":105,"../source/source_cache":110,"../util/browser":231,"../util/util":252,"./draw_background":74,"./draw_circle":75,"./draw_debug":77,"./draw_fill":78,"./draw_fill_extrusion":79,"./draw_heatmap":80,"./draw_line":81,"./draw_raster":82,"./draw_symbol":83,"./frame_history":84,"./program":92,"./render_texture":93,"./tile_mask":95,"./vertex_array_object":96,"@mapbox/gl-matrix":1}],91:[function(_dereq_,module,exports){ -"use strict";var pixelsToTileUnits=_dereq_("../source/pixels_to_tile_units");exports.isPatternMissing=function(r,i){if(!r)return!1;var e=i.imageManager.getPattern(r.from),o=i.imageManager.getPattern(r.to);return!e||!o},exports.prepare=function(r,i,e){var o=i.gl,t=i.imageManager.getPattern(r.from),n=i.imageManager.getPattern(r.to);o.uniform1i(e.uniforms.u_image,0),o.uniform2fv(e.uniforms.u_pattern_tl_a,t.tl),o.uniform2fv(e.uniforms.u_pattern_br_a,t.br),o.uniform2fv(e.uniforms.u_pattern_tl_b,n.tl),o.uniform2fv(e.uniforms.u_pattern_br_b,n.br);var u=i.imageManager.getPixelSize(),a=u.width,f=u.height;o.uniform2fv(e.uniforms.u_texsize,[a,f]),o.uniform1f(e.uniforms.u_mix,r.t),o.uniform2fv(e.uniforms.u_pattern_size_a,t.displaySize),o.uniform2fv(e.uniforms.u_pattern_size_b,n.displaySize),o.uniform1f(e.uniforms.u_scale_a,r.fromScale),o.uniform1f(e.uniforms.u_scale_b,r.toScale),o.activeTexture(o.TEXTURE0),i.imageManager.bind(o)},exports.setTile=function(r,i,e){var o=i.gl;o.uniform1f(e.uniforms.u_tile_units_to_pixels,1/pixelsToTileUnits(r,1,i.transform.tileZoom));var t=Math.pow(2,r.coord.z),n=r.tileSize*Math.pow(2,i.transform.tileZoom)/t,u=n*(r.coord.x+r.coord.w*t),a=n*r.coord.y;o.uniform2f(e.uniforms.u_pixel_coord_upper,u>>16,a>>16),o.uniform2f(e.uniforms.u_pixel_coord_lower,65535&u,65535&a)}; -},{"../source/pixels_to_tile_units":105}],92:[function(_dereq_,module,exports){ -"use strict";var browser=_dereq_("../util/browser"),shaders=_dereq_("../shaders"),ref=_dereq_("../data/program_configuration"),ProgramConfiguration=ref.ProgramConfiguration,VertexArrayObject=_dereq_("./vertex_array_object"),Program=function(r,e,t,a){var o=this;this.gl=r,this.program=r.createProgram();var i=t.defines().concat("#define DEVICE_PIXEL_RATIO "+browser.devicePixelRatio.toFixed(1));a&&i.push("#define OVERDRAW_INSPECTOR;");var n=i.concat(shaders.prelude.fragmentSource,e.fragmentSource).join("\n"),s=i.concat(shaders.prelude.vertexSource,e.vertexSource).join("\n"),m=r.createShader(r.FRAGMENT_SHADER);r.shaderSource(m,n),r.compileShader(m),r.attachShader(this.program,m);var g=r.createShader(r.VERTEX_SHADER);r.shaderSource(g,s),r.compileShader(g),r.attachShader(this.program,g);for(var c=t.interface?t.interface.layoutAttributes:[],u=0;u":[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]]}; +},{"../data/array_types":39,"../data/extent":53,"../data/pos_attributes":57,"../gl/depth_mode":67,"../gl/stencil_mode":70,"../util/browser":252,"./vertex_array_object":95,"@mapbox/gl-matrix":2}],78:[function(_dereq_,module,exports){ +"use strict";function drawFill(t,e,r,o){var a=r.paint.get("fill-color"),i=r.paint.get("fill-opacity");if(0!==i.constantOr(1)){var n=t.context;n.setColorMode(t.colorModeForRenderPass());var l=r.paint.get("fill-pattern")||1!==a.constantOr(Color.transparent).a||1!==i.constantOr(0)?"translucent":"opaque";t.renderPass===l&&(n.setDepthMode(t.depthModeForSublayer(1,"opaque"===t.renderPass?DepthMode.ReadWrite:DepthMode.ReadOnly)),drawFillTiles(t,e,r,o,drawFillTile)),"translucent"===t.renderPass&&r.paint.get("fill-antialias")&&(n.lineWidth.set(2),n.setDepthMode(t.depthModeForSublayer(r.getPaintProperty("fill-outline-color")?2:0,DepthMode.ReadOnly)),drawFillTiles(t,e,r,o,drawStrokeTile))}}function drawFillTiles(t,e,r,o,a){if(!pattern.isPatternMissing(r.paint.get("fill-pattern"),t))for(var i=!0,n=0,l=o;n0?1/(1-e):1+e}function saturationFactor(e){return e>0?1-1/(1.001-e):-e}function getFadeValues(e,r,t,a,i){var o=a.paint.get("raster-fade-duration");if(o>0){var n=browser.now(),s=(n-e.timeAdded)/o,u=r?(n-r.timeAdded)/o:-1,d=t.getSource(),f=i.coveringZoomLevel({tileSize:d.tileSize,roundZoom:d.roundZoom}),c=!r||Math.abs(r.tileID.overscaledZ-f)>Math.abs(e.tileID.overscaledZ-f),m=c&&e.refreshedUponExpiration?1:util.clamp(c?s:1-u,0,1);return e.refreshedUponExpiration&&s>=1&&(e.refreshedUponExpiration=!1),r?{opacity:1,mix:1-m}:{opacity:m,mix:0}}return{opacity:1,mix:0}}var util=_dereq_("../util/util"),ImageSource=_dereq_("../source/image_source"),browser=_dereq_("../util/browser"),StencilMode=_dereq_("../gl/stencil_mode"),DepthMode=_dereq_("../gl/depth_mode");module.exports=drawRaster; +},{"../gl/depth_mode":67,"../gl/stencil_mode":70,"../source/image_source":102,"../util/browser":252,"../util/util":275}],84:[function(_dereq_,module,exports){ +"use strict";function drawSymbols(t,e,o,i){if("translucent"===t.renderPass){var r=t.context;r.setStencilMode(StencilMode.disabled),r.setColorMode(t.colorModeForRenderPass()),0!==o.paint.get("icon-opacity").constantOr(1)&&drawLayerSymbols(t,e,o,i,!1,o.paint.get("icon-translate"),o.paint.get("icon-translate-anchor"),o.layout.get("icon-rotation-alignment"),o.layout.get("icon-pitch-alignment"),o.layout.get("icon-keep-upright")),0!==o.paint.get("text-opacity").constantOr(1)&&drawLayerSymbols(t,e,o,i,!0,o.paint.get("text-translate"),o.paint.get("text-translate-anchor"),o.layout.get("text-rotation-alignment"),o.layout.get("text-pitch-alignment"),o.layout.get("text-keep-upright")),e.map.showCollisionBoxes&&drawCollisionDebug(t,e,o,i)}}function drawLayerSymbols(t,e,o,i,r,n,a,s,u,l){var m=t.context,f=m.gl,c=t.transform,y="map"===s,p="map"===u,_=y&&"line"===o.layout.get("symbol-placement"),d=y&&!p&&!_,g=p;m.setDepthMode(g?t.depthModeForSublayer(0,DepthMode.ReadOnly):DepthMode.disabled);for(var x,b=0,h=i;b65535)return void r(new Error("glyphs > 65535 not supported"));var o=l.requests[s];o||(o=l.requests[s]=[],loadGlyphRange(t,s,i.url,i.requestTransform,function(e,r){if(r)for(var i in r)l.glyphs[+i]=r[+i];for(var t=0,a=o;tthis.height)return util.warnOnce("LineAtlas out of space"),null;for(var a=0,r=0;r=0;this.currentLayer--){var f=t.style._layers[a[t.currentLayer]];f.source!==(d&&d.id)&&(d=t.style.sourceCaches[f.source],p=[],d&&(t.clearStencil(),p=d.getVisibleCoordinates(),d.getSource().isTileClipped&&t._renderTileClippingMasks(p))),t.renderLayer(t,d,f,p)}this.renderPass="translucent";var m,g=[];for(this.currentLayer=0,this.currentLayer;this.currentLayer0?r.pop():null},Painter.prototype._createProgramCached=function(e,r){this.cache=this.cache||{};var t=""+e+(r.cacheKey||"")+(this._showOverdrawInspector?"/overdraw":"");return this.cache[t]||(this.cache[t]=new Program(this.context,shaders[e],r,this._showOverdrawInspector)),this.cache[t]},Painter.prototype.useProgram=function(e,r){var t=this._createProgramCached(e,r||this.emptyProgramConfiguration);return this.context.program.set(t.program),t},module.exports=Painter; +},{"../data/array_types":39,"../data/extent":53,"../data/pos_attributes":57,"../data/program_configuration":58,"../data/raster_bounds_attributes":59,"../gl/color_mode":65,"../gl/context":66,"../gl/depth_mode":67,"../gl/stencil_mode":70,"../shaders":97,"../source/pixels_to_tile_units":104,"../source/source_cache":111,"../style-spec/util/color":153,"../symbol/cross_tile_symbol_index":218,"../util/browser":252,"../util/util":275,"./draw_background":74,"./draw_circle":75,"./draw_debug":77,"./draw_fill":78,"./draw_fill_extrusion":79,"./draw_heatmap":80,"./draw_hillshade":81,"./draw_line":82,"./draw_raster":83,"./draw_symbol":84,"./program":92,"./texture":93,"./tile_mask":94,"./vertex_array_object":95,"@mapbox/gl-matrix":2}],91:[function(_dereq_,module,exports){ +"use strict";var pixelsToTileUnits=_dereq_("../source/pixels_to_tile_units");exports.isPatternMissing=function(e,i){if(!e)return!1;var r=i.imageManager.getPattern(e.from),t=i.imageManager.getPattern(e.to);return!r||!t},exports.prepare=function(e,i,r){var t=i.context,n=t.gl,o=i.imageManager.getPattern(e.from),a=i.imageManager.getPattern(e.to);n.uniform1i(r.uniforms.u_image,0),n.uniform2fv(r.uniforms.u_pattern_tl_a,o.tl),n.uniform2fv(r.uniforms.u_pattern_br_a,o.br),n.uniform2fv(r.uniforms.u_pattern_tl_b,a.tl),n.uniform2fv(r.uniforms.u_pattern_br_b,a.br);var u=i.imageManager.getPixelSize(),f=u.width,m=u.height;n.uniform2fv(r.uniforms.u_texsize,[f,m]),n.uniform1f(r.uniforms.u_mix,e.t),n.uniform2fv(r.uniforms.u_pattern_size_a,o.displaySize),n.uniform2fv(r.uniforms.u_pattern_size_b,a.displaySize),n.uniform1f(r.uniforms.u_scale_a,e.fromScale),n.uniform1f(r.uniforms.u_scale_b,e.toScale),t.activeTexture.set(n.TEXTURE0),i.imageManager.bind(i.context)},exports.setTile=function(e,i,r){var t=i.context.gl;t.uniform1f(r.uniforms.u_tile_units_to_pixels,1/pixelsToTileUnits(e,1,i.transform.tileZoom));var n=Math.pow(2,e.tileID.overscaledZ),o=e.tileSize*Math.pow(2,i.transform.tileZoom)/n,a=o*(e.tileID.canonical.x+e.tileID.wrap*n),u=o*e.tileID.canonical.y;t.uniform2f(r.uniforms.u_pixel_coord_upper,a>>16,u>>16),t.uniform2f(r.uniforms.u_pixel_coord_lower,65535&a,65535&u)}; +},{"../source/pixels_to_tile_units":104}],92:[function(_dereq_,module,exports){ +"use strict";var browser=_dereq_("../util/browser"),shaders=_dereq_("../shaders"),ref=_dereq_("../data/program_configuration"),ProgramConfiguration=ref.ProgramConfiguration,VertexArrayObject=_dereq_("./vertex_array_object"),Context=_dereq_("../gl/context"),Program=function(r,e,t,a){var o=this,i=r.gl;this.program=i.createProgram();var n=t.defines().concat("#define DEVICE_PIXEL_RATIO "+browser.devicePixelRatio.toFixed(1));a&&n.push("#define OVERDRAW_INSPECTOR;");var s=n.concat(shaders.prelude.fragmentSource,e.fragmentSource).join("\n"),m=n.concat(shaders.prelude.vertexSource,e.vertexSource).join("\n"),g=i.createShader(i.FRAGMENT_SHADER);i.shaderSource(g,s),i.compileShader(g),i.attachShader(this.program,g);var c=i.createShader(i.VERTEX_SHADER);i.shaderSource(c,m),i.compileShader(c),i.attachShader(this.program,c);for(var u=t.layoutAttributes||[],h=0;h= v_max_zoom + v_perspective_zoom_adjust) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0) * alpha * 0.25;\n }\n\n // Faded blue = the placement scale for this label is beyond the CollisionTile\n // max scale, so it's impossible for this label to show without collision detection\n // being run again (the label's glyphs haven't even been added to the symbol bucket)\n if (v_placement_zoom >= u_maxzoom) {\n gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0) * alpha * 0.2;\n }\n}\n",vertexSource:"attribute vec2 a_pos;\nattribute vec2 a_anchor_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_data;\n\nuniform mat4 u_matrix;\nuniform float u_scale;\nuniform float u_pitch;\nuniform float u_collision_y_stretch;\nuniform float u_camera_to_center_distance;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\nvarying float v_perspective_zoom_adjust;\nvarying vec2 v_fade_tex;\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 = 1.0 + 0.5 * ((camera_to_anchor_distance / u_camera_to_center_distance) - 1.0);\n\n highp float incidence_stretch = camera_to_anchor_distance / (u_camera_to_center_distance * cos(u_pitch));\n highp float collision_adjustment = max(1.0, incidence_stretch / u_collision_y_stretch);\n\n gl_Position = u_matrix * vec4(a_pos + a_extrude * collision_perspective_ratio * collision_adjustment / u_scale, 0.0, 1.0);\n\n v_max_zoom = a_data.x;\n v_placement_zoom = a_data.y;\n\n v_perspective_zoom_adjust = floor(log2(collision_perspective_ratio * collision_adjustment) * 10.0);\n v_fade_tex = vec2((v_placement_zoom + v_perspective_zoom_adjust) / 255.0, 0.0);\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 vec3 a_normal;\nattribute float a_edgedistance;\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 base = max(0.0, base);\n height = max(0.0, height);\n\n float ed = a_edgedistance; // use each attrib in order to not trip a VAO assert\n float t = mod(a_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(a_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 (a_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 vec3 a_normal;\nattribute float a_edgedistance;\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 base = max(0.0, base);\n height = max(0.0, height);\n\n float t = mod(a_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 = a_normal.x == 1.0 && a_normal.y == 0.0 && a_normal.z == 16384.0\n ? a_pos // extrusion top\n : vec2(a_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(a_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 (a_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"},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;\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 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) + 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 float y_a = 0.5 + (v_normal.y * v_width2.s / u_pattern_size_a.y);\n float y_b = 0.5 + (v_normal.y * v_width2.s / 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) + 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) + 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;\nuniform sampler2D u_fadetexture;\n\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n lowp float alpha = texture2D(u_fadetexture, v_fade_tex).a * 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;\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 highp float u_collision_y_stretch;\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 vec2 v_fade_tex;\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 vec2 angle_labelminzoom = unpack_float(a_projected_pos[2]);\n highp float segment_angle = -angle_labelminzoom[0] / 255.0 * 2.0 * PI;\n mediump float a_labelminzoom = angle_labelminzoom[1];\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 = 0.5 + 0.5 * distance_ratio;\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 / 64.0 * fontScale), 0.0, 1.0);\n\n v_tex = a_tex / u_texsize;\n // See comments in symbol_sdf.vertex\n highp float incidence_stretch = camera_to_anchor_distance / (u_camera_to_center_distance * cos(u_pitch));\n highp float collision_adjustment = max(1.0, incidence_stretch / u_collision_y_stretch);\n\n highp float collision_perspective_ratio = 1.0 + 0.5*((camera_to_anchor_distance / u_camera_to_center_distance) - 1.0);\n highp float perspective_zoom_adjust = floor(log2(collision_perspective_ratio * collision_adjustment) * 10.0);\n v_fade_tex = vec2((a_labelminzoom + perspective_zoom_adjust) / 255.0, 0.0);\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 sampler2D u_fadetexture;\nuniform highp float u_gamma_scale;\nuniform bool u_is_text;\n\nvarying vec4 v_data0;\nvarying vec2 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 vec2 fade_tex = v_data0.zw;\n float gamma_scale = v_data1.x;\n float size = v_data1.y;\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 lowp float fade_alpha = texture2D(u_fadetexture, fade_tex).a;\n highp float gamma_scaled = gamma * gamma_scale;\n highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist) * fade_alpha;\n\n gl_FragColor = color * (alpha * 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;\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 highp float u_collision_y_stretch;\n\nuniform vec2 u_texsize;\n\nvarying vec4 v_data0;\nvarying vec2 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 vec2 angle_labelminzoom = unpack_float(a_projected_pos[2]);\n highp float segment_angle = -angle_labelminzoom[0] / 255.0 * 2.0 * PI;\n mediump float a_labelminzoom = angle_labelminzoom[1];\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 = 0.5 + 0.5 * distance_ratio;\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 / 64.0 * fontScale), 0.0, 1.0);\n float gamma_scale = gl_Position.w;\n\n vec2 tex = a_tex / u_texsize;\n // incidence_stretch is the ratio of how much y space a label takes up on a tile while drawn perpendicular to the viewport vs\n // how much space it would take up if it were drawn flat on the tile\n // Using law of sines, camera_to_anchor/sin(ground_angle) = camera_to_center/sin(incidence_angle)\n // sin(incidence_angle) = 1/incidence_stretch\n // Incidence angle 90 -> head on, sin(incidence_angle) = 1, no incidence stretch\n // Incidence angle 1 -> very oblique, sin(incidence_angle) =~ 0, lots of incidence stretch\n // ground_angle = u_pitch + PI/2 -> sin(ground_angle) = cos(u_pitch)\n // This 2D calculation is only exactly correct when gl_Position.x is in the center of the viewport,\n // but it's a close enough approximation for our purposes\n highp float incidence_stretch = camera_to_anchor_distance / (u_camera_to_center_distance * cos(u_pitch));\n // incidence_stretch only applies to the y-axis, but without re-calculating the collision tile, we can't\n // adjust the size of only one axis. So, we do a crude approximation at placement time to get the aspect ratio\n // about right, and then do the rest of the adjustment here: there will be some extra padding on the x-axis,\n // but hopefully not too much.\n // Never make the adjustment less than 1.0: instead of allowing collisions on the x-axis, be conservative on\n // the y-axis.\n highp float collision_adjustment = max(1.0, incidence_stretch / u_collision_y_stretch);\n\n // Floor to 1/10th zoom to dodge precision issues that can cause partially hidden labels\n highp float collision_perspective_ratio = 1.0 + 0.5*((camera_to_anchor_distance / u_camera_to_center_distance) - 1.0);\n highp float perspective_zoom_adjust = floor(log2(collision_perspective_ratio * collision_adjustment) * 10.0);\n vec2 fade_tex = vec2((a_labelminzoom + perspective_zoom_adjust) / 255.0, 0.0);\n\n v_data0 = vec4(tex.x, tex.y, fade_tex.x, fade_tex.y);\n v_data1 = vec2(gamma_scale, size);\n}\n"}},re=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,loop=function(e){var n=shaders[e],a={};n.fragmentSource=n.fragmentSource.replace(re,function(e,n,t,o,i){return a[i]=!0,"define"===n?"\n#ifndef HAS_UNIFORM_u_"+i+"\nvarying "+t+" "+o+" "+i+";\n#else\nuniform "+t+" "+o+" u_"+i+";\n#endif\n":"\n#ifdef HAS_UNIFORM_u_"+i+"\n "+t+" "+o+" "+i+" = u_"+i+";\n#endif\n"}),n.vertexSource=n.vertexSource.replace(re,function(e,n,t,o,i){var r="float"===o?"vec2":"vec4";return a[i]?"define"===n?"\n#ifndef HAS_UNIFORM_u_"+i+"\nuniform lowp float a_"+i+"_t;\nattribute "+t+" "+r+" a_"+i+";\nvarying "+t+" "+o+" "+i+";\n#else\nuniform "+t+" "+o+" u_"+i+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+i+"\n "+i+" = unpack_mix_"+r+"(a_"+i+", a_"+i+"_t);\n#else\n "+t+" "+o+" "+i+" = u_"+i+";\n#endif\n":"define"===n?"\n#ifndef HAS_UNIFORM_u_"+i+"\nuniform lowp float a_"+i+"_t;\nattribute "+t+" "+r+" a_"+i+";\n#else\nuniform "+t+" "+o+" u_"+i+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+i+"\n "+t+" "+o+" "+i+" = unpack_mix_"+r+"(a_"+i+", a_"+i+"_t);\n#else\n "+t+" "+o+" "+i+" = u_"+i+";\n#endif\n"})};for(var programName in shaders)loop(programName);module.exports=shaders; -},{}],99:[function(_dereq_,module,exports){ -"use strict";var ImageSource=_dereq_("./image_source"),window=_dereq_("../util/window"),CanvasSource=function(t){function i(i,a,s,n){t.call(this,i,a,s,n),this.options=a,this.animate=void 0===a.animate||a.animate}return t&&(i.__proto__=t),i.prototype=Object.create(t&&t.prototype),i.prototype.constructor=i,i.prototype.load=function(){if(this.canvas=this.canvas||window.document.getElementById(this.options.canvas),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions())return this.fire("error",new Error("Canvas dimensions cannot be less than or equal to zero."));var t;this.play=function(){void 0===t&&(t=this.map.style.animationLoop.set(1/0),this.map._rerender())},this.pause=function(){void 0!==t&&(t=this.map.style.animationLoop.cancel(t))},this._finishLoading()},i.prototype.getCanvas=function(){return this.canvas},i.prototype.onAdd=function(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()},i.prototype.onRemove=function(){this.pause()},i.prototype.prepare=function(){var t=!1;this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||0!==Object.keys(this.tiles).length&&this._prepareImage(this.map.painter.gl,this.canvas,t)},i.prototype.serialize=function(){return{type:"canvas",canvas:this.canvas,coordinates:this.coordinates}},i.prototype._hasInvalidDimensions=function(){for(var t=this,i=0,a=[t.canvas.width,t.canvas.height];ithis.maxzoom?Math.pow(2,t.coord.z-this.maxzoom):1,angle:this.map.transform.angle,pitch:this.map.transform.pitch,cameraToCenterDistance:this.map.transform.cameraToCenterDistance,cameraToTileDistance:this.map.transform.cameraToTileDistance(t),showCollisionBoxes:this.map.showCollisionBoxes};t.workerID=this.dispatcher.send(r,i,function(r,i){if(t.unloadVectorData(),!t.aborted)return r?e(r):(t.loadVectorData(i,o.map.painter),t.redoWhenDone&&(t.redoWhenDone=!1,t.redoPlacement(o)),e(null))},this.workerID)},e.prototype.abortTile=function(t){t.aborted=!0},e.prototype.unloadTile=function(t){t.unloadVectorData(),this.dispatcher.send("removeTile",{uid:t.uid,type:this.type,source:this.id},function(){},t.workerID)},e.prototype.onRemove=function(){this.dispatcher.broadcast("removeSource",{type:this.type,source:this.id},function(){})},e.prototype.serialize=function(){return util.extend({},this._options,{type:this.type,data:this._data})},e}(Evented);module.exports=GeoJSONSource; -},{"../data/extent":58,"../util/ajax":230,"../util/browser":231,"../util/evented":239,"../util/util":252,"../util/window":233}],101:[function(_dereq_,module,exports){ -"use strict";function loadGeoJSONTile(e,r){var t=e.source,o=e.coord;if(!this._geoJSONIndexes[t])return r(null,null);var n=this._geoJSONIndexes[t].getTile(Math.min(o.z,e.maxZoom),o.x,o.y);if(!n)return r(null,null);var u=new GeoJSONWrapper(n.features),i=vtpbf(u);0===i.byteOffset&&i.byteLength===i.buffer.byteLength||(i=new Uint8Array(i)),r(null,{vectorTile:u,rawData:i.buffer})}var ajax=_dereq_("../util/ajax"),rewind=_dereq_("geojson-rewind"),GeoJSONWrapper=_dereq_("./geojson_wrapper"),vtpbf=_dereq_("vt-pbf"),supercluster=_dereq_("supercluster"),geojsonvt=_dereq_("geojson-vt"),VectorTileWorkerSource=_dereq_("./vector_tile_worker_source"),GeoJSONWorkerSource=function(e){function r(r,t,o){e.call(this,r,t,loadGeoJSONTile),o&&(this.loadGeoJSON=o),this._geoJSONIndexes={}}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.loadData=function(e,r){var t=this;this.loadGeoJSON(e,function(o,n){if(o||!n)return r(o);if("object"!=typeof n)return r(new Error("Input data is not a valid GeoJSON object."));rewind(n,!0);try{t._geoJSONIndexes[e.source]=e.cluster?supercluster(e.superclusterOptions).load(n.features):geojsonvt(n,e.geojsonVtOptions)}catch(o){return r(o)}t.loaded[e.source]={},r(null)})},r.prototype.reloadTile=function(r,t){var o=this.loaded[r.source],n=r.uid;return o&&o[n]?e.prototype.reloadTile.call(this,r,t):this.loadTile(r,t)},r.prototype.loadGeoJSON=function(e,r){if(e.request)ajax.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(e){return r(new Error("Input data is not a valid GeoJSON object."))}}},r.prototype.removeSource=function(e){this._geoJSONIndexes[e.source]&&delete this._geoJSONIndexes[e.source]},r}(VectorTileWorkerSource);module.exports=GeoJSONWorkerSource; -},{"../util/ajax":230,"./geojson_wrapper":102,"./vector_tile_worker_source":115,"geojson-rewind":14,"geojson-vt":18,"supercluster":41,"vt-pbf":46}],102:[function(_dereq_,module,exports){ +},{"../util/util":275}],97:[function(_dereq_,module,exports){ +"use strict";var shaders={prelude:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n\n#if !defined(lowp)\n#define lowp\n#endif\n\n#if !defined(mediump)\n#define mediump\n#endif\n\n#if !defined(highp)\n#define highp\n#endif\n\n#endif\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n\n#if !defined(lowp)\n#define lowp\n#endif\n\n#if !defined(mediump)\n#define mediump\n#endif\n\n#if !defined(highp)\n#define highp\n#endif\n\n#endif\n\n// Unpack a pair of values that have been packed into a single float.\n// The packed values are assumed to be 8-bit unsigned integers, and are\n// packed like so:\n// packedValue = floor(input[0]) * 256 + input[1],\nvec2 unpack_float(const float packedValue) {\n int packedIntValue = int(packedValue);\n int v0 = packedIntValue / 256;\n return vec2(v0, packedIntValue - v0 * 256);\n}\n\nvec2 unpack_opacity(const float packedOpacity) {\n int intOpacity = int(packedOpacity) / 2;\n return vec2(float(intOpacity) / 127.0, mod(packedOpacity, 2.0));\n}\n\n// To minimize the number of attributes needed, we encode a 4-component\n// color into a pair of floats (i.e. a vec2) as follows:\n// [ floor(color.r * 255) * 256 + color.g * 255,\n// floor(color.b * 255) * 256 + color.g * 255 ]\nvec4 decode_color(const vec2 encodedColor) {\n return vec4(\n unpack_float(encodedColor[0]) / 255.0,\n unpack_float(encodedColor[1]) / 255.0\n );\n}\n\n// Unpack a pair of paint values and interpolate between them.\nfloat unpack_mix_vec2(const vec2 packedValue, const float t) {\n return mix(packedValue[0], packedValue[1], t);\n}\n\n// Unpack a pair of paint values and interpolate between them.\nvec4 unpack_mix_vec4(const vec4 packedColors, const float t) {\n vec4 minColor = decode_color(vec2(packedColors[0], packedColors[1]));\n vec4 maxColor = decode_color(vec2(packedColors[2], packedColors[3]));\n return mix(minColor, maxColor, t);\n}\n\n// The offset depends on how many pixels are between the world origin and the edge of the tile:\n// vec2 offset = mod(pixel_coord, size)\n//\n// At high zoom levels there are a ton of pixels between the world origin and the edge of the tile.\n// The glsl spec only guarantees 16 bits of precision for highp floats. We need more than that.\n//\n// The pixel_coord is passed in as two 16 bit values:\n// pixel_coord_upper = floor(pixel_coord / 2^16)\n// pixel_coord_lower = mod(pixel_coord, 2^16)\n//\n// The offset is calculated in a series of steps that should preserve this precision:\nvec2 get_pattern_pos(const vec2 pixel_coord_upper, const vec2 pixel_coord_lower,\n const vec2 pattern_size, const float tile_units_to_pixels, const vec2 pos) {\n\n vec2 offset = mod(mod(mod(pixel_coord_upper, pattern_size) * 256.0, pattern_size) * 256.0 + pixel_coord_lower, pattern_size);\n return (tile_units_to_pixels * pos + offset) / pattern_size;\n}\n"},background:{fragmentSource:"uniform vec4 u_color;\nuniform float u_opacity;\n\nvoid main() {\n gl_FragColor = u_color * u_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\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n"},backgroundPattern:{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;\nuniform float u_opacity;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\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) * u_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\nvoid main() {\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"},circle:{fragmentSource:"#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\n\nvarying vec3 v_data;\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize mediump float radius\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize highp vec4 stroke_color\n #pragma mapbox: initialize mediump float stroke_width\n #pragma mapbox: initialize lowp float stroke_opacity\n\n vec2 extrude = v_data.xy;\n float extrude_length = length(extrude);\n\n lowp float antialiasblur = v_data.z;\n float antialiased_blur = -max(blur, antialiasblur);\n\n float opacity_t = smoothstep(0.0, antialiased_blur, extrude_length - 1.0);\n\n float color_t = stroke_width < 0.01 ? 0.0 : smoothstep(\n antialiased_blur,\n 0.0,\n extrude_length - radius / (radius + stroke_width)\n );\n\n gl_FragColor = opacity_t * mix(color * opacity, stroke_color * stroke_opacity, color_t);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform bool u_scale_with_map;\nuniform bool u_pitch_with_map;\nuniform vec2 u_extrude_scale;\nuniform highp float u_camera_to_center_distance;\n\nattribute vec2 a_pos;\n\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\n\nvarying vec3 v_data;\n\nvoid main(void) {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize mediump float radius\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize highp vec4 stroke_color\n #pragma mapbox: initialize mediump float stroke_width\n #pragma mapbox: initialize lowp float stroke_opacity\n\n // unencode the extrusion vector that we snuck into the a_pos vector\n vec2 extrude = vec2(mod(a_pos, 2.0) * 2.0 - 1.0);\n\n // multiply a_pos by 0.5, since we had it * 2 in order to sneak\n // in extrusion data\n vec2 circle_center = floor(a_pos * 0.5);\n if (u_pitch_with_map) {\n vec2 corner_position = circle_center;\n if (u_scale_with_map) {\n corner_position += extrude * (radius + stroke_width) * u_extrude_scale;\n } else {\n // Pitching the circle with the map effectively scales it with the map\n // To counteract the effect for pitch-scale: viewport, we rescale the\n // whole circle based on the pitch scaling effect at its central point\n vec4 projected_center = u_matrix * vec4(circle_center, 0, 1);\n corner_position += extrude * (radius + stroke_width) * u_extrude_scale * (projected_center.w / u_camera_to_center_distance);\n }\n\n gl_Position = u_matrix * vec4(corner_position, 0, 1);\n } else {\n gl_Position = u_matrix * vec4(circle_center, 0, 1);\n\n if (u_scale_with_map) {\n gl_Position.xy += extrude * (radius + stroke_width) * u_extrude_scale * u_camera_to_center_distance;\n } else {\n gl_Position.xy += extrude * (radius + stroke_width) * u_extrude_scale * gl_Position.w;\n }\n }\n\n // This is a minimum blur distance that serves as a faux-antialiasing for\n // the circle. since blur is a ratio of the circle's size and the intent is\n // to keep the blur at roughly 1px, the two are inversely related.\n lowp float antialiasblur = 1.0 / DEVICE_PIXEL_RATIO / (radius + stroke_width);\n\n v_data = vec3(extrude.x, extrude.y, antialiasblur);\n}\n"},clippingMask:{fragmentSource:"void main() {\n gl_FragColor = vec4(1.0);\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"},heatmap:{fragmentSource:"#pragma mapbox: define highp float weight\n\nuniform highp float u_intensity;\nvarying vec2 v_extrude;\n\n// Gaussian kernel coefficient: 1 / sqrt(2 * PI)\n#define GAUSS_COEF 0.3989422804014327\n\nvoid main() {\n #pragma mapbox: initialize highp float weight\n\n // Kernel density estimation with a Gaussian kernel of size 5x5\n float d = -0.5 * 3.0 * 3.0 * dot(v_extrude, v_extrude);\n float val = weight * u_intensity * GAUSS_COEF * exp(d);\n\n gl_FragColor = vec4(val, 1.0, 1.0, 1.0);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\n\nuniform mat4 u_matrix;\nuniform float u_extrude_scale;\nuniform float u_opacity;\nuniform float u_intensity;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_extrude;\n\n// Effective \"0\" in the kernel density texture to adjust the kernel size to;\n// this empirically chosen number minimizes artifacts on overlapping kernels\n// for typical heatmap cases (assuming clustered source)\nconst highp float ZERO = 1.0 / 255.0 / 16.0;\n\n// Gaussian kernel coefficient: 1 / sqrt(2 * PI)\n#define GAUSS_COEF 0.3989422804014327\n\nvoid main(void) {\n #pragma mapbox: initialize highp float weight\n #pragma mapbox: initialize mediump float radius\n\n // unencode the extrusion vector that we snuck into the a_pos vector\n vec2 unscaled_extrude = vec2(mod(a_pos, 2.0) * 2.0 - 1.0);\n\n // This 'extrude' comes in ranging from [-1, -1], to [1, 1]. We'll use\n // it to produce the vertices of a square mesh framing the point feature\n // we're adding to the kernel density texture. We'll also pass it as\n // a varying, so that the fragment shader can determine the distance of\n // each fragment from the point feature.\n // Before we do so, we need to scale it up sufficiently so that the\n // kernel falls effectively to zero at the edge of the mesh.\n // That is, we want to know S such that\n // weight * u_intensity * GAUSS_COEF * exp(-0.5 * 3.0^2 * S^2) == ZERO\n // Which solves to:\n // S = sqrt(-2.0 * log(ZERO / (weight * u_intensity * GAUSS_COEF))) / 3.0\n float S = sqrt(-2.0 * log(ZERO / weight / u_intensity / GAUSS_COEF)) / 3.0;\n\n // Pass the varying in units of radius\n v_extrude = S * unscaled_extrude;\n\n // Scale by radius and the zoom-based scale factor to produce actual\n // mesh position\n vec2 extrude = v_extrude * radius * u_extrude_scale;\n\n // multiply a_pos by 0.5, since we had it * 2 in order to sneak\n // in extrusion data\n vec4 pos = vec4(floor(a_pos * 0.5) + extrude, 0, 1);\n\n gl_Position = u_matrix * pos;\n}\n"},heatmapTexture:{fragmentSource:"uniform sampler2D u_image;\nuniform sampler2D u_color_ramp;\nuniform float u_opacity;\nvarying vec2 v_pos;\n\nvoid main() {\n float t = texture2D(u_image, v_pos).r;\n vec4 color = texture2D(u_color_ramp, vec2(t, 0.5));\n gl_FragColor = color * 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"},collisionBox:{fragmentSource:"\nvarying float v_placed;\nvarying float v_notUsed;\n\nvoid main() {\n\n float alpha = 0.5;\n\n // Red = collision, hide label\n gl_FragColor = 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 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 = 0.5 + 0.5 * (u_camera_to_center_distance / camera_to_anchor_distance);\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:"\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;\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 = 0.5 + 0.5 * (u_camera_to_center_distance / camera_to_anchor_distance);\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;\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 - 14) * a) where a is an arbitrary value and 14 is the\n // maxzoom of the tile source. here we use a=0.3 which works out to the\n // expression below. see 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 - 14.0) * 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;\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 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) + 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 float y_a = 0.5 + (v_normal.y * v_width2.s / u_pattern_size_a.y);\n float y_b = 0.5 + (v_normal.y * v_width2.s / 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) + 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) + 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 = 0.5 + 0.5 * distance_ratio;\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 / 64.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 = 0.5 + 0.5 * distance_ratio;\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 / 64.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"}},re=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,loop=function(e){var n=shaders[e],a={};n.fragmentSource=n.fragmentSource.replace(re,function(e,n,t,o,i){return a[i]=!0,"define"===n?"\n#ifndef HAS_UNIFORM_u_"+i+"\nvarying "+t+" "+o+" "+i+";\n#else\nuniform "+t+" "+o+" u_"+i+";\n#endif\n":"\n#ifdef HAS_UNIFORM_u_"+i+"\n "+t+" "+o+" "+i+" = u_"+i+";\n#endif\n"}),n.vertexSource=n.vertexSource.replace(re,function(e,n,t,o,i){var r="float"===o?"vec2":"vec4";return a[i]?"define"===n?"\n#ifndef HAS_UNIFORM_u_"+i+"\nuniform lowp float a_"+i+"_t;\nattribute "+t+" "+r+" a_"+i+";\nvarying "+t+" "+o+" "+i+";\n#else\nuniform "+t+" "+o+" u_"+i+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+i+"\n "+i+" = unpack_mix_"+r+"(a_"+i+", a_"+i+"_t);\n#else\n "+t+" "+o+" "+i+" = u_"+i+";\n#endif\n":"define"===n?"\n#ifndef HAS_UNIFORM_u_"+i+"\nuniform lowp float a_"+i+"_t;\nattribute "+t+" "+r+" a_"+i+";\n#else\nuniform "+t+" "+o+" u_"+i+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+i+"\n "+t+" "+o+" "+i+" = unpack_mix_"+r+"(a_"+i+", a_"+i+"_t);\n#else\n "+t+" "+o+" "+i+" = u_"+i+";\n#endif\n"})};for(var programName in shaders)loop(programName);module.exports=shaders; +},{}],98:[function(_dereq_,module,exports){ +"use strict";var ImageSource=_dereq_("./image_source"),window=_dereq_("../util/window"),rasterBoundsAttributes=_dereq_("../data/raster_bounds_attributes"),VertexArrayObject=_dereq_("../render/vertex_array_object"),Texture=_dereq_("../render/texture"),CanvasSource=function(t){function e(e,i,s,a){t.call(this,e,i,s,a),this.options=i,this.animate=void 0===i.animate||i.animate}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.load=function(){if(this.canvas=this.canvas||window.document.getElementById(this.options.canvas),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions())return void this.fire("error",new Error("Canvas dimensions cannot be less than or equal to zero."));this.play=function(){this._playing=!0,this.map._rerender()},this.pause=function(){this._playing=!1},this._finishLoading()},e.prototype.getCanvas=function(){return this.canvas},e.prototype.onAdd=function(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()},e.prototype.onRemove=function(){this.pause()},e.prototype.prepare=function(){var t=this,e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),!this._hasInvalidDimensions()&&0!==Object.keys(this.tiles).length){var i=this.map.painter.context,s=i.gl;this.boundsBuffer||(this.boundsBuffer=i.createVertexBuffer(this._boundsArray,rasterBoundsAttributes.members)),this.boundsVAO||(this.boundsVAO=new VertexArrayObject),this.texture?e?this.texture.update(this.canvas):this._playing&&(this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE),s.texSubImage2D(s.TEXTURE_2D,0,0,0,s.RGBA,s.UNSIGNED_BYTE,this.canvas)):(this.texture=new Texture(i,this.canvas,s.RGBA),this.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE));for(var a in t.tiles){var r=t.tiles[a];"loaded"!==r.state&&(r.state="loaded",r.texture=t.texture)}}},e.prototype.serialize=function(){return{type:"canvas",canvas:this.canvas,coordinates:this.coordinates}},e.prototype.hasTransition=function(){return this._playing},e.prototype._hasInvalidDimensions=function(){for(var t=this,e=0,i=[t.canvas.width,t.canvas.height];e0&&(i.resourceTiming=e._resourceTiming,e._resourceTiming=[]),e.fire("data",i)})},t.prototype.onAdd=function(e){this.map=e,this.load()},t.prototype.setData=function(e){var t=this;return this._data=e,this.fire("dataloading",{dataType:"source"}),this._updateWorkerData(function(e){if(e)return t.fire("error",{error:e});var i={dataType:"source",sourceDataType:"content"};t._collectResourceTiming&&t._resourceTiming&&t._resourceTiming.length>0&&(i.resourceTiming=t._resourceTiming,t._resourceTiming=[]),t.fire("data",i)}),this},t.prototype._updateWorkerData=function(e){var t=this,i=util.extend({},this.workerOptions),o=this._data;"string"==typeof o?(i.request=this.map._transformRequest(resolveURL(o),ResourceType.Source),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(o),this.workerID=this.dispatcher.send(this.type+".loadData",i,function(i,o){t._loaded=!0,o&&o.resourceTiming&&o.resourceTiming[t.id]&&(t._resourceTiming=o.resourceTiming[t.id].slice(0)),e(i)},this.workerID)},t.prototype.loadTile=function(e,t){var i=this,o=void 0===e.workerID||"expired"===e.state?"loadTile":"reloadTile",r={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:browser.devicePixelRatio,overscaling:e.tileID.overscaleFactor(),showCollisionBoxes:this.map.showCollisionBoxes};e.workerID=this.dispatcher.send(o,r,function(r,s){return e.unloadVectorData(),e.aborted?t(null):r?t(r):(e.loadVectorData(s,i.map.painter,"reloadTile"===o),t(null))},this.workerID)},t.prototype.abortTile=function(e){e.aborted=!0},t.prototype.unloadTile=function(e){e.unloadVectorData(),this.dispatcher.send("removeTile",{uid:e.uid,type:this.type,source:this.id},null,e.workerID)},t.prototype.onRemove=function(){this.dispatcher.broadcast("removeSource",{type:this.type,source:this.id})},t.prototype.serialize=function(){return util.extend({},this._options,{type:this.type,data:this._data})},t.prototype.hasTransition=function(){return!1},t}(Evented);module.exports=GeoJSONSource; +},{"../data/extent":53,"../util/ajax":251,"../util/browser":252,"../util/evented":260,"../util/util":275,"../util/window":254}],100:[function(_dereq_,module,exports){ +"use strict";function loadGeoJSONTile(e,r){var t=e.source,o=e.tileID.canonical;if(!this._geoJSONIndexes[t])return r(null,null);var u=this._geoJSONIndexes[t].getTile(o.z,o.x,o.y);if(!u)return r(null,null);var n=new GeoJSONWrapper(u.features),i=vtpbf(n);0===i.byteOffset&&i.byteLength===i.buffer.byteLength||(i=new Uint8Array(i)),r(null,{vectorTile:n,rawData:i.buffer})}var ajax=_dereq_("../util/ajax"),perf=_dereq_("../util/performance"),rewind=_dereq_("geojson-rewind"),GeoJSONWrapper=_dereq_("./geojson_wrapper"),vtpbf=_dereq_("vt-pbf"),supercluster=_dereq_("supercluster"),geojsonvt=_dereq_("geojson-vt"),VectorTileWorkerSource=_dereq_("./vector_tile_worker_source"),GeoJSONWorkerSource=function(e){function r(r,t,o){e.call(this,r,t,loadGeoJSONTile),o&&(this.loadGeoJSON=o),this._geoJSONIndexes={}}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.loadData=function(e,r){var t=this;this.loadGeoJSON(e,function(o,u){if(o||!u)return r(o);if("object"!=typeof u)return r(new Error("Input data is not a valid GeoJSON object."));rewind(u,!0);try{t._geoJSONIndexes[e.source]=e.cluster?supercluster(e.superclusterOptions).load(u.features):geojsonvt(u,e.geojsonVtOptions)}catch(o){return r(o)}t.loaded[e.source]={};var n={};if(e.request&&e.request.collectResourceTiming){var i=perf.getEntriesByName(e.request.url);i&&(n.resourceTiming={},n.resourceTiming[e.source]=JSON.parse(JSON.stringify(i)))}r(null,n)})},r.prototype.reloadTile=function(r,t){var o=this.loaded[r.source],u=r.uid;return o&&o[u]?e.prototype.reloadTile.call(this,r,t):this.loadTile(r,t)},r.prototype.loadGeoJSON=function(e,r){if(e.request)ajax.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(e){return r(new Error("Input data is not a valid GeoJSON object."))}}},r.prototype.removeSource=function(e,r){this._geoJSONIndexes[e.source]&&delete this._geoJSONIndexes[e.source],r()},r}(VectorTileWorkerSource);module.exports=GeoJSONWorkerSource; +},{"../util/ajax":251,"../util/performance":268,"./geojson_wrapper":101,"./vector_tile_worker_source":116,"geojson-rewind":15,"geojson-vt":19,"supercluster":32,"vt-pbf":34}],101:[function(_dereq_,module,exports){ "use strict";var Point=_dereq_("@mapbox/point-geometry"),toGeoJSON=_dereq_("@mapbox/vector-tile").VectorTileFeature.prototype.toGeoJSON,EXTENT=_dereq_("../data/extent"),FeatureWrapper=function(e){this._feature=e,this.extent=EXTENT,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))};FeatureWrapper.prototype.loadGeometry=function(){var e=this;if(1===this._feature.type){for(var t=[],r=0,o=e._feature.geometry;r0&&(o[new OverscaledTileID(e.overscaledZ,l,r.z,t,r.y-1).key]={backfilled:!1},o[new OverscaledTileID(e.overscaledZ,e.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},o[new OverscaledTileID(e.overscaledZ,s,r.z,a,r.y-1).key]={backfilled:!1}),r.y+1t)){var n=Math.pow(2,Math.min(a.coord.z,i._source.maxzoom)-Math.min(e.z,i._source.maxzoom));if(Math.floor(a.coord.x/n)===e.x&&Math.floor(a.coord.y/n)===e.y)for(o[s]=!0,r=!0;a&&a.coord.z-1>e.z;){var d=a.coord.parent(i._source.maxzoom);if(!d)break;a=i._tiles[d.id],a&&a.hasData()&&(delete o[s],o[d.id]=!0)}}}return r},t.prototype.findLoadedParent=function(e,t,o){for(var i=this,r=e.z-1;r>=t;r--){var s=e.parent(i._source.maxzoom);if(!s)return;e=s;var a=String(e.id),n=i._tiles[a];if(n&&n.hasData())return o[a]=!0,n;if(i._cache.has(a))return o[a]=!0,i._cache.getWithoutRemoving(a)}},t.prototype.updateCacheSize=function(e){var t=Math.ceil(e.width/e.tileSize)+1,o=Math.ceil(e.height/e.tileSize)+1,i=t*o,r=Math.floor(5*i),s="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,r):r;this._cache.setMaxSize(s)},t.prototype.update=function(e){var o=this;if(this.transform=e,this._sourceLoaded&&!this._paused){this.updateCacheSize(e),this._coveredTiles={};var i;this.used?this._source.coord?i=e.getVisibleWrappedCoordinates(this._source.coord):(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(e){return o._source.hasTile(e)}))):i=[];var r=(this._source.roundZoom?Math.round:Math.floor)(this.getZoom(e)),s=Math.max(r-t.maxOverzooming,this._source.minzoom),a=Math.max(r+t.maxUnderzooming,this._source.minzoom),n=this._updateRetainedTiles(i,r),d={};if(isRasterType(this._source.type))for(var h=Object.keys(n),u=0;u=Date.now())){o._findLoadedChildren(l,a,n)&&(n[c]=!0);var m=o.findLoadedParent(l,s,d);m&&o._addTile(m.coord)}}var p;for(p in d)n[p]||(o._coveredTiles[p]=!0);for(p in d)n[p]=!0;for(var f=util.keysDifference(this._tiles,n),T=0;Tn._source.maxzoom){var l=r.children(n._source.maxzoom)[0],_=n.getTile(l);_&&_.hasData()?d[l.id]=!0:a=!1}else for(var m=r.children(n._source.maxzoom),p=0;p=u;--v){var y=r.scaledTo(v,n._source.maxzoom);if(h[y.id])break;if(h[y.id]=!0,s=n.getTile(y),!s&&c&&(s=n._addTile(y)),s&&(d[y.id]=!0,c=s.wasRequested(),s.hasData()))break}}}return d},t.prototype._addTile=function(e){var t=this._tiles[e.id];if(t)return t;(t=this._cache.get(e.id))&&(t.redoPlacement(this._source),this._cacheTimers[e.id]&&(clearTimeout(this._cacheTimers[e.id]),delete this._cacheTimers[e.id],this._setTileReloadTimer(e.id,t)));var o=Boolean(t);if(!o){var i=e.z,r=i>this._source.maxzoom?Math.pow(2,i-this._source.maxzoom):1;t=new Tile(e,this._source.tileSize*r,this._source.maxzoom),this._loadTile(t,this._tileLoaded.bind(this,t,e.id,t.state))}return t?(t.uses++,this._tiles[e.id]=t,o||this._source.fire("dataloading",{tile:t,coord:t.coord,dataType:"source"}),t):null},t.prototype._setTileReloadTimer=function(e,t){var o=this,i=t.getExpiryTimeout();i&&(this._timers[e]=setTimeout(function(){o._reloadTile(e,"expired"),delete o._timers[e]},i))},t.prototype._setCacheInvalidationTimer=function(e,t){var o=this,i=t.getExpiryTimeout();i&&(this._cacheTimers[e]=setTimeout(function(){o._cache.remove(e),delete o._cacheTimers[e]},i))},t.prototype._removeTile=function(e){var t=this._tiles[e];if(t&&(t.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),!(t.uses>0)))if(t.stopPlacementThrottler(),t.hasData()){var o=t.coord.wrapped().id;this._cache.add(o,t),this._setCacheInvalidationTimer(o,t)}else t.aborted=!0,this._abortTile(t),this._unloadTile(t)},t.prototype.clearTiles=function(){var e=this;this._shouldReloadOnResume=!1,this._paused=!1;for(var t in e._tiles)e._removeTile(t);this._cache.reset()},t.prototype.tilesIn=function(e){for(var t=this,o=[],i=this.getIds(),r=1/0,s=1/0,a=-1/0,n=-1/0,d=e[0].zoom,h=0;h=0&&m[1].y>=0){for(var p=[],f=0;f>n.z,h=new Point(n.x*l,n.y*l),u=new Point(h.x+l,h.y+l),c=i.segments.prepareSegment(4,a,r);a.emplaceBack(h.x,h.y,h.x,h.y),a.emplaceBack(u.x,h.y,u.x,h.y),a.emplaceBack(h.x,u.y,h.x,u.y),a.emplaceBack(u.x,u.y,u.x,u.y);var d=c.vertexLength;r.emplaceBack(d,d+1,d+2),r.emplaceBack(d+1,d+2,d+3),c.vertexLength+=4,c.primitiveLength+=2}this.maskedBoundsBuffer=new VertexBuffer(t,a),this.maskedIndexBuffer=new IndexBuffer(t,r)}},Tile.prototype.hasData=function(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state},Tile.prototype.setExpiryData=function(e){var t=this.expirationTime;if(e.cacheControl){var i=util.parseCacheControl(e.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+1e3*i["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){var a=Date.now(),r=!1;if(this.expirationTime>a)r=!1;else if(t)if(this.expirationTime=a.minX&&t.x=a.minY&&t.yi.row){var o=t;t=i,i=o}return{x0:t.column,y0:t.row,x1:i.column,y1:i.row,dx:i.column-t.column,dy:i.row-t.row}}function scanSpans(t,i,o,r,e){var h=Math.max(o,Math.floor(i.y0)),s=Math.min(r,Math.ceil(i.y1));if(t.x0===i.x0&&t.y0===i.y0?t.x0+i.dy/t.dy*t.dx0,l=i.dx<0,x=h;xd.dy&&(s=n,n=d,d=s),n.dy>a.dy&&(s=n,n=a,a=s),d.dy>a.dy&&(s=d,d=a,a=s),n.dy&&scanSpans(a,n,r,e,h),d.dy&&scanSpans(a,d,r,e,h)}function getQuadkey(t,i,o){for(var r,e="",h=t;h>0;h--)r=1<t?new TileCoord(this.z-1,this.x,this.y,this.w):new TileCoord(this.z-1,Math.floor(this.x/2),Math.floor(this.y/2),this.w)},TileCoord.prototype.wrapped=function(){return new TileCoord(this.z,this.x,this.y,0)},TileCoord.prototype.isLessThan=function(t){return this.wt.w)&&(this.zt.z)&&(this.xt.x)&&this.y=t)return[new TileCoord(this.z+1,this.x,this.y,this.w)];var i=this.z+1,o=2*this.x,r=2*this.y;return[new TileCoord(i,o,r,this.w),new TileCoord(i,o+1,r,this.w),new TileCoord(i,o,r+1,this.w),new TileCoord(i,o+1,r+1,this.w)]},TileCoord.prototype.scaledTo=function(t,i){return this.z>i?new TileCoord(t,this.x,this.y,this.w):t<=this.z?new TileCoord(t,this.x>>this.z-t,this.y>>this.z-t,this.w):new TileCoord(t,this.x<>this.z-t.z&&t.y===this.y>>this.z-t.z},TileCoord.cover=function(t,i,o,r){function e(t,i,e){var n,d,a,y;if(e>=0&&e<=h)for(n=t;nthis.maxzoom?Math.pow(2,e.coord.z-this.maxzoom):1,r=normalizeURL(e.coord.url(this.tiles,this.maxzoom,this.scheme),this.url),s={request:this.map._transformRequest(r,ResourceType.Tile),uid:e.uid,coord:e.coord,zoom:e.coord.z,tileSize:this.tileSize*o,type:this.type,source:this.id,pixelRatio:browser.devicePixelRatio,overscaling:o,angle:this.map.transform.angle,pitch:this.map.transform.pitch,cameraToCenterDistance:this.map.transform.cameraToCenterDistance,cameraToTileDistance:this.map.transform.cameraToTileDistance(e),showCollisionBoxes:this.map.showCollisionBoxes};void 0===e.workerID||"expired"===e.state?e.workerID=this.dispatcher.send("loadTile",s,i.bind(this)):"loading"===e.state?e.reloadCallback=t:this.dispatcher.send("reloadTile",s,i.bind(this),e.workerID)},t.prototype.abortTile=function(e){this.dispatcher.send("abortTile",{uid:e.uid,type:this.type,source:this.id},void 0,e.workerID)},t.prototype.unloadTile=function(e){e.unloadVectorData(),this.dispatcher.send("removeTile",{uid:e.uid,type:this.type,source:this.id},void 0,e.workerID)},t}(Evented);module.exports=VectorTileSource; -},{"../util/ajax":230,"../util/browser":231,"../util/evented":239,"../util/mapbox":246,"../util/util":252,"./load_tilejson":104,"./tile_bounds":112}],115:[function(_dereq_,module,exports){ -"use strict";function loadVectorTile(e,r){var o=ajax.getArrayBuffer(e.request,function(e,o){e?r(e):o&&r(null,{vectorTile:new vt.VectorTile(new Protobuf(o.data)),rawData:o.data,cacheControl:o.cacheControl,expires:o.expires})});return function(){o.abort()}}var ajax=_dereq_("../util/ajax"),vt=_dereq_("@mapbox/vector-tile"),Protobuf=_dereq_("pbf"),WorkerTile=_dereq_("./worker_tile"),util=_dereq_("../util/util"),VectorTileWorkerSource=function(e,r,o){this.actor=e,this.layerIndex=r,this.loadVectorData=o||loadVectorTile,this.loading={},this.loaded={}};VectorTileWorkerSource.prototype.loadTile=function(e,r){var o=this,t=e.source,a=e.uid;this.loading[t]||(this.loading[t]={});var i=this.loading[t][a]=new WorkerTile(e);i.abort=this.loadVectorData(e,function(e,l){if(delete o.loading[t][a],e||!l)return r(e);var c=l.rawData,n={};l.expires&&(n.expires=l.expires),l.cacheControl&&(n.cacheControl=l.cacheControl),i.vectorTile=l.vectorTile,i.parse(l.vectorTile,o.layerIndex,o.actor,function(e,o,t){if(e||!o)return r(e);r(null,util.extend({rawTileData:c},o,n),t)}),o.loaded[t]=o.loaded[t]||{},o.loaded[t][a]=i})},VectorTileWorkerSource.prototype.reloadTile=function(e,r){function o(e,o){if(this.reloadCallback){var t=this.reloadCallback;delete this.reloadCallback,this.parse(this.vectorTile,i.layerIndex,i.actor,t)}r(e,o)}var t=this.loaded[e.source],a=e.uid,i=this;if(t&&t[a]){var l=t[a];"parsing"===l.status?l.reloadCallback=r:"done"===l.status&&l.parse(l.vectorTile,this.layerIndex,this.actor,o.bind(l))}},VectorTileWorkerSource.prototype.abortTile=function(e){var r=this.loading[e.source],o=e.uid;r&&r[o]&&r[o].abort&&(r[o].abort(),delete r[o])},VectorTileWorkerSource.prototype.removeTile=function(e){var r=this.loaded[e.source],o=e.uid;r&&r[o]&&delete r[o]},VectorTileWorkerSource.prototype.redoPlacement=function(e,r){var o=this.loaded[e.source],t=this.loading[e.source],a=e.uid;if(o&&o[a]){var i=o[a],l=i.redoPlacement(e.angle,e.pitch,e.cameraToCenterDistance,e.cameraToTileDistance,e.showCollisionBoxes);l.result&&r(null,l.result,l.transferables)}else t&&t[a]&&(t[a].angle=e.angle)},module.exports=VectorTileWorkerSource; -},{"../util/ajax":230,"../util/util":252,"./worker_tile":118,"@mapbox/vector-tile":6,"pbf":38}],116:[function(_dereq_,module,exports){ -"use strict";var ajax=_dereq_("../util/ajax"),ImageSource=_dereq_("./image_source"),VideoSource=function(e){function t(t,o,i,r){e.call(this,t,o,i,r),this.roundZoom=!0,this.type="video",this.options=o}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.load=function(){var e=this,t=this.options;this.urls=t.urls,ajax.getVideo(t.urls,function(t,o){if(t)e.fire("error",{error:t});else if(o){e.video=o,e.video.loop=!0;var i;e.video.addEventListener("playing",function(){i=e.map.style.animationLoop.set(1/0),e.map._rerender()}),e.video.addEventListener("pause",function(){e.map.style.animationLoop.cancel(i)}),e.map&&e.video.play(),e._finishLoading()}})},t.prototype.getVideo=function(){return this.video},t.prototype.onAdd=function(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))},t.prototype.prepare=function(){0===Object.keys(this.tiles).length||this.video.readyState<2||this._prepareImage(this.map.painter.gl,this.video)},t.prototype.serialize=function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}},t}(ImageSource);module.exports=VideoSource; -},{"../util/ajax":230,"./image_source":103}],117:[function(_dereq_,module,exports){ -"use strict";var Actor=_dereq_("../util/actor"),StyleLayerIndex=_dereq_("../style/style_layer_index"),VectorTileWorkerSource=_dereq_("./vector_tile_worker_source"),GeoJSONWorkerSource=_dereq_("./geojson_worker_source"),globalRTLTextPlugin=_dereq_("./rtl_text_plugin"),Worker=function(e){var r=this;this.self=e,this.actor=new Actor(e,this),this.layerIndexes={},this.workerSourceTypes={vector:VectorTileWorkerSource,geojson:GeoJSONWorkerSource},this.workerSources={},this.self.registerWorkerSource=function(e,o){if(r.workerSourceTypes[e])throw new Error('Worker source with name "'+e+'" already registered.');r.workerSourceTypes[e]=o},this.self.registerRTLTextPlugin=function(e){if(globalRTLTextPlugin.applyArabicShaping||globalRTLTextPlugin.processBidirectionalText)throw new Error("RTL text plugin already registered.");globalRTLTextPlugin.applyArabicShaping=e.applyArabicShaping,globalRTLTextPlugin.processBidirectionalText=e.processBidirectionalText}};Worker.prototype.setLayers=function(e,r){this.getLayerIndex(e).replace(r)},Worker.prototype.updateLayers=function(e,r){this.getLayerIndex(e).update(r.layers,r.removedIds,r.symbolOrder)},Worker.prototype.loadTile=function(e,r,o){this.getWorkerSource(e,r.type).loadTile(r,o)},Worker.prototype.reloadTile=function(e,r,o){this.getWorkerSource(e,r.type).reloadTile(r,o)},Worker.prototype.abortTile=function(e,r){this.getWorkerSource(e,r.type).abortTile(r)},Worker.prototype.removeTile=function(e,r){this.getWorkerSource(e,r.type).removeTile(r)},Worker.prototype.removeSource=function(e,r){var o=this.getWorkerSource(e,r.type);void 0!==o.removeSource&&o.removeSource(r)},Worker.prototype.redoPlacement=function(e,r,o){this.getWorkerSource(e,r.type).redoPlacement(r,o)},Worker.prototype.loadWorkerSource=function(e,r,o){try{this.self.importScripts(r.url),o()}catch(e){o(e)}},Worker.prototype.loadRTLTextPlugin=function(e,r,o){try{globalRTLTextPlugin.applyArabicShaping||globalRTLTextPlugin.processBidirectionalText||(this.self.importScripts(r),globalRTLTextPlugin.applyArabicShaping&&globalRTLTextPlugin.processBidirectionalText||o(new Error("RTL Text Plugin failed to import scripts from "+r)))}catch(e){o(e)}},Worker.prototype.getLayerIndex=function(e){var r=this.layerIndexes[e];return r||(r=this.layerIndexes[e]=new StyleLayerIndex),r},Worker.prototype.getWorkerSource=function(e,r){var o=this;if(this.workerSources[e]||(this.workerSources[e]={}),!this.workerSources[e][r]){var t={send:function(r,t,i,n){o.actor.send(r,t,i,n,e)}};this.workerSources[e][r]=new this.workerSourceTypes[r](t,this.getLayerIndex(e))}return this.workerSources[e][r]},module.exports=function(e){return new Worker(e)}; -},{"../style/style_layer_index":193,"../util/actor":229,"./geojson_worker_source":101,"./rtl_text_plugin":108,"./vector_tile_worker_source":115}],118:[function(_dereq_,module,exports){ -"use strict";function recalculateLayers(e,i){for(var r=0,t=e.layers;r=b.maxzoom||b.layout&&"none"===b.layout.visibility)){for(var x=0,T=k;x=0;z--){var B=n[i.symbolOrder[z]];B&&o.symbolBuckets.push(B)}var D,A,C,I=util.mapObject(c.glyphDependencies,function(e){return Object.keys(e).map(Number)});Object.keys(I).length?r.send("getGlyphs",{uid:this.uid,stacks:I},function(e,i){D||(D=e,A=i,a.call(o))}):A={};var w=Object.keys(c.iconDependencies);w.length?r.send("getImages",{icons:w},function(e,i){D||(D=e,C=i,a.call(o))}):C={},a.call(this)},WorkerTile.prototype.redoPlacement=function(e,i,r,t,a){var o=this;if(this.angle=e,this.pitch=i,this.cameraToCenterDistance=r,this.cameraToTileDistance=t,"done"!==this.status)return{};for(var s=new CollisionTile(this.angle,this.pitch,this.cameraToCenterDistance,this.cameraToTileDistance,this.collisionBoxArray),l=0,n=o.symbolBuckets;l1||(Math.abs(i)>1&&(1===Math.abs(i+o)?i+=o:1===Math.abs(i-o)&&(i-=o)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,i,r),e.neighboringTiles&&e.neighboringTiles[a]&&(e.neighboringTiles[a].backfilled=!0)))}for(var i=this,r=this.getRenderableIds(),o=0;ot)){var n=Math.pow(2,s.tileID.canonical.z-e.canonical.z);if(Math.floor(s.tileID.canonical.x/n)===e.canonical.x&&Math.floor(s.tileID.canonical.y/n)===e.canonical.y)for(i[a]=s.tileID,o=!0;s&&s.tileID.overscaledZ-1>e.overscaledZ;){var l=s.tileID.scaledTo(s.tileID.overscaledZ-1);if(!l)break;s=r._tiles[l.key],s&&s.hasData()&&(delete i[a],i[l.key]=l)}}}return o},t.prototype.findLoadedParent=function(e,t,i){for(var r=this,o=e.overscaledZ-1;o>=t;o--){var a=e.scaledTo(o);if(!a)return;var s=String(a.key),n=r._tiles[s];if(n&&n.hasData())return i[s]=a,n;if(r._cache.has(s))return i[s]=a,r._cache.get(s)}},t.prototype.updateCacheSize=function(e){var t=Math.ceil(e.width/this._source.tileSize)+1,i=Math.ceil(e.height/this._source.tileSize)+1,r=t*i,o=Math.floor(5*r),a="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,o):o;this._cache.setMaxSize(a)},t.prototype.update=function(e){var i=this;if(this.transform=e,this._sourceLoaded&&!this._paused){this.updateCacheSize(e),this._coveredTiles={};var r;this.used?this._source.tileID?r=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(function(e){return new OverscaledTileID(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)}):(r=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&&(r=r.filter(function(e){return i._source.hasTile(e)}))):r=[];var o=(this._source.roundZoom?Math.round:Math.floor)(this.getZoom(e)),a=Math.max(o-t.maxOverzooming,this._source.minzoom),s=Math.max(o+t.maxUnderzooming,this._source.minzoom),n=this._updateRetainedTiles(r,o),l={};if(isRasterType(this._source.type))for(var c=Object.keys(n),h=0;h=browser.now())){i._findLoadedChildren(u,s,n)&&(n[d]=u);var p=i.findLoadedParent(u,a,l);p&&i._addTile(p.tileID)}}var m;for(m in l)n[m]||(i._coveredTiles[m]=!0);for(m in l)n[m]=l[m];for(var f=util.keysDifference(this._tiles,n),T=0;Tr._source.maxzoom){var _=c.children(r._source.maxzoom)[0],p=r.getTile(_);p&&p.hasData()?o[_.key]=_:u=!1}else{r._findLoadedChildren(c,n,o);for(var m=c.children(r._source.maxzoom),f=0;f=s;--T){var v=c.scaledTo(T);if(a[v.key])break;if(a[v.key]=!0,h=r.getTile(v),!h&&d&&(h=r._addTile(v)),h&&(o[v.key]=v,d=h.wasRequested(),h.hasData()))break}}}return o},t.prototype._addTile=function(e){var t=this._tiles[e.key];if(t)return t;(t=this._cache.getAndRemove(e.key))&&this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,t));var i=Boolean(t);return i||(t=new Tile(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(t,this._tileLoaded.bind(this,t,e.key,t.state))),t?(t.uses++,this._tiles[e.key]=t,i||this._source.fire("dataloading",{tile:t,coord:t.tileID,dataType:"source"}),t):null},t.prototype._setTileReloadTimer=function(e,t){var i=this;e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);var r=t.getExpiryTimeout();r&&(this._timers[e]=setTimeout(function(){i._reloadTile(e,"expired"),delete i._timers[e]},r))},t.prototype._setCacheInvalidationTimer=function(e,t){var i=this;e in this._cacheTimers&&(clearTimeout(this._cacheTimers[e]),delete this._cacheTimers[e]);var r=t.getExpiryTimeout();r&&(this._cacheTimers[e]=setTimeout(function(){i._cache.remove(e),delete i._cacheTimers[e]},r))},t.prototype._removeTile=function(e){var t=this._tiles[e];if(t&&(t.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),!(t.uses>0)))if(t.hasData()){t.tileID=t.tileID.wrapped();var i=t.tileID.key;this._cache.add(i,t),this._setCacheInvalidationTimer(i,t)}else t.aborted=!0,this._abortTile(t),this._unloadTile(t)},t.prototype.clearTiles=function(){var e=this;this._shouldReloadOnResume=!1,this._paused=!1;for(var t in e._tiles)e._removeTile(t);this._resetCache()},t.prototype._resetCache=function(){var e=this;for(var t in e._cacheTimers)clearTimeout(e._cacheTimers[t]);this._cacheTimers={},this._cache.reset()},t.prototype.tilesIn=function(e){for(var t=this,i=[],r=this.getIds(),o=1/0,a=1/0,s=-1/0,n=-1/0,l=e[0].zoom,c=0;c=0&&p[1].y>=0){for(var m=[],f=0;f=browser.now())return!0}return!1},t}(Evented);SourceCache.maxOverzooming=10,SourceCache.maxUnderzooming=3,module.exports=SourceCache; +},{"../data/extent":53,"../geo/coordinate":61,"../gl/context":66,"../util/browser":252,"../util/evented":260,"../util/lru_cache":266,"../util/util":275,"./source":110,"./tile":112,"./tile_id":114,"@mapbox/point-geometry":4}],112:[function(_dereq_,module,exports){ +"use strict";var util=_dereq_("../util/util"),deserializeBucket=_dereq_("../data/bucket").deserialize,FeatureIndex=_dereq_("../data/feature_index"),vt=_dereq_("@mapbox/vector-tile"),Protobuf=_dereq_("pbf"),GeoJSONFeature=_dereq_("../util/vectortile_to_geojson"),featureFilter=_dereq_("../style-spec/feature_filter"),CollisionIndex=_dereq_("../symbol/collision_index"),SymbolBucket=_dereq_("../data/bucket/symbol_bucket"),ref=_dereq_("../data/array_types"),RasterBoundsArray=ref.RasterBoundsArray,CollisionBoxArray=ref.CollisionBoxArray,rasterBoundsAttributes=_dereq_("../data/raster_bounds_attributes"),EXTENT=_dereq_("../data/extent"),Point=_dereq_("@mapbox/point-geometry"),Texture=_dereq_("../render/texture"),ref$1=_dereq_("../data/segment"),SegmentVector=ref$1.SegmentVector,ref$2=_dereq_("../data/index_array_type"),TriangleIndexArray=ref$2.TriangleIndexArray,browser=_dereq_("../util/browser"),CLOCK_SKEW_RETRY_TIMEOUT=3e4,Tile=function(e,t){this.tileID=e,this.uid=util.uniqueId(),this.uses=0,this.tileSize=t,this.buckets={},this.expirationTime=null,this.expiredRequestCount=0,this.state="loading"};Tile.prototype.registerFadeDuration=function(e){var t=e+this.timeAdded;t>n.z,u=new Point(n.x*l,n.y*l),h=new Point(u.x+l,u.y+l),d=i.segments.prepareSegment(4,r,a);r.emplaceBack(u.x,u.y,u.x,u.y),r.emplaceBack(h.x,u.y,h.x,u.y),r.emplaceBack(u.x,h.y,u.x,h.y),r.emplaceBack(h.x,h.y,h.x,h.y);var c=d.vertexLength;a.emplaceBack(c,c+1,c+2),a.emplaceBack(c+1,c+2,c+3),d.vertexLength+=4,d.primitiveLength+=2}this.maskedBoundsBuffer=t.createVertexBuffer(r,rasterBoundsAttributes.members),this.maskedIndexBuffer=t.createIndexBuffer(a)}},Tile.prototype.hasData=function(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state},Tile.prototype.setExpiryData=function(e){var t=this.expirationTime;if(e.cacheControl){var i=util.parseCacheControl(e.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+1e3*i["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){var r=Date.now(),a=!1;if(this.expirationTime>r)a=!1;else if(t)if(this.expirationTime=n.minX&&t.x=n.minY&&t.y0;c--)t=1<this.canonical.z?new OverscaledTileID(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new OverscaledTileID(e,this.wrap,e,this.canonical.x>>i,this.canonical.y>>i)},OverscaledTileID.prototype.isChildOf=function(e){var i=this.canonical.z-e.canonical.z;return 0===e.overscaledZ||e.overscaledZ>i&&e.canonical.y===this.canonical.y>>i},OverscaledTileID.prototype.children=function(e){if(this.overscaledZ>=e)return[new OverscaledTileID(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];var i=this.canonical.z+1,a=2*this.canonical.x,t=2*this.canonical.y;return[new OverscaledTileID(i,this.wrap,i,a,t),new OverscaledTileID(i,this.wrap,i,a+1,t),new OverscaledTileID(i,this.wrap,i,a,t+1),new OverscaledTileID(i,this.wrap,i,a+1,t+1)]},OverscaledTileID.prototype.isLessThan=function(e){return this.wrape.wrap)&&(this.overscaledZe.overscaledZ)&&(this.canonical.xe.canonical.x)&&this.canonical.y=I.maxzoom)&&"none"!==I.visibility)){recalculateLayers(x,t.zoom);(n[I.id]=I.createBucket({index:s.bucketLayerIDs.length,layers:x,zoom:t.zoom,pixelRatio:t.pixelRatio,overscaling:t.overscaling,collisionBoxArray:t.collisionBoxArray})).populate(d,c),s.bucketLayerIDs.push(x.map(function(e){return e.id}))}}}}var k,b,D,A=util.mapObject(c.glyphDependencies,function(e){return Object.keys(e).map(Number)});Object.keys(A).length?i.send("getGlyphs",{uid:this.uid,stacks:A},function(e,r){k||(k=e,b=r,a.call(t))}):b={};var z=Object.keys(c.iconDependencies);z.length?i.send("getImages",{icons:z},function(e,r){k||(k=e,D=r,a.call(t))}):D={},a.call(this)},module.exports=WorkerTile; +},{"../data/array_types":39,"../data/bucket/symbol_bucket":51,"../data/feature_index":54,"../render/glyph_atlas":85,"../render/image_atlas":87,"../style/evaluation_parameters":182,"../symbol/symbol_layout":227,"../util/dictionary_coder":257,"../util/util":275,"./tile_id":114}],120:[function(_dereq_,module,exports){ "use strict";function deref(r,e){var f={};for(var t in r)"ref"!==t&&(f[t]=r[t]);return refProperties.forEach(function(r){r in e&&(f[r]=e[r])}),f}function derefLayers(r){r=r.slice();for(var e=Object.create(null),f=0;f0;)t[o]=arguments[o+2];this.message=(r?r+": ":"")+format.apply(format,t),null!==i&&void 0!==i&&i.__line__&&(this.line=i.__line__)}var format=_dereq_("util").format;module.exports=ValidationError; -},{"util":45}],122:[function(_dereq_,module,exports){ -"use strict";function varargs(r){return{type:r}}function stringifySignature(r){return Array.isArray(r)?"("+r.map(toString).join(", ")+")":"("+toString(r.type)+"...)"}var ref=_dereq_("./types"),toString=ref.toString,ParsingContext=_dereq_("./parsing_context"),EvaluationContext=_dereq_("./evaluation_context"),CompoundExpression=function(r,e,n,t,o){this.key=r,this.name=e,this.type=n,this._evaluate=t,this.args=o};CompoundExpression.prototype.evaluate=function(r){return this._evaluate(r,this.args)},CompoundExpression.prototype.eachChild=function(r){this.args.forEach(r)},CompoundExpression.parse=function(r,e){var n=r[0],t=CompoundExpression.definitions[n];if(!t)return e.error('Unknown expression "'+n+'". If you wanted a literal array, use ["literal", [...]].',0);for(var o=Array.isArray(t)?t[0]:t.type,i=Array.isArray(t)?[[t[1],t[2]]]:t.overloads.filter(function(e){return!Array.isArray(e[0][0])||e[0][0].length===r.length-1}),s=[],a=1;a4)return r.error("Expected 1, 2, or 3 arguments, but found "+(e.length-1)+" instead.");var t,n;if(e.length>2){var i=e[1];if("string"!=typeof i||!(i in types))return r.error('The item type argument of "array" must be one of string, number, boolean',1);t=types[i]}else t=ValueType;if(e.length>3){if("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2]))return r.error('The length argument to "array" must be a positive integer literal',2);n=e[2]}var o=array(t,n),a=r.parse(e[e.length-1],e.length-1,ValueType);return a?new ArrayAssertion(r.key,o,a):null},ArrayAssertion.prototype.evaluate=function(e){var r=this.input.evaluate(e);if(checkSubtype(this.type,typeOf(r)))throw new RuntimeError("Expected value to be of type "+toString(this.type)+", but found "+toString(typeOf(r))+" instead.");return r},ArrayAssertion.prototype.eachChild=function(e){e(this.input)},module.exports=ArrayAssertion; -},{"../runtime_error":140,"../types":142,"../values":143}],124:[function(_dereq_,module,exports){ -"use strict";var ref=_dereq_("../types"),ObjectType=ref.ObjectType,ValueType=ref.ValueType,StringType=ref.StringType,NumberType=ref.NumberType,BooleanType=ref.BooleanType,RuntimeError=_dereq_("../runtime_error"),ref$1=_dereq_("../types"),checkSubtype=ref$1.checkSubtype,toString=ref$1.toString,ref$2=_dereq_("../values"),typeOf=ref$2.typeOf,types={string:StringType,number:NumberType,boolean:BooleanType,object:ObjectType},Assertion=function(e,r,t){this.key=e,this.type=r,this.args=t};Assertion.parse=function(e,r){if(e.length<2)return r.error("Expected at least one argument.");for(var t=e[0],n=types[t],o=[],p=1;p=t.length)throw new RuntimeError("Array index out of bounds: "+r+" > "+t.length+".");if(r!==Math.floor(r))throw new RuntimeError("Array index must be an integer, but found "+r+" instead.");return t[r]},At.prototype.eachChild=function(e){e(this.index),e(this.input)},module.exports=At; -},{"../runtime_error":140,"../types":142}],126:[function(_dereq_,module,exports){ -"use strict";var ref=_dereq_("../types"),BooleanType=ref.BooleanType,Case=function(e,r,t,a){this.key=e,this.type=r,this.branches=t,this.otherwise=a};Case.parse=function(e,r){if(e.length<4)return r.error("Expected at least 3 arguments, but found only "+(e.length-1)+".");if(e.length%2!=0)return r.error("Expected an odd number of arguments.");var t;r.expectedType&&"value"!==r.expectedType.kind&&(t=r.expectedType);for(var a=[],n=1;n4?"Invalid rbga value "+JSON.stringify(o)+": expected an array containing either three or four numeric values.":validateRGBA(o[0],o[1],o[2],o[3])))return new Color(o[0]/255,o[1]/255,o[2]/255,o[3])}throw new RuntimeError(t||"Could not parse color from value '"+("string"==typeof o?o:JSON.stringify(o))+"'")}for(var u=null,l=0,s=e.args;lt&&rr&&(o=u-1)}return Math.max(u-1,0)}var UnitBezier=_dereq_("@mapbox/unitbezier"),interpolate=_dereq_("../../util/interpolate"),ref=_dereq_("../types"),toString=ref.toString,NumberType=ref.NumberType,ref$1=_dereq_("../values"),Color=ref$1.Color,Curve=function(e,r,t,n,i){var a=this;this.key=e,this.type=r,this.interpolation=t,this.input=n,this.labels=[],this.outputs=[];for(var o=0,u=i;o1}))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);t={name:"cubic-bezier",controlPoints:o}}var u="step"===t.name,l=u?5:4;if(e.length-1c)return r.error('Input/output pairs for "curve" expressions must be arranged with input values in strictly ascending order.',m);var d=r.parse(h,b,v);if(!d)return null;v=v||d.type,s.push([c,d])}return"step"===t.name||"number"===v.kind||"color"===v.kind||"array"===v.kind&&"number"===v.itemType.kind?new Curve(r.key,v,t,n,s):r.error("Type "+toString(v)+" is not interpolatable, and thus cannot be used as a "+t.name+" curve's output type.")},Curve.prototype.evaluate=function(e){var r=this.labels,t=this.outputs;if(1===r.length)return t[0].evaluate(e);var n=this.input.evaluate(e);if(n<=r[0])return t[0].evaluate(e);var i=r.length;if(n>=r[i-1])return t[i-1].evaluate(e);var a=findStopLessThanOrEqualTo(r,n);if("step"===this.interpolation.name)return t[a].evaluate(e);var o=r[a],u=r[a+1],l=Curve.interpolationFactor(this.interpolation,n,o,u),p=t[a].evaluate(e),s=t[a+1].evaluate(e),v=this.type.kind.toLowerCase();return"color"===v?new(Function.prototype.bind.apply(Color,[null].concat(interpolate.color(p.value,s.value,l)))):interpolate[v](p,s,l)},Curve.prototype.eachChild=function(e){var r=this;e(this.input);for(var t=0,n=r.outputs;ta.evaluate(e)}function lteq(e,r){var t=r[0],a=r[1];return t.evaluate(e)<=a.evaluate(e)}function gteq(e,r){var t=r[0],a=r[1];return t.evaluate(e)>=a.evaluate(e)}var ref=_dereq_("../types"),NullType=ref.NullType,NumberType=ref.NumberType,StringType=ref.StringType,BooleanType=ref.BooleanType,ColorType=ref.ColorType,ObjectType=ref.ObjectType,ValueType=ref.ValueType,ErrorType=ref.ErrorType,array=ref.array,toString=ref.toString,ref$1=_dereq_("../values"),typeOf=ref$1.typeOf,Color=ref$1.Color,validateRGBA=ref$1.validateRGBA,ref$2=_dereq_("../compound_expression"),CompoundExpression=ref$2.CompoundExpression,varargs=ref$2.varargs,RuntimeError=_dereq_("../runtime_error"),Let=_dereq_("./let"),Var=_dereq_("./var"),Literal=_dereq_("./literal"),Assertion=_dereq_("./assertion"),ArrayAssertion=_dereq_("./array"),Coercion=_dereq_("./coercion"),At=_dereq_("./at"),Match=_dereq_("./match"),Case=_dereq_("./case"),Curve=_dereq_("./curve"),Coalesce=_dereq_("./coalesce"),expressions={let:Let,var:Var,literal:Literal,string:Assertion,number:Assertion,boolean:Assertion,object:Assertion,array:ArrayAssertion,"to-number":Coercion,"to-color":Coercion,at:At,case:Case,match:Match,coalesce:Coalesce,curve:Curve};CompoundExpression.register(expressions,{error:[ErrorType,[StringType],function(e,r){var t=r[0];throw new RuntimeError(t.evaluate(e))}],typeof:[StringType,[ValueType],function(e,r){var t=r[0];return toString(typeOf(t.evaluate(e)))}],"to-string":[StringType,[ValueType],function(e,r){var t=r[0];t=t.evaluate(e);var a=typeof t;if(null===t||"string"===a||"number"===a||"boolean"===a)return String(t);if(t instanceof Color){var n=t.value;return"rgba("+255*n[0]+", "+255*n[1]+", "+255*n[2]+", "+n[3]+")"}return JSON.stringify(t)}],"to-boolean":[BooleanType,[ValueType],function(e,r){var t=r[0];return Boolean(t.evaluate(e))}],"to-rgba":[array(NumberType,4),[ColorType],function(e,r){return r[0].evaluate(e).value}],rgb:[ColorType,[NumberType,NumberType,NumberType],rgba],rgba:[ColorType,[NumberType,NumberType,NumberType,NumberType],rgba],length:{type:NumberType,overloads:[[[StringType],length],[[array(ValueType)],length]]},has:{type:BooleanType,overloads:[[[StringType],function(e,r){return has(r[0].evaluate(e),e.properties())}],[[StringType,ObjectType],function(e,r){var t=r[0],a=r[1];return has(t.evaluate(e),a.evaluate(e))}]]},get:{type:ValueType,overloads:[[[StringType],function(e,r){return get(r[0].evaluate(e),e.properties())}],[[StringType,ObjectType],function(e,r){var t=r[0],a=r[1];return get(t.evaluate(e),a.evaluate(e))}]]},properties:[ObjectType,[],function(e){return e.properties()}],"geometry-type":[StringType,[],function(e){return e.geometryType()}],id:[ValueType,[],function(e){return e.id()}],zoom:[NumberType,[],function(e){return e.globals.zoom}],"heatmap-density":[NumberType,[],function(e){return e.globals.heatmapDensity||0}],"+":[NumberType,varargs(NumberType),function(e,r){for(var t=0,a=0,n=r;a":{type:BooleanType,overloads:[[[NumberType,NumberType],gt],[[StringType,StringType],gt]]},"<":{type:BooleanType,overloads:[[[NumberType,NumberType],lt],[[StringType,StringType],lt]]},">=":{type:BooleanType,overloads:[[[NumberType,NumberType],gteq],[[StringType,StringType],gteq]]},"<=":{type:BooleanType,overloads:[[[NumberType,NumberType],lteq],[[StringType,StringType],lteq]]},all:{type:BooleanType,overloads:[[[BooleanType,BooleanType],function(e,r){var t=r[0],a=r[1];return t.evaluate(e)&&a.evaluate(e)}],[varargs(BooleanType),function(e,r){for(var t=0,a=r;tNumber.MAX_SAFE_INTEGER)return l.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if("number"==typeof c&&Math.floor(c)!==c)return l.error("Numeric branch labels must be integer values.");if(r){if(l.checkSubtype(r,typeOf(c)))return null}else r=typeOf(c);if(void 0!==a[String(c)])return l.error("Branch labels must be unique.");a[String(c)]=u.length}var f=t.parse(h,s,n);if(!f)return null;n=n||f.type,u.push(f)}var y=t.parse(e[1],1,r);if(!y)return null;var b=t.parse(e[e.length-1],e.length-1,n);return b?new Match(t.key,r,n,y,a,u,b):null},Match.prototype.evaluate=function(e){var t=this.input.evaluate(e);return(this.outputs[this.cases[t]]||this.otherwise).evaluate(e)},Match.prototype.eachChild=function(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)},module.exports=Match; -},{"../values":143}],134:[function(_dereq_,module,exports){ -"use strict";var Var=function(e,r,t){this.key=e,this.type=t,this.name=r};Var.parse=function(e,r){if(2!==e.length||"string"!=typeof e[1])return r.error("'var' expression requires exactly one string literal argument.");var t=e[1];return r.scope.has(t)?new Var(r.key,t,r.scope.get(t).type):r.error('Unknown variable "'+t+'". Make sure "'+t+'" has been bound in an enclosing "let" expression before using it.',1)},Var.prototype.evaluate=function(e){return e.scope.get(this.name).evaluate(e)},Var.prototype.eachChild=function(){},module.exports=Var; -},{}],135:[function(_dereq_,module,exports){ -"use strict";var Scope=_dereq_("./scope"),parseColor=_dereq_("../util/parse_color"),ref=_dereq_("./values"),Color=ref.Color,geometryTypes=["Unknown","Point","LineString","Polygon"],EvaluationContext=function(){this.scope=new Scope,this._parseColorCache={}};EvaluationContext.prototype.id=function(){return this.feature&&"id"in this.feature?this.feature.id:null},EvaluationContext.prototype.geometryType=function(){return this.feature?"number"==typeof this.feature.type?geometryTypes[this.feature.type]:this.feature.type:null},EvaluationContext.prototype.properties=function(){return this.feature&&this.feature.properties||{}},EvaluationContext.prototype.pushScope=function(e){this.scope=this.scope.concat(e)},EvaluationContext.prototype.popScope=function(){this.scope=this.scope.parent},EvaluationContext.prototype.parseColor=function(e){var t=this._parseColorCache[e];if(!t){var o=parseColor(e);t=this._parseColorCache[e]=o?new Color(o[0],o[1],o[2],o[3]):null}return t},module.exports=EvaluationContext; -},{"../util/parse_color":153,"./scope":141,"./values":143}],136:[function(_dereq_,module,exports){ -"use strict";function isExpression(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in definitions}function createExpression(e,r,n,o){void 0===o&&(o={});var t=new ParsingContext(definitions,[],getExpectedType(r)),s=t.parse(e);if(!s)return{result:"error",errors:t.errors};var i,a=new EvaluationContext;if(!1===o.handleErrors)i=function(e,r){return a.globals=e,a.feature=r,s.evaluate(a)};else{var u={},l=getDefaultValue(r);i=function(e,r){a.globals=e,a.feature=r;try{var n=s.evaluate(a);return unwrap(null===n||void 0===n?l:n)}catch(e){return u[e.message]||(u[e.message]=!0,"undefined"!=typeof console&&console.warn(e.message)),unwrap(l)}}}var p=isConstant.isFeatureConstant(s);if(!p&&"property"===n&&!r["property-function"])return{result:"error",errors:[new ParsingError("","property expressions not supported")]};if(isConstant.isGlobalPropertyConstant(s,["zoom"]))return{result:"success",context:n,isZoomConstant:!0,isFeatureConstant:p,evaluate:i,parsed:s};if("filter"===n)return{result:"success",context:"filter",isZoomConstant:!1,isFeatureConstant:p,evaluate:i,parsed:s};var f=findZoomCurve(s);return f?f instanceof Curve?"step"!==f.interpolation.name&&"piecewise-constant"===r.function?{result:"error",errors:[new ParsingError(f.key,'interpolation type must be "step" for this property')]}:{result:"success",context:"property",isZoomConstant:!1,isFeatureConstant:p,evaluate:i,parsed:s,interpolation:f.interpolation,zoomStops:f.labels}:{result:"error",errors:[new ParsingError(f.key,f.error)]}:{result:"error",errors:[new ParsingError("",'"zoom" expression may only be used as input to a top-level "curve" expression.')]}}function findZoomCurve(e){if(e instanceof Curve){var r=e.input;return r instanceof CompoundExpression&&"zoom"===r.name?e:null}if(e instanceof Let)return findZoomCurve(e.result);if(e instanceof Coalesce){for(var n=null,o=0,t=e.args;o=0)return!1;var t=!0;return n.eachChild(function(n){t&&!isGlobalPropertyConstant(n,e)&&(t=!1)}),t}var ref=_dereq_("./compound_expression"),CompoundExpression=ref.CompoundExpression;module.exports={isFeatureConstant:isFeatureConstant,isGlobalPropertyConstant:isGlobalPropertyConstant}; -},{"./compound_expression":122}],138:[function(_dereq_,module,exports){ -"use strict";function isConstant(e){var r=_dereq_("./compound_expression"),t=r.CompoundExpression,n=_dereq_("./is_constant"),i=n.isGlobalPropertyConstant,o=n.isFeatureConstant;if(e instanceof _dereq_("./definitions/var"))return!1;if(e instanceof t&&"error"===e.name)return!1;var a=!0;return e.eachChild(function(e){e instanceof Literal||(a=!1)}),!!a&&(o(e)&&i(e,["zoom","heatmap-density"]))}var Scope=_dereq_("./scope"),ref=_dereq_("./types"),checkSubtype=ref.checkSubtype,ParsingError=_dereq_("./parsing_error"),Literal=_dereq_("./definitions/literal"),ParsingContext=function(e,r,t,n,i){void 0===r&&(r=[]),void 0===n&&(n=new Scope),void 0===i&&(i=[]),this.definitions=e,this.path=r,this.key=r.map(function(e){return"["+e+"]"}).join(""),this.scope=n,this.errors=i,this.expectedType=t};ParsingContext.prototype.parse=function(e,r,t,n){var i=this;if(r&&(i=i.concat(r,t,n)),null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return i.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');var o=e[0];if("string"!=typeof o)return i.error("Expression name must be a string, but found "+typeof o+' instead. If you wanted a literal array, use ["literal", [...]].',0),null;var a=i.definitions[o];if(a){var s=a.parse(e,i);if(!s)return null;var u=i.expectedType,l=s.type;if(u){if(("string"===u.kind||"number"===u.kind||"boolean"===u.kind)&&"value"===l.kind){s=new(_dereq_("./definitions/assertion"))(s.key,u,[s])}else if("color"===u.kind&&("value"===l.kind||"string"===l.kind)){var p=_dereq_("./definitions/coercion");s=new p(s.key,u,[s])}if(i.checkSubtype(u,s.type))return null}if(!(s instanceof Literal)&&isConstant(s)){var c=new(_dereq_("./evaluation_context"));try{s=new Literal(s.key,s.type,s.evaluate(c))}catch(e){return i.error(e.message),null}}return s}return i.error('Unknown expression "'+o+'". If you wanted a literal array, use ["literal", [...]].',0)}return void 0===e?i.error("'undefined' value invalid. Use null instead."):"object"==typeof e?i.error('Bare objects invalid. Use ["literal", {...}] instead.'):i.error("Expected an array, but found "+typeof e+" instead.")},ParsingContext.prototype.concat=function(e,r,t){var n="number"==typeof e?this.path.concat(e):this.path,i=t?this.scope.concat(t):this.scope;return new ParsingContext(this.definitions,n,r||null,i,this.errors)},ParsingContext.prototype.error=function(e){for(var r=[],t=arguments.length-1;t-- >0;)r[t]=arguments[t+1];var n=""+this.key+r.map(function(e){return"["+e+"]"}).join("");this.errors.push(new ParsingError(n,e))},ParsingContext.prototype.checkSubtype=function(e,r){var t=checkSubtype(e,r);return t&&this.error(t),t},module.exports=ParsingContext; -},{"./compound_expression":122,"./definitions/assertion":124,"./definitions/coercion":128,"./definitions/literal":132,"./definitions/var":134,"./evaluation_context":135,"./is_constant":137,"./parsing_error":139,"./scope":141,"./types":142}],139:[function(_dereq_,module,exports){ +},{"./util/ref_properties":159}],121:[function(_dereq_,module,exports){ +"use strict";function addSource(e,r,o){o.push({command:operations.addSource,args:[e,r[e]]})}function removeSource(e,r,o){r.push({command:operations.removeSource,args:[e]}),o[e]=!0}function updateSource(e,r,o,a){removeSource(e,o,a),addSource(e,r,o)}function canUpdateGeoJSON(e,r,o){var a;for(a in e[o])if(e[o].hasOwnProperty(a)&&"data"!==a&&!isEqual(e[o][a],r[o][a]))return!1;for(a in r[o])if(r[o].hasOwnProperty(a)&&"data"!==a&&!isEqual(e[o][a],r[o][a]))return!1;return!0}function diffSources(e,r,o,a){e=e||{},r=r||{};var t;for(t in e)e.hasOwnProperty(t)&&(r.hasOwnProperty(t)||removeSource(t,o,a));for(t in r)r.hasOwnProperty(t)&&(e.hasOwnProperty(t)?isEqual(e[t],r[t])||("geojson"===e[t].type&&"geojson"===r[t].type&&canUpdateGeoJSON(e,r,t)?o.push({command:operations.setGeoJSONSourceData,args:[t,r[t].data]}):updateSource(t,r,o,a)):addSource(t,r,o))}function diffLayerPropertyChanges(e,r,o,a,t,s){e=e||{},r=r||{};var n;for(n in e)e.hasOwnProperty(n)&&(isEqual(e[n],r[n])||o.push({command:s,args:[a,n,r[n],t]}));for(n in r)r.hasOwnProperty(n)&&!e.hasOwnProperty(n)&&(isEqual(e[n],r[n])||o.push({command:s,args:[a,n,r[n],t]}))}function pluckId(e){return e.id}function indexById(e,r){return e[r.id]=r,e}function diffLayers(e,r,o){e=e||[],r=r||[];var a,t,s,n,i,p,u,m=e.map(pluckId),c=r.map(pluckId),l=e.reduce(indexById,{}),d=r.reduce(indexById,{}),y=m.slice(),h=Object.create(null);for(a=0,t=0;a4)return r.error("Expected 1, 2, or 3 arguments, but found "+(e.length-1)+" instead.");var t,n;if(e.length>2){var i=e[1];if("string"!=typeof i||!(i in types))return r.error('The item type argument of "array" must be one of string, number, boolean',1);t=types[i]}else t=ValueType;if(e.length>3){if("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2]))return r.error('The length argument to "array" must be a positive integer literal',2);n=e[2]}var o=array(t,n),u=r.parse(e[e.length-1],e.length-1,ValueType);return u?new ArrayAssertion(o,u):null},ArrayAssertion.prototype.evaluate=function(e){var r=this.input.evaluate(e);if(checkSubtype(this.type,typeOf(r)))throw new RuntimeError("Expected value to be of type "+toString(this.type)+", but found "+toString(typeOf(r))+" instead.");return r},ArrayAssertion.prototype.eachChild=function(e){e(this.input)},ArrayAssertion.prototype.possibleOutputs=function(){return this.input.possibleOutputs()},module.exports=ArrayAssertion; +},{"../runtime_error":143,"../types":146,"../values":147}],125:[function(_dereq_,module,exports){ +"use strict";var ref=_dereq_("../types"),ObjectType=ref.ObjectType,ValueType=ref.ValueType,StringType=ref.StringType,NumberType=ref.NumberType,BooleanType=ref.BooleanType,RuntimeError=_dereq_("../runtime_error"),ref$1=_dereq_("../types"),checkSubtype=ref$1.checkSubtype,toString=ref$1.toString,ref$2=_dereq_("../values"),typeOf=ref$2.typeOf,types={string:StringType,number:NumberType,boolean:BooleanType,object:ObjectType},Assertion=function(e,r){this.type=e,this.args=r};Assertion.parse=function(e,r){if(e.length<2)return r.error("Expected at least one argument.");for(var t=e[0],n=types[t],o=[],p=1;p=r.length)throw new RuntimeError("Array index out of bounds: "+t+" > "+r.length+".");if(t!==Math.floor(t))throw new RuntimeError("Array index must be an integer, but found "+t+" instead.");return r[t]},At.prototype.eachChild=function(e){e(this.index),e(this.input)},At.prototype.possibleOutputs=function(){return[void 0]},module.exports=At; +},{"../runtime_error":143,"../types":146}],127:[function(_dereq_,module,exports){ +"use strict";var ref=_dereq_("../types"),BooleanType=ref.BooleanType,Case=function(e,t,r){this.type=e,this.branches=t,this.otherwise=r};Case.parse=function(e,t){if(e.length<4)return t.error("Expected at least 3 arguments, but found only "+(e.length-1)+".");if(e.length%2!=0)return t.error("Expected an odd number of arguments.");var r;t.expectedType&&"value"!==t.expectedType.kind&&(r=t.expectedType);for(var n=[],a=1;a4?"Invalid rbga value "+JSON.stringify(t)+": expected an array containing either three or four numeric values.":validateRGBA(t[0],t[1],t[2],t[3])))return new Color(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new RuntimeError(o||"Could not parse color from value '"+("string"==typeof t?t:JSON.stringify(t))+"'")}for(var u=null,l=0,s=e.args;la.evaluate(e)}function lteq(e,r){var t=r[0],a=r[1];return t.evaluate(e)<=a.evaluate(e)}function gteq(e,r){var t=r[0],a=r[1];return t.evaluate(e)>=a.evaluate(e)}function binarySearch(e,r,t,a){for(;t<=a;){var n=t+a>>1;if(r[n]===e)return!0;r[n]>e?a=n-1:t=n+1}return!1}var ref=_dereq_("../types"),NumberType=ref.NumberType,StringType=ref.StringType,BooleanType=ref.BooleanType,ColorType=ref.ColorType,ObjectType=ref.ObjectType,ValueType=ref.ValueType,ErrorType=ref.ErrorType,array=ref.array,toString=ref.toString,ref$1=_dereq_("../values"),typeOf=ref$1.typeOf,Color=ref$1.Color,validateRGBA=ref$1.validateRGBA,ref$2=_dereq_("../compound_expression"),CompoundExpression=ref$2.CompoundExpression,varargs=ref$2.varargs,RuntimeError=_dereq_("../runtime_error"),Let=_dereq_("./let"),Var=_dereq_("./var"),Literal=_dereq_("./literal"),Assertion=_dereq_("./assertion"),ArrayAssertion=_dereq_("./array"),Coercion=_dereq_("./coercion"),At=_dereq_("./at"),Match=_dereq_("./match"),Case=_dereq_("./case"),Step=_dereq_("./step"),Interpolate=_dereq_("./interpolate"),Coalesce=_dereq_("./coalesce"),ref$3=_dereq_("./equals"),Equals=ref$3.Equals,NotEquals=ref$3.NotEquals,expressions={"==":Equals,"!=":NotEquals,array:ArrayAssertion,at:At,boolean:Assertion,case:Case,coalesce:Coalesce,interpolate:Interpolate,let:Let,literal:Literal,match:Match,number:Assertion,object:Assertion,step:Step,string:Assertion,"to-color":Coercion,"to-number":Coercion,var:Var};CompoundExpression.register(expressions,{error:[ErrorType,[StringType],function(e,r){var t=r[0];throw new RuntimeError(t.evaluate(e))}],typeof:[StringType,[ValueType],function(e,r){var t=r[0];return toString(typeOf(t.evaluate(e)))}],"to-string":[StringType,[ValueType],function(e,r){var t=r[0];t=t.evaluate(e);var a=typeof t;return null===t||"string"===a||"number"===a||"boolean"===a?String(t):t instanceof Color?t.toString():JSON.stringify(t)}],"to-boolean":[BooleanType,[ValueType],function(e,r){var t=r[0];return Boolean(t.evaluate(e))}],"to-rgba":[array(NumberType,4),[ColorType],function(e,r){var t=r[0],a=t.evaluate(e),n=a.r,u=a.g,o=a.b,p=a.a;return[255*n/p,255*u/p,255*o/p,p]}],rgb:[ColorType,[NumberType,NumberType,NumberType],rgba],rgba:[ColorType,[NumberType,NumberType,NumberType,NumberType],rgba],length:{type:NumberType,overloads:[[[StringType],length],[[array(ValueType)],length]]},has:{type:BooleanType,overloads:[[[StringType],function(e,r){return has(r[0].evaluate(e),e.properties())}],[[StringType,ObjectType],function(e,r){var t=r[0],a=r[1];return has(t.evaluate(e),a.evaluate(e))}]]},get:{type:ValueType,overloads:[[[StringType],function(e,r){return get(r[0].evaluate(e),e.properties())}],[[StringType,ObjectType],function(e,r){var t=r[0],a=r[1];return get(t.evaluate(e),a.evaluate(e))}]]},properties:[ObjectType,[],function(e){return e.properties()}],"geometry-type":[StringType,[],function(e){return e.geometryType()}],id:[ValueType,[],function(e){return e.id()}],zoom:[NumberType,[],function(e){return e.globals.zoom}],"heatmap-density":[NumberType,[],function(e){return e.globals.heatmapDensity||0}],"+":[NumberType,varargs(NumberType),function(e,r){for(var t=0,a=0,n=r;a":[BooleanType,[StringType,ValueType],function(e,r){var t=r[0],a=r[1],n=e.properties()[t.value],u=a.value;return typeof n==typeof u&&n>u}],"filter-id->":[BooleanType,[ValueType],function(e,r){var t=r[0],a=e.id(),n=t.value;return typeof a==typeof n&&a>n}],"filter-<=":[BooleanType,[StringType,ValueType],function(e,r){var t=r[0],a=r[1],n=e.properties()[t.value],u=a.value;return typeof n==typeof u&&n<=u}],"filter-id-<=":[BooleanType,[ValueType],function(e,r){var t=r[0],a=e.id(),n=t.value;return typeof a==typeof n&&a<=n}],"filter->=":[BooleanType,[StringType,ValueType],function(e,r){var t=r[0],a=r[1],n=e.properties()[t.value],u=a.value;return typeof n==typeof u&&n>=u}],"filter-id->=":[BooleanType,[ValueType],function(e,r){var t=r[0],a=e.id(),n=t.value;return typeof a==typeof n&&a>=n}],"filter-has":[BooleanType,[ValueType],function(e,r){return r[0].value in e.properties()}],"filter-has-id":[BooleanType,[],function(e){return null!==e.id()}],"filter-type-in":[BooleanType,[array(StringType)],function(e,r){return r[0].value.indexOf(e.geometryType())>=0}],"filter-id-in":[BooleanType,[array(ValueType)],function(e,r){return r[0].value.indexOf(e.id())>=0}],"filter-in-small":[BooleanType,[StringType,array(ValueType)],function(e,r){var t=r[0];return r[1].value.indexOf(e.properties()[t.value])>=0}],"filter-in-large":[BooleanType,[StringType,array(ValueType)],function(e,r){var t=r[0],a=r[1];return binarySearch(e.properties()[t.value],a.value,0,a.value.length-1)}],">":{type:BooleanType,overloads:[[[NumberType,NumberType],gt],[[StringType,StringType],gt]]},"<":{type:BooleanType,overloads:[[[NumberType,NumberType],lt],[[StringType,StringType],lt]]},">=":{type:BooleanType,overloads:[[[NumberType,NumberType],gteq],[[StringType,StringType],gteq]]},"<=":{type:BooleanType,overloads:[[[NumberType,NumberType],lteq],[[StringType,StringType],lteq]]},all:{type:BooleanType,overloads:[[[BooleanType,BooleanType],function(e,r){var t=r[0],a=r[1];return t.evaluate(e)&&a.evaluate(e)}],[varargs(BooleanType),function(e,r){for(var t=0,a=r;t1}))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:a}}if(e.length-1<4)return t.error("Expected at least 4 arguments, but found only "+(e.length-1)+".");if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");if(!(n=t.parse(n,2,NumberType)))return null;var u=[],p=null;t.expectedType&&"value"!==t.expectedType.kind&&(p=t.expectedType);for(var l=0;l=s)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',c);var v=t.parse(f,h,p);if(!v)return null;p=p||v.type,u.push([s,v])}return"number"===p.kind||"color"===p.kind||"array"===p.kind&&"number"===p.itemType.kind&&"number"==typeof p.N?new Interpolate(p,r,n,u):t.error("Type "+toString(p)+" is not interpolatable.")},Interpolate.prototype.evaluate=function(e){var t=this.labels,r=this.outputs;if(1===t.length)return r[0].evaluate(e);var n=this.input.evaluate(e);if(n<=t[0])return r[0].evaluate(e);var i=t.length;if(n>=t[i-1])return r[i-1].evaluate(e);var o=findStopLessThanOrEqualTo(t,n),a=t[o],u=t[o+1],p=Interpolate.interpolationFactor(this.interpolation,n,a,u),l=r[o].evaluate(e),s=r[o+1].evaluate(e);return interpolate[this.type.kind.toLowerCase()](l,s,p)},Interpolate.prototype.eachChild=function(e){var t=this;e(this.input);for(var r=0,n=t.outputs;rNumber.MAX_SAFE_INTEGER)return p.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if("number"==typeof c&&Math.floor(c)!==c)return p.error("Numeric branch labels must be integer values.");if(r){if(p.checkSubtype(r,typeOf(c)))return null}else r=typeOf(c);if(void 0!==u[String(c)])return p.error("Branch labels must be unique.");u[String(c)]=s.length}var f=t.parse(o,a,n);if(!f)return null;n=n||f.type,s.push(f)}var b=t.parse(e[1],1,r);if(!b)return null;var y=t.parse(e[e.length-1],e.length-1,n);return y?new Match(r,n,b,u,s,y):null},Match.prototype.evaluate=function(e){var t=this.input.evaluate(e);return(this.outputs[this.cases[t]]||this.otherwise).evaluate(e)},Match.prototype.eachChild=function(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)},Match.prototype.possibleOutputs=function(){return(e=[]).concat.apply(e,this.outputs.map(function(e){return e.possibleOutputs()})).concat(this.otherwise.possibleOutputs());var e},module.exports=Match; +},{"../values":147}],136:[function(_dereq_,module,exports){ +"use strict";var ref=_dereq_("../types"),NumberType=ref.NumberType,ref$1=_dereq_("../stops"),findStopLessThanOrEqualTo=ref$1.findStopLessThanOrEqualTo,Step=function(e,t,r){var u=this;this.type=e,this.input=t,this.labels=[],this.outputs=[];for(var n=0,s=r;n=a)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',o);var f=t.parse(i,l,s);if(!f)return null;s=s||f.type,n.push([a,f])}return new Step(s,r,n)},Step.prototype.evaluate=function(e){var t=this.labels,r=this.outputs;if(1===t.length)return r[0].evaluate(e);var u=this.input.evaluate(e);if(u<=t[0])return r[0].evaluate(e);var n=t.length;return u>=t[n-1]?r[n-1].evaluate(e):r[findStopLessThanOrEqualTo(t,u)].evaluate(e)},Step.prototype.eachChild=function(e){var t=this;e(this.input);for(var r=0,u=t.outputs;r0&&"string"==typeof e[0]&&e[0]in definitions}function createExpression(e,r,n){void 0===n&&(n={});var t=new ParsingContext(definitions,[],getExpectedType(r)),o=t.parse(e);return o?success(!1===n.handleErrors?new StyleExpression(o):new StyleExpressionWithErrorHandling(o,r)):error(t.errors)}function createPropertyExpression(e,r,n){if(void 0===n&&(n={}),e=createExpression(e,r,n),"error"===e.result)return e;var t=e.value.expression,o=isConstant.isFeatureConstant(t);if(!o&&!r["property-function"])return error([new ParsingError("","property expressions not supported")]);var i=isConstant.isGlobalPropertyConstant(t,["zoom"]);if(!i&&!1===r["zoom-function"])return error([new ParsingError("","zoom expressions not supported")]);var s=findZoomCurve(t);return s||i?s instanceof ParsingError?error([s]):s instanceof Interpolate&&"piecewise-constant"===r.function?error([new ParsingError("",'"interpolate" expressions cannot be used with this property')]):success(s?o?new ZoomDependentExpression("camera",e.value,s):new ZoomDependentExpression("composite",e.value,s):o?new ZoomConstantExpression("constant",e.value):new ZoomConstantExpression("source",e.value)):error([new ParsingError("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}function normalizePropertyExpression(e,r){if(isFunction(e))return new StylePropertyFunction(e,r);if(isExpression(e)){var n=createPropertyExpression(e,r);if("error"===n.result)throw new Error(n.value.map(function(e){return e.key+": "+e.message}).join(", "));return n.value}var t=e;return"string"==typeof e&&"color"===r.type&&(t=Color.parse(e)),{kind:"constant",evaluate:function(){return t}}}function findZoomCurve(e){var r=null;if(e instanceof Let)r=findZoomCurve(e.result);else if(e instanceof Coalesce)for(var n=0,t=e.args;n=0)return!1;var t=!0;return n.eachChild(function(n){t&&!isGlobalPropertyConstant(n,e)&&(t=!1)}),t}var ref=_dereq_("./compound_expression"),CompoundExpression=ref.CompoundExpression;module.exports={isFeatureConstant:isFeatureConstant,isGlobalPropertyConstant:isGlobalPropertyConstant}; +},{"./compound_expression":123}],141:[function(_dereq_,module,exports){ +"use strict";function isConstant(e){var r=_dereq_("./compound_expression"),t=r.CompoundExpression,n=_dereq_("./is_constant"),i=n.isGlobalPropertyConstant,o=n.isFeatureConstant;if(e instanceof _dereq_("./definitions/var"))return!1;if(e instanceof t&&"error"===e.name)return!1;var a=!0;return e.eachChild(function(e){e instanceof Literal||(a=!1)}),!!a&&(o(e)&&i(e,["zoom","heatmap-density"]))}var Scope=_dereq_("./scope"),ref=_dereq_("./types"),checkSubtype=ref.checkSubtype,ParsingError=_dereq_("./parsing_error"),Literal=_dereq_("./definitions/literal"),Assertion=_dereq_("./definitions/assertion"),ArrayAssertion=_dereq_("./definitions/array"),Coercion=_dereq_("./definitions/coercion"),ParsingContext=function(e,r,t,n,i){void 0===r&&(r=[]),void 0===n&&(n=new Scope),void 0===i&&(i=[]),this.registry=e,this.path=r,this.key=r.map(function(e){return"["+e+"]"}).join(""),this.scope=n,this.errors=i,this.expectedType=t};ParsingContext.prototype.parse=function(e,r,t,n,i){void 0===i&&(i={});var o=this;if(r&&(o=o.concat(r,t,n)),null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return o.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');var a=e[0];if("string"!=typeof a)return o.error("Expression name must be a string, but found "+typeof a+' instead. If you wanted a literal array, use ["literal", [...]].',0),null;var s=o.registry[a];if(s){var u=s.parse(e,o);if(!u)return null;if(o.expectedType){var p=o.expectedType,l=u.type;if("string"!==p.kind&&"number"!==p.kind&&"boolean"!==p.kind||"value"!==l.kind)if("array"===p.kind&&"value"===l.kind)i.omitTypeAnnotations||(u=new ArrayAssertion(p,u));else if("color"!==p.kind||"value"!==l.kind&&"string"!==l.kind){if(o.checkSubtype(o.expectedType,u.type))return null}else i.omitTypeAnnotations||(u=new Coercion(p,[u]));else i.omitTypeAnnotations||(u=new Assertion(p,[u]))}if(!(u instanceof Literal)&&isConstant(u)){var c=new(_dereq_("./evaluation_context"));try{u=new Literal(u.type,u.evaluate(c))}catch(e){return o.error(e.message),null}}return u}return o.error('Unknown expression "'+a+'". If you wanted a literal array, use ["literal", [...]].',0)}return void 0===e?o.error("'undefined' value invalid. Use null instead."):"object"==typeof e?o.error('Bare objects invalid. Use ["literal", {...}] instead.'):o.error("Expected an array, but found "+typeof e+" instead.")},ParsingContext.prototype.concat=function(e,r,t){var n="number"==typeof e?this.path.concat(e):this.path,i=t?this.scope.concat(t):this.scope;return new ParsingContext(this.registry,n,r||null,i,this.errors)},ParsingContext.prototype.error=function(e){for(var r=[],t=arguments.length-1;t-- >0;)r[t]=arguments[t+1];var n=""+this.key+r.map(function(e){return"["+e+"]"}).join("");this.errors.push(new ParsingError(n,e))},ParsingContext.prototype.checkSubtype=function(e,r){var t=checkSubtype(e,r);return t&&this.error(t),t},module.exports=ParsingContext; +},{"./compound_expression":123,"./definitions/array":124,"./definitions/assertion":125,"./definitions/coercion":129,"./definitions/literal":134,"./definitions/var":137,"./evaluation_context":138,"./is_constant":140,"./parsing_error":142,"./scope":144,"./types":146}],142:[function(_dereq_,module,exports){ "use strict";var ParsingError=function(r){function t(t,o){r.call(this,o),this.message=o,this.key=t}return r&&(t.__proto__=r),t.prototype=Object.create(r&&r.prototype),t.prototype.constructor=t,t}(Error);module.exports=ParsingError; -},{}],140:[function(_dereq_,module,exports){ -"use strict";var RuntimeError=function(r){this.name="ExpressionEvaluationError",this.message=r};RuntimeError.prototype.toJSON=function(){return this.message},module.exports=RuntimeError; -},{}],141:[function(_dereq_,module,exports){ -"use strict";var Scope=function(t,n){var i=this;void 0===n&&(n=[]),this.parent=t,this.bindings={};for(var e=0,r=n;e":"value"===e.itemType.kind?"array":"array<"+r+">"}return e.kind}function checkSubtype(e,r){if("error"===r.kind)return null;if("array"===e.kind){if("array"===r.kind&&!checkSubtype(e.itemType,r.itemType)&&("number"!=typeof e.N||e.N===r.N))return null}else{if(e.kind===r.kind)return null;if("value"===e.kind)for(var n=0,y=valueMemberTypes;n=0&&e<=255&&"number"==typeof r&&r>=0&&r<=255&&"number"==typeof n&&n>=0&&n<=255)){return"Invalid rgba value ["+("number"==typeof t?[e,r,n,t]:[e,r,n]).join(", ")+"]: 'r', 'g', and 'b' must be between 0 and 255."}return void 0===t||"number"==typeof t&&t>=0&&t<=1?null:"Invalid rgba value ["+[e,r,n,t].join(", ")+"]: 'a' must be between 0 and 1."}function isValue(e){if(null===e)return!0;if("string"==typeof e)return!0;if("boolean"==typeof e)return!0;if("number"==typeof e)return!0;if(e instanceof Color)return!0;if(Array.isArray(e)){for(var r=0,n=e;r=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3===e.length&&(Array.isArray(e[1])||Array.isArray(e[2]));case"any":case"all":for(var r=0,i=e.slice(1);r"===r||"<="===r||">="===r?compileComparisonOp(e[1],e[2],r,!0):"any"===r?compileLogicalOp(e.slice(1),"||"):"all"===r?compileLogicalOp(e.slice(1),"&&"):"none"===r?compileNegation(compileLogicalOp(e.slice(1),"||")):"in"===r?compileInOp(e[1],e.slice(2)):"!in"===r?compileNegation(compileInOp(e[1],e.slice(2))):"has"===r?compileHasOp(e[1]):"!has"===r?compileNegation(compileHasOp(e[1])):"true")+")"}function compilePropertyReference(e){return"$type"===e?"f.type":"$id"===e?"f.id":"p["+JSON.stringify(e)+"]"}function compileComparisonOp(e,r,i,n){var t=compilePropertyReference(e),o="$type"===e?types.indexOf(r):JSON.stringify(r);return(n?"typeof "+t+"=== typeof "+o+"&&":"")+t+i+o}function compileLogicalOp(e,r){return e.map(compile).join(r)}function compileInOp(e,r){"$type"===e&&(r=r.map(function(e){return types.indexOf(e)}));var i=JSON.stringify(r.sort(compare)),n=compilePropertyReference(e);return r.length<=200?i+".indexOf("+n+") !== -1":"function(v, a, i, j) {while (i <= j) { var m = (i + j) >> 1; if (a[m] === v) return true; if (a[m] > v) j = m - 1; else i = m + 1;}return false; }("+n+", "+i+",0,"+(r.length-1)+")"}function compileHasOp(e){return"$id"===e?'"id" in f':JSON.stringify(e)+" in p"}function compileNegation(e){return"!("+e+")"}function compare(e,r){return er?1:0}var ref=_dereq_("../expression"),createExpression=ref.createExpression;module.exports=createFilter,module.exports.isExpressionFilter=isExpressionFilter;var types=["Unknown","Point","LineString","Polygon"],filterSpec={type:"boolean",default:!1,function:!0,"property-function":!0}; -},{"../expression":136}],145:[function(_dereq_,module,exports){ -"use strict";function isFunction(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function identityFunction(t){return t}function createFunction(t,e,o){var n="color"===e.type,r=t.stops&&"object"==typeof t.stops[0][0],a=r||void 0!==t.property,i=r||!a,s=t.type||("interpolated"===e.function?"exponential":"interval");n&&(t=extend({},t),t.stops&&(t.stops=t.stops.map(function(t){return[t[0],parseColor(t[1])]})),t.default?t.default=parseColor(t.default):t.default=parseColor(e.default));var u,p,l;if("exponential"===s)u=evaluateExponentialFunction;else if("interval"===s)u=evaluateIntervalFunction;else if("categorical"===s){u=evaluateCategoricalFunction,p=Object.create(null);for(var c=0,f=t.stops;c=t.stops[n-1][0])return t.stops[n-1][1];var r=findStopLessThanOrEqualTo(t.stops,o);return t.stops[r][1]}function evaluateExponentialFunction(t,e,o){var n=void 0!==t.base?t.base:1;if("number"!==getType(o))return coalesce(t.default,e.default);var r=t.stops.length;if(1===r)return t.stops[0][1];if(o<=t.stops[0][0])return t.stops[0][1];if(o>=t.stops[r-1][0])return t.stops[r-1][1];var a=findStopLessThanOrEqualTo(t.stops,o),i=interpolationFactor(o,n,t.stops[a][0],t.stops[a+1][0]),s=t.stops[a][1],u=t.stops[a+1][1],p=interpolate[e.type]||identityFunction;return"function"==typeof s.evaluate?{evaluate:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var o=s.evaluate.apply(void 0,t),n=u.evaluate.apply(void 0,t);if(void 0!==o&&void 0!==n)return p(o,n,i)}}:p(s,u,i)}function evaluateIdentityFunction(t,e,o){return"color"===e.type?o=parseColor(o):getType(o)===e.type||"enum"===e.type&&e.values[o]||(o=void 0),coalesce(o,t.default,e.default)}function findStopLessThanOrEqualTo(t,e){for(var o,n,r=t.length,a=0,i=r-1,s=0;a<=i;){if(s=Math.floor((a+i)/2),o=t[s][0],n=t[s+1][0],e===o||e>o&&ee&&(i=s-1)}return Math.max(s-1,0)}function interpolationFactor(t,e,o,n){var r=n-o,a=t-o;return 0===r?0:1===e?a/r:(Math.pow(e,a)-1)/(Math.pow(e,r)-1)}var colorSpaces=_dereq_("../util/color_spaces"),parseColor=_dereq_("../util/parse_color"),extend=_dereq_("../util/extend"),getType=_dereq_("../util/get_type"),interpolate=_dereq_("../util/interpolate");module.exports={createFunction:createFunction,isFunction:isFunction}; -},{"../util/color_spaces":149,"../util/extend":150,"../util/get_type":151,"../util/interpolate":152,"../util/parse_color":153}],146:[function(_dereq_,module,exports){ +"use strict";var RuntimeError=function(r){this.name="ExpressionEvaluationError",this.message=r};RuntimeError.prototype.toJSON=function(){return this.message},module.exports=RuntimeError; +},{}],144:[function(_dereq_,module,exports){ +"use strict";var Scope=function(t,n){var i=this;void 0===n&&(n=[]),this.parent=t,this.bindings={};for(var e=0,r=n;en&&ee))throw new RuntimeError("Input is not a number.");i=a-1}}return Math.max(a-1,0)}var RuntimeError=_dereq_("./runtime_error");module.exports={findStopLessThanOrEqualTo:findStopLessThanOrEqualTo}; +},{"./runtime_error":143}],146:[function(_dereq_,module,exports){ +"use strict";function array(e,r){return{kind:"array",itemType:e,N:r}}function toString(e){if("array"===e.kind){var r=toString(e.itemType);return"number"==typeof e.N?"array<"+r+", "+e.N+">":"value"===e.itemType.kind?"array":"array<"+r+">"}return e.kind}function checkSubtype(e,r){if("error"===r.kind)return null;if("array"===e.kind){if("array"===r.kind&&!checkSubtype(e.itemType,r.itemType)&&("number"!=typeof e.N||e.N===r.N))return null}else{if(e.kind===r.kind)return null;if("value"===e.kind)for(var n=0,y=valueMemberTypes;n=0&&e<=255&&"number"==typeof r&&r>=0&&r<=255&&"number"==typeof t&&t>=0&&t<=255)){return"Invalid rgba value ["+("number"==typeof n?[e,r,t,n]:[e,r,t]).join(", ")+"]: 'r', 'g', and 'b' must be between 0 and 255."}return void 0===n||"number"==typeof n&&n>=0&&n<=1?null:"Invalid rgba value ["+[e,r,t,n].join(", ")+"]: 'a' must be between 0 and 1."}function isValue(e){if(null===e)return!0;if("string"==typeof e)return!0;if("boolean"==typeof e)return!0;if("number"==typeof e)return!0;if(e instanceof Color)return!0;if(Array.isArray(e)){for(var r=0,t=e;r=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3===e.length&&(Array.isArray(e[1])||Array.isArray(e[2]));case"any":case"all":for(var r=0,t=e.slice(1);rr?1:0}function convertFilter(e){if(!e)return!0;var r=e[0];return e.length<=1?"any"!==r:"=="===r?convertComparisonOp(e[1],e[2],"=="):"!="===r?convertNegation(convertComparisonOp(e[1],e[2],"==")):"<"===r||">"===r||"<="===r||">="===r?convertComparisonOp(e[1],e[2],r):"any"===r?convertDisjunctionOp(e.slice(1)):"all"===r?["all"].concat(e.slice(1).map(convertFilter)):"none"===r?["all"].concat(e.slice(1).map(convertFilter).map(convertNegation)):"in"===r?convertInOp(e[1],e.slice(2)):"!in"===r?convertNegation(convertInOp(e[1],e.slice(2))):"has"===r?convertHasOp(e[1]):"!has"!==r||convertNegation(convertHasOp(e[1]))}function convertComparisonOp(e,r,t){switch(e){case"$type":return["filter-type-"+t,r];case"$id":return["filter-id-"+t,r];default:return["filter-"+t,e,r]}}function convertDisjunctionOp(e){return["any"].concat(e.map(convertFilter))}function convertInOp(e,r){if(0===r.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",r]];case"$id":return["filter-id-in",["literal",r]];default:return r.length>200&&!r.some(function(e){return typeof e!=typeof r[0]})?["filter-in-large",e,["literal",r.sort(compare)]]:["filter-in-small",e,["literal",r]]}}function convertHasOp(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function convertNegation(e){return["!",e]}var ref=_dereq_("../expression"),createExpression=ref.createExpression;module.exports=createFilter,module.exports.isExpressionFilter=isExpressionFilter;var filterSpec={type:"boolean",default:!1,function:!0,"property-function":!0,"zoom-function":!0}; +},{"../expression":139}],149:[function(_dereq_,module,exports){ +"use strict";function isFunction(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function identityFunction(e){return e}function createFunction(e,t){var o="color"===t.type,r=e.stops&&"object"==typeof e.stops[0][0],n=r||void 0!==e.property,a=r||!n,i=e.type||("interpolated"===t.function?"exponential":"interval");if(o&&(e=extend({},e),e.stops&&(e.stops=e.stops.map(function(e){return[e[0],Color.parse(e[1])]})),e.default?e.default=Color.parse(e.default):e.default=Color.parse(t.default)),e.colorSpace&&"rgb"!==e.colorSpace&&!colorSpaces[e.colorSpace])throw new Error("Unknown color space: "+e.colorSpace);var u,p,l;if("exponential"===i)u=evaluateExponentialFunction;else if("interval"===i)u=evaluateIntervalFunction;else if("categorical"===i){u=evaluateCategoricalFunction,p=Object.create(null);for(var s=0,c=e.stops;s=e.stops[r-1][0])return e.stops[r-1][1];var n=findStopLessThanOrEqualTo(e.stops,o);return e.stops[n][1]}function evaluateExponentialFunction(e,t,o){var r=void 0!==e.base?e.base:1;if("number"!==getType(o))return coalesce(e.default,t.default);var n=e.stops.length;if(1===n)return e.stops[0][1];if(o<=e.stops[0][0])return e.stops[0][1];if(o>=e.stops[n-1][0])return e.stops[n-1][1];var a=findStopLessThanOrEqualTo(e.stops,o),i=interpolationFactor(o,r,e.stops[a][0],e.stops[a+1][0]),u=e.stops[a][1],p=e.stops[a+1][1],l=interpolate[t.type]||identityFunction;if(e.colorSpace&&"rgb"!==e.colorSpace){var s=colorSpaces[e.colorSpace];l=function(e,t){return s.reverse(s.interpolate(s.forward(e),s.forward(t),i))}}return"function"==typeof u.evaluate?{evaluate:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var o=u.evaluate.apply(void 0,e),r=p.evaluate.apply(void 0,e);if(void 0!==o&&void 0!==r)return l(o,r,i)}}:l(u,p,i)}function evaluateIdentityFunction(e,t,o){return"color"===t.type?o=Color.parse(o):getType(o)===t.type||"enum"===t.type&&t.values[o]||(o=void 0),coalesce(o,e.default,t.default)}function findStopLessThanOrEqualTo(e,t){for(var o,r,n=e.length,a=0,i=n-1,u=0;a<=i;){if(u=Math.floor((a+i)/2),o=e[u][0],r=e[u+1][0],t===o||t>o&&tt&&(i=u-1)}return Math.max(u-1,0)}function interpolationFactor(e,t,o,r){var n=r-o,a=e-o;return 0===n?0:1===t?a/n:(Math.pow(t,a)-1)/(Math.pow(t,n)-1)}var colorSpaces=_dereq_("../util/color_spaces"),Color=_dereq_("../util/color"),extend=_dereq_("../util/extend"),getType=_dereq_("../util/get_type"),interpolate=_dereq_("../util/interpolate"),Interpolate=_dereq_("../expression/definitions/interpolate");module.exports={createFunction:createFunction,isFunction:isFunction}; +},{"../expression/definitions/interpolate":132,"../util/color":153,"../util/color_spaces":154,"../util/extend":156,"../util/get_type":157,"../util/interpolate":158}],150:[function(_dereq_,module,exports){ "use strict";function stringify(r){var t=typeof r;if("number"===t||"boolean"===t||"string"===t||void 0===r||null===r)return JSON.stringify(r);if(Array.isArray(r)){for(var e="[",i=0,n=r;i":{},">=":{},"<":{},"<=":{},"in":{},"!in":{},"all":{},"any":{},"none":{},"has":{},"!has":{}}},"geometry_type":{"type":"enum","values":{"Point":{},"LineString":{},"Polygon":{}}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":{},"exponential":{},"interval":{},"categorical":{}},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":{},"lab":{},"hcl":{}},"default":"rgb"},"default":{"type":"*","required":false}},"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"},"curve":{"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"},"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"},"geometry-type":{"group":"Feature data"},"id":{"group":"Feature data"},"zoom":{"group":"Zoom"},"heatmap-density":{"group":"Heatmap"},"+":{"group":"Math"},"*":{"group":"Math"},"-":{"group":"Math"},"/":{"group":"Math"},"%":{"group":"Math"},"^":{"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"},"==":{"group":"Decision"},"!=":{"group":"Decision"},">":{"group":"Decision"},"<":{"group":"Decision"},">=":{"group":"Decision"},"<=":{"group":"Decision"},"all":{"group":"Decision"},"any":{"group":"Decision"},"!":{"group":"Decision"},"upcase":{"group":"String"},"downcase":{"group":"String"},"concat":{"group":"String"}}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":{},"viewport":{}},"transition":false,"zoom-function":true,"property-function":false,"function":"piecewise-constant"},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"function":"interpolated","zoom-function":true,"property-function":false},"color":{"type":"color","default":"#ffffff","function":"interpolated","zoom-function":true,"property-function":false,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":false,"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_background"],"paint_fill":{"fill-antialias":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"default":true},"fill-opacity":{"type":"number","function":"interpolated","zoom-function":true,"property-function":true,"default":1,"minimum":0,"maximum":1,"transition":true},"fill-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":[{"!":"fill-pattern"}]},"fill-outline-color":{"type":"color","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":[{"!":"fill-pattern"},{"fill-antialias":true}]},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"transition":true,"units":"pixels"},"fill-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"map":{},"viewport":{}},"default":"map","requires":["fill-translate"]},"fill-pattern":{"type":"string","function":"piecewise-constant","zoom-function":true,"transition":true}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","function":"interpolated","zoom-function":true,"property-function":false,"default":1,"minimum":0,"maximum":1,"transition":true},"fill-extrusion-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":[{"!":"fill-extrusion-pattern"}]},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"transition":true,"units":"pixels"},"fill-extrusion-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"map":{},"viewport":{}},"default":"map","requires":["fill-extrusion-translate"]},"fill-extrusion-pattern":{"type":"string","function":"piecewise-constant","zoom-function":true,"transition":true},"fill-extrusion-height":{"type":"number","function":"interpolated","zoom-function":true,"property-function":true,"default":0,"minimum":0,"units":"meters","transition":true},"fill-extrusion-base":{"type":"number","function":"interpolated","zoom-function":true,"property-function":true,"default":0,"minimum":0,"units":"meters","transition":true,"requires":["fill-extrusion-height"]}},"paint_line":{"line-opacity":{"type":"number","function":"interpolated","zoom-function":true,"property-function":true,"default":1,"minimum":0,"maximum":1,"transition":true},"line-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":[{"!":"line-pattern"}]},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"transition":true,"units":"pixels"},"line-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"map":{},"viewport":{}},"default":"map","requires":["line-translate"]},"line-width":{"type":"number","default":1,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-gap-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-offset":{"type":"number","default":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-dasharray":{"type":"array","value":"number","function":"piecewise-constant","zoom-function":true,"minimum":0,"transition":true,"units":"line widths","requires":[{"!":"line-pattern"}]},"line-pattern":{"type":"string","function":"piecewise-constant","zoom-function":true,"transition":true}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"circle-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true},"circle-blur":{"type":"number","default":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"transition":true,"units":"pixels"},"circle-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"map":{},"viewport":{}},"default":"map","requires":["circle-translate"]},"circle-pitch-scale":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"map":{},"viewport":{}},"default":"map"},"circle-pitch-alignment":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"map":{},"viewport":{}},"default":"viewport"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"circle-stroke-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"function":"interpolated","zoom-function":true,"property-function":false,"transition":true,"units":"pixels"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":false},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":false,"transition":true},"heatmap-color":{"type":"color","default":{"stops":[[0,"rgba(0, 0, 255, 0)"],[0.1,"royalblue"],[0.3,"cyan"],[0.5,"lime"],[0.7,"yellow"],[1,"red"]]},"function":"interpolated","zoom-function":true,"property-function":false,"transition":true},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":false,"transition":true}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["icon-image"]},"icon-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["icon-image"]},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["icon-image"]},"icon-halo-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["icon-image"]},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["icon-image"]},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"transition":true,"units":"pixels","requires":["icon-image"]},"icon-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"map":{},"viewport":{}},"default":"map","requires":["icon-image","icon-translate"]},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["text-field"]},"text-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["text-field"]},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["text-field"]},"text-halo-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["text-field"]},"text-halo-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["text-field"]},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"transition":true,"units":"pixels","requires":["text-field"]},"text-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"map":{},"viewport":{}},"default":"map","requires":["text-field","text-translate"]}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true},"raster-hue-rotate":{"type":"number","default":0,"period":360,"function":"interpolated","zoom-function":true,"transition":true,"units":"degrees"},"raster-brightness-min":{"type":"number","function":"interpolated","zoom-function":true,"default":0,"minimum":0,"maximum":1,"transition":true},"raster-brightness-max":{"type":"number","function":"interpolated","zoom-function":true,"default":1,"minimum":0,"maximum":1,"transition":true},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"function":"interpolated","zoom-function":true,"transition":true,"units":"milliseconds"}},"paint_background":{"background-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"transition":true,"requires":[{"!":"background-pattern"}]},"background-pattern":{"type":"string","function":"piecewise-constant","zoom-function":true,"transition":true},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true}},"transition":{"duration":{"type":"number","default":300,"minimum":0,"units":"milliseconds"},"delay":{"type":"number","default":0,"minimum":0,"units":"milliseconds"}}} -},{}],149:[function(_dereq_,module,exports){ -"use strict";function xyz2lab(r){return r>t3?Math.pow(r,1/3):r/t2+t0}function lab2xyz(r){return r>t1?r*r*r:t2*(r-t0)}function xyz2rgb(r){return 255*(r<=.0031308?12.92*r:1.055*Math.pow(r,1/2.4)-.055)}function rgb2xyz(r){return r/=255,r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function rgbToLab(r){var t=rgb2xyz(r[0]),a=rgb2xyz(r[1]),n=rgb2xyz(r[2]),b=xyz2lab((.4124564*t+.3575761*a+.1804375*n)/Xn),o=xyz2lab((.2126729*t+.7151522*a+.072175*n)/Yn);return[116*o-16,500*(b-o),200*(o-xyz2lab((.0193339*t+.119192*a+.9503041*n)/Zn)),r[3]]}function labToRgb(r){var t=(r[0]+16)/116,a=isNaN(r[1])?t:t+r[1]/500,n=isNaN(r[2])?t:t-r[2]/200;return t=Yn*lab2xyz(t),a=Xn*lab2xyz(a),n=Zn*lab2xyz(n),[xyz2rgb(3.2404542*a-1.5371385*t-.4985314*n),xyz2rgb(-.969266*a+1.8760108*t+.041556*n),xyz2rgb(.0556434*a-.2040259*t+1.0572252*n),r[3]]}function rgbToHcl(r){var t=rgbToLab(r),a=t[0],n=t[1],b=t[2],o=Math.atan2(b,n)*rad2deg;return[o<0?o+360:o,Math.sqrt(n*n+b*b),a,r[3]]}function hclToRgb(r){var t=r[0]*deg2rad,a=r[1];return labToRgb([r[2],Math.cos(t)*a,Math.sin(t)*a,r[3]])}var Xn=.95047,Yn=1,Zn=1.08883,t0=4/29,t1=6/29,t2=3*t1*t1,t3=t1*t1*t1,deg2rad=Math.PI/180,rad2deg=180/Math.PI;module.exports={lab:{forward:rgbToLab,reverse:labToRgb},hcl:{forward:rgbToHcl,reverse:hclToRgb}}; -},{}],150:[function(_dereq_,module,exports){ -"use strict";module.exports=function(r){for(var t=[],e=arguments.length-1;e-- >0;)t[e]=arguments[e+1];for(var n=0,o=t;n":{},">=":{},"<":{},"<=":{},"in":{},"!in":{},"all":{},"any":{},"none":{},"has":{},"!has":{}}},"geometry_type":{"type":"enum","values":{"Point":{},"LineString":{},"Polygon":{}}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":{},"exponential":{},"interval":{},"categorical":{}},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":{},"lab":{},"hcl":{}},"default":"rgb"},"default":{"type":"*","required":false}},"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"},"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"},"geometry-type":{"group":"Feature data"},"id":{"group":"Feature data"},"zoom":{"group":"Zoom"},"heatmap-density":{"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"},"==":{"group":"Decision"},"!=":{"group":"Decision"},">":{"group":"Decision"},"<":{"group":"Decision"},">=":{"group":"Decision"},"<=":{"group":"Decision"},"all":{"group":"Decision"},"any":{"group":"Decision"},"!":{"group":"Decision"},"upcase":{"group":"String"},"downcase":{"group":"String"},"concat":{"group":"String"}}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":{},"viewport":{}},"transition":false,"zoom-function":true,"property-function":false,"function":"piecewise-constant"},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"function":"interpolated","zoom-function":true,"property-function":false},"color":{"type":"color","default":"#ffffff","function":"interpolated","zoom-function":true,"property-function":false,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":false,"transition":true}},"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","function":"piecewise-constant","zoom-function":true,"default":true},"fill-opacity":{"type":"number","function":"interpolated","zoom-function":true,"property-function":true,"default":1,"minimum":0,"maximum":1,"transition":true},"fill-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":[{"!":"fill-pattern"}]},"fill-outline-color":{"type":"color","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":[{"!":"fill-pattern"},{"fill-antialias":true}]},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"transition":true,"units":"pixels"},"fill-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"map":{},"viewport":{}},"default":"map","requires":["fill-translate"]},"fill-pattern":{"type":"string","function":"piecewise-constant","zoom-function":true,"transition":true}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","function":"interpolated","zoom-function":true,"property-function":false,"default":1,"minimum":0,"maximum":1,"transition":true},"fill-extrusion-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":[{"!":"fill-extrusion-pattern"}]},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"transition":true,"units":"pixels"},"fill-extrusion-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"map":{},"viewport":{}},"default":"map","requires":["fill-extrusion-translate"]},"fill-extrusion-pattern":{"type":"string","function":"piecewise-constant","zoom-function":true,"transition":true},"fill-extrusion-height":{"type":"number","function":"interpolated","zoom-function":true,"property-function":true,"default":0,"minimum":0,"units":"meters","transition":true},"fill-extrusion-base":{"type":"number","function":"interpolated","zoom-function":true,"property-function":true,"default":0,"minimum":0,"units":"meters","transition":true,"requires":["fill-extrusion-height"]}},"paint_line":{"line-opacity":{"type":"number","function":"interpolated","zoom-function":true,"property-function":true,"default":1,"minimum":0,"maximum":1,"transition":true},"line-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":[{"!":"line-pattern"}]},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"transition":true,"units":"pixels"},"line-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"map":{},"viewport":{}},"default":"map","requires":["line-translate"]},"line-width":{"type":"number","default":1,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-gap-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-offset":{"type":"number","default":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-dasharray":{"type":"array","value":"number","function":"piecewise-constant","zoom-function":true,"minimum":0,"transition":true,"units":"line widths","requires":[{"!":"line-pattern"}]},"line-pattern":{"type":"string","function":"piecewise-constant","zoom-function":true,"transition":true}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"circle-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true},"circle-blur":{"type":"number","default":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"transition":true,"units":"pixels"},"circle-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"map":{},"viewport":{}},"default":"map","requires":["circle-translate"]},"circle-pitch-scale":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"map":{},"viewport":{}},"default":"map"},"circle-pitch-alignment":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"map":{},"viewport":{}},"default":"viewport"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"circle-stroke-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":false},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":false,"transition":true},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"function":"interpolated","zoom-function":false,"property-function":false,"transition":false},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":false,"transition":true}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["icon-image"]},"icon-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["icon-image"]},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["icon-image"]},"icon-halo-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["icon-image"]},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["icon-image"]},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"transition":true,"units":"pixels","requires":["icon-image"]},"icon-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"map":{},"viewport":{}},"default":"map","requires":["icon-image","icon-translate"]},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["text-field"]},"text-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["text-field"]},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["text-field"]},"text-halo-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["text-field"]},"text-halo-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["text-field"]},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"transition":true,"units":"pixels","requires":["text-field"]},"text-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"map":{},"viewport":{}},"default":"map","requires":["text-field","text-translate"]}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true},"raster-hue-rotate":{"type":"number","default":0,"period":360,"function":"interpolated","zoom-function":true,"transition":true,"units":"degrees"},"raster-brightness-min":{"type":"number","function":"interpolated","zoom-function":true,"default":0,"minimum":0,"maximum":1,"transition":true},"raster-brightness-max":{"type":"number","function":"interpolated","zoom-function":true,"default":1,"minimum":0,"maximum":1,"transition":true},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"function":"interpolated","zoom-function":true,"transition":false,"units":"milliseconds"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"function":"interpolated","zoom-function":true,"transition":false},"hillshade-illumination-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":{"map":{},"viewport":{}},"default":"viewport"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true},"hillshade-shadow-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"transition":true},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","function":"interpolated","zoom-function":true,"transition":true},"hillshade-accent-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"transition":true}},"paint_background":{"background-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"transition":true,"requires":[{"!":"background-pattern"}]},"background-pattern":{"type":"string","function":"piecewise-constant","zoom-function":true,"transition":true},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true}},"transition":{"duration":{"type":"number","default":300,"minimum":0,"units":"milliseconds"},"delay":{"type":"number","default":0,"minimum":0,"units":"milliseconds"}}} },{}],153:[function(_dereq_,module,exports){ -"use strict";var parseColorString=_dereq_("csscolorparser").parseCSSColor;module.exports=function(r){if("string"==typeof r){var e=parseColorString(r);if(!e)return;return[e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3]]}return Array.isArray(r)?r:void 0}; -},{"csscolorparser":11}],154:[function(_dereq_,module,exports){ -"use strict";module.exports=["type","source","source-layer","minzoom","maxzoom","filter","layout"]; -},{}],155:[function(_dereq_,module,exports){ -"use strict";function unbundle(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function deepUnbundle(e){return Array.isArray(e)?e.map(deepUnbundle):unbundle(e)}module.exports=unbundle,module.exports.deep=deepUnbundle; +"use strict";var ref=_dereq_("csscolorparser"),parseCSSColor=ref.parseCSSColor,Color=function(r,o,t,e){void 0===e&&(e=1),this.r=r,this.g=o,this.b=t,this.a=e};Color.parse=function(r){if(r){if(r instanceof Color)return r;if("string"==typeof r){var o=parseCSSColor(r);if(o)return new Color(o[0]/255*o[3],o[1]/255*o[3],o[2]/255*o[3],o[3])}}},Color.prototype.toString=function(){var r=this,o=function(o){return Math.round(255*o/r.a)};return"rgba("+[this.r,this.g,this.b].map(o).concat(this.a).join(",")+")"},Color.black=new Color(0,0,0,1),Color.white=new Color(1,1,1,1),Color.transparent=new Color(0,0,0,0),module.exports=Color; +},{"csscolorparser":13}],154:[function(_dereq_,module,exports){ +"use strict";function xyz2lab(a){return a>t3?Math.pow(a,1/3):a/t2+t0}function lab2xyz(a){return a>t1?a*a*a:t2*(a-t0)}function xyz2rgb(a){return 255*(a<=.0031308?12.92*a:1.055*Math.pow(a,1/2.4)-.055)}function rgb2xyz(a){return a/=255,a<=.04045?a/12.92:Math.pow((a+.055)/1.055,2.4)}function rgbToLab(a){var r=rgb2xyz(a.r),t=rgb2xyz(a.g),e=rgb2xyz(a.b),n=xyz2lab((.4124564*r+.3575761*t+.1804375*e)/Xn),l=xyz2lab((.2126729*r+.7151522*t+.072175*e)/Yn);return{l:116*l-16,a:500*(n-l),b:200*(l-xyz2lab((.0193339*r+.119192*t+.9503041*e)/Zn)),alpha:a.a}}function labToRgb(a){var r=(a.l+16)/116,t=isNaN(a.a)?r:r+a.a/500,e=isNaN(a.b)?r:r-a.b/200;return r=Yn*lab2xyz(r),t=Xn*lab2xyz(t),e=Zn*lab2xyz(e),new Color(xyz2rgb(3.2404542*t-1.5371385*r-.4985314*e),xyz2rgb(-.969266*t+1.8760108*r+.041556*e),xyz2rgb(.0556434*t-.2040259*r+1.0572252*e),a.alpha)}function interpolateLab(a,r,t){return{l:interpolateNumber(a.l,r.l,t),a:interpolateNumber(a.a,r.a,t),b:interpolateNumber(a.b,r.b,t),alpha:interpolateNumber(a.alpha,r.alpha,t)}}function rgbToHcl(a){var r=rgbToLab(a),t=r.l,e=r.a,n=r.b,l=Math.atan2(n,e)*rad2deg;return{h:l<0?l+360:l,c:Math.sqrt(e*e+n*n),l:t,alpha:a.a}}function hclToRgb(a){var r=a.h*deg2rad,t=a.c;return labToRgb({l:a.l,a:Math.cos(r)*t,b:Math.sin(r)*t,alpha:a.alpha})}function interpolateHue(a,r,t){var e=r-a;return a+t*(e>180||e<-180?e-360*Math.round(e/360):e)}function interpolateHcl(a,r,t){return{h:interpolateHue(a.h,r.h,t),c:interpolateNumber(a.c,r.c,t),l:interpolateNumber(a.l,r.l,t),alpha:interpolateNumber(a.alpha,r.alpha,t)}}var Color=_dereq_("./color"),interpolateNumber=_dereq_("./interpolate").number,Xn=.95047,Yn=1,Zn=1.08883,t0=4/29,t1=6/29,t2=3*t1*t1,t3=t1*t1*t1,deg2rad=Math.PI/180,rad2deg=180/Math.PI;module.exports={lab:{forward:rgbToLab,reverse:labToRgb,interpolate:interpolateLab},hcl:{forward:rgbToHcl,reverse:hclToRgb,interpolate:interpolateHcl}}; +},{"./color":153,"./interpolate":158}],155:[function(_dereq_,module,exports){ +"use strict";function deepEqual(e,r){if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(var t=0;t7)return[new ValidationError(o,a,"constants have been deprecated as of v8")];if(!(a in s.constants))return[new ValidationError(o,a,'constant "%s" not found',a)];e=extend({},e,{value:s.constants[a]})}return u.function&&isFunction(unbundle(a))?r(e):u.function&&isExpression(unbundle.deep(a))?i(e):u.type&&n[u.type]?n[u.type](e):t(extend({},e,{valueSpec:u.type?l[u.type]:u}))}; -},{"../error/validation_error":121,"../expression":136,"../function":145,"../util/extend":150,"../util/get_type":151,"../util/unbundle_jsonlint":155,"./validate_array":157,"./validate_boolean":158,"./validate_color":159,"./validate_constants":160,"./validate_enum":161,"./validate_expression":162,"./validate_filter":163,"./validate_function":164,"./validate_layer":166,"./validate_light":168,"./validate_number":169,"./validate_object":170,"./validate_source":173,"./validate_string":174}],157:[function(_dereq_,module,exports){ -"use strict";var getType=_dereq_("../util/get_type"),validate=_dereq_("./validate"),ValidationError=_dereq_("../error/validation_error");module.exports=function(e){var r=e.value,t=e.valueSpec,a=e.style,n=e.styleSpec,l=e.key,i=e.arrayElementValidator||validate;if("array"!==getType(r))return[new ValidationError(l,r,"array expected, %s found",getType(r))];if(t.length&&r.length!==t.length)return[new ValidationError(l,r,"array length %d expected, length %d found",t.length,r.length)];if(t["min-length"]&&r.length7)return t?[new ValidationError(e,t,"constants have been deprecated as of v8")]:[];var a=getType(t);if("object"!==a)return[new ValidationError(e,t,"object expected, %s found",a)];var o=[];for(var n in t)"@"!==n[0]&&o.push(new ValidationError(e+"."+n,t[n],'constants must start with "@"'));return o}; -},{"../error/validation_error":121,"../util/get_type":151}],161:[function(_dereq_,module,exports){ -"use strict";var ValidationError=_dereq_("../error/validation_error"),unbundle=_dereq_("../util/unbundle_jsonlint");module.exports=function(e){var r=e.key,n=e.value,u=e.valueSpec,i=[];return Array.isArray(u.values)?-1===u.values.indexOf(unbundle(n))&&i.push(new ValidationError(r,n,"expected one of [%s], %s found",u.values.join(", "),JSON.stringify(n))):-1===Object.keys(u.values).indexOf(unbundle(n))&&i.push(new ValidationError(r,n,"expected one of [%s], %s found",Object.keys(u.values).join(", "),JSON.stringify(n))),i}; -},{"../error/validation_error":121,"../util/unbundle_jsonlint":155}],162:[function(_dereq_,module,exports){ -"use strict";var ValidationError=_dereq_("../error/validation_error"),ref=_dereq_("../expression"),createExpression=ref.createExpression,unbundle=_dereq_("../util/unbundle_jsonlint");module.exports=function(e){var r=createExpression(unbundle.deep(e.value),e.valueSpec,e.expressionContext);return"success"===r.result?[]:r.errors.map(function(r){return new ValidationError(""+e.key+r.key,e.value,r.message)})}; -},{"../error/validation_error":121,"../expression":136,"../util/unbundle_jsonlint":155}],163:[function(_dereq_,module,exports){ -"use strict";var ValidationError=_dereq_("../error/validation_error"),validateExpression=_dereq_("./validate_expression"),validateEnum=_dereq_("./validate_enum"),getType=_dereq_("../util/get_type"),unbundle=_dereq_("../util/unbundle_jsonlint"),extend=_dereq_("../util/extend"),ref=_dereq_("../feature_filter"),isExpressionFilter=ref.isExpressionFilter;module.exports=function e(r){var t,a=r.value,n=r.key,s=r.styleSpec,l=[];if("array"!==getType(a))return[new ValidationError(n,a,"array expected, %s found",getType(a))];if(isExpressionFilter(unbundle.deep(a)))return validateExpression(extend({},r,{expressionContext:"filter",valueSpec:{value:"boolean"}}));if(a.length<1)return[new ValidationError(n,a,"filter array must have at least 1 element")];switch(l=l.concat(validateEnum({key:n+"[0]",value:a[0],valueSpec:s.filter_operator,style:r.style,styleSpec:r.styleSpec})),unbundle(a[0])){case"<":case"<=":case">":case">=":a.length>=2&&"$type"===unbundle(a[1])&&l.push(new ValidationError(n,a,'"$type" cannot be use with operator "%s"',a[0]));case"==":case"!=":3!==a.length&&l.push(new ValidationError(n,a,'filter array for operator "%s" must have 3 elements',a[0]));case"in":case"!in":a.length>=2&&"string"!==(t=getType(a[1]))&&l.push(new ValidationError(n+"[1]",a[1],"string expected, %s found",t));for(var i=2;iunbundle(r[0].zoom))return[new ValidationError(o,r[0].zoom,"stop zoom values must appear in ascending order")];unbundle(r[0].zoom)!==l&&(l=unbundle(r[0].zoom),i=void 0,s={}),t=t.concat(validateObject({key:o+"[0]",value:r[0],valueSpec:{zoom:{}},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:validateNumber,value:a}}))}else t=t.concat(a({key:o+"[0]",value:r[0],valueSpec:{},style:e.style,styleSpec:e.styleSpec},r));return t.concat(validate({key:o+"[1]",value:r[1],valueSpec:u,style:e.style,styleSpec:e.styleSpec}))}function a(e,t){var r=getType(e.value),a=unbundle(e.value),o=null!==e.value?e.value:t;if(n){if(r!==n)return[new ValidationError(e.key,o,"%s stop domain type must match previous stop domain type %s",r,n)]}else n=r;if("number"!==r&&"string"!==r&&"boolean"!==r)return[new ValidationError(e.key,o,"stop domain value must be a number, string, or boolean")];if("number"!==r&&"categorical"!==p){var l="number expected, %s found";return u["property-function"]&&void 0===p&&(l+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new ValidationError(e.key,o,l,r)]}return"categorical"!==p||"number"!==r||isFinite(a)&&Math.floor(a)===a?"categorical"!==p&&"number"===r&&void 0!==i&&a=8&&(d&&!e.valueSpec["property-function"]?v.push(new ValidationError(e.key,e.value,"property functions not supported")):y&&!e.valueSpec["zoom-function"]&&v.push(new ValidationError(e.key,e.value,"zoom functions not supported"))),"categorical"!==p&&!c||void 0!==e.value.property||v.push(new ValidationError(e.key,e.value,'"property" property is required')),v}; -},{"../error/validation_error":121,"../util/get_type":151,"../util/unbundle_jsonlint":155,"./validate":156,"./validate_array":157,"./validate_number":169,"./validate_object":170}],165:[function(_dereq_,module,exports){ +"use strict";module.exports=function(r){for(var t=[],e=arguments.length-1;e-- >0;)t[e]=arguments[e+1];for(var n=0,o=t;n":case">=":r.length>=2&&"$type"===unbundle(r[1])&&i.push(new ValidationError(t,r,'"$type" cannot be use with operator "'+r[0]+'"'));case"==":case"!=":3!==r.length&&i.push(new ValidationError(t,r,'filter array for operator "'+r[0]+'" must have 3 elements'));case"in":case"!in":r.length>=2&&"string"!==(a=getType(r[1]))&&i.push(new ValidationError(t+"[1]",r[1],"string expected, "+a+" found"));for(var l=2;lunbundle(r[0].zoom))return[new ValidationError(o,r[0].zoom,"stop zoom values must appear in ascending order")];unbundle(r[0].zoom)!==l&&(l=unbundle(r[0].zoom),i=void 0,s={}),t=t.concat(validateObject({key:o+"[0]",value:r[0],valueSpec:{zoom:{}},style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:validateNumber,value:a}}))}else t=t.concat(a({key:o+"[0]",value:r[0],valueSpec:{},style:e.style,styleSpec:e.styleSpec},r));return t.concat(validate({key:o+"[1]",value:r[1],valueSpec:u,style:e.style,styleSpec:e.styleSpec}))}function a(e,t){var r=getType(e.value),a=unbundle(e.value),o=null!==e.value?e.value:t;if(n){if(r!==n)return[new ValidationError(e.key,o,r+" stop domain type must match previous stop domain type "+n)]}else n=r;if("number"!==r&&"string"!==r&&"boolean"!==r)return[new ValidationError(e.key,o,"stop domain value must be a number, string, or boolean")];if("number"!==r&&"categorical"!==p){var l="number expected, "+r+" found";return u["property-function"]&&void 0===p&&(l+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new ValidationError(e.key,o,l)]}return"categorical"!==p||"number"!==r||isFinite(a)&&Math.floor(a)===a?"categorical"!==p&&"number"===r&&void 0!==i&&a=8&&(c&&!e.valueSpec["property-function"]?v.push(new ValidationError(e.key,e.value,"property functions not supported")):y&&!e.valueSpec["zoom-function"]&&"heatmap-color"!==e.objectKey&&v.push(new ValidationError(e.key,e.value,"zoom functions not supported"))),"categorical"!==p&&!d||void 0!==e.value.property||v.push(new ValidationError(e.key,e.value,'"property" property is required')),v}; +},{"../error/validation_error":122,"../util/get_type":157,"../util/unbundle_jsonlint":161,"./validate":162,"./validate_array":163,"./validate_number":175,"./validate_object":176}],171:[function(_dereq_,module,exports){ "use strict";var ValidationError=_dereq_("../error/validation_error"),validateString=_dereq_("./validate_string");module.exports=function(r){var e=r.value,t=r.key,a=validateString(r);return a.length?a:(-1===e.indexOf("{fontstack}")&&a.push(new ValidationError(t,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&a.push(new ValidationError(t,e,'"glyphs" url must include a "{range}" token')),a)}; -},{"../error/validation_error":121,"./validate_string":174}],166:[function(_dereq_,module,exports){ -"use strict";var ValidationError=_dereq_("../error/validation_error"),unbundle=_dereq_("../util/unbundle_jsonlint"),validateObject=_dereq_("./validate_object"),validateFilter=_dereq_("./validate_filter"),validatePaintProperty=_dereq_("./validate_paint_property"),validateLayoutProperty=_dereq_("./validate_layout_property"),extend=_dereq_("../util/extend");module.exports=function(e){var r=[],t=e.value,a=e.key,i=e.style,l=e.styleSpec;t.type||t.ref||r.push(new ValidationError(a,t,'either "type" or "ref" is required'));var u=unbundle(t.type),n=unbundle(t.ref);if(t.id)for(var o=unbundle(t.id),s=0;sm.maximum?[new ValidationError(r,i,"%s is greater than the maximum value %s",i,m.maximum)]:[]}; -},{"../error/validation_error":121,"../util/get_type":151}],170:[function(_dereq_,module,exports){ -"use strict";var ValidationError=_dereq_("../error/validation_error"),getType=_dereq_("../util/get_type"),validateSpec=_dereq_("./validate");module.exports=function(e){var r=e.key,t=e.value,i=e.valueSpec||{},a=e.objectElementValidators||{},o=e.style,l=e.styleSpec,n=[],u=getType(t);if("object"!==u)return[new ValidationError(r,t,"object expected, %s found",u)];for(var d in t){var p=d.split(".")[0],s=i[p]||i["*"],c=void 0;if(a[p])c=a[p];else if(i[p])c=validateSpec;else if(a["*"])c=a["*"];else{if(!i["*"]){n.push(new ValidationError(r,t[d],'unknown property "%s"',d));continue}c=validateSpec}n=n.concat(c({key:(r?r+".":r)+d,value:t[d],valueSpec:s,style:o,styleSpec:l,object:t,objectKey:d},t))}for(var v in i)i[v].required&&void 0===i[v].default&&void 0===t[v]&&n.push(new ValidationError(r,t,'missing required property "%s"',v));return n}; -},{"../error/validation_error":121,"../util/get_type":151,"./validate":156}],171:[function(_dereq_,module,exports){ +},{"./validate_property":178}],174:[function(_dereq_,module,exports){ +"use strict";var ValidationError=_dereq_("../error/validation_error"),getType=_dereq_("../util/get_type"),validate=_dereq_("./validate");module.exports=function(e){var t=e.value,r=e.styleSpec,a=r.light,i=e.style,n=[],o=getType(t);if(void 0===t)return n;if("object"!==o)return n=n.concat([new ValidationError("light",t,"object expected, "+o+" found")]);for(var l in t){var c=l.match(/^(.*)-transition$/);n=c&&a[c[1]]&&a[c[1]].transition?n.concat(validate({key:l,value:t[l],valueSpec:r.transition,style:i,styleSpec:r})):a[l]?n.concat(validate({key:l,value:t[l],valueSpec:a[l],style:i,styleSpec:r})):n.concat([new ValidationError(l,t[l],'unknown property "'+l+'"')])}return n}; +},{"../error/validation_error":122,"../util/get_type":157,"./validate":162}],175:[function(_dereq_,module,exports){ +"use strict";var getType=_dereq_("../util/get_type"),ValidationError=_dereq_("../error/validation_error");module.exports=function(e){var r=e.key,i=e.value,m=e.valueSpec,a=getType(i);return"number"!==a?[new ValidationError(r,i,"number expected, "+a+" found")]:"minimum"in m&&im.maximum?[new ValidationError(r,i,i+" is greater than the maximum value "+m.maximum)]:[]}; +},{"../error/validation_error":122,"../util/get_type":157}],176:[function(_dereq_,module,exports){ +"use strict";var ValidationError=_dereq_("../error/validation_error"),getType=_dereq_("../util/get_type"),validateSpec=_dereq_("./validate");module.exports=function(e){var r=e.key,t=e.value,i=e.valueSpec||{},a=e.objectElementValidators||{},o=e.style,l=e.styleSpec,n=[],u=getType(t);if("object"!==u)return[new ValidationError(r,t,"object expected, "+u+" found")];for(var d in t){var p=d.split(".")[0],c=i[p]||i["*"],v=void 0;if(a[p])v=a[p];else if(i[p])v=validateSpec;else if(a["*"])v=a["*"];else{if(!i["*"]){n.push(new ValidationError(r,t[d],'unknown property "'+d+'"'));continue}v=validateSpec}n=n.concat(v({key:(r?r+".":r)+d,value:t[d],valueSpec:c,style:o,styleSpec:l,object:t,objectKey:d},t))}for(var s in i)a[s]||i[s].required&&void 0===i[s].default&&void 0===t[s]&&n.push(new ValidationError(r,t,'missing required property "'+s+'"'));return n}; +},{"../error/validation_error":122,"../util/get_type":157,"./validate":162}],177:[function(_dereq_,module,exports){ "use strict";var validateProperty=_dereq_("./validate_property");module.exports=function(r){return validateProperty(r,"paint")}; -},{"./validate_property":172}],172:[function(_dereq_,module,exports){ -"use strict";var validate=_dereq_("./validate"),ValidationError=_dereq_("../error/validation_error"),getType=_dereq_("../util/get_type");module.exports=function(e,t){var r=e.key,i=e.style,n=e.styleSpec,a=e.value,o=e.objectKey,p=n[t+"_"+e.layerType];if(!p)return[];var y=o.match(/^(.*)-transition$/);if("paint"===t&&y&&p[y[1]]&&p[y[1]].transition)return validate({key:r,value:a,valueSpec:n.transition,style:i,styleSpec:n});var l=e.valueSpec||p[o];if(!l)return[new ValidationError(r,a,'unknown property "%s"',o)];var s;if("string"===getType(a)&&l["property-function"]&&!l.tokens&&(s=/^{([^}]+)}$/.exec(a)))return[new ValidationError(r,a,'"%s" does not support interpolation syntax\nUse an identity property function instead: `{ "type": "identity", "property": %s` }`.',o,JSON.stringify(s[1]))];var u=[];return"symbol"===e.layerType&&"text-field"===o&&i&&!i.glyphs&&u.push(new ValidationError(r,a,'use of "text-field" requires a style "glyphs" property')),u.concat(validate({key:e.key,value:a,valueSpec:l,style:i,styleSpec:n,expressionContext:"property"}))}; -},{"../error/validation_error":121,"../util/get_type":151,"./validate":156}],173:[function(_dereq_,module,exports){ -"use strict";var ValidationError=_dereq_("../error/validation_error"),unbundle=_dereq_("../util/unbundle_jsonlint"),validateObject=_dereq_("./validate_object"),validateEnum=_dereq_("./validate_enum");module.exports=function(e){var a=e.value,t=e.key,r=e.styleSpec,l=e.style;if(!a.type)return[new ValidationError(t,a,'"type" is required')];var u=unbundle(a.type),i=[];switch(u){case"vector":case"raster":if(i=i.concat(validateObject({key:t,value:a,valueSpec:r.source_tile,style:e.style,styleSpec:r})),"url"in a)for(var s in a)["type","url","tileSize"].indexOf(s)<0&&i.push(new ValidationError(t+"."+s,a[s],'a source with a "url" property may not include a "%s" property',s));return i;case"geojson":return validateObject({key:t,value:a,valueSpec:r.source_geojson,style:l,styleSpec:r});case"video":return validateObject({key:t,value:a,valueSpec:r.source_video,style:l,styleSpec:r});case"image":return validateObject({key:t,value:a,valueSpec:r.source_image,style:l,styleSpec:r});case"canvas":return validateObject({key:t,value:a,valueSpec:r.source_canvas,style:l,styleSpec:r});default:return validateEnum({key:t+".type",value:a.type,valueSpec:{values:["vector","raster","geojson","video","image","canvas"]},style:l,styleSpec:r})}}; -},{"../error/validation_error":121,"../util/unbundle_jsonlint":155,"./validate_enum":161,"./validate_object":170}],174:[function(_dereq_,module,exports){ -"use strict";var getType=_dereq_("../util/get_type"),ValidationError=_dereq_("../error/validation_error");module.exports=function(r){var e=r.value,t=r.key,i=getType(e);return"string"!==i?[new ValidationError(t,e,"string expected, %s found",i)]:[]}; -},{"../error/validation_error":121,"../util/get_type":151}],175:[function(_dereq_,module,exports){ -"use strict";function validateStyleMin(e,a){a=a||latestStyleSpec;var t=[];return t=t.concat(validate({key:"",value:e,valueSpec:a.$root,styleSpec:a,style:e,objectElementValidators:{glyphs:validateGlyphsURL,"*":function(){return[]}}})),a.$version>7&&e.constants&&(t=t.concat(validateConstants({key:"constants",value:e.constants,style:e,styleSpec:a}))),sortErrors(t)}function sortErrors(e){return[].concat(e).sort(function(e,a){return e.line-a.line})}function wrapCleanErrors(e){return function(){return sortErrors(e.apply(this,arguments))}}var validateConstants=_dereq_("./validate/validate_constants"),validate=_dereq_("./validate/validate"),latestStyleSpec=_dereq_("./reference/latest"),validateGlyphsURL=_dereq_("./validate/validate_glyphs_url");validateStyleMin.source=wrapCleanErrors(_dereq_("./validate/validate_source")),validateStyleMin.light=wrapCleanErrors(_dereq_("./validate/validate_light")),validateStyleMin.layer=wrapCleanErrors(_dereq_("./validate/validate_layer")),validateStyleMin.filter=wrapCleanErrors(_dereq_("./validate/validate_filter")),validateStyleMin.paintProperty=wrapCleanErrors(_dereq_("./validate/validate_paint_property")),validateStyleMin.layoutProperty=wrapCleanErrors(_dereq_("./validate/validate_layout_property")),module.exports=validateStyleMin; -},{"./reference/latest":147,"./validate/validate":156,"./validate/validate_constants":160,"./validate/validate_filter":163,"./validate/validate_glyphs_url":165,"./validate/validate_layer":166,"./validate/validate_layout_property":167,"./validate/validate_light":168,"./validate/validate_paint_property":171,"./validate/validate_source":173}],176:[function(_dereq_,module,exports){ -"use strict";var AnimationLoop=function(){this.n=0,this.times=[]};AnimationLoop.prototype.stopped=function(){return this.times=this.times.filter(function(t){return t.time>=(new Date).getTime()}),!this.times.length},AnimationLoop.prototype.set=function(t){return this.times.push({id:this.n,time:t+(new Date).getTime()}),this.n++},AnimationLoop.prototype.cancel=function(t){this.times=this.times.filter(function(i){return i.id!==t})},module.exports=AnimationLoop; -},{}],177:[function(_dereq_,module,exports){ -"use strict";var styleSpec=_dereq_("../style-spec/reference/latest"),util=_dereq_("../util/util"),Evented=_dereq_("../util/evented"),validateStyle=_dereq_("./validate_style"),StyleDeclaration=_dereq_("./style_declaration"),StyleTransition=_dereq_("./style_transition"),TRANSITION_SUFFIX="-transition",properties=["anchor","color","position","intensity"],specifications=styleSpec.light,Light=function(t){function i(i){t.call(this),this.set(i)}return t&&(i.__proto__=t),i.prototype=Object.create(t&&t.prototype),i.prototype.constructor=i,i.prototype.set=function(t){var i=this;if(!this._validate(validateStyle.light,t)){this._declarations={},this._transitions={},this._transitionOptions={},this.calculated={},t=util.extend({anchor:specifications.anchor.default,color:specifications.color.default,position:specifications.position.default,intensity:specifications.intensity.default},t);for(var e=0,o=properties;e1?"@2x":"";ajax.getJSON(r(normalizeSpriteURL(e,n,".json"),ajax.ResourceType.SpriteJSON),function(e,r){u||(u=e,t=r,a())}),ajax.getImage(r(normalizeSpriteURL(e,n,".png"),ajax.ResourceType.SpriteImage),function(e,r){u||(u=e,o=r,a())})}; -},{"../util/ajax":230,"../util/browser":231,"../util/image":242,"../util/mapbox":246}],180:[function(_dereq_,module,exports){ -"use strict";function readFontstacks(e,a,r){1===e&&r.readMessage(readFontstack,a)}function readFontstack(e,a,r){if(3===e){var t=r.readMessage(readGlyph,{}),d=t.id,i=t.bitmap,n=t.width,o=t.height,h=t.left,s=t.top,p=t.advance;a.push({id:d,bitmap:AlphaImage.create({width:n+2*border,height:o+2*border},i),metrics:{width:n,height:o,left:h,top:s,advance:p}})}}function readGlyph(e,a,r){1===e?a.id=r.readVarint():2===e?a.bitmap=r.readBytes():3===e?a.width=r.readVarint():4===e?a.height=r.readVarint():5===e?a.left=r.readSVarint():6===e?a.top=r.readSVarint():7===e&&(a.advance=r.readVarint())}var ref=_dereq_("../util/image"),AlphaImage=ref.AlphaImage,Protobuf=_dereq_("pbf"),border=3;module.exports=function(e){return new Protobuf(e).readFields(readFontstacks,[])},module.exports.GLYPH_PBF_BORDER=border; -},{"../util/image":242,"pbf":38}],181:[function(_dereq_,module,exports){ -"use strict";function getMaximumPaintValue(t,a,e){return a.isPaintValueFeatureConstant(t)?a.paint[t]:e.programConfigurations.get(a.id).paintPropertyStatistics[t].max}function translateDistance(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function translate(t,a,e,n,r){if(!a[0]&&!a[1])return t;var i=Point.convert(a);"viewport"===e&&i._rotate(-n);for(var u=[],s=0;sMath.floor(e)&&(t.lastIntegerZoom=Math.floor(e+1),t.lastIntegerZoomTime=Date.now()),t.lastZoom=e},t.prototype._checkLoaded=function(){if(!this._loaded)throw new Error("Style is not done loading")},t.prototype.update=function(e){var t=this;if(this._changed){var r=Object.keys(this._updatedLayers),a=Object.keys(this._removedLayers);(r.length||a.length||this._updatedSymbolOrder)&&this._updateWorkerLayers(r,a);for(var i in t._updatedSources){var o=t._updatedSources[i];"reload"===o?t._reloadSource(i):"clear"===o&&t._clearSource(i)}this._applyPaintPropertyUpdates(e),this._resetUpdates(),this.fire("data",{dataType:"style"})}},t.prototype._updateWorkerLayers=function(e,t){var r=this,a=this._updatedSymbolOrder?this._order.filter(function(e){return"symbol"===r._layers[e].type}):null;this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(e),removedIds:t,symbolOrder:a})},t.prototype._resetUpdates=function(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSymbolOrder=!1,this._updatedSources={},this._updatedPaintProps={},this._updatedAllPaintProps=!1},t.prototype.setState=function(e){var t=this;if(this._checkLoaded(),validateStyle.emitErrors(this,validateStyle(e)))return!1;e=util.clone(e),e.layers=deref(e.layers);var r=diff(this.serialize(),e).filter(function(e){return!(e.command in ignoredDiffOperations)});if(0===r.length)return!1;var a=r.filter(function(e){return!(e.command in supportedDiffOperations)});if(a.length>0)throw new Error("Unimplemented: "+a.map(function(e){return e.command}).join(", ")+".");return r.forEach(function(e){"setTransition"!==e.command&&t[e.command].apply(t,e.args)}),this.stylesheet=e,!0},t.prototype.addImage=function(e,t){if(this.imageManager.getImage(e))return this.fire("error",{error:new Error("An image with this name already exists.")});this.imageManager.addImage(e,t),this.fire("data",{dataType:"style"})},t.prototype.removeImage=function(e){if(!this.imageManager.getImage(e))return this.fire("error",{error:new Error("No image with this name exists.")});this.imageManager.removeImage(e),this.fire("data",{dataType:"style"})},t.prototype.addSource=function(e,t,r){var a=this;if(this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error("There is already a source with this ID");if(!t.type)throw new Error("The type property must be defined, but the only the following properties were given: "+Object.keys(t).join(", ")+".");if(!(["vector","raster","geojson","video","image","canvas"].indexOf(t.type)>=0&&this._validate(validateStyle.source,"sources."+e,t,null,r))){var i=this.sourceCaches[e]=new SourceCache(e,t,this.dispatcher);i.style=this,i.setEventedParent(this,function(){return{isSourceLoaded:a.loaded(),source:i.serialize(),sourceId:e}}),i.onAdd(this.map),this._changed=!0}},t.prototype.removeSource=function(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");var t=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],t.fire("data",{sourceDataType:"metadata",dataType:"source",sourceId:e}),t.setEventedParent(null),t.clearTiles(),t.onRemove&&t.onRemove(this.map),this._changed=!0},t.prototype.setGeoJSONSourceData=function(e,t){this._checkLoaded(),this.sourceCaches[e].getSource().setData(t),this._changed=!0},t.prototype.getSource=function(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()},t.prototype.addLayer=function(e,t,r){this._checkLoaded();var a=e.id;if("object"==typeof e.source&&(this.addSource(a,e.source),e=util.clone(e),e=util.extend(e,{source:a})),!this._validate(validateStyle.layer,"layers."+a,e,{arrayIndex:-1},r)){var i=StyleLayer.create(e);this._validateLayer(i),i.setEventedParent(this,{layer:{id:a}});var o=t?this._order.indexOf(t):this._order.length;if(t&&-1===o)return void this.fire("error",{message:new Error('Layer with id "'+t+'" does not exist on this map.')});if(this._order.splice(o,0,a),this._layers[a]=i,this._removedLayers[a]&&i.source){var s=this._removedLayers[a];delete this._removedLayers[a],s.type!==i.type?this._updatedSources[i.source]="clear":(this._updatedSources[i.source]="reload",this.sourceCaches[i.source].pause())}this._updateLayer(i),"symbol"===i.type&&(this._updatedSymbolOrder=!0),this.updatePaintProperties(a)}},t.prototype.moveLayer=function(e,t){this._checkLoaded(),this._changed=!0;var r=this._layers[e];if(!r)return void this.fire("error",{error:new Error("The layer '"+e+"' does not exist in the map's style and cannot be moved.")});var a=this._order.indexOf(e);this._order.splice(a,1);var i=t?this._order.indexOf(t):this._order.length;this._order.splice(i,0,e),"symbol"===r.type&&(this._updatedSymbolOrder=!0,r.source&&!this._updatedSources[r.source]&&(this._updatedSources[r.source]="reload",this.sourceCaches[r.source].pause()))},t.prototype.removeLayer=function(e){this._checkLoaded();var t=this._layers[e];if(!t)return void this.fire("error",{error:new Error("The layer '"+e+"' does not exist in the map's style and cannot be removed.")});t.setEventedParent(null);var r=this._order.indexOf(e);this._order.splice(r,1),"symbol"===t.type&&(this._updatedSymbolOrder=!0),this._changed=!0,this._removedLayers[e]=t,delete this._layers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e]},t.prototype.getLayer=function(e){return this._layers[e]},t.prototype.setLayerZoomRange=function(e,t,r){this._checkLoaded();var a=this.getLayer(e);if(!a)return void this.fire("error",{error:new Error("The layer '"+e+"' does not exist in the map's style and cannot have zoom extent.")});a.minzoom===t&&a.maxzoom===r||(null!=t&&(a.minzoom=t),null!=r&&(a.maxzoom=r),this._updateLayer(a))},t.prototype.setFilter=function(e,t){this._checkLoaded();var r=this.getLayer(e);if(!r)return void this.fire("error",{error:new Error("The layer '"+e+"' does not exist in the map's style and cannot be filtered.")});null!==t&&void 0!==t&&this._validate(validateStyle.filter,"layers."+r.id+".filter",t)||util.deepEqual(r.filter,t)||(r.filter=util.clone(t),this._updateLayer(r))},t.prototype.getFilter=function(e){return util.clone(this.getLayer(e).filter)},t.prototype.setLayoutProperty=function(e,t,r){this._checkLoaded();var a=this.getLayer(e);if(!a)return void this.fire("error",{error:new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")});util.deepEqual(a.getLayoutProperty(t),r)||(a.setLayoutProperty(t,r),this._updateLayer(a))},t.prototype.getLayoutProperty=function(e,t){return this.getLayer(e).getLayoutProperty(t)},t.prototype.setPaintProperty=function(e,t,r){this._checkLoaded();var a=this.getLayer(e);if(!a)return void this.fire("error",{error:new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")});if(!util.deepEqual(a.getPaintProperty(t),r)){var i=a.isPaintValueFeatureConstant(t);a.setPaintProperty(t,r);a.isPaintValueFeatureConstant(t)&&i||this._updateLayer(a),this.updatePaintProperties(e,t)}},t.prototype.getPaintProperty=function(e,t){return this.getLayer(e).getPaintProperty(t)},t.prototype.getTransition=function(){return util.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)},t.prototype.updatePaintProperties=function(e,t){if(this._changed=!0,e){var r=this._updatedPaintProps;r[e]||(r[e]={}),r[e][t||"all"]=!0}else this._updatedAllPaintProps=!0},t.prototype.serialize=function(){var e=this;return util.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:util.mapObject(this.sourceCaches,function(e){return e.serialize()}),layers:this._order.map(function(t){return e._layers[t].serialize()})},function(e){return void 0!==e})},t.prototype._updateLayer=function(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._changed=!0},t.prototype._flattenRenderedFeatures=function(e){for(var t=this,r=[],a=this._order.length-1;a>=0;a--)for(var i=t._order[a],o=0,s=e;o=this.maxzoom)||"none"===this.layout.visibility)},e.prototype.updatePaintTransitions=function(t,e,i,a){var o,n=this;for(o in n._paintDeclarations)n._applyPaintDeclaration(o,n._paintDeclarations[o],t,e,i,a);for(o in n._paintTransitions)o in n._paintDeclarations||n._applyPaintDeclaration(o,null,t,e,i,a)},e.prototype.updatePaintTransition=function(t,e,i,a,o){var n=this._paintDeclarations[t];this._applyPaintDeclaration(t,n,e,i,a,o)},e.prototype.recalculate=function(t){var e=this;for(var i in e._paintTransitions)e.paint[i]=e.getPaintValue(i,{zoom:t});for(var a in e._layoutFunctions)e.layout[a]=e.getLayoutValue(a,{zoom: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:util.mapObject(this._layoutDeclarations,getDeclarationValue),paint:util.mapObject(this._paintDeclarations,getDeclarationValue)};return util.filterObject(t,function(t,e){return!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)})},e.prototype._applyPaintDeclaration=function(t,e,i,a,o,n){var r=i.transition?this._paintTransitions[t]:void 0,s=this._paintSpecifications[t];if(null!==e&&void 0!==e||(e=new StyleDeclaration(s,s.default,t)),!r||r.declaration.json!==e.json){var l=util.extend({duration:300,delay:0},a,this.getPaintProperty(t+TRANSITION_SUFFIX)),u=this._paintTransitions[t]=new StyleTransition(s,e,r,l,n);o&&(u.instant()||(u.loopID=o.set(u.endTime-Date.now())),r&&o.cancel(r.loopID))}},e.prototype._updateLayoutValue=function(t){var e=this._layoutDeclarations[t];!e||e.expression.isZoomConstant&&e.expression.isFeatureConstant?(delete this._layoutFunctions[t],this.layout[t]=this.getLayoutValue(t,{zoom:0})):this._layoutFunctions[t]=!0},e.prototype._validate=function(t,e,i,a,o){return(!o||!1!==o.validate)&&validateStyle.emitErrors(this,t.call(validateStyle,{key:e,layerType:this.type,objectKey:i,value:a,styleSpec:styleSpec,style:{glyphs:!0,sprite:!0}}))},e.prototype.has3DPass=function(){return!1},e.prototype.resize=function(t){},e}(Evented);module.exports=StyleLayer;var subclasses={circle:_dereq_("./style_layer/circle_style_layer"),heatmap:_dereq_("./style_layer/heatmap_style_layer"),fill:_dereq_("./style_layer/fill_style_layer"),"fill-extrusion":_dereq_("./style_layer/fill_extrusion_style_layer"),line:_dereq_("./style_layer/line_style_layer"),symbol:_dereq_("./style_layer/symbol_style_layer"),background:_dereq_("./style_layer/background_style_layer"),raster:_dereq_("./style_layer/raster_style_layer")};StyleLayer.create=function(t){return new subclasses[t.type](t)}; -},{"../style-spec/reference/latest":147,"../util/evented":239,"../util/util":252,"./../style-spec/util/parse_color":153,"./style_declaration":183,"./style_layer/background_style_layer":185,"./style_layer/circle_style_layer":186,"./style_layer/fill_extrusion_style_layer":187,"./style_layer/fill_style_layer":188,"./style_layer/heatmap_style_layer":189,"./style_layer/line_style_layer":190,"./style_layer/raster_style_layer":191,"./style_layer/symbol_style_layer":192,"./style_transition":194,"./validate_style":195}],185:[function(_dereq_,module,exports){ -"use strict";var StyleLayer=_dereq_("../style_layer"),BackgroundStyleLayer=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.isOpacityZero=function(t){return 0===this.getPaintValue("background-opacity",{zoom:t})},e}(StyleLayer);module.exports=BackgroundStyleLayer; -},{"../style_layer":184}],186:[function(_dereq_,module,exports){ -"use strict";var StyleLayer=_dereq_("../style_layer"),CircleBucket=_dereq_("../../data/bucket/circle_bucket"),ref=_dereq_("../../util/intersection_tests"),multiPolygonIntersectsBufferedMultiPoint=ref.multiPolygonIntersectsBufferedMultiPoint,ref$1=_dereq_("../query_utils"),getMaximumPaintValue=ref$1.getMaximumPaintValue,translateDistance=ref$1.translateDistance,translate=ref$1.translate,CircleStyleLayer=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.createBucket=function(t){return new CircleBucket(t)},e.prototype.isOpacityZero=function(t){return this.isPaintValueFeatureConstant("circle-opacity")&&0===this.getPaintValue("circle-opacity",{zoom:t})&&this.isPaintValueFeatureConstant("circle-stroke-width")&&0===this.getPaintValue("circle-stroke-width",{zoom:t})||this.isPaintValueFeatureConstant("circle-stroke-opacity")&&0===this.getPaintValue("circle-stroke-opacity",{zoom:t})},e.prototype.queryRadius=function(t){return getMaximumPaintValue("circle-radius",this,t)+translateDistance(this.paint["circle-translate"])},e.prototype.queryIntersectsFeature=function(t,e,r,i,a,n){var o=translate(t,this.getPaintValue("circle-translate",{zoom:i},e),this.getPaintValue("circle-translate-anchor",{zoom:i},e),a,n),c=this.getPaintValue("circle-radius",{zoom:i},e)*n;return multiPolygonIntersectsBufferedMultiPoint(o,r,c)},e}(StyleLayer);module.exports=CircleStyleLayer; -},{"../../data/bucket/circle_bucket":52,"../../util/intersection_tests":243,"../query_utils":181,"../style_layer":184}],187:[function(_dereq_,module,exports){ -"use strict";var StyleLayer=_dereq_("../style_layer"),FillExtrusionBucket=_dereq_("../../data/bucket/fill_extrusion_bucket"),ref=_dereq_("../../util/intersection_tests"),multiPolygonIntersectsMultiPolygon=ref.multiPolygonIntersectsMultiPolygon,ref$1=_dereq_("../query_utils"),translateDistance=ref$1.translateDistance,translate=ref$1.translate,FillExtrusionStyleLayer=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.getPaintValue=function(e,r,i){var o=t.prototype.getPaintValue.call(this,e,r,i);return"fill-extrusion-color"===e&&o&&(o[3]=1),o},e.prototype.createBucket=function(t){return new FillExtrusionBucket(t)},e.prototype.isOpacityZero=function(t){return 0===this.getPaintValue("fill-extrusion-opacity",{zoom:t})},e.prototype.queryRadius=function(){return translateDistance(this.paint["fill-extrusion-translate"])},e.prototype.queryIntersectsFeature=function(t,e,r,i,o,n){var l=translate(t,this.getPaintValue("fill-extrusion-translate",{zoom:i},e),this.getPaintValue("fill-extrusion-translate-anchor",{zoom:i},e),o,n);return multiPolygonIntersectsMultiPolygon(l,r)},e.prototype.has3DPass=function(){return 0!==this.paint["fill-extrusion-opacity"]&&"none"!==this.layout.visibility},e.prototype.resize=function(t){if(this.viewportFrame){var e=this.viewportFrame,r=e.texture,i=e.fbo;t.deleteTexture(r),t.deleteFramebuffer(i),this.viewportFrame=null}},e}(StyleLayer);module.exports=FillExtrusionStyleLayer; -},{"../../data/bucket/fill_extrusion_bucket":54,"../../util/intersection_tests":243,"../query_utils":181,"../style_layer":184}],188:[function(_dereq_,module,exports){ -"use strict";var StyleLayer=_dereq_("../style_layer"),FillBucket=_dereq_("../../data/bucket/fill_bucket"),ref=_dereq_("../../util/intersection_tests"),multiPolygonIntersectsMultiPolygon=ref.multiPolygonIntersectsMultiPolygon,ref$1=_dereq_("../query_utils"),translateDistance=ref$1.translateDistance,translate=ref$1.translate,FillStyleLayer=function(t){function o(){t.apply(this,arguments)}return t&&(o.__proto__=t),o.prototype=Object.create(t&&t.prototype),o.prototype.constructor=o,o.prototype.getPaintValue=function(o,e,l){var i=this;if("fill-outline-color"===o){if(void 0===this.getPaintProperty("fill-outline-color"))return t.prototype.getPaintValue.call(this,"fill-color",e,l);for(var r=this._paintTransitions["fill-outline-color"];r;){if(!(r&&r.declaration&&r.declaration.value))return t.prototype.getPaintValue.call(i,"fill-color",e,l);r=r.oldTransition}}return t.prototype.getPaintValue.call(this,o,e,l)},o.prototype.getPaintInterpolationFactor=function(o){for(var e=[],l=arguments.length-1;l-- >0;)e[l]=arguments[l+1];return"fill-outline-color"===o&&void 0===this.getPaintProperty("fill-outline-color")?t.prototype.getPaintInterpolationFactor.apply(this,["fill-color"].concat(e)):t.prototype.getPaintInterpolationFactor.apply(this,[o].concat(e))},o.prototype.isPaintValueFeatureConstant=function(o){return"fill-outline-color"===o&&void 0===this.getPaintProperty("fill-outline-color")?t.prototype.isPaintValueFeatureConstant.call(this,"fill-color"):t.prototype.isPaintValueFeatureConstant.call(this,o)},o.prototype.isPaintValueZoomConstant=function(o){return"fill-outline-color"===o&&void 0===this.getPaintProperty("fill-outline-color")?t.prototype.isPaintValueZoomConstant.call(this,"fill-color"):t.prototype.isPaintValueZoomConstant.call(this,o)},o.prototype.createBucket=function(t){return new FillBucket(t)},o.prototype.isOpacityZero=function(t){return this.isPaintValueFeatureConstant("fill-opacity")&&0===this.getPaintValue("fill-opacity",{zoom:t})},o.prototype.queryRadius=function(){return translateDistance(this.paint["fill-translate"])},o.prototype.queryIntersectsFeature=function(t,o,e,l,i,r){var n=translate(t,this.getPaintValue("fill-translate",{zoom:l},o),this.getPaintValue("fill-translate-anchor",{zoom:l},o),i,r);return multiPolygonIntersectsMultiPolygon(n,e)},o}(StyleLayer);module.exports=FillStyleLayer; -},{"../../data/bucket/fill_bucket":53,"../../util/intersection_tests":243,"../query_utils":181,"../style_layer":184}],189:[function(_dereq_,module,exports){ -"use strict";var StyleLayer=_dereq_("../style_layer"),HeatmapBucket=_dereq_("../../data/bucket/heatmap_bucket"),RGBAImage=_dereq_("../../util/image").RGBAImage,HeatmapStyleLayer=function(t){function a(a){t.call(this,a),this.colorRampData=new Uint8Array(1024),this.getPaintProperty("heatmap-color")||this.setPaintProperty("heatmap-color",this._paintSpecifications["heatmap-color"].default,"")}return t&&(a.__proto__=t),a.prototype=Object.create(t&&t.prototype),a.prototype.constructor=a,a.prototype.createBucket=function(t){return new HeatmapBucket(t)},a.prototype.isOpacityZero=function(t){return 0===this.getPaintValue("heatmap-opacity",{zoom:t})},a.prototype._applyPaintDeclaration=function(a,e,o,r,p,i){var l=this;if(t.prototype._applyPaintDeclaration.call(this,a,e,o,r,p,i),"heatmap-color"===a){for(var c=this.colorRampData.length,h=4;h0?e+2*t:t}function offsetLine(t,e){for(var i=[],n=new Point(0,0),r=0;r=this.endTime)return o;var a=this.oldTransition.calculate(t,i,this.startTime),n=util.easeCubicInOut((e-this.startTime-this.delay)/this.duration);return this.interp(a,o,n)},StyleTransition.prototype._calculateTargetValue=function(t,i){if(!this.zoomTransitioned)return this.declaration.calculate(t,i);var e=t.zoom,o=this.zoomHistory.lastIntegerZoom,a=e>o?2:.5,n=this.declaration.calculate({zoom:e>o?e-1:e+1},i),r=this.declaration.calculate({zoom:e},i),s=Math.min((Date.now()-this.zoomHistory.lastIntegerZoomTime)/this.duration,1),l=Math.abs(e-o),u=interpolate(s,1,l);return void 0!==n&&void 0!==r?{from:n,fromScale:a,to:r,toScale:1,t:u}:void 0},module.exports=StyleTransition; -},{"../style-spec/util/interpolate":152,"../util/util":252}],195:[function(_dereq_,module,exports){ +},{"../util/ajax":251,"../util/mapbox":267,"./parse_glyph_pbf":186}],185:[function(_dereq_,module,exports){ +"use strict";var ajax=_dereq_("../util/ajax"),browser=_dereq_("../util/browser"),ref=_dereq_("../util/mapbox"),normalizeSpriteURL=ref.normalizeSpriteURL,ref$1=_dereq_("../util/image"),RGBAImage=ref$1.RGBAImage;module.exports=function(e,i,r){function a(){if(n)r(n);else if(t&&o){var e=browser.getImageData(o),i={};for(var a in t){var u=t[a],g=u.width,l=u.height,x=u.x,m=u.y,p=u.sdf,f=u.pixelRatio,s=new RGBAImage({width:g,height:l});RGBAImage.copy(e,s,{x:x,y:m},{x:0,y:0},{width:g,height:l}),i[a]={data:s,pixelRatio:f,sdf:p}}r(null,i)}}var t,o,n,u=browser.devicePixelRatio>1?"@2x":"";ajax.getJSON(i(normalizeSpriteURL(e,u,".json"),ajax.ResourceType.SpriteJSON),function(e,i){n||(n=e,t=i,a())}),ajax.getImage(i(normalizeSpriteURL(e,u,".png"),ajax.ResourceType.SpriteImage),function(e,i){n||(n=e,o=i,a())})}; +},{"../util/ajax":251,"../util/browser":252,"../util/image":263,"../util/mapbox":267}],186:[function(_dereq_,module,exports){ +"use strict";function readFontstacks(e,a,r){1===e&&r.readMessage(readFontstack,a)}function readFontstack(e,a,r){if(3===e){var t=r.readMessage(readGlyph,{}),d=t.id,i=t.bitmap,n=t.width,o=t.height,h=t.left,s=t.top,p=t.advance;a.push({id:d,bitmap:new AlphaImage({width:n+2*border,height:o+2*border},i),metrics:{width:n,height:o,left:h,top:s,advance:p}})}}function readGlyph(e,a,r){1===e?a.id=r.readVarint():2===e?a.bitmap=r.readBytes():3===e?a.width=r.readVarint():4===e?a.height=r.readVarint():5===e?a.left=r.readSVarint():6===e?a.top=r.readSVarint():7===e&&(a.advance=r.readVarint())}var ref=_dereq_("../util/image"),AlphaImage=ref.AlphaImage,Protobuf=_dereq_("pbf"),border=3;module.exports=function(e){return new Protobuf(e).readFields(readFontstacks,[])},module.exports.GLYPH_PBF_BORDER=border; +},{"../util/image":263,"pbf":30}],187:[function(_dereq_,module,exports){ +"use strict";var browser=_dereq_("../util/browser"),Placement=_dereq_("../symbol/placement"),LayerPlacement=function(){this._currentTileIndex=0,this._seenCrossTileIDs={}};LayerPlacement.prototype.continuePlacement=function(e,n,t,r,o){for(var l=this;this._currentTileIndex2};this._currentPlacementIndex>=0;){var s=e[r._currentPlacementIndex],a=n[s],i=r.placement.collisionIndex.transform.zoom;if("symbol"===a.type&&(!a.minzoom||a.minzoom<=i)&&(!a.maxzoom||a.maxzoom>i)){r._inProgressLayer||(r._inProgressLayer=new LayerPlacement);if(r._inProgressLayer.continuePlacement(t[a.source],r.placement,r._showCollisionBoxes,a,l))return;delete r._inProgressLayer}r._currentPlacementIndex--}this._done=!0},PauseablePlacement.prototype.commit=function(e,n){return this.placement.commit(e,n),this.placement},module.exports=PauseablePlacement; +},{"../symbol/placement":223,"../util/browser":252}],188:[function(_dereq_,module,exports){ +"use strict";var ref=_dereq_("../util/util"),clone=ref.clone,extend=ref.extend,easeCubicInOut=ref.easeCubicInOut,interpolate=_dereq_("../style-spec/util/interpolate"),ref$1=_dereq_("../style-spec/expression"),normalizePropertyExpression=ref$1.normalizePropertyExpression,Color=_dereq_("../style-spec/util/color"),ref$2=_dereq_("../util/web_worker_transfer"),register=ref$2.register,PropertyValue=function(t,e){this.property=t,this.value=e,this.expression=normalizePropertyExpression(void 0===e?t.specification.default:e,t.specification)};PropertyValue.prototype.isDataDriven=function(){return"source"===this.expression.kind||"composite"===this.expression.kind},PropertyValue.prototype.possiblyEvaluate=function(t){return this.property.possiblyEvaluate(this,t)};var TransitionablePropertyValue=function(t){this.property=t,this.value=new PropertyValue(t,void 0)};TransitionablePropertyValue.prototype.transitioned=function(t,e){return new TransitioningPropertyValue(this.property,this.value,e,extend({},t.transition,this.transition),t.now)},TransitionablePropertyValue.prototype.untransitioned=function(){return new TransitioningPropertyValue(this.property,this.value,null,{},0)};var Transitionable=function(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)};Transitionable.prototype.getValue=function(t){return clone(this._values[t].value.value)},Transitionable.prototype.setValue=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new TransitionablePropertyValue(this._values[t].property)),this._values[t].value=new PropertyValue(this._values[t].property,null===e?void 0:clone(e))},Transitionable.prototype.getTransition=function(t){return clone(this._values[t].transition)},Transitionable.prototype.setTransition=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new TransitionablePropertyValue(this._values[t].property)),this._values[t].transition=clone(e)||void 0},Transitionable.prototype.serialize=function(){for(var t=this,e={},r=0,a=Object.keys(t._values);rthis.end)return this.prior=null,r;if(this.value.isDataDriven())return this.prior=null,r;if(ea.zoomHistory.lastIntegerZoom?{from:t,to:e,fromScale:2,toScale:1,t:i+(1-i)*n}:{from:r,to:e,fromScale:.5,toScale:1,t:1-(1-n)*i}},CrossFadedProperty.prototype.interpolate=function(t){return t};var HeatmapColorProperty=function(t){this.specification=t};HeatmapColorProperty.prototype.possiblyEvaluate=function(){},HeatmapColorProperty.prototype.interpolate=function(){};var Properties=function(t){var e=this;this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={};for(var r in t){var a=t[r],o=e.defaultPropertyValues[r]=new PropertyValue(a,void 0),i=e.defaultTransitionablePropertyValues[r]=new TransitionablePropertyValue(a);e.defaultTransitioningPropertyValues[r]=i.untransitioned(),e.defaultPossiblyEvaluatedValues[r]=o.possiblyEvaluate({})}};register("DataDrivenProperty",DataDrivenProperty),register("DataConstantProperty",DataConstantProperty),register("CrossFadedProperty",CrossFadedProperty),register("HeatmapColorProperty",HeatmapColorProperty),module.exports={PropertyValue:PropertyValue,Transitionable:Transitionable,Transitioning:Transitioning,Layout:Layout,PossiblyEvaluatedPropertyValue:PossiblyEvaluatedPropertyValue,PossiblyEvaluated:PossiblyEvaluated,DataConstantProperty:DataConstantProperty,DataDrivenProperty:DataDrivenProperty,CrossFadedProperty:CrossFadedProperty,HeatmapColorProperty:HeatmapColorProperty,Properties:Properties}; +},{"../style-spec/expression":139,"../style-spec/util/color":153,"../style-spec/util/interpolate":158,"../util/util":275,"../util/web_worker_transfer":278}],189:[function(_dereq_,module,exports){ +"use strict";function getMaximumPaintValue(t,a,e){var n=a.paint.get(t).value;return"constant"===n.kind?n.value:e.programConfigurations.get(a.id).binders[t].statistics.max}function translateDistance(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function translate(t,a,e,n,r){if(!a[0]&&!a[1])return t;var i=Point.convert(a);"viewport"===e&&i._rotate(-n);for(var u=[],s=0;s0)throw new Error("Unimplemented: "+a.map(function(e){return e.command}).join(", ")+".");return t.forEach(function(e){"setTransition"!==e.command&&r[e.command].apply(r,e.args)}),this.stylesheet=e,!0},r.prototype.addImage=function(e,r){if(this.getImage(e))return this.fire("error",{error:new Error("An image with this name already exists.")});this.imageManager.addImage(e,r),this.fire("data",{dataType:"style"})},r.prototype.getImage=function(e){return this.imageManager.getImage(e)},r.prototype.removeImage=function(e){if(!this.getImage(e))return this.fire("error",{error:new Error("No image with this name exists.")});this.imageManager.removeImage(e),this.fire("data",{dataType:"style"})},r.prototype.addSource=function(e,r,t){var a=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","canvas"].indexOf(r.type)>=0&&this._validate(validateStyle.source,"sources."+e,r,null,t))){this.map&&this.map._collectResourceTiming&&(r.collectResourceTiming=!0);var i=this.sourceCaches[e]=new SourceCache(e,r,this.dispatcher);i.style=this,i.setEventedParent(this,function(){return{isSourceLoaded:a.loaded(),source:i.serialize(),sourceId:e}}),i.onAdd(this.map),this._changed=!0}},r.prototype.removeSource=function(e){var r=this;if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(var t in r._layers)if(r._layers[t].source===e)return r.fire("error",{error:new Error('Source "'+e+'" cannot be removed while layer "'+t+'" is using it.')});var a=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],a.fire("data",{sourceDataType:"metadata",dataType:"source",sourceId:e}),a.setEventedParent(null),a.clearTiles(),a.onRemove&&a.onRemove(this.map),this._changed=!0},r.prototype.setGeoJSONSourceData=function(e,r){this._checkLoaded(),this.sourceCaches[e].getSource().setData(r),this._changed=!0},r.prototype.getSource=function(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()},r.prototype.addLayer=function(e,r,t){this._checkLoaded();var a=e.id;if("object"==typeof e.source&&(this.addSource(a,e.source),e=util.clone(e),e=util.extend(e,{source:a})),!this._validate(validateStyle.layer,"layers."+a,e,{arrayIndex:-1},t)){var i=StyleLayer.create(e);this._validateLayer(i),i.setEventedParent(this,{layer:{id:a}});var s=r?this._order.indexOf(r):this._order.length;if(r&&-1===s)return void this.fire("error",{error:new Error('Layer with id "'+r+'" does not exist on this map.')});if(this._order.splice(s,0,a),this._layerOrderChanged=!0,this._layers[a]=i,this._removedLayers[a]&&i.source){var o=this._removedLayers[a];delete this._removedLayers[a],o.type!==i.type?this._updatedSources[i.source]="clear":(this._updatedSources[i.source]="reload",this.sourceCaches[i.source].pause())}this._updateLayer(i)}},r.prototype.moveLayer=function(e,r){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire("error",{error:new Error("The layer '"+e+"' does not exist in the map's style and cannot be moved.")});var t=this._order.indexOf(e);this._order.splice(t,1);var a=r?this._order.indexOf(r):this._order.length;if(r&&-1===a)return void this.fire("error",{error:new Error('Layer with id "'+r+'" does not exist on this map.')});this._order.splice(a,0,e),this._layerOrderChanged=!0},r.prototype.removeLayer=function(e){this._checkLoaded();var r=this._layers[e];if(!r)return void this.fire("error",{error:new Error("The layer '"+e+"' does not exist in the map's style and cannot be removed.")});r.setEventedParent(null);var t=this._order.indexOf(e);this._order.splice(t,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=r,delete this._layers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e]},r.prototype.getLayer=function(e){return this._layers[e]},r.prototype.setLayerZoomRange=function(e,r,t){this._checkLoaded();var a=this.getLayer(e);if(!a)return void this.fire("error",{error:new Error("The layer '"+e+"' does not exist in the map's style and cannot have zoom extent.")});a.minzoom===r&&a.maxzoom===t||(null!=r&&(a.minzoom=r),null!=t&&(a.maxzoom=t),this._updateLayer(a))},r.prototype.setFilter=function(e,r){this._checkLoaded();var t=this.getLayer(e);if(!t)return void this.fire("error",{error:new Error("The layer '"+e+"' does not exist in the map's style and cannot be filtered.")});if(!util.deepEqual(t.filter,r))return null===r||void 0===r?(t.filter=void 0,void this._updateLayer(t)):void(this._validate(validateStyle.filter,"layers."+t.id+".filter",r)||(t.filter=util.clone(r),this._updateLayer(t)))},r.prototype.getFilter=function(e){return util.clone(this.getLayer(e).filter)},r.prototype.setLayoutProperty=function(e,r,t){this._checkLoaded();var a=this.getLayer(e);if(!a)return void this.fire("error",{error:new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")});util.deepEqual(a.getLayoutProperty(r),t)||(a.setLayoutProperty(r,t),this._updateLayer(a))},r.prototype.getLayoutProperty=function(e,r){return this.getLayer(e).getLayoutProperty(r)},r.prototype.setPaintProperty=function(e,r,t){this._checkLoaded();var a=this.getLayer(e);if(!a)return void this.fire("error",{error:new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")});if(!util.deepEqual(a.getPaintProperty(r),t)){var i=a._transitionablePaint._values[r].value.isDataDriven();a.setPaintProperty(r,t);(a._transitionablePaint._values[r].value.isDataDriven()||i)&&this._updateLayer(a),this._changed=!0,this._updatedPaintProps[e]=!0}},r.prototype.getPaintProperty=function(e,r){return this.getLayer(e).getPaintProperty(r)},r.prototype.getTransition=function(){return util.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)},r.prototype.serialize=function(){var e=this;return util.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:util.mapObject(this.sourceCaches,function(e){return e.serialize()}),layers:this._order.map(function(r){return e._layers[r].serialize()})},function(e){return void 0!==e})},r.prototype._updateLayer=function(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._changed=!0},r.prototype._flattenRenderedFeatures=function(e){for(var r=this,t=[],a=this._order.length-1;a>=0;a--)for(var i=r._order[a],s=0,o=e;s=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"),util.filterObject(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,i,a,r){return(!r||!1!==r.validate)&&validateStyle.emitErrors(this,t.call(validateStyle,{key:e,layerType:this.type,objectKey:i,value:a,styleSpec:styleSpec,style:{glyphs:!0,sprite:!0}}))},e.prototype.hasOffscreenPass=function(){return!1},e.prototype.resize=function(){},e}(Evented);module.exports=StyleLayer;var subclasses={circle:_dereq_("./style_layer/circle_style_layer"),heatmap:_dereq_("./style_layer/heatmap_style_layer"),hillshade:_dereq_("./style_layer/hillshade_style_layer"),fill:_dereq_("./style_layer/fill_style_layer"),"fill-extrusion":_dereq_("./style_layer/fill_extrusion_style_layer"),line:_dereq_("./style_layer/line_style_layer"),symbol:_dereq_("./style_layer/symbol_style_layer"),background:_dereq_("./style_layer/background_style_layer"),raster:_dereq_("./style_layer/raster_style_layer")};StyleLayer.create=function(t){return new subclasses[t.type](t)}; +},{"../style-spec/reference/latest":151,"../util/evented":260,"../util/util":275,"./properties":188,"./style_layer/background_style_layer":192,"./style_layer/circle_style_layer":194,"./style_layer/fill_extrusion_style_layer":196,"./style_layer/fill_style_layer":198,"./style_layer/heatmap_style_layer":200,"./style_layer/hillshade_style_layer":202,"./style_layer/line_style_layer":204,"./style_layer/raster_style_layer":206,"./style_layer/symbol_style_layer":208,"./validate_style":211}],192:[function(_dereq_,module,exports){ +"use strict";var StyleLayer=_dereq_("../style_layer"),properties=_dereq_("./background_style_layer_properties"),ref=_dereq_("../properties"),Transitionable=ref.Transitionable,Transitioning=ref.Transitioning,PossiblyEvaluated=ref.PossiblyEvaluated,BackgroundStyleLayer=function(e){function r(r){e.call(this,r,properties)}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r}(StyleLayer);module.exports=BackgroundStyleLayer; +},{"../properties":188,"../style_layer":191,"./background_style_layer_properties":193}],193:[function(_dereq_,module,exports){ +"use strict";var styleSpec=_dereq_("../../style-spec/reference/latest"),ref=_dereq_("../properties"),Properties=ref.Properties,DataConstantProperty=ref.DataConstantProperty,DataDrivenProperty=ref.DataDrivenProperty,CrossFadedProperty=ref.CrossFadedProperty,HeatmapColorProperty=ref.HeatmapColorProperty,paint=new Properties({"background-color":new DataConstantProperty(styleSpec.paint_background["background-color"]),"background-pattern":new CrossFadedProperty(styleSpec.paint_background["background-pattern"]),"background-opacity":new DataConstantProperty(styleSpec.paint_background["background-opacity"])});module.exports={paint:paint}; +},{"../../style-spec/reference/latest":151,"../properties":188}],194:[function(_dereq_,module,exports){ +"use strict";var StyleLayer=_dereq_("../style_layer"),CircleBucket=_dereq_("../../data/bucket/circle_bucket"),ref=_dereq_("../../util/intersection_tests"),multiPolygonIntersectsBufferedMultiPoint=ref.multiPolygonIntersectsBufferedMultiPoint,ref$1=_dereq_("../query_utils"),getMaximumPaintValue=ref$1.getMaximumPaintValue,translateDistance=ref$1.translateDistance,translate=ref$1.translate,properties=_dereq_("./circle_style_layer_properties"),ref$2=_dereq_("../properties"),Transitionable=ref$2.Transitionable,Transitioning=ref$2.Transitioning,PossiblyEvaluated=ref$2.PossiblyEvaluated,CircleStyleLayer=function(e){function t(t){e.call(this,t,properties)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.createBucket=function(e){return new CircleBucket(e)},t.prototype.queryRadius=function(e){var t=e;return getMaximumPaintValue("circle-radius",this,t)+getMaximumPaintValue("circle-stroke-width",this,t)+translateDistance(this.paint.get("circle-translate"))},t.prototype.queryIntersectsFeature=function(e,t,r,i,a,n){var l=translate(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),a,n),s=this.paint.get("circle-radius").evaluate(t)*n,u=this.paint.get("circle-stroke-width").evaluate(t)*n;return multiPolygonIntersectsBufferedMultiPoint(l,r,s+u)},t}(StyleLayer);module.exports=CircleStyleLayer; +},{"../../data/bucket/circle_bucket":42,"../../util/intersection_tests":264,"../properties":188,"../query_utils":189,"../style_layer":191,"./circle_style_layer_properties":195}],195:[function(_dereq_,module,exports){ +"use strict";var styleSpec=_dereq_("../../style-spec/reference/latest"),ref=_dereq_("../properties"),Properties=ref.Properties,DataConstantProperty=ref.DataConstantProperty,DataDrivenProperty=ref.DataDrivenProperty,CrossFadedProperty=ref.CrossFadedProperty,HeatmapColorProperty=ref.HeatmapColorProperty,paint=new Properties({"circle-radius":new DataDrivenProperty(styleSpec.paint_circle["circle-radius"]),"circle-color":new DataDrivenProperty(styleSpec.paint_circle["circle-color"]),"circle-blur":new DataDrivenProperty(styleSpec.paint_circle["circle-blur"]),"circle-opacity":new DataDrivenProperty(styleSpec.paint_circle["circle-opacity"]),"circle-translate":new DataConstantProperty(styleSpec.paint_circle["circle-translate"]),"circle-translate-anchor":new DataConstantProperty(styleSpec.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new DataConstantProperty(styleSpec.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new DataConstantProperty(styleSpec.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new DataDrivenProperty(styleSpec.paint_circle["circle-stroke-width"]),"circle-stroke-color":new DataDrivenProperty(styleSpec.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new DataDrivenProperty(styleSpec.paint_circle["circle-stroke-opacity"])});module.exports={paint:paint}; +},{"../../style-spec/reference/latest":151,"../properties":188}],196:[function(_dereq_,module,exports){ +"use strict";var StyleLayer=_dereq_("../style_layer"),FillExtrusionBucket=_dereq_("../../data/bucket/fill_extrusion_bucket"),ref=_dereq_("../../util/intersection_tests"),multiPolygonIntersectsMultiPolygon=ref.multiPolygonIntersectsMultiPolygon,ref$1=_dereq_("../query_utils"),translateDistance=ref$1.translateDistance,translate=ref$1.translate,properties=_dereq_("./fill_extrusion_style_layer_properties"),ref$2=_dereq_("../properties"),Transitionable=ref$2.Transitionable,Transitioning=ref$2.Transitioning,PossiblyEvaluated=ref$2.PossiblyEvaluated,FillExtrusionStyleLayer=function(t){function e(e){t.call(this,e,properties)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createBucket=function(t){return new FillExtrusionBucket(t)},e.prototype.queryRadius=function(){return translateDistance(this.paint.get("fill-extrusion-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,i,n,o){var s=translate(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),n,o);return multiPolygonIntersectsMultiPolygon(s,r)},e.prototype.hasOffscreenPass=function(){return 0!==this.paint.get("fill-extrusion-opacity")&&"none"!==this.visibility},e.prototype.resize=function(){this.viewportFrame&&(this.viewportFrame.destroy(),this.viewportFrame=null)},e}(StyleLayer);module.exports=FillExtrusionStyleLayer; +},{"../../data/bucket/fill_extrusion_bucket":46,"../../util/intersection_tests":264,"../properties":188,"../query_utils":189,"../style_layer":191,"./fill_extrusion_style_layer_properties":197}],197:[function(_dereq_,module,exports){ +"use strict";var styleSpec=_dereq_("../../style-spec/reference/latest"),ref=_dereq_("../properties"),Properties=ref.Properties,DataConstantProperty=ref.DataConstantProperty,DataDrivenProperty=ref.DataDrivenProperty,CrossFadedProperty=ref.CrossFadedProperty,HeatmapColorProperty=ref.HeatmapColorProperty,paint=new Properties({"fill-extrusion-opacity":new DataConstantProperty(styleSpec["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new DataDrivenProperty(styleSpec["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new DataConstantProperty(styleSpec["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new DataConstantProperty(styleSpec["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new CrossFadedProperty(styleSpec["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new DataDrivenProperty(styleSpec["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new DataDrivenProperty(styleSpec["paint_fill-extrusion"]["fill-extrusion-base"])});module.exports={paint:paint}; +},{"../../style-spec/reference/latest":151,"../properties":188}],198:[function(_dereq_,module,exports){ +"use strict";var StyleLayer=_dereq_("../style_layer"),FillBucket=_dereq_("../../data/bucket/fill_bucket"),ref=_dereq_("../../util/intersection_tests"),multiPolygonIntersectsMultiPolygon=ref.multiPolygonIntersectsMultiPolygon,ref$1=_dereq_("../query_utils"),translateDistance=ref$1.translateDistance,translate=ref$1.translate,properties=_dereq_("./fill_style_layer_properties"),ref$2=_dereq_("../properties"),Transitionable=ref$2.Transitionable,Transitioning=ref$2.Transitioning,PossiblyEvaluated=ref$2.PossiblyEvaluated,FillStyleLayer=function(t){function e(e){t.call(this,e,properties)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.recalculate=function(t){this.paint=this._transitioningPaint.possiblyEvaluate(t),void 0===this._transitionablePaint.getValue("fill-outline-color")&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])},e.prototype.createBucket=function(t){return new FillBucket(t)},e.prototype.queryRadius=function(){return translateDistance(this.paint.get("fill-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,i,l,n){var a=translate(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),l,n);return multiPolygonIntersectsMultiPolygon(a,r)},e}(StyleLayer);module.exports=FillStyleLayer; +},{"../../data/bucket/fill_bucket":44,"../../util/intersection_tests":264,"../properties":188,"../query_utils":189,"../style_layer":191,"./fill_style_layer_properties":199}],199:[function(_dereq_,module,exports){ +"use strict";var styleSpec=_dereq_("../../style-spec/reference/latest"),ref=_dereq_("../properties"),Properties=ref.Properties,DataConstantProperty=ref.DataConstantProperty,DataDrivenProperty=ref.DataDrivenProperty,CrossFadedProperty=ref.CrossFadedProperty,HeatmapColorProperty=ref.HeatmapColorProperty,paint=new Properties({"fill-antialias":new DataConstantProperty(styleSpec.paint_fill["fill-antialias"]),"fill-opacity":new DataDrivenProperty(styleSpec.paint_fill["fill-opacity"]),"fill-color":new DataDrivenProperty(styleSpec.paint_fill["fill-color"]),"fill-outline-color":new DataDrivenProperty(styleSpec.paint_fill["fill-outline-color"]),"fill-translate":new DataConstantProperty(styleSpec.paint_fill["fill-translate"]),"fill-translate-anchor":new DataConstantProperty(styleSpec.paint_fill["fill-translate-anchor"]),"fill-pattern":new CrossFadedProperty(styleSpec.paint_fill["fill-pattern"])});module.exports={paint:paint}; +},{"../../style-spec/reference/latest":151,"../properties":188}],200:[function(_dereq_,module,exports){ +"use strict";var StyleLayer=_dereq_("../style_layer"),HeatmapBucket=_dereq_("../../data/bucket/heatmap_bucket"),RGBAImage=_dereq_("../../util/image").RGBAImage,properties=_dereq_("./heatmap_style_layer_properties"),ref=_dereq_("../properties"),Transitionable=ref.Transitionable,Transitioning=ref.Transitioning,PossiblyEvaluated=ref.PossiblyEvaluated,HeatmapStyleLayer=function(t){function e(e){t.call(this,e,properties),this._updateColorRamp()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createBucket=function(t){return new HeatmapBucket(t)},e.prototype.setPaintProperty=function(e,r,a){t.prototype.setPaintProperty.call(this,e,r,a),"heatmap-color"===e&&this._updateColorRamp()},e.prototype._updateColorRamp=function(){for(var t=this._transitionablePaint._values["heatmap-color"].value.expression,e=new Uint8Array(1024),r=e.length,a=4;a0?e+2*t:t}function offsetLine(t,e){for(var r=[],i=new Point(0,0),n=0;ns?(this.lastIntegerZoom=s+1,this.lastIntegerZoomTime=t):this.lastFloorZoom-a/2;){if(--s<0)return!1;f-=e[s].dist(i),i=e[s]}f+=e[s].dist(e[s+1]),s++;for(var l=[],o=0;fr;)o-=l.shift().angleDelta;if(o>n)return!1;s++,f+=c.dist(g)}return!0}module.exports=checkMaxAngle; -},{}],198:[function(_dereq_,module,exports){ +},{}],215:[function(_dereq_,module,exports){ "use strict";function clipLine(n,x,y,o,e){for(var r=[],t=0;t=o&&w.x>=o||(P.x>=o?P=new Point(o,P.y+(w.y-P.y)*((o-P.x)/(w.x-P.x)))._round():w.x>=o&&(w=new Point(o,P.y+(w.y-P.y)*((o-P.x)/(w.x-P.x)))._round()),P.y>=e&&w.y>=e||(P.y>=e?P=new Point(P.x+(w.x-P.x)*((e-P.y)/(w.y-P.y)),e)._round():w.y>=e&&(w=new Point(P.x+(w.x-P.x)*((e-P.y)/(w.y-P.y)),e)._round()),u&&P.equals(u[u.length-1])||(u=[P],r.push(u)),u.push(w)))))}return r}var Point=_dereq_("@mapbox/point-geometry");module.exports=clipLine; -},{"@mapbox/point-geometry":2}],199:[function(_dereq_,module,exports){ -"use strict";var createStructArrayType=_dereq_("../util/struct_array"),Point=_dereq_("@mapbox/point-geometry"),CollisionBoxArray=createStructArrayType({members:[{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"offsetX"},{type:"Int16",name:"offsetY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Float32",name:"unadjustedMaxScale"},{type:"Float32",name:"maxScale"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"},{type:"Int16",name:"bbox0"},{type:"Int16",name:"bbox1"},{type:"Int16",name:"bbox2"},{type:"Int16",name:"bbox3"},{type:"Float32",name:"placementScale"}]});Object.defineProperty(CollisionBoxArray.prototype.StructType.prototype,"anchorPoint",{get:function(){return new Point(this.anchorPointX,this.anchorPointY)}}),module.exports=CollisionBoxArray; -},{"../util/struct_array":249,"@mapbox/point-geometry":2}],200:[function(_dereq_,module,exports){ -"use strict";var CollisionFeature=function(t,e,i,o,a,n,s,l,r,d,u){var h=s.top*l-r,f=s.bottom*l+r,x=s.left*l-r,m=s.right*l+r;if(this.boxStartIndex=t.length,d){var _=f-h,b=m-x;if(_>0)if(_=Math.max(10*l,_),u){var v=e[i.segment+1].sub(e[i.segment])._unit()._mult(b),c=[i.sub(v),i.add(v)];this._addLineCollisionBoxes(t,c,i,0,b,_,o,a,n)}else this._addLineCollisionBoxes(t,e,i,i.segment,b,_,o,a,n)}else t.emplaceBack(i.x,i.y,0,0,x,h,m,f,1/0,1/0,o,a,n,0,0,0,0,0);this.boxEndIndex=t.length};CollisionFeature.prototype._addLineCollisionBoxes=function(t,e,i,o,a,n,s,l,r){var d=n/2,u=Math.floor(a/d),h=Math.floor(u/2),f=-n/2,x=i,m=o+1,_=f,b=-a/2,v=b-a/8;do{if(--m<0){if(_>b)return;m=0;break}_-=e[m].dist(x),x=e[m]}while(_>v);for(var c=e[m].dist(e[m+1]),g=-h;ga&&(C+=p-a),!(C<_)){for(;_+c=e.length)return;c=e[m].dist(e[m+1])}var M=C-_,y=e[m],B=e[m+1],k=B.sub(y)._unit()._mult(M)._add(y)._round(),F=Math.max(Math.abs(C-f)-d/2,0),L=a/2/F;(g<0||g>=u)&&(L=Math.min(L,.99)),t.emplaceBack(k.x,k.y,k.x-i.x,k.y-i.y,-n/2,-n/2,n/2,n/2,L,L,s,l,r,0,0,0,0,0)}}},module.exports=CollisionFeature; -},{}],201:[function(_dereq_,module,exports){ -"use strict";var Point=_dereq_("@mapbox/point-geometry"),EXTENT=_dereq_("../data/extent"),Grid=_dereq_("grid-index"),intersectionTests=_dereq_("../util/intersection_tests"),CollisionTile=function(e,t,i,a,r,o,n){void 0===o&&(o=new Grid(EXTENT,12,6)),void 0===n&&(n=new Grid(EXTENT,12,0)),this.angle=e,this.pitch=t,this.cameraToCenterDistance=i,this.cameraToTileDistance=a,this.grid=o,this.ignoredGrid=n,this.perspectiveRatio=1+.5*(a/i-1),this.minScale=.5/this.perspectiveRatio,this.maxScale=2/this.perspectiveRatio;var s=Math.sin(this.angle),l=Math.cos(this.angle);this.rotationMatrix=[l,-s,s,l],this.reverseRotationMatrix=[l,s,-s,l],this.yStretch=Math.max(1,a/(i*Math.cos(t/180*Math.PI))),this.collisionBoxArray=r,0===r.length&&(r.emplaceBack(),r.emplaceBack(0,0,0,0,0,-EXTENT,0,EXTENT,1/0,1/0,0,0,0,0,0,0,0,0,0),r.emplaceBack(EXTENT,0,0,0,0,-EXTENT,0,EXTENT,1/0,1/0,0,0,0,0,0,0,0,0,0),r.emplaceBack(0,0,0,0,-EXTENT,0,EXTENT,0,1/0,1/0,0,0,0,0,0,0,0,0,0),r.emplaceBack(0,EXTENT,0,0,-EXTENT,0,EXTENT,0,1/0,1/0,0,0,0,0,0,0,0,0,0)),this.tempCollisionBox=r.get(0),this.edges=[r.get(1),r.get(2),r.get(3),r.get(4)]};CollisionTile.deserialize=function(e,t){return new CollisionTile(e.angle,e.pitch,e.cameraToCenterDistance,e.cameraToTileDistance,t,new Grid(e.grid),new Grid(e.ignoredGrid))},CollisionTile.prototype.serialize=function(e){var t=this.grid.toArrayBuffer(),i=this.ignoredGrid.toArrayBuffer();return e&&(e.push(t),e.push(i)),{angle:this.angle,pitch:this.pitch,cameraToCenterDistance:this.cameraToCenterDistance,cameraToTileDistance:this.cameraToTileDistance,grid:t,ignoredGrid:i}},CollisionTile.prototype.placeCollisionFeature=function(e,t,i){for(var a=this,r=this.collisionBoxArray,o=this.minScale,n=this.rotationMatrix,s=this.yStretch,l=e.boxStartIndex;l=a.maxScale)return o}if(i){var N=void 0;if(a.angle){var C=a.reverseRotationMatrix,w=new Point(c.x1,c.y1).matMult(C),X=new Point(c.x2,c.y1).matMult(C),B=new Point(c.x1,c.y2).matMult(C),G=new Point(c.x2,c.y2).matMult(C);N=a.tempCollisionBox,N.anchorPointX=c.anchorPoint.x,N.anchorPointY=c.anchorPoint.y,N.x1=Math.min(w.x,X.x,B.x,G.x),N.y1=Math.min(w.y,X.x,B.x,G.x),N.x2=Math.max(w.x,X.x,B.x,G.x),N.y2=Math.max(w.y,X.x,B.x,G.x),N.maxScale=c.maxScale}else N=c;for(var R=0;R=a.maxScale)return o}}}return o},CollisionTile.prototype.queryRenderedSymbols=function(e,t){var i={},a=[];if(0===e.length||0===this.grid.keys.length&&0===this.ignoredGrid.keys.length)return a;for(var r=this.collisionBoxArray,o=this.rotationMatrix,n=this.yStretch,s=[],l=1/0,c=1/0,h=-1/0,x=-1/0,m=0;mE.maxScale)){var b=E.anchorPoint.matMult(o),N=b.x+E.x1/v,C=b.y+E.y1/v*n,w=b.x+E.x2/v,X=b.y+E.y2/v*n,B=[new Point(N,C),new Point(w,C),new Point(w,X),new Point(N,X)];intersectionTests.polygonIntersectsPolygon(s,B)&&(i[S][P]=!0,a.push(d[f]))}}return a},CollisionTile.prototype.getPlacementScale=function(e,t,i,a,r){var o=t.x-a.x,n=t.y-a.y,s=(r.x1-i.x2)/o,l=(r.x2-i.x1)/o,c=(r.y1-i.y2)*this.yStretch/n,h=(r.y2-i.y1)*this.yStretch/n;(isNaN(s)||isNaN(l))&&(s=l=1),(isNaN(c)||isNaN(h))&&(c=h=1);var x=Math.min(Math.max(s,l),Math.max(c,h)),m=r.maxScale,p=i.maxScale;return x>m&&(x=m),x>p&&(x=p),x>e&&x>=r.placementScale&&(e=x),e},CollisionTile.prototype.insertCollisionFeature=function(e,t,i){for(var a=this,r=i?this.ignoredGrid:this.grid,o=this.collisionBoxArray,n=e.boxStartIndex;n=1)&&r.insert(n,s.bbox0,s.bbox1,s.bbox2,s.bbox3)}},module.exports=CollisionTile; -},{"../data/extent":58,"../util/intersection_tests":243,"@mapbox/point-geometry":2,"grid-index":23}],202:[function(_dereq_,module,exports){ -"use strict";function getAnchors(e,r,t,n,a,l,o,i,c){var h=n?.6*l*o:0,s=Math.max(n?n.right-n.left:0,a?a.right-a.left:0),u=0===e[0].x||e[0].x===c||0===e[0].y||e[0].y===c;r-s*o=0&&k=0&&q=0&&p+h<=s){var M=new Anchor(k,q,A,f);M._round(),n&&!checkMaxAngle(e,M,l,n,a)||x.push(M)}}g+=y}return i||x.length||o||(x=resample(e,g/2,t,n,a,l,o,!0,c)),x}var interpolate=_dereq_("../style-spec/util/interpolate"),Anchor=_dereq_("../symbol/anchor"),checkMaxAngle=_dereq_("./check_max_angle");module.exports=getAnchors; -},{"../style-spec/util/interpolate":152,"../symbol/anchor":196,"./check_max_angle":197}],203:[function(_dereq_,module,exports){ +},{"@mapbox/point-geometry":4}],216:[function(_dereq_,module,exports){ +"use strict";var CollisionFeature=function(t,e,i,o,a,r,l,n,s,d,h){var u=l.top*n-s,f=l.bottom*n+s,c=l.left*n-s,x=l.right*n+s;if(this.boxStartIndex=t.length,d){var m=f-u,v=x-c;m>0&&(m=Math.max(10*n,m),this._addLineCollisionCircles(t,e,i,i.segment,v,m,o,a,r,h))}else t.emplaceBack(i.x,i.y,c,u,x,f,o,a,r,0,0);this.boxEndIndex=t.length};CollisionFeature.prototype._addLineCollisionCircles=function(t,e,i,o,a,r,l,n,s,d){var h=r/2,u=Math.floor(a/h),f=1+.4*Math.log(d)/Math.LN2,c=Math.floor(u*f/2),x=-r/2,m=i,v=o+1,C=x,b=-a/2,g=b-a/4;do{if(--v<0){if(C>b)return;v=0;break}C-=e[v].dist(m),m=e[v]}while(C>g);for(var p=e[v].dist(e[v+1]),M=-c;Ma&&(k+=_-a),!(k=e.length)return;p=e[v].dist(e[v+1])}var y=k-C,F=e[v],L=e[v+1],B=L.sub(F)._unit()._mult(y)._add(F)._round(),I=Math.abs(k-x)k)markCollisionCircleUsed(t,G,!1);else{var A=f.projectPoint(p,M,R),O=q*b;if(x.length>0){var U=A.x-x[x.length-4],X=A.y-x[x.length-3];if(O*O*2>U*U+X*X){if(G+8-T&&Y=this.screenRightBoundary||nthis.screenBottomBoundary},module.exports=CollisionIndex; +},{"../symbol/projection":224,"../util/intersection_tests":264,"./grid_index":220,"@mapbox/gl-matrix":2,"@mapbox/point-geometry":4}],218:[function(_dereq_,module,exports){ +"use strict";var EXTENT=_dereq_("../data/extent"),roundingFactor=512/EXTENT/2,TileLayerIndex=function(e,s,r){var n=this;this.tileID=e,this.indexedSymbolInstances={},this.bucketInstanceId=r;for(var o=0,t=s;oe.overscaledZ)for(var c in l){var d=l[c];d.tileID.isChildOf(e)&&d.findMatches(s.symbolInstances,e,i)}else{var I=e.scaledTo(Number(a)),y=l[I.key];y&&y.findMatches(s.symbolInstances,e,i)}}for(var v=0,h=s.symbolInstances;v=0&&k=0&&q=0&&p+h<=s){var M=new Anchor(k,q,A,f);M._round(),n&&!checkMaxAngle(e,M,l,n,a)||x.push(M)}}g+=y}return i||x.length||o||(x=resample(e,g/2,t,n,a,l,o,!0,c)),x}var interpolate=_dereq_("../style-spec/util/interpolate").number,Anchor=_dereq_("../symbol/anchor"),checkMaxAngle=_dereq_("./check_max_angle");module.exports=getAnchors; +},{"../style-spec/util/interpolate":158,"../symbol/anchor":213,"./check_max_angle":214}],220:[function(_dereq_,module,exports){ +"use strict";var GridIndex=function(e,t,i){var r=this.boxCells=[],s=this.circleCells=[];this.xCellCount=Math.ceil(e/i),this.yCellCount=Math.ceil(t/i);for(var l=0;lthis.width||r<0||t>this.height)return!s&&[];var l=[];if(e<=0&&t<=0&&this.width<=i&&this.height<=r)l=Array.prototype.slice.call(this.boxKeys).concat(this.circleKeys);else{var o={hitTest:s,seenUids:{box:{},circle:{}}};this._forEachCell(e,t,i,r,this._queryCell,l,o)}return s?l.length>0:l},GridIndex.prototype._queryCircle=function(e,t,i,r){var s=e-i,l=e+i,o=t-i,h=t+i;if(l<0||s>this.width||h<0||o>this.height)return!r&&[];var n=[],c={hitTest:r,circle:{x:e,y:t,radius:i},seenUids:{box:{},circle:{}}};return this._forEachCell(s,o,l,h,this._queryCellCircle,n,c),r?n.length>0:n},GridIndex.prototype.query=function(e,t,i,r){return this._query(e,t,i,r,!1)},GridIndex.prototype.hitTest=function(e,t,i,r){return this._query(e,t,i,r,!0)},GridIndex.prototype.hitTestCircle=function(e,t,i){return this._queryCircle(e,t,i,!0)},GridIndex.prototype._queryCell=function(e,t,i,r,s,l,o){var h=this,n=o.seenUids,c=this.boxCells[s];if(null!==c)for(var u=this.bboxes,d=0,C=c;d=u[x+0]&&r>=u[x+1]){if(o.hitTest)return l.push(!0),!0;l.push(h.boxKeys[a])}}}var p=this.circleCells[s];if(null!==p)for(var f=this.circles,y=0,v=p;yo*o+h*h},GridIndex.prototype._circleAndRectCollide=function(e,t,i,r,s,l,o){var h=(l-r)/2,n=Math.abs(e-(r+h));if(n>h+i)return!1;var c=(o-s)/2,u=Math.abs(t-(s+c));if(u>c+i)return!1;if(n<=h||u<=c)return!0;var d=n-h,C=u-c;return d*d+C*C<=i*i},module.exports=GridIndex; +},{}],221:[function(_dereq_,module,exports){ "use strict";module.exports=function(e){function t(t){g.push(e[t]),l++}function r(e,t,r){var n=u[e];return delete u[e],u[t]=n,g[n].geometry[0].pop(),g[n].geometry[0]=g[n].geometry[0].concat(r[0]),n}function n(e,t,r){var n=i[t];return delete i[t],i[e]=n,g[n].geometry[0].shift(),g[n].geometry[0]=r[0].concat(g[n].geometry[0]),n}function o(e,t,r){var n=r?t[0][t[0].length-1]:t[0][0];return e+":"+n.x+":"+n.y}for(var i={},u={},g=[],l=0,m=0;m=-a[0]&&r<=a[0]&&i>=-a[1]&&i<=a[1]&&n.frameHistory.isVisible(t)}function updateLineLabels(e,t,a,n,r,i,o,l,s,p){var m=n?e.textSizeData:e.iconSizeData,c=symbolSize.evaluateSizeForZoom(m,a.transform,p,n),u=[256/a.width*2+1,256/a.height*2+1],y=n?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;y.clear();for(var g=e.lineVertexArray,d=n?e.placedGlyphArray:e.placedIconArray,f=0;f1){var h=e.glyphStartIndex+e.numGlyphs,x=l.get(e.glyphStartIndex).offsetX,v=l.get(h-1).offsetX,b=e.lineStartIndex,L=e.lineStartIndex+e.lineLength,A=placeGlyphAlongLine(g*x,d,f,a,m,c,e.segment,b,L,s,i,u);if(!A)return{notEnoughRoom:!0};var G=placeGlyphAlongLine(g*v,d,f,a,m,c,e.segment,b,L,s,i,u);if(!G)return{notEnoughRoom:!0};var S=project(A.point,o).point,P=project(G.point,o).point;if(n&&!a&&(e.vertical?S.yP.x))return{needsFlipping:!0};y=[A];for(var D=e.glyphStartIndex+1;D0?w.point:projectTruncatedLineSegment(c,new Point(j.x,j.y),M,1,r);if(e.vertical?F.y>M.y:F.x0?1:-1,g=0;n&&(y*=-1,g=Math.PI),y<0&&(g+=Math.PI);for(var d=y>0?l+o:l+o+1,f=r,h=r,x=0,v=0,b=Math.abs(u);x+v<=b;){if((d+=y)=s)return null;if(h=f,void 0===(f=c[d])){var L=project(p.get(d),m);if(L.signedDistanceFromCamera>0)f=c[d]=L.point;else{f=projectTruncatedLineSegment(0===x?i:new Point(p.get(d-y).x,p.get(d-y).y),new Point(p.get(d).x,p.get(d).y),h,b-x+1,m)}}x+=v,v=h.dist(f)}var A=(b-x)/v,G=f.sub(h),S=G.mult(A)._add(h);return S._add(G._unit()._perp()._mult(a*y)),{point:S,angle:g+Math.atan2(f.y-h.y,f.x-h.x)}}function hideGlyphs(e,t){for(var a=0;a1||(b?(clearTimeout(b),b=null,h("dblclick",t)):b=setTimeout(l,300))}function i(e){f("touchmove",e)}function c(e){f("touchend",e)}function d(e){f("touchcancel",e)}function l(){b=null}function s(e){DOM.mousePos(g,e).equals(L)&&h("click",e)}function m(e){h("dblclick",e),e.preventDefault()}function v(t){var n=e.dragRotate&&e.dragRotate.isActive();E||n?E&&(p=t):h("contextmenu",t),t.preventDefault()}function h(t,n){var o=DOM.mousePos(g,n);return e.fire(t,{lngLat:e.unproject(o),point:o,originalEvent:n})}function f(t,n){var o=DOM.touchPos(g,n),r=o.reduce(function(e,t,n,o){return e.add(t.div(o.length))},new Point(0,0));return e.fire(t,{lngLat:e.unproject(r),point:r,lngLats:o.map(function(t){return e.unproject(t)},this),points:o,originalEvent:n})}var g=e.getCanvasContainer(),p=null,E=!1,L=null,b=null;for(var k in handlers)e[k]=new handlers[k](e,t),t.interactive&&t[k]&&e[k].enable(t[k]);g.addEventListener("mouseout",n,!1),g.addEventListener("mousedown",o,!1),g.addEventListener("mouseup",r,!1),g.addEventListener("mousemove",u,!1),g.addEventListener("touchstart",a,!1),g.addEventListener("touchend",c,!1),g.addEventListener("touchmove",i,!1),g.addEventListener("touchcancel",d,!1),g.addEventListener("click",s,!1),g.addEventListener("dblclick",m,!1),g.addEventListener("contextmenu",v,!1)}; -},{"../util/dom":238,"./handler/box_zoom":218,"./handler/dblclick_zoom":219,"./handler/drag_pan":220,"./handler/drag_rotate":221,"./handler/keyboard":222,"./handler/scroll_zoom":223,"./handler/touch_zoom_rotate":224,"@mapbox/point-geometry":2}],210:[function(_dereq_,module,exports){ -"use strict";var util=_dereq_("../util/util"),interpolate=_dereq_("../style-spec/util/interpolate"),browser=_dereq_("../util/browser"),LngLat=_dereq_("../geo/lng_lat"),LngLatBounds=_dereq_("../geo/lng_lat_bounds"),Point=_dereq_("@mapbox/point-geometry"),Evented=_dereq_("../util/evented"),Camera=function(t){function i(i,e){t.call(this),this.moving=!1,this.transform=i,this._bearingSnap=e.bearingSnap}return t&&(i.__proto__=t),i.prototype=Object.create(t&&t.prototype),i.prototype.constructor=i,i.prototype.getCenter=function(){return this.transform.center},i.prototype.setCenter=function(t,i){return this.jumpTo({center:t},i)},i.prototype.panBy=function(t,i,e){return t=Point.convert(t).mult(-1),this.panTo(this.transform.center,util.extend({offset:t},i),e)},i.prototype.panTo=function(t,i,e){return this.easeTo(util.extend({center:t},i),e)},i.prototype.getZoom=function(){return this.transform.zoom},i.prototype.setZoom=function(t,i){return this.jumpTo({zoom:t},i),this},i.prototype.zoomTo=function(t,i,e){return this.easeTo(util.extend({zoom:t},i),e)},i.prototype.zoomIn=function(t,i){return this.zoomTo(this.getZoom()+1,t,i),this},i.prototype.zoomOut=function(t,i){return this.zoomTo(this.getZoom()-1,t,i),this},i.prototype.getBearing=function(){return this.transform.bearing},i.prototype.setBearing=function(t,i){return this.jumpTo({bearing:t},i),this},i.prototype.rotateTo=function(t,i,e){return this.easeTo(util.extend({bearing:t},i),e)},i.prototype.resetNorth=function(t,i){return this.rotateTo(0,util.extend({duration:1e3},t),i),this},i.prototype.snapToNorth=function(t,i){return Math.abs(this.getBearing())i?1:0}),["bottom","left","right","top"]))return util.warnOnce("options.padding must be a positive number, or an Object with keys 'bottom', 'left', 'right', 'top'"),this;t=LngLatBounds.convert(t);var n=[i.padding.left-i.padding.right,i.padding.top-i.padding.bottom],r=Math.min(i.padding.right,i.padding.left),a=Math.min(i.padding.top,i.padding.bottom);i.offset=[i.offset[0]+n[0],i.offset[1]+n[1]];var s=Point.convert(i.offset),h=this.transform,p=h.project(t.getNorthWest()),u=h.project(t.getSouthEast()),c=u.sub(p),m=(h.width-2*r-2*Math.abs(s.x))/c.x,f=(h.height-2*a-2*Math.abs(s.y))/c.y;return f<0||m<0?(util.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset."),this):(i.center=h.unproject(p.add(u).div(2)),i.zoom=Math.min(h.scaleZoom(h.scale*Math.min(m,f)),i.maxZoom),i.bearing=0,i.linear?this.easeTo(i,e):this.flyTo(i,e))},i.prototype.jumpTo=function(t,i){this.stop();var e=this.transform,o=!1,n=!1,r=!1;return"zoom"in t&&e.zoom!==+t.zoom&&(o=!0,e.zoom=+t.zoom),void 0!==t.center&&(e.center=LngLat.convert(t.center)),"bearing"in t&&e.bearing!==+t.bearing&&(n=!0,e.bearing=+t.bearing),"pitch"in t&&e.pitch!==+t.pitch&&(r=!0,e.pitch=+t.pitch),this.fire("movestart",i).fire("move",i),o&&this.fire("zoomstart",i).fire("zoom",i).fire("zoomend",i),n&&this.fire("rotate",i),r&&this.fire("pitchstart",i).fire("pitch",i).fire("pitchend",i),this.fire("moveend",i)},i.prototype.easeTo=function(t,i){var e=this;this.stop(),t=util.extend({offset:[0,0],duration:500,easing:util.ease},t),!1===t.animate&&(t.duration=0),t.smoothEasing&&0!==t.duration&&(t.easing=this._smoothOutEasing(t.duration));var o=this.transform,n=this.getZoom(),r=this.getBearing(),a=this.getPitch(),s="zoom"in t?+t.zoom:n,h="bearing"in t?this._normalizeBearing(t.bearing,r):r,p="pitch"in t?+t.pitch:a,u=o.centerPoint.add(Point.convert(t.offset)),c=o.pointLocation(u),m=LngLat.convert(t.center||c);this._normalizeCenter(m);var f,g,d=o.project(c),l=o.project(m).sub(d),v=o.zoomScale(s-n);return t.around&&(f=LngLat.convert(t.around),g=o.locationPoint(f)),this.zooming=s!==n,this.rotating=r!==h,this.pitching=p!==a,this._prepareEase(i,t.noMoveStart),clearTimeout(this._onEaseEnd),this._ease(function(t){if(this.zooming&&(o.zoom=interpolate(n,s,t)),this.rotating&&(o.bearing=interpolate(r,h,t)),this.pitching&&(o.pitch=interpolate(a,p,t)),f)o.setLocationAtPoint(f,g);else{var e=o.zoomScale(o.zoom-n),c=s>n?Math.min(2,v):Math.max(.5,v),m=Math.pow(c,1-t),b=o.unproject(d.add(l.mult(t*m)).mult(e));o.setLocationAtPoint(o.renderWorldCopies?b.wrap():b,u)}this._fireMoveEvents(i)},function(){t.delayEndEvents?e._onEaseEnd=setTimeout(function(){return e._easeToEnd(i)},t.delayEndEvents):e._easeToEnd(i)},t),this},i.prototype._prepareEase=function(t,i){this.moving=!0,i||this.fire("movestart",t),this.zooming&&this.fire("zoomstart",t),this.pitching&&this.fire("pitchstart",t)},i.prototype._fireMoveEvents=function(t){this.fire("move",t),this.zooming&&this.fire("zoom",t),this.rotating&&this.fire("rotate",t),this.pitching&&this.fire("pitch",t)},i.prototype._easeToEnd=function(t){var i=this.zooming,e=this.pitching;this.moving=!1,this.zooming=!1,this.rotating=!1,this.pitching=!1,i&&this.fire("zoomend",t),e&&this.fire("pitchend",t),this.fire("moveend",t)},i.prototype.flyTo=function(t,i){function e(t){var i=(M*M-z*z+(t?-1:1)*L*L*E*E)/(2*(t?M:z)*L*E);return Math.log(Math.sqrt(i*i+1)-i)}function o(t){return(Math.exp(t)-Math.exp(-t))/2}function n(t){return(Math.exp(t)+Math.exp(-t))/2}function r(t){return o(t)/n(t)}var a=this;this.stop(),t=util.extend({offset:[0,0],speed:1.2,curve:1.42,easing:util.ease},t);var s=this.transform,h=this.getZoom(),p=this.getBearing(),u=this.getPitch(),c="zoom"in t?util.clamp(+t.zoom,s.minZoom,s.maxZoom):h,m="bearing"in t?this._normalizeBearing(t.bearing,p):p,f="pitch"in t?+t.pitch:u,g=s.zoomScale(c-h),d=s.centerPoint.add(Point.convert(t.offset)),l=s.pointLocation(d),v=LngLat.convert(t.center||l);this._normalizeCenter(v);var b=s.project(l),y=s.project(v).sub(b),_=t.curve,z=Math.max(s.width,s.height),M=z/g,E=y.mag();if("minZoom"in t){var T=util.clamp(Math.min(t.minZoom,h,c),s.minZoom,s.maxZoom),x=z/s.zoomScale(T-h);_=Math.sqrt(x/E*2)}var L=_*_,j=e(0),Z=function(t){return n(j)/n(j+_*t)},w=function(t){return z*((n(j)*r(j+_*t)-o(j))/L)/E},P=(e(1)-j)/_;if(Math.abs(E)<1e-6||!isFinite(P)){if(Math.abs(z-M)<1e-6)return this.easeTo(t,i);var q=Mt.maxDuration&&(t.duration=0),this.zooming=!0,this.rotating=p!==m,this.pitching=f!==u,this._prepareEase(i,!1),this._ease(function(t){var e=t*P,o=1/Z(e);s.zoom=h+s.scaleZoom(o),this.rotating&&(s.bearing=interpolate(p,m,t)),this.pitching&&(s.pitch=interpolate(u,f,t));var n=s.unproject(b.add(y.mult(w(e))).mult(o));s.setLocationAtPoint(s.renderWorldCopies?n.wrap():n,d),this._fireMoveEvents(i)},function(){return a._easeToEnd(i)},t),this},i.prototype.isEasing=function(){return!!this._abortFn},i.prototype.isMoving=function(){return this.moving},i.prototype.stop=function(){return this._abortFn&&(this._abortFn(),this._finishEase()),this},i.prototype._ease=function(t,i,e){this._finishFn=i,this._abortFn=browser.timed(function(i){t.call(this,e.easing(i)),1===i&&this._finishEase()},!1===e.animate?0:e.duration,this)},i.prototype._finishEase=function(){delete this._abortFn;var t=this._finishFn;delete this._finishFn,t.call(this)},i.prototype._normalizeBearing=function(t,i){t=util.wrap(t,-180,180);var e=Math.abs(t-i);return Math.abs(t-360-i)180?-360:e<-180?360:0}},i.prototype._smoothOutEasing=function(t){var i=util.ease;if(this._prevEase){var e=this._prevEase,o=(Date.now()-e.start)/e.duration,n=e.easing(o+.01)-e.easing(o),r=.27/Math.sqrt(n*n+1e-4)*.01,a=Math.sqrt(.0729-r*r);i=util.bezier(r,a,.25,1)}return this._prevEase={start:(new Date).getTime(),duration:t,easing:i},i},i}(Evented);module.exports=Camera; -},{"../geo/lng_lat":68,"../geo/lng_lat_bounds":69,"../style-spec/util/interpolate":152,"../util/browser":231,"../util/evented":239,"../util/util":252,"@mapbox/point-geometry":2}],211:[function(_dereq_,module,exports){ -"use strict";var DOM=_dereq_("../../util/dom"),util=_dereq_("../../util/util"),config=_dereq_("../../util/config"),AttributionControl=function(t){this.options=t,util.bindAll(["_updateEditLink","_updateData","_updateCompact"],this)};AttributionControl.prototype.getDefaultPosition=function(){return"bottom-right"},AttributionControl.prototype.onAdd=function(t){var i=this.options&&this.options.compact;return this._map=t,this._container=DOM.create("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),i&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===i&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container},AttributionControl.prototype.onRemove=function(){DOM.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},AttributionControl.prototype._updateEditLink=function(){var t=this._editLink;t||(t=this._editLink=this._container.querySelector(".mapbox-improve-map"));var i=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:config.ACCESS_TOKEN}];if(t){var o=i.reduce(function(t,o,e){return o.value&&(t+=o.key+"="+o.value+(e=0)return!1;return!0}),this._container.innerHTML=t.join(" | "),this._editLink=null}},AttributionControl.prototype._updateCompact=function(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact")},module.exports=AttributionControl; -},{"../../util/config":235,"../../util/dom":238,"../../util/util":252}],212:[function(_dereq_,module,exports){ +},{}],222:[function(_dereq_,module,exports){ +"use strict";var ref=_dereq_("../util/web_worker_transfer"),register=ref.register,OpacityState=function(){this.opacity=0,this.targetOpacity=0,this.time=0};OpacityState.prototype.clone=function(){var t=new OpacityState;return t.opacity=this.opacity,t.targetOpacity=this.targetOpacity,t.time=this.time,t},register("OpacityState",OpacityState),module.exports=OpacityState; +},{"../util/web_worker_transfer":278}],223:[function(_dereq_,module,exports){ +"use strict";function updateCollisionVertices(e,t,i){e.emplaceBack(t?1:0,i?1:0),e.emplaceBack(t?1:0,i?1:0),e.emplaceBack(t?1:0,i?1:0),e.emplaceBack(t?1:0,i?1:0)}function packOpacity(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 4294967295;var t=e.placed?1:0,i=Math.floor(127*e.opacity);return i*shift25+t*shift24+i*shift17+t*shift16+i*shift9+t*shift8+i*shift1+t}var CollisionIndex=_dereq_("./collision_index"),EXTENT=_dereq_("../data/extent"),symbolSize=_dereq_("./symbol_size"),projection=_dereq_("./projection"),symbolLayoutProperties=_dereq_("../style/style_layer/symbol_style_layer_properties").layout,pixelsToTileUnits=_dereq_("../source/pixels_to_tile_units"),OpacityState=function(e,t,i,o){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):o&&i?1:0,this.placed=i};OpacityState.prototype.isHidden=function(){return 0===this.opacity&&!this.placed};var JointOpacityState=function(e,t,i,o,a){this.text=new OpacityState(e?e.text:null,t,i,a),this.icon=new OpacityState(e?e.icon:null,t,o,a)};JointOpacityState.prototype.isHidden=function(){return this.text.isHidden()&&this.icon.isHidden()};var JointPlacement=function(e,t,i){this.text=e,this.icon=t,this.skipFade=i},Placement=function(e,t){this.transform=e.clone(),this.collisionIndex=new CollisionIndex(this.transform),this.placements={},this.opacities={},this.stale=!1,this.fadeDuration=t};Placement.prototype.placeLayerTile=function(e,t,i,o){var a=t.getBucket(e);if(a){var l=a.layers[0].layout,n=Math.pow(2,this.transform.zoom-t.tileID.overscaledZ),r=t.tileSize/EXTENT,s=this.transform.calculatePosMatrix(t.tileID.toUnwrapped()),c=projection.getLabelPlaneMatrix(s,"map"===l.get("text-pitch-alignment"),"map"===l.get("text-rotation-alignment"),this.transform,pixelsToTileUnits(t,1,this.transform.zoom)),p=projection.getLabelPlaneMatrix(s,"map"===l.get("icon-pitch-alignment"),"map"===l.get("icon-rotation-alignment"),this.transform,pixelsToTileUnits(t,1,this.transform.zoom));this.placeLayerBucket(a,s,c,p,n,r,i,o,t.collisionBoxArray,t.tileID.key,e.source)}},Placement.prototype.placeLayerBucket=function(e,t,i,o,a,l,n,r,s,c,p){for(var x=this,y=e.layers[0].layout,h=symbolSize.evaluateSizeForZoom(e.textSizeData,this.transform.zoom,symbolLayoutProperties.properties["text-size"]),m=!e.hasTextData()||y.get("text-optional"),d=!e.hasIconData()||y.get("icon-optional"),u=0,f=e.symbolInstances;u0,v=v&&C.offscreen);var V=B.collisionArrays.textCircles;if(V){var S=e.text.placedSymbolArray.get(B.placedTextSymbolIndices[0]),A=symbolSize.evaluateSizeForFeature(e.textSizeData,h,S);D=x.collisionIndex.placeCollisionCircles(V,y.get("text-allow-overlap"),a,l,B.key,S,e.lineVertexArray,e.glyphOffsetArray,A,t,i,n,"map"===y.get("text-pitch-alignment")),g=y.get("text-allow-overlap")||D.circles.length>0,v=v&&D.offscreen}B.collisionArrays.iconBox&&(T=x.collisionIndex.placeCollisionBox(B.collisionArrays.iconBox,y.get("icon-allow-overlap"),l,t),I=T.box.length>0,v=v&&T.offscreen),m||d?d?m||(I=I&&g):g=I&&g:I=g=I&&g,g&&C&&x.collisionIndex.insertCollisionBox(C.box,y.get("text-ignore-placement"),c,p,e.bucketInstanceId,B.textBoxStartIndex),I&&T&&x.collisionIndex.insertCollisionBox(T.box,y.get("icon-ignore-placement"),c,p,e.bucketInstanceId,B.iconBoxStartIndex),g&&D&&x.collisionIndex.insertCollisionCircles(D.circles,y.get("text-ignore-placement"),c,p,e.bucketInstanceId,B.textBoxStartIndex),x.placements[B.crossTileID]=new JointPlacement(g,I,v||e.justReloaded),r[B.crossTileID]=!0}}e.justReloaded=!1},Placement.prototype.commit=function(e,t){var i=this;this.commitTime=t;var o=!1,a=e&&0!==this.fadeDuration?(this.commitTime-e.commitTime)/this.fadeDuration:1,l=e?e.opacities:{};for(var n in i.placements){var r=i.placements[n],s=l[n];s?(i.opacities[n]=new JointOpacityState(s,a,r.text,r.icon),o=o||r.text!==s.text.placed||r.icon!==s.icon.placed):(i.opacities[n]=new JointOpacityState(null,a,r.text,r.icon,r.skipFade),o=o||r.text||r.icon)}for(var c in l){var p=l[c];if(!i.opacities[c]){var x=new JointOpacityState(p,a,!1,!1);x.isHidden()||(i.opacities[c]=x,o=o||p.text.placed||p.icon.placed)}}o?this.lastPlacementChangeTime=t:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t)},Placement.prototype.updateLayerOpacities=function(e,t){for(var i=this,o={},a=0,l=t;a0||r.numVerticalGlyphVertices>0,x=r.numIconVertices>0;if(p){for(var y=packOpacity(c.text),h=(r.numGlyphVertices+r.numVerticalGlyphVertices)/4,m=0;me},Placement.prototype.setStale=function(){this.stale=!0};var shift25=Math.pow(2,25),shift24=Math.pow(2,24),shift17=Math.pow(2,17),shift16=Math.pow(2,16),shift9=Math.pow(2,9),shift8=Math.pow(2,8),shift1=Math.pow(2,1);module.exports=Placement; +},{"../data/extent":53,"../source/pixels_to_tile_units":104,"../style/style_layer/symbol_style_layer_properties":209,"./collision_index":217,"./projection":224,"./symbol_size":228}],224:[function(_dereq_,module,exports){ +"use strict";function getLabelPlaneMatrix(e,t,r,n,a){var i=mat4.identity(new Float32Array(16));return t?(mat4.identity(i),mat4.scale(i,i,[1/a,1/a,1]),r||mat4.rotateZ(i,i,n.angle)):(mat4.scale(i,i,[n.width/2,-n.height/2,1]),mat4.translate(i,i,[1,-1,0]),mat4.multiply(i,i,e)),i}function getGlCoordMatrix(e,t,r,n,a){var i=mat4.identity(new Float32Array(16));return t?(mat4.multiply(i,i,e),mat4.scale(i,i,[a,a,1]),r||mat4.rotateZ(i,i,-n.angle)):(mat4.scale(i,i,[1,-1,1]),mat4.translate(i,i,[-1,-1,0]),mat4.scale(i,i,[2/n.width,2/n.height,1])),i}function project(e,t){var r=[e.x,e.y,0,1];xyTransformMat4(r,r,t);var n=r[3];return{point:new Point(r[0]/n,r[1]/n),signedDistanceFromCamera:n}}function isVisible(e,t){var r=e[0]/e[3],n=e[1]/e[3];return r>=-t[0]&&r<=t[0]&&n>=-t[1]&&n<=t[1]}function updateLineLabels(e,t,r,n,a,i,o,l){var s=n?e.textSizeData:e.iconSizeData,p=symbolSize.evaluateSizeForZoom(s,r.transform.zoom,symbolLayoutProperties.properties[n?"text-size":"icon-size"]),u=[256/r.width*2+1,256/r.height*2+1],y=n?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;y.clear();for(var c=e.lineVertexArray,m=n?e.text.placedSymbolArray:e.icon.placedSymbolArray,d=r.transform.width/r.transform.height,g=!1,h=0;hMath.abs(r.x-t.x)*n)return{useVertical:!0}}return(e===WritingMode.vertical?t.yr.x)?{needsFlipping:!0}:null}function placeGlyphsAlongLine(e,t,r,n,a,i,o,l,s,p,u,y,c,m){var d,g=t/24,h=e.lineOffsetX*t,f=e.lineOffsetY*t;if(e.numGlyphs>1){var x=e.glyphStartIndex+e.numGlyphs,v=e.lineStartIndex,b=e.lineStartIndex+e.lineLength,L=placeFirstAndLastGlyph(g,l,h,f,r,u,y,e,s,i,c,!1);if(!L)return{notEnoughRoom:!0};var A=project(L.first.point,o).point,G=project(L.last.point,o).point;if(n&&!r){var M=requiresOrientationChange(e.writingMode,A,G,m);if(M)return M}d=[L.first];for(var S=e.glyphStartIndex+1;S0?I.point:projectTruncatedLineSegment(y,D,w,1,a),z=requiresOrientationChange(e.writingMode,w,j,m);if(z)return z}var P=placeGlyphAlongLine(g*l.getoffsetX(e.glyphStartIndex),h,f,r,u,y,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,s,i,c,!1);if(!P)return{notEnoughRoom:!0};d=[P]}for(var _=0,C=d;_0?1:-1,g=0;n&&(d*=-1,g=Math.PI),d<0&&(g+=Math.PI);for(var h=d>0?l+o:l+o+1,f=h,x=a,v=a,b=0,L=0,A=Math.abs(m);b+L<=A;){if((h+=d)=s)return null;if(v=x,void 0===(x=y[h])){var G=new Point(p.getx(h),p.gety(h)),M=project(G,u);if(M.signedDistanceFromCamera>0)x=y[h]=M.point;else{var S=h-d;x=projectTruncatedLineSegment(0===b?i:new Point(p.getx(S),p.gety(S)),G,v,A-b+1,u)}}b+=L,L=v.dist(x)}var w=(A-b)/L,F=x.sub(v),D=F.mult(w)._add(v);return D._add(F._unit()._perp()._mult(r*d)),{point:D,angle:g+Math.atan2(x.y-v.y,x.x-v.x),tileDistance:c?{prevTileDistance:h-d===f?0:p.gettileUnitDistanceFromAnchor(h-d),lastSegmentViewportDistance:A-b}:null}}function hideGlyphs(e,t){for(var r=0;r=EXTENT||l.y<0||l.y>=EXTENT||e.symbolInstances.push(addSymbol(e,l,r,a,i,e.layers[0],e.collisionBoxArray,t.index,t.sourceLayerIndex,e.index,y,v,S,u,d,f,z,x,{zoom:e.zoom},t,o,n))};if("line"===b)for(var E=0,P=clipLine(t.geometry,0,0,EXTENT,EXTENT);E=SymbolBucket.MAX_GLYPHS&&util.warnOnce("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),{key:q,textBoxStartIndex:L,textBoxEndIndex:D,iconBoxStartIndex:B,iconBoxEndIndex:M,textOffset:y,iconOffset:v,anchor:t,line:a,featureIndex:l,feature:h,numGlyphVertices:P,numVerticalGlyphVertices:w,numIconVertices:E,textOpacityState:new OpacityState,iconOpacityState:new OpacityState,isDuplicate:!1,placedTextSymbolIndices:A,crossTileID:0}}function anchorIsTooClose(e,t,a,i){var o=e.compareText;if(t in o){for(var n=o[t],r=n.length-1;r>=0;r--)if(i.dist(n[r])1||(k?(clearTimeout(k),k=null,h("dblclick",t)):k=setTimeout(s,300))}function c(e){g("touchmove",e)}function d(e){g("touchend",e)}function l(e){g("touchcancel",e)}function s(){k=null}function v(e){DOM.mousePos(p,e).equals(b)&&h("click",e)}function m(e){h("dblclick",e),e.preventDefault()}function f(t){var n=e.dragRotate&&e.dragRotate.isActive();L||n?L&&(E=t):h("contextmenu",t),t.preventDefault()}function h(t,n){var o=DOM.mousePos(p,n);return e.fire(t,{lngLat:e.unproject(o),point:o,originalEvent:n})}function g(t,n){var o=DOM.touchPos(p,n),r=o.reduce(function(e,t,n,o){return e.add(t.div(o.length))},new Point(0,0));return e.fire(t,{lngLat:e.unproject(r),point:r,lngLats:o.map(function(t){return e.unproject(t)},this),points:o,originalEvent:n})}var p=e.getCanvasContainer(),E=null,L=!1,b=null,k=null;for(var q in handlers)e[q]=new handlers[q](e,t),t.interactive&&t[q]&&e[q].enable(t[q]);p.addEventListener("mouseout",n,!1),p.addEventListener("mousedown",o,!1),p.addEventListener("mouseup",r,!1),p.addEventListener("mousemove",a,!1),p.addEventListener("mouseover",u,!1),p.addEventListener("touchstart",i,!1),p.addEventListener("touchend",d,!1),p.addEventListener("touchmove",c,!1),p.addEventListener("touchcancel",l,!1),p.addEventListener("click",v,!1),p.addEventListener("dblclick",m,!1),p.addEventListener("contextmenu",f,!1)}; +},{"../util/dom":259,"./handler/box_zoom":239,"./handler/dblclick_zoom":240,"./handler/drag_pan":241,"./handler/drag_rotate":242,"./handler/keyboard":243,"./handler/scroll_zoom":244,"./handler/touch_zoom_rotate":245,"@mapbox/point-geometry":4}],231:[function(_dereq_,module,exports){ +"use strict";var util=_dereq_("../util/util"),interpolate=_dereq_("../style-spec/util/interpolate").number,browser=_dereq_("../util/browser"),LngLat=_dereq_("../geo/lng_lat"),LngLatBounds=_dereq_("../geo/lng_lat_bounds"),Point=_dereq_("@mapbox/point-geometry"),Evented=_dereq_("../util/evented"),Camera=function(t){function i(i,e){t.call(this),this.moving=!1,this.transform=i,this._bearingSnap=e.bearingSnap}return t&&(i.__proto__=t),i.prototype=Object.create(t&&t.prototype),i.prototype.constructor=i,i.prototype.getCenter=function(){return this.transform.center},i.prototype.setCenter=function(t,i){return this.jumpTo({center:t},i)},i.prototype.panBy=function(t,i,e){return t=Point.convert(t).mult(-1),this.panTo(this.transform.center,util.extend({offset:t},i),e)},i.prototype.panTo=function(t,i,e){return this.easeTo(util.extend({center:t},i),e)},i.prototype.getZoom=function(){return this.transform.zoom},i.prototype.setZoom=function(t,i){return this.jumpTo({zoom:t},i),this},i.prototype.zoomTo=function(t,i,e){return this.easeTo(util.extend({zoom:t},i),e)},i.prototype.zoomIn=function(t,i){return this.zoomTo(this.getZoom()+1,t,i),this},i.prototype.zoomOut=function(t,i){return this.zoomTo(this.getZoom()-1,t,i),this},i.prototype.getBearing=function(){return this.transform.bearing},i.prototype.setBearing=function(t,i){return this.jumpTo({bearing:t},i),this},i.prototype.rotateTo=function(t,i,e){return this.easeTo(util.extend({bearing:t},i),e)},i.prototype.resetNorth=function(t,i){return this.rotateTo(0,util.extend({duration:1e3},t),i),this},i.prototype.snapToNorth=function(t,i){return Math.abs(this.getBearing())i?1:0}),["bottom","left","right","top"]))return util.warnOnce("options.padding must be a positive number, or an Object with keys 'bottom', 'left', 'right', 'top'"),this;t=LngLatBounds.convert(t);var n=[(i.padding.left-i.padding.right)/2,(i.padding.top-i.padding.bottom)/2],r=Math.min(i.padding.right,i.padding.left),a=Math.min(i.padding.top,i.padding.bottom);i.offset=[i.offset[0]+n[0],i.offset[1]+n[1]];var s=Point.convert(i.offset),h=this.transform,p=h.project(t.getNorthWest()),u=h.project(t.getSouthEast()),c=u.sub(p),m=(h.width-2*r-2*Math.abs(s.x))/c.x,f=(h.height-2*a-2*Math.abs(s.y))/c.y;return f<0||m<0?(util.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset."),this):(i.center=h.unproject(p.add(u).div(2)),i.zoom=Math.min(h.scaleZoom(h.scale*Math.min(m,f)),i.maxZoom),i.bearing=0,i.linear?this.easeTo(i,e):this.flyTo(i,e))},i.prototype.jumpTo=function(t,i){this.stop();var e=this.transform,o=!1,n=!1,r=!1;return"zoom"in t&&e.zoom!==+t.zoom&&(o=!0,e.zoom=+t.zoom),void 0!==t.center&&(e.center=LngLat.convert(t.center)),"bearing"in t&&e.bearing!==+t.bearing&&(n=!0,e.bearing=+t.bearing),"pitch"in t&&e.pitch!==+t.pitch&&(r=!0,e.pitch=+t.pitch),this.fire("movestart",i).fire("move",i),o&&this.fire("zoomstart",i).fire("zoom",i).fire("zoomend",i),n&&this.fire("rotate",i),r&&this.fire("pitchstart",i).fire("pitch",i).fire("pitchend",i),this.fire("moveend",i)},i.prototype.easeTo=function(t,i){var e=this;this.stop(),t=util.extend({offset:[0,0],duration:500,easing:util.ease},t),!1===t.animate&&(t.duration=0);var o=this.transform,n=this.getZoom(),r=this.getBearing(),a=this.getPitch(),s="zoom"in t?+t.zoom:n,h="bearing"in t?this._normalizeBearing(t.bearing,r):r,p="pitch"in t?+t.pitch:a,u=o.centerPoint.add(Point.convert(t.offset)),c=o.pointLocation(u),m=LngLat.convert(t.center||c);this._normalizeCenter(m);var f,g,d=o.project(c),l=o.project(m).sub(d),v=o.zoomScale(s-n);return t.around&&(f=LngLat.convert(t.around),g=o.locationPoint(f)),this.zooming=s!==n,this.rotating=r!==h,this.pitching=p!==a,this._prepareEase(i,t.noMoveStart),clearTimeout(this._onEaseEnd),this._ease(function(t){if(e.zooming&&(o.zoom=interpolate(n,s,t)),e.rotating&&(o.bearing=interpolate(r,h,t)),e.pitching&&(o.pitch=interpolate(a,p,t)),f)o.setLocationAtPoint(f,g);else{var c=o.zoomScale(o.zoom-n),m=s>n?Math.min(2,v):Math.max(.5,v),_=Math.pow(m,1-t),b=o.unproject(d.add(l.mult(t*_)).mult(c));o.setLocationAtPoint(o.renderWorldCopies?b.wrap():b,u)}e._fireMoveEvents(i)},function(){t.delayEndEvents?e._onEaseEnd=setTimeout(function(){return e._afterEase(i)},t.delayEndEvents):e._afterEase(i)},t),this},i.prototype._prepareEase=function(t,i){this.moving=!0,i||this.fire("movestart",t),this.zooming&&this.fire("zoomstart",t),this.pitching&&this.fire("pitchstart",t)},i.prototype._fireMoveEvents=function(t){this.fire("move",t),this.zooming&&this.fire("zoom",t),this.rotating&&this.fire("rotate",t),this.pitching&&this.fire("pitch",t)},i.prototype._afterEase=function(t){var i=this.zooming,e=this.pitching;this.moving=!1,this.zooming=!1,this.rotating=!1,this.pitching=!1,i&&this.fire("zoomend",t),e&&this.fire("pitchend",t),this.fire("moveend",t)},i.prototype.flyTo=function(t,i){function e(t){var i=(M*M-z*z+(t?-1:1)*L*L*x*x)/(2*(t?M:z)*L*x);return Math.log(Math.sqrt(i*i+1)-i)}function o(t){return(Math.exp(t)-Math.exp(-t))/2}function n(t){return(Math.exp(t)+Math.exp(-t))/2}function r(t){return o(t)/n(t)}var a=this;this.stop(),t=util.extend({offset:[0,0],speed:1.2,curve:1.42,easing:util.ease},t);var s=this.transform,h=this.getZoom(),p=this.getBearing(),u=this.getPitch(),c="zoom"in t?util.clamp(+t.zoom,s.minZoom,s.maxZoom):h,m="bearing"in t?this._normalizeBearing(t.bearing,p):p,f="pitch"in t?+t.pitch:u,g=s.zoomScale(c-h),d=s.centerPoint.add(Point.convert(t.offset)),l=s.pointLocation(d),v=LngLat.convert(t.center||l);this._normalizeCenter(v);var _=s.project(l),b=s.project(v).sub(_),y=t.curve,z=Math.max(s.width,s.height),M=z/g,x=b.mag();if("minZoom"in t){var E=util.clamp(Math.min(t.minZoom,h,c),s.minZoom,s.maxZoom),T=z/s.zoomScale(E-h);y=Math.sqrt(T/x*2)}var L=y*y,j=e(0),w=function(t){return n(j)/n(j+y*t)},Z=function(t){return z*((n(j)*r(j+y*t)-o(j))/L)/x},P=(e(1)-j)/y;if(Math.abs(x)<1e-6||!isFinite(P)){if(Math.abs(z-M)<1e-6)return this.easeTo(t,i);var S=Mt.maxDuration&&(t.duration=0),this.zooming=!0,this.rotating=p!==m,this.pitching=f!==u,this._prepareEase(i,!1),this._ease(function(t){var e=t*P,o=1/w(e);s.zoom=h+s.scaleZoom(o),a.rotating&&(s.bearing=interpolate(p,m,t)),a.pitching&&(s.pitch=interpolate(u,f,t));var n=s.unproject(_.add(b.mult(Z(e))).mult(o));s.setLocationAtPoint(s.renderWorldCopies?n.wrap():n,d),a._fireMoveEvents(i)},function(){return a._afterEase(i)},t),this},i.prototype.isEasing=function(){return!!this._isEasing},i.prototype.isMoving=function(){return this.moving},i.prototype.stop=function(){return this._onFrame&&this._finishAnimation(),this},i.prototype._ease=function(t,i,e){var o=this;!1===e.animate||0===e.duration?(t(1),i()):(this._easeStart=browser.now(),this._isEasing=!0,this._easeOptions=e,this._startAnimation(function(i){var e=Math.min((browser.now()-o._easeStart)/o._easeOptions.duration,1);t(o._easeOptions.easing(e)),1===e&&o.stop()},function(){o._isEasing=!1,i()}))},i.prototype._updateCamera=function(){this._onFrame&&this._onFrame(this.transform)},i.prototype._startAnimation=function(t,i){return void 0===i&&(i=function(){}),this.stop(),this._onFrame=t,this._finishFn=i,this._update(),this},i.prototype._finishAnimation=function(){delete this._onFrame;var t=this._finishFn;delete this._finishFn,t.call(this)},i.prototype._normalizeBearing=function(t,i){t=util.wrap(t,-180,180);var e=Math.abs(t-i);return Math.abs(t-360-i)180?-360:e<-180?360:0}},i}(Evented);module.exports=Camera; +},{"../geo/lng_lat":62,"../geo/lng_lat_bounds":63,"../style-spec/util/interpolate":158,"../util/browser":252,"../util/evented":260,"../util/util":275,"@mapbox/point-geometry":4}],232:[function(_dereq_,module,exports){ +"use strict";var DOM=_dereq_("../../util/dom"),util=_dereq_("../../util/util"),config=_dereq_("../../util/config"),AttributionControl=function(t){this.options=t,util.bindAll(["_updateEditLink","_updateData","_updateCompact"],this)};AttributionControl.prototype.getDefaultPosition=function(){return"bottom-right"},AttributionControl.prototype.onAdd=function(t){var i=this.options&&this.options.compact;return this._map=t,this._container=DOM.create("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),i&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===i&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container},AttributionControl.prototype.onRemove=function(){DOM.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},AttributionControl.prototype._updateEditLink=function(){var t=this._editLink;t||(t=this._editLink=this._container.querySelector(".mapbox-improve-map"));var i=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:config.ACCESS_TOKEN}];if(t){var e=i.reduce(function(t,e,o){return e.value&&(t+=e.key+"="+e.value+(o=0)return!1;return!0}),t.length?(this._container.innerHTML=t.join(" | "),this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null}},AttributionControl.prototype._updateCompact=function(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact")},module.exports=AttributionControl; +},{"../../util/config":256,"../../util/dom":259,"../../util/util":275}],233:[function(_dereq_,module,exports){ "use strict";var DOM=_dereq_("../../util/dom"),util=_dereq_("../../util/util"),window=_dereq_("../../util/window"),FullscreenControl=function(){this._fullscreen=!1,util.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in window.document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in window.document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in window.document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in window.document&&(this._fullscreenchange="MSFullscreenChange"),this._className="mapboxgl-ctrl"};FullscreenControl.prototype.onAdd=function(e){return this._map=e,this._mapContainer=this._map.getContainer(),this._container=DOM.create("div",this._className+" mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._container.style.display="none",util.warnOnce("This device does not support fullscreen mode.")),this._container},FullscreenControl.prototype.onRemove=function(){DOM.remove(this._container),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._changeIcon)},FullscreenControl.prototype._checkFullscreenSupport=function(){return!!(window.document.fullscreenEnabled||window.document.mozFullScreenEnabled||window.document.msFullscreenEnabled||window.document.webkitFullscreenEnabled)},FullscreenControl.prototype._setupUI=function(){var e=this._fullscreenButton=DOM.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),window.document.addEventListener(this._fullscreenchange,this._changeIcon)},FullscreenControl.prototype._isFullscreen=function(){return this._fullscreen},FullscreenControl.prototype._changeIcon=function(){(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._mapContainer!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle(this._className+"-shrink"),this._fullscreenButton.classList.toggle(this._className+"-fullscreen"))},FullscreenControl.prototype._onClickFullscreen=function(){this._isFullscreen()?window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen&&window.document.webkitCancelFullScreen():this._mapContainer.requestFullscreen?this._mapContainer.requestFullscreen():this._mapContainer.mozRequestFullScreen?this._mapContainer.mozRequestFullScreen():this._mapContainer.msRequestFullscreen?this._mapContainer.msRequestFullscreen():this._mapContainer.webkitRequestFullscreen&&this._mapContainer.webkitRequestFullscreen()},module.exports=FullscreenControl; -},{"../../util/dom":238,"../../util/util":252,"../../util/window":233}],213:[function(_dereq_,module,exports){ +},{"../../util/dom":259,"../../util/util":275,"../../util/window":254}],234:[function(_dereq_,module,exports){ "use strict";function checkGeolocationSupport(t){void 0!==supportsGeolocation?t(supportsGeolocation):void 0!==window.navigator.permissions?window.navigator.permissions.query({name:"geolocation"}).then(function(o){supportsGeolocation="denied"!==o.state,t(supportsGeolocation)}):(supportsGeolocation=!!window.navigator.geolocation,t(supportsGeolocation))}var Evented=_dereq_("../../util/evented"),DOM=_dereq_("../../util/dom"),window=_dereq_("../../util/window"),util=_dereq_("../../util/util"),LngLat=_dereq_("../../geo/lng_lat"),Marker=_dereq_("../marker"),defaultOptions={positionOptions:{enableHighAccuracy:!1,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showUserLocation:!0},className="mapboxgl-ctrl",supportsGeolocation,GeolocateControl=function(t){function o(o){t.call(this),this.options=util.extend({},defaultOptions,o),util.bindAll(["_onSuccess","_onError","_finish","_setupUI","_updateCamera","_updateMarker","_onClickGeolocate"],this)}return t&&(o.__proto__=t),o.prototype=Object.create(t&&t.prototype),o.prototype.constructor=o,o.prototype.onAdd=function(t){return this._map=t,this._container=DOM.create("div",className+" "+className+"-group"),checkGeolocationSupport(this._setupUI),this._container},o.prototype.onRemove=function(){void 0!==this._geolocationWatchID&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker.remove(),DOM.remove(this._container),this._map=void 0},o.prototype._onSuccess=function(t){if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(t),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire("geolocate",t),this._finish()},o.prototype._updateCamera=function(t){var o=new LngLat(t.coords.longitude,t.coords.latitude),e=t.coords.accuracy;this._map.fitBounds(o.toBounds(e),this.options.fitBoundsOptions,{geolocateSource:!0})},o.prototype._updateMarker=function(t){t?this._userLocationDotMarker.setLngLat([t.coords.longitude,t.coords.latitude]).addTo(this._map):this._userLocationDotMarker.remove()},o.prototype._onError=function(t){if(this.options.trackUserLocation)if(1===t.code)this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),void 0!==this._geolocationWatchID&&this._clearWatch();else switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire("error",t),this._finish()},o.prototype._finish=function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},o.prototype._setupUI=function(t){var o=this;!1!==t&&(this._container.addEventListener("contextmenu",function(t){return t.preventDefault()}),this._geolocateButton=DOM.create("button",className+"-icon "+className+"-geolocate",this._container),this._geolocateButton.type="button",this._geolocateButton.setAttribute("aria-label","Geolocate"),this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=DOM.create("div","mapboxgl-user-location-dot"),this._userLocationDotMarker=new Marker(this._dotElement),this.options.trackUserLocation&&(this._watchState="OFF")),this._geolocateButton.addEventListener("click",this._onClickGeolocate.bind(this)),this.options.trackUserLocation&&this._map.on("movestart",function(t){t.geolocateSource||"ACTIVE_LOCK"!==o._watchState||(o._watchState="BACKGROUND",o._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),o._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),o.fire("trackuserlocationend"))}))},o.prototype._onClickGeolocate=function(){if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire("trackuserlocationstart");break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire("trackuserlocationend");break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire("trackuserlocationstart")}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}"OFF"===this._watchState&&void 0!==this._geolocationWatchID?this._clearWatch():void 0===this._geolocationWatchID&&(this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,this.options.positionOptions))}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4)},o.prototype._clearWatch=function(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)},o}(Evented);module.exports=GeolocateControl; -},{"../../geo/lng_lat":68,"../../util/dom":238,"../../util/evented":239,"../../util/util":252,"../../util/window":233,"../marker":227}],214:[function(_dereq_,module,exports){ +},{"../../geo/lng_lat":62,"../../util/dom":259,"../../util/evented":260,"../../util/util":275,"../../util/window":254,"../marker":248}],235:[function(_dereq_,module,exports){ "use strict";var DOM=_dereq_("../../util/dom"),util=_dereq_("../../util/util"),LogoControl=function(){util.bindAll(["_updateLogo"],this)};LogoControl.prototype.onAdd=function(o){this._map=o,this._container=DOM.create("div","mapboxgl-ctrl");var t=DOM.create("a","mapboxgl-ctrl-logo");return t.target="_blank",t.href="https://www.mapbox.com/",t.setAttribute("aria-label","Mapbox logo"),this._container.appendChild(t),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._container},LogoControl.prototype.onRemove=function(){DOM.remove(this._container),this._map.off("sourcedata",this._updateLogo)},LogoControl.prototype.getDefaultPosition=function(){return"bottom-left"},LogoControl.prototype._updateLogo=function(o){o&&"metadata"!==o.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")},LogoControl.prototype._logoRequired=function(){if(this._map.style){var o=this._map.style.sourceCaches;for(var t in o){if(o[t].getSource().mapbox_logo)return!0}return!1}},module.exports=LogoControl; -},{"../../util/dom":238,"../../util/util":252}],215:[function(_dereq_,module,exports){ -"use strict";var DOM=_dereq_("../../util/dom"),util=_dereq_("../../util/util"),DragRotateHandler=_dereq_("../handler/drag_rotate"),NavigationControl=function(){var t=this;util.bindAll(["_rotateCompassArrow"],this),this._container=DOM.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",function(t){return t.preventDefault()}),this._zoomInButton=this._createButton("mapboxgl-ctrl-icon mapboxgl-ctrl-zoom-in","Zoom In",function(){return t._map.zoomIn()}),this._zoomOutButton=this._createButton("mapboxgl-ctrl-icon mapboxgl-ctrl-zoom-out","Zoom Out",function(){return t._map.zoomOut()}),this._compass=this._createButton("mapboxgl-ctrl-icon mapboxgl-ctrl-compass","Reset North",function(){return t._map.resetNorth()}),this._compassArrow=DOM.create("span","mapboxgl-ctrl-compass-arrow",this._compass)};NavigationControl.prototype._rotateCompassArrow=function(){var t="rotate("+this._map.transform.angle*(180/Math.PI)+"deg)";this._compassArrow.style.transform=t},NavigationControl.prototype.onAdd=function(t){return this._map=t,this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new DragRotateHandler(t,{button:"left",element:this._compass,pitchWithRotate:!1}),this._handler.enable(),this._container},NavigationControl.prototype.onRemove=function(){DOM.remove(this._container),this._map.off("rotate",this._rotateCompassArrow),delete this._map,this._handler.disable(),delete this._handler},NavigationControl.prototype._createButton=function(t,o,r){var e=DOM.create("button",t,this._container);return e.type="button",e.setAttribute("aria-label",o),e.addEventListener("click",r),e},module.exports=NavigationControl; -},{"../../util/dom":238,"../../util/util":252,"../handler/drag_rotate":221}],216:[function(_dereq_,module,exports){ +},{"../../util/dom":259,"../../util/util":275}],236:[function(_dereq_,module,exports){ +"use strict";var DOM=_dereq_("../../util/dom"),util=_dereq_("../../util/util"),DragRotateHandler=_dereq_("../handler/drag_rotate"),defaultOptions={showCompass:!0,showZoom:!0},NavigationControl=function(t){var o=this;this.options=util.extend({},defaultOptions,t),this._container=DOM.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",function(t){return t.preventDefault()}),this.options.showZoom&&(this._zoomInButton=this._createButton("mapboxgl-ctrl-icon mapboxgl-ctrl-zoom-in","Zoom In",function(){return o._map.zoomIn()}),this._zoomOutButton=this._createButton("mapboxgl-ctrl-icon mapboxgl-ctrl-zoom-out","Zoom Out",function(){return o._map.zoomOut()})),this.options.showCompass&&(util.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-icon mapboxgl-ctrl-compass","Reset North",function(){return o._map.resetNorth()}),this._compassArrow=DOM.create("span","mapboxgl-ctrl-compass-arrow",this._compass))};NavigationControl.prototype._rotateCompassArrow=function(){var t="rotate("+this._map.transform.angle*(180/Math.PI)+"deg)";this._compassArrow.style.transform=t},NavigationControl.prototype.onAdd=function(t){return this._map=t,this.options.showCompass&&(this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new DragRotateHandler(t,{button:"left",element:this._compass}),this._handler.enable()),this._container},NavigationControl.prototype.onRemove=function(){DOM.remove(this._container),this.options.showCompass&&(this._map.off("rotate",this._rotateCompassArrow),this._handler.disable(),delete this._handler),delete this._map},NavigationControl.prototype._createButton=function(t,o,r){var e=DOM.create("button",t,this._container);return e.type="button",e.setAttribute("aria-label",o),e.addEventListener("click",r),e},module.exports=NavigationControl; +},{"../../util/dom":259,"../../util/util":275,"../handler/drag_rotate":242}],237:[function(_dereq_,module,exports){ "use strict";function updateScale(t,e,o){var n=o&&o.maxWidth||100,i=t._container.clientHeight/2,a=getDistance(t.unproject([0,i]),t.unproject([n,i]));if(o&&"imperial"===o.unit){var l=3.2808*a;if(l>5280){setScale(e,n,l/5280,"mi")}else setScale(e,n,l,"ft")}else if(o&&"nautical"===o.unit){var r=a/1852;setScale(e,n,r,"nm")}else setScale(e,n,a,"m")}function setScale(t,e,o,n){var i=getRoundNum(o),a=i/o;"m"===n&&i>=1e3&&(i/=1e3,n="km"),t.style.width=e*a+"px",t.innerHTML=i+n}function getDistance(t,e){var o=Math.PI/180,n=t.lat*o,i=e.lat*o,a=Math.sin(n)*Math.sin(i)+Math.cos(n)*Math.cos(i)*Math.cos((e.lng-t.lng)*o);return 6371e3*Math.acos(Math.min(a,1))}function getRoundNum(t){var e=Math.pow(10,(""+Math.floor(t)).length-1),o=t/e;return o=o>=10?10:o>=5?5:o>=3?3:o>=2?2:1,e*o}var DOM=_dereq_("../../util/dom"),util=_dereq_("../../util/util"),ScaleControl=function(t){this.options=t,util.bindAll(["_onMove"],this)};ScaleControl.prototype.getDefaultPosition=function(){return"bottom-left"},ScaleControl.prototype._onMove=function(){updateScale(this._map,this._container,this.options)},ScaleControl.prototype.onAdd=function(t){return this._map=t,this._container=DOM.create("div","mapboxgl-ctrl mapboxgl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container},ScaleControl.prototype.onRemove=function(){DOM.remove(this._container),this._map.off("move",this._onMove),this._map=void 0},module.exports=ScaleControl; -},{"../../util/dom":238,"../../util/util":252}],217:[function(_dereq_,module,exports){ +},{"../../util/dom":259,"../../util/util":275}],238:[function(_dereq_,module,exports){ "use strict"; -},{}],218:[function(_dereq_,module,exports){ +},{}],239:[function(_dereq_,module,exports){ "use strict";var DOM=_dereq_("../../util/dom"),LngLatBounds=_dereq_("../../geo/lng_lat_bounds"),util=_dereq_("../../util/util"),window=_dereq_("../../util/window"),BoxZoomHandler=function(o){this._map=o,this._el=o.getCanvasContainer(),this._container=o.getContainer(),util.bindAll(["_onMouseDown","_onMouseMove","_onMouseUp","_onKeyDown"],this)};BoxZoomHandler.prototype.isEnabled=function(){return!!this._enabled},BoxZoomHandler.prototype.isActive=function(){return!!this._active},BoxZoomHandler.prototype.enable=function(){this.isEnabled()||(this._map.dragPan&&this._map.dragPan.disable(),this._el.addEventListener("mousedown",this._onMouseDown,!1),this._map.dragPan&&this._map.dragPan.enable(),this._enabled=!0)},BoxZoomHandler.prototype.disable=function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onMouseDown),this._enabled=!1)},BoxZoomHandler.prototype._onMouseDown=function(o){o.shiftKey&&0===o.button&&(window.document.addEventListener("mousemove",this._onMouseMove,!1),window.document.addEventListener("keydown",this._onKeyDown,!1),window.document.addEventListener("mouseup",this._onMouseUp,!1),DOM.disableDrag(),this._startPos=DOM.mousePos(this._el,o),this._active=!0)},BoxZoomHandler.prototype._onMouseMove=function(o){var e=this._startPos,t=DOM.mousePos(this._el,o);this._box||(this._box=DOM.create("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",o));var n=Math.min(e.x,t.x),i=Math.max(e.x,t.x),s=Math.min(e.y,t.y),a=Math.max(e.y,t.y);DOM.setTransform(this._box,"translate("+n+"px,"+s+"px)"),this._box.style.width=i-n+"px",this._box.style.height=a-s+"px"},BoxZoomHandler.prototype._onMouseUp=function(o){if(0===o.button){var e=this._startPos,t=DOM.mousePos(this._el,o),n=(new LngLatBounds).extend(this._map.unproject(e)).extend(this._map.unproject(t));this._finish(),e.x===t.x&&e.y===t.y?this._fireEvent("boxzoomcancel",o):this._map.fitBounds(n,{linear:!0}).fire("boxzoomend",{originalEvent:o,boxZoomBounds:n})}},BoxZoomHandler.prototype._onKeyDown=function(o){27===o.keyCode&&(this._finish(),this._fireEvent("boxzoomcancel",o))},BoxZoomHandler.prototype._finish=function(){this._active=!1,window.document.removeEventListener("mousemove",this._onMouseMove,!1),window.document.removeEventListener("keydown",this._onKeyDown,!1),window.document.removeEventListener("mouseup",this._onMouseUp,!1),this._container.classList.remove("mapboxgl-crosshair"),this._box&&(DOM.remove(this._box),this._box=null),DOM.enableDrag()},BoxZoomHandler.prototype._fireEvent=function(o,e){return this._map.fire(o,{originalEvent:e})},module.exports=BoxZoomHandler; -},{"../../geo/lng_lat_bounds":69,"../../util/dom":238,"../../util/util":252,"../../util/window":233}],219:[function(_dereq_,module,exports){ +},{"../../geo/lng_lat_bounds":63,"../../util/dom":259,"../../util/util":275,"../../util/window":254}],240:[function(_dereq_,module,exports){ "use strict";var util=_dereq_("../../util/util"),DoubleClickZoomHandler=function(o){this._map=o,util.bindAll(["_onDblClick","_onZoomEnd"],this)};DoubleClickZoomHandler.prototype.isEnabled=function(){return!!this._enabled},DoubleClickZoomHandler.prototype.isActive=function(){return!!this._active},DoubleClickZoomHandler.prototype.enable=function(){this.isEnabled()||(this._map.on("dblclick",this._onDblClick),this._enabled=!0)},DoubleClickZoomHandler.prototype.disable=function(){this.isEnabled()&&(this._map.off("dblclick",this._onDblClick),this._enabled=!1)},DoubleClickZoomHandler.prototype._onDblClick=function(o){this._active=!0,this._map.on("zoomend",this._onZoomEnd),this._map.zoomTo(this._map.getZoom()+(o.originalEvent.shiftKey?-1:1),{around:o.lngLat},o)},DoubleClickZoomHandler.prototype._onZoomEnd=function(){this._active=!1,this._map.off("zoomend",this._onZoomEnd)},module.exports=DoubleClickZoomHandler; -},{"../../util/util":252}],220:[function(_dereq_,module,exports){ -"use strict";var DOM=_dereq_("../../util/dom"),util=_dereq_("../../util/util"),window=_dereq_("../../util/window"),inertiaLinearity=.3,inertiaEasing=util.bezier(0,0,inertiaLinearity,1),inertiaMaxSpeed=1400,inertiaDeceleration=2500,DragPanHandler=function(t){this._map=t,this._el=t.getCanvasContainer(),util.bindAll(["_onDown","_onMove","_onUp","_onTouchEnd","_onMouseUp"],this)};DragPanHandler.prototype.isEnabled=function(){return!!this._enabled},DragPanHandler.prototype.isActive=function(){return!!this._active},DragPanHandler.prototype.enable=function(){this.isEnabled()||(this._el.classList.add("mapboxgl-touch-drag-pan"),this._el.addEventListener("mousedown",this._onDown),this._el.addEventListener("touchstart",this._onDown),this._enabled=!0)},DragPanHandler.prototype.disable=function(){this.isEnabled()&&(this._el.classList.remove("mapboxgl-touch-drag-pan"),this._el.removeEventListener("mousedown",this._onDown),this._el.removeEventListener("touchstart",this._onDown),this._enabled=!1)},DragPanHandler.prototype._onDown=function(t){this._ignoreEvent(t)||this.isActive()||(t.touches?(window.document.addEventListener("touchmove",this._onMove),window.document.addEventListener("touchend",this._onTouchEnd)):(window.document.addEventListener("mousemove",this._onMove),window.document.addEventListener("mouseup",this._onMouseUp)),window.addEventListener("blur",this._onMouseUp),this._active=!1,this._startPos=this._pos=DOM.mousePos(this._el,t),this._inertia=[[Date.now(),this._pos]])},DragPanHandler.prototype._onMove=function(t){if(!this._ignoreEvent(t)){this.isActive()||(this._active=!0,this._map.moving=!0,this._fireEvent("dragstart",t),this._fireEvent("movestart",t));var e=DOM.mousePos(this._el,t),n=this._map;n.stop(),this._drainInertiaBuffer(),this._inertia.push([Date.now(),e]),n.transform.setLocationAtPoint(n.transform.pointLocation(this._pos),e),this._fireEvent("drag",t),this._fireEvent("move",t),this._pos=e,t.preventDefault()}},DragPanHandler.prototype._onUp=function(t){var e=this;if(this.isActive()){this._active=!1,this._fireEvent("dragend",t),this._drainInertiaBuffer();var n=function(){e._map.moving=!1,e._fireEvent("moveend",t)},i=this._inertia;if(i.length<2)return void n();var o=i[i.length-1],r=i[0],a=o[1].sub(r[1]),s=(o[0]-r[0])/1e3;if(0===s||o[1].equals(r[1]))return void n();var u=a.mult(inertiaLinearity/s),d=u.mag();d>inertiaMaxSpeed&&(d=inertiaMaxSpeed,u._unit()._mult(d));var h=d/(inertiaDeceleration*inertiaLinearity),v=u.mult(-h/2);this._map.panBy(v,{duration:1e3*h,easing:inertiaEasing,noMoveStart:!0},{originalEvent:t})}},DragPanHandler.prototype._onMouseUp=function(t){this._ignoreEvent(t)||(this._onUp(t),window.document.removeEventListener("mousemove",this._onMove),window.document.removeEventListener("mouseup",this._onMouseUp),window.removeEventListener("blur",this._onMouseUp))},DragPanHandler.prototype._onTouchEnd=function(t){this._ignoreEvent(t)||(this._onUp(t),window.document.removeEventListener("touchmove",this._onMove),window.document.removeEventListener("touchend",this._onTouchEnd))},DragPanHandler.prototype._fireEvent=function(t,e){return this._map.fire(t,{originalEvent:e})},DragPanHandler.prototype._ignoreEvent=function(t){var e=this._map;return!(!e.boxZoom||!e.boxZoom.isActive())||(!(!e.dragRotate||!e.dragRotate.isActive())||(t.touches?t.touches.length>1:!!t.ctrlKey||"mousemove"!==t.type&&t.button&&0!==t.button))},DragPanHandler.prototype._drainInertiaBuffer=function(){for(var t=this._inertia,e=Date.now();t.length>0&&e-t[0][0]>160;)t.shift()},module.exports=DragPanHandler; -},{"../../util/dom":238,"../../util/util":252,"../../util/window":233}],221:[function(_dereq_,module,exports){ -"use strict";var DOM=_dereq_("../../util/dom"),util=_dereq_("../../util/util"),window=_dereq_("../../util/window"),inertiaLinearity=.25,inertiaEasing=util.bezier(0,0,inertiaLinearity,1),inertiaMaxSpeed=180,inertiaDeceleration=720,DragRotateHandler=function(t,e){this._map=t,this._el=e.element||t.getCanvasContainer(),this._button=e.button||"right",this._bearingSnap=e.bearingSnap||0,this._pitchWithRotate=!1!==e.pitchWithRotate,util.bindAll(["_onDown","_onMove","_onUp"],this)};DragRotateHandler.prototype.isEnabled=function(){return!!this._enabled},DragRotateHandler.prototype.isActive=function(){return!!this._active},DragRotateHandler.prototype.enable=function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onDown),this._enabled=!0)},DragRotateHandler.prototype.disable=function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onDown),this._enabled=!1)},DragRotateHandler.prototype._onDown=function(t){if(!(this._map.boxZoom&&this._map.boxZoom.isActive()||this._map.dragPan&&this._map.dragPan.isActive()||this.isActive())){if("right"===this._button){var e=t.ctrlKey?0:2,i=t.button;if(void 0!==window.InstallTrigger&&2===t.button&&t.ctrlKey&&window.navigator.platform.toUpperCase().indexOf("MAC")>=0&&(i=0),i!==e)return}else if(t.ctrlKey||0!==t.button)return;DOM.disableDrag(),window.document.addEventListener("mousemove",this._onMove,{capture:!0}),window.document.addEventListener("mouseup",this._onUp),window.addEventListener("blur",this._onUp),this._active=!1,this._inertia=[[Date.now(),this._map.getBearing()]],this._startPos=this._pos=DOM.mousePos(this._el,t),this._center=this._map.transform.centerPoint,t.preventDefault()}},DragRotateHandler.prototype._onMove=function(t){this.isActive()||(this._active=!0,this._map.moving=!0,this._fireEvent("rotatestart",t),this._fireEvent("movestart",t),this._pitchWithRotate&&this._fireEvent("pitchstart",t));var e=this._map;e.stop();var i=this._pos,n=DOM.mousePos(this._el,t),r=.8*(i.x-n.x),a=-.5*(i.y-n.y),o=e.getBearing()-r,s=e.getPitch()-a,h=this._inertia,_=h[h.length-1];this._drainInertiaBuffer(),h.push([Date.now(),e._normalizeBearing(o,_[1])]),e.transform.bearing=o,this._pitchWithRotate&&(this._fireEvent("pitch",t),e.transform.pitch=s),this._fireEvent("rotate",t),this._fireEvent("move",t),this._pos=n},DragRotateHandler.prototype._onUp=function(t){var e=this;if(window.document.removeEventListener("mousemove",this._onMove,{capture:!0}),window.document.removeEventListener("mouseup",this._onUp),window.removeEventListener("blur",this._onUp),DOM.enableDrag(),this.isActive()){this._active=!1,this._fireEvent("rotateend",t),this._drainInertiaBuffer();var i=this._map,n=i.getBearing(),r=this._inertia,a=function(){Math.abs(n)inertiaMaxSpeed&&(l=inertiaMaxSpeed);var u=l/(inertiaDeceleration*inertiaLinearity);_+=v*l*(u/2),Math.abs(i._normalizeBearing(_,0))0&&e-t[0][0]>160;)t.shift()},module.exports=DragRotateHandler; -},{"../../util/dom":238,"../../util/util":252,"../../util/window":233}],222:[function(_dereq_,module,exports){ +},{"../../util/util":275}],241:[function(_dereq_,module,exports){ +"use strict";var DOM=_dereq_("../../util/dom"),util=_dereq_("../../util/util"),window=_dereq_("../../util/window"),browser=_dereq_("../../util/browser"),inertiaLinearity=.3,inertiaEasing=util.bezier(0,0,inertiaLinearity,1),inertiaMaxSpeed=1400,inertiaDeceleration=2500,DragPanHandler=function(e){this._map=e,this._el=e.getCanvasContainer(),util.bindAll(["_onDown","_onMove","_onUp","_onTouchEnd","_onMouseUp","_onDragFrame","_onDragFinished"],this)};DragPanHandler.prototype.isEnabled=function(){return!!this._enabled},DragPanHandler.prototype.isActive=function(){return!!this._active},DragPanHandler.prototype.enable=function(){this.isEnabled()||(this._el.classList.add("mapboxgl-touch-drag-pan"),this._el.addEventListener("mousedown",this._onDown),this._el.addEventListener("touchstart",this._onDown),this._enabled=!0)},DragPanHandler.prototype.disable=function(){this.isEnabled()&&(this._el.classList.remove("mapboxgl-touch-drag-pan"),this._el.removeEventListener("mousedown",this._onDown),this._el.removeEventListener("touchstart",this._onDown),this._enabled=!1)},DragPanHandler.prototype._onDown=function(e){this._ignoreEvent(e)||this.isActive()||(e.touches?(window.document.addEventListener("touchmove",this._onMove),window.document.addEventListener("touchend",this._onTouchEnd)):(window.document.addEventListener("mousemove",this._onMove),window.document.addEventListener("mouseup",this._onMouseUp)),window.addEventListener("blur",this._onMouseUp),this._active=!1,this._previousPos=DOM.mousePos(this._el,e),this._inertia=[[browser.now(),this._previousPos]])},DragPanHandler.prototype._onMove=function(e){if(!this._ignoreEvent(e)){this._lastMoveEvent=e,e.preventDefault();var t=DOM.mousePos(this._el,e);if(this._drainInertiaBuffer(),this._inertia.push([browser.now(),t]),!this._previousPos)return void(this._previousPos=t);this._pos=t,this.isActive()||(this._active=!0,this._map.moving=!0,this._fireEvent("dragstart",e),this._fireEvent("movestart",e),this._map._startAnimation(this._onDragFrame,this._onDragFinished)),this._map._update()}},DragPanHandler.prototype._onDragFrame=function(e){var t=this._lastMoveEvent;t&&(e.setLocationAtPoint(e.pointLocation(this._previousPos),this._pos),this._fireEvent("drag",t),this._fireEvent("move",t),this._previousPos=this._pos,delete this._lastMoveEvent)},DragPanHandler.prototype._onDragFinished=function(e){var t=this;if(this.isActive()){this._active=!1,delete this._lastMoveEvent,delete this._previousPos,delete this._pos,this._fireEvent("dragend",e),this._drainInertiaBuffer();var n=function(){t._map.moving=!1,t._fireEvent("moveend",e)},i=this._inertia;if(i.length<2)return void n();var o=i[i.length-1],r=i[0],s=o[1].sub(r[1]),a=(o[0]-r[0])/1e3;if(0===a||o[1].equals(r[1]))return void n();var h=s.mult(inertiaLinearity/a),u=h.mag();u>inertiaMaxSpeed&&(u=inertiaMaxSpeed,h._unit()._mult(u));var d=u/(inertiaDeceleration*inertiaLinearity),_=h.mult(-d/2);this._map.panBy(_,{duration:1e3*d,easing:inertiaEasing,noMoveStart:!0},{originalEvent:e})}},DragPanHandler.prototype._onUp=function(e){this._onDragFinished(e)},DragPanHandler.prototype._onMouseUp=function(e){this._ignoreEvent(e)||(this._onUp(e),window.document.removeEventListener("mousemove",this._onMove),window.document.removeEventListener("mouseup",this._onMouseUp),window.removeEventListener("blur",this._onMouseUp))},DragPanHandler.prototype._onTouchEnd=function(e){this._ignoreEvent(e)||(this._onUp(e),window.document.removeEventListener("touchmove",this._onMove),window.document.removeEventListener("touchend",this._onTouchEnd))},DragPanHandler.prototype._fireEvent=function(e,t){return this._map.fire(e,t?{originalEvent:t}:{})},DragPanHandler.prototype._ignoreEvent=function(e){var t=this._map;return!(!t.boxZoom||!t.boxZoom.isActive())||(!(!t.dragRotate||!t.dragRotate.isActive())||(e.touches?e.touches.length>1:!!e.ctrlKey||"mousemove"!==e.type&&e.button&&0!==e.button))},DragPanHandler.prototype._drainInertiaBuffer=function(){for(var e=this._inertia,t=browser.now();e.length>0&&t-e[0][0]>160;)e.shift()},module.exports=DragPanHandler; +},{"../../util/browser":252,"../../util/dom":259,"../../util/util":275,"../../util/window":254}],242:[function(_dereq_,module,exports){ +"use strict";var DOM=_dereq_("../../util/dom"),util=_dereq_("../../util/util"),window=_dereq_("../../util/window"),browser=_dereq_("../../util/browser"),inertiaLinearity=.25,inertiaEasing=util.bezier(0,0,inertiaLinearity,1),inertiaMaxSpeed=180,inertiaDeceleration=720,DragRotateHandler=function(t,e){this._map=t,this._el=e.element||t.getCanvasContainer(),this._button=e.button||"right",this._bearingSnap=e.bearingSnap||0,this._pitchWithRotate=!1!==e.pitchWithRotate,util.bindAll(["_onDown","_onMove","_onUp","_onDragFrame","_onDragFinished"],this)};DragRotateHandler.prototype.isEnabled=function(){return!!this._enabled},DragRotateHandler.prototype.isActive=function(){return!!this._active},DragRotateHandler.prototype.enable=function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onDown),this._enabled=!0)},DragRotateHandler.prototype.disable=function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onDown),this._enabled=!1)},DragRotateHandler.prototype._onDown=function(t){if(!(this._map.boxZoom&&this._map.boxZoom.isActive()||this._map.dragPan&&this._map.dragPan.isActive()||this.isActive())){if("right"===this._button){var e=t.ctrlKey?0:2,i=t.button;if(void 0!==window.InstallTrigger&&2===t.button&&t.ctrlKey&&window.navigator.platform.toUpperCase().indexOf("MAC")>=0&&(i=0),i!==e)return}else if(t.ctrlKey||0!==t.button)return;DOM.disableDrag(),window.document.addEventListener("mousemove",this._onMove,{capture:!0}),window.document.addEventListener("mouseup",this._onUp),window.addEventListener("blur",this._onUp),this._active=!1,this._inertia=[[browser.now(),this._map.getBearing()]],this._previousPos=DOM.mousePos(this._el,t),this._center=this._map.transform.centerPoint,t.preventDefault()}},DragRotateHandler.prototype._onMove=function(t){this._lastMoveEvent=t;var e=DOM.mousePos(this._el,t);if(!this._previousPos)return void(this._previousPos=e);this._pos=e,this.isActive()||(this._active=!0,this._map.moving=!0,this._fireEvent("rotatestart",t),this._fireEvent("movestart",t),this._pitchWithRotate&&this._fireEvent("pitchstart",t),this._map._startAnimation(this._onDragFrame,this._onDragFinished)),this._map._update()},DragRotateHandler.prototype._onUp=function(t){window.document.removeEventListener("mousemove",this._onMove,{capture:!0}),window.document.removeEventListener("mouseup",this._onUp),window.removeEventListener("blur",this._onUp),DOM.enableDrag(),this._onDragFinished(t)},DragRotateHandler.prototype._onDragFrame=function(t){var e=this._lastMoveEvent;if(e){var i=this._previousPos,n=this._pos,r=.8*(i.x-n.x),a=-.5*(i.y-n.y),o=t.bearing-r,s=t.pitch-a,h=this._inertia,_=h[h.length-1];this._drainInertiaBuffer(),h.push([browser.now(),this._map._normalizeBearing(o,_[1])]),t.bearing=o,this._pitchWithRotate&&(this._fireEvent("pitch",e),t.pitch=s),this._fireEvent("rotate",e),this._fireEvent("move",e),delete this._lastMoveEvent,this._previousPos=this._pos}},DragRotateHandler.prototype._onDragFinished=function(t){var e=this;if(this.isActive()){this._active=!1,delete this._lastMoveEvent,delete this._previousPos,this._fireEvent("rotateend",t),this._drainInertiaBuffer();var i=this._map,n=i.getBearing(),r=this._inertia,a=function(){Math.abs(n)inertiaMaxSpeed&&(u=inertiaMaxSpeed);var l=u/(inertiaDeceleration*inertiaLinearity);_+=p*u*(l/2),Math.abs(i._normalizeBearing(_,0))0&&e-t[0][0]>160;)t.shift()},module.exports=DragRotateHandler; +},{"../../util/browser":252,"../../util/dom":259,"../../util/util":275,"../../util/window":254}],243:[function(_dereq_,module,exports){ "use strict";function easeOut(e){return e*(2-e)}var util=_dereq_("../../util/util"),panStep=100,bearingStep=15,pitchStep=10,KeyboardHandler=function(e){this._map=e,this._el=e.getCanvasContainer(),util.bindAll(["_onKeyDown"],this)};KeyboardHandler.prototype.isEnabled=function(){return!!this._enabled},KeyboardHandler.prototype.enable=function(){this.isEnabled()||(this._el.addEventListener("keydown",this._onKeyDown,!1),this._enabled=!0)},KeyboardHandler.prototype.disable=function(){this.isEnabled()&&(this._el.removeEventListener("keydown",this._onKeyDown),this._enabled=!1)},KeyboardHandler.prototype._onKeyDown=function(e){if(!(e.altKey||e.ctrlKey||e.metaKey)){var t=0,a=0,n=0,r=0,i=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?a=-1:(e.preventDefault(),r=-1);break;case 39:e.shiftKey?a=1:(e.preventDefault(),r=1);break;case 38:e.shiftKey?n=1:(e.preventDefault(),i=-1);break;case 40:e.shiftKey?n=-1:(i=1,e.preventDefault());break;default:return}var s=this._map,o=s.getZoom(),l={duration:300,delayEndEvents:500,easing:easeOut,zoom:t?Math.round(o)+t*(e.shiftKey?2:1):o,bearing:s.getBearing()+a*bearingStep,pitch:s.getPitch()+n*pitchStep,offset:[-r*panStep,-i*panStep],center:s.getCenter()};s.easeTo(l,{originalEvent:e})}},module.exports=KeyboardHandler; -},{"../../util/util":252}],223:[function(_dereq_,module,exports){ -"use strict";var DOM=_dereq_("../../util/dom"),util=_dereq_("../../util/util"),browser=_dereq_("../../util/browser"),window=_dereq_("../../util/window"),ua=window.navigator.userAgent.toLowerCase(),firefox=-1!==ua.indexOf("firefox"),safari=-1!==ua.indexOf("safari")&&-1===ua.indexOf("chrom"),ScrollZoomHandler=function(e){this._map=e,this._el=e.getCanvasContainer(),util.bindAll(["_onWheel","_onTimeout"],this)};ScrollZoomHandler.prototype.isEnabled=function(){return!!this._enabled},ScrollZoomHandler.prototype.enable=function(e){this.isEnabled()||(this._el.addEventListener("wheel",this._onWheel,!1),this._el.addEventListener("mousewheel",this._onWheel,!1),this._enabled=!0,this._aroundCenter=e&&"center"===e.around)},ScrollZoomHandler.prototype.disable=function(){this.isEnabled()&&(this._el.removeEventListener("wheel",this._onWheel),this._el.removeEventListener("mousewheel",this._onWheel),this._enabled=!1)},ScrollZoomHandler.prototype._onWheel=function(e){var t=0;"wheel"===e.type?(t=e.deltaY,firefox&&e.deltaMode===window.WheelEvent.DOM_DELTA_PIXEL&&(t/=browser.devicePixelRatio),e.deltaMode===window.WheelEvent.DOM_DELTA_LINE&&(t*=40)):"mousewheel"===e.type&&(t=-e.wheelDeltaY,safari&&(t/=3));var o=browser.now(),i=o-(this._time||0);this._pos=DOM.mousePos(this._el,e),this._time=o,0!==t&&t%4.000244140625==0?this._type="wheel":0!==t&&Math.abs(t)<4?this._type="trackpad":i>400?(this._type=null,this._lastValue=t,this._timeout=setTimeout(this._onTimeout,40)):this._type||(this._type=Math.abs(i*t)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,t+=this._lastValue)),e.shiftKey&&t&&(t/=4),this._type&&this._zoom(-t,e),e.preventDefault()},ScrollZoomHandler.prototype._onTimeout=function(){this._type="wheel",this._zoom(-this._lastValue)},ScrollZoomHandler.prototype._zoom=function(e,t){if(0!==e){var o=this._map,i=2/(1+Math.exp(-Math.abs(e/100)));e<0&&0!==i&&(i=1/i);var l=o.ease?o.ease.to:o.transform.scale,s=o.transform.scaleZoom(l*i);o.zoomTo(s,{duration:"wheel"===this._type?200:0,around:this._aroundCenter?o.getCenter():o.unproject(this._pos),delayEndEvents:200,smoothEasing:!0},{originalEvent:t})}},module.exports=ScrollZoomHandler; -},{"../../util/browser":231,"../../util/dom":238,"../../util/util":252,"../../util/window":233}],224:[function(_dereq_,module,exports){ -"use strict";var DOM=_dereq_("../../util/dom"),util=_dereq_("../../util/util"),window=_dereq_("../../util/window"),inertiaLinearity=.15,inertiaEasing=util.bezier(0,0,inertiaLinearity,1),inertiaDeceleration=12,inertiaMaxSpeed=2.5,significantScaleThreshold=.15,significantRotateThreshold=10,TouchZoomRotateHandler=function(t){this._map=t,this._el=t.getCanvasContainer(),util.bindAll(["_onStart","_onMove","_onEnd"],this)};TouchZoomRotateHandler.prototype.isEnabled=function(){return!!this._enabled},TouchZoomRotateHandler.prototype.enable=function(t){this.isEnabled()||(this._el.classList.add("mapboxgl-touch-zoom-rotate"),this._el.addEventListener("touchstart",this._onStart,!1),this._enabled=!0,this._aroundCenter=t&&"center"===t.around)},TouchZoomRotateHandler.prototype.disable=function(){this.isEnabled()&&(this._el.classList.remove("mapboxgl-touch-zoom-rotate"),this._el.removeEventListener("touchstart",this._onStart),this._enabled=!1)},TouchZoomRotateHandler.prototype.disableRotation=function(){this._rotationDisabled=!0},TouchZoomRotateHandler.prototype.enableRotation=function(){this._rotationDisabled=!1},TouchZoomRotateHandler.prototype._onStart=function(t){if(2===t.touches.length){var e=DOM.mousePos(this._el,t.touches[0]),o=DOM.mousePos(this._el,t.touches[1]);this._startVec=e.sub(o),this._startScale=this._map.transform.scale,this._startBearing=this._map.transform.bearing,this._gestureIntent=void 0,this._inertia=[],window.document.addEventListener("touchmove",this._onMove,!1),window.document.addEventListener("touchend",this._onEnd,!1)}},TouchZoomRotateHandler.prototype._onMove=function(t){if(2===t.touches.length){var e=DOM.mousePos(this._el,t.touches[0]),o=DOM.mousePos(this._el,t.touches[1]),i=e.add(o).div(2),n=e.sub(o),a=n.mag()/this._startVec.mag(),r=this._rotationDisabled?0:180*n.angleWith(this._startVec)/Math.PI,s=this._map;if(this._gestureIntent){var h={duration:0,around:s.unproject(i)};"rotate"===this._gestureIntent&&(h.bearing=this._startBearing+r),"zoom"!==this._gestureIntent&&"rotate"!==this._gestureIntent||(h.zoom=s.transform.scaleZoom(this._startScale*a)),s.stop(),this._drainInertiaBuffer(),this._inertia.push([Date.now(),a,i]),s.easeTo(h,{originalEvent:t})}else{var u=Math.abs(1-a)>significantScaleThreshold;Math.abs(r)>significantRotateThreshold?this._gestureIntent="rotate":u&&(this._gestureIntent="zoom"),this._gestureIntent&&(this._startVec=n,this._startScale=s.transform.scale,this._startBearing=s.transform.bearing)}t.preventDefault()}},TouchZoomRotateHandler.prototype._onEnd=function(t){window.document.removeEventListener("touchmove",this._onMove),window.document.removeEventListener("touchend",this._onEnd),this._drainInertiaBuffer();var e=this._inertia,o=this._map;if(e.length<2)return void o.snapToNorth({},{originalEvent:t});var i=e[e.length-1],n=e[0],a=o.transform.scaleZoom(this._startScale*i[1]),r=o.transform.scaleZoom(this._startScale*n[1]),s=a-r,h=(i[0]-n[0])/1e3,u=i[2];if(0===h||a===r)return void o.snapToNorth({},{originalEvent:t});var l=s*inertiaLinearity/h;Math.abs(l)>inertiaMaxSpeed&&(l=l>0?inertiaMaxSpeed:-inertiaMaxSpeed);var d=1e3*Math.abs(l/(inertiaDeceleration*inertiaLinearity)),c=a+l*d/2e3;c<0&&(c=0),o.easeTo({zoom:c,duration:d,easing:inertiaEasing,around:this._aroundCenter?o.getCenter():o.unproject(u)},{originalEvent:t})},TouchZoomRotateHandler.prototype._drainInertiaBuffer=function(){for(var t=this._inertia,e=Date.now();t.length>2&&e-t[0][0]>160;)t.shift()},module.exports=TouchZoomRotateHandler; -},{"../../util/dom":238,"../../util/util":252,"../../util/window":233}],225:[function(_dereq_,module,exports){ -"use strict";var util=_dereq_("../util/util"),window=_dereq_("../util/window"),Hash=function(){util.bindAll(["_onHashChange","_updateHash"],this)};Hash.prototype.addTo=function(t){return this._map=t,window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},Hash.prototype.remove=function(){return window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),delete this._map,this},Hash.prototype.getHashString=function(t){var a=this._map.getCenter(),h=Math.round(100*this._map.getZoom())/100,e=Math.max(0,Math.ceil(Math.log(h)/Math.LN2)),n=Math.round(a.lng*Math.pow(10,e))/Math.pow(10,e),o=Math.round(a.lat*Math.pow(10,e))/Math.pow(10,e),i=this._map.getBearing(),s=this._map.getPitch(),r="";return r+=t?"#/"+n+"/"+o+"/"+h:"#"+h+"/"+o+"/"+n,(i||s)&&(r+="/"+Math.round(10*i)/10),s&&(r+="/"+Math.round(s)),r},Hash.prototype._onHashChange=function(){var t=window.location.hash.replace("#","").split("/");return t.length>=3&&(this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:+(t[3]||0),pitch:+(t[4]||0)}),!0)},Hash.prototype._updateHash=function(){var t=this.getHashString();window.history.replaceState("","",t)},module.exports=Hash; -},{"../util/util":252,"../util/window":233}],226:[function(_dereq_,module,exports){ -"use strict";function removeNode(t){t.parentNode&&t.parentNode.removeChild(t)}var util=_dereq_("../util/util"),browser=_dereq_("../util/browser"),window=_dereq_("../util/window"),ref=_dereq_("../util/window"),HTMLImageElement=ref.HTMLImageElement,DOM=_dereq_("../util/dom"),ajax=_dereq_("../util/ajax"),Style=_dereq_("../style/style"),AnimationLoop=_dereq_("../style/animation_loop"),Painter=_dereq_("../render/painter"),Transform=_dereq_("../geo/transform"),Hash=_dereq_("./hash"),bindHandlers=_dereq_("./bind_handlers"),Camera=_dereq_("./camera"),LngLat=_dereq_("../geo/lng_lat"),LngLatBounds=_dereq_("../geo/lng_lat_bounds"),Point=_dereq_("@mapbox/point-geometry"),AttributionControl=_dereq_("./control/attribution_control"),LogoControl=_dereq_("./control/logo_control"),isSupported=_dereq_("mapbox-gl-supported");_dereq_("./events");var defaultMinZoom=0,defaultMaxZoom=22,defaultOptions={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:defaultMinZoom,maxZoom:defaultMaxZoom,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,bearingSnap:7,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,transformRequest:null},Map=function(t){function e(e){var o=this;if(e=util.extend({},defaultOptions,e),null!=e.minZoom&&null!=e.maxZoom&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than minZoom");var r=new Transform(e.minZoom,e.maxZoom,e.renderWorldCopies);t.call(this,r,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;var i=e.transformRequest;if(this._transformRequest=i?function(t,e){return i(t,e)||{url:t}}:function(t){return{url:t}},"string"==typeof e.container){var n=window.document.getElementById(e.container);if(!n)throw new Error("Container '"+e.container+"' not found.");this._container=n}else this._container=e.container;this.animationLoop=new AnimationLoop,e.maxBounds&&this.setMaxBounds(e.maxBounds),util.bindAll(["_onWindowOnline","_onWindowResize","_contextLost","_contextRestored","_update","_render","_onData","_onDataLoading"],this),this._setupContainer(),this._setupPainter(),this.on("move",this._update.bind(this,!1)),this.on("zoom",this._update.bind(this,!0)),this.on("moveend",function(){o.animationLoop.set(300),o._rerender()}),void 0!==window&&(window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1)),bindHandlers(this,e),this._hash=e.hash&&(new Hash).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 AttributionControl),this.addControl(new LogoControl,e.logoPosition),this.on("style.load",function(){this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this.style.update({transition:!1})}),this.on("data",this._onData),this.on("dataloading",this._onDataLoading)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var o={showTileBoundaries:{},showCollisionBoxes:{},showOverdrawInspector:{},repaint:{},vertices:{}};return e.prototype.addControl=function(t,e){void 0===e&&t.getDefaultPosition&&(e=t.getDefaultPosition()),void 0===e&&(e="top-right");var o=t.onAdd(this),r=this._controlPositions[e];return-1!==e.indexOf("bottom")?r.insertBefore(o,r.firstChild):r.appendChild(o),this},e.prototype.removeControl=function(t){return t.onRemove(this),this},e.prototype.resize=function(){var t=this._containerDimensions(),e=t[0],o=t[1];return this._resizeCanvas(e,o),this.transform.resize(e,o),this.painter.resize(e,o),this.fire("movestart").fire("move").fire("resize").fire("moveend")},e.prototype.getBounds=function(){var t=new LngLatBounds(this.transform.pointLocation(new Point(0,this.transform.height)),this.transform.pointLocation(new Point(this.transform.width,0)));return(this.transform.angle||this.transform.pitch)&&(t.extend(this.transform.pointLocation(new Point(this.transform.size.x,0))),t.extend(this.transform.pointLocation(new Point(0,this.transform.size.y)))),t},e.prototype.getMaxBounds=function(){return this.transform.latRange&&2===this.transform.latRange.length&&this.transform.lngRange&&2===this.transform.lngRange.length?new LngLatBounds([this.transform.lngRange[0],this.transform.latRange[0]],[this.transform.lngRange[1],this.transform.latRange[1]]):null},e.prototype.setMaxBounds=function(t){if(t){var e=LngLatBounds.convert(t);this.transform.lngRange=[e.getWest(),e.getEast()],this.transform.latRange=[e.getSouth(),e.getNorth()],this.transform._constrain(),this._update()}else null!==t&&void 0!==t||(this.transform.lngRange=null,this.transform.latRange=null,this._update());return this},e.prototype.setMinZoom=function(t){if((t=null===t||void 0===t?defaultMinZoom:t)>=defaultMinZoom&&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")},e.prototype.getMaxZoom=function(){return this.transform.maxZoom},e.prototype.project=function(t){return this.transform.locationPoint(LngLat.convert(t))},e.prototype.unproject=function(t){return this.transform.pointLocation(Point.convert(t))},e.prototype.on=function(e,o,r){var i=this;if(void 0===r)return t.prototype.on.call(this,e,o);var n=function(){if("mouseenter"===e||"mouseover"===e){var t=!1;return{layer:o,listener:r,delegates:{mousemove:function(n){var s=i.getLayer(o)?i.queryRenderedFeatures(n.point,{layers:[o]}):[];s.length?t||(t=!0,r.call(i,util.extend({features:s},n,{type:e}))):t=!1},mouseout:function(){t=!1}}}}if("mouseleave"===e||"mouseout"===e){var n=!1;return{layer:o,listener:r,delegates:{mousemove:function(t){(i.getLayer(o)?i.queryRenderedFeatures(t.point,{layers:[o]}):[]).length?n=!0:n&&(n=!1,r.call(i,util.extend({},t,{type:e})))},mouseout:function(t){n&&(n=!1,r.call(i,util.extend({},t,{type:e})))}}}}var s=function(t){var e=i.getLayer(o)?i.queryRenderedFeatures(t.point,{layers:[o]}):[];e.length&&r.call(i,util.extend({features:e},t))};return{layer:o,listener:r,delegates:(a={},a[e]=s,a)};var a}();this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(n);for(var s in n.delegates)i.on(s,n.delegates[s]);return this},e.prototype.off=function(e,o,r){var i=this;if(void 0===r)return t.prototype.off.call(this,e,o);if(this._delegatedListeners&&this._delegatedListeners[e])for(var n=this._delegatedListeners[e],s=0;s400?(this._type=null,this._lastValue=e,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(o*e)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,e+=this._lastValue)),t.shiftKey&&e&&(e/=4),this._type&&(this._lastWheelEvent=t,this._delta-=e,this.isActive()||this._start(t)),t.preventDefault()},ScrollZoomHandler.prototype._onTimeout=function(t){this._type="wheel",this._delta-=this._lastValue,this.isActive()||this._start(t)},ScrollZoomHandler.prototype._start=function(t){if(this._delta){this._active=!0,this._map.moving=!0,this._map.zooming=!0,this._map.fire("movestart",{originalEvent:t}),this._map.fire("zoomstart",{originalEvent:t}),clearTimeout(this._finishTimeout);var e=DOM.mousePos(this._el,t);this._around=LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(e)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._map._startAnimation(this._onScrollFrame,this._onScrollFinished)}},ScrollZoomHandler.prototype._onScrollFrame=function(t){if(this.isActive()){if(0!==this._delta){var e="wheel"===this._type&&Math.abs(this._delta)>wheelZoomDelta?wheelZoomRate:defaultZoomRate,i=maxScalePerFrame/(1+Math.exp(-Math.abs(this._delta*e)));this._delta<0&&0!==i&&(i=1/i);var o="number"==typeof this._targetZoom?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(o*i))),"wheel"===this._type&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}if("wheel"===this._type){var a=Math.min((browser.now()-this._lastWheelEventTime)/200,1),s=this._easing(a);t.zoom=interpolate(this._startZoom,this._targetZoom,s),1===a&&this._map.stop()}else t.zoom=this._targetZoom,this._map.stop();t.setLocationAtPoint(this._around,this._aroundPoint),this._map.fire("move",{originalEvent:this._lastWheelEvent}),this._map.fire("zoom",{originalEvent:this._lastWheelEvent})}},ScrollZoomHandler.prototype._onScrollFinished=function(){var t=this;this.isActive()&&(this._active=!1,this._finishTimeout=setTimeout(function(){t._map.moving=!1,t._map.zooming=!1,t._map.fire("zoomend"),t._map.fire("moveend"),delete t._targetZoom},200))},ScrollZoomHandler.prototype._smoothOutEasing=function(t){var e=util.ease;if(this._prevEase){var i=this._prevEase,o=(browser.now()-i.start)/i.duration,a=i.easing(o+.01)-i.easing(o),s=.27/Math.sqrt(a*a+1e-4)*.01,r=Math.sqrt(.0729-s*s);e=util.bezier(s,r,.25,1)}return this._prevEase={start:browser.now(),duration:t,easing:e},e},module.exports=ScrollZoomHandler; +},{"../../geo/lng_lat":62,"../../style-spec/util/interpolate":158,"../../util/browser":252,"../../util/dom":259,"../../util/util":275,"../../util/window":254}],245:[function(_dereq_,module,exports){ +"use strict";var DOM=_dereq_("../../util/dom"),util=_dereq_("../../util/util"),window=_dereq_("../../util/window"),browser=_dereq_("../../util/browser"),inertiaLinearity=.15,inertiaEasing=util.bezier(0,0,inertiaLinearity,1),inertiaDeceleration=12,inertiaMaxSpeed=2.5,significantScaleThreshold=.15,significantRotateThreshold=10,TouchZoomRotateHandler=function(t){this._map=t,this._el=t.getCanvasContainer(),util.bindAll(["_onStart","_onMove","_onEnd"],this)};TouchZoomRotateHandler.prototype.isEnabled=function(){return!!this._enabled},TouchZoomRotateHandler.prototype.enable=function(t){this.isEnabled()||(this._el.classList.add("mapboxgl-touch-zoom-rotate"),this._el.addEventListener("touchstart",this._onStart,!1),this._enabled=!0,this._aroundCenter=t&&"center"===t.around)},TouchZoomRotateHandler.prototype.disable=function(){this.isEnabled()&&(this._el.classList.remove("mapboxgl-touch-zoom-rotate"),this._el.removeEventListener("touchstart",this._onStart),this._enabled=!1)},TouchZoomRotateHandler.prototype.disableRotation=function(){this._rotationDisabled=!0},TouchZoomRotateHandler.prototype.enableRotation=function(){this._rotationDisabled=!1},TouchZoomRotateHandler.prototype._onStart=function(t){if(2===t.touches.length){var e=DOM.mousePos(this._el,t.touches[0]),o=DOM.mousePos(this._el,t.touches[1]);this._startVec=e.sub(o),this._startScale=this._map.transform.scale,this._startBearing=this._map.transform.bearing,this._gestureIntent=void 0,this._inertia=[],window.document.addEventListener("touchmove",this._onMove,!1),window.document.addEventListener("touchend",this._onEnd,!1)}},TouchZoomRotateHandler.prototype._onMove=function(t){if(2===t.touches.length){var e=DOM.mousePos(this._el,t.touches[0]),o=DOM.mousePos(this._el,t.touches[1]),i=e.add(o).div(2),n=e.sub(o),a=n.mag()/this._startVec.mag(),r=this._rotationDisabled?0:180*n.angleWith(this._startVec)/Math.PI,s=this._map;if(this._gestureIntent){var h={duration:0,around:s.unproject(i)};"rotate"===this._gestureIntent&&(h.bearing=this._startBearing+r),"zoom"!==this._gestureIntent&&"rotate"!==this._gestureIntent||(h.zoom=s.transform.scaleZoom(this._startScale*a)),s.stop(),this._drainInertiaBuffer(),this._inertia.push([browser.now(),a,i]),s.easeTo(h,{originalEvent:t})}else{var u=Math.abs(1-a)>significantScaleThreshold;Math.abs(r)>significantRotateThreshold?this._gestureIntent="rotate":u&&(this._gestureIntent="zoom"),this._gestureIntent&&(this._startVec=n,this._startScale=s.transform.scale,this._startBearing=s.transform.bearing)}t.preventDefault()}},TouchZoomRotateHandler.prototype._onEnd=function(t){window.document.removeEventListener("touchmove",this._onMove),window.document.removeEventListener("touchend",this._onEnd),this._drainInertiaBuffer();var e=this._inertia,o=this._map;if(e.length<2)return void o.snapToNorth({},{originalEvent:t});var i=e[e.length-1],n=e[0],a=o.transform.scaleZoom(this._startScale*i[1]),r=o.transform.scaleZoom(this._startScale*n[1]),s=a-r,h=(i[0]-n[0])/1e3,u=i[2];if(0===h||a===r)return void o.snapToNorth({},{originalEvent:t});var l=s*inertiaLinearity/h;Math.abs(l)>inertiaMaxSpeed&&(l=l>0?inertiaMaxSpeed:-inertiaMaxSpeed);var d=1e3*Math.abs(l/(inertiaDeceleration*inertiaLinearity)),c=a+l*d/2e3;c<0&&(c=0),o.easeTo({zoom:c,duration:d,easing:inertiaEasing,around:this._aroundCenter?o.getCenter():o.unproject(u)},{originalEvent:t})},TouchZoomRotateHandler.prototype._drainInertiaBuffer=function(){for(var t=this._inertia,e=browser.now();t.length>2&&e-t[0][0]>160;)t.shift()},module.exports=TouchZoomRotateHandler; +},{"../../util/browser":252,"../../util/dom":259,"../../util/util":275,"../../util/window":254}],246:[function(_dereq_,module,exports){ +"use strict";var util=_dereq_("../util/util"),window=_dereq_("../util/window"),throttle=_dereq_("../util/throttle"),Hash=function(){util.bindAll(["_onHashChange","_updateHash"],this),this._updateHash=throttle(this._updateHashUnthrottled.bind(this),300)};Hash.prototype.addTo=function(t){return this._map=t,window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},Hash.prototype.remove=function(){return window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),delete this._map,this},Hash.prototype.getHashString=function(t){var e=this._map.getCenter(),h=Math.round(100*this._map.getZoom())/100,a=Math.ceil((h*Math.LN2+Math.log(512/360/.5))/Math.LN10),n=Math.pow(10,a),i=Math.round(e.lng*n)/n,o=Math.round(e.lat*n)/n,s=this._map.getBearing(),r=this._map.getPitch(),u="";return u+=t?"#/"+i+"/"+o+"/"+h:"#"+h+"/"+o+"/"+i,(s||r)&&(u+="/"+Math.round(10*s)/10),r&&(u+="/"+Math.round(r)),u},Hash.prototype._onHashChange=function(){var t=window.location.hash.replace("#","").split("/");return t.length>=3&&(this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:+(t[3]||0),pitch:+(t[4]||0)}),!0)},Hash.prototype._updateHashUnthrottled=function(){var t=this.getHashString();window.history.replaceState("","",t)},module.exports=Hash; +},{"../util/throttle":272,"../util/util":275,"../util/window":254}],247:[function(_dereq_,module,exports){ +"use strict";function removeNode(t){t.parentNode&&t.parentNode.removeChild(t)}var util=_dereq_("../util/util"),browser=_dereq_("../util/browser"),window=_dereq_("../util/window"),ref=_dereq_("../util/window"),HTMLImageElement=ref.HTMLImageElement,HTMLElement=ref.HTMLElement,DOM=_dereq_("../util/dom"),ajax=_dereq_("../util/ajax"),Style=_dereq_("../style/style"),EvaluationParameters=_dereq_("../style/evaluation_parameters"),Painter=_dereq_("../render/painter"),Transform=_dereq_("../geo/transform"),Hash=_dereq_("./hash"),bindHandlers=_dereq_("./bind_handlers"),Camera=_dereq_("./camera"),LngLat=_dereq_("../geo/lng_lat"),LngLatBounds=_dereq_("../geo/lng_lat_bounds"),Point=_dereq_("@mapbox/point-geometry"),AttributionControl=_dereq_("./control/attribution_control"),LogoControl=_dereq_("./control/logo_control"),isSupported=_dereq_("@mapbox/mapbox-gl-supported"),ref$1=_dereq_("../util/image"),RGBAImage=ref$1.RGBAImage;_dereq_("./events");var defaultMinZoom=0,defaultMaxZoom=22,defaultOptions={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:defaultMinZoom,maxZoom:defaultMaxZoom,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,bearingSnap:7,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,transformRequest:null,fadeDuration:300},Map=function(t){function e(e){if(e=util.extend({},defaultOptions,e),null!=e.minZoom&&null!=e.maxZoom&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than minZoom");var r=new Transform(e.minZoom,e.maxZoom,e.renderWorldCopies);t.call(this,r,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._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming;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 i=window.document.getElementById(e.container);if(!i)throw new Error("Container '"+e.container+"' not found.");this._container=i}else{if(!(e.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}e.maxBounds&&this.setMaxBounds(e.maxBounds),util.bindAll(["_onWindowOnline","_onWindowResize","_contextLost","_contextRestored","_update","_render","_onData","_onDataLoading"],this),this._setupContainer(),this._setupPainter(),this.on("move",this._update.bind(this,!1)),this.on("zoom",this._update.bind(this,!0)),void 0!==window&&(window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1)),bindHandlers(this,e),this._hash=e.hash&&(new Hash).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 AttributionControl),this.addControl(new LogoControl,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)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={showTileBoundaries:{},showCollisionBoxes:{},showOverdrawInspector:{},repaint:{},vertices:{}};return e.prototype.addControl=function(t,e){void 0===e&&t.getDefaultPosition&&(e=t.getDefaultPosition()),void 0===e&&(e="top-right");var r=t.onAdd(this),o=this._controlPositions[e];return-1!==e.indexOf("bottom")?o.insertBefore(r,o.firstChild):o.appendChild(r),this},e.prototype.removeControl=function(t){return t.onRemove(this),this},e.prototype.resize=function(){var t=this._containerDimensions(),e=t[0],r=t[1];return this._resizeCanvas(e,r),this.transform.resize(e,r),this.painter.resize(e,r),this.fire("movestart").fire("move").fire("resize").fire("moveend")},e.prototype.getBounds=function(){var t=new LngLatBounds(this.transform.pointLocation(new Point(0,this.transform.height)),this.transform.pointLocation(new Point(this.transform.width,0)));return(this.transform.angle||this.transform.pitch)&&(t.extend(this.transform.pointLocation(new Point(this.transform.size.x,0))),t.extend(this.transform.pointLocation(new Point(0,this.transform.size.y)))),t},e.prototype.getMaxBounds=function(){return this.transform.latRange&&2===this.transform.latRange.length&&this.transform.lngRange&&2===this.transform.lngRange.length?new LngLatBounds([this.transform.lngRange[0],this.transform.latRange[0]],[this.transform.lngRange[1],this.transform.latRange[1]]):null},e.prototype.setMaxBounds=function(t){if(t){var e=LngLatBounds.convert(t);this.transform.lngRange=[e.getWest(),e.getEast()],this.transform.latRange=[e.getSouth(),e.getNorth()],this.transform._constrain(),this._update()}else null!==t&&void 0!==t||(this.transform.lngRange=null,this.transform.latRange=null,this._update());return this},e.prototype.setMinZoom=function(t){if((t=null===t||void 0===t?defaultMinZoom:t)>=defaultMinZoom&&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")},e.prototype.getMaxZoom=function(){return this.transform.maxZoom},e.prototype.project=function(t){return this.transform.locationPoint(LngLat.convert(t))},e.prototype.unproject=function(t){return this.transform.pointLocation(Point.convert(t))},e.prototype.on=function(e,r,o){var i=this;if(void 0===o)return t.prototype.on.call(this,e,r);var n=function(){if("mouseenter"===e||"mouseover"===e){var t=!1;return{layer:r,listener:o,delegates:{mousemove:function(n){var s=i.getLayer(r)?i.queryRenderedFeatures(n.point,{layers:[r]}):[];s.length?t||(t=!0,o.call(i,util.extend({features:s},n,{type:e}))):t=!1},mouseout:function(){t=!1}}}}if("mouseleave"===e||"mouseout"===e){var n=!1;return{layer:r,listener:o,delegates:{mousemove:function(t){(i.getLayer(r)?i.queryRenderedFeatures(t.point,{layers:[r]}):[]).length?n=!0:n&&(n=!1,o.call(i,util.extend({},t,{type:e})))},mouseout:function(t){n&&(n=!1,o.call(i,util.extend({},t,{type:e})))}}}}var s=function(t){var e=i.getLayer(r)?i.queryRenderedFeatures(t.point,{layers:[r]}):[];e.length&&o.call(i,util.extend({features:e},t))};return{layer:r,listener:o,delegates:(a={},a[e]=s,a)};var a}();this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(n);for(var s in n.delegates)i.on(s,n.delegates[s]);return this},e.prototype.off=function(e,r,o){var i=this;if(void 0===o)return t.prototype.off.call(this,e,r);if(this._delegatedListeners&&this._delegatedListeners[e])for(var n=this._delegatedListeners[e],s=0;sthis._map.transform.height-i?["bottom"]:[],t.xthis._map.transform.width-n/2&&o.push("right"),o=0===o.length?"bottom":o.join("-")}var r=t.add(e[o]).round(),s={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%)"},p=this._container.classList;for(var a in s)p.remove("mapboxgl-popup-anchor-"+a);p.add("mapboxgl-popup-anchor-"+o),DOM.setTransform(this._container,s[o]+" translate("+r.x+"px,"+r.y+"px)")}},o.prototype._onClickClose=function(){this.remove()},o}(Evented);module.exports=Popup; -},{"../geo/lng_lat":68,"../util/dom":238,"../util/evented":239,"../util/smart_wrap":248,"../util/util":252,"../util/window":233,"@mapbox/point-geometry":2}],229:[function(_dereq_,module,exports){ -"use strict";var util=_dereq_("./util"),Actor=function(t,e,r){this.target=t,this.parent=e,this.mapId=r,this.callbacks={},this.callbackID=0,util.bindAll(["receive"],this),this.target.addEventListener("message",this.receive,!1)};Actor.prototype.send=function(t,e,r,a,i){var s=r?this.mapId+":"+this.callbackID++:null;r&&(this.callbacks[s]=r),this.target.postMessage({targetMapId:i,sourceMapId:this.mapId,type:t,id:String(s),data:e},a)},Actor.prototype.receive=function(t){var e,r=this,a=t.data,i=a.id;if(!a.targetMapId||this.mapId===a.targetMapId){var s=function(t,e,a){r.target.postMessage({sourceMapId:r.mapId,type:"",id:String(i),error:t?String(t):null,data:e},a)};if(""===a.type)e=this.callbacks[a.id],delete this.callbacks[a.id],e&&a.error?e(new Error(a.error)):e&&e(null,a.data);else if(void 0!==a.id&&this.parent[a.type])this.parent[a.type](a.sourceMapId,a.data,s);else if(void 0!==a.id&&this.parent.getWorkerSource){var o=a.type.split("."),p=this.parent.getWorkerSource(a.sourceMapId,o[0]);p[o[1]](a.data,s)}else this.parent[a.type](a.data)}},Actor.prototype.remove=function(){this.target.removeEventListener("message",this.receive,!1)},module.exports=Actor; -},{"./util":252}],230:[function(_dereq_,module,exports){ +},{"../geo/lng_lat":62,"../util/dom":259,"../util/evented":260,"../util/smart_wrap":270,"../util/util":275,"../util/window":254,"@mapbox/point-geometry":4}],250:[function(_dereq_,module,exports){ +"use strict";var util=_dereq_("./util"),ref=_dereq_("./web_worker_transfer"),serialize=ref.serialize,deserialize=ref.deserialize,Actor=function(e,t,r){this.target=e,this.parent=t,this.mapId=r,this.callbacks={},this.callbackID=0,util.bindAll(["receive"],this),this.target.addEventListener("message",this.receive,!1)};Actor.prototype.send=function(e,t,r,i){var a=r?this.mapId+":"+this.callbackID++:null;r&&(this.callbacks[a]=r);var s=[];this.target.postMessage({targetMapId:i,sourceMapId:this.mapId,type:e,id:String(a),data:serialize(t,s)},s)},Actor.prototype.receive=function(e){var t,r=this,i=e.data,a=i.id;if(!i.targetMapId||this.mapId===i.targetMapId){var s=function(e,t){var i=[];r.target.postMessage({sourceMapId:r.mapId,type:"",id:String(a),error:e?String(e):null,data:serialize(t,i)},i)};if(""===i.type)t=this.callbacks[i.id],delete this.callbacks[i.id],t&&i.error?t(new Error(i.error)):t&&t(null,deserialize(i.data));else if(void 0!==i.id&&this.parent[i.type])this.parent[i.type](i.sourceMapId,deserialize(i.data),s);else if(void 0!==i.id&&this.parent.getWorkerSource){var d=i.type.split("."),l=this.parent.getWorkerSource(i.sourceMapId,d[0]);l[d[1]](deserialize(i.data),s)}else this.parent[i.type](deserialize(i.data))}},Actor.prototype.remove=function(){this.target.removeEventListener("message",this.receive,!1)},module.exports=Actor; +},{"./util":275,"./web_worker_transfer":278}],251:[function(_dereq_,module,exports){ "use strict";function makeRequest(e){var t=new window.XMLHttpRequest;t.open("GET",e.url,!0);for(var r in e.headers)t.setRequestHeader(r,e.headers[r]);return t.withCredentials="include"===e.credentials,t}function sameOrigin(e){var t=window.document.createElement("a");return t.href=e,t.protocol===window.document.location.protocol&&t.host===window.document.location.host}var window=_dereq_("./window"),ResourceType={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};exports.ResourceType=ResourceType,"function"==typeof Object.freeze&&Object.freeze(ResourceType);var AJAXError=function(e){function t(t,r){e.call(this,t),this.status=r}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(Error);exports.getJSON=function(e,t){var r=makeRequest(e);return r.setRequestHeader("Accept","application/json"),r.onerror=function(){t(new Error(r.statusText))},r.onload=function(){if(r.status>=200&&r.status<300&&r.response){var e;try{e=JSON.parse(r.response)}catch(e){return t(e)}t(null,e)}else t(new AJAXError(r.statusText,r.status))},r.send(),r},exports.getArrayBuffer=function(e,t){var r=makeRequest(e);return r.responseType="arraybuffer",r.onerror=function(){t(new Error(r.statusText))},r.onload=function(){var e=r.response;if(0===e.byteLength&&200===r.status)return t(new Error("http status 200 returned without content."));r.status>=200&&r.status<300&&r.response?t(null,{data:e,cacheControl:r.getResponseHeader("Cache-Control"),expires:r.getResponseHeader("Expires")}):t(new AJAXError(r.statusText,r.status))},r.send(),r};var transparentPngUrl="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";exports.getImage=function(e,t){return exports.getArrayBuffer(e,function(e,r){if(e)t(e);else if(r){var n=new window.Image,o=window.URL||window.webkitURL;n.onload=function(){t(null,n),o.revokeObjectURL(n.src)};var s=new window.Blob([new Uint8Array(r.data)],{type:"image/png"});n.cacheControl=r.cacheControl,n.expires=r.expires,n.src=r.data.byteLength?o.createObjectURL(s):transparentPngUrl}})},exports.getVideo=function(e,t){var r=window.document.createElement("video");r.onloadstart=function(){t(null,r)};for(var n=0;n=o+n?e.call(t,1):(e.call(t,(r-o)/n),frame(a))}}if(!n)return e.call(t,1),null;var i=!1,o=now();return frame(a),function(){i=!0}},getImageData:function(e){var n=window.document.createElement("canvas"),t=n.getContext("2d");if(!t)throw new Error("failed to create canvas 2d context");return n.width=e.width,n.height=e.height,t.drawImage(e,0,0,e.width,e.height),t.getImageData(0,0,e.width,e.height)},hardwareConcurrency:window.navigator.hardwareConcurrency||4,get devicePixelRatio(){return window.devicePixelRatio},supportsWebp:!1};var webpImgTest=window.document.createElement("img");webpImgTest.onload=function(){module.exports.supportsWebp=!0},webpImgTest.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="; -},{"./window":233}],232:[function(_dereq_,module,exports){ +},{"./window":254}],252:[function(_dereq_,module,exports){ +"use strict";var window=_dereq_("./window"),now=window.performance&&window.performance.now?window.performance.now.bind(window.performance):Date.now.bind(Date),frame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame,cancel=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame;module.exports={now:now,frame:function(e){return frame(e)},cancelFrame:function(e){return cancel(e)},getImageData:function(e){var n=window.document.createElement("canvas"),t=n.getContext("2d");if(!t)throw new Error("failed to create canvas 2d context");return n.width=e.width,n.height=e.height,t.drawImage(e,0,0,e.width,e.height),t.getImageData(0,0,e.width,e.height)},hardwareConcurrency:window.navigator.hardwareConcurrency||4,get devicePixelRatio(){return window.devicePixelRatio},supportsWebp:!1};var webpImgTest=window.document.createElement("img");webpImgTest.onload=function(){module.exports.supportsWebp=!0},webpImgTest.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="; +},{"./window":254}],253:[function(_dereq_,module,exports){ "use strict";var WebWorkify=_dereq_("webworkify"),window=_dereq_("../window"),workerURL=window.URL.createObjectURL(new WebWorkify(_dereq_("../../source/worker"),{bare:!0}));module.exports=function(){return new window.Worker(workerURL)}; -},{"../../source/worker":117,"../window":233,"webworkify":48}],233:[function(_dereq_,module,exports){ +},{"../../source/worker":118,"../window":254,"webworkify":36}],254:[function(_dereq_,module,exports){ "use strict";module.exports=self; -},{}],234:[function(_dereq_,module,exports){ +},{}],255:[function(_dereq_,module,exports){ "use strict";function compareAreas(e,r){return r.area-e.area}var quickselect=_dereq_("quickselect"),calculateSignedArea=_dereq_("./util").calculateSignedArea;module.exports=function(e,r){var a=e.length;if(a<=1)return[e];for(var t,u,c=[],i=0;i1)for(var n=0;n0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)},Evented.prototype.setEventedParent=function(e,t){return this._eventedParent=e,this._eventedParentData=t,this},module.exports=Evented; -},{"./util":252}],240:[function(_dereq_,module,exports){ +},{}],258:[function(_dereq_,module,exports){ +"use strict";var util=_dereq_("./util"),Actor=_dereq_("./actor"),Dispatcher=function(t,r){var o=this;this.workerPool=t,this.actors=[],this.currentActor=0,this.id=util.uniqueId();for(var i=this.workerPool.acquire(this.id),e=0;e0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)},Evented.prototype.setEventedParent=function(e,t){return this._eventedParent=e,this._eventedParentData=t,this},module.exports=Evented; +},{"./util":275}],261:[function(_dereq_,module,exports){ "use strict";function compareMax(e,t){return t.max-e.max}function Cell(e,t,n,o){this.p=new Point(e,t),this.h=n,this.d=pointToPolygonDist(this.p,o),this.max=this.d+this.h*Math.SQRT2}function pointToPolygonDist(e,t){for(var n=!1,o=1/0,r=0;re.y!=p.y>e.y&&e.x<(p.x-s.x)*(e.y-s.y)/(p.y-s.y)+s.x&&(n=!n),o=Math.min(o,distToSegmentSquared(e,s,p))}return(n?1:-1)*Math.sqrt(o)}function getCentroidCell(e){for(var t=0,n=0,o=0,r=e[0],i=0,l=r.length,u=l-1;ii)&&(i=s.x),(!a||s.y>l)&&(l=s.y)}var p=i-o,h=l-r,d=Math.min(p,h),x=d/2,y=new Queue(null,compareMax);if(0===d)return new Point(o,r);for(var g=o;gm.d||!m.d)&&(m=c,n&&console.log("found best %d after %d probes",Math.round(1e4*c.d)/1e4,v)),c.max-m.d<=t||(x=c.h/2,y.push(new Cell(c.p.x-x,c.p.y-x,x,e)),y.push(new Cell(c.p.x+x,c.p.y-x,x,e)),y.push(new Cell(c.p.x-x,c.p.y+x,x,e)),y.push(new Cell(c.p.x+x,c.p.y+x,x,e)),v+=4)}return n&&(console.log("num probes: "+v),console.log("best distance: "+m.d)),m.p}; -},{"./intersection_tests":243,"@mapbox/point-geometry":2,"tinyqueue":42}],241:[function(_dereq_,module,exports){ +},{"./intersection_tests":264,"@mapbox/point-geometry":4,"tinyqueue":33}],262:[function(_dereq_,module,exports){ "use strict";var WorkerPool=_dereq_("./worker_pool"),globalWorkerPool;module.exports=function(){return globalWorkerPool||(globalWorkerPool=new WorkerPool),globalWorkerPool}; -},{"./worker_pool":255}],242:[function(_dereq_,module,exports){ -"use strict";function createImage(e,t,i){var h=e.width,a=e.height;if(i){if(i.length!==h*a*t)throw new RangeError("mismatched image size")}else i=new Uint8Array(h*a*t);return{width:h,height:a,data:i}}function resizeImage(e,t,i){var h=t.width,a=t.height;if(h===e.width&&a===e.height)return e;var r=createImage({width:h,height:a},i);copyImage(e,r,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,h),height:Math.min(e.height,a)},i),e.width=h,e.height=a,e.data=r.data}function copyImage(e,t,i,h,a,r){if(0===a.width||0===a.height)return t;if(a.width>e.width||a.height>e.height||i.x>e.width-a.width||i.y>e.height-a.height)throw new RangeError("out of range source coordinates for image copy");if(a.width>t.width||a.height>t.height||h.x>t.width-a.width||h.y>t.height-a.height)throw new RangeError("out of range destination coordinates for image copy");for(var g=e.data,n=t.data,o=0;oe.width||a.height>e.height||i.x>e.width-a.width||i.y>e.height-a.height)throw new RangeError("out of range source coordinates for image copy");if(a.width>t.width||a.height>t.height||h.x>t.width-a.width||h.y>t.height-a.height)throw new RangeError("out of range destination coordinates for image copy");for(var g=e.data,n=t.data,o=0;o=3)for(var u=0;u1){if(lineIntersectsLine(n,t))return!0;for(var r=0;r1?n.distSqr(e):n.distSqr(e.sub(t)._mult(o)._add(t))}function multiPolygonContainsPoint(n,t){for(var e,r,o,i=!1,l=0;lt.y!=o.y>t.y&&t.x<(o.x-r.x)*(t.y-r.y)/(o.y-r.y)+r.x&&(i=!i)}return i}function polygonContainsPoint(n,t){for(var e=!1,r=0,o=n.length-1;rt.y!=l.y>t.y&&t.x<(l.x-i.x)*(t.y-i.y)/(l.y-i.y)+i.x&&(e=!e)}return e}var ref=_dereq_("./util"),isCounterClockwise=ref.isCounterClockwise;module.exports={multiPolygonIntersectsBufferedMultiPoint:multiPolygonIntersectsBufferedMultiPoint,multiPolygonIntersectsMultiPolygon:multiPolygonIntersectsMultiPolygon,multiPolygonIntersectsBufferedMultiLine:multiPolygonIntersectsBufferedMultiLine,polygonIntersectsPolygon:polygonIntersectsPolygon,distToSegmentSquared:distToSegmentSquared}; -},{"./util":252}],244:[function(_dereq_,module,exports){ +},{"./util":275}],265:[function(_dereq_,module,exports){ "use strict";var unicodeBlockLookup={"Latin-1 Supplement":function(n){return n>=128&&n<=255},Arabic:function(n){return n>=1536&&n<=1791},"Arabic Supplement":function(n){return n>=1872&&n<=1919},"Arabic Extended-A":function(n){return n>=2208&&n<=2303},"Hangul Jamo":function(n){return n>=4352&&n<=4607},"Unified Canadian Aboriginal Syllabics":function(n){return n>=5120&&n<=5759},"Unified Canadian Aboriginal Syllabics Extended":function(n){return n>=6320&&n<=6399},"General Punctuation":function(n){return n>=8192&&n<=8303},"Letterlike Symbols":function(n){return n>=8448&&n<=8527},"Number Forms":function(n){return n>=8528&&n<=8591},"Miscellaneous Technical":function(n){return n>=8960&&n<=9215},"Control Pictures":function(n){return n>=9216&&n<=9279},"Optical Character Recognition":function(n){return n>=9280&&n<=9311},"Enclosed Alphanumerics":function(n){return n>=9312&&n<=9471},"Geometric Shapes":function(n){return n>=9632&&n<=9727},"Miscellaneous Symbols":function(n){return n>=9728&&n<=9983},"Miscellaneous Symbols and Arrows":function(n){return n>=11008&&n<=11263},"CJK Radicals Supplement":function(n){return n>=11904&&n<=12031},"Kangxi Radicals":function(n){return n>=12032&&n<=12255},"Ideographic Description Characters":function(n){return n>=12272&&n<=12287},"CJK Symbols and Punctuation":function(n){return n>=12288&&n<=12351},Hiragana:function(n){return n>=12352&&n<=12447},Katakana:function(n){return n>=12448&&n<=12543},Bopomofo:function(n){return n>=12544&&n<=12591},"Hangul Compatibility Jamo":function(n){return n>=12592&&n<=12687},Kanbun:function(n){return n>=12688&&n<=12703},"Bopomofo Extended":function(n){return n>=12704&&n<=12735},"CJK Strokes":function(n){return n>=12736&&n<=12783},"Katakana Phonetic Extensions":function(n){return n>=12784&&n<=12799},"Enclosed CJK Letters and Months":function(n){return n>=12800&&n<=13055},"CJK Compatibility":function(n){return n>=13056&&n<=13311},"CJK Unified Ideographs Extension A":function(n){return n>=13312&&n<=19903},"Yijing Hexagram Symbols":function(n){return n>=19904&&n<=19967},"CJK Unified Ideographs":function(n){return n>=19968&&n<=40959},"Yi Syllables":function(n){return n>=40960&&n<=42127},"Yi Radicals":function(n){return n>=42128&&n<=42191},"Hangul Jamo Extended-A":function(n){return n>=43360&&n<=43391},"Hangul Syllables":function(n){return n>=44032&&n<=55215},"Hangul Jamo Extended-B":function(n){return n>=55216&&n<=55295},"Private Use Area":function(n){return n>=57344&&n<=63743},"CJK Compatibility Ideographs":function(n){return n>=63744&&n<=64255},"Arabic Presentation Forms-A":function(n){return n>=64336&&n<=65023},"Vertical Forms":function(n){return n>=65040&&n<=65055},"CJK Compatibility Forms":function(n){return n>=65072&&n<=65103},"Small Form Variants":function(n){return n>=65104&&n<=65135},"Arabic Presentation Forms-B":function(n){return n>=65136&&n<=65279},"Halfwidth and Fullwidth Forms":function(n){return n>=65280&&n<=65519}};module.exports=unicodeBlockLookup; -},{}],245:[function(_dereq_,module,exports){ -"use strict";var LRUCache=function(t,e){this.max=t,this.onRemove=e,this.reset()};LRUCache.prototype.reset=function(){var t=this;for(var e in t.data)t.onRemove(t.data[e]);return this.data={},this.order=[],this},LRUCache.prototype.add=function(t,e){if(this.has(t))this.order.splice(this.order.indexOf(t),1),this.data[t]=e,this.order.push(t);else if(this.data[t]=e,this.order.push(t),this.order.length>this.max){var r=this.get(this.order[0]);r&&this.onRemove(r)}return this},LRUCache.prototype.has=function(t){return t in this.data},LRUCache.prototype.keys=function(){return this.order},LRUCache.prototype.get=function(t){if(!this.has(t))return null;var e=this.data[t];return delete this.data[t],this.order.splice(this.order.indexOf(t),1),e},LRUCache.prototype.getWithoutRemoving=function(t){return this.has(t)?this.data[t]:null},LRUCache.prototype.remove=function(t){if(!this.has(t))return this;var e=this.data[t];return delete this.data[t],this.onRemove(e),this.order.splice(this.order.indexOf(t),1),this},LRUCache.prototype.setMaxSize=function(t){var e=this;for(this.max=t;this.order.length>this.max;){var r=e.get(e.order[0]);r&&e.onRemove(r)}return this},module.exports=LRUCache; -},{}],246:[function(_dereq_,module,exports){ +},{}],266:[function(_dereq_,module,exports){ +"use strict";var LRUCache=function(t,e){this.max=t,this.onRemove=e,this.reset()};LRUCache.prototype.reset=function(){var t=this;for(var e in t.data)t.onRemove(t.data[e]);return this.data={},this.order=[],this},LRUCache.prototype.add=function(t,e){if(this.has(t))this.order.splice(this.order.indexOf(t),1),this.data[t]=e,this.order.push(t);else if(this.data[t]=e,this.order.push(t),this.order.length>this.max){var r=this.getAndRemove(this.order[0]);r&&this.onRemove(r)}return this},LRUCache.prototype.has=function(t){return t in this.data},LRUCache.prototype.keys=function(){return this.order},LRUCache.prototype.getAndRemove=function(t){if(!this.has(t))return null;var e=this.data[t];return delete this.data[t],this.order.splice(this.order.indexOf(t),1),e},LRUCache.prototype.get=function(t){return this.has(t)?this.data[t]:null},LRUCache.prototype.remove=function(t){if(!this.has(t))return this;var e=this.data[t];return delete this.data[t],this.onRemove(e),this.order.splice(this.order.indexOf(t),1),this},LRUCache.prototype.setMaxSize=function(t){var e=this;for(this.max=t;this.order.length>this.max;){var r=e.getAndRemove(e.order[0]);r&&e.onRemove(r)}return this},module.exports=LRUCache; +},{}],267:[function(_dereq_,module,exports){ "use strict";function makeAPIURL(r,e){var t=parseUrl(config.API_URL);if(r.protocol=t.protocol,r.authority=t.authority,"/"!==t.path&&(r.path=""+t.path+r.path),!config.REQUIRE_ACCESS_TOKEN)return formatUrl(r);if(!(e=e||config.ACCESS_TOKEN))throw new Error("An API access token is required to use Mapbox GL. "+help);if("s"===e[0])throw new Error("Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). "+help);return r.params.push("access_token="+e),formatUrl(r)}function isMapboxURL(r){return 0===r.indexOf("mapbox:")}function replaceTempAccessToken(r){for(var e=0;e=2||512===t?"@2x":"",p=browser.supportsWebp?".webp":"$1";return a.path=a.path.replace(imageExtensionRe,""+o+p),replaceTempAccessToken(a.params),formatUrl(a)};var urlRe=/^(\w+):\/\/([^\/?]*)(\/[^?]+)?\??(.+)?/; -},{"./browser":231,"./config":235}],247:[function(_dereq_,module,exports){ +},{"./browser":252,"./config":256}],268:[function(_dereq_,module,exports){ +"use strict";module.exports={getEntriesByName:function(e){return!(!performance||!performance.getEntriesByName)&&performance.getEntriesByName(e)}}; +},{}],269:[function(_dereq_,module,exports){ "use strict";var isChar=_dereq_("./is_char_in_unicode_block");module.exports.allowsIdeographicBreaking=function(a){for(var i=0,r=a;i=65097&&a<=65103)||(!!isChar["CJK Compatibility Ideographs"](a)||(!!isChar["CJK Compatibility"](a)||(!!isChar["CJK Radicals Supplement"](a)||(!!isChar["CJK Strokes"](a)||(!(!isChar["CJK Symbols and Punctuation"](a)||a>=12296&&a<=12305||a>=12308&&a<=12319||12336===a)||(!!isChar["CJK Unified Ideographs Extension A"](a)||(!!isChar["CJK Unified Ideographs"](a)||(!!isChar["Enclosed CJK Letters and Months"](a)||(!!isChar["Hangul Compatibility Jamo"](a)||(!!isChar["Hangul Jamo Extended-A"](a)||(!!isChar["Hangul Jamo Extended-B"](a)||(!!isChar["Hangul Jamo"](a)||(!!isChar["Hangul Syllables"](a)||(!!isChar.Hiragana(a)||(!!isChar["Ideographic Description Characters"](a)||(!!isChar.Kanbun(a)||(!!isChar["Kangxi Radicals"](a)||(!!isChar["Katakana Phonetic Extensions"](a)||(!(!isChar.Katakana(a)||12540===a)||(!(!isChar["Halfwidth and Fullwidth Forms"](a)||65288===a||65289===a||65293===a||a>=65306&&a<=65310||65339===a||65341===a||65343===a||a>=65371&&a<=65503||65507===a||a>=65512&&a<=65519)||(!(!isChar["Small Form Variants"](a)||a>=65112&&a<=65118||a>=65123&&a<=65126)||(!!isChar["Unified Canadian Aboriginal Syllabics"](a)||(!!isChar["Unified Canadian Aboriginal Syllabics Extended"](a)||(!!isChar["Vertical Forms"](a)||(!!isChar["Yijing Hexagram Symbols"](a)||(!!isChar["Yi Syllables"](a)||!!isChar["Yi Radicals"](a))))))))))))))))))))))))))))))},exports.charHasNeutralVerticalOrientation=function(a){return!(!isChar["Latin-1 Supplement"](a)||167!==a&&169!==a&&174!==a&&177!==a&&188!==a&&189!==a&&190!==a&&215!==a&&247!==a)||(!(!isChar["General Punctuation"](a)||8214!==a&&8224!==a&&8225!==a&&8240!==a&&8241!==a&&8251!==a&&8252!==a&&8258!==a&&8263!==a&&8264!==a&&8265!==a&&8273!==a)||(!!isChar["Letterlike Symbols"](a)||(!!isChar["Number Forms"](a)||(!(!isChar["Miscellaneous Technical"](a)||!(a>=8960&&a<=8967||a>=8972&&a<=8991||a>=8996&&a<=9e3||9003===a||a>=9085&&a<=9114||a>=9150&&a<=9165||9167===a||a>=9169&&a<=9179||a>=9186&&a<=9215))||(!(!isChar["Control Pictures"](a)||9251===a)||(!!isChar["Optical Character Recognition"](a)||(!!isChar["Enclosed Alphanumerics"](a)||(!!isChar["Geometric Shapes"](a)||(!(!isChar["Miscellaneous Symbols"](a)||a>=9754&&a<=9759)||(!(!isChar["Miscellaneous Symbols and Arrows"](a)||!(a>=11026&&a<=11055||a>=11088&&a<=11097||a>=11192&&a<=11243))||(!!isChar["CJK Symbols and Punctuation"](a)||(!!isChar.Katakana(a)||(!!isChar["Private Use Area"](a)||(!!isChar["CJK Compatibility Forms"](a)||(!!isChar["Small Form Variants"](a)||(!!isChar["Halfwidth and Fullwidth Forms"](a)||(8734===a||8756===a||8757===a||a>=9984&&a<=10087||a>=10102&&a<=10131||65532===a||65533===a)))))))))))))))))},exports.charHasRotatedVerticalOrientation=function(a){return!(exports.charHasUprightVerticalOrientation(a)||exports.charHasNeutralVerticalOrientation(a))}; -},{"./is_char_in_unicode_block":244}],248:[function(_dereq_,module,exports){ +},{"./is_char_in_unicode_block":265}],270:[function(_dereq_,module,exports){ "use strict";var LngLat=_dereq_("../geo/lng_lat");module.exports=function(n,t,l){if(n=new LngLat(n.lng,n.lat),t){var a=new LngLat(n.lng-360,n.lat),i=new LngLat(n.lng+360,n.lat),o=l.locationPoint(n).distSqr(t);l.locationPoint(a).distSqr(t)180;){var e=l.locationPoint(n);if(e.x>=0&&e.y>=0&&e.x<=l.width&&e.y<=l.height)break;n.lng>l.center.lng?n.lng-=360:n.lng+=360}return n}; -},{"../geo/lng_lat":68}],249:[function(_dereq_,module,exports){ -"use strict";function createStructArrayType(t){var r=JSON.stringify(t);if(structArrayTypeCache[r])return structArrayTypeCache[r];var e=void 0===t.alignment?1:t.alignment,i=0,n=0,a=["Uint8"],s=t.members.map(function(t){a.indexOf(t.type)<0&&a.push(t.type);var r=sizeOf(t.type),s=i=align(i,Math.max(e,r)),o=t.components||1;return n=Math.max(n,r),i+=r*o,{name:t.name,type:t.type,components:o,offset:s}}),o=align(i,Math.max(n,e)),p=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r}(Struct);p.prototype.alignment=e,p.prototype.size=o;for(var y=0,c=s;y1&&(f+=u),f in p.prototype)throw new Error(f+" is a reserved name and cannot be used as a member name.");Object.defineProperty(p.prototype,f,createAccessors(h,u))}var m=function(t){function r(){t.apply(this,arguments)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r}(StructArray);return m.prototype.members=s,m.prototype.StructType=p,m.prototype.bytesPerElement=o,m.prototype.emplaceBack=createEmplaceBack(s,o),m.prototype._usedTypes=a,structArrayTypeCache[r]=m,m}function align(t,r){return Math.ceil(t/r)*r}function sizeOf(t){return viewTypes[t].BYTES_PER_ELEMENT}function getArrayViewName(t){return t.toLowerCase()}function createEmplaceBack(t,r){for(var e=[],i=[],n="var i = this.length;\nthis.resize(this.length + 1);\n",a=0,s=t;athis.capacity){this.capacity=Math.max(t,Math.floor(this.capacity*RESIZE_MULTIPLIER),DEFAULT_CAPACITY),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}},StructArray.prototype._refreshViews=function(){for(var t=this,r=0,e=t._usedTypes;rthis.capacity){this.capacity=Math.max(t,Math.floor(this.capacity*RESIZE_MULTIPLIER),DEFAULT_CAPACITY),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}},StructArray.prototype._refreshViews=function(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")},module.exports.StructArray=StructArray,module.exports.Struct=Struct,module.exports.viewTypes=viewTypes,module.exports.createLayout=createLayout; +},{}],272:[function(_dereq_,module,exports){ +"use strict";module.exports=function(t,n){var u=!1,e=0,r=function(){e=0,u&&(t(),e=setTimeout(r,n),u=!1)};return function(){return u=!0,e||r(),e}}; +},{}],273:[function(_dereq_,module,exports){ +"use strict";function tileCover(e,r,a,n){function d(r,d,t){var y,c,l,x;if(t>=0&&t<=o)for(y=r;yr.row){var a=e;e=r,r=a}return{x0:e.column,y0:e.row,x1:r.column,y1:r.row,dx:r.column-e.column,dy:r.row-e.row}}function scanSpans(e,r,a,n,d){var o=Math.max(a,Math.floor(r.y0)),i=Math.min(n,Math.ceil(r.y1));if(e.x0===r.x0&&e.y0===r.y0?e.x0+r.dy/e.dy*e.dx0,x=r.dx<0,u=o;uy.dy&&(i=t,t=y,y=i),t.dy>c.dy&&(i=t,t=c,c=i),y.dy>c.dy&&(i=y,y=c,c=i),t.dy&&scanSpans(c,t,n,d,o),y.dy&&scanSpans(c,y,n,d,o)}var Coordinate=_dereq_("../geo/coordinate"),ref=_dereq_("../source/tile_id"),OverscaledTileID=ref.OverscaledTileID;module.exports=tileCover; +},{"../geo/coordinate":61,"../source/tile_id":114}],274:[function(_dereq_,module,exports){ "use strict";function resolveTokens(e,n){return n.replace(/{([^{}]+)}/g,function(n,r){return r in e?String(e[r]):""})}module.exports=resolveTokens; -},{}],252:[function(_dereq_,module,exports){ -"use strict";var UnitBezier=_dereq_("@mapbox/unitbezier"),Coordinate=_dereq_("../geo/coordinate"),Point=_dereq_("@mapbox/point-geometry");exports.easeCubicInOut=function(r){if(r<=0)return 0;if(r>=1)return 1;var e=r*r,t=e*r;return 4*(r<.5?t:3*(r-e)+t-.75)},exports.bezier=function(r,e,t,n){var o=new UnitBezier(r,e,t,n);return function(r){return o.solve(r)}},exports.ease=exports.bezier(.25,.1,.25,1),exports.clamp=function(r,e,t){return Math.min(t,Math.max(e,r))},exports.wrap=function(r,e,t){var n=t-e,o=((r-e)%n+n)%n+e;return o===e?t:o},exports.asyncAll=function(r,e,t){if(!r.length)return t(null,[]);var n=r.length,o=new Array(r.length),a=null;r.forEach(function(r,i){e(r,function(r,e){r&&(a=r),o[i]=e,0==--n&&t(a,o)})})},exports.values=function(r){var e=[];for(var t in r)e.push(r[t]);return e},exports.keysDifference=function(r,e){var t=[];for(var n in r)n in e||t.push(n);return t},exports.extend=function(r){for(var e=[],t=arguments.length-1;t-- >0;)e[t]=arguments[t+1];for(var n=0,o=e;n=0)return!0;return!1};var warnOnceHistory={};exports.warnOnce=function(r){warnOnceHistory[r]||("undefined"!=typeof console&&console.warn(r),warnOnceHistory[r]=!0)},exports.isCounterClockwise=function(r,e,t){return(t.y-r.y)*(e.x-r.x)>(e.y-r.y)*(t.x-r.x)},exports.calculateSignedArea=function(r){for(var e=0,t=0,n=r.length,o=n-1,a=void 0,i=void 0;t0||Math.abs(e.y-t.y)>0)&&Math.abs(exports.calculateSignedArea(r))>.01},exports.sphericalToCartesian=function(r){var e=r[0],t=r[1],n=r[2];return t+=90,t*=Math.PI/180,n*=Math.PI/180,[e*Math.cos(t)*Math.sin(n),e*Math.sin(t)*Math.sin(n),e*Math.cos(n)]},exports.parseCacheControl=function(r){var e=/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,t={};if(r.replace(e,function(r,e,n,o){var a=n||o;return t[e]=!a||a.toLowerCase(),""}),t["max-age"]){var n=parseInt(t["max-age"],10);isNaN(n)?delete t["max-age"]:t["max-age"]=n}return t}; -},{"../geo/coordinate":67,"@mapbox/point-geometry":2,"@mapbox/unitbezier":5}],253:[function(_dereq_,module,exports){ +},{}],275:[function(_dereq_,module,exports){ +"use strict";var UnitBezier=_dereq_("@mapbox/unitbezier"),Coordinate=_dereq_("../geo/coordinate"),Point=_dereq_("@mapbox/point-geometry");exports.easeCubicInOut=function(r){if(r<=0)return 0;if(r>=1)return 1;var e=r*r,n=e*r;return 4*(r<.5?n:3*(r-e)+n-.75)},exports.bezier=function(r,e,n,t){var o=new UnitBezier(r,e,n,t);return function(r){return o.solve(r)}},exports.ease=exports.bezier(.25,.1,.25,1),exports.clamp=function(r,e,n){return Math.min(n,Math.max(e,r))},exports.wrap=function(r,e,n){var t=n-e,o=((r-e)%t+t)%t+e;return o===e?n:o},exports.asyncAll=function(r,e,n){if(!r.length)return n(null,[]);var t=r.length,o=new Array(r.length),a=null;r.forEach(function(r,i){e(r,function(r,e){r&&(a=r),o[i]=e,0==--t&&n(a,o)})})},exports.values=function(r){var e=[];for(var n in r)e.push(r[n]);return e},exports.keysDifference=function(r,e){var n=[];for(var t in r)t in e||n.push(t);return n},exports.extend=function(r){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];for(var t=0,o=e;t=0)return!0;return!1};var warnOnceHistory={};exports.warnOnce=function(r){warnOnceHistory[r]||("undefined"!=typeof console&&console.warn(r),warnOnceHistory[r]=!0)},exports.isCounterClockwise=function(r,e,n){return(n.y-r.y)*(e.x-r.x)>(e.y-r.y)*(n.x-r.x)},exports.calculateSignedArea=function(r){for(var e=0,n=0,t=r.length,o=t-1,a=void 0,i=void 0;n0||Math.abs(e.y-n.y)>0)&&Math.abs(exports.calculateSignedArea(r))>.01},exports.sphericalToCartesian=function(r){var e=r[0],n=r[1],t=r[2];return n+=90,n*=Math.PI/180,t*=Math.PI/180,{x:e*Math.cos(n)*Math.sin(t),y:e*Math.sin(n)*Math.sin(t),z:e*Math.cos(t)}},exports.parseCacheControl=function(r){var e=/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,n={};if(r.replace(e,function(r,e,t,o){var a=t||o;return n[e]=!a||a.toLowerCase(),""}),n["max-age"]){var t=parseInt(n["max-age"],10);isNaN(t)?delete n["max-age"]:n["max-age"]=t}return n}; +},{"../geo/coordinate":61,"../style-spec/util/deep_equal":155,"@mapbox/point-geometry":4,"@mapbox/unitbezier":7}],276:[function(_dereq_,module,exports){ "use strict";var Feature=function(e,t,r,o){this.type="Feature",this._vectorTileFeature=e,e._z=t,e._x=r,e._y=o,this.properties=e.properties,null!=e.id&&(this.id=e.id)},prototypeAccessors={geometry:{}};prototypeAccessors.geometry.get=function(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry},prototypeAccessors.geometry.set=function(e){this._geometry=e},Feature.prototype.toJSON=function(){var e=this,t={geometry:this.geometry};for(var r in e)"_geometry"!==r&&"_vectorTileFeature"!==r&&(t[r]=e[r]);return t},Object.defineProperties(Feature.prototype,prototypeAccessors),module.exports=Feature; -},{}],254:[function(_dereq_,module,exports){ +},{}],277:[function(_dereq_,module,exports){ "use strict";var scriptDetection=_dereq_("./script_detection");module.exports=function(t){for(var o="",e=0;e":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"}; -},{"./script_detection":247}],255:[function(_dereq_,module,exports){ +},{"./script_detection":269}],278:[function(_dereq_,module,exports){ +"use strict";function register(e,r,i){void 0===i&&(i={}),Object.defineProperty(r,"_classRegistryKey",{value:e,writeable:!1}),registry[e]={klass:r,omit:i.omit||[],shallow:i.shallow||[]}}function serialize(e,r){if(null===e||void 0===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp)return e;if(e instanceof ArrayBuffer)return r&&r.push(e),e;if(ArrayBuffer.isView(e)){var i=e;return r&&r.push(i.buffer),i}if(e instanceof ImageData)return r&&r.push(e.data.buffer),e;if(Array.isArray(e)){for(var s=[],o=0,t=e;o=0)){var u=e[p];l[p]=registry[f].shallow.indexOf(p)>=0?u:serialize(u,r)}return{name:f,properties:l}}throw new Error("can't serialize object of type "+typeof e)}function deserialize(e){if(null===e||void 0===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof ArrayBuffer||ArrayBuffer.isView(e)||e instanceof ImageData)return e;if(Array.isArray(e))return e.map(function(e){return deserialize(e)});if("object"==typeof e){var r=e,i=r.name,s=r.properties;if(!i)throw new Error("can't deserialize object of anonymous class");var o=registry[i],t=o.klass;if(!t)throw new Error("can't deserialize unregistered class "+i);if(t.deserialize)return t.deserialize(s._serialized);for(var n=Object.create(t.prototype),a=0,f=Object.keys(s);a=0?s[l]:deserialize(s[l])}return n}throw new Error("can't deserialize object of type "+typeof e)}var Grid=_dereq_("grid-index"),Color=_dereq_("../style-spec/util/color"),ref=_dereq_("../style-spec/expression"),StylePropertyFunction=ref.StylePropertyFunction,StyleExpression=ref.StyleExpression,StyleExpressionWithErrorHandling=ref.StyleExpressionWithErrorHandling,ZoomDependentExpression=ref.ZoomDependentExpression,ZoomConstantExpression=ref.ZoomConstantExpression,ref$1=_dereq_("../style-spec/expression/compound_expression"),CompoundExpression=ref$1.CompoundExpression,expressions=_dereq_("../style-spec/expression/definitions"),ref$2=_dereq_("./window"),ImageData=ref$2.ImageData,registry={};register("Object",Object),Grid.serialize=function(e,r){var i=e.toArrayBuffer();return r&&r.push(i),i},Grid.deserialize=function(e){return new Grid(e)},register("Grid",Grid),register("Color",Color),register("StylePropertyFunction",StylePropertyFunction),register("StyleExpression",StyleExpression,{omit:["_evaluator"]}),register("StyleExpressionWithErrorHandling",StyleExpressionWithErrorHandling,{omit:["_evaluator"]}),register("ZoomDependentExpression",ZoomDependentExpression),register("ZoomConstantExpression",ZoomConstantExpression),register("CompoundExpression",CompoundExpression,{omit:["_evaluate"]});for(var name in expressions)expressions[name]._classRegistryKey||register("Expression_"+name,expressions[name]);module.exports={register:register,serialize:serialize,deserialize:deserialize}; +},{"../style-spec/expression":139,"../style-spec/expression/compound_expression":123,"../style-spec/expression/definitions":131,"../style-spec/util/color":153,"./window":254,"grid-index":24}],279:[function(_dereq_,module,exports){ "use strict";var WebWorker=_dereq_("./web_worker"),WorkerPool=function(){this.active={}};WorkerPool.prototype.acquire=function(r){var e=this;if(!this.workers){var o=_dereq_("../").workerCount;for(this.workers=[];this.workers.length=2.2.7 <3", through@^2.3.6, through@^2.3.7, through@^2.3.8, through@~2.3.4: +through@2, "through@>=2.2.7 <3", through@^2.3.6, through@^2.3.7, through@^2.3.8, through@~2.3.4: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" @@ -3146,10 +3181,6 @@ tinyqueue@^1.1.0: version "1.2.3" resolved "https://registry.yarnpkg.com/tinyqueue/-/tinyqueue-1.2.3.tgz#b6a61de23060584da29f82362e45df1ec7353f3d" -to-utf8@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/to-utf8/-/to-utf8-0.0.1.tgz#d17aea72ff2fba39b9e43601be7b3ff72e089852" - trim-newlines@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613" @@ -3285,9 +3316,9 @@ vt-pbf@^3.0.1: "@mapbox/vector-tile" "^1.3.0" pbf "^3.0.5" -webworkify@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/webworkify/-/webworkify-1.4.0.tgz#71245d1e34cacf54e426bd955f8cc6ee12d024c2" +webworkify@^1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/webworkify/-/webworkify-1.5.0.tgz#734ad87a774de6ebdd546e1d3e027da5b8f4a42c" wgs84@0.0.0: version "0.0.0"