New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

leaflet-control-geocoder

Package Overview
Dependencies
Maintainers
2
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

leaflet-control-geocoder - npm Package Compare versions

Comparing version 2.3.0 to 2.4.0

4

CHANGELOG.md

@@ -0,1 +1,5 @@

## 2.4.0 (2022-02-06)
* export { Geocoder, geocoder, geocoders } ([ec17333](https://github.com/perliedman/leaflet-control-geocoder/commit/ec17333))
## 2.3.0 (2021-05-25)

@@ -2,0 +6,0 @@

11

dist/Control.Geocoder.js

@@ -1,2 +0,2 @@

var leafletControlGeocoder = (function (L) {
var leafletControlGeocoder = (function (exports, L) {

@@ -1963,5 +1963,10 @@ function _interopNamespace(e) {

return GeocoderControl;
exports.Geocoder = GeocoderControl;
exports.default = GeocoderControl;
exports.geocoder = geocoder;
exports.geocoders = geocoders;
}(L));
return exports;
}({}, L));
//# sourceMappingURL=Control.Geocoder.js.map

@@ -1,2 +0,2 @@

var leafletControlGeocoder=function(t){function e(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(o){if("default"!==o){var n=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(e,o,n.get?n:{enumerable:!0,get:function(){return t[o]}})}}),e.default=t,e}var o=e(t);function n(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}function s(t,e){return o.Util.extend(e,t.geocodingQueryParams)}function i(t,e){return o.Util.extend(e,t.reverseQueryParams)}var r=0,a=/[&<>"'`]/g,l=/[&<>"'`]/,c={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};function u(t){return c[t]}function p(t,e,n,s,i){var a="_l_geocoder_"+r++;e[i||"callback"]=a,window[a]=o.Util.bind(n,s);var l=document.createElement("script");l.type="text/javascript",l.src=t+h(e),l.id=a,document.getElementsByTagName("head")[0].appendChild(l)}function d(t,e,o){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;o(t)}},n.open("GET",t+h(e),!0),n.responseType="json",n.setRequestHeader("Accept","application/json"),n.send(null)}function h(t,e,o){var n=[];for(var s in t){var i=encodeURIComponent(o?s.toUpperCase():s),r=t[s];if(Array.isArray(r))for(var a=0;a<r.length;a++)n.push(i+"="+encodeURIComponent(r[a]));else n.push(i+"="+encodeURIComponent(String(r)))}return(e&&-1!==e.indexOf("?")?"&":"?")+n.join("&")}var g=function(){function t(t){this.options={serviceUrl:"https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer",apiKey:""},o.Util.setOptions(this,t)}var e=t.prototype;return e.geocode=function(t,e,n){var i=s(this.options,{token:this.options.apiKey,SingleLine:t,outFields:"Addr_Type",forStorage:!1,maxLocations:10,f:"json"});d(this.options.serviceUrl+"/findAddressCandidates",i,function(t){var s=[];if(t.candidates&&t.candidates.length)for(var i=0;i<=t.candidates.length-1;i++){var r=t.candidates[i],a=o.latLng(r.location.y,r.location.x),l=o.latLngBounds(o.latLng(r.extent.ymax,r.extent.xmax),o.latLng(r.extent.ymin,r.extent.xmin));s[i]={name:r.address,bbox:l,center:a}}e.call(n,s)})},e.suggest=function(t,e,o){return this.geocode(t,e,o)},e.reverse=function(t,e,n,s){var r=i(this.options,{location:t.lng+","+t.lat,distance:100,f:"json"});d(this.options.serviceUrl+"/reverseGeocode",r,function(t){var e=[];if(t&&!t.error){var i=o.latLng(t.location.y,t.location.x),r=o.latLngBounds(i,i);e.push({name:t.address.Match_addr,center:i,bbox:r})}n.call(s,e)})},t}(),f=function(){function t(t){this.options={serviceUrl:"https://dev.virtualearth.net/REST/v1/Locations"},o.Util.setOptions(this,t)}var e=t.prototype;return e.geocode=function(t,e,n){var i=s(this.options,{query:t,key:this.options.apiKey});p(this.options.apiKey,i,function(t){var s=[];if(t.resourceSets.length>0)for(var i=t.resourceSets[0].resources.length-1;i>=0;i--){var r=t.resourceSets[0].resources[i],a=r.bbox;s[i]={name:r.name,bbox:o.latLngBounds([a[0],a[1]],[a[2],a[3]]),center:o.latLng(r.point.coordinates)}}e.call(n,s)},this,"jsonp")},e.reverse=function(t,e,n,s){var r=i(this.options,{key:this.options.apiKey});p(this.options.serviceUrl+t.lat+","+t.lng,r,function(t){for(var e=[],i=t.resourceSets[0].resources.length-1;i>=0;i--){var r=t.resourceSets[0].resources[i],a=r.bbox;e[i]={name:r.name,bbox:o.latLngBounds([a[0],a[1]],[a[2],a[3]]),center:o.latLng(r.point.coordinates)}}n.call(s,e)},this,"jsonp")},t}(),v=function(){function t(t){this.options={serviceUrl:"https://maps.googleapis.com/maps/api/geocode/json"},o.Util.setOptions(this,t)}var e=t.prototype;return e.geocode=function(t,e,n){var i=s(this.options,{key:this.options.apiKey,address:t});d(this.options.serviceUrl,i,function(t){var s=[];if(t.results&&t.results.length)for(var i=0;i<=t.results.length-1;i++){var r=t.results[i],a=o.latLng(r.geometry.location),l=o.latLngBounds(o.latLng(r.geometry.viewport.northeast),o.latLng(r.geometry.viewport.southwest));s[i]={name:r.formatted_address,bbox:l,center:a,properties:r.address_components}}e.call(n,s)})},e.reverse=function(t,e,n,s){var r=i(this.options,{key:this.options.apiKey,latlng:t.lat+","+t.lng});d(this.options.serviceUrl,r,function(t){var e=[];if(t.results&&t.results.length)for(var i=0;i<=t.results.length-1;i++){var r=t.results[i],a=o.latLng(r.geometry.location),l=o.latLngBounds(o.latLng(r.geometry.viewport.northeast),o.latLng(r.geometry.viewport.southwest));e[i]={name:r.formatted_address,bbox:l,center:a,properties:r.address_components}}n.call(s,e)})},t}(),m=function(){function t(t){if(this.options={serviceUrl:"https://geocoder.api.here.com/6.2/",app_id:"",app_code:"",apiKey:"",maxResults:5},o.Util.setOptions(this,t),t.apiKey)throw Error("apiKey is not supported, use app_id/app_code instead!")}var e=t.prototype;return e.geocode=function(t,e,o){var n=s(this.options,{searchtext:t,gen:9,app_id:this.options.app_id,app_code:this.options.app_code,jsonattributes:1,maxresults:this.options.maxResults});this.getJSON(this.options.serviceUrl+"geocode.json",n,e,o)},e.reverse=function(t,e,o,n){var s=t.lat+","+t.lng;this.options.reverseGeocodeProxRadius&&(s+=","+this.options.reverseGeocodeProxRadius);var r=i(this.options,{prox:s,mode:"retrieveAddresses",app_id:this.options.app_id,app_code:this.options.app_code,gen:9,jsonattributes:1,maxresults:this.options.maxResults});this.getJSON(this.options.serviceUrl+"reversegeocode.json",r,o,n)},e.getJSON=function(t,e,n,s){d(t,e,function(t){var e=[];if(t.response.view&&t.response.view.length)for(var i=0;i<=t.response.view[0].result.length-1;i++){var r=t.response.view[0].result[i].location,a=o.latLng(r.displayPosition.latitude,r.displayPosition.longitude),l=o.latLngBounds(o.latLng(r.mapView.topLeft.latitude,r.mapView.topLeft.longitude),o.latLng(r.mapView.bottomRight.latitude,r.mapView.bottomRight.longitude));e[i]={name:r.address.label,properties:r.address,bbox:l,center:a}}n.call(s,e)})},t}(),_=function(){function t(t){this.options={serviceUrl:"https://geocode.search.hereapi.com/v1",apiKey:"",app_id:"",app_code:"",maxResults:10},o.Util.setOptions(this,t)}var e=t.prototype;return e.geocode=function(t,e,o){var n=s(this.options,{q:t,apiKey:this.options.apiKey,limit:this.options.maxResults});if(!n.at&&!n.in)throw Error("at / in parameters not found. Please define coordinates (at=latitude,longitude) or other (in) in your geocodingQueryParams.");this.getJSON(this.options.serviceUrl+"/discover",n,e,o)},e.reverse=function(t,e,o,n){var s=i(this.options,{at:t.lat+","+t.lng,limit:this.options.reverseGeocodeProxRadius,apiKey:this.options.apiKey});this.getJSON(this.options.serviceUrl+"/revgeocode",s,o,n)},e.getJSON=function(t,e,n,s){d(t,e,function(t){var e=[];if(t.items&&t.items.length)for(var i=0;i<=t.items.length-1;i++){var r,a=t.items[i],l=o.latLng(a.position.lat,a.position.lng);r=a.mapView?o.latLngBounds(o.latLng(a.mapView.south,a.mapView.west),o.latLng(a.mapView.north,a.mapView.east)):o.latLngBounds(o.latLng(a.position.lat,a.position.lng),o.latLng(a.position.lat,a.position.lng)),e[i]={name:a.address.label,properties:a.address,bbox:r,center:l}}n.call(s,e)})},t}();function b(t){var e;return(e=t.match(/^([NS])\s*(\d{1,3}(?:\.\d*)?)\W*([EW])\s*(\d{1,3}(?:\.\d*)?)$/))?o.latLng((/N/i.test(e[1])?1:-1)*+e[2],(/E/i.test(e[3])?1:-1)*+e[4]):(e=t.match(/^(\d{1,3}(?:\.\d*)?)\s*([NS])\W*(\d{1,3}(?:\.\d*)?)\s*([EW])$/))?o.latLng((/N/i.test(e[2])?1:-1)*+e[1],(/E/i.test(e[4])?1:-1)*+e[3]):(e=t.match(/^([NS])\s*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\W*([EW])\s*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?$/))?o.latLng((/N/i.test(e[1])?1:-1)*(+e[2]+ +e[3]/60),(/E/i.test(e[4])?1:-1)*(+e[5]+ +e[6]/60)):(e=t.match(/^(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\s*([NS])\W*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\s*([EW])$/))?o.latLng((/N/i.test(e[3])?1:-1)*(+e[1]+ +e[2]/60),(/E/i.test(e[6])?1:-1)*(+e[4]+ +e[5]/60)):(e=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.latLng((/N/i.test(e[1])?1:-1)*(+e[2]+ +e[3]/60+ +e[4]/3600),(/E/i.test(e[5])?1:-1)*(+e[6]+ +e[7]/60+ +e[8]/3600)):(e=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.latLng((/N/i.test(e[4])?1:-1)*(+e[1]+ +e[2]/60+ +e[3]/3600),(/E/i.test(e[8])?1:-1)*(+e[5]+ +e[6]/60+ +e[7]/3600)):(e=t.match(/^\s*([+-]?\d+(?:\.\d*)?)\s*[\s,]\s*([+-]?\d+(?:\.\d*)?)\s*$/))?o.latLng(+e[1],+e[2]):void 0}var y=function(){function t(t){this.options={next:void 0,sizeInMeters:1e4},o.Util.setOptions(this,t)}return t.prototype.geocode=function(t,e,o){var n=b(t);if(n){var s=[{name:t,center:n,bbox:n.toBounds(this.options.sizeInMeters)}];e.call(o,s)}else this.options.next&&this.options.next.geocode(t,e,o)},t}(),L=function(){function t(t){this.options={serviceUrl:"https://api.mapbox.com/geocoding/v5/mapbox.places/"},o.Util.setOptions(this,t)}var e=t.prototype;return e._getProperties=function(t){for(var e={text:t.text,address:t.address},o=0;o<(t.context||[]).length;o++)e[t.context[o].id.split(".")[0]]=t.context[o].text,t.context[o].short_code&&(e.countryShortCode=t.context[o].short_code);return e},e.geocode=function(t,e,n){var i=this,r=s(this.options,{access_token:this.options.apiKey});void 0!==r.proximity&&void 0!==r.proximity.lat&&void 0!==r.proximity.lng&&(r.proximity=r.proximity.lng+","+r.proximity.lat),d(this.options.serviceUrl+encodeURIComponent(t)+".json",r,function(t){var s=[];if(t.features&&t.features.length)for(var r=0;r<=t.features.length-1;r++){var a,l=t.features[r],c=o.latLng(l.center.reverse());a=l.bbox?o.latLngBounds(o.latLng(l.bbox.slice(0,2).reverse()),o.latLng(l.bbox.slice(2,4).reverse())):o.latLngBounds(c,c),s[r]={name:l.place_name,bbox:a,center:c,properties:i._getProperties(l)}}e.call(n,s)})},e.suggest=function(t,e,o){return this.geocode(t,e,o)},e.reverse=function(t,e,n,s){var r=this;d(this.options.serviceUrl+t.lng+","+t.lat+".json",i(this.options,{access_token:this.options.apiKey}),function(t){var e=[];if(t.features&&t.features.length)for(var i=0;i<=t.features.length-1;i++){var a,l=t.features[i],c=o.latLng(l.center.reverse());a=l.bbox?o.latLngBounds(o.latLng(l.bbox.slice(0,2).reverse()),o.latLng(l.bbox.slice(2,4).reverse())):o.latLngBounds(c,c),e[i]={name:l.place_name,bbox:a,center:c,properties:r._getProperties(l)}}n.call(s,e)})},t}(),x=function(){function t(t){this.options={serviceUrl:"https://www.mapquestapi.com/geocoding/v1"},o.Util.setOptions(this,t),this.options.apiKey=decodeURIComponent(this.options.apiKey)}var e=t.prototype;return e._formatName=function(){return[].slice.call(arguments).filter(function(t){return!!t}).join(", ")},e.geocode=function(t,e,n){var i=s(this.options,{key:this.options.apiKey,location:t,limit:5,outFormat:"json"});d(this.options.serviceUrl+"/address",i,o.Util.bind(function(t){var s=[];if(t.results&&t.results[0].locations)for(var i=t.results[0].locations.length-1;i>=0;i--){var r=t.results[0].locations[i],a=o.latLng(r.latLng);s[i]={name:this._formatName(r.street,r.adminArea4,r.adminArea3,r.adminArea1),bbox:o.latLngBounds(a,a),center:a}}e.call(n,s)},this))},e.reverse=function(t,e,n,s){var r=i(this.options,{key:this.options.apiKey,location:t.lat+","+t.lng,outputFormat:"json"});d(this.options.serviceUrl+"/reverse",r,o.Util.bind(function(t){var e=[];if(t.results&&t.results[0].locations)for(var i=t.results[0].locations.length-1;i>=0;i--){var r=t.results[0].locations[i],a=o.latLng(r.latLng);e[i]={name:this._formatName(r.street,r.adminArea4,r.adminArea3,r.adminArea1),bbox:o.latLngBounds(a,a),center:a}}n.call(s,e)},this))},t}(),U=function(){function t(t){this.options={userId:void 0,apiKey:void 0,serviceUrl:"https://neutrinoapi.com/"},o.Util.setOptions(this,t)}var e=t.prototype;return e.geocode=function(t,e,n){var i=s(this.options,{apiKey:this.options.apiKey,userId:this.options.userId,address:t.split(/\s+/).join(".")});d(this.options.serviceUrl+"geocode-address",i,function(t){var s=[];if(t.locations){t.geometry=t.locations[0];var i=o.latLng(t.geometry.latitude,t.geometry.longitude),r=o.latLngBounds(i,i);s[0]={name:t.geometry.address,bbox:r,center:i}}e.call(n,s)})},e.suggest=function(t,e,o){return this.geocode(t,e,o)},e.reverse=function(t,e,n,s){var r=i(this.options,{apiKey:this.options.apiKey,userId:this.options.userId,latitude:t.lat,longitude:t.lng});d(this.options.serviceUrl+"geocode-reverse",r,function(e){var i=[];if(200==e.status.status&&e.found){var r=o.latLng(t.lat,t.lng),a=o.latLngBounds(r,r);i[0]={name:e.address,bbox:a,center:r}}n.call(s,i)})},t}(),w=function(){function t(t){this.options={serviceUrl:"https://nominatim.openstreetmap.org/",htmlTemplate:function(t){var e,o,n=t.address,s=[];return(n.road||n.building)&&s.push("{building} {road} {house_number}"),(n.city||n.town||n.village||n.hamlet)&&s.push('<span class="'+(s.length>0?"leaflet-control-geocoder-address-detail":"")+'">{postcode} {city} {town} {village} {hamlet}</span>'),(n.state||n.country)&&s.push('<span class="'+(s.length>0?"leaflet-control-geocoder-address-context":"")+'">{state} {country}</span>'),e=s.join("<br/>"),o=n,e.replace(/\{ *([\w_]+) *\}/g,function(t,e){var n,s=o[e];return void 0===s?s="":"function"==typeof s&&(s=s(o)),null==(n=s)?"":n?l.test(n=""+n)?n.replace(a,u):n:n+""})}},o.Util.setOptions(this,t||{})}var e=t.prototype;return e.geocode=function(t,e,n){var i=this,r=s(this.options,{q:t,limit:5,format:"json",addressdetails:1});d(this.options.serviceUrl+"search",r,function(t){for(var s=[],r=t.length-1;r>=0;r--){for(var a=t[r].boundingbox,l=0;l<4;l++)a[l]=+a[l];s[r]={icon:t[r].icon,name:t[r].display_name,html:i.options.htmlTemplate?i.options.htmlTemplate(t[r]):void 0,bbox:o.latLngBounds([a[0],a[2]],[a[1],a[3]]),center:o.latLng(t[r].lat,t[r].lon),properties:t[r]}}e.call(n,s)})},e.reverse=function(t,e,n,s){var r=this,a=i(this.options,{lat:t.lat,lon:t.lng,zoom:Math.round(Math.log(e/256)/Math.log(2)),addressdetails:1,format:"json"});d(this.options.serviceUrl+"reverse",a,function(t){var e=[];if(t&&t.lat&&t.lon){var i=o.latLng(t.lat,t.lon),a=o.latLngBounds(i,i);e.push({name:t.display_name,html:r.options.htmlTemplate?r.options.htmlTemplate(t):void 0,center:i,bbox:a,properties:t})}n.call(s,e)})},t}(),C=function(){function t(t){o.Util.setOptions(this,t)}var e=t.prototype;return e.geocode=function(t,e,n){try{var s=this.options.OpenLocationCode.decode(t),i={name:t,center:o.latLng(s.latitudeCenter,s.longitudeCenter),bbox:o.latLngBounds(o.latLng(s.latitudeLo,s.longitudeLo),o.latLng(s.latitudeHi,s.longitudeHi))};e.call(n,[i])}catch(t){console.warn(t),e.call(n,[])}},e.reverse=function(t,e,n,s){try{var i={name:this.options.OpenLocationCode.encode(t.lat,t.lng,this.options.codeLength),center:o.latLng(t.lat,t.lng),bbox:o.latLngBounds(o.latLng(t.lat,t.lng),o.latLng(t.lat,t.lng))};n.call(s,[i])}catch(t){console.warn(t),n.call(s,[])}},t}(),E=function(){function t(t){this.options={serviceUrl:"https://api.opencagedata.com/geocode/v1/json"},o.Util.setOptions(this,t)}var e=t.prototype;return e.geocode=function(t,e,n){var i=s(this.options,{key:this.options.apiKey,q:t});d(this.options.serviceUrl,i,function(t){var s=[];if(t.results&&t.results.length)for(var i=0;i<t.results.length;i++){var r,a=t.results[i],l=o.latLng(a.geometry);r=a.annotations&&a.annotations.bounds?o.latLngBounds(o.latLng(a.annotations.bounds.northeast),o.latLng(a.annotations.bounds.southwest)):o.latLngBounds(l,l),s.push({name:a.formatted,bbox:r,center:l})}e.call(n,s)})},e.suggest=function(t,e,o){return this.geocode(t,e,o)},e.reverse=function(t,e,n,s){var r=i(this.options,{key:this.options.apiKey,q:[t.lat,t.lng].join(",")});d(this.options.serviceUrl,r,function(t){var e=[];if(t.results&&t.results.length)for(var i=0;i<t.results.length;i++){var r,a=t.results[i],l=o.latLng(a.geometry);r=a.annotations&&a.annotations.bounds?o.latLngBounds(o.latLng(a.annotations.bounds.northeast),o.latLng(a.annotations.bounds.southwest)):o.latLngBounds(l,l),e.push({name:a.formatted,bbox:r,center:l})}n.call(s,e)})},t}(),k=function(){function t(t){this.options={serviceUrl:"https://api.geocode.earth/v1"},this._lastSuggest=0,o.Util.setOptions(this,t)}var e=t.prototype;return e.geocode=function(t,e,o){var n=this,i=s(this.options,{api_key:this.options.apiKey,text:t});d(this.options.serviceUrl+"/search",i,function(t){e.call(o,n._parseResults(t,"bbox"))})},e.suggest=function(t,e,o){var n=this,i=s(this.options,{api_key:this.options.apiKey,text:t});d(this.options.serviceUrl+"/autocomplete",i,function(t){t.geocoding.timestamp>n._lastSuggest&&(n._lastSuggest=t.geocoding.timestamp,e.call(o,n._parseResults(t,"bbox")))})},e.reverse=function(t,e,o,n){var s=this,r=i(this.options,{api_key:this.options.apiKey,"point.lat":t.lat,"point.lon":t.lng});d(this.options.serviceUrl+"/reverse",r,function(t){o.call(n,s._parseResults(t,"bounds"))})},e._parseResults=function(t,e){var n=[];return o.geoJSON(t,{pointToLayer:function(t,e){return o.circleMarker(e)},onEachFeature:function(t,s){var i,r,a={};s.getBounds?r=(i=s.getBounds()).getCenter():s.feature.bbox?(r=s.getLatLng(),i=o.latLngBounds(o.GeoJSON.coordsToLatLng(s.feature.bbox.slice(0,2)),o.GeoJSON.coordsToLatLng(s.feature.bbox.slice(2,4)))):(r=s.getLatLng(),i=o.latLngBounds(r,r)),a.name=s.feature.properties.label,a.center=r,a[e]=i,a.properties=s.feature.properties,n.push(a)}}),n},t}();function D(t){return new k(t)}var B=k,R=D,S=k,O=D,K=function(t){function e(e){return t.call(this,o.Util.extend({serviceUrl:"https://api.openrouteservice.org/geocode"},e))||this}return n(e,t),e}(k),T=function(){function t(t){this.options={serviceUrl:"https://photon.komoot.io/api/",reverseUrl:"https://photon.komoot.io/reverse/",nameProperties:["name","street","suburb","hamlet","town","city","state","country"]},o.Util.setOptions(this,t)}var e=t.prototype;return e.geocode=function(t,e,n){var i=s(this.options,{q:t});d(this.options.serviceUrl,i,o.Util.bind(function(t){e.call(n,this._decodeFeatures(t))},this))},e.suggest=function(t,e,o){return this.geocode(t,e,o)},e.reverse=function(t,e,n,s){var r=i(this.options,{lat:t.lat,lon:t.lng});d(this.options.reverseUrl,r,o.Util.bind(function(t){n.call(s,this._decodeFeatures(t))},this))},e._decodeFeatures=function(t){var e=[];if(t&&t.features)for(var n=0;n<t.features.length;n++){var s=t.features[n],i=s.geometry.coordinates,r=o.latLng(i[1],i[0]),a=s.properties.extent,l=a?o.latLngBounds([a[1],a[0]],[a[3],a[2]]):o.latLngBounds(r,r);e.push({name:this._decodeFeatureName(s),html:this.options.htmlTemplate?this.options.htmlTemplate(s):void 0,center:r,bbox:l,properties:s.properties})}return e},e._decodeFeatureName=function(t){return(this.options.nameProperties||[]).map(function(e){return t.properties[e]}).filter(function(t){return!!t}).join(", ")},t}(),j=function(){function t(t){this.options={serviceUrl:"https://api.what3words.com/v2/"},o.Util.setOptions(this,t)}var e=t.prototype;return e.geocode=function(t,e,n){d(this.options.serviceUrl+"forward",s(this.options,{key:this.options.apiKey,addr:t.split(/\s+/).join(".")}),function(t){var s=[];if(t.geometry){var i=o.latLng(t.geometry.lat,t.geometry.lng),r=o.latLngBounds(i,i);s[0]={name:t.words,bbox:r,center:i}}e.call(n,s)})},e.suggest=function(t,e,o){return this.geocode(t,e,o)},e.reverse=function(t,e,n,s){d(this.options.serviceUrl+"reverse",i(this.options,{key:this.options.apiKey,coords:[t.lat,t.lng].join(",")}),function(t){var e=[];if(200==t.status.status){var i=o.latLng(t.geometry.lat,t.geometry.lng),r=o.latLngBounds(i,i);e[0]={name:t.words,bbox:r,center:i}}n.call(s,e)})},t}(),N={__proto__:null,geocodingParams:s,reverseParams:i,ArcGis:g,arcgis:function(t){return new g(t)},Bing:f,bing:function(t){return new f(t)},Google:v,google:function(t){return new v(t)},HERE:m,HEREv2:_,here:function(t){return t.apiKey?new _(t):new m(t)},parseLatLng:b,LatLng:y,latLng:function(t){return new y(t)},Mapbox:L,mapbox:function(t){return new L(t)},MapQuest:x,mapQuest:function(t){return new x(t)},Neutrino:U,neutrino:function(t){return new U(t)},Nominatim:w,nominatim:function(t){return new w(t)},OpenLocationCode:C,openLocationCode:function(t){return new C(t)},OpenCage:E,opencage:function(t){return new E(t)},Pelias:k,pelias:D,GeocodeEarth:B,geocodeEarth:R,Mapzen:S,mapzen:O,Openrouteservice:K,openrouteservice:function(t){return new K(t)},Photon:T,photon:function(t){return new T(t)},What3Words:j,what3words:function(t){return new j(t)}},M=function(){};o.Util.extend(M.prototype,o.Control.prototype),o.Util.extend(M.prototype,o.Evented.prototype);var P=function(t){function e(e){var n;return(n=t.call(this,e)||this).options={showUniqueResult:!0,showResultIcons:!1,collapsed:!0,expand:"touch",position:"topright",placeholder:"Search...",errorMessage:"Nothing found.",iconLabel:"Initiate a new search",query:"",queryMinLength:1,suggestMinLength:3,suggestTimeout:250,defaultMarkGeocode:!0},n._requestCount=0,o.Util.setOptions(function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(n),e),n.options.geocoder||(n.options.geocoder=new w),n}n(e,t);var s=e.prototype;return s.addThrobberClass=function(){o.DomUtil.addClass(this._container,"leaflet-control-geocoder-throbber")},s.removeThrobberClass=function(){o.DomUtil.removeClass(this._container,"leaflet-control-geocoder-throbber")},s.onAdd=function(t){var e=this,n="leaflet-control-geocoder",s=o.DomUtil.create("div",n+" leaflet-bar"),i=o.DomUtil.create("button",n+"-icon",s),r=this._form=o.DomUtil.create("div",n+"-form",s);this._map=t,this._container=s,i.innerHTML="&nbsp;",i.type="button",i.setAttribute("aria-label",this.options.iconLabel);var a=this._input=o.DomUtil.create("input","",r);return a.type="text",a.value=this.options.query,a.placeholder=this.options.placeholder,o.DomEvent.disableClickPropagation(a),this._errorElement=o.DomUtil.create("div",n+"-form-no-error",s),this._errorElement.innerHTML=this.options.errorMessage,this._alts=o.DomUtil.create("ul",n+"-alternatives leaflet-control-geocoder-alternatives-minimized",s),o.DomEvent.disableClickPropagation(this._alts),o.DomEvent.addListener(a,"keydown",this._keydown,this),this.options.geocoder.suggest&&o.DomEvent.addListener(a,"input",this._change,this),o.DomEvent.addListener(a,"blur",function(){e.options.collapsed&&!e._preventBlurCollapse&&e._collapse(),e._preventBlurCollapse=!1}),this.options.collapsed?"click"===this.options.expand?o.DomEvent.addListener(s,"click",function(t){0===t.button&&2!==t.detail&&e._toggle()}):"touch"===this.options.expand?o.DomEvent.addListener(s,o.Browser.touch?"touchstart mousedown":"mousedown",function(t){e._toggle(),t.preventDefault(),t.stopPropagation()},this):(o.DomEvent.addListener(s,"mouseover",this._expand,this),o.DomEvent.addListener(s,"mouseout",this._collapse,this),this._map.on("movestart",this._collapse,this)):(this._expand(),o.DomEvent.addListener(s,o.Browser.touch?"touchstart":"click",function(){return e._geocode()})),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),o.DomEvent.disableClickPropagation(s),s},s.setQuery=function(t){return this._input.value=t,this},s._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,o.DomUtil.removeClass(this._alts,"leaflet-control-geocoder-alternatives-minimized"),o.DomUtil.addClass(this._container,"leaflet-control-geocoder-options-open");for(var n=0;n<t.length;n++)this._alts.appendChild(this._createAlt(t[n],n))}else o.DomUtil.addClass(this._container,"leaflet-control-geocoder-options-error"),o.DomUtil.addClass(this._errorElement,"leaflet-control-geocoder-error")},s.markGeocode=function(t){var e=t.geocode;return this._map.fitBounds(e.bbox),this._geocodeMarker&&this._map.removeLayer(this._geocodeMarker),this._geocodeMarker=new o.Marker(e.center).bindPopup(e.html||e.name).addTo(this._map).openPopup(),this},s._geocode=function(t){var e=this,o=this._input.value;if(t||!(o.length<this.options.queryMinLength)){var n=++this._requestCount,s=function(s){n===e._requestCount&&(e.fire(t?"finishsuggest":"finishgeocode",{input:o,results:s}),e._geocodeResult(s,t))};this._lastGeocode=o,t||this._clearResults(),this.fire(t?"startsuggest":"startgeocode",{input:o}),t?this.options.geocoder.suggest(o,s):this.options.geocoder.geocode(o,s)}},s._geocodeResultSelected=function(t){this.fire("markgeocode",{geocode:t})},s._toggle=function(){o.DomUtil.hasClass(this._container,"leaflet-control-geocoder-expanded")?this._collapse():this._expand()},s._expand=function(){o.DomUtil.addClass(this._container,"leaflet-control-geocoder-expanded"),this._input.select(),this.fire("expand")},s._collapse=function(){o.DomUtil.removeClass(this._container,"leaflet-control-geocoder-expanded"),o.DomUtil.addClass(this._alts,"leaflet-control-geocoder-alternatives-minimized"),o.DomUtil.removeClass(this._errorElement,"leaflet-control-geocoder-error"),o.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-open"),o.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-error"),this._input.blur(),this.fire("collapse")},s._clearResults=function(){o.DomUtil.addClass(this._alts,"leaflet-control-geocoder-alternatives-minimized"),this._selection=null,o.DomUtil.removeClass(this._errorElement,"leaflet-control-geocoder-error"),o.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-open"),o.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-error")},s._createAlt=function(t,e){var n=this,s=o.DomUtil.create("li",""),i=o.DomUtil.create("a","",s),r=this.options.showResultIcons&&t.icon?o.DomUtil.create("img","",i):null,a=t.html?void 0:document.createTextNode(t.name);return r&&(r.src=t.icon),s.setAttribute("data-result-index",String(e)),t.html?i.innerHTML=i.innerHTML+t.html:a&&i.appendChild(a),o.DomEvent.addListener(s,"mousedown touchstart",function(e){n._preventBlurCollapse=!0,o.DomEvent.stop(e),n._geocodeResultSelected(t),o.DomEvent.on(s,"click touchend",function(){n.options.collapsed?n._collapse():n._clearResults()})},this),s},s._keydown=function(t){var e=this,n=function(t){e._selection&&(o.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&&o.DomUtil.addClass(e._selection,"leaflet-control-geocoder-selected")};switch(t.keyCode){case 27:this.options.collapsed?this._collapse():this._clearResults();break;case 38:n(-1);break;case 40:n(1);break;case 13:if(this._selection){var s=parseInt(this._selection.getAttribute("data-result-index"),10);this._geocodeResultSelected(this._results[s]),this._clearResults()}else this._geocode();break;default:return}o.DomEvent.preventDefault(t)},s._change=function(){var t=this,e=this._input.value;e!==this._lastGeocode&&(clearTimeout(this._suggestTimeout),e.length>=this.options.suggestMinLength?this._suggestTimeout=setTimeout(function(){return t._geocode(!0)},this.options.suggestTimeout):this._clearResults())},e}(M);return o.Util.extend(P,N),o.Util.extend(o.Control,{Geocoder:P,geocoder:function(t){return new P(t)}}),P}(L);
var leafletControlGeocoder=function(t,e){function o(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(o){if("default"!==o){var n=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(e,o,n.get?n:{enumerable:!0,get:function(){return t[o]}})}}),e.default=t,e}var n=o(e);function s(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}function i(t,e){return n.Util.extend(e,t.geocodingQueryParams)}function r(t,e){return n.Util.extend(e,t.reverseQueryParams)}var a=0,l=/[&<>"'`]/g,c=/[&<>"'`]/,u={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};function p(t){return u[t]}function d(t,e,o,s,i){var r="_l_geocoder_"+a++;e[i||"callback"]=r,window[r]=n.Util.bind(o,s);var l=document.createElement("script");l.type="text/javascript",l.src=t+g(e),l.id=r,document.getElementsByTagName("head")[0].appendChild(l)}function h(t,e,o){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;o(t)}},n.open("GET",t+g(e),!0),n.responseType="json",n.setRequestHeader("Accept","application/json"),n.send(null)}function g(t,e,o){var n=[];for(var s in t){var i=encodeURIComponent(o?s.toUpperCase():s),r=t[s];if(Array.isArray(r))for(var a=0;a<r.length;a++)n.push(i+"="+encodeURIComponent(r[a]));else n.push(i+"="+encodeURIComponent(String(r)))}return(e&&-1!==e.indexOf("?")?"&":"?")+n.join("&")}var f=function(){function t(t){this.options={serviceUrl:"https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer",apiKey:""},n.Util.setOptions(this,t)}var e=t.prototype;return e.geocode=function(t,e,o){var s=i(this.options,{token:this.options.apiKey,SingleLine:t,outFields:"Addr_Type",forStorage:!1,maxLocations:10,f:"json"});h(this.options.serviceUrl+"/findAddressCandidates",s,function(t){var s=[];if(t.candidates&&t.candidates.length)for(var i=0;i<=t.candidates.length-1;i++){var r=t.candidates[i],a=n.latLng(r.location.y,r.location.x),l=n.latLngBounds(n.latLng(r.extent.ymax,r.extent.xmax),n.latLng(r.extent.ymin,r.extent.xmin));s[i]={name:r.address,bbox:l,center:a}}e.call(o,s)})},e.suggest=function(t,e,o){return this.geocode(t,e,o)},e.reverse=function(t,e,o,s){var i=r(this.options,{location:t.lng+","+t.lat,distance:100,f:"json"});h(this.options.serviceUrl+"/reverseGeocode",i,function(t){var e=[];if(t&&!t.error){var i=n.latLng(t.location.y,t.location.x),r=n.latLngBounds(i,i);e.push({name:t.address.Match_addr,center:i,bbox:r})}o.call(s,e)})},t}(),v=function(){function t(t){this.options={serviceUrl:"https://dev.virtualearth.net/REST/v1/Locations"},n.Util.setOptions(this,t)}var e=t.prototype;return e.geocode=function(t,e,o){var s=i(this.options,{query:t,key:this.options.apiKey});d(this.options.apiKey,s,function(t){var s=[];if(t.resourceSets.length>0)for(var i=t.resourceSets[0].resources.length-1;i>=0;i--){var r=t.resourceSets[0].resources[i],a=r.bbox;s[i]={name:r.name,bbox:n.latLngBounds([a[0],a[1]],[a[2],a[3]]),center:n.latLng(r.point.coordinates)}}e.call(o,s)},this,"jsonp")},e.reverse=function(t,e,o,s){var i=r(this.options,{key:this.options.apiKey});d(this.options.serviceUrl+t.lat+","+t.lng,i,function(t){for(var e=[],i=t.resourceSets[0].resources.length-1;i>=0;i--){var r=t.resourceSets[0].resources[i],a=r.bbox;e[i]={name:r.name,bbox:n.latLngBounds([a[0],a[1]],[a[2],a[3]]),center:n.latLng(r.point.coordinates)}}o.call(s,e)},this,"jsonp")},t}(),m=function(){function t(t){this.options={serviceUrl:"https://maps.googleapis.com/maps/api/geocode/json"},n.Util.setOptions(this,t)}var e=t.prototype;return e.geocode=function(t,e,o){var s=i(this.options,{key:this.options.apiKey,address:t});h(this.options.serviceUrl,s,function(t){var s=[];if(t.results&&t.results.length)for(var i=0;i<=t.results.length-1;i++){var r=t.results[i],a=n.latLng(r.geometry.location),l=n.latLngBounds(n.latLng(r.geometry.viewport.northeast),n.latLng(r.geometry.viewport.southwest));s[i]={name:r.formatted_address,bbox:l,center:a,properties:r.address_components}}e.call(o,s)})},e.reverse=function(t,e,o,s){var i=r(this.options,{key:this.options.apiKey,latlng:t.lat+","+t.lng});h(this.options.serviceUrl,i,function(t){var e=[];if(t.results&&t.results.length)for(var i=0;i<=t.results.length-1;i++){var r=t.results[i],a=n.latLng(r.geometry.location),l=n.latLngBounds(n.latLng(r.geometry.viewport.northeast),n.latLng(r.geometry.viewport.southwest));e[i]={name:r.formatted_address,bbox:l,center:a,properties:r.address_components}}o.call(s,e)})},t}(),_=function(){function t(t){if(this.options={serviceUrl:"https://geocoder.api.here.com/6.2/",app_id:"",app_code:"",apiKey:"",maxResults:5},n.Util.setOptions(this,t),t.apiKey)throw Error("apiKey is not supported, use app_id/app_code instead!")}var e=t.prototype;return e.geocode=function(t,e,o){var n=i(this.options,{searchtext:t,gen:9,app_id:this.options.app_id,app_code:this.options.app_code,jsonattributes:1,maxresults:this.options.maxResults});this.getJSON(this.options.serviceUrl+"geocode.json",n,e,o)},e.reverse=function(t,e,o,n){var s=t.lat+","+t.lng;this.options.reverseGeocodeProxRadius&&(s+=","+this.options.reverseGeocodeProxRadius);var i=r(this.options,{prox:s,mode:"retrieveAddresses",app_id:this.options.app_id,app_code:this.options.app_code,gen:9,jsonattributes:1,maxresults:this.options.maxResults});this.getJSON(this.options.serviceUrl+"reversegeocode.json",i,o,n)},e.getJSON=function(t,e,o,s){h(t,e,function(t){var e=[];if(t.response.view&&t.response.view.length)for(var i=0;i<=t.response.view[0].result.length-1;i++){var r=t.response.view[0].result[i].location,a=n.latLng(r.displayPosition.latitude,r.displayPosition.longitude),l=n.latLngBounds(n.latLng(r.mapView.topLeft.latitude,r.mapView.topLeft.longitude),n.latLng(r.mapView.bottomRight.latitude,r.mapView.bottomRight.longitude));e[i]={name:r.address.label,properties:r.address,bbox:l,center:a}}o.call(s,e)})},t}(),b=function(){function t(t){this.options={serviceUrl:"https://geocode.search.hereapi.com/v1",apiKey:"",app_id:"",app_code:"",maxResults:10},n.Util.setOptions(this,t)}var e=t.prototype;return e.geocode=function(t,e,o){var n=i(this.options,{q:t,apiKey:this.options.apiKey,limit:this.options.maxResults});if(!n.at&&!n.in)throw Error("at / in parameters not found. Please define coordinates (at=latitude,longitude) or other (in) in your geocodingQueryParams.");this.getJSON(this.options.serviceUrl+"/discover",n,e,o)},e.reverse=function(t,e,o,n){var s=r(this.options,{at:t.lat+","+t.lng,limit:this.options.reverseGeocodeProxRadius,apiKey:this.options.apiKey});this.getJSON(this.options.serviceUrl+"/revgeocode",s,o,n)},e.getJSON=function(t,e,o,s){h(t,e,function(t){var e=[];if(t.items&&t.items.length)for(var i=0;i<=t.items.length-1;i++){var r,a=t.items[i],l=n.latLng(a.position.lat,a.position.lng);r=a.mapView?n.latLngBounds(n.latLng(a.mapView.south,a.mapView.west),n.latLng(a.mapView.north,a.mapView.east)):n.latLngBounds(n.latLng(a.position.lat,a.position.lng),n.latLng(a.position.lat,a.position.lng)),e[i]={name:a.address.label,properties:a.address,bbox:r,center:l}}o.call(s,e)})},t}();function y(t){var e;return(e=t.match(/^([NS])\s*(\d{1,3}(?:\.\d*)?)\W*([EW])\s*(\d{1,3}(?:\.\d*)?)$/))?n.latLng((/N/i.test(e[1])?1:-1)*+e[2],(/E/i.test(e[3])?1:-1)*+e[4]):(e=t.match(/^(\d{1,3}(?:\.\d*)?)\s*([NS])\W*(\d{1,3}(?:\.\d*)?)\s*([EW])$/))?n.latLng((/N/i.test(e[2])?1:-1)*+e[1],(/E/i.test(e[4])?1:-1)*+e[3]):(e=t.match(/^([NS])\s*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\W*([EW])\s*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?$/))?n.latLng((/N/i.test(e[1])?1:-1)*(+e[2]+ +e[3]/60),(/E/i.test(e[4])?1:-1)*(+e[5]+ +e[6]/60)):(e=t.match(/^(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\s*([NS])\W*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\s*([EW])$/))?n.latLng((/N/i.test(e[3])?1:-1)*(+e[1]+ +e[2]/60),(/E/i.test(e[6])?1:-1)*(+e[4]+ +e[5]/60)):(e=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*)?)?["″]?$/))?n.latLng((/N/i.test(e[1])?1:-1)*(+e[2]+ +e[3]/60+ +e[4]/3600),(/E/i.test(e[5])?1:-1)*(+e[6]+ +e[7]/60+ +e[8]/3600)):(e=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])$/))?n.latLng((/N/i.test(e[4])?1:-1)*(+e[1]+ +e[2]/60+ +e[3]/3600),(/E/i.test(e[8])?1:-1)*(+e[5]+ +e[6]/60+ +e[7]/3600)):(e=t.match(/^\s*([+-]?\d+(?:\.\d*)?)\s*[\s,]\s*([+-]?\d+(?:\.\d*)?)\s*$/))?n.latLng(+e[1],+e[2]):void 0}var L=function(){function t(t){this.options={next:void 0,sizeInMeters:1e4},n.Util.setOptions(this,t)}return t.prototype.geocode=function(t,e,o){var n=y(t);if(n){var s=[{name:t,center:n,bbox:n.toBounds(this.options.sizeInMeters)}];e.call(o,s)}else this.options.next&&this.options.next.geocode(t,e,o)},t}(),x=function(){function t(t){this.options={serviceUrl:"https://api.mapbox.com/geocoding/v5/mapbox.places/"},n.Util.setOptions(this,t)}var e=t.prototype;return e._getProperties=function(t){for(var e={text:t.text,address:t.address},o=0;o<(t.context||[]).length;o++)e[t.context[o].id.split(".")[0]]=t.context[o].text,t.context[o].short_code&&(e.countryShortCode=t.context[o].short_code);return e},e.geocode=function(t,e,o){var s=this,r=i(this.options,{access_token:this.options.apiKey});void 0!==r.proximity&&void 0!==r.proximity.lat&&void 0!==r.proximity.lng&&(r.proximity=r.proximity.lng+","+r.proximity.lat),h(this.options.serviceUrl+encodeURIComponent(t)+".json",r,function(t){var i=[];if(t.features&&t.features.length)for(var r=0;r<=t.features.length-1;r++){var a,l=t.features[r],c=n.latLng(l.center.reverse());a=l.bbox?n.latLngBounds(n.latLng(l.bbox.slice(0,2).reverse()),n.latLng(l.bbox.slice(2,4).reverse())):n.latLngBounds(c,c),i[r]={name:l.place_name,bbox:a,center:c,properties:s._getProperties(l)}}e.call(o,i)})},e.suggest=function(t,e,o){return this.geocode(t,e,o)},e.reverse=function(t,e,o,s){var i=this;h(this.options.serviceUrl+t.lng+","+t.lat+".json",r(this.options,{access_token:this.options.apiKey}),function(t){var e=[];if(t.features&&t.features.length)for(var r=0;r<=t.features.length-1;r++){var a,l=t.features[r],c=n.latLng(l.center.reverse());a=l.bbox?n.latLngBounds(n.latLng(l.bbox.slice(0,2).reverse()),n.latLng(l.bbox.slice(2,4).reverse())):n.latLngBounds(c,c),e[r]={name:l.place_name,bbox:a,center:c,properties:i._getProperties(l)}}o.call(s,e)})},t}(),U=function(){function t(t){this.options={serviceUrl:"https://www.mapquestapi.com/geocoding/v1"},n.Util.setOptions(this,t),this.options.apiKey=decodeURIComponent(this.options.apiKey)}var e=t.prototype;return e._formatName=function(){return[].slice.call(arguments).filter(function(t){return!!t}).join(", ")},e.geocode=function(t,e,o){var s=i(this.options,{key:this.options.apiKey,location:t,limit:5,outFormat:"json"});h(this.options.serviceUrl+"/address",s,n.Util.bind(function(t){var s=[];if(t.results&&t.results[0].locations)for(var i=t.results[0].locations.length-1;i>=0;i--){var r=t.results[0].locations[i],a=n.latLng(r.latLng);s[i]={name:this._formatName(r.street,r.adminArea4,r.adminArea3,r.adminArea1),bbox:n.latLngBounds(a,a),center:a}}e.call(o,s)},this))},e.reverse=function(t,e,o,s){var i=r(this.options,{key:this.options.apiKey,location:t.lat+","+t.lng,outputFormat:"json"});h(this.options.serviceUrl+"/reverse",i,n.Util.bind(function(t){var e=[];if(t.results&&t.results[0].locations)for(var i=t.results[0].locations.length-1;i>=0;i--){var r=t.results[0].locations[i],a=n.latLng(r.latLng);e[i]={name:this._formatName(r.street,r.adminArea4,r.adminArea3,r.adminArea1),bbox:n.latLngBounds(a,a),center:a}}o.call(s,e)},this))},t}(),w=function(){function t(t){this.options={userId:void 0,apiKey:void 0,serviceUrl:"https://neutrinoapi.com/"},n.Util.setOptions(this,t)}var e=t.prototype;return e.geocode=function(t,e,o){var s=i(this.options,{apiKey:this.options.apiKey,userId:this.options.userId,address:t.split(/\s+/).join(".")});h(this.options.serviceUrl+"geocode-address",s,function(t){var s=[];if(t.locations){t.geometry=t.locations[0];var i=n.latLng(t.geometry.latitude,t.geometry.longitude),r=n.latLngBounds(i,i);s[0]={name:t.geometry.address,bbox:r,center:i}}e.call(o,s)})},e.suggest=function(t,e,o){return this.geocode(t,e,o)},e.reverse=function(t,e,o,s){var i=r(this.options,{apiKey:this.options.apiKey,userId:this.options.userId,latitude:t.lat,longitude:t.lng});h(this.options.serviceUrl+"geocode-reverse",i,function(e){var i=[];if(200==e.status.status&&e.found){var r=n.latLng(t.lat,t.lng),a=n.latLngBounds(r,r);i[0]={name:e.address,bbox:a,center:r}}o.call(s,i)})},t}(),C=function(){function t(t){this.options={serviceUrl:"https://nominatim.openstreetmap.org/",htmlTemplate:function(t){var e,o,n=t.address,s=[];return(n.road||n.building)&&s.push("{building} {road} {house_number}"),(n.city||n.town||n.village||n.hamlet)&&s.push('<span class="'+(s.length>0?"leaflet-control-geocoder-address-detail":"")+'">{postcode} {city} {town} {village} {hamlet}</span>'),(n.state||n.country)&&s.push('<span class="'+(s.length>0?"leaflet-control-geocoder-address-context":"")+'">{state} {country}</span>'),e=s.join("<br/>"),o=n,e.replace(/\{ *([\w_]+) *\}/g,function(t,e){var n,s=o[e];return void 0===s?s="":"function"==typeof s&&(s=s(o)),null==(n=s)?"":n?c.test(n=""+n)?n.replace(l,p):n:n+""})}},n.Util.setOptions(this,t||{})}var e=t.prototype;return e.geocode=function(t,e,o){var s=this,r=i(this.options,{q:t,limit:5,format:"json",addressdetails:1});h(this.options.serviceUrl+"search",r,function(t){for(var i=[],r=t.length-1;r>=0;r--){for(var a=t[r].boundingbox,l=0;l<4;l++)a[l]=+a[l];i[r]={icon:t[r].icon,name:t[r].display_name,html:s.options.htmlTemplate?s.options.htmlTemplate(t[r]):void 0,bbox:n.latLngBounds([a[0],a[2]],[a[1],a[3]]),center:n.latLng(t[r].lat,t[r].lon),properties:t[r]}}e.call(o,i)})},e.reverse=function(t,e,o,s){var i=this,a=r(this.options,{lat:t.lat,lon:t.lng,zoom:Math.round(Math.log(e/256)/Math.log(2)),addressdetails:1,format:"json"});h(this.options.serviceUrl+"reverse",a,function(t){var e=[];if(t&&t.lat&&t.lon){var r=n.latLng(t.lat,t.lon),a=n.latLngBounds(r,r);e.push({name:t.display_name,html:i.options.htmlTemplate?i.options.htmlTemplate(t):void 0,center:r,bbox:a,properties:t})}o.call(s,e)})},t}(),E=function(){function t(t){n.Util.setOptions(this,t)}var e=t.prototype;return e.geocode=function(t,e,o){try{var s=this.options.OpenLocationCode.decode(t),i={name:t,center:n.latLng(s.latitudeCenter,s.longitudeCenter),bbox:n.latLngBounds(n.latLng(s.latitudeLo,s.longitudeLo),n.latLng(s.latitudeHi,s.longitudeHi))};e.call(o,[i])}catch(t){console.warn(t),e.call(o,[])}},e.reverse=function(t,e,o,s){try{var i={name:this.options.OpenLocationCode.encode(t.lat,t.lng,this.options.codeLength),center:n.latLng(t.lat,t.lng),bbox:n.latLngBounds(n.latLng(t.lat,t.lng),n.latLng(t.lat,t.lng))};o.call(s,[i])}catch(t){console.warn(t),o.call(s,[])}},t}(),k=function(){function t(t){this.options={serviceUrl:"https://api.opencagedata.com/geocode/v1/json"},n.Util.setOptions(this,t)}var e=t.prototype;return e.geocode=function(t,e,o){var s=i(this.options,{key:this.options.apiKey,q:t});h(this.options.serviceUrl,s,function(t){var s=[];if(t.results&&t.results.length)for(var i=0;i<t.results.length;i++){var r,a=t.results[i],l=n.latLng(a.geometry);r=a.annotations&&a.annotations.bounds?n.latLngBounds(n.latLng(a.annotations.bounds.northeast),n.latLng(a.annotations.bounds.southwest)):n.latLngBounds(l,l),s.push({name:a.formatted,bbox:r,center:l})}e.call(o,s)})},e.suggest=function(t,e,o){return this.geocode(t,e,o)},e.reverse=function(t,e,o,s){var i=r(this.options,{key:this.options.apiKey,q:[t.lat,t.lng].join(",")});h(this.options.serviceUrl,i,function(t){var e=[];if(t.results&&t.results.length)for(var i=0;i<t.results.length;i++){var r,a=t.results[i],l=n.latLng(a.geometry);r=a.annotations&&a.annotations.bounds?n.latLngBounds(n.latLng(a.annotations.bounds.northeast),n.latLng(a.annotations.bounds.southwest)):n.latLngBounds(l,l),e.push({name:a.formatted,bbox:r,center:l})}o.call(s,e)})},t}(),D=function(){function t(t){this.options={serviceUrl:"https://api.geocode.earth/v1"},this._lastSuggest=0,n.Util.setOptions(this,t)}var e=t.prototype;return e.geocode=function(t,e,o){var n=this,s=i(this.options,{api_key:this.options.apiKey,text:t});h(this.options.serviceUrl+"/search",s,function(t){e.call(o,n._parseResults(t,"bbox"))})},e.suggest=function(t,e,o){var n=this,s=i(this.options,{api_key:this.options.apiKey,text:t});h(this.options.serviceUrl+"/autocomplete",s,function(t){t.geocoding.timestamp>n._lastSuggest&&(n._lastSuggest=t.geocoding.timestamp,e.call(o,n._parseResults(t,"bbox")))})},e.reverse=function(t,e,o,n){var s=this,i=r(this.options,{api_key:this.options.apiKey,"point.lat":t.lat,"point.lon":t.lng});h(this.options.serviceUrl+"/reverse",i,function(t){o.call(n,s._parseResults(t,"bounds"))})},e._parseResults=function(t,e){var o=[];return n.geoJSON(t,{pointToLayer:function(t,e){return n.circleMarker(e)},onEachFeature:function(t,s){var i,r,a={};s.getBounds?r=(i=s.getBounds()).getCenter():s.feature.bbox?(r=s.getLatLng(),i=n.latLngBounds(n.GeoJSON.coordsToLatLng(s.feature.bbox.slice(0,2)),n.GeoJSON.coordsToLatLng(s.feature.bbox.slice(2,4)))):(r=s.getLatLng(),i=n.latLngBounds(r,r)),a.name=s.feature.properties.label,a.center=r,a[e]=i,a.properties=s.feature.properties,o.push(a)}}),o},t}();function B(t){return new D(t)}var R=D,S=B,O=D,K=B,T=function(t){function e(e){return t.call(this,n.Util.extend({serviceUrl:"https://api.openrouteservice.org/geocode"},e))||this}return s(e,t),e}(D),j=function(){function t(t){this.options={serviceUrl:"https://photon.komoot.io/api/",reverseUrl:"https://photon.komoot.io/reverse/",nameProperties:["name","street","suburb","hamlet","town","city","state","country"]},n.Util.setOptions(this,t)}var e=t.prototype;return e.geocode=function(t,e,o){var s=i(this.options,{q:t});h(this.options.serviceUrl,s,n.Util.bind(function(t){e.call(o,this._decodeFeatures(t))},this))},e.suggest=function(t,e,o){return this.geocode(t,e,o)},e.reverse=function(t,e,o,s){var i=r(this.options,{lat:t.lat,lon:t.lng});h(this.options.reverseUrl,i,n.Util.bind(function(t){o.call(s,this._decodeFeatures(t))},this))},e._decodeFeatures=function(t){var e=[];if(t&&t.features)for(var o=0;o<t.features.length;o++){var s=t.features[o],i=s.geometry.coordinates,r=n.latLng(i[1],i[0]),a=s.properties.extent,l=a?n.latLngBounds([a[1],a[0]],[a[3],a[2]]):n.latLngBounds(r,r);e.push({name:this._decodeFeatureName(s),html:this.options.htmlTemplate?this.options.htmlTemplate(s):void 0,center:r,bbox:l,properties:s.properties})}return e},e._decodeFeatureName=function(t){return(this.options.nameProperties||[]).map(function(e){return t.properties[e]}).filter(function(t){return!!t}).join(", ")},t}(),N=function(){function t(t){this.options={serviceUrl:"https://api.what3words.com/v2/"},n.Util.setOptions(this,t)}var e=t.prototype;return e.geocode=function(t,e,o){h(this.options.serviceUrl+"forward",i(this.options,{key:this.options.apiKey,addr:t.split(/\s+/).join(".")}),function(t){var s=[];if(t.geometry){var i=n.latLng(t.geometry.lat,t.geometry.lng),r=n.latLngBounds(i,i);s[0]={name:t.words,bbox:r,center:i}}e.call(o,s)})},e.suggest=function(t,e,o){return this.geocode(t,e,o)},e.reverse=function(t,e,o,s){h(this.options.serviceUrl+"reverse",r(this.options,{key:this.options.apiKey,coords:[t.lat,t.lng].join(",")}),function(t){var e=[];if(200==t.status.status){var i=n.latLng(t.geometry.lat,t.geometry.lng),r=n.latLngBounds(i,i);e[0]={name:t.words,bbox:r,center:i}}o.call(s,e)})},t}(),M={__proto__:null,geocodingParams:i,reverseParams:r,ArcGis:f,arcgis:function(t){return new f(t)},Bing:v,bing:function(t){return new v(t)},Google:m,google:function(t){return new m(t)},HERE:_,HEREv2:b,here:function(t){return t.apiKey?new b(t):new _(t)},parseLatLng:y,LatLng:L,latLng:function(t){return new L(t)},Mapbox:x,mapbox:function(t){return new x(t)},MapQuest:U,mapQuest:function(t){return new U(t)},Neutrino:w,neutrino:function(t){return new w(t)},Nominatim:C,nominatim:function(t){return new C(t)},OpenLocationCode:E,openLocationCode:function(t){return new E(t)},OpenCage:k,opencage:function(t){return new k(t)},Pelias:D,pelias:B,GeocodeEarth:R,geocodeEarth:S,Mapzen:O,mapzen:K,Openrouteservice:T,openrouteservice:function(t){return new T(t)},Photon:j,photon:function(t){return new j(t)},What3Words:N,what3words:function(t){return new N(t)}},P=function(){};n.Util.extend(P.prototype,n.Control.prototype),n.Util.extend(P.prototype,n.Evented.prototype);var G=function(t){function e(e){var o;return(o=t.call(this,e)||this).options={showUniqueResult:!0,showResultIcons:!1,collapsed:!0,expand:"touch",position:"topright",placeholder:"Search...",errorMessage:"Nothing found.",iconLabel:"Initiate a new search",query:"",queryMinLength:1,suggestMinLength:3,suggestTimeout:250,defaultMarkGeocode:!0},o._requestCount=0,n.Util.setOptions(function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(o),e),o.options.geocoder||(o.options.geocoder=new C),o}s(e,t);var o=e.prototype;return o.addThrobberClass=function(){n.DomUtil.addClass(this._container,"leaflet-control-geocoder-throbber")},o.removeThrobberClass=function(){n.DomUtil.removeClass(this._container,"leaflet-control-geocoder-throbber")},o.onAdd=function(t){var e=this,o="leaflet-control-geocoder",s=n.DomUtil.create("div",o+" leaflet-bar"),i=n.DomUtil.create("button",o+"-icon",s),r=this._form=n.DomUtil.create("div",o+"-form",s);this._map=t,this._container=s,i.innerHTML="&nbsp;",i.type="button",i.setAttribute("aria-label",this.options.iconLabel);var a=this._input=n.DomUtil.create("input","",r);return a.type="text",a.value=this.options.query,a.placeholder=this.options.placeholder,n.DomEvent.disableClickPropagation(a),this._errorElement=n.DomUtil.create("div",o+"-form-no-error",s),this._errorElement.innerHTML=this.options.errorMessage,this._alts=n.DomUtil.create("ul",o+"-alternatives leaflet-control-geocoder-alternatives-minimized",s),n.DomEvent.disableClickPropagation(this._alts),n.DomEvent.addListener(a,"keydown",this._keydown,this),this.options.geocoder.suggest&&n.DomEvent.addListener(a,"input",this._change,this),n.DomEvent.addListener(a,"blur",function(){e.options.collapsed&&!e._preventBlurCollapse&&e._collapse(),e._preventBlurCollapse=!1}),this.options.collapsed?"click"===this.options.expand?n.DomEvent.addListener(s,"click",function(t){0===t.button&&2!==t.detail&&e._toggle()}):"touch"===this.options.expand?n.DomEvent.addListener(s,n.Browser.touch?"touchstart mousedown":"mousedown",function(t){e._toggle(),t.preventDefault(),t.stopPropagation()},this):(n.DomEvent.addListener(s,"mouseover",this._expand,this),n.DomEvent.addListener(s,"mouseout",this._collapse,this),this._map.on("movestart",this._collapse,this)):(this._expand(),n.DomEvent.addListener(s,n.Browser.touch?"touchstart":"click",function(){return e._geocode()})),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),n.DomEvent.disableClickPropagation(s),s},o.setQuery=function(t){return this._input.value=t,this},o._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,n.DomUtil.removeClass(this._alts,"leaflet-control-geocoder-alternatives-minimized"),n.DomUtil.addClass(this._container,"leaflet-control-geocoder-options-open");for(var o=0;o<t.length;o++)this._alts.appendChild(this._createAlt(t[o],o))}else n.DomUtil.addClass(this._container,"leaflet-control-geocoder-options-error"),n.DomUtil.addClass(this._errorElement,"leaflet-control-geocoder-error")},o.markGeocode=function(t){var e=t.geocode;return this._map.fitBounds(e.bbox),this._geocodeMarker&&this._map.removeLayer(this._geocodeMarker),this._geocodeMarker=new n.Marker(e.center).bindPopup(e.html||e.name).addTo(this._map).openPopup(),this},o._geocode=function(t){var e=this,o=this._input.value;if(t||!(o.length<this.options.queryMinLength)){var n=++this._requestCount,s=function(s){n===e._requestCount&&(e.fire(t?"finishsuggest":"finishgeocode",{input:o,results:s}),e._geocodeResult(s,t))};this._lastGeocode=o,t||this._clearResults(),this.fire(t?"startsuggest":"startgeocode",{input:o}),t?this.options.geocoder.suggest(o,s):this.options.geocoder.geocode(o,s)}},o._geocodeResultSelected=function(t){this.fire("markgeocode",{geocode:t})},o._toggle=function(){n.DomUtil.hasClass(this._container,"leaflet-control-geocoder-expanded")?this._collapse():this._expand()},o._expand=function(){n.DomUtil.addClass(this._container,"leaflet-control-geocoder-expanded"),this._input.select(),this.fire("expand")},o._collapse=function(){n.DomUtil.removeClass(this._container,"leaflet-control-geocoder-expanded"),n.DomUtil.addClass(this._alts,"leaflet-control-geocoder-alternatives-minimized"),n.DomUtil.removeClass(this._errorElement,"leaflet-control-geocoder-error"),n.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-open"),n.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-error"),this._input.blur(),this.fire("collapse")},o._clearResults=function(){n.DomUtil.addClass(this._alts,"leaflet-control-geocoder-alternatives-minimized"),this._selection=null,n.DomUtil.removeClass(this._errorElement,"leaflet-control-geocoder-error"),n.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-open"),n.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-error")},o._createAlt=function(t,e){var o=this,s=n.DomUtil.create("li",""),i=n.DomUtil.create("a","",s),r=this.options.showResultIcons&&t.icon?n.DomUtil.create("img","",i):null,a=t.html?void 0:document.createTextNode(t.name);return r&&(r.src=t.icon),s.setAttribute("data-result-index",String(e)),t.html?i.innerHTML=i.innerHTML+t.html:a&&i.appendChild(a),n.DomEvent.addListener(s,"mousedown touchstart",function(e){o._preventBlurCollapse=!0,n.DomEvent.stop(e),o._geocodeResultSelected(t),n.DomEvent.on(s,"click touchend",function(){o.options.collapsed?o._collapse():o._clearResults()})},this),s},o._keydown=function(t){var e=this,o=function(t){e._selection&&(n.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&&n.DomUtil.addClass(e._selection,"leaflet-control-geocoder-selected")};switch(t.keyCode){case 27:this.options.collapsed?this._collapse():this._clearResults();break;case 38:o(-1);break;case 40:o(1);break;case 13:if(this._selection){var s=parseInt(this._selection.getAttribute("data-result-index"),10);this._geocodeResultSelected(this._results[s]),this._clearResults()}else this._geocode();break;default:return}n.DomEvent.preventDefault(t)},o._change=function(){var t=this,e=this._input.value;e!==this._lastGeocode&&(clearTimeout(this._suggestTimeout),e.length>=this.options.suggestMinLength?this._suggestTimeout=setTimeout(function(){return t._geocode(!0)},this.options.suggestTimeout):this._clearResults())},e}(P);function q(t){return new G(t)}return n.Util.extend(G,M),n.Util.extend(n.Control,{Geocoder:G,geocoder:q}),t.Geocoder=G,t.default=G,t.geocoder=q,t.geocoders=M,t}({},L);
//# sourceMappingURL=Control.Geocoder.min.js.map

@@ -1839,2 +1839,3 @@ import * as L from 'leaflet';

export default GeocoderControl;
export { GeocoderControl as Geocoder, geocoder, geocoders };
//# sourceMappingURL=Control.Geocoder.modern.js.map

@@ -1,2 +0,4 @@

import { GeocoderControl as Geocoder } from './control';
import { GeocoderControl as Geocoder, geocoder } from './control';
import * as geocoders from './geocoders/index';
export default Geocoder;
export { Geocoder, geocoder, geocoders };
{
"name": "leaflet-control-geocoder",
"version": "2.3.0",
"version": "2.4.0",
"description": "Extendable geocoder with builtin support for OpenStreetMap Nominatim, Bing, Google, Mapbox, MapQuest, What3Words, Photon, Pelias, HERE, Neutrino, Plus codes",

@@ -5,0 +5,0 @@ "source": "src/index.ts",

@@ -15,2 +15,3 @@ /* @preserve

export default Geocoder;
export { Geocoder, geocoder, geocoders };

@@ -17,0 +18,0 @@ L.Util.extend(L.Control, {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc