leaflet-control-geocoder
Advanced tools
Comparing version 2.2.0 to 2.3.0
@@ -0,1 +1,5 @@ | ||
## 2.3.0 (2021-05-25) | ||
* Specify TypeScript declaration file ([1183518](https://github.com/perliedman/leaflet-control-geocoder/commit/1183518)) | ||
## 2.2.0 (2021-03-08) | ||
@@ -2,0 +6,0 @@ |
var leafletControlGeocoder = (function (L) { | ||
function _interopNamespace(e) { | ||
if (e && e.__esModule) return e; | ||
var n = Object.create(null); | ||
if (e) { | ||
Object.keys(e).forEach(function (k) { | ||
if (k !== 'default') { | ||
var d = Object.getOwnPropertyDescriptor(e, k); | ||
Object.defineProperty(n, k, d.get ? d : { | ||
enumerable: true, | ||
get: function () { | ||
return e[k]; | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
n['default'] = e; | ||
return n; | ||
} | ||
var L__namespace = /*#__PURE__*/_interopNamespace(L); | ||
function _inheritsLoose(subClass, superClass) { | ||
@@ -21,3 +44,3 @@ subClass.prototype = Object.create(superClass.prototype); | ||
function geocodingParams(options, params) { | ||
return L.Util.extend(params, options.geocodingQueryParams); | ||
return L__namespace.Util.extend(params, options.geocodingQueryParams); | ||
} | ||
@@ -29,3 +52,3 @@ /** | ||
function reverseParams(options, params) { | ||
return L.Util.extend(params, options.reverseQueryParams); | ||
return L__namespace.Util.extend(params, options.reverseQueryParams); | ||
} | ||
@@ -99,3 +122,3 @@ | ||
params[jsonpParam || 'callback'] = callbackId; | ||
window[callbackId] = L.Util.bind(callback, context); | ||
window[callbackId] = L__namespace.Util.bind(callback, context); | ||
var script = document.createElement('script'); | ||
@@ -193,3 +216,3 @@ script.type = 'text/javascript'; | ||
}; | ||
L.Util.setOptions(this, options); | ||
L__namespace.Util.setOptions(this, options); | ||
} | ||
@@ -214,4 +237,4 @@ | ||
var loc = data.candidates[i]; | ||
var latLng = L.latLng(loc.location.y, loc.location.x); | ||
var latLngBounds = L.latLngBounds(L.latLng(loc.extent.ymax, loc.extent.xmax), L.latLng(loc.extent.ymin, loc.extent.xmin)); | ||
var latLng = L__namespace.latLng(loc.location.y, loc.location.x); | ||
var latLngBounds = L__namespace.latLngBounds(L__namespace.latLng(loc.extent.ymax, loc.extent.xmax), L__namespace.latLng(loc.extent.ymin, loc.extent.xmin)); | ||
results[i] = { | ||
@@ -243,4 +266,4 @@ name: loc.address, | ||
if (data && !data.error) { | ||
var center = L.latLng(data.location.y, data.location.x); | ||
var bbox = L.latLngBounds(center, center); | ||
var center = L__namespace.latLng(data.location.y, data.location.x); | ||
var bbox = L__namespace.latLngBounds(center, center); | ||
result.push({ | ||
@@ -277,3 +300,3 @@ name: data.address.Match_addr, | ||
}; | ||
L.Util.setOptions(this, options); | ||
L__namespace.Util.setOptions(this, options); | ||
} | ||
@@ -297,4 +320,4 @@ | ||
name: resource.name, | ||
bbox: L.latLngBounds([bbox[0], bbox[1]], [bbox[2], bbox[3]]), | ||
center: L.latLng(resource.point.coordinates) | ||
bbox: L__namespace.latLngBounds([bbox[0], bbox[1]], [bbox[2], bbox[3]]), | ||
center: L__namespace.latLng(resource.point.coordinates) | ||
}; | ||
@@ -320,4 +343,4 @@ } | ||
name: resource.name, | ||
bbox: L.latLngBounds([bbox[0], bbox[1]], [bbox[2], bbox[3]]), | ||
center: L.latLng(resource.point.coordinates) | ||
bbox: L__namespace.latLngBounds([bbox[0], bbox[1]], [bbox[2], bbox[3]]), | ||
center: L__namespace.latLng(resource.point.coordinates) | ||
}; | ||
@@ -346,3 +369,3 @@ } | ||
}; | ||
L.Util.setOptions(this, options); | ||
L__namespace.Util.setOptions(this, options); | ||
} | ||
@@ -363,4 +386,4 @@ | ||
var loc = data.results[i]; | ||
var latLng = L.latLng(loc.geometry.location); | ||
var latLngBounds = L.latLngBounds(L.latLng(loc.geometry.viewport.northeast), L.latLng(loc.geometry.viewport.southwest)); | ||
var latLng = L__namespace.latLng(loc.geometry.location); | ||
var latLngBounds = L__namespace.latLngBounds(L__namespace.latLng(loc.geometry.viewport.northeast), L__namespace.latLng(loc.geometry.viewport.southwest)); | ||
results[i] = { | ||
@@ -390,4 +413,4 @@ name: loc.formatted_address, | ||
var loc = data.results[i]; | ||
var center = L.latLng(loc.geometry.location); | ||
var bbox = L.latLngBounds(L.latLng(loc.geometry.viewport.northeast), L.latLng(loc.geometry.viewport.southwest)); | ||
var center = L__namespace.latLng(loc.geometry.location); | ||
var bbox = L__namespace.latLngBounds(L__namespace.latLng(loc.geometry.viewport.northeast), L__namespace.latLng(loc.geometry.viewport.southwest)); | ||
results[i] = { | ||
@@ -430,3 +453,3 @@ name: loc.formatted_address, | ||
}; | ||
L.Util.setOptions(this, options); | ||
L__namespace.Util.setOptions(this, options); | ||
if (options.apiKey) throw Error('apiKey is not supported, use app_id/app_code instead!'); | ||
@@ -475,4 +498,4 @@ } | ||
var loc = data.response.view[0].result[i].location; | ||
var center = L.latLng(loc.displayPosition.latitude, loc.displayPosition.longitude); | ||
var bbox = L.latLngBounds(L.latLng(loc.mapView.topLeft.latitude, loc.mapView.topLeft.longitude), L.latLng(loc.mapView.bottomRight.latitude, loc.mapView.bottomRight.longitude)); | ||
var center = L__namespace.latLng(loc.displayPosition.latitude, loc.displayPosition.longitude); | ||
var bbox = L__namespace.latLngBounds(L__namespace.latLng(loc.mapView.topLeft.latitude, loc.mapView.topLeft.longitude), L__namespace.latLng(loc.mapView.bottomRight.latitude, loc.mapView.bottomRight.longitude)); | ||
results[i] = { | ||
@@ -506,3 +529,3 @@ name: loc.address.label, | ||
}; | ||
L.Util.setOptions(this, options); | ||
L__namespace.Util.setOptions(this, options); | ||
} | ||
@@ -542,10 +565,10 @@ | ||
var item = data.items[i]; | ||
var latLng = L.latLng(item.position.lat, item.position.lng); | ||
var latLng = L__namespace.latLng(item.position.lat, item.position.lng); | ||
var bbox = void 0; | ||
if (item.mapView) { | ||
bbox = L.latLngBounds(L.latLng(item.mapView.south, item.mapView.west), L.latLng(item.mapView.north, item.mapView.east)); | ||
bbox = L__namespace.latLngBounds(L__namespace.latLng(item.mapView.south, item.mapView.west), L__namespace.latLng(item.mapView.north, item.mapView.east)); | ||
} else { | ||
// Using only position when not provided | ||
bbox = L.latLngBounds(L.latLng(item.position.lat, item.position.lng), L.latLng(item.position.lat, item.position.lng)); | ||
bbox = L__namespace.latLngBounds(L__namespace.latLng(item.position.lat, item.position.lng), L__namespace.latLng(item.position.lat, item.position.lng)); | ||
} | ||
@@ -592,20 +615,20 @@ | ||
// [NSEW] decimal degrees | ||
return L.latLng((/N/i.test(match[1]) ? 1 : -1) * +match[2], (/E/i.test(match[3]) ? 1 : -1) * +match[4]); | ||
return L__namespace.latLng((/N/i.test(match[1]) ? 1 : -1) * +match[2], (/E/i.test(match[3]) ? 1 : -1) * +match[4]); | ||
} else if (match = query.match(/^(\d{1,3}(?:\.\d*)?)\s*([NS])\W*(\d{1,3}(?:\.\d*)?)\s*([EW])$/)) { | ||
// decimal degrees [NSEW] | ||
return L.latLng((/N/i.test(match[2]) ? 1 : -1) * +match[1], (/E/i.test(match[4]) ? 1 : -1) * +match[3]); | ||
return L__namespace.latLng((/N/i.test(match[2]) ? 1 : -1) * +match[1], (/E/i.test(match[4]) ? 1 : -1) * +match[3]); | ||
} else if (match = query.match(/^([NS])\s*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\W*([EW])\s*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?$/)) { | ||
// [NSEW] degrees, decimal minutes | ||
return L.latLng((/N/i.test(match[1]) ? 1 : -1) * (+match[2] + +match[3] / 60), (/E/i.test(match[4]) ? 1 : -1) * (+match[5] + +match[6] / 60)); | ||
return L__namespace.latLng((/N/i.test(match[1]) ? 1 : -1) * (+match[2] + +match[3] / 60), (/E/i.test(match[4]) ? 1 : -1) * (+match[5] + +match[6] / 60)); | ||
} else if (match = query.match(/^(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\s*([NS])\W*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\s*([EW])$/)) { | ||
// degrees, decimal minutes [NSEW] | ||
return L.latLng((/N/i.test(match[3]) ? 1 : -1) * (+match[1] + +match[2] / 60), (/E/i.test(match[6]) ? 1 : -1) * (+match[4] + +match[5] / 60)); | ||
return L__namespace.latLng((/N/i.test(match[3]) ? 1 : -1) * (+match[1] + +match[2] / 60), (/E/i.test(match[6]) ? 1 : -1) * (+match[4] + +match[5] / 60)); | ||
} else if (match = query.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*)?)?["″]?$/)) { | ||
// [NSEW] degrees, minutes, decimal seconds | ||
return L.latLng((/N/i.test(match[1]) ? 1 : -1) * (+match[2] + +match[3] / 60 + +match[4] / 3600), (/E/i.test(match[5]) ? 1 : -1) * (+match[6] + +match[7] / 60 + +match[8] / 3600)); | ||
return L__namespace.latLng((/N/i.test(match[1]) ? 1 : -1) * (+match[2] + +match[3] / 60 + +match[4] / 3600), (/E/i.test(match[5]) ? 1 : -1) * (+match[6] + +match[7] / 60 + +match[8] / 3600)); | ||
} else if (match = query.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])$/)) { | ||
// degrees, minutes, decimal seconds [NSEW] | ||
return L.latLng((/N/i.test(match[4]) ? 1 : -1) * (+match[1] + +match[2] / 60 + +match[3] / 3600), (/E/i.test(match[8]) ? 1 : -1) * (+match[5] + +match[6] / 60 + +match[7] / 3600)); | ||
return L__namespace.latLng((/N/i.test(match[4]) ? 1 : -1) * (+match[1] + +match[2] / 60 + +match[3] / 3600), (/E/i.test(match[8]) ? 1 : -1) * (+match[5] + +match[6] / 60 + +match[7] / 3600)); | ||
} else if (match = query.match(/^\s*([+-]?\d+(?:\.\d*)?)\s*[\s,]\s*([+-]?\d+(?:\.\d*)?)\s*$/)) { | ||
return L.latLng(+match[1], +match[2]); | ||
return L__namespace.latLng(+match[1], +match[2]); | ||
} | ||
@@ -623,3 +646,3 @@ } | ||
}; | ||
L.Util.setOptions(this, options); | ||
L__namespace.Util.setOptions(this, options); | ||
} | ||
@@ -664,3 +687,3 @@ | ||
}; | ||
L.Util.setOptions(this, options); | ||
L__namespace.Util.setOptions(this, options); | ||
} | ||
@@ -705,9 +728,9 @@ | ||
var loc = data.features[i]; | ||
var center = L.latLng(loc.center.reverse()); | ||
var center = L__namespace.latLng(loc.center.reverse()); | ||
var bbox = void 0; | ||
if (loc.bbox) { | ||
bbox = L.latLngBounds(L.latLng(loc.bbox.slice(0, 2).reverse()), L.latLng(loc.bbox.slice(2, 4).reverse())); | ||
bbox = L__namespace.latLngBounds(L__namespace.latLng(loc.bbox.slice(0, 2).reverse()), L__namespace.latLng(loc.bbox.slice(2, 4).reverse())); | ||
} else { | ||
bbox = L.latLngBounds(center, center); | ||
bbox = L__namespace.latLngBounds(center, center); | ||
} | ||
@@ -745,9 +768,9 @@ | ||
var loc = data.features[i]; | ||
var center = L.latLng(loc.center.reverse()); | ||
var center = L__namespace.latLng(loc.center.reverse()); | ||
var bbox = void 0; | ||
if (loc.bbox) { | ||
bbox = L.latLngBounds(L.latLng(loc.bbox.slice(0, 2).reverse()), L.latLng(loc.bbox.slice(2, 4).reverse())); | ||
bbox = L__namespace.latLngBounds(L__namespace.latLng(loc.bbox.slice(0, 2).reverse()), L__namespace.latLng(loc.bbox.slice(2, 4).reverse())); | ||
} else { | ||
bbox = L.latLngBounds(center, center); | ||
bbox = L__namespace.latLngBounds(center, center); | ||
} | ||
@@ -788,3 +811,3 @@ | ||
}; | ||
L.Util.setOptions(this, options); // MapQuest seems to provide URI encoded API keys, | ||
L__namespace.Util.setOptions(this, options); // MapQuest seems to provide URI encoded API keys, | ||
// so to avoid encoding them twice, we decode them here | ||
@@ -810,3 +833,3 @@ | ||
}); | ||
getJSON(this.options.serviceUrl + '/address', params, L.Util.bind(function (data) { | ||
getJSON(this.options.serviceUrl + '/address', params, L__namespace.Util.bind(function (data) { | ||
var results = []; | ||
@@ -817,6 +840,6 @@ | ||
var loc = data.results[0].locations[i]; | ||
var center = L.latLng(loc.latLng); | ||
var center = L__namespace.latLng(loc.latLng); | ||
results[i] = { | ||
name: this._formatName(loc.street, loc.adminArea4, loc.adminArea3, loc.adminArea1), | ||
bbox: L.latLngBounds(center, center), | ||
bbox: L__namespace.latLngBounds(center, center), | ||
center: center | ||
@@ -837,3 +860,3 @@ }; | ||
}); | ||
getJSON(this.options.serviceUrl + '/reverse', params, L.Util.bind(function (data) { | ||
getJSON(this.options.serviceUrl + '/reverse', params, L__namespace.Util.bind(function (data) { | ||
var results = []; | ||
@@ -844,6 +867,6 @@ | ||
var loc = data.results[0].locations[i]; | ||
var center = L.latLng(loc.latLng); | ||
var center = L__namespace.latLng(loc.latLng); | ||
results[i] = { | ||
name: this._formatName(loc.street, loc.adminArea4, loc.adminArea3, loc.adminArea1), | ||
bbox: L.latLngBounds(center, center), | ||
bbox: L__namespace.latLngBounds(center, center), | ||
center: center | ||
@@ -880,3 +903,3 @@ }; | ||
}; | ||
L.Util.setOptions(this, options); | ||
L__namespace.Util.setOptions(this, options); | ||
} // https://www.neutrinoapi.com/api/geocode-address/ | ||
@@ -899,4 +922,4 @@ | ||
data.geometry = data.locations[0]; | ||
var center = L.latLng(data.geometry['latitude'], data.geometry['longitude']); | ||
var bbox = L.latLngBounds(center, center); | ||
var center = L__namespace.latLng(data.geometry['latitude'], data.geometry['longitude']); | ||
var bbox = L__namespace.latLngBounds(center, center); | ||
results[0] = { | ||
@@ -929,4 +952,4 @@ name: data.geometry.address, | ||
if (data.status.status == 200 && data.found) { | ||
var center = L.latLng(location.lat, location.lng); | ||
var bbox = L.latLngBounds(center, center); | ||
var center = L__namespace.latLng(location.lat, location.lng); | ||
var bbox = L__namespace.latLngBounds(center, center); | ||
results[0] = { | ||
@@ -988,3 +1011,3 @@ name: data.address, | ||
}; | ||
L.Util.setOptions(this, options || {}); | ||
L__namespace.Util.setOptions(this, options || {}); | ||
} | ||
@@ -1017,4 +1040,4 @@ | ||
html: _this.options.htmlTemplate ? _this.options.htmlTemplate(data[i]) : undefined, | ||
bbox: L.latLngBounds([bbox[0], bbox[2]], [bbox[1], bbox[3]]), | ||
center: L.latLng(data[i].lat, data[i].lon), | ||
bbox: L__namespace.latLngBounds([bbox[0], bbox[2]], [bbox[1], bbox[3]]), | ||
center: L__namespace.latLng(data[i].lat, data[i].lon), | ||
properties: data[i] | ||
@@ -1042,4 +1065,4 @@ }; | ||
if (data && data.lat && data.lon) { | ||
var center = L.latLng(data.lat, data.lon); | ||
var bbox = L.latLngBounds(center, center); | ||
var center = L__namespace.latLng(data.lat, data.lon); | ||
var bbox = L__namespace.latLngBounds(center, center); | ||
result.push({ | ||
@@ -1075,3 +1098,3 @@ name: data.display_name, | ||
function OpenLocationCode(options) { | ||
L.Util.setOptions(this, options); | ||
L__namespace.Util.setOptions(this, options); | ||
} | ||
@@ -1086,4 +1109,4 @@ | ||
name: query, | ||
center: L.latLng(decoded.latitudeCenter, decoded.longitudeCenter), | ||
bbox: L.latLngBounds(L.latLng(decoded.latitudeLo, decoded.longitudeLo), L.latLng(decoded.latitudeHi, decoded.longitudeHi)) | ||
center: L__namespace.latLng(decoded.latitudeCenter, decoded.longitudeCenter), | ||
bbox: L__namespace.latLngBounds(L__namespace.latLng(decoded.latitudeLo, decoded.longitudeLo), L__namespace.latLng(decoded.latitudeHi, decoded.longitudeHi)) | ||
}; | ||
@@ -1103,4 +1126,4 @@ cb.call(context, [result]); | ||
name: code, | ||
center: L.latLng(location.lat, location.lng), | ||
bbox: L.latLngBounds(L.latLng(location.lat, location.lng), L.latLng(location.lat, location.lng)) | ||
center: L__namespace.latLng(location.lat, location.lng), | ||
bbox: L__namespace.latLngBounds(L__namespace.latLng(location.lat, location.lng), L__namespace.latLng(location.lat, location.lng)) | ||
}; | ||
@@ -1135,3 +1158,3 @@ cb.call(context, [result]); | ||
}; | ||
L.Util.setOptions(this, options); | ||
L__namespace.Util.setOptions(this, options); | ||
} | ||
@@ -1152,9 +1175,9 @@ | ||
var loc = data.results[i]; | ||
var center = L.latLng(loc.geometry); | ||
var center = L__namespace.latLng(loc.geometry); | ||
var bbox = void 0; | ||
if (loc.annotations && loc.annotations.bounds) { | ||
bbox = L.latLngBounds(L.latLng(loc.annotations.bounds.northeast), L.latLng(loc.annotations.bounds.southwest)); | ||
bbox = L__namespace.latLngBounds(L__namespace.latLng(loc.annotations.bounds.northeast), L__namespace.latLng(loc.annotations.bounds.southwest)); | ||
} else { | ||
bbox = L.latLngBounds(center, center); | ||
bbox = L__namespace.latLngBounds(center, center); | ||
} | ||
@@ -1189,9 +1212,9 @@ | ||
var loc = data.results[i]; | ||
var center = L.latLng(loc.geometry); | ||
var center = L__namespace.latLng(loc.geometry); | ||
var bbox = void 0; | ||
if (loc.annotations && loc.annotations.bounds) { | ||
bbox = L.latLngBounds(L.latLng(loc.annotations.bounds.northeast), L.latLng(loc.annotations.bounds.southwest)); | ||
bbox = L__namespace.latLngBounds(L__namespace.latLng(loc.annotations.bounds.northeast), L__namespace.latLng(loc.annotations.bounds.southwest)); | ||
} else { | ||
bbox = L.latLngBounds(center, center); | ||
bbox = L__namespace.latLngBounds(center, center); | ||
} | ||
@@ -1227,3 +1250,3 @@ | ||
this._lastSuggest = 0; | ||
L.Util.setOptions(this, options); | ||
L__namespace.Util.setOptions(this, options); | ||
} | ||
@@ -1275,5 +1298,5 @@ | ||
var results = []; | ||
L.geoJSON(data, { | ||
L__namespace.geoJSON(data, { | ||
pointToLayer: function pointToLayer(feature, latlng) { | ||
return L.circleMarker(latlng); | ||
return L__namespace.circleMarker(latlng); | ||
}, | ||
@@ -1290,6 +1313,6 @@ onEachFeature: function onEachFeature(feature, layer) { | ||
center = layer.getLatLng(); | ||
bbox = L.latLngBounds(L.GeoJSON.coordsToLatLng(layer.feature.bbox.slice(0, 2)), L.GeoJSON.coordsToLatLng(layer.feature.bbox.slice(2, 4))); | ||
bbox = L__namespace.latLngBounds(L__namespace.GeoJSON.coordsToLatLng(layer.feature.bbox.slice(0, 2)), L__namespace.GeoJSON.coordsToLatLng(layer.feature.bbox.slice(2, 4))); | ||
} else { | ||
center = layer.getLatLng(); | ||
bbox = L.latLngBounds(center, center); | ||
bbox = L__namespace.latLngBounds(center, center); | ||
} | ||
@@ -1339,3 +1362,3 @@ | ||
function Openrouteservice(options) { | ||
return _Pelias.call(this, L.Util.extend({ | ||
return _Pelias.call(this, L__namespace.Util.extend({ | ||
serviceUrl: 'https://api.openrouteservice.org/geocode' | ||
@@ -1367,3 +1390,3 @@ }, options)) || this; | ||
}; | ||
L.Util.setOptions(this, options); | ||
L__namespace.Util.setOptions(this, options); | ||
} | ||
@@ -1377,3 +1400,3 @@ | ||
}); | ||
getJSON(this.options.serviceUrl, params, L.Util.bind(function (data) { | ||
getJSON(this.options.serviceUrl, params, L__namespace.Util.bind(function (data) { | ||
cb.call(context, this._decodeFeatures(data)); | ||
@@ -1392,3 +1415,3 @@ }, this)); | ||
}); | ||
getJSON(this.options.reverseUrl, params, L.Util.bind(function (data) { | ||
getJSON(this.options.reverseUrl, params, L__namespace.Util.bind(function (data) { | ||
cb.call(context, this._decodeFeatures(data)); | ||
@@ -1405,5 +1428,5 @@ }, this)); | ||
var c = f.geometry.coordinates; | ||
var center = L.latLng(c[1], c[0]); | ||
var center = L__namespace.latLng(c[1], c[0]); | ||
var extent = f.properties.extent; | ||
var bbox = extent ? L.latLngBounds([extent[1], extent[0]], [extent[3], extent[2]]) : L.latLngBounds(center, center); | ||
var bbox = extent ? L__namespace.latLngBounds([extent[1], extent[0]], [extent[3], extent[2]]) : L__namespace.latLngBounds(center, center); | ||
results.push({ | ||
@@ -1450,3 +1473,3 @@ name: this._decodeFeatureName(f), | ||
}; | ||
L.Util.setOptions(this, options); | ||
L__namespace.Util.setOptions(this, options); | ||
} | ||
@@ -1465,4 +1488,4 @@ | ||
if (data.geometry) { | ||
var latLng = L.latLng(data.geometry['lat'], data.geometry['lng']); | ||
var latLngBounds = L.latLngBounds(latLng, latLng); | ||
var latLng = L__namespace.latLng(data.geometry['lat'], data.geometry['lng']); | ||
var latLngBounds = L__namespace.latLngBounds(latLng, latLng); | ||
results[0] = { | ||
@@ -1491,4 +1514,4 @@ name: data.words, | ||
if (data.status.status == 200) { | ||
var center = L.latLng(data.geometry['lat'], data.geometry['lng']); | ||
var bbox = L.latLngBounds(center, center); | ||
var center = L__namespace.latLng(data.geometry['lat'], data.geometry['lng']); | ||
var bbox = L__namespace.latLngBounds(center, center); | ||
results[0] = { | ||
@@ -1516,4 +1539,2 @@ name: data.words, | ||
var geocoders = { | ||
@@ -1571,4 +1592,4 @@ __proto__: null, | ||
L.Util.extend(EventedControl.prototype, L.Control.prototype); | ||
L.Util.extend(EventedControl.prototype, L.Evented.prototype); | ||
L__namespace.Util.extend(EventedControl.prototype, L__namespace.Control.prototype); | ||
L__namespace.Util.extend(EventedControl.prototype, L__namespace.Evented.prototype); | ||
/** | ||
@@ -1605,3 +1626,3 @@ * This is the geocoder control. It works like any other [Leaflet control](https://leafletjs.com/reference.html#control), and is added to the map. | ||
_this._requestCount = 0; | ||
L.Util.setOptions(_assertThisInitialized(_this), options); | ||
L__namespace.Util.setOptions(_assertThisInitialized(_this), options); | ||
@@ -1618,7 +1639,7 @@ if (!_this.options.geocoder) { | ||
_proto.addThrobberClass = function addThrobberClass() { | ||
L.DomUtil.addClass(this._container, 'leaflet-control-geocoder-throbber'); | ||
L__namespace.DomUtil.addClass(this._container, 'leaflet-control-geocoder-throbber'); | ||
}; | ||
_proto.removeThrobberClass = function removeThrobberClass() { | ||
L.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-throbber'); | ||
L__namespace.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-throbber'); | ||
} | ||
@@ -1636,5 +1657,5 @@ /** | ||
var className = 'leaflet-control-geocoder'; | ||
var container = L.DomUtil.create('div', className + ' leaflet-bar'); | ||
var icon = L.DomUtil.create('button', className + '-icon', container); | ||
var form = this._form = L.DomUtil.create('div', className + '-form', container); | ||
var container = L__namespace.DomUtil.create('div', className + ' leaflet-bar'); | ||
var icon = L__namespace.DomUtil.create('button', className + '-icon', container); | ||
var form = this._form = L__namespace.DomUtil.create('div', className + '-form', container); | ||
this._map = map; | ||
@@ -1645,18 +1666,18 @@ this._container = container; | ||
icon.setAttribute('aria-label', this.options.iconLabel); | ||
var input = this._input = L.DomUtil.create('input', '', form); | ||
var input = this._input = L__namespace.DomUtil.create('input', '', form); | ||
input.type = 'text'; | ||
input.value = this.options.query; | ||
input.placeholder = this.options.placeholder; | ||
L.DomEvent.disableClickPropagation(input); | ||
this._errorElement = L.DomUtil.create('div', className + '-form-no-error', container); | ||
L__namespace.DomEvent.disableClickPropagation(input); | ||
this._errorElement = L__namespace.DomUtil.create('div', className + '-form-no-error', container); | ||
this._errorElement.innerHTML = this.options.errorMessage; | ||
this._alts = L.DomUtil.create('ul', className + '-alternatives leaflet-control-geocoder-alternatives-minimized', container); | ||
L.DomEvent.disableClickPropagation(this._alts); | ||
L.DomEvent.addListener(input, 'keydown', this._keydown, this); | ||
this._alts = L__namespace.DomUtil.create('ul', className + '-alternatives leaflet-control-geocoder-alternatives-minimized', container); | ||
L__namespace.DomEvent.disableClickPropagation(this._alts); | ||
L__namespace.DomEvent.addListener(input, 'keydown', this._keydown, this); | ||
if (this.options.geocoder.suggest) { | ||
L.DomEvent.addListener(input, 'input', this._change, this); | ||
L__namespace.DomEvent.addListener(input, 'input', this._change, this); | ||
} | ||
L.DomEvent.addListener(input, 'blur', function () { | ||
L__namespace.DomEvent.addListener(input, 'blur', function () { | ||
if (_this2.options.collapsed && !_this2._preventBlurCollapse) { | ||
@@ -1671,3 +1692,3 @@ _this2._collapse(); | ||
if (this.options.expand === 'click') { | ||
L.DomEvent.addListener(container, 'click', function (e) { | ||
L__namespace.DomEvent.addListener(container, 'click', function (e) { | ||
if (e.button === 0 && e.detail !== 2) { | ||
@@ -1678,3 +1699,3 @@ _this2._toggle(); | ||
} else if (this.options.expand === 'touch') { | ||
L.DomEvent.addListener(container, L.Browser.touch ? 'touchstart mousedown' : 'mousedown', function (e) { | ||
L__namespace.DomEvent.addListener(container, L__namespace.Browser.touch ? 'touchstart mousedown' : 'mousedown', function (e) { | ||
_this2._toggle(); | ||
@@ -1687,4 +1708,4 @@ | ||
} else { | ||
L.DomEvent.addListener(container, 'mouseover', this._expand, this); | ||
L.DomEvent.addListener(container, 'mouseout', this._collapse, this); | ||
L__namespace.DomEvent.addListener(container, 'mouseover', this._expand, this); | ||
L__namespace.DomEvent.addListener(container, 'mouseout', this._collapse, this); | ||
@@ -1696,8 +1717,8 @@ this._map.on('movestart', this._collapse, this); | ||
if (L.Browser.touch) { | ||
L.DomEvent.addListener(container, 'touchstart', function () { | ||
if (L__namespace.Browser.touch) { | ||
L__namespace.DomEvent.addListener(container, 'touchstart', function () { | ||
return _this2._geocode(); | ||
}); | ||
} else { | ||
L.DomEvent.addListener(container, 'click', function () { | ||
L__namespace.DomEvent.addListener(container, 'click', function () { | ||
return _this2._geocode(); | ||
@@ -1716,3 +1737,3 @@ }); | ||
this.on('finishsuggest', this.removeThrobberClass, this); | ||
L.DomEvent.disableClickPropagation(container); | ||
L__namespace.DomEvent.disableClickPropagation(container); | ||
return container; | ||
@@ -1737,4 +1758,4 @@ } | ||
this._results = results; | ||
L.DomUtil.removeClass(this._alts, 'leaflet-control-geocoder-alternatives-minimized'); | ||
L.DomUtil.addClass(this._container, 'leaflet-control-geocoder-options-open'); | ||
L__namespace.DomUtil.removeClass(this._alts, 'leaflet-control-geocoder-alternatives-minimized'); | ||
L__namespace.DomUtil.addClass(this._container, 'leaflet-control-geocoder-options-open'); | ||
@@ -1745,4 +1766,4 @@ for (var i = 0; i < results.length; i++) { | ||
} else { | ||
L.DomUtil.addClass(this._container, 'leaflet-control-geocoder-options-error'); | ||
L.DomUtil.addClass(this._errorElement, 'leaflet-control-geocoder-error'); | ||
L__namespace.DomUtil.addClass(this._container, 'leaflet-control-geocoder-options-error'); | ||
L__namespace.DomUtil.addClass(this._errorElement, 'leaflet-control-geocoder-error'); | ||
} | ||
@@ -1765,3 +1786,3 @@ } | ||
this._geocodeMarker = new L.Marker(result.center).bindPopup(result.html || result.name).addTo(this._map).openPopup(); | ||
this._geocodeMarker = new L__namespace.Marker(result.center).bindPopup(result.html || result.name).addTo(this._map).openPopup(); | ||
return this; | ||
@@ -1820,3 +1841,3 @@ }; | ||
_proto._toggle = function _toggle() { | ||
if (L.DomUtil.hasClass(this._container, 'leaflet-control-geocoder-expanded')) { | ||
if (L__namespace.DomUtil.hasClass(this._container, 'leaflet-control-geocoder-expanded')) { | ||
this._collapse(); | ||
@@ -1829,3 +1850,3 @@ } else { | ||
_proto._expand = function _expand() { | ||
L.DomUtil.addClass(this._container, 'leaflet-control-geocoder-expanded'); | ||
L__namespace.DomUtil.addClass(this._container, 'leaflet-control-geocoder-expanded'); | ||
@@ -1838,7 +1859,7 @@ this._input.select(); | ||
_proto._collapse = function _collapse() { | ||
L.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-expanded'); | ||
L.DomUtil.addClass(this._alts, 'leaflet-control-geocoder-alternatives-minimized'); | ||
L.DomUtil.removeClass(this._errorElement, 'leaflet-control-geocoder-error'); | ||
L.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-options-open'); | ||
L.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-options-error'); | ||
L__namespace.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-expanded'); | ||
L__namespace.DomUtil.addClass(this._alts, 'leaflet-control-geocoder-alternatives-minimized'); | ||
L__namespace.DomUtil.removeClass(this._errorElement, 'leaflet-control-geocoder-error'); | ||
L__namespace.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-options-open'); | ||
L__namespace.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-options-error'); | ||
@@ -1852,7 +1873,7 @@ this._input.blur(); // mobile: keyboard shouldn't stay expanded | ||
_proto._clearResults = function _clearResults() { | ||
L.DomUtil.addClass(this._alts, 'leaflet-control-geocoder-alternatives-minimized'); | ||
L__namespace.DomUtil.addClass(this._alts, 'leaflet-control-geocoder-alternatives-minimized'); | ||
this._selection = null; | ||
L.DomUtil.removeClass(this._errorElement, 'leaflet-control-geocoder-error'); | ||
L.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-options-open'); | ||
L.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-options-error'); | ||
L__namespace.DomUtil.removeClass(this._errorElement, 'leaflet-control-geocoder-error'); | ||
L__namespace.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-options-open'); | ||
L__namespace.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-options-error'); | ||
}; | ||
@@ -1863,5 +1884,5 @@ | ||
var li = L.DomUtil.create('li', ''), | ||
a = L.DomUtil.create('a', '', li), | ||
icon = this.options.showResultIcons && result.icon ? L.DomUtil.create('img', '', a) : null, | ||
var li = L__namespace.DomUtil.create('li', ''), | ||
a = L__namespace.DomUtil.create('a', '', li), | ||
icon = this.options.showResultIcons && result.icon ? L__namespace.DomUtil.create('img', '', a) : null, | ||
text = result.html ? undefined : document.createTextNode(result.name), | ||
@@ -1875,7 +1896,7 @@ mouseDownHandler = function mouseDownHandler(e) { | ||
_this4._preventBlurCollapse = true; | ||
L.DomEvent.stop(e); | ||
L__namespace.DomEvent.stop(e); | ||
_this4._geocodeResultSelected(result); | ||
L.DomEvent.on(li, 'click touchend', function () { | ||
L__namespace.DomEvent.on(li, 'click touchend', function () { | ||
if (_this4.options.collapsed) { | ||
@@ -1904,3 +1925,3 @@ _this4._collapse(); | ||
L.DomEvent.addListener(li, 'mousedown touchstart', mouseDownHandler, this); | ||
L__namespace.DomEvent.addListener(li, 'mousedown touchstart', mouseDownHandler, this); | ||
return li; | ||
@@ -1914,3 +1935,3 @@ }; | ||
if (_this5._selection) { | ||
L.DomUtil.removeClass(_this5._selection, 'leaflet-control-geocoder-selected'); | ||
L__namespace.DomUtil.removeClass(_this5._selection, 'leaflet-control-geocoder-selected'); | ||
_this5._selection = _this5._selection[dir > 0 ? 'nextSibling' : 'previousSibling']; | ||
@@ -1924,3 +1945,3 @@ } | ||
if (_this5._selection) { | ||
L.DomUtil.addClass(_this5._selection, 'leaflet-control-geocoder-selected'); | ||
L__namespace.DomUtil.addClass(_this5._selection, 'leaflet-control-geocoder-selected'); | ||
} | ||
@@ -1968,3 +1989,3 @@ }; | ||
L.DomEvent.preventDefault(e); | ||
L__namespace.DomEvent.preventDefault(e); | ||
}; | ||
@@ -2009,4 +2030,4 @@ | ||
*/ | ||
L.Util.extend(GeocoderControl, geocoders); | ||
L.Util.extend(L.Control, { | ||
L__namespace.Util.extend(GeocoderControl, geocoders); | ||
L__namespace.Util.extend(L__namespace.Control, { | ||
Geocoder: GeocoderControl, | ||
@@ -2013,0 +2034,0 @@ geocoder: geocoder |
@@ -1,2 +0,2 @@ | ||
var leafletControlGeocoder=function(t){function e(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}function o(e,o){return t.Util.extend(o,e.geocodingQueryParams)}function n(e,o){return t.Util.extend(o,e.reverseQueryParams)}var s=0,i=/[&<>"'`]/g,r=/[&<>"'`]/,a={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"};function l(t){return a[t]}function c(e,o,n,i,r){var a="_l_geocoder_"+s++;o[r||"callback"]=a,window[a]=t.Util.bind(n,i);var l=document.createElement("script");l.type="text/javascript",l.src=e+u(o),l.id=a,document.getElementsByTagName("head")[0].appendChild(l)}function p(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+u(e),!0),n.responseType="json",n.setRequestHeader("Accept","application/json"),n.send(null)}function u(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 d=function(){function e(e){this.options={serviceUrl:"https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer",apiKey:""},t.Util.setOptions(this,e)}var s=e.prototype;return s.geocode=function(e,n,s){var i=o(this.options,{token:this.options.apiKey,SingleLine:e,outFields:"Addr_Type",forStorage:!1,maxLocations:10,f:"json"});p(this.options.serviceUrl+"/findAddressCandidates",i,function(e){var o=[];if(e.candidates&&e.candidates.length)for(var i=0;i<=e.candidates.length-1;i++){var r=e.candidates[i],a=t.latLng(r.location.y,r.location.x),l=t.latLngBounds(t.latLng(r.extent.ymax,r.extent.xmax),t.latLng(r.extent.ymin,r.extent.xmin));o[i]={name:r.address,bbox:l,center:a}}n.call(s,o)})},s.suggest=function(t,e,o){return this.geocode(t,e,o)},s.reverse=function(e,o,s,i){var r=n(this.options,{location:e.lng+","+e.lat,distance:100,f:"json"});p(this.options.serviceUrl+"/reverseGeocode",r,function(e){var o=[];if(e&&!e.error){var n=t.latLng(e.location.y,e.location.x),r=t.latLngBounds(n,n);o.push({name:e.address.Match_addr,center:n,bbox:r})}s.call(i,o)})},e}(),h=function(){function e(e){this.options={serviceUrl:"https://dev.virtualearth.net/REST/v1/Locations"},t.Util.setOptions(this,e)}var s=e.prototype;return s.geocode=function(e,n,s){var i=o(this.options,{query:e,key:this.options.apiKey});c(this.options.apiKey,i,function(e){var o=[];if(e.resourceSets.length>0)for(var i=e.resourceSets[0].resources.length-1;i>=0;i--){var r=e.resourceSets[0].resources[i],a=r.bbox;o[i]={name:r.name,bbox:t.latLngBounds([a[0],a[1]],[a[2],a[3]]),center:t.latLng(r.point.coordinates)}}n.call(s,o)},this,"jsonp")},s.reverse=function(e,o,s,i){var r=n(this.options,{key:this.options.apiKey});c(this.options.serviceUrl+e.lat+","+e.lng,r,function(e){for(var o=[],n=e.resourceSets[0].resources.length-1;n>=0;n--){var r=e.resourceSets[0].resources[n],a=r.bbox;o[n]={name:r.name,bbox:t.latLngBounds([a[0],a[1]],[a[2],a[3]]),center:t.latLng(r.point.coordinates)}}s.call(i,o)},this,"jsonp")},e}(),g=function(){function e(e){this.options={serviceUrl:"https://maps.googleapis.com/maps/api/geocode/json"},t.Util.setOptions(this,e)}var s=e.prototype;return s.geocode=function(e,n,s){var i=o(this.options,{key:this.options.apiKey,address:e});p(this.options.serviceUrl,i,function(e){var o=[];if(e.results&&e.results.length)for(var i=0;i<=e.results.length-1;i++){var r=e.results[i],a=t.latLng(r.geometry.location),l=t.latLngBounds(t.latLng(r.geometry.viewport.northeast),t.latLng(r.geometry.viewport.southwest));o[i]={name:r.formatted_address,bbox:l,center:a,properties:r.address_components}}n.call(s,o)})},s.reverse=function(e,o,s,i){var r=n(this.options,{key:this.options.apiKey,latlng:e.lat+","+e.lng});p(this.options.serviceUrl,r,function(e){var o=[];if(e.results&&e.results.length)for(var n=0;n<=e.results.length-1;n++){var r=e.results[n],a=t.latLng(r.geometry.location),l=t.latLngBounds(t.latLng(r.geometry.viewport.northeast),t.latLng(r.geometry.viewport.southwest));o[n]={name:r.formatted_address,bbox:l,center:a,properties:r.address_components}}s.call(i,o)})},e}(),f=function(){function e(e){if(this.options={serviceUrl:"https://geocoder.api.here.com/6.2/",app_id:"",app_code:"",apiKey:"",maxResults:5},t.Util.setOptions(this,e),e.apiKey)throw Error("apiKey is not supported, use app_id/app_code instead!")}var s=e.prototype;return s.geocode=function(t,e,n){var s=o(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",s,e,n)},s.reverse=function(t,e,o,s){var i=t.lat+","+t.lng;this.options.reverseGeocodeProxRadius&&(i+=","+this.options.reverseGeocodeProxRadius);var r=n(this.options,{prox:i,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,s)},s.getJSON=function(e,o,n,s){p(e,o,function(e){var o=[];if(e.response.view&&e.response.view.length)for(var i=0;i<=e.response.view[0].result.length-1;i++){var r=e.response.view[0].result[i].location,a=t.latLng(r.displayPosition.latitude,r.displayPosition.longitude),l=t.latLngBounds(t.latLng(r.mapView.topLeft.latitude,r.mapView.topLeft.longitude),t.latLng(r.mapView.bottomRight.latitude,r.mapView.bottomRight.longitude));o[i]={name:r.address.label,properties:r.address,bbox:l,center:a}}n.call(s,o)})},e}(),v=function(){function e(e){this.options={serviceUrl:"https://geocode.search.hereapi.com/v1",apiKey:"",app_id:"",app_code:"",maxResults:10},t.Util.setOptions(this,e)}var s=e.prototype;return s.geocode=function(t,e,n){var s=o(this.options,{q:t,apiKey:this.options.apiKey,limit:this.options.maxResults});if(!s.at&&!s.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",s,e,n)},s.reverse=function(t,e,o,s){var i=n(this.options,{at:t.lat+","+t.lng,limit:this.options.reverseGeocodeProxRadius,apiKey:this.options.apiKey});this.getJSON(this.options.serviceUrl+"/revgeocode",i,o,s)},s.getJSON=function(e,o,n,s){p(e,o,function(e){var o=[];if(e.items&&e.items.length)for(var i=0;i<=e.items.length-1;i++){var r,a=e.items[i],l=t.latLng(a.position.lat,a.position.lng);r=a.mapView?t.latLngBounds(t.latLng(a.mapView.south,a.mapView.west),t.latLng(a.mapView.north,a.mapView.east)):t.latLngBounds(t.latLng(a.position.lat,a.position.lng),t.latLng(a.position.lat,a.position.lng)),o[i]={name:a.address.label,properties:a.address,bbox:r,center:l}}n.call(s,o)})},e}();function m(e){var o;return(o=e.match(/^([NS])\s*(\d{1,3}(?:\.\d*)?)\W*([EW])\s*(\d{1,3}(?:\.\d*)?)$/))?t.latLng((/N/i.test(o[1])?1:-1)*+o[2],(/E/i.test(o[3])?1:-1)*+o[4]):(o=e.match(/^(\d{1,3}(?:\.\d*)?)\s*([NS])\W*(\d{1,3}(?:\.\d*)?)\s*([EW])$/))?t.latLng((/N/i.test(o[2])?1:-1)*+o[1],(/E/i.test(o[4])?1:-1)*+o[3]):(o=e.match(/^([NS])\s*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\W*([EW])\s*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?$/))?t.latLng((/N/i.test(o[1])?1:-1)*(+o[2]+ +o[3]/60),(/E/i.test(o[4])?1:-1)*(+o[5]+ +o[6]/60)):(o=e.match(/^(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\s*([NS])\W*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\s*([EW])$/))?t.latLng((/N/i.test(o[3])?1:-1)*(+o[1]+ +o[2]/60),(/E/i.test(o[6])?1:-1)*(+o[4]+ +o[5]/60)):(o=e.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*)?)?["″]?$/))?t.latLng((/N/i.test(o[1])?1:-1)*(+o[2]+ +o[3]/60+ +o[4]/3600),(/E/i.test(o[5])?1:-1)*(+o[6]+ +o[7]/60+ +o[8]/3600)):(o=e.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])$/))?t.latLng((/N/i.test(o[4])?1:-1)*(+o[1]+ +o[2]/60+ +o[3]/3600),(/E/i.test(o[8])?1:-1)*(+o[5]+ +o[6]/60+ +o[7]/3600)):(o=e.match(/^\s*([+-]?\d+(?:\.\d*)?)\s*[\s,]\s*([+-]?\d+(?:\.\d*)?)\s*$/))?t.latLng(+o[1],+o[2]):void 0}var _=function(){function e(e){this.options={next:void 0,sizeInMeters:1e4},t.Util.setOptions(this,e)}return e.prototype.geocode=function(t,e,o){var n=m(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)},e}(),b=function(){function e(e){this.options={serviceUrl:"https://api.mapbox.com/geocoding/v5/mapbox.places/"},t.Util.setOptions(this,e)}var s=e.prototype;return s._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},s.geocode=function(e,n,s){var i=this,r=o(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),p(this.options.serviceUrl+encodeURIComponent(e)+".json",r,function(e){var o=[];if(e.features&&e.features.length)for(var r=0;r<=e.features.length-1;r++){var a,l=e.features[r],c=t.latLng(l.center.reverse());a=l.bbox?t.latLngBounds(t.latLng(l.bbox.slice(0,2).reverse()),t.latLng(l.bbox.slice(2,4).reverse())):t.latLngBounds(c,c),o[r]={name:l.place_name,bbox:a,center:c,properties:i._getProperties(l)}}n.call(s,o)})},s.suggest=function(t,e,o){return this.geocode(t,e,o)},s.reverse=function(e,o,s,i){var r=this;p(this.options.serviceUrl+e.lng+","+e.lat+".json",n(this.options,{access_token:this.options.apiKey}),function(e){var o=[];if(e.features&&e.features.length)for(var n=0;n<=e.features.length-1;n++){var a,l=e.features[n],c=t.latLng(l.center.reverse());a=l.bbox?t.latLngBounds(t.latLng(l.bbox.slice(0,2).reverse()),t.latLng(l.bbox.slice(2,4).reverse())):t.latLngBounds(c,c),o[n]={name:l.place_name,bbox:a,center:c,properties:r._getProperties(l)}}s.call(i,o)})},e}(),y=function(){function e(e){this.options={serviceUrl:"https://www.mapquestapi.com/geocoding/v1"},t.Util.setOptions(this,e),this.options.apiKey=decodeURIComponent(this.options.apiKey)}var s=e.prototype;return s._formatName=function(){return[].slice.call(arguments).filter(function(t){return!!t}).join(", ")},s.geocode=function(e,n,s){var i=o(this.options,{key:this.options.apiKey,location:e,limit:5,outFormat:"json"});p(this.options.serviceUrl+"/address",i,t.Util.bind(function(e){var o=[];if(e.results&&e.results[0].locations)for(var i=e.results[0].locations.length-1;i>=0;i--){var r=e.results[0].locations[i],a=t.latLng(r.latLng);o[i]={name:this._formatName(r.street,r.adminArea4,r.adminArea3,r.adminArea1),bbox:t.latLngBounds(a,a),center:a}}n.call(s,o)},this))},s.reverse=function(e,o,s,i){var r=n(this.options,{key:this.options.apiKey,location:e.lat+","+e.lng,outputFormat:"json"});p(this.options.serviceUrl+"/reverse",r,t.Util.bind(function(e){var o=[];if(e.results&&e.results[0].locations)for(var n=e.results[0].locations.length-1;n>=0;n--){var r=e.results[0].locations[n],a=t.latLng(r.latLng);o[n]={name:this._formatName(r.street,r.adminArea4,r.adminArea3,r.adminArea1),bbox:t.latLngBounds(a,a),center:a}}s.call(i,o)},this))},e}(),L=function(){function e(e){this.options={userId:void 0,apiKey:void 0,serviceUrl:"https://neutrinoapi.com/"},t.Util.setOptions(this,e)}var s=e.prototype;return s.geocode=function(e,n,s){var i=o(this.options,{apiKey:this.options.apiKey,userId:this.options.userId,address:e.split(/\s+/).join(".")});p(this.options.serviceUrl+"geocode-address",i,function(e){var o=[];if(e.locations){e.geometry=e.locations[0];var i=t.latLng(e.geometry.latitude,e.geometry.longitude),r=t.latLngBounds(i,i);o[0]={name:e.geometry.address,bbox:r,center:i}}n.call(s,o)})},s.suggest=function(t,e,o){return this.geocode(t,e,o)},s.reverse=function(e,o,s,i){var r=n(this.options,{apiKey:this.options.apiKey,userId:this.options.userId,latitude:e.lat,longitude:e.lng});p(this.options.serviceUrl+"geocode-reverse",r,function(o){var n=[];if(200==o.status.status&&o.found){var r=t.latLng(e.lat,e.lng),a=t.latLngBounds(r,r);n[0]={name:o.address,bbox:a,center:r}}s.call(i,n)})},e}(),x=function(){function e(e){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?r.test(n=""+n)?n.replace(i,l):n:n+""})}},t.Util.setOptions(this,e||{})}var s=e.prototype;return s.geocode=function(e,n,s){var i=this,r=o(this.options,{q:e,limit:5,format:"json",addressdetails:1});p(this.options.serviceUrl+"search",r,function(e){for(var o=[],r=e.length-1;r>=0;r--){for(var a=e[r].boundingbox,l=0;l<4;l++)a[l]=+a[l];o[r]={icon:e[r].icon,name:e[r].display_name,html:i.options.htmlTemplate?i.options.htmlTemplate(e[r]):void 0,bbox:t.latLngBounds([a[0],a[2]],[a[1],a[3]]),center:t.latLng(e[r].lat,e[r].lon),properties:e[r]}}n.call(s,o)})},s.reverse=function(e,o,s,i){var r=this,a=n(this.options,{lat:e.lat,lon:e.lng,zoom:Math.round(Math.log(o/256)/Math.log(2)),addressdetails:1,format:"json"});p(this.options.serviceUrl+"reverse",a,function(e){var o=[];if(e&&e.lat&&e.lon){var n=t.latLng(e.lat,e.lon),a=t.latLngBounds(n,n);o.push({name:e.display_name,html:r.options.htmlTemplate?r.options.htmlTemplate(e):void 0,center:n,bbox:a,properties:e})}s.call(i,o)})},e}(),U=function(){function e(e){t.Util.setOptions(this,e)}var o=e.prototype;return o.geocode=function(e,o,n){try{var s=this.options.OpenLocationCode.decode(e),i={name:e,center:t.latLng(s.latitudeCenter,s.longitudeCenter),bbox:t.latLngBounds(t.latLng(s.latitudeLo,s.longitudeLo),t.latLng(s.latitudeHi,s.longitudeHi))};o.call(n,[i])}catch(t){console.warn(t),o.call(n,[])}},o.reverse=function(e,o,n,s){try{var i={name:this.options.OpenLocationCode.encode(e.lat,e.lng,this.options.codeLength),center:t.latLng(e.lat,e.lng),bbox:t.latLngBounds(t.latLng(e.lat,e.lng),t.latLng(e.lat,e.lng))};n.call(s,[i])}catch(t){console.warn(t),n.call(s,[])}},e}(),w=function(){function e(e){this.options={serviceUrl:"https://api.opencagedata.com/geocode/v1/json"},t.Util.setOptions(this,e)}var s=e.prototype;return s.geocode=function(e,n,s){var i=o(this.options,{key:this.options.apiKey,q:e});p(this.options.serviceUrl,i,function(e){var o=[];if(e.results&&e.results.length)for(var i=0;i<e.results.length;i++){var r,a=e.results[i],l=t.latLng(a.geometry);r=a.annotations&&a.annotations.bounds?t.latLngBounds(t.latLng(a.annotations.bounds.northeast),t.latLng(a.annotations.bounds.southwest)):t.latLngBounds(l,l),o.push({name:a.formatted,bbox:r,center:l})}n.call(s,o)})},s.suggest=function(t,e,o){return this.geocode(t,e,o)},s.reverse=function(e,o,s,i){var r=n(this.options,{key:this.options.apiKey,q:[e.lat,e.lng].join(",")});p(this.options.serviceUrl,r,function(e){var o=[];if(e.results&&e.results.length)for(var n=0;n<e.results.length;n++){var r,a=e.results[n],l=t.latLng(a.geometry);r=a.annotations&&a.annotations.bounds?t.latLngBounds(t.latLng(a.annotations.bounds.northeast),t.latLng(a.annotations.bounds.southwest)):t.latLngBounds(l,l),o.push({name:a.formatted,bbox:r,center:l})}s.call(i,o)})},e}(),C=function(){function e(e){this.options={serviceUrl:"https://api.geocode.earth/v1"},this._lastSuggest=0,t.Util.setOptions(this,e)}var s=e.prototype;return s.geocode=function(t,e,n){var s=this,i=o(this.options,{api_key:this.options.apiKey,text:t});p(this.options.serviceUrl+"/search",i,function(t){e.call(n,s._parseResults(t,"bbox"))})},s.suggest=function(t,e,n){var s=this,i=o(this.options,{api_key:this.options.apiKey,text:t});p(this.options.serviceUrl+"/autocomplete",i,function(t){t.geocoding.timestamp>s._lastSuggest&&(s._lastSuggest=t.geocoding.timestamp,e.call(n,s._parseResults(t,"bbox")))})},s.reverse=function(t,e,o,s){var i=this,r=n(this.options,{api_key:this.options.apiKey,"point.lat":t.lat,"point.lon":t.lng});p(this.options.serviceUrl+"/reverse",r,function(t){o.call(s,i._parseResults(t,"bounds"))})},s._parseResults=function(e,o){var n=[];return t.geoJSON(e,{pointToLayer:function(e,o){return t.circleMarker(o)},onEachFeature:function(e,s){var i,r,a={};s.getBounds?r=(i=s.getBounds()).getCenter():s.feature.bbox?(r=s.getLatLng(),i=t.latLngBounds(t.GeoJSON.coordsToLatLng(s.feature.bbox.slice(0,2)),t.GeoJSON.coordsToLatLng(s.feature.bbox.slice(2,4)))):(r=s.getLatLng(),i=t.latLngBounds(r,r)),a.name=s.feature.properties.label,a.center=r,a[o]=i,a.properties=s.feature.properties,n.push(a)}}),n},e}();function E(t){return new C(t)}var k=C,D=E,B=C,R=E,S=function(o){function n(e){return o.call(this,t.Util.extend({serviceUrl:"https://api.openrouteservice.org/geocode"},e))||this}return e(n,o),n}(C),K=function(){function e(e){this.options={serviceUrl:"https://photon.komoot.io/api/",reverseUrl:"https://photon.komoot.io/reverse/",nameProperties:["name","street","suburb","hamlet","town","city","state","country"]},t.Util.setOptions(this,e)}var s=e.prototype;return s.geocode=function(e,n,s){var i=o(this.options,{q:e});p(this.options.serviceUrl,i,t.Util.bind(function(t){n.call(s,this._decodeFeatures(t))},this))},s.suggest=function(t,e,o){return this.geocode(t,e,o)},s.reverse=function(e,o,s,i){var r=n(this.options,{lat:e.lat,lon:e.lng});p(this.options.reverseUrl,r,t.Util.bind(function(t){s.call(i,this._decodeFeatures(t))},this))},s._decodeFeatures=function(e){var o=[];if(e&&e.features)for(var n=0;n<e.features.length;n++){var s=e.features[n],i=s.geometry.coordinates,r=t.latLng(i[1],i[0]),a=s.properties.extent,l=a?t.latLngBounds([a[1],a[0]],[a[3],a[2]]):t.latLngBounds(r,r);o.push({name:this._decodeFeatureName(s),html:this.options.htmlTemplate?this.options.htmlTemplate(s):void 0,center:r,bbox:l,properties:s.properties})}return o},s._decodeFeatureName=function(t){return(this.options.nameProperties||[]).map(function(e){return t.properties[e]}).filter(function(t){return!!t}).join(", ")},e}(),T=function(){function e(e){this.options={serviceUrl:"https://api.what3words.com/v2/"},t.Util.setOptions(this,e)}var s=e.prototype;return s.geocode=function(e,n,s){p(this.options.serviceUrl+"forward",o(this.options,{key:this.options.apiKey,addr:e.split(/\s+/).join(".")}),function(e){var o=[];if(e.geometry){var i=t.latLng(e.geometry.lat,e.geometry.lng),r=t.latLngBounds(i,i);o[0]={name:e.words,bbox:r,center:i}}n.call(s,o)})},s.suggest=function(t,e,o){return this.geocode(t,e,o)},s.reverse=function(e,o,s,i){p(this.options.serviceUrl+"reverse",n(this.options,{key:this.options.apiKey,coords:[e.lat,e.lng].join(",")}),function(e){var o=[];if(200==e.status.status){var n=t.latLng(e.geometry.lat,e.geometry.lng),r=t.latLngBounds(n,n);o[0]={name:e.words,bbox:r,center:n}}s.call(i,o)})},e}(),O={__proto__:null,geocodingParams:o,reverseParams:n,ArcGis:d,arcgis:function(t){return new d(t)},Bing:h,bing:function(t){return new h(t)},Google:g,google:function(t){return new g(t)},HERE:f,HEREv2:v,here:function(t){return t.apiKey?new v(t):new f(t)},parseLatLng:m,LatLng:_,latLng:function(t){return new _(t)},Mapbox:b,mapbox:function(t){return new b(t)},MapQuest:y,mapQuest:function(t){return new y(t)},Neutrino:L,neutrino:function(t){return new L(t)},Nominatim:x,nominatim:function(t){return new x(t)},OpenLocationCode:U,openLocationCode:function(t){return new U(t)},OpenCage:w,opencage:function(t){return new w(t)},Pelias:C,pelias:E,GeocodeEarth:k,geocodeEarth:D,Mapzen:B,mapzen:R,Openrouteservice:S,openrouteservice:function(t){return new S(t)},Photon:K,photon:function(t){return new K(t)},What3Words:T,what3words:function(t){return new T(t)}},N=function(){};t.Util.extend(N.prototype,t.Control.prototype),t.Util.extend(N.prototype,t.Evented.prototype);var j=function(o){function n(e){var n;return(n=o.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,t.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 x),n}e(n,o);var s=n.prototype;return s.addThrobberClass=function(){t.DomUtil.addClass(this._container,"leaflet-control-geocoder-throbber")},s.removeThrobberClass=function(){t.DomUtil.removeClass(this._container,"leaflet-control-geocoder-throbber")},s.onAdd=function(e){var o=this,n="leaflet-control-geocoder",s=t.DomUtil.create("div",n+" leaflet-bar"),i=t.DomUtil.create("button",n+"-icon",s),r=this._form=t.DomUtil.create("div",n+"-form",s);this._map=e,this._container=s,i.innerHTML=" ",i.type="button",i.setAttribute("aria-label",this.options.iconLabel);var a=this._input=t.DomUtil.create("input","",r);return a.type="text",a.value=this.options.query,a.placeholder=this.options.placeholder,t.DomEvent.disableClickPropagation(a),this._errorElement=t.DomUtil.create("div",n+"-form-no-error",s),this._errorElement.innerHTML=this.options.errorMessage,this._alts=t.DomUtil.create("ul",n+"-alternatives leaflet-control-geocoder-alternatives-minimized",s),t.DomEvent.disableClickPropagation(this._alts),t.DomEvent.addListener(a,"keydown",this._keydown,this),this.options.geocoder.suggest&&t.DomEvent.addListener(a,"input",this._change,this),t.DomEvent.addListener(a,"blur",function(){o.options.collapsed&&!o._preventBlurCollapse&&o._collapse(),o._preventBlurCollapse=!1}),this.options.collapsed?"click"===this.options.expand?t.DomEvent.addListener(s,"click",function(t){0===t.button&&2!==t.detail&&o._toggle()}):"touch"===this.options.expand?t.DomEvent.addListener(s,t.Browser.touch?"touchstart mousedown":"mousedown",function(t){o._toggle(),t.preventDefault(),t.stopPropagation()},this):(t.DomEvent.addListener(s,"mouseover",this._expand,this),t.DomEvent.addListener(s,"mouseout",this._collapse,this),this._map.on("movestart",this._collapse,this)):(this._expand(),t.DomEvent.addListener(s,t.Browser.touch?"touchstart":"click",function(){return o._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),t.DomEvent.disableClickPropagation(s),s},s.setQuery=function(t){return this._input.value=t,this},s._geocodeResult=function(e,o){if(!o&&this.options.showUniqueResult&&1===e.length)this._geocodeResultSelected(e[0]);else if(e.length>0){this._alts.innerHTML="",this._results=e,t.DomUtil.removeClass(this._alts,"leaflet-control-geocoder-alternatives-minimized"),t.DomUtil.addClass(this._container,"leaflet-control-geocoder-options-open");for(var n=0;n<e.length;n++)this._alts.appendChild(this._createAlt(e[n],n))}else t.DomUtil.addClass(this._container,"leaflet-control-geocoder-options-error"),t.DomUtil.addClass(this._errorElement,"leaflet-control-geocoder-error")},s.markGeocode=function(e){var o=e.geocode;return this._map.fitBounds(o.bbox),this._geocodeMarker&&this._map.removeLayer(this._geocodeMarker),this._geocodeMarker=new t.Marker(o.center).bindPopup(o.html||o.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(){t.DomUtil.hasClass(this._container,"leaflet-control-geocoder-expanded")?this._collapse():this._expand()},s._expand=function(){t.DomUtil.addClass(this._container,"leaflet-control-geocoder-expanded"),this._input.select(),this.fire("expand")},s._collapse=function(){t.DomUtil.removeClass(this._container,"leaflet-control-geocoder-expanded"),t.DomUtil.addClass(this._alts,"leaflet-control-geocoder-alternatives-minimized"),t.DomUtil.removeClass(this._errorElement,"leaflet-control-geocoder-error"),t.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-open"),t.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-error"),this._input.blur(),this.fire("collapse")},s._clearResults=function(){t.DomUtil.addClass(this._alts,"leaflet-control-geocoder-alternatives-minimized"),this._selection=null,t.DomUtil.removeClass(this._errorElement,"leaflet-control-geocoder-error"),t.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-open"),t.DomUtil.removeClass(this._container,"leaflet-control-geocoder-options-error")},s._createAlt=function(e,o){var n=this,s=t.DomUtil.create("li",""),i=t.DomUtil.create("a","",s),r=this.options.showResultIcons&&e.icon?t.DomUtil.create("img","",i):null,a=e.html?void 0:document.createTextNode(e.name);return r&&(r.src=e.icon),s.setAttribute("data-result-index",String(o)),e.html?i.innerHTML=i.innerHTML+e.html:a&&i.appendChild(a),t.DomEvent.addListener(s,"mousedown touchstart",function(o){n._preventBlurCollapse=!0,t.DomEvent.stop(o),n._geocodeResultSelected(e),t.DomEvent.on(s,"click touchend",function(){n.options.collapsed?n._collapse():n._clearResults()})},this),s},s._keydown=function(e){var o=this,n=function(e){o._selection&&(t.DomUtil.removeClass(o._selection,"leaflet-control-geocoder-selected"),o._selection=o._selection[e>0?"nextSibling":"previousSibling"]),o._selection||(o._selection=o._alts[e>0?"firstChild":"lastChild"]),o._selection&&t.DomUtil.addClass(o._selection,"leaflet-control-geocoder-selected")};switch(e.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}t.DomEvent.preventDefault(e)},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())},n}(N);return t.Util.extend(j,O),t.Util.extend(t.Control,{Geocoder:j,geocoder:function(t){return new j(t)}}),j}(L); | ||
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={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"};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=" ",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); | ||
//# sourceMappingURL=Control.Geocoder.min.js.map |
@@ -1,2 +0,2 @@ | ||
import { Util, latLng as latLng$1, latLngBounds, geoJSON, circleMarker, GeoJSON, Control, Evented, DomUtil, DomEvent, Browser, Marker } from 'leaflet'; | ||
import * as L from 'leaflet'; | ||
@@ -8,3 +8,3 @@ /** | ||
function geocodingParams(options, params) { | ||
return Util.extend(params, options.geocodingQueryParams); | ||
return L.Util.extend(params, options.geocodingQueryParams); | ||
} | ||
@@ -16,3 +16,3 @@ /** | ||
function reverseParams(options, params) { | ||
return Util.extend(params, options.reverseQueryParams); | ||
return L.Util.extend(params, options.reverseQueryParams); | ||
} | ||
@@ -86,3 +86,3 @@ | ||
params[jsonpParam || 'callback'] = callbackId; | ||
window[callbackId] = Util.bind(callback, context); | ||
window[callbackId] = L.Util.bind(callback, context); | ||
const script = document.createElement('script'); | ||
@@ -180,3 +180,3 @@ script.type = 'text/javascript'; | ||
}; | ||
Util.setOptions(this, options); | ||
L.Util.setOptions(this, options); | ||
} | ||
@@ -199,7 +199,7 @@ | ||
const loc = data.candidates[i]; | ||
const latLng = latLng$1(loc.location.y, loc.location.x); | ||
const latLngBounds$1 = latLngBounds(latLng$1(loc.extent.ymax, loc.extent.xmax), latLng$1(loc.extent.ymin, loc.extent.xmin)); | ||
const latLng = L.latLng(loc.location.y, loc.location.x); | ||
const latLngBounds = L.latLngBounds(L.latLng(loc.extent.ymax, loc.extent.xmax), L.latLng(loc.extent.ymin, loc.extent.xmin)); | ||
results[i] = { | ||
name: loc.address, | ||
bbox: latLngBounds$1, | ||
bbox: latLngBounds, | ||
center: latLng | ||
@@ -228,4 +228,4 @@ }; | ||
if (data && !data.error) { | ||
const center = latLng$1(data.location.y, data.location.x); | ||
const bbox = latLngBounds(center, center); | ||
const center = L.latLng(data.location.y, data.location.x); | ||
const bbox = L.latLngBounds(center, center); | ||
result.push({ | ||
@@ -261,3 +261,3 @@ name: data.address.Match_addr, | ||
}; | ||
Util.setOptions(this, options); | ||
L.Util.setOptions(this, options); | ||
} | ||
@@ -279,4 +279,4 @@ | ||
name: resource.name, | ||
bbox: latLngBounds([bbox[0], bbox[1]], [bbox[2], bbox[3]]), | ||
center: latLng$1(resource.point.coordinates) | ||
bbox: L.latLngBounds([bbox[0], bbox[1]], [bbox[2], bbox[3]]), | ||
center: L.latLng(resource.point.coordinates) | ||
}; | ||
@@ -302,4 +302,4 @@ } | ||
name: resource.name, | ||
bbox: latLngBounds([bbox[0], bbox[1]], [bbox[2], bbox[3]]), | ||
center: latLng$1(resource.point.coordinates) | ||
bbox: L.latLngBounds([bbox[0], bbox[1]], [bbox[2], bbox[3]]), | ||
center: L.latLng(resource.point.coordinates) | ||
}; | ||
@@ -327,3 +327,3 @@ } | ||
}; | ||
Util.setOptions(this, options); | ||
L.Util.setOptions(this, options); | ||
} | ||
@@ -342,7 +342,7 @@ | ||
const loc = data.results[i]; | ||
const latLng = latLng$1(loc.geometry.location); | ||
const latLngBounds$1 = latLngBounds(latLng$1(loc.geometry.viewport.northeast), latLng$1(loc.geometry.viewport.southwest)); | ||
const latLng = L.latLng(loc.geometry.location); | ||
const latLngBounds = L.latLngBounds(L.latLng(loc.geometry.viewport.northeast), L.latLng(loc.geometry.viewport.southwest)); | ||
results[i] = { | ||
name: loc.formatted_address, | ||
bbox: latLngBounds$1, | ||
bbox: latLngBounds, | ||
center: latLng, | ||
@@ -369,4 +369,4 @@ properties: loc.address_components | ||
const loc = data.results[i]; | ||
const center = latLng$1(loc.geometry.location); | ||
const bbox = latLngBounds(latLng$1(loc.geometry.viewport.northeast), latLng$1(loc.geometry.viewport.southwest)); | ||
const center = L.latLng(loc.geometry.location); | ||
const bbox = L.latLngBounds(L.latLng(loc.geometry.viewport.northeast), L.latLng(loc.geometry.viewport.southwest)); | ||
results[i] = { | ||
@@ -408,3 +408,3 @@ name: loc.formatted_address, | ||
}; | ||
Util.setOptions(this, options); | ||
L.Util.setOptions(this, options); | ||
if (options.apiKey) throw Error('apiKey is not supported, use app_id/app_code instead!'); | ||
@@ -451,4 +451,4 @@ } | ||
const loc = data.response.view[0].result[i].location; | ||
const center = latLng$1(loc.displayPosition.latitude, loc.displayPosition.longitude); | ||
const bbox = latLngBounds(latLng$1(loc.mapView.topLeft.latitude, loc.mapView.topLeft.longitude), latLng$1(loc.mapView.bottomRight.latitude, loc.mapView.bottomRight.longitude)); | ||
const center = L.latLng(loc.displayPosition.latitude, loc.displayPosition.longitude); | ||
const bbox = L.latLngBounds(L.latLng(loc.mapView.topLeft.latitude, loc.mapView.topLeft.longitude), L.latLng(loc.mapView.bottomRight.latitude, loc.mapView.bottomRight.longitude)); | ||
results[i] = { | ||
@@ -481,3 +481,3 @@ name: loc.address.label, | ||
}; | ||
Util.setOptions(this, options); | ||
L.Util.setOptions(this, options); | ||
} | ||
@@ -515,10 +515,10 @@ | ||
const item = data.items[i]; | ||
const latLng = latLng$1(item.position.lat, item.position.lng); | ||
const latLng = L.latLng(item.position.lat, item.position.lng); | ||
let bbox; | ||
if (item.mapView) { | ||
bbox = latLngBounds(latLng$1(item.mapView.south, item.mapView.west), latLng$1(item.mapView.north, item.mapView.east)); | ||
bbox = L.latLngBounds(L.latLng(item.mapView.south, item.mapView.west), L.latLng(item.mapView.north, item.mapView.east)); | ||
} else { | ||
// Using only position when not provided | ||
bbox = latLngBounds(latLng$1(item.position.lat, item.position.lng), latLng$1(item.position.lat, item.position.lng)); | ||
bbox = L.latLngBounds(L.latLng(item.position.lat, item.position.lng), L.latLng(item.position.lat, item.position.lng)); | ||
} | ||
@@ -564,20 +564,20 @@ | ||
// [NSEW] decimal degrees | ||
return latLng$1((/N/i.test(match[1]) ? 1 : -1) * +match[2], (/E/i.test(match[3]) ? 1 : -1) * +match[4]); | ||
return L.latLng((/N/i.test(match[1]) ? 1 : -1) * +match[2], (/E/i.test(match[3]) ? 1 : -1) * +match[4]); | ||
} else if (match = query.match(/^(\d{1,3}(?:\.\d*)?)\s*([NS])\W*(\d{1,3}(?:\.\d*)?)\s*([EW])$/)) { | ||
// decimal degrees [NSEW] | ||
return latLng$1((/N/i.test(match[2]) ? 1 : -1) * +match[1], (/E/i.test(match[4]) ? 1 : -1) * +match[3]); | ||
return L.latLng((/N/i.test(match[2]) ? 1 : -1) * +match[1], (/E/i.test(match[4]) ? 1 : -1) * +match[3]); | ||
} else if (match = query.match(/^([NS])\s*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\W*([EW])\s*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?$/)) { | ||
// [NSEW] degrees, decimal minutes | ||
return latLng$1((/N/i.test(match[1]) ? 1 : -1) * (+match[2] + +match[3] / 60), (/E/i.test(match[4]) ? 1 : -1) * (+match[5] + +match[6] / 60)); | ||
return L.latLng((/N/i.test(match[1]) ? 1 : -1) * (+match[2] + +match[3] / 60), (/E/i.test(match[4]) ? 1 : -1) * (+match[5] + +match[6] / 60)); | ||
} else if (match = query.match(/^(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\s*([NS])\W*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\s*([EW])$/)) { | ||
// degrees, decimal minutes [NSEW] | ||
return latLng$1((/N/i.test(match[3]) ? 1 : -1) * (+match[1] + +match[2] / 60), (/E/i.test(match[6]) ? 1 : -1) * (+match[4] + +match[5] / 60)); | ||
return L.latLng((/N/i.test(match[3]) ? 1 : -1) * (+match[1] + +match[2] / 60), (/E/i.test(match[6]) ? 1 : -1) * (+match[4] + +match[5] / 60)); | ||
} else if (match = query.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*)?)?["″]?$/)) { | ||
// [NSEW] degrees, minutes, decimal seconds | ||
return latLng$1((/N/i.test(match[1]) ? 1 : -1) * (+match[2] + +match[3] / 60 + +match[4] / 3600), (/E/i.test(match[5]) ? 1 : -1) * (+match[6] + +match[7] / 60 + +match[8] / 3600)); | ||
return L.latLng((/N/i.test(match[1]) ? 1 : -1) * (+match[2] + +match[3] / 60 + +match[4] / 3600), (/E/i.test(match[5]) ? 1 : -1) * (+match[6] + +match[7] / 60 + +match[8] / 3600)); | ||
} else if (match = query.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])$/)) { | ||
// degrees, minutes, decimal seconds [NSEW] | ||
return latLng$1((/N/i.test(match[4]) ? 1 : -1) * (+match[1] + +match[2] / 60 + +match[3] / 3600), (/E/i.test(match[8]) ? 1 : -1) * (+match[5] + +match[6] / 60 + +match[7] / 3600)); | ||
return L.latLng((/N/i.test(match[4]) ? 1 : -1) * (+match[1] + +match[2] / 60 + +match[3] / 3600), (/E/i.test(match[8]) ? 1 : -1) * (+match[5] + +match[6] / 60 + +match[7] / 3600)); | ||
} else if (match = query.match(/^\s*([+-]?\d+(?:\.\d*)?)\s*[\s,]\s*([+-]?\d+(?:\.\d*)?)\s*$/)) { | ||
return latLng$1(+match[1], +match[2]); | ||
return L.latLng(+match[1], +match[2]); | ||
} | ||
@@ -595,3 +595,3 @@ } | ||
}; | ||
Util.setOptions(this, options); | ||
L.Util.setOptions(this, options); | ||
} | ||
@@ -633,3 +633,3 @@ | ||
}; | ||
Util.setOptions(this, options); | ||
L.Util.setOptions(this, options); | ||
} | ||
@@ -670,9 +670,9 @@ | ||
const loc = data.features[i]; | ||
const center = latLng$1(loc.center.reverse()); | ||
const center = L.latLng(loc.center.reverse()); | ||
let bbox; | ||
if (loc.bbox) { | ||
bbox = latLngBounds(latLng$1(loc.bbox.slice(0, 2).reverse()), latLng$1(loc.bbox.slice(2, 4).reverse())); | ||
bbox = L.latLngBounds(L.latLng(loc.bbox.slice(0, 2).reverse()), L.latLng(loc.bbox.slice(2, 4).reverse())); | ||
} else { | ||
bbox = latLngBounds(center, center); | ||
bbox = L.latLngBounds(center, center); | ||
} | ||
@@ -708,9 +708,9 @@ | ||
const loc = data.features[i]; | ||
const center = latLng$1(loc.center.reverse()); | ||
const center = L.latLng(loc.center.reverse()); | ||
let bbox; | ||
if (loc.bbox) { | ||
bbox = latLngBounds(latLng$1(loc.bbox.slice(0, 2).reverse()), latLng$1(loc.bbox.slice(2, 4).reverse())); | ||
bbox = L.latLngBounds(L.latLng(loc.bbox.slice(0, 2).reverse()), L.latLng(loc.bbox.slice(2, 4).reverse())); | ||
} else { | ||
bbox = latLngBounds(center, center); | ||
bbox = L.latLngBounds(center, center); | ||
} | ||
@@ -750,3 +750,3 @@ | ||
}; | ||
Util.setOptions(this, options); // MapQuest seems to provide URI encoded API keys, | ||
L.Util.setOptions(this, options); // MapQuest seems to provide URI encoded API keys, | ||
// so to avoid encoding them twice, we decode them here | ||
@@ -768,3 +768,3 @@ | ||
}); | ||
getJSON(this.options.serviceUrl + '/address', params, Util.bind(function (data) { | ||
getJSON(this.options.serviceUrl + '/address', params, L.Util.bind(function (data) { | ||
const results = []; | ||
@@ -775,6 +775,6 @@ | ||
const loc = data.results[0].locations[i]; | ||
const center = latLng$1(loc.latLng); | ||
const center = L.latLng(loc.latLng); | ||
results[i] = { | ||
name: this._formatName(loc.street, loc.adminArea4, loc.adminArea3, loc.adminArea1), | ||
bbox: latLngBounds(center, center), | ||
bbox: L.latLngBounds(center, center), | ||
center: center | ||
@@ -795,3 +795,3 @@ }; | ||
}); | ||
getJSON(this.options.serviceUrl + '/reverse', params, Util.bind(function (data) { | ||
getJSON(this.options.serviceUrl + '/reverse', params, L.Util.bind(function (data) { | ||
const results = []; | ||
@@ -802,6 +802,6 @@ | ||
const loc = data.results[0].locations[i]; | ||
const center = latLng$1(loc.latLng); | ||
const center = L.latLng(loc.latLng); | ||
results[i] = { | ||
name: this._formatName(loc.street, loc.adminArea4, loc.adminArea3, loc.adminArea1), | ||
bbox: latLngBounds(center, center), | ||
bbox: L.latLngBounds(center, center), | ||
center: center | ||
@@ -837,3 +837,3 @@ }; | ||
}; | ||
Util.setOptions(this, options); | ||
L.Util.setOptions(this, options); | ||
} // https://www.neutrinoapi.com/api/geocode-address/ | ||
@@ -854,4 +854,4 @@ | ||
data.geometry = data.locations[0]; | ||
const center = latLng$1(data.geometry['latitude'], data.geometry['longitude']); | ||
const bbox = latLngBounds(center, center); | ||
const center = L.latLng(data.geometry['latitude'], data.geometry['longitude']); | ||
const bbox = L.latLngBounds(center, center); | ||
results[0] = { | ||
@@ -884,4 +884,4 @@ name: data.geometry.address, | ||
if (data.status.status == 200 && data.found) { | ||
const center = latLng$1(location.lat, location.lng); | ||
const bbox = latLngBounds(center, center); | ||
const center = L.latLng(location.lat, location.lng); | ||
const bbox = L.latLngBounds(center, center); | ||
results[0] = { | ||
@@ -942,3 +942,3 @@ name: data.address, | ||
}; | ||
Util.setOptions(this, options || {}); | ||
L.Util.setOptions(this, options || {}); | ||
} | ||
@@ -965,4 +965,4 @@ | ||
html: this.options.htmlTemplate ? this.options.htmlTemplate(data[i]) : undefined, | ||
bbox: latLngBounds([bbox[0], bbox[2]], [bbox[1], bbox[3]]), | ||
center: latLng$1(data[i].lat, data[i].lon), | ||
bbox: L.latLngBounds([bbox[0], bbox[2]], [bbox[1], bbox[3]]), | ||
center: L.latLng(data[i].lat, data[i].lon), | ||
properties: data[i] | ||
@@ -988,4 +988,4 @@ }; | ||
if (data && data.lat && data.lon) { | ||
const center = latLng$1(data.lat, data.lon); | ||
const bbox = latLngBounds(center, center); | ||
const center = L.latLng(data.lat, data.lon); | ||
const bbox = L.latLngBounds(center, center); | ||
result.push({ | ||
@@ -1020,3 +1020,3 @@ name: data.display_name, | ||
constructor(options) { | ||
Util.setOptions(this, options); | ||
L.Util.setOptions(this, options); | ||
} | ||
@@ -1029,4 +1029,4 @@ | ||
name: query, | ||
center: latLng$1(decoded.latitudeCenter, decoded.longitudeCenter), | ||
bbox: latLngBounds(latLng$1(decoded.latitudeLo, decoded.longitudeLo), latLng$1(decoded.latitudeHi, decoded.longitudeHi)) | ||
center: L.latLng(decoded.latitudeCenter, decoded.longitudeCenter), | ||
bbox: L.latLngBounds(L.latLng(decoded.latitudeLo, decoded.longitudeLo), L.latLng(decoded.latitudeHi, decoded.longitudeHi)) | ||
}; | ||
@@ -1046,4 +1046,4 @@ cb.call(context, [result]); | ||
name: code, | ||
center: latLng$1(location.lat, location.lng), | ||
bbox: latLngBounds(latLng$1(location.lat, location.lng), latLng$1(location.lat, location.lng)) | ||
center: L.latLng(location.lat, location.lng), | ||
bbox: L.latLngBounds(L.latLng(location.lat, location.lng), L.latLng(location.lat, location.lng)) | ||
}; | ||
@@ -1077,3 +1077,3 @@ cb.call(context, [result]); | ||
}; | ||
Util.setOptions(this, options); | ||
L.Util.setOptions(this, options); | ||
} | ||
@@ -1092,9 +1092,9 @@ | ||
const loc = data.results[i]; | ||
const center = latLng$1(loc.geometry); | ||
const center = L.latLng(loc.geometry); | ||
let bbox; | ||
if (loc.annotations && loc.annotations.bounds) { | ||
bbox = latLngBounds(latLng$1(loc.annotations.bounds.northeast), latLng$1(loc.annotations.bounds.southwest)); | ||
bbox = L.latLngBounds(L.latLng(loc.annotations.bounds.northeast), L.latLng(loc.annotations.bounds.southwest)); | ||
} else { | ||
bbox = latLngBounds(center, center); | ||
bbox = L.latLngBounds(center, center); | ||
} | ||
@@ -1129,9 +1129,9 @@ | ||
const loc = data.results[i]; | ||
const center = latLng$1(loc.geometry); | ||
const center = L.latLng(loc.geometry); | ||
let bbox; | ||
if (loc.annotations && loc.annotations.bounds) { | ||
bbox = latLngBounds(latLng$1(loc.annotations.bounds.northeast), latLng$1(loc.annotations.bounds.southwest)); | ||
bbox = L.latLngBounds(L.latLng(loc.annotations.bounds.northeast), L.latLng(loc.annotations.bounds.southwest)); | ||
} else { | ||
bbox = latLngBounds(center, center); | ||
bbox = L.latLngBounds(center, center); | ||
} | ||
@@ -1166,3 +1166,3 @@ | ||
this._lastSuggest = 0; | ||
Util.setOptions(this, options); | ||
L.Util.setOptions(this, options); | ||
} | ||
@@ -1206,5 +1206,5 @@ | ||
const results = []; | ||
geoJSON(data, { | ||
L.geoJSON(data, { | ||
pointToLayer: function (feature, latlng) { | ||
return circleMarker(latlng); | ||
return L.circleMarker(latlng); | ||
}, | ||
@@ -1221,6 +1221,6 @@ onEachFeature: function (feature, layer) { | ||
center = layer.getLatLng(); | ||
bbox = latLngBounds(GeoJSON.coordsToLatLng(layer.feature.bbox.slice(0, 2)), GeoJSON.coordsToLatLng(layer.feature.bbox.slice(2, 4))); | ||
bbox = L.latLngBounds(L.GeoJSON.coordsToLatLng(layer.feature.bbox.slice(0, 2)), L.GeoJSON.coordsToLatLng(layer.feature.bbox.slice(2, 4))); | ||
} else { | ||
center = layer.getLatLng(); | ||
bbox = latLngBounds(center, center); | ||
bbox = L.latLngBounds(center, center); | ||
} | ||
@@ -1267,3 +1267,3 @@ | ||
constructor(options) { | ||
super(Util.extend({ | ||
super(L.Util.extend({ | ||
serviceUrl: 'https://api.openrouteservice.org/geocode' | ||
@@ -1294,3 +1294,3 @@ }, options)); | ||
}; | ||
Util.setOptions(this, options); | ||
L.Util.setOptions(this, options); | ||
} | ||
@@ -1302,3 +1302,3 @@ | ||
}); | ||
getJSON(this.options.serviceUrl, params, Util.bind(function (data) { | ||
getJSON(this.options.serviceUrl, params, L.Util.bind(function (data) { | ||
cb.call(context, this._decodeFeatures(data)); | ||
@@ -1317,3 +1317,3 @@ }, this)); | ||
}); | ||
getJSON(this.options.reverseUrl, params, Util.bind(function (data) { | ||
getJSON(this.options.reverseUrl, params, L.Util.bind(function (data) { | ||
cb.call(context, this._decodeFeatures(data)); | ||
@@ -1330,5 +1330,5 @@ }, this)); | ||
const c = f.geometry.coordinates; | ||
const center = latLng$1(c[1], c[0]); | ||
const center = L.latLng(c[1], c[0]); | ||
const extent = f.properties.extent; | ||
const bbox = extent ? latLngBounds([extent[1], extent[0]], [extent[3], extent[2]]) : latLngBounds(center, center); | ||
const bbox = extent ? L.latLngBounds([extent[1], extent[0]], [extent[3], extent[2]]) : L.latLngBounds(center, center); | ||
results.push({ | ||
@@ -1374,3 +1374,3 @@ name: this._decodeFeatureName(f), | ||
}; | ||
Util.setOptions(this, options); | ||
L.Util.setOptions(this, options); | ||
} | ||
@@ -1387,7 +1387,7 @@ | ||
if (data.geometry) { | ||
const latLng = latLng$1(data.geometry['lat'], data.geometry['lng']); | ||
const latLngBounds$1 = latLngBounds(latLng, latLng); | ||
const latLng = L.latLng(data.geometry['lat'], data.geometry['lng']); | ||
const latLngBounds = L.latLngBounds(latLng, latLng); | ||
results[0] = { | ||
name: data.words, | ||
bbox: latLngBounds$1, | ||
bbox: latLngBounds, | ||
center: latLng | ||
@@ -1413,4 +1413,4 @@ }; | ||
if (data.status.status == 200) { | ||
const center = latLng$1(data.geometry['lat'], data.geometry['lng']); | ||
const bbox = latLngBounds(center, center); | ||
const center = L.latLng(data.geometry['lat'], data.geometry['lng']); | ||
const bbox = L.latLngBounds(center, center); | ||
results[0] = { | ||
@@ -1437,4 +1437,2 @@ name: data.words, | ||
var geocoders = { | ||
@@ -1495,4 +1493,4 @@ __proto__: null, | ||
Util.extend(EventedControl.prototype, Control.prototype); | ||
Util.extend(EventedControl.prototype, Evented.prototype); | ||
L.Util.extend(EventedControl.prototype, L.Control.prototype); | ||
L.Util.extend(EventedControl.prototype, L.Evented.prototype); | ||
/** | ||
@@ -1525,3 +1523,3 @@ * This is the geocoder control. It works like any other [Leaflet control](https://leafletjs.com/reference.html#control), and is added to the map. | ||
this._requestCount = 0; | ||
Util.setOptions(this, options); | ||
L.Util.setOptions(this, options); | ||
@@ -1534,7 +1532,7 @@ if (!this.options.geocoder) { | ||
addThrobberClass() { | ||
DomUtil.addClass(this._container, 'leaflet-control-geocoder-throbber'); | ||
L.DomUtil.addClass(this._container, 'leaflet-control-geocoder-throbber'); | ||
} | ||
removeThrobberClass() { | ||
DomUtil.removeClass(this._container, 'leaflet-control-geocoder-throbber'); | ||
L.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-throbber'); | ||
} | ||
@@ -1550,5 +1548,5 @@ /** | ||
const className = 'leaflet-control-geocoder'; | ||
const container = DomUtil.create('div', className + ' leaflet-bar'); | ||
const icon = DomUtil.create('button', className + '-icon', container); | ||
const form = this._form = DomUtil.create('div', className + '-form', container); | ||
const container = L.DomUtil.create('div', className + ' leaflet-bar'); | ||
const icon = L.DomUtil.create('button', className + '-icon', container); | ||
const form = this._form = L.DomUtil.create('div', className + '-form', container); | ||
this._map = map; | ||
@@ -1559,18 +1557,18 @@ this._container = container; | ||
icon.setAttribute('aria-label', this.options.iconLabel); | ||
const input = this._input = DomUtil.create('input', '', form); | ||
const input = this._input = L.DomUtil.create('input', '', form); | ||
input.type = 'text'; | ||
input.value = this.options.query; | ||
input.placeholder = this.options.placeholder; | ||
DomEvent.disableClickPropagation(input); | ||
this._errorElement = DomUtil.create('div', className + '-form-no-error', container); | ||
L.DomEvent.disableClickPropagation(input); | ||
this._errorElement = L.DomUtil.create('div', className + '-form-no-error', container); | ||
this._errorElement.innerHTML = this.options.errorMessage; | ||
this._alts = DomUtil.create('ul', className + '-alternatives leaflet-control-geocoder-alternatives-minimized', container); | ||
DomEvent.disableClickPropagation(this._alts); | ||
DomEvent.addListener(input, 'keydown', this._keydown, this); | ||
this._alts = L.DomUtil.create('ul', className + '-alternatives leaflet-control-geocoder-alternatives-minimized', container); | ||
L.DomEvent.disableClickPropagation(this._alts); | ||
L.DomEvent.addListener(input, 'keydown', this._keydown, this); | ||
if (this.options.geocoder.suggest) { | ||
DomEvent.addListener(input, 'input', this._change, this); | ||
L.DomEvent.addListener(input, 'input', this._change, this); | ||
} | ||
DomEvent.addListener(input, 'blur', () => { | ||
L.DomEvent.addListener(input, 'blur', () => { | ||
if (this.options.collapsed && !this._preventBlurCollapse) { | ||
@@ -1585,3 +1583,3 @@ this._collapse(); | ||
if (this.options.expand === 'click') { | ||
DomEvent.addListener(container, 'click', e => { | ||
L.DomEvent.addListener(container, 'click', e => { | ||
if (e.button === 0 && e.detail !== 2) { | ||
@@ -1592,3 +1590,3 @@ this._toggle(); | ||
} else if (this.options.expand === 'touch') { | ||
DomEvent.addListener(container, Browser.touch ? 'touchstart mousedown' : 'mousedown', e => { | ||
L.DomEvent.addListener(container, L.Browser.touch ? 'touchstart mousedown' : 'mousedown', e => { | ||
this._toggle(); | ||
@@ -1601,4 +1599,4 @@ | ||
} else { | ||
DomEvent.addListener(container, 'mouseover', this._expand, this); | ||
DomEvent.addListener(container, 'mouseout', this._collapse, this); | ||
L.DomEvent.addListener(container, 'mouseover', this._expand, this); | ||
L.DomEvent.addListener(container, 'mouseout', this._collapse, this); | ||
@@ -1610,6 +1608,6 @@ this._map.on('movestart', this._collapse, this); | ||
if (Browser.touch) { | ||
DomEvent.addListener(container, 'touchstart', () => this._geocode()); | ||
if (L.Browser.touch) { | ||
L.DomEvent.addListener(container, 'touchstart', () => this._geocode()); | ||
} else { | ||
DomEvent.addListener(container, 'click', () => this._geocode()); | ||
L.DomEvent.addListener(container, 'click', () => this._geocode()); | ||
} | ||
@@ -1626,3 +1624,3 @@ } | ||
this.on('finishsuggest', this.removeThrobberClass, this); | ||
DomEvent.disableClickPropagation(container); | ||
L.DomEvent.disableClickPropagation(container); | ||
return container; | ||
@@ -1647,4 +1645,4 @@ } | ||
this._results = results; | ||
DomUtil.removeClass(this._alts, 'leaflet-control-geocoder-alternatives-minimized'); | ||
DomUtil.addClass(this._container, 'leaflet-control-geocoder-options-open'); | ||
L.DomUtil.removeClass(this._alts, 'leaflet-control-geocoder-alternatives-minimized'); | ||
L.DomUtil.addClass(this._container, 'leaflet-control-geocoder-options-open'); | ||
@@ -1655,4 +1653,4 @@ for (let i = 0; i < results.length; i++) { | ||
} else { | ||
DomUtil.addClass(this._container, 'leaflet-control-geocoder-options-error'); | ||
DomUtil.addClass(this._errorElement, 'leaflet-control-geocoder-error'); | ||
L.DomUtil.addClass(this._container, 'leaflet-control-geocoder-options-error'); | ||
L.DomUtil.addClass(this._errorElement, 'leaflet-control-geocoder-error'); | ||
} | ||
@@ -1675,3 +1673,3 @@ } | ||
this._geocodeMarker = new Marker(result.center).bindPopup(result.html || result.name).addTo(this._map).openPopup(); | ||
this._geocodeMarker = new L.Marker(result.center).bindPopup(result.html || result.name).addTo(this._map).openPopup(); | ||
return this; | ||
@@ -1727,3 +1725,3 @@ } | ||
_toggle() { | ||
if (DomUtil.hasClass(this._container, 'leaflet-control-geocoder-expanded')) { | ||
if (L.DomUtil.hasClass(this._container, 'leaflet-control-geocoder-expanded')) { | ||
this._collapse(); | ||
@@ -1736,3 +1734,3 @@ } else { | ||
_expand() { | ||
DomUtil.addClass(this._container, 'leaflet-control-geocoder-expanded'); | ||
L.DomUtil.addClass(this._container, 'leaflet-control-geocoder-expanded'); | ||
@@ -1745,7 +1743,7 @@ this._input.select(); | ||
_collapse() { | ||
DomUtil.removeClass(this._container, 'leaflet-control-geocoder-expanded'); | ||
DomUtil.addClass(this._alts, 'leaflet-control-geocoder-alternatives-minimized'); | ||
DomUtil.removeClass(this._errorElement, 'leaflet-control-geocoder-error'); | ||
DomUtil.removeClass(this._container, 'leaflet-control-geocoder-options-open'); | ||
DomUtil.removeClass(this._container, 'leaflet-control-geocoder-options-error'); | ||
L.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-expanded'); | ||
L.DomUtil.addClass(this._alts, 'leaflet-control-geocoder-alternatives-minimized'); | ||
L.DomUtil.removeClass(this._errorElement, 'leaflet-control-geocoder-error'); | ||
L.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-options-open'); | ||
L.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-options-error'); | ||
@@ -1759,13 +1757,13 @@ this._input.blur(); // mobile: keyboard shouldn't stay expanded | ||
_clearResults() { | ||
DomUtil.addClass(this._alts, 'leaflet-control-geocoder-alternatives-minimized'); | ||
L.DomUtil.addClass(this._alts, 'leaflet-control-geocoder-alternatives-minimized'); | ||
this._selection = null; | ||
DomUtil.removeClass(this._errorElement, 'leaflet-control-geocoder-error'); | ||
DomUtil.removeClass(this._container, 'leaflet-control-geocoder-options-open'); | ||
DomUtil.removeClass(this._container, 'leaflet-control-geocoder-options-error'); | ||
L.DomUtil.removeClass(this._errorElement, 'leaflet-control-geocoder-error'); | ||
L.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-options-open'); | ||
L.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-options-error'); | ||
} | ||
_createAlt(result, index) { | ||
const li = DomUtil.create('li', ''), | ||
a = DomUtil.create('a', '', li), | ||
icon = this.options.showResultIcons && result.icon ? DomUtil.create('img', '', a) : null, | ||
const li = L.DomUtil.create('li', ''), | ||
a = L.DomUtil.create('a', '', li), | ||
icon = this.options.showResultIcons && result.icon ? L.DomUtil.create('img', '', a) : null, | ||
text = result.html ? undefined : document.createTextNode(result.name), | ||
@@ -1779,7 +1777,7 @@ mouseDownHandler = e => { | ||
this._preventBlurCollapse = true; | ||
DomEvent.stop(e); | ||
L.DomEvent.stop(e); | ||
this._geocodeResultSelected(result); | ||
DomEvent.on(li, 'click touchend', () => { | ||
L.DomEvent.on(li, 'click touchend', () => { | ||
if (this.options.collapsed) { | ||
@@ -1808,3 +1806,3 @@ this._collapse(); | ||
DomEvent.addListener(li, 'mousedown touchstart', mouseDownHandler, this); | ||
L.DomEvent.addListener(li, 'mousedown touchstart', mouseDownHandler, this); | ||
return li; | ||
@@ -1816,3 +1814,3 @@ } | ||
if (this._selection) { | ||
DomUtil.removeClass(this._selection, 'leaflet-control-geocoder-selected'); | ||
L.DomUtil.removeClass(this._selection, 'leaflet-control-geocoder-selected'); | ||
this._selection = this._selection[dir > 0 ? 'nextSibling' : 'previousSibling']; | ||
@@ -1826,3 +1824,3 @@ } | ||
if (this._selection) { | ||
DomUtil.addClass(this._selection, 'leaflet-control-geocoder-selected'); | ||
L.DomUtil.addClass(this._selection, 'leaflet-control-geocoder-selected'); | ||
} | ||
@@ -1870,3 +1868,3 @@ }; | ||
DomEvent.preventDefault(e); | ||
L.DomEvent.preventDefault(e); | ||
} | ||
@@ -1906,4 +1904,4 @@ | ||
*/ | ||
Util.extend(GeocoderControl, geocoders); | ||
Util.extend(Control, { | ||
L.Util.extend(GeocoderControl, geocoders); | ||
L.Util.extend(L.Control, { | ||
Geocoder: GeocoderControl, | ||
@@ -1910,0 +1908,0 @@ geocoder: geocoder |
{ | ||
"name": "leaflet-control-geocoder", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"description": "Extendable geocoder with builtin support for OpenStreetMap Nominatim, Bing, Google, Mapbox, MapQuest, What3Words, Photon, Pelias, HERE, Neutrino, Plus codes", | ||
@@ -8,2 +8,3 @@ "source": "src/index.ts", | ||
"module": "dist/Control.Geocoder.modern.js", | ||
"types": "dist/index.d.ts", | ||
"scripts": { | ||
@@ -73,3 +74,3 @@ "prepare": "npm run build", | ||
"leaflet": "^1.6.0", | ||
"microbundle": "^0.12.4", | ||
"microbundle": "^0.13.0", | ||
"prettier": "^1.19.1", | ||
@@ -76,0 +77,0 @@ "ts-jest": "^26.4.4", |
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
671174
6203