Skip to content

Instantly share code, notes, and snippets.

@etpinard
Last active May 16, 2024 21:06
Show Gist options
  • Save etpinard/9cce3976acc33770bd1212adcc95c9fe to your computer and use it in GitHub Desktop.
Save etpinard/9cce3976acc33770bd1212adcc95c9fe to your computer and use it in GitHub Desktop.
Try mapbox-gl 3D extrude fill layers
Try mapbox-gl 3D extrude fill layers
license: mit
height: 1000
node_modules
npm-debug.log
raw_data
data.json
(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;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){(function(process){function normalizeArray(parts,allowAboveRoot){var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up--;up){parts.unshift("..")}}return parts}var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var splitPath=function(filename){return splitPathRe.exec(filename).slice(1)};exports.resolve=function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:process.cwd();if(typeof path!=="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){continue}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=path.charAt(0)==="/"}resolvedPath=normalizeArray(filter(resolvedPath.split("/"),function(p){return!!p}),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."};exports.normalize=function(path){var isAbsolute=exports.isAbsolute(path),trailingSlash=substr(path,-1)==="/";path=normalizeArray(filter(path.split("/"),function(p){return!!p}),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path};exports.isAbsolute=function(path){return path.charAt(0)==="/"};exports.join=function(){var paths=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(paths,function(p,index){if(typeof p!=="string"){throw new TypeError("Arguments to path.join must be strings")}return p}).join("/"))};exports.relative=function(from,to){from=exports.resolve(from).substr(1);to=exports.resolve(to).substr(1);function trim(arr){var start=0;for(;start<arr.length;start++){if(arr[start]!=="")break}var end=arr.length-1;for(;end>=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i<length;i++){if(fromParts[i]!==toParts[i]){samePartsLength=i;break}}var outputParts=[];for(var i=samePartsLength;i<fromParts.length;i++){outputParts.push("..")}outputParts=outputParts.concat(toParts.slice(samePartsLength));return outputParts.join("/")};exports.sep="/";exports.delimiter=":";exports.dirname=function(path){var result=splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir};exports.basename=function(path,ext){var f=splitPath(path)[2];if(ext&&f.substr(-1*ext.length)===ext){f=f.substr(0,f.length-ext.length)}return f};exports.extname=function(path){return splitPath(path)[3]};function filter(xs,f){if(xs.filter)return xs.filter(f);var res=[];for(var i=0;i<xs.length;i++){if(f(xs[i],i,xs))res.push(xs[i])}return res}var substr="ab".substr(-1)==="b"?function(str,start,len){return str.substr(start,len)}:function(str,start,len){if(start<0)start=str.length+start;return str.substr(start,len)}}).call(this,require("_process"))},{_process:2}],2:[function(require,module,exports){var process=module.exports={};var cachedSetTimeout;var cachedClearTimeout;function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function"){cachedSetTimeout=setTimeout}else{cachedSetTimeout=defaultSetTimout}}catch(e){cachedSetTimeout=defaultSetTimout}try{if(typeof clearTimeout==="function"){cachedClearTimeout=clearTimeout}else{cachedClearTimeout=defaultClearTimeout}}catch(e){cachedClearTimeout=defaultClearTimeout}})();function runTimeout(fun){if(cachedSetTimeout===setTimeout){return setTimeout(fun,0)}if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout){cachedSetTimeout=setTimeout;return setTimeout(fun,0)}try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}function runClearTimeout(marker){if(cachedClearTimeout===clearTimeout){return clearTimeout(marker)}if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout){cachedClearTimeout=clearTimeout;return clearTimeout(marker)}try{return cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}var queue=[];var draining=false;var currentQueue;var queueIndex=-1;function cleanUpNextTick(){if(!draining||!currentQueue){return}draining=false;if(currentQueue.length){queue=currentQueue.concat(queue)}else{queueIndex=-1}if(queue.length){drainQueue()}}function drainQueue(){if(draining){return}var timeout=runTimeout(cleanUpNextTick);draining=true;var len=queue.length;while(len){currentQueue=queue;queue=[];while(++queueIndex<len){if(currentQueue){currentQueue[queueIndex].run()}}queueIndex=-1;len=queue.length}currentQueue=null;draining=false;runClearTimeout(timeout)}process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1){for(var i=1;i<arguments.length;i++){args[i-1]=arguments[i]}}queue.push(new Item(fun,args));if(queue.length===1&&!draining){runTimeout(drainQueue)}};function Item(fun,array){this.fun=fun;this.array=array}Item.prototype.run=function(){this.fun.apply(null,this.array)};process.title="browser";process.browser=true;process.env={};process.argv=[];process.version="";process.versions={};function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")};process.umask=function(){return 0}},{}],3:[function(require,module,exports){(function(global){(function(root){var freeExports=typeof exports=="object"&&exports&&!exports.nodeType&&exports;var freeModule=typeof module=="object"&&module&&!module.nodeType&&module;var freeGlobal=typeof global=="object"&&global;if(freeGlobal.global===freeGlobal||freeGlobal.window===freeGlobal||freeGlobal.self===freeGlobal){root=freeGlobal}var punycode,maxInt=2147483647,base=36,tMin=1,tMax=26,skew=38,damp=700,initialBias=72,initialN=128,delimiter="-",regexPunycode=/^xn--/,regexNonASCII=/[^\x20-\x7E]/,regexSeparators=/[\x2E\u3002\uFF0E\uFF61]/g,errors={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},baseMinusTMin=base-tMin,floor=Math.floor,stringFromCharCode=String.fromCharCode,key;function error(type){throw new RangeError(errors[type])}function map(array,fn){var length=array.length;var result=[];while(length--){result[length]=fn(array[length])}return result}function mapDomain(string,fn){var parts=string.split("@");var result="";if(parts.length>1){result=parts[0]+"@";string=parts[1]}string=string.replace(regexSeparators,".");var labels=string.split(".");var encoded=map(labels,fn).join(".");return result+encoded}function ucs2decode(string){var output=[],counter=0,length=string.length,value,extra;while(counter<length){value=string.charCodeAt(counter++);if(value>=55296&&value<=56319&&counter<length){extra=string.charCodeAt(counter++);if((extra&64512)==56320){output.push(((value&1023)<<10)+(extra&1023)+65536)}else{output.push(value);counter--}}else{output.push(value)}}return output}function ucs2encode(array){return map(array,function(value){var output="";if(value>65535){value-=65536;output+=stringFromCharCode(value>>>10&1023|55296);value=56320|value&1023}output+=stringFromCharCode(value);return output}).join("")}function basicToDigit(codePoint){if(codePoint-48<10){return codePoint-22}if(codePoint-65<26){return codePoint-65}if(codePoint-97<26){return codePoint-97}return base}function digitToBasic(digit,flag){return digit+22+75*(digit<26)-((flag!=0)<<5)}function adapt(delta,numPoints,firstTime){var k=0;delta=firstTime?floor(delta/damp):delta>>1;delta+=floor(delta/numPoints);for(;delta>baseMinusTMin*tMax>>1;k+=base){delta=floor(delta/baseMinusTMin)}return floor(k+(baseMinusTMin+1)*delta/(delta+skew))}function decode(input){var output=[],inputLength=input.length,out,i=0,n=initialN,bias=initialBias,basic,j,index,oldi,w,k,digit,t,baseMinusT;basic=input.lastIndexOf(delimiter);if(basic<0){basic=0}for(j=0;j<basic;++j){if(input.charCodeAt(j)>=128){error("not-basic")}output.push(input.charCodeAt(j))}for(index=basic>0?basic+1:0;index<inputLength;){for(oldi=i,w=1,k=base;;k+=base){if(index>=inputLength){error("invalid-input")}digit=basicToDigit(input.charCodeAt(index++));if(digit>=base||digit>floor((maxInt-i)/w)){error("overflow")}i+=digit*w;t=k<=bias?tMin:k>=bias+tMax?tMax:k-bias;if(digit<t){break}baseMinusT=base-t;if(w>floor(maxInt/baseMinusT)){error("overflow")}w*=baseMinusT}out=output.length+1;bias=adapt(i-oldi,out,oldi==0);if(floor(i/out)>maxInt-n){error("overflow")}n+=floor(i/out);i%=out;output.splice(i++,0,n)}return ucs2encode(output)}function encode(input){var n,delta,handledCPCount,basicLength,bias,j,m,q,k,t,currentValue,output=[],inputLength,handledCPCountPlusOne,baseMinusT,qMinusT;input=ucs2decode(input);inputLength=input.length;n=initialN;delta=0;bias=initialBias;for(j=0;j<inputLength;++j){currentValue=input[j];if(currentValue<128){output.push(stringFromCharCode(currentValue))}}handledCPCount=basicLength=output.length;if(basicLength){output.push(delimiter)}while(handledCPCount<inputLength){for(m=maxInt,j=0;j<inputLength;++j){currentValue=input[j];if(currentValue>=n&&currentValue<m){m=currentValue}}handledCPCountPlusOne=handledCPCount+1;if(m-n>floor((maxInt-delta)/handledCPCountPlusOne)){error("overflow")}delta+=(m-n)*handledCPCountPlusOne;n=m;for(j=0;j<inputLength;++j){currentValue=input[j];if(currentValue<n&&++delta>maxInt){error("overflow")}if(currentValue==n){for(q=delta,k=base;;k+=base){t=k<=bias?tMin:k>=bias+tMax?tMax:k-bias;if(q<t){break}qMinusT=q-t;baseMinusT=base-t;output.push(stringFromCharCode(digitToBasic(t+qMinusT%baseMinusT,0)));q=floor(qMinusT/baseMinusT)}output.push(stringFromCharCode(digitToBasic(q,0)));bias=adapt(delta,handledCPCountPlusOne,handledCPCount==basicLength);delta=0;++handledCPCount}}++delta;++n}return output.join("")}function toUnicode(input){return mapDomain(input,function(string){return regexPunycode.test(string)?decode(string.slice(4).toLowerCase()):string})}function toASCII(input){return mapDomain(input,function(string){return regexNonASCII.test(string)?"xn--"+encode(string):string})}punycode={version:"1.4.1",ucs2:{decode:ucs2decode,encode:ucs2encode},decode:decode,encode:encode,toASCII:toASCII,toUnicode:toUnicode};if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){define("punycode",function(){return punycode})}else if(freeExports&&freeModule){if(module.exports==freeExports){freeModule.exports=punycode}else{for(key in punycode){punycode.hasOwnProperty(key)&&(freeExports[key]=punycode[key])}}}else{root.punycode=punycode}})(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],4:[function(require,module,exports){"use strict";function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}module.exports=function(qs,sep,eq,options){sep=sep||"&";eq=eq||"=";var obj={};if(typeof qs!=="string"||qs.length===0){return obj}var regexp=/\+/g;qs=qs.split(sep);var maxKeys=1e3;if(options&&typeof options.maxKeys==="number"){maxKeys=options.maxKeys}var len=qs.length;if(maxKeys>0&&len>maxKeys){len=maxKeys}for(var i=0;i<len;++i){var x=qs[i].replace(regexp,"%20"),idx=x.indexOf(eq),kstr,vstr,k,v;if(idx>=0){kstr=x.substr(0,idx);vstr=x.substr(idx+1)}else{kstr=x;vstr=""}k=decodeURIComponent(kstr);v=decodeURIComponent(vstr);if(!hasOwnProperty(obj,k)){obj[k]=v}else if(isArray(obj[k])){obj[k].push(v)}else{obj[k]=[obj[k],v]}}return obj};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==="[object Array]"}},{}],5:[function(require,module,exports){"use strict";var stringifyPrimitive=function(v){switch(typeof v){case"string":return v;case"boolean":return v?"true":"false";case"number":return isFinite(v)?v:"";default:return""}};module.exports=function(obj,sep,eq,name){sep=sep||"&";eq=eq||"=";if(obj===null){obj=undefined}if(typeof obj==="object"){return map(objectKeys(obj),function(k){var ks=encodeURIComponent(stringifyPrimitive(k))+eq;if(isArray(obj[k])){return map(obj[k],function(v){return ks+encodeURIComponent(stringifyPrimitive(v))}).join(sep)}else{return ks+encodeURIComponent(stringifyPrimitive(obj[k]))}}).join(sep)}if(!name)return"";return encodeURIComponent(stringifyPrimitive(name))+eq+encodeURIComponent(stringifyPrimitive(obj))};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==="[object Array]"};function map(xs,f){if(xs.map)return xs.map(f);var res=[];for(var i=0;i<xs.length;i++){res.push(f(xs[i],i))}return res}var objectKeys=Object.keys||function(obj){var res=[];for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))res.push(key)}return res}},{}],6:[function(require,module,exports){"use strict";exports.decode=exports.parse=require("./decode");exports.encode=exports.stringify=require("./encode")},{"./decode":4,"./encode":5}],7:[function(require,module,exports){"use strict";var punycode=require("punycode");var util=require("./util");exports.parse=urlParse;exports.resolve=urlResolve;exports.resolveObject=urlResolveObject;exports.format=urlFormat;exports.Url=Url;function Url(){this.protocol=null;this.slashes=null;this.auth=null;this.host=null;this.port=null;this.hostname=null;this.hash=null;this.search=null;this.query=null;this.pathname=null;this.path=null;this.href=null}var protocolPattern=/^([a-z0-9.+-]+:)/i,portPattern=/:[0-9]*$/,simplePathPattern=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,delims=["<",">",'"',"`"," ","\r","\n","\t"],unwise=["{","}","|","\\","^","`"].concat(delims),autoEscape=["'"].concat(unwise),nonHostChars=["%","/","?",";","#"].concat(autoEscape),hostEndingChars=["/","?","#"],hostnameMaxLen=255,hostnamePartPattern=/^[+a-z0-9A-Z_-]{0,63}$/,hostnamePartStart=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,unsafeProtocol={javascript:true,"javascript:":true},hostlessProtocol={javascript:true,"javascript:":true},slashedProtocol={http:true,https:true,ftp:true,gopher:true,file:true,"http:":true,"https:":true,"ftp:":true,"gopher:":true,"file:":true},querystring=require("querystring");function urlParse(url,parseQueryString,slashesDenoteHost){if(url&&util.isObject(url)&&url instanceof Url)return url;var u=new Url;u.parse(url,parseQueryString,slashesDenoteHost);return u}Url.prototype.parse=function(url,parseQueryString,slashesDenoteHost){if(!util.isString(url)){throw new TypeError("Parameter 'url' must be a string, not "+typeof url)}var queryIndex=url.indexOf("?"),splitter=queryIndex!==-1&&queryIndex<url.indexOf("#")?"?":"#",uSplit=url.split(splitter),slashRegex=/\\/g;uSplit[0]=uSplit[0].replace(slashRegex,"/");url=uSplit.join(splitter);var rest=url;rest=rest.trim();if(!slashesDenoteHost&&url.split("#").length===1){var simplePath=simplePathPattern.exec(rest);if(simplePath){this.path=rest;this.href=rest;this.pathname=simplePath[1];if(simplePath[2]){this.search=simplePath[2];if(parseQueryString){this.query=querystring.parse(this.search.substr(1))}else{this.query=this.search.substr(1)}}else if(parseQueryString){this.search="";this.query={}}return this}}var proto=protocolPattern.exec(rest);if(proto){proto=proto[0];var lowerProto=proto.toLowerCase();this.protocol=lowerProto;rest=rest.substr(proto.length)}if(slashesDenoteHost||proto||rest.match(/^\/\/[^@\/]+@[^@\/]+/)){var slashes=rest.substr(0,2)==="//";if(slashes&&!(proto&&hostlessProtocol[proto])){rest=rest.substr(2);this.slashes=true}}if(!hostlessProtocol[proto]&&(slashes||proto&&!slashedProtocol[proto])){var hostEnd=-1;for(var i=0;i<hostEndingChars.length;i++){var hec=rest.indexOf(hostEndingChars[i]);if(hec!==-1&&(hostEnd===-1||hec<hostEnd))hostEnd=hec}var auth,atSign;if(hostEnd===-1){atSign=rest.lastIndexOf("@")}else{atSign=rest.lastIndexOf("@",hostEnd)}if(atSign!==-1){auth=rest.slice(0,atSign);rest=rest.slice(atSign+1);this.auth=decodeURIComponent(auth)}hostEnd=-1;for(var i=0;i<nonHostChars.length;i++){var hec=rest.indexOf(nonHostChars[i]);if(hec!==-1&&(hostEnd===-1||hec<hostEnd))hostEnd=hec}if(hostEnd===-1)hostEnd=rest.length;this.host=rest.slice(0,hostEnd);rest=rest.slice(hostEnd);this.parseHost();this.hostname=this.hostname||"";var ipv6Hostname=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!ipv6Hostname){var hostparts=this.hostname.split(/\./);for(var i=0,l=hostparts.length;i<l;i++){var part=hostparts[i];if(!part)continue;if(!part.match(hostnamePartPattern)){var newpart="";for(var j=0,k=part.length;j<k;j++){if(part.charCodeAt(j)>127){newpart+="x"}else{newpart+=part[j]}}if(!newpart.match(hostnamePartPattern)){var validParts=hostparts.slice(0,i);var notHost=hostparts.slice(i+1);var bit=part.match(hostnamePartStart);if(bit){validParts.push(bit[1]);notHost.unshift(bit[2])}if(notHost.length){rest="/"+notHost.join(".")+rest}this.hostname=validParts.join(".");break}}}}if(this.hostname.length>hostnameMaxLen){this.hostname=""}else{this.hostname=this.hostname.toLowerCase()}if(!ipv6Hostname){this.hostname=punycode.toASCII(this.hostname)}var p=this.port?":"+this.port:"";var h=this.hostname||"";this.host=h+p;this.href+=this.host;if(ipv6Hostname){this.hostname=this.hostname.substr(1,this.hostname.length-2);if(rest[0]!=="/"){rest="/"+rest}}}if(!unsafeProtocol[lowerProto]){for(var i=0,l=autoEscape.length;i<l;i++){var ae=autoEscape[i];if(rest.indexOf(ae)===-1)continue;var esc=encodeURIComponent(ae);if(esc===ae){esc=escape(ae)}rest=rest.split(ae).join(esc)}}var hash=rest.indexOf("#");if(hash!==-1){this.hash=rest.substr(hash);rest=rest.slice(0,hash)}var qm=rest.indexOf("?");if(qm!==-1){this.search=rest.substr(qm);this.query=rest.substr(qm+1);if(parseQueryString){this.query=querystring.parse(this.query)}rest=rest.slice(0,qm)}else if(parseQueryString){this.search="";this.query={}}if(rest)this.pathname=rest;if(slashedProtocol[lowerProto]&&this.hostname&&!this.pathname){this.pathname="/"}if(this.pathname||this.search){var p=this.pathname||"";var s=this.search||"";this.path=p+s}this.href=this.format();return this};function urlFormat(obj){if(util.isString(obj))obj=urlParse(obj);if(!(obj instanceof Url))return Url.prototype.format.call(obj);return obj.format()}Url.prototype.format=function(){var auth=this.auth||"";if(auth){auth=encodeURIComponent(auth);auth=auth.replace(/%3A/i,":");auth+="@"}var protocol=this.protocol||"",pathname=this.pathname||"",hash=this.hash||"",host=false,query="";if(this.host){host=auth+this.host}else if(this.hostname){host=auth+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]");if(this.port){host+=":"+this.port}}if(this.query&&util.isObject(this.query)&&Object.keys(this.query).length){query=querystring.stringify(this.query)}var search=this.search||query&&"?"+query||"";if(protocol&&protocol.substr(-1)!==":")protocol+=":";if(this.slashes||(!protocol||slashedProtocol[protocol])&&host!==false){host="//"+(host||"");if(pathname&&pathname.charAt(0)!=="/")pathname="/"+pathname}else if(!host){host=""}if(hash&&hash.charAt(0)!=="#")hash="#"+hash;if(search&&search.charAt(0)!=="?")search="?"+search;pathname=pathname.replace(/[?#]/g,function(match){return encodeURIComponent(match)});search=search.replace("#","%23");return protocol+host+pathname+search+hash};function urlResolve(source,relative){return urlParse(source,false,true).resolve(relative)}Url.prototype.resolve=function(relative){return this.resolveObject(urlParse(relative,false,true)).format()};function urlResolveObject(source,relative){if(!source)return relative;return urlParse(source,false,true).resolveObject(relative)}Url.prototype.resolveObject=function(relative){if(util.isString(relative)){var rel=new Url;rel.parse(relative,false,true);relative=rel}var result=new Url;var tkeys=Object.keys(this);for(var tk=0;tk<tkeys.length;tk++){var tkey=tkeys[tk];result[tkey]=this[tkey]}result.hash=relative.hash;if(relative.href===""){result.href=result.format();return result}if(relative.slashes&&!relative.protocol){var rkeys=Object.keys(relative);for(var rk=0;rk<rkeys.length;rk++){var rkey=rkeys[rk];if(rkey!=="protocol")result[rkey]=relative[rkey]}if(slashedProtocol[result.protocol]&&result.hostname&&!result.pathname){result.path=result.pathname="/"}result.href=result.format();return result}if(relative.protocol&&relative.protocol!==result.protocol){if(!slashedProtocol[relative.protocol]){var keys=Object.keys(relative);for(var v=0;v<keys.length;v++){var k=keys[v];result[k]=relative[k]}result.href=result.format();return result}result.protocol=relative.protocol;if(!relative.host&&!hostlessProtocol[relative.protocol]){var relPath=(relative.pathname||"").split("/");while(relPath.length&&!(relative.host=relPath.shift()));if(!relative.host)relative.host="";if(!relative.hostname)relative.hostname="";if(relPath[0]!=="")relPath.unshift("");if(relPath.length<2)relPath.unshift("");result.pathname=relPath.join("/")}else{result.pathname=relative.pathname}result.search=relative.search;result.query=relative.query;result.host=relative.host||"";result.auth=relative.auth;result.hostname=relative.hostname||relative.host;result.port=relative.port;if(result.pathname||result.search){var p=result.pathname||"";var s=result.search||"";result.path=p+s}result.slashes=result.slashes||relative.slashes;result.href=result.format();return result}var isSourceAbs=result.pathname&&result.pathname.charAt(0)==="/",isRelAbs=relative.host||relative.pathname&&relative.pathname.charAt(0)==="/",mustEndAbs=isRelAbs||isSourceAbs||result.host&&relative.pathname,removeAllDots=mustEndAbs,srcPath=result.pathname&&result.pathname.split("/")||[],relPath=relative.pathname&&relative.pathname.split("/")||[],psychotic=result.protocol&&!slashedProtocol[result.protocol];if(psychotic){result.hostname="";result.port=null;if(result.host){if(srcPath[0]==="")srcPath[0]=result.host;else srcPath.unshift(result.host)}result.host="";if(relative.protocol){relative.hostname=null;relative.port=null;if(relative.host){if(relPath[0]==="")relPath[0]=relative.host;else relPath.unshift(relative.host)}relative.host=null}mustEndAbs=mustEndAbs&&(relPath[0]===""||srcPath[0]==="")}if(isRelAbs){result.host=relative.host||relative.host===""?relative.host:result.host;result.hostname=relative.hostname||relative.hostname===""?relative.hostname:result.hostname;result.search=relative.search;result.query=relative.query;srcPath=relPath}else if(relPath.length){if(!srcPath)srcPath=[];srcPath.pop();srcPath=srcPath.concat(relPath);result.search=relative.search;result.query=relative.query}else if(!util.isNullOrUndefined(relative.search)){if(psychotic){result.hostname=result.host=srcPath.shift();var authInHost=result.host&&result.host.indexOf("@")>0?result.host.split("@"):false;if(authInHost){result.auth=authInHost.shift();result.host=result.hostname=authInHost.shift()}}result.search=relative.search;result.query=relative.query;if(!util.isNull(result.pathname)||!util.isNull(result.search)){result.path=(result.pathname?result.pathname:"")+(result.search?result.search:"")}result.href=result.format();return result}if(!srcPath.length){result.pathname=null;if(result.search){result.path="/"+result.search}else{result.path=null}result.href=result.format();return result}var last=srcPath.slice(-1)[0];var hasTrailingSlash=(result.host||relative.host||srcPath.length>1)&&(last==="."||last==="..")||last==="";var up=0;for(var i=srcPath.length;i>=0;i--){last=srcPath[i];if(last==="."){srcPath.splice(i,1)}else if(last===".."){srcPath.splice(i,1);up++}else if(up){srcPath.splice(i,1);up--}}if(!mustEndAbs&&!removeAllDots){for(;up--;up){srcPath.unshift("..")}}if(mustEndAbs&&srcPath[0]!==""&&(!srcPath[0]||srcPath[0].charAt(0)!=="/")){srcPath.unshift("")}if(hasTrailingSlash&&srcPath.join("/").substr(-1)!=="/"){srcPath.push("")}var isAbsolute=srcPath[0]===""||srcPath[0]&&srcPath[0].charAt(0)==="/";if(psychotic){result.hostname=result.host=isAbsolute?"":srcPath.length?srcPath.shift():"";var authInHost=result.host&&result.host.indexOf("@")>0?result.host.split("@"):false;if(authInHost){result.auth=authInHost.shift();result.host=result.hostname=authInHost.shift()}}mustEndAbs=mustEndAbs||result.host&&srcPath.length;if(mustEndAbs&&!isAbsolute){srcPath.unshift("")}if(!srcPath.length){result.pathname=null;result.path=null}else{result.pathname=srcPath.join("/")}if(!util.isNull(result.pathname)||!util.isNull(result.search)){result.path=(result.pathname?result.pathname:"")+(result.search?result.search:"")}result.auth=relative.auth||result.auth;result.slashes=result.slashes||relative.slashes;result.href=result.format();return result};Url.prototype.parseHost=function(){var host=this.host;var port=portPattern.exec(host);if(port){port=port[0];if(port!==":"){this.port=port.substr(1)}host=host.substr(0,host.length-port.length)}if(host)this.hostname=host}},{"./util":8,punycode:3,querystring:6}],8:[function(require,module,exports){"use strict";module.exports={isString:function(arg){return typeof arg==="string"},isObject:function(arg){return typeof arg==="object"&&arg!==null},isNull:function(arg){return arg===null},isNullOrUndefined:function(arg){return arg==null}}},{}],9:[function(require,module,exports){if(typeof Object.create==="function"){module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:false,writable:true,configurable:true}})}}else{module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor;ctor.prototype.constructor=ctor}}},{}],10:[function(require,module,exports){module.exports=function isBuffer(arg){return arg&&typeof arg==="object"&&typeof arg.copy==="function"&&typeof arg.fill==="function"&&typeof arg.readUInt8==="function"}},{}],11:[function(require,module,exports){(function(process,global){var formatRegExp=/%[sdj%]/g;exports.format=function(f){if(!isString(f)){var objects=[];for(var i=0;i<arguments.length;i++){objects.push(inspect(arguments[i]))}return objects.join(" ")}var i=1;var args=arguments;var len=args.length;var str=String(f).replace(formatRegExp,function(x){if(x==="%%")return"%";if(i>=len)return x;switch(x){case"%s":return String(args[i++]);case"%d":return Number(args[i++]);case"%j":try{return JSON.stringify(args[i++])}catch(_){return"[Circular]"}default:return x}});for(var x=args[i];i<len;x=args[++i]){if(isNull(x)||!isObject(x)){str+=" "+x}else{str+=" "+inspect(x)}}return str};exports.deprecate=function(fn,msg){if(isUndefined(global.process)){return function(){return exports.deprecate(fn,msg).apply(this,arguments)}}if(process.noDeprecation===true){return fn}var warned=false;function deprecated(){if(!warned){if(process.throwDeprecation){throw new Error(msg)}else if(process.traceDeprecation){console.trace(msg)}else{console.error(msg)}warned=true}return fn.apply(this,arguments)}return deprecated};var debugs={};var debugEnviron;exports.debuglog=function(set){if(isUndefined(debugEnviron))debugEnviron=process.env.NODE_DEBUG||"";set=set.toUpperCase();if(!debugs[set]){if(new RegExp("\\b"+set+"\\b","i").test(debugEnviron)){var pid=process.pid;debugs[set]=function(){var msg=exports.format.apply(exports,arguments);console.error("%s %d: %s",set,pid,msg)}}else{debugs[set]=function(){}}}return debugs[set]};function inspect(obj,opts){var ctx={seen:[],stylize:stylizeNoColor};if(arguments.length>=3)ctx.depth=arguments[2];if(arguments.length>=4)ctx.colors=arguments[3];if(isBoolean(opts)){ctx.showHidden=opts}else if(opts){exports._extend(ctx,opts)}if(isUndefined(ctx.showHidden))ctx.showHidden=false;if(isUndefined(ctx.depth))ctx.depth=2;if(isUndefined(ctx.colors))ctx.colors=false;if(isUndefined(ctx.customInspect))ctx.customInspect=true;if(ctx.colors)ctx.stylize=stylizeWithColor;return formatValue(ctx,obj,ctx.depth)}exports.inspect=inspect;inspect.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};inspect.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function stylizeWithColor(str,styleType){var style=inspect.styles[styleType];if(style){return"["+inspect.colors[style][0]+"m"+str+"["+inspect.colors[style][1]+"m"}else{return str}}function stylizeNoColor(str,styleType){return str}function arrayToHash(array){var hash={};array.forEach(function(val,idx){hash[val]=true});return hash}function formatValue(ctx,value,recurseTimes){if(ctx.customInspect&&value&&isFunction(value.inspect)&&value.inspect!==exports.inspect&&!(value.constructor&&value.constructor.prototype===value)){var ret=value.inspect(recurseTimes,ctx);if(!isString(ret)){ret=formatValue(ctx,ret,recurseTimes)}return ret}var primitive=formatPrimitive(ctx,value);if(primitive){return primitive}var keys=Object.keys(value);var visibleKeys=arrayToHash(keys);if(ctx.showHidden){keys=Object.getOwnPropertyNames(value)}if(isError(value)&&(keys.indexOf("message")>=0||keys.indexOf("description")>=0)){return formatError(value)}if(keys.length===0){if(isFunction(value)){var name=value.name?": "+value.name:"";return ctx.stylize("[Function"+name+"]","special")}if(isRegExp(value)){return ctx.stylize(RegExp.prototype.toString.call(value),"regexp")}if(isDate(value)){return ctx.stylize(Date.prototype.toString.call(value),"date")}if(isError(value)){return formatError(value)}}var base="",array=false,braces=["{","}"];if(isArray(value)){array=true;braces=["[","]"]}if(isFunction(value)){var n=value.name?": "+value.name:"";base=" [Function"+n+"]"}if(isRegExp(value)){base=" "+RegExp.prototype.toString.call(value)}if(isDate(value)){base=" "+Date.prototype.toUTCString.call(value)}if(isError(value)){base=" "+formatError(value)}if(keys.length===0&&(!array||value.length==0)){return braces[0]+base+braces[1]}if(recurseTimes<0){if(isRegExp(value)){return ctx.stylize(RegExp.prototype.toString.call(value),"regexp")}else{return ctx.stylize("[Object]","special")}}ctx.seen.push(value);var output;if(array){output=formatArray(ctx,value,recurseTimes,visibleKeys,keys)}else{output=keys.map(function(key){return formatProperty(ctx,value,recurseTimes,visibleKeys,key,array)})}ctx.seen.pop();return reduceToSingleString(output,base,braces)}function formatPrimitive(ctx,value){if(isUndefined(value))return ctx.stylize("undefined","undefined");if(isString(value)){var simple="'"+JSON.stringify(value).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return ctx.stylize(simple,"string")}if(isNumber(value))return ctx.stylize(""+value,"number");if(isBoolean(value))return ctx.stylize(""+value,"boolean");if(isNull(value))return ctx.stylize("null","null")}function formatError(value){return"["+Error.prototype.toString.call(value)+"]"}function formatArray(ctx,value,recurseTimes,visibleKeys,keys){var output=[];for(var i=0,l=value.length;i<l;++i){if(hasOwnProperty(value,String(i))){output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,String(i),true))}else{output.push("")}}keys.forEach(function(key){if(!key.match(/^\d+$/)){output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,key,true))}});
return output}function formatProperty(ctx,value,recurseTimes,visibleKeys,key,array){var name,str,desc;desc=Object.getOwnPropertyDescriptor(value,key)||{value:value[key]};if(desc.get){if(desc.set){str=ctx.stylize("[Getter/Setter]","special")}else{str=ctx.stylize("[Getter]","special")}}else{if(desc.set){str=ctx.stylize("[Setter]","special")}}if(!hasOwnProperty(visibleKeys,key)){name="["+key+"]"}if(!str){if(ctx.seen.indexOf(desc.value)<0){if(isNull(recurseTimes)){str=formatValue(ctx,desc.value,null)}else{str=formatValue(ctx,desc.value,recurseTimes-1)}if(str.indexOf("\n")>-1){if(array){str=str.split("\n").map(function(line){return" "+line}).join("\n").substr(2)}else{str="\n"+str.split("\n").map(function(line){return" "+line}).join("\n")}}}else{str=ctx.stylize("[Circular]","special")}}if(isUndefined(name)){if(array&&key.match(/^\d+$/)){return str}name=JSON.stringify(""+key);if(name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)){name=name.substr(1,name.length-2);name=ctx.stylize(name,"name")}else{name=name.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'");name=ctx.stylize(name,"string")}}return name+": "+str}function reduceToSingleString(output,base,braces){var numLinesEst=0;var length=output.reduce(function(prev,cur){numLinesEst++;if(cur.indexOf("\n")>=0)numLinesEst++;return prev+cur.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(length>60){return braces[0]+(base===""?"":base+"\n ")+" "+output.join(",\n ")+" "+braces[1]}return braces[0]+base+" "+output.join(", ")+" "+braces[1]}function isArray(ar){return Array.isArray(ar)}exports.isArray=isArray;function isBoolean(arg){return typeof arg==="boolean"}exports.isBoolean=isBoolean;function isNull(arg){return arg===null}exports.isNull=isNull;function isNullOrUndefined(arg){return arg==null}exports.isNullOrUndefined=isNullOrUndefined;function isNumber(arg){return typeof arg==="number"}exports.isNumber=isNumber;function isString(arg){return typeof arg==="string"}exports.isString=isString;function isSymbol(arg){return typeof arg==="symbol"}exports.isSymbol=isSymbol;function isUndefined(arg){return arg===void 0}exports.isUndefined=isUndefined;function isRegExp(re){return isObject(re)&&objectToString(re)==="[object RegExp]"}exports.isRegExp=isRegExp;function isObject(arg){return typeof arg==="object"&&arg!==null}exports.isObject=isObject;function isDate(d){return isObject(d)&&objectToString(d)==="[object Date]"}exports.isDate=isDate;function isError(e){return isObject(e)&&(objectToString(e)==="[object Error]"||e instanceof Error)}exports.isError=isError;function isFunction(arg){return typeof arg==="function"}exports.isFunction=isFunction;function isPrimitive(arg){return arg===null||typeof arg==="boolean"||typeof arg==="number"||typeof arg==="string"||typeof arg==="symbol"||typeof arg==="undefined"}exports.isPrimitive=isPrimitive;exports.isBuffer=require("./support/isBuffer");function objectToString(o){return Object.prototype.toString.call(o)}function pad(n){return n<10?"0"+n.toString(10):n.toString(10)}var months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function timestamp(){var d=new Date;var time=[pad(d.getHours()),pad(d.getMinutes()),pad(d.getSeconds())].join(":");return[d.getDate(),months[d.getMonth()],time].join(" ")}exports.log=function(){console.log("%s - %s",timestamp(),exports.format.apply(exports,arguments))};exports.inherits=require("inherits");exports._extend=function(origin,add){if(!add||!isObject(add))return origin;var keys=Object.keys(add);var i=keys.length;while(i--){origin[keys[i]]=add[keys[i]]}return origin};function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}}).call(this,require("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./support/isBuffer":10,_process:2,inherits:9}],12:[function(require,module,exports){module.exports={type:"Topology",objects:{0:{name:"mapbox-gl-extrude",type:"GeometryCollection",properties:{"pop-colorbar":[[0,"#440154"],[2e4,"#472c7a"],[4e4,"#3c508b"],[6e4,"#2d708e"],[8e4,"#228d8d"],[1e5,"#24aa83"],[12e4,"#52c569"],[14e4,"#9bd93c"],[16e4,"#ece51b"]],"density-colorbar":[[0,"#440154"],[2e3,"#453882"],[4e3,"#31668e"],[6e3,"#228d8d"],[8e3,"#2fb47c"],[1e4,"#81d34d"],[12e3,"#efe51c"]]},geometries:[{type:"Polygon",properties:{name:"Ahuntsic-Cartierville",pop:126891,density:4961.868225779869,centroid:[-73.67415923134685,45.55963677315867],"pop-color":"#67cc5c","pop-z":7688.919051572128,"density-color":"#29798e","density-z":4029.396391825679},arcs:[[0,1,2,3,4,5]]},{type:"Polygon",properties:{name:"Anjou",pop:41928,density:3020.9381263873756,centroid:[-73.55647396467437,45.60958367032752],"pop-color":"#3a538b","pop-z":2540.6135816907126,"density-color":"#3c508b","density-z":2453.2205678397936},arcs:[[6,7,8,9,10]]},{type:"Polygon",properties:{name:"Côte-des-Neiges-Notre-Dame-de-Grâce",pop:165031,density:7680.930451318207,centroid:[-73.64007655497313,45.476771421416295],"pop-color":"#fde725","pop-z":1e4,"density-color":"#27ad81","density-z":6237.471863038273},arcs:[[11,12,13,14,15,16,17,18,19,20,21,22,23]]},{type:"Polygon",properties:{name:"Lachine",pop:41616,density:1799.2148205203657,centroid:[-73.6955454776235,45.45306637317464],"pop-color":"#3b528b","pop-z":2521.7080427313654,"density-color":"#46337f","density-z":1461.092752979063},arcs:[[24,25,26,27,28,29,30]]},{type:"Polygon",properties:{name:"LaSalle",pop:74276,density:2947.5365660003063,centroid:[-73.61886810236031,45.43205464417021],"pop-color":"#25848e","pop-z":4500.730165847628,"density-color":"#3c4f8a","density-z":2393.6131842657273},arcs:[[31,32,33,-26]]},{type:"Polygon",properties:{name:"Le Plateau-Mont-Royal",pop:100390,density:12314.172504462129,centroid:[-73.58361190449193,45.52664159364899],"pop-color":"#24aa83","pop-z":6083.099538874515,"density-color":"#fde725","density-z":1e4},arcs:[[34,35,36]]},{type:"Polygon",properties:{name:"Le Sud-Ouest",pop:71546,density:3942.7900999632357,centroid:[-73.58038491349677,45.46962235796394],"pop-color":"#27808e","pop-z":4335.306699953342,"density-color":"#32648e","density-z":3201.8311409349976},arcs:[[-34,37,38,39,40,-20,41,-27]]},{type:"Polygon",properties:{name:"L'Île-Bizard-Sainte-Geneviève",pop:18097,density:495.3315372656391,centroid:[-73.88789291671509,45.489647191742904],"pop-color":"#482878","pop-z":1096.5818543182795,"density-color":"#471063","density-z":402.2450855598719},arcs:[[42,43]]},{type:"Polygon",properties:{name:"Mercier-Hochelaga-Maisonneuve",pop:131483,density:4796.779850341198,centroid:[-73.53674770196567,45.586021701022915],"pop-color":"#77d153","pop-z":7967.169804460979,"density-color":"#2b758e","density-z":3895.3326734728216},arcs:[[44,-9,45,46,47,48]]},{type:"Polygon",properties:{name:"Montréal-Nord",pop:83868,density:6746.590233316801,centroid:[-73.63624252189464,45.595252376001994],"pop-color":"#20928c","pop-z":5081.954299495246,"density-color":"#1e9c89","density-z":5478.719930934965},arcs:[[-5,49,50,-7,51,52]]},{type:"Polygon",properties:{name:"Outremont",pop:23566,density:6179.33780397759,centroid:[-73.60778314528575,45.514137583566054],"pop-color":"#46327e","pop-z":1427.9741381922183,"density-color":"#21918c","density-z":5018.069871717699},arcs:[[53,-23,54,-36,55,56]]},{type:"Polygon",properties:{name:"Pierrefonds-Roxboro",pop:68410,density:2025.850885626828,centroid:[-73.85546306595447,45.48018296248366],"pop-color":"#287c8e","pop-z":4145.281795541444,"density-color":"#443983","density-z":1645.1376532956206},arcs:[[57,58,59,60,61,-1,62,-43]]},{type:"Polygon",properties:{name:"Rivière-des-Prairies-Pointe-aux-Trembles",pop:106437,density:2126.6193839015446,centroid:[-73.51819795680828,45.655445996580596],"pop-color":"#2eb37c","pop-z":6449.515545564167,"density-color":"#443b84","density-z":1726.9689726459076},arcs:[[-52,-11,63,64]]},{type:"Polygon",properties:{name:"Rosemont-La Petite-Patrie",pop:134038,density:8436.533947804195,centroid:[-73.5824434131883,45.55486910744227],"pop-color":"#81d34d","pop-z":8121.98920202871,"density-color":"#3dbc74","density-z":6851.076631212659},arcs:[[65,-56,-35,-47,66]]},{type:"Polygon",properties:{name:"Saint-Laurent",pop:93842,density:2178.233263512947,centroid:[-73.72562447452381,45.498049709026134],"pop-color":"#1fa188","pop-z":5686.325599432835,"density-color":"#433d84","density-z":1768.8831813291947},arcs:[[67,68,-30,69,70,-2,-62]]},{type:"Polygon",properties:{name:"Saint-Léonard",pop:75707,density:5586.6107679599045,centroid:[-73.58617470468465,45.585977718886404],"pop-color":"#24868e","pop-z":4587.441147420787,"density-color":"#25858e","density-z":4536.732586729279},arcs:[[71,-67,-46,-8,-51]]},{type:"Polygon",properties:{name:"Verdun",pop:66158,density:2962.520872964788,centroid:[-73.56316142205539,45.46236208307733],"pop-color":"#2a788e","pop-z":4008.8225848476955,"density-color":"#3c4f8a","density-z":2405.7815268474574},arcs:[[72,-38,-33]]},{type:"Polygon",properties:{name:"Ville-Marie",pop:84013,density:3907.190869457255,centroid:[-73.57491334988144,45.50596260845277],"pop-color":"#20928c","pop-z":5090.740527537251,"density-color":"#32648e","density-z":3172.921987280474},arcs:[[-48,-37,-55,-22,73,-40,74]]},{type:"Polygon",properties:{name:"Villeray-Saint-Michel-Parc-Extension",pop:142222,density:8630.670660703216,centroid:[-73.62193788393165,45.55450956747774],"pop-color":"#a2da37","pop-z":8617.89603165466,"density-color":"#44bf70","density-z":7008.729703580026},arcs:[[-4,75,-57,-66,-72,-50]]},{type:"Polygon",properties:{name:"Baie-d'Urfé",pop:3850,density:479.6584640206323,centroid:[-73.91405140299823,45.412354483351244],"pop-color":"#46085c","pop-z":233.28950318425024,"density-color":"#470e61","density-z":389.5174148704061},arcs:[[76,77,78]]},{type:"Polygon",properties:{name:"Beaconsfield",pop:19505,density:782.5770450710299,centroid:[-73.869979000846,45.428304831750324],"pop-color":"#472a7a","pop-z":1181.8991583399481,"density-color":"#48186a","density-z":635.5092433433571},arcs:[[79,80,81,82,-77]]},{type:"MultiPolygon",properties:{name:"Côte-Saint-Luc",pop:32321,density:4745.513787351189,centroid:[-73.65871115809352,45.464768202202315],"pop-color":"#414287","pop-z":1958.4805279008185,"density-color":"#2b748e","density-z":3853.700917078771},arcs:[[[-70,-29,83,-18,84,-12]],[[85,-14]],[[-16,86]]]},{type:"Polygon",properties:{name:"Dollard-des-Ormeaux",pop:49637,density:3294.5250950053123,centroid:[-73.82648604559515,45.491166372667095],"pop-color":"#355f8d","pop-z":3007.7379401445787,"density-color":"#39568c","density-z":2675.393002503024},arcs:[[87,88,89,-68,-61]]},{type:"Polygon",properties:{name:"Dorval",pop:18208,density:646.609514942322,centroid:[-73.74256516976043,45.46082836949516],"pop-color":"#482878","pop-z":1103.3078633711243,"density-color":"#481467","density-z":525.0937606307028},arcs:[[90,91,-31,-69,-90],[92]]},{type:"Polygon",properties:{name:"Hampstead",pop:7153,density:4045.3142221597,centroid:[-73.64171257010618,45.4786896881529],"pop-color":"#471164","pop-z":433.43371851349144,"density-color":"#31678e","density-z":3285.0881540711334},arcs:[[-85,-17,-87,-15,-86,-13]]},{type:"Polygon",properties:{name:"Kirkland",pop:21253,density:2193.670660524318,centroid:[-73.87902237538324,45.45192779285516],"pop-color":"#472d7b","pop-z":1287.818652253213,"density-color":"#433d84","density-z":1781.4194658467109},arcs:[[-82,93,-88,-60,94]]},{type:"Polygon",properties:{name:"L'Île-Dorval",pop:5,density:27.6966687529606,centroid:[-73.74151473086185,45.43245852577515],"pop-color":"#440154","pop-z":.30297338075876656,"density-color":"#440154","density-z":22.491701121552843},arcs:[[-93]]},{type:"Polygon",properties:{name:"Montréal-Est",pop:3728,density:266.7637088083333,centroid:[-73.52664821591028,45.62797830459412],"pop-color":"#46085c","pop-z":225.89695269373635,"density-color":"#46085c","density-z":216.6314534831062},arcs:[[-64,-10,-45,95]]},{type:"Polygon",properties:{name:"Montréal-Ouest",pop:5085,density:3582.001695577735,centroid:[-73.65400506453325,45.45488117181161],"pop-color":"#460b5e","pop-z":308.12392823166556,"density-color":"#365d8d","density-z":2908.8448243515923},arcs:[[-28,-42,-19,-84]]},{type:"Polygon",properties:{name:"Mont-Royal",pop:19503,density:2619.180731521667,centroid:[-73.65776375653466,45.50438989954612],"pop-color":"#472a7a","pop-z":1181.7779689876447,"density-color":"#3f4788","density-z":2126.9644635663403},arcs:[[-71,-24,-54,-76,-3]]},{type:"Polygon",properties:{name:"Pointe-Claire",pop:30790,density:893.7539289105686,centroid:[-73.80229717088228,45.44457424544323],"pop-color":"#423f85","pop-z":1865.7100787124843,"density-color":"#481b6d","density-z":725.7929256608272},arcs:[[-81,96,-91,-89,-94]]},{type:"Polygon",properties:{name:"Sainte-Anne-de-Bellevue",pop:5073,density:454.9157491719321,centroid:[-73.92945251277767,45.42849890159742],"pop-color":"#460b5e","pop-z":307.39679211784454,"density-color":"#470e61","density-z":369.42453827659966},arcs:[[-78,-83,-95,-59,97,98]]},{type:"Polygon",properties:{name:"Senneville",pop:920,density:49.43388949103907,centroid:[-73.96587734935103,45.43364022100779],"pop-color":"#440256","pop-z":55.74710205961305,"density-color":"#440256","density-z":40.14389880694488},arcs:[[-98,-58,99]]},{type:"Polygon",properties:{name:"Westmount",pop:19931,density:4962.048690211099,centroid:[-73.59740453929449,45.48480473610579],"pop-color":"#472a7a","pop-z":1207.712490380595,"density-color":"#29798e","density-z":4029.542942015036},arcs:[[-21,-41,-74]]}]}},arcs:[[[-73.7636321275885,45.5119344933272],[-73.7612309506519,45.5104047165094],[-73.7611349153639,45.5103427559007],[-73.7551670016324,45.5064847747152],[-73.7550640438883,45.5065227142585]],[[-73.7550640438883,45.5065227142585],[-73.75205500101,45.5076217923965],[-73.7487010809923,45.508834818651],[-73.7479160370762,45.5091238826921],[-73.7401980887296,45.5119328561758],[-73.7350991302198,45.513785840003],[-73.7285011626726,45.5160866844387],[-73.7358992375735,45.5207279662727],[-73.7335791358777,45.5223699339036],[-73.7317670926602,45.5236728955001],[-73.7280651988295,45.5213507656331],[-73.7253480834467,45.5236707616028],[-73.7228480546355,45.5257777581423],[-73.7217051601094,45.5267448129993],[-73.7184940800218,45.5247427935226],[-73.7180881815427,45.5250657364208],[-73.7172921525596,45.5256957496755],[-73.7146471352446,45.5239867664037],[-73.7145582286775,45.5239307786904],[-73.7131142237409,45.5251598050071],[-73.7124052797546,45.5248747718855],[-73.7120052608426,45.5246927414453],[-73.7111132891695,45.5242227462703],[-73.7107852407182,45.5240277992522],[-73.7092593528495,45.5230447388544],[-73.7027882507738,45.5253738858166],[-73.70159921875,45.5258008543614],[-73.6990391606697,45.5267128447679],[-73.6982051687726,45.5270128932336],[-73.6951281514722,45.5280598695451],[-73.6938882218894,45.5283639275633],[-73.6926142206739,45.5285909080044],[-73.6916091271405,45.5287129390014],[-73.6903351442363,45.5287970057747],[-73.6890601568571,45.5288030355207],[-73.6880801391526,45.5287550998146],[-73.687082125088,45.5286601056346],[-73.6863731374072,45.5292350736983],[-73.6857030725034,45.529704135964],[-73.6851710908417,45.530131124246],[-73.6833001001956,45.5305671172463],[-73.6831171190403,45.5306081755598],[-73.6806030984421,45.5311841407141],[-73.6796871204911,45.5313901286163],[-73.6779741174318,45.5317860751287],[-73.6771030794354,45.5319820830237],[-73.6764130851363,45.5321250676708],[-73.6754170953927,45.5322511479678],[-73.6747560797402,45.5323071455381],[-73.6735201535736,45.5323251415563],[-73.6726120976454,45.532299071996],[-73.6716881123919,45.5322091243518],[-73.6709941458118,45.5321231426362],[-73.6703721242683,45.5320111324031],[-73.6698852271887,45.5318830782507],[-73.6688721548177,45.5315921045001],[-73.6653972113726,45.5305941172536],[-73.6553050268881,45.527667013906],[-73.6545840901521,45.5274640727694],[-73.6545450912508,45.5274130989125],[-73.6538981115597,45.5272240899945],[-73.6510260686543,45.5263880213419],[-73.6507508626002,45.526307356847]],[[-73.6507508626002,45.526307356847],[-73.6503609034947,45.5269752375581],[-73.6499925353766,45.5276040725009],[-73.6489075944103,45.5294635493114],[-73.6481900695937,45.5307189032401]],[[-73.6481900695937,45.5307189032401],[-73.6485460602073,45.5308259961571],[-73.6481519889812,45.5314029916612],[-73.6476840192056,45.532154034167],[-73.6465820665633,45.5338750084239],[-73.6456860340674,45.5352839811114],[-73.6445750706039,45.5369929835244],[-73.6428100414146,45.53972799897],[-73.6424291071358,45.5403229636646],[-73.6417201180962,45.5414229201372],[-73.6409111187669,45.5426690061778],[-73.6407200599337,45.5429700086082],[-73.6405361155058,45.5432449919816],[-73.6403841374698,45.5434630584198],[-73.640235098695,45.5436740119722],[-73.6401051683779,45.5438390440122],[-73.6398581134794,45.5441380427215],[-73.639092093523,45.5450270548791],[-73.6373581444485,45.5470351489519],[-73.6366981968622,45.5477931804644],[-73.6364111235183,45.5481141852534],[-73.6361041936503,45.5483942668237],[-73.6356551216059,45.5487372489939],[-73.6353301588158,45.5489452652027],[-73.6349071237386,45.5491803091316],[-73.6345621764619,45.5493383112249],[-73.6340401201237,45.5495593444689],[-73.6335852049138,45.5497193673362],[-73.6331651592782,45.54984037658],[-73.6329301367233,45.549894383538],[-73.6324192023658,45.5500004670166],[-73.6316141237934,45.5501324468769],[-73.6310751313493,45.5502124531807],[-73.6305082054078,45.5503194875295],[-73.6299691180916,45.5504505131903],[-73.6295421944851,45.5505715068935],[-73.6289972199514,45.5507594904274],[-73.6285032020809,45.5509615270265],[-73.6279842581879,45.5512124555464],[-73.62637030564,45.5520764364301],[-73.6240034059426,45.5533584277211],[-73.6227974728936,45.5540083924846],[-73.6219445490679,45.5545664425535],[-73.6240414507808,45.5555243904139],[-73.626243402559,45.5564753282985],[-73.6281222687352,45.5572943664098],[-73.6307432345542,45.5584283070036],[-73.6330432538957,45.5594313029232],[-73.6379311791654,45.561562227186],[-73.6426181420955,45.5636010776724],[-73.6446641310423,45.5644710444822],[-73.645366195089,45.5647650509692],[-73.6451721352376,45.5650700964055],[-73.6448991598805,45.5654650534882],[-73.644618196297,45.5658370714957],[-73.6443951091125,45.5661170447119],[-73.6439391845691,45.5666680922101],[-73.6423560704545,45.5685690157697],[-73.6379621579698,45.5738229101809],[-73.6367480877894,45.5752699289438],[-73.6362380591395,45.5758819553338],[-73.6363220615251,45.5759169506436],[-73.636516910282,45.5759962946569]],[[-73.636516910282,45.5759962946569],[-73.6369531219932,45.576173921453],[-73.6379681218961,45.576585921362],[-73.6396461754081,45.5772668814451],[-73.6400152208376,45.5774248071775],[-73.640241263009,45.5775388144658],[-73.6404991812588,45.5777198264996],[-73.6405212334128,45.5777048597193],[-73.6415202997503,45.5781088387766],[-73.6418182337917,45.5782297763134],[-73.6442372863102,45.5792088398087],[-73.6444592716443,45.5793017932738],[-73.6447562775423,45.5794257897121],[-73.6468943654411,45.580309862381],[-73.647192330628,45.5804338502934],[-73.6473953136524,45.5805318622046],[-73.6476903155312,45.5806538725617],[-73.6508074043189,45.5819558671893],[-73.6525574147144,45.5826878787088],[-73.6524713297819,45.5828649174387],[-73.6540893290933,45.5835387277216],[-73.6543033315624,45.5836305207479]],[[-73.6543033315624,45.5836305207479],[-73.6543294778833,45.5835797276423],[-73.654355032574,45.5835526982885],[-73.6544445361578,45.5834805905811],[-73.6545081610564,45.5833185379655],[-73.654635935742,45.5831833883307],[-73.6547633871501,45.5829312623281],[-73.6548142482233,45.5827872207102],[-73.6549159944654,45.5825081358577],[-73.6549285356425,45.5824091382417],[-73.6551072664008,45.5821658497436],[-73.6552218994538,45.581913833277],[-73.6552858467665,45.5818687543196],[-73.6554138906232,45.5818325853212],[-73.6555033167615,45.5817334821655],[-73.6555156822236,45.5815714978804],[-73.6555798285077,45.5815984041262],[-73.655643875025,45.5815893177566],[-73.6557718431188,45.5815261542721],[-73.6561939377884,45.5812465385548],[-73.6563220047785,45.581219367358],[-73.6565268065812,45.5811381921447],[-73.6566676873656,45.5811110029979],[-73.6569493227547,45.5810116340076],[-73.6571028661118,45.5809304384309],[-73.6576014055045,45.5804978394645],[-73.6580107208923,45.5802363277017],[-73.658151370736,45.5801281558293],[-73.658342844509,45.5798669467839],[-73.6583426922874,45.5798129588697],[-73.6583169376869,45.5797680047009],[-73.6582270122708,45.5796871473214],[-73.6582525132364,45.5796421217984],[-73.6583166840227,45.5796780248262],[-73.6583165318247,45.5796240369004],[-73.6583806770848,45.5796509410315],[-73.6584578392487,45.5797498106304],[-73.6584579915644,45.5798037985329],[-73.6584837462113,45.5798487523552],[-73.6585477901048,45.5798396641078],[-73.6586882087601,45.5796505078259],[-73.658841669336,45.579542315186],[-73.6589696545865,45.5794881464437],[-73.6590719099358,45.5793979310242],[-73.6590974101111,45.5793529049475],[-73.6590972320575,45.5792900100148],[-73.6590200949378,45.5792001388685],[-73.6590584088084,45.5791550945461],[-73.6591864441259,45.5791189210451],[-73.6594038435544,45.578965645045],[-73.6595318782071,45.5789294712036],[-73.6596854633412,45.5788662665799],[-73.6597366156972,45.5788302014837],[-73.6599026044623,45.5786230087251],[-73.6600427855742,45.5783528654602],[-73.6601578510567,45.5782627206111],[-73.6601830165969,45.5781007183184],[-73.6600287425999,45.5779209745506],[-73.6600542413868,45.5778759476454],[-73.6602078999277,45.5778397368758],[-73.6605149594859,45.5776773337476],[-73.6606428618674,45.5775961684212],[-73.6607322978613,45.5775059687764],[-73.6607704036089,45.5773890295979],[-73.6607824448711,45.577119068376],[-73.6606788072824,45.5767232979587],[-73.6606783183901,45.5765522431595],[-73.6607036619515,45.5764533184574],[-73.6606263977426,45.5763184563198],[-73.6606006944992,45.5762914984605],[-73.6606004117501,45.5761925193326],[-73.6606644512138,45.5761834301106],[-73.6607284134808,45.5761473465509],[-73.6608434475246,45.576048203288],[-73.6608815775316,45.5759401713509],[-73.6610731534435,45.5757239431321],[-73.6611368054195,45.5755798822329],[-73.6611751151138,45.5755348369316],[-73.6612512697442,45.5752827805718],[-73.6612124958302,45.5751658601408],[-73.6611739284537,45.5751209244628],[-73.6611719892425,45.5751023811728],[-73.6610386131075,45.5749741606116],[-73.661434532672,45.5750575756082],[-73.6613899892135,45.5751581105419],[-73.6615333262246,45.575188320402],[-73.6615778694467,45.57508778543],[-73.6621519552865,45.5752087756145],[-73.6621074130111,45.57530931074],[-73.6622507495194,45.5753395187446],[-73.6618276301212,45.5754986497863],[-73.6617773465007,45.5755429745622],[-73.661764714868,45.5756059795308],[-73.6617908586156,45.5757859046292],[-73.6617147834139,45.5760649554676],[-73.6617280365095,45.5762179046403],[-73.661702695148,45.5763169203145],[-73.6616138053892,45.5765958986137],[-73.6614991079157,45.5768121086886],[-73.6614355588382,45.5769921621582],[-73.6614357655659,45.5770641468883],[-73.6614615212659,45.5771091006826],[-73.661512929377,45.5771630158829],[-73.6616412430966,45.5772258190412],[-73.661654211631,45.5772797892159],[-73.6616031912997,45.5773608454307],[-73.6613991859893,45.5777120644303],[-73.6613742566696,45.5779550495476],[-73.6612977116615,45.578072134729],[-73.6609912446644,45.5784414052345],[-73.6608121640271,45.5785497293566],[-73.6606206544713,45.5787929521046],[-73.6606081493297,45.5789009475489],[-73.6606856228835,45.5791077941562],[-73.6606092030358,45.5792698678086],[-73.6603410119052,45.5795851795168],[-73.6601751241821,45.5798283614038],[-73.6600346070201,45.5799815271873],[-73.6599454472161,45.5801706118342],[-73.6598049796737,45.5803416825264],[-73.6596771214795,45.5804409330057],[-73.6595235580605,45.5805131349887],[-73.6593828593316,45.5806033145717],[-73.6590628657801,45.5807297399524],[-73.6587557359072,45.5808741424403],[-73.6584614949341,45.5810455201409],[-73.6579363930819,45.5811452332945],[-73.6575907884234,45.5812805947667],[-73.6575396580234,45.5813257471511],[-73.6574632773488,45.5815058148445],[-73.6572461907953,45.5817760594062],[-73.6571694307564,45.5818211566956],[-73.6571568934999,45.5819201530954],[-73.6569646025524,45.581893426433],[-73.6569134457266,45.5819294899697],[-73.6568879678834,45.5819835140042],[-73.6568497007454,45.5820465539403],[-73.6569137978591,45.5820554628789],[-73.6569523668334,45.5821003996964],[-73.6569015116263,45.5822444400809],[-73.6568890241247,45.5823614327799],[-73.6568124390015,45.582469516707],[-73.6568766120148,45.5825054196925],[-73.6569533983365,45.5824693202448],[-73.6570039767783,45.5822263011663],[-73.6570806115857,45.5821362134687],[-73.6571445577047,45.5820911339195],[-73.6572214441158,45.5820910267434],[-73.6572728277616,45.5821359454835],[-73.6573368998197,45.5821358560833],[-73.6577204474804,45.5818203882948],[-73.6588204421078,45.5810990012789],[-73.6590251621571,45.5809907355414],[-73.6592556626265,45.5809364210072],[-73.6594990278316,45.5809000837947],[-73.6594735783868,45.580963105918],[-73.6592815712606,45.5810353623172],[-73.659307326954,45.5810803158104],[-73.6595633790621,45.580998970414],[-73.6597040017154,45.5808817966589],[-73.6598959567618,45.5807915437512],[-73.6604209476117,45.5806558258484],[-73.6605360683747,45.5805836776446],[-73.660638041,45.5803945743921],[-73.6607146418764,45.5802953962879],[-73.660893651562,45.5801602615778],[-73.6610213017416,45.5799891174123],[-73.6611492345515,45.5799169504791],[-73.6611872897747,45.5797819263934],[-73.661442122197,45.5792776749359],[-73.6614548069665,45.5792326669106],[-73.6614290247432,45.5791787160501],[-73.6614288180828,45.5791067315754],[-73.6614924729997,45.5789626703497],[-73.6616586108524,45.5788094640052],[-73.6616968705801,45.578746422253],[-73.6618246959741,45.5786382613133],[-73.6618886603159,45.5786021769692],[-73.6619144171028,45.578647130571],[-73.6619784591882,45.5786380404269],[-73.6620039567163,45.5785930131827],[-73.6620678949435,45.5785479306689],[-73.6621571746505,45.5784038323785],[-73.6621698324278,45.5783498254639],[-73.6621696506974,45.578286838901],[-73.662105401442,45.5782239444711],[-73.6621051419332,45.578133963657],[-73.6623606058554,45.5778546544995],[-73.6626419811783,45.577674285748],[-73.6628593399635,45.5775119134153],[-73.6631535776804,45.5773496104757],[-73.6633453325892,45.5771963631501],[-73.6634221075573,45.5771602587606],[-73.6634862264871,45.5771781615669],[-73.6635502142529,45.5771510738557],[-73.6637417301876,45.5769168427462],[-73.6639591072286,45.5767635565803],[-73.6642143414677,45.5764122551066],[-73.6644437603828,45.5759980035025],[-73.6646479198335,45.5757097623995],[-73.6647501310105,45.5756106322229],[-73.6648649952961,45.5754574942903],[-73.6649161401828,45.5754214262582],[-73.6649797259544,45.5752593655346],[-73.6650437363209,45.5752412747697],[-73.6650948542025,45.5751962084918],[-73.6651329997775,45.5750971723247],[-73.6653246323167,45.5749079284548],[-73.6654777484103,45.5746916570976],[-73.6655417056162,45.5746556610023],[-73.6657842961783,45.574367363114],[-73.6658733739107,45.5741602752326],[-73.6659116786837,45.5741152280428],[-73.6659756613061,45.574088138921],[-73.6659912253823,45.574055794734],[-73.6659861657844,45.5740227792867],[-73.6660042176511,45.5739837908266],[-73.6660322338696,45.5739517970865],[-73.6660571730633,45.5739147779806],[-73.6660752214047,45.573869840889],[-73.6660822134602,45.573837797353],[-73.6660971623969,45.5738197790124],[-73.6661081545522,45.5737838522676],[-73.6660782138114,45.5737028240038],[-73.6660451524281,45.5736358283603],[-73.6660292472256,45.5736158753145],[-73.6660182008944,45.5735977974584],[-73.6660021807574,45.5735788352665],[-73.6659471828092,45.5735298772678],[-73.6658991847146,45.5734488666959],[-73.6658811501606,45.5734258583296],[-73.66586321027,45.5733988807652],[-73.6658442506075,45.5733828031844],[-73.6658192352556,45.5733578255671],[-73.6657992082639,45.5733408488496],[-73.6657511997509,45.5732918713806],[-73.6656981987171,45.5732408407128],[-73.6656382113062,45.5731798234767],[-73.6656152186171,45.5731598808381],[-73.6656081780597,45.5731358582663],[-73.6655852250337,45.5730958507311],[-73.6655262600397,45.5730238542408],[-73.6654982456967,45.5729858328406],[-73.6654631741905,45.5729538433771],[-73.665436180127,45.5729028641037],[-73.6653882396772,45.5728768404554],[-73.665296263709,45.5728299072391],[-73.6652031900312,45.5728079092635],[-73.6651251605569,45.5727929075393],[-73.6650252218704,45.5727699207431],[-73.6649212545737,45.5727769205301],[-73.6648122068798,45.57277987136],[-73.6647871661746,45.5727818877865],[-73.6647662509827,45.5727838972386],[-73.6645842076434,45.5727989226841],[-73.6645342319254,45.5728049348598],[-73.6644482255442,45.5728109099466],[-73.6643761917813,45.5728228931873],[-73.6643092655831,45.5728508855059],[-73.6642531809486,45.5728569065264],[-73.6641792614805,45.5728769097218],[-73.6641292184075,45.5728958781905],[-73.6640562523618,45.5729129015434],[-73.6639972550726,45.5729398931872],[-73.6639662524111,45.5729628927467],[-73.6639421904269,45.5729758852461],[-73.663926187915,45.5729978640441],[-73.6639052011025,45.5730109420159],[-73.6636492758314,45.5733859434528],[-73.6634952337208,45.573543923354],[-73.663464253833,45.5735749220917],[-73.6633962288318,45.573622900356],[-73.6633622805756,45.5736509340307],[-73.663330245455,45.5736839129639],[-73.6633111861738,45.5737078856439],[-73.6632832143338,45.5737908890135],[-73.6632592331837,45.5738318734938],[-73.6632332114655,45.573858905783],[-73.6632202850486,45.5738818707157],[-73.6631652509425,45.5739279403205],[-73.6631392712134,45.5739699093923],[-73.663117236149,45.573987946738],[-73.6630732888396,45.5740319215798],[-73.6630662714626,45.5740509178191],[-73.6630632703309,45.5740759369368],[-73.6630482545991,45.5741079111098],[-73.6630333002537,45.5741239495407],[-73.6630072117697,45.5741328956898],[-73.6629962406435,45.5741749418469],[-73.6629752170148,45.5742108749387],[-73.6629432816046,45.5742439445303],[-73.6629322554219,45.574267904564],[-73.6628821967431,45.5743169271977],[-73.6628642753426,45.5743309003682],[-73.6628452302844,45.5743599110157],[-73.6628321984524,45.574385934531],[-73.6628132454456,45.5744069268244],[-73.6628072686307,45.5744269122321],[-73.6627882217045,45.5744508740359],[-73.6627512962549,45.5745129337691],[-73.6627422757593,45.5745349022898],[-73.6627162431112,45.5745578952578],[-73.6626892783888,45.5745908666838],[-73.662629214703,45.5746888634225],[-73.6626012788376,45.5747139188075],[-73.6625822606708,45.574747877449],[-73.6625772446929,45.5747678614535],[-73.6625663064345,45.5747868633779],[-73.662548278667,45.5748048858176],[-73.6625363100899,45.5748309167644],[-73.6625362710999,45.5748528722171],[-73.6625342137824,45.5748729401007],[-73.6625212633563,45.5748908660745],[-73.6624973143315,45.5749038581245],[-73.6624065645402,45.5749878563175],[-73.6611121082933,45.5747150415948],[-73.6611227862217,45.5746917463844],[-73.6612013356308,45.5746996356301],[-73.661259018778,45.5745685152694],[-73.6612757290619,45.5745345864538],[-73.6613229450101,45.5744386313596],[-73.6613704069773,45.5743427335048],[-73.6613864536663,45.5743097747365],[-73.6615001526896,45.574054716048],[-73.6616121985163,45.5737838275218],[-73.6617184471029,45.5735201044135],[-73.6618093643696,45.5732584970759],[-73.6618245797053,45.5732022091517],[-73.66188688627,45.5729309129978],[-73.6619055197703,45.5728114938249],[-73.661928924274,45.5726582132888],[-73.6619371254052,45.5724524179574],[-73.6619394445405,45.5722133415261],[-73.6617552777395,45.5721265612729],[-73.6617581287901,45.5720230120771],[-73.6617590805989,45.571998494404],[-73.6619234194953,45.5714454170276],[-73.6619173099023,45.571398019961],[-73.661929704932,45.5713386848382],[-73.6619752143024,45.5712306083132],[-73.6620970585141,45.5709923749881],[-73.6621650910892,45.5708702203365],[-73.6621993291393,45.5708265072845],[-73.6622475139623,45.5707754589285],[-73.6623041715318,45.5707254080816],[-73.6623578079765,45.5706887093288],[-73.6625509517889,45.5705455166661],[-73.6625707854337,45.5705227811846],[-73.6625057944051,45.570457993553],[-73.6624664775958,45.5701521138133],[-73.6624657776208,45.5699091656896],[-73.6625670249546,45.5694771104034],[-73.6625540579269,45.5694231404827],[-73.6625535650794,45.5692521770058],[-73.6626423099404,45.5689281164321],[-73.6629481406329,45.5683607924064],[-73.6635874921175,45.5679459514179],[-73.6635345759627,45.5673701497009],[-73.6634311235079,45.5670373700117],[-73.663198758472,45.5664258298288],[-73.6633762252316,45.5657776943646],[-73.6634393094005,45.565444665783],[-73.6635030198004,45.5653275958897],[-73.6638857706871,45.5647961445675],[-73.6641922300925,45.5644626756093],[-73.664345576434,45.5643365696472],[-73.6644478945524,45.564282432489],[-73.6649978546537,45.5639936945392],[-73.6651897563375,45.5639124330378],[-73.665624767087,45.5637408372953],[-73.6657657234452,45.5637586291879],[-73.6659194086602,45.5637494079035],[-73.6663035267588,45.5636948605341],[-73.6666494595535,45.5637213508768],[-73.6667902901452,45.5636941469705],[-73.6669949834628,45.5636038601403],[-73.667135651987,45.5635225759789],[-73.6672378900749,45.5634415309414],[-73.6673658841117,45.5634053469223],[-73.6674170165013,45.5633692779192],[-73.6684651150222,45.5625937760875],[-73.6691044143484,45.5621879846467],[-73.6694497231347,45.5619985007424],[-73.670076066914,45.5615476435556],[-73.6704977123656,45.5611870775768],[-73.6706384037799,45.5611148787093],[-73.6707662307915,45.5610247030325],[-73.6711495423986,45.5607000915528],[-73.6714181080845,45.5605557993166],[-73.6716991819063,45.5603124172854],[-73.6719164790526,45.5601591144088],[-73.6727716128164,45.5591410087009],[-73.6730396446643,45.5588255701786],[-73.6732563003912,45.5584654025223],[-73.6733326594825,45.5583033186804],[-73.6733833722406,45.5581322752691],[-73.6736507337916,45.5576009707092],[-73.673739733851,45.5573848776095],[-73.6737902793684,45.5571598460067],[-73.673866469668,45.5569437729363],[-73.6738783950816,45.5566558143169],[-73.6739036535872,45.5565387995814],[-73.6739018315208,45.5559449258125],[-73.6739905801044,45.555647850667],[-73.6740671549077,45.5555577513116],[-73.6742071913427,45.5552785935712],[-73.6744749507242,45.5548822635847],[-73.6745517178784,45.5548551508168],[-73.674641071714,45.5547560337817],[-73.6747427070269,45.5544859339675],[-73.6748574825544,45.5543237911437],[-73.674921440673,45.5542966981471],[-73.67517690646,45.554071345397],[-73.6753938321674,45.5538100551587],[-73.6756493190999,45.5535936963462],[-73.6756875749547,45.5535396468149],[-73.6758536291035,45.5533954145139],[-73.6760706056195,45.5531521218965],[-73.6763261155523,45.5529447621981],[-73.6763643704274,45.5528907129171],[-73.6764921105631,45.5527825341216],[-73.6767472244485,45.5524492008077],[-73.6769639412063,45.5521249265674],[-73.6771169842454,45.5519177288688],[-73.6773852367613,45.5516923546954],[-73.6778831727933,45.551196677166],[-73.6780490460727,45.5509984588091],[-73.6783045972807,45.550809098247],[-73.678649371771,45.5504845360632],[-73.6787643245588,45.5503854680076],[-73.6789943704825,45.5502321402914],[-73.6790965432893,45.5501419995894],[-73.6791984308024,45.549961877629],[-73.6792492018763,45.5498178250343],[-73.6793248724436,45.5494487768439],[-73.6793373650912,45.5493497763356],[-73.679311351524,45.5492238420839],[-73.6792341679778,45.5491159852517],[-73.6791443204704,45.5490531392645],[-73.6791055574929,45.5489452209345],[-73.6792332258311,45.5488190444071],[-73.6792458612596,45.5487650349259],[-73.6792201050686,45.5487200843511],[-73.6792583824523,45.5486750326254],[-73.6793225016769,45.5487019260678],[-73.6793864780963,45.5486838284565],[-73.6794375620318,45.5486387564843],[-73.6794762108167,45.548710681291],[-73.6795661152132,45.5487915231583],[-73.6796430414365,45.5488183960453],[-73.6798351997763,45.5488360879678],[-73.6798993194295,45.5488629809238],[-73.6800020887148,45.5489617981498],[-73.6800278742619,45.5490157464494],[-73.6800024040278,45.5490607779516],[-73.679951320159,45.5491058501487],[-73.6798745939516,45.5491419648571],[-73.6798235385565,45.5491960352321],[-73.6797982112664,45.5492860576483],[-73.679862560537,45.5493849358173],[-73.6799266807878,45.5494118285301],[-73.6801444261523,45.5494204802966],[-73.6808355937985,45.5492934035945],[-73.6813732211408,45.5492115604117],[-73.6821026592555,45.5490394261937],[-73.6824483262647,45.5490028779807],[-73.6828451035591,45.5489302542612],[-73.6833316145823,45.5488844785823],[-73.6837411426635,45.5487938351492],[-73.6838947958166,45.5487845879509],[-73.6840999105323,45.5488472407834],[-73.6842154067086,45.5489190368052],[-73.6843562825065,45.5489188076171],[-73.6844204049031,45.5489456971007],[-73.6846901128726,45.5491792039735],[-73.6848182997739,45.5492149863805],[-73.685177100286,45.54927738501],[-73.685625550302,45.549339635067],[-73.6857408130611,45.5493394457988],[-73.6860480622464,45.5493029493122],[-73.6862144345399,45.5492666841535],[-73.6863551335743,45.5492124654675],[-73.6865982878654,45.5491580778347],[-73.687135525941,45.5489592396004],[-73.6874040248139,45.548823829238],[-73.6877617885132,45.5485712125379],[-73.6881574667539,45.5481657531286],[-73.6882596544819,45.5480846048728],[-73.6885402441639,45.5477332290716],[-73.688655267468,45.547660966075],[-73.6887448861838,45.5476518202223],[-73.6890267887613,45.5476964337199],[-73.6891420512939,45.5476962428846],[-73.6902428177188,45.5475054609866],[-73.6903067621302,45.5474783610707],[-73.6906651148949,45.5474057809385],[-73.6909083556321,45.5473783811269],[-73.6913562952418,45.5472876533083],[-73.6916252095451,45.5472782044887],[-73.6919070174029,45.5472957262358],[-73.6920222168903,45.5472775366967],[-73.6922908839613,45.5471961038018],[-73.6924445029918,45.547177849079],[-73.6926494092242,45.5471775031056],[-73.6927904039141,45.5472132559702],[-73.6928416305082,45.547213169353],[-73.6929698492284,45.5472579413625],[-73.693162314916,45.5473655888404],[-73.6932520227284,45.5473834323806],[-73.6933929268687,45.5473921912395],[-73.6937386464413,45.5473736087585],[-73.6941740738744,45.5473728680427],[-73.6946737192816,45.5474260025706],[-73.6949042091205,45.5474166110271],[-73.6953649723374,45.5473348427302],[-73.6956848917404,45.5472623122254],[-73.6958895810159,45.5471989748337],[-73.6969646775918,45.5470081351492],[-73.6974125313272,45.5468993724932],[-73.6976558546593,45.5468989429106],[-73.6981297573778,45.5469161003947],[-73.6984624756206,45.5468435281328],[-73.6993709180268,45.5466079686018],[-73.6996266374422,45.5464905400688],[-73.699793026274,45.5464632492283],[-73.6998955090375,45.5464720639287],[-73.7000748289652,45.5464807422688],[-73.7004979392576,45.5466239579248],[-73.7005875195259,45.5466058029378],[-73.7008176192381,45.5464884205223],[-73.7010985608875,45.5462629709178],[-73.7011239188609,45.5461909419047],[-73.7010853099551,45.546137023005],[-73.7011107632085,45.5460919877153],[-73.7012384421098,45.5459837838954],[-73.7013664068422,45.5459565610966],[-73.7016481710682,45.5459650546762],[-73.7018914534461,45.5459556205674],[-73.7019938376102,45.5459374408113],[-73.7024025726422,45.5456397689237],[-73.7024663462046,45.5455676692218],[-73.7025807988589,45.5453425103448],[-73.702644636237,45.5452884068862],[-73.7026827976514,45.5452163533599],[-73.7026825092738,45.5451353708329],[-73.7026309332524,45.5450364841708],[-73.7023741747468,45.5448568912939],[-73.70238682052,45.5448118779546],[-73.7024889795306,45.5447308025803],[-73.7026424255541,45.5446675406481],[-73.7027577102602,45.5446763319954],[-73.7029116690104,45.5447570385983],[-73.7030270500229,45.5447928236959],[-73.7031423345516,45.5448015236487],[-73.7032575873361,45.5448013163285],[-73.7035007706809,45.5447649771236],[-73.7036158307614,45.5447107814738],[-73.7038074688302,45.5445844633773],[-73.703947690371,45.5444042497888],[-73.7041905178382,45.5442688410869],[-73.7050474776001,45.5439883410749],[-73.7055602383875,45.5441403680319],[-73.7056498112382,45.5441222081477],[-73.7057774453334,45.5440050018065],[-73.7059564940224,45.5439416885778],[-73.706212180779,45.5438242476812],[-73.7063913259186,45.5437879276628],[-73.7066601726648,45.5437694383077],[-73.7068137393424,45.5437421626638],[-73.7069160524644,45.5437059834036],[-73.7070437821798,45.5436157707874],[-73.7071967666424,45.5434265365573],[-73.7072858537967,45.5432734111067],[-73.7073493626219,45.5431293305851],[-73.7073745203124,45.5430033160921],[-73.7074891204301,45.542823151149],[-73.7075402118959,45.5427870664953],[-73.7077564764836,45.5423907705821],[-73.7078621465295,45.5422881256456],[-73.7092750137778,45.5431751745658],[-73.7094372419499,45.5430164606322],[-73.7101659200742,45.5421230463083],[-73.7110770390534,45.5412292433471],[-73.7119889495453,45.5405282734402],[-73.7133215990529,45.5398747635981],[-73.7149285977154,45.5392447616179],[-73.7161335556466,45.5386879437872],[-73.7175594553325,45.5384683396538],[-73.7189127175032,45.5383932967949],[-73.7201194107164,45.5382704658417],[-73.7212883007102,45.5379306266166],[-73.7223470501005,45.5373497961683],[-73.7240261837607,45.5364303500434],[-73.7253758275411,45.5355113765444],[-73.7262146081557,45.5348105829154],[-73.7267609967009,45.5342790889428],[-73.727453347337,45.5336748553387],[-73.7280001000863,45.5332398238557],[-73.7288029463028,45.5327318461666],[-73.7297881722647,45.5321995685421],[-73.7308476657031,45.5319079544848],[-73.7324187180861,45.5315190053471],[-73.7343558760716,45.5311293749352],[-73.736474165276,45.5304500170105],[-73.7381163924077,45.5296026987684],[-73.739867492669,45.5284659059943],[-73.7412528387001,45.5274503279836],[-73.7420902008855,45.5265323514519],[-73.742635969755,45.5258560802617],[-73.7431432228311,45.5247700575681],[-73.7440151585896,45.5234180493301],[-73.7447416514354,45.5222832197082],[-73.7457244618698,45.5212685117138],[-73.7466348032164,45.5203984888218],[-73.7476194422721,45.5197454463796],[-73.7486781792835,45.5193332209043],[-73.749737651722,45.51913795319],[-73.7510537870328,45.5190626969689],[-73.752552896743,45.5190593746093],[-73.7535763574845,45.5189365889026],[-73.7546354754293,45.5186447933568],[-73.7558763467335,45.5181355930463],[-73.7570067268353,45.5174337618414],[-73.7581359592629,45.5164666168799],[-73.7591911322229,45.5153793515604],[-73.7596990340387,45.5144860880169],[-73.7603179440538,45.5138576924691],[-73.7612287211694,45.5131806552284],[-73.7624688447384,45.5125025784904],[-73.7635438153943,45.5119776857271],[-73.7636321275885,45.5119344933272]],[[-73.6023542291246,45.6125870623215],[-73.6016681818309,45.6118970741756],[-73.603090149747,45.6111490613011]],[[-73.603090149747,45.6111490613011],[-73.5971109854928,45.6085990579459],[-73.5932108987142,45.6068920600992],[-73.5920299245655,45.606371071781],[-73.5890028587264,45.6050240592893],[-73.579676851883,45.6009451154212],[-73.5771248107799,45.5998581274069],[-73.5774439028704,45.5993811429971],[-73.5773669201381,45.5993721052758],[-73.5771238805524,45.5993190792538],[-73.5767259132218,45.5993190687667],[-73.5765468870764,45.5993010966721],[-73.5762258324264,45.5992561285013],[-73.5757649072384,45.5991390754965],[-73.5745978939037,45.5986720404084],[-73.5741228854154,45.5984480798058],[-73.572673945049,45.5977470415623],[-73.5721739126246,45.5975400056792],[-73.5696559300578,45.5965919209051]],[[-73.5696559300578,45.5965919209051],[-73.5694209423822,45.5971479428998],[-73.561107953019,45.5943588288432],[-73.557485986473,45.593147890106],[-73.5489330905734,45.5902997945146],[-73.5484101067903,45.5911447672298],[-73.5481611541266,45.5915277861275],[-73.5479000625558,45.5919348414023],[-73.5477960807129,45.5921098310029],[-73.546797083931,45.5936698187938],[-73.5465311055452,45.5940678758863],[-73.5482361139546,45.5946678645121],[-73.547443122012,45.5955688451197],[-73.5459240840008,45.5949968469123],[-73.5438621293285,45.5980748791722],[-73.5442041364978,45.5981878673963],[-73.5445070371629,45.5993999515917],[-73.544829102572,45.5995548806833],[-73.5444860590426,45.6006619226717],[-73.5448260723536,45.600769958873],[-73.5448310594977,45.6007909248167],[-73.5448020638762,45.6008879473862],[-73.5448681255266,45.6009898822284],[-73.5450270955151,45.6010569529449],[-73.5447581061715,45.6019399717369],[-73.5441460773264,45.6017568980689],[-73.5407421611408,45.6006989712084],[-73.5397301749513,45.6018179148004],[-73.5417141936703,45.6026929166701],[-73.5429361807431,45.6032339434797],[-73.5421761889329,45.6042449191015],[-73.5394321791643,45.6030899458904],[-73.539298220776,45.6032518850926],[-73.538017277917,45.6027209178473],[-73.5379551928527,45.6026949308168],[-73.5365962257247,45.6021619255523],[-73.5366411991278,45.6023739276342],[-73.5367172256457,45.6026948988022],[-73.5366652036477,45.6026949165281],[-73.536504237033,45.6026449367339],[-73.5365182278187,45.6026949664801],[-73.5371542411212,45.6046369331851],[-73.5377811865707,45.6048279550448],[-73.5375402376863,45.6052348889394],[-73.5416362303461,45.6069420038722],[-73.5411261239319,45.6075659224844],[-73.5410281881262,45.607698965598],[-73.5409011841558,45.6078519970953],[-73.5416431524015,45.6081789440758],[-73.5415901226621,45.6084099713148],[-73.5415000862361,45.6086619751416],[-73.541440074122,45.6089010100225],[-73.5411510247833,45.6094869481654],[-73.5423181007381,45.6097889805166],[-73.5429821388452,45.609960977518],[-73.5432821183924,45.6100499557238],[-73.5441480884167,45.6102739755042],[-73.5453511080041,45.6107679212586],[-73.5451891103286,45.6109309577423],[-73.5451640849133,45.6109819917121],[-73.5450711451133,45.6111450011394],[-73.5444920662496,45.6121869528406],[-73.5462770604094,45.6127229551579],[-73.5461011188875,45.6128989619104],[-73.5457800813166,45.6133499486065],[-73.545725074746,45.6133359320723],[-73.545696128352,45.6133759889731],[-73.5457520862658,45.6133899160565],[-73.5453891059744,45.6139159636029],[-73.5453080049855,45.6140729394957],[-73.5452780414725,45.6141649219947],[-73.5440589854485,45.615052978741],[-73.543722020509,45.6149089422742],[-73.5378599851114,45.6138809187356],[-73.5371866179934,45.6158357657932]],[[-73.5371866179934,45.6158357657932],[-73.5362608510948,45.618457898742],[-73.5354974024558,45.6198971580049],[-73.5439404275928,45.6236714406244],[-73.5468463503493,45.6249358948305],[-73.547925886992,45.6254056214377],[-73.5480813343789,45.6254729245783],[-73.5484420629026,45.6256289064905],[-73.5484635181517,45.6256381988457],[-73.5504879749674,45.626513541267],[-73.5511162168742,45.6267805107081],[-73.5514021879531,45.6269032963511],[-73.5514203557319,45.6269111971174],[-73.5539520985669,45.6280141362732],[-73.5567600431776,45.6292372501746],[-73.5596465511604,45.6304568456919],[-73.5628435983779,45.6318353662969],[-73.5638550490322,45.6322714461165],[-73.5676490033825,45.6339070679301],[-73.5679944455889,45.6340559827157],[-73.5681679783651,45.634130175512],[-73.5683415333325,45.6342040823769]],[[-73.5683415333325,45.6342040823769],[-73.5740075697115,45.6304916964315],[-73.5757545880206,45.6292977245367],[-73.5769886033606,45.6284546845067],[-73.5800676147804,45.6263507429805],[-73.5821846271246,45.6249027435416],[-73.5843755587145,45.6234048406462],[-73.5867853928719,45.6217578881289],[-73.592965103947,45.6175330228188],[-73.5936570645005,45.6170600176327],[-73.5954720783567,45.6158180091798],[-73.5969310920751,45.6149040030198],[-73.5984981016877,45.6140830261531],[-73.6001601056135,45.6133610267473],[-73.6014191703201,45.6129020492353],[-73.6023542291246,45.6125870623215]],[[-73.677212053007,45.4836885142825],[-73.6763007020112,45.4830772167304],[-73.6746354931586,45.4819601694168],[-73.6697561850446,45.483713219065],[-73.6695851275087,45.4838020274496],[-73.6637420865267,45.4811460234594],[-73.663314120662,45.4809570221891],[-73.6618620747884,45.4803200536814],[-73.6611070952024,45.4811520359743],[-73.6560111303193,45.4789340349537]],[[-73.6560111303193,45.4789340349537],[-73.656005034498,45.4813720519306],[-73.6559759550704,45.4843940695432],[-73.6559770017075,45.4844290758318]],[[-73.6559770017075,45.4844290758318],[-73.6559829314965,45.484629033032],[-73.655951994557,45.4851210701981],[-73.6558599516719,45.4856090503391],[-73.6557068942633,45.4860891046513],[-73.6554969316511,45.4865590657944],[-73.6558779070936,45.4867300759224],[-73.6552588989697,45.4874160366868],[-73.6505029114016,45.4926830622275],[-73.6493058772782,45.4921991168153],[-73.6490358664487,45.4920530484331],[-73.648618909739,45.491887100538],[-73.6490501160621,45.4913276516227],[-73.6498410196164,45.4904443814769],[-73.6499700915361,45.4903071698683],[-73.6504793906873,45.4897544866372],[-73.6505921505841,45.4896098600407],[-73.6511634728205,45.4889836808889]],[[-73.6511634728205,45.4889836808889],[-73.6450193618018,45.4862240039104],[-73.6388304224155,45.4834377720507]],[[-73.6388304224155,45.4834377720507],[-73.6351663002996,45.4817904516314],[-73.6304021320274,45.4796457818922],[-73.6307209472348,45.479299896201],[-73.6308195600955,45.4793442297966]],[[-73.6308195600955,45.4793442297966],[-73.6311680671365,45.4789660630719],[-73.631123365295,45.4789459688871],[-73.6310694086523,45.478921829751],[-73.6310243583042,45.4789014596787],[-73.6307110725493,45.4787606129314],[-73.630612559046,45.4787163313813],[-73.6299147524973,45.4784026162296],[-73.6299235841852,45.4783643535823],[-73.6325591302881,45.4778818820268],[-73.6328320735545,45.4777837042509],[-73.6337097601863,45.4774773485724],[-73.6346357751155,45.4771919236648],[-73.6349650324774,45.4771040872459],[-73.6352998489062,45.4770321489985],[-73.6356688118753,45.4769712146439],[-73.6360149201794,45.4769307555651],[-73.6364233425344,45.4769031127716],[-73.6366802032854,45.4768917403196],[-73.6370802609816,45.4768846317385],[-73.637249048566,45.4768772399135],[-73.6375995741912,45.4768647611767],[-73.6379550287161,45.4768514262522],[-73.6382493445085,45.4768440073391],[-73.6385657157453,45.4768447605521],[-73.6386742073373,45.4768440323319],[-73.6388720999429,45.4768412632483],[-73.6390370433647,45.4768554229575],[-73.6393228579022,45.4768618431679],[-73.6395036585933,45.4768336620874],[-73.639606821942,45.476802982489],[-73.6397348301544,45.4767456199233],[-73.6416262290117,45.4755317405062],[-73.6420866740247,45.4752354171579],[-73.6422813259739,45.4751032927699],[-73.6427161743875,45.4748289615705],[-73.6429170752816,45.4747152141854],[-73.6431196022945,45.4746019556529],[-73.6433582782828,45.4744900310967],[-73.6438880456447,45.4742193923574],[-73.644459591704,45.4739660002599]],[[-73.644459591704,45.4739660002599],[-73.6443899792965,45.4739362103555],[-73.6459220609619,45.473275484503],[-73.6458872022476,45.4730902705594],[-73.6472068487391,45.4720324730302],[-73.6476683494405,45.4716726066632],[-73.6478743443295,45.4715019392638],[-73.6483151142304,45.4711523326002],[-73.6489355601019,45.4706511058895],[-73.6491102826088,45.4705121833868],[-73.6493344852905,45.4703339340724],[-73.6494533669225,45.4703810370493],[-73.6503483149657,45.4687316497107],[-73.6508859419124,45.4683702466853],[-73.6522138370854,45.4676253633483],[-73.6532318559768,45.4662912827542],[-73.6533076844359,45.4663136585768],[-73.6541607606292,45.4651468397016],[-73.6557592262419,45.4629537218473],[-73.6558615012944,45.462897261899],[-73.6562474176332,45.4626842479601],[-73.6574713214642,45.4619989640225],[-73.6574030263448,45.461971359809],[-73.6582727825394,45.4614534598448],[-73.6580641306118,45.4613859195995],[-73.6577135637777,45.4612491119569],[-73.6577185513339,45.4612377354883],[-73.657722119995,45.4612260901391],[-73.6577242380548,45.461214270437],[-73.657724890416,45.4612023654877],[-73.6577240722136,45.4611904652824],[-73.6577217900943,45.4611786606963],[-73.6577180596484,45.4611670398921],[-73.6577129105324,45.4611556910133],[-73.6577063813468,45.4611446994913],[-73.6576985209145,45.4611341480436],[-73.6576893882808,45.4611241166741],[-73.6576790527086,45.4611146808731],[-73.6576675923996,45.4611059116193],[-73.6576356424261,45.461077307669],[-73.6576071211402,45.4610469748436],[-73.6575822106585,45.4610151054596],[-73.6575825705688,45.4609844454569],[-73.6575860882398,45.4609733166927],[-73.6575923761508,45.4609628094722],[-73.6576012306372,45.4609532615199],[-73.6576123686716,45.4609449818747],[-73.6576481927535,45.4609227356359],[-73.6576643083854,45.460911012563],[-73.6576776023842,45.4608976601917],[-73.6577453780016,45.4608166402612],[-73.6577509179761,45.4608075711243],[-73.6577530929141,45.4607978173851],[-73.6577289375047,45.4606703681947],[-73.6577213142392,45.4606443633865],[-73.6577132121896,45.4606269176646],[-73.657702863748,45.4606100698616],[-73.6576948404067,45.4605997849917],[-73.6576854555464,45.460590088712],[-73.657674793812,45.4605810699891],[-73.6576629551737,45.4605728105698],[-73.6576500459801,45.4605653867925],[-73.6575753148321,45.4605264571438],[-73.6575613145809,45.4605198510303],[-73.6575465062103,45.4605141854749],[-73.657531013901,45.460509511596],[-73.6575149733079,45.4605058678985],[-73.6574985213469,45.4605032865863],[-73.6574817987425,45.4605017899601],[-73.6574649525857,45.4605013904135],[-73.6574486994598,45.4605008784608],[-73.657434532989,45.4604993458862],[-73.657306258939,45.4604727786153],[-73.6572914916669,45.4604680937999],[-73.6572790062168,45.4604608304639],[-73.6572696863693,45.4604515074936],[-73.6572649777164,45.4604431076707],[-73.6572601302494,45.4604307631208],[-73.6572562260516,45.4604182552913],[-73.6572532716113,45.4604056183672],[-73.6572515208133,45.4603935628744],[-73.6572511932075,45.4603741068858],[-73.6572527469341,45.4603607483371],[-73.6572557447127,45.4603475119656],[-73.6572929917208,45.4602154450173],[-73.6572916937117,45.4602052740718],[-73.6572838855989,45.4601978791728],[-73.6572527027888,45.460185736694],[-73.6572379694274,45.4601789731814],[-73.657225049913,45.4601705721357],[-73.6572143093448,45.4601607697108],[-73.6572080469414,45.4601528021631],[-73.657203772999,45.4601411451961],[-73.6572042890294,45.4601312488882],[-73.6572101941995,45.4601187580601],[-73.6572195435655,45.4601073764678],[-73.6572316678094,45.4600973740912],[-73.6572461650441,45.4600890826293],[-73.6574841439841,45.4599837947141],[-73.6575306816811,45.4599529653287],[-73.6575447212217,45.4599419569346],[-73.6575559420686,45.4599294488119],[-73.6575640267961,45.4599157950411],[-73.657568747581,45.4599013819725],[-73.6575849373326,45.4598454530398],[-73.6575868482019,45.459833624627],[-73.6575858024544,45.4598217427299],[-73.657581834347,45.459810170838],[-73.6575704316061,45.4597926136036],[-73.6575636997289,45.459778595271],[-73.6575605070237,45.4597639700282],[-73.6575609506114,45.4597491759649],[-73.6575650163821,45.4597346585239],[-73.6575725840578,45.459720851597],[-73.6575834233412,45.4597081721315],[-73.6575970596134,45.4596970077188],[-73.6576126782223,45.4596873261951],[-73.6576245864727,45.4596824567934],[-73.6576378616591,45.4596798746967],[-73.6576824021721,45.4596754296756],[-73.6577090986401,45.459673605488],[-73.657735921255,45.4596734620286],[-73.657762653913,45.4596750004978],[-73.6579280114346,45.4596897619203],[-73.6580601869742,45.4596995391896],[-73.6580779372984,45.4597013879429],[-73.6580954028095,45.4597042818098],[-73.6581124594147,45.4597082011666],[-73.6581289830012,45.4597131191912],[-73.6581448162564,45.4597190262045],[-73.6581598223476,45.4597259196983],[-73.6581738770818,45.4597337440553],[-73.6581868639132,45.4597424346496],[-73.6582899851164,45.4598179857857],[-73.6583004795263,45.4598234017092],[-73.6583129634682,45.4598259857452],[-73.6583273409404,45.4598252440124],[-73.6583404533366,45.4598217658644],[-73.658351885364,45.4598160638761],[-73.6583674602986,45.459803479523],[-73.6583785031491,45.459792557175],[-73.6583882426557,45.4597810382393],[-73.6584430829453,45.4597097042901],[-73.658094608074,45.4595798263112],[-73.6579627849665,45.4595293234168]],[[-73.6579627849665,45.4595293234168],[-73.6578502058197,45.459486192125],[-73.6563251757375,45.4589184310583],[-73.6557389621477,45.4586932029738],[-73.6553968465389,45.4585608834671],[-73.6551850223747,45.4584662584514],[-73.6547345768363,45.4582928969312],[-73.6546755213921,45.4582701742541],[-73.6540849436571,45.4580428757063],[-73.6538452715816,45.4579506215614],[-73.6536055994733,45.4578583768252],[-73.6535581369836,45.4578401008552],[-73.6531943005995,45.4577000584782],[-73.6530433553181,45.4576419642358],[-73.6530250578874,45.4576349150534],[-73.6528541134017,45.4575691140739],[-73.652683165724,45.4575033218483],[-73.6526176884984,45.4574781092622],[-73.652512222479,45.4574375203691],[-73.6524467390977,45.4574123076957],[-73.6520205567722,45.457248267675],[-73.6516575040517,45.4571085092398],[-73.6515948542594,45.4570843388496],[-73.6504579450717,45.4566456032708],[-73.6502870875882,45.4565796751565],[-73.6494260561671,45.456247379988],[-73.6492597005476,45.4561814070035],[-73.6490875811032,45.4561148265991],[-73.6487385135682,45.4559798165239],[-73.6480615128746,45.4557179461044],[-73.6477137571117,45.4555834409359],[-73.6475910932925,45.4555359857632],[-73.6473703562126,45.4554506063078],[-73.6471132839511,45.4553511593632],[-73.6468597094032,45.4552530786776],[-73.646196857792,45.4549966611743],[-73.6460265886541,45.4549300109935],[-73.6456013913042,45.4547635484647],[-73.6455889811214,45.4547586959584],[-73.645432377482,45.4546973898617],[-73.6454187207597,45.4546920376893],[-73.6452484567323,45.4546253872142],[-73.64448227551,45.4543254269936],[-73.6442742188637,45.4542439799227],[-73.6441465266745,45.454193979955],[-73.643886360165,45.4540921317481],[-73.6427005069417,45.4536278564905],[-73.6424746504564,45.4535424219278],[-73.6423454460786,45.4534935561279],[-73.6420050507427,45.4533647904165],[-73.6416638181394,45.4532323947349],[-73.6413216232797,45.4530996364205],[-73.6404661101738,45.4527677290159],[-73.640295490447,45.4527015414155],[-73.6399952004148,45.4525850288273],[-73.6397616557232,45.4524944271723],[-73.6397199232003,45.4524782310103],[-73.6394535370844,45.4523687230626],[-73.6373473111061,45.4515614631467],[-73.636919576931,45.4513975003891],[-73.6365773919343,45.4512663431074],[-73.6360640994777,45.4510695800067],[-73.6352965061135,45.4507753419737]],[[-73.6352965061135,45.4507753419737],[-73.6346630707316,45.4510930860629],[-73.6314600498022,45.4527581020496],[-73.6285339989808,45.4553450484515],[-73.6285429680941,45.45539507216],[-73.6262048084532,45.4574909545631],[-73.6243247780992,45.4586589553701],[-73.619961785943,45.4617499471863],[-73.6197927717393,45.4616749892348],[-73.6182277975818,45.4622300022047],[-73.6151789351161,45.4635180563947],[-73.6121179363526,45.4648862143063],[-73.6120629292635,45.4648581926149],[-73.6118169731738,45.4649172031161],[-73.6116069916948,45.4647641594792],[-73.6082661751977,45.4662881946],[-73.6072010785006,45.4666632255106],[-73.606607064306,45.4670542702454],[-73.6058459889466,45.4672872657244],[-73.6056279954032,45.4676032515635],[-73.6047150126955,45.468183208778],[-73.6031689877337,45.4691032752683],[-73.6025899905104,45.4690512531097],[-73.6018038812672,45.4696342972775],[-73.6012719054193,45.4700542213259],[-73.6007278911396,45.470533274452],[-73.5993759384363,45.4717291850022],[-73.599088955606,45.4718812537732],[-73.5988839321356,45.4720902129839],[-73.5979918840429,45.4725662405096],[-73.5979378921711,45.472578256456],[-73.5964599040188,45.4734171867195],[-73.5951357763157,45.4764447402168]],[[-73.5951357763157,45.4764447402168],[-73.5955776296593,45.4761381089479],[-73.5957648973491,45.4760082647023],[-73.5984752904683,45.4741008893753],[-73.6012281015711,45.4753315826438],[-73.6024033191885,45.4758568718724],[-73.6028915088277,45.4760750635219],[-73.6032424634259,45.4762319300865],[-73.6033806712245,45.4762936919933],[-73.6036867143848,45.4764304747095],[-73.6037273559683,45.4764486451217],[-73.604335008424,45.4767202088926],[-73.6049972947601,45.4770162010376],[-73.6054046717619,45.476571466707],[-73.6054876849203,45.4766108263643],[-73.6058032133516,45.4767534735697],[-73.606057235055,45.4768704468339],[-73.6067548041457,45.4771879875381],[-73.6090621060599,45.4782038220565],[-73.6143800341701,45.4805888811276],[-73.6123993681801,45.4826886760394],[-73.6145353064049,45.4836637124811],[-73.6171482378122,45.4848337615346],[-73.6159641735315,45.4861257231186],[-73.6153512054172,45.4867947276862],[-73.6156752364023,45.4869428042983],[-73.6168142106247,45.4874618310378],[-73.6184231387654,45.4881788448198],[-73.6183200561041,45.4886448514511],[-73.6184160689556,45.4889458759476],[-73.6176980194366,45.4897409121479],[-73.6170630314216,45.4904569524562],[-73.6147350703793,45.4930287788849],[-73.6121731823429,45.4919378279921],[-73.6115921374067,45.4916908804069],[-73.60936012739,45.4939779182218],[-73.6083680561917,45.4935919766229],[-73.6074091855818,45.4945479056299],[-73.6068401918011,45.4952759075412]],[[-73.6068401918011,45.4952759075412],[-73.6066841925338,45.4954849190755],[-73.6062482077926,45.4954249461949],[-73.6048812298194,45.4956179059164],[-73.604661223617,45.4956959537503],[-73.6045181720371,45.495783920228],[-73.6026300952302,45.4976740022197],[-73.6005159818638,45.4995999548103],[-73.5986160180852,45.5011579600525],[-73.5973769575743,45.5018779848695],[-73.5969599440387,45.502071017459],[-73.596435919391,45.502275027553],[-73.5959149515715,45.502417028699],[-73.5954028983565,45.5025820553441],[-73.5949539110756,45.5027779853022],[-73.5945779306573,45.5029550444051],[-73.5943389035207,45.5031669969315],[-73.5942299182858,45.5033199854165],[-73.5956109141946,45.5040629949286]],[[-73.5956109141946,45.5040629949286],[-73.5987838942435,45.5056170015326],[-73.5988969771019,45.5055140396732],[-73.5991199024211,45.5056320080072],[-73.5993799928364,45.5053890662042],[-73.6000319044616,45.5056960036382],[-73.6024758700409,45.5068569698039],[-73.6035339056393,45.5056989463303],[-73.6059059043036,45.5067739808066],[-73.606133883651,45.506876000718],[-73.6063528884867,45.5074899994525],[-73.611243886916,45.5096689249774],[-73.6122108318229,45.5100839424483],[-73.6130488831493,45.5104459633429],[-73.6139258105029,45.5094719273215],[-73.6146357847723,45.5086858816877],[-73.6156428056742,45.50758584957],[-73.6158888397486,45.5073138173095],[-73.616486866179,45.506659747411],[-73.6174598829913,45.5055757562669],[-73.6175969109787,45.505430723084],[-73.6177618618361,45.5052617221482],[-73.6182348932225,45.5047207201667],[-73.618948838393,45.5051247454567],[-73.6185918430223,45.5055257789995],[-73.6183618439377,45.5057827742422],[-73.6182368673897,45.5059367055579],[-73.6179928487264,45.5062047819349],[-73.6164537542892,45.507876735584],[-73.6162207774673,45.5081327369473],[-73.6160398238206,45.5083287473535],[-73.6178927943616,45.509173781791],[-73.6169198104361,45.5102758011751],[-73.618879835197,45.5111338573937],[-73.6176638457886,45.5124989304851],[-73.6181778143121,45.512730938516],[-73.6211108895945,45.5140419351202],[-73.6225748083554,45.5147068651661],[-73.6238049108022,45.5152729444053],[-73.6240228217757,45.5153728701655],[-73.6247258132996,45.5156978780009],[-73.6247608646889,45.5156979294181],[-73.6252809111825,45.5159299069007],[-73.6260049185647,45.5162468899168],[-73.6267218934442,45.5165789048672]],[[-73.6267218934442,45.5165789048672],[-73.626991841415,45.5162449113037],[-73.6270658603441,45.5161559153743],[-73.627846889063,45.5152129052336],[-73.6289039549215,45.514081942656],[-73.6297179053138,45.5143059350389],[-73.6310359777456,45.5146679491502],[-73.6346519858976,45.5156590388536],[-73.6357189414844,45.5143920455427],[-73.6365909644118,45.5146560421423],[-73.6385809897399,45.5112151243708],[-73.6388099339852,45.5109481068909],[-73.640415959159,45.509072122684],[-73.64112893633,45.5082370936606],[-73.6416659198838,45.5076090792305],[-73.6418849746928,45.5071990587021],[-73.6418759337231,45.5071300435727],[-73.6417448937834,45.5070700917457],[-73.6415509759418,45.5069820481583],[-73.6423109356377,45.5062129921995],[-73.6422519174173,45.5054969786649],[-73.6447178300038,45.5028229380199],[-73.6447978171437,45.5027340127476],[-73.6447418469439,45.5027219351565],[-73.6451438453446,45.5023009761438],[-73.6456047989611,45.5018249550685],[-73.6457918392698,45.5016270016637],[-73.6460468063084,45.5017389856868],[-73.6462207569761,45.5018259649154],[-73.6464178332431,45.5019169642694],[-73.6516117839576,45.5043109125054],[-73.656644809694,45.5037580229215],[-73.6599988175418,45.5047070579263],[-73.6600818328942,45.5033210679571],[-73.6605367461894,45.5024300591785],[-73.6612118180476,45.5023471284348],[-73.6623618020394,45.5022061064441],[-73.6623478035756,45.5021470921449],[-73.6622757782317,45.5018041463698],[-73.661940760251,45.5002281502092],[-73.6617467411198,45.4992181640805],[-73.6633698755656,45.499240144866],[-73.6637508006019,45.4992440960343],[-73.663368872267,45.499001124521],[-73.6562268806695,45.4943261292561],[-73.6614959473737,45.4901010854515],[-73.6633390261303,45.4886231232913],[-73.663482945118,45.4885080869647],[-73.6640779782916,45.4880300909431],[-73.6644029509904,45.4877630649045],[-73.6648610298386,45.4874020707684],[-73.6653490051192,45.4870180795779],[-73.6654299736619,45.4870661094615],[-73.6656340079766,45.4869060736437],[-73.6659050195752,45.4867371205642],[-73.6660959803106,45.4866180498351],[-73.6663019935009,45.4866310699576],[-73.667205048339,45.4868160427585],[-73.6678730771256,45.486953116178],[-73.6685969961669,45.4873970771248],[-73.6751680077292,45.4912830681118],[-73.6760480155997,45.48806509021],[-73.676278992894,45.4873851033249],[-73.677212053007,45.4836885142825]],[[-73.7229892547875,45.4217852596423],[-73.7218423965817,45.4218739542458],[-73.7160913996896,45.4222552760546],[-73.715843370092,45.4222690570878],[-73.7119530754273,45.4224850915625],[-73.7073140787744,45.4227074300966],[-73.7017859058056,45.4229296207284],[-73.6972024343418,45.4230684718134],[-73.6920634895951,45.4231796631821],[-73.6869799160306,45.4231519203659],[-73.6820075996991,45.4230407739052],[-73.6769240815463,45.4228462961792],[-73.6718128722204,45.422568699642],[-73.6698682836578,45.4224298042186],[-73.666201702501,45.4218186969709],[-73.6661041107315,45.4217973659872]],[[-73.6661041107315,45.4217973659872],[-73.6660087565942,45.4284426792555],[-73.665920484294,45.4286811899612],[-73.6659179762004,45.4288559886472],[-73.6659104510504,45.4290776591224],[-73.6658466511195,45.4307522371534],[-73.6658428819034,45.4309120283135],[-73.6658525421916,45.431610956886],[-73.6658659638824,45.4325670238065],[-73.6651185372331,45.4323671786218],[-73.6621185057316,45.4334422056143],[-73.6593234875261,45.4348592122126],[-73.6578425495822,45.4354731310572],[-73.6550205578309,45.4365561649154],[-73.6537695351084,45.4370890723824],[-73.6532715214688,45.4373330831347],[-73.6520335244969,45.438018152928],[-73.6506175107695,45.4388571551967],[-73.650247466789,45.4390640884276],[-73.6489454464232,45.4397681049981],[-73.6480514887261,45.4402551418216],[-73.6470944763818,45.440706073953],[-73.6453324580801,45.4414100935809],[-73.6431103548585,45.442277109922],[-73.6392792415949,45.4438391008779],[-73.6360471514086,45.4450481305807],[-73.6339661360801,45.4458702048296],[-73.6333021336862,45.4461311567716],[-73.6320371360635,45.446673095535],[-73.6309770657776,45.4472050799724],[-73.6304161205367,45.4475391426071],[-73.6299940633282,45.4477910625946],[-73.6296750884614,45.4480251393115],[-73.6290820298705,45.4483901068409]],[[-73.6290820298705,45.4483901068409],[-73.6319658361357,45.4495066838684]],[[-73.6319658361357,45.4495066838684],[-73.6358261221632,45.448144745519],[-73.636488467185,45.4478907461773],[-73.637124606526,45.4476054845466],[-73.6377315728045,45.4472902950325],[-73.63880730847,45.4466906380227],[-73.6391982514068,45.446833105429],[-73.6432913768084,45.4483600596828],[-73.6433544235023,45.4478560202068],[-73.6448363476508,45.4475930796549],[-73.6497253664219,45.4494951040274],[-73.6507360817519,45.4498714140907],[-73.6521152823043,45.4503861949197],[-73.6555573656122,45.4516707672655],[-73.656454580221,45.4520671592785],[-73.6572867181179,45.4523786747896],[-73.6575270937308,45.4524640681493],[-73.6578120880585,45.4525780905157],[-73.6581704528327,45.4527160099931],[-73.6585288143152,45.4528539373743],[-73.6590672433006,45.4530610159585],[-73.659479664664,45.4532196191551],[-73.6602730142867,45.453524730414],[-73.6625245526358,45.454392737859],[-73.6638303144561,45.4548961277185],[-73.6641657561132,45.4550285458302],[-73.6668748321283,45.4560578037871],[-73.6681676863569,45.4565489710695]],[[-73.6681676863569,45.4565489710695],[-73.6685070596757,45.4561569138883],[-73.6694198359783,45.4556326047056],[-73.6700564345867,45.4550187869932],[-73.6705550842324,45.4543070158287],[-73.671209084131,45.453527338931],[-73.6712673648164,45.45355413232],[-73.6717893687502,45.45269024703],[-73.6729892968906,45.4528110271453],[-73.6739202101433,45.4527881084785],[-73.674663826223,45.4527764437313],[-73.6775055702608,45.4527315649346],[-73.6818974372195,45.4540509202144],[-73.6850851086177,45.4548576605134],[-73.6853820034028,45.4549327734436],[-73.6872338237784,45.455401387165],[-73.686497967568,45.4567552392786],[-73.685658326364,45.4574261827925],[-73.684356724393,45.4586759296974],[-73.6839224358627,45.4591023408889],[-73.6830227641153,45.4600283753317],[-73.6831935038104,45.4600945109035],[-73.6827998737737,45.4610113695879],[-73.6818317178435,45.4613634012624],[-73.6812881204844,45.4621520780591],[-73.6828058933345,45.4631779363512]],[[-73.6828058933345,45.4631779363512],[-73.6933021787683,45.4703501169406],[-73.694778181844,45.4645171299617],[-73.699150224248,45.4675331020665],[-73.7019702829579,45.4694080858287],[-73.7047652794541,45.4713021323759],[-73.705662193786,45.4718041189557],[-73.7076623055355,45.4731151233522],[-73.7080082442405,45.4733481184171],[-73.7080983263073,45.4734021310518],[-73.7079835655602,45.4734912049656],[-73.7081490474139,45.4735992659858]],[[-73.7081490474139,45.4735992659858],[-73.7084594901248,45.4733621931792],[-73.7089626310757,45.4729873331911],[-73.7092720159762,45.4727553139056],[-73.7106621692212,45.47171138289],[-73.7108300296704,45.4715852787083],[-73.7108598484607,45.4715628924158],[-73.7108747463075,45.4715516925387],[-73.710977278655,45.4714749603801],[-73.7110804978662,45.4713986866834],[-73.7111843949948,45.4713228732629],[-73.7113193268578,45.4712258363875],[-73.711455380105,45.4711295792461],[-73.711592547083,45.4710341072476],[-73.7116565764528,45.4709897355638],[-73.7117203658767,45.4709451942108],[-73.7117839166371,45.4709004840868],[-73.7119664430947,45.4707701463261],[-73.7121469238263,45.4706384048993],[-73.7123253292091,45.4705052748402],[-73.7124367717165,45.4704206072231],[-73.712547377913,45.4703353983827],[-73.7126571506721,45.4702496537258],[-73.7126951476502,45.4702193943203],[-73.7127332484072,45.4701891994957],[-73.7127714465515,45.4701590701633],[-73.7128843789163,45.4700682514227],[-73.7129977647794,45.4699757174844],[-73.7131174861218,45.4698780541957],[-73.7132382810946,45.4697810483416],[-73.7133601407568,45.4696847035344],[-73.713466926665,45.4696015028136],[-73.7135745069761,45.4695188107027],[-73.7136828791651,45.4694366362028],[-73.7149533143217,45.4684796904918],[-73.7161506255786,45.4675777641065],[-73.7162410371261,45.4675105058041],[-73.716332639511,45.4674440496331],[-73.7164254020742,45.467378404647],[-73.7165335920798,45.4673038866396],[-73.7166432949778,45.4672304733654],[-73.716754500033,45.4671581814908],[-73.7169732016477,45.4670145682473],[-73.7171868583244,45.4668672444738],[-73.7173953437827,45.4667162968225],[-73.7175894986718,45.4665683652658],[-73.7177780009767,45.4664168582293],[-73.7179607153525,45.4662618808197],[-73.7179780459706,45.4662468159439],[-73.7179954304088,45.4662317824562],[-73.7180128699494,45.4662167812539],[-73.718109507646,45.4661350569622],[-73.7182077689817,45.4660542976854],[-73.7183076348299,45.4659745187527],[-73.718378995887,45.4659188712225],[-73.7184511362238,45.4658637251527],[-73.7185240533031,45.4658090859457],[-73.7194932753521,45.46508982951],[-73.7198974031362,45.4647895706129],[-73.7201159217937,45.4646266286476],[-73.7206786491924,45.4642101417814],[-73.7208432423001,45.4640886415677],[-73.7210087461027,45.4639677615968],[-73.7211751700596,45.4638475105362],[-73.7212695991072,45.4637796524336],[-73.7213348506284,45.4637330515684],[-73.7214005072839,45.4636867342536],[-73.721466569081,45.4636407022885],[-73.7215428723176,45.4635882278415],[-73.7216197038235,45.4635361374818],[-73.721697058484,45.4634844312183],[-73.7217595712138,45.4634431772606],[-73.7218224173551,45.4634021754969],[-73.7218855956293,45.4633614259293],[-73.7223010795019,45.4630846385489],[-73.7227013567096,45.4627969685407],[-73.7230858547634,45.4624988320316],[-73.7231491652117,45.462448156736],[-73.7232129306208,45.4623977639691],[-73.7232771510116,45.4623476591291],[-73.7234053886621,45.4622495077353],[-73.723535369486,45.4621524982966],[-73.7236670730874,45.4620566470447],[-73.7238131841235,45.4619516363097],[-73.7247695422227,45.4612823176945],[-73.724756458574,45.4612736959771],[-73.7248476468381,45.4612098832774],[-73.7245812783374,45.4610186554968],[-73.7245992593826,45.4610061936931],[-73.7230976335344,45.456201337099],[-73.7216388239629,45.4516615479975],[-73.7213714627477,45.450817666977],[-73.7208020044987,45.449020068392],[-73.7207614735746,45.4488515499721],[-73.7222981583512,45.4488817094849],[-73.722062877666,45.4481386854726],[-73.7219346543055,45.4477325011432],[-73.7217206047108,45.4470552388779],[-73.7215979135035,45.4466670762674],[-73.7212090913889,45.4454422057274],[-73.7209255891083,45.4445396846997],[-73.7208894813267,45.4445315736937],[-73.720824995668,45.4443271241959],[-73.7208114077106,45.4442837752467],[-73.720659187083,45.4437984698679],[-73.7205214587555,45.4433255259345],[-73.7204906951602,45.4432179556544],[-73.7204228992193,45.4430570899375],[-73.7203769856471,45.442895724533],[-73.7202854356712,45.4425740737867],[-73.7201927491416,45.4423003006934],[-73.7201377196297,45.4421377928651],[-73.7199298460957,45.4414486204171],[-73.7198875492755,45.4413084841296],[-73.7198810776817,45.4412876872295],[-73.7198409973679,45.4411752813939],[-73.7198244620531,45.4411279740664],[-73.7198124194465,45.4410673616047],[-73.7197808959833,45.4409662315809],[-73.7197297714147,45.4408056635637],[-73.7197096808933,45.4407462796274],[-73.7196764626541,45.4406454335358],[-73.7196389160814,45.4405325744337],[-73.7196246385987,45.44048498099],[-73.7196045366409,45.4404255619185],[-73.7195729782845,45.4403244929522],[-73.7195245604155,45.4401635063526],[-73.7194738983219,45.4400028668537],[-73.7193215595051,45.4395331984755],[-73.71931280618,45.4395000065598],[-73.7192967938154,45.4394263435043],[-73.7200875151398,45.4393582868117],[-73.7200345857808,45.438971265358],[-73.7208062806789,45.4393289298785],[-73.720756284826,45.4390784485551],[-73.7207850977224,45.4390599824444],[-73.720853080231,45.4385274186133],[-73.7229892547875,45.4217852596423]],[[-73.6661041107315,45.4217973659872],[-73.6653125340744,45.4216243446996],[-73.6636183429176,45.4210965490589],[-73.6553955841186,45.4178743263042],[-73.6535344843182,45.4169021305945],[-73.65103454441,45.4150688260579],[-73.6482564406312,45.4132910128954],[-73.6461730458609,45.4121521258833],[-73.6435896752735,45.4109299486928],[-73.6413120060766,45.4102077190387],[-73.6387282252219,45.4097633547747],[-73.6362561472612,45.4096521474674],[-73.6341727832382,45.4097079112598],[-73.6317002996178,45.409957847374],[-73.6292282386475,45.4102634323668],[-73.6264223549418,45.4104023693928],[-73.6228666364334,45.4103190281139],[-73.6212833586224,45.4103746170764],[-73.6185333760578,45.4105967058638],[-73.6162830238401,45.4108467549914],[-73.614616545082,45.4110967274878],[-73.6113661242248,45.4117356507488],[-73.6065604561412,45.412957840184],[-73.6032548906407,45.4140412453756],[-73.6012547201525,45.4147635320498],[-73.5989489184578,45.415569024131],[-73.5974167883797,45.4159908847123],[-73.5966711764692,45.416180055676],[-73.5963932572156,45.4162357267863],[-73.5937821963311,45.4167634601501],[-73.5915044924121,45.417069033539],[-73.5888099330437,45.4172356703152],[-73.5864209660268,45.4172635251077],[-73.581614808127,45.4170968623117],[-73.5765033929602,45.4170969644544],[-73.5733367983951,45.4171803429746],[-73.5708365861484,45.4173471766698],[-73.5683366489682,45.4175692991983],[-73.5649198910695,45.4180416118538],[-73.5616975260911,45.4185971345183],[-73.5596419337656,45.4190694450497],[-73.5553083054878,45.4202917011105],[-73.5539471412987,45.4207639312942],[-73.5513637449104,45.4216805258347],[-73.5484471066088,45.4229305318166],[-73.5458637040658,45.4242915691537],[-73.543530608637,45.4256527376327],[-73.5408637034558,45.4272915897005],[-73.5398579830246,45.4280063599261]],[[-73.5398579830246,45.4280063599261],[-73.5838854919383,45.435017900671],[-73.5993974145556,45.4374840663238]],[[-73.5993974145556,45.4374840663238],[-73.6118004932302,45.4394490122078],[-73.6105933753783,45.4426361001336],[-73.6104503054727,45.442978044772],[-73.6102642968112,45.4433101327707],[-73.6100392463418,45.4436291198556],[-73.6097752545,45.4439331161355],[-73.6094742140327,45.4442201407923],[-73.6068868974794,45.4464912966843],[-73.6055458037641,45.4476942768695],[-73.605369743629,45.4478323159627],[-73.6052117363113,45.4479813163162],[-73.6050717768839,45.4481392983613],[-73.6049527122252,45.4483053595985],[-73.6048547493783,45.4484773393864],[-73.604807707933,45.4485863660028],[-73.6047827336364,45.4487093199002],[-73.6047897154512,45.4488343137374],[-73.606595939391,45.4539012704808],[-73.6068229739847,45.4545462246216],[-73.6121020323687,45.4569513555897],[-73.6136069929782,45.4576943099484],[-73.6201139906435,45.4548252285575],[-73.6208281021317,45.4544862824262],[-73.6214980188519,45.4541052584758],[-73.6220710371931,45.4537422208652],[-73.6223240156066,45.4535892227968],[-73.6227950163629,45.4532612144131],[-73.6255510191322,45.4513161827494],[-73.6263110224133,45.450751161075],[-73.626998045521,45.4501421230244],[-73.6275990664249,45.4495021293978],[-73.6288140769018,45.448289073351],[-73.6290820298705,45.4483901068409]],[[-73.5592306898526,45.5398986242761],[-73.5610486514678,45.5401086797545],[-73.5636517542747,45.5403666121292],[-73.567114710442,45.5406936761429],[-73.5690667608012,45.5409057335781],[-73.5736737785322,45.541359700419],[-73.574017810734,45.5413807175834],[-73.5764927524736,45.5415727416349],[-73.5771967470294,45.5415957505788],[-73.5775446626919,45.5415967719146],[-73.5780336664692,45.5415817660779],[-73.5786067115566,45.541542762552],[-73.5791097089261,45.5414886864044],[-73.5796567245868,45.5414127128987],[-73.5800766819584,45.5413416866382],[-73.5805056962644,45.541252743576],[-73.5810606578124,45.541123754405],[-73.5815087330357,45.5409987094571],[-73.5820707049476,45.5408297561176],[-73.5824746997021,45.5406847614449],[-73.5829796956741,45.5404907394322],[-73.5838506739363,45.5400848110122],[-73.584191658983,45.5398988345166],[-73.5851887116832,45.5392598345628],[-73.5854126875088,45.5390908541137],[-73.586655715332,45.5380419332307],[-73.5892078258429,45.5358500177486],[-73.5912088689105,45.5342081035264],[-73.595157927651,45.5308490791859],[-73.5955219132733,45.5305850983631],[-73.596188912561,45.5301611241946],[-73.5971359375373,45.5296621253385],[-73.5980219183509,45.5292900599946],[-73.5986048965885,45.5290841059584],[-73.5992859680526,45.5288770739501],[-73.5997769047219,45.5287601058379],[-73.6001399299509,45.5286860843851],[-73.6012159982325,45.528517120145],[-73.6023780039335,45.5283981055031],[-73.6045859873054,45.5283520992322],[-73.6057849847563,45.5283731308991],[-73.6061840218251,45.5283641205522],[-73.6064669723294,45.5283371295353],[-73.6068910354485,45.5282731075219],[-73.6073930645886,45.528173103127],[-73.6078560572055,45.5280371369576],[-73.6083059882386,45.5278650929998],[-73.6088439552983,45.5276261015922],[-73.612422919886,45.5256420616179]],[[-73.612422919886,45.5256420616179],[-73.6122399832393,45.5255640375319],[-73.6027967704682,45.5213480469144],[-73.5967786568455,45.5186900628813],[-73.5913807820754,45.5162801450928],[-73.5913087273834,45.5162461850563],[-73.590205784111,45.5157531802494]],[[-73.590205784111,45.5157531802494],[-73.5898038527872,45.5162821189518],[-73.589329823556,45.5167521648295],[-73.588249832576,45.5162831534474],[-73.5866209258684,45.515553109784],[-73.5824311133809,45.513601099907],[-73.5801882083286,45.5124581897934],[-73.5796102246222,45.5121501911631],[-73.5792041753087,45.5118141708293],[-73.5785722302299,45.5113411501201],[-73.5781491746134,45.5108461168909],[-73.5785002617101,45.5102881009511],[-73.5789882552803,45.5098771269704],[-73.5795421952856,45.5093031215612],[-73.5801323095696,45.5081951568356],[-73.576104013202,45.5062182398167],[-73.5734439212372,45.5049542690125],[-73.5730339444319,45.5054312040147],[-73.5726709474589,45.5059971985846],[-73.5719459912642,45.5072121531739],[-73.5713009679028,45.5083051174564],[-73.5708169830677,45.5092361054354],[-73.5701779876395,45.5107450266126],[-73.5694320010726,45.5124890647088],[-73.5677339236421,45.5162970637949],[-73.5655648192219,45.5211118884872],[-73.5655598331713,45.5213689022388],[-73.5655387286906,45.5217498405612],[-73.565478699997,45.5227208631344],[-73.5653777326036,45.5231618696269],[-73.5651077287913,45.5241737787422],[-73.5645856320741,45.5258177593445],[-73.5629925868819,45.5309197749242],[-73.5613836655163,45.5358337447872],[-73.5601746655118,45.5381566979218],[-73.5592306898526,45.5398986242761]],[[-73.5993974145556,45.4374840663238],[-73.5946690226256,45.4431892099677],[-73.5935769817139,45.4442902298626],[-73.5929059641192,45.4449502663461],[-73.5922129470816,45.4456432490745],[-73.5921319500057,45.4456312525607],[-73.5906198477406,45.4476272761096],[-73.5905178773699,45.4477602785393],[-73.5895417718362,45.4479752148593],[-73.587301741834,45.4501962121303],[-73.5868967271875,45.4505632520352],[-73.5866837608396,45.4507352140088],[-73.5865197545808,45.4508572813951],[-73.5857497490993,45.4514312202668],[-73.5841867166578,45.4525122305749],[-73.5840017397609,45.4526502393435],[-73.5832896473991,45.4532642591481],[-73.5830146850852,45.4535293175506],[-73.5827086813954,45.4538442560052],[-73.5822606462578,45.4543193042607],[-73.5818966524899,45.4547883427912],[-73.5815276979444,45.4553322602676],[-73.5812487081355,45.455810326934],[-73.5810206354008,45.4562493063437],[-73.5808784282122,45.4565857692612],[-73.5807548322293,45.4569258535532],[-73.5806500336367,45.4572690507015],[-73.5804073577404,45.4582436671681],[-73.5803031459625,45.459291086851],[-73.5803286899427,45.4598693652176],[-73.5803549192526,45.4601430200811],[-73.5803981247474,45.4605935929864],[-73.5804250300605,45.4607602043085],[-73.5805942586815,45.4615124461992],[-73.5808535120379,45.4624249615467],[-73.5808936435286,45.4625916089755],[-73.581005858107,45.4633230879727],[-73.5810229813716,45.4634664649613],[-73.5810426837532,45.4638295141462],[-73.5810551898188,45.4643104034322],[-73.5809627027485,45.4654551829017],[-73.5809219838412,45.4656973746465],[-73.5808825144729,45.465910030266],[-73.5808377741481,45.466122250551],[-73.5807877778024,45.4663338069256],[-73.5807269956159,45.4665640269796],[-73.5788604229342,45.4664828006397],[-73.5787637204685,45.4675772317591],[-73.5776955036394,45.4675304911315],[-73.5774574197066,45.4677948139799],[-73.5759694474283,45.4677296880892],[-73.576075805274,45.466526623435],[-73.5725997197174,45.4663751553698],[-73.5725691465504,45.4663747629114],[-73.5725386423344,45.4663762447884],[-73.5725084359613,45.466379590955],[-73.5724787601389,45.4663847751656],[-73.5724498373292,45.466391759484],[-73.5724218899721,45.4664004888765],[-73.5723951289856,45.4664108984192],[-73.5723697575954,45.4664229078956],[-73.5723459700629,45.4664364271969],[-73.5723239465655,45.4664513527258],[-73.5723038532012,45.4664675709958],[-73.5722858432689,45.4664849595301],[-73.5722700559878,45.466503385963],[-73.5722566075485,45.4665227098443],[-73.5722456026234,45.466542783533],[-73.5722371241418,45.4665634567021],[-73.572231237118,45.4665845700376],[-73.5722279861057,45.4666059642383],[-73.5720285048274,45.4688330168627],[-73.5718680460055,45.4702724704379],[-73.5717201122084,45.4722705198354],[-73.5714071140445,45.4725084804974],[-73.5717041782116,45.4728335332474],[-73.5718401909882,45.4731015393027],[-73.5723451195517,45.4741024930212],[-73.5721141665246,45.4741605057235],[-73.5708291763847,45.4744185178838],[-73.5705162415641,45.4744735182477],[-73.5701972690875,45.4745095317977],[-73.5698752111594,45.4745254786672],[-73.5695522848982,45.4745225264089],[-73.5692312326667,45.4744995026593],[-73.5689142689329,45.4744564979005],[-73.5686032959109,45.4743944990795],[-73.5683022174383,45.4743135048235],[-73.568011243588,45.4742135159988],[-73.5651172554904,45.4731064786263],[-73.5629772463762,45.4722905406474],[-73.5630852185887,45.4721515314005],[-73.560973239234,45.4713394996355],[-73.5597412593085,45.4708835237607],[-73.5564354357745,45.4697112970061],[-73.5538776434711,45.4688030684979],[-73.5534326505313,45.4688550299764],[-73.552937581469,45.4689420222104],[-73.5524565670116,45.4690600555171],[-73.5519905541684,45.4692060675229],[-73.551779559952,45.469302103135],[-73.5508785692256,45.4697570861037],[-73.5500375270849,45.47026611411],[-73.5492625465885,45.4708241540041],[-73.546021384575,45.4731172362101],[-73.5428472771015,45.4748973260876],[-73.5420602841526,45.4753453262075],[-73.5409312653489,45.4758652769126],[-73.5391672540822,45.4764693187956],[-73.5389092385276,45.4765342931181],[-73.5384451731991,45.4765933057065],[-73.5381631683897,45.4765993395953],[-73.5377741772011,45.4765933480507],[-73.5373842212494,45.476558286818],[-73.5368382323131,45.476503288976],[-73.536116261254,45.4764253024043],[-73.5355512757608,45.47635329577],[-73.5353982879291,45.4763252625777],[-73.5349052453019,45.4762373013014],[-73.5341842906374,45.4760802871129],[-73.5297155768494,45.4750671791465],[-73.5212763404032,45.4731533628261]],[[-73.5212763404032,45.4731533628261],[-73.5220629297227,45.4742465203548],[-73.5223013378201,45.4745722324391],[-73.5225012927172,45.474910511052],[-73.5226614618739,45.4752591128462],[-73.5291826363344,45.4917076069951]],[[-73.5291826363344,45.4917076069951],[-73.5297260339216,45.4915230858779],[-73.535405999619,45.4895902243632],[-73.5399129414637,45.4880523958515],[-73.5402509178576,45.4881843864784],[-73.5406039709933,45.4882943234579],[-73.5409689337849,45.48838337659],[-73.5412569433888,45.488435380304],[-73.549312964988,45.4899903270932],[-73.5494859543922,45.4900273293934],[-73.5496679205605,45.4900723370077],[-73.549899922069,45.490135321112],[-73.5500889690348,45.4901913937655],[-73.550266940273,45.4902503503108],[-73.5504810169866,45.4903263893101],[-73.5506889767427,45.4904073806001],[-73.5508519747321,45.4904773226282],[-73.550967994181,45.4905273063084],[-73.5511379650906,45.4906083136674],[-73.5513450009874,45.4907143213276],[-73.5515159351977,45.4908083761554],[-73.551767014088,45.4909553101024],[-73.5519889723132,45.4911063059805],[-73.5527500259294,45.4916593180264],[-73.5534449179275,45.4924583100288],[-73.5538219640431,45.4930273371825],[-73.5542788965547,45.4941702986313],[-73.5546417779009,45.4949183178422],[-73.5550977601888,45.495439324723],[-73.5556377667423,45.4958513028074],[-73.5560687950318,45.4960652607914],[-73.5586558674546,45.4970641649168],[-73.5595458467295,45.4974361708526],[-73.5613819337669,45.4983160886715],[-73.5623428375509,45.4964722056253],[-73.5630928909463,45.4952512696567],[-73.5638388424598,45.4941563082779],[-73.5645008829016,45.4932643109994],[-73.5671788752145,45.49009234129],[-73.5687328044439,45.4908522918004],[-73.5698455173482,45.4913623696873],[-73.5730731113373,45.4929081570495],[-73.5761830149272,45.490553327871],[-73.5769825997116,45.4899640411638],[-73.5782545966912,45.4889815378342],[-73.5784434727384,45.4888372844831],[-73.5788497763445,45.488527099886],[-73.5803207524328,45.4875027714921],[-73.5807756211484,45.487201671627],[-73.5815240781672,45.4867156699989]],[[-73.5815240781672,45.4867156699989],[-73.5806059889231,45.4855663223266],[-73.5807761235675,45.4854517969429],[-73.5830128375541,45.4839453686739],[-73.5843512143286,45.48304435949],[-73.5851248265437,45.4822492293223],[-73.5857669236011,45.4825564986615],[-73.585842159093,45.4825040232766],[-73.5859519485223,45.4824275360745],[-73.5860194907969,45.4824354645839],[-73.5860874647701,45.4824412961226],[-73.5861557373741,45.4824450182002],[-73.5862241755523,45.4824466255248],[-73.5862926475283,45.4824461137039],[-73.5863610228148,45.4824434846428],[-73.5866410201649,45.4823565071678],[-73.5866845273386,45.4823261561975],[-73.5867397768813,45.4822871676185],[-73.5893576021328,45.480460452931],[-73.5900068258423,45.4800093599206],[-73.5901758526521,45.4798926443477],[-73.5905176800022,45.4796559312425],[-73.5905654521352,45.4796236163474],[-73.5908679006227,45.4794136816625],[-73.5917058640612,45.4788284356538],[-73.5921757368073,45.4785019228773],[-73.5922621728772,45.478441781781],[-73.5925892676331,45.4782166858588],[-73.5929575787764,45.4779613438934],[-73.5934780420252,45.4775990280753],[-73.593757708561,45.477402563076],[-73.5939081070373,45.4772985787684],[-73.5946866828007,45.4767563915303],[-73.5951357763157,45.4764447402168]],[[-73.6352965061135,45.4507753419737],[-73.6352364539272,45.4507523232681],[-73.6349223305298,45.4506320608805],[-73.6339251893613,45.4502524832022],[-73.6336011527952,45.450129294258],[-73.6331904600711,45.4499732183878],[-73.6322407594411,45.4496121579703],[-73.6319658361357,45.4495066838684]],[[-73.9743520622515,45.4664301916245],[-73.95671430917,45.468627318003],[-73.9560172373531,45.4690344356752],[-73.9506348007981,45.4708771485253],[-73.9465827638345,45.4719644450953],[-73.9426009352941,45.4725825954631],[-73.9398666832536,45.4734502615387],[-73.9373872489873,45.4744597383053],[-73.9360702550261,45.474821901921],[-73.9343959997382,45.4749354189754],[-73.934040953626,45.4749724817992],[-73.9332287910759,45.4749755651759],[-73.9324684878393,45.475121298356],[-73.9314258243231,45.4755719500602],[-73.9309021177321,45.4756810652706],[-73.9303771371097,45.4756235242626],[-73.9297836600174,45.4754591013148],[-73.9291067633181,45.4754497434048],[-73.9285490309085,45.4755351676628],[-73.9278213718023,45.4755259927662],[-73.9273474246924,45.4755039588437],[-73.9269749101058,45.4754696404792],[-73.9264161840744,45.4754241116059],[-73.9259599687121,45.4755091440333],[-73.925520671925,45.4755941124903],[-73.9250117190186,45.4754174447272],[-73.9247393831571,45.4752041823883],[-73.9240390476062,45.4746264556634],[-73.9236842595966,45.4742468374408],[-73.923164908845,45.4735821254513],[-73.9223030843491,45.4728682051429],[-73.9213857141394,45.4723716155643],[-73.9209366014564,45.4720447151632],[-73.9205681804527,45.4716460902931],[-73.9201777667243,45.4710189822783],[-73.9200926339607,45.4704907443954],[-73.9199478694291,45.470134147652],[-73.919620707468,45.4698210781567],[-73.9191318763005,45.4696085969111],[-73.9185611025765,45.4692964183679],[-73.9181528503051,45.4689979251307],[-73.9176545831493,45.4682397742292],[-73.9173758096115,45.4671455900582],[-73.9172323648489,45.466050913826],[-73.9165486245793,45.4651010609619],[-73.9151213198805,45.4642491464179],[-73.9139030042618,45.4642059529419],[-73.912552144622,45.464544164925],[-73.9113019412171,45.4650826247676],[-73.9101663707734,45.4652581321055],[-73.9081642279234,45.4653795877347],[-73.9065404575149,45.4654234852412],[-73.9050793609848,45.4655048770156],[-73.9036449270758,45.4655290068466],[-73.9027249170487,45.4655703427904],[-73.901211991235,45.4659756501453],[-73.8990323041609,45.4668342007614],[-73.8982316745657,45.4672536554622],[-73.8971785250016,45.4678525586814],[-73.8964203697018,45.4683016254958],[-73.8955369887196,45.4689892357903],[-73.8946942236627,45.4694386161498],[-73.8935543453588,45.469740209624],[-73.8918633752148,45.4698651229109],[-73.8901735550518,45.4701685312386],[-73.8885266133199,45.4705610445023],[-73.8875578415411,45.4711595611894],[-73.8867167651049,45.4718766621746],[-73.8860454810229,45.4726824848489],[-73.8856215908137,45.4731712120336],[-73.8840026208922,45.4739576184355],[-73.8832464262515,45.4742268314703],[-73.8826253263591,45.4744574876851],[-73.8822084254766,45.4748588911696],[-73.8820008428167,45.4752540554252],[-73.8786141673239,45.470927299705],[-73.8785531231598,45.4708309880105],[-73.8783554320162,45.4705686042949],[-73.8782881659159,45.4704793079776],[-73.8779622133952,45.4706059088091],[-73.8773564207684,45.4708412132182],[-73.8771065407592,45.4709326559877],[-73.8766323186583,45.4711097876902],[-73.8761677558472,45.4712824566678],[-73.8761803524045,45.471298531609],[-73.875285328937,45.4716723203709],[-73.8746682570708,45.4719504606254],[-73.874416491579,45.4720641186786],[-73.8735952365252,45.4724344272792],[-73.8733091513239,45.4725604713723],[-73.8729079991446,45.4727003793883],[-73.8724356676912,45.4728729794098],[-73.8723076147145,45.4729138285038],[-73.8718758441038,45.4730631650868],[-73.8716550279942,45.4731402829673],[-73.8712083347581,45.4732963089821],[-73.8716965717947,45.4739461795846],[-73.8717468946609,45.4740126432326],[-73.8719051723279,45.4742217644525],[-73.8721700544029,45.4745767546451],[-73.8723598658275,45.4748359231642],[-73.8725551370548,45.4750969453027],[-73.8729561696023,45.4756140771888],[-73.8723643397986,45.4760842011761],[-73.8719054566885,45.4764486932414],[-73.8716486988864,45.4766656504909],[-73.8714828139564,45.4767976521836],[-73.8712107988238,45.4770237004653],[-73.8710049271635,45.4771878708841],[-73.8707132104035,45.4774311265061],[-73.8705769592418,45.4775569584759],[-73.8703118649695,45.477772797338],[-73.8686142466137,45.4793345668725],[-73.8669403046266,45.4806131607994],[-73.8661065308375,45.4812721531105],[-73.8659384717449,45.4814120009068],[-73.8657983185182,45.4815286565814],[-73.8656581893556,45.4816452592791],[-73.8655178592372,45.4817617833574],[-73.8653662227767,45.4818878867213],[-73.8652803143056,45.4819476181379],[-73.8650764670449,45.4821173249938],[-73.8649513720721,45.4822256799637],[-73.8647317648935,45.482415841271],[-73.8646937242214,45.4824406557844],[-73.8644316980534,45.4826201168639],[-73.8641740706723,45.4827961976759],[-73.8639821115822,45.4829274102742],[-73.8635527040273,45.4832224756894],[-73.8634324259363,45.4833153211704],[-73.8628874457049,45.4837134783185],[-73.8624496756102,45.4840270990791],[-73.8622078236199,45.4842768617815],[-73.8614372563299,45.4850691285369],[-73.8613447748505,45.485165144017],[-73.8611041261792,45.4853505755896],[-73.8608229353918,45.4855886052365],[-73.8606835083506,45.4857048656014],[-73.8600494437725,45.4862296729572],[-73.8598669990185,45.4863830020029],[-73.8590837360551,45.4870429343983],[-73.858918785746,45.4871819886442],[-73.8587630543297,45.4873131312563],[-73.8590460868292,45.487751646141],[-73.8591562870538,45.4879222352364],[-73.8593482509139,45.4882196087172],[-73.8595077550413,45.4884692445766],[-73.8595864124281,45.4885790171775],[-73.8601841587048,45.4898658637951],[-73.8601991405396,45.4898569850834],[-73.8603304321935,45.489795479937],[-73.86039788544,45.4897699677734],[-73.8604360708338,45.4897589419368],[-73.8605384694276,45.4897433108657],[-73.8606286301586,45.4897364531669],[-73.8607420080414,45.4897419476775],[-73.8608624485546,45.4897421472322],[-73.8609726433735,45.4897695940888],[-73.861112578248,45.4898564649193],[-73.8611898073387,45.4899335424224],[-73.8613080952547,45.4900894285919],[-73.8613238897379,45.490124968219],[-73.8613149975742,45.4901606738079],[-73.8613087547089,45.490212109522],[-73.8612905262729,45.4902805079698],[-73.8612780371993,45.4902968835297],[-73.8610948270918,45.4906291533658],[-73.8610764263658,45.4906628283099],[-73.8610240317564,45.4907457155317],[-73.8608769863486,45.4909426083099],[-73.8608396368399,45.4909868178371],[-73.8608221685074,45.4910061089659],[-73.8607825416601,45.4910341389988],[-73.8607602378312,45.4910475137936],[-73.860736468478,45.491054837792],[-73.8610746859869,45.4917829025563],[-73.8603882416009,45.4921607093145],[-73.8599259963179,45.4926681073554],[-73.8598434435623,45.4929957386452],[-73.8593398142821,45.4936520648419],[-73.8590041178979,45.4940995331873],[-73.8584570254785,45.4945774224243],[-73.8577483633989,45.4954916624483],[-73.8573115606385,45.4960168517676],[-73.8571460491802,45.49661257502],[-73.8572852253618,45.4972073259795],[-73.8578306598911,45.4978007898105],[-73.8590204133915,45.498558892755],[-73.8597691750986,45.4991755396956],[-73.860721709422,45.4998867608158],[-73.8610643933102,45.5005285133283],[-73.8611693193131,45.5010519823784],[-73.8610039972451,45.5016715454496],[-73.8606016710194,45.5022918582364],[-73.8599954313599,45.5027937667838],[-73.8591863419762,45.503343927562],[-73.8587492286446,45.503821482704],[-73.8584141269462,45.504370154095],[-73.8582478435228,45.5048468797838],[-73.8582172887448,45.5053708015624],[-73.858457449672,45.5058700701254],[-73.8586977724589,45.5063931389636],[-73.8589727118894,45.5070351487652],[-73.8587386982793,45.5075120936888],[-73.8581323807179,45.5080140025028],[-73.8572209221538,45.5084453372653],[-73.856139703457,45.5088057417856],[-73.8550936456387,45.5093803439491],[-73.8544202952856,45.5100014600924],[-73.8537819485081,45.5108129610324],[-73.8531785538655,45.511485284942]],[[-73.8531785538655,45.511485284942],[-73.85400038625,45.511677119221],[-73.8545151980086,45.5121820556846],[-73.8548830341307,45.5125425169275],[-73.855360801973,45.5129025829725],[-73.8556916895428,45.5131909436579],[-73.8560952823242,45.5134066350342],[-73.8563540909021,45.5138157181006],[-73.8565027325203,45.5142491746933],[-73.8564321770204,45.5146111472075],[-73.8565812870145,45.515068721059],[-73.8570218712737,45.5153566550349],[-73.8582315047528,45.5158351200314],[-73.8593684366468,45.5163619558924],[-73.8606518347258,45.5169364660086],[-73.8617527741415,45.5175357467775],[-73.8622676798035,45.5179922593793],[-73.8627468767974,45.518593512325],[-73.8628872587683,45.5191115105267],[-73.8629437428368,45.5193403598367],[-73.8630917572263,45.5196171586085],[-73.8632943597017,45.5198456405545],[-73.8635693976863,45.51997733465],[-73.864027041911,45.520036195455],[-73.8647949003897,45.5200336938041],[-73.8659093766699,45.519885570913],[-73.8668046835418,45.5198345850431],[-73.8677921974268,45.5198434132147],[-73.8685061614612,45.5199855967346],[-73.8692384530587,45.5201038677017],[-73.8698055054922,45.5201260293506],[-73.8704085565229,45.5200517774728],[-73.8716519789732,45.5200597681994],[-73.8734077352447,45.5201262907924],[-73.875969051049,45.5203830894379],[-73.8770483599444,45.5204760133899],[-73.8783291398831,45.5206043500269],[-73.8794282341744,45.5208901306861],[-73.880399808509,45.521284662997],[-73.8812986906978,45.5217156921171],[-73.8821597841372,45.5219900746379],[-73.8831483839087,45.5221796983007],[-73.8843191015159,45.5222360408203],[-73.8856356527678,45.5222314905747],[-73.8871706729815,45.5221056878757],[-73.8890898743208,45.5219786646646],[-73.8900773250977,45.5220113847146],[-73.8910115116986,45.5222493670515],[-73.8923867349532,45.5227872122125],[-73.8934610480697,45.5234585506858],[-73.894894231405,45.5244663005615],[-73.8961396189199,45.5255449748978],[-73.8986513024253,45.5246421496237],[-73.8998793049117,45.5244588551968],[-73.9002785454365,45.5243991393564],[-73.9039847760143,45.5234869497912],[-73.9076889138296,45.5222748851383],[-73.910482868125,45.5209660920039],[-73.9128182940882,45.5191593401486],[-73.915451652791,45.5167019861741],[-73.9194451623347,45.5137401248084],[-73.9239744213497,45.5115753609365],[-73.927978474265,45.5101617615199],[-73.9301305798079,45.5092544665326],[-73.9333746291851,45.5075438654567],[-73.9345453003648,45.506560927918],[-73.9354067620372,45.5058377044078],[-73.9384149901414,45.5030786228965],[-73.9414212483532,45.5001197712489],[-73.9449557352434,45.496909046634],[-73.9462398637514,45.4958465263529],[-73.9482122148483,45.4939298659003],[-73.9499068136555,45.4923466156721],[-73.9518511481361,45.4903743906665],[-73.9536292032225,45.4885133079125],[-73.955323643988,45.486596643114],[-73.9573234541887,45.484291035894],[-73.9589625482419,45.4823467269832],[-73.9601846822434,45.4808188535826],[-73.9613237718695,45.4793744576303],[-73.9629351235048,45.4772078325346],[-73.9645183408775,45.4749577826074],[-73.9657127391591,45.4734300534264],[-73.9674350404496,45.4715689779916],[-73.9690741303427,45.4701523334085],[-73.969685063287,45.469624532635],[-73.9709076125609,45.4686801482828],[-73.9721574964496,45.467819153995],[-73.9728519820087,45.4673745930486],[-73.9743520622515,45.4664301916245]],[[-73.5068798058957,45.610651036789],[-73.5086303771476,45.610953112881],[-73.5087345183782,45.6109668270635],[-73.5092900554807,45.6110617384212],[-73.5094036574523,45.6110820462041],[-73.5124379079687,45.6116003938359],[-73.5126285940759,45.6116330766753],[-73.5142914695695,45.6119190608703],[-73.514596923268,45.6119699172061],[-73.5148609939166,45.61201331728],[-73.5160269147223,45.6122145031511],[-73.516409410366,45.6122797737331],[-73.5166389114957,45.6123176340853],[-73.5170758636828,45.6123920788106],[-73.5185296882212,45.6126450538762],[-73.5187604738227,45.6126795702175],[-73.5191348232161,45.6127448321381],[-73.5202583250658,45.6129354340606],[-73.520640565516,45.6129997534001],[-73.5208695087715,45.6130391595391],[-73.5212475592273,45.6131054996557],[-73.5213048722111,45.613115269219],[-73.5223660930817,45.6132964050122],[-73.522749625408,45.6133627347316],[-73.5229786731622,45.6134017878888],[-73.5233563212539,45.6134661000987],[-73.5234136287827,45.6134758686111],[-73.5244913875732,45.6136596175706],[-73.5248696531218,45.6137241795033],[-73.5371866179934,45.6158357657932]],[[-73.5696559300578,45.5965919209051],[-73.5696790182423,45.5965389013409],[-73.5687970092404,45.5950969391696],[-73.5687399670033,45.5949618953058],[-73.569048031191,45.593732962558],[-73.5686770125709,45.5922959202541],[-73.5675350209055,45.5903129012513],[-73.5674280357327,45.5901318994406],[-73.5663610942248,45.5883388881755],[-73.566273078279,45.5882838637729],[-73.5660100898924,45.5881198701259],[-73.5642220454459,45.5872438167513],[-73.564182015506,45.5871818352729],[-73.5641540216978,45.5868298928402],[-73.5642160193216,45.5854018691201],[-73.5639439655983,45.5849698788417],[-73.56607210689,45.5843148913896],[-73.5659310590596,45.58419285321],[-73.5658330374226,45.5840738497687],[-73.5657290046399,45.5839669091911],[-73.5656250912515,45.5838718471143],[-73.5654740549054,45.583702838334],[-73.5654100380692,45.5836468996915],[-73.5653470692742,45.5835818712251],[-73.5652670389034,45.5834808555136],[-73.5651930357418,45.5833798363424],[-73.5648899876129,45.5831078773449],[-73.5648789752391,45.5830908753324],[-73.5648270341154,45.5830558982825],[-73.5649229712754,45.5830208383073],[-73.5649580325615,45.5829939116374],[-73.5649810496807,45.5829708618026],[-73.5650950398192,45.5829178835642],[-73.5652420742952,45.5828298813444],[-73.56527603118,45.5828528990957],[-73.5656050371516,45.5828168979626],[-73.5658649931894,45.5828478863438],[-73.5660320021384,45.5828478811332],[-73.5661090319651,45.5828258800389],[-73.5661410676309,45.5827438811565],[-73.5661380216396,45.5826718910865],[-73.5661490636318,45.5825359103421],[-73.5662019957241,45.5825149127709],[-73.5662560373371,45.5825398992078],[-73.5663380215362,45.5825069157087],[-73.5664000753461,45.5825129097472],[-73.5667620761579,45.5823209355747],[-73.5668130365899,45.5822459459754],[-73.5669320749019,45.5821779376479],[-73.567007032004,45.5821059038337],[-73.5671060085292,45.5819688848992],[-73.5673140328019,45.5820669459751],[-73.5673930552453,45.5820359453041],[-73.5674350489518,45.5818889683923],[-73.5674770226079,45.5818989334556],[-73.5675249787967,45.5818749696127],[-73.567590010884,45.5818989595161],[-73.5676350436838,45.581903973842],[-73.5676670616194,45.5818979260718],[-73.5677170380177,45.5818829590879],[-73.5677989652409,45.581893982037],[-73.5678590011704,45.581893947917],[-73.5678979939214,45.5818869063202],[-73.5679460586996,45.5818649217923],[-73.5679729874823,45.5818459177566],[-73.5679990472001,45.5818069375152],[-73.5680070372691,45.5817729174248],[-73.5680089985648,45.5817339500133],[-73.568016982522,45.581694980065],[-73.5680380008611,45.5816829097105],[-73.5680790114554,45.5816829762781],[-73.5681330269129,45.5816869945663],[-73.5681920115983,45.5816929904714],[-73.5682639666427,45.5816739614724],[-73.5683590456452,45.5816359313393],[-73.5684130189386,45.5816059339414],[-73.5684380260617,45.5815710032911],[-73.568428984974,45.5815249336349],[-73.568417958282,45.581497942925],[-73.5683800426737,45.5814359622965],[-73.5683710315155,45.5814140093738]],[[-73.5683710315155,45.5814140093738],[-73.5679950315912,45.5812929185661],[-73.5674310284743,45.5811059711717],[-73.5654570183517,45.5804419774594],[-73.5643440622851,45.5800779600558],[-73.5633130626668,45.5797349436726],[-73.5616750892878,45.5791799432768],[-73.5610910464976,45.5789799240131],[-73.5600971178164,45.5786538478077],[-73.5597671429901,45.5785389123454],[-73.5595051584065,45.5784538199802],[-73.5587991282506,45.5782188370585],[-73.5587232020281,45.578177836966],[-73.5586101913093,45.5781478345452],[-73.5585221126135,45.5781088206674],[-73.5583861280013,45.5780398625075],[-73.5582501306892,45.5779588445862],[-73.5581661590682,45.5779028197415],[-73.5580561598153,45.5778198095347],[-73.5579692095191,45.5777447976467],[-73.5578911363554,45.577669781459],[-73.5578241641741,45.5775968295483],[-73.557749181425,45.5775468299683],[-73.5560033177972,45.5759037631672],[-73.5557953147606,45.5757777810555],[-73.555692304089,45.575701785466],[-73.5555322470932,45.5756477738522],[-73.5502333080258,45.5738776505782],[-73.5489663383439,45.5734586502918],[-73.5490823326606,45.5732886047084],[-73.5495523116732,45.5725896125575],[-73.5497733150404,45.5722626647568],[-73.5500213341892,45.5718966483283],[-73.5503033298567,45.5714766237048],[-73.5506952927773,45.5708966345487],[-73.5510652866047,45.5703616452775],[-73.5514872787674,45.5697346569926],[-73.5519741683424,45.56902259142],[-73.5523992018088,45.5683936120345],[-73.5529541136174,45.5675706315176],[-73.5540880308311,45.5658405045476],[-73.5542740502884,45.565560540081],[-73.5545220013334,45.5649715132015],[-73.5546300308035,45.5642595275132],[-73.5546080324041,45.5637045484082],[-73.5545700537327,45.5629074956345],[-73.5545190414505,45.5619564748176],[-73.5544620267923,45.5609095276791],[-73.5543930374425,45.5594955077617],[-73.5543529884885,45.558506508479],[-73.554311949589,45.5575944566461],[-73.5542790207148,45.5568755250885],[-73.554282008987,45.5567984897525],[-73.5542990048598,45.5564604715215],[-73.5543739841003,45.555784505714],[-73.5543879055011,45.5556514901043],[-73.5543919866928,45.5556115319251],[-73.5543959712924,45.5555814728726],[-73.5553147602383,45.5473365656903],[-73.5564747355465,45.5450975459617],[-73.5592306898526,45.5398986242761]],[[-73.5592306898526,45.5398986242761],[-73.5565055700764,45.5396016958386],[-73.5511175594313,45.5390786840818],[-73.5504055258056,45.5390016959263],[-73.549468579795,45.538845700864],[-73.5487985876517,45.5386286616474],[-73.5485186008542,45.5385017128719],[-73.5482535962147,45.5383556785445],[-73.5479166138711,45.5381437104338],[-73.5475116268951,45.5378156778294],[-73.5473605788805,45.5376657235687],[-73.5459196604184,45.5358957329662],[-73.5439877601844,45.5336787739891],[-73.5432779391542,45.531769760449],[-73.5406310898653,45.531273870499],[-73.5354348936565,45.5329980783199],[-73.5301291075517,45.5347580265772]],[[-73.5301291075517,45.5347580265772],[-73.5300242324726,45.5350059499538],[-73.5298063873729,45.5353885870305],[-73.5295396316056,45.5357556105375],[-73.5292262030454,45.5361039405393],[-73.5131377768675,45.5522857580001],[-73.5220022850777,45.5551823508915],[-73.520218264046,45.5569930644035],[-73.518617787179,45.5586220445415],[-73.5185409499283,45.5586760449985],[-73.5190918097491,45.5589279175458],[-73.5208075460842,45.557208933077],[-73.5213584013609,45.5574337814971],[-73.5216530816695,45.5576406851031],[-73.5217043642028,45.5577576561795],[-73.5215763314602,45.5578836668044],[-73.5214739377229,45.5580635738335],[-73.5212562666811,45.5582436873848],[-73.5210770411265,45.5584956826248],[-73.5208594206953,45.5588556583079],[-73.5209106902995,45.5589545369759],[-73.5210516024405,45.558999496951],[-73.5212565425674,45.5589994516997],[-73.5214743242185,45.5590894754776],[-73.5204628408856,45.5603134291196],[-73.5206293907199,45.5603943849472],[-73.5235739899325,45.556803370111],[-73.5237789513577,45.5568663110721],[-73.5240861863271,45.5564883004145],[-73.5250469778357,45.5568570032677],[-73.524944574326,45.5570010031857],[-73.5252776684343,45.5571538059935],[-73.525098455771,45.5573968965355],[-73.525265006781,45.5574778421503],[-73.5180572645242,45.566131072255],[-73.5180308755124,45.5661627483097],[-73.5159174118156,45.567278870623],[-73.5158149357082,45.567323876878],[-73.5154947075942,45.5675038879933],[-73.5156100380211,45.5676118499857],[-73.5157509382749,45.5675308454401],[-73.5157893742933,45.567539838032],[-73.5159431415412,45.5676567923062],[-73.5159303559284,45.5677467764532],[-73.5155461390875,45.5681787472231],[-73.5155461565294,45.568241734771],[-73.515597416853,45.5682956267318],[-73.5175065441087,45.5690602711238],[-73.5141119495175,45.5708964037502],[-73.5140863371857,45.5709413984572],[-73.513830106343,45.5709774243332],[-73.5139966832719,45.5710583876511],[-73.5091801386665,45.5757649696305],[-73.5059132124885,45.5805253508103],[-73.5058363382259,45.5806693275817],[-73.5059772995758,45.5807053139741],[-73.5046448023524,45.5839987350243],[-73.5054137205158,45.5842236623004],[-73.5055931362198,45.5842866424361],[-73.5056828534094,45.5844576038401],[-73.5056316027217,45.5846105745744],[-73.5054394049754,45.5850963925811],[-73.505221560824,45.5853664353814],[-73.5050293280879,45.5853214514316],[-73.5049780662357,45.5853124550423],[-73.5039273109486,45.5877419952311],[-73.5041195481696,45.5877689823208],[-73.5055553692485,45.592061150945],[-73.5057348026777,45.5920341499851],[-73.5056835080574,45.5918541796703],[-73.5058116746008,45.5918361787746],[-73.5060936677457,45.5919711487544],[-73.5068754791463,45.5918361424062],[-73.5068242262656,45.5919261299037],[-73.5068883154222,45.5919531230515],[-73.5069780565199,45.5920880976742],[-73.507055009639,45.5923940449871],[-73.5071062974109,45.5925109338426],[-73.5072216645674,45.5925920055898],[-73.5072729389349,45.5926279974231],[-73.5072985822959,45.5926819874622],[-73.5073371215372,45.5931949020391],[-73.5075037978347,45.5935007537997],[-73.5074910244103,45.5937528031609],[-73.5075166730301,45.5938337885586],[-73.5076833388666,45.59406774124],[-73.50773463044,45.5941937176692],[-73.5077731239954,45.5944275869395],[-73.5078885626706,45.5948865943702],[-73.5079142557622,45.59521053917],[-73.5080040092961,45.595381505277],[-73.5080937534236,45.5954984801779],[-73.5081450483629,45.595633454411],[-73.508234799651,45.5957864230331],[-73.5083501760918,45.5958943959248],[-73.5083886466927,45.5960113711493],[-73.5086578745238,45.5963802819494],[-73.5086707563635,45.5967852047255],[-73.5087349027446,45.5971451320847],[-73.5088502985347,45.5973610825976],[-73.508888780103,45.597532047405],[-73.5090041922051,45.5978379807458],[-73.5090555240311,45.5981979088003],[-73.5091452886004,45.5984228592311],[-73.5091453684775,45.5988997691585],[-73.5091710534443,45.5991877127071],[-73.509235177263,45.5993766718452],[-73.5091967659805,45.5996376256117],[-73.5092865581135,45.6000064586779],[-73.5092866105978,45.600312493564],[-73.509466134142,45.6006724138379],[-73.5094789701142,45.6007713949041],[-73.5094661686449,45.6008703781196],[-73.5093892733354,45.6009693667008],[-73.5093508605169,45.601221324466],[-73.5093766537218,45.6021211599296],[-73.5093510281614,45.6021931491052],[-73.5093127366749,45.603155978501],[-73.5093255636142,45.6032009692747],[-73.5092999823786,45.603533911317],[-73.5092359075336,45.6036598940518],[-73.5091847083369,45.6041188155386],[-73.5091462648767,45.6042088023759],[-73.5091334764874,45.6044067667921],[-73.509043780799,45.6046676359761],[-73.5090438045415,45.6048206975782],[-73.5089412757928,45.6050006726251],[-73.5089156861517,45.6053246145099],[-73.508851635672,45.6056395610833],[-73.508800374417,45.6057565433793],[-73.5087491345463,45.6060174987949],[-73.5086850542471,45.6061434802848],[-73.5086594319314,45.6062604604358],[-73.5085912270413,45.6067482416984],[-73.5084648598794,45.6072556542281],[-73.5083032588906,45.6074932292526],[-73.5077102933674,45.6085941356315],[-73.5073710618661,45.609536499862],[-73.5070290264566,45.6094695300544],[-73.5069943689301,45.6095567153933],[-73.5073394973632,45.6096242914501],[-73.5072859223208,45.6099062883994],[-73.5071574900932,45.6102072659247],[-73.506768999939,45.6101336416075],[-73.5067353808791,45.6102210245001],[-73.5071298188626,45.6102957777629],[-73.5072622690701,45.6104685944393],[-73.5072965293002,45.6105991059704],[-73.5069718924542,45.610641093131],[-73.5069289977924,45.6106438416012],[-73.5068798058957,45.610651036789]],[[-73.636516910282,45.5759962946569],[-73.6364935797796,45.5760250412512],[-73.6348878259482,45.5777926775955],[-73.6349011048111,45.5777985195824],[-73.6342403997738,45.5785054040897],[-73.6337973030558,45.5789930715882],[-73.6335862762084,45.5792248286153],[-73.6336111734446,45.5792480417915],[-73.6335881029708,45.579248986148],[-73.6329124369175,45.5800142833561],[-73.6320029987452,45.57962046154],[-73.6307166001419,45.5810100660897],[-73.6307631042712,45.5810603464681],[-73.630448491294,45.5814152777948],[-73.6302559162786,45.5816031879217],[-73.6299413598911,45.5819580390127],[-73.6295130955044,45.5823747222998],[-73.6289994187228,45.5829998733939],[-73.6287832389293,45.5832170955527],[-73.6287732200027,45.5832270961725]],[[-73.6287732200027,45.5832270961725],[-73.6289382437025,45.5833270688518],[-73.6291302828709,45.5834521159923],[-73.6294382199233,45.5836411052226],[-73.629631235235,45.5838210463008],[-73.6165923271731,45.5995101769918],[-73.6125641946899,45.6043731295581],[-73.6107861672179,45.6064261410659],[-73.6106711731195,45.6065621393643],[-73.6106202211953,45.6066251826185],[-73.610556193117,45.606706145847],[-73.6105052231085,45.6067601898363],[-73.610390225799,45.6068951976952],[-73.610172248038,45.6071472019486],[-73.6100571591763,45.6072911174128],[-73.6099291519966,45.6074261366621],[-73.6097251816257,45.6076511282733],[-73.6094181571951,45.6080111125765],[-73.6092901490468,45.6081471200978],[-73.6085651456889,45.6088661095418],[-73.6082791557313,45.6091191619639],[-73.6080611652495,45.609318155862],[-73.6079201434309,45.60945309465],[-73.6076391732962,45.6096781540872],[-73.6070371821641,45.6101461261893],[-73.6067812206729,45.6103451526878],[-73.6067041244091,45.6103991286635],[-73.6066401414597,45.6104530924899],[-73.6065631513917,45.6105070682691],[-73.6063071854368,45.6107051038626],[-73.6062301948542,45.6107590794096],[-73.6048050869619,45.6094290536432],[-73.6035501129891,45.6100961129665],[-73.6041151793753,45.6106171069397],[-73.603090149747,45.6111490613011]],[[-73.6023542291246,45.6125870623215],[-73.6033931874281,45.6135620751453],[-73.6071493281462,45.6170479773583],[-73.6124332452316,45.6220729596935],[-73.6165611786021,45.6259739006853],[-73.6168871005514,45.6262819563973],[-73.6196860934357,45.628897636355],[-73.6197931468813,45.6289986596066],[-73.6206950784494,45.6298425850252],[-73.6247478305618,45.6335889967278]],[[-73.6247478305618,45.6335889967278],[-73.6250174850891,45.6333672721549],[-73.6256770565451,45.6328251297702],[-73.6283464185029,45.6305074874774],[-73.6304300528556,45.6286004096256],[-73.6319643932627,45.6267180450078],[-73.6342472122633,45.6237618499509],[-73.6358168253903,45.6213972158175],[-73.6373131771335,45.6191770492527],[-73.638316161718,45.6174279281297],[-73.6388971926747,45.6155225059313],[-73.6393328125144,45.6138343012475],[-73.6399862965814,45.6115429609078],[-73.6404327797199,45.6105839146715],[-73.6412896516128,45.6090638114347],[-73.6422012156478,45.6074473367263],[-73.642947670593,45.6056984662264],[-73.6435669032955,45.604335344842],[-73.6441587740705,45.6032314741947],[-73.6447235993766,45.6021096622265],[-73.6452334164588,45.6009879349292],[-73.6458353284925,45.6001552961092],[-73.6466751965996,45.5992741864642],[-73.6475705473743,45.5985134804408],[-73.6487762335243,45.5976077303723],[-73.6498450364985,45.5967323056988],[-73.6506666255186,45.5958269890217],[-73.6513048244188,45.594982381441],[-73.6518152859152,45.5941378677362],[-73.6527908286647,45.5927321891383],[-73.6533924274054,45.5918754104117],[-73.6542865676179,45.5907650723399],[-73.6547970849135,45.5900893646405],[-73.6554900361152,45.5892203709073],[-73.6564936952883,45.5880737703688],[-73.6574871860561,45.5866317454514],[-73.6582525694688,45.5854251893152],[-73.6584690664573,45.5851222896762],[-73.6582965087008,45.5850627486689],[-73.6581283633035,45.5849972816298],[-73.6579650442339,45.5849260457282],[-73.6578069525863,45.5848492159108],[-73.6576544766129,45.5847669808647],[-73.6575079907701,45.5846795425543],[-73.6573678547986,45.5845871157249],[-73.6573027317021,45.5845385012063],[-73.6572429201648,45.5844866308975],[-73.6571887492559,45.5844317901906],[-73.6571405170076,45.584374280822],[-73.6570810332781,45.5843041080608],[-73.6570134172654,45.5842376653438],[-73.6569381406298,45.5841754161168],[-73.6568557284619,45.5841177945767],[-73.6567667556203,45.5840652026428],[-73.6566718427214,45.5840180071537],[-73.6565716518104,45.5839765373094],[-73.6564668817439,45.5839410823743],[-73.6563582633152,45.5839118896598],[-73.6562465541575,45.5838891628001],[-73.65613253346,45.5838730603308],[-73.6560169965329,45.5838636945827],[-73.6559007492612,45.5838611308989],[-73.6557846024841,45.583865387178],[-73.6556693663399,45.5838764337487],[-73.6555499551913,45.5838914355241],[-73.6554292403925,45.5838998434357],[-73.6553079593448,45.5839016061055],[-73.6551868529095,45.5838967127489],[-73.6550666608807,45.5838851932408],[-73.6549499357784,45.5838667400425],[-73.6548361704678,45.5838407233679],[-73.654781311415,45.5838240612276],[-73.6544438652282,45.5836907990845],[-73.6543033315624,45.5836305207479]],[[-73.6207755934418,45.5236508796029],[-73.6207872028152,45.5236377690769],[-73.6208360983675,45.5235925888858],[-73.6229064657189,45.5212544720817],[-73.6244768311808,45.5195510388648],[-73.6267218934442,45.5165789048672]],[[-73.5956109141946,45.5040629949286],[-73.5934899969367,45.5061120484855],[-73.5914649102154,45.5080701175066],[-73.5941909351712,45.5097861073881],[-73.5935088384283,45.5105251548103],[-73.5943628438174,45.5109121348475],[-73.5949668679484,45.5109061398078],[-73.5956738651781,45.5111200884042],[-73.5966758518709,45.5115460750828],[-73.5969007789133,45.5117780652608],[-73.5968818247043,45.5124961373726],[-73.5968167337995,45.5125841163881],[-73.596793808861,45.5126371410099],[-73.5967787648421,45.5127301162159],[-73.5968207695811,45.5129110558321],[-73.5969408082518,45.51304108236],[-73.5970327502278,45.5130991385768],[-73.5971757853588,45.5131550812638],[-73.5973337620513,45.5131831132336],[-73.5975097723248,45.5131990707199],[-73.5977157399835,45.5132010527777],[-73.5979057416331,45.513189099848],[-73.5980747296379,45.513173114616],[-73.5984197121962,45.5131030704137],[-73.5986818075475,45.513086104328],[-73.5987887625844,45.5130941096285],[-73.5988957337211,45.5131121048595],[-73.5984157123796,45.5136001046227],[-73.5978607488775,45.5141631292314],[-73.5977037635577,45.5142861043779],[-73.597550728497,45.5143730795687],[-73.597366749244,45.5144530605157],[-73.5972027743173,45.5145020668286],[-73.5970616795637,45.5145341354493],[-73.5968587128929,45.5145621165344],[-73.5956037122206,45.5145810897428],[-73.5921677973593,45.5144841395591],[-73.5920288439416,45.5144691334948],[-73.5918448417188,45.514472163475],[-73.5916048410107,45.5145121346391],[-73.591418828585,45.5145781592694],[-73.5912887748834,45.5146491787759],[-73.5911988215994,45.5147101759116],[-73.590205784111,45.5157531802494]],[[-73.612422919886,45.5256420616179],[-73.617229085672,45.5277519834938]],[[-73.617229085672,45.5277519834938],[-73.6172792346566,45.5277741602959],[-73.617304713874,45.5277413346227],[-73.6174920524961,45.5274983627902],[-73.6175332583267,45.5275122538334],[-73.6180741889569,45.5267591051693],[-73.6182716512573,45.526500673565],[-73.6184463200447,45.5262879434732],[-73.6189685079001,45.5256985601733],[-73.6193880023274,45.5252167500984],[-73.6195329660365,45.5250641831466],[-73.6196866624052,45.5248892907296],[-73.6197870389348,45.5247700866834],[-73.6199257423881,45.5245849397865],[-73.6199544860087,45.5245576900523],[-73.620122362851,45.5243779610402],[-73.6202017130167,45.5242989075929],[-73.6207755934418,45.5236508796029]],[[-73.9743520622515,45.4664301916245],[-73.9370250052565,45.4509631539921],[-73.9368088329398,45.4507691403742],[-73.9367209294972,45.4506939641295],[-73.935577475256,45.4497120564666],[-73.935265471644,45.4494391532336],[-73.9348519327091,45.4490801346278],[-73.9316844266233,45.4463559451027],[-73.9280423713208,45.44325446863],[-73.9249009474547,45.4405960005763]],[[-73.9249009474547,45.4405960005763],[-73.9246226722795,45.4406883824903],[-73.9248136474176,45.4410019712965],[-73.9227938387521,45.4416363951344],[-73.9230278664112,45.4420391627568],[-73.920118215567,45.4431649092817],[-73.9158533673569,45.4448147484012],[-73.9145948843157,45.4452524794193],[-73.9131936397384,45.4458335472394],[-73.9126895451077,45.4460269117548],[-73.9121807198336,45.446181538086],[-73.9119084223529,45.4463334033161],[-73.9112085094017,45.4465912826664],[-73.910512808094,45.4468693722997],[-73.9103789574147,45.4469149598766],[-73.9102387687654,45.4469542782772],[-73.9079635045702,45.4477193268125],[-73.9068531941132,45.4479596463178],[-73.9055649628789,45.4484285289827],[-73.905372133905,45.4481723332165],[-73.9052232760902,45.4479891122269],[-73.9047508038394,45.4473439125942],[-73.9045378023242,45.4470454570052],[-73.9043512629398,45.4467807139511]],[[-73.9043512629398,45.4467807139511],[-73.904168685388,45.4468354734593],[-73.9039564496157,45.4469049515444],[-73.903749837109,45.4469819582541],[-73.9035419372829,45.4470572639322],[-73.9031277772708,45.4472103727189],[-73.9029208073712,45.4472868960446],[-73.9025963697972,45.4474068304251],[-73.9023363054219,45.4475029774376],[-73.9022133770424,45.4473266815099],[-73.9020347909453,45.4470694719594],[-73.901920925192,45.4469139186878],[-73.9018008670037,45.4467618748705],[-73.9016015275189,45.4465103875945],[-73.901467717691,45.4463481810104],[-73.9008193256363,45.4465115503116],[-73.900582025702,45.4465713475706],[-73.9001310864701,45.4467110506003],[-73.9003752639038,45.447149067434],[-73.8980760842277,45.4475422834479],[-73.8966912484148,45.4472193409484],[-73.8962187200985,45.4471091321078],[-73.8950199020093,45.446829542746],[-73.8940005728012,45.4465397434942],[-73.8937534010021,45.4465092771232],[-73.8935951387799,45.4465298204767],[-73.8936429579194,45.4466801299431],[-73.8935759865334,45.4467221545995],[-73.8931722409049,45.4469755491329],[-73.8927491254122,45.4472410649754],[-73.8927049747539,45.4472687838722],[-73.8925423382447,45.4473850148595],[-73.8924263998012,45.4474591591255],[-73.8923674363412,45.4474968496766],[-73.8923458355248,45.4475106763701],[-73.8922686502095,45.4475600294935],[-73.8921006430097,45.4476724295699],[-73.8917572451477,45.4479022007278],[-73.8915564287688,45.4480365574262],[-73.8914024430583,45.4481081412139],[-73.8913752904227,45.4481207735546],[-73.8912294176328,45.4481885769908],[-73.8905664744492,45.4484564222643],[-73.8904314866288,45.4485170076812],[-73.8903246017065,45.4485649926971],[-73.8902364102469,45.4486045659081],[-73.8900037964519,45.4487089828079],[-73.8895823449746,45.4488830524397],[-73.8894533340506,45.4489415863783],[-73.8892588318783,45.4490298178246],[-73.8890005343755,45.4491470181243],[-73.8888872633074,45.4492072031694],[-73.8887244346901,45.4492937351426],[-73.8883635804724,45.4495229564598],[-73.8882424828961,45.4496181691703],[-73.8879537131236,45.4499166458108],[-73.8877768037715,45.4500986681012],[-73.8875085197636,45.450344543213],[-73.887450454627,45.4503977741915],[-73.887077593585,45.4506909555456],[-73.8869325752712,45.4508049665504],[-73.8868395134938,45.4508781485831],[-73.8863814427615,45.4512109146913],[-73.8862461033328,45.451312958174],[-73.8861987300792,45.4513487697907],[-73.8860085389387,45.4514924755504],[-73.8856971413707,45.4517275613877],[-73.8855279400482,45.451855315703],[-73.8850218442951,45.4522373797725],[-73.8846693487481,45.4524816079577],[-73.8845020392777,45.4524956246081],[-73.884473040176,45.4524980599751],[-73.8843004185482,45.4525057051841],[-73.8840958714092,45.4525112959327],[-73.8840774989885,45.4525121927286],[-73.8838861851085,45.4525214739656],[-73.8835818167977,45.4525362301751],[-73.8833432736474,45.4525478043298],[-73.8830996852759,45.4525596127807],[-73.8824147302002,45.4525933701266],[-73.881775658009,45.4526288331557],[-73.8813990842464,45.452649718689],[-73.8811903326633,45.4527508917034],[-73.8810658083358,45.4528112554478],[-73.8809354597668,45.4528744243716],[-73.880878536358,45.4529020224158],[-73.88067110318,45.4530025574091],[-73.8805428075746,45.4530631445261],[-73.8803421771683,45.4531579178746],[-73.8802991631591,45.4531782192727],[-73.8796196986069,45.4534991399322],[-73.8794507774827,45.4535789552689],[-73.8787394849317,45.4539177464419],[-73.8785755651127,45.4539951196008],[-73.8784162995428,45.4540703147629],[-73.8780765066487,45.4542307141163],[-73.8778123622287,45.454355395476],[-73.8777412442002,45.4543894278409],[-73.8775826791759,45.4544653309633],[-73.8770794251392,45.4547061985406],[-73.876920832723,45.4547821018263],[-73.8767504175468,45.4548636760299],[-73.8766946064299,45.4548903811862],[-73.8765012389813,45.4549829359495],[-73.8764226519032,45.4550205420784],[-73.8763078696092,45.4550754913246],[-73.8761144995204,45.4551680365089],[-73.8760843287904,45.4551824685731],[-73.875925759198,45.4552583705403],[-73.8757565849174,45.45533933283],[-73.8755874344371,45.4554202957159],[-73.8753943386789,45.4555131205568],[-73.87520126784,45.4556059450223],[-73.8751358230849,45.4556373999309],[-73.8750304255196,45.455688080727],[-73.874698293567,45.4558467146275],[-73.8742007650557,45.4560843810499],[-73.8741458985836,45.4561105718924],[-73.8739523231953,45.456203045581],[-73.8735373645446,45.4564012550984],[-73.8733714943019,45.4564804724812],[-73.8732055756878,45.4565597788999],[-73.8729599180843,45.4566771222822],[-73.8725249630033,45.4568848666797],[-73.8723330108653,45.4569742039002],[-73.8722981808381,45.4569904077507],[-73.8721613247791,45.4570541073098],[-73.8719858778114,45.4571357450689],[-73.8718897520167,45.4571804884968],[-73.8718104560089,45.4572173825124],[-73.871491952078,45.457365612087],[-73.8711022903846,45.4575469385281],[-73.8704317099446,45.4578705922631],[-73.8703150285071,45.4579268941563],[-73.8701220947079,45.4580200261977],[-73.8699217405866,45.4581167056972],[-73.8693983491694,45.4583693178877],[-73.8693354638722,45.4583996540478],[-73.8690609190084,45.4585321595912],[-73.8689421684487,45.45858945968],[-73.868741835418,45.4586861452659],[-73.8687129327929,45.4587000870588],[-73.8685442154278,45.4587815206176],[-73.8683754987377,45.4588629359531],[-73.8683485373414,45.4588759580676],[-73.8681562184987,45.4589687583817],[-73.8678581607302,45.4591116195418],[-73.8671751999367,45.4594389359896],[-73.8662355801358,45.4598955296574],[-73.8661417463073,45.4599411124581],[-73.8657890016297,45.4601125850449],[-73.8662849665864,45.4606689816391],[-73.8663836747019,45.4607770258032],[-73.8664860230251,45.4608833790799],[-73.8665919447145,45.4609879858827],[-73.8667426656945,45.4611282640706],[-73.8668998043079,45.4612650112111],[-73.8670631995727,45.4613980774172],[-73.865633534472,45.4622405891777],[-73.8651749668354,45.4625093739473],[-73.8651506575126,45.4625236440689],[-73.8649836262315,45.4626215531804],[-73.8648299810673,45.4627115977933],[-73.8648116680336,45.4627223419767],[-73.8644668023384,45.4629244850552],[-73.8644406772375,45.4629398064283],[-73.8642460243327,45.463053909756],[-73.8640513451949,45.4631680128052],[-73.8639499994395,45.4632274233094],[-73.8639085455358,45.4632517126716],[-73.8638579860075,45.4632814615989],[-73.8636635820156,45.4633958006123],[-73.8636006558813,45.463432820853],[-73.8634692028825,45.463510130187],[-73.8634289429883,45.4635338180626],[-73.8632748231487,45.4636244684009],[-73.8632513591827,45.4636382782712],[-73.8630504100087,45.4637564676039],[-73.8628527687411,45.4638727230728],[-73.8622969080107,45.4641981498758],[-73.8621243944127,45.4642991563402],[-73.8615960012552,45.464608499392],[-73.8612455694586,45.4648136720801],[-73.8611294136631,45.4648816680442],[-73.860543521581,45.4652230435456],[-73.8603656903407,45.4653272910817],[-73.8602287622348,45.46540643957],[-73.8599277131014,45.46558185673],[-73.8604132312592,45.4659959205057],[-73.8601345890789,45.4662150472581],[-73.8599786660362,45.4663376866456],[-73.8598227168744,45.4664603160142],[-73.8585751136104,45.4674414093879],[-73.85826319916,45.4676866739417],[-73.8581072662725,45.467809310742],[-73.8576393896309,45.4681772119998],[-73.8574574572422,45.4683202902766],[-73.8568076409928,45.4688312580057],[-73.856677678216,45.4689334597411],[-73.8561577933281,45.469342230202],[-73.8559888555854,45.4694750801678],[-73.8554858683281,45.4698705697449],[-73.855329928088,45.469993202743],[-73.8550000504123,45.4702525671293],[-73.8545620756257,45.4705969521696]],[[-73.8545620756257,45.4705969521696],[-73.8551740485777,45.4712106519579],[-73.8553156879478,45.4713636780693],[-73.8554574939563,45.4715110893292],[-73.8555886135129,45.4716473647095],[-73.8565828687574,45.4726808037327],[-73.8567249094511,45.472828432526],[-73.8568669768398,45.4729760691889],[-73.8569487621818,45.472936752937],[-73.8571253616921,45.4732124937187],[-73.8572401595566,45.4733925460735],[-73.8573549316089,45.4735725975222],[-73.8574132350686,45.4736633321313],[-73.8565984125487,45.4740560128228],[-73.8564719534543,45.4741219624182],[-73.8562661607868,45.4742202784526],[-73.8562457763813,45.4742282417794],[-73.8561816846173,45.4742532495095],[-73.8560220824411,45.4743323694681],[-73.8560148868047,45.4743242454926],[-73.8559265069059,45.474368230113],[-73.8559147693128,45.4743568169047],[-73.8555278949027,45.4745514618726],[-73.8553907591296,45.4746204758523],[-73.855334481345,45.4746488062388],[-73.855174708526,45.4747291825257],[-73.8549475999251,45.4748434499665],[-73.8549366205064,45.474849318688],[-73.8545696330716,45.4750460255311],[-73.854380386975,45.4751474411876],[-73.8543293725461,45.4751747881995],[-73.8538207308853,45.4754618462049],[-73.8537148095222,45.4755216307037],[-73.853708474035,45.4754912191857],[-73.8535984095559,45.4755474925815],[-73.8534089340121,45.475644399369],[-73.8532197062109,45.4757411556879],[-73.8524628874635,45.4761281774069],[-73.8522736560096,45.4762249321015],[-73.8518446143093,45.4764443345762],[-73.8515174763739,45.4766125869062],[-73.8513286183066,45.4767097077567],[-73.8509509511379,45.4769039483297],[-73.8507620908751,45.4770010682093],[-73.8495834723215,45.4776072205622],[-73.8493731245849,45.4777162344311],[-73.8472370095707,45.478805059141],[-73.8470783104895,45.4788846935743],[-73.8458396668472,45.4795108833905],[-73.8459028512413,45.4796096412638],[-73.8459854708458,45.4797369100259],[-73.846149815186,45.4799917316849],[-73.8463142605885,45.4802466840903],[-73.8463966337336,45.4803740755741],[-73.8467094436461,45.4808592906358],[-73.8467864954783,45.4809863209046],[-73.846753148563,45.4810005757515],[-73.8467206052643,45.4810157208119],[-73.846688914061,45.4810317352417],[-73.8469462011984,45.481237156092],[-73.8471350216389,45.481525654373],[-73.8472787041594,45.4817418442136],[-73.8474387464365,45.4819897771373],[-73.8474555642912,45.4819821686331],[-73.8476630319484,45.4822144019495],[-73.8476016921202,45.4822421741288],[-73.8476831656161,45.4823683729518],[-73.847635106239,45.4823901375013],[-73.8478445040931,45.482619007934],[-73.8477963931606,45.4826407385212],[-73.848005466891,45.4828692226119],[-73.8480818102682,45.4829976855209],[-73.8480336732628,45.483019381204],[-73.848250094637,45.4832478071103],[-73.8484293923656,45.4835255091897],[-73.8485407880081,45.4836903226914],[-73.84867811612,45.4839034579943],[-73.848711918762,45.4839559129041],[-73.84874574712,45.484008376743],[-73.8488566399558,45.4841804934557],[-73.8489031572891,45.4842526818986],[-73.8489353703652,45.4843026464522],[-73.8491460609211,45.484629647044],[-73.8492883386782,45.4848504220211],[-73.8493670470604,45.4849725753652],[-73.849399261138,45.4850225400391],[-73.8494330654141,45.4850749951448],[-73.8496242876013,45.4853717653265],[-73.8496565022343,45.4854217300668],[-73.8497563025716,45.4855766052681],[-73.8498206838657,45.4856765349745],[-73.8498672285054,45.4857487228036],[-73.8499656172822,45.48590142395],[-73.8501728624655,45.4862230246718],[-73.8505064533375,45.4867409409047],[-73.8502970130018,45.486880805353],[-73.8494162279479,45.4874603194894],[-73.849362400297,45.4873903940912],[-73.84927089071,45.4874140316503],[-73.8492019397023,45.4874761230353],[-73.8489309721565,45.4876126625915],[-73.8486358187179,45.4877659515239],[-73.8477263297288,45.4882248479331],[-73.8470169803224,45.4885737608547],[-73.8466629727936,45.48875172777],[-73.8463326549311,45.4889138395781],[-73.8459920126431,45.4890795748028],[-73.8445723928093,45.4898024672834],[-73.8445361040365,45.4899001855211],[-73.842507852236,45.4909345047221],[-73.8386155474721,45.4928251698669],[-73.8382506526429,45.4930027394347],[-73.8378300356209,45.4932105344761],[-73.8374590031219,45.4933946881],[-73.8370621335456,45.4935880436971],[-73.8361044247492,45.4940568445104],[-73.8352505038832,45.494504155306],[-73.8351955514624,45.4945291407177],[-73.8358181001936,45.4953392034002],[-73.8367559678348,45.4965833072958],[-73.8371611125951,45.4971207527337],[-73.8373401077215,45.497357719606],[-73.8376391854467,45.4976952096628],[-73.8375179707777,45.4977648634718],[-73.8373359128384,45.4978694944566],[-73.8369626269736,45.4980839878202],[-73.8367760089519,45.4981912362267],[-73.836587844417,45.4982993554382],[-73.8364027433517,45.4984057286237],[-73.8362102936273,45.4985163065157],[-73.8359384667007,45.4986725137757],[-73.8358202718161,45.4987340046575],[-73.8355232786708,45.4982703718803],[-73.8348800442083,45.4985808847491],[-73.8345266998882,45.498751466153],[-73.8345426189112,45.4987725062518],[-73.8339981759807,45.4990597732706],[-73.8336429251366,45.4992472254768],[-73.8330585404405,45.4995014209617],[-73.8325097135951,45.4997250218623],[-73.8320437797262,45.4999570673271],[-73.8320076758617,45.4999757489299],[-73.8317045876888,45.5001313250272],[-73.8316802359097,45.5001424511763],[-73.8308772681142,45.5005091007114],[-73.8307123112171,45.5005844297306],[-73.829828636247,45.5010462847442],[-73.8298077511969,45.5010562621598],[-73.8294967633407,45.501204735717],[-73.8293300497245,45.5012835527297],[-73.8288633239665,45.5015038426323],[-73.8282282294014,45.5017950413496],[-73.827873186755,45.5019679875928],[-73.8265941723744,45.5025722830506],[-73.8264289368421,45.5026145526547],[-73.826117409136,45.5026942615957],[-73.8261039257178,45.5026991825851],[-73.8260927011804,45.5027063818024],[-73.826084490263,45.5027153711838],[-73.8260798486812,45.5027255444554],[-73.8260790898321,45.50273621415],[-73.8260822633298,45.502746662059],[-73.8261097258809,45.5028011567826],[-73.8259429512614,45.5028799416456],[-73.8258315912379,45.5029382391684],[-73.8256192849944,45.5030529621996],[-73.8254980419155,45.5031137872476],[-73.8250920211369,45.5033175062976],[-73.8249421256597,45.5033898276252],[-73.8244725215212,45.5036163583689],[-73.8240027634609,45.5038429770687],[-73.8232869068012,45.5042124771236],[-73.8225442399487,45.5045930324351],[-73.8221201529831,45.5047811142187],[-73.8207196915716,45.5054252540259],[-73.8204653694217,45.5055546464484],[-73.8192454454394,45.5061749426288],[-73.8161794309546,45.5030318438567],[-73.8157579908282,45.5026149227487],[-73.8155341465693,45.5027122362337],[-73.815299758158,45.5028170740369],[-73.8151194697312,45.5029023413209],[-73.8149546288703,45.5027386989205],[-73.814841305052,45.5026233633913],[-73.8146182833586,45.502399457961],[-73.8151773416112,45.5021240900557],[-73.8149884171371,45.5019325123834],[-73.814428088893,45.5022085074915],[-73.8142043295643,45.5019838658187],[-73.8138380574916,45.5016001848296],[-73.8143623681357,45.5012860438865],[-73.8136148847174,45.5004972046419],[-73.8126648897607,45.4994946311042],[-73.811623933276,45.4984445929791],[-73.8114714335514,45.4982958216157],[-73.810891186918,45.497694420074],[-73.8101116544296,45.4968864688074],[-73.8100294044147,45.4967957214153],[-73.8090626787974,45.4972569754416],[-73.8088787430349,45.4970487490689],[-73.8081946127178,45.4973641000805],[-73.8073676847549,45.4977711694293],[-73.8061568315089,45.4983500175897],[-73.8046939540848,45.4990493295938],[-73.8034189903645,45.4996587909385],[-73.8020608433051,45.5003079972753],[-73.8007057535783,45.4990097367834],[-73.7999842980656,45.4993524943142],[-73.7998810885264,45.4994032283288],[-73.7967647788525,45.5008900606923],[-73.7964610436808,45.5010349594386],[-73.7951977053791,45.5016376647665],[-73.7946369960872,45.5019051641146],[-73.7946100459799,45.5019180152266],[-73.7940209857789,45.5021967092351],[-73.7939073367973,45.5022509103834],[-73.7937254016739,45.5023378528425],[-73.7935435032921,45.5024248173716],[-73.792998142105,45.5026855236446],[-73.7905572876745,45.5038523298587],[-73.7903578395544,45.5039474750832],[-73.791057012606,45.5043762252094],[-73.7921362482369,45.5050548214148],[-73.7922494344333,45.5051391509258],[-73.7922621223049,45.5051665268109],[-73.7906708893094,45.5048079433508],[-73.7876576542747,45.5041285572287],[-73.7836990020041,45.5032359040602],[-73.7839402966027,45.5027064858974],[-73.7840421663533,45.5027102856187],[-73.7841441155455,45.5027077312034],[-73.784245343172,45.5026988426522],[-73.7843450548688,45.5026836885436],[-73.7844424680495,45.5026623887209],[-73.7845368182818,45.5026351097762],[-73.7846273656963,45.5026020668338],[-73.7851870066595,45.5023381005009],[-73.7853844797165,45.5022443032439],[-73.7859695642376,45.5019570558828],[-73.7860549821521,45.5019637666604],[-73.7861394514308,45.501974938497],[-73.7862224995918,45.5019905086902],[-73.7862825939733,45.5018520710241],[-73.7862872878766,45.501784416841],[-73.786312833443,45.5014152174774],[-73.7857343923608,45.5010520326985],[-73.7855402092959,45.500930121829],[-73.7846459554101,45.500368628723],[-73.7829246471948,45.4992856131845],[-73.7821909452286,45.499629392585],[-73.7812000707969,45.5001100119048],[-73.7806167830397,45.4997392887405],[-73.7781824610744,45.5009014394536],[-73.7780684213676,45.5008657222602],[-73.7774483082737,45.5005060460221],[-73.7769824608172,45.5001100565844],[-73.7767711540037,45.5002092733634],[-73.7758594271069,45.4996678818],[-73.7754257385199,45.4994041841574],[-73.7747637202066,45.4989585212825],[-73.7741781429071,45.4985289304407],[-73.7736210636385,45.4981998311138]],[[-73.7736210636385,45.4981998311138],[-73.7723773637723,45.4988906451708],[-73.77167789666,45.4991086256518],[-73.773881986544,45.5005086098294],[-73.7709096919502,45.5014640710316],[-73.772507128661,45.5025735461205],[-73.7716011503707,45.5030255031449],[-73.7709631247623,45.5034055403589],[-73.7692001227496,45.50401260737],[-73.7671980240963,45.5027486066011],[-73.7656520642809,45.5032736546227],[-73.765384011615,45.503463627722],[-73.764601024787,45.5029436666673],[-73.7638610413059,45.5034936278541],[-73.7609990649749,45.5016736143112],[-73.7607180089032,45.5017916084322],[-73.7594310510848,45.5027756493404],[-73.7582369794975,45.5020396953987],[-73.7566520648264,45.5024576921117],[-73.7547110516145,45.5033797027775],[-73.753074995036,45.5037526908032],[-73.7529080577708,45.503644710884],[-73.7525129885843,45.5039067523836],[-73.7516830062177,45.5044217475167],[-73.7521580479418,45.5047177672573],[-73.7550640438883,45.5065227142585]],[[-73.7636321275885,45.5119344933272],[-73.763709071798,45.5118969410627],[-73.7648045381908,45.5116050726707],[-73.7661200332907,45.5114332698999],[-73.7684960581316,45.5113312316946],[-73.7714941128735,45.5113241331936],[-73.7750239217572,45.5115567347829],[-73.7810579932721,45.5118312423955],[-73.784495953615,45.5119915541335],[-73.7866170831848,45.5121309565947],[-73.7884826304739,45.5122468388892],[-73.7913345924323,45.5122154582665],[-73.7935647137019,45.5122579703375],[-73.7949551182574,45.5123748825979],[-73.7958525328998,45.5127341556051],[-73.7970629270905,45.5134062331569],[-73.7976881985914,45.5141038625252],[-73.7984593413398,45.5147528673501],[-73.7996325564615,45.5153284533696],[-73.8008047295396,45.5156870832431],[-73.8018296017865,45.5159013038255],[-73.8029632434072,45.5159224583336],[-73.8038772743205,45.5159200601686],[-73.8050853891417,45.516158010163],[-73.8066601092178,45.5166119066096],[-73.807905385473,45.5169942099468],[-73.8094437138512,45.5174481814501],[-73.8106522568337,45.5177341310207],[-73.8115662660583,45.5177557556917],[-73.8128821101108,45.5176076233673],[-73.8150003430593,45.5171195195743],[-73.8173011422787,45.5166067523588],[-73.8188703002447,45.5161202049052],[-73.8201490348534,45.5158995713678],[-73.8214658925888,45.5160164877218],[-73.8230049023154,45.5165426138764],[-73.825020250855,45.5173325772385],[-73.8267796003028,45.5180268350328],[-73.8285010927439,45.5185041110793],[-73.8302575099927,45.518716109785],[-73.8316465088788,45.5185673631748],[-73.8331076718149,45.5183220910036],[-73.8354113533901,45.5183153674483],[-73.8382275825386,45.518427512304],[-73.8406414341973,45.5184686177983],[-73.8424341230685,45.5186562394509],[-73.8434947485093,45.5186530699845],[-73.844371714133,45.5185539664028],[-73.8455758388601,45.5181404182088],[-73.8463768809046,45.517559319668],[-73.8473222508808,45.5166884336136],[-73.8485559247356,45.5151896499007],[-73.8498263150046,45.5136668515477],[-73.8502057947968,45.51296654604],[-73.8504959035236,45.5125798776715],[-73.8509332681299,45.5123615017717],[-73.8514434052715,45.5120465134941],[-73.8518800285223,45.511707709039],[-73.8525363461796,45.5114404177281],[-73.8531785538655,45.511485284942]],[[-73.5683415333325,45.6342040823769],[-73.5641592553722,45.6369445712466],[-73.5613403943445,45.6387911516022],[-73.5577564022958,45.641138904148],[-73.5555562547823,45.6425801525952],[-73.5555015872647,45.6426159510483],[-73.5545181792519,45.6432381288006],[-73.5535047780925,45.6438361835464],[-73.5524625891726,45.6444094021152],[-73.552331581832,45.6444781790564],[-73.5520576940186,45.6446209312806],[-73.5517820240957,45.644761970232],[-73.5515045845963,45.6449012871039],[-73.5512254069106,45.6450389433797],[-73.5491079327415,45.6460728032794],[-73.5489466016577,45.6461518977511],[-73.5464974293631,45.6473488086518],[-73.5445965150946,45.648275495648],[-73.5444188673774,45.648195152643],[-73.5431259555089,45.6476277015901],[-73.538670276736,45.6455483940076],[-73.5330753960349,45.64302416486],[-73.5329896524938,45.6429851039381],[-73.5276840978637,45.6405859783661],[-73.5228365773241,45.6383951937501],[-73.5213860118815,45.6377188477733],[-73.5214140906865,45.6376915662931],[-73.520349068553,45.6375183678873],[-73.5178793188125,45.6371181950843],[-73.5164472096387,45.6368837066639],[-73.5160672748144,45.6368191161823],[-73.5114465320949,45.6360632643837],[-73.5077932670275,45.6354654964012],[-73.506402758493,45.6352370622823],[-73.5057546388829,45.6351318978629],[-73.5055259482152,45.6350952861675],[-73.5031221108851,45.6347018295307],[-73.5028939640711,45.6346636387212],[-73.5001090439047,45.6342072485995],[-73.4972600621255,45.6337402615654],[-73.4969384687007,45.6336872078692],[-73.4967770771922,45.6336610870643],[-73.4955290795863,45.6334564793217],[-73.494091086348,45.6332206861706],[-73.493808418679,45.6331747685671],[-73.4927160760812,45.6329952371464],[-73.4919013588155,45.6328613271054]],[[-73.4919013588155,45.6328613271054],[-73.4918812370611,45.6328952020038],[-73.4918555832367,45.6329221946305],[-73.4917401424303,45.633030164056],[-73.4916118750702,45.6331201365553],[-73.4914964174402,45.6333090910176],[-73.4914066217382,45.6333900702857],[-73.4910858935684,45.6338039775849],[-73.4910858854702,45.6338489700047],[-73.4912141163943,45.6340289485608],[-73.4913295392486,45.6341099426813],[-73.4914577950803,45.6341549435667],[-73.4916245152145,45.6342899313108],[-73.4917014494891,45.6344249135005],[-73.4916372963933,45.6345598858563],[-73.4914320276935,45.6348208284296],[-73.4910086759479,45.6352347314391],[-73.4908803941843,45.6353157095399],[-73.4905596989458,45.6354596643357],[-73.4904570605109,45.6355856365499],[-73.4904185327678,45.6358285937692],[-73.4902003988782,45.6362155154915],[-73.4900849033188,45.6364764650295],[-73.4900207497525,45.6365664460644],[-73.4900207130269,45.6367464166355],[-73.489302214795,45.6375832296336],[-73.489019994979,45.6376911874935],[-73.4888275629931,45.6378171472173],[-73.48867360329,45.6379970979272],[-73.4885581189551,45.6382129526794],[-73.4884169836411,45.6384019925632],[-73.4882501973525,45.6385639448314],[-73.4881475529324,45.6386989077059],[-73.488006427043,45.6388248690584],[-73.4878139936004,45.6389328295252],[-73.4876857176952,45.6389328183701],[-73.4875574536043,45.6388698206424],[-73.4871726497943,45.6387887904023],[-73.4871213301331,45.6388427720364],[-73.4874163333622,45.638968783429],[-73.487441981149,45.639004778978],[-73.4873778136046,45.6391666449189],[-73.487275175488,45.6392657012044],[-73.4872495067141,45.639337682379],[-73.4872110121696,45.6394006638244],[-73.4872366600426,45.6394366594091],[-73.4873392761682,45.6394546687942],[-73.4872750866348,45.6397246023845],[-73.4873007278086,45.6397965901765],[-73.4874033208112,45.6399405722548],[-73.4874674537013,45.6399675745681],[-73.4876341807678,45.640147552371],[-73.4876726156509,45.6404084997698],[-73.4880316505106,45.6412093615036],[-73.4880957499489,45.6414343194087],[-73.4880956670915,45.6418662222172],[-73.4881597580781,45.6421091705558],[-73.4882494076076,45.6428380059871],[-73.4881595578031,45.6430899372076],[-73.4881594659303,45.64353983011],[-73.4881337352812,45.6438997417727],[-73.488172101696,45.6444846064306],[-73.488133569557,45.6447094579002],[-73.4879666911077,45.6452134105693],[-73.48795382671,45.6453843682832],[-73.4878511143491,45.6457712642709],[-73.487620080514,45.6463291297414],[-73.4875430805834,45.646455097285],[-73.4874147309126,45.6467430304111],[-73.4873557353384,45.6469910811442],[-73.4774840695232,45.6455090018614],[-73.4775338926307,45.645780530575],[-73.4775913616248,45.6460513150859],[-73.4776564544916,45.6463212494727],[-73.4777291459975,45.6465902281455],[-73.4778094078146,45.6468581458862],[-73.4778972086522,45.6471248978909],[-73.4779598614874,45.6473451389564],[-73.478030947008,45.6475641169247],[-73.47811041376,45.6477816729947],[-73.47819820421,45.6479976493951],[-73.4782942547861,45.6482118894984],[-73.4784421151363,45.6485260620811],[-73.4785987783574,45.6488381291166],[-73.4787641836941,45.6491479692944],[-73.4795263267403,45.6501940301145],[-73.4802832291507,45.6512419760506],[-73.4808950547599,45.6520361463445],[-73.4815134292674,45.6528278209751],[-73.4821383322137,45.6536169734107],[-73.4823444415206,45.65392315993],[-73.4825415482125,45.6542322470558],[-73.4827295655739,45.6545441020957],[-73.4829084189309,45.6548585968219],[-73.4830780328379,45.6551755988281],[-73.4832383357366,45.6554949746508],[-73.483465709337,45.6559938058409],[-73.4836841063016,45.6564946062312],[-73.4838934914932,45.6569972955944],[-73.4840938314743,45.6575017942055],[-73.4842850942398,45.6580080220502],[-73.4844672493217,45.6585158999169],[-73.4846402679414,45.6590253483557],[-73.4848041223506,45.6595362847607],[-73.4857800697887,45.6625349775576],[-73.4864305806449,45.6656408072217],[-73.4865928953846,45.6680504120221],[-73.4865918224468,45.6724413139624],[-73.4864276659703,45.6780100699072],[-73.4861822003174,45.6826149889633],[-73.4856115887435,45.6850780222624],[-73.4843893422829,45.6871125262524],[-73.4824341838113,45.6890933694136],[-73.4802338489346,45.6919310176378],[-73.4793169035205,45.6934435783822],[-73.4786645833674,45.6949427741112],[-73.478501213823,45.6962009805345],[-73.4783381144789,45.6970041109332],[-73.4779302470348,45.698048187695],[-73.4774409705543,45.698958431611],[-73.4765856268657,45.6996007878412],[-73.4756077960105,45.7000557541765],[-73.4744755679495,45.7003936944734],[-73.4746764573755,45.700847753815],[-73.4747788564722,45.7016216153414],[-73.4746371776916,45.7025843839755],[-73.4742257111031,45.7037630474859],[-73.4738656203371,45.7049237312269],[-73.4739679571271,45.7058685653224],[-73.4745583357751,45.7068045093933],[-73.475354286986,45.707578526278],[-73.4763563057882,45.7069038695165],[-73.4783730277194,45.7058154800403],[-73.4809419236628,45.7046641554055],[-73.4835491944986,45.7037197414115],[-73.484731661447,45.7033429658996],[-73.4864247822048,45.7028397426964],[-73.4889214563133,45.7023392738827],[-73.4892000691615,45.7022987371784],[-73.490073328968,45.7023438061893],[-73.490779601737,45.7026587964964],[-73.4911776526101,45.703072737435],[-73.4914344436635,45.7034776683589],[-73.4918453440535,45.7039186001096],[-73.4922819339874,45.7043955230479],[-73.4929368496239,45.7049714359138],[-73.493450541246,45.7051694195919],[-73.4944137453618,45.7052414470053],[-73.4968282052604,45.7049535855702],[-73.4973419180384,45.7048636162266],[-73.5003940027799,45.704377634764],[-73.5034570491471,45.7036584484786],[-73.5076755537386,45.7025492132834],[-73.5128731820437,45.7012716342959],[-73.5141548611542,45.7009609327045],[-73.5166625509756,45.7006435747441],[-73.5191018990953,45.6999561128335],[-73.5214854430281,45.6988706511884],[-73.5230990366567,45.6978819492463],[-73.5251524483771,45.696193539209],[-73.5266555168297,45.6942643161371],[-73.5276451295114,45.692552264638],[-73.5283409589168,45.690767932028],[-73.5289633381636,45.6889594995001],[-73.5295494260739,45.6874645109914],[-73.5301722308908,45.6863551282072],[-73.5310153998223,45.685294097636],[-73.5325179977589,45.6840159116562],[-73.5342042101544,45.6826652034363],[-73.5360365895836,45.6810010739528],[-73.5373376566756,45.6798312321012],[-73.5386570870232,45.678794106562],[-73.540416361505,45.6777084863938],[-73.5424320204139,45.6767915657491],[-73.5443750300555,45.6760673965569],[-73.5462995489627,45.6754519117357],[-73.548682445587,45.6748240552465],[-73.5503686613352,45.6744376277574],[-73.5520913034379,45.6737376385047],[-73.5541799741553,45.6726998977627],[-73.5557186535605,45.6715417870829],[-73.5569645725984,45.670697318226],[-73.5587599157857,45.6694667718216],[-73.5615073558153,45.6676329283421],[-73.5634488647674,45.6662817478244],[-73.5659036943788,45.6650506587921],[-73.5689450024792,45.6639397459297],[-73.572022606628,45.6626600598604],[-73.5742935306092,45.6612360376329],[-73.5779202008853,45.6594976161928],[-73.5809423724181,45.6581093072354],[-73.5847885694251,45.6567321781521],[-73.5876819520782,45.6551628118425],[-73.5907213403125,45.6534003923494],[-73.5936874051676,45.6518308041539],[-73.596946483502,45.6501162071882],[-73.5992896861799,45.6489328922128],[-73.6009740380511,45.6481598474334],[-73.6024395678122,45.6478209960015],[-73.6044174040556,45.6473369447925],[-73.6066516140832,45.6465151275122],[-73.6087748178806,45.6454040676822],[-73.6111173421032,45.6440516884662],[-73.6136056267554,45.6422650113939],[-73.6163131555521,45.6402130143682],[-73.6187460321119,45.6384383204335],[-73.6211964826797,45.6363863859864],[-73.6237388509925,45.6344184938147],[-73.6246894869795,45.633636970995],[-73.6247478305618,45.6335889967278]],[[-73.5871469592181,45.5664211682795],[-73.5866999702821,45.5662721212202],[-73.5862989939037,45.5661530950624],[-73.5891550570883,45.5628230814332],[-73.5921229909224,45.5594722116239],[-73.5939520556921,45.5573482902792],[-73.5982421335072,45.5524342190909],[-73.6018671588286,45.5481891600156],[-73.6020551907509,45.5479571727348],[-73.6029461830768,45.5469571926479],[-73.6035321569149,45.5463431875769],[-73.6070412980164,45.5479552660605],[-73.6083872159827,45.5464472671532],[-73.609671180587,45.545059279265],[-73.6109041992203,45.5436852737792],[-73.6122731877954,45.5422023169457],[-73.6126131057482,45.5416912774584],[-73.6129441598284,45.5410743164463],[-73.613876182332,45.5391432964092],[-73.6140951536433,45.5387372945831],[-73.6143151946359,45.5384432441195],[-73.6147771774708,45.5379302628252],[-73.6155521809978,45.5371052232258],[-73.6161011160119,45.5364721908017],[-73.6173001103657,45.5352071897075],[-73.6182000621935,45.5347892329657],[-73.6182960428408,45.5346822222671],[-73.621517025833,45.5311341840985],[-73.6215339756421,45.5311101382376],[-73.6198210635892,45.5307931990368],[-73.6193740704142,45.5307011535761],[-73.619233974912,45.5306681818716],[-73.6190969764984,45.530652215655],[-73.6185880556405,45.530487157836],[-73.618313981096,45.5303672107377],[-73.6179969952191,45.5301781919153],[-73.6176970220522,45.5299441587906],[-73.6174269728793,45.5296771570657],[-73.617291013797,45.529500189853],[-73.6171810439151,45.5293291348173],[-73.6170240661923,45.5289982097249],[-73.6169719669221,45.5287771478679],[-73.6169431376096,45.5285235784085],[-73.6170710849053,45.5285716454233],[-73.6170649061574,45.5284018785304],[-73.6170763692715,45.5282322483616],[-73.6171054106738,45.528063657542],[-73.6171131208756,45.5280309400481],[-73.6171214931105,45.5279983028638],[-73.6171305273923,45.5279657531878],[-73.6171584837417,45.5279297350253],[-73.6171797192781,45.5278700414408],[-73.6172032587729,45.5278107756274],[-73.617229085672,45.5277519834938]],[[-73.5683710315155,45.5814140093738],[-73.568379990641,45.5813939366326],[-73.5683940242542,45.5813739509546],[-73.56842898578,45.5813549430335],[-73.5684560366043,45.5813499776108],[-73.5685009515497,45.581345002798],[-73.5685479769601,45.5813379562832],[-73.5685970240754,45.5813419771689],[-73.5686419501363,45.5813469911053],[-73.5686849882508,45.581362984724],[-73.5687159897245,45.5813889740979],[-73.5687420119448,45.5814069562146],[-73.56877500407,45.581418996438],[-73.5688019596872,45.5814219502383],[-73.5688330302029,45.5814189628898],[-73.5688669644534,45.5814229924138],[-73.5688940251535,45.5814259461326],[-73.5689219354543,45.5814309698225],[-73.5694930285734,45.5816179969463],[-73.5697539949198,45.5812029901149],[-73.5705429129416,45.5814620556945],[-73.5709318955983,45.5809040633042],[-73.5739949728304,45.5819250824477],[-73.5752619977039,45.5805341005942],[-73.5752810045617,45.5805201400644],[-73.5756299219385,45.5802151125052],[-73.5766259418577,45.5794001231425],[-73.5767479663598,45.5792851219848],[-73.5767909977081,45.5792950818714],[-73.5775519504544,45.5786370805478],[-73.5781390275726,45.5780600953243],[-73.5772409653124,45.5776770669274],[-73.5788470292919,45.5758390394136],[-73.5805600446019,45.5738780823806],[-73.5817760088786,45.5724870213175],[-73.5846990321934,45.569141088173],[-73.5852079658946,45.5685900578446],[-73.5860149800515,45.5676910787254],[-73.5860930415902,45.5676030995832],[-73.5862149864323,45.5674671215467],[-73.5866910147229,45.5669800925162],[-73.5868949907286,45.5667301234516],[-73.5871469592181,45.5664211682795]],[[-73.7736210636385,45.4981998311138],[-73.7697080321747,45.4957106333699],[-73.7683378180592,45.4943590537364]],[[-73.7683378180592,45.4943590537364],[-73.7658603930102,45.4918321071104],[-73.7658764238336,45.4918242968397],[-73.7650465797699,45.4909825420001],[-73.7648106070741,45.4907411652743],[-73.7645352177049,45.4904517155942],[-73.7644724253371,45.4904499282524],[-73.7644153911808,45.490391377407],[-73.7657053556333,45.4897917199007],[-73.7670450451728,45.4891689057094],[-73.7670312463871,45.4891679014445],[-73.7670190850476,45.4891636053229],[-73.7670106979257,45.489156068126],[-73.7669725516879,45.4890590647818],[-73.7669517771045,45.4889452890846],[-73.7669529991946,45.488935834298],[-73.7669598026123,45.4889276343033],[-73.7669709088905,45.4889222380221],[-73.7671167918761,45.4888805455863],[-73.7671362939039,45.4888703973338],[-73.7671529361421,45.4888579836891],[-73.767166195896,45.4888436955104],[-73.767175654383,45.4888279837017],[-73.7671810132828,45.4888113420767],[-73.7671821036461,45.4887942974392],[-73.7671788908967,45.4887773852758],[-73.7671714773432,45.4887611398515],[-73.7671600956755,45.4887460717294],[-73.76714510508,45.488732657881],[-73.7671269770603,45.4887213192242],[-73.7671062851731,45.4887124143483],[-73.7668203074275,45.4886240266984],[-73.7667712908892,45.4885647646927],[-73.7667311120426,45.4884660005851],[-73.7667426707042,45.4884583347646],[-73.7667577827321,45.4884548871668],[-73.7667735369096,45.4884563223947],[-73.7667869024494,45.4884623623004],[-73.7668249763473,45.4884693035352],[-73.7669051789423,45.4884305205101],[-73.7669123943299,45.4884226092969],[-73.7669175194966,45.4884139300205],[-73.7669203957884,45.4884047512054],[-73.7669209350032,45.4883953601078],[-73.7669191180485,45.4883860492204],[-73.7669150038536,45.488377107254],[-73.7669087178303,45.4883688137647],[-73.7669004582056,45.4883614256418],[-73.7668904806578,45.4883551744444],[-73.7668790956977,45.4883502538095],[-73.7668666584215,45.4883468167774],[-73.7668535569762,45.4883449713183],[-73.7668401971779,45.4883447740708],[-73.7667806741257,45.4883629112617],[-73.7667008976315,45.4883298283736],[-73.7666849523142,45.488322556323],[-73.7666699353217,45.4883143651591],[-73.766655951564,45.4883053121729],[-73.7666431051956,45.4882954628533],[-73.7666325159457,45.4882848613901],[-73.7666247602178,45.4882731096075],[-73.7666200802748,45.4882605785736],[-73.7666186263752,45.4882476629678],[-73.7666204362446,45.4882347685294],[-73.7666286191064,45.4882108055619],[-73.7666400226696,45.4881875027476],[-73.7666545468714,45.488165075381],[-73.7667005521343,45.4881021894308],[-73.7667508317072,45.4880181687292],[-73.7668153684777,45.487953848975],[-73.766824785744,45.4879476135043],[-73.7668306696839,45.4879395128476],[-73.7668323351805,45.487930491644],[-73.7668295876118,45.4879216031633],[-73.7668227478438,45.487913883269],[-73.7668126120127,45.4879082317345],[-73.7668003653273,45.487905309863],[-73.7667582950759,45.4879075950723],[-73.7667003865919,45.4879019573891],[-73.7663424560206,45.4877931878686],[-73.7664962613941,45.4876642505196],[-73.7665072143219,45.4876583372776],[-73.7665204577551,45.487656065735],[-73.766534232777,45.4876514821593],[-73.7665428396719,45.487642637317],[-73.766509274996,45.4873979660269],[-73.7664698152454,45.4873199373894],[-73.7663589446998,45.4871446215753],[-73.7662962212884,45.4869974978531],[-73.7662263140447,45.4869802706944],[-73.7661763842512,45.4870454675183],[-73.7660800468964,45.4870349715916],[-73.7660841062598,45.4869444945719],[-73.7661633619433,45.4869093965952],[-73.7661721244279,45.4867565521322],[-73.766118562858,45.486641912017],[-73.7661660723229,45.4866094184576],[-73.7666442277992,45.486282995971],[-73.7668037025301,45.486127205987],[-73.7667076478983,45.485977172308],[-73.7669354793252,45.4857546219433],[-73.7680019672945,45.4854167861579],[-73.7680966340046,45.4847560663897],[-73.7704455222326,45.4836397682537],[-73.7716803064201,45.4830228780516],[-73.7733511879209,45.4821984253568],[-73.7738170982863,45.4819691937176],[-73.7742011021256,45.4818112399011],[-73.7735086539151,45.4813588600354],[-73.7722232586994,45.4805540881633],[-73.7661605332211,45.4767576930959],[-73.7683881105807,45.4749608139787],[-73.7623598191957,45.4685635074001],[-73.7627572407088,45.4682475254707],[-73.7507533142707,45.4606033360855],[-73.7454324389542,45.4647871895058],[-73.7425707704457,45.4670321646182],[-73.7399776963654,45.4690686167967],[-73.7340200524818,45.4736926743763],[-73.7322349077958,45.4751050575837],[-73.730576654832,45.4764163786757],[-73.7300101625827,45.4768657832845],[-73.72646835201,45.4795658754723],[-73.7253416698502,45.4805364926804],[-73.7230870266523,45.4823305257274],[-73.7230488602337,45.4823071291551],[-73.7224677932762,45.4827515610007],[-73.7223560083239,45.4826796952282],[-73.7198554572557,45.4810890753356],[-73.7164800257025,45.4789417367142],[-73.7138278770338,45.477254315674],[-73.7125201554323,45.4764221991712],[-73.7081490474139,45.4735992659858]],[[-73.6828058933345,45.4631779363512],[-73.6816241550401,45.4674908085533],[-73.6816475976913,45.4675067033372],[-73.6799993457044,45.4735210003517],[-73.6799742717642,45.473511144977],[-73.6792265581809,45.4762389436552],[-73.6779373824716,45.4809415842212],[-73.6779608229266,45.4809574706775],[-73.6775902043258,45.4823092647883],[-73.677212053007,45.4836885142825]],[[-73.677212053007,45.4836885142825],[-73.6858354528323,45.4894558180251],[-73.6856204014368,45.4895529619297],[-73.6850818912618,45.4897275129731],[-73.684912003898,45.4897702572988],[-73.6847429209581,45.4898145504798],[-73.6845746692709,45.4898603843772],[-73.6843619768543,45.4899208834271],[-73.6841507300218,45.4899838380868],[-73.6839409862738,45.4900492329741],[-73.6838542303476,45.4900771337296],[-73.6837677469267,45.4901054524017],[-73.6836815411156,45.4901341853832],[-73.6828431230772,45.4904398800472],[-73.6827415839348,45.4904895864347],[-73.6821907687488,45.4907133733821],[-73.6819754493365,45.4908114792501],[-73.6817664230272,45.4909161030314],[-73.6815640895891,45.4910270443612],[-73.6814440405431,45.4910977752705],[-73.6813267132279,45.491170731534],[-73.6812121906299,45.4912458599377],[-73.6811894015316,45.4912612214232],[-73.6808958013615,45.4914690867173],[-73.6803502582482,45.4918819989632],[-73.6784902199698,45.49337064152],[-73.6785436544519,45.4934043452251],[-73.6761369454254,45.4953202307912],[-73.6753191643077,45.4959517769191],[-73.6737747513023,45.4971626088033],[-73.6734406441111,45.4974241247033],[-73.6679092584033,45.5017435896795],[-73.6646439095566,45.5044267443639],[-73.6644258828565,45.5047737807765],[-73.6625813949955,45.507605449769],[-73.6625348771184,45.5076730956619],[-73.6624382131421,45.5077601192494],[-73.6619078225391,45.5085851912799],[-73.6611946234212,45.5097125850061],[-73.6599960663403,45.5116071357526],[-73.659886650752,45.5117712317348],[-73.6598391443901,45.5118568267446],[-73.6594458185922,45.5124909874599],[-73.6591406478188,45.5129958218259],[-73.6583394917723,45.5143011494585],[-73.6579906459183,45.5148476428553],[-73.6577811959759,45.5151837372792],[-73.65776340451,45.5152124136682],[-73.6554280901699,45.5186540071582],[-73.6550268159509,45.5192421418754],[-73.6550078932431,45.5192704145354],[-73.654857061677,45.5194916080788],[-73.654836837046,45.5195212853424],[-73.6547465681642,45.5196138389305],[-73.6545430832767,45.519970146331],[-73.6545280631887,45.5199924557879],[-73.6545454171995,45.5199982298248],[-73.6527681931102,45.5228458531792],[-73.6518666699911,45.5243741686892],[-73.6512569615905,45.5254405314593],[-73.6507508626002,45.526307356847]],[[-73.6287732200027,45.5832270961725],[-73.6267602959658,45.585463132119],[-73.6253702471344,45.5848621067026],[-73.6247972554571,45.5847390935067],[-73.6242662181385,45.5846531034182],[-73.6240002253516,45.5845401854348],[-73.6238352120131,45.5844411050581],[-73.6236101546491,45.5842921448879],[-73.6234401933328,45.5841541030941],[-73.6232731424587,45.5839931104495],[-73.6227892081481,45.5837381459857],[-73.6226031316309,45.5836701322487],[-73.6218901593317,45.5833671709145],[-73.6214461540819,45.5831391527564],[-73.6212912289134,45.5830541845698],[-73.6208352087117,45.5828401259149],[-73.620666141108,45.5827651611629],[-73.6191101755403,45.5820791612676],[-73.6177791792168,45.5814990973173],[-73.6169501873703,45.581137096182],[-73.6160232246742,45.5807230801032],[-73.614793180599,45.5801731087554],[-73.6146301457412,45.5800950678111],[-73.6139892331344,45.5797910777527],[-73.6123472303964,45.5790270313751],[-73.6121291984584,45.5789270835605],[-73.6119312363409,45.5788220768269],[-73.6113231918672,45.578558092159],[-73.6106031463129,45.5782540774588],[-73.6087091776336,45.5774490240219],[-73.6085001551687,45.5773560809248],[-73.6059231159328,45.5762430601432],[-73.6046220372274,45.5756500461433],[-73.6043680371638,45.5755750454117],[-73.6028070467406,45.5747600576644],[-73.6027830345646,45.5747481107715],[-73.6023740545657,45.5742870967314],[-73.601871059576,45.5744940716806],[-73.601680135853,45.5742830343945],[-73.6012380461875,45.5741541087756],[-73.6008770701862,45.5739950533595],[-73.6008121003322,45.5740680928251],[-73.6007030540494,45.5740190529916],[-73.6006621261998,45.574062104675],[-73.6005380705091,45.5740110982128],[-73.6006761451671,45.5738620429728],[-73.6016441631664,45.5727831075069],[-73.5990631712836,45.5716501158398],[-73.595902144977,45.5702481033906],[-73.5929250587812,45.5689430972398],[-73.592716089241,45.5688490476889],[-73.5903830160172,45.5678120726458],[-73.5871750155983,45.5663871293229],[-73.5871469592181,45.5664211682795]],[[-73.5398579830246,45.4280063599261],[-73.5389133468799,45.4286730728954],[-73.5388080696712,45.4287359487911],[-73.5363081980863,45.4306804136883],[-73.5348080518481,45.4319581253943],[-73.533474599906,45.4331525287498],[-73.5312523718321,45.4354302703126],[-73.5296968601727,45.4371525254611],[-73.5283634539929,45.4388747155487],[-73.5273910468359,45.4401525048214],[-73.5260299224558,45.4422914345848],[-73.5241690531113,45.4457636480508],[-73.5232244207417,45.4478747424807],[-73.5226134672084,45.4495136610059],[-73.5222519966196,45.450624799821],[-73.5205974508747,45.4556368431671],[-73.5193946103953,45.4607122682813],[-73.5186483009215,45.4658309428023],[-73.5188677703395,45.4675905297772],[-73.5193241444254,45.4693274485809],[-73.520013299103,45.4710259419713],[-73.5209289816194,45.4726706072644],[-73.5212763404032,45.4731533628261]],[[-73.6068401918011,45.4952759075412],[-73.6049051714614,45.4947679078679],[-73.6045971796269,45.4947459607638],[-73.6038191902154,45.4947559450814],[-73.6031461345849,45.4949019071046],[-73.6029471863289,45.494953926876],[-73.6027421396136,45.4950179198557],[-73.6028491413678,45.4944909109949],[-73.6016011328737,45.4943469817449],[-73.6009131088345,45.4942669711947],[-73.6012071727302,45.4937010071047],[-73.5998470900093,45.4931250098521],[-73.5982470528305,45.492436958941],[-73.5968680321132,45.4918670386769],[-73.5964670504372,45.4917039493407],[-73.5957200428208,45.4926119835128],[-73.5926138807723,45.4916460377021],[-73.5893259193684,45.4905840906473],[-73.5884928893171,45.490311086507],[-73.5865809660419,45.4896910947713],[-73.5848800668364,45.4891417472369],[-73.5846479680748,45.4890639705484],[-73.5843032794056,45.4889484761183],[-73.5838478601415,45.4887983185711],[-73.5835960329987,45.488718551389],[-73.5834746352327,45.4886800661886],[-73.5825681222597,45.4883974020874],[-73.5825012412241,45.4883749567427],[-73.5824125681957,45.4883441588675],[-73.5831344205449,45.4881256166176],[-73.581750109105,45.4869986277515],[-73.5815240781672,45.4867156699989]],[[-73.5291826363344,45.4917076069951],[-73.5292195566601,45.4918006975219],[-73.5192220227645,45.4951852416999],[-73.5204442459801,45.4991229496501],[-73.519872972145,45.4992106428096],[-73.5302322111121,45.5325677446719],[-73.530330966113,45.5329739872072],[-73.5303764136004,45.5333848757669],[-73.5303681712313,45.5337969581879],[-73.5303063071203,45.5342067825796],[-73.5301913395574,45.5346109101815],[-73.5301291075517,45.5347580265772]],[[-73.6481900695937,45.5307189032401],[-73.6414813307105,45.5287655336015],[-73.6375113588793,45.5276173761569],[-73.6294606564508,45.5252884967829],[-73.6227672281163,45.5233516491541],[-73.6221455594791,45.5240232718452],[-73.6216672610185,45.523898074322],[-73.6207755934418,45.5236508796029]],[[-73.894533712414,45.4101474077226],[-73.8955919400618,45.4140464163116],[-73.898123280518,45.4233694641677],[-73.8980722658469,45.423414459257],[-73.9011974142341,45.4351554991761]],[[-73.9011974142341,45.4351554991761],[-73.901643370581,45.4350094918952],[-73.9027523158182,45.4346105160048],[-73.9039373571024,45.4341375548743],[-73.9047143115305,45.4337845499245],[-73.9164022728533,45.4275425825383],[-73.9289650417636,45.4209534713447],[-73.9299080311375,45.420563495653],[-73.931145039097,45.4201985026762],[-73.9322937988237,45.4133464055275],[-73.9327108548068,45.4111314372023],[-73.9334539290696,45.4063585615923],[-73.9335809858324,45.4054995520658],[-73.9336489548392,45.4050445617308],[-73.9341520583382,45.3988273405852]],[[-73.9341520583382,45.3988273405852],[-73.9290723636895,45.3984024074542],[-73.9266834523599,45.3982912197981],[-73.9251556036339,45.3982634414506],[-73.9233498210449,45.3982356799622],[-73.9188774375908,45.3983467266573],[-73.9164049794864,45.3989022708323],[-73.9150991387766,45.3994022452498],[-73.9134881510063,45.4002355577508],[-73.9088062366409,45.4039510021393],[-73.9047259372644,45.406578573618],[-73.9013207288626,45.4080687240445],[-73.8996261923671,45.4087910197932],[-73.89754291832,45.4094576771695],[-73.8961260354836,45.4098466040063],[-73.8946417707439,45.4101380137663],[-73.894533712414,45.4101474077226]],[[-73.894533712414,45.4101474077226],[-73.8920156483821,45.4103662834257],[-73.8888202994409,45.4101798383062],[-73.8862157702347,45.4098931329249],[-73.8837922321142,45.4094853534952],[-73.879125591627,45.4084575554682],[-73.8761258314667,45.4077074801404],[-73.8684031269009,45.4054297080296],[-73.8665697547527,45.4048463248388],[-73.8562085513937,45.401262939663],[-73.8483191871825,45.3981238758384],[-73.8450137144451,45.3967072200948],[-73.8429303951586,45.3957349844274],[-73.836874498228,45.3928183163229],[-73.8318189675997,45.3903460283604],[-73.8221797251068,45.3854017852652],[-73.8162626313534,45.3920127117698],[-73.814627887428,45.3937185474742]],[[-73.814627887428,45.3937185474742],[-73.8317043795134,45.4284044510674],[-73.8323374579228,45.4296894453775],[-73.8319803799037,45.4297534798124],[-73.8336534432088,45.4338874104954],[-73.8351184289778,45.4375104322429],[-73.8350174338206,45.4375644554773],[-73.8353674613987,45.4384544593679],[-73.8382845286656,45.4454013430943]],[[-73.8382845286656,45.4454013430943],[-73.8407905875309,45.4454203344782],[-73.8520654089719,45.445422330054],[-73.8557354606898,45.4435753517885],[-73.8650633536458,45.4389845378702],[-73.8684124225624,45.4429234495806],[-73.8715085008199,45.4413654565952],[-73.8727944618262,45.4425404574813],[-73.8737764817214,45.442231450955],[-73.8751285765171,45.4417944197413],[-73.8768775654376,45.4414294988871],[-73.875925536275,45.4386514696744],[-73.8759765078837,45.4385794875157],[-73.8760784775995,45.4384714288612],[-73.8764105048243,45.4384434266943],[-73.8766904830542,45.4382625162534],[-73.8770474497189,45.4381804334686],[-73.8770984641122,45.4380994512023],[-73.8772655026348,45.4382154409575],[-73.8777894638559,45.4382584358066],[-73.8780965475755,45.4382215117864],[-73.8782244789789,45.43827544455],[-73.8784795396568,45.4382475112367],[-73.878504465969,45.4381754332981],[-73.878671568688,45.4383005111686],[-73.8789405601691,45.4382904394751],[-73.87915850175,45.4383714306881],[-73.8792225531933,45.438442492542],[-73.8792995179785,45.4384425068574],[-73.8798195762904,45.439880501008],[-73.8818195631452,45.4388394414706],[-73.8810765048914,45.4367184307067],[-73.883182473319,45.4361535137564],[-73.8837665947446,45.4374464681327],[-73.8844185461477,45.4374624588019],[-73.8851085319672,45.4375054960665],[-73.8859895453037,45.4372864526072],[-73.8858064506051,45.4367204678158],[-73.8934124377737,45.43511047319],[-73.893999438643,45.436728539765],[-73.9000854253065,45.4352764778063],[-73.9002034037434,45.4355905066023],[-73.9012363511951,45.4353535304524]],[[-73.9012363511951,45.4353535304524],[-73.901223335743,45.4352724907099],[-73.9011974142341,45.4351554991761]],[[-73.6681676863569,45.4565489710695],[-73.6680680808386,45.4566668357569],[-73.667821093707,45.4569591311552],[-73.6674614381208,45.4573573235817],[-73.6673166416852,45.4575649749428],[-73.6668183469701,45.4573768881919],[-73.6667035147107,45.4573336460819],[-73.6666465401275,45.4573121827753],[-73.66648713714,45.4572519928376],[-73.666457668633,45.4572408581526],[-73.6662714986102,45.4571705586894],[-73.6660799224142,45.4570982007872],[-73.666055859627,45.4570891232396],[-73.6658910464348,45.457026876145],[-73.66562339244,45.4569240212521],[-73.6655147970019,45.4568822980772],[-73.6653253700783,45.4568116850907],[-73.6651361234081,45.456740842971],[-73.6649466977697,45.4566702374604],[-73.6647578294111,45.4565989019569],[-73.6644314707291,45.4564745745694],[-73.6643808398523,45.4564552796061],[-73.6640034808831,45.4563121406757],[-73.6638155520505,45.4562396063821],[-73.6636278060233,45.4561668348604],[-73.6634231487788,45.4560872422535],[-73.6632179292415,45.4560083789667],[-73.663048038407,45.4559412057676],[-73.6628773990698,45.455875007924],[-73.6627069462393,45.455808563004],[-73.6622812784854,45.455641838373],[-73.6620950301277,45.455567137191],[-73.661907845703,45.4554936311356],[-73.6618496945346,45.4554713849371],[-73.6617195456459,45.4554215769121],[-73.6616578916059,45.4553980875013],[-73.6615281428251,45.455348621537],[-73.6614698151183,45.4553258129973],[-73.6613378449036,45.4552742497308],[-73.6612858390331,45.4552538743328],[-73.6610950447964,45.455179266175],[-73.6609973311614,45.4551410987002],[-73.6609077170876,45.4551060133797],[-73.6607140342605,45.4550351781239],[-73.6606698450336,45.4550195192168],[-73.6605160009284,45.4549602795767],[-73.6603623277588,45.4549008199321],[-73.6603339409817,45.4548898835517],[-73.6602085516116,45.4548414916078],[-73.6600564802693,45.4547794980503],[-73.659752773543,45.4546557121978],[-73.6595567328478,45.454575799806],[-73.6591786538478,45.4549137435419],[-73.6588762011384,45.4551709726048],[-73.6587408880377,45.4552924635485],[-73.6586168709649,45.4554010744465],[-73.6584965526305,45.4555111126096],[-73.6583040814854,45.4556701176647],[-73.658182250478,45.4557788212014],[-73.657991682055,45.455940073598],[-73.6584523897866,45.4561162043443],[-73.6585700824865,45.4561612084208],[-73.6594163879024,45.4564847723717],[-73.6594433118632,45.456495060446],[-73.6597857583037,45.4566259899362],[-73.6599571689681,45.4566938795714],[-73.6611534065809,45.4571550963642],[-73.6613243024276,45.4572209906719],[-73.660394508691,45.4578441421417],[-73.6601927344255,45.4579725039144],[-73.6598907727043,45.4581554624567],[-73.6596956388718,45.4583125927885],[-73.6596455219268,45.4584276917699],[-73.6579627849665,45.4595293234168]],[[-73.644459591704,45.4739660002599],[-73.644904047153,45.4741559891925],[-73.6451568282817,45.4742593625664],[-73.6465826401703,45.4748734593596],[-73.6469170419987,45.4750208641439],[-73.6471082019545,45.475105138287],[-73.6476830427246,45.4753465763872],[-73.6480299303794,45.4754995421823],[-73.6481960662322,45.4755714034625],[-73.6483624116002,45.4756430347339],[-73.648529583517,45.4757131718114],[-73.6487318834291,45.4757927267061],[-73.6488589897295,45.4758417103541],[-73.649166604113,45.4759769989396],[-73.6492438040032,45.4760109413555],[-73.6494478182787,45.4761006689235],[-73.6500145494914,45.4763498896156],[-73.6508418442488,45.47671370427],[-73.6560111303193,45.4789340349537]],[[-73.6559770017075,45.4844290758318],[-73.654869920986,45.4839250878494],[-73.6540149065935,45.4848890822481],[-73.6546548862652,45.4851670184868],[-73.6530013511913,45.4869373996762],[-73.6524678303751,45.4875272287558],[-73.6515873965003,45.4885158463909],[-73.6514679310546,45.4886499982479],[-73.6511634728205,45.4889836808889]],[[-73.6388304224155,45.4834377720507],[-73.6388908315856,45.4833672747837],[-73.6391408567337,45.4830902593747],[-73.6389765748154,45.4830163002923],[-73.6373399112323,45.4822793769316],[-73.6368486091765,45.4820581695019],[-73.6366011541088,45.4819467411847],[-73.6365186057496,45.4819095800853],[-73.635681037565,45.4815324339111],[-73.6354810402582,45.4814437067458],[-73.6325169727642,45.480108844491],[-73.6322667212073,45.4799948542289],[-73.6308195600955,45.4793442297966]],[[-73.8545620756257,45.4705969521696],[-73.8485405515301,45.4646454489146],[-73.8465856654758,45.4627974434075]],[[-73.8465856654758,45.4627974434075],[-73.8430547075239,45.4645804336433],[-73.8391406086946,45.4666084337239],[-73.8318726511936,45.4702824661819],[-73.8237747181917,45.474319519709],[-73.815585665563,45.4783375064213],[-73.8151996799862,45.4777985204134],[-73.814464718764,45.4768645216693],[-73.8134746989534,45.4758954911959],[-73.8127416679552,45.4751864602791],[-73.7959126575489,45.4830875177618],[-73.7947036136552,45.4818125740811]],[[-73.7947036136552,45.4818125740811],[-73.7895995616625,45.4842105356839],[-73.7816993480297,45.4880365147327],[-73.7761863531615,45.4907224843467],[-73.7683378180592,45.4943590537364]],[[-73.7947036136552,45.4818125740811],[-73.7901516591099,45.4772175310921],[-73.7888146845411,45.4757625578537],[-73.7866286112462,45.473599478758],[-73.7817055642213,45.4685095159712],[-73.7802914536057,45.4671904663737],[-73.7820905461202,45.4663224241178],[-73.7846167740294,45.4650833801048],[-73.7832928414208,45.4637273680891],[-73.7827619351712,45.4622893902009],[-73.7827348584573,45.462064385722],[-73.7816838795016,45.4590613975494],[-73.7805318352697,45.4561933384991],[-73.7800517717586,45.4548994225686],[-73.7822878728655,45.4544523789418],[-73.7813787292925,45.4517553214738],[-73.7801116974963,45.4488973414744],[-73.7788934770678,45.4456153801962],[-73.7650422148075,45.4190569997397]],[[-73.7650422148075,45.4190569997397],[-73.7649550066688,45.4190683089815],[-73.7639827680923,45.4191794469822],[-73.7579826349814,45.419707194551],[-73.7543990840613,45.4199572490399],[-73.7506211515753,45.4202072537875],[-73.7429542433247,45.4204850715701],[-73.737065214066,45.4207905893069],[-73.7316760864812,45.4210961656922],[-73.7268703010329,45.4214850338142],[-73.7229892547875,45.4217852596423]],[[-73.7398954804591,45.4305913646116],[-73.7401512429028,45.4306059309229],[-73.7405720907186,45.4306365015926],[-73.7406718693844,45.4306445422109],[-73.7409834733793,45.4307040068181],[-73.7412978270278,45.4307583418942],[-73.7413934203626,45.4307741680825],[-73.7420056139639,45.4309136163554],[-73.7421002433691,45.4309312441848],[-73.742489920613,45.4310555127162],[-73.7429016331507,45.4311577019375],[-73.7430021684683,45.431170105398],[-73.7432082229556,45.4311810357001],[-73.7433760297073,45.4312109928847],[-73.7434178940691,45.4312294894348],[-73.7434701333888,45.4312166437936],[-73.743830179249,45.4312052830226],[-73.7441220165417,45.4312373186871],[-73.7444289597385,45.4312353232301],[-73.7447242834552,45.4312595122203],[-73.7450954998991,45.4313350311372],[-73.7454394432457,45.4314990020615],[-73.7457267703443,45.4316360991434],[-73.7460528483958,45.4318525332406],[-73.7459800683763,45.4318831920282],[-73.7462741538869,45.4322388444203],[-73.7463329449021,45.4322400351204],[-73.7463253740897,45.4322728031173],[-73.7462705177126,45.4325281993733],[-73.746261019998,45.4325743369103],[-73.7462100358573,45.4326581490788],[-73.7460159116674,45.4328297768267],[-73.7460015194894,45.4328410479618],[-73.7455708859881,45.4330010255254],[-73.7452443819534,45.4332590202607],[-73.7448868316751,45.4335029356434],[-73.7447303421751,45.43366014804],[-73.7443903963196,45.4337204428754],[-73.7442914089869,45.433735533054],[-73.744031287189,45.4337505042977],[-73.7439146406245,45.4337456230547],[-73.7437605569699,45.4337160671952],[-73.7436827145848,45.4336908377983],[-73.7433209717134,45.4335891412174],[-73.7431104208166,45.4335590907988],[-73.7430271318791,45.4335293994252],[-73.7427732801405,45.433512938766],[-73.7426827086952,45.4335496095801],[-73.7425970314728,45.4335422176826],[-73.7425698865267,45.4335398856594],[-73.7424736080015,45.4334700270664],[-73.7423264925085,45.4334350326966],[-73.7418875347041,45.4334283673639],[-73.7417913313822,45.4334405582342],[-73.7414535672954,45.4335504186302],[-73.7411044510016,45.4335728831614],[-73.741006324513,45.4335702522691],[-73.7406635936483,45.4336418779363],[-73.7403173139595,45.4336861878895],[-73.7402218069319,45.4337037722684],[-73.7397596061461,45.4337672548374],[-73.7392063826271,45.4336947713977],[-73.7391134733952,45.4336742280291],[-73.7388138857438,45.4335907514768],[-73.7385096253241,45.4335177420128],[-73.7383633356536,45.4334795847356],[-73.7382104811986,45.4334834209773],[-73.7380159742369,45.4334655327204],[-73.7378209810254,45.4334805365862],[-73.7376262309725,45.4334790992913],[-73.737431494409,45.4334776515572],[-73.737344529347,45.4334934310609],[-73.7372549383278,45.4334927657517],[-73.7371334318738,45.4334590189826],[-73.737049075295,45.4334057047551],[-73.7370785062568,45.4331184916922],[-73.7370752374789,45.4330499022261],[-73.7371133720922,45.4329103815155],[-73.7371806232361,45.4327764241857],[-73.7372756845242,45.4325863969819],[-73.7374036114761,45.4324061788458],[-73.737562405588,45.4322385757943],[-73.7376869230555,45.4322257321235],[-73.7381879042782,45.4318700264547],[-73.7384241253297,45.4316876554764],[-73.7385888553805,45.4314872175814],[-73.7386433162858,45.4314293863177],[-73.7388040273257,45.4312263731722],[-73.7389342265836,45.4310037659087],[-73.7389759091119,45.4309377358737],[-73.7392672670845,45.4308186058562],[-73.739422754609,45.4307662479698],[-73.7395758813648,45.4307105555335],[-73.7396709119537,45.4306787906737],[-73.7398954804591,45.4305913646116]],[[-73.8382845286656,45.4454013430943],[-73.8321485464365,45.445365382156],[-73.8358176281517,45.4497273589085],[-73.833426683562,45.4497343729257],[-73.8465856654758,45.4627974434075]],[[-73.9043512629398,45.4467807139511],[-73.9045904714733,45.4467245163263],[-73.9042324293959,45.4450065421623],[-73.9055344245809,45.4446965786555],[-73.9052974513905,45.4438065712027],[-73.9052584441269,45.4436895382515],[-73.9052064561339,45.4434825563738],[-73.9049434685757,45.4425655531735],[-73.904668466813,45.4415595872457],[-73.9043923960805,45.4405075432215],[-73.9039184586457,45.4403285114862],[-73.9034324081527,45.4403575860916],[-73.9032533938317,45.4404035739772],[-73.9029584025162,45.4402425350227],[-73.90286841385,45.4401164999863],[-73.9028164224828,45.4399815124209],[-73.9027243995309,45.4396585773302],[-73.9024623735858,45.4387955568022],[-73.902334422867,45.4387865578741],[-73.9013153643734,45.4355685201631],[-73.9012363511951,45.4353535304524]],[[-73.5068798058957,45.610651036789],[-73.4994557045912,45.6093697207333],[-73.498521942156,45.6124428904008],[-73.4966509970971,45.6163518638141],[-73.4948609220985,45.6188688924636],[-73.4932748824442,45.6202338842668],[-73.4912409832005,45.6220538449922],[-73.4894509708908,45.6239278544186],[-73.4878229668361,45.6260159314186],[-73.4855440699464,45.6292828787832],[-73.4841146731455,45.6315813105886],[-73.4919013588155,45.6328613271054]],[[-73.814627887428,45.3937185474742],[-73.8137070179475,45.3946793863182],[-73.8067621758083,45.400568310613],[-73.8040675996805,45.4025682836182],[-73.8005396514094,45.4050127942899],[-73.7962897607119,45.4077350134431],[-73.7923726457151,45.4099572566301],[-73.7896780995164,45.4114849513535],[-73.7864834818402,45.4131239043295],[-73.7843723685306,45.4140961948123],[-73.7824280650846,45.4149295200613],[-73.7784835285234,45.4163182962981],[-73.7764552694773,45.4169572445935],[-73.7747887798413,45.4174017124042],[-73.7679551350979,45.41867940091],[-73.767489442627,45.4187396149766],[-73.7650422148075,45.4190569997397]],[[-73.9249009474547,45.4405960005763],[-73.9266815795142,45.4400036233685],[-73.9274705612376,45.4412065934529],[-73.9315125567127,45.4398865688618],[-73.9307115450426,45.4387465779608],[-73.9326625912322,45.4381366021704],[-73.936882425358,45.436788622528],[-73.9369614413538,45.4370125874595],[-73.9375514497427,45.4372895831911],[-73.9393234540109,45.4366795458382],[-73.9402934834728,45.4382596230252],[-73.9424614872026,45.4375945604624],[-73.9440144386572,45.4367606000988],[-73.9454054221028,45.4364225777703],[-73.9465175127668,45.4380375937367],[-73.9475766105435,45.4377906481738],[-73.9468514789976,45.4366236525601],[-73.9480504685373,45.4363666166781],[-73.9460174163641,45.4330096028825],[-73.9461063882372,45.4329826172925],[-73.9496055043071,45.4357576413848],[-73.9510165184109,45.4364006698356],[-73.9583243006306,45.4281736616008],[-73.955466258112,45.4271776006756],[-73.954548165052,45.4226726336293],[-73.9506890807064,45.4178195788671],[-73.9500071736135,45.4172196643627],[-73.9498261416114,45.4169315871039],[-73.9498731509922,45.4164816150971],[-73.949883064656,45.4160586074488],[-73.9498801292097,45.4156896473656],[-73.9498011500293,45.4153396142814],[-73.9497331378886,45.4148446493591],[-73.9496010870471,45.414287660703],[-73.9495850548658,45.4139546585582],[-73.9516110694747,45.4116426293959],[-73.9547631617695,45.4079585643742],[-73.9566672401535,45.4096695601492],[-73.9572242598419,45.4090375266615],[-73.9571082199739,45.408930533838],[-73.9607149248518,45.4061814278033]],[[-73.9607149248518,45.4061814278033],[-73.9607034465839,45.4060934487693],[-73.9605518662761,45.4054193428807],[-73.9604105012802,45.4048353706789],[-73.9598135824515,45.4043744663755],[-73.9590022027168,45.4040926242353],[-73.9575596449907,45.4035521601972],[-73.9560641594059,45.4031185925169],[-73.9546602023519,45.4029103366293],[-73.9528578822955,45.4023711690996],[-73.9513782440042,45.4016761997739],[-73.9502604021366,45.4012887311017],[-73.9490363317059,45.4010678851693],[-73.9471030981347,45.4010101958701],[-73.9446200970071,45.4007229506331],[-73.9410273156795,45.3998995769627],[-73.9383502977694,45.3993746220184],[-73.9354133576609,45.3989487717892],[-73.9347755289345,45.3988794780883],[-73.9341520583382,45.3988273405852]],[[-73.9743520622515,45.4664301916245],[-73.9763799901425,45.4652913618176],[-73.9779078815584,45.4644302333433],[-73.9799079893468,45.4635136442412],[-73.9812133534743,45.4629303121686],[-73.9822411866313,45.4624581084839],[-73.9849637945049,45.461374777071],[-73.9875472104771,45.4604025751909],[-73.9901028930184,45.4595136843583],[-73.9923529009719,45.4587637420019],[-73.9950752971843,45.4579582600396],[-73.9966030869942,45.45748604394],[-73.9961865592759,45.4567916002939],[-73.9961585479549,45.4567360177139],[-73.9958809693957,45.4561805394641],[-73.9949085850121,45.4544582239237],[-73.9947973418303,45.4542915865293],[-73.9936863666513,45.452124911057],[-73.9922974154305,45.4493192958966],[-73.9920472203643,45.4487915630315],[-73.9919359285336,45.4485692150625],[-73.9914361822719,45.4475137469142],[-73.9909915897973,45.4465415561926],[-73.9905469533201,45.4455137475741],[-73.9904637435578,45.4454026914728],[-73.9898247467035,45.4439304226787],[-73.9894636855033,45.4430137573686],[-73.9881859338067,45.439624918569],[-73.9877968376642,45.4386526670685],[-73.9870188013358,45.4365136805856],[-73.9868244393694,45.4359304465737],[-73.9864633099593,45.434735962205],[-73.9853800815662,45.431124874057],[-73.984518863379,45.4276526792409],[-73.9843521168663,45.4268193190158],[-73.9842408917292,45.4263748567779],[-73.9841576820118,45.4260137905962],[-73.9839074847703,45.424985944328],[-73.9834909733235,45.4226249028676],[-73.9832964986087,45.4211805034721],[-73.9831852769496,45.4203748897691],[-73.9831298416736,45.4199304584202],[-73.9830462954192,45.4192915773467],[-73.9829630909781,45.41879146722],[-73.9828796518913,45.4183748716638],[-73.9826574662759,45.4177915633483],[-73.9822964377941,45.4171526840531],[-73.9820739416241,45.4167914820987],[-73.9818240988699,45.4164859229969],[-73.980727854491,45.4152072937435],[-73.9792407639163,45.4142366371608],[-73.9768715872373,45.4131944122396],[-73.9734778156882,45.4120813393781],[-73.9693454274974,45.4109899302534],[-73.9667804076812,45.4103241257593],[-73.9645994979233,45.4096661551039],[-73.9630864955796,45.4089395421552],[-73.961714864527,45.4081372756978],[-73.961170289792,45.407575817595],[-73.9607940799188,45.4067881418942],[-73.9607149248518,45.4061814278033]]],
bbox:[-73.9966030869942,45.3854017852652,-73.4738656203371,45.707578526278]}},{}],13:[function(require,module,exports){var mapboxgl=require("mapbox-gl");var d3_selection=require("d3-selection");var d3_format=require("d3-format");var topojson=require("topojson-client");var topology=require("./data.json");var data=topojson.feature(topology,topology.objects["0"]);data.properties=topology.objects["0"].properties;var specs=[{key:"pop",name:"Population",units:"habitants",cbUnits:"millier d'habitants",format:","},{key:"density",name:"Densité de population",units:"habitants par km²",cbUnits:"millers d'habitants par km²",format:",.2f"}].reverse();mapboxgl.accessToken="pk.eyJ1IjoiaHZyOHpvZGoiLCJhIjoiY2x3OXAzNHV6MDVwbDJrcDd4N3VvNWNlOSJ9.n6YG-bG9xRvigumeUerRvg";d3_format.formatDefaultLocale({decimal:",",thousands:" ",grouping:[3]});d3_selection.select("body").append("fieldset").style("border","none").append("select").attr("id","layer-select").selectAll("option").data(specs).enter().append("option").attr("value",function(d){return d.key}).text(function(d){return d.name});d3_selection.select("body").append("div").attr("id","map").style("width","1000px").style("height","800px");d3_selection.select("body").append("svg").attr("width",1e3).attr("height",300);var map=new mapboxgl.Map({container:"map",style:"mapbox://styles/mapbox/light-v9",center:[-73.67563994222256,45.491548049146814],zoom:10,pitch:10});map.addControl(new mapboxgl.NavigationControl);var popup=new mapboxgl.Popup({closeButton:false,closeOnClick:false});map.on("load",function(){map.addSource("source",{type:"geojson",data:data});specs.forEach(function(spec){addChoroplethLayer(spec);addExtrudedLayers(spec);addColorbar(spec)});map.on("mousemove",mousemoveHandler);map.on("click",clickHandler);setVisibility();d3_selection.select("#layer-select").on("click",function(){clearVisibility();setVisibility()})});function addChoroplethLayer(spec){var key=spec.key;map.addLayer({id:"choropleth-"+key,type:"fill",source:"source",layout:{visibility:"none"},paint:{"fill-color":{property:key+"-color",type:"identity"},"fill-outline-color":"#088","fill-opacity":.7}})}function addExtrudedLayers(spec){var key=spec.key;data.features.forEach(function(f){var name=f.properties.name;map.addLayer({id:"extrude-"+name+"-"+key,type:"fill",source:"source",layout:{visibility:"none"},paint:{"fill-color":{property:key+"-color",type:"identity"},"fill-extrude-height":{property:key+"-z",type:"identity"},"fill-extrude-base":0,"fill-opacity":.65},filter:["==","name",name]})})}function addColorbar(spec){var key=spec.key;var colorbarData=data.properties[key+"-colorbar"];var formatter=function(v){return v/1e3};var n=colorbarData.length;var w=50;var h=30;var colorbar=d3_selection.select("svg").append("g").attr("id","colorbar-"+key).classed("colorbar",true).style("cursor","pointer").style("visibility","hidden");var items=colorbar.selectAll(".item").data(colorbarData).enter().append("g").classed("item",true).attr("transform",function(_,i){return"translate("+(i*w+5)+",0)"});items.append("rect").attr("x",0).attr("y",0).attr("width",w).attr("height",h).attr("fill",function(d){return d[1]});items.append("line").attr("x1",0).attr("y1",h).attr("x2",0).attr("y2",h+5).attr("stroke-width","1.5").attr("stroke","black");items.append("text").text(function(d){return formatter(d[0])}).attr("x",-5).attr("y",2*h);colorbar.append("text").text(""+spec.name).attr("x",""+(w*n+10)).attr("y",h/2+5);colorbar.append("text").text("[en "+spec.cbUnits+"]").attr("x",""+(w*n+10)).attr("y",h+15);items.on("click",function(d,i){var min=d[0];var max=colorbarData[i+1]?colorbarData[i+1][0]:Infinity;var featuresWithin=[];data.features.forEach(function(f){var val=f.properties[key];if(val>=min&&val<max){featuresWithin.push(f)}});var areAllFeatureVisible=featuresWithin.every(function(f){return extrudeVisiblity(f,key).get()==="visible"});var newVal=areAllFeatureVisible?"none":"visible";featuresWithin.forEach(function(f){extrudeVisiblity(f,key).set(newVal)})})}function mousemoveHandler(evt){var features=findFeatures(evt);map.getCanvas().style.cursor=features.length?"pointer":"";if(!features.length){popup.remove();return}var spec=getVisibleSpec();var feature=features[0];var prop=feature.properties;var lnglat=JSON.parse(prop.centroid);var formatter=d3_format.format(spec.format);var html=("\n <b>"+prop.name+"</b><br>\n Population: "+formatter(prop[spec.key])+" "+spec.units+"\n ").trim();popup.setLngLat(new mapboxgl.LngLat(lnglat[0],lnglat[1])).setHTML(html).addTo(map);popup._container.onclick=function(){extrudeVisiblity(feature,spec.key).toggle()}}function clickHandler(evt){var features=findFeatures(evt);if(!features.length)return;var feature=features[0];var spec=getVisibleSpec();extrudeVisiblity(feature,spec.key).toggle()}function getVisibleSpec(){var key=d3_selection.select("#layer-select").node().value;return specs.filter(function(s){return s.key===key})[0]}function findFeatures(evt){return map.queryRenderedFeatures(evt.point,{layers:specs.map(function(s){return"choropleth-"+s.key})})}function setVisibility(){var spec=getVisibleSpec();var key=spec.key;map.setLayoutProperty("choropleth-"+key,"visibility","visible");d3_selection.select("#colorbar-"+key).style("visibility",null)}function clearVisibility(){specs.forEach(function(s){var key=s.key;map.setLayoutProperty("choropleth-"+key,"visibility","none");d3_selection.select("#colorbar-"+key).style("visibility","hidden");data.features.forEach(function(f){extrudeVisiblity(f,key).set("none")})})}function extrudeVisiblity(feature,key){var name=feature.properties.name;var layerId="extrude-"+name+"-"+key;var get=function(){return map.getLayoutProperty(layerId,"visibility")};var set=function(val){return map.setLayoutProperty(layerId,"visibility",val)};var toggle=function(){return set(get()==="visible"?"none":"visible")};return{get:get,set:set,toggle:toggle}}},{"./data.json":12,"d3-format":14,"d3-selection":15,"mapbox-gl":33,"topojson-client":216}],14:[function(require,module,exports){(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?factory(exports):typeof define==="function"&&define.amd?define(["exports"],factory):factory(global.d3=global.d3||{})})(this,function(exports){"use strict";function formatDecimal(x,p){if((i=(x=p?x.toExponential(p-1):x.toExponential()).indexOf("e"))<0)return null;var i,coefficient=x.slice(0,i);return[coefficient.length>1?coefficient[0]+coefficient.slice(2):coefficient,+x.slice(i+1)]}function exponent(x){return x=formatDecimal(Math.abs(x)),x?x[1]:NaN}function formatGroup(grouping,thousands){return function(value,width){var i=value.length,t=[],j=0,g=grouping[0],length=0;while(i>0&&g>0){if(length+g+1>width)g=Math.max(1,width-length);t.push(value.substring(i-=g,i+g));if((length+=g+1)>width)break;g=grouping[j=(j+1)%grouping.length]}return t.reverse().join(thousands)}}function formatDefault(x,p){x=x.toPrecision(p);out:for(var n=x.length,i=1,i0=-1,i1;i<n;++i){switch(x[i]){case".":i0=i1=i;break;case"0":if(i0===0)i0=i;i1=i;break;case"e":break out;default:if(i0>0)i0=0;break}}return i0>0?x.slice(0,i0)+x.slice(i1+1):x}var prefixExponent;function formatPrefixAuto(x,p){var d=formatDecimal(x,p);if(!d)return x+"";var coefficient=d[0],exponent=d[1],i=exponent-(prefixExponent=Math.max(-8,Math.min(8,Math.floor(exponent/3)))*3)+1,n=coefficient.length;return i===n?coefficient:i>n?coefficient+new Array(i-n+1).join("0"):i>0?coefficient.slice(0,i)+"."+coefficient.slice(i):"0."+new Array(1-i).join("0")+formatDecimal(x,Math.max(0,p+i-1))[0]}function formatRounded(x,p){var d=formatDecimal(x,p);if(!d)return x+"";var coefficient=d[0],exponent=d[1];return exponent<0?"0."+new Array(-exponent).join("0")+coefficient:coefficient.length>exponent+1?coefficient.slice(0,exponent+1)+"."+coefficient.slice(exponent+1):coefficient+new Array(exponent-coefficient.length+2).join("0")}var formatTypes={"":formatDefault,"%":function(x,p){return(x*100).toFixed(p)},b:function(x){return Math.round(x).toString(2)},c:function(x){return x+""},d:function(x){return Math.round(x).toString(10)},e:function(x,p){return x.toExponential(p)},f:function(x,p){return x.toFixed(p)},g:function(x,p){return x.toPrecision(p)},o:function(x){return Math.round(x).toString(8)},p:function(x,p){return formatRounded(x*100,p)},r:formatRounded,s:formatPrefixAuto,X:function(x){return Math.round(x).toString(16).toUpperCase()},x:function(x){return Math.round(x).toString(16)}};var re=/^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i;function formatSpecifier(specifier){return new FormatSpecifier(specifier)}function FormatSpecifier(specifier){if(!(match=re.exec(specifier)))throw new Error("invalid format: "+specifier);var match,fill=match[1]||" ",align=match[2]||">",sign=match[3]||"-",symbol=match[4]||"",zero=!!match[5],width=match[6]&&+match[6],comma=!!match[7],precision=match[8]&&+match[8].slice(1),type=match[9]||"";if(type==="n")comma=true,type="g";else if(!formatTypes[type])type="";if(zero||fill==="0"&&align==="=")zero=true,fill="0",align="=";this.fill=fill;this.align=align;this.sign=sign;this.symbol=symbol;this.zero=zero;this.width=width;this.comma=comma;this.precision=precision;this.type=type}FormatSpecifier.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width==null?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision==null?"":"."+Math.max(0,this.precision|0))+this.type};var prefixes=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function identity(x){return x}function formatLocale(locale){var group=locale.grouping&&locale.thousands?formatGroup(locale.grouping,locale.thousands):identity,currency=locale.currency,decimal=locale.decimal;function newFormat(specifier){specifier=formatSpecifier(specifier);var fill=specifier.fill,align=specifier.align,sign=specifier.sign,symbol=specifier.symbol,zero=specifier.zero,width=specifier.width,comma=specifier.comma,precision=specifier.precision,type=specifier.type;var prefix=symbol==="$"?currency[0]:symbol==="#"&&/[boxX]/.test(type)?"0"+type.toLowerCase():"",suffix=symbol==="$"?currency[1]:/[%p]/.test(type)?"%":"";var formatType=formatTypes[type],maybeSuffix=!type||/[defgprs%]/.test(type);precision=precision==null?type?6:12:/[gprs]/.test(type)?Math.max(1,Math.min(21,precision)):Math.max(0,Math.min(20,precision));function format(value){var valuePrefix=prefix,valueSuffix=suffix,i,n,c;if(type==="c"){valueSuffix=formatType(value)+valueSuffix;value=""}else{value=+value;var valueNegative=(value<0||1/value<0)&&(value*=-1,true);value=formatType(value,precision);if(valueNegative){i=-1,n=value.length;valueNegative=false;while(++i<n){if(c=value.charCodeAt(i),48<c&&c<58||type==="x"&&96<c&&c<103||type==="X"&&64<c&&c<71){valueNegative=true;break}}}valuePrefix=(valueNegative?sign==="("?sign:"-":sign==="-"||sign==="("?"":sign)+valuePrefix;valueSuffix=valueSuffix+(type==="s"?prefixes[8+prefixExponent/3]:"")+(valueNegative&&sign==="("?")":"");if(maybeSuffix){i=-1,n=value.length;while(++i<n){if(c=value.charCodeAt(i),48>c||c>57){valueSuffix=(c===46?decimal+value.slice(i+1):value.slice(i))+valueSuffix;value=value.slice(0,i);break}}}}if(comma&&!zero)value=group(value,Infinity);var length=valuePrefix.length+value.length+valueSuffix.length,padding=length<width?new Array(width-length+1).join(fill):"";if(comma&&zero)value=group(padding+value,padding.length?width-valueSuffix.length:Infinity),padding="";switch(align){case"<":return valuePrefix+value+valueSuffix+padding;case"=":return valuePrefix+padding+value+valueSuffix;case"^":return padding.slice(0,length=padding.length>>1)+valuePrefix+value+valueSuffix+padding.slice(length)}return padding+valuePrefix+value+valueSuffix}format.toString=function(){return specifier+""};return format}function formatPrefix(specifier,value){var f=newFormat((specifier=formatSpecifier(specifier),specifier.type="f",specifier)),e=Math.max(-8,Math.min(8,Math.floor(exponent(value)/3)))*3,k=Math.pow(10,-e),prefix=prefixes[8+e/3];return function(value){return f(k*value)+prefix}}return{format:newFormat,formatPrefix:formatPrefix}}var locale;defaultLocale({decimal:".",thousands:",",grouping:[3],currency:["$",""]});function defaultLocale(definition){locale=formatLocale(definition);exports.format=locale.format;exports.formatPrefix=locale.formatPrefix;return locale}function precisionFixed(step){return Math.max(0,-exponent(Math.abs(step)))}function precisionPrefix(step,value){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(exponent(value)/3)))*3-exponent(Math.abs(step)))}function precisionRound(step,max){step=Math.abs(step),max=Math.abs(max)-step;return Math.max(0,exponent(max)-exponent(step))+1}exports.formatDefaultLocale=defaultLocale;exports.formatLocale=formatLocale;exports.formatSpecifier=formatSpecifier;exports.precisionFixed=precisionFixed;exports.precisionPrefix=precisionPrefix;exports.precisionRound=precisionRound;Object.defineProperty(exports,"__esModule",{value:true})})},{}],15:[function(require,module,exports){(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?factory(exports):typeof define==="function"&&define.amd?define(["exports"],factory):factory(global.d3=global.d3||{})})(this,function(exports){"use strict";var xhtml="http://www.w3.org/1999/xhtml";var namespaces={svg:"http://www.w3.org/2000/svg",xhtml:xhtml,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function namespace(name){var prefix=name+="",i=prefix.indexOf(":");if(i>=0&&(prefix=name.slice(0,i))!=="xmlns")name=name.slice(i+1);return namespaces.hasOwnProperty(prefix)?{space:namespaces[prefix],local:name}:name}function creatorInherit(name){return function(){var document=this.ownerDocument,uri=this.namespaceURI;return uri===xhtml&&document.documentElement.namespaceURI===xhtml?document.createElement(name):document.createElementNS(uri,name)}}function creatorFixed(fullname){return function(){return this.ownerDocument.createElementNS(fullname.space,fullname.local)}}function creator(name){var fullname=namespace(name);return(fullname.local?creatorFixed:creatorInherit)(fullname)}var nextId=0;function local(){return new Local}function Local(){this._="@"+(++nextId).toString(36)}Local.prototype=local.prototype={constructor:Local,get:function(node){var id=this._;while(!(id in node))if(!(node=node.parentNode))return;return node[id]},set:function(node,value){return node[this._]=value},remove:function(node){return this._ in node&&delete node[this._]},toString:function(){return this._}};var matcher=function(selector){return function(){return this.matches(selector)}};if(typeof document!=="undefined"){var element=document.documentElement;if(!element.matches){var vendorMatches=element.webkitMatchesSelector||element.msMatchesSelector||element.mozMatchesSelector||element.oMatchesSelector;matcher=function(selector){return function(){return vendorMatches.call(this,selector)}}}}var matcher$1=matcher;var filterEvents={};exports.event=null;if(typeof document!=="undefined"){var element$1=document.documentElement;if(!("onmouseenter"in element$1)){filterEvents={mouseenter:"mouseover",mouseleave:"mouseout"}}}function filterContextListener(listener,index,group){listener=contextListener(listener,index,group);return function(event){var related=event.relatedTarget;if(!related||related!==this&&!(related.compareDocumentPosition(this)&8)){listener.call(this,event)}}}function contextListener(listener,index,group){return function(event1){var event0=exports.event;exports.event=event1;try{listener.call(this,this.__data__,index,group)}finally{exports.event=event0}}}function parseTypenames(typenames){return typenames.trim().split(/^|\s+/).map(function(t){var name="",i=t.indexOf(".");if(i>=0)name=t.slice(i+1),t=t.slice(0,i);return{type:t,name:name}})}function onRemove(typename){return function(){var on=this.__on;if(!on)return;for(var j=0,i=-1,m=on.length,o;j<m;++j){if(o=on[j],(!typename.type||o.type===typename.type)&&o.name===typename.name){this.removeEventListener(o.type,o.listener,o.capture)}else{on[++i]=o}}if(++i)on.length=i;else delete this.__on}}function onAdd(typename,value,capture){var wrap=filterEvents.hasOwnProperty(typename.type)?filterContextListener:contextListener;return function(d,i,group){var on=this.__on,o,listener=wrap(value,i,group);if(on)for(var j=0,m=on.length;j<m;++j){if((o=on[j]).type===typename.type&&o.name===typename.name){this.removeEventListener(o.type,o.listener,o.capture);this.addEventListener(o.type,o.listener=listener,o.capture=capture);o.value=value;return}}this.addEventListener(typename.type,listener,capture);o={type:typename.type,name:typename.name,value:value,listener:listener,capture:capture};if(!on)this.__on=[o];else on.push(o)}}function selection_on(typename,value,capture){var typenames=parseTypenames(typename+""),i,n=typenames.length,t;if(arguments.length<2){var on=this.node().__on;if(on)for(var j=0,m=on.length,o;j<m;++j){for(i=0,o=on[j];i<n;++i){if((t=typenames[i]).type===o.type&&t.name===o.name){return o.value}}}return}on=value?onAdd:onRemove;if(capture==null)capture=false;for(i=0;i<n;++i)this.each(on(typenames[i],value,capture));return this}function customEvent(event1,listener,that,args){var event0=exports.event;event1.sourceEvent=exports.event;exports.event=event1;try{return listener.apply(that,args)}finally{exports.event=event0}}function sourceEvent(){var current=exports.event,source;while(source=current.sourceEvent)current=source;return current}function point(node,event){var svg=node.ownerSVGElement||node;if(svg.createSVGPoint){var point=svg.createSVGPoint();point.x=event.clientX,point.y=event.clientY;point=point.matrixTransform(node.getScreenCTM().inverse());return[point.x,point.y]}var rect=node.getBoundingClientRect();return[event.clientX-rect.left-node.clientLeft,event.clientY-rect.top-node.clientTop]}function mouse(node){var event=sourceEvent();if(event.changedTouches)event=event.changedTouches[0];return point(node,event)}function none(){}function selector(selector){return selector==null?none:function(){return this.querySelector(selector)}}function selection_select(select){if(typeof select!=="function")select=selector(select);for(var groups=this._groups,m=groups.length,subgroups=new Array(m),j=0;j<m;++j){for(var group=groups[j],n=group.length,subgroup=subgroups[j]=new Array(n),node,subnode,i=0;i<n;++i){if((node=group[i])&&(subnode=select.call(node,node.__data__,i,group))){if("__data__"in node)subnode.__data__=node.__data__;subgroup[i]=subnode}}}return new Selection(subgroups,this._parents)}function empty(){return[]}function selectorAll(selector){return selector==null?empty:function(){return this.querySelectorAll(selector)}}function selection_selectAll(select){if(typeof select!=="function")select=selectorAll(select);for(var groups=this._groups,m=groups.length,subgroups=[],parents=[],j=0;j<m;++j){for(var group=groups[j],n=group.length,node,i=0;i<n;++i){if(node=group[i]){subgroups.push(select.call(node,node.__data__,i,group));parents.push(node)}}}return new Selection(subgroups,parents)}function selection_filter(match){if(typeof match!=="function")match=matcher$1(match);for(var groups=this._groups,m=groups.length,subgroups=new Array(m),j=0;j<m;++j){for(var group=groups[j],n=group.length,subgroup=subgroups[j]=[],node,i=0;i<n;++i){if((node=group[i])&&match.call(node,node.__data__,i,group)){subgroup.push(node)}}}return new Selection(subgroups,this._parents)}function sparse(update){return new Array(update.length)}function selection_enter(){return new Selection(this._enter||this._groups.map(sparse),this._parents)}function EnterNode(parent,datum){this.ownerDocument=parent.ownerDocument;this.namespaceURI=parent.namespaceURI;this._next=null;this._parent=parent;this.__data__=datum}EnterNode.prototype={constructor:EnterNode,appendChild:function(child){return this._parent.insertBefore(child,this._next)},insertBefore:function(child,next){return this._parent.insertBefore(child,next)},querySelector:function(selector){return this._parent.querySelector(selector)},querySelectorAll:function(selector){return this._parent.querySelectorAll(selector)}};function constant(x){return function(){return x}}var keyPrefix="$";function bindIndex(parent,group,enter,update,exit,data){var i=0,node,groupLength=group.length,dataLength=data.length;for(;i<dataLength;++i){if(node=group[i]){node.__data__=data[i];update[i]=node}else{enter[i]=new EnterNode(parent,data[i])}}for(;i<groupLength;++i){if(node=group[i]){exit[i]=node}}}function bindKey(parent,group,enter,update,exit,data,key){var i,node,nodeByKeyValue={},groupLength=group.length,dataLength=data.length,keyValues=new Array(groupLength),keyValue;for(i=0;i<groupLength;++i){if(node=group[i]){keyValues[i]=keyValue=keyPrefix+key.call(node,node.__data__,i,group);if(keyValue in nodeByKeyValue){exit[i]=node}else{nodeByKeyValue[keyValue]=node}}}for(i=0;i<dataLength;++i){keyValue=keyPrefix+key.call(parent,data[i],i,data);if(node=nodeByKeyValue[keyValue]){update[i]=node;node.__data__=data[i];nodeByKeyValue[keyValue]=null}else{enter[i]=new EnterNode(parent,data[i])}}for(i=0;i<groupLength;++i){if((node=group[i])&&nodeByKeyValue[keyValues[i]]===node){exit[i]=node}}}function selection_data(value,key){if(!value){data=new Array(this.size()),j=-1;this.each(function(d){data[++j]=d});return data}var bind=key?bindKey:bindIndex,parents=this._parents,groups=this._groups;if(typeof value!=="function")value=constant(value);for(var m=groups.length,update=new Array(m),enter=new Array(m),exit=new Array(m),j=0;j<m;++j){var parent=parents[j],group=groups[j],groupLength=group.length,data=value.call(parent,parent&&parent.__data__,j,parents),dataLength=data.length,enterGroup=enter[j]=new Array(dataLength),updateGroup=update[j]=new Array(dataLength),exitGroup=exit[j]=new Array(groupLength);bind(parent,group,enterGroup,updateGroup,exitGroup,data,key);for(var i0=0,i1=0,previous,next;i0<dataLength;++i0){if(previous=enterGroup[i0]){if(i0>=i1)i1=i0+1;while(!(next=updateGroup[i1])&&++i1<dataLength);previous._next=next||null}}}update=new Selection(update,parents);update._enter=enter;update._exit=exit;return update}function selection_exit(){return new Selection(this._exit||this._groups.map(sparse),this._parents)}function selection_merge(selection){for(var groups0=this._groups,groups1=selection._groups,m0=groups0.length,m1=groups1.length,m=Math.min(m0,m1),merges=new Array(m0),j=0;j<m;++j){for(var group0=groups0[j],group1=groups1[j],n=group0.length,merge=merges[j]=new Array(n),node,i=0;i<n;++i){if(node=group0[i]||group1[i]){merge[i]=node}}}for(;j<m0;++j){merges[j]=groups0[j]}return new Selection(merges,this._parents)}function selection_order(){for(var groups=this._groups,j=-1,m=groups.length;++j<m;){for(var group=groups[j],i=group.length-1,next=group[i],node;--i>=0;){if(node=group[i]){if(next&&next!==node.nextSibling)next.parentNode.insertBefore(node,next);next=node}}}return this}function selection_sort(compare){if(!compare)compare=ascending;function compareNode(a,b){return a&&b?compare(a.__data__,b.__data__):!a-!b}for(var groups=this._groups,m=groups.length,sortgroups=new Array(m),j=0;j<m;++j){for(var group=groups[j],n=group.length,sortgroup=sortgroups[j]=new Array(n),node,i=0;i<n;++i){if(node=group[i]){sortgroup[i]=node}}sortgroup.sort(compareNode)}return new Selection(sortgroups,this._parents).order()}function ascending(a,b){return a<b?-1:a>b?1:a>=b?0:NaN}function selection_call(){var callback=arguments[0];arguments[0]=this;callback.apply(null,arguments);return this}function selection_nodes(){var nodes=new Array(this.size()),i=-1;this.each(function(){nodes[++i]=this});return nodes}function selection_node(){for(var groups=this._groups,j=0,m=groups.length;j<m;++j){for(var group=groups[j],i=0,n=group.length;i<n;++i){var node=group[i];if(node)return node}}return null}function selection_size(){var size=0;this.each(function(){++size});return size}function selection_empty(){return!this.node()}function selection_each(callback){for(var groups=this._groups,j=0,m=groups.length;j<m;++j){for(var group=groups[j],i=0,n=group.length,node;i<n;++i){if(node=group[i])callback.call(node,node.__data__,i,group)}}return this}function attrRemove(name){return function(){this.removeAttribute(name)}}function attrRemoveNS(fullname){return function(){this.removeAttributeNS(fullname.space,fullname.local)}}function attrConstant(name,value){return function(){this.setAttribute(name,value)}}function attrConstantNS(fullname,value){return function(){this.setAttributeNS(fullname.space,fullname.local,value)}}function attrFunction(name,value){return function(){var v=value.apply(this,arguments);if(v==null)this.removeAttribute(name);else this.setAttribute(name,v)}}function attrFunctionNS(fullname,value){return function(){var v=value.apply(this,arguments);if(v==null)this.removeAttributeNS(fullname.space,fullname.local);else this.setAttributeNS(fullname.space,fullname.local,v)}}function selection_attr(name,value){var fullname=namespace(name);if(arguments.length<2){var node=this.node();return fullname.local?node.getAttributeNS(fullname.space,fullname.local):node.getAttribute(fullname)}return this.each((value==null?fullname.local?attrRemoveNS:attrRemove:typeof value==="function"?fullname.local?attrFunctionNS:attrFunction:fullname.local?attrConstantNS:attrConstant)(fullname,value))}function defaultView(node){return node.ownerDocument&&node.ownerDocument.defaultView||node.document&&node||node.defaultView}function styleRemove(name){return function(){this.style.removeProperty(name)}}function styleConstant(name,value,priority){return function(){this.style.setProperty(name,value,priority)}}function styleFunction(name,value,priority){return function(){var v=value.apply(this,arguments);if(v==null)this.style.removeProperty(name);else this.style.setProperty(name,v,priority)}}function selection_style(name,value,priority){var node;return arguments.length>1?this.each((value==null?styleRemove:typeof value==="function"?styleFunction:styleConstant)(name,value,priority==null?"":priority)):defaultView(node=this.node()).getComputedStyle(node,null).getPropertyValue(name)}function propertyRemove(name){return function(){delete this[name]}}function propertyConstant(name,value){return function(){this[name]=value}}function propertyFunction(name,value){return function(){var v=value.apply(this,arguments);if(v==null)delete this[name];else this[name]=v}}function selection_property(name,value){return arguments.length>1?this.each((value==null?propertyRemove:typeof value==="function"?propertyFunction:propertyConstant)(name,value)):this.node()[name]}function classArray(string){return string.trim().split(/^|\s+/)}function classList(node){return node.classList||new ClassList(node)}function ClassList(node){this._node=node;this._names=classArray(node.getAttribute("class")||"")}ClassList.prototype={add:function(name){var i=this._names.indexOf(name);if(i<0){this._names.push(name);this._node.setAttribute("class",this._names.join(" "))}},remove:function(name){var i=this._names.indexOf(name);if(i>=0){this._names.splice(i,1);this._node.setAttribute("class",this._names.join(" "))}},contains:function(name){return this._names.indexOf(name)>=0}};function classedAdd(node,names){var list=classList(node),i=-1,n=names.length;while(++i<n)list.add(names[i])}function classedRemove(node,names){var list=classList(node),i=-1,n=names.length;while(++i<n)list.remove(names[i])}function classedTrue(names){return function(){classedAdd(this,names)}}function classedFalse(names){return function(){classedRemove(this,names)}}function classedFunction(names,value){return function(){(value.apply(this,arguments)?classedAdd:classedRemove)(this,names)}}function selection_classed(name,value){var names=classArray(name+"");if(arguments.length<2){var list=classList(this.node()),i=-1,n=names.length;while(++i<n)if(!list.contains(names[i]))return false;return true}return this.each((typeof value==="function"?classedFunction:value?classedTrue:classedFalse)(names,value))}function textRemove(){this.textContent=""}function textConstant(value){return function(){this.textContent=value}}function textFunction(value){return function(){var v=value.apply(this,arguments);this.textContent=v==null?"":v}}function selection_text(value){return arguments.length?this.each(value==null?textRemove:(typeof value==="function"?textFunction:textConstant)(value)):this.node().textContent}function htmlRemove(){this.innerHTML=""}function htmlConstant(value){return function(){this.innerHTML=value}}function htmlFunction(value){return function(){var v=value.apply(this,arguments);this.innerHTML=v==null?"":v}}function selection_html(value){return arguments.length?this.each(value==null?htmlRemove:(typeof value==="function"?htmlFunction:htmlConstant)(value)):this.node().innerHTML}function raise(){if(this.nextSibling)this.parentNode.appendChild(this)}function selection_raise(){return this.each(raise)}function lower(){if(this.previousSibling)this.parentNode.insertBefore(this,this.parentNode.firstChild)}function selection_lower(){return this.each(lower)}function selection_append(name){var create=typeof name==="function"?name:creator(name);return this.select(function(){return this.appendChild(create.apply(this,arguments))})}function constantNull(){return null}function selection_insert(name,before){var create=typeof name==="function"?name:creator(name),select=before==null?constantNull:typeof before==="function"?before:selector(before);return this.select(function(){return this.insertBefore(create.apply(this,arguments),select.apply(this,arguments)||null)})}function remove(){var parent=this.parentNode;if(parent)parent.removeChild(this)}function selection_remove(){return this.each(remove)}function selection_datum(value){return arguments.length?this.property("__data__",value):this.node().__data__}function dispatchEvent(node,type,params){var window=defaultView(node),event=window.CustomEvent;if(event){event=new event(type,params)}else{event=window.document.createEvent("Event");if(params)event.initEvent(type,params.bubbles,params.cancelable),event.detail=params.detail;else event.initEvent(type,false,false)}node.dispatchEvent(event)}function dispatchConstant(type,params){return function(){return dispatchEvent(this,type,params)}}function dispatchFunction(type,params){return function(){return dispatchEvent(this,type,params.apply(this,arguments))}}function selection_dispatch(type,params){return this.each((typeof params==="function"?dispatchFunction:dispatchConstant)(type,params))}var root=[null];function Selection(groups,parents){this._groups=groups;this._parents=parents}function selection(){return new Selection([[document.documentElement]],root)}Selection.prototype=selection.prototype={constructor:Selection,select:selection_select,selectAll:selection_selectAll,filter:selection_filter,data:selection_data,enter:selection_enter,exit:selection_exit,merge:selection_merge,order:selection_order,sort:selection_sort,call:selection_call,nodes:selection_nodes,node:selection_node,size:selection_size,empty:selection_empty,each:selection_each,attr:selection_attr,style:selection_style,property:selection_property,classed:selection_classed,text:selection_text,html:selection_html,raise:selection_raise,lower:selection_lower,append:selection_append,insert:selection_insert,remove:selection_remove,datum:selection_datum,on:selection_on,dispatch:selection_dispatch};function select(selector){return typeof selector==="string"?new Selection([[document.querySelector(selector)]],[document.documentElement]):new Selection([[selector]],root)}function selectAll(selector){return typeof selector==="string"?new Selection([document.querySelectorAll(selector)],[document.documentElement]):new Selection([selector==null?[]:selector],root)}function touch(node,touches,identifier){if(arguments.length<3)identifier=touches,touches=sourceEvent().changedTouches;for(var i=0,n=touches?touches.length:0,touch;i<n;++i){if((touch=touches[i]).identifier===identifier){return point(node,touch)}}return null}function touches(node,touches){if(touches==null)touches=sourceEvent().touches;
for(var i=0,n=touches?touches.length:0,points=new Array(n);i<n;++i){points[i]=point(node,touches[i])}return points}exports.creator=creator;exports.local=local;exports.matcher=matcher$1;exports.mouse=mouse;exports.namespace=namespace;exports.namespaces=namespaces;exports.select=select;exports.selectAll=selectAll;exports.selection=selection;exports.selector=selector;exports.selectorAll=selectorAll;exports.touch=touch;exports.touches=touches;exports.window=defaultView;exports.customEvent=customEvent;Object.defineProperty(exports,"__esModule",{value:true})})},{}],16:[function(require,module,exports){"use strict";var util=require("../util/util");module.exports=ArrayGroup;function ArrayGroup(arrayTypes){var LayoutVertexArrayType=arrayTypes.layoutVertexArrayType;this.layoutVertexArray=new LayoutVertexArrayType;var ElementArrayType=arrayTypes.elementArrayType;if(ElementArrayType)this.elementArray=new ElementArrayType;var ElementArrayType2=arrayTypes.elementArrayType2;if(ElementArrayType2)this.elementArray2=new ElementArrayType2;this.paintVertexArrays=util.mapObject(arrayTypes.paintVertexArrayTypes,function(PaintVertexArrayType){return new PaintVertexArrayType})}ArrayGroup.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1;ArrayGroup.prototype.hasCapacityFor=function(numVertices){return this.layoutVertexArray.length+numVertices<=ArrayGroup.MAX_VERTEX_ARRAY_LENGTH};ArrayGroup.prototype.isEmpty=function(){return this.layoutVertexArray.length===0};ArrayGroup.prototype.trim=function(){this.layoutVertexArray.trim();if(this.elementArray){this.elementArray.trim()}if(this.elementArray2){this.elementArray2.trim()}for(var layerName in this.paintVertexArrays){this.paintVertexArrays[layerName].trim()}};ArrayGroup.prototype.serialize=function(){return{layoutVertexArray:this.layoutVertexArray.serialize(),elementArray:this.elementArray&&this.elementArray.serialize(),elementArray2:this.elementArray2&&this.elementArray2.serialize(),paintVertexArrays:util.mapObject(this.paintVertexArrays,function(array){return array.serialize()})}};ArrayGroup.prototype.getTransferables=function(transferables){transferables.push(this.layoutVertexArray.arrayBuffer);if(this.elementArray){transferables.push(this.elementArray.arrayBuffer)}if(this.elementArray2){transferables.push(this.elementArray2.arrayBuffer)}for(var layerName in this.paintVertexArrays){transferables.push(this.paintVertexArrays[layerName].arrayBuffer)}}},{"../util/util":137}],17:[function(require,module,exports){"use strict";var ArrayGroup=require("./array_group");var BufferGroup=require("./buffer_group");var util=require("../util/util");var StructArrayType=require("../util/struct_array");module.exports=Bucket;Bucket.create=function(options){var Classes={fill:require("./bucket/fill_bucket"),fillextrusion:require("./bucket/fill_extrusion_bucket"),line:require("./bucket/line_bucket"),circle:require("./bucket/circle_bucket"),symbol:require("./bucket/symbol_bucket")};var type=options.layer.type;if(type==="fill"&&(!options.layer.isPaintValueFeatureConstant("fill-extrude-height")||!options.layer.isPaintValueZoomConstant("fill-extrude-height")||options.layer.getPaintValue("fill-extrude-height")!==0)){type="fillextrusion"}return new Classes[type](options)};Bucket.EXTENT=8192;function Bucket(options){this.zoom=options.zoom;this.overscaling=options.overscaling;this.layer=options.layer;this.childLayers=options.childLayers;this.type=this.layer.type;this.features=[];this.id=this.layer.id;this.index=options.index;this.sourceLayer=this.layer.sourceLayer;this.sourceLayerIndex=options.sourceLayerIndex;this.minZoom=this.layer.minzoom;this.maxZoom=this.layer.maxzoom;this.paintAttributes=createPaintAttributes(this);if(options.arrays){var programInterfaces=this.programInterfaces;this.bufferGroups=util.mapObject(options.arrays,function(programArrayGroups,programName){var programInterface=programInterfaces[programName];var paintVertexArrayTypes=options.paintVertexArrayTypes[programName];return programArrayGroups.map(function(arrayGroup){return new BufferGroup(arrayGroup,{layoutVertexArrayType:programInterface.layoutVertexArrayType.serialize(),elementArrayType:programInterface.elementArrayType&&programInterface.elementArrayType.serialize(),elementArrayType2:programInterface.elementArrayType2&&programInterface.elementArrayType2.serialize(),paintVertexArrayTypes:paintVertexArrayTypes})})})}}Bucket.prototype.populateArrays=function(){this.createArrays();this.recalculateStyleLayers();for(var i=0;i<this.features.length;i++){this.addFeature(this.features[i])}this.trimArrays()};Bucket.prototype.prepareArrayGroup=function(programName,numVertices){var groups=this.arrayGroups[programName];var currentGroup=groups.length&&groups[groups.length-1];if(!currentGroup||!currentGroup.hasCapacityFor(numVertices)){currentGroup=new ArrayGroup({layoutVertexArrayType:this.programInterfaces[programName].layoutVertexArrayType,elementArrayType:this.programInterfaces[programName].elementArrayType,elementArrayType2:this.programInterfaces[programName].elementArrayType2,paintVertexArrayTypes:this.paintVertexArrayTypes[programName]});currentGroup.index=groups.length;groups.push(currentGroup)}return currentGroup};Bucket.prototype.createArrays=function(){this.arrayGroups={};this.paintVertexArrayTypes={};for(var programName in this.programInterfaces){this.arrayGroups[programName]=[];var paintVertexArrayTypes=this.paintVertexArrayTypes[programName]={};var layerPaintAttributes=this.paintAttributes[programName];for(var layerName in layerPaintAttributes){paintVertexArrayTypes[layerName]=new Bucket.VertexArrayType(layerPaintAttributes[layerName].attributes)}}};Bucket.prototype.destroy=function(){for(var programName in this.bufferGroups){var programBufferGroups=this.bufferGroups[programName];for(var i=0;i<programBufferGroups.length;i++){programBufferGroups[i].destroy()}}};Bucket.prototype.trimArrays=function(){for(var programName in this.arrayGroups){var arrayGroups=this.arrayGroups[programName];for(var i=0;i<arrayGroups.length;i++){arrayGroups[i].trim()}}};Bucket.prototype.isEmpty=function(){for(var programName in this.arrayGroups){var arrayGroups=this.arrayGroups[programName];for(var i=0;i<arrayGroups.length;i++){if(!arrayGroups[i].isEmpty()){return false}}}return true};Bucket.prototype.getTransferables=function(transferables){for(var programName in this.arrayGroups){var arrayGroups=this.arrayGroups[programName];for(var i=0;i<arrayGroups.length;i++){arrayGroups[i].getTransferables(transferables)}}};Bucket.prototype.setUniforms=function(gl,programName,program,layer,globalProperties){var uniforms=this.paintAttributes[programName][layer.id].uniforms;for(var i=0;i<uniforms.length;i++){var uniform=uniforms[i];var uniformLocation=program[uniform.name];gl["uniform"+uniform.components+"fv"](uniformLocation,uniform.getValue(layer,globalProperties))}};Bucket.prototype.serialize=function(){return{layerId:this.layer.id,zoom:this.zoom,arrays:util.mapObject(this.arrayGroups,function(programArrayGroups){return programArrayGroups.map(function(arrayGroup){return arrayGroup.serialize()})}),paintVertexArrayTypes:util.mapObject(this.paintVertexArrayTypes,function(arrayTypes){return util.mapObject(arrayTypes,function(arrayType){return arrayType.serialize()})}),childLayerIds:this.childLayers.map(function(layer){return layer.id})}};var FAKE_ZOOM_HISTORY={lastIntegerZoom:Infinity,lastIntegerZoomTime:0,lastZoom:0};Bucket.prototype.recalculateStyleLayers=function(){for(var i=0;i<this.childLayers.length;i++){this.childLayers[i].recalculate(this.zoom,FAKE_ZOOM_HISTORY)}};Bucket.prototype.populatePaintArrays=function(interfaceName,globalProperties,featureProperties,startGroup,startIndex){for(var l=0;l<this.childLayers.length;l++){var layer=this.childLayers[l];var groups=this.arrayGroups[interfaceName];for(var g=startGroup.index;g<groups.length;g++){var group=groups[g];var length=group.layoutVertexArray.length;var paintArray=group.paintVertexArrays[layer.id];paintArray.resize(length);var attributes=this.paintAttributes[interfaceName][layer.id].attributes;for(var m=0;m<attributes.length;m++){var attribute=attributes[m];var value=attribute.getValue(layer,globalProperties,featureProperties);var multiplier=attribute.multiplier||1;var components=attribute.components||1;var start=g===startGroup.index?startIndex:0;for(var i=start;i<length;i++){var vertex=paintArray.get(i);for(var c=0;c<components;c++){var memberName=components>1?attribute.name+c:attribute.name;vertex[memberName]=value[c]*multiplier}}}}}};Bucket.VertexArrayType=function(members){return new StructArrayType({members:members,alignment:4})};Bucket.ElementArrayType=function(components){return new StructArrayType({members:[{type:"Uint16",name:"vertices",components:components||3}]})};function createPaintAttributes(bucket){var attributes={};for(var interfaceName in bucket.programInterfaces){var layerPaintAttributes=attributes[interfaceName]={};for(var c=0;c<bucket.childLayers.length;c++){var childLayer=bucket.childLayers[c];layerPaintAttributes[childLayer.id]={attributes:[],uniforms:[],defines:[],vertexPragmas:{define:{},initialize:{}},fragmentPragmas:{define:{},initialize:{}}}}var interface_=bucket.programInterfaces[interfaceName];if(!interface_.paintAttributes)continue;var attributePrecision="{precision}";var attributeType="{type}";for(var i=0;i<interface_.paintAttributes.length;i++){var attribute=interface_.paintAttributes[i];attribute.multiplier=attribute.multiplier||1;for(var j=0;j<bucket.childLayers.length;j++){var layer=bucket.childLayers[j];var paintAttributes=layerPaintAttributes[layer.id];var attributeInputName=attribute.name;var attributeInnerName=attribute.name.slice(2);var attributeVaryingDefinition;paintAttributes.fragmentPragmas.initialize[attributeInnerName]="";if(layer.isPaintValueFeatureConstant(attribute.paintProperty)){paintAttributes.uniforms.push(attribute);paintAttributes.fragmentPragmas.define[attributeInnerName]=paintAttributes.vertexPragmas.define[attributeInnerName]=["uniform",attributePrecision,attributeType,attributeInputName].join(" ")+";";paintAttributes.fragmentPragmas.initialize[attributeInnerName]=paintAttributes.vertexPragmas.initialize[attributeInnerName]=[attributePrecision,attributeType,attributeInnerName,"=",attributeInputName].join(" ")+";\n"}else if(layer.isPaintValueZoomConstant(attribute.paintProperty)){paintAttributes.attributes.push(util.extend({},attribute,{name:attributeInputName}));attributeVaryingDefinition=["varying",attributePrecision,attributeType,attributeInnerName].join(" ")+";\n";var attributeAttributeDefinition=[paintAttributes.fragmentPragmas.define[attributeInnerName],"attribute",attributePrecision,attributeType,attributeInputName].join(" ")+";\n";paintAttributes.fragmentPragmas.define[attributeInnerName]=attributeVaryingDefinition;paintAttributes.vertexPragmas.define[attributeInnerName]=attributeVaryingDefinition+attributeAttributeDefinition;paintAttributes.vertexPragmas.initialize[attributeInnerName]=[attributeInnerName,"=",attributeInputName,"/",attribute.multiplier.toFixed(1)].join(" ")+";\n"}else{var tName="u_"+attributeInputName.slice(2)+"_t";var zoomLevels=layer.getPaintValueStopZoomLevels(attribute.paintProperty);var numStops=0;while(numStops<zoomLevels.length&&zoomLevels[numStops]<bucket.zoom)numStops++;var stopOffset=Math.max(0,Math.min(zoomLevels.length-4,numStops-2));var fourZoomLevels=[];for(var s=0;s<4;s++){fourZoomLevels.push(zoomLevels[Math.min(stopOffset+s,zoomLevels.length-1)])}attributeVaryingDefinition=["varying",attributePrecision,attributeType,attributeInnerName].join(" ")+";\n";paintAttributes.vertexPragmas.define[attributeInnerName]=attributeVaryingDefinition+["uniform","lowp","float",tName].join(" ")+";\n";paintAttributes.fragmentPragmas.define[attributeInnerName]=attributeVaryingDefinition;paintAttributes.uniforms.push(util.extend({},attribute,{name:tName,getValue:createGetUniform(attribute,stopOffset),components:1}));var components=attribute.components;if(components===1){paintAttributes.attributes.push(util.extend({},attribute,{getValue:createFunctionGetValue(attribute,fourZoomLevels),isFunction:true,components:components*4}));paintAttributes.vertexPragmas.define[attributeInnerName]+=["attribute",attributePrecision,"vec4",attributeInputName].join(" ")+";\n";paintAttributes.vertexPragmas.initialize[attributeInnerName]=[attributeInnerName,"=","evaluate_zoom_function_1("+attributeInputName+", "+tName+")","/",attribute.multiplier.toFixed(1)].join(" ")+";\n"}else{var attributeInputNames=[];for(var k=0;k<4;k++){attributeInputNames.push(attributeInputName+k);paintAttributes.attributes.push(util.extend({},attribute,{getValue:createFunctionGetValue(attribute,[fourZoomLevels[k]]),isFunction:true,name:attributeInputName+k}));paintAttributes.vertexPragmas.define[attributeInnerName]+=["attribute",attributePrecision,attributeType,attributeInputName+k].join(" ")+";\n"}paintAttributes.vertexPragmas.initialize[attributeInnerName]=[attributeInnerName," = ","evaluate_zoom_function_4("+attributeInputNames.join(", ")+", "+tName+")","/",attribute.multiplier.toFixed(1)].join(" ")+";\n"}}}}}return attributes}function createFunctionGetValue(attribute,stopZoomLevels){return function(layer,globalProperties,featureProperties){if(stopZoomLevels.length===1){return attribute.getValue(layer,util.extend({},globalProperties,{zoom:stopZoomLevels[0]}),featureProperties)}else{var values=[];for(var z=0;z<stopZoomLevels.length;z++){var stopZoomLevel=stopZoomLevels[z];values.push(attribute.getValue(layer,util.extend({},globalProperties,{zoom:stopZoomLevel}),featureProperties)[0])}return values}}}function createGetUniform(attribute,stopOffset){return function(layer,globalProperties){var stopInterp=layer.getPaintInterpolationT(attribute.paintProperty,globalProperties.zoom);return[Math.max(0,Math.min(4,stopInterp-stopOffset))]}}},{"../util/struct_array":135,"../util/util":137,"./array_group":16,"./bucket/circle_bucket":18,"./bucket/fill_bucket":19,"./bucket/fill_extrusion_bucket":20,"./bucket/line_bucket":21,"./bucket/symbol_bucket":22,"./buffer_group":24}],18:[function(require,module,exports){"use strict";var Bucket=require("../bucket");var util=require("../../util/util");var loadGeometry=require("../load_geometry");var EXTENT=Bucket.EXTENT;module.exports=CircleBucket;function CircleBucket(){Bucket.apply(this,arguments)}CircleBucket.prototype=util.inherit(Bucket,{});CircleBucket.prototype.addCircleVertex=function(layoutVertexArray,x,y,extrudeX,extrudeY){return layoutVertexArray.emplaceBack(x*2+(extrudeX+1)/2,y*2+(extrudeY+1)/2)};CircleBucket.prototype.programInterfaces={circle:{layoutVertexArrayType:new Bucket.VertexArrayType([{name:"a_pos",components:2,type:"Int16"}]),elementArrayType:new Bucket.ElementArrayType,paintAttributes:[{name:"a_color",components:4,type:"Uint8",getValue:function(layer,globalProperties,featureProperties){return layer.getPaintValue("circle-color",globalProperties,featureProperties)},multiplier:255,paintProperty:"circle-color"},{name:"a_radius",components:1,type:"Uint16",isLayerConstant:false,getValue:function(layer,globalProperties,featureProperties){return[layer.getPaintValue("circle-radius",globalProperties,featureProperties)]},multiplier:10,paintProperty:"circle-radius"},{name:"a_blur",components:1,type:"Uint16",isLayerConstant:false,getValue:function(layer,globalProperties,featureProperties){return[layer.getPaintValue("circle-blur",globalProperties,featureProperties)]},multiplier:10,paintProperty:"circle-blur"},{name:"a_opacity",components:1,type:"Uint16",isLayerConstant:false,getValue:function(layer,globalProperties,featureProperties){return[layer.getPaintValue("circle-opacity",globalProperties,featureProperties)]},multiplier:255,paintProperty:"circle-opacity"}]}};CircleBucket.prototype.addFeature=function(feature){var globalProperties={zoom:this.zoom};var geometries=loadGeometry(feature);var startGroup=this.prepareArrayGroup("circle",0);var startIndex=startGroup.layoutVertexArray.length;for(var j=0;j<geometries.length;j++){for(var k=0;k<geometries[j].length;k++){var x=geometries[j][k].x;var y=geometries[j][k].y;if(x<0||x>=EXTENT||y<0||y>=EXTENT)continue;var group=this.prepareArrayGroup("circle",4);var layoutVertexArray=group.layoutVertexArray;var index=this.addCircleVertex(layoutVertexArray,x,y,-1,-1);this.addCircleVertex(layoutVertexArray,x,y,1,-1);this.addCircleVertex(layoutVertexArray,x,y,1,1);this.addCircleVertex(layoutVertexArray,x,y,-1,1);group.elementArray.emplaceBack(index,index+1,index+2);group.elementArray.emplaceBack(index,index+3,index+2)}}this.populatePaintArrays("circle",globalProperties,feature.properties,startGroup,startIndex)}},{"../../util/util":137,"../bucket":17,"../load_geometry":26}],19:[function(require,module,exports){"use strict";var Bucket=require("../bucket");var util=require("../../util/util");var loadGeometry=require("../load_geometry");var earcut=require("earcut");var classifyRings=require("../../util/classify_rings");var Point=require("point-geometry");var EARCUT_MAX_RINGS=500;module.exports=FillBucket;function FillBucket(){Bucket.apply(this,arguments)}FillBucket.prototype=util.inherit(Bucket,{});FillBucket.prototype.programInterfaces={fill:{layoutVertexArrayType:new Bucket.VertexArrayType([{name:"a_pos",components:2,type:"Int16"}]),elementArrayType:new Bucket.ElementArrayType(1),elementArrayType2:new Bucket.ElementArrayType(2),paintAttributes:[{name:"a_color",components:4,type:"Uint8",getValue:function(layer,globalProperties,featureProperties){return layer.getPaintValue("fill-color",globalProperties,featureProperties)},multiplier:255,paintProperty:"fill-color"},{name:"a_outline_color",components:4,type:"Uint8",getValue:function(layer,globalProperties,featureProperties){return layer.getPaintValue("fill-outline-color",globalProperties,featureProperties)},multiplier:255,paintProperty:"fill-outline-color"},{name:"a_opacity",components:1,type:"Uint8",getValue:function(layer,globalProperties,featureProperties){return[layer.getPaintValue("fill-opacity",globalProperties,featureProperties)]},multiplier:255,paintProperty:"fill-opacity"}]}};FillBucket.prototype.addVertex=function(vertexArray,x,y){return vertexArray.emplaceBack(x,y)};FillBucket.prototype.addFeature=function(feature){var lines=loadGeometry(feature);var polygons=convertCoords(classifyRings(lines,EARCUT_MAX_RINGS));this.factor=Math.pow(2,13);var startGroup=this.prepareArrayGroup("fill",0);var startIndex=startGroup.layoutVertexArray.length;for(var i=0;i<polygons.length;i++){this.addPolygon(polygons[i])}this.populatePaintArrays("fill",{zoom:this.zoom},feature.properties,startGroup,startIndex)};FillBucket.prototype.addPolygon=function(polygon){var numVertices=0;for(var k=0;k<polygon.length;k++){numVertices+=polygon[k].length}var group=this.prepareArrayGroup("fill",numVertices);var flattened=[];var holeIndices=[];var startIndex=group.layoutVertexArray.length;var indices=[];for(var r=0;r<polygon.length;r++){var ring=polygon[r];if(r>0)holeIndices.push(flattened.length/2);for(var v=0;v<ring.length;v++){var v1=ring[v];var index=this.addVertex(group.layoutVertexArray,v1[0],v1[1],0,0,1,1,0);indices.push(index);if(v>=1){group.elementArray2.emplaceBack(index-1,index)}flattened.push(v1[0]);flattened.push(v1[1])}}var triangleIndices=earcut(flattened,holeIndices);for(var i=0;i<triangleIndices.length;i++){group.elementArray.emplaceBack(triangleIndices[i]+startIndex)}};function convertCoords(rings){if(rings instanceof Point)return[rings.x,rings.y];return rings.map(convertCoords)}},{"../../util/classify_rings":123,"../../util/util":137,"../bucket":17,"../load_geometry":26,earcut:141,"point-geometry":196}],20:[function(require,module,exports){"use strict";var Bucket=require("../bucket");var util=require("../../util/util");var loadGeometry=require("../load_geometry");var earcut=require("earcut");var classifyRings=require("../../util/classify_rings");var Point=require("point-geometry");var EARCUT_MAX_RINGS=500;module.exports=FillExtrusionBucket;function FillExtrusionBucket(){Bucket.apply(this,arguments)}FillExtrusionBucket.prototype=util.inherit(Bucket,{});FillExtrusionBucket.prototype.programInterfaces={fillextrusion:{layoutVertexArrayType:new Bucket.VertexArrayType([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal",components:3,type:"Int16"},{name:"a_edgedistance",components:1,type:"Int16"}]),elementArrayType:new Bucket.ElementArrayType(3),paintAttributes:[{name:"a_minH",components:1,type:"Uint16",getValue:function(layer,globalProperties,featureProperties){return[layer.getPaintValue("fill-extrude-base",globalProperties,featureProperties)]},multiplier:1,paintProperty:"fill-extrude-base"},{name:"a_maxH",components:1,type:"Uint16",getValue:function(layer,globalProperties,featureProperties){return[layer.getPaintValue("fill-extrude-height",globalProperties,featureProperties)]},multiplier:1,paintProperty:"fill-extrude-height"},{name:"a_color",components:4,type:"Uint8",getValue:function(layer,globalProperties,featureProperties){var color=layer.getPaintValue("fill-color",globalProperties,featureProperties);color[3]=1;return color},multiplier:255,paintProperty:"fill-color"}]}};FillExtrusionBucket.prototype.addVertex=function(vertexArray,x,y,nx,ny,nz,t,e){return vertexArray.emplaceBack(x,y,Math.floor(nx*this.factor)*2+t,ny*this.factor*2,nz*this.factor*2,Math.round(e))};FillExtrusionBucket.prototype.addFeature=function(feature){var lines=loadGeometry(feature);var polygons=convertCoords(classifyRings(lines,EARCUT_MAX_RINGS));this.factor=Math.pow(2,13);var startGroup=this.prepareArrayGroup("fillextrusion",0);var startIndex=startGroup.layoutVertexArray.length;for(var i=0;i<polygons.length;i++){this.addPolygon(polygons[i])}this.populatePaintArrays("fillextrusion",{zoom:this.zoom},feature.properties,startGroup,startIndex)};FillExtrusionBucket.prototype.addPolygon=function(polygon){var numVertices=0;for(var k=0;k<polygon.length;k++){numVertices+=polygon[k].length}numVertices*=5;var group=this.prepareArrayGroup("fillextrusion",numVertices);var flattened=[];var holeIndices=[];var indices=[];for(var r=0;r<polygon.length;r++){var ring=polygon[r];if(r>0)holeIndices.push(flattened.length/2);var edgeDistance=0;for(var v=0;v<ring.length;v++){var v1=ring[v];var index=this.addVertex(group.layoutVertexArray,v1[0],v1[1],0,0,1,1,0);indices.push(index);if(v>=1){var v2=ring[v-1];if(!isBoundaryEdge(v1,v2)){var perp=Point.convert(v1)._sub(Point.convert(v2))._perp()._unit();var bottomRight=this.addVertex(group.layoutVertexArray,v1[0],v1[1],perp.x,perp.y,0,0,edgeDistance);this.addVertex(group.layoutVertexArray,v1[0],v1[1],perp.x,perp.y,0,1,edgeDistance);edgeDistance+=Point.convert(v2).dist(Point.convert(v1));this.addVertex(group.layoutVertexArray,v2[0],v2[1],perp.x,perp.y,0,0,edgeDistance);this.addVertex(group.layoutVertexArray,v2[0],v2[1],perp.x,perp.y,0,1,edgeDistance);group.elementArray.emplaceBack(bottomRight,bottomRight+1,bottomRight+2);group.elementArray.emplaceBack(bottomRight+1,bottomRight+2,bottomRight+3)}}flattened.push(v1[0]);flattened.push(v1[1])}}var triangleIndices=earcut(flattened,holeIndices);for(var j=0;j<triangleIndices.length-2;j+=3){group.elementArray.emplaceBack(indices[triangleIndices[j]],indices[triangleIndices[j+1]],indices[triangleIndices[j+2]])}};function convertCoords(rings){if(rings instanceof Point)return[rings.x,rings.y];return rings.map(convertCoords)}function isBoundaryEdge(v1,v2){return v1.some(function(a,i){return isOutside(v2[i])&&v2[i]===a})}function isOutside(coord){return coord<0||coord>Bucket.EXTENT}},{"../../util/classify_rings":123,"../../util/util":137,"../bucket":17,"../load_geometry":26,earcut:141,"point-geometry":196}],21:[function(require,module,exports){"use strict";var Bucket=require("../bucket");var util=require("../../util/util");var loadGeometry=require("../load_geometry");var EXTENT=Bucket.EXTENT;var EXTRUDE_SCALE=63;var COS_HALF_SHARP_CORNER=Math.cos(75/2*(Math.PI/180));var SHARP_CORNER_OFFSET=15;var LINE_DISTANCE_BUFFER_BITS=15;var LINE_DISTANCE_SCALE=1/2;var MAX_LINE_DISTANCE=Math.pow(2,LINE_DISTANCE_BUFFER_BITS-1)/LINE_DISTANCE_SCALE;module.exports=LineBucket;function LineBucket(){Bucket.apply(this,arguments)}LineBucket.prototype=util.inherit(Bucket,{});LineBucket.prototype.addLineVertex=function(layoutVertexBuffer,point,extrude,tx,ty,dir,linesofar){return layoutVertexBuffer.emplaceBack(point.x<<1|tx,point.y<<1|ty,Math.round(EXTRUDE_SCALE*extrude.x)+128,Math.round(EXTRUDE_SCALE*extrude.y)+128,(dir===0?0:dir<0?-1:1)+1|(linesofar*LINE_DISTANCE_SCALE&63)<<2,linesofar*LINE_DISTANCE_SCALE>>6)};LineBucket.prototype.programInterfaces={line:{layoutVertexArrayType:new Bucket.VertexArrayType([{name:"a_pos",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}]),paintAttributes:[{name:"a_color",components:4,type:"Uint8",getValue:function(layer,globalProperties,featureProperties){return layer.getPaintValue("line-color",globalProperties,featureProperties)},multiplier:255,paintProperty:"line-color"}],elementArrayType:new Bucket.ElementArrayType}};LineBucket.prototype.addFeature=function(feature){var lines=loadGeometry(feature,LINE_DISTANCE_BUFFER_BITS);for(var i=0;i<lines.length;i++){this.addLine(lines[i],feature.properties,this.layer.layout["line-join"],this.layer.layout["line-cap"],this.layer.layout["line-miter-limit"],this.layer.layout["line-round-limit"])}};LineBucket.prototype.addLine=function(vertices,featureProperties,join,cap,miterLimit,roundLimit){var len=vertices.length;while(len>2&&vertices[len-1].equals(vertices[len-2])){len--}if(vertices.length<2)return;if(join==="bevel")miterLimit=1.05;var sharpCornerOffset=SHARP_CORNER_OFFSET*(EXTENT/(512*this.overscaling));var firstVertex=vertices[0],lastVertex=vertices[len-1],closed=firstVertex.equals(lastVertex);var group=this.prepareArrayGroup("line",len*10);var startIndex=group.layoutVertexArray.length;if(len===2&&closed)return;this.distance=0;var beginCap=cap,endCap=closed?"butt":cap,startOfLine=true,currentVertex,prevVertex,nextVertex,prevNormal,nextNormal,offsetA,offsetB;this.e1=this.e2=this.e3=-1;if(closed){currentVertex=vertices[len-2];nextNormal=firstVertex.sub(currentVertex)._unit()._perp()}for(var i=0;i<len;i++){nextVertex=closed&&i===len-1?vertices[1]:vertices[i+1];if(nextVertex&&vertices[i].equals(nextVertex))continue;if(nextNormal)prevNormal=nextNormal;if(currentVertex)prevVertex=currentVertex;currentVertex=vertices[i];nextNormal=nextVertex?nextVertex.sub(currentVertex)._unit()._perp():prevNormal;prevNormal=prevNormal||nextNormal;var joinNormal=prevNormal.add(nextNormal)._unit();var cosHalfAngle=joinNormal.x*nextNormal.x+joinNormal.y*nextNormal.y;var miterLength=1/cosHalfAngle;var isSharpCorner=cosHalfAngle<COS_HALF_SHARP_CORNER&&prevVertex&&nextVertex;if(isSharpCorner&&i>0){var prevSegmentLength=currentVertex.dist(prevVertex);if(prevSegmentLength>2*sharpCornerOffset){var newPrevVertex=currentVertex.sub(currentVertex.sub(prevVertex)._mult(sharpCornerOffset/prevSegmentLength)._round());this.distance+=newPrevVertex.dist(prevVertex);this.addCurrentVertex(newPrevVertex,this.distance,prevNormal.mult(1),0,0,false);prevVertex=newPrevVertex}}var middleVertex=prevVertex&&nextVertex;var currentJoin=middleVertex?join:nextVertex?beginCap:endCap;if(middleVertex&&currentJoin==="round"){if(miterLength<roundLimit){currentJoin="miter"}else if(miterLength<=2){currentJoin="fakeround"}}if(currentJoin==="miter"&&miterLength>miterLimit){currentJoin="bevel"}if(currentJoin==="bevel"){if(miterLength>2)currentJoin="flipbevel";if(miterLength<miterLimit)currentJoin="miter"}if(prevVertex)this.distance+=currentVertex.dist(prevVertex);if(currentJoin==="miter"){joinNormal._mult(miterLength);this.addCurrentVertex(currentVertex,this.distance,joinNormal,0,0,false)}else if(currentJoin==="flipbevel"){if(miterLength>100){joinNormal=nextNormal.clone()}else{var direction=prevNormal.x*nextNormal.y-prevNormal.y*nextNormal.x>0?-1:1;var bevelLength=miterLength*prevNormal.add(nextNormal).mag()/prevNormal.sub(nextNormal).mag();joinNormal._perp()._mult(bevelLength*direction)}this.addCurrentVertex(currentVertex,this.distance,joinNormal,0,0,false);this.addCurrentVertex(currentVertex,this.distance,joinNormal.mult(-1),0,0,false)}else if(currentJoin==="bevel"||currentJoin==="fakeround"){var lineTurnsLeft=prevNormal.x*nextNormal.y-prevNormal.y*nextNormal.x>0;var offset=-Math.sqrt(miterLength*miterLength-1);if(lineTurnsLeft){offsetB=0;offsetA=offset}else{offsetA=0;offsetB=offset}if(!startOfLine){this.addCurrentVertex(currentVertex,this.distance,prevNormal,offsetA,offsetB,false)}if(currentJoin==="fakeround"){var n=Math.floor((.5-(cosHalfAngle-.5))*8);var approxFractionalJoinNormal;for(var m=0;m<n;m++){approxFractionalJoinNormal=nextNormal.mult((m+1)/(n+1))._add(prevNormal)._unit();this.addPieSliceVertex(currentVertex,this.distance,approxFractionalJoinNormal,lineTurnsLeft)}this.addPieSliceVertex(currentVertex,this.distance,joinNormal,lineTurnsLeft);for(var k=n-1;k>=0;k--){approxFractionalJoinNormal=prevNormal.mult((k+1)/(n+1))._add(nextNormal)._unit();this.addPieSliceVertex(currentVertex,this.distance,approxFractionalJoinNormal,lineTurnsLeft)}}if(nextVertex){this.addCurrentVertex(currentVertex,this.distance,nextNormal,-offsetA,-offsetB,false)}}else if(currentJoin==="butt"){if(!startOfLine){this.addCurrentVertex(currentVertex,this.distance,prevNormal,0,0,false)}if(nextVertex){this.addCurrentVertex(currentVertex,this.distance,nextNormal,0,0,false)}}else if(currentJoin==="square"){if(!startOfLine){this.addCurrentVertex(currentVertex,this.distance,prevNormal,1,1,false);this.e1=this.e2=-1}if(nextVertex){this.addCurrentVertex(currentVertex,this.distance,nextNormal,-1,-1,false)}}else if(currentJoin==="round"){if(!startOfLine){this.addCurrentVertex(currentVertex,this.distance,prevNormal,0,0,false);this.addCurrentVertex(currentVertex,this.distance,prevNormal,1,1,true);this.e1=this.e2=-1}if(nextVertex){this.addCurrentVertex(currentVertex,this.distance,nextNormal,-1,-1,true);this.addCurrentVertex(currentVertex,this.distance,nextNormal,0,0,false)}}if(isSharpCorner&&i<len-1){var nextSegmentLength=currentVertex.dist(nextVertex);if(nextSegmentLength>2*sharpCornerOffset){var newCurrentVertex=currentVertex.add(nextVertex.sub(currentVertex)._mult(sharpCornerOffset/nextSegmentLength)._round());this.distance+=newCurrentVertex.dist(currentVertex);this.addCurrentVertex(newCurrentVertex,this.distance,nextNormal.mult(1),0,0,false);currentVertex=newCurrentVertex}}startOfLine=false}this.populatePaintArrays("line",{zoom:this.zoom},featureProperties,group,startIndex)};LineBucket.prototype.addCurrentVertex=function(currentVertex,distance,normal,endLeft,endRight,round){var tx=round?1:0;var extrude;var arrayGroup=this.arrayGroups.line[this.arrayGroups.line.length-1];var layoutVertexArray=arrayGroup.layoutVertexArray;var elementArray=arrayGroup.elementArray;extrude=normal.clone();if(endLeft)extrude._sub(normal.perp()._mult(endLeft));this.e3=this.addLineVertex(layoutVertexArray,currentVertex,extrude,tx,0,endLeft,distance);if(this.e1>=0&&this.e2>=0){elementArray.emplaceBack(this.e1,this.e2,this.e3)}this.e1=this.e2;this.e2=this.e3;extrude=normal.mult(-1);if(endRight)extrude._sub(normal.perp()._mult(endRight));this.e3=this.addLineVertex(layoutVertexArray,currentVertex,extrude,tx,1,-endRight,distance);if(this.e1>=0&&this.e2>=0){elementArray.emplaceBack(this.e1,this.e2,this.e3)}this.e1=this.e2;this.e2=this.e3;if(distance>MAX_LINE_DISTANCE/2){this.distance=0;this.addCurrentVertex(currentVertex,this.distance,normal,endLeft,endRight,round)}};LineBucket.prototype.addPieSliceVertex=function(currentVertex,distance,extrude,lineTurnsLeft){var ty=lineTurnsLeft?1:0;extrude=extrude.mult(lineTurnsLeft?-1:1);var arrayGroup=this.arrayGroups.line[this.arrayGroups.line.length-1];var layoutVertexArray=arrayGroup.layoutVertexArray;var elementArray=arrayGroup.elementArray;this.e3=this.addLineVertex(layoutVertexArray,currentVertex,extrude,0,ty,0,distance);if(this.e1>=0&&this.e2>=0){elementArray.emplaceBack(this.e1,this.e2,this.e3)}if(lineTurnsLeft){this.e2=this.e3}else{this.e1=this.e3}}},{"../../util/util":137,
"../bucket":17,"../load_geometry":26}],22:[function(require,module,exports){"use strict";var Point=require("point-geometry");var Bucket=require("../bucket");var Anchor=require("../../symbol/anchor");var getAnchors=require("../../symbol/get_anchors");var resolveTokens=require("../../util/token");var Quads=require("../../symbol/quads");var Shaping=require("../../symbol/shaping");var resolveText=require("../../symbol/resolve_text");var mergeLines=require("../../symbol/mergelines");var clipLine=require("../../symbol/clip_line");var util=require("../../util/util");var loadGeometry=require("../load_geometry");var CollisionFeature=require("../../symbol/collision_feature");var findPoleOfInaccessibility=require("../../util/find_pole_of_inaccessibility");var classifyRings=require("../../util/classify_rings");var shapeText=Shaping.shapeText;var shapeIcon=Shaping.shapeIcon;var getGlyphQuads=Quads.getGlyphQuads;var getIconQuads=Quads.getIconQuads;var EXTENT=Bucket.EXTENT;module.exports=SymbolBucket;function SymbolBucket(options){Bucket.apply(this,arguments);this.showCollisionBoxes=options.showCollisionBoxes;this.overscaling=options.overscaling;this.collisionBoxArray=options.collisionBoxArray;this.symbolQuadsArray=options.symbolQuadsArray;this.symbolInstancesArray=options.symbolInstancesArray;this.sdfIcons=options.sdfIcons;this.iconsNeedLinear=options.iconsNeedLinear;this.adjustedTextSize=options.adjustedTextSize;this.adjustedIconSize=options.adjustedIconSize;this.fontstack=options.fontstack}SymbolBucket.MAX_QUADS=65535;SymbolBucket.prototype=util.inherit(Bucket,{});SymbolBucket.prototype.serialize=function(){var serialized=Bucket.prototype.serialize.apply(this);serialized.sdfIcons=this.sdfIcons;serialized.iconsNeedLinear=this.iconsNeedLinear;serialized.adjustedTextSize=this.adjustedTextSize;serialized.adjustedIconSize=this.adjustedIconSize;serialized.fontstack=this.fontstack;return serialized};var layoutVertexArrayType=new Bucket.VertexArrayType([{name:"a_pos",components:2,type:"Int16"},{name:"a_offset",components:2,type:"Int16"},{name:"a_texture_pos",components:2,type:"Uint16"},{name:"a_data",components:4,type:"Uint8"}]);var elementArrayType=new Bucket.ElementArrayType;function addVertex(array,x,y,ox,oy,tx,ty,minzoom,maxzoom,labelminzoom,labelangle){return array.emplaceBack(x,y,Math.round(ox*64),Math.round(oy*64),tx/4,ty/4,(labelminzoom||0)*10,labelangle,(minzoom||0)*10,Math.min(maxzoom||25,25)*10)}SymbolBucket.prototype.addCollisionBoxVertex=function(layoutVertexArray,point,extrude,maxZoom,placementZoom){return layoutVertexArray.emplaceBack(point.x,point.y,Math.round(extrude.x),Math.round(extrude.y),maxZoom*10,placementZoom*10)};SymbolBucket.prototype.programInterfaces={glyph:{layoutVertexArrayType:layoutVertexArrayType,elementArrayType:elementArrayType},icon:{layoutVertexArrayType:layoutVertexArrayType,elementArrayType:elementArrayType},collisionBox:{layoutVertexArrayType:new Bucket.VertexArrayType([{name:"a_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"},{name:"a_data",components:2,type:"Uint8"}])}};SymbolBucket.prototype.populateArrays=function(collisionTile,stacks,icons){var zoomHistory={lastIntegerZoom:Infinity,lastIntegerZoomTime:0,lastZoom:0};this.adjustedTextMaxSize=this.layer.getLayoutValue("text-size",{zoom:18,zoomHistory:zoomHistory});this.adjustedTextSize=this.layer.getLayoutValue("text-size",{zoom:this.zoom+1,zoomHistory:zoomHistory});this.adjustedIconMaxSize=this.layer.getLayoutValue("icon-size",{zoom:18,zoomHistory:zoomHistory});this.adjustedIconSize=this.layer.getLayoutValue("icon-size",{zoom:this.zoom+1,zoomHistory:zoomHistory});var tileSize=512*this.overscaling;this.tilePixelRatio=EXTENT/tileSize;this.compareText={};this.iconsNeedLinear=false;this.symbolInstancesStartIndex=this.symbolInstancesArray.length;var layout=this.layer.layout;var features=this.features;var textFeatures=this.textFeatures;var horizontalAlign=.5,verticalAlign=.5;switch(layout["text-anchor"]){case"right":case"top-right":case"bottom-right":horizontalAlign=1;break;case"left":case"top-left":case"bottom-left":horizontalAlign=0;break}switch(layout["text-anchor"]){case"bottom":case"bottom-right":case"bottom-left":verticalAlign=1;break;case"top":case"top-right":case"top-left":verticalAlign=0;break}var justify=layout["text-justify"]==="right"?1:layout["text-justify"]==="left"?0:.5;var oneEm=24;var lineHeight=layout["text-line-height"]*oneEm;var maxWidth=layout["symbol-placement"]!=="line"?layout["text-max-width"]*oneEm:0;var spacing=layout["text-letter-spacing"]*oneEm;var textOffset=[layout["text-offset"][0]*oneEm,layout["text-offset"][1]*oneEm];var fontstack=this.fontstack=layout["text-font"].join(",");var geometries=[];for(var g=0;g<features.length;g++){geometries.push(loadGeometry(features[g]))}if(layout["symbol-placement"]==="line"){var merged=mergeLines(features,textFeatures,geometries);geometries=merged.geometries;features=merged.features;textFeatures=merged.textFeatures}var shapedText,shapedIcon;for(var k=0;k<features.length;k++){if(!geometries[k])continue;if(textFeatures[k]){shapedText=shapeText(textFeatures[k],stacks[fontstack],maxWidth,lineHeight,horizontalAlign,verticalAlign,justify,spacing,textOffset)}else{shapedText=null}if(layout["icon-image"]){var iconName=resolveTokens(features[k].properties,layout["icon-image"]);var image=icons[iconName];shapedIcon=shapeIcon(image,layout);if(image){if(this.sdfIcons===undefined){this.sdfIcons=image.sdf}else if(this.sdfIcons!==image.sdf){util.warnOnce("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer")}if(image.pixelRatio!==1){this.iconsNeedLinear=true}else if(layout["icon-rotate"]!==0||!this.layer.isLayoutValueFeatureConstant("icon-rotate")){this.iconsNeedLinear=true}}}else{shapedIcon=null}if(shapedText||shapedIcon){this.addFeature(geometries[k],shapedText,shapedIcon,features[k])}}this.symbolInstancesEndIndex=this.symbolInstancesArray.length;this.placeFeatures(collisionTile,this.showCollisionBoxes);this.trimArrays()};SymbolBucket.prototype.addFeature=function(lines,shapedText,shapedIcon,feature){var layout=this.layer.layout;var glyphSize=24;var fontScale=this.adjustedTextSize/glyphSize,textMaxSize=this.adjustedTextMaxSize!==undefined?this.adjustedTextMaxSize:this.adjustedTextSize,textBoxScale=this.tilePixelRatio*fontScale,textMaxBoxScale=this.tilePixelRatio*textMaxSize/glyphSize,iconBoxScale=this.tilePixelRatio*this.adjustedIconSize,symbolMinDistance=this.tilePixelRatio*layout["symbol-spacing"],avoidEdges=layout["symbol-avoid-edges"],textPadding=layout["text-padding"]*this.tilePixelRatio,iconPadding=layout["icon-padding"]*this.tilePixelRatio,textMaxAngle=layout["text-max-angle"]/180*Math.PI,textAlongLine=layout["text-rotation-alignment"]==="map"&&layout["symbol-placement"]==="line",iconAlongLine=layout["icon-rotation-alignment"]==="map"&&layout["symbol-placement"]==="line",mayOverlap=layout["text-allow-overlap"]||layout["icon-allow-overlap"]||layout["text-ignore-placement"]||layout["icon-ignore-placement"],symbolPlacement=layout["symbol-placement"],isLine=symbolPlacement==="line",textRepeatDistance=symbolMinDistance/2;var list=null;if(isLine){list=clipLine(lines,0,0,EXTENT,EXTENT)}else{list=classifyRings(lines,0)}for(var i=0;i<list.length;i++){var anchors=null;var pointsOrRings=list[i];var line=null;if(isLine){line=pointsOrRings;anchors=getAnchors(line,symbolMinDistance,textMaxAngle,shapedText,shapedIcon,glyphSize,textMaxBoxScale,this.overscaling,EXTENT)}else{line=pointsOrRings[0];anchors=this.findPolygonAnchors(pointsOrRings)}for(var j=0,len=anchors.length;j<len;j++){var anchor=anchors[j];if(shapedText&&isLine){if(this.anchorIsTooClose(shapedText.text,textRepeatDistance,anchor)){continue}}var inside=!(anchor.x<0||anchor.x>EXTENT||anchor.y<0||anchor.y>EXTENT);if(avoidEdges&&!inside)continue;var addToBuffers=inside||mayOverlap;this.addSymbolInstance(anchor,line,shapedText,shapedIcon,this.layer,addToBuffers,this.symbolInstancesArray.length,this.collisionBoxArray,feature.index,this.sourceLayerIndex,this.index,textBoxScale,textPadding,textAlongLine,iconBoxScale,iconPadding,iconAlongLine,{zoom:this.zoom},feature.properties)}}};SymbolBucket.prototype.findPolygonAnchors=function(polygonRings){var outerRing=polygonRings[0];if(outerRing.length===0){return[]}else if(outerRing.length<3||!util.isClosedPolygon(outerRing)){return[new Anchor(outerRing[0].x,outerRing[0].y,0)]}var anchors=null;var poi=findPoleOfInaccessibility(polygonRings,16);anchors=[new Anchor(poi.x,poi.y,0)];return anchors};SymbolBucket.prototype.anchorIsTooClose=function(text,repeatDistance,anchor){var compareText=this.compareText;if(!(text in compareText)){compareText[text]=[]}else{var otherAnchors=compareText[text];for(var k=otherAnchors.length-1;k>=0;k--){if(anchor.dist(otherAnchors[k])<repeatDistance){return true}}}compareText[text].push(anchor);return false};SymbolBucket.prototype.placeFeatures=function(collisionTile,showCollisionBoxes){this.recalculateStyleLayers();this.createArrays();var layout=this.layer.layout;var maxScale=collisionTile.maxScale;var textAlongLine=layout["text-rotation-alignment"]==="map"&&layout["symbol-placement"]==="line";var iconAlongLine=layout["icon-rotation-alignment"]==="map"&&layout["symbol-placement"]==="line";var mayOverlap=layout["text-allow-overlap"]||layout["icon-allow-overlap"]||layout["text-ignore-placement"]||layout["icon-ignore-placement"];if(mayOverlap){var symbolInstancesStructTypeArray=this.symbolInstancesArray.toArray(this.symbolInstancesStartIndex,this.symbolInstancesEndIndex);var angle=collisionTile.angle;var sin=Math.sin(angle),cos=Math.cos(angle);this.sortedSymbolInstances=symbolInstancesStructTypeArray.sort(function(a,b){var aRotated=sin*a.anchorPointX+cos*a.anchorPointY|0;var bRotated=sin*b.anchorPointX+cos*b.anchorPointY|0;return aRotated-bRotated||b.index-a.index})}for(var p=this.symbolInstancesStartIndex;p<this.symbolInstancesEndIndex;p++){var symbolInstance=this.sortedSymbolInstances?this.sortedSymbolInstances[p-this.symbolInstancesStartIndex]:this.symbolInstancesArray.get(p);var textCollisionFeature={boxStartIndex:symbolInstance.textBoxStartIndex,boxEndIndex:symbolInstance.textBoxEndIndex};var iconCollisionFeature={boxStartIndex:symbolInstance.iconBoxStartIndex,boxEndIndex:symbolInstance.iconBoxEndIndex};var hasText=!(symbolInstance.textBoxStartIndex===symbolInstance.textBoxEndIndex);var hasIcon=!(symbolInstance.iconBoxStartIndex===symbolInstance.iconBoxEndIndex);var iconWithoutText=layout["text-optional"]||!hasText,textWithoutIcon=layout["icon-optional"]||!hasIcon;var glyphScale=hasText?collisionTile.placeCollisionFeature(textCollisionFeature,layout["text-allow-overlap"],layout["symbol-avoid-edges"]):collisionTile.minScale;var iconScale=hasIcon?collisionTile.placeCollisionFeature(iconCollisionFeature,layout["icon-allow-overlap"],layout["symbol-avoid-edges"]):collisionTile.minScale;if(!iconWithoutText&&!textWithoutIcon){iconScale=glyphScale=Math.max(iconScale,glyphScale)}else if(!textWithoutIcon&&glyphScale){glyphScale=Math.max(iconScale,glyphScale)}else if(!iconWithoutText&&iconScale){iconScale=Math.max(iconScale,glyphScale)}if(hasText){collisionTile.insertCollisionFeature(textCollisionFeature,glyphScale,layout["text-ignore-placement"]);if(glyphScale<=maxScale){this.addSymbols("glyph",symbolInstance.glyphQuadStartIndex,symbolInstance.glyphQuadEndIndex,glyphScale,layout["text-keep-upright"],textAlongLine,collisionTile.angle)}}if(hasIcon){collisionTile.insertCollisionFeature(iconCollisionFeature,iconScale,layout["icon-ignore-placement"]);if(iconScale<=maxScale){this.addSymbols("icon",symbolInstance.iconQuadStartIndex,symbolInstance.iconQuadEndIndex,iconScale,layout["icon-keep-upright"],iconAlongLine,collisionTile.angle)}}}if(showCollisionBoxes)this.addToDebugBuffers(collisionTile)};SymbolBucket.prototype.addSymbols=function(programName,quadsStart,quadsEnd,scale,keepUpright,alongLine,placementAngle){var group=this.prepareArrayGroup(programName,4*(quadsEnd-quadsStart));var elementArray=group.elementArray;var layoutVertexArray=group.layoutVertexArray;var zoom=this.zoom;var placementZoom=Math.max(Math.log(scale)/Math.LN2+zoom,0);for(var k=quadsStart;k<quadsEnd;k++){var symbol=this.symbolQuadsArray.get(k).SymbolQuad;var a=(symbol.anchorAngle+placementAngle+Math.PI)%(Math.PI*2);if(keepUpright&&alongLine&&(a<=Math.PI/2||a>Math.PI*3/2))continue;var tl=symbol.tl,tr=symbol.tr,bl=symbol.bl,br=symbol.br,tex=symbol.tex,anchorPoint=symbol.anchorPoint,minZoom=Math.max(zoom+Math.log(symbol.minScale)/Math.LN2,placementZoom),maxZoom=Math.min(zoom+Math.log(symbol.maxScale)/Math.LN2,25);if(maxZoom<=minZoom)continue;if(minZoom===placementZoom)minZoom=0;var glyphAngle=Math.round(symbol.glyphAngle/(Math.PI*2)*256);var index=addVertex(layoutVertexArray,anchorPoint.x,anchorPoint.y,tl.x,tl.y,tex.x,tex.y,minZoom,maxZoom,placementZoom,glyphAngle);addVertex(layoutVertexArray,anchorPoint.x,anchorPoint.y,tr.x,tr.y,tex.x+tex.w,tex.y,minZoom,maxZoom,placementZoom,glyphAngle);addVertex(layoutVertexArray,anchorPoint.x,anchorPoint.y,bl.x,bl.y,tex.x,tex.y+tex.h,minZoom,maxZoom,placementZoom,glyphAngle);addVertex(layoutVertexArray,anchorPoint.x,anchorPoint.y,br.x,br.y,tex.x+tex.w,tex.y+tex.h,minZoom,maxZoom,placementZoom,glyphAngle);elementArray.emplaceBack(index,index+1,index+2);elementArray.emplaceBack(index+1,index+2,index+3)}};SymbolBucket.prototype.updateIcons=function(icons){this.recalculateStyleLayers();var iconValue=this.layer.layout["icon-image"];if(!iconValue)return;for(var i=0;i<this.features.length;i++){var iconName=resolveTokens(this.features[i].properties,iconValue);if(iconName)icons[iconName]=true}};SymbolBucket.prototype.updateFont=function(stacks){this.recalculateStyleLayers();var fontName=this.layer.layout["text-font"],stack=stacks[fontName]=stacks[fontName]||{};this.textFeatures=resolveText(this.features,this.layer.layout,stack)};SymbolBucket.prototype.addToDebugBuffers=function(collisionTile){var group=this.prepareArrayGroup("collisionBox",0);var layoutVertexArray=group.layoutVertexArray;var angle=-collisionTile.angle;var yStretch=collisionTile.yStretch;for(var j=this.symbolInstancesStartIndex;j<this.symbolInstancesEndIndex;j++){var symbolInstance=this.symbolInstancesArray.get(j);symbolInstance.textCollisionFeature={boxStartIndex:symbolInstance.textBoxStartIndex,boxEndIndex:symbolInstance.textBoxEndIndex};symbolInstance.iconCollisionFeature={boxStartIndex:symbolInstance.iconBoxStartIndex,boxEndIndex:symbolInstance.iconBoxEndIndex};for(var i=0;i<2;i++){var feature=symbolInstance[i===0?"textCollisionFeature":"iconCollisionFeature"];if(!feature)continue;for(var b=feature.boxStartIndex;b<feature.boxEndIndex;b++){var box=this.collisionBoxArray.get(b);var anchorPoint=box.anchorPoint;var tl=new Point(box.x1,box.y1*yStretch)._rotate(angle);var tr=new Point(box.x2,box.y1*yStretch)._rotate(angle);var bl=new Point(box.x1,box.y2*yStretch)._rotate(angle);var br=new Point(box.x2,box.y2*yStretch)._rotate(angle);var maxZoom=Math.max(0,Math.min(25,this.zoom+Math.log(box.maxScale)/Math.LN2));var placementZoom=Math.max(0,Math.min(25,this.zoom+Math.log(box.placementScale)/Math.LN2));this.addCollisionBoxVertex(layoutVertexArray,anchorPoint,tl,maxZoom,placementZoom);this.addCollisionBoxVertex(layoutVertexArray,anchorPoint,tr,maxZoom,placementZoom);this.addCollisionBoxVertex(layoutVertexArray,anchorPoint,tr,maxZoom,placementZoom);this.addCollisionBoxVertex(layoutVertexArray,anchorPoint,br,maxZoom,placementZoom);this.addCollisionBoxVertex(layoutVertexArray,anchorPoint,br,maxZoom,placementZoom);this.addCollisionBoxVertex(layoutVertexArray,anchorPoint,bl,maxZoom,placementZoom);this.addCollisionBoxVertex(layoutVertexArray,anchorPoint,bl,maxZoom,placementZoom);this.addCollisionBoxVertex(layoutVertexArray,anchorPoint,tl,maxZoom,placementZoom)}}}};SymbolBucket.prototype.addSymbolInstance=function(anchor,line,shapedText,shapedIcon,layer,addToBuffers,index,collisionBoxArray,featureIndex,sourceLayerIndex,bucketIndex,textBoxScale,textPadding,textAlongLine,iconBoxScale,iconPadding,iconAlongLine,globalProperties,featureProperties){var glyphQuadStartIndex,glyphQuadEndIndex,iconQuadStartIndex,iconQuadEndIndex,textCollisionFeature,iconCollisionFeature,glyphQuads,iconQuads;if(shapedText){glyphQuads=addToBuffers?getGlyphQuads(anchor,shapedText,textBoxScale,line,layer,textAlongLine):[];textCollisionFeature=new CollisionFeature(collisionBoxArray,line,anchor,featureIndex,sourceLayerIndex,bucketIndex,shapedText,textBoxScale,textPadding,textAlongLine,false)}glyphQuadStartIndex=this.symbolQuadsArray.length;if(glyphQuads&&glyphQuads.length){for(var i=0;i<glyphQuads.length;i++){this.addSymbolQuad(glyphQuads[i])}}glyphQuadEndIndex=this.symbolQuadsArray.length;var textBoxStartIndex=textCollisionFeature?textCollisionFeature.boxStartIndex:this.collisionBoxArray.length;var textBoxEndIndex=textCollisionFeature?textCollisionFeature.boxEndIndex:this.collisionBoxArray.length;if(shapedIcon){iconQuads=addToBuffers?getIconQuads(anchor,shapedIcon,iconBoxScale,line,layer,iconAlongLine,shapedText,globalProperties,featureProperties):[];iconCollisionFeature=new CollisionFeature(collisionBoxArray,line,anchor,featureIndex,sourceLayerIndex,bucketIndex,shapedIcon,iconBoxScale,iconPadding,iconAlongLine,true)}iconQuadStartIndex=this.symbolQuadsArray.length;if(iconQuads&&iconQuads.length===1){this.addSymbolQuad(iconQuads[0])}iconQuadEndIndex=this.symbolQuadsArray.length;var iconBoxStartIndex=iconCollisionFeature?iconCollisionFeature.boxStartIndex:this.collisionBoxArray.length;var iconBoxEndIndex=iconCollisionFeature?iconCollisionFeature.boxEndIndex:this.collisionBoxArray.length;if(iconQuadEndIndex>SymbolBucket.MAX_QUADS)util.warnOnce("Too many symbols being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907");if(glyphQuadEndIndex>SymbolBucket.MAX_QUADS)util.warnOnce("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907");return this.symbolInstancesArray.emplaceBack(textBoxStartIndex,textBoxEndIndex,iconBoxStartIndex,iconBoxEndIndex,glyphQuadStartIndex,glyphQuadEndIndex,iconQuadStartIndex,iconQuadEndIndex,anchor.x,anchor.y,index)};SymbolBucket.prototype.addSymbolQuad=function(symbolQuad){return this.symbolQuadsArray.emplaceBack(symbolQuad.anchorPoint.x,symbolQuad.anchorPoint.y,symbolQuad.tl.x,symbolQuad.tl.y,symbolQuad.tr.x,symbolQuad.tr.y,symbolQuad.bl.x,symbolQuad.bl.y,symbolQuad.br.x,symbolQuad.br.y,symbolQuad.tex.h,symbolQuad.tex.w,symbolQuad.tex.x,symbolQuad.tex.y,symbolQuad.anchorAngle,symbolQuad.glyphAngle,symbolQuad.maxScale,symbolQuad.minScale)}},{"../../symbol/anchor":84,"../../symbol/clip_line":86,"../../symbol/collision_feature":88,"../../symbol/get_anchors":90,"../../symbol/mergelines":93,"../../symbol/quads":94,"../../symbol/resolve_text":95,"../../symbol/shaping":96,"../../util/classify_rings":123,"../../util/find_pole_of_inaccessibility":129,"../../util/token":136,"../../util/util":137,"../bucket":17,"../load_geometry":26,"point-geometry":196}],23:[function(require,module,exports){"use strict";module.exports=Buffer;function Buffer(array,arrayType,type){this.arrayBuffer=array.arrayBuffer;this.length=array.length;this.attributes=arrayType.members;this.itemSize=arrayType.bytesPerElement;this.type=type;this.arrayType=arrayType}Buffer.prototype.bind=function(gl){var type=gl[this.type];if(!this.buffer){this.gl=gl;this.buffer=gl.createBuffer();gl.bindBuffer(type,this.buffer);gl.bufferData(type,this.arrayBuffer,gl.STATIC_DRAW);this.arrayBuffer=null}else{gl.bindBuffer(type,this.buffer)}};var AttributeType={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT"};Buffer.prototype.setVertexAttribPointers=function(gl,program){for(var j=0;j<this.attributes.length;j++){var member=this.attributes[j];var attribIndex=program[member.name];if(attribIndex!==undefined){gl.vertexAttribPointer(attribIndex,member.components,gl[AttributeType[member.type]],false,this.arrayType.bytesPerElement,member.offset)}}};Buffer.prototype.destroy=function(){if(this.buffer){this.gl.deleteBuffer(this.buffer)}};Buffer.BufferType={VERTEX:"ARRAY_BUFFER",ELEMENT:"ELEMENT_ARRAY_BUFFER"}},{}],24:[function(require,module,exports){"use strict";var util=require("../util/util");var Buffer=require("./buffer");var VertexArrayObject=require("../render/vertex_array_object");module.exports=BufferGroup;function BufferGroup(arrayGroup,arrayTypes){this.layoutVertexBuffer=new Buffer(arrayGroup.layoutVertexArray,arrayTypes.layoutVertexArrayType,Buffer.BufferType.VERTEX);if(arrayGroup.elementArray){this.elementBuffer=new Buffer(arrayGroup.elementArray,arrayTypes.elementArrayType,Buffer.BufferType.ELEMENT)}var vaos=this.vaos={};var secondVaos;if(arrayGroup.elementArray2){this.elementBuffer2=new Buffer(arrayGroup.elementArray2,arrayTypes.elementArrayType2,Buffer.BufferType.ELEMENT);secondVaos=this.secondVaos={}}this.paintVertexBuffers=util.mapObject(arrayGroup.paintVertexArrays,function(array,name){vaos[name]=new VertexArrayObject;if(arrayGroup.elementArray2){secondVaos[name]=new VertexArrayObject}return new Buffer(array,arrayTypes.paintVertexArrayTypes[name],Buffer.BufferType.VERTEX)})}BufferGroup.prototype.destroy=function(){this.layoutVertexBuffer.destroy();if(this.elementBuffer){this.elementBuffer.destroy()}if(this.elementBuffer2){this.elementBuffer2.destroy()}for(var n in this.paintVertexBuffers){this.paintVertexBuffers[n].destroy()}for(var j in this.vaos){this.vaos[j].destroy()}for(var k in this.secondVaos){this.secondVaos[k].destroy()}}},{"../render/vertex_array_object":49,"../util/util":137,"./buffer":23}],25:[function(require,module,exports){"use strict";var Point=require("point-geometry");var loadGeometry=require("./load_geometry");var EXTENT=require("./bucket").EXTENT;var featureFilter=require("feature-filter");var StructArrayType=require("../util/struct_array");var Grid=require("grid-index");var DictionaryCoder=require("../util/dictionary_coder");var vt=require("vector-tile");var Protobuf=require("pbf");var GeoJSONFeature=require("../util/vectortile_to_geojson");var arraysIntersect=require("../util/util").arraysIntersect;var intersection=require("../util/intersection_tests");var multiPolygonIntersectsBufferedMultiPoint=intersection.multiPolygonIntersectsBufferedMultiPoint;var multiPolygonIntersectsMultiPolygon=intersection.multiPolygonIntersectsMultiPolygon;var multiPolygonIntersectsBufferedMultiLine=intersection.multiPolygonIntersectsBufferedMultiLine;var FeatureIndexArray=new StructArrayType({members:[{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]});module.exports=FeatureIndex;function FeatureIndex(coord,overscaling,collisionTile){if(coord.grid){var serialized=coord;var rawTileData=overscaling;coord=serialized.coord;overscaling=serialized.overscaling;this.grid=new Grid(serialized.grid);this.featureIndexArray=new FeatureIndexArray(serialized.featureIndexArray);this.rawTileData=rawTileData;this.bucketLayerIDs=serialized.bucketLayerIDs}else{this.grid=new Grid(EXTENT,16,0);this.featureIndexArray=new FeatureIndexArray}this.coord=coord;this.overscaling=overscaling;this.x=coord.x;this.y=coord.y;this.z=coord.z-Math.log(overscaling)/Math.LN2;this.setCollisionTile(collisionTile)}FeatureIndex.prototype.insert=function(feature,featureIndex,sourceLayerIndex,bucketIndex){var key=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(featureIndex,sourceLayerIndex,bucketIndex);var geometry=loadGeometry(feature);for(var r=0;r<geometry.length;r++){var ring=geometry[r];var bbox=[Infinity,Infinity,-Infinity,-Infinity];for(var i=0;i<ring.length;i++){var p=ring[i];bbox[0]=Math.min(bbox[0],p.x);bbox[1]=Math.min(bbox[1],p.y);bbox[2]=Math.max(bbox[2],p.x);bbox[3]=Math.max(bbox[3],p.y)}this.grid.insert(key,bbox[0],bbox[1],bbox[2],bbox[3])}};FeatureIndex.prototype.setCollisionTile=function(collisionTile){this.collisionTile=collisionTile};FeatureIndex.prototype.serialize=function(){var data={coord:this.coord,overscaling:this.overscaling,grid:this.grid.toArrayBuffer(),featureIndexArray:this.featureIndexArray.serialize(),bucketLayerIDs:this.bucketLayerIDs};return{data:data,transferables:[data.grid,data.featureIndexArray.arrayBuffer]}};function translateDistance(translate){return Math.sqrt(translate[0]*translate[0]+translate[1]*translate[1])}FeatureIndex.prototype.query=function(args,styleLayers){if(!this.vtLayers){this.vtLayers=new vt.VectorTile(new Protobuf(this.rawTileData)).layers;this.sourceLayerCoder=new DictionaryCoder(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])}var result={};var params=args.params||{},pixelsToTileUnits=EXTENT/args.tileSize/args.scale,filter=featureFilter(params.filter);var additionalRadius=0;for(var id in styleLayers){var styleLayer=styleLayers[id];var paint=styleLayer.paint;var styleLayerDistance=0;if(styleLayer.type==="line"){styleLayerDistance=getLineWidth(paint)/2+Math.abs(paint["line-offset"])+translateDistance(paint["line-translate"])}else if(styleLayer.type==="fill"){styleLayerDistance=translateDistance(paint["fill-translate"])}else if(styleLayer.type==="circle"){styleLayerDistance=paint["circle-radius"]+translateDistance(paint["circle-translate"])}additionalRadius=Math.max(additionalRadius,styleLayerDistance*pixelsToTileUnits)}var queryGeometry=args.queryGeometry.map(function(q){return q.map(function(p){return new Point(p.x,p.y)})});var minX=Infinity;var minY=Infinity;var maxX=-Infinity;var maxY=-Infinity;for(var i=0;i<queryGeometry.length;i++){var ring=queryGeometry[i];for(var k=0;k<ring.length;k++){var p=ring[k];minX=Math.min(minX,p.x);minY=Math.min(minY,p.y);maxX=Math.max(maxX,p.x);maxY=Math.max(maxY,p.y)}}var matching=this.grid.query(minX-additionalRadius,minY-additionalRadius,maxX+additionalRadius,maxY+additionalRadius);matching.sort(topDownFeatureComparator);this.filterMatching(result,matching,this.featureIndexArray,queryGeometry,filter,params.layers,styleLayers,args.bearing,pixelsToTileUnits);var matchingSymbols=this.collisionTile.queryRenderedSymbols(minX,minY,maxX,maxY,args.scale);matchingSymbols.sort();this.filterMatching(result,matchingSymbols,this.collisionTile.collisionBoxArray,queryGeometry,filter,params.layers,styleLayers,args.bearing,pixelsToTileUnits);return result};function topDownFeatureComparator(a,b){return b-a}function getLineWidth(paint){if(paint["line-gap-width"]>0){return paint["line-gap-width"]+2*paint["line-width"]}else{return paint["line-width"]}}FeatureIndex.prototype.filterMatching=function(result,matching,array,queryGeometry,filter,filterLayerIDs,styleLayers,bearing,pixelsToTileUnits){var previousIndex;for(var k=0;k<matching.length;k++){var index=matching[k];if(index===previousIndex)continue;previousIndex=index;var match=array.get(index);var layerIDs=this.bucketLayerIDs[match.bucketIndex];if(filterLayerIDs&&!arraysIntersect(filterLayerIDs,layerIDs))continue;var sourceLayerName=this.sourceLayerCoder.decode(match.sourceLayerIndex);var sourceLayer=this.vtLayers[sourceLayerName];var feature=sourceLayer.feature(match.featureIndex);if(!filter(feature))continue;var geometry=null;for(var l=0;l<layerIDs.length;l++){var layerID=layerIDs[l];if(filterLayerIDs&&filterLayerIDs.indexOf(layerID)<0){continue}var styleLayer=styleLayers[layerID];if(!styleLayer)continue;var translatedPolygon;if(styleLayer.type!=="symbol"){if(!geometry)geometry=loadGeometry(feature);var paint=styleLayer.paint;if(styleLayer.type==="line"){translatedPolygon=translate(queryGeometry,paint["line-translate"],paint["line-translate-anchor"],bearing,pixelsToTileUnits);var halfWidth=getLineWidth(paint)/2*pixelsToTileUnits;if(paint["line-offset"]){geometry=offsetLine(geometry,paint["line-offset"]*pixelsToTileUnits)}if(!multiPolygonIntersectsBufferedMultiLine(translatedPolygon,geometry,halfWidth))continue}else if(styleLayer.type==="fill"){translatedPolygon=translate(queryGeometry,paint["fill-translate"],paint["fill-translate-anchor"],bearing,pixelsToTileUnits);if(!multiPolygonIntersectsMultiPolygon(translatedPolygon,geometry))continue}else if(styleLayer.type==="circle"){translatedPolygon=translate(queryGeometry,paint["circle-translate"],paint["circle-translate-anchor"],bearing,pixelsToTileUnits);var circleRadius=paint["circle-radius"]*pixelsToTileUnits;if(!multiPolygonIntersectsBufferedMultiPoint(translatedPolygon,geometry,circleRadius))continue}}var geojsonFeature=new GeoJSONFeature(feature,this.z,this.x,this.y);geojsonFeature.layer=styleLayer.serialize({includeRefProperties:true});var layerResult=result[layerID];if(layerResult===undefined){layerResult=result[layerID]=[]}layerResult.push(geojsonFeature)}}};function translate(queryGeometry,translate,translateAnchor,bearing,pixelsToTileUnits){if(!translate[0]&&!translate[1]){return queryGeometry}translate=Point.convert(translate);if(translateAnchor==="viewport"){translate._rotate(-bearing)}var translated=[];for(var i=0;i<queryGeometry.length;i++){var ring=queryGeometry[i];var translatedRing=[];for(var k=0;k<ring.length;k++){translatedRing.push(ring[k].sub(translate._mult(pixelsToTileUnits)))}translated.push(translatedRing)}return translated}function offsetLine(rings,offset){var newRings=[];var zero=new Point(0,0);for(var k=0;k<rings.length;k++){var ring=rings[k];var newRing=[];for(var i=0;i<ring.length;i++){var a=ring[i-1];var b=ring[i];var c=ring[i+1];var aToB=i===0?zero:b.sub(a)._unit()._perp();var bToC=i===ring.length-1?zero:c.sub(b)._unit()._perp();var extrude=aToB._add(bToC)._unit();var cosHalfAngle=extrude.x*bToC.x+extrude.y*bToC.y;extrude._mult(1/cosHalfAngle);newRing.push(extrude._mult(offset)._add(b))}newRings.push(newRing)}return newRings}},{"../util/dictionary_coder":125,"../util/intersection_tests":132,"../util/struct_array":135,"../util/util":137,"../util/vectortile_to_geojson":138,"./bucket":17,"./load_geometry":26,"feature-filter":142,"grid-index":164,pbf:194,"point-geometry":196,"vector-tile":206}],26:[function(require,module,exports){"use strict";var util=require("../util/util");var EXTENT=require("./bucket").EXTENT;function createBounds(bits){return{min:-1*Math.pow(2,bits-1),max:Math.pow(2,bits-1)-1}}var boundsLookup={15:createBounds(15),16:createBounds(16)};module.exports=function loadGeometry(feature,bits){var bounds=boundsLookup[bits||16];var scale=EXTENT/feature.extent;var geometry=feature.loadGeometry();for(var r=0;r<geometry.length;r++){var ring=geometry[r];for(var p=0;p<ring.length;p++){var point=ring[p];point.x=Math.round(point.x*scale);point.y=Math.round(point.y*scale);if(point.x<bounds.min||point.x>bounds.max||point.y<bounds.min||point.y>bounds.max){util.warnOnce("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}}return geometry}},{"../util/util":137,"./bucket":17}],27:[function(require,module,exports){"use strict";module.exports=Coordinate;function Coordinate(column,row,zoom){this.column=column;this.row=row;this.zoom=zoom}Coordinate.prototype={clone:function(){return new Coordinate(this.column,this.row,this.zoom)},zoomTo:function(zoom){return this.clone()._zoomTo(zoom)},sub:function(c){return this.clone()._sub(c)},_zoomTo:function(zoom){var scale=Math.pow(2,zoom-this.zoom);this.column*=scale;this.row*=scale;this.zoom=zoom;return this},_sub:function(c){c=c.zoomTo(this.zoom);this.column-=c.column;this.row-=c.row;return this}}},{}],28:[function(require,module,exports){"use strict";module.exports=LngLat;var wrap=require("../util/util").wrap;function LngLat(lng,lat){if(isNaN(lng)||isNaN(lat)){throw new Error("Invalid LngLat object: ("+lng+", "+lat+")")}this.lng=+lng;this.lat=+lat;if(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.convert=function(input){if(input instanceof LngLat){return input}else if(input&&input.hasOwnProperty("lng")&&input.hasOwnProperty("lat")){return new LngLat(input.lng,input.lat);
}else if(Array.isArray(input)&&input.length===2){return new LngLat(input[0],input[1])}else{throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}},{"../util/util":137}],29:[function(require,module,exports){"use strict";module.exports=LngLatBounds;var LngLat=require("./lng_lat");function LngLatBounds(sw,ne){if(!sw){return}else if(ne){this.setSouthWest(sw).setNorthEast(ne)}else if(sw.length===4){this.setSouthWest([sw[0],sw[1]]).setNorthEast([sw[2],sw[3]])}else{this.setSouthWest(sw[0]).setNorthEast(sw[1])}}LngLatBounds.prototype={setNorthEast:function(ne){this._ne=LngLat.convert(ne);return this},setSouthWest:function(sw){this._sw=LngLat.convert(sw);return this},extend:function(obj){var sw=this._sw,ne=this._ne,sw2,ne2;if(obj instanceof LngLat){sw2=obj;ne2=obj}else if(obj instanceof LngLatBounds){sw2=obj._sw;ne2=obj._ne;if(!sw2||!ne2)return this}else{if(Array.isArray(obj)){if(obj.every(Array.isArray)){return this.extend(LngLatBounds.convert(obj))}else{return this.extend(LngLat.convert(obj))}}return this}if(!sw&&!ne){this._sw=new LngLat(sw2.lng,sw2.lat);this._ne=new LngLat(ne2.lng,ne2.lat)}else{sw.lng=Math.min(sw2.lng,sw.lng);sw.lat=Math.min(sw2.lat,sw.lat);ne.lng=Math.max(ne2.lng,ne.lng);ne.lat=Math.max(ne2.lat,ne.lat)}return this},getCenter:function(){return new LngLat((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},getSouthWest:function(){return this._sw},getNorthEast:function(){return this._ne},getNorthWest:function(){return new LngLat(this.getWest(),this.getNorth())},getSouthEast:function(){return new LngLat(this.getEast(),this.getSouth())},getWest:function(){return this._sw.lng},getSouth:function(){return this._sw.lat},getEast:function(){return this._ne.lng},getNorth:function(){return this._ne.lat},toArray:function(){return[this._sw.toArray(),this._ne.toArray()]},toString:function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"}};LngLatBounds.convert=function(input){if(!input||input instanceof LngLatBounds)return input;return new LngLatBounds(input)}},{"./lng_lat":28}],30:[function(require,module,exports){"use strict";var LngLat=require("./lng_lat"),Point=require("point-geometry"),Coordinate=require("./coordinate"),util=require("../util/util"),interp=require("../util/interpolate"),TileCoord=require("../source/tile_coord"),EXTENT=require("../data/bucket").EXTENT,glmatrix=require("gl-matrix");var vec4=glmatrix.vec4,mat4=glmatrix.mat4,mat2=glmatrix.mat2;module.exports=Transform;function Transform(minZoom,maxZoom){this.tileSize=512;this._minZoom=minZoom||0;this._maxZoom=maxZoom||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._altitude=1.5;this._pitch=0;this._unmodified=true}Transform.prototype={get minZoom(){return this._minZoom},set minZoom(zoom){if(this._minZoom===zoom)return;this._minZoom=zoom;this.zoom=Math.max(this.zoom,zoom)},get maxZoom(){return this._maxZoom},set maxZoom(zoom){if(this._maxZoom===zoom)return;this._maxZoom=zoom;this.zoom=Math.min(this.zoom,zoom)},get worldSize(){return this.tileSize*this.scale},get centerPoint(){return this.size._div(2)},get size(){return new Point(this.width,this.height)},get bearing(){return-this.angle/Math.PI*180},set bearing(bearing){var b=-util.wrap(bearing,-180,180)*Math.PI/180;if(this.angle===b)return;this._unmodified=false;this.angle=b;this._calcMatrices();this.rotationMatrix=mat2.create();mat2.rotate(this.rotationMatrix,this.rotationMatrix,this.angle)},get pitch(){return this._pitch/Math.PI*180},set pitch(pitch){var p=util.clamp(pitch,0,60)/180*Math.PI;if(this._pitch===p)return;this._unmodified=false;this._pitch=p;this._calcMatrices()},get altitude(){return this._altitude},set altitude(altitude){var a=Math.max(.75,altitude);if(this._altitude===a)return;this._unmodified=false;this._altitude=a;this._calcMatrices()},get zoom(){return this._zoom},set zoom(zoom){var z=Math.min(Math.max(zoom,this.minZoom),this.maxZoom);if(this._zoom===z)return;this._unmodified=false;this._zoom=z;this.scale=this.zoomScale(z);this.tileZoom=Math.floor(z);this.zoomFraction=z-this.tileZoom;this._calcMatrices();this._constrain()},get center(){return this._center},set center(center){if(center.lat===this._center.lat&&center.lng===this._center.lng)return;this._unmodified=false;this._center=center;this._calcMatrices();this._constrain()},coveringZoomLevel:function(options){return(options.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/options.tileSize))},coveringTiles:function(options){var z=this.coveringZoomLevel(options);var actualZ=z;if(z<options.minzoom)return[];if(z>options.maxzoom)z=options.maxzoom;var tr=this,tileCenter=tr.locationCoordinate(tr.center)._zoomTo(z),centerPoint=new Point(tileCenter.column-.5,tileCenter.row-.5);return TileCoord.cover(z,[tr.pointCoordinate(new Point(0,0))._zoomTo(z),tr.pointCoordinate(new Point(tr.width,0))._zoomTo(z),tr.pointCoordinate(new Point(tr.width,tr.height))._zoomTo(z),tr.pointCoordinate(new Point(0,tr.height))._zoomTo(z)],options.reparseOverscaled?actualZ:z).sort(function(a,b){return centerPoint.dist(a)-centerPoint.dist(b)})},resize:function(width,height){this.width=width;this.height=height;this.pixelsToGLUnits=[2/width,-2/height];this._calcMatrices();this._constrain()},get unmodified(){return this._unmodified},zoomScale:function(zoom){return Math.pow(2,zoom)},scaleZoom:function(scale){return Math.log(scale)/Math.LN2},project:function(lnglat,worldSize){return new Point(this.lngX(lnglat.lng,worldSize),this.latY(lnglat.lat,worldSize))},unproject:function(point,worldSize){return new LngLat(this.xLng(point.x,worldSize),this.yLat(point.y,worldSize))},get x(){return this.lngX(this.center.lng)},get y(){return this.latY(this.center.lat)},get point(){return new Point(this.x,this.y)},lngX:function(lng,worldSize){return(180+lng)*(worldSize||this.worldSize)/360},latY:function(lat,worldSize){var y=180/Math.PI*Math.log(Math.tan(Math.PI/4+lat*Math.PI/360));return(180-y)*(worldSize||this.worldSize)/360},xLng:function(x,worldSize){return x*360/(worldSize||this.worldSize)-180},yLat:function(y,worldSize){var y2=180-y*360/(worldSize||this.worldSize);return 360/Math.PI*Math.atan(Math.exp(y2*Math.PI/180))-90},panBy:function(offset){var point=this.centerPoint._add(offset);this.center=this.pointLocation(point)},setLocationAtPoint:function(lnglat,point){var c=this.locationCoordinate(lnglat);var coordAtPoint=this.pointCoordinate(point);var coordCenter=this.pointCoordinate(this.centerPoint);var translate=coordAtPoint._sub(c);this._unmodified=false;this.center=this.coordinateLocation(coordCenter._sub(translate))},locationPoint:function(lnglat){return this.coordinatePoint(this.locationCoordinate(lnglat))},pointLocation:function(p){return this.coordinateLocation(this.pointCoordinate(p))},locationCoordinate:function(lnglat){var k=this.zoomScale(this.tileZoom)/this.worldSize,ll=LngLat.convert(lnglat);return new Coordinate(this.lngX(ll.lng)*k,this.latY(ll.lat)*k,this.tileZoom)},coordinateLocation:function(coord){var worldSize=this.zoomScale(coord.zoom);return new LngLat(this.xLng(coord.column,worldSize),this.yLat(coord.row,worldSize))},pointCoordinate:function(p){var targetZ=0;var coord0=[p.x,p.y,0,1];var coord1=[p.x,p.y,1,1];vec4.transformMat4(coord0,coord0,this.pixelMatrixInverse);vec4.transformMat4(coord1,coord1,this.pixelMatrixInverse);var w0=coord0[3];var w1=coord1[3];var x0=coord0[0]/w0;var x1=coord1[0]/w1;var y0=coord0[1]/w0;var y1=coord1[1]/w1;var z0=coord0[2]/w0;var z1=coord1[2]/w1;var t=z0===z1?0:(targetZ-z0)/(z1-z0);var scale=this.worldSize/this.zoomScale(this.tileZoom);return new Coordinate(interp(x0,x1,t)/scale,interp(y0,y1,t)/scale,this.tileZoom)},coordinatePoint:function(coord){var scale=this.worldSize/this.zoomScale(coord.zoom);var p=[coord.column*scale,coord.row*scale,0,1];vec4.transformMat4(p,p,this.pixelMatrix);return new Point(p[0]/p[3],p[1]/p[3])},calculatePosMatrix:function(coord,maxZoom){if(maxZoom===undefined)maxZoom=Infinity;if(coord instanceof TileCoord)coord=coord.toCoordinate(maxZoom);var z=Math.min(coord.zoom,maxZoom);var scale=this.worldSize/Math.pow(2,z);var posMatrix=new Float64Array(16);mat4.identity(posMatrix);mat4.translate(posMatrix,posMatrix,[coord.column*scale,coord.row*scale,0]);mat4.scale(posMatrix,posMatrix,[scale/EXTENT,scale/EXTENT,1]);mat4.multiply(posMatrix,this.projMatrix,posMatrix);return new Float32Array(posMatrix)},_constrain:function(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=true;var minY,maxY,minX,maxX,sy,sx,x2,y2,size=this.size,unmodified=this._unmodified;if(this.latRange){minY=this.latY(this.latRange[1]);maxY=this.latY(this.latRange[0]);sy=maxY-minY<size.y?size.y/(maxY-minY):0}if(this.lngRange){minX=this.lngX(this.lngRange[0]);maxX=this.lngX(this.lngRange[1]);sx=maxX-minX<size.x?size.x/(maxX-minX):0}var s=Math.max(sx||0,sy||0);if(s){this.center=this.unproject(new Point(sx?(maxX+minX)/2:this.x,sy?(maxY+minY)/2:this.y));this.zoom+=this.scaleZoom(s);this._unmodified=unmodified;this._constraining=false;return}if(this.latRange){var y=this.y,h2=size.y/2;if(y-h2<minY)y2=minY+h2;if(y+h2>maxY)y2=maxY-h2}if(this.lngRange){var x=this.x,w2=size.x/2;if(x-w2<minX)x2=minX+w2;if(x+w2>maxX)x2=maxX-w2}if(x2!==undefined||y2!==undefined){this.center=this.unproject(new Point(x2!==undefined?x2:this.x,y2!==undefined?y2:this.y))}this._unmodified=unmodified;this._constraining=false},_calcMatrices:function(){if(!this.height)return;var halfFov=Math.atan(.5/this.altitude);var topHalfSurfaceDistance=Math.sin(halfFov)*this.altitude/Math.sin(Math.PI/2-this._pitch-halfFov);var farZ=Math.cos(Math.PI/2-this._pitch)*topHalfSurfaceDistance+this.altitude;var m=new Float64Array(16);mat4.perspective(m,2*Math.atan(this.height/2/this.altitude),this.width/this.height,.1,farZ);mat4.translate(m,m,[0,0,-this.altitude]);mat4.scale(m,m,[1,-1,1/this.height]);mat4.rotateX(m,m,this._pitch);mat4.rotateZ(m,m,this.angle);mat4.translate(m,m,[-this.x,-this.y,0]);this.projMatrix=m;m=mat4.create();mat4.scale(m,m,[this.width/2,-this.height/2,1]);mat4.translate(m,m,[1,-1,0]);this.pixelMatrix=mat4.multiply(new Float64Array(16),m,this.projMatrix);m=mat4.invert(new Float64Array(16),this.pixelMatrix);if(!m)throw new Error("failed to invert matrix");this.pixelMatrixInverse=m;m=mat2.create();mat2.scale(m,m,[1,Math.cos(this._pitch)]);mat2.rotate(m,m,this.angle);this.lineAntialiasingMatrix=m;var topedgelength=Math.sqrt(this.height*this.height/4*(1+this.altitude*this.altitude));this.lineStretch=(topedgelength+this.height/2*Math.tan(this._pitch))/topedgelength-1}}},{"../data/bucket":17,"../source/tile_coord":61,"../util/interpolate":131,"../util/util":137,"./coordinate":27,"./lng_lat":28,"gl-matrix":154,"point-geometry":196}],31:[function(require,module,exports){"use strict";var WorkerPool=require("./util/worker_pool");var globalWorkerPool;module.exports=function getGlobalWorkerPool(){if(!globalWorkerPool){globalWorkerPool=new WorkerPool}return globalWorkerPool}},{"./util/worker_pool":139}],32:[function(require,module,exports){"use strict";var simplexFont={" ":[16,[]],"!":[10,[5,21,5,7,-1,-1,5,2,4,1,5,0,6,1,5,2]],'"':[16,[4,21,4,14,-1,-1,12,21,12,14]],"#":[21,[11,25,4,-7,-1,-1,17,25,10,-7,-1,-1,4,12,18,12,-1,-1,3,6,17,6]],$:[20,[8,25,8,-4,-1,-1,12,25,12,-4,-1,-1,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]],"%":[24,[21,21,3,0,-1,-1,8,21,10,19,10,17,9,15,7,14,5,14,3,16,3,18,4,20,6,21,8,21,10,20,13,19,16,19,19,20,21,21,-1,-1,17,7,15,6,14,4,14,2,16,0,18,0,20,1,21,3,21,5,19,7,17,7]],"&":[26,[23,12,23,13,22,14,21,14,20,13,19,11,17,6,15,3,13,1,11,0,7,0,5,1,4,2,3,4,3,6,4,8,5,9,12,13,13,14,14,16,14,18,13,20,11,21,9,20,8,18,8,16,9,13,11,10,16,3,18,1,20,0,22,0,23,1,23,2]],"'":[10,[5,19,4,20,5,21,6,20,6,18,5,16,4,15]],"(":[14,[11,25,9,23,7,20,5,16,4,11,4,7,5,2,7,-2,9,-5,11,-7]],")":[14,[3,25,5,23,7,20,9,16,10,11,10,7,9,2,7,-2,5,-5,3,-7]],"*":[16,[8,21,8,9,-1,-1,3,18,13,12,-1,-1,13,18,3,12]],"+":[26,[13,18,13,0,-1,-1,4,9,22,9]],",":[10,[6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4]],"-":[26,[4,9,22,9]],".":[10,[5,2,4,1,5,0,6,1,5,2]],"/":[22,[20,25,2,-7]],0:[20,[9,21,6,20,4,17,3,12,3,9,4,4,6,1,9,0,11,0,14,1,16,4,17,9,17,12,16,17,14,20,11,21,9,21]],1:[20,[6,17,8,18,11,21,11,0]],2:[20,[4,16,4,17,5,19,6,20,8,21,12,21,14,20,15,19,16,17,16,15,15,13,13,10,3,0,17,0]],3:[20,[5,21,16,21,10,13,13,13,15,12,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4]],4:[20,[13,21,3,7,18,7,-1,-1,13,21,13,0]],5:[20,[15,21,5,21,4,12,5,13,8,14,11,14,14,13,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4]],6:[20,[16,18,15,20,12,21,10,21,7,20,5,17,4,12,4,7,5,3,7,1,10,0,11,0,14,1,16,3,17,6,17,7,16,10,14,12,11,13,10,13,7,12,5,10,4,7]],7:[20,[17,21,7,0,-1,-1,3,21,17,21]],8:[20,[8,21,5,20,4,18,4,16,5,14,7,13,11,12,14,11,16,9,17,7,17,4,16,2,15,1,12,0,8,0,5,1,4,2,3,4,3,7,4,9,6,11,9,12,13,13,15,14,16,16,16,18,15,20,12,21,8,21]],9:[20,[16,14,15,11,13,9,10,8,9,8,6,9,4,11,3,14,3,15,4,18,6,20,9,21,10,21,13,20,15,18,16,14,16,9,15,4,13,1,10,0,8,0,5,1,4,3]],":":[10,[5,14,4,13,5,12,6,13,5,14,-1,-1,5,2,4,1,5,0,6,1,5,2]],";":[10,[5,14,4,13,5,12,6,13,5,14,-1,-1,6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4]],"<":[24,[20,18,4,9,20,0]],"=":[26,[4,12,22,12,-1,-1,4,6,22,6]],">":[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]]};module.exports=function textVertices(text,left,baseline,scale){scale=scale||1;var strokes=[],i,len,j,len2,glyph,x,y,prev;for(i=0,len=text.length;i<len;i++){glyph=simplexFont[text[i]];if(!glyph)continue;prev=null;for(j=0,len2=glyph[1].length;j<len2;j+=2){if(glyph[1][j]===-1&&glyph[1][j+1]===-1){prev=null}else{x=left+glyph[1][j]*scale;y=baseline-glyph[1][j+1]*scale;if(prev){strokes.push(prev.x,prev.y,x,y)}prev={x:x,y:y}}}left+=glyph[0]*scale}return strokes}},{}],33:[function(require,module,exports){"use strict";var browser=require("./util/browser");var mapboxgl=module.exports={};mapboxgl.version=require("../package.json").version;mapboxgl.workerCount=Math.max(browser.hardwareConcurrency-1,1);mapboxgl.Map=require("./ui/map");mapboxgl.Control=require("./ui/control/control");mapboxgl.NavigationControl=require("./ui/control/navigation_control");mapboxgl.GeolocateControl=require("./ui/control/geolocate_control");mapboxgl.AttributionControl=require("./ui/control/attribution_control");mapboxgl.ScaleControl=require("./ui/control/scale_control");mapboxgl.Popup=require("./ui/popup");mapboxgl.Marker=require("./ui/marker");mapboxgl.Style=require("./style/style");mapboxgl.LngLat=require("./geo/lng_lat");mapboxgl.LngLatBounds=require("./geo/lng_lat_bounds");mapboxgl.Point=require("point-geometry");mapboxgl.Evented=require("./util/evented");mapboxgl.util=require("./util/util");mapboxgl.supported=require("./util/browser").supported;var ajax=require("./util/ajax");mapboxgl.util.getJSON=ajax.getJSON;mapboxgl.util.getArrayBuffer=ajax.getArrayBuffer;var config=require("./util/config");mapboxgl.config=config;Object.defineProperty(mapboxgl,"accessToken",{get:function(){return config.ACCESS_TOKEN},set:function(token){config.ACCESS_TOKEN=token}})},{"../package.json":215,"./geo/lng_lat":28,"./geo/lng_lat_bounds":29,"./style/style":71,"./ui/control/attribution_control":102,"./ui/control/control":103,"./ui/control/geolocate_control":104,"./ui/control/navigation_control":105,"./ui/control/scale_control":106,"./ui/map":115,"./ui/marker":116,"./ui/popup":117,"./util/ajax":119,"./util/browser":120,"./util/config":124,"./util/evented":128,"./util/util":137,"point-geometry":196}],34:[function(require,module,exports){"use strict";module.exports=function(uniforms){var pragmas={define:{},initialize:{}};for(var i=0;i<uniforms.length;i++){var uniform=uniforms[i];var type="{precision} "+(uniform.components===1?"float":"vec"+uniform.components);pragmas.define[uniform.name.slice(2)]="uniform "+type+" "+uniform.name+";\n";pragmas.initialize[uniform.name.slice(2)]=type+" "+uniform.name.slice(2)+" = "+uniform.name+";\n"}return pragmas}},{}],35:[function(require,module,exports){"use strict";var pixelsToTileUnits=require("../source/pixels_to_tile_units");var createUniformPragmas=require("./create_uniform_pragmas");var tileSize=512;module.exports=drawBackground;function drawBackground(painter,sourceCache,layer){var gl=painter.gl;var transform=painter.transform;var color=layer.paint["background-color"];var image=layer.paint["background-pattern"];var opacity=layer.paint["background-opacity"];var program;var imagePosA=image?painter.spriteAtlas.getPosition(image.from,true):null;var imagePosB=image?painter.spriteAtlas.getPosition(image.to,true):null;painter.setDepthSublayer(0);if(imagePosA&&imagePosB){if(painter.isOpaquePass)return;program=painter.useProgram("fillPattern");gl.uniform1i(program.u_image,0);gl.uniform2fv(program.u_pattern_tl_a,imagePosA.tl);gl.uniform2fv(program.u_pattern_br_a,imagePosA.br);gl.uniform2fv(program.u_pattern_tl_b,imagePosB.tl);gl.uniform2fv(program.u_pattern_br_b,imagePosB.br);gl.uniform1f(program.u_opacity,opacity);gl.uniform1f(program.u_mix,image.t);gl.uniform2fv(program.u_pattern_size_a,imagePosA.size);gl.uniform2fv(program.u_pattern_size_b,imagePosB.size);gl.uniform1f(program.u_scale_a,image.fromScale);gl.uniform1f(program.u_scale_b,image.toScale);gl.activeTexture(gl.TEXTURE0);painter.spriteAtlas.bind(gl,true);painter.tileExtentPatternVAO.bind(gl,program,painter.tileExtentBuffer)}else{if(painter.isOpaquePass!==(color[3]===1))return;var pragmas=createUniformPragmas([{name:"u_color",components:4},{name:"u_opacity",components:1}]);program=painter.useProgram("fill",[],pragmas,pragmas);gl.uniform4fv(program.u_color,color);gl.uniform1f(program.u_opacity,opacity);painter.tileExtentVAO.bind(gl,program,painter.tileExtentBuffer)}gl.disable(gl.STENCIL_TEST);var coords=transform.coveringTiles({tileSize:tileSize});for(var c=0;c<coords.length;c++){var coord=coords[c];if(imagePosA&&imagePosB){var tile={coord:coord,tileSize:tileSize};gl.uniform1f(program.u_tile_units_to_pixels,1/pixelsToTileUnits(tile,1,painter.transform.tileZoom));var tileSizeAtNearestZoom=tile.tileSize*Math.pow(2,painter.transform.tileZoom-tile.coord.z);var pixelX=tileSizeAtNearestZoom*(tile.coord.x+coord.w*Math.pow(2,tile.coord.z));var pixelY=tileSizeAtNearestZoom*tile.coord.y;gl.uniform2f(program.u_pixel_coord_upper,pixelX>>16,pixelY>>16);gl.uniform2f(program.u_pixel_coord_lower,pixelX&65535,pixelY&65535)}gl.uniformMatrix4fv(program.u_matrix,false,painter.transform.calculatePosMatrix(coord));gl.drawArrays(gl.TRIANGLE_STRIP,0,painter.tileExtentBuffer.length)}gl.stencilMask(0);gl.stencilFunc(gl.EQUAL,128,128)}},{"../source/pixels_to_tile_units":55,"./create_uniform_pragmas":34}],36:[function(require,module,exports){"use strict";var browser=require("../util/browser");module.exports=drawCircles;function drawCircles(painter,sourceCache,layer,coords){if(painter.isOpaquePass)return;var gl=painter.gl;painter.setDepthSublayer(0);painter.depthMask(false);gl.disable(gl.STENCIL_TEST);for(var i=0;i<coords.length;i++){var coord=coords[i];var tile=sourceCache.getTile(coord);var bucket=tile.getBucket(layer);if(!bucket)continue;var bufferGroups=bucket.bufferGroups.circle;if(!bufferGroups)continue;var programOptions=bucket.paintAttributes.circle[layer.id];var program=painter.useProgram("circle",programOptions.defines,programOptions.vertexPragmas,programOptions.fragmentPragmas);if(layer.paint["circle-pitch-scale"]==="map"){gl.uniform1i(program.u_scale_with_map,true);gl.uniform2f(program.u_extrude_scale,painter.transform.pixelsToGLUnits[0]*painter.transform.altitude,painter.transform.pixelsToGLUnits[1]*painter.transform.altitude)}else{gl.uniform1i(program.u_scale_with_map,false);gl.uniform2fv(program.u_extrude_scale,painter.transform.pixelsToGLUnits)}gl.uniform1f(program.u_devicepixelratio,browser.devicePixelRatio);gl.uniformMatrix4fv(program.u_matrix,false,painter.translatePosMatrix(coord.posMatrix,tile,layer.paint["circle-translate"],layer.paint["circle-translate-anchor"]));bucket.setUniforms(gl,"circle",program,layer,{zoom:painter.transform.zoom});for(var k=0;k<bufferGroups.length;k++){var group=bufferGroups[k];group.vaos[layer.id].bind(gl,program,group.layoutVertexBuffer,group.elementBuffer,group.paintVertexBuffers[layer.id]);gl.drawElements(gl.TRIANGLES,group.elementBuffer.length*3,gl.UNSIGNED_SHORT,0)}}}},{"../util/browser":120}],37:[function(require,module,exports){"use strict";module.exports=drawCollisionDebug;function drawCollisionDebug(painter,sourceCache,layer,coords){var gl=painter.gl;gl.enable(gl.STENCIL_TEST);var program=painter.useProgram("collisionBox");for(var i=0;i<coords.length;i++){var coord=coords[i];var tile=sourceCache.getTile(coord);var bucket=tile.getBucket(layer);if(!bucket)continue;var bufferGroups=bucket.bufferGroups.collisionBox;if(!bufferGroups||!bufferGroups.length)continue;var group=bufferGroups[0];if(group.layoutVertexBuffer.length===0)continue;gl.uniformMatrix4fv(program.u_matrix,false,coord.posMatrix);painter.enableTileClippingMask(coord);painter.lineWidth(1);gl.uniform1f(program.u_scale,Math.pow(2,painter.transform.zoom-tile.coord.z));gl.uniform1f(program.u_zoom,painter.transform.zoom*10);gl.uniform1f(program.u_maxzoom,(tile.coord.z+1)*10);group.vaos[layer.id].bind(gl,program,group.layoutVertexBuffer);gl.drawArrays(gl.LINES,0,group.layoutVertexBuffer.length)}}},{}],38:[function(require,module,exports){"use strict";var textVertices=require("../lib/debugtext");var browser=require("../util/browser");var mat4=require("gl-matrix").mat4;var EXTENT=require("../data/bucket").EXTENT;var Buffer=require("../data/buffer");var VertexArrayObject=require("./vertex_array_object");module.exports=drawDebug;function drawDebug(painter,sourceCache,coords){if(painter.isOpaquePass)return;if(!painter.options.debug)return;for(var i=0;i<coords.length;i++){drawDebugTile(painter,sourceCache,coords[i])}}function drawDebugTile(painter,sourceCache,coord){var gl=painter.gl;gl.disable(gl.STENCIL_TEST);painter.lineWidth(1*browser.devicePixelRatio);var posMatrix=coord.posMatrix;var program=painter.useProgram("debug");gl.uniformMatrix4fv(program.u_matrix,false,posMatrix);gl.uniform4f(program.u_color,1,0,0,1);painter.debugVAO.bind(gl,program,painter.debugBuffer);gl.drawArrays(gl.LINE_STRIP,0,painter.debugBuffer.length);var vertices=textVertices(coord.toString(),50,200,5);var debugTextArray=new painter.PosArray;for(var v=0;v<vertices.length;v+=2){debugTextArray.emplaceBack(vertices[v],vertices[v+1])}var debugTextBuffer=new Buffer(debugTextArray.serialize(),painter.PosArray.serialize(),Buffer.BufferType.VERTEX);var debugTextVAO=new VertexArrayObject;debugTextVAO.bind(gl,program,debugTextBuffer);gl.uniform4f(program.u_color,1,1,1,1);var tileSize=sourceCache.getTile(coord).tileSize;var onePixel=EXTENT/(Math.pow(2,painter.transform.zoom-coord.z)*tileSize);var translations=[[-1,-1],[-1,1],[1,-1],[1,1]];for(var i=0;i<translations.length;i++){var translation=translations[i];gl.uniformMatrix4fv(program.u_matrix,false,mat4.translate([],posMatrix,[onePixel*translation[0],onePixel*translation[1],0]));gl.drawArrays(gl.LINES,0,debugTextBuffer.length)}gl.uniform4f(program.u_color,0,0,0,1);gl.uniformMatrix4fv(program.u_matrix,false,posMatrix);gl.drawArrays(gl.LINES,0,debugTextBuffer.length)}},{"../data/bucket":17,"../data/buffer":23,"../lib/debugtext":32,"../util/browser":120,"./vertex_array_object":49,"gl-matrix":154}],39:[function(require,module,exports){"use strict";var mat3=require("gl-matrix").mat3;var mat4=require("gl-matrix").mat4;var vec3=require("gl-matrix").vec3;var Buffer=require("../data/buffer");var VertexArrayObject=require("./vertex_array_object");var StructArrayType=require("../util/struct_array");var setPattern=require("./set_pattern");module.exports=draw;function draw(painter,source,layer,coords){if(layer.paint["fill-opacity"]===0)return;var gl=painter.gl;gl.disable(gl.STENCIL_TEST);painter.depthMask(true);var texture=new ExtrusionTexture(gl,painter,layer);texture.bindFramebuffer();gl.clear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT);for(var i=0;i<coords.length;i++){drawExtrusion(painter,source,layer,coords[i])}texture.unbindFramebuffer();texture.renderToMap()}function ExtrusionTexture(gl,painter,layer){this.gl=gl;this.width=painter.width;this.height=painter.height;this.painter=painter;this.layer=layer;this.texture=null;this.fbo=null;this.fbos=this.painter.preFbos[this.width]&&this.painter.preFbos[this.width][this.height]}ExtrusionTexture.prototype.bindFramebuffer=function(){var gl=this.gl;this.texture=this.painter.getViewportTexture(this.width,this.height);gl.activeTexture(gl.TEXTURE1);if(!this.texture){this.texture=gl.createTexture();gl.bindTexture(gl.TEXTURE_2D,this.texture);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.LINEAR);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.LINEAR);gl.texImage2D(gl.TEXTURE_2D,0,gl.RGBA,this.width,this.height,0,gl.RGBA,gl.UNSIGNED_BYTE,null);this.texture.width=this.width;this.texture.height=this.height}else{gl.bindTexture(gl.TEXTURE_2D,this.texture)}if(!this.fbos){this.fbo=gl.createFramebuffer();var stencil=gl.createRenderbuffer();var depthRenderBuffer=gl.createRenderbuffer();gl.bindRenderbuffer(gl.RENDERBUFFER,stencil);gl.bindRenderbuffer(gl.RENDERBUFFER,depthRenderBuffer);gl.renderbufferStorage(gl.RENDERBUFFER,gl.RGBA4,this.width,this.height);gl.renderbufferStorage(gl.RENDERBUFFER,gl.DEPTH_COMPONENT16,this.width,this.height);gl.bindFramebuffer(gl.FRAMEBUFFER,this.fbo);gl.framebufferRenderbuffer(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.RENDERBUFFER,stencil);gl.framebufferRenderbuffer(gl.FRAMEBUFFER,gl.DEPTH_ATTACHMENT,gl.RENDERBUFFER,depthRenderBuffer);gl.framebufferTexture2D(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.TEXTURE_2D,this.texture,0)}else{this.fbo=this.fbos.pop();gl.bindFramebuffer(gl.FRAMEBUFFER,this.fbo);gl.framebufferTexture2D(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.TEXTURE_2D,this.texture,0)}};ExtrusionTexture.prototype.unbindFramebuffer=function(){this.painter.bindDefaultFramebuffer();if(this.fbos){this.fbos.push(this.fbo)}else{if(!this.painter.preFbos[this.width])this.painter.preFbos[this.width]={};this.painter.preFbos[this.width][this.height]=[this.fbo]}this.painter.saveViewportTexture(this.texture)};ExtrusionTexture.prototype.TextureBoundsArray=new StructArrayType({members:[{name:"a_pos",type:"Int16",components:2}]});ExtrusionTexture.prototype.renderToMap=function(){var gl=this.gl;var painter=this.painter;var program=painter.useProgram("fillExtrudeTexture");gl.activeTexture(gl.TEXTURE0);gl.bindTexture(gl.TEXTURE_2D,this.texture);gl.uniform1f(program.u_opacity,this.layer.paint["fill-opacity"]);gl.uniform1i(program.u_texture,1);gl.uniformMatrix4fv(program.u_matrix,false,mat4.ortho(mat4.create(),0,painter.width,painter.height,0,0,1));gl.disable(gl.DEPTH_TEST);gl.uniform1i(program.u_xdim,painter.width);gl.uniform1i(program.u_ydim,painter.height);var array=new this.TextureBoundsArray;array.emplaceBack(0,0);array.emplaceBack(painter.width,0);array.emplaceBack(0,painter.height);array.emplaceBack(painter.width,painter.height);var buffer=new Buffer(array.serialize(),this.TextureBoundsArray.serialize(),Buffer.BufferType.VERTEX);
var vao=new VertexArrayObject;vao.bind(gl,program,buffer);gl.drawArrays(gl.TRIANGLE_STRIP,0,4);gl.enable(gl.DEPTH_TEST)};function drawExtrusion(painter,source,layer,coord){var tile=source.getTile(coord);var bucket=tile.getBucket(layer);if(!bucket)return;var bufferGroups=bucket.bufferGroups.fillextrusion;if(!bufferGroups)return;if(painter.isOpaquePass)return;var gl=painter.gl;var image=layer.paint["fill-pattern"];var programOptions=bucket.paintAttributes.fillextrusion[layer.id];var program=painter.useProgram(image?"fillExtrudePattern":"fillExtrude",programOptions.defines,programOptions.vertexPragmas,programOptions.fragmentPragmas);if(image){setPattern(image,tile,coord,painter,program,true)}setMatrix(program,painter,coord,tile,layer);setLight(program,painter);bucket.setUniforms(gl,"fillextrusion",program,layer,{zoom:painter.transform.zoom});for(var i=0;i<bufferGroups.length;i++){var group=bufferGroups[i];group.vaos[layer.id].bind(gl,program,group.layoutVertexBuffer,group.elementBuffer,group.paintVertexBuffers[layer.id]);gl.drawElements(gl.TRIANGLES,group.elementBuffer.length*3,gl.UNSIGNED_SHORT,0)}}function setMatrix(program,painter,coord,tile,layer){var zScale=Math.pow(2,painter.transform.zoom)/5e4;painter.gl.uniformMatrix4fv(program.u_matrix,false,mat4.scale(mat4.create(),painter.translatePosMatrix(coord.posMatrix,tile,layer.paint["fill-translate"],layer.paint["fill-translate-anchor"]),[1,1,zScale,1]))}function setLight(program,painter){var gl=painter.gl;var light=painter.style.light;var _lp=light.calculated.position,lightPos=[_lp.x,_lp.y,_lp.z];var lightMat=mat3.create();if(light.calculated.anchor==="viewport")mat3.fromRotation(lightMat,-painter.transform.angle);vec3.transformMat3(lightPos,lightPos,lightMat);gl.uniform3fv(program.u_lightpos,lightPos);gl.uniform1f(program.u_lightintensity,light.calculated.intensity);gl.uniform3fv(program.u_lightcolor,light.calculated.color.slice(0,3))}},{"../data/buffer":23,"../util/struct_array":135,"./set_pattern":48,"./vertex_array_object":49,"gl-matrix":154}],40:[function(require,module,exports){"use strict";var setPattern=require("./set_pattern");module.exports=draw;function draw(painter,sourceCache,layer,coords){var gl=painter.gl;gl.enable(gl.STENCIL_TEST);var isOpaque=!layer.paint["fill-pattern"]&&layer.isPaintValueFeatureConstant("fill-color")&&layer.isPaintValueFeatureConstant("fill-opacity")&&layer.paint["fill-color"][3]===1&&layer.paint["fill-opacity"]===1;if(painter.isOpaquePass===isOpaque){painter.setDepthSublayer(1);for(var i=0;i<coords.length;i++){drawFill(painter,sourceCache,layer,coords[i])}}if(!painter.isOpaquePass&&layer.paint["fill-antialias"]){painter.lineWidth(2);painter.depthMask(false);painter.setDepthSublayer(layer.getPaintProperty("fill-outline-color")?2:0);for(var j=0;j<coords.length;j++){drawStroke(painter,sourceCache,layer,coords[j])}}}function drawFill(painter,sourceCache,layer,coord){var tile=sourceCache.getTile(coord);var bucket=tile.getBucket(layer);if(!bucket)return;var bufferGroups=bucket.bufferGroups.fill;if(!bufferGroups)return;var gl=painter.gl;var image=layer.paint["fill-pattern"];var program;if(!image){var programOptions=bucket.paintAttributes.fill[layer.id];program=painter.useProgram("fill",programOptions.defines,programOptions.vertexPragmas,programOptions.fragmentPragmas);bucket.setUniforms(gl,"fill",program,layer,{zoom:painter.transform.zoom})}else{program=painter.useProgram("fillPattern");setPattern(image,tile,coord,painter,program,false);gl.uniform1f(program.u_opacity,layer.paint["fill-opacity"]);gl.activeTexture(gl.TEXTURE0);painter.spriteAtlas.bind(gl,true)}gl.uniformMatrix4fv(program.u_matrix,false,painter.translatePosMatrix(coord.posMatrix,tile,layer.paint["fill-translate"],layer.paint["fill-translate-anchor"]));painter.enableTileClippingMask(coord);for(var i=0;i<bufferGroups.length;i++){var group=bufferGroups[i];group.vaos[layer.id].bind(gl,program,group.layoutVertexBuffer,group.elementBuffer,group.paintVertexBuffers[layer.id]);gl.drawElements(gl.TRIANGLES,group.elementBuffer.length,gl.UNSIGNED_SHORT,0)}}function drawStroke(painter,sourceCache,layer,coord){var tile=sourceCache.getTile(coord);var bucket=tile.getBucket(layer);if(!bucket)return;var bufferGroups=bucket.bufferGroups.fill;if(!bufferGroups)return;var gl=painter.gl;var image=layer.paint["fill-pattern"];var isOutlineColorDefined=layer.getPaintProperty("fill-outline-color");var program;if(image&&!isOutlineColorDefined){program=painter.useProgram("fillOutlinePattern");gl.uniform2f(program.u_world,gl.drawingBufferWidth,gl.drawingBufferHeight)}else{var programOptions=bucket.paintAttributes.fill[layer.id];program=painter.useProgram("fillOutline",programOptions.defines,programOptions.vertexPragmas,programOptions.fragmentPragmas);gl.uniform2f(program.u_world,gl.drawingBufferWidth,gl.drawingBufferHeight);bucket.setUniforms(gl,"fill",program,layer,{zoom:painter.transform.zoom})}gl.uniform1f(program.u_opacity,layer.paint["fill-opacity"]);gl.uniformMatrix4fv(program.u_matrix,false,painter.translatePosMatrix(coord.posMatrix,tile,layer.paint["fill-translate"],layer.paint["fill-translate-anchor"]));if(image){setPattern(image,tile,coord,painter,program,false)}painter.enableTileClippingMask(coord);for(var k=0;k<bufferGroups.length;k++){var group=bufferGroups[k];group.secondVaos[layer.id].bind(gl,program,group.layoutVertexBuffer,group.elementBuffer2,group.paintVertexBuffers[layer.id]);gl.drawElements(gl.LINES,group.elementBuffer2.length*2,gl.UNSIGNED_SHORT,0)}}},{"./set_pattern":48}],41:[function(require,module,exports){"use strict";var browser=require("../util/browser");var pixelsToTileUnits=require("../source/pixels_to_tile_units");module.exports=function drawLine(painter,sourceCache,layer,coords){if(painter.isOpaquePass)return;painter.setDepthSublayer(0);painter.depthMask(false);var gl=painter.gl;gl.enable(gl.STENCIL_TEST);if(layer.paint["line-width"]<=0)return;for(var k=0;k<coords.length;k++){drawLineTile(painter,sourceCache,layer,coords[k])}};function drawLineTile(painter,sourceCache,layer,coord){var tile=sourceCache.getTile(coord);var bucket=tile.getBucket(layer);if(!bucket)return;var bufferGroups=bucket.bufferGroups.line;if(!bufferGroups)return;var gl=painter.gl;var dasharray=layer.paint["line-dasharray"];var image=layer.paint["line-pattern"];var programOptions=bucket.paintAttributes.line[layer.id];var program=painter.useProgram(dasharray?"lineSDF":image?"linePattern":"line",programOptions.defines,programOptions.vertexPragmas,programOptions.fragmentPragmas);if(!image){gl.uniform4fv(program.u_color,layer.paint["line-color"])}var posA,posB,imagePosA,imagePosB;if(dasharray){posA=painter.lineAtlas.getDash(dasharray.from,layer.layout["line-cap"]==="round");posB=painter.lineAtlas.getDash(dasharray.to,layer.layout["line-cap"]==="round");gl.uniform1i(program.u_image,0);gl.activeTexture(gl.TEXTURE0);painter.lineAtlas.bind(gl);gl.uniform1f(program.u_tex_y_a,posA.y);gl.uniform1f(program.u_tex_y_b,posB.y);gl.uniform1f(program.u_mix,dasharray.t)}else if(image){imagePosA=painter.spriteAtlas.getPosition(image.from,true);imagePosB=painter.spriteAtlas.getPosition(image.to,true);if(!imagePosA||!imagePosB)return;gl.uniform1i(program.u_image,0);gl.activeTexture(gl.TEXTURE0);painter.spriteAtlas.bind(gl,true);gl.uniform2fv(program.u_pattern_tl_a,imagePosA.tl);gl.uniform2fv(program.u_pattern_br_a,imagePosA.br);gl.uniform2fv(program.u_pattern_tl_b,imagePosB.tl);gl.uniform2fv(program.u_pattern_br_b,imagePosB.br);gl.uniform1f(program.u_fade,image.t)}var antialiasing=1/browser.devicePixelRatio;gl.uniform1f(program.u_linewidth,layer.paint["line-width"]/2);gl.uniform1f(program.u_gapwidth,layer.paint["line-gap-width"]/2);gl.uniform1f(program.u_antialiasing,antialiasing/2);gl.uniform1f(program.u_blur,layer.paint["line-blur"]+antialiasing);gl.uniform1f(program.u_opacity,layer.paint["line-opacity"]);gl.uniformMatrix2fv(program.u_antialiasingmatrix,false,painter.transform.lineAntialiasingMatrix);gl.uniform1f(program.u_offset,-layer.paint["line-offset"]);gl.uniform1f(program.u_extra,painter.transform.lineStretch);painter.enableTileClippingMask(coord);var posMatrix=painter.translatePosMatrix(coord.posMatrix,tile,layer.paint["line-translate"],layer.paint["line-translate-anchor"]);gl.uniformMatrix4fv(program.u_matrix,false,posMatrix);if(dasharray){var widthA=posA.width*dasharray.fromScale;var widthB=posB.width*dasharray.toScale;var scaleA=[1/pixelsToTileUnits(tile,widthA,painter.transform.tileZoom),-posA.height/2];var scaleB=[1/pixelsToTileUnits(tile,widthB,painter.transform.tileZoom),-posB.height/2];var gamma=painter.lineAtlas.width/(Math.min(widthA,widthB)*256*browser.devicePixelRatio)/2;gl.uniform2fv(program.u_patternscale_a,scaleA);gl.uniform2fv(program.u_patternscale_b,scaleB);gl.uniform1f(program.u_sdfgamma,gamma)}else if(image){gl.uniform2fv(program.u_pattern_size_a,[pixelsToTileUnits(tile,imagePosA.size[0]*image.fromScale,painter.transform.tileZoom),imagePosB.size[1]]);gl.uniform2fv(program.u_pattern_size_b,[pixelsToTileUnits(tile,imagePosB.size[0]*image.toScale,painter.transform.tileZoom),imagePosB.size[1]])}gl.uniform1f(program.u_ratio,1/pixelsToTileUnits(tile,1,painter.transform.zoom));bucket.setUniforms(gl,"line",program,layer,{zoom:painter.transform.zoom});for(var i=0;i<bufferGroups.length;i++){var group=bufferGroups[i];group.vaos[layer.id].bind(gl,program,group.layoutVertexBuffer,group.elementBuffer,group.paintVertexBuffers[layer.id]);gl.drawElements(gl.TRIANGLES,group.elementBuffer.length*3,gl.UNSIGNED_SHORT,0)}}},{"../source/pixels_to_tile_units":55,"../util/browser":120}],42:[function(require,module,exports){"use strict";var util=require("../util/util");var StructArrayType=require("../util/struct_array");module.exports=drawRaster;function drawRaster(painter,sourceCache,layer,coords){if(painter.isOpaquePass)return;var gl=painter.gl;gl.enable(gl.DEPTH_TEST);painter.depthMask(true);gl.depthFunc(gl.LESS);var minTileZ=coords.length&&coords[0].z;for(var i=0;i<coords.length;i++){var coord=coords[i];painter.setDepthSublayer(coord.z-minTileZ);drawRasterTile(painter,sourceCache,layer,coord)}gl.depthFunc(gl.LEQUAL)}drawRaster.RasterBoundsArray=new StructArrayType({members:[{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]});function drawRasterTile(painter,sourceCache,layer,coord){var gl=painter.gl;gl.disable(gl.STENCIL_TEST);var tile=sourceCache.getTile(coord);var posMatrix=painter.transform.calculatePosMatrix(coord,sourceCache.getSource().maxzoom);var program=painter.useProgram("raster");gl.uniformMatrix4fv(program.u_matrix,false,posMatrix);gl.uniform1f(program.u_brightness_low,layer.paint["raster-brightness-min"]);gl.uniform1f(program.u_brightness_high,layer.paint["raster-brightness-max"]);gl.uniform1f(program.u_saturation_factor,saturationFactor(layer.paint["raster-saturation"]));gl.uniform1f(program.u_contrast_factor,contrastFactor(layer.paint["raster-contrast"]));gl.uniform3fv(program.u_spin_weights,spinWeights(layer.paint["raster-hue-rotate"]));var parentTile=tile.sourceCache&&tile.sourceCache.findLoadedParent(coord,0,{}),opacities=getOpacities(tile,parentTile,layer,painter.transform);var parentScaleBy,parentTL;gl.activeTexture(gl.TEXTURE0);gl.bindTexture(gl.TEXTURE_2D,tile.texture);gl.activeTexture(gl.TEXTURE1);if(parentTile){gl.bindTexture(gl.TEXTURE_2D,parentTile.texture);parentScaleBy=Math.pow(2,parentTile.coord.z-tile.coord.z);parentTL=[tile.coord.x*parentScaleBy%1,tile.coord.y*parentScaleBy%1]}else{gl.bindTexture(gl.TEXTURE_2D,tile.texture)}gl.uniform2fv(program.u_tl_parent,parentTL||[0,0]);gl.uniform1f(program.u_scale_parent,parentScaleBy||1);gl.uniform1f(program.u_buffer_scale,1);gl.uniform1f(program.u_opacity0,opacities[0]);gl.uniform1f(program.u_opacity1,opacities[1]);gl.uniform1i(program.u_image0,0);gl.uniform1i(program.u_image1,1);var buffer=tile.boundsBuffer||painter.rasterBoundsBuffer;var vao=tile.boundsVAO||painter.rasterBoundsVAO;vao.bind(gl,program,buffer);gl.drawArrays(gl.TRIANGLE_STRIP,0,buffer.length)}function spinWeights(angle){angle*=Math.PI/180;var s=Math.sin(angle);var c=Math.cos(angle);return[(2*c+1)/3,(-Math.sqrt(3)*s-c+1)/3,(Math.sqrt(3)*s-c+1)/3]}function contrastFactor(contrast){return contrast>0?1/(1-contrast):1+contrast}function saturationFactor(saturation){return saturation>0?1-1/(1.001-saturation):-saturation}function getOpacities(tile,parentTile,layer,transform){var opacities=[1,0];var fadeDuration=layer.paint["raster-fade-duration"];if(tile.sourceCache&&fadeDuration>0){var now=Date.now();var sinceTile=(now-tile.timeAdded)/fadeDuration;var sinceParent=parentTile?(now-parentTile.timeAdded)/fadeDuration:-1;var source=tile.sourceCache.getSource();var idealZ=transform.coveringZoomLevel({tileSize:source.tileSize,roundZoom:source.roundZoom});var fadeIn=!parentTile||Math.abs(parentTile.coord.z-idealZ)>Math.abs(tile.coord.z-idealZ);opacities[0]=util.clamp(fadeIn?sinceTile:1-sinceParent,0,1);opacities[1]=parentTile?1-opacities[0]:0}var opacity=layer.paint["raster-opacity"];opacities[0]*=opacity;opacities[1]*=opacity;return opacities}},{"../util/struct_array":135,"../util/util":137}],43:[function(require,module,exports){"use strict";var browser=require("../util/browser");var drawCollisionDebug=require("./draw_collision_debug");var pixelsToTileUnits=require("../source/pixels_to_tile_units");module.exports=drawSymbols;function drawSymbols(painter,sourceCache,layer,coords){if(painter.isOpaquePass)return;var drawAcrossEdges=!(layer.layout["text-allow-overlap"]||layer.layout["icon-allow-overlap"]||layer.layout["text-ignore-placement"]||layer.layout["icon-ignore-placement"]);var gl=painter.gl;if(drawAcrossEdges){gl.disable(gl.STENCIL_TEST)}else{gl.enable(gl.STENCIL_TEST)}drawLayerSymbols(painter,sourceCache,layer,coords,false,layer.paint["icon-translate"],layer.paint["icon-translate-anchor"],layer.layout["icon-rotation-alignment"],layer.layout["icon-rotation-alignment"],layer.layout["icon-size"],layer.paint["icon-halo-width"],layer.paint["icon-halo-color"],layer.paint["icon-halo-blur"],layer.paint["icon-opacity"],layer.paint["icon-color"]);drawLayerSymbols(painter,sourceCache,layer,coords,true,layer.paint["text-translate"],layer.paint["text-translate-anchor"],layer.layout["text-rotation-alignment"],layer.layout["text-pitch-alignment"],layer.layout["text-size"],layer.paint["text-halo-width"],layer.paint["text-halo-color"],layer.paint["text-halo-blur"],layer.paint["text-opacity"],layer.paint["text-color"]);if(sourceCache.map.showCollisionBoxes){drawCollisionDebug(painter,sourceCache,layer,coords)}}function drawLayerSymbols(painter,sourceCache,layer,coords,isText,translate,translateAnchor,rotationAlignment,pitchAlignment,size,haloWidth,haloColor,haloBlur,opacity,color){var gl=painter.gl;painter.setDepthSublayer(0);painter.depthMask(false);if(pitchAlignment==="map"){gl.enable(gl.DEPTH_TEST)}else{gl.disable(gl.DEPTH_TEST)}for(var j=0;j<coords.length;j++){var tile=sourceCache.getTile(coords[j]);var bucket=tile.getBucket(layer);if(!bucket)continue;var bothBufferGroups=bucket.bufferGroups;var bufferGroups=isText?bothBufferGroups.glyph:bothBufferGroups.icon;if(!bufferGroups.length)continue;painter.enableTileClippingMask(coords[j]);drawSymbol(painter,layer,coords[j].posMatrix,tile,bucket,bufferGroups,isText,isText||bucket.sdfIcons,!isText&&bucket.iconsNeedLinear,isText?bucket.adjustedTextSize:bucket.adjustedIconSize,bucket.fontstack,translate,translateAnchor,rotationAlignment,pitchAlignment,size,haloWidth,haloColor,haloBlur,opacity,color)}gl.enable(gl.DEPTH_TEST)}function drawSymbol(painter,layer,posMatrix,tile,bucket,bufferGroups,isText,sdf,iconsNeedLinear,adjustedSize,fontstack,translate,translateAnchor,rotationAlignment,pitchAlignment,size,haloWidth,haloColor,haloBlur,opacity,color){var gl=painter.gl;var tr=painter.transform;var rotateWithMap=rotationAlignment==="map";var pitchWithMap=pitchAlignment==="map";var defaultSize=isText?24:1;var fontScale=size/defaultSize;var extrudeScale,s,gammaScale;if(pitchWithMap){s=pixelsToTileUnits(tile,1,painter.transform.zoom)*fontScale;gammaScale=1/Math.cos(tr._pitch);extrudeScale=[s,s]}else{s=painter.transform.altitude*fontScale;gammaScale=1;extrudeScale=[tr.pixelsToGLUnits[0]*s,tr.pixelsToGLUnits[1]*s]}if(!isText&&!painter.style.sprite.loaded())return;var program=painter.useProgram(sdf?"symbolSDF":"symbolIcon");gl.uniformMatrix4fv(program.u_matrix,false,painter.translatePosMatrix(posMatrix,tile,translate,translateAnchor));gl.uniform1i(program.u_rotate_with_map,rotateWithMap);gl.uniform1i(program.u_pitch_with_map,pitchWithMap);gl.uniform2fv(program.u_extrude_scale,extrudeScale);gl.activeTexture(gl.TEXTURE0);gl.uniform1i(program.u_texture,0);if(isText){var glyphAtlas=fontstack&&painter.glyphSource.getGlyphAtlas(fontstack);if(!glyphAtlas)return;glyphAtlas.updateTexture(gl);gl.uniform2f(program.u_texsize,glyphAtlas.width/4,glyphAtlas.height/4)}else{var mapMoving=painter.options.rotating||painter.options.zooming;var iconScaled=fontScale!==1||browser.devicePixelRatio!==painter.spriteAtlas.pixelRatio||iconsNeedLinear;var iconTransformed=pitchWithMap||painter.transform.pitch;painter.spriteAtlas.bind(gl,sdf||mapMoving||iconScaled||iconTransformed);gl.uniform2f(program.u_texsize,painter.spriteAtlas.width/4,painter.spriteAtlas.height/4)}var zoomAdjust=Math.log(size/adjustedSize)/Math.LN2||0;gl.uniform1f(program.u_zoom,(painter.transform.zoom-zoomAdjust)*10);gl.activeTexture(gl.TEXTURE1);painter.frameHistory.bind(gl);gl.uniform1i(program.u_fadetexture,1);var group;if(sdf){var sdfPx=8;var blurOffset=1.19;var haloOffset=6;var gamma=.105*defaultSize/size/browser.devicePixelRatio;if(haloWidth){gl.uniform1f(program.u_gamma,(haloBlur*blurOffset/fontScale/sdfPx+gamma)*gammaScale);gl.uniform4fv(program.u_color,haloColor);gl.uniform1f(program.u_opacity,opacity);gl.uniform1f(program.u_buffer,(haloOffset-haloWidth/fontScale)/sdfPx);for(var j=0;j<bufferGroups.length;j++){group=bufferGroups[j];group.vaos[layer.id].bind(gl,program,group.layoutVertexBuffer,group.elementBuffer);gl.drawElements(gl.TRIANGLES,group.elementBuffer.length*3,gl.UNSIGNED_SHORT,0)}}gl.uniform1f(program.u_gamma,gamma*gammaScale);gl.uniform4fv(program.u_color,color);gl.uniform1f(program.u_opacity,opacity);gl.uniform1f(program.u_buffer,(256-64)/256);gl.uniform1f(program.u_pitch,tr.pitch/360*2*Math.PI);gl.uniform1f(program.u_bearing,tr.bearing/360*2*Math.PI);gl.uniform1f(program.u_aspect_ratio,tr.width/tr.height);for(var i=0;i<bufferGroups.length;i++){group=bufferGroups[i];group.vaos[layer.id].bind(gl,program,group.layoutVertexBuffer,group.elementBuffer);gl.drawElements(gl.TRIANGLES,group.elementBuffer.length*3,gl.UNSIGNED_SHORT,0)}}else{gl.uniform1f(program.u_opacity,opacity);for(var k=0;k<bufferGroups.length;k++){group=bufferGroups[k];group.vaos[layer.id].bind(gl,program,group.layoutVertexBuffer,group.elementBuffer);gl.drawElements(gl.TRIANGLES,group.elementBuffer.length*3,gl.UNSIGNED_SHORT,0)}}}},{"../source/pixels_to_tile_units":55,"../util/browser":120,"./draw_collision_debug":37}],44:[function(require,module,exports){"use strict";module.exports=FrameHistory;function FrameHistory(){this.changeTimes=new Float64Array(256);this.changeOpacities=new Uint8Array(256);this.opacities=new Uint8ClampedArray(256);this.array=new Uint8Array(this.opacities.buffer);this.fadeDuration=300;this.previousZoom=0;this.firstFrame=true}FrameHistory.prototype.record=function(zoom){var now=Date.now();if(this.firstFrame){now=0;this.firstFrame=false}zoom=Math.floor(zoom*10);var z;if(zoom<this.previousZoom){for(z=zoom+1;z<=this.previousZoom;z++){this.changeTimes[z]=now;this.changeOpacities[z]=this.opacities[z]}}else{for(z=zoom;z>this.previousZoom;z--){this.changeTimes[z]=now;this.changeOpacities[z]=this.opacities[z]}}for(z=0;z<256;z++){var timeSince=now-this.changeTimes[z];var opacityChange=timeSince/this.fadeDuration*255;if(z<=zoom){this.opacities[z]=this.changeOpacities[z]+opacityChange}else{this.opacities[z]=this.changeOpacities[z]-opacityChange}}this.changed=true;this.previousZoom=zoom};FrameHistory.prototype.bind=function(gl){if(!this.texture){this.texture=gl.createTexture();gl.bindTexture(gl.TEXTURE_2D,this.texture);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.NEAREST);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.NEAREST);gl.texImage2D(gl.TEXTURE_2D,0,gl.ALPHA,256,1,0,gl.ALPHA,gl.UNSIGNED_BYTE,this.array)}else{gl.bindTexture(gl.TEXTURE_2D,this.texture);if(this.changed){gl.texSubImage2D(gl.TEXTURE_2D,0,0,0,256,1,gl.ALPHA,gl.UNSIGNED_BYTE,this.array);this.changed=false}}}},{}],45:[function(require,module,exports){"use strict";var util=require("../util/util");module.exports=LineAtlas;function LineAtlas(width,height){this.width=width;this.height=height;this.nextRow=0;this.bytes=4;this.data=new Uint8Array(this.width*this.height*this.bytes);this.positions={}}LineAtlas.prototype.setSprite=function(sprite){this.sprite=sprite};LineAtlas.prototype.getDash=function(dasharray,round){var key=dasharray.join(",")+round;if(!this.positions[key]){this.positions[key]=this.addDash(dasharray,round)}return this.positions[key]};LineAtlas.prototype.addDash=function(dasharray,round){var n=round?7:0;var height=2*n+1;var offset=128;if(this.nextRow+height>this.height){util.warnOnce("LineAtlas out of space");return null}var length=0;for(var i=0;i<dasharray.length;i++){length+=dasharray[i]}var stretch=this.width/length;var halfWidth=stretch/2;var oddLength=dasharray.length%2===1;for(var y=-n;y<=n;y++){var row=this.nextRow+n+y;var index=this.width*row;var left=oddLength?-dasharray[dasharray.length-1]:0;var right=dasharray[0];var partIndex=1;for(var x=0;x<this.width;x++){while(right<x/stretch){left=right;right=right+dasharray[partIndex];if(oddLength&&partIndex===dasharray.length-1){right+=dasharray[0]}partIndex++}var distLeft=Math.abs(x-left*stretch);var distRight=Math.abs(x-right*stretch);var dist=Math.min(distLeft,distRight);var inside=partIndex%2===1;var signedDistance;if(round){var distMiddle=n?y/n*(halfWidth+1):0;if(inside){var distEdge=halfWidth-Math.abs(distMiddle);signedDistance=Math.sqrt(dist*dist+distEdge*distEdge)}else{signedDistance=halfWidth-Math.sqrt(dist*dist+distMiddle*distMiddle)}}else{signedDistance=(inside?1:-1)*dist}this.data[3+(index+x)*4]=Math.max(0,Math.min(255,signedDistance+offset))}}var pos={y:(this.nextRow+n+.5)/this.height,height:2*n/this.height,width:length};this.nextRow+=height;this.dirty=true;return pos};LineAtlas.prototype.bind=function(gl){if(!this.texture){this.texture=gl.createTexture();gl.bindTexture(gl.TEXTURE_2D,this.texture);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.REPEAT);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.REPEAT);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.LINEAR);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.LINEAR);gl.texImage2D(gl.TEXTURE_2D,0,gl.RGBA,this.width,this.height,0,gl.RGBA,gl.UNSIGNED_BYTE,this.data)}else{gl.bindTexture(gl.TEXTURE_2D,this.texture);if(this.dirty){this.dirty=false;gl.texSubImage2D(gl.TEXTURE_2D,0,0,0,this.width,this.height,gl.RGBA,gl.UNSIGNED_BYTE,this.data)}}}},{"../util/util":137}],46:[function(require,module,exports){"use strict";var browser=require("../util/browser");var mat4=require("gl-matrix").mat4;var FrameHistory=require("./frame_history");var SourceCache=require("../source/source_cache");var EXTENT=require("../data/bucket").EXTENT;var pixelsToTileUnits=require("../source/pixels_to_tile_units");var util=require("../util/util");var StructArrayType=require("../util/struct_array");var Buffer=require("../data/buffer");var VertexArrayObject=require("./vertex_array_object");var RasterBoundsArray=require("./draw_raster").RasterBoundsArray;var createUniformPragmas=require("./create_uniform_pragmas");module.exports=Painter;function Painter(gl,transform){this.gl=gl;this.transform=transform;this.reusableTextures={};this.preFbos={};this.frameHistory=new FrameHistory;this.setup();this.numSublayers=SourceCache.maxUnderzooming+SourceCache.maxOverzooming+1;this.depthEpsilon=1/Math.pow(2,16);this.lineWidthRange=gl.getParameter(gl.ALIASED_LINE_WIDTH_RANGE)}util.extend(Painter.prototype,require("./painter/use_program"));Painter.prototype.resize=function(width,height){var gl=this.gl;this.width=width*browser.devicePixelRatio;this.height=height*browser.devicePixelRatio;gl.viewport(0,0,this.width,this.height)};Painter.prototype.setup=function(){var gl=this.gl;gl.verbose=true;gl.enable(gl.BLEND);gl.blendFunc(gl.ONE,gl.ONE_MINUS_SRC_ALPHA);gl.enable(gl.STENCIL_TEST);gl.enable(gl.DEPTH_TEST);gl.depthFunc(gl.LEQUAL);this._depthMask=false;gl.depthMask(false);var PosArray=this.PosArray=new StructArrayType({members:[{name:"a_pos",type:"Int16",components:2}]});var tileExtentArray=new PosArray;tileExtentArray.emplaceBack(0,0);tileExtentArray.emplaceBack(EXTENT,0);tileExtentArray.emplaceBack(0,EXTENT);tileExtentArray.emplaceBack(EXTENT,EXTENT);this.tileExtentBuffer=new Buffer(tileExtentArray.serialize(),PosArray.serialize(),Buffer.BufferType.VERTEX);this.tileExtentVAO=new VertexArrayObject;this.tileExtentPatternVAO=new VertexArrayObject;var debugArray=new PosArray;debugArray.emplaceBack(0,0);debugArray.emplaceBack(EXTENT,0);debugArray.emplaceBack(EXTENT,EXTENT);debugArray.emplaceBack(0,EXTENT);debugArray.emplaceBack(0,0);this.debugBuffer=new Buffer(debugArray.serialize(),PosArray.serialize(),Buffer.BufferType.VERTEX);this.debugVAO=new VertexArrayObject;var rasterBoundsArray=new RasterBoundsArray;rasterBoundsArray.emplaceBack(0,0,0,0);rasterBoundsArray.emplaceBack(EXTENT,0,32767,0);rasterBoundsArray.emplaceBack(0,EXTENT,0,32767);rasterBoundsArray.emplaceBack(EXTENT,EXTENT,32767,32767);this.rasterBoundsBuffer=new Buffer(rasterBoundsArray.serialize(),RasterBoundsArray.serialize(),Buffer.BufferType.VERTEX);this.rasterBoundsVAO=new VertexArrayObject};Painter.prototype.clearColor=function(){var gl=this.gl;gl.clearColor(0,0,0,0);gl.clear(gl.COLOR_BUFFER_BIT)};Painter.prototype.clearStencil=function(){var gl=this.gl;gl.clearStencil(0);gl.stencilMask(255);gl.clear(gl.STENCIL_BUFFER_BIT)};Painter.prototype.clearDepth=function(){var gl=this.gl;gl.clearDepth(1);this.depthMask(true);gl.clear(gl.DEPTH_BUFFER_BIT)};Painter.prototype._renderTileClippingMasks=function(coords){var gl=this.gl;gl.colorMask(false,false,false,false);this.depthMask(false);gl.disable(gl.DEPTH_TEST);gl.enable(gl.STENCIL_TEST);gl.stencilMask(248);gl.stencilOp(gl.KEEP,gl.KEEP,gl.REPLACE);var idNext=1;this._tileClippingMaskIDs={};for(var i=0;i<coords.length;i++){var coord=coords[i];var id=this._tileClippingMaskIDs[coord.id]=idNext++<<3;gl.stencilFunc(gl.ALWAYS,id,248);var pragmas=createUniformPragmas([{name:"u_color",components:4},{name:"u_opacity",components:1}]);var program=this.useProgram("fill",[],pragmas,pragmas);gl.uniformMatrix4fv(program.u_matrix,false,coord.posMatrix);this.tileExtentVAO.bind(gl,program,this.tileExtentBuffer);gl.drawArrays(gl.TRIANGLE_STRIP,0,this.tileExtentBuffer.length)}gl.stencilMask(0);gl.colorMask(true,true,true,true);this.depthMask(true);gl.enable(gl.DEPTH_TEST)};Painter.prototype.enableTileClippingMask=function(coord){var gl=this.gl;gl.stencilFunc(gl.EQUAL,this._tileClippingMaskIDs[coord.id],248)};Painter.prototype.prepareBuffers=function(){};Painter.prototype.bindDefaultFramebuffer=function(){var gl=this.gl;gl.bindFramebuffer(gl.FRAMEBUFFER,null)};var draw={symbol:require("./draw_symbol"),circle:require("./draw_circle"),line:require("./draw_line"),fill:require("./draw_fill"),extrusion:require("./draw_extrusion"),raster:require("./draw_raster"),background:require("./draw_background"),debug:require("./draw_debug")};Painter.prototype.render=function(style,options){this.style=style;this.options=options;this.lineAtlas=style.lineAtlas;this.spriteAtlas=style.spriteAtlas;this.spriteAtlas.setSprite(style.sprite);this.glyphSource=style.glyphSource;this.frameHistory.record(this.transform.zoom);this.prepareBuffers();this.clearColor();this.clearDepth();this.showOverdrawInspector(options.showOverdrawInspector);this.depthRange=(style._order.length+2)*this.numSublayers*this.depthEpsilon;this.renderPass({isOpaquePass:true});this.renderPass({isOpaquePass:false})};Painter.prototype.renderPass=function(options){var groups=this.style._groups;var isOpaquePass=options.isOpaquePass;this.currentLayer=isOpaquePass?this.style._order.length:-1;for(var i=0;i<groups.length;i++){var group=groups[isOpaquePass?groups.length-1-i:i];var sourceCache=this.style.sourceCaches[group.source];var j;var coords=[];if(sourceCache){coords=sourceCache.getVisibleCoordinates();for(j=0;j<coords.length;j++){coords[j].posMatrix=this.transform.calculatePosMatrix(coords[j],sourceCache.getSource().maxzoom)}this.clearStencil();if(sourceCache.prepare)sourceCache.prepare();if(sourceCache.getSource().isTileClipped){this._renderTileClippingMasks(coords)}}if(isOpaquePass){if(!this._showOverdrawInspector){this.gl.disable(this.gl.BLEND)}this.isOpaquePass=true}else{this.gl.enable(this.gl.BLEND);this.isOpaquePass=false;coords.reverse()}for(j=0;j<group.length;j++){var layer=group[isOpaquePass?group.length-1-j:j];this.currentLayer+=isOpaquePass?-1:1;this.renderLayer(this,sourceCache,layer,coords)}if(sourceCache){draw.debug(this,sourceCache,coords)}}};Painter.prototype.depthMask=function(mask){if(mask!==this._depthMask){this._depthMask=mask;this.gl.depthMask(mask)}};Painter.prototype.renderLayer=function(painter,sourceCache,layer,coords){if(layer.isHidden(this.transform.zoom))return;if(layer.type!=="background"&&!coords.length)return;this.id=layer.id;var type=layer.type;if(type==="fill"&&(!layer.isPaintValueFeatureConstant("fill-extrude-height")||!layer.isPaintValueZoomConstant("fill-extrude-height")||layer.getPaintValue("fill-extrude-height")!==0)){type="extrusion"}draw[type](painter,sourceCache,layer,coords)};Painter.prototype.setDepthSublayer=function(n){var farDepth=1-((1+this.currentLayer)*this.numSublayers+n)*this.depthEpsilon;var nearDepth=farDepth-1+this.depthRange;this.gl.depthRange(nearDepth,farDepth)};Painter.prototype.translatePosMatrix=function(matrix,tile,translate,anchor){if(!translate[0]&&!translate[1])return matrix;if(anchor==="viewport"){var sinA=Math.sin(-this.transform.angle);var cosA=Math.cos(-this.transform.angle);translate=[translate[0]*cosA-translate[1]*sinA,translate[0]*sinA+translate[1]*cosA]}var translation=[pixelsToTileUnits(tile,translate[0],this.transform.zoom),pixelsToTileUnits(tile,translate[1],this.transform.zoom),0];var translatedMatrix=new Float32Array(16);mat4.translate(translatedMatrix,matrix,translation);return translatedMatrix};Painter.prototype.saveTileTexture=function(texture){var textures=this.reusableTextures[texture.size];if(!textures){this.reusableTextures[texture.size]=[texture]}else{textures.push(texture)}};Painter.prototype.saveViewportTexture=function(texture){if(!this.reusableTextures.viewport)this.reusableTextures.viewport={};this.reusableTextures.viewport.texture=texture};Painter.prototype.getTileTexture=function(width,height){var widthTextures=this.reusableTextures[width];if(widthTextures){var textures=widthTextures[height||width];return textures&&textures.length>0?textures.pop():null}};Painter.prototype.getViewportTexture=function(width,height){if(!this.reusableTextures.viewport)return;var texture=this.reusableTextures.viewport.texture;if(texture.width===width&&texture.height===height){return texture}else{this.gl.deleteTexture(texture);this.reusableTextures.viewport.texture=null;return}};Painter.prototype.lineWidth=function(width){this.gl.lineWidth(util.clamp(width,this.lineWidthRange[0],this.lineWidthRange[1]))};Painter.prototype.showOverdrawInspector=function(enabled){if(!enabled&&!this._showOverdrawInspector)return;this._showOverdrawInspector=enabled;var gl=this.gl;if(enabled){gl.blendFunc(gl.CONSTANT_COLOR,gl.ONE);var numOverdrawSteps=8;var a=1/numOverdrawSteps;gl.blendColor(a,a,a,0);gl.clearColor(0,0,0,1);gl.clear(gl.COLOR_BUFFER_BIT)}else{gl.blendFunc(gl.ONE,gl.ONE_MINUS_SRC_ALPHA);
}}},{"../data/bucket":17,"../data/buffer":23,"../source/pixels_to_tile_units":55,"../source/source_cache":59,"../util/browser":120,"../util/struct_array":135,"../util/util":137,"./create_uniform_pragmas":34,"./draw_background":35,"./draw_circle":36,"./draw_debug":38,"./draw_extrusion":39,"./draw_fill":40,"./draw_line":41,"./draw_raster":42,"./draw_symbol":43,"./frame_history":44,"./painter/use_program":47,"./vertex_array_object":49,"gl-matrix":154}],47:[function(require,module,exports){"use strict";var util=require("../../util/util");var shaders=require("mapbox-gl-shaders");var utilSource=shaders.util;module.exports._createProgram=function(name,defines,vertexPragmas,fragmentPragmas){var gl=this.gl;var program=gl.createProgram();var definition=shaders[name];var definesSource="#define MAPBOX_GL_JS;\n";for(var j=0;j<defines.length;j++){definesSource+="#define "+defines[j]+";\n"}var fragmentShader=gl.createShader(gl.FRAGMENT_SHADER);gl.shaderSource(fragmentShader,applyPragmas(definesSource+definition.fragmentSource,fragmentPragmas));gl.compileShader(fragmentShader);gl.attachShader(program,fragmentShader);var vertexShader=gl.createShader(gl.VERTEX_SHADER);gl.shaderSource(vertexShader,applyPragmas(definesSource+utilSource+definition.vertexSource,vertexPragmas));gl.compileShader(vertexShader);gl.attachShader(program,vertexShader);gl.linkProgram(program);var attributes={};var numAttributes=gl.getProgramParameter(program,gl.ACTIVE_ATTRIBUTES);for(var i=0;i<numAttributes;i++){var attribute=gl.getActiveAttrib(program,i);attributes[attribute.name]=gl.getAttribLocation(program,attribute.name)}var uniforms={};var numUniforms=gl.getProgramParameter(program,gl.ACTIVE_UNIFORMS);for(var ui=0;ui<numUniforms;ui++){var uniform=gl.getActiveUniform(program,ui);uniforms[uniform.name]=gl.getUniformLocation(program,uniform.name)}return util.extend({program:program,definition:definition,attributes:attributes,numAttributes:numAttributes},attributes,uniforms)};module.exports._createProgramCached=function(name,defines,vertexPragmas,fragmentPragmas){this.cache=this.cache||{};var key=JSON.stringify({name:name,defines:defines,vertexPragmas:vertexPragmas,fragmentPragmas:fragmentPragmas});if(!this.cache[key]){this.cache[key]=this._createProgram(name,defines,vertexPragmas,fragmentPragmas)}return this.cache[key]};module.exports.useProgram=function(nextProgramName,defines,vertexPragmas,fragmentPragmas){var gl=this.gl;defines=defines||[];if(this._showOverdrawInspector){defines=defines.concat("OVERDRAW_INSPECTOR")}var nextProgram=this._createProgramCached(nextProgramName,defines,vertexPragmas,fragmentPragmas);var previousProgram=this.currentProgram;if(previousProgram!==nextProgram){gl.useProgram(nextProgram.program);this.currentProgram=nextProgram}return nextProgram};function applyPragmas(source,pragmas){return source.replace(/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,function(match,operation,precision,type,name){return pragmas[operation][name].replace(/{type}/g,type).replace(/{precision}/g,precision)})}},{"../../util/util":137,"mapbox-gl-shaders":167}],48:[function(require,module,exports){"use strict";var pixelsToTileUnits=require("../source/pixels_to_tile_units");module.exports=setPattern;function setPattern(image,tile,coord,painter,program,includeHeightFactor){var gl=painter.gl;var imagePosA=painter.spriteAtlas.getPosition(image.from,true);var imagePosB=painter.spriteAtlas.getPosition(image.to,true);if(!imagePosA||!imagePosB)return;gl.uniform1i(program.u_image,0);gl.uniform2fv(program.u_pattern_tl_a,imagePosA.tl);gl.uniform2fv(program.u_pattern_br_a,imagePosA.br);gl.uniform2fv(program.u_pattern_tl_b,imagePosB.tl);gl.uniform2fv(program.u_pattern_br_b,imagePosB.br);gl.uniform1f(program.u_mix,image.t);gl.uniform1f(program.u_tile_units_to_pixels,1/pixelsToTileUnits(tile,1,painter.transform.tileZoom));gl.uniform2fv(program.u_pattern_size_a,imagePosA.size);gl.uniform2fv(program.u_pattern_size_b,imagePosB.size);gl.uniform1f(program.u_scale_a,image.fromScale);gl.uniform1f(program.u_scale_b,image.toScale);var tileSizeAtNearestZoom=tile.tileSize*Math.pow(2,painter.transform.tileZoom-tile.coord.z);var pixelX=tileSizeAtNearestZoom*(tile.coord.x+coord.w*Math.pow(2,tile.coord.z));var pixelY=tileSizeAtNearestZoom*tile.coord.y;gl.uniform2f(program.u_pixel_coord_upper,pixelX>>16,pixelY>>16);gl.uniform2f(program.u_pixel_coord_lower,pixelX&65535,pixelY&65535);if(includeHeightFactor){gl.uniform1f(program.u_height_factor,-Math.pow(2,painter.transform.tileZoom)/tileSizeAtNearestZoom>>3)}gl.activeTexture(gl.TEXTURE0);painter.spriteAtlas.bind(gl,true)}},{"../source/pixels_to_tile_units":55}],49:[function(require,module,exports){"use strict";module.exports=VertexArrayObject;function VertexArrayObject(){this.boundProgram=null;this.boundVertexBuffer=null;this.boundVertexBuffer2=null;this.boundElementBuffer=null;this.vao=null}VertexArrayObject.prototype.bind=function(gl,program,layoutVertexBuffer,elementBuffer,vertexBuffer2){if(gl.extVertexArrayObject===undefined){gl.extVertexArrayObject=gl.getExtension("OES_vertex_array_object")}var isFreshBindRequired=!this.vao||this.boundProgram!==program||this.boundVertexBuffer!==layoutVertexBuffer||this.boundVertexBuffer2!==vertexBuffer2||this.boundElementBuffer!==elementBuffer;if(!gl.extVertexArrayObject||isFreshBindRequired){this.freshBind(gl,program,layoutVertexBuffer,elementBuffer,vertexBuffer2);this.gl=gl}else{gl.extVertexArrayObject.bindVertexArrayOES(this.vao)}};VertexArrayObject.prototype.freshBind=function(gl,program,layoutVertexBuffer,elementBuffer,vertexBuffer2){var numPrevAttributes;var numNextAttributes=program.numAttributes;if(gl.extVertexArrayObject){if(this.vao)this.destroy();this.vao=gl.extVertexArrayObject.createVertexArrayOES();gl.extVertexArrayObject.bindVertexArrayOES(this.vao);numPrevAttributes=0;this.boundProgram=program;this.boundVertexBuffer=layoutVertexBuffer;this.boundVertexBuffer2=vertexBuffer2;this.boundElementBuffer=elementBuffer}else{numPrevAttributes=gl.currentNumAttributes||0;for(var i=numNextAttributes;i<numPrevAttributes;i++){gl.disableVertexAttribArray(i)}}for(var j=numPrevAttributes;j<numNextAttributes;j++){gl.enableVertexAttribArray(j)}layoutVertexBuffer.bind(gl);layoutVertexBuffer.setVertexAttribPointers(gl,program);if(vertexBuffer2){vertexBuffer2.bind(gl);vertexBuffer2.setVertexAttribPointers(gl,program)}if(elementBuffer){elementBuffer.bind(gl)}gl.currentNumAttributes=numNextAttributes};VertexArrayObject.prototype.destroy=function(){if(this.vao){this.gl.extVertexArrayObject.deleteVertexArrayOES(this.vao);this.vao=null}}},{}],50:[function(require,module,exports){"use strict";var Evented=require("../util/evented");var util=require("../util/util");var window=require("../util/window");var EXTENT=require("../data/bucket").EXTENT;module.exports=GeoJSONSource;function GeoJSONSource(id,options,dispatcher,eventedParent){options=options||{};this.id=id;this.dispatcher=dispatcher;this._data=options.data;if(options.maxzoom!==undefined)this.maxzoom=options.maxzoom;if(options.type)this.type=options.type;var scale=EXTENT/this.tileSize;this.workerOptions=util.extend({source:this.id,cluster:options.cluster||false,geojsonVtOptions:{buffer:(options.buffer!==undefined?options.buffer:128)*scale,tolerance:(options.tolerance!==undefined?options.tolerance:.375)*scale,extent:EXTENT,maxZoom:this.maxzoom},superclusterOptions:{maxZoom:Math.min(options.clusterMaxZoom,this.maxzoom-1)||this.maxzoom-1,extent:EXTENT,radius:(options.clusterRadius||50)*scale,log:false}},options.workerOptions);this.setEventedParent(eventedParent);this.fire("dataloading",{dataType:"source"});this._updateWorkerData(function done(err){if(err){this.fire("error",{error:err});return}this.fire("data",{dataType:"source"});this.fire("source.load")}.bind(this))}GeoJSONSource.prototype=util.inherit(Evented,{type:"geojson",minzoom:0,maxzoom:18,tileSize:512,isTileClipped:true,reparseOverscaled:true,onAdd:function(map){this.map=map},setData:function(data){this._data=data;this.fire("dataloading",{dataType:"source"});this._updateWorkerData(function(err){if(err){return this.fire("error",{error:err})}this.fire("data",{dataType:"source"})}.bind(this));return this},_updateWorkerData:function(callback){var options=util.extend({},this.workerOptions);var data=this._data;if(typeof data==="string"){options.url=resolveURL(data)}else{options.data=JSON.stringify(data)}this.workerID=this.dispatcher.send(this.type+".loadData",options,function(err){this._loaded=true;callback(err)}.bind(this))},loadTile:function(tile,callback){var overscaling=tile.coord.z>this.maxzoom?Math.pow(2,tile.coord.z-this.maxzoom):1;var params={type:this.type,uid:tile.uid,coord:tile.coord,zoom:tile.coord.z,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,overscaling:overscaling,angle:this.map.transform.angle,pitch:this.map.transform.pitch,showCollisionBoxes:this.map.showCollisionBoxes};tile.workerID=this.dispatcher.send("load tile",params,function(err,data){tile.unloadVectorData();if(tile.aborted)return;if(err){return callback(err)}tile.loadVectorData(data,this.map.painter);if(tile.redoWhenDone){tile.redoWhenDone=false;tile.redoPlacement(this)}return callback(null)}.bind(this),this.workerID)},abortTile:function(tile){tile.aborted=true},unloadTile:function(tile){tile.unloadVectorData();this.dispatcher.send("remove tile",{uid:tile.uid,source:this.id},function(){},tile.workerID)},serialize:function(){return{type:this.type,data:this._data}}});function resolveURL(url){var a=window.document.createElement("a");a.href=url;return a.href}},{"../data/bucket":17,"../util/evented":128,"../util/util":137,"../util/window":122}],51:[function(require,module,exports){"use strict";var util=require("../util/util");var ajax=require("../util/ajax");var rewind=require("geojson-rewind");var GeoJSONWrapper=require("./geojson_wrapper");var vtpbf=require("vt-pbf");var supercluster=require("supercluster");var geojsonvt=require("geojson-vt");var VectorTileWorkerSource=require("./vector_tile_worker_source");module.exports=GeoJSONWorkerSource;function GeoJSONWorkerSource(actor,styleLayers,loadGeoJSON){if(loadGeoJSON){this.loadGeoJSON=loadGeoJSON}VectorTileWorkerSource.call(this,actor,styleLayers)}GeoJSONWorkerSource.prototype=util.inherit(VectorTileWorkerSource,{_geoJSONIndexes:{},loadVectorData:function(params,callback){var source=params.source,coord=params.coord;if(!this._geoJSONIndexes[source]){return callback(null,null)}var geoJSONTile=this._geoJSONIndexes[source].getTile(Math.min(coord.z,params.maxZoom),coord.x,coord.y);if(!geoJSONTile){return callback(null,null)}var geojsonWrapper=new GeoJSONWrapper(geoJSONTile.features);geojsonWrapper.name="_geojsonTileLayer";var pbf=vtpbf({layers:{_geojsonTileLayer:geojsonWrapper}});if(pbf.byteOffset!==0||pbf.byteLength!==pbf.buffer.byteLength){pbf=new Uint8Array(pbf)}geojsonWrapper.rawData=pbf.buffer;callback(null,geojsonWrapper)},loadData:function(params,callback){var handleData=function(err,data){if(err)return callback(err);if(typeof data!="object"){return callback(new Error("Input data is not a valid GeoJSON object."))}rewind(data,true);this._indexData(data,params,function(err,indexed){if(err){return callback(err)}this._geoJSONIndexes[params.source]=indexed;callback(null)}.bind(this))}.bind(this);this.loadGeoJSON(params,handleData)},loadGeoJSON:function(params,callback){if(params.url){ajax.getJSON(params.url,callback)}else if(typeof params.data==="string"){try{return callback(null,JSON.parse(params.data))}catch(e){return callback(new Error("Input data is not a valid GeoJSON object."))}}else{return callback(new Error("Input data is not a valid GeoJSON object."))}},_indexData:function(data,params,callback){try{if(params.cluster){callback(null,supercluster(params.superclusterOptions).load(data.features))}else{callback(null,geojsonvt(data,params.geojsonVtOptions))}}catch(err){return callback(err)}}})},{"../util/ajax":119,"../util/util":137,"./geojson_wrapper":52,"./vector_tile_worker_source":63,"geojson-rewind":143,"geojson-vt":149,supercluster:199,"vt-pbf":210}],52:[function(require,module,exports){"use strict";var Point=require("point-geometry");var VectorTileFeature=require("vector-tile").VectorTileFeature;var EXTENT=require("../data/bucket").EXTENT;module.exports=GeoJSONWrapper;function GeoJSONWrapper(features){this.features=features;this.length=features.length;this.extent=EXTENT}GeoJSONWrapper.prototype.feature=function(i){return new FeatureWrapper(this.features[i])};function FeatureWrapper(feature){this.type=feature.type;if(feature.type===1){this.rawGeometry=[];for(var i=0;i<feature.geometry.length;i++){this.rawGeometry.push([feature.geometry[i]])}}else{this.rawGeometry=feature.geometry}this.properties=feature.tags;this.extent=EXTENT}FeatureWrapper.prototype.loadGeometry=function(){var rings=this.rawGeometry;this.geometry=[];for(var i=0;i<rings.length;i++){var ring=rings[i],newRing=[];for(var j=0;j<ring.length;j++){newRing.push(new Point(ring[j][0],ring[j][1]))}this.geometry.push(newRing)}return this.geometry};FeatureWrapper.prototype.bbox=function(){if(!this.geometry)this.loadGeometry();var rings=this.geometry,x1=Infinity,x2=-Infinity,y1=Infinity,y2=-Infinity;for(var i=0;i<rings.length;i++){var ring=rings[i];for(var j=0;j<ring.length;j++){var coord=ring[j];x1=Math.min(x1,coord.x);x2=Math.max(x2,coord.x);y1=Math.min(y1,coord.y);y2=Math.max(y2,coord.y)}}return[x1,y1,x2,y2]};FeatureWrapper.prototype.toGeoJSON=VectorTileFeature.prototype.toGeoJSON},{"../data/bucket":17,"point-geometry":196,"vector-tile":206}],53:[function(require,module,exports){"use strict";var util=require("../util/util");var TileCoord=require("./tile_coord");var LngLat=require("../geo/lng_lat");var Point=require("point-geometry");var Evented=require("../util/evented");var ajax=require("../util/ajax");var EXTENT=require("../data/bucket").EXTENT;var RasterBoundsArray=require("../render/draw_raster").RasterBoundsArray;var Buffer=require("../data/buffer");var VertexArrayObject=require("../render/vertex_array_object");module.exports=ImageSource;function ImageSource(id,options,dispatcher,eventedParent){this.id=id;this.dispatcher=dispatcher;this.url=options.url;this.coordinates=options.coordinates;this.setEventedParent(eventedParent);this.fire("dataloading",{dataType:"source"});ajax.getImage(options.url,function(err,image){if(err)return this.fire("error",{error:err});this.image=image;this._loaded=true;this.fire("data",{dataType:"source"});this.fire("source.load");if(this.map){this.setCoordinates(options.coordinates)}}.bind(this))}ImageSource.prototype=util.inherit(Evented,{minzoom:0,maxzoom:22,tileSize:512,onAdd:function(map){this.map=map;if(this.image){this.setCoordinates(this.coordinates)}},setCoordinates:function(coordinates){this.coordinates=coordinates;var map=this.map;var cornerZ0Coords=coordinates.map(function(coord){return map.transform.locationCoordinate(LngLat.convert(coord)).zoomTo(0)});var centerCoord=this.centerCoord=util.getCoordinatesCenter(cornerZ0Coords);centerCoord.column=Math.round(centerCoord.column);centerCoord.row=Math.round(centerCoord.row);this.minzoom=this.maxzoom=centerCoord.zoom;this.coord=new TileCoord(centerCoord.zoom,centerCoord.column,centerCoord.row);this._tileCoords=cornerZ0Coords.map(function(coord){var zoomedCoord=coord.zoomTo(centerCoord.zoom);return new Point(Math.round((zoomedCoord.column-centerCoord.column)*EXTENT),Math.round((zoomedCoord.row-centerCoord.row)*EXTENT))});this.fire("data",{dataType:"source"});return this},_setTile:function(tile){this._prepared=false;this.tile=tile;var maxInt16=32767;var array=new RasterBoundsArray;array.emplaceBack(this._tileCoords[0].x,this._tileCoords[0].y,0,0);array.emplaceBack(this._tileCoords[1].x,this._tileCoords[1].y,maxInt16,0);array.emplaceBack(this._tileCoords[3].x,this._tileCoords[3].y,0,maxInt16);array.emplaceBack(this._tileCoords[2].x,this._tileCoords[2].y,maxInt16,maxInt16);this.tile.buckets={};this.tile.boundsBuffer=new Buffer(array.serialize(),RasterBoundsArray.serialize(),Buffer.BufferType.VERTEX);this.tile.boundsVAO=new VertexArrayObject;this.tile.state="loaded"},prepare:function(){if(!this.tile||!this._loaded||!this.image||!this.image.complete)return;this._prepareImage(this.map.painter.gl,this.image)},_prepareImage:function(gl,image){if(!this._prepared){this._prepared=true;this.tile.texture=gl.createTexture();gl.bindTexture(gl.TEXTURE_2D,this.tile.texture);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.LINEAR);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.LINEAR);gl.texImage2D(gl.TEXTURE_2D,0,gl.RGBA,gl.RGBA,gl.UNSIGNED_BYTE,image)}else{gl.bindTexture(gl.TEXTURE_2D,this.tile.texture);gl.texSubImage2D(gl.TEXTURE_2D,0,0,0,gl.RGBA,gl.UNSIGNED_BYTE,image)}},loadTile:function(tile,callback){if(this.coord&&this.coord.toString()===tile.coord.toString()){this._setTile(tile);callback(null)}else{tile.state="errored";callback(null)}},serialize:function(){return{type:"image",urls:this.url,coordinates:this.coordinates}}})},{"../data/bucket":17,"../data/buffer":23,"../geo/lng_lat":28,"../render/draw_raster":42,"../render/vertex_array_object":49,"../util/ajax":119,"../util/evented":128,"../util/util":137,"./tile_coord":61,"point-geometry":196}],54:[function(require,module,exports){"use strict";var util=require("../util/util");var ajax=require("../util/ajax");var browser=require("../util/browser");var normalizeURL=require("../util/mapbox").normalizeSourceURL;module.exports=function(options,callback){var loaded=function(err,tileJSON){if(err){return callback(err)}var result=util.pick(tileJSON,["tiles","minzoom","maxzoom","attribution"]);if(tileJSON.vector_layers){result.vectorLayers=tileJSON.vector_layers;result.vectorLayerIds=result.vectorLayers.map(function(layer){return layer.id})}callback(null,result)};if(options.url){ajax.getJSON(normalizeURL(options.url),loaded)}else{browser.frame(loaded.bind(null,null,options))}}},{"../util/ajax":119,"../util/browser":120,"../util/mapbox":134,"../util/util":137}],55:[function(require,module,exports){"use strict";var Bucket=require("../data/bucket");module.exports=function(tile,pixelValue,z){return pixelValue*(Bucket.EXTENT/(tile.tileSize*Math.pow(2,z-tile.coord.z)))}},{"../data/bucket":17}],56:[function(require,module,exports){"use strict";var TileCoord=require("./tile_coord");exports.rendered=function(sourceCache,styleLayers,queryGeometry,params,zoom,bearing){var tilesIn=sourceCache.tilesIn(queryGeometry);tilesIn.sort(sortTilesIn);var renderedFeatureLayers=[];for(var r=0;r<tilesIn.length;r++){var tileIn=tilesIn[r];if(!tileIn.tile.featureIndex)continue;renderedFeatureLayers.push(tileIn.tile.featureIndex.query({queryGeometry:tileIn.queryGeometry,scale:tileIn.scale,tileSize:tileIn.tile.tileSize,bearing:bearing,params:params},styleLayers))}return mergeRenderedFeatureLayers(renderedFeatureLayers)};exports.source=function(sourceCache,params){var tiles=sourceCache.getRenderableIds().map(function(id){return sourceCache.getTileByID(id)});var result=[];var dataTiles={};for(var i=0;i<tiles.length;i++){var tile=tiles[i];var dataID=new TileCoord(Math.min(tile.sourceMaxZoom,tile.coord.z),tile.coord.x,tile.coord.y,0).id;if(!dataTiles[dataID]){dataTiles[dataID]=true;tile.querySourceFeatures(result,params)}}return result};function sortTilesIn(a,b){var coordA=a.coord;var coordB=b.coord;return coordA.z-coordB.z||coordA.y-coordB.y||coordA.w-coordB.w||coordA.x-coordB.x}function mergeRenderedFeatureLayers(tiles){var result=tiles[0]||{};for(var i=1;i<tiles.length;i++){var tile=tiles[i];for(var layerID in tile){var tileFeatures=tile[layerID];var resultFeatures=result[layerID];if(resultFeatures===undefined){resultFeatures=result[layerID]=tileFeatures}else{for(var f=0;f<tileFeatures.length;f++){resultFeatures.push(tileFeatures[f])}}}}return result}},{"./tile_coord":61}],57:[function(require,module,exports){"use strict";var util=require("../util/util");var ajax=require("../util/ajax");var Evented=require("../util/evented");var loadTileJSON=require("./load_tilejson");var normalizeURL=require("../util/mapbox").normalizeTileURL;module.exports=RasterTileSource;function RasterTileSource(id,options,dispatcher,eventedParent){this.id=id;this.dispatcher=dispatcher;util.extend(this,util.pick(options,["url","scheme","tileSize"]));this.setEventedParent(eventedParent);this.fire("dataloading",{dataType:"source"});loadTileJSON(options,function(err,tileJSON){if(err){return this.fire("error",err)}util.extend(this,tileJSON);this.fire("data",{dataType:"source"});this.fire("source.load")}.bind(this))}RasterTileSource.prototype=util.inherit(Evented,{minzoom:0,maxzoom:22,roundZoom:true,scheme:"xyz",tileSize:512,_loaded:false,onAdd:function(map){this.map=map},serialize:function(){return{type:"raster",url:this.url,tileSize:this.tileSize,tiles:this.tiles}},loadTile:function(tile,callback){var url=normalizeURL(tile.coord.url(this.tiles,null,this.scheme),this.url,this.tileSize);tile.request=ajax.getImage(url,done.bind(this));function done(err,img){delete tile.request;if(tile.aborted)return;if(err){return callback(err)}var gl=this.map.painter.gl;tile.texture=this.map.painter.getTileTexture(img.width);if(tile.texture){gl.bindTexture(gl.TEXTURE_2D,tile.texture);gl.texSubImage2D(gl.TEXTURE_2D,0,0,0,gl.RGBA,gl.UNSIGNED_BYTE,img)}else{tile.texture=gl.createTexture();gl.bindTexture(gl.TEXTURE_2D,tile.texture);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.LINEAR_MIPMAP_NEAREST);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.LINEAR);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE);gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,true);gl.texImage2D(gl.TEXTURE_2D,0,gl.RGBA,gl.RGBA,gl.UNSIGNED_BYTE,img);tile.texture.size=img.width}gl.generateMipmap(gl.TEXTURE_2D);this.map.animationLoop.set(this.map.style.rasterFadeDuration);tile.state="loaded";callback(null)}},abortTile:function(tile){if(tile.request){tile.request.abort();delete tile.request}},unloadTile:function(tile){if(tile.texture)this.map.painter.saveTileTexture(tile.texture)}})},{"../util/ajax":119,"../util/evented":128,"../util/mapbox":134,"../util/util":137,"./load_tilejson":54}],58:[function(require,module,exports){"use strict";var util=require("../util/util");var sourceTypes={vector:require("../source/vector_tile_source"),raster:require("../source/raster_tile_source"),geojson:require("../source/geojson_source"),video:require("../source/video_source"),image:require("../source/image_source")};exports.create=function(id,source,dispatcher,eventedParent){source=new sourceTypes[source.type](id,source,dispatcher,eventedParent);source.setEventedParent(eventedParent);if(source.id!==id){throw new Error("Expected Source id to be "+id+" instead of "+source.id)}util.bindAll(["load","abort","unload","serialize","prepare"],source);return source};exports.getType=function(name){return sourceTypes[name]};exports.setType=function(name,type){sourceTypes[name]=type}},{"../source/geojson_source":50,"../source/image_source":53,"../source/raster_tile_source":57,"../source/vector_tile_source":62,"../source/video_source":64,"../util/util":137}],59:[function(require,module,exports){"use strict";var Source=require("./source");var Tile=require("./tile");var Evented=require("../util/evented");var TileCoord=require("./tile_coord");var Cache=require("../util/lru_cache");var Coordinate=require("../geo/coordinate");var util=require("../util/util");var EXTENT=require("../data/bucket").EXTENT;module.exports=SourceCache;function SourceCache(id,options,dispatcher){this.id=id;this.dispatcher=dispatcher;this._source=Source.create(id,options,dispatcher,this);this.on("source.load",function(){if(this.map&&this._source.onAdd){this._source.onAdd(this.map)}this._sourceLoaded=true});this.on("error",function(){this._sourceErrored=true});this.on("data",function(event){if(this._sourceLoaded&&event.dataType==="source"){this.reload();if(this.transform){this.update(this.transform,this.map&&this.map.style.rasterFadeDuration)}}});this._tiles={};this._cache=new Cache(0,this.unloadTile.bind(this));this._isIdRenderable=this._isIdRenderable.bind(this)}SourceCache.maxOverzooming=10;SourceCache.maxUnderzooming=3;SourceCache.prototype=util.inherit(Evented,{onAdd:function(map){this.map=map;if(this._source&&this._source.onAdd){this._source.onAdd(map)}},loaded:function(){if(this._sourceErrored){return true}if(!this._sourceLoaded){return false}for(var t in this._tiles){var tile=this._tiles[t];if(tile.state!=="loaded"&&tile.state!=="errored")return false}return true},getSource:function(){return this._source},loadTile:function(tile,callback){return this._source.loadTile(tile,callback)},unloadTile:function(tile){if(this._source.unloadTile)return this._source.unloadTile(tile)},abortTile:function(tile){if(this._source.abortTile)return this._source.abortTile(tile)},serialize:function(){return this._source.serialize()},prepare:function(){if(this._sourceLoaded&&this._source.prepare)return this._source.prepare()},getIds:function(){return Object.keys(this._tiles).map(Number).sort(compareKeyZoom)},getRenderableIds:function(){return this.getIds().filter(this._isIdRenderable)},_isIdRenderable:function(id){return this._tiles[id].hasData()&&!this._coveredTiles[id]},reload:function(){this._cache.reset();for(var i in this._tiles){var tile=this._tiles[i];if(tile.state!=="loading"){tile.state="reloading"}this.loadTile(this._tiles[i],this._tileLoaded.bind(this,this._tiles[i]))}},_tileLoaded:function(tile,err){if(err){tile.state="errored";this._source.fire("error",{tile:tile,error:err});return}tile.sourceCache=this;tile.timeAdded=(new Date).getTime();this._source.fire("data",{tile:tile,dataType:"tile"});if(this.map)this.map.painter.tileExtentVAO.vao=null},getTile:function(coord){return this.getTileByID(coord.id)},getTileByID:function(id){return this._tiles[id]},getZoom:function(transform){return transform.zoom+transform.scaleZoom(transform.tileSize/this._source.tileSize)},findLoadedChildren:function(coord,maxCoveringZoom,retain){var found=false;for(var id in this._tiles){var tile=this._tiles[id];if(retain[id]||!tile.hasData()||tile.coord.z<=coord.z||tile.coord.z>maxCoveringZoom)continue;var z2=Math.pow(2,Math.min(tile.coord.z,this._source.maxzoom)-Math.min(coord.z,this._source.maxzoom));if(Math.floor(tile.coord.x/z2)!==coord.x||Math.floor(tile.coord.y/z2)!==coord.y)continue;retain[id]=true;found=true;while(tile&&tile.coord.z-1>coord.z){var parentId=tile.coord.parent(this._source.maxzoom).id;tile=this._tiles[parentId];if(tile&&tile.hasData()){delete retain[id];retain[parentId]=true}}}return found},findLoadedParent:function(coord,minCoveringZoom,retain){for(var z=coord.z-1;z>=minCoveringZoom;z--){coord=coord.parent(this._source.maxzoom);var tile=this._tiles[coord.id];if(tile&&tile.hasData()){retain[coord.id]=true;return tile}if(this._cache.has(coord.id)){this.addTile(coord);retain[coord.id]=true;return this._tiles[coord.id]}}},updateCacheSize:function(transform){var widthInTiles=Math.ceil(transform.width/transform.tileSize)+1;var heightInTiles=Math.ceil(transform.height/transform.tileSize)+1;var approxTilesInView=widthInTiles*heightInTiles;var commonZoomRange=5;this._cache.setMaxSize(Math.floor(approxTilesInView*commonZoomRange))},update:function(transform,fadeDuration){if(!this._sourceLoaded){return}var i;var coord;var tile;this.updateCacheSize(transform);var zoom=(this._source.roundZoom?Math.round:Math.floor)(this.getZoom(transform));var minCoveringZoom=Math.max(zoom-SourceCache.maxOverzooming,this._source.minzoom);var maxCoveringZoom=Math.max(zoom+SourceCache.maxUnderzooming,this._source.minzoom);var retain={};var now=(new Date).getTime();this._coveredTiles={};var visibleCoords;if(!this.used){visibleCoords=[]}else if(this._source.coord){visibleCoords=[this._source.coord]}else{visibleCoords=transform.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled})}for(i=0;i<visibleCoords.length;i++){coord=visibleCoords[i];tile=this.addTile(coord);retain[coord.id]=true;if(tile.hasData())continue;if(!this.findLoadedChildren(coord,maxCoveringZoom,retain)){this.findLoadedParent(coord,minCoveringZoom,retain)}}var parentsForFading={};var ids=Object.keys(retain);for(var k=0;k<ids.length;k++){var id=ids[k];coord=TileCoord.fromID(id);tile=this._tiles[id];if(tile&&tile.timeAdded>now-(fadeDuration||0)){if(this.findLoadedChildren(coord,maxCoveringZoom,retain)){retain[id]=true}this.findLoadedParent(coord,minCoveringZoom,parentsForFading)}}var fadedParent;for(fadedParent in parentsForFading){if(!retain[fadedParent]){this._coveredTiles[fadedParent]=true}}for(fadedParent in parentsForFading){retain[fadedParent]=true}var remove=util.keysDifference(this._tiles,retain);for(i=0;i<remove.length;i++){this.removeTile(+remove[i])}this.transform=transform},addTile:function(coord){var tile=this._tiles[coord.id];if(tile)return tile;var wrapped=coord.wrapped();tile=this._tiles[wrapped.id];if(!tile){tile=this._cache.get(wrapped.id);if(tile&&this._redoPlacement){this._redoPlacement(tile)}}if(!tile){var zoom=coord.z;var overscaling=zoom>this._source.maxzoom?Math.pow(2,zoom-this._source.maxzoom):1;tile=new Tile(wrapped,this._source.tileSize*overscaling,this._source.maxzoom);this.loadTile(tile,this._tileLoaded.bind(this,tile))}tile.uses++;this._tiles[coord.id]=tile;this._source.fire("dataloading",{tile:tile,dataType:"tile"});return tile},removeTile:function(id){var tile=this._tiles[id];if(!tile)return;tile.uses--;delete this._tiles[id];this._source.fire("data",{tile:tile,dataType:"tile"});if(tile.uses>0)return;if(tile.hasData()){this._cache.add(tile.coord.wrapped().id,tile)}else{tile.aborted=true;this.abortTile(tile);this.unloadTile(tile)}},clearTiles:function(){for(var id in this._tiles)this.removeTile(id);this._cache.reset()},tilesIn:function(queryGeometry){var tileResults={};var ids=this.getIds();var minX=Infinity;var minY=Infinity;var maxX=-Infinity;var maxY=-Infinity;var z=queryGeometry[0].zoom;for(var k=0;k<queryGeometry.length;k++){var p=queryGeometry[k];minX=Math.min(minX,p.column);minY=Math.min(minY,p.row);maxX=Math.max(maxX,p.column);maxY=Math.max(maxY,p.row)}for(var i=0;i<ids.length;i++){var tile=this._tiles[ids[i]];var coord=TileCoord.fromID(ids[i]);var tileSpaceBounds=[coordinateToTilePoint(coord,tile.sourceMaxZoom,new Coordinate(minX,minY,z)),coordinateToTilePoint(coord,tile.sourceMaxZoom,new Coordinate(maxX,maxY,z))];if(tileSpaceBounds[0].x<EXTENT&&tileSpaceBounds[0].y<EXTENT&&tileSpaceBounds[1].x>=0&&tileSpaceBounds[1].y>=0){var tileSpaceQueryGeometry=[];for(var j=0;j<queryGeometry.length;j++){tileSpaceQueryGeometry.push(coordinateToTilePoint(coord,tile.sourceMaxZoom,queryGeometry[j]))}var tileResult=tileResults[tile.coord.id];if(tileResult===undefined){tileResult=tileResults[tile.coord.id]={tile:tile,coord:coord,queryGeometry:[],scale:Math.pow(2,this.transform.zoom-tile.coord.z)}}tileResult.queryGeometry.push(tileSpaceQueryGeometry)}}var results=[];for(var t in tileResults){results.push(tileResults[t])}return results},redoPlacement:function(){var ids=this.getIds();for(var i=0;i<ids.length;i++){var tile=this.getTileByID(ids[i]);tile.redoPlacement(this)}},getVisibleCoordinates:function(){return this.getRenderableIds().map(TileCoord.fromID)}});function coordinateToTilePoint(tileCoord,sourceMaxZoom,coord){var zoomedCoord=coord.zoomTo(Math.min(tileCoord.z,sourceMaxZoom));return{x:(zoomedCoord.column-(tileCoord.x+tileCoord.w*Math.pow(2,tileCoord.z)))*EXTENT,y:(zoomedCoord.row-tileCoord.y)*EXTENT}}function compareKeyZoom(a,b){return a%32-b%32}},{"../data/bucket":17,"../geo/coordinate":27,"../util/evented":128,"../util/lru_cache":133,"../util/util":137,"./source":58,"./tile":60,"./tile_coord":61}],60:[function(require,module,exports){"use strict";var util=require("../util/util");var Bucket=require("../data/bucket");
var FeatureIndex=require("../data/feature_index");var vt=require("vector-tile");var Protobuf=require("pbf");var GeoJSONFeature=require("../util/vectortile_to_geojson");var featureFilter=require("feature-filter");var CollisionTile=require("../symbol/collision_tile");var CollisionBoxArray=require("../symbol/collision_box");var SymbolInstancesArray=require("../symbol/symbol_instances");var SymbolQuadsArray=require("../symbol/symbol_quads");module.exports=Tile;function Tile(coord,size,sourceMaxZoom){this.coord=coord;this.uid=util.uniqueId();this.uses=0;this.tileSize=size;this.sourceMaxZoom=sourceMaxZoom;this.buckets={};this.state="loading"}Tile.prototype={loadVectorData:function(data,painter){if(this.hasData()){this.unloadVectorData(painter)}this.state="loaded";if(!data)return;if(data.rawTileData){this.rawTileData=data.rawTileData}this.collisionBoxArray=new CollisionBoxArray(data.collisionBoxArray);this.collisionTile=new CollisionTile(data.collisionTile,this.collisionBoxArray);this.symbolInstancesArray=new SymbolInstancesArray(data.symbolInstancesArray);this.symbolQuadsArray=new SymbolQuadsArray(data.symbolQuadsArray);this.featureIndex=new FeatureIndex(data.featureIndex,this.rawTileData,this.collisionTile);this.buckets=unserializeBuckets(data.buckets,painter.style)},reloadSymbolData:function(data,style){if(this.state==="unloaded")return;this.collisionTile=new CollisionTile(data.collisionTile,this.collisionBoxArray);this.featureIndex.setCollisionTile(this.collisionTile);for(var id in this.buckets){var bucket=this.buckets[id];if(bucket.type==="symbol"){bucket.destroy();delete this.buckets[id]}}util.extend(this.buckets,unserializeBuckets(data.buckets,style))},unloadVectorData:function(){for(var id in this.buckets){this.buckets[id].destroy()}this.collisionBoxArray=null;this.symbolQuadsArray=null;this.symbolInstancesArray=null;this.collisionTile=null;this.featureIndex=null;this.buckets=null;this.state="unloaded"},redoPlacement:function(source){if(this.state!=="loaded"||this.state==="reloading"){this.redoWhenDone=true;return}this.state="reloading";source.dispatcher.send("redo placement",{uid:this.uid,source:source.id,angle:source.map.transform.angle,pitch:source.map.transform.pitch,showCollisionBoxes:source.map.showCollisionBoxes},done.bind(this),this.workerID);function done(_,data){this.reloadSymbolData(data,source.map.style);source.fire("data",{tile:this,dataType:"tile"});if(source.map)source.map.painter.tileExtentVAO.vao=null;this.state="loaded";if(this.redoWhenDone){this.redoPlacement(source);this.redoWhenDone=false}}},getBucket:function(layer){return this.buckets&&this.buckets[layer.ref||layer.id]},querySourceFeatures:function(result,params){if(!this.rawTileData)return;if(!this.vtLayers){this.vtLayers=new vt.VectorTile(new Protobuf(this.rawTileData)).layers}var layer=this.vtLayers._geojsonTileLayer||this.vtLayers[params.sourceLayer];if(!layer)return;var filter=featureFilter(params.filter);var coord={z:this.coord.z,x:this.coord.x,y:this.coord.y};for(var i=0;i<layer.length;i++){var feature=layer.feature(i);if(filter(feature)){var geojsonFeature=new GeoJSONFeature(feature,this.coord.z,this.coord.x,this.coord.y);geojsonFeature.tile=coord;result.push(geojsonFeature)}}},hasData:function(){return this.state==="loaded"||this.state==="reloading"}};function unserializeBuckets(input,style){if(!style)return;var output={};for(var i=0;i<input.length;i++){var layer=style.getLayer(input[i].layerId);if(!layer)continue;var bucket=Bucket.create(util.extend({layer:layer,childLayers:input[i].childLayerIds.map(style.getLayer.bind(style)).filter(function(layer){return layer})},input[i]));output[bucket.id]=bucket}return output}},{"../data/bucket":17,"../data/feature_index":25,"../symbol/collision_box":87,"../symbol/collision_tile":89,"../symbol/symbol_instances":98,"../symbol/symbol_quads":99,"../util/util":137,"../util/vectortile_to_geojson":138,"feature-filter":142,pbf:194,"vector-tile":206}],61:[function(require,module,exports){"use strict";var WhooTS=require("whoots-js");var Coordinate=require("../geo/coordinate");module.exports=TileCoord;function TileCoord(z,x,y,w){if(isNaN(w))w=0;this.z=+z;this.x=+x;this.y=+y;this.w=+w;w*=2;if(w<0)w=w*-1-1;var dim=1<<this.z;this.id=(dim*dim*w+dim*this.y+this.x)*32+this.z;this.posMatrix=null}TileCoord.prototype.toString=function(){return this.z+"/"+this.x+"/"+this.y};TileCoord.prototype.toCoordinate=function(sourceMaxZoom){var zoom=Math.min(this.z,sourceMaxZoom);var tileScale=Math.pow(2,zoom);var row=this.y;var column=this.x+tileScale*this.w;return new Coordinate(column,row,zoom)};TileCoord.fromID=function(id){var z=id%32,dim=1<<z;var xy=(id-z)/32;var x=xy%dim,y=(xy-x)/dim%dim;var w=Math.floor(xy/(dim*dim));if(w%2!==0)w=w*-1-1;w/=2;return new TileCoord(z,x,y,w)};function getQuadkey(z,x,y){var quadkey="",mask;for(var i=z;i>0;i--){mask=1<<i-1;quadkey+=(x&mask?1:0)+(y&mask?2:0)}return quadkey}TileCoord.prototype.url=function(urls,sourceMaxZoom,scheme){var bbox=WhooTS.getTileBBox(this.x,this.y,this.z);var quadkey=getQuadkey(this.z,this.x,this.y);return urls[(this.x+this.y)%urls.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace("{z}",Math.min(this.z,sourceMaxZoom||this.z)).replace("{x}",this.x).replace("{y}",scheme==="tms"?Math.pow(2,this.z)-this.y-1:this.y).replace("{quadkey}",quadkey).replace("{bbox-epsg-3857}",bbox)};TileCoord.prototype.parent=function(sourceMaxZoom){if(this.z===0)return null;if(this.z>sourceMaxZoom){return new TileCoord(this.z-1,this.x,this.y,this.w)}return 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.children=function(sourceMaxZoom){if(this.z>=sourceMaxZoom){return[new TileCoord(this.z+1,this.x,this.y,this.w)]}var z=this.z+1;var x=this.x*2;var y=this.y*2;return[new TileCoord(z,x,y,this.w),new TileCoord(z,x+1,y,this.w),new TileCoord(z,x,y+1,this.w),new TileCoord(z,x+1,y+1,this.w)]};function edge(a,b){if(a.row>b.row){var t=a;a=b;b=t}return{x0:a.column,y0:a.row,x1:b.column,y1:b.row,dx:b.column-a.column,dy:b.row-a.row}}function scanSpans(e0,e1,ymin,ymax,scanLine){var y0=Math.max(ymin,Math.floor(e1.y0));var y1=Math.min(ymax,Math.ceil(e1.y1));if(e0.x0===e1.x0&&e0.y0===e1.y0?e0.x0+e1.dy/e0.dy*e0.dx<e1.x1:e0.x1-e1.dy/e0.dy*e0.dx<e1.x0){var t=e0;e0=e1;e1=t}var m0=e0.dx/e0.dy;var m1=e1.dx/e1.dy;var d0=e0.dx>0;var d1=e1.dx<0;for(var y=y0;y<y1;y++){var x0=m0*Math.max(0,Math.min(e0.dy,y+d0-e0.y0))+e0.x0;var x1=m1*Math.max(0,Math.min(e1.dy,y+d1-e1.y0))+e1.x0;scanLine(Math.floor(x1),Math.ceil(x0),y)}}function scanTriangle(a,b,c,ymin,ymax,scanLine){var ab=edge(a,b),bc=edge(b,c),ca=edge(c,a);var t;if(ab.dy>bc.dy){t=ab;ab=bc;bc=t}if(ab.dy>ca.dy){t=ab;ab=ca;ca=t}if(bc.dy>ca.dy){t=bc;bc=ca;ca=t}if(ab.dy)scanSpans(ca,ab,ymin,ymax,scanLine);if(bc.dy)scanSpans(ca,bc,ymin,ymax,scanLine)}TileCoord.cover=function(z,bounds,actualZ){var tiles=1<<z;var t={};function scanLine(x0,x1,y){var x,wx,coord;if(y>=0&&y<=tiles){for(x=x0;x<x1;x++){wx=(x%tiles+tiles)%tiles;coord=new TileCoord(actualZ,wx,y,Math.floor(x/tiles));t[coord.id]=coord}}}scanTriangle(bounds[0],bounds[1],bounds[2],0,tiles,scanLine);scanTriangle(bounds[2],bounds[3],bounds[0],0,tiles,scanLine);return Object.keys(t).map(function(id){return t[id]})}},{"../geo/coordinate":27,"whoots-js":214}],62:[function(require,module,exports){"use strict";var Evented=require("../util/evented");var util=require("../util/util");var loadTileJSON=require("./load_tilejson");var normalizeURL=require("../util/mapbox").normalizeTileURL;module.exports=VectorTileSource;function VectorTileSource(id,options,dispatcher,eventedParent){this.id=id;this.dispatcher=dispatcher;util.extend(this,util.pick(options,["url","scheme","tileSize"]));this._options=util.extend({type:"vector"},options);if(this.tileSize!==512){throw new Error("vector tile sources must have a tileSize of 512")}this.setEventedParent(eventedParent);this.fire("dataloading",{dataType:"source"});loadTileJSON(options,function(err,tileJSON){if(err){this.fire("error",err);return}util.extend(this,tileJSON);this.fire("data",{dataType:"source"});this.fire("source.load")}.bind(this))}VectorTileSource.prototype=util.inherit(Evented,{minzoom:0,maxzoom:22,scheme:"xyz",tileSize:512,reparseOverscaled:true,isTileClipped:true,onAdd:function(map){this.map=map},serialize:function(){return util.extend({},this._options)},loadTile:function(tile,callback){var overscaling=tile.coord.z>this.maxzoom?Math.pow(2,tile.coord.z-this.maxzoom):1;var params={url:normalizeURL(tile.coord.url(this.tiles,this.maxzoom,this.scheme),this.url),uid:tile.uid,coord:tile.coord,zoom:tile.coord.z,tileSize:this.tileSize*overscaling,source:this.id,overscaling:overscaling,angle:this.map.transform.angle,pitch:this.map.transform.pitch,showCollisionBoxes:this.map.showCollisionBoxes};if(!tile.workerID){tile.workerID=this.dispatcher.send("load tile",params,done.bind(this))}else if(tile.state==="loading"){tile.reloadCallback=callback}else{this.dispatcher.send("reload tile",params,done.bind(this),tile.workerID)}function done(err,data){if(tile.aborted)return;if(err){return callback(err)}tile.loadVectorData(data,this.map.painter);if(tile.redoWhenDone){tile.redoWhenDone=false;tile.redoPlacement(this)}callback(null);if(tile.reloadCallback){this.loadTile(tile,tile.reloadCallback);tile.reloadCallback=null}}},abortTile:function(tile){this.dispatcher.send("abort tile",{uid:tile.uid,source:this.id},null,tile.workerID)},unloadTile:function(tile){tile.unloadVectorData();this.dispatcher.send("remove tile",{uid:tile.uid,source:this.id},null,tile.workerID)}})},{"../util/evented":128,"../util/mapbox":134,"../util/util":137,"./load_tilejson":54}],63:[function(require,module,exports){"use strict";var ajax=require("../util/ajax");var vt=require("vector-tile");var Protobuf=require("pbf");var WorkerTile=require("./worker_tile");var util=require("../util/util");module.exports=VectorTileWorkerSource;function VectorTileWorkerSource(actor,styleLayers,loadVectorData){this.actor=actor;this.styleLayers=styleLayers;if(loadVectorData){this.loadVectorData=loadVectorData}this.loading={};this.loaded={}}VectorTileWorkerSource.prototype={loadTile:function(params,callback){var source=params.source,uid=params.uid;if(!this.loading[source])this.loading[source]={};var workerTile=this.loading[source][uid]=new WorkerTile(params);workerTile.abort=this.loadVectorData(params,done.bind(this));function done(err,vectorTile){delete this.loading[source][uid];if(err)return callback(err);if(!vectorTile)return callback(null,null);workerTile.vectorTile=vectorTile;workerTile.parse(vectorTile,this.styleLayers.getLayerFamilies(),this.actor,function(err,result,transferrables){if(err)return callback(err);callback(null,util.extend({rawTileData:vectorTile.rawData},result),transferrables)});this.loaded[source]=this.loaded[source]||{};this.loaded[source][uid]=workerTile}},reloadTile:function(params,callback){var loaded=this.loaded[params.source],uid=params.uid;if(loaded&&loaded[uid]){var workerTile=loaded[uid];workerTile.parse(workerTile.vectorTile,this.styleLayers.getLayerFamilies(),this.actor,callback)}},abortTile:function(params){var loading=this.loading[params.source],uid=params.uid;if(loading&&loading[uid]&&loading[uid].abort){loading[uid].abort();delete loading[uid]}},removeTile:function(params){var loaded=this.loaded[params.source],uid=params.uid;if(loaded&&loaded[uid]){delete loaded[uid]}},loadVectorData:function(params,callback){var xhr=ajax.getArrayBuffer(params.url,done.bind(this));return function abort(){xhr.abort()};function done(err,arrayBuffer){if(err){return callback(err)}var vectorTile=new vt.VectorTile(new Protobuf(arrayBuffer));vectorTile.rawData=arrayBuffer;callback(err,vectorTile)}},redoPlacement:function(params,callback){var loaded=this.loaded[params.source],loading=this.loading[params.source],uid=params.uid;if(loaded&&loaded[uid]){var workerTile=loaded[uid];var result=workerTile.redoPlacement(params.angle,params.pitch,params.showCollisionBoxes);if(result.result){callback(null,result.result,result.transferables)}}else if(loading&&loading[uid]){loading[uid].angle=params.angle}}}},{"../util/ajax":119,"../util/util":137,"./worker_tile":66,pbf:194,"vector-tile":206}],64:[function(require,module,exports){"use strict";var util=require("../util/util");var ajax=require("../util/ajax");var ImageSource=require("./image_source");module.exports=VideoSource;function VideoSource(id,options,dispatcher,eventedParent){this.id=id;this.urls=options.urls;this.coordinates=options.coordinates;this.setEventedParent(eventedParent);this.fire("dataloading",{dataType:"source"});ajax.getVideo(options.urls,function(err,video){if(err)return this.fire("error",{error:err});this.video=video;this.video.loop=true;var loopID;this.video.addEventListener("playing",function(){loopID=this.map.style.animationLoop.set(Infinity);this.map._rerender()}.bind(this));this.video.addEventListener("pause",function(){this.map.style.animationLoop.cancel(loopID)}.bind(this));if(this.map){this.video.play();this.setCoordinates(options.coordinates)}this.fire("data",{dataType:"source"});this.fire("source.load")}.bind(this))}VideoSource.prototype=util.inherit(ImageSource,{roundZoom:true,getVideo:function(){return this.video},onAdd:function(map){if(this.map)return;this.map=map;if(this.video){this.video.play();this.setCoordinates(this.coordinates)}},prepare:function(){if(!this.tile||this.video.readyState<2)return;this._prepareImage(this.map.painter.gl,this.video)},serialize:function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}})},{"../util/ajax":119,"../util/util":137,"./image_source":53}],65:[function(require,module,exports){"use strict";var Actor=require("../util/actor");var StyleLayer=require("../style/style_layer");var util=require("../util/util");var VectorTileWorkerSource=require("./vector_tile_worker_source");var GeoJSONWorkerSource=require("./geojson_worker_source");var featureFilter=require("feature-filter");module.exports=function createWorker(self){return new Worker(self)};function Worker(self){this.self=self;this.actor=new Actor(self,this);this.layers={};this.layerFamilies={};this.workerSourceTypes={vector:VectorTileWorkerSource,geojson:GeoJSONWorkerSource};this.workerSources={};this.self.registerWorkerSource=function(name,WorkerSource){if(this.workerSourceTypes[name]){throw new Error('Worker source with name "'+name+'" already registered.')}this.workerSourceTypes[name]=WorkerSource}.bind(this)}util.extend(Worker.prototype,{"set layers":function(mapId,layerDefinitions){var layers=this.layers[mapId]={};var childLayerIndicies=[];for(var i=0;i<layerDefinitions.length;i++){var layer=layerDefinitions[i];if(layer.type==="fill"||layer.type==="line"||layer.type==="circle"||layer.type==="symbol"){if(layer.ref){childLayerIndicies.push(i)}else{setLayer(layer)}}}for(var j=0;j<childLayerIndicies.length;j++){setLayer(layerDefinitions[childLayerIndicies[j]])}function setLayer(serializedLayer){var styleLayer=StyleLayer.create(serializedLayer,serializedLayer.ref&&layers[serializedLayer.ref]);styleLayer.updatePaintTransitions({},{transition:false});styleLayer.filter=featureFilter(styleLayer.filter);layers[styleLayer.id]=styleLayer}this.layerFamilies[mapId]=createLayerFamilies(this.layers[mapId])},"update layers":function(mapId,layerDefinitions){var id;var layer;var layers=this.layers[mapId];for(id in layerDefinitions){layer=layerDefinitions[id];if(layer.ref)updateLayer(layer)}for(id in layerDefinitions){layer=layerDefinitions[id];if(!layer.ref)updateLayer(layer)}function updateLayer(layer){var refLayer=layers[layer.ref];var styleLayer=layers[layer.id];if(styleLayer){styleLayer.set(layer,refLayer)}else{styleLayer=layers[layer.id]=StyleLayer.create(layer,refLayer)}styleLayer.updatePaintTransitions({},{transition:false});styleLayer.filter=featureFilter(styleLayer.filter)}this.layerFamilies[mapId]=createLayerFamilies(this.layers[mapId])},"load tile":function(mapId,params,callback){var type=params.type||"vector";this.getWorkerSource(mapId,type).loadTile(params,callback)},"reload tile":function(mapId,params,callback){var type=params.type||"vector";this.getWorkerSource(mapId,type).reloadTile(params,callback)},"abort tile":function(mapId,params){var type=params.type||"vector";this.getWorkerSource(mapId,type).abortTile(params)},"remove tile":function(mapId,params){var type=params.type||"vector";this.getWorkerSource(mapId,type).removeTile(params)},"redo placement":function(mapId,params,callback){var type=params.type||"vector";this.getWorkerSource(mapId,type).redoPlacement(params,callback)},"load worker source":function(map,params,callback){try{this.self.importScripts(params.url);callback()}catch(e){callback(e)}},getWorkerSource:function(mapId,type){if(!this.workerSources[mapId])this.workerSources[mapId]={};if(!this.workerSources[mapId][type]){var layers={getLayers:function(){return this.layers[mapId]}.bind(this),getLayerFamilies:function(){return this.layerFamilies[mapId]}.bind(this)};var actor={send:function(type,data,callback,buffers){this.actor.send(type,data,callback,buffers,mapId)}.bind(this)};this.workerSources[mapId][type]=new this.workerSourceTypes[type](actor,layers)}return this.workerSources[mapId][type]}});function createLayerFamilies(layers){var families={};for(var layerId in layers){var layer=layers[layerId];var parentLayerId=layer.ref||layer.id;var parentLayer=layers[parentLayerId];if(parentLayer.layout&&parentLayer.layout.visibility==="none")continue;families[parentLayerId]=families[parentLayerId]||[];if(layerId===parentLayerId){families[parentLayerId].unshift(layer)}else{families[parentLayerId].push(layer)}}return families}},{"../style/style_layer":74,"../util/actor":118,"../util/util":137,"./geojson_worker_source":51,"./vector_tile_worker_source":63,"feature-filter":142}],66:[function(require,module,exports){"use strict";var FeatureIndex=require("../data/feature_index");var CollisionTile=require("../symbol/collision_tile");var Bucket=require("../data/bucket");var CollisionBoxArray=require("../symbol/collision_box");var DictionaryCoder=require("../util/dictionary_coder");var util=require("../util/util");var SymbolInstancesArray=require("../symbol/symbol_instances");var SymbolQuadsArray=require("../symbol/symbol_quads");module.exports=WorkerTile;function WorkerTile(params){this.coord=params.coord;this.uid=params.uid;this.zoom=params.zoom;this.tileSize=params.tileSize;this.source=params.source;this.overscaling=params.overscaling;this.angle=params.angle;this.pitch=params.pitch;this.showCollisionBoxes=params.showCollisionBoxes}WorkerTile.prototype.parse=function(data,layerFamilies,actor,callback){this.status="parsing";this.data=data;this.collisionBoxArray=new CollisionBoxArray;this.symbolInstancesArray=new SymbolInstancesArray;this.symbolQuadsArray=new SymbolQuadsArray;var collisionTile=new CollisionTile(this.angle,this.pitch,this.collisionBoxArray);var featureIndex=new FeatureIndex(this.coord,this.overscaling,collisionTile,data.layers);var sourceLayerCoder=new DictionaryCoder(data.layers?Object.keys(data.layers).sort():["_geojsonTileLayer"]);var tile=this;var bucketsById={};var bucketsBySourceLayer={};var i;var layer;var sourceLayerId;var bucket;var bucketIndex=0;for(var layerId in layerFamilies){layer=layerFamilies[layerId][0];if(layer.source!==this.source)continue;if(layer.ref)continue;if(layer.minzoom&&this.zoom<layer.minzoom)continue;if(layer.maxzoom&&this.zoom>=layer.maxzoom)continue;if(layer.layout&&layer.layout.visibility==="none")continue;if(data.layers&&!data.layers[layer.sourceLayer])continue;bucket=Bucket.create({layer:layer,index:bucketIndex++,childLayers:layerFamilies[layerId],zoom:this.zoom,overscaling:this.overscaling,showCollisionBoxes:this.showCollisionBoxes,collisionBoxArray:this.collisionBoxArray,symbolQuadsArray:this.symbolQuadsArray,symbolInstancesArray:this.symbolInstancesArray,sourceLayerIndex:sourceLayerCoder.encode(layer.sourceLayer||"_geojsonTileLayer")});bucketsById[layer.id]=bucket;if(data.layers){sourceLayerId=layer.sourceLayer;bucketsBySourceLayer[sourceLayerId]=bucketsBySourceLayer[sourceLayerId]||{};bucketsBySourceLayer[sourceLayerId][layer.id]=bucket}}if(data.layers){for(sourceLayerId in bucketsBySourceLayer){if(layer.version===1){util.warnOnce('Vector tile source "'+this.source+'" layer "'+sourceLayerId+'" does not use vector tile spec v2 '+"and therefore may have some rendering errors.")}layer=data.layers[sourceLayerId];if(layer){sortLayerIntoBuckets(layer,bucketsBySourceLayer[sourceLayerId])}}}else{sortLayerIntoBuckets(data,bucketsById)}function sortLayerIntoBuckets(layer,buckets){for(var i=0;i<layer.length;i++){var feature=layer.feature(i);feature.index=i;for(var id in buckets){if(buckets[id].layer.filter(feature))buckets[id].features.push(feature)}}}var buckets=[],symbolBuckets=this.symbolBuckets=[],otherBuckets=[];featureIndex.bucketLayerIDs={};for(var id in bucketsById){bucket=bucketsById[id];if(bucket.features.length===0)continue;featureIndex.bucketLayerIDs[bucket.index]=bucket.childLayers.map(getLayerId);buckets.push(bucket);if(bucket.type==="symbol")symbolBuckets.push(bucket);else otherBuckets.push(bucket)}var icons={};var stacks={};var deps=0;if(symbolBuckets.length>0){for(i=symbolBuckets.length-1;i>=0;i--){symbolBuckets[i].updateIcons(icons);symbolBuckets[i].updateFont(stacks)}for(var fontName in stacks){stacks[fontName]=Object.keys(stacks[fontName]).map(Number)}icons=Object.keys(icons);actor.send("get glyphs",{uid:this.uid,stacks:stacks},function(err,newStacks){stacks=newStacks;gotDependency(err)});if(icons.length){actor.send("get icons",{icons:icons},function(err,newIcons){icons=newIcons;gotDependency(err)})}else{gotDependency()}}for(i=otherBuckets.length-1;i>=0;i--){parseBucket(this,otherBuckets[i])}if(symbolBuckets.length===0)return done();function gotDependency(err){if(err)return callback(err);deps++;if(deps===2){for(var i=symbolBuckets.length-1;i>=0;i--){parseBucket(tile,symbolBuckets[i])}done()}}function parseBucket(tile,bucket){bucket.populateArrays(collisionTile,stacks,icons);if(bucket.type!=="symbol"){for(var i=0;i<bucket.features.length;i++){var feature=bucket.features[i];featureIndex.insert(feature,feature.index,bucket.sourceLayerIndex,bucket.index)}}bucket.features=null}function done(){tile.status="done";if(tile.redoPlacementAfterDone){tile.redoPlacement(tile.angle,tile.pitch,null);tile.redoPlacementAfterDone=false}var featureIndex_=featureIndex.serialize();var collisionTile_=collisionTile.serialize();var collisionBoxArray=tile.collisionBoxArray.serialize();var symbolInstancesArray=tile.symbolInstancesArray.serialize();var symbolQuadsArray=tile.symbolQuadsArray.serialize();var nonEmptyBuckets=buckets.filter(isBucketNonEmpty);callback(null,{buckets:nonEmptyBuckets.map(serializeBucket),featureIndex:featureIndex_.data,collisionTile:collisionTile_.data,collisionBoxArray:collisionBoxArray,symbolInstancesArray:symbolInstancesArray,symbolQuadsArray:symbolQuadsArray},getTransferables(nonEmptyBuckets).concat(featureIndex_.transferables).concat(collisionTile_.transferables))}};WorkerTile.prototype.redoPlacement=function(angle,pitch,showCollisionBoxes){if(this.status!=="done"){this.redoPlacementAfterDone=true;this.angle=angle;return{}}var collisionTile=new CollisionTile(angle,pitch,this.collisionBoxArray);var buckets=this.symbolBuckets;for(var i=buckets.length-1;i>=0;i--){buckets[i].placeFeatures(collisionTile,showCollisionBoxes)}var collisionTile_=collisionTile.serialize();var nonEmptyBuckets=buckets.filter(isBucketNonEmpty);return{result:{buckets:nonEmptyBuckets.map(serializeBucket),collisionTile:collisionTile_.data},transferables:getTransferables(nonEmptyBuckets).concat(collisionTile_.transferables)}};function isBucketNonEmpty(bucket){return!bucket.isEmpty()}function serializeBucket(bucket){return bucket.serialize()}function getTransferables(buckets){var transferables=[];for(var i in buckets){buckets[i].getTransferables(transferables)}return transferables}function getLayerId(layer){return layer.id}},{"../data/bucket":17,"../data/feature_index":25,"../symbol/collision_box":87,"../symbol/collision_tile":89,"../symbol/symbol_instances":98,"../symbol/symbol_quads":99,"../util/dictionary_coder":125,"../util/util":137}],67:[function(require,module,exports){"use strict";module.exports=AnimationLoop;function AnimationLoop(){this.n=0;this.times=[]}AnimationLoop.prototype.stopped=function(){this.times=this.times.filter(function(t){return t.time>=(new Date).getTime()});return!this.times.length};AnimationLoop.prototype.set=function(t){this.times.push({id:this.n,time:t+(new Date).getTime()});return this.n++};AnimationLoop.prototype.cancel=function(n){this.times=this.times.filter(function(t){return t.id!==n})}},{}],68:[function(require,module,exports){"use strict";var Evented=require("../util/evented");var ajax=require("../util/ajax");var browser=require("../util/browser");var normalizeURL=require("../util/mapbox").normalizeSpriteURL;module.exports=ImageSprite;function ImageSprite(base){this.base=base;this.retina=browser.devicePixelRatio>1;var format=this.retina?"@2x":"";ajax.getJSON(normalizeURL(base,format,".json"),function(err,data){if(err){this.fire("error",{error:err});return}this.data=data;if(this.img)this.fire("data",{dataType:"style"})}.bind(this));ajax.getImage(normalizeURL(base,format,".png"),function(err,img){if(err){this.fire("error",{error:err});return}var data=img.getData();var newdata=img.data=new Uint8Array(data.length);for(var i=0;i<data.length;i+=4){var alpha=data[i+3]/255;newdata[i+0]=data[i+0]*alpha;newdata[i+1]=data[i+1]*alpha;newdata[i+2]=data[i+2]*alpha;newdata[i+3]=data[i+3]}this.img=img;if(this.data)this.fire("data",{dataType:"style"})}.bind(this))}ImageSprite.prototype=Object.create(Evented);ImageSprite.prototype.toJSON=function(){return this.base};ImageSprite.prototype.loaded=function(){return!!(this.data&&this.img)};ImageSprite.prototype.resize=function(){if(browser.devicePixelRatio>1!==this.retina){var newSprite=new ImageSprite(this.base);newSprite.on("data",function(){this.img=newSprite.img;this.data=newSprite.data;this.retina=newSprite.retina}.bind(this))}};function SpritePosition(){}SpritePosition.prototype={x:0,y:0,width:0,height:0,pixelRatio:1,sdf:false};ImageSprite.prototype.getSpritePosition=function(name){if(!this.loaded())return new SpritePosition;var pos=this.data&&this.data[name];if(pos&&this.img)return pos;return new SpritePosition}},{"../util/ajax":119,"../util/browser":120,"../util/evented":128,"../util/mapbox":134}],69:[function(require,module,exports){"use strict";var styleSpec=require("./style_spec");var util=require("../util/util");var Evented=require("../util/evented");var validateStyle=require("./validate_style");var StyleDeclaration=require("./style_declaration");var StyleTransition=require("./style_transition");module.exports=Light;var TRANSITION_SUFFIX="-transition";function Light(lightOptions){this.set(lightOptions)}Light.prototype=util.inherit(Evented,{properties:["anchor","color","position","intensity"],_specifications:styleSpec.$root.light,set:function(lightOpts){if(this._validate(validateStyle.light,lightOpts))return;this._declarations={};this._transitions={};this._transitionOptions={};this.calculated={};lightOpts=util.extend({anchor:this._specifications.anchor.default,color:this._specifications.color.default,position:this._specifications.position.default,intensity:this._specifications.intensity.default},lightOpts);for(var p in this.properties){var prop=this.properties[p];this._declarations[prop]=new StyleDeclaration(this._specifications[prop],lightOpts[prop])}return this},getLight:function(){return{anchor:this.getLightProperty("anchor"),color:this.getLightProperty("color"),position:this.getLightProperty("position"),intensity:this.getLightProperty("intensity")}},getLightProperty:function(property){if(util.endsWith(property,TRANSITION_SUFFIX)){return this._transitionOptions[property]}else{return this._declarations[property]&&this._declarations[property].value}},getLightValue:function(property,globalProperties){if(property==="position"){var calculated=this._transitions[property].calculate(globalProperties),cartesian=util.sphericalToCartesian(calculated);return{x:cartesian[0],y:cartesian[1],z:cartesian[2]}}return this._transitions[property].calculate(globalProperties)},setLight:function(options){if(this._validate(validateStyle.light,options))return;for(var key in options){var value=options[key];if(util.endsWith(key,TRANSITION_SUFFIX)){this._transitionOptions[key]=value}else if(value===null||value===undefined){delete this._declarations[key]}else{this._declarations[key]=new StyleDeclaration(this._specifications[key],value)}}},recalculate:function(zoom,zoomHistory){for(var property in this._declarations){this.calculated[property]=this.getLightValue(property,{zoom:zoom,zoomHistory:zoomHistory})}},_applyLightDeclaration:function(property,declaration,options,globalOptions,animationLoop){var oldTransition=options.transition?this._transitions[property]:undefined;var spec=this._specifications[property];if(declaration===null||declaration===undefined){declaration=new StyleDeclaration(spec,spec.default)}if(oldTransition&&oldTransition.declaration.json===declaration.json)return;var transitionOptions=util.extend({duration:300,delay:0},globalOptions,this.getLightProperty(property+TRANSITION_SUFFIX));var newTransition=this._transitions[property]=new StyleTransition(spec,declaration,oldTransition,transitionOptions);if(!newTransition.instant()){newTransition.loopID=animationLoop.set(newTransition.endTime-Date.now())}if(oldTransition){animationLoop.cancel(oldTransition.loopID)}},updateLightTransitions:function(options,globalOptions,animationLoop){var property;for(property in this._declarations){this._applyLightDeclaration(property,this._declarations[property],options,globalOptions,animationLoop)}},_validate:function(validate,value){return validateStyle.emitErrors(this,validate.call(validateStyle,util.extend({value:value,style:{glyphs:true,sprite:true},styleSpec:styleSpec})))}})},{"../util/evented":128,"../util/util":137,"./style_declaration":72,"./style_spec":81,"./style_transition":82,"./validate_style":83}],70:[function(require,module,exports){"use strict";var parseColorString=require("csscolorparser").parseCSSColor;var util=require("../util/util");var StyleFunction=require("./style_function");var cache={};module.exports=function parseColor(input){if(StyleFunction.isFunctionDefinition(input)){if(!input.stops)return input;else return util.extend({},input,{stops:input.stops.map(function(stop){return[stop[0],parseColor(stop[1])]})})}else if(typeof input==="string"){if(!cache[input]){var rgba=parseColorString(input);if(!rgba){throw new Error("Invalid color "+input)}cache[input]=[rgba[0]/255*rgba[3],rgba[1]/255*rgba[3],rgba[2]/255*rgba[3],rgba[3]]}return cache[input]}else if(Array.isArray(input)){return input}else{throw new Error("Invalid color "+input)}}},{"../util/util":137,"./style_function":73,csscolorparser:140}],71:[function(require,module,exports){"use strict";var Evented=require("../util/evented");var StyleLayer=require("./style_layer");var ImageSprite=require("./image_sprite");var Light=require("./light");var GlyphSource=require("../symbol/glyph_source");var SpriteAtlas=require("../symbol/sprite_atlas");var LineAtlas=require("../render/line_atlas");var util=require("../util/util");var ajax=require("../util/ajax");var mapbox=require("../util/mapbox");var browser=require("../util/browser");var Dispatcher=require("../util/dispatcher");var AnimationLoop=require("./animation_loop");var validateStyle=require("./validate_style");var Source=require("../source/source");var QueryFeatures=require("../source/query_features");var SourceCache=require("../source/source_cache");var styleSpec=require("./style_spec");var StyleFunction=require("./style_function");var getWorkerPool=require("../global_worker_pool");module.exports=Style;function Style(stylesheet,map,options){this.map=map;this.animationLoop=map&&map.animationLoop||new AnimationLoop;
this.dispatcher=new Dispatcher(getWorkerPool(),this);this.spriteAtlas=new SpriteAtlas(1024,1024);this.lineAtlas=new LineAtlas(256,512);this._layers={};this._order=[];this._groups=[];this.sourceCaches={};this.zoomHistory={};util.bindAll(["_redoPlacement"],this);this._resetUpdates();options=util.extend({validate:typeof stylesheet==="string"?!mapbox.isMapboxURL(stylesheet):true},options);this.setEventedParent(map);this.fire("dataloading",{dataType:"style"});var stylesheetLoaded=function(err,stylesheet){if(err){this.fire("error",{error:err});return}if(options.validate&&validateStyle.emitErrors(this,validateStyle(stylesheet)))return;this._loaded=true;this.stylesheet=stylesheet;this.updateClasses();for(var id in stylesheet.sources){this.addSource(id,stylesheet.sources[id],options)}if(stylesheet.sprite){this.sprite=new ImageSprite(stylesheet.sprite);this.sprite.setEventedParent(this)}this.glyphSource=new GlyphSource(stylesheet.glyphs);this._resolve();this.fire("data",{dataType:"style"});this.fire("style.load")}.bind(this);if(typeof stylesheet==="string"){ajax.getJSON(mapbox.normalizeStyleURL(stylesheet),stylesheetLoaded)}else{browser.frame(stylesheetLoaded.bind(this,null,stylesheet))}this.on("source.load",function(event){var source=event.source;if(source&&source.vectorLayerIds){for(var layerId in this._layers){var layer=this._layers[layerId];if(layer.source===source.id){this._validateLayer(layer)}}}})}Style.prototype=util.inherit(Evented,{_loaded:false,_validateLayer:function(layer){var sourceCache=this.sourceCaches[layer.source];if(!layer.sourceLayer)return;if(!sourceCache)return;var source=sourceCache.getSource();if(!source.vectorLayerIds)return;if(source.vectorLayerIds.indexOf(layer.sourceLayer)===-1){this.fire("error",{error:new Error('Source layer "'+layer.sourceLayer+'" '+'does not exist on source "'+source.id+'" '+'as specified by style layer "'+layer.id+'"')})}},loaded:function(){if(!this._loaded)return false;if(Object.keys(this._updates.sources).length)return false;for(var id in this.sourceCaches)if(!this.sourceCaches[id].loaded())return false;if(this.sprite&&!this.sprite.loaded())return false;return true},_resolve:function(){var layer,layerJSON;this._layers={};this._order=this.stylesheet.layers.map(function(layer){return layer.id});for(var i=0;i<this.stylesheet.layers.length;i++){layerJSON=this.stylesheet.layers[i];if(layerJSON.ref)continue;layer=StyleLayer.create(layerJSON);this._layers[layer.id]=layer;layer.setEventedParent(this,{layer:{id:layer.id}})}for(var j=0;j<this.stylesheet.layers.length;j++){layerJSON=this.stylesheet.layers[j];if(!layerJSON.ref)continue;var refLayer=this.getLayer(layerJSON.ref);layer=StyleLayer.create(layerJSON,refLayer);this._layers[layer.id]=layer;layer.setEventedParent(this,{layer:{id:layer.id}})}this._groupLayers();this._updateWorkerLayers();this.light=new Light(this.stylesheet.light)},_groupLayers:function(){var group;this._groups=[];for(var i=0;i<this._order.length;++i){var layer=this._layers[this._order[i]];if(!group||layer.source!==group.source){group=[];group.source=layer.source;this._groups.push(group)}group.push(layer)}},_updateWorkerLayers:function(ids){this.dispatcher.broadcast(ids?"update layers":"set layers",this._serializeLayers(ids))},_serializeLayers:function(ids){ids=ids||this._order;var serialized=[];var options={includeRefProperties:true};for(var i=0;i<ids.length;i++){serialized.push(this._layers[ids[i]].serialize(options))}return serialized},_applyClasses:function(classes,options){if(!this._loaded)return;classes=classes||[];options=options||{transition:true};var transition=this.stylesheet.transition||{};var layers=this._updates.allPaintProps?this._layers:this._updates.paintProps;for(var id in layers){var layer=this._layers[id];var props=this._updates.paintProps[id];if(this._updates.allPaintProps||props.all){layer.updatePaintTransitions(classes,options,transition,this.animationLoop)}else{for(var paintName in props){this._layers[id].updatePaintTransition(paintName,classes,options,transition,this.animationLoop)}}}this.light.updateLightTransitions(options,transition,this.animationLoop)},_recalculate:function(z){if(!this._loaded)return;for(var sourceId in this.sourceCaches)this.sourceCaches[sourceId].used=false;this._updateZoomHistory(z);this.rasterFadeDuration=300;for(var layerId in this._layers){var layer=this._layers[layerId];layer.recalculate(z,this.zoomHistory);if(!layer.isHidden(z)&&layer.source){this.sourceCaches[layer.source].used=true}}this.light.recalculate(z,this.zoomHistory);var maxZoomTransitionDuration=300;if(Math.floor(this.z)!==Math.floor(z)){this.animationLoop.set(maxZoomTransitionDuration)}this.z=z},_updateZoomHistory:function(z){var zh=this.zoomHistory;if(zh.lastIntegerZoom===undefined){zh.lastIntegerZoom=Math.floor(z);zh.lastIntegerZoomTime=0;zh.lastZoom=z}if(Math.floor(zh.lastZoom)<Math.floor(z)){zh.lastIntegerZoom=Math.floor(z);zh.lastIntegerZoomTime=Date.now()}else if(Math.floor(zh.lastZoom)>Math.floor(z)){zh.lastIntegerZoom=Math.floor(z+1);zh.lastIntegerZoomTime=Date.now()}zh.lastZoom=z},_checkLoaded:function(){if(!this._loaded){throw new Error("Style is not done loading")}},update:function(classes,options){if(!this._updates.changed)return this;if(this._updates.allLayers){this._groupLayers();this._updateWorkerLayers()}else{var updatedIds=Object.keys(this._updates.layers);if(updatedIds.length){this._updateWorkerLayers(updatedIds)}}var updatedSourceIds=Object.keys(this._updates.sources);var i;for(i=0;i<updatedSourceIds.length;i++){this._reloadSource(updatedSourceIds[i])}for(i=0;i<this._updates.events.length;i++){var args=this._updates.events[i];this.fire(args[0],args[1])}this._applyClasses(classes,options);if(this._updates.changed){this.fire("data",{dataType:"style"})}this._resetUpdates();return this},_resetUpdates:function(){this._updates={events:[],layers:{},sources:{},paintProps:{}}},addSource:function(id,source,options){this._checkLoaded();if(this.sourceCaches[id]!==undefined){throw new Error("There is already a source with this ID")}if(!source.type){throw new Error("The type property must be defined, but the only the following properties were given: "+Object.keys(source)+".")}var builtIns=["vector","raster","geojson","video","image"];var shouldValidate=builtIns.indexOf(source.type)>=0;if(shouldValidate&&this._validate(validateStyle.source,"sources."+id,source,null,options))return this;source=new SourceCache(id,source,this.dispatcher);this.sourceCaches[id]=source;source.style=this;source.setEventedParent(this,{source:source.getSource()});if(source.onAdd)source.onAdd(this.map);this._updates.changed=true;return this},removeSource:function(id){this._checkLoaded();if(this.sourceCaches[id]===undefined){throw new Error("There is no source with this ID")}var sourceCache=this.sourceCaches[id];delete this.sourceCaches[id];delete this._updates.sources[id];sourceCache.setEventedParent(null);sourceCache.clearTiles();if(sourceCache.onRemove)sourceCache.onRemove(this.map);this._updates.changed=true;return this},getSource:function(id){return this.sourceCaches[id]&&this.sourceCaches[id].getSource()},addLayer:function(layer,before,options){this._checkLoaded();if(!(layer instanceof StyleLayer)){if(this._validate(validateStyle.layer,"layers."+layer.id,layer,{arrayIndex:-1},options))return this;var refLayer=layer.ref&&this.getLayer(layer.ref);layer=StyleLayer.create(layer,refLayer)}this._validateLayer(layer);layer.setEventedParent(this,{layer:{id:layer.id}});this._layers[layer.id]=layer;this._order.splice(before?this._order.indexOf(before):Infinity,0,layer.id);this._updates.allLayers=true;if(layer.source){this._updates.sources[layer.source]=true}return this.updateClasses(layer.id)},removeLayer:function(id){this._checkLoaded();var layer=this._layers[id];if(layer===undefined){throw new Error("There is no layer with this ID")}for(var i in this._layers){if(this._layers[i].ref===id){this.removeLayer(i)}}layer.setEventedParent(null);delete this._layers[id];delete this._updates.layers[id];delete this._updates.paintProps[id];this._order.splice(this._order.indexOf(id),1);this._updates.allLayers=true;this._updates.changed=true;return this},getLayer:function(id){return this._layers[id]},getReferentLayer:function(id){var layer=this.getLayer(id);if(layer.ref){layer=this.getLayer(layer.ref)}return layer},setLayerZoomRange:function(layerId,minzoom,maxzoom){this._checkLoaded();var layer=this.getReferentLayer(layerId);if(layer.minzoom===minzoom&&layer.maxzoom===maxzoom)return this;if(minzoom!=null){layer.minzoom=minzoom}if(maxzoom!=null){layer.maxzoom=maxzoom}return this._updateLayer(layer)},setFilter:function(layerId,filter){this._checkLoaded();var layer=this.getReferentLayer(layerId);if(filter!==null&&this._validate(validateStyle.filter,"layers."+layer.id+".filter",filter))return this;if(util.deepEqual(layer.filter,filter))return this;layer.filter=util.clone(filter);return this._updateLayer(layer)},getFilter:function(layer){return util.clone(this.getReferentLayer(layer).filter)},setLayoutProperty:function(layerId,name,value){this._checkLoaded();var layer=this.getReferentLayer(layerId);if(util.deepEqual(layer.getLayoutProperty(name),value))return this;layer.setLayoutProperty(name,value);return this._updateLayer(layer)},getLayoutProperty:function(layer,name){return this.getReferentLayer(layer).getLayoutProperty(name)},setPaintProperty:function(layerId,name,value,klass){this._checkLoaded();var layer=this.getLayer(layerId);if(util.deepEqual(layer.getPaintProperty(name,klass),value))return this;var wasFeatureConstant=layer.isPaintValueFeatureConstant(name);layer.setPaintProperty(name,value,klass);var isFeatureConstant=!(value&&StyleFunction.isFunctionDefinition(value)&&value.property!=="$zoom"&&value.property!==undefined);if(!isFeatureConstant||!wasFeatureConstant){this._updates.layers[layerId]=true;if(layer.source){this._updates.sources[layer.source]=true}}return this.updateClasses(layerId,name)},getPaintProperty:function(layer,name,klass){return this.getLayer(layer).getPaintProperty(name,klass)},updateClasses:function(layerId,paintName){this._updates.changed=true;if(!layerId){this._updates.allPaintProps=true}else{var props=this._updates.paintProps;if(!props[layerId])props[layerId]={};props[layerId][paintName||"all"]=true}return this},serialize:function(){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(source){return source.serialize()}),layers:this._order.map(function(id){return this._layers[id].serialize()},this)},function(value){return value!==undefined})},_updateLayer:function(layer){this._updates.layers[layer.id]=true;if(layer.source){this._updates.sources[layer.source]=true}this._updates.changed=true;return this},_flattenRenderedFeatures:function(sourceResults){var features=[];for(var l=this._order.length-1;l>=0;l--){var layerID=this._order[l];for(var s=0;s<sourceResults.length;s++){var layerFeatures=sourceResults[s][layerID];if(layerFeatures){for(var f=0;f<layerFeatures.length;f++){features.push(layerFeatures[f])}}}}return features},queryRenderedFeatures:function(queryGeometry,params,zoom,bearing){if(params&&params.filter){this._validate(validateStyle.filter,"queryRenderedFeatures.filter",params.filter)}var includedSources={};if(params&&params.layers){for(var i=0;i<params.layers.length;i++){var layer=this._layers[params.layers[i]];if(!(layer instanceof StyleLayer)){return this.fire("error",{error:"The layer '"+params.layers[i]+"' does not exist in the map's style and cannot be queried for features."})}includedSources[layer.source]=true}}var sourceResults=[];for(var id in this.sourceCaches){if(params.layers&&!includedSources[id])continue;var sourceCache=this.sourceCaches[id];var results=QueryFeatures.rendered(sourceCache,this._layers,queryGeometry,params,zoom,bearing);sourceResults.push(results)}return this._flattenRenderedFeatures(sourceResults)},querySourceFeatures:function(sourceID,params){if(params&&params.filter){this._validate(validateStyle.filter,"querySourceFeatures.filter",params.filter)}var sourceCache=this.sourceCaches[sourceID];return sourceCache?QueryFeatures.source(sourceCache,params):[]},addSourceType:function(name,SourceType,callback){if(Source.getType(name)){return callback(new Error('A source type called "'+name+'" already exists.'))}Source.setType(name,SourceType);if(!SourceType.workerSourceURL){return callback(null,null)}this.dispatcher.broadcast("load worker source",{name:name,url:SourceType.workerSourceURL},callback)},getLight:function(){return this.light.getLight()},setLight:function(lightOptions,transitionOptions){this._checkLoaded();var light=this.light.getLight();var _update=false;for(var key in lightOptions){if(!util.deepEqual(lightOptions[key],light[key])){_update=true;break}}if(!_update)return this;var transition=this.stylesheet.transition||{};this.light.setLight(lightOptions);return this.light.updateLightTransitions(transitionOptions||{transition:true},transition,this.animationLoop)},_validate:function(validate,key,value,props,options){if(options&&options.validate===false){return false}return validateStyle.emitErrors(this,validate.call(validateStyle,util.extend({key:key,style:this.serialize(),value:value,styleSpec:styleSpec},props)))},_remove:function(){for(var id in this.sourceCaches){this.sourceCaches[id].clearTiles()}this.dispatcher.remove()},_reloadSource:function(id){this.sourceCaches[id].reload()},_updateSources:function(transform){for(var id in this.sourceCaches){this.sourceCaches[id].update(transform)}},_redoPlacement:function(){for(var id in this.sourceCaches){if(this.sourceCaches[id].redoPlacement)this.sourceCaches[id].redoPlacement()}},"get icons":function(mapId,params,callback){var sprite=this.sprite;var spriteAtlas=this.spriteAtlas;if(sprite.loaded()){spriteAtlas.setSprite(sprite);spriteAtlas.addIcons(params.icons,callback)}else{sprite.on("data",function(){spriteAtlas.setSprite(sprite);spriteAtlas.addIcons(params.icons,callback)})}},"get glyphs":function(mapId,params,callback){var stacks=params.stacks,remaining=Object.keys(stacks).length,allGlyphs={};for(var fontName in stacks){this.glyphSource.getSimpleGlyphs(fontName,stacks[fontName],params.uid,done)}function done(err,glyphs,fontName){if(err)console.error(err);allGlyphs[fontName]=glyphs;remaining--;if(remaining===0)callback(null,allGlyphs)}}})},{"../global_worker_pool":31,"../render/line_atlas":45,"../source/query_features":56,"../source/source":58,"../source/source_cache":59,"../symbol/glyph_source":92,"../symbol/sprite_atlas":97,"../util/ajax":119,"../util/browser":120,"../util/dispatcher":126,"../util/evented":128,"../util/mapbox":134,"../util/util":137,"./animation_loop":67,"./image_sprite":68,"./light":69,"./style_function":73,"./style_layer":74,"./style_spec":81,"./validate_style":83}],72:[function(require,module,exports){"use strict";var MapboxGLFunction=require("./style_function");var parseColor=require("./parse_color");var util=require("../util/util");module.exports=StyleDeclaration;function StyleDeclaration(reference,value){this.value=util.clone(value);this.isFunction=MapboxGLFunction.isFunctionDefinition(value);this.json=JSON.stringify(this.value);var parsedValue=reference.type==="color"&&this.value?parseColor(this.value):value;var specDefault=reference.default;if(specDefault&&reference.type==="color")specDefault=parseColor(specDefault);this.calculate=MapboxGLFunction[reference.function||"piecewise-constant"](parsedValue);this.isFeatureConstant=this.calculate.isFeatureConstant;this.isZoomConstant=this.calculate.isZoomConstant;if(reference.type==="color"){this.calculate=wrapColorCalculate(this.calculate)}if(reference.function==="piecewise-constant"&&reference.transition){this.calculate=wrapTransitionedCalculate(this.calculate)}if(!this.isFeatureConstant&&!this.isZoomConstant){this.stopZoomLevels=[];var interpolationAmountStops=[];var stops=this.value.stops;for(var i=0;i<this.value.stops.length;i++){var zoom=stops[i][0].zoom;if(this.stopZoomLevels.indexOf(zoom)<0){this.stopZoomLevels.push(zoom);interpolationAmountStops.push([zoom,interpolationAmountStops.length])}}this.calculateInterpolationT=MapboxGLFunction.interpolated({stops:interpolationAmountStops,base:value.base,colorSpace:value.colorSpace})}}function wrapColorCalculate(calculate){return function(globalProperties,featureProperties){var color=calculate(globalProperties,featureProperties);return color&&parseColor(color)}}function wrapTransitionedCalculate(calculate){return function(globalProperties,featureProperties){var z=globalProperties.zoom;var zh=globalProperties.zoomHistory;var duration=globalProperties.duration;var fraction=z%1;var t=Math.min((Date.now()-zh.lastIntegerZoomTime)/duration,1);var fromScale=1;var toScale=1;var mix,from,to;if(z>zh.lastIntegerZoom){mix=fraction+(1-fraction)*t;fromScale*=2;from=calculate({zoom:z-1},featureProperties);to=calculate({zoom:z},featureProperties)}else{mix=1-(1-t)*fraction;to=calculate({zoom:z},featureProperties);from=calculate({zoom:z+1},featureProperties);fromScale/=2}if(from===undefined||to===undefined){return undefined}else{return{from:from,fromScale:fromScale,to:to,toScale:toScale,t:mix}}}}},{"../util/util":137,"./parse_color":70,"./style_function":73}],73:[function(require,module,exports){"use strict";var MapboxGLFunction=require("mapbox-gl-function");exports.interpolated=function(parameters,specDefault){var inner=MapboxGLFunction.interpolated(parameters,specDefault);var outer=function(globalProperties,featureProperties){return inner(globalProperties&&globalProperties.zoom,featureProperties||{})};outer.isFeatureConstant=inner.isFeatureConstant;outer.isZoomConstant=inner.isZoomConstant;return outer};exports["piecewise-constant"]=function(parameters,specDefault){var inner=MapboxGLFunction["piecewise-constant"](parameters,specDefault);var outer=function(globalProperties,featureProperties){return inner(globalProperties&&globalProperties.zoom,featureProperties||{})};outer.isFeatureConstant=inner.isFeatureConstant;outer.isZoomConstant=inner.isZoomConstant;return outer};exports.isFunctionDefinition=MapboxGLFunction.isFunctionDefinition},{"mapbox-gl-function":166}],74:[function(require,module,exports){"use strict";var util=require("../util/util");var StyleTransition=require("./style_transition");var StyleDeclaration=require("./style_declaration");var styleSpec=require("./style_spec");var validateStyle=require("./validate_style");var parseColor=require("./parse_color");var Evented=require("../util/evented");module.exports=StyleLayer;var TRANSITION_SUFFIX="-transition";function StyleLayer(layer,refLayer){this.set(layer,refLayer)}StyleLayer.prototype=util.inherit(Evented,{set:function(layer,refLayer){this.id=layer.id;this.ref=layer.ref;this.metadata=layer.metadata;this.type=(refLayer||layer).type;this.source=(refLayer||layer).source;this.sourceLayer=(refLayer||layer)["source-layer"];this.minzoom=(refLayer||layer).minzoom;this.maxzoom=(refLayer||layer).maxzoom;this.filter=(refLayer||layer).filter;this.paint={};this.layout={};this._paintSpecifications=styleSpec["paint_"+this.type];this._layoutSpecifications=styleSpec["layout_"+this.type];this._paintTransitions={};this._paintTransitionOptions={};this._paintDeclarations={};this._layoutDeclarations={};this._layoutFunctions={};var paintName,layoutName;var options={validate:false};for(var key in layer){var match=key.match(/^paint(?:\.(.*))?$/);if(match){var klass=match[1]||"";for(paintName in layer[key]){this.setPaintProperty(paintName,layer[key][paintName],klass,options)}}}if(this.ref){this._layoutDeclarations=refLayer._layoutDeclarations}else{for(layoutName in layer.layout){this.setLayoutProperty(layoutName,layer.layout[layoutName],options)}}for(paintName in this._paintSpecifications){this.paint[paintName]=this.getPaintValue(paintName)}for(layoutName in this._layoutSpecifications){this._updateLayoutValue(layoutName)}},setLayoutProperty:function(name,value,options){if(value==null){delete this._layoutDeclarations[name]}else{var key="layers."+this.id+".layout."+name;if(this._validate(validateStyle.layoutProperty,key,name,value,options))return;this._layoutDeclarations[name]=new StyleDeclaration(this._layoutSpecifications[name],value)}this._updateLayoutValue(name)},getLayoutProperty:function(name){return this._layoutDeclarations[name]&&this._layoutDeclarations[name].value},getLayoutValue:function(name,globalProperties,featureProperties){var specification=this._layoutSpecifications[name];var declaration=this._layoutDeclarations[name];if(declaration){return declaration.calculate(globalProperties,featureProperties)}else{return specification.default}},setPaintProperty:function(name,value,klass,options){var validateStyleKey="layers."+this.id+(klass?'["paint.'+klass+'"].':".paint.")+name;if(util.endsWith(name,TRANSITION_SUFFIX)){if(!this._paintTransitionOptions[klass||""]){this._paintTransitionOptions[klass||""]={}}if(value===null||value===undefined){delete this._paintTransitionOptions[klass||""][name]}else{if(this._validate(validateStyle.paintProperty,validateStyleKey,name,value,options))return;this._paintTransitionOptions[klass||""][name]=value}}else{if(!this._paintDeclarations[klass||""]){this._paintDeclarations[klass||""]={}}if(value===null||value===undefined){delete this._paintDeclarations[klass||""][name]}else{if(this._validate(validateStyle.paintProperty,validateStyleKey,name,value,options))return;this._paintDeclarations[klass||""][name]=new StyleDeclaration(this._paintSpecifications[name],value)}}},getPaintProperty:function(name,klass){klass=klass||"";if(util.endsWith(name,TRANSITION_SUFFIX)){return this._paintTransitionOptions[klass]&&this._paintTransitionOptions[klass][name]}else{return this._paintDeclarations[klass]&&this._paintDeclarations[klass][name]&&this._paintDeclarations[klass][name].value}},getPaintValue:function(name,globalProperties,featureProperties){var specification=this._paintSpecifications[name];var transition=this._paintTransitions[name];if(transition){return transition.calculate(globalProperties,featureProperties)}else if(specification.type==="color"&&specification.default){return parseColor(specification.default)}else{return specification.default}},getPaintValueStopZoomLevels:function(name){var transition=this._paintTransitions[name];if(transition){return transition.declaration.stopZoomLevels}else{return[]}},getPaintInterpolationT:function(name,zoom){var transition=this._paintTransitions[name];return transition.declaration.calculateInterpolationT({zoom:zoom})},isPaintValueFeatureConstant:function(name){var transition=this._paintTransitions[name];if(transition){return transition.declaration.isFeatureConstant}else{return true}},isLayoutValueFeatureConstant:function(name){var declaration=this._layoutDeclarations[name];if(declaration){return declaration.isFeatureConstant}else{return true}},isPaintValueZoomConstant:function(name){var transition=this._paintTransitions[name];if(transition){return transition.declaration.isZoomConstant}else{return true}},isHidden:function(zoom){if(this.minzoom&&zoom<this.minzoom)return true;if(this.maxzoom&&zoom>=this.maxzoom)return true;if(this.layout["visibility"]==="none")return true;return false},updatePaintTransitions:function(classes,options,globalOptions,animationLoop){var declarations=util.extend({},this._paintDeclarations[""]);for(var i=0;i<classes.length;i++){util.extend(declarations,this._paintDeclarations[classes[i]])}var name;for(name in declarations){this._applyPaintDeclaration(name,declarations[name],options,globalOptions,animationLoop)}for(name in this._paintTransitions){if(!(name in declarations))this._applyPaintDeclaration(name,null,options,globalOptions,animationLoop)}},updatePaintTransition:function(name,classes,options,globalOptions,animationLoop){var declaration=this._paintDeclarations[""][name];for(var i=0;i<classes.length;i++){var classPaintDeclarations=this._paintDeclarations[classes[i]];if(classPaintDeclarations&&classPaintDeclarations[name]){declaration=classPaintDeclarations[name]}}this._applyPaintDeclaration(name,declaration,options,globalOptions,animationLoop)},recalculate:function(zoom,zoomHistory){for(var paintName in this._paintTransitions){this.paint[paintName]=this.getPaintValue(paintName,{zoom:zoom,zoomHistory:zoomHistory})}for(var layoutName in this._layoutFunctions){this.layout[layoutName]=this.getLayoutValue(layoutName,{zoom:zoom,zoomHistory:zoomHistory})}},serialize:function(options){var output={id:this.id,ref:this.ref,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom};for(var klass in this._paintDeclarations){var key=klass===""?"paint":"paint."+klass;output[key]=util.mapObject(this._paintDeclarations[klass],getDeclarationValue)}if(!this.ref||options&&options.includeRefProperties){util.extend(output,{type:this.type,source:this.source,"source-layer":this.sourceLayer,filter:this.filter,layout:util.mapObject(this._layoutDeclarations,getDeclarationValue)})}return util.filterObject(output,function(value,key){return value!==undefined&&!(key==="layout"&&!Object.keys(value).length)})},_applyPaintDeclaration:function(name,declaration,options,globalOptions,animationLoop){var oldTransition=options.transition?this._paintTransitions[name]:undefined;var spec=this._paintSpecifications[name];if(declaration===null||declaration===undefined){declaration=new StyleDeclaration(spec,spec.default)}if(oldTransition&&oldTransition.declaration.json===declaration.json)return;var transitionOptions=util.extend({duration:300,delay:0},globalOptions,this.getPaintProperty(name+TRANSITION_SUFFIX));var newTransition=this._paintTransitions[name]=new StyleTransition(spec,declaration,oldTransition,transitionOptions);if(!newTransition.instant()){newTransition.loopID=animationLoop.set(newTransition.endTime-Date.now())}if(oldTransition){animationLoop.cancel(oldTransition.loopID)}},_updateLayoutValue:function(name){var declaration=this._layoutDeclarations[name];if(declaration&&declaration.isFunction){this._layoutFunctions[name]=true}else{delete this._layoutFunctions[name];this.layout[name]=this.getLayoutValue(name)}},_validate:function(validate,key,name,value,options){if(options&&options.validate===false){return false}return validateStyle.emitErrors(this,validate.call(validateStyle,{key:key,layerType:this.type,objectKey:name,value:value,styleSpec:styleSpec,style:{glyphs:true,sprite:true}}))}});function getDeclarationValue(declaration){return declaration.value}var Classes={background:require("./style_layer/background_style_layer"),circle:require("./style_layer/circle_style_layer"),fill:require("./style_layer/fill_style_layer"),line:require("./style_layer/line_style_layer"),raster:require("./style_layer/raster_style_layer"),symbol:require("./style_layer/symbol_style_layer")};StyleLayer.create=function(layer,refLayer){return new Classes[(refLayer||layer).type](layer,refLayer)}},{"../util/evented":128,"../util/util":137,"./parse_color":70,"./style_declaration":72,"./style_layer/background_style_layer":75,"./style_layer/circle_style_layer":76,"./style_layer/fill_style_layer":77,"./style_layer/line_style_layer":78,"./style_layer/raster_style_layer":79,"./style_layer/symbol_style_layer":80,"./style_spec":81,"./style_transition":82,"./validate_style":83}],75:[function(require,module,exports){"use strict";var util=require("../../util/util");var StyleLayer=require("../style_layer");function BackgroundStyleLayer(){StyleLayer.apply(this,arguments)}module.exports=BackgroundStyleLayer;BackgroundStyleLayer.prototype=util.inherit(StyleLayer,{})},{"../../util/util":137,"../style_layer":74}],76:[function(require,module,exports){"use strict";var util=require("../../util/util");var StyleLayer=require("../style_layer");function CircleStyleLayer(){StyleLayer.apply(this,arguments)}module.exports=CircleStyleLayer;CircleStyleLayer.prototype=util.inherit(StyleLayer,{})},{"../../util/util":137,"../style_layer":74}],77:[function(require,module,exports){"use strict";var util=require("../../util/util");var StyleLayer=require("../style_layer");function FillStyleLayer(){StyleLayer.apply(this,arguments)}FillStyleLayer.prototype=util.inherit(StyleLayer,{getPaintValue:function(name,globalProperties,featureProperties){if(name==="fill-outline-color"&&this.getPaintProperty("fill-outline-color")===undefined){return StyleLayer.prototype.getPaintValue.call(this,"fill-color",globalProperties,featureProperties)}else{return StyleLayer.prototype.getPaintValue.call(this,name,globalProperties,featureProperties)}},getPaintValueStopZoomLevels:function(name){if(name==="fill-outline-color"&&this.getPaintProperty("fill-outline-color")===undefined){return StyleLayer.prototype.getPaintValueStopZoomLevels.call(this,"fill-color")}else{return StyleLayer.prototype.getPaintValueStopZoomLevels.call(this,name)}},getPaintInterpolationT:function(name,zoom){if(name==="fill-outline-color"&&this.getPaintProperty("fill-outline-color")===undefined){return StyleLayer.prototype.getPaintInterpolationT.call(this,"fill-color",zoom)}else{return StyleLayer.prototype.getPaintInterpolationT.call(this,name,zoom)}},isPaintValueFeatureConstant:function(name){if(name==="fill-outline-color"&&this.getPaintProperty("fill-outline-color")===undefined){return StyleLayer.prototype.isPaintValueFeatureConstant.call(this,"fill-color")}else{return StyleLayer.prototype.isPaintValueFeatureConstant.call(this,name)}},isPaintValueZoomConstant:function(name){if(name==="fill-outline-color"&&this.getPaintProperty("fill-outline-color")===undefined){return StyleLayer.prototype.isPaintValueZoomConstant.call(this,"fill-color")}else{return StyleLayer.prototype.isPaintValueZoomConstant.call(this,name)}}});module.exports=FillStyleLayer},{"../../util/util":137,"../style_layer":74}],78:[function(require,module,exports){"use strict";var util=require("../../util/util");var StyleLayer=require("../style_layer");function LineStyleLayer(){StyleLayer.apply(this,arguments)}module.exports=LineStyleLayer;LineStyleLayer.prototype=util.inherit(StyleLayer,{getPaintValue:function(name,globalProperties,featureProperties){var value=StyleLayer.prototype.getPaintValue.apply(this,arguments);if(value&&name==="line-dasharray"){var flooredZoom=Math.floor(globalProperties.zoom);if(this._flooredZoom!==flooredZoom){this._flooredZoom=flooredZoom;this._flooredLineWidth=this.getPaintValue("line-width",globalProperties,featureProperties)}value.fromScale*=this._flooredLineWidth;value.toScale*=this._flooredLineWidth}return value}})},{"../../util/util":137,"../style_layer":74}],79:[function(require,module,exports){"use strict";var util=require("../../util/util");var StyleLayer=require("../style_layer");function RasterStyleLayer(){StyleLayer.apply(this,arguments)}module.exports=RasterStyleLayer;RasterStyleLayer.prototype=util.inherit(StyleLayer,{})},{"../../util/util":137,"../style_layer":74}],80:[function(require,module,exports){"use strict";var util=require("../../util/util");var StyleLayer=require("../style_layer");function SymbolStyleLayer(){StyleLayer.apply(this,arguments)}module.exports=SymbolStyleLayer;SymbolStyleLayer.prototype=util.inherit(StyleLayer,{getLayoutValue:function(name,globalProperties,featureProperties){var value=StyleLayer.prototype.getLayoutValue.apply(this,arguments);if(value!=="auto"){return value}switch(name){case"text-rotation-alignment":case"icon-rotation-alignment":return this.getLayoutValue("symbol-placement",globalProperties,featureProperties)==="line"?"map":"viewport";case"text-pitch-alignment":return this.getLayoutValue("text-rotation-alignment",globalProperties,featureProperties);default:return value}}})},{"../../util/util":137,"../style_layer":74}],81:[function(require,module,exports){"use strict";module.exports=require("mapbox-gl-style-spec/reference/latest.min")},{"mapbox-gl-style-spec/reference/latest.min":190
}],82:[function(require,module,exports){"use strict";var util=require("../util/util");var interpolate=require("../util/interpolate");module.exports=StyleTransition;function StyleTransition(reference,declaration,oldTransition,value){this.declaration=declaration;this.startTime=this.endTime=(new Date).getTime();if(reference.function==="piecewise-constant"&&reference.transition){this.interp=interpZoomTransitioned}else{this.interp=interpolate[reference.type]}this.oldTransition=oldTransition;this.duration=value.duration||0;this.delay=value.delay||0;if(!this.instant()){this.endTime=this.startTime+this.duration+this.delay;this.ease=util.easeCubicInOut}if(oldTransition&&oldTransition.endTime<=this.startTime){delete oldTransition.oldTransition}}StyleTransition.prototype.instant=function(){return!this.oldTransition||!this.interp||this.duration===0&&this.delay===0};StyleTransition.prototype.calculate=function(globalProperties,featureProperties){var value=this.declaration.calculate(util.extend({},globalProperties,{duration:this.duration}),featureProperties);if(this.instant())return value;var t=globalProperties.time||Date.now();if(t<this.endTime){var oldValue=this.oldTransition.calculate(util.extend({},globalProperties,{time:this.startTime}),featureProperties);var eased=this.ease((t-this.startTime-this.delay)/this.duration);value=this.interp(oldValue,value,eased)}return value};function interpZoomTransitioned(from,to,t){if((from&&from.to)===undefined||(to&&to.to)===undefined){return undefined}else{return{from:from.to,fromScale:from.toScale,to:to.to,toScale:to.toScale,t:t}}}},{"../util/interpolate":131,"../util/util":137}],83:[function(require,module,exports){"use strict";module.exports=require("mapbox-gl-style-spec/lib/validate_style.min");module.exports.emitErrors=function(emitter,errors){if(errors&&errors.length){for(var i=0;i<errors.length;i++){emitter.fire("error",{error:new Error(errors[i].message)})}return true}else{return false}}},{"mapbox-gl-style-spec/lib/validate_style.min":189}],84:[function(require,module,exports){"use strict";var Point=require("point-geometry");module.exports=Anchor;function Anchor(x,y,angle,segment){this.x=x;this.y=y;this.angle=angle;if(segment!==undefined){this.segment=segment}}Anchor.prototype=Object.create(Point.prototype);Anchor.prototype.clone=function(){return new Anchor(this.x,this.y,this.angle,this.segment)}},{"point-geometry":196}],85:[function(require,module,exports){"use strict";module.exports=checkMaxAngle;function checkMaxAngle(line,anchor,labelLength,windowSize,maxAngle){if(anchor.segment===undefined)return true;var p=anchor;var index=anchor.segment+1;var anchorDistance=0;while(anchorDistance>-labelLength/2){index--;if(index<0)return false;anchorDistance-=line[index].dist(p);p=line[index]}anchorDistance+=line[index].dist(line[index+1]);index++;var recentCorners=[];var recentAngleDelta=0;while(anchorDistance<labelLength/2){var prev=line[index-1];var current=line[index];var next=line[index+1];if(!next)return false;var angleDelta=prev.angleTo(current)-current.angleTo(next);angleDelta=Math.abs((angleDelta+3*Math.PI)%(Math.PI*2)-Math.PI);recentCorners.push({distance:anchorDistance,angleDelta:angleDelta});recentAngleDelta+=angleDelta;while(anchorDistance-recentCorners[0].distance>windowSize){recentAngleDelta-=recentCorners.shift().angleDelta}if(recentAngleDelta>maxAngle)return false;index++;anchorDistance+=current.dist(next)}return true}},{}],86:[function(require,module,exports){"use strict";var Point=require("point-geometry");module.exports=clipLine;function clipLine(lines,x1,y1,x2,y2){var clippedLines=[];for(var l=0;l<lines.length;l++){var line=lines[l];var clippedLine;for(var i=0;i<line.length-1;i++){var p0=line[i];var p1=line[i+1];if(p0.x<x1&&p1.x<x1){continue}else if(p0.x<x1){p0=new Point(x1,p0.y+(p1.y-p0.y)*((x1-p0.x)/(p1.x-p0.x)))._round()}else if(p1.x<x1){p1=new Point(x1,p0.y+(p1.y-p0.y)*((x1-p0.x)/(p1.x-p0.x)))._round()}if(p0.y<y1&&p1.y<y1){continue}else if(p0.y<y1){p0=new Point(p0.x+(p1.x-p0.x)*((y1-p0.y)/(p1.y-p0.y)),y1)._round()}else if(p1.y<y1){p1=new Point(p0.x+(p1.x-p0.x)*((y1-p0.y)/(p1.y-p0.y)),y1)._round()}if(p0.x>=x2&&p1.x>=x2){continue}else if(p0.x>=x2){p0=new Point(x2,p0.y+(p1.y-p0.y)*((x2-p0.x)/(p1.x-p0.x)))._round()}else if(p1.x>=x2){p1=new Point(x2,p0.y+(p1.y-p0.y)*((x2-p0.x)/(p1.x-p0.x)))._round()}if(p0.y>=y2&&p1.y>=y2){continue}else if(p0.y>=y2){p0=new Point(p0.x+(p1.x-p0.x)*((y2-p0.y)/(p1.y-p0.y)),y2)._round()}else if(p1.y>=y2){p1=new Point(p0.x+(p1.x-p0.x)*((y2-p0.y)/(p1.y-p0.y)),y2)._round()}if(!clippedLine||!p0.equals(clippedLine[clippedLine.length-1])){clippedLine=[p0];clippedLines.push(clippedLine)}clippedLine.push(p1)}}return clippedLines}},{"point-geometry":196}],87:[function(require,module,exports){"use strict";var StructArrayType=require("../util/struct_array");var util=require("../util/util");var Point=require("point-geometry");var CollisionBoxArray=module.exports=new StructArrayType({members:[{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:"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"}]});util.extendAll(CollisionBoxArray.prototype.StructType.prototype,{get anchorPoint(){return new Point(this.anchorPointX,this.anchorPointY)}})},{"../util/struct_array":135,"../util/util":137,"point-geometry":196}],88:[function(require,module,exports){"use strict";module.exports=CollisionFeature;function CollisionFeature(collisionBoxArray,line,anchor,featureIndex,sourceLayerIndex,bucketIndex,shaped,boxScale,padding,alignLine,straight){var y1=shaped.top*boxScale-padding;var y2=shaped.bottom*boxScale+padding;var x1=shaped.left*boxScale-padding;var x2=shaped.right*boxScale+padding;this.boxStartIndex=collisionBoxArray.length;if(alignLine){var height=y2-y1;var length=x2-x1;if(height>0){height=Math.max(10*boxScale,height);if(straight){var vector=line[anchor.segment+1].sub(line[anchor.segment])._unit()._mult(length);var straightLine=[anchor.sub(vector),anchor.add(vector)];this._addLineCollisionBoxes(collisionBoxArray,straightLine,anchor,0,length,height,featureIndex,sourceLayerIndex,bucketIndex)}else{this._addLineCollisionBoxes(collisionBoxArray,line,anchor,anchor.segment,length,height,featureIndex,sourceLayerIndex,bucketIndex)}}}else{collisionBoxArray.emplaceBack(anchor.x,anchor.y,x1,y1,x2,y2,Infinity,featureIndex,sourceLayerIndex,bucketIndex,0,0,0,0,0)}this.boxEndIndex=collisionBoxArray.length}CollisionFeature.prototype._addLineCollisionBoxes=function(collisionBoxArray,line,anchor,segment,labelLength,boxSize,featureIndex,sourceLayerIndex,bucketIndex){var step=boxSize/2;var nBoxes=Math.floor(labelLength/step);var firstBoxOffset=-boxSize/2;var bboxes=this.boxes;var p=anchor;var index=segment+1;var anchorDistance=firstBoxOffset;do{index--;if(index<0)return bboxes;anchorDistance-=line[index].dist(p);p=line[index]}while(anchorDistance>-labelLength/2);var segmentLength=line[index].dist(line[index+1]);for(var i=0;i<nBoxes;i++){var boxDistanceToAnchor=-labelLength/2+i*step;while(anchorDistance+segmentLength<boxDistanceToAnchor){anchorDistance+=segmentLength;index++;if(index+1>=line.length)return bboxes;segmentLength=line[index].dist(line[index+1])}var segmentBoxDistance=boxDistanceToAnchor-anchorDistance;var p0=line[index];var p1=line[index+1];var boxAnchorPoint=p1.sub(p0)._unit()._mult(segmentBoxDistance)._add(p0)._round();var distanceToInnerEdge=Math.max(Math.abs(boxDistanceToAnchor-firstBoxOffset)-step/2,0);var maxScale=labelLength/2/distanceToInnerEdge;collisionBoxArray.emplaceBack(boxAnchorPoint.x,boxAnchorPoint.y,-boxSize/2,-boxSize/2,boxSize/2,boxSize/2,maxScale,featureIndex,sourceLayerIndex,bucketIndex,0,0,0,0,0)}return bboxes}},{}],89:[function(require,module,exports){"use strict";var Point=require("point-geometry");var EXTENT=require("../data/bucket").EXTENT;var Grid=require("grid-index");module.exports=CollisionTile;function CollisionTile(angle,pitch,collisionBoxArray){if(typeof angle==="object"){var serialized=angle;collisionBoxArray=pitch;angle=serialized.angle;pitch=serialized.pitch;this.grid=new Grid(serialized.grid);this.ignoredGrid=new Grid(serialized.ignoredGrid)}else{this.grid=new Grid(EXTENT,12,6);this.ignoredGrid=new Grid(EXTENT,12,0)}this.angle=angle;this.pitch=pitch;var sin=Math.sin(angle),cos=Math.cos(angle);this.rotationMatrix=[cos,-sin,sin,cos];this.reverseRotationMatrix=[cos,sin,-sin,cos];this.yStretch=1/Math.cos(pitch/180*Math.PI);this.yStretch=Math.pow(this.yStretch,1.3);this.collisionBoxArray=collisionBoxArray;if(collisionBoxArray.length===0){collisionBoxArray.emplaceBack();var maxInt16=32767;collisionBoxArray.emplaceBack(0,0,0,-maxInt16,0,maxInt16,maxInt16,0,0,0,0,0,0,0,0,0);collisionBoxArray.emplaceBack(EXTENT,0,0,-maxInt16,0,maxInt16,maxInt16,0,0,0,0,0,0,0,0,0);collisionBoxArray.emplaceBack(0,0,-maxInt16,0,maxInt16,0,maxInt16,0,0,0,0,0,0,0,0,0);collisionBoxArray.emplaceBack(0,EXTENT,-maxInt16,0,maxInt16,0,maxInt16,0,0,0,0,0,0,0,0,0)}this.tempCollisionBox=collisionBoxArray.get(0);this.edges=[collisionBoxArray.get(1),collisionBoxArray.get(2),collisionBoxArray.get(3),collisionBoxArray.get(4)]}CollisionTile.prototype.serialize=function(){var data={angle:this.angle,pitch:this.pitch,grid:this.grid.toArrayBuffer(),ignoredGrid:this.ignoredGrid.toArrayBuffer()};return{data:data,transferables:[data.grid,data.ignoredGrid]}};CollisionTile.prototype.minScale=.25;CollisionTile.prototype.maxScale=2;CollisionTile.prototype.placeCollisionFeature=function(collisionFeature,allowOverlap,avoidEdges){var collisionBoxArray=this.collisionBoxArray;var minPlacementScale=this.minScale;var rotationMatrix=this.rotationMatrix;var yStretch=this.yStretch;for(var b=collisionFeature.boxStartIndex;b<collisionFeature.boxEndIndex;b++){var box=collisionBoxArray.get(b);var anchorPoint=box.anchorPoint._matMult(rotationMatrix);var x=anchorPoint.x;var y=anchorPoint.y;var x1=x+box.x1;var y1=y+box.y1*yStretch;var x2=x+box.x2;var y2=y+box.y2*yStretch;box.bbox0=x1;box.bbox1=y1;box.bbox2=x2;box.bbox3=y2;if(!allowOverlap){var blockingBoxes=this.grid.query(x1,y1,x2,y2);for(var i=0;i<blockingBoxes.length;i++){var blocking=collisionBoxArray.get(blockingBoxes[i]);var blockingAnchorPoint=blocking.anchorPoint._matMult(rotationMatrix);minPlacementScale=this.getPlacementScale(minPlacementScale,anchorPoint,box,blockingAnchorPoint,blocking);if(minPlacementScale>=this.maxScale){return minPlacementScale}}}if(avoidEdges){var rotatedCollisionBox;if(this.angle){var reverseRotationMatrix=this.reverseRotationMatrix;var tl=new Point(box.x1,box.y1).matMult(reverseRotationMatrix);var tr=new Point(box.x2,box.y1).matMult(reverseRotationMatrix);var bl=new Point(box.x1,box.y2).matMult(reverseRotationMatrix);var br=new Point(box.x2,box.y2).matMult(reverseRotationMatrix);rotatedCollisionBox=this.tempCollisionBox;rotatedCollisionBox.anchorPointX=box.anchorPoint.x;rotatedCollisionBox.anchorPointY=box.anchorPoint.y;rotatedCollisionBox.x1=Math.min(tl.x,tr.x,bl.x,br.x);rotatedCollisionBox.y1=Math.min(tl.y,tr.x,bl.x,br.x);rotatedCollisionBox.x2=Math.max(tl.x,tr.x,bl.x,br.x);rotatedCollisionBox.y2=Math.max(tl.y,tr.x,bl.x,br.x);rotatedCollisionBox.maxScale=box.maxScale}else{rotatedCollisionBox=box}for(var k=0;k<this.edges.length;k++){var edgeBox=this.edges[k];minPlacementScale=this.getPlacementScale(minPlacementScale,box.anchorPoint,rotatedCollisionBox,edgeBox.anchorPoint,edgeBox);if(minPlacementScale>=this.maxScale){return minPlacementScale}}}}return minPlacementScale};CollisionTile.prototype.queryRenderedSymbols=function(minX,minY,maxX,maxY,scale){var sourceLayerFeatures={};var result=[];var collisionBoxArray=this.collisionBoxArray;var rotationMatrix=this.rotationMatrix;var anchorPoint=new Point(minX,minY)._matMult(rotationMatrix);var queryBox=this.tempCollisionBox;queryBox.anchorX=anchorPoint.x;queryBox.anchorY=anchorPoint.y;queryBox.x1=0;queryBox.y1=0;queryBox.x2=maxX-minX;queryBox.y2=maxY-minY;queryBox.maxScale=scale;scale=queryBox.maxScale;var searchBox=[anchorPoint.x+queryBox.x1/scale,anchorPoint.y+queryBox.y1/scale*this.yStretch,anchorPoint.x+queryBox.x2/scale,anchorPoint.y+queryBox.y2/scale*this.yStretch];var blockingBoxKeys=this.grid.query(searchBox[0],searchBox[1],searchBox[2],searchBox[3]);var blockingBoxKeys2=this.ignoredGrid.query(searchBox[0],searchBox[1],searchBox[2],searchBox[3]);for(var k=0;k<blockingBoxKeys2.length;k++){blockingBoxKeys.push(blockingBoxKeys2[k])}for(var i=0;i<blockingBoxKeys.length;i++){var blocking=collisionBoxArray.get(blockingBoxKeys[i]);var sourceLayer=blocking.sourceLayerIndex;var featureIndex=blocking.featureIndex;if(sourceLayerFeatures[sourceLayer]===undefined){sourceLayerFeatures[sourceLayer]={}}if(!sourceLayerFeatures[sourceLayer][featureIndex]){var blockingAnchorPoint=blocking.anchorPoint.matMult(rotationMatrix);var minPlacementScale=this.getPlacementScale(this.minScale,anchorPoint,queryBox,blockingAnchorPoint,blocking);if(minPlacementScale>=scale){sourceLayerFeatures[sourceLayer][featureIndex]=true;result.push(blockingBoxKeys[i])}}}return result};CollisionTile.prototype.getPlacementScale=function(minPlacementScale,anchorPoint,box,blockingAnchorPoint,blocking){var anchorDiffX=anchorPoint.x-blockingAnchorPoint.x;var anchorDiffY=anchorPoint.y-blockingAnchorPoint.y;var s1=(blocking.x1-box.x2)/anchorDiffX;var s2=(blocking.x2-box.x1)/anchorDiffX;var s3=(blocking.y1-box.y2)*this.yStretch/anchorDiffY;var s4=(blocking.y2-box.y1)*this.yStretch/anchorDiffY;if(isNaN(s1)||isNaN(s2))s1=s2=1;if(isNaN(s3)||isNaN(s4))s3=s4=1;var collisionFreeScale=Math.min(Math.max(s1,s2),Math.max(s3,s4));var blockingMaxScale=blocking.maxScale;var boxMaxScale=box.maxScale;if(collisionFreeScale>blockingMaxScale){collisionFreeScale=blockingMaxScale}if(collisionFreeScale>boxMaxScale){collisionFreeScale=boxMaxScale}if(collisionFreeScale>minPlacementScale&&collisionFreeScale>=blocking.placementScale){minPlacementScale=collisionFreeScale}return minPlacementScale};CollisionTile.prototype.insertCollisionFeature=function(collisionFeature,minPlacementScale,ignorePlacement){var grid=ignorePlacement?this.ignoredGrid:this.grid;var collisionBoxArray=this.collisionBoxArray;for(var k=collisionFeature.boxStartIndex;k<collisionFeature.boxEndIndex;k++){var box=collisionBoxArray.get(k);box.placementScale=minPlacementScale;if(minPlacementScale<this.maxScale){grid.insert(k,box.bbox0,box.bbox1,box.bbox2,box.bbox3)}}}},{"../data/bucket":17,"grid-index":164,"point-geometry":196}],90:[function(require,module,exports){"use strict";var interpolate=require("../util/interpolate");var Anchor=require("../symbol/anchor");var checkMaxAngle=require("./check_max_angle");module.exports=getAnchors;function getAnchors(line,spacing,maxAngle,shapedText,shapedIcon,glyphSize,boxScale,overscaling,tileExtent){var angleWindowSize=shapedText?3/5*glyphSize*boxScale:0;var labelLength=Math.max(shapedText?shapedText.right-shapedText.left:0,shapedIcon?shapedIcon.right-shapedIcon.left:0);var isLineContinued=line[0].x===0||line[0].x===tileExtent||line[0].y===0||line[0].y===tileExtent;if(spacing-labelLength*boxScale<spacing/4){spacing=labelLength*boxScale+spacing/4}var fixedExtraOffset=glyphSize*2;var offset=!isLineContinued?(labelLength/2+fixedExtraOffset)*boxScale*overscaling%spacing:spacing/2*overscaling%spacing;return resample(line,offset,spacing,angleWindowSize,maxAngle,labelLength*boxScale,isLineContinued,false,tileExtent)}function resample(line,offset,spacing,angleWindowSize,maxAngle,labelLength,isLineContinued,placeAtMiddle,tileExtent){var halfLabelLength=labelLength/2;var lineLength=0;for(var k=0;k<line.length-1;k++){lineLength+=line[k].dist(line[k+1])}var distance=0,markedDistance=offset-spacing;var anchors=[];for(var i=0;i<line.length-1;i++){var a=line[i],b=line[i+1];var segmentDist=a.dist(b),angle=b.angleTo(a);while(markedDistance+spacing<distance+segmentDist){markedDistance+=spacing;var t=(markedDistance-distance)/segmentDist,x=interpolate(a.x,b.x,t),y=interpolate(a.y,b.y,t);if(x>=0&&x<tileExtent&&y>=0&&y<tileExtent&&markedDistance-halfLabelLength>=0&&markedDistance+halfLabelLength<=lineLength){var anchor=new Anchor(x,y,angle,i)._round();if(!angleWindowSize||checkMaxAngle(line,anchor,labelLength,angleWindowSize,maxAngle)){anchors.push(anchor)}}}distance+=segmentDist}if(!placeAtMiddle&&!anchors.length&&!isLineContinued){anchors=resample(line,distance/2,spacing,angleWindowSize,maxAngle,labelLength,isLineContinued,true,tileExtent)}return anchors}},{"../symbol/anchor":84,"../util/interpolate":131,"./check_max_angle":85}],91:[function(require,module,exports){"use strict";var ShelfPack=require("shelf-pack");var util=require("../util/util");var SIZE_GROWTH_RATE=4;var DEFAULT_SIZE=128;var MAX_SIZE=2048;module.exports=GlyphAtlas;function GlyphAtlas(){this.width=DEFAULT_SIZE;this.height=DEFAULT_SIZE;this.bin=new ShelfPack(this.width,this.height);this.index={};this.ids={};this.data=new Uint8Array(this.width*this.height)}GlyphAtlas.prototype.getGlyphs=function(){var glyphs={},split,name,id;for(var key in this.ids){split=key.split("#");name=split[0];id=split[1];if(!glyphs[name])glyphs[name]=[];glyphs[name].push(id)}return glyphs};GlyphAtlas.prototype.getRects=function(){var rects={},split,name,id;for(var key in this.ids){split=key.split("#");name=split[0];id=split[1];if(!rects[name])rects[name]={};rects[name][id]=this.index[key]}return rects};GlyphAtlas.prototype.addGlyph=function(id,name,glyph,buffer){if(!glyph)return null;var key=name+"#"+glyph.id;if(this.index[key]){if(this.ids[key].indexOf(id)<0){this.ids[key].push(id)}return this.index[key]}if(!glyph.bitmap){return null}var bufferedWidth=glyph.width+buffer*2;var bufferedHeight=glyph.height+buffer*2;var padding=1;var packWidth=bufferedWidth+2*padding;var packHeight=bufferedHeight+2*padding;packWidth+=4-packWidth%4;packHeight+=4-packHeight%4;var rect=this.bin.packOne(packWidth,packHeight);if(!rect){this.resize();rect=this.bin.packOne(packWidth,packHeight)}if(!rect){util.warnOnce("glyph bitmap overflow");return null}this.index[key]=rect;this.ids[key]=[id];var target=this.data;var source=glyph.bitmap;for(var y=0;y<bufferedHeight;y++){var y1=this.width*(rect.y+y+padding)+rect.x+padding;var y2=bufferedWidth*y;for(var x=0;x<bufferedWidth;x++){target[y1+x]=source[y2+x]}}this.dirty=true;return rect};GlyphAtlas.prototype.resize=function(){var prevWidth=this.width;var prevHeight=this.height;if(prevWidth>=MAX_SIZE||prevHeight>=MAX_SIZE)return;if(this.texture){if(this.gl){this.gl.deleteTexture(this.texture)}this.texture=null}this.width*=SIZE_GROWTH_RATE;this.height*=SIZE_GROWTH_RATE;this.bin.resize(this.width,this.height);var buf=new ArrayBuffer(this.width*this.height);for(var i=0;i<prevHeight;i++){var src=new Uint8Array(this.data.buffer,prevHeight*i,prevWidth);var dst=new Uint8Array(buf,prevHeight*i*SIZE_GROWTH_RATE,prevWidth);dst.set(src)}this.data=new Uint8Array(buf)};GlyphAtlas.prototype.bind=function(gl){this.gl=gl;if(!this.texture){this.texture=gl.createTexture();gl.bindTexture(gl.TEXTURE_2D,this.texture);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.LINEAR);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.LINEAR);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE);gl.texImage2D(gl.TEXTURE_2D,0,gl.ALPHA,this.width,this.height,0,gl.ALPHA,gl.UNSIGNED_BYTE,null)}else{gl.bindTexture(gl.TEXTURE_2D,this.texture)}};GlyphAtlas.prototype.updateTexture=function(gl){this.bind(gl);if(this.dirty){gl.texSubImage2D(gl.TEXTURE_2D,0,0,0,this.width,this.height,gl.ALPHA,gl.UNSIGNED_BYTE,this.data);this.dirty=false}}},{"../util/util":137,"shelf-pack":198}],92:[function(require,module,exports){"use strict";var normalizeURL=require("../util/mapbox").normalizeGlyphsURL;var ajax=require("../util/ajax");var Glyphs=require("../util/glyphs");var GlyphAtlas=require("../symbol/glyph_atlas");var Protobuf=require("pbf");module.exports=GlyphSource;function GlyphSource(url){this.url=url&&normalizeURL(url);this.atlases={};this.stacks={};this.loading={}}GlyphSource.prototype.getSimpleGlyphs=function(fontstack,glyphIDs,uid,callback){if(this.stacks[fontstack]===undefined){this.stacks[fontstack]={}}if(this.atlases[fontstack]===undefined){this.atlases[fontstack]=new GlyphAtlas}var glyphs={};var stack=this.stacks[fontstack];var atlas=this.atlases[fontstack];var buffer=3;var missing={};var remaining=0;var range;for(var i=0;i<glyphIDs.length;i++){var glyphID=glyphIDs[i];range=Math.floor(glyphID/256);if(stack[range]){var glyph=stack[range].glyphs[glyphID];var rect=atlas.addGlyph(uid,fontstack,glyph,buffer);if(glyph)glyphs[glyphID]=new SimpleGlyph(glyph,rect,buffer)}else{if(missing[range]===undefined){missing[range]=[];remaining++}missing[range].push(glyphID)}}if(!remaining)callback(undefined,glyphs,fontstack);var onRangeLoaded=function(err,range,data){if(!err){var stack=this.stacks[fontstack][range]=data.stacks[0];for(var i=0;i<missing[range].length;i++){var glyphID=missing[range][i];var glyph=stack.glyphs[glyphID];var rect=atlas.addGlyph(uid,fontstack,glyph,buffer);if(glyph)glyphs[glyphID]=new SimpleGlyph(glyph,rect,buffer)}}remaining--;if(!remaining)callback(undefined,glyphs,fontstack)}.bind(this);for(var r in missing){this.loadRange(fontstack,r,onRangeLoaded)}};function SimpleGlyph(glyph,rect,buffer){var padding=1;this.advance=glyph.advance;this.left=glyph.left-buffer-padding;this.top=glyph.top+buffer+padding;this.rect=rect}GlyphSource.prototype.loadRange=function(fontstack,range,callback){if(range*256>65535)return callback("glyphs > 65535 not supported");if(this.loading[fontstack]===undefined){this.loading[fontstack]={}}var loading=this.loading[fontstack];if(loading[range]){loading[range].push(callback)}else{loading[range]=[callback];var rangeName=range*256+"-"+(range*256+255);var url=glyphUrl(fontstack,rangeName,this.url);ajax.getArrayBuffer(url,function(err,data){var glyphs=!err&&new Glyphs(new Protobuf(data));for(var i=0;i<loading[range].length;i++){loading[range][i](err,range,glyphs)}delete loading[range]})}};GlyphSource.prototype.getGlyphAtlas=function(fontstack){return this.atlases[fontstack]};function glyphUrl(fontstack,range,url,subdomains){subdomains=subdomains||"abc";return url.replace("{s}",subdomains[fontstack.length%subdomains.length]).replace("{fontstack}",fontstack).replace("{range}",range)}},{"../symbol/glyph_atlas":91,"../util/ajax":119,"../util/glyphs":130,"../util/mapbox":134,pbf:194}],93:[function(require,module,exports){"use strict";module.exports=function(features,textFeatures,geometries){var leftIndex={},rightIndex={},mergedFeatures=[],mergedGeom=[],mergedTexts=[],mergedIndex=0,k;function add(k){mergedFeatures.push(features[k]);mergedGeom.push(geometries[k]);mergedTexts.push(textFeatures[k]);mergedIndex++}function mergeFromRight(leftKey,rightKey,geom){var i=rightIndex[leftKey];delete rightIndex[leftKey];rightIndex[rightKey]=i;mergedGeom[i][0].pop();mergedGeom[i][0]=mergedGeom[i][0].concat(geom[0]);return i}function mergeFromLeft(leftKey,rightKey,geom){var i=leftIndex[rightKey];delete leftIndex[rightKey];leftIndex[leftKey]=i;mergedGeom[i][0].shift();mergedGeom[i][0]=geom[0].concat(mergedGeom[i][0]);return i}function getKey(text,geom,onRight){var point=onRight?geom[0][geom[0].length-1]:geom[0][0];return text+":"+point.x+":"+point.y}for(k=0;k<features.length;k++){var geom=geometries[k],text=textFeatures[k];if(!text){add(k);continue}var leftKey=getKey(text,geom),rightKey=getKey(text,geom,true);if(leftKey in rightIndex&&rightKey in leftIndex&&rightIndex[leftKey]!==leftIndex[rightKey]){var j=mergeFromLeft(leftKey,rightKey,geom);var i=mergeFromRight(leftKey,rightKey,mergedGeom[j]);delete leftIndex[leftKey];delete rightIndex[rightKey];rightIndex[getKey(text,mergedGeom[i],true)]=i;mergedGeom[j]=null}else if(leftKey in rightIndex){mergeFromRight(leftKey,rightKey,geom)}else if(rightKey in leftIndex){mergeFromLeft(leftKey,rightKey,geom)}else{add(k);leftIndex[leftKey]=mergedIndex-1;rightIndex[rightKey]=mergedIndex-1}}return{features:mergedFeatures,textFeatures:mergedTexts,geometries:mergedGeom}}},{}],94:[function(require,module,exports){"use strict";var Point=require("point-geometry");module.exports={getIconQuads:getIconQuads,getGlyphQuads:getGlyphQuads,SymbolQuad:SymbolQuad};var minScale=.5;function SymbolQuad(anchorPoint,tl,tr,bl,br,tex,anchorAngle,glyphAngle,minScale,maxScale){this.anchorPoint=anchorPoint;this.tl=tl;this.tr=tr;this.bl=bl;this.br=br;this.tex=tex;this.anchorAngle=anchorAngle;this.glyphAngle=glyphAngle;this.minScale=minScale;this.maxScale=maxScale}function getIconQuads(anchor,shapedIcon,boxScale,line,layer,alongLine,shapedText,globalProperties,featureProperties){var rect=shapedIcon.image.rect;var layout=layer.layout;var border=1;var left=shapedIcon.left-border;var right=left+rect.w/shapedIcon.image.pixelRatio;var top=shapedIcon.top-border;var bottom=top+rect.h/shapedIcon.image.pixelRatio;var tl,tr,br,bl;if(layout["icon-text-fit"]!=="none"&&shapedText){var iconWidth=right-left,iconHeight=bottom-top,size=layout["text-size"]/24,textLeft=shapedText.left*size,textRight=shapedText.right*size,textTop=shapedText.top*size,textBottom=shapedText.bottom*size,textWidth=textRight-textLeft,textHeight=textBottom-textTop,padT=layout["icon-text-fit-padding"][0],padR=layout["icon-text-fit-padding"][1],padB=layout["icon-text-fit-padding"][2],padL=layout["icon-text-fit-padding"][3],offsetY=layout["icon-text-fit"]==="width"?(textHeight-iconHeight)*.5:0,offsetX=layout["icon-text-fit"]==="height"?(textWidth-iconWidth)*.5:0,width=layout["icon-text-fit"]==="width"||layout["icon-text-fit"]==="both"?textWidth:iconWidth,height=layout["icon-text-fit"]==="height"||layout["icon-text-fit"]==="both"?textHeight:iconHeight;tl=new Point(textLeft+offsetX-padL,textTop+offsetY-padT);tr=new Point(textLeft+offsetX+padR+width,textTop+offsetY-padT);br=new Point(textLeft+offsetX+padR+width,textTop+offsetY+padB+height);bl=new Point(textLeft+offsetX-padL,textTop+offsetY+padB+height)}else{tl=new Point(left,top);tr=new Point(right,top);br=new Point(right,bottom);bl=new Point(left,bottom)}var angle=layer.getLayoutValue("icon-rotate",globalProperties,featureProperties)*Math.PI/180;if(alongLine){var prev=line[anchor.segment];if(anchor.y===prev.y&&anchor.x===prev.x&&anchor.segment+1<line.length){var next=line[anchor.segment+1];angle+=Math.atan2(anchor.y-next.y,anchor.x-next.x)+Math.PI}else{angle+=Math.atan2(anchor.y-prev.y,anchor.x-prev.x)}}if(angle){var sin=Math.sin(angle),cos=Math.cos(angle),matrix=[cos,-sin,sin,cos];tl=tl.matMult(matrix);tr=tr.matMult(matrix);bl=bl.matMult(matrix);br=br.matMult(matrix)}return[new SymbolQuad(new Point(anchor.x,anchor.y),tl,tr,bl,br,shapedIcon.image.rect,0,0,minScale,Infinity)]}function getGlyphQuads(anchor,shaping,boxScale,line,layer,alongLine){var textRotate=layer.layout["text-rotate"]*Math.PI/180;var keepUpright=layer.layout["text-keep-upright"];var positionedGlyphs=shaping.positionedGlyphs;var quads=[];for(var k=0;k<positionedGlyphs.length;k++){var positionedGlyph=positionedGlyphs[k];var glyph=positionedGlyph.glyph;if(!glyph)continue;var rect=glyph.rect;if(!rect)continue;var centerX=(positionedGlyph.x+glyph.advance/2)*boxScale;var glyphInstances;var labelMinScale=minScale;if(alongLine){glyphInstances=[];labelMinScale=getSegmentGlyphs(glyphInstances,anchor,centerX,line,anchor.segment,true);if(keepUpright){labelMinScale=Math.min(labelMinScale,getSegmentGlyphs(glyphInstances,anchor,centerX,line,anchor.segment,false))}}else{glyphInstances=[{anchorPoint:new Point(anchor.x,anchor.y),offset:0,angle:0,maxScale:Infinity,minScale:minScale}]}var x1=positionedGlyph.x+glyph.left,y1=positionedGlyph.y-glyph.top,x2=x1+rect.w,y2=y1+rect.h,otl=new Point(x1,y1),otr=new Point(x2,y1),obl=new Point(x1,y2),obr=new Point(x2,y2);for(var i=0;i<glyphInstances.length;i++){var instance=glyphInstances[i],tl=otl,tr=otr,bl=obl,br=obr;if(textRotate){var sin=Math.sin(textRotate),cos=Math.cos(textRotate),matrix=[cos,-sin,sin,cos];tl=tl.matMult(matrix);tr=tr.matMult(matrix);bl=bl.matMult(matrix);br=br.matMult(matrix)}var glyphMinScale=Math.max(instance.minScale,labelMinScale);var anchorAngle=(anchor.angle+instance.offset+2*Math.PI)%(2*Math.PI);var glyphAngle=(instance.angle+instance.offset+2*Math.PI)%(2*Math.PI);quads.push(new SymbolQuad(instance.anchorPoint,tl,tr,bl,br,rect,anchorAngle,glyphAngle,glyphMinScale,instance.maxScale))}}return quads}function getSegmentGlyphs(glyphs,anchor,offset,line,segment,forward){var upsideDown=!forward;if(offset<0)forward=!forward;if(forward)segment++;var newAnchorPoint=new Point(anchor.x,anchor.y);var end=line[segment];var prevScale=Infinity;offset=Math.abs(offset);var placementScale=minScale;while(true){var distance=newAnchorPoint.dist(end);var scale=offset/distance;var angle=Math.atan2(end.y-newAnchorPoint.y,end.x-newAnchorPoint.x);if(!forward)angle+=Math.PI;glyphs.push({anchorPoint:newAnchorPoint,offset:upsideDown?Math.PI:0,minScale:scale,maxScale:prevScale,angle:(angle+2*Math.PI)%(2*Math.PI)});if(scale<=placementScale)break;newAnchorPoint=end;while(newAnchorPoint.equals(end)){segment+=forward?1:-1;end=line[segment];if(!end){return scale}}var unit=end.sub(newAnchorPoint)._unit();newAnchorPoint=newAnchorPoint.sub(unit._mult(distance));prevScale=scale}return placementScale}},{"point-geometry":196}],95:[function(require,module,exports){"use strict";var resolveTokens=require("../util/token");module.exports=resolveText;function resolveText(features,layoutProperties,codepoints){var textFeatures=[];for(var i=0,fl=features.length;i<fl;i++){var text=resolveTokens(features[i].properties,layoutProperties["text-field"]);if(!text){textFeatures[i]=null;continue}text=text.toString();var transform=layoutProperties["text-transform"];if(transform==="uppercase"){text=text.toLocaleUpperCase()}else if(transform==="lowercase"){text=text.toLocaleLowerCase()}for(var j=0;j<text.length;j++){codepoints[text.charCodeAt(j)]=true}textFeatures[i]=text}return textFeatures}},{"../util/token":136}],96:[function(require,module,exports){"use strict";module.exports={shapeText:shapeText,shapeIcon:shapeIcon};function PositionedGlyph(codePoint,x,y,glyph){this.codePoint=codePoint;this.x=x;this.y=y;this.glyph=glyph||null}function Shaping(positionedGlyphs,text,top,bottom,left,right){this.positionedGlyphs=positionedGlyphs;this.text=text;this.top=top;this.bottom=bottom;this.left=left;this.right=right}var newLine=10;function shapeText(text,glyphs,maxWidth,lineHeight,horizontalAlign,verticalAlign,justify,spacing,translate){var positionedGlyphs=[];var shaping=new Shaping(positionedGlyphs,text,translate[1],translate[1],translate[0],translate[0]);var yOffset=-17;var x=0;var y=yOffset;text=text.trim();for(var i=0;i<text.length;i++){var codePoint=text.charCodeAt(i);var glyph=glyphs[codePoint];if(!glyph&&codePoint!==newLine)continue;positionedGlyphs.push(new PositionedGlyph(codePoint,x,y,glyph));if(glyph){x+=glyph.advance+spacing}}if(!positionedGlyphs.length)return false;linewrap(shaping,glyphs,lineHeight,maxWidth,horizontalAlign,verticalAlign,justify,translate);return shaping}var invisible={32:true,8203:true};var breakable={32:true,38:true,43:true,45:true,47:true,173:true,183:true,8203:true,8208:true,8211:true};invisible[newLine]=breakable[newLine]=true;function linewrap(shaping,glyphs,lineHeight,maxWidth,horizontalAlign,verticalAlign,justify,translate){var lastSafeBreak=null;var lengthBeforeCurrentLine=0;var lineStartIndex=0;var line=0;var maxLineLength=0;var positionedGlyphs=shaping.positionedGlyphs;if(maxWidth){for(var i=0;i<positionedGlyphs.length;i++){var positionedGlyph=positionedGlyphs[i];positionedGlyph.x-=lengthBeforeCurrentLine;positionedGlyph.y+=lineHeight*line;if(lastSafeBreak!==null&&(positionedGlyph.x>maxWidth||positionedGlyphs[lastSafeBreak].codePoint===newLine)){var lineLength=positionedGlyphs[lastSafeBreak+1].x;
maxLineLength=Math.max(lineLength,maxLineLength);for(var k=lastSafeBreak+1;k<=i;k++){positionedGlyphs[k].y+=lineHeight;positionedGlyphs[k].x-=lineLength}if(justify){var lineEnd=lastSafeBreak;if(invisible[positionedGlyphs[lastSafeBreak].codePoint]){lineEnd--}justifyLine(positionedGlyphs,glyphs,lineStartIndex,lineEnd,justify)}lineStartIndex=lastSafeBreak+1;lastSafeBreak=null;lengthBeforeCurrentLine+=lineLength;line++}if(breakable[positionedGlyph.codePoint]){lastSafeBreak=i}}}var lastPositionedGlyph=positionedGlyphs[positionedGlyphs.length-1];var lastLineLength=lastPositionedGlyph.x+glyphs[lastPositionedGlyph.codePoint].advance;maxLineLength=Math.max(maxLineLength,lastLineLength);var height=(line+1)*lineHeight;justifyLine(positionedGlyphs,glyphs,lineStartIndex,positionedGlyphs.length-1,justify);align(positionedGlyphs,justify,horizontalAlign,verticalAlign,maxLineLength,lineHeight,line,translate);shaping.top+=-verticalAlign*height;shaping.bottom=shaping.top+height;shaping.left+=-horizontalAlign*maxLineLength;shaping.right=shaping.left+maxLineLength}function justifyLine(positionedGlyphs,glyphs,start,end,justify){var lastAdvance=glyphs[positionedGlyphs[end].codePoint].advance;var lineIndent=(positionedGlyphs[end].x+lastAdvance)*justify;for(var j=start;j<=end;j++){positionedGlyphs[j].x-=lineIndent}}function align(positionedGlyphs,justify,horizontalAlign,verticalAlign,maxLineLength,lineHeight,line,translate){var shiftX=(justify-horizontalAlign)*maxLineLength+translate[0];var shiftY=(-verticalAlign*(line+1)+.5)*lineHeight+translate[1];for(var j=0;j<positionedGlyphs.length;j++){positionedGlyphs[j].x+=shiftX;positionedGlyphs[j].y+=shiftY}}function shapeIcon(image,layout){if(!image||!image.rect)return null;var dx=layout["icon-offset"][0];var dy=layout["icon-offset"][1];var x1=dx-image.width/2;var x2=x1+image.width;var y1=dy-image.height/2;var y2=y1+image.height;return new PositionedIcon(image,y1,y2,x1,x2)}function PositionedIcon(image,top,bottom,left,right){this.image=image;this.top=top;this.bottom=bottom;this.left=left;this.right=right}},{}],97:[function(require,module,exports){"use strict";var ShelfPack=require("shelf-pack");var browser=require("../util/browser");var util=require("../util/util");module.exports=SpriteAtlas;function SpriteAtlas(width,height){this.width=width;this.height=height;this.bin=new ShelfPack(width,height);this.images={};this.data=false;this.texture=0;this.filter=0;this.pixelRatio=1;this.dirty=true}function copyBitmap(src,srcStride,srcX,srcY,dst,dstStride,dstX,dstY,width,height,wrap){var srcI=srcY*srcStride+srcX;var dstI=dstY*dstStride+dstX;var x,y;if(wrap){dstI-=dstStride;for(y=-1;y<=height;y++,srcI=((y+height)%height+srcY)*srcStride+srcX,dstI+=dstStride){for(x=-1;x<=width;x++){dst[dstI+x]=src[srcI+(x+width)%width]}}}else{for(y=0;y<height;y++,srcI+=srcStride,dstI+=dstStride){for(x=0;x<width;x++){dst[dstI+x]=src[srcI+x]}}}}SpriteAtlas.prototype.allocateImage=function(pixelWidth,pixelHeight){pixelWidth=pixelWidth/this.pixelRatio;pixelHeight=pixelHeight/this.pixelRatio;var padding=2;var packWidth=pixelWidth+padding+(4-(pixelWidth+padding)%4);var packHeight=pixelHeight+padding+(4-(pixelHeight+padding)%4);var rect=this.bin.packOne(packWidth,packHeight);if(!rect){util.warnOnce("SpriteAtlas out of space.");return null}return rect};SpriteAtlas.prototype.getImage=function(name,wrap){if(this.images[name]){return this.images[name]}if(!this.sprite){return null}var pos=this.sprite.getSpritePosition(name);if(!pos.width||!pos.height){return null}var rect=this.allocateImage(pos.width,pos.height);if(!rect){return null}var image=new AtlasImage(rect,pos.width/pos.pixelRatio,pos.height/pos.pixelRatio,pos.sdf,pos.pixelRatio/this.pixelRatio);this.images[name]=image;this.copy(rect,pos,wrap);return image};SpriteAtlas.prototype.getPosition=function(name,repeating){var image=this.getImage(name,repeating);var rect=image&&image.rect;if(!rect){return null}var width=image.width*image.pixelRatio;var height=image.height*image.pixelRatio;var padding=1;return{size:[image.width,image.height],tl:[(rect.x+padding)/this.width,(rect.y+padding)/this.height],br:[(rect.x+padding+width)/this.width,(rect.y+padding+height)/this.height]}};SpriteAtlas.prototype.allocate=function(){if(!this.data){var w=Math.floor(this.width*this.pixelRatio);var h=Math.floor(this.height*this.pixelRatio);this.data=new Uint32Array(w*h);for(var i=0;i<this.data.length;i++){this.data[i]=0}}};SpriteAtlas.prototype.copy=function(dst,src,wrap){if(!this.sprite.img.data)return;var srcImg=new Uint32Array(this.sprite.img.data.buffer);this.allocate();var dstImg=this.data;var padding=1;copyBitmap(srcImg,this.sprite.img.width,src.x,src.y,dstImg,this.width*this.pixelRatio,(dst.x+padding)*this.pixelRatio,(dst.y+padding)*this.pixelRatio,src.width,src.height,wrap);this.dirty=true};SpriteAtlas.prototype.setSprite=function(sprite){if(sprite){this.pixelRatio=browser.devicePixelRatio>1?2:1;if(this.canvas){this.canvas.width=this.width*this.pixelRatio;this.canvas.height=this.height*this.pixelRatio}}this.sprite=sprite};SpriteAtlas.prototype.addIcons=function(icons,callback){for(var i=0;i<icons.length;i++){this.getImage(icons[i])}callback(null,this.images)};SpriteAtlas.prototype.bind=function(gl,linear){var first=false;if(!this.texture){this.texture=gl.createTexture();gl.bindTexture(gl.TEXTURE_2D,this.texture);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE);first=true}else{gl.bindTexture(gl.TEXTURE_2D,this.texture)}var filterVal=linear?gl.LINEAR:gl.NEAREST;if(filterVal!==this.filter){gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,filterVal);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,filterVal);this.filter=filterVal}if(this.dirty){this.allocate();if(first){gl.texImage2D(gl.TEXTURE_2D,0,gl.RGBA,this.width*this.pixelRatio,this.height*this.pixelRatio,0,gl.RGBA,gl.UNSIGNED_BYTE,new Uint8Array(this.data.buffer))}else{gl.texSubImage2D(gl.TEXTURE_2D,0,0,0,this.width*this.pixelRatio,this.height*this.pixelRatio,gl.RGBA,gl.UNSIGNED_BYTE,new Uint8Array(this.data.buffer))}this.dirty=false}};function AtlasImage(rect,width,height,sdf,pixelRatio){this.rect=rect;this.width=width;this.height=height;this.sdf=sdf;this.pixelRatio=pixelRatio}},{"../util/browser":120,"../util/util":137,"shelf-pack":198}],98:[function(require,module,exports){"use strict";var StructArrayType=require("../util/struct_array");var util=require("../util/util");var Point=require("point-geometry");var SymbolInstancesArray=module.exports=new StructArrayType({members:[{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"glyphQuadStartIndex"},{type:"Uint16",name:"glyphQuadEndIndex"},{type:"Uint16",name:"iconQuadStartIndex"},{type:"Uint16",name:"iconQuadEndIndex"},{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int8",name:"index"}]});util.extendAll(SymbolInstancesArray.prototype.StructType.prototype,{get anchorPoint(){return new Point(this.anchorPointX,this.anchorPointY)}})},{"../util/struct_array":135,"../util/util":137,"point-geometry":196}],99:[function(require,module,exports){"use strict";var StructArrayType=require("../util/struct_array");var util=require("../util/util");var Point=require("point-geometry");var SymbolQuad=require("./quads").SymbolQuad;var SymbolQuadsArray=module.exports=new StructArrayType({members:[{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Float32",name:"tlX"},{type:"Float32",name:"tlY"},{type:"Float32",name:"trX"},{type:"Float32",name:"trY"},{type:"Float32",name:"blX"},{type:"Float32",name:"blY"},{type:"Float32",name:"brX"},{type:"Float32",name:"brY"},{type:"Int16",name:"texH"},{type:"Int16",name:"texW"},{type:"Int16",name:"texX"},{type:"Int16",name:"texY"},{type:"Float32",name:"anchorAngle"},{type:"Float32",name:"glyphAngle"},{type:"Float32",name:"maxScale"},{type:"Float32",name:"minScale"}]});util.extendAll(SymbolQuadsArray.prototype.StructType.prototype,{get anchorPoint(){return new Point(this.anchorPointX,this.anchorPointY)},get SymbolQuad(){return new SymbolQuad(this.anchorPoint,new Point(this.tlX,this.tlY),new Point(this.trX,this.trY),new Point(this.blX,this.blY),new Point(this.brX,this.brY),{x:this.texX,y:this.texY,h:this.texH,w:this.texW,height:this.texH,width:this.texW},this.anchorAngle,this.glyphAngle,this.minScale,this.maxScale)}})},{"../util/struct_array":135,"../util/util":137,"./quads":94,"point-geometry":196}],100:[function(require,module,exports){"use strict";var DOM=require("../util/dom");var Point=require("point-geometry");var handlers={scrollZoom:require("./handler/scroll_zoom"),boxZoom:require("./handler/box_zoom"),dragRotate:require("./handler/drag_rotate"),dragPan:require("./handler/drag_pan"),keyboard:require("./handler/keyboard"),doubleClickZoom:require("./handler/dblclick_zoom"),touchZoomRotate:require("./handler/touch_zoom_rotate")};module.exports=function bindHandlers(map,options){var el=map.getCanvasContainer();var contextMenuEvent=null;var startPos=null;var tapped=null;for(var name in handlers){map[name]=new handlers[name](map,options);if(options.interactive&&options[name]){map[name].enable()}}el.addEventListener("mouseout",onMouseOut,false);el.addEventListener("mousedown",onMouseDown,false);el.addEventListener("mouseup",onMouseUp,false);el.addEventListener("mousemove",onMouseMove,false);el.addEventListener("touchstart",onTouchStart,false);el.addEventListener("touchend",onTouchEnd,false);el.addEventListener("touchmove",onTouchMove,false);el.addEventListener("touchcancel",onTouchCancel,false);el.addEventListener("click",onClick,false);el.addEventListener("dblclick",onDblClick,false);el.addEventListener("contextmenu",onContextMenu,false);function onMouseOut(e){fireMouseEvent("mouseout",e)}function onMouseDown(e){map.stop();startPos=DOM.mousePos(el,e);fireMouseEvent("mousedown",e)}function onMouseUp(e){var rotating=map.dragRotate&&map.dragRotate.isActive();if(contextMenuEvent&&!rotating){fireMouseEvent("contextmenu",contextMenuEvent)}contextMenuEvent=null;fireMouseEvent("mouseup",e)}function onMouseMove(e){if(map.dragPan&&map.dragPan.isActive())return;if(map.dragRotate&&map.dragRotate.isActive())return;var target=e.toElement||e.target;while(target&&target!==el)target=target.parentNode;if(target!==el)return;fireMouseEvent("mousemove",e)}function onTouchStart(e){map.stop();fireTouchEvent("touchstart",e);if(!e.touches||e.touches.length>1)return;if(!tapped){tapped=setTimeout(onTouchTimeout,300)}else{clearTimeout(tapped);tapped=null;fireMouseEvent("dblclick",e)}}function onTouchMove(e){fireTouchEvent("touchmove",e)}function onTouchEnd(e){fireTouchEvent("touchend",e)}function onTouchCancel(e){fireTouchEvent("touchcancel",e)}function onTouchTimeout(){tapped=null}function onClick(e){var pos=DOM.mousePos(el,e);if(pos.equals(startPos)){fireMouseEvent("click",e)}}function onDblClick(e){fireMouseEvent("dblclick",e);e.preventDefault()}function onContextMenu(e){contextMenuEvent=e;e.preventDefault()}function fireMouseEvent(type,e){var pos=DOM.mousePos(el,e);return map.fire(type,{lngLat:map.unproject(pos),point:pos,originalEvent:e})}function fireTouchEvent(type,e){var touches=DOM.touchPos(el,e);var singular=touches.reduce(function(prev,curr,i,arr){return prev.add(curr.div(arr.length))},new Point(0,0));return map.fire(type,{lngLat:map.unproject(singular),point:singular,lngLats:touches.map(function(t){return map.unproject(t)},this),points:touches,originalEvent:e})}}},{"../util/dom":127,"./handler/box_zoom":107,"./handler/dblclick_zoom":108,"./handler/drag_pan":109,"./handler/drag_rotate":110,"./handler/keyboard":111,"./handler/scroll_zoom":112,"./handler/touch_zoom_rotate":113,"point-geometry":196}],101:[function(require,module,exports){"use strict";var util=require("../util/util");var interpolate=require("../util/interpolate");var browser=require("../util/browser");var LngLat=require("../geo/lng_lat");var LngLatBounds=require("../geo/lng_lat_bounds");var Point=require("point-geometry");var Camera=module.exports=function(){};util.extend(Camera.prototype,{getCenter:function(){return this.transform.center},setCenter:function(center,eventData){this.jumpTo({center:center},eventData);return this},panBy:function(offset,options,eventData){this.panTo(this.transform.center,util.extend({offset:Point.convert(offset).mult(-1)},options),eventData);return this},panTo:function(lnglat,options,eventData){return this.easeTo(util.extend({center:lnglat},options),eventData)},getZoom:function(){return this.transform.zoom},setZoom:function(zoom,eventData){this.jumpTo({zoom:zoom},eventData);return this},zoomTo:function(zoom,options,eventData){return this.easeTo(util.extend({zoom:zoom},options),eventData)},zoomIn:function(options,eventData){this.zoomTo(this.getZoom()+1,options,eventData);return this},zoomOut:function(options,eventData){this.zoomTo(this.getZoom()-1,options,eventData);return this},getBearing:function(){return this.transform.bearing},setBearing:function(bearing,eventData){this.jumpTo({bearing:bearing},eventData);return this},rotateTo:function(bearing,options,eventData){return this.easeTo(util.extend({bearing:bearing},options),eventData)},resetNorth:function(options,eventData){this.rotateTo(0,util.extend({duration:1e3},options),eventData);return this},snapToNorth:function(options,eventData){if(Math.abs(this.getBearing())<this._bearingSnap){return this.resetNorth(options,eventData)}return this},getPitch:function(){return this.transform.pitch},setPitch:function(pitch,eventData){this.jumpTo({pitch:pitch},eventData);return this},fitBounds:function(bounds,options,eventData){options=util.extend({padding:0,offset:[0,0],maxZoom:Infinity},options);bounds=LngLatBounds.convert(bounds);var offset=Point.convert(options.offset),tr=this.transform,nw=tr.project(bounds.getNorthWest()),se=tr.project(bounds.getSouthEast()),size=se.sub(nw),scaleX=(tr.width-options.padding*2-Math.abs(offset.x)*2)/size.x,scaleY=(tr.height-options.padding*2-Math.abs(offset.y)*2)/size.y;options.center=tr.unproject(nw.add(se).div(2));options.zoom=Math.min(tr.scaleZoom(tr.scale*Math.min(scaleX,scaleY)),options.maxZoom);options.bearing=0;return options.linear?this.easeTo(options,eventData):this.flyTo(options,eventData)},jumpTo:function(options,eventData){this.stop();var tr=this.transform,zoomChanged=false,bearingChanged=false,pitchChanged=false;if("zoom"in options&&tr.zoom!==+options.zoom){zoomChanged=true;tr.zoom=+options.zoom}if("center"in options){tr.center=LngLat.convert(options.center)}if("bearing"in options&&tr.bearing!==+options.bearing){bearingChanged=true;tr.bearing=+options.bearing}if("pitch"in options&&tr.pitch!==+options.pitch){pitchChanged=true;tr.pitch=+options.pitch}this.fire("movestart",eventData).fire("move",eventData);if(zoomChanged){this.fire("zoomstart",eventData).fire("zoom",eventData).fire("zoomend",eventData)}if(bearingChanged){this.fire("rotate",eventData)}if(pitchChanged){this.fire("pitch",eventData)}return this.fire("moveend",eventData)},easeTo:function(options,eventData){this.stop();options=util.extend({offset:[0,0],duration:500,easing:util.ease},options);var tr=this.transform,offset=Point.convert(options.offset),startZoom=this.getZoom(),startBearing=this.getBearing(),startPitch=this.getPitch(),zoom="zoom"in options?+options.zoom:startZoom,bearing="bearing"in options?this._normalizeBearing(options.bearing,startBearing):startBearing,pitch="pitch"in options?+options.pitch:startPitch,toLngLat,toPoint;if("center"in options){toLngLat=LngLat.convert(options.center);toPoint=tr.centerPoint.add(offset)}else if("around"in options){toLngLat=LngLat.convert(options.around);toPoint=tr.locationPoint(toLngLat)}else{toPoint=tr.centerPoint.add(offset);toLngLat=tr.pointLocation(toPoint)}var fromPoint=tr.locationPoint(toLngLat);if(options.animate===false)options.duration=0;this.zooming=zoom!==startZoom;this.rotating=startBearing!==bearing;this.pitching=pitch!==startPitch;if(options.smoothEasing&&options.duration!==0){options.easing=this._smoothOutEasing(options.duration)}if(!options.noMoveStart){this.fire("movestart",eventData)}if(this.zooming){this.fire("zoomstart",eventData)}clearTimeout(this._onEaseEnd);this._ease(function(k){if(this.zooming){tr.zoom=interpolate(startZoom,zoom,k)}if(this.rotating){tr.bearing=interpolate(startBearing,bearing,k)}if(this.pitching){tr.pitch=interpolate(startPitch,pitch,k)}tr.setLocationAtPoint(toLngLat,fromPoint.add(toPoint.sub(fromPoint)._mult(k)));this.fire("move",eventData);if(this.zooming){this.fire("zoom",eventData)}if(this.rotating){this.fire("rotate",eventData)}if(this.pitching){this.fire("pitch",eventData)}},function(){if(options.delayEndEvents){this._onEaseEnd=setTimeout(this._easeToEnd.bind(this,eventData),options.delayEndEvents)}else{this._easeToEnd(eventData)}}.bind(this),options);return this},_easeToEnd:function(eventData){var wasZooming=this.zooming;this.zooming=false;this.rotating=false;this.pitching=false;if(wasZooming){this.fire("zoomend",eventData)}this.fire("moveend",eventData)},flyTo:function(options,eventData){this.stop();options=util.extend({offset:[0,0],speed:1.2,curve:1.42,easing:util.ease},options);var tr=this.transform,offset=Point.convert(options.offset),startZoom=this.getZoom(),startBearing=this.getBearing(),startPitch=this.getPitch();var center="center"in options?LngLat.convert(options.center):this.getCenter();var zoom="zoom"in options?+options.zoom:startZoom;var bearing="bearing"in options?this._normalizeBearing(options.bearing,startBearing):startBearing;var pitch="pitch"in options?+options.pitch:startPitch;if(Math.abs(tr.center.lng)+Math.abs(center.lng)>180){if(tr.center.lng>0&&center.lng<0){center.lng+=360}else if(tr.center.lng<0&&center.lng>0){center.lng-=360}}var scale=tr.zoomScale(zoom-startZoom),from=tr.point,to="center"in options?tr.project(center).sub(offset.div(scale)):from;var startWorldSize=tr.worldSize,rho=options.curve,w0=Math.max(tr.width,tr.height),w1=w0/scale,u1=to.sub(from).mag();if("minZoom"in options){var minZoom=util.clamp(Math.min(options.minZoom,startZoom,zoom),tr.minZoom,tr.maxZoom);var wMax=w0/tr.zoomScale(minZoom-startZoom);rho=Math.sqrt(wMax/u1*2)}var rho2=rho*rho;function r(i){var b=(w1*w1-w0*w0+(i?-1:1)*rho2*rho2*u1*u1)/(2*(i?w1:w0)*rho2*u1);return Math.log(Math.sqrt(b*b+1)-b)}function sinh(n){return(Math.exp(n)-Math.exp(-n))/2}function cosh(n){return(Math.exp(n)+Math.exp(-n))/2}function tanh(n){return sinh(n)/cosh(n)}var r0=r(0),w=function(s){return cosh(r0)/cosh(r0+rho*s)},u=function(s){return w0*((cosh(r0)*tanh(r0+rho*s)-sinh(r0))/rho2)/u1},S=(r(1)-r0)/rho;if(Math.abs(u1)<1e-6){if(Math.abs(w0-w1)<1e-6)return this.easeTo(options);var k=w1<w0?-1:1;S=Math.abs(Math.log(w1/w0))/rho;u=function(){return 0};w=function(s){return Math.exp(k*rho*s)}}if("duration"in options){options.duration=+options.duration}else{var V="screenSpeed"in options?+options.screenSpeed/rho:+options.speed;options.duration=1e3*S/V}this.zooming=true;if(startBearing!==bearing)this.rotating=true;if(startPitch!==pitch)this.pitching=true;this.fire("movestart",eventData);this.fire("zoomstart",eventData);this._ease(function(k){var s=k*S,us=u(s);tr.zoom=startZoom+tr.scaleZoom(1/w(s));tr.center=tr.unproject(from.add(to.sub(from).mult(us)),startWorldSize);if(this.rotating){tr.bearing=interpolate(startBearing,bearing,k)}if(this.pitching){tr.pitch=interpolate(startPitch,pitch,k)}this.fire("move",eventData);this.fire("zoom",eventData);if(this.rotating){this.fire("rotate",eventData)}if(this.pitching){this.fire("pitch",eventData)}},function(){this.zooming=false;this.rotating=false;this.pitching=false;this.fire("zoomend",eventData);this.fire("moveend",eventData)},options);return this},isEasing:function(){return!!this._abortFn},stop:function(){if(this._abortFn){this._abortFn();this._finishEase()}return this},_ease:function(frame,finish,options){this._finishFn=finish;this._abortFn=browser.timed(function(t){frame.call(this,options.easing(t));if(t===1){this._finishEase()}},options.animate===false?0:options.duration,this)},_finishEase:function(){delete this._abortFn;var finish=this._finishFn;delete this._finishFn;finish.call(this)},_normalizeBearing:function(bearing,currentBearing){bearing=util.wrap(bearing,-180,180);var diff=Math.abs(bearing-currentBearing);if(Math.abs(bearing-360-currentBearing)<diff)bearing-=360;if(Math.abs(bearing+360-currentBearing)<diff)bearing+=360;return bearing},_smoothOutEasing:function(duration){var easing=util.ease;if(this._prevEase){var ease=this._prevEase,t=(Date.now()-ease.start)/ease.duration,speed=ease.easing(t+.01)-ease.easing(t),x=.27/Math.sqrt(speed*speed+1e-4)*.01,y=Math.sqrt(.27*.27-x*x);easing=util.bezier(x,y,.25,1)}this._prevEase={start:(new Date).getTime(),duration:duration,easing:easing};return easing}})},{"../geo/lng_lat":28,"../geo/lng_lat_bounds":29,"../util/browser":120,"../util/interpolate":131,"../util/util":137,"point-geometry":196}],102:[function(require,module,exports){"use strict";var Control=require("./control");var DOM=require("../../util/dom");var util=require("../../util/util");module.exports=AttributionControl;function AttributionControl(options){util.setOptions(this,options)}AttributionControl.prototype=util.inherit(Control,{options:{position:"bottom-right"},onAdd:function(map){var className="mapboxgl-ctrl-attrib",container=this._container=DOM.create("div",className,map.getContainer());this._updateAttributions();this._updateEditLink();map.on("data",function(event){if(event.dataType==="source"){this._updateAttributions();this._updateEditLink()}}.bind(this));map.on("moveend",this._updateEditLink.bind(this));return container},_updateAttributions:function(){if(!this._map.style)return;var attributions=[];var sourceCaches=this._map.style.sourceCaches;for(var id in sourceCaches){var source=sourceCaches[id].getSource();if(source.attribution&&attributions.indexOf(source.attribution)<0){attributions.push(source.attribution)}}attributions.sort(function(a,b){return a.length-b.length});attributions=attributions.filter(function(attrib,i){for(var j=i+1;j<attributions.length;j++){if(attributions[j].indexOf(attrib)>=0){return false}}return true});this._container.innerHTML=attributions.join(" | ");this._editLink=null},_updateEditLink:function(){if(!this._editLink)this._editLink=this._container.querySelector(".mapbox-improve-map");if(this._editLink){var center=this._map.getCenter();this._editLink.href="https://www.mapbox.com/map-feedback/#/"+center.lng+"/"+center.lat+"/"+Math.round(this._map.getZoom()+1)}}})},{"../../util/dom":127,"../../util/util":137,"./control":103}],103:[function(require,module,exports){"use strict";var util=require("../../util/util");var Evented=require("../../util/evented");module.exports=Control;function Control(){}Control.prototype={addTo:function(map){this._map=map;var container=this._container=this.onAdd(map);if(this.options&&this.options.position){var pos=this.options.position;var corner=map._controlCorners[pos];container.className+=" mapboxgl-ctrl";if(pos.indexOf("bottom")!==-1){corner.insertBefore(container,corner.firstChild)}else{corner.appendChild(container)}}return this},remove:function(){this._container.parentNode.removeChild(this._container);if(this.onRemove)this.onRemove(this._map);this._map=null;return this}};util.extend(Control.prototype,Evented)},{"../../util/evented":128,"../../util/util":137}],104:[function(require,module,exports){"use strict";var Control=require("./control");var browser=require("../../util/browser");var DOM=require("../../util/dom");var util=require("../../util/util");var window=require("../../util/window");module.exports=GeolocateControl;var geoOptions={enableHighAccuracy:false,timeout:6e3};function GeolocateControl(options){util.setOptions(this,options)}GeolocateControl.prototype=util.inherit(Control,{options:{position:"top-right"},onAdd:function(map){var className="mapboxgl-ctrl";var container=this._container=DOM.create("div",className+"-group",map.getContainer());if(!browser.supportsGeolocation)return container;this._container.addEventListener("contextmenu",this._onContextMenu.bind(this));this._geolocateButton=DOM.create("button",className+"-icon "+className+"-geolocate",this._container);this._geolocateButton.type="button";this._geolocateButton.addEventListener("click",this._onClickGeolocate.bind(this));return container},_onContextMenu:function(e){e.preventDefault()},_onClickGeolocate:function(){window.navigator.geolocation.getCurrentPosition(this._success.bind(this),this._error.bind(this),geoOptions);this._timeoutId=setTimeout(this._finish.bind(this),1e4)},_success:function(position){this._map.jumpTo({center:[position.coords.longitude,position.coords.latitude],zoom:17,bearing:0,pitch:0});this.fire("geolocate",position);this._finish()},_error:function(error){this.fire("error",error);this._finish()},_finish:function(){if(this._timeoutId){clearTimeout(this._timeoutId)}this._timeoutId=undefined}})},{"../../util/browser":120,"../../util/dom":127,"../../util/util":137,"../../util/window":122,"./control":103}],105:[function(require,module,exports){"use strict";var Control=require("./control");var DOM=require("../../util/dom");var util=require("../../util/util");var window=require("../../util/window");module.exports=NavigationControl;function NavigationControl(options){util.setOptions(this,options)}NavigationControl.prototype=util.inherit(Control,{options:{position:"top-right"},onAdd:function(map){var className="mapboxgl-ctrl";var container=this._container=DOM.create("div",className+"-group",map.getContainer());this._container.addEventListener("contextmenu",this._onContextMenu.bind(this));this._zoomInButton=this._createButton(className+"-icon "+className+"-zoom-in",map.zoomIn.bind(map));this._zoomOutButton=this._createButton(className+"-icon "+className+"-zoom-out",map.zoomOut.bind(map));this._compass=this._createButton(className+"-icon "+className+"-compass",map.resetNorth.bind(map));this._compassArrow=DOM.create("span","arrow",this._compass);this._compass.addEventListener("mousedown",this._onCompassDown.bind(this));this._onCompassMove=this._onCompassMove.bind(this);this._onCompassUp=this._onCompassUp.bind(this);map.on("rotate",this._rotateCompassArrow.bind(this));this._rotateCompassArrow();this._el=map.getCanvasContainer();return container},_onContextMenu:function(e){e.preventDefault()},_onCompassDown:function(e){if(e.button!==0)return;DOM.disableDrag();window.document.addEventListener("mousemove",this._onCompassMove);window.document.addEventListener("mouseup",this._onCompassUp);this._el.dispatchEvent(copyMouseEvent(e));e.stopPropagation()},_onCompassMove:function(e){if(e.button!==0)return;this._el.dispatchEvent(copyMouseEvent(e));e.stopPropagation()},_onCompassUp:function(e){if(e.button!==0)return;window.document.removeEventListener("mousemove",this._onCompassMove);window.document.removeEventListener("mouseup",this._onCompassUp);DOM.enableDrag();this._el.dispatchEvent(copyMouseEvent(e));e.stopPropagation()},_createButton:function(className,fn){var a=DOM.create("button",className,this._container);a.type="button";a.addEventListener("click",function(){fn()});return a},_rotateCompassArrow:function(){var rotate="rotate("+this._map.transform.angle*(180/Math.PI)+"deg)";this._compassArrow.style.transform=rotate}});function copyMouseEvent(e){return new window.MouseEvent(e.type,{button:2,buttons:2,bubbles:true,cancelable:true,detail:e.detail,view:e.view,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY,movementX:e.movementX,movementY:e.movementY,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey})}},{"../../util/dom":127,"../../util/util":137,"../../util/window":122,"./control":103}],106:[function(require,module,exports){"use strict";var util=require("../../util/util");var Control=require("./control");var DOM=require("../../util/dom");module.exports=ScaleControl;function ScaleControl(options){util.setOptions(this,options)}ScaleControl.prototype=util.inherit(Control,{options:{position:"bottom-left"},onAdd:function(map){var className="mapboxgl-ctrl-scale",container=this._container=DOM.create("div",className,map.getContainer()),options=this.options;updateScale(map,container,options);map.on("move",function(){updateScale(map,container,options)});return container}});function updateScale(map,scale,options){var maxWidth=options&&options.maxWidth||100;var y=map._container.clientHeight/2;var maxMeters=getDistance(map.unproject([0,y]),map.unproject([maxWidth,y]));if(options&&options.unit==="imperial"){var maxFeet=3.2808*maxMeters;if(maxFeet>5280){var maxMiles=maxFeet/5280;setScale(scale,maxWidth,maxMiles,"mi")}else{setScale(scale,maxWidth,maxFeet,"ft")}}else{setScale(scale,maxWidth,maxMeters,"m")}}function setScale(scale,maxWidth,maxDistance,unit){var distance=getRoundNum(maxDistance);var ratio=distance/maxDistance;if(unit==="m"&&distance>=1e3){distance=distance/1e3;unit="km"}scale.style.width=maxWidth*ratio+"px";scale.innerHTML=distance+unit}function getDistance(latlng1,latlng2){var R=6371e3;var rad=Math.PI/180,lat1=latlng1.lat*rad,lat2=latlng2.lat*rad,a=Math.sin(lat1)*Math.sin(lat2)+Math.cos(lat1)*Math.cos(lat2)*Math.cos((latlng2.lng-latlng1.lng)*rad);var maxMeters=R*Math.acos(Math.min(a,1));return maxMeters}function getRoundNum(num){var pow10=Math.pow(10,(Math.floor(num)+"").length-1),d=num/pow10;d=d>=10?10:d>=5?5:d>=3?3:d>=2?2:1;return pow10*d}},{"../../util/dom":127,"../../util/util":137,"./control":103}],107:[function(require,module,exports){"use strict";var DOM=require("../../util/dom");var LngLatBounds=require("../../geo/lng_lat_bounds");var util=require("../../util/util");var window=require("../../util/window");module.exports=BoxZoomHandler;function BoxZoomHandler(map){this._map=map;this._el=map.getCanvasContainer();this._container=map.getContainer();util.bindHandlers(this)}BoxZoomHandler.prototype={_enabled:false,_active:false,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){if(this.isEnabled())return;this._el.addEventListener("mousedown",this._onMouseDown,false);this._enabled=true},disable:function(){if(!this.isEnabled())return;this._el.removeEventListener("mousedown",this._onMouseDown);this._enabled=false},_onMouseDown:function(e){if(!(e.shiftKey&&e.button===0))return;window.document.addEventListener("mousemove",this._onMouseMove,false);window.document.addEventListener("keydown",this._onKeyDown,false);window.document.addEventListener("mouseup",this._onMouseUp,false);DOM.disableDrag();this._startPos=DOM.mousePos(this._el,e);this._active=true},_onMouseMove:function(e){var p0=this._startPos,p1=DOM.mousePos(this._el,e);if(!this._box){this._box=DOM.create("div","mapboxgl-boxzoom",this._container);this._container.classList.add("mapboxgl-crosshair");this._fireEvent("boxzoomstart",e)}var minX=Math.min(p0.x,p1.x),maxX=Math.max(p0.x,p1.x),minY=Math.min(p0.y,p1.y),maxY=Math.max(p0.y,p1.y);DOM.setTransform(this._box,"translate("+minX+"px,"+minY+"px)");this._box.style.width=maxX-minX+"px";this._box.style.height=maxY-minY+"px"},_onMouseUp:function(e){if(e.button!==0)return;var p0=this._startPos,p1=DOM.mousePos(this._el,e),bounds=(new LngLatBounds).extend(this._map.unproject(p0)).extend(this._map.unproject(p1));this._finish();if(p0.x===p1.x&&p0.y===p1.y){this._fireEvent("boxzoomcancel",e)}else{this._map.fitBounds(bounds,{linear:true}).fire("boxzoomend",{originalEvent:e,boxZoomBounds:bounds})}},_onKeyDown:function(e){if(e.keyCode===27){this._finish();this._fireEvent("boxzoomcancel",e)}},_finish:function(){this._active=false;window.document.removeEventListener("mousemove",this._onMouseMove,false);window.document.removeEventListener("keydown",this._onKeyDown,false);window.document.removeEventListener("mouseup",this._onMouseUp,false);this._container.classList.remove("mapboxgl-crosshair");if(this._box){this._box.parentNode.removeChild(this._box);this._box=null}DOM.enableDrag()},_fireEvent:function(type,e){return this._map.fire(type,{originalEvent:e
})}}},{"../../geo/lng_lat_bounds":29,"../../util/dom":127,"../../util/util":137,"../../util/window":122}],108:[function(require,module,exports){"use strict";module.exports=DoubleClickZoomHandler;function DoubleClickZoomHandler(map){this._map=map;this._onDblClick=this._onDblClick.bind(this)}DoubleClickZoomHandler.prototype={_enabled:false,isEnabled:function(){return this._enabled},enable:function(){if(this.isEnabled())return;this._map.on("dblclick",this._onDblClick);this._enabled=true},disable:function(){if(!this.isEnabled())return;this._map.off("dblclick",this._onDblClick);this._enabled=false},_onDblClick:function(e){this._map.zoomTo(this._map.getZoom()+(e.originalEvent.shiftKey?-1:1),{around:e.lngLat},e)}}},{}],109:[function(require,module,exports){"use strict";var DOM=require("../../util/dom");var util=require("../../util/util");var window=require("../../util/window");module.exports=DragPanHandler;var inertiaLinearity=.3,inertiaEasing=util.bezier(0,0,inertiaLinearity,1),inertiaMaxSpeed=1400,inertiaDeceleration=2500;function DragPanHandler(map){this._map=map;this._el=map.getCanvasContainer();util.bindHandlers(this)}DragPanHandler.prototype={_enabled:false,_active:false,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){if(this.isEnabled())return;this._el.addEventListener("mousedown",this._onDown);this._el.addEventListener("touchstart",this._onDown);this._enabled=true},disable:function(){if(!this.isEnabled())return;this._el.removeEventListener("mousedown",this._onDown);this._el.removeEventListener("touchstart",this._onDown);this._enabled=false},_onDown:function(e){if(this._ignoreEvent(e))return;if(this.isActive())return;if(e.touches){window.document.addEventListener("touchmove",this._onMove);window.document.addEventListener("touchend",this._onTouchEnd)}else{window.document.addEventListener("mousemove",this._onMove);window.document.addEventListener("mouseup",this._onMouseUp)}this._active=false;this._startPos=this._pos=DOM.mousePos(this._el,e);this._inertia=[[Date.now(),this._pos]]},_onMove:function(e){if(this._ignoreEvent(e))return;if(!this.isActive()){this._active=true;this._fireEvent("dragstart",e);this._fireEvent("movestart",e)}var pos=DOM.mousePos(this._el,e),map=this._map;map.stop();this._drainInertiaBuffer();this._inertia.push([Date.now(),pos]);map.transform.setLocationAtPoint(map.transform.pointLocation(this._pos),pos);this._fireEvent("drag",e);this._fireEvent("move",e);this._pos=pos;e.preventDefault()},_onUp:function(e){if(!this.isActive())return;this._active=false;this._fireEvent("dragend",e);this._drainInertiaBuffer();var finish=function(){this._fireEvent("moveend",e)}.bind(this);var inertia=this._inertia;if(inertia.length<2){finish();return}var last=inertia[inertia.length-1],first=inertia[0],flingOffset=last[1].sub(first[1]),flingDuration=(last[0]-first[0])/1e3;if(flingDuration===0||last[1].equals(first[1])){finish();return}var velocity=flingOffset.mult(inertiaLinearity/flingDuration),speed=velocity.mag();if(speed>inertiaMaxSpeed){speed=inertiaMaxSpeed;velocity._unit()._mult(speed)}var duration=speed/(inertiaDeceleration*inertiaLinearity),offset=velocity.mult(-duration/2);this._map.panBy(offset,{duration:duration*1e3,easing:inertiaEasing,noMoveStart:true},{originalEvent:e})},_onMouseUp:function(e){if(this._ignoreEvent(e))return;this._onUp(e);window.document.removeEventListener("mousemove",this._onMove);window.document.removeEventListener("mouseup",this._onMouseUp)},_onTouchEnd:function(e){if(this._ignoreEvent(e))return;this._onUp(e);window.document.removeEventListener("touchmove",this._onMove);window.document.removeEventListener("touchend",this._onTouchEnd)},_fireEvent:function(type,e){return this._map.fire(type,{originalEvent:e})},_ignoreEvent:function(e){var map=this._map;if(map.boxZoom&&map.boxZoom.isActive())return true;if(map.dragRotate&&map.dragRotate.isActive())return true;if(e.touches){return e.touches.length>1}else{if(e.ctrlKey)return true;var buttons=1,button=0;return e.type==="mousemove"?e.buttons&buttons===0:e.button!==button}},_drainInertiaBuffer:function(){var inertia=this._inertia,now=Date.now(),cutoff=160;while(inertia.length>0&&now-inertia[0][0]>cutoff)inertia.shift()}}},{"../../util/dom":127,"../../util/util":137,"../../util/window":122}],110:[function(require,module,exports){"use strict";var DOM=require("../../util/dom");var util=require("../../util/util");var window=require("../../util/window");module.exports=DragRotateHandler;var inertiaLinearity=.25,inertiaEasing=util.bezier(0,0,inertiaLinearity,1),inertiaMaxSpeed=180,inertiaDeceleration=720;function DragRotateHandler(map,options){this._map=map;this._el=map.getCanvasContainer();this._bearingSnap=options.bearingSnap;this._pitchWithRotate=options.pitchWithRotate!==false;util.bindHandlers(this)}DragRotateHandler.prototype={_enabled:false,_active:false,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){if(this.isEnabled())return;this._el.addEventListener("mousedown",this._onDown);this._enabled=true},disable:function(){if(!this.isEnabled())return;this._el.removeEventListener("mousedown",this._onDown);this._enabled=false},_onDown:function(e){if(this._ignoreEvent(e))return;if(this.isActive())return;window.document.addEventListener("mousemove",this._onMove);window.document.addEventListener("mouseup",this._onUp);this._active=false;this._inertia=[[Date.now(),this._map.getBearing()]];this._startPos=this._pos=DOM.mousePos(this._el,e);this._center=this._map.transform.centerPoint;e.preventDefault()},_onMove:function(e){if(this._ignoreEvent(e))return;if(!this.isActive()){this._active=true;this._fireEvent("rotatestart",e);this._fireEvent("movestart",e)}var map=this._map;map.stop();var p1=this._pos,p2=DOM.mousePos(this._el,e),bearingDiff=(p1.x-p2.x)*.8,pitchDiff=(p1.y-p2.y)*-.5,bearing=map.getBearing()-bearingDiff,pitch=map.getPitch()-pitchDiff,inertia=this._inertia,last=inertia[inertia.length-1];this._drainInertiaBuffer();inertia.push([Date.now(),map._normalizeBearing(bearing,last[1])]);map.transform.bearing=bearing;if(this._pitchWithRotate)map.transform.pitch=pitch;this._fireEvent("rotate",e);this._fireEvent("move",e);this._pos=p2},_onUp:function(e){if(this._ignoreEvent(e))return;window.document.removeEventListener("mousemove",this._onMove);window.document.removeEventListener("mouseup",this._onUp);if(!this.isActive())return;this._active=false;this._fireEvent("rotateend",e);this._drainInertiaBuffer();var map=this._map,mapBearing=map.getBearing(),inertia=this._inertia;var finish=function(){if(Math.abs(mapBearing)<this._bearingSnap){map.resetNorth({noMoveStart:true},{originalEvent:e})}else{this._fireEvent("moveend",e)}}.bind(this);if(inertia.length<2){finish();return}var first=inertia[0],last=inertia[inertia.length-1],previous=inertia[inertia.length-2],bearing=map._normalizeBearing(mapBearing,previous[1]),flingDiff=last[1]-first[1],sign=flingDiff<0?-1:1,flingDuration=(last[0]-first[0])/1e3;if(flingDiff===0||flingDuration===0){finish();return}var speed=Math.abs(flingDiff*(inertiaLinearity/flingDuration));if(speed>inertiaMaxSpeed){speed=inertiaMaxSpeed}var duration=speed/(inertiaDeceleration*inertiaLinearity),offset=sign*speed*(duration/2);bearing+=offset;if(Math.abs(map._normalizeBearing(bearing,0))<this._bearingSnap){bearing=map._normalizeBearing(0,bearing)}map.rotateTo(bearing,{duration:duration*1e3,easing:inertiaEasing,noMoveStart:true},{originalEvent:e})},_fireEvent:function(type,e){return this._map.fire(type,{originalEvent:e})},_ignoreEvent:function(e){var map=this._map;if(map.boxZoom&&map.boxZoom.isActive())return true;if(map.dragPan&&map.dragPan.isActive())return true;if(e.touches){return e.touches.length>1}else{var buttons=e.ctrlKey?1:2,button=e.ctrlKey?0:2;return e.type==="mousemove"?e.buttons&buttons===0:e.button!==button}},_drainInertiaBuffer:function(){var inertia=this._inertia,now=Date.now(),cutoff=160;while(inertia.length>0&&now-inertia[0][0]>cutoff)inertia.shift()}}},{"../../util/dom":127,"../../util/util":137,"../../util/window":122}],111:[function(require,module,exports){"use strict";module.exports=KeyboardHandler;var panStep=100,bearingStep=15,pitchStep=10;function KeyboardHandler(map){this._map=map;this._el=map.getCanvasContainer();this._onKeyDown=this._onKeyDown.bind(this)}function easeOut(t){return t*(2-t)}KeyboardHandler.prototype={_enabled:false,isEnabled:function(){return this._enabled},enable:function(){if(this.isEnabled())return;this._el.addEventListener("keydown",this._onKeyDown,false);this._enabled=true},disable:function(){if(!this.isEnabled())return;this._el.removeEventListener("keydown",this._onKeyDown);this._enabled=false},_onKeyDown:function(e){if(e.altKey||e.ctrlKey||e.metaKey)return;var zoomDir=0;var bearingDir=0;var pitchDir=0;var xDir=0;var yDir=0;switch(e.keyCode){case 61:case 107:case 171:case 187:zoomDir=1;break;case 189:case 109:case 173:zoomDir=-1;break;case 37:if(e.shiftKey){bearingDir=-1}else{e.preventDefault();xDir=-1}break;case 39:if(e.shiftKey){bearingDir=1}else{e.preventDefault();xDir=1}break;case 38:if(e.shiftKey){pitchDir=1}else{e.preventDefault();yDir=-1}break;case 40:if(e.shiftKey){pitchDir=-1}else{yDir=1;e.preventDefault()}break}var map=this._map;var zoom=map.getZoom();var easeOptions={duration:300,delayEndEvents:500,easing:easeOut,zoom:zoomDir?Math.round(zoom)+zoomDir*(e.shiftKey?2:1):zoom,bearing:map.getBearing()+bearingDir*bearingStep,pitch:map.getPitch()+pitchDir*pitchStep,offset:[-xDir*panStep,-yDir*panStep],center:map.getCenter()};map.easeTo(easeOptions,{originalEvent:e})}}},{}],112:[function(require,module,exports){"use strict";var DOM=require("../../util/dom");var util=require("../../util/util");var browser=require("../../util/browser");var window=require("../../util/window");module.exports=ScrollZoomHandler;var ua=window.navigator.userAgent.toLowerCase(),firefox=ua.indexOf("firefox")!==-1,safari=ua.indexOf("safari")!==-1&&ua.indexOf("chrom")===-1;function ScrollZoomHandler(map){this._map=map;this._el=map.getCanvasContainer();util.bindHandlers(this)}ScrollZoomHandler.prototype={_enabled:false,isEnabled:function(){return this._enabled},enable:function(){if(this.isEnabled())return;this._el.addEventListener("wheel",this._onWheel,false);this._el.addEventListener("mousewheel",this._onWheel,false);this._enabled=true},disable:function(){if(!this.isEnabled())return;this._el.removeEventListener("wheel",this._onWheel);this._el.removeEventListener("mousewheel",this._onWheel);this._enabled=false},_onWheel:function(e){var value;if(e.type==="wheel"){value=e.deltaY;if(firefox&&e.deltaMode===window.WheelEvent.DOM_DELTA_PIXEL)value/=browser.devicePixelRatio;if(e.deltaMode===window.WheelEvent.DOM_DELTA_LINE)value*=40}else if(e.type==="mousewheel"){value=-e.wheelDeltaY;if(safari)value=value/3}var now=browser.now(),timeDelta=now-(this._time||0);this._pos=DOM.mousePos(this._el,e);this._time=now;if(value!==0&&value%4.000244140625===0){this._type="wheel"}else if(value!==0&&Math.abs(value)<4){this._type="trackpad"}else if(timeDelta>400){this._type=null;this._lastValue=value;this._timeout=setTimeout(this._onTimeout,40)}else if(!this._type){this._type=Math.abs(timeDelta*value)<200?"trackpad":"wheel";if(this._timeout){clearTimeout(this._timeout);this._timeout=null;value+=this._lastValue}}if(e.shiftKey&&value)value=value/4;if(this._type)this._zoom(-value,e);e.preventDefault()},_onTimeout:function(){this._type="wheel";this._zoom(-this._lastValue)},_zoom:function(delta,e){if(delta===0)return;var map=this._map;var scale=2/(1+Math.exp(-Math.abs(delta/100)));if(delta<0&&scale!==0)scale=1/scale;var fromScale=map.ease?map.ease.to:map.transform.scale,targetZoom=map.transform.scaleZoom(fromScale*scale);map.zoomTo(targetZoom,{duration:this._type==="wheel"?200:0,around:map.unproject(this._pos),delayEndEvents:200,smoothEasing:true},{originalEvent:e})}}},{"../../util/browser":120,"../../util/dom":127,"../../util/util":137,"../../util/window":122}],113:[function(require,module,exports){"use strict";var DOM=require("../../util/dom");var util=require("../../util/util");var window=require("../../util/window");module.exports=TouchZoomRotateHandler;var inertiaLinearity=.15,inertiaEasing=util.bezier(0,0,inertiaLinearity,1),inertiaDeceleration=12,inertiaMaxSpeed=2.5,significantScaleThreshold=.15,significantRotateThreshold=4;function TouchZoomRotateHandler(map){this._map=map;this._el=map.getCanvasContainer();util.bindHandlers(this)}TouchZoomRotateHandler.prototype={_enabled:false,isEnabled:function(){return this._enabled},enable:function(){if(this.isEnabled())return;this._el.addEventListener("touchstart",this._onStart,false);this._enabled=true},disable:function(){if(!this.isEnabled())return;this._el.removeEventListener("touchstart",this._onStart);this._enabled=false},disableRotation:function(){this._rotationDisabled=true},enableRotation:function(){this._rotationDisabled=false},_onStart:function(e){if(e.touches.length!==2)return;var p0=DOM.mousePos(this._el,e.touches[0]),p1=DOM.mousePos(this._el,e.touches[1]);this._startVec=p0.sub(p1);this._startScale=this._map.transform.scale;this._startBearing=this._map.transform.bearing;this._gestureIntent=undefined;this._inertia=[];window.document.addEventListener("touchmove",this._onMove,false);window.document.addEventListener("touchend",this._onEnd,false)},_onMove:function(e){if(e.touches.length!==2)return;var p0=DOM.mousePos(this._el,e.touches[0]),p1=DOM.mousePos(this._el,e.touches[1]),p=p0.add(p1).div(2),vec=p0.sub(p1),scale=vec.mag()/this._startVec.mag(),bearing=this._rotationDisabled?0:vec.angleWith(this._startVec)*180/Math.PI,map=this._map;if(!this._gestureIntent){var scalingSignificantly=Math.abs(1-scale)>significantScaleThreshold,rotatingSignificantly=Math.abs(bearing)>significantRotateThreshold;if(rotatingSignificantly){this._gestureIntent="rotate"}else if(scalingSignificantly){this._gestureIntent="zoom"}if(this._gestureIntent){this._startVec=vec;this._startScale=map.transform.scale;this._startBearing=map.transform.bearing}}else{var param={duration:0,around:map.unproject(p)};if(this._gestureIntent==="rotate"){param.bearing=this._startBearing+bearing}if(this._gestureIntent==="zoom"||this._gestureIntent==="rotate"){param.zoom=map.transform.scaleZoom(this._startScale*scale)}map.stop();this._drainInertiaBuffer();this._inertia.push([Date.now(),scale,p]);map.easeTo(param,{originalEvent:e})}e.preventDefault()},_onEnd:function(e){window.document.removeEventListener("touchmove",this._onMove);window.document.removeEventListener("touchend",this._onEnd);this._drainInertiaBuffer();var inertia=this._inertia,map=this._map;if(inertia.length<2){map.snapToNorth({},{originalEvent:e});return}var last=inertia[inertia.length-1],first=inertia[0],lastScale=map.transform.scaleZoom(this._startScale*last[1]),firstScale=map.transform.scaleZoom(this._startScale*first[1]),scaleOffset=lastScale-firstScale,scaleDuration=(last[0]-first[0])/1e3,p=last[2];if(scaleDuration===0||lastScale===firstScale){map.snapToNorth({},{originalEvent:e});return}var speed=scaleOffset*inertiaLinearity/scaleDuration;if(Math.abs(speed)>inertiaMaxSpeed){if(speed>0){speed=inertiaMaxSpeed}else{speed=-inertiaMaxSpeed}}var duration=Math.abs(speed/(inertiaDeceleration*inertiaLinearity))*1e3,targetScale=lastScale+speed*duration/2e3;if(targetScale<0){targetScale=0}map.easeTo({zoom:targetScale,duration:duration,easing:inertiaEasing,around:map.unproject(p)},{originalEvent:e})},_drainInertiaBuffer:function(){var inertia=this._inertia,now=Date.now(),cutoff=160;while(inertia.length>2&&now-inertia[0][0]>cutoff)inertia.shift()}}},{"../../util/dom":127,"../../util/util":137,"../../util/window":122}],114:[function(require,module,exports){"use strict";module.exports=Hash;var util=require("../util/util");var window=require("../util/window");function Hash(){util.bindAll(["_onHashChange","_updateHash"],this)}Hash.prototype={addTo:function(map){this._map=map;window.addEventListener("hashchange",this._onHashChange,false);this._map.on("moveend",this._updateHash);return this},remove:function(){window.removeEventListener("hashchange",this._onHashChange,false);this._map.off("moveend",this._updateHash);delete this._map;return this},_onHashChange:function(){var loc=window.location.hash.replace("#","").split("/");if(loc.length>=3){this._map.jumpTo({center:[+loc[2],+loc[1]],zoom:+loc[0],bearing:+(loc[3]||0),pitch:+(loc[4]||0)});return true}return false},_updateHash:function(){var center=this._map.getCenter(),zoom=this._map.getZoom(),bearing=this._map.getBearing(),pitch=this._map.getPitch(),precision=Math.max(0,Math.ceil(Math.log(zoom)/Math.LN2)),hash="#"+Math.round(zoom*100)/100+"/"+center.lat.toFixed(precision)+"/"+center.lng.toFixed(precision);if(bearing||pitch)hash+="/"+Math.round(bearing*10)/10;if(pitch)hash+="/"+Math.round(pitch);window.history.replaceState("","",hash)}}},{"../util/util":137,"../util/window":122}],115:[function(require,module,exports){"use strict";var util=require("../util/util");var browser=require("../util/browser");var window=require("../util/window");var Evented=require("../util/evented");var DOM=require("../util/dom");var Style=require("../style/style");var AnimationLoop=require("../style/animation_loop");var Painter=require("../render/painter");var Transform=require("../geo/transform");var Hash=require("./hash");var bindHandlers=require("./bind_handlers");var Camera=require("./camera");var LngLat=require("../geo/lng_lat");var LngLatBounds=require("../geo/lng_lat_bounds");var Point=require("point-geometry");var AttributionControl=require("./control/attribution_control");var isSupported=require("mapbox-gl-supported");var defaultMinZoom=0;var defaultMaxZoom=20;var defaultOptions={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:defaultMinZoom,maxZoom:defaultMaxZoom,interactive:true,scrollZoom:true,boxZoom:true,dragRotate:true,dragPan:true,keyboard:true,doubleClickZoom:true,touchZoomRotate:true,bearingSnap:7,hash:false,attributionControl:true,failIfMajorPerformanceCaveat:false,preserveDrawingBuffer:false,trackResize:true};var Map=module.exports=function(options){options=util.extend({},defaultOptions,options);this._interactive=options.interactive;this._failIfMajorPerformanceCaveat=options.failIfMajorPerformanceCaveat;this._preserveDrawingBuffer=options.preserveDrawingBuffer;this._trackResize=options.trackResize;this._bearingSnap=options.bearingSnap;if(typeof options.container==="string"){this._container=window.document.getElementById(options.container)}else{this._container=options.container}this.animationLoop=new AnimationLoop;this.transform=new Transform(options.minZoom,options.maxZoom);if(options.maxBounds){this.setMaxBounds(options.maxBounds)}util.bindAll(["_onWindowOnline","_onWindowResize","_contextLost","_contextRestored","_update","_render"],this);this._setupContainer();this._setupPainter();this.on("move",this._update.bind(this,false));this.on("zoom",this._update.bind(this,true));this.on("moveend",function(){this.animationLoop.set(300);this._rerender()}.bind(this));if(typeof window!=="undefined"){window.addEventListener("online",this._onWindowOnline,false);window.addEventListener("resize",this._onWindowResize,false)}bindHandlers(this,options);this._hash=options.hash&&(new Hash).addTo(this);if(!this._hash||!this._hash._onHashChange()){this.jumpTo({center:options.center,zoom:options.zoom,bearing:options.bearing,pitch:options.pitch})}this._classes=[];this.resize();if(options.classes)this.setClasses(options.classes);if(options.style)this.setStyle(options.style);if(options.attributionControl)this.addControl(new AttributionControl(options.attributionControl));this.on("style.load",function(){if(this.transform.unmodified){this.jumpTo(this.style.stylesheet)}this.style.update(this._classes,{transition:false})});this.on("data",function(event){if(event.dataType==="style"){this._update(true)}else{this._update()}})};util.extend(Map.prototype,Evented);util.extend(Map.prototype,Camera.prototype);util.extend(Map.prototype,{addControl:function(control){control.addTo(this);return this},addClass:function(klass,options){if(this._classes.indexOf(klass)>=0||klass==="")return this;this._classes.push(klass);this._classOptions=options;if(this.style)this.style.updateClasses();return this._update(true)},removeClass:function(klass,options){var i=this._classes.indexOf(klass);if(i<0||klass==="")return this;this._classes.splice(i,1);this._classOptions=options;if(this.style)this.style.updateClasses();return this._update(true)},setClasses:function(klasses,options){var uniqueClasses={};for(var i=0;i<klasses.length;i++){if(klasses[i]!=="")uniqueClasses[klasses[i]]=true}this._classes=Object.keys(uniqueClasses);this._classOptions=options;if(this.style)this.style.updateClasses();return this._update(true)},hasClass:function(klass){return this._classes.indexOf(klass)>=0},getClasses:function(){return this._classes},resize:function(){var dimensions=this._containerDimensions();var width=dimensions[0];var height=dimensions[1];this._resizeCanvas(width,height);this.transform.resize(width,height);this.painter.resize(width,height);return this.fire("movestart").fire("move").fire("resize").fire("moveend")},getBounds:function(){var bounds=new LngLatBounds(this.transform.pointLocation(new Point(0,this.transform.height)),this.transform.pointLocation(new Point(this.transform.width,0)));if(this.transform.angle||this.transform.pitch){bounds.extend(this.transform.pointLocation(new Point(this.transform.size.x,0)));bounds.extend(this.transform.pointLocation(new Point(0,this.transform.size.y)))}return bounds},setMaxBounds:function(lnglatbounds){if(lnglatbounds){var b=LngLatBounds.convert(lnglatbounds);this.transform.lngRange=[b.getWest(),b.getEast()];this.transform.latRange=[b.getSouth(),b.getNorth()];this.transform._constrain();this._update()}else if(lnglatbounds===null||lnglatbounds===undefined){this.transform.lngRange=[];this.transform.latRange=[];this._update()}return this},setMinZoom:function(minZoom){minZoom=minZoom===null||minZoom===undefined?defaultMinZoom:minZoom;if(minZoom>=defaultMinZoom&&minZoom<=this.transform.maxZoom){this.transform.minZoom=minZoom;this._update();if(this.getZoom()<minZoom)this.setZoom(minZoom);return this}else throw new Error("minZoom must be between "+defaultMinZoom+" and the current maxZoom, inclusive")},setMaxZoom:function(maxZoom){maxZoom=maxZoom===null||maxZoom===undefined?defaultMaxZoom:maxZoom;if(maxZoom>=this.transform.minZoom&&maxZoom<=defaultMaxZoom){this.transform.maxZoom=maxZoom;this._update();if(this.getZoom()>maxZoom)this.setZoom(maxZoom);return this}else throw new Error("maxZoom must be between the current minZoom and "+defaultMaxZoom+", inclusive")},project:function(lnglat){return this.transform.locationPoint(LngLat.convert(lnglat))},unproject:function(point){return this.transform.pointLocation(Point.convert(point))},queryRenderedFeatures:function(){var params={};var geometry;if(arguments.length===2){geometry=arguments[0];params=arguments[1]}else if(arguments.length===1&&isPointLike(arguments[0])){geometry=arguments[0]}else if(arguments.length===1){params=arguments[0]}return this.style.queryRenderedFeatures(this._makeQueryGeometry(geometry),params,this.transform.zoom,this.transform.angle);function isPointLike(input){return input instanceof Point||Array.isArray(input)}},_makeQueryGeometry:function(pointOrBox){if(pointOrBox===undefined){pointOrBox=[Point.convert([0,0]),Point.convert([this.transform.width,this.transform.height])]}var queryGeometry;var isPoint=pointOrBox instanceof Point||typeof pointOrBox[0]==="number";if(isPoint){var point=Point.convert(pointOrBox);queryGeometry=[point]}else{var box=[Point.convert(pointOrBox[0]),Point.convert(pointOrBox[1])];queryGeometry=[box[0],new Point(box[1].x,box[0].y),box[1],new Point(box[0].x,box[1].y),box[0]]}queryGeometry=queryGeometry.map(function(p){return this.transform.pointCoordinate(p)}.bind(this));return queryGeometry},querySourceFeatures:function(sourceID,params){return this.style.querySourceFeatures(sourceID,params)},setStyle:function(style){if(this.style){this.style.setEventedParent(null);this.style._remove();this.off("rotate",this.style._redoPlacement);this.off("pitch",this.style._redoPlacement)}if(!style){this.style=null;return this}else if(style instanceof Style){this.style=style}else{this.style=new Style(style,this)}this.style.setEventedParent(this,{style:this.style});this.on("rotate",this.style._redoPlacement);this.on("pitch",this.style._redoPlacement);return this},getStyle:function(){if(this.style){return this.style.serialize()}},addSource:function(id,source){this.style.addSource(id,source);this._update(true);return this},addSourceType:function(name,SourceType,callback){return this.style.addSourceType(name,SourceType,callback)},removeSource:function(id){this.style.removeSource(id);this._update(true);return this},getSource:function(id){return this.style.getSource(id)},addLayer:function(layer,before){this.style.addLayer(layer,before);this._update(true);return this},removeLayer:function(id){this.style.removeLayer(id);this._update(true);return this},getLayer:function(id){return this.style.getLayer(id)},setFilter:function(layer,filter){this.style.setFilter(layer,filter);this._update(true);return this},setLayerZoomRange:function(layerId,minzoom,maxzoom){this.style.setLayerZoomRange(layerId,minzoom,maxzoom);this._update(true);return this},getFilter:function(layer){return this.style.getFilter(layer)},setPaintProperty:function(layer,name,value,klass){this.style.setPaintProperty(layer,name,value,klass);this._update(true);return this},getPaintProperty:function(layer,name,klass){return this.style.getPaintProperty(layer,name,klass)},setLayoutProperty:function(layer,name,value){this.style.setLayoutProperty(layer,name,value);this._update(true);return this},getLayoutProperty:function(layer,name){return this.style.getLayoutProperty(layer,name)},setLight:function(lightOptions){this.style.setLight(lightOptions);this._update(true);return this},getLight:function(){return this.style.getLight()},getContainer:function(){return this._container},getCanvasContainer:function(){return this._canvasContainer},getCanvas:function(){return this._canvas},_containerDimensions:function(){var width=0;var height=0;if(this._container){width=this._container.offsetWidth||400;height=this._container.offsetHeight||300}return[width,height]},_setupContainer:function(){var container=this._container;container.classList.add("mapboxgl-map");var canvasContainer=this._canvasContainer=DOM.create("div","mapboxgl-canvas-container",container);if(this._interactive){canvasContainer.classList.add("mapboxgl-interactive")}this._canvas=DOM.create("canvas","mapboxgl-canvas",canvasContainer);this._canvas.style.position="absolute";this._canvas.addEventListener("webglcontextlost",this._contextLost,false);this._canvas.addEventListener("webglcontextrestored",this._contextRestored,false);this._canvas.setAttribute("tabindex",0);var dimensions=this._containerDimensions();this._resizeCanvas(dimensions[0],dimensions[1]);var controlContainer=this._controlContainer=DOM.create("div","mapboxgl-control-container",container);var corners=this._controlCorners={};["top-left","top-right","bottom-left","bottom-right"].forEach(function(pos){corners[pos]=DOM.create("div","mapboxgl-ctrl-"+pos,controlContainer)})},_resizeCanvas:function(width,height){var pixelRatio=window.devicePixelRatio||1;this._canvas.width=pixelRatio*width;this._canvas.height=pixelRatio*height;this._canvas.style.width=width+"px";this._canvas.style.height=height+"px"},_setupPainter:function(){var attributes=util.extend({failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer},isSupported.webGLContextAttributes);var gl=this._canvas.getContext("webgl",attributes)||this._canvas.getContext("experimental-webgl",attributes);if(!gl){this.fire("error",{error:new Error("Failed to initialize WebGL")});return}this.painter=new Painter(gl,this.transform)},_contextLost:function(event){event.preventDefault();if(this._frameId){browser.cancelFrame(this._frameId)}this.fire("webglcontextlost",{originalEvent:event})},_contextRestored:function(event){this._setupPainter();this.resize();this._update();this.fire("webglcontextrestored",{originalEvent:event})},loaded:function(){if(this._styleDirty||this._sourcesDirty)return false;if(!this.style||!this.style.loaded())return false;return true},_update:function(updateStyle){if(!this.style)return this;this._styleDirty=this._styleDirty||updateStyle;this._sourcesDirty=true;this._rerender();return this},_render:function(){if(this.style&&this._styleDirty){this._styleDirty=false;this.style.update(this._classes,this._classOptions);this._classOptions=null;this.style._recalculate(this.transform.zoom)}if(this.style&&this._sourcesDirty){this._sourcesDirty=false;this.style._updateSources(this.transform)}this.painter.render(this.style,{debug:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,vertices:this.vertices,rotating:this.rotating,zooming:this.zooming});this.fire("render");if(this.loaded()&&!this._loaded){this._loaded=true;this.fire("load")}this._frameId=null;if(!this.animationLoop.stopped()){this._styleDirty=true}if(this._sourcesDirty||this._repaint||this._styleDirty){this._rerender()}return this},remove:function(){if(this._hash)this._hash.remove();browser.cancelFrame(this._frameId);this.setStyle(null);if(typeof window!=="undefined"){window.removeEventListener("resize",this._onWindowResize,false)}var extension=this.painter.gl.getExtension("WEBGL_lose_context");if(extension)extension.loseContext();removeNode(this._canvasContainer);removeNode(this._controlContainer);this._container.classList.remove("mapboxgl-map");this.fire("remove")},_rerender:function(){if(this.style&&!this._frameId){this._frameId=browser.frame(this._render)}},_onWindowOnline:function(){this._update()},_onWindowResize:function(){if(this._trackResize){this.stop().resize()._update()}}});util.extendAll(Map.prototype,{_showTileBoundaries:false,get showTileBoundaries(){return this._showTileBoundaries},set showTileBoundaries(value){if(this._showTileBoundaries===value)return;this._showTileBoundaries=value;this._update()},_showCollisionBoxes:false,get showCollisionBoxes(){return this._showCollisionBoxes},set showCollisionBoxes(value){if(this._showCollisionBoxes===value)return;this._showCollisionBoxes=value;this.style._redoPlacement()},_showOverdrawInspector:false,get showOverdrawInspector(){return this._showOverdrawInspector},set showOverdrawInspector(value){if(this._showOverdrawInspector===value)return;this._showOverdrawInspector=value;this._update()},_repaint:false,get repaint(){return this._repaint},set repaint(value){this._repaint=value;this._update()},_vertices:false,get vertices(){return this._vertices},set vertices(value){this._vertices=value;this._update()}});function removeNode(node){if(node.parentNode){node.parentNode.removeChild(node)}}},{"../geo/lng_lat":28,"../geo/lng_lat_bounds":29,"../geo/transform":30,"../render/painter":46,"../style/animation_loop":67,"../style/style":71,"../util/browser":120,"../util/dom":127,"../util/evented":128,"../util/util":137,"../util/window":122,"./bind_handlers":100,"./camera":101,"./control/attribution_control":102,"./hash":114,"mapbox-gl-supported":192,"point-geometry":196}],116:[function(require,module,exports){"use strict";module.exports=Marker;var DOM=require("../util/dom");var util=require("../util/util");var LngLat=require("../geo/lng_lat");var Point=require("point-geometry");var Popup=require("./popup");function Marker(element,options){this._offset=Point.convert(options&&options.offset||[0,0]);this._update=this._update.bind(this);this._onMapClick=this._onMapClick.bind(this);if(!element)element=DOM.create("div");element.classList.add("mapboxgl-marker");this._element=element;this._popup=null}Marker.prototype={addTo:function(map){this.remove();this._map=map;map.getCanvasContainer().appendChild(this._element);map.on("move",this._update);map.on("moveend",this._update);this._update();this._map.on("click",this._onMapClick);
return this},remove:function(){if(this._map){this._map.off("click",this._onMapClick);this._map.off("move",this._update);this._map.off("moveend",this._update);this._map=null}DOM.remove(this._element);if(this._popup)this._popup.remove();return this},getLngLat:function(){return this._lngLat},setLngLat:function(lnglat){this._lngLat=LngLat.convert(lnglat);if(this._popup)this._popup.setLngLat(this._lngLat);this._update();return this},getElement:function(){return this._element},setPopup:function(popup){var that=this;if(this._popup){this._popup.remove();this._popup=null}if(popup){this._popup=popup;this._popup.setLngLat(this._lngLat)}return this},_onMapClick:function(event){var targetElement=event.originalEvent.target;var element=this._element;if(this._popup&&(targetElement===element||element.contains(targetElement))){this.togglePopup()}},getPopup:function(){return this._popup},togglePopup:function(){var popup=this._popup;if(!popup)return;else if(popup.isOpen())popup.remove();else popup.addTo(this._map)},_update:function(e){if(!this._map)return;var pos=this._map.project(this._lngLat)._add(this._offset);if(!e||e.type==="moveend")pos=pos.round();DOM.setTransform(this._element,"translate("+pos.x+"px,"+pos.y+"px)")}}},{"../geo/lng_lat":28,"../util/dom":127,"../util/util":137,"./popup":117,"point-geometry":196}],117:[function(require,module,exports){"use strict";module.exports=Popup;var util=require("../util/util");var Evented=require("../util/evented");var DOM=require("../util/dom");var LngLat=require("../geo/lng_lat");var Point=require("point-geometry");var window=require("../util/window");function Popup(options){util.setOptions(this,options);util.bindAll(["_update","_onClickClose"],this)}Popup.prototype=util.inherit(Evented,{options:{closeButton:true,closeOnClick:true},addTo:function(map){this._map=map;this._map.on("move",this._update);if(this.options.closeOnClick){this._map.on("click",this._onClickClose)}this._update();return this},isOpen:function(){return!!this._map},remove:function(){if(this._content&&this._content.parentNode){this._content.parentNode.removeChild(this._content)}if(this._container){this._container.parentNode.removeChild(this._container);delete this._container}if(this._map){this._map.off("move",this._update);this._map.off("click",this._onClickClose);delete this._map}this.fire("close");return this},getLngLat:function(){return this._lngLat},setLngLat:function(lnglat){this._lngLat=LngLat.convert(lnglat);this._update();return this},setText:function(text){return this.setDOMContent(window.document.createTextNode(text))},setHTML:function(html){var frag=window.document.createDocumentFragment();var temp=window.document.createElement("body"),child;temp.innerHTML=html;while(true){child=temp.firstChild;if(!child)break;frag.appendChild(child)}return this.setDOMContent(frag)},setDOMContent:function(htmlNode){this._createContent();this._content.appendChild(htmlNode);this._update();return this},_createContent:function(){if(this._content&&this._content.parentNode){this._content.parentNode.removeChild(this._content)}this._content=DOM.create("div","mapboxgl-popup-content",this._container);if(this.options.closeButton){this._closeButton=DOM.create("button","mapboxgl-popup-close-button",this._content);this._closeButton.type="button";this._closeButton.innerHTML="&#215;";this._closeButton.addEventListener("click",this._onClickClose)}},_update:function(){if(!this._map||!this._lngLat||!this._content){return}if(!this._container){this._container=DOM.create("div","mapboxgl-popup",this._map.getContainer());this._tip=DOM.create("div","mapboxgl-popup-tip",this._container);this._container.appendChild(this._content)}var anchor=this.options.anchor;var offset=normalizeOffset(this.options.offset);var pos=this._map.project(this._lngLat).round();if(!anchor){var width=this._container.offsetWidth,height=this._container.offsetHeight;if(pos.y+offset.bottom.y<height){anchor=["top"]}else if(pos.y>this._map.transform.height-height){anchor=["bottom"]}else{anchor=[]}if(pos.x<width/2){anchor.push("left")}else if(pos.x>this._map.transform.width-width/2){anchor.push("right")}if(anchor.length===0){anchor="bottom"}else{anchor=anchor.join("-")}}var offsetedPos=pos.add(offset[anchor]);var anchorTranslate={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%)"};var classList=this._container.classList;for(var key in anchorTranslate){classList.remove("mapboxgl-popup-anchor-"+key)}classList.add("mapboxgl-popup-anchor-"+anchor);DOM.setTransform(this._container,anchorTranslate[anchor]+" translate("+offsetedPos.x+"px,"+offsetedPos.y+"px)")},_onClickClose:function(){this.remove()}});function normalizeOffset(offset){if(!offset){return normalizeOffset(new Point(0,0))}else if(typeof offset==="number"){var cornerOffset=Math.round(Math.sqrt(.5*Math.pow(offset,2)));return{top:new Point(0,offset),"top-left":new Point(cornerOffset,cornerOffset),"top-right":new Point(-cornerOffset,cornerOffset),bottom:new Point(0,-offset),"bottom-left":new Point(cornerOffset,-cornerOffset),"bottom-right":new Point(-cornerOffset,-cornerOffset),left:new Point(offset,0),right:new Point(-offset,0)}}else if(isPointLike(offset)){var convertedOffset=Point.convert(offset);return{top:convertedOffset,"top-left":convertedOffset,"top-right":convertedOffset,bottom:convertedOffset,"bottom-left":convertedOffset,"bottom-right":convertedOffset,left:convertedOffset,right:convertedOffset}}else{return{top:Point.convert(offset["top"]),"top-left":Point.convert(offset["top-left"]),"top-right":Point.convert(offset["top-right"]),bottom:Point.convert(offset["bottom"]),"bottom-left":Point.convert(offset["bottom-left"]),"bottom-right":Point.convert(offset["bottom-right"]),left:Point.convert(offset["left"]),right:Point.convert(offset["right"])}}}function isPointLike(input){return input instanceof Point||Array.isArray(input)}},{"../geo/lng_lat":28,"../util/dom":127,"../util/evented":128,"../util/util":137,"../util/window":122,"point-geometry":196}],118:[function(require,module,exports){"use strict";module.exports=Actor;function Actor(target,parent,mapId){this.target=target;this.parent=parent;this.mapId=mapId;this.callbacks={};this.callbackID=0;this.receive=this.receive.bind(this);this.target.addEventListener("message",this.receive,false)}Actor.prototype.send=function(type,data,callback,buffers,targetMapId){var id=callback?this.mapId+":"+this.callbackID++:null;if(callback)this.callbacks[id]=callback;this.target.postMessage({targetMapId:targetMapId,sourceMapId:this.mapId,type:type,id:String(id),data:data},buffers)};Actor.prototype.receive=function(message){var data=message.data,id=data.id,callback;if(data.targetMapId&&this.mapId!==data.targetMapId)return;if(data.type==="<response>"){callback=this.callbacks[data.id];delete this.callbacks[data.id];if(callback)callback(data.error||null,data.data)}else if(typeof data.id!=="undefined"&&this.parent[data.type]){this.parent[data.type](data.sourceMapId,data.data,done.bind(this))}else if(typeof data.id!=="undefined"&&this.parent.getWorkerSource){var keys=data.type.split(".");var workerSource=this.parent.getWorkerSource(data.sourceMapId,keys[0]);workerSource[keys[1]](data.data,done.bind(this))}else{this.parent[data.type](data.data)}function done(err,data,buffers){this.target.postMessage({sourceMapId:this.mapId,type:"<response>",id:String(id),error:err?String(err):null,data:data},buffers)}};Actor.prototype.remove=function(){this.target.removeEventListener("message",this.receive,false)}},{}],119:[function(require,module,exports){"use strict";var window=require("./window");exports.getJSON=function(url,callback){var xhr=new window.XMLHttpRequest;xhr.open("GET",url,true);xhr.setRequestHeader("Accept","application/json");xhr.onerror=function(e){callback(e)};xhr.onload=function(){if(xhr.status>=200&&xhr.status<300&&xhr.response){var data;try{data=JSON.parse(xhr.response)}catch(err){return callback(err)}callback(null,data)}else{callback(new Error(xhr.statusText))}};xhr.send();return xhr};exports.getArrayBuffer=function(url,callback){var xhr=new window.XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onerror=function(e){callback(e)};xhr.onload=function(){if(xhr.status>=200&&xhr.status<300&&xhr.response){callback(null,xhr.response)}else{callback(new Error(xhr.statusText))}};xhr.send();return xhr};function sameOrigin(url){var a=window.document.createElement("a");a.href=url;return a.protocol===window.document.location.protocol&&a.host===window.document.location.host}exports.getImage=function(url,callback){return exports.getArrayBuffer(url,function(err,imgData){if(err)return callback(err);var img=new window.Image;img.onload=function(){callback(null,img);(window.URL||window.webkitURL).revokeObjectURL(img.src)};var blob=new window.Blob([new Uint8Array(imgData)],{type:"image/png"});img.src=(window.URL||window.webkitURL).createObjectURL(blob);img.getData=function(){var canvas=window.document.createElement("canvas");var context=canvas.getContext("2d");canvas.width=img.width;canvas.height=img.height;context.drawImage(img,0,0);return context.getImageData(0,0,img.width,img.height).data};return img})};exports.getVideo=function(urls,callback){var video=window.document.createElement("video");video.onloadstart=function(){callback(null,video)};for(var i=0;i<urls.length;i++){var s=window.document.createElement("source");if(!sameOrigin(urls[i])){video.crossOrigin="Anonymous"}s.src=urls[i];video.appendChild(s)}video.getData=function(){return video};return video}},{"./window":122}],120:[function(require,module,exports){"use strict";var window=require("./window");module.exports.now=function(){if(window.performance&&window.performance.now){return window.performance.now.bind(window.performance)}else{return Date.now.bind(Date)}}();var frame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;exports.frame=function(fn){return frame(fn)};var cancel=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame;exports.cancelFrame=function(id){cancel(id)};exports.timed=function(fn,dur,ctx){if(!dur){fn.call(ctx,1);return null}var abort=false,start=module.exports.now();function tick(now){if(abort)return;now=module.exports.now();if(now>=start+dur){fn.call(ctx,1)}else{fn.call(ctx,(now-start)/dur);exports.frame(tick)}}exports.frame(tick);return function(){abort=true}};exports.supported=require("mapbox-gl-supported");exports.hardwareConcurrency=window.navigator.hardwareConcurrency||4;Object.defineProperty(exports,"devicePixelRatio",{get:function(){return window.devicePixelRatio}});exports.supportsWebp=false;var webpImgTest=window.document.createElement("img");webpImgTest.onload=function(){exports.supportsWebp=true};webpImgTest.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=";exports.supportsGeolocation=!!window.navigator.geolocation},{"./window":122,"mapbox-gl-supported":192}],121:[function(require,module,exports){"use strict";var WebWorkify=require("webworkify");var window=require("../window");var workerURL=window.URL.createObjectURL(new WebWorkify(require("../../source/worker"),{bare:true}));module.exports=function(){return new window.Worker(workerURL)}},{"../../source/worker":65,"../window":122,webworkify:213}],122:[function(require,module,exports){"use strict";module.exports=self},{}],123:[function(require,module,exports){"use strict";var quickselect=require("quickselect");var calculateSignedArea=require("./util").calculateSignedArea;module.exports=function classifyRings(rings,maxRings){var len=rings.length;if(len<=1)return[rings];var polygons=[],polygon,ccw;for(var i=0;i<len;i++){var area=calculateSignedArea(rings[i]);if(area===0)continue;rings[i].area=Math.abs(area);if(ccw===undefined)ccw=area<0;if(ccw===area<0){if(polygon)polygons.push(polygon);polygon=[rings[i]]}else{polygon.push(rings[i])}}if(polygon)polygons.push(polygon);if(maxRings>1){for(var j=0;j<polygons.length;j++){if(polygons[j].length<=maxRings)continue;quickselect(polygons[j],maxRings,1,polygons[j].length-1,compareAreas);polygons[j]=polygons[j].slice(0,maxRings)}}return polygons};function compareAreas(a,b){return b.area-a.area}},{"./util":137,quickselect:197}],124:[function(require,module,exports){"use strict";module.exports={API_URL:"https://api.mapbox.com",REQUIRE_ACCESS_TOKEN:true}},{}],125:[function(require,module,exports){"use strict";module.exports=DictionaryCoder;function DictionaryCoder(strings){this._stringToNumber={};this._numberToString=[];for(var i=0;i<strings.length;i++){var string=strings[i];this._stringToNumber[string]=i;this._numberToString[i]=string}}DictionaryCoder.prototype.encode=function(string){return this._stringToNumber[string]};DictionaryCoder.prototype.decode=function(n){return this._numberToString[n]}},{}],126:[function(require,module,exports){"use strict";var util=require("./util");var Actor=require("./actor");module.exports=Dispatcher;function Dispatcher(workerPool,parent){this.workerPool=workerPool;this.actors=[];this.currentActor=0;this.id=util.uniqueId();var workers=this.workerPool.acquire(this.id);for(var i=0;i<workers.length;i++){var worker=workers[i];var actor=new Actor(worker,parent,this.id);actor.name="Worker "+i;this.actors.push(actor)}}Dispatcher.prototype={broadcast:function(type,data,cb){cb=cb||function(){};util.asyncAll(this.actors,function(actor,done){actor.send(type,data,done)},cb)},send:function(type,data,callback,targetID,buffers){if(typeof targetID!=="number"||isNaN(targetID)){targetID=this.currentActor=(this.currentActor+1)%this.actors.length}this.actors[targetID].send(type,data,callback,buffers);return targetID},remove:function(){this.actors.forEach(function(actor){actor.remove()});this.actors=[];this.workerPool.release(this.id)}}},{"./actor":118,"./util":137}],127:[function(require,module,exports){"use strict";var Point=require("point-geometry");var window=require("./window");exports.create=function(tagName,className,container){var el=window.document.createElement(tagName);if(className)el.className=className;if(container)container.appendChild(el);return el};var docStyle=window.document.documentElement.style;function testProp(props){for(var i=0;i<props.length;i++){if(props[i]in docStyle){return props[i]}}return props[0]}var selectProp=testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),userSelect;exports.disableDrag=function(){if(selectProp){userSelect=docStyle[selectProp];docStyle[selectProp]="none"}};exports.enableDrag=function(){if(selectProp){docStyle[selectProp]=userSelect}};var transformProp=testProp(["transform","WebkitTransform"]);exports.setTransform=function(el,value){el.style[transformProp]=value};function suppressClick(e){e.preventDefault();e.stopPropagation();window.removeEventListener("click",suppressClick,true)}exports.suppressClick=function(){window.addEventListener("click",suppressClick,true);window.setTimeout(function(){window.removeEventListener("click",suppressClick,true)},0)};exports.mousePos=function(el,e){var rect=el.getBoundingClientRect();e=e.touches?e.touches[0]:e;return new Point(e.clientX-rect.left-el.clientLeft,e.clientY-rect.top-el.clientTop)};exports.touchPos=function(el,e){var rect=el.getBoundingClientRect(),points=[];var touches=e.type==="touchend"?e.changedTouches:e.touches;for(var i=0;i<touches.length;i++){points.push(new Point(touches[i].clientX-rect.left-el.clientLeft,touches[i].clientY-rect.top-el.clientTop))}return points};exports.remove=function(node){if(node.parentNode){node.parentNode.removeChild(node)}}},{"./window":122,"point-geometry":196}],128:[function(require,module,exports){"use strict";var util=require("./util");var Evented={on:function(type,listener){this._listeners=this._listeners||{};this._listeners[type]=this._listeners[type]||[];this._listeners[type].push(listener);return this},off:function(type,listener){if(this._listeners&&this._listeners[type]){var index=this._listeners[type].indexOf(listener);if(index!==-1){this._listeners[type].splice(index,1)}}return this},once:function(type,listener){var wrapper=function(data){this.off(type,wrapper);listener.call(this,data)}.bind(this);this.on(type,wrapper);return this},fire:function(type,data){if(this.listens(type)){data=util.extend({},data,{type:type,target:this});var listeners=this._listeners&&this._listeners[type]?this._listeners[type].slice():[];for(var i=0;i<listeners.length;i++){listeners[i].call(this,data)}if(this._eventedParent){this._eventedParent.fire(type,util.extend({},data,this._eventedParentData))}}else if(util.endsWith(type,"error")){console.error(data&&data.error||data||"Empty error event")}return this},listens:function(type){return this._listeners&&this._listeners[type]||this._eventedParent&&this._eventedParent.listens(type)},setEventedParent:function(parent,data){this._eventedParent=parent;this._eventedParentData=data;return this}};module.exports=Evented},{"./util":137}],129:[function(require,module,exports){"use strict";var Queue=require("tinyqueue");var Point=require("point-geometry");var distToSegmentSquared=require("./intersection_tests").distToSegmentSquared;module.exports=function(polygonRings,precision,debug){precision=precision||1;var minX,minY,maxX,maxY;var outerRing=polygonRings[0];for(var i=0;i<outerRing.length;i++){var p=outerRing[i];if(!i||p.x<minX)minX=p.x;if(!i||p.y<minY)minY=p.y;if(!i||p.x>maxX)maxX=p.x;if(!i||p.y>maxY)maxY=p.y}var width=maxX-minX;var height=maxY-minY;var cellSize=Math.min(width,height);var h=cellSize/2;var cellQueue=new Queue(null,compareMax);for(var x=minX;x<maxX;x+=cellSize){for(var y=minY;y<maxY;y+=cellSize){cellQueue.push(new Cell(x+h,y+h,h,polygonRings))}}var bestCell=getCentroidCell(polygonRings);var numProbes=cellQueue.length;while(cellQueue.length){var cell=cellQueue.pop();if(cell.d>bestCell.d){bestCell=cell;if(debug)console.log("found best %d after %d probes",Math.round(1e4*cell.d)/1e4,numProbes)}if(cell.max-bestCell.d<=precision)continue;h=cell.h/2;cellQueue.push(new Cell(cell.p.x-h,cell.p.y-h,h,polygonRings));cellQueue.push(new Cell(cell.p.x+h,cell.p.y-h,h,polygonRings));cellQueue.push(new Cell(cell.p.x-h,cell.p.y+h,h,polygonRings));cellQueue.push(new Cell(cell.p.x+h,cell.p.y+h,h,polygonRings));numProbes+=4}if(debug){console.log("num probes: "+numProbes);console.log("best distance: "+bestCell.d)}return bestCell.p};function compareMax(a,b){return b.max-a.max}function Cell(x,y,h,polygon){this.p=new Point(x,y);this.h=h;this.d=pointToPolygonDist(this.p,polygon);this.max=this.d+this.h*Math.SQRT2}function pointToPolygonDist(p,polygon){var inside=false;var minDistSq=Infinity;for(var k=0;k<polygon.length;k++){var ring=polygon[k];for(var i=0,len=ring.length,j=len-1;i<len;j=i++){var a=ring[i];var b=ring[j];if(a.y>p.y!==b.y>p.y&&p.x<(b.x-a.x)*(p.y-a.y)/(b.y-a.y)+a.x)inside=!inside;minDistSq=Math.min(minDistSq,distToSegmentSquared(p,a,b))}}return(inside?1:-1)*Math.sqrt(minDistSq)}function getCentroidCell(polygon){var area=0;var x=0;var y=0;var points=polygon[0];for(var i=0,len=points.length,j=len-1;i<len;j=i++){var a=points[i];var b=points[j];var f=a.x*b.y-b.x*a.y;x+=(a.x+b.x)*f;y+=(a.y+b.y)*f;area+=f*3}return new Cell(x/area,y/area,0,polygon)}},{"./intersection_tests":132,"point-geometry":196,tinyqueue:204}],130:[function(require,module,exports){"use strict";module.exports=Glyphs;function Glyphs(pbf,end){this.stacks=pbf.readFields(readFontstacks,[],end)}function readFontstacks(tag,stacks,pbf){if(tag===1){var fontstack=pbf.readMessage(readFontstack,{glyphs:{}});stacks.push(fontstack)}}function readFontstack(tag,fontstack,pbf){if(tag===1)fontstack.name=pbf.readString();else if(tag===2)fontstack.range=pbf.readString();else if(tag===3){var glyph=pbf.readMessage(readGlyph,{});fontstack.glyphs[glyph.id]=glyph}}function readGlyph(tag,glyph,pbf){if(tag===1)glyph.id=pbf.readVarint();else if(tag===2)glyph.bitmap=pbf.readBytes();else if(tag===3)glyph.width=pbf.readVarint();else if(tag===4)glyph.height=pbf.readVarint();else if(tag===5)glyph.left=pbf.readSVarint();else if(tag===6)glyph.top=pbf.readSVarint();else if(tag===7)glyph.advance=pbf.readVarint()}},{}],131:[function(require,module,exports){"use strict";module.exports=interpolate;function interpolate(a,b,t){return a*(1-t)+b*t}interpolate.number=interpolate;interpolate.vec2=function(from,to,t){return[interpolate(from[0],to[0],t),interpolate(from[1],to[1],t)]};interpolate.color=function(from,to,t){return[interpolate(from[0],to[0],t),interpolate(from[1],to[1],t),interpolate(from[2],to[2],t),interpolate(from[3],to[3],t)]};interpolate.array=function(from,to,t){return from.map(function(d,i){return interpolate(d,to[i],t)})}},{}],132:[function(require,module,exports){"use strict";var isCounterClockwise=require("./util").isCounterClockwise;module.exports={multiPolygonIntersectsBufferedMultiPoint:multiPolygonIntersectsBufferedMultiPoint,multiPolygonIntersectsMultiPolygon:multiPolygonIntersectsMultiPolygon,multiPolygonIntersectsBufferedMultiLine:multiPolygonIntersectsBufferedMultiLine,distToSegmentSquared:distToSegmentSquared};function multiPolygonIntersectsBufferedMultiPoint(multiPolygon,rings,radius){for(var j=0;j<multiPolygon.length;j++){var polygon=multiPolygon[j];for(var i=0;i<rings.length;i++){var ring=rings[i];for(var k=0;k<ring.length;k++){var point=ring[k];if(polygonContainsPoint(polygon,point))return true;if(pointIntersectsBufferedLine(point,polygon,radius))return true}}}return false}function multiPolygonIntersectsMultiPolygon(multiPolygonA,multiPolygonB){if(multiPolygonA.length===1&&multiPolygonA[0].length===1){return multiPolygonContainsPoint(multiPolygonB,multiPolygonA[0][0])}for(var m=0;m<multiPolygonB.length;m++){var ring=multiPolygonB[m];for(var n=0;n<ring.length;n++){if(multiPolygonContainsPoint(multiPolygonA,ring[n]))return true}}for(var j=0;j<multiPolygonA.length;j++){var polygon=multiPolygonA[j];for(var i=0;i<polygon.length;i++){if(multiPolygonContainsPoint(multiPolygonB,polygon[i]))return true}for(var k=0;k<multiPolygonB.length;k++){if(lineIntersectsLine(polygon,multiPolygonB[k]))return true}}return false}function multiPolygonIntersectsBufferedMultiLine(multiPolygon,multiLine,radius){for(var i=0;i<multiLine.length;i++){var line=multiLine[i];for(var j=0;j<multiPolygon.length;j++){var polygon=multiPolygon[j];if(polygon.length>=3){for(var k=0;k<line.length;k++){if(polygonContainsPoint(polygon,line[k]))return true}}if(lineIntersectsBufferedLine(polygon,line,radius))return true}}return false}function lineIntersectsBufferedLine(lineA,lineB,radius){if(lineA.length>1){if(lineIntersectsLine(lineA,lineB))return true;for(var j=0;j<lineB.length;j++){if(pointIntersectsBufferedLine(lineB[j],lineA,radius))return true}}for(var k=0;k<lineA.length;k++){if(pointIntersectsBufferedLine(lineA[k],lineB,radius))return true}return false}function lineIntersectsLine(lineA,lineB){for(var i=0;i<lineA.length-1;i++){var a0=lineA[i];var a1=lineA[i+1];for(var j=0;j<lineB.length-1;j++){var b0=lineB[j];var b1=lineB[j+1];if(lineSegmentIntersectsLineSegment(a0,a1,b0,b1))return true}}return false}function lineSegmentIntersectsLineSegment(a0,a1,b0,b1){return isCounterClockwise(a0,b0,b1)!==isCounterClockwise(a1,b0,b1)&&isCounterClockwise(a0,a1,b0)!==isCounterClockwise(a0,a1,b1)}function pointIntersectsBufferedLine(p,line,radius){var radiusSquared=radius*radius;if(line.length===1)return p.distSqr(line[0])<radiusSquared;for(var i=1;i<line.length;i++){var v=line[i-1],w=line[i];if(distToSegmentSquared(p,v,w)<radiusSquared)return true}return false}function distToSegmentSquared(p,v,w){var l2=v.distSqr(w);if(l2===0)return p.distSqr(v);var t=((p.x-v.x)*(w.x-v.x)+(p.y-v.y)*(w.y-v.y))/l2;if(t<0)return p.distSqr(v);if(t>1)return p.distSqr(w);return p.distSqr(w.sub(v)._mult(t)._add(v))}function multiPolygonContainsPoint(rings,p){var c=false,ring,p1,p2;for(var k=0;k<rings.length;k++){ring=rings[k];for(var i=0,j=ring.length-1;i<ring.length;j=i++){p1=ring[i];p2=ring[j];if(p1.y>p.y!==p2.y>p.y&&p.x<(p2.x-p1.x)*(p.y-p1.y)/(p2.y-p1.y)+p1.x){c=!c}}}return c}function polygonContainsPoint(ring,p){var c=false;for(var i=0,j=ring.length-1;i<ring.length;j=i++){var p1=ring[i];var p2=ring[j];if(p1.y>p.y!==p2.y>p.y&&p.x<(p2.x-p1.x)*(p.y-p1.y)/(p2.y-p1.y)+p1.x){c=!c}}return c}},{"./util":137}],133:[function(require,module,exports){"use strict";module.exports=LRUCache;function LRUCache(max,onRemove){this.max=max;this.onRemove=onRemove;this.reset()}LRUCache.prototype.reset=function(){for(var key in this.data){this.onRemove(this.data[key])}this.data={};this.order=[];return this};LRUCache.prototype.add=function(key,data){if(this.has(key)){this.order.splice(this.order.indexOf(key),1);this.data[key]=data;this.order.push(key)}else{this.data[key]=data;this.order.push(key);if(this.order.length>this.max){var removedData=this.get(this.order[0]);if(removedData)this.onRemove(removedData)}}return this};LRUCache.prototype.has=function(key){return key in this.data};LRUCache.prototype.keys=function(){return this.order};LRUCache.prototype.get=function(key){if(!this.has(key)){return null}var data=this.data[key];delete this.data[key];this.order.splice(this.order.indexOf(key),1);return data};LRUCache.prototype.setMaxSize=function(max){this.max=max;while(this.order.length>this.max){var removedData=this.get(this.order[0]);if(removedData)this.onRemove(removedData)}return this}},{}],134:[function(require,module,exports){"use strict";var config=require("./config");var browser=require("./browser");var URL=require("url");var util=require("./util");function makeAPIURL(path,query,accessToken){accessToken=accessToken||config.ACCESS_TOKEN;if(!accessToken&&config.REQUIRE_ACCESS_TOKEN){throw new Error("An API access token is required to use Mapbox GL. "+"See https://www.mapbox.com/developers/api/#access-tokens")}var url=config.API_URL+path+(query?"?"+query:"");if(config.REQUIRE_ACCESS_TOKEN){if(accessToken[0]==="s"){throw new Error("Use a public access token (pk.*) with Mapbox GL JS, not a secret access token (sk.*). "+"See https://www.mapbox.com/developers/api/#access-tokens")}url+=(query?"&":"?")+"access_token="+accessToken}return url}module.exports.isMapboxURL=function(url){return URL.parse(url).protocol==="mapbox:"};module.exports.normalizeStyleURL=function(url,accessToken){var urlObject=URL.parse(url);if(urlObject.protocol!=="mapbox:"){return url}else{return makeAPIURL("/styles/v1"+urlObject.pathname,urlObject.query,accessToken)}};module.exports.normalizeSourceURL=function(url,accessToken){var urlObject=URL.parse(url);if(urlObject.protocol!=="mapbox:"){return url}else{var sources=url.match(/mapbox:\/\/([^?]+)/)[1];return makeAPIURL("/v4/"+sources+".json",urlObject.query,accessToken)+"&secure"}};module.exports.normalizeGlyphsURL=function(url,accessToken){var urlObject=URL.parse(url);if(urlObject.protocol!=="mapbox:"){return url}else{var user=urlObject.pathname.split("/")[1];return makeAPIURL("/fonts/v1/"+user+"/{fontstack}/{range}.pbf",urlObject.query,accessToken)}};module.exports.normalizeSpriteURL=function(url,format,extension,accessToken){var urlObject=URL.parse(url);if(urlObject.protocol!=="mapbox:"){urlObject.pathname+=format+extension;return URL.format(urlObject)}else{return makeAPIURL("/styles/v1"+urlObject.pathname+"/sprite"+format+extension,urlObject.query,accessToken)}};module.exports.normalizeTileURL=function(tileURL,sourceURL,tileSize){var tileURLObject=URL.parse(tileURL,true);if(!sourceURL)return tileURL;var sourceURLObject=URL.parse(sourceURL);if(sourceURLObject.protocol!=="mapbox:")return tileURL;var extension=browser.supportsWebp?".webp":"$1";var resolution=browser.devicePixelRatio>=2||tileSize===512?"@2x":"";return URL.format({protocol:tileURLObject.protocol,hostname:tileURLObject.hostname,pathname:tileURLObject.pathname.replace(/(\.(?:png|jpg)\d*)/,resolution+extension),query:replaceTempAccessToken(tileURLObject.query)})};function replaceTempAccessToken(query){if(query.access_token&&query.access_token.slice(0,3)==="tk."){return util.extend({},query,{access_token:config.ACCESS_TOKEN})}else{return query}}},{"./browser":120,"./config":124,"./util":137,url:7}],135:[function(require,module,exports){"use strict";module.exports=StructArrayType;var viewTypes={Int8:Int8Array,Uint8:Uint8Array,Uint8Clamped:Uint8ClampedArray,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array,Float64:Float64Array};var structArrayTypeCache={};function StructArrayType(options){var key=JSON.stringify(options);if(structArrayTypeCache[key]){return structArrayTypeCache[key]}if(options.alignment===undefined)options.alignment=1;function StructType(){Struct.apply(this,arguments)}StructType.prototype=Object.create(Struct.prototype);var offset=0;var maxSize=0;var usedTypes=["Uint8"];StructType.prototype.members=options.members.map(function(member){member={name:member.name,type:member.type,components:member.components||1};if(usedTypes.indexOf(member.type)<0)usedTypes.push(member.type);var typeSize=sizeOf(member.type);maxSize=Math.max(maxSize,typeSize);member.offset=offset=align(offset,Math.max(options.alignment,typeSize));for(var c=0;c<member.components;c++){Object.defineProperty(StructType.prototype,member.name+(member.components===1?"":c),{get:createGetter(member,c),set:createSetter(member,c)})}offset+=typeSize*member.components;return member});StructType.prototype.alignment=options.alignment;StructType.prototype.size=align(offset,Math.max(maxSize,options.alignment));function StructArrayType(){StructArray.apply(this,arguments);this.members=StructType.prototype.members}StructArrayType.serialize=serializeStructArrayType;StructArrayType.prototype=Object.create(StructArray.prototype);StructArrayType.prototype.StructType=StructType;StructArrayType.prototype.bytesPerElement=StructType.prototype.size;StructArrayType.prototype.emplaceBack=createEmplaceBack(StructType.prototype.members,StructType.prototype.size);StructArrayType.prototype._usedTypes=usedTypes;structArrayTypeCache[key]=StructArrayType;return StructArrayType}function serializeStructArrayType(){return{members:this.prototype.StructType.prototype.members,alignment:this.prototype.StructType.prototype.alignment,bytesPerElement:this.prototype.bytesPerElement}}function align(offset,size){return Math.ceil(offset/size)*size}function sizeOf(type){return viewTypes[type].BYTES_PER_ELEMENT}function getArrayViewName(type){return type.toLowerCase()}function createEmplaceBack(members,bytesPerElement){var usedTypeSizes=[];var argNames=[];var body=""+"var i = this.length;\n"+"this.resize(this.length + 1);\n";for(var m=0;m<members.length;m++){var member=members[m];var size=sizeOf(member.type);if(usedTypeSizes.indexOf(size)<0){usedTypeSizes.push(size);body+="var o"+size.toFixed(0)+" = i * "+(bytesPerElement/size).toFixed(0)+";\n"}for(var c=0;c<member.components;c++){var argName="v"+argNames.length;var index="o"+size.toFixed(0)+" + "+(member.offset/size+c).toFixed(0);body+="this."+getArrayViewName(member.type)+"["+index+"] = "+argName+";\n";argNames.push(argName)}}body+="return i;";return new Function(argNames,body)}function createMemberComponentString(member,component){var elementOffset="this._pos"+sizeOf(member.type).toFixed(0);var componentOffset=(member.offset/sizeOf(member.type)+component).toFixed(0);var index=elementOffset+" + "+componentOffset;return"this._structArray."+getArrayViewName(member.type)+"["+index+"]"}function createGetter(member,c){return new Function([],"return "+createMemberComponentString(member,c)+";")}function createSetter(member,c){return new Function(["x"],createMemberComponentString(member,c)+" = x;")}function Struct(structArray,index){this._structArray=structArray;this._pos1=index*this.size;this._pos2=this._pos1/2;this._pos4=this._pos1/4;this._pos8=this._pos1/8}function StructArray(serialized){if(serialized!==undefined){this.arrayBuffer=serialized.arrayBuffer;this.length=serialized.length;
this.capacity=this.arrayBuffer.byteLength/this.bytesPerElement;this._refreshViews()}else{this.capacity=-1;this.resize(0)}}StructArray.prototype.DEFAULT_CAPACITY=128;StructArray.prototype.RESIZE_MULTIPLIER=5;StructArray.prototype.serialize=function(){this.trim();return{length:this.length,arrayBuffer:this.arrayBuffer}};StructArray.prototype.get=function(index){return new this.StructType(this,index)};StructArray.prototype.trim=function(){if(this.length!==this.capacity){this.capacity=this.length;this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement);this._refreshViews()}};StructArray.prototype.resize=function(n){this.length=n;if(n>this.capacity){this.capacity=Math.max(n,Math.floor(this.capacity*this.RESIZE_MULTIPLIER),this.DEFAULT_CAPACITY);this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var oldUint8Array=this.uint8;this._refreshViews();if(oldUint8Array)this.uint8.set(oldUint8Array)}};StructArray.prototype._refreshViews=function(){for(var t=0;t<this._usedTypes.length;t++){var type=this._usedTypes[t];this[getArrayViewName(type)]=new viewTypes[type](this.arrayBuffer)}};StructArray.prototype.toArray=function(startIndex,endIndex){var array=[];for(var i=startIndex;i<endIndex;i++){var struct=this.get(i);array.push(struct)}return array}},{}],136:[function(require,module,exports){"use strict";module.exports=resolveTokens;function resolveTokens(properties,text){return text.replace(/{([^{}]+)}/g,function(match,key){return key in properties?properties[key]:""})}},{}],137:[function(require,module,exports){"use strict";var UnitBezier=require("unitbezier");var Coordinate=require("../geo/coordinate");exports.easeCubicInOut=function(t){if(t<=0)return 0;if(t>=1)return 1;var t2=t*t,t3=t2*t;return 4*(t<.5?t3:3*(t-t2)+t3-.75)};exports.bezier=function(p1x,p1y,p2x,p2y){var bezier=new UnitBezier(p1x,p1y,p2x,p2y);return function(t){return bezier.solve(t)}};exports.ease=exports.bezier(.25,.1,.25,1);exports.clamp=function(n,min,max){return Math.min(max,Math.max(min,n))};exports.wrap=function(n,min,max){var d=max-min;var w=((n-min)%d+d)%d+min;return w===min?max:w};exports.coalesce=function(){for(var i=0;i<arguments.length;i++){var arg=arguments[i];if(arg!==null&&arg!==undefined)return arg}};exports.asyncAll=function(array,fn,callback){if(!array.length){return callback(null,[])}var remaining=array.length;var results=new Array(array.length);var error=null;array.forEach(function(item,i){fn(item,function(err,result){if(err)error=err;results[i]=result;if(--remaining===0)callback(error,results)})})};exports.keysDifference=function(obj,other){var difference=[];for(var i in obj){if(!(i in other)){difference.push(i)}}return difference};exports.extend=function(dest){for(var i=1;i<arguments.length;i++){var src=arguments[i];for(var k in src){dest[k]=src[k]}}return dest};exports.extendAll=function(dest,src){for(var i in src){Object.defineProperty(dest,i,Object.getOwnPropertyDescriptor(src,i))}return dest};exports.inherit=function(parent,props){var parentProto=typeof parent==="function"?parent.prototype:parent,proto=Object.create(parentProto);exports.extendAll(proto,props);return proto};exports.pick=function(src,properties){var result={};for(var i=0;i<properties.length;i++){var k=properties[i];if(k in src){result[k]=src[k]}}return result};var id=1;exports.uniqueId=function(){return id++};exports.debounce=function(fn,time){var timer,args;return function(){args=arguments;clearTimeout(timer);timer=setTimeout(function(){fn.apply(null,args)},time)}};exports.bindAll=function(fns,context){fns.forEach(function(fn){if(!context[fn]){return}context[fn]=context[fn].bind(context)})};exports.bindHandlers=function(context){for(var i in context){if(typeof context[i]==="function"&&i.indexOf("_on")===0){context[i]=context[i].bind(context)}}};exports.setOptions=function(obj,options){if(!obj.hasOwnProperty("options")){obj.options=obj.options?Object.create(obj.options):{}}for(var i in options){obj.options[i]=options[i]}return obj.options};exports.getCoordinatesCenter=function(coords){var minX=Infinity;var minY=Infinity;var maxX=-Infinity;var maxY=-Infinity;for(var i=0;i<coords.length;i++){minX=Math.min(minX,coords[i].column);minY=Math.min(minY,coords[i].row);maxX=Math.max(maxX,coords[i].column);maxY=Math.max(maxY,coords[i].row)}var dx=maxX-minX;var dy=maxY-minY;var dMax=Math.max(dx,dy);return new Coordinate((minX+maxX)/2,(minY+maxY)/2,0).zoomTo(Math.floor(-Math.log(dMax)/Math.LN2))};exports.endsWith=function(string,suffix){return string.indexOf(suffix,string.length-suffix.length)!==-1};exports.startsWith=function(string,prefix){return string.indexOf(prefix)===0};exports.mapObject=function(input,iterator,context){var output={};for(var key in input){output[key]=iterator.call(context||this,input[key],key,input)}return output};exports.filterObject=function(input,iterator,context){var output={};for(var key in input){if(iterator.call(context||this,input[key],key,input)){output[key]=input[key]}}return output};exports.deepEqual=function(a,b){if(Array.isArray(a)){if(!Array.isArray(b)||a.length!==b.length)return false;for(var i=0;i<a.length;i++){if(!exports.deepEqual(a[i],b[i]))return false}return true}if(typeof a==="object"&&a!==null&&b!==null){if(!(typeof b==="object"))return false;var keys=Object.keys(a);if(keys.length!==Object.keys(b).length)return false;for(var key in a){if(!exports.deepEqual(a[key],b[key]))return false}return true}return a===b};exports.clone=function(input){if(Array.isArray(input)){return input.map(exports.clone)}else if(typeof input==="object"){return exports.mapObject(input,exports.clone)}else{return input}};exports.arraysIntersect=function(a,b){for(var l=0;l<a.length;l++){if(b.indexOf(a[l])>=0)return true}return false};var warnOnceHistory={};exports.warnOnce=function(message){if(!warnOnceHistory[message]){if(typeof console!=="undefined")console.warn(message);warnOnceHistory[message]=true}};exports.isCounterClockwise=function(a,b,c){return(c.y-a.y)*(b.x-a.x)>(b.y-a.y)*(c.x-a.x)};exports.calculateSignedArea=function(ring){var sum=0;for(var i=0,len=ring.length,j=len-1,p1,p2;i<len;j=i++){p1=ring[i];p2=ring[j];sum+=(p2.x-p1.x)*(p1.y+p2.y)}return sum};exports.isClosedPolygon=function(points){if(points.length<4)return false;var p1=points[0];var p2=points[points.length-1];if(Math.abs(p1.x-p2.x)>0||Math.abs(p1.y-p2.y)>0){return false}return Math.abs(exports.calculateSignedArea(points))>.01};exports.sphericalToCartesian=function(spherical){var r=spherical[0],azimuthal=spherical[1],polar=spherical[2];azimuthal+=90;azimuthal*=Math.PI/180;polar*=Math.PI/180;return[r*Math.cos(azimuthal)*Math.sin(polar),r*Math.sin(azimuthal)*Math.sin(polar),r*Math.cos(polar)]}},{"../geo/coordinate":27,unitbezier:205}],138:[function(require,module,exports){"use strict";module.exports=Feature;function Feature(vectorTileFeature,z,x,y){this._vectorTileFeature=vectorTileFeature;vectorTileFeature._z=z;vectorTileFeature._x=x;vectorTileFeature._y=y;this.properties=vectorTileFeature.properties;if(vectorTileFeature.id!=null){this.id=vectorTileFeature.id}}Feature.prototype={type:"Feature",get geometry(){if(this._geometry===undefined){this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry}return this._geometry},set geometry(g){this._geometry=g},toJSON:function(){var json={};for(var i in this){if(i==="_geometry"||i==="_vectorTileFeature"||i==="toJSON")continue;json[i]=this[i]}return json}}},{}],139:[function(require,module,exports){"use strict";var WebWorker=require("./web_worker");module.exports=WorkerPool;function WorkerPool(){this.active={}}WorkerPool.prototype={acquire:function(mapId){if(!this.workers){var workerCount=require("../mapbox-gl").workerCount;this.workers=[];while(this.workers.length<workerCount){this.workers.push(new WebWorker)}}this.active[mapId]=true;return this.workers.slice()},release:function(mapId){delete this.active[mapId];if(Object.keys(this.active).length===0){this.workers.forEach(function(w){w.terminate()});this.workers=null}}}},{"../mapbox-gl":33,"./web_worker":121}],140:[function(require,module,exports){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]};function clamp_css_byte(i){i=Math.round(i);return i<0?0:i>255?255:i}function clamp_css_float(f){return f<0?0:f>1?1:f}function parse_css_int(str){if(str[str.length-1]==="%")return clamp_css_byte(parseFloat(str)/100*255);return clamp_css_byte(parseInt(str))}function parse_css_float(str){if(str[str.length-1]==="%")return clamp_css_float(parseFloat(str)/100);return clamp_css_float(parseFloat(str))}function css_hue_to_rgb(m1,m2,h){if(h<0)h+=1;else if(h>1)h-=1;if(h*6<1)return m1+(m2-m1)*h*6;if(h*2<1)return m2;if(h*3<2)return m1+(m2-m1)*(2/3-h)*6;return m1}function parseCSSColor(css_str){var str=css_str.replace(/ /g,"").toLowerCase();if(str in kCSSColorTable)return kCSSColorTable[str].slice();if(str[0]==="#"){if(str.length===4){var iv=parseInt(str.substr(1),16);if(!(iv>=0&&iv<=4095))return null;return[(iv&3840)>>4|(iv&3840)>>8,iv&240|(iv&240)>>4,iv&15|(iv&15)<<4,1]}else if(str.length===7){var iv=parseInt(str.substr(1),16);if(!(iv>=0&&iv<=16777215))return null;return[(iv&16711680)>>16,(iv&65280)>>8,iv&255,1]}return null}var op=str.indexOf("("),ep=str.indexOf(")");if(op!==-1&&ep+1===str.length){var fname=str.substr(0,op);var params=str.substr(op+1,ep-(op+1)).split(",");var alpha=1;switch(fname){case"rgba":if(params.length!==4)return null;alpha=parse_css_float(params.pop());case"rgb":if(params.length!==3)return null;return[parse_css_int(params[0]),parse_css_int(params[1]),parse_css_int(params[2]),alpha];case"hsla":if(params.length!==4)return null;alpha=parse_css_float(params.pop());case"hsl":if(params.length!==3)return null;var h=(parseFloat(params[0])%360+360)%360/360;var s=parse_css_float(params[1]);var l=parse_css_float(params[2]);var m2=l<=.5?l*(s+1):l+s-l*s;var m1=l*2-m2;return[clamp_css_byte(css_hue_to_rgb(m1,m2,h+1/3)*255),clamp_css_byte(css_hue_to_rgb(m1,m2,h)*255),clamp_css_byte(css_hue_to_rgb(m1,m2,h-1/3)*255),alpha];default:return null}}return null}try{exports.parseCSSColor=parseCSSColor}catch(e){}},{}],141:[function(require,module,exports){"use strict";module.exports=earcut;function earcut(data,holeIndices,dim){dim=dim||2;var hasHoles=holeIndices&&holeIndices.length,outerLen=hasHoles?holeIndices[0]*dim:data.length,outerNode=linkedList(data,0,outerLen,dim,true),triangles=[];if(!outerNode)return triangles;var minX,minY,maxX,maxY,x,y,size;if(hasHoles)outerNode=eliminateHoles(data,holeIndices,outerNode,dim);if(data.length>80*dim){minX=maxX=data[0];minY=maxY=data[1];for(var i=dim;i<outerLen;i+=dim){x=data[i];y=data[i+1];if(x<minX)minX=x;if(y<minY)minY=y;if(x>maxX)maxX=x;if(y>maxY)maxY=y}size=Math.max(maxX-minX,maxY-minY)}earcutLinked(outerNode,triangles,dim,minX,minY,size);return triangles}function linkedList(data,start,end,dim,clockwise){var i,last;if(clockwise===signedArea(data,start,end,dim)>0){for(i=start;i<end;i+=dim)last=insertNode(i,data[i],data[i+1],last)}else{for(i=end-dim;i>=start;i-=dim)last=insertNode(i,data[i],data[i+1],last)}if(last&&equals(last,last.next)){removeNode(last);last=last.next}return last}function filterPoints(start,end){if(!start)return start;if(!end)end=start;var p=start,again;do{again=false;if(!p.steiner&&(equals(p,p.next)||area(p.prev,p,p.next)===0)){removeNode(p);p=end=p.prev;if(p===p.next)return null;again=true}else{p=p.next}}while(again||p!==end);return end}function earcutLinked(ear,triangles,dim,minX,minY,size,pass){if(!ear)return;if(!pass&&size)indexCurve(ear,minX,minY,size);var stop=ear,prev,next;while(ear.prev!==ear.next){prev=ear.prev;next=ear.next;if(size?isEarHashed(ear,minX,minY,size):isEar(ear)){triangles.push(prev.i/dim);triangles.push(ear.i/dim);triangles.push(next.i/dim);removeNode(ear);ear=next.next;stop=next.next;continue}ear=next;if(ear===stop){if(!pass){earcutLinked(filterPoints(ear),triangles,dim,minX,minY,size,1)}else if(pass===1){ear=cureLocalIntersections(ear,triangles,dim);earcutLinked(ear,triangles,dim,minX,minY,size,2)}else if(pass===2){splitEarcut(ear,triangles,dim,minX,minY,size)}break}}}function isEar(ear){var a=ear.prev,b=ear,c=ear.next;if(area(a,b,c)>=0)return false;var p=ear.next.next;while(p!==ear.prev){if(pointInTriangle(a.x,a.y,b.x,b.y,c.x,c.y,p.x,p.y)&&area(p.prev,p,p.next)>=0)return false;p=p.next}return true}function isEarHashed(ear,minX,minY,size){var a=ear.prev,b=ear,c=ear.next;if(area(a,b,c)>=0)return false;var minTX=a.x<b.x?a.x<c.x?a.x:c.x:b.x<c.x?b.x:c.x,minTY=a.y<b.y?a.y<c.y?a.y:c.y:b.y<c.y?b.y:c.y,maxTX=a.x>b.x?a.x>c.x?a.x:c.x:b.x>c.x?b.x:c.x,maxTY=a.y>b.y?a.y>c.y?a.y:c.y:b.y>c.y?b.y:c.y;var minZ=zOrder(minTX,minTY,minX,minY,size),maxZ=zOrder(maxTX,maxTY,minX,minY,size);var p=ear.nextZ;while(p&&p.z<=maxZ){if(p!==ear.prev&&p!==ear.next&&pointInTriangle(a.x,a.y,b.x,b.y,c.x,c.y,p.x,p.y)&&area(p.prev,p,p.next)>=0)return false;p=p.nextZ}p=ear.prevZ;while(p&&p.z>=minZ){if(p!==ear.prev&&p!==ear.next&&pointInTriangle(a.x,a.y,b.x,b.y,c.x,c.y,p.x,p.y)&&area(p.prev,p,p.next)>=0)return false;p=p.prevZ}return true}function cureLocalIntersections(start,triangles,dim){var p=start;do{var a=p.prev,b=p.next.next;if(!equals(a,b)&&intersects(a,p,p.next,b)&&locallyInside(a,b)&&locallyInside(b,a)){triangles.push(a.i/dim);triangles.push(p.i/dim);triangles.push(b.i/dim);removeNode(p);removeNode(p.next);p=start=b}p=p.next}while(p!==start);return p}function splitEarcut(start,triangles,dim,minX,minY,size){var a=start;do{var b=a.next.next;while(b!==a.prev){if(a.i!==b.i&&isValidDiagonal(a,b)){var c=splitPolygon(a,b);a=filterPoints(a,a.next);c=filterPoints(c,c.next);earcutLinked(a,triangles,dim,minX,minY,size);earcutLinked(c,triangles,dim,minX,minY,size);return}b=b.next}a=a.next}while(a!==start)}function eliminateHoles(data,holeIndices,outerNode,dim){var queue=[],i,len,start,end,list;for(i=0,len=holeIndices.length;i<len;i++){start=holeIndices[i]*dim;end=i<len-1?holeIndices[i+1]*dim:data.length;list=linkedList(data,start,end,dim,false);if(list===list.next)list.steiner=true;queue.push(getLeftmost(list))}queue.sort(compareX);for(i=0;i<queue.length;i++){eliminateHole(queue[i],outerNode);outerNode=filterPoints(outerNode,outerNode.next)}return outerNode}function compareX(a,b){return a.x-b.x}function eliminateHole(hole,outerNode){outerNode=findHoleBridge(hole,outerNode);if(outerNode){var b=splitPolygon(outerNode,hole);filterPoints(b,b.next)}}function findHoleBridge(hole,outerNode){var p=outerNode,hx=hole.x,hy=hole.y,qx=-Infinity,m;do{if(hy<=p.y&&hy>=p.next.y){var x=p.x+(hy-p.y)*(p.next.x-p.x)/(p.next.y-p.y);if(x<=hx&&x>qx){qx=x;if(x===hx){if(hy===p.y)return p;if(hy===p.next.y)return p.next}m=p.x<p.next.x?p:p.next}}p=p.next}while(p!==outerNode);if(!m)return null;if(hx===qx)return m.prev;var stop=m,mx=m.x,my=m.y,tanMin=Infinity,tan;p=m.next;while(p!==stop){if(hx>=p.x&&p.x>=mx&&pointInTriangle(hy<my?hx:qx,hy,mx,my,hy<my?qx:hx,hy,p.x,p.y)){tan=Math.abs(hy-p.y)/(hx-p.x);if((tan<tanMin||tan===tanMin&&p.x>m.x)&&locallyInside(p,hole)){m=p;tanMin=tan}}p=p.next}return m}function indexCurve(start,minX,minY,size){var p=start;do{if(p.z===null)p.z=zOrder(p.x,p.y,minX,minY,size);p.prevZ=p.prev;p.nextZ=p.next;p=p.next}while(p!==start);p.prevZ.nextZ=null;p.prevZ=null;sortLinked(p)}function sortLinked(list){var i,p,q,e,tail,numMerges,pSize,qSize,inSize=1;do{p=list;list=null;tail=null;numMerges=0;while(p){numMerges++;q=p;pSize=0;for(i=0;i<inSize;i++){pSize++;q=q.nextZ;if(!q)break}qSize=inSize;while(pSize>0||qSize>0&&q){if(pSize===0){e=q;q=q.nextZ;qSize--}else if(qSize===0||!q){e=p;p=p.nextZ;pSize--}else if(p.z<=q.z){e=p;p=p.nextZ;pSize--}else{e=q;q=q.nextZ;qSize--}if(tail)tail.nextZ=e;else list=e;e.prevZ=tail;tail=e}p=q}tail.nextZ=null;inSize*=2}while(numMerges>1);return list}function zOrder(x,y,minX,minY,size){x=32767*(x-minX)/size;y=32767*(y-minY)/size;x=(x|x<<8)&16711935;x=(x|x<<4)&252645135;x=(x|x<<2)&858993459;x=(x|x<<1)&1431655765;y=(y|y<<8)&16711935;y=(y|y<<4)&252645135;y=(y|y<<2)&858993459;y=(y|y<<1)&1431655765;return x|y<<1}function getLeftmost(start){var p=start,leftmost=start;do{if(p.x<leftmost.x)leftmost=p;p=p.next}while(p!==start);return leftmost}function pointInTriangle(ax,ay,bx,by,cx,cy,px,py){return(cx-px)*(ay-py)-(ax-px)*(cy-py)>=0&&(ax-px)*(by-py)-(bx-px)*(ay-py)>=0&&(bx-px)*(cy-py)-(cx-px)*(by-py)>=0}function isValidDiagonal(a,b){return a.next.i!==b.i&&a.prev.i!==b.i&&!intersectsPolygon(a,b)&&locallyInside(a,b)&&locallyInside(b,a)&&middleInside(a,b)}function area(p,q,r){return(q.y-p.y)*(r.x-q.x)-(q.x-p.x)*(r.y-q.y)}function equals(p1,p2){return p1.x===p2.x&&p1.y===p2.y}function intersects(p1,q1,p2,q2){if(equals(p1,q1)&&equals(p2,q2)||equals(p1,q2)&&equals(p2,q1))return true;return area(p1,q1,p2)>0!==area(p1,q1,q2)>0&&area(p2,q2,p1)>0!==area(p2,q2,q1)>0}function intersectsPolygon(a,b){var p=a;do{if(p.i!==a.i&&p.next.i!==a.i&&p.i!==b.i&&p.next.i!==b.i&&intersects(p,p.next,a,b))return true;p=p.next}while(p!==a);return false}function locallyInside(a,b){return area(a.prev,a,a.next)<0?area(a,b,a.next)>=0&&area(a,a.prev,b)>=0:area(a,b,a.prev)<0||area(a,a.next,b)<0}function middleInside(a,b){var p=a,inside=false,px=(a.x+b.x)/2,py=(a.y+b.y)/2;do{if(p.y>py!==p.next.y>py&&px<(p.next.x-p.x)*(py-p.y)/(p.next.y-p.y)+p.x)inside=!inside;p=p.next}while(p!==a);return inside}function splitPolygon(a,b){var a2=new Node(a.i,a.x,a.y),b2=new Node(b.i,b.x,b.y),an=a.next,bp=b.prev;a.next=b;b.prev=a;a2.next=an;an.prev=a2;b2.next=a2;a2.prev=b2;bp.next=b2;b2.prev=bp;return b2}function insertNode(i,x,y,last){var p=new Node(i,x,y);if(!last){p.prev=p;p.next=p}else{p.next=last.next;p.prev=last;last.next.prev=p;last.next=p}return p}function removeNode(p){p.next.prev=p.prev;p.prev.next=p.next;if(p.prevZ)p.prevZ.nextZ=p.nextZ;if(p.nextZ)p.nextZ.prevZ=p.prevZ}function Node(i,x,y){this.i=i;this.x=x;this.y=y;this.prev=null;this.next=null;this.z=null;this.prevZ=null;this.nextZ=null;this.steiner=false}earcut.deviation=function(data,holeIndices,dim,triangles){var hasHoles=holeIndices&&holeIndices.length;var outerLen=hasHoles?holeIndices[0]*dim:data.length;var polygonArea=Math.abs(signedArea(data,0,outerLen,dim));if(hasHoles){for(var i=0,len=holeIndices.length;i<len;i++){var start=holeIndices[i]*dim;var end=i<len-1?holeIndices[i+1]*dim:data.length;polygonArea-=Math.abs(signedArea(data,start,end,dim))}}var trianglesArea=0;for(i=0;i<triangles.length;i+=3){var a=triangles[i]*dim;var b=triangles[i+1]*dim;var c=triangles[i+2]*dim;trianglesArea+=Math.abs((data[a]-data[c])*(data[b+1]-data[a+1])-(data[a]-data[b])*(data[c+1]-data[a+1]))}return polygonArea===0&&trianglesArea===0?0:Math.abs((trianglesArea-polygonArea)/polygonArea)};function signedArea(data,start,end,dim){var sum=0;for(var i=start,j=end-dim;i<end;i+=dim){sum+=(data[j]-data[i])*(data[i+1]+data[j+1]);j=i}return sum}earcut.flatten=function(data){var dim=data[0][0].length,result={vertices:[],holes:[],dimensions:dim},holeIndex=0;for(var i=0;i<data.length;i++){for(var j=0;j<data[i].length;j++){for(var d=0;d<dim;d++)result.vertices.push(data[i][j][d])}if(i>0){holeIndex+=data[i-1].length;result.holes.push(holeIndex)}}return result}},{}],142:[function(require,module,exports){"use strict";module.exports=createFilter;var types=["Unknown","Point","LineString","Polygon"];function createFilter(filter){return new Function("f","var p = (f && f.properties || {}); return "+compile(filter))}function compile(filter){if(!filter)return"true";var op=filter[0];if(filter.length<=1)return op==="any"?"false":"true";var str=op==="=="?compileComparisonOp(filter[1],filter[2],"===",false):op==="!="?compileComparisonOp(filter[1],filter[2],"!==",false):op==="<"||op===">"||op==="<="||op===">="?compileComparisonOp(filter[1],filter[2],op,true):op==="any"?compileLogicalOp(filter.slice(1),"||"):op==="all"?compileLogicalOp(filter.slice(1),"&&"):op==="none"?compileNegation(compileLogicalOp(filter.slice(1),"||")):op==="in"?compileInOp(filter[1],filter.slice(2)):op==="!in"?compileNegation(compileInOp(filter[1],filter.slice(2))):op==="has"?compileHasOp(filter[1]):op==="!has"?compileNegation(compileHasOp([filter[1]])):"true";return"("+str+")"}function compilePropertyReference(property){return property==="$type"?"f.type":property==="$id"?"f.id":"p["+JSON.stringify(property)+"]"}function compileComparisonOp(property,value,op,checkType){var left=compilePropertyReference(property);var right=property==="$type"?types.indexOf(value):JSON.stringify(value);return(checkType?"typeof "+left+"=== typeof "+right+"&&":"")+left+op+right}function compileLogicalOp(expressions,op){return expressions.map(compile).join(op)}function compileInOp(property,values){if(property==="$type")values=values.map(function(value){return types.indexOf(value)});var left=JSON.stringify(values.sort(compare));var right=compilePropertyReference(property);if(values.length<=200)return left+".indexOf("+right+") !== -1";return"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; }("+right+", "+left+",0,"+(values.length-1)+")"}function compileHasOp(property){return JSON.stringify(property)+" in p"}function compileNegation(expression){return"!("+expression+")"}function compare(a,b){return a<b?-1:a>b?1:0}},{}],143:[function(require,module,exports){var geojsonArea=require("geojson-area");module.exports=rewind;function rewind(gj,outer){switch(gj&&gj.type||null){case"FeatureCollection":gj.features=gj.features.map(curryOuter(rewind,outer));return gj;case"Feature":gj.geometry=rewind(gj.geometry,outer);return gj;case"Polygon":case"MultiPolygon":return correct(gj,outer);default:return gj}}function curryOuter(a,b){return function(_){return a(_,b)}}function correct(_,outer){if(_.type==="Polygon"){_.coordinates=correctRings(_.coordinates,outer)}else if(_.type==="MultiPolygon"){_.coordinates=_.coordinates.map(curryOuter(correctRings,outer))}return _}function correctRings(_,outer){outer=!!outer;_[0]=wind(_[0],!outer);for(var i=1;i<_.length;i++){_[i]=wind(_[i],outer)}return _}function wind(_,dir){return cw(_)===dir?_:_.reverse()}function cw(_){return geojsonArea.ring(_)>=0}},{"geojson-area":144}],144:[function(require,module,exports){var wgs84=require("wgs84");module.exports.geometry=geometry;module.exports.ring=ringArea;function geometry(_){if(_.type==="Polygon")return polygonArea(_.coordinates);else if(_.type==="MultiPolygon"){var area=0;for(var i=0;i<_.coordinates.length;i++){area+=polygonArea(_.coordinates[i])}return area}else{return null}}function polygonArea(coords){var area=0;if(coords&&coords.length>0){area+=Math.abs(ringArea(coords[0]));for(var i=1;i<coords.length;i++){area-=Math.abs(ringArea(coords[i]))}}return area}function ringArea(coords){var area=0;if(coords.length>2){var p1,p2;for(var i=0;i<coords.length-1;i++){p1=coords[i];p2=coords[i+1];area+=rad(p2[0]-p1[0])*(2+Math.sin(rad(p1[1]))+Math.sin(rad(p2[1])))}area=area*wgs84.RADIUS*wgs84.RADIUS/2}return area}function rad(_){return _*Math.PI/180}},{wgs84:145}],145:[function(require,module,exports){module.exports.RADIUS=6378137;module.exports.FLATTENING=1/298.257223563;module.exports.POLAR_RADIUS=6356752.3142},{}],146:[function(require,module,exports){"use strict";module.exports=clip;var createFeature=require("./feature");function clip(features,scale,k1,k2,axis,intersect,minAll,maxAll){k1/=scale;k2/=scale;if(minAll>=k1&&maxAll<=k2)return features;else if(minAll>k2||maxAll<k1)return null;var clipped=[];for(var i=0;i<features.length;i++){var feature=features[i],geometry=feature.geometry,type=feature.type,min,max;min=feature.min[axis];max=feature.max[axis];if(min>=k1&&max<=k2){clipped.push(feature);continue}else if(min>k2||max<k1)continue;var slices=type===1?clipPoints(geometry,k1,k2,axis):clipGeometry(geometry,k1,k2,axis,intersect,type===3);if(slices.length){clipped.push(createFeature(feature.tags,type,slices,feature.id))}}return clipped.length?clipped:null}function clipPoints(geometry,k1,k2,axis){var slice=[];for(var i=0;i<geometry.length;i++){var a=geometry[i],ak=a[axis];if(ak>=k1&&ak<=k2)slice.push(a)}return slice}function clipGeometry(geometry,k1,k2,axis,intersect,closed){var slices=[];for(var i=0;i<geometry.length;i++){var ak=0,bk=0,b=null,points=geometry[i],area=points.area,dist=points.dist,outer=points.outer,len=points.length,a,j,last;var slice=[];for(j=0;j<len-1;j++){a=b||points[j];b=points[j+1];ak=bk||a[axis];bk=b[axis];if(ak<k1){if(bk>k2){slice.push(intersect(a,b,k1),intersect(a,b,k2));if(!closed)slice=newSlice(slices,slice,area,dist,outer)}else if(bk>=k1)slice.push(intersect(a,b,k1))}else if(ak>k2){if(bk<k1){slice.push(intersect(a,b,k2),intersect(a,b,k1));if(!closed)slice=newSlice(slices,slice,area,dist,outer)}else if(bk<=k2)slice.push(intersect(a,b,k2))}else{slice.push(a);if(bk<k1){slice.push(intersect(a,b,k1));if(!closed)slice=newSlice(slices,slice,area,dist,outer)}else if(bk>k2){slice.push(intersect(a,b,k2));if(!closed)slice=newSlice(slices,slice,area,dist,outer)}}}a=points[len-1];ak=a[axis];if(ak>=k1&&ak<=k2)slice.push(a);last=slice[slice.length-1];if(closed&&last&&(slice[0][0]!==last[0]||slice[0][1]!==last[1]))slice.push(slice[0]);newSlice(slices,slice,area,dist,outer)}return slices}function newSlice(slices,slice,area,dist,outer){if(slice.length){slice.area=area;slice.dist=dist;if(outer!==undefined)slice.outer=outer;slices.push(slice)}return[]}},{"./feature":148}],147:[function(require,module,exports){"use strict";module.exports=convert;var simplify=require("./simplify");var createFeature=require("./feature");function convert(data,tolerance){var features=[];if(data.type==="FeatureCollection"){for(var i=0;i<data.features.length;i++){convertFeature(features,data.features[i],tolerance)}}else if(data.type==="Feature"){convertFeature(features,data,tolerance)}else{convertFeature(features,{geometry:data},tolerance)}return features}function convertFeature(features,feature,tolerance){if(feature.geometry===null){return}var geom=feature.geometry,type=geom.type,coords=geom.coordinates,tags=feature.properties,id=feature.id,i,j,rings,projectedRing;if(type==="Point"){features.push(createFeature(tags,1,[projectPoint(coords)],id))}else if(type==="MultiPoint"){features.push(createFeature(tags,1,project(coords),id))}else if(type==="LineString"){features.push(createFeature(tags,2,[project(coords,tolerance)],id))}else if(type==="MultiLineString"||type==="Polygon"){rings=[];for(i=0;i<coords.length;i++){projectedRing=project(coords[i],tolerance);if(type==="Polygon")projectedRing.outer=i===0;rings.push(projectedRing)}features.push(createFeature(tags,type==="Polygon"?3:2,rings,id))}else if(type==="MultiPolygon"){rings=[];for(i=0;i<coords.length;i++){for(j=0;j<coords[i].length;j++){projectedRing=project(coords[i][j],tolerance);projectedRing.outer=j===0;rings.push(projectedRing)}}features.push(createFeature(tags,3,rings,id))}else if(type==="GeometryCollection"){for(i=0;i<geom.geometries.length;i++){convertFeature(features,{geometry:geom.geometries[i],properties:tags},tolerance)}}else{throw new Error("Input data is not a valid GeoJSON object.")}}function project(lonlats,tolerance){var projected=[];for(var i=0;i<lonlats.length;i++){projected.push(projectPoint(lonlats[i]))}if(tolerance){simplify(projected,tolerance);calcSize(projected)}return projected}function projectPoint(p){var sin=Math.sin(p[1]*Math.PI/180),x=p[0]/360+.5,y=.5-.25*Math.log((1+sin)/(1-sin))/Math.PI;y=y<0?0:y>1?1:y;return[x,y,0]}function calcSize(points){var area=0,dist=0;for(var i=0,a,b;i<points.length-1;i++){a=b||points[i];b=points[i+1];area+=a[0]*b[1]-b[0]*a[1];dist+=Math.abs(b[0]-a[0])+Math.abs(b[1]-a[1])}points.area=Math.abs(area/2);points.dist=dist}},{"./feature":148,"./simplify":150}],148:[function(require,module,exports){"use strict";module.exports=createFeature;function createFeature(tags,type,geom,id){var feature={id:id||null,type:type,geometry:geom,tags:tags||null,min:[Infinity,Infinity],max:[-Infinity,-Infinity]};calcBBox(feature);return feature}function calcBBox(feature){var geometry=feature.geometry,min=feature.min,max=feature.max;if(feature.type===1){calcRingBBox(min,max,geometry)}else{for(var i=0;i<geometry.length;i++){calcRingBBox(min,max,geometry[i])}}return feature}function calcRingBBox(min,max,points){for(var i=0,p;i<points.length;i++){p=points[i];min[0]=Math.min(p[0],min[0]);max[0]=Math.max(p[0],max[0]);min[1]=Math.min(p[1],min[1]);max[1]=Math.max(p[1],max[1])}}},{}],149:[function(require,module,exports){
"use strict";module.exports=geojsonvt;var convert=require("./convert"),transform=require("./transform"),clip=require("./clip"),wrap=require("./wrap"),createTile=require("./tile");function geojsonvt(data,options){return new GeoJSONVT(data,options)}function GeoJSONVT(data,options){options=this.options=extend(Object.create(this.options),options);var debug=options.debug;if(debug)console.time("preprocess data");var z2=1<<options.maxZoom,features=convert(data,options.tolerance/(z2*options.extent));this.tiles={};this.tileCoords=[];if(debug){console.timeEnd("preprocess data");console.log("index: maxZoom: %d, maxPoints: %d",options.indexMaxZoom,options.indexMaxPoints);console.time("generate tiles");this.stats={};this.total=0}features=wrap(features,options.buffer/options.extent,intersectX);if(features.length)this.splitTile(features,0,0,0);if(debug){if(features.length)console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints);console.timeEnd("generate tiles");console.log("tiles generated:",this.total,JSON.stringify(this.stats))}}GeoJSONVT.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,solidChildren:false,tolerance:3,extent:4096,buffer:64,debug:0};GeoJSONVT.prototype.splitTile=function(features,z,x,y,cz,cx,cy){var stack=[features,z,x,y],options=this.options,debug=options.debug,solid=null;while(stack.length){y=stack.pop();x=stack.pop();z=stack.pop();features=stack.pop();var z2=1<<z,id=toID(z,x,y),tile=this.tiles[id],tileTolerance=z===options.maxZoom?0:options.tolerance/(z2*options.extent);if(!tile){if(debug>1)console.time("creation");tile=this.tiles[id]=createTile(features,z2,x,y,tileTolerance,z===options.maxZoom);this.tileCoords.push({z:z,x:x,y:y});if(debug){if(debug>1){console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",z,x,y,tile.numFeatures,tile.numPoints,tile.numSimplified);console.timeEnd("creation")}var key="z"+z;this.stats[key]=(this.stats[key]||0)+1;this.total++}}tile.source=features;if(!cz){if(z===options.indexMaxZoom||tile.numPoints<=options.indexMaxPoints)continue}else{if(z===options.maxZoom||z===cz)continue;var m=1<<cz-z;if(x!==Math.floor(cx/m)||y!==Math.floor(cy/m))continue}if(!options.solidChildren&&isClippedSquare(tile,options.extent,options.buffer)){if(cz)solid=z;continue}tile.source=null;if(debug>1)console.time("clipping");var k1=.5*options.buffer/options.extent,k2=.5-k1,k3=.5+k1,k4=1+k1,tl,bl,tr,br,left,right;tl=bl=tr=br=null;left=clip(features,z2,x-k1,x+k3,0,intersectX,tile.min[0],tile.max[0]);right=clip(features,z2,x+k2,x+k4,0,intersectX,tile.min[0],tile.max[0]);if(left){tl=clip(left,z2,y-k1,y+k3,1,intersectY,tile.min[1],tile.max[1]);bl=clip(left,z2,y+k2,y+k4,1,intersectY,tile.min[1],tile.max[1])}if(right){tr=clip(right,z2,y-k1,y+k3,1,intersectY,tile.min[1],tile.max[1]);br=clip(right,z2,y+k2,y+k4,1,intersectY,tile.min[1],tile.max[1])}if(debug>1)console.timeEnd("clipping");if(features.length){stack.push(tl||[],z+1,x*2,y*2);stack.push(bl||[],z+1,x*2,y*2+1);stack.push(tr||[],z+1,x*2+1,y*2);stack.push(br||[],z+1,x*2+1,y*2+1)}}return solid};GeoJSONVT.prototype.getTile=function(z,x,y){var options=this.options,extent=options.extent,debug=options.debug;var z2=1<<z;x=(x%z2+z2)%z2;var id=toID(z,x,y);if(this.tiles[id])return transform.tile(this.tiles[id],extent);if(debug>1)console.log("drilling down to z%d-%d-%d",z,x,y);var z0=z,x0=x,y0=y,parent;while(!parent&&z0>0){z0--;x0=Math.floor(x0/2);y0=Math.floor(y0/2);parent=this.tiles[toID(z0,x0,y0)]}if(!parent||!parent.source)return null;if(debug>1)console.log("found parent tile z%d-%d-%d",z0,x0,y0);if(isClippedSquare(parent,extent,options.buffer))return transform.tile(parent,extent);if(debug>1)console.time("drilling down");var solid=this.splitTile(parent.source,z0,x0,y0,z,x,y);if(debug>1)console.timeEnd("drilling down");if(solid!==null){var m=1<<z-solid;id=toID(solid,Math.floor(x/m),Math.floor(y/m))}return this.tiles[id]?transform.tile(this.tiles[id],extent):null};function toID(z,x,y){return((1<<z)*y+x)*32+z}function intersectX(a,b,x){return[x,(x-a[0])*(b[1]-a[1])/(b[0]-a[0])+a[1],1]}function intersectY(a,b,y){return[(y-a[1])*(b[0]-a[0])/(b[1]-a[1])+a[0],y,1]}function extend(dest,src){for(var i in src)dest[i]=src[i];return dest}function isClippedSquare(tile,extent,buffer){var features=tile.source;if(features.length!==1)return false;var feature=features[0];if(feature.type!==3||feature.geometry.length>1)return false;var len=feature.geometry[0].length;if(len!==5)return false;for(var i=0;i<len;i++){var p=transform.point(feature.geometry[0][i],extent,tile.z2,tile.x,tile.y);if(p[0]!==-buffer&&p[0]!==extent+buffer||p[1]!==-buffer&&p[1]!==extent+buffer)return false}return true}},{"./clip":146,"./convert":147,"./tile":151,"./transform":152,"./wrap":153}],150:[function(require,module,exports){"use strict";module.exports=simplify;function simplify(points,tolerance){var sqTolerance=tolerance*tolerance,len=points.length,first=0,last=len-1,stack=[],i,maxSqDist,sqDist,index;points[first][2]=1;points[last][2]=1;while(last){maxSqDist=0;for(i=first+1;i<last;i++){sqDist=getSqSegDist(points[i],points[first],points[last]);if(sqDist>maxSqDist){index=i;maxSqDist=sqDist}}if(maxSqDist>sqTolerance){points[index][2]=maxSqDist;stack.push(first);stack.push(index);first=index}else{last=stack.pop();first=stack.pop()}}}function getSqSegDist(p,a,b){var x=a[0],y=a[1],bx=b[0],by=b[1],px=p[0],py=p[1],dx=bx-x,dy=by-y;if(dx!==0||dy!==0){var t=((px-x)*dx+(py-y)*dy)/(dx*dx+dy*dy);if(t>1){x=bx;y=by}else if(t>0){x+=dx*t;y+=dy*t}}dx=px-x;dy=py-y;return dx*dx+dy*dy}},{}],151:[function(require,module,exports){"use strict";module.exports=createTile;function createTile(features,z2,tx,ty,tolerance,noSimplify){var tile={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:tx,y:ty,z2:z2,transformed:false,min:[2,1],max:[-1,0]};for(var i=0;i<features.length;i++){tile.numFeatures++;addFeature(tile,features[i],tolerance,noSimplify);var min=features[i].min,max=features[i].max;if(min[0]<tile.min[0])tile.min[0]=min[0];if(min[1]<tile.min[1])tile.min[1]=min[1];if(max[0]>tile.max[0])tile.max[0]=max[0];if(max[1]>tile.max[1])tile.max[1]=max[1]}return tile}function addFeature(tile,feature,tolerance,noSimplify){var geom=feature.geometry,type=feature.type,simplified=[],sqTolerance=tolerance*tolerance,i,j,ring,p;if(type===1){for(i=0;i<geom.length;i++){simplified.push(geom[i]);tile.numPoints++;tile.numSimplified++}}else{for(i=0;i<geom.length;i++){ring=geom[i];if(!noSimplify&&(type===2&&ring.dist<tolerance||type===3&&ring.area<sqTolerance)){tile.numPoints+=ring.length;continue}var simplifiedRing=[];for(j=0;j<ring.length;j++){p=ring[j];if(noSimplify||p[2]>sqTolerance){simplifiedRing.push(p);tile.numSimplified++}tile.numPoints++}if(type===3)rewind(simplifiedRing,ring.outer);simplified.push(simplifiedRing)}}if(simplified.length){var tileFeature={geometry:simplified,type:type,tags:feature.tags||null};if(feature.id!==null){tileFeature.id=feature.id}tile.features.push(tileFeature)}}function rewind(ring,clockwise){var area=signedArea(ring);if(area<0===clockwise)ring.reverse()}function signedArea(ring){var sum=0;for(var i=0,len=ring.length,j=len-1,p1,p2;i<len;j=i++){p1=ring[i];p2=ring[j];sum+=(p2[0]-p1[0])*(p1[1]+p2[1])}return sum}},{}],152:[function(require,module,exports){"use strict";exports.tile=transformTile;exports.point=transformPoint;function transformTile(tile,extent){if(tile.transformed)return tile;var z2=tile.z2,tx=tile.x,ty=tile.y,i,j,k;for(i=0;i<tile.features.length;i++){var feature=tile.features[i],geom=feature.geometry,type=feature.type;if(type===1){for(j=0;j<geom.length;j++)geom[j]=transformPoint(geom[j],extent,z2,tx,ty)}else{for(j=0;j<geom.length;j++){var ring=geom[j];for(k=0;k<ring.length;k++)ring[k]=transformPoint(ring[k],extent,z2,tx,ty)}}}tile.transformed=true;return tile}function transformPoint(p,extent,z2,tx,ty){var x=Math.round(extent*(p[0]*z2-tx)),y=Math.round(extent*(p[1]*z2-ty));return[x,y]}},{}],153:[function(require,module,exports){"use strict";var clip=require("./clip");var createFeature=require("./feature");module.exports=wrap;function wrap(features,buffer,intersectX){var merged=features,left=clip(features,1,-1-buffer,buffer,0,intersectX,-1,2),right=clip(features,1,1-buffer,2+buffer,0,intersectX,-1,2);if(left||right){merged=clip(features,1,-buffer,1+buffer,0,intersectX,-1,2)||[];if(left)merged=shiftFeatureCoords(left,1).concat(merged);if(right)merged=merged.concat(shiftFeatureCoords(right,-1))}return merged}function shiftFeatureCoords(features,offset){var newFeatures=[];for(var i=0;i<features.length;i++){var feature=features[i],type=feature.type;var newGeometry;if(type===1){newGeometry=shiftCoords(feature.geometry,offset)}else{newGeometry=[];for(var j=0;j<feature.geometry.length;j++){newGeometry.push(shiftCoords(feature.geometry[j],offset))}}newFeatures.push(createFeature(feature.tags,type,newGeometry,feature.id))}return newFeatures}function shiftCoords(points,offset){var newPoints=[];newPoints.area=points.area;newPoints.dist=points.dist;for(var i=0;i<points.length;i++){newPoints.push([points[i][0]+offset,points[i][1],points[i][2]])}return newPoints}},{"./clip":146,"./feature":148}],154:[function(require,module,exports){exports.glMatrix=require("./gl-matrix/common.js");exports.mat2=require("./gl-matrix/mat2.js");exports.mat2d=require("./gl-matrix/mat2d.js");exports.mat3=require("./gl-matrix/mat3.js");exports.mat4=require("./gl-matrix/mat4.js");exports.quat=require("./gl-matrix/quat.js");exports.vec2=require("./gl-matrix/vec2.js");exports.vec3=require("./gl-matrix/vec3.js");exports.vec4=require("./gl-matrix/vec4.js")},{"./gl-matrix/common.js":155,"./gl-matrix/mat2.js":156,"./gl-matrix/mat2d.js":157,"./gl-matrix/mat3.js":158,"./gl-matrix/mat4.js":159,"./gl-matrix/quat.js":160,"./gl-matrix/vec2.js":161,"./gl-matrix/vec3.js":162,"./gl-matrix/vec4.js":163}],155:[function(require,module,exports){var glMatrix={};glMatrix.EPSILON=1e-6;glMatrix.ARRAY_TYPE=typeof Float32Array!=="undefined"?Float32Array:Array;glMatrix.RANDOM=Math.random;glMatrix.ENABLE_SIMD=false;glMatrix.SIMD_AVAILABLE=glMatrix.ARRAY_TYPE===Float32Array&&"SIMD"in this;glMatrix.USE_SIMD=glMatrix.ENABLE_SIMD&&glMatrix.SIMD_AVAILABLE;glMatrix.setMatrixArrayType=function(type){glMatrix.ARRAY_TYPE=type};var degree=Math.PI/180;glMatrix.toRadian=function(a){return a*degree};glMatrix.equals=function(a,b){return Math.abs(a-b)<=glMatrix.EPSILON*Math.max(1,Math.abs(a),Math.abs(b))};module.exports=glMatrix},{}],156:[function(require,module,exports){var glMatrix=require("./common.js");var mat2={};mat2.create=function(){var out=new glMatrix.ARRAY_TYPE(4);out[0]=1;out[1]=0;out[2]=0;out[3]=1;return out};mat2.clone=function(a){var out=new glMatrix.ARRAY_TYPE(4);out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];return out};mat2.copy=function(out,a){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];return out};mat2.identity=function(out){out[0]=1;out[1]=0;out[2]=0;out[3]=1;return out};mat2.fromValues=function(m00,m01,m10,m11){var out=new glMatrix.ARRAY_TYPE(4);out[0]=m00;out[1]=m01;out[2]=m10;out[3]=m11;return out};mat2.set=function(out,m00,m01,m10,m11){out[0]=m00;out[1]=m01;out[2]=m10;out[3]=m11;return out};mat2.transpose=function(out,a){if(out===a){var a1=a[1];out[1]=a[2];out[2]=a1}else{out[0]=a[0];out[1]=a[2];out[2]=a[1];out[3]=a[3]}return out};mat2.invert=function(out,a){var a0=a[0],a1=a[1],a2=a[2],a3=a[3],det=a0*a3-a2*a1;if(!det){return null}det=1/det;out[0]=a3*det;out[1]=-a1*det;out[2]=-a2*det;out[3]=a0*det;return out};mat2.adjoint=function(out,a){var a0=a[0];out[0]=a[3];out[1]=-a[1];out[2]=-a[2];out[3]=a0;return out};mat2.determinant=function(a){return a[0]*a[3]-a[2]*a[1]};mat2.multiply=function(out,a,b){var a0=a[0],a1=a[1],a2=a[2],a3=a[3];var b0=b[0],b1=b[1],b2=b[2],b3=b[3];out[0]=a0*b0+a2*b1;out[1]=a1*b0+a3*b1;out[2]=a0*b2+a2*b3;out[3]=a1*b2+a3*b3;return out};mat2.mul=mat2.multiply;mat2.rotate=function(out,a,rad){var a0=a[0],a1=a[1],a2=a[2],a3=a[3],s=Math.sin(rad),c=Math.cos(rad);out[0]=a0*c+a2*s;out[1]=a1*c+a3*s;out[2]=a0*-s+a2*c;out[3]=a1*-s+a3*c;return out};mat2.scale=function(out,a,v){var a0=a[0],a1=a[1],a2=a[2],a3=a[3],v0=v[0],v1=v[1];out[0]=a0*v0;out[1]=a1*v0;out[2]=a2*v1;out[3]=a3*v1;return out};mat2.fromRotation=function(out,rad){var s=Math.sin(rad),c=Math.cos(rad);out[0]=c;out[1]=s;out[2]=-s;out[3]=c;return out};mat2.fromScaling=function(out,v){out[0]=v[0];out[1]=0;out[2]=0;out[3]=v[1];return out};mat2.str=function(a){return"mat2("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"};mat2.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3],2))};mat2.LDU=function(L,D,U,a){L[2]=a[2]/a[0];U[0]=a[0];U[1]=a[1];U[3]=a[3]-L[2]*U[1];return[L,D,U]};mat2.add=function(out,a,b){out[0]=a[0]+b[0];out[1]=a[1]+b[1];out[2]=a[2]+b[2];out[3]=a[3]+b[3];return out};mat2.subtract=function(out,a,b){out[0]=a[0]-b[0];out[1]=a[1]-b[1];out[2]=a[2]-b[2];out[3]=a[3]-b[3];return out};mat2.sub=mat2.subtract;mat2.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]};mat2.equals=function(a,b){var a0=a[0],a1=a[1],a2=a[2],a3=a[3];var b0=b[0],b1=b[1],b2=b[2],b3=b[3];return Math.abs(a0-b0)<=glMatrix.EPSILON*Math.max(1,Math.abs(a0),Math.abs(b0))&&Math.abs(a1-b1)<=glMatrix.EPSILON*Math.max(1,Math.abs(a1),Math.abs(b1))&&Math.abs(a2-b2)<=glMatrix.EPSILON*Math.max(1,Math.abs(a2),Math.abs(b2))&&Math.abs(a3-b3)<=glMatrix.EPSILON*Math.max(1,Math.abs(a3),Math.abs(b3))};mat2.multiplyScalar=function(out,a,b){out[0]=a[0]*b;out[1]=a[1]*b;out[2]=a[2]*b;out[3]=a[3]*b;return out};mat2.multiplyScalarAndAdd=function(out,a,b,scale){out[0]=a[0]+b[0]*scale;out[1]=a[1]+b[1]*scale;out[2]=a[2]+b[2]*scale;out[3]=a[3]+b[3]*scale;return out};module.exports=mat2},{"./common.js":155}],157:[function(require,module,exports){var glMatrix=require("./common.js");var mat2d={};mat2d.create=function(){var out=new glMatrix.ARRAY_TYPE(6);out[0]=1;out[1]=0;out[2]=0;out[3]=1;out[4]=0;out[5]=0;return out};mat2d.clone=function(a){var out=new glMatrix.ARRAY_TYPE(6);out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4];out[5]=a[5];return out};mat2d.copy=function(out,a){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4];out[5]=a[5];return out};mat2d.identity=function(out){out[0]=1;out[1]=0;out[2]=0;out[3]=1;out[4]=0;out[5]=0;return out};mat2d.fromValues=function(a,b,c,d,tx,ty){var out=new glMatrix.ARRAY_TYPE(6);out[0]=a;out[1]=b;out[2]=c;out[3]=d;out[4]=tx;out[5]=ty;return out};mat2d.set=function(out,a,b,c,d,tx,ty){out[0]=a;out[1]=b;out[2]=c;out[3]=d;out[4]=tx;out[5]=ty;return out};mat2d.invert=function(out,a){var aa=a[0],ab=a[1],ac=a[2],ad=a[3],atx=a[4],aty=a[5];var det=aa*ad-ab*ac;if(!det){return null}det=1/det;out[0]=ad*det;out[1]=-ab*det;out[2]=-ac*det;out[3]=aa*det;out[4]=(ac*aty-ad*atx)*det;out[5]=(ab*atx-aa*aty)*det;return out};mat2d.determinant=function(a){return a[0]*a[3]-a[1]*a[2]};mat2d.multiply=function(out,a,b){var a0=a[0],a1=a[1],a2=a[2],a3=a[3],a4=a[4],a5=a[5],b0=b[0],b1=b[1],b2=b[2],b3=b[3],b4=b[4],b5=b[5];out[0]=a0*b0+a2*b1;out[1]=a1*b0+a3*b1;out[2]=a0*b2+a2*b3;out[3]=a1*b2+a3*b3;out[4]=a0*b4+a2*b5+a4;out[5]=a1*b4+a3*b5+a5;return out};mat2d.mul=mat2d.multiply;mat2d.rotate=function(out,a,rad){var a0=a[0],a1=a[1],a2=a[2],a3=a[3],a4=a[4],a5=a[5],s=Math.sin(rad),c=Math.cos(rad);out[0]=a0*c+a2*s;out[1]=a1*c+a3*s;out[2]=a0*-s+a2*c;out[3]=a1*-s+a3*c;out[4]=a4;out[5]=a5;return out};mat2d.scale=function(out,a,v){var a0=a[0],a1=a[1],a2=a[2],a3=a[3],a4=a[4],a5=a[5],v0=v[0],v1=v[1];out[0]=a0*v0;out[1]=a1*v0;out[2]=a2*v1;out[3]=a3*v1;out[4]=a4;out[5]=a5;return out};mat2d.translate=function(out,a,v){var a0=a[0],a1=a[1],a2=a[2],a3=a[3],a4=a[4],a5=a[5],v0=v[0],v1=v[1];out[0]=a0;out[1]=a1;out[2]=a2;out[3]=a3;out[4]=a0*v0+a2*v1+a4;out[5]=a1*v0+a3*v1+a5;return out};mat2d.fromRotation=function(out,rad){var s=Math.sin(rad),c=Math.cos(rad);out[0]=c;out[1]=s;out[2]=-s;out[3]=c;out[4]=0;out[5]=0;return out};mat2d.fromScaling=function(out,v){out[0]=v[0];out[1]=0;out[2]=0;out[3]=v[1];out[4]=0;out[5]=0;return out};mat2d.fromTranslation=function(out,v){out[0]=1;out[1]=0;out[2]=0;out[3]=1;out[4]=v[0];out[5]=v[1];return out};mat2d.str=function(a){return"mat2d("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+")"};mat2d.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3],2)+Math.pow(a[4],2)+Math.pow(a[5],2)+1)};mat2d.add=function(out,a,b){out[0]=a[0]+b[0];out[1]=a[1]+b[1];out[2]=a[2]+b[2];out[3]=a[3]+b[3];out[4]=a[4]+b[4];out[5]=a[5]+b[5];return out};mat2d.subtract=function(out,a,b){out[0]=a[0]-b[0];out[1]=a[1]-b[1];out[2]=a[2]-b[2];out[3]=a[3]-b[3];out[4]=a[4]-b[4];out[5]=a[5]-b[5];return out};mat2d.sub=mat2d.subtract;mat2d.multiplyScalar=function(out,a,b){out[0]=a[0]*b;out[1]=a[1]*b;out[2]=a[2]*b;out[3]=a[3]*b;out[4]=a[4]*b;out[5]=a[5]*b;return out};mat2d.multiplyScalarAndAdd=function(out,a,b,scale){out[0]=a[0]+b[0]*scale;out[1]=a[1]+b[1]*scale;out[2]=a[2]+b[2]*scale;out[3]=a[3]+b[3]*scale;out[4]=a[4]+b[4]*scale;out[5]=a[5]+b[5]*scale;return out};mat2d.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]};mat2d.equals=function(a,b){var a0=a[0],a1=a[1],a2=a[2],a3=a[3],a4=a[4],a5=a[5];var b0=b[0],b1=b[1],b2=b[2],b3=b[3],b4=b[4],b5=b[5];return Math.abs(a0-b0)<=glMatrix.EPSILON*Math.max(1,Math.abs(a0),Math.abs(b0))&&Math.abs(a1-b1)<=glMatrix.EPSILON*Math.max(1,Math.abs(a1),Math.abs(b1))&&Math.abs(a2-b2)<=glMatrix.EPSILON*Math.max(1,Math.abs(a2),Math.abs(b2))&&Math.abs(a3-b3)<=glMatrix.EPSILON*Math.max(1,Math.abs(a3),Math.abs(b3))&&Math.abs(a4-b4)<=glMatrix.EPSILON*Math.max(1,Math.abs(a4),Math.abs(b4))&&Math.abs(a5-b5)<=glMatrix.EPSILON*Math.max(1,Math.abs(a5),Math.abs(b5))};module.exports=mat2d},{"./common.js":155}],158:[function(require,module,exports){var glMatrix=require("./common.js");var mat3={};mat3.create=function(){var out=new glMatrix.ARRAY_TYPE(9);out[0]=1;out[1]=0;out[2]=0;out[3]=0;out[4]=1;out[5]=0;out[6]=0;out[7]=0;out[8]=1;return out};mat3.fromMat4=function(out,a){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[4];out[4]=a[5];out[5]=a[6];out[6]=a[8];out[7]=a[9];out[8]=a[10];return out};mat3.clone=function(a){var out=new glMatrix.ARRAY_TYPE(9);out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4];out[5]=a[5];out[6]=a[6];out[7]=a[7];out[8]=a[8];return out};mat3.copy=function(out,a){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4];out[5]=a[5];out[6]=a[6];out[7]=a[7];out[8]=a[8];return out};mat3.fromValues=function(m00,m01,m02,m10,m11,m12,m20,m21,m22){var out=new glMatrix.ARRAY_TYPE(9);out[0]=m00;out[1]=m01;out[2]=m02;out[3]=m10;out[4]=m11;out[5]=m12;out[6]=m20;out[7]=m21;out[8]=m22;return out};mat3.set=function(out,m00,m01,m02,m10,m11,m12,m20,m21,m22){out[0]=m00;out[1]=m01;out[2]=m02;out[3]=m10;out[4]=m11;out[5]=m12;out[6]=m20;out[7]=m21;out[8]=m22;return out};mat3.identity=function(out){out[0]=1;out[1]=0;out[2]=0;out[3]=0;out[4]=1;out[5]=0;out[6]=0;out[7]=0;out[8]=1;return out};mat3.transpose=function(out,a){if(out===a){var a01=a[1],a02=a[2],a12=a[5];out[1]=a[3];out[2]=a[6];out[3]=a01;out[5]=a[7];out[6]=a02;out[7]=a12}else{out[0]=a[0];out[1]=a[3];out[2]=a[6];out[3]=a[1];out[4]=a[4];out[5]=a[7];out[6]=a[2];out[7]=a[5];out[8]=a[8]}return out};mat3.invert=function(out,a){var a00=a[0],a01=a[1],a02=a[2],a10=a[3],a11=a[4],a12=a[5],a20=a[6],a21=a[7],a22=a[8],b01=a22*a11-a12*a21,b11=-a22*a10+a12*a20,b21=a21*a10-a11*a20,det=a00*b01+a01*b11+a02*b21;if(!det){return null}det=1/det;out[0]=b01*det;out[1]=(-a22*a01+a02*a21)*det;out[2]=(a12*a01-a02*a11)*det;out[3]=b11*det;out[4]=(a22*a00-a02*a20)*det;out[5]=(-a12*a00+a02*a10)*det;out[6]=b21*det;out[7]=(-a21*a00+a01*a20)*det;out[8]=(a11*a00-a01*a10)*det;return out};mat3.adjoint=function(out,a){var a00=a[0],a01=a[1],a02=a[2],a10=a[3],a11=a[4],a12=a[5],a20=a[6],a21=a[7],a22=a[8];out[0]=a11*a22-a12*a21;out[1]=a02*a21-a01*a22;out[2]=a01*a12-a02*a11;out[3]=a12*a20-a10*a22;out[4]=a00*a22-a02*a20;out[5]=a02*a10-a00*a12;out[6]=a10*a21-a11*a20;out[7]=a01*a20-a00*a21;out[8]=a00*a11-a01*a10;return out};mat3.determinant=function(a){var a00=a[0],a01=a[1],a02=a[2],a10=a[3],a11=a[4],a12=a[5],a20=a[6],a21=a[7],a22=a[8];return a00*(a22*a11-a12*a21)+a01*(-a22*a10+a12*a20)+a02*(a21*a10-a11*a20)};mat3.multiply=function(out,a,b){var a00=a[0],a01=a[1],a02=a[2],a10=a[3],a11=a[4],a12=a[5],a20=a[6],a21=a[7],a22=a[8],b00=b[0],b01=b[1],b02=b[2],b10=b[3],b11=b[4],b12=b[5],b20=b[6],b21=b[7],b22=b[8];out[0]=b00*a00+b01*a10+b02*a20;out[1]=b00*a01+b01*a11+b02*a21;out[2]=b00*a02+b01*a12+b02*a22;out[3]=b10*a00+b11*a10+b12*a20;out[4]=b10*a01+b11*a11+b12*a21;out[5]=b10*a02+b11*a12+b12*a22;out[6]=b20*a00+b21*a10+b22*a20;out[7]=b20*a01+b21*a11+b22*a21;out[8]=b20*a02+b21*a12+b22*a22;return out};mat3.mul=mat3.multiply;mat3.translate=function(out,a,v){var a00=a[0],a01=a[1],a02=a[2],a10=a[3],a11=a[4],a12=a[5],a20=a[6],a21=a[7],a22=a[8],x=v[0],y=v[1];out[0]=a00;out[1]=a01;out[2]=a02;out[3]=a10;out[4]=a11;out[5]=a12;out[6]=x*a00+y*a10+a20;out[7]=x*a01+y*a11+a21;out[8]=x*a02+y*a12+a22;return out};mat3.rotate=function(out,a,rad){var a00=a[0],a01=a[1],a02=a[2],a10=a[3],a11=a[4],a12=a[5],a20=a[6],a21=a[7],a22=a[8],s=Math.sin(rad),c=Math.cos(rad);out[0]=c*a00+s*a10;out[1]=c*a01+s*a11;out[2]=c*a02+s*a12;out[3]=c*a10-s*a00;out[4]=c*a11-s*a01;out[5]=c*a12-s*a02;out[6]=a20;out[7]=a21;out[8]=a22;return out};mat3.scale=function(out,a,v){var x=v[0],y=v[1];out[0]=x*a[0];out[1]=x*a[1];out[2]=x*a[2];out[3]=y*a[3];out[4]=y*a[4];out[5]=y*a[5];out[6]=a[6];out[7]=a[7];out[8]=a[8];return out};mat3.fromTranslation=function(out,v){out[0]=1;out[1]=0;out[2]=0;out[3]=0;out[4]=1;out[5]=0;out[6]=v[0];out[7]=v[1];out[8]=1;return out};mat3.fromRotation=function(out,rad){var s=Math.sin(rad),c=Math.cos(rad);out[0]=c;out[1]=s;out[2]=0;out[3]=-s;out[4]=c;out[5]=0;out[6]=0;out[7]=0;out[8]=1;return out};mat3.fromScaling=function(out,v){out[0]=v[0];out[1]=0;out[2]=0;out[3]=0;out[4]=v[1];out[5]=0;out[6]=0;out[7]=0;out[8]=1;return out};mat3.fromMat2d=function(out,a){out[0]=a[0];out[1]=a[1];out[2]=0;out[3]=a[2];out[4]=a[3];out[5]=0;out[6]=a[4];out[7]=a[5];out[8]=1;return out};mat3.fromQuat=function(out,q){var x=q[0],y=q[1],z=q[2],w=q[3],x2=x+x,y2=y+y,z2=z+z,xx=x*x2,yx=y*x2,yy=y*y2,zx=z*x2,zy=z*y2,zz=z*z2,wx=w*x2,wy=w*y2,wz=w*z2;out[0]=1-yy-zz;out[3]=yx-wz;out[6]=zx+wy;out[1]=yx+wz;out[4]=1-xx-zz;out[7]=zy-wx;out[2]=zx-wy;out[5]=zy+wx;out[8]=1-xx-yy;return out};mat3.normalFromMat4=function(out,a){var a00=a[0],a01=a[1],a02=a[2],a03=a[3],a10=a[4],a11=a[5],a12=a[6],a13=a[7],a20=a[8],a21=a[9],a22=a[10],a23=a[11],a30=a[12],a31=a[13],a32=a[14],a33=a[15],b00=a00*a11-a01*a10,b01=a00*a12-a02*a10,b02=a00*a13-a03*a10,b03=a01*a12-a02*a11,b04=a01*a13-a03*a11,b05=a02*a13-a03*a12,b06=a20*a31-a21*a30,b07=a20*a32-a22*a30,b08=a20*a33-a23*a30,b09=a21*a32-a22*a31,b10=a21*a33-a23*a31,b11=a22*a33-a23*a32,det=b00*b11-b01*b10+b02*b09+b03*b08-b04*b07+b05*b06;if(!det){return null}det=1/det;out[0]=(a11*b11-a12*b10+a13*b09)*det;out[1]=(a12*b08-a10*b11-a13*b07)*det;out[2]=(a10*b10-a11*b08+a13*b06)*det;out[3]=(a02*b10-a01*b11-a03*b09)*det;out[4]=(a00*b11-a02*b08+a03*b07)*det;out[5]=(a01*b08-a00*b10-a03*b06)*det;out[6]=(a31*b05-a32*b04+a33*b03)*det;out[7]=(a32*b02-a30*b05-a33*b01)*det;out[8]=(a30*b04-a31*b02+a33*b00)*det;return out};mat3.str=function(a){return"mat3("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+")"};mat3.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3],2)+Math.pow(a[4],2)+Math.pow(a[5],2)+Math.pow(a[6],2)+Math.pow(a[7],2)+Math.pow(a[8],2))};mat3.add=function(out,a,b){out[0]=a[0]+b[0];out[1]=a[1]+b[1];out[2]=a[2]+b[2];out[3]=a[3]+b[3];out[4]=a[4]+b[4];out[5]=a[5]+b[5];out[6]=a[6]+b[6];out[7]=a[7]+b[7];out[8]=a[8]+b[8];return out};mat3.subtract=function(out,a,b){out[0]=a[0]-b[0];out[1]=a[1]-b[1];out[2]=a[2]-b[2];out[3]=a[3]-b[3];out[4]=a[4]-b[4];out[5]=a[5]-b[5];out[6]=a[6]-b[6];out[7]=a[7]-b[7];out[8]=a[8]-b[8];return out};mat3.sub=mat3.subtract;mat3.multiplyScalar=function(out,a,b){out[0]=a[0]*b;out[1]=a[1]*b;out[2]=a[2]*b;out[3]=a[3]*b;out[4]=a[4]*b;out[5]=a[5]*b;out[6]=a[6]*b;out[7]=a[7]*b;out[8]=a[8]*b;return out};mat3.multiplyScalarAndAdd=function(out,a,b,scale){out[0]=a[0]+b[0]*scale;out[1]=a[1]+b[1]*scale;out[2]=a[2]+b[2]*scale;out[3]=a[3]+b[3]*scale;out[4]=a[4]+b[4]*scale;out[5]=a[5]+b[5]*scale;out[6]=a[6]+b[6]*scale;out[7]=a[7]+b[7]*scale;out[8]=a[8]+b[8]*scale;return out};mat3.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]&&a[6]===b[6]&&a[7]===b[7]&&a[8]===b[8]};mat3.equals=function(a,b){var a0=a[0],a1=a[1],a2=a[2],a3=a[3],a4=a[4],a5=a[5],a6=a[6],a7=a[7],a8=a[8];var b0=b[0],b1=b[1],b2=b[2],b3=b[3],b4=b[4],b5=b[5],b6=a[6],b7=b[7],b8=b[8];return Math.abs(a0-b0)<=glMatrix.EPSILON*Math.max(1,Math.abs(a0),Math.abs(b0))&&Math.abs(a1-b1)<=glMatrix.EPSILON*Math.max(1,Math.abs(a1),Math.abs(b1))&&Math.abs(a2-b2)<=glMatrix.EPSILON*Math.max(1,Math.abs(a2),Math.abs(b2))&&Math.abs(a3-b3)<=glMatrix.EPSILON*Math.max(1,Math.abs(a3),Math.abs(b3))&&Math.abs(a4-b4)<=glMatrix.EPSILON*Math.max(1,Math.abs(a4),Math.abs(b4))&&Math.abs(a5-b5)<=glMatrix.EPSILON*Math.max(1,Math.abs(a5),Math.abs(b5))&&Math.abs(a6-b6)<=glMatrix.EPSILON*Math.max(1,Math.abs(a6),Math.abs(b6))&&Math.abs(a7-b7)<=glMatrix.EPSILON*Math.max(1,Math.abs(a7),Math.abs(b7))&&Math.abs(a8-b8)<=glMatrix.EPSILON*Math.max(1,Math.abs(a8),Math.abs(b8))};module.exports=mat3},{"./common.js":155}],159:[function(require,module,exports){var glMatrix=require("./common.js");var mat4={scalar:{},SIMD:{}};mat4.create=function(){var out=new glMatrix.ARRAY_TYPE(16);out[0]=1;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=1;out[6]=0;out[7]=0;out[8]=0;out[9]=0;out[10]=1;out[11]=0;out[12]=0;out[13]=0;out[14]=0;out[15]=1;return out};mat4.clone=function(a){var out=new glMatrix.ARRAY_TYPE(16);out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4];out[5]=a[5];out[6]=a[6];out[7]=a[7];out[8]=a[8];out[9]=a[9];out[10]=a[10];out[11]=a[11];out[12]=a[12];out[13]=a[13];out[14]=a[14];out[15]=a[15];return out};mat4.copy=function(out,a){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4];out[5]=a[5];out[6]=a[6];out[7]=a[7];out[8]=a[8];out[9]=a[9];out[10]=a[10];out[11]=a[11];out[12]=a[12];out[13]=a[13];out[14]=a[14];out[15]=a[15];return out};mat4.fromValues=function(m00,m01,m02,m03,m10,m11,m12,m13,m20,m21,m22,m23,m30,m31,m32,m33){var out=new glMatrix.ARRAY_TYPE(16);out[0]=m00;out[1]=m01;out[2]=m02;out[3]=m03;out[4]=m10;out[5]=m11;out[6]=m12;out[7]=m13;out[8]=m20;out[9]=m21;out[10]=m22;out[11]=m23;out[12]=m30;out[13]=m31;out[14]=m32;out[15]=m33;return out};mat4.set=function(out,m00,m01,m02,m03,m10,m11,m12,m13,m20,m21,m22,m23,m30,m31,m32,m33){out[0]=m00;out[1]=m01;out[2]=m02;out[3]=m03;out[4]=m10;out[5]=m11;out[6]=m12;out[7]=m13;out[8]=m20;out[9]=m21;out[10]=m22;out[11]=m23;out[12]=m30;out[13]=m31;out[14]=m32;out[15]=m33;return out};mat4.identity=function(out){out[0]=1;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=1;out[6]=0;out[7]=0;out[8]=0;out[9]=0;out[10]=1;out[11]=0;out[12]=0;out[13]=0;out[14]=0;out[15]=1;return out};mat4.scalar.transpose=function(out,a){if(out===a){var a01=a[1],a02=a[2],a03=a[3],a12=a[6],a13=a[7],a23=a[11];out[1]=a[4];out[2]=a[8];out[3]=a[12];out[4]=a01;out[6]=a[9];out[7]=a[13];out[8]=a02;out[9]=a12;out[11]=a[14];out[12]=a03;out[13]=a13;out[14]=a23}else{out[0]=a[0];out[1]=a[4];out[2]=a[8];out[3]=a[12];out[4]=a[1];out[5]=a[5];out[6]=a[9];out[7]=a[13];out[8]=a[2];out[9]=a[6];out[10]=a[10];out[11]=a[14];out[12]=a[3];out[13]=a[7];out[14]=a[11];out[15]=a[15]}return out};mat4.SIMD.transpose=function(out,a){var a0,a1,a2,a3,tmp01,tmp23,out0,out1,out2,out3;a0=SIMD.Float32x4.load(a,0);a1=SIMD.Float32x4.load(a,4);a2=SIMD.Float32x4.load(a,8);a3=SIMD.Float32x4.load(a,12);tmp01=SIMD.Float32x4.shuffle(a0,a1,0,1,4,5);tmp23=SIMD.Float32x4.shuffle(a2,a3,0,1,4,5);out0=SIMD.Float32x4.shuffle(tmp01,tmp23,0,2,4,6);out1=SIMD.Float32x4.shuffle(tmp01,tmp23,1,3,5,7);SIMD.Float32x4.store(out,0,out0);SIMD.Float32x4.store(out,4,out1);tmp01=SIMD.Float32x4.shuffle(a0,a1,2,3,6,7);tmp23=SIMD.Float32x4.shuffle(a2,a3,2,3,6,7);out2=SIMD.Float32x4.shuffle(tmp01,tmp23,0,2,4,6);out3=SIMD.Float32x4.shuffle(tmp01,tmp23,1,3,5,7);SIMD.Float32x4.store(out,8,out2);SIMD.Float32x4.store(out,12,out3);return out};mat4.transpose=glMatrix.USE_SIMD?mat4.SIMD.transpose:mat4.scalar.transpose;mat4.scalar.invert=function(out,a){var a00=a[0],a01=a[1],a02=a[2],a03=a[3],a10=a[4],a11=a[5],a12=a[6],a13=a[7],a20=a[8],a21=a[9],a22=a[10],a23=a[11],a30=a[12],a31=a[13],a32=a[14],a33=a[15],b00=a00*a11-a01*a10,b01=a00*a12-a02*a10,b02=a00*a13-a03*a10,b03=a01*a12-a02*a11,b04=a01*a13-a03*a11,b05=a02*a13-a03*a12,b06=a20*a31-a21*a30,b07=a20*a32-a22*a30,b08=a20*a33-a23*a30,b09=a21*a32-a22*a31,b10=a21*a33-a23*a31,b11=a22*a33-a23*a32,det=b00*b11-b01*b10+b02*b09+b03*b08-b04*b07+b05*b06;if(!det){return null}det=1/det;out[0]=(a11*b11-a12*b10+a13*b09)*det;out[1]=(a02*b10-a01*b11-a03*b09)*det;out[2]=(a31*b05-a32*b04+a33*b03)*det;out[3]=(a22*b04-a21*b05-a23*b03)*det;out[4]=(a12*b08-a10*b11-a13*b07)*det;out[5]=(a00*b11-a02*b08+a03*b07)*det;out[6]=(a32*b02-a30*b05-a33*b01)*det;out[7]=(a20*b05-a22*b02+a23*b01)*det;out[8]=(a10*b10-a11*b08+a13*b06)*det;out[9]=(a01*b08-a00*b10-a03*b06)*det;out[10]=(a30*b04-a31*b02+a33*b00)*det;out[11]=(a21*b02-a20*b04-a23*b00)*det;out[12]=(a11*b07-a10*b09-a12*b06)*det;out[13]=(a00*b09-a01*b07+a02*b06)*det;out[14]=(a31*b01-a30*b03-a32*b00)*det;out[15]=(a20*b03-a21*b01+a22*b00)*det;return out};mat4.SIMD.invert=function(out,a){var row0,row1,row2,row3,tmp1,minor0,minor1,minor2,minor3,det,a0=SIMD.Float32x4.load(a,0),a1=SIMD.Float32x4.load(a,4),a2=SIMD.Float32x4.load(a,8),a3=SIMD.Float32x4.load(a,12);tmp1=SIMD.Float32x4.shuffle(a0,a1,0,1,4,5);row1=SIMD.Float32x4.shuffle(a2,a3,0,1,4,5);row0=SIMD.Float32x4.shuffle(tmp1,row1,0,2,4,6);row1=SIMD.Float32x4.shuffle(row1,tmp1,1,3,5,7);tmp1=SIMD.Float32x4.shuffle(a0,a1,2,3,6,7);row3=SIMD.Float32x4.shuffle(a2,a3,2,3,6,7);row2=SIMD.Float32x4.shuffle(tmp1,row3,0,2,4,6);row3=SIMD.Float32x4.shuffle(row3,tmp1,1,3,5,7);tmp1=SIMD.Float32x4.mul(row2,row3);tmp1=SIMD.Float32x4.swizzle(tmp1,1,0,3,2);minor0=SIMD.Float32x4.mul(row1,tmp1);minor1=SIMD.Float32x4.mul(row0,tmp1);tmp1=SIMD.Float32x4.swizzle(tmp1,2,3,0,1);minor0=SIMD.Float32x4.sub(SIMD.Float32x4.mul(row1,tmp1),minor0);minor1=SIMD.Float32x4.sub(SIMD.Float32x4.mul(row0,tmp1),minor1);minor1=SIMD.Float32x4.swizzle(minor1,2,3,0,1);tmp1=SIMD.Float32x4.mul(row1,row2);tmp1=SIMD.Float32x4.swizzle(tmp1,1,0,3,2);minor0=SIMD.Float32x4.add(SIMD.Float32x4.mul(row3,tmp1),minor0);minor3=SIMD.Float32x4.mul(row0,tmp1);tmp1=SIMD.Float32x4.swizzle(tmp1,2,3,0,1);minor0=SIMD.Float32x4.sub(minor0,SIMD.Float32x4.mul(row3,tmp1));minor3=SIMD.Float32x4.sub(SIMD.Float32x4.mul(row0,tmp1),minor3);minor3=SIMD.Float32x4.swizzle(minor3,2,3,0,1);tmp1=SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(row1,2,3,0,1),row3);tmp1=SIMD.Float32x4.swizzle(tmp1,1,0,3,2);row2=SIMD.Float32x4.swizzle(row2,2,3,0,1);minor0=SIMD.Float32x4.add(SIMD.Float32x4.mul(row2,tmp1),minor0);minor2=SIMD.Float32x4.mul(row0,tmp1);tmp1=SIMD.Float32x4.swizzle(tmp1,2,3,0,1);minor0=SIMD.Float32x4.sub(minor0,SIMD.Float32x4.mul(row2,tmp1));minor2=SIMD.Float32x4.sub(SIMD.Float32x4.mul(row0,tmp1),minor2);minor2=SIMD.Float32x4.swizzle(minor2,2,3,0,1);tmp1=SIMD.Float32x4.mul(row0,row1);tmp1=SIMD.Float32x4.swizzle(tmp1,1,0,3,2);minor2=SIMD.Float32x4.add(SIMD.Float32x4.mul(row3,tmp1),minor2);minor3=SIMD.Float32x4.sub(SIMD.Float32x4.mul(row2,tmp1),minor3);tmp1=SIMD.Float32x4.swizzle(tmp1,2,3,0,1);minor2=SIMD.Float32x4.sub(SIMD.Float32x4.mul(row3,tmp1),minor2);minor3=SIMD.Float32x4.sub(minor3,SIMD.Float32x4.mul(row2,tmp1));tmp1=SIMD.Float32x4.mul(row0,row3);tmp1=SIMD.Float32x4.swizzle(tmp1,1,0,3,2);minor1=SIMD.Float32x4.sub(minor1,SIMD.Float32x4.mul(row2,tmp1));minor2=SIMD.Float32x4.add(SIMD.Float32x4.mul(row1,tmp1),minor2);tmp1=SIMD.Float32x4.swizzle(tmp1,2,3,0,1);minor1=SIMD.Float32x4.add(SIMD.Float32x4.mul(row2,tmp1),minor1);minor2=SIMD.Float32x4.sub(minor2,SIMD.Float32x4.mul(row1,tmp1));tmp1=SIMD.Float32x4.mul(row0,row2);tmp1=SIMD.Float32x4.swizzle(tmp1,1,0,3,2);
minor1=SIMD.Float32x4.add(SIMD.Float32x4.mul(row3,tmp1),minor1);minor3=SIMD.Float32x4.sub(minor3,SIMD.Float32x4.mul(row1,tmp1));tmp1=SIMD.Float32x4.swizzle(tmp1,2,3,0,1);minor1=SIMD.Float32x4.sub(minor1,SIMD.Float32x4.mul(row3,tmp1));minor3=SIMD.Float32x4.add(SIMD.Float32x4.mul(row1,tmp1),minor3);det=SIMD.Float32x4.mul(row0,minor0);det=SIMD.Float32x4.add(SIMD.Float32x4.swizzle(det,2,3,0,1),det);det=SIMD.Float32x4.add(SIMD.Float32x4.swizzle(det,1,0,3,2),det);tmp1=SIMD.Float32x4.reciprocalApproximation(det);det=SIMD.Float32x4.sub(SIMD.Float32x4.add(tmp1,tmp1),SIMD.Float32x4.mul(det,SIMD.Float32x4.mul(tmp1,tmp1)));det=SIMD.Float32x4.swizzle(det,0,0,0,0);if(!det){return null}SIMD.Float32x4.store(out,0,SIMD.Float32x4.mul(det,minor0));SIMD.Float32x4.store(out,4,SIMD.Float32x4.mul(det,minor1));SIMD.Float32x4.store(out,8,SIMD.Float32x4.mul(det,minor2));SIMD.Float32x4.store(out,12,SIMD.Float32x4.mul(det,minor3));return out};mat4.invert=glMatrix.USE_SIMD?mat4.SIMD.invert:mat4.scalar.invert;mat4.scalar.adjoint=function(out,a){var a00=a[0],a01=a[1],a02=a[2],a03=a[3],a10=a[4],a11=a[5],a12=a[6],a13=a[7],a20=a[8],a21=a[9],a22=a[10],a23=a[11],a30=a[12],a31=a[13],a32=a[14],a33=a[15];out[0]=a11*(a22*a33-a23*a32)-a21*(a12*a33-a13*a32)+a31*(a12*a23-a13*a22);out[1]=-(a01*(a22*a33-a23*a32)-a21*(a02*a33-a03*a32)+a31*(a02*a23-a03*a22));out[2]=a01*(a12*a33-a13*a32)-a11*(a02*a33-a03*a32)+a31*(a02*a13-a03*a12);out[3]=-(a01*(a12*a23-a13*a22)-a11*(a02*a23-a03*a22)+a21*(a02*a13-a03*a12));out[4]=-(a10*(a22*a33-a23*a32)-a20*(a12*a33-a13*a32)+a30*(a12*a23-a13*a22));out[5]=a00*(a22*a33-a23*a32)-a20*(a02*a33-a03*a32)+a30*(a02*a23-a03*a22);out[6]=-(a00*(a12*a33-a13*a32)-a10*(a02*a33-a03*a32)+a30*(a02*a13-a03*a12));out[7]=a00*(a12*a23-a13*a22)-a10*(a02*a23-a03*a22)+a20*(a02*a13-a03*a12);out[8]=a10*(a21*a33-a23*a31)-a20*(a11*a33-a13*a31)+a30*(a11*a23-a13*a21);out[9]=-(a00*(a21*a33-a23*a31)-a20*(a01*a33-a03*a31)+a30*(a01*a23-a03*a21));out[10]=a00*(a11*a33-a13*a31)-a10*(a01*a33-a03*a31)+a30*(a01*a13-a03*a11);out[11]=-(a00*(a11*a23-a13*a21)-a10*(a01*a23-a03*a21)+a20*(a01*a13-a03*a11));out[12]=-(a10*(a21*a32-a22*a31)-a20*(a11*a32-a12*a31)+a30*(a11*a22-a12*a21));out[13]=a00*(a21*a32-a22*a31)-a20*(a01*a32-a02*a31)+a30*(a01*a22-a02*a21);out[14]=-(a00*(a11*a32-a12*a31)-a10*(a01*a32-a02*a31)+a30*(a01*a12-a02*a11));out[15]=a00*(a11*a22-a12*a21)-a10*(a01*a22-a02*a21)+a20*(a01*a12-a02*a11);return out};mat4.SIMD.adjoint=function(out,a){var a0,a1,a2,a3;var row0,row1,row2,row3;var tmp1;var minor0,minor1,minor2,minor3;var a0=SIMD.Float32x4.load(a,0);var a1=SIMD.Float32x4.load(a,4);var a2=SIMD.Float32x4.load(a,8);var a3=SIMD.Float32x4.load(a,12);tmp1=SIMD.Float32x4.shuffle(a0,a1,0,1,4,5);row1=SIMD.Float32x4.shuffle(a2,a3,0,1,4,5);row0=SIMD.Float32x4.shuffle(tmp1,row1,0,2,4,6);row1=SIMD.Float32x4.shuffle(row1,tmp1,1,3,5,7);tmp1=SIMD.Float32x4.shuffle(a0,a1,2,3,6,7);row3=SIMD.Float32x4.shuffle(a2,a3,2,3,6,7);row2=SIMD.Float32x4.shuffle(tmp1,row3,0,2,4,6);row3=SIMD.Float32x4.shuffle(row3,tmp1,1,3,5,7);tmp1=SIMD.Float32x4.mul(row2,row3);tmp1=SIMD.Float32x4.swizzle(tmp1,1,0,3,2);minor0=SIMD.Float32x4.mul(row1,tmp1);minor1=SIMD.Float32x4.mul(row0,tmp1);tmp1=SIMD.Float32x4.swizzle(tmp1,2,3,0,1);minor0=SIMD.Float32x4.sub(SIMD.Float32x4.mul(row1,tmp1),minor0);minor1=SIMD.Float32x4.sub(SIMD.Float32x4.mul(row0,tmp1),minor1);minor1=SIMD.Float32x4.swizzle(minor1,2,3,0,1);tmp1=SIMD.Float32x4.mul(row1,row2);tmp1=SIMD.Float32x4.swizzle(tmp1,1,0,3,2);minor0=SIMD.Float32x4.add(SIMD.Float32x4.mul(row3,tmp1),minor0);minor3=SIMD.Float32x4.mul(row0,tmp1);tmp1=SIMD.Float32x4.swizzle(tmp1,2,3,0,1);minor0=SIMD.Float32x4.sub(minor0,SIMD.Float32x4.mul(row3,tmp1));minor3=SIMD.Float32x4.sub(SIMD.Float32x4.mul(row0,tmp1),minor3);minor3=SIMD.Float32x4.swizzle(minor3,2,3,0,1);tmp1=SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(row1,2,3,0,1),row3);tmp1=SIMD.Float32x4.swizzle(tmp1,1,0,3,2);row2=SIMD.Float32x4.swizzle(row2,2,3,0,1);minor0=SIMD.Float32x4.add(SIMD.Float32x4.mul(row2,tmp1),minor0);minor2=SIMD.Float32x4.mul(row0,tmp1);tmp1=SIMD.Float32x4.swizzle(tmp1,2,3,0,1);minor0=SIMD.Float32x4.sub(minor0,SIMD.Float32x4.mul(row2,tmp1));minor2=SIMD.Float32x4.sub(SIMD.Float32x4.mul(row0,tmp1),minor2);minor2=SIMD.Float32x4.swizzle(minor2,2,3,0,1);tmp1=SIMD.Float32x4.mul(row0,row1);tmp1=SIMD.Float32x4.swizzle(tmp1,1,0,3,2);minor2=SIMD.Float32x4.add(SIMD.Float32x4.mul(row3,tmp1),minor2);minor3=SIMD.Float32x4.sub(SIMD.Float32x4.mul(row2,tmp1),minor3);tmp1=SIMD.Float32x4.swizzle(tmp1,2,3,0,1);minor2=SIMD.Float32x4.sub(SIMD.Float32x4.mul(row3,tmp1),minor2);minor3=SIMD.Float32x4.sub(minor3,SIMD.Float32x4.mul(row2,tmp1));tmp1=SIMD.Float32x4.mul(row0,row3);tmp1=SIMD.Float32x4.swizzle(tmp1,1,0,3,2);minor1=SIMD.Float32x4.sub(minor1,SIMD.Float32x4.mul(row2,tmp1));minor2=SIMD.Float32x4.add(SIMD.Float32x4.mul(row1,tmp1),minor2);tmp1=SIMD.Float32x4.swizzle(tmp1,2,3,0,1);minor1=SIMD.Float32x4.add(SIMD.Float32x4.mul(row2,tmp1),minor1);minor2=SIMD.Float32x4.sub(minor2,SIMD.Float32x4.mul(row1,tmp1));tmp1=SIMD.Float32x4.mul(row0,row2);tmp1=SIMD.Float32x4.swizzle(tmp1,1,0,3,2);minor1=SIMD.Float32x4.add(SIMD.Float32x4.mul(row3,tmp1),minor1);minor3=SIMD.Float32x4.sub(minor3,SIMD.Float32x4.mul(row1,tmp1));tmp1=SIMD.Float32x4.swizzle(tmp1,2,3,0,1);minor1=SIMD.Float32x4.sub(minor1,SIMD.Float32x4.mul(row3,tmp1));minor3=SIMD.Float32x4.add(SIMD.Float32x4.mul(row1,tmp1),minor3);SIMD.Float32x4.store(out,0,minor0);SIMD.Float32x4.store(out,4,minor1);SIMD.Float32x4.store(out,8,minor2);SIMD.Float32x4.store(out,12,minor3);return out};mat4.adjoint=glMatrix.USE_SIMD?mat4.SIMD.adjoint:mat4.scalar.adjoint;mat4.determinant=function(a){var a00=a[0],a01=a[1],a02=a[2],a03=a[3],a10=a[4],a11=a[5],a12=a[6],a13=a[7],a20=a[8],a21=a[9],a22=a[10],a23=a[11],a30=a[12],a31=a[13],a32=a[14],a33=a[15],b00=a00*a11-a01*a10,b01=a00*a12-a02*a10,b02=a00*a13-a03*a10,b03=a01*a12-a02*a11,b04=a01*a13-a03*a11,b05=a02*a13-a03*a12,b06=a20*a31-a21*a30,b07=a20*a32-a22*a30,b08=a20*a33-a23*a30,b09=a21*a32-a22*a31,b10=a21*a33-a23*a31,b11=a22*a33-a23*a32;return b00*b11-b01*b10+b02*b09+b03*b08-b04*b07+b05*b06};mat4.SIMD.multiply=function(out,a,b){var a0=SIMD.Float32x4.load(a,0);var a1=SIMD.Float32x4.load(a,4);var a2=SIMD.Float32x4.load(a,8);var a3=SIMD.Float32x4.load(a,12);var b0=SIMD.Float32x4.load(b,0);var out0=SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(b0,0,0,0,0),a0),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(b0,1,1,1,1),a1),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(b0,2,2,2,2),a2),SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(b0,3,3,3,3),a3))));SIMD.Float32x4.store(out,0,out0);var b1=SIMD.Float32x4.load(b,4);var out1=SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(b1,0,0,0,0),a0),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(b1,1,1,1,1),a1),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(b1,2,2,2,2),a2),SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(b1,3,3,3,3),a3))));SIMD.Float32x4.store(out,4,out1);var b2=SIMD.Float32x4.load(b,8);var out2=SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(b2,0,0,0,0),a0),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(b2,1,1,1,1),a1),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(b2,2,2,2,2),a2),SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(b2,3,3,3,3),a3))));SIMD.Float32x4.store(out,8,out2);var b3=SIMD.Float32x4.load(b,12);var out3=SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(b3,0,0,0,0),a0),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(b3,1,1,1,1),a1),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(b3,2,2,2,2),a2),SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(b3,3,3,3,3),a3))));SIMD.Float32x4.store(out,12,out3);return out};mat4.scalar.multiply=function(out,a,b){var a00=a[0],a01=a[1],a02=a[2],a03=a[3],a10=a[4],a11=a[5],a12=a[6],a13=a[7],a20=a[8],a21=a[9],a22=a[10],a23=a[11],a30=a[12],a31=a[13],a32=a[14],a33=a[15];var b0=b[0],b1=b[1],b2=b[2],b3=b[3];out[0]=b0*a00+b1*a10+b2*a20+b3*a30;out[1]=b0*a01+b1*a11+b2*a21+b3*a31;out[2]=b0*a02+b1*a12+b2*a22+b3*a32;out[3]=b0*a03+b1*a13+b2*a23+b3*a33;b0=b[4];b1=b[5];b2=b[6];b3=b[7];out[4]=b0*a00+b1*a10+b2*a20+b3*a30;out[5]=b0*a01+b1*a11+b2*a21+b3*a31;out[6]=b0*a02+b1*a12+b2*a22+b3*a32;out[7]=b0*a03+b1*a13+b2*a23+b3*a33;b0=b[8];b1=b[9];b2=b[10];b3=b[11];out[8]=b0*a00+b1*a10+b2*a20+b3*a30;out[9]=b0*a01+b1*a11+b2*a21+b3*a31;out[10]=b0*a02+b1*a12+b2*a22+b3*a32;out[11]=b0*a03+b1*a13+b2*a23+b3*a33;b0=b[12];b1=b[13];b2=b[14];b3=b[15];out[12]=b0*a00+b1*a10+b2*a20+b3*a30;out[13]=b0*a01+b1*a11+b2*a21+b3*a31;out[14]=b0*a02+b1*a12+b2*a22+b3*a32;out[15]=b0*a03+b1*a13+b2*a23+b3*a33;return out};mat4.multiply=glMatrix.USE_SIMD?mat4.SIMD.multiply:mat4.scalar.multiply;mat4.mul=mat4.multiply;mat4.scalar.translate=function(out,a,v){var x=v[0],y=v[1],z=v[2],a00,a01,a02,a03,a10,a11,a12,a13,a20,a21,a22,a23;if(a===out){out[12]=a[0]*x+a[4]*y+a[8]*z+a[12];out[13]=a[1]*x+a[5]*y+a[9]*z+a[13];out[14]=a[2]*x+a[6]*y+a[10]*z+a[14];out[15]=a[3]*x+a[7]*y+a[11]*z+a[15]}else{a00=a[0];a01=a[1];a02=a[2];a03=a[3];a10=a[4];a11=a[5];a12=a[6];a13=a[7];a20=a[8];a21=a[9];a22=a[10];a23=a[11];out[0]=a00;out[1]=a01;out[2]=a02;out[3]=a03;out[4]=a10;out[5]=a11;out[6]=a12;out[7]=a13;out[8]=a20;out[9]=a21;out[10]=a22;out[11]=a23;out[12]=a00*x+a10*y+a20*z+a[12];out[13]=a01*x+a11*y+a21*z+a[13];out[14]=a02*x+a12*y+a22*z+a[14];out[15]=a03*x+a13*y+a23*z+a[15]}return out};mat4.SIMD.translate=function(out,a,v){var a0=SIMD.Float32x4.load(a,0),a1=SIMD.Float32x4.load(a,4),a2=SIMD.Float32x4.load(a,8),a3=SIMD.Float32x4.load(a,12),vec=SIMD.Float32x4(v[0],v[1],v[2],0);if(a!==out){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[4]=a[4];out[5]=a[5];out[6]=a[6];out[7]=a[7];out[8]=a[8];out[9]=a[9];out[10]=a[10];out[11]=a[11]}a0=SIMD.Float32x4.mul(a0,SIMD.Float32x4.swizzle(vec,0,0,0,0));a1=SIMD.Float32x4.mul(a1,SIMD.Float32x4.swizzle(vec,1,1,1,1));a2=SIMD.Float32x4.mul(a2,SIMD.Float32x4.swizzle(vec,2,2,2,2));var t0=SIMD.Float32x4.add(a0,SIMD.Float32x4.add(a1,SIMD.Float32x4.add(a2,a3)));SIMD.Float32x4.store(out,12,t0);return out};mat4.translate=glMatrix.USE_SIMD?mat4.SIMD.translate:mat4.scalar.translate;mat4.scalar.scale=function(out,a,v){var x=v[0],y=v[1],z=v[2];out[0]=a[0]*x;out[1]=a[1]*x;out[2]=a[2]*x;out[3]=a[3]*x;out[4]=a[4]*y;out[5]=a[5]*y;out[6]=a[6]*y;out[7]=a[7]*y;out[8]=a[8]*z;out[9]=a[9]*z;out[10]=a[10]*z;out[11]=a[11]*z;out[12]=a[12];out[13]=a[13];out[14]=a[14];out[15]=a[15];return out};mat4.SIMD.scale=function(out,a,v){var a0,a1,a2;var vec=SIMD.Float32x4(v[0],v[1],v[2],0);a0=SIMD.Float32x4.load(a,0);SIMD.Float32x4.store(out,0,SIMD.Float32x4.mul(a0,SIMD.Float32x4.swizzle(vec,0,0,0,0)));a1=SIMD.Float32x4.load(a,4);SIMD.Float32x4.store(out,4,SIMD.Float32x4.mul(a1,SIMD.Float32x4.swizzle(vec,1,1,1,1)));a2=SIMD.Float32x4.load(a,8);SIMD.Float32x4.store(out,8,SIMD.Float32x4.mul(a2,SIMD.Float32x4.swizzle(vec,2,2,2,2)));out[12]=a[12];out[13]=a[13];out[14]=a[14];out[15]=a[15];return out};mat4.scale=glMatrix.USE_SIMD?mat4.SIMD.scale:mat4.scalar.scale;mat4.rotate=function(out,a,rad,axis){var x=axis[0],y=axis[1],z=axis[2],len=Math.sqrt(x*x+y*y+z*z),s,c,t,a00,a01,a02,a03,a10,a11,a12,a13,a20,a21,a22,a23,b00,b01,b02,b10,b11,b12,b20,b21,b22;if(Math.abs(len)<glMatrix.EPSILON){return null}len=1/len;x*=len;y*=len;z*=len;s=Math.sin(rad);c=Math.cos(rad);t=1-c;a00=a[0];a01=a[1];a02=a[2];a03=a[3];a10=a[4];a11=a[5];a12=a[6];a13=a[7];a20=a[8];a21=a[9];a22=a[10];a23=a[11];b00=x*x*t+c;b01=y*x*t+z*s;b02=z*x*t-y*s;b10=x*y*t-z*s;b11=y*y*t+c;b12=z*y*t+x*s;b20=x*z*t+y*s;b21=y*z*t-x*s;b22=z*z*t+c;out[0]=a00*b00+a10*b01+a20*b02;out[1]=a01*b00+a11*b01+a21*b02;out[2]=a02*b00+a12*b01+a22*b02;out[3]=a03*b00+a13*b01+a23*b02;out[4]=a00*b10+a10*b11+a20*b12;out[5]=a01*b10+a11*b11+a21*b12;out[6]=a02*b10+a12*b11+a22*b12;out[7]=a03*b10+a13*b11+a23*b12;out[8]=a00*b20+a10*b21+a20*b22;out[9]=a01*b20+a11*b21+a21*b22;out[10]=a02*b20+a12*b21+a22*b22;out[11]=a03*b20+a13*b21+a23*b22;if(a!==out){out[12]=a[12];out[13]=a[13];out[14]=a[14];out[15]=a[15]}return out};mat4.scalar.rotateX=function(out,a,rad){var s=Math.sin(rad),c=Math.cos(rad),a10=a[4],a11=a[5],a12=a[6],a13=a[7],a20=a[8],a21=a[9],a22=a[10],a23=a[11];if(a!==out){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[12]=a[12];out[13]=a[13];out[14]=a[14];out[15]=a[15]}out[4]=a10*c+a20*s;out[5]=a11*c+a21*s;out[6]=a12*c+a22*s;out[7]=a13*c+a23*s;out[8]=a20*c-a10*s;out[9]=a21*c-a11*s;out[10]=a22*c-a12*s;out[11]=a23*c-a13*s;return out};mat4.SIMD.rotateX=function(out,a,rad){var s=SIMD.Float32x4.splat(Math.sin(rad)),c=SIMD.Float32x4.splat(Math.cos(rad));if(a!==out){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];out[12]=a[12];out[13]=a[13];out[14]=a[14];out[15]=a[15]}var a_1=SIMD.Float32x4.load(a,4);var a_2=SIMD.Float32x4.load(a,8);SIMD.Float32x4.store(out,4,SIMD.Float32x4.add(SIMD.Float32x4.mul(a_1,c),SIMD.Float32x4.mul(a_2,s)));SIMD.Float32x4.store(out,8,SIMD.Float32x4.sub(SIMD.Float32x4.mul(a_2,c),SIMD.Float32x4.mul(a_1,s)));return out};mat4.rotateX=glMatrix.USE_SIMD?mat4.SIMD.rotateX:mat4.scalar.rotateX;mat4.scalar.rotateY=function(out,a,rad){var s=Math.sin(rad),c=Math.cos(rad),a00=a[0],a01=a[1],a02=a[2],a03=a[3],a20=a[8],a21=a[9],a22=a[10],a23=a[11];if(a!==out){out[4]=a[4];out[5]=a[5];out[6]=a[6];out[7]=a[7];out[12]=a[12];out[13]=a[13];out[14]=a[14];out[15]=a[15]}out[0]=a00*c-a20*s;out[1]=a01*c-a21*s;out[2]=a02*c-a22*s;out[3]=a03*c-a23*s;out[8]=a00*s+a20*c;out[9]=a01*s+a21*c;out[10]=a02*s+a22*c;out[11]=a03*s+a23*c;return out};mat4.SIMD.rotateY=function(out,a,rad){var s=SIMD.Float32x4.splat(Math.sin(rad)),c=SIMD.Float32x4.splat(Math.cos(rad));if(a!==out){out[4]=a[4];out[5]=a[5];out[6]=a[6];out[7]=a[7];out[12]=a[12];out[13]=a[13];out[14]=a[14];out[15]=a[15]}var a_0=SIMD.Float32x4.load(a,0);var a_2=SIMD.Float32x4.load(a,8);SIMD.Float32x4.store(out,0,SIMD.Float32x4.sub(SIMD.Float32x4.mul(a_0,c),SIMD.Float32x4.mul(a_2,s)));SIMD.Float32x4.store(out,8,SIMD.Float32x4.add(SIMD.Float32x4.mul(a_0,s),SIMD.Float32x4.mul(a_2,c)));return out};mat4.rotateY=glMatrix.USE_SIMD?mat4.SIMD.rotateY:mat4.scalar.rotateY;mat4.scalar.rotateZ=function(out,a,rad){var s=Math.sin(rad),c=Math.cos(rad),a00=a[0],a01=a[1],a02=a[2],a03=a[3],a10=a[4],a11=a[5],a12=a[6],a13=a[7];if(a!==out){out[8]=a[8];out[9]=a[9];out[10]=a[10];out[11]=a[11];out[12]=a[12];out[13]=a[13];out[14]=a[14];out[15]=a[15]}out[0]=a00*c+a10*s;out[1]=a01*c+a11*s;out[2]=a02*c+a12*s;out[3]=a03*c+a13*s;out[4]=a10*c-a00*s;out[5]=a11*c-a01*s;out[6]=a12*c-a02*s;out[7]=a13*c-a03*s;return out};mat4.SIMD.rotateZ=function(out,a,rad){var s=SIMD.Float32x4.splat(Math.sin(rad)),c=SIMD.Float32x4.splat(Math.cos(rad));if(a!==out){out[8]=a[8];out[9]=a[9];out[10]=a[10];out[11]=a[11];out[12]=a[12];out[13]=a[13];out[14]=a[14];out[15]=a[15]}var a_0=SIMD.Float32x4.load(a,0);var a_1=SIMD.Float32x4.load(a,4);SIMD.Float32x4.store(out,0,SIMD.Float32x4.add(SIMD.Float32x4.mul(a_0,c),SIMD.Float32x4.mul(a_1,s)));SIMD.Float32x4.store(out,4,SIMD.Float32x4.sub(SIMD.Float32x4.mul(a_1,c),SIMD.Float32x4.mul(a_0,s)));return out};mat4.rotateZ=glMatrix.USE_SIMD?mat4.SIMD.rotateZ:mat4.scalar.rotateZ;mat4.fromTranslation=function(out,v){out[0]=1;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=1;out[6]=0;out[7]=0;out[8]=0;out[9]=0;out[10]=1;out[11]=0;out[12]=v[0];out[13]=v[1];out[14]=v[2];out[15]=1;return out};mat4.fromScaling=function(out,v){out[0]=v[0];out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=v[1];out[6]=0;out[7]=0;out[8]=0;out[9]=0;out[10]=v[2];out[11]=0;out[12]=0;out[13]=0;out[14]=0;out[15]=1;return out};mat4.fromRotation=function(out,rad,axis){var x=axis[0],y=axis[1],z=axis[2],len=Math.sqrt(x*x+y*y+z*z),s,c,t;if(Math.abs(len)<glMatrix.EPSILON){return null}len=1/len;x*=len;y*=len;z*=len;s=Math.sin(rad);c=Math.cos(rad);t=1-c;out[0]=x*x*t+c;out[1]=y*x*t+z*s;out[2]=z*x*t-y*s;out[3]=0;out[4]=x*y*t-z*s;out[5]=y*y*t+c;out[6]=z*y*t+x*s;out[7]=0;out[8]=x*z*t+y*s;out[9]=y*z*t-x*s;out[10]=z*z*t+c;out[11]=0;out[12]=0;out[13]=0;out[14]=0;out[15]=1;return out};mat4.fromXRotation=function(out,rad){var s=Math.sin(rad),c=Math.cos(rad);out[0]=1;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=c;out[6]=s;out[7]=0;out[8]=0;out[9]=-s;out[10]=c;out[11]=0;out[12]=0;out[13]=0;out[14]=0;out[15]=1;return out};mat4.fromYRotation=function(out,rad){var s=Math.sin(rad),c=Math.cos(rad);out[0]=c;out[1]=0;out[2]=-s;out[3]=0;out[4]=0;out[5]=1;out[6]=0;out[7]=0;out[8]=s;out[9]=0;out[10]=c;out[11]=0;out[12]=0;out[13]=0;out[14]=0;out[15]=1;return out};mat4.fromZRotation=function(out,rad){var s=Math.sin(rad),c=Math.cos(rad);out[0]=c;out[1]=s;out[2]=0;out[3]=0;out[4]=-s;out[5]=c;out[6]=0;out[7]=0;out[8]=0;out[9]=0;out[10]=1;out[11]=0;out[12]=0;out[13]=0;out[14]=0;out[15]=1;return out};mat4.fromRotationTranslation=function(out,q,v){var x=q[0],y=q[1],z=q[2],w=q[3],x2=x+x,y2=y+y,z2=z+z,xx=x*x2,xy=x*y2,xz=x*z2,yy=y*y2,yz=y*z2,zz=z*z2,wx=w*x2,wy=w*y2,wz=w*z2;out[0]=1-(yy+zz);out[1]=xy+wz;out[2]=xz-wy;out[3]=0;out[4]=xy-wz;out[5]=1-(xx+zz);out[6]=yz+wx;out[7]=0;out[8]=xz+wy;out[9]=yz-wx;out[10]=1-(xx+yy);out[11]=0;out[12]=v[0];out[13]=v[1];out[14]=v[2];out[15]=1;return out};mat4.getTranslation=function(out,mat){out[0]=mat[12];out[1]=mat[13];out[2]=mat[14];return out};mat4.getRotation=function(out,mat){var trace=mat[0]+mat[5]+mat[10];var S=0;if(trace>0){S=Math.sqrt(trace+1)*2;out[3]=.25*S;out[0]=(mat[6]-mat[9])/S;out[1]=(mat[8]-mat[2])/S;out[2]=(mat[1]-mat[4])/S}else if(mat[0]>mat[5]&mat[0]>mat[10]){S=Math.sqrt(1+mat[0]-mat[5]-mat[10])*2;out[3]=(mat[6]-mat[9])/S;out[0]=.25*S;out[1]=(mat[1]+mat[4])/S;out[2]=(mat[8]+mat[2])/S}else if(mat[5]>mat[10]){S=Math.sqrt(1+mat[5]-mat[0]-mat[10])*2;out[3]=(mat[8]-mat[2])/S;out[0]=(mat[1]+mat[4])/S;out[1]=.25*S;out[2]=(mat[6]+mat[9])/S}else{S=Math.sqrt(1+mat[10]-mat[0]-mat[5])*2;out[3]=(mat[1]-mat[4])/S;out[0]=(mat[8]+mat[2])/S;out[1]=(mat[6]+mat[9])/S;out[2]=.25*S}return out};mat4.fromRotationTranslationScale=function(out,q,v,s){var x=q[0],y=q[1],z=q[2],w=q[3],x2=x+x,y2=y+y,z2=z+z,xx=x*x2,xy=x*y2,xz=x*z2,yy=y*y2,yz=y*z2,zz=z*z2,wx=w*x2,wy=w*y2,wz=w*z2,sx=s[0],sy=s[1],sz=s[2];out[0]=(1-(yy+zz))*sx;out[1]=(xy+wz)*sx;out[2]=(xz-wy)*sx;out[3]=0;out[4]=(xy-wz)*sy;out[5]=(1-(xx+zz))*sy;out[6]=(yz+wx)*sy;out[7]=0;out[8]=(xz+wy)*sz;out[9]=(yz-wx)*sz;out[10]=(1-(xx+yy))*sz;out[11]=0;out[12]=v[0];out[13]=v[1];out[14]=v[2];out[15]=1;return out};mat4.fromRotationTranslationScaleOrigin=function(out,q,v,s,o){var x=q[0],y=q[1],z=q[2],w=q[3],x2=x+x,y2=y+y,z2=z+z,xx=x*x2,xy=x*y2,xz=x*z2,yy=y*y2,yz=y*z2,zz=z*z2,wx=w*x2,wy=w*y2,wz=w*z2,sx=s[0],sy=s[1],sz=s[2],ox=o[0],oy=o[1],oz=o[2];out[0]=(1-(yy+zz))*sx;out[1]=(xy+wz)*sx;out[2]=(xz-wy)*sx;out[3]=0;out[4]=(xy-wz)*sy;out[5]=(1-(xx+zz))*sy;out[6]=(yz+wx)*sy;out[7]=0;out[8]=(xz+wy)*sz;out[9]=(yz-wx)*sz;out[10]=(1-(xx+yy))*sz;out[11]=0;out[12]=v[0]+ox-(out[0]*ox+out[4]*oy+out[8]*oz);out[13]=v[1]+oy-(out[1]*ox+out[5]*oy+out[9]*oz);out[14]=v[2]+oz-(out[2]*ox+out[6]*oy+out[10]*oz);out[15]=1;return out};mat4.fromQuat=function(out,q){var x=q[0],y=q[1],z=q[2],w=q[3],x2=x+x,y2=y+y,z2=z+z,xx=x*x2,yx=y*x2,yy=y*y2,zx=z*x2,zy=z*y2,zz=z*z2,wx=w*x2,wy=w*y2,wz=w*z2;out[0]=1-yy-zz;out[1]=yx+wz;out[2]=zx-wy;out[3]=0;out[4]=yx-wz;out[5]=1-xx-zz;out[6]=zy+wx;out[7]=0;out[8]=zx+wy;out[9]=zy-wx;out[10]=1-xx-yy;out[11]=0;out[12]=0;out[13]=0;out[14]=0;out[15]=1;return out};mat4.frustum=function(out,left,right,bottom,top,near,far){var rl=1/(right-left),tb=1/(top-bottom),nf=1/(near-far);out[0]=near*2*rl;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=near*2*tb;out[6]=0;out[7]=0;out[8]=(right+left)*rl;out[9]=(top+bottom)*tb;out[10]=(far+near)*nf;out[11]=-1;out[12]=0;out[13]=0;out[14]=far*near*2*nf;out[15]=0;return out};mat4.perspective=function(out,fovy,aspect,near,far){var f=1/Math.tan(fovy/2),nf=1/(near-far);out[0]=f/aspect;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=f;out[6]=0;out[7]=0;out[8]=0;out[9]=0;out[10]=(far+near)*nf;out[11]=-1;out[12]=0;out[13]=0;out[14]=2*far*near*nf;out[15]=0;return out};mat4.perspectiveFromFieldOfView=function(out,fov,near,far){var upTan=Math.tan(fov.upDegrees*Math.PI/180),downTan=Math.tan(fov.downDegrees*Math.PI/180),leftTan=Math.tan(fov.leftDegrees*Math.PI/180),rightTan=Math.tan(fov.rightDegrees*Math.PI/180),xScale=2/(leftTan+rightTan),yScale=2/(upTan+downTan);out[0]=xScale;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=yScale;out[6]=0;out[7]=0;out[8]=-((leftTan-rightTan)*xScale*.5);out[9]=(upTan-downTan)*yScale*.5;out[10]=far/(near-far);out[11]=-1;out[12]=0;out[13]=0;out[14]=far*near/(near-far);out[15]=0;return out};mat4.ortho=function(out,left,right,bottom,top,near,far){var lr=1/(left-right),bt=1/(bottom-top),nf=1/(near-far);out[0]=-2*lr;out[1]=0;out[2]=0;out[3]=0;out[4]=0;out[5]=-2*bt;out[6]=0;out[7]=0;out[8]=0;out[9]=0;out[10]=2*nf;out[11]=0;out[12]=(left+right)*lr;out[13]=(top+bottom)*bt;out[14]=(far+near)*nf;out[15]=1;return out};mat4.lookAt=function(out,eye,center,up){var x0,x1,x2,y0,y1,y2,z0,z1,z2,len,eyex=eye[0],eyey=eye[1],eyez=eye[2],upx=up[0],upy=up[1],upz=up[2],centerx=center[0],centery=center[1],centerz=center[2];if(Math.abs(eyex-centerx)<glMatrix.EPSILON&&Math.abs(eyey-centery)<glMatrix.EPSILON&&Math.abs(eyez-centerz)<glMatrix.EPSILON){return mat4.identity(out)}z0=eyex-centerx;z1=eyey-centery;z2=eyez-centerz;len=1/Math.sqrt(z0*z0+z1*z1+z2*z2);z0*=len;z1*=len;z2*=len;x0=upy*z2-upz*z1;x1=upz*z0-upx*z2;x2=upx*z1-upy*z0;len=Math.sqrt(x0*x0+x1*x1+x2*x2);if(!len){x0=0;x1=0;x2=0}else{len=1/len;x0*=len;x1*=len;x2*=len}y0=z1*x2-z2*x1;y1=z2*x0-z0*x2;y2=z0*x1-z1*x0;len=Math.sqrt(y0*y0+y1*y1+y2*y2);if(!len){y0=0;y1=0;y2=0}else{len=1/len;y0*=len;y1*=len;y2*=len}out[0]=x0;out[1]=y0;out[2]=z0;out[3]=0;out[4]=x1;out[5]=y1;out[6]=z1;out[7]=0;out[8]=x2;out[9]=y2;out[10]=z2;out[11]=0;out[12]=-(x0*eyex+x1*eyey+x2*eyez);out[13]=-(y0*eyex+y1*eyey+y2*eyez);out[14]=-(z0*eyex+z1*eyey+z2*eyez);out[15]=1;return out};mat4.str=function(a){return"mat4("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+", "+a[9]+", "+a[10]+", "+a[11]+", "+a[12]+", "+a[13]+", "+a[14]+", "+a[15]+")"};mat4.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3],2)+Math.pow(a[4],2)+Math.pow(a[5],2)+Math.pow(a[6],2)+Math.pow(a[7],2)+Math.pow(a[8],2)+Math.pow(a[9],2)+Math.pow(a[10],2)+Math.pow(a[11],2)+Math.pow(a[12],2)+Math.pow(a[13],2)+Math.pow(a[14],2)+Math.pow(a[15],2))};mat4.add=function(out,a,b){out[0]=a[0]+b[0];out[1]=a[1]+b[1];out[2]=a[2]+b[2];out[3]=a[3]+b[3];out[4]=a[4]+b[4];out[5]=a[5]+b[5];out[6]=a[6]+b[6];out[7]=a[7]+b[7];out[8]=a[8]+b[8];out[9]=a[9]+b[9];out[10]=a[10]+b[10];out[11]=a[11]+b[11];out[12]=a[12]+b[12];out[13]=a[13]+b[13];out[14]=a[14]+b[14];out[15]=a[15]+b[15];return out};mat4.subtract=function(out,a,b){out[0]=a[0]-b[0];out[1]=a[1]-b[1];out[2]=a[2]-b[2];out[3]=a[3]-b[3];out[4]=a[4]-b[4];out[5]=a[5]-b[5];out[6]=a[6]-b[6];out[7]=a[7]-b[7];out[8]=a[8]-b[8];out[9]=a[9]-b[9];out[10]=a[10]-b[10];out[11]=a[11]-b[11];out[12]=a[12]-b[12];out[13]=a[13]-b[13];out[14]=a[14]-b[14];out[15]=a[15]-b[15];return out};mat4.sub=mat4.subtract;mat4.multiplyScalar=function(out,a,b){out[0]=a[0]*b;out[1]=a[1]*b;out[2]=a[2]*b;out[3]=a[3]*b;out[4]=a[4]*b;out[5]=a[5]*b;out[6]=a[6]*b;out[7]=a[7]*b;out[8]=a[8]*b;out[9]=a[9]*b;out[10]=a[10]*b;out[11]=a[11]*b;out[12]=a[12]*b;out[13]=a[13]*b;out[14]=a[14]*b;out[15]=a[15]*b;return out};mat4.multiplyScalarAndAdd=function(out,a,b,scale){out[0]=a[0]+b[0]*scale;out[1]=a[1]+b[1]*scale;out[2]=a[2]+b[2]*scale;out[3]=a[3]+b[3]*scale;out[4]=a[4]+b[4]*scale;out[5]=a[5]+b[5]*scale;out[6]=a[6]+b[6]*scale;out[7]=a[7]+b[7]*scale;out[8]=a[8]+b[8]*scale;out[9]=a[9]+b[9]*scale;out[10]=a[10]+b[10]*scale;out[11]=a[11]+b[11]*scale;out[12]=a[12]+b[12]*scale;out[13]=a[13]+b[13]*scale;out[14]=a[14]+b[14]*scale;out[15]=a[15]+b[15]*scale;return out};mat4.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]&&a[6]===b[6]&&a[7]===b[7]&&a[8]===b[8]&&a[9]===b[9]&&a[10]===b[10]&&a[11]===b[11]&&a[12]===b[12]&&a[13]===b[13]&&a[14]===b[14]&&a[15]===b[15]};mat4.equals=function(a,b){var a0=a[0],a1=a[1],a2=a[2],a3=a[3],a4=a[4],a5=a[5],a6=a[6],a7=a[7],a8=a[8],a9=a[9],a10=a[10],a11=a[11],a12=a[12],a13=a[13],a14=a[14],a15=a[15];var b0=b[0],b1=b[1],b2=b[2],b3=b[3],b4=b[4],b5=b[5],b6=b[6],b7=b[7],b8=b[8],b9=b[9],b10=b[10],b11=b[11],b12=b[12],b13=b[13],b14=b[14],b15=b[15];return Math.abs(a0-b0)<=glMatrix.EPSILON*Math.max(1,Math.abs(a0),Math.abs(b0))&&Math.abs(a1-b1)<=glMatrix.EPSILON*Math.max(1,Math.abs(a1),Math.abs(b1))&&Math.abs(a2-b2)<=glMatrix.EPSILON*Math.max(1,Math.abs(a2),Math.abs(b2))&&Math.abs(a3-b3)<=glMatrix.EPSILON*Math.max(1,Math.abs(a3),Math.abs(b3))&&Math.abs(a4-b4)<=glMatrix.EPSILON*Math.max(1,Math.abs(a4),Math.abs(b4))&&Math.abs(a5-b5)<=glMatrix.EPSILON*Math.max(1,Math.abs(a5),Math.abs(b5))&&Math.abs(a6-b6)<=glMatrix.EPSILON*Math.max(1,Math.abs(a6),Math.abs(b6))&&Math.abs(a7-b7)<=glMatrix.EPSILON*Math.max(1,Math.abs(a7),Math.abs(b7))&&Math.abs(a8-b8)<=glMatrix.EPSILON*Math.max(1,Math.abs(a8),Math.abs(b8))&&Math.abs(a9-b9)<=glMatrix.EPSILON*Math.max(1,Math.abs(a9),Math.abs(b9))&&Math.abs(a10-b10)<=glMatrix.EPSILON*Math.max(1,Math.abs(a10),Math.abs(b10))&&Math.abs(a11-b11)<=glMatrix.EPSILON*Math.max(1,Math.abs(a11),Math.abs(b11))&&Math.abs(a12-b12)<=glMatrix.EPSILON*Math.max(1,Math.abs(a12),Math.abs(b12))&&Math.abs(a13-b13)<=glMatrix.EPSILON*Math.max(1,Math.abs(a13),Math.abs(b13))&&Math.abs(a14-b14)<=glMatrix.EPSILON*Math.max(1,Math.abs(a14),Math.abs(b14))&&Math.abs(a15-b15)<=glMatrix.EPSILON*Math.max(1,Math.abs(a15),Math.abs(b15))};module.exports=mat4},{"./common.js":155}],160:[function(require,module,exports){var glMatrix=require("./common.js");var mat3=require("./mat3.js");var vec3=require("./vec3.js");var vec4=require("./vec4.js");var quat={};quat.create=function(){var out=new glMatrix.ARRAY_TYPE(4);out[0]=0;out[1]=0;out[2]=0;out[3]=1;return out};quat.rotationTo=function(){var tmpvec3=vec3.create();var xUnitVec3=vec3.fromValues(1,0,0);var yUnitVec3=vec3.fromValues(0,1,0);return function(out,a,b){var dot=vec3.dot(a,b);if(dot<-.999999){vec3.cross(tmpvec3,xUnitVec3,a);if(vec3.length(tmpvec3)<1e-6)vec3.cross(tmpvec3,yUnitVec3,a);vec3.normalize(tmpvec3,tmpvec3);quat.setAxisAngle(out,tmpvec3,Math.PI);return out}else if(dot>.999999){out[0]=0;out[1]=0;out[2]=0;out[3]=1;return out}else{vec3.cross(tmpvec3,a,b);out[0]=tmpvec3[0];out[1]=tmpvec3[1];out[2]=tmpvec3[2];out[3]=1+dot;return quat.normalize(out,out)}}}();quat.setAxes=function(){var matr=mat3.create();return function(out,view,right,up){matr[0]=right[0];matr[3]=right[1];matr[6]=right[2];matr[1]=up[0];matr[4]=up[1];matr[7]=up[2];matr[2]=-view[0];matr[5]=-view[1];matr[8]=-view[2];return quat.normalize(out,quat.fromMat3(out,matr))}}();quat.clone=vec4.clone;quat.fromValues=vec4.fromValues;quat.copy=vec4.copy;quat.set=vec4.set;quat.identity=function(out){out[0]=0;out[1]=0;out[2]=0;out[3]=1;return out};quat.setAxisAngle=function(out,axis,rad){rad=rad*.5;var s=Math.sin(rad);out[0]=s*axis[0];out[1]=s*axis[1];out[2]=s*axis[2];out[3]=Math.cos(rad);return out};quat.getAxisAngle=function(out_axis,q){var rad=Math.acos(q[3])*2;var s=Math.sin(rad/2);if(s!=0){out_axis[0]=q[0]/s;out_axis[1]=q[1]/s;out_axis[2]=q[2]/s}else{out_axis[0]=1;out_axis[1]=0;out_axis[2]=0}return rad};quat.add=vec4.add;quat.multiply=function(out,a,b){var ax=a[0],ay=a[1],az=a[2],aw=a[3],bx=b[0],by=b[1],bz=b[2],bw=b[3];out[0]=ax*bw+aw*bx+ay*bz-az*by;out[1]=ay*bw+aw*by+az*bx-ax*bz;out[2]=az*bw+aw*bz+ax*by-ay*bx;out[3]=aw*bw-ax*bx-ay*by-az*bz;return out};quat.mul=quat.multiply;quat.scale=vec4.scale;quat.rotateX=function(out,a,rad){rad*=.5;var ax=a[0],ay=a[1],az=a[2],aw=a[3],bx=Math.sin(rad),bw=Math.cos(rad);out[0]=ax*bw+aw*bx;out[1]=ay*bw+az*bx;out[2]=az*bw-ay*bx;out[3]=aw*bw-ax*bx;return out};quat.rotateY=function(out,a,rad){rad*=.5;var ax=a[0],ay=a[1],az=a[2],aw=a[3],by=Math.sin(rad),bw=Math.cos(rad);out[0]=ax*bw-az*by;out[1]=ay*bw+aw*by;out[2]=az*bw+ax*by;out[3]=aw*bw-ay*by;return out};quat.rotateZ=function(out,a,rad){rad*=.5;var ax=a[0],ay=a[1],az=a[2],aw=a[3],bz=Math.sin(rad),bw=Math.cos(rad);out[0]=ax*bw+ay*bz;out[1]=ay*bw-ax*bz;out[2]=az*bw+aw*bz;out[3]=aw*bw-az*bz;return out};quat.calculateW=function(out,a){var x=a[0],y=a[1],z=a[2];out[0]=x;out[1]=y;out[2]=z;out[3]=Math.sqrt(Math.abs(1-x*x-y*y-z*z));return out};quat.dot=vec4.dot;quat.lerp=vec4.lerp;quat.slerp=function(out,a,b,t){var ax=a[0],ay=a[1],az=a[2],aw=a[3],bx=b[0],by=b[1],bz=b[2],bw=b[3];var omega,cosom,sinom,scale0,scale1;cosom=ax*bx+ay*by+az*bz+aw*bw;if(cosom<0){cosom=-cosom;bx=-bx;by=-by;bz=-bz;bw=-bw}if(1-cosom>1e-6){omega=Math.acos(cosom);sinom=Math.sin(omega);scale0=Math.sin((1-t)*omega)/sinom;scale1=Math.sin(t*omega)/sinom}else{scale0=1-t;scale1=t}out[0]=scale0*ax+scale1*bx;out[1]=scale0*ay+scale1*by;out[2]=scale0*az+scale1*bz;out[3]=scale0*aw+scale1*bw;return out};quat.sqlerp=function(){var temp1=quat.create();var temp2=quat.create();return function(out,a,b,c,d,t){quat.slerp(temp1,a,d,t);quat.slerp(temp2,b,c,t);quat.slerp(out,temp1,temp2,2*t*(1-t));return out}}();quat.invert=function(out,a){var a0=a[0],a1=a[1],a2=a[2],a3=a[3],dot=a0*a0+a1*a1+a2*a2+a3*a3,invDot=dot?1/dot:0;out[0]=-a0*invDot;out[1]=-a1*invDot;out[2]=-a2*invDot;out[3]=a3*invDot;return out};quat.conjugate=function(out,a){out[0]=-a[0];out[1]=-a[1];out[2]=-a[2];out[3]=a[3];return out};quat.length=vec4.length;quat.len=quat.length;quat.squaredLength=vec4.squaredLength;quat.sqrLen=quat.squaredLength;quat.normalize=vec4.normalize;quat.fromMat3=function(out,m){var fTrace=m[0]+m[4]+m[8];var fRoot;if(fTrace>0){fRoot=Math.sqrt(fTrace+1);out[3]=.5*fRoot;fRoot=.5/fRoot;out[0]=(m[5]-m[7])*fRoot;out[1]=(m[6]-m[2])*fRoot;out[2]=(m[1]-m[3])*fRoot}else{var i=0;if(m[4]>m[0])i=1;if(m[8]>m[i*3+i])i=2;var j=(i+1)%3;var k=(i+2)%3;fRoot=Math.sqrt(m[i*3+i]-m[j*3+j]-m[k*3+k]+1);out[i]=.5*fRoot;fRoot=.5/fRoot;out[3]=(m[j*3+k]-m[k*3+j])*fRoot;out[j]=(m[j*3+i]+m[i*3+j])*fRoot;out[k]=(m[k*3+i]+m[i*3+k])*fRoot}return out};quat.str=function(a){return"quat("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"};quat.exactEquals=vec4.exactEquals;quat.equals=vec4.equals;module.exports=quat},{"./common.js":155,"./mat3.js":158,"./vec3.js":162,"./vec4.js":163}],161:[function(require,module,exports){var glMatrix=require("./common.js");var vec2={};vec2.create=function(){var out=new glMatrix.ARRAY_TYPE(2);out[0]=0;out[1]=0;return out};vec2.clone=function(a){var out=new glMatrix.ARRAY_TYPE(2);out[0]=a[0];out[1]=a[1];return out};vec2.fromValues=function(x,y){var out=new glMatrix.ARRAY_TYPE(2);out[0]=x;out[1]=y;return out};vec2.copy=function(out,a){out[0]=a[0];out[1]=a[1];return out};vec2.set=function(out,x,y){out[0]=x;out[1]=y;return out};vec2.add=function(out,a,b){out[0]=a[0]+b[0];out[1]=a[1]+b[1];return out};vec2.subtract=function(out,a,b){out[0]=a[0]-b[0];out[1]=a[1]-b[1];return out};vec2.sub=vec2.subtract;vec2.multiply=function(out,a,b){out[0]=a[0]*b[0];out[1]=a[1]*b[1];return out};vec2.mul=vec2.multiply;vec2.divide=function(out,a,b){out[0]=a[0]/b[0];out[1]=a[1]/b[1];return out};vec2.div=vec2.divide;vec2.ceil=function(out,a){out[0]=Math.ceil(a[0]);out[1]=Math.ceil(a[1]);return out};vec2.floor=function(out,a){out[0]=Math.floor(a[0]);out[1]=Math.floor(a[1]);return out};vec2.min=function(out,a,b){out[0]=Math.min(a[0],b[0]);out[1]=Math.min(a[1],b[1]);return out};vec2.max=function(out,a,b){out[0]=Math.max(a[0],b[0]);out[1]=Math.max(a[1],b[1]);return out};vec2.round=function(out,a){out[0]=Math.round(a[0]);out[1]=Math.round(a[1]);return out};vec2.scale=function(out,a,b){out[0]=a[0]*b;out[1]=a[1]*b;return out};vec2.scaleAndAdd=function(out,a,b,scale){out[0]=a[0]+b[0]*scale;out[1]=a[1]+b[1]*scale;return out};vec2.distance=function(a,b){var x=b[0]-a[0],y=b[1]-a[1];return Math.sqrt(x*x+y*y)};vec2.dist=vec2.distance;vec2.squaredDistance=function(a,b){var x=b[0]-a[0],y=b[1]-a[1];return x*x+y*y};vec2.sqrDist=vec2.squaredDistance;vec2.length=function(a){var x=a[0],y=a[1];return Math.sqrt(x*x+y*y)};vec2.len=vec2.length;vec2.squaredLength=function(a){var x=a[0],y=a[1];return x*x+y*y};vec2.sqrLen=vec2.squaredLength;vec2.negate=function(out,a){out[0]=-a[0];out[1]=-a[1];return out};vec2.inverse=function(out,a){out[0]=1/a[0];out[1]=1/a[1];return out};vec2.normalize=function(out,a){var x=a[0],y=a[1];
var len=x*x+y*y;if(len>0){len=1/Math.sqrt(len);out[0]=a[0]*len;out[1]=a[1]*len}return out};vec2.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]};vec2.cross=function(out,a,b){var z=a[0]*b[1]-a[1]*b[0];out[0]=out[1]=0;out[2]=z;return out};vec2.lerp=function(out,a,b,t){var ax=a[0],ay=a[1];out[0]=ax+t*(b[0]-ax);out[1]=ay+t*(b[1]-ay);return out};vec2.random=function(out,scale){scale=scale||1;var r=glMatrix.RANDOM()*2*Math.PI;out[0]=Math.cos(r)*scale;out[1]=Math.sin(r)*scale;return out};vec2.transformMat2=function(out,a,m){var x=a[0],y=a[1];out[0]=m[0]*x+m[2]*y;out[1]=m[1]*x+m[3]*y;return out};vec2.transformMat2d=function(out,a,m){var x=a[0],y=a[1];out[0]=m[0]*x+m[2]*y+m[4];out[1]=m[1]*x+m[3]*y+m[5];return out};vec2.transformMat3=function(out,a,m){var x=a[0],y=a[1];out[0]=m[0]*x+m[3]*y+m[6];out[1]=m[1]*x+m[4]*y+m[7];return out};vec2.transformMat4=function(out,a,m){var x=a[0],y=a[1];out[0]=m[0]*x+m[4]*y+m[12];out[1]=m[1]*x+m[5]*y+m[13];return out};vec2.forEach=function(){var vec=vec2.create();return function(a,stride,offset,count,fn,arg){var i,l;if(!stride){stride=2}if(!offset){offset=0}if(count){l=Math.min(count*stride+offset,a.length)}else{l=a.length}for(i=offset;i<l;i+=stride){vec[0]=a[i];vec[1]=a[i+1];fn(vec,vec,arg);a[i]=vec[0];a[i+1]=vec[1]}return a}}();vec2.str=function(a){return"vec2("+a[0]+", "+a[1]+")"};vec2.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]};vec2.equals=function(a,b){var a0=a[0],a1=a[1];var b0=b[0],b1=b[1];return Math.abs(a0-b0)<=glMatrix.EPSILON*Math.max(1,Math.abs(a0),Math.abs(b0))&&Math.abs(a1-b1)<=glMatrix.EPSILON*Math.max(1,Math.abs(a1),Math.abs(b1))};module.exports=vec2},{"./common.js":155}],162:[function(require,module,exports){var glMatrix=require("./common.js");var vec3={};vec3.create=function(){var out=new glMatrix.ARRAY_TYPE(3);out[0]=0;out[1]=0;out[2]=0;return out};vec3.clone=function(a){var out=new glMatrix.ARRAY_TYPE(3);out[0]=a[0];out[1]=a[1];out[2]=a[2];return out};vec3.fromValues=function(x,y,z){var out=new glMatrix.ARRAY_TYPE(3);out[0]=x;out[1]=y;out[2]=z;return out};vec3.copy=function(out,a){out[0]=a[0];out[1]=a[1];out[2]=a[2];return out};vec3.set=function(out,x,y,z){out[0]=x;out[1]=y;out[2]=z;return out};vec3.add=function(out,a,b){out[0]=a[0]+b[0];out[1]=a[1]+b[1];out[2]=a[2]+b[2];return out};vec3.subtract=function(out,a,b){out[0]=a[0]-b[0];out[1]=a[1]-b[1];out[2]=a[2]-b[2];return out};vec3.sub=vec3.subtract;vec3.multiply=function(out,a,b){out[0]=a[0]*b[0];out[1]=a[1]*b[1];out[2]=a[2]*b[2];return out};vec3.mul=vec3.multiply;vec3.divide=function(out,a,b){out[0]=a[0]/b[0];out[1]=a[1]/b[1];out[2]=a[2]/b[2];return out};vec3.div=vec3.divide;vec3.ceil=function(out,a){out[0]=Math.ceil(a[0]);out[1]=Math.ceil(a[1]);out[2]=Math.ceil(a[2]);return out};vec3.floor=function(out,a){out[0]=Math.floor(a[0]);out[1]=Math.floor(a[1]);out[2]=Math.floor(a[2]);return out};vec3.min=function(out,a,b){out[0]=Math.min(a[0],b[0]);out[1]=Math.min(a[1],b[1]);out[2]=Math.min(a[2],b[2]);return out};vec3.max=function(out,a,b){out[0]=Math.max(a[0],b[0]);out[1]=Math.max(a[1],b[1]);out[2]=Math.max(a[2],b[2]);return out};vec3.round=function(out,a){out[0]=Math.round(a[0]);out[1]=Math.round(a[1]);out[2]=Math.round(a[2]);return out};vec3.scale=function(out,a,b){out[0]=a[0]*b;out[1]=a[1]*b;out[2]=a[2]*b;return out};vec3.scaleAndAdd=function(out,a,b,scale){out[0]=a[0]+b[0]*scale;out[1]=a[1]+b[1]*scale;out[2]=a[2]+b[2]*scale;return out};vec3.distance=function(a,b){var x=b[0]-a[0],y=b[1]-a[1],z=b[2]-a[2];return Math.sqrt(x*x+y*y+z*z)};vec3.dist=vec3.distance;vec3.squaredDistance=function(a,b){var x=b[0]-a[0],y=b[1]-a[1],z=b[2]-a[2];return x*x+y*y+z*z};vec3.sqrDist=vec3.squaredDistance;vec3.length=function(a){var x=a[0],y=a[1],z=a[2];return Math.sqrt(x*x+y*y+z*z)};vec3.len=vec3.length;vec3.squaredLength=function(a){var x=a[0],y=a[1],z=a[2];return x*x+y*y+z*z};vec3.sqrLen=vec3.squaredLength;vec3.negate=function(out,a){out[0]=-a[0];out[1]=-a[1];out[2]=-a[2];return out};vec3.inverse=function(out,a){out[0]=1/a[0];out[1]=1/a[1];out[2]=1/a[2];return out};vec3.normalize=function(out,a){var x=a[0],y=a[1],z=a[2];var len=x*x+y*y+z*z;if(len>0){len=1/Math.sqrt(len);out[0]=a[0]*len;out[1]=a[1]*len;out[2]=a[2]*len}return out};vec3.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]};vec3.cross=function(out,a,b){var ax=a[0],ay=a[1],az=a[2],bx=b[0],by=b[1],bz=b[2];out[0]=ay*bz-az*by;out[1]=az*bx-ax*bz;out[2]=ax*by-ay*bx;return out};vec3.lerp=function(out,a,b,t){var ax=a[0],ay=a[1],az=a[2];out[0]=ax+t*(b[0]-ax);out[1]=ay+t*(b[1]-ay);out[2]=az+t*(b[2]-az);return out};vec3.hermite=function(out,a,b,c,d,t){var factorTimes2=t*t,factor1=factorTimes2*(2*t-3)+1,factor2=factorTimes2*(t-2)+t,factor3=factorTimes2*(t-1),factor4=factorTimes2*(3-2*t);out[0]=a[0]*factor1+b[0]*factor2+c[0]*factor3+d[0]*factor4;out[1]=a[1]*factor1+b[1]*factor2+c[1]*factor3+d[1]*factor4;out[2]=a[2]*factor1+b[2]*factor2+c[2]*factor3+d[2]*factor4;return out};vec3.bezier=function(out,a,b,c,d,t){var inverseFactor=1-t,inverseFactorTimesTwo=inverseFactor*inverseFactor,factorTimes2=t*t,factor1=inverseFactorTimesTwo*inverseFactor,factor2=3*t*inverseFactorTimesTwo,factor3=3*factorTimes2*inverseFactor,factor4=factorTimes2*t;out[0]=a[0]*factor1+b[0]*factor2+c[0]*factor3+d[0]*factor4;out[1]=a[1]*factor1+b[1]*factor2+c[1]*factor3+d[1]*factor4;out[2]=a[2]*factor1+b[2]*factor2+c[2]*factor3+d[2]*factor4;return out};vec3.random=function(out,scale){scale=scale||1;var r=glMatrix.RANDOM()*2*Math.PI;var z=glMatrix.RANDOM()*2-1;var zScale=Math.sqrt(1-z*z)*scale;out[0]=Math.cos(r)*zScale;out[1]=Math.sin(r)*zScale;out[2]=z*scale;return out};vec3.transformMat4=function(out,a,m){var x=a[0],y=a[1],z=a[2],w=m[3]*x+m[7]*y+m[11]*z+m[15];w=w||1;out[0]=(m[0]*x+m[4]*y+m[8]*z+m[12])/w;out[1]=(m[1]*x+m[5]*y+m[9]*z+m[13])/w;out[2]=(m[2]*x+m[6]*y+m[10]*z+m[14])/w;return out};vec3.transformMat3=function(out,a,m){var x=a[0],y=a[1],z=a[2];out[0]=x*m[0]+y*m[3]+z*m[6];out[1]=x*m[1]+y*m[4]+z*m[7];out[2]=x*m[2]+y*m[5]+z*m[8];return out};vec3.transformQuat=function(out,a,q){var x=a[0],y=a[1],z=a[2],qx=q[0],qy=q[1],qz=q[2],qw=q[3],ix=qw*x+qy*z-qz*y,iy=qw*y+qz*x-qx*z,iz=qw*z+qx*y-qy*x,iw=-qx*x-qy*y-qz*z;out[0]=ix*qw+iw*-qx+iy*-qz-iz*-qy;out[1]=iy*qw+iw*-qy+iz*-qx-ix*-qz;out[2]=iz*qw+iw*-qz+ix*-qy-iy*-qx;return out};vec3.rotateX=function(out,a,b,c){var p=[],r=[];p[0]=a[0]-b[0];p[1]=a[1]-b[1];p[2]=a[2]-b[2];r[0]=p[0];r[1]=p[1]*Math.cos(c)-p[2]*Math.sin(c);r[2]=p[1]*Math.sin(c)+p[2]*Math.cos(c);out[0]=r[0]+b[0];out[1]=r[1]+b[1];out[2]=r[2]+b[2];return out};vec3.rotateY=function(out,a,b,c){var p=[],r=[];p[0]=a[0]-b[0];p[1]=a[1]-b[1];p[2]=a[2]-b[2];r[0]=p[2]*Math.sin(c)+p[0]*Math.cos(c);r[1]=p[1];r[2]=p[2]*Math.cos(c)-p[0]*Math.sin(c);out[0]=r[0]+b[0];out[1]=r[1]+b[1];out[2]=r[2]+b[2];return out};vec3.rotateZ=function(out,a,b,c){var p=[],r=[];p[0]=a[0]-b[0];p[1]=a[1]-b[1];p[2]=a[2]-b[2];r[0]=p[0]*Math.cos(c)-p[1]*Math.sin(c);r[1]=p[0]*Math.sin(c)+p[1]*Math.cos(c);r[2]=p[2];out[0]=r[0]+b[0];out[1]=r[1]+b[1];out[2]=r[2]+b[2];return out};vec3.forEach=function(){var vec=vec3.create();return function(a,stride,offset,count,fn,arg){var i,l;if(!stride){stride=3}if(!offset){offset=0}if(count){l=Math.min(count*stride+offset,a.length)}else{l=a.length}for(i=offset;i<l;i+=stride){vec[0]=a[i];vec[1]=a[i+1];vec[2]=a[i+2];fn(vec,vec,arg);a[i]=vec[0];a[i+1]=vec[1];a[i+2]=vec[2]}return a}}();vec3.angle=function(a,b){var tempA=vec3.fromValues(a[0],a[1],a[2]);var tempB=vec3.fromValues(b[0],b[1],b[2]);vec3.normalize(tempA,tempA);vec3.normalize(tempB,tempB);var cosine=vec3.dot(tempA,tempB);if(cosine>1){return 0}else{return Math.acos(cosine)}};vec3.str=function(a){return"vec3("+a[0]+", "+a[1]+", "+a[2]+")"};vec3.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]};vec3.equals=function(a,b){var a0=a[0],a1=a[1],a2=a[2];var b0=b[0],b1=b[1],b2=b[2];return Math.abs(a0-b0)<=glMatrix.EPSILON*Math.max(1,Math.abs(a0),Math.abs(b0))&&Math.abs(a1-b1)<=glMatrix.EPSILON*Math.max(1,Math.abs(a1),Math.abs(b1))&&Math.abs(a2-b2)<=glMatrix.EPSILON*Math.max(1,Math.abs(a2),Math.abs(b2))};module.exports=vec3},{"./common.js":155}],163:[function(require,module,exports){var glMatrix=require("./common.js");var vec4={};vec4.create=function(){var out=new glMatrix.ARRAY_TYPE(4);out[0]=0;out[1]=0;out[2]=0;out[3]=0;return out};vec4.clone=function(a){var out=new glMatrix.ARRAY_TYPE(4);out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];return out};vec4.fromValues=function(x,y,z,w){var out=new glMatrix.ARRAY_TYPE(4);out[0]=x;out[1]=y;out[2]=z;out[3]=w;return out};vec4.copy=function(out,a){out[0]=a[0];out[1]=a[1];out[2]=a[2];out[3]=a[3];return out};vec4.set=function(out,x,y,z,w){out[0]=x;out[1]=y;out[2]=z;out[3]=w;return out};vec4.add=function(out,a,b){out[0]=a[0]+b[0];out[1]=a[1]+b[1];out[2]=a[2]+b[2];out[3]=a[3]+b[3];return out};vec4.subtract=function(out,a,b){out[0]=a[0]-b[0];out[1]=a[1]-b[1];out[2]=a[2]-b[2];out[3]=a[3]-b[3];return out};vec4.sub=vec4.subtract;vec4.multiply=function(out,a,b){out[0]=a[0]*b[0];out[1]=a[1]*b[1];out[2]=a[2]*b[2];out[3]=a[3]*b[3];return out};vec4.mul=vec4.multiply;vec4.divide=function(out,a,b){out[0]=a[0]/b[0];out[1]=a[1]/b[1];out[2]=a[2]/b[2];out[3]=a[3]/b[3];return out};vec4.div=vec4.divide;vec4.ceil=function(out,a){out[0]=Math.ceil(a[0]);out[1]=Math.ceil(a[1]);out[2]=Math.ceil(a[2]);out[3]=Math.ceil(a[3]);return out};vec4.floor=function(out,a){out[0]=Math.floor(a[0]);out[1]=Math.floor(a[1]);out[2]=Math.floor(a[2]);out[3]=Math.floor(a[3]);return out};vec4.min=function(out,a,b){out[0]=Math.min(a[0],b[0]);out[1]=Math.min(a[1],b[1]);out[2]=Math.min(a[2],b[2]);out[3]=Math.min(a[3],b[3]);return out};vec4.max=function(out,a,b){out[0]=Math.max(a[0],b[0]);out[1]=Math.max(a[1],b[1]);out[2]=Math.max(a[2],b[2]);out[3]=Math.max(a[3],b[3]);return out};vec4.round=function(out,a){out[0]=Math.round(a[0]);out[1]=Math.round(a[1]);out[2]=Math.round(a[2]);out[3]=Math.round(a[3]);return out};vec4.scale=function(out,a,b){out[0]=a[0]*b;out[1]=a[1]*b;out[2]=a[2]*b;out[3]=a[3]*b;return out};vec4.scaleAndAdd=function(out,a,b,scale){out[0]=a[0]+b[0]*scale;out[1]=a[1]+b[1]*scale;out[2]=a[2]+b[2]*scale;out[3]=a[3]+b[3]*scale;return out};vec4.distance=function(a,b){var x=b[0]-a[0],y=b[1]-a[1],z=b[2]-a[2],w=b[3]-a[3];return Math.sqrt(x*x+y*y+z*z+w*w)};vec4.dist=vec4.distance;vec4.squaredDistance=function(a,b){var x=b[0]-a[0],y=b[1]-a[1],z=b[2]-a[2],w=b[3]-a[3];return x*x+y*y+z*z+w*w};vec4.sqrDist=vec4.squaredDistance;vec4.length=function(a){var x=a[0],y=a[1],z=a[2],w=a[3];return Math.sqrt(x*x+y*y+z*z+w*w)};vec4.len=vec4.length;vec4.squaredLength=function(a){var x=a[0],y=a[1],z=a[2],w=a[3];return x*x+y*y+z*z+w*w};vec4.sqrLen=vec4.squaredLength;vec4.negate=function(out,a){out[0]=-a[0];out[1]=-a[1];out[2]=-a[2];out[3]=-a[3];return out};vec4.inverse=function(out,a){out[0]=1/a[0];out[1]=1/a[1];out[2]=1/a[2];out[3]=1/a[3];return out};vec4.normalize=function(out,a){var x=a[0],y=a[1],z=a[2],w=a[3];var len=x*x+y*y+z*z+w*w;if(len>0){len=1/Math.sqrt(len);out[0]=x*len;out[1]=y*len;out[2]=z*len;out[3]=w*len}return out};vec4.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]};vec4.lerp=function(out,a,b,t){var ax=a[0],ay=a[1],az=a[2],aw=a[3];out[0]=ax+t*(b[0]-ax);out[1]=ay+t*(b[1]-ay);out[2]=az+t*(b[2]-az);out[3]=aw+t*(b[3]-aw);return out};vec4.random=function(out,scale){scale=scale||1;out[0]=glMatrix.RANDOM();out[1]=glMatrix.RANDOM();out[2]=glMatrix.RANDOM();out[3]=glMatrix.RANDOM();vec4.normalize(out,out);vec4.scale(out,out,scale);return out};vec4.transformMat4=function(out,a,m){var x=a[0],y=a[1],z=a[2],w=a[3];out[0]=m[0]*x+m[4]*y+m[8]*z+m[12]*w;out[1]=m[1]*x+m[5]*y+m[9]*z+m[13]*w;out[2]=m[2]*x+m[6]*y+m[10]*z+m[14]*w;out[3]=m[3]*x+m[7]*y+m[11]*z+m[15]*w;return out};vec4.transformQuat=function(out,a,q){var x=a[0],y=a[1],z=a[2],qx=q[0],qy=q[1],qz=q[2],qw=q[3],ix=qw*x+qy*z-qz*y,iy=qw*y+qz*x-qx*z,iz=qw*z+qx*y-qy*x,iw=-qx*x-qy*y-qz*z;out[0]=ix*qw+iw*-qx+iy*-qz-iz*-qy;out[1]=iy*qw+iw*-qy+iz*-qx-ix*-qz;out[2]=iz*qw+iw*-qz+ix*-qy-iy*-qx;out[3]=a[3];return out};vec4.forEach=function(){var vec=vec4.create();return function(a,stride,offset,count,fn,arg){var i,l;if(!stride){stride=4}if(!offset){offset=0}if(count){l=Math.min(count*stride+offset,a.length)}else{l=a.length}for(i=offset;i<l;i+=stride){vec[0]=a[i];vec[1]=a[i+1];vec[2]=a[i+2];vec[3]=a[i+3];fn(vec,vec,arg);a[i]=vec[0];a[i+1]=vec[1];a[i+2]=vec[2];a[i+3]=vec[3]}return a}}();vec4.str=function(a){return"vec4("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"};vec4.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]};vec4.equals=function(a,b){var a0=a[0],a1=a[1],a2=a[2],a3=a[3];var b0=b[0],b1=b[1],b2=b[2],b3=b[3];return Math.abs(a0-b0)<=glMatrix.EPSILON*Math.max(1,Math.abs(a0),Math.abs(b0))&&Math.abs(a1-b1)<=glMatrix.EPSILON*Math.max(1,Math.abs(a1),Math.abs(b1))&&Math.abs(a2-b2)<=glMatrix.EPSILON*Math.max(1,Math.abs(a2),Math.abs(b2))&&Math.abs(a3-b3)<=glMatrix.EPSILON*Math.max(1,Math.abs(a3),Math.abs(b3))};module.exports=vec4},{"./common.js":155}],164:[function(require,module,exports){"use strict";module.exports=GridIndex;var NUM_PARAMS=3;function GridIndex(extent,n,padding){var cells=this.cells=[];if(extent instanceof ArrayBuffer){this.arrayBuffer=extent;var array=new Int32Array(this.arrayBuffer);extent=array[0];n=array[1];padding=array[2];this.d=n+2*padding;for(var k=0;k<this.d*this.d;k++){var start=array[NUM_PARAMS+k];var end=array[NUM_PARAMS+k+1];cells.push(start===end?null:array.subarray(start,end))}var keysOffset=array[NUM_PARAMS+cells.length];var bboxesOffset=array[NUM_PARAMS+cells.length+1];this.keys=array.subarray(keysOffset,bboxesOffset);this.bboxes=array.subarray(bboxesOffset);this.insert=this._insertReadonly}else{this.d=n+2*padding;for(var i=0;i<this.d*this.d;i++){cells.push([])}this.keys=[];this.bboxes=[]}this.n=n;this.extent=extent;this.padding=padding;this.scale=n/extent;this.uid=0;var p=padding/n*extent;this.min=-p;this.max=extent+p}GridIndex.prototype.insert=function(key,x1,y1,x2,y2){this._forEachCell(x1,y1,x2,y2,this._insertCell,this.uid++);this.keys.push(key);this.bboxes.push(x1);this.bboxes.push(y1);this.bboxes.push(x2);this.bboxes.push(y2)};GridIndex.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."};GridIndex.prototype._insertCell=function(x1,y1,x2,y2,cellIndex,uid){this.cells[cellIndex].push(uid)};GridIndex.prototype.query=function(x1,y1,x2,y2){var min=this.min;var max=this.max;if(x1<=min&&y1<=min&&max<=x2&&max<=y2){return Array.prototype.slice.call(this.keys)}else{var result=[];var seenUids={};this._forEachCell(x1,y1,x2,y2,this._queryCell,result,seenUids);return result}};GridIndex.prototype._queryCell=function(x1,y1,x2,y2,cellIndex,result,seenUids){var cell=this.cells[cellIndex];if(cell!==null){var keys=this.keys;var bboxes=this.bboxes;for(var u=0;u<cell.length;u++){var uid=cell[u];if(seenUids[uid]===undefined){var offset=uid*4;if(x1<=bboxes[offset+2]&&y1<=bboxes[offset+3]&&x2>=bboxes[offset+0]&&y2>=bboxes[offset+1]){seenUids[uid]=true;result.push(keys[uid])}else{seenUids[uid]=false}}}}};GridIndex.prototype._forEachCell=function(x1,y1,x2,y2,fn,arg1,arg2){var cx1=this._convertToCellCoord(x1);var cy1=this._convertToCellCoord(y1);var cx2=this._convertToCellCoord(x2);var cy2=this._convertToCellCoord(y2);for(var x=cx1;x<=cx2;x++){for(var y=cy1;y<=cy2;y++){var cellIndex=this.d*y+x;if(fn.call(this,x1,y1,x2,y2,cellIndex,arg1,arg2))return}}};GridIndex.prototype._convertToCellCoord=function(x){return Math.max(0,Math.min(this.d-1,Math.floor(x*this.scale)+this.padding))};GridIndex.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;var cells=this.cells;var metadataLength=NUM_PARAMS+this.cells.length+1+1;var totalCellLength=0;for(var i=0;i<this.cells.length;i++){totalCellLength+=this.cells[i].length}var array=new Int32Array(metadataLength+totalCellLength+this.keys.length+this.bboxes.length);array[0]=this.extent;array[1]=this.n;array[2]=this.padding;var offset=metadataLength;for(var k=0;k<cells.length;k++){var cell=cells[k];array[NUM_PARAMS+k]=offset;array.set(cell,offset);offset+=cell.length}array[NUM_PARAMS+cells.length]=offset;array.set(this.keys,offset);offset+=this.keys.length;array[NUM_PARAMS+cells.length+1]=offset;array.set(this.bboxes,offset);offset+=this.bboxes.length;return array.buffer}},{}],165:[function(require,module,exports){var Kn=18,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;function xyz2lab(t){return t>t3?Math.pow(t,1/3):t/t2+t0}function lab2xyz(t){return t>t1?t*t*t:t2*(t-t0)}function xyz2rgb(x){return 255*(x<=.0031308?12.92*x:1.055*Math.pow(x,1/2.4)-.055)}function rgb2xyz(x){return(x/=255)<=.04045?x/12.92:Math.pow((x+.055)/1.055,2.4)}function rgbToLab(rgbColor){var b=rgb2xyz(rgbColor[0]),a=rgb2xyz(rgbColor[1]),l=rgb2xyz(rgbColor[2]),x=xyz2lab((.4124564*b+.3575761*a+.1804375*l)/Xn),y=xyz2lab((.2126729*b+.7151522*a+.072175*l)/Yn),z=xyz2lab((.0193339*b+.119192*a+.9503041*l)/Zn);return[116*y-16,500*(x-y),200*(y-z),rgbColor[3]]}function labToRgb(labColor){var y=(labColor[0]+16)/116,x=isNaN(labColor[1])?y:y+labColor[1]/500,z=isNaN(labColor[2])?y:y-labColor[2]/200;y=Yn*lab2xyz(y);x=Xn*lab2xyz(x);z=Zn*lab2xyz(z);return[xyz2rgb(3.2404542*x-1.5371385*y-.4985314*z),xyz2rgb(-.969266*x+1.8760108*y+.041556*z),xyz2rgb(.0556434*x-.2040259*y+1.0572252*z),labColor[3]]}function rgbToHcl(rgbColor){var labColor=rgbToLab(rgbColor);var l=labColor[0],a=labColor[1],b=labColor[2];var h=Math.atan2(b,a)*rad2deg;return[h<0?h+360:h,Math.sqrt(a*a+b*b),l,rgbColor[3]]}function hclToRgb(hclColor){var h=hclColor[0]*deg2rad,c=hclColor[1],l=hclColor[2];return labToRgb([l,Math.cos(h)*c,Math.sin(h)*c,hclColor[3]])}module.exports={lab:{forward:rgbToLab,reverse:labToRgb},hcl:{forward:rgbToHcl,reverse:hclToRgb}}},{}],166:[function(require,module,exports){"use strict";var colorSpaces=require("./color_spaces");function identityFunction(x){return x}function createFunction(parameters,defaultType){var fun;if(!isFunctionDefinition(parameters)){fun=function(){return parameters};fun.isFeatureConstant=true;fun.isZoomConstant=true}else{var zoomAndFeatureDependent=parameters.stops&&typeof parameters.stops[0][0]==="object";var featureDependent=zoomAndFeatureDependent||parameters.property!==undefined;var zoomDependent=zoomAndFeatureDependent||!featureDependent;var type=parameters.type||defaultType||"exponential";var innerFun;if(type==="exponential"){innerFun=evaluateExponentialFunction}else if(type==="interval"){innerFun=evaluateIntervalFunction}else if(type==="categorical"){innerFun=evaluateCategoricalFunction}else if(type==="identity"){innerFun=evaluateIdentityFunction}else{throw new Error('Unknown function type "'+type+'"')}var outputFunction;if(parameters.colorSpace&&parameters.colorSpace!=="rgb"){if(colorSpaces[parameters.colorSpace]){var colorspace=colorSpaces[parameters.colorSpace];parameters=JSON.parse(JSON.stringify(parameters));for(var s=0;s<parameters.stops.length;s++){parameters.stops[s]=[parameters.stops[s][0],colorspace.forward(parameters.stops[s][1])]}outputFunction=colorspace.reverse}else{throw new Error("Unknown color space: "+parameters.colorSpace)}}else{outputFunction=identityFunction}if(zoomAndFeatureDependent){var featureFunctions={};var featureFunctionStops=[];for(s=0;s<parameters.stops.length;s++){var stop=parameters.stops[s];if(featureFunctions[stop[0].zoom]===undefined){featureFunctions[stop[0].zoom]={zoom:stop[0].zoom,type:parameters.type,property:parameters.property,stops:[]}}featureFunctions[stop[0].zoom].stops.push([stop[0].value,stop[1]])}for(var z in featureFunctions){featureFunctionStops.push([featureFunctions[z].zoom,createFunction(featureFunctions[z])])}fun=function(zoom,feature){return outputFunction(evaluateExponentialFunction({stops:featureFunctionStops,base:parameters.base},zoom)(zoom,feature))};fun.isFeatureConstant=false;fun.isZoomConstant=false}else if(zoomDependent){fun=function(zoom){return outputFunction(innerFun(parameters,zoom))};fun.isFeatureConstant=true;fun.isZoomConstant=false}else{fun=function(zoom,feature){return outputFunction(innerFun(parameters,feature[parameters.property]))};fun.isFeatureConstant=false;fun.isZoomConstant=true}}return fun}function evaluateCategoricalFunction(parameters,input){for(var i=0;i<parameters.stops.length;i++){if(input===parameters.stops[i][0]){return parameters.stops[i][1]}}return parameters.stops[0][1]}function evaluateIntervalFunction(parameters,input){for(var i=0;i<parameters.stops.length;i++){if(input<parameters.stops[i][0])break}return parameters.stops[Math.max(i-1,0)][1]}function evaluateExponentialFunction(parameters,input){var base=parameters.base!==undefined?parameters.base:1;var i=0;while(true){if(i>=parameters.stops.length)break;else if(input<=parameters.stops[i][0])break;else i++}if(i===0){return parameters.stops[i][1]}else if(i===parameters.stops.length){return parameters.stops[i-1][1]}else{return interpolate(input,base,parameters.stops[i-1][0],parameters.stops[i][0],parameters.stops[i-1][1],parameters.stops[i][1])}}function evaluateIdentityFunction(parameters,input){return input}function interpolate(input,base,inputLower,inputUpper,outputLower,outputUpper){if(typeof outputLower==="function"){return function(){var evaluatedLower=outputLower.apply(undefined,arguments);var evaluatedUpper=outputUpper.apply(undefined,arguments);return interpolate(input,base,inputLower,inputUpper,evaluatedLower,evaluatedUpper)}}else if(outputLower.length){return interpolateArray(input,base,inputLower,inputUpper,outputLower,outputUpper)}else{return interpolateNumber(input,base,inputLower,inputUpper,outputLower,outputUpper)}}function interpolateNumber(input,base,inputLower,inputUpper,outputLower,outputUpper){var difference=inputUpper-inputLower;var progress=input-inputLower;var ratio;if(base===1){ratio=progress/difference}else{ratio=(Math.pow(base,progress)-1)/(Math.pow(base,difference)-1)}return outputLower*(1-ratio)+outputUpper*ratio}function interpolateArray(input,base,inputLower,inputUpper,outputLower,outputUpper){var output=[];for(var i=0;i<outputLower.length;i++){output[i]=interpolateNumber(input,base,inputLower,inputUpper,outputLower[i],outputUpper[i])}return output}function isFunctionDefinition(value){return typeof value==="object"&&(value.stops||value.type==="identity")}module.exports.isFunctionDefinition=isFunctionDefinition;module.exports.interpolated=function(parameters){return createFunction(parameters,"exponential")};module.exports["piecewise-constant"]=function(parameters){return createFunction(parameters,"interval")}},{"./color_spaces":165}],167:[function(require,module,exports){var path=require("path");module.exports={circle:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n#pragma mapbox: define lowp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_extrude;\nvarying lowp float v_antialiasblur;\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n\n float t = smoothstep(1.0 - max(blur, v_antialiasblur), 1.0, length(v_extrude));\n gl_FragColor = color * (1.0 - t) * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform mat4 u_matrix;\nuniform bool u_scale_with_map;\nuniform vec2 u_extrude_scale;\nuniform float u_devicepixelratio;\n\nattribute vec2 a_pos;\n\n#pragma mapbox: define lowp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_extrude;\nvarying lowp float v_antialiasblur;\n\nvoid main(void) {\n #pragma mapbox: initialize lowp vec4 color\n #pragma mapbox: initialize mediump float radius\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n\n // unencode the extrusion vector that we snuck into the a_pos vector\n v_extrude = vec2(mod(a_pos, 2.0) * 2.0 - 1.0);\n\n vec2 extrude = v_extrude * radius * u_extrude_scale;\n // multiply a_pos by 0.5, since we had it * 2 in order to sneak\n // in extrusion data\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5), 0, 1);\n\n if (u_scale_with_map) {\n gl_Position.xy += extrude;\n } else {\n gl_Position.xy += extrude * gl_Position.w;\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 v_antialiasblur = 1.0 / u_devicepixelratio / radius;\n}\n"},collisionBox:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_zoom;\nuniform float u_maxzoom;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n\n float alpha = 0.5;\n\n gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0) * alpha;\n\n if (v_placement_zoom > u_zoom) {\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0) * alpha;\n }\n\n if (u_zoom >= v_max_zoom) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0) * alpha * 0.25;\n }\n\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:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_data;\n\nuniform mat4 u_matrix;\nuniform float u_scale;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos + a_extrude / u_scale, 0.0, 1.0);\n\n v_max_zoom = a_data.x;\n v_placement_zoom = a_data.y;\n}\n"},debug:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform lowp vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, step(32767.0, a_pos.x), 1);\n}\n"},fill:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n#pragma mapbox: define lowp vec4 color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp 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:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\n#pragma mapbox: define lowp vec4 color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n"},fillOutline:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n#pragma mapbox: define lowp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_pos;\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.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:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\n#pragma mapbox: define lowp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp 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:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity;\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 float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, 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_pattern_br_b, 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 = smoothstep(1.0, 0.0, dist);\n \n\n gl_FragColor = mix(color1, color2, u_mix) * alpha * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\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\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n vec2 scaled_size_a = u_scale_a * u_pattern_size_a;\n vec2 scaled_size_b = u_scale_b * u_pattern_size_b;\n\n // the correct offset needs to be calculated.\n //\n // The offset depends on how many pixels are between the world origin and\n // 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\n // and the edge of the tile. The glsl spec only guarantees 16 bits of\n // 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:\n vec2 offset_a = mod(mod(mod(u_pixel_coord_upper, scaled_size_a) * 256.0, scaled_size_a) * 256.0 + u_pixel_coord_lower, scaled_size_a);\n vec2 offset_b = mod(mod(mod(u_pixel_coord_upper, scaled_size_b) * 256.0, scaled_size_b) * 256.0 + u_pixel_coord_lower, scaled_size_b);\n\n v_pos_a = (u_tile_units_to_pixels * a_pos + offset_a) / scaled_size_a;\n v_pos_b = (u_tile_units_to_pixels * a_pos + offset_b) / scaled_size_b;\n\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},fillPattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity;\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 float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, 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_pattern_br_b, 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:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform 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 vec2 scaled_size_a = u_scale_a * u_pattern_size_a;\n vec2 scaled_size_b = u_scale_b * u_pattern_size_b;\n\n // the correct offset needs to be calculated.\n //\n // The offset depends on how many pixels are between the world origin and\n // 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\n // and the edge of the tile. The glsl spec only guarantees 16 bits of\n // 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:\n vec2 offset_a = mod(mod(mod(u_pixel_coord_upper, scaled_size_a) * 256.0, scaled_size_a) * 256.0 + u_pixel_coord_lower, scaled_size_a);\n vec2 offset_b = mod(mod(mod(u_pixel_coord_upper, scaled_size_b) * 256.0, scaled_size_b) * 256.0 + u_pixel_coord_lower, scaled_size_b);\n\n v_pos_a = (u_tile_units_to_pixels * a_pos + offset_a) / scaled_size_a;\n v_pos_b = (u_tile_units_to_pixels * a_pos + offset_b) / scaled_size_b;\n}\n"},fillExtrude:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nvarying vec4 v_color;\n#ifdef MAPBOX_GL_JS\n#pragma mapbox: define lowp float minH\n#pragma mapbox: define lowp float maxH\n#endif\n#pragma mapbox: define lowp vec4 color\n\nvoid main() {\n#ifdef MAPBOX_GL_JS\n #pragma mapbox: initialize lowp float minH\n #pragma mapbox: initialize lowp float maxH\n#endif\n #pragma mapbox: initialize lowp vec4 color\n\n gl_FragColor = v_color;\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform mat4 u_matrix;\nuniform vec3 u_lightcolor;\nuniform lowp vec3 u_lightpos;\nuniform lowp float u_lightintensity;\nuniform lowp vec4 u_outline_color;\n\nattribute vec2 a_pos;\nattribute vec3 a_normal;\nattribute float a_edgedistance;\n\nvarying vec4 v_color;\n\n#ifndef MAPBOX_GL_JS\nattribute float minH;\nattribute float maxH;\n#else\n#pragma mapbox: define lowp float minH\n#pragma mapbox: define lowp float maxH\n#endif\n\n#pragma mapbox: define lowp vec4 color\n\nvoid main() {\n#ifdef MAPBOX_GL_JS\n #pragma mapbox: initialize lowp float minH\n #pragma mapbox: initialize lowp float maxH\n#endif\n #pragma mapbox: initialize lowp vec4 color\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 ? maxH : minH, 1);\n\n#ifdef OUTLINE\n color = u_outline_color;\n#endif\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 + minH) * pow(maxH / 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"},fillExtrudePattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\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 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#ifdef MAPBOX_GL_JS\n#pragma mapbox: define lowp float minH\n#pragma mapbox: define lowp float maxH\n#endif\n#pragma mapbox: define lowp vec4 color\n\nvoid main() {\n#ifdef MAPBOX_GL_JS\n #pragma mapbox: initialize lowp float minH\n #pragma mapbox: initialize lowp float maxH\n#endif\n #pragma mapbox: initialize lowp vec4 color\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, 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_pattern_br_b, 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:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform 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#ifndef MAPBOX_GL_JS\nattribute float minH;\nattribute float maxH;\n#else\n#pragma mapbox: define lowp float minH\n#pragma mapbox: define lowp float maxH\n#endif\n\n#pragma mapbox: define lowp vec4 color\n\nvoid main() {\n#ifdef MAPBOX_GL_JS\n #pragma mapbox: initialize lowp float minH\n #pragma mapbox: initialize lowp float maxH\n#endif\n #pragma mapbox: initialize lowp vec4 color\n\n float t = mod(a_normal.x, 2.0);\n float z = t > 0.0 ? maxH : minH;\n\n gl_Position = u_matrix * vec4(a_pos, z, 1);\n\n vec2 scaled_size_a = u_scale_a * u_pattern_size_a;\n vec2 scaled_size_b = u_scale_b * u_pattern_size_b;\n\n // the following offset calculation is duplicated from the regular pattern shader:\n vec2 offset_a = mod(mod(mod(u_pixel_coord_upper, scaled_size_a) * 256.0, scaled_size_a) * 256.0 + u_pixel_coord_lower, scaled_size_a);\n vec2 offset_b = mod(mod(mod(u_pixel_coord_upper, scaled_size_b) * 256.0, scaled_size_b) * 256.0 + u_pixel_coord_lower, scaled_size_b);\n\n if (a_normal.x == 1.0 && a_normal.y == 0.0 && a_normal.z == 16384.0) {\n // extrusion top\n v_pos_a = (u_tile_units_to_pixels * a_pos + offset_a) / scaled_size_a;\n v_pos_b = (u_tile_units_to_pixels * a_pos + offset_b) / scaled_size_b;\n } else {\n // extrusion side\n float hf = z * u_height_factor;\n\n v_pos_a = (u_tile_units_to_pixels * vec2(a_edgedistance, hf) + offset_a) / scaled_size_a;\n v_pos_b = (u_tile_units_to_pixels * vec2(a_edgedistance, hf) + offset_b) / scaled_size_b;\n }\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 + minH) * pow(maxH / 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"},fillExtrudeTexture:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform sampler2D u_texture;\nuniform float u_opacity;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_FragColor = texture2D(u_texture, v_pos) * u_opacity;\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform mat4 u_matrix;\nuniform int u_xdim;\nuniform int u_ydim;\nattribute vec2 a_pos;\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n\n v_pos.x = a_pos.x / float(u_xdim);\n v_pos.y = 1.0 - a_pos.y / float(u_ydim);\n}\n"},line:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform lowp float u_opacity;\nuniform float u_blur;\n\n#pragma mapbox: define lowp vec4 color\n\nvarying vec2 v_linewidth;\nvarying vec2 v_normal;\nvarying float v_gamma_scale;\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 color\n\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n gl_FragColor = color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\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 vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform mediump float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\nuniform mediump float u_blur;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define lowp vec4 color\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 color\n\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_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 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},linePattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_blur;\n\nuniform 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 float u_fade;\nuniform float u_opacity;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 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_linewidth.s / u_pattern_size_a.y);\n float y_b = 0.5 + (v_normal.y * v_linewidth.s / u_pattern_size_b.y);\n vec2 pos_a = mix(u_pattern_tl_a, u_pattern_br_a, vec2(x_a, y_a));\n vec2 pos_b = mix(u_pattern_tl_b, u_pattern_br_b, vec2(x_b, y_b));\n\n vec4 color = mix(texture2D(u_image, pos_a), texture2D(u_image, pos_b), u_fade);\n\n alpha *= u_opacity;\n\n gl_FragColor = color * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\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\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\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform mediump float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\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 // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_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 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n v_linesofar = a_linesofar;\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},lineSDF:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform lowp float u_opacity;\n\nuniform float u_blur;\nuniform sampler2D u_image;\nuniform float u_sdfgamma;\nuniform float u_mix;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define lowp vec4 color\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 color\n\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 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, 0.5 + u_sdfgamma, sdfdist);\n\n gl_FragColor = color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\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\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\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform vec2 u_patternscale_a;\nuniform float u_tex_y_a;\nuniform vec2 u_patternscale_b;\nuniform float u_tex_y_b;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define lowp vec4 color\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 color\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 // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_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 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n\n v_tex_a = vec2(a_linesofar * u_patternscale_a.x, normal.y * u_patternscale_a.y + u_tex_y_a);\n v_tex_b = vec2(a_linesofar * u_patternscale_b.x, normal.y * u_patternscale_b.y + u_tex_y_b);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},raster:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity0;\nuniform float u_opacity1;\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 vec4 color = color0 * u_opacity0 + color1 * u_opacity1;\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);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform 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 v_pos0 = (((a_texture_pos / 32767.0) - 0.5) / u_buffer_scale ) + 0.5;\n v_pos1 = (v_pos0 * u_scale_parent) + u_tl_parent;\n}\n"},symbolIcon:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp float u_opacity;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n lowp float alpha = texture2D(u_fadetexture, v_fade_tex).a * u_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:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec2 a_texture_pos;\nattribute vec4 a_data;\n\n\n// matrix is for the vertex position.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_rotate_with_map;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n vec2 a_tex = a_texture_pos.xy;\n mediump float a_labelminzoom = a_data[0];\n mediump vec2 a_zoom = a_data.pq;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n if (u_rotate_with_map) {\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n } else {\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n"},symbolSDF:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform lowp float u_buffer;\nuniform lowp float u_gamma;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n lowp float dist = texture2D(u_texture, v_tex).a;\n lowp float fade_alpha = texture2D(u_fadetexture, v_fade_tex).a;\n lowp float gamma = u_gamma * v_gamma_scale;\n lowp float alpha = smoothstep(u_buffer - gamma, u_buffer + gamma, dist) * fade_alpha;\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nconst float PI = 3.141592653589793;\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec2 a_texture_pos;\nattribute vec4 a_data;\n\n\n// matrix is for the vertex position.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_rotate_with_map;\nuniform bool u_pitch_with_map;\nuniform mediump float u_pitch;\nuniform mediump float u_bearing;\nuniform mediump float u_aspect_ratio;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_tex = a_texture_pos.xy;\n mediump float a_labelminzoom = a_data[0];\n mediump vec2 a_zoom = a_data.pq;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n // pitch-alignment: map\n // rotation-alignment: map | viewport\n if (u_pitch_with_map) {\n lowp float angle = u_rotate_with_map ? (a_data[1] / 256.0 * 2.0 * PI) : u_bearing;\n lowp float asin = sin(angle);\n lowp float acos = cos(angle);\n mat2 RotationMatrix = mat2(acos, asin, -1.0 * asin, acos);\n vec2 offset = RotationMatrix * a_offset;\n vec2 extrude = u_extrude_scale * (offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n // pitch-alignment: viewport\n // rotation-alignment: map\n } else if (u_rotate_with_map) {\n // foreshortening factor to apply on pitched maps\n // as a label goes from horizontal <=> vertical in angle\n // it goes from 0% foreshortening to up to around 70% foreshortening\n lowp float pitchfactor = 1.0 - cos(u_pitch * sin(u_pitch * 0.75));\n\n lowp float lineangle = a_data[1] / 256.0 * 2.0 * PI;\n\n // use the lineangle to position points a,b along the line\n // project the points and calculate the label angle in projected space\n // this calculation allows labels to be rendered unskewed on pitched maps\n vec4 a = u_matrix * vec4(a_pos, 0, 1);\n vec4 b = u_matrix * vec4(a_pos + vec2(cos(lineangle),sin(lineangle)), 0, 1);\n lowp float angle = atan((b[1]/b[3] - a[1]/a[3])/u_aspect_ratio, b[0]/b[3] - a[0]/a[3]);\n lowp float asin = sin(angle);\n lowp float acos = cos(angle);\n mat2 RotationMatrix = mat2(acos, -1.0 * asin, asin, acos);\n\n vec2 offset = RotationMatrix * (vec2((1.0-pitchfactor)+(pitchfactor*cos(angle*2.0)), 1.0) * a_offset);\n vec2 extrude = u_extrude_scale * (offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n gl_Position.z += z * gl_Position.w;\n // pitch-alignment: viewport\n // rotation-alignment: viewport\n } else {\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_gamma_scale = (gl_Position.w - 0.5);\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n"}};module.exports.util="float evaluate_zoom_function_1(const vec4 values, const float t) {\n if (t < 1.0) {\n return mix(values[0], values[1], t);\n } else if (t < 2.0) {\n return mix(values[1], values[2], t - 1.0);\n } else {\n return mix(values[2], values[3], t - 2.0);\n }\n}\nvec4 evaluate_zoom_function_4(const vec4 value0, const vec4 value1, const vec4 value2, const vec4 value3, const float t) {\n if (t < 1.0) {\n return mix(value0, value1, t);\n } else if (t < 2.0) {\n return mix(value1, value2, t - 1.0);\n } else {\n return mix(value2, value3, t - 2.0);\n }\n}\n"},{path:1}],168:[function(require,module,exports){"use strict";var format=require("util").format;function ValidationError(key,value){this.message=(key?key+": ":"")+format.apply(format,Array.prototype.slice.call(arguments,2));if(value!==null&&value!==undefined&&value.__line__){this.line=value.__line__}}module.exports=ValidationError},{util:11
}],169:[function(require,module,exports){"use strict";module.exports=function(output){for(var i=1;i<arguments.length;i++){var input=arguments[i];for(var k in input){output[k]=input[k]}}return output}},{}],170:[function(require,module,exports){"use strict";module.exports=function getType(val){if(val instanceof Number){return"number"}else if(val instanceof String){return"string"}else if(val instanceof Boolean){return"boolean"}else if(Array.isArray(val)){return"array"}else if(val===null){return"null"}else{return typeof val}}},{}],171:[function(require,module,exports){"use strict";module.exports=function unbundle(value){if(value instanceof Number||value instanceof String||value instanceof Boolean){return value.valueOf()}else{return value}}},{}],172:[function(require,module,exports){"use strict";var ValidationError=require("../error/validation_error");var getType=require("../util/get_type");var extend=require("../util/extend");module.exports=function validate(options){var validateFunction=require("./validate_function");var validateObject=require("./validate_object");var VALIDATORS={"*":function(){return[]},array:require("./validate_array"),boolean:require("./validate_boolean"),number:require("./validate_number"),color:require("./validate_color"),constants:require("./validate_constants"),enum:require("./validate_enum"),filter:require("./validate_filter"),function:require("./validate_function"),layer:require("./validate_layer"),object:require("./validate_object"),source:require("./validate_source"),string:require("./validate_string")};var value=options.value;var valueSpec=options.valueSpec;var key=options.key;var styleSpec=options.styleSpec;var style=options.style;if(getType(value)==="string"&&value[0]==="@"){if(styleSpec.$version>7){return[new ValidationError(key,value,"constants have been deprecated as of v8")]}if(!(value in style.constants)){return[new ValidationError(key,value,'constant "%s" not found',value)]}options=extend({},options,{value:style.constants[value]})}if(valueSpec.function&&getType(value)==="object"){return validateFunction(options)}else if(valueSpec.type&&VALIDATORS[valueSpec.type]){return VALIDATORS[valueSpec.type](options)}else{return validateObject(extend({},options,{valueSpec:valueSpec.type?styleSpec[valueSpec.type]:valueSpec}))}}},{"../error/validation_error":168,"../util/extend":169,"../util/get_type":170,"./validate_array":173,"./validate_boolean":174,"./validate_color":175,"./validate_constants":176,"./validate_enum":177,"./validate_filter":178,"./validate_function":179,"./validate_layer":181,"./validate_number":184,"./validate_object":185,"./validate_source":187,"./validate_string":188}],173:[function(require,module,exports){"use strict";var getType=require("../util/get_type");var validate=require("./validate");var ValidationError=require("../error/validation_error");module.exports=function validateArray(options){var array=options.value;var arraySpec=options.valueSpec;var style=options.style;var styleSpec=options.styleSpec;var key=options.key;var validateArrayElement=options.arrayElementValidator||validate;if(getType(array)!=="array"){return[new ValidationError(key,array,"array expected, %s found",getType(array))]}if(arraySpec.length&&array.length!==arraySpec.length){return[new ValidationError(key,array,"array length %d expected, length %d found",arraySpec.length,array.length)]}if(arraySpec["min-length"]&&array.length<arraySpec["min-length"]){return[new ValidationError(key,array,"array length at least %d expected, length %d found",arraySpec["min-length"],array.length)]}var arrayElementSpec={type:arraySpec.value};if(styleSpec.$version<7){arrayElementSpec.function=arraySpec.function}if(getType(arraySpec.value)==="object"){arrayElementSpec=arraySpec.value}var errors=[];for(var i=0;i<array.length;i++){errors=errors.concat(validateArrayElement({array:array,arrayIndex:i,value:array[i],valueSpec:arrayElementSpec,style:style,styleSpec:styleSpec,key:key+"["+i+"]"}))}return errors}},{"../error/validation_error":168,"../util/get_type":170,"./validate":172}],174:[function(require,module,exports){"use strict";var getType=require("../util/get_type");var ValidationError=require("../error/validation_error");module.exports=function validateBoolean(options){var value=options.value;var key=options.key;var type=getType(value);if(type!=="boolean"){return[new ValidationError(key,value,"boolean expected, %s found",type)]}return[]}},{"../error/validation_error":168,"../util/get_type":170}],175:[function(require,module,exports){"use strict";var ValidationError=require("../error/validation_error");var getType=require("../util/get_type");var parseCSSColor=require("csscolorparser").parseCSSColor;module.exports=function validateColor(options){var key=options.key;var value=options.value;var type=getType(value);if(type!=="string"){return[new ValidationError(key,value,"color expected, %s found",type)]}if(parseCSSColor(value)===null){return[new ValidationError(key,value,'color expected, "%s" found',value)]}return[]}},{"../error/validation_error":168,"../util/get_type":170,csscolorparser:140}],176:[function(require,module,exports){"use strict";var ValidationError=require("../error/validation_error");var getType=require("../util/get_type");module.exports=function validateConstants(options){var key=options.key;var constants=options.value;var styleSpec=options.styleSpec;if(styleSpec.$version>7){if(constants){return[new ValidationError(key,constants,"constants have been deprecated as of v8")]}else{return[]}}else{var type=getType(constants);if(type!=="object"){return[new ValidationError(key,constants,"object expected, %s found",type)]}var errors=[];for(var constantName in constants){if(constantName[0]!=="@"){errors.push(new ValidationError(key+"."+constantName,constants[constantName],'constants must start with "@"'))}}return errors}}},{"../error/validation_error":168,"../util/get_type":170}],177:[function(require,module,exports){"use strict";var ValidationError=require("../error/validation_error");var unbundle=require("../util/unbundle_jsonlint");module.exports=function validateEnum(options){var key=options.key;var value=options.value;var valueSpec=options.valueSpec;var errors=[];if(Array.isArray(valueSpec.values)){if(valueSpec.values.indexOf(unbundle(value))===-1){errors.push(new ValidationError(key,value,"expected one of [%s], %s found",valueSpec.values.join(", "),value))}}else{if(Object.keys(valueSpec.values).indexOf(unbundle(value))===-1){errors.push(new ValidationError(key,value,"expected one of [%s], %s found",Object.keys(valueSpec.values).join(", "),value))}}return errors}},{"../error/validation_error":168,"../util/unbundle_jsonlint":171}],178:[function(require,module,exports){"use strict";var ValidationError=require("../error/validation_error");var validateEnum=require("./validate_enum");var getType=require("../util/get_type");var unbundle=require("../util/unbundle_jsonlint");module.exports=function validateFilter(options){var value=options.value;var key=options.key;var styleSpec=options.styleSpec;var type;var errors=[];if(getType(value)!=="array"){return[new ValidationError(key,value,"array expected, %s found",getType(value))]}if(value.length<1){return[new ValidationError(key,value,"filter array must have at least 1 element")]}errors=errors.concat(validateEnum({key:key+"[0]",value:value[0],valueSpec:styleSpec.filter_operator,style:options.style,styleSpec:options.styleSpec}));switch(unbundle(value[0])){case"<":case"<=":case">":case">=":if(value.length>=2&&value[1]=="$type"){errors.push(new ValidationError(key,value,'"$type" cannot be use with operator "%s"',value[0]))}case"==":case"!=":if(value.length!=3){errors.push(new ValidationError(key,value,'filter array for operator "%s" must have 3 elements',value[0]))}case"in":case"!in":if(value.length>=2){type=getType(value[1]);if(type!=="string"){errors.push(new ValidationError(key+"[1]",value[1],"string expected, %s found",type))}else if(value[1][0]==="@"){errors.push(new ValidationError(key+"[1]",value[1],"filter key cannot be a constant"))}}for(var i=2;i<value.length;i++){type=getType(value[i]);if(value[1]=="$type"){errors=errors.concat(validateEnum({key:key+"["+i+"]",value:value[i],valueSpec:styleSpec.geometry_type,style:options.style,styleSpec:options.styleSpec}))}else if(type==="string"&&value[i][0]==="@"){errors.push(new ValidationError(key+"["+i+"]",value[i],"filter value cannot be a constant"))}else if(type!=="string"&&type!=="number"&&type!=="boolean"){errors.push(new ValidationError(key+"["+i+"]",value[i],"string, number, or boolean expected, %s found",type))}}break;case"any":case"all":case"none":for(i=1;i<value.length;i++){errors=errors.concat(validateFilter({key:key+"["+i+"]",value:value[i],style:options.style,styleSpec:options.styleSpec}))}break;case"has":case"!has":type=getType(value[1]);if(value.length!==2){errors.push(new ValidationError(key,value,'filter array for "%s" operator must have 2 elements',value[0]))}else if(type!=="string"){errors.push(new ValidationError(key+"[1]",value[1],"string expected, %s found",type))}else if(value[1][0]==="@"){errors.push(new ValidationError(key+"[1]",value[1],"filter key cannot be a constant"))}break}return errors}},{"../error/validation_error":168,"../util/get_type":170,"../util/unbundle_jsonlint":171,"./validate_enum":177}],179:[function(require,module,exports){"use strict";var ValidationError=require("../error/validation_error");var getType=require("../util/get_type");var validate=require("./validate");var validateObject=require("./validate_object");var validateArray=require("./validate_array");var validateNumber=require("./validate_number");var unbundle=require("../util/unbundle_jsonlint");module.exports=function validateFunction(options){var functionValueSpec=options.valueSpec;var functionValue=options.value;var stopKeyType;var isPropertyFunction=options.value.property!==undefined||stopKeyType==="object";var isZoomFunction=options.value.property===undefined||stopKeyType==="object";var errors=validateObject({key:options.key,value:options.value,valueSpec:options.styleSpec.function,style:options.style,styleSpec:options.styleSpec,objectElementValidators:{stops:validateFunctionStops}});if(unbundle(options.value.type)!=="identity"&&!options.value.stops){errors.push(new ValidationError(options.key,options.value,'missing required property "stops"'))}if(options.styleSpec.$version>=8){if(isPropertyFunction&&!options.valueSpec["property-function"]){errors.push(new ValidationError(options.key,options.value,"property functions not supported"))}else if(isZoomFunction&&!options.valueSpec["zoom-function"]){errors.push(new ValidationError(options.key,options.value,"zoom functions not supported"))}}return errors;function validateFunctionStops(options){if(unbundle(functionValue.type)==="identity"){return[new ValidationError(options.key,options.value,'identity function may not have a "stops" property')]}var errors=[];var value=options.value;errors=errors.concat(validateArray({key:options.key,value:value,valueSpec:options.valueSpec,style:options.style,styleSpec:options.styleSpec,arrayElementValidator:validateFunctionStop}));if(getType(value)==="array"&&value.length===0){errors.push(new ValidationError(options.key,value,"array must have at least one stop"))}return errors}function validateFunctionStop(options){var errors=[];var value=options.value;var key=options.key;if(getType(value)!=="array"){return[new ValidationError(key,value,"array expected, %s found",getType(value))]}if(value.length!==2){return[new ValidationError(key,value,"array length %d expected, length %d found",2,value.length)]}var type=getType(value[0]);if(!stopKeyType)stopKeyType=type;if(type!==stopKeyType){return[new ValidationError(key,value,"%s stop key type must match previous stop key type %s",type,stopKeyType)]}if(type==="object"){if(value[0].zoom===undefined){return[new ValidationError(key,value,"object stop key must have zoom")]}if(value[0].value===undefined){return[new ValidationError(key,value,"object stop key must have value")]}errors=errors.concat(validateObject({key:key+"[0]",value:value[0],valueSpec:{zoom:{}},style:options.style,styleSpec:options.styleSpec,objectElementValidators:{zoom:validateNumber,value:validateValue}}))}else{errors=errors.concat((isZoomFunction?validateNumber:validateValue)({key:key+"[0]",value:value[0],valueSpec:{},style:options.style,styleSpec:options.styleSpec}))}errors=errors.concat(validate({key:key+"[1]",value:value[1],valueSpec:functionValueSpec,style:options.style,styleSpec:options.styleSpec}));if(getType(value[0])==="number"){if(functionValueSpec.function==="piecewise-constant"&&value[0]%1!==0){errors.push(new ValidationError(key+"[0]",value[0],"zoom level for piecewise-constant functions must be an integer"))}if(options.arrayIndex!==0){if(value[0]<options.array[options.arrayIndex-1][0]){errors.push(new ValidationError(key+"[0]",value[0],"array stops must appear in ascending order"))}}}return errors}function validateValue(options){var errors=[];var type=getType(options.value);if(type!=="number"&&type!=="string"&&type!=="array"){errors.push(new ValidationError(options.key,options.value,"property value must be a number, string or array"))}return errors}}},{"../error/validation_error":168,"../util/get_type":170,"../util/unbundle_jsonlint":171,"./validate":172,"./validate_array":173,"./validate_number":184,"./validate_object":185}],180:[function(require,module,exports){"use strict";var ValidationError=require("../error/validation_error");var validateString=require("./validate_string");module.exports=function(options){var value=options.value;var key=options.key;var errors=validateString(options);if(errors.length)return errors;if(value.indexOf("{fontstack}")===-1){errors.push(new ValidationError(key,value,'"glyphs" url must include a "{fontstack}" token'))}if(value.indexOf("{range}")===-1){errors.push(new ValidationError(key,value,'"glyphs" url must include a "{range}" token'))}return errors}},{"../error/validation_error":168,"./validate_string":188}],181:[function(require,module,exports){"use strict";var ValidationError=require("../error/validation_error");var unbundle=require("../util/unbundle_jsonlint");var validateObject=require("./validate_object");var validateFilter=require("./validate_filter");var validatePaintProperty=require("./validate_paint_property");var validateLayoutProperty=require("./validate_layout_property");var extend=require("../util/extend");module.exports=function validateLayer(options){var errors=[];var layer=options.value;var key=options.key;var style=options.style;var styleSpec=options.styleSpec;if(!layer.type&&!layer.ref){errors.push(new ValidationError(key,layer,'either "type" or "ref" is required'))}var type=unbundle(layer.type);var ref=unbundle(layer.ref);if(layer.id){for(var i=0;i<options.arrayIndex;i++){var otherLayer=style.layers[i];if(unbundle(otherLayer.id)===unbundle(layer.id)){errors.push(new ValidationError(key,layer.id,'duplicate layer id "%s", previously used at line %d',layer.id,otherLayer.id.__line__))}}}if("ref"in layer){["type","source","source-layer","filter","layout"].forEach(function(p){if(p in layer){errors.push(new ValidationError(key,layer[p],'"%s" is prohibited for ref layers',p))}});var parent;style.layers.forEach(function(layer){if(layer.id==ref)parent=layer});if(!parent){errors.push(new ValidationError(key,layer.ref,'ref layer "%s" not found',ref))}else if(parent.ref){errors.push(new ValidationError(key,layer.ref,"ref cannot reference another ref layer"))}else{type=unbundle(parent.type)}}else if(type!=="background"){if(!layer.source){errors.push(new ValidationError(key,layer,'missing required property "source"'))}else{var source=style.sources&&style.sources[layer.source];if(!source){errors.push(new ValidationError(key,layer.source,'source "%s" not found',layer.source))}else if(source.type=="vector"&&type=="raster"){errors.push(new ValidationError(key,layer.source,'layer "%s" requires a raster source',layer.id))}else if(source.type=="raster"&&type!="raster"){errors.push(new ValidationError(key,layer.source,'layer "%s" requires a vector source',layer.id))}else if(source.type=="vector"&&!layer["source-layer"]){errors.push(new ValidationError(key,layer,'layer "%s" must specify a "source-layer"',layer.id))}}}errors=errors.concat(validateObject({key:key,value:layer,valueSpec:styleSpec.layer,style:options.style,styleSpec:options.styleSpec,objectElementValidators:{filter:validateFilter,layout:function(options){return validateObject({layer:layer,key:options.key,value:options.value,style:options.style,styleSpec:options.styleSpec,objectElementValidators:{"*":function(options){return validateLayoutProperty(extend({layerType:type},options))}}})},paint:function(options){return validateObject({layer:layer,key:options.key,value:options.value,style:options.style,styleSpec:options.styleSpec,objectElementValidators:{"*":function(options){return validatePaintProperty(extend({layerType:type},options))}}})}}}));return errors}},{"../error/validation_error":168,"../util/extend":169,"../util/unbundle_jsonlint":171,"./validate_filter":178,"./validate_layout_property":182,"./validate_object":185,"./validate_paint_property":186}],182:[function(require,module,exports){"use strict";var validate=require("./validate");var ValidationError=require("../error/validation_error");module.exports=function validateLayoutProperty(options){var key=options.key;var style=options.style;var styleSpec=options.styleSpec;var value=options.value;var propertyKey=options.objectKey;var layerSpec=styleSpec["layout_"+options.layerType];if(!layerSpec)return[];if(options.valueSpec||layerSpec[propertyKey]){var errors=[];if(options.layerType==="symbol"){if(propertyKey==="icon-image"&&style&&!style.sprite){errors.push(new ValidationError(key,value,'use of "icon-image" requires a style "sprite" property'))}else if(propertyKey==="text-field"&&style&&!style.glyphs){errors.push(new ValidationError(key,value,'use of "text-field" requires a style "glyphs" property'))}}return errors.concat(validate({key:options.key,value:value,valueSpec:options.valueSpec||layerSpec[propertyKey],style:style,styleSpec:styleSpec}))}else{return[new ValidationError(key,value,'unknown property "%s"',propertyKey)]}}},{"../error/validation_error":168,"./validate":172}],183:[function(require,module,exports){"use strict";var ValidationError=require("../error/validation_error");var getType=require("../util/get_type");var validate=require("./validate");var validateTypes={enum:require("./validate_enum"),color:require("./validate_color"),array:require("./validate_array"),number:require("./validate_number"),function:require("./validate_function")};module.exports=function validateLight(options){var light=options.value;var styleSpec=options.styleSpec;var lightSpec=styleSpec.$root.light;var style=options.style;var errors=[];var type;for(var key in light){var transitionMatch=key.match(/^(.*)-transition$/);if(transitionMatch&&lightSpec[transitionMatch[1]]&&lightSpec[transitionMatch[1]].transition){var baseKey=transitionMatch[1];type=lightSpec[baseKey].type;errors=errors.concat(validate({key:key,value:light[key],valueSpec:styleSpec.transition,style:style,styleSpec:styleSpec}))}else if(lightSpec[key]){type=lightSpec[key].type;if(lightSpec[key].function&&getType(light[key])==="object")type="function";errors=errors.concat(validateTypes[type]({key:key,value:light[key],valueSpec:lightSpec[key],style:style,styleSpec:styleSpec}))}else{errors=errors.concat([new ValidationError(key,light[key],'unknown property "%s"',key)])}}return errors}},{"../error/validation_error":168,"../util/get_type":170,"./validate":172,"./validate_array":173,"./validate_color":175,"./validate_enum":177,"./validate_function":179,"./validate_number":184}],184:[function(require,module,exports){"use strict";var getType=require("../util/get_type");var ValidationError=require("../error/validation_error");module.exports=function validateNumber(options){var key=options.key;var value=options.value;var valueSpec=options.valueSpec;var type=getType(value);if(type!=="number"){return[new ValidationError(key,value,"number expected, %s found",type)]}if("minimum"in valueSpec&&value<valueSpec.minimum){return[new ValidationError(key,value,"%s is less than the minimum value %s",value,valueSpec.minimum)]}if("maximum"in valueSpec&&value>valueSpec.maximum){return[new ValidationError(key,value,"%s is greater than the maximum value %s",value,valueSpec.maximum)]}return[]}},{"../error/validation_error":168,"../util/get_type":170}],185:[function(require,module,exports){"use strict";var ValidationError=require("../error/validation_error");var getType=require("../util/get_type");var validate=require("./validate");module.exports=function validateObject(options){var key=options.key;var object=options.value;var valueSpec=options.valueSpec;var objectElementValidators=options.objectElementValidators||{};var style=options.style;var styleSpec=options.styleSpec;var errors=[];var type=getType(object);if(type!=="object"){return[new ValidationError(key,object,"object expected, %s found",type)]}for(var objectKey in object){var valueSpecKey=objectKey.split(".")[0];var objectElementSpec=valueSpec&&(valueSpec[valueSpecKey]||valueSpec["*"]);var objectElementValidator=objectElementValidators[valueSpecKey]||objectElementValidators["*"];if(objectElementSpec||objectElementValidator){errors=errors.concat((objectElementValidator||validate)({key:(key?key+".":key)+objectKey,value:object[objectKey],valueSpec:objectElementSpec,style:style,styleSpec:styleSpec,object:object,objectKey:objectKey}))}else if(key!==""&&key.split(".").length!==1){errors.push(new ValidationError(key,object[objectKey],'unknown property "%s"',objectKey))}}for(valueSpecKey in valueSpec){if(valueSpec[valueSpecKey].required&&valueSpec[valueSpecKey]["default"]===undefined&&object[valueSpecKey]===undefined){errors.push(new ValidationError(key,object,'missing required property "%s"',valueSpecKey))}}return errors}},{"../error/validation_error":168,"../util/get_type":170,"./validate":172}],186:[function(require,module,exports){"use strict";var validate=require("./validate");var ValidationError=require("../error/validation_error");module.exports=function validatePaintProperty(options){var key=options.key;var style=options.style;var styleSpec=options.styleSpec;var value=options.value;var propertyKey=options.objectKey;var layerSpec=styleSpec["paint_"+options.layerType];if(!layerSpec)return[];var transitionMatch=propertyKey.match(/^(.*)-transition$/);if(transitionMatch&&layerSpec[transitionMatch[1]]&&layerSpec[transitionMatch[1]].transition){return validate({key:key,value:value,valueSpec:styleSpec.transition,style:style,styleSpec:styleSpec})}else if(options.valueSpec||layerSpec[propertyKey]){return validate({key:options.key,value:value,valueSpec:options.valueSpec||layerSpec[propertyKey],style:style,styleSpec:styleSpec})}else{return[new ValidationError(key,value,'unknown property "%s"',propertyKey)]}}},{"../error/validation_error":168,"./validate":172}],187:[function(require,module,exports){"use strict";var ValidationError=require("../error/validation_error");var unbundle=require("../util/unbundle_jsonlint");var validateObject=require("./validate_object");var validateEnum=require("./validate_enum");module.exports=function validateSource(options){var value=options.value;var key=options.key;var styleSpec=options.styleSpec;var style=options.style;if(!value.type){return[new ValidationError(key,value,'"type" is required')]}var type=unbundle(value.type);switch(type){case"vector":case"raster":var errors=[];errors=errors.concat(validateObject({key:key,value:value,valueSpec:styleSpec.source_tile,style:options.style,styleSpec:styleSpec}));if("url"in value){for(var prop in value){if(["type","url","tileSize"].indexOf(prop)<0){errors.push(new ValidationError(key+"."+prop,value[prop],'a source with a "url" property may not include a "%s" property',prop))}}}return errors;case"geojson":return validateObject({key:key,value:value,valueSpec:styleSpec.source_geojson,style:style,styleSpec:styleSpec});case"video":return validateObject({key:key,value:value,valueSpec:styleSpec.source_video,style:style,styleSpec:styleSpec});case"image":return validateObject({key:key,value:value,valueSpec:styleSpec.source_image,style:style,styleSpec:styleSpec});default:return validateEnum({key:key+".type",value:value.type,valueSpec:{values:["vector","raster","geojson","video","image"]},style:style,styleSpec:styleSpec})}}},{"../error/validation_error":168,"../util/unbundle_jsonlint":171,"./validate_enum":177,"./validate_object":185}],188:[function(require,module,exports){"use strict";var getType=require("../util/get_type");var ValidationError=require("../error/validation_error");module.exports=function validateString(options){var value=options.value;var key=options.key;var type=getType(value);if(type!=="string"){return[new ValidationError(key,value,"string expected, %s found",type)]}return[]}},{"../error/validation_error":168,"../util/get_type":170}],189:[function(require,module,exports){"use strict";var validateConstants=require("./validate/validate_constants");var validate=require("./validate/validate");var latestStyleSpec=require("../reference/latest.min");var validateGlyphsURL=require("./validate/validate_glyphs_url");function validateStyleMin(style,styleSpec){styleSpec=styleSpec||latestStyleSpec;var errors=[];errors=errors.concat(validate({key:"",value:style,valueSpec:styleSpec.$root,styleSpec:styleSpec,style:style,objectElementValidators:{glyphs:validateGlyphsURL}}));if(styleSpec.$version>7&&style.constants){errors=errors.concat(validateConstants({key:"constants",value:style.constants,style:style,styleSpec:styleSpec}))}return sortErrors(errors)}validateStyleMin.source=wrapCleanErrors(require("./validate/validate_source"));validateStyleMin.light=wrapCleanErrors(require("./validate/validate_light"));validateStyleMin.layer=wrapCleanErrors(require("./validate/validate_layer"));validateStyleMin.filter=wrapCleanErrors(require("./validate/validate_filter"));validateStyleMin.paintProperty=wrapCleanErrors(require("./validate/validate_paint_property"));validateStyleMin.layoutProperty=wrapCleanErrors(require("./validate/validate_layout_property"));function sortErrors(errors){return[].concat(errors).sort(function(a,b){return a.line-b.line})}function wrapCleanErrors(inner){return function(){return sortErrors(inner.apply(this,arguments))}}module.exports=validateStyleMin},{"../reference/latest.min":190,"./validate/validate":172,"./validate/validate_constants":176,"./validate/validate_filter":178,"./validate/validate_glyphs_url":180,"./validate/validate_layer":181,"./validate/validate_layout_property":182,"./validate/validate_light":183,"./validate/validate_paint_property":186,"./validate/validate_source":187}],190:[function(require,module,exports){module.exports=require("./v8.min.json")},{"./v8.min.json":191}],191:[function(require,module,exports){module.exports={$version:8,$root:{version:{required:true,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},transition:false},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:.5,minimum:0,maximum:1,function:"interpolated","zoom-function":true,"property-function":false,transition:true}},sources:{required:true,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:true,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_tile","source_geojson","source_video","source_image"],source_tile:{type:{required:true,type:"enum",values:{vector:{},raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},"*":{type:"*"}},source_geojson:{type:{required:true,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},buffer:{type:"number",default:128,maximum:512,minimum:0},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:false},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"}},source_video:{type:{required:true,type:"enum",values:{video:{}}},urls:{required:true,type:"array",value:"string"},coordinates:{required:true,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:true,type:"enum",values:{image:{}}},url:{required:true,type:"string"},coordinates:{required:true,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:true},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},raster:{},background:{}}},metadata:{type:"*"},ref:{type:"string"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:22},maxzoom:{type:"number",minimum:0,maximum:22},interactive:{type:"boolean",default:false},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"},"paint.*":{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_symbol","layout_raster","layout_background"],layout_background:{visibility:{type:"enum",function:"piecewise-constant","zoom-function":true,values:{visible:{},none:{}},default:"visible"}},layout_fill:{visibility:{type:"enum",function:"piecewise-constant","zoom-function":true,values:{visible:{},none:{}},default:"visible"}},layout_circle:{visibility:{type:"enum",function:"piecewise-constant","zoom-function":true,values:{visible:{},none:{}},default:"visible"}},layout_line:{"line-cap":{type:"enum",function:"piecewise-constant","zoom-function":true,"property-function":true,values:{butt:{},round:{},square:{}},default:"butt"},"line-join":{type:"enum",function:"piecewise-constant","zoom-function":true,"property-function":true,values:{bevel:{},round:{},miter:{}},default:"miter"},"line-miter-limit":{type:"number",default:2,function:"interpolated","zoom-function":true,"property-function":true,requires:[{"line-join":"miter"}]},"line-round-limit":{type:"number",default:1.05,function:"interpolated","zoom-function":true,"property-function":true,requires:[{"line-join":"round"}]},visibility:{type:"enum",function:"piecewise-constant","zoom-function":true,values:{visible:{},none:{}},default:"visible"}},layout_symbol:{"symbol-placement":{type:"enum",function:"piecewise-constant","zoom-function":true,"property-function":true,values:{point:{},line:{}},default:"point"},"symbol-spacing":{type:"number",default:250,minimum:1,function:"interpolated","zoom-function":true,"property-function":true,units:"pixels",requires:[{"symbol-placement":"line"}]},"symbol-avoid-edges":{type:"boolean",function:"piecewise-constant","zoom-function":true,"property-function":true,default:false},"icon-allow-overlap":{type:"boolean",function:"piecewise-constant","zoom-function":true,"property-function":true,default:false,requires:["icon-image"]},"icon-ignore-placement":{type:"boolean",function:"piecewise-constant","zoom-function":true,"property-function":true,default:false,requires:["icon-image"]},"icon-optional":{type:"boolean",function:"piecewise-constant","zoom-function":true,"property-function":true,default:false,requires:["icon-image","text-field"]},"icon-rotation-alignment":{type:"enum",function:"piecewise-constant","zoom-function":true,"property-function":true,values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"]},"icon-size":{type:"number",default:1,minimum:0,function:"interpolated","zoom-function":true,"property-function":true,requires:["icon-image"]},"icon-text-fit":{
type:"enum",function:"piecewise-constant","zoom-function":true,"property-function":false,values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"]},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",function:"interpolated","zoom-function":true,"property-function":true,requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}]},"icon-image":{type:"string",function:"piecewise-constant","zoom-function":true,"property-function":true,tokens:true},"icon-rotate":{type:"number",default:0,period:360,function:"interpolated","zoom-function":true,"property-function":true,units:"degrees",requires:["icon-image"]},"icon-padding":{type:"number",default:2,minimum:0,function:"interpolated","zoom-function":true,"property-function":true,units:"pixels",requires:["icon-image"]},"icon-keep-upright":{type:"boolean",function:"piecewise-constant","zoom-function":true,"property-function":true,default:false,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":"line"}]},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],function:"interpolated","zoom-function":true,"property-function":true,requires:["icon-image"]},"text-pitch-alignment":{type:"enum",function:"piecewise-constant","zoom-function":true,"property-function":true,values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"]},"text-rotation-alignment":{type:"enum",function:"piecewise-constant","zoom-function":true,"property-function":true,values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"]},"text-field":{type:"string",function:"piecewise-constant","zoom-function":true,"property-function":true,default:"",tokens:true},"text-font":{type:"array",value:"string",function:"piecewise-constant","zoom-function":true,"property-function":true,default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"]},"text-size":{type:"number",default:16,minimum:0,units:"pixels",function:"interpolated","zoom-function":true,"property-function":true,requires:["text-field"]},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",function:"interpolated","zoom-function":true,"property-function":true,requires:["text-field"]},"text-line-height":{type:"number",default:1.2,units:"ems",function:"interpolated","zoom-function":true,"property-function":true,requires:["text-field"]},"text-letter-spacing":{type:"number",default:0,units:"ems",function:"interpolated","zoom-function":true,"property-function":true,requires:["text-field"]},"text-justify":{type:"enum",function:"piecewise-constant","zoom-function":true,"property-function":true,values:{left:{},center:{},right:{}},default:"center",requires:["text-field"]},"text-anchor":{type:"enum",function:"piecewise-constant","zoom-function":true,"property-function":true,values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field"]},"text-max-angle":{type:"number",default:45,units:"degrees",function:"interpolated","zoom-function":true,"property-function":true,requires:["text-field",{"symbol-placement":"line"}]},"text-rotate":{type:"number",default:0,period:360,units:"degrees",function:"interpolated","zoom-function":true,"property-function":true,requires:["text-field"]},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",function:"interpolated","zoom-function":true,"property-function":true,requires:["text-field"]},"text-keep-upright":{type:"boolean",function:"piecewise-constant","zoom-function":true,"property-function":true,default:true,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":"line"}]},"text-transform":{type:"enum",function:"piecewise-constant","zoom-function":true,"property-function":true,values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"]},"text-offset":{type:"array",value:"number",units:"ems",function:"interpolated","zoom-function":true,"property-function":true,length:2,default:[0,0],requires:["text-field"]},"text-allow-overlap":{type:"boolean",function:"piecewise-constant","zoom-function":true,"property-function":true,default:false,requires:["text-field"]},"text-ignore-placement":{type:"boolean",function:"piecewise-constant","zoom-function":true,"property-function":true,default:false,requires:["text-field"]},"text-optional":{type:"boolean",function:"piecewise-constant","zoom-function":true,"property-function":true,default:false,requires:["text-field","icon-image"]},visibility:{type:"enum",function:"piecewise-constant","zoom-function":true,values:{visible:{},none:{}},default:"visible"}},layout_raster:{visibility:{type:"enum",function:"piecewise-constant","zoom-function":true,values:{visible:{},none:{}},default:"visible"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{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"}},function_stop:{type:"array",minimum:0,maximum:22,value:["number","color"],length:2},paint:["paint_fill","paint_line","paint_circle","paint_symbol","paint_raster","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",function:"piecewise-constant","zoom-function":true,"property-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,"property-function":true,transition:true,units:"pixels"},"fill-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":true,"property-function":true,values:{map:{},viewport:{}},default:"map",requires:["fill-translate"]},"fill-pattern":{type:"string",function:"piecewise-constant","zoom-function":true,"property-function":true,transition:true},"fill-extrude-height":{type:"number",function:"interpolated","zoom-function":true,"property-function":true,default:0,minimum:0,transition:true},"fill-extrude-base":{type:"number",function:"interpolated","zoom-function":true,"property-function":true,default:0,minimum:0,transition:true,requires:[{"<=":"fill-extrude-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,"property-function":true,transition:true,units:"pixels"},"line-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":true,"property-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,"property-function":true,minimum:0,transition:true,units:"line widths",requires:[{"!":"line-pattern"}]},"line-pattern":{type:"string",function:"piecewise-constant","zoom-function":true,"property-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,"property-function":true,transition:true,units:"pixels"},"circle-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":true,"property-function":true,values:{map:{},viewport:{}},default:"map",requires:["circle-translate"]},"circle-pitch-scale":{type:"enum",function:"piecewise-constant","zoom-function":true,"property-function":true,values:{map:{},viewport:{}},default:"map"}},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,"property-function":true,transition:true,units:"pixels",requires:["icon-image"]},"icon-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":true,"property-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,"property-function":true,transition:true,units:"pixels",requires:["text-field"]},"text-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":true,"property-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"}}}},{}],192:[function(require,module,exports){"use strict";if(typeof module!=="undefined"&&module.exports){module.exports=isSupported}else if(window){window.mapboxgl=window.mapboxgl||{};window.mapboxgl.supported=isSupported}function isSupported(options){return!!(isBrowser()&&isArraySupported()&&isFunctionSupported()&&isObjectSupported()&&isJSONSupported()&&isWorkerSupported()&&isUint8ClampedArraySupported()&&isWebGLSupportedCached(options&&options.failIfMajorPerformanceCaveat))}function isBrowser(){return typeof window!=="undefined"&&typeof document!=="undefined"}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(){return"Worker"in window}function isUint8ClampedArraySupported(){return"Uint8ClampedArray"in window}var isWebGLSupportedCache={};function isWebGLSupportedCached(failIfMajorPerformanceCaveat){if(isWebGLSupportedCache[failIfMajorPerformanceCaveat]===undefined){isWebGLSupportedCache[failIfMajorPerformanceCaveat]=isWebGLSupported(failIfMajorPerformanceCaveat)}return isWebGLSupportedCache[failIfMajorPerformanceCaveat]}isSupported.webGLContextAttributes={antialias:false,alpha:true,stencil:true,depth:true};function isWebGLSupported(failIfMajorPerformanceCaveat){var canvas=document.createElement("canvas");var attributes=Object.create(isSupported.webGLContextAttributes);attributes.failIfMajorPerformanceCaveat=failIfMajorPerformanceCaveat;if(canvas.probablySupportsContext){return canvas.probablySupportsContext("webgl",attributes)||canvas.probablySupportsContext("experimental-webgl",attributes)}else if(canvas.supportsContext){return canvas.supportsContext("webgl",attributes)||canvas.supportsContext("experimental-webgl",attributes)}else{return canvas.getContext("webgl",attributes)||canvas.getContext("experimental-webgl",attributes)}}},{}],193:[function(require,module,exports){"use strict";module.exports=Buffer;var ieee754=require("ieee754");var BufferMethods;function Buffer(length){var arr;if(length&&length.length){arr=length;length=arr.length}var buf=new Uint8Array(length||0);if(arr)buf.set(arr);buf.readUInt32LE=BufferMethods.readUInt32LE;buf.writeUInt32LE=BufferMethods.writeUInt32LE;buf.readInt32LE=BufferMethods.readInt32LE;buf.writeInt32LE=BufferMethods.writeInt32LE;buf.readFloatLE=BufferMethods.readFloatLE;buf.writeFloatLE=BufferMethods.writeFloatLE;buf.readDoubleLE=BufferMethods.readDoubleLE;buf.writeDoubleLE=BufferMethods.writeDoubleLE;buf.toString=BufferMethods.toString;buf.write=BufferMethods.write;buf.slice=BufferMethods.slice;buf.copy=BufferMethods.copy;buf._isBuffer=true;return buf}var lastStr,lastStrEncoded;BufferMethods={readUInt32LE:function(pos){return(this[pos]|this[pos+1]<<8|this[pos+2]<<16)+this[pos+3]*16777216},writeUInt32LE:function(val,pos){this[pos]=val;this[pos+1]=val>>>8;this[pos+2]=val>>>16;this[pos+3]=val>>>24},readInt32LE:function(pos){return(this[pos]|this[pos+1]<<8|this[pos+2]<<16)+(this[pos+3]<<24)},readFloatLE:function(pos){return ieee754.read(this,pos,true,23,4)},readDoubleLE:function(pos){return ieee754.read(this,pos,true,52,8)},writeFloatLE:function(val,pos){return ieee754.write(this,val,pos,true,23,4)},writeDoubleLE:function(val,pos){return ieee754.write(this,val,pos,true,52,8)},toString:function(encoding,start,end){var str="",tmp="";start=start||0;end=Math.min(this.length,end||this.length);for(var i=start;i<end;i++){var ch=this[i];if(ch<=127){str+=decodeURIComponent(tmp)+String.fromCharCode(ch);tmp=""}else{tmp+="%"+ch.toString(16)}}str+=decodeURIComponent(tmp);return str},write:function(str,pos){var bytes=str===lastStr?lastStrEncoded:encodeString(str);for(var i=0;i<bytes.length;i++){this[pos+i]=bytes[i]}},slice:function(start,end){return this.subarray(start,end)},copy:function(buf,pos){pos=pos||0;for(var i=0;i<this.length;i++){buf[pos+i]=this[i]}}};BufferMethods.writeInt32LE=BufferMethods.writeUInt32LE;Buffer.byteLength=function(str){lastStr=str;lastStrEncoded=encodeString(str);return lastStrEncoded.length};Buffer.isBuffer=function(buf){return!!(buf&&buf._isBuffer)};function encodeString(str){var length=str.length,bytes=[];for(var i=0,c,lead;i<length;i++){c=str.charCodeAt(i);if(c>55295&&c<57344){if(lead){if(c<56320){bytes.push(239,191,189);lead=c;continue}else{c=lead-55296<<10|c-56320|65536;lead=null}}else{if(c>56319||i+1===length)bytes.push(239,191,189);else lead=c;continue}}else if(lead){bytes.push(239,191,189);lead=null}if(c<128)bytes.push(c);else if(c<2048)bytes.push(c>>6|192,c&63|128);else if(c<65536)bytes.push(c>>12|224,c>>6&63|128,c&63|128);else bytes.push(c>>18|240,c>>12&63|128,c>>6&63|128,c&63|128)}return bytes}},{ieee754:195}],194:[function(require,module,exports){(function(global){"use strict";module.exports=Pbf;var Buffer=global.Buffer||require("./buffer");function Pbf(buf){this.buf=!Buffer.isBuffer(buf)?new Buffer(buf||0):buf;this.pos=0;this.length=this.buf.length}Pbf.Varint=0;Pbf.Fixed64=1;Pbf.Bytes=2;Pbf.Fixed32=5;var SHIFT_LEFT_32=(1<<16)*(1<<16),SHIFT_RIGHT_32=1/SHIFT_LEFT_32,POW_2_63=Math.pow(2,63);Pbf.prototype={destroy:function(){this.buf=null},readFields:function(readField,result,end){end=end||this.length;while(this.pos<end){var val=this.readVarint(),tag=val>>3,startPos=this.pos;readField(tag,result,this);if(this.pos===startPos)this.skip(val)}return result},readMessage:function(readField,result){return this.readFields(readField,result,this.readVarint()+this.pos)},readFixed32:function(){var val=this.buf.readUInt32LE(this.pos);this.pos+=4;return val},readSFixed32:function(){var val=this.buf.readInt32LE(this.pos);this.pos+=4;return val},readFixed64:function(){var val=this.buf.readUInt32LE(this.pos)+this.buf.readUInt32LE(this.pos+4)*SHIFT_LEFT_32;this.pos+=8;return val},readSFixed64:function(){var val=this.buf.readUInt32LE(this.pos)+this.buf.readInt32LE(this.pos+4)*SHIFT_LEFT_32;this.pos+=8;return val},readFloat:function(){var val=this.buf.readFloatLE(this.pos);this.pos+=4;return val},readDouble:function(){var val=this.buf.readDoubleLE(this.pos);this.pos+=8;return val},readVarint:function(){var buf=this.buf,val,b;b=buf[this.pos++];val=b&127;if(b<128)return val;b=buf[this.pos++];val|=(b&127)<<7;if(b<128)return val;b=buf[this.pos++];val|=(b&127)<<14;if(b<128)return val;b=buf[this.pos++];val|=(b&127)<<21;if(b<128)return val;return readVarintRemainder(val,this)},readVarint64:function(){var startPos=this.pos,val=this.readVarint();if(val<POW_2_63)return val;var pos=this.pos-2;while(this.buf[pos]===255)pos--;if(pos<startPos)pos=startPos;val=0;for(var i=0;i<pos-startPos+1;i++){var b=~this.buf[startPos+i]&127;val+=i<4?b<<i*7:b*Math.pow(2,i*7)}return-val-1},readSVarint:function(){var num=this.readVarint();return num%2===1?(num+1)/-2:num/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var end=this.readVarint()+this.pos,str=this.buf.toString("utf8",this.pos,end);this.pos=end;return str},readBytes:function(){var end=this.readVarint()+this.pos,buffer=this.buf.slice(this.pos,end);this.pos=end;return buffer},readPackedVarint:function(){var end=this.readVarint()+this.pos,arr=[];while(this.pos<end)arr.push(this.readVarint());return arr},readPackedSVarint:function(){var end=this.readVarint()+this.pos,arr=[];while(this.pos<end)arr.push(this.readSVarint());return arr},readPackedBoolean:function(){var end=this.readVarint()+this.pos,arr=[];while(this.pos<end)arr.push(this.readBoolean());return arr},readPackedFloat:function(){var end=this.readVarint()+this.pos,arr=[];while(this.pos<end)arr.push(this.readFloat());return arr},readPackedDouble:function(){var end=this.readVarint()+this.pos,arr=[];while(this.pos<end)arr.push(this.readDouble());return arr},readPackedFixed32:function(){var end=this.readVarint()+this.pos,arr=[];while(this.pos<end)arr.push(this.readFixed32());return arr},readPackedSFixed32:function(){var end=this.readVarint()+this.pos,arr=[];while(this.pos<end)arr.push(this.readSFixed32());return arr},readPackedFixed64:function(){var end=this.readVarint()+this.pos,arr=[];while(this.pos<end)arr.push(this.readFixed64());return arr},readPackedSFixed64:function(){var end=this.readVarint()+this.pos,arr=[];while(this.pos<end)arr.push(this.readSFixed64());return arr},skip:function(val){var type=val&7;if(type===Pbf.Varint)while(this.buf[this.pos++]>127){}else if(type===Pbf.Bytes)this.pos=this.readVarint()+this.pos;else if(type===Pbf.Fixed32)this.pos+=4;else if(type===Pbf.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+type)},writeTag:function(tag,type){this.writeVarint(tag<<3|type)},realloc:function(min){var length=this.length||16;while(length<this.pos+min)length*=2;if(length!==this.length){var buf=new Buffer(length);this.buf.copy(buf);this.buf=buf;this.length=length}},finish:function(){this.length=this.pos;this.pos=0;return this.buf.slice(0,this.length)},writeFixed32:function(val){this.realloc(4);this.buf.writeUInt32LE(val,this.pos);this.pos+=4},writeSFixed32:function(val){this.realloc(4);this.buf.writeInt32LE(val,this.pos);this.pos+=4},writeFixed64:function(val){this.realloc(8);this.buf.writeInt32LE(val&-1,this.pos);this.buf.writeUInt32LE(Math.floor(val*SHIFT_RIGHT_32),this.pos+4);this.pos+=8},writeSFixed64:function(val){this.realloc(8);this.buf.writeInt32LE(val&-1,this.pos);this.buf.writeInt32LE(Math.floor(val*SHIFT_RIGHT_32),this.pos+4);this.pos+=8},writeVarint:function(val){val=+val;if(val>268435455){writeBigVarint(val,this);return}this.realloc(4);this.buf[this.pos++]=val&127|(val>127?128:0);if(val<=127)return;this.buf[this.pos++]=(val>>>=7)&127|(val>127?128:0);if(val<=127)return;this.buf[this.pos++]=(val>>>=7)&127|(val>127?128:0);if(val<=127)return;this.buf[this.pos++]=val>>>7&127},writeSVarint:function(val){this.writeVarint(val<0?-val*2-1:val*2)},writeBoolean:function(val){this.writeVarint(Boolean(val))},writeString:function(str){str=String(str);var bytes=Buffer.byteLength(str);this.writeVarint(bytes);this.realloc(bytes);this.buf.write(str,this.pos);this.pos+=bytes},writeFloat:function(val){this.realloc(4);this.buf.writeFloatLE(val,this.pos);this.pos+=4},writeDouble:function(val){this.realloc(8);this.buf.writeDoubleLE(val,this.pos);this.pos+=8},writeBytes:function(buffer){var len=buffer.length;this.writeVarint(len);this.realloc(len);for(var i=0;i<len;i++)this.buf[this.pos++]=buffer[i]},writeRawMessage:function(fn,obj){this.pos++;var startPos=this.pos;fn(obj,this);var len=this.pos-startPos;if(len>=128)reallocForRawMessage(startPos,len,this);this.pos=startPos-1;this.writeVarint(len);this.pos+=len},writeMessage:function(tag,fn,obj){this.writeTag(tag,Pbf.Bytes);this.writeRawMessage(fn,obj)},writePackedVarint:function(tag,arr){this.writeMessage(tag,writePackedVarint,arr)},writePackedSVarint:function(tag,arr){this.writeMessage(tag,writePackedSVarint,arr)},writePackedBoolean:function(tag,arr){this.writeMessage(tag,writePackedBoolean,arr)},writePackedFloat:function(tag,arr){this.writeMessage(tag,writePackedFloat,arr)},writePackedDouble:function(tag,arr){this.writeMessage(tag,writePackedDouble,arr)},writePackedFixed32:function(tag,arr){this.writeMessage(tag,writePackedFixed32,arr)},writePackedSFixed32:function(tag,arr){this.writeMessage(tag,writePackedSFixed32,arr)},writePackedFixed64:function(tag,arr){this.writeMessage(tag,writePackedFixed64,arr)},writePackedSFixed64:function(tag,arr){this.writeMessage(tag,writePackedSFixed64,arr)},writeBytesField:function(tag,buffer){this.writeTag(tag,Pbf.Bytes);this.writeBytes(buffer)},writeFixed32Field:function(tag,val){this.writeTag(tag,Pbf.Fixed32);this.writeFixed32(val)},writeSFixed32Field:function(tag,val){this.writeTag(tag,Pbf.Fixed32);this.writeSFixed32(val)},writeFixed64Field:function(tag,val){this.writeTag(tag,Pbf.Fixed64);this.writeFixed64(val)},writeSFixed64Field:function(tag,val){this.writeTag(tag,Pbf.Fixed64);this.writeSFixed64(val)},writeVarintField:function(tag,val){this.writeTag(tag,Pbf.Varint);this.writeVarint(val)},writeSVarintField:function(tag,val){this.writeTag(tag,Pbf.Varint);this.writeSVarint(val)},writeStringField:function(tag,str){this.writeTag(tag,Pbf.Bytes);this.writeString(str)},writeFloatField:function(tag,val){this.writeTag(tag,Pbf.Fixed32);this.writeFloat(val)},writeDoubleField:function(tag,val){this.writeTag(tag,Pbf.Fixed64);this.writeDouble(val)},writeBooleanField:function(tag,val){this.writeVarintField(tag,Boolean(val))}};function readVarintRemainder(val,pbf){var buf=pbf.buf,b;b=buf[pbf.pos++];val+=(b&127)*268435456;if(b<128)return val;b=buf[pbf.pos++];val+=(b&127)*34359738368;if(b<128)return val;b=buf[pbf.pos++];val+=(b&127)*4398046511104;if(b<128)return val;b=buf[pbf.pos++];val+=(b&127)*562949953421312;if(b<128)return val;b=buf[pbf.pos++];val+=(b&127)*72057594037927940;if(b<128)return val;b=buf[pbf.pos++];val+=(b&127)*0x8000000000000000;if(b<128)return val;throw new Error("Expected varint not more than 10 bytes")}function writeBigVarint(val,pbf){pbf.realloc(10);var maxPos=pbf.pos+10;while(val>=1){if(pbf.pos>=maxPos)throw new Error("Given varint doesn't fit into 10 bytes");var b=val&255;pbf.buf[pbf.pos++]=b|(val>=128?128:0);val/=128}}function reallocForRawMessage(startPos,len,pbf){var extraLen=len<=16383?1:len<=2097151?2:len<=268435455?3:Math.ceil(Math.log(len)/(Math.LN2*7));pbf.realloc(extraLen);for(var i=pbf.pos-1;i>=startPos;i--)pbf.buf[i+extraLen]=pbf.buf[i]}function writePackedVarint(arr,pbf){for(var i=0;i<arr.length;i++)pbf.writeVarint(arr[i])}function writePackedSVarint(arr,pbf){for(var i=0;i<arr.length;i++)pbf.writeSVarint(arr[i])}function writePackedFloat(arr,pbf){for(var i=0;i<arr.length;i++)pbf.writeFloat(arr[i])}function writePackedDouble(arr,pbf){for(var i=0;i<arr.length;i++)pbf.writeDouble(arr[i])}function writePackedBoolean(arr,pbf){for(var i=0;i<arr.length;i++)pbf.writeBoolean(arr[i])}function writePackedFixed32(arr,pbf){for(var i=0;i<arr.length;i++)pbf.writeFixed32(arr[i])}function writePackedSFixed32(arr,pbf){for(var i=0;i<arr.length;i++)pbf.writeSFixed32(arr[i])}function writePackedFixed64(arr,pbf){for(var i=0;i<arr.length;i++)pbf.writeFixed64(arr[i])}function writePackedSFixed64(arr,pbf){for(var i=0;i<arr.length;i++)pbf.writeSFixed64(arr[i])}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./buffer":193}],195:[function(require,module,exports){exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m;var eLen=nBytes*8-mLen-1;var eMax=(1<<eLen)-1;var eBias=eMax>>1;var nBits=-7;var i=isLE?nBytes-1:0;var d=isLE?-1:1;var s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8){}m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8){}if(e===0){e=1-eBias}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity}else{m=m+Math.pow(2,mLen);e=e-eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)};exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c;var eLen=nBytes*8-mLen-1;var eMax=(1<<eLen)-1;var eBias=eMax>>1;var rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0;var i=isLE?0:nBytes-1;var d=isLE?1:-1;var s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2}if(e+eBias>=1){value+=rt/c}else{value+=rt*Math.pow(2,1-eBias)}if(value*c>=2){e++;c/=2}if(e+eBias>=eMax){m=0;e=eMax}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0}}for(;mLen>=8;buffer[offset+i]=m&255,i+=d,m/=256,mLen-=8){}e=e<<mLen|m;eLen+=mLen;for(;eLen>0;buffer[offset+i]=e&255,i+=d,e/=256,eLen-=8){}buffer[offset+i-d]|=s*128}},{}],196:[function(require,module,exports){"use strict";module.exports=Point;function Point(x,y){this.x=x;this.y=y}Point.prototype={clone:function(){return new Point(this.x,this.y)},add:function(p){return this.clone()._add(p)},sub:function(p){return this.clone()._sub(p)},mult:function(k){return this.clone()._mult(k)},div:function(k){return this.clone()._div(k)},rotate:function(a){return this.clone()._rotate(a)},matMult:function(m){return this.clone()._matMult(m)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(p){return this.x===p.x&&this.y===p.y},dist:function(p){return Math.sqrt(this.distSqr(p))},distSqr:function(p){var dx=p.x-this.x,dy=p.y-this.y;return dx*dx+dy*dy},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(b){return Math.atan2(this.y-b.y,this.x-b.x)},angleWith:function(b){return this.angleWithSep(b.x,b.y)},angleWithSep:function(x,y){return Math.atan2(this.x*y-this.y*x,this.x*x+this.y*y)},_matMult:function(m){var x=m[0]*this.x+m[1]*this.y,y=m[2]*this.x+m[3]*this.y;this.x=x;this.y=y;return this},_add:function(p){this.x+=p.x;this.y+=p.y;return this},_sub:function(p){this.x-=p.x;this.y-=p.y;return this},_mult:function(k){this.x*=k;this.y*=k;return this},_div:function(k){this.x/=k;this.y/=k;return this},_unit:function(){this._div(this.mag());return this},_perp:function(){var y=this.y;this.y=this.x;this.x=-y;return this},_rotate:function(angle){var cos=Math.cos(angle),sin=Math.sin(angle),x=cos*this.x-sin*this.y,y=sin*this.x+cos*this.y;this.x=x;this.y=y;return this},_round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this}};Point.convert=function(a){if(a instanceof Point){return a}if(Array.isArray(a)){return new Point(a[0],a[1])}return a}},{}],197:[function(require,module,exports){"use strict";module.exports=partialSort;function partialSort(arr,k,left,right,compare){left=left||0;right=right||arr.length-1;compare=compare||defaultCompare;while(right>left){
if(right-left>600){var n=right-left+1;var m=k-left+1;var z=Math.log(n);var s=.5*Math.exp(2*z/3);var sd=.5*Math.sqrt(z*s*(n-s)/n)*(m-n/2<0?-1:1);var newLeft=Math.max(left,Math.floor(k-m*s/n+sd));var newRight=Math.min(right,Math.floor(k+(n-m)*s/n+sd));partialSort(arr,k,newLeft,newRight,compare)}var t=arr[k];var i=left;var j=right;swap(arr,left,k);if(compare(arr[right],t)>0)swap(arr,left,right);while(i<j){swap(arr,i,j);i++;j--;while(compare(arr[i],t)<0)i++;while(compare(arr[j],t)>0)j--}if(compare(arr[left],t)===0)swap(arr,left,j);else{j++;swap(arr,j,right)}if(j<=k)left=j+1;if(k<=j)right=j-1}}function swap(arr,i,j){var tmp=arr[i];arr[i]=arr[j];arr[j]=tmp}function defaultCompare(a,b){return a<b?-1:a>b?1:0}},{}],198:[function(require,module,exports){(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?module.exports=factory():typeof define==="function"&&define.amd?define(factory):global.ShelfPack=factory()})(this,function(){function ShelfPack(w,h,options){options=options||{};this.w=w||64;this.h=h||64;this.autoResize=!!options.autoResize;this.shelves=[];this.stats={};this.count=function(h){this.stats[h]=(this.stats[h]|0)+1}}ShelfPack.prototype.pack=function(bins,options){bins=[].concat(bins);options=options||{};var results=[],w,h,allocation;for(var i=0;i<bins.length;i++){w=bins[i].w||bins[i].width;h=bins[i].h||bins[i].height;if(w&&h){allocation=this.packOne(w,h);if(!allocation){continue}if(options.inPlace){bins[i].x=allocation.x;bins[i].y=allocation.y}results.push(allocation)}}if(this.shelves.length>0){var w2=0;var h2=0;for(var j=0;j<this.shelves.length;j++){var shelf=this.shelves[j];h2+=shelf.h;w2=Math.max(shelf.w-shelf.free,w2)}this.resize(w2,h2)}return results};ShelfPack.prototype.packOne=function(w,h){var y=0,best={shelf:-1,waste:Infinity},shelf,waste;for(var i=0;i<this.shelves.length;i++){shelf=this.shelves[i];y+=shelf.h;if(h===shelf.h&&w<=shelf.free){this.count(h);return shelf.alloc(w,h)}if(h>shelf.h||w>shelf.free){continue}if(h<shelf.h&&w<=shelf.free){waste=shelf.h-h;if(waste<best.waste){best.waste=waste;best.shelf=i}}}if(best.shelf!==-1){shelf=this.shelves[best.shelf];this.count(h);return shelf.alloc(w,h)}if(h<=this.h-y&&w<=this.w){shelf=new Shelf(y,this.w,h);this.shelves.push(shelf);this.count(h);return shelf.alloc(w,h)}if(this.autoResize){var h1,h2,w1,w2;h1=h2=this.h;w1=w2=this.w;if(w1<=h1||w>w1){w2=Math.max(w,w1)*2}if(h1<w1||h>h1){h2=Math.max(h,h1)*2}this.resize(w2,h2);return this.packOne(w,h)}return null};ShelfPack.prototype.clear=function(){this.shelves=[];this.stats={}};ShelfPack.prototype.resize=function(w,h){this.w=w;this.h=h;for(var i=0;i<this.shelves.length;i++){this.shelves[i].resize(w)}return true};function Shelf(y,w,h){this.x=0;this.y=y;this.w=this.free=w;this.h=h}Shelf.prototype.alloc=function(w,h){if(w>this.free||h>this.h){return null}var x=this.x;this.x+=w;this.free-=w;return{x:x,y:this.y,w:w,h:h,width:w,height:h}};Shelf.prototype.resize=function(w){this.free+=w-this.w;this.w=w;return true};return ShelfPack})},{}],199:[function(require,module,exports){"use strict";var kdbush=require("kdbush");module.exports=supercluster;function supercluster(options){return new SuperCluster(options)}function SuperCluster(options){this.options=extend(Object.create(this.options),options);this.trees=new Array(this.options.maxZoom+1)}SuperCluster.prototype={options:{minZoom:0,maxZoom:16,radius:40,extent:512,nodeSize:64,log:false},load:function(points){var log=this.options.log;if(log)console.time("total time");var timerId="prepare "+points.length+" points";if(log)console.time(timerId);this.points=points;var clusters=points.map(createPointCluster);if(log)console.timeEnd(timerId);for(var z=this.options.maxZoom;z>=this.options.minZoom;z--){var now=+Date.now();this.trees[z+1]=kdbush(clusters,getX,getY,this.options.nodeSize,Float32Array);clusters=this._cluster(clusters,z);if(log)console.log("z%d: %d clusters in %dms",z,clusters.length,+Date.now()-now)}this.trees[this.options.minZoom]=kdbush(clusters,getX,getY,this.options.nodeSize,Float32Array);if(log)console.timeEnd("total time");return this},getClusters:function(bbox,zoom){var tree=this.trees[this._limitZoom(zoom)];var ids=tree.range(lngX(bbox[0]),latY(bbox[3]),lngX(bbox[2]),latY(bbox[1]));var clusters=[];for(var i=0;i<ids.length;i++){var c=tree.points[ids[i]];clusters.push(c.id!==-1?this.points[c.id]:getClusterJSON(c))}return clusters},getTile:function(z,x,y){var tree=this.trees[this._limitZoom(z)];var z2=Math.pow(2,z);var extent=this.options.extent;var r=this.options.radius;var p=r/extent;var top=(y-p)/z2;var bottom=(y+1+p)/z2;var tile={features:[]};this._addTileFeatures(tree.range((x-p)/z2,top,(x+1+p)/z2,bottom),tree.points,x,y,z2,tile);if(x===0){this._addTileFeatures(tree.range(1-p/z2,top,1,bottom),tree.points,z2,y,z2,tile)}if(x===z2-1){this._addTileFeatures(tree.range(0,top,p/z2,bottom),tree.points,-1,y,z2,tile)}return tile.features.length?tile:null},_addTileFeatures:function(ids,points,x,y,z2,tile){for(var i=0;i<ids.length;i++){var c=points[ids[i]];tile.features.push({type:1,geometry:[[Math.round(this.options.extent*(c.x*z2-x)),Math.round(this.options.extent*(c.y*z2-y))]],tags:c.id!==-1?this.points[c.id].properties:getClusterProperties(c)})}},_limitZoom:function(z){return Math.max(this.options.minZoom,Math.min(z,this.options.maxZoom+1))},_cluster:function(points,zoom){var clusters=[];var r=this.options.radius/(this.options.extent*Math.pow(2,zoom));for(var i=0;i<points.length;i++){var p=points[i];if(p.zoom<=zoom)continue;p.zoom=zoom;var tree=this.trees[zoom+1];var neighborIds=tree.within(p.x,p.y,r);var foundNeighbors=false;var numPoints=p.numPoints;var wx=p.x*numPoints;var wy=p.y*numPoints;for(var j=0;j<neighborIds.length;j++){var b=tree.points[neighborIds[j]];if(zoom<b.zoom){foundNeighbors=true;b.zoom=zoom;wx+=b.x*b.numPoints;wy+=b.y*b.numPoints;numPoints+=b.numPoints}}clusters.push(foundNeighbors?createCluster(wx/numPoints,wy/numPoints,numPoints,-1):p)}return clusters}};function createCluster(x,y,numPoints,id){return{x:x,y:y,zoom:Infinity,id:id,numPoints:numPoints}}function createPointCluster(p,i){var coords=p.geometry.coordinates;return createCluster(lngX(coords[0]),latY(coords[1]),1,i)}function getClusterJSON(cluster){return{type:"Feature",properties:getClusterProperties(cluster),geometry:{type:"Point",coordinates:[xLng(cluster.x),yLat(cluster.y)]}}}function getClusterProperties(cluster){var count=cluster.numPoints;var abbrev=count>=1e4?Math.round(count/1e3)+"k":count>=1e3?Math.round(count/100)/10+"k":count;return{cluster:true,point_count:count,point_count_abbreviated:abbrev}}function lngX(lng){return lng/360+.5}function latY(lat){var sin=Math.sin(lat*Math.PI/180),y=.5-.25*Math.log((1+sin)/(1-sin))/Math.PI;return y<0?0:y>1?1:y}function xLng(x){return(x-.5)*360}function yLat(y){var y2=(180-y*360)*Math.PI/180;return 360*Math.atan(Math.exp(y2))/Math.PI-90}function extend(dest,src){for(var id in src)dest[id]=src[id];return dest}function getX(p){return p.x}function getY(p){return p.y}},{kdbush:200}],200:[function(require,module,exports){"use strict";var sort=require("./sort");var range=require("./range");var within=require("./within");module.exports=kdbush;function kdbush(points,getX,getY,nodeSize,ArrayType){return new KDBush(points,getX,getY,nodeSize,ArrayType)}function KDBush(points,getX,getY,nodeSize,ArrayType){getX=getX||defaultGetX;getY=getY||defaultGetY;ArrayType=ArrayType||Array;this.nodeSize=nodeSize||64;this.points=points;this.ids=new ArrayType(points.length);this.coords=new ArrayType(points.length*2);for(var i=0;i<points.length;i++){this.ids[i]=i;this.coords[2*i]=getX(points[i]);this.coords[2*i+1]=getY(points[i])}sort(this.ids,this.coords,this.nodeSize,0,this.ids.length-1,0)}KDBush.prototype={range:function(minX,minY,maxX,maxY){return range(this.ids,this.coords,minX,minY,maxX,maxY,this.nodeSize)},within:function(x,y,r){return within(this.ids,this.coords,x,y,r,this.nodeSize)}};function defaultGetX(p){return p[0]}function defaultGetY(p){return p[1]}},{"./range":201,"./sort":202,"./within":203}],201:[function(require,module,exports){"use strict";module.exports=range;function range(ids,coords,minX,minY,maxX,maxY,nodeSize){var stack=[0,ids.length-1,0];var result=[];var x,y;while(stack.length){var axis=stack.pop();var right=stack.pop();var left=stack.pop();if(right-left<=nodeSize){for(var i=left;i<=right;i++){x=coords[2*i];y=coords[2*i+1];if(x>=minX&&x<=maxX&&y>=minY&&y<=maxY)result.push(ids[i])}continue}var m=Math.floor((left+right)/2);x=coords[2*m];y=coords[2*m+1];if(x>=minX&&x<=maxX&&y>=minY&&y<=maxY)result.push(ids[m]);var nextAxis=(axis+1)%2;if(axis===0?minX<=x:minY<=y){stack.push(left);stack.push(m-1);stack.push(nextAxis)}if(axis===0?maxX>=x:maxY>=y){stack.push(m+1);stack.push(right);stack.push(nextAxis)}}return result}},{}],202:[function(require,module,exports){"use strict";module.exports=sortKD;function sortKD(ids,coords,nodeSize,left,right,depth){if(right-left<=nodeSize)return;var m=Math.floor((left+right)/2);select(ids,coords,m,left,right,depth%2);sortKD(ids,coords,nodeSize,left,m-1,depth+1);sortKD(ids,coords,nodeSize,m+1,right,depth+1)}function select(ids,coords,k,left,right,inc){while(right>left){if(right-left>600){var n=right-left+1;var m=k-left+1;var z=Math.log(n);var s=.5*Math.exp(2*z/3);var sd=.5*Math.sqrt(z*s*(n-s)/n)*(m-n/2<0?-1:1);var newLeft=Math.max(left,Math.floor(k-m*s/n+sd));var newRight=Math.min(right,Math.floor(k+(n-m)*s/n+sd));select(ids,coords,k,newLeft,newRight,inc)}var t=coords[2*k+inc];var i=left;var j=right;swapItem(ids,coords,left,k);if(coords[2*right+inc]>t)swapItem(ids,coords,left,right);while(i<j){swapItem(ids,coords,i,j);i++;j--;while(coords[2*i+inc]<t)i++;while(coords[2*j+inc]>t)j--}if(coords[2*left+inc]===t)swapItem(ids,coords,left,j);else{j++;swapItem(ids,coords,j,right)}if(j<=k)left=j+1;if(k<=j)right=j-1}}function swapItem(ids,coords,i,j){swap(ids,i,j);swap(coords,2*i,2*j);swap(coords,2*i+1,2*j+1)}function swap(arr,i,j){var tmp=arr[i];arr[i]=arr[j];arr[j]=tmp}},{}],203:[function(require,module,exports){"use strict";module.exports=within;function within(ids,coords,qx,qy,r,nodeSize){var stack=[0,ids.length-1,0];var result=[];var r2=r*r;while(stack.length){var axis=stack.pop();var right=stack.pop();var left=stack.pop();if(right-left<=nodeSize){for(var i=left;i<=right;i++){if(sqDist(coords[2*i],coords[2*i+1],qx,qy)<=r2)result.push(ids[i])}continue}var m=Math.floor((left+right)/2);var x=coords[2*m];var y=coords[2*m+1];if(sqDist(x,y,qx,qy)<=r2)result.push(ids[m]);var nextAxis=(axis+1)%2;if(axis===0?qx-r<=x:qy-r<=y){stack.push(left);stack.push(m-1);stack.push(nextAxis)}if(axis===0?qx+r>=x:qy+r>=y){stack.push(m+1);stack.push(right);stack.push(nextAxis)}}return result}function sqDist(ax,ay,bx,by){var dx=ax-bx;var dy=ay-by;return dx*dx+dy*dy}},{}],204:[function(require,module,exports){"use strict";module.exports=TinyQueue;function TinyQueue(data,compare){if(!(this instanceof TinyQueue))return new TinyQueue(data,compare);this.data=data||[];this.length=this.data.length;this.compare=compare||defaultCompare;if(data)for(var i=Math.floor(this.length/2);i>=0;i--)this._down(i)}function defaultCompare(a,b){return a<b?-1:a>b?1:0}TinyQueue.prototype={push:function(item){this.data.push(item);this.length++;this._up(this.length-1)},pop:function(){var top=this.data[0];this.data[0]=this.data[this.length-1];this.length--;this.data.pop();this._down(0);return top},peek:function(){return this.data[0]},_up:function(pos){var data=this.data,compare=this.compare;while(pos>0){var parent=Math.floor((pos-1)/2);if(compare(data[pos],data[parent])<0){swap(data,parent,pos);pos=parent}else break}},_down:function(pos){var data=this.data,compare=this.compare,len=this.length;while(true){var left=2*pos+1,right=left+1,min=pos;if(left<len&&compare(data[left],data[min])<0)min=left;if(right<len&&compare(data[right],data[min])<0)min=right;if(min===pos)return;swap(data,min,pos);pos=min}}};function swap(data,i,j){var tmp=data[i];data[i]=data[j];data[j]=tmp}},{}],205:[function(require,module,exports){module.exports=UnitBezier;function UnitBezier(p1x,p1y,p2x,p2y){this.cx=3*p1x;this.bx=3*(p2x-p1x)-this.cx;this.ax=1-this.cx-this.bx;this.cy=3*p1y;this.by=3*(p2y-p1y)-this.cy;this.ay=1-this.cy-this.by;this.p1x=p1x;this.p1y=p2y;this.p2x=p2x;this.p2y=p2y}UnitBezier.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t};UnitBezier.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t};UnitBezier.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx};UnitBezier.prototype.solveCurveX=function(x,epsilon){if(typeof epsilon==="undefined")epsilon=1e-6;var t0,t1,t2,x2,i;for(t2=x,i=0;i<8;i++){x2=this.sampleCurveX(t2)-x;if(Math.abs(x2)<epsilon)return t2;var d2=this.sampleCurveDerivativeX(t2);if(Math.abs(d2)<1e-6)break;t2=t2-x2/d2}t0=0;t1=1;t2=x;if(t2<t0)return t0;if(t2>t1)return t1;while(t0<t1){x2=this.sampleCurveX(t2);if(Math.abs(x2-x)<epsilon)return t2;if(x>x2){t0=t2}else{t1=t2}t2=(t1-t0)*.5+t0}return t2};UnitBezier.prototype.solve=function(x,epsilon){return this.sampleCurveY(this.solveCurveX(x,epsilon))}},{}],206:[function(require,module,exports){module.exports.VectorTile=require("./lib/vectortile.js");module.exports.VectorTileFeature=require("./lib/vectortilefeature.js");module.exports.VectorTileLayer=require("./lib/vectortilelayer.js")},{"./lib/vectortile.js":207,"./lib/vectortilefeature.js":208,"./lib/vectortilelayer.js":209}],207:[function(require,module,exports){"use strict";var VectorTileLayer=require("./vectortilelayer");module.exports=VectorTile;function VectorTile(pbf,end){this.layers=pbf.readFields(readTile,{},end)}function readTile(tag,layers,pbf){if(tag===3){var layer=new VectorTileLayer(pbf,pbf.readVarint()+pbf.pos);if(layer.length)layers[layer.name]=layer}}},{"./vectortilelayer":209}],208:[function(require,module,exports){"use strict";var Point=require("point-geometry");module.exports=VectorTileFeature;function VectorTileFeature(pbf,end,extent,keys,values){this.properties={};this.extent=extent;this.type=0;this._pbf=pbf;this._geometry=-1;this._keys=keys;this._values=values;pbf.readFields(readFeature,this,end)}function readFeature(tag,feature,pbf){if(tag==1)feature.id=pbf.readVarint();else if(tag==2)readTag(pbf,feature);else if(tag==3)feature.type=pbf.readVarint();else if(tag==4)feature._geometry=pbf.pos}function readTag(pbf,feature){var end=pbf.readVarint()+pbf.pos;while(pbf.pos<end){var key=feature._keys[pbf.readVarint()],value=feature._values[pbf.readVarint()];feature.properties[key]=value}}VectorTileFeature.types=["Unknown","Point","LineString","Polygon"];VectorTileFeature.prototype.loadGeometry=function(){var pbf=this._pbf;pbf.pos=this._geometry;var end=pbf.readVarint()+pbf.pos,cmd=1,length=0,x=0,y=0,lines=[],line;while(pbf.pos<end){if(!length){var cmdLen=pbf.readVarint();cmd=cmdLen&7;length=cmdLen>>3}length--;if(cmd===1||cmd===2){x+=pbf.readSVarint();y+=pbf.readSVarint();if(cmd===1){if(line)lines.push(line);line=[]}line.push(new Point(x,y))}else if(cmd===7){if(line){line.push(line[0].clone())}}else{throw new Error("unknown command "+cmd)}}if(line)lines.push(line);return lines};VectorTileFeature.prototype.bbox=function(){var pbf=this._pbf;pbf.pos=this._geometry;var end=pbf.readVarint()+pbf.pos,cmd=1,length=0,x=0,y=0,x1=Infinity,x2=-Infinity,y1=Infinity,y2=-Infinity;while(pbf.pos<end){if(!length){var cmdLen=pbf.readVarint();cmd=cmdLen&7;length=cmdLen>>3}length--;if(cmd===1||cmd===2){x+=pbf.readSVarint();y+=pbf.readSVarint();if(x<x1)x1=x;if(x>x2)x2=x;if(y<y1)y1=y;if(y>y2)y2=y}else if(cmd!==7){throw new Error("unknown command "+cmd)}}return[x1,y1,x2,y2]};VectorTileFeature.prototype.toGeoJSON=function(x,y,z){var size=this.extent*Math.pow(2,z),x0=this.extent*x,y0=this.extent*y,coords=this.loadGeometry(),type=VectorTileFeature.types[this.type],i,j;function project(line){for(var j=0;j<line.length;j++){var p=line[j],y2=180-(p.y+y0)*360/size;line[j]=[(p.x+x0)*360/size-180,360/Math.PI*Math.atan(Math.exp(y2*Math.PI/180))-90]}}switch(this.type){case 1:var points=[];for(i=0;i<coords.length;i++){points[i]=coords[i][0]}coords=points;project(coords);break;case 2:for(i=0;i<coords.length;i++){project(coords[i])}break;case 3:coords=classifyRings(coords);for(i=0;i<coords.length;i++){for(j=0;j<coords[i].length;j++){project(coords[i][j])}}break}if(coords.length===1){coords=coords[0]}else{type="Multi"+type}var result={type:"Feature",geometry:{type:type,coordinates:coords},properties:this.properties};if("id"in this){result.id=this.id}return result};function classifyRings(rings){var len=rings.length;if(len<=1)return[rings];var polygons=[],polygon,ccw;for(var i=0;i<len;i++){var area=signedArea(rings[i]);if(area===0)continue;if(ccw===undefined)ccw=area<0;if(ccw===area<0){if(polygon)polygons.push(polygon);polygon=[rings[i]]}else{polygon.push(rings[i])}}if(polygon)polygons.push(polygon);return polygons}function signedArea(ring){var sum=0;for(var i=0,len=ring.length,j=len-1,p1,p2;i<len;j=i++){p1=ring[i];p2=ring[j];sum+=(p2.x-p1.x)*(p1.y+p2.y)}return sum}},{"point-geometry":196}],209:[function(require,module,exports){"use strict";var VectorTileFeature=require("./vectortilefeature.js");module.exports=VectorTileLayer;function VectorTileLayer(pbf,end){this.version=1;this.name=null;this.extent=4096;this.length=0;this._pbf=pbf;this._keys=[];this._values=[];this._features=[];pbf.readFields(readLayer,this,end);this.length=this._features.length}function readLayer(tag,layer,pbf){if(tag===15)layer.version=pbf.readVarint();else if(tag===1)layer.name=pbf.readString();else if(tag===5)layer.extent=pbf.readVarint();else if(tag===2)layer._features.push(pbf.pos);else if(tag===3)layer._keys.push(pbf.readString());else if(tag===4)layer._values.push(readValueMessage(pbf))}function readValueMessage(pbf){var value=null,end=pbf.readVarint()+pbf.pos;while(pbf.pos<end){var tag=pbf.readVarint()>>3;value=tag===1?pbf.readString():tag===2?pbf.readFloat():tag===3?pbf.readDouble():tag===4?pbf.readVarint64():tag===5?pbf.readVarint():tag===6?pbf.readSVarint():tag===7?pbf.readBoolean():null}return value}VectorTileLayer.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var end=this._pbf.readVarint()+this._pbf.pos;return new VectorTileFeature(this._pbf,end,this.extent,this._keys,this._values)}},{"./vectortilefeature.js":208}],210:[function(require,module,exports){var Pbf=require("pbf");var vtpb=require("./vector-tile-pb");var GeoJSONWrapper=require("./lib/geojson_wrapper");module.exports=fromVectorTileJs;module.exports.fromVectorTileJs=fromVectorTileJs;module.exports.fromGeojsonVt=fromGeojsonVt;module.exports.GeoJSONWrapper=GeoJSONWrapper;function fromVectorTileJs(tile){var layers=[];for(var l in tile.layers){layers.push(prepareLayer(tile.layers[l]))}var out=new Pbf;vtpb.tile.write({layers:layers},out);return out.finish()}function fromGeojsonVt(layers){var l={};for(var k in layers){l[k]=new GeoJSONWrapper(layers[k].features);l[k].name=k}return fromVectorTileJs({layers:l})}function prepareLayer(layer){var preparedLayer={name:layer.name||"",version:layer.version||1,extent:layer.extent||4096,keys:[],values:[],features:[]};var keycache={};var valuecache={};for(var i=0;i<layer.length;i++){var feature=layer.feature(i);feature.geometry=encodeGeometry(feature.loadGeometry());var tags=[];for(var key in feature.properties){var keyIndex=keycache[key];if(typeof keyIndex==="undefined"){preparedLayer.keys.push(key);keyIndex=preparedLayer.keys.length-1;keycache[key]=keyIndex}var value=wrapValue(feature.properties[key]);var valueIndex=valuecache[value.key];if(typeof valueIndex==="undefined"){preparedLayer.values.push(value);valueIndex=preparedLayer.values.length-1;valuecache[value.key]=valueIndex}tags.push(keyIndex);tags.push(valueIndex)}feature.tags=tags;preparedLayer.features.push(feature)}return preparedLayer}function command(cmd,length){return(length<<3)+(cmd&7)}function zigzag(num){return num<<1^num>>31}function encodeGeometry(geometry){var encoded=[];var x=0;var y=0;var rings=geometry.length;for(var r=0;r<rings;r++){var ring=geometry[r];encoded.push(command(1,1));for(var i=0;i<ring.length;i++){if(i===1){encoded.push(command(2,ring.length-1))}var dx=ring[i].x-x;var dy=ring[i].y-y;encoded.push(zigzag(dx),zigzag(dy));x+=dx;y+=dy}}return encoded}function wrapValue(value){var result;var type=typeof value;if(type==="string"){result={string_value:value}}else if(type==="boolean"){result={bool_value:value}}else if(type==="number"){if(value%1!==0){result={double_value:value}}else if(value<0){result={sint_value:value}}else{result={uint_value:value}}}else{value=JSON.stringify(value);result={string_value:value}}result.key=type+":"+value;return result}},{"./lib/geojson_wrapper":211,"./vector-tile-pb":212,pbf:194}],211:[function(require,module,exports){"use strict";var Point=require("point-geometry");var VectorTileFeature=require("vector-tile").VectorTileFeature;module.exports=GeoJSONWrapper;function GeoJSONWrapper(features){this.features=features;this.length=features.length}GeoJSONWrapper.prototype.feature=function(i){return new FeatureWrapper(this.features[i])};function FeatureWrapper(feature){this.id=typeof feature.id==="number"?feature.id:undefined;this.type=feature.type;this.rawGeometry=feature.type===1?[feature.geometry]:feature.geometry;this.properties=feature.tags;this.extent=4096}FeatureWrapper.prototype.loadGeometry=function(){var rings=this.rawGeometry;this.geometry=[];for(var i=0;i<rings.length;i++){var ring=rings[i];var newRing=[];for(var j=0;j<ring.length;j++){newRing.push(new Point(ring[j][0],ring[j][1]))}this.geometry.push(newRing)}return this.geometry};FeatureWrapper.prototype.bbox=function(){if(!this.geometry)this.loadGeometry();var rings=this.geometry;var x1=Infinity;var x2=-Infinity;var y1=Infinity;var y2=-Infinity;for(var i=0;i<rings.length;i++){var ring=rings[i];for(var j=0;j<ring.length;j++){var coord=ring[j];x1=Math.min(x1,coord.x);x2=Math.max(x2,coord.x);y1=Math.min(y1,coord.y);y2=Math.max(y2,coord.y)}}return[x1,y1,x2,y2]};FeatureWrapper.prototype.toGeoJSON=VectorTileFeature.prototype.toGeoJSON},{"point-geometry":196,"vector-tile":206}],212:[function(require,module,exports){"use strict";var tile=exports.tile={read:readTile,write:writeTile};tile.GeomType={Unknown:0,Point:1,LineString:2,Polygon:3};function readTile(pbf,end){return pbf.readFields(readTileField,{layers:[]},end)}function readTileField(tag,tile,pbf){if(tag===3)tile.layers.push(readLayer(pbf,pbf.readVarint()+pbf.pos))}function writeTile(tile,pbf){var i;if(tile.layers!==undefined)for(i=0;i<tile.layers.length;i++)pbf.writeMessage(3,writeLayer,tile.layers[i])}tile.value={read:readValue,write:writeValue};function readValue(pbf,end){return pbf.readFields(readValueField,{},end)}function readValueField(tag,value,pbf){if(tag===1)value.string_value=pbf.readString();else if(tag===2)value.float_value=pbf.readFloat();else if(tag===3)value.double_value=pbf.readDouble();else if(tag===4)value.int_value=pbf.readVarint();else if(tag===5)value.uint_value=pbf.readVarint();else if(tag===6)value.sint_value=pbf.readSVarint();else if(tag===7)value.bool_value=pbf.readBoolean()}function writeValue(value,pbf){if(value.string_value!==undefined)pbf.writeStringField(1,value.string_value);if(value.float_value!==undefined)pbf.writeFloatField(2,value.float_value);if(value.double_value!==undefined)pbf.writeDoubleField(3,value.double_value);if(value.int_value!==undefined)pbf.writeVarintField(4,value.int_value);if(value.uint_value!==undefined)pbf.writeVarintField(5,value.uint_value);if(value.sint_value!==undefined)pbf.writeSVarintField(6,value.sint_value);if(value.bool_value!==undefined)pbf.writeBooleanField(7,value.bool_value)}tile.feature={read:readFeature,write:writeFeature};function readFeature(pbf,end){var feature=pbf.readFields(readFeatureField,{},end);if(feature.type===undefined)feature.type="Unknown";return feature}function readFeatureField(tag,feature,pbf){if(tag===1)feature.id=pbf.readVarint();else if(tag===2)feature.tags=pbf.readPackedVarint();else if(tag===3)feature.type=pbf.readVarint();else if(tag===4)feature.geometry=pbf.readPackedVarint()}function writeFeature(feature,pbf){if(feature.id!==undefined)pbf.writeVarintField(1,feature.id);if(feature.tags!==undefined)pbf.writePackedVarint(2,feature.tags);if(feature.type!==undefined)pbf.writeVarintField(3,feature.type);if(feature.geometry!==undefined)pbf.writePackedVarint(4,feature.geometry)}tile.layer={read:readLayer,write:writeLayer};function readLayer(pbf,end){return pbf.readFields(readLayerField,{features:[],keys:[],values:[]},end)}function readLayerField(tag,layer,pbf){if(tag===15)layer.version=pbf.readVarint();else if(tag===1)layer.name=pbf.readString();else if(tag===2)layer.features.push(readFeature(pbf,pbf.readVarint()+pbf.pos));else if(tag===3)layer.keys.push(pbf.readString());else if(tag===4)layer.values.push(readValue(pbf,pbf.readVarint()+pbf.pos));else if(tag===5)layer.extent=pbf.readVarint()}function writeLayer(layer,pbf){if(layer.version!==undefined)pbf.writeVarintField(15,layer.version);if(layer.name!==undefined)pbf.writeStringField(1,layer.name);var i;if(layer.features!==undefined)for(i=0;i<layer.features.length;i++)pbf.writeMessage(2,writeFeature,layer.features[i]);if(layer.keys!==undefined)for(i=0;i<layer.keys.length;i++)pbf.writeStringField(3,layer.keys[i]);if(layer.values!==undefined)for(i=0;i<layer.values.length;i++)pbf.writeMessage(4,writeValue,layer.values[i]);if(layer.extent!==undefined)pbf.writeVarintField(5,layer.extent)}},{}],213:[function(require,module,exports){var bundleFn=arguments[3];var sources=arguments[4];var cache=arguments[5];var stringify=JSON.stringify;module.exports=function(fn,options){var wkey;var cacheKeys=Object.keys(cache);for(var i=0,l=cacheKeys.length;i<l;i++){var key=cacheKeys[i];var exp=cache[key].exports;if(exp===fn||exp&&exp.default===fn){wkey=key;break}}if(!wkey){wkey=Math.floor(Math.pow(16,8)*Math.random()).toString(16);var wcache={};for(var i=0,l=cacheKeys.length;i<l;i++){var key=cacheKeys[i];wcache[key]=key}sources[wkey]=[Function(["require","module","exports"],"("+fn+")(self)"),wcache]}var skey=Math.floor(Math.pow(16,8)*Math.random()).toString(16);var scache={};scache[wkey]=wkey;sources[skey]=[Function(["require"],"var f = require("+stringify(wkey)+");"+"(f.default ? f.default : f)(self);"),scache];var workerSources={};resolveSources(skey);function resolveSources(key){workerSources[key]=true;for(var depPath in sources[key][1]){var depKey=sources[key][1][depPath];if(!workerSources[depKey]){resolveSources(depKey)}}}var src="("+bundleFn+")({"+Object.keys(workerSources).map(function(key){return stringify(key)+":["+sources[key][0]+","+stringify(sources[key][1])+"]"}).join(",")+"},{},["+stringify(skey)+"])";var URL=window.URL||window.webkitURL||window.mozURL||window.msURL;var blob=new Blob([src],{type:"text/javascript"});if(options&&options.bare){return blob}var workerUrl=URL.createObjectURL(blob);var worker=new Worker(workerUrl);worker.objectURL=workerUrl;return worker}},{}],214:[function(require,module,exports){(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?factory(exports):typeof define==="function"&&define.amd?define(["exports"],factory):factory(global.WhooTS=global.WhooTS||{})})(this,function(exports){function getURL(baseUrl,layer,x,y,z,options){options=options||{};var url=baseUrl+"?"+["bbox="+getTileBBox(x,y,z),"format="+(options.format||"image/png"),"service="+(options.service||"WMS"),"version="+(options.version||"1.1.1"),"request="+(options.request||"GetMap"),"srs="+(options.srs||"EPSG:3857"),"width="+(options.width||256),"height="+(options.height||256),"layers="+layer].join("&");return url}function getTileBBox(x,y,z){y=Math.pow(2,z)-y-1;var min=getMercCoords(x*256,y*256,z),max=getMercCoords((x+1)*256,(y+1)*256,z);return min[0]+","+min[1]+","+max[0]+","+max[1]}function getMercCoords(x,y,z){var resolution=2*Math.PI*6378137/256/Math.pow(2,z),merc_x=x*resolution-2*Math.PI*6378137/2,merc_y=y*resolution-2*Math.PI*6378137/2;return[merc_x,merc_y]}exports.getURL=getURL;exports.getTileBBox=getTileBBox;exports.getMercCoords=getMercCoords;Object.defineProperty(exports,"__esModule",{value:true})})},{}],215:[function(require,module,exports){module.exports={version:"0.26.0"}},{}],216:[function(require,module,exports){(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?factory(exports):typeof define==="function"&&define.amd?define(["exports"],factory):factory(global.topojson=global.topojson||{})})(this,function(exports){"use strict";var identity=function(x){return x};var transform=function(topology){if((transform=topology.transform)==null)return identity;var transform,x0,y0,kx=transform.scale[0],ky=transform.scale[1],dx=transform.translate[0],dy=transform.translate[1];return function(point,i){if(!i)x0=y0=0;point[0]=(x0+=point[0])*kx+dx;point[1]=(y0+=point[1])*ky+dy;return point}};var bbox=function(topology){var bbox=topology.bbox;function bboxPoint(p0){p1[0]=p0[0],p1[1]=p0[1],t(p1);if(p1[0]<x0)x0=p1[0];if(p1[0]>x1)x1=p1[0];if(p1[1]<y0)y0=p1[1];if(p1[1]>y1)y1=p1[1]}function bboxGeometry(o){switch(o.type){case"GeometryCollection":o.geometries.forEach(bboxGeometry);break;case"Point":bboxPoint(o.coordinates);break;case"MultiPoint":o.coordinates.forEach(bboxPoint);break}}if(!bbox){var t=transform(topology),p0,p1=new Array(2),name,x0=Infinity,y0=x0,x1=-x0,y1=-x0;topology.arcs.forEach(function(arc){var i=-1,n=arc.length;while(++i<n){p0=arc[i],p1[0]=p0[0],p1[1]=p0[1],t(p1,i);if(p1[0]<x0)x0=p1[0];if(p1[0]>x1)x1=p1[0];if(p1[1]<y0)y0=p1[1];if(p1[1]>y1)y1=p1[1]}});for(name in topology.objects){bboxGeometry(topology.objects[name])}bbox=topology.bbox=[x0,y0,x1,y1]}return bbox};var reverse=function(array,n){var t,j=array.length,i=j-n;while(i<--j)t=array[i],array[i++]=array[j],array[j]=t};var feature=function(topology,o){return o.type==="GeometryCollection"?{type:"FeatureCollection",features:o.geometries.map(function(o){return feature$1(topology,o)})}:feature$1(topology,o)};function feature$1(topology,o){var id=o.id,bbox=o.bbox,properties=o.properties==null?{}:o.properties,geometry=object(topology,o);return id==null&&bbox==null?{type:"Feature",properties:properties,geometry:geometry}:bbox==null?{type:"Feature",id:id,properties:properties,geometry:geometry}:{type:"Feature",id:id,bbox:bbox,properties:properties,geometry:geometry}}function object(topology,o){var transformPoint=transform(topology),arcs=topology.arcs;function arc(i,points){if(points.length)points.pop();for(var a=arcs[i<0?~i:i],k=0,n=a.length;k<n;++k){points.push(transformPoint(a[k].slice(),k))}if(i<0)reverse(points,n)}function point(p){return transformPoint(p.slice())}function line(arcs){var points=[];for(var i=0,n=arcs.length;i<n;++i)arc(arcs[i],points);if(points.length<2)points.push(points[0].slice());return points}function ring(arcs){var points=line(arcs);while(points.length<4)points.push(points[0].slice());return points}function polygon(arcs){return arcs.map(ring)}function geometry(o){var type=o.type,coordinates;switch(type){case"GeometryCollection":return{type:type,geometries:o.geometries.map(geometry)};case"Point":coordinates=point(o.coordinates);break;case"MultiPoint":coordinates=o.coordinates.map(point);break;case"LineString":coordinates=line(o.arcs);break;case"MultiLineString":coordinates=o.arcs.map(line);break;case"Polygon":coordinates=polygon(o.arcs);break;case"MultiPolygon":coordinates=o.arcs.map(polygon);break;default:return null}return{type:type,coordinates:coordinates}}return geometry(o)}var stitch=function(topology,arcs){var stitchedArcs={},fragmentByStart={},fragmentByEnd={},fragments=[],emptyIndex=-1;arcs.forEach(function(i,j){var arc=topology.arcs[i<0?~i:i],t;if(arc.length<3&&!arc[1][0]&&!arc[1][1]){t=arcs[++emptyIndex],arcs[emptyIndex]=i,arcs[j]=t}});arcs.forEach(function(i){var e=ends(i),start=e[0],end=e[1],f,g;if(f=fragmentByEnd[start]){delete fragmentByEnd[f.end];f.push(i);f.end=end;if(g=fragmentByStart[end]){delete fragmentByStart[g.start];var fg=g===f?f:f.concat(g);
fragmentByStart[fg.start=f.start]=fragmentByEnd[fg.end=g.end]=fg}else{fragmentByStart[f.start]=fragmentByEnd[f.end]=f}}else if(f=fragmentByStart[end]){delete fragmentByStart[f.start];f.unshift(i);f.start=start;if(g=fragmentByEnd[start]){delete fragmentByEnd[g.end];var gf=g===f?f:g.concat(f);fragmentByStart[gf.start=g.start]=fragmentByEnd[gf.end=f.end]=gf}else{fragmentByStart[f.start]=fragmentByEnd[f.end]=f}}else{f=[i];fragmentByStart[f.start=start]=fragmentByEnd[f.end=end]=f}});function ends(i){var arc=topology.arcs[i<0?~i:i],p0=arc[0],p1;if(topology.transform)p1=[0,0],arc.forEach(function(dp){p1[0]+=dp[0],p1[1]+=dp[1]});else p1=arc[arc.length-1];return i<0?[p1,p0]:[p0,p1]}function flush(fragmentByEnd,fragmentByStart){for(var k in fragmentByEnd){var f=fragmentByEnd[k];delete fragmentByStart[f.start];delete f.start;delete f.end;f.forEach(function(i){stitchedArcs[i<0?~i:i]=1});fragments.push(f)}}flush(fragmentByEnd,fragmentByStart);flush(fragmentByStart,fragmentByEnd);arcs.forEach(function(i){if(!stitchedArcs[i<0?~i:i])fragments.push([i])});return fragments};var mesh=function(topology){return object(topology,meshArcs.apply(this,arguments))};function meshArcs(topology,object$$1,filter){var arcs,i,n;if(arguments.length>1)arcs=extractArcs(topology,object$$1,filter);else for(i=0,arcs=new Array(n=topology.arcs.length);i<n;++i)arcs[i]=i;return{type:"MultiLineString",arcs:stitch(topology,arcs)}}function extractArcs(topology,object$$1,filter){var arcs=[],geomsByArc=[],geom;function extract0(i){var j=i<0?~i:i;(geomsByArc[j]||(geomsByArc[j]=[])).push({i:i,g:geom})}function extract1(arcs){arcs.forEach(extract0)}function extract2(arcs){arcs.forEach(extract1)}function extract3(arcs){arcs.forEach(extract2)}function geometry(o){switch(geom=o,o.type){case"GeometryCollection":o.geometries.forEach(geometry);break;case"LineString":extract1(o.arcs);break;case"MultiLineString":case"Polygon":extract2(o.arcs);break;case"MultiPolygon":extract3(o.arcs);break}}geometry(object$$1);geomsByArc.forEach(filter==null?function(geoms){arcs.push(geoms[0].i)}:function(geoms){if(filter(geoms[0].g,geoms[geoms.length-1].g))arcs.push(geoms[0].i)});return arcs}function planarRingArea(ring){var i=-1,n=ring.length,a,b=ring[n-1],area=0;while(++i<n)a=b,b=ring[i],area+=a[0]*b[1]-a[1]*b[0];return Math.abs(area)}var merge=function(topology){return object(topology,mergeArcs.apply(this,arguments))};function mergeArcs(topology,objects){var polygonsByArc={},polygons=[],groups=[];objects.forEach(geometry);function geometry(o){switch(o.type){case"GeometryCollection":o.geometries.forEach(geometry);break;case"Polygon":extract(o.arcs);break;case"MultiPolygon":o.arcs.forEach(extract);break}}function extract(polygon){polygon.forEach(function(ring){ring.forEach(function(arc){(polygonsByArc[arc=arc<0?~arc:arc]||(polygonsByArc[arc]=[])).push(polygon)})});polygons.push(polygon)}function area(ring){return planarRingArea(object(topology,{type:"Polygon",arcs:[ring]}).coordinates[0])}polygons.forEach(function(polygon){if(!polygon._){var group=[],neighbors=[polygon];polygon._=1;groups.push(group);while(polygon=neighbors.pop()){group.push(polygon);polygon.forEach(function(ring){ring.forEach(function(arc){polygonsByArc[arc<0?~arc:arc].forEach(function(polygon){if(!polygon._){polygon._=1;neighbors.push(polygon)}})})})}}});polygons.forEach(function(polygon){delete polygon._});return{type:"MultiPolygon",arcs:groups.map(function(polygons){var arcs=[],n;polygons.forEach(function(polygon){polygon.forEach(function(ring){ring.forEach(function(arc){if(polygonsByArc[arc<0?~arc:arc].length<2){arcs.push(arc)}})})});arcs=stitch(topology,arcs);if((n=arcs.length)>1){for(var i=1,k=area(arcs[0]),ki,t;i<n;++i){if((ki=area(arcs[i]))>k){t=arcs[0],arcs[0]=arcs[i],arcs[i]=t,k=ki}}}return arcs})}}var bisect=function(a,x){var lo=0,hi=a.length;while(lo<hi){var mid=lo+hi>>>1;if(a[mid]<x)lo=mid+1;else hi=mid}return lo};var neighbors=function(objects){var indexesByArc={},neighbors=objects.map(function(){return[]});function line(arcs,i){arcs.forEach(function(a){if(a<0)a=~a;var o=indexesByArc[a];if(o)o.push(i);else indexesByArc[a]=[i]})}function polygon(arcs,i){arcs.forEach(function(arc){line(arc,i)})}function geometry(o,i){if(o.type==="GeometryCollection")o.geometries.forEach(function(o){geometry(o,i)});else if(o.type in geometryType)geometryType[o.type](o.arcs,i)}var geometryType={LineString:line,MultiLineString:polygon,Polygon:polygon,MultiPolygon:function(arcs,i){arcs.forEach(function(arc){polygon(arc,i)})}};objects.forEach(geometry);for(var i in indexesByArc){for(var indexes=indexesByArc[i],m=indexes.length,j=0;j<m;++j){for(var k=j+1;k<m;++k){var ij=indexes[j],ik=indexes[k],n;if((n=neighbors[ij])[i=bisect(n,ik)]!==ik)n.splice(i,0,ik);if((n=neighbors[ik])[i=bisect(n,ij)]!==ij)n.splice(i,0,ij)}}}return neighbors};var quantize=function(topology,n){if(!((n=Math.floor(n))>=2))throw new Error("n must be ≥2");if(topology.transform)throw new Error("already quantized");var bb=bbox(topology),name,dx=bb[0],kx=(bb[2]-dx)/(n-1)||1,dy=bb[1],ky=(bb[3]-dy)/(n-1)||1;function quantizePoint(p){p[0]=Math.round((p[0]-dx)/kx);p[1]=Math.round((p[1]-dy)/ky)}function quantizeGeometry(o){switch(o.type){case"GeometryCollection":o.geometries.forEach(quantizeGeometry);break;case"Point":quantizePoint(o.coordinates);break;case"MultiPoint":o.coordinates.forEach(quantizePoint);break}}topology.arcs.forEach(function(arc){var i=1,j=1,n=arc.length,pi=arc[0],x0=pi[0]=Math.round((pi[0]-dx)/kx),y0=pi[1]=Math.round((pi[1]-dy)/ky),pj,x1,y1;for(;i<n;++i){pi=arc[i];x1=Math.round((pi[0]-dx)/kx);y1=Math.round((pi[1]-dy)/ky);if(x1!==x0||y1!==y0){pj=arc[j++];pj[0]=x1-x0,x0=x1;pj[1]=y1-y0,y0=y1}}if(j<2){pj=arc[j++];pj[0]=0;pj[1]=0}arc.length=j});for(name in topology.objects){quantizeGeometry(topology.objects[name])}topology.transform={scale:[kx,ky],translate:[dx,dy]};return topology};var untransform=function(topology){if((transform=topology.transform)==null)return identity;var transform,x0,y0,kx=transform.scale[0],ky=transform.scale[1],dx=transform.translate[0],dy=transform.translate[1];return function(point,i){if(!i)x0=y0=0;var x1=Math.round((point[0]-dx)/kx),y1=Math.round((point[1]-dy)/ky);point[0]=x1-x0,x0=x1;point[1]=y1-y0,y0=y1;return point}};exports.bbox=bbox;exports.feature=feature;exports.mesh=mesh;exports.meshArcs=meshArcs;exports.merge=merge;exports.mergeArcs=mergeArcs;exports.neighbors=neighbors;exports.quantize=quantize;exports.transform=transform;exports.untransform=untransform;Object.defineProperty(exports,"__esModule",{value:true})})},{}]},{},[13]);
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title></title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.26.0/mapbox-gl.css' rel='stylesheet' />
</head>
<body></body>
<script src='./bundle.js'></script>
</html>
var mapboxgl = require('mapbox-gl')
var d3_selection = require('d3-selection')
var d3_format = require('d3-format')
var topojson = require('topojson-client')
var topology = require('./data.json')
var data = topojson.feature(topology, topology.objects['0'])
data.properties = topology.objects['0'].properties
var specs = [{
key: 'pop',
name: 'Population',
units: 'habitants',
cbUnits: 'millier d\'habitants',
format: ','
}, {
key: 'density',
name: 'Densité de population',
units: 'habitants par km²',
cbUnits: 'millers d\'habitants par km²',
format: ',.2f'
}]
.reverse()
mapboxgl.accessToken = process.env["MAPBOX_TOKEN"]
d3_format.formatDefaultLocale({
decimal: ',',
thousands: ' ',
grouping: [3]
})
d3_selection.select('body')
.append('fieldset')
.style('border', 'none')
.append('select')
.attr('id', 'layer-select')
.selectAll('option')
.data(specs)
.enter()
.append('option')
.attr('value', (d) => d.key)
.text((d) => d.name)
d3_selection.select('body')
.append('div')
.attr('id', 'map')
.style('width', '1000px')
.style('height', '800px')
d3_selection.select('body')
.append('svg')
.attr('width', 1000)
.attr('height', 300)
var map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/mapbox/light-v9',
center: [-73.67563994222256, 45.491548049146814],
zoom: 10,
pitch: 10
})
map.addControl(new mapboxgl.NavigationControl())
var popup = new mapboxgl.Popup({
closeButton: false,
closeOnClick: false
})
map.on('load', () => {
map.addSource('source', {
type: 'geojson',
data: data
})
specs.forEach((spec) => {
addChoroplethLayer(spec)
addExtrudedLayers(spec)
addColorbar(spec)
})
map.on('mousemove', mousemoveHandler)
map.on('click', clickHandler)
setVisibility()
d3_selection.select('#layer-select').on('click', () => {
clearVisibility()
setVisibility()
})
})
function addChoroplethLayer(spec) {
var key = spec.key
map.addLayer({
id: 'choropleth-' + key,
type: 'fill',
source: 'source',
layout: { visibility: 'none' },
paint: {
'fill-color': {
property: key + '-color',
type: 'identity'
},
'fill-outline-color': '#088',
'fill-opacity': 0.7
}
})
}
function addExtrudedLayers(spec) {
var key = spec.key
data.features.forEach((f) => {
var name = f.properties.name
map.addLayer({
id: `extrude-${name}-${key}`,
type: 'fill',
source: 'source',
layout: { visibility: 'none' },
paint: {
'fill-color': {
property: key + '-color',
type: 'identity'
},
'fill-extrude-height': {
property: key + '-z',
type: 'identity'
},
'fill-extrude-base': 0,
'fill-opacity': 0.65
},
filter: ['==', 'name', name]
})
})
}
function addColorbar(spec) {
var key = spec.key
var colorbarData = data.properties[key + '-colorbar']
var formatter = (v) => v / 1e3
var n = colorbarData.length
var w = 50
var h = 30
var colorbar = d3_selection.select('svg').append('g')
.attr('id', 'colorbar-' + key)
.classed('colorbar', true)
.style('cursor', 'pointer')
.style('visibility', 'hidden')
var items = colorbar.selectAll('.item')
.data(colorbarData)
.enter().append('g')
.classed('item', true)
.attr('transform', (_, i) => `translate(${i * w + 5},0)`)
items.append('rect')
.attr('x', 0)
.attr('y', 0)
.attr('width', w)
.attr('height', h)
.attr('fill', (d) => d[1])
items.append('line')
.attr('x1', 0)
.attr('y1', h)
.attr('x2', 0)
.attr('y2', h + 5)
.attr('stroke-width', '1.5')
.attr('stroke', 'black')
items.append('text')
.text((d) => formatter(d[0]))
.attr('x', -5)
.attr('y', 2 * h)
colorbar.append('text')
.text(`${spec.name}`)
.attr('x', `${w * n + 10}`)
.attr('y', h / 2 + 5)
colorbar.append('text')
.text(`[en ${spec.cbUnits}]`)
.attr('x', `${w * n + 10}`)
.attr('y', h + 15)
items.on('click', (d, i) => {
var min = d[0]
var max = colorbarData[i + 1] ? colorbarData[i + 1][0] : Infinity
var featuresWithin = []
data.features.forEach((f) => {
var val = f.properties[key]
if(val >= min && val < max) {
featuresWithin.push(f)
}
})
var areAllFeatureVisible = featuresWithin.every((f) =>
extrudeVisiblity(f, key).get() === 'visible'
)
var newVal = areAllFeatureVisible ? 'none' : 'visible'
featuresWithin.forEach((f) => {
extrudeVisiblity(f, key).set(newVal)
})
})
}
function mousemoveHandler(evt) {
var features = findFeatures(evt)
map.getCanvas().style.cursor = (features.length) ? 'pointer' : ''
if(!features.length) {
popup.remove()
return
}
var spec = getVisibleSpec()
var feature = features[0]
var prop = feature.properties
var lnglat = JSON.parse(prop.centroid)
var formatter = d3_format.format(spec.format)
var html = `
<b>${prop.name}</b><br>
Population: ${formatter(prop[spec.key])} ${spec.units}
`.trim()
popup.setLngLat(new mapboxgl.LngLat(lnglat[0], lnglat[1]))
.setHTML(html)
.addTo(map)
popup._container.onclick = () => {
extrudeVisiblity(feature, spec.key).toggle()
}
}
function clickHandler(evt) {
var features = findFeatures(evt)
if(!features.length) return
var feature = features[0]
var spec = getVisibleSpec()
extrudeVisiblity(feature, spec.key).toggle()
}
function getVisibleSpec() {
var key = d3_selection.select('#layer-select').node().value
return specs.filter((s) => s.key === key)[0]
}
function findFeatures(evt) {
return map.queryRenderedFeatures(evt.point, {
layers: specs.map((s) => 'choropleth-' + s.key)
})
}
function setVisibility() {
var spec = getVisibleSpec()
var key = spec.key
map.setLayoutProperty('choropleth-' + key, 'visibility', 'visible')
d3_selection.select('#colorbar-' + key).style('visibility', null)
}
function clearVisibility() {
specs.forEach((s) => {
var key = s.key
map.setLayoutProperty('choropleth-' + key, 'visibility', 'none')
d3_selection.select('#colorbar-' + key).style('visibility', 'hidden')
data.features.forEach((f) => {
extrudeVisiblity(f, key).set('none')
})
})
}
function extrudeVisiblity(feature, key) {
var name = feature.properties.name
var layerId = `extrude-${name}-${key}`
var get = () => map.getLayoutProperty(layerId, 'visibility')
var set = (val) => map.setLayoutProperty(layerId, 'visibility', val)
var toggle = () => set(get() === 'visible' ? 'none' : 'visible')
return {
get: get,
set: set,
toggle: toggle
}
}
{
"name": "mapbox-gl-extrude",
"version": "1.0.0",
"description": "Try mapbox-gl 3D extrude fill layers",
"main": "index.js",
"scripts": {
"wget": "./wget.sh",
"prestart": "node prestart.js",
"start": "budo index.js --open --live --css node_modules/mapbox-gl/dist/mapbox-gl.css",
"build": "browserify -t es2020 index.js | uglifyjs > bundle.js"
},
"author": "Étienne Tétreault-Pinard",
"license": "MIT",
"dependencies": {
"d3-format": "^1.0.2",
"d3-selection": "^1.0.2",
"mapbox-gl": "^0.26.0",
"topojson-client": "^2.1.0"
},
"devDependencies": {
"@turf/area": "^3.5.2",
"@turf/centroid": "^3.5.2",
"csv-parse": "^1.1.7",
"d3-array": "^1.0.1",
"d3-scale": "^1.0.3",
"es2020": "^1.1.9",
"topojson": "^2.0.0"
}
}
var fs = require('fs')
var parse = require('csv-parse')
var d3_scale = require('d3-scale')
var d3_array = require('d3-array')
var topojson = require('topojson')
var centroid = require('@turf/centroid')
var area = require('@turf/area')
var polygons = require('./raw_data/polygons.json')
var pkg = require('./package.json')
var popCSVpath = 'raw_data/population.csv'
var nameProp = 'NOM'
fs.readFile(popCSVpath, 'utf-8', (err, txt) => {
if(err) throw err
parse(cleanCSV(txt), (err, rows) => {
if(err) throw err
fs.writeFile('data.json', JSON.stringify(makeData(rows)), (err) => {
if(err) throw err
})
})
})
function cleanCSV(txt) {
return txt.split('\n')
.map((line) => line.trim())
.filter((line) => line !== ',,')
.filter((_, i, self) => i < self.length - 3)
.join('\n')
}
function format(s) {
return s
.replace(/\W/g, '')
.toLowerCase()
}
function makeData(rows) {
var data = {
name: pkg.name,
type: 'FeatureCollection'
}
var features = rows2features(rows)
// 'pop' en nombre d'habitants
// 'density' en habitants / km^2
data.features = features
data.properties = {};
[{
key: 'pop', nticks: 10
}, {
key: 'density', nticks: 5
}]
.forEach((spec) => {
var k = spec.key
var domain = [0, d3_array.max(features, (f) => f.properties[k])]
var scaleColor = makeScaleColor(domain)
var scaleZ = makeScaleZ(domain)
features.forEach((f) => {
var v = f.properties[k]
f.properties[k + '-color'] = scaleColor(v)
f.properties[k + '-z'] = scaleZ(v)
})
data.properties[k + '-colorbar'] = makeColorbar(scaleColor, spec.nticks)
})
return convertToTopojson(data)
}
function rows2features(rows) {
var _features = polygons.features
var nameList = _features.map((f) => format(f.properties[nameProp]))
var out = []
rows.forEach((r) => {
var index = nameList.indexOf(format(r[0]))
if(index === -1) return
var pop = Number(r[2])
var _feature = _features[index]
out.push({
type: 'Feature',
geometry: _feature.geometry,
properties: {
name: _feature.properties[nameProp],
pop: pop,
density: pop / area(_feature) * 1e6,
centroid: centroid(_feature).geometry.coordinates
}
})
})
return out
}
function makeScaleColor(domain) {
return d3_scale.scaleSequential(d3_scale.interpolateViridis)
.domain(domain)
}
function makeScaleZ(domain) {
return d3_scale.scaleLinear()
.domain(domain)
.range([0, 1e4])
}
function makeColorbar(scaleColor, nticks) {
var domain = scaleColor.domain()
return d3_array.ticks(domain[0], domain[1], nticks).map((v) =>
[v, scaleColor(v)]
)
}
function convertToTopojson(data) {
var collection = { 0: data }
return topojson.topology(collection)
}
View raw

(Sorry about that, but we can’t show files that are this big right now.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment