Plugin Directory

Changeset 3081562

Timestamp:
05/05/2024 05:31:54 PM (2 months ago)
Author:
morehawes
Message:

v1.1.5 release

Location:
waymark
Files:
104 added
14 edited

Legend:

Unmodified
Added
Removed
  • waymark/trunk/Waymark.php

    r3043696 r3081562  
    55Plugin URI: https://www.waymark.dev/
    66Description: Mapping with WordPress made easy. With Waymark enabled, click on the "Maps" link in the sidebar to create and edit Maps. Once you are happy with your Map, copy the Waymark shortcode and add it to your content.
    7 Version: 1.1.4
     7Version: 1.1.
    88Text Domain: waymark
    99Author: Joe Hawes
  • waymark/trunk/inc/Waymark_Config.php

    r3043696 r3081562  
    1212            'plugin_name_short' => 'Waymark',
    1313            'custom_types' => array(),
    14             'plugin_version' => '1.1.4',
     14            'plugin_version' => '1.1.',
    1515            'nonce_string' => 'Waymark_Nonce',
    1616            'site_url' => 'https://www.waymark.dev/',
  • waymark/trunk/languages/waymark-en_CA.po

    r3043696 r3081562  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Waymark 1.1.4\n"
     5"Project-Id-Version: Waymark 1.1.\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/waymark\n"
    77"POT-Creation-Date: 2024-01-18 00:24:31+00:00\n"
  • waymark/trunk/languages/waymark-en_GB.po

    r3043696 r3081562  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Waymark 1.1.4\n"
     5"Project-Id-Version: Waymark 1.1.\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/waymark\n"
    77"POT-Creation-Date: 2024-01-18 00:24:31+00:00\n"
  • waymark/trunk/languages/waymark-es_ES.po

    r3043696 r3081562  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Waymark 1.1.4\n"
     5"Project-Id-Version: Waymark 1.1.\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/waymark\n"
    77"POT-Creation-Date: 2024-01-18 00:24:31+00:00\n"
  • waymark/trunk/languages/waymark-fr_CA.po

    r3043696 r3081562  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Waymark 1.1.4\n"
     5"Project-Id-Version: Waymark 1.1.\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/waymark\n"
    77"POT-Creation-Date: 2024-01-18 00:24:31+00:00\n"
  • waymark/trunk/languages/waymark-ja_JP.po

    r3043696 r3081562  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Waymark 1.1.4\n"
     5"Project-Id-Version: Waymark 1.1.\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/waymark\n"
    77"POT-Creation-Date: 2024-01-23 14:32:30+00:00\n"
  • waymark/trunk/languages/waymark-sv_SE.po

    r3043696 r3081562  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Waymark 1.1.4\n"
     5"Project-Id-Version: Waymark 1.1.\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/waymark\n"
    77"POT-Creation-Date: 2024-01-18 00:24:31+00:00\n"
  • waymark/trunk/languages/waymark-uk_UA.po

    r3043696 r3081562  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Waymark 1.1.4\n"
     5"Project-Id-Version: Waymark 1.1.\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/waymark\n"
    77"POT-Creation-Date: 2024-01-18 00:24:31+00:00\n"
  • waymark/trunk/languages/waymark-zh_CN.po

    r3043696 r3081562  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Waymark 1.1.4\n"
     5"Project-Id-Version: Waymark 1.1.\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/waymark\n"
    77"POT-Creation-Date: 2024-01-23 14:32:30+00:00\n"
  • waymark/trunk/languages/waymark.pot

    r3043696 r3081562  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Waymark 1.1.4\n"
     5"Project-Id-Version: Waymark 1.1.\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/waymark\n"
    77"POT-Creation-Date: 2024-02-22 21:00:18+00:00\n"
  • waymark/trunk/readme.txt

    r3043696 r3081562  
    1 === Waymark - Create an Interactive Map, or entire GIS. Embed OpenStreetMap, OSM, MapBox & Google Maps with Leaflet | Import + Export GPX, KML & GeoJSON | Elevation, EXIF & Geo Location ===
     1=== Waymark ===
    22Contributors: morehawes
    3 Tags: GIS, Map maker, Maps, Leaflet, GPX, KML, GeoJSON, OpenStreetMap, EXIF, Map markers
     3Tags: GIS, Map maker,
    44Requires at least: 4.6
    55Tested up to: 6.4
    66Requires PHP: 5.2
    7 Stable tag: 1.1.4
     7Stable tag: 1.1.
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
    1010
    11 Waymark adds powerful mapping features to WordPress that are easy to use. Create beautiful, interactive Maps that you can customise to suit your needs.
     11Waymark adds powerful mapping features to WordPress that are easy to use. Create beautiful, interactive Maps to suit your needs.
    1212
    1313== Description ==
    1414
    15 🗺 [Demo](https://www.ogis.app/yosemite/)
     15🗺 [Demo](https://www./)
    1616🛠️ [Try](https://www.waymark.dev/try/)
    1717📼 [Watch](https://www.waymark.dev/#footer)
     
    171171== Changelog ==
    172172
     173
     174
     175
     176
    173177= 1.1.4 =
    174178
    175179- Map height bug fix.
    176180
    177 = 1.1.4 =
     181= 1.1. =
    178182
    179183- Submission File Upload bug fix.
  • waymark/trunk/waymark-js/dist/js/waymark-js.js

    r3040294 r3081562  
    78357835    };
    78367836
    7837     this.make_key = function (str) {
    7838         if (!str) {
    7839             return str;
     7837    this.make_key = function (str) {
     7838        if (!str) {
     7839            return str;
    78407840        }
    78417841
    78427842        //No cyrillic
    7843         str = this.transliterate(str);
     7843        str);
    78447844
    78457845        //No underscores
    7846         str = str.replace(/[^a-z0-9+]+/gi, "");
     7846        str.replace(/[^a-z0-9+]+/gi, "");
    78477847
    78487848        //Lower
    7849         str = str.toLowerCase();
    7850 
    7851         return str;
     7849        str_out = str_out.toLowerCase();
     7850
     7851        // Check for empty str_out
     7852        if (!str_out) {
     7853            // Convert to hex
     7854            str_out = str_in
     7855                .split("")
     7856                .map(function (char) {
     7857                    return char.charCodeAt(0).toString(16);
     7858                })
     7859                .join("");
     7860        }
     7861
     7862        return str_out;
    78527863    };
    78537864
  • waymark/trunk/waymark-js/dist/js/waymark-js.min.js

    r3040294 r3081562  
    77 * Copyright (c) 2018 Per Liedman
    88 * All rights reserved.
    9  */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={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};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;s<r.length;s++)n.push(a+"="+encodeURIComponent(r[s]));else n.push(a+"="+encodeURIComponent(r))}return(e&&-1!==e.indexOf("?")?"&":"?")+n.join("&")}var u=Waymark_L.Class.extend({options:{service_url:"https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer"},initialize:function(t,e){Waymark_L.setOptions(this,e),this._accessToken=t},geocode:function(t,e,i){var n={SingleLine:t,outFields:"Addr_Type",forStorage:!1,maxLocations:10,f:"json"};this._key&&this._key.length&&(n.token=this._key),s(this.options.service_url+"/findAddressCandidates",Waymark_L.extend(n,this.options.geocodingQueryParams),(function(t){var n,o,a,r=[];if(t.candidates&&t.candidates.length)for(var s=0;s<=t.candidates.length-1;s++)n=t.candidates[s],o=Waymark_L.latLng(n.location.y,n.location.x),a=Waymark_L.latLngBounds(Waymark_L.latLng(n.extent.ymax,n.extent.xmax),Waymark_L.latLng(n.extent.ymin,n.extent.xmin)),r[s]={name:n.address,bbox:a,center:o};e.call(i,r)}))},suggest:function(t,e,i){return this.geocode(t,e,i)},reverse:function(t,e,i,n){var o={location:encodeURIComponent(t.lng)+","+encodeURIComponent(t.lat),distance:100,f:"json"};s(this.options.service_url+"/reverseGeocode",o,(function(t){var e,o=[];t&&!t.error&&(e=Waymark_L.latLng(t.location.y,t.location.x),o.push({name:t.address.Match_addr,center:e,bounds:Waymark_L.latLngBounds(e,e)})),i.call(n,o)}))}});var d=Waymark_L.Class.extend({initialize:function(t){this.key=t},geocode:function(t,e,i){r("https://dev.virtualearth.net/REST/v1/Locations",{query:t,key:this.key},(function(t){var n=[];if(t.resourceSets.length>0)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:"<insert your app_id here>",app_code:"<insert your app_code here>",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<arguments.length;t++)arguments[t]&&e.push(arguments[t]);return e.join(", ")},geocode:function(t,e,i){s(this.options.serviceUrl+"/address",{key:this._key,location:t,limit:5,outFormat:"json"},Waymark_L.bind((function(t){var n,o,a=[];if(t.results&&t.results[0].locations)for(var r=t.results[0].locations.length-1;r>=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:"<insert your userId here>",apiKey:"<insert your apiKey here>",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('<span class="'+(i.length>0?"leaflet-control-geocoder-address-detail":"")+'">{postcode} {city} {town} {village} {hamlet}</span>'),(e.state||e.country)&&i.push('<span class="'+(i.length>0?"leaflet-control-geocoder-address-context":"")+'">{state} {country}</span>'),l(i.join("<br/>"),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;s<t.results.length;s++)a=t.results[s],n=Waymark_L.latLng(a.geometry),o=a.annotations&&a.annotations.bounds?Waymark_L.latLngBounds(Waymark_L.latLng(a.annotations.bounds.northeast),Waymark_L.latLng(a.annotations.bounds.southwest)):Waymark_L.latLngBounds(n,n),r.push({name:a.formatted,bbox:o,center:n});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,{key:this._accessToken,q:[t.lat,t.lng].join(",")},(function(t){var e,o,a,r=[];if(t.results&&t.results.length)for(var s=0;s<t.results.length;s++)a=t.results[s],e=Waymark_L.latLng(a.geometry),o=a.annotations&&a.annotations.bounds?Waymark_L.latLngBounds(Waymark_L.latLng(a.annotations.bounds.northeast),Waymark_L.latLng(a.annotations.bounds.southwest)):Waymark_L.latLngBounds(e,e),r.push({name:a.formatted,bbox:o,center:e});i.call(n,r)}))}});var L=Waymark_L.Class.extend({options:{serviceUrl:"https://api.geocode.earth/v1",geocodingQueryParams:{},reverseQueryParams:{}},initialize:function(t,e){Waymark_L.Util.setOptions(this,e),this._apiKey=t,this._lastSuggest=0},geocode:function(t,e,i){var n=this;s(this.options.serviceUrl+"/search",Waymark_L.extend({api_key:this._apiKey,text:t},this.options.geocodingQueryParams),(function(t){e.call(i,n._parseResults(t,"bbox"))}))},suggest:function(t,e,i){var n=this;s(this.options.serviceUrl+"/autocomplete",Waymark_L.extend({api_key:this._apiKey,text:t},this.options.geocodingQueryParams),Waymark_L.bind((function(t){t.geocoding.timestamp>this._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;e<t.features.length;e++)n=(i=t.features[e]).geometry.coordinates,o=Waymark_L.latLng(n[1],n[0]),r=(a=i.properties.extent)?Waymark_L.latLngBounds([a[1],a[0]],[a[3],a[2]]):Waymark_L.latLngBounds(o,o),s.push({name:this._decodeFeatureName(i),html:this.options.htmlTemplate?this.options.htmlTemplate(i):void 0,center:o,bbox:r,properties:i.properties});return s},_decodeFeatureName:function(t){return(this.options.nameProperties||[]).map((function(e){return t.properties[e]})).filter((function(t){return!!t})).join(", ")}});var E=Waymark_L.Class.extend({options:{serviceUrl:"https://api.what3words.com/v2/"},initialize:function(t){this._accessToken=t},geocode:function(t,e,i){s(this.options.serviceUrl+"forward",{key:this._accessToken,addr:t.split(/\s+/).join(".")},(function(t){var n,o,a=[];t.geometry&&(n=Waymark_L.latLng(t.geometry.lat,t.geometry.lng),o=Waymark_L.latLngBounds(n,n),a[0]={name:t.words,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+"reverse",{key:this._accessToken,coords:[t.lat,t.lng].join(",")},(function(t){var e,o,a=[];200==t.status.status&&(e=Waymark_L.latLng(t.geometry.lat,t.geometry.lng),o=Waymark_L.latLngBounds(e,e),a[0]={name:t.words,bbox:o,center:e}),i.call(n,a)}))}});var T=Object.freeze({ArcGis:u,arcgis:function(t,e){return new u(t,e)},Bing:d,bing:function(t){return new d(t)},Google:c,google:function(t,e){return new c(t,e)},HERE:_,here:function(t){return new _(t)},LatLng:p,latLng:function(t){return new p(t)},Mapbox:m,mapbox:function(t,e){return new m(t,e)},MapQuest:f,mapQuest:function(t,e){return new f(t,e)},Neutrino:g,neutrino:function(t){return new g(t)},Nominatim:y,nominatim:function(t){return new y(t)},OpenLocationCode:v,openLocationCode:function(t){return new v(t)},OpenCage:k,opencage:function(t){return new k(t)},Pelias:L,pelias:w,GeocodeEarth:b,geocodeEarth:x,Mapzen:W,mapzen:C,Openrouteservice:M,openrouteservice:function(t,e){return new M(t,e)},Photon:P,photon:function(t){return new P(t)},What3Words:E,what3words:function(t){return new E(t)}}),S=Waymark_L.Control.extend({options:{showUniqueResult:!0,showResultIcons:!1,collapsed:!0,expand:"touch",position:"topright",placeholder:"Search...",errorMessage:"Nothing found.",queryMinLength:1,suggestMinLength:3,suggestTimeout:250,defaultMarkGeocode:!0},includes:Waymark_L.Evented.prototype||Waymark_L.Mixin.Events,initialize:function(t){Waymark_L.Util.setOptions(this,t),this.options.geocoder||(this.options.geocoder=new y),this._requestCount=0},addThrobberClass:function(){Waymark_L.DomUtil.addClass(this._container,"leaflet-control-geocoder-throbber")},removeThrobberClass:function(){Waymark_L.DomUtil.removeClass(this._container,"leaflet-control-geocoder-throbber")},onAdd:function(t){var e,i="leaflet-control-geocoder",n=Waymark_L.DomUtil.create("div",i+" leaflet-bar"),o=Waymark_L.DomUtil.create("button",i+"-icon",n),a=this._form=Waymark_L.DomUtil.create("div",i+"-form",n);return this._map=t,this._container=n,o.innerHTML="&nbsp;",o.type="button",(e=this._input=Waymark_L.DomUtil.create("input","",a)).type="text",e.placeholder=this.options.placeholder,Waymark_L.DomEvent.disableClickPropagation(e),this._errorElement=Waymark_L.DomUtil.create("div",i+"-form-no-error",n),this._errorElement.innerHTML=this.options.errorMessage,this._alts=Waymark_L.DomUtil.create("ul",i+"-alternatives leaflet-control-geocoder-alternatives-minimized",n),Waymark_L.DomEvent.disableClickPropagation(this._alts),Waymark_L.DomEvent.addListener(e,"keydown",this._keydown,this),this.options.geocoder.suggest&&Waymark_L.DomEvent.addListener(e,"input",this._change,this),Waymark_L.DomEvent.addListener(e,"blur",(function(){this.options.collapsed&&!this._preventBlurCollapse&&this._collapse(),this._preventBlurCollapse=!1}),this),this.options.collapsed?"click"===this.options.expand?Waymark_L.DomEvent.addListener(n,"click",(function(t){0===t.button&&2!==t.detail&&this._toggle()}),this):Waymark_L.Browser.touch&&"touch"===this.options.expand?Waymark_L.DomEvent.addListener(n,"touchstart mousedown",(function(t){this._toggle(),t.preventDefault(),t.stopPropagation()}),this):(Waymark_L.DomEvent.addListener(n,"mouseover",this._expand,this),Waymark_L.DomEvent.addListener(n,"mouseout",this._collapse,this),this._map.on("movestart",this._collapse,this)):(this._expand(),Waymark_L.Browser.touch?Waymark_L.DomEvent.addListener(n,"touchstart",(function(){this._geocode()}),this):Waymark_L.DomEvent.addListener(n,"click",(function(){this._geocode()}),this)),this.options.defaultMarkGeocode&&this.on("markgeocode",this.markGeocode,this),this.on("startgeocode",this.addThrobberClass,this),this.on("finishgeocode",this.removeThrobberClass,this),this.on("startsuggest",this.addThrobberClass,this),this.on("finishsuggest",this.removeThrobberClass,this),Waymark_L.DomEvent.disableClickPropagation(n),n},_geocodeResult:function(t,e){if(!e&&this.options.showUniqueResult&&1===t.length)this._geocodeResultSelected(t[0]);else if(t.length>0){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;i<t.length;i++)this._alts.appendChild(this._createAlt(t[i],i))}else Waymark_L.DomUtil.addClass(this._container,"leaflet-control-geocoder-options-error"),Waymark_L.DomUtil.addClass(this._errorElement,"leaflet-control-geocoder-error")},markGeocode:function(t){return t=t.geocode||t,this._map.fitBounds(t.bbox),this._geocodeMarker&&this._map.removeLayer(this._geocodeMarker),this._geocodeMarker=new Waymark_L.Marker(t.center).bindPopup(t.html||t.name).addTo(this._map).openPopup(),this},_geocode:function(t){var e=this._input.value;if(t||!(e.length<this.options.queryMinLength)){var i=++this._requestCount,n=t?"suggest":"geocode",o={input:e};this._lastGeocode=e,t||this._clearResults(),this.fire("start"+n,o),this.options.geocoder[n](e,(function(e){i===this._requestCount&&(o.results=e,this.fire("finish"+n,o),this._geocodeResult(e,t))}),this)}},_geocodeResultSelected:function(t){this.fire("markgeocode",{geocode:t})},_toggle:function(){Waymark_L.DomUtil.hasClass(this._container,"leaflet-control-geocoder-expanded")?this._collapse():this._expand()},_expand:function(){Waymark_L.DomUtil.addClass(this._container,"leaflet-control-geocoder-expanded"),this._input.select(),this.fire("expand")},_collapse:function(){Waymark_L.DomUtil.removeClass(this._container,"leaflet-control-geocoder-expanded"),Waymark_L.DomUtil.addClass(this._alts,"leaflet-control-geocoder-alternatives-minimized"),Waymark_L.DomUtil.removeClass(this._errorElement,"leaflet-control-geocoder-error"),Waymark_L.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-open"),Waymark_L.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-error"),this._input.blur(),this.fire("collapse")},_clearResults:function(){Waymark_L.DomUtil.addClass(this._alts,"leaflet-control-geocoder-alternatives-minimized"),this._selection=null,Waymark_L.DomUtil.removeClass(this._errorElement,"leaflet-control-geocoder-error"),Waymark_L.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-open"),Waymark_L.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-error")},_createAlt:function(t,e){var i=Waymark_L.DomUtil.create("li",""),n=Waymark_L.DomUtil.create("a","",i),o=this.options.showResultIcons&&t.icon?Waymark_L.DomUtil.create("img","",n):null,a=t.html?void 0:document.createTextNode(t.name);return o&&(o.src=t.icon),i.setAttribute("data-result-index",e),t.html?n.innerHTML=n.innerHTML+t.html:n.appendChild(a),Waymark_L.DomEvent.addListener(i,"mousedown touchstart",(function(e){this._preventBlurCollapse=!0,Waymark_L.DomEvent.stop(e),this._geocodeResultSelected(t),Waymark_L.DomEvent.on(i,"click",(function(){this.options.collapsed?this._collapse():this._clearResults()}),this)}),this),i},_keydown:function(t){var e=this,i=function(t){e._selection&&(Waymark_L.DomUtil.removeClass(e._selection,"leaflet-control-geocoder-selected"),e._selection=e._selection[t>0?"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:'<svg xmlns="http://www.w3.org/2000/svg" width="'+o+'" height="'+o+'" version="1.1" viewBox="-'+n+" -"+n+" "+o+" "+o+'"><circle r="'+i+'" style="'+e+'" /></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:'<svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+o+'" version="1.1" viewBox="-'+n/2+" 0 "+n+" "+o+'" style="transform: rotate('+this._heading+'deg)"><path d="'+a+'" style="'+e+'" /></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:'<i class="elevation-waypoint-icon"></i>',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:'<i class="elevation-position-icon"></i>',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("<b>"+o+"</b>"+(n.length>0?"<br>"+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=o<i?i:o,a=a>i?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.yAxisMin<e[0]||i.forceAxisBounds)&&(e[0]=i.yAxisMin),void 0!==i.yAxisMax&&(i.yAxisMax>e[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);o<i&&(i=o,e=n)}),e},_findItemForX:function(t){let e=this._data?this._data:[0,1];return(0,d3.bisector(t=>t.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<this._zFollow?this._zFollow:e,this._map.setView(t.latlng,e,{animate:!0,duration:.25})},_showPositionMarker:function(t){this._selectedItem=t,this._map&&!this._map.getPane("elevationPane")&&(this._map.createPane("elevationPane"),this._map.getPane("elevationPane").style.zIndex=625,this._map.getPane("elevationPane").style.pointerEvents="none"),"elevation-line"==this.options.marker?this._updatePositionMarker(t):"position-marker"==this.options.marker&&this._updateLeafletMarker(t)},_updateAxis:function(){this._grid.selectAll("g").remove(),this._axis.selectAll("g").remove(),this._appendXGrid(this._grid),this._appendYGrid(this._grid),this._appendXaxis(this._axis),this._appendYaxis(this._axis)},_updateHeightIndicator:function(t){let e=this.options,i=e.hoverNumber.formatter(t.z,e.hoverNumber.decimalsY),n=(e.hoverNumber.formatter(t.dist,e.hoverNumber.decimalsX),this._height()/this._maxElevation*t.z),o=t.y-n;this._mouseHeightFocus.attr("x1",t.x).attr("x2",t.x).attr("y1",t.y).attr("y2",o).style("visibility","visible"),this._mouseHeightFocusLabel.attr("x",t.x).attr("y",o).text(i+" "+this._yLabel).style("visibility","visible")},_updateLeafletMarker:function(t){let e=t.latlng;this._marker?this._marker.setLatLng(e):(this._marker=new L.Marker(e,{icon:this.options.markerIcon,zIndexOffset:1e6}),this._marker.addTo(this._map,{pane:"elevationPane"}))},_updatePointG:function(t){this._pointG.attr("transform","translate("+t.x+","+t.y+")").style("visibility","visible")},_updatePositionMarker:function(t){let e=this._map.latLngToLayerPoint(t.latlng),i={dist:t.dist,x:e.x,y:e.y,z:t.z};if(!this._mouseHeightFocus){L.svg({pane:"elevationPane"}).addTo(this._map);let t=d3.select(this._map.getContainer()).select(".leaflet-elevation-pane svg");this._appendPositionMarker(t)}this._updatePointG(i),this._updateHeightIndicator(i)},_updateSummary:function(){this.summaryDiv.innerHTML="",this.track_info=this.track_info||{},this.track_info.distance=this._distance||0,this.track_info.elevation_max=this._maxElevation||0,this.track_info.elevation_min=this._minElevation||0,this.track_info.ascent=this._ascent||0,this.track_info.descent=this._descent||0,this.options.summary&&(this.summaryDiv.innerHTML+='<span class="totlen"><span class="summarylabel">'+L._("Total Length: ")+'</span><span class="summaryvalue">'+this.track_info.distance.toFixed(2)+" "+this._xLabel+'</span></span><span class="maxele"><span class="summarylabel">'+L._("Max Elevation: ")+'</span><span class="summaryvalue">'+this.track_info.elevation_max.toFixed(2)+" "+this._yLabel+'</span></span><span class="minele"><span class="summarylabel">'+L._("Min Elevation: ")+'</span><span class="summaryvalue">'+this.track_info.elevation_min.toFixed(2)+" "+this._yLabel+'</span></span><span class="totasc"><span class="summarylabel">'+L._("Total Ascent: ")+'</span><span class="summaryvalue">'+this.track_info.ascent.toFixed(0)+" "+this._yLabel+'</span></span><span class="totdesc"><span class="summarylabel">'+L._("Total Descent: ")+'</span><span class="summaryvalue">'+this.track_info.descent.toFixed(0)+" "+this._yLabel+"</span></span>"),this.options.downloadLink&&this._downloadURL&&(this.summaryDiv.innerHTML+='<span class="download"><a href="#">'+L._("Download")+"</a></span>",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<t.length;e++)this.initVertexMarkers(t[e])},getLatLngs:function(){return this.feature.getLatLngs()},reset:function(){this.editLayer.clearLayers(),this.initVertexMarkers()},addVertexMarker:function(t,e){return new this.tools.options.vertexMarkerClass(t,e,this)},onNewVertex:function(t){this.fireAndForward("editable:vertex:new",{latlng:t.latlng,vertex:t})},addVertexMarkers:function(t){for(var e=0;e<t.length;e++)this.addVertexMarker(t[e],t)},refreshVertexMarkers:function(t){t=t||this.getDefaultLatLngs();for(var e=0;e<t.length;e++)t[e].__vertex.update()},addMiddleMarker:function(t,e,i){return new this.tools.options.middleMarkerClass(t,e,i,this)},onVertexMarkerClick:function(t){if(Waymark_L.Editable.makeCancellable(t),this.fireAndForward("editable:vertex:click",t),!(t._cancelled||this.tools.drawing()&&this.tools._drawingEditor!==this)){var e,i=t.vertex.getIndex();t.originalEvent.ctrlKey?this.onVertexMarkerCtrlClick(t):t.originalEvent.altKey?this.onVertexMarkerAltClick(t):t.originalEvent.shiftKey?this.onVertexMarkerShiftClick(t):t.originalEvent.metaKey?this.onVertexMarkerMetaKeyClick(t):i===t.vertex.getLastIndex()&&this._drawing===Waymark_L.Editable.FORWARD?i>=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.length<this.MIN_VERTEX&&this.deleteShape(this._drawnLatLngs),Waymark_L.Editable.BaseEditor.prototype.endDrawing.call(this),delete this._drawnLatLngs},addLatLng:function(t){this._drawing===Waymark_L.Editable.FORWARD?this._drawnLatLngs.push(t):this._drawnLatLngs.unshift(t),this.feature._bounds.extend(t);var e=this.addVertexMarker(t,this._drawnLatLngs);this.onNewVertex(e),this.refresh()},newPointForward:function(t){this.addLatLng(t),this.tools.attachForwardLineGuide(),this.tools.anchorForwardLineGuide(t)},newPointBackward:function(t){this.addLatLng(t),this.tools.anchorBackwardLineGuide(t)},push:function(t){if(!t)return console.error("Waymark_L.Editable.PathEditor.push expect a valid latlng as parameter");this._drawing===Waymark_L.Editable.FORWARD?this.newPointForward(t):this.newPointBackward(t)},removeLatLng:function(t){t.__vertex.delete(),this.refresh()},pop:function(){var t;if(!(this._drawnLatLngs.length<=1))return t=this._drawing===Waymark_L.Editable.FORWARD?this._drawnLatLngs[this._drawnLatLngs.length-1]:this._drawnLatLngs[0],this.removeLatLng(t),this._drawing===Waymark_L.Editable.FORWARD?this.tools.anchorForwardLineGuide(this._drawnLatLngs[this._drawnLatLngs.length-1]):this.tools.anchorForwardLineGuide(this._drawnLatLngs[0]),t},processDrawingClick:function(t){t.vertex&&t.vertex.editor===this||(this._drawing===Waymark_L.Editable.FORWARD?this.newPointForward(t.latlng):this.newPointBackward(t.latlng),this.fireAndForward("editable:drawing:clicked",t))},onDrawingMouseMove:function(t){Waymark_L.Editable.BaseEditor.prototype.onDrawingMouseMove.call(this,t),this._drawing&&(this.tools.moveForwardLineGuide(t.latlng),this.tools.moveBackwardLineGuide(t.latlng))},refresh:function(){this.feature.redraw(),this.onEditing()},newShape:function(t){var e=this.addNewEmptyShape();e&&(this.setDrawnLatLngs(e[0]||e),this.startDrawingForward(),this.fireAndForward("editable:shape:new",{shape:e}),t&&this.newPointForward(t))},deleteShape:function(t,e){var i={shape:t};if(Waymark_L.Editable.makeCancellable(i),this.fireAndForward("editable:shape:delete",i),!i._cancelled)return t=this._deleteShape(t,e),this.ensureNotFlat&&this.ensureNotFlat(),this.feature.setLatLngs(this.getLatLngs()),this.refresh(),this.reset(),this.fireAndForward("editable:shape:deleted",{shape:t}),t},_deleteShape:function(t,e){if((e=e||this.getLatLngs()).length){var i=this,n=function(t,e){return t.splice(t.indexOf(e),1),t.length||i._deleteShape(t),e};if(e===t)return function(t,e){return t.splice(0,Number.MAX_VALUE)}(e);for(var o=0;o<e.length;o++){if(e[o]===t)return n(e,t);if(-1!==e[o].indexOf(t))return n(e[o],t)}}},deleteShapeAt:function(t){var e=this.feature.shapeAt(t);if(e)return this.deleteShape(e)},appendShape:function(t){this.insertShape(t)},prependShape:function(t){this.insertShape(t,0)},insertShape:function(t,e){this.ensureMulti(),t=this.formatShape(t),void 0===e&&(e=this.feature._latlngs.length),this.feature._latlngs.splice(e,0,t),this.feature.redraw(),this._enabled&&this.reset()},extendBounds:function(t){this.feature._bounds.extend(t.vertex.latlng)},onDragStart:function(t){this.editLayer.clearLayers(),Waymark_L.Editable.BaseEditor.prototype.onDragStart.call(this,t)},onDragEnd:function(t){this.initVertexMarkers(),Waymark_L.Editable.BaseEditor.prototype.onDragEnd.call(this,t)}}),Waymark_L.Editable.PolylineEditor=Waymark_L.Editable.PathEditor.extend({startDrawingBackward:function(){this._drawing=Waymark_L.Editable.BACKWARD,this.startDrawing()},continueBackward:function(t){this.drawing()||(t=t||this.getDefaultLatLngs(),this.setDrawnLatLngs(t),t.length>0&&(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;n<e.length;n++)e[n].update(i[n])}}),Waymark_L.Editable.CircleEditor=Waymark_L.Editable.PathEditor.extend({MIN_VERTEX:2,options:{skipMiddleMarkers:!0},initialize:function(t,e,i){Waymark_L.Editable.PathEditor.prototype.initialize.call(this,t,e,i),this._resizeLatLng=this.computeResizeLatLng()},computeResizeLatLng:function(){var t=(this.feature._radius||this.feature._mRadius)*Math.cos(Math.PI/4),e=this.map.project(this.feature._latlng);return this.map.unproject([e.x+t,e.y-t])},updateResizeLatLng:function(){this._resizeLatLng.update(this.computeResizeLatLng()),this._resizeLatLng.__vertex.update()},getLatLngs:function(){return[this.feature._latlng,this._resizeLatLng]},getDefaultLatLngs:function(){return this.getLatLngs()},onVertexMarkerDrag:function(t){1===t.vertex.getIndex()?this.resize(t):this.updateResizeLatLng(t),Waymark_L.Editable.PathEditor.prototype.onVertexMarkerDrag.call(this,t)},resize:function(t){var e=this.feature._latlng.distanceTo(t.latlng);this.feature.setRadius(e)},onDrawingMouseDown:function(t){Waymark_L.Editable.PathEditor.prototype.onDrawingMouseDown.call(this,t),this._resizeLatLng.update(t.latlng),this.feature._latlng.update(t.latlng),this.connect(),t.originalEvent._simulated=!1,this.map.dragging._draggable._onUp(t.originalEvent),this._resizeLatLng.__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)},onDrag:function(t){Waymark_L.Editable.PathEditor.prototype.onDrag.call(this,t),this.feature.dragging.updateLatLng(this._resizeLatLng)}});var e={createEditor:function(t){t=t||this._map;var e=(this.options.editOptions||{}).editTools||t.editTools;if(!e)throw Error("Unable to detect Editable instance.");return new(this.options.editorClass||this.getEditorClass(e))(t,this,this.options.editOptions)},enableEdit:function(t){return this.editor||this.createEditor(t),this.editor.enable(),this.editor},editEnabled:function(){return this.editor&&this.editor.enabled()},disableEdit:function(){this.editor&&(this.editor.disable(),delete this.editor)},toggleEdit:function(){this.editEnabled()?this.disableEdit():this.enableEdit()},_onEditableAdd:function(){this.editor&&this.enableEdit()}},i={getEditorClass:function(t){return t&&t.options.polylineEditorClass?t.options.polylineEditorClass:Waymark_L.Editable.PolylineEditor},shapeAt:function(t,e){var i=null;if(!(e=e||this._latlngs).length)return i;if(l(e)&&this.isInLatLngs(t,e))i=e;else for(var n=0;n<e.length;n++)if(this.isInLatLngs(t,e[n]))return e[n];return i},isInLatLngs:function(t,e){if(!e)return!1;var i,n,o,a,r=[],s=this._clickTolerance();if(this._projectLatlngs(e,r,this._pxBounds),r=r[0],a=this._map.latLngToLayerPoint(t),!this._pxBounds.contains(a))return!1;for(i=1,o=r.length,n=0;i<o;n=i++)if(Waymark_L.LineUtil.pointToSegmentDistance(a,r[n],r[i])<=s)return!0;return!1}},n={getEditorClass:function(t){return t&&t.options.polygonEditorClass?t.options.polygonEditorClass:Waymark_L.Editable.PolygonEditor},shapeAt:function(t,e){var i=null;if(!(e=e||this._latlngs).length)return i;if(l(e)&&this.isInLatLngs(t,e))i=e;else if(l(e[0])&&this.isInLatLngs(t,e[0]))i=e;else for(var n=0;n<e.length;n++)if(this.isInLatLngs(t,e[n][0]))return e[n];return i},isInLatLngs:function(t,e){var i,n,o,a,r,s=!1;for(o=0,a=(r=e.length)-1;o<r;a=o++)i=e[o],n=e[a],i.lat>t.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<e.length;n++)if(-1!==(i=Waymark_L.Util.indexOf(e[n],t)))return e[n]}}},o={getEditorClass:function(t){return t&&t.options.markerEditorClass?t.options.markerEditorClass:Waymark_L.Editable.MarkerEditor}},a={getEditorClass:function(t){return t&&t.options.rectangleEditorClass?t.options.rectangleEditorClass:Waymark_L.Editable.RectangleEditor}},r={getEditorClass:function(t){return t&&t.options.circleEditorClass?t.options.circleEditorClass:Waymark_L.Editable.CircleEditor}},s=function(){this.on("add",this._onEditableAdd)},l=Waymark_L.LineUtil.isFlat||Waymark_L.LineUtil._flat||Waymark_L.Polyline._flat;Waymark_L.Polyline&&(Waymark_L.Polyline.include(e),Waymark_L.Polyline.include(i),Waymark_L.Polyline.addInitHook(s)),Waymark_L.Polygon&&(Waymark_L.Polygon.include(e),Waymark_L.Polygon.include(n)),Waymark_L.Marker&&(Waymark_L.Marker.include(e),Waymark_L.Marker.include(o),Waymark_L.Marker.addInitHook(s)),Waymark_L.Rectangle&&(Waymark_L.Rectangle.include(e),Waymark_L.Rectangle.include(a)),Waymark_L.Circle&&(Waymark_L.Circle.include(e),Waymark_L.Circle.include(r)),Waymark_L.LatLng.prototype.update=function(t){t=Waymark_L.latLng(t),this.lat=t.lat,this.lng=t.lng}}),window),Waymark_L.FeatureGroup.SubGroup=Waymark_L.FeatureGroup.extend({initialize:function(t,e){Waymark_L.FeatureGroup.prototype.initialize.call(this,e),this.setParentGroup(t)},setParentGroup:function(t){var e=t instanceof Waymark_L.LayerGroup;return this._parentGroup=t,this.onAdd=e?"function"==typeof t.addLayers?this._onAddToGroupBatch:this._onAddToGroup:this._onAddToMap,this.onRemove=e?"function"==typeof t.removeLayers?this._onRemoveFromGroupBatch:this._onRemoveFromGroup:this._onRemoveFromMap,this.addLayer=e?this._addLayerToGroup:this._addLayerToMap,this.removeLayer=e?this._removeLayerFromGroup:this._removeLayerFromMap,this},setParentGroupSafe:function(t){var e=this._map;return e&&e.removeLayer(this),this.setParentGroup(t),e&&e.addLayer(this),this},getParentGroup:function(){return this._parentGroup},_onAddToGroupBatch:function(t){var e=this.getLayers();this._map=t,this._parentGroup.addLayers(e)},_onRemoveFromGroupBatch:function(){var t=this.getLayers();this._parentGroup.removeLayers(t),this._map=null},_onAddToGroup:function(t){var e=this._parentGroup;this._map=t,this.eachLayer(e.addLayer,e)},_onRemoveFromGroup:function(){var t=this._parentGroup;this.eachLayer(t.removeLayer,t),this._map=null},_onAddToMap:Waymark_L.FeatureGroup.prototype.onAdd,_onRemoveFromMap:Waymark_L.FeatureGroup.prototype.onRemove,_addLayerToGroup:function(t){if(this.hasLayer(t))return this;t.addEventParent(this);var e=this.getLayerId(t);return this._layers[e]=t,this._map&&this._parentGroup.addLayer(t),this.fire("layeradd",{layer:t})},_removeLayerFromGroup:function(t){if(!this.hasLayer(t))return this;var e=t in this._layers?t:this.getLayerId(t);return(t=this._layers[e]).removeEventParent(this),this._map&&t&&this._parentGroup.removeLayer(t),delete this._layers[e],this.fire("layerremove",{layer:t})},_addLayerToMap:Waymark_L.FeatureGroup.prototype.addLayer,_removeLayerFromMap:Waymark_L.FeatureGroup.prototype.removeLayer}),Waymark_L.featureGroup.subGroup=function(t,e){return new Waymark_L.FeatureGroup.SubGroup(t,e)},function(t){var e;if("function"==typeof define&&define.amd)define(["leaflet"],t);else if("undefined"!=typeof module)e=require("leaflet"),module.exports=t(e);else{if(void 0===window.L)throw new Error("Leaflet must be loaded first");t(window.L)}}((function(t){Waymark_L.Control.Fullscreen=Waymark_L.Control.extend({options:{position:"topleft",title:{false:"View Fullscreen",true:"Exit Fullscreen"}},onAdd:function(t){var e=Waymark_L.DomUtil.create("div","leaflet-control-fullscreen leaflet-bar leaflet-control");return this.link=Waymark_L.DomUtil.create("a","leaflet-control-fullscreen-button leaflet-bar-part",e),this.link.href="#",this._map=t,this._map.on("fullscreenchange",this._toggleTitle,this),this._toggleTitle(),Waymark_L.DomEvent.on(this.link,"click",this._click,this),e},_click:function(t){Waymark_L.DomEvent.stopPropagation(t),Waymark_L.DomEvent.preventDefault(t),this._map.toggleFullscreen(this.options)},_toggleTitle:function(){this.link.title=this.options.title[this._map.isFullscreen()]}}),Waymark_L.Map.include({isFullscreen:function(){return this._isFullscreen||!1},toggleFullscreen:function(t){var e=this.getContainer();this.isFullscreen()?t&&t.pseudoFullscreen?this._disablePseudoFullscreen(e):document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.msExitFullscreen?document.msExitFullscreen():this._disablePseudoFullscreen(e):t&&t.pseudoFullscreen?this._enablePseudoFullscreen(e):e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):e.msRequestFullscreen?e.msRequestFullscreen():this._enablePseudoFullscreen(e)},_enablePseudoFullscreen:function(t){Waymark_L.DomUtil.addClass(t,"leaflet-pseudo-fullscreen"),this._setFullscreen(!0),this.fire("fullscreenchange")},_disablePseudoFullscreen:function(t){Waymark_L.DomUtil.removeClass(t,"leaflet-pseudo-fullscreen"),this._setFullscreen(!1),this.fire("fullscreenchange")},_setFullscreen:function(t){this._isFullscreen=t;var e=this.getContainer();t?Waymark_L.DomUtil.addClass(e,"leaflet-fullscreen-on"):Waymark_L.DomUtil.removeClass(e,"leaflet-fullscreen-on"),this.invalidateSize()},_onFullscreenChange:function(t){var e=document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement;e!==this.getContainer()||this._isFullscreen?e!==this.getContainer()&&this._isFullscreen&&(this._setFullscreen(!1),this.fire("fullscreenchange")):(this._setFullscreen(!0),this.fire("fullscreenchange"))}}),Waymark_L.Map.mergeOptions({fullscreenControl:!1}),Waymark_L.Map.addInitHook((function(){var t;if(this.options.fullscreenControl&&(this.fullscreenControl=new Waymark_L.Control.Fullscreen(this.options.fullscreenControl),this.addControl(this.fullscreenControl)),"onfullscreenchange"in document?t="fullscreenchange":"onmozfullscreenchange"in document?t="mozfullscreenchange":"onwebkitfullscreenchange"in document?t="webkitfullscreenchange":"onmsfullscreenchange"in document&&(t="MSFullscreenChange"),t){var e=Waymark_L.bind(this._onFullscreenChange,this);this.whenReady((function(){Waymark_L.DomEvent.on(document,t,e)})),this.on("unload",(function(){Waymark_L.DomEvent.off(document,t,e)}))}})),Waymark_L.control.fullscreen=function(t){return new Waymark_L.Control.Fullscreen(t)}})),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t.Leaflet=t.Leaflet||{},t.Leaflet.markercluster=t.Leaflet.markercluster||{}))}(this,(function(t){"use strict";var e=L.MarkerClusterGroup=L.FeatureGroup.extend({options:{maxClusterRadius:80,iconCreateFunction:null,clusterPane:L.Marker.prototype.options.pane,spiderfyOnMaxZoom:!0,showCoverageOnHover:!0,zoomToBoundsOnClick:!0,singleMarkerMode:!1,disableClusteringAtZoom:null,removeOutsideVisibleBounds:!0,animate:!0,animateAddingMarkers:!1,spiderfyDistanceMultiplier:1,spiderLegPolylineOptions:{weight:1.5,color:"#222",opacity:.5},chunkedLoading:!1,chunkInterval:200,chunkDelay:50,chunkProgress:null,polygonOptions:{}},initialize:function(t){L.Util.setOptions(this,t),this.options.iconCreateFunction||(this.options.iconCreateFunction=this._defaultIconCreateFunction),this._featureGroup=L.featureGroup(),this._featureGroup.addEventParent(this),this._nonPointGroup=L.featureGroup(),this._nonPointGroup.addEventParent(this),this._inZoomAnimation=0,this._needsClustering=[],this._needsRemoving=[],this._currentShownBounds=null,this._queue=[],this._childMarkerEventHandlers={dragstart:this._childMarkerDragStart,move:this._childMarkerMoved,dragend:this._childMarkerDragEnd};var e=L.DomUtil.TRANSITION&&this.options.animate;L.extend(this,e?this._withAnimation:this._noAnimation),this._markerCluster=e?L.MarkerCluster:L.MarkerClusterNonAnimated},addLayer:function(t){if(t instanceof L.LayerGroup)return this.addLayers([t]);if(!t.getLatLng)return this._nonPointGroup.addLayer(t),this.fire("layeradd",{layer:t}),this;if(!this._map)return this._needsClustering.push(t),this.fire("layeradd",{layer:t}),this;if(this.hasLayer(t))return this;this._unspiderfy&&this._unspiderfy(),this._addLayer(t,this._maxZoom),this.fire("layeradd",{layer:t}),this._topClusterLevel._recalculateBounds(),this._refreshClustersIcons();var e=t,i=this._zoom;if(t.__parent)for(;e.__parent._zoom>=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._zoom<Math.round(this._map._zoom)?(this._map.on("moveend",i,this),this._map.panTo(t.getLatLng())):(this._map.on("moveend",i,this),this.on("animationend",i,this),t.__parent.zoomToBounds())},onAdd:function(t){var e,i,n;if(this._map=t,!isFinite(this._map.getMaxZoom()))throw"Map has no maxZoom specified";for(this._featureGroup.addTo(t),this._nonPointGroup.addTo(t),this._gridClusters||this._generateInitialClusters(),this._maxLat=t.options.crs.projection.MAX_LATITUDE,e=0,i=this._needsRemoving.length;i>e;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._zoom<s));)e&&h._childCount<=1?(l=h._markers[0]===t?h._markers[1]:h._markers[0],n[h._zoom].removeObject(h,r.project(h._cLatLng,h._zoom)),o[h._zoom].addObject(l,r.project(l.getLatLng(),h._zoom)),this._arraySplice(h.__parent._childClusters,h),h.__parent._markers.push(l),l.__parent=h.__parent,h._icon&&(a.removeLayer(h),i||a.addLayer(l))):h._iconNeedsUpdate=!0,h=h.__parent;delete t.__parent},_isOrIsParent:function(t,e){for(;e;){if(t===e)return!0;e=e.parentNode}return!1},fire:function(t,e,i){if(e&&e.layer instanceof L.MarkerCluster){if(e.originalEvent&&this._isOrIsParent(e.layer._icon,e.originalEvent.relatedTarget))return;t="cluster"+t}L.FeatureGroup.prototype.fire.call(this,t,e,i)},listens:function(t,e){return L.FeatureGroup.prototype.listens.call(this,t,e)||L.FeatureGroup.prototype.listens.call(this,"cluster"+t,e)},_defaultIconCreateFunction:function(t){var e=t.getChildCount(),i=" marker-cluster-";return i+=10>e?"small":100>e?"medium":"large",new L.DivIcon({html:"<div><span>"+e+"</span></div>",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;t<this._queue.length;t++)this._queue[t].call(this);this._queue.length=0,clearTimeout(this._queueTimeout),this._queueTimeout=null},_mergeSplitClusters:function(){var t=Math.round(this._map._zoom);this._processQueue(),this._zoom<t&&this._currentShownBounds.intersects(this._getExpandedVisibleBounds())?(this._animationStart(),this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,Math.floor(this._map.getMinZoom()),this._zoom,this._getExpandedVisibleBounds()),this._animationZoomIn(this._zoom,t)):this._zoom>t?(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<n.length;o++)(i=n[o])instanceof L.LayerGroup?this._extractNonGroupLayers(i,e):e.push(i);return e},_overrideMarkerIcon:function(t){return t.options.icon=this.options.iconCreateFunction({getChildCount:function(){return 1},getAllChildMarkers:function(){return[t]}})}});L.MarkerClusterGroup.include({_mapBoundsInfinite:new L.LatLngBounds(new L.LatLng(-1/0,-1/0),new L.LatLng(1/0,1/0))}),L.MarkerClusterGroup.include({_noAnimation:{_animationStart:function(){},_animationZoomIn:function(t,e){this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,Math.floor(this._map.getMinZoom()),t),this._topClusterLevel._recursivelyAddChildrenToMap(null,e,this._getExpandedVisibleBounds()),this.fire("animationend")},_animationZoomOut:function(t,e){this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,Math.floor(this._map.getMinZoom()),t),this._topClusterLevel._recursivelyAddChildrenToMap(null,e,this._getExpandedVisibleBounds()),this.fire("animationend")},_animationAddLayer:function(t,e){this._animationAddLayerNonAnimated(t,e)}},_withAnimation:{_animationStart:function(){this._map._mapPane.className+=" leaflet-cluster-anim",this._inZoomAnimation++},_animationZoomIn:function(t,e){var i,n=this._getExpandedVisibleBounds(),o=this._featureGroup,a=Math.floor(this._map.getMinZoom());this._ignoreMove=!0,this._topClusterLevel._recursively(n,t,a,(function(a){var r,s=a._latlng,l=a._markers;for(n.contains(s)||(s=null),a._isSingleParent()&&t+1===e?(o.removeLayer(a),a._recursivelyAddChildrenToMap(null,e,n)):(a.clusterHide(),a._recursivelyAddChildrenToMap(s,e,n)),i=l.length-1;i>=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;e<i.length;e++)s=s.concat(i[e]._childClusters);i=s}o>a?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<o.length;t++)i=o[t]._latlng,this._bounds.extend(i),r+=i.lat,s+=i.lng;for(t=0;t<a.length;t++)(e=a[t])._boundsNeedUpdate&&e._recalculateBounds(),this._bounds.extend(e._bounds),i=e._wLatLng,n=e._childCount,r+=i.lat*n,s+=i.lng*n;this._latlng=this._wLatLng=new L.LatLng(r/l,s/l),this._boundsNeedUpdate=!1}},_addToMap:function(t){t&&(this._backupLatlng=this._latlng,this.setLatLng(t)),this._group._featureGroup.addLayer(this)},_recursivelyAnimateChildrenIn:function(t,e,i){this._recursively(t,this._group._map.getMinZoom(),i-1,(function(t){var i,n,o=t._markers;for(i=o.length-1;i>=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.lat<n)&&(s=c,n=c.lat),(!1===o||c.lng>o)&&(l=c,o=c.lng),(!1===a||c.lng<a)&&(h=c,a=c.lng)}return n!==i?(d=s,u=r):(d=h,u=l),[].concat(this.buildConvexHull([d,u],t),this.buildConvexHull([u,d],t))}},L.MarkerCluster.include({getConvexHull:function(){var t,e,i=this.getAllChildMarkers(),n=[];for(e=i.length-1;e>=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<t.length;i++)a=s.layerPointToLatLng(e[i]),n=t[i],o=new L.Polyline([this._latlng,a],h),s.addLayer(o),n._spiderLeg=o,n._preSpiderfyLatlng=n._latlng,n.setLatLng(a),n.setZIndexOffset&&n.setZIndexOffset(1e6),l.addLayer(n);this.setOpacity(.3),r._ignoreMove=!1,r.fire("spiderfied",{cluster:this,markers:t})},_animationUnspiderfy:function(){this._noanimationUnspiderfy()}}),L.MarkerCluster.include({_animationSpiderfy:function(t,e){var i,n,o,a,r,s,l=this,h=this._group,u=h._map,d=h._featureGroup,c=this._latlng,_=u.latLngToLayerPoint(c),p=L.Path.SVG,m=L.extend({},this._group.options.spiderLegPolylineOptions),f=m.opacity;for(void 0===f&&(f=L.MarkerClusterGroup.prototype.options.spiderLegPolylineOptions.opacity),p?(m.opacity=0,m.className=(m.className||"")+" leaflet-cluster-spider-leg"):m.opacity=f,h._ignoreMove=!0,i=0;i<t.length;i++)n=t[i],s=u.layerPointToLatLng(e[i]),o=new L.Polyline([c,s],m),u.addLayer(o),n._spiderLeg=o,p&&(r=(a=o._path).getTotalLength()+.1,a.style.strokeDasharray=r,a.style.strokeDashoffset=r),n.setZIndexOffset&&n.setZIndexOffset(1e6),n.clusterHide&&n.clusterHide(),d.addLayer(n),n._setPos&&n._setPos(_);for(h._forceLayout(),h._animationStart(),i=t.length-1;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&&_<a-d);var p=0,m=n[0];return c.map((function(t){for(;t>m.distB&&p<o-1;)p++,m=n[p];var e=(t-m.distA)/(m.distB-m.distA);return{pt:l(m.a,m.b,e),heading:m.heading}}))}(e.map((function(t){return o._map.project(t)})),n).map((function(e){return{latLng:o._map.unproject(t.point(e.pt)),heading:e.heading}}))},redraw:function(){this._map&&(this.clearLayers(),this._draw())},_getPatternLayers:function(e){var i=this,n=this._map.getBounds().pad(.1);return this._paths.map((function(o){var a=i._getDirectionPoints(o,e).filter((function(t){return n.contains(t.latLng)}));return t.featureGroup(i._buildSymbols(o,e.symbolFactory,a))}))},_draw:function(){var e=this;this._patterns.map((function(t){return e._getPatternLayers(t)})).forEach((function(i){e.addLayer(t.featureGroup(i))}))}}),t.polylineDecorator=function(e,i){return new t.PolylineDecorator(e,i)}})),Waymark_L.Control.SleepMapControl=Waymark_L.Control.extend({initialize:function(t){Waymark_L.setOptions(this,t)},options:{position:"topright",prompt:"disable map",styles:{backgroundColor:"white",padding:"5px",border:"2px solid gray"}},buildContainer:function(){var t=this,e=Waymark_L.DomUtil.create("p","sleep-button"),i=this._nonBoundEvent.bind(this);return e.appendChild(document.createTextNode(this.options.prompt)),Waymark_L.DomEvent.addListener(e,"click",i),Waymark_L.DomEvent.addListener(e,"touchstart",i),Object.keys(this.options.styles).map((function(i){e.style[i]=t.options.styles[i]})),this._container=e},onAdd:function(){return this._container||this.buildContainer()},_nonBoundEvent:function(t){return Waymark_L.DomEvent.stop(t),this._map&&this._map.sleep._sleepMap(),!1}}),Waymark_L.Control.sleepMapControl=function(){return new Waymark_L.Control.SleepMapControl},Waymark_L.Map.mergeOptions({sleep:!0,sleepTime:750,wakeTime:750,wakeMessageTouch:"Touch to Wake",sleepNote:!0,hoverToWake:!0,sleepOpacity:.7,sleepButton:Waymark_L.Control.sleepMapControl}),Waymark_L.Map.Sleep=Waymark_L.Handler.extend({addHooks:function(){this.sleepNote=Waymark_L.DomUtil.create("p","sleep-note",this._map._container),this._enterTimeout=null,this._exitTimeout=null,this._sleepButton=this._map.options.sleepButton(),this._map.tap&&this._map.addControl(this._sleepButton);var t=this._map._container.style;t.WebkitTransition+="opacity .5s",t.MozTransition+="opacity .5s",this._setSleepNoteStyle(),this._sleepMap()},removeHooks:function(){this._map.scrollWheelZoom.enabled()||this._map.scrollWheelZoom.enable(),this._map.tap&&!this._map.tap.enabled()&&(this._map.touchZoom.enable(),this._map.dragging.enable(),this._map.tap.enable()),Waymark_L.DomUtil.setOpacity(this._map._container,1),Waymark_L.DomUtil.setOpacity(this.sleepNote,0),this._removeSleepingListeners(),this._removeAwakeListeners()},_setSleepNoteStyle:function(){var t="",e=this.sleepNote.style;if(t=this._map.tap?this._map.options.wakeMessageTouch:this._map.options.wakeMessage?this._map.options.wakeMessage:this._map.options.hoverToWake?"click or hover to wake":"click to wake",this._map.options.sleepNote&&(this.sleepNote.appendChild(document.createTextNode(t)),e.pointerEvents="none",e.maxWidth="150px",e.transitionDuration=".2s",e.zIndex=5e3,e.opacity=".6",e.margin="auto",e.textAlign="center",e.borderRadius="4px",e.top="50%",e.position="relative",e.padding="5px",e.border="solid 2px black",e.background="white",this._map.options.sleepNoteStyle)){var i=this._map.options.sleepNoteStyle;Object.keys(i).map((function(t){e[t]=i[t]}))}},_wakeMap:function(t){this._stopWaiting(),this._map.scrollWheelZoom.enable(),this._map.dragging.enable(),this._map.tap&&(this._map.touchZoom.enable(),this._map.tap.enable(),this._map.addControl(this._sleepButton)),Waymark_L.DomUtil.setOpacity(this._map._container,1),this.sleepNote.style.opacity=0,this._addAwakeListeners()},_sleepMap:function(){this._stopWaiting(),this._map.scrollWheelZoom.disable(),this._map.tap&&(this._map.touchZoom.disable(),this._map.dragging.disable(),this._map.tap.disable(),this._map.removeControl(this._sleepButton)),Waymark_L.DomUtil.setOpacity(this._map._container,this._map.options.sleepOpacity),this.sleepNote.style.opacity=.4,this._addSleepingListeners()},_wakePending:function(){if(this._map.once("mousedown",this._wakeMap,this),this._map.options.hoverToWake){var t=this;this._map.once("mouseout",this._sleepMap,this),t._enterTimeout=setTimeout((function(){t._map.off("mouseout",t._sleepMap,t),t._wakeMap()}),t._map.options.wakeTime)}},_sleepPending:function(){var t=this;t._map.once("mouseover",t._wakeMap,t),t._exitTimeout=setTimeout((function(){t._map.off("mouseover",t._wakeMap,t),t._sleepMap()}),t._map.options.sleepTime)},_addSleepingListeners:function(){this._map.once("mouseover",this._wakePending,this),this._map.tap&&this._map.once("click",this._wakeMap,this)},_addAwakeListeners:function(){this._map.once("mouseout",this._sleepPending,this)},_removeSleepingListeners:function(){this._map.options.hoverToWake&&this._map.off("mouseover",this._wakePending,this),this._map.off("mousedown",this._wakeMap,this),this._map.tap&&this._map.off("click",this._wakeMap,this)},_removeAwakeListeners:function(){this._map.off("mouseout",this._sleepPending,this)},_stopWaiting:function(){this._removeSleepingListeners(),this._removeAwakeListeners();this._enterTimeout&&clearTimeout(this._enterTimeout),this._exitTimeout&&clearTimeout(this._exitTimeout),this._enterTimeout=null,this._exitTimeout=null}}),Waymark_L.Map.addInitHook("addHandler","sleep",Waymark_L.Map.Sleep);var toGeoJSON=function(){var t,e=/\s*/g,i=/^\s*|\s*$/g,n=/\s+/;function o(t){if(!t||!t.length)return 0;for(var e=0,i=0;e<t.length;e++)i=(i<<5)-i+t.charCodeAt(e)|0;return i}function a(t,e){return t.getElementsByTagName(e)}function r(t,e){return t.getAttribute(e)}function s(t,e){return parseFloat(r(t,e))}function l(t,e){var i=a(t,e);return i.length?i[0]:null}function h(t){for(var e=0,i=[];e<t.length;e++)i[e]=parseFloat(t[e]);return i}function u(t){return t&&function(t){t.normalize&&t.normalize()}(t),t&&t.textContent||""}function d(t,e){var i,n,o={};for(n=0;n<e.length;n++)(i=l(t,e[n]))&&(o[e[n]]=u(i));return o}function c(t,e){for(var i in e)t[i]=e[i]}function _(t){return h(t.replace(e,"").split(","))}function p(t){for(var e=t.replace(i,"").split(n),o=[],a=0;a<e.length;a++)o.push(_(e[a]));return o}function m(t){var e,i=[s(t,"lon"),s(t,"lat")],n=l(t,"ele"),o=l(t,"gpxtpx:hr")||l(t,"hr"),a=l(t,"time");return n&&(e=parseFloat(u(n)),isNaN(e)||i.push(e)),{coordinates:i,time:a?u(a):null,heartRate:o?parseFloat(u(o)):null}}if("undefined"!=typeof XMLSerializer)t=new XMLSerializer;else{var f="object"==typeof process&&!process.browser,g="object"==typeof Titanium;if("object"!=typeof exports||!f&&!g)throw new Error("Unable to initialize serializer");t=new(require("xmldom").XMLSerializer)}function y(e){return void 0!==e.xml?e.xml:t.serializeToString(e)}return{kml:function(t){for(var e={type:"FeatureCollection",features:[]},i={},n={},s={},d=["Polygon","LineString","Point","Track","gx:Track"],c=a(t,"Placemark"),m=a(t,"Style"),f=a(t,"StyleMap"),g=0;g<m.length;g++){var v=o(y(m[g])).toString(16);i["#"+r(m[g],"id")]=v,n[v]=m[g]}for(var k=0;k<f.length;k++){i["#"+r(f[k],"id")]=o(y(f[k])).toString(16);for(var L=a(f[k],"Pair"),w={},b=0;b<L.length;b++)w[u(l(L[b],"key"))]=u(l(L[b],"styleUrl"));s["#"+r(f[k],"id")]=w}for(var x=0;x<c.length;x++)e.features=e.features.concat(P(c[x]));function W(t){var e,i;return"#"===(t=t||"").substr(0,1)&&(t=t.substr(1)),6!==t.length&&3!==t.length||(e=t),8===t.length&&(i=parseInt(t.substr(0,2),16)/255,e="#"+t.substr(6,2)+t.substr(4,2)+t.substr(2,2)),[e,isNaN(i)?void 0:i]}function C(t){return h(t.split(" "))}function M(t){var e=a(t,"coord"),i=[],n=[];0===e.length&&(e=a(t,"gx:coord"));for(var o=0;o<e.length;o++)i.push(C(u(e[o])));for(var r=a(t,"when"),s=0;s<r.length;s++)n.push(u(r[s]));return{coords:i,times:n}}function P(t){var e,o=function t(e){var i,n,o,r,s,h=[],c=[];if(l(e,"MultiGeometry"))return t(l(e,"MultiGeometry"));if(l(e,"MultiTrack"))return t(l(e,"MultiTrack"));if(l(e,"gx:MultiTrack"))return t(l(e,"gx:MultiTrack"));for(o=0;o<d.length;o++)if(n=a(e,d[o]))for(r=0;r<n.length;r++)if(i=n[r],"Point"===d[o])h.push({type:"Point",coordinates:_(u(l(i,"coordinates")))});else if("LineString"===d[o])h.push({type:"LineString",coordinates:p(u(l(i,"coordinates")))});else if("Polygon"===d[o]){var m=a(i,"LinearRing"),f=[];for(s=0;s<m.length;s++)f.push(p(u(l(m[s],"coordinates"))));h.push({type:"Polygon",coordinates:f})}else if("Track"===d[o]||"gx:Track"===d[o]){var g=M(i);h.push({type:"LineString",coordinates:g.coords}),g.times.length&&c.push(g.times)}return{geoms:h,coordTimes:c}}(t),h={},c=u(l(t,"name")),m=u(l(t,"address")),f=u(l(t,"styleUrl")),g=u(l(t,"description")),y=l(t,"TimeSpan"),v=l(t,"TimeStamp"),k=l(t,"ExtendedData"),L=l(t,"LineStyle"),w=l(t,"PolyStyle"),b=l(t,"visibility");if(!o.geoms.length)return[];if(c&&(h.name=c),m&&(h.address=m),f){"#"!==f[0]&&(f="#"+f),h.styleUrl=f,i[f]&&(h.styleHash=i[f]),s[f]&&(h.styleMapHash=s[f],h.styleHash=i[s[f].normal]);var x=n[h.styleHash];if(x){L||(L=l(x,"LineStyle")),w||(w=l(x,"PolyStyle"));var C=l(x,"IconStyle");if(C){var P=l(C,"Icon");if(P){var E=u(l(P,"href"));E&&(h.icon=E)}}}}if(g&&(h.description=g),y){var T=u(l(y,"begin")),S=u(l(y,"end"));h.timespan={begin:T,end:S}}if(v&&(h.timestamp=u(l(v,"when"))),L){var z=W(u(l(L,"color"))),D=z[0],O=z[1],A=parseFloat(u(l(L,"width")));D&&(h.stroke=D),isNaN(O)||(h["stroke-opacity"]=O),isNaN(A)||(h["stroke-width"]=A)}if(w){var B=W(u(l(w,"color"))),I=B[0],F=B[1],N=u(l(w,"fill")),j=u(l(w,"outline"));I&&(h.fill=I),isNaN(F)||(h["fill-opacity"]=F),N&&(h["fill-opacity"]="1"===N?h["fill-opacity"]||1:0),j&&(h["stroke-opacity"]="1"===j?h["stroke-opacity"]||1:0)}if(k){var Z=a(k,"Data"),R=a(k,"SimpleData");for(e=0;e<Z.length;e++)h[Z[e].getAttribute("name")]=u(l(Z[e],"value"));for(e=0;e<R.length;e++)h[R[e].getAttribute("name")]=u(R[e])}b&&(h.visibility=u(b)),o.coordTimes.length&&(h.coordTimes=1===o.coordTimes.length?o.coordTimes[0]:o.coordTimes);var G={type:"Feature",geometry:1===o.geoms.length?o.geoms[0]:{type:"GeometryCollection",geometries:o.geoms},properties:h};return r(t,"id")&&(G.id=r(t,"id")),[G]}return e},gpx:function(t){var e,i,n=a(t,"trk"),o=a(t,"rte"),s=a(t,"wpt"),h={type:"FeatureCollection",features:[]};for(e=0;e<n.length;e++)(i=f(n[e]))&&h.features.push(i);for(e=0;e<o.length;e++)(i=g(o[e]))&&h.features.push(i);for(e=0;e<s.length;e++)h.features.push(y(s[e]));function _(t,e){for(var i=0;i<e;i++)t.push(null);return t}function p(t,e){var i=a(t,e),n=[],o=[],r=[],s=i.length;if(s<2)return{};for(var l=0;l<s;l++){var h=m(i[l]);n.push(h.coordinates),h.time&&o.push(h.time),(h.heartRate||r.length)&&(r.length||_(r,l),r.push(h.heartRate||null))}return{line:n,times:o,heartRates:r}}function f(t){for(var e,i=a(t,"trkseg"),n=[],o=[],r=[],s=0;s<i.length;s++)if((e=p(i[s],"trkpt"))&&(e.line&&n.push(e.line),e.times&&e.times.length&&o.push(e.times),r.length||e.heartRates&&e.heartRates.length)){if(!r.length)for(var h=0;h<s;h++)r.push(_([],n[h].length));e.heartRates&&e.heartRates.length?r.push(e.heartRates):r.push(_([],e.line.length||0))}if(0!==n.length){var u=k(t);return c(u,v(l(t,"extensions"))),o.length&&(u.coordTimes=1===n.length?o[0]:o),r.length&&(u.heartRates=1===n.length?r[0]:r),{type:"Feature",properties:u,geometry:{type:1===n.length?"LineString":"MultiLineString",coordinates:1===n.length?n[0]:n}}}}function g(t){var e=p(t,"rtept");if(e.line){var i=k(t);return c(i,v(l(t,"extensions"))),{type:"Feature",properties:i,geometry:{type:"LineString",coordinates:e.line}}}}function y(t){var e=k(t);return c(e,d(t,["sym"])),{type:"Feature",properties:e,geometry:{type:"Point",coordinates:m(t).coordinates}}}function v(t){var e={};if(t){var i=l(t,"line");if(i){var n=u(l(i,"color")),o=parseFloat(u(l(i,"opacity"))),a=parseFloat(u(l(i,"width")));n&&(e.stroke=n),isNaN(o)||(e["stroke-opacity"]=o),isNaN(a)||(e["stroke-width"]=96*a/25.4)}}return e}function k(t){var e=d(t,["name","cmt","desc","type","time","keywords"]),i=a(t,"link");i.length&&(e.links=[]);for(var n,o=0;o<i.length;o++)c(n={href:r(i[o],"href")},d(i[o],["text","type"])),e.links.push(n);return e}return h}}}();function Waymark_Map(){this.init=function(t={}){for(key in Waymark=this,Waymark.start_time=(new Date).getTime(),Waymark.jq_map_container=null,Waymark.config={map_options:{debug_mode:0,map_height:null,map_div_id:"waymark-map",map_width:null,map_init_zoom:null,map_init_latlng:null,map_init_basemap:null,map_max_zoom:null,tile_layers:[{layer_name:"OpenStreetMap",layer_url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png?r=1",layer_attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> 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.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:'<a href="https://www.waymark.dev/js/" title="Share your way">Waymark</a>'}).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='<span class="waymark-type-label">['+o[t+"_title"]+"]</span> ");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"],"<b>"+Waymark.config.language["object_label_"+t+"_plural"]+"</b>"),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"]+"</"+i+">"},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='<div class="waymark-marker-background" style="'+i+'"></div>',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+='<div style="'+n+'" class="'+o+'">'+t.marker_icon+"</div>";break;case"html":o+=" waymark-icon-html";var a=jQuery("<div/>").html(t.marker_icon).text();e.html+='<div class="'+o+'">'+a+"</div>";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+='<i style="'+n+'" class="'+o+'"></i>'}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<div class="waymark-type-heading" style="background:${n}">\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</div>\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+=`<div class="${i.className}">${i.html}</div>`;break;case"line":case"shape":n+=Waymark.type_to_text(t,e,"span")}return n+=`</${i}>`,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=`<div class="waymark-overlay-content ${t.properties.title?"waymark-overlay-has-title":""} ${t.properties.description?"waymark-overlay-has-desc":""} ${t.properties.image_large_url?"waymark-overlay-has-image":""} waymark-overlay-${e}">`;const o=["type","title","description","image_large_url"];for(index in o){var a=o[index];switch(n+=`<div class="waymark-overlay-property waymark-overlay-property-${a}">`,a){case"type":n+=Waymark.type_to_text(e,i);break;case"title":n+=t.properties.title?t.properties.title:"<em>Untitled "+i[e+"_title"]+" "+Waymark.title_case(e)+"</em>";break;case"description":var r=t.properties.description;r&&(0===r.indexOf("<")?n+=r:n+=`<p>${r}</p>`);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+=`<a href="${t.properties.image_large_url}" target="_blank" style="background-image:url(${s})"></a>`}}n+="</div>"}return n+="</div>"},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+=`<div class="waymark-cluster-count">${s}</div>`);const u=8*n;i+=`\n\t\t\t\t<div \n\t\t\t\t\tclass="${l.className}" \n\t\t\t\t\tstyle="\n\t\t\t\t\t\tleft:${u}px;\n\t\t\t\t\t\tz-index:${h};\n\t\t\t\t\t\theight:${l.iconSize[1]}px;\n\t\t\t\t\t\twidth:${l.iconSize[0]}px;\n\t\t\t\t\t\theight:${l.iconSize[1]}px;\n\t\t\t\t\t"\n\t\t\t\t>\n\t\t\t\t\t${l.html}\t\t\t\t\t\n\t\t\t\t</div>\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("<div />"),n=jQuery("<ul />").addClass("waymark-info waymark-"+t+"-info");for(key in Waymark.config[t+"_data_defaults"]){var o=null;switch(key){case"title":e.properties.title?o=jQuery("<strong />").html(e.properties.title):(o=jQuery("<strong />").html("&nbsp;"),n.addClass("waymark-no-title"));break;case"type":var a=Waymark.get_type(t,e.properties.type);a&&(o=Waymark.type_to_text(t,a,"small"));break;case"description":var r=e.properties.description;r?o=0===r.indexOf("<")?r:jQuery("<p />").html(r):n.addClass("waymark-no-description");break;case"image_large_url":if(void 0!==e.properties.image_large_url){var s=e.properties.image_large_url;if(void 0!==e.properties.image_medium_url)s=e.properties.image_medium_url;o=jQuery("<a />").attr({href:e.properties.image_large_url,target:"_blank",style:"background-image:url("+s+")"})}else n.addClass("waymark-no-image")}o&&n.append(jQuery("<li />").addClass("waymark-info-"+key+" waymark-"+t+"-info-"+key).append(o))}return n.children().length&&i.append(n),i},this.info_window=function(t,e,i){if(Waymark=this,parseInt(Waymark.config.viewer_options.show_elevation)&&"line"==t&&(parseInt(Waymark.config.viewer_options.elevation_initial)&&Waymark.line_has_elevation_data(e)&&!Waymark.elevation_container.is(":visible")&&(Waymark.elevation_container.show(),Waymark.elevation_control.loadData(e)),jQuery(i).on("click",{W:Waymark},(function(t){var e=t.data.W,i=t.target.feature;e.elevation_control.clear(),void 0!==e.elevation_control.layer&&e.elevation_control.layer.removeFrom(e.map),e.elevation_container.hide(),e.line_has_elevation_data(i)&&(e.elevation_container.show(),e.elevation_control.loadData(i))}))),void 0!==e.properties.description||void 0!==e.properties.image_large_url){var n=Waymark.build_content(t,e,i);e.properties.title;i.bindPopup(n.get(0)).openPopup()}},this.line_has_elevation_data=function(t){if("MultiLineString"==t.geometry.type){for(var e in t.geometry.coordinates)for(var i in t.geometry.coordinates[e])if(3==t.geometry.coordinates[e][i].length)return!0}else for(var i in t.geometry.coordinates)if(3==t.geometry.coordinates[i].length)return!0;return!1},this.setup_elevation=function(){if(Waymark=this,!Waymark.config.viewer_options.show_elevation)return;Waymark.debug("Setting up Elevation Control"),Waymark_L.registerLocale("waymark",{"Total Length: ":Waymark.config.language.label_total_length,"Max Elevation: ":Waymark.config.language.label_max_elevation,"Min Elevation: ":Waymark.config.language.label_min_elevation,"Total Ascent: ":Waymark.config.language.label_ascent,"Total Descent: ":Waymark.config.language.label_descent}),Waymark_L.setLocale("waymark");var t={theme:"magenta-theme",detached:!0,followMarker:!1,width:Waymark.config.map_options.map_width};const e=`\n\t\t\tdiv#${Waymark.config.map_options.map_div_id} .elevation-polyline { stroke: ${Waymark.config.viewer_options.elevation_colour} !important; }\n\t\t\tdiv#${Waymark.config.viewer_options.elevation_div_id} .elevation-control.elevation .area { fill: ${Waymark.config.viewer_options.elevation_colour} !important; }\n\t\t`;if(jQuery("head").append(`<style type="text/css">${e}</style>`),void 0!==Waymark.config.viewer_options.elevation_div_id){t.elevationDiv="#"+Waymark.config.viewer_options.elevation_div_id,Waymark.elevation_container=jQuery(t.elevationDiv),Waymark.elevation_container.length||(Waymark.debug("Creating Elevation Container"),t.width=Waymark.config.map_options.map_width/2,Waymark.elevation_container=jQuery("<div />").attr("id",Waymark.config.viewer_options.elevation_div_id).appendTo(Waymark.jq_map_container)),Waymark.elevation_container.addClass("waymark-elevation-container").hide();var i=jQuery("<span />").addClass("waymark-elevation-close").text("x").on("click",{W:Waymark},(function(t){var e=t.data.W;e.elevation_control.clear(),void 0!==e.elevation_control.layer&&e.elevation_control.layer.removeFrom(e.map),e.elevation_container.hide()}));Waymark.elevation_container.append(i)}void 0!==Waymark.config.viewer_options.elevation_units&&"imperial"==Waymark.config.viewer_options.elevation_units&&(t.imperial=!0),Waymark.elevation_control=Waymark_L.control.elevation(t).addTo(Waymark.map),Waymark.map.on("overlayremove",(function(t){if(void 0!==Waymark.elevation_control.layer){var e=null;Waymark.elevation_control.layer.eachLayer((function(t){e=JSON.stringify(t.getLatLngs())})),e&&t.layer.eachLayer((function(t){void 0!==t.getLatLngs&&e==JSON.stringify(t.getLatLngs())&&(Waymark.elevation_control.clear(),Waymark.elevation_control.layer.removeFrom(Waymark.map),Waymark.elevation_container.hide())}))}}))},this.setup_gallery=function(){if(Waymark=this,parseInt(Waymark.config.viewer_options.show_gallery)){Waymark.gallery=jQuery("<div />").attr("id",Waymark.config.gallery_div_id).css("width",Waymark.config.map_options.map_width).addClass("waymark-gallery-container").html(""),Waymark_L.DomEvent.disableClickPropagation(Waymark.gallery.get(0)),jQuery(Waymark.map.getContainer()).append(Waymark.gallery),Waymark.size_gallery();var t=Waymark;Waymark.map.on("moveend",(function(){t.render_gallery()}),{W:t}),Waymark.map.on("layerremove layeradd",(function(){t.render_gallery()}),{W:t})}},this.size_gallery=function(){if(Waymark=this,void 0!==Waymark.gallery&&Waymark.gallery.length){gallery_padding=Waymark.gallery.css("paddingRight"),gallery_padding=gallery_padding.replace("px",""),gallery_padding=parseInt(gallery_padding);var t=Waymark.config.map_options.map_width-2*gallery_padding;Waymark.gallery.css("width",t)}},this.add_to_gallery=function(t){if(Waymark=this,void 0===t.feature.properties.image_thumbnail_url||void 0===t.feature.properties.image_large_url)return!1;var e=Object.assign({},t.feature.properties);e.latlng=t.feature.geometry.coordinates,e.marker=t,Waymark.gallery_images.push(e)},this.render_gallery=function(){Waymark=this;var t=0;if(void 0!==Waymark.gallery&&Waymark.gallery.length&&(Waymark.gallery.html(""),Waymark.gallery.hide(),jQuery(Waymark.map.getContainer()).removeClass("waymark-has-gallery"),Waymark.gallery_images.length)){for(i=0;i<Waymark.gallery_images.length;i++){var e=Waymark.gallery_images[i];let a=Waymark.map;if(parseInt(Waymark.config.viewer_options.show_cluster)&&"object"==typeof Waymark.marker_cluster&&(a=Waymark.marker_cluster),Waymark.map.getBounds().contains(e.marker.getLatLng())&&a.hasLayer(e.marker)){t++;var n=jQuery("<div />").addClass("waymark-image").on("click",{marker:e.marker},(function(t){var e=t.data.marker;Waymark.map.setView(e.getLatLng(),16),e.openPopup()})),o=jQuery("<img />").attr({src:e.image_thumbnail_url});n.append(o),Waymark.gallery.append(n)}}t&&(Waymark.gallery.show(),jQuery(Waymark.map.getContainer()).addClass("waymark-has-gallery"))}}}function Waymark_Map_Editor(){this.pre_map_setup=function(){Waymark=this,Waymark.mode="edit"},this.init_done=function(){Waymark=this,Waymark.jq_map_container.addClass("waymark-is-editor");const t=Waymark.config.editor_options.data_div_id;if(Waymark.jq_data_container=jQuery("#"+t),Waymark.jq_data_container.length){const e=Waymark.jq_data_container.val();try{const i=JSON.parse(e);Waymark.load_json(i),Waymark.debug(`Data container (#${t}) found, valid GeoJSON added to Map.`)}catch(e){Waymark.debug(`Data container (#${t}) found, but not valid GeoJSON.`)}}else Waymark.debug(`Data container (#${t}) not found, adding to DOM.`),Waymark.jq_data_container=jQuery("<textarea />").attr({id:t,name:"map_data"}).addClass("waymark-input waymark-input-map_data").appendTo(Waymark.jq_map_container);Waymark.jq_map_container.append(jQuery("<div />").attr({id:"waymark-loading"}).html('<div class="waymark-spinner"></div>')),Waymark.map.on("editable:drawing:commit",(function(t){switch(layer=t.layer,void 0===layer.feature&&(layer.feature={type:"Feature",properties:{}}),!0){case layer instanceof Waymark_L.Circle:layer.feature.properties=Waymark.config.shape_data_defaults,layer.feature.properties.radius=layer.getRadius();break;case layer instanceof Waymark_L.Rectangle:layer.feature.properties=Waymark.config.shape_data_defaults,layer.feature.properties.rectangle=!0;break;case layer instanceof Waymark_L.Polygon:layer.feature.properties=Waymark.config.shape_data_defaults;break;case layer instanceof Waymark_L.Polyline:layer.feature.properties=Waymark.config.line_data_defaults}Waymark.map_data.addData(layer.toGeoJSON()),Waymark.map.removeLayer(layer),Waymark.map_was_edited()})),Waymark.map.on("editable:editing",(function(t){layer=t.layer,void 0!==layer.feature&&layer.feature.properties.radius&&(layer.feature.properties.radius=layer.getRadius()),Waymark.map_was_edited()}))},this.create_marker=function(t){Waymark=this;var e=Waymark_L.marker(t,{draggable:!0});return e.on("moveend",(function(t){var e=t.target,i=e.feature;i.geometry.coordinates=[e._latlng.lng.toFixed(6),e._latlng.lat.toFixed(6)],Waymark.info_window("marker",i,e),Waymark.map_was_edited()})),e},this.save_data_layer=function(){Waymark=this;var t=JSON.stringify(Waymark.map_data.toGeoJSON());Waymark.jq_data_container.html(t)},this.map_was_edited=function(){Waymark=this,Waymark.save_data_layer()},this.loading_start=function(){Waymark=this,Waymark.jq_map_container.addClass("waymark-loading")},this.loading_stop=function(){Waymark=this,Waymark.jq_map_container.removeClass("waymark-loading")},this.create_buttons=function(){Waymark=this;var t=Waymark_L.Control.geocoder({position:"bottomright",defaultMarkGeocode:!1,placeholder:Waymark.config.language.action_search_placeholder});t.on("markgeocode",(function(t){Waymark.map.fitBounds(t.geocode.bbox)})),t.addTo(Waymark.map);var e=Waymark_L.Control.extend({options:{position:"bottomleft"},onAdd:function(t){var e,i=Waymark_L.DomUtil.create("div","leaflet-bar leaflet-control waymark-leaflet-control waymark-edit-toolbar");(e=Waymark_L.DomUtil.create("a","waymark-icon waymark-edit-button waymark-edit-line",i)).setAttribute("title",Waymark.config.language.add_line_title),e.onclick=function(){Waymark.map.editTools.startPolyline()},(e=Waymark_L.DomUtil.create("a","waymark-edit-button waymark-edit-image",i)).innerHTML='<i class="ion ion-image"></i>',e.setAttribute("title",Waymark.config.language.add_photo_title),e.classList.add("waymark-hidden"),(e=Waymark_L.DomUtil.create("a","waymark-edit-button waymark-edit-marker",i)).innerHTML='<i class="ion ion-location"></i>',e.setAttribute("title",Waymark.config.language.add_marker_title),e.onclick=function(){var t=Waymark.create_marker_json(Waymark.map.getCenter());Waymark.map_data.addData(t),Waymark.map_was_edited()},(e=Waymark_L.DomUtil.create("a","waymark-edit-button waymark-edit-rectangle",i)).innerHTML='<i class="ion ion-android-checkbox-outline-blank"></i>',e.setAttribute("title",Waymark.config.language.add_rectangle_title),e.onclick=function(){Waymark.map.editTools.startRectangle()},(e=Waymark_L.DomUtil.create("a","waymark-edit-button waymark-edit-polygon",i)).innerHTML='<i class="ion ion-android-star-outline"></i>',e.setAttribute("title",Waymark.config.language.add_polygon_title),e.onclick=function(){Waymark.map.editTools.startPolygon()},(e=Waymark_L.DomUtil.create("a","waymark-edit-button waymark-edit-circle",i)).innerHTML='<i class="ion ion-ios-circle-outline"></i>',e.setAttribute("title",Waymark.config.language.add_circle_title),e.onclick=function(){Waymark.map.editTools.startCircle()},(e=Waymark_L.DomUtil.create("a","waymark-edit-button waymark-edit-upload waymark-hidden",i)).innerHTML='<i class="ion ion-document"></i><i class="ion ion-arrow-up-c"></i>',e.setAttribute("title",Waymark.config.language.upload_file_title);var n=jQuery("<input />").attr({type:"file",name:"add_file"}).css("display","none").change((function(){Waymark.handle_file_upload(jQuery(this))}));return jQuery("#waymark-edit-toolbar").append(n),e.onclick=function(){n.trigger("click"),Waymark.map.editTools.stopDrawing()},i}});Waymark.map.addControl(new e)},this.handle_file_upload=function(t,e={}){Waymark=this,Waymark.loading_start();var i=new FormData;i.append("waymark_security",waymark_security),i.append("action","waymark_read_file"),i.append(t.attr("name"),t[0].files[0]),jQuery.ajax({type:"POST",url:waymark_js.ajaxurl,data:i,dataType:"json",processData:!1,contentType:!1,success:function(i){if(Waymark.debug("File upload response:"),Waymark.debug(i),null===i)return Waymark.message(Waymark.config.language.error_file_upload,"error"),Waymark.loading_stop(),!1;if(i.error)return Waymark.message(i.error,"error"),Waymark.loading_stop(),!1;switch(t.attr("name")){case"add_file":Waymark.load_file_contents(i.file_contents,i.file_type);break;case"add_photo":if(void 0===i.url)return!1;var n=Waymark.map.getCenter();(latlng=Waymark.get_exif_latlng(i))&&(n=latlng,Waymark.map.setView(n));var o=Waymark.get_image_sizes(i.sizes,i.url),a=Waymark.create_marker_json(n,o);Waymark.map_data.addData(a);break;case"marker_photo":if(void 0===i.url)return!1;o=Waymark.get_image_sizes(i.sizes,i.url);e.feature.properties=Object.assign({},e.feature.properties,o),e.img_view.attr("href",e.feature.properties.image_large_url),jQuery("img",e.img_view).attr("src",e.feature.properties.image_thumbnail_url),e.img_input.val(e.feature.properties.image_large_url)}Waymark.map_was_edited(),Waymark.loading_stop()}})},this.build_content=function(t,e,i){Waymark=this;var n=jQuery("<div />"),o=jQuery("<ul />").addClass("waymark-info");if("line"==t||"shape"==t){var a=jQuery("<button />").html('<i class="ion-edit"></i>').addClass("button").attr("title",Waymark.config.language.action_edit+" "+Waymark.title_case(Waymark.config.language["object_label_"+t])).on("click",(function(e){e.preventDefault();var n=jQuery(this),o=jQuery("i",n);return i.editEnabled()?(i.disableEdit(),n.attr("title",Waymark.config.language.action_edit+" "+Waymark.title_case(Waymark.config.language["object_label_"+t])),o.attr("class","ion-edit")):(i.enableEdit(),i.closePopup(),n.attr("title",Waymark.config.language.action_edit_done),o.attr("class","ion-android-done")),!1}));o.append(jQuery("<li />").addClass("waymark-info-button waymark-info-edit waymark-"+t+"-edit").append(a))}a=jQuery("<button />").html('<i class="ion-ios-copy"></i>').addClass("button").attr("title",Waymark.config.language.action_duplicate+" "+Waymark.title_case(Waymark.config.language["object_label_"+t])).on("click",(function(t){return t.preventDefault(),Waymark.load_json(Object.assign({},i.feature)),Waymark.map_was_edited(),!1}));o.append(jQuery("<li />").addClass("waymark-info-button waymark-info-duplicate waymark-"+t+"-duplicate").append(a));a=jQuery("<button />").html('<i class="ion-trash-a"></i>').addClass("button").attr("title",Waymark.config.language.action_delete+" "+Waymark.title_case(Waymark.config.language["object_label_"+t])).on("click",(function(e){return e.preventDefault(),!("1"==Waymark.config.editor_options.confirm_delete&&!confirm(Waymark.config.language.action_delete_confirm+" "+Waymark.title_case(Waymark.config.language["object_label_"+t])+"?"))&&(Waymark.map.removeLayer(i),Waymark.map_data.removeLayer(i),Waymark.map_was_edited(),!1)}));o.append(jQuery("<li />").addClass("waymark-info-button waymark-info-delete waymark-"+t+"-delete").append(a));var r=Waymark.config.map_options[t+"_types"];if("line"==t){var s=jQuery("<select />");s.append(jQuery("<option />").val("").text(Waymark.title_case(Waymark.config.language.no_direction)),jQuery("<option />").val("default").text(Waymark.title_case(Waymark.config.language.show_direction)),jQuery("<option />").val("reverse").text(Waymark.title_case(Waymark.config.language.reverse_direction))),s.change((function(){jQuery("option:selected",jQuery(this));var t=jQuery(this).val();e.properties.direction=t,Waymark.draw_line_direction(i),Waymark.map_was_edited()})),o.append(jQuery("<li />").addClass("waymark-info-direction waymark-line-direction").append(s)),"string"==typeof e.properties.direction&&jQuery("option",s).filter((function(){return jQuery(this).val()==Waymark.make_key(e.properties.direction)})).attr("selected","selected")}var l=jQuery("<select />");for(var h in l.append(jQuery("<option />").attr({disabled:"disabled"}).text(Waymark.title_case(Waymark.config.language["object_label_"+t])+" "+Waymark.config.language.object_type_label+":")),r){var u=Waymark.make_key(r[h][t+"_title"]);l.append(jQuery("<option />").val(u).text(r[h][t+"_title"]))}l.change((function(){jQuery("option:selected",jQuery(this));var n=jQuery(this).val();if(e.properties.type=n,"object"!=typeof n)var o=Waymark.get_type(t,e.properties.type);switch(t){case"line":i.setStyle({color:o.line_colour,weight:o.line_weight,opacity:o.line_opacity});break;case"shape":i.setStyle({color:o.shape_colour,fillOpacity:o.fill_opacity});break;case"marker":i.setIcon(Waymark_L.divIcon(Waymark.build_icon_data(o)))}Waymark.map_was_edited()})),o.append(jQuery("<li />").addClass("waymark-info-type waymark-"+t+"-type").append(l)),jQuery("option",l).filter((function(){return jQuery(this).val()==Waymark.make_key(e.properties.type)})).attr("selected","selected");var d=jQuery("<div />").addClass("waymark-overlay-preview waymark-"+t+"-preview");for(var h in r){var c=r[h][t+"_title"],_=(u=Waymark.make_key(c),Waymark.get_type(t,u)),p=jQuery("<div />").addClass("waymark-type").data("type_key",u).attr("title",c);switch(t){case"marker":var m=Waymark.build_icon_data(_);p.addClass(m.className).html(m.html).css({width:m.iconSize[0],height:m.iconSize[1]});break;case"line":p.addClass("waymark-line").append(jQuery("<div />").css({margin:"15px 0",height:"1px",borderTop:_.line_weight+"px solid "+_.line_colour}));break;case"shape":p.addClass("waymark-shape").css({border:"3px solid "+_.shape_colour}).append(jQuery("<div />").css({height:"20px",background:_.shape_colour,opacity:_.fill_opacity}))}var f=jQuery("<div />").addClass("waymark-overlay-wrap waymark-"+t+"-wrap").attr("title",c);f.append(p),f.on("click",(function(){var e=(p=jQuery(".waymark-type",jQuery(this))).data("type_key");jQuery("option",l).each((function(){p.val()==e?p.attr("selected","selected"):p.removeAttr("selected")})),l.val(e),l.trigger("change"),jQuery(".waymark-"+t+"-wrap",d).each((function(){p.removeClass("waymark-active")})),p.parent(".waymark-"+t+"-wrap").addClass("waymark-active")})),u==Waymark.make_key(e.properties.type)?(f.addClass("waymark-active"),d.prepend(f)):d.append(f)}for(key in o.append(d),Waymark.config[t+"_data_defaults"]){a=null;switch(key){case"title":a=jQuery("<input />").attr({type:"text",value:e.properties.title,placeholder:Waymark.title_case(Waymark.config.language["object_label_"+t])+" "+Waymark.config.language.object_title_placeholder}).on("change",(function(){e.properties.title=jQuery(this).val(),Waymark.map_was_edited()}));break;case"description":a=jQuery("<textarea />").attr({id:"waymark-info-description",class:"wp-editor",placeholder:Waymark.title_case(Waymark.config.language["object_label_"+t])+" "+Waymark.config.language.object_description_placeholder}).val(e.properties.description).on("change",(function(){e.properties.description=jQuery(this).val(),Waymark.map_was_edited()}));break;case"image_large_url":var g=jQuery("<input />").attr({value:e.properties.image_large_url,placeholder:Waymark.config.language.object_image_placeholder}).on("change",(function(){e.properties.image_large_url=jQuery(this).val(),Waymark.map_was_edited()}));if(void 0!==e.properties.image_thumbnail_url)var y=e.properties.image_thumbnail_url;else y=e.properties.image_large_url;var v=jQuery("<img />").attr({src:y,width:160});g.on("change",(function(){v.attr("src",jQuery(this).val())}));var k=jQuery("<a />").attr({href:e.properties.image_large_url,target:"_blank"}).append(v).hover((function(){jQuery(this).addClass("waymark-hover")}),(function(){jQuery(this).removeClass("waymark-hover")}));const i=jQuery("<div />").text(Waymark.config.language.action_upload_image).addClass("button button-small waymark-hidden");a=jQuery("<div />").append(k,g,i)}a&&o.append(jQuery("<li />").addClass("waymark-info-"+key+" waymark-"+t+"-info-"+key).append(a))}if("marker"==t&&void 0!==i.feature.geometry.coordinates){i.feature.geometry.coordinates;var L=i.feature.geometry.coordinates[1],w=i.feature.geometry.coordinates[0];"number"==typeof L&&(w=w.toFixed(6),L=L.toFixed(6)),a=jQuery("<small>").html("<b>"+Waymark.config.language.marker_latlng_label+"</b>: "+L+","+w),o.append(jQuery("<li />").addClass("waymark-info-latlng waymark-marker-info-latlng").append(a))}return o.children().length&&n.append(o),n},this.info_window=function(t,e,i){Waymark=this;Waymark.title_case(Waymark.config.language.action_edit+" "+t);var n=Waymark.build_content(t,e,i).get(0);i.bindPopup(n).openPopup()},this.load_file_contents=function(t,e){switch(Waymark=this,t=t.trim(),e=e.toLowerCase()){case"gpx":var i=(new DOMParser).parseFromString(t,"text/xml"),n=toGeoJSON.gpx(i);break;case"kml":var o=(new DOMParser).parseFromString(t,"text/xml");n=toGeoJSON.kml(o);break;case"json":case"geojson":n=JSON.parse(t);break;default:Waymark.message(Waymark.config.language.error_file_type,"error")}void 0!==n?this.load_json(n):Waymark.message(Waymark.config.language.error_file_conversion,"error")},this.load_json=function(t){if(Waymark=this,"object"==typeof t){Waymark.map_data.addData(t),Waymark.map_was_edited();var e=Waymark.map_data.getBounds();e.isValid()&&Waymark.map.fitBounds(e)}}}function Waymark_Map_Factory(){this.instances=[],this.viewer=function(){var t=Object.assign(new Waymark_Map,new Waymark_Map_Viewer);return this.instances.push(t),t},this.editor=function(){var t=Object.assign(new Waymark_Map,new Waymark_Map_Editor);return this.instances.push(t),t}}"undefined"!=typeof module&&(module.exports=toGeoJSON),function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).togpx=t()}}((function(){return function t(e,i,n){function o(r,s){if(!i[r]){if(!e[r]){var l="function"==typeof require&&require;if(!s&&l)return l(r,!0);if(a)return a(r,!0);var h=new Error("Cannot find module '"+r+"'");throw h.code="MODULE_NOT_FOUND",h}var u=i[r]={exports:{}};e[r][0].call(u.exports,(function(t){var i=e[r][1][t];return o(i||t)}),u,u.exports,t,e,i,n)}return i[r].exports}for(var a="function"==typeof require&&require,r=0;r<n.length;r++)o(n[r]);return o}({1:[function(t,e,i){var n=t("jxon");n.config({attrPrefix:"@"}),e.exports=function(t,e){if("string"==typeof(e=function(t,e){for(var i in t)e.hasOwnProperty(i)&&(t[i]=e[i]);return t}({creator:"togpx",metadata:void 0,featureTitle:function t(e){if(!e)return"";if("object"==typeof e.tags){var i=t(e.tags);if(""!==i)return i}return e.name?e.name:e.ref?e.ref:e.id?e.id:""},featureDescription:function t(e){if(!e)return"";if("object"==typeof e.tags)return t(e.tags);var i="";for(var n in e)"object"!=typeof e[n]&&(i+=n+"="+e[n]+"\n");return i.substr(0,i.length-1)},featureLink:void 0,featureCoordTimes:function(t){return t.properties&&(t.properties.times||t.properties.coordTimes)||null}},e||{})).featureCoordTimes){var i=e.featureCoordTimes;e.featureCoordTimes=function(t){return t.properties[i]}}function a(t,i){e.featureLink&&(t.link={"@href":e.featureLink(i.properties)})}var r={gpx:{"@xmlns":"http://www.topografix.com/GPX/1/1","@xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@xsi:schemaLocation":"http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd","@version":"1.1",metadata:null,wpt:[],trk:[]}};return e.creator&&(r.gpx["@creator"]=e.creator),e.metadata?r.gpx.metadata=e.metadata:delete e.metadata,("FeatureCollection"===t.type?t.features:"Feature"===t.type?[t]:[{type:"Feature",properties:{},geometry:t}]).forEach((function t(i){switch(i.geometry.type){case"Point":case"MultiPoint":var n=i.geometry.coordinates;"Point"==i.geometry.type&&(n=[n]),n.forEach((function(t){o={"@lat":t[1],"@lon":t[0],name:e.featureTitle(i.properties),desc:e.featureDescription(i.properties)},void 0!==t[2]&&(o.ele=t[2]),a(o,i),r.gpx.wpt.push(o)}));break;case"LineString":case"MultiLineString":n=i.geometry.coordinates;var s=e.featureCoordTimes(i);"LineString"==i.geometry.type&&(n=[n]),o={name:e.featureTitle(i.properties),desc:e.featureDescription(i.properties)},a(o,i),o.trkseg=[],n.forEach((function(t){var e={trkpt:[]};t.forEach((function(t,i){var n={"@lat":t[1],"@lon":t[0]};void 0!==t[2]&&(n.ele=t[2]),s&&s[i]&&(n.time=s[i]),e.trkpt.push(n)})),o.trkseg.push(e)})),r.gpx.trk.push(o);break;case"Polygon":case"MultiPolygon":o={name:e.featureTitle(i.properties),desc:e.featureDescription(i.properties)},a(o,i),o.trkseg=[];n=i.geometry.coordinates,s=e.featureCoordTimes(i);"Polygon"==i.geometry.type&&(n=[n]),n.forEach((function(t){t.forEach((function(t){var e={trkpt:[]},i=0;t.forEach((function(t){var n={"@lat":t[1],"@lon":t[0]};void 0!==t[2]&&(n.ele=t[2]),s&&s[i]&&(n.time=s[i]),i++,e.trkpt.push(n)})),o.trkseg.push(e)}))})),r.gpx.trk.push(o);break;case"GeometryCollection":i.geometry.geometries.forEach((function(e){var n={properties:i.properties,geometry:e};t(n)}));break;default:console.log("warning: unsupported geometry type: "+i.geometry.type)}})),gpx_str=n.stringify(r),gpx_str}},{jxon:2}],2:[function(t,e,i){var n,o;n=this,o=function(t,e){var i,n={valueKey:"_",attrKey:"$",attrPrefix:"$",lowerCaseTags:!1,trueIsEmpty:!1,autoDate:!1,ignorePrefixedNodes:!1,parseValues:!1},o=[],a=/^\s*$/,r=/^(?:true|false)$/i;return new function(){function s(t){return n.parseValues?a.test(t)?null:r.test(t)?"true"===t.toLowerCase():isFinite(t)?parseFloat(t):n.autoDate&&isFinite(Date.parse(t))?new Date(t):t:t}function l(){}function h(t,e,i,a){var r,u,d=o.length,c=t.hasChildNodes(),_=t.nodeType===t.ELEMENT_NODE&&t.hasAttributes(),p=Boolean(2&e),m=0,f="",g=p?{}:!!n.trueIsEmpty||"";if(c)for(var y,v=0;v<t.childNodes.length;v++)4===(y=t.childNodes.item(v)).nodeType?f+=y.nodeValue:3===y.nodeType?f+=y.nodeValue.trim():1!==y.nodeType||n.ignorePrefixedNodes&&y.prefix||o.push(y);var k,L=o.length,w=s(f);p||!c&&!_||(g=0===e?null===(k=w)?new l:k instanceof Object?k:new k.constructor(k):{});for(var b=d;b<L;b++)r=o[b].nodeName,n.lowerCaseTags&&(r=r.toLowerCase()),u=h(o[b],e,i,a),g.hasOwnProperty(r)?(g[r].constructor!==Array&&(g[r]=[g[r]]),g[r].push(u)):(g[r]=u,m++);if(_){for(var x,W,C=t.attributes.length,M=a?"":n.attrPrefix,P=a?{}:g,E=0;E<C;m++,E++)W=(x=t.attributes.item(E)).name,n.lowerCaseTags&&(W=W.toLowerCase()),P[M+W]=s(x.value.trim());a&&(i&&Object.freeze(P),g[n.attrKey]=P,m-=C-1)}return 3===e||(2===e||1===e&&m>0)&&f?g[n.valueKey]=w:!p&&0===m&&f&&(g=w),i&&(p||m>0)&&Object.freeze(g),o.length=d,g}this.config=function(e){for(var o in e)n[o]=e[o];n.parserErrorHandler&&(i=new t.DOMParser({errorHandler:n.parserErrorHandler,locator:{}}))},l.prototype.toString=function(){return"null"},l.prototype.valueOf=function(){return null},this.xmlToJs=this.build=function(t,e,i,n){var o=arguments.length>1&&"number"==typeof e?3&e:1;return h(t,o,i||!1,arguments.length>3?n:3===o)},this.jsToXml=this.unbuild=function(i,o,a,r){var s=(t.document&&t.document.implementation||new t.DOMImplementation).createDocument(o||null,a||"",r||null);return function t(i,o,a){var r,s,l;if(a.constructor===String||a.constructor===Number||a.constructor===Boolean){if(o.appendChild(i.createTextNode(a.toString())),a===a.valueOf())return}else a.constructor===Date&&o.appendChild(i.createTextNode(a.toISOString()));for(var h in a)if(void 0!==(r=a[h])&&(null===r&&(r={}),!(isFinite(h)||r instanceof Function)))if(h===n.valueKey)null!==r&&!0!==r&&o.appendChild(i.createTextNode(r.constructor===Date?r.toISOString():String(r)));else if(h===n.attrKey)for(var u in r)o.setAttribute(u,r[u]);else if(h===n.attrPrefix+"xmlns")e&&o.setAttribute(h.slice(1),r);else if(h.charAt(0)===n.attrPrefix)o.setAttribute(h.slice(1),r);else if(r.constructor===Array)for(var d in r)r.hasOwnProperty(d)&&(s=(l=r[d]&&r[d][n.attrPrefix+"xmlns"]||o.namespaceURI)?i.createElementNS(l,h):i.createElement(h),t(i,s,r[d]||{}),o.appendChild(s));else s=(l=(r||{})[n.attrPrefix+"xmlns"]||o.namespaceURI)?i.createElementNS(l,h):i.createElement(h),r instanceof Object?t(i,s,r):null===r||!0===r&&n.trueIsEmpty||s.appendChild(i.createTextNode(r.toString())),o.appendChild(s)}(s,s.documentElement||s,i),s},this.stringToXml=function(e){return i||(i=new t.DOMParser),i.parseFromString(e,"application/xml")},this.xmlToString=function(e){return void 0!==e.xml?e.xml:(new t.XMLSerializer).serializeToString(e)},this.stringToJs=function(t){var e=this.stringToXml(t);return this.xmlToJs(e)},this.jsToString=this.stringify=function(t,e,i,n){return this.xmlToString(this.jsToXml(t,e,i,n))},this.each=function(t,e,i){t instanceof Array?t.forEach(e,i):[t].forEach(e,i)}}},"object"==typeof i?"object"==typeof window&&window.DOMImplementation&&window.XMLSerializer&&window.DOMParser?e.exports=o(window):e.exports=o(t("xmldom"),!0):n.JXON=o(window)},{xmldom:3}],3:[function(t,e,i){},{}]},{},[1])(1)})),function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).tokml=t()}}((function(){return function t(e,i,n){function o(r,s){if(!i[r]){if(!e[r]){var l="function"==typeof require&&require;if(!s&&l)return l(r,!0);if(a)return a(r,!0);var h=new Error("Cannot find module '"+r+"'");throw h.code="MODULE_NOT_FOUND",h}var u=i[r]={exports:{}};e[r][0].call(u.exports,(function(t){return o(e[r][1][t]||t)}),u,u.exports,t,e,i,n)}return i[r].exports}for(var a="function"==typeof require&&require,r=0;r<n.length;r++)o(n[r]);return o}({1:[function(t,e,i){var n=t("xml-escape"),o=t("strxml").tag;function a(t,e){return function(i){if(!i.properties||!r.valid(i.geometry))return"";var a=r.any(i.geometry);if(!a)return"";var s="",u="";if(t.simplestyle){var d=function(t){var e="";t["marker-symbol"]&&(e=e+"ms"+t["marker-symbol"]);t["marker-color"]&&(e=e+"mc"+t["marker-color"].replace("#",""));t["marker-size"]&&(e=e+"ms"+t["marker-size"]);t.stroke&&(e=e+"s"+t.stroke.replace("#",""));t["stroke-width"]&&(e=e+"sw"+t["stroke-width"].toString().replace(".",""));t["stroke-opacity"]&&(e=e+"mo"+t["stroke-opacity"].toString().replace(".",""));t.fill&&(e=e+"f"+t.fill.replace("#",""));t["fill-opacity"]&&(e=e+"fo"+t["fill-opacity"].toString().replace(".",""));return e}(i.properties);d&&(r.isPoint(i.geometry)&&function(t){return!!(t["marker-size"]||t["marker-symbol"]||t["marker-color"])}(i.properties)?(-1===e.indexOf(d)&&(s=function(t,e){return o("Style",{id:e},o("IconStyle",o("Icon",o("href",function(t){var e=t["marker-size"]||"medium",i=t["marker-symbol"]?"-"+t["marker-symbol"]:"",n=(t["marker-color"]||"7e7e7e").replace("#","");return"https://api.tiles.mapbox.com/v3/marker/pin-"+e.charAt(0)+i+"+"+n+".png"}(t))))+o("hotSpot",{xunits:"fraction",yunits:"fraction",x:"0.5",y:"0.5"},""))}(i.properties,d),e.push(d)),u=o("styleUrl","#"+d)):(r.isPolygon(i.geometry)||r.isLine(i.geometry))&&function(t){for(var e in t)if({stroke:!0,"stroke-opacity":!0,"stroke-width":!0,fill:!0,"fill-opacity":!0}[e])return!0}(i.properties)&&(-1===e.indexOf(d)&&(s=function(t,e){var i=o("LineStyle",o("color",h(t.stroke,t["stroke-opacity"])||"ff555555")+o("width",{},void 0===t["stroke-width"]?2:t["stroke-width"])),n="";(t.fill||t["fill-opacity"])&&(n=o("PolyStyle",o("color",{},h(t.fill,t["fill-opacity"])||"88555555")));return o("Style",{id:e},i+n)}(i.properties,d),e.push(d)),u=o("styleUrl","#"+d)))}var c={};return i.id&&(c.id=i.id),s+o("Placemark",c,function(t,e){return t[e.name]?o("name",n(t[e.name])):""}(i.properties,t)+function(t,e){return t[e.description]?o("description",n(t[e.description])):""}(i.properties,t)+function(t){return o("ExtendedData",{},function(t){var e=[];for(var i in t)t[i]?e.push([i,t[i]]):e.push([i,""]);return e}(t).map(l).join(""))}(i.properties)+function(t,e){return t[e.timestamp]?o("TimeStamp",o("when",n(t[e.timestamp]))):""}(i.properties,t)+a+u)}}e.exports=function(t,e){return'<?xml version="1.0" encoding="UTF-8"?>'+o("kml",{xmlns:"http://www.opengis.net/kml/2.2"},o("Document",function(t){return void 0!==t.documentName?o("name",t.documentName):""}(e=e||{documentName:void 0,documentDescription:void 0,name:"name",description:"description",simplestyle:!1,timestamp:"timestamp"})+function(t){return void 0!==t.documentDescription?o("description",t.documentDescription):""}(e)+function(t,e){if(!t.type)return"";var i=[];switch(t.type){case"FeatureCollection":return t.features?t.features.map(a(e,i)).join(""):"";case"Feature":return a(e,i)(t);default:return a(e,i)({type:"Feature",geometry:t,properties:{}})}}(t,e)))};var r={Point:function(t){return o("Point",o("coordinates",t.coordinates.join(",")))},LineString:function(t){return o("LineString",o("coordinates",s(t.coordinates)))},Polygon:function(t){if(!t.coordinates.length)return"";var e=t.coordinates[0],i=t.coordinates.slice(1),n=o("outerBoundaryIs",o("LinearRing",o("coordinates",s(e)))),a=i.map((function(t){return o("innerBoundaryIs",o("LinearRing",o("coordinates",s(t))))})).join("");return o("Polygon",n+a)},MultiPoint:function(t){return t.coordinates.length?o("MultiGeometry",t.coordinates.map((function(t){return r.Point({coordinates:t})})).join("")):""},MultiPolygon:function(t){return t.coordinates.length?o("MultiGeometry",t.coordinates.map((function(t){return r.Polygon({coordinates:t})})).join("")):""},MultiLineString:function(t){return t.coordinates.length?o("MultiGeometry",t.coordinates.map((function(t){return r.LineString({coordinates:t})})).join("")):""},GeometryCollection:function(t){return o("MultiGeometry",t.geometries.map(r.any).join(""))},valid:function(t){return t&&t.type&&(t.coordinates||"GeometryCollection"===t.type&&t.geometries&&t.geometries.every(r.valid))},any:function(t){return r[t.type]?r[t.type](t):""},isPoint:function(t){return"Point"===t.type||"MultiPoint"===t.type},isPolygon:function(t){return"Polygon"===t.type||"MultiPolygon"===t.type},isLine:function(t){return"LineString"===t.type||"MultiLineString"===t.type}};function s(t){return t.map((function(t){return t.join(",")})).join(" ")}function l(t){return o("Data",{name:t[0]},o("value",{},n(t[1]?t[1].toString():"")))}function h(t,e){if("string"!=typeof t)return"";if(3===(t=t.replace("#","").toLowerCase()).length)t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2];else if(6!==t.length)return"";var i=t[0]+t[1],n=t[2]+t[3],o=t[4]+t[5],a="ff";return"number"==typeof e&&e>=0&&e<=1&&((a=(255*e).toString(16)).indexOf(".")>-1&&(a=a.substr(0,a.indexOf("."))),a.length<2&&(a="0"+a)),a+o+n+i}},{strxml:2,"xml-escape":3}],2:[function(t,e,i){var n=t("xml-escape");function o(t){return Object.keys(t).length?" "+Object.keys(t).map((function(e){return e+'="'+n(t[e])+'"'})).join(" "):""}e.exports.attr=o,e.exports.tagClose=function(t,e){return"<"+t+o(e)+"/>"},e.exports.tag=function(t,e,i){(Array.isArray(e)||"string"==typeof e)&&(i=e,e={});Array.isArray(i)&&(i="\n"+i.map((function(t){return"  "+t})).join("\n")+"\n");return"<"+t+o(e)+">"+i+"</"+t+">"}},{"xml-escape":3}],3:[function(t,e,i){(e.exports=function t(e,i){var n;if(null!=e)return e=e.toString(),i=(i||"").replace(/[^&"<>\']/g,""),n="([&\"<>'])".replace(new RegExp("["+i+"]","g"),""),e.replace(new RegExp(n,"g"),(function(e,i){return t.map[i]}))}).map={">":"&gt;","<":"&lt;","'":"&apos;",'"':"&quot;","&":"&amp;"}},{}]},{},[1])(1)})),window.Waymark_Map_Factory=new Waymark_Map_Factory;
     9 */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={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};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;s<r.length;s++)n.push(a+"="+encodeURIComponent(r[s]));else n.push(a+"="+encodeURIComponent(r))}return(e&&-1!==e.indexOf("?")?"&":"?")+n.join("&")}var u=Waymark_L.Class.extend({options:{service_url:"https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer"},initialize:function(t,e){Waymark_L.setOptions(this,e),this._accessToken=t},geocode:function(t,e,i){var n={SingleLine:t,outFields:"Addr_Type",forStorage:!1,maxLocations:10,f:"json"};this._key&&this._key.length&&(n.token=this._key),s(this.options.service_url+"/findAddressCandidates",Waymark_L.extend(n,this.options.geocodingQueryParams),(function(t){var n,o,a,r=[];if(t.candidates&&t.candidates.length)for(var s=0;s<=t.candidates.length-1;s++)n=t.candidates[s],o=Waymark_L.latLng(n.location.y,n.location.x),a=Waymark_L.latLngBounds(Waymark_L.latLng(n.extent.ymax,n.extent.xmax),Waymark_L.latLng(n.extent.ymin,n.extent.xmin)),r[s]={name:n.address,bbox:a,center:o};e.call(i,r)}))},suggest:function(t,e,i){return this.geocode(t,e,i)},reverse:function(t,e,i,n){var o={location:encodeURIComponent(t.lng)+","+encodeURIComponent(t.lat),distance:100,f:"json"};s(this.options.service_url+"/reverseGeocode",o,(function(t){var e,o=[];t&&!t.error&&(e=Waymark_L.latLng(t.location.y,t.location.x),o.push({name:t.address.Match_addr,center:e,bounds:Waymark_L.latLngBounds(e,e)})),i.call(n,o)}))}});var d=Waymark_L.Class.extend({initialize:function(t){this.key=t},geocode:function(t,e,i){r("https://dev.virtualearth.net/REST/v1/Locations",{query:t,key:this.key},(function(t){var n=[];if(t.resourceSets.length>0)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:"<insert your app_id here>",app_code:"<insert your app_code here>",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<arguments.length;t++)arguments[t]&&e.push(arguments[t]);return e.join(", ")},geocode:function(t,e,i){s(this.options.serviceUrl+"/address",{key:this._key,location:t,limit:5,outFormat:"json"},Waymark_L.bind((function(t){var n,o,a=[];if(t.results&&t.results[0].locations)for(var r=t.results[0].locations.length-1;r>=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:"<insert your userId here>",apiKey:"<insert your apiKey here>",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('<span class="'+(i.length>0?"leaflet-control-geocoder-address-detail":"")+'">{postcode} {city} {town} {village} {hamlet}</span>'),(e.state||e.country)&&i.push('<span class="'+(i.length>0?"leaflet-control-geocoder-address-context":"")+'">{state} {country}</span>'),l(i.join("<br/>"),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;s<t.results.length;s++)a=t.results[s],n=Waymark_L.latLng(a.geometry),o=a.annotations&&a.annotations.bounds?Waymark_L.latLngBounds(Waymark_L.latLng(a.annotations.bounds.northeast),Waymark_L.latLng(a.annotations.bounds.southwest)):Waymark_L.latLngBounds(n,n),r.push({name:a.formatted,bbox:o,center:n});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,{key:this._accessToken,q:[t.lat,t.lng].join(",")},(function(t){var e,o,a,r=[];if(t.results&&t.results.length)for(var s=0;s<t.results.length;s++)a=t.results[s],e=Waymark_L.latLng(a.geometry),o=a.annotations&&a.annotations.bounds?Waymark_L.latLngBounds(Waymark_L.latLng(a.annotations.bounds.northeast),Waymark_L.latLng(a.annotations.bounds.southwest)):Waymark_L.latLngBounds(e,e),r.push({name:a.formatted,bbox:o,center:e});i.call(n,r)}))}});var L=Waymark_L.Class.extend({options:{serviceUrl:"https://api.geocode.earth/v1",geocodingQueryParams:{},reverseQueryParams:{}},initialize:function(t,e){Waymark_L.Util.setOptions(this,e),this._apiKey=t,this._lastSuggest=0},geocode:function(t,e,i){var n=this;s(this.options.serviceUrl+"/search",Waymark_L.extend({api_key:this._apiKey,text:t},this.options.geocodingQueryParams),(function(t){e.call(i,n._parseResults(t,"bbox"))}))},suggest:function(t,e,i){var n=this;s(this.options.serviceUrl+"/autocomplete",Waymark_L.extend({api_key:this._apiKey,text:t},this.options.geocodingQueryParams),Waymark_L.bind((function(t){t.geocoding.timestamp>this._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;e<t.features.length;e++)n=(i=t.features[e]).geometry.coordinates,o=Waymark_L.latLng(n[1],n[0]),r=(a=i.properties.extent)?Waymark_L.latLngBounds([a[1],a[0]],[a[3],a[2]]):Waymark_L.latLngBounds(o,o),s.push({name:this._decodeFeatureName(i),html:this.options.htmlTemplate?this.options.htmlTemplate(i):void 0,center:o,bbox:r,properties:i.properties});return s},_decodeFeatureName:function(t){return(this.options.nameProperties||[]).map((function(e){return t.properties[e]})).filter((function(t){return!!t})).join(", ")}});var E=Waymark_L.Class.extend({options:{serviceUrl:"https://api.what3words.com/v2/"},initialize:function(t){this._accessToken=t},geocode:function(t,e,i){s(this.options.serviceUrl+"forward",{key:this._accessToken,addr:t.split(/\s+/).join(".")},(function(t){var n,o,a=[];t.geometry&&(n=Waymark_L.latLng(t.geometry.lat,t.geometry.lng),o=Waymark_L.latLngBounds(n,n),a[0]={name:t.words,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+"reverse",{key:this._accessToken,coords:[t.lat,t.lng].join(",")},(function(t){var e,o,a=[];200==t.status.status&&(e=Waymark_L.latLng(t.geometry.lat,t.geometry.lng),o=Waymark_L.latLngBounds(e,e),a[0]={name:t.words,bbox:o,center:e}),i.call(n,a)}))}});var T=Object.freeze({ArcGis:u,arcgis:function(t,e){return new u(t,e)},Bing:d,bing:function(t){return new d(t)},Google:c,google:function(t,e){return new c(t,e)},HERE:_,here:function(t){return new _(t)},LatLng:p,latLng:function(t){return new p(t)},Mapbox:m,mapbox:function(t,e){return new m(t,e)},MapQuest:f,mapQuest:function(t,e){return new f(t,e)},Neutrino:g,neutrino:function(t){return new g(t)},Nominatim:y,nominatim:function(t){return new y(t)},OpenLocationCode:v,openLocationCode:function(t){return new v(t)},OpenCage:k,opencage:function(t){return new k(t)},Pelias:L,pelias:w,GeocodeEarth:b,geocodeEarth:x,Mapzen:W,mapzen:C,Openrouteservice:M,openrouteservice:function(t,e){return new M(t,e)},Photon:P,photon:function(t){return new P(t)},What3Words:E,what3words:function(t){return new E(t)}}),S=Waymark_L.Control.extend({options:{showUniqueResult:!0,showResultIcons:!1,collapsed:!0,expand:"touch",position:"topright",placeholder:"Search...",errorMessage:"Nothing found.",queryMinLength:1,suggestMinLength:3,suggestTimeout:250,defaultMarkGeocode:!0},includes:Waymark_L.Evented.prototype||Waymark_L.Mixin.Events,initialize:function(t){Waymark_L.Util.setOptions(this,t),this.options.geocoder||(this.options.geocoder=new y),this._requestCount=0},addThrobberClass:function(){Waymark_L.DomUtil.addClass(this._container,"leaflet-control-geocoder-throbber")},removeThrobberClass:function(){Waymark_L.DomUtil.removeClass(this._container,"leaflet-control-geocoder-throbber")},onAdd:function(t){var e,i="leaflet-control-geocoder",n=Waymark_L.DomUtil.create("div",i+" leaflet-bar"),o=Waymark_L.DomUtil.create("button",i+"-icon",n),a=this._form=Waymark_L.DomUtil.create("div",i+"-form",n);return this._map=t,this._container=n,o.innerHTML="&nbsp;",o.type="button",(e=this._input=Waymark_L.DomUtil.create("input","",a)).type="text",e.placeholder=this.options.placeholder,Waymark_L.DomEvent.disableClickPropagation(e),this._errorElement=Waymark_L.DomUtil.create("div",i+"-form-no-error",n),this._errorElement.innerHTML=this.options.errorMessage,this._alts=Waymark_L.DomUtil.create("ul",i+"-alternatives leaflet-control-geocoder-alternatives-minimized",n),Waymark_L.DomEvent.disableClickPropagation(this._alts),Waymark_L.DomEvent.addListener(e,"keydown",this._keydown,this),this.options.geocoder.suggest&&Waymark_L.DomEvent.addListener(e,"input",this._change,this),Waymark_L.DomEvent.addListener(e,"blur",(function(){this.options.collapsed&&!this._preventBlurCollapse&&this._collapse(),this._preventBlurCollapse=!1}),this),this.options.collapsed?"click"===this.options.expand?Waymark_L.DomEvent.addListener(n,"click",(function(t){0===t.button&&2!==t.detail&&this._toggle()}),this):Waymark_L.Browser.touch&&"touch"===this.options.expand?Waymark_L.DomEvent.addListener(n,"touchstart mousedown",(function(t){this._toggle(),t.preventDefault(),t.stopPropagation()}),this):(Waymark_L.DomEvent.addListener(n,"mouseover",this._expand,this),Waymark_L.DomEvent.addListener(n,"mouseout",this._collapse,this),this._map.on("movestart",this._collapse,this)):(this._expand(),Waymark_L.Browser.touch?Waymark_L.DomEvent.addListener(n,"touchstart",(function(){this._geocode()}),this):Waymark_L.DomEvent.addListener(n,"click",(function(){this._geocode()}),this)),this.options.defaultMarkGeocode&&this.on("markgeocode",this.markGeocode,this),this.on("startgeocode",this.addThrobberClass,this),this.on("finishgeocode",this.removeThrobberClass,this),this.on("startsuggest",this.addThrobberClass,this),this.on("finishsuggest",this.removeThrobberClass,this),Waymark_L.DomEvent.disableClickPropagation(n),n},_geocodeResult:function(t,e){if(!e&&this.options.showUniqueResult&&1===t.length)this._geocodeResultSelected(t[0]);else if(t.length>0){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;i<t.length;i++)this._alts.appendChild(this._createAlt(t[i],i))}else Waymark_L.DomUtil.addClass(this._container,"leaflet-control-geocoder-options-error"),Waymark_L.DomUtil.addClass(this._errorElement,"leaflet-control-geocoder-error")},markGeocode:function(t){return t=t.geocode||t,this._map.fitBounds(t.bbox),this._geocodeMarker&&this._map.removeLayer(this._geocodeMarker),this._geocodeMarker=new Waymark_L.Marker(t.center).bindPopup(t.html||t.name).addTo(this._map).openPopup(),this},_geocode:function(t){var e=this._input.value;if(t||!(e.length<this.options.queryMinLength)){var i=++this._requestCount,n=t?"suggest":"geocode",o={input:e};this._lastGeocode=e,t||this._clearResults(),this.fire("start"+n,o),this.options.geocoder[n](e,(function(e){i===this._requestCount&&(o.results=e,this.fire("finish"+n,o),this._geocodeResult(e,t))}),this)}},_geocodeResultSelected:function(t){this.fire("markgeocode",{geocode:t})},_toggle:function(){Waymark_L.DomUtil.hasClass(this._container,"leaflet-control-geocoder-expanded")?this._collapse():this._expand()},_expand:function(){Waymark_L.DomUtil.addClass(this._container,"leaflet-control-geocoder-expanded"),this._input.select(),this.fire("expand")},_collapse:function(){Waymark_L.DomUtil.removeClass(this._container,"leaflet-control-geocoder-expanded"),Waymark_L.DomUtil.addClass(this._alts,"leaflet-control-geocoder-alternatives-minimized"),Waymark_L.DomUtil.removeClass(this._errorElement,"leaflet-control-geocoder-error"),Waymark_L.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-open"),Waymark_L.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-error"),this._input.blur(),this.fire("collapse")},_clearResults:function(){Waymark_L.DomUtil.addClass(this._alts,"leaflet-control-geocoder-alternatives-minimized"),this._selection=null,Waymark_L.DomUtil.removeClass(this._errorElement,"leaflet-control-geocoder-error"),Waymark_L.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-open"),Waymark_L.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-error")},_createAlt:function(t,e){var i=Waymark_L.DomUtil.create("li",""),n=Waymark_L.DomUtil.create("a","",i),o=this.options.showResultIcons&&t.icon?Waymark_L.DomUtil.create("img","",n):null,a=t.html?void 0:document.createTextNode(t.name);return o&&(o.src=t.icon),i.setAttribute("data-result-index",e),t.html?n.innerHTML=n.innerHTML+t.html:n.appendChild(a),Waymark_L.DomEvent.addListener(i,"mousedown touchstart",(function(e){this._preventBlurCollapse=!0,Waymark_L.DomEvent.stop(e),this._geocodeResultSelected(t),Waymark_L.DomEvent.on(i,"click",(function(){this.options.collapsed?this._collapse():this._clearResults()}),this)}),this),i},_keydown:function(t){var e=this,i=function(t){e._selection&&(Waymark_L.DomUtil.removeClass(e._selection,"leaflet-control-geocoder-selected"),e._selection=e._selection[t>0?"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:'<svg xmlns="http://www.w3.org/2000/svg" width="'+o+'" height="'+o+'" version="1.1" viewBox="-'+n+" -"+n+" "+o+" "+o+'"><circle r="'+i+'" style="'+e+'" /></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:'<svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+o+'" version="1.1" viewBox="-'+n/2+" 0 "+n+" "+o+'" style="transform: rotate('+this._heading+'deg)"><path d="'+a+'" style="'+e+'" /></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:'<i class="elevation-waypoint-icon"></i>',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:'<i class="elevation-position-icon"></i>',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("<b>"+o+"</b>"+(n.length>0?"<br>"+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=o<i?i:o,a=a>i?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.yAxisMin<e[0]||i.forceAxisBounds)&&(e[0]=i.yAxisMin),void 0!==i.yAxisMax&&(i.yAxisMax>e[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);o<i&&(i=o,e=n)}),e},_findItemForX:function(t){let e=this._data?this._data:[0,1];return(0,d3.bisector(t=>t.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<this._zFollow?this._zFollow:e,this._map.setView(t.latlng,e,{animate:!0,duration:.25})},_showPositionMarker:function(t){this._selectedItem=t,this._map&&!this._map.getPane("elevationPane")&&(this._map.createPane("elevationPane"),this._map.getPane("elevationPane").style.zIndex=625,this._map.getPane("elevationPane").style.pointerEvents="none"),"elevation-line"==this.options.marker?this._updatePositionMarker(t):"position-marker"==this.options.marker&&this._updateLeafletMarker(t)},_updateAxis:function(){this._grid.selectAll("g").remove(),this._axis.selectAll("g").remove(),this._appendXGrid(this._grid),this._appendYGrid(this._grid),this._appendXaxis(this._axis),this._appendYaxis(this._axis)},_updateHeightIndicator:function(t){let e=this.options,i=e.hoverNumber.formatter(t.z,e.hoverNumber.decimalsY),n=(e.hoverNumber.formatter(t.dist,e.hoverNumber.decimalsX),this._height()/this._maxElevation*t.z),o=t.y-n;this._mouseHeightFocus.attr("x1",t.x).attr("x2",t.x).attr("y1",t.y).attr("y2",o).style("visibility","visible"),this._mouseHeightFocusLabel.attr("x",t.x).attr("y",o).text(i+" "+this._yLabel).style("visibility","visible")},_updateLeafletMarker:function(t){let e=t.latlng;this._marker?this._marker.setLatLng(e):(this._marker=new L.Marker(e,{icon:this.options.markerIcon,zIndexOffset:1e6}),this._marker.addTo(this._map,{pane:"elevationPane"}))},_updatePointG:function(t){this._pointG.attr("transform","translate("+t.x+","+t.y+")").style("visibility","visible")},_updatePositionMarker:function(t){let e=this._map.latLngToLayerPoint(t.latlng),i={dist:t.dist,x:e.x,y:e.y,z:t.z};if(!this._mouseHeightFocus){L.svg({pane:"elevationPane"}).addTo(this._map);let t=d3.select(this._map.getContainer()).select(".leaflet-elevation-pane svg");this._appendPositionMarker(t)}this._updatePointG(i),this._updateHeightIndicator(i)},_updateSummary:function(){this.summaryDiv.innerHTML="",this.track_info=this.track_info||{},this.track_info.distance=this._distance||0,this.track_info.elevation_max=this._maxElevation||0,this.track_info.elevation_min=this._minElevation||0,this.track_info.ascent=this._ascent||0,this.track_info.descent=this._descent||0,this.options.summary&&(this.summaryDiv.innerHTML+='<span class="totlen"><span class="summarylabel">'+L._("Total Length: ")+'</span><span class="summaryvalue">'+this.track_info.distance.toFixed(2)+" "+this._xLabel+'</span></span><span class="maxele"><span class="summarylabel">'+L._("Max Elevation: ")+'</span><span class="summaryvalue">'+this.track_info.elevation_max.toFixed(2)+" "+this._yLabel+'</span></span><span class="minele"><span class="summarylabel">'+L._("Min Elevation: ")+'</span><span class="summaryvalue">'+this.track_info.elevation_min.toFixed(2)+" "+this._yLabel+'</span></span><span class="totasc"><span class="summarylabel">'+L._("Total Ascent: ")+'</span><span class="summaryvalue">'+this.track_info.ascent.toFixed(0)+" "+this._yLabel+'</span></span><span class="totdesc"><span class="summarylabel">'+L._("Total Descent: ")+'</span><span class="summaryvalue">'+this.track_info.descent.toFixed(0)+" "+this._yLabel+"</span></span>"),this.options.downloadLink&&this._downloadURL&&(this.summaryDiv.innerHTML+='<span class="download"><a href="#">'+L._("Download")+"</a></span>",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<t.length;e++)this.initVertexMarkers(t[e])},getLatLngs:function(){return this.feature.getLatLngs()},reset:function(){this.editLayer.clearLayers(),this.initVertexMarkers()},addVertexMarker:function(t,e){return new this.tools.options.vertexMarkerClass(t,e,this)},onNewVertex:function(t){this.fireAndForward("editable:vertex:new",{latlng:t.latlng,vertex:t})},addVertexMarkers:function(t){for(var e=0;e<t.length;e++)this.addVertexMarker(t[e],t)},refreshVertexMarkers:function(t){t=t||this.getDefaultLatLngs();for(var e=0;e<t.length;e++)t[e].__vertex.update()},addMiddleMarker:function(t,e,i){return new this.tools.options.middleMarkerClass(t,e,i,this)},onVertexMarkerClick:function(t){if(Waymark_L.Editable.makeCancellable(t),this.fireAndForward("editable:vertex:click",t),!(t._cancelled||this.tools.drawing()&&this.tools._drawingEditor!==this)){var e,i=t.vertex.getIndex();t.originalEvent.ctrlKey?this.onVertexMarkerCtrlClick(t):t.originalEvent.altKey?this.onVertexMarkerAltClick(t):t.originalEvent.shiftKey?this.onVertexMarkerShiftClick(t):t.originalEvent.metaKey?this.onVertexMarkerMetaKeyClick(t):i===t.vertex.getLastIndex()&&this._drawing===Waymark_L.Editable.FORWARD?i>=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.length<this.MIN_VERTEX&&this.deleteShape(this._drawnLatLngs),Waymark_L.Editable.BaseEditor.prototype.endDrawing.call(this),delete this._drawnLatLngs},addLatLng:function(t){this._drawing===Waymark_L.Editable.FORWARD?this._drawnLatLngs.push(t):this._drawnLatLngs.unshift(t),this.feature._bounds.extend(t);var e=this.addVertexMarker(t,this._drawnLatLngs);this.onNewVertex(e),this.refresh()},newPointForward:function(t){this.addLatLng(t),this.tools.attachForwardLineGuide(),this.tools.anchorForwardLineGuide(t)},newPointBackward:function(t){this.addLatLng(t),this.tools.anchorBackwardLineGuide(t)},push:function(t){if(!t)return console.error("Waymark_L.Editable.PathEditor.push expect a valid latlng as parameter");this._drawing===Waymark_L.Editable.FORWARD?this.newPointForward(t):this.newPointBackward(t)},removeLatLng:function(t){t.__vertex.delete(),this.refresh()},pop:function(){var t;if(!(this._drawnLatLngs.length<=1))return t=this._drawing===Waymark_L.Editable.FORWARD?this._drawnLatLngs[this._drawnLatLngs.length-1]:this._drawnLatLngs[0],this.removeLatLng(t),this._drawing===Waymark_L.Editable.FORWARD?this.tools.anchorForwardLineGuide(this._drawnLatLngs[this._drawnLatLngs.length-1]):this.tools.anchorForwardLineGuide(this._drawnLatLngs[0]),t},processDrawingClick:function(t){t.vertex&&t.vertex.editor===this||(this._drawing===Waymark_L.Editable.FORWARD?this.newPointForward(t.latlng):this.newPointBackward(t.latlng),this.fireAndForward("editable:drawing:clicked",t))},onDrawingMouseMove:function(t){Waymark_L.Editable.BaseEditor.prototype.onDrawingMouseMove.call(this,t),this._drawing&&(this.tools.moveForwardLineGuide(t.latlng),this.tools.moveBackwardLineGuide(t.latlng))},refresh:function(){this.feature.redraw(),this.onEditing()},newShape:function(t){var e=this.addNewEmptyShape();e&&(this.setDrawnLatLngs(e[0]||e),this.startDrawingForward(),this.fireAndForward("editable:shape:new",{shape:e}),t&&this.newPointForward(t))},deleteShape:function(t,e){var i={shape:t};if(Waymark_L.Editable.makeCancellable(i),this.fireAndForward("editable:shape:delete",i),!i._cancelled)return t=this._deleteShape(t,e),this.ensureNotFlat&&this.ensureNotFlat(),this.feature.setLatLngs(this.getLatLngs()),this.refresh(),this.reset(),this.fireAndForward("editable:shape:deleted",{shape:t}),t},_deleteShape:function(t,e){if((e=e||this.getLatLngs()).length){var i=this,n=function(t,e){return t.splice(t.indexOf(e),1),t.length||i._deleteShape(t),e};if(e===t)return function(t,e){return t.splice(0,Number.MAX_VALUE)}(e);for(var o=0;o<e.length;o++){if(e[o]===t)return n(e,t);if(-1!==e[o].indexOf(t))return n(e[o],t)}}},deleteShapeAt:function(t){var e=this.feature.shapeAt(t);if(e)return this.deleteShape(e)},appendShape:function(t){this.insertShape(t)},prependShape:function(t){this.insertShape(t,0)},insertShape:function(t,e){this.ensureMulti(),t=this.formatShape(t),void 0===e&&(e=this.feature._latlngs.length),this.feature._latlngs.splice(e,0,t),this.feature.redraw(),this._enabled&&this.reset()},extendBounds:function(t){this.feature._bounds.extend(t.vertex.latlng)},onDragStart:function(t){this.editLayer.clearLayers(),Waymark_L.Editable.BaseEditor.prototype.onDragStart.call(this,t)},onDragEnd:function(t){this.initVertexMarkers(),Waymark_L.Editable.BaseEditor.prototype.onDragEnd.call(this,t)}}),Waymark_L.Editable.PolylineEditor=Waymark_L.Editable.PathEditor.extend({startDrawingBackward:function(){this._drawing=Waymark_L.Editable.BACKWARD,this.startDrawing()},continueBackward:function(t){this.drawing()||(t=t||this.getDefaultLatLngs(),this.setDrawnLatLngs(t),t.length>0&&(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;n<e.length;n++)e[n].update(i[n])}}),Waymark_L.Editable.CircleEditor=Waymark_L.Editable.PathEditor.extend({MIN_VERTEX:2,options:{skipMiddleMarkers:!0},initialize:function(t,e,i){Waymark_L.Editable.PathEditor.prototype.initialize.call(this,t,e,i),this._resizeLatLng=this.computeResizeLatLng()},computeResizeLatLng:function(){var t=(this.feature._radius||this.feature._mRadius)*Math.cos(Math.PI/4),e=this.map.project(this.feature._latlng);return this.map.unproject([e.x+t,e.y-t])},updateResizeLatLng:function(){this._resizeLatLng.update(this.computeResizeLatLng()),this._resizeLatLng.__vertex.update()},getLatLngs:function(){return[this.feature._latlng,this._resizeLatLng]},getDefaultLatLngs:function(){return this.getLatLngs()},onVertexMarkerDrag:function(t){1===t.vertex.getIndex()?this.resize(t):this.updateResizeLatLng(t),Waymark_L.Editable.PathEditor.prototype.onVertexMarkerDrag.call(this,t)},resize:function(t){var e=this.feature._latlng.distanceTo(t.latlng);this.feature.setRadius(e)},onDrawingMouseDown:function(t){Waymark_L.Editable.PathEditor.prototype.onDrawingMouseDown.call(this,t),this._resizeLatLng.update(t.latlng),this.feature._latlng.update(t.latlng),this.connect(),t.originalEvent._simulated=!1,this.map.dragging._draggable._onUp(t.originalEvent),this._resizeLatLng.__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)},onDrag:function(t){Waymark_L.Editable.PathEditor.prototype.onDrag.call(this,t),this.feature.dragging.updateLatLng(this._resizeLatLng)}});var e={createEditor:function(t){t=t||this._map;var e=(this.options.editOptions||{}).editTools||t.editTools;if(!e)throw Error("Unable to detect Editable instance.");return new(this.options.editorClass||this.getEditorClass(e))(t,this,this.options.editOptions)},enableEdit:function(t){return this.editor||this.createEditor(t),this.editor.enable(),this.editor},editEnabled:function(){return this.editor&&this.editor.enabled()},disableEdit:function(){this.editor&&(this.editor.disable(),delete this.editor)},toggleEdit:function(){this.editEnabled()?this.disableEdit():this.enableEdit()},_onEditableAdd:function(){this.editor&&this.enableEdit()}},i={getEditorClass:function(t){return t&&t.options.polylineEditorClass?t.options.polylineEditorClass:Waymark_L.Editable.PolylineEditor},shapeAt:function(t,e){var i=null;if(!(e=e||this._latlngs).length)return i;if(l(e)&&this.isInLatLngs(t,e))i=e;else for(var n=0;n<e.length;n++)if(this.isInLatLngs(t,e[n]))return e[n];return i},isInLatLngs:function(t,e){if(!e)return!1;var i,n,o,a,r=[],s=this._clickTolerance();if(this._projectLatlngs(e,r,this._pxBounds),r=r[0],a=this._map.latLngToLayerPoint(t),!this._pxBounds.contains(a))return!1;for(i=1,o=r.length,n=0;i<o;n=i++)if(Waymark_L.LineUtil.pointToSegmentDistance(a,r[n],r[i])<=s)return!0;return!1}},n={getEditorClass:function(t){return t&&t.options.polygonEditorClass?t.options.polygonEditorClass:Waymark_L.Editable.PolygonEditor},shapeAt:function(t,e){var i=null;if(!(e=e||this._latlngs).length)return i;if(l(e)&&this.isInLatLngs(t,e))i=e;else if(l(e[0])&&this.isInLatLngs(t,e[0]))i=e;else for(var n=0;n<e.length;n++)if(this.isInLatLngs(t,e[n][0]))return e[n];return i},isInLatLngs:function(t,e){var i,n,o,a,r,s=!1;for(o=0,a=(r=e.length)-1;o<r;a=o++)i=e[o],n=e[a],i.lat>t.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<e.length;n++)if(-1!==(i=Waymark_L.Util.indexOf(e[n],t)))return e[n]}}},o={getEditorClass:function(t){return t&&t.options.markerEditorClass?t.options.markerEditorClass:Waymark_L.Editable.MarkerEditor}},a={getEditorClass:function(t){return t&&t.options.rectangleEditorClass?t.options.rectangleEditorClass:Waymark_L.Editable.RectangleEditor}},r={getEditorClass:function(t){return t&&t.options.circleEditorClass?t.options.circleEditorClass:Waymark_L.Editable.CircleEditor}},s=function(){this.on("add",this._onEditableAdd)},l=Waymark_L.LineUtil.isFlat||Waymark_L.LineUtil._flat||Waymark_L.Polyline._flat;Waymark_L.Polyline&&(Waymark_L.Polyline.include(e),Waymark_L.Polyline.include(i),Waymark_L.Polyline.addInitHook(s)),Waymark_L.Polygon&&(Waymark_L.Polygon.include(e),Waymark_L.Polygon.include(n)),Waymark_L.Marker&&(Waymark_L.Marker.include(e),Waymark_L.Marker.include(o),Waymark_L.Marker.addInitHook(s)),Waymark_L.Rectangle&&(Waymark_L.Rectangle.include(e),Waymark_L.Rectangle.include(a)),Waymark_L.Circle&&(Waymark_L.Circle.include(e),Waymark_L.Circle.include(r)),Waymark_L.LatLng.prototype.update=function(t){t=Waymark_L.latLng(t),this.lat=t.lat,this.lng=t.lng}}),window),Waymark_L.FeatureGroup.SubGroup=Waymark_L.FeatureGroup.extend({initialize:function(t,e){Waymark_L.FeatureGroup.prototype.initialize.call(this,e),this.setParentGroup(t)},setParentGroup:function(t){var e=t instanceof Waymark_L.LayerGroup;return this._parentGroup=t,this.onAdd=e?"function"==typeof t.addLayers?this._onAddToGroupBatch:this._onAddToGroup:this._onAddToMap,this.onRemove=e?"function"==typeof t.removeLayers?this._onRemoveFromGroupBatch:this._onRemoveFromGroup:this._onRemoveFromMap,this.addLayer=e?this._addLayerToGroup:this._addLayerToMap,this.removeLayer=e?this._removeLayerFromGroup:this._removeLayerFromMap,this},setParentGroupSafe:function(t){var e=this._map;return e&&e.removeLayer(this),this.setParentGroup(t),e&&e.addLayer(this),this},getParentGroup:function(){return this._parentGroup},_onAddToGroupBatch:function(t){var e=this.getLayers();this._map=t,this._parentGroup.addLayers(e)},_onRemoveFromGroupBatch:function(){var t=this.getLayers();this._parentGroup.removeLayers(t),this._map=null},_onAddToGroup:function(t){var e=this._parentGroup;this._map=t,this.eachLayer(e.addLayer,e)},_onRemoveFromGroup:function(){var t=this._parentGroup;this.eachLayer(t.removeLayer,t),this._map=null},_onAddToMap:Waymark_L.FeatureGroup.prototype.onAdd,_onRemoveFromMap:Waymark_L.FeatureGroup.prototype.onRemove,_addLayerToGroup:function(t){if(this.hasLayer(t))return this;t.addEventParent(this);var e=this.getLayerId(t);return this._layers[e]=t,this._map&&this._parentGroup.addLayer(t),this.fire("layeradd",{layer:t})},_removeLayerFromGroup:function(t){if(!this.hasLayer(t))return this;var e=t in this._layers?t:this.getLayerId(t);return(t=this._layers[e]).removeEventParent(this),this._map&&t&&this._parentGroup.removeLayer(t),delete this._layers[e],this.fire("layerremove",{layer:t})},_addLayerToMap:Waymark_L.FeatureGroup.prototype.addLayer,_removeLayerFromMap:Waymark_L.FeatureGroup.prototype.removeLayer}),Waymark_L.featureGroup.subGroup=function(t,e){return new Waymark_L.FeatureGroup.SubGroup(t,e)},function(t){var e;if("function"==typeof define&&define.amd)define(["leaflet"],t);else if("undefined"!=typeof module)e=require("leaflet"),module.exports=t(e);else{if(void 0===window.L)throw new Error("Leaflet must be loaded first");t(window.L)}}((function(t){Waymark_L.Control.Fullscreen=Waymark_L.Control.extend({options:{position:"topleft",title:{false:"View Fullscreen",true:"Exit Fullscreen"}},onAdd:function(t){var e=Waymark_L.DomUtil.create("div","leaflet-control-fullscreen leaflet-bar leaflet-control");return this.link=Waymark_L.DomUtil.create("a","leaflet-control-fullscreen-button leaflet-bar-part",e),this.link.href="#",this._map=t,this._map.on("fullscreenchange",this._toggleTitle,this),this._toggleTitle(),Waymark_L.DomEvent.on(this.link,"click",this._click,this),e},_click:function(t){Waymark_L.DomEvent.stopPropagation(t),Waymark_L.DomEvent.preventDefault(t),this._map.toggleFullscreen(this.options)},_toggleTitle:function(){this.link.title=this.options.title[this._map.isFullscreen()]}}),Waymark_L.Map.include({isFullscreen:function(){return this._isFullscreen||!1},toggleFullscreen:function(t){var e=this.getContainer();this.isFullscreen()?t&&t.pseudoFullscreen?this._disablePseudoFullscreen(e):document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.msExitFullscreen?document.msExitFullscreen():this._disablePseudoFullscreen(e):t&&t.pseudoFullscreen?this._enablePseudoFullscreen(e):e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):e.msRequestFullscreen?e.msRequestFullscreen():this._enablePseudoFullscreen(e)},_enablePseudoFullscreen:function(t){Waymark_L.DomUtil.addClass(t,"leaflet-pseudo-fullscreen"),this._setFullscreen(!0),this.fire("fullscreenchange")},_disablePseudoFullscreen:function(t){Waymark_L.DomUtil.removeClass(t,"leaflet-pseudo-fullscreen"),this._setFullscreen(!1),this.fire("fullscreenchange")},_setFullscreen:function(t){this._isFullscreen=t;var e=this.getContainer();t?Waymark_L.DomUtil.addClass(e,"leaflet-fullscreen-on"):Waymark_L.DomUtil.removeClass(e,"leaflet-fullscreen-on"),this.invalidateSize()},_onFullscreenChange:function(t){var e=document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement;e!==this.getContainer()||this._isFullscreen?e!==this.getContainer()&&this._isFullscreen&&(this._setFullscreen(!1),this.fire("fullscreenchange")):(this._setFullscreen(!0),this.fire("fullscreenchange"))}}),Waymark_L.Map.mergeOptions({fullscreenControl:!1}),Waymark_L.Map.addInitHook((function(){var t;if(this.options.fullscreenControl&&(this.fullscreenControl=new Waymark_L.Control.Fullscreen(this.options.fullscreenControl),this.addControl(this.fullscreenControl)),"onfullscreenchange"in document?t="fullscreenchange":"onmozfullscreenchange"in document?t="mozfullscreenchange":"onwebkitfullscreenchange"in document?t="webkitfullscreenchange":"onmsfullscreenchange"in document&&(t="MSFullscreenChange"),t){var e=Waymark_L.bind(this._onFullscreenChange,this);this.whenReady((function(){Waymark_L.DomEvent.on(document,t,e)})),this.on("unload",(function(){Waymark_L.DomEvent.off(document,t,e)}))}})),Waymark_L.control.fullscreen=function(t){return new Waymark_L.Control.Fullscreen(t)}})),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t.Leaflet=t.Leaflet||{},t.Leaflet.markercluster=t.Leaflet.markercluster||{}))}(this,(function(t){"use strict";var e=L.MarkerClusterGroup=L.FeatureGroup.extend({options:{maxClusterRadius:80,iconCreateFunction:null,clusterPane:L.Marker.prototype.options.pane,spiderfyOnMaxZoom:!0,showCoverageOnHover:!0,zoomToBoundsOnClick:!0,singleMarkerMode:!1,disableClusteringAtZoom:null,removeOutsideVisibleBounds:!0,animate:!0,animateAddingMarkers:!1,spiderfyDistanceMultiplier:1,spiderLegPolylineOptions:{weight:1.5,color:"#222",opacity:.5},chunkedLoading:!1,chunkInterval:200,chunkDelay:50,chunkProgress:null,polygonOptions:{}},initialize:function(t){L.Util.setOptions(this,t),this.options.iconCreateFunction||(this.options.iconCreateFunction=this._defaultIconCreateFunction),this._featureGroup=L.featureGroup(),this._featureGroup.addEventParent(this),this._nonPointGroup=L.featureGroup(),this._nonPointGroup.addEventParent(this),this._inZoomAnimation=0,this._needsClustering=[],this._needsRemoving=[],this._currentShownBounds=null,this._queue=[],this._childMarkerEventHandlers={dragstart:this._childMarkerDragStart,move:this._childMarkerMoved,dragend:this._childMarkerDragEnd};var e=L.DomUtil.TRANSITION&&this.options.animate;L.extend(this,e?this._withAnimation:this._noAnimation),this._markerCluster=e?L.MarkerCluster:L.MarkerClusterNonAnimated},addLayer:function(t){if(t instanceof L.LayerGroup)return this.addLayers([t]);if(!t.getLatLng)return this._nonPointGroup.addLayer(t),this.fire("layeradd",{layer:t}),this;if(!this._map)return this._needsClustering.push(t),this.fire("layeradd",{layer:t}),this;if(this.hasLayer(t))return this;this._unspiderfy&&this._unspiderfy(),this._addLayer(t,this._maxZoom),this.fire("layeradd",{layer:t}),this._topClusterLevel._recalculateBounds(),this._refreshClustersIcons();var e=t,i=this._zoom;if(t.__parent)for(;e.__parent._zoom>=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._zoom<Math.round(this._map._zoom)?(this._map.on("moveend",i,this),this._map.panTo(t.getLatLng())):(this._map.on("moveend",i,this),this.on("animationend",i,this),t.__parent.zoomToBounds())},onAdd:function(t){var e,i,n;if(this._map=t,!isFinite(this._map.getMaxZoom()))throw"Map has no maxZoom specified";for(this._featureGroup.addTo(t),this._nonPointGroup.addTo(t),this._gridClusters||this._generateInitialClusters(),this._maxLat=t.options.crs.projection.MAX_LATITUDE,e=0,i=this._needsRemoving.length;i>e;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._zoom<s));)e&&h._childCount<=1?(l=h._markers[0]===t?h._markers[1]:h._markers[0],n[h._zoom].removeObject(h,r.project(h._cLatLng,h._zoom)),o[h._zoom].addObject(l,r.project(l.getLatLng(),h._zoom)),this._arraySplice(h.__parent._childClusters,h),h.__parent._markers.push(l),l.__parent=h.__parent,h._icon&&(a.removeLayer(h),i||a.addLayer(l))):h._iconNeedsUpdate=!0,h=h.__parent;delete t.__parent},_isOrIsParent:function(t,e){for(;e;){if(t===e)return!0;e=e.parentNode}return!1},fire:function(t,e,i){if(e&&e.layer instanceof L.MarkerCluster){if(e.originalEvent&&this._isOrIsParent(e.layer._icon,e.originalEvent.relatedTarget))return;t="cluster"+t}L.FeatureGroup.prototype.fire.call(this,t,e,i)},listens:function(t,e){return L.FeatureGroup.prototype.listens.call(this,t,e)||L.FeatureGroup.prototype.listens.call(this,"cluster"+t,e)},_defaultIconCreateFunction:function(t){var e=t.getChildCount(),i=" marker-cluster-";return i+=10>e?"small":100>e?"medium":"large",new L.DivIcon({html:"<div><span>"+e+"</span></div>",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;t<this._queue.length;t++)this._queue[t].call(this);this._queue.length=0,clearTimeout(this._queueTimeout),this._queueTimeout=null},_mergeSplitClusters:function(){var t=Math.round(this._map._zoom);this._processQueue(),this._zoom<t&&this._currentShownBounds.intersects(this._getExpandedVisibleBounds())?(this._animationStart(),this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,Math.floor(this._map.getMinZoom()),this._zoom,this._getExpandedVisibleBounds()),this._animationZoomIn(this._zoom,t)):this._zoom>t?(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<n.length;o++)(i=n[o])instanceof L.LayerGroup?this._extractNonGroupLayers(i,e):e.push(i);return e},_overrideMarkerIcon:function(t){return t.options.icon=this.options.iconCreateFunction({getChildCount:function(){return 1},getAllChildMarkers:function(){return[t]}})}});L.MarkerClusterGroup.include({_mapBoundsInfinite:new L.LatLngBounds(new L.LatLng(-1/0,-1/0),new L.LatLng(1/0,1/0))}),L.MarkerClusterGroup.include({_noAnimation:{_animationStart:function(){},_animationZoomIn:function(t,e){this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,Math.floor(this._map.getMinZoom()),t),this._topClusterLevel._recursivelyAddChildrenToMap(null,e,this._getExpandedVisibleBounds()),this.fire("animationend")},_animationZoomOut:function(t,e){this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,Math.floor(this._map.getMinZoom()),t),this._topClusterLevel._recursivelyAddChildrenToMap(null,e,this._getExpandedVisibleBounds()),this.fire("animationend")},_animationAddLayer:function(t,e){this._animationAddLayerNonAnimated(t,e)}},_withAnimation:{_animationStart:function(){this._map._mapPane.className+=" leaflet-cluster-anim",this._inZoomAnimation++},_animationZoomIn:function(t,e){var i,n=this._getExpandedVisibleBounds(),o=this._featureGroup,a=Math.floor(this._map.getMinZoom());this._ignoreMove=!0,this._topClusterLevel._recursively(n,t,a,(function(a){var r,s=a._latlng,l=a._markers;for(n.contains(s)||(s=null),a._isSingleParent()&&t+1===e?(o.removeLayer(a),a._recursivelyAddChildrenToMap(null,e,n)):(a.clusterHide(),a._recursivelyAddChildrenToMap(s,e,n)),i=l.length-1;i>=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;e<i.length;e++)s=s.concat(i[e]._childClusters);i=s}o>a?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<o.length;t++)i=o[t]._latlng,this._bounds.extend(i),r+=i.lat,s+=i.lng;for(t=0;t<a.length;t++)(e=a[t])._boundsNeedUpdate&&e._recalculateBounds(),this._bounds.extend(e._bounds),i=e._wLatLng,n=e._childCount,r+=i.lat*n,s+=i.lng*n;this._latlng=this._wLatLng=new L.LatLng(r/l,s/l),this._boundsNeedUpdate=!1}},_addToMap:function(t){t&&(this._backupLatlng=this._latlng,this.setLatLng(t)),this._group._featureGroup.addLayer(this)},_recursivelyAnimateChildrenIn:function(t,e,i){this._recursively(t,this._group._map.getMinZoom(),i-1,(function(t){var i,n,o=t._markers;for(i=o.length-1;i>=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.lat<n)&&(s=c,n=c.lat),(!1===o||c.lng>o)&&(l=c,o=c.lng),(!1===a||c.lng<a)&&(h=c,a=c.lng)}return n!==i?(d=s,u=r):(d=h,u=l),[].concat(this.buildConvexHull([d,u],t),this.buildConvexHull([u,d],t))}},L.MarkerCluster.include({getConvexHull:function(){var t,e,i=this.getAllChildMarkers(),n=[];for(e=i.length-1;e>=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<t.length;i++)a=s.layerPointToLatLng(e[i]),n=t[i],o=new L.Polyline([this._latlng,a],h),s.addLayer(o),n._spiderLeg=o,n._preSpiderfyLatlng=n._latlng,n.setLatLng(a),n.setZIndexOffset&&n.setZIndexOffset(1e6),l.addLayer(n);this.setOpacity(.3),r._ignoreMove=!1,r.fire("spiderfied",{cluster:this,markers:t})},_animationUnspiderfy:function(){this._noanimationUnspiderfy()}}),L.MarkerCluster.include({_animationSpiderfy:function(t,e){var i,n,o,a,r,s,l=this,h=this._group,u=h._map,d=h._featureGroup,c=this._latlng,_=u.latLngToLayerPoint(c),p=L.Path.SVG,m=L.extend({},this._group.options.spiderLegPolylineOptions),f=m.opacity;for(void 0===f&&(f=L.MarkerClusterGroup.prototype.options.spiderLegPolylineOptions.opacity),p?(m.opacity=0,m.className=(m.className||"")+" leaflet-cluster-spider-leg"):m.opacity=f,h._ignoreMove=!0,i=0;i<t.length;i++)n=t[i],s=u.layerPointToLatLng(e[i]),o=new L.Polyline([c,s],m),u.addLayer(o),n._spiderLeg=o,p&&(r=(a=o._path).getTotalLength()+.1,a.style.strokeDasharray=r,a.style.strokeDashoffset=r),n.setZIndexOffset&&n.setZIndexOffset(1e6),n.clusterHide&&n.clusterHide(),d.addLayer(n),n._setPos&&n._setPos(_);for(h._forceLayout(),h._animationStart(),i=t.length-1;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&&_<a-d);var p=0,m=n[0];return c.map((function(t){for(;t>m.distB&&p<o-1;)p++,m=n[p];var e=(t-m.distA)/(m.distB-m.distA);return{pt:l(m.a,m.b,e),heading:m.heading}}))}(e.map((function(t){return o._map.project(t)})),n).map((function(e){return{latLng:o._map.unproject(t.point(e.pt)),heading:e.heading}}))},redraw:function(){this._map&&(this.clearLayers(),this._draw())},_getPatternLayers:function(e){var i=this,n=this._map.getBounds().pad(.1);return this._paths.map((function(o){var a=i._getDirectionPoints(o,e).filter((function(t){return n.contains(t.latLng)}));return t.featureGroup(i._buildSymbols(o,e.symbolFactory,a))}))},_draw:function(){var e=this;this._patterns.map((function(t){return e._getPatternLayers(t)})).forEach((function(i){e.addLayer(t.featureGroup(i))}))}}),t.polylineDecorator=function(e,i){return new t.PolylineDecorator(e,i)}})),Waymark_L.Control.SleepMapControl=Waymark_L.Control.extend({initialize:function(t){Waymark_L.setOptions(this,t)},options:{position:"topright",prompt:"disable map",styles:{backgroundColor:"white",padding:"5px",border:"2px solid gray"}},buildContainer:function(){var t=this,e=Waymark_L.DomUtil.create("p","sleep-button"),i=this._nonBoundEvent.bind(this);return e.appendChild(document.createTextNode(this.options.prompt)),Waymark_L.DomEvent.addListener(e,"click",i),Waymark_L.DomEvent.addListener(e,"touchstart",i),Object.keys(this.options.styles).map((function(i){e.style[i]=t.options.styles[i]})),this._container=e},onAdd:function(){return this._container||this.buildContainer()},_nonBoundEvent:function(t){return Waymark_L.DomEvent.stop(t),this._map&&this._map.sleep._sleepMap(),!1}}),Waymark_L.Control.sleepMapControl=function(){return new Waymark_L.Control.SleepMapControl},Waymark_L.Map.mergeOptions({sleep:!0,sleepTime:750,wakeTime:750,wakeMessageTouch:"Touch to Wake",sleepNote:!0,hoverToWake:!0,sleepOpacity:.7,sleepButton:Waymark_L.Control.sleepMapControl}),Waymark_L.Map.Sleep=Waymark_L.Handler.extend({addHooks:function(){this.sleepNote=Waymark_L.DomUtil.create("p","sleep-note",this._map._container),this._enterTimeout=null,this._exitTimeout=null,this._sleepButton=this._map.options.sleepButton(),this._map.tap&&this._map.addControl(this._sleepButton);var t=this._map._container.style;t.WebkitTransition+="opacity .5s",t.MozTransition+="opacity .5s",this._setSleepNoteStyle(),this._sleepMap()},removeHooks:function(){this._map.scrollWheelZoom.enabled()||this._map.scrollWheelZoom.enable(),this._map.tap&&!this._map.tap.enabled()&&(this._map.touchZoom.enable(),this._map.dragging.enable(),this._map.tap.enable()),Waymark_L.DomUtil.setOpacity(this._map._container,1),Waymark_L.DomUtil.setOpacity(this.sleepNote,0),this._removeSleepingListeners(),this._removeAwakeListeners()},_setSleepNoteStyle:function(){var t="",e=this.sleepNote.style;if(t=this._map.tap?this._map.options.wakeMessageTouch:this._map.options.wakeMessage?this._map.options.wakeMessage:this._map.options.hoverToWake?"click or hover to wake":"click to wake",this._map.options.sleepNote&&(this.sleepNote.appendChild(document.createTextNode(t)),e.pointerEvents="none",e.maxWidth="150px",e.transitionDuration=".2s",e.zIndex=5e3,e.opacity=".6",e.margin="auto",e.textAlign="center",e.borderRadius="4px",e.top="50%",e.position="relative",e.padding="5px",e.border="solid 2px black",e.background="white",this._map.options.sleepNoteStyle)){var i=this._map.options.sleepNoteStyle;Object.keys(i).map((function(t){e[t]=i[t]}))}},_wakeMap:function(t){this._stopWaiting(),this._map.scrollWheelZoom.enable(),this._map.dragging.enable(),this._map.tap&&(this._map.touchZoom.enable(),this._map.tap.enable(),this._map.addControl(this._sleepButton)),Waymark_L.DomUtil.setOpacity(this._map._container,1),this.sleepNote.style.opacity=0,this._addAwakeListeners()},_sleepMap:function(){this._stopWaiting(),this._map.scrollWheelZoom.disable(),this._map.tap&&(this._map.touchZoom.disable(),this._map.dragging.disable(),this._map.tap.disable(),this._map.removeControl(this._sleepButton)),Waymark_L.DomUtil.setOpacity(this._map._container,this._map.options.sleepOpacity),this.sleepNote.style.opacity=.4,this._addSleepingListeners()},_wakePending:function(){if(this._map.once("mousedown",this._wakeMap,this),this._map.options.hoverToWake){var t=this;this._map.once("mouseout",this._sleepMap,this),t._enterTimeout=setTimeout((function(){t._map.off("mouseout",t._sleepMap,t),t._wakeMap()}),t._map.options.wakeTime)}},_sleepPending:function(){var t=this;t._map.once("mouseover",t._wakeMap,t),t._exitTimeout=setTimeout((function(){t._map.off("mouseover",t._wakeMap,t),t._sleepMap()}),t._map.options.sleepTime)},_addSleepingListeners:function(){this._map.once("mouseover",this._wakePending,this),this._map.tap&&this._map.once("click",this._wakeMap,this)},_addAwakeListeners:function(){this._map.once("mouseout",this._sleepPending,this)},_removeSleepingListeners:function(){this._map.options.hoverToWake&&this._map.off("mouseover",this._wakePending,this),this._map.off("mousedown",this._wakeMap,this),this._map.tap&&this._map.off("click",this._wakeMap,this)},_removeAwakeListeners:function(){this._map.off("mouseout",this._sleepPending,this)},_stopWaiting:function(){this._removeSleepingListeners(),this._removeAwakeListeners();this._enterTimeout&&clearTimeout(this._enterTimeout),this._exitTimeout&&clearTimeout(this._exitTimeout),this._enterTimeout=null,this._exitTimeout=null}}),Waymark_L.Map.addInitHook("addHandler","sleep",Waymark_L.Map.Sleep);var toGeoJSON=function(){var t,e=/\s*/g,i=/^\s*|\s*$/g,n=/\s+/;function o(t){if(!t||!t.length)return 0;for(var e=0,i=0;e<t.length;e++)i=(i<<5)-i+t.charCodeAt(e)|0;return i}function a(t,e){return t.getElementsByTagName(e)}function r(t,e){return t.getAttribute(e)}function s(t,e){return parseFloat(r(t,e))}function l(t,e){var i=a(t,e);return i.length?i[0]:null}function h(t){for(var e=0,i=[];e<t.length;e++)i[e]=parseFloat(t[e]);return i}function u(t){return t&&function(t){t.normalize&&t.normalize()}(t),t&&t.textContent||""}function d(t,e){var i,n,o={};for(n=0;n<e.length;n++)(i=l(t,e[n]))&&(o[e[n]]=u(i));return o}function c(t,e){for(var i in e)t[i]=e[i]}function _(t){return h(t.replace(e,"").split(","))}function p(t){for(var e=t.replace(i,"").split(n),o=[],a=0;a<e.length;a++)o.push(_(e[a]));return o}function m(t){var e,i=[s(t,"lon"),s(t,"lat")],n=l(t,"ele"),o=l(t,"gpxtpx:hr")||l(t,"hr"),a=l(t,"time");return n&&(e=parseFloat(u(n)),isNaN(e)||i.push(e)),{coordinates:i,time:a?u(a):null,heartRate:o?parseFloat(u(o)):null}}if("undefined"!=typeof XMLSerializer)t=new XMLSerializer;else{var f="object"==typeof process&&!process.browser,g="object"==typeof Titanium;if("object"!=typeof exports||!f&&!g)throw new Error("Unable to initialize serializer");t=new(require("xmldom").XMLSerializer)}function y(e){return void 0!==e.xml?e.xml:t.serializeToString(e)}return{kml:function(t){for(var e={type:"FeatureCollection",features:[]},i={},n={},s={},d=["Polygon","LineString","Point","Track","gx:Track"],c=a(t,"Placemark"),m=a(t,"Style"),f=a(t,"StyleMap"),g=0;g<m.length;g++){var v=o(y(m[g])).toString(16);i["#"+r(m[g],"id")]=v,n[v]=m[g]}for(var k=0;k<f.length;k++){i["#"+r(f[k],"id")]=o(y(f[k])).toString(16);for(var L=a(f[k],"Pair"),w={},b=0;b<L.length;b++)w[u(l(L[b],"key"))]=u(l(L[b],"styleUrl"));s["#"+r(f[k],"id")]=w}for(var x=0;x<c.length;x++)e.features=e.features.concat(P(c[x]));function W(t){var e,i;return"#"===(t=t||"").substr(0,1)&&(t=t.substr(1)),6!==t.length&&3!==t.length||(e=t),8===t.length&&(i=parseInt(t.substr(0,2),16)/255,e="#"+t.substr(6,2)+t.substr(4,2)+t.substr(2,2)),[e,isNaN(i)?void 0:i]}function C(t){return h(t.split(" "))}function M(t){var e=a(t,"coord"),i=[],n=[];0===e.length&&(e=a(t,"gx:coord"));for(var o=0;o<e.length;o++)i.push(C(u(e[o])));for(var r=a(t,"when"),s=0;s<r.length;s++)n.push(u(r[s]));return{coords:i,times:n}}function P(t){var e,o=function t(e){var i,n,o,r,s,h=[],c=[];if(l(e,"MultiGeometry"))return t(l(e,"MultiGeometry"));if(l(e,"MultiTrack"))return t(l(e,"MultiTrack"));if(l(e,"gx:MultiTrack"))return t(l(e,"gx:MultiTrack"));for(o=0;o<d.length;o++)if(n=a(e,d[o]))for(r=0;r<n.length;r++)if(i=n[r],"Point"===d[o])h.push({type:"Point",coordinates:_(u(l(i,"coordinates")))});else if("LineString"===d[o])h.push({type:"LineString",coordinates:p(u(l(i,"coordinates")))});else if("Polygon"===d[o]){var m=a(i,"LinearRing"),f=[];for(s=0;s<m.length;s++)f.push(p(u(l(m[s],"coordinates"))));h.push({type:"Polygon",coordinates:f})}else if("Track"===d[o]||"gx:Track"===d[o]){var g=M(i);h.push({type:"LineString",coordinates:g.coords}),g.times.length&&c.push(g.times)}return{geoms:h,coordTimes:c}}(t),h={},c=u(l(t,"name")),m=u(l(t,"address")),f=u(l(t,"styleUrl")),g=u(l(t,"description")),y=l(t,"TimeSpan"),v=l(t,"TimeStamp"),k=l(t,"ExtendedData"),L=l(t,"LineStyle"),w=l(t,"PolyStyle"),b=l(t,"visibility");if(!o.geoms.length)return[];if(c&&(h.name=c),m&&(h.address=m),f){"#"!==f[0]&&(f="#"+f),h.styleUrl=f,i[f]&&(h.styleHash=i[f]),s[f]&&(h.styleMapHash=s[f],h.styleHash=i[s[f].normal]);var x=n[h.styleHash];if(x){L||(L=l(x,"LineStyle")),w||(w=l(x,"PolyStyle"));var C=l(x,"IconStyle");if(C){var P=l(C,"Icon");if(P){var E=u(l(P,"href"));E&&(h.icon=E)}}}}if(g&&(h.description=g),y){var T=u(l(y,"begin")),S=u(l(y,"end"));h.timespan={begin:T,end:S}}if(v&&(h.timestamp=u(l(v,"when"))),L){var z=W(u(l(L,"color"))),D=z[0],O=z[1],A=parseFloat(u(l(L,"width")));D&&(h.stroke=D),isNaN(O)||(h["stroke-opacity"]=O),isNaN(A)||(h["stroke-width"]=A)}if(w){var B=W(u(l(w,"color"))),I=B[0],F=B[1],N=u(l(w,"fill")),j=u(l(w,"outline"));I&&(h.fill=I),isNaN(F)||(h["fill-opacity"]=F),N&&(h["fill-opacity"]="1"===N?h["fill-opacity"]||1:0),j&&(h["stroke-opacity"]="1"===j?h["stroke-opacity"]||1:0)}if(k){var Z=a(k,"Data"),R=a(k,"SimpleData");for(e=0;e<Z.length;e++)h[Z[e].getAttribute("name")]=u(l(Z[e],"value"));for(e=0;e<R.length;e++)h[R[e].getAttribute("name")]=u(R[e])}b&&(h.visibility=u(b)),o.coordTimes.length&&(h.coordTimes=1===o.coordTimes.length?o.coordTimes[0]:o.coordTimes);var G={type:"Feature",geometry:1===o.geoms.length?o.geoms[0]:{type:"GeometryCollection",geometries:o.geoms},properties:h};return r(t,"id")&&(G.id=r(t,"id")),[G]}return e},gpx:function(t){var e,i,n=a(t,"trk"),o=a(t,"rte"),s=a(t,"wpt"),h={type:"FeatureCollection",features:[]};for(e=0;e<n.length;e++)(i=f(n[e]))&&h.features.push(i);for(e=0;e<o.length;e++)(i=g(o[e]))&&h.features.push(i);for(e=0;e<s.length;e++)h.features.push(y(s[e]));function _(t,e){for(var i=0;i<e;i++)t.push(null);return t}function p(t,e){var i=a(t,e),n=[],o=[],r=[],s=i.length;if(s<2)return{};for(var l=0;l<s;l++){var h=m(i[l]);n.push(h.coordinates),h.time&&o.push(h.time),(h.heartRate||r.length)&&(r.length||_(r,l),r.push(h.heartRate||null))}return{line:n,times:o,heartRates:r}}function f(t){for(var e,i=a(t,"trkseg"),n=[],o=[],r=[],s=0;s<i.length;s++)if((e=p(i[s],"trkpt"))&&(e.line&&n.push(e.line),e.times&&e.times.length&&o.push(e.times),r.length||e.heartRates&&e.heartRates.length)){if(!r.length)for(var h=0;h<s;h++)r.push(_([],n[h].length));e.heartRates&&e.heartRates.length?r.push(e.heartRates):r.push(_([],e.line.length||0))}if(0!==n.length){var u=k(t);return c(u,v(l(t,"extensions"))),o.length&&(u.coordTimes=1===n.length?o[0]:o),r.length&&(u.heartRates=1===n.length?r[0]:r),{type:"Feature",properties:u,geometry:{type:1===n.length?"LineString":"MultiLineString",coordinates:1===n.length?n[0]:n}}}}function g(t){var e=p(t,"rtept");if(e.line){var i=k(t);return c(i,v(l(t,"extensions"))),{type:"Feature",properties:i,geometry:{type:"LineString",coordinates:e.line}}}}function y(t){var e=k(t);return c(e,d(t,["sym"])),{type:"Feature",properties:e,geometry:{type:"Point",coordinates:m(t).coordinates}}}function v(t){var e={};if(t){var i=l(t,"line");if(i){var n=u(l(i,"color")),o=parseFloat(u(l(i,"opacity"))),a=parseFloat(u(l(i,"width")));n&&(e.stroke=n),isNaN(o)||(e["stroke-opacity"]=o),isNaN(a)||(e["stroke-width"]=96*a/25.4)}}return e}function k(t){var e=d(t,["name","cmt","desc","type","time","keywords"]),i=a(t,"link");i.length&&(e.links=[]);for(var n,o=0;o<i.length;o++)c(n={href:r(i[o],"href")},d(i[o],["text","type"])),e.links.push(n);return e}return h}}}();function Waymark_Map(){this.init=function(t={}){for(key in Waymark=this,Waymark.start_time=(new Date).getTime(),Waymark.jq_map_container=null,Waymark.config={map_options:{debug_mode:0,map_height:null,map_div_id:"waymark-map",map_width:null,map_init_zoom:null,map_init_latlng:null,map_init_basemap:null,map_max_zoom:null,tile_layers:[{layer_name:"OpenStreetMap",layer_url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png?r=1",layer_attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> 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.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},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:'<a href="https://www.waymark.dev/js/" title="Share your way">Waymark</a>'}).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='<span class="waymark-type-label">['+o[t+"_title"]+"]</span> ");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"],"<b>"+Waymark.config.language["object_label_"+t+"_plural"]+"</b>"),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"]+"</"+i+">"},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='<div class="waymark-marker-background" style="'+i+'"></div>',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+='<div style="'+n+'" class="'+o+'">'+t.marker_icon+"</div>";break;case"html":o+=" waymark-icon-html";var a=jQuery("<div/>").html(t.marker_icon).text();e.html+='<div class="'+o+'">'+a+"</div>";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+='<i style="'+n+'" class="'+o+'"></i>'}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<div class="waymark-type-heading" style="background:${n}">\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</div>\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+=`<div class="${i.className}">${i.html}</div>`;break;case"line":case"shape":n+=Waymark.type_to_text(t,e,"span")}return n+=`</${i}>`,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=`<div class="waymark-overlay-content ${t.properties.title?"waymark-overlay-has-title":""} ${t.properties.description?"waymark-overlay-has-desc":""} ${t.properties.image_large_url?"waymark-overlay-has-image":""} waymark-overlay-${e}">`;const o=["type","title","description","image_large_url"];for(index in o){var a=o[index];switch(n+=`<div class="waymark-overlay-property waymark-overlay-property-${a}">`,a){case"type":n+=Waymark.type_to_text(e,i);break;case"title":n+=t.properties.title?t.properties.title:"<em>Untitled "+i[e+"_title"]+" "+Waymark.title_case(e)+"</em>";break;case"description":var r=t.properties.description;r&&(0===r.indexOf("<")?n+=r:n+=`<p>${r}</p>`);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+=`<a href="${t.properties.image_large_url}" target="_blank" style="background-image:url(${s})"></a>`}}n+="</div>"}return n+="</div>"},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+=`<div class="waymark-cluster-count">${s}</div>`);const u=8*n;i+=`\n\t\t\t\t<div \n\t\t\t\t\tclass="${l.className}" \n\t\t\t\t\tstyle="\n\t\t\t\t\t\tleft:${u}px;\n\t\t\t\t\t\tz-index:${h};\n\t\t\t\t\t\theight:${l.iconSize[1]}px;\n\t\t\t\t\t\twidth:${l.iconSize[0]}px;\n\t\t\t\t\t\theight:${l.iconSize[1]}px;\n\t\t\t\t\t"\n\t\t\t\t>\n\t\t\t\t\t${l.html}\t\t\t\t\t\n\t\t\t\t</div>\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("<div />"),n=jQuery("<ul />").addClass("waymark-info waymark-"+t+"-info");for(key in Waymark.config[t+"_data_defaults"]){var o=null;switch(key){case"title":e.properties.title?o=jQuery("<strong />").html(e.properties.title):(o=jQuery("<strong />").html("&nbsp;"),n.addClass("waymark-no-title"));break;case"type":var a=Waymark.get_type(t,e.properties.type);a&&(o=Waymark.type_to_text(t,a,"small"));break;case"description":var r=e.properties.description;r?o=0===r.indexOf("<")?r:jQuery("<p />").html(r):n.addClass("waymark-no-description");break;case"image_large_url":if(void 0!==e.properties.image_large_url){var s=e.properties.image_large_url;if(void 0!==e.properties.image_medium_url)s=e.properties.image_medium_url;o=jQuery("<a />").attr({href:e.properties.image_large_url,target:"_blank",style:"background-image:url("+s+")"})}else n.addClass("waymark-no-image")}o&&n.append(jQuery("<li />").addClass("waymark-info-"+key+" waymark-"+t+"-info-"+key).append(o))}return n.children().length&&i.append(n),i},this.info_window=function(t,e,i){if(Waymark=this,parseInt(Waymark.config.viewer_options.show_elevation)&&"line"==t&&(parseInt(Waymark.config.viewer_options.elevation_initial)&&Waymark.line_has_elevation_data(e)&&!Waymark.elevation_container.is(":visible")&&(Waymark.elevation_container.show(),Waymark.elevation_control.loadData(e)),jQuery(i).on("click",{W:Waymark},(function(t){var e=t.data.W,i=t.target.feature;e.elevation_control.clear(),void 0!==e.elevation_control.layer&&e.elevation_control.layer.removeFrom(e.map),e.elevation_container.hide(),e.line_has_elevation_data(i)&&(e.elevation_container.show(),e.elevation_control.loadData(i))}))),void 0!==e.properties.description||void 0!==e.properties.image_large_url){var n=Waymark.build_content(t,e,i);e.properties.title;i.bindPopup(n.get(0)).openPopup()}},this.line_has_elevation_data=function(t){if("MultiLineString"==t.geometry.type){for(var e in t.geometry.coordinates)for(var i in t.geometry.coordinates[e])if(3==t.geometry.coordinates[e][i].length)return!0}else for(var i in t.geometry.coordinates)if(3==t.geometry.coordinates[i].length)return!0;return!1},this.setup_elevation=function(){if(Waymark=this,!Waymark.config.viewer_options.show_elevation)return;Waymark.debug("Setting up Elevation Control"),Waymark_L.registerLocale("waymark",{"Total Length: ":Waymark.config.language.label_total_length,"Max Elevation: ":Waymark.config.language.label_max_elevation,"Min Elevation: ":Waymark.config.language.label_min_elevation,"Total Ascent: ":Waymark.config.language.label_ascent,"Total Descent: ":Waymark.config.language.label_descent}),Waymark_L.setLocale("waymark");var t={theme:"magenta-theme",detached:!0,followMarker:!1,width:Waymark.config.map_options.map_width};const e=`\n\t\t\tdiv#${Waymark.config.map_options.map_div_id} .elevation-polyline { stroke: ${Waymark.config.viewer_options.elevation_colour} !important; }\n\t\t\tdiv#${Waymark.config.viewer_options.elevation_div_id} .elevation-control.elevation .area { fill: ${Waymark.config.viewer_options.elevation_colour} !important; }\n\t\t`;if(jQuery("head").append(`<style type="text/css">${e}</style>`),void 0!==Waymark.config.viewer_options.elevation_div_id){t.elevationDiv="#"+Waymark.config.viewer_options.elevation_div_id,Waymark.elevation_container=jQuery(t.elevationDiv),Waymark.elevation_container.length||(Waymark.debug("Creating Elevation Container"),t.width=Waymark.config.map_options.map_width/2,Waymark.elevation_container=jQuery("<div />").attr("id",Waymark.config.viewer_options.elevation_div_id).appendTo(Waymark.jq_map_container)),Waymark.elevation_container.addClass("waymark-elevation-container").hide();var i=jQuery("<span />").addClass("waymark-elevation-close").text("x").on("click",{W:Waymark},(function(t){var e=t.data.W;e.elevation_control.clear(),void 0!==e.elevation_control.layer&&e.elevation_control.layer.removeFrom(e.map),e.elevation_container.hide()}));Waymark.elevation_container.append(i)}void 0!==Waymark.config.viewer_options.elevation_units&&"imperial"==Waymark.config.viewer_options.elevation_units&&(t.imperial=!0),Waymark.elevation_control=Waymark_L.control.elevation(t).addTo(Waymark.map),Waymark.map.on("overlayremove",(function(t){if(void 0!==Waymark.elevation_control.layer){var e=null;Waymark.elevation_control.layer.eachLayer((function(t){e=JSON.stringify(t.getLatLngs())})),e&&t.layer.eachLayer((function(t){void 0!==t.getLatLngs&&e==JSON.stringify(t.getLatLngs())&&(Waymark.elevation_control.clear(),Waymark.elevation_control.layer.removeFrom(Waymark.map),Waymark.elevation_container.hide())}))}}))},this.setup_gallery=function(){if(Waymark=this,parseInt(Waymark.config.viewer_options.show_gallery)){Waymark.gallery=jQuery("<div />").attr("id",Waymark.config.gallery_div_id).css("width",Waymark.config.map_options.map_width).addClass("waymark-gallery-container").html(""),Waymark_L.DomEvent.disableClickPropagation(Waymark.gallery.get(0)),jQuery(Waymark.map.getContainer()).append(Waymark.gallery),Waymark.size_gallery();var t=Waymark;Waymark.map.on("moveend",(function(){t.render_gallery()}),{W:t}),Waymark.map.on("layerremove layeradd",(function(){t.render_gallery()}),{W:t})}},this.size_gallery=function(){if(Waymark=this,void 0!==Waymark.gallery&&Waymark.gallery.length){gallery_padding=Waymark.gallery.css("paddingRight"),gallery_padding=gallery_padding.replace("px",""),gallery_padding=parseInt(gallery_padding);var t=Waymark.config.map_options.map_width-2*gallery_padding;Waymark.gallery.css("width",t)}},this.add_to_gallery=function(t){if(Waymark=this,void 0===t.feature.properties.image_thumbnail_url||void 0===t.feature.properties.image_large_url)return!1;var e=Object.assign({},t.feature.properties);e.latlng=t.feature.geometry.coordinates,e.marker=t,Waymark.gallery_images.push(e)},this.render_gallery=function(){Waymark=this;var t=0;if(void 0!==Waymark.gallery&&Waymark.gallery.length&&(Waymark.gallery.html(""),Waymark.gallery.hide(),jQuery(Waymark.map.getContainer()).removeClass("waymark-has-gallery"),Waymark.gallery_images.length)){for(i=0;i<Waymark.gallery_images.length;i++){var e=Waymark.gallery_images[i];let a=Waymark.map;if(parseInt(Waymark.config.viewer_options.show_cluster)&&"object"==typeof Waymark.marker_cluster&&(a=Waymark.marker_cluster),Waymark.map.getBounds().contains(e.marker.getLatLng())&&a.hasLayer(e.marker)){t++;var n=jQuery("<div />").addClass("waymark-image").on("click",{marker:e.marker},(function(t){var e=t.data.marker;Waymark.map.setView(e.getLatLng(),16),e.openPopup()})),o=jQuery("<img />").attr({src:e.image_thumbnail_url});n.append(o),Waymark.gallery.append(n)}}t&&(Waymark.gallery.show(),jQuery(Waymark.map.getContainer()).addClass("waymark-has-gallery"))}}}function Waymark_Map_Editor(){this.pre_map_setup=function(){Waymark=this,Waymark.mode="edit"},this.init_done=function(){Waymark=this,Waymark.jq_map_container.addClass("waymark-is-editor");const t=Waymark.config.editor_options.data_div_id;if(Waymark.jq_data_container=jQuery("#"+t),Waymark.jq_data_container.length){const e=Waymark.jq_data_container.val();try{const i=JSON.parse(e);Waymark.load_json(i),Waymark.debug(`Data container (#${t}) found, valid GeoJSON added to Map.`)}catch(e){Waymark.debug(`Data container (#${t}) found, but not valid GeoJSON.`)}}else Waymark.debug(`Data container (#${t}) not found, adding to DOM.`),Waymark.jq_data_container=jQuery("<textarea />").attr({id:t,name:"map_data"}).addClass("waymark-input waymark-input-map_data").appendTo(Waymark.jq_map_container);Waymark.jq_map_container.append(jQuery("<div />").attr({id:"waymark-loading"}).html('<div class="waymark-spinner"></div>')),Waymark.map.on("editable:drawing:commit",(function(t){switch(layer=t.layer,void 0===layer.feature&&(layer.feature={type:"Feature",properties:{}}),!0){case layer instanceof Waymark_L.Circle:layer.feature.properties=Waymark.config.shape_data_defaults,layer.feature.properties.radius=layer.getRadius();break;case layer instanceof Waymark_L.Rectangle:layer.feature.properties=Waymark.config.shape_data_defaults,layer.feature.properties.rectangle=!0;break;case layer instanceof Waymark_L.Polygon:layer.feature.properties=Waymark.config.shape_data_defaults;break;case layer instanceof Waymark_L.Polyline:layer.feature.properties=Waymark.config.line_data_defaults}Waymark.map_data.addData(layer.toGeoJSON()),Waymark.map.removeLayer(layer),Waymark.map_was_edited()})),Waymark.map.on("editable:editing",(function(t){layer=t.layer,void 0!==layer.feature&&layer.feature.properties.radius&&(layer.feature.properties.radius=layer.getRadius()),Waymark.map_was_edited()}))},this.create_marker=function(t){Waymark=this;var e=Waymark_L.marker(t,{draggable:!0});return e.on("moveend",(function(t){var e=t.target,i=e.feature;i.geometry.coordinates=[e._latlng.lng.toFixed(6),e._latlng.lat.toFixed(6)],Waymark.info_window("marker",i,e),Waymark.map_was_edited()})),e},this.save_data_layer=function(){Waymark=this;var t=JSON.stringify(Waymark.map_data.toGeoJSON());Waymark.jq_data_container.html(t)},this.map_was_edited=function(){Waymark=this,Waymark.save_data_layer()},this.loading_start=function(){Waymark=this,Waymark.jq_map_container.addClass("waymark-loading")},this.loading_stop=function(){Waymark=this,Waymark.jq_map_container.removeClass("waymark-loading")},this.create_buttons=function(){Waymark=this;var t=Waymark_L.Control.geocoder({position:"bottomright",defaultMarkGeocode:!1,placeholder:Waymark.config.language.action_search_placeholder});t.on("markgeocode",(function(t){Waymark.map.fitBounds(t.geocode.bbox)})),t.addTo(Waymark.map);var e=Waymark_L.Control.extend({options:{position:"bottomleft"},onAdd:function(t){var e,i=Waymark_L.DomUtil.create("div","leaflet-bar leaflet-control waymark-leaflet-control waymark-edit-toolbar");(e=Waymark_L.DomUtil.create("a","waymark-icon waymark-edit-button waymark-edit-line",i)).setAttribute("title",Waymark.config.language.add_line_title),e.onclick=function(){Waymark.map.editTools.startPolyline()},(e=Waymark_L.DomUtil.create("a","waymark-edit-button waymark-edit-image",i)).innerHTML='<i class="ion ion-image"></i>',e.setAttribute("title",Waymark.config.language.add_photo_title),e.classList.add("waymark-hidden"),(e=Waymark_L.DomUtil.create("a","waymark-edit-button waymark-edit-marker",i)).innerHTML='<i class="ion ion-location"></i>',e.setAttribute("title",Waymark.config.language.add_marker_title),e.onclick=function(){var t=Waymark.create_marker_json(Waymark.map.getCenter());Waymark.map_data.addData(t),Waymark.map_was_edited()},(e=Waymark_L.DomUtil.create("a","waymark-edit-button waymark-edit-rectangle",i)).innerHTML='<i class="ion ion-android-checkbox-outline-blank"></i>',e.setAttribute("title",Waymark.config.language.add_rectangle_title),e.onclick=function(){Waymark.map.editTools.startRectangle()},(e=Waymark_L.DomUtil.create("a","waymark-edit-button waymark-edit-polygon",i)).innerHTML='<i class="ion ion-android-star-outline"></i>',e.setAttribute("title",Waymark.config.language.add_polygon_title),e.onclick=function(){Waymark.map.editTools.startPolygon()},(e=Waymark_L.DomUtil.create("a","waymark-edit-button waymark-edit-circle",i)).innerHTML='<i class="ion ion-ios-circle-outline"></i>',e.setAttribute("title",Waymark.config.language.add_circle_title),e.onclick=function(){Waymark.map.editTools.startCircle()},(e=Waymark_L.DomUtil.create("a","waymark-edit-button waymark-edit-upload waymark-hidden",i)).innerHTML='<i class="ion ion-document"></i><i class="ion ion-arrow-up-c"></i>',e.setAttribute("title",Waymark.config.language.upload_file_title);var n=jQuery("<input />").attr({type:"file",name:"add_file"}).css("display","none").change((function(){Waymark.handle_file_upload(jQuery(this))}));return jQuery("#waymark-edit-toolbar").append(n),e.onclick=function(){n.trigger("click"),Waymark.map.editTools.stopDrawing()},i}});Waymark.map.addControl(new e)},this.handle_file_upload=function(t,e={}){Waymark=this,Waymark.loading_start();var i=new FormData;i.append("waymark_security",waymark_security),i.append("action","waymark_read_file"),i.append(t.attr("name"),t[0].files[0]),jQuery.ajax({type:"POST",url:waymark_js.ajaxurl,data:i,dataType:"json",processData:!1,contentType:!1,success:function(i){if(Waymark.debug("File upload response:"),Waymark.debug(i),null===i)return Waymark.message(Waymark.config.language.error_file_upload,"error"),Waymark.loading_stop(),!1;if(i.error)return Waymark.message(i.error,"error"),Waymark.loading_stop(),!1;switch(t.attr("name")){case"add_file":Waymark.load_file_contents(i.file_contents,i.file_type);break;case"add_photo":if(void 0===i.url)return!1;var n=Waymark.map.getCenter();(latlng=Waymark.get_exif_latlng(i))&&(n=latlng,Waymark.map.setView(n));var o=Waymark.get_image_sizes(i.sizes,i.url),a=Waymark.create_marker_json(n,o);Waymark.map_data.addData(a);break;case"marker_photo":if(void 0===i.url)return!1;o=Waymark.get_image_sizes(i.sizes,i.url);e.feature.properties=Object.assign({},e.feature.properties,o),e.img_view.attr("href",e.feature.properties.image_large_url),jQuery("img",e.img_view).attr("src",e.feature.properties.image_thumbnail_url),e.img_input.val(e.feature.properties.image_large_url)}Waymark.map_was_edited(),Waymark.loading_stop()}})},this.build_content=function(t,e,i){Waymark=this;var n=jQuery("<div />"),o=jQuery("<ul />").addClass("waymark-info");if("line"==t||"shape"==t){var a=jQuery("<button />").html('<i class="ion-edit"></i>').addClass("button").attr("title",Waymark.config.language.action_edit+" "+Waymark.title_case(Waymark.config.language["object_label_"+t])).on("click",(function(e){e.preventDefault();var n=jQuery(this),o=jQuery("i",n);return i.editEnabled()?(i.disableEdit(),n.attr("title",Waymark.config.language.action_edit+" "+Waymark.title_case(Waymark.config.language["object_label_"+t])),o.attr("class","ion-edit")):(i.enableEdit(),i.closePopup(),n.attr("title",Waymark.config.language.action_edit_done),o.attr("class","ion-android-done")),!1}));o.append(jQuery("<li />").addClass("waymark-info-button waymark-info-edit waymark-"+t+"-edit").append(a))}a=jQuery("<button />").html('<i class="ion-ios-copy"></i>').addClass("button").attr("title",Waymark.config.language.action_duplicate+" "+Waymark.title_case(Waymark.config.language["object_label_"+t])).on("click",(function(t){return t.preventDefault(),Waymark.load_json(Object.assign({},i.feature)),Waymark.map_was_edited(),!1}));o.append(jQuery("<li />").addClass("waymark-info-button waymark-info-duplicate waymark-"+t+"-duplicate").append(a));a=jQuery("<button />").html('<i class="ion-trash-a"></i>').addClass("button").attr("title",Waymark.config.language.action_delete+" "+Waymark.title_case(Waymark.config.language["object_label_"+t])).on("click",(function(e){return e.preventDefault(),!("1"==Waymark.config.editor_options.confirm_delete&&!confirm(Waymark.config.language.action_delete_confirm+" "+Waymark.title_case(Waymark.config.language["object_label_"+t])+"?"))&&(Waymark.map.removeLayer(i),Waymark.map_data.removeLayer(i),Waymark.map_was_edited(),!1)}));o.append(jQuery("<li />").addClass("waymark-info-button waymark-info-delete waymark-"+t+"-delete").append(a));var r=Waymark.config.map_options[t+"_types"];if("line"==t){var s=jQuery("<select />");s.append(jQuery("<option />").val("").text(Waymark.title_case(Waymark.config.language.no_direction)),jQuery("<option />").val("default").text(Waymark.title_case(Waymark.config.language.show_direction)),jQuery("<option />").val("reverse").text(Waymark.title_case(Waymark.config.language.reverse_direction))),s.change((function(){jQuery("option:selected",jQuery(this));var t=jQuery(this).val();e.properties.direction=t,Waymark.draw_line_direction(i),Waymark.map_was_edited()})),o.append(jQuery("<li />").addClass("waymark-info-direction waymark-line-direction").append(s)),"string"==typeof e.properties.direction&&jQuery("option",s).filter((function(){return jQuery(this).val()==Waymark.make_key(e.properties.direction)})).attr("selected","selected")}var l=jQuery("<select />");for(var h in l.append(jQuery("<option />").attr({disabled:"disabled"}).text(Waymark.title_case(Waymark.config.language["object_label_"+t])+" "+Waymark.config.language.object_type_label+":")),r){var u=Waymark.make_key(r[h][t+"_title"]);l.append(jQuery("<option />").val(u).text(r[h][t+"_title"]))}l.change((function(){jQuery("option:selected",jQuery(this));var n=jQuery(this).val();if(e.properties.type=n,"object"!=typeof n)var o=Waymark.get_type(t,e.properties.type);switch(t){case"line":i.setStyle({color:o.line_colour,weight:o.line_weight,opacity:o.line_opacity});break;case"shape":i.setStyle({color:o.shape_colour,fillOpacity:o.fill_opacity});break;case"marker":i.setIcon(Waymark_L.divIcon(Waymark.build_icon_data(o)))}Waymark.map_was_edited()})),o.append(jQuery("<li />").addClass("waymark-info-type waymark-"+t+"-type").append(l)),jQuery("option",l).filter((function(){return jQuery(this).val()==Waymark.make_key(e.properties.type)})).attr("selected","selected");var d=jQuery("<div />").addClass("waymark-overlay-preview waymark-"+t+"-preview");for(var h in r){var c=r[h][t+"_title"],_=(u=Waymark.make_key(c),Waymark.get_type(t,u)),p=jQuery("<div />").addClass("waymark-type").data("type_key",u).attr("title",c);switch(t){case"marker":var m=Waymark.build_icon_data(_);p.addClass(m.className).html(m.html).css({width:m.iconSize[0],height:m.iconSize[1]});break;case"line":p.addClass("waymark-line").append(jQuery("<div />").css({margin:"15px 0",height:"1px",borderTop:_.line_weight+"px solid "+_.line_colour}));break;case"shape":p.addClass("waymark-shape").css({border:"3px solid "+_.shape_colour}).append(jQuery("<div />").css({height:"20px",background:_.shape_colour,opacity:_.fill_opacity}))}var f=jQuery("<div />").addClass("waymark-overlay-wrap waymark-"+t+"-wrap").attr("title",c);f.append(p),f.on("click",(function(){var e=(p=jQuery(".waymark-type",jQuery(this))).data("type_key");jQuery("option",l).each((function(){p.val()==e?p.attr("selected","selected"):p.removeAttr("selected")})),l.val(e),l.trigger("change"),jQuery(".waymark-"+t+"-wrap",d).each((function(){p.removeClass("waymark-active")})),p.parent(".waymark-"+t+"-wrap").addClass("waymark-active")})),u==Waymark.make_key(e.properties.type)?(f.addClass("waymark-active"),d.prepend(f)):d.append(f)}for(key in o.append(d),Waymark.config[t+"_data_defaults"]){a=null;switch(key){case"title":a=jQuery("<input />").attr({type:"text",value:e.properties.title,placeholder:Waymark.title_case(Waymark.config.language["object_label_"+t])+" "+Waymark.config.language.object_title_placeholder}).on("change",(function(){e.properties.title=jQuery(this).val(),Waymark.map_was_edited()}));break;case"description":a=jQuery("<textarea />").attr({id:"waymark-info-description",class:"wp-editor",placeholder:Waymark.title_case(Waymark.config.language["object_label_"+t])+" "+Waymark.config.language.object_description_placeholder}).val(e.properties.description).on("change",(function(){e.properties.description=jQuery(this).val(),Waymark.map_was_edited()}));break;case"image_large_url":var g=jQuery("<input />").attr({value:e.properties.image_large_url,placeholder:Waymark.config.language.object_image_placeholder}).on("change",(function(){e.properties.image_large_url=jQuery(this).val(),Waymark.map_was_edited()}));if(void 0!==e.properties.image_thumbnail_url)var y=e.properties.image_thumbnail_url;else y=e.properties.image_large_url;var v=jQuery("<img />").attr({src:y,width:160});g.on("change",(function(){v.attr("src",jQuery(this).val())}));var k=jQuery("<a />").attr({href:e.properties.image_large_url,target:"_blank"}).append(v).hover((function(){jQuery(this).addClass("waymark-hover")}),(function(){jQuery(this).removeClass("waymark-hover")}));const i=jQuery("<div />").text(Waymark.config.language.action_upload_image).addClass("button button-small waymark-hidden");a=jQuery("<div />").append(k,g,i)}a&&o.append(jQuery("<li />").addClass("waymark-info-"+key+" waymark-"+t+"-info-"+key).append(a))}if("marker"==t&&void 0!==i.feature.geometry.coordinates){i.feature.geometry.coordinates;var L=i.feature.geometry.coordinates[1],w=i.feature.geometry.coordinates[0];"number"==typeof L&&(w=w.toFixed(6),L=L.toFixed(6)),a=jQuery("<small>").html("<b>"+Waymark.config.language.marker_latlng_label+"</b>: "+L+","+w),o.append(jQuery("<li />").addClass("waymark-info-latlng waymark-marker-info-latlng").append(a))}return o.children().length&&n.append(o),n},this.info_window=function(t,e,i){Waymark=this;Waymark.title_case(Waymark.config.language.action_edit+" "+t);var n=Waymark.build_content(t,e,i).get(0);i.bindPopup(n).openPopup()},this.load_file_contents=function(t,e){switch(Waymark=this,t=t.trim(),e=e.toLowerCase()){case"gpx":var i=(new DOMParser).parseFromString(t,"text/xml"),n=toGeoJSON.gpx(i);break;case"kml":var o=(new DOMParser).parseFromString(t,"text/xml");n=toGeoJSON.kml(o);break;case"json":case"geojson":n=JSON.parse(t);break;default:Waymark.message(Waymark.config.language.error_file_type,"error")}void 0!==n?this.load_json(n):Waymark.message(Waymark.config.language.error_file_conversion,"error")},this.load_json=function(t){if(Waymark=this,"object"==typeof t){Waymark.map_data.addData(t),Waymark.map_was_edited();var e=Waymark.map_data.getBounds();e.isValid()&&Waymark.map.fitBounds(e)}}}function Waymark_Map_Factory(){this.instances=[],this.viewer=function(){var t=Object.assign(new Waymark_Map,new Waymark_Map_Viewer);return this.instances.push(t),t},this.editor=function(){var t=Object.assign(new Waymark_Map,new Waymark_Map_Editor);return this.instances.push(t),t}}"undefined"!=typeof module&&(module.exports=toGeoJSON),function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).togpx=t()}}((function(){return function t(e,i,n){function o(r,s){if(!i[r]){if(!e[r]){var l="function"==typeof require&&require;if(!s&&l)return l(r,!0);if(a)return a(r,!0);var h=new Error("Cannot find module '"+r+"'");throw h.code="MODULE_NOT_FOUND",h}var u=i[r]={exports:{}};e[r][0].call(u.exports,(function(t){var i=e[r][1][t];return o(i||t)}),u,u.exports,t,e,i,n)}return i[r].exports}for(var a="function"==typeof require&&require,r=0;r<n.length;r++)o(n[r]);return o}({1:[function(t,e,i){var n=t("jxon");n.config({attrPrefix:"@"}),e.exports=function(t,e){if("string"==typeof(e=function(t,e){for(var i in t)e.hasOwnProperty(i)&&(t[i]=e[i]);return t}({creator:"togpx",metadata:void 0,featureTitle:function t(e){if(!e)return"";if("object"==typeof e.tags){var i=t(e.tags);if(""!==i)return i}return e.name?e.name:e.ref?e.ref:e.id?e.id:""},featureDescription:function t(e){if(!e)return"";if("object"==typeof e.tags)return t(e.tags);var i="";for(var n in e)"object"!=typeof e[n]&&(i+=n+"="+e[n]+"\n");return i.substr(0,i.length-1)},featureLink:void 0,featureCoordTimes:function(t){return t.properties&&(t.properties.times||t.properties.coordTimes)||null}},e||{})).featureCoordTimes){var i=e.featureCoordTimes;e.featureCoordTimes=function(t){return t.properties[i]}}function a(t,i){e.featureLink&&(t.link={"@href":e.featureLink(i.properties)})}var r={gpx:{"@xmlns":"http://www.topografix.com/GPX/1/1","@xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@xsi:schemaLocation":"http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd","@version":"1.1",metadata:null,wpt:[],trk:[]}};return e.creator&&(r.gpx["@creator"]=e.creator),e.metadata?r.gpx.metadata=e.metadata:delete e.metadata,("FeatureCollection"===t.type?t.features:"Feature"===t.type?[t]:[{type:"Feature",properties:{},geometry:t}]).forEach((function t(i){switch(i.geometry.type){case"Point":case"MultiPoint":var n=i.geometry.coordinates;"Point"==i.geometry.type&&(n=[n]),n.forEach((function(t){o={"@lat":t[1],"@lon":t[0],name:e.featureTitle(i.properties),desc:e.featureDescription(i.properties)},void 0!==t[2]&&(o.ele=t[2]),a(o,i),r.gpx.wpt.push(o)}));break;case"LineString":case"MultiLineString":n=i.geometry.coordinates;var s=e.featureCoordTimes(i);"LineString"==i.geometry.type&&(n=[n]),o={name:e.featureTitle(i.properties),desc:e.featureDescription(i.properties)},a(o,i),o.trkseg=[],n.forEach((function(t){var e={trkpt:[]};t.forEach((function(t,i){var n={"@lat":t[1],"@lon":t[0]};void 0!==t[2]&&(n.ele=t[2]),s&&s[i]&&(n.time=s[i]),e.trkpt.push(n)})),o.trkseg.push(e)})),r.gpx.trk.push(o);break;case"Polygon":case"MultiPolygon":o={name:e.featureTitle(i.properties),desc:e.featureDescription(i.properties)},a(o,i),o.trkseg=[];n=i.geometry.coordinates,s=e.featureCoordTimes(i);"Polygon"==i.geometry.type&&(n=[n]),n.forEach((function(t){t.forEach((function(t){var e={trkpt:[]},i=0;t.forEach((function(t){var n={"@lat":t[1],"@lon":t[0]};void 0!==t[2]&&(n.ele=t[2]),s&&s[i]&&(n.time=s[i]),i++,e.trkpt.push(n)})),o.trkseg.push(e)}))})),r.gpx.trk.push(o);break;case"GeometryCollection":i.geometry.geometries.forEach((function(e){var n={properties:i.properties,geometry:e};t(n)}));break;default:console.log("warning: unsupported geometry type: "+i.geometry.type)}})),gpx_str=n.stringify(r),gpx_str}},{jxon:2}],2:[function(t,e,i){var n,o;n=this,o=function(t,e){var i,n={valueKey:"_",attrKey:"$",attrPrefix:"$",lowerCaseTags:!1,trueIsEmpty:!1,autoDate:!1,ignorePrefixedNodes:!1,parseValues:!1},o=[],a=/^\s*$/,r=/^(?:true|false)$/i;return new function(){function s(t){return n.parseValues?a.test(t)?null:r.test(t)?"true"===t.toLowerCase():isFinite(t)?parseFloat(t):n.autoDate&&isFinite(Date.parse(t))?new Date(t):t:t}function l(){}function h(t,e,i,a){var r,u,d=o.length,c=t.hasChildNodes(),_=t.nodeType===t.ELEMENT_NODE&&t.hasAttributes(),p=Boolean(2&e),m=0,f="",g=p?{}:!!n.trueIsEmpty||"";if(c)for(var y,v=0;v<t.childNodes.length;v++)4===(y=t.childNodes.item(v)).nodeType?f+=y.nodeValue:3===y.nodeType?f+=y.nodeValue.trim():1!==y.nodeType||n.ignorePrefixedNodes&&y.prefix||o.push(y);var k,L=o.length,w=s(f);p||!c&&!_||(g=0===e?null===(k=w)?new l:k instanceof Object?k:new k.constructor(k):{});for(var b=d;b<L;b++)r=o[b].nodeName,n.lowerCaseTags&&(r=r.toLowerCase()),u=h(o[b],e,i,a),g.hasOwnProperty(r)?(g[r].constructor!==Array&&(g[r]=[g[r]]),g[r].push(u)):(g[r]=u,m++);if(_){for(var x,W,C=t.attributes.length,M=a?"":n.attrPrefix,P=a?{}:g,E=0;E<C;m++,E++)W=(x=t.attributes.item(E)).name,n.lowerCaseTags&&(W=W.toLowerCase()),P[M+W]=s(x.value.trim());a&&(i&&Object.freeze(P),g[n.attrKey]=P,m-=C-1)}return 3===e||(2===e||1===e&&m>0)&&f?g[n.valueKey]=w:!p&&0===m&&f&&(g=w),i&&(p||m>0)&&Object.freeze(g),o.length=d,g}this.config=function(e){for(var o in e)n[o]=e[o];n.parserErrorHandler&&(i=new t.DOMParser({errorHandler:n.parserErrorHandler,locator:{}}))},l.prototype.toString=function(){return"null"},l.prototype.valueOf=function(){return null},this.xmlToJs=this.build=function(t,e,i,n){var o=arguments.length>1&&"number"==typeof e?3&e:1;return h(t,o,i||!1,arguments.length>3?n:3===o)},this.jsToXml=this.unbuild=function(i,o,a,r){var s=(t.document&&t.document.implementation||new t.DOMImplementation).createDocument(o||null,a||"",r||null);return function t(i,o,a){var r,s,l;if(a.constructor===String||a.constructor===Number||a.constructor===Boolean){if(o.appendChild(i.createTextNode(a.toString())),a===a.valueOf())return}else a.constructor===Date&&o.appendChild(i.createTextNode(a.toISOString()));for(var h in a)if(void 0!==(r=a[h])&&(null===r&&(r={}),!(isFinite(h)||r instanceof Function)))if(h===n.valueKey)null!==r&&!0!==r&&o.appendChild(i.createTextNode(r.constructor===Date?r.toISOString():String(r)));else if(h===n.attrKey)for(var u in r)o.setAttribute(u,r[u]);else if(h===n.attrPrefix+"xmlns")e&&o.setAttribute(h.slice(1),r);else if(h.charAt(0)===n.attrPrefix)o.setAttribute(h.slice(1),r);else if(r.constructor===Array)for(var d in r)r.hasOwnProperty(d)&&(s=(l=r[d]&&r[d][n.attrPrefix+"xmlns"]||o.namespaceURI)?i.createElementNS(l,h):i.createElement(h),t(i,s,r[d]||{}),o.appendChild(s));else s=(l=(r||{})[n.attrPrefix+"xmlns"]||o.namespaceURI)?i.createElementNS(l,h):i.createElement(h),r instanceof Object?t(i,s,r):null===r||!0===r&&n.trueIsEmpty||s.appendChild(i.createTextNode(r.toString())),o.appendChild(s)}(s,s.documentElement||s,i),s},this.stringToXml=function(e){return i||(i=new t.DOMParser),i.parseFromString(e,"application/xml")},this.xmlToString=function(e){return void 0!==e.xml?e.xml:(new t.XMLSerializer).serializeToString(e)},this.stringToJs=function(t){var e=this.stringToXml(t);return this.xmlToJs(e)},this.jsToString=this.stringify=function(t,e,i,n){return this.xmlToString(this.jsToXml(t,e,i,n))},this.each=function(t,e,i){t instanceof Array?t.forEach(e,i):[t].forEach(e,i)}}},"object"==typeof i?"object"==typeof window&&window.DOMImplementation&&window.XMLSerializer&&window.DOMParser?e.exports=o(window):e.exports=o(t("xmldom"),!0):n.JXON=o(window)},{xmldom:3}],3:[function(t,e,i){},{}]},{},[1])(1)})),function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).tokml=t()}}((function(){return function t(e,i,n){function o(r,s){if(!i[r]){if(!e[r]){var l="function"==typeof require&&require;if(!s&&l)return l(r,!0);if(a)return a(r,!0);var h=new Error("Cannot find module '"+r+"'");throw h.code="MODULE_NOT_FOUND",h}var u=i[r]={exports:{}};e[r][0].call(u.exports,(function(t){return o(e[r][1][t]||t)}),u,u.exports,t,e,i,n)}return i[r].exports}for(var a="function"==typeof require&&require,r=0;r<n.length;r++)o(n[r]);return o}({1:[function(t,e,i){var n=t("xml-escape"),o=t("strxml").tag;function a(t,e){return function(i){if(!i.properties||!r.valid(i.geometry))return"";var a=r.any(i.geometry);if(!a)return"";var s="",u="";if(t.simplestyle){var d=function(t){var e="";t["marker-symbol"]&&(e=e+"ms"+t["marker-symbol"]);t["marker-color"]&&(e=e+"mc"+t["marker-color"].replace("#",""));t["marker-size"]&&(e=e+"ms"+t["marker-size"]);t.stroke&&(e=e+"s"+t.stroke.replace("#",""));t["stroke-width"]&&(e=e+"sw"+t["stroke-width"].toString().replace(".",""));t["stroke-opacity"]&&(e=e+"mo"+t["stroke-opacity"].toString().replace(".",""));t.fill&&(e=e+"f"+t.fill.replace("#",""));t["fill-opacity"]&&(e=e+"fo"+t["fill-opacity"].toString().replace(".",""));return e}(i.properties);d&&(r.isPoint(i.geometry)&&function(t){return!!(t["marker-size"]||t["marker-symbol"]||t["marker-color"])}(i.properties)?(-1===e.indexOf(d)&&(s=function(t,e){return o("Style",{id:e},o("IconStyle",o("Icon",o("href",function(t){var e=t["marker-size"]||"medium",i=t["marker-symbol"]?"-"+t["marker-symbol"]:"",n=(t["marker-color"]||"7e7e7e").replace("#","");return"https://api.tiles.mapbox.com/v3/marker/pin-"+e.charAt(0)+i+"+"+n+".png"}(t))))+o("hotSpot",{xunits:"fraction",yunits:"fraction",x:"0.5",y:"0.5"},""))}(i.properties,d),e.push(d)),u=o("styleUrl","#"+d)):(r.isPolygon(i.geometry)||r.isLine(i.geometry))&&function(t){for(var e in t)if({stroke:!0,"stroke-opacity":!0,"stroke-width":!0,fill:!0,"fill-opacity":!0}[e])return!0}(i.properties)&&(-1===e.indexOf(d)&&(s=function(t,e){var i=o("LineStyle",o("color",h(t.stroke,t["stroke-opacity"])||"ff555555")+o("width",{},void 0===t["stroke-width"]?2:t["stroke-width"])),n="";(t.fill||t["fill-opacity"])&&(n=o("PolyStyle",o("color",{},h(t.fill,t["fill-opacity"])||"88555555")));return o("Style",{id:e},i+n)}(i.properties,d),e.push(d)),u=o("styleUrl","#"+d)))}var c={};return i.id&&(c.id=i.id),s+o("Placemark",c,function(t,e){return t[e.name]?o("name",n(t[e.name])):""}(i.properties,t)+function(t,e){return t[e.description]?o("description",n(t[e.description])):""}(i.properties,t)+function(t){return o("ExtendedData",{},function(t){var e=[];for(var i in t)t[i]?e.push([i,t[i]]):e.push([i,""]);return e}(t).map(l).join(""))}(i.properties)+function(t,e){return t[e.timestamp]?o("TimeStamp",o("when",n(t[e.timestamp]))):""}(i.properties,t)+a+u)}}e.exports=function(t,e){return'<?xml version="1.0" encoding="UTF-8"?>'+o("kml",{xmlns:"http://www.opengis.net/kml/2.2"},o("Document",function(t){return void 0!==t.documentName?o("name",t.documentName):""}(e=e||{documentName:void 0,documentDescription:void 0,name:"name",description:"description",simplestyle:!1,timestamp:"timestamp"})+function(t){return void 0!==t.documentDescription?o("description",t.documentDescription):""}(e)+function(t,e){if(!t.type)return"";var i=[];switch(t.type){case"FeatureCollection":return t.features?t.features.map(a(e,i)).join(""):"";case"Feature":return a(e,i)(t);default:return a(e,i)({type:"Feature",geometry:t,properties:{}})}}(t,e)))};var r={Point:function(t){return o("Point",o("coordinates",t.coordinates.join(",")))},LineString:function(t){return o("LineString",o("coordinates",s(t.coordinates)))},Polygon:function(t){if(!t.coordinates.length)return"";var e=t.coordinates[0],i=t.coordinates.slice(1),n=o("outerBoundaryIs",o("LinearRing",o("coordinates",s(e)))),a=i.map((function(t){return o("innerBoundaryIs",o("LinearRing",o("coordinates",s(t))))})).join("");return o("Polygon",n+a)},MultiPoint:function(t){return t.coordinates.length?o("MultiGeometry",t.coordinates.map((function(t){return r.Point({coordinates:t})})).join("")):""},MultiPolygon:function(t){return t.coordinates.length?o("MultiGeometry",t.coordinates.map((function(t){return r.Polygon({coordinates:t})})).join("")):""},MultiLineString:function(t){return t.coordinates.length?o("MultiGeometry",t.coordinates.map((function(t){return r.LineString({coordinates:t})})).join("")):""},GeometryCollection:function(t){return o("MultiGeometry",t.geometries.map(r.any).join(""))},valid:function(t){return t&&t.type&&(t.coordinates||"GeometryCollection"===t.type&&t.geometries&&t.geometries.every(r.valid))},any:function(t){return r[t.type]?r[t.type](t):""},isPoint:function(t){return"Point"===t.type||"MultiPoint"===t.type},isPolygon:function(t){return"Polygon"===t.type||"MultiPolygon"===t.type},isLine:function(t){return"LineString"===t.type||"MultiLineString"===t.type}};function s(t){return t.map((function(t){return t.join(",")})).join(" ")}function l(t){return o("Data",{name:t[0]},o("value",{},n(t[1]?t[1].toString():"")))}function h(t,e){if("string"!=typeof t)return"";if(3===(t=t.replace("#","").toLowerCase()).length)t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2];else if(6!==t.length)return"";var i=t[0]+t[1],n=t[2]+t[3],o=t[4]+t[5],a="ff";return"number"==typeof e&&e>=0&&e<=1&&((a=(255*e).toString(16)).indexOf(".")>-1&&(a=a.substr(0,a.indexOf("."))),a.length<2&&(a="0"+a)),a+o+n+i}},{strxml:2,"xml-escape":3}],2:[function(t,e,i){var n=t("xml-escape");function o(t){return Object.keys(t).length?" "+Object.keys(t).map((function(e){return e+'="'+n(t[e])+'"'})).join(" "):""}e.exports.attr=o,e.exports.tagClose=function(t,e){return"<"+t+o(e)+"/>"},e.exports.tag=function(t,e,i){(Array.isArray(e)||"string"==typeof e)&&(i=e,e={});Array.isArray(i)&&(i="\n"+i.map((function(t){return"  "+t})).join("\n")+"\n");return"<"+t+o(e)+">"+i+"</"+t+">"}},{"xml-escape":3}],3:[function(t,e,i){(e.exports=function t(e,i){var n;if(null!=e)return e=e.toString(),i=(i||"").replace(/[^&"<>\']/g,""),n="([&\"<>'])".replace(new RegExp("["+i+"]","g"),""),e.replace(new RegExp(n,"g"),(function(e,i){return t.map[i]}))}).map={">":"&gt;","<":"&lt;","'":"&apos;",'"':"&quot;","&":"&amp;"}},{}]},{},[1])(1)})),window.Waymark_Map_Factory=new Waymark_Map_Factory;
Note: See TracChangeset for help on using the changeset viewer.