!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.MapboxGeocoder=e()}}(function(){var e;return function(){function e(t,n,i){function r(s,a){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[s]={exports:{}};t[s][0].call(l.exports,function(e){return r(t[s][1][e]||e)},l,l.exports,e,t,n,i)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s2&&void 0!==arguments[2]?arguments[2]:{};if("search.select"===e&&!n.selectedFeature||"search.keystroke"===e&&!n.key)return null;var r;if(t.options.proximity)if("object"===i(t.options.proximity))r=[t.options.proximity.longitude,t.options.proximity.latitude];else if("ip"===t.options.proximity){var o=t._headers?t._headers["ip-proximity"]:null;r=o&&"string"==typeof o?o.split(",").map(parseFloat):[999,999]}else r=t.options.proximity;else r=null;var s=t._map?t._map.getZoom():void 0,a={event:e,version:this.getEventSchemaVersion(e),created:+new Date,sessionIdentifier:this.getSessionId(),country:this.countries,userAgent:this.userAgent,language:this.language,bbox:this.bbox,types:this.types,endpoint:"mapbox.places",autocomplete:t.options.autocomplete,fuzzyMatch:t.options.fuzzyMatch,proximity:r,limit:t.options.limit,routing:t.options.routing,worldview:t.options.worldview,mapZoom:s,keyboardLocale:this.locale};if("search.select"===e?a.queryString=t.inputString:"search.select"!=e&&t._inputEl?a.queryString=t._inputEl.value:a.queryString=t.inputString,["search.keystroke","search.select"].includes(e)&&(a.path="geocoding/v5/mapbox.places"),"search.keystroke"===e&&n.key)a.lastAction=n.key;else if("search.select"===e&&n.selectedFeature){var u=n.selectedFeature,c=this.getSelectedIndex(u,t);if(a.resultIndex=c,a.resultPlaceName=u.place_name,a.resultId=u.id,u.properties&&(a.resultMapboxId=u.properties.mapbox_id),t._typeahead){var l=t._typeahead.data;l&&l.length>0&&(a.suggestionIds=this.getSuggestionIds(l),a.suggestionNames=this.getSuggestionNames(l),a.suggestionTypes=this.getSuggestionTypes(l),a.suggestionSources=this.getSuggestionSources(l))}}return this.validatePayload(a)?a:null},request:function(e,t){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4==this.readyState)return t(204==this.status?null:this.statusText)},n.open(e.method,e.host+"/"+e.path,!0);for(var i in e.headers){var r=e.headers[i];n.setRequestHeader(i,r)}n.send(e.body)},handleError:function(e,t){if(t)return t(e)},generateSessionID:function(){return o()},getSessionId:function(){return this.pluginSessionID+"."+this.sessionIncrementer},getUserAgent:function(){return"mapbox-gl-geocoder."+this.version+"."+navigator.userAgent},getSelectedIndex:function(e,t){if(t._typeahead){var n=t._typeahead.data,i=e.id;return n.map(function(e){return e.id}).indexOf(i)}},getSuggestionIds:function(e){return e.map(function(e){return e.properties?e.properties.mapbox_id||"":e.id||""})},getSuggestionNames:function(e){return e.map(function(e){return e.place_name||""})},getSuggestionTypes:function(e){return e.map(function(e){return e.place_type&&Array.isArray(e.place_type)?e.place_type[0]||"":""})},getSuggestionSources:function(e){return e.map(function(e){return e._source||""})},getEventSchemaVersion:function(e){return["search.keystroke","search.select"].includes(e)?"2.2":"2.0"},validatePayload:function(e){if(!e||!e.event)return!1;var t=["event","created","sessionIdentifier","queryString"],n=["event","created","sessionIdentifier","queryString","lastAction"],i=["event","created","sessionIdentifier","queryString","resultIndex","path","suggestionIds"],r=e.event;return"search.start"===r?this.objectHasRequiredProps(e,t):"search.keystroke"===r?this.objectHasRequiredProps(e,n):"search.select"!==r||this.objectHasRequiredProps(e,i)},objectHasRequiredProps:function(e,t){return t.every(function(t){return"queryString"===t?"string"==typeof e[t]&&e[t].length>0:void 0!==e[t]})},shouldEnableLogging:function(e){return!1!==e.enableEventLogging&&(!e.origin||"https://api.mapbox.com"===e.origin)},flush:function(){this.eventQueue.length>0&&(this.send(this.eventQueue),this.eventQueue=new Array),this.timer&&clearTimeout(this.timer),this.flushInterval&&(this.timer=setTimeout(this.flush.bind(this),this.flushInterval))},push:function(e,t){this.eventQueue.push(e),(this.eventQueue.length>=this.maxQueueSize||t)&&this.flush()},remove:function(){this.flush()}},t.exports=r},{nanoid:32}],2:[function(e,t,n){"use strict";t.exports={fr:{name:"France",bbox:[[-4.59235,41.380007],[9.560016,51.148506]]},us:{name:"United States",bbox:[[-171.791111,18.91619],[-66.96466,71.357764]]},ru:{name:"Russia",bbox:[[19.66064,41.151416],[190.10042,81.2504]]},ca:{name:"Canada",bbox:[[-140.99778,41.675105],[-52.648099,83.23324]]}}},{}],3:[function(e,t,n){"use strict";function i(){}i.prototype={isSupport:function(){return Boolean(window.navigator.geolocation)},getCurrentPosition:function(){var e={enableHighAccuracy:!0};return new Promise(function(t,n){window.navigator.geolocation.getCurrentPosition(t,n,e)})}},t.exports=i},{}],4:[function(e,t,n){"use strict";function i(){var e=document.createElement("div");return e.className="mapboxgl-ctrl-geocoder--powered-by",e.innerHTML='Powered by Mapbox',e}function r(e){this._eventEmitter=new u,this.options=a({},this.options,e),this.inputString="",this.fresh=!0,this.lastSelected=null,this.geolocation=new g}var o=e("suggestions"),s=e("lodash.debounce"),a=e("xtend"),u=e("events").EventEmitter,c=e("./exceptions"),l=e("@mapbox/mapbox-sdk"),h=e("@mapbox/mapbox-sdk/services/geocoding"),p=e("./events"),f=e("./localization"),d=e("subtag"),g=e("./geolocation"),y=e("./utils"),m={FORWARD:0,LOCAL:1,REVERSE:2};r.prototype={options:{zoom:16,flyTo:!0,trackProximity:!0,minLength:2,reverseGeocode:!1,flipCoordinates:!1,limit:5,origin:"https://api.mapbox.com",enableEventLogging:!0,marker:!0,mapboxgl:null,collapsed:!1,clearAndBlurOnEsc:!1,clearOnBlur:!1,enableGeolocation:!1,addressAccuracy:"street",getItemValue:function(e){return e.place_name},render:function(e){var t=e.place_name.split(",");return'
'+t[0]+'
'+t.splice(1,t.length).join(",")+"
"}},_headers:{},addTo:function(e){function t(e,t){if(!document.body.contains(t))throw new Error("Element provided to #addTo() exists, but is not in the DOM");var n=e.onAdd();t.appendChild(n)}if(e._controlContainer)e.addControl(this);else if(e instanceof HTMLElement)t(this,e);else{if("string"!=typeof e)throw new Error("Error: addTo must be a mapbox-gl-js map, an html element, or a CSS selector query for a single html element");var n=document.querySelectorAll(e);if(0===n.length)throw new Error("Element ",e,"not found.");if(n.length>1)throw new Error("Geocoder can only be added to a single html element");t(this,n[0])}},onAdd:function(e){if(e&&"string"!=typeof e&&(this._map=e),this.setLanguage(),this.options.localGeocoderOnly||(this.geocoderService=h(l({accessToken:this.options.accessToken,origin:this.options.origin}))),this.options.localGeocoderOnly&&!this.options.localGeocoder)throw new Error("A localGeocoder function must be specified to use localGeocoderOnly mode");this.eventManager=new p(this.options),this._onChange=this._onChange.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onPaste=this._onPaste.bind(this),this._onBlur=this._onBlur.bind(this),this._showButton=this._showButton.bind(this),this._hideButton=this._hideButton.bind(this),this._onQueryResult=this._onQueryResult.bind(this),this.clear=this.clear.bind(this),this._updateProximity=this._updateProximity.bind(this),this._collapse=this._collapse.bind(this),this._unCollapse=this._unCollapse.bind(this),this._clear=this._clear.bind(this),this._clearOnBlur=this._clearOnBlur.bind(this),this._geolocateUser=this._geolocateUser.bind(this);var t=this.container=document.createElement("div");t.className="mapboxgl-ctrl-geocoder mapboxgl-ctrl";var n=this.createIcon("search",'');this._inputEl=document.createElement("input"),this._inputEl.type="text",this._inputEl.className="mapboxgl-ctrl-geocoder--input",this.setPlaceholder(),this.options.collapsed&&(this._collapse(),this.container.addEventListener("mouseenter",this._unCollapse),this.container.addEventListener("mouseleave",this._collapse),this._inputEl.addEventListener("focus",this._unCollapse)),(this.options.collapsed||this.options.clearOnBlur)&&this._inputEl.addEventListener("blur",this._onBlur),this._inputEl.addEventListener("keydown",s(this._onKeyDown,200)),this._inputEl.addEventListener("paste",this._onPaste),this._inputEl.addEventListener("change",this._onChange),this.container.addEventListener("mouseenter",this._showButton),this.container.addEventListener("mouseleave",this._hideButton),this._inputEl.addEventListener("keyup",function(e){this.eventManager.keyevent(e,this)}.bind(this));var r=document.createElement("div");r.classList.add("mapboxgl-ctrl-geocoder--pin-right"),this._clearEl=document.createElement("button"),this._clearEl.setAttribute("aria-label","Clear"),this._clearEl.addEventListener("click",this.clear),this._clearEl.className="mapboxgl-ctrl-geocoder--button";var a=this.createIcon("close",'');if(this._clearEl.appendChild(a),this._loadingEl=this.createIcon("loading",''),r.appendChild(this._clearEl),r.appendChild(this._loadingEl),t.appendChild(n),t.appendChild(this._inputEl),t.appendChild(r),this.options.enableGeolocation&&this.geolocation.isSupport()){this._geolocateEl=document.createElement("button"),this._geolocateEl.setAttribute("aria-label","Geolocate"),this._geolocateEl.addEventListener("click",this._geolocateUser),this._geolocateEl.className="mapboxgl-ctrl-geocoder--button";var u=this.createIcon("geolocate",'');this._geolocateEl.appendChild(u),r.appendChild(this._geolocateEl),this._showGeolocateButton()}var c=this._typeahead=new o(this._inputEl,[],{filter:!1,minLength:this.options.minLength,limit:this.options.limit});this.setRenderFunction(this.options.render),c.getItemValue=this.options.getItemValue;var f=c.list.draw,d=this._footerNode=i();return c.list.draw=function(){f.call(this),d.addEventListener("mousedown",function(){this.selectingListItem=!0}.bind(this)),d.addEventListener("mouseup",function(){this.selectingListItem=!1}.bind(this)),this.element.appendChild(d)},this.mapMarker=null,this._handleMarker=this._handleMarker.bind(this),this._map&&(this.options.trackProximity&&(this._updateProximity(),this._map.on("moveend",this._updateProximity)),this._mapboxgl=this.options.mapboxgl,!this._mapboxgl&&this.options.marker&&(console.error("No mapboxgl detected in options. Map markers are disabled. Please set options.mapboxgl."),this.options.marker=!1)),t},_geolocateUser:function(){this._hideGeolocateButton(),this._showLoadingIcon(),this.geolocation.getCurrentPosition().then(function(e){this._hideLoadingIcon();var t={geometry:{type:"Point",coordinates:[e.coords.longitude,e.coords.latitude]}};this._handleMarker(t),this._fly(t),this._typeahead.clear(),this._typeahead.selected=!0,this.lastSelected=JSON.stringify(t),this._showClearButton(),this.fresh=!1;var n={limit:1,language:[this.options.language],query:t.geometry.coordinates,types:["address"]};if(this.options.localGeocoderOnly){var i=t.geometry.coordinates[0]+","+t.geometry.coordinates[1];this._setInputValue(i),this._eventEmitter.emit("result",{result:t})}else this.geocoderService.reverseGeocode(n).send().then(function(e){var n=e.body.features[0];if(n){var i=y.transformFeatureToGeolocationText(n,this.options.addressAccuracy);this._setInputValue(i),n.user_coordinates=t.geometry.coordinates,this._eventEmitter.emit("result",{result:n})}else this._eventEmitter.emit("result",{result:{user_coordinates:t.geometry.coordinates}})}.bind(this))}.bind(this)).catch(function(e){1===e.code?this._renderUserDeniedGeolocationError():this._renderLocationError(),this._hideLoadingIcon(),this._showGeolocateButton(),this._hideAttribution()}.bind(this))},createIcon:function(e,t){var n=document.createElementNS("http://www.w3.org/2000/svg","svg");return n.setAttribute("class","mapboxgl-ctrl-geocoder--icon mapboxgl-ctrl-geocoder--icon-"+e),n.setAttribute("viewBox","0 0 18 18"),n.setAttribute("xml:space","preserve"),n.setAttribute("width",18),n.setAttribute("height",18),n.innerHTML=t,n},onRemove:function(){return this.container.parentNode.removeChild(this.container),this.options.trackProximity&&this._map&&this._map.off("moveend",this._updateProximity),this._removeMarker(),this._map=null,this},_setInputValue:function(e){this._inputEl.value=e,setTimeout(function(){this._inputEl.focus(),this._inputEl.scrollLeft=0,this._inputEl.setSelectionRange(0,0)}.bind(this),1)},_onPaste:function(e){var t=(e.clipboardData||window.clipboardData).getData("text");t.length>=this.options.minLength&&this._geocode(t)},_onKeyDown:function(e){if(27===e.keyCode&&this.options.clearAndBlurOnEsc)return this._clear(e),this._inputEl.blur();var t=e.target&&e.target.shadowRoot?e.target.shadowRoot.activeElement:e.target;if(!(t?t.value:""))return this.fresh=!0,9!==e.keyCode&&this.clear(e),this._showGeolocateButton(),this._hideClearButton();this._hideGeolocateButton(),e.metaKey||-1!==[9,27,37,39,13,38,40].indexOf(e.keyCode)||t.value.length>=this.options.minLength&&this._geocode(t.value)},_showButton:function(){this._typeahead.selected&&this._showClearButton()},_hideButton:function(){this._typeahead.selected&&this._hideClearButton()},_showClearButton:function(){this._clearEl.style.display="block"},_hideClearButton:function(){this._clearEl.style.display="none"},_showGeolocateButton:function(){this._geolocateEl&&this.geolocation.isSupport()&&(this._geolocateEl.style.display="block")},_hideGeolocateButton:function(){this._geolocateEl&&(this._geolocateEl.style.display="none")},_showLoadingIcon:function(){this._loadingEl.style.display="block"},_hideLoadingIcon:function(){this._loadingEl.style.display="none"},_showAttribution:function(){this._footerNode.style.display="block"},_hideAttribution:function(){this._footerNode.style.display="none"},_onBlur:function(e){this.options.clearOnBlur&&this._clearOnBlur(e),this.options.collapsed&&this._collapse()},_onChange:function(){var e=this._typeahead.selected;e&&JSON.stringify(e)!==this.lastSelected&&(this._hideClearButton(),this.options.flyTo&&this._fly(e),this.options.marker&&this._mapboxgl&&this._handleMarker(e),this._inputEl.focus(),this._inputEl.scrollLeft=0,this._inputEl.setSelectionRange(0,0),this.lastSelected=JSON.stringify(e),this._eventEmitter.emit("result",{result:e}),this.eventManager.select(e,this))},_fly:function(e){var t;if(e.properties&&c[e.properties.short_code])t=a({},this.options.flyTo),this._map&&this._map.fitBounds(c[e.properties.short_code].bbox,t);else if(e.bbox){var n=e.bbox;t=a({},this.options.flyTo),this._map&&this._map.fitBounds([[n[0],n[1]],[n[2],n[3]]],t)}else{var i={zoom:this.options.zoom};t=a({},i,this.options.flyTo),e.center?t.center=e.center:e.geometry&&e.geometry.type&&"Point"===e.geometry.type&&e.geometry.coordinates&&(t.center=e.geometry.coordinates),this._map&&this._map.flyTo(t)}},_requestType:function(e,t){return e.localGeocoderOnly?m.LOCAL:e.reverseGeocode&&y.REVERSE_GEOCODE_COORD_RGX.test(t)?m.REVERSE:m.FORWARD},_setupConfig:function(e,t){var n=["bbox","limit","proximity","countries","types","language","reverseMode","mode","autocomplete","fuzzyMatch","routing","worldview"],i=/[\s,]+/,r=this,o=n.reduce(function(e,t){if(void 0===r.options[t]||null===r.options[t])return e;["countries","types","language"].indexOf(t)>-1?e[t]=r.options[t].split(i):e[t]=r.options[t];var n="number"==typeof r.options[t].longitude&&"number"==typeof r.options[t].latitude;if("proximity"===t&&n){var o=r.options[t].longitude,s=r.options[t].latitude;e[t]=[o,s]}return e},{});switch(e){case m.REVERSE:var s=t.split(i).map(function(e){return parseFloat(e,10)});r.options.flipCoordinates||s.reverse(),o.types&&o.types[0],o=a(o,{query:s,limit:1}),["proximity","autocomplete","fuzzyMatch","bbox"].forEach(function(e){e in o&&delete o[e]});break;case m.FORWARD:/^(-?\d{1,3}(\.\d{0,256})?)[, ]+(-?\d{1,3}(\.\d{0,256})?)?$/.test(t.trim())&&(t=t.replace(/,/g," ")),o=a(o,{query:t})}return o.session_token=this.eventManager.getSessionId(),o},_geocode:function(e){this.inputString=e,this._showLoadingIcon(),this._eventEmitter.emit("loading",{query:e});var t,n=this._requestType(this.options,e),i=this._setupConfig(n,e);switch(n){case m.LOCAL:t=Promise.resolve();break;case m.FORWARD:t=this.geocoderService.forwardGeocode(i).send();break;case m.REVERSE:t=this.geocoderService.reverseGeocode(i).send()}var r=this.options.localGeocoder?this.options.localGeocoder(e)||[]:[],o=[],s=null;return t.catch(function(e){s=e}.bind(this)).then(function(t){this._hideLoadingIcon();var n={};return t?"200"==t.statusCode&&(n=t.body,n.request=t.request,n.headers=t.headers,this._headers=t.headers):n={type:"FeatureCollection",features:[]},n.config=i,this.fresh&&(this.eventManager.start(this),this.fresh=!1),n.features&&n.features.length&&n.features.map(function(e){e._source="mapbox"}),n.features=n.features?r.concat(n.features):r,this.options.externalGeocoder?(o=this.options.externalGeocoder(e,n.features)||Promise.resolve([]),o.then(function(e){return n.features=n.features?e.concat(n.features):e,n},function(){return n})):n}.bind(this)).then(function(e){if(s)throw s;this.options.filter&&e.features.length&&(e.features=e.features.filter(this.options.filter)),e.features.length?(this._showClearButton(),this._hideGeolocateButton(),this._showAttribution(),this._eventEmitter.emit("results",e),this._typeahead.update(e.features)):(this._hideClearButton(),this._hideAttribution(),this._typeahead.selected=null,this._renderNoResults(),this._eventEmitter.emit("results",e))}.bind(this)).catch(function(e){this._hideLoadingIcon(),this._hideAttribution(),r.length&&this.options.localGeocoder||o.length&&this.options.externalGeocoder?(this._showClearButton(),this._hideGeolocateButton(),this._typeahead.update(r)):(this._hideClearButton(),this._typeahead.selected=null,this._renderError()),this._eventEmitter.emit("results",{features:r}),this._eventEmitter.emit("error",{error:e})}.bind(this)),t},_clear:function(e){e&&e.preventDefault(),this._inputEl.value="",this._typeahead.selected=null,this._typeahead.clear(),this.eventManager.sessionIncrementer++,this._onChange(),this._hideClearButton(),this._showGeolocateButton(),this._removeMarker(),this.lastSelected=null,this._eventEmitter.emit("clear"),this.fresh=!0},clear:function(e){this._clear(e),this._inputEl.focus()},_clearOnBlur:function(e){var t=this;e.relatedTarget&&t._clear(e)},_onQueryResult:function(e){var t=e.body;if(t.features.length){var n=t.features[0];this._typeahead.selected=n,this._inputEl.value=n.place_name,this._onChange()}},_updateProximity:function(){if(this._map&&this.options.trackProximity)if(this._map.getZoom()>9){var e=this._map.getCenter().wrap();this.setProximity({longitude:e.lng,latitude:e.lat},!1)}else this.setProximity(null,!1)},_collapse:function(){this._inputEl.value||this._inputEl===document.activeElement||this.container.classList.add("mapboxgl-ctrl-geocoder--collapsed")},_unCollapse:function(){this.container.classList.remove("mapboxgl-ctrl-geocoder--collapsed")},query:function(e){return this._geocode(e).then(this._onQueryResult),this},_renderError:function(){this._renderMessage("
There was an error reaching the server
")},_renderLocationError:function(){this._renderMessage("
A location error has occurred
")},_renderNoResults:function(){this._renderMessage("
No results found
")},_renderUserDeniedGeolocationError:function(){this._renderMessage("
Geolocation permission denied
")},_renderMessage:function(e){this._typeahead.update([]),this._typeahead.selected=null,this._typeahead.clear(),this._typeahead.renderError(e)},_getPlaceholderText:function(){if(this.options.placeholder)return this.options.placeholder;if(this.options.language){var e=this.options.language.split(",")[0],t=d.language(e),n=f.placeholder[t];if(n)return n}return"Search"},setInput:function(e,t){return void 0===t&&(t=!1),this._inputEl.value=e,this._typeahead.selected=null,this._typeahead.clear(),e.length>=this.options.minLength&&(t?this._geocode(e):this._onChange()),this},setProximity:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.options.proximity=e,t&&(this.options.trackProximity=!1),this},getProximity:function(){return this.options.proximity},setRenderFunction:function(e){return e&&"function"==typeof e&&(this._typeahead.render=e),this},getRenderFunction:function(){return this._typeahead.render},setLanguage:function(e){var t=navigator.language||navigator.userLanguage||navigator.browserLanguage;return this.options.language=e||this.options.language||t,this},getLanguage:function(){return this.options.language},getZoom:function(){return this.options.zoom},setZoom:function(e){return this.options.zoom=e,this},getFlyTo:function(){return this.options.flyTo},setFlyTo:function(e){return this.options.flyTo=e,this},getPlaceholder:function(){return this.options.placeholder},setPlaceholder:function(e){return this.options.placeholder=e||this._getPlaceholderText(),this._inputEl.placeholder=this.options.placeholder,this._inputEl.setAttribute("aria-label",this.options.placeholder),this},getBbox:function(){return this.options.bbox},setBbox:function(e){return this.options.bbox=e,this},getCountries:function(){return this.options.countries},setCountries:function(e){return this.options.countries=e,this},getTypes:function(){return this.options.types},setTypes:function(e){return this.options.types=e,this},getMinLength:function(){return this.options.minLength},setMinLength:function(e){return this.options.minLength=e,this._typeahead&&(this._typeahead.options.minLength=e),this},getLimit:function(){return this.options.limit},setLimit:function(e){return this.options.limit=e,this._typeahead&&(this._typeahead.options.limit=e),this},getFilter:function(){return this.options.filter},setFilter:function(e){return this.options.filter=e,this},setOrigin:function(e){return this.options.origin=e,this.geocoderService=h(l({accessToken:this.options.accessToken,origin:this.options.origin})),this},getOrigin:function(){return this.options.origin},setAccessToken:function(e){return this.options.accessToken=e,this.geocoderService=h(l({accessToken:this.options.accessToken,origin:this.options.origin})),this},setAutocomplete:function(e){return this.options.autocomplete=e,this},getAutocomplete:function(){return this.options.autocomplete},setFuzzyMatch:function(e){return this.options.fuzzyMatch=e,this},getFuzzyMatch:function(){return this.options.fuzzyMatch},setRouting:function(e){return this.options.routing=e,this},getRouting:function(){return this.options.routing},setWorldview:function(e){return this.options.worldview=e,this},getWorldview:function(){return this.options.worldview},_handleMarker:function(e){if(this._map){this._removeMarker();var t={color:"#4668F2"},n=a({},t,this.options.marker);return this.mapMarker=new this._mapboxgl.Marker(n),e.center?this.mapMarker.setLngLat(e.center).addTo(this._map):e.geometry&&e.geometry.type&&"Point"===e.geometry.type&&e.geometry.coordinates&&this.mapMarker.setLngLat(e.geometry.coordinates).addTo(this._map),this}},_removeMarker:function(){this.mapMarker&&(this.mapMarker.remove(),this.mapMarker=null)},on:function(e,t){return this._eventEmitter.on(e,t),this},off:function(e,t){return this._eventEmitter.removeListener(e,t),this.eventManager.remove(),this}},t.exports=r},{"./events":1,"./exceptions":2,"./geolocation":3,"./localization":5,"./utils":6,"@mapbox/mapbox-sdk":8,"@mapbox/mapbox-sdk/services/geocoding":19,events:27,"lodash.debounce":31,subtag:35,suggestions:36,xtend:39}],5:[function(e,t,n){"use strict";var i={de:"Suche",it:"Ricerca",en:"Search",nl:"Zoeken",fr:"Chercher",ca:"Cerca",he:"לחפש",ja:"サーチ",lv:"Meklēt",pt:"Procurar",sr:"Претрага",zh:"搜索",cs:"Vyhledávání",hu:"Keresés",ka:"ძიება",nb:"Søke",sk:"Vyhľadávanie",th:"ค้นหา",fi:"Hae",is:"Leita",ko:"수색",pl:"Szukaj",sl:"Iskanje",fa:"جستجو",ru:"Поиск"};t.exports={placeholder:i}},{}],6:[function(e,t,n){"use strict";function i(e,t){var n,i=r(e),o=["address","street","place","country"];if("function"==typeof t)return t(i);var s=o.indexOf(t);return n=-1===s?o:o.slice(s),n.reduce(function(e,t){return i[t]?(""!==e&&(e+=", "),e+i[t]):e},"")}function r(e){var t=e.address||"",n=e.text||"",i=e.place_name||"",r=i.split(",")[0],o={address:r,houseNumber:t,street:n,placeName:i};return e.context.forEach(function(e){var t=e.id.split(".")[0];o[t]=e.text}),o}var o=/^[ ]*(-?\d{1,3}(\.\d{0,256})?)[, ]+(-?\d{1,3}(\.\d{0,256})?)[ ]*$/;t.exports={transformFeatureToGeolocationText:i,getAddressInfo:r,REVERSE_GEOCODE_COORD_RGX:o}},{}],7:[function(e,t,n){"use strict";function i(e){var t=Array.isArray(e),n=function(n){return t?e[n]:e};return function(i){var o=r(g.plainArray,i);if(o)return o;if(t&&i.length!==e.length)return"an array with "+e.length+" items";for(var s=0;se.length?t:e})}},g.equal=function(e){return function(t){if(t!==e)return JSON.stringify(e)}},g.oneOf=function(){var e=Array.isArray(arguments[0])?arguments[0]:Array.prototype.slice.call(arguments),t=e.map(function(e){return g.equal(e)});return g.oneOfType.apply(this,t)},g.range=function(e){var t=e[0],n=e[1];return function(e){if(r(g.number,e)||en)return"number between "+t+" & "+n+" (inclusive)"}},g.any=function(){},g.boolean=function(e){if("boolean"!=typeof e)return"boolean"},g.number=function(e){if("number"!=typeof e)return"number"},g.plainArray=function(e){if(!Array.isArray(e))return"array"},g.plainObject=function(e){if(!p(e))return"object"},g.string=function(e){if("string"!=typeof e)return"string"},g.func=function(e){if("function"!=typeof e)return"function"},g.validate=r,g.processMessage=o,t.exports=g},{"is-plain-obj":30,xtend:39}],8:[function(e,t,n){"use strict";var i=e("./lib/client");t.exports=i},{"./lib/client":9}],9:[function(e,t,n){"use strict";function i(e){s.call(this,e)} function r(e){return new i(e)}var o=e("./browser-layer"),s=e("../classes/mapi-client");i.prototype=Object.create(s.prototype),i.prototype.constructor=i,i.prototype.sendRequest=o.browserSend,i.prototype.abortRequest=o.browserAbort,t.exports=r},{"../classes/mapi-client":11,"./browser-layer":10}],10:[function(e,t,n){"use strict";function i(e){var t=f[e.id];t&&(t.abort(),delete f[e.id])}function r(e,t){return new c(e,{body:t.response,headers:p(t.getAllResponseHeaders()),statusCode:t.status})}function o(e){var t=e.total,n=e.loaded;return{total:t,transferred:n,percent:100*n/t}}function s(e,t){return new Promise(function(n,i){t.onprogress=function(t){e.emitter.emit(h.EVENT_PROGRESS_DOWNLOAD,o(t))};var r=e.file;r&&(t.upload.onprogress=function(t){e.emitter.emit(h.EVENT_PROGRESS_UPLOAD,o(t))}),t.onerror=function(e){i(e)},t.onabort=function(){var t=new l({request:e,type:h.ERROR_REQUEST_ABORTED});i(t)},t.onload=function(){if(delete f[e.id],t.status<200||t.status>=400){var r=new l({request:e,body:t.response,statusCode:t.status});return void i(r)}n(t)};var s=e.body;"string"==typeof s?t.send(s):s?t.send(JSON.stringify(s)):r?t.send(r):t.send(),f[e.id]=t}).then(function(t){return r(e,t)})}function a(e,t){var n=e.url(t),i=new window.XMLHttpRequest;return i.open(e.method,n),Object.keys(e.headers).forEach(function(t){i.setRequestHeader(t,e.headers[t])}),i}function u(e){return Promise.resolve().then(function(){var t=a(e,e.client.accessToken);return s(e,t)})}var c=e("../classes/mapi-response"),l=e("../classes/mapi-error"),h=e("../constants"),p=e("../helpers/parse-headers"),f={};t.exports={browserAbort:i,sendRequestXhr:s,browserSend:u,createRequestXhr:a}},{"../classes/mapi-error":12,"../classes/mapi-response":14,"../constants":15,"../helpers/parse-headers":16}],11:[function(e,t,n){"use strict";function i(e){if(!e||!e.accessToken)throw new Error("Cannot create a client without an access token");r(e.accessToken),this.accessToken=e.accessToken,this.origin=e.origin||s.API_ORIGIN}var r=e("@mapbox/parse-mapbox-token"),o=e("./mapi-request"),s=e("../constants");i.prototype.createRequest=function(e){return new o(this,e)},t.exports=i},{"../constants":15,"./mapi-request":13,"@mapbox/parse-mapbox-token":25}],12:[function(e,t,n){"use strict";function i(e){var t,n=e.type||r.ERROR_HTTP;if(e.body)try{t=JSON.parse(e.body)}catch(n){t=e.body}else t=null;var i=e.message||null;i||("string"==typeof t?i=t:t&&"string"==typeof t.message?i=t.message:n===r.ERROR_REQUEST_ABORTED&&(i="Request aborted")),this.message=i,this.type=n,this.statusCode=e.statusCode||null,this.request=e.request,this.body=t}var r=e("../constants");t.exports=i},{"../constants":15}],13:[function(e,t,n){"use strict";function i(e,t){if(!e)throw new Error("MapiRequest requires a client");if(!t||!t.path||!t.method)throw new Error("MapiRequest requires an options object with path and method properties");var n={};t.body&&(n["content-type"]="application/json");var i=o(n,t.headers),r=Object.keys(i).reduce(function(e,t){return e[t.toLowerCase()]=i[t],e},{});this.id=c++,this._options=t,this.emitter=new s,this.client=e,this.response=null,this.error=null,this.sent=!1,this.aborted=!1,this.path=t.path,this.method=t.method,this.origin=t.origin||e.origin,this.query=t.query||{},this.params=t.params||{},this.body=t.body||null,this.file=t.file||null,this.encoding=t.encoding||"utf8",this.sendFileAs=t.sendFileAs||null,this.headers=r}var r=e("@mapbox/parse-mapbox-token"),o=e("xtend"),s=e("eventemitter3"),a=e("../helpers/url-utils"),u=e("../constants"),c=1;i.prototype.url=function(e){var t=a.prependOrigin(this.path,this.origin);t=a.appendQueryObject(t,this.query);var n=this.params,i=null==e?this.client.accessToken:e;if(i){t=a.appendQueryParam(t,"access_token",i);var s=r(i).user;n=o({ownerId:s},n)}return t=a.interpolateRouteParams(t,n),t},i.prototype.send=function(){var e=this;if(e.sent)throw new Error("This request has already been sent. Check the response and error properties. Create a new request with clone().");return e.sent=!0,e.client.sendRequest(e).then(function(t){return e.response=t,e.emitter.emit(u.EVENT_RESPONSE,t),t},function(t){throw e.error=t,e.emitter.emit(u.EVENT_ERROR,t),t})},i.prototype.abort=function(){this._nextPageRequest&&(this._nextPageRequest.abort(),delete this._nextPageRequest),this.response||this.error||this.aborted||(this.aborted=!0,this.client.abortRequest(this))},i.prototype.eachPage=function(e){function t(t){function n(){delete r._nextPageRequest;var e=t.nextPage();e&&(r._nextPageRequest=e,i(e))}e(null,t,n)}function n(t){e(t,null,function(){})}function i(e){e.send().then(t,n)}var r=this;i(this)},i.prototype.clone=function(){return this._extend()},i.prototype._extend=function(e){var t=o(this._options,e);return new i(this.client,t)},t.exports=i},{"../constants":15,"../helpers/url-utils":18,"@mapbox/parse-mapbox-token":25,eventemitter3:28,xtend:39}],14:[function(e,t,n){"use strict";function i(e,t){this.request=e,this.headers=t.headers,this.rawBody=t.body,this.statusCode=t.statusCode;try{this.body=JSON.parse(t.body||"{}")}catch(e){this.body=t.body}this.links=r(this.headers.link)}var r=e("../helpers/parse-link-header");i.prototype.hasNextPage=function(){return!!this.links.next},i.prototype.nextPage=function(){return this.hasNextPage()?this.request._extend({path:this.links.next.url}):null},t.exports=i},{"../helpers/parse-link-header":17}],15:[function(e,t,n){"use strict";t.exports={API_ORIGIN:"https://api.mapbox.com",EVENT_PROGRESS_DOWNLOAD:"downloadProgress",EVENT_PROGRESS_UPLOAD:"uploadProgress",EVENT_ERROR:"error",EVENT_RESPONSE:"response",ERROR_HTTP:"HttpError",ERROR_REQUEST_ABORTED:"RequestAbortedError"}},{}],16:[function(e,t,n){"use strict";function i(e){var t=e.indexOf(":");return{name:e.substring(0,t).trim().toLowerCase(),value:e.substring(t+1).trim()}}function r(e){var t={};return e?(e.trim().split(/[\r|\n]+/).forEach(function(e){var n=i(e);t[n.name]=n.value}),t):t}t.exports=r},{}],17:[function(e,t,n){"use strict";function i(e){var t=e.match(/\s*(.+)\s*=\s*"?([^"]+)"?/);return t?{key:t[1],value:t[2]}:null}function r(e){var t=e.match(/]*)>(.*)/);if(!t)return null;var n=t[1],r=t[2].split(";"),o=null,s=r.reduce(function(e,t){var n=i(t);return n?"rel"===n.key?(o||(o=n.value),e):(e[n.key]=n.value,e):e},{});return o?{url:n,rel:o,params:s}:null}function o(e){return e?e.split(/,\s*>(-2*r&6)));return o},d=function(e){e=String(e),/[^\0-\xFF]/.test(e)&&l("The string to be encoded contains characters outside of the Latin1 range.");for(var t,n,i,r,o=e.length%3,s="",a=-1,u=e.length-o;++a>18&63)+h.charAt(r>>12&63)+h.charAt(r>>6&63)+h.charAt(63&r);return 2==o?(t=e.charCodeAt(a)<<8,n=e.charCodeAt(++a),r=t+n,s+=h.charAt(r>>10)+h.charAt(r>>4&63)+h.charAt(r<<2&63)+"="):1==o&&(r=e.charCodeAt(a),s+=h.charAt(r>>2)+h.charAt(r<<4&63)+"=="),s},g={encode:d,decode:f,version:"0.1.0"};if("function"==typeof e&&"object"==r(e.amd)&&e.amd)e(function(){return g});else if(s&&!s.nodeType)if(a)a.exports=g;else for(var y in g)g.hasOwnProperty(y)&&(s[y]=g[y]);else o.base64=g}(void 0)}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],27:[function(e,t,n){"use strict";function i(e){"@babel/helpers - typeof";return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=w(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}function o(e){return void 0===e._maxListeners?r.defaultMaxListeners:e._maxListeners}function s(e,t,n){if(t)e.call(n);else for(var i=e.length,r=m(e,i),o=0;o0&&u.length>s){u.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+u.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=u.length,"object"===("undefined"==typeof console?"undefined":i(console))&&console.warn&&console.warn("%s: %s",c.name,c.message)}}else u=a[t]=n,++e._eventsCount;return e}function p(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=new Array(arguments.length),t=0;t1&&(t=arguments[1]),t instanceof Error)throw t;var f=new Error('Unhandled "error" event. ('+t+")");throw f.context=t,f}if(!(n=h[e]))return!1;var d="function"==typeof n;switch(i=arguments.length){case 1:s(n,d,this);break;case 2:a(n,d,this,arguments[1]);break;case 3:u(n,d,this,arguments[1],arguments[2]);break;case 4:c(n,d,this,arguments[1],arguments[2],arguments[3]);break;default:for(r=new Array(i-1),o=1;o=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,r=o;break}if(r<0)return this;0===r?n.shift():y(n,r),1===n.length&&(i[e]=n[0]),i.removeListener&&this.emit("removeListener",e,s||t)}return this},r.prototype.removeAllListeners=function(e){var t,n,i;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=w(null),this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=w(null):delete n[e]),this;if(0===arguments.length){var r,o=E(n);for(i=0;i=0;i--)this.removeListener(e,t[i]);return this},r.prototype.listeners=function(e){return d(this,e,!0)},r.prototype.rawListeners=function(e){return d(this,e,!1)},r.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):g.call(e,t)},r.prototype.listenerCount=g,r.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],28:[function(e,t,n){"use strict";function i(){}function r(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new r(n,i||e,o),a=c?c+t:t;return e._events[a]?e._events[a].fn?e._events[a]=[e._events[a],s]:e._events[a].push(s):(e._events[a]=s,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function a(){this._events=new i,this._eventsCount=0}var u=Object.prototype.hasOwnProperty,c="~";Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(c=!1)),a.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)u.call(e,t)&&n.push(c?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},a.prototype.listeners=function(e){var t=c?c+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,r=n.length,o=new Array(r);i=t||n<0||k&&i>=m}function l(){var e=E();if(c(e))return h(e);b=setTimeout(l,s(e))}function h(e){return b=void 0,S&&g?i(e):(g=y=void 0,v)}function p(){void 0!==b&&clearTimeout(b),O=0,g=_=y=b=void 0}function f(){return void 0===b?v:h(E())}function d(){var e=E(),n=c(e);if(g=arguments,y=this,_=e,n){if(void 0===b)return o(_);if(k)return b=setTimeout(l,t),i(_)}return void 0===b&&(b=setTimeout(l,t)),v}var g,y,m,v,b,_,O=0,L=!1,k=!1,S=!0;if("function"!=typeof e)throw new TypeError(u);return t=a(t)||0,r(n)&&(L=!!n.leading,k="maxWait"in n,m=k?x(a(n.maxWait)||0,t):m,S="trailing"in n?!!n.trailing:S),d.cancel=p,d.flush=f,d}function r(e){var t=n(e);return!!e&&("object"==t||"function"==t)}function o(e){return!!e&&"object"==n(e)}function s(e){return"symbol"==n(e)||o(e)&&_.call(e)==l}function a(e){if("number"==typeof e)return e;if(s(e))return c;if(r(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=r(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(h,"");var n=f.test(e);return n||d.test(e)?g(e.slice(2),n?2:8):p.test(e)?c:+e}var u="Expected a function",c=NaN,l="[object Symbol]",h=/^\s+|\s+$/g,p=/^[-+]0x[0-9a-f]+$/i,f=/^0b[01]+$/i,d=/^0o[0-7]+$/i,g=parseInt,y="object"==(void 0===e?"undefined":n(e))&&e&&e.Object===Object&&e,m="object"==("undefined"==typeof self?"undefined":n(self))&&self&&self.Object===Object&&self,v=y||m||Function("return this")(),b=Object.prototype,_=b.toString,x=Math.max,w=Math.min,E=function(){return v.Date.now()};t.exports=i}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],32:[function(e,t,n){(function(n){(function(){"use strict";var i=e("./url-alphabet/index.cjs"),r=i.urlAlphabet;if("production"!==n.env.NODE_ENV){if("undefined"!=typeof navigator&&"ReactNative"===navigator.product&&"undefined"==typeof crypto)throw new Error("React Native does not have a built-in secure random generator. If you don’t need unpredictable IDs use `nanoid/non-secure`. For secure IDs, import `react-native-get-random-values` before Nano ID.");if("undefined"!=typeof msCrypto&&"undefined"==typeof crypto)throw new Error("Import file with `if (!window.crypto) window.crypto = window.msCrypto` before importing Nano ID to fix IE 11 support");if("undefined"==typeof crypto)throw new Error("Your browser does not have secure random generator. If you don’t need unpredictable IDs, you can use nanoid/non-secure.")}var o=function(e){return crypto.getRandomValues(new Uint8Array(e))},s=function(e,t,n){var i=(2<0&&void 0!==arguments[0]?arguments[0]:21,t="",n=crypto.getRandomValues(new Uint8Array(e));e--;){var i=63&n[e];t+=i<36?i.toString(36):i<62?(i-26).toString(36).toUpperCase():i<63?"_":"-"}return t};t.exports={nanoid:u,customAlphabet:a,customRandom:s,urlAlphabet:r,random:o}}).call(this)}).call(this,e("_process"))},{"./url-alphabet/index.cjs":33,_process:34}],33:[function(e,t,n){"use strict";t.exports={urlAlphabet:"useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"}},{}],34:[function(e,t,n){"use strict";function i(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(e){if(h===setTimeout)return setTimeout(e,0);if((h===i||!h)&&setTimeout)return h=setTimeout,setTimeout(e,0);try{return h(e,0)}catch(t){try{return h.call(null,e,0)}catch(t){return h.call(this,e,0)}}}function s(e){if(p===clearTimeout)return clearTimeout(e);if((p===r||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(e);try{return p(e)}catch(t){try{return p.call(null,e)}catch(t){return p.call(this,e)}}}function a(){y&&d&&(y=!1,d.length?g=d.concat(g):m=-1,g.length&&u())}function u(){if(!y){var e=o(a);y=!0;for(var t=g.length;t;){for(d=g,g=[];++m1)for(var n=1;n-1},s.prototype.value=function(e){if(this.selected=e,this.el.value=this.getItemValue(e),document.createEvent){var t=document.createEvent("HTMLEvents");t.initEvent("change",!0,!1),this.el.dispatchEvent(t)}else this.el.fireEvent("onchange")},s.prototype.getCandidates=function(e){var t,n={pre:"",post:"",extract:function(e){return this.getItemValue(e)}.bind(this)};this.options.filter?(t=r.filter(this.query,this.data,n),t=t.map(function(e){return{original:e.original,string:this.render(e.original,e.string)}}.bind(this))):t=this.data.map(function(e){return{original:e,string:this.render(e)}}.bind(this)),e(t)},s.prototype.getItemValue=function(e){return e},s.prototype.render=function(e,t){if(t)return t;for(var n=e.original?this.getItemValue(e.original):this.getItemValue(e),i=this.normalize(n),r=i.lastIndexOf(this.query);r>-1;){var o=r+this.query.length;n=n.slice(0,r)+""+n.slice(r,o)+""+n.slice(o),r=i.slice(0,r).lastIndexOf(this.query)}return n},s.prototype.renderError=function(e){this.list.drawError(e)},t.exports=s},{"./list":37,fuzzy:29,xtend:39}],39:[function(e,t,n){"use strict";function i(){for(var e={},t=0;t