text: "use strict";function processData(a){$.each(a,function(a,b){locationQuery.push({name:b[1],value:b[0],source:b[2]})});var b=new Bloodhound({name:"locations",datumTokenizer:function(a){return Bloodhound.tokenizers.whitespace(a.name)},queryTokenizer:Bloodhound.tokenizers.whitespace,local:locationQuery,limit:5});b.initialize();var c={hint:!0,highlight:!0,minLength:1,limit:5},d={name:"source",displayKey:"name",source:b.ttAdapter()};$("#userQuery").typeahead(c,d).on("typeahead:selected",function(a,b){queryLayer=b.source,queryName=b.name,queryValue=b.value,fadeLanding(queryType,queryLayer,queryValue)}),$("#mapQuery").typeahead(c,d).on("typeahead:selected",function(a,b){queryLayer=b.source,queryName=b.name,queryValue=b.value,map.hasLayer(searchArea)&&map.removeLayer(searchArea),$(".collapse.in").collapse("hide"),proximity_sort=!1,searchLocation(queryLayer,queryValue),$("#mapQuery").typeahead("val","")})}function createMap(){map=new L.map("mapDIV",{minZoom:zLevel,zoomControl:!1,layers:[CartoDB_Positron]}).setView([oLat,oLng],zLevel);var a={Satellite:Mapbox_Imagery,"Street Map":CartoDB_Positron};L.esri.featureLayer({url:"https://arcgis.dvrpc.org/arcgis/rest/services/Boundaries/DVRPC_Boundaries/FeatureServer/1",simplifyFactor:.5,precision:5,style:{color:"grey",weight:3,fill:!1,opacity:.3,clickable:!1}}).addTo(map);L.control.layers(a,null,{position:"topright"}).addTo(map);map.addControl(L.control.zoom({position:"topright"})),map.on("click",function(){$("#aoi-help").collapse("hide")}),map.on("draw:drawstart",function(){syncMapTable=!1,$("#return-to-search").hide(),$("#noresults").hide()}),map.on("moveend",function(){syncMapTable&&filDataTable(map.getBounds())}),map.on("zoomend",function(){syncMapTable&&filDataTable(map.getBounds())}),map.on("draw:created",function(a){map.hasLayer(searchArea)&&map.removeLayer(searchArea),map.hasLayer(TCresults)&&map.removeLayer(TCresults),$("#aoi-draw").collapse("hide"),searchArea=a.layer,proximity_sort=!1,map.addLayer(searchArea),searchArea.setStyle({weight:5,color:"#7d95b8",fill:!1,opacity:.6}),map.fitBounds(searchArea.getBounds()),updateSearchArea(searchArea)}),polygonDrawer=new L.Draw.Polygon(map),L.Control.MapLegend=L.Control.extend({options:{position:"bottomleft"},onAdd:function(a){var b=L.DomUtil.create("div","map-legend legend-control leaflet-bar");b.innerHTML+='<div id="legend-icon" title="Toggle Legend"><i class="glyphicon glyphicon-minus"></i><span class="legend-label" style="display:none;">&nbsp;&nbsp;Legend</span></div>';var c=L.DomUtil.create("div","map-legend-items legend-top",b),d=L.DomUtil.create("div","map-legend-items legend-body",b);L.DomUtil.create("div","map-legend-items legend-bottom",b);return d.innerHTML+='<div id="legend-content" class="row"><div class="col-xs-4"><i class="glyphicon glyphicon-circle ct-vol"></i>&nbsp;&nbsp;Volume<br/><i class="glyphicon glyphicon-circle ct-15min"></i>&nbsp;&nbsp;15 Min Volume<br/><i class="glyphicon glyphicon-circle ct-speed"></i>&nbsp;&nbsp;Speed</div><div class="col-xs-4"><i class="glyphicon glyphicon-circle ct-class"></i>&nbsp;&nbsp;Class<br/><i class="glyphicon glyphicon-circle ct-mclass"></i>&nbsp;&nbsp;Manual Class<br/><i class="glyphicon glyphicon-circle ct-tm"></i>&nbsp;&nbsp;Turning Movement</div><div class="col-xs-4"><i class="glyphicon glyphicon-circle ct-loop"></i>&nbsp;&nbsp;Loop<br/><i class="glyphicon glyphicon-circle ct-8day"></i>&nbsp;&nbsp;8 Day<br/><i class="glyphicon glyphicon-circle ct-cwalk"></i>&nbsp;&nbsp;Crosswalk</div></div>',c.innerHTML+='<p><b>Count Types</b><span id="legend-definition" class="nav-item" data-modal="legend-modal"><i class="glyphicon glyphicon-info-sign"></i>&nbsp;&nbsp;data definitions</span>',b.setAttribute("data-status","open"),b}});var b=new L.Control.MapLegend;map.addControl(b)}function fadeLanding(a,b,c){$("#TC_header").css({height:"60px"}),$(".video-hero").css({opacity:"0.0"}).delay(800).queue(function(){$(".video-hero").hide(),$("#hero-video").get(0).pause()}),$("#landingSearch").css({opacity:"0.0"}).html(),$("#container").addClass("mapView"),$("#landing_map").toggleClass("col-sm-12 col-lg-12 col-sm-6 col-lg-6").delay(790).queue(function(){createMap(),$("#mapDIV").queue(function(){switch(a){case"location":searchLocation(b,c);break;case"recnumber":break;default:polygonDrawer.enable(),$("#loading").hide()}$("#mapDIV").css({opacity:"1.0"}),$("#container").fadeOut()})})}function searchLocation(a,b){L.esri.Tasks.query({url:get_query_url(a)}).where(get_key_field(a)+"='"+b+"'").run(function(a,b){a||(syncMapTable=!1,fitSearchArea=!0,searchArea=L.geoJson(b,{style:{weight:5,color:"#7d95b8",fill:!1,opacity:.6}}),map.fitBounds(searchArea.getBounds()),searchArea.addTo(map),updateSearchArea(searchArea),$(".filter-btn").prop("disabled",!1))})}function search_by_number(){var a="",b="";$("#loading").show(),b=rec_query.split(","),$(b).each(function(b,c){a.length?a+=" OR ":a+=" ",a+="(RECORDNUM = '"+c+"')"}),L.esri.Tasks.query({url:"https://services1.arcgis.com/LWtWv6q6BJyKidj8/arcgis/rest/services/DVRPC_Traffic_Counts/FeatureServer/0"}).where(a).run(function(a,b){if(!a){null!=TCresults&&TCresults.clearLayers(),TCresults.addData(b),$("#loading").hide(),map_direct()}})}function updateSearchArea(a,b){var c="",d="";$("#loading").show(),$(".collapse.in").collapse("hide"),$('#dropdown-types input[type="checkbox"]').each(function(a){$(this).prop("checked")&&(d.length?d+=" OR ":d+=" AND (",d+="TYPE ='"+$(this).attr("data-layer")+"'")}),d.length>1&&(d+=")"),c="(SETYEAR >="+min+" AND SETYEAR <="+max+")"+d,"filter"===b&&(fitSearchArea=!1),L.esri.Tasks.query({url:"https://services1.arcgis.com/LWtWv6q6BJyKidj8/arcgis/rest/services/DVRPC_Traffic_Counts/FeatureServer/0"}).within(a).where(c).run(function(a,b){a||(null!=TCresults&&TCresults.clearLayers(),TCresults.addData(b),$("#loading").hide(),map_results(),clear_table_filter())})}function map_direct(){syncMapTable=!1,map.hasLayer(records_download)&&map.removeLayer(records_download),map.hasLayer(searchArea)&&map.removeLayer(records_download),TCresults.eachLayer(function(a){download_records.push(a.feature)}),map.addLayer(TCresults),map.fitBounds(TCresults.getBounds()),build_table(TCresults),clear_table_filter(),$("div.results-toolbar").html('<button type="button" class="download-records btn btn-primary btn-xs">download selected</button>&nbsp;&nbsp;<p>Showing direct search results. To enable filters identify search area.</p>'),$(".filter-btn").prop("disabled",!0)}function map_results(){var a="disabled";syncMapTable=!0,fitSearchArea=!0,map.hasLayer(records_download)&&map.removeLayer(records_download),map.addLayer(TCresults),map.addLayer(searchArea),fitSearchArea&&map.fitBounds(searchArea.getBounds()),build_table(TCresults),download_records.length&&(a=" "),$("div.results-toolbar").html('<button id="view-selected" type="button" class="download_all record-btns btn btn-primary btn-xs '+a+'">view selected</button><button type="button" class="download-records record-btns btn btn-primary btn-xs '+a+'">download selected</button><span id="download-help" class="nav-item small" data-modal="help-modal"><i class="glyphicon glyphicon-question-sign"></i>&nbsp;&nbsp;download help</span>'),$(".filter-btn").prop("disabled",!1)}function map_selected(){if(download_records.length){var a="",b="";null!==records_download&&records_download.clearLayers(),a='{"type": "FeatureCollection","features": '+JSON.stringify(download_records)+"}",b=jQuery.parseJSON(a),syncMapTable=!1,map.removeLayer(TCresults),map.removeLayer(searchArea),records_download.addData(b).addTo(map),map.fitBounds(records_download.getBounds(),[30,30]),build_table(records_download),clear_table_filter(),$("div.results-toolbar").html('<button type="button" class="view-all btn btn-primary btn-xs">view all</button><button type="button" class="download-records record-btns btn btn-primary btn-xs">download selected</button><span id="download-help" class="nav-item small" data-modal="help-modal"><i class="glyphicon glyphicon-question-sign"></i>&nbsp;&nbsp;download help</span>'),$(".filter-btn").prop("disabled",!0)}}function build_table(a){$("#noresults").hide(),TCtable=[],a.eachLayer(function(a){var b=a.feature.properties.SETDATE,c=processRoadname(a.feature.properties),d=a.feature.properties.TYPE,e=a.feature.properties.AADT,f=a.feature.properties.CNTDIR,g=a.feature.id,h=a.feature.properties.RECORDNUM,i='<button type="button" class="btn btn-primary btn-xs">'+a.feature.properties.RECORDNUM+'&nbsp;<i class="glyphicon glyphicon-new-window" title="download report"></i></button>',j=L.stamp(a),k=new Date(b),l=a._latlng,m=processRoadname(a.feature.properties)+" "+("both"!=a.feature.properties.CNTDIR?'<span class="cnt-direction" >- '+capitalize(a.feature.properties.CNTDIR.split("")[0])+"B</span>":""),n='<span class="hidden">'+k.getFullYear()+k.getMonth()+k.getDate()+"</span>"+months[k.getMonth()]+" "+k.getFullYear(),o=0!==e?numeral(e).format("0,0"):"n/a";TCtable.push({date:n,road:c,type:capitalize(d),aadt:o,cntdir:f,unid:j,layer:g,recnum:h,report:i,latlng:l,tableRoad:m})}),TCtable.length?syncMapTable?filDataTable(map.getBounds()):render_table(TCtable):(clearTable(),$("#noresults").show())}function render_table(a){$("#return-to-search").hide(),currTable=a,a.length?(proximity_sort?sortDataTable():(clearTable(),table.order([1,"desc"]),table.rows.add(a).draw(),resizeTableHeight()),currTable.length!=TCtable.length&&$("#table_info").append(" ("+TCtable.length+" results in search area)"),build_legend(a)):(clearTable(),$("#return-to-search").show())}function clearTable(){tableExists&&table.clear().draw()}function build_legend(a){var b='<div class="col-xs-4">',c=[];legend_types={};for(var d=0,e=a.length;d<e;d++)legend_types[a[d].type]||(legend_types[a[d].type]=count_dictionary[a[d].type].rank);c=Object.keys(legend_types).sort(function(a,b){return legend_types[a]-legend_types[b]});for(var f=c.length,g=Math.floor(f>5?f/3:f/2),d=0,e=c.length;d<e;d++)d%g||0===d||(b+='</div><div class="col-xs-4">'),b+='<i class="glyphicon glyphicon-circle '+count_dictionary[c[d]].class+'"></i>&nbsp;&nbsp;'+c[d]+"</br>",d+1===e&&(b+="</div>");$("#legend-content").html(b)}function clear_table_filter(){table.search("").columns().search("").draw()}function get_key_field(a){switch(a){case"zip":return"ZIP_CODE";case"mun_boundary":return"OBJECTID";case"neighborhood":return"FID"}}function get_query_url(a){switch(a){case"zip":return"https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/USA_ZIP_Codes_2015/FeatureServer/0";case"mun_boundary":return"https://arcgis.dvrpc.org/arcgis/rest/services/AppData/TC_MCD/MapServer/2";case"neighborhood":return"https://services.arcgis.com/rkitYk91zieQFZov/ArcGIS/rest/services/Philadelphia_Neighborhoods/FeatureServer/0"}}function getValue(a){switch(a){case"Volume":return"#ff7f00";case"15 min Volume":return"#35978f";case"Speed":return"#c2e699";case"Class":return"#fb9a99";case"Manual Class":return"#e31a1c";case"Turning Movement":return"#1f78b4";case"Loop":return"#cab2d6";case"8 Day":return"#fdbf6f";case"Crosswalk":return"#dd3497"}}function processRoadname(a){if(" "!==a.RDPREFIX){var b=" "!==a.ROAD?" ("+capitalize(a.ROAD)+")":"";return a.RDPREFIX.toUpperCase()+" "+a.ROUTE+b}return capitalize(a.ROAD)}function findWithAttr(a,b,c,d){for(var e=0,f=a.length;e<f;e++)if(a[e][b][c]===parseInt(d))return e}function capitalize(a){return a.toLowerCase().replace(/\b./g,function(a){return a.toUpperCase()}).replace(/(Wb |Eb |Nb |Sb )/g,function(a){return a.toUpperCase()}).replace(/('[A-z])/g,function(a){return a.toLowerCase()})}function sortDataTable(a){currTable.sort(function(a,b){var c=cartDist(centerLatLng,a.latlng),d=cartDist(centerLatLng,b.latlng);return c<d?-1:c>d?1:a.recnum<b.recnum?1:a.recnum>b.recnum?-1:0}),tableExists&&(clearTable(),table.order([0,"desc"]),table.rows.add(currTable).draw(),resizeTableHeight())}function cartDist(a,b){return Math.sqrt(Math.pow(b.lat-a.lat,2)+Math.pow(b.lng-a.lng,2))}function filDataTable(a){TCtable.length&&render_table(TCtable.filter(function(b){return a.contains(b.latlng)}))}function record_report(a,b){"Turning Movement"===b||"Manual Class"===b||"Crosswalk"===b?window.open("https://www.dvrpc.org/asp/TrafficCountPDF/"+b+"/"+a+".pdf","_blank"):window.open("https://www.dvrpc.org/asp/trafficCount/default.aspx?recnum="+a,"_blank")}function partyTime(a){var b=document.createElement("div");b.id="party",b.style="width:500px;height:60px;position:absolute;top:130px;left:20px;background-color:#efefef;";var c=document.createElement("div");c.id="js-sc-close",c.style="height:20px;width:20px;font-size:14px;color:#fff;text-align:center;background-color:#ff9900;position:absolute;top:0;right:-20px;",c.innerHTML="x",b.appendChild(c);var d=document.createElement("iframe");d.width="500",d.height="60",d.scrolling="no",d.frameborder="no","tasty time"===a?d.src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/269256410&amp;color=ff9900&amp;auto_play=true&amp;hide_related=false&amp;show_comments=false&amp;show_user=false&amp;show_reposts=false;":"gusgus"===a?d.src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/18608884&amp;color=ff5500&amp;auto_play=true&amp;hide_related=false&amp;show_comments=false&amp;show_user=false&amp;show_reposts=false":"goodbye brady"===a&&(d.src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/108456959&amp;color=ff5500&amp;auto_play=true&amp;hide_related=false&amp;show_comments=false&amp;show_user=false&amp;show_reposts=false"),b.appendChild(d),document.body.appendChild(b),$("#records").val("")}function getDynTableHeight(){return $("#results-panel").height()-getRealHigh("#table_filter")-getRealHigh("#table_paginate")-getRealHigh("#table_info")}function getRealHigh(a){return $(a).height()+parseInt($(a).css("margin-top").replace("px",""))+parseInt($(a).css("margin-bottom").replace("px",""))+parseInt($(a).css("padding-top").replace("px",""))+parseInt($(a).css("padding-bottom").replace("px",""))}function resizeTableHeight(){}function filterdates(a){return a%5?0:1}!function(a,b,c){L.drawVersion="0.2.4-dev",L.drawLocal={draw:{toolbar:{actions:{title:"Cancel drawing",text:"Cancel"},undo:{title:"Delete last point drawn",text:"Delete last point"},buttons:{polygon:"Draw a search area"}},handlers:{polygon:{tooltip:{start:"Click to start drawing search area.",cont:"Click to continue drawing search area.",end:"Click first point to close this search area."}},polyline:{error:"<strong>Error:</strong> shape edges cannot cross!",tooltip:{start:"Click to start drawing line.",cont:"Click to continue drawing line.",end:"Click last point to finish line."}}}},edit:{toolbar:{actions:{save:{title:"Save changes.",text:"Save"},cancel:{title:"Cancel editing, discards all changes.",text:"Cancel"}},buttons:{edit:"Edit layers.",editDisabled:"No layers to edit.",remove:"Delete layers.",removeDisabled:"No layers to delete."}},handlers:{edit:{tooltip:{text:"Drag handles, or marker to edit feature.",subtext:"Click cancel to undo changes."}},remove:{tooltip:{text:"Click on a feature to remove"}}}}},L.Draw={},L.Draw.Feature=L.Handler.extend({includes:L.Mixin.Events,initialize:function(a,b){this._map=a,this._container=a._container,this._overlayPane=a._panes.overlayPane,this._popupPane=a._panes.popupPane,b&&b.shapeOptions&&(b.shapeOptions=L.Util.extend({},this.options.shapeOptions,b.shapeOptions)),L.setOptions(this,b)},enable:function(){this._enabled||(L.Handler.prototype.enable.call(this),this.fire("enabled",{handler:this.type}),this._map.fire("draw:drawstart",{layerType:this.type}))},disable:function(){this._enabled&&(L.Handler.prototype.disable.call(this),this._map.fire("draw:drawstop",{layerType:this.type}),this.fire("disabled",{handler:this.type}))},addHooks:function(){var a=this._map;a&&(L.DomUtil.disableTextSelection(),a.getContainer().focus(),this._tooltip=new L.Tooltip(this._map),L.DomEvent.on(this._container,"keyup",this._cancelDrawing,this))},removeHooks:function(){this._map&&(L.DomUtil.enableTextSelection(),this._tooltip.dispose(),this._tooltip=null,L.DomEvent.off(this._container,"keyup",this._cancelDrawing,this))},setOptions:function(a){L.setOptions(this,a)},_fireCreatedEvent:function(a){this._map.fire("draw:created",{layer:a,layerType:this.type})},_cancelDrawing:function(a){27===a.keyCode&&this.disable()}}),L.Draw.Polyline=L.Draw.Feature.extend({statics:{TYPE:"polyline"},Poly:L.Polyline,options:{allowIntersection:!0,repeatMode:!1,drawError:{color:"#b00b00",timeout:2500},icon:new L.DivIcon({iconSize:new L.Point(8,8),className:"leaflet-div-icon leaflet-editing-icon"}),guidelineDistance:20,maxGuideLineLength:4e3,shapeOptions:{stroke:!0,color:"#f06eaa",weight:4,opacity:.5,fill:!1,clickable:!0},metric:!0,showLength:!0,zIndexOffset:2e3},initialize:function(a,b){this.options.drawError.message=L.drawLocal.draw.handlers.polyline.error,b&&b.drawError&&(b.drawError=L.Util.extend({},this.options.drawError,b.drawError)),this.type=L.Draw.Polyline.TYPE,L.Draw.Feature.prototype.initialize.call(this,a,b)},addHooks:function(){L.Draw.Feature.prototype.addHooks.call(this),this._map&&(this._markers=[],this._markerGroup=new L.LayerGroup,this._map.addLayer(this._markerGroup),this._poly=new L.Polyline([],this.options.shapeOptions),this._tooltip.updateContent(this._getTooltipText()),this._mouseMarker||(this._mouseMarker=L.marker(this._map.getCenter(),{icon:L.divIcon({className:"leaflet-mouse-marker",iconAnchor:[20,20],iconSize:[40,40]}),opacity:0,zIndexOffset:this.options.zIndexOffset})),this._mouseMarker.on("mousedown",this._onMouseDown,this).addTo(this._map),this._map.on("mousemove",this._onMouseMove,this).on("mouseup",this._onMouseUp,this).on("zoomend",this._onZoomEnd,this))},removeHooks:function(){L.Draw.Feature.prototype.removeHooks.call(this),this._clearHideErrorTimeout(),this._cleanUpShape(),this._map.removeLayer(this._markerGroup),delete this._markerGroup,delete this._markers,this._map.removeLayer(this._poly),delete this._poly,this._mouseMarker.off("mousedown",this._onMouseDown,this).off("mouseup",this._onMouseUp,this),this._map.removeLayer(this._mouseMarker),delete this._mouseMarker,this._clearGuides(),this._map.off("mousemove",this._onMouseMove,this).off("zoomend",this._onZoomEnd,this)},deleteLastVertex:function(){if(!(this._markers.length<=1)){var a=this._markers.pop(),b=this._poly,c=this._poly.spliceLatLngs(b.getLatLngs().length-1,1)[0];this._markerGroup.removeLayer(a),b.getLatLngs().length<2&&this._map.removeLayer(b),this._vertexChanged(c,!1)}},addVertex:function(a){if(this._markers.length>0&&!this.options.allowIntersection&&this._poly.newLatLngIntersects(a))return void this._showErrorTooltip();this._errorShown&&this._hideErrorTooltip(),this._markers.push(this._createMarker(a)),this._poly.addLatLng(a),2===this._poly.getLatLngs().length&&this._map.addLayer(this._poly),this._vertexChanged(a,!0)},_finishShape:function(){var a=this._poly.newLatLngIntersects(this._poly.getLatLngs()[0],!0);if(!this.options.allowIntersection&&a||!this._shapeIsValid())return void this._showErrorTooltip();this._fireCreatedEvent(),this.disable(),this.options.repeatMode&&this.enable()},_shapeIsValid:function(){return!0},_onZoomEnd:function(){this._updateGuide()},_onMouseMove:function(a){var b=a.layerPoint,c=a.latlng;this._currentLatLng=c,this._updateTooltip(c),this._updateGuide(b),this._mouseMarker.setLatLng(c),L.DomEvent.preventDefault(a.originalEvent)},_vertexChanged:function(a,b){this._updateFinishHandler(),this._updateRunningMeasure(a,b),this._clearGuides(),this._updateTooltip()},_onMouseDown:function(a){var b=a.originalEvent;this._mouseDownOrigin=L.point(b.clientX,b.clientY)},_onMouseUp:function(b){if(this._mouseDownOrigin){var c=L.point(b.originalEvent.clientX,b.originalEvent.clientY).distanceTo(this._mouseDownOrigin);Math.abs(c)<9*(a.devicePixelRatio||1)&&this.addVertex(b.latlng)}this._mouseDownOrigin=null},_updateFinishHandler:function(){var a=this._markers.length;a>1&&this._markers[a-1].on("click",this._finishShape,this),a>2&&this._markers[a-2].off("click",this._finishShape,this)},_createMarker:function(a){var b=new L.Marker(a,{icon:this.options.icon,zIndexOffset:2*this.options.zIndexOffset});return this._markerGroup.addLayer(b),b},_updateGuide:function(a){var b=this._markers.length;b>0&&(a=a||this._map.latLngToLayerPoint(this._currentLatLng),this._clearGuides(),this._drawGuide(this._map.latLngToLayerPoint(this._markers[b-1].getLatLng()),a))},_updateTooltip:function(a){var b=this._getTooltipText();a&&this._tooltip.updatePosition(a),this._errorShown||this._tooltip.updateContent(b)},_drawGuide:function(a,b){var c,d,e,f=Math.floor(Math.sqrt(Math.pow(b.x-a.x,2)+Math.pow(b.y-a.y,2))),g=this.options.guidelineDistance,h=this.options.maxGuideLineLength,i=f>h?f-h:g;for(this._guidesContainer||(this._guidesContainer=L.DomUtil.create("div","leaflet-draw-guides",this._overlayPane));i<f;i+=this.options.guidelineDistance)c=i/f,d={x:Math.floor(a.x*(1-c)+c*b.x),y:Math.floor(a.y*(1-c)+c*b.y)},e=L.DomUtil.create("div","leaflet-draw-guide-dash",this._guidesContainer),e.style.backgroundColor=this._errorShown?this.options.drawError.color:this.options.shapeOptions.color,L.DomUtil.setPosition(e,d)},_updateGuideColor:function(a){if(this._guidesContainer)for(var b=0,c=this._guidesContainer.childNodes.length;b<c;b++)this._guidesContainer.childNodes[b].style.backgroundColor=a},_clearGuides:function(){if(this._guidesContainer)for(;this._guidesContainer.firstChild;)this._guidesContainer.removeChild(this._guidesContainer.firstChild)},_getTooltipText:function(){var a,b,c=this.options.showLength;return 0===this._markers.length?a={text:L.drawLocal.draw.handlers.polyline.tooltip.start}:(b=c?this._getMeasurementString():"",a=1===this._markers.length?{text:L.drawLocal.draw.handlers.polyline.tooltip.cont,subtext:b}:{text:L.drawLocal.draw.handlers.polyline.tooltip.end,subtext:b}),a},_updateRunningMeasure:function(a,b){var c,d,e=this._markers.length;1===this._markers.length?this._measurementRunningTotal=0:(c=e-(b?2:1),d=a.distanceTo(this._markers[c].getLatLng()),this._measurementRunningTotal+=d*(b?1:-1))},_getMeasurementString:function(){var a,b=this._currentLatLng,c=this._markers[this._markers.length-1].getLatLng();return a=this._measurementRunningTotal+b.distanceTo(c),L.GeometryUtil.readableDistance(a,this.options.metric)},_showErrorTooltip:function(){this._errorShown=!0,this._tooltip.showAsError().updateContent({text:this.options.drawError.message}),this._updateGuideColor(this.options.drawError.color),this._poly.setStyle({color:this.options.drawError.color}),this._clearHideErrorTimeout(),this._hideErrorTimeout=setTimeout(L.Util.bind(this._hideErrorTooltip,this),this.options.drawError.timeout)},_hideErrorTooltip:function(){this._errorShown=!1,this._clearHideErrorTimeout(),this._tooltip.removeError().updateContent(this._getTooltipText()),this._updateGuideColor(this.options.shapeOptions.color),this._poly.setStyle({color:this.options.shapeOptions.color})},_clearHideErrorTimeout:function(){this._hideErrorTimeout&&(clearTimeout(this._hideErrorTimeout),this._hideErrorTimeout=null)},_cleanUpShape:function(){this._markers.length>1&&this._markers[this._markers.length-1].off("click",this._finishShape,this)},_fireCreatedEvent:function(){var a=new this.Poly(this._poly.getLatLngs(),this.options.shapeOptions);L.Draw.Feature.prototype._fireCreatedEvent.call(this,a)}}),L.Draw.Polygon=L.Draw.Polyline.extend({statics:{TYPE:"polygon"},Poly:L.Polygon,options:{showArea:!1,shapeOptions:{stroke:!0,color:"#FFA200",weight:5,opacity:.5,fill:!0,fillColor:null,fillOpacity:.2,clickable:!0}},initialize:function(a,b){L.Draw.Polyline.prototype.initialize.call(this,a,b),this.type=L.Draw.Polygon.TYPE},_updateFinishHandler:function(){var a=this._markers.length;1===a&&this._markers[0].on("click",this._finishShape,this),a>2&&(this._markers[a-1].on("dblclick",this._finishShape,this),a>3&&this._markers[a-2].off("dblclick",this._finishShape,this))},_getTooltipText:function(){var a,b;return 0===this._markers.length?a=L.drawLocal.draw.handlers.polygon.tooltip.start:this._markers.length<3?a=L.drawLocal.draw.handlers.polygon.tooltip.cont:(a=L.drawLocal.draw.handlers.polygon.tooltip.end,b=this._getMeasurementString()),{text:a,subtext:b}},_getMeasurementString:function(){var a=this._area;return a?L.GeometryUtil.readableArea(a,this.options.metric):null},_shapeIsValid:function(){return this._markers.length>=3},_vertexChanged:function(a,b){var c;!this.options.allowIntersection&&this.options.showArea&&(c=this._poly.getLatLngs(),this._area=L.GeometryUtil.geodesicArea(c)),L.Draw.Polyline.prototype._vertexChanged.call(this,a,b)},_cleanUpShape:function(){var a=this._markers.length;a>0&&(this._markers[0].off("click",this._finishShape,this),a>2&&this._markers[a-1].off("dblclick",this._finishShape,this))}}),L.SimpleShape={},L.Draw.SimpleShape=L.Draw.Feature.extend({options:{repeatMode:!1},initialize:function(a,b){this._endLabelText=L.drawLocal.draw.handlers.simpleshape.tooltip.end,L.Draw.Feature.prototype.initialize.call(this,a,b)},addHooks:function(){L.Draw.Feature.prototype.addHooks.call(this),this._map&&(this._mapDraggable=this._map.dragging.enabled(),this._mapDraggable&&this._map.dragging.disable(),this._container.style.cursor="crosshair",this._tooltip.updateContent({text:this._initialLabelText}),this._map.on("mousedown",this._onMouseDown,this).on("mousemove",this._onMouseMove,this))},removeHooks:function(){L.Draw.Feature.prototype.removeHooks.call(this),this._map&&(this._mapDraggable&&this._map.dragging.enable(),this._container.style.cursor="",this._map.off("mousedown",this._onMouseDown,this).off("mousemove",this._onMouseMove,this),L.DomEvent.off(b,"mouseup",this._onMouseUp,this),this._shape&&(this._map.removeLayer(this._shape),delete this._shape)),this._isDrawing=!1},_getTooltipText:function(){return{text:this._endLabelText}},_onMouseDown:function(a){this._isDrawing=!0,this._startLatLng=a.latlng,L.DomEvent.on(b,"mouseup",this._onMouseUp,this).preventDefault(a.originalEvent)},_onMouseMove:function(a){var b=a.latlng;this._tooltip.updatePosition(b),this._isDrawing&&(this._tooltip.updateContent(this._getTooltipText()),this._drawShape(b))},_onMouseUp:function(){this._shape&&this._fireCreatedEvent(),this.disable(),this.options.repeatMode&&this.enable()}}),L.Edit=L.Edit||{},L.Edit.Poly=L.Handler.extend({options:{icon:new L.DivIcon({iconSize:new L.Point(8,8),className:"leaflet-div-icon leaflet-editing-icon"})},initialize:function(a,b){this._poly=a,L.setOptions(this,b)},addHooks:function(){var a=this._poly;a instanceof L.Polygon||(a.options.editing.fill=!1),a.setStyle(a.options.editing),this._poly._map&&(this._markerGroup||this._initMarkers(),this._poly._map.addLayer(this._markerGroup))},removeHooks:function(){var a=this._poly;a.setStyle(a.options.original),a._map&&(a._map.removeLayer(this._markerGroup),delete this._markerGroup,delete this._markers)},updateMarkers:function(){this._markerGroup.clearLayers(),this._initMarkers()},_initMarkers:function(){this._markerGroup||(this._markerGroup=new L.LayerGroup),this._markers=[];var a,b,c,d,e=this._poly._latlngs;for(a=0,c=e.length;a<c;a++)d=this._createMarker(e[a],a),d.on("click",this._onMarkerClick,this),this._markers.push(d);var f,g;for(a=0,b=c-1;a<c;b=a++)(0!==a||L.Polygon&&this._poly instanceof L.Polygon)&&(f=this._markers[b],g=this._markers[a],this._createMiddleMarker(f,g),this._updatePrevNext(f,g))},_createMarker:function(a,b){var c=new L.Marker(a,{draggable:!0,icon:this.options.icon});return c._origLatLng=a,c._index=b,c.on("drag",this._onMarkerDrag,this),c.on("dragend",this._fireEdit,this),this._markerGroup.addLayer(c),c},_removeMarker:function(a){var b=a._index;this._markerGroup.removeLayer(a),this._markers.splice(b,1),this._poly.spliceLatLngs(b,1),this._updateIndexes(b,-1),a.off("drag",this._onMarkerDrag,this).off("dragend",this._fireEdit,this).off("click",this._onMarkerClick,this)},_fireEdit:function(){this._poly.edited=!0,this._poly.fire("edit")},_onMarkerDrag:function(a){var b=a.target;L.extend(b._origLatLng,b._latlng),b._middleLeft&&b._middleLeft.setLatLng(this._getMiddleLatLng(b._prev,b)),b._middleRight&&b._middleRight.setLatLng(this._getMiddleLatLng(b,b._next)),this._poly.redraw()},_onMarkerClick:function(a){var b=L.Polygon&&this._poly instanceof L.Polygon?4:3,c=a.target;this._poly._latlngs.length<b||(this._removeMarker(c),this._updatePrevNext(c._prev,c._next),c._middleLeft&&this._markerGroup.removeLayer(c._middleLeft),c._middleRight&&this._markerGroup.removeLayer(c._middleRight),c._prev&&c._next?this._createMiddleMarker(c._prev,c._next):c._prev?c._next||(c._prev._middleRight=null):c._next._middleLeft=null,this._fireEdit())},_updateIndexes:function(a,b){this._markerGroup.eachLayer(function(c){c._index>a&&(c._index+=b)})},_createMiddleMarker:function(a,b){var c,d,e,f=this._getMiddleLatLng(a,b),g=this._createMarker(f);g.setOpacity(.6),a._middleRight=b._middleLeft=g,d=function(){var d=b._index;g._index=d,g.off("click",c,this).on("click",this._onMarkerClick,this),f.lat=g.getLatLng().lat,f.lng=g.getLatLng().lng,this._poly.spliceLatLngs(d,0,f),this._markers.splice(d,0,g),g.setOpacity(1),this._updateIndexes(d,1),b._index++,this._updatePrevNext(a,g),this._updatePrevNext(g,b),this._poly.fire("editstart")},e=function(){g.off("dragstart",d,this),g.off("dragend",e,this),this._createMiddleMarker(a,g),this._createMiddleMarker(g,b)},c=function(){d.call(this),e.call(this),this._fireEdit()},g.on("click",c,this).on("dragstart",d,this).on("dragend",e,this),this._markerGroup.addLayer(g)},_updatePrevNext:function(a,b){a&&(a._next=b),b&&(b._prev=a)},_getMiddleLatLng:function(a,b){var c=this._poly._map,d=c.project(a.getLatLng()),e=c.project(b.getLatLng());return c.unproject(d._add(e)._divideBy(2))}}),L.Polyline.addInitHook(function(){this.editing||(L.Edit.Poly&&(this.editing=new L.Edit.Poly(this),this.options.editable&&this.editing.enable()),this.on("add",function(){this.editing&&this.editing.enabled()&&this.editing.addHooks()}),this.on("remove",function(){this.editing&&this.editing.enabled()&&this.editing.removeHooks()}))}),L.Edit=L.Edit||{},L.Edit.SimpleShape=L.Handler.extend({options:{moveIcon:new L.DivIcon({iconSize:new L.Point(8,8),className:"leaflet-div-icon leaflet-editing-icon leaflet-edit-move"}),resizeIcon:new L.DivIcon({iconSize:new L.Point(8,8),className:"leaflet-div-icon leaflet-editing-icon leaflet-edit-resize"})},initialize:function(a,b){this._shape=a,L.Util.setOptions(this,b)},addHooks:function(){var a=this._shape;a.setStyle(a.options.editing),a._map&&(this._map=a._map,this._markerGroup||this._initMarkers(),this._map.addLayer(this._markerGroup))},removeHooks:function(){var a=this._shape;if(a.setStyle(a.options.original),a._map){this._unbindMarker(this._moveMarker);for(var b=0,c=this._resizeMarkers.length;b<c;b++)this._unbindMarker(this._resizeMarkers[b]);this._resizeMarkers=null,this._map.removeLayer(this._markerGroup),delete this._markerGroup}this._map=null},updateMarkers:function(){this._markerGroup.clearLayers(),this._initMarkers()},_initMarkers:function(){this._markerGroup||(this._markerGroup=new L.LayerGroup),this._createMoveMarker(),this._createResizeMarker()},_createMoveMarker:function(){},_createResizeMarker:function(){},_createMarker:function(a,b){var c=new L.Marker(a,{draggable:!0,icon:b,zIndexOffset:10});return this._bindMarker(c),this._markerGroup.addLayer(c),c},_bindMarker:function(a){a.on("dragstart",this._onMarkerDragStart,this).on("drag",this._onMarkerDrag,this).on("dragend",this._onMarkerDragEnd,this)},_unbindMarker:function(a){a.off("dragstart",this._onMarkerDragStart,this).off("drag",this._onMarkerDrag,this).off("dragend",this._onMarkerDragEnd,this)},_onMarkerDragStart:function(a){a.target.setOpacity(0),this._shape.fire("editstart")},_fireEdit:function(){this._shape.edited=!0,this._shape.fire("edit")},_onMarkerDrag:function(a){var b=a.target,c=b.getLatLng();b===this._moveMarker?this._move(c):this._resize(c),this._shape.redraw()},_onMarkerDragEnd:function(a){a.target.setOpacity(1),this._fireEdit()},_move:function(){},_resize:function(){}}),L.Edit=L.Edit||{},
  L.Edit.Rectangle=L.Edit.SimpleShape.extend({_createMoveMarker:function(){var a=this._shape.getBounds(),b=a.getCenter();this._moveMarker=this._createMarker(b,this.options.moveIcon)},_createResizeMarker:function(){var a=this._getCorners();this._resizeMarkers=[];for(var b=0,c=a.length;b<c;b++)this._resizeMarkers.push(this._createMarker(a[b],this.options.resizeIcon)),this._resizeMarkers[b]._cornerIndex=b},_onMarkerDragStart:function(a){L.Edit.SimpleShape.prototype._onMarkerDragStart.call(this,a);var b=this._getCorners(),c=a.target,d=c._cornerIndex;this._oppositeCorner=b[(d+2)%4],this._toggleCornerMarkers(0,d)},_onMarkerDragEnd:function(a){var b,c,d=a.target;d===this._moveMarker&&(b=this._shape.getBounds(),c=b.getCenter(),d.setLatLng(c)),this._toggleCornerMarkers(1),this._repositionCornerMarkers(),L.Edit.SimpleShape.prototype._onMarkerDragEnd.call(this,a)},_move:function(a){for(var b,c=this._shape.getLatLngs(),d=this._shape.getBounds(),e=d.getCenter(),f=[],g=0,h=c.length;g<h;g++)b=[c[g].lat-e.lat,c[g].lng-e.lng],f.push([a.lat+b[0],a.lng+b[1]]);this._shape.setLatLngs(f),this._repositionCornerMarkers()},_resize:function(a){var b;this._shape.setBounds(L.latLngBounds(a,this._oppositeCorner)),b=this._shape.getBounds(),this._moveMarker.setLatLng(b.getCenter())},_getCorners:function(){var a=this._shape.getBounds();return[a.getNorthWest(),a.getNorthEast(),a.getSouthEast(),a.getSouthWest()]},_toggleCornerMarkers:function(a){for(var b=0,c=this._resizeMarkers.length;b<c;b++)this._resizeMarkers[b].setOpacity(a)},_repositionCornerMarkers:function(){for(var a=this._getCorners(),b=0,c=this._resizeMarkers.length;b<c;b++)this._resizeMarkers[b].setLatLng(a[b])}}),L.Rectangle.addInitHook(function(){L.Edit.Rectangle&&(this.editing=new L.Edit.Rectangle(this),this.options.editable&&this.editing.enable())}),L.Edit=L.Edit||{},L.Edit.Circle=L.Edit.SimpleShape.extend({_createMoveMarker:function(){var a=this._shape.getLatLng();this._moveMarker=this._createMarker(a,this.options.moveIcon)},_createResizeMarker:function(){var a=this._shape.getLatLng(),b=this._getResizeMarkerPoint(a);this._resizeMarkers=[],this._resizeMarkers.push(this._createMarker(b,this.options.resizeIcon))},_getResizeMarkerPoint:function(a){var b=this._shape._radius*Math.cos(Math.PI/4),c=this._map.project(a);return this._map.unproject([c.x+b,c.y-b])},_move:function(a){var b=this._getResizeMarkerPoint(a);this._resizeMarkers[0].setLatLng(b),this._shape.setLatLng(a)},_resize:function(a){var b=this._moveMarker.getLatLng(),c=b.distanceTo(a);this._shape.setRadius(c)}}),L.Circle.addInitHook(function(){L.Edit.Circle&&(this.editing=new L.Edit.Circle(this),this.options.editable&&this.editing.enable()),this.on("add",function(){this.editing&&this.editing.enabled()&&this.editing.addHooks()}),this.on("remove",function(){this.editing&&this.editing.enabled()&&this.editing.removeHooks()})}),L.LatLngUtil={cloneLatLngs:function(a){for(var b=[],c=0,d=a.length;c<d;c++)b.push(this.cloneLatLng(a[c]));return b},cloneLatLng:function(a){return L.latLng(a.lat,a.lng)}},L.GeometryUtil=L.extend(L.GeometryUtil||{},{geodesicArea:function(a){var b,c,d=a.length,e=0,f=L.LatLng.DEG_TO_RAD;if(d>2){for(var g=0;g<d;g++)b=a[g],c=a[(g+1)%d],e+=(c.lng-b.lng)*f*(2+Math.sin(b.lat*f)+Math.sin(c.lat*f));e=6378137*e*6378137/2}return Math.abs(e)},readableArea:function(a,b){var c;return b?c=a>=1e4?(1e-4*a).toFixed(2)+" ha":a.toFixed(2)+" m&sup2;":(a/=.836127,c=a>=3097600?(a/3097600).toFixed(2)+" mi&sup2;":a>=4840?(a/4840).toFixed(2)+" acres":Math.ceil(a)+" yd&sup2;"),c},readableDistance:function(a,b){var c;return b?c=a>1e3?(a/1e3).toFixed(2)+" km":Math.ceil(a)+" m":(a*=1.09361,c=a>1760?(a/1760).toFixed(2)+" miles":Math.ceil(a)+" yd"),c}}),L.Util.extend(L.LineUtil,{segmentsIntersect:function(a,b,c,d){return this._checkCounterclockwise(a,c,d)!==this._checkCounterclockwise(b,c,d)&&this._checkCounterclockwise(a,b,c)!==this._checkCounterclockwise(a,b,d)},_checkCounterclockwise:function(a,b,c){return(c.y-a.y)*(b.x-a.x)>(b.y-a.y)*(c.x-a.x)}}),L.Polyline.include({intersects:function(){var a,b,c,d=this._originalPoints,e=d?d.length:0;if(this._tooFewPointsForIntersection())return!1;for(a=e-1;a>=3;a--)if(b=d[a-1],c=d[a],this._lineSegmentsIntersectsRange(b,c,a-2))return!0;return!1},newLatLngIntersects:function(a,b){return!!this._map&&this.newPointIntersects(this._map.latLngToLayerPoint(a),b)},newPointIntersects:function(a,b){var c=this._originalPoints,d=c?c.length:0,e=c?c[d-1]:null,f=d-2;return!this._tooFewPointsForIntersection(1)&&this._lineSegmentsIntersectsRange(e,a,f,b?1:0)},_tooFewPointsForIntersection:function(a){var b=this._originalPoints,c=b?b.length:0;return c+=a||0,!this._originalPoints||c<=3},_lineSegmentsIntersectsRange:function(a,b,c,d){var e,f,g=this._originalPoints;d=d||0;for(var h=c;h>d;h--)if(e=g[h-1],f=g[h],L.LineUtil.segmentsIntersect(a,b,e,f))return!0;return!1}}),L.Polygon.include({intersects:function(){var a,b,c,d,e=this._originalPoints;return!this._tooFewPointsForIntersection()&&(!!L.Polyline.prototype.intersects.call(this)||(a=e.length,b=e[0],c=e[a-1],d=a-2,this._lineSegmentsIntersectsRange(c,b,d,1)))}}),L.Control.Draw=L.Control.extend({options:{position:"topleft",draw:{},edit:!1},initialize:function(a){if(L.version<"0.7")throw new Error("Leaflet.draw 0.2.3+ requires Leaflet 0.7.0+. Download latest from https://github.com/Leaflet/Leaflet/");L.Control.prototype.initialize.call(this,a);var b;this._toolbars={},L.DrawToolbar&&this.options.draw&&(b=new L.DrawToolbar(this.options.draw),this._toolbars[L.DrawToolbar.TYPE]=b,this._toolbars[L.DrawToolbar.TYPE].on("enable",this._toolbarEnabled,this)),L.EditToolbar&&this.options.edit&&(b=new L.EditToolbar(this.options.edit),this._toolbars[L.EditToolbar.TYPE]=b,this._toolbars[L.EditToolbar.TYPE].on("enable",this._toolbarEnabled,this))},onAdd:function(a){var b,c=L.DomUtil.create("div","leaflet-draw"),d=!1;for(var e in this._toolbars)this._toolbars.hasOwnProperty(e)&&(b=this._toolbars[e].addToolbar(a))&&(d||(L.DomUtil.hasClass(b,"leaflet-draw-toolbar-top")||L.DomUtil.addClass(b.childNodes[0],"leaflet-draw-toolbar-top"),d=!0),c.appendChild(b));return c},onRemove:function(){for(var a in this._toolbars)this._toolbars.hasOwnProperty(a)&&this._toolbars[a].removeToolbar()},setDrawingOptions:function(a){for(var b in this._toolbars)this._toolbars[b]instanceof L.DrawToolbar&&this._toolbars[b].setOptions(a)},_toolbarEnabled:function(a){var b=a.target;for(var c in this._toolbars)this._toolbars[c]!==b&&this._toolbars[c].disable()}}),L.Map.mergeOptions({drawControlTooltips:!0,drawControl:!1}),L.Map.addInitHook(function(){this.options.drawControl&&(this.drawControl=new L.Control.Draw,this.addControl(this.drawControl))}),L.Toolbar=L.Class.extend({includes:[L.Mixin.Events],initialize:function(a){L.setOptions(this,a),this._modes={},this._actionButtons=[],this._activeMode=null},enabled:function(){return null!==this._activeMode},disable:function(){this.enabled()&&this._activeMode.handler.disable()},addToolbar:function(a){var b,c=L.DomUtil.create("div","leaflet-draw-section"),d=0,e=this._toolbarClass||"",f=this.getModeHandlers(a);for(this._toolbarContainer=L.DomUtil.create("div","leaflet-draw-toolbar leaflet-bar"),this._map=a,b=0;b<f.length;b++)f[b].enabled&&this._initModeHandler(f[b].handler,this._toolbarContainer,d++,e,f[b].title);if(d)return this._lastButtonIndex=--d,this._actionsContainer=L.DomUtil.create("ul","leaflet-draw-actions"),c.appendChild(this._toolbarContainer),c.appendChild(this._actionsContainer),c},removeToolbar:function(){for(var a in this._modes)this._modes.hasOwnProperty(a)&&(this._disposeButton(this._modes[a].button,this._modes[a].handler.enable,this._modes[a].handler),this._modes[a].handler.disable(),this._modes[a].handler.off("enabled",this._handlerActivated,this).off("disabled",this._handlerDeactivated,this));this._modes={};for(var b=0,c=this._actionButtons.length;b<c;b++)this._disposeButton(this._actionButtons[b].button,this._actionButtons[b].callback,this);this._actionButtons=[],this._actionsContainer=null},_initModeHandler:function(a,b,c,d,e){var f=a.type;this._modes[f]={},this._modes[f].handler=a,this._modes[f].button=this._createButton({title:e,className:d+"-"+f,container:b,callback:this._modes[f].handler.enable,context:this._modes[f].handler}),this._modes[f].buttonIndex=c,this._modes[f].handler.on("enabled",this._handlerActivated,this).on("disabled",this._handlerDeactivated,this)},_createButton:function(a){var b=L.DomUtil.create("a",a.className||"",a.container);return b.href="#",a.text&&(b.innerHTML=a.text),a.title&&(b.title=a.title),L.DomEvent.on(b,"click",L.DomEvent.stopPropagation).on(b,"mousedown",L.DomEvent.stopPropagation).on(b,"dblclick",L.DomEvent.stopPropagation).on(b,"click",L.DomEvent.preventDefault).on(b,"click",a.callback,a.context),b},_disposeButton:function(a,b){L.DomEvent.off(a,"click",L.DomEvent.stopPropagation).off(a,"mousedown",L.DomEvent.stopPropagation).off(a,"dblclick",L.DomEvent.stopPropagation).off(a,"click",L.DomEvent.preventDefault).off(a,"click",b)},_handlerActivated:function(a){this.disable(),this._activeMode=this._modes[a.handler],L.DomUtil.addClass(this._activeMode.button,"leaflet-draw-toolbar-button-enabled"),this._showActionsToolbar(),this.fire("enable")},_handlerDeactivated:function(){this._hideActionsToolbar(),L.DomUtil.removeClass(this._activeMode.button,"leaflet-draw-toolbar-button-enabled"),this._activeMode=null,this.fire("disable")},_createActions:function(a){var b,c,d,e,f=this._actionsContainer,g=this.getActions(a),h=g.length;for(c=0,d=this._actionButtons.length;c<d;c++)this._disposeButton(this._actionButtons[c].button,this._actionButtons[c].callback);for(this._actionButtons=[];f.firstChild;)f.removeChild(f.firstChild);for(var i=0;i<h;i++)"enabled"in g[i]&&!g[i].enabled||(b=L.DomUtil.create("li","",f),e=this._createButton({title:g[i].title,text:g[i].text,container:b,callback:g[i].callback,context:g[i].context}),this._actionButtons.push({button:e,callback:g[i].callback}))},_showActionsToolbar:function(){var a=this._activeMode.buttonIndex,b=this._lastButtonIndex,c=this._activeMode.button.offsetTop-1;this._createActions(this._activeMode.handler),this._actionsContainer.style.top=c+"px",0===a&&(L.DomUtil.addClass(this._toolbarContainer,"leaflet-draw-toolbar-notop"),L.DomUtil.addClass(this._actionsContainer,"leaflet-draw-actions-top")),a===b&&(L.DomUtil.addClass(this._toolbarContainer,"leaflet-draw-toolbar-nobottom"),L.DomUtil.addClass(this._actionsContainer,"leaflet-draw-actions-bottom")),this._actionsContainer.style.display="block"},_hideActionsToolbar:function(){this._actionsContainer.style.display="none",L.DomUtil.removeClass(this._toolbarContainer,"leaflet-draw-toolbar-notop"),L.DomUtil.removeClass(this._toolbarContainer,"leaflet-draw-toolbar-nobottom"),L.DomUtil.removeClass(this._actionsContainer,"leaflet-draw-actions-top"),L.DomUtil.removeClass(this._actionsContainer,"leaflet-draw-actions-bottom")}}),L.Tooltip=L.Class.extend({initialize:function(a){this._map=a,this._popupPane=a._panes.popupPane,this._container=a.options.drawControlTooltips?L.DomUtil.create("div","leaflet-draw-tooltip",this._popupPane):null,this._singleLineLabel=!1},dispose:function(){this._container&&(this._popupPane.removeChild(this._container),this._container=null)},updateContent:function(a){return this._container?(a.subtext=a.subtext||"",0!==a.subtext.length||this._singleLineLabel?a.subtext.length>0&&this._singleLineLabel&&(L.DomUtil.removeClass(this._container,"leaflet-draw-tooltip-single"),this._singleLineLabel=!1):(L.DomUtil.addClass(this._container,"leaflet-draw-tooltip-single"),this._singleLineLabel=!0),this._container.innerHTML=(a.subtext.length>0?'<span class="leaflet-draw-tooltip-subtext">'+a.subtext+"</span><br />":"")+"<span>"+a.text+"</span>",this):this},updatePosition:function(a){var b=this._map.latLngToLayerPoint(a),c=this._container;return this._container&&(c.style.visibility="inherit",L.DomUtil.setPosition(c,b)),this},showAsError:function(){return this._container&&L.DomUtil.addClass(this._container,"leaflet-error-draw-tooltip"),this},removeError:function(){return this._container&&L.DomUtil.removeClass(this._container,"leaflet-error-draw-tooltip"),this}}),L.DrawToolbar=L.Toolbar.extend({statics:{TYPE:"draw"},options:{polyline:{},polygon:{},rectangle:{},circle:{},marker:{}},initialize:function(a){for(var b in this.options)this.options.hasOwnProperty(b)&&a[b]&&(a[b]=L.extend({},this.options[b],a[b]));this._toolbarClass="leaflet-draw-draw",L.Toolbar.prototype.initialize.call(this,a)},getModeHandlers:function(a){return[{enabled:this.options.polygon,handler:new L.Draw.Polygon(a,this.options.polygon),title:L.drawLocal.draw.toolbar.buttons.polygon}]},getActions:function(a){return[{enabled:a.deleteLastVertex,title:L.drawLocal.draw.toolbar.undo.title,text:L.drawLocal.draw.toolbar.undo.text,callback:a.deleteLastVertex,context:a},{title:L.drawLocal.draw.toolbar.actions.title,text:L.drawLocal.draw.toolbar.actions.text,callback:this.disable,context:this}]},setOptions:function(a){L.setOptions(this,a);for(var b in this._modes)this._modes.hasOwnProperty(b)&&a.hasOwnProperty(b)&&this._modes[b].handler.setOptions(a[b])}})}(window,document);var oLat=40.018,oLng=-75.148,zLevel=10,searchArea,queryValue,queryLayer,queryName,currTable,rec_query,table,centerLatLng,map,polygonDrawer,locationQuery=[],download_records=[],TCtable=[],legend_types={},months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],queryType="location",tableExists=!1,proximity_sort=!1,syncMapTable=!0,fitSearchArea=!1,win_height=$(window).height(),table_rows=Math.floor((win_height-282)/35),count_dictionary={Volume:{class:"ct-vol",rank:1},"15 Min Volume":{class:"ct-15min",rank:2},Speed:{class:"ct-speed",rank:3},Class:{class:"ct-class",rank:4},"Manual Class":{class:"ct-mclass",rank:5},"Turning Movement":{class:"ct-tm",rank:6},Loop:{class:"ct-loop",rank:7},"8 Day":{class:"ct-8day",rank:8},Crosswalk:{class:"ct-cwalk",rank:9}};$.ajax({url:"data/search_locations.json",dataType:"json",success:function(a){processData(a)}});var CartoDB_Positron=L.tileLayer("https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png",{attribution:'&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> &copy; <a href="http://cartodb.com/attributions">CartoDB</a>',subdomains:"abcd",maxZoom:19}),Mapbox_Imagery=L.tileLayer("https://api.mapbox.com/styles/v1/crvanpollard/cimpi6q3l00geahm71yhzxjek/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoiY3J2YW5wb2xsYXJkIiwiYSI6Ii00ZklVS28ifQ.Ht4KwAM3ZUjo1dT2Erskgg",{tileSize:512,zoomOffset:-1,attribution:'© <a href="https://www.mapbox.com/map-feedback/">Mapbox</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'}),records_download=L.geoJson(null,{pointToLayer:function(a,b){return L.circleMarker(b,{stroke:!0,weight:1,color:"#fff",radius:5,fillOpacity:.8,fillColor:getValue(a.properties.TYPE)})},onEachFeature:function(a,b){a.properties&&(b.bindLabel(processRoadname(a.properties),{direction:"auto",className:"leaflet-label"}),b.on({mouseover:function(a){this.setStyle({weight:3,radius:10,fillOpacity:1})},mouseout:function(a){this.setStyle({weight:1,radius:5,fillOpacity:.8})},click:function(a){TCtable.length>0&&(proximity_sort=!0,centerLatLng=this.getLatLng(),sortDataTable())}}))}}),TCresults=L.geoJson(null,{pointToLayer:function(a,b){return L.circleMarker(b,{stroke:!0,weight:1,color:"#fff",radius:5,fillOpacity:.7,fillColor:getValue(a.properties.TYPE)})},onEachFeature:function(a,b){a.properties&&(b.bindLabel(processRoadname(a.properties),{direction:"auto",className:"leaflet-label"}),b.on({mouseover:function(a){this.setStyle({weight:3,radius:10,fillOpacity:1})},mouseout:function(a){this.setStyle({weight:1,radius:5,fillOpacity:.8})},click:function(a){TCtable.length>0&&(proximity_sort=!0,centerLatLng=this.getLatLng(),sortDataTable())}}))}}),column_options=[{className:"select-record",orderable:!1,data:null,width:"1%",searchable:!1,render:function(a){return findWithAttr(download_records,"properties","RECORDNUM",a.recnum)>-1?'<i class="glyphicon glyphicon-check"></i>':'<i class="glyphicon glyphicon-unchecked"></i>'}},{data:"date",title:"Date",width:"10%",className:"table-date",searchable:!1},{data:"tableRoad",title:"Road",width:"46%",className:"max-char"},{data:"type",title:"Type",width:"20%",className:"table-type",searchable:!1},{data:"aadt",title:"AADT",width:"6%",type:"num-fmt-nan",searchable:!1},{data:"report",title:"DVRPC File #",width:"17%",className:"select-report"},{data:"unid",visible:!1,searchable:!1},{data:"recnum",title:"Record #",visible:!1,searchable:!1},{data:"latlng",visible:!1,searchable:!1},{data:"layer",visible:!1,searchable:!1}];jQuery.extend(jQuery.fn.dataTableExt.oSort,{"num-fmt-nan-asc":function(a,b){return a=parseInt(a.replace(/,/g,"")),b=parseInt(b.replace(/,/g,"")),isNaN(a)&&(a=0),isNaN(b)&&(b=0),a<b?-1:a>b?1:0},"num-fmt-nan-desc":function(a,b){return a=parseInt(a.replace(/,/g,"")),b=parseInt(b.replace(/,/g,"")),isNaN(a)&&(a=0),isNaN(b)&&(b=0),a<b?1:a>b?-1:0}}),table=$("#table").DataTable({data:null,columns:column_options,order:[[1,"desc"]],pageLength:table_rows,lengthChange:!1,dom:'<"results-toolbar">frtip',language:{search:"Filter table results",emptyTable:"No results found"},createdRow:function(a,b){null!=centerLatLng&&0===cartDist(b.latlng,centerLatLng)&&$(a).addClass("coincident")}}),tableExists=!0,$("#table thead th").removeClass("data-link"),$("div.results-toolbar").html('<button id="view-selected" type="button" class="download_all record-btns btn btn-primary btn-xs disabled">view selected</button><button type="button" class="download-records record-btns btn btn-primary btn-xs disabled" >download selected</button>'),$(document.body).on("click","#table tbody td.select-record",function(){var a=$(this).closest("tr"),b=table.row(a).data(),c=$(this).find("i");if(c.hasClass("glyphicon-check")){c.toggleClass("glyphicon-check glyphicon-unchecked");for(var d=b.recnum,e=0,f=download_records.length;e<f;e++)if(parseInt(download_records[e].properties.RECORDNUM)==d){download_records.splice(e,1);break}download_records.length||$(".record-btns").toggleClass("disabled")}else c.toggleClass("glyphicon-unchecked glyphicon-check"),download_records.push(map._layers[b.unid].feature),$("#view-selected").hasClass("disabled")&&$(".record-btns").toggleClass("disabled")}),$(document.body).on("click","#table tbody td",function(){if(5===table.cell(this).index().column){var a=table.cell(this).index().row,b=table.row(a).data();record_report(b.recnum,b.type)}}),$(document.body).on("mouseover","#table tbody td",function(){if(tableExists&&TCtable.length){var a=table.cell(this).index().row,b=table.row(a).data();map._layers[b.unid].setStyle({weigth:3,radius:10,fillOpacity:1})}}),$(document.body).on("mouseleave","#table tbody td",function(){if(tableExists&&TCtable.length){var a=table.cell(this).index().row,b=table.row(a).data();map._layers[b.unid].setStyle({weight:1,radius:5,fillOpacity:.8})}}),$(document).on("click",".dropdown-menu",function(a){$(this).hasClass("keep-open-on-click")&&a.stopPropagation()}),$("#dropdown-types").on("mouseleave",function(a){$("#count_types_dropdown").dropdown("toggle")}),$("#dropdown_years").on("mouseleave",function(a){$("#count_years_dropdown").dropdown("toggle")}),$(document).ready(function(){$('[data-tooltip="tooltip"]').tooltip({placement:"left"})}),$(document).on("click",".download-records",function(a){var b=1,c="",d='<a type="button" data-loading-text="Downloading..." class="download-request btn btn-primary btn-md" href="https://www.dvrpc.org/asp/trafficCount/download.aspx?recnum=';c+=d;for(var e=0,f=download_records.length;e<f;e++){var g=download_records[e].properties.RECORDNUM,h=e+1;h!==f&&h%50||!(h%51)?f%51||h!==f?h%51?c+=g+",":(c+=d+g+",",b=h):c+=d+g+'">Download Records ('+h+" - "+h+")</a><br/>":c+=g+'">Download Records ('+b+" - "+h+")</a><br/>",f>50&&$("#download-notice").html("<p>Your request exceeds our batch limit of 50 records per download. We have grouped your count requests into separate downloads.</p>")}$("#download-container").html(c),$("#download-modal").modal("show")}),$(document.body).on("click",".download-request",function(){$(this).button("loading").delay(3500).queue(function(){$(this).replaceWith('<div class="alert alert-success" role="alert">Download may take a few seconds to process.</div>')})}),$(document.body).on("click",".nav-item",function(){var a=$(this).attr("data-modal");return $("#"+a).modal("show"),!1}),$(document.body).on("click","#legend-icon",function(){"closed"===$(".map-legend").attr("data-status")?($(".map-legend").css("width","450px").css("height","auto").attr("data-status","open"),$("#legend-icon i").toggleClass("glyphicon glyphicon-list glyphicon glyphicon-minus"),$("#legend-icon .legend-label").hide(),$(".map-legend-items").show()):($(".map-legend").css("width","80px").css("height","32px").attr("data-status","closed"),$("#legend-icon i").toggleClass("glyphicon glyphicon-minus glyphicon glyphicon-list"),$("#legend-icon .legend-label").show(),$(".map-legend-items").hide())}),$("#updateSearchbtn").on("click",function(){updateSearchArea(searchArea,"filter"),$(".collapse.in").collapse("hide")}),$("#aoiSearch").on("click",function(){queryType="aoi",fadeLanding(queryType,queryLayer,queryValue),$("#aoi-draw").collapse("show"),$("#aoi-help").collapse("show")}),$("#count_num").on("click",function(){fadeLanding("recnumber")}),$("#filterBtn").on("click",function(){$(".collapse.in").collapse("hide")}),$("#count_types checkbox").on("click",function(){"checked"===$(this).attr("checked")?$(this).attr("data-render","false"):$(this).attr("data-render","true"),$(this).toggleClass("inactive")}),$("#searchBtn").on("click",function(){$(".collapse.in").collapse("hide")}),$("#doaSearch").on("click",function(){polygonDrawer.enable(),$(".collapse.in").collapse("hide"),$("#aoi-draw").collapse("show"),$("#aoi-help").collapse("show")}),$("#draw-cancel").on("click",function(){polygonDrawer.disable(),$("#aoi-draw").collapse("hide")}),$("#delete-last").on("click",function(){polygonDrawer.deleteLastVertex()}),$("#aoi-help").on("click",function(){$("#aoi-help").collapse("hide")}),$("#filter").on("hide.bs.collapse",function(a){$("#preFilter").text("Show")}),$("#filter").on("show.bs.collapse",function(a){$("#preFilter").text("Hide")}),$("#fit-search").on("click",function(a){map.fitBounds(searchArea)}),$('a[href^="#"]').on("click",function(a){var b=$(this.getAttribute("href"));b.length&&(a.preventDefault(),$("html, body").stop().animate({scrollTop:b.offset().bottom},1e3))}),$(document.body).on("click",".view-all",function(a){map_results()}),$(document.body).on("click",".download_all",function(){map_selected()}),$("#rec-num-submit").on("click",function(a){var b=$("#recnum-form"),c=$(b).find("#records").val();"tasty time"===c||"gusgus"===c||"goodbye brady"===c?partyTime(c):(rec_query=c.replace(/^(?:[\s+]|"[|-]")+/,"").replace(/(?:[\s+]|"[|-]")+$/,""),search_by_number()),$("#count-modal").modal("hide")}),$(document.body).on("click","#js-sc-close",function(){$("#party").remove()}),$(window).resize(function(){tableExists&&TCtable.length&&table.page.len(Math.max(1,Math.floor(getDynTableHeight()-20)/34-1)).draw()});var slider_min=1995,max=(new Date).getFullYear(),min=max-5,density=max-slider_min,yearSlider=document.getElementById("yearSlider");noUiSlider.create(yearSlider,{start:[min,max],connect:!0,step:1,behaviour:"tap-snap",range:{min:slider_min,max:max},pips:{mode:"steps",filter:filterdates,density:density}}),yearSlider.noUiSlider.on("update",function(a){$("#yearMin").text(Math.round(a[0])),$("#yearMax").text(Math.round(a[1])),min=Math.round(a[0]),max=Math.round(a[1])}),L.drawLocal.draw.toolbar.buttons.polygon="Draw a custom search area",function(){window.jQuery&&$(document).ready(function(){$("html").addClass("js"),$(".video-bg video").each(function(){$(this)[0].currentTime>0?$(this).addClass("is-playing"):$(this).on("playing",function(){$(this).addClass("is-playing")})}),(/iPad|iPhone|iPod/.test(navigator.platform)||/iPad|iPhone|iPod/.test(navigator.userAgent))&&$(".video-bg video").remove()})}();
  //# sourceMappingURL=map.min.js.map