!function(e){if("object"==typeofexports&&"undefined"!=typeofmodule)module.exports=e();elseif("function"==typeofdefine&&define.amd)define([],e);else{vart;"undefined"!=typeofwindow?t=window:"undefined"!=typeofglobal?t=global:"undefined"!=typeofself&&(t=self),t.torque=e()}}(function(){vare,t,n;returnfunctioni(e,t,n){functionr(o,u){if(!t[o]){if(!e[o]){vara=typeofrequire=="function"&&require;if(!u&&a)returna(o,!0);if(s)returns(o,!0);varf=newError("Cannot find module '"+o+"'");throwf.code="MODULE_NOT_FOUND",f}varl=t[o]={exports:{}};e[o][0].call(l.exports,function(t){varn=e[o][1][t];returnr(n?n:t)},l,l.exports,i,e,t,n)}returnt[o].exports}vars=typeofrequire=="function"&&require;for(varo=0;o<n.length;o++)r(n[o]);returnr}({1:[function(e,t,n){(function(n){functiono(e,t){if(!t.steps)thrownewError("steps option missing");this.options=t,this.running=!1,this._tick=this._tick.bind(this),this._t0=+(newDate),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.rescale()}varr=e("./"),i=n.requestAnimationFrame||n.mozRequestAnimationFrame||n.webkitRequestAnimationFrame||n.msRequestAnimationFrame||function(e){returnn.setTimeout(e,1e3/60)},s=n.cancelAnimationFrame||n.mozCancelAnimationFrame||n.webkitCancelAnimationFrame||n.msCancelAnimationFrame||function(e){clearTimeout(e)};o.prototype={start:function(){this.running=!0,i(this._tick),this.options.onStart&&this.options.onStart(),this.options.steps===1&&(this.running=!1)},isRunning:function(){returnthis.running},stop:function(){this.pause(),this.time(0),this.options.onStop&&this.options.onStop()},time:function(e){if(!arguments.length)returnthis._time;this._time=e;vart=this.range(this.domain(this._time));this.callback(t)},toggle:function(){this.running?this.pause():this.start()},rescale:function(){returnthis.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.options.steps),this.rangeInv=this.range.invert(),this.time(this._time),this.start(),this},duration:function(e){returnarguments.length?(this.options.animationDuration=e,this.time()>e&&this.time(0),this.rescale(),this):this.options.animationDuration},steps:function(e){returnthis.options.steps=e,this.rescale()},step:function(e){if(arguments.length===0)returnthis.range(this.domain(this._time));this._time=this.domainInv(this.rangeInv(e))},pause:function(){this.running=!1,s(this._tick),this.options.onPause&&this.options.onPause()},_tick:function(){vare=+(newDate),t=(e-this._t0)*.001;t=Math.min(this.options.maxDelta,t),this._t0=e,this._time+=t,this.step()>=this.options.steps&&(this.options.loop?this._time=0:(this.time(this.options.animationDuration),this.pause())),this.running&&(this.time(this._time),i(this._tick))}},t.exports=o}).call(this,typeofglobal!="undefined"?global:typeofself!="undefined"?self:typeofwindow!="undefined"?window:{})},{"./":10}],2:[function(e,t,n){varr={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:"Numberofanimationsteps/framesusedintheanimation.Ifthedatacontainsafewere
window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame||function(e){clearTimeout(e)}},_createCanvas:function(){vare;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;vart="leaflet-tile-container";returnthis.options.zoomAnimation&&(t+=" leaflet-zoom-animated"),e.setAttribute("class",t),e},onAdd:function(e){this._map=e;vart=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(){vart=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.render,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);vart=this._backCanvas;t.width=this._canvas.width,t.height=this._canvas.height;varn=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";varr=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(){returnthis._canvas},getAttribution:function(){returnthis.options.attribution},draw:function(){returnthis._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){returne.addLayer(this),this},error:function(e){returnthis.provider.options.errorCallback=e,this},setOpacity:function(e){returnthis.options.opacity=e,this._updateOpacity(),this},setZIndex:function(e){this._canvas.style.zIndex=e,this.options.zoomAnimation&&(this._backCanvas.style.zIndex=e)},bringToFront:function(){returnthis},bringToBack:function(){returnthis},_reset:function(){vare=this._map.getSize();this._canvas.width=e.x,this._canvas.height=e.y;vart=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){e?this.render():this._render()},onResize:function(){},render:function(){thrownewError("render function should be implemented")}})},{"./leaflet_tileloader_mixin":13}],12:[function(e,t,n){typeofL!="undefined"&&e("./torque")},{"./torque":14}],13:[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;vare=this._map.getPixelBounds(),t=this._map.getZoom(),n=this.options.tileSize;if(t>this.options.maxZoom||t<this.options.minZoom)return;varr=newL.Point(Math.floor(e.min.x/n),Math.floor(e.min.y/n)),i=newL.Point(Math.floor(e.max.x/n),Math.floor(e.max.y/n)),s=newL.Bounds(r,i);this._addTilesFromCenterOut(s),th
e.zoom+"/"+e.x+"/"+e.y);varr=this;s(function(s){varo=c(s);if(o){varu=o;n(r.proccessTile(u,e,t))}elsei.metric("torque.provider.splunk.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(){returnMath.min(this.options.steps,this.options.data_steps)},getBounds:function(){returnthis.options.bounds},getSQL:function(){returnthis.options.sql||"select * from "+this.options.table},setSQL:function(e){this.options.sql!=e&&(this.options.sql=e,this.reload())},_buildMapsApiTemplate:function(e){vart=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(){vare=this.options,t=e.user_name||e.user;returne.maps_api_template.replace("{user}",t)},url:function(){vare=this.options,t=e.cdn_url,n=!t||t&&!t.http&&!t.https;if(e.no_cdn||n)returnthis._tilerHost();varr=this.isHttps()?"https":"http",i=r+"://";this.isHttps()||(i+="{s}.");vars=t[r];this._isUserTemplateUrl(s)||(s+="/{user}");varo=e.user_name||e.user;returni+=s.replace("{user}",o),i},_isUserTemplateUrl:function(e){returne&&e.indexOf("{user}")!==-1},isHttps:function(){returnthis.options.maps_api_template.indexOf("https")===0},_generateCartoCSS:function(){vare={"-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(varnine)t+=n+":"+e[n]+";";returnt+"}"},_fetchMap:function(e){vart=this,n={},r=this.options.dynamic_cdn?this.url().replace("{s}","0"):this._tilerHost(),s=r+"/api/v1/map",o=this.options.named_map,u={};o?(s=r+"/api/v1/map/named/"+o.name+"/jsonp",typeofo.params!="undefined"&&(n=o.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&&(u.stat_tag=this.options.stat_tag),extra=this._extraParams(u),extra&&(extra=extra.replace("api_key=","map_key=")),s=s+"?config="+encodeURIComponent(JSON.stringify(n))+"&callback=?"+(extra?"&"+extra:"");vara=i.metric("torque.provider.windshaft.layergroup.time").start(),f={start:1262311701e3,end:1391640787e3,data_steps:8247,column_type:"date"};for(varlinf)t.options[l]=f[l]}},t.exports=c},{"../":10,"../profiler":17}],22:[function(e,t,n){functionf(e){for(vart=1;t<arguments.length;++t){varn=arguments[t];for(varrinn)e=e.replace(RegExp("\\{"+r+"\\}","g"),n[r])}returne}varr=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){vart=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){varr,s=newthis.options.coordinates_data_type(e.length),f=newthis.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.leng