/*! * ui-leaflet 2.0.0 2016-10-04 * ui-leaflet - An AngularJS directive to easily interact with Leaflet maps * git: https://github.com/angular-ui/ui-leaflet */ !function(a){"use strict";a.module("ui-leaflet",["nemLogging"]).directive("leaflet",["$q","leafletData","leafletMapDefaults","leafletHelpers","leafletMapEvents",function(a,b,c,d,e){return{restrict:"EA",replace:!0,scope:{center:"=",lfCenter:"=",defaults:"=",maxbounds:"=",bounds:"=",markers:"=",legend:"=",geojson:"=",paths:"=",tiles:"=",layers:"=",controls:"=",decorations:"=",eventBroadcast:"=",watchOptions:"=",id:"@"},transclude:!0,template:'
',controller:["$scope",function(b){this._leafletMap=a.defer(),this.getMap=function(){return this._leafletMap.promise},this.getLeafletScope=function(){return b}}],link:function(a,f,g,h){function i(){isNaN(g.width)?f.css("width",g.width):f.css("width",g.width+"px")}function j(){isNaN(g.height)?f.css("height",g.height):f.css("height",g.height+"px")}var k=d.isDefined,l=c.setDefaults(a.defaults,g.id),m=e.getAvailableMapEvents(),n=e.addEvents;a.mapId=g.id,b.setDirectiveControls({},g.id);var o=new L.Map(f[0],c.getMapCreationDefaults(g.id));if(h._leafletMap.resolve(o),k(g.width)&&(i(),a.$watch(function(){return f[0].getAttribute("width")},function(){i(),o.invalidateSize()})),k(g.height)&&(j(),a.$watch(function(){return f[0].getAttribute("height")},function(){j(),o.invalidateSize()})),k(g.center)||k(g.lfCenter)||o.setView([l.center.lat,l.center.lng],l.center.zoom),!k(g.tiles)&&!k(g.layers)){var p=L.tileLayer(l.tileLayer,l.tileLayerOptions);p.addTo(o),b.setTiles(p,g.id)}if(k(o.zoomControl)&&k(l.zoomControlPosition)&&o.zoomControl.setPosition(l.zoomControlPosition),k(o.zoomControl)&&l.zoomControl===!1&&o.zoomControl.removeFrom(o),k(o.zoomsliderControl)&&k(l.zoomsliderControl)&&l.zoomsliderControl===!1&&o.zoomsliderControl.removeFrom(o),!k(g.eventBroadcast)){var q="broadcast";n(o,g.id,m,"eventName",a,q)}o.whenReady(function(){b.setMap(o,g.id)}),a.$on("$destroy",function(){c.reset(),o.remove(),b.unresolveMap(g.id)}),a.$on("invalidateSize",function(){o.invalidateSize()})}}}]),function(){a.module("ui-leaflet").factory("eventManager",[function(){var a=function(){this.listeners={}};return a.prototype={addEventListener:function(a,b,c){for(var d=[],e=arguments.length,f=0;f3?d.splice(3,d.length-1):[],"undefined"!=typeof this.listeners[a]?this.listeners[a].push({scope:c,callback:b,args:d}):this.listeners[a]=[{scope:c,callback:b,args:d}]},removeEventListener:function(a,b,c){if("undefined"!=typeof this.listeners[a]){for(var d=this.listeners[a].length,e=[],f=0;f0;for(var e=0;e2?e.splice(2,e.length-1):[],e=[d].concat(e),"undefined"!=typeof this.listeners[a])for(var h=this.listeners[a].length,i=0;i=1)for(f in b)b.hasOwnProperty(f)&&(e=f);else c.error(g+"- You have more than 1 map on the DOM, you must provide the map ID to the leafletData.getXXX call");return e}function f(c,d){var f,g=e(c,d);return a.isDefined(c[g])&&c[g].resolvedDefer!==!0?f=c[g].defer:(f=b.defer(),c[g]={defer:f,resolvedDefer:!1}),f}var g="[ui-leaflet] ",h=a.copy,i=h,j=function(b,c){var d;if(b&&a.isObject(b))return null!==c&&a.isString(c)?(d=b,c.split(".").forEach(function(a){d&&(d=d[a])}),d):c},k=function(a){return a.split(".").reduce(function(a,b){return a+'["'+b+'"]'})},l=function(a){return a.reduce(function(a,b){return a+"."+b})},m=function(b){return a.isDefined(b)&&null!==b},n=function(a){return!m(a)},o=/([\:\-\_]+(.))/g,p=/^moz([A-Z])/,q=/^((?:x|data)[\:\-_])/i,r=function(a){return a.replace(o,function(a,b,c,d){return d?c.toUpperCase():c}).replace(p,"Moz$1")},s=function(a){return r(a.replace(q,""))},t=10,u=function(a,b,c){if(!a)throw new Error(g+"trapObj is undefined");if(!b)throw new Error(g+"trapField is undefined");a[b]=!0;var e=c();return d(function(){a[b]=!1},t),e};return{watchTrapDelayMilliSec:t,modelChangeInDirective:u,camelCase:r,directiveNormalize:s,copy:h,clone:i,errorHeader:g,getObjectValue:j,getObjectArrayPath:k,getObjectDotPath:l,defaultTo:function(a,b){return m(a)?a:b},isTruthy:function(a){return"true"===a||a===!0},isEmpty:function(a){return 0===Object.keys(a).length},isUndefinedOrEmpty:function(b){return a.isUndefined(b)||null===b||0===Object.keys(b).length},isDefined:m,isUndefined:n,isNumber:a.isNumber,isString:a.isString,isArray:a.isArray,isObject:a.isObject,isFunction:a.isFunction,equals:a.equals,isValidCenter:function(b){return a.isDefined(b)&&a.isNumber(b.lat)&&a.isNumber(b.lng)&&a.isNumber(b.zoom)},isValidPoint:function(b){return!!a.isDefined(b)&&(a.isArray(b)?2===b.length&&a.isNumber(b[0])&&a.isNumber(b[1]):a.isNumber(b.lat)&&a.isNumber(b.lng))},isSameCenterOnMap:function(a,b){var c=b.getCenter(),d=b.getZoom();return!(!a.lat||!a.lng||c.lat.toFixed(4)!==a.lat.toFixed(4)||c.lng.toFixed(4)!==a.lng.toFixed(4)||d!==a.zoom)},safeApply:function(a,b){var c=a.$root.$$phase;"$apply"===c||"$digest"===c?a.$eval(b):a.$evalAsync(b)},obtainEffectiveMapId:e,getDefer:function(b,c){var d,g=e(b,c);return d=a.isDefined(b[g])&&b[g].resolvedDefer!==!1?b[g].defer:f(b,c)},getUnresolvedDefer:f,setResolvedDefer:function(a,b){var c=e(a,b);a[c].resolvedDefer=!0},rangeIsSupported:function(){var a=document.createElement("input");return a.setAttribute("type","range"),"range"===a.type},FullScreenControlPlugin:{isLoaded:function(){return a.isDefined(L.Control.Fullscreen)}},MiniMapControlPlugin:{isLoaded:function(){return a.isDefined(L.Control.MiniMap)}},AwesomeMarkersPlugin:{isLoaded:function(){return a.isDefined(L.AwesomeMarkers)&&a.isDefined(L.AwesomeMarkers.Icon)},is:function(a){return!!this.isLoaded()&&a instanceof L.AwesomeMarkers.Icon},equal:function(b,c){return!!this.isLoaded()&&(!!this.is(b)&&a.equals(b,c))}},VectorMarkersPlugin:{isLoaded:function(){return a.isDefined(L.VectorMarkers)&&a.isDefined(L.VectorMarkers.Icon)},is:function(a){return!!this.isLoaded()&&a instanceof L.VectorMarkers.Icon},equal:function(b,c){return!!this.isLoaded()&&(!!this.is(b)&&a.equals(b,c))}},DomMarkersPlugin:{isLoaded:function(){return!(!a.isDefined(L.DomMarkers)||!a.isDefined(L.DomMarkers.Icon))},is:function(a){return!!this.isLoaded()&&a instanceof L.DomMarkers.Icon},equal:function(b,c){return!!this.isLoaded()&&(!!this.is(b)&&a.equals(b,c))}},PolylineDecoratorPlugin:{isLoaded:function(){return!!a.isDefined(L.PolylineDecorator)},is:function(a){return!!this.isLoaded()&&a instanceof L.PolylineDecorator},equal:function(b,c){return!!this.isLoaded()&&(!!this.is(b)&&a.equals(b,c))}},MakiMarkersPlugin:{isLoaded:function(){return!(!a.isDefined(L.MakiMarkers)||!a.isDefined(L.MakiMarkers.Icon))},is:function(a){return!!this.isLoaded()&&a instanceof L.MakiMarkers.Icon},equal:function(b,c){return!!this.isLoaded()&&(!!this.is(b)&&a.equals(b,c))}},ExtraMarkersPlugin:{isLoaded:function(){return!(!a.isDefined(L.ExtraMarkers)||!a.isDefined(L.ExtraMarkers.Icon))},is:function(a){return!!this.isLoaded()&&a instanceof L.ExtraMarkers.Icon},equal:function(b,c){return!!this.isLoaded()&&(!!this.is(b)&&a.equals(b,c))}},LabelPlugin:{isLoaded:function(){return a.isDefined(L.Label)},is:function(a){return!!this.isLoaded()&&a instanceof L.MarkerClusterGroup}},MarkerClusterPlugin:{isLoaded:function(){return a.isDefined(L.MarkerClusterGroup)},is:function(a){return!!this.isLoaded()&&a instanceof L.MarkerClusterGroup}},GeoJSONPlugin:{isLoaded:function(){return a.isDefined(L.TileLayer.GeoJSON)},is:function(a){return!!this.isLoaded()&&a instanceof L.TileLayer.GeoJSON}},CartoDB:{isLoaded:function(){return cartodb},is:function(){return!0}},Leaflet:{DivIcon:{is:function(a){return a instanceof L.DivIcon},equal:function(b,c){return!!this.is(b)&&a.equals(b,c)}},Icon:{is:function(a){return a instanceof L.Icon},equal:function(b,c){return!!this.is(b)&&a.equals(b,c)}}},watchOptions:{type:"watchDeep",individual:{type:"watchDeep"}}}}]),a.module("ui-leaflet").service("leafletIterators",["leafletLogger","leafletHelpers",function(a,b){var c,d=b,e=b.errorHeader+"leafletIterators: ",f=Object.keys,g=d.isFunction,h=d.isObject,i=a,j=Math.pow(2,53)-1,k=function(a){var b=null!==a&&a.length;return d.isNumber(b)&&b>=0&&b<=j},l=function(a){return a},m=function(a){return function(b){return null===b?void 0:b[a]}},n=function(a,b,c){if(void 0===b)return a;switch(null===c?3:c){case 1:return function(c){return a.call(b,c)};case 2:return function(c,d){return a.call(b,c,d)};case 3:return function(c,d,e){return a.call(b,c,d,e)};case 4:return function(c,d,e,f){return a.call(b,c,d,e,f)}}return function(){return a.apply(b,arguments)}},o=function(a,b){return function(c){var d=arguments.length;if(d<2||null===c)return c;for(var e=1;e0)for(var g=function(){f--,0===f&&b.removeLayer(c)},h=0;h0&&b(c)},function(a){d.shift(),f.d.reject(a),d.length>0&&b(c)})},h=function(a,b,c,d){if(a.innerHTML="",b.error)a.innerHTML+='
'+b.error.message+"
";else if("arcgis"===c)for(var e=0;e'+f.layerName+"";for(var g=0;g
'+h.label+"
"}}else"image"===c&&(a.innerHTML='')},i=function(a,b,c,d){return function(){var e=L.DomUtil.create("div",b);return L.Browser.touch?L.DomEvent.on(e,"click",L.DomEvent.stopPropagation):(L.DomEvent.disableClickPropagation(e),L.DomEvent.on(e,"mousewheel",L.DomEvent.stopPropagation)),h(e,a,c,d),e}},j=function(a,b){return function(){for(var c=L.DomUtil.create("div",b),d=0;d
'+a.labels[d]+"
";return L.Browser.touch?L.DomEvent.on(c,"click",L.DomEvent.stopPropagation):(L.DomEvent.disableClickPropagation(c),L.DomEvent.on(c,"mousewheel",L.DomEvent.stopPropagation)),c}};return{getOnAddLegend:i,getOnAddArrayLegend:j,updateLegend:h,addLegendURL:function(a,c){var d=b.defer();return f(e[a])||(e[a]=[]),e[a].push({c:c,d:d}),1===e[a].length&&g(a),d.promise}}}]),a.module("ui-leaflet").factory("leafletMapDefaults",["$q","leafletHelpers",function(b,c){function d(){return{keyboard:!0,dragging:!0,worldCopyJump:!1,doubleClickZoom:!0,scrollWheelZoom:!0,tap:!0,touchZoom:!0,zoomControl:!0,zoomsliderControl:!1,zoomControlPosition:"topleft",attributionControl:!0,controls:{layers:{visible:!0,position:"topright",collapsed:!0}},nominatim:{server:" http://nominatim.openstreetmap.org/search"},crs:L.CRS.EPSG3857,tileLayer:"//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",tileLayerOptions:{attribution:'© OpenStreetMap contributors'},path:{weight:10,opacity:1,color:"#0000ff"},center:{lat:0,lng:0,zoom:1},trackResize:!0}}var e=c.isDefined,f=c.isObject,g=c.obtainEffectiveMapId,h={};return{reset:function(){h={}},getDefaults:function(a){var b=g(h,a);return h[b]},getMapCreationDefaults:function(a){var b=g(h,a),c=h[b],d={maxZoom:c.maxZoom,keyboard:c.keyboard,dragging:c.dragging,zoomControl:c.zoomControl,doubleClickZoom:c.doubleClickZoom,scrollWheelZoom:c.scrollWheelZoom,tap:c.tap,touchZoom:c.touchZoom,attributionControl:c.attributionControl,worldCopyJump:c.worldCopyJump,crs:c.crs,trackResize:c.trackResize};if(e(c.minZoom)&&(d.minZoom=c.minZoom),e(c.zoomAnimation)&&(d.zoomAnimation=c.zoomAnimation),e(c.fadeAnimation)&&(d.fadeAnimation=c.fadeAnimation),e(c.markerZoomAnimation)&&(d.markerZoomAnimation=c.markerZoomAnimation),c.map)for(var f in c.map)d[f]=c.map[f];return d},setDefaults:function(b,c){var i=d();e(b)&&(i.doubleClickZoom=e(b.doubleClickZoom)?b.doubleClickZoom:i.doubleClickZoom,i.scrollWheelZoom=e(b.scrollWheelZoom)?b.scrollWheelZoom:i.doubleClickZoom,i.tap=e(b.tap)?b.tap:i.tap,i.touchZoom=e(b.touchZoom)?b.touchZoom:i.doubleClickZoom,i.zoomControl=e(b.zoomControl)?b.zoomControl:i.zoomControl,i.zoomsliderControl=e(b.zoomsliderControl)?b.zoomsliderControl:i.zoomsliderControl,i.attributionControl=e(b.attributionControl)?b.attributionControl:i.attributionControl,i.tileLayer=e(b.tileLayer)?b.tileLayer:i.tileLayer,i.zoomControlPosition=e(b.zoomControlPosition)?b.zoomControlPosition:i.zoomControlPosition,i.keyboard=e(b.keyboard)?b.keyboard:i.keyboard,i.dragging=e(b.dragging)?b.dragging:i.dragging,i.trackResize=e(b.trackResize)?b.trackResize:i.trackResize,e(b.controls)&&a.extend(i.controls,b.controls),f(b.crs)?i.crs=b.crs:e(L.CRS[b.crs])&&(i.crs=L.CRS[b.crs]),e(b.center)&&a.copy(b.center,i.center),e(b.tileLayerOptions)&&a.copy(b.tileLayerOptions,i.tileLayerOptions),e(b.maxZoom)&&(i.maxZoom=b.maxZoom),e(b.minZoom)&&(i.minZoom=b.minZoom),e(b.zoomAnimation)&&(i.zoomAnimation=b.zoomAnimation),e(b.fadeAnimation)&&(i.fadeAnimation=b.fadeAnimation),e(b.markerZoomAnimation)&&(i.markerZoomAnimation=b.markerZoomAnimation),e(b.worldCopyJump)&&(i.worldCopyJump=b.worldCopyJump),e(b.map)&&(i.map=b.map),e(b.path)&&(i.path=b.path));var j=g(h,c);return h[j]=i,i}}}]),a.module("ui-leaflet").service("leafletMarkersHelpers",["$rootScope","$timeout","leafletHelpers","leafletLogger","$compile","leafletGeoJsonHelpers","leafletWatchHelpers",function(b,c,d,e,f,g,h){var i=d.isDefined,j=d.defaultTo,k=d.MarkerClusterPlugin,l=d.AwesomeMarkersPlugin,m=d.VectorMarkersPlugin,n=d.MakiMarkersPlugin,o=d.ExtraMarkersPlugin,p=d.DomMarkersPlugin,q=d.safeApply,r=d,s=d.isString,t=d.isNumber,u=d.isObject,v={},w=g,x=d.errorHeader,y=h.maybeWatch,z=e,A=function(a){var b="";return["_icon","_latlng","_leaflet_id","_map","_shadow"].forEach(function(c){b+=c+": "+j(a[c],"undefined")+" \n"}),"[leafletMarker] : \n"+b},B=function(a,b){var c=b?console:z;c.debug(A(a))},C=function(b){return a.element(v[b]._map._container).parent().length>0},D=function(c){if(i(c)&&i(c.type)&&"awesomeMarker"===c.type)return l.isLoaded()||z.error(x+" The AwesomeMarkers Plugin is not loaded."),new L.AwesomeMarkers.icon(c);if(i(c)&&i(c.type)&&"vectorMarker"===c.type)return m.isLoaded()||z.error(x+" The VectorMarkers Plugin is not loaded."),new L.VectorMarkers.icon(c);if(i(c)&&i(c.type)&&"makiMarker"===c.type)return n.isLoaded()||z.error(x+"The MakiMarkers Plugin is not loaded."),new L.MakiMarkers.icon(c);if(i(c)&&i(c.type)&&"extraMarker"===c.type)return o.isLoaded()||z.error(x+"The ExtraMarkers Plugin is not loaded."),new L.ExtraMarkers.icon(c);if(i(c)&&i(c.type)&&"div"===c.type)return new L.divIcon(c);if(i(c)&&i(c.type)&&"dom"===c.type){p.isLoaded()||z.error(x+"The DomMarkers Plugin is not loaded.");var d=a.isFunction(c.getMarkerScope)?c.getMarkerScope().$new():b,e=f(c.template)(d),g=a.copy(c);return g.ngElement=e,g.element=e[0],a.isFunction(c.getMarkerScope)&&(g.scope=d),new L.DomMarkers.icon(g)}if(i(c)&&i(c.type)&&"icon"===c.type)return c.icon;var h="data:image/png;base64,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",j="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAYAAACoYAD2AAAC5ElEQVRYw+2YW4/TMBCF45S0S1luXZCABy5CgLQgwf//S4BYBLTdJLax0fFqmB07nnQfEGqkIydpVH85M+NLjPe++dcPc4Q8Qh4hj5D/AaQJx6H/4TMwB0PeBNwU7EGQAmAtsNfAzoZkgIa0ZgLMa4Aj6CxIAsjhjOCoL5z7Glg1JAOkaicgvQBXuncwJAWjksLtBTWZe04CnYRktUGdilALppZBOgHGZcBzL6OClABvMSVIzyBjazOgrvACf1ydC5mguqAVg6RhdkSWQFj2uxfaq/BrIZOLEWgZdALIDvcMcZLD8ZbLC9de4yR1sYMi4G20S4Q/PWeJYxTOZn5zJXANZHIxAd4JWhPIloTJZhzMQduM89WQ3MUVAE/RnhAXpTycqys3NZALOBbB7kFrgLesQl2h45Fcj8L1tTSohUwuxhy8H/Qg6K7gIs+3kkaigQCOcyEXCHN07wyQazhrmIulvKMQAwMcmLNqyCVyMAI+BuxSMeTk3OPikLY2J1uE+VHQk6ANrhds+tNARqBeaGc72cK550FP4WhXmFmcMGhTwAR1ifOe3EvPqIegFmF+C8gVy0OfAaWQPMR7gF1OQKqGoBjq90HPMP01BUjPOqGFksC4emE48tWQAH0YmvOgF3DST6xieJgHAWxPAHMuNhrImIdvoNOKNWIOcE+UXE0pYAnkX6uhWsgVXDxHdTfCmrEEmMB2zMFimLVOtiiajxiGWrbU52EeCdyOwPEQD8LqyPH9Ti2kgYMf4OhSKB7qYILbBv3CuVTJ11Y80oaseiMWOONc/Y7kJYe0xL2f0BaiFTxknHO5HaMGMublKwxFGzYdWsBF174H/QDknhTHmHHN39iWFnkZx8lPyM8WHfYELmlLKtgWNmFNzQcC1b47gJ4hL19i7o65dhH0Negbca8vONZoP7doIeOC9zXm8RjuL0Gf4d4OYaU5ljo3GYiqzrWQHfJxA6ALhDpVKv9qYeZA8eM3EhfPSCmpuD0AAAAASUVORK5CYII="; return i(c)&&i(c.iconUrl)?new L.Icon(c):new L.Icon.Default({iconUrl:h,shadowUrl:j,iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],shadowSize:[41,41]})},E=function(a){i(v[a])&&delete v[a]},F=function(){v={}},G=function(){for(var a in v)C(a)||E(a)},H=function(a){a.options.icon.options.ngElement&&a.options.icon.options.ngElement.remove(),a.options.icon.options.scope&&a.options.icon.options.scope.$destroy()},I=function(a,b,c){if(a.closePopup(),a.options.icon&&a.options.icon.options&&"dom"===a.options.icon.options.type&&H(a),i(c)&&i(c.overlays))for(var d in c.overlays)if((c.overlays[d]instanceof L.LayerGroup||c.overlays[d]instanceof L.FeatureGroup)&&c.overlays[d].hasLayer(a))return void c.overlays[d].removeLayer(a);if(i(v))for(var e in v)v[e].hasLayer(a)&&v[e].removeLayer(a);b.hasLayer(a)&&b.removeLayer(a)},J=function(a,b){var c=a._popup._container.offsetHeight,d=new L.Point(a._popup._containerLeft,-c-a._popup._containerBottom),e=b.layerPointToContainerPoint(d);null!==e&&a._popup._adjustPan()},K=function(a,b){f(a._popup._contentNode)(b)},M=function a(b,d,e){var f=b._popup._contentNode.innerText||b._popup._contentNode.textContent;f.length<1&&c(function(){a(b,d,e)});var g=b._popup._contentNode.offsetWidth;return b._popup._updateLayout(),b._popup._updatePosition(),b._popup.options.autoPan&&J(b,e),g},N=function(c,d,e){var f=a.isFunction(d.getMessageScope)?d.getMessageScope():b,g=!i(d.compileMessage)||d.compileMessage;if(g){if(!i(c._popup)||!i(c._popup._contentNode))return z.error(x+"Popup is invalid or does not have any content."),!1;K(c,f),M(c,d,e)}},O=function(c,d){var e=a.isFunction(d.getMessageScope)?d.getMessageScope():b,g=a.isFunction(d.getLabelScope)?d.getLabelScope():e,h=!i(d.compileMessage)||d.compileMessage;r.LabelPlugin.isLoaded()&&i(d.label)&&(i(d.label.options)&&d.label.options.noHide===!0&&c.showLabel(),h&&i(c.label)&&f(c.label._container)(g))},P=function(b,c,d,e,f,g,h){if(i(c)){if(!w.validateCoords(b))return z.warn("There are problems with lat-lng data, please verify your marker model"),void I(d,h,g);var j=b===c;if(i(b.iconAngle)&&c.iconAngle!==b.iconAngle&&d.setIconAngle(b.iconAngle),s(b.layer)||s(c.layer)&&(i(g.overlays[c.layer])&&g.overlays[c.layer].hasLayer(d)&&(g.overlays[c.layer].removeLayer(d),d.closePopup()),h.hasLayer(d)||h.addLayer(d)),(t(b.opacity)||t(parseFloat(b.opacity)))&&b.opacity!==c.opacity&&d.setOpacity(b.opacity),s(b.layer)&&c.layer!==b.layer){if(s(c.layer)&&i(g.overlays[c.layer])&&g.overlays[c.layer].hasLayer(d)&&g.overlays[c.layer].removeLayer(d),d.closePopup(),h.hasLayer(d)&&h.removeLayer(d),!i(g.overlays[b.layer]))return void z.error(x+"You must use a name of an existing layer");var k=g.overlays[b.layer];if(!(k instanceof L.LayerGroup||k instanceof L.FeatureGroup))return void z.error(x+'A marker can only be added to a layer of type "group" or "featureGroup"');k.addLayer(d),h.hasLayer(d)&&b.focus===!0&&d.openPopup()}if(b.draggable!==!0&&c.draggable===!0&&i(d.dragging)&&d.dragging.disable(),b.draggable===!0&&c.draggable!==!0&&(d.dragging?d.dragging.enable():L.Handler.MarkerDrag&&(d.dragging=new L.Handler.MarkerDrag(d),d.options.draggable=!0,d.dragging.enable())),u(b.icon)||u(c.icon)&&("dom"===c.icon.type&&H(d),d.setIcon(D()),d.closePopup(),d.unbindPopup(),s(b.message)&&d.bindPopup(b.message,b.popupOptions)),u(b.icon)&&u(c.icon)&&!a.equals(b.icon,c.icon)){var l=!1;d.dragging&&(l=d.dragging.enabled()),"dom"===c.icon.type&&H(d),d.setIcon(D(b.icon)),l&&d.dragging.enable(),d.closePopup(),d.unbindPopup(),s(b.message)&&(d.bindPopup(b.message,b.popupOptions),h.hasLayer(d)&&b.focus===!0&&d.openPopup())}!s(b.message)&&s(c.message)&&(d.closePopup(),d.unbindPopup()),r.LabelPlugin.isLoaded()&&(i(b.label)&&i(b.label.message)?"label"in c&&"message"in c.label&&!a.equals(b.label.message,c.label.message)?d.updateLabelContent(b.label.message):!a.isFunction(d.getLabel)||a.isFunction(d.getLabel)&&!i(d.getLabel())?(d.bindLabel(b.label.message,b.label.options),O(d,b)):O(d,b):"label"in b&&!("message"in b.label)||a.isFunction(d.unbindLabel)&&d.unbindLabel()),s(b.message)&&!s(c.message)&&d.bindPopup(b.message,b.popupOptions),s(b.message)&&s(c.message)&&b.message!==c.message&&d.setPopupContent(b.message);var m=!1;b.focus!==!0&&c.focus===!0&&(d.closePopup(),m=!0),(b.focus===!0&&(!i(c.focus)||c.focus===!1)||j&&b.focus===!0)&&(d.openPopup(),m=!0),c.zIndexOffset!==b.zIndexOffset&&d.setZIndexOffset(b.zIndexOffset);var n=d.getLatLng(),o=s(b.layer)&&r.MarkerClusterPlugin.is(g.overlays[b.layer]);o?m?b.lat===c.lat&&b.lng===c.lng||(g.overlays[b.layer].removeLayer(d),d.setLatLng([b.lat,b.lng]),g.overlays[b.layer].addLayer(d)):n.lat!==b.lat||n.lng!==b.lng?(g.overlays[b.layer].removeLayer(d),d.setLatLng([b.lat,b.lng]),g.overlays[b.layer].addLayer(d)):b.lat!==c.lat||b.lng!==c.lng?(g.overlays[b.layer].removeLayer(d),d.setLatLng([b.lat,b.lng]),g.overlays[b.layer].addLayer(d)):u(b.icon)&&u(c.icon)&&!a.equals(b.icon,c.icon)&&(g.overlays[b.layer].removeLayer(d),g.overlays[b.layer].addLayer(d)):n.lat===b.lat&&n.lng===b.lng||d.setLatLng([b.lat,b.lng])}},Q=function(a,b){if(i(a))return b?a[b]:a},R=function(a,b,c){if(i(a))return b?c?a[c][b]:a[b]:void z.error(x+"marker id missing in getMarker")};return{resetMarkerGroup:E,resetMarkerGroups:F,resetUnusedMarkerGroups:G,deleteMarker:I,manageOpenPopup:N,manageOpenLabel:O,createMarker:function(a){if(!i(a)||!w.validateCoords(a))return void z.error(x+"The marker definition is not valid.");var b=w.getCoords(a);if(!i(b))return void z.error(x+"Unable to get coordinates from markerData.");var c={icon:D(a.icon),title:i(a.title)?a.title:"",draggable:!!i(a.draggable)&&a.draggable,clickable:!i(a.clickable)||a.clickable,riseOnHover:!!i(a.riseOnHover)&&a.riseOnHover,zIndexOffset:i(a.zIndexOffset)?a.zIndexOffset:0,iconAngle:i(a.iconAngle)?a.iconAngle:0};for(var d in a)a.hasOwnProperty(d)&&!c.hasOwnProperty(d)&&(c[d]=a[d]);var e=new L.marker(b,c);return s(a.message)||e.unbindPopup(),e},addMarkerToGroup:function(a,b,c,d){return s(b)?k.isLoaded()?(i(v[b])||(v[b]=new L.MarkerClusterGroup(c),d.addLayer(v[b])),void v[b].addLayer(a)):void z.error(x+"The MarkerCluster plugin is not loaded."):void z.error(x+"The marker group you have specified is invalid.")},listenMarkerEvents:function(a,b,c,d,e){a.on("popupopen",function(){q(c,function(){(i(a._popup)||i(a._popup._contentNode))&&(b.focus=!0,N(a,b,e))})}),a.on("popupclose",function(){q(c,function(){b.focus=!1})}),a.on("add",function(){q(c,function(){"label"in b&&O(a,b)})})},updateMarker:P,addMarkerWatcher:function(a,b,c,d,e,f){var g=r.getObjectArrayPath("markers."+b);y(c,g,f,function(f,g,h){return i(f)?void P(f,g,a,b,c,d,e):(I(a,e,d),void h())})},string:A,log:B,getModelFromModels:R,getLayerModels:Q}}]),a.module("ui-leaflet").factory("leafletPathsHelpers",["$rootScope","leafletLogger","leafletHelpers",function(a,b,c){function d(a){return a.filter(function(a){return k(a)}).map(function(a){return e(a)})}function e(a){return i(a)?new L.LatLng(a[0],a[1]):new L.LatLng(a.lat,a.lng)}function f(a){return a.map(function(a){return d(a)})}function g(a,b){for(var c={},d=0;d0&&e(a[0].boundingbox)?i.resolve(a[0]):i.reject("[Nominatim] Invalid address")}),i.promise}}}]),a.module("ui-leaflet").directive("bounds",["leafletLogger","$timeout","$http","leafletHelpers","nominatimService","leafletBoundsHelpers",function(b,c,d,e,f,g){var h=b;return{restrict:"A",scope:!1,replace:!1,require:["leaflet"],link:function(b,d,i,j){var k=e.isDefined,l=g.createLeafletBounds,m=j[0].getLeafletScope(),n=j[0],o=e.errorHeader+" [Bounds] ",p=function(a){return 0===a._southWest.lat&&0===a._southWest.lng&&0===a._northEast.lat&&0===a._northEast.lng};n.getMap().then(function(d){m.$on("boundsChanged",function(b){var e=b.currentScope,f=d.getBounds();if(!p(f)&&!e.settingBoundsFromScope){e.settingBoundsFromLeaflet=!0;var g={northEast:{lat:f._northEast.lat,lng:f._northEast.lng},southWest:{lat:f._southWest.lat,lng:f._southWest.lng},options:f.options};a.equals(e.bounds,g)||(e.bounds=g),c(function(){e.settingBoundsFromLeaflet=!1})}});var e;m.$watch("bounds",function(a){if(!b.settingBoundsFromLeaflet){if(k(a.address)&&a.address!==e)return b.settingBoundsFromScope=!0,f.query(a.address,i.id).then(function(a){var b=a.boundingbox,c=[[b[0],b[2]],[b[1],b[3]]];d.fitBounds(c)},function(a){h.error(o+" "+a+".")}),e=a.address,void c(function(){b.settingBoundsFromScope=!1});var g=l(a);g&&!d.getBounds().equals(g)&&(b.settingBoundsFromScope=!0,d.fitBounds(g,a.options),c(function(){b.settingBoundsFromScope=!1}))}},!0)})}}}]);var b=["center","lfCenter"],c={};b.forEach(function(b){c[b]=["leafletLogger","$q","$location","$timeout","leafletMapDefaults","leafletHelpers","leafletBoundsHelpers","leafletMapEvents",function(c,d,e,f,g,h,i,j){var k,l=h.isDefined,m=h.isNumber,n=h.isSameCenterOnMap,o=h.safeApply,p=h.isValidCenter,q=i.isValidBounds,r=h.isUndefinedOrEmpty,s=h.errorHeader,t=c,u=function(a,b){return l(a)&&q(a)&&r(b)};return{restrict:"A",scope:!1,replace:!1,require:"leaflet",controller:function(){k=d.defer(),this.getCenter=function(){return k.promise}},link:function(c,d,h,q){var r=q.getLeafletScope(),v=r[b];q.getMap().then(function(c){var d=g.getDefaults(h.id);if(h[b].search("-")!==-1)return t.error(s+' The "center" variable can\'t use a "-" on its key name: "'+h[b]+'".'),void c.setView([d.center.lat,d.center.lng],d.center.zoom);if(u(r.bounds,v))c.fitBounds(i.createLeafletBounds(r.bounds),r.bounds.options),v=c.getCenter(),o(r,function(d){a.extend(d[b],{lat:c.getCenter().lat,lng:c.getCenter().lng,zoom:c.getZoom(),autoDiscover:!1})}),o(r,function(a){var b=c.getBounds();a.bounds={northEast:{lat:b._northEast.lat,lng:b._northEast.lng},southWest:{lat:b._southWest.lat,lng:b._southWest.lng}}});else{if(!l(v))return t.error(s+' The "center" property is not defined in the main scope'),void c.setView([d.center.lat,d.center.lng],d.center.zoom);l(v.lat)&&l(v.lng)||l(v.autoDiscover)||a.copy(d.center,v)}var q,w;if("yes"===h.urlHashCenter){var x=function(){var a,b=e.search(),c=h.urlHashParam?h.urlHashParam:"c";if(l(b[c])){var d=b[c].split(":");3===d.length&&(a={lat:parseFloat(d[0]),lng:parseFloat(d[1]),zoom:parseInt(d[2],10)})}return a};q=x(),r.$on("$locationChangeSuccess",function(d){var e=d.currentScope,f=x();l(f)&&!n(f,c)&&a.extend(e[b],{lat:f.lat,lng:f.lng,zoom:f.zoom})})}r.$watch(b,function(b){if(!r.settingCenterFromLeaflet)return l(q)&&(a.copy(q,b),q=void 0),p(b)||b.autoDiscover===!0?b.autoDiscover===!0?(m(b.zoom)||c.setView([d.center.lat,d.center.lng],d.center.zoom),void(m(b.zoom)&&b.zoom>d.center.zoom?c.locate({setView:!0,maxZoom:b.zoom}):l(d.maxZoom)?c.locate({setView:!0,maxZoom:d.maxZoom}):c.locate({setView:!0}))):void(w&&n(b,c)||(r.settingCenterFromScope=!0,c.setView([b.lat,b.lng],b.zoom),j.notifyCenterChangedToBounds(r,c),f(function(){r.settingCenterFromScope=!1}))):void t.warn(s+" invalid 'center'")},!0),c.whenReady(function(){w=!0}),c.on("moveend",function(){k.resolve(),j.notifyCenterUrlHashChanged(r,c,h,e.search()),n(v,c)||r.settingCenterFromScope||(r.settingCenterFromLeaflet=!0,o(r,function(d){r.settingCenterFromScope||a.extend(d[b],{lat:c.getCenter().lat,lng:c.getCenter().lng,zoom:c.getZoom(),autoDiscover:!1}),j.notifyCenterChangedToBounds(r,c),f(function(){r.settingCenterFromLeaflet=!1})}))}),v.autoDiscover===!0&&c.on("locationerror",function(){t.warn(s+" The Geolocation API is unauthorized on this page."),p(v)?(c.setView([v.lat,v.lng],v.zoom),j.notifyCenterChangedToBounds(r,c)):(c.setView([d.center.lat,d.center.lng],d.center.zoom),j.notifyCenterChangedToBounds(r,c))})})}}}]}),b.forEach(function(b){a.module("ui-leaflet").directive(b,c[b])}),a.module("ui-leaflet").directive("controls",["leafletLogger","leafletHelpers","leafletControlHelpers",function(a,b,c){var d=a;return{restrict:"A",scope:!1,replace:!1,require:"?^leaflet",link:function(a,e,f,g){if(g){var h=c.createControl,i=c.isValidControlType,j=g.getLeafletScope(),k=b.isDefined,l=b.isArray,m={},n=b.errorHeader+" [Controls] ";a.$on("$destroy",function(){c.destroyMapLayersControl(a.mapId)}),g.getMap().then(function(a){j.$watchCollection("controls",function(b){for(var c in m)k(b[c])||(a.hasControl(m[c])&&a.removeControl(m[c]),delete m[c]);for(var e in b){var f,g=k(b[e].type)?b[e].type:e;if(!i(g))return void d.error(n+" Invalid control type: "+g+".");if("custom"!==g)f=h(g,b[e]),a.addControl(f),m[e]=f;else{var j=b[e];if(l(j))for(var o=0;o=0?e.each(l.map.enable,function(a){b.indexOf(a)===-1&&m.indexOf(a)!==-1&&b.push(a)}):f.warn("[AngularJS - Leaflet] event-broadcast.map.enable must be an object check your model.")):f.warn("[AngularJS - Leaflet] event-broadcast.map must be an object check your model."):b=m,n(a,g.id,b,"eventName",k,c)})}}}]),a.module("ui-leaflet").directive("geojson",["$timeout","leafletLogger","leafletData","leafletHelpers","leafletWatchHelpers","leafletDirectiveControlsHelpers","leafletIterators","leafletGeoJsonEvents",function(b,c,d,e,f,g,h,i){var j=f.maybeWatch,k=e.watchOptions,l=g.extend,m=e,n=h,o={changeFromDirective:!1};return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(b,c,f,g){var h=e.isDefined,p=g.getLeafletScope(),q={},r=!1;g.getMap().then(function(b){var c;c=p.watchOptions&&p.watchOptions.geojson?p.watchOptions.geojson:k;var g=function(b,c){var d;return d=a.isFunction(b.onEachFeature)?b.onEachFeature:function(a,d){e.LabelPlugin.isLoaded()&&h(a.properties.description)&&d.bindLabel(a.properties.description),i.bindEvents(f.id,d,null,a,p,c,{resetStyleOnMouseout:b.resetStyleOnMouseout,mapId:f.id})}},s=m.isDefined(f.geojsonNested)&&m.isTruthy(f.geojsonNested),t=function(){if(q){var a=function(a){h(a)&&b.hasLayer(a)&&b.removeLayer(a)};return s?void n.each(q,function(b){a(b)}):void a(q)}},u=function(a,c){if(h(a)&&h(a.data)){var e=g(a,c);h(a.options)||m.modelChangeInDirective(o,"changeFromDirective",function(){a.options={style:a.style,filter:a.filter,onEachFeature:e,pointToLayer:a.pointToLayer}});var i=L.geoJson(a.data,a.options);c&&m.isString(c)?q[c]=i:q=i,i.addTo(b),r||(r=!0,d.setGeoJSON(q,f.id))}},v=function(a){if(t(),s){if(!a||!Object.keys(a).length)return;return void n.each(a,function(a,b){u(a,b)})}u(a)};l(f.id,"geojson",v,t),j(p,"geojson",c,function(a){o.changeFromDirective||v(a)})})}}}]),a.module("ui-leaflet").directive("layercontrol",["$filter","leafletLogger","leafletData","leafletHelpers",function(b,c,d,e){var f=c;return{restrict:"E",scope:{icons:"=?",autoHideOpacity:"=?",showGroups:"=?",title:"@",baseTitle:"@",overlaysTitle:"@"},replace:!0,transclude:!1,require:"^leaflet",controller:["$scope","$element","$sce",function(b,c,g){f.debug("[Angular Directive - Layers] layers",b,c);var h=e.safeApply,i=e.isDefined;a.extend(b,{baselayer:"",oldGroup:"",layerProperties:{},groupProperties:{},rangeIsSupported:e.rangeIsSupported(),changeBaseLayer:function(a,c){e.safeApply(b,function(c){c.baselayer=a,d.getMap().then(function(e){d.getLayers().then(function(d){if(!e.hasLayer(d.baselayers[a])){for(var f in c.layers.baselayers)c.layers.baselayers[f].icon=c.icons.unradio,e.hasLayer(d.baselayers[f])&&e.removeLayer(d.baselayers[f]);e.addLayer(d.baselayers[a]),c.layers.baselayers[a].icon=b.icons.radio}})})}),c.preventDefault()},moveLayer:function(a,c,d){var e=Object.keys(b.layers.baselayers).length;if(c>=1+e&&c<=b.overlaysArray.length+e){var f;for(var g in b.layers.overlays)if(b.layers.overlays[g].index===c){f=b.layers.overlays[g];break}f&&h(b,function(){f.index=a.index,a.index=c})}d.stopPropagation(),d.preventDefault()},initIndex:function(a,c){var d=Object.keys(b.layers.baselayers).length;a.index=i(a.index)?a.index:c+d+1},initGroup:function(a){b.groupProperties[a]=b.groupProperties[a]?b.groupProperties[a]:{}},toggleOpacity:function(a,c){if(c.visible){if(b.autoHideOpacity&&!b.layerProperties[c.name].opacityControl)for(var d in b.layerProperties)b.layerProperties[d].opacityControl=!1;b.layerProperties[c.name].opacityControl=!b.layerProperties[c.name].opacityControl}a.stopPropagation(),a.preventDefault()},toggleLegend:function(a){b.layerProperties[a.name].showLegend=!b.layerProperties[a.name].showLegend},showLegend:function(a){return a.legend&&b.layerProperties[a.name].showLegend},unsafeHTML:function(a){return g.trustAsHtml(a)},getOpacityIcon:function(a){return a.visible&&b.layerProperties[a.name].opacityControl?b.icons.close:b.icons.open},getGroupIcon:function(a){return a.visible?b.icons.check:b.icons.uncheck},changeGroupVisibility:function(a){if(i(b.groupProperties[a])){var c=b.groupProperties[a].visible;for(var d in b.layers.overlays){var e=b.layers.overlays[d];e.group===a&&(e.visible=c)}}}});var j=c.get(0);L.Browser.touch?L.DomEvent.on(j,"click",L.DomEvent.stopPropagation):(L.DomEvent.disableClickPropagation(j),L.DomEvent.on(j,"mousewheel",L.DomEvent.stopPropagation))}],template:'

{{ title }}

{{ baseTitle }}
{{ overlaysTitle }}
Range is not supported in this browser
',link:function(b,c,f,g){var h=e.isDefined,i=g.getLeafletScope(),j=i.layers;b.$watch("icons",function(){var c={uncheck:"fa fa-square-o",check:"fa fa-check-square-o",radio:"fa fa-dot-circle-o",unradio:"fa fa-circle-o",up:"fa fa-angle-up",down:"fa fa-angle-down",open:"fa fa-angle-double-down",close:"fa fa-angle-double-up",toggleLegend:"fa fa-pencil-square-o"};h(b.icons)?(a.extend(c,b.icons),a.extend(b.icons,c)):b.icons=c}),f.order=!h(f.order)||"normal"!==f.order&&"reverse"!==f.order?"normal":f.order,b.order="normal"===f.order,b.orderNumber="normal"===f.order?-1:1,b.layers=j,g.getMap().then(function(a){i.$watch("layers.baselayers",function(c){var e={};d.getLayers().then(function(d){var f;for(f in c){var g=c[f];g.icon=b.icons[a.hasLayer(d.baselayers[f])?"radio":"unradio"],e[f]=g}b.baselayersArray=e})}),i.$watch("layers.overlays",function(a){var c=[],e={};d.getLayers().then(function(){var d;for(d in a){var f=a[d];f.icon=b.icons[f.visible?"check":"uncheck"],c.push(f),h(b.layerProperties[f.name])||(h(f.layerOptions.opacity)&&(f.layerOptions.opacity=1),b.layerProperties[f.name]={opacityControl:!1,showLegend:!0,layerOptions:f.layerOptions}),h(f.group)&&(h(b.groupProperties[f.group])||(b.groupProperties[f.group]={visible:!1}),e[f.group]=h(e[f.group])?e[f.group]:{count:0,visibles:0},e[f.group].count++,f.visible&&e[f.group].visibles++)}for(d in e)b.groupProperties[d].visible=e[d].visibles===e[d].count;b.overlaysArray=c})},!0)})}}}]),a.module("ui-leaflet").directive("layers",["leafletLogger","$q","leafletData","leafletHelpers","leafletLayerHelpers","leafletControlHelpers",function(b,c,d,e,f,g){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",controller:["$scope",function(a){a._leafletLayers=c.defer(),this.getLayers=function(){return a._leafletLayers.promise}}],link:function(b,c,h,i){var j=e.isDefined,k={},l=i.getLeafletScope(),m=l.layers,n=f.createLayer,o=f.safeAddLayer,p=f.safeRemoveLayer,q=f.changeOpacityListener,r=g.updateLayersControl,s=!1;b.$on("$destroy",function(){g.destroyMapLayersControl(b.mapId)}),i.getMap().then(function(c){b._leafletLayers.resolve(k),d.setLayers(k,h.id),k.baselayers={},k.overlays={};var e=h.id,f=!1;for(var g in m.baselayers){var i=n(m.baselayers[g]);j(i)?(k.baselayers[g]=i,m.baselayers[g].top===!0&&(o(c,k.baselayers[g]),f=!0)):delete m.baselayers[g]}!f&&Object.keys(k.baselayers).length>0&&o(c,k.baselayers[Object.keys(m.baselayers)[0]]);for(g in m.overlays){"cartodb"===m.overlays[g].type;var t=n(m.overlays[g]);j(t)?(k.overlays[g]=t,m.overlays[g].visible===!0&&o(c,k.overlays[g])):delete m.overlays[g]}l.$watch("layers.baselayers",function(b,d){if(a.equals(b,d))return s=r(c,e,s,b,m.overlays,k),!0;for(var f in k.baselayers)j(b[f])&&!b[f].doRefresh||(c.hasLayer(k.baselayers[f])&&c.removeLayer(k.baselayers[f]),delete k.baselayers[f],b[f]&&b[f].doRefresh&&(b[f].doRefresh=!1));for(var g in b)if(j(k.baselayers[g]))b[g].top!==!0||c.hasLayer(k.baselayers[g])?b[g].top===!1&&c.hasLayer(k.baselayers[g])&&c.removeLayer(k.baselayers[g]):o(c,k.baselayers[g]);else{var h=n(b[g]);j(h)&&(k.baselayers[g]=h,b[g].top===!0&&o(c,k.baselayers[g]))}var i=!1;for(var l in k.baselayers)if(c.hasLayer(k.baselayers[l])){i=!0;break}!i&&Object.keys(k.baselayers).length>0&&o(c,k.baselayers[Object.keys(k.baselayers)[0]]),s=r(c,e,s,b,m.overlays,k)},!0),l.$watch("layers.overlays",function(b,d){if(a.equals(b,d))return s=r(c,e,s,m.baselayers,b,k),!0;for(var f in k.overlays)if(!j(b[f])||b[f].doRefresh){if(c.hasLayer(k.overlays[f])){var g=j(b[f])?b[f].layerOptions:null;p(c,k.overlays[f],g)}delete k.overlays[f],b[f]&&b[f].doRefresh&&(b[f].doRefresh=!1)}for(var h in b){if(j(k.overlays[h])){b[h].visible&&!c.hasLayer(k.overlays[h])?o(c,k.overlays[h]):b[h].visible===!1&&c.hasLayer(k.overlays[h])&&p(c,k.overlays[h],b[h].layerOptions);var i=k.overlays[h];c.hasLayer(k.overlays[h])&&(b[h].layerOptions.opacity!==d[h].layerOptions.opacity&&(j(i.setOpacity)&&i.setOpacity(b[h].layerOptions.opacity),j(i.getLayers)&&j(i.eachLayer)&&i.eachLayer(q(b[h].layerOptions.opacity))),j(b[h].index)&&i.setZIndex&&b[h].index!==d[h].index&&i.setZIndex(b[h].index))}else{var l=n(b[h]);if(!j(l))continue;k.overlays[h]=l,b[h].visible===!0&&o(c,k.overlays[h]),j(b[h].index)&&k.overlays[h].setZIndex&&k.overlays[h].setZIndex(b[h].index)}b[h].visible&&c._loaded&&b[h].data&&"heatmap"===b[h].type&&(k.overlays[h].setData(b[h].data),k.overlays[h].update())}s=r(c,e,s,m.baselayers,b,k)},!0)})}}}]),a.module("ui-leaflet").directive("legend",["leafletLogger","$http","$timeout","leafletHelpers","leafletLegendHelpers",function(a,b,c,d,e){var f=a,g=d.errorHeader+" [Legend] ";return{restrict:"A",scope:!1,replace:!1,require:"leaflet",transclude:!1,link:function(a,b,c,h){var i,j,k,l,m=d.isArray,n=d.isString,o=d.isDefined,p=d.isFunction,q=h.getLeafletScope(),r=q.legend;q.$watch("legend",function(a){o(a)&&(i=a.legendClass?a.legendClass:"legend",j=a.position||"bottomright",l=a.type||"arcgis")},!0);var s=function(a,b,c){b&&b.layers&&b.layers.length>0&&(o(k)?e.updateLegend(k.getContainer(),b,l,c):(k=L.control({position:j}),k.onAdd=e.getOnAddLegend(b,i,l,c),k.addTo(a)),o(r.loadedData)&&p(r.loadedData)&&r.loadedData())};h.getMap().then(function(a){q.$watch("legend",function(b){return o(b)?o(b.url)||"arcgis"!==l||m(b.colors)&&m(b.labels)&&b.colors.length===b.labels.length?o(b.url)?void f.info(g+" loading legend service."):(o(k)&&(k.removeFrom(a),k=null),k=L.control({position:j}),"arcgis"===l&&(k.onAdd=e.getOnAddArrayLegend(b,i)),void k.addTo(a)):void f.warn(g+" legend.colors and legend.labels must be set."):void(o(k)&&(k.removeFrom(a),k=null))}),q.$watch("legend.url",function(b){if(o(b)){if(!m(b)&&!n(b))return void f.warn(g+" legend.url must be an array or string.");for(var d,h=n(b)?[b]:b,i=function(c,e){return function(i){o(i.data.error)?f.warn(g+"Error loadin legend from: "+e,i.data.error.message):d&&d.layers&&d.layers.length>0?d.layers=d.layers.concat(i.data.layers):d=i.data,c===h.length-1&&s(a,d,b)}},j=function(a){f.warn(g+" legend.url not loaded.",a)},k=0;k