torque/dist/torque.full.js
2015-11-25 17:07:13 +01:00

7 lines
219 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.torque=e()}}(function(){var define,module,exports;return function e(t,n,r){function i(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(s)return s(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 i(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var s=typeof require=="function"&&require;for(var o=0;o<r.length;o++)i(r[o]);return i}({1:[function(e,t,n){var r=function(e,t){if(e<0)throw new Error("start must be a positive number");if(e>=t)throw new Error("start must be smaller than end");this.start=e,this.end=t};r.prototype={diff:function(){return this.end-this.start},isLast:function(e){return(e|0)===this.end}},t.exports=r},{}],2:[function(e,t,n){(function(n){function u(e,t){if(!t.steps)throw new Error("steps option missing");this.options=t,this.running=!1,this._tick=this._tick.bind(this),this._t0=+(new Date),this.callback=e,this._time=0,this.itemsReady=!1,this.options=r.extend({animationDelay:0,maxDelta:.2,loop:t.loop===undefined?!0:t.loop},this.options),this.steps(t.steps)}var r=e("./"),i=e("./animator-steps-range"),s=n.requestAnimationFrame||n.mozRequestAnimationFrame||n.webkitRequestAnimationFrame||n.msRequestAnimationFrame||function(e){return n.setTimeout(e,1e3/60)},o=n.cancelAnimationFrame||n.mozCancelAnimationFrame||n.webkitCancelAnimationFrame||n.msCancelAnimationFrame||function(e){clearTimeout(e)};u.prototype={start:function(){this.running=!0,s(this._tick),this.options.onStart&&this.options.onStart(),this.stepsRange().diff()===1&&(this.running=!1)},isRunning:function(){return this.running},stop:function(){this.pause(),this.time(this.stepsRange().start),this.options.onStop&&this.options.onStop()},time:function(e){if(!arguments.length)return this._time;this._time=e;var t=this.range(this.domain(this._time));this.callback(t)},toggle:function(){this.running?this.pause():this.start()},rescale:function(){return this.domainInv=r.math.linear(this.options.animationDelay,this.options.animationDelay+this.options.animationDuration),this.domain=this.domainInv.invert(),this.range=r.math.linear(0,this._defaultStepsRange.end),this.rangeInv=this.range.invert(),this.time(this._time),this.running?this.start():this.pause(),this},duration:function(e){return arguments.length?(this.options.animationDuration=e,this.time()>e&&this.time(0),this.rescale(),this):this.options.animationDuration},steps:function(e){return this.options.steps=e,this._defaultStepsRange=new i(0,e),this.rescale()},stepsRange:function(e,t){if(arguments.length===2){if(e<this._defaultStepsRange.start)throw new Error("start must be within default steps range");if(t>this._defaultStepsRange.end)throw new Error("end must be within default steps range");this._customStepsRange=new i(e,t),this.options.onStepsRange&&this.options.onStepsRange();var n=this.step()|0;(n<e||n>t)&&this.step(e)}return this._customStepsRange||this._defaultStepsRange},removeCustomStepsRange:function(){this._customStepsRange=undefined,this.options.onStepsRange&&this.options.onStepsRange()},step:function(e){if(arguments.length===0)return this.range(this.domain(this._time));this._time=this.domainInv(this.rangeInv(e))},pause:function(){this.running=!1,o(this._tick),this.options.onPause&&this.options.onPause()},_tick:function(){var e=+(new Date),t=(e-this._t0)*.001;t=Math.min(this.options.maxDelta,t),this._t0=e,this._time+=t;var n=this.stepsRange();n.isLast(this.step())&&(this.options.loop?this.step(n.start):(this.time(this.options.animationDuration),this.pause())),this.running&&(this.time(this._time),s(this._tick))}},t.exports=u}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"./":11,"./animator-steps-range":1}],3:[function(e,t,n){var r={version:"1.0.0",style:{"comp-op":{css:"comp-op","default-value":"src-over","default-meaning":"add the current layer on top of other layers",doc:"Composite operation. This defines how this layer should behave relative to layers atop or below it.",type:["src","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","darken","lighten"]}},layer:{"buffer-size":{"default-value":"0",type:"float","default-meaning":"No buffer will be used",doc:"Extra tolerance around the Layer extent (in pixels) used to when querying and (potentially) clipping the layer data during rendering"},"-torque-clear-color":{css:"-torque-clear-color",type:"color","default-value":"rgba(255, 255, 255, 0)","default-meaning":"full clear",doc:"color used to clear canvas on each frame"},"-torque-frame-count":{css:"-torque-frame-count","default-value":"128",type:"number","default-meaning":"the data is broken into 128 time frames",doc:"Number of animation steps/frames used in the animation. If the data contains a fewere number of total frames, the lesser value will be used."},"-torque-resolution":{css:"-torque-resolution","default-value":"2",type:"number","default-meaning":"",doc:"Spatial resolution in pixels. A resolution of 1 means no spatial aggregation of the data. Any other resolution of N results in spatial aggregation into cells of NxN pixels. The value N must be power of 2"},"-torque-animation-duration":{css:"-torque-animation-duration","default-value":"30",type:"number","default-meaning":"the animation lasts 30 seconds",doc:"Animation duration in seconds"},"-torque-aggregation-function":{css:"-torque-aggregation-function","default-value":"count(cartodb_id)",type:"string","default-meaning":"the value for each cell is the count of points in that cell",doc:"A function used to calculate a value from the aggregate data for each cell. See -torque-resolution"},"-torque-time-attribute":{css:"-torque-time-attribute","default-value":"time",type:"string","default-meaning":"the data column in your table that is of a time based type",doc:"The table column that contains the time information used create the animation"},"-torque-data-aggregation":{css:"-torque-data-aggregation","default-value":"linear",type:["cumulative"],"default-meaning":"previous values are discarded",doc:"A linear animation will discard previous values while a cumulative animation will accumulate them until it restarts"}},symbolizers:{"*":{"comp-op":{css:"comp-op","default-value":"src-over","default-meaning":"add the current layer on top of other layers",doc:"Composite operation. This defines how this layer should behave relative to layers atop or below it.",type:["src","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","darken","lighten"]},opacity:{css:"opacity",type:"float",doc:"An alpha value for the style (which means an alpha applied to all features in separate buffer and then composited back to main buffer)","default-value":1,"default-meaning":"no separate buffer will be used and no alpha will be applied to the style after rendering"}},trail:{steps:{css:"trail-steps",type:"float","default-value":1,"default-meaning":"no trail steps",doc:"How many steps of trails are going to be rendered"}},polygon:{fill:{css:"polygon-fill",type:"color","default-value":"rgba(128,128,128,1)","default-meaning":"gray and fully opaque (alpha = 1), same as rgb(128,128,128)",doc:"Fill color to assign to a polygon"},"fill-opacity":{css:"polygon-opacity",type:"float",doc:"The opacity of the polygon","default-value":1,"default-meaning":"opaque"}},line:{stroke:{css:"line-color","default-value":"rgba(0,0,0,1)",type:"color","default-meaning":"black and fully opaque (alpha = 1), same as rgb(0,0,0)",doc:"The color of a drawn line"},"stroke-width":{css:"line-width","default-value":1,type:"float",doc:"The width of a line in pixels"},"stroke-opacity":{css:"line-opacity","default-value":1,type:"float","default-meaning":"opaque",doc:"The opacity of a line"},"stroke-linejoin":{css:"line-join","default-value":"miter",type:["miter","round","bevel"],doc:"The behavior of lines when joining"},"stroke-linecap":{css:"line-cap","default-value":"butt",type:["butt","round","square"],doc:"The display of line endings"}},markers:{file:{css:"marker-file",doc:"An SVG file that this marker shows at each placement. If no file is given, the marker will show an ellipse.","default-value":"","default-meaning":"An ellipse or circle, if width equals height",type:"uri"},opacity:{css:"marker-opacity",doc:"The overall opacity of the marker, if set, overrides both the opacity of both the fill and stroke","default-value":1,"default-meaning":"The stroke-opacity and fill-opacity will be used",type:"float"},"fill-opacity":{css:"marker-fill-opacity",doc:"The fill opacity of the marker","default-value":1,"default-meaning":"opaque",type:"float"},stroke:{css:"marker-line-color",doc:"The color of the stroke around a marker shape.","default-value":"black",type:"color"},"stroke-width":{css:"marker-line-width",doc:"The width of the stroke around a marker shape, in pixels. This is positioned on the boundary, so high values can cover the area itself.",type:"float"},"stroke-opacity":{css:"marker-line-opacity","default-value":1,"default-meaning":"opaque",doc:"The opacity of a line",type:"float"},fill:{css:"marker-fill","default-value":"blue",doc:"The color of the area of the marker.",type:"color"},"marker-type":{css:"marker-type",type:["rectangle","ellipse"],"default-value":"ellipse",doc:"The default marker-type. If a SVG file is not given as the marker-file parameter, the renderer provides either an rectangle or an ellipse (a circle if height is equal to width)"},width:{css:"marker-width","default-value":10,doc:"The width of the marker, if using one of the default types.",type:"float"}},point:{file:{css:"point-file",type:"uri",required:!1,"default-value":"none",doc:"Image file to represent a point"},opacity:{css:"point-opacity",type:"float","default-value":1,"default-meaning":"Fully opaque",doc:"A value from 0 to 1 to control the opacity of the point"}}},colors:{aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50],transparent:[0,0,0,0]}};t.exports={version:{latest:r,"1.0.0":r}}},{}],4:[function(e,t,n){(function(n){function i(){}var r=n.carto||e("carto");i.prototype={},i.optionsFromLayer=function(e){var t={};if(!e)return t;var n={"buffer-size":"buffer-size","-torque-frame-count":"steps","-torque-resolution":"resolution","-torque-animation-duration":"animationDuration","-torque-aggregation-function":"countby","-torque-time-attribute":"column","-torque-data-aggregation":"data_aggregation"};for(var r in n){var i=e.eval(r);if(i!==undefined){var s=n[r];t[s]=i}}return t},i.optionsFromCartoCSS=function(e){var t=(new r.RendererJS).render(e),n=t.findLayer({name:"Map"});return i.optionsFromLayer(n)},t.exports.TorqueLayer=i}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{carto:38}],5:[function(e,t,n){(function(e){function r(){var e=arguments,t=e[0];for(var n=1;n<e.length;++n){var r=e[n];for(var i in r)t[i]=r[i]}return t}function i(e){return r({},e)}function s(e){return typeof e=="function"||!1}function o(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)=="[object Array]"}function a(){return!!document.createElement("canvas")}function f(){return typeof navigator!="undefined"?navigator.userAgent:""}var n={};n.on=function(e,t){var n=this._evt_callbacks=this._evt_callbacks||{},r=n[e]||(n[e]=[]);return r.push(t),this},n.trigger=function(e){var t=this._evt_callbacks&&this._evt_callbacks[e];for(var n=0;t&&n<t.length;++n)t[n].apply(this,Array.prototype.slice.call(arguments,1));return this},n.fire=n.trigger,n.off=function(e,t){var n=this._evt_callbacks&&this._evt_callbacks[e];if(n&&!t)return delete this._evt_callbacks[e],this;var r=[];for(var i=0;n&&i<n.length;++i)n[i]===t&&r.push(i);while((i=r.pop())!==undefined)n.splice(i,1);return this},n.callbacks=function(e){return this._evt_callbacks&&this._evt_callbacks[e]||[]};var u={Uint8Array:typeof e.Uint8Array!="undefined"?e.Uint8Array:Array,Uint8ClampedArray:typeof e.Uint8ClampedArray!="undefined"?e.Uint8ClampedArray:Array,Uint32Array:typeof e.Uint32Array!="undefined"?e.Uint32Array:Array,Int16Array:typeof e.Int16Array!="undefined"?e.Int16Array:Array,Int32Array:typeof e.Int32Array!="undefined"?e.Int32Array:Array},l={sprites_to_images:f().indexOf("Safari")===-1&&f().indexOf("Firefox")===-1};t.exports={Event:n,extend:r,clone:i,isFunction:s,isArray:o,types:u,isBrowserSupported:a,flags:l}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],6:[function(e,t,n){function r(e){function n(e,t){return function(){t.apply(e)}}this.isAdded_=!1,this.isAnimated_=!1,this.paneName_=r.DEFAULT_PANE_NAME_,this.updateHandler_=null,this.resizeHandler_=null,this.topLeft_=null,this.centerListener_=null,this.resizeListener_=null,this.needsResize_=!0,this.requestAnimationFrameId_=null;var t=document.createElement("canvas");t.style.position="absolute",t.style.top=0,t.style.left=0,t.style.pointerEvents="none",this.canvas=t,this.repositionFunction_=n(this,this.repositionCanvas_),this.resizeFunction_=n(this,this.resize_),this.requestUpdateFunction_=n(this,this.update_),e&&this.setOptions(e)}r.prototype=new google.maps.OverlayView,r.DEFAULT_PANE_NAME_="overlayLayer",r.CSS_TRANSFORM_=function(){var e=document.createElement("div"),t=["transform","WebkitTransform","MozTransform","OTransform","msTransform"];for(var n=0;n<t.length;n++){var r=t[n];if(e.style[r]!==undefined)return r}return t[0]}(),r.prototype.requestAnimFrame_=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){return window.setTimeout(e,1e3/60)},r.prototype.cancelAnimFrame_=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame||function(e){},r.prototype.setOptions=function(e){e.animate!==undefined&&this.setAnimate(e.animate),e.paneName!==undefined&&this.setPane(e.paneName),e.updateHandler!==undefined&&this.setUpdateHandler(e.updateHandler),e.resizeHandler!==undefined&&this.setResizeHandler(e.resizeHandler),e.readyHandler&&(this.readyHandler=e.readyHandler)},r.prototype.setAnimate=function(e){this.isAnimated_=!!e,this.isAnimated_&&this.scheduleUpdate()},r.prototype.isAnimated=function(){return this.isAnimated_},r.prototype.setPaneName=function(e){this.paneName_=e,this.setPane_()},r.prototype.setOpacity=function(e){this.canvas.style.opacity=e},r.prototype.getOpacity=function(){return this.canvas.style.opacity},r.prototype.getPaneName=function(){return this.paneName_},r.prototype.setPane_=function(){if(!this.isAdded_)return;var e=this.getPanes();if(!e[this.paneName_])throw new Error('"'+this.paneName_+'" is not a valid MapPane name.');e[this.paneName_].appendChild(this.canvas)},r.prototype.setResizeHandler=function(e){this.resizeHandler_=e},r.prototype.setUpdateHandler=function(e){this.updateHandler_=e},r.prototype.onAdd=function(){if(this.isAdded_)return;this.isAdded_=!0,this.setPane_(),this.resizeListener_=google.maps.event.addListener(this.getMap(),"resize",this.resizeFunction_),this.centerListener_=google.maps.event.addListener(this.getMap(),"center_changed",this.repositionFunction_),this.resize_(),this.repositionCanvas_(),this.readyHandler&&this.readyHandler()},r.prototype.onRemove=function(){if(!this.isAdded_)return;this.isAdded_=!1,this.topLeft_=null,this.canvas.parentElement.removeChild(this.canvas),this.centerListener_&&(google.maps.event.removeListener(this.centerListener_),this.centerListener_=null),this.resizeListener_&&(google.maps.event.removeListener(this.resizeListener_),this.resizeListener_=null),this.requestAnimationFrameId_&&(this.cancelAnimFrame_.call(window,this.requestAnimationFrameId_),this.requestAnimationFrameId_=null)},r.prototype.resize_=function(){if(!this.isAdded_)return;var e=this.getMap(),t=e.getDiv().offsetWidth,n=e.getDiv().offsetHeight,r=this.canvas.width,i=this.canvas.height;if(r!==t||i!==n)this.canvas.width=t,this.canvas.height=n,this.canvas.style.width=t+"px",this.canvas.style.height=n+"px",this.needsResize_=!0,this.scheduleUpdate()},r.prototype.draw=function(){this.repositionCanvas_()},r.prototype.repositionCanvas_=function(){var e=this.getMap().getBounds();this.topLeft_=new google.maps.LatLng(e.getNorthEast().lat(),e.getSouthWest().lng());var t=this.getProjection(),n=t.fromLatLngToDivPixel(this.topLeft_),i=(1<<this.getMap().getZoom())*256;Math.abs(n.x)>i&&(n.x-=i),this.canvas.style[r.CSS_TRANSFORM_]="translate("+Math.round(n.x)+"px,"+Math.round(n.y)+"px)",this.scheduleUpdate()},r.prototype.update_=function(){this.requestAnimationFrameId_=null;if(!this.isAdded_)return;this.isAnimated_&&this.scheduleUpdate(),this.needsResize_&&this.resizeHandler_&&(this.needsResize_=!1,this.resizeHandler_()),this.updateHandler_&&this.updateHandler_()},r.prototype.getTopLeft=function(){return this.topLeft_},r.prototype.scheduleUpdate=function(){this.isAdded_&&!this.requestAnimationFrameId_&&(this.requestAnimationFrameId_=this.requestAnimFrame_.call(window,this.requestUpdateFunction_))},t.exports=r},{}],7:[function(e,t,n){function r(e,t){this.tileSize=new google.maps.Size(256,256),this.maxZoom=19,this.name="Tile #s",this.alt="Canvas tile layer",this.tiles={},this.canvas_setup=e,this.render=t,t||(this.render=e)}r.prototype.create_tile_canvas=function(e,t,n){var r=n.createElement("canvas"),i=n.createElement("canvas");r.style.border=i.style.border="none",r.style.margin=i.style.margin="0",r.style.padding=i.style.padding="0";var s=r.getContext("2d");s.width=r.width=this.tileSize.width,s.height=r.height=this.tileSize.height;var o=i.getContext("2d");i.width=o.width=this.tileSize.width,i.height=o.height=this.tileSize.height;var u=e.x+"_"+e.y+"_"+t;return r.setAttribute("id",u),i.setAttribute("id",u),u in this.tiles&&delete this.tiles[u],this.tiles[u]={canvas:r,ctx:s,hit_canvas:i,hit_ctx:o,coord:e,zoom:t,primitives:null},this.canvas_setup&&this.canvas_setup(this.tiles[u],e,t),r},r.prototype.each=function(e){for(var t in this.tiles){var n=this.tiles[t];e(n)}},r.prototype.recreate=function(){for(var e in this.tiles){var t=this.tiles[e];this.canvas_setup(t,t.coord,t.zoom)}},r.prototype.redraw_tile=function(e){this.render(e,e.coord,e.zoom)},r.prototype.redraw=function(){for(var e in this.tiles){var t=this.tiles[e];this.render(t,t.coord,t.zoom)}},r.prototype.getTile=function(e,t,n){return this.create_tile_canvas(e,t,n)},r.prototype.releaseTile=function(e){var t=e.getAttribute("id");delete this.tiles[t]},t.exports=r},{}],8:[function(e,t,n){function r(){}r.prototype={_initTileLoader:function(e,t){this._map=e,this._projection=t,this._tiles={},this._tilesLoading={},this._tilesToLoad=0,this._updateTiles=this._updateTiles.bind(this),this._listeners=[],this._listeners.push(google.maps.event.addListener(this._map,"dragend",this._updateTiles),google.maps.event.addListener(this._map,"zoom_changed",this._updateTiles)),this.tileSize=256,this._updateTiles()},_removeTileLoader:function(){this._listeners.forEach(function(e){google.maps.event.removeListener(e)}),this._removeTiles()},_removeTiles:function(){for(var e in this._tiles)this._removeTile(e)},_reloadTiles:function(){this._removeTiles(),this._updateTiles()},_updateTiles:function(){if(!this._map)return;var e=this._map.getBounds(),t=this._map.getZoom(),n=this.tileSize,r=1<<t,i=new google.maps.LatLng(e.getNorthEast().lat(),e.getSouthWest().lng()),s=new google.maps.LatLng(e.getSouthWest().lat(),e.getNorthEast().lng());this._projection=this._map.getProjection();var o=this._projection.fromLatLngToPoint(i),u=this._projection.fromLatLngToPoint(s),a=new google.maps.Point(Math.floor(o.x*r/n),Math.floor(o.y*r/n)),f=new google.maps.Point(Math.floor(u.x*r/n),Math.floor(u.y*r/n));this._addTilesFromCenterOut(a,f),this._removeOtherTiles(a,f)},_removeOtherTiles:function(e,t){var n,r,i,s,o=this._map.getZoom();for(s in this._tiles)this._tiles.hasOwnProperty(s)&&(n=s.split(":"),r=parseInt(n[0],10),i=parseInt(n[1],10),z=parseInt(n[2],10),(z!==o||r<e.x||r>t.x||i<e.y||i>t.y)&&this._removeTile(s))},_removeTile:function(e){this.onTileRemoved&&this.onTileRemoved(this._tiles[e]),delete this._tiles[e],delete this._tilesLoading[e]},_tileKey:function(e){return e.x+":"+e.y+":"+e.zoom},_tileShouldBeLoaded:function(e){var t=this._tileKey(e);return!(t in this._tiles)&&!(t in this._tilesLoading)},_tileLoaded:function(e,t){this._tilesToLoad--;var n=e.x+":"+e.y+":"+e.zoom;this._tiles[n]=t,delete this._tilesLoading[n],this._tilesToLoad===0&&this.onTilesLoaded&&this.onTilesLoaded()},getTilePos:function(e){var t=1<<this._map.getZoom();e={x:(e.x%t+t)%t,y:e.y},e=new google.maps.Point(e.x*this.tileSize,e.y*this.tileSize);var n=this._map.getBounds(),r=new google.maps.LatLng(n.getNorthEast().lat(),n.getSouthWest().lng()),i=this._map.getProjection().fromLatLngToPoint(r);return zoom=1<<this._map.getZoom(),i.x=i.x*zoom,i.y=i.y*zoom,new google.maps.Point(e.x-i.x,e.y-i.y)},_addTilesFromCenterOut:function(e,t){function f(e){var t=e.x-r.x,n=e.y-r.y;return t*t+n*n}var n=[],r=new google.maps.Point((e.x+t.x)*.5,(e.y+t.y)*.5),i=this._map.getZoom(),s,o,u;for(s=e.y;s<=t.y;s++)for(o=e.x;o<=t.x;o++)u=new google.maps.Point(o,s),u.zoom=i,this._tileShouldBeLoaded(u)&&n.push(u);var a=n.length;if(a===0)return;n.sort(function(e,t){return f(e)-f(t)}),this._tilesToLoad+=a;for(o=0;o<a;o++){var l=n[o],c=this._tileKey(l);this._tilesLoading[c]=l,this.onTileAdded&&this.onTileAdded(l)}this.onTilesLoading&&this.onTilesLoading()}},t.exports=r},{}],9:[function(e,t,n){var r={};typeof google!="undefined"&&typeof google.maps!="undefined"&&(r=e("./torque"),r.GMapsTileLoader=e("./gmaps_tileloader_mixin")),t.exports=r},{"./gmaps_tileloader_mixin":8,"./torque":10}],10:[function(e,t,n){(function(n){function a(e){var t=this;if(!i.isBrowserSupported())throw new Error("browser is not supported by torque");this.key=0,this.shader=null,this.ready=!1,this.options=i.extend({},e),this.options=i.extend({provider:"windshaft",renderer:"point",resolution:2,steps:100,visible:!0},this.options),e.cartocss&&i.extend(this.options,i.common.TorqueLayer.optionsFromCartoCSS(e.cartocss)),e.tileJSON&&(this.options.provider="tileJSON"),this.hidden=!this.options.visible,this.animator=new i.Animator(function(e){var n=e|0;t.key!==n&&t.setKey(n)},i.extend(i.clone(this.options),{onPause:function(){t.fire("pause")},onStop:function(){t.fire("stop")},onStart:function(){t.fire("play")},onStepsRange:function(){t.fire("change:stepsRange",t.animator.stepsRange())}})),this.play=this.animator.start.bind(this.animator),this.stop=this.animator.stop.bind(this.animator),this.pause=this.animator.pause.bind(this.animator),this.toggle=this.animator.toggle.bind(this.animator),this.setDuration=this.animator.duration.bind(this.animator),this.isRunning=this.animator.isRunning.bind(this.animator),s.call(this,{map:this.options.map,animate:!1,updateHandler:this.render,readyHandler:this.initialize})}function f(e){this.options=i.extend({},e),o.call(this,this._loadTile.bind(this),this.drawTile.bind(this)),this.initialize(e)}var r=n.carto||e("carto"),i=e("../"),s=e("./CanvasLayer"),o=e("./canvas_tile_layer"),u=e("./gmaps_tileloader_mixin");a.prototype=i.extend({},s.prototype,u.prototype,i.Event,{providers:{sql_api:i.providers.json,url_template:i.providers.JsonArray,windshaft:i.providers.windshaft,tileJSON:i.providers.tileJSON},renderers:{point:i.renderer.Point,pixel:i.renderer.Rectangle},initialize:function(){var e=this;this.onTileAdded=this.onTileAdded.bind(this),this.options.ready=function(){e.fire("change:bounds",{bounds:e.provider.getBounds()}),e.animator.steps(e.provider.getSteps()),e.animator.rescale(),e.fire("change:steps",{steps:e.provider.getSteps()}),e.setKey(e.key)},this.provider=new this.providers[this.options.provider](this.options),this.renderer=new this.renderers[this.options.renderer](this.getCanvas(),this.options),this.renderer.options.errorCallback=this.options.errorCallback,this._cacheListener=google.maps.event.addListener(this.options.map,"zoom_changed",function(){e.renderer&&e.renderer.clearSpriteCache()}),this._initTileLoader(this.options.map,this.getProjection()),this.shader&&this.renderer.setShader(this.shader)},hide:function(){return this.hidden?this:(this.pause(),this.clear(),this.hidden=!0,this)},show:function(){return this.hidden?(this.hidden=!1,this.play(),this.options.steps===1&&this.redraw(),this):this},setSQL:function(e){if(this.provider.options.named_map)throw new Error("SQL queries on named maps are read-only");if(!this.provider||!this.provider.setSQL)throw new Error("this provider does not support SQL");return this.provider.setSQL(e),this._reloadTiles(),this},setBlendMode:function(e){this.renderer&&this.renderer.setBlendMode(e),this.redraw()},setSteps:function(e){this.provider&&this.provider.setSteps(e),this.animator&&this.animator.steps(e),this._reloadTiles()},setColumn:function(e,t){this.provider&&this.provider.setColumn(e,t),this._reloadTiles()},getTimeBounds:function(){return this.provider&&this.provider.getKeySpan()},getCanvas:function(){return this.canvas},onTileAdded:function(e){var t=this;this.provider.getTileData(e,e.zoom,function(n){if(e.zoom!==t.options.map.getZoom())return;t._tileLoaded(e,n),t.fire("tileLoaded"),n&&t.redraw()})},clear:function(){var e=this.canvas;e.width=e.width},render:function(){if(this.hidden)return;var e,t,n,r=this.canvas;this.renderer.clearCanvas();var i=r.getContext("2d");for(e in this._tiles)t=this._tiles[e],t&&(n=this.getTilePos(t.coord),i.setTransform(1,0,0,1,n.x,n.y),this.renderer.renderTile(t,this.key));this.renderer.applyFilters()},getActivePointsBBox:function(e){var t=[],n=this.options.resolution*(256/this.options.resolution-1);for(var r in this._tiles){var i=this._tiles[r];t=t.concat(this.renderer.getActivePointsBBox(i,e))}return t},setKey:function(e){this.key=e,this.animator.step(e),this.redraw(),this.fire("change:time",{time:this.getTime(),step:this.key})},setStep:function(e){if(e===undefined||e.length!==undefined)throw new Error("setTime only accept scalars");this.setKey(e)},stepToTime:function(e){if(!this.provider)return 0;var t=this.provider.getKeySpan(),n=t.start+(t.end-t.start)*(e/this.provider.getSteps());return new Date(n)},timeToStep:function(e){typeof e=="Date"&&(e=e.getTime());if(!this.provider)return 0;var t=this.provider.getKeySpan(),n=this.provider.getSteps()*(e-t.start)/(t.end-t.start);return n},getStep:function(){return this.key},getTime:function(){return this.stepToTime(this.key)},setCartoCSS:function(e){if(this.provider&&this.provider.options.named_map)throw new Error("CartoCSS style on named maps is read-only");var t=(new r.RendererJS).render(e);this.shader=t,this.renderer&&this.renderer.setShader(t);var n=i.common.TorqueLayer.optionsFromLayer(t.findLayer({name:"Map"}));return this.provider&&this.provider.setCartoCSS&&this.provider.setCartoCSS(e),this.provider&&this.provider.setOptions(n)&&this._reloadTiles(),i.extend(this.options,n),n.animationDuration&&this.animator.duration(n.animationDuration),this.redraw(),this},redraw:function(){this.scheduleUpdate()},onRemove:function(){this.fire("remove"),s.prototype.onRemove.call(this),this.animator.stop(),this._removeTileLoader(),google.maps.event.removeListener(this._cacheListener)},getValues:function(e){var t=[];e=e===undefined?this.key:e;var n,r;for(n in this._tiles)r=this._tiles[n],this.renderer.getValues(r,e,t);return t},getValueForPos:function(e,t,n){n=n===undefined?this.key:n;var r,i,s,o=null,u,a;for(r in this._tiles){i=this._tiles[r],s=this.getTilePos(i.coord),u=e-s.x,a=t-s.y,u>=0&&a>=0&&u<this.renderer.TILE_SIZE&&a<=this.renderer.TILE_SIZE&&(o=this.renderer.getValueFor(i,n,u,a));if(o!==null)return o}return null},getValueForBBox:function(e,t,n,r){var i=e+n,s=t+r,o=0;for(_y=t;t<s;t+=this.options.resolution)for(_x=e;e<i;e+=this.options.resolution){var u=this.getValueForPos(_x,_y);if(u){var a=u.bbox,f=this.getProjection(),l=f.fromLatLngToContainerPixel(new google.maps.LatLng(a[1].lat,a[1].lon));l.x<i&&l.y<s&&(o+=u.value)}}return o},error:function(e){return this.options.errorCallback=e,this}}),f.prototype=i.extend({},o.prototype,{providers:{sql_api:i.providers.json,url_template:i.providers.JsonArray},renderers:{point:i.renderer.Point,pixel:i.renderer.Rectangle},initialize:function(e){var t=this;this.key=0,this.options.renderer=this.options.renderer||"pixel",this.options.provider=this.options.provider||"sql_api",this.provider=new this.providers[this.options.provider](e),this.renderer=new this.renderers[this.options.renderer](null,e)},_tileLoaded:function(e,t){e.data=t,this.drawTile(e)},_loadTile:function(e,t,n){var r=this,i=1<<n,s={x:(t.x%i+i)%i,y:t.y};this.provider.getTileData(s,n,function(t){r._tileLoaded(e,t)})},drawTile:function(e){var t=e.canvas;if(!e.data)return;t.width=t.width,this.renderer.setCanvas(t);var n=this.renderer.accumulate(e.data,this.key);this.renderer.renderTileAccum(n,0,0)},setKey:function(e){this.key=e,this.redraw()},setCartoCSS:function(e){if(!this.renderer)throw new Error("renderer is not valid");return this.renderer.setCartoCSS(e)},setStepsRange:function(e,t){this.animator.stepsRange(e,t)},removeStepsRange:function(){this.animator.removeCustomStepsRange()},getStepsRange
:function(){return this.animator.stepsRange()}}),t.exports={GMapsTiledTorqueLayer:f,GMapsTorqueLayer:a}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"../":11,"./CanvasLayer":6,"./canvas_tile_layer":7,"./gmaps_tileloader_mixin":8,carto:38}],11:[function(e,t,n){t.exports=e("./core"),t.exports.Animator=e("./animator"),t.exports.cartocss_reference=e("./cartocss_reference"),t.exports.common=e("./common"),t.exports.math=e("./math"),t.exports.Mercator=e("./mercator"),t.exports.net=e("./request"),t.exports.renderer=e("./renderer"),t.exports.providers=e("./provider"),e("./leaflet");var r=e("./gmaps");t.exports.GMapsTileLoader=r.GMapsTileLoader,t.exports.GMapsTorqueLayer=r.GMapsTorqueLayer,t.exports.GMapsTiledTorqueLayer=r.GMapsTiledTorqueLayer},{"./animator":2,"./cartocss_reference":3,"./common":4,"./core":5,"./gmaps":9,"./leaflet":13,"./math":16,"./mercator":17,"./provider":19,"./renderer":25,"./request":29}],12:[function(e,t,n){e("./leaflet_tileloader_mixin"),L.CanvasLayer=L.Class.extend({includes:[L.Mixin.Events,L.Mixin.TileLoader],options:{minZoom:0,maxZoom:28,tileSize:256,subdomains:"abc",errorTileUrl:"",attribution:"",zoomOffset:0,opacity:1,unloadInvisibleTiles:L.Browser.mobile,updateWhenIdle:L.Browser.mobile,tileLoader:!1,zoomAnimation:!0},initialize:function(e){var t=this;e=e||{},this.render=this.render.bind(this),L.Util.setOptions(this,e),this._canvas=this._createCanvas(),this.options.zoomAnimation&&(this._backCanvas=this._createCanvas()),this._ctx=this._canvas.getContext("2d"),this.currentAnimationFrame=-1,this.requestAnimationFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||function(e){return window.setTimeout(e,1e3/60)},this.cancelAnimationFrame=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame||function(e){clearTimeout(e)}},_createCanvas:function(){var e;e=document.createElement("canvas"),e.style.position="absolute",e.style.top=0,e.style.left=0,e.style.pointerEvents="none",e.style.zIndex=this.options.zIndex||0;var t="leaflet-tile-container";return this.options.zoomAnimation&&(t+=" leaflet-zoom-animated"),e.setAttribute("class",t),e},onAdd:function(e){this._map=e;var t=this._map._panes.tilePane,n=L.DomUtil.create("div","leaflet-layer");n.appendChild(this._canvas),this.options.zoomAnimation&&(n.appendChild(this._backCanvas),this._backCanvas.style.display="none"),t.appendChild(n),this._container=n,e.dragging._draggable.on("predrag",function(){var t=e.dragging._draggable;L.DomUtil.setPosition(this._canvas,{x:-t._newPos.x,y:-t._newPos.y})},this),e.on({viewreset:this._reset},this),e.on("move",this.redraw,this),e.on("resize",this._reset,this),this.options.zoomAnimation&&e.on({zoomanim:this._animateZoom,zoomend:this._endZoomAnim,moveend:this._reset},this),this.options.tileLoader&&this._initTileLoader(),this._reset()},_animateZoom:function(e){this._animating||(this._animating=!0);var t=this._backCanvas;t.width=this._canvas.width,t.height=this._canvas.height;var n=this._canvas._leaflet_pos||{x:0,y:0};t.getContext("2d").drawImage(this._canvas,0,0),L.DomUtil.setPosition(t,L.DomUtil.getPosition(this._canvas)),this._canvas.style.display="none",t.style.display="block";var r=this._map,i=r.getZoomScale(e.zoom),s=r._latLngToNewLayerPoint(r.getCenter(),e.zoom,e.center),o=r._latLngToNewLayerPoint(e.center,e.zoom,e.center),u={x:s.x-o.x+n.x,y:s.y-o.y+n.y},a=t,f=L.DomUtil.TRANSFORM;setTimeout(function(){a.style[f]=L.DomUtil.getTranslateString(u)+" scale("+e.scale+") "},0)},_endZoomAnim:function(){this._animating=!1,this._canvas.style.display="block",this._backCanvas.style.display="none",this._backCanvas.style[L.DomUtil.TRANSFORM]=""},getCanvas:function(){return this._canvas},getAttribution:function(){return this.options.attribution},draw:function(){return this._reset()},onRemove:function(e){this._container.parentNode.removeChild(this._container),e.off({viewreset:this._reset,move:this._render,moveend:this._reset,resize:this._reset,zoomanim:this._animateZoom,zoomend:this._endZoomAnim},this)},addTo:function(e){return e.addLayer(this),this},error:function(e){return this.provider.options.errorCallback=e,this},setOpacity:function(e){return this.options.opacity=e,this._updateOpacity(),this},setZIndex:function(e){this._canvas.style.zIndex=e,this.options.zoomAnimation&&(this._backCanvas.style.zIndex=e)},bringToFront:function(){return this},bringToBack:function(){return this},_reset:function(){var e=this._map.getSize();this._canvas.width=e.x,this._canvas.height=e.y;var t=L.DomUtil.getPosition(this._map.getPanes().mapPane);t&&L.DomUtil.setPosition(this._canvas,{x:-t.x,y:-t.y}),this.onResize(),this._render()},_updateOpacity:function(){},_render:function(){this.currentAnimationFrame>=0&&this.cancelAnimationFrame.call(window,this.currentAnimationFrame),this.currentAnimationFrame=this.requestAnimationFrame.call(window,this.render)},redraw:function(e){var t=L.DomUtil.getPosition(this._map.getPanes().mapPane);t&&L.DomUtil.setPosition(this._canvas,{x:-t.x,y:-t.y}),e?this.render():this._render()},onResize:function(){},render:function(){throw new Error("render function should be implemented")}})},{"./leaflet_tileloader_mixin":14}],13:[function(e,t,n){typeof L!="undefined"&&e("./torque")},{"./torque":15}],14:[function(e,t,n){L.Mixin.TileLoader={_initTileLoader:function(){this._tiles={},this._tilesLoading={},this._tilesToLoad=0,this._map.on({moveend:this._updateTiles},this),this._updateTiles()},_removeTileLoader:function(){this._map.off({moveend:this._updateTiles},this),this._removeTiles()},_updateTiles:function(){if(!this._map)return;var e=this._map.getPixelBounds(),t=this._map.getZoom(),n=this.options.tileSize;if(t>this.options.maxZoom||t<this.options.minZoom)return;var r=new L.Point(Math.floor(e.min.x/n),Math.floor(e.min.y/n)),i=new L.Point(Math.floor(e.max.x/n),Math.floor(e.max.y/n)),s=new L.Bounds(r,i);this._addTilesFromCenterOut(s),this._removeOtherTiles(s)},_removeTiles:function(e){for(var t in this._tiles)this._removeTile(t)},_reloadTiles:function(){this._removeTiles(),this._updateTiles()},_removeOtherTiles:function(e){var t,n,r,i,s,o=this._map.getZoom();for(s in this._tiles)this._tiles.hasOwnProperty(s)&&(t=s.split(":"),n=parseInt(t[0],10),r=parseInt(t[1],10),i=parseInt(t[2],10),(o!==i||n<e.min.x||n>e.max.x||r<e.min.y||r>e.max.y)&&this._removeTile(s))},_removeTile:function(e){this.fire("tileRemoved",this._tiles[e]),delete this._tiles[e],delete this._tilesLoading[e]},_tileKey:function(e){return e.x+":"+e.y+":"+e.zoom},_tileShouldBeLoaded:function(e){var t=this._tileKey(e);return!(t in this._tiles)&&!(t in this._tilesLoading)},_tileLoaded:function(e,t){this._tilesToLoad--;var n=e.x+":"+e.y+":"+e.zoom;this._tiles[n]=t,delete this._tilesLoading[n],this._tilesToLoad===0&&this.fire("tilesLoaded")},getTilePos:function(e){e=new L.Point(e.x,e.y);var t=this._map._getNewTopLeftPoint(this._map.getCenter()),n=this.options.tileSize;return e.multiplyBy(n).subtract(t)},_addTilesFromCenterOut:function(e){var t=[],n=e.getCenter(),r=this._map.getZoom(),i,s,o;for(i=e.min.y;i<=e.max.y;i++)for(s=e.min.x;s<=e.max.x;s++)o=new L.Point(s,i),o.zoom=r,this._tileShouldBeLoaded(o)&&t.push(o);var u=t.length;if(u===0)return;t.sort(function(e,t){return e.distanceTo(n)-t.distanceTo(n)}),this._tilesToLoad+=u;for(s=0;s<u;s++){var a=t[s],f=this._tileKey(a);this._tilesLoading[f]=a,this.fire("tileAdded",a)}this.fire("tilesLoading")}}},{}],15:[function(e,t,n){(function(t){var n=t.carto||e("carto"),r=e("../");e("./canvas_layer"),L.TorqueLayer=L.CanvasLayer.extend({providers:{sql_api:r.providers.json,url_template:r.providers.JsonArray,windshaft:r.providers.windshaft,tileJSON:r.providers.tileJSON},renderers:{point:r.renderer.Point,pixel:r.renderer.Rectangle},initialize:function(e){var t=this;if(!r.isBrowserSupported())throw new Error("browser is not supported by torque");e.tileLoader=!0,this.key=0,this.prevRenderedKey=0,e.cartocss&&r.extend(e,r.common.TorqueLayer.optionsFromCartoCSS(e.cartocss)),e.resolution=e.resolution||2,e.steps=e.steps||100,e.visible=e.visible===undefined?!0:e.visible,this.hidden=!e.visible,this.animator=new r.Animator(function(e){var n=e|0;t.key!==n&&t.setKey(n,{direct:!0})},r.extend(r.clone(e),{onPause:function(){t.fire("pause")},onStop:function(){t.fire("stop")},onStart:function(){t.fire("play")},onStepsRange:function(){t.fire("change:stepsRange",t.animator.stepsRange())}})),this.play=this.animator.start.bind(this.animator),this.stop=this.animator.stop.bind(this.animator),this.pause=this.animator.pause.bind(this.animator),this.toggle=this.animator.toggle.bind(this.animator),this.setDuration=this.animator.duration.bind(this.animator),this.isRunning=this.animator.isRunning.bind(this.animator),L.CanvasLayer.prototype.initialize.call(this,e),this.options.renderer=this.options.renderer||"point",this.options.provider=this.options.provider||"windshaft",this.options.tileJSON&&(this.options.provider="tileJSON"),this.provider=new this.providers[this.options.provider](e),this.renderer=new this.renderers[this.options.renderer](this.getCanvas(),e),e.ready=function(){t.fire("change:bounds",{bounds:t.provider.getBounds()}),t.animator.steps(t.provider.getSteps()),t.animator.rescale(),t.fire("change:steps",{steps:t.provider.getSteps()}),t.setKey(t.key)},this.renderer.on("allIconsLoaded",this.render.bind(this)),this.on("tileAdded",function(e){var n=this.provider.getTileData(e,e.zoom,function(n){if(e.zoom!==t._map.getZoom())return;t._tileLoaded(e,n),t._clearTileCaches(),n&&t.redraw(),t.fire("tileLoaded")})},this)},_clearTileCaches:function(){var e,t;for(e in this._tiles)t=this._tiles[e],t&&t._tileCache&&(t._tileCache=null)},_clearCaches:function(){this.renderer&&this.renderer.clearSpriteCache(),this._clearTileCaches()},onAdd:function(e){e.on({zoomend:this._clearCaches,zoomstart:this._pauseOnZoom},this),e.on({zoomend:this._resumeOnZoom},this),L.CanvasLayer.prototype.onAdd.call(this,e)},onRemove:function(e){this.fire("remove"),this._removeTileLoader(),e.off({zoomend:this._clearCaches,zoomstart:this._pauseOnZoom},this),e.off({zoomend:this._resumeOnZoom},this),L.CanvasLayer.prototype.onRemove.call(this,e)},_pauseOnZoom:function(){this.wasRunning=this.isRunning(),this.wasRunning&&this.pause()},_resumeOnZoom:function(){this.wasRunning&&this.play()},hide:function(){return this.hidden?this:(this.pause(),this.clear(),this.hidden=!0,this)},show:function(){return this.hidden?(this.hidden=!1,this.play(),this.options.steps===1&&this.redraw(),this):this},setSQL:function(e){if(this.provider.options.named_map)throw new Error("SQL queries on named maps are read-only");if(!this.provider||!this.provider.setSQL)throw new Error("this provider does not support SQL");return this.provider.setSQL(e),this._reloadTiles(),this},setBlendMode:function(e){this.renderer.setBlendMode(e),this.redraw()},setSteps:function(e){this.provider.setSteps(e),this._reloadTiles()},setColumn:function(e,t){this.provider.setColumn(e,t),this._reloadTiles()},getTimeBounds:function(){return this.provider&&this.provider.getKeySpan()},clear:function(){var e=this.getCanvas();e.width=e.width},render:function(){if(this.hidden)return;var e,t,n,r=this.getCanvas();this.renderer.clearCanvas();var i=r.getContext("2d");for(e in this._tiles)t=this._tiles[e],t&&(this.animator.isRunning()&&(t._tileCache=null),n=this.getTilePos(t.coord),i.setTransform(1,0,0,1,n.x,n.y),t._tileCache?this.renderer._ctx.drawImage(t._tileCache,0,0):this.renderer.renderTile(t,this.key));this.renderer.applyFilters();if(!this.animator.isRunning()&&this.key===this.prevRenderedKey){var s=this.renderer.TILE_SIZE;for(e in this._tiles){t=this._tiles[e];if(t&&!t._tileCache){var o=t._tileCache=document.createElement("canvas");o.width=o.height=s,n=this.getTilePos(t.coord);var u=Math.max(0,n.x),a=Math.max(0,n.y),f=Math.min(s,this.getCanvas().width-u),l=Math.min(s,this.getCanvas().height-a);f>0&&l>0&&o.getContext("2d").drawImage(this.getCanvas(),u,a,f,l,u-n.x,a-n.y,f,l)}}}this.prevRenderedKey=this.key},setKey:function(e,t){this.key=e,this.animator.step(e),this._clearTileCaches(),this.redraw(t&&t.direct),this.fire("change:time",{time:this.getTime(),step:this.key})},setStep:function(e){if(e===undefined||e.length!==undefined)throw new Error("setTime only accept scalars");this.setKey(e)},stepToTime:function(e){var t=this.provider.getKeySpan(),n=t.start+(t.end-t.start)*(e/this.provider.getSteps());return new Date(n)},timeToStep:function(e){typeof e=="Date"&&(e=e.getTime());if(!this.provider)return 0;var t=this.provider.getKeySpan(),n=this.provider.getSteps()*(e-t.start)/(t.end-t.start);return n},getStep:function(){return this.key},getTime:function(){return this.stepToTime(this.key)},getTimeSpan:function(){return this.provider.getKeySpan()},setCartoCSS:function(e){if(this.provider.options.named_map)throw new Error("CartoCSS style on named maps is read-only");if(!this.renderer)throw new Error("renderer is not valid");var t=(new n.RendererJS).render(e);this.renderer.setShader(t);var i=r.common.TorqueLayer.optionsFromLayer(t.findLayer({name:"Map"}));return this.provider.setCartoCSS&&this.provider.setCartoCSS(e),this.provider.setOptions(i)&&this._reloadTiles(),r.extend(this.options,i),i.animationDuration&&this.animator.duration(i.animationDuration),this._clearCaches(),this.redraw(),this},getActivePointsBBox:function(e){var t=[];for(var n in this._tiles){var r=this._tiles[n];t=t.concat(this.renderer.getActivePointsBBox(r,e))}return t},getValues:function(e){var t=[];e=e===undefined?this.key:e;var n,r;for(n in this._tiles)r=this._tiles[n],this.renderer.getValues(r,e,t);return t},getValueForPos:function(e,t,n){n=n===undefined?this.key:n;var r,i,s,o=null,u,a;for(r in this._tiles){i=this._tiles[r],s=this.getTilePos(i.coord),u=e-s.x,a=t-s.y,u>=0&&a>=0&&u<this.renderer.TILE_SIZE&&a<=this.renderer.TILE_SIZE&&(o=this.renderer.getValueFor(i,n,u,a));if(o!==null)return o}return null},getValueForBBox:function(e,t,n,r){var i=e+n,s=t+r,o=e,u=0;for(_y=t;_y<s;_y+=this.options.resolution)for(o=e;o<i;o+=this.options.resolution){var a=this.getValueForPos(o,_y);if(a){var f=a.bbox,l=this._map.latLngToContainerPoint([f[1].lat,f[1].lon]);l.x<i&&l.y<s&&(u+=a.value)}}return u},invalidate:function(){this.provider.reload()},setStepsRange:function(e,t){this.animator.stepsRange(e,t)},removeStepsRange:function(){this.animator.removeCustomStepsRange()},getStepsRange:function(){return this.animator.stepsRange()}})}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"../":11,"./canvas_layer":12,carto:38}],16:[function(e,t,n){function r(e,t){return function(n){return Math.max(Math.min(n,t),e)}}function i(e,t){var n=r(0,1);return function(r){return n((r-e)/(t-e))}}function s(e,t){function s(r){return n(e*(1-r)+r*t)}var n=r(e,t);return s.invert=function(){return i(e,t)},s}t.exports={clamp:r,linear:s,invLinear:i}},{}],17:[function(e,t,n){function i(e,t,n){return t!==null&&(e=Math.max(e,t)),n!==null&&(e=Math.min(e,n)),e}function s(e){return e*(Math.PI/180)}function o(e){return e/(Math.PI/180)}var r=function(e,t){this.x=e||0,this.y=t||0},u=function(){this._tileSize=256,this._pixelOrigin=new r(this._tileSize/2,this._tileSize/2),this._pixelsPerLonDegree=this._tileSize/360,this._pixelsPerLonRadian=this._tileSize/(2*Math.PI)};u.prototype._fromLatLonToPoint=function(e,t){var n=new r(0,0),o=this._pixelOrigin;n.x=o.x+t*this._pixelsPerLonDegree;var u=i(Math.sin(s(e)),-0.9999,.9999);return n.y=o.y+.5*Math.log((1+u)/(1-u))*-this._pixelsPerLonRadian,n},u.prototype._fromPointToLatLon=function(e){var t=this,n=t._pixelOrigin,r=(e.x-n.x)/t._pixelsPerLonDegree,i=(e.y-n.y)/-t._pixelsPerLonRadian,s=o(2*Math.atan(Math.exp(i))-Math.PI/2);return{lat:s,lon:r}},u.prototype._tilePixelPos=function(e,t){return{x:e*this._tileSize,y:t*this._tileSize}},u.prototype.tilePixelBBox=function(e,t,n,i,s,o){o=o||1;var u=1<<n,a=o/u;return i=(e*this._tileSize+i)/u,s=(t*this._tileSize+s)/u,[this._fromPointToLatLon(new r(i,s+a)),this._fromPointToLatLon(new r(i+a,s))]},u.prototype.tileBBox=function(e,t,n,i){var s=1<<n;i=i||0;var o=(this._tileSize+i*2)/s,u=(e*this._tileSize-i)/s,a=(t*this._tileSize-i)/s;return[this._fromPointToLatLon(new r(u,a+o)),this._fromPointToLatLon(new r(u+o,a))]},u.prototype.latLonToTilePoint=function(e,t,n,i,s){var o=1<<s,u=this._fromLatLonToPoint(e,t),a=new r(u.x*o,u.y*o),f=this._tilePixelPos(n,i);return new r(Math.round(a.x-f.x),Math.round(a.y-f.y))},t.exports=u},{}],18:[function(e,t,n){function i(){}function s(e){this.t0=null,this.name=e,this.count=0}var r=1024;i.metrics={},i.get=function(e){return i.metrics[e]||{max:0,min:Number.MAX_VALUE,avg:0,total:0,count:0,history:typeof Float32Array!="undefined"?new Float32Array(r):[]}},i.new_value=function(e,t){var n=i.metrics[e]=i.get(e);n.max=Math.max(n.max,t),n.min=Math.min(n.min,t),n.total+=t,++n.count,n.avg=n.total/n.count,n.history[n.count%r]=t},i.print_stats=function(){for(k in i.metrics){var e=i.metrics[k];console.log(" === "+k+" === "),console.log(" max: "+e.max),console.log(" min: "+e.min),console.log(" avg: "+e.avg),console.log(" count: "+e.count),console.log(" total: "+e.total)}},s.prototype={start:function(){return this.t0=+(new Date),this},_elapsed:function(){return+(new Date)-this.t0},end:function(){this.t0!==null&&(i.new_value(this.name,this._elapsed()),this.t0=null)},inc:function(e){e=e===undefined?1:e,i.new_value(this.name,i.get(this.name).count+(e?e:0))},dec:function(e){e=e===undefined?1:e,this.inc(-e)},mark:function(){++this.count;if(this.t0===null){this.start();return}var e=this._elapsed();e>1&&(i.new_value(this.name,this.count),this.count=0,this.start())}},i.metric=function(e){return new s(e)},t.exports=i},{}],19:[function(e,t,n){t.exports={json:e("./json"),JsonArray:e("./jsonarray"),windshaft:e("./windshaft"),tileJSON:e("./tilejson")}},{"./json":20,"./jsonarray":21,"./tilejson":22,"./windshaft":23}],20:[function(e,t,n){function a(e){for(var t=1;t<arguments.length;++t){var n=arguments[t];for(var r in n)e=e.replace(RegExp("\\{"+r+"\\}","g"),n[r])}return e}var r=e("../"),i=e("../profiler"),s=r.types.Uint8Array,o=r.types.Int32Array,u=r.types.Uint32Array,f=function(e){this._ready=!1,this._tileQueue=[],this.options=e,this.options.is_time=this.options.is_time===undefined?!0:this.options.is_time,this.options.tiler_protocol=e.tiler_protocol||"http",this.options.tiler_domain=e.tiler_domain||"cartodb.com",this.options.tiler_port=e.tiler_port||80,this.options.data_aggregation&&(this.options.cumulative=this.options.data_aggregation==="cumulative");if(e.resolution===undefined)throw new Error("resolution should be provided");if(e.steps===undefined)throw new Error("steps should be provided");e.start===undefined?this._fetchKeySpan():this._setReady(!0)};f.prototype={proccessTile:function(e,t,n){var r,a=new s(e.length),f=new s(e.length),l=i.metric("ProviderJSON:mem"),c=i.metric("ProviderJSON:point_count"),h=i.metric("ProviderJSON:process_time").start(),p=0,d=-1;for(r=0;r<e.length;++r){var v=e[r];p+=v.dates__uint16.length;for(var m=0;m<v.dates__uint16.length;++m)d=Math.max(d,v.dates__uint16[m])}this.options.cumulative&&(p=(1+d)*e.length);var g=this.options.cumulative?u:s,y=new o(d+1),b=new o(d+1),w=new(this.options.valueDataType||g)(p),E=new u(p);l.inc(4*d+4*d+p+p*4),c.inc(e.length);var S={};for(var r=0;r<e.length;++r){var v=e[r];a[r]=v.x__uint8*this.options.resolution,v.y__uint8===-1?f[r]=0:f[r]=v.y__uint8*this.options.resolution;var p=v.dates__uint16,x=v.vals__uint8;if(!this.options.cumulative)for(var T=0,N=p.length;T<N;++T){var C=S[p[T]]||(S[p[T]]=[]);this.options.cumulative&&(x[T]+=prev_val),prev_val=x[T],C.push([r,x[T]])}else{var k={};for(var T=0,N=p.length;T<N;++T)k[p[T]]=x[T];var L=0;for(var T=p[0];T<=d;++T){var C=S[T]||(S[T]=[]),A=k[T];A&&(L+=A),C.push([r,L])}}}var O=0,M=0,_=0;for(var _=0;_<=d;++_){var D=0,P=S[_];if(P)for(var r=0;r<P.length;++r){var C=P[r];++D,E[O]=C[0],w[O]=C[1],++O}y[_]=M,b[_]=D,M+=D}return h.end(),{x:a,y:f,z:n,coord:{x:t.x,y:t.y,z:n},timeCount:b,timeIndex:y,renderDataPos:E,renderData:w,maxDate:d}},_host:function(){var e=this.options,t=e.sql_api_port,n=(e.user_name||e.user)+"."+(e.sql_api_domain||"cartodb.com")+(t?":"+t:""),r=e.sql_api_protocol||"http";return this.options.url||r+"://"+n+"/api/v2/sql"},url:function(e){var t=this.options,n=t.sql_api_protocol||"http";if(!this.options.cdn_url)return this._host();var r=n+"://";e&&(r+=e+".");var i=t.cdn_url;if(!i.http&&!i.https)throw new Error("cdn_host should contain http and/or https entries");return r+=i[n]+"/"+(t.user_name||t.user)+"/api/v2/sql",r},_hash:function(e){var t=0;if(!e||e.length==0)return t;for(var n=0,r=e.length;n<r;++n)t=(t<<5)-t+e.charCodeAt(n)|0;return t},_extraParams:function(){if(this.options.extra_params){var e=[];for(var t in this.options.extra_params){var n=this.options.extra_params[t];n&&e.push(t+"="+encodeURIComponent(n))}return e.join("&")}return null},isHttps:function(){return this.options.sql_api_protocol&&this.options.sql_api_protocol==="https"},sql:function(e,t,n){n=n||{};var i=this.options.subdomains||"0123";this.isHttps()&&(i=[null]);var s;n.no_cdn?s=this._host():s=this.url(i[Math.abs(this._hash(e))%i.length]);var o=this._extraParams();r.net.get(s+"?q="+encodeURIComponent(e)+(o?"&"+o:""),function(e){n.parseJSON&&(e=JSON.parse(e&&e.responseText)),t&&t(e)})},getTileData:function(e,t,n){this._ready?this._getTileData(e,t,n):this._tileQueue.push([e,t,n])},_setReady:function(e){this._ready=!0,this._processQueue(),this.options.ready&&this.options.ready()},_processQueue:function(){var e;while(e=this._tileQueue.pop())this._getTileData.apply(this,e)},_getTileData:function(e,t,n){var r=i.metric("ProviderJSON:tile_fetch_time").start();this.table=this.options.table;var s=1<<t,o=this.options.column;this.options.is_time&&(o=a("date_part('epoch', {column})",this.options));var u="WITH par AS ( SELECT CDB_XYZ_Resolution({zoom})*{resolution} as res, 256/{resolution} as tile_size, CDB_XYZ_Extent({x}, {y}, {zoom}) as ext ),cte AS ( SELECT ST_SnapToGrid(i.the_geom_webmercator, p.res) g, {countby} c, floor(({column_conv} - {start})/{step}) d FROM ({_sql}) i, par p WHERE i.the_geom_webmercator && p.ext GROUP BY g, d) SELECT (st_x(g)-st_xmin(p.ext))/p.res x__uint8, (st_y(g)-st_ymin(p.ext))/p.res y__uint8, array_agg(c) vals__uint8, array_agg(d) dates__uint16 FROM cte, par p where (st_y(g)-st_ymin(p.ext))/p.res < tile_size and (st_x(g)-st_xmin(p.ext))/p.res < tile_size GROUP BY x__uint8, y__uint8",f=a(u,this.options,{zoom:t,x:e.x,y:e.y,column_conv:o,_sql:this.getSQL()}),l=this;this.sql(f,function(i){if(i){var s=JSON.parse(i.responseText).rows;n(l.proccessTile(s,e,t))}else n(null);r.end()})},getKeySpan:function(){return{start:this.options.start*1e3,end:this.options.end*1e3,step:this.options.step,steps:this.options.steps,columnType:this.options.is_time?"date":"number"}},setColumn:function(e,t){this.options.column=e,this.options.is_time=t===undefined?!0:!1,this.reload()},setResolution:function(e){this.options.resolution=e},setOptions:function(e){var t=!1;e.resolution!==undefined&&e.resolution!==this.options.resolution&&(this.options.resolution=e.resolution,t=!0),e.steps!==undefined&&e.steps!==this.options.steps&&(this.setSteps(e.steps,{silent:!0}),t=!0),e.column!==undefined&&e.column!==this.options.column&&(this.options.column=e.column,t=!0),e.countby!==undefined&&e.countby!==this.options.countby&&(this.options.countby=e.countby,t=!0);if(e.data_aggregation!==undefined){var n=e.data_aggregation==="cumulative";this.options.cumulative!==n&&(this.options.cumulative=n,t=!0)}return t&&this.reload(),t},reload:function(){this._ready=!1,this._fetchKeySpan()},setSQL:function(e){this.options.sql!=e&&(this.options.sql=e,this.reload())},getSteps:function(){return Math.min(this.options.steps,this.options.data_steps)},setSteps:function(e,t){t=t||{},this.options.steps!==e&&(this.options.steps=e,this.options.step=(this.options.end-this.options.start)/this.getSteps(),this.options.step=this.options.step||1,t.silent||this.reload())},getBounds:function(){return this.options.bounds},getSQL:function(){return this.options.sql||"select * from "+this.options.table},_tilerHost:function(){var e=this.options,t=e.user_name||e.user;return e.tiler_protocol+"://"+(t?t+".":"")+e.tiler_domain+(e.tiler_port!=""?":"+e.tiler_port:"")},_fetchUpdateAt:function(e){var t=this,n={version:"1.0.1",stat_tag:this.options.stat_tag||"torque",layers:[{type:"cartodb",options:{cartocss_version:"2.1.1",cartocss:"#layer {}",sql:this.getSQL()}}]},i=this._tilerHost()+"/tiles/layergroup",s=this._extraParams();s&&(s=s.replace("api_key=","map_key=")),i=i+"?config="+encodeURIComponent(JSON.stringify(n))+"&callback=?"+(s?"&"+s:""),r.net.jsonp(i,function(n){var r=a("select * from ({sql}) __torque_wrap_sql limit 0",{sql:t.getSQL()});t.sql(r,function(t){n&&t&&e({updated_at:n.last_updated,fields:t.fields})},{parseJSON:!0})})},_fetchKeySpan:function(){var e=this,t,n,r,i;this._fetchUpdateAt(function(s){if(!s)return;e.options.extra_params=e.options.extra_params||{},e.options.extra_params.last_updated=s.updated_at||0,e.options.extra_params.cache_policy="persist",e.options.is_time=s.fields[e.options.column].type==="date";var o=e.options.column;e.options.is_time?(r="date_part('epoch', max({column}))",i="date_part('epoch', min({column}))",o=a("date_part('epoch', {column})",e.options)):(r="max({column})",i="min({column})"),t=a(r,{column:e.options.column}),n=a(i,{column:e.options.column});var u=" SELECT st_xmax(st_envelope(st_collect(the_geom))) xmax, st_ymax(st_envelope(st_collect(the_geom))) ymax, st_xmin(st_envelope(st_collect(the_geom))) xmin, st_ymin(st_envelope(st_collect(the_geom))) ymin, count(*) as num_steps, {max_col} max_date, {min_col} min_date FROM ({sql}) __torque_wrap_sql ",f=a(u,{max_col:t,min_col:n,column:o,sql:e.getSQL()});e.sql(f,function(t){t=t.rows[0],e.options.start=t.min_date,e.options.end=t.max_date,e.options.step=(t.max_date-t.min_date)/Math.min(e.options.steps,t.num_steps>>0),e.options.data_steps=t.num_steps>>0,e.options.step=e.options.step||1,e.options.bounds=[[t.ymin,t.xmin],[t.ymax,t.xmax]],e._setReady(!0)},{parseJSON:!0,no_cdn:!0})},{parseJSON:!0,no_cdn:!0})}},t.exports=f},{"../":11,"../profiler":18}],21:[function(e,t,n){function f(e,t){for(var n=1;n<arguments.length;++n){var t=arguments[n];for(var r in t)e=e.replace(RegExp("\\{"+r+"\\}","g"),t[r])}return e}var i=e("../"),s=e("../profiler"),o=i.types.Uint8Array,u=i.types.Int32Array,a=i.types.Uint32Array,l=function(e){this.options=e};l.prototype={aggregateByKey:function(e){function t(e){var t=3,n=e.data[2],r={};for(var i=0;i<n;++i)r[e.data[t+i]]=e.data[t+n+i];return r}var n={};for(r=0;r<e.length;++r){var i=t(e[r]);for(var s in i)n[s]=n[s]||0,n[s]+=i[s]}return n},proccessTile:function(e,t,n){function l(e){var t=3,n={x:e.data[0]*f.options.resolution,y:e.data[1]*f.options.resolution,valuesCount:e.data[2],times:[],values:[]};for(var r=0;r<n.valuesCount;++r)n.times.push(e.data[t+r]),n.values.push(e.data[t+n.valuesCount+r]);if(f.options.cumulative)for(var r=1;r<n.valuesCount;++r)n.values[r]+=n.values[r-1];return n}var r,i=new o(e.length),s=new o(e.length),f=this;for(r=0;r<e.length;++r)e[r]=l(e[r]);var c=0,h=0;for(r=0;r<e.length;++r){var p=e[r];c+=p.times.length;for(var d=0;d<p.times.length;++d)h=Math.max(h,p.times[d])}var v=new u(h+1),m=new u(h+1),g=new(this.options.valueDataType||o)(c),y=new a(c),b={};for(var r=0;r<e.length;++r){var p=e[r];i[r]=p.x,s[r]=p.y;var c=p.times,w=p.values;for(var E=0,S=c.length;E<S;++E){var x=b[c[E]]||(b[c[E]]=[]);x.push([r,w[E]])}}var T=0,N=0,C=0;for(var C=0;C<=h;++C){var k=0,L=b[C];if(L)for(var r=0;r<L.length;++r){var x=L[r];++k,y[T]=x[0],g[T]=x[1],++T}v[C]=N,m[C]=k,N+=k}return{x:i,y:s,coord:{x:t.x,y:t.y,z:n},timeCount:m,timeIndex:v,renderDataPos:y,renderData:g}},url:function(){return this.options.url},tileUrl:function(e,t){var n=this.url(),r=(this.options.subdomains||"abcd")[(e.x+e.y+t)%4];return n.replace("{x}",e.x).replace("{y}",e.y).replace("{z}",t).replace("{s}",r)},getTile:function(e,t,n){var r=this.tileUrl(e,t),o=this,u=s.metric("jsonarray:fetch time");u.start(),i.net.get(r,function(e){u.end(),e&&(e=JSON.parse(e.responseText)),n(e)})},getTileData:function(e,t,n){var r=this.tileUrl(e,t),o=this,u=s.metric("jsonarray:fetch time");u.start(),i.net.get(r,function(r){u.end();var i=null,a=s.metric("jsonarray:processing time"),f=s.metric("jsonarray:parsing time");try{a.start(),f.start();var l=JSON.parse(r.responseText||r.response).rows;f.end(),i=o.proccessTile(l,e,t),a.end()}catch(c){console.error("problem parsing JSON on ",e,t)}n(i)})}},t.exports=l},{"../":11,"../profiler":18}],22:[function(e,t,n){function a(e){for(var t=1;t<arguments.length;++t){var n=arguments[t];for(var r in n)e=e.replace(RegExp("\\{"+r+"\\}","g"),n[r])}return e}var r=e("../"),i=r.types.Uint8Array,s=r.types.Int32Array,o=r.types.Uint32Array,u=r.types.Uint8ClampedArray,f=function(e){this._ready=!1,this._tileQueue=[],this.options=e,this.options.coordinates_data_type=this.options.coordinates_data_type||i,this.options.data_aggregation&&(this.options.cumulative=this.options.data_aggregation==="cumulative");if(this.options.auth_token){var t=this.options.extra_params||(this.options.extra_params={});t.auth_token=this.options.auth_token}this.options.no_fetch_map||this._fetchMap()};f.prototype={NAME:"tileJSON",proccessTile:function(e,t,n){var r,i=new this.options.coordinates_data_type(e.length),a=new this.options.coordinates_data_type(e.length),f=0,l=-1;for(r=0;r<e.length;++r){var c=e[r];f+=c.dates__uint16.length;for(var h=0;h<c.dates__uint16.length;++h)l=Math.max(l,c.dates__uint16[h])}this.options.cumulative&&(f=(1+l)*e.length);var p=this.options.cumulative?o:u,d=new s(l+1),v=new s(l+1),m=new(this.options.valueDataType||p)(f),g=new o(f),y={};for(var r=0;r<e.length;++r){var c=e[r];i[r]=c.x__uint8*this.options.resolution,a[r]=c.y__uint8*this.options.resolution;var f=c.dates__uint16,b=c.vals__uint8;if(!this.options.cumulative)for(var w=0,E=f.length;w<E;++w){var S=y[f[w]]||(y[f[w]]=[]);this.options.cumulative&&(b[w]+=prev_val),prev_val=b[w],S.push([r,b[w]])}else{var x={};for(var w=0,E=f.length;w<E;++w)x[f[w]]=b[w];var T=0;for(var w=f[0];w<=l;++w){var S=y[w]||(y[w]=[]),N=x[w];N&&(T+=N),S.push([r,T])}}}var C=0,k=0,L=0;for(var L=0;L<=l;++L){var A=0,O=y[L];if(O)for(var r=0;r<O.length;++r){var S=O[r];++A,g[C]=S[0],m[C]=S[1],++C}d[L]=k,v[L]=A,k+=A}return{x:i,y:a,z:n,coord:{x:t.x,y:t.y,z:n},timeCount:v,timeIndex:d,renderDataPos:g,renderData:m,maxDate:l}},setSteps:function(e,t){t=t||{},this.options.steps!==e&&(this.options.steps=e,this.options.step=(this.options.end-this.options.start)/this.getSteps(),this.options.step=this.options.step||1,t.silent||this.reload())},setOptions:function(e){var t=!1;e.resolution!==undefined&&e.resolution!==this.options.resolution&&(this.options.resolution=e.resolution,t=!0),e.steps!==undefined&&e.steps!==this.options.steps&&(this.setSteps(e.steps,{silent:!0}),t=!0),e.column!==undefined&&e.column!==this.options.column&&(this.options.column=e.column,t=!0),e.countby!==undefined&&e.countby!==this.options.countby&&(this.options.countby=e.countby,t=!0);if(e.data_aggregation!==undefined){var n=e.data_aggregation==="cumulative";this.options.cumulative!==n&&(this.options.cumulative=n,t=!0)}return t&&this.reload(),t},_extraParams:function(e){e=r.extend(r.extend({},e),this.options.extra_params);if(e){var t=[];for(var n in e){var i=e[n];if(i)if(r.isArray(i))for(var s=0,o=i.length;s<o;s++)t.push(n+"[]="+encodeURIComponent(i[s]));else t.push(n+"="+encodeURIComponent(i))}return t.join("&")}return null},getTileData:function(e,t,n){this._ready?this._getTileData(e,t,n):this._tileQueue.push([e,t,n])},_setReady:function(e){this._ready=!0,this._processQueue(),this.options.ready&&this.options.ready()},_processQueue:function(){var e;while(e=this._tileQueue.pop())this._getTileData.apply(this,e)},_getTileData:function(e,t,n){var i=this,s=this.options.subdomains||"0123",o=Math.pow(2,t),u=(e.x%o+o)%o,a=Math.abs(u+e.y)%s.length,f=this._extraParams(),l=this.templateUrl.replace("{x}",u).replace("{y}",e.y).replace("{z}",t).replace("{s}",s[a]);l+=f,r.net.get(l,function(r){if(r&&r.responseText){var s=JSON.parse(r.responseText);n(i.proccessTile(s,e,t))}else n(null)})},getKeySpan:function(){return{start:this.options.start,end:this.options.end,step:this.options.step,steps:this.options.steps,columnType:this.options.column_type}},setColumn:function(e,t){this.options.column=e,this.options.is_time=t===undefined?!0:!1,this.reload()},reload:function(){this._ready=!1,this._fetchMap()},getSteps:function(){return Math.min(this.options.steps,this.options.data_steps)},getBounds:function(){return this.options.bounds},getSQL:function(){return this.options.sql||"select * from "+this
.options.table},setSQL:function(e){this.options.sql!=e&&(this.options.sql=e,this.reload())},_isUserTemplateUrl:function(e){return e&&e.indexOf("{user}")!==-1},isHttps:function(){return this.options.maps_api_template.indexOf("https")===0},_fetchMap:function(e){var t=this;r.net.get(this.options.tileJSON,function(e){e=JSON.parse(e.response);if(e){if(e.errors){t.options.errorCallback&&t.options.errorCallback(e.errors);return}for(var n in e)t.options[n]=e[n];t.templateUrl=e.tiles[0],t.templateUrl.indexOf("http")!==0&&(t.templateUrl=t.options.tileJSON.substring(0,t.options.tileJSON.lastIndexOf("/")+1)+t.templateUrl),t._setReady(!0)}})}},t.exports=f},{"../":11}],23:[function(e,t,n){function f(e){for(var t=1;t<arguments.length;++t){var n=arguments[t];for(var r in n)e=e.replace(RegExp("\\{"+r+"\\}","g"),n[r])}return e}var r=e("../"),i=e("../profiler"),s=r.types.Uint8Array,o=r.types.Int32Array,u=r.types.Uint32Array,a=r.types.Uint8ClampedArray,l=function(e){this._ready=!1,this._tileQueue=[],this.options=e,this.options.is_time=this.options.is_time===undefined?!0:this.options.is_time,this.options.tiler_protocol=e.tiler_protocol||"http",this.options.tiler_domain=e.tiler_domain||"cartodb.com",this.options.tiler_port=e.tiler_port||80,e.maps_api_template?this.options.maps_api_template=e.maps_api_template:this._buildMapsApiTemplate(this.options),this.options.coordinates_data_type=this.options.coordinates_data_type||s,this.options.data_aggregation&&(this.options.cumulative=this.options.data_aggregation==="cumulative");if(this.options.auth_token){var t=this.options.extra_params||(this.options.extra_params={});t.auth_token=this.options.auth_token}this.options.no_fetch_map||this._fetchMap()};l.prototype={proccessTile:function(e,t,n){var r,s=new this.options.coordinates_data_type(e.length),f=new this.options.coordinates_data_type(e.length),l=i.metric("torque.provider.windshaft.mem"),c=i.metric("torque.provider.windshaft.points"),h=i.metric("torque.provider.windshaft.process_time").start(),p=0,d=-1;for(r=0;r<e.length;++r){var v=e[r];p+=v.dates__uint16.length;for(var m=0;m<v.dates__uint16.length;++m)d=Math.max(d,v.dates__uint16[m])}this.options.cumulative&&(p=(1+d)*e.length);var g=this.options.cumulative?u:a,y=new o(d+1),b=new o(d+1),w=new(this.options.valueDataType||g)(p),E=new u(p);l.inc(4*d+4*d+p+p*4),c.inc(e.length);var S={};for(var r=0;r<e.length;++r){var v=e[r];s[r]=v.x__uint8*this.options.resolution,f[r]=v.y__uint8*this.options.resolution;var p=v.dates__uint16,x=v.vals__uint8;if(!this.options.cumulative)for(var T=0,N=p.length;T<N;++T){var C=S[p[T]]||(S[p[T]]=[]);this.options.cumulative&&(x[T]+=prev_val),prev_val=x[T],C.push([r,x[T]])}else{var k={};for(var T=0,N=p.length;T<N;++T)k[p[T]]=x[T];var L=0;for(var T=p[0];T<=d;++T){var C=S[T]||(S[T]=[]),A=k[T];A&&(L+=A),C.push([r,L])}}}var O=0,M=0,_=0;for(var _=0;_<=d;++_){var D=0,P=S[_];if(P)for(var r=0;r<P.length;++r){var C=P[r];++D,E[O]=C[0],w[O]=C[1],++O}y[_]=M,b[_]=D,M+=D}return h.end(),{x:s,y:f,z:n,coord:{x:t.x,y:t.y,z:n},timeCount:b,timeIndex:y,renderDataPos:E,renderData:w,maxDate:d}},setSteps:function(e,t){t=t||{},this.options.steps!==e&&(this.options.steps=e,this.options.step=(this.options.end-this.options.start)/this.getSteps(),this.options.step=this.options.step||1,t.silent||this.reload())},setOptions:function(e){var t=!1;e.resolution!==undefined&&e.resolution!==this.options.resolution&&(this.options.resolution=e.resolution,t=!0),e.steps!==undefined&&e.steps!==this.options.steps&&(this.setSteps(e.steps,{silent:!0}),t=!0),e.column!==undefined&&e.column!==this.options.column&&(this.options.column=e.column,t=!0),e.countby!==undefined&&e.countby!==this.options.countby&&(this.options.countby=e.countby,t=!0);if(e.data_aggregation!==undefined){var n=e.data_aggregation==="cumulative";this.options.cumulative!==n&&(this.options.cumulative=n,t=!0)}return t&&this.reload(),t},_extraParams:function(e){e=r.extend(r.extend({},e),this.options.extra_params);if(e){var t=[];for(var n in e){var i=e[n];if(i)if(r.isArray(i))for(var s=0,o=i.length;s<o;s++)t.push(n+"[]="+encodeURIComponent(i[s]));else t.push(n+"="+encodeURIComponent(i))}return t.join("&")}return null},getTileData:function(e,t,n){this._ready?this._getTileData(e,t,n):this._tileQueue.push([e,t,n])},_setReady:function(e){this._ready=!0,this._processQueue(),this.options.ready&&this.options.ready()},_processQueue:function(){var e;while(e=this._tileQueue.pop())this._getTileData.apply(this,e)},_getTileData:function(e,t,n){var s=this,o=i.metric("torque.provider.windshaft.tile.fetch").start(),u=this.options.subdomains||"0123",a=Math.pow(2,t),f=(e.x%a+a)%a,l=Math.abs(f+e.y)%u.length,c=this.templateUrl.replace("{x}",f).replace("{y}",e.y).replace("{z}",t).replace("{s}",u[l]),h=this._extraParams();r.net.get(c+(h?"?"+h:""),function(r){o.end();if(r&&r.responseText){var u=JSON.parse(r.responseText);n(s.proccessTile(u,e,t))}else i.metric("torque.provider.windshaft.tile.error").inc(),n(null)})},getKeySpan:function(){return{start:this.options.start,end:this.options.end,step:this.options.step,steps:this.options.steps,columnType:this.options.column_type}},setColumn:function(e,t){this.options.column=e,this.options.is_time=t===undefined?!0:!1,this.reload()},reload:function(){this._ready=!1,this._fetchMap()},getSteps:function(){return Math.min(this.options.steps,this.options.data_steps)},getBounds:function(){return this.options.bounds},getSQL:function(){return this.options.sql||"select * from "+this.options.table},setSQL:function(e){this.options.sql!=e&&(this.options.sql=e,this.reload())},_buildMapsApiTemplate:function(e){var t=e.user_name||e.user;e.maps_api_template=e.tiler_protocol+"://"+(t?"{user}.":"")+e.tiler_domain+(e.tiler_port!=""?":"+e.tiler_port:"")},_tilerHost:function(){var e=this.options,t=e.user_name||e.user;return e.maps_api_template.replace("{user}",t)},url:function(){var e=this.options,t=e.cdn_url,n=!t||t&&!t.http&&!t.https;if(e.no_cdn||n)return this._tilerHost();var r=this.isHttps()?"https":"http",i=r+"://";this.isHttps()||(i+="{s}.");var s=t[r];this._isUserTemplateUrl(s)||(s+="/{user}");var o=e.user_name||e.user;return i+=s.replace("{user}",o),i},_isUserTemplateUrl:function(e){return e&&e.indexOf("{user}")!==-1},isHttps:function(){return this.options.maps_api_template.indexOf("https")===0},_generateCartoCSS:function(){var e={"-torque-frame-count":this.options.steps,"-torque-resolution":this.options.resolution,"-torque-aggregation-function":"'"+this.options.countby+"'","-torque-time-attribute":"'"+this.options.column+"'","-torque-data-aggregation":this.options.cumulative?"cumulative":"linear"},t="Map{";for(var n in e)t+=n+":"+e[n]+";";return t+"}"},_fetchMap:function(e){var t=this,n={},s=this.options.dynamic_cdn?this.url().replace("{s}","0"):this._tilerHost(),o=s+"/api/v1/map",u=this.options.named_map,a={};u?(o=s+"/api/v1/map/named/"+u.name+"/jsonp",typeof u.params!="undefined"&&(n=u.params)):n={version:"1.0.1",stat_tag:this.options.stat_tag||"torque",layers:[{type:"torque",options:{cartocss_version:"1.0.0",cartocss:this._generateCartoCSS(),sql:this.getSQL()}}]},this.options.stat_tag&&(a.stat_tag=this.options.stat_tag),extra=this._extraParams(a),extra&&(extra=extra.replace("api_key=","map_key=")),o=o+"?config="+encodeURIComponent(JSON.stringify(n))+"&callback=?"+(extra?"&"+extra:"");var f=i.metric("torque.provider.windshaft.layergroup.time").start();r.net.jsonp(o,function(e){f.end();if(e){if(e.errors){t.options.errorCallback&&t.options.errorCallback(e.errors);return}var n=Object.keys(e.metadata.torque)[0],r=e.metadata.torque[n];for(var s in r)t.options[s]=r[s];if(e.cdn_url){var o=t.options.cdn_url=t.options.cdn_url||{};o.http=e.cdn_url.http||o.http,o.https=e.cdn_url.https||o.https}t.templateUrl=t.url()+"/api/v1/map/"+e.layergroupid+"/"+n+"/{z}/{x}/{y}.json.torque",t._setReady(!0)}else i.metric("torque.provider.windshaft.layergroup.error").inc()},{callbackName:t.options.instanciateCallback})}},t.exports=l},{"../":11,"../profiler":18}],24:[function(e,t,n){function o(e,t){e.fillStyle=t["marker-fill"];var n=t["marker-width"];e.beginPath(),e.arc(0,0,n,0,r,!0,!0),e.closePath(),t["marker-opacity"]!==undefined&&(t["marker-fill-opacity"]=t["marker-line-opacity"]=t["marker-opacity"]),t["marker-fill"]&&(e.globalAlpha=t["marker-fill-opacity"]>=0?t["marker-fill-opacity"]:1,e.globalAlpha>0&&e.fill()),t["marker-line-color"]&&t["marker-line-width"]&&t["marker-line-width"]>i&&(e.globalAlpha=t["marker-line-opacity"]>=0?t["marker-line-opacity"]:1,t["marker-line-width"]!==undefined&&(e.lineWidth=t["marker-line-width"]),e.strokeStyle=t["marker-line-color"],e.globalAlpha>0&&e.stroke())}function u(e,t){e.fillStyle=t["marker-fill"];var n=t["marker-width"],r=n*2;if(t["marker-fill"]){if(t["marker-fill-opacity"]!==undefined||t["marker-opacity"]!==undefined)e.globalAlpha=t["marker-fill-opacity"]||t["marker-opacity"];e.fillRect(-n,-n,r,r)}e.globalAlpha=1,t["marker-line-color"]&&t["marker-line-width"]&&(t["marker-line-opacity"]&&(e.globalAlpha=t["marker-line-opacity"]),t["marker-line-width"]&&(e.lineWidth=t["marker-line-width"]),e.strokeStyle=t["marker-line-color"],e.globalAlpha>0&&e.strokeRect(-n,-n,r,r))}function a(e,t,n){if(t.complete){if(n["marker-fill-opacity"]!==undefined||n["marker-opacity"]!==undefined)e.globalAlpha=n["marker-fill-opacity"]||n["marker-opacity"];e.drawImage(t,0,0,Math.min(t.width,s),Math.min(t.height,s))}}var r=Math.PI*2,i=.05,s=255;t.exports={renderPoint:o,renderSprite:a,renderRectangle:u,MAX_SPRITE_RADIUS:s}},{}],25:[function(e,t,n){t.exports={cartocss:e("./cartocss_render"),Point:e("./point"),Rectangle:e("./rectangle")}},{"./cartocss_render":24,"./point":26,"./rectangle":27}],26:[function(e,t,n){(function(n){function c(e){return l[e]||e}function h(e,t){if(!e)throw new Error("canvas can't be undefined");this.options=t,this._canvas=e,this._ctx=e.getContext("2d"),this._sprites=[],this._shader=null,this._icons={},this._iconsToLoad=0,this._filters=new u(this._canvas,{canvasClass:t.canvasClass}),this.setCartoCSS(this.options.cartocss||f),this.TILE_SIZE=256,this._style=null,this._gradients={},this._forcePoints=!1}var r=e("../"),i=e("./cartocss_render"),s=e("../profiler"),o=n.carto||e("carto"),u=e("./torque_filters"),a=Math.PI*2,f=["#layer {"," marker-fill: #662506;"," marker-width: 4;"," [value > 1] { marker-fill: #FEE391; }"," [value > 2] { marker-fill: #FEC44F; }"," [value > 3] { marker-fill: #FE9929; }"," [value > 4] { marker-fill: #EC7014; }"," [value > 5] { marker-fill: #CC4C02; }"," [value > 6] { marker-fill: #993404; }"," [value > 7] { marker-fill: #662506; }","}"].join("\n"),l={src:"source-over","src-over":"source-over","dst-over":"destination-over","src-in":"source-in","dst-in":"destination-in","src-out":"source-out","dst-out":"destination-out","src-atop":"source-atop","dst-atop":"destination-atop",xor:"xor",darken:"darken",lighten:"lighten"};r.extend(h.prototype,r.Event,{clearCanvas:function(){var e=this._canvas,t=this._Map["-torque-clear-color"];if(t==="rgba(255, 255, 255, 0)"||!t)this._canvas.width=this._canvas.width;else{var n=this._ctx;n.setTransform(1,0,0,1,0,0);var r=this._Map["comp-op"];n.globalCompositeOperation=c(r),n.fillStyle=t,n.fillRect(0,0,e.width,e.height)}},setCanvas:function(e){this._canvas=e,this._ctx=e.getContext("2d")},setCartoCSS:function(e){this.setShader((new o.RendererJS).render(e))},setShader:function(e){this._sprites=[],this._shader=e,this._Map=this._shader.getDefault().getStyle({},{zoom:0});var t=this._shader.getImageURLs();this._preloadIcons(t)},clearSpriteCache:function(){this._sprites=[]},generateSprite:function(e,t,n){var o=this,u=s.metric("torque.renderer.point.generateSprite").start(),a=e.getStyle({value:t},n);if(this._style===null||this._style!==a)this._style=a;var f=a["marker-width"];if(!f)return null;if(a["marker-opacity"]===0&&!a["marker-line-opacity"])return null;var l=this._createCanvas(),c=l.getContext("2d"),h=a["marker-file"]||a["point-file"],p=h&&this._qualifyURL(h);if(p&&this._iconsToLoad<=0&&this._icons[p]){var d=this._icons[p],v=Math.min(a["marker-width"]*2||d.width,i.MAX_SPRITE_RADIUS*2),m=Math.min((a["marker-height"]||v)*(d.width/d.height),i.MAX_SPRITE_RADIUS*2);l.width=c.width=v,l.height=c.height=m,c.scale(v/d.width,m/d.height),i.renderSprite(c,d,a)}else{var g=(a["marker-line-width"]||0)+f*2,y=c.width=l.width=c.height=l.height=Math.ceil(g);c.translate(y/2,y/2);var b=a["marker-type"];b&&b==="rectangle"?i.renderRectangle(c,a):i.renderPoint(c,a)}u.end(!0);if(r.flags.sprites_to_images){var w=this._createImage();return w.src=l.toDataURL(),w}return l},renderTile:function(e,t,n){if(this._iconsToLoad>0)return this.on("allIconsLoaded",function(){this.renderTile.apply(this,[e,t,n])}),!1;var r=s.metric("torque.renderer.point.renderLayers").start(),i=this._shader.getLayers();for(var o=0,u=i.length;o<u;++o){var a=i[o];if(a.name()!=="Map"){var f=this._sprites[o]||(this._sprites[o]={});for(var l=0;l<a.frames().length;++l){var c=a.frames()[l],h=f[c]||(f[c]=[]);this._renderTile(e,t-c,c,h,a)}}}return r.end(!0),n&&n(null)},_createCanvas:function(){return this.options.canvasClass?new this.options.canvasClass:document.createElement("canvas")},_createImage:function(){return this.options.imageClass?new this.options.imageClass:new Image},_setImageSrc:function(e,t,n){this.options.setImageSrc?this.options.setImageSrc(e,t,n):(e.onload=function(){n(null)},e.onerror=function(){n(new Error("Could not load image"))},e.src=t)},_qualifyURL:function(e){if(typeof this.options.qualifyURL!="undefined")return this.options.qualifyURL(e);var t=document.createElement("a");return t.href=e,t.href},_renderTile:function(e,t,n,i,o,u){if(!this._canvas)return;var a=s.metric("torque.renderer.point.renderTile").start(),f=this._ctx,l=c(o.eval("comp-op"))||this.options.blendmode;l&&(f.globalCompositeOperation=l),this.options.cumulative&&t>e.maxDate&&(t=e.maxDate);var h=this.options.resolution*(this.TILE_SIZE/this.options.resolution-1),p=e.timeCount[t],d=this.options.resolution/2;if(p){var v=e.timeIndex[t];for(var m=0;m<p;++m){var g=e.renderDataPos[v+m],y=e.renderData[v+m];if(y){var b=i[y];b===undefined&&(b=i[y]=this.generateSprite(o,y,r.extend({zoom:e.z,"frame-offset":n},u)));if(b){var w=e.x[g]-(b.width>>1)+d,E=h-e.y[g]+d;f.drawImage(b,w,E-(b.height>>1))}}}}a.end(!0)},setBlendMode:function(e){this.options.blendmode=e},getActivePointsBBox:function(e,t){var n=[],i=new r.Mercator,s=this.options.resolution*(this.TILE_SIZE/this.options.resolution-1),o=e.timeCount[t],u=e.timeIndex[t];for(var a=0;a<o;++a){var f=e.renderDataPos[u+a],l=e.renderData[u+a];if(l){var c=e.x[f],h=s-e.y[f];n.push(i.tilePixelBBox(e.coord.x,e.coord.y,e.coord.z,c,h))}}return n},getValues:function(e,t,n){n=n||[];var r=e.timeCount[t],i=e.timeIndex[t];for(var s=0;s<r;++s){var o=e.renderDataPos[i+s];n.push(e.renderData[i+s])}return n},getValueFor:function(e,t,n,i){var s=new r.Mercator,o=this.options.resolution,u=o>>1,a=this.options.resolution*(this.TILE_SIZE/this.options.resolution-1),f=e.timeCount[t],l=e.timeIndex[t];for(var c=0;c<f;++c){var h=e.renderDataPos[l+c],p=e.renderData[l+c];if(p){var d=e.x[h],v=a-e.y[h],m=n+u-d,g=i+u-v;if(m>=0&&m<o&&g>=0&&g<o)return{value:p,bbox:s.tilePixelBBox(e.coord.x,e.coord.y,e.coord.z,d-u,v-u,o)}}}return null},_preloadIcons:function(e){var t=this;if(e.length>0&&!this._forcePoints){var n=Object.keys(e.reduce(function(e,n){var r=t._qualifyURL(n);return t._icons[r]||(e[r]=!0),e},{})),r=t._shader.getLayers().some(function(e){return typeof e.shader["image-filters"]!="undefined"});this._iconsToLoad+=n.length,n.forEach(function(e){t._icons[e]=null;var n=t._createImage();r&&(n.crossOrigin="Anonymous"),t._setImageSrc(n,e,function(i){i?(t._forcePoints=!0,t.clearSpriteCache(),t._iconsToLoad=0,t.fire("allIconsLoaded"),r&&console.info("Only CORS-enabled, or same domain image-files can be used in combination with image-filters"),console.error("Couldn't get marker-file "+e)):(t._icons[e]=n,t._iconsToLoad--,t._iconsToLoad<=0&&(t.clearSpriteCache(),t.fire("allIconsLoaded")))})})}else this.fire("allIconsLoaded")},applyFilters:function(){if(this._style&&this._style["image-filters"]){function e(e){var t="";for(var n=0;n<e.args.length;n++){var r=e.args[n].rgb;t+=r[0]+":"+r[1]+":"+r[2]}return t}var t=this._gradients[e(this._style["image-filters"])];if(!t){function n(e){var t=e.toString(16);return t.length==1?"0"+t:t}function r(e,t,r){return"#"+n(e)+n(t)+n(r)}t={};var i=this._style["image-filters"].args,s=1/i.length;for(var o=0;o<i.length;o++){var u=s*o+s,a=i[o].rgb,f=r(a[0],a[1],a[2]);t[u]=f}this._gradients[e(this._style["image-filters"])]=t}this._filters.gradient(t),this._filters.draw()}}}),t.exports=h}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"../":11,"../profiler":18,"./cartocss_render":24,"./torque_filters":28,carto:38}],27:[function(e,t,n){(function(n){function o(e,t){this.options=t,r.tree.Reference.set(torque["torque-reference"]),this.setCanvas(e),this.setCartoCSS(this.options.cartocss||i)}var r=n.carto||e("carto"),i=["#layer {"," polygon-fill: #FFFF00;"," [value > 10] { polygon-fill: #FFFF00; }"," [value > 100] { polygon-fill: #FFCC00; }"," [value > 1000] { polygon-fill: #FE9929; }"," [value > 10000] { polygon-fill: #FF6600; }"," [value > 100000] { polygon-fill: #FF3300; }","}"].join("\n"),s=Math.PI*2;o.prototype={setCartoCSS:function(e){this._cartoCssStyle=(new r.RendererJS).render(e);if(this._cartoCssStyle.getLayers().length>1)throw new Error("only one CartoCSS layer is supported");this._shader=this._cartoCssStyle.getLayers()[0].shader},setCanvas:function(e){if(!e)return;this._canvas=e,this._ctx=e.getContext("2d")},accumulate:function(e,t){var n=Profiler.metric("RectangleRender:accumulate").start(),r,i,s,o,u,a,f,l,c=this.options.resolution,h=256/c,p=new Float32Array(h*h);typeof t!="object"&&(t=[t]);for(u=0;u<t.length;++u){a=t[u],f=e.timeCount[a];if(f){l=e.timeIndex[a];for(o=0;o<f;++o)s=e.renderDataPos[l+o],r=e.x[s]/c,i=e.y[s]/c,p[r*h+i]+=e.renderData[l+o]}}return n.end(),p},renderTileAccum:function(e,t,n){var r=Profiler.metric("RectangleRender:renderTileAccum").start(),i,s,o,u,a=this.options.resolution,f=this._ctx,l=256/a|0,c=l*l,h=this._colors;this.options.blendmode&&(f.globalCompositeOperation=this.options.blendmode);var p=this._shader["polygon-opacity"]||function(){return 1};for(var d=0;d<c;++d){var v=d,m=e[d];m&&(s=v/l|0,o=v%l,i=this._shader["polygon-fill"]({value:m},{zoom:0}),f.fillStyle=i,u=p({value:m},{zoom:0}),u===null&&(u=1),f.globalAlpha=u,f.fillRect(s*a,256-a-o*a,a,a))}r.end()},renderTile:function(e,t,n){if(!this._canvas)return;var r=this.options.resolution,i=this._ctx,s=this._colors,o=e.timeCount[t];if(o){var u=this._canvas.width,a=this._canvas.height,f=e.timeIndex[t];for(var l=0;l<activePixels;++l){var c=e.renderDataPos[f+l],h=e.renderData[f+l];if(h){var p=s[Math.min(h,s.length-1)],d=e.x[c],v=e.y[c];i.fillStyle=p,i.fillRect(d,v,r,r)}}}return n&&n(null)}},t.exports=o}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{carto:38}],28:[function(e,t,n){"use strict";function r(e,t){if(!(this instanceof r))return new r(e,t);t=t||{},this._canvas=e=typeof e=="string"?document.getElementById(e):e,this._ctx=e.getContext("2d"),this._width=e.width,this._height=e.height,this._max=1,this._data=[],this.canvasClass=t.canvasClass}r.prototype={defaultGradient:{.4:"blue",.6:"cyan",.7:"lime",.8:"yellow",1:"red"},gradient:function(e){var t=this._createCanvas(),n=t.getContext("2d"),r=n.createLinearGradient(0,0,0,256);t.width=1,t.height=256;for(var i in e)r.addColorStop(+i,e[i]);return n.fillStyle=r,n.fillRect(0,0,1,256),this._grad=n.getImageData(0,0,1,256).data,this},draw:function(){this._grad||this.gradient(this.defaultGradient);var e=this._ctx,t=e.getImageData(0,0,this._canvas.width,this._canvas.height);return this._colorize(t.data,this._grad),e.putImageData(t,0,0),this},_colorize:function(e,t){for(var n=3,r=e.length,i;n<r;n+=4)i=e[n]*4,i&&(e[n-3]=t[i],e[n-2]=t[i+1],e[n-1]=t[i+2])},_createCanvas:function(){return this.canvasClass?new this.canvasClass:document.createElement("canvas")}},t.exports=r},{}],29:[function(e,t,n){(function(n){function s(e,t,n){function u(){i.removeChild(s),clearTimeout(a),delete window[o]}n=n||{},n.timeout=n.timeout===undefined?1e4:n.timeout;var i=document.getElementsByTagName("head")[0],s=document.createElement("script"),o=n.callbackName||"torque_"+Date.now();r.isFunction(o)&&(o=o()),window[o]=function(){u(),t.apply(window,arguments)};var a=setTimeout(function(){u(),t.call(window,null)},n.timeout);e=e.replace("callback=?","callback="+o),s.type="text/javascript",s.src=e,s.async=!0,setTimeout(function(){i.appendChild(s)},0)}function o(e,t,r){function u(){var e=o.status,n,i=r.responseType==="arraybuffer"?o.response:o.responseText;!e&&i||e>=200&&e<300||e===304?t(o):t(null)}r=r||{method:"GET",data:null,responseType:"text"},i={url:e,callback:t};var s=XMLHttpRequest;n.XDomainRequest&&!("withCredentials"in s)&&/^(http(s)?:)?\/\//.test(e)&&(s=XDomainRequest);var o=new s;return o.open(r.method,e,!0),"onload"in o?o.onload=o.onerror=u:o.onreadystatechange=function(){o.readyState>3&&u()},o.onprogress=function(){},o.responseType=r.responseType,r.data&&(o.setRequestHeader("Content-type","application/json"),o.setRequestHeader("Accept","*")),o.send(r.data),o}function u(e,t,n){return o(e,n,{data:t,method:"POST"})}var r=e("./core"),i=null;t.exports={get:o,post:u,jsonp:s,lastCall:function(){return i}}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"./core":5}],30:[function(e,t,n){},{}],31:[function(e,t,n){function u(e,t){return r.isUndefined(t)?""+t:r.isNumber(t)&&(isNaN(t)||!isFinite(t))?t.toString():r.isFunction(t)||r.isRegExp(t)?t.toString():t}function a(e,t){return r.isString(e)?e.length<t?e:e.slice(0,t):e}function f(e){return a(JSON.stringify(e.actual,u),128)+" "+e.operator+" "+a(JSON.stringify(e.expected,u),128)}function l(e,t,n,r,i){throw new o.AssertionError({message:n,actual:e,expected:t,operator:r,stackStartFunction:i})}function c(e,t){e||l(e,!0,t,"==",o.ok)}function h(e,t){if(e===t)return!0;if(r.isBuffer(e)&&r.isBuffer(t)){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}return r.isDate(e)&&r.isDate(t)?e.getTime()===t.getTime():r.isRegExp(e)&&r.isRegExp(t)?e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase:!r.isObject(e)&&!r.isObject(t)?e==t:d(e,t)}function p(e){return Object.prototype.toString.call(e)=="[object Arguments]"}function d(e,t){if(r.isNullOrUndefined(e)||r.isNullOrUndefined(t))return!1;if(e.prototype!==t.prototype)return!1;if(p(e))return p(t)?(e=i.call(e),t=i.call(t),h(e,t)):!1;try{var n=g(e),s=g(t),o,u}catch(a){return!1}if(n.length!=s.length)return!1;n.sort(),s.sort();for(u=n.length-1;u>=0;u--)if(n[u]!=s[u])return!1;for(u=n.length-1;u>=0;u--){o=n[u];if(!h(e[o],t[o]))return!1}return!0}function v(e,t){return!e||!t?!1:Object.prototype.toString.call(t)=="[object RegExp]"?t.test(e):e instanceof t?!0:t.call({},e)===!0?!0:!1}function m(e,t,n,i){var s;r.isString(n)&&(i=n,n=null);try{t()}catch(o){s=o}i=(n&&n.name?" ("+n.name+").":".")+(i?" "+i:"."),e&&!s&&l(s,n,"Missing expected exception"+i),!e&&v(s,n)&&l(s,n,"Got unwanted exception"+i);if(e&&s&&n&&!v(s,n)||!e&&s)throw s}var r=e("util/"),i=Array.prototype.slice,s=Object.prototype.hasOwnProperty,o=t.exports=c;o.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=f(this),this.generatedMessage=!0);var n=t.stackStartFunction||l;if(Error.captureStackTrace)Error.captureStackTrace(this,n);else{var r=new Error;if(r.stack){var i=r.stack,s=n.name,o=i.indexOf("\n"+s);if(o>=0){var u=i.indexOf("\n",o+1);i=i.substring(u+1)}this.stack=i}}},r.inherits(o.AssertionError,Error),o.fail=l,o.ok=c,o.equal=function(t,n,r){t!=n&&l(t,n,r,"==",o.equal)},o.notEqual=function(t,n,r){t==n&&l(t,n,r,"!=",o.notEqual)},o.deepEqual=function(t,n,r){h(t,n)||l(t,n,r,"deepEqual",o.deepEqual)},o.notDeepEqual=function(t,n,r){h(t,n)&&l(t,n,r,"notDeepEqual",o.notDeepEqual)},o.strictEqual=function(t,n,r){t!==n&&l(t,n,r,"===",o.strictEqual)},o.notStrictEqual=function(t,n,r){t===n&&l(t,n,r,"!==",o.notStrictEqual)},o.throws=function(e,t,n){m.apply(this,[!0].concat(i.call(arguments)))},o.doesNotThrow=function(e,t){m.apply(this,[!1].concat(i.call(arguments)))},o.ifError=function(e){if(e)throw e};var g=Object.keys||function(e){var t=[];for(var n in e)s.call(e,n)&&t.push(n);return t}},{"util/":36}],32:[function(e,t,n){typeof Object.create=="function"?t.exports=function(t,n){t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,n){t.super_=n;var r=function(){};r.prototype=n.prototype,t.prototype=new r,t.prototype.constructor=t}},{}],33:[function(e,t,n){(function(e){function t(e,t){var n=0;for(var r=e.length-1;r>=0;r--){var i=e[r];i==="."?e.splice(r,1):i===".."?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function s(e,t){if(e.filter)return e.filter(t);var n=[];for(var r=0;r<e.length;r++)t(e[r],r,e)&&n.push(e[r]);return n}var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,i=function(e){return r.exec(e).slice(1)};n.resolve=function(){var n="",r=!1;for(var i=arguments.length-1;i>=-1&&!r;i--){var o=i>=0?arguments[i]:e.cwd();if(typeof o!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!o)continue;n=o+"/"+n,r=o.charAt(0)==="/"}return n=t(s(n.split("/"),function(e){return!!e}),!r).join("/"),(r?"/":"")+n||"."},n.normalize=function(e){var r=n.isAbsolute(e),i=o(e,-1)==="/";return e=t(s(e.split("/"),function(e){return!!e}),!r).join("/"),!e&&!r&&(e="."),e&&i&&(e+="/"),(r?"/":"")+e},n.isAbsolute=function(e){return e.charAt(0)==="/"},n.join=function(){var e=Array.prototype.slice.call(arguments,0);return n.normalize(s(e,function(e,t){if(typeof e!="string")throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},n.relative=function(e,t){function r(e){var t=0;for(;t<e.length;t++)if(e[t]!=="")break;var n=e.length-1;for(;n>=0;n--)if(e[n]!=="")break;return t>n?[]:e.slice(t,n-t+1)}e=n.resolve(e).substr(1),t=n.resolve(t).substr(1);var i=r(e.split("/")),s=r(t.split("/")),o=Math.min(i.length,s.length),u=o;for(var a=0;a<o;a++)if(i[a]!==s[a]){u=a;break}var f=[];for(var a=u;a<i.length;a++)f.push("..");return f=f.concat(s.slice(u)),f.join("/")},n.sep="/",n.delimiter=":",n.dirname=function(e){var t=i(e),n=t[0],r=t[1];return!n&&!r?".":(r&&(r=r.substr(0,r.length-1)),n+r)},n.basename=function(e,t){var n=i(e)[2];return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},n.extname=function(e){return i(e)[3]};var o="ab".substr(-1)==="b"?function(e,t,n){return e.substr(t,n)}:function(e,t,n){return t<0&&(t=e.length+t),e.substr(t,n)}}).call(this,e("_process"))},{_process:34}],34:[function(e,t,n){function i(){}var r=t.exports={};r.nextTick=function(){var e=typeof window!="undefined"&&window.setImmediate,t=typeof window!="undefined"&&window.MutationObserver,n=typeof window!="undefined"&&window.postMessage&&window.addEventListener;if(e)return function(e){return window.setImmediate(e)};var r=[];if(t){var i=document.createElement("div"),s=new MutationObserver(function(){var e=r.slice();r.length=0,e.forEach(function(e){e()})});return s.observe(i,{attributes:!0}),function(t){r.length||i.setAttribute("yes","no"),r.push(t)}}return n?(window.addEventListener("message",function(e){var t=e.source;if((t===window||t===null)&&e.data==="process-tick"){e.stopPropagation();if(r.length>0){var n=r.shift();n()}}},!0),function(t){r.push(t),window.postMessage("process-tick","*")}):function(t){setTimeout(t,0)}}(),r.title="browser",r.browser=!0,r.env={},r.argv=[],r.on=i,r.addListener=i,r.once=i,r.off=i,r.removeListener=i,r.removeAllListeners=i,r.emit=i,r.binding=function(e){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(e){throw new Error("process.chdir is not supported")}},{}],35:[function(e,t,n){t.exports=function(t){return t&&typeof t=="object"&&typeof t.copy=="function"&&typeof t.fill=="function"&&typeof t.readUInt8=="function"}},{}],36:[function(e,t,n){(function(t,r){function u(e,t){var r={seen:[],stylize:f};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),y(t)?r.showHidden=t:t&&n._extend(r,t),T(r.showHidden)&&(r.showHidden=!1),T(r.depth)&&(r.depth=2),T(r.colors)&&(r.colors=!1),T(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=a),c(r,e,r.depth)}function a(e,t){var n=u.styles[t];return n?"["+u.colors[n][0]+"m"+e+"["+u.colors[n][1]+"m":e}function f(e,t){return e}function l(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}function c(e,t,r){if(e.customInspect&&t&&A(t.inspect)&&t.inspect!==n.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(r,e);return S(i)||(i=c(e,i,r)),i}var s=h(e,t);if(s)return s;var o=Object.keys(t),u=l(o);e.showHidden&&(o=Object.getOwnPropertyNames(t));if(L(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return p(t);if(o.length===0){if(A(t)){var a=t.name?": "+t.name:"";return e.stylize("[Function"+a+"]","special")}if(N(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(k(t))return e.stylize(Date.prototype.toString.call(t),"date");if(L(t))return p(t)}var f="",y=!1,b=["{","}"];g(t)&&(y=!0,b=["[","]"]);if(A(t)){var w=t.name?": "+t.name:"";f=" [Function"+w+"]"}N(t)&&(f=" "+RegExp.prototype.toString.call(t)),k(t)&&(f=" "+Date.prototype.toUTCString.call(t)),L(t)&&(f=" "+p(t));if(o.length!==0||!!y&&t.length!=0){if(r<0)return N(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var E;return y?E=d(e,t,r,u,o):E=o.map(function(n){return v(e,t,r,u,n,y)}),e.seen.pop(),m(E,f,b)}return b[0]+f+b[1]}function h(e,t){if(T(t))return e.stylize("undefined","undefined");if(S(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(E(t))return e.stylize(""+t,"number");if(y(t))return e.stylize(""+t,"boolean");if(b(t))return e.stylize("null","null")}function p(e){return"["+Error.prototype.toString.call(e)+"]"}function d(e,t,n,r,i){var s=[];for(var o=0,u=t.length;o<u;++o)H(t,String(o))?s.push(v(e,t,n,r,String(o),!0)):s.push("");return i.forEach(function(i){i.match(/^\d+$/)||s.push(v(e,t,n,r,i,!0))}),s}function v(e,t,n,r,i,s){var o,u,a;a=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]},a.get?a.set?u=e.stylize("[Getter/Setter]","special"):u=e.stylize("[Getter]","special"):a.set&&(u=e.stylize("[Setter]","special")),H(r,i)||(o="["+i+"]"),u||(e.seen.indexOf(a.value)<0?(b(n)?u=c(e,a.value,null):u=c(e,a.value,n-1),u.indexOf("\n")>-1&&(s?u=u.split("\n").map(function(e){return" "+e}).join("\n").substr(2):u="\n"+u.split("\n").map(function(e){return" "+e}).join("\n"))):u=e.stylize("[Circular]","special"));if(T(o)){if(s&&i.match(/^\d+$/))return u;o=JSON.stringify(""+i),o.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+u}function m(e,t,n){var r=0,i=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(t===""?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function g(e){return Array.isArray(e)}function y(e){return typeof e=="boolean"}function b(e){return e===null}function w(e){return e==null}function E(e){return typeof e=="number"}function S(e){return typeof e=="string"}function x(e){return typeof e=="symbol"}function T(e){return e===void 0}function N(e){return C(e)&&M(e)==="[object RegExp]"}function C(e){return typeof e=="object"&&e!==null}function k(e){return C(e)&&M(e)==="[object Date]"}function L(e){return C(e)&&(M(e)==="[object Error]"||e instanceof Error)}function A(e){return typeof e=="function"}function O(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e=="undefined"}function M(e){return Object.prototype.toString.call(e)}function _(e){return e<10?"0"+e.toString(10):e.toString(10)}function P(){var e=new Date,t=[_(e.getHours()),_(e.getMinutes()),_(e.getSeconds())].join(":");return[e.getDate(),D[e.getMonth()],t].join(" ")}function H(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var i=/%[sdj%]/g;n.format=function(e){if(!S(e)){var t=[];for(var n=0;n<arguments.length;n++)t.push(u(arguments[n]));return t.join(" ")}var n=1,r=arguments,s=r.length,o=String(e).replace(i,function(
e){if(e==="%%")return"%";if(n>=s)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"};default:return e}});for(var a=r[n];n<s;a=r[++n])b(a)||!C(a)?o+=" "+a:o+=" "+u(a);return o},n.deprecate=function(e,i){function o(){if(!s){if(t.throwDeprecation)throw new Error(i);t.traceDeprecation?console.trace(i):console.error(i),s=!0}return e.apply(this,arguments)}if(T(r.process))return function(){return n.deprecate(e,i).apply(this,arguments)};if(t.noDeprecation===!0)return e;var s=!1;return o};var s={},o;n.debuglog=function(e){T(o)&&(o=t.env.NODE_DEBUG||""),e=e.toUpperCase();if(!s[e])if((new RegExp("\\b"+e+"\\b","i")).test(o)){var r=t.pid;s[e]=function(){var t=n.format.apply(n,arguments);console.error("%s %d: %s",e,r,t)}}else s[e]=function(){};return s[e]},n.inspect=u,u.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]},u.styles={special:"cyan",number:"yellow","boolean":"yellow","undefined":"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},n.isArray=g,n.isBoolean=y,n.isNull=b,n.isNullOrUndefined=w,n.isNumber=E,n.isString=S,n.isSymbol=x,n.isUndefined=T,n.isRegExp=N,n.isObject=C,n.isDate=k,n.isError=L,n.isFunction=A,n.isPrimitive=O,n.isBuffer=e("./support/isBuffer");var D=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];n.log=function(){console.log("%s - %s",P(),n.format.apply(n,arguments))},n.inherits=e("inherits"),n._extend=function(e,t){if(!t||!C(t))return e;var n=Object.keys(t),r=n.length;while(r--)e[n[r]]=t[n[r]];return e}}).call(this,e("_process"),typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"./support/isBuffer":35,_process:34,inherits:32}],37:[function(e,t,n){(function(e){function i(t){return e.functions.hsla(t.h,t.s,t.l,t.a)}function s(t){return t instanceof e.Dimension?parseFloat(t.unit=="%"?t.value/100:t.value):typeof t=="number"?t:NaN}function o(e){return Math.min(1,Math.max(0,e))}e.functions={rgb:function(e,t,n){return this.rgba(e,t,n,1)},rgba:function(t,n,r,i){var o=[t,n,r].map(function(e){return s(e)});return i=s(i),o.some(isNaN)||isNaN(i)?null:new e.Color(o,i)},stop:function(e){var t,n;return arguments.length>1&&(t=arguments[1]),arguments.length>2&&(n=arguments[2]),{is:"tag",val:e,color:t,mode:n,toString:function(r){return'\n <stop value="'+e.ev(r)+'"'+(t?' color="'+t.ev(r)+'" ':"")+(n?' mode="'+n.ev(r)+'" ':"")+"/>"}}},hsl:function(e,t,n){return this.hsla(e,t,n,1)},hsla:function(e,t,n,r){function u(e){return e=e<0?e+1:e>1?e-1:e,e*6<1?o+(i-o)*e*6:e*2<1?i:e*3<2?o+(i-o)*(2/3-e)*6:o}e=s(e)%360/360,t=s(t),n=s(n),r=s(r);if([e,t,n,r].some(isNaN))return null;var i=n<=.5?n*(t+1):n+t-n*t,o=n*2-i;return this.rgba(u(e+1/3)*255,u(e)*255,u(e-1/3)*255,r)},hue:function(t){return"toHSL"in t?new e.Dimension(Math.round(t.toHSL().h)):null},saturation:function(t){return"toHSL"in t?new e.Dimension(Math.round(t.toHSL().s*100),"%"):null},lightness:function(t){return"toHSL"in t?new e.Dimension(Math.round(t.toHSL().l*100),"%"):null},alpha:function(t){return"toHSL"in t?new e.Dimension(t.toHSL().a):null},saturate:function(e,t){if("toHSL"in e){var n=e.toHSL();return n.s+=t.value/100,n.s=o(n.s),i(n)}return null},desaturate:function(e,t){if("toHSL"in e){var n=e.toHSL();return n.s-=t.value/100,n.s=o(n.s),i(n)}return null},lighten:function(e,t){if("toHSL"in e){var n=e.toHSL();return n.l+=t.value/100,n.l=o(n.l),i(n)}return null},darken:function(e,t){if("toHSL"in e){var n=e.toHSL();return n.l-=t.value/100,n.l=o(n.l),i(n)}return null},fadein:function(e,t){if("toHSL"in e){var n=e.toHSL();return n.a+=t.value/100,n.a=o(n.a),i(n)}return null},fadeout:function(e,t){if("toHSL"in e){var n=e.toHSL();return n.a-=t.value/100,n.a=o(n.a),i(n)}return null},spin:function(e,t){if("toHSL"in e){var n=e.toHSL(),r=(n.h+t.value)%360;return n.h=r<0?360+r:r,i(n)}return null},replace:function(e,t,n){return e.is==="field"?e.toString+".replace("+t.toString()+", "+n.toString()+")":e.replace(t,n)},mix:function(t,n,r){var i=r.value/100,s=i*2-1,o=t.toHSL().a-n.toHSL().a,u=((s*o==-1?s:(s+o)/(1+s*o))+1)/2,a=1-u,f=[t.rgb[0]*u+n.rgb[0]*a,t.rgb[1]*u+n.rgb[1]*a,t.rgb[2]*u+n.rgb[2]*a],l=t.alpha*i+n.alpha*(1-i);return new e.Color(f,l)},greyscale:function(t){return this.desaturate(t,new e.Dimension(100))},"%":function(t){var n=Array.prototype.slice.call(arguments,1),r=t.value;for(var i=0;i<n.length;i++)r=r.replace(/%s/,n[i].value).replace(/%[da]/,n[i].toString());return r=r.replace(/%%/g,"%"),new e.Quoted(r)}};var t=["emboss","blur","gray","sobel","edge-detect","x-gradient","y-gradient","sharpen"];for(var n=0;n<t.length;n++){var r=t[n];e.functions[r]=function(t){return function(){return new e.ImageFilter(t)}}(r)}e.functions["agg-stack-blur"]=function(t,n){return new e.ImageFilter("agg-stack-blur",[t,n])},e.functions["scale-hsla"]=function(t,n,r,i,s,o,u,a){return new e.ImageFilter("scale-hsla",[t,n,r,i,s,o,u,a])}})(e("./tree"))},{"./tree":43}],38:[function(e,t,n){(function(t,r){function u(){if(t.browser)return e("../../package.json").version.split(".");if(parseInt(t.version.split(".")[1],10)>4)return e("../../package.json").version.split(".");var n=JSON.parse(s.readFileSync(o.join(r,"../../package.json")));return n.version.split(".")}function l(e,t){var n={bold:[1,22],inverse:[7,27],underline:[4,24],yellow:[33,39],green:[32,39],red:[31,39],grey:[90,39]};return"["+n[t][0]+"m"+e+"["+n[t][1]+"m"}var i=e("util"),s=e("fs"),o=e("path"),a={version:u(),Parser:e("./parser").Parser,Renderer:e("./renderer").Renderer,tree:e("./tree"),RendererJS:e("./renderer_js"),default_reference:e("./torque-reference"),writeError:function(e,t){var n="",r=e.extract,s=[];t=t||{};if(t.silent)return;t.indent=t.indent||"";if(!("index"in e)||!r)return i.error(t.indent+(e.stack||e.message));typeof r[0]=="string"&&s.push(l(e.line-1+" "+r[0],"grey")),r[1]===""&&typeof r[2]=="undefined"&&(r[1]="¶"),s.push(e.line+" "+r[1].slice(0,e.column)+l(l(r[1][e.column],"bold")+r[1].slice(e.column+1),"yellow")),typeof r[2]=="string"&&s.push(l(e.line+1+" "+r[2],"grey")),s=t.indent+s.join("\n"+t.indent)+"\n",n=t.indent+n+l(e.message,"red"),e.filename&&(n+=l(" in ","red")+e.filename),i.error(n,s),e.callLine&&(i.error(l("from ","red")+(e.filename||"")),i.error(l(e.callLine,"grey")+" "+e.callExtract)),e.stack&&i.error(l(e.stack,"red"))}};e("./tree/call"),e("./tree/color"),e("./tree/comment"),e("./tree/definition"),e("./tree/dimension"),e("./tree/element"),e("./tree/expression"),e("./tree/filterset"),e("./tree/filter"),e("./tree/field"),e("./tree/keyword"),e("./tree/layer"),e("./tree/literal"),e("./tree/operation"),e("./tree/quoted"),e("./tree/imagefilter"),e("./tree/reference"),e("./tree/rule"),e("./tree/ruleset"),e("./tree/selector"),e("./tree/style"),e("./tree/url"),e("./tree/value"),e("./tree/variable"),e("./tree/zoom"),e("./tree/invalid"),e("./tree/fontset"),e("./tree/frame_offset"),e("./functions");for(var f in a)n[f]=a[f]}).call(this,e("_process"),"/node_modules/carto/lib/carto")},{"../../package.json":74,"./functions":37,"./parser":39,"./renderer":40,"./renderer_js":41,"./torque-reference":42,"./tree":43,"./tree/call":44,"./tree/color":45,"./tree/comment":46,"./tree/definition":47,"./tree/dimension":48,"./tree/element":49,"./tree/expression":50,"./tree/field":51,"./tree/filter":52,"./tree/filterset":53,"./tree/fontset":54,"./tree/frame_offset":55,"./tree/imagefilter":56,"./tree/invalid":57,"./tree/keyword":58,"./tree/layer":59,"./tree/literal":60,"./tree/operation":61,"./tree/quoted":62,"./tree/reference":63,"./tree/rule":64,"./tree/ruleset":65,"./tree/selector":66,"./tree/style":67,"./tree/url":68,"./tree/value":69,"./tree/variable":70,"./tree/zoom":71,_process:34,fs:30,path:33,util:36}],39:[function(e,t,n){(function(t){var r=n,i=e("./tree"),s=t._||e("underscore");r.Parser=function(t){function v(){u=l[o],a=r,c=r}function m(){l[o]=u,r=a,c=r}function g(){r>c&&(l[o]=l[o].slice(r-c),c=r)}function y(e){var t,i,s,u,a,f,p;if(e instanceof Function)return e.call(h.parsers);if(typeof e=="string")t=n.charAt(r)===e?e:null,s=1,g();else{g(),t=e.exec(l[o]);if(!t)return null;s=t[0].length}if(t){var d=r+=s;f=r+l[o].length-s;while(r<f){u=n.charCodeAt(r);if(u!==32&&u!==10&&u!==9)break;r++}return l[o]=l[o].slice(s+(r-d)),c=r,l[o].length===0&&o<l.length-1&&o++,typeof t=="string"?t:t.length===1?t[0]:t}}function b(e){return typeof e=="string"?n.charAt(r)===e:!!e.test(l[o])}function w(e,t){return(e.slice(0,t).match(/\n/g)||"").length+1}function E(e){var r;s(e).defaults({index:f,filename:t.filename,message:"Parse error.",line:0,column:-1}),e.filename&&p.env.inputs&&p.env.inputs[e.filename]?r=p.env.inputs[e.filename]:r=n,e.line=w(r,e.index);for(var i=e.index;i>=0&&r.charAt(i)!=="\n";i--)e.column++;return new Error(s("<%=filename%>:<%=line%>:<%=column%> <%=message%>").template(e))}var n,r,o,u,a,f,l,c,h,p=this,d=function(){};return this.env=t=t||{},this.env.filename=this.env.filename||null,this.env.inputs=this.env.inputs||{},h={extractErrorLine:w,parse:function(e){var s,u,a,h,d,v,m=[],g,b=null;r=o=c=f=0,l=[],n=e.replace(/\r\n/g,"\n"),t.filename&&(p.env.inputs[t.filename]=n);var w=!1;l=function(e){var t=0,r=/(?:@\{[\w-]+\}|[^"'`\{\}\/\(\)\\])+/g,i=/\/\*(?:[^*]|\*+[^\/*])*\*+\/|\/\/.*/g,s=/"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'|`((?:[^`]|\\.)*)`/g,o=0,u,a=e[0],f;for(var l=0,c,h;l<n.length;){r.lastIndex=l,(u=r.exec(n))&&u.index===l&&(l+=u[0].length,a.push(u[0])),c=n.charAt(l),i.lastIndex=s.lastIndex=l;if(u=s.exec(n))if(u.index===l){l+=u[0].length,a.push(u[0]);continue}if(!f&&c==="/"){h=n.charAt(l+1);if(h==="/"||h==="*")if(u=i.exec(n))if(u.index===l){l+=u[0].length,a.push(u[0]);continue}}switch(c){case"{":if(!f){o++,a.push(c);break};case"}":if(!f){o--,a.push(c),e[++t]=a=[];break};case"(":if(!f){f=!0,a.push(c);break};case")":if(f){f=!1,a.push(c);break};default:a.push(c)}l++}return o!==0&&(b={index:l-1,type:"Parse",message:o>0?"missing closing `}`":"missing opening `{`"}),e.map(function(e){return e.join("")})}([[]]);if(b)throw E(b);s=new i.Ruleset([],y(this.parsers.primary)),s.root=!0,s.toList=function(){var e,t,n;return function(e){e.error=function(t){e.errors||(e.errors=new Error("")),e.errors.message?e.errors.message+="\n"+E(t).message:e.errors.message=E(t).message},e.frames=e.frames||[];var t=this.flatten([],[],e);return t.sort(S),t}}();var S=function(e,t){var n=e.specificity,r=t.specificity;return n[0]!=r[0]?r[0]-n[0]:n[1]!=r[1]?r[1]-n[1]:n[2]!=r[2]?r[2]-n[2]:r[3]-n[3]};return s},parsers:{primary:function(){var e,t=[];while((e=y(this.rule)||y(this.ruleset)||y(this.comment))||y(/^[\s\n]+/)||(e=y(this.invalid)))e&&t.push(e);return t},invalid:function(){var e=y(/^[^;\n]*[;\n]/);if(e)return new i.Invalid(e,a)},comment:function(){var e;if(n.charAt(r)!=="/")return;if(n.charAt(r+1)==="/")return new i.Comment(y(/^\/\/.*/),!0);if(e=y(/^\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/))return new i.Comment(e)},entities:{quoted:function(){if(n.charAt(r)!=='"'&&n.charAt(r)!=="'")return;var e=y(/^"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/);if(e)return new i.Quoted(e[1]||e[2])},field:function(){if(!y("["))return;var e=y(/(^[^\]]+)/);if(!y("]"))return;if(e)return new i.Field(e[1])},comparison:function(){var e=y(/^=~|=|!=|<=|>=|<|>/);if(e)return e},keyword:function(){var e=y(/^[A-Za-z-]+[A-Za-z-0-9_]*/);if(e)return new i.Keyword(e)},call:function(){var e,t;if(!(e=/^([\w\-]+|%)\(/.exec(l[o])))return;e=e[1];if(e==="url")return null;r+=e.length,y("("),t=y(this.entities.arguments);if(!y(")"))return;if(e)return new i.Call(e,t,r)},arguments:function(){var e=[],t;while(t=y(this.expression)){e.push(t);if(!y(","))break}return e},literal:function(){return y(this.entities.dimension)||y(this.entities.keywordcolor)||y(this.entities.hexcolor)||y(this.entities.quoted)},url:function(){var e;if(n.charAt(r)!=="u"||!y(/^url\(/))return;return e=y(this.entities.quoted)||y(this.entities.variable)||y(/^[\-\w%@$\/.&=:;#+?~]+/)||"",y(")")?new i.URL(typeof e.value!="undefined"||e instanceof i.Variable?e:new i.Quoted(e)):new i.Invalid(e,a,"Missing closing ) in URL.")},variable:function(){var e,s=r;if(n.charAt(r)==="@"&&(e=y(/^@[\w-]+/)))return new i.Variable(e,s,t.filename)},hexcolor:function(){var e;if(n.charAt(r)==="#"&&(e=y(/^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})/)))return new i.Color(e[1])},keywordcolor:function(){var e=l[o].match(/^[a-z]+/);if(e&&e[0]in i.Reference.data.colors)return new i.Color(i.Reference.data.colors[y(/^[a-z]+/)])},dimension:function(){var e=n.charCodeAt(r);if(e>57||e<45||e===47)return;var t=y(/^(-?\d*\.?\d+(?:[eE][-+]?\d+)?)(\%|\w+)?/);if(t)return new i.Dimension(t[1],t[2],a)}},variable:function(){var e;if(n.charAt(r)==="@"&&(e=y(/^(@[\w-]+)\s*:/)))return e[1]},entity:function(){return y(this.entities.call)||y(this.entities.literal)||y(this.entities.field)||y(this.entities.variable)||y(this.entities.url)||y(this.entities.keyword)},end:function(){return y(";")||b("}")},element:function(){var e=y(/^(?:[.#][\w\-]+|\*|Map)/);if(e)return new i.Element(e)},attachment:function(){var e=y(/^::([\w\-]+(?:\/[\w\-]+)*)/);if(e)return e[1]},selector:function(){var e,t,s,o=[],u,f=new i.Filterset,l,c=[],h=i.FrameOffset.none;segments=0,conditions=0;while((s=y(this.element))||(l=y(this.zoom))||(fo=y(this.frame_offset))||(u=y(this.filter))||(e=y(this.attachment))){segments++;if(s)o.push(s);else if(l)c.push(l),conditions++;else if(fo)h=fo,conditions++;else if(u){var p=f.add(u);if(p)throw E({message:p,index:r-1});conditions++}else{if(t)throw E({message:"Encountered second attachment name.",index:r-1});t=e}var d=n.charAt(r);if(d==="{"||d==="}"||d===";"||d===",")break}if(segments)return new i.Selector(f,c,h,o,t,conditions,a)},filter:function(){v();var e,n,r;if(!y("["))return;if(e=y(/^[a-zA-Z0-9\-_]+/)||y(this.entities.quoted)||y(this.entities.variable)||y(this.entities.keyword)||y(this.entities.field)){e instanceof i.Quoted&&(e=new i.Field(e.toString()));if((n=y(this.entities.comparison))&&(r=y(this.entities.quoted)||y(this.entities.variable)||y(this.entities.dimension)||y(this.entities.keyword)||y(this.entities.field))){if(!y("]"))throw E({message:"Missing closing ] of filter.",index:a-1});return e.is||(e=new i.Field(e)),new i.Filter(e,n,r,a,t.filename)}}},frame_offset:function(){v();var e,t;if(y(/^\[\s*frame-offset/g)&&(e=y(this.entities.comparison))&&(t=y(/^\d+/))&&y("]"))return i.FrameOffset(e,t,a)},zoom:function(){v();var e,t;if(y(/^\[\s*zoom/g)&&(e=y(this.entities.comparison))&&(t=y(this.entities.variable)||y(this.entities.dimension))&&y("]"))return new i.Zoom(e,t,a);m()},block:function(){var e;if(y("{")&&(e=y(this.primary))&&y("}"))return e},ruleset:function(){var e=[],t,n,r,s,o=[];v();while(t=y(this.selector)){e.push(t);while(y(this.comment));if(!y(","))break;while(y(this.comment));}if(t)while(y(this.comment));if(e.length>0&&(s=y(this.block))){if(e.length===1&&e[0].elements.length&&e[0].elements[0].value==="Map"){var u=new i.Ruleset(e,s);return u.isMap=!0,u}return new i.Ruleset(e,s)}m()},rule:function(){var e,s,o=n.charAt(r);v();if(o==="."||o==="#")return;if(e=y(this.variable)||y(this.property)){s=y(this.value);if(s&&y(this.end))return new i.Rule(e,s,a,t.filename);f=r,m()}},font:function(){var e=[],t=[],n,r,s;while(s=y(this.entity))t.push(s);e.push(new i.Expression(t));if(y(","))while(s=y(this.expression)){e.push(s);if(!y(","))break}return new i.Value(e)},value:function(){var e,t=[];while(e=y(this.expression)){t.push(e);if(!y(","))break}if(t.length>1)return new i.Value(t.map(function(e){return e.value[0]}));if(t.length===1)return new i.Value(t)},sub:function(){var e;if(y("(")&&(e=y(this.expression))&&y(")"))return e},multiplication:function(){var e,t,n,r;if(e=y(this.operand)){while((n=y("/")||y("*")||y("%"))&&(t=y(this.operand)))r=new i.Operation(n,[r||e,t],a);return r||e}},addition:function(){var e,t,s,o;if(e=y(this.multiplication)){while((s=y(/^[-+]\s+/)||n.charAt(r-1)!=" "&&(y("+")||y("-")))&&(t=y(this.multiplication)))o=new i.Operation(s,[o||e,t],a);return o||e}},operand:function(){return y(this.sub)||y(this.entity)},expression:function(){var e,t,n=[],r;while(e=y(this.addition)||y(this.entity))n.push(e);if(n.length>0)return new i.Expression(n)},property:function(){var e=y(/^(([a-z][-a-z_0-9]*\/)?\*?-?[-a-z_0-9]+)\s*:/);if(e)return e[1]}}},h}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"./tree":43,underscore:73}],40:[function(e,t,n){(function(n){function s(e,t,n,r){var i=t.filters,s=t.rules,o,u,a;for(var f=0;f<e.length;f++)o=e[f].filters.cloneWith(i),o?(a=n[o],a?a.addRules(s):(u=e[f].clone(o),u.addRules(s)&&(n[o]=u,e.splice(f,0,u),f++))):o===null&&(e[f]=e[f].clone(),e[f].addRules(s));return e}function o(e,t){var n=+(new Date),r={},i={},o=[],u,a,f;e.forEach(function(e){e.filters.ev(t)});for(var l=0;l<e.length;l++){f=e[l].attachment,u=[e[l]],r[f]||(r[f]=[],r[f].attachment=f,i[f]={},o.push(r[f]));for(var c=l+1;c<e.length;c++)e[c].attachment===f&&(u=s(u,e[c],i[f],t));for(var h=0;h<u.length;h++)i[f][u[h].filters]=u[h],r[f].push(u[h])}return t.benchmark&&console.warn("Inheritance time: "+(new Date-n)+"ms"),o}function u(e,t){return t.index-e.index}function a(e,t){for(var n=0;n<e.length;n++){var r=e[n];r.index=Infinity;for(var i=0;i<r.length;i++){var s=r[i].rules;for(var o=0;o<s.length;o++){var a=s[o];a.index<r.index&&(r.index=a.index)}}}var f=e.slice();return f.sort(u),f}function f(e,t,n){var s={},o=i.tree.Reference.data.symbolizers.map;return r(e).each(function(e,t){t in o&&(s[t]=t+'="'+e+'"')}),t.filter(function(e){return e.elements.join("")==="Map"}).forEach(function(e){for(var t=0;t<e.rules.length;t++){var r=e.rules[t].name;r in o||n.error({message:"Rule "+r+" not allowed for Map.",index:e.rules[t].index}),s[r]=e.rules[t].ev(n).toXML(n)}}),s}var r=n._||e("underscore"),i=e("./index");i.Renderer=function(t,n){this.env=t||{},this.options=n||{},this.options.mapnik_version=this.options.mapnik_version||"3.0.0"},i.Renderer.prototype.renderMSS=function(t){var n=r(this.env).defaults({benchmark:!1,validation_data:!1,effects:[]});if(!i.tree.Reference.setVersion(this.options.mapnik_version))throw new Error("Could not set mapnik version to "+this.options.mapnik_version);var s=[],u=[];n.benchmark&&console.time("Parsing MSS");var f=i.Parser(n).parse(t);n.benchmark&&console.timeEnd("Parsing MSS"),n.benchmark&&console.time("Rule generation");var l=f.toList(n);n.benchmark&&console.timeEnd("Rule generation"),n.benchmark&&console.time("Rule inheritance");var c=o(l,n);n.benchmark&&console.timeEnd("Rule inheritance"),n.benchmark&&console.time("Style sort");var h=a(c,n);n.benchmark&&console.timeEnd("Style sort"),n.benchmark&&console.time("Total Style generation");for(var p=0,d,v;p<h.length;p++){d=h[p],v="style"+(d.attachment!=="__default__"?"-"+d.attachment:""),u.push(v);var m=' Style "'+v+'" (#'+p+") toXML";n.benchmark&&console.time(m),s.push(i.tree.StyleXML(v,d.attachment,d,n)),n.benchmark&&console.timeEnd(m)}n.benchmark&&console.timeEnd("Total Style generation");if(n.errors)throw n.errors;return s.join("\n")},i.Renderer.prototype.render=function(t){function l(e,t){return function(e){return e.appliesTo(h.name,t)}}var n=r(this.env).defaults({benchmark:!1,validation_data:!1,effects:[],ppi:90.714});if(!i.tree.Reference.setVersion(this.options.mapnik_version))throw new Error("Could not set mapnik version to "+this.options.mapnik_version);var s=[],u=r(t.Stylesheet).chain().map(function(e){if(typeof e=="string")throw new Error("Stylesheet object is expected not a string: '"+e+"'");n=r(n).extend({filename:e.id});var t=+(new Date),s=i.Parser(n).parse(e.data);return n.benchmark&&console.warn("Parsing time: "+(new Date-t)+"ms"),s.toList(n)}).flatten().value(),c,h,p,d,v,m;for(var g=0;g<t.Layer.length;g++){h=t.Layer[g],c=[],p={},n.benchmark&&console.warn("processing layer: "+h.id);var y=(h["class"]||"").split(/\s+/g);for(var b=0;b<y.length;b++)p[y[b]]=!0;m=u.filter(l(h.name,p)),d=o(m,n),v=a(d,n);for(var w=0,E,S;w<v.length;w++){E=v[w],S=h.name+(E.attachment!=="__default__"?"-"+E.attachment:"");var x=i.tree.StyleXML(S,E.attachment,E,n);x&&(s.push(x),c.push(S))}s.push(i.tree.LayerXML(h,c))}s.unshift(n.effects.map(function(e){return e.toXML(n)}).join("\n"));var T=f(t,u,n);if(n.errors)throw n.errors;var N=r(t).reduce(function(e,t,n){if(!t&&t!==0)return e;switch(n){case"srs":case"Layer":case"Stylesheet":break;case"bounds":case"center":case"minzoom":case"maxzoom":case"version":e.push(' <Parameter name="'+n+'">'+t+"</Parameter>");break;case"name":case"description":case"legend":case"attribution":case"template":e.push(' <Parameter name="'+n+'"><![CDATA['+t+"]]></Parameter>");break;case"format":e.push(' <Parameter name="'+n+'">'+t+"</Parameter>");break;case"interactivity":e.push(' <Parameter name="interactivity_layer">'+t.layer+"</Parameter>"),e.push(' <Parameter name="interactivity_fields">'+t.fields+"</Parameter>");break;default:"string"==typeof t?e.push(' <Parameter name="'+n+'"><![CDATA['+t+"]]></Parameter>"):"number"==typeof t?e.push(' <Parameter name="'+n+'">'+t+"</Parameter>"):"boolean"==typeof t&&e.push(' <Parameter name="'+n+'">'+t+"</Parameter>")}return e},[]);N.length&&s.unshift("<Parameters>\n"+N.join("\n")+"\n</Parameters>\n");var C=r(T).map(function(e){return" "+e}).join("");return s.unshift('<?xml version="1.0" encoding="utf-8"?>\n<!DOCTYPE Map[]>\n<Map'+C+">\n"),s.push("</Map>"),s.join("\n")},t.exports=i,t.exports.addRules=s,t.exports.inheritDefinitions=o,t.exports.sortStyles=a}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"./index":38,underscore:73}],41:[function(require,module,exports){(function(global){(function(carto){function CartoCSS(e,t){this.options=t||{},this.imageURLs=[],e&&this.setStyle(e)}var tree=require("./tree"),_=global._||require("underscore");CartoCSS.Layer=function(e,t){this.options=t,this.shader=e},CartoCSS.Layer.prototype={fullName:function(){return this.shader.attachment},name:function(){return this.fullName().split("::")[0]},frames:function(){return this.shader.frames},attachment:function(){return this.fullName().split("::")[1]},eval:function(e){var t=this.shader[e];if(!t||!t.style)return;return t.style({},{zoom:0,"frame-offset":0})},getStyle:function(e,t){var n={};for(var r in this.shader)r!=="attachment"&&r!=="zoom"&&r!=="frames"&&r!=="symbolizers"&&(n[r]=this.shader[r].style(e,t));return n},getSymbolizers:function(){return this.shader.symbolizers},isVariable:function(){for(var e in this.shader)if(e!=="attachment"&&e!=="zoom"&&e!=="frames"&&e!=="symbolizers"&&!this.shader[e].constant)return!0;return!1},getShader:function(){return this.shader},filter:function(e,t,n){for(var r in this.shader){var i=this.shader[r](t,n);if(i)return!0}return!1},transformGeometry:function(e){return e},transformGeometries:function(e){return e}},CartoCSS.prototype={setStyle:function(e){var t=this.parse(e);if(!t)throw new Error(this.parse_env.errors);this.layers=t.map(function(e){return new CartoCSS.Layer(e)})},getLayers:function(){return this.layers},getDefault:function(){return this.findLayer({attachment:"__default__"})},findLayer:function(e){return _.find(this.layers,function(t){for(var n in e){var r=t[n];typeof r=="function"&&(r=r.call(t));if(e[n]!==r)return!1}return!0})},_createFn:function(e){var t=e.join("\n");return this.options.debug&&console.log(t),Function("data","ctx","var _value = null; "+t+"; return _value; ")},_compile:function(shader){typeof shader=="string"&&(shader=eval("(function() { return "+shader+"; })()")),this.shader_src=shader;for(var attr in shader){var c=mapper[attr];c&&(this.compiled[c]=eval("(function() { return shader[attr]; })();"))}},getImageURLs:function(){return this.imageURLs},parse:function(e){var t={frames:[],errors:[],error:function(e){this.errors.push(e)}};this.parse_env=t;var n=null;try{n=(new carto.Parser(t)).parse(e)}catch(r){t.errors.push(r.message);return}if(n){function i(e){return e.elements[0]+"::"+e.attachment}var s=n.toList(t);s.reverse();var o={};for(var u=0;u<s.length;++u){var a=s[u],f=i(a),l=o[f]=o[f]||{symbolizers:[]};for(var c=0;c<a.rules.length;c++)if(a.rules[c].name==="marker-file"||a.rules[c].name==="point-file"){var h=a.rules[c].value.value[0].value[0].value.value;this.imageURLs.push(h)}l.frames=[],l.zoom=tree.Zoom.all;var p=a.toJS(t);this.options.debug&&console.log("props",p);for(var d in p){var v=l[d]=l[d]||{constant:!1,symbolizer:null,js:[],index:0};v.js.push(p[d].map(function(e){return e.js}).join("\n")),v.symbolizer=_.first(p[d].map(function(e){return e.symbolizer})),v.index=_.max(p[d].map(function(e){return e.index}).concat(v.index)),v.constant=!_.any(p[d].map(function(e){return!e.constant}))}}var m=[];this.options.debug&&console.log(o);var g={};for(var u=0;u<s.length;++u){var a=s[u],y=i(a),l=o[y];if(!g[y]){this.options.debug&&console.log("**",y);for(var b in l)b!=="zoom"&&b!=="frames"&&b!=="symbolizers"&&(this.options.debug&&console.log("*",b),l[b].style=this._createFn(l[b].js),l.symbolizers.push(l[b].symbolizer),l.symbolizers=_.uniq(l.symbolizers));l.attachment=y,m.push(l),g[y]=!0}l.zoom|=a.zoom,l.frames.push(a.frame_offset)}for(u=0;u<m.length;++u)m[u].frames=_.uniq(m[u].frames);return m}return null}},carto.RendererJS=function(e){this.options=e||{},this.options.mapnik_version=this.options.mapnik_version||"latest"},carto.RendererJS.prototype.render=function(t,n){var r=require("./torque-reference");return tree.Reference.setData(r.version.latest),new CartoCSS(t,this.options)},typeof module!="undefined"&&(module.exports=carto.RendererJS)})(require("../carto"))}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"../carto":38,"./torque-reference":42,"./tree":43,underscore:73}],42:[function(e,t,n){var r={version:"2.1.1",style:{"filter-mode":{type:["all","first"],doc:"Control the processing behavior of Rule filters within a Style. If 'all' is used then all Rules are processed sequentially independent of whether any previous filters matched. If 'first' is used then it means processing ends after the first match (a positive filter evaluation) and no further Rules in the Style are processed ('first' is usually the default for CSS implementations on top of Mapnik to simplify translation from CSS to Mapnik XML)","default-value":"all","default-meaning":"All Rules in a Style are processed whether they have filters or not and whether or not the filter conditions evaluate to true."},"image-filters":{css:"image-filters","default-value":"none","default-meaning":"no filters",type:"functions",functions:[["agg-stack-blur",2],["emboss",0],["blur",0],["gray",0],["sobel",0],["edge-detect",0],["x-gradient",0],["y-gradient",0],["invert",0],["sharpen",0],["colorize-alpha",-1],["color-to-alpha",1],["scale-hsla",8]],doc:"A list of image filters."},"comp-op":{css:"comp-op","default-value":"src-over","default-meaning":"add the current layer on top of other layers",doc:"Composite operation. This defines how this layer should behave relative to layers atop or below it.",type:["clear","src","dst","src-over","source-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","lighter","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]},opacity:{css:"opacity",type:"float",doc:"An alpha value for the style (which means an alpha applied to all features in separate buffer and then composited back to main buffer)","default-value":1,"default-meaning":"no separate buffer will be used and no alpha will be applied to the style after rendering"}},layer:{name:{"default-value":"",type:"string",required:!0,"default-meaning":"No layer name has been provided",doc:"The name of a layer. Can be anything you wish and is not strictly validated, but ideally unique in the map"},srs:{"default-value":"",type:"string","default-meaning":"No srs value is provided and the value will be inherited from the Map's srs",doc:"The spatial reference system definition for the layer, aka the projection. Can either be a proj4 literal string like '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs' or, if the proper proj4 epsg/nad/etc identifier files are installed, a string that uses an id like: '+init=epsg:4326'"},status:{"default-value":!0,type:"boolean","default-meaning":"This layer will be marked as active and available for processing",doc:"A property that can be set to false to disable this layer from being processed"},minzoom:{"default-value":"0",type:"float","default-meaning":"The layer will be visible at the minimum possible scale",doc:"The minimum scale denominator that this layer will be visible at. A layer's visibility is determined by whether its status is true and if the Map scale >= minzoom - 1e-6 and scale < maxzoom + 1e-6"},maxzoom:{"default-value":"1.79769e+308",type:"float","default-meaning":"The layer will be visible at the maximum possible scale",doc:"The maximum scale denominator that this layer will be visible at. The default is the numeric limit of the C++ double type, which may vary slightly by system, but is likely a massive number like 1.79769e+308 and ensures that this layer will always be visible unless the value is reduced. A layer's visibility is determined by whether its status is true and if the Map scale >= minzoom - 1e-6 and scale < maxzoom + 1e-6"},queryable:{"default-value":!1,type:"boolean","default-meaning":"The layer will not be available for the direct querying of data values",doc:"This property was added for GetFeatureInfo/WMS compatibility and is rarely used. It is off by default meaning that in a WMS context the layer will not be able to be queried unless the property is explicitly set to true"},"clear-label-cache":{"default-value":!1,type:"boolean","default-meaning":"The renderer's collision detector cache (used for avoiding duplicate labels and overlapping markers) will not be cleared immediately before processing this layer",doc:"This property, by default off, can be enabled to allow a user to clear the collision detector cache before a given layer is processed. This may be desirable to ensure that a given layers data shows up on the map even if it normally would not because of collisions with previously rendered labels or markers"},"group-by":{"default-value":"",type:"string","default-meaning":"No special layer grouping will be used during rendering",doc:"https://github.com/mapnik/mapnik/wiki/Grouped-rendering"},"buffer-size":{"default-value":"0",type:"float","default-meaning":"No buffer will be used",doc:"Extra tolerance around the Layer extent (in pixels) used to when querying and (potentially) clipping the layer data during rendering"},"maximum-extent":{"default-value":"none",type:"bbox","default-meaning":"No clipping extent will be used",doc:"An extent to be used to limit the bounds used to query this specific layer data during rendering. Should be minx, miny, maxx, maxy in the coordinates of the Layer."}},symbolizers:{"*":{"image-filters":{css:"image-filters","default-value":"none","default-meaning":"no filters",type:"functions",functions:[["agg-stack-blur",2],["emboss",0],["blur",0],["gray",0],["sobel",0],["edge-detect",0],["x-gradient",0],["y-gradient",0],["invert",0],["sharpen",0],["colorize-alpha",-1],["color-to-alpha",1],["scale-hsla",8]],doc:"A list of image filters."},"comp-op":{css:"comp-op","default-value":"src-over","default-meaning":"add the current layer on top of other layers",doc:"Composite operation. This defines how this layer should behave relative to layers atop or below it.",type:["clear","src","dst","src-over","source-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","lighter","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]},opacity:{css:"opacity",type:"float",doc:"An alpha value for the style (which means an alpha applied to all features in separate buffer and then composited back to main buffer)","default-value":1,"default-meaning":"no separate buffer will be used and no alpha will be applied to the style after rendering"}},map:{"background-color":{css:"background-color","default-value":"none","default-meaning":"transparent",type:"color",doc:"Map Background color"},"background-image":{css:"background-image",type:"uri","default-value":"","default-meaning":"transparent",doc:"An image that is repeated below all features on a map as a background.",description:"Map Background image"},srs:{css:"srs",type:"string"
,"default-value":"+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs","default-meaning":"The proj4 literal of EPSG:4326 is assumed to be the Map's spatial reference and all data from layers within this map will be plotted using this coordinate system. If any layers do not declare an srs value then they will be assumed to be in the same srs as the Map and not transformations will be needed to plot them in the Map's coordinate space",doc:"Map spatial reference (proj4 string)"},"buffer-size":{css:"buffer-size","default-value":"0",type:"float","default-meaning":"No buffer will be used",doc:'Extra tolerance around the map (in pixels) used to ensure labels crossing tile boundaries are equally rendered in each tile (e.g. cut in each tile). Not intended to be used in combination with "avoid-edges".'},"maximum-extent":{css:"","default-value":"none",type:"bbox","default-meaning":"No clipping extent will be used",doc:"An extent to be used to limit the bounds used to query all layers during rendering. Should be minx, miny, maxx, maxy in the coordinates of the Map."},base:{css:"base","default-value":"","default-meaning":"This base path defaults to an empty string meaning that any relative paths to files referenced in styles or layers will be interpreted relative to the application process.",type:"string",doc:"Any relative paths used to reference files will be understood as relative to this directory path if the map is loaded from an in memory object rather than from the filesystem. If the map is loaded from the filesystem and this option is not provided it will be set to the directory of the stylesheet."},"paths-from-xml":{css:"","default-value":!0,"default-meaning":"Paths read from XML will be interpreted from the location of the XML",type:"boolean",doc:"value to control whether paths in the XML will be interpreted from the location of the XML or from the working directory of the program that calls load_map()"},"minimum-version":{css:"","default-value":"none","default-meaning":"Mapnik version will not be detected and no error will be thrown about compatibility",type:"string",doc:"The minumum Mapnik version (e.g. 0.7.2) needed to use certain functionality in the stylesheet"},"font-directory":{css:"font-directory",type:"uri","default-value":"none","default-meaning":"No map-specific fonts will be registered",doc:"Path to a directory which holds fonts which should be registered when the Map is loaded (in addition to any fonts that may be automatically registered)."}},polygon:{fill:{css:"polygon-fill",type:"color","default-value":"rgba(128,128,128,1)","default-meaning":"gray and fully opaque (alpha = 1), same as rgb(128,128,128)",doc:"Fill color to assign to a polygon"},"fill-opacity":{css:"polygon-opacity",type:"float",doc:"The opacity of the polygon","default-value":1,"default-meaning":"opaque"},gamma:{css:"polygon-gamma",type:"float","default-value":1,"default-meaning":"fully antialiased",range:"0-1",doc:"Level of antialiasing of polygon edges"},"gamma-method":{css:"polygon-gamma-method",type:["power","linear","none","threshold","multiply"],"default-value":"power","default-meaning":"pow(x,gamma) is used to calculate pixel gamma, which produces slightly smoother line and polygon antialiasing than the 'linear' method, while other methods are usually only used to disable AA",doc:"An Antigrain Geometry specific rendering hint to control the quality of antialiasing. Under the hood in Mapnik this method is used in combination with the 'gamma' value (which defaults to 1). The methods are in the AGG source at https://github.com/mapnik/mapnik/blob/master/deps/agg/include/agg_gamma_functions.h"},clip:{css:"polygon-clip",type:"boolean","default-value":!0,"default-meaning":"geometry will be clipped to map bounds before rendering",doc:"geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."},smooth:{css:"polygon-smooth",type:"float","default-value":0,"default-meaning":"no smoothing",range:"0-1",doc:"Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."},"geometry-transform":{css:"polygon-geometry-transform",type:"functions","default-value":"none","default-meaning":"geometry will not be transformed",doc:"Allows transformation functions to be applied to the geometry.",functions:[["matrix",6],["translate",2],["scale",2],["rotate",3],["skewX",1],["skewY",1]]},"comp-op":{css:"polygon-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},line:{stroke:{css:"line-color","default-value":"rgba(0,0,0,1)",type:"color","default-meaning":"black and fully opaque (alpha = 1), same as rgb(0,0,0)",doc:"The color of a drawn line"},"stroke-width":{css:"line-width","default-value":1,type:"float",doc:"The width of a line in pixels"},"stroke-opacity":{css:"line-opacity","default-value":1,type:"float","default-meaning":"opaque",doc:"The opacity of a line"},"stroke-linejoin":{css:"line-join","default-value":"miter",type:["miter","round","bevel"],doc:"The behavior of lines when joining"},"stroke-linecap":{css:"line-cap","default-value":"butt",type:["butt","round","square"],doc:"The display of line endings"},"stroke-gamma":{css:"line-gamma",type:"float","default-value":1,"default-meaning":"fully antialiased",range:"0-1",doc:"Level of antialiasing of stroke line"},"stroke-gamma-method":{css:"line-gamma-method",type:["power","linear","none","threshold","multiply"],"default-value":"power","default-meaning":"pow(x,gamma) is used to calculate pixel gamma, which produces slightly smoother line and polygon antialiasing than the 'linear' method, while other methods are usually only used to disable AA",doc:"An Antigrain Geometry specific rendering hint to control the quality of antialiasing. Under the hood in Mapnik this method is used in combination with the 'gamma' value (which defaults to 1). The methods are in the AGG source at https://github.com/mapnik/mapnik/blob/master/deps/agg/include/agg_gamma_functions.h"},"stroke-dasharray":{css:"line-dasharray",type:"numbers",doc:"A pair of length values [a,b], where (a) is the dash length and (b) is the gap length respectively. More than two values are supported for more complex patterns.","default-value":"none","default-meaning":"solid line"},"stroke-dashoffset":{css:"line-dash-offset",type:"numbers",doc:"valid parameter but not currently used in renderers (only exists for experimental svg support in Mapnik which is not yet enabled)","default-value":"none","default-meaning":"solid line"},"stroke-miterlimit":{css:"line-miterlimit",type:"float",doc:"The limit on the ratio of the miter length to the stroke-width. Used to automatically convert miter joins to bevel joins for sharp angles to avoid the miter extending beyond the thickness of the stroking path. Normally will not need to be set, but a larger value can sometimes help avoid jaggy artifacts.","default-value":4,"default-meaning":"Will auto-convert miters to bevel line joins when theta is less than 29 degrees as per the SVG spec: 'miterLength / stroke-width = 1 / sin ( theta / 2 )'"},clip:{css:"line-clip",type:"boolean","default-value":!0,"default-meaning":"geometry will be clipped to map bounds before rendering",doc:"geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."},smooth:{css:"line-smooth",type:"float","default-value":0,"default-meaning":"no smoothing",range:"0-1",doc:"Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."},offset:{css:"line-offset",type:"float","default-value":0,"default-meaning":"no offset",doc:"Offsets a line a number of pixels parallel to its actual path. Postive values move the line left, negative values move it right (relative to the directionality of the line)."},rasterizer:{css:"line-rasterizer",type:["full","fast"],"default-value":"full",doc:"Exposes an alternate AGG rendering method that sacrifices some accuracy for speed."},"geometry-transform":{css:"line-geometry-transform",type:"functions","default-value":"none","default-meaning":"geometry will not be transformed",doc:"Allows transformation functions to be applied to the geometry.",functions:[["matrix",6],["translate",2],["scale",2],["rotate",3],["skewX",1],["skewY",1]]},"comp-op":{css:"line-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},markers:{file:{css:"marker-file",doc:"An SVG file that this marker shows at each placement. If no file is given, the marker will show an ellipse.","default-value":"","default-meaning":"An ellipse or circle, if width equals height",type:"uri"},opacity:{css:"marker-opacity",doc:"The overall opacity of the marker, if set, overrides both the opacity of both the fill and stroke","default-value":1,"default-meaning":"The stroke-opacity and fill-opacity will be used",type:"float"},"fill-opacity":{css:"marker-fill-opacity",doc:"The fill opacity of the marker","default-value":1,"default-meaning":"opaque",type:"float"},stroke:{css:"marker-line-color",doc:"The color of the stroke around a marker shape.","default-value":"black",type:"color"},"stroke-width":{css:"marker-line-width",doc:"The width of the stroke around a marker shape, in pixels. This is positioned on the boundary, so high values can cover the area itself.",type:"float"},"stroke-opacity":{css:"marker-line-opacity","default-value":1,"default-meaning":"opaque",doc:"The opacity of a line",type:"float"},placement:{css:"marker-placement",type:["point","line","interior"],"default-value":"point","default-meaning":"Place markers at the center point (centroid) of the geometry",doc:"Attempt to place markers on a point, in the center of a polygon, or if markers-placement:line, then multiple times along a line. 'interior' placement can be used to ensure that points placed on polygons are forced to be inside the polygon interior"},"multi-policy":{css:"marker-multi-policy",type:["each","whole","largest"],"default-value":"each","default-meaning":"If a feature contains multiple geometries and the placement type is either point or interior then a marker will be rendered for each",doc:"A special setting to allow the user to control rendering behavior for 'multi-geometries' (when a feature contains multiple geometries). This setting does not apply to markers placed along lines. The 'each' policy is default and means all geometries will get a marker. The 'whole' policy means that the aggregate centroid between all geometries will be used. The 'largest' policy means that only the largest (by bounding box areas) feature will get a rendered marker (this is how text labeling behaves by default)."},"marker-type":{css:"marker-type",type:["arrow","ellipse","rectangle"],"default-value":"ellipse",doc:"The default marker-type. If a SVG file is not given as the marker-file parameter, the renderer provides either an arrow or an ellipse (a circle if height is equal to width)"},width:{css:"marker-width","default-value":10,doc:"The width of the marker, if using one of the default types.",type:"float",expression:!0},height:{css:"marker-height","default-value":10,doc:"The height of the marker, if using one of the default types.",type:"float",expression:!0},fill:{css:"marker-fill","default-value":"blue",doc:"The color of the area of the marker.",type:"color"},"allow-overlap":{css:"marker-allow-overlap",type:"boolean","default-value":!1,doc:"Control whether overlapping markers are shown or hidden.","default-meaning":"Do not allow makers to overlap with each other - overlapping markers will not be shown."},"ignore-placement":{css:"marker-ignore-placement",type:"boolean","default-value":!1,"default-meaning":"do not store the bbox of this geometry in the collision detector cache",doc:"value to control whether the placement of the feature will prevent the placement of other features"},spacing:{css:"marker-spacing",doc:"Space between repeated labels","default-value":100,type:"float"},"max-error":{css:"marker-max-error",type:"float","default-value":.2,doc:"The maximum difference between actual marker placement and the marker-spacing parameter. Setting a high value can allow the renderer to try to resolve placement conflicts with other symbolizers."},transform:{css:"marker-transform",type:"functions",functions:[["matrix",6],["translate",2],["scale",2],["rotate",3],["skewX",1],["skewY",1]],"default-value":"","default-meaning":"No transformation",doc:"SVG transformation definition"},clip:{css:"marker-clip",type:"boolean","default-value":!0,"default-meaning":"geometry will be clipped to map bounds before rendering",doc:"geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."},smooth:{css:"marker-smooth",type:"float","default-value":0,"default-meaning":"no smoothing",range:"0-1",doc:"Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."},"geometry-transform":{css:"marker-geometry-transform",type:"functions","default-value":"none","default-meaning":"geometry will not be transformed",doc:"Allows transformation functions to be applied to the geometry.",functions:[["matrix",6],["translate",2],["scale",2],["rotate",3],["skewX",1],["skewY",1]]},"comp-op":{css:"marker-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},shield:{name:{css:"shield-name",type:"string",expression:!0,serialization:"content",doc:'Value to use for a shield"s text label. Data columns are specified using brackets like [column_name]'},file:{css:"shield-file",required:!0,type:"uri","default-value":"none",doc:"Image file to render behind the shield text"},"face-name":{css:"shield-face-name",type:"string",validate:"font",doc:"Font name and style to use for the shield text","default-value":"",required:!0},"unlock-image":{css:"shield-unlock-image",type:"boolean",doc:"This parameter should be set to true if you are trying to position text beside rather than on top of the shield image","default-value":!1,"default-meaning":"text alignment relative to the shield image uses the center of the image as the anchor for text positioning."},size:{css:"shield-size",type:"float",doc:"The size of the shield text in pixels"},fill:{css:"shield-fill",type:"color",doc:"The color of the shield text"},placement:{css:"shield-placement",type:["point","line","vertex","interior"],"default-value":"point",doc:"How this shield should be placed. Point placement attempts to place it on top of points, line places along lines multiple times per feature, vertex places on the vertexes of polygons, and interior attempts to place inside of polygons."},"avoid-edges":{css:"shield-avoid-edges",doc:"Tell positioning algorithm to avoid labeling near intersection edges.",type:"boolean","default-value":!1},"allow-overlap":{css:"shield-allow-overlap",type:"boolean","default-value":!1,doc:"Control whether overlapping shields are shown or hidden.","default-meaning":"Do not allow shields to overlap with other map elements already placed."},"minimum-distance":{css:"shield-min-distance",type:"float","default-value":0,doc:"Minimum distance to the next shield symbol, not necessarily the same shield."},spacing:{css:"shield-spacing",type:"float","default-value":0,doc:"The spacing between repeated occurrences of the same shield on a line"},"minimum-padding":{css:"shield-min-padding","default-value":0,doc:"Determines the minimum amount of padding that a shield gets relative to other shields",type:"float"},"wrap-width":{css:"shield-wrap-width",type:"unsigned","default-value":0,doc:"Length of a chunk of text in characters before wrapping text"},"wrap-before":{css:"shield-wrap-before",type:"boolean","default-value":!1,doc:"Wrap text before wrap-width is reached. If false, wrapped lines will be a bit longer than wrap-width."},"wrap-character":{css:"shield-wrap-character",type:"string","default-value":" ",doc:"Use this character instead of a space to wrap long names."},"halo-fill":{css:"shield-halo-fill",type:"color","default-value":"#FFFFFF","default-meaning":"white",doc:"Specifies the color of the halo around the text."},"halo-radius":{css:"shield-halo-radius",doc:"Specify the radius of the halo in pixels","default-value":0,"default-meaning":"no halo",type:"float"},"character-spacing":{css:"shield-character-spacing",type:"unsigned","default-value":0,doc:"Horizontal spacing between characters (in pixels). Currently works for point placement only, not line placement."},"line-spacing":{css:"shield-line-spacing",doc:"Vertical spacing between lines of multiline labels (in pixels)",type:"unsigned"},dx:{css:"shield-text-dx",type:"float",doc:"Displace text within shield by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right","default-value":0},dy:{css:"shield-text-dy",type:"float",doc:"Displace text within shield by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down","default-value":0},"shield-dx":{css:"shield-dx",type:"float",doc:"Displace shield by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right","default-value":0},"shield-dy":{css:"shield-dy",type:"float",doc:"Displace shield by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down","default-value":0},opacity:{css:"shield-opacity",type:"float",doc:"(Default 1.0) - opacity of the image used for the shield","default-value":1},"text-opacity":{css:"shield-text-opacity",type:"float",doc:"(Default 1.0) - opacity of the text placed on top of the shield","default-value":1},"horizontal-alignment":{css:"shield-horizontal-alignment",type:["left","middle","right","auto"],doc:"The shield's horizontal alignment from its centerpoint","default-value":"auto"},"vertical-alignment":{css:"shield-vertical-alignment",type:["top","middle","bottom","auto"],doc:"The shield's vertical alignment from its centerpoint","default-value":"middle"},"text-transform":{css:"shield-text-transform",type:["none","uppercase","lowercase","capitalize"],doc:"Transform the case of the characters","default-value":"none"},"justify-alignment":{css:"shield-justify-alignment",type:["left","center","right","auto"],doc:"Define how text in a shield's label is justified","default-value":"auto"},clip:{css:"shield-clip",type:"boolean","default-value":!0,"default-meaning":"geometry will be clipped to map bounds before rendering",doc:"geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."},"comp-op":{css:"shield-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},"line-pattern":{file:{css:"line-pattern-file",type:"uri","default-value":"none",required:!0,doc:"An image file to be repeated and warped along a line"},clip:{css:"line-pattern-clip",type:"boolean","default-value":!0,"default-meaning":"geometry will be clipped to map bounds before rendering",doc:"geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."},smooth:{css:"line-pattern-smooth",type:"float","default-value":0,"default-meaning":"no smoothing",range:"0-1",doc:"Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."},"geometry-transform":{css:"line-pattern-geometry-transform",type:"functions","default-value":"none","default-meaning":"geometry will not be transformed",doc:"Allows transformation functions to be applied to the geometry.",functions:[["matrix",6],["translate",2],["scale",2],["rotate",3],["skewX",1],["skewY",1]]},"comp-op":{css:"line-pattern-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},"polygon-pattern":{file:{css:"polygon-pattern-file",type:"uri","default-value":"none",required:!0,doc:"Image to use as a repeated pattern fill within a polygon"},alignment:{css:"polygon-pattern-alignment",type:["local","global"],"default-value":"local",doc:"Specify whether to align pattern fills to the layer or to the map."},gamma:{css:"polygon-pattern-gamma",type:"float","default-value":1,"default-meaning":"fully antialiased",range:"0-1",doc:"Level of antialiasing of polygon pattern edges"},opacity:{css:"polygon-pattern-opacity",type:"float",doc:"(Default 1.0) - Apply an opacity level to the image used for the pattern","default-value":1,"default-meaning":"The image is rendered without modifications"},clip:{css:"polygon-pattern-clip",type:"boolean","default-value":!0,"default-meaning":"geometry will be clipped to map bounds before rendering",doc:"geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."},smooth:{css:"polygon-pattern-smooth",type:"float","default-value":0,"default-meaning":"no smoothing",range:"0-1",doc:"Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."},"geometry-transform":{css:"polygon-pattern-geometry-transform",type:"functions","default-value":"none","default-meaning":"geometry will not be transformed",doc:"Allows transformation functions to be applied to the geometry.",functions:[["matrix",6],["translate",2],["scale",2],["rotate",3],["skewX",1],["skewY",1]]},"comp-op":{css:"polygon-pattern-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},raster:{opacity:{css:"raster-opacity","default-value":1,"default-meaning":"opaque",type:"float",doc:"The opacity of the raster symbolizer on top of other symbolizers."},"filter-factor":{css:"raster-filter-factor","default-value":-1,"default-meaning":"Allow the datasource to choose appropriate downscaling.",type:"float",doc:"This is used by the Raster or Gdal datasources to pre-downscale images using overviews. Higher numbers can sometimes cause much better scaled image output, at the cost of speed."},scaling:{css:"raster-scaling",type:["near","fast","bilinear","bilinear8","bicubic","spline16","spline36","hanning","hamming","hermite","kaiser","quadric","catrom","gaussian","bessel","mitchell","sinc","lanczos","blackman"],"default-value":"near",doc:"The scaling algorithm used to making different resolution versions of this raster layer. Bilinear is a good compromise between speed and accuracy, while lanczos gives the highest quality."},"mesh-size":{css:"raster-mesh-size","default-value":16,"default-meaning":"Reprojection mesh will be 1/16 of the resolution of the source image",type:"unsigned",doc:"A reduced resolution mesh is used for raster reprojection, and the total image size is divided by the mesh-size to determine the quality of that mesh. Values for mesh-size larger than the default will result in faster reprojection but might lead to distortion."},"comp-op":{css:"raster-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},point:{file:{css:"point-file",type:"uri",required:!1,"default-value":"none",doc:"Image file to represent a point"},"allow-overlap":{css:"point-allow-overlap",type:"boolean","default-value":!1,doc:"Control whether overlapping points are shown or hidden.","default-meaning":"Do not allow points to overlap with each other - overlapping markers will not be shown."},"ignore-placement":{css:"point-ignore-placement",type:"boolean","default-value":!1,"default-meaning":"do not store the bbox of this geometry in the collision detector cache",doc:"value to control whether the placement of the feature will prevent the placement of other features"},opacity:{css:"point-opacity",type:"float","default-value":1,"default-meaning":"Fully opaque",doc:"A value from 0 to 1 to control the opacity of the point"},placement:{css:"point-placement",type:["centroid","interior"],doc:"How this point should be placed. Centroid calculates the geometric center of a polygon, which can be outside of it, while interior always places inside of a polygon.","default-value":"centroid"},transform:{css:"point-transform",type:"functions",functions:[["matrix",6],["translate",2],["scale",2],["rotate",3],["skewX",1],["skewY",1]],"default-value":"","default-meaning":"No transformation",doc:"SVG transformation definition"},"comp-op":{css:"point-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},text:{name:{css:"text-name",type:"string",expression:!0,required:!0,"default-value":"",serialization:"content",doc:"Value to use for a text label. Data columns are specified using brackets like [column_name]"},"face-name":{css:"text-face-name",type:"string",validate:"font",doc:"Font name and style to render a label in",required:!0},size:{css:"text-size",type:"float","default-value":10,doc:"Text size in pixels"},"text-ratio":{css:"text-ratio",doc:"Define the amount of text (of the total) present on successive lines when wrapping occurs","default-value":0,type:"unsigned"},"wrap-width":{css:"text-wrap-width",doc:"Length of a chunk of text in characters before wrapping text","default-value":0,type:"unsigned"},"wrap-before":{css:"text-wrap-before",type:"boolean","default-value":!1,doc:"Wrap text before wrap-width is reached. If false, wrapped lines will be a bit longer than wrap-width."},"wrap-character":{css:"text-wrap-character",type:"string","default-value":" ",doc:"Use this character instead of a space to wrap long text."},spacing:{css:"text-spacing",type:"unsigned",doc:"Distance between repeated text labels on a line (aka. label-spacing)"},"character-spacing":{css:"text-character-spacing",type:"float","default-value":0,doc:"Horizontal spacing adjustment between characters in pixels"},"line-spacing":{css:"text-line-spacing","default-value":0,type:"unsigned",doc:"Vertical spacing adjustment between lines in pixels"},"label-position-tolerance":{css:"text-label-position-tolerance","default-value":0,type:"unsigned",doc:"Allows the label to be displaced from its ideal position by a number of pixels (only works with placement:line)"},"max-char-angle-delta":{css:"text-max-char-angle-delta",type:"float","default-value":"22.5",doc:"The maximum angle change, in degrees, allowed between adjacent characters in a label. This value internally is converted to radians to the default is 22.5*math.pi/180.0. The higher the value the fewer labels will be placed around around sharp corners."},fill:{css:"text-fill",doc:"Specifies the color for the text","default-value":"#000000",type:"color"},opacity:{css:"text-opacity",doc:"A number from 0 to 1 specifying the opacity for the text","default-value":1,"default-meaning":"Fully opaque",type:"float"},"halo-fill":{css:"text-halo-fill",type:"color","default-value":"#FFFFFF","default-meaning":"white",doc:"Specifies the color of the halo around the text."},"halo-radius":{css:"text-halo-radius",doc:"Specify the radius of the halo in pixels","default-value":0,"default-meaning":"no halo",type:"float"},dx:{css:"text-dx",type:"float",doc:"Displace text by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right","default-value":0},dy:{css:"text-dy",type:"float",doc:"Displace text by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down","default-value":0},"vertical-alignment":{css:"text-vertical-alignment",type:["top","middle","bottom","auto"],doc:"Position of label relative to point position.","default-value":"auto","default-meaning":'Default affected by value of dy; "bottom" for dy>0, "top" for dy<0.'},"avoid-edges":{css:"text-avoid-edges",doc:"Tell positioning algorithm to avoid labeling near intersection edges.","default-value":!1,type:"boolean"},"minimum-distance":{css:"text-min-distance",doc:"Minimum permitted distance to the next text symbolizer.",type:"float"},"minimum-padding":{css:"text-min-padding",doc:"Determines the minimum amount of padding that a text symbolizer gets relative to other text",type:"float"},"minimum-path-length":{css:"text-min-path-length",type:"float","default-value":0,"default-meaning":"place labels on all paths",doc:"Place labels only on paths longer than this value."},"allow-overlap":{css:"text-allow-overlap",type:"boolean","default-value":!1,doc:"Control whether overlapping text is shown or hidden.","default-meaning":"Do not allow text to overlap with other text - overlapping markers will not be shown."},orientation:{css:"text-orientation",type:"float",expression:!0,doc:"Rotate the text."},placement:{css:"text-placement",type:["point","line","vertex","interior"],"default-value":"point",doc:"Control the style of placement of a point versus the geometry it is attached to."
},"placement-type":{css:"text-placement-type",doc:'Re-position and/or re-size text to avoid overlaps. "simple" for basic algorithm (using text-placements string,) "dummy" to turn this feature off.',type:["dummy","simple"],"default-value":"dummy"},placements:{css:"text-placements",type:"string","default-value":"",doc:'If "placement-type" is set to "simple", use this "POSITIONS,[SIZES]" string. An example is `text-placements: "E,NE,SE,W,NW,SW";` '},"text-transform":{css:"text-transform",type:["none","uppercase","lowercase","capitalize"],doc:"Transform the case of the characters","default-value":"none"},"horizontal-alignment":{css:"text-horizontal-alignment",type:["left","middle","right","auto"],doc:"The text's horizontal alignment from its centerpoint","default-value":"auto"},"justify-alignment":{css:"text-align",type:["left","right","center","auto"],doc:"Define how text is justified","default-value":"auto","default-meaning":"Auto alignment means that text will be centered by default except when using the `placement-type` parameter - in that case either right or left justification will be used automatically depending on where the text could be fit given the `text-placements` directives"},clip:{css:"text-clip",type:"boolean","default-value":!0,"default-meaning":"geometry will be clipped to map bounds before rendering",doc:"geometries are clipped to map bounds by default for best rendering performance. In some cases users may wish to disable this to avoid rendering artifacts."},"comp-op":{css:"text-comp-op","default-value":"src-over","default-meaning":"add the current symbolizer on top of other symbolizer",doc:"Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",type:["clear","src","dst","src-over","dst-over","src-in","dst-in","src-out","dst-out","src-atop","dst-atop","xor","plus","minus","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","contrast","invert","invert-rgb","grain-merge","grain-extract","hue","saturation","color","value"]}},building:{fill:{css:"building-fill","default-value":"#FFFFFF",doc:"The color of the buildings walls.",type:"color"},"fill-opacity":{css:"building-fill-opacity",type:"float",doc:"The opacity of the building as a whole, including all walls.","default-value":1},height:{css:"building-height",doc:"The height of the building in pixels.",type:"float",expression:!0,"default-value":"0"}},torque:{"-torque-clear-color":{css:"-torque-clear-color",type:"color","default-value":"rgba(255, 255, 255, 0)","default-meaning":"full clear",doc:"color used to clear canvas on each frame"},"-torque-frame-count":{css:"-torque-frame-count","default-value":"128",type:"float","default-meaning":"the data is broken into 128 time frames",doc:"Number of animation steps/frames used in the animation. If the data contains a fewere number of total frames, the lesser value will be used."},"-torque-resolution":{css:"-torque-resolution","default-value":"2",type:"float","default-meaning":"",doc:"Spatial resolution in pixels. A resolution of 1 means no spatial aggregation of the data. Any other resolution of N results in spatial aggregation into cells of NxN pixels. The value N must be power of 2"},"-torque-animation-duration":{css:"-torque-animation-duration","default-value":"30",type:"float","default-meaning":"the animation lasts 30 seconds",doc:"Animation duration in seconds"},"-torque-aggregation-function":{css:"-torque-aggregation-function","default-value":"count(cartodb_id)",type:"string","default-meaning":"the value for each cell is the count of points in that cell",doc:"A function used to calculate a value from the aggregate data for each cell. See -torque-resolution"},"-torque-time-attribute":{css:"-torque-time-attribute","default-value":"time",type:"string","default-meaning":"the data column in your table that is of a time based type",doc:"The table column that contains the time information used create the animation"},"-torque-data-aggregation":{css:"-torque-data-aggregation","default-value":"linear",type:["linear","cumulative"],"default-meaning":"previous values are discarded",doc:"A linear animation will discard previous values while a cumulative animation will accumulate them until it restarts"}}},colors:{aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50],transparent:[0,0,0,0]},filter:{value:["true","false","null","point","linestring","polygon","collection"]}};t.exports={version:{latest:r,"2.1.1":r}}},{}],43:[function(e,t,n){typeof t!="undefined"&&(t.exports.find=function(e,t){for(var n=0,r;n<e.length;n++)if(r=t.call(e,e[n]))return r;return null})},{}],44:[function(e,t,n){(function(t){(function(n){var r=t._||e("underscore");n.Call=function(t,n,r){this.name=t,this.args=n,this.index=r},n.Call.prototype={is:"call",ev:function(e){var t=this.args.map(function(t){return t.ev(e)});for(var i=0;i<t.length;i++)if(t[i].is==="undefined")return{is:"undefined",value:"undefined"};if(this.name in n.functions){if(n.functions[this.name].length<=t.length){var s=n.functions[this.name].apply(n.functions,t);return s===null?(e.error({message:"incorrect arguments given to "+this.name+"()",index:this.index,type:"runtime",filename:this.filename}),{is:"undefined",value:"undefined"}):s}return e.error({message:"incorrect number of arguments for "+this.name+"(). "+n.functions[this.name].length+" expected.",index:this.index,type:"runtime",filename:this.filename}),{is:"undefined",value:"undefined"}}var o=n.Reference.mapnikFunctions[this.name];if(o===undefined){var u=r.pairs(n.Reference.mapnikFunctions),a=this.name,f=u.map(function(e){return[e[0],n.Reference.editDistance(a,e[0]),e[1]]}).sort(function(e,t){return e[1]-t[1]});return e.error({message:"unknown function "+this.name+"(), did you mean "+f[0][0]+"("+f[0][2]+")",index:this.index,type:"runtime",filename:this.filename}),{is:"undefined",value:"undefined"}}return o!==t.length&&(!Array.isArray(o)||!r.include(o,t.length))&&o!==-1?(e.error({message:"function "+this.name+"() takes "+o+" arguments and was given "+t.length,index:this.index,type:"runtime",filename:this.filename}),{is:"undefined",value:"undefined"}):(this.args=t,this)},toString:function(e,t){return this.args.length?this.name+"("+this.args.join(",")+")":this.name}}})(e("../tree"))}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"../tree":43,underscore:73}],45:[function(e,t,n){(function(e){e.Color=function(t,n){Array.isArray(t)?this.rgb=t.slice(0,3):t.length==6?this.rgb=t.match(/.{2}/g).map(function(e){return parseInt(e,16)}):this.rgb=t.split("").map(function(e){return parseInt(e+e,16)}),typeof n=="number"?this.alpha=n:t.length===4?this.alpha=t[3]:this.alpha=1},e.Color.prototype={is:"color",ev:function(){return this},toString:function(){return this.alpha<1?"rgba("+this.rgb.map(function(e){return Math.round(e)}).concat(this.alpha).join(", ")+")":"#"+this.rgb.map(function(e){return e=Math.round(e),e=(e>255?255:e<0?0:e).toString(16),e.length===1?"0"+e:e}).join("")},operate:function(t,n,r){var i=[];r instanceof e.Color||(r=r.toColor());for(var s=0;s<3;s++)i[s]=e.operate(n,this.rgb[s],r.rgb[s]);return new e.Color(i)},toHSL:function(){var e=this.rgb[0]/255,t=this.rgb[1]/255,n=this.rgb[2]/255,r=this.alpha,i=Math.max(e,t,n),s=Math.min(e,t,n),o,u,a=(i+s)/2,f=i-s;if(i===s)o=u=0;else{u=a>.5?f/(2-i-s):f/(i+s);switch(i){case e:o=(t-n)/f+(t<n?6:0);break;case t:o=(n-e)/f+2;break;case n:o=(e-t)/f+4}o/=6}return{h:o*360,s:u,l:a,a:r}}}})(e("../tree"))},{"../tree":43}],46:[function(e,t,n){(function(e){e.Comment=function(t,n){this.value=t,this.silent=!!n},e.Comment.prototype={toString:function(e){return"<!--"+this.value+"-->"},ev:function(){return this}}})(e("../tree"))},{"../tree":43}],47:[function(e,t,n){(function(t){(function(n){function s(e){function t(e){return e[1].toUpperCase()}return e.charAt(0).toUpperCase()+e.slice(1).replace(/\-./,t)+"Symbolizer"}function o(e){return e.sort(function(e,t){return e[1]-t[1]}).map(function(e){return e[0]})}var r=e("assert"),i=t._||e("underscore");n.Definition=function(t,i){this.elements=t.elements,r.ok(t.filters instanceof n.Filterset),this.rules=i,this.ruleIndex={};for(var s=0;s<this.rules.length;s++)"zoom"in this.rules[s]&&(this.rules[s]=this.rules[s].clone()),this.rules[s].zoom=t.zoom,this.ruleIndex[this.rules[s].updateID()]=!0;this.filters=t.filters,this.zoom=t.zoom,this.frame_offset=t.frame_offset,this.attachment=t.attachment||"__default__",this.specificity=t.specificity()},n.Definition.prototype.toString=function(){var e=this.filters.toString();for(var t=0;t<this.rules.length;t++)e+="\n "+this.rules[t];return e},n.Definition.prototype.clone=function(e){e&&r.ok(e instanceof n.Filterset);var t=Object.create(n.Definition.prototype);return t.rules=this.rules.slice(),t.ruleIndex=i.clone(this.ruleIndex),t.filters=e?e:this.filters.clone(),t.attachment=this.attachment,t},n.Definition.prototype.addRules=function(e){var t=0;for(var n=0;n<e.length;n++)this.ruleIndex[e[n].id]||(this.rules.push(e[n]),this.ruleIndex[e[n].id]=!0,t++);return t},n.Definition.prototype.appliesTo=function(e,t){for(var n=0,r=this.elements.length;n<r;n++){var i=this.elements[n];if(!(i.wildcard||i.type==="class"&&t[i.clean]||i.type==="id"&&e===i.clean))return!1}return!0},n.Definition.prototype.symbolizersToXML=function(e,t,r){var i=r.toXML(e).join("")+this.filters.toXML(e),u=[],a=[];for(var f in t){a=[];for(var l in t[f])a.push(t[f][l].index);var c=Math.min.apply(Math,a);u.push([f,c])}u=o(u);var h=0;for(var p=0;p<u.length;p++){var d=t[u[p]],v=u[p].split("/").pop();if(v==="*")continue;h++;var m=n.Reference.requiredProperties(v,d);if(m){var g=d[Object.keys(d).shift()];e.error({message:m,index:g.index,filename:g.filename})}var y=s(v),b=!0,w;i+=" <"+y+" ";for(var E in d){v==="map"&&e.error({message:"Map properties are not permitted in other rules",index:d[E].index,filename:d[E].filename});var S=n.Reference.selector(d[E].name);S&&S.serialization&&S.serialization==="content"?(b=!1,w=d[E].ev(e).toXML(e,!0)):S&&S.serialization&&S.serialization==="tag"?(b=!1,w=d[E].ev(e).toXML(e,!0)):i+=d[E].ev(e).toXML(e)+" "}b?i+="/>\n":typeof w!="undefined"&&(w.indexOf("<")!=-1?i+=">"+w+"</"+y+">\n":i+="><![CDATA["+w+"]]></"+y+">\n")}return!h||!i?"":" <Rule>\n"+i+" </Rule>\n"},n.Definition.prototype.collectSymbolizers=function(e,t){var n={},r;for(var i=t;i<this.rules.length;i++){r=this.rules[i];var s=r.instance+"/"+r.symbolizer;e.current&r.zoom&&(!(s in n)||!(r.name in n[s]))&&(e.current&=r.zoom,s in n||(n[s]={}),n[s][r.name]=r)}if(Object.keys(n).length)return e.rule&=e.available&=~e.current,n},n.Definition.prototype.toXML=function(e,t){var r=this.filters.toString();r in t||(t[r]=n.Zoom.all);var i=n.Zoom.all,s="",o,u,a={available:n.Zoom.all};for(var f=0;f<this.rules.length&&i;f++){a.rule=this.rules[f].zoom;if(!(t[r]&a.rule))continue;while(a.current=a.rule&i)if(u=this.collectSymbolizers(a,f)){if(!(t[r]&a.current))continue;s+=this.symbolizersToXML(e,u,(new n.Zoom).setZoom(t[r]&a.current)),t[r]&=~a.current}}return s},n.Definition.prototype.toJS=function(e){var t={},r="("+this.zoom+" & (1 << ctx.zoom))",s=this.frame_offset,o=this.filters.toJS(e),u=[r];return o&&u.push(o),s&&u.push('ctx["frame-offset"] === '+s),o=u.join(" && "),i.each(this.rules,function(r){if(!(r instanceof n.Rule))throw new Error("Ruleset not supported");t[r.name]=t[r.name]||[];var i={index:r.index,symbolizer:r.symbolizer};o?i.js="if("+o+"){"+r.value.toJS(e)+"}":i.js=r.value.toJS(e),i.constant=r.value.ev(e).is!=="field",i.filtered=!!o,t[r.name].push(i)}),t}})(e("../tree"))}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"../tree":43,assert:31,underscore:73}],48:[function(e,t,n){(function(t){(function(n){var r=t._||e("underscore");n.Dimension=function(t,n,r){this.value=parseFloat(t),this.unit=n||null,this.index=r},n.Dimension.prototype={is:"float",physical_units:["m","cm","in","mm","pt","pc"],screen_units:["px","%"],all_units:["m","cm","in","mm","pt","pc","px","%"],densities:{m:.0254,mm:25.4,cm:2.54,pt:72,pc:6},ev:function(e){if(this.unit&&!r.contains(this.all_units,this.unit))return e.error({message:"Invalid unit: '"+this.unit+"'",index:this.index}),{is:"undefined",value:"undefined"};if(this.unit&&r.contains(this.physical_units,this.unit)){if(!e.ppi)return e.error({message:"ppi is not set, so metric units can't be used",index:this.index}),{is:"undefined",value:"undefined"};this.value=this.value/this.densities[this.unit]*e.ppi,this.unit="px"}return this},round:function(){return this.value=Math.round(this.value),this},toColor:function(){return new n.Color([this.value,this.value,this.value])},round:function(){return this.value=Math.round(this.value),this},toString:function(){return this.value.toString()},operate:function(e,t,r){return this.unit==="%"&&r.unit!=="%"?(e.error({message:"If two operands differ, the first must not be %",index:this.index}),{is:"undefined",value:"undefined"}):this.unit!=="%"&&r.unit==="%"?t==="*"||t==="/"||t==="%"?(e.error({message:"Percent values can only be added or subtracted from other values",index:this.index}),{is:"undefined",value:"undefined"}):new n.Dimension(n.operate(t,this.value,this.value*r.value*.01),this.unit):new n.Dimension(n.operate(t,this.value,r.value),this.unit||r.unit)}}})(e("../tree"))}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"../tree":43,underscore:73}],49:[function(e,t,n){(function(e){e.Element=function(t){this.value=t.trim(),this.value[0]==="#"&&(this.type="id",this.clean=this.value.replace(/^#/,"")),this.value[0]==="."&&(this.type="class",this.clean=this.value.replace(/^\./,"")),this.value.indexOf("*")!==-1&&(this.type="wildcard")},e.Element.prototype.specificity=function(){return[this.type==="id"?1:0,this.type==="class"?1:0]},e.Element.prototype.toString=function(){return this.value}})(e("../tree"))},{"../tree":43}],50:[function(e,t,n){(function(e){e.Expression=function(t){this.value=t},e.Expression.prototype={is:"expression",ev:function(t){return this.value.length>1?new e.Expression(this.value.map(function(e){return e.ev(t)})):this.value[0].ev(t)},toString:function(e){return this.value.map(function(t){return t.toString(e)}).join(" ")}}})(e("../tree"))},{"../tree":43}],51:[function(e,t,n){(function(e){e.Field=function(t){this.value=t||""},e.Field.prototype={is:"field",toString:function(){return"["+this.value+"]"},ev:function(){return this}}})(e("../tree"))},{"../tree":43}],52:[function(e,t,n){(function(e){e.Filter=function(t,n,r,i,s){this.key=t,this.op=n,this.val=r,this.index=i,this.filename=s,this.id=this.key+this.op+this.val};var t={"<":[" &lt; ","numeric"],">":[" &gt; ","numeric"],"=":[" = ","both"],"!=":[" != ","both"],"<=":[" &lt;= ","numeric"],">=":[" &gt;= ","numeric"],"=~":[".match(","string",")"]};e.Filter.prototype.ev=function(e){return this.key=this.key.ev(e),this.val=this.val.ev(e),this},e.Filter.prototype.toXML=function(n){e.Reference.data.filter&&(this.key.is==="keyword"&&-1===e.Reference.data.filter.value.indexOf(this.key.toString())&&n.error({message:this.key.toString()+" is not a valid keyword in a filter expression",index:this.index,filename:this.filename}),this.val.is==="keyword"&&-1===e.Reference.data.filter.value.indexOf(this.val.toString())&&n.error({message:this.val.toString()+" is not a valid keyword in a filter expression",index:this.index,filename:this.filename}));var r=this.key.toString(!1),i=this.val.toString(this.val.is=="string");return(t[this.op][1]=="numeric"&&isNaN(i)&&this.val.is!=="field"||t[this.op][1]=="string"&&i[0]!="'")&&n.error({message:'Cannot use operator "'+this.op+'" with value '+this.val,index:this.index,filename:this.filename}),r+t[this.op][0]+i+(t[this.op][2]||"")},e.Filter.prototype.toString=function(){return"["+this.id+"]"}})(e("../tree"))},{"../tree":43}],53:[function(e,t,n){(function(t){var n=e("../tree"),r=t._||e("underscore");n.Filterset=function(){this.filters={}},n.Filterset.prototype.toXML=function(e){var t=[];for(var n in this.filters)t.push("("+this.filters[n].toXML(e).trim()+")");return t.length?" <Filter>"+t.join(" and ")+"</Filter>\n":""},n.Filterset.prototype.toString=function(){var e=[];for(var t in this.filters)e.push(this.filters[t].id);return e.sort().join(" ")},n.Filterset.prototype.ev=function(e){for(var t in this.filters)this.filters[t].ev(e);return this},n.Filterset.prototype.clone=function(){var e=new n.Filterset;for(var t in this.filters)e.filters[t]=this.filters[t];return e},n.Filterset.prototype.cloneWith=function(e){var t=[];for(var r in e.filters){var i=this.addable(e.filters[r]);if(i===!1)return!1;i===!0&&t.push(e.filters[r])}if(!t.length)return null;var s=new n.Filterset;for(r in this.filters)s.filters[r]=this.filters[r];while(r=t.shift())s.add(r);return s},n.Filterset.prototype.toJS=function(e){var t={"=":"==="};return r.map(this.filters,function(e){var n=e.op;n in t&&(n=t[n]);var r=e.val;e._val!==undefined&&(r=e._val.toString(!0));var i="data";return i+"."+e.key.value+" "+n+" "+(r.is==="string"?"'"+r+"'":r)}).join(" && ")},n.Filterset.prototype.addable=function(e){var t=e.key.toString(),n=e.val.toString();n.match(/^[0-9]+(\.[0-9]*)?$/)&&(n=parseFloat(n));switch(e.op){case"=":if(this.filters[t+"="]!==undefined)return this.filters[t+"="].val.toString()!=n?!1:null;if(this.filters[t+"!="+n]!==undefined)return!1;if(this.filters[t+">"]!==undefined&&this.filters[t+">"].val>=n)return!1;if(this.filters[t+"<"]!==undefined&&this.filters[t+"<"].val<=n)return!1;if(this.filters[t+">="]!==undefined&&this.filters[t+">="].val>n)return!1;if(this.filters[t+"<="]!==undefined&&this.filters[t+"<="].val<n)return!1;return!0;case"=~":return!0;case"!=":if(this.filters[t+"="]!==undefined)return this.filters[t+"="].val==n?!1:null;if(this.filters[t+"!="+n]!==undefined)return null;if(this.filters[t+">"]!==undefined&&this.filters[t+">"].val>=n)return null;if(this.filters[t+"<"]!==undefined&&this.filters[t+"<"].val<=n)return null;if(this.filters[t+">="]!==undefined&&this.filters[t+">="].val>n)return null;if(this.filters[t+"<="]!==undefined&&this.filters[t+"<="].val<n)return null;return!0;case">":if(t+"="in this.filters)return this.filters[t+"="].val<=n?!1:null;if(this.filters[t+"<"]!==undefined&&this.filters[t+"<"].val<=n)return!1;if(this.filters[t+"<="]!==undefined&&this.filters[t+"<="].val<=n)return!1;if(this.filters[t+">"]!==undefined&&this.filters[t+">"].val>=n)return null;if(this.filters[t+">="]!==undefined&&this.filters[t+">="].val>n)return null;return!0;case">=":if(this.filters[t+"="]!==undefined)return this.filters[t+"="].val<n?!1:null;if(this.filters[t+"<"]!==undefined&&this.filters[t+"<"].val<=n)return!1;if(this.filters[t+"<="]!==undefined&&this.filters[t+"<="].val<n)return!1;if(this.filters[t+">"]!==undefined&&this.filters[t+">"].val>=n)return null;if(this.filters[t+">="]!==undefined&&this.filters[t+">="].val>=n)return null;return!0;case"<":if(this.filters[t+"="]!==undefined)return this.filters[t+"="].val>=n?!1:null;if(this.filters[t+">"]!==undefined&&this.filters[t+">"].val>=n)return!1;if(this.filters[t+">="]!==undefined&&this.filters[t+">="].val>=n)return!1;if(this.filters[t+"<"]!==undefined&&this.filters[t+"<"].val<=n)return null;if(this.filters[t+"<="]!==undefined&&this.filters[t+"<="].val<n)return null;return!0;case"<=":if(this.filters[t+"="]!==undefined)return this.filters[t+"="].val>n?!1:null;if(this.filters[t+">"]!==undefined&&this.filters[t+">"].val>=n)return!1;if(this.filters[t+">="]!==undefined&&this.filters[t+">="].val>n)return!1;if(this.filters[t+"<"]!==undefined&&this.filters[t+"<"].val<=n)return null;if(this.filters[t+"<="]!==undefined&&this.filters[t+"<="].val<=n)return null;return!0}},n.Filterset.prototype.conflict=function(e){var t=e.key.toString(),n=e.val.toString();return isNaN(parseFloat(n))||(n=parseFloat(n)),e.op==="="&&this.filters[t+"="]!==undefined&&n!=this.filters[t+"="].val.toString()||e.op==="!="&&this.filters[t+"="]!==undefined&&n==this.filters[t+"="].val.toString()||e.op==="="&&this.filters[t+"!="]!==undefined&&n==this.filters[t+"!="].val.toString()?e.toString()+" added to "+this.toString()+" produces an invalid filter":!1},n.Filterset.prototype.add=function(e,t){var n=e.key.toString(),r,i=e.op,s=this.conflict(e),o;if(s)return s;if(i==="="){for(var u in this.filters)this.filters[u].key==n&&delete this.filters[u];this.filters[n+"="]=e}else if(i==="!=")this.filters[n+"!="+e.val]=e;else if(i==="=~")this.filters[n+"=~"+e.val]=e;else if(i===">"){for(var a in this.filters)this.filters[a].key==n&&this.filters[a].val<=e.val&&delete this.filters[a];this.filters[n+">"]=e}else if(i===">="){for(var f in this.filters)o=+this.filters[f].val.toString(),this.filters[f].key==n&&o<e.val&&delete this.filters[f];this.filters[n+"!="+e.val]!==undefined?(delete this.filters[n+"!="+e.val],e.op=">",this.filters[n+">"]=e):this.filters[n+">="]=e}else if(i==="<"){for(var l in this.filters)o=+this.filters[l].val.toString(),this.filters[l].key==n&&o>=e.val&&delete this.filters[l];this.filters[n+"<"]=e}else if(i==="<="){for(var c in this.filters)o=+this.filters[c].val.toString(),this.filters[c].key==n&&o>e.val&&delete this.filters[c];this.filters[n+"!="+e.val]!==undefined?(delete this.filters[n+"!="+e.val],e.op="<",this.filters[n+"<"]=e):this.filters[n+"<="]=e}}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"../tree":43,underscore:73}],54:[function(e,t,n){(function(e){e._getFontSet=function(t,n){var r=n.join("");if(t._fontMap&&t._fontMap[r])return t._fontMap[r];var i=new e.FontSet(t,n);return t.effects.push(i),t._fontMap||(t._fontMap={}),t._fontMap[r]=i,i},e.FontSet=function(t,n){this.fonts=n,this.name="fontset-"+t.effects.length},e.FontSet.prototype.toXML=function(e){return'<FontSet name="'+this.name+'">\n'+this.fonts.map(function(e){return' <Font face-name="'+e+'"/>'}).join("\n")+"\n</FontSet>"}})(e("../tree"))},{"../tree":43}],55:[function(e,t,n){var r=e("../tree");r.FrameOffset=function(e,t,n){t=parseInt(t,10);if(t>r.FrameOffset.max||t<=0)throw{message:"Only frame-offset levels between 1 and "+r.FrameOffset.max+" supported.",index:n};if(e!=="=")throw{message:"only = operator is supported for frame-offset",index:n};return t},r.FrameOffset.max=32,r.FrameOffset.none=0},{"../tree":43}],56:[function(e,t,n){(function(e){e.ImageFilter=function(t,n){this.filter=t,this.args=n||null},e.ImageFilter.prototype={is:"imagefilter",ev:function(){return this},toString:function(){return this.args?this.filter+"("+this.args.join(",")+")":this.filter}}})(e("../tree"))},{"../tree":43}],57:[function(e,t,n){(function(e){e.Invalid=function(t,n,r){this.chunk=t,this.index=n,this.type="syntax",this.message=r||"Invalid code: "+this.chunk},e.Invalid.prototype.is="invalid",e.Invalid.prototype.ev=function(e){return e.error({chunk:this.chunk,index:this.index,type:"syntax",message:this.message||"Invalid code: "+this.chunk}),{is:"undefined"}}})(e("../tree"))},{"../tree":43}],58:[function(e,t,n){(function(e){e.Keyword=function(t){this.value=t;var n={transparent:"color","true":"boolean","false":"boolean"};this.is=n[t]?n[t]:"keyword"},e.Keyword.prototype={ev:function(){return this},toString:function(){return this.value}}})(e("../tree"))},{"../tree":43}],59:[function(e,t,n){(function(e){e.LayerXML=function(t,n){var r=[];for(var i in t.Datasource)r.push('<Parameter name="'+i+'"><![CDATA['+t.Datasource[i]+"]]></Parameter>");var s="";for(var o in t.properties)o==="minzoom"?s+=' maxzoom="'+e.Zoom.ranges[t.properties[o]]+'"\n':o==="maxzoom"?s+=' minzoom="'+e.Zoom.ranges[t.properties[o]+1]+'"\n':s+=" "+o+'="'+t.properties[o]+'"\n';return'<Layer name="'+t.name+'"\n'+s+(typeof t.status=="undefined"?"":' status="'+t.status+'"\n')+(typeof t.srs=="undefined"?"":' srs="'+t.srs+'"')+">\n "+n.reverse().map(function(e){return"<StyleName>"+e+"</StyleName>"}).join("\n ")+(r.length?"\n <Datasource>\n "+r.join("\n ")+"\n </Datasource>\n":"")+" </Layer>\n"}})(e("../tree"))},{"../tree":43}],60:[function(e,t,n){(function(e){e.Literal=function(t){this.value=t||"",this.is="field"},e.Literal.prototype={toString:function(){return this.value},ev:function(){return this}}})(e("../tree"))},{"../tree":43}],61:[function(e,t,n){(function(e){e.Operation=function(t,n,r){this.op=t.trim(),this.operands=n,this.index=r},e.Operation.prototype.is="operation",e.Operation.prototype.ev=function(t){var n=this.operands[0].ev(t),r=this.operands[1].ev(t),i;return n.is==="undefined"||r.is==="undefined"?{is:"undefined",value:"undefined"}:(n instanceof e.Dimension&&r instanceof e.Color&&(this.op==="*"||this.op==="+"?(i=r,r=n,n=i):t.error({name:"OperationError",message:"Can't substract or divide a color from a number",index:this.index})),n instanceof e.Quoted&&r instanceof e.Quoted&&this.op!=="+"?(t.error({message:"Can't subtract, divide, or multiply strings.",index:this.index,type:"runtime",filename:this.filename}),{is:"undefined",value:"undefined"}):n instanceof e.Field||r instanceof e.Field||n instanceof e.Literal||r instanceof e.Literal?n.is==="color"||r.is==="color"?(t.error({message:"Can't subtract, divide, or multiply colors in expressions.",index:this.index,type:"runtime",filename:this.filename}),{is:"undefined",value:"undefined"}):new e.Literal(n.ev(t).toString(!0)+this.op+r.ev(t).toString(!0)):n.operate===undefined?(t.error({message:"Cannot do math with type "+n.is+".",index:this.index,type:"runtime",filename:this.filename}),{is:"undefined",value:"undefined"}):n.operate(t,this.op,r))},e.operate=function(e,t,n){switch(e){case"+":return t+n;case"-":return t-n;case"*":return t*n;case"%":return t%n;case"/":return t/n}}})(e("../tree"))},{"../tree":43}],62:[function(e,t,n){(function(e){e.Quoted=function(t){this.value=t||""},e.Quoted.prototype={is:"string",toString:function(e){var t=this.value.replace(/&/g,"&amp;"),n=t.replace(/\'/g,"\\'").replace(/\"/g,"&quot;").replace(/</g,"&lt;").replace(/\>/g,"&gt;");return e===!0?"'"+n+"'":t},ev:function(){return this},operate:function(t,n,r){return new e.Quoted(e.operate(n,this.toString(),r.toString(this.contains_field)))}}})(e("../tree"))},{"../tree":43}],63:[function(e,t,n){(function(t){(function(n){function s(e){var t={};for(var n in e.symbolizers)for(var r in e.symbolizers[n])e.symbolizers[n][r].hasOwnProperty("css")&&(t[e.symbolizers[n][r].css]=[e.symbolizers[n][r],n,r]);return t}function o(e){var t={};for(var n in e.symbolizers)for(var r in e.symbolizers[n])if(e.symbolizers[n][r].type==="functions")for(var i=0;i<e.symbolizers[n][r].functions.length;i++){var s=e.symbolizers[n][r].functions[i];t[s[0]]=s[1]}return t}function u(e){var t={};for(var n in e.symbolizers){t[n]=[];for(var r in e.symbolizers[n])e.symbolizers[n][r].required&&t[n].push(e.symbolizers[n][r].css)}return t}function a(e,t){if(e.value[0].is==="string")return!0;for(var n in e.value)for(var s in e.value[n].value){if(e.value[n].value[s].is!=="call")return!1;var o=r.find(i.selector(t).functions,function(t){return t[0]==e.value[n].value[s].name});if(!o||o[1]!=-1)if(!o||o[1]!==e.value[n].value[s].args.length)return!1}return!0}function f(e,t){return typeof i.selector(t).type=="object"?i.selector(t).type.indexOf(e.value[0].value)!==-1:i.selector(t).type==="string"}var r=t._||e("underscore"),i={};i.setData=function(e){i.data=e,i.selector_cache=s(e),i.mapnikFunctions=o(e),i.mapnikFunctions.matrix=[6],i.mapnikFunctions.translate=[1,2],i.mapnikFunctions.scale=[1,2],i.mapnikFunctions.rotate=[1,3],i.mapnikFunctions.skewX=[1],i.mapnikFunctions.skewY=[1],i.required_cache=u(e)},i.setVersion=function(t){var n=e("mapnik-reference");return n.version.hasOwnProperty(t)?(i.setData(n.version[t]),!0):!1},i.selectorData=function(e,t){if(i.selector_cache[e])return i.selector_cache[e][t]},i.validSelector=function(e){return!!i.selector_cache[e]},i.selectorName=function(e){return i.selectorData(e,2)},i.selector=function(e){return i.selectorData(e,0)},i.symbolizer=function(e){return i.selectorData(e,1)},i.requiredProperties=function(e,t){var n=i.required_cache[e];for(var r in n)if(!(n[r]in t))return"Property "+n[r]+" required for defining "+e+" styles."},i._validateValue={font:function(e,t){return e.validation_data&&e.validation_data.fonts?e.validation_data.fonts.indexOf(t)!=-1:!0}},i.isFont=function(e){return i.selector(e).validate=="font"},i.editDistance=function(e,t){if(e.length===0)return t.length;if(t.length===0)return e.length;var n=[];for(var r=0;r<=t.length;r++)n[r]=[r];for(var i=0;i<=e.length;i++)n[0][i]=i;for(r=1;r<=t.length;r++)for(i=1;i<=e.length;i++)t.charAt(r-1)==e.charAt(i-1)?n[r][i]=n[r-1][i-1]:n[r][i]=Math.min(n[r-1][i-1]+1,Math.min(n[r][i-1]+1,n[r-1][i]+1));return n[t.length][e.length]},i.validValue=function(e,t,n){var r,s;if(!i.selector(t))return!1;if(n.value[0].is=="keyword")return f(n,t);if(n.value[0].is=="undefined")return!0;if(i.selector(t).type=="numbers"){for(r in n.value)if(n.value[r].is!=="float")return!1;return!0}if(i.selector(t).type=="tags"){if(!n.value)return!1;if(!n.value[0].value)return n.value[0].is==="tag";for(r=0;r<n.value[0].value.length;r++)if(n.value[0].value[r].is!=="tag")return!1;return!0}if(i.selector(t).type=="functions")return a(n,t);if(i.selector(t).type==="unsigned")return n.value[0].is==="float"?(n.value[0].round(),!0):!1;if(i.selector(t).expression)return!0;if(i.selector(t).validate){var o=!1;for(r=0;r<n.value.length;r++)if(i.selector(t).type==n.value[r].is&&i._validateValue[i.selector(t).validate
](e,n.value[r].value))return!0;return o}return i.selector(t).type==n.value[0].is},n.Reference=i})(e("../tree"))}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"../tree":43,"mapnik-reference":72,underscore:73}],64:[function(e,t,n){(function(e){function t(t){return Object.keys(e.Reference.selector_cache).map(function(n){return[n,e.Reference.editDistance(t,n)]}).sort(function(e,t){return e[1]-t[1]})}e.Rule=function(n,r,i,s){var o=n.split("/");this.name=o.pop(),this.instance=o.length?o[0]:"__default__",this.value=r instanceof e.Value?r:new e.Value([r]),this.index=i,this.symbolizer=e.Reference.symbolizer(this.name),this.filename=s,this.variable=n.charAt(0)==="@"},e.Rule.prototype.is="rule",e.Rule.prototype.clone=function(){var t=Object.create(e.Rule.prototype);return t.name=this.name,t.value=this.value,t.index=this.index,t.instance=this.instance,t.symbolizer=this.symbolizer,t.filename=this.filename,t.variable=this.variable,t},e.Rule.prototype.updateID=function(){return this.id=this.zoom+"#"+this.instance+"#"+this.name},e.Rule.prototype.toString=function(){return"["+e.Zoom.toString(this.zoom)+"] "+this.name+": "+this.value},e.Rule.prototype.toXML=function(n,r,i,s){if(!e.Reference.validSelector(this.name)){var o=t(this.name),u="";return o[0][1]<3&&(u=". Did you mean "+o[0][0]+"?"),n.error({message:"Unrecognized rule: "+this.name+u,index:this.index,type:"syntax",filename:this.filename})}if(this.value instanceof e.Value&&!e.Reference.validValue(n,this.name,this.value)){if(!e.Reference.selector(this.name))return n.error({message:"Unrecognized property: "+this.name,index:this.index,type:"syntax",filename:this.filename});var a;return e.Reference.selector(this.name).validate?a=e.Reference.selector(this.name).validate:typeof e.Reference.selector(this.name).type=="object"?a="keyword (options: "+e.Reference.selector(this.name).type.join(", ")+")":a=e.Reference.selector(this.name).type,n.error({message:"Invalid value for "+this.name+", the type "+a+" is expected. "+this.value+" (of type "+this.value.value[0].is+") "+" was given.",index:this.index,type:"syntax",filename:this.filename})}if(this.variable)return"";if(e.Reference.isFont(this.name)&&this.value.value.length>1){var f=e._getFontSet(n,this.value.value);return'fontset-name="'+f.name+'"'}return r?this.value.toString(n,this.name,i):e.Reference.selectorName(this.name)+'="'+this.value.toString(n,this.name)+'"'},e.Rule.prototype.ev=function(t){return new e.Rule(this.name,this.value.ev(t),this.index,this.filename)}})(e("../tree"))},{"../tree":43}],65:[function(e,t,n){(function(e){e.Ruleset=function(t,n){this.selectors=t,this.rules=n,this._lookups={}},e.Ruleset.prototype={is:"ruleset",ev:function(t){var n,r=new e.Ruleset(this.selectors,this.rules.slice(0));r.root=this.root,t.frames.unshift(r);for(n=0,rule;n<r.rules.length;n++)rule=r.rules[n],r.rules[n]=rule.ev?rule.ev(t):rule;return t.frames.shift(),r},match:function(e){return!e||e.length===0},variables:function(){return this._variables?this._variables:this._variables=this.rules.reduce(function(t,n){return n instanceof e.Rule&&n.variable===!0&&(t[n.name]=n),t},{})},variable:function(e){return this.variables()[e]},rulesets:function(){return this._rulesets?this._rulesets:this._rulesets=this.rules.filter(function(t){return t instanceof e.Ruleset})},find:function(t,n){n=n||this;var r=[],i,s,o=t.toString();return o in this._lookups?this._lookups[o]:(this.rulesets().forEach(function(i){if(i!==n)for(var o=0;o<i.selectors.length;o++){s=t.match(i.selectors[o]);if(s){t.elements.length>1?Array.prototype.push.apply(r,i.find(new e.Selector(null,null,null,t.elements.slice(1)),n)):r.push(i);break}}}),this._lookups[o]=r)},evZooms:function(t){for(var n=0;n<this.selectors.length;n++){var r=e.Zoom.all;for(var i=0;i<this.selectors[n].zoom.length;i++)r&=this.selectors[n].zoom[i].ev(t).zoom;this.selectors[n].zoom=r}},flatten:function(t,n,r){var i=[],s,o;this.selectors.length===0&&(r.frames=r.frames.concat(this.rules)),this.evZooms(r);for(s=0;s<this.selectors.length;s++){var u=this.selectors[s];if(!u.filters)continue;if(n.length)for(o=0;o<n.length;o++){var a=n[o],f=a.filters.cloneWith(u.filters);if(f===null){if(a.zoom===(a.zoom&u.zoom)&&a.frame_offset===u.frame_offset&&a.attachment===u.attachment&&a.elements.join()===u.elements.join()){i.push(a);continue}f=a.filters}else if(!f)continue;var l=Object.create(e.Selector.prototype);l.filters=f,l.zoom=a.zoom&u.zoom,l.frame_offset=u.frame_offset,l.elements=a.elements.concat(u.elements),a.attachment&&u.attachment?l.attachment=a.attachment+"/"+u.attachment:l.attachment=u.attachment||a.attachment,l.conditions=a.conditions+u.conditions,l.index=u.index,i.push(l)}else i.push(u)}var c=[];for(s=0;s<this.rules.length;s++){var h=this.rules[s];h instanceof e.Ruleset?h.flatten(t,i,r):h instanceof e.Rule?c.push(h):h instanceof e.Invalid&&r.error(h)}var p=c.length?c[0].index:!1;for(s=0;s<i.length;s++)p!==!1&&(i[s].index=p),t.push(new e.Definition(i[s],c.slice()));return t}}})(e("../tree"))},{"../tree":43}],66:[function(e,t,n){(function(e){e.Selector=function(n,r,i,s,o,u,a){this.elements=s||[],this.attachment=o,this.filters=n||{},this.frame_offset=i,this.zoom=typeof r!="undefined"?r:e.Zoom.all,this.conditions=u,this.index=a},e.Selector.prototype.specificity=function(){return this.elements.reduce(function(e,t){var n=t.specificity();return e[0]+=n[0],e[1]+=n[1],e},[0,0,this.conditions,this.index])}})(e("../tree"))},{"../tree":43}],67:[function(e,t,n){(function(t){(function(n){var r=t._||e("underscore");n.StyleXML=function(e,t,n,i){var s={},o=[],u=[],a=[],f=[],l=[];for(var c=0;c<n.length;c++)for(var h=0;h<n[c].rules.length;h++)n[c].rules[h].name==="image-filters"&&o.push(n[c].rules[h]),n[c].rules[h].name==="image-filters-inflate"&&u.push(n[c].rules[h]),n[c].rules[h].name==="direct-image-filters"&&a.push(n[c].rules[h]),n[c].rules[h].name==="comp-op"&&f.push(n[c].rules[h]),n[c].rules[h].name==="opacity"&&l.push(n[c].rules[h]);var p=n.map(function(e){return e.toXML(i,s)}),d="";o.length&&(d+=' image-filters="'+r.chain(o).uniq(function(e){return e.id}).map(function(e){return e.ev(i).toXML(i,!0,",","image-filter")}).value().join(",")+'"'),u.length&&(d+=' image-filters-inflate="'+u[0].value.ev(i).toString()+'"'),a.length&&(d+=' direct-image-filters="'+r.chain(a).uniq(function(e){return e.id}).map(function(e){return e.ev(i).toXML(i,!0,",","direct-image-filter")}).value().join(",")+'"'),f.length&&f[0].value.ev(i).value!="src-over"&&(d+=' comp-op="'+f[0].value.ev(i).toString()+'"'),l.length&&l[0].value.ev(i).value!=1&&(d+=' opacity="'+l[0].value.ev(i).toString()+'"');var v=p.join("");return!d&&!v?"":'<Style name="'+e+'" filter-mode="first"'+d+">\n"+v+"</Style>"}})(e("../tree"))}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{"../tree":43,underscore:73}],68:[function(e,t,n){(function(e){e.URL=function(t,n){this.value=t,this.paths=n},e.URL.prototype={is:"uri",toString:function(){return this.value.toString()},ev:function(t){return new e.URL(this.value.ev(t),this.paths)}}})(e("../tree"))},{"../tree":43}],69:[function(e,t,n){(function(e){e.Value=function(t){this.value=t},e.Value.prototype={is:"value",ev:function(t){return this.value.length===1?this.value[0].ev(t):new e.Value(this.value.map(function(e){return e.ev(t)}))},toString:function(e,t,n,r){return this.value.map(function(t){return t.toString(e,r)}).join(n||", ")},clone:function(){var t=Object.create(e.Value.prototype);return Array.isArray(t)?t.value=this.value.slice():t.value=this.value,t.is=this.is,t},toJS:function(e){var t=this.ev(e),n=t.toString();return t.is==="color"||t.is==="uri"||t.is==="string"||t.is==="keyword"?n="'"+n+"'":t.is==="field"?n=n.replace(/\[(.*)\]/g,"data['$1']"):t.is==="call"&&(n=JSON.stringify({name:t.name,args:t.args})),"_value = "+n+";"}}})(e("../tree"))},{"../tree":43}],70:[function(e,t,n){(function(e){e.Variable=function(t,n,r){this.name=t,this.index=n,this.filename=r},e.Variable.prototype={is:"variable",toString:function(){return this.name},ev:function(e){var t,n,r=this.name;if(this._css)return this._css;var i=e.frames.filter(function(e){return e.name==this.name}.bind(this));return i.length?i[0].value.ev(e):(e.error({message:"variable "+this.name+" is undefined",index:this.index,type:"runtime",filename:this.filename}),{is:"undefined",value:"undefined"})}}})(e("../tree"))},{"../tree":43}],71:[function(e,t,n){var r=e("../tree");r.Zoom=function(e,t,n){this.op=e,this.value=t,this.index=n},r.Zoom.prototype.setZoom=function(e){return this.zoom=e,this},r.Zoom.prototype.ev=function(e){var t=0,n=Infinity,i=parseInt(this.value.ev(e).toString(),10),s=0;(i>r.Zoom.maxZoom||i<0)&&e.error({message:"Only zoom levels between 0 and "+r.Zoom.maxZoom+" supported.",index:this.index});switch(this.op){case"=":return this.zoom=1<<i,this;case">":t=i+1;break;case">=":t=i;break;case"<":n=i-1;break;case"<=":n=i}for(var o=0;o<=r.Zoom.maxZoom;o++)o>=t&&o<=n&&(s|=1<<o);return this.zoom=s,this},r.Zoom.prototype.toString=function(){return this.zoom},r.Zoom.all=8388607,r.Zoom.maxZoom=22,r.Zoom.ranges={0:1e9,1:5e8,2:2e8,3:1e8,4:5e7,5:25e6,6:125e5,7:65e5,8:3e6,9:15e5,10:75e4,11:4e5,12:2e5,13:1e5,14:5e4,15:25e3,16:12500,17:5e3,18:2500,19:1500,20:750,21:500,22:250,23:100},r.Zoom.prototype.toXML=function(){var e=[];if(this.zoom!=r.Zoom.all){var t=null,n=null;for(var i=0;i<=r.Zoom.maxZoom;i++)this.zoom&1<<i&&(t===null&&(t=i),n=i);t>0&&e.push(" <MaxScaleDenominator>"+r.Zoom.ranges[t]+"</MaxScaleDenominator>\n"),n<22&&e.push(" <MinScaleDenominator>"+r.Zoom.ranges[n+1]+"</MinScaleDenominator>\n")}return e},r.Zoom.prototype.toString=function(){var e="";for(var t=0;t<=r.Zoom.maxZoom;t++)e+=this.zoom&1<<t?"X":".";return e}},{"../tree":43}],72:[function(e,t,n){(function(n){var r=e("fs"),i=e("path"),s=e("fs").existsSync||e("path").existsSync;t.exports.version={};var o=["2.0.0","2.0.1","2.0.2","2.1.0","2.1.1","2.2.0","2.3.0","3.0.0"];o.map(function(r){t.exports.version[r]=e(i.join(n,r,"reference.json"));var o=i.join(n,r,"datasources.json");s(o)&&(t.exports.version[r].datasources=e(o).datasources)})}).call(this,"/node_modules/carto/node_modules/mapnik-reference")},{fs:30,path:33}],73:[function(e,t,n){(function(){var e=this,r=e._,i={},s=Array.prototype,o=Object.prototype,u=Function.prototype,a=s.push,f=s.slice,l=s.concat,c=o.toString,h=o.hasOwnProperty,p=s.forEach,d=s.map,v=s.reduce,m=s.reduceRight,g=s.filter,y=s.every,b=s.some,w=s.indexOf,E=s.lastIndexOf,S=Array.isArray,x=Object.keys,T=u.bind,N=function(e){if(e instanceof N)return e;if(!(this instanceof N))return new N(e);this._wrapped=e};typeof n!="undefined"?(typeof t!="undefined"&&t.exports&&(n=t.exports=N),n._=N):e._=N,N.VERSION="1.6.0";var C=N.each=N.forEach=function(e,t,n){if(e==null)return e;if(p&&e.forEach===p)e.forEach(t,n);else if(e.length===+e.length){for(var r=0,s=e.length;r<s;r++)if(t.call(n,e[r],r,e)===i)return}else{var o=N.keys(e);for(var r=0,s=o.length;r<s;r++)if(t.call(n,e[o[r]],o[r],e)===i)return}return e};N.map=N.collect=function(e,t,n){var r=[];return e==null?r:d&&e.map===d?e.map(t,n):(C(e,function(e,i,s){r.push(t.call(n,e,i,s))}),r)};var k="Reduce of empty array with no initial value";N.reduce=N.foldl=N.inject=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(v&&e.reduce===v)return r&&(t=N.bind(t,r)),i?e.reduce(t,n):e.reduce(t);C(e,function(e,s,o){i?n=t.call(r,n,e,s,o):(n=e,i=!0)});if(!i)throw new TypeError(k);return n},N.reduceRight=N.foldr=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(m&&e.reduceRight===m)return r&&(t=N.bind(t,r)),i?e.reduceRight(t,n):e.reduceRight(t);var s=e.length;if(s!==+s){var o=N.keys(e);s=o.length}C(e,function(u,a,f){a=o?o[--s]:--s,i?n=t.call(r,n,e[a],a,f):(n=e[a],i=!0)});if(!i)throw new TypeError(k);return n},N.find=N.detect=function(e,t,n){var r;return L(e,function(e,i,s){if(t.call(n,e,i,s))return r=e,!0}),r},N.filter=N.select=function(e,t,n){var r=[];return e==null?r:g&&e.filter===g?e.filter(t,n):(C(e,function(e,i,s){t.call(n,e,i,s)&&r.push(e)}),r)},N.reject=function(e,t,n){return N.filter(e,function(e,r,i){return!t.call(n,e,r,i)},n)},N.every=N.all=function(e,t,n){t||(t=N.identity);var r=!0;return e==null?r:y&&e.every===y?e.every(t,n):(C(e,function(e,s,o){if(!(r=r&&t.call(n,e,s,o)))return i}),!!r)};var L=N.some=N.any=function(e,t,n){t||(t=N.identity);var r=!1;return e==null?r:b&&e.some===b?e.some(t,n):(C(e,function(e,s,o){if(r||(r=t.call(n,e,s,o)))return i}),!!r)};N.contains=N.include=function(e,t){return e==null?!1:w&&e.indexOf===w?e.indexOf(t)!=-1:L(e,function(e){return e===t})},N.invoke=function(e,t){var n=f.call(arguments,2),r=N.isFunction(t);return N.map(e,function(e){return(r?t:e[t]).apply(e,n)})},N.pluck=function(e,t){return N.map(e,N.property(t))},N.where=function(e,t){return N.filter(e,N.matches(t))},N.findWhere=function(e,t){return N.find(e,N.matches(t))},N.max=function(e,t,n){if(!t&&N.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.max.apply(Math,e);var r=-Infinity,i=-Infinity;return C(e,function(e,s,o){var u=t?t.call(n,e,s,o):e;u>i&&(r=e,i=u)}),r},N.min=function(e,t,n){if(!t&&N.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.min.apply(Math,e);var r=Infinity,i=Infinity;return C(e,function(e,s,o){var u=t?t.call(n,e,s,o):e;u<i&&(r=e,i=u)}),r},N.shuffle=function(e){var t,n=0,r=[];return C(e,function(e){t=N.random(n++),r[n-1]=r[t],r[t]=e}),r},N.sample=function(e,t,n){return t==null||n?(e.length!==+e.length&&(e=N.values(e)),e[N.random(e.length-1)]):N.shuffle(e).slice(0,Math.max(0,t))};var A=function(e){return e==null?N.identity:N.isFunction(e)?e:N.property(e)};N.sortBy=function(e,t,n){return t=A(t),N.pluck(N.map(e,function(e,r,i){return{value:e,index:r,criteria:t.call(n,e,r,i)}}).sort(function(e,t){var n=e.criteria,r=t.criteria;if(n!==r){if(n>r||n===void 0)return 1;if(n<r||r===void 0)return-1}return e.index-t.index}),"value")};var O=function(e){return function(t,n,r){var i={};return n=A(n),C(t,function(s,o){var u=n.call(r,s,o,t);e(i,u,s)}),i}};N.groupBy=O(function(e,t,n){N.has(e,t)?e[t].push(n):e[t]=[n]}),N.indexBy=O(function(e,t,n){e[t]=n}),N.countBy=O(function(e,t){N.has(e,t)?e[t]++:e[t]=1}),N.sortedIndex=function(e,t,n,r){n=A(n);var i=n.call(r,t),s=0,o=e.length;while(s<o){var u=s+o>>>1;n.call(r,e[u])<i?s=u+1:o=u}return s},N.toArray=function(e){return e?N.isArray(e)?f.call(e):e.length===+e.length?N.map(e,N.identity):N.values(e):[]},N.size=function(e){return e==null?0:e.length===+e.length?e.length:N.keys(e).length},N.first=N.head=N.take=function(e,t,n){return e==null?void 0:t==null||n?e[0]:t<0?[]:f.call(e,0,t)},N.initial=function(e,t,n){return f.call(e,0,e.length-(t==null||n?1:t))},N.last=function(e,t,n){return e==null?void 0:t==null||n?e[e.length-1]:f.call(e,Math.max(e.length-t,0))},N.rest=N.tail=N.drop=function(e,t,n){return f.call(e,t==null||n?1:t)},N.compact=function(e){return N.filter(e,N.identity)};var M=function(e,t,n){return t&&N.every(e,N.isArray)?l.apply(n,e):(C(e,function(e){N.isArray(e)||N.isArguments(e)?t?a.apply(n,e):M(e,t,n):n.push(e)}),n)};N.flatten=function(e,t){return M(e,t,[])},N.without=function(e){return N.difference(e,f.call(arguments,1))},N.partition=function(e,t){var n=[],r=[];return C(e,function(e){(t(e)?n:r).push(e)}),[n,r]},N.uniq=N.unique=function(e,t,n,r){N.isFunction(t)&&(r=n,n=t,t=!1);var i=n?N.map(e,n,r):e,s=[],o=[];return C(i,function(n,r){if(t?!r||o[o.length-1]!==n:!N.contains(o,n))o.push(n),s.push(e[r])}),s},N.union=function(){return N.uniq(N.flatten(arguments,!0))},N.intersection=function(e){var t=f.call(arguments,1);return N.filter(N.uniq(e),function(e){return N.every(t,function(t){return N.contains(t,e)})})},N.difference=function(e){var t=l.apply(s,f.call(arguments,1));return N.filter(e,function(e){return!N.contains(t,e)})},N.zip=function(){var e=N.max(N.pluck(arguments,"length").concat(0)),t=new Array(e);for(var n=0;n<e;n++)t[n]=N.pluck(arguments,""+n);return t},N.object=function(e,t){if(e==null)return{};var n={};for(var r=0,i=e.length;r<i;r++)t?n[e[r]]=t[r]:n[e[r][0]]=e[r][1];return n},N.indexOf=function(e,t,n){if(e==null)return-1;var r=0,i=e.length;if(n){if(typeof n!="number")return r=N.sortedIndex(e,t),e[r]===t?r:-1;r=n<0?Math.max(0,i+n):n}if(w&&e.indexOf===w)return e.indexOf(t,n);for(;r<i;r++)if(e[r]===t)return r;return-1},N.lastIndexOf=function(e,t,n){if(e==null)return-1;var r=n!=null;if(E&&e.lastIndexOf===E)return r?e.lastIndexOf(t,n):e.lastIndexOf(t);var i=r?n:e.length;while(i--)if(e[i]===t)return i;return-1},N.range=function(e,t,n){arguments.length<=1&&(t=e||0,e=0),n=arguments[2]||1;var r=Math.max(Math.ceil((t-e)/n),0),i=0,s=new Array(r);while(i<r)s[i++]=e,e+=n;return s};var _=function(){};N.bind=function(e,t){var n,r;if(T&&e.bind===T)return T.apply(e,f.call(arguments,1));if(!N.isFunction(e))throw new TypeError;return n=f.call(arguments,2),r=function(){if(this instanceof r){_.prototype=e.prototype;var i=new _;_.prototype=null;var s=e.apply(i,n.concat(f.call(arguments)));return Object(s)===s?s:i}return e.apply(t,n.concat(f.call(arguments)))}},N.partial=function(e){var t=f.call(arguments,1);return function(){var n=0,r=t.slice();for(var i=0,s=r.length;i<s;i++)r[i]===N&&(r[i]=arguments[n++]);while(n<arguments.length)r.push(arguments[n++]);return e.apply(this,r)}},N.bindAll=function(e){var t=f.call(arguments,1);if(t.length===0)throw new Error("bindAll must be passed function names");return C(t,function(t){e[t]=N.bind(e[t],e)}),e},N.memoize=function(e,t){var n={};return t||(t=N.identity),function(){var r=t.apply(this,arguments);return N.has(n,r)?n[r]:n[r]=e.apply(this,arguments)}},N.delay=function(e,t){var n=f.call(arguments,2);return setTimeout(function(){return e.apply(null,n)},t)},N.defer=function(e){return N.delay.apply(N,[e,1].concat(f.call(arguments,1)))},N.throttle=function(e,t,n){var r,i,s,o=null,u=0;n||(n={});var a=function(){u=n.leading===!1?0:N.now(),o=null,s=e.apply(r,i),r=i=null};return function(){var f=N.now();!u&&n.leading===!1&&(u=f);var l=t-(f-u);return r=this,i=arguments,l<=0?(clearTimeout(o),o=null,u=f,s=e.apply(r,i),r=i=null):!o&&n.trailing!==!1&&(o=setTimeout(a,l)),s}},N.debounce=function(e,t,n){var r,i,s,o,u,a=function(){var f=N.now()-o;f<t?r=setTimeout(a,t-f):(r=null,n||(u=e.apply(s,i),s=i=null))};return function(){s=this,i=arguments,o=N.now();var f=n&&!r;return r||(r=setTimeout(a,t)),f&&(u=e.apply(s,i),s=i=null),u}},N.once=function(e){var t=!1,n;return function(){return t?n:(t=!0,n=e.apply(this,arguments),e=null,n)}},N.wrap=function(e,t){return N.partial(t,e)},N.compose=function(){var e=arguments;return function(){var t=arguments;for(var n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},N.after=function(e,t){return function(){if(--e<1)return t.apply(this,arguments)}},N.keys=function(e){if(!N.isObject(e))return[];if(x)return x(e);var t=[];for(var n in e)N.has(e,n)&&t.push(n);return t},N.values=function(e){var t=N.keys(e),n=t.length,r=new Array(n);for(var i=0;i<n;i++)r[i]=e[t[i]];return r},N.pairs=function(e){var t=N.keys(e),n=t.length,r=new Array(n);for(var i=0;i<n;i++)r[i]=[t[i],e[t[i]]];return r},N.invert=function(e){var t={},n=N.keys(e);for(var r=0,i=n.length;r<i;r++)t[e[n[r]]]=n[r];return t},N.functions=N.methods=function(e){var t=[];for(var n in e)N.isFunction(e[n])&&t.push(n);return t.sort()},N.extend=function(e){return C(f.call(arguments,1),function(t){if(t)for(var n in t)e[n]=t[n]}),e},N.pick=function(e){var t={},n=l.apply(s,f.call(arguments,1));return C(n,function(n){n in e&&(t[n]=e[n])}),t},N.omit=function(e){var t={},n=l.apply(s,f.call(arguments,1));for(var r in e)N.contains(n,r)||(t[r]=e[r]);return t},N.defaults=function(e){return C(f.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e},N.clone=function(e){return N.isObject(e)?N.isArray(e)?e.slice():N.extend({},e):e},N.tap=function(e,t){return t(e),e};var D=function(e,t,n,r){if(e===t)return e!==0||1/e==1/t;if(e==null||t==null)return e===t;e instanceof N&&(e=e._wrapped),t instanceof N&&(t=t._wrapped);var i=c.call(e);if(i!=c.call(t))return!1;switch(i){case"[object String]":return e==String(t);case"[object Number]":return e!=+e?t!=+t:e==0?1/e==1/t:e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object RegExp]":return e.source==t.source&&e.global==t.global&&e.multiline==t.multiline&&e.ignoreCase==t.ignoreCase}if(typeof e!="object"||typeof t!="object")return!1;var s=n.length;while(s--)if(n[s]==e)return r[s]==t;var o=e.constructor,u=t.constructor;if(o!==u&&!(N.isFunction(o)&&o instanceof o&&N.isFunction(u)&&u instanceof u)&&"constructor"in e&&"constructor"in t)return!1;n.push(e),r.push(t);var a=0,f=!0;if(i=="[object Array]"){a=e.length,f=a==t.length;if(f)while(a--)if(!(f=D(e[a],t[a],n,r)))break}else{for(var l in e)if(N.has(e,l)){a++;if(!(f=N.has(t,l)&&D(e[l],t[l],n,r)))break}if(f){for(l in t)if(N.has(t,l)&&!(a--))break;f=!a}}return n.pop(),r.pop(),f};N.isEqual=function(e,t){return D(e,t,[],[])},N.isEmpty=function(e){if(e==null)return!0;if(N.isArray(e)||N.isString(e))return e.length===0;for(var t in e)if(N.has(e,t))return!1;return!0},N.isElement=function(e){return!!e&&e.nodeType===1},N.isArray=S||function(e){return c.call(e)=="[object Array]"},N.isObject=function(e){return e===Object(e)},C(["Arguments","Function","String","Number","Date","RegExp"],function(e){N["is"+e]=function(t){return c.call(t)=="[object "+e+"]"}}),N.isArguments(arguments)||(N.isArguments=function(e){return!!e&&!!N.has(e,"callee")}),typeof /./!="function"&&(N.isFunction=function(e){return typeof e=="function"}),N.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},N.isNaN=function(e){return N.isNumber(e)&&e!=+e},N.isBoolean=function(e){return e===!0||e===!1||c.call(e)=="[object Boolean]"},N.isNull=function(e){return e===null},N.isUndefined=function(e){return e===void 0},N.has=function(e,t){return h.call(e,t)},N.noConflict=function(){return e._=r,this},N.identity=function(e){return e},N.constant=function(e){return function(){return e}},N.property=function(e){return function(t){return t[e]}},N.matches=function(e){return function(t){if(t===e)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0}},N.times=function(e,t,n){var r=Array(Math.max(0,e));for(var i=0;i<e;i++)r[i]=t.call(n,i);return r},N.random=function(e,t){return t==null&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))},N.now=Date.now||function(){return(new Date).getTime()};var P={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"}};P.unescape=N.invert(P.escape);var H={escape:new RegExp("["+N.keys(P.escape).join("")+"]","g"),unescape:new RegExp("("+N.keys(P.unescape).join("|")+")","g")};N.each(["escape","unescape"],function(e){N[e]=function(t){return t==null?"":(""+t).replace(H[e],function(t){return P[e][t]})}}),N.result=function(e,t){if(e==null)return void 0;var n=e[t];return N.isFunction(n)?n.call(e):n},N.mixin=function(e){C(N.functions(e),function(t){var n=N[t]=e[t];N.prototype[t]=function(){var e=[this._wrapped];return a.apply(e,arguments),q.call(this,n.apply(N,e))}})};var B=0;N.uniqueId=function(e){var t=++B+"";return e?e+t:t},N.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var j=/(.)^/,F={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},I=/\\|'|\r|\n|\t|\u2028|\u2029/g;N.template=function(e,t,n){var r;n=N.defaults({},n,N.templateSettings);var i=new RegExp([(n.escape||j).source,(n.interpolate||j).source,(n.evaluate||j).source].join("|")+"|$","g"),s=0,o="__p+='";e.replace(i,function(t,n,r,i,u){return o+=e.slice(s,u).replace(I,function(e){return"\\"+F[e]}),n&&(o+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'"),r&&(o+="'+\n((__t=("+r+"))==null?'':__t)+\n'"),i&&(o+="';\n"+i+"\n__p+='"),s=u+t.length,t}),o+="';\n",n.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{r=new Function(n.variable||"obj","_",o)}catch(u){throw u.source=o,u}if(t)return r(t,N);var a=function(e){return r.call(this,e,N)};return a.source="function("+(n.variable||"obj")+"){\n"+o+"}",a},N.chain=function(e){return N(e).chain()};var q=function(e){return this._chain?N(e).chain():e};N.mixin(N),C(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=s[e];N.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),(e=="shift"||e=="splice")&&n.length===0&&delete n[0],q.call(this,n)}}),C(["concat","join","slice"],function(e){var t=s[e];N.prototype[e]=function(){return q.call(this,t.apply(this._wrapped,arguments))}}),N.extend(N.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}}),typeof define=="function"&&define.amd&&define("underscore",[],function(){return N})}).call(this)},{}],74:[function(e,t,n){t.exports={name:"carto",version:"0.15.1-cdb1",description:"CartoCSS Stylesheet Compiler",url:"https://github.com/cartodb/carto",repository:{type:"git",url:"http://github.com/cartodb/carto.git"},author:{name:"CartoDB",url:"http://cartodb.com/"},keywords:["maps","css","stylesheets"],contributors:[{name:"Tom MacWright",email:"macwright@gmail.com"},{name:"Konstantin Käfer"},{name:"Alexis Sellier",email:"self@cloudhead.net"},{name:"Raul Ochoa",email:"rochoa@cartodb.com"},{name:"Javi Santana",email:"jsantana@cartodb.com"}],licenses:[{type:"Apache"}],bin:{carto:"./bin/carto"},man:["./man/carto.1"],main:"./lib/carto/index",engines:{node:">=0.4.x"},dependencies:{underscore:"~1.6.0","mapnik-reference":"~6.0.2",optimist:"~0.6.0"},devDependencies:{mocha:"1.12.x",jshint:"0.2.x",sax:"0.1.x",istanbul:"~0.2.14",coveralls:"~2.10.1",browserify:"~7.0.0","uglify-js":"1.3.3"},scripts:{pretest:"npm install",test:"mocha -R spec",coverage:"istanbul cover ./node_modules/.bin/_mocha && coveralls < ./coverage/lcov.info"},readme:"# CartoCSS\n\n[![Build Status](https://secure.travis-ci.org/mapbox/carto.png)](http://travis-ci.org/mapbox/carto)\n\nIs as stylesheet renderer for javascript, It's an evolution of the Mapnik renderer from Mapbox.\nPlease, see original [Mapbox repo](http://github.com/mapbox/carto) for more information and credits\n\n## Quick Start\n\n```javascript\n// shader is a CartoCSS object\n\nvar cartocss = [\n '#layer {',\n ' marker-width: [property]',\n ' marker-fill: red',\n '}'\n].join('')\nvar shader = new carto.RendererJS().render(cartocss);\nvar layers = shader.getLayers()\nfor (var i = 0; i < layers.length; ++i) {\n var layer = layers[i];\n console.log(\"layer name: \", layer.fullName())\n console.log(\"- frames: \", layer.frames())\n console.log(\"- attachment: \", layer.attachment())\n\n var layerShader = layer.getStyle({ property: 1 }, { zoom: 10 })\n console.log(layerShader['marker-width']) // 1\n console.log(layerShader['marker-fill']) // #FF0000\n}\n\n```\n\n# API\n\n## RendererJS\n\n### render(cartocss)\n\n## CartoCSS\n\ncompiled cartocss object\n\n### getLayers\n\nreturn the layers, an array of ``CartoCSS.Layer`` object\n\n### getDefault\n\nreturn the default layer (``CartoCSS.Layer``), usually the Map layer\n\n\n### findLayer(where)\n\nfind a layer using where object.\n\n```\nshader.findLayer({ name: 'test' })\n```\n\n## CartoCSS.Layer\n\n### getStyle(props, context)\n\nreturn the evaluated style:\n - props: object containing properties needed to render the style. If the cartocss style uses\n some variables they should be passed in this object\n - context: rendering context variables like ``zoom`` or animation ``frame``\n\n\n\n\n\n\n\n\n\n\n## Reference Documentation\n\n* [mapbox.com/carto](http://mapbox.com/carto/)\n\n\n",readmeFilename:"README.md",bugs:{url:"https://github.com/cartodb/carto/issues"},homepage:"https://github.com/cartodb/carto",_id:"carto@0.15.1-cdb1",_shasum:"62534c2975cbee073f10c6c14a0c7e889c9469e7",_from:"https://github.com/CartoDB/carto/archive/master.tar.gz",_resolved:"https://github.com/CartoDB/carto/archive/master.tar.gz"}},{}]},{},[11])(11)});