diff --git a/dist/js/waymark-js.js b/dist/js/waymark-js.js index 64dd464..3653f7d 100644 --- a/dist/js/waymark-js.js +++ b/dist/js/waymark-js.js @@ -9628,23 +9628,24 @@ function Waymark_Map_Viewer() { Waymark.elevation_control.loadData(feature); } - layer.on("click", function (e) { + jQuery(layer).on("click", { W: Waymark }, function (e) { + var W = e.data.W; var feature = e.target.feature; //Clear chart - Waymark.elevation_control.clear(); + W.elevation_control.clear(); //Clear Map layer - if (typeof Waymark.elevation_control.layer !== "undefined") { - Waymark.elevation_control.layer.removeFrom(Waymark.map); + if (typeof W.elevation_control.layer !== "undefined") { + W.elevation_control.layer.removeFrom(W.map); } //Feature has elevation data - Waymark.elevation_container.hide(); - if (Waymark.line_has_elevation_data(feature)) { - Waymark.elevation_container.show(); + W.elevation_container.hide(); + if (W.line_has_elevation_data(feature)) { + W.elevation_container.show(); - Waymark.elevation_control.loadData(feature); + W.elevation_control.loadData(feature); } }); } diff --git a/dist/js/waymark-js.min.js b/dist/js/waymark-js.min.js index 32c20d1..0181930 100644 --- a/dist/js/waymark-js.min.js +++ b/dist/js/waymark-js.min.js @@ -6,4 +6,4 @@ * Copyright (c) 2012 sa3m (https://github.com/sa3m) * Copyright (c) 2018 Per Liedman * All rights reserved. - */this.L=this.L||{},this.Waymark_L.Control=this.Waymark_L.Control||{},this.Waymark_L.Control.Geocoder=function(t){"use strict";t=t&&Waymark_L.hasOwnProperty("default")?t.default:t;var e=0,i=/[&<>"'`]/g,n=/[&<>"'`]/,o={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"};function a(t){return o[t]}function r(t,i,n,o,a){var r="_l_geocoder_"+e++;i[a||"callback"]=r,window[r]=Waymark_L.Util.bind(n,o);var s=document.createElement("script");s.type="text/javascript",s.src=t+h(i),s.id=r,document.getElementsByTagName("head")[0].appendChild(s)}function s(t,e,i){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState){var t;if(200!==n.status&&304!==n.status)t="";else if("string"==typeof n.response)try{t=JSON.parse(n.response)}catch(e){t=n.response}else t=n.response;i(t)}},n.open("GET",t+h(e),!0),n.responseType="json",n.setRequestHeader("Accept","application/json"),n.send(null)}function l(t,e){return t.replace(/\{ *([\w_]+) *\}/g,(function(t,o){var r,s=e[o];return void 0===s?s="":"function"==typeof s&&(s=s(e)),null==(r=s)?"":r?(r=""+r,n.test(r)?r.replace(i,a):r):r+""}))}function h(t,e,i){var n=[];for(var o in t){var a=encodeURIComponent(i?o.toUpperCase():o),r=t[o];if(Waymark_L.Util.isArray(r))for(var s=0;s0)for(var o=t.resourceSets[0].resources.length-1;o>=0;o--){var a=t.resourceSets[0].resources[o],r=a.bbox;n[o]={name:a.name,bbox:Waymark_L.latLngBounds([r[0],r[1]],[r[2],r[3]]),center:Waymark_L.latLng(a.point.coordinates)}}e.call(i,n)}),this,"jsonp")},reverse:function(t,e,i,n){r("//dev.virtualearth.net/REST/v1/Locations/"+t.lat+","+t.lng,{key:this.key},(function(t){for(var e=[],o=t.resourceSets[0].resources.length-1;o>=0;o--){var a=t.resourceSets[0].resources[o],r=a.bbox;e[o]={name:a.name,bbox:Waymark_L.latLngBounds([r[0],r[1]],[r[2],r[3]]),center:Waymark_L.latLng(a.point.coordinates)}}i.call(n,e)}),this,"jsonp")}});var c=Waymark_L.Class.extend({options:{serviceUrl:"https://maps.googleapis.com/maps/api/geocode/json",geocodingQueryParams:{},reverseQueryParams:{}},initialize:function(t,e){this._key=t,Waymark_L.setOptions(this,e),this.options.serviceUrl=this.options.service_url||this.options.serviceUrl},geocode:function(t,e,i){var n={address:t};this._key&&this._key.length&&(n.key=this._key),n=Waymark_L.Util.extend(n,this.options.geocodingQueryParams),s(this.options.serviceUrl,n,(function(t){var n,o,a,r=[];if(t.results&&t.results.length)for(var s=0;s<=t.results.length-1;s++)n=t.results[s],o=Waymark_L.latLng(n.geometry.location),a=Waymark_L.latLngBounds(Waymark_L.latLng(n.geometry.viewport.northeast),Waymark_L.latLng(n.geometry.viewport.southwest)),r[s]={name:n.formatted_address,bbox:a,center:o,properties:n.address_components};e.call(i,r)}))},reverse:function(t,e,i,n){var o={latlng:encodeURIComponent(t.lat)+","+encodeURIComponent(t.lng)};o=Waymark_L.Util.extend(o,this.options.reverseQueryParams),this._key&&this._key.length&&(o.key=this._key),s(this.options.serviceUrl,o,(function(t){var e,o,a,r=[];if(t.results&&t.results.length)for(var s=0;s<=t.results.length-1;s++)e=t.results[s],o=Waymark_L.latLng(e.geometry.location),a=Waymark_L.latLngBounds(Waymark_L.latLng(e.geometry.viewport.northeast),Waymark_L.latLng(e.geometry.viewport.southwest)),r[s]={name:e.formatted_address,bbox:a,center:o,properties:e.address_components};i.call(n,r)}))}});var _=Waymark_L.Class.extend({options:{geocodeUrl:"https://geocoder.api.here.com/6.2/geocode.json",reverseGeocodeUrl:"https://reverse.geocoder.api.here.com/6.2/reversegeocode.json",app_id:"",app_code:"",geocodingQueryParams:{},reverseQueryParams:{},reverseGeocodeProxRadius:null},initialize:function(t){Waymark_L.setOptions(this,t)},geocode:function(t,e,i){var n={searchtext:t,gen:9,app_id:this.options.app_id,app_code:this.options.app_code,jsonattributes:1};n=Waymark_L.Util.extend(n,this.options.geocodingQueryParams),this.getJSON(this.options.geocodeUrl,n,e,i)},reverse:function(t,e,i,n){var o=this.options.reverseGeocodeProxRadius?this.options.reverseGeocodeProxRadius:null,a=o?","+encodeURIComponent(o):"",r={prox:encodeURIComponent(t.lat)+","+encodeURIComponent(t.lng)+a,mode:"retrieveAddresses",app_id:this.options.app_id,app_code:this.options.app_code,gen:9,jsonattributes:1};r=Waymark_L.Util.extend(r,this.options.reverseQueryParams),this.getJSON(this.options.reverseGeocodeUrl,r,i,n)},getJSON:function(t,e,i,n){s(t,e,(function(t){var e,o,a,r=[];if(t.response.view&&t.response.view.length)for(var s=0;s<=t.response.view[0].result.length-1;s++)e=t.response.view[0].result[s].location,o=Waymark_L.latLng(e.displayPosition.latitude,e.displayPosition.longitude),a=Waymark_L.latLngBounds(Waymark_L.latLng(e.mapView.topLeft.latitude,e.mapView.topLeft.longitude),Waymark_L.latLng(e.mapView.bottomRight.latitude,e.mapView.bottomRight.longitude)),r[s]={name:e.address.label,bbox:a,center:o};i.call(n,r)}))}});var p=Waymark_L.Class.extend({options:{next:void 0,sizeInMeters:1e4},initialize:function(t){Waymark_L.Util.setOptions(this,t)},geocode:function(t,e,i){var n,o;if((n=t.match(/^([NS])\s*(\d{1,3}(?:\.\d*)?)\W*([EW])\s*(\d{1,3}(?:\.\d*)?)$/))?o=Waymark_L.latLng((/N/i.test(n[1])?1:-1)*parseFloat(n[2]),(/E/i.test(n[3])?1:-1)*parseFloat(n[4])):(n=t.match(/^(\d{1,3}(?:\.\d*)?)\s*([NS])\W*(\d{1,3}(?:\.\d*)?)\s*([EW])$/))?o=Waymark_L.latLng((/N/i.test(n[2])?1:-1)*parseFloat(n[1]),(/E/i.test(n[4])?1:-1)*parseFloat(n[3])):(n=t.match(/^([NS])\s*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\W*([EW])\s*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?$/))?o=Waymark_L.latLng((/N/i.test(n[1])?1:-1)*(parseFloat(n[2])+parseFloat(n[3]/60)),(/E/i.test(n[4])?1:-1)*(parseFloat(n[5])+parseFloat(n[6]/60))):(n=t.match(/^(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\s*([NS])\W*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\s*([EW])$/))?o=Waymark_L.latLng((/N/i.test(n[3])?1:-1)*(parseFloat(n[1])+parseFloat(n[2]/60)),(/E/i.test(n[6])?1:-1)*(parseFloat(n[4])+parseFloat(n[5]/60))):(n=t.match(/^([NS])\s*(\d{1,3})°?\s*(\d{1,2})['′]?\s*(\d{1,3}(?:\.\d*)?)?["″]?\W*([EW])\s*(\d{1,3})°?\s*(\d{1,2})['′]?\s*(\d{1,3}(?:\.\d*)?)?["″]?$/))?o=Waymark_L.latLng((/N/i.test(n[1])?1:-1)*(parseFloat(n[2])+parseFloat(n[3]/60+parseFloat(n[4]/3600))),(/E/i.test(n[5])?1:-1)*(parseFloat(n[6])+parseFloat(n[7]/60)+parseFloat(n[8]/3600))):(n=t.match(/^(\d{1,3})°?\s*(\d{1,2})['′]?\s*(\d{1,3}(?:\.\d*)?)?["″]\s*([NS])\W*(\d{1,3})°?\s*(\d{1,2})['′]?\s*(\d{1,3}(?:\.\d*)?)?["″]?\s*([EW])$/))?o=Waymark_L.latLng((/N/i.test(n[4])?1:-1)*(parseFloat(n[1])+parseFloat(n[2]/60+parseFloat(n[3]/3600))),(/E/i.test(n[8])?1:-1)*(parseFloat(n[5])+parseFloat(n[6]/60)+parseFloat(n[7]/3600))):(n=t.match(/^\s*([+-]?\d+(?:\.\d*)?)\s*[\s,]\s*([+-]?\d+(?:\.\d*)?)\s*$/))&&(o=Waymark_L.latLng(parseFloat(n[1]),parseFloat(n[2]))),o){var a=[{name:t,center:o,bbox:o.toBounds(this.options.sizeInMeters)}];e.call(i,a)}else this.options.next&&this.options.next.geocode(t,e,i)}});var m=Waymark_L.Class.extend({options:{serviceUrl:"https://api.mapbox.com/geocoding/v5/mapbox.places/",geocodingQueryParams:{},reverseQueryParams:{}},initialize:function(t,e){Waymark_L.setOptions(this,e),this.options.geocodingQueryParams.access_token=t,this.options.reverseQueryParams.access_token=t},geocode:function(t,e,i){var n=this.options.geocodingQueryParams;void 0!==n.proximity&&void 0!==n.proximity.lat&&void 0!==n.proximity.lng&&(n.proximity=n.proximity.lng+","+n.proximity.lat),s(this.options.serviceUrl+encodeURIComponent(t)+".json",n,(function(t){var n,o,a,r=[];if(t.features&&t.features.length)for(var s=0;s<=t.features.length-1;s++){n=t.features[s],o=Waymark_L.latLng(n.center.reverse()),a=n.bbox?Waymark_L.latLngBounds(Waymark_L.latLng(n.bbox.slice(0,2).reverse()),Waymark_L.latLng(n.bbox.slice(2,4).reverse())):Waymark_L.latLngBounds(o,o);for(var l={text:n.text,address:n.address},h=0;h<(n.context||[]).length;h++){l[n.context[h].id.split(".")[0]]=n.context[h].text}r[s]={name:n.place_name,bbox:a,center:o,properties:l}}e.call(i,r)}))},suggest:function(t,e,i){return this.geocode(t,e,i)},reverse:function(t,e,i,n){s(this.options.serviceUrl+encodeURIComponent(t.lng)+","+encodeURIComponent(t.lat)+".json",this.options.reverseQueryParams,(function(t){var e,o,a,r=[];if(t.features&&t.features.length)for(var s=0;s<=t.features.length-1;s++)e=t.features[s],o=Waymark_L.latLng(e.center.reverse()),a=e.bbox?Waymark_L.latLngBounds(Waymark_L.latLng(e.bbox.slice(0,2).reverse()),Waymark_L.latLng(e.bbox.slice(2,4).reverse())):Waymark_L.latLngBounds(o,o),r[s]={name:e.place_name,bbox:a,center:o};i.call(n,r)}))}});var f=Waymark_L.Class.extend({options:{serviceUrl:"https://www.mapquestapi.com/geocoding/v1"},initialize:function(t,e){this._key=decodeURIComponent(t),Waymark_L.Util.setOptions(this,e)},_formatName:function(){var t,e=[];for(t=0;t=0;r--)n=t.results[0].locations[r],o=Waymark_L.latLng(n.latLng),a[r]={name:this._formatName(n.street,n.adminArea4,n.adminArea3,n.adminArea1),bbox:Waymark_L.latLngBounds(o,o),center:o};e.call(i,a)}),this))},reverse:function(t,e,i,n){s(this.options.serviceUrl+"/reverse",{key:this._key,location:t.lat+","+t.lng,outputFormat:"json"},Waymark_L.bind((function(t){var e,o,a=[];if(t.results&&t.results[0].locations)for(var r=t.results[0].locations.length-1;r>=0;r--)e=t.results[0].locations[r],o=Waymark_L.latLng(e.latLng),a[r]={name:this._formatName(e.street,e.adminArea4,e.adminArea3,e.adminArea1),bbox:Waymark_L.latLngBounds(o,o),center:o};i.call(n,a)}),this))}});var g=Waymark_L.Class.extend({options:{userId:"",apiKey:"",serviceUrl:"https://neutrinoapi.com/"},initialize:function(t){Waymark_L.Util.setOptions(this,t)},geocode:function(t,e,i){s(this.options.serviceUrl+"geocode-address",{apiKey:this.options.apiKey,userId:this.options.userId,address:t.split(/\s+/).join(".")},(function(t){var n,o,a=[];t.locations&&(t.geometry=t.locations[0],n=Waymark_L.latLng(t.geometry.latitude,t.geometry.longitude),o=Waymark_L.latLngBounds(n,n),a[0]={name:t.geometry.address,bbox:o,center:n}),e.call(i,a)}))},suggest:function(t,e,i){return this.geocode(t,e,i)},reverse:function(t,e,i,n){s(this.options.serviceUrl+"geocode-reverse",{apiKey:this.options.apiKey,userId:this.options.userId,latitude:t.lat,longitude:t.lng},(function(e){var o,a,r=[];200==e.status.status&&e.found&&(o=Waymark_L.latLng(t.lat,t.lng),a=Waymark_L.latLngBounds(o,o),r[0]={name:e.address,bbox:a,center:o}),i.call(n,r)}))}});var y=Waymark_L.Class.extend({options:{serviceUrl:"https://nominatim.openstreetmap.org/",geocodingQueryParams:{},reverseQueryParams:{},htmlTemplate:function(t){var e=t.address,i=[];return(e.road||e.building)&&i.push("{building} {road} {house_number}"),(e.city||e.town||e.village||e.hamlet)&&i.push('{postcode} {city} {town} {village} {hamlet}'),(e.state||e.country)&&i.push('{state} {country}'),l(i.join("
"),e)}},initialize:function(t){Waymark_L.Util.setOptions(this,t)},geocode:function(t,e,i){s(this.options.serviceUrl+"search",Waymark_L.extend({q:t,limit:5,format:"json",addressdetails:1},this.options.geocodingQueryParams),Waymark_L.bind((function(t){for(var n=[],o=t.length-1;o>=0;o--){for(var a=t[o].boundingbox,r=0;r<4;r++)a[r]=parseFloat(a[r]);n[o]={icon:t[o].icon,name:t[o].display_name,html:this.options.htmlTemplate?this.options.htmlTemplate(t[o]):void 0,bbox:Waymark_L.latLngBounds([a[0],a[2]],[a[1],a[3]]),center:Waymark_L.latLng(t[o].lat,t[o].lon),properties:t[o]}}e.call(i,n)}),this))},reverse:function(t,e,i,n){s(this.options.serviceUrl+"reverse",Waymark_L.extend({lat:t.lat,lon:t.lng,zoom:Math.round(Math.log(e/256)/Math.log(2)),addressdetails:1,format:"json"},this.options.reverseQueryParams),Waymark_L.bind((function(t){var e,o=[];t&&t.lat&&t.lon&&(e=Waymark_L.latLng(t.lat,t.lon),o.push({name:t.display_name,html:this.options.htmlTemplate?this.options.htmlTemplate(t):void 0,center:e,bounds:Waymark_L.latLngBounds(e,e),properties:t})),i.call(n,o)}),this))}});var v=Waymark_L.Class.extend({options:{OpenLocationCode:void 0,codeLength:void 0},initialize:function(t){Waymark_L.setOptions(this,t)},geocode:function(t,e,i){try{var n=this.options.OpenLocationCode.decode(t),o={name:t,center:Waymark_L.latLng(n.latitudeCenter,n.longitudeCenter),bbox:Waymark_L.latLngBounds(Waymark_L.latLng(n.latitudeLo,n.longitudeLo),Waymark_L.latLng(n.latitudeHi,n.longitudeHi))};e.call(i,[o])}catch(t){console.warn(t),e.call(i,[])}},reverse:function(t,e,i,n){try{var o={name:this.options.OpenLocationCode.encode(t.lat,t.lng,this.options.codeLength),center:Waymark_L.latLng(t.lat,t.lng),bbox:Waymark_L.latLngBounds(Waymark_L.latLng(t.lat,t.lng),Waymark_L.latLng(t.lat,t.lng))};i.call(n,[o])}catch(t){console.warn(t),i.call(n,[])}}});var k=Waymark_L.Class.extend({options:{serviceUrl:"https://api.opencagedata.com/geocode/v1/json"},initialize:function(t){this._accessToken=t},geocode:function(t,e,i){s(this.options.serviceUrl,{key:this._accessToken,q:t},(function(t){var n,o,a,r=[];if(t.results&&t.results.length)for(var s=0;sthis._lastSuggest&&(this._lastSuggest=t.geocoding.timestamp,e.call(i,n._parseResults(t,"bbox")))}),this))},reverse:function(t,e,i,n){var o=this;s(this.options.serviceUrl+"/reverse",Waymark_L.extend({api_key:this._apiKey,"point.lat":t.lat,"point.lon":t.lng},this.options.reverseQueryParams),(function(t){i.call(n,o._parseResults(t,"bounds"))}))},_parseResults:function(t,e){var i=[];return Waymark_L.geoJson(t,{pointToLayer:function(t,e){return Waymark_L.circleMarker(e)},onEachFeature:function(t,n){var o,a,r={};n.getBounds?a=(o=n.getBounds()).getCenter():n.feature.bbox?(a=n.getLatLng(),o=Waymark_L.latLngBounds(Waymark_L.GeoJSON.coordsToLatLng(n.feature.bbox.slice(0,2)),Waymark_L.GeoJSON.coordsToLatLng(n.feature.bbox.slice(2,4)))):(a=n.getLatLng(),o=Waymark_L.latLngBounds(a,a)),r.name=n.feature.properties.label,r.center=a,r[e]=o,r.properties=n.feature.properties,i.push(r)}}),i}});function w(t,e){return new L(t,e)}var b=L,x=w,W=L,C=w,M=W.extend({options:{serviceUrl:"https://api.openrouteservice.org/geocode"}});var P=Waymark_L.Class.extend({options:{serviceUrl:"https://photon.komoot.de/api/",reverseUrl:"https://photon.komoot.de/reverse/",nameProperties:["name","street","suburb","hamlet","town","city","state","country"]},initialize:function(t){Waymark_L.setOptions(this,t)},geocode:function(t,e,i){var n=Waymark_L.extend({q:t},this.options.geocodingQueryParams);s(this.options.serviceUrl,n,Waymark_L.bind((function(t){e.call(i,this._decodeFeatures(t))}),this))},suggest:function(t,e,i){return this.geocode(t,e,i)},reverse:function(t,e,i,n){var o=Waymark_L.extend({lat:t.lat,lon:t.lng},this.options.reverseQueryParams);s(this.options.reverseUrl,o,Waymark_L.bind((function(t){i.call(n,this._decodeFeatures(t))}),this))},_decodeFeatures:function(t){var e,i,n,o,a,r,s=[];if(t&&t.features)for(e=0;e0){this._alts.innerHTML="",this._results=t,Waymark_L.DomUtil.removeClass(this._alts,"leaflet-control-geocoder-alternatives-minimized"),Waymark_L.DomUtil.addClass(this._container,"leaflet-control-geocoder-options-open");for(var i=0;i0?"nextSibling":"previousSibling"]),e._selection||(e._selection=e._alts[t>0?"firstChild":"lastChild"]),e._selection&&Waymark_L.DomUtil.addClass(e._selection,"leaflet-control-geocoder-selected")};switch(t.keyCode){case 27:this.options.collapsed?this._collapse():this._clearResults();break;case 38:i(-1);break;case 40:i(1);break;case 13:if(this._selection){var n=parseInt(this._selection.getAttribute("data-result-index"),10);this._geocodeResultSelected(this._results[n]),this._clearResults()}else this._geocode();break;default:return}Waymark_L.DomEvent.preventDefault(t)},_change:function(){var t=this._input.value;t!==this._lastGeocode&&(clearTimeout(this._suggestTimeout),t.length>=this.options.suggestMinLength?this._suggestTimeout=setTimeout(Waymark_L.bind((function(){this._geocode(!0)}),this),this.options.suggestTimeout):this._clearResults())}});return Waymark_L.Util.extend(S,T),Waymark_L.Util.extend(Waymark_L.Control,{Geocoder:S,geocoder:function(t){return new S(t)}}),S}(L),function(t,e){"function"==typeof define&&define.amd?define(["leaflet"],t):"object"==typeof exports&&(void 0!==e&&e.L?module.exports=t(L):module.exports=t(require("leaflet"))),void 0!==e&&e.L&&(e.Waymark_L.Control.Locate=t(L))}((function(t){var e=function(e,i,n){(n=n.split(" ")).forEach((function(n){t.DomUtil[e].call(this,i,n)}))},i=function(t,i){e("addClass",t,i)},n=function(t,i){e("removeClass",t,i)},o=t.Marker.extend({initialize:function(e,i){t.Util.setOptions(this,i),this._latlng=e,this.createIcon()},createIcon:function(){var e=this.options,i="";void 0!==e.color&&(i+="stroke:"+e.color+";"),void 0!==e.weight&&(i+="stroke-width:"+e.weight+";"),void 0!==e.fillColor&&(i+="fill:"+e.fillColor+";"),void 0!==e.fillOpacity&&(i+="fill-opacity:"+e.fillOpacity+";"),void 0!==e.opacity&&(i+="opacity:"+e.opacity+";");var n=this._getIconSVG(e,i);this._locationIcon=t.divIcon({className:n.className,html:n.svg,iconSize:[n.w,n.h]}),this.setIcon(this._locationIcon)},_getIconSVG:function(t,e){var i=t.radius,n=i+t.weight,o=2*n;return{className:"leaflet-control-locate-location",svg:'',w:o,h:o}},setStyle:function(e){t.Util.setOptions(this,e),this.createIcon()}}),a=o.extend({initialize:function(e,i,n){t.Util.setOptions(this,n),this._latlng=e,this._heading=i,this.createIcon()},setHeading:function(t){this._heading=t},_getIconSVG:function(t,e){var i=t.radius,n=t.width+t.weight,o=2*(i+t.depth+t.weight),a="M0,0 l"+t.width/2+","+t.depth+" l-"+n+",0 z";return{className:"leaflet-control-locate-heading",svg:'',w:n,h:o}}}),r=t.Control.extend({options:{position:"topleft",layer:void 0,setView:"untilPanOrZoom",keepCurrentZoomLevel:!1,getLocationBounds:function(t){return t.bounds},flyTo:!1,clickBehavior:{inView:"stop",outOfView:"setView",inViewNotFollowing:"inView"},returnToPrevBounds:!1,cacheLocation:!0,drawCircle:!0,drawMarker:!0,showCompass:!0,markerClass:o,compassClass:a,circleStyle:{className:"leaflet-control-locate-circle",color:"#136AEC",fillColor:"#136AEC",fillOpacity:.15,weight:0},markerStyle:{className:"leaflet-control-locate-marker",color:"#fff",fillColor:"#2A93EE",fillOpacity:1,weight:3,opacity:1,radius:9},compassStyle:{fillColor:"#2A93EE",fillOpacity:1,weight:0,color:"#fff",opacity:1,radius:9,width:9,depth:6},followCircleStyle:{},followMarkerStyle:{},followCompassStyle:{},icon:"fa fa-map-marker",iconLoading:"fa fa-spinner fa-spin",iconElementTag:"span",circlePadding:[0,0],metric:!0,createButtonCallback:function(e,i){var n=t.DomUtil.create("a","leaflet-bar-part leaflet-bar-part-single",e);return n.title=i.strings.title,{link:n,icon:t.DomUtil.create(i.iconElementTag,i.icon,n)}},onLocationError:function(t,e){alert(t.message)},onLocationOutsideMapBounds:function(t){t.stop(),alert(t.options.strings.outsideMapBoundsMsg)},showPopup:!0,strings:{title:"Show me where I am",metersUnit:"meters",feetUnit:"feet",popup:"You are within {distance} {unit} from this point",outsideMapBoundsMsg:"You seem located outside the boundaries of the map"},locateOptions:{maxZoom:1/0,watch:!0,setView:!1}},initialize:function(e){for(var i in e)"object"==typeof this.options[i]?t.extend(this.options[i],e[i]):this.options[i]=e[i];this.options.followMarkerStyle=t.extend({},this.options.markerStyle,this.options.followMarkerStyle),this.options.followCircleStyle=t.extend({},this.options.circleStyle,this.options.followCircleStyle),this.options.followCompassStyle=t.extend({},this.options.compassStyle,this.options.followCompassStyle)},onAdd:function(e){var i=t.DomUtil.create("div","leaflet-control-locate leaflet-bar leaflet-control");this._layer=this.options.layer||new t.LayerGroup,this._layer.addTo(e),this._event=void 0,this._compassHeading=null,this._prevBounds=null;var n=this.options.createButtonCallback(i,this.options);return this._link=n.link,this._icon=n.icon,t.DomEvent.on(this._link,"click",t.DomEvent.stopPropagation).on(this._link,"click",t.DomEvent.preventDefault).on(this._link,"click",this._onClick,this).on(this._link,"dblclick",t.DomEvent.stopPropagation),this._resetVariables(),this._map.on("unload",this._unload,this),i},_onClick:function(){this._justClicked=!0;var t=this._isFollowing();if(this._userPanned=!1,this._userZoomed=!1,this._active&&!this._event)this.stop();else if(this._active&&void 0!==this._event){var e=this.options.clickBehavior,i=e.outOfView;switch(this._map.getBounds().contains(this._event.latlng)&&(i=t?e.inView:e.inViewNotFollowing),e[i]&&(i=e[i]),i){case"setView":this.setView();break;case"stop":this.stop(),this.options.returnToPrevBounds&&(this.options.flyTo?this._map.flyToBounds:this._map.fitBounds).bind(this._map)(this._prevBounds)}}else this.options.returnToPrevBounds&&(this._prevBounds=this._map.getBounds()),this.start();this._updateContainerStyle()},start:function(){this._activate(),this._event&&(this._drawMarker(this._map),this.options.setView&&this.setView()),this._updateContainerStyle()},stop:function(){this._deactivate(),this._cleanClasses(),this._resetVariables(),this._removeMarker()},stopFollowing:function(){this._userPanned=!0,this._updateContainerStyle(),this._drawMarker()},_activate:function(){this._active||(this._map.locate(this.options.locateOptions),this._active=!0,this._map.on("locationfound",this._onLocationFound,this),this._map.on("locationerror",this._onLocationError,this),this._map.on("dragstart",this._onDrag,this),this._map.on("zoomstart",this._onZoom,this),this._map.on("zoomend",this._onZoomEnd,this),this.options.showCompass&&("ondeviceorientationabsolute"in window?t.DomEvent.on(window,"deviceorientationabsolute",this._onDeviceOrientation,this):"ondeviceorientation"in window&&t.DomEvent.on(window,"deviceorientation",this._onDeviceOrientation,this)))},_deactivate:function(){this._map.stopLocate(),this._active=!1,this.options.cacheLocation||(this._event=void 0),this._map.off("locationfound",this._onLocationFound,this),this._map.off("locationerror",this._onLocationError,this),this._map.off("dragstart",this._onDrag,this),this._map.off("zoomstart",this._onZoom,this),this._map.off("zoomend",this._onZoomEnd,this),this.options.showCompass&&(this._compassHeading=null,"ondeviceorientationabsolute"in window?t.DomEvent.off(window,"deviceorientationabsolute",this._onDeviceOrientation,this):"ondeviceorientation"in window&&t.DomEvent.off(window,"deviceorientation",this._onDeviceOrientation,this))},setView:function(){if(this._drawMarker(),this._isOutsideMapBounds())this._event=void 0,this.options.onLocationOutsideMapBounds(this);else if(this.options.keepCurrentZoomLevel)(e=this.options.flyTo?this._map.flyTo:this._map.panTo).bind(this._map)([this._event.latitude,this._event.longitude]);else{var e=this.options.flyTo?this._map.flyToBounds:this._map.fitBounds;this._ignoreEvent=!0,e.bind(this._map)(this.options.getLocationBounds(this._event),{padding:this.options.circlePadding,maxZoom:this.options.locateOptions.maxZoom}),t.Util.requestAnimFrame((function(){this._ignoreEvent=!1}),this)}},_drawCompass:function(){if(this._event){var t=this._event.latlng;if(this.options.showCompass&&t&&null!==this._compassHeading){var e=this._isFollowing()?this.options.followCompassStyle:this.options.compassStyle;this._compass?(this._compass.setLatLng(t),this._compass.setHeading(this._compassHeading),this._compass.setStyle&&this._compass.setStyle(e)):this._compass=new this.options.compassClass(t,this._compassHeading,e).addTo(this._layer)}!this._compass||this.options.showCompass&&null!==this._compassHeading||(this._compass.removeFrom(this._layer),this._compass=null)}},_drawMarker:function(){void 0===this._event.accuracy&&(this._event.accuracy=0);var e,i,n=this._event.accuracy,o=this._event.latlng;if(this.options.drawCircle){var a=this._isFollowing()?this.options.followCircleStyle:this.options.circleStyle;this._circle?this._circle.setLatLng(o).setRadius(n).setStyle(a):this._circle=t.circle(o,n,a).addTo(this._layer)}if(i=this.options.metric?(e=n.toFixed(0),this.options.strings.metersUnit):(e=(3.2808399*n).toFixed(0),this.options.strings.feetUnit),this.options.drawMarker){var r=this._isFollowing()?this.options.followMarkerStyle:this.options.markerStyle;this._marker?(this._marker.setLatLng(o),this._marker.setStyle&&this._marker.setStyle(r)):this._marker=new this.options.markerClass(o,r).addTo(this._layer)}this._drawCompass();var s=this.options.strings.popup;this.options.showPopup&&s&&this._marker&&this._marker.bindPopup(t.Util.template(s,{distance:e,unit:i}))._popup.setLatLng(o),this.options.showPopup&&s&&this._compass&&this._compass.bindPopup(t.Util.template(s,{distance:e,unit:i}))._popup.setLatLng(o)},_removeMarker:function(){this._layer.clearLayers(),this._marker=void 0,this._circle=void 0},_unload:function(){this.stop(),this._map.off("unload",this._unload,this)},_setCompassHeading:function(e){!isNaN(parseFloat(e))&&isFinite(e)?(e=Math.round(e),this._compassHeading=e,t.Util.requestAnimFrame(this._drawCompass,this)):this._compassHeading=null},_onCompassNeedsCalibration:function(){this._setCompassHeading()},_onDeviceOrientation:function(t){this._active&&(t.webkitCompassHeading?this._setCompassHeading(t.webkitCompassHeading):t.absolute&&t.alpha&&this._setCompassHeading(360-t.alpha))},_onLocationError:function(t){3==t.code&&this.options.locateOptions.watch||(this.stop(),this.options.onLocationError(t,this))},_onLocationFound:function(t){if((!this._event||this._event.latlng.lat!==t.latlng.lat||this._event.latlng.lng!==t.latlng.lng||this._event.accuracy!==t.accuracy)&&this._active){switch(this._event=t,this._drawMarker(),this._updateContainerStyle(),this.options.setView){case"once":this._justClicked&&this.setView();break;case"untilPan":this._userPanned||this.setView();break;case"untilPanOrZoom":this._userPanned||this._userZoomed||this.setView();break;case"always":this.setView()}this._justClicked=!1}},_onDrag:function(){this._event&&!this._ignoreEvent&&(this._userPanned=!0,this._updateContainerStyle(),this._drawMarker())},_onZoom:function(){this._event&&!this._ignoreEvent&&(this._userZoomed=!0,this._updateContainerStyle(),this._drawMarker())},_onZoomEnd:function(){this._event&&this._drawCompass(),this._event&&!this._ignoreEvent&&this._marker&&!this._map.getBounds().pad(-.3).contains(this._marker.getLatLng())&&(this._userPanned=!0,this._updateContainerStyle(),this._drawMarker())},_isFollowing:function(){return!!this._active&&("always"===this.options.setView||("untilPan"===this.options.setView?!this._userPanned:"untilPanOrZoom"===this.options.setView?!this._userPanned&&!this._userZoomed:void 0))},_isOutsideMapBounds:function(){return void 0!==this._event&&this._map.options.maxBounds&&!this._map.options.maxBounds.contains(this._event.latlng)},_updateContainerStyle:function(){this._container&&(this._active&&!this._event?this._setClasses("requesting"):this._isFollowing()?this._setClasses("following"):this._active?this._setClasses("active"):this._cleanClasses())},_setClasses:function(t){"requesting"==t?(n(this._container,"active following"),i(this._container,"requesting"),n(this._icon,this.options.icon),i(this._icon,this.options.iconLoading)):"active"==t?(n(this._container,"requesting following"),i(this._container,"active"),n(this._icon,this.options.iconLoading),i(this._icon,this.options.icon)):"following"==t&&(n(this._container,"requesting"),i(this._container,"active following"),n(this._icon,this.options.iconLoading),i(this._icon,this.options.icon))},_cleanClasses:function(){t.DomUtil.removeClass(this._container,"requesting"),t.DomUtil.removeClass(this._container,"active"),t.DomUtil.removeClass(this._container,"following"),n(this._icon,this.options.iconLoading),i(this._icon,this.options.icon)},_resetVariables:function(){this._active=!1,this._justClicked=!1,this._userPanned=!1,this._userZoomed=!1}});return t.control.locate=function(e){return new t.Control.Locate(e)},r}),window),function(t){"function"==typeof define&&define.amd?define(t):t()}((function(){"use strict";!function(t,e){"function"==typeof define&&define.amd?define(["leaflet"],t):"object"==typeof exports&&(module.exports=t(require("leaflet"))),void 0!==e&&e.L&&t(e.L)}((function(t){return t.locales={},t.locale=null,t.registerLocale=function(e,i){t.locales[e]=t.Util.extend({},t.locales[e],i)},t.setLocale=function(e){t.locale=e},t.i18n=t._=function(e,i){t.locale&&t.locales[t.locale]&&t.locales[t.locale][e]&&(e=t.locales[t.locale][e]);try{e=t.Util.template(e,i)}catch(t){}return e}}),window),L.Control.Elevation=L.Control.extend({includes:L.Evented?L.Evented.prototype:L.Mixin.Events,options:{autohide:!L.Browser.mobile,autohideMarker:!0,collapsed:!1,controlButton:{iconCssClass:"elevation-toggle-icon",title:"Elevation"},detached:!0,distanceFactor:1,dragging:!L.Browser.mobile,downloadLink:"link",elevationDiv:"#elevation-div",followMarker:!0,forceAxisBounds:!1,gpxOptions:{async:!0,marker_options:{startIconUrl:null,endIconUrl:null,shadowUrl:null,wptIcons:{"":L.divIcon({className:"elevation-waypoint-marker",html:'',iconSize:[30,30],iconAnchor:[8,30]})}}},height:200,heightFactor:1,hoverNumber:{decimalsX:2,decimalsY:0,formatter:void 0},imperial:!1,interpolation:"curveLinear",lazyLoadJS:!0,legend:!0,loadData:{defer:!1,lazy:!1},marker:"elevation-line",markerIcon:L.divIcon({className:"elevation-position-marker",html:'',iconSize:[32,32],iconAnchor:[16,16]}),placeholder:!1,position:"topright",polyline:{className:"elevation-polyline",color:"#000",opacity:.75,weight:5,lineCap:"round"},reverseCoords:!1,skipNullZCoords:!1,theme:"lightblue-theme",margins:{top:10,right:20,bottom:30,left:50},responsive:!0,summary:"inline",width:600,xLabel:"km",xTicks:void 0,yAxisMax:void 0,yAxisMin:void 0,yLabel:"m",yTicks:void 0,zFollow:13},__mileFactor:.621371,__footFactor:3.28084,addData:function(t,e){L.Control.Elevation._d3LazyLoader=this._lazyLoadJS("https://unpkg.com/d3@5.15.0/dist/d3.min.js","object"!=typeof d3,L.Control.Elevation._d3LazyLoader).then(function(t,e){this._addData(t),this._container&&this._applyData(),null==e&&t.on&&(e=t),e&&(e._path&&L.DomUtil.addClass(e._path,this.options.polyline.className+" "+this.options.theme),e.on("mousemove",this._mousemoveLayerHandler,this).on("mouseout",this._mouseoutHandler,this)),this.track_info=L.extend({},this.track_info,{distance:this._distance,elevation_max:this._maxElevation,elevation_min:this._minElevation,ascent:this._ascent,descent:this._descent}),this._layers=this._layers||{},this._layers[L.Util.stamp(e)]=e,this._fireEvt("eledata_added",{data:t,layer:e,track_info:this.track_info},!0)}.bind(this,t,e))},addTo:function(t){return this.options.detached?this._appendElevationDiv(t._container).appendChild(this.onAdd(t)):L.Control.prototype.addTo.call(this,t),this},clear:function(){this._clearPath(),this._clearChart(),this._clearData(),this._fireEvt("eledata_clear")},disableDragging:function(){this._draggingEnabled=!1,this._resetDrag()},enableDragging:function(){this._draggingEnabled=!0},fitBounds:function(t){t=t||this._fullExtent,this._map&&t&&this._map.fitBounds(t)},getZFollow:function(){return this._zFollow},hide:function(){this._container.style.display="none"},initialize:function(t){this.options=this._deepMerge({},this.options,t),this.options.imperial?(this._distanceFactor=this.__mileFactor,this._heightFactor=this.__footFactor,this._xLabel="mi",this._yLabel="ft"):(this._distanceFactor=this.options.distanceFactor,this._heightFactor=this.options.heightFactor,this._xLabel=this.options.xLabel,this._yLabel=this.options.yLabel),this._chartEnabled=!0,this._draggingEnabled=this.options.dragging,this._zFollow=this.options.zFollow,this.options.followMarker&&(this._setMapView=L.Util.throttle(this._setMapView,300,this)),this.options.placeholder&&(this.options.loadData.lazy=this.options.loadData.defer=!0),this.on("waypoint_added",(function(t){t.point._popup&&(t.point._popup.options.className="elevation-popup",t.point._popup._content=decodeURI(t.point._popup._content)),t.point._popup&&t.point._popup._content&&t.point.bindTooltip(t.point._popup._content,{direction:"top",sticky:!0,opacity:1,className:"elevation-tooltip"}).openTooltip()}))},load:function(t,e){this.loadData(t,e)},loadChart:function(t){this.addTo(t)},loadData:function(t,e){(e=L.extend({},this.options.loadData,e)).defer?this.loadDefer(t,e):e.lazy?this.loadLazy(t,e):this._isXMLDoc(t)?this.loadGPX(t):this._isJSONDoc(t)?this.loadGeoJSON(t):this.loadFile(t)},loadDefer:function(t,e){(e=L.extend({},this.options.loadData,e)).defer=!1,"complete"!==document.readyState?window.addEventListener("load",L.bind(this.loadData,this,t,e),{once:!0}):this.loadData(t,e)},loadFile:function(t){this._downloadURL=t;try{let e=new XMLHttpRequest;e.responseType="text",e.open("GET",t),e.onload=function(){if(200!==e.status)throw"Error "+e.status+" while fetching remote file: "+t;this.loadData(e.response,{lazy:!1,defer:!1})}.bind(this),e.send()}catch(t){console.warn(t)}},loadGeoJSON:function(t){"string"==typeof t&&(t=JSON.parse(t)),this.layer=this.geojson=L.geoJson(t,{style:function(t){let e=L.extend({},this.options.polyline);return this.options.theme&&(e.className+=" "+this.options.theme),e}.bind(this),pointToLayer:function(t,e){let i=L.marker(e,{icon:this.options.gpxOptions.marker_options.wptIcons[""]}),n=t.properties.desc?t.properties.desc:"",o=t.properties.name?t.properties.name:"";return(o||n)&&i.bindPopup(""+o+""+(n.length>0?"
"+n:"")).openPopup(),this.fire("waypoint_added",{point:i,point_type:"waypoint",element:e}),i}.bind(this),onEachFeature:function(e,i){"Point"!=e.geometry.type&&(this.addData(e,i),this.track_info=L.extend({},this.track_info,{type:"geojson",name:t.name}))}.bind(this)}),this._map?(this._map.once("layeradd",(function(e){this._fireEvt("eledata_loaded",{data:t,layer:this.layer,name:this.track_info.name,track_info:this.track_info},!0)}),this),this.layer.addTo(this._map)):console.warn("Undefined elevation map object")},loadGPX:function(t){L.Control.Elevation._gpxLazyLoader=this._lazyLoadJS("https://unpkg.com/leaflet-gpx@1.5.0/gpx.js","function"!=typeof L.GPX,L.Control.Elevation._gpxLazyLoader).then(function(t){this.options.gpxOptions.polyline_options=L.extend({},this.options.polyline,this.options.gpxOptions.polyline_options),this.options.theme&&(this.options.gpxOptions.polyline_options.className+=" "+this.options.theme),this.layer=this.gpx=new L.GPX(t,this.options.gpxOptions),this.layer.on("loaded",(function(t){this.fitBounds(t.target.getBounds())}),this),this.layer.on("addpoint",(function(t){this.fire("waypoint_added",t,!0)}),this),this.layer.once("addline",(function(e){this.addData(e.line),this.track_info=L.extend({},this.track_info,{type:"gpx",name:this.layer.get_name()}),this._fireEvt("eledata_loaded",{data:t,layer:this.layer,name:this.track_info.name,track_info:this.track_info},!0)}),this),this._map?this.layer.addTo(this._map):console.warn("Undefined elevation map object")}.bind(this,t))},loadLazy:function(t,e){(e=L.extend({},this.options.loadData,e)).lazy=!1;let i=!1,n=L.bind((function(t){i||(L.Util.requestAnimFrame((function(){this._isVisible(this.placeholder)&&(window.removeEventListener("scroll",n),this.loadData(t,e),this.once("eledata_loaded",(function(){this.placeholder&&this.placeholder.parentNode&&this.placeholder.parentNode.removeChild(this.placeholder)}),this)),i=!1}),this),i=!0)}),this,t);window.addEventListener("scroll",n),this.placeholder&&this.placeholder.addEventListener("mouseenter",n,{once:!0}),n()},onAdd:function(t){this._map=t;let e=this._container=L.DomUtil.create("div","elevation-control elevation");if(this.options.detached||L.DomUtil.addClass(e,"leaflet-control"),this.options.theme&&L.DomUtil.addClass(e,this.options.theme),this.options.placeholder&&!this._data){if(this.placeholder=L.DomUtil.create("img","elevation-placeholder"),"string"==typeof this.options.placeholder)this.placeholder.src=this.options.placeholder,this.placeholder.alt="";else for(let t in this.options.placeholder)this.placeholder.setAttribute(t,this.options.placeholder[t]);e.insertBefore(this.placeholder,e.firstChild)}return L.Control.Elevation._d3LazyLoader=this._lazyLoadJS("https://unpkg.com/d3@5.15.0/dist/d3.min.js","object"!=typeof d3,L.Control.Elevation._d3LazyLoader).then(function(t,e){this._initToggle(e),this._initChart(e),this._applyData(),this._map.on("zoom viewreset zoomanim",this._hidePositionMarker,this),this._map.on("resize",this._resetView,this),this._map.on("resize",this._resizeChart,this),this._map.on("mousedown",this._resetDrag,this),this._map.on("eledata_added",this._updateSummary,this),L.DomEvent.on(this._map._container,"mousewheel",this._resetDrag,this),L.DomEvent.on(this._map._container,"touchstart",this._resetDrag,this)}.bind(this,t,e)),e},onRemove:function(t){this._container=null},redraw:function(){this._resizeChart()},setZFollow:function(t){this._zFollow=t},show:function(){this._container.style.display="block"},_addData:function(t){let e=t&&t.geometry,i=t&&"FeatureCollection"===t.type,n=t&&t._latlngs;if(e)switch(e.type){case"LineString":this._addGeoJSONData(e.coordinates);break;case"MultiLineString":e.coordinates.forEach(t=>this._addGeoJSONData(t));break;default:console.warn("Unsopperted GeoJSON feature geometry type:"+e.type)}i&&t.features.forEach(t=>this._addData(t)),n&&this._addGPXdata(t._latlngs)},_addGeoJSONData:function(t){t&&t.forEach(t=>this._addPoint(t[1],t[0],t[2]))},_addGPXdata:function(t){t&&t.forEach(t=>this._addPoint(t.lat,t.lng,t.meta.ele))},_addPoint:function(t,e,i){this.options.reverseCoords&&([t,e]=[e,t]);let n=this._data||[],o=this._maxElevation||-1/0,a=this._minElevation||1/0,r=this._distance||0,s=new L.LatLng(t,e),l=n.length?n[n.length-1].latlng:s,h=s.distanceTo(l)*this._distanceFactor;if(r+=Math.round(h/1e3*1e5)/1e5,!this.options.skipNullZCoords&&n.length>0){let t=n[n.length-1].z;if(isNaN(t)){let e=this._lastValidZ,o=i*this._heightFactor;isNaN(e)||isNaN(o)?isNaN(e)?isNaN(o)||(t=o):t=e:t=(e+o)/2,isNaN(t)?n.splice(n.length-1,1):n[n.length-1].z=t}}if(i*=this._heightFactor,!isNaN(i)){o=oi?i:a;let t=i-this._lastValidZ;t>0?(this.track_info.ascent=(this.track_info.ascent||0)+t,this._ascent=this.track_info.ascent):t<0&&(this.track_info.descent=(this.track_info.descent||0)-t,this._descent=this.track_info.descent),this._lastValidZ=i}n.push({dist:r,x:t,y:e,z:i,latlng:s}),this._data=n,this._distance=r,this._maxElevation=o,this._minElevation=a},_appendChart:function(t){let e=t.append("g").attr("transform","translate("+this.options.margins.left+","+this.options.margins.top+")");this._appendGrid(e),this._appendAreaPath(e),this._appendAxis(e),this._appendFocusRect(e),this._appendMouseFocusG(e),this._appendLegend(e)},_appendElevationDiv:function(t){let e=document.querySelector(this.options.elevationDiv);return e||(e=L.DomUtil.create("div","leaflet-control elevation elevation-div"),this.options.elevationDiv="#elevation-div_"+Math.random().toString(36).substr(2,9),e.id=this.options.elevationDiv.substr(1),t.parentNode.insertBefore(e,t.nextSibling)),this.options.detached&&(L.DomUtil.addClass(e,"elevation-detached"),L.DomUtil.removeClass(e,"leaflet-control")),this.eleDiv=e,this.eleDiv},_appendXaxis:function(t){t.append("g").attr("class","x axis").attr("transform","translate(0,"+this._height()+")").call(d3.axisBottom().scale(this._x).ticks(this.options.xTicks)).append("text").attr("x",this._width()+6).attr("y",30).text(this._xLabel)},_appendXGrid:function(t){t.append("g").attr("class","x grid").attr("transform","translate(0,"+this._height()+")").call(d3.axisBottom().scale(this._x).ticks(this.options.xTicks).tickSize(-this._height()).tickFormat(""))},_appendYaxis:function(t){t.append("g").attr("class","y axis").call(d3.axisLeft().scale(this._y).ticks(this.options.yTicks)).append("text").attr("x",-30).attr("y",3).text(this._yLabel)},_appendYGrid:function(t){t.append("g").attr("class","y grid").call(d3.axisLeft().scale(this._y).ticks(this.options.yTicks).tickSize(-this._width()).tickFormat(""))},_appendAreaPath:function(t){this._areapath=t.append("path").attr("class","area")},_appendAxis:function(t){this._axis=t.append("g").attr("class","axis"),this._appendXaxis(this._axis),this._appendYaxis(this._axis)},_appendFocusRect:function(t){let e=this._focusRect=t.append("rect").attr("width",this._width()).attr("height",this._height()).style("fill","none").style("stroke","none").style("pointer-events","all");L.Browser.mobile&&(e.on("touchmove.drag",this._dragHandler.bind(this)).on("touchstart.drag",this._dragStartHandler.bind(this)).on("touchstart.focus",this._mousemoveHandler.bind(this)).on("touchmove.focus",this._mousemoveHandler.bind(this)),L.DomEvent.on(this._container,"touchend",this._dragEndHandler,this)),e.on("mousemove.drag",this._dragHandler.bind(this)).on("mousedown.drag",this._dragStartHandler.bind(this)).on("mouseenter.focus",this._mouseenterHandler.bind(this)).on("mousemove.focus",this._mousemoveHandler.bind(this)).on("mouseout.focus",this._mouseoutHandler.bind(this)),L.DomEvent.on(this._container,"mouseup",this._dragEndHandler,this)},_appendGrid:function(t){this._grid=t.append("g").attr("class","grid"),this._appendXGrid(this._grid),this._appendYGrid(this._grid)},_appendMouseFocusG:function(t){let e=this._focusG=t.append("g").attr("class","mouse-focus-group");this._mousefocus=e.append("svg:line").attr("class","mouse-focus-line").attr("x2","0").attr("y2","0").attr("x1","0").attr("y1","0"),this._focuslabelrect=e.append("rect").attr("class","mouse-focus-label").attr("x",0).attr("y",0).attr("width",0).attr("height",0).attr("rx",3).attr("ry",3),this._focuslabeltext=e.append("svg:text").attr("class","mouse-focus-label-text"),this._focuslabelY=this._focuslabeltext.append("svg:tspan").attr("class","mouse-focus-label-y").attr("dy","-1em"),this._focuslabelX=this._focuslabeltext.append("svg:tspan").attr("class","mouse-focus-label-x").attr("dy","2em")},_appendLegend:function(t){if(!this.options.legend)return;let e=this._legend=t.append("g").attr("class","legend"),i=this._altitudeLegend=this._legend.append("g").attr("class","legend-altitude");i.append("rect").attr("class","area").attr("x",this._width()/2-50).attr("y",this._height()+this.options.margins.bottom-17).attr("width",50).attr("height",5).attr("opacity",.75),i.append("text").text(L._("Altitude")).attr("x",this._width()/2+5).attr("font-size",10).style("text-decoration-thickness","2px").style("font-weight","700").attr("y",this._height()+this.options.margins.bottom-11),e.on("click",function(){if(this._chartEnabled)this._clearChart(),this._clearPath(),this._chartEnabled=!1;else{this._resizeChart();for(let t in this._layers)L.DomUtil.addClass(this._layers[t]._path,this.options.polyline.className+" "+this.options.theme);this._chartEnabled=!0}}.bind(this))},_appendPositionMarker:function(t){let e=this.options.theme,i=t.select("g");this._mouseHeightFocus=i.append("svg:line").attr("class",e+" height-focus line").attr("x2",0).attr("y2",0).attr("x1",0).attr("y1",0),this._pointG=i.append("g"),this._pointG.append("svg:circle").attr("class",e+" height-focus circle-lower").attr("r",6).attr("cx",0).attr("cy",0),this._mouseHeightFocusLabel=i.append("svg:text").attr("class",e+" height-focus-label").style("pointer-events","none")},_applyData:function(){if(!this._data)return;let t=d3.extent(this._data,t=>t.dist),e=d3.extent(this._data,t=>t.z),i=this.options;void 0!==i.yAxisMin&&(i.yAxisMine[1]||i.forceAxisBounds)&&(e[1]=i.yAxisMax),this._x.domain(t),this._y.domain(e),this._areapath.datum(this._data).attr("d",this._area),this._updateAxis(),this._fullExtent=this._calculateFullExtent(this._data)},_calculateFullExtent:function(t){if(!t||t.length<1)throw new Error("no data in parameters");let e=new L.latLngBounds(t[0].latlng,t[0].latlng);return t.forEach(t=>e.extend(t.latlng)),e},_clearChart:function(){this._resetDrag(),this._areapath&&(this._areapath.attr("d","M0 0"),this._x.domain([0,1]),this._y.domain([0,1]),this._updateAxis()),this._altitudeLegend&&this._altitudeLegend.select("text").style("text-decoration-line","line-through")},_clearData:function(){this._data=null,this._distance=null,this._maxElevation=null,this._minElevation=null,this.track_info=null,this._layers=null},_clearPath:function(){this._hidePositionMarker();for(let t in this._layers)L.DomUtil.removeClass(this._layers[t]._path,this.options.polyline.className),L.DomUtil.removeClass(this._layers[t]._path,this.options.theme)},_collapse:function(){this._container&&(L.DomUtil.removeClass(this._container,"elevation-expanded"),L.DomUtil.addClass(this._container,"elevation-collapsed"))},_deepMerge:function(t,...e){if(!e.length)return t;const i=e.shift();if(this._isObject(t)&&this._isObject(i))for(const e in i)this._isObject(i[e])?(t[e]||Object.assign(t,{[e]:{}}),this._deepMerge(t[e],i[e])):Object.assign(t,{[e]:i[e]});return this._deepMerge(t,...e)},_dragHandler:function(){d3.event.preventDefault(),d3.event.stopPropagation(),this._gotDragged=!0,this._drawDragRectangle()},_dragEndHandler:function(){if(!this._dragStartCoords||!this._dragCurrentCoords||!this._gotDragged)return this._dragStartCoords=null,this._gotDragged=!1,void(this._draggingEnabled&&this._resetDrag());let t=this._findItemForX(this._dragStartCoords[0]),e=this._findItemForX(this._dragCurrentCoords[0]);t!=e&&(this._hidePositionMarker(),this._fitSection(t,e),this._dragStartCoords=null,this._gotDragged=!1,this._fireEvt("elechart_dragged",{data:{dragstart:this._data[t],dragend:this._data[e]}},!0))},_dragStartHandler:function(){d3.event.preventDefault(),d3.event.stopPropagation(),this._gotDragged=!1,this._dragStartCoords=d3.mouse(this._focusRect.node())},_drawDragRectangle:function(){if(!this._dragStartCoords||!this._draggingEnabled)return;let t=this._dragCurrentCoords=d3.mouse(this._focusRect.node()),e=Math.min(this._dragStartCoords[0],t[0]),i=Math.max(this._dragStartCoords[0],t[0]);if(this._dragRectangle||this._dragRectangleG)this._dragRectangle.attr("width",i-e).attr("x",e);else{let t=d3.select(this._container).select("svg").select("g");this._dragRectangleG=t.insert("g",".mouse-focus-group"),this._dragRectangle=this._dragRectangleG.append("rect").attr("width",i-e).attr("height",this._height()).attr("x",e).attr("class","mouse-drag").style("pointer-events","none")}},_expand:function(){this._container&&(L.DomUtil.removeClass(this._container,"elevation-collapsed"),L.DomUtil.addClass(this._container,"elevation-expanded"))},_findItemForLatLng:function(t){let e=null,i=1/0;return this._data.forEach(n=>{let o=t.distanceTo(n.latlng);ot.dist).left)(e,this._x.invert(t))},_fireEvt:function(t,e,i){this.fire&&this.fire(t,e,i),this._map&&this._map.fire(t,e,i)},_fitSection:function(t,e){let i=Math.min(t,e),n=Math.max(t,e),o=this._calculateFullExtent(this._data.slice(i,n));this.fitBounds(o)},_formatter:function(t,e,i){let n=L.Util.formatNum(t,e).toString(),o=n.split(".");if(o[1]){for(let t=e-o[1].length;t>0;t--)o[1]+="0";n=o.join(i||".")}return n},_height:function(){let t=this.options;return t.height-t.margins.top-t.margins.bottom},_hidePositionMarker:function(){this.options.autohideMarker&&(this._selectedItem=null,this._marker&&(this._map&&this._map.removeLayer(this._marker),this._marker=null),this._mouseHeightFocus&&(this._mouseHeightFocus.style("visibility","hidden"),this._mouseHeightFocusLabel.style("visibility","hidden")),this._pointG&&this._pointG.style("visibility","hidden"),this._focusG&&this._focusG.style("visibility","hidden"))},_initChart:function(){let t=this.options;if(t.xTicks=t.xTicks||Math.round(this._width()/75),t.yTicks=t.yTicks||Math.round(this._height()/30),t.hoverNumber.formatter=t.hoverNumber.formatter||this._formatter,t.responsive)if(t.detached){let e=this.eleDiv.offsetWidth,i=this.eleDiv.offsetHeight;t.width=e>0?e:t.width,t.height=i-20>0?i-20:t.height}else{t._maxWidth=t._maxWidth>t.width?t._maxWidth:t.width;let e=this._map._container.clientWidth;t.width=t._maxWidth>e?e-30:t.width}let e=this._x=d3.scaleLinear().range([0,this._width()]),i=this._y=d3.scaleLinear().range([this._height(),0]),n="function"==typeof t.interpolation?t.interpolation:d3[t.interpolation],o=(this._area=d3.area().curve(n).x(t=>t.xDiagCoord=e(t.dist)).y0(this._height()).y1(t=>i(t.z)),this._line=d3.line().x(t=>d3.mouse(a.select("g"))[0]).y(t=>this._height()),d3.select(this._container)),a=o.append("svg").attr("class","background").attr("width",t.width).attr("height",t.height);this.summaryDiv=o.append("div").attr("class","elevation-summary "+(this.options.summary?this.options.summary+"-summary":"")).node();this._appendChart(a),this._updateSummary()},_initToggle:function(t){if(t.setAttribute("aria-haspopup",!0),this.options.detached||L.DomEvent.disableClickPropagation(t),L.Browser.mobile&&L.DomEvent.on(t,"click",L.DomEvent.stopPropagation),!this.options.detached){let e="elevation-toggle "+this.options.controlButton.iconCssClass+(this.options.autohide?"":" close-button"),i=this._button=L.DomUtil.create("a",e,t);i.href="#",i.title=this.options.controlButton.title,this.options.collapsed&&(this._collapse(),this.options.autohide?L.DomEvent.on(t,"mouseover",this._expand,this).on(t,"mouseout",this._collapse,this):L.DomEvent.on(i,"click",L.DomEvent.stop).on(i,"click",this._toggle,this),L.DomEvent.on(i,"focus",this._toggle,this),this._map.on("click",this._collapse,this))}},_isObject:function(t){return t&&"object"==typeof t&&!Array.isArray(t)},_isJSONDoc:function(t,e){if(e=void 0===e||e,"string"==typeof t&&e)return 0==(t=t.trim()).indexOf("{")||0==t.indexOf("[");try{JSON.parse(t.toString())}catch(i){return!("object"!=typeof t||!e)||(console.warn(i),!1)}return!0},_isXMLDoc:function(t,e){if(e=void 0===e||e,"string"==typeof t&&e)return 0==(t=t.trim()).indexOf("<");{let e=(t?t.ownerDocument||t:0).documentElement;return!!e&&"HTML"!==e.nodeName}},_isDomVisible:function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)},_isVisible:function(t){if(!t)return!1;let e=window.getComputedStyle(t);return!!function(t,e){return"hidden"!==e.visibility&&"none"!==e.display}(0,e)&&!!function(t,e){let i=t.getBoundingClientRect(),n=i.left+1,o=i.right-1,a=i.top+1,r=(i.bottom,!0),s=t.style.pointerEvents;return"none"==e["pointer-events"]&&(t.style.pointerEvents="auto"),document.elementFromPoint(n,a)!==t&&(r=!1),document.elementFromPoint(o,a)!==t&&(r=!1),t.style.pointerEvents=s,r}(t,e)},_lazyLoadJS:function(t,e,i){return!1!==e&&this.options.lazyLoadJS?i instanceof Promise?i:new Promise((e,i)=>{let n=document.createElement("script");n.addEventListener("load",e,{once:!0}),n.src=t,document.head.appendChild(n)}):Promise.resolve()},_mouseenterHandler:function(){this._fireEvt("elechart_enter",null,!0)},_mousemoveHandler:function(t,e,i){if(!this._data||0===this._data.length||!this._chartEnabled)return;let n=d3.mouse(this._focusRect.node())[0],o=this._data[this._findItemForX(n)];this._hidePositionMarker(),this._showDiagramIndicator(o,n),this._showPositionMarker(o),this._setMapView(o),this._map&&this._map._container&&L.DomUtil.addClass(this._map._container,"elechart-hover"),this._fireEvt("elechart_change",{data:o},!0),this._fireEvt("elechart_hover",{data:o},!0)},_mousemoveLayerHandler:function(t){if(!this._data||0===this._data.length)return;let e=t.latlng,i=this._findItemForLatLng(e);if(i){let t=i.xDiagCoord;this._hidePositionMarker(),this._showDiagramIndicator(i,t),this._showPositionMarker(i)}},_mouseoutHandler:function(){this.options.detached||this._hidePositionMarker(),this._map&&this._map._container&&L.DomUtil.removeClass(this._map._container,"elechart-hover"),this._fireEvt("elechart_leave",null,!0)},_mousewheelHandler:function(t){if(this._map.gestureHandling&&this._map.gestureHandling._enabled)return;let e=this._selectedItem?this._selectedItem.latlng:this._map.getCenter(),i=t.deltaY>0?this._map.getZoom()-1:this._map.getZoom()+1;this._resetDrag(),this._map.flyTo(e,i)},_resetDrag:function(){this._dragRectangleG&&(this._dragRectangleG.remove(),this._dragRectangleG=null,this._dragRectangle=null,this._hidePositionMarker())},_resetView:function(){this._map&&this._map._isFullscreen||(this._resetDrag(),this._hidePositionMarker(),this.fitBounds(this._fullExtent))},_resizeChart:function(){if(this.options.responsive)if(this.options.detached){let t=this.eleDiv.offsetWidth;if(t<=0)return;this.options.width=t,this.eleDiv.innerHTML="",this.eleDiv.appendChild(this.onAdd(this._map))}else this._map.removeControl(this._container),this.addTo(this._map)},_saveFile:function(t){let e=document,i=e.createElement("a"),n=e.body;i.href=t,i.target="_new",i.download="",i.style.display="none",n.appendChild(i),i.click(),n.removeChild(i)},_showDiagramIndicator:function(t,e){if(!this._chartEnabled)return;let i=this.options;this._focusG.style("visibility","visible"),this._mousefocus.attr("x1",e).attr("y1",0).attr("x2",e).attr("y2",this._height()).classed("hidden",!1);let n=t.z,o=t.dist,a=(t.latlng,i.hoverNumber.formatter(n,i.hoverNumber.decimalsY)),r=i.hoverNumber.formatter(o,i.hoverNumber.decimalsX);this._focuslabeltext.attr("y",this._y(t.z)).style("font-weight","700"),this._focuslabelX.text(r+" "+this._xLabel).attr("x",e+10),this._focuslabelY.text(a+" "+this._yLabel).attr("x",e+10);let s=this._focuslabeltext.node();if(this._isDomVisible(s)){let t=s.getBBox(),i=2;this._focuslabelrect.attr("x",t.x-i).attr("y",t.y-i).attr("width",t.width+2*i).attr("height",t.height+2*i),e>=this._width()/2&&(this._focuslabelrect.attr("x",this._focuslabelrect.attr("x")-this._focuslabelrect.attr("width")-2*i-10),this._focuslabelX.attr("x",this._focuslabelX.attr("x")-this._focuslabelrect.attr("width")-2*i-10),this._focuslabelY.attr("x",this._focuslabelY.attr("x")-this._focuslabelrect.attr("width")-2*i-10))}},_toggle:function(){L.DomUtil.hasClass(this._container,"elevation-expanded")?this._collapse():this._expand()},_setMapView:function(t){if(!this.options.followMarker||!this._map)return;let e=this._map.getZoom();e=e'+L._("Total Length: ")+''+this.track_info.distance.toFixed(2)+" "+this._xLabel+''+L._("Max Elevation: ")+''+this.track_info.elevation_max.toFixed(2)+" "+this._yLabel+''+L._("Min Elevation: ")+''+this.track_info.elevation_min.toFixed(2)+" "+this._yLabel+''+L._("Total Ascent: ")+''+this.track_info.ascent.toFixed(0)+" "+this._yLabel+''+L._("Total Descent: ")+''+this.track_info.descent.toFixed(0)+" "+this._yLabel+""),this.options.downloadLink&&this._downloadURL&&(this.summaryDiv.innerHTML+=''+L._("Download")+"",this.summaryDiv.querySelector(".download a").onclick=function(t){t.preventDefault();let e={confirm:this._saveFile.bind(this,this._downloadURL)},i=this.options.downloadLink;"modal"==i?("function"==typeof CustomEvent&&document.dispatchEvent(new CustomEvent("eletrack_download",{detail:e})),this._fireEvt("eletrack_download",e)):"link"!=i&&!0!==i||e.confirm()}.bind(this))},_width:function(){let t=this.options;return t.width-t.margins.left-t.margins.right}}),L.control.elevation=function(t){return new L.Control.Elevation(t)}})),function(t,e){"function"==typeof define&&define.amd?define(["leaflet"],t):"object"==typeof exports&&(module.exports=t(require("leaflet"))),void 0!==e&&e.L&&t(e.L)}((function(t){Waymark_L.Editable=Waymark_L.Evented.extend({statics:{FORWARD:1,BACKWARD:-1},options:{zIndex:1e3,polygonClass:Waymark_L.Polygon,polylineClass:Waymark_L.Polyline,markerClass:Waymark_L.Marker,rectangleClass:Waymark_L.Rectangle,circleClass:Waymark_L.Circle,drawingCSSClass:"leaflet-editable-drawing",drawingCursor:"crosshair",editLayer:void 0,featuresLayer:void 0,polylineEditorClass:void 0,polygonEditorClass:void 0,markerEditorClass:void 0,rectangleEditorClass:void 0,circleEditorClass:void 0,lineGuideOptions:{},skipMiddleMarkers:!1},initialize:function(t,e){Waymark_L.setOptions(this,e),this._lastZIndex=this.options.zIndex,this.map=t,this.editLayer=this.createEditLayer(),this.featuresLayer=this.createFeaturesLayer(),this.forwardLineGuide=this.createLineGuide(),this.backwardLineGuide=this.createLineGuide()},fireAndForward:function(t,e){(e=e||{}).editTools=this,this.fire(t,e),this.map.fire(t,e)},createLineGuide:function(){var t=Waymark_L.extend({dashArray:"5,10",weight:1,interactive:!1},this.options.lineGuideOptions);return Waymark_L.polyline([],t)},createVertexIcon:function(t){return Waymark_L.Browser.mobile&&Waymark_L.Browser.touch?new Waymark_L.Editable.TouchVertexIcon(t):new Waymark_L.Editable.VertexIcon(t)},createEditLayer:function(){return this.options.editLayer||(new Waymark_L.LayerGroup).addTo(this.map)},createFeaturesLayer:function(){return this.options.featuresLayer||(new Waymark_L.LayerGroup).addTo(this.map)},moveForwardLineGuide:function(t){this.forwardLineGuide._latlngs.length&&(this.forwardLineGuide._latlngs[1]=t,this.forwardLineGuide._bounds.extend(t),this.forwardLineGuide.redraw())},moveBackwardLineGuide:function(t){this.backwardLineGuide._latlngs.length&&(this.backwardLineGuide._latlngs[1]=t,this.backwardLineGuide._bounds.extend(t),this.backwardLineGuide.redraw())},anchorForwardLineGuide:function(t){this.forwardLineGuide._latlngs[0]=t,this.forwardLineGuide._bounds.extend(t),this.forwardLineGuide.redraw()},anchorBackwardLineGuide:function(t){this.backwardLineGuide._latlngs[0]=t,this.backwardLineGuide._bounds.extend(t),this.backwardLineGuide.redraw()},attachForwardLineGuide:function(){this.editLayer.addLayer(this.forwardLineGuide)},attachBackwardLineGuide:function(){this.editLayer.addLayer(this.backwardLineGuide)},detachForwardLineGuide:function(){this.forwardLineGuide.setLatLngs([]),this.editLayer.removeLayer(this.forwardLineGuide)},detachBackwardLineGuide:function(){this.backwardLineGuide.setLatLngs([]),this.editLayer.removeLayer(this.backwardLineGuide)},blockEvents:function(){this._oldTargets||(this._oldTargets=this.map._targets,this.map._targets={})},unblockEvents:function(){this._oldTargets&&(this.map._targets=Waymark_L.extend(this.map._targets,this._oldTargets),delete this._oldTargets)},registerForDrawing:function(t){this._drawingEditor&&this.unregisterForDrawing(this._drawingEditor),this.blockEvents(),t.reset(),this._drawingEditor=t,this.map.on("mousemove touchmove",t.onDrawingMouseMove,t),this.map.on("mousedown",this.onMousedown,this),this.map.on("mouseup",this.onMouseup,this),Waymark_L.DomUtil.addClass(this.map._container,this.options.drawingCSSClass),this.defaultMapCursor=this.map._container.style.cursor,this.map._container.style.cursor=this.options.drawingCursor},unregisterForDrawing:function(t){this.unblockEvents(),Waymark_L.DomUtil.removeClass(this.map._container,this.options.drawingCSSClass),this.map._container.style.cursor=this.defaultMapCursor,(t=t||this._drawingEditor)&&(this.map.off("mousemove touchmove",t.onDrawingMouseMove,t),this.map.off("mousedown",this.onMousedown,this),this.map.off("mouseup",this.onMouseup,this),t===this._drawingEditor&&(delete this._drawingEditor,t._drawing&&t.cancelDrawing()))},onMousedown:function(t){1==t.originalEvent.which&&(this._mouseDown=t,this._drawingEditor.onDrawingMouseDown(t))},onMouseup:function(t){if(this._mouseDown){var e=this._drawingEditor,i=this._mouseDown;if(this._mouseDown=null,e.onDrawingMouseUp(t),this._drawingEditor!==e)return;var n=Waymark_L.point(i.originalEvent.clientX,i.originalEvent.clientY),o=Waymark_L.point(t.originalEvent.clientX,t.originalEvent.clientY).distanceTo(n);Math.abs(o)<9*(window.devicePixelRatio||1)&&this._drawingEditor.onDrawingClick(t)}},drawing:function(){return this._drawingEditor&&this._drawingEditor.drawing()},stopDrawing:function(){this.unregisterForDrawing()},commitDrawing:function(t){this._drawingEditor&&this._drawingEditor.commitDrawing(t)},connectCreatedToMap:function(t){return this.featuresLayer.addLayer(t)},startPolyline:function(t,e){var i=this.createPolyline([],e);return i.enableEdit(this.map).newShape(t),i},startPolygon:function(t,e){var i=this.createPolygon([],e);return i.enableEdit(this.map).newShape(t),i},startMarker:function(t,e){t=t||this.map.getCenter().clone();var i=this.createMarker(t,e);return i.enableEdit(this.map).startDrawing(),i},startRectangle:function(t,e){var i=t||Waymark_L.latLng([0,0]),n=new Waymark_L.LatLngBounds(i,i),o=this.createRectangle(n,e);return o.enableEdit(this.map).startDrawing(),o},startCircle:function(t,e){t=t||this.map.getCenter().clone();var i=this.createCircle(t,e);return i.enableEdit(this.map).startDrawing(),i},startHole:function(t,e){t.newHole(e)},createLayer:function(t,e,i){var n=new t(e,i=Waymark_L.Util.extend({editOptions:{editTools:this}},i));return this.fireAndForward("editable:created",{layer:n}),n},createPolyline:function(t,e){return this.createLayer(e&&e.polylineClass||this.options.polylineClass,t,e)},createPolygon:function(t,e){return this.createLayer(e&&e.polygonClass||this.options.polygonClass,t,e)},createMarker:function(t,e){return this.createLayer(e&&e.markerClass||this.options.markerClass,t,e)},createRectangle:function(t,e){return this.createLayer(e&&e.rectangleClass||this.options.rectangleClass,t,e)},createCircle:function(t,e){return this.createLayer(e&&e.circleClass||this.options.circleClass,t,e)}}),Waymark_L.extend(Waymark_L.Editable,{makeCancellable:function(t){t.cancel=function(){t._cancelled=!0}}}),Waymark_L.Map.mergeOptions({editToolsClass:Waymark_L.Editable,editable:!1,editOptions:{}}),Waymark_L.Map.addInitHook((function(){this.whenReady((function(){this.options.editable&&(this.editTools=new this.options.editToolsClass(this,this.options.editOptions))}))})),Waymark_L.Editable.VertexIcon=Waymark_L.DivIcon.extend({options:{iconSize:new Waymark_L.Point(8,8)}}),Waymark_L.Editable.TouchVertexIcon=Waymark_L.Editable.VertexIcon.extend({options:{iconSize:new Waymark_L.Point(20,20)}}),Waymark_L.Editable.VertexMarker=Waymark_L.Marker.extend({options:{draggable:!0,className:"leaflet-div-icon leaflet-vertex-icon"},initialize:function(t,e,i,n){this.latlng=t,this.latlngs=e,this.editor=i,Waymark_L.Marker.prototype.initialize.call(this,t,n),this.options.icon=this.editor.tools.createVertexIcon({className:this.options.className}),this.latlng.__vertex=this,this.editor.editLayer.addLayer(this),this.setZIndexOffset(i.tools._lastZIndex+1)},onAdd:function(t){Waymark_L.Marker.prototype.onAdd.call(this,t),this.on("drag",this.onDrag),this.on("dragstart",this.onDragStart),this.on("dragend",this.onDragEnd),this.on("mouseup",this.onMouseup),this.on("click",this.onClick),this.on("contextmenu",this.onContextMenu),this.on("mousedown touchstart",this.onMouseDown),this.on("mouseover",this.onMouseOver),this.on("mouseout",this.onMouseOut),this.addMiddleMarkers()},onRemove:function(t){this.middleMarker&&this.middleMarker.delete(),delete this.latlng.__vertex,this.off("drag",this.onDrag),this.off("dragstart",this.onDragStart),this.off("dragend",this.onDragEnd),this.off("mouseup",this.onMouseup),this.off("click",this.onClick),this.off("contextmenu",this.onContextMenu),this.off("mousedown touchstart",this.onMouseDown),this.off("mouseover",this.onMouseOver),this.off("mouseout",this.onMouseOut),Waymark_L.Marker.prototype.onRemove.call(this,t)},onDrag:function(t){t.vertex=this,this.editor.onVertexMarkerDrag(t);var e=Waymark_L.DomUtil.getPosition(this._icon),i=this._map.layerPointToLatLng(e);this.latlng.update(i),this._latlng=this.latlng,this.editor.refresh(),this.middleMarker&&this.middleMarker.updateLatLng();var n=this.getNext();n&&n.middleMarker&&n.middleMarker.updateLatLng()},onDragStart:function(t){t.vertex=this,this.editor.onVertexMarkerDragStart(t)},onDragEnd:function(t){t.vertex=this,this.editor.onVertexMarkerDragEnd(t)},onClick:function(t){t.vertex=this,this.editor.onVertexMarkerClick(t)},onMouseup:function(t){Waymark_L.DomEvent.stop(t),t.vertex=this,this.editor.map.fire("mouseup",t)},onContextMenu:function(t){t.vertex=this,this.editor.onVertexMarkerContextMenu(t)},onMouseDown:function(t){t.vertex=this,this.editor.onVertexMarkerMouseDown(t)},onMouseOver:function(t){t.vertex=this,this.editor.onVertexMarkerMouseOver(t)},onMouseOut:function(t){t.vertex=this,this.editor.onVertexMarkerMouseOut(t)},delete:function(){var t=this.getNext();this.latlngs.splice(this.getIndex(),1),this.editor.editLayer.removeLayer(this),this.editor.onVertexDeleted({latlng:this.latlng,vertex:this}),this.latlngs.length||this.editor.deleteShape(this.latlngs),t&&t.resetMiddleMarker(),this.editor.refresh()},getIndex:function(){return this.latlngs.indexOf(this.latlng)},getLastIndex:function(){return this.latlngs.length-1},getPrevious:function(){if(!(this.latlngs.length<2)){var t=this.getIndex(),e=t-1;0===t&&this.editor.CLOSED&&(e=this.getLastIndex());var i=this.latlngs[e];return i?i.__vertex:void 0}},getNext:function(){if(!(this.latlngs.length<2)){var t=this.getIndex(),e=t+1;t===this.getLastIndex()&&this.editor.CLOSED&&(e=0);var i=this.latlngs[e];return i?i.__vertex:void 0}},addMiddleMarker:function(t){this.editor.hasMiddleMarkers()&&(t=t||this.getPrevious())&&!this.middleMarker&&(this.middleMarker=this.editor.addMiddleMarker(t,this,this.latlngs,this.editor))},addMiddleMarkers:function(){if(this.editor.hasMiddleMarkers()){var t=this.getPrevious();t&&this.addMiddleMarker(t);var e=this.getNext();e&&e.resetMiddleMarker()}},resetMiddleMarker:function(){this.middleMarker&&this.middleMarker.delete(),this.addMiddleMarker()},split:function(){this.editor.splitShape&&this.editor.splitShape(this.latlngs,this.getIndex())},continue:function(){if(this.editor.continueBackward){var t=this.getIndex();0===t?this.editor.continueBackward(this.latlngs):t===this.getLastIndex()&&this.editor.continueForward(this.latlngs)}}}),Waymark_L.Editable.mergeOptions({vertexMarkerClass:Waymark_L.Editable.VertexMarker}),Waymark_L.Editable.MiddleMarker=Waymark_L.Marker.extend({options:{opacity:.5,className:"leaflet-div-icon leaflet-middle-icon",draggable:!0},initialize:function(t,e,i,n,o){this.left=t,this.right=e,this.editor=n,this.latlngs=i,Waymark_L.Marker.prototype.initialize.call(this,this.computeLatLng(),o),this._opacity=this.options.opacity,this.options.icon=this.editor.tools.createVertexIcon({className:this.options.className}),this.editor.editLayer.addLayer(this),this.setVisibility()},setVisibility:function(){var t=this._map.latLngToContainerPoint(this.left.latlng),e=this._map.latLngToContainerPoint(this.right.latlng),i=Waymark_L.point(this.options.icon.options.iconSize);t.distanceTo(e)<3*i.x?this.hide():this.show()},show:function(){this.setOpacity(this._opacity)},hide:function(){this.setOpacity(0)},updateLatLng:function(){this.setLatLng(this.computeLatLng()),this.setVisibility()},computeLatLng:function(){var t=this.editor.map.latLngToContainerPoint(this.left.latlng),e=this.editor.map.latLngToContainerPoint(this.right.latlng),i=(t.y+e.y)/2,n=(t.x+e.x)/2;return this.editor.map.containerPointToLatLng([n,i])},onAdd:function(t){Waymark_L.Marker.prototype.onAdd.call(this,t),Waymark_L.DomEvent.on(this._icon,"mousedown touchstart",this.onMouseDown,this),t.on("zoomend",this.setVisibility,this)},onRemove:function(t){delete this.right.middleMarker,Waymark_L.DomEvent.off(this._icon,"mousedown touchstart",this.onMouseDown,this),t.off("zoomend",this.setVisibility,this),Waymark_L.Marker.prototype.onRemove.call(this,t)},onMouseDown:function(t){var e=Waymark_L.DomUtil.getPosition(this._icon);if(t={originalEvent:t,latlng:this.editor.map.layerPointToLatLng(e)},0!==this.options.opacity&&(Waymark_L.Editable.makeCancellable(t),this.editor.onMiddleMarkerMouseDown(t),!t._cancelled)){this.latlngs.splice(this.index(),0,t.latlng),this.editor.refresh();var i=this._icon,n=this.editor.addVertexMarker(t.latlng,this.latlngs);this.editor.onNewVertex(n);var o=n._icon.parentNode;o.removeChild(n._icon),n._icon=i,o.appendChild(n._icon),n._initIcon(),n._initInteraction(),n.setOpacity(1),Waymark_L.Draggable._dragging=!1,n.dragging._draggable._onDown(t.originalEvent),this.delete()}},delete:function(){this.editor.editLayer.removeLayer(this)},index:function(){return this.latlngs.indexOf(this.right.latlng)}}),Waymark_L.Editable.mergeOptions({middleMarkerClass:Waymark_L.Editable.MiddleMarker}),Waymark_L.Editable.BaseEditor=Waymark_L.Handler.extend({initialize:function(t,e,i){Waymark_L.setOptions(this,i),this.map=t,this.feature=e,this.feature.editor=this,this.editLayer=new Waymark_L.LayerGroup,this.tools=this.options.editTools||t.editTools},addHooks:function(){this.isConnected()?this.onFeatureAdd():this.feature.once("add",this.onFeatureAdd,this),this.onEnable(),this.feature.on(this._getEvents(),this)},removeHooks:function(){this.feature.off(this._getEvents(),this),this.feature.dragging&&this.feature.dragging.disable(),this.editLayer.clearLayers(),this.tools.editLayer.removeLayer(this.editLayer),this.onDisable(),this._drawing&&this.cancelDrawing()},drawing:function(){return!!this._drawing},reset:function(){},onFeatureAdd:function(){this.tools.editLayer.addLayer(this.editLayer),this.feature.dragging&&this.feature.dragging.enable()},hasMiddleMarkers:function(){return!this.options.skipMiddleMarkers&&!this.tools.options.skipMiddleMarkers},fireAndForward:function(t,e){(e=e||{}).layer=this.feature,this.feature.fire(t,e),this.tools.fireAndForward(t,e)},onEnable:function(){this.fireAndForward("editable:enable")},onDisable:function(){this.fireAndForward("editable:disable")},onEditing:function(){this.fireAndForward("editable:editing")},onStartDrawing:function(){this.fireAndForward("editable:drawing:start")},onEndDrawing:function(){this.fireAndForward("editable:drawing:end")},onCancelDrawing:function(){this.fireAndForward("editable:drawing:cancel")},onCommitDrawing:function(t){this.fireAndForward("editable:drawing:commit",t)},onDrawingMouseDown:function(t){this.fireAndForward("editable:drawing:mousedown",t)},onDrawingMouseUp:function(t){this.fireAndForward("editable:drawing:mouseup",t)},startDrawing:function(){this._drawing||(this._drawing=Waymark_L.Editable.FORWARD),this.tools.registerForDrawing(this),this.onStartDrawing()},commitDrawing:function(t){this.onCommitDrawing(t),this.endDrawing()},cancelDrawing:function(){Waymark_L.Draggable._dragging=!1,this.onCancelDrawing(),this.endDrawing()},endDrawing:function(){this._drawing=!1,this.tools.unregisterForDrawing(this),this.onEndDrawing()},onDrawingClick:function(t){this.drawing()&&(Waymark_L.Editable.makeCancellable(t),this.fireAndForward("editable:drawing:click",t),t._cancelled||(this.isConnected()||this.connect(t),this.processDrawingClick(t)))},isConnected:function(){return this.map.hasLayer(this.feature)},connect:function(){this.tools.connectCreatedToMap(this.feature),this.tools.editLayer.addLayer(this.editLayer)},onMove:function(t){this.fireAndForward("editable:drawing:move",t)},onDrawingMouseMove:function(t){this.onMove(t)},_getEvents:function(){return{dragstart:this.onDragStart,drag:this.onDrag,dragend:this.onDragEnd,remove:this.disable}},onDragStart:function(t){this.onEditing(),this.fireAndForward("editable:dragstart",t)},onDrag:function(t){this.onMove(t),this.fireAndForward("editable:drag",t)},onDragEnd:function(t){this.fireAndForward("editable:dragend",t)}}),Waymark_L.Editable.MarkerEditor=Waymark_L.Editable.BaseEditor.extend({onDrawingMouseMove:function(t){Waymark_L.Editable.BaseEditor.prototype.onDrawingMouseMove.call(this,t),this._drawing&&this.feature.setLatLng(t.latlng)},processDrawingClick:function(t){this.fireAndForward("editable:drawing:clicked",t),this.commitDrawing(t)},connect:function(t){t&&(this.feature._latlng=t.latlng),Waymark_L.Editable.BaseEditor.prototype.connect.call(this,t)}}),Waymark_L.Editable.PathEditor=Waymark_L.Editable.BaseEditor.extend({CLOSED:!1,MIN_VERTEX:2,addHooks:function(){return Waymark_L.Editable.BaseEditor.prototype.addHooks.call(this),this.feature&&this.initVertexMarkers(),this},initVertexMarkers:function(t){if(this.enabled())if(t=t||this.getLatLngs(),l(t))this.addVertexMarkers(t);else for(var e=0;e=this.MIN_VERTEX-1&&(e=!0):0===i&&this._drawing===Waymark_L.Editable.BACKWARD&&this._drawnLatLngs.length>=this.MIN_VERTEX||0===i&&this._drawing===Waymark_L.Editable.FORWARD&&this._drawnLatLngs.length>=this.MIN_VERTEX&&this.CLOSED?e=!0:this.onVertexRawMarkerClick(t),this.fireAndForward("editable:vertex:clicked",t),e&&this.commitDrawing(t)}},onVertexRawMarkerClick:function(t){this.fireAndForward("editable:vertex:rawclick",t),t._cancelled||this.vertexCanBeDeleted(t.vertex)&&t.vertex.delete()},vertexCanBeDeleted:function(t){return t.latlngs.length>this.MIN_VERTEX},onVertexDeleted:function(t){this.fireAndForward("editable:vertex:deleted",t)},onVertexMarkerCtrlClick:function(t){this.fireAndForward("editable:vertex:ctrlclick",t)},onVertexMarkerShiftClick:function(t){this.fireAndForward("editable:vertex:shiftclick",t)},onVertexMarkerMetaKeyClick:function(t){this.fireAndForward("editable:vertex:metakeyclick",t)},onVertexMarkerAltClick:function(t){this.fireAndForward("editable:vertex:altclick",t)},onVertexMarkerContextMenu:function(t){this.fireAndForward("editable:vertex:contextmenu",t)},onVertexMarkerMouseDown:function(t){this.fireAndForward("editable:vertex:mousedown",t)},onVertexMarkerMouseOver:function(t){this.fireAndForward("editable:vertex:mouseover",t)},onVertexMarkerMouseOut:function(t){this.fireAndForward("editable:vertex:mouseout",t)},onMiddleMarkerMouseDown:function(t){this.fireAndForward("editable:middlemarker:mousedown",t)},onVertexMarkerDrag:function(t){this.onMove(t),this.feature._bounds&&this.extendBounds(t),this.fireAndForward("editable:vertex:drag",t)},onVertexMarkerDragStart:function(t){this.fireAndForward("editable:vertex:dragstart",t)},onVertexMarkerDragEnd:function(t){this.fireAndForward("editable:vertex:dragend",t)},setDrawnLatLngs:function(t){this._drawnLatLngs=t||this.getDefaultLatLngs()},startDrawing:function(){this._drawnLatLngs||this.setDrawnLatLngs(),Waymark_L.Editable.BaseEditor.prototype.startDrawing.call(this)},startDrawingForward:function(){this.startDrawing()},endDrawing:function(){this.tools.detachForwardLineGuide(),this.tools.detachBackwardLineGuide(),this._drawnLatLngs&&this._drawnLatLngs.length0&&(this.tools.attachBackwardLineGuide(),this.tools.anchorBackwardLineGuide(t[0])),this.startDrawingBackward())},continueForward:function(t){this.drawing()||(t=t||this.getDefaultLatLngs(),this.setDrawnLatLngs(t),t.length>0&&(this.tools.attachForwardLineGuide(),this.tools.anchorForwardLineGuide(t[t.length-1])),this.startDrawingForward())},getDefaultLatLngs:function(t){return!(t=t||this.feature._latlngs).length||t[0]instanceof Waymark_L.LatLng?t:this.getDefaultLatLngs(t[0])},ensureMulti:function(){this.feature._latlngs.length&&l(this.feature._latlngs)&&(this.feature._latlngs=[this.feature._latlngs])},addNewEmptyShape:function(){if(this.feature._latlngs.length){var t=[];return this.appendShape(t),t}return this.feature._latlngs},formatShape:function(t){return l(t)?t:t[0]?this.formatShape(t[0]):void 0},splitShape:function(t,e){if(e&&!(e>=t.length-1)){this.ensureMulti();var i=this.feature._latlngs.indexOf(t);if(-1!==i){var n=t.slice(0,e+1),o=t.slice(e);o[0]=Waymark_L.latLng(o[0].lat,o[0].lng,o[0].alt),this.feature._latlngs.splice(i,1,n,o),this.refresh(),this.reset()}}}}),Waymark_L.Editable.PolygonEditor=Waymark_L.Editable.PathEditor.extend({CLOSED:!0,MIN_VERTEX:3,newPointForward:function(t){Waymark_L.Editable.PathEditor.prototype.newPointForward.call(this,t),this.tools.backwardLineGuide._latlngs.length||this.tools.anchorBackwardLineGuide(t),2===this._drawnLatLngs.length&&this.tools.attachBackwardLineGuide()},addNewEmptyHole:function(t){this.ensureNotFlat();var e=this.feature.shapeAt(t);if(e){var i=[];return e.push(i),i}},newHole:function(t){var e=this.addNewEmptyHole(t);e&&(this.setDrawnLatLngs(e),this.startDrawingForward(),t&&this.newPointForward(t))},addNewEmptyShape:function(){if(this.feature._latlngs.length&&this.feature._latlngs[0].length){var t=[];return this.appendShape(t),t}return this.feature._latlngs},ensureMulti:function(){this.feature._latlngs.length&&l(this.feature._latlngs[0])&&(this.feature._latlngs=[this.feature._latlngs])},ensureNotFlat:function(){this.feature._latlngs.length&&!l(this.feature._latlngs)||(this.feature._latlngs=[this.feature._latlngs])},vertexCanBeDeleted:function(t){var e=this.feature.parentShape(t.latlngs);return Waymark_L.Util.indexOf(e,t.latlngs)>0||Waymark_L.Editable.PathEditor.prototype.vertexCanBeDeleted.call(this,t)},getDefaultLatLngs:function(){return this.feature._latlngs.length||this.feature._latlngs.push([]),this.feature._latlngs[0]},formatShape:function(t){return!l(t)||t[0]&&0===t[0].length?t:[t]}}),Waymark_L.Editable.RectangleEditor=Waymark_L.Editable.PathEditor.extend({CLOSED:!0,MIN_VERTEX:4,options:{skipMiddleMarkers:!0},extendBounds:function(t){var e=t.vertex.getIndex(),i=t.vertex.getNext(),n=t.vertex.getPrevious(),o=(e+2)%4,a=t.vertex.latlngs[o],r=new Waymark_L.LatLngBounds(t.latlng,a);n.latlng.update([t.latlng.lat,a.lng]),i.latlng.update([a.lat,t.latlng.lng]),this.updateBounds(r),this.refreshVertexMarkers()},onDrawingMouseDown:function(t){Waymark_L.Editable.PathEditor.prototype.onDrawingMouseDown.call(this,t),this.connect();var e=this.getDefaultLatLngs();3===e.length&&e.push(t.latlng);var i=new Waymark_L.LatLngBounds(t.latlng,t.latlng);this.updateBounds(i),this.updateLatLngs(i),this.refresh(),this.reset(),t.originalEvent._simulated=!1,this.map.dragging._draggable._onUp(t.originalEvent),e[3].__vertex.dragging._draggable._onDown(t.originalEvent)},onDrawingMouseUp:function(t){this.commitDrawing(t),t.originalEvent._simulated=!1,Waymark_L.Editable.PathEditor.prototype.onDrawingMouseUp.call(this,t)},onDrawingMouseMove:function(t){t.originalEvent._simulated=!1,Waymark_L.Editable.PathEditor.prototype.onDrawingMouseMove.call(this,t)},getDefaultLatLngs:function(t){return t||this.feature._latlngs[0]},updateBounds:function(t){this.feature._bounds=t},updateLatLngs:function(t){for(var e=this.getDefaultLatLngs(),i=this.feature._boundsToLatLngs(t),n=0;nt.lat!=n.lat>t.lat&&t.lng<(n.lng-i.lng)*(t.lat-i.lat)/(n.lat-i.lat)+i.lng&&(s=!s);return s},parentShape:function(t,e){if(e=e||this._latlngs){var i=Waymark_L.Util.indexOf(e,t);if(-1!==i)return e;for(var n=0;n=i;)e=e.__parent;return this._currentShownBounds.contains(e.getLatLng())&&(this.options.animateAddingMarkers?this._animationAddLayer(t,e):this._animationAddLayerNonAnimated(t,e)),this},removeLayer:function(t){return t instanceof L.LayerGroup?this.removeLayers([t]):t.getLatLng?this._map?t.__parent?(this._unspiderfy&&(this._unspiderfy(),this._unspiderfyLayer(t)),this._removeLayer(t,!0),this.fire("layerremove",{layer:t}),this._topClusterLevel._recalculateBounds(),this._refreshClustersIcons(),t.off(this._childMarkerEventHandlers,this),this._featureGroup.hasLayer(t)&&(this._featureGroup.removeLayer(t),t.clusterShow&&t.clusterShow()),this):this:(!this._arraySplice(this._needsClustering,t)&&this.hasLayer(t)&&this._needsRemoving.push({layer:t,latlng:t._latlng}),this.fire("layerremove",{layer:t}),this):(this._nonPointGroup.removeLayer(t),this.fire("layerremove",{layer:t}),this)},addLayers:function(t,e){if(!L.Util.isArray(t))return this.addLayer(t);var i,n=this._featureGroup,o=this._nonPointGroup,a=this.options.chunkedLoading,r=this.options.chunkInterval,s=this.options.chunkProgress,l=t.length,h=0,u=!0;if(this._map){var d=(new Date).getTime(),c=L.bind((function(){for(var _=(new Date).getTime();l>h;h++){if(a&&0==h%200)if((new Date).getTime()-_>r)break;if((i=t[h])instanceof L.LayerGroup)u&&(t=t.slice(),u=!1),this._extractNonGroupLayers(i,t),l=t.length;else if(i.getLatLng){if(!this.hasLayer(i)&&(this._addLayer(i,this._maxZoom),e||this.fire("layeradd",{layer:i}),i.__parent&&2===i.__parent.getChildCount())){var p=i.__parent.getAllChildMarkers(),m=p[0]===i?p[1]:p[0];n.removeLayer(m)}}else o.addLayer(i),e||this.fire("layeradd",{layer:i})}s&&s(h,l,(new Date).getTime()-d),h===l?(this._topClusterLevel._recalculateBounds(),this._refreshClustersIcons(),this._topClusterLevel._recursivelyAddChildrenToMap(null,this._zoom,this._currentShownBounds)):setTimeout(c,this.options.chunkDelay)}),this);c()}else for(var _=this._needsClustering;l>h;h++)(i=t[h])instanceof L.LayerGroup?(u&&(t=t.slice(),u=!1),this._extractNonGroupLayers(i,t),l=t.length):i.getLatLng?this.hasLayer(i)||_.push(i):o.addLayer(i);return this},removeLayers:function(t){var e,i,n=t.length,o=this._featureGroup,a=this._nonPointGroup,r=!0;if(!this._map){for(e=0;n>e;e++)(i=t[e])instanceof L.LayerGroup?(r&&(t=t.slice(),r=!1),this._extractNonGroupLayers(i,t),n=t.length):(this._arraySplice(this._needsClustering,i),a.removeLayer(i),this.hasLayer(i)&&this._needsRemoving.push({layer:i,latlng:i._latlng}),this.fire("layerremove",{layer:i}));return this}if(this._unspiderfy){this._unspiderfy();var s=t.slice(),l=n;for(e=0;l>e;e++)(i=s[e])instanceof L.LayerGroup?(this._extractNonGroupLayers(i,s),l=s.length):this._unspiderfyLayer(i)}for(e=0;n>e;e++)(i=t[e])instanceof L.LayerGroup?(r&&(t=t.slice(),r=!1),this._extractNonGroupLayers(i,t),n=t.length):i.__parent?(this._removeLayer(i,!0,!0),this.fire("layerremove",{layer:i}),o.hasLayer(i)&&(o.removeLayer(i),i.clusterShow&&i.clusterShow())):(a.removeLayer(i),this.fire("layerremove",{layer:i}));return this._topClusterLevel._recalculateBounds(),this._refreshClustersIcons(),this._topClusterLevel._recursivelyAddChildrenToMap(null,this._zoom,this._currentShownBounds),this},clearLayers:function(){return this._map||(this._needsClustering=[],this._needsRemoving=[],delete this._gridClusters,delete this._gridUnclustered),this._noanimationUnspiderfy&&this._noanimationUnspiderfy(),this._featureGroup.clearLayers(),this._nonPointGroup.clearLayers(),this.eachLayer((function(t){t.off(this._childMarkerEventHandlers,this),delete t.__parent}),this),this._map&&this._generateInitialClusters(),this},getBounds:function(){var t=new L.LatLngBounds;this._topClusterLevel&&t.extend(this._topClusterLevel._bounds);for(var e=this._needsClustering.length-1;e>=0;e--)t.extend(this._needsClustering[e].getLatLng());return t.extend(this._nonPointGroup.getBounds()),t},eachLayer:function(t,e){var i,n,o,a=this._needsClustering.slice(),r=this._needsRemoving;for(this._topClusterLevel&&this._topClusterLevel.getAllChildMarkers(a),n=a.length-1;n>=0;n--){for(i=!0,o=r.length-1;o>=0;o--)if(r[o].layer===a[n]){i=!1;break}i&&t.call(e,a[n])}this._nonPointGroup.eachLayer(t,e)},getLayers:function(){var t=[];return this.eachLayer((function(e){t.push(e)})),t},getLayer:function(t){var e=null;return t=parseInt(t,10),this.eachLayer((function(i){L.stamp(i)===t&&(e=i)})),e},hasLayer:function(t){if(!t)return!1;var e,i=this._needsClustering;for(e=i.length-1;e>=0;e--)if(i[e]===t)return!0;for(e=(i=this._needsRemoving).length-1;e>=0;e--)if(i[e].layer===t)return!1;return!(!t.__parent||t.__parent._group!==this)||this._nonPointGroup.hasLayer(t)},zoomToShowLayer:function(t,e){"function"!=typeof e&&(e=function(){});var i=function(){!t._icon&&!t.__parent._icon||this._inZoomAnimation||(this._map.off("moveend",i,this),this.off("animationend",i,this),t._icon?e():t.__parent._icon&&(this.once("spiderfied",e,this),t.__parent.spiderfy()))};t._icon&&this._map.getBounds().contains(t.getLatLng())?e():t.__parent._zoome;e++)(n=this._needsRemoving[e]).newlatlng=n.layer._latlng,n.layer._latlng=n.latlng;for(e=0,i=this._needsRemoving.length;i>e;e++)n=this._needsRemoving[e],this._removeLayer(n.layer,!0),n.layer._latlng=n.newlatlng;this._needsRemoving=[],this._zoom=Math.round(this._map._zoom),this._currentShownBounds=this._getExpandedVisibleBounds(),this._map.on("zoomend",this._zoomEnd,this),this._map.on("moveend",this._moveEnd,this),this._spiderfierOnAdd&&this._spiderfierOnAdd(),this._bindEvents(),i=this._needsClustering,this._needsClustering=[],this.addLayers(i,!0)},onRemove:function(t){t.off("zoomend",this._zoomEnd,this),t.off("moveend",this._moveEnd,this),this._unbindEvents(),this._map._mapPane.className=this._map._mapPane.className.replace(" leaflet-cluster-anim",""),this._spiderfierOnRemove&&this._spiderfierOnRemove(),delete this._maxLat,this._hideCoverage(),this._featureGroup.remove(),this._nonPointGroup.remove(),this._featureGroup.clearLayers(),this._map=null},getVisibleParent:function(t){for(var e=t;e&&!e._icon;)e=e.__parent;return e||null},_arraySplice:function(t,e){for(var i=t.length-1;i>=0;i--)if(t[i]===e)return t.splice(i,1),!0},_removeFromGridUnclustered:function(t,e){for(var i=this._map,n=this._gridUnclustered,o=Math.floor(this._map.getMinZoom());e>=o&&n[e].removeObject(t,i.project(t.getLatLng(),e));e--);},_childMarkerDragStart:function(t){t.target.__dragStart=t.target._latlng},_childMarkerMoved:function(t){if(!this._ignoreMove&&!t.target.__dragStart){var e=t.target._popup&&t.target._popup.isOpen();this._moveChild(t.target,t.oldLatLng,t.latlng),e&&t.target.openPopup()}},_moveChild:function(t,e,i){t._latlng=e,this.removeLayer(t),t._latlng=i,this.addLayer(t)},_childMarkerDragEnd:function(t){var e=t.target.__dragStart;delete t.target.__dragStart,e&&this._moveChild(t.target,e,t.target._latlng)},_removeLayer:function(t,e,i){var n=this._gridClusters,o=this._gridUnclustered,a=this._featureGroup,r=this._map,s=Math.floor(this._map.getMinZoom());e&&this._removeFromGridUnclustered(t,this._maxZoom);var l,h=t.__parent,u=h._markers;for(this._arraySplice(u,t);h&&(h._childCount--,h._boundsNeedUpdate=!0,!(h._zoome?"small":100>e?"medium":"large",new L.DivIcon({html:"
"+e+"
",className:"marker-cluster"+i,iconSize:new L.Point(40,40)})},_bindEvents:function(){var t=this._map,e=this.options.spiderfyOnMaxZoom,i=this.options.showCoverageOnHover,n=this.options.zoomToBoundsOnClick;(e||n)&&this.on("clusterclick",this._zoomOrSpiderfy,this),i&&(this.on("clustermouseover",this._showCoverage,this),this.on("clustermouseout",this._hideCoverage,this),t.on("zoomend",this._hideCoverage,this))},_zoomOrSpiderfy:function(t){for(var e=t.layer,i=e;1===i._childClusters.length;)i=i._childClusters[0];i._zoom===this._maxZoom&&i._childCount===e._childCount&&this.options.spiderfyOnMaxZoom?e.spiderfy():this.options.zoomToBoundsOnClick&&e.zoomToBounds(),t.originalEvent&&13===t.originalEvent.keyCode&&this._map._container.focus()},_showCoverage:function(t){var e=this._map;this._inZoomAnimation||(this._shownPolygon&&e.removeLayer(this._shownPolygon),t.layer.getChildCount()>2&&t.layer!==this._spiderfied&&(this._shownPolygon=new L.Polygon(t.layer.getConvexHull(),this.options.polygonOptions),e.addLayer(this._shownPolygon)))},_hideCoverage:function(){this._shownPolygon&&(this._map.removeLayer(this._shownPolygon),this._shownPolygon=null)},_unbindEvents:function(){var t=this.options.spiderfyOnMaxZoom,e=this.options.showCoverageOnHover,i=this.options.zoomToBoundsOnClick,n=this._map;(t||i)&&this.off("clusterclick",this._zoomOrSpiderfy,this),e&&(this.off("clustermouseover",this._showCoverage,this),this.off("clustermouseout",this._hideCoverage,this),n.off("zoomend",this._hideCoverage,this))},_zoomEnd:function(){this._map&&(this._mergeSplitClusters(),this._zoom=Math.round(this._map._zoom),this._currentShownBounds=this._getExpandedVisibleBounds())},_moveEnd:function(){if(!this._inZoomAnimation){var t=this._getExpandedVisibleBounds();this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,Math.floor(this._map.getMinZoom()),this._zoom,t),this._topClusterLevel._recursivelyAddChildrenToMap(null,Math.round(this._map._zoom),t),this._currentShownBounds=t}},_generateInitialClusters:function(){var t=Math.ceil(this._map.getMaxZoom()),e=Math.floor(this._map.getMinZoom()),i=this.options.maxClusterRadius,n=i;"function"!=typeof i&&(n=function(){return i}),null!==this.options.disableClusteringAtZoom&&(t=this.options.disableClusteringAtZoom-1),this._maxZoom=t,this._gridClusters={},this._gridUnclustered={};for(var o=t;o>=e;o--)this._gridClusters[o]=new L.DistanceGrid(n(o)),this._gridUnclustered[o]=new L.DistanceGrid(n(o));this._topClusterLevel=new this._markerCluster(this,e-1)},_addLayer:function(t,e){var i,n,o=this._gridClusters,a=this._gridUnclustered,r=Math.floor(this._map.getMinZoom());for(this.options.singleMarkerMode&&this._overrideMarkerIcon(t),t.on(this._childMarkerEventHandlers,this);e>=r;e--){i=this._map.project(t.getLatLng(),e);var s=o[e].getNearObject(i);if(s)return s._addChild(t),void(t.__parent=s);if(s=a[e].getNearObject(i)){var l=s.__parent;l&&this._removeLayer(s,!1);var h=new this._markerCluster(this,e,s,t);o[e].addObject(h,this._map.project(h._cLatLng,e)),s.__parent=h,t.__parent=h;var u=h;for(n=e-1;n>l._zoom;n--)u=new this._markerCluster(this,n,u),o[n].addObject(u,this._map.project(s.getLatLng(),n));return l._addChild(u),void this._removeFromGridUnclustered(s,e)}a[e].addObject(t,i)}this._topClusterLevel._addChild(t),t.__parent=this._topClusterLevel},_refreshClustersIcons:function(){this._featureGroup.eachLayer((function(t){t instanceof L.MarkerCluster&&t._iconNeedsUpdate&&t._updateIcon()}))},_enqueue:function(t){this._queue.push(t),this._queueTimeout||(this._queueTimeout=setTimeout(L.bind(this._processQueue,this),300))},_processQueue:function(){for(var t=0;tt?(this._animationStart(),this._animationZoomOut(this._zoom,t)):this._moveEnd()},_getExpandedVisibleBounds:function(){return this.options.removeOutsideVisibleBounds?L.Browser.mobile?this._checkBoundsMaxLat(this._map.getBounds()):this._checkBoundsMaxLat(this._map.getBounds().pad(1)):this._mapBoundsInfinite},_checkBoundsMaxLat:function(t){var e=this._maxLat;return void 0!==e&&(t.getNorth()>=e&&(t._northEast.lat=1/0),t.getSouth()<=-e&&(t._southWest.lat=-1/0)),t},_animationAddLayerNonAnimated:function(t,e){if(e===t)this._featureGroup.addLayer(t);else if(2===e._childCount){e._addToMap();var i=e.getAllChildMarkers();this._featureGroup.removeLayer(i[0]),this._featureGroup.removeLayer(i[1])}else e._updateIcon()},_extractNonGroupLayers:function(t,e){var i,n=t.getLayers(),o=0;for(e=e||[];o=0;i--)r=l[i],n.contains(r._latlng)||o.removeLayer(r)})),this._forceLayout(),this._topClusterLevel._recursivelyBecomeVisible(n,e),o.eachLayer((function(t){t instanceof L.MarkerCluster||!t._icon||t.clusterShow()})),this._topClusterLevel._recursively(n,t,e,(function(t){t._recursivelyRestoreChildPositions(e)})),this._ignoreMove=!1,this._enqueue((function(){this._topClusterLevel._recursively(n,t,a,(function(t){o.removeLayer(t),t.clusterShow()})),this._animationEnd()}))},_animationZoomOut:function(t,e){this._animationZoomOutSingle(this._topClusterLevel,t-1,e),this._topClusterLevel._recursivelyAddChildrenToMap(null,e,this._getExpandedVisibleBounds()),this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,Math.floor(this._map.getMinZoom()),t,this._getExpandedVisibleBounds())},_animationAddLayer:function(t,e){var i=this,n=this._featureGroup;n.addLayer(t),e!==t&&(e._childCount>2?(e._updateIcon(),this._forceLayout(),this._animationStart(),t._setPos(this._map.latLngToLayerPoint(e.getLatLng())),t.clusterHide(),this._enqueue((function(){n.removeLayer(t),t.clusterShow(),i._animationEnd()}))):(this._forceLayout(),i._animationStart(),i._animationZoomOutSingle(e,this._map.getMaxZoom(),this._zoom)))}},_animationZoomOutSingle:function(t,e,i){var n=this._getExpandedVisibleBounds(),o=Math.floor(this._map.getMinZoom());t._recursivelyAnimateChildrenInAndAddSelfToMap(n,o,e+1,i);var a=this;this._forceLayout(),t._recursivelyBecomeVisible(n,i),this._enqueue((function(){if(1===t._childCount){var r=t._markers[0];this._ignoreMove=!0,r.setLatLng(r.getLatLng()),this._ignoreMove=!1,r.clusterShow&&r.clusterShow()}else t._recursively(n,i,o,(function(t){t._recursivelyRemoveChildrenFromMap(n,o,e+1)}));a._animationEnd()}))},_animationEnd:function(){this._map&&(this._map._mapPane.className=this._map._mapPane.className.replace(" leaflet-cluster-anim","")),this._inZoomAnimation--,this.fire("animationend")},_forceLayout:function(){L.Util.falseFn(document.body.offsetWidth)}}),L.markerClusterGroup=function(t){return new L.MarkerClusterGroup(t)};var i=L.MarkerCluster=L.Marker.extend({options:L.Icon.prototype.options,initialize:function(t,e,i,n){L.Marker.prototype.initialize.call(this,i?i._cLatLng||i.getLatLng():new L.LatLng(0,0),{icon:this,pane:t.options.clusterPane}),this._group=t,this._zoom=e,this._markers=[],this._childClusters=[],this._childCount=0,this._iconNeedsUpdate=!0,this._boundsNeedUpdate=!0,this._bounds=new L.LatLngBounds,i&&this._addChild(i),n&&this._addChild(n)},getAllChildMarkers:function(t,e){t=t||[];for(var i=this._childClusters.length-1;i>=0;i--)this._childClusters[i].getAllChildMarkers(t);for(var n=this._markers.length-1;n>=0;n--)e&&this._markers[n].__dragStart||t.push(this._markers[n]);return t},getChildCount:function(){return this._childCount},zoomToBounds:function(t){for(var e,i=this._childClusters.slice(),n=this._group._map,o=n.getBoundsZoom(this._bounds),a=this._zoom+1,r=n.getZoom();i.length>0&&o>a;){a++;var s=[];for(e=0;ea?this._group._map.setView(this._latlng,a):r>=o?this._group._map.setView(this._latlng,r+1):this._group._map.fitBounds(this._bounds,t)},getBounds:function(){var t=new L.LatLngBounds;return t.extend(this._bounds),t},_updateIcon:function(){this._iconNeedsUpdate=!0,this._icon&&this.setIcon(this)},createIcon:function(){return this._iconNeedsUpdate&&(this._iconObj=this._group.options.iconCreateFunction(this),this._iconNeedsUpdate=!1),this._iconObj.createIcon()},createShadow:function(){return this._iconObj.createShadow()},_addChild:function(t,e){this._iconNeedsUpdate=!0,this._boundsNeedUpdate=!0,this._setClusterCenter(t),t instanceof L.MarkerCluster?(e||(this._childClusters.push(t),t.__parent=this),this._childCount+=t._childCount):(e||this._markers.push(t),this._childCount++),this.__parent&&this.__parent._addChild(t,!0)},_setClusterCenter:function(t){this._cLatLng||(this._cLatLng=t._cLatLng||t._latlng)},_resetBounds:function(){var t=this._bounds;t._southWest&&(t._southWest.lat=1/0,t._southWest.lng=1/0),t._northEast&&(t._northEast.lat=-1/0,t._northEast.lng=-1/0)},_recalculateBounds:function(){var t,e,i,n,o=this._markers,a=this._childClusters,r=0,s=0,l=this._childCount;if(0!==l){for(this._resetBounds(),t=0;t=0;i--)(n=o[i])._icon&&(n._setPos(e),n.clusterHide())}),(function(t){var i,n,o=t._childClusters;for(i=o.length-1;i>=0;i--)(n=o[i])._icon&&(n._setPos(e),n.clusterHide())}))},_recursivelyAnimateChildrenInAndAddSelfToMap:function(t,e,i,n){this._recursively(t,n,e,(function(o){o._recursivelyAnimateChildrenIn(t,o._group._map.latLngToLayerPoint(o.getLatLng()).round(),i),o._isSingleParent()&&i-1===n?(o.clusterShow(),o._recursivelyRemoveChildrenFromMap(t,e,i)):o.clusterHide(),o._addToMap()}))},_recursivelyBecomeVisible:function(t,e){this._recursively(t,this._group._map.getMinZoom(),e,null,(function(t){t.clusterShow()}))},_recursivelyAddChildrenToMap:function(t,e,i){this._recursively(i,this._group._map.getMinZoom()-1,e,(function(n){if(e!==n._zoom)for(var o=n._markers.length-1;o>=0;o--){var a=n._markers[o];i.contains(a._latlng)&&(t&&(a._backupLatlng=a.getLatLng(),a.setLatLng(t),a.clusterHide&&a.clusterHide()),n._group._featureGroup.addLayer(a))}}),(function(e){e._addToMap(t)}))},_recursivelyRestoreChildPositions:function(t){for(var e=this._markers.length-1;e>=0;e--){var i=this._markers[e];i._backupLatlng&&(i.setLatLng(i._backupLatlng),delete i._backupLatlng)}if(t-1===this._zoom)for(var n=this._childClusters.length-1;n>=0;n--)this._childClusters[n]._restorePosition();else for(var o=this._childClusters.length-1;o>=0;o--)this._childClusters[o]._recursivelyRestoreChildPositions(t)},_restorePosition:function(){this._backupLatlng&&(this.setLatLng(this._backupLatlng),delete this._backupLatlng)},_recursivelyRemoveChildrenFromMap:function(t,e,i,n){var o,a;this._recursively(t,e-1,i-1,(function(t){for(a=t._markers.length-1;a>=0;a--)o=t._markers[a],n&&n.contains(o._latlng)||(t._group._featureGroup.removeLayer(o),o.clusterShow&&o.clusterShow())}),(function(t){for(a=t._childClusters.length-1;a>=0;a--)o=t._childClusters[a],n&&n.contains(o._latlng)||(t._group._featureGroup.removeLayer(o),o.clusterShow&&o.clusterShow())}))},_recursively:function(t,e,i,n,o){var a,r,s=this._childClusters,l=this._zoom;if(l>=e&&(n&&n(this),o&&l===i&&o(this)),e>l||i>l)for(a=s.length-1;a>=0;a--)(r=s[a])._boundsNeedUpdate&&r._recalculateBounds(),t.intersects(r._bounds)&&r._recursively(t,e,i,n,o)},_isSingleParent:function(){return this._childClusters.length>0&&this._childClusters[0]._childCount===this._childCount}});L.Marker.include({clusterHide:function(){var t=this.options.opacity;return this.setOpacity(0),this.options.opacity=t,this},clusterShow:function(){return this.setOpacity(this.options.opacity)}}),L.DistanceGrid=function(t){this._cellSize=t,this._sqCellSize=t*t,this._grid={},this._objectPoint={}},L.DistanceGrid.prototype={addObject:function(t,e){var i=this._getCoord(e.x),n=this._getCoord(e.y),o=this._grid,a=o[n]=o[n]||{},r=a[i]=a[i]||[],s=L.Util.stamp(t);this._objectPoint[s]=e,r.push(t)},updateObject:function(t,e){this.removeObject(t),this.addObject(t,e)},removeObject:function(t,e){var i,n,o=this._getCoord(e.x),a=this._getCoord(e.y),r=this._grid,s=r[a]=r[a]||{},l=s[o]=s[o]||[];for(delete this._objectPoint[L.Util.stamp(t)],i=0,n=l.length;n>i;i++)if(l[i]===t)return l.splice(i,1),1===n&&delete s[o],!0},eachObject:function(t,e){var i,n,o,a,r,s,l=this._grid;for(i in l)for(n in r=l[i])for(o=0,a=(s=r[n]).length;a>o;o++)t.call(e,s[o])&&(o--,a--)},getNearObject:function(t){var e,i,n,o,a,r,s,l,h=this._getCoord(t.x),u=this._getCoord(t.y),d=this._objectPoint,c=this._sqCellSize,_=null;for(e=u-1;u+1>=e;e++)if(o=this._grid[e])for(i=h-1;h+1>=i;i++)if(a=o[i])for(n=0,r=a.length;r>n;n++)s=a[n],(c>(l=this._sqDist(d[L.Util.stamp(s)],t))||c>=l&&null===_)&&(c=l,_=s);return _},_getCoord:function(t){var e=Math.floor(t/this._cellSize);return isFinite(e)?e:t},_sqDist:function(t,e){var i=e.x-t.x,n=e.y-t.y;return i*i+n*n}},L.QuickHull={getDistant:function(t,e){var i=e[1].lat-e[0].lat;return(e[0].lng-e[1].lng)*(t.lat-e[0].lat)+i*(t.lng-e[0].lng)},findMostDistantPointFromBaseLine:function(t,e){var i,n,o,a=0,r=null,s=[];for(i=e.length-1;i>=0;i--)n=e[i],(o=this.getDistant(n,t))>0&&(s.push(n),o>a&&(a=o,r=n));return{maxPoint:r,newPoints:s}},buildConvexHull:function(t,e){var i=[],n=this.findMostDistantPointFromBaseLine(t,e);return n.maxPoint?i=(i=i.concat(this.buildConvexHull([t[0],n.maxPoint],n.newPoints))).concat(this.buildConvexHull([n.maxPoint,t[1]],n.newPoints)):[t[0]]},getConvexHull:function(t){var e,i=!1,n=!1,o=!1,a=!1,r=null,s=null,l=null,h=null,u=null,d=null;for(e=t.length-1;e>=0;e--){var c=t[e];(!1===i||c.lat>i)&&(r=c,i=c.lat),(!1===n||c.lato)&&(l=c,o=c.lng),(!1===a||c.lng=0;e--)t=i[e].getLatLng(),n.push(t);return L.QuickHull.getConvexHull(n)}}),L.MarkerCluster.include({_2PI:2*Math.PI,_circleFootSeparation:25,_circleStartAngle:0,_spiralFootSeparation:28,_spiralLengthStart:11,_spiralLengthFactor:5,_circleSpiralSwitchover:9,spiderfy:function(){if(this._group._spiderfied!==this&&!this._group._inZoomAnimation){var t,e=this.getAllChildMarkers(null,!0),i=this._group._map.latLngToLayerPoint(this._latlng);this._group._unspiderfy(),this._group._spiderfied=this,e.length>=this._circleSpiralSwitchover?t=this._generatePointsSpiral(e.length,i):(i.y+=10,t=this._generatePointsCircle(e.length,i)),this._animationSpiderfy(e,t)}},unspiderfy:function(t){this._group._inZoomAnimation||(this._animationUnspiderfy(t),this._group._spiderfied=null)},_generatePointsCircle:function(t,e){var i,n,o=this._group.options.spiderfyDistanceMultiplier*this._circleFootSeparation*(2+t)/this._2PI,a=this._2PI/t,r=[];for(o=Math.max(o,35),r.length=t,i=0;t>i;i++)n=this._circleStartAngle+i*a,r[i]=new L.Point(e.x+o*Math.cos(n),e.y+o*Math.sin(n))._round();return r},_generatePointsSpiral:function(t,e){var i,n=this._group.options.spiderfyDistanceMultiplier,o=n*this._spiralLengthStart,a=n*this._spiralFootSeparation,r=n*this._spiralLengthFactor*this._2PI,s=0,l=[];for(l.length=t,i=t;i>=0;i--)t>i&&(l[i]=new L.Point(e.x+o*Math.cos(s),e.y+o*Math.sin(s))._round()),o+=r/(s+=a/o+5e-4*i);return l},_noanimationUnspiderfy:function(){var t,e,i=this._group,n=i._map,o=i._featureGroup,a=this.getAllChildMarkers(null,!0);for(i._ignoreMove=!0,this.setOpacity(1),e=a.length-1;e>=0;e--)t=a[e],o.removeLayer(t),t._preSpiderfyLatlng&&(t.setLatLng(t._preSpiderfyLatlng),delete t._preSpiderfyLatlng),t.setZIndexOffset&&t.setZIndexOffset(0),t._spiderLeg&&(n.removeLayer(t._spiderLeg),delete t._spiderLeg);i.fire("unspiderfied",{cluster:this,markers:a}),i._ignoreMove=!1,i._spiderfied=null}}),L.MarkerClusterNonAnimated=L.MarkerCluster.extend({_animationSpiderfy:function(t,e){var i,n,o,a,r=this._group,s=r._map,l=r._featureGroup,h=this._group.options.spiderLegPolylineOptions;for(r._ignoreMove=!0,i=0;i=0;i--)s=u.layerPointToLatLng(e[i]),(n=t[i])._preSpiderfyLatlng=n._latlng,n.setLatLng(s),n.clusterShow&&n.clusterShow(),p&&((a=(o=n._spiderLeg)._path).style.strokeDashoffset=0,o.setStyle({opacity:f}));this.setOpacity(.3),h._ignoreMove=!1,setTimeout((function(){h._animationEnd(),h.fire("spiderfied",{cluster:l,markers:t})}),200)},_animationUnspiderfy:function(t){var e,i,n,o,a,r,s=this,l=this._group,h=l._map,u=l._featureGroup,d=t?h._latLngToNewLayerPoint(this._latlng,t.zoom,t.center):h.latLngToLayerPoint(this._latlng),c=this.getAllChildMarkers(null,!0),_=L.Path.SVG;for(l._ignoreMove=!0,l._animationStart(),this.setOpacity(1),i=c.length-1;i>=0;i--)(e=c[i])._preSpiderfyLatlng&&(e.closePopup(),e.setLatLng(e._preSpiderfyLatlng),delete e._preSpiderfyLatlng,r=!0,e._setPos&&(e._setPos(d),r=!1),e.clusterHide&&(e.clusterHide(),r=!1),r&&u.removeLayer(e),_&&(a=(o=(n=e._spiderLeg)._path).getTotalLength()+.1,o.style.strokeDashoffset=a,n.setStyle({opacity:0})));l._ignoreMove=!1,setTimeout((function(){var t=0;for(i=c.length-1;i>=0;i--)(e=c[i])._spiderLeg&&t++;for(i=c.length-1;i>=0;i--)(e=c[i])._spiderLeg&&(e.clusterShow&&e.clusterShow(),e.setZIndexOffset&&e.setZIndexOffset(0),t>1&&u.removeLayer(e),h.removeLayer(e._spiderLeg),delete e._spiderLeg);l._animationEnd(),l.fire("unspiderfied",{cluster:s,markers:c})}),200)}}),L.MarkerClusterGroup.include({_spiderfied:null,unspiderfy:function(){this._unspiderfy.apply(this,arguments)},_spiderfierOnAdd:function(){this._map.on("click",this._unspiderfyWrapper,this),this._map.options.zoomAnimation&&this._map.on("zoomstart",this._unspiderfyZoomStart,this),this._map.on("zoomend",this._noanimationUnspiderfy,this),L.Browser.touch||this._map.getRenderer(this)},_spiderfierOnRemove:function(){this._map.off("click",this._unspiderfyWrapper,this),this._map.off("zoomstart",this._unspiderfyZoomStart,this),this._map.off("zoomanim",this._unspiderfyZoomAnim,this),this._map.off("zoomend",this._noanimationUnspiderfy,this),this._noanimationUnspiderfy()},_unspiderfyZoomStart:function(){this._map&&this._map.on("zoomanim",this._unspiderfyZoomAnim,this)},_unspiderfyZoomAnim:function(t){L.DomUtil.hasClass(this._map._mapPane,"leaflet-touching")||(this._map.off("zoomanim",this._unspiderfyZoomAnim,this),this._unspiderfy(t))},_unspiderfyWrapper:function(){this._unspiderfy()},_unspiderfy:function(t){this._spiderfied&&this._spiderfied.unspiderfy(t)},_noanimationUnspiderfy:function(){this._spiderfied&&this._spiderfied._noanimationUnspiderfy()},_unspiderfyLayer:function(t){t._spiderLeg&&(this._featureGroup.removeLayer(t),t.clusterShow&&t.clusterShow(),t.setZIndexOffset&&t.setZIndexOffset(0),this._map.removeLayer(t._spiderLeg),delete t._spiderLeg)}}),L.MarkerClusterGroup.include({refreshClusters:function(t){return t?t instanceof L.MarkerClusterGroup?t=t._topClusterLevel.getAllChildMarkers():t instanceof L.LayerGroup?t=t._layers:t instanceof L.MarkerCluster?t=t.getAllChildMarkers():t instanceof L.Marker&&(t=[t]):t=this._topClusterLevel.getAllChildMarkers(),this._flagParentsIconsNeedUpdate(t),this._refreshClustersIcons(),this.options.singleMarkerMode&&this._refreshSingleMarkerModeMarkers(t),this},_flagParentsIconsNeedUpdate:function(t){var e,i;for(e in t)for(i=t[e].__parent;i;)i._iconNeedsUpdate=!0,i=i.__parent},_refreshSingleMarkerModeMarkers:function(t){var e,i;for(e in t)i=t[e],this.hasLayer(i)&&i.setIcon(this._overrideMarkerIcon(i))}}),L.Marker.include({refreshIconOptions:function(t,e){var i=this.options.icon;return L.setOptions(i,t),this.setIcon(i),e&&this.__parent&&this.__parent._group.refreshClusters(this),this}}),t.MarkerClusterGroup=e,t.MarkerCluster=i})),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(require("leaflet")):"function"==typeof define&&define.amd?define(["leaflet"],e):e(t.L)}(this,(function(t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var e=function(t,e){return(180*Math.atan2(e.y-t.y,e.x-t.x)/Math.PI+90+360)%360},i=function(t,e){var i=t.value;return t.isInPixels?i/e:i};function n(t){if("string"==typeof t&&-1!==t.indexOf("%"))return{value:parseFloat(t)/100,isInPixels:!1};var e=t?parseFloat(t):0;return{value:e,isInPixels:e>0}}var o,a,r;function s(t){return t.reduce((function(t,i,n,o){if(n>0&&!function(t,e){return t.x===e.x&&t.y===e.y}(i,o[n-1])){var a=o[n-1],r=t.length>0?t[t.length-1].distB:0,s=(l=a,u=(h=i).x-l.x,d=h.y-l.y,Math.sqrt(u*u+d*d));t.push({a:a,b:i,distA:r,distB:r+s,heading:e(a,i)})}var l,h,u,d;return t}),[])}function l(t,e,i){return e.x!==t.x?{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}:{x:t.x,y:t.y+(e.y-t.y)*i}}o=Waymark_L.Marker.prototype._initIcon,a=Waymark_L.Marker.prototype._setPos,r="msTransform"===Waymark_L.DomUtil.TRANSFORM,Waymark_L.Marker.addInitHook((function(){var t=this.options.icon&&this.options.icon.options&&this.options.icon.options.iconAnchor;t&&(t=t[0]+"px "+t[1]+"px"),this.options.rotationOrigin=this.options.rotationOrigin||t||"center bottom",this.options.rotationAngle=this.options.rotationAngle||0,this.on("drag",(function(t){t.target._applyRotation()}))})),Waymark_L.Marker.include({_initIcon:function(){o.call(this)},_setPos:function(t){a.call(this,t),this._applyRotation()},_applyRotation:function(){this.options.rotationAngle&&(this._icon.style[Waymark_L.DomUtil.TRANSFORM+"Origin"]=this.options.rotationOrigin,r?this._icon.style[Waymark_L.DomUtil.TRANSFORM]="rotate("+this.options.rotationAngle+"deg)":this._icon.style[Waymark_L.DomUtil.TRANSFORM]+=" rotateZ("+this.options.rotationAngle+"deg)")},setRotationAngle:function(t){return this.options.rotationAngle=t,this.update(),this},setRotationOrigin:function(t){return this.options.rotationOrigin=t,this.update(),this}}),t.Symbol=t.Symbol||{},t.Symbol.Dash=t.Class.extend({options:{pixelSize:10,pathOptions:{}},initialize:function(e){t.Util.setOptions(this,e),this.options.pathOptions.clickable=!1},buildSymbol:function(e,i,n,o,a){var r=this.options,s=Math.PI/180;if(r.pixelSize<=1)return t.polyline([e.latLng,e.latLng],r.pathOptions);var l=n.project(e.latLng),h=-(e.heading-90)*s,u=t.point(l.x+r.pixelSize*Math.cos(h+Math.PI)/2,l.y+r.pixelSize*Math.sin(h)/2),d=l.add(l.subtract(u));return t.polyline([n.unproject(u),n.unproject(d)],r.pathOptions)}}),t.Symbol.dash=function(e){return new t.Symbol.Dash(e)},t.Symbol.ArrowHead=t.Class.extend({options:{polygon:!0,pixelSize:10,headAngle:60,pathOptions:{stroke:!1,weight:2}},initialize:function(e){t.Util.setOptions(this,e),this.options.pathOptions.clickable=!1},buildSymbol:function(e,i,n,o,a){return this.options.polygon?t.polygon(this._buildArrowPath(e,n),this.options.pathOptions):t.polyline(this._buildArrowPath(e,n),this.options.pathOptions)},_buildArrowPath:function(e,i){var n=Math.PI/180,o=i.project(e.latLng),a=-(e.heading-90)*n,r=this.options.headAngle/2*n,s=a+r,l=a-r,h=t.point(o.x-this.options.pixelSize*Math.cos(s),o.y+this.options.pixelSize*Math.sin(s)),u=t.point(o.x-this.options.pixelSize*Math.cos(l),o.y+this.options.pixelSize*Math.sin(l));return[i.unproject(h),e.latLng,i.unproject(u)]}}),t.Symbol.arrowHead=function(e){return new t.Symbol.ArrowHead(e)},t.Symbol.Marker=t.Class.extend({options:{markerOptions:{},rotate:!1},initialize:function(e){t.Util.setOptions(this,e),this.options.markerOptions.clickable=!1,this.options.markerOptions.draggable=!1},buildSymbol:function(e,i,n,o,a){return this.options.rotate&&(this.options.markerOptions.rotationAngle=e.heading+(this.options.angleCorrection||0)),t.marker(e.latLng,this.options.markerOptions)}}),t.Symbol.marker=function(e){return new t.Symbol.Marker(e)};var h=function(e){return Array.isArray(e)&&((i=e[0])instanceof t.LatLng||Array.isArray(i)&&2===i.length&&"number"==typeof i[0]);var i};t.PolylineDecorator=t.FeatureGroup.extend({options:{patterns:[]},initialize:function(e,i){t.FeatureGroup.prototype.initialize.call(this),t.Util.setOptions(this,i),this._map=null,this._paths=this._initPaths(e),this._bounds=this._initBounds(),this._patterns=this._initPatterns(this.options.patterns)},_initPaths:function(e,i){var n=this;return h(e)?[i?e.concat([e[0]]):e]:e instanceof t.Polyline?this._initPaths(e.getLatLngs(),e instanceof t.Polygon):Array.isArray(e)?e.reduce((function(t,e){return t.concat(n._initPaths(e,i))}),[]):[]},_initPatterns:function(t){return t.map(this._parsePatternDef)},setPatterns:function(t){this.options.patterns=t,this._patterns=this._initPatterns(this.options.patterns),this.redraw()},setPaths:function(t){this._paths=this._initPaths(t),this._bounds=this._initBounds(),this.redraw()},_parsePatternDef:function(t,e){return{symbolFactory:t.symbol,offset:n(t.offset),endOffset:n(t.endOffset),repeat:n(t.repeat)}},onAdd:function(t){this._map=t,this._draw(),this._map.on("moveend",this.redraw,this)},onRemove:function(e){this._map.off("moveend",this.redraw,this),this._map=null,t.FeatureGroup.prototype.onRemove.call(this,e)},_initBounds:function(){var e=this._paths.reduce((function(t,e){return t.concat(e)}),[]);return t.latLngBounds(e)},getBounds:function(){return this._bounds},_buildSymbols:function(t,e,i){var n=this;return i.map((function(o,a){return e.buildSymbol(o,t,n._map,a,i.length)}))},_getDirectionPoints:function(e,n){var o=this;return e.length<2?[]:function(t,e){var n=s(t),o=n.length;if(0===o)return[];var a=n[o-1].distB,r=i(e.offset,a),h=i(e.endOffset,a),u=a*i(e.repeat,a),d=h>0?a*h:0,c=[],_=r>0?a*r:0;do{c.push(_),_+=u}while(u>0&&_m.distB&&pOpenStreetMap contributors',layer_max_zoom:"18"}],line_types:[],shape_types:[],marker_types:[],show_scale:0},viewer_options:{show_gallery:0,show_filter:1,show_cluster:1,cluster_radius:80,cluster_threshold:14,show_elevation:0,elevation_div_id:"waymark-elevation",elevation_units:"metric",elevation_initial:1,elevation_colour:"green",sleep_delay_seconds:2,sleep_do_message:0,sleep_wake_message:"Click or Hover to Wake"},editor_options:{confirm_delete:1,data_div_id:"waymark-data"},image_size_names:["thumbnail","medium","large","full"],marker_type_defaults:{marker_title:"Marker",marker_shape:"marker",marker_size:"medium",marker_colour:"#b42714",marker_icon:"fa-star",icon_type:"font",icon_colour:"white"},line_type_defaults:{line_title:"Line",line_colour:"#b42714",line_weight:"2",line_opacity:"0.7"},shape_type_defaults:{shape_title:"Shape",shape_colour:"red",fill_opacity:"0.4"},marker_data_defaults:{title:void 0,type:void 0,image_thumbnail_url:void 0,image_medium_url:void 0,image_large_url:void 0,description:void 0},line_data_defaults:{type:void 0,title:void 0,image_thumbnail_url:void 0,image_medium_url:void 0,image_large_url:void 0,description:void 0,direction:void 0},shape_data_defaults:{type:void 0,title:void 0,image_thumbnail_url:void 0,image_medium_url:void 0,image_large_url:void 0,description:void 0},language:{action_fullscreen_activate:"View Fullscreen",action_fullscreen_deactivate:"Exit Fullscreen",action_locate_activate:"Show me where I am",action_zoom_in:"Zoom in",action_zoom_out:"Zoom out",label_total_length:"Total Length: ",label_max_elevation:"Max. Elevation: ",label_min_elevation:"Min. Elevation: ",label_ascent:"Total Ascent: ",label_descent:"Total Descent: ",add_line_title:"Draw a Line",add_photo_title:"Upload an Image",add_marker_title:"Place a Marker",add_rectangle_title:"Draw a Rectangle",add_polygon_title:"Draw a Polygon",add_circle_title:"Draw a Circle",upload_file_title:"Read Lines and Markers from file (GPX/KML/GeoJSON supported, which most apps should Export to)",action_duplicate:"Duplicate",action_delete:"Delete",action_edit:"Edit",action_edit_done:"Finish editing",action_upload_image:"Upload Image",object_title_placeholder:"Title",object_image_placeholder:"Image URL",object_description_placeholder:"Description",object_type_label:"Type",marker_latlng_label:"Lat,Lng",action_delete_confirm:"Are you sure you want to delete this",action_search_placeholder:"Search...",object_label_marker:"Marker",object_label_line:"Line",object_label_shape:"Shape",object_label_marker_plural:"Markers",object_label_line_plural:"Lines",object_label_shape_plural:"Shapes",error_message_prefix:"Waymark Error",info_message_prefix:"Waymark Info",debug_message_prefix:"Waymark Debug",error_file_type:"This file type is not supported.",error_file_conversion:"Could not convert this file to GeoJSON.",error_file_upload:"File upload error.",error_photo_meta:"Could not retrieve Image metadata.",info_exif_yes:"Image location metadata (EXIF) detected!",info_exif_no:"Image location metadata (EXIF) NOT detected.",error_no_wpmedia:"WordPress Media Library not found",no_direction:"No Direction",show_direction:"Show Direction",reverse_direction:"Reverse Direction",sleep_wake_message:"Click or Hover to Wake"}},t)if(["map_options","viewer_options","editor_options","language"].indexOf(key)>-1)for(sub_key in t[key])void 0!==Waymark.config[key][sub_key]&&("object"==typeof t[key][sub_key]?(Array.isArray(t[key][sub_key])?Waymark.config[key][sub_key]=t[key][sub_key]:Waymark.config[key][sub_key]=Object.assign({},Waymark.config[key][sub_key],t[key][sub_key]),Waymark.debug("Setting config: "+key+" - "+sub_key+" - "+JSON.stringify(t[key][sub_key]))):(Waymark.config[key][sub_key]=t[key][sub_key],Waymark.debug("Setting config: "+key+" - "+sub_key+" - "+t[key][sub_key])));Waymark.config.viewer_options.sleep_wake_message=Waymark.config.language.sleep_wake_message;var e=Waymark.get_type("line"),i=Waymark.make_key(e.line_title);Waymark.config.line_data_defaults.type=i;var n=Waymark.get_type("shape"),o=Waymark.make_key(n.shape_title);Waymark.config.shape_data_defaults.type=o;var a=Waymark.get_type("marker"),r=Waymark.make_key(a.marker_title);Waymark.config.marker_data_defaults.type=r,Waymark.config.map_options.debug_mode&&console.log(Waymark.config),Waymark.marker_parent_group=Waymark_L.layerGroup(),Waymark.marker_sub_groups={},Waymark.line_parent_group=Waymark_L.layerGroup(),Waymark.line_sub_groups={},Waymark.shape_parent_group=Waymark_L.layerGroup(),Waymark.shape_sub_groups={},Waymark.pre_map_setup(),Waymark.setup_map(),Waymark.handle_resize(),Waymark.init_done()},this.get_property=function(t,...e){return e.reduce((t,e)=>t&&t[e],t)},this.debug=function(t,e="console"){this.config.map_options.debug_mode&&("string"==typeof t?this.message(t,"debug",e):("object"==typeof t&&null!==t&&(t=JSON.parse(JSON.stringify(t))),"console"==e?console.debug(t):this.message(JSON.stringify(t),"debug",e)))},this.message=function(t=null,e="info",i="console"){if(t){var n="";switch(e){case"debug":case"error":n=Waymark.config.language[e+"_message_prefix"];break;default:case"info":n=Waymark.config.language.info_message_prefix}n&&(n="["+n+"] "),"console"==i?"error"==e?console.error(n+t):"debug"==e?console.debug(n+t):console.log(n+t):alert(n+t)}},this.title_case=function(t){return t.replace(/(?:^|\s)\w/g,(function(t){return t.toUpperCase()}))},this.transliterate=function(t){var e={"Ё":"YO","Й":"I","Ц":"TS","У":"U","К":"K","Е":"E","Н":"N","Г":"G","Ш":"SH","Щ":"SCH","З":"Z","Х":"H","Ъ":"'","ё":"yo","й":"i","ц":"ts","у":"u","к":"k","е":"e","н":"n","г":"g","ш":"sh","щ":"sch","з":"z","х":"h","ъ":"'","Ф":"F","Ы":"I","В":"V","А":"a","П":"P","Р":"R","О":"O","Л":"L","Д":"D","Ж":"ZH","Э":"E","ф":"f","ы":"i","в":"v","а":"a","п":"p","р":"r","о":"o","л":"l","д":"d","ж":"zh","э":"e","Я":"Ya","Ч":"CH","С":"S","М":"M","И":"I","Т":"T","Ь":"'","Б":"B","Ю":"YU","я":"ya","ч":"ch","с":"s","м":"m","и":"i","т":"t","ь":"'","б":"b","ю":"yu"};return t.split("").map((function(t){return e[t]||t})).join("")},this.make_key=function(t){return t?t=(t=(t=this.transliterate(t)).replace(/[^a-z0-9+]+/gi,"")).toLowerCase():t},this.get_feature_overlay_type=function(t){if(void 0===t.geometry.type)return!1;switch(t.geometry.type){case"Point":return t.properties.radius?"shape":"marker";case"LineString":case"MultiLineString":return"line";case"Polygon":return"shape"}return!1},this.setup_map=function(){Waymark=this,Waymark.jq_map_container=jQuery("#"+Waymark.config.map_options.map_div_id),Waymark.jq_map_container.addClass("waymark-map-container");const t=Waymark.config.map_options.map_height?Waymark.config.map_options.map_height+"px":"100%";Waymark.jq_map_container.css("height",t);var e={fullscreenControl:!1,attributionControl:!1,editable:!0,zoomControl:!1,sleep:!1};"view"==Waymark.mode?(e.dragging=!1,e.sleep=!0,e.wakeTime=1e3*Waymark.config.viewer_options.sleep_delay_seconds,"1"===Waymark.config.viewer_options.sleep_do_message?(e.sleepNote=!0,e.wakeMessage=Waymark.config.viewer_options.sleep_wake_message):(e.sleepNote=!1,e.wakeMessage=!1),e.sleepOpacity=1):e.dragging=!0,void 0!==Waymark.config.map_options&&void 0!==Waymark.config.map_options.map_max_zoom&&Waymark.config.map_options.map_max_zoom&&(e.maxZoom=Waymark.config.map_options.map_max_zoom,console.log("Max Zoom: "+e.maxZoom)),Waymark.map=Waymark_L.map(Waymark.config.map_options.map_div_id,e),Waymark_L.control.attribution({prefix:'Waymark'}).addTo(Waymark.map),1==Waymark.config.map_options.show_scale&&Waymark_L.control.scale().addTo(Waymark.map),Waymark.jq_map_container.data("Waymark",Waymark);let i=Waymark.config.map_options.map_init_latlng;void 0!==i&&i?Waymark.map.setView(i):i=!1;let n=Waymark.config.map_options.map_init_zoom;void 0!==n&&n?Waymark.map.setZoom(n):n=!1,i||n||Waymark.debug("No initial latlng or zoom set! 🌍"),Waymark_L.Path.mergeOptions({color:"#b42714"}),Waymark_L.control.zoom({position:"topleft",zoomInTitle:Waymark.config.language.action_zoom_in,zoomOutTitle:Waymark.config.language.action_zoom_out}).addTo(Waymark.map),Waymark_L.control.locate({position:"bottomright",icon:"ion ion-android-locate",drawCircle:!1,strings:{title:Waymark.config.language.action_locate_activate},locateOptions:{enableHighAccuracy:!0}}).addTo(Waymark.map),Waymark_L.control.fullscreen({position:"topleft",title:{false:Waymark.config.language.action_fullscreen_activate,true:Waymark.config.language.action_fullscreen_deactivate}}).addTo(Waymark.map),Waymark.marker_parent_group.addTo(Waymark.map),Waymark.line_parent_group.addTo(Waymark.map),Waymark.shape_parent_group.addTo(Waymark.map),Waymark.setup_layers(),Waymark.create_data_layer(),Waymark.create_buttons()},this.create_data_layer=function(){Waymark=this,Waymark.map_data=Waymark_L.geoJSON(null,{pointToLayer:function(t,e){return void 0!==t.properties&&t.properties.radius?new Waymark_L.Circle(e,parseFloat(t.properties.radius)):Waymark.create_marker(e)},onEachFeature:function(t,e){switch(t.geometry.type){case"Point":if(t.properties.radius){t.properties=Waymark.parse_layer_data("shape",t.properties);var i=Waymark.get_type("shape",t.properties.type);e.setStyle({color:i.shape_colour,fillOpacity:i.fill_opacity}),Waymark.info_window("shape",t,e),Waymark.tooltip("shape",t,e),Waymark.add_to_group("shape",e)}else{t.properties=Waymark.parse_layer_data("marker",t.properties);i=Waymark.get_type("marker",t.properties.type);e.setIcon(Waymark_L.divIcon(Waymark.build_icon_data(i))),void 0!==Waymark.gallery_images&&Waymark.add_to_gallery(e),Waymark.info_window("marker",t,e),Waymark.tooltip("marker",t,e),Waymark.add_to_group("marker",e)}break;case"LineString":case"MultiLineString":t.properties=Waymark.parse_layer_data("line",t.properties);i=Waymark.get_type("line",t.properties.type);e.setStyle({color:i.line_colour,weight:i.line_weight,opacity:i.line_opacity}),Waymark.info_window("line",t,e),Waymark.tooltip("line",t,e);var n=parseInt(i.line_display);Waymark.draw_line_direction(e,n),Waymark.add_to_group("line",e);break;case"Polygon":t.properties=Waymark.parse_layer_data("shape",t.properties),t.properties.rectangle;i=Waymark.get_type("shape",t.properties.type);e.setStyle({color:i.shape_colour,fillOpacity:i.fill_opacity}),Waymark.info_window("shape",t,e),Waymark.tooltip("shape",t,e),Waymark.add_to_group("shape",e)}}})},this.draw_line_direction=function(t,e=!0){var i=t.feature,n=i.properties.direction,o=Waymark.get_type("line",i.properties.type);if("object"==typeof t.direction_layer&&Waymark.map.removeLayer(t.direction_layer),"string"==typeof n&&("default"==n||"reverse"==n)){var a=45;"reverse"==n&&(a=360-a);var r=Waymark_L.polylineDecorator(t,{patterns:[{repeat:100,symbol:L.Symbol.arrowHead({pixelSize:15,headAngle:a,polygon:!0,pathOptions:{color:"#fff",fillColor:o.line_colour,opacity:"0.7",stroke:!0,fillOpacity:.7,weight:2}})}]});e&&r.addTo(Waymark.map),t.direction_layer=r}},this.setup_layers=function(){Waymark=this,Waymark.layer_control=Waymark_L.control.layers();var t=[],e=0;if(void 0!==Waymark.config.map_options.map_init_basemap&&Waymark.config.map_options.map_init_basemap)for(var i in Waymark.config.map_options.tile_layers){Waymark.config.map_options.map_init_basemap.toUpperCase()===Waymark.config.map_options.tile_layers[i].layer_name.toUpperCase()&&(e=i)}for(var i in Waymark.config.map_options.tile_layers){void 0!==Waymark.config.map_options.tile_layers[i].append&&(Waymark.config.map_options.tile_layers[i].layer_url+=Waymark.config.map_options.tile_layers[i].append);var n={id:Waymark.config.map_options.tile_layers[i].layer_name.replace(/ /g,""),attribution:Waymark.config.map_options.tile_layers[i].layer_attribution},o=parseInt(Waymark.config.map_options.tile_layers[i].layer_max_zoom);o&&(n.maxZoom=o);var a=Waymark_L.tileLayer(Waymark.config.map_options.tile_layers[i].layer_url,n);t[Waymark.config.map_options.tile_layers[i].layer_name]=a,i==e&&a.addTo(Waymark.map)}if(i>=1)for(basemap_name in Waymark.layer_control.addTo(Waymark.map),t)Waymark.layer_control.addBaseLayer(t[basemap_name],basemap_name)},this.get_type=function(t,e){Waymark=this;var i=null;for(var n in Waymark.config.map_options[t+"_types"]){0==n&&(i=Waymark.config.map_options[t+"_types"][n]);var o=Waymark.config.map_options[t+"_types"][n][t+"_title"];o&&Waymark.make_key(e)==Waymark.make_key(o)&&(i=Waymark.config.map_options[t+"_types"][n])}return i=Waymark.parse_type(i,t)},this.parse_type=function(t={},e="marker"){Waymark=this,null==t&&(t={});var i=Waymark.config[e+"_type_defaults"];return(t=Object.assign({},i,t)).type_key=Waymark.make_key(t[e+"_title"]),t},this.handle_resize=function(){Waymark=this,jQuery(window).on("resize",(function(){Waymark.config.map_options.map_height=Waymark.jq_map_container.height(),Waymark.config.map_options.map_width=Waymark.jq_map_container.width(),"function"==typeof Waymark.size_gallery&&Waymark.size_gallery()}))},this.tooltip=function(t,e,i){Waymark=this;var n="",o=Waymark.get_type(t,e.properties.type);o&&void 0!==o[t+"_title"]&&(n='['+o[t+"_title"]+"] ");e.properties.title&&(n+=e.properties.title),n&&(i.bindTooltip(n),i.on("mouseover",(function(t){var e=t.target.getTooltip();e.setLatLng(t.latlng),e.openTooltip()})),i.on("mousemove",(function(t){t.target.getTooltip().setLatLng(t.latlng)})))},this.get_data_defaults=function(t){return Object.assign({},Waymark.config[t+"_data_defaults"])},this.parse_layer_data=function(t,e){Waymark=this;var i=Waymark.get_data_defaults(t);if("object"==typeof e)for(key in i)void 0!==e[key]&&e[key]&&(i[key]=e[key]);for(key in e)if(e[key])switch(key){case"name":i.title=e[key];break;case"desc":case"notes":i.description=e[key];break;case"radius":i[key]=parseFloat(e[key])}return i},this.add_to_group=function(t,e){Waymark=this;var i=e.feature;if(void 0!==i.properties.type){var n=i.properties.type,o=Waymark.get_type(t,n);if(void 0===Waymark[t+"_sub_groups"][o.type_key]){var a=Waymark_L.featureGroup.subGroup(Waymark[t+"_parent_group"]);Waymark[t+"_sub_groups"][o.type_key]=a,"view"==Waymark.mode&&void 0!==o[t+"_display"]?"1"==o[t+"_display"]&&a.addTo(Waymark.map):a.addTo(Waymark.map)}if(e.addTo(Waymark[t+"_sub_groups"][o.type_key]),"line"==t&&"object"==typeof e.direction_layer&&e.direction_layer.addTo(Waymark[t+"_sub_groups"][o.type_key]),parseInt(Waymark.config.viewer_options.show_filter)&&"view"==Waymark.mode)for(key in Waymark.layer_control.addTo(Waymark.map),Waymark.layer_control.removeLayer(Waymark[t+"_parent_group"]),Waymark.layer_control.addOverlay(Waymark[t+"_parent_group"],""+Waymark.config.language["object_label_"+t+"_plural"]+""),Waymark_L.stamp(Waymark[t+"_parent_group"]),Waymark[t+"_sub_groups"]){var r=Waymark.get_type(t,key);a=Waymark[t+"_sub_groups"][key];Waymark.layer_control.removeLayer(a),Waymark.layer_control.addOverlay(a,Waymark.type_to_text(t,r))}}else e.addTo(Waymark[t+"_parent_group"])},this.type_to_text=function(t="",e={},i="span"){Waymark=this;var n="waymark-type-text waymark-"+t+"-type",o="";switch(t){case"marker":o+="color:"+e.icon_colour+";",o+="background:"+Waymark.get_marker_background(e.marker_colour);break;case"line":o+="background:"+e.line_colour;break;case"shape":o+="background:"+e.shape_colour}return"<"+i+' class="'+n+'" style="'+o+'">'+e[t+"_title"]+""},this.create_marker=function(t){return Waymark_L.marker(t)},this.build_icon_data=function(t={}){if(Waymark=this,"object"!=typeof t||void 0===t.type_key)return!1;var e={className:"waymark-marker waymark-marker-"+t.type_key};if(void 0!==t.marker_shape&&void 0!==t.marker_size){switch(e.className+=" waymark-marker-"+t.marker_shape,e.className+=" waymark-marker-"+t.marker_size,t.marker_shape){case"rectangle":case"circle":case"marker":switch(t.marker_size){case"small":e.iconSize=[16,16];break;case"medium":e.iconSize=[25,25];break;default:case"large":e.iconSize=[32,32]}}"marker"==t.marker_shape&&(e.iconAnchor=[e.iconSize[0]/2,1.25*e.iconSize[1]])}var i="background:"+Waymark.get_marker_background(t.marker_colour)+";",n="color:"+t.icon_colour+";";e.html='
',void 0===t.marker_icon&&Waymark.debug("No marker_icon for type: "+JSON.stringify(t),"alert");var o="waymark-marker-icon";switch(t.icon_type){case"text":o+=" waymark-icon-text",e.html+='
'+t.marker_icon+"
";break;case"html":o+=" waymark-icon-html";var a=jQuery("
").html(t.marker_icon).text();e.html+='
'+a+"
";break;case"icon":default:o+=" waymark-icon-icon",0===t.marker_icon.indexOf("ion-")?(o+=" ion ",o+=" "+t.marker_icon):0===t.marker_icon.indexOf("fa-")?(o+=" fa",o+=" "+t.marker_icon):(o+=" ion",o+=" ion-"+t.marker_icon),e.html+=''}return e},this.build_type_heading=function(t="marker",e="photo"){const i=Waymark.get_type(t,e);i||Waymark.message("Type not found: "+e,"error");let n=i.shape_colour;switch(t){case"marker":n=Waymark.get_marker_background(i.marker_colour);break;case"line":n=i.line_colour;break;case"shape":n=i.shape_colour}return i&&(heading=`\n\t\t\t\t
\n\t\t\t\t\t${Waymark.type_preview(t,i)}\n\t\t\t\t\t${Waymark.type_to_text(t,i)}\n\t\t\t\t
\n\t\t\t`),heading},this.type_preview=function(t="marker",e={},i="div"){let n=`<${i} class="waymark-type-preview waymark-${t}-type waymark-${t}-${e.type_key}">`;switch(t){case"marker":const i=Waymark.build_icon_data(e);n+=`
${i.html}
`;break;case"line":case"shape":n+=Waymark.type_to_text(t,e,"span")}return n+=``,n},this.get_marker_background=function(t){if(["red","darkred","orange","green","darkgreen","blue","purple","darkpurple","cadetblue","white","black"].includes(t))switch(t){case"red":return"#da3d20";case"darkred":return"#a43233";case"orange":return"#f9960a";case"green":return"#70af00";case"darkgreen":return"#72820d";case"blue":return"#2aabe1";case"purple":return"#d553bd";case"darkpurple":return"#5c3a6e";case"cadetblue":return"#416979";case"white":return"#fbfbfb";case"black":return"#303030"}return t},this.create_marker_json=function(t,e={}){var i=Object.assign({},Waymark.config.marker_data_defaults,e);return{geometry:{type:"Point",coordinates:[t.lng,t.lat]},type:"Feature",properties:i}},this.get_exif_latlng=function(t){return t.GPSLatitudeNum&&!isNaN(t.GPSLatitudeNum)&&t.GPSLongitudeNum&&!isNaN(t.GPSLongitudeNum)?(Waymark.debug(Waymark.config.language.info_exif_yes),L.latLng(t.GPSLatitudeNum,t.GPSLongitudeNum)):(Waymark.debug(Waymark.config.language.info_exif_no),!1)},this.get_image_sizes=function(t,e){Waymark=this;var i={};for(var n in Waymark.config.image_size_names)i["image_"+Waymark.config.image_size_names[n]+"_url"]=e,void 0!==t[Waymark.config.image_size_names[n]]&&void 0!==t[Waymark.config.image_size_names[n]].url&&(i["image_"+Waymark.config.image_size_names[n]+"_url"]=t[Waymark.config.image_size_names[n]].url);return i},this.build_overlay_content=function(t=[],e="",i=[]){Waymark=this;var n=`
`;const o=["type","title","description","image_large_url"];for(index in o){var a=o[index];switch(n+=`
`,a){case"type":n+=Waymark.type_to_text(e,i);break;case"title":n+=t.properties.title?t.properties.title:"Untitled "+i[e+"_title"]+" "+Waymark.title_case(e)+"";break;case"description":var r=t.properties.description;r&&(0===r.indexOf("<")?n+=r:n+=`

${r}

`);break;case"image_large_url":if(!t.properties.image_large_url)break;if(!t.properties.image_large_url.match(/^(https?:\/\/)/))break;if(t.properties.image_large_url){var s=t.properties.image_large_url;t.properties.image_medium_url&&(s=t.properties.image_medium_url),n+=``}}n+="
"}return n+="
"},this.load_done=function(){Waymark=this;let t=((new Date).getTime()-Waymark.start_time)/1e3;Waymark.debug("Waymark Loaded in "+t.toFixed(3)+" seconds"),"function"==typeof waymark_loaded_callback?(Waymark.debug("Global Callback detected! waymark_loaded_callback(waymark_instance)"),waymark_loaded_callback(Waymark)):Waymark.debug("No Global Callback detected.")},this.country_code_to_bounds=function(t=""){let e=[-140.99778,41.6751050889,-52.6480987209,83.23324];var i={AF:[60.5284298033,29.318572496,75.1580277851,38.4862816432],AO:[11.6400960629,-17.9306364885,24.0799052263,-4.43802336998],AL:[19.3044861183,39.624997667,21.0200403175,42.6882473822],AE:[51.5795186705,22.4969475367,56.3968473651,26.055464179],AR:[-73.4154357571,-55.25,-53.628348965,-21.8323104794],AM:[43.5827458026,38.7412014837,46.5057198423,41.2481285671],AQ:[-180,-90,180,-63.2706604895],TF:[68.72,-49.775,70.56,-48.625],AU:[113.338953078,-43.6345972634,153.569469029,-10.6681857235],AT:[9.47996951665,46.4318173285,16.9796667823,49.0390742051],AZ:[44.7939896991,38.2703775091,50.3928210793,41.8606751572],BI:[29.0249263852,-4.49998341229,30.752262811,-2.34848683025],BE:[2.51357303225,49.5294835476,6.15665815596,51.4750237087],BJ:[.772335646171,6.14215770103,3.79711225751,12.2356358912],BF:[-5.47056494793,9.61083486576,2.17710778159,15.1161577418],BD:[88.0844222351,20.670883287,92.6727209818,26.4465255803],BG:[22.3805257504,41.2344859889,28.5580814959,44.2349230007],BS:[-78.98,23.71,-77,27.04],BA:[15.7500260759,42.65,19.59976,45.2337767604],BY:[23.1994938494,51.3195034857,32.6936430193,56.1691299506],BZ:[-89.2291216703,15.8869375676,-88.1068129138,18.4999822047],BO:[-69.5904237535,-22.8729187965,-57.4983711412,-9.76198780685],BR:[-73.9872354804,-33.7683777809,-34.7299934555,5.24448639569],BN:[114.204016555,4.007636827,115.450710484,5.44772980389],BT:[88.8142484883,26.7194029811,92.1037117859,28.2964385035],BW:[19.8954577979,-26.8285429827,29.4321883481,-17.6618156877],CF:[14.4594071794,2.2676396753,27.3742261085,11.1423951278],CA:[-140.99778,41.6751050889,-52.6480987209,83.23324],CH:[6.02260949059,45.7769477403,10.4427014502,47.8308275417],CL:[-75.6443953112,-55.61183,-66.95992,-17.5800118954],CN:[73.6753792663,18.197700914,135.026311477,53.4588044297],CI:[-8.60288021487,4.33828847902,-2.56218950033,10.5240607772],CM:[8.48881554529,1.72767263428,16.0128524106,12.8593962671],CD:[12.1823368669,-13.2572266578,31.1741492042,5.25608775474],CG:[11.0937728207,-5.03798674888,18.4530652198,3.72819651938],CO:[-78.9909352282,-4.29818694419,-66.8763258531,12.4373031682],CR:[-85.94172543,8.22502798099,-82.5461962552,11.2171192489],CU:[-84.9749110583,19.8554808619,-74.1780248685,23.1886107447],CY:[32.2566671079,34.5718694118,34.0048808123,35.1731247015],CZ:[12.2401111182,48.5553052842,18.8531441586,51.1172677679],DE:[5.98865807458,47.3024876979,15.0169958839,54.983104153],DJ:[41.66176,10.9268785669,43.3178524107,12.6996385767],DK:[8.08997684086,54.8000145534,12.6900061378,57.730016588],DO:[-71.9451120673,17.598564358,-68.3179432848,19.8849105901],DZ:[-8.68439978681,19.0573642034,11.9995056495,37.1183806422],EC:[-80.9677654691,-4.95912851321,-75.2337227037,1.3809237736],EG:[24.70007,22,36.86623,31.58568],ER:[36.3231889178,12.4554157577,43.0812260272,17.9983074],ES:[-9.39288367353,35.946850084,3.03948408368,43.7483377142],EE:[23.3397953631,57.4745283067,28.1316992531,59.6110903998],ET:[32.95418,3.42206,47.78942,14.95943],FI:[20.6455928891,59.846373196,31.5160921567,70.1641930203],FJ:[-180,-18.28799,180,-16.0208822567],FK:[-61.2,-52.3,-57.75,-51.1],FR:[-54.5247541978,2.05338918702,9.56001631027,51.1485061713],GA:[8.79799563969,-3.97882659263,14.4254557634,2.32675751384],GB:[-7.57216793459,49.959999905,1.68153079591,58.6350001085],GE:[39.9550085793,41.0644446885,46.6379081561,43.553104153],GH:[-3.24437008301,4.71046214438,1.0601216976,11.0983409693],GN:[-15.1303112452,7.3090373804,-7.83210038902,12.5861829696],GM:[-16.8415246241,13.1302841252,-13.8449633448,13.8764918075],GW:[-16.6774519516,11.0404116887,-13.7004760401,12.6281700708],GQ:[9.3056132341,1.01011953369,11.285078973,2.28386607504],GR:[20.1500159034,34.9199876979,26.6041955909,41.8269046087],GL:[-73.297,60.03676,-12.20855,83.64513],GT:[-92.2292486234,13.7353376327,-88.2250227526,17.8193260767],GY:[-61.4103029039,1.26808828369,-56.5393857489,8.36703481692],HN:[-89.3533259753,12.9846857772,-83.147219001,16.0054057886],HR:[13.6569755388,42.47999136,19.3904757016,46.5037509222],HT:[-74.4580336168,18.0309927434,-71.6248732164,19.9156839055],HU:[16.2022982113,45.7594811061,22.710531447,48.6238540716],ID:[95.2930261576,-10.3599874813,141.03385176,5.47982086834],IN:[68.1766451354,7.96553477623,97.4025614766,35.4940095078],IE:[-9.97708574059,51.6693012559,-6.03298539878,55.1316222195],IR:[44.1092252948,25.0782370061,63.3166317076,39.7130026312],IQ:[38.7923405291,29.0990251735,48.5679712258,37.3852635768],IS:[-24.3261840479,63.4963829617,-13.609732225,66.5267923041],IL:[34.2654333839,29.5013261988,35.8363969256,33.2774264593],IT:[6.7499552751,36.619987291,18.4802470232,47.1153931748],JM:[-78.3377192858,17.7011162379,-76.1996585761,18.5242184514],JO:[34.9226025734,29.1974946152,39.1954683774,33.3786864284],JP:[129.408463169,31.0295791692,145.543137242,45.5514834662],KZ:[46.4664457538,40.6623245306,87.3599703308,55.3852501491],KE:[33.8935689697,-4.67677,41.8550830926,5.506],KG:[69.464886916,39.2794632025,80.2599902689,43.2983393418],KH:[102.3480994,10.4865436874,107.614547968,14.5705838078],KR:[126.117397903,34.3900458847,129.468304478,38.6122429469],KW:[46.5687134133,28.5260627304,48.4160941913,30.0590699326],LA:[100.115987583,13.88109101,107.564525181,22.4647531194],LB:[35.1260526873,33.0890400254,36.6117501157,34.6449140488],LR:[-11.4387794662,4.35575511313,-7.53971513511,8.54105520267],LY:[9.31941084152,19.58047,25.16482,33.1369957545],LK:[79.6951668639,5.96836985923,81.7879590189,9.82407766361],LS:[26.9992619158,-30.6451058896,29.3251664568,-28.6475017229],LT:[21.0558004086,53.9057022162,26.5882792498,56.3725283881],LU:[5.67405195478,49.4426671413,6.24275109216,50.1280516628],LV:[21.0558004086,55.61510692,28.1767094256,57.9701569688],MA:[-17.0204284327,21.4207341578,-1.12455115397,35.7599881048],MD:[26.6193367856,45.4882831895,30.0246586443,48.4671194525],MG:[43.2541870461,-25.6014344215,50.4765368996,-12.0405567359],MX:[-117.12776,14.5388286402,-86.811982388,32.72083],MK:[20.46315,40.8427269557,22.9523771502,42.3202595078],ML:[-12.1707502914,10.0963607854,4.27020999514,24.9745740829],MM:[92.3032344909,9.93295990645,101.180005324,28.335945136],ME:[18.45,41.87755,20.3398,43.52384],MN:[87.7512642761,41.5974095729,119.772823928,52.0473660345],MZ:[30.1794812355,-26.7421916643,40.7754752948,-10.3170960425],MR:[-17.0634232243,14.6168342147,-4.92333736817,27.3957441269],MW:[32.6881653175,-16.8012997372,35.7719047381,-9.23059905359],MY:[100.085756871,.773131415201,119.181903925,6.92805288332],NA:[11.7341988461,-29.045461928,25.0844433937,-16.9413428687],NC:[164.029605748,-22.3999760881,167.120011428,-20.1056458473],NE:[.295646396495,11.6601671412,15.9032466977,23.4716684026],NG:[2.69170169436,4.24059418377,14.5771777686,13.8659239771],NI:[-87.6684934151,10.7268390975,-83.147219001,15.0162671981],NL:[3.31497114423,50.803721015,7.09205325687,53.5104033474],NO:[4.99207807783,58.0788841824,31.29341841,80.6571442736],NP:[80.0884245137,26.3978980576,88.1748043151,30.4227169866],NZ:[166.509144322,-46.641235447,178.517093541,-34.4506617165],OM:[52.0000098,16.6510511337,59.8080603372,26.3959343531],PK:[60.8742484882,23.6919650335,77.8374507995,37.1330309108],PA:[-82.9657830472,7.2205414901,-77.2425664944,9.61161001224],PE:[-81.4109425524,-18.3479753557,-68.6650797187,-.0572054988649],PH:[117.17427453,5.58100332277,126.537423944,18.5052273625],PG:[141.000210403,-10.6524760881,156.019965448,-2.50000212973],PL:[14.0745211117,49.0273953314,24.0299857927,54.8515359564],PR:[-67.2424275377,17.946553453,-65.5910037909,18.5206011011],KP:[124.265624628,37.669070543,130.780007359,42.9853868678],PT:[-9.52657060387,36.838268541,-6.3890876937,42.280468655],PY:[-62.6850571357,-27.5484990374,-54.2929595608,-19.3427466773],QA:[50.7439107603,24.5563308782,51.6067004738,26.1145820175],RO:[20.2201924985,43.6884447292,29.62654341,48.2208812526],RU:[-180,41.151416124,180,81.2504],RW:[29.0249263852,-2.91785776125,30.8161348813,-1.13465911215],SA:[34.6323360532,16.3478913436,55.6666593769,32.161008816],SD:[21.93681,8.61972971293,38.4100899595,22],SS:[23.8869795809,3.50917,35.2980071182,12.2480077571],SN:[-17.6250426905,12.332089952,-11.4678991358,16.5982636581],SB:[156.491357864,-10.8263672828,162.398645868,-6.59933847415],SL:[-13.2465502588,6.78591685631,-10.2300935531,10.0469839543],SV:[-90.0955545723,13.1490168319,-87.7235029772,14.4241327987],SO:[40.98105,-1.68325,51.13387,12.02464],RS:[18.82982,42.2452243971,22.9860185076,46.1717298447],SR:[-58.0446943834,1.81766714112,-53.9580446031,6.0252914494],SK:[16.8799829444,47.7584288601,22.5581376482,49.5715740017],SI:[13.6981099789,45.4523163926,16.5648083839,46.8523859727],SE:[11.0273686052,55.3617373725,23.9033785336,69.1062472602],SZ:[30.6766085141,-27.2858794085,32.0716654803,-25.660190525],SY:[35.7007979673,32.312937527,42.3495910988,37.2298725449],TD:[13.5403935076,7.42192454674,23.88689,23.40972],TG:[-.0497847151599,5.92883738853,1.86524051271,11.0186817489],TH:[97.3758964376,5.69138418215,105.589038527,20.4178496363],TJ:[67.4422196796,36.7381712916,74.9800024759,40.9602133245],TM:[52.5024597512,35.2706639674,66.5461503437,42.7515510117],TL:[124.968682489,-9.39317310958,127.335928176,-8.27334482181],TT:[-61.95,10,-60.895,10.89],TN:[7.52448164229,30.3075560572,11.4887874691,37.3499944118],TR:[26.0433512713,35.8215347357,44.7939896991,42.1414848903],TW:[120.106188593,21.9705713974,121.951243931,25.2954588893],TZ:[29.3399975929,-11.7209380022,40.31659,-.95],UG:[29.5794661801,-1.44332244223,35.03599,4.24988494736],UA:[22.0856083513,44.3614785833,40.0807890155,52.3350745713],UY:[-58.4270741441,-34.9526465797,-53.209588996,-30.1096863746],US:[-171.791110603,18.91619,-66.96466,71.3577635769],UZ:[55.9289172707,37.1449940049,73.055417108,45.5868043076],VE:[-73.3049515449,.724452215982,-59.7582848782,12.1623070337],VN:[102.170435826,8.59975962975,109.33526981,23.3520633001],VU:[166.629136998,-16.5978496233,167.844876744,-14.6264970842],PS:[34.9274084816,31.3534353704,35.5456653175,32.5325106878],YE:[42.6048726743,12.5859504257,53.1085726255,19.0000033635],ZA:[16.3449768409,-34.8191663551,32.830120477,-22.0913127581],ZM:[21.887842645,-17.9612289364,33.4856876971,-8.23825652429],ZW:[25.2642257016,-22.2716118303,32.8498608742,-15.5077869605]};if(i[t])e=i[t];else{var n=Object.keys(i);e=i[n[Math.floor(Math.random()*n.length)]]}return Waymark_L.latLngBounds([e[1],e[0]],[e[3],e[2]])},this.pre_map_setup=function(){},this.init_done=function(){},this.info_window=function(t,e,i){},this.build_content=function(t,e){}}function Waymark_Map_Viewer(){this.gallery_images=[],this.pre_map_setup=function(){Waymark=this,Waymark.mode="view"},this.init_done=function(){Waymark=this,Waymark.jq_map_container.show(),Waymark.map.invalidateSize(),Waymark.config.map_options.map_width=Waymark.jq_map_container.width(),Waymark.setup_gallery(),Waymark.setup_elevation(),Waymark.setupCluster(),jQuery(Waymark.map.getContainer()).addClass("waymark-is-viewer"),Waymark.setup_hidden_checker()},this.setupCluster=()=>{parseInt(Waymark.config.viewer_options.show_cluster)&&(Waymark.jq_map_container.addClass("waymark-has-cluster"),Waymark.map._layersMaxZoom=18,Waymark.marker_cluster=L.markerClusterGroup({animate:!1,showCoverageOnHover:!1,removeOutsideVisibleBounds:!0,iconCreateFunction:this.clusterIconFunction,spiderfyOnMaxZoom:!1,disableClusteringAtZoom:Waymark.config.viewer_options.cluster_threshold,maxClusterRadius:Waymark.config.viewer_options.cluster_radius}),Waymark.marker_parent_group=Waymark.marker_cluster,Waymark.map.addLayer(Waymark.marker_cluster))},this.clusterIconFunction=t=>{const e=new Map([]);t.getAllChildMarkers().forEach(t=>{const i=t.feature.properties.type,n=Waymark.get_type("marker",i);e.has(i)?n.typeCount=e.get(i).typeCount+1:n.typeCount=1,n.iconData=Waymark.build_icon_data(n),e.set(i,n)});let i="",n=0,o=0,a=0;return[...e.entries()].sort((t,e)=>e[1].typeCount-t[1].typeCount).forEach(([t,r])=>{const s=r.typeCount,l=r.iconData,h=e.size-n;o=l.iconSize[0]>o?l.iconSize[0]:o,a=l.iconSize[0]>a?l.iconSize[0]:a,s>1&&(l.html+=`
${s}
`);const u=8*n;i+=`\n\t\t\t\t
\n\t\t\t\t\t${l.html}\t\t\t\t\t\n\t\t\t\t
\n\t\t\t`,n++}),L.divIcon({className:"waymark-cluster",html:i,iconSize:[o,a]})},this.setup_hidden_checker=function(){let t=setInterval((function(){is_hidden=Waymark.jq_map_container.is(":hidden"),is_hidden||(Waymark.reset_map_view(),clearInterval(t))}),100)},this.create_buttons=function(){},this.load_json=function(t,e=!0){Waymark=this,"object"==typeof t&&void 0!==t.features&&(Waymark.map_data.addData(t),e&&Waymark.reset_map_view())},this.reset_map_view=function(){Waymark=this;let t=Waymark.config.map_options.map_init_latlng,e=Waymark.config.map_options.map_init_zoom;if(void 0===t&&(t=!1),void 0===e&&(e=!1),t||e)t&&e?Waymark.map.setView(t,e):(t&&(Waymark.map.setView(t),Waymark.map.setZoom(Waymark.map.getBoundsZoom(Waymark.map_data.getBounds()))),e&&(Waymark.map.setZoom(e),Waymark.map.setView(Waymark.map_data.getBounds().getCenter())));else{var i=Waymark.map_data.getBounds();"object"==typeof i&&i.isValid()&&(Waymark.map.invalidateSize(),Waymark.map.fitBounds(i))}},this.build_content=function(t,e){Waymark=this;var i=jQuery("
"),n=jQuery("