UNPKG

nextzen.js

Version:

Javascript SDK for Nextzen products

1 lines 1.24 MB
!function r(o,s,l){function u(n,e){if(!s[n]){if(!o[n]){var t="function"==typeof require&&require;if(!e&&t)return t(n,!0);if(d)return d(n,!0);var i=new Error("Cannot find module '"+n+"'");throw i.code="MODULE_NOT_FOUND",i}var a=s[n]={exports:{}};o[n][0].call(a.exports,function(e){var t=o[n][1][e];return u(t||e)},a,a.exports,r,o,s,l)}return s[n].exports}for(var d="function"==typeof require&&require,e=0;e<l.length;e++)u(l[e]);return u}({1:[function(e,t,n){"undefined"!==typeof t&&(t.exports=function(e,t,n){var i=!1;if("undefined"===typeof window.XMLHttpRequest)return t(Error("Browser not supported"));if("undefined"===typeof n){var a=e.match(/^\s*https?:\/\/[^\/]*/);n=a&&a[0]!==location.protocol+"//"+location.hostname+(location.port?":"+location.port:"")}var r=new window.XMLHttpRequest;if(n&&!("withCredentials"in r)){r=new window.XDomainRequest;var o=t;t=function(){if(i)o.apply(this,arguments);else{var e=this,t=arguments;setTimeout(function(){o.apply(e,t)},0)}}}function s(){var e;void 0===r.status||(e=r.status)>=200&&e<300||304===e?t.call(r,null,r):t.call(r,r,null)}return"onload"in r?r.onload=s:r.onreadystatechange=function(){4===r.readyState&&s()},r.onerror=function(e){t.call(this,e||!0,null),t=function(){}},r.onprogress=function(){},r.ontimeout=function(e){t.call(this,e,null),t=function(){}},r.onabort=function(e){t.call(this,e,null),t=function(){}},r.open("GET",e,!0),r.send(null),i=!0,r})},{}],2:[function(e,t,n){"use strict";var i={};function r(e){return Math.floor(Math.abs(e)+.5)*Math.sign(e)}function s(e,t,n){var i=(e=r(e*n))-(t=r(t*n));i<<=1,e-t<0&&(i=~i);for(var a="";i>=32;)a+=String.fromCharCode(63+(32|31&i)),i>>=5;return a+=String.fromCharCode(i+63)}function a(e){for(var t=[],n=0;n<e.length;n++)t.push(e[n].slice().reverse());return t}i.decode=function(e,t){for(var n,i=0,a=0,r=0,o=[],s=0,l=0,u=null,d=Math.pow(10,t||5);i<e.length;){for(u=null,l=s=0;l|=(31&(u=e.charCodeAt(i++)-63))<<s,s+=5,u>=32;);for(n=1&l?~(l>>1):l>>1,s=l=0;l|=(31&(u=e.charCodeAt(i++)-63))<<s,s+=5,u>=32;);a+=n,r+=1&l?~(l>>1):l>>1,o.push([a/d,r/d])}return o},i.encode=function(e,t){if(!e.length)return"";for(var n=Math.pow(10,t||5),i=s(e[0][0],0,n)+s(e[0][1],0,n),a=1;a<e.length;a++){var r=e[a],o=e[a-1];i+=s(r[0],o[0],n),i+=s(r[1],o[1],n)}return i},i.fromGeoJSON=function(e,t){if(e&&"Feature"===e.type&&(e=e.geometry),!e||"LineString"!==e.type)throw new Error("Input must be a GeoJSON LineString");return i.encode(a(e.coordinates),t)},i.toGeoJSON=function(e,t){return{type:"LineString",coordinates:a(i.decode(e,t))}},"object"===typeof t&&t.exports&&(t.exports=i)},{}],3:[function(e,t,n){!function(e){"use strict";e.console||(e.console={});for(var t,n,i=e.console,a=function(){},r=["memory"],o="assert,clear,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn".split(",");t=r.pop();)i[t]||(i[t]={});for(;n=o.pop();)"function"!==typeof i[n]&&(i[n]=a)}("undefined"===typeof window?this:window)},{}],4:[function(e,t,n){var s=e("leaflet"),r=e("../util");t.exports={class:s.Class.extend({options:{serviceUrl:"https://search.mapzen.com/v1",geocodingQueryParams:{},reverseQueryParams:{}},initialize:function(e,t){s.Util.setOptions(this,t),this._apiKey=e,this._lastSuggest=0},geocode:function(e,t,n){var i=this;r.getJSON(this.options.serviceUrl+"/search",s.extend({api_key:this._apiKey,text:e},this.options.geocodingQueryParams),function(e){t.call(n,i._parseResults(e,"bbox"))})},suggest:function(e,t,n){var i=this;r.getJSON(this.options.serviceUrl+"/autocomplete",s.extend({api_key:this._apiKey,text:e},this.options.geocodingQueryParams),s.bind(function(e){e.geocoding.timestamp>this._lastSuggest&&(this._lastSuggest=e.geocoding.timestamp,t.call(n,i._parseResults(e,"bbox")))},this))},reverse:function(e,t,n,i){var a=this;r.getJSON(this.options.serviceUrl+"/reverse",s.extend({api_key:this._apiKey,"point.lat":e.lat,"point.lon":e.lng},this.options.reverseQueryParams),function(e){n.call(i,a._parseResults(e,"bounds"))})},_parseResults:function(e,r){var o=[];return s.geoJson(e,{pointToLayer:function(e,t){return s.circleMarker(t)},onEachFeature:function(e,t){var n,i,a={};t.getBounds?i=(n=t.getBounds()).getCenter():(i=t.getLatLng(),n=s.latLngBounds(i,i)),a.name=t.feature.properties.label,a.center=i,a[r]=n,a.properties=t.feature.properties,o.push(a)}}),o}}),factory:function(e,t){return new s.Control.Geocoder.Mapzen(e,t)}}},{"../util":5,leaflet:22}],5:[function(e,t,n){var s=e("leaflet"),l=0,a=function(){var t=/[&<>"'`]/g,n=/[&<>"'`]/,i={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};function a(e){return i[e]}return function(e){return null==e?"":e?(e=""+e,n.test(e)?e.replace(t,a):e):e+""}}();t.exports={jsonp:function(e,t,n,i,a){var r="_l_geocoder_"+l++;t[a||"callback"]=r,window[r]=s.Util.bind(n,i);var o=document.createElement("script");o.type="text/javascript",o.src=e+s.Util.getParamString(t),o.id=r,document.getElementsByTagName("head")[0].appendChild(o)},getJSON:function(e,t,n){var i=new XMLHttpRequest;i.onreadystatechange=function(){4===i.readyState&&(200===i.status||304===i.status?n(JSON.parse(i.response)):n(""))},i.open("GET",e+s.Util.getParamString(t),!0),i.setRequestHeader("Accept","application/json"),i.send(null)},template:function(e,i){return e.replace(/\{ *([\w_]+) *\}/g,function(e,t){var n=i[t];return void 0===n?n="":"function"===typeof n&&(n=n(i)),a(n)})},htmlEscape:a}},{leaflet:22}],6:[function(e,t,n){"use strict";e("console-polyfill");var c=e("leaflet"),i=e("@mapbox/corslite"),a=e("./utils/throttle"),r=e("./utils/escapeRegExp"),o=c.Control.extend({version:"1.9.4",includes:c.Evented?c.Evented.prototype:c.Mixin.Events,options:{position:"topleft",attribution:'Geocoding by <a href="https://mapzen.com/projects/search/">Mapzen</a>',url:"https://search.mapzen.com/v1",placeholder:null,bounds:!1,focus:!0,layers:null,panToPoint:!0,pointIcon:!0,polygonIcon:!0,fullWidth:650,markers:!0,overrideBbox:!1,expanded:!1,autocomplete:!0,place:!1,textStrings:{INPUT_PLACEHOLDER:"Search",INPUT_TITLE_ATTRIBUTE:"Search",RESET_TITLE_ATTRIBUTE:"Reset",NO_RESULTS:"No results were found.",ERROR_403:"A valid API key is needed for this search feature.",ERROR_404:"The search service cannot be found. :-(",ERROR_408:"The search service took too long to respond. Try again in a second.",ERROR_429:"There were too many requests. Try again in a second.",ERROR_500:"The search service is not working right now. Please try again later.",ERROR_502:"Connection lost. Please try again later.",ERROR_DEFAULT:"The search service is having problems :-("}},initialize:function(e,t){if(window.XDomainRequest&&(this.options.url="//search.mapzen.com/v1"),"object"===typeof e&&e?t=e:this.apiKey=e,t&&"undefined"!==typeof t.latlng&&("undefined"===typeof t.focus&&(t.focus=t.latlng),console.warn("[leaflet-geocoder-mapzen] DEPRECATION WARNING:","As of v1.6.0, the `latlng` option is deprecated. It has been renamed to `focus`. `latlng` will be removed in a future version.")),t&&"undefined"!==typeof t.title&&(t.textStrings=t.textStrings||{},t.textStrings.INPUT_TITLE_ATTRIBUTE=t.title,console.warn("[leaflet-geocoder-mapzen] DEPRECATION WARNING:","As of v1.8.0, the `title` option is deprecated. Please set the property `INPUT_TITLE_ATTRIBUTE` on the `textStrings` option instead. `title` will be removed in a future version.")),t&&"undefined"!==typeof t.placeholder&&(t.textStrings&&"undefined"!==typeof t.textStrings.INPUT_PLACEHOLDER||(t.textStrings=t.textStrings||{},t.textStrings.INPUT_PLACEHOLDER=t.placeholder)),t&&"object"===typeof t.textStrings)for(var n in this.options.textStrings)"undefined"===typeof t.textStrings[n]&&(t.textStrings[n]=this.options.textStrings[n]);c.Util.setOptions(this,t),this.markers=[]},reset:function(){this._input.value="",c.DomUtil.addClass(this._reset,"leaflet-pelias-hidden"),this.removeMarkers(),this.clearResults(),this.fire("reset")},getLayers:function(e){var t=this.options.layers;return t&&(e.layers=t),e},getBoundingBoxParam:function(e){var t=this.options.bounds;if(!t)return e;if(!0===t&&this._map)e=i(e,t=this._map.getBounds());else if("object"===typeof t&&t.isValid&&t.isValid())e=i(e,t);else if(c.Util.isArray(t)){var n=c.latLngBounds(t);n.isValid&&n.isValid()&&(e=i(e,n))}function i(e,t){return e["boundary.rect.min_lon"]=t.getWest(),e["boundary.rect.min_lat"]=t.getSouth(),e["boundary.rect.max_lon"]=t.getEast(),e["boundary.rect.max_lat"]=t.getNorth(),e}return e},getFocusParam:function(e){var t=this.options.focus;if(!t)return e;if(!0===t&&this._map){var n=this._map.getCenter();e["focus.point.lat"]=n.lat,e["focus.point.lon"]=n.lng}else if("object"===typeof t){var i=c.latLng(t);e["focus.point.lat"]=i.lat,e["focus.point.lon"]=i.lng}return e},getParams:function(e){e=e||{},e=this.getBoundingBoxParam(e),e=this.getFocusParam(e),e=this.getLayers(e),this.apiKey&&(e.api_key=this.apiKey);var t=this.options.params;if(!t)return e;if("object"===typeof t)for(var n in t)e[n]=t[n];return e},serialize:function(e){var t="";for(var n in e)if(e.hasOwnProperty(n)){var i,a=e[n],r=a.toString();switch(t.length&&(t+="&"),r){case"[object Array]":i="[object Object]"===a[0].toString()?JSON.stringify(a):a.join(",");break;case"[object Object]":i=JSON.stringify(a);break;case"[object Date]":i=a.valueOf();break;default:i=a}t+=encodeURIComponent(n)+"="+encodeURIComponent(i)}return t},search:function(e){if(e){var t=this.options.url+"/search",n={text:e};this.callPelias(t,n,"search")}},autocomplete:a(function(e){if(e){var t=this.options.url+"/autocomplete",n={text:e};this.callPelias(t,n,"autocomplete")}},250),place:function(e){if(e){var t=this.options.url+"/place",n={ids:e};this.callPelias(t,n,"place")}},handlePlaceResponse:function(e){},maxReqTimestampRendered:(new Date).getTime(),callPelias:function(a,r,o){r=this.getParams(r),c.DomUtil.addClass(this._search,"leaflet-pelias-loading");var s=(new Date).getTime(),e=this.serialize(r),l=this;i(a+"?"+e,function(t,e){var n;c.DomUtil.removeClass(l._search,"leaflet-pelias-loading");try{n=JSON.parse(e.responseText)}catch(e){t={code:500,message:"Parse Error"}}if(t){var i;switch(t.code){case 403:i=l.options.textStrings.ERROR_403;break;case 404:i=l.options.textStrings.ERROR_404;break;case 408:i=l.options.textStrings.ERROR_408;break;case 429:i=l.options.textStrings.ERROR_429;break;case 500:i=l.options.textStrings.ERROR_500;break;case 502:i=l.options.textStrings.ERROR_502;break;default:i=l.options.textStrings.ERROR_DEFAULT}l.showMessage(i),l.fire("error",{results:n,endpoint:a,requestType:o,params:r,errorCode:t.code,errorMessage:i})}if(n&&n.geocoding&&n.geocoding.errors)return i=n.geocoding.errors[0],l.showMessage(i),void l.fire("error",{results:n,endpoint:a,requestType:o,params:r,errorCode:t.code,errorMessage:i});if(n&&n.features){if("autocomplete"===o||"search"===o){if(""===l._input.value||l.maxReqTimestampRendered>=s)return;l.maxReqTimestampRendered=s}"place"===o&&l.handlePlaceResponse(n),"autocomplete"!==o&&"search"!==o||l.showResults(n.features,r.text),l.fire("results",{results:n,endpoint:a,requestType:o,params:r})}},!0)},highlight:function(e,t){var n=RegExp("("+r(t)+")","gi");return e.replace(n,"<strong>$1</strong>")},getIconType:function(e){var t=this.options.pointIcon,n=this.options.polygonIcon,i="leaflet-pelias-layer-icon-";return e.match("venue")||e.match("address")?!0===t?{type:"class",value:i+"point"}:!1!==t&&{type:"image",value:t}:!0===n?{type:"class",value:i+"polygon"}:!1!==n&&{type:"image",value:n}},showResults:function(e,t){if(0!==e.length){var n=this._results;n.innerHTML="",n.style.display="block",n.style.maxHeight=this._map.getSize().y-n.offsetTop-this._container.offsetTop-20+"px";for(var i=c.DomUtil.create("ul","leaflet-pelias-list",n),a=0,r=e.length;a<r;a++){var o=e[a],s=c.DomUtil.create("li","leaflet-pelias-result",i);s.feature=o,s.layer=o.properties.layer,s.coords=o.geometry.coordinates;var l=this.getIconType(o.properties.layer);if(l){var u,d=c.DomUtil.create("span","leaflet-pelias-layer-icon-container",s);"class"===l.type?u=c.DomUtil.create("div","leaflet-pelias-layer-icon "+l.value,d):(u=c.DomUtil.create("img","leaflet-pelias-layer-icon",d)).src=l.value,u.title="layer: "+o.properties.layer}s.innerHTML+=this.highlight(o.properties.label,t)}}else this.showMessage(this.options.textStrings.NO_RESULTS)},showMessage:function(e){var t=this._results;t.innerHTML="",t.style.display="block",c.DomUtil.create("div","leaflet-pelias-message",t).appendChild(document.createTextNode(e))},removeMarkers:function(){if(this.options.markers){for(var e=0;e<this.markers.length;e++)this._map.removeLayer(this.markers[e]);this.markers=[]}},showMarker:function(e,t){this._map.setView(t,this._map.getZoom()||8);var n="object"===typeof this.options.markers?this.options.markers:{};if(this.options.markers){var i=new c.marker(t,n).bindPopup(e);this._map.addLayer(i),this.markers.push(i),i.openPopup()}},fitBoundingBox:function(e){this._map.fitBounds([[e[1],e[0]],[e[3],e[2]]],{animate:!0,maxZoom:16})},setSelectedResult:function(e,t){var n=c.GeoJSON.coordsToLatLng(e.feature.geometry.coordinates);this._input.value=e.textContent||e.innerText;var i=e.feature.properties.layer;"venue"!==i&&"address"!==i&&e.feature.bbox&&!this.options.overrideBbox?(this.removeMarkers(),this.fitBoundingBox(e.feature.bbox)):(this.removeMarkers(),this.showMarker(e.innerHTML,n)),this.fire("select",{originalEvent:t,latlng:n,feature:e.feature}),this.blur(),this.options.place&&e.feature.properties.gid&&this.place(e.feature.properties.gid)},focus:function(){c.DomUtil.hasClass(this._container,"leaflet-pelias-expanded")||this.expand(),this._input.focus()},blur:function(){this._input.blur(),this.clearResults(),""===this._input.value&&"none"!==this._results.style.display&&(c.DomUtil.addClass(this._reset,"leaflet-pelias-hidden"),this.options.expanded||this.collapse())},clearResults:function(e){this._results.style.display="none",""!==this._input.value&&!0!==e||(this._results.innerHTML=""),this._enableMapScrollWheelZoom()},expand:function(){c.DomUtil.addClass(this._container,"leaflet-pelias-expanded"),this.setFullWidth(),this.fire("expand")},collapse:function(){c.DomUtil.removeClass(this._container,"leaflet-pelias-expanded"),this._input.blur(),this.clearFullWidth(),this.clearResults(),this.fire("collapse")},setFullWidth:function(){if(this.options.fullWidth){this._map.invalidateSize();var e=this._map.getSize().x,t=e-20-(c.Browser.touch?4:0);if("number"===typeof this.options.fullWidth&&e>=window.parseInt(this.options.fullWidth,10))return void this.clearFullWidth();this._container.style.width=t.toString()+"px"}},clearFullWidth:function(){this.options.fullWidth&&(this._container.style.width="")},onAdd:function(e){var t=c.DomUtil.create("div","leaflet-pelias-control leaflet-bar leaflet-control");return this._body=document.body||document.getElementsByTagName("body")[0],this._container=t,this._input=c.DomUtil.create("input","leaflet-pelias-input",this._container),this._input.spellcheck=!1,c.DomEvent.addListener(this._input,"focus",function(e){this.fire("focus",{originalEvent:e})},this),c.DomEvent.addListener(this._input,"blur",function(e){this.fire("blur",{originalEvent:e})},this),this.options.textStrings.INPUT_TITLE_ATTRIBUTE&&(this._input.title=this.options.textStrings.INPUT_TITLE_ATTRIBUTE),this.options.textStrings.INPUT_PLACEHOLDER&&(this._input.placeholder=this.options.textStrings.INPUT_PLACEHOLDER),this._search=c.DomUtil.create("a","leaflet-pelias-search-icon",this._container),this._reset=c.DomUtil.create("div","leaflet-pelias-close leaflet-pelias-hidden",this._container),this._reset.innerHTML="×",this._reset.title=this.options.textStrings.RESET_TITLE_ATTRIBUTE,this._results=c.DomUtil.create("div","leaflet-pelias-results leaflet-bar",this._container),this.options.expanded&&this.expand(),c.DomEvent.on(this._container,"click",function(e){this._input.focus()},this).on(this._input,"focus",function(e){this._input.value&&this._results.children.length&&(this._results.style.display="block")},this).on(this._map,"click",function(e){this.blur()},this).on(this._search,"click",function(e){c.DomEvent.stopPropagation(e),c.DomUtil.hasClass(this._container,"leaflet-pelias-expanded")?!0===this.options.expanded?this._input.focus():(c.DomUtil.addClass(this._reset,"leaflet-pelias-hidden"),this.collapse()):(this._input.value.length>0&&c.DomUtil.removeClass(this._reset,"leaflet-pelias-hidden"),this.expand(),this._input.focus())},this).on(this._reset,"click",function(e){this.reset(),this._input.focus(),c.DomEvent.stopPropagation(e)},this).on(this._input,"keydown",function(e){for(var t,n=this._results.querySelectorAll(".leaflet-pelias-result"),i=this._results.querySelectorAll(".leaflet-pelias-selected")[0],a=this,r=function(e,t){if(e&&t.panToPoint){var n=e.feature.properties.layer;"venue"!==n&&"address"!==n&&e.feature.bbox&&!t.overrideBbox?(a.removeMarkers(),a.fitBoundingBox(e.feature.bbox)):(a.removeMarkers(),a.showMarker(e.innerHTML,c.GeoJSON.coordsToLatLng(e.feature.geometry.coordinates)))}},o=function(e){var t=e.getBoundingClientRect(),n=a._results.getBoundingClientRect();t.bottom>n.bottom?a._results.scrollTop=e.offsetTop+e.offsetHeight-a._results.offsetHeight:t.top<n.top&&(a._results.scrollTop=e.offsetTop)},s=0;s<n.length;s++)if(n[s]===i){t=s;break}switch(e.keyCode){case 13:if(i)this.setSelectedResult(i,e);else{var l=(e.target||e.srcElement).value;this.search(l)}c.DomEvent.preventDefault(e);break;case 38:if(0===n.length||"none"===this._results.style.display)return;i&&c.DomUtil.removeClass(i,"leaflet-pelias-selected");var u=n[t-1],d=i&&u?u:n[n.length-1];c.DomUtil.addClass(d,"leaflet-pelias-selected"),o(d),r(d,this.options),this._input.value=d.textContent||d.innerText,this.fire("highlight",{originalEvent:e,latlng:c.GeoJSON.coordsToLatLng(d.feature.geometry.coordinates),feature:d.feature}),c.DomEvent.preventDefault(e);break;case 40:if(0===n.length||"none"===this._results.style.display)return;i&&c.DomUtil.removeClass(i,"leaflet-pelias-selected");var h=n[t+1];d=i&&h?h:n[0];c.DomUtil.addClass(d,"leaflet-pelias-selected"),o(d),r(d,this.options),this._input.value=d.textContent||d.innerText,this.fire("highlight",{originalEvent:e,latlng:c.GeoJSON.coordsToLatLng(d.feature.geometry.coordinates),feature:d.feature}),c.DomEvent.preventDefault(e)}},this).on(this._input,"keyup",function(e){var t=e.which||e.keyCode,n=(e.target||e.srcElement).value;if(n.length>0?c.DomUtil.removeClass(this._reset,"leaflet-pelias-hidden"):c.DomUtil.addClass(this._reset,"leaflet-pelias-hidden"),13!==t&&38!==t&&40!==t)return 27===t?(0!==n.length&&"none"!==this._results.style.display||(this._input.blur(),!this.options.expanded&&c.DomUtil.hasClass(this._container,"leaflet-pelias-expanded")&&this.collapse()),this.clearResults(!0),void c.DomUtil.removeClass(this._search,"leaflet-pelias-loading")):void(n!==this._lastValue&&((this._lastValue=n).length>=1&&!0===this.options.autocomplete?this.autocomplete(n):this.clearResults(!0)))},this).on(this._results,"click",function(e){c.DomEvent.preventDefault(e),c.DomEvent.stopPropagation(e);var t=this._results.querySelectorAll(".leaflet-pelias-selected")[0];t&&c.DomUtil.removeClass(t,"leaflet-pelias-selected");var n=e.target||e.srcElement,i=function(){return c.DomUtil.hasClass(n,"leaflet-pelias-result")||(n=n.parentElement)&&i(),n};i(),n&&(c.DomUtil.addClass(n,"leaflet-pelias-selected"),this.setSelectedResult(n,e))},this),this.options.fullWidth&&c.DomEvent.on(window,"resize",function(e){c.DomUtil.hasClass(this._container,"leaflet-pelias-expanded")&&this.setFullWidth()},this),c.DomEvent.on(this._results,"mouseover",this._disableMapScrollWheelZoom,this),c.DomEvent.on(this._results,"mouseout",this._enableMapScrollWheelZoom,this),c.DomEvent.on(this._map,"mousedown",this._onMapInteraction,this),c.DomEvent.on(this._map,"touchstart",this._onMapInteraction,this),c.DomEvent.disableClickPropagation(this._container),e.attributionControl&&e.attributionControl.addAttribution(this.options.attribution),t},_onMapInteraction:function(e){this.blur(),this.options.expanded||!this._input.value&&c.DomUtil.hasClass(this._container,"leaflet-pelias-expanded")&&this.collapse()},_disableMapScrollWheelZoom:function(e){this._scrollWheelZoomEnabled=this._map.scrollWheelZoom.enabled(),this._scrollWheelZoomEnabled&&this._map.scrollWheelZoom.disable()},_enableMapScrollWheelZoom:function(e){this._scrollWheelZoomEnabled&&this._map.scrollWheelZoom.enable()},onRemove:function(e){e.attributionControl&&e.attributionControl.removeAttribution(this.options.attribution)}});t.exports=o},{"./utils/escapeRegExp":7,"./utils/throttle":8,"@mapbox/corslite":1,"console-polyfill":3,leaflet:22}],7:[function(e,t,n){t.exports=function(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}},{}],8:[function(e,t,n){t.exports=function(n,i,a){var r,o,s,l=null,u=0;a||(a={});var d=function(){u=!1===a.leading?0:(new Date).getTime(),l=null,s=n.apply(r,o),l||(r=o=null)};return function(){var e=(new Date).getTime();u||!1!==a.leading||(u=e);var t=i-(e-u);return r=this,o=arguments,t<=0||t>i?(l&&(clearTimeout(l),l=null),u=e,s=n.apply(r,o),l||(r=o=null)):l||!1===a.trailing||(l=setTimeout(d,t)),s}}},{}],9:[function(e,t,n){!function(){"use strict";var r=e("leaflet");t.exports=r.Class.extend({options:{timeout:500,blurTimeout:100,noResultsMessage:"No results found."},initialize:function(e,t,n,i){r.setOptions(this,i),this._elem=e,this._resultFn=i.resultFn?r.Util.bind(i.resultFn,i.resultContext):null,this._autocomplete=i.autocompleteFn?r.Util.bind(i.autocompleteFn,i.autocompleteContext):null,this._selectFn=r.Util.bind(t,n),this._container=r.DomUtil.create("div","leaflet-routing-geocoder-result"),this._resultTable=r.DomUtil.create("table","",this._container),r.DomEvent.addListener(this._elem,"input",this._keyPressed,this),r.DomEvent.addListener(this._elem,"keypress",this._keyPressed,this),r.DomEvent.addListener(this._elem,"keydown",this._keyDown,this),r.DomEvent.addListener(this._elem,"blur",function(){this._isOpen&&this.close()},this)},close:function(){r.DomUtil.removeClass(this._container,"leaflet-routing-geocoder-result-open"),this._isOpen=!1},_open:function(){var e=this._elem.getBoundingClientRect();if(!this._container.parentElement){var t=void 0!==window.pageXOffset?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,n=void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop;this._container.style.left=e.left+t+"px",this._container.style.top=e.bottom+n+"px",this._container.style.width=e.right-e.left+"px",document.body.appendChild(this._container)}r.DomUtil.addClass(this._container,"leaflet-routing-geocoder-result-open"),this._isOpen=!0},_setResults:function(e){var t,n,i,a;for(delete this._selection,this._results=e;this._resultTable.firstChild;)this._resultTable.removeChild(this._resultTable.firstChild);for(t=0;t<e.length;t++)(n=r.DomUtil.create("tr","",this._resultTable)).setAttribute("data-result-index",t),i=r.DomUtil.create("td","",n),a=document.createTextNode(e[t].name),i.appendChild(a),r.DomEvent.addListener(i,"mousedown",r.DomEvent.preventDefault),r.DomEvent.addListener(i,"click",this._createClickListener(e[t]));t||(n=r.DomUtil.create("tr","",this._resultTable),(i=r.DomUtil.create("td","leaflet-routing-geocoder-no-results",n)).innerHTML=this.options.noResultsMessage),this._open(),e.length>0&&this._select(1)},_createClickListener:function(e){var t=this._resultSelected(e);return r.bind(function(){this._elem.blur(),t()},this)},_resultSelected:function(e){return r.bind(function(){this.close(),this._elem.value=e.name,this._lastCompletedText=e.name,this._selectFn(e)},this)},_keyPressed:function(e){var t;return this._isOpen&&13===e.keyCode&&this._selection?(t=parseInt(this._selection.getAttribute("data-result-index"),10),this._resultSelected(this._results[t])(),void r.DomEvent.preventDefault(e)):13!==e.keyCode?this._autocomplete&&document.activeElement===this._elem?(this._timer&&clearTimeout(this._timer),void(this._timer=setTimeout(r.Util.bind(function(){this._complete(this._autocomplete)},this),this.options.timeout))):void this._unselect():void this._complete(this._resultFn,!0)},_select:function(e){var t=this._selection;t&&(r.DomUtil.removeClass(t.firstChild,"leaflet-routing-geocoder-selected"),t=t[e>0?"nextSibling":"previousSibling"]),t||(t=this._resultTable[e>0?"firstChild":"lastChild"]),t&&(r.DomUtil.addClass(t.firstChild,"leaflet-routing-geocoder-selected"),this._selection=t)},_unselect:function(){this._selection&&r.DomUtil.removeClass(this._selection.firstChild,"leaflet-routing-geocoder-selected"),delete this._selection},_keyDown:function(e){if(this._isOpen)switch(e.keyCode){case 27:return this.close(),void r.DomEvent.preventDefault(e);case 38:return this._select(-1),void r.DomEvent.preventDefault(e);case 40:return this._select(1),void r.DomEvent.preventDefault(e)}},_complete:function(e,t){var n=this._elem.value;function i(e){this._lastCompletedText=n,t&&1===e.length?this._resultSelected(e[0])():this._setResults(e)}n&&(n!==this._lastCompletedText?e(n,i,this):t&&i.call(this,this._results))}})}()},{leaflet:22}],10:[function(e,r,t){!function(){"use strict";var o=e("leaflet"),i=e("./itinerary"),n=e("./line"),t=e("./plan"),a=e("./osrm-v1");r.exports=i.extend({options:{fitSelectedRoutes:"smart",routeLine:function(e,t){return new n(e,t)},autoRoute:!0,routeWhileDragging:!1,routeDragInterval:500,waypointMode:"connect",showAlternatives:!1,defaultErrorHandler:function(e){console.error("Routing error:",e.error)}},initialize:function(e){o.Util.setOptions(this,e),this._router=this.options.router||new a(e),this._plan=this.options.plan||new t(this.options.waypoints,e),this._requestCount=0,i.prototype.initialize.call(this,e),this.on("routeselected",this._routeSelected,this),this.options.defaultErrorHandler&&this.on("routingerror",this.options.defaultErrorHandler),this._plan.on("waypointschanged",this._onWaypointsChanged,this),e.routeWhileDragging&&this._setupRouteDragging(),this.options.autoRoute&&this.route()},_onZoomEnd:function(){if(this._selectedRoute&&this._router.requiresMoreDetail){var e=this._map;this._router.requiresMoreDetail(this._selectedRoute,e.getZoom(),e.getBounds())&&this.route({callback:o.bind(function(e,t){var n;if(!e){for(n=0;n<t.length;n++)this._routes[n].properties=t[n].properties;this._updateLineCallback(e,t)}},this),simplifyGeometry:!1,geometryOnly:!0})}},onAdd:function(e){var t=i.prototype.onAdd.call(this,e);return this._map=e,this._map.addLayer(this._plan),this._map.on("zoomend",this._onZoomEnd,this),this._plan.options.geocoder&&t.insertBefore(this._plan.createGeocoders(),t.firstChild),t},onRemove:function(e){if(e.off("zoomend",this._onZoomEnd,this),this._line&&e.removeLayer(this._line),e.removeLayer(this._plan),this._alternatives&&this._alternatives.length>0)for(var t=0,n=this._alternatives.length;t<n;t++)e.removeLayer(this._alternatives[t]);return i.prototype.onRemove.call(this,e)},getWaypoints:function(){return this._plan.getWaypoints()},setWaypoints:function(e){return this._plan.setWaypoints(e),this},spliceWaypoints:function(){return this._plan.spliceWaypoints.apply(this._plan,arguments)},getPlan:function(){return this._plan},getRouter:function(){return this._router},_routeSelected:function(e){var t=this._selectedRoute=e.route,n=this.options.showAlternatives&&e.alternatives,i=this.options.fitSelectedRoutes,a="smart"===i&&!this._waypointsVisible()||"smart"!==i&&i;this._updateLines({route:t,alternatives:n}),a&&this._map.fitBounds(this._line.getBounds()),"snap"===this.options.waypointMode&&(this._plan.off("waypointschanged",this._onWaypointsChanged,this),this.setWaypoints(t.waypoints),this._plan.on("waypointschanged",this._onWaypointsChanged,this))},_waypointsVisible:function(){var e,t,n,i,a,r=this.getWaypoints();try{for(e=this._map.getSize(),i=0;i<r.length;i++)a=this._map.latLngToLayerPoint(r[i].latLng),t?t.extend(a):t=o.bounds([a]);return((n=t.getSize()).x>e.x/5||n.y>e.y/5)&&this._waypointsInViewport()}catch(e){return!1}},_waypointsInViewport:function(){var e,t,n=this.getWaypoints();try{e=this._map.getBounds()}catch(e){return!1}for(t=0;t<n.length;t++)if(e.contains(n[t].latLng))return!0;return!1},_updateLines:function(e){var t=void 0===this.options.addWaypoints||this.options.addWaypoints;this._clearLines(),this._alternatives=[],e.alternatives&&e.alternatives.forEach(function(e,t){this._alternatives[t]=this.options.routeLine(e,o.extend({isAlternative:!0},this.options.altLineOptions||this.options.lineOptions)),this._alternatives[t].addTo(this._map),this._hookAltEvents(this._alternatives[t])},this),this._line=this.options.routeLine(e.route,o.extend({addWaypoints:t,extendToWaypoints:"connect"===this.options.waypointMode},this.options.lineOptions)),this._line.addTo(this._map),this._hookEvents(this._line)},_hookEvents:function(e){e.on("linetouched",function(e){this._plan.dragNewWaypoint(e)},this)},_hookAltEvents:function(e){e.on("linetouched",function(e){var t=this._routes.slice(),n=t.splice(e.target._route.routesIndex,1)[0];this.fire("routeselected",{route:n,alternatives:t})},this)},_onWaypointsChanged:function(e){this.options.autoRoute&&this.route({}),this._plan.isReady()||(this._clearLines(),this._clearAlts()),this.fire("waypointschanged",{waypoints:e.waypoints})},_setupRouteDragging:function(){var t,n=0;this._plan.on("waypointdrag",o.bind(function(e){t=e.waypoints,n||(n=setTimeout(o.bind(function(){this.route({waypoints:t,geometryOnly:!0,callback:o.bind(this._updateLineCallback,this)}),n=void 0},this),this.options.routeDragInterval))},this)),this._plan.on("waypointdragend",function(){n&&(clearTimeout(n),n=void 0),this.route()},this)},_updateLineCallback:function(e,t){if(e)"abort"!==e.type&&this._clearLines();else{var n=(t=t.slice()).splice(this._selectedRoute.routesIndex,1)[0];this._updateLines({route:n,alternatives:this.options.showAlternatives?t:[]})}},route:function(i){var a,r=++this._requestCount;this._pendingRequest&&this._pendingRequest.abort&&(this._pendingRequest.abort(),this._pendingRequest=null),i=i||{},this._plan.isReady()&&(this.options.useZoomParameter&&(i.z=this._map&&this._map.getZoom()),a=i&&i.waypoints||this._plan.getWaypoints(),this.fire("routingstart",{waypoints:a}),this._pendingRequest=this._router.route(a,function(e,t){if(this._pendingRequest=null,i.callback)return i.callback.call(this,e,t);if(r===this._requestCount){if(this._clearLines(),this._clearAlts(),e&&"abort"!==e.type)return void this.fire("routingerror",{error:e});if(t.forEach(function(e,t){e.routesIndex=t}),i.geometryOnly){var n=t.splice(0,1)[0];this._routeSelected({route:n,alternatives:t})}else this.fire("routesfound",{waypoints:a,routes:t}),this.setAlternatives(t)}},this,i))},_clearLines:function(){if(this._line&&(this._map.removeLayer(this._line),delete this._line),this._alternatives&&this._alternatives.length){for(var e in this._alternatives)this._map.removeLayer(this._alternatives[e]);this._alternatives=[]}}})}()},{"./itinerary":15,"./line":16,"./osrm-v1":18,"./plan":19,leaflet:22}],11:[function(e,t,n){!function(){"use strict";var n=e("leaflet");t.exports=n.Control.extend({options:{header:"Routing error",formatMessage:function(e){return e.status<0?"Calculating the route caused an error. Technical description follows: <code><pre>"+e.message+"</pre></code":"The route could not be calculated. "+e.message}},initialize:function(e,t){n.Control.prototype.initialize.call(this,t),e.on("routingerror",n.bind(function(e){this._element&&(this._element.children[1].innerHTML=this.options.formatMessage(e.error),this._element.style.visibility="visible")},this)).on("routingstart",n.bind(function(){this._element&&(this._element.style.visibility="hidden")},this))},onAdd:function(){var e;return this._element=n.DomUtil.create("div","leaflet-bar leaflet-routing-error"),this._element.style.visibility="hidden",e=n.DomUtil.create("h3",null,this._element),n.DomUtil.create("span",null,this._element),e.innerHTML=this.options.header,this._element},onRemove:function(){delete this._element}})}()},{leaflet:22}],12:[function(e,t,n){!function(){"use strict";var l=e("leaflet"),n=e("./localization");t.exports=l.Class.extend({options:{units:"metric",unitNames:null,language:"en",roundingSensitivity:1,distanceTemplate:"{value} {unit}"},initialize:function(e){l.setOptions(this,e);var t=l.Util.isArray(this.options.language)?this.options.language:[this.options.language,"en"];this._localization=new n(t)},formatDistance:function(e,t){var n,i,a,r=this.options.unitNames||this._localization.localize("units"),o=t<=0,s=o?function(e){return e}:l.bind(this._round,this);return a="imperial"===this.options.units?(i=e/.9144)>=1e3?{value:s(e/1609.344,t),unit:r.miles}:{value:s(i,t),unit:r.yards}:{value:(n=s(e,t))>=1e3?n/1e3:n,unit:n>=1e3?r.kilometers:r.meters},o&&(a.value=a.value.toFixed(-t)),l.Util.template(this.options.distanceTemplate,a)},_round:function(e,t){var n=t||this.options.roundingSensitivity,i=Math.pow(10,(Math.floor(e/n)+"").length-1),a=Math.floor(e/i)>5?i:i/2;return Math.round(e/a)*a},formatTime:function(e){var t=this.options.unitNames||this._localization.localize("units");return(e=30*Math.round(e/30))>86400?Math.round(e/3600)+" "+t.hours:e>3600?Math.floor(e/3600)+" "+t.hours+" "+Math.round(e%3600/60)+" "+t.minutes:e>300?Math.round(e/60)+" "+t.minutes:e>60?Math.floor(e/60)+" "+t.minutes+(e%60!==0?" "+e%60+" "+t.seconds:""):e+" "+t.seconds},formatInstruction:function(e,t){return void 0===e.text?this.capitalize(l.Util.template(this._getInstructionTemplate(e,t),l.extend({},e,{exitStr:e.exit?this._localization.localize("formatOrder")(e.exit):"",dir:this._localization.localize(["directions",e.direction]),modifier:this._localization.localize(["directions",e.modifier])}))):e.text},getIconName:function(e,t){switch(e.type){case"Head":if(0===t)return"depart";break;case"WaypointReached":return"via";case"Roundabout":return"enter-roundabout";case"DestinationReached":return"arrive"}switch(e.modifier){case"Straight":return"continue";case"SlightRight":return"bear-right";case"Right":return"turn-right";case"SharpRight":return"sharp-right";case"TurnAround":case"Uturn":return"u-turn";case"SharpLeft":return"sharp-left";case"Left":return"turn-left";case"SlightLeft":return"bear-left"}},capitalize:function(e){return e.charAt(0).toUpperCase()+e.substring(1)},_getInstructionTemplate:function(e,t){var n="Straight"===e.type?0===t?"Head":"Continue":e.type,i=this._localization.localize(["instructions",n]);return i||(i=[this._localization.localize(["directions",n])," "+this._localization.localize(["instructions","Onto"])]),i[0]+(i.length>1&&e.road?i[1]:"")}})}()},{"./localization":17,leaflet:22}],13:[function(e,t,n){!function(){"use strict";var s=e("leaflet"),l=e("./autocomplete"),a=e("./localization");function u(e){e.setSelectionRange?e.setSelectionRange(0,9999):e.select()}t.exports=s.Class.extend({includes:"undefined"!==typeof s.Evented&&s.Evented.prototype||s.Mixin.Events,options:{createGeocoder:function(e,t,n){var i=s.DomUtil.create("div","leaflet-routing-geocoder"),a=s.DomUtil.create("input","",i),r=n.addWaypoints?s.DomUtil.create("span","leaflet-routing-remove-waypoint",i):void 0;return a.disabled=!n.addWaypoints,{container:i,input:a,closeButton:r}},geocoderPlaceholder:function(e,t,n){var i=new a(n.options.language).localize("ui");return 0===e?i.startPlaceholder:e<t-1?s.Util.template(i.viaPlaceholder,{viaNumber:e}):i.endPlaceholder},geocoderClass:function(){return""},waypointNameFallback:function(e){var t=e.lat<0?"S":"N",n=e.lng<0?"W":"E";return t+(Math.round(1e4*Math.abs(e.lat))/1e4).toString()+", "+n+(Math.round(1e4*Math.abs(e.lng))/1e4).toString()},maxGeocoderTolerance:200,autocompleteOptions:{},language:"en"},initialize:function(t,e,n,i){s.setOptions(this,i);var a=this.options.createGeocoder(e,n,this.options),r=a.closeButton,o=a.input;o.setAttribute("placeholder",this.options.geocoderPlaceholder(e,n,this)),o.className=this.options.geocoderClass(e,n),this._element=a,this._waypoint=t,this.update(),o.value=t.name,s.DomEvent.addListener(o,"click",function(){u(this)},o),r&&s.DomEvent.addListener(r,"click",function(){this.fire("delete",{waypoint:this._waypoint})},this),new l(o,function(e){o.value=e.name,t.name=e.name,t.latLng=e.center,this.fire("geocoded",{waypoint:t,value:e})},this,s.extend({resultFn:this.options.geocoder.geocode,resultContext:this.options.geocoder,autocompleteFn:this.options.geocoder.suggest,autocompleteContext:this.options.geocoder},this.options.autocompleteOptions))},getContainer:function(){return this._element.container},setValue:function(e){this._element.input.value=e},update:function(e){var t,n=this._waypoint;n.name=n.name||"",!n.latLng||!e&&n.name||(t=this.options.waypointNameFallback(n.latLng),this.options.geocoder&&this.options.geocoder.reverse?this.options.geocoder.reverse(n.latLng,67108864,function(e){e.length>0&&e[0].center.distanceTo(n.latLng)<this.options.maxGeocoderTolerance?n.name=e[0].name:n.name=t,this._update()},this):(n.name=t,this._update()))},focus:function(){var e=this._element.input;e.focus(),u(e)},_update:function(){var e=this._waypoint,t=e&&e.name?e.name:"";this.setValue(t),this.fire("reversegeocoded",{waypoint:e,value:t})}})}()},{"./autocomplete":9,"./localization":17,leaflet:22}],14:[function(e,t,n){!function(){"use strict";var s=e("leaflet");t.exports=s.Class.extend({options:{containerClassName:""},initialize:function(e){s.setOptions(this,e)},createContainer:function(e){var t=s.DomUtil.create("table",e||""),n=s.DomUtil.create("colgroup","",t);return s.DomUtil.create("col","leaflet-routing-instruction-icon",n),s.DomUtil.create("col","leaflet-routing-instruction-text",n),s.DomUtil.create("col","leaflet-routing-instruction-distance",n),t},createStepsContainer:function(){return s.DomUtil.create("tbody","")},createStep:function(e,t,n,i){var a,r,o=s.DomUtil.create("tr","",i);return r=s.DomUtil.create("td","",o),a=s.DomUtil.create("span","leaflet-routing-icon leaflet-routing-icon-"+n,r),r.appendChild(a),(r=s.DomUtil.create("td","",o)).appendChild(document.createTextNode(e)),(r=s.DomUtil.create("td","",o)).appendChild(document.createTextNode(t)),o}})}()},{leaflet:22}],15:[function(e,i,t){!function(){"use strict";var r=e("leaflet"),t=e("./formatter"),n=e("./itinerary-builder");i.exports=r.Control.extend({includes:"undefined"!==typeof r.Evented&&r.Evented.prototype||r.Mixin.Events,options:{pointMarkerStyle:{radius:5,color:"#03f",fillColor:"white",opacity:1,fillOpacity:.7},summaryTemplate:"<h2>{name}</h2><h3>{distance}, {time}</h3>",timeTemplate:"{time}",containerClassName:"",alternativeClassName:"",minimizedClassName:"",itineraryClassName:"",totalDistanceRoundingSensitivity:-1,show:!0,collapsible:void 0,collapseBtn:function(e){var t=r.DomUtil.create("span",e.options.collapseBtnClass);r.DomEvent.on(t,"click",e._toggle,e),e._container.insertBefore(t,e._container.firstChild)},collapseBtnClass:"leaflet-routing-collapse-btn"},initialize:function(e){r.setOptions(this,e),this._formatter=this.options.formatter||new t(this.options),this._itineraryBuilder=this.options.itineraryBuilder||new n({containerClassName:this.options.itineraryClassName})},onAdd:function(e){var t=this.options.collapsible;return t=t||void 0===t&&e.getSize().x<=640,this._container=r.DomUtil.create("div","leaflet-routing-container leaflet-bar "+(this.options.show?"":"leaflet-routing-container-hide ")+(t?"leaflet-routing-collapsible ":"")+this.options.containerClassName),this._altContainer=this.createAlternativesContainer(),this._container.appendChild(this._altContainer),r.DomEvent.disableClickPropagation(this._container),r.DomEvent.addListener(this._container,"mousewheel",function(e){r.DomEvent.stopPropagation(e)}),t&&this.options.collapseBtn(this),this._container},onRemove:function(){},createAlternativesContainer:function(){return r.DomUtil.create("div","leaflet-routing-alternatives-container")},setAlternatives:function(e){var t,n,i;for(this._clearAlts(),this._routes=e,t=0;t<this._routes.length;t++)n=this._routes[t],i=this._createAlternative(n,t),this._altContainer.appendChild(i),this._altElements.push(i);return this._selectRoute({route:this._routes[0],alternatives:this._routes.slice(1)}),this},show:function(){r.DomUtil.removeClass(this._container,"leaflet-routing-container-hide")},hide:function(){r.DomUtil.addClass(this._container,"leaflet-routing-container-hide")},_toggle:function(){this[r.DomUtil.hasClass(this._container,"leaflet-routing-container-hide")?"show":"hide"]()},_createAlternative:function(e,t){var n=r.DomUtil.create("div","leaflet-routing-alt "+this.options.alternativeClassName+(t>0?" leaflet-routing-alt-minimized "+this.options.minimizedClassName:"")),i=this.options.summaryTemplate,a=r.extend({name:e.name,distance:this._formatter.formatDistance(e.summary.totalDistance,this.options.totalDistanceRoundingSensitivity),time:this._formatter.formatTime(e.summary.totalTime)},e);return n.innerHTML="function"===typeof i?i(a):r.Util.template(i,a),r.DomEvent.addListener(n,"click",this._onAltClicked,this),this.on("routeselected",this._selectAlt,this),n.appendChild(this._createItineraryContainer(e)),n},_clearAlts:function(){for(var e=this._altContainer;e&&e.firstChild;)e.removeChild(e.firstChild);this._altElements=[]},_createItineraryContainer:function(e){var t,n,i,a,r,o,s=this._itineraryBuilder.createContainer(),l=this._itineraryBuilder.createStepsContainer();for(s.appendChild(l),t=0;t<e.instructions.length;t++)n=e.instructions[t],r=this._formatter.formatInstruction(n,t),a=this._formatter.formatDistance(n.distance),o=this._formatter.getIconName(n,t),i=this._itineraryBuilder.createStep(r,a,o,l),n.index&&this._addRowListeners(i,e.coordinates[n.index]);return s},_addRowListeners:function(e,t){r.DomEvent.addListener(e,"mouseover",function(){this._marker=r.circleMarker(t,this.options.pointMarkerStyle).addTo(this._map)},this),r.DomEvent.addListener(e,"mouseout",function(){this._marker&&(this._map.removeLayer(this._marker),delete this._marker)},this),r.DomEvent.addListener(e,"click",function(e){this._map.panTo(t),r.DomEvent.stopPropagation(e)},this)},_onAltClicked:function(e){for(var t=e.target||window.event.srcElement;!r.DomUtil.hasClass(t,"leaflet-routing-alt");)t=t.parentElement;var n=this._altElements.indexOf(t),i=this._routes.slice(),a=i.splice(n,1)[0];this.fire("routeselected",{route:a,alternatives:i})},_selectAlt:function(e){var t,n,i,a;if(t=this._altElements[e.route.routesIndex],r.DomUtil.hasClass(t,"leaflet-routing-alt-minimized"))for(n=0;n<this._altElements.length;n++)i=this._altElements[n],a=n===e.route.routesIndex?"removeClass":"addClass",r.DomUtil[a](i,"leaflet-routing-alt-minimized"),this.options.minimizedClassName&&r.DomUtil[a](i,this.options.minimizedClassName),n!==e.route.routesIndex&&(i.scrollTop=0);r.DomEvent.stop(e)},_selectRoute:function(e){this._marker&&(this._map.removeLayer(this._marker),delete this._marker),this.fire("routeselected",e)}})}()},{"./formatter":12,"./itinerary-builder":14,leaflet:22}],16:[function(e,t,n){!function(){"use strict";var r=e("leaflet");t.exports=r.LayerGroup.extend({includes:"undefined"!==typeof r.Evented&&r.Evented.prototype||r.Mixin.Events,options:{styles:[{color:"black",opacity:.15,weight:9},{color:"white",opacity:.8,weight:6},{color:"red",opacity:1,weight:2}],missingRouteStyles:[{color:"black",opacity:.15,weight:7},{color:"white",opacity:.6,weight:4},{color:"gray",opacity:.8,weight:2,dashArray:"7,12"}],addWaypoints:!0,extendToWaypoints:!0,missingRouteTolerance:10},initialize:function(e,t){r.setOptions(this,t),r.LayerGroup.prototype.initialize.call(this,t),this._route=e,this.options.extendToWaypoints&&this._extendToWaypoints(),this._addSegment(e.coordinates,this.options.styles,this.options.addWaypoints)},getBounds:function(){return r.latLngBounds(this._route.coordinates)},_findWaypointIndices:function(){var e,t=this._route.inputWaypoints,n=[];for(e=0;e<t.length;e++)n.push(this._findClosestRoutePoint(t[e].latLng));return n},_findClosestRoutePoint:function(e){var t,n,i,a=Number.MAX_VALUE;for(n=this._route.coordinates.length-1;n>=0;n--)(i=e.distanceTo(this._route.coordinates[n]))<a&&(t=n,a=i);return t},_extendToWaypoints:function(){var e,t,n,i=this._route.inputWaypoints,a=this._getWaypointIndices();for(e=0;e<i.length;e++)t=i[e].latLng,n=r.latLng(this._route.coordinates[a[e]]),t.distanceTo(n)>this.options.missingRouteTolerance&&this._addSegment([t,n],this.options.missingRouteStyles)},_addSegment:function(e,t,n){var i,a;for(i=0;i<t.length;i++)a=r.polyline(e,t[i]),this.addLayer(a),n&&a.on("mousedown",this._onLineTouched,this)},_findNearestWpBefore:function(e){for(var t=this._getWaypointIndices(),n=t.length-1;n>=0&&t[n]>e;)n--;return n},_onLineTouched:function(e){var t=this._findNearestWpBefore(this._findClosestRoutePoint(e.latlng));this.fire("linetouched",{afterIndex:t,latlng:e.latlng})},_getWaypointIndices:function(){return this._wpIndices||(this._wpIndices=this._route.waypointIndices||this._findWaypointIndices()),this._wpIndices}})}()},{leaflet:22}],17:[function(e,t,n){!function(){"use strict";var e={directions:{N:"norte",NE:"noreste",E:"este",SE:"sureste",S:"sur",SW:"suroeste",W:"oeste",NW:"noroeste",SlightRight:"leve giro a la derecha",Right:"derecha",SharpRight:"giro pronunciado a la derecha",SlightLeft:"leve giro a la izquierda",Left:"izquierda",SharpLeft:"giro pronunciado a la izquierda",Uturn:"media vuelta"},instructions:{Head:["Derecho {dir}"," sobre {road}"],Continue:["Continuar {dir}"," en {road}"],TurnAround:["Dar vuelta"],WaypointReached:["Llegó a un punto del camino"],Roundabout:["Tomar {exitStr} salida en la rotonda"," en {road}"],DestinationReached:["Llegada a destino"],Fork:["En el cruce gira a {modifier}"," hacia {road}"],Merge:["Incorpórate {modifier}"," hacia {road}"],OnRamp:["Gira {modifier} en la salida"," hacia {road}"],OffRamp:["Toma la salida {modifier}"," hacia {road}"],EndOfRoad:["Gira {modifier} al final de la carretera"," hacia {road}"],Onto:"hacia {road}"},formatOrder:function(e){return e+"º"},ui:{startPlaceholder:"Inicio",viaPlaceholder:"Via {viaNumber}",endPlaceholder:"Destino"},units:{meters:"m",kilometers:"km",yards:"yd",miles:"mi",hours:"h",minutes:"min",seconds:"s"}};L.Routing=L.Routing||{};var s=L.Class.extend({initialize:function(e){this._langs=L.Util.isArray(e)?e:[e,"en"];for(var t=0,n=this._langs.length;t<n;t++)if(!s[this._langs[t]])throw new Error('No localization for language "'+this._langs[t]+'".')},localize:function(e){var t,n;e=L.Util.isArray(e)?e:[e];for(var i=0,a=this._langs.length;i<a;i++){t=s[this._langs[i]];for(var r=0,o=e.length;t&&r<o;r++)t=n=t[e[r]];if(n)return n}}});t.exports=L.extend(s,{en:{directions:{N:"north",NE:"northeast",E:"east",SE:"southeast",S:"south",SW:"southwest",W:"west",NW:"northwest",SlightRight:"slight right",Right:"right",SharpRight:"sharp right",SlightLeft:"slight left",Left:"left",SharpLeft:"sharp left",Uturn:"Turn around"},instructions:{Head:["Head {dir}"," on {road}"],Continue:["Continue {dir}"],TurnAround:["Turn around"],WaypointReached:["Waypoint reached"],Roundabout:["Take the {exitStr} exit in the roundabout"," onto {road}"],DestinationReached:["Destination reached"],Fork:["At the fork, turn {modifier}"," onto {road}"],Merge:["Merge {modifier}"," onto {road}"],OnRamp:["Turn {modifier} on the ramp"," onto {road}"],OffRamp:["Take the ramp on the {modifier}"," onto {road}"],EndOfRoad:["Turn {modifier} at the end of the road"," onto {road}"],Onto:"onto {road}"},formatOrder:function(e){var t=e%10-1,n=["st","nd","rd"];return n[t]?e+n[t]:e+"th"},ui:{startPlaceholder:"Start",viaPlaceholder:"Via {viaNumber}",endPlaceholder:"End"},units:{meters:"m",kilometers:"km",yards:"yd",miles:"mi",hours:"h",minutes:"min",seconds:"s"}},de:{directions:{N:"Norden",NE:"Nordosten",E:"Osten",SE:"Südosten",S:"Süden",SW:"Südwesten",W:"Westen",NW:"Nordwesten",SlightRight:"leicht rechts",Right:"rechts",SharpRight:"scharf rechts",SlightLeft:"leicht links",Left:"links",SharpLeft:"scharf links",Uturn:"Wenden"},instructions:{Head:["Richtung {dir}"," auf {road}"],Continue:["Geradeaus Richtung {dir}"," auf {road}"],SlightRight:["Leicht rechts abbiegen"," auf {road}"],Right:["Rechts abbiegen"," auf {road}"],SharpRight:["Scharf rechts abbiegen"," auf {road}"],TurnAround:["Wenden"],SharpLeft:["Scharf links abbiegen"," auf {road}"],Left:["Links abbiegen"," auf {road}"],SlightLeft:["Leicht links abbiegen"," auf {road}"],WaypointReached:["Zwischenhalt erreicht"],Roundabout:["Nehmen Sie die {exitStr} Ausfahrt im Kreisverkehr"," auf {road}"],DestinationReached:["Sie haben ihr Ziel erreicht"],Fork:["An der Kreuzung {modifier}"," auf {road}"],Merge:["Fahren Sie {modifier} weiter"," auf {road}"],OnRamp:["Fahren Sie {modifier} auf die Auffahrt"," auf {road}"],OffRamp:["Nehmen Sie die Ausfahrt {modifier}"," auf {road}"],EndOfRoad:["Fahren Sie {modifier} am Ende der Straße"," auf {road}"],Onto:"auf {road}"},formatOrder:function(e){return e+"."},ui:{startPlaceholder:"Start",viaPlaceholder:"Via {viaNumber}",endPlaceholder:"Ziel"}},sv:{directions:{N:"norr",NE:"nordost",E:"öst",SE:"sydost",S:"syd",SW:"sydväst",W:"väst",NW:"nordväst",SlightRight:"svagt höger",Right:"höger",SharpRight:"skarpt höger",SlightLeft:"svagt vänster",Left:"vänster",SharpLeft:"skarpt vänster",Uturn:"Vänd"},instructions:{Head:["Åk åt {dir}"," till {road}"],Continue:["Fortsätt {dir}"],SlightRight:["Svagt höger"," till {road}"],Right:["Sväng höger"," till {road}"],SharpRight:["Skarpt höger"," till {road}"],TurnAround:["Vänd"],SharpLeft:["Skarpt vänster"," till {road}"],Left:["Sväng vänster"," till {road}"],SlightLeft:["Svagt vänster"," till {road}"],WaypointReached:["Viapunkt nådd"],Roundabout:["Tag {exitStr} avfarten i rondellen"," till {road}"],DestinationReached:["Framme vid resans mål"],Fork:["Tag av {modifier}"," till {road}"],Merge:["Anslut {modifier} "," till {road}"],OnRamp:["Tag påfarten {modifier}"," till {road}"],OffRamp:["Tag avfarten {modifier}"," till {road}"],EndOfRoad:["Sväng {modifier} vid vägens slut"," till {road}"],Onto:"till {road}"},formatOrder:function(e){return["första","andra","tredje","fjärde","femte","sjätte","sjunde","åttonde","nionde"