diff --git a/dist/total-conversion-build.user.js b/dist/total-conversion-build.user.js index 1323830a..71ba49cd 100644 --- a/dist/total-conversion-build.user.js +++ b/dist/total-conversion-build.user.js @@ -12,7 +12,7 @@ // @match https://www.ingress.com/intel* // ==/UserScript== // REPLACE ORIG SITE /////////////////////////////////////////////////// -function wrapper(){function boot(){window.debug.console.overwriteNativeIfRequired(),console.log("loading done, booting. Built: 2013-03-11-111823"),window.deviceID&&console.log("Your device ID: "+window.deviceID),window.runOnSmartphonesBeforeBoot();var e="https://iitcserv.appspot.com/dist/images";L.Icon.Default.imagePath=e,window.iconEnl=L.Icon.Default.extend({options:{iconUrl:e+"/marker-green.png"}}),window.iconRes=L.Icon.Default.extend({options:{iconUrl:e+"/marker-blue.png"}}),window.setupTaphold(),window.setupStyles(),window.setupDialogs(),window.setupMap(),window.setupGeosearch(),window.setupRedeem(),window.setupLargeImagePreview(),window.setupSidebarToggle(),window.updateGameScore(),window.setupPlayerStat(),window.setupTooltips(),window.chat.setup(),window.setupQRLoadLib(),window.setupLayerChooserSelectOne(),window.setupBackButton(),urlPortal=getURLParam("pguid");var t=window.PLAYER.nickname;window.PLAYER.nickMatcher=new RegExp("\\b("+t+")\\b","ig"),$("#sidebar").show(),window.bootPlugins&&$.each(window.bootPlugins,function(e,t){t()}),$("#scrollwrapper").css("max-height",$("#sidebar").get(0).scrollHeight+3+"px"),window.runOnSmartphonesAfterBoot(),setTimeout("window.map.invalidateSize(false);",500),window.iitcLoaded=!0}function asyncLoadScript(e){return function(t,n){var r=document.createElement("script");r.type="text/javascript",r.src=e,r.onload=t,r.onerror=n,r.onreadystatechange=function(){var e=this.readyState;if(e==="loaded"||e==="complete")r.onreadystatechange=null,t()},head.insertBefore(r,head.firstChild)}}L_PREFER_CANVAS=!1,window.REFRESH=30,window.ZOOM_LEVEL_ADJ=5,window.REFRESH_GAME_SCORE=300,window.MAX_IDLE_TIME=4,window.PRECACHE_PLAYER_NAMES_ZOOM=17,window.HIDDEN_SCROLLBAR_ASSUMED_WIDTH=20,window.SIDEBAR_WIDTH=300,window.CHAT_MIN_RANGE=6,window.VIEWPORT_PAD_RATIO=.3,window.CHAT_PUBLIC_ITEMS=200,window.CHAT_FACTION_ITEMS=50,window.CHAT_REQUEST_SCROLL_TOP=200,window.CHAT_SHRINKED=60,window.MAX_DRAWN_PORTALS=1e3,window.MAX_DRAWN_LINKS=400,window.MAX_DRAWN_FIELDS=200,window.RESONATOR_DISPLAY_ZOOM_LEVEL=17,window.FIELD_MU_DISPLAY_AREA_ZOOM_RATIO=.001,window.FIELD_MU_DISPLAY_POINT_TOLERANCE=60,window.COLOR_SELECTED_PORTAL="#f00",window.COLORS=["#FFCE00","#0088FF","#03DC03"],window.COLORS_LVL=["#000","#FECE5A","#FFA630","#FF7315","#E40000","#FD2992","#EB26CD","#C124E0","#9627F4"],window.COLORS_MOD={VERY_RARE:"#F78AF6",RARE:"#AD8AFF",COMMON:"#84FBBD"},window.OPTIONS_RESONATOR_SELECTED={color:"#fff",weight:2,radius:4},window.OPTIONS_RESONATOR_NON_SELECTED={color:"#aaa",weight:1,radius:3},window.OPTIONS_RESONATOR_LINE_SELECTED={opacity:.7,weight:3},window.OPTIONS_RESONATOR_LINE_NON_SELECTED={opacity:.25,weight:2},window.ACCESS_INDICATOR_COLOR="orange",window.RANGE_INDICATOR_COLOR="red",window.PORTAL_RADIUS_ENLARGE_MOBILE=5,window.DEFAULT_PORTAL_IMG="https://commondatastorage.googleapis.com/ingress/img/default-portal-image.png",window.NOMINATIM="http://nominatim.openstreetmap.org/search?format=json&limit=1&q=",window.RESO_NRG=[0,1e3,1500,2e3,2500,3e3,4e3,5e3,6e3],window.MAX_XM_PER_LEVEL=[0,3e3,4e3,5e3,6e3,7e3,8e3,9e3,1e4],window.MIN_AP_FOR_LEVEL=[0,1e4,3e4,7e4,15e4,3e5,6e5,12e5],window.HACK_RANGE=40,window.OCTANTS=["E","NE","N","NW","W","SW","S","SE"],window.DESTROY_RESONATOR=75,window.DESTROY_LINK=187,window.DESTROY_FIELD=750,window.CAPTURE_PORTAL=500,window.DEPLOY_RESONATOR=125,window.COMPLETION_BONUS=250,window.UPGRADE_ANOTHERS_RESONATOR=65,window.MAX_PORTAL_LEVEL=8,window.MAX_RESO_PER_PLAYER=[0,8,4,4,4,2,2,1,1],window.TEAM_NONE=0,window.TEAM_RES=1,window.TEAM_ENL=2,window.TEAM_TO_CSS=["none","res","enl"],window.TYPE_UNKNOWN=0,window.TYPE_PORTAL=1,window.TYPE_LINK=2,window.TYPE_FIELD=3,window.TYPE_PLAYER=4,window.TYPE_CHAT=5,window.TYPE_RESONATOR=6,window.SLOT_TO_LAT=[0,Math.sqrt(2)/2,1,Math.sqrt(2)/2,0,-Math.sqrt(2)/2,-1,-Math.sqrt(2)/2],window.SLOT_TO_LNG=[1,Math.sqrt(2)/2,0,-Math.sqrt(2)/2,-1,-Math.sqrt(2)/2,0,Math.sqrt(2)/2],window.EARTH_RADIUS=6378137,window.DEG2RAD=Math.PI/180;var refreshTimeout,urlPortal=null;window.playersToResolve=[],window.playersInResolving=[],window.selectedPortal=null,window.portalRangeIndicator=null,window.portalAccessIndicator=null,window.mapRunsUserAction=!1;var portalsLayers,linksLayer,fieldsLayer;window.portals={},window.links={},window.fields={},window.resonators={},typeof window.plugin!="function"&&(window.plugin=function(){}),window._hooks={},window.VALID_HOOKS=["portalAdded","portalDetailsUpdated","publicChatDataAvailable","portalDataLoaded","beforePortalReRender","checkRenderLimit","requestFinished"],window.runHooks=function(e,t){if(VALID_HOOKS.indexOf(e)===-1)throw"Unknown event type: "+e;if(!_hooks[e])return;$.each(_hooks[e],function(e,n){n(t)})},window.addHook=function(e,t){if(VALID_HOOKS.indexOf(e)===-1)throw"Unknown event type: "+e;if(typeof t!="function")throw"Callback must be a function.";_hooks[e]?_hooks[e].push(t):_hooks[e]=[t]},window.requestData=function(){console.log("refreshing data"),requests.abort(),cleanUp();var e=convertCenterLat(map.getCenter().lat),t=calculateR(e),n=map.getBounds();topRight=convertLatLngToPoint(n.getNorthEast(),e,t),bottomLeft=convertLatLngToPoint(n.getSouthWest(),e,t),quadsX=Math.abs(bottomLeft.x-topRight.x),quadsY=Math.abs(bottomLeft.y-topRight.y),tiles={};for(var r=0;r<=quadsX;r++){var i=Math.abs(topRight.x-r),s=pointToQuadKey(i,topRight.y),o=convertPointToLatLng(i,topRight.y,e,t);tiles[s.slice(0,-1)]||(tiles[s.slice(0,-1)]=[]),tiles[s.slice(0,-1)].push(generateBoundsParams(s,o));for(var u=1;u<=quadsY;u++){var s=pointToQuadKey(i,topRight.y+u),o=convertPointToLatLng(i,topRight.y+u,e,t);tiles[s.slice(0,-1)]||(tiles[s.slice(0,-1)]=[]),tiles[s.slice(0,-1)].push(generateBoundsParams(s,o))}}portalRenderLimit.init(),$.each(tiles,function(e,t){data={minLevelOfDetail:-1},data.boundsParamsList=t,window.requests.add(window.postAjax("getThinnedEntitiesV2",data,window.handleDataResponse,window.handleFailedRequest))})},window.handleFailedRequest=function(){if(requests.isLastRequest("getThinnedEntitiesV2")){var e=portalRenderLimit.mergeLowLevelPortals(null);handlePortalsRender(e)}runHooks("requestFinished",{success:!1})},window.handleDataResponse=function(e,t,n){if(!e||!e.result){window.failedRequestCount++,console.warn(e),handleFailedRequest();return}var r=e.result.map,i=[],s={};$.each(r,function(e,t){$.each(t.deletedGameEntityGuids||[],function(e,t){getTypeByGuid(t)===TYPE_FIELD&&window.fields[t]!==undefined&&$.each(window.fields[t].options.vertices,function(e,n){if(window.portals[n.guid]===undefined)return!0;fieldArray=window.portals[n.guid].options.details.portalV2.linkedFields,fieldArray.splice($.inArray(t,fieldArray),1)}),window.removeByGuid(t)}),$.each(t.gameEntities||[],function(e,t){if(t[2].turret!==undefined){var n=[t[2].locationE6.latE6/1e6,t[2].locationE6.lngE6/1e6];if(!window.getPaddedBounds().contains(n)&&selectedPortal!==t[0]&&urlPortal!==t[0])return;i.push(t)}else if(t[2].edge!==undefined)renderLink(t);else{if(t[2].capturedRegion===undefined)throw"Unknown entity: "+JSON.stringify(t);$.each(t[2].capturedRegion,function(e,n){s[n.guid]===undefined&&(s[n.guid]=new Array),s[n.guid].push(t[0])}),renderField(t)}})}),$.each(i,function(e,t){t[2].portalV2.linkedFields===undefined&&(t[2].portalV2.linkedFields=[]),s[t[0]]!==undefined&&($.merge(s[t[0]],t[2].portalV2.linkedFields),t[2].portalV2.linkedFields=uniqueArray(s[t[0]]))});var o=portalRenderLimit.splitOrMergeLowLevelPortals(i);handlePortalsRender(o),resolvePlayerNames(),renderUpdateStatus(),runHooks("requestFinished",{success:!0})},window.handlePortalsRender=function(e){var t=!1,n=selectedPortal;runHooks("portalDataLoaded",{portals:e}),$.each(e,function(e,n){urlPortal&&n[0]===urlPortal&&(t=!0),renderPortal(n)});var r=e[n];if(r){selectedPortal=n,renderPortalDetails(selectedPortal);try{r.bringToFront()}catch(i){}}t&&(renderPortalDetails(urlPortal),urlPortal=null)},window.cleanUp=function(){var e=[0,0,0],t=getPaddedBounds(),n=getMinPortalLevel();for(var r=0;r=n)return!0;e[0]++,portalsLayers[r].removeLayer(s)});linksLayer.eachLayer(function(n){if(t.intersects(n.getBounds()))return;e[1]++,linksLayer.removeLayer(n)}),fieldsLayer.eachLayer(function(n){n.eachLayer(function(r){if(!r.options.guid)return!0;if(t.intersects(r.getBounds()))return;e[2]++,fieldsLayer.removeLayer(n)})}),console.log("removed out-of-bounds: "+e[0]+" portals, "+e[1]+" links, "+e[2]+" fields")},window.removeByGuid=function(e){switch(getTypeByGuid(e)){case TYPE_PORTAL:if(!window.portals[e])return;var t=window.portals[e];for(var n=0;n=MAX_DRAWN_PORTALS&&e[0]!==selectedPortal)return removeByGuid(e[0]);var t=getPortalLevel(e[2]);if(t=RESONATOR_DISPLAY_ZOOM_LEVEL},window.isSameResonator=function(e,t){return!e&&!t?!0:!e||!t?!1:typeof e!=typeof t?!1:e.level!==t.level?!1:e.energyTotal!==t.energyTotal?!1:e.distanceToPortal!==t.distanceToPortal?!1:!0},window.portalResetColor=function(e){e.setStyle({color:COLORS[getTeam(e.options.details)]}),resonatorsResetStyle(e.options.guid)},window.resonatorsResetStyle=function(e){window.resonatorsSetStyle(e,OPTIONS_RESONATOR_NON_SELECTED,OPTIONS_RESONATOR_LINE_NON_SELECTED)},window.resonatorsSetSelectStyle=function(e){window.resonatorsSetStyle(e,OPTIONS_RESONATOR_SELECTED,OPTIONS_RESONATOR_LINE_SELECTED)},window.resonatorsSetStyle=function(e,t,n){for(var r=0;r<8;r++){resonatorLayerGroup=resonators[portalResonatorGuid(e,r)];if(!resonatorLayerGroup)continue;resonatorLayerGroup.eachLayer(function(e){e.options.guid||e.bringToFront().setStyle(n)}),resonatorLayerGroup.eachLayer(function(e){e.options.guid&&e.bringToFront().setStyle(t)})}portals[e].bringToFront()},window.renderLink=function(e){if(Object.keys(links).length>=MAX_DRAWN_LINKS)return removeByGuid(e[0]);if(findEntityInLeaflet(linksLayer,links,e[0]))return;var t=getTeam(e[2]),n=e[2].edge,r=[[n.originPortalLocation.latE6/1e6,n.originPortalLocation.lngE6/1e6],[n.destinationPortalLocation.latE6/1e6,n.destinationPortalLocation.lngE6/1e6]],i=L.polyline(r,{color:COLORS[t],opacity:1,weight:2,clickable:!1,guid:e[0],data:e[2],smoothFactor:0});i._map=window.map,i.projectLatlngs();var s=i._originalPoints,o=Math.abs(s[0].x-s[1].x)+Math.abs(s[0].y-s[1].y);if(o<=10)return;if(!getPaddedBounds().intersects(i.getBounds()))return;i.on("remove",function(){delete window.links[this.options.guid]}),i.on("add",function(){if(window.links[this.options.guid])throw"duplicate link detected";window.links[this.options.guid]=this,this.bringToBack()}),i.addTo(linksLayer)},window.renderField=function(e){if(Object.keys(fields).length>=MAX_DRAWN_FIELDS)return window.removeByGuid(e[0]);var t=findEntityInLeaflet(fieldsLayer,window.fields,e[0]);if(t&&map.getZoom()===t.options.creationZoom)return;var n=getTeam(e[2]),r=e[2].capturedRegion,i=[L.latLng(r.vertexA.location.latE6/1e6,r.vertexA.location.lngE6/1e6),L.latLng(r.vertexB.location.latE6/1e6,r.vertexB.location.lngE6/1e6),L.latLng(r.vertexC.location.latE6/1e6,r.vertexC.location.lngE6/1e6)],s=L.polygon(i,{fillColor:COLORS[n],fillOpacity:.25,stroke:!1,clickable:!1,smoothFactor:0,guid:e[0]});s._map=window.map,s.projectLatlngs();var o=L.LineUtil.simplify(s._originalPoints,6).length;if(o<=2)return;if(!getPaddedBounds().intersects(s.getBounds()))return;var u=calcTriArea(i)/Math.exp(14.2714860198866-1.384987247*map.getZoom()),a=L.LineUtil.simplify(s._originalPoints,FIELD_MU_DISPLAY_POINT_TOLERANCE).length;if(t){var f=0;t.eachLayer(function(e){f++});if(u>FIELD_MU_DISPLAY_AREA_ZOOM_RATIO&&a>2&&f===2)return;if(u<=FIELD_MU_DISPLAY_AREA_ZOOM_RATIO&&a<=2&&f===1)return;removeByGuid(e[0])}if(u>FIELD_MU_DISPLAY_AREA_ZOOM_RATIO&&a>2)var l=[(i[0].lat+i[1].lat+i[2].lat)/3,(i[0].lng+i[1].lng+i[2].lng)/3],c=L.marker(l,{icon:L.divIcon({className:"fieldmu",iconSize:[70,12],html:digits(e[2].entityScore.entityScore)}),clickable:!1}),h=L.layerGroup([s,c]);else var h=L.layerGroup([s]);h.options={vertices:r,lastUpdate:e[1],creationZoom:map.getZoom(),guid:e[0],data:e[2]},s.on("remove",function(){delete window.fields[this.options.guid]}),s.on("add",function(){window.fields[this.options.guid]&&console.warn("duplicate field detected"),window.fields[this.options.guid]=h,this.bringToBack()}),h.addTo(fieldsLayer)},window.findEntityInLeaflet=function(e,t,n){if(map.hasLayer(e))return t[n]||null;var r=null;return e.eachLayer(function(e){return e.options.guid!==n?!0:(r=e,!1)}),r},window.activeRequests=[],window.failedRequestCount=0,window.requests=function(){},window.requests.add=function(e){window.activeRequests.push(e),renderUpdateStatus()},window.requests.remove=function(e){window.activeRequests.splice(window.activeRequests.indexOf(e),1),renderUpdateStatus()},window.requests.abort=function(){$.each(window.activeRequests,function(e,t){t&&t.abort()}),window.activeRequests=[],window.failedRequestCount=0,window.chat._requestPublicRunning=!1,window.chat._requestFactionRunning=!1,renderUpdateStatus()},window.renderUpdateStatus=function(){var e="map status: ";mapRunsUserAction?e+="paused during interaction":isIdle()?e+='Idle, not updating.':window.activeRequests.length>0?e+=window.activeRequests.length+" requests running.":e+="Up to date.",renderLimitReached()&&(e+=' RENDER LIMIT '),window.failedRequestCount>0&&(e+=' '+window.failedRequestCount+" failed."),e+="
(";var t=getMinPortalLevel();t===0?e+="loading all portals":e+="only loading portals with level "+t+" and up",e+=")";var n=$(".leaflet-control-layers-overlays label");n.slice(0,t+1).addClass("disabled").attr("title","Zoom in to show those."),n.slice(t,8).removeClass("disabled").attr("title",""),$("#updatestatus").html(e)},window.startRefreshTimeout=function(e){window.renderUpdateStatus(),refreshTimeout&&clearTimeout(refreshTimeout);var t=0;if(e)t=e;else{t=REFRESH*1e3;var n=ZOOM_LEVEL_ADJ*(18-window.map.getZoom());n>0&&(t+=n*1e3)}var r=(new Date((new Date).getTime()+t)).toLocaleTimeString();console.log("planned refresh: "+r),refreshTimeout=setTimeout(window.requests._callOnRefreshFunctions,t)},window.requests._onRefreshFunctions=[],window.requests._callOnRefreshFunctions=function(){startRefreshTimeout();if(isIdle()){console.log("user has been idle for "+idleTime+" minutes. Skipping refresh."),renderUpdateStatus();return}console.log("refreshing"),$.each(window.requests._onRefreshFunctions,function(e,t){t()})},window.requests.addRefreshFunction=function(e){window.requests._onRefreshFunctions.push(e)},window.requests.isLastRequest=function(e){var t=!0;return $.each(window.activeRequests,function(n,r){if(r.action===e)return t=!1,!1}),t},window.layerGroupLength=function(e){var t=0,n=e._layers;return n&&(t=Object.keys(n).length),t},window.getURLParam=function(e){var t=document.URL,n=t.indexOf(e);return n<=-1?"":(t=t.substr(n),n=t.indexOf("&"),n>=0&&(t=t.substr(0,n)),t.replace(e+"=",""))};var cookies;window.readCookie=function(e,t,n,r){if(cookies)return cookies[e];t=document.cookie.split("; "),cookies={};for(r=t.length-1;r>=0;r--)n=t[r].split("="),cookies[n[0]]=unescape(n[1]);return cookies[e]},window.writeCookie=function(e,t){document.cookie=e+"="+t+"; expires=Thu, 31 Dec 2020 23:59:59 GMT; path=/"},window.digits=function(e){return(e+"").replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1 ")},window.postAjax=function(e,t,n,r){t=JSON.stringify($.extend({method:"dashboard."+e},t));var i=function(e,t,n){window.requests.remove(n)},s=function(e){window.failedRequestCount++,window.requests.remove(e)},o=$.ajax({url:"https://www.ingress.com/rpc/dashboard."+e,type:"POST",data:t,dataType:"json",success:[i,n],error:r?[s,r]:s,contentType:"application/json; charset=utf-8",beforeSend:function(e){e.setRequestHeader("X-CSRFToken",readCookie("csrftoken"))}});return o.action=e,o},window.unixTimeToString=function(e,t){if(!e)return null;var n=new Date(typeof e=="string"?parseInt(e):e),e=n.toLocaleTimeString(),r=n.getFullYear()+"-"+(n.getMonth()+1)+"-"+n.getDate();return typeof t!="undefined"&&t?r+" "+e:n.toDateString()==(new Date).toDateString()?e:r},window.unixTimeToHHmm=function(e){if(!e)return null;var t=new Date(typeof e=="string"?parseInt(e):e),n=""+t.getHours();n=n.length===1?"0"+n:n;var r=""+t.getMinutes();return r=r.length===1?"0"+r:r,n+":"+r},window.rangeLinkClick=function(){window.portalRangeIndicator&&window.map.fitBounds(window.portalRangeIndicator.getBounds()),window.isSmartphone&&window.smartphone.mapButton.click()},window.showPortalPosLinks=function(e,t){var n='
',r="",i='gmaps',s='OSM';alert('
'+n+r+i+" "+s+"
")},window.reportPortalIssue=function(e){var t="Redirecting you to a Google Help Page.\n\nThe text box contains all necessary information. Press CTRL+C to copy it.",n=window.portals[window.selectedPortal].options.details,e="Your Nick: "+PLAYER.nickname+" "+"Portal: "+n.portalV2.descriptiveText.TITLE+" "+"Location: "+n.portalV2.descriptiveText.ADDRESS+" (lat "+n.locationE6.latE6/1e6+"; lng "+n.locationE6.lngE6/1e6+")";prompt(t,e)!==null&&(location.href="https://support.google.com/ingress?hl=en&contact=1")},window._storedPaddedBounds=undefined,window.getPaddedBounds=function(){_storedPaddedBounds===undefined&&map.on("zoomstart zoomend movestart moveend",function(){window._storedPaddedBounds=null});if(renderLimitReached(.7))return window.map.getBounds();if(window._storedPaddedBounds)return window._storedPaddedBounds;var e=window.map.getBounds().pad(VIEWPORT_PAD_RATIO);return window._storedPaddedBounds=e,e},window.renderLimitReached=function(e){e=e||1;if(Object.keys(portals).length*e>=MAX_DRAWN_PORTALS)return!0;if(Object.keys(links).length*e>=MAX_DRAWN_LINKS)return!0;if(Object.keys(fields).length*e>=MAX_DRAWN_FIELDS)return!0;var t={reached:!1};return window.runHooks("checkRenderLimit",t),t.reached},window.getMinPortalLevel=function(){var e=map.getZoom();if(e>=16)return 0;var t=["impossible",8,7,7,6,6,5,5,4,4,3,3,2,2,1,1],n=portalRenderLimit.getMinLevel(),r=n>t[e]?n:t[e];return r},window.scrollBottom=function(e){typeof e=="string"&&(e=$(e));try{return e.get(0).scrollHeight-e.innerHeight()-e.scrollTop()}catch(t){return console.warn("elmget undefined error"),debug.printStackTrace(),0}},window.zoomToAndShowPortal=function(e,t){map.setView(t,17),window.portals[e]?renderPortalDetails(e):urlPortal=e},window.getTypeByGuid=function(e){switch(e.slice(33)){case"11":case"12":return TYPE_PORTAL;case"9":return TYPE_LINK;case"b":return TYPE_FIELD;case"c":return TYPE_PLAYER;case"d":return TYPE_CHAT;default:if(e.slice(-11,-2)=="resonator")return TYPE_RESONATOR;return TYPE_UNKNOWN}},String.prototype.capitalize=function(){return this.charAt(0).toUpperCase()+this.slice(1).toLowerCase()},typeof String.prototype.startsWith!="function"&&(String.prototype.startsWith=function(e){return this.slice(0,e.length)===e}),window.prettyEnergy=function(e){return e>1e3?Math.round(e/1e3)+" k":e},window.setPermaLink=function(e){var t=map.getCenter(),n=Math.round(t.lat*1e6),r=Math.round(t.lng*1e6),i="latE6="+n+"&lngE6="+r+"&z="+(map.getZoom()-1);$(e).attr("href","https://www.ingress.com/intel?"+i)},window.uniqueArray=function(e){return $.grep(e,function(t,n){return $.inArray(t,e)===n})},window.genFourColumnTable=function(e){var t=$.map(e,function(e,t){return e?t%2===0?""+e[1]+""+e[0]+"":" "+e[0]+""+e[1]+"":""}).join("");return t.length%2===1&&t+"",t},window.convertTextToTableMagic=function(e){if(!e.match(/\t/))return e.replace(/\n/g,"
");var t=[],n=0,r=e.split("\n");$.each(r,function(e,r){t[e]=r.split(" "),t[e].length>n&&(n=t[e].length)});var i="";return $.each(t,function(e,r){i+="",$.each(t[e],function(r,s){var o="";r===0&&t[e].length"+s+""}),i+=""}),i+="
",i},window.calcTriArea=function(e){return Math.abs((e[0].lat*(e[1].lng-e[2].lng)+e[1].lat*(e[2].lng-e[0].lng)+e[2].lat*(e[0].lng-e[1].lng))/2)},window.setupBackButton=function(){var e=window.isSmartphone()?window.smartphone.mapButton:$("#chatcontrols a.active");window.setupBackButton._actions=[e.get(0)],$("#chatcontrols a").click(function(){if($(this).hasClass("toggle"))return;window.setupBackButton._actions.push(this),window.setupBackButton._actions=window.setupBackButton._actions.slice(-2)}),window.goBack=function(){var e=window.setupBackButton._actions[0];if(!e)return;$(e).click(),window.setupBackButton._actions=[e]}},window.setupLargeImagePreview=function(){$("#portaldetails").on("click",".imgpreview",function(){var e=$("#largepreview");if(e.length>0){e.remove();return}var t=$(this).find("img")[0],n=t.naturalWidth/2,r=t.naturalHeight/2,i=$("#portaldetails").attr("class");$("body").append('
'+t.outerHTML+"
"),$("#largepreview").click(function(){$(this).remove()})})},window.setupLayerChooserSelectOne=function(){$(".leaflet-control-layers-overlays").on("click taphold","label",function(e){if(!e)return;if(!(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.type==="taphold"))return;var t=window.map,n=function(e){t.hasLayer(e.layer)||t.addLayer(e.layer)},r=function(e){t.hasLayer(e.layer)&&t.removeLayer(e.layer)},i=$(e.target).find("input").is(":checked"),s=$(".leaflet-control-layers-overlays input:checked").length;if(i&&s===1||s===0)$.each(window.layerChooser._layers,function(e,t){if(!t.overlay)return!0;n(t)});else{var o=$.trim($(e.target).text());$.each(window.layerChooser._layers,function(e,t){if(t.overlay!==!0)return!0;if(t.name===o)return n(t),!0;r(t)})}e.preventDefault()})},window.setupStyles=function(){$("head").append("")},window.setupMap=function(){$("#map").text("");var e={attribution:"Map data © OpenStreetMap contributors",maxZoom:18,detectRetina:!0},t=new L.TileLayer("http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",e),n={attribution:"Map data © OpenStreetMap contributors, Imagery © CloudMade",maxZoom:18,detectRetina:!0},r=new L.TileLayer("http://{s}.tile.cloudmade.com/654cef5fd49a432ab81267e200ecc502/22677/256/{z}/{x}/{y}.png",n),i=new L.TileLayer("http://{s}.tile.cloudmade.com/654cef5fd49a432ab81267e200ecc502/999/256/{z}/{x}/{y}.png",n),s=[i,r,t,new L.Google("INGRESS"),new L.Google("ROADMAP"),new L.Google("SATELLITE"),new L.Google("HYBRID")];window.map=new L.Map("map",$.extend(getPosition(),{zoomControl:localStorage["iitc.zoom.buttons"]!=="false"}));var o={};portalsLayers=[];for(var u=0;u<=8;u++){portalsLayers[u]=L.layerGroup([]),map.addLayer(portalsLayers[u]);var a=(u===0?"Unclaimed":"Level "+u)+" Portals";o[a]=portalsLayers[u]}fieldsLayer=L.layerGroup([]),map.addLayer(fieldsLayer,!0),o.Fields=fieldsLayer,linksLayer=L.layerGroup([]),map.addLayer(linksLayer,!0),o.Links=linksLayer,window.layerChooser=new L.Control.Layers({"OSM Midnight":s[0],"OSM Minimal":s[1],"OSM Mapnik":s[2],"Default Ingress Map":s[3],"Google Roads":s[4],"Google Satellite":s[5],"Google Hybrid":s[6]},o),map.addControl(window.layerChooser);try{map.addLayer(s[readCookie("ingress.intelmap.type")])}catch(f){map.addLayer(s[0])}map.attributionControl.setPrefix(""),map.on("moveend",window.storeMapPosition),map.on("zoomend",function(){window.storeMapPosition();if(isResonatorsShow())return;for(var e=1;e'+e+" "+'
'+''+PLAYER.nickname+""+'sign out'+"
"+'
'+"XM: "+u+"%"+""+(e<8?"level: "+s+"%":"max level")+""+"
"+""),$("#name").mouseenter(function(){$("#signout").show()}).mouseleave(function(){$("#signout").hide()})},window.setupSidebarToggle=function(){$("#sidebartoggle").on("click",function(){var e=$("#sidebartoggle"),t=$("#scrollwrapper");t.is(":visible")?(t.hide().css("z-index",1),$(".leaflet-right").css("margin-right","0"),e.html(''),e.css("right","0")):(t.css("z-index",1001).show(),$(".leaflet-right").css("margin-right",SIDEBAR_WIDTH+1+"px"),e.html(''),e.css("right",SIDEBAR_WIDTH+1+"px"))})},window.setupTooltips=function(e){e=e||$(document),e.tooltip({show:{effect:"hide",duration:0},hide:!1,open:function(e,t){t.tooltip.delay(300).fadeIn(0)},content:function(){var e=$(this).attr("title");return window.convertTextToTableMagic(e)}}),window.tooltipClearerHasBeenSetup||(window.tooltipClearerHasBeenSetup=!0,$(document).on("click",".ui-tooltip",function(){$(this).remove()}))},window.setupDialogs=function(){$("#dialog").dialog({autoOpen:!1,modal:!0,buttons:[{text:"OK",click:function(){$(this).dialog("close")}}]}),window.alert=function(e,t){var n=t?e:window.convertTextToTableMagic(e);$("#dialog").html(n).dialog("open")}},window.setupTaphold=function(){(function(e){function t(e){var t=jQuery(this);if(typeof t.data("events")!="undefined"&&typeof t.data("events").click!="undefined"){for(var n in t.data("events").click)if(t.data("events").click[n].namespace==""){var r=t.data("events").click[n].handler;t.data("taphold_click_handler",r),t.unbind("click",r);break}}else typeof e.data!="undefined"&&e.data!=null&&typeof e.data.clickHandler=="function"&&t.data("taphold_click_handler",e.data.clickHandler);t.data("taphold_triggered",!1),t.data("taphold_clicked",!1),t.data("taphold_cancelled",!1),t.data("taphold_timer",setTimeout(function(){!t.data("taphold_cancelled")&&!t.data("taphold_clicked")&&(t.trigger(jQuery.extend(e,jQuery.Event +function wrapper(){function boot(){window.debug.console.overwriteNativeIfRequired(),console.log("loading done, booting. Built: 2013-03-11-111823"),window.deviceID&&console.log("Your device ID: "+window.deviceID),window.runOnSmartphonesBeforeBoot();var e="http://breunigs.github.com/ingress-intel-total-conversion/dist/images";L.Icon.Default.imagePath=e,window.iconEnl=L.Icon.Default.extend({options:{iconUrl:e+"/marker-green.png"}}),window.iconRes=L.Icon.Default.extend({options:{iconUrl:e+"/marker-blue.png"}}),window.setupTaphold(),window.setupStyles(),window.setupDialogs(),window.setupMap(),window.setupGeosearch(),window.setupRedeem(),window.setupLargeImagePreview(),window.setupSidebarToggle(),window.updateGameScore(),window.setupPlayerStat(),window.setupTooltips(),window.chat.setup(),window.setupQRLoadLib(),window.setupLayerChooserSelectOne(),window.setupBackButton(),urlPortal=getURLParam("pguid");var t=window.PLAYER.nickname;window.PLAYER.nickMatcher=new RegExp("\\b("+t+")\\b","ig"),$("#sidebar").show(),window.bootPlugins&&$.each(window.bootPlugins,function(e,t){t()}),$("#scrollwrapper").css("max-height",$("#sidebar").get(0).scrollHeight+3+"px"),window.runOnSmartphonesAfterBoot(),setTimeout("window.map.invalidateSize(false);",500),window.iitcLoaded=!0}function asyncLoadScript(e){return function(t,n){var r=document.createElement("script");r.type="text/javascript",r.src=e,r.onload=t,r.onerror=n,r.onreadystatechange=function(){var e=this.readyState;if(e==="loaded"||e==="complete")r.onreadystatechange=null,t()},head.insertBefore(r,head.firstChild)}}L_PREFER_CANVAS=!1,window.REFRESH=30,window.ZOOM_LEVEL_ADJ=5,window.REFRESH_GAME_SCORE=300,window.MAX_IDLE_TIME=4,window.PRECACHE_PLAYER_NAMES_ZOOM=17,window.HIDDEN_SCROLLBAR_ASSUMED_WIDTH=20,window.SIDEBAR_WIDTH=300,window.CHAT_MIN_RANGE=6,window.VIEWPORT_PAD_RATIO=.3,window.CHAT_PUBLIC_ITEMS=200,window.CHAT_FACTION_ITEMS=50,window.CHAT_REQUEST_SCROLL_TOP=200,window.CHAT_SHRINKED=60,window.MAX_DRAWN_PORTALS=1e3,window.MAX_DRAWN_LINKS=400,window.MAX_DRAWN_FIELDS=200,window.RESONATOR_DISPLAY_ZOOM_LEVEL=17,window.FIELD_MU_DISPLAY_AREA_ZOOM_RATIO=.001,window.FIELD_MU_DISPLAY_POINT_TOLERANCE=60,window.COLOR_SELECTED_PORTAL="#f00",window.COLORS=["#FFCE00","#0088FF","#03DC03"],window.COLORS_LVL=["#000","#FECE5A","#FFA630","#FF7315","#E40000","#FD2992","#EB26CD","#C124E0","#9627F4"],window.COLORS_MOD={VERY_RARE:"#F78AF6",RARE:"#AD8AFF",COMMON:"#84FBBD"},window.OPTIONS_RESONATOR_SELECTED={color:"#fff",weight:2,radius:4},window.OPTIONS_RESONATOR_NON_SELECTED={color:"#aaa",weight:1,radius:3},window.OPTIONS_RESONATOR_LINE_SELECTED={opacity:.7,weight:3},window.OPTIONS_RESONATOR_LINE_NON_SELECTED={opacity:.25,weight:2},window.ACCESS_INDICATOR_COLOR="orange",window.RANGE_INDICATOR_COLOR="red",window.PORTAL_RADIUS_ENLARGE_MOBILE=5,window.DEFAULT_PORTAL_IMG="https://commondatastorage.googleapis.com/ingress/img/default-portal-image.png",window.NOMINATIM="http://nominatim.openstreetmap.org/search?format=json&limit=1&q=",window.RESO_NRG=[0,1e3,1500,2e3,2500,3e3,4e3,5e3,6e3],window.MAX_XM_PER_LEVEL=[0,3e3,4e3,5e3,6e3,7e3,8e3,9e3,1e4],window.MIN_AP_FOR_LEVEL=[0,1e4,3e4,7e4,15e4,3e5,6e5,12e5],window.HACK_RANGE=40,window.OCTANTS=["E","NE","N","NW","W","SW","S","SE"],window.DESTROY_RESONATOR=75,window.DESTROY_LINK=187,window.DESTROY_FIELD=750,window.CAPTURE_PORTAL=500,window.DEPLOY_RESONATOR=125,window.COMPLETION_BONUS=250,window.UPGRADE_ANOTHERS_RESONATOR=65,window.MAX_PORTAL_LEVEL=8,window.MAX_RESO_PER_PLAYER=[0,8,4,4,4,2,2,1,1],window.TEAM_NONE=0,window.TEAM_RES=1,window.TEAM_ENL=2,window.TEAM_TO_CSS=["none","res","enl"],window.TYPE_UNKNOWN=0,window.TYPE_PORTAL=1,window.TYPE_LINK=2,window.TYPE_FIELD=3,window.TYPE_PLAYER=4,window.TYPE_CHAT=5,window.TYPE_RESONATOR=6,window.SLOT_TO_LAT=[0,Math.sqrt(2)/2,1,Math.sqrt(2)/2,0,-Math.sqrt(2)/2,-1,-Math.sqrt(2)/2],window.SLOT_TO_LNG=[1,Math.sqrt(2)/2,0,-Math.sqrt(2)/2,-1,-Math.sqrt(2)/2,0,Math.sqrt(2)/2],window.EARTH_RADIUS=6378137,window.DEG2RAD=Math.PI/180;var refreshTimeout,urlPortal=null;window.playersToResolve=[],window.playersInResolving=[],window.selectedPortal=null,window.portalRangeIndicator=null,window.portalAccessIndicator=null,window.mapRunsUserAction=!1;var portalsLayers,linksLayer,fieldsLayer;window.portals={},window.links={},window.fields={},window.resonators={},typeof window.plugin!="function"&&(window.plugin=function(){}),window._hooks={},window.VALID_HOOKS=["portalAdded","portalDetailsUpdated","publicChatDataAvailable","portalDataLoaded","beforePortalReRender","checkRenderLimit","requestFinished"],window.runHooks=function(e,t){if(VALID_HOOKS.indexOf(e)===-1)throw"Unknown event type: "+e;if(!_hooks[e])return;$.each(_hooks[e],function(e,n){n(t)})},window.addHook=function(e,t){if(VALID_HOOKS.indexOf(e)===-1)throw"Unknown event type: "+e;if(typeof t!="function")throw"Callback must be a function.";_hooks[e]?_hooks[e].push(t):_hooks[e]=[t]},window.requestData=function(){console.log("refreshing data"),requests.abort(),cleanUp();var e=convertCenterLat(map.getCenter().lat),t=calculateR(e),n=map.getBounds();topRight=convertLatLngToPoint(n.getNorthEast(),e,t),bottomLeft=convertLatLngToPoint(n.getSouthWest(),e,t),quadsX=Math.abs(bottomLeft.x-topRight.x),quadsY=Math.abs(bottomLeft.y-topRight.y),tiles={};for(var r=0;r<=quadsX;r++){var i=Math.abs(topRight.x-r),s=pointToQuadKey(i,topRight.y),o=convertPointToLatLng(i,topRight.y,e,t);tiles[s.slice(0,-1)]||(tiles[s.slice(0,-1)]=[]),tiles[s.slice(0,-1)].push(generateBoundsParams(s,o));for(var u=1;u<=quadsY;u++){var s=pointToQuadKey(i,topRight.y+u),o=convertPointToLatLng(i,topRight.y+u,e,t);tiles[s.slice(0,-1)]||(tiles[s.slice(0,-1)]=[]),tiles[s.slice(0,-1)].push(generateBoundsParams(s,o))}}portalRenderLimit.init(),$.each(tiles,function(e,t){data={minLevelOfDetail:-1},data.boundsParamsList=t,window.requests.add(window.postAjax("getThinnedEntitiesV2",data,window.handleDataResponse,window.handleFailedRequest))})},window.handleFailedRequest=function(){if(requests.isLastRequest("getThinnedEntitiesV2")){var e=portalRenderLimit.mergeLowLevelPortals(null);handlePortalsRender(e)}runHooks("requestFinished",{success:!1})},window.handleDataResponse=function(e,t,n){if(!e||!e.result){window.failedRequestCount++,console.warn(e),handleFailedRequest();return}var r=e.result.map,i=[],s={};$.each(r,function(e,t){$.each(t.deletedGameEntityGuids||[],function(e,t){getTypeByGuid(t)===TYPE_FIELD&&window.fields[t]!==undefined&&$.each(window.fields[t].options.vertices,function(e,n){if(window.portals[n.guid]===undefined)return!0;fieldArray=window.portals[n.guid].options.details.portalV2.linkedFields,fieldArray.splice($.inArray(t,fieldArray),1)}),window.removeByGuid(t)}),$.each(t.gameEntities||[],function(e,t){if(t[2].turret!==undefined){var n=[t[2].locationE6.latE6/1e6,t[2].locationE6.lngE6/1e6];if(!window.getPaddedBounds().contains(n)&&selectedPortal!==t[0]&&urlPortal!==t[0])return;i.push(t)}else if(t[2].edge!==undefined)renderLink(t);else{if(t[2].capturedRegion===undefined)throw"Unknown entity: "+JSON.stringify(t);$.each(t[2].capturedRegion,function(e,n){s[n.guid]===undefined&&(s[n.guid]=new Array),s[n.guid].push(t[0])}),renderField(t)}})}),$.each(i,function(e,t){t[2].portalV2.linkedFields===undefined&&(t[2].portalV2.linkedFields=[]),s[t[0]]!==undefined&&($.merge(s[t[0]],t[2].portalV2.linkedFields),t[2].portalV2.linkedFields=uniqueArray(s[t[0]]))});var o=portalRenderLimit.splitOrMergeLowLevelPortals(i);handlePortalsRender(o),resolvePlayerNames(),renderUpdateStatus(),runHooks("requestFinished",{success:!0})},window.handlePortalsRender=function(e){var t=!1,n=selectedPortal;runHooks("portalDataLoaded",{portals:e}),$.each(e,function(e,n){urlPortal&&n[0]===urlPortal&&(t=!0),renderPortal(n)});var r=e[n];if(r){selectedPortal=n,renderPortalDetails(selectedPortal);try{r.bringToFront()}catch(i){}}t&&(renderPortalDetails(urlPortal),urlPortal=null)},window.cleanUp=function(){var e=[0,0,0],t=getPaddedBounds(),n=getMinPortalLevel();for(var r=0;r=n)return!0;e[0]++,portalsLayers[r].removeLayer(s)});linksLayer.eachLayer(function(n){if(t.intersects(n.getBounds()))return;e[1]++,linksLayer.removeLayer(n)}),fieldsLayer.eachLayer(function(n){n.eachLayer(function(r){if(!r.options.guid)return!0;if(t.intersects(r.getBounds()))return;e[2]++,fieldsLayer.removeLayer(n)})}),console.log("removed out-of-bounds: "+e[0]+" portals, "+e[1]+" links, "+e[2]+" fields")},window.removeByGuid=function(e){switch(getTypeByGuid(e)){case TYPE_PORTAL:if(!window.portals[e])return;var t=window.portals[e];for(var n=0;n=MAX_DRAWN_PORTALS&&e[0]!==selectedPortal)return removeByGuid(e[0]);var t=getPortalLevel(e[2]);if(t=RESONATOR_DISPLAY_ZOOM_LEVEL},window.isSameResonator=function(e,t){return!e&&!t?!0:!e||!t?!1:typeof e!=typeof t?!1:e.level!==t.level?!1:e.energyTotal!==t.energyTotal?!1:e.distanceToPortal!==t.distanceToPortal?!1:!0},window.portalResetColor=function(e){e.setStyle({color:COLORS[getTeam(e.options.details)]}),resonatorsResetStyle(e.options.guid)},window.resonatorsResetStyle=function(e){window.resonatorsSetStyle(e,OPTIONS_RESONATOR_NON_SELECTED,OPTIONS_RESONATOR_LINE_NON_SELECTED)},window.resonatorsSetSelectStyle=function(e){window.resonatorsSetStyle(e,OPTIONS_RESONATOR_SELECTED,OPTIONS_RESONATOR_LINE_SELECTED)},window.resonatorsSetStyle=function(e,t,n){for(var r=0;r<8;r++){resonatorLayerGroup=resonators[portalResonatorGuid(e,r)];if(!resonatorLayerGroup)continue;resonatorLayerGroup.eachLayer(function(e){e.options.guid||e.bringToFront().setStyle(n)}),resonatorLayerGroup.eachLayer(function(e){e.options.guid&&e.bringToFront().setStyle(t)})}portals[e].bringToFront()},window.renderLink=function(e){if(Object.keys(links).length>=MAX_DRAWN_LINKS)return removeByGuid(e[0]);if(findEntityInLeaflet(linksLayer,links,e[0]))return;var t=getTeam(e[2]),n=e[2].edge,r=[[n.originPortalLocation.latE6/1e6,n.originPortalLocation.lngE6/1e6],[n.destinationPortalLocation.latE6/1e6,n.destinationPortalLocation.lngE6/1e6]],i=L.polyline(r,{color:COLORS[t],opacity:1,weight:2,clickable:!1,guid:e[0],data:e[2],smoothFactor:0});i._map=window.map,i.projectLatlngs();var s=i._originalPoints,o=Math.abs(s[0].x-s[1].x)+Math.abs(s[0].y-s[1].y);if(o<=10)return;if(!getPaddedBounds().intersects(i.getBounds()))return;i.on("remove",function(){delete window.links[this.options.guid]}),i.on("add",function(){if(window.links[this.options.guid])throw"duplicate link detected";window.links[this.options.guid]=this,this.bringToBack()}),i.addTo(linksLayer)},window.renderField=function(e){if(Object.keys(fields).length>=MAX_DRAWN_FIELDS)return window.removeByGuid(e[0]);var t=findEntityInLeaflet(fieldsLayer,window.fields,e[0]);if(t&&map.getZoom()===t.options.creationZoom)return;var n=getTeam(e[2]),r=e[2].capturedRegion,i=[L.latLng(r.vertexA.location.latE6/1e6,r.vertexA.location.lngE6/1e6),L.latLng(r.vertexB.location.latE6/1e6,r.vertexB.location.lngE6/1e6),L.latLng(r.vertexC.location.latE6/1e6,r.vertexC.location.lngE6/1e6)],s=L.polygon(i,{fillColor:COLORS[n],fillOpacity:.25,stroke:!1,clickable:!1,smoothFactor:0,guid:e[0]});s._map=window.map,s.projectLatlngs();var o=L.LineUtil.simplify(s._originalPoints,6).length;if(o<=2)return;if(!getPaddedBounds().intersects(s.getBounds()))return;var u=calcTriArea(i)/Math.exp(14.2714860198866-1.384987247*map.getZoom()),a=L.LineUtil.simplify(s._originalPoints,FIELD_MU_DISPLAY_POINT_TOLERANCE).length;if(t){var f=0;t.eachLayer(function(e){f++});if(u>FIELD_MU_DISPLAY_AREA_ZOOM_RATIO&&a>2&&f===2)return;if(u<=FIELD_MU_DISPLAY_AREA_ZOOM_RATIO&&a<=2&&f===1)return;removeByGuid(e[0])}if(u>FIELD_MU_DISPLAY_AREA_ZOOM_RATIO&&a>2)var l=[(i[0].lat+i[1].lat+i[2].lat)/3,(i[0].lng+i[1].lng+i[2].lng)/3],c=L.marker(l,{icon:L.divIcon({className:"fieldmu",iconSize:[70,12],html:digits(e[2].entityScore.entityScore)}),clickable:!1}),h=L.layerGroup([s,c]);else var h=L.layerGroup([s]);h.options={vertices:r,lastUpdate:e[1],creationZoom:map.getZoom(),guid:e[0],data:e[2]},s.on("remove",function(){delete window.fields[this.options.guid]}),s.on("add",function(){window.fields[this.options.guid]&&console.warn("duplicate field detected"),window.fields[this.options.guid]=h,this.bringToBack()}),h.addTo(fieldsLayer)},window.findEntityInLeaflet=function(e,t,n){if(map.hasLayer(e))return t[n]||null;var r=null;return e.eachLayer(function(e){return e.options.guid!==n?!0:(r=e,!1)}),r},window.activeRequests=[],window.failedRequestCount=0,window.requests=function(){},window.requests.add=function(e){window.activeRequests.push(e),renderUpdateStatus()},window.requests.remove=function(e){window.activeRequests.splice(window.activeRequests.indexOf(e),1),renderUpdateStatus()},window.requests.abort=function(){$.each(window.activeRequests,function(e,t){t&&t.abort()}),window.activeRequests=[],window.failedRequestCount=0,window.chat._requestPublicRunning=!1,window.chat._requestFactionRunning=!1,renderUpdateStatus()},window.renderUpdateStatus=function(){var e="map status: ";mapRunsUserAction?e+="paused during interaction":isIdle()?e+='Idle, not updating.':window.activeRequests.length>0?e+=window.activeRequests.length+" requests running.":e+="Up to date.",renderLimitReached()&&(e+=' RENDER LIMIT '),window.failedRequestCount>0&&(e+=' '+window.failedRequestCount+" failed."),e+="
(";var t=getMinPortalLevel();t===0?e+="loading all portals":e+="only loading portals with level "+t+" and up",e+=")";var n=$(".leaflet-control-layers-overlays label");n.slice(0,t+1).addClass("disabled").attr("title","Zoom in to show those."),n.slice(t,8).removeClass("disabled").attr("title",""),$("#updatestatus").html(e)},window.startRefreshTimeout=function(e){window.renderUpdateStatus(),refreshTimeout&&clearTimeout(refreshTimeout);var t=0;if(e)t=e;else{t=REFRESH*1e3;var n=ZOOM_LEVEL_ADJ*(18-window.map.getZoom());n>0&&(t+=n*1e3)}var r=(new Date((new Date).getTime()+t)).toLocaleTimeString();console.log("planned refresh: "+r),refreshTimeout=setTimeout(window.requests._callOnRefreshFunctions,t)},window.requests._onRefreshFunctions=[],window.requests._callOnRefreshFunctions=function(){startRefreshTimeout();if(isIdle()){console.log("user has been idle for "+idleTime+" minutes. Skipping refresh."),renderUpdateStatus();return}console.log("refreshing"),$.each(window.requests._onRefreshFunctions,function(e,t){t()})},window.requests.addRefreshFunction=function(e){window.requests._onRefreshFunctions.push(e)},window.requests.isLastRequest=function(e){var t=!0;return $.each(window.activeRequests,function(n,r){if(r.action===e)return t=!1,!1}),t},window.layerGroupLength=function(e){var t=0,n=e._layers;return n&&(t=Object.keys(n).length),t},window.getURLParam=function(e){var t=document.URL,n=t.indexOf(e);return n<=-1?"":(t=t.substr(n),n=t.indexOf("&"),n>=0&&(t=t.substr(0,n)),t.replace(e+"=",""))};var cookies;window.readCookie=function(e,t,n,r){if(cookies)return cookies[e];t=document.cookie.split("; "),cookies={};for(r=t.length-1;r>=0;r--)n=t[r].split("="),cookies[n[0]]=unescape(n[1]);return cookies[e]},window.writeCookie=function(e,t){document.cookie=e+"="+t+"; expires=Thu, 31 Dec 2020 23:59:59 GMT; path=/"},window.digits=function(e){return(e+"").replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1 ")},window.postAjax=function(e,t,n,r){t=JSON.stringify($.extend({method:"dashboard."+e},t));var i=function(e,t,n){window.requests.remove(n)},s=function(e){window.failedRequestCount++,window.requests.remove(e)},o=$.ajax({url:"https://www.ingress.com/rpc/dashboard."+e,type:"POST",data:t,dataType:"json",success:[i,n],error:r?[s,r]:s,contentType:"application/json; charset=utf-8",beforeSend:function(e){e.setRequestHeader("X-CSRFToken",readCookie("csrftoken"))}});return o.action=e,o},window.unixTimeToString=function(e,t){if(!e)return null;var n=new Date(typeof e=="string"?parseInt(e):e),e=n.toLocaleTimeString(),r=n.getFullYear()+"-"+(n.getMonth()+1)+"-"+n.getDate();return typeof t!="undefined"&&t?r+" "+e:n.toDateString()==(new Date).toDateString()?e:r},window.unixTimeToHHmm=function(e){if(!e)return null;var t=new Date(typeof e=="string"?parseInt(e):e),n=""+t.getHours();n=n.length===1?"0"+n:n;var r=""+t.getMinutes();return r=r.length===1?"0"+r:r,n+":"+r},window.rangeLinkClick=function(){window.portalRangeIndicator&&window.map.fitBounds(window.portalRangeIndicator.getBounds()),window.isSmartphone&&window.smartphone.mapButton.click()},window.showPortalPosLinks=function(e,t){var n='
',r="",i='gmaps',s='OSM';alert('
'+n+r+i+" "+s+"
")},window.reportPortalIssue=function(e){var t="Redirecting you to a Google Help Page.\n\nThe text box contains all necessary information. Press CTRL+C to copy it.",n=window.portals[window.selectedPortal].options.details,e="Your Nick: "+PLAYER.nickname+" "+"Portal: "+n.portalV2.descriptiveText.TITLE+" "+"Location: "+n.portalV2.descriptiveText.ADDRESS+" (lat "+n.locationE6.latE6/1e6+"; lng "+n.locationE6.lngE6/1e6+")";prompt(t,e)!==null&&(location.href="https://support.google.com/ingress?hl=en&contact=1")},window._storedPaddedBounds=undefined,window.getPaddedBounds=function(){_storedPaddedBounds===undefined&&map.on("zoomstart zoomend movestart moveend",function(){window._storedPaddedBounds=null});if(renderLimitReached(.7))return window.map.getBounds();if(window._storedPaddedBounds)return window._storedPaddedBounds;var e=window.map.getBounds().pad(VIEWPORT_PAD_RATIO);return window._storedPaddedBounds=e,e},window.renderLimitReached=function(e){e=e||1;if(Object.keys(portals).length*e>=MAX_DRAWN_PORTALS)return!0;if(Object.keys(links).length*e>=MAX_DRAWN_LINKS)return!0;if(Object.keys(fields).length*e>=MAX_DRAWN_FIELDS)return!0;var t={reached:!1};return window.runHooks("checkRenderLimit",t),t.reached},window.getMinPortalLevel=function(){var e=map.getZoom();if(e>=16)return 0;var t=["impossible",8,7,7,6,6,5,5,4,4,3,3,2,2,1,1],n=portalRenderLimit.getMinLevel(),r=n>t[e]?n:t[e];return r},window.scrollBottom=function(e){typeof e=="string"&&(e=$(e));try{return e.get(0).scrollHeight-e.innerHeight()-e.scrollTop()}catch(t){return console.warn("elmget undefined error"),debug.printStackTrace(),0}},window.zoomToAndShowPortal=function(e,t){map.setView(t,17),window.portals[e]?renderPortalDetails(e):urlPortal=e},window.getTypeByGuid=function(e){switch(e.slice(33)){case"11":case"12":return TYPE_PORTAL;case"9":return TYPE_LINK;case"b":return TYPE_FIELD;case"c":return TYPE_PLAYER;case"d":return TYPE_CHAT;default:if(e.slice(-11,-2)=="resonator")return TYPE_RESONATOR;return TYPE_UNKNOWN}},String.prototype.capitalize=function(){return this.charAt(0).toUpperCase()+this.slice(1).toLowerCase()},typeof String.prototype.startsWith!="function"&&(String.prototype.startsWith=function(e){return this.slice(0,e.length)===e}),window.prettyEnergy=function(e){return e>1e3?Math.round(e/1e3)+" k":e},window.setPermaLink=function(e){var t=map.getCenter(),n=Math.round(t.lat*1e6),r=Math.round(t.lng*1e6),i="latE6="+n+"&lngE6="+r+"&z="+(map.getZoom()-1);$(e).attr("href","https://www.ingress.com/intel?"+i)},window.uniqueArray=function(e){return $.grep(e,function(t,n){return $.inArray(t,e)===n})},window.genFourColumnTable=function(e){var t=$.map(e,function(e,t){return e?t%2===0?""+e[1]+""+e[0]+"":" "+e[0]+""+e[1]+"":""}).join("");return t.length%2===1&&t+"",t},window.convertTextToTableMagic=function(e){if(!e.match(/\t/))return e.replace(/\n/g,"
");var t=[],n=0,r=e.split("\n");$.each(r,function(e,r){t[e]=r.split(" "),t[e].length>n&&(n=t[e].length)});var i="";return $.each(t,function(e,r){i+="",$.each(t[e],function(r,s){var o="";r===0&&t[e].length"+s+""}),i+=""}),i+="
",i},window.calcTriArea=function(e){return Math.abs((e[0].lat*(e[1].lng-e[2].lng)+e[1].lat*(e[2].lng-e[0].lng)+e[2].lat*(e[0].lng-e[1].lng))/2)},window.setupBackButton=function(){var e=window.isSmartphone()?window.smartphone.mapButton:$("#chatcontrols a.active");window.setupBackButton._actions=[e.get(0)],$("#chatcontrols a").click(function(){if($(this).hasClass("toggle"))return;window.setupBackButton._actions.push(this),window.setupBackButton._actions=window.setupBackButton._actions.slice(-2)}),window.goBack=function(){var e=window.setupBackButton._actions[0];if(!e)return;$(e).click(),window.setupBackButton._actions=[e]}},window.setupLargeImagePreview=function(){$("#portaldetails").on("click",".imgpreview",function(){var e=$("#largepreview");if(e.length>0){e.remove();return}var t=$(this).find("img")[0],n=t.naturalWidth/2,r=t.naturalHeight/2,i=$("#portaldetails").attr("class");$("body").append('
'+t.outerHTML+"
"),$("#largepreview").click(function(){$(this).remove()})})},window.setupLayerChooserSelectOne=function(){$(".leaflet-control-layers-overlays").on("click taphold","label",function(e){if(!e)return;if(!(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.type==="taphold"))return;var t=window.map,n=function(e){t.hasLayer(e.layer)||t.addLayer(e.layer)},r=function(e){t.hasLayer(e.layer)&&t.removeLayer(e.layer)},i=$(e.target).find("input").is(":checked"),s=$(".leaflet-control-layers-overlays input:checked").length;if(i&&s===1||s===0)$.each(window.layerChooser._layers,function(e,t){if(!t.overlay)return!0;n(t)});else{var o=$.trim($(e.target).text());$.each(window.layerChooser._layers,function(e,t){if(t.overlay!==!0)return!0;if(t.name===o)return n(t),!0;r(t)})}e.preventDefault()})},window.setupStyles=function(){$("head").append("")},window.setupMap=function(){$("#map").text("");var e={attribution:"Map data © OpenStreetMap contributors",maxZoom:18,detectRetina:!0},t=new L.TileLayer("http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",e),n={attribution:"Map data © OpenStreetMap contributors, Imagery © CloudMade",maxZoom:18,detectRetina:!0},r=new L.TileLayer("http://{s}.tile.cloudmade.com/654cef5fd49a432ab81267e200ecc502/22677/256/{z}/{x}/{y}.png",n),i=new L.TileLayer("http://{s}.tile.cloudmade.com/654cef5fd49a432ab81267e200ecc502/999/256/{z}/{x}/{y}.png",n),s=[i,r,t,new L.Google("INGRESS"),new L.Google("ROADMAP"),new L.Google("SATELLITE"),new L.Google("HYBRID")];window.map=new L.Map("map",$.extend(getPosition(),{zoomControl:localStorage["iitc.zoom.buttons"]!=="false"}));var o={};portalsLayers=[];for(var u=0;u<=8;u++){portalsLayers[u]=L.layerGroup([]),map.addLayer(portalsLayers[u]);var a=(u===0?"Unclaimed":"Level "+u)+" Portals";o[a]=portalsLayers[u]}fieldsLayer=L.layerGroup([]),map.addLayer(fieldsLayer,!0),o.Fields=fieldsLayer,linksLayer=L.layerGroup([]),map.addLayer(linksLayer,!0),o.Links=linksLayer,window.layerChooser=new L.Control.Layers({"OSM Midnight":s[0],"OSM Minimal":s[1],"OSM Mapnik":s[2],"Default Ingress Map":s[3],"Google Roads":s[4],"Google Satellite":s[5],"Google Hybrid":s[6]},o),map.addControl(window.layerChooser);try{map.addLayer(s[readCookie("ingress.intelmap.type")])}catch(f){map.addLayer(s[0])}map.attributionControl.setPrefix(""),map.on("moveend",window.storeMapPosition),map.on("zoomend",function(){window.storeMapPosition();if(isResonatorsShow())return;for(var e=1;e'+e+" "+'
'+''+PLAYER.nickname+""+'sign out'+"
"+'
'+"XM: "+u+"%"+""+(e<8?"level: "+s+"%":"max level")+""+"
"+""),$("#name").mouseenter(function(){$("#signout").show()}).mouseleave(function(){$("#signout").hide()})},window.setupSidebarToggle=function(){$("#sidebartoggle").on("click",function(){var e=$("#sidebartoggle"),t=$("#scrollwrapper");t.is(":visible")?(t.hide().css("z-index",1),$(".leaflet-right").css("margin-right","0"),e.html(''),e.css("right","0")):(t.css("z-index",1001).show(),$(".leaflet-right").css("margin-right",SIDEBAR_WIDTH+1+"px"),e.html(''),e.css("right",SIDEBAR_WIDTH+1+"px"))})},window.setupTooltips=function(e){e=e||$(document),e.tooltip({show:{effect:"hide",duration:0},hide:!1,open:function(e,t){t.tooltip.delay(300).fadeIn(0)},content:function(){var e=$(this).attr("title");return window.convertTextToTableMagic(e)}}),window.tooltipClearerHasBeenSetup||(window.tooltipClearerHasBeenSetup=!0,$(document).on("click",".ui-tooltip",function(){$(this).remove()}))},window.setupDialogs=function(){$("#dialog").dialog({autoOpen:!1,modal:!0,buttons:[{text:"OK",click:function(){$(this).dialog("close")}}]}),window.alert=function(e,t){var n=t?e:window.convertTextToTableMagic(e);$("#dialog").html(n).dialog("open")}},window.setupTaphold=function(){(function(e){function t(e){var t=jQuery(this);if(typeof t.data("events")!="undefined"&&typeof t.data("events").click!="undefined"){for(var n in t.data("events").click)if(t.data("events").click[n].namespace==""){var r=t.data("events").click[n].handler;t.data("taphold_click_handler",r),t.unbind("click",r);break}}else typeof e.data!="undefined"&&e.data!=null&&typeof e.data.clickHandler=="function"&&t.data("taphold_click_handler",e.data.clickHandler);t.data("taphold_triggered",!1),t.data("taphold_clicked",!1),t.data("taphold_cancelled",!1),t.data("taphold_timer",setTimeout(function(){!t.data("taphold_cancelled")&&!t.data("taphold_clicked")&&(t.trigger(jQuery.extend(e,jQuery.Event ("taphold"))),t.data("taphold_triggered",!0))},1e3))}function n(e){var t=jQuery(this);if(t.data("taphold_cancelled"))return;clearTimeout(t.data("taphold_timer")),!t.data("taphold_triggered")&&!t.data("taphold_clicked")&&(typeof t.data("taphold_click_handler")=="function"&&t.data("taphold_click_handler")(jQuery.extend(e,jQuery.Event("click"))),t.data("taphold_clicked",!0))}function r(t){e(this).data("taphold_cancelled",!0)}var i=e.event.special.taphold={setup:function(i){e(this).bind("touchstart mousedown",i,t).bind("touchend mouseup",n).bind("touchmove mouseleave",r)},teardown:function(i){e(this).unbind("touchstart mousedown",t).unbind("touchend mouseup",n).unbind("touchmove mouseleave",r)}}})(jQuery)},window.setupQRLoadLib=function(){(function(e){e.fn.qrcode=function(t){function i(e){this.mode=n,this.data=e}function s(e,t){this.typeNumber=e,this.errorCorrectLevel=t,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}function o(e,t){if(void 0==e.length)throw Error(e.length+"/"+t);for(var n=0;ne||this.moduleCount<=e||0>t||this.moduleCount<=t)throw Error(e+","+t);return this.modules[e][t]},getModuleCount:function(){return this.moduleCount},make:function(){if(1>this.typeNumber){for(var e=1,e=1;40>e;e++){for(var t=u.getRSBlocks(e,this.errorCorrectLevel),n=new a,r=0,i=0;i=n;n++)if(!(-1>=e+n||this.moduleCount<=e+n))for(var r=-1;7>=r;r++)-1>=t+r||this.moduleCount<=t+r||(this.modules[e+n][t+r]=0<=n&&6>=n&&(0==r||6==r)||0<=r&&6>=r&&(0==n||6==n)||2<=n&&4>=n&&2<=r&&4>=r?!0:!1)},getBestMaskPattern:function(){for(var e=0,t=0,n=0;8>n;n++){this.makeImpl(!0,n);var r=f.getLostPoint(this);if(0==n||e>r)e=r,t=n}return t},createMovieClip:function(e,t,n){e=e.createEmptyMovieClip(t,n),this.make();for(t=0;t=s;s++)for(var o=-2;2>=o;o++)this.modules[r+s][i+o]=-2==s||2==s||-2==o||2==o||0==s&&0==o?!0:!1}},setupTypeNumber:function(e){for(var t=f.getBCHTypeNumber(this.typeNumber),n=0;18>n;n++){var r=!e&&1==(t>>n&1);this.modules[Math.floor(n/3)][n%3+this.moduleCount-8-3]=r}for(n=0;18>n;n++)r=!e&&1==(t>>n&1),this.modules[n%3+this.moduleCount-8-3][Math.floor(n/3)]=r},setupTypeInfo:function(e,t){for(var n=f.getBCHTypeInfo(this.errorCorrectLevel<<3|t),r=0;15>r;r++){var i=!e&&1==(n>>r&1);6>r?this.modules[r][8]=i:8>r?this.modules[r+1][8]=i:this.modules[this.moduleCount-15+r][8]=i}for(r=0;15>r;r++)i=!e&&1==(n>>r&1),8>r?this.modules[8][this.moduleCount-r-1]=i:9>r?this.modules[8][15-r-1+1]=i:this.modules[8][15-r-1]=i;this.modules[this.moduleCount-8][8]=!e},mapData:function(e,t){for(var n=-1,r=this.moduleCount-1,i=7,s=0,o=this.moduleCount-1;0u;u++)if(null==this.modules[r][o-u]){var a=!1;s>>i&1)),f.getMask(t,r,o-u)&&(a=!a),this.modules[r][o-u]=a,i--,-1==i&&(s++,i=7)}r+=n;if(0>r||this.moduleCount<=r){r-=n,n=-n;break}}}},s.PAD0=236,s.PAD1=17,s.createData=function(e,t,n){for(var t=u.getRSBlocks(e,t),r=new a,i=0;i8*e)throw Error("code length overflow. ("+r.getLengthInBits()+">"+8*e+")");for(r.getLengthInBits()+4<=8*e&&r.put(0,4);0!=r.getLengthInBits()%8;)r.putBit(!1);for(;!(r.getLengthInBits()>=8*e);){r.put(s.PAD0,8);if(r.getLengthInBits()>=8*e)break;r.put(s.PAD1,8)}return s.createBytes(r,t)},s.createBytes=function(e,t){for(var n=0,r=0,i=0,s=Array(t.length),u=Array(t.length),a=0;a>>=1;return t},getPatternPosition:function(e){return f.PATTERN_POSITION_TABLE[e-1]},getMask:function(e,t,n){switch(e){case 0:return 0==(t+n)%2;case 1:return 0==t%2;case 2:return 0==n%3;case 3:return 0==(t+n)%3;case 4:return 0==(Math.floor(t/2)+Math.floor(n/3))%2;case 5:return 0==t*n%2+t*n%3;case 6:return 0==(t*n%2+t*n%3)%2;case 7:return 0==(t*n%3+(t+n)%2)%2;default:throw Error("bad maskPattern:"+e)}},getErrorCorrectPolynomial:function(e){for(var t=new o([1],0),n=0;nt)switch(e){case 1:return 10;case 2:return 9;case n:return 8;case 8:return 8;default:throw Error("mode:"+e)}else if(27>t)switch(e){case 1:return 12;case 2:return 11;case n:return 16;case 8:return 10;default:throw Error("mode:"+e)}else{if(!(41>t))throw Error("type:"+t);switch(e){case 1:return 14;case 2:return 13;case n:return 16;case 8:return 12;default:throw Error("mode:"+e)}}},getLostPoint:function(e){for(var t=e.getModuleCount(),n=0,r=0;r=u;u++)if(!(0>r+u||t<=r+u))for(var a=-1;1>=a;a++)0>i+a||t<=i+a||0==u&&0==a||o==e.isDark(r+u,i+a)&&s++;5e)throw Error("glog("+e+")");return l.LOG_TABLE[e]},gexp:function(e){for(;0>e;)e+=255;for(;256<=e;)e-=255;return l.EXP_TABLE[e]},EXP_TABLE:Array(256),LOG_TABLE:Array(256)},c=0;8>c;c++)l.EXP_TABLE[c]=1<c;c++)l.EXP_TABLE[c]=l.EXP_TABLE[c-4]^l.EXP_TABLE[c-5]^l.EXP_TABLE[c-6]^l.EXP_TABLE[c-8];for(c=0;255>c;c++)l.LOG_TABLE[l.EXP_TABLE[c]]=c;return o.prototype={get:function(e){return this.num[e]},getLength:function(){return this.num.length},multiply:function(e){for(var t=Array(this.getLength()+e.getLength()-1),n=0;nthis.getLength()-e.getLength())return this;for(var t=l.glog(this.get(0))-l.glog(e.get(0)),n=Array(this.getLength()),r=0;r>>7-e%8&1)},put:function(e,t){for(var n=0;n>>t-n-1&1))},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},"string"==typeof t&&(t={text:t}),t=e.extend({},{render:"canvas",width:256,height:256,typeNumber:-1,correctLevel:2,background:"#ffffff",foreground:"#000000"},t),this.each(function(){var n;if("canvas"==t.render){n=new s(t.typeNumber,t.correctLevel),n.addData(t.text),n.make();var i=document.createElement("canvas");i.width=t.width,i.height=t.height;for(var o=i.getContext("2d"),u=t.width/n.getModuleCount(),a=t.height/n.getModuleCount(),f=0;f").css("width",t.width+"px").css("height",t.height+"px").css("border","0px").css("border-collapse","collapse").css("background-color",t.background),o=t.width/n.getModuleCount(),u=t.height/n.getModuleCount();for(a=0;a").css("height",u+"px").appendTo(i);for(l=0;l").css("width",o+"px").css("background-color",n.isDark(a,l)?t.foreground:t.background).appendTo(f)}}n=i,jQuery(n).appendTo(this)})}})(jQuery)},function(e){e=e||{};var t={},n,r;n=function(e,r,i){var s=e.halt=!1;e.error=function(e){throw e},e.next=function(n){n&&(s=!1);if(!e.halt&&r&&r.length){var i=r.shift(),o=i.shift();s=!0;try{t[o].apply(e,[i,i.length,o])}catch(u){e.error(u)}}return e};for(var o in t){if(typeof e[o]=="function")continue;(function(i){e[i]=function(){var o=Array.prototype.slice.call(arguments);if(i==="onError"){if(r)return t.onError.apply(e,[o,o.length]),e;var u={};return t.onError.apply(u,[o,o.length]),n(u,null,"onError")}return o.unshift(i),r?(e.then=e[i],r.push(o),s?e:e.next()):n({},[o],i)}})(o)}return i&&(e.then=e[i]),e.call=function(t,n){n.unshift(t),r.unshift(n),e.next(!0)},e.next()},r=e.addMethod=function(r){var i=Array.prototype.slice.call(arguments),s=i.pop();for(var o=0,u=i.length;on;n++){i=s[n]||{};for(t in i)i.hasOwnProperty(t)&&(e[t]=i[t])}return e},bind:function(e,t){var n=arguments.length>2?Array.prototype.slice.call(arguments,2):null;return function(){return e.apply(t,n||arguments)}},stamp:function(){var e=0,t="_leaflet_id";return function(n){return n[t]=n[t]||++e,n[t]}}(),limitExecByInterval:function(e,t,r){var i,s;return function o(){var u=arguments;return i?(s=!0,n):(i=!0,setTimeout(function(){i=!1,s&&(o.apply(r,u),s=!1)},t),e.apply(r,u),n)}},falseFn:function(){return!1},formatNum:function(e,t){var n=Math.pow(10,t||5);return Math.round(e*n)/n},splitWords:function(e){return e.replace(/^\s+|\s+$/g,"").split(/\s+/)},setOptions:function(e,t){return e.options=r.extend({},e.options,t),e.options},getParamString:function(e,t){var n=[];for(var r in e)e.hasOwnProperty(r)&&n.push(r+"="+e[r]);return(t&&-1!==t.indexOf("?")?"&":"?")+n.join("&")},template:function(e,t){return e.replace(/\{ *([\w_]+) *\}/g,function(e,n){var r=t[n];if(!t.hasOwnProperty(n))throw Error("No value provided for variable "+e);return r})},isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},emptyImageUrl:"data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="},function(){function t(t){var n,r,i=["webkit","moz","o","ms"];for(n=0;i.length>n&&!r;n++)r=e[i[n]+t];return r}function i(t){var n=+(new Date),r=Math.max(0,16-(n-s));return s=n+r,e.setTimeout(t,r)}var s=0,o=e.requestAnimationFrame||t("RequestAnimationFrame")||i,u=e.cancelAnimationFrame||t("CancelAnimationFrame")||t("CancelRequestAnimationFrame")||function(t){e.clearTimeout(t)};r.Util.requestAnimFrame=function(t,s,u,f){return t=r.bind(t,s),u&&o===i?(t(),n):o.call(e,t,f)},r.Util.cancelAnimFrame=function(t){t&&u.call(e,t)}}(),r.extend=r.Util.extend,r.bind=r.Util.bind,r.stamp=r.Util.stamp,r.setOptions=r.Util.setOptions,r.Class=function(){},r.Class.extend=function(e){var t=function(){this.initialize&&this.initialize.apply(this,arguments),this._initHooks&&this.callInitHooks()},n=function(){};n.prototype=this.prototype;var i=new n;i.constructor=t,t.prototype=i;for(var s in this)this.hasOwnProperty(s)&&"prototype"!==s&&(t[s]=this[s]);e.statics&&(r.extend(t,e.statics),delete e.statics),e.includes&&(r.Util.extend.apply(null,[i].concat(e.includes)),delete e.includes),e.options&&i.options&&(e.options=r.extend({},i.options,e.options)),r.extend(i,e),i._initHooks=[];var o=this;return i.callInitHooks=function(){if(!this._initHooksCalled){o.prototype.callInitHooks&&o.prototype.callInitHooks.call(this),this._initHooksCalled=!0;for(var e=0,t=i._initHooks.length;t>e;e++)i._initHooks[e].call(this)}},t},r.Class.include=function(e){r.extend(this.prototype,e)},r.Class.mergeOptions=function(e){r.extend(this.prototype.options,e)},r.Class.addInitHook=function(e){var t=Array.prototype.slice.call(arguments,1),n="function"==typeof e?e:function(){this[e].apply(this,t)};this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(n)};var s="_leaflet_events";r.Mixin={},r.Mixin.Events={addEventListener:function(e,t,n){var i,o,u,a=this[s]=this[s]||{};if("object"==typeof e){for(i in e)e.hasOwnProperty(i)&&this.addEventListener(i,e[i],t);return this}for(e=r.Util.splitWords(e),o=0,u=e.length;u>o;o++)a[e[o]]=a[e[o]]||[],a[e[o]].push({action:t,context:n||this});return this},hasEventListeners:function(e){return s in this&&e in this[s]&&this[s][e].length>0},removeEventListener:function(e,t,n){var i,o,u,a,f,l=this[s];if("object"==typeof e){for(i in e)e.hasOwnProperty(i)&&this.removeEventListener(i,e[i],t);return this}for(e=r.Util.splitWords(e),o=0,u=e.length;u>o;o++)if(this.hasEventListeners(e[o]))for(a=l[e[o]],f=a.length-1;f>=0;f--)t&&a[f].action!==t||n&&a[f].context!==n||a.splice(f,1);return this},fireEvent:function(e,t){if(!this.hasEventListeners(e))return this;for(var n=r.extend({type:e,target:this},t),i=this[s][e].slice(),o=0,u=i.length;u>o;o++)i[o].action.call(i[o].context||this,n);return this}},r.Mixin.Events.on=r.Mixin.Events.addEventListener,r.Mixin.Events.off=r.Mixin.Events.removeEventListener,r.Mixin.Events.fire=r.Mixin.Events.fireEvent,function(){var i=!!e.ActiveXObject,s=i&&!e.XMLHttpRequest,o=i&&!t.querySelector,u=navigator.userAgent.toLowerCase(),a=-1!==u.indexOf("webkit"),f=-1!==u.indexOf("chrome"),l=-1!==u.indexOf("android"),c=-1!==u.search("android [23]"),h=typeof orientation!=n+"",p=e.navigator&&e.navigator.msPointerEnabled&&e.navigator.msMaxTouchPoints,d="devicePixelRatio"in e&&e.devicePixelRatio>1||"matchMedia"in e&&e.matchMedia("(min-resolution:144dpi)")&&e.matchMedia("(min-resolution:144dpi)").matches,v=t.documentElement,m=i&&"transition"in v.style,g="WebKitCSSMatrix"in e&&"m11"in new e.WebKitCSSMatrix,y="MozPerspective"in v.style,b="OTransition"in v.style,w=!e.L_DISABLE_3D&&(m||g||y||b),E=!e.L_NO_TOUCH&&function(){var e="ontouchstart";if(p||e in v)return!0;var n=t.createElement("div"),r=!1;return n.setAttribute?(n.setAttribute(e,"return;"),"function"==typeof n[e]&&(r=!0),n.removeAttribute(e),n=null,r):!1}();r.Browser={ie:i,ie6:s,ie7:o,webkit:a,android:l,android23:c,chrome:f,ie3d:m,webkit3d:g,gecko3d:y,opera3d:b,any3d:w,mobile:h,mobileWebkit:h&&a,mobileWebkit3d:h&&g,mobileOpera:h&&e.opera,touch:E,msTouch:p,retina:d}}(),r.Point=function(e,t,n){this.x=n?Math.round(e):e,this.y=n?Math.round(t):t},r.Point.prototype={clone:function(){return new r.Point(this.x,this.y)},add:function(e){return this.clone()._add(r.point(e))},_add:function(e){return this.x+=e.x,this.y+=e.y,this},subtract:function(e){return this.clone()._subtract(r.point(e))},_subtract:function(e){return this.x-=e.x,this.y-=e.y,this},divideBy:function(e){return this.clone()._divideBy(e)},_divideBy:function(e){return this.x/=e,this.y/=e,this},multiplyBy:function(e){return this.clone()._multiplyBy(e)},_multiplyBy:function(e){return this.x*=e,this.y*=e,this},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},distanceTo:function(e){e=r.point(e);var t=e.x-this.x,n=e.y-this.y;return Math.sqrt(t*t+n*n)},equals:function(e){return e.x===this.x&&e.y===this.y},toString:function(){return"Point("+r.Util.formatNum(this.x)+", "+r.Util.formatNum(this.y)+")"}},r.point=function(e,t,n){return e instanceof r.Point?e:r.Util.isArray(e)?new r.Point(e[0],e[1]):isNaN(e)?e:new r.Point(e,t,n)},r.Bounds=function(e,t){if(e)for(var n=t?[e,t]:e,r=0,i=n.length;i>r;r++)this.extend(n[r])},r.Bounds.prototype={extend:function(e){return e=r.point(e),this.min||this.max?(this.min.x=Math.min(e.x,this.min.x),this.max.x=Math.max(e.x,this.max.x),this.min.y=Math.min(e.y,this.min.y),this.max.y=Math.max(e.y,this.max.y)):(this.min=e.clone(),this.max=e.clone()),this},getCenter:function(e){return new r.Point((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,e)},getBottomLeft:function(){return new r.Point(this.min.x,this.max.y)},getTopRight:function(){return new r.Point(this.max.x,this.min.y)},getSize:function(){return this.max.subtract(this.min)},contains:function(e){var t,n;return e="number"==typeof e[0]||e instanceof r.Point?r.point(e):r.bounds(e),e instanceof r.Bounds?(t=e.min,n=e.max):t=n=e,t.x>=this.min.x&&n.x<=this.max.x&&t.y>=this.min.y&&n.y<=this.max.y},intersects:function(e){e=r.bounds(e);var t=this.min,n=this.max,i=e.min,s=e.max,o=s.x>=t.x&&i.x<=n.x,u=s.y>=t.y&&i.y<=n.y;return o&&u},isValid:function(){return!!this.min&&!!this.max}},r.bounds=function(e,t){return!e||e instanceof r.Bounds?e:new r.Bounds(e,t)},r.Transformation=function(e,t,n,r){this._a=e,this._b=t,this._c=n,this._d=r},r.Transformation.prototype={transform:function(e,t){return this._transform(e.clone(),t)},_transform:function(e,t){return t=t||1,e.x=t*(this._a*e.x+this._b),e.y=t*(this._c*e.y+this._d),e},untransform:function(e,t){return t=t||1,new r.Point((e.x/t-this._b)/this._a,(e.y/t-this._d)/this._c)}},r.DomUtil={get:function(e){return"string"==typeof e?t.getElementById(e):e},getStyle:function(e,n){var r=e.style[n];if(!r&&e.currentStyle&&(r=e.currentStyle[n]),(!r||"auto"===r)&&t.defaultView){var i=t.defaultView.getComputedStyle(e,null);r=i?i[n]:null}return"auto"===r?null:r},getViewportOffset:function(e){var n,i=0,s=0,o=e,u=t.body,a=r.Browser.ie7;do{if(i+=o.offsetTop||0,s+=o.offsetLeft||0,i+=parseInt(r.DomUtil.getStyle(o,"borderTopWidth"),10)||0,s+=parseInt(r.DomUtil.getStyle(o,"borderLeftWidth"),10)||0,n=r.DomUtil.getStyle(o,"position"),o.offsetParent===u&&"absolute"===n)break;if("fixed"===n){i+=u.scrollTop||0,s+=u.scrollLeft||0;break}o=o.offsetParent}while(o);o=e;do{if(o===u)break;i-=o.scrollTop||0,s-=o.scrollLeft||0,r.DomUtil.documentIsLtr()||!r.Browser.webkit&&!a||(s+=o.scrollWidth-o.clientWidth,a&&"hidden"!==r.DomUtil.getStyle(o,"overflow-y")&&"hidden"!==r.DomUtil.getStyle(o,"overflow")&&(s+=17)),o=o.parentNode}while(o);return new r.Point(s,i)},documentIsLtr:function(){return r.DomUtil._docIsLtrCached||(r.DomUtil._docIsLtrCached=!0,r.DomUtil._docIsLtr="ltr"===r.DomUtil.getStyle(t.body,"direction")),r.DomUtil._docIsLtr},create:function(e,n,r){var i=t.createElement(e);return i.className=n,r&&r.appendChild(i),i},disableTextSelection:function(){t.selection&&t.selection.empty&&t.selection.empty(),this._onselectstart||(this._onselectstart=t.onselectstart||null,t.onselectstart=r.Util.falseFn)},enableTextSelection:function(){t.onselectstart===r.Util.falseFn&&(t.onselectstart=this._onselectstart,this._onselectstart=null)},hasClass:function(e,t){return e.className.length>0&&RegExp("(^|\\s)"+t+"(\\s|$)").test(e.className)},addClass:function(e,t){r.DomUtil.hasClass(e,t)||(e.className+=(e.className?" ":"")+t)},removeClass:function(e,t){function n(e,n){return n===t?"":e}e.className=e.className.replace(/(\S+)\s*/g,n).replace(/(^\s+|\s+$)/,"")},setOpacity:function(e,t){if("opacity"in e.style)e.style.opacity=t;else if("filter"in e.style){var n=!1,r="DXImageTransform.Microsoft.Alpha";try{n=e.filters.item(r)}catch(i){}t=Math.round(100*t),n?(n.Enabled=100!==t,n.Opacity=t):e.style.filter+=" progid:"+r+"(opacity="+t+")"}},testProp:function(e){for(var n=t.documentElement.style,r=0;e.length>r;r++)if(e[r]in n)return e[r];return!1},getTranslateString:function(e){var t=r.Browser.webkit3d,n="translate"+(t?"3d":"")+"(",i=(t?",0":"")+")";return n+e.x+"px,"+e.y+"px"+i},getScaleString:function(e,t){var n=r.DomUtil.getTranslateString(t.add(t.multiplyBy(-1*e))),i=" scale("+e+") ";return n+i},setPosition:function(e,t,n){e._leaflet_pos=t,!n&&r.Browser.any3d?(e.style[r.DomUtil.TRANSFORM]=r.DomUtil.getTranslateString(t),r.Browser.mobileWebkit3d&&(e.style.WebkitBackfaceVisibility="hidden")):(e.style.left=t.x+"px",e.style.top=t.y+"px")},getPosition:function(e){return e._leaflet_pos}},r.DomUtil.TRANSFORM=r.DomUtil.testProp(["transform","WebkitTransform","OTransform","MozTransform","msTransform"]),r.DomUtil.TRANSITION=r.DomUtil.testProp(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),r.DomUtil.TRANSITION_END="webkitTransition"===r.DomUtil.TRANSITION||"OTransition"===r.DomUtil.TRANSITION?r.DomUtil.TRANSITION+"End":"transitionend",r.LatLng=function(e,t){var n=parseFloat(e),r=parseFloat(t);if(isNaN(n)||isNaN(r))throw Error("Invalid LatLng object: ("+e+", "+t+")");this.lat=n,this.lng=r},r.extend(r.LatLng,{DEG_TO_RAD:Math.PI/180,RAD_TO_DEG:180/Math.PI,MAX_MARGIN:1e-9}),r.LatLng.prototype={equals:function(e){if(!e)return!1;e=r.latLng(e);var t=Math.max(Math.abs(this.lat-e.lat),Math.abs(this.lng-e.lng));return r.LatLng.MAX_MARGIN>=t},toString:function(e){return"LatLng("+r.Util.formatNum(this.lat,e)+", "+r.Util.formatNum(this.lng,e)+")"},distanceTo:function(e){e=r.latLng(e);var t=6378137,n=r.LatLng.DEG_TO_RAD,i=(e.lat-this.lat)*n,s=(e.lng-this.lng)*n,o=this.lat*n,u=e.lat*n,a=Math.sin(i/2),f=Math.sin(s/2),l=a*a+f*f*Math.cos(o)*Math.cos(u);return 2*t*Math.atan2(Math.sqrt(l),Math.sqrt(1-l))},wrap:function(e,t){var n=this.lng;return e=e||-180,t=t||180,n=(n+t)%(t-e)+(e>n||n===t?t:e),new r.LatLng(this.lat,n)}},r.latLng=function(e,t){return e instanceof r.LatLng?e:r.Util.isArray(e)?new r.LatLng(e[0],e[1]):isNaN(e)?e:new r.LatLng(e,t)},r.LatLngBounds=function(e,t){if(e)for(var n=t?[e,t]:e,r=0,i=n.length;i>r;r++)this.extend(n[r])},r.LatLngBounds.prototype={extend:function(e){return e="number"==typeof e[0]||"string"==typeof e[0]||e instanceof r.LatLng?r.latLng(e):r.latLngBounds(e),e instanceof r.LatLng?this._southWest||this._northEast?(this._southWest.lat=Math.min(e.lat,this._southWest.lat),this._southWest.lng=Math.min(e.lng,this._southWest.lng),this._northEast.lat=Math.max(e.lat,this._northEast.lat),this._northEast.lng=Math.max(e.lng,this._northEast.lng)):(this._southWest=new r.LatLng(e.lat,e.lng),this._northEast=new r.LatLng(e.lat,e.lng)):e instanceof r.LatLngBounds&&(this.extend(e._southWest),this.extend(e._northEast)),this},pad:function(e){var t=this._southWest,n=this._northEast,i=Math.abs(t.lat-n.lat)*e,s=Math.abs(t.lng-n.lng)*e;return new r.LatLngBounds(new r.LatLng(t.lat-i,t.lng-s),new r.LatLng(n.lat+i,n.lng+s))},getCenter:function(){return new r.LatLng((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new r.LatLng(this._northEast.lat,this._southWest.lng)},getSouthEast:function(){return new r.LatLng(this._southWest.lat,this._northEast.lng)},contains:function(e){e="number"==typeof e[0]||e instanceof r.LatLng?r.latLng(e):r.latLngBounds(e);var t,n,i=this._southWest,s=this._northEast;return e instanceof r.LatLngBounds?(t=e.getSouthWest(),n=e.getNorthEast()):t=n=e,t.lat>=i.lat&&n.lat<=s.lat&&t.lng>=i.lng&&n.lng<=s.lng},intersects:function(e){e=r.latLngBounds(e);var t=this._southWest,n=this._northEast,i=e.getSouthWest(),s=e.getNorthEast(),o=s.lat>=t.lat&&i.lat<=n.lat,u=s.lng>=t.lng&&i.lng<=n.lng;return o&&u},toBBoxString:function(){var e=this._southWest,t=this._northEast;return[e.lng,e.lat,t.lng,t.lat].join(",")},equals:function(e){return e?(e=r.latLngBounds(e),this._southWest.equals(e.getSouthWest())&&this._northEast.equals(e.getNorthEast())):!1},isValid:function(){return!!this._southWest&&!!this._northEast}},r.latLngBounds=function(e,t){return!e||e instanceof r.LatLngBounds?e:new r.LatLngBounds(e,t)},r.Projection={},r.Projection.SphericalMercator={MAX_LATITUDE:85.0511287798,project:function(e){var t=r.LatLng.DEG_TO_RAD,n=this.MAX_LATITUDE,i=Math.max(Math.min(n,e.lat),-n),s=e.lng*t,o=i*t;return o=Math.log(Math.tan(Math.PI/4+o/2)),new r.Point(s,o)},unproject:function(e){var t=r.LatLng.RAD_TO_DEG,n=e.x*t,i=(2*Math.atan(Math.exp(e.y))-Math.PI/2)*t;return new r.LatLng(i,n)}},r.Projection.LonLat={project:function(e){return new r.Point(e.lng,e.lat)},unproject:function(e){return new r.LatLng(e.y,e.x)}},r.CRS={latLngToPoint:function(e,t){var n=this.projection.project(e),r=this.scale(t);return this.transformation._transform(n,r)},pointToLatLng:function(e,t){var n=this.scale(t),r=this.transformation.untransform(e,n);return this.projection.unproject(r)},project:function(e){return this.projection.project(e)},scale:function(e){return 256*Math.pow(2,e)}},r.CRS.Simple=r.extend({},r.CRS,{projection:r.Projection.LonLat,transformation:new r.Transformation(1,0,-1,0),scale:function(e){return Math.pow(2,e)}}),r.CRS.EPSG3857=r.extend({},r.CRS,{code:"EPSG:3857",projection:r.Projection.SphericalMercator,transformation:new r.Transformation(.5/Math.PI,.5,-0.5/Math.PI,.5),project:function(e){var t=this.projection.project(e),n=6378137;return t.multiplyBy(n)}}),r.CRS.EPSG900913=r.extend({},r.CRS.EPSG3857,{code:"EPSG:900913"}),r.CRS.EPSG4326=r.extend({},r.CRS,{code:"EPSG:4326",projection:r.Projection.LonLat,transformation:new r.Transformation(1/360,.5,-1/360,.5)}),r.Map=r.Class.extend({includes:r.Mixin.Events,options:{crs:r.CRS.EPSG3857,fadeAnimation:r.DomUtil.TRANSITION&&!r.Browser.android23,trackResize:!0,markerZoomAnimation:r.DomUtil.TRANSITION&&r.Browser.any3d},initialize:function(e,t){t=r.setOptions(this,t),this._initContainer(e),this._initLayout(),this.callInitHooks(),this._initEvents(),t.maxBounds&&this.setMaxBounds(t.maxBounds),t.center&&t.zoom!==n&&this.setView(r.latLng( t.center),t.zoom,!0),this._initLayers(t.layers)},setView:function(e,t){return this._resetView(r.latLng(e),this._limitZoom(t)),this},setZoom:function(e){return this.setView(this.getCenter(),e)},zoomIn:function(e){return this.setZoom(this._zoom+(e||1))},zoomOut:function(e){return this.setZoom(this._zoom-(e||1))},fitBounds:function(e){var t=this.getBoundsZoom(e);return this.setView(r.latLngBounds(e).getCenter(),t)},fitWorld:function(){var e=new r.LatLng(-60,-170),t=new r.LatLng(85,179);return this.fitBounds(new r.LatLngBounds(e,t))},panTo:function(e){return this.setView(e,this._zoom)},panBy:function(e){return this.fire("movestart"),this._rawPanBy(r.point(e)),this.fire("move"),this.fire("moveend")},setMaxBounds:function(e){if(e=r.latLngBounds(e),this.options.maxBounds=e,!e)return this._boundsMinZoom=null,this;var t=this.getBoundsZoom(e,!0);return this._boundsMinZoom=t,this._loaded&&(t>this._zoom?this.setView(e.getCenter(),t):this.panInsideBounds(e)),this},panInsideBounds:function(e){e=r.latLngBounds(e);var t=this.getBounds(),n=this.project(t.getSouthWest()),i=this.project(t.getNorthEast()),s=this.project(e.getSouthWest()),o=this.project(e.getNorthEast()),u=0,a=0;return i.yo.x&&(u=o.x-i.x),n.y>s.y&&(a=s.y-n.y),n.x=u);return c&&t?null:t?u:u-1},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new r.Point(this._container.clientWidth,this._container.clientHeight),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(){var e=this._getTopLeftPoint();return new r.Bounds(e,e.add(this.getSize()))},getPixelOrigin:function(){return this._initialTopLeftPoint},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(e){var t=this.options.crs;return t.scale(e)/t.scale(this._zoom)},getScaleZoom:function(e){return this._zoom+Math.log(e)/Math.LN2},project:function(e,t){return t=t===n?this._zoom:t,this.options.crs.latLngToPoint(r.latLng(e),t)},unproject:function(e,t){return t=t===n?this._zoom:t,this.options.crs.pointToLatLng(r.point(e),t)},layerPointToLatLng:function(e){var t=r.point(e).add(this._initialTopLeftPoint);return this.unproject(t)},latLngToLayerPoint:function(e){var t=this.project(r.latLng(e))._round();return t._subtract(this._initialTopLeftPoint)},containerPointToLayerPoint:function(e){return r.point(e).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(e){return r.point(e).add(this._getMapPanePos())},containerPointToLatLng:function(e){var t=this.containerPointToLayerPoint(r.point(e));return this.layerPointToLatLng(t)},latLngToContainerPoint:function(e){return this.layerPointToContainerPoint(this.latLngToLayerPoint(r.latLng(e)))},mouseEventToContainerPoint:function(e){return r.DomEvent.getMousePosition(e,this._container)},mouseEventToLayerPoint:function(e){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(e))},mouseEventToLatLng:function(e){return this.layerPointToLatLng(this.mouseEventToLayerPoint(e))},_initContainer:function(e){var t=this._container=r.DomUtil.get(e);if(t._leaflet)throw Error("Map container is already initialized.");t._leaflet=!0},_initLayout:function(){var e=this._container;r.DomUtil.addClass(e,"leaflet-container"),r.Browser.touch&&r.DomUtil.addClass(e,"leaflet-touch"),this.options.fadeAnimation&&r.DomUtil.addClass(e,"leaflet-fade-anim");var t=r.DomUtil.getStyle(e,"position");"absolute"!==t&&"relative"!==t&&"fixed"!==t&&(e.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var e=this._panes={};this._mapPane=e.mapPane=this._createPane("leaflet-map-pane",this._container),this._tilePane=e.tilePane=this._createPane("leaflet-tile-pane",this._mapPane),e.objectsPane=this._createPane("leaflet-objects-pane",this._mapPane),e.shadowPane=this._createPane("leaflet-shadow-pane"),e.overlayPane=this._createPane("leaflet-overlay-pane"),e.markerPane=this._createPane("leaflet-marker-pane"),e.popupPane=this._createPane("leaflet-popup-pane");var t=" leaflet-zoom-hide";this.options.markerZoomAnimation||(r.DomUtil.addClass(e.markerPane,t),r.DomUtil.addClass(e.shadowPane,t),r.DomUtil.addClass(e.popupPane,t))},_createPane:function(e,t){return r.DomUtil.create("div",e,t||this._panes.objectsPane)},_initLayers:function(e){e=e?r.Util.isArray(e)?e:[e]:[],this._layers={},this._zoomBoundLayers={},this._tileLayersNum=0;var t,n;for(t=0,n=e.length;n>t;t++)this.addLayer(e[t])},_resetView:function(e,t,n,i){var s=this._zoom!==t;i||(this.fire("movestart"),s&&this.fire("zoomstart")),this._zoom=t,this._initialTopLeftPoint=this._getNewTopLeftPoint(e),n?this._initialTopLeftPoint._add(this._getMapPanePos()):r.DomUtil.setPosition(this._mapPane,new r.Point(0,0)),this._tileLayersToLoad=this._tileLayersNum;var o=!this._loaded;this._loaded=!0,this.fire("viewreset",{hard:!n}),this.fire("move"),(s||i)&&this.fire("zoomend"),this.fire("moveend",{hard:!n}),o&&this.fire("load")},_rawPanBy:function(e){r.DomUtil.setPosition(this._mapPane,this._getMapPanePos().subtract(e))},_updateZoomLevels:function(){var e,t=1/0,r=-1/0;for(e in this._zoomBoundLayers)if(this._zoomBoundLayers.hasOwnProperty(e)){var i=this._zoomBoundLayers[e];isNaN(i.options.minZoom)||(t=Math.min(t,i.options.minZoom)),isNaN(i.options.maxZoom)||(r=Math.max(r,i.options.maxZoom))}e===n?this._layersMaxZoom=this._layersMinZoom=n:(this._layersMaxZoom=r,this._layersMinZoom=t)},_initEvents:function(){if(r.DomEvent){r.DomEvent.on(this._container,"click",this._onMouseClick,this);var t,n,i=["dblclick","mousedown","mouseup","mouseenter","mouseleave","mousemove","contextmenu"];for(t=0,n=i.length;n>t;t++)r.DomEvent.on(this._container,i[t],this._fireMouseEvent,this);this.options.trackResize&&r.DomEvent.on(e,"resize",this._onResize,this)}},_onResize:function(){r.Util.cancelAnimFrame(this._resizeRequest),this._resizeRequest=r.Util.requestAnimFrame(this.invalidateSize,this,!1,this._container)},_onMouseClick:function(e){!this._loaded||this.dragging&&this.dragging.moved()||(this.fire("preclick"),this._fireMouseEvent(e))},_fireMouseEvent:function(e){if(this._loaded){var t=e.type;if(t="mouseenter"===t?"mouseover":"mouseleave"===t?"mouseout":t,this.hasEventListeners(t)){"contextmenu"===t&&r.DomEvent.preventDefault(e);var n=this.mouseEventToContainerPoint(e),i=this.containerPointToLayerPoint(n),s=this.layerPointToLatLng(i);this.fire(t,{latlng:s,layerPoint:i,containerPoint:n,originalEvent:e})}}},_onTileLayerLoad:function(){this._tileLayersToLoad--,this._tileLayersNum&&!this._tileLayersToLoad&&this._tileBg&&(clearTimeout(this._clearTileBgTimer),this._clearTileBgTimer=setTimeout(r.bind(this._clearTileBg,this),500))},whenReady:function(e,t){return this._loaded?e.call(t||this,this):this.on("load",e,t),this},_getMapPanePos:function(){return r.DomUtil.getPosition(this._mapPane)},_getTopLeftPoint:function(){if(!this._loaded)throw Error("Set map center and zoom first.");return this._initialTopLeftPoint.subtract(this._getMapPanePos())},_getNewTopLeftPoint:function(e,t){var n=this.getSize()._divideBy(2);return this.project(e,t)._subtract(n)._round()},_latLngToNewLayerPoint:function(e,t,n){var r=this._getNewTopLeftPoint(n,t).add(this._getMapPanePos());return this.project(e,t)._subtract(r)},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(e){return this.latLngToLayerPoint(e).subtract(this._getCenterLayerPoint())},_limitZoom:function(e){var t=this.getMinZoom(),n=this.getMaxZoom();return Math.max(t,Math.min(n,e))}}),r.map=function(e,t){return new r.Map(e,t)},r.Projection.Mercator={MAX_LATITUDE:85.0840591556,R_MINOR:6356752.3142,R_MAJOR:6378137,project:function(e){var t=r.LatLng.DEG_TO_RAD,n=this.MAX_LATITUDE,i=Math.max(Math.min(n,e.lat),-n),s=this.R_MAJOR,o=this.R_MINOR,u=e.lng*t*s,a=i*t,f=o/s,l=Math.sqrt(1-f*f),c=l*Math.sin(a);c=Math.pow((1-c)/(1+c),.5*l);var h=Math.tan(.5*(.5*Math.PI-a))/c;return a=-o*Math.log(h),new r.Point(u,a)},unproject:function(e){for(var t,n=r.LatLng.RAD_TO_DEG,i=this.R_MAJOR,s=this.R_MINOR,o=e.x*n/i,u=s/i,a=Math.sqrt(1-u*u),f=Math.exp(-e.y/s),l=Math.PI/2-2*Math.atan(f),c=15,h=1e-7,p=c,d=.1;Math.abs(d)>h&&--p>0;)t=a*Math.sin(l),d=Math.PI/2-2*Math.atan(f*Math.pow((1-t)/(1+t),.5*a))-l,l+=d;return new r.LatLng(l*n,o)}},r.CRS.EPSG3395=r.extend({},r.CRS,{code:"EPSG:3395",projection:r.Projection.Mercator,transformation:function(){var e=r.Projection.Mercator,t=e.R_MAJOR,n=e.R_MINOR;return new r.Transformation(.5/(Math.PI*t),.5,-0.5/(Math.PI*n),.5)}()}),r.TileLayer=r.Class.extend({includes:r.Mixin.Events,options:{minZoom:0,maxZoom:18,tileSize:256,subdomains:"abc",errorTileUrl:"",attribution:"",zoomOffset:0,opacity:1,unloadInvisibleTiles:r.Browser.mobile,updateWhenIdle:r.Browser.mobile},initialize:function(e,t){t=r.setOptions(this,t),t.detectRetina&&r.Browser.retina&&t.maxZoom>0&&(t.tileSize=Math.floor(t.tileSize/2),t.zoomOffset++,t.minZoom>0&&t.minZoom--,this.options.maxZoom--),this._url=e;var n=this.options.subdomains;"string"==typeof n&&(this.options.subdomains=n.split(""))},onAdd:function(e){this._map=e,this._initContainer(),this._createTileProto(),e.on({viewreset:this._resetCallback,moveend:this._update},this),this.options.updateWhenIdle||(this._limitedUpdate=r.Util.limitExecByInterval(this._update,150,this),e.on("move",this._limitedUpdate,this)),this._reset(),this._update()},addTo:function(e){return e.addLayer(this),this},onRemove:function(e){this._container.parentNode.removeChild(this._container),e.off({viewreset:this._resetCallback,moveend:this._update},this),this.options.updateWhenIdle||e.off("move",this._limitedUpdate,this),this._container=null,this._map=null},bringToFront:function(){var e=this._map._panes.tilePane;return this._container&&(e.appendChild(this._container),this._setAutoZIndex(e,Math.max)),this},bringToBack:function(){var e=this._map._panes.tilePane;return this._container&&(e.insertBefore(this._container,e.firstChild),this._setAutoZIndex(e,Math.min)),this},getAttribution:function(){return this.options.attribution},setOpacity:function(e){return this.options.opacity=e,this._map&&this._updateOpacity(),this},setZIndex:function(e){return this.options.zIndex=e,this._updateZIndex(),this},setUrl:function(e,t){return this._url=e,t||this.redraw(),this},redraw:function(){return this._map&&(this._map._panes.tilePane.empty=!1,this._reset(!0),this._update()),this},_updateZIndex:function(){this._container&&this.options.zIndex!==n&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(e,t){var n,r,i,s=e.children,o=-t(1/0,-1/0);for(r=0,i=s.length;i>r;r++)s[r]!==this._container&&(n=parseInt(s[r].style.zIndex,10),isNaN(n)||(o=t(o,n)));this.options.zIndex=this._container.style.zIndex=(isFinite(o)?o:0)+t(1,-1)},_updateOpacity:function(){r.DomUtil.setOpacity(this._container,this.options.opacity);var e,t=this._tiles;if(r.Browser.webkit)for(e in t)t.hasOwnProperty(e)&&(t[e].style.webkitTransform+=" translate(0,0)")},_initContainer:function(){var e=this._map._panes.tilePane;(!this._container||e.empty)&&(this._container=r.DomUtil.create("div","leaflet-layer"),this._updateZIndex(),e.appendChild(this._container),1>this.options.opacity&&this._updateOpacity())},_resetCallback:function(e){this._reset(e.hard)},_reset:function(e){var t=this._tiles;for(var n in t)t.hasOwnProperty(n)&&this.fire("tileunload",{tile:t[n]});this._tiles={},this._tilesToLoad=0,this.options.reuseTiles&&(this._unusedTiles=[]),e&&this._container&&(this._container.innerHTML=""),this._initContainer()},_update:function(){if(this._map){var e=this._map.getPixelBounds(),t=this._map.getZoom(),n=this.options.tileSize;if(!(t>this.options.maxZoom||this.options.minZoom>t)){var i=new r.Point(Math.floor(e.min.x/n),Math.floor(e.min.y/n)),s=new r.Point(Math.floor(e.max.x/n),Math.floor(e.max.y/n)),o=new r.Bounds(i,s);this._addTilesFromCenterOut(o),(this.options.unloadInvisibleTiles||this.options.reuseTiles)&&this._removeOtherTiles(o)}}},_addTilesFromCenterOut:function(e){var n,i,s,o=[],u=e.getCenter();for(n=e.min.y;e.max.y>=n;n++)for(i=e.min.x;e.max.x>=i;i++)s=new r.Point(i,n),this._tileShouldBeLoaded(s)&&o.push(s);var a=o.length;if(0!==a){o.sort(function(e,t){return e.distanceTo(u)-t.distanceTo(u)});var f=t.createDocumentFragment();for(this._tilesToLoad||this.fire("loading"),this._tilesToLoad+=a,i=0;a>i;i++)this._addTile(o[i],f);this._container.appendChild(f)}},_tileShouldBeLoaded:function(e){if(e.x+":"+e.y in this._tiles)return!1;if(!this.options.continuousWorld){var t=this._getWrapTileNum();if(this.options.noWrap&&(0>e.x||e.x>=t)||0>e.y||e.y>=t)return!1}return!0},_removeOtherTiles:function(e){var t,n,r,i;for(i in this._tiles)this._tiles.hasOwnProperty(i)&&(t=i.split(":"),n=parseInt(t[0],10),r=parseInt(t[1],10),(e.min.x>n||n>e.max.x||e.min.y>r||r>e.max.y)&&this._removeTile(i))},_removeTile:function(e){var t=this._tiles[e];this.fire("tileunload",{tile:t,url:t.src}),this.options.reuseTiles?(r.DomUtil.removeClass(t,"leaflet-tile-loaded"),this._unusedTiles.push(t)):t.parentNode===this._container&&this._container.removeChild(t),r.Browser.android||(t.src=r.Util.emptyImageUrl),delete this._tiles[e]},_addTile:function(e,t){var n=this._getTilePos(e),i=this._getTile();r.DomUtil.setPosition(i,n,r.Browser.chrome||r.Browser.android23),this._tiles[e.x+":"+e.y]=i,this._loadTile(i,e),i.parentNode!==this._container&&t.appendChild(i)},_getZoomForUrl:function(){var e=this.options,t=this._map.getZoom();return e.zoomReverse&&(t=e.maxZoom-t),t+e.zoomOffset},_getTilePos:function(e){var t=this._map.getPixelOrigin(),n=this.options.tileSize;return e.multiplyBy(n).subtract(t)},getTileUrl:function(e){return this._adjustTilePoint(e),r.Util.template(this._url,r.extend({s:this._getSubdomain(e),z:this._getZoomForUrl(),x:e.x,y:e.y},this.options))},_getWrapTileNum:function(){return Math.pow(2,this._getZoomForUrl())},_adjustTilePoint:function(e){var t=this._getWrapTileNum();this.options.continuousWorld||this.options.noWrap||(e.x=(e.x%t+t)%t),this.options.tms&&(e.y=t-e.y-1)},_getSubdomain:function(e){var t=(e.x+e.y)%this.options.subdomains.length;return this.options.subdomains[t]},_createTileProto:function(){var e=this._tileImg=r.DomUtil.create("img","leaflet-tile");e.style.width=e.style.height=this.options.tileSize+"px",e.galleryimg="no"},_getTile:function(){if(this.options.reuseTiles&&this._unusedTiles.length>0){var e=this._unusedTiles.pop();return this._resetTile(e),e}return this._createTile()},_resetTile:function(){},_createTile:function(){var e=this._tileImg.cloneNode(!1);return e.onselectstart=e.onmousemove=r.Util.falseFn,e},_loadTile:function(e,t){e._layer=this,e.onload=this._tileOnLoad,e.onerror=this._tileOnError,e.src=this.getTileUrl(t)},_tileLoaded:function(){this._tilesToLoad--,this._tilesToLoad||this.fire("load")},_tileOnLoad:function(){var e=this._layer;this.src!==r.Util.emptyImageUrl&&(r.DomUtil.addClass(this,"leaflet-tile-loaded"),e.fire("tileload",{tile:this,url:this.src})),e._tileLoaded()},_tileOnError:function(){var e=this._layer;e.fire("tileerror",{tile:this,url:this.src});var t=e.options.errorTileUrl;t&&(this.src=t),e._tileLoaded()}}),r.tileLayer=function(e,t){return new r.TileLayer(e,t)},r.TileLayer.WMS=r.TileLayer.extend({defaultWmsParams:{service:"WMS",request:"GetMap",version:"1.1.1",layers:"",styles:"",format:"image/jpeg",transparent:!1},initialize:function(e,t){this._url=e;var n=r.extend({},this.defaultWmsParams);n.width=n.height=t.detectRetina&&r.Browser.retina?2*this.options.tileSize:this.options.tileSize;for(var i in t)this.options.hasOwnProperty(i)||(n[i]=t[i]);this.wmsParams=n,r.setOptions(this,t)},onAdd:function(e){var t=parseFloat(this.wmsParams.version)>=1.3?"crs":"srs";this.wmsParams[t]=e.options.crs.code,r.TileLayer.prototype.onAdd.call(this,e)},getTileUrl:function(e,t){this._adjustTilePoint(e);var n=this._map,i=n.options.crs,s=this.options.tileSize,o=e.multiplyBy(s),u=o.add(new r.Point(s,s)),a=i.project(n.unproject(o,t)),f=i.project(n.unproject(u,t)),l=[a.x,f.y,f.x,a.y].join(","),c=r.Util.template(this._url,{s:this._getSubdomain(e)});return c+r.Util.getParamString(this.wmsParams,c)+"&bbox="+l},setParams:function(e,t){return r.extend(this.wmsParams,e),t||this.redraw(),this}}),r.tileLayer.wms=function(e,t){return new r.TileLayer.WMS(e,t)},r.TileLayer.Canvas=r.TileLayer.extend({options:{async:!1},initialize:function(e){r.setOptions(this,e)},redraw:function(){var e=this._tiles;for(var t in e)e.hasOwnProperty(t)&&this._redrawTile(e[t])},_redrawTile:function(e){this.drawTile(e,e._tilePoint,this._map._zoom)},_createTileProto:function(){var e=this._canvasProto=r.DomUtil.create("canvas","leaflet-tile");e.width=e.height=this.options.tileSize},_createTile:function(){var e=this._canvasProto.cloneNode(!1);return e.onselectstart=e.onmousemove=r.Util.falseFn,e},_loadTile:function(e,t){e._layer=this,e._tilePoint=t,this._redrawTile(e),this.options.async||this.tileDrawn(e)},drawTile:function(){},tileDrawn:function(e){this._tileOnLoad.call(e)}}),r.tileLayer.canvas=function(e){return new r.TileLayer.Canvas(e)},r.ImageOverlay=r.Class.extend({includes:r.Mixin.Events,options:{opacity:1},initialize:function(e,t,n){this._url=e,this._bounds=r.latLngBounds(t),r.setOptions(this,n)},onAdd:function(e){this._map=e,this._image||this._initImage(),e._panes.overlayPane.appendChild(this._image),e.on("viewreset",this._reset,this),e.options.zoomAnimation&&r.Browser.any3d&&e.on("zoomanim",this._animateZoom,this),this._reset()},onRemove:function(e){e.getPanes().overlayPane.removeChild(this._image),e.off("viewreset",this._reset,this),e.options.zoomAnimation&&e.off("zoomanim",this._animateZoom,this)},addTo:function(e){return e.addLayer(this),this},setOpacity:function(e){return this.options.opacity=e,this._updateOpacity(),this},bringToFront:function(){return this._image&&this._map._panes.overlayPane.appendChild(this._image),this},bringToBack:function(){var e=this._map._panes.overlayPane;return this._image&&e.insertBefore(this._image,e.firstChild),this},_initImage:function(){this._image=r.DomUtil.create("img","leaflet-image-layer"),this._map.options.zoomAnimation&&r.Browser.any3d?r.DomUtil.addClass(this._image,"leaflet-zoom-animated"):r.DomUtil.addClass(this._image,"leaflet-zoom-hide"),this._updateOpacity(),r.extend(this._image,{galleryimg:"no",onselectstart:r.Util.falseFn,onmousemove:r.Util.falseFn,onload:r.bind(this._onImageLoad,this),src:this._url})},_animateZoom:function(e){var t=this._map,n=this._image,i=t.getZoomScale(e.zoom),s=this._bounds.getNorthWest(),o=this._bounds.getSouthEast(),u=t._latLngToNewLayerPoint(s,e.zoom,e.center),a=t._latLngToNewLayerPoint(o,e.zoom,e.center)._subtract(u),f=u._add(a._multiplyBy(.5*(1-1/i)));n.style[r.DomUtil.TRANSFORM]=r.DomUtil.getTranslateString(f)+" scale("+i+") "},_reset:function(){var e=this._image,t=this._map.latLngToLayerPoint(this._bounds.getNorthWest()),n=this._map.latLngToLayerPoint(this._bounds.getSouthEast())._subtract(t);r.DomUtil.setPosition(e,t),e.style.width=n.x+"px",e.style.height=n.y+"px"},_onImageLoad:function(){this.fire("load")},_updateOpacity:function(){r.DomUtil.setOpacity(this._image,this.options.opacity)}}),r.imageOverlay=function(e,t,n){return new r.ImageOverlay(e,t,n)},r.Icon=r.Class.extend({options:{className:""},initialize:function(e){r.setOptions(this,e)},createIcon:function(){return this._createIcon("icon")},createShadow:function(){return this._createIcon("shadow")},_createIcon:function(e){var t=this._getIconUrl(e);if(!t){if("icon"===e)throw Error("iconUrl not set in Icon options (see the docs).");return null}var n=this._createImg(t);return this._setIconStyles(n,e),n},_setIconStyles:function(e,t){var n,i=this.options,s=r.point(i[t+"Size"]);n="shadow"===t?r.point(i.shadowAnchor||i.iconAnchor):r.point(i.iconAnchor),!n&&s&&(n=s.divideBy(2,!0)),e.className="leaflet-marker-"+t+" "+i.className,n&&(e.style.marginLeft=-n.x+"px",e.style.marginTop=-n.y+"px"),s&&(e.style.width=s.x+"px",e.style.height=s.y+"px")},_createImg:function(e){var n;return r.Browser.ie6?(n=t.createElement("div"),n.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+e+'")'):(n=t.createElement("img"),n.src=e),n},_getIconUrl:function(e){return r.Browser.retina&&this.options[e+"RetinaUrl"]?this.options[e+"RetinaUrl"]:this.options[e+"Url"]}}),r.icon=function(e){return new r.Icon(e)},r.Icon.Default=r.Icon.extend({options:{iconSize:new r.Point(25,41),iconAnchor:new r.Point(12,41),popupAnchor:new r.Point(1,-34),shadowSize:new r.Point(41,41)},_getIconUrl:function(e){var t=e+"Url";if(this.options[t])return this.options[t];r.Browser.retina&&"icon"===e&&(e+="_2x");var n=r.Icon.Default.imagePath;if(!n)throw Error("Couldn't autodetect L.Icon.Default.imagePath, set it manually.");return n+"/marker-"+e+".png"}}),r.Icon.Default.imagePath=function(){var e,n,r,i,s=t.getElementsByTagName("script"),o=/\/?leaflet[\-\._]?([\w\-\._]*)\.js\??/;for(e=0,n=s.length;n>e;e++)if(r=s[e].src,i=r.match(o))return r.split(o)[0]+"/images"}(),r.Marker=r.Class.extend({includes:r.Mixin.Events,options:{icon:new r.Icon.Default,title:"",clickable:!0,draggable:!1,zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250},initialize:function(e,t){r.setOptions(this,t),this._latlng=r.latLng(e)},onAdd:function(e){this._map=e,e.on("viewreset",this.update,this),this._initIcon(),this.update(),e.options.zoomAnimation&&e.options.markerZoomAnimation&&e.on("zoomanim",this._animateZoom,this)},addTo:function(e){return e.addLayer(this),this},onRemove:function(e){this._removeIcon(),this.fire("remove"),e.off({viewreset:this.update,zoomanim:this._animateZoom},this),this._map=null},getLatLng:function(){return this._latlng},setLatLng:function(e){return this._latlng=r.latLng(e),this.update(),this.fire("move",{latlng:this._latlng})},setZIndexOffset:function(e){return this.options.zIndexOffset=e,this.update(),this},setIcon:function(e){return this._map&&this._removeIcon(),this.options.icon=e,this._map&&(this._initIcon(),this.update()),this},update:function(){if(this._icon){var e=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(e)}return this},_initIcon:function(){var e=this.options,t=this._map,n=t.options.zoomAnimation&&t.options.markerZoomAnimation,i=n?"leaflet-zoom-animated":"leaflet-zoom-hide",s=!1;this._icon||(this._icon=e.icon.createIcon(),e.title&&(this._icon.title=e.title),this._initInteraction(),s=1>this.options.opacity,r.DomUtil.addClass(this._icon,i),e.riseOnHover&&r.DomEvent.on(this._icon,"mouseover",this._bringToFront,this).on(this._icon,"mouseout",this._resetZIndex,this)),this._shadow||(this._shadow=e.icon.createShadow(),this._shadow&&(r.DomUtil.addClass(this._shadow,i),s=1>this.options.opacity)),s&&this._updateOpacity();var o=this._map._panes;o.markerPane.appendChild(this._icon),this._shadow&&o.shadowPane.appendChild(this._shadow)},_removeIcon:function(){var e=this._map._panes;this.options.riseOnHover&&r.DomEvent.off(this._icon,"mouseover",this._bringToFront).off(this._icon,"mouseout",this._resetZIndex),e.markerPane.removeChild(this._icon),this._shadow&&e.shadowPane.removeChild(this._shadow),this._icon=this._shadow=null},_setPos:function(e){r.DomUtil.setPosition(this._icon,e),this._shadow&&r.DomUtil.setPosition(this._shadow,e),this._zIndex=e.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(e){this._icon.style.zIndex=this._zIndex+e},_animateZoom:function(e){var t=this._map._latLngToNewLayerPoint(this._latlng,e.zoom,e.center);this._setPos(t)},_initInteraction:function(){if(this.options.clickable){var e=this._icon,t=["dblclick","mousedown","mouseover","mouseout","contextmenu"];r.DomUtil.addClass(e,"leaflet-clickable"),r.DomEvent.on(e,"click",this._onMouseClick,this);for(var n=0;t.length>n;n++)r.DomEvent.on(e,t[n],this._fireMouseEvent,this);r.Handler.MarkerDrag&&(this.dragging=new r.Handler.MarkerDrag(this),this.options.draggable&&this.dragging.enable())}},_onMouseClick:function(e){var t=this.dragging&&this.dragging.moved();(this.hasEventListeners(e.type)||t)&&r.DomEvent.stopPropagation(e),t||(this.dragging&&this.dragging._enabled||!this._map.dragging||!this._map.dragging.moved())&&this.fire(e.type,{originalEvent:e})},_fireMouseEvent:function(e){this.fire(e.type,{originalEvent:e}),"contextmenu"===e.type&&this.hasEventListeners(e.type)&&r.DomEvent.preventDefault(e),"mousedown"!==e.type&&r.DomEvent.stopPropagation(e)},setOpacity:function(e){this.options.opacity=e,this._map&&this._updateOpacity()},_updateOpacity:function(){r.DomUtil.setOpacity(this._icon,this.options.opacity),this._shadow&&r.DomUtil.setOpacity(this._shadow,this.options.opacity)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)}}),r.marker=function(e,t){return new r.Marker(e,t)},r.DivIcon=r.Icon.extend({options:{iconSize:new r.Point(12,12),className:"leaflet-div-icon"},createIcon:function(){var e=t.createElement("div"),n=this.options;return n.html&&(e.innerHTML=n.html),n.bgPos&&(e.style.backgroundPosition=-n.bgPos.x+"px "+ -n.bgPos.y+"px"),this._setIconStyles(e,"icon"),e},createShadow:function(){return null}}),r.divIcon=function(e){return new r.DivIcon(e)},r.Map.mergeOptions({closePopupOnClick:!0}),r.Popup=r.Class.extend({includes:r.Mixin.Events,options:{minWidth:50,maxWidth:300,maxHeight:null,autoPan:!0,closeButton:!0,offset:new r.Point(0,6),autoPanPadding:new r.Point(5,5),className:"",zoomAnimation:!0},initialize:function(e,t){r.setOptions(this,e),this._source=t,this._animated=r.Browser.any3d&&this.options.zoomAnimation},onAdd:function(e){this._map=e,this._container||this._initLayout(),this._updateContent();var t=e.options.fadeAnimation;t&&r.DomUtil.setOpacity(this._container,0),e._panes.popupPane.appendChild(this._container),e.on("viewreset",this._updatePosition,this),this._animated&&e.on("zoomanim",this._zoomAnimation,this),e.options.closePopupOnClick&&e.on("preclick",this._close,this),this._update(),t&&r.DomUtil.setOpacity(this._container,1)},addTo:function(e){return e.addLayer(this),this},openOn:function(e){return e.openPopup(this),this},onRemove:function(e){e._panes.popupPane.removeChild(this._container),r.Util.falseFn(this._container.offsetWidth),e.off({viewreset:this._updatePosition,preclick:this._close,zoomanim:this._zoomAnimation},this),e.options.fadeAnimation&&r.DomUtil.setOpacity(this._container,0),this._map=null},setLatLng:function(e){return this._latlng=r.latLng(e),this._update(),this},setContent:function(e){return this._content=e,this._update(),this},_close:function(){var e=this._map;e&&(e._popup=null,e.removeLayer(this).fire("popupclose",{popup:this}))},_initLayout:function(){var e,t="leaflet-popup",n=t+" "+this.options.className+" leaflet-zoom-"+(this._animated?"animated":"hide"),i=this._container=r.DomUtil.create("div",n);this.options.closeButton&&(e=this._closeButton=r.DomUtil.create("a",t+"-close-button",i),e.href="#close",e.innerHTML="×",r.DomEvent.on(e,"click",this._onCloseButtonClick,this));var s=this._wrapper=r.DomUtil.create("div",t+"-content-wrapper",i);r.DomEvent.disableClickPropagation(s),this._contentNode=r.DomUtil.create("div",t+"-content",s),r.DomEvent.on(this._contentNode,"mousewheel",r.DomEvent.stopPropagation),this._tipContainer=r.DomUtil.create("div",t+"-tip-container",i),this._tip=r.DomUtil.create("div",t+"-tip",this._tipContainer)},_update:function(){this._map&&(this._container.style.visibility="hidden",this._updateContent(),this._updateLayout(),this._updatePosition(),this._container.style.visibility="",this._adjustPan())},_updateContent:function(){if(this._content){if("string"==typeof this._content)this._contentNode.innerHTML=this._content;else{for(;this._contentNode.hasChildNodes();)this._contentNode.removeChild(this._contentNode.firstChild);this._contentNode.appendChild(this._content)}this.fire("contentupdate")}},_updateLayout:function(){var e=this._contentNode,t=e.style;t.width="",t.whiteSpace="nowrap";var n=e.offsetWidth;n=Math.min(n,this.options.maxWidth),n=Math.max(n,this.options.minWidth),t.width=n+1+"px",t.whiteSpace="",t.height="";var i=e.offsetHeight,s=this.options.maxHeight,o="leaflet-popup-scrolled";s&&i>s?(t.height=s+"px",r.DomUtil.addClass(e,o)):r.DomUtil.removeClass(e,o),this._containerWidth=this._container.offsetWidth},_updatePosition:function(){if(this._map){var e=this._map.latLngToLayerPoint(this._latlng),t=this._animated,n=this.options.offset;t&&r.DomUtil.setPosition(this._container,e),this._containerBottom=-n.y-(t?0:e.y),this._containerLeft=-Math.round(this._containerWidth/2)+n.x+(t?0:e.x),this._container.style.bottom=this._containerBottom+"px",this._container.style.left=this._containerLeft+"px"}},_zoomAnimation:function(e){var t=this._map._latLngToNewLayerPoint(this._latlng,e.zoom,e.center);r.DomUtil.setPosition(this._container,t)},_adjustPan:function(){if(this.options.autoPan){var e=this._map,t=this._container.offsetHeight,n=this._containerWidth,i=new r.Point(this._containerLeft,-t-this._containerBottom);this._animated&&i._add(r.DomUtil.getPosition(this._container));var s=e.layerPointToContainerPoint(i),o=this.options.autoPanPadding,u=e.getSize(),a=0,f=0;0>s.x&&(a=s.x-o.x),s.x+n>u.x&&(a=s.x+n-u.x+o.x),0>s.y&&(f=s.y-o.y),s.y+t>u.y&&(f=s.y+t-u.y+o.y),(a||f)&&e.panBy(new r.Point(a,f))}},_onCloseButtonClick:function(e){this._close(),r.DomEvent.stop(e)}}),r.popup=function(e,t){return new r.Popup(e,t)},r.Marker.include({openPopup:function(){return this._popup&&this._map&&(this._popup.setLatLng(this._latlng),this._map.openPopup(this._popup)),this},closePopup:function(){return this._popup&&this._popup._close(),this},bindPopup:function(e,t){var n=r.point(this.options.icon.options.popupAnchor)||new r.Point(0,0);return n=n.add(r.Popup.prototype.options.offset),t&&t.offset&&(n=n.add(t.offset)),t=r.extend({offset:n},t),this._popup||this.on("click",this.openPopup,this).on("remove",this.closePopup,this).on("move",this._movePopup,this),this._popup=(new r.Popup(t,this)).setContent(e),this},unbindPopup:function(){return this._popup&&(this._popup=null,this.off("click",this.openPopup).off("remove",this.closePopup).off("move",this._movePopup)),this},_movePopup:function(e){this._popup.setLatLng(e.latlng)}}),r.Map.include({openPopup:function(e){return this.closePopup(),this._popup=e,this.addLayer(e).fire("popupopen",{popup:this._popup})},closePopup:function(){return this._popup&&this._popup._close(),this}}),r.LayerGroup=r.Class.extend({initialize:function(e){this._layers={};var t,n;if(e)for(t=0,n=e.length;n>t;t++)this.addLayer(e[t])},addLayer:function(e){var t=r.stamp(e);return this._layers[t]=e,this._map&&this._map.addLayer(e),this},removeLayer:function(e){var t= r.stamp(e);return delete this._layers[t],this._map&&this._map.removeLayer(e),this},clearLayers:function(){return this.eachLayer(this.removeLayer,this),this},invoke:function(e){var t,n,r=Array.prototype.slice.call(arguments,1);for(t in this._layers)this._layers.hasOwnProperty(t)&&(n=this._layers[t],n[e]&&n[e].apply(n,r));return this},onAdd:function(e){this._map=e,this.eachLayer(e.addLayer,e)},onRemove:function(e){this.eachLayer(e.removeLayer,e),this._map=null},addTo:function(e){return e.addLayer(this),this},eachLayer:function(e,t){for(var n in this._layers)this._layers.hasOwnProperty(n)&&e.call(t,this._layers[n])},setZIndex:function(e){return this.invoke("setZIndex",e)}}),r.layerGroup=function(e){return new r.LayerGroup(e)},r.FeatureGroup=r.LayerGroup.extend({includes:r.Mixin.Events,statics:{EVENTS:"click dblclick mouseover mouseout mousemove contextmenu"},addLayer:function(e){return this._layers[r.stamp(e)]?this:(e.on(r.FeatureGroup.EVENTS,this._propagateEvent,this),r.LayerGroup.prototype.addLayer.call(this,e),this._popupContent&&e.bindPopup&&e.bindPopup(this._popupContent,this._popupOptions),this.fire("layeradd",{layer:e}))},removeLayer:function(e){return e.off(r.FeatureGroup.EVENTS,this._propagateEvent,this),r.LayerGroup.prototype.removeLayer.call(this,e),this._popupContent&&this.invoke("unbindPopup"),this.fire("layerremove",{layer:e})},bindPopup:function(e,t){return this._popupContent=e,this._popupOptions=t,this.invoke("bindPopup",e,t)},setStyle:function(e){return this.invoke("setStyle",e)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var e=new r.LatLngBounds;return this.eachLayer(function(t){e.extend(t instanceof r.Marker?t.getLatLng():t.getBounds())}),e},_propagateEvent:function(e){e.layer=e.target,e.target=this,this.fire(e.type,e)}}),r.featureGroup=function(e){return new r.FeatureGroup(e)},r.Path=r.Class.extend({includes:[r.Mixin.Events],statics:{CLIP_PADDING:r.Browser.mobile?Math.max(0,Math.min(.5,(1280/Math.max(e.innerWidth,e.innerHeight)-1)/2)):.5},options:{stroke:!0,color:"#0033ff",dashArray:null,weight:5,opacity:.5,fill:!1,fillColor:null,fillOpacity:.2,clickable:!0},initialize:function(e){r.setOptions(this,e)},onAdd:function(e){this._map=e,this._container||(this._initElements(),this._initEvents()),this.projectLatlngs(),this._updatePath(),this._container&&this._map._pathRoot.appendChild(this._container),this.fire("add"),e.on({viewreset:this.projectLatlngs,moveend:this._updatePath},this)},addTo:function(e){return e.addLayer(this),this},onRemove:function(e){e._pathRoot.removeChild(this._container),this.fire("remove"),this._map=null,r.Browser.vml&&(this._container=null,this._stroke=null,this._fill=null),e.off({viewreset:this.projectLatlngs,moveend:this._updatePath},this)},projectLatlngs:function(){},setStyle:function(e){return r.setOptions(this,e),this._container&&this._updateStyle(),this},redraw:function(){return this._map&&(this.projectLatlngs(),this._updatePath()),this}}),r.Map.include({_updatePathViewport:function(){var e=r.Path.CLIP_PADDING,t=this.getSize(),n=r.DomUtil.getPosition(this._mapPane),i=n.multiplyBy(-1)._subtract(t.multiplyBy(e)._round()),s=i.add(t.multiplyBy(1+2*e)._round());this._pathViewport=new r.Bounds(i,s)}}),r.Path.SVG_NS="http://www.w3.org/2000/svg",r.Browser.svg=!!t.createElementNS&&!!t.createElementNS(r.Path.SVG_NS,"svg").createSVGRect,r.Path=r.Path.extend({statics:{SVG:r.Browser.svg},bringToFront:function(){var e=this._map._pathRoot,t=this._container;return t&&e.lastChild!==t&&e.appendChild(t),this},bringToBack:function(){var e=this._map._pathRoot,t=this._container,n=e.firstChild;return t&&n!==t&&e.insertBefore(t,n),this},getPathString:function(){},_createElement:function(e){return t.createElementNS(r.Path.SVG_NS,e)},_initElements:function(){this._map._initPathRoot(),this._initPath(),this._initStyle()},_initPath:function(){this._container=this._createElement("g"),this._path=this._createElement("path"),this._container.appendChild(this._path)},_initStyle:function(){this.options.stroke&&(this._path.setAttribute("stroke-linejoin","round"),this._path.setAttribute("stroke-linecap","round")),this.options.fill&&this._path.setAttribute("fill-rule","evenodd"),this._updateStyle()},_updateStyle:function(){this.options.stroke?(this._path.setAttribute("stroke",this.options.color),this._path.setAttribute("stroke-opacity",this.options.opacity),this._path.setAttribute("stroke-width",this.options.weight),this.options.dashArray?this._path.setAttribute("stroke-dasharray",this.options.dashArray):this._path.removeAttribute("stroke-dasharray")):this._path.setAttribute("stroke","none"),this.options.fill?(this._path.setAttribute("fill",this.options.fillColor||this.options.color),this._path.setAttribute("fill-opacity",this.options.fillOpacity)):this._path.setAttribute("fill","none")},_updatePath:function(){var e=this.getPathString();e||(e="M0 0"),this._path.setAttribute("d",e)},_initEvents:function(){if(this.options.clickable){(r.Browser.svg||!r.Browser.vml)&&this._path.setAttribute("class","leaflet-clickable"),r.DomEvent.on(this._container,"click",this._onMouseClick,this);for(var e=["dblclick","mousedown","mouseover","mouseout","mousemove","contextmenu"],t=0;e.length>t;t++)r.DomEvent.on(this._container,e[t],this._fireMouseEvent,this)}},_onMouseClick:function(e){this._map.dragging&&this._map.dragging.moved()||this._fireMouseEvent(e)},_fireMouseEvent:function(e){if(this.hasEventListeners(e.type)){var t=this._map,n=t.mouseEventToContainerPoint(e),i=t.containerPointToLayerPoint(n),s=t.layerPointToLatLng(i);this.fire(e.type,{latlng:s,layerPoint:i,containerPoint:n,originalEvent:e}),"contextmenu"===e.type&&r.DomEvent.preventDefault(e),"mousemove"!==e.type&&r.DomEvent.stopPropagation(e)}}}),r.Map.include({_initPathRoot:function(){this._pathRoot||(this._pathRoot=r.Path.prototype._createElement("svg"),this._panes.overlayPane.appendChild(this._pathRoot),this.options.zoomAnimation&&r.Browser.any3d?(this._pathRoot.setAttribute("class"," leaflet-zoom-animated"),this.on({zoomanim:this._animatePathZoom,zoomend:this._endPathZoom})):this._pathRoot.setAttribute("class"," leaflet-zoom-hide"),this.on("moveend",this._updateSvgViewport),this._updateSvgViewport())},_animatePathZoom:function(e){var t=this.getZoomScale(e.zoom),n=this._getCenterOffset(e.center)._multiplyBy(-t)._add(this._pathViewport.min);this._pathRoot.style[r.DomUtil.TRANSFORM]=r.DomUtil.getTranslateString(n)+" scale("+t+") ",this._pathZooming=!0},_endPathZoom:function(){this._pathZooming=!1},_updateSvgViewport:function(){if(!this._pathZooming){this._updatePathViewport();var e=this._pathViewport,t=e.min,n=e.max,i=n.x-t.x,s=n.y-t.y,o=this._pathRoot,u=this._panes.overlayPane;r.Browser.mobileWebkit&&u.removeChild(o),r.DomUtil.setPosition(o,t),o.setAttribute("width",i),o.setAttribute("height",s),o.setAttribute("viewBox",[t.x,t.y,i,s].join(" ")),r.Browser.mobileWebkit&&u.appendChild(o)}}}),r.Path.include({bindPopup:function(e,t){return(!this._popup||t)&&(this._popup=new r.Popup(t,this)),this._popup.setContent(e),this._popupHandlersAdded||(this.on("click",this._openPopup,this).on("remove",this.closePopup,this),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this._popup=null,this.off("click",this._openPopup).off("remove",this.closePopup),this._popupHandlersAdded=!1),this},openPopup:function(e){return this._popup&&(e=e||this._latlng||this._latlngs[Math.floor(this._latlngs.length/2)],this._openPopup({latlng:e})),this},closePopup:function(){return this._popup&&this._popup._close(),this},_openPopup:function(e){this._popup.setLatLng(e.latlng),this._map.openPopup(this._popup)}}),r.Browser.vml=!r.Browser.svg&&function(){try{var e=t.createElement("div");e.innerHTML='';var n=e.firstChild;return n.style.behavior="url(#default#VML)",n&&"object"==typeof n.adj}catch(r){return!1}}(),r.Path=r.Browser.svg||!r.Browser.vml?r.Path:r.Path.extend({statics:{VML:!0,CLIP_PADDING:.02},_createElement:function(){try{return t.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(e){return t.createElement("')}}catch(e){return function(e){return t.createElement("<"+e+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}}(),_initPath:function(){var e=this._container=this._createElement("shape");r.DomUtil.addClass(e,"leaflet-vml-shape"),this.options.clickable&&r.DomUtil.addClass(e,"leaflet-clickable"),e.coordsize="1 1",this._path=this._createElement("path"),e.appendChild(this._path),this._map._pathRoot.appendChild(e)},_initStyle:function(){this._updateStyle()},_updateStyle:function(){var e=this._stroke,t=this._fill,n=this.options,r=this._container;r.stroked=n.stroke,r.filled=n.fill,n.stroke?(e||(e=this._stroke=this._createElement("stroke"),e.endcap="round",r.appendChild(e)),e.weight=n.weight+"px",e.color=n.color,e.opacity=n.opacity,e.dashStyle=n.dashArray?n.dashArray instanceof Array?n.dashArray.join(" "):n.dashArray.replace(/ *, */g," "):""):e&&(r.removeChild(e),this._stroke=null),n.fill?(t||(t=this._fill=this._createElement("fill"),r.appendChild(t)),t.color=n.fillColor||n.color,t.opacity=n.fillOpacity):t&&(r.removeChild(t),this._fill=null)},_updatePath:function(){var e=this._container.style;e.display="none",this._path.v=this.getPathString()+" ",e.display=""}}),r.Map.include(r.Browser.svg||!r.Browser.vml?{}:{_initPathRoot:function(){if(!this._pathRoot){var e=this._pathRoot=t.createElement("div");e.className="leaflet-vml-container",this._panes.overlayPane.appendChild(e),this.on("moveend",this._updatePathViewport),this._updatePathViewport()}}}),r.Browser.canvas=function(){return!!t.createElement("canvas").getContext}(),r.Path=r.Path.SVG&&!e.L_PREFER_CANVAS||!r.Browser.canvas?r.Path:r.Path.extend({statics:{CANVAS:!0,SVG:!1},redraw:function(){return this._map&&(this.projectLatlngs(),this._requestUpdate()),this},setStyle:function(e){return r.setOptions(this,e),this._map&&(this._updateStyle(),this._requestUpdate()),this},onRemove:function(e){e.off("viewreset",this.projectLatlngs,this).off("moveend",this._updatePath,this),this.options.clickable&&this._map.off("click",this._onClick,this),this._requestUpdate(),this._map=null},_requestUpdate:function(){this._map&&!r.Path._updateRequest&&(r.Path._updateRequest=r.Util.requestAnimFrame(this._fireMapMoveEnd,this._map))},_fireMapMoveEnd:function(){r.Path._updateRequest=null,this.fire("moveend")},_initElements:function(){this._map._initPathRoot(),this._ctx=this._map._canvasCtx},_updateStyle:function(){var e=this.options;e.stroke&&(this._ctx.lineWidth=e.weight,this._ctx.strokeStyle=e.color),e.fill&&(this._ctx.fillStyle=e.fillColor||e.color)},_drawPath:function(){var e,t,n,i,s,o;for(this._ctx.beginPath(),e=0,n=this._parts.length;n>e;e++){for(t=0,i=this._parts[e].length;i>t;t++)s=this._parts[e][t],o=(0===t?"move":"line")+"To",this._ctx[o](s.x,s.y);this instanceof r.Polygon&&this._ctx.closePath()}},_checkIfEmpty:function(){return!this._parts.length},_updatePath:function(){if(!this._checkIfEmpty()){var e=this._ctx,t=this.options;this._drawPath(),e.save(),this._updateStyle(),t.fill&&(e.globalAlpha=t.fillOpacity,e.fill()),t.stroke&&(e.globalAlpha=t.opacity,e.stroke()),e.restore()}},_initEvents:function(){this.options.clickable&&this._map.on("click",this._onClick,this)},_onClick:function(e){this._containsPoint(e.layerPoint)&&this.fire("click",{latlng:e.latlng,layerPoint:e.layerPoint,containerPoint:e.containerPoint,originalEvent:e})}}),r.Map.include(r.Path.SVG&&!e.L_PREFER_CANVAS||!r.Browser.canvas?{}:{_initPathRoot:function(){var e,n=this._pathRoot;n||(n=this._pathRoot=t.createElement("canvas"),n.style.position="absolute",e=this._canvasCtx=n.getContext("2d"),e.lineCap="round",e.lineJoin="round",this._panes.overlayPane.appendChild(n),this.options.zoomAnimation&&(this._pathRoot.className="leaflet-zoom-animated",this.on("zoomanim",this._animatePathZoom),this.on("zoomend",this._endPathZoom)),this.on("moveend",this._updateCanvasViewport),this._updateCanvasViewport())},_updateCanvasViewport:function(){if(!this._pathZooming){this._updatePathViewport();var e=this._pathViewport,t=e.min,n=e.max.subtract(t),i=this._pathRoot;r.DomUtil.setPosition(i,t),i.width=n.x,i.height=n.y,i.getContext("2d").translate(-t.x,-t.y)}}}),r.LineUtil={simplify:function(e,t){if(!t||!e.length)return e.slice();var n=t*t;return e=this._reducePoints(e,n),e=this._simplifyDP(e,n)},pointToSegmentDistance:function(e,t,n){return Math.sqrt(this._sqClosestPointOnSegment(e,t,n,!0))},closestPointOnSegment:function(e,t,n){return this._sqClosestPointOnSegment(e,t,n)},_simplifyDP:function(e,t){var r=e.length,i=typeof Uint8Array!=n+""?Uint8Array:Array,s=new i(r);s[0]=s[r-1]=1,this._simplifyDPStep(e,s,t,0,r-1);var o,u=[];for(o=0;r>o;o++)s[o]&&u.push(e[o]);return u},_simplifyDPStep:function(e,t,n,r,i){var s,o,u,a=0;for(o=r+1;i-1>=o;o++)u=this._sqClosestPointOnSegment(e[o],e[r],e[i],!0),u>a&&(s=o,a=u);a>n&&(t[s]=1,this._simplifyDPStep(e,t,n,r,s),this._simplifyDPStep(e,t,n,s,i))},_reducePoints:function(e,t){for(var n=[e[0]],r=1,i=0,s=e.length;s>r;r++)this._sqDist(e[r],e[i])>t&&(n.push(e[r]),i=r);return s-1>i&&n.push(e[s-1]),n},clipSegment:function(e,t,n,r){var i,s,o,u=r?this._lastCode:this._getBitCode(e,n),a=this._getBitCode(t,n);for(this._lastCode=a;;){if(!(u|a))return[e,t];if(u&a)return!1;i=u||a,s=this._getEdgeIntersection(e,t,i,n),o=this._getBitCode(s,n),i===u?(e=s,u=o):(t=s,a=o)}},_getEdgeIntersection:function(e,t,i,s){var o=t.x-e.x,u=t.y-e.y,a=s.min,f=s.max;return 8&i?new r.Point(e.x+o*(f.y-e.y)/u,f.y):4&i?new r.Point(e.x+o*(a.y-e.y)/u,a.y):2&i?new r.Point(f.x,e.y+u*(f.x-e.x)/o):1&i?new r.Point(a.x,e.y+u*(a.x-e.x)/o):n},_getBitCode:function(e,t){var n=0;return e.xt.max.x&&(n|=2),e.yt.max.y&&(n|=8),n},_sqDist:function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},_sqClosestPointOnSegment:function(e,t,n,i){var s,o=t.x,u=t.y,a=n.x-o,f=n.y-u,l=a*a+f*f;return l>0&&(s=((e.x-o)*a+(e.y-u)*f)/l,s>1?(o=n.x,u=n.y):s>0&&(o+=a*s,u+=f*s)),a=e.x-o,f=e.y-u,i?a*a+f*f:new r.Point(o,u)}},r.Polyline=r.Path.extend({initialize:function(e,t){r.Path.prototype.initialize.call(this,t),this._latlngs=this._convertLatLngs(e)},options:{smoothFactor:1,noClip:!1},projectLatlngs:function(){this._originalPoints=[];for(var e=0,t=this._latlngs.length;t>e;e++)this._originalPoints[e]=this._map.latLngToLayerPoint(this._latlngs[e])},getPathString:function(){for(var e=0,t=this._parts.length,n="";t>e;e++)n+=this._getPathPartStr(this._parts[e]);return n},getLatLngs:function(){return this._latlngs},setLatLngs:function(e){return this._latlngs=this._convertLatLngs(e),this.redraw()},addLatLng:function(e){return this._latlngs.push(r.latLng(e)),this.redraw()},spliceLatLngs:function(){var e=[].splice.apply(this._latlngs,arguments);return this._convertLatLngs(this._latlngs),this.redraw(),e},closestLayerPoint:function(e){for(var t,n,i=1/0,s=this._parts,o=null,u=0,a=s.length;a>u;u++)for(var f=s[u],l=1,c=f.length;c>l;l++){t=f[l-1],n=f[l];var h=r.LineUtil._sqClosestPointOnSegment(e,t,n,!0);i>h&&(i=h,o=r.LineUtil._sqClosestPointOnSegment(e,t,n))}return o&&(o.distance=Math.sqrt(i)),o},getBounds:function(){var e,t,n=new r.LatLngBounds,i=this.getLatLngs();for(e=0,t=i.length;t>e;e++)n.extend(i[e]);return n},_convertLatLngs:function(e){var t,n;for(t=0,n=e.length;n>t;t++){if(r.Util.isArray(e[t])&&"number"!=typeof e[t][0])return;e[t]=r.latLng(e[t])}return e},_initEvents:function(){r.Path.prototype._initEvents.call(this)},_getPathPartStr:function(e){for(var t,n=r.Path.VML,i=0,s=e.length,o="";s>i;i++)t=e[i],n&&t._round(),o+=(i?"L":"M")+t.x+" "+t.y;return o},_clipPoints:function(){var e,t,i,s=this._originalPoints,o=s.length;if(this.options.noClip)return this._parts=[s],n;this._parts=[];var u=this._parts,a=this._map._pathViewport,f=r.LineUtil;for(e=0,t=0;o-1>e;e++)i=f.clipSegment(s[e],s[e+1],a,e),i&&(u[t]=u[t]||[],u[t].push(i[0]),(i[1]!==s[e+1]||e===o-2)&&(u[t].push(i[1]),t++))},_simplifyPoints:function(){for(var e=this._parts,t=r.LineUtil,n=0,i=e.length;i>n;n++)e[n]=t.simplify(e[n],this.options.smoothFactor)},_updatePath:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),r.Path.prototype._updatePath.call(this))}}),r.polyline=function(e,t){return new r.Polyline(e,t)},r.PolyUtil={},r.PolyUtil.clipPolygon=function(e,t){var n,i,s,o,u,a,f,l,c,h=[1,4,2,8],p=r.LineUtil;for(i=0,f=e.length;f>i;i++)e[i]._code=p._getBitCode(e[i],t);for(o=0;4>o;o++){for(l=h[o],n=[],i=0,f=e.length,s=f-1;f>i;s=i++)u=e[i],a=e[s],u._code&l?a._code&l||(c=p._getEdgeIntersection(a,u,l,t),c._code=p._getBitCode(c,t),n.push(c)):(a._code&l&&(c=p._getEdgeIntersection(a,u,l,t),c._code=p._getBitCode(c,t),n.push(c)),n.push(u));e=n}return e},r.Polygon=r.Polyline.extend({options:{fill:!0},initialize:function(e,t){r.Polyline.prototype.initialize.call(this,e,t),e&&r.Util.isArray(e[0])&&"number"!=typeof e[0][0]&&(this._latlngs=this._convertLatLngs(e[0]),this._holes=e.slice(1))},projectLatlngs:function(){if(r.Polyline.prototype.projectLatlngs.call(this),this._holePoints=[],this._holes){var e,t,n,i;for(e=0,n=this._holes.length;n>e;e++)for(this._holePoints[e]=[],t=0,i=this._holes[e].length;i>t;t++)this._holePoints[e][t]=this._map.latLngToLayerPoint(this._holes[e][t])}},_clipPoints:function(){var e=this._originalPoints,t=[];if(this._parts=[e].concat(this._holePoints),!this.options.noClip){for(var n=0,i=this._parts.length;i>n;n++){var s=r.PolyUtil.clipPolygon(this._parts[n],this._map._pathViewport);s.length&&t.push(s)}this._parts=t}},_getPathPartStr:function(e){var t=r.Polyline.prototype._getPathPartStr.call(this,e);return t+(r.Browser.svg?"z":"x")}}),r.polygon=function(e,t){return new r.Polygon(e,t)},function(){function e(e){return r.FeatureGroup.extend({initialize:function(e,t){this._layers={},this._options=t,this.setLatLngs(e)},setLatLngs:function(t){var n=0,r=t.length;for(this.eachLayer(function(e){r>n?e.setLatLngs(t[n++]):this.removeLayer(e)},this);r>n;)this.addLayer(new e(t[n++],this._options));return this}})}r.MultiPolyline=e(r.Polyline),r.MultiPolygon=e(r.Polygon),r.multiPolyline=function(e,t){return new r.MultiPolyline(e,t)},r.multiPolygon=function(e,t){return new r.MultiPolygon(e,t)}}(),r.Rectangle=r.Polygon.extend({initialize:function(e,t){r.Polygon.prototype.initialize.call(this,this._boundsToLatLngs(e),t)},setBounds:function(e){this.setLatLngs(this._boundsToLatLngs(e))},_boundsToLatLngs:function(e){return e=r.latLngBounds(e),[e.getSouthWest(),e.getNorthWest(),e.getNorthEast(),e.getSouthEast()]}}),r.rectangle=function(e,t){return new r.Rectangle(e,t)},r.Circle=r.Path.extend({initialize:function(e,t,n){r.Path.prototype.initialize.call(this,n),this._latlng=r.latLng(e),this._mRadius=t},options:{fill:!0},setLatLng:function(e){return this._latlng=r.latLng(e),this.redraw()},setRadius:function(e){return this._mRadius=e,this.redraw()},projectLatlngs:function(){var e=this._getLngRadius(),t=new r.LatLng(this._latlng.lat,this._latlng.lng-e),n=this._map.latLngToLayerPoint(t);this._point=this._map.latLngToLayerPoint(this._latlng),this._radius=Math.max(Math.round(this._point.x-n.x),1)},getBounds:function(){var e=this._getLngRadius(),t=360*(this._mRadius/40075017),n=this._latlng,i=new r.LatLng(n.lat-t,n.lng-e),s=new r.LatLng(n.lat+t,n.lng+e);return new r.LatLngBounds(i,s)},getLatLng:function(){return this._latlng},getPathString:function(){var e=this._point,t=this._radius;return this._checkIfEmpty()?"":r.Browser.svg?"M"+e.x+","+(e.y-t)+"A"+t+","+t+",0,1,1,"+(e.x-.1)+","+(e.y-t)+" z":(e._round(),t=Math.round(t),"AL "+e.x+","+e.y+" "+t+","+t+" 0,"+23592600)},getRadius:function(){return this._mRadius},_getLatRadius:function(){return 360*(this._mRadius/40075017)},_getLngRadius:function(){return this._getLatRadius()/Math.cos(r.LatLng.DEG_TO_RAD*this._latlng.lat)},_checkIfEmpty:function(){if(!this._map)return!1;var e=this._map._pathViewport,t=this._radius,n=this._point;return n.x-t>e.max.x||n.y-t>e.max.y||n.x+tn;n++)for(f=this._parts[n],i=0,u=f.length,s=u-1;u>i;s=i++)if((t||0!==i)&&(a=r.LineUtil.pointToSegmentDistance(e,f[s],f[i]),l>=a))return!0;return!1}}:{}),r.Polygon.include(r.Path.CANVAS?{_containsPoint:function(e){var t,n,i,s,o,u,a,f,l=!1;if(r.Polyline.prototype._containsPoint.call(this,e,!0))return!0;for(s=0,a=this._parts.length;a>s;s++)for(t=this._parts[s],o=0,f=t.length,u=f-1;f>o;u=o++)n=t[o],i=t[u],n.y>e.y!=i.y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(l=!l);return l}}:{}),r.Circle.include(r.Path.CANVAS?{_drawPath:function(){var e=this._point;this._ctx.beginPath(),this._ctx.arc(e.x,e.y,this._radius,0,2*Math.PI,!1)},_containsPoint:function(e){var t=this._point,n=this.options.stroke?this.options.weight/2:0;return e.distanceTo(t)<=this._radius+n}}:{}),r.GeoJSON=r.FeatureGroup.extend({initialize:function(e,t){r.setOptions(this,t),this._layers={},e&&this.addData(e)},addData:function(e){var t,n,i=r.Util.isArray(e)?e:e.features;if(i){for(t=0,n=i.length;n>t;t++)(i[t].geometries||i[t].geometry)&&this.addData(i[t]);return this}var s=this.options;if(!s.filter||s.filter(e)){var o=r.GeoJSON.geometryToLayer(e,s.pointToLayer);return o.feature=e,o.defaultOptions=o.options,this.resetStyle(o),s.onEachFeature&&s.onEachFeature(e,o),this.addLayer(o)}},resetStyle:function(e){var t=this.options.style;t&&(r.Util.extend(e.options,e.defaultOptions),this._setLayerStyle(e,t))},setStyle:function(e){this.eachLayer(function(t){this._setLayerStyle(t,e)},this)},_setLayerStyle:function(e,t){"function"==typeof t&&(t=t(e.feature)),e.setStyle&&e.setStyle(t)}}),r.extend(r.GeoJSON,{geometryToLayer:function(e,t){var n,i,s,o,u,a="Feature"===e.type?e.geometry:e,f=a.coordinates,l=[];switch(a.type){case"Point":return n=this.coordsToLatLng(f),t?t(e,n):new r.Marker(n);case"MultiPoint":for(s=0,o=f.length;o>s;s++)n=this.coordsToLatLng(f[s]),u=t?t(e,n):new r.Marker(n),l.push(u);return new r.FeatureGroup(l);case"LineString":return i=this.coordsToLatLngs(f),new r.Polyline(i);case"Polygon":return i=this.coordsToLatLngs(f,1),new r.Polygon(i);case"MultiLineString":return i=this.coordsToLatLngs(f,1),new r.MultiPolyline(i);case"MultiPolygon":return i=this.coordsToLatLngs(f,2),new r.MultiPolygon(i);case"GeometryCollection":for(s=0,o=a.geometries.length;o>s;s++)u=this.geometryToLayer({geometry:a.geometries[s],type:"Feature",properties:e.properties},t),l.push(u);return new r.FeatureGroup(l);default:throw Error("Invalid GeoJSON object.")}},coordsToLatLng:function(e,t){var n=parseFloat(e[t?0:1]),i=parseFloat(e[t?1:0]);return new r.LatLng(n,i)},coordsToLatLngs:function(e,t,n){var r,i,s,o=[];for(i=0,s=e.length;s>i;i++)r=t?this.coordsToLatLngs(e[i],t-1,n):this.coordsToLatLng(e[i],n),o.push(r);return o}}),r.geoJson=function(e,t){return new r.GeoJSON(e,t)},r.DomEvent={addListener:function(e,t,i,s){var o,u,a,f=r.stamp(i),l="_leaflet_"+t+f;return e[l]?this:(o=function(t){return i.call(s||e,t||r.DomEvent._getEvent())},r.Browser.msTouch&&0===t.indexOf("touch")?this.addMsTouchListener(e,t,o,f):(r.Browser.touch&&"dblclick"===t&&this.addDoubleTapListener&&this.addDoubleTapListener(e,o,f),"addEventListener"in e?"mousewheel"===t?(e.addEventListener("DOMMouseScroll",o,!1),e.addEventListener(t,o,!1)):"mouseenter"===t||"mouseleave"===t?(u=o,a="mouseenter"===t?"mouseover":"mouseout",o=function(t){return r.DomEvent._checkMouse(e,t)?u(t):n},e.addEventListener(a,o,!1)):e.addEventListener(t,o,!1):"attachEvent"in e&&e.attachEvent("on"+t,o),e[l]=o,this))},removeListener:function(e,t,n){var i=r.stamp(n),s="_leaflet_"+t+i,o=e[s];if(o)return r.Browser.msTouch&&0===t.indexOf("touch")?this.removeMsTouchListener(e,t,i):r.Browser.touch&&"dblclick"===t&&this.removeDoubleTapListener?this.removeDoubleTapListener(e,i):"removeEventListener"in e?"mousewheel"===t?(e.removeEventListener("DOMMouseScroll",o,!1),e.removeEventListener(t,o,!1)):"mouseenter"===t||"mouseleave"===t?e.removeEventListener("mouseenter"===t?"mouseover":"mouseout",o,!1):e.removeEventListener(t,o,!1):"detachEvent"in e&&e.detachEvent("on"+t,o),e[s]=null,this},stopPropagation:function(e){return e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,this},disableClickPropagation:function(e){for(var t=r.DomEvent.stopPropagation,n=r.Draggable.START.length-1;n>=0;n--)r.DomEvent.addListener(e,r.Draggable.START[n],t);return r.DomEvent.addListener(e,"click",t).addListener(e,"dblclick",t)},preventDefault:function(e){return e.preventDefault?e.preventDefault():e.returnValue=!1,this},stop:function(e){return r.DomEvent.preventDefault(e).stopPropagation(e)},getMousePosition:function(e,n){var i=t.body,s=t.documentElement,o=e.pageX?e.pageX:e.clientX+i.scrollLeft+s.scrollLeft,u=e.pageY?e.pageY:e.clientY+i.scrollTop+s.scrollTop,a=new r.Point(o,u);return n?a._subtract(r.DomUtil.getViewportOffset(n)):a},getWheelDelta:function(e){var t=0;return e.wheelDelta&&(t=e.wheelDelta/120),e.detail&&(t=-e.detail/3),t},_checkMouse:function(e,t){var n=t.relatedTarget;if(!n)return!0;try{for(;n&&n!==e;)n=n.parentNode}catch(r){return!1}return n!==e},_getEvent:function(){var t=e.event;if(!t)for(var n=arguments.callee.caller;n&&(t=n.arguments[0],!t||e.Event!==t.constructor);)n=n.caller;return t}},r.DomEvent.on=r.DomEvent.addListener,r.DomEvent.off=r.DomEvent.removeListener,r.Draggable=r.Class.extend({includes:r.Mixin.Events,statics:{START:r.Browser.touch?["touchstart","mousedown"]:["mousedown"],END:{mousedown:"mouseup",touchstart:"touchend",MSPointerDown:"touchend"},MOVE:{mousedown:"mousemove",touchstart:"touchmove",MSPointerDown:"touchmove"},TAP_TOLERANCE:15},initialize:function(e,t,n){this._element=e,this._dragStartTarget=t||e,this._longPress=n&&!r.Browser.msTouch},enable:function(){if(!this._enabled){for(var e=r.Draggable.START.length-1;e>=0;e--)r.DomEvent.on(this._dragStartTarget,r.Draggable.START[e],this._onDown,this);this._enabled=!0}},disable:function(){if(this._enabled){for(var e=r.Draggable.START.length-1;e>=0;e--)r.DomEvent.off(this._dragStartTarget,r.Draggable.START[e],this._onDown,this);this._enabled=!1,this._moved=!1}},_onDown:function(e){if(!(!r.Browser.touch&&e.shiftKey||1!==e.which&&1!==e.button&&!e.touches||(r.DomEvent.preventDefault(e),r.DomEvent.stopPropagation(e),r.Draggable._disabled))){if(this._simulateClick=!0,e.touches&&e.touches.length>1)return this._simulateClick=!1,clearTimeout(this._longPressTimeout),n;var i=e.touches&&1===e.touches.length?e.touches[0]:e,s=i.target;r.Browser.touch&&"a"===s.tagName.toLowerCase()&&r.DomUtil.addClass(s,"leaflet-active"),this._moved=!1,this._moving||(this._startPoint=new r.Point(i.clientX,i.clientY),this._startPos=this._newPos=r.DomUtil.getPosition(this._element),e.touches&&1===e.touches.length&&r.Browser.touch&&this._longPress&&(this._longPressTimeout=setTimeout(r.bind(function(){var e=this._newPos&&this._newPos.distanceTo(this._startPos)||0;r.Draggable.TAP_TOLERANCE>e&&(this._simulateClick=!1,this._onUp(),this._simulateEvent("contextmenu",i))},this),1e3)),r.DomEvent.on(t,r.Draggable.MOVE[e.type],this._onMove,this),r.DomEvent.on(t,r.Draggable.END[e.type],this._onUp,this))}},_onMove:function(e){if(!(e.touches&&e.touches.length>1)){var t=e.touches&&1===e.touches.length?e.touches[0]:e,n=new r.Point(t.clientX,t.clientY),i=n.subtract(this._startPoint);(i.x||i.y)&&(r.DomEvent.preventDefault(e),this._moved||(this.fire("dragstart"),this._moved=!0,this._startPos=r.DomUtil.getPosition(this._element).subtract(i),r.Browser.touch||(r.DomUtil.disableTextSelection(),this._setMovingCursor())),this._newPos=this._startPos.add(i),this._moving=!0,r.Util.cancelAnimFrame(this._animRequest),this._animRequest=r.Util.requestAnimFrame(this._updatePosition,this,!0,this._dragStartTarget))}},_updatePosition:function(){this.fire("predrag"),r.DomUtil.setPosition(this._element,this._newPos),this.fire("drag")},_onUp:function(e){var n;if(clearTimeout(this._longPressTimeout),this._simulateClick&&e.changedTouches){var i=e.changedTouches[0],s=i.target,o=this._newPos&&this._newPos.distanceTo(this._startPos)||0;"a"===s.tagName.toLowerCase()&&r.DomUtil.removeClass(s,"leaflet-active"),r.Draggable.TAP_TOLERANCE>o&&(n=i)}r.Browser.touch||(r.DomUtil.enableTextSelection(),this._restoreCursor());for(var u in r.Draggable.MOVE)r.Draggable.MOVE.hasOwnProperty(u)&&(r.DomEvent.off(t,r.Draggable.MOVE[u],this._onMove),r.DomEvent.off(t,r.Draggable.END[u],this._onUp));this._moved&&(r.Util.cancelAnimFrame(this._animRequest),this.fire("dragend")),this._moving=!1,n&&(this._moved=!1,this._simulateEvent("click",n))},_setMovingCursor:function(){r.DomUtil.addClass(t.body,"leaflet-dragging")},_restoreCursor:function(){r.DomUtil.removeClass(t.body,"leaflet-dragging")},_simulateEvent:function(n,r){var i=t.createEvent("MouseEvents");i.initMouseEvent(n,!0,!0,e,1,r.screenX,r.screenY,r.clientX,r.clientY,!1,!1,!1,!1,0,null),r.target.dispatchEvent(i)}}),r.Handler=r.Class.extend({initialize:function(e){this._map=e},enable:function(){this._enabled||(this._enabled=!0,this.addHooks())},disable:function(){this._enabled&&(this._enabled=!1,this.removeHooks())},enabled:function(){return!!this._enabled}}),r.Map.mergeOptions({dragging:!0,inertia:!r.Browser.android23,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,inertiaThreshold:r.Browser.touch?32:18,easeLinearity:.25,longPress:!0,worldCopyJump:!1}),r.Map.Drag=r.Handler.extend({addHooks:function(){if(!this._draggable){var e=this._map;this._draggable=new r.Draggable(e._mapPane,e._container,e.options.longPress),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),e.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDrag,this),e.on("viewreset",this._onViewReset,this))}this._draggable.enable()},removeHooks:function(){this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},_onDragStart:function(){var e=this._map;e._panAnim&&e._panAnim.stop(),e.fire("movestart").fire("dragstart"),e.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(){if(this._map.options.inertia){var e=this._lastTime=+(new Date),t=this._lastPos=this._draggable._newPos;this._positions.push(t),this._times.push(e),e-this._times[0]>200&&(this._positions.shift(),this._times.shift())}this._map.fire("move").fire("drag")},_onViewReset:function(){var e=this._map.getSize()._divideBy(2),t=this._map.latLngToLayerPoint(new r.LatLng(0,0));this._initialWorldOffset=t.subtract(e).x,this._worldWidth=this._map.project(new r.LatLng(0,180)).x},_onPreDrag:function(){var e=this._worldWidth,t=Math.round(e/2),n=this._initialWorldOffset,r=this._draggable._newPos.x,i=(r-t+n)%e+t-n,s=(r+t+n)%e-t-n,o=Math.abs(i+n)t.inertiaThreshold||!this._positions[0];if(i)e.fire("moveend");else{var s=this._lastPos.subtract(this._positions[0]),o=(this._lastTime+n-this._times[0])/1e3,u=t.easeLinearity,a=s.multiplyBy(u/o),f=a.distanceTo(new r.Point(0,0)),l=Math.min(t.inertiaMaxSpeed,f),c=a.multiplyBy(l/f),h=l/(t.inertiaDeceleration*u),p=c.multiplyBy(-h/2).round();r.Util.requestAnimFrame(function(){e.panBy(p,h,u)})}e.fire("dragend"),t.maxBounds&&r.Util.requestAnimFrame(this._panInsideMaxBounds,e,!0,e._container)},_panInsideMaxBounds:function(){this.panInsideBounds(this.options.maxBounds)}}),r.Map.addInitHook("addHandler","dragging",r.Map.Drag),r.Map.mergeOptions({doubleClickZoom:!0}),r.Map.DoubleClickZoom=r.Handler.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick)},_onDoubleClick:function(e){this.setView(e.latlng,this._zoom+1)}}),r.Map.addInitHook("addHandler","doubleClickZoom",r.Map.DoubleClickZoom),r.Map.mergeOptions({scrollWheelZoom:!0}),r.Map.ScrollWheelZoom=r.Handler.extend({addHooks:function(){r.DomEvent.on(this._map._container,"mousewheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){r.DomEvent.off(this._map._container,"mousewheel",this._onWheelScroll)},_onWheelScroll:function(e){var t=r.DomEvent.getWheelDelta(e);this._delta+=t,this._lastMousePos=this._map.mouseEventToContainerPoint(e),this._startTime||(this._startTime=+(new Date));var n=Math.max(40-(+(new Date)-this._startTime),0);clearTimeout