!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.MaplibreGeocoder=t()}}(function(){return function(){function t(e,i,n){function s(o,l){if(!i[o]){if(!e[o]){var a="function"==typeof require&&require;if(!l&&a)return a(o,!0);if(r)return r(o,!0);var h=new Error("Cannot find module '"+o+"'");throw h.code="MODULE_NOT_FOUND",h}var u=i[o]={exports:{}};e[o][0].call(u.exports,function(t){return s(e[o][1][t]||t)},u,u.exports,t,e,i,n)}return i[o].exports}for(var r="function"==typeof require&&require,o=0;o
'+e[0]+'
'+e.splice(1,e.length).join(",")+"
"}var i=t.text,n=i.toLowerCase().indexOf(this.query.toLowerCase()),s=this.query.length;return'
'+i.substring(0,n)+''+i.substring(n,n+s)+""+i.substring(n+s)+"
"},popupRender:function(t){var e=t.place_name.split(",");return'"},showResultMarkers:!0,debounceSearch:200},addTo:function(t){function e(t,e){if(!document.body.contains(e))throw new Error("Element provided to #addTo() exists, but is not in the DOM");var i=t.onAdd();e.appendChild(i)}if(t._controlContainer)t.addControl(this);else if(t instanceof HTMLElement)e(this,t);else{if("string"!=typeof t)throw new Error("Error: addTo must be a maplibre-gl-js map, an html element, or a CSS selector query for a single html element");var i=document.querySelectorAll(t);if(0===i.length)throw new Error("Element ",t,"not found.");if(i.length>1)throw new Error("Geocoder can only be added to a single html element");e(this,i[0])}},onAdd:function(t){if(t&&"string"!=typeof t&&(this._map=t),this.setLanguage(),this.options.localGeocoderOnly&&!this.options.localGeocoder)throw new Error("A localGeocoder function must be specified to use localGeocoderOnly mode");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);var e=this.container=document.createElement("div");e.className="mapboxgl-ctrl-geocoder mapboxgl-ctrl maplibregl-ctrl-geocoder maplibregl-ctrl";var i=this.createIcon("search",'');this._inputEl=document.createElement("input"),this._inputEl.type="text",this._inputEl.className="mapboxgl-ctrl-geocoder--input maplibregl-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",r(this._onKeyDown,this.options.debounceSearch)),this._inputEl.addEventListener("paste",this._onPaste),this._inputEl.addEventListener("change",this._onChange),this.container.addEventListener("mouseenter",this._showButton),this.container.addEventListener("mouseleave",this._hideButton);var n=document.createElement("div");n.classList.add("mapboxgl-ctrl-geocoder--pin-right","maplibregl-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 maplibregl-ctrl-geocoder--button";var o=this.createIcon("close",'');return this._clearEl.appendChild(o),this._loadingEl=this.createIcon("loading",''),n.appendChild(this._clearEl),n.appendChild(this._loadingEl),e.appendChild(i),e.appendChild(this._inputEl),e.appendChild(n),this._typeahead=new s(this._inputEl,[],{filter:!1,minLength:this.options.minLength,limit:this.options.limit,noInitialSelection:!0}),this.setRenderFunction(this.options.render),this._typeahead.getItemValue=this.options.getItemValue,this.mapMarker=null,this.resultMarkers=[],this._handleMarker=this._handleMarker.bind(this),this._handleResultMarkers=this._handleResultMarkers.bind(this),this._map&&(this.options.trackProximity&&(this._updateProximity(),this._map.on("moveend",this._updateProximity)),this._maplibregl=this.options.maplibregl,!this._maplibregl&&this.options.marker&&(console.error("No maplibregl detected in options. Map markers are disabled. Please set options.maplibregl."),this.options.marker=!1)),e},createIcon:function(t,e){var i=document.createElementNS("http://www.w3.org/2000/svg","svg");if(i.setAttribute("class","mapboxgl-ctrl-geocoder--icon mapboxgl-ctrl-geocoder--icon-"+t+" maplibregl-ctrl-geocoder--icon maplibregl-ctrl-geocoder--icon-"+t),i.setAttribute("viewBox","0 0 18 18"),i.setAttribute("xml:space","preserve"),i.setAttribute("width",18),i.setAttribute("height",18),"innerHTML"in i)i.innerHTML=e;else{var n=document.createElement("div");n.innerHTML=""+e.valueOf().toString()+"";var s=n.firstChild,r=s.firstChild;i.appendChild(r)}return i},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},_onPaste:function(t){var e=(t.clipboardData||window.clipboardData).getData("text");e.length>=this.options.minLength&&this.options.showResultsWhileTyping&&this._geocode(e)},_onKeyDown:function(t){if(27===t.keyCode&&this.options.clearAndBlurOnEsc)return this._clear(t),this._inputEl.blur();var e=t.target&&t.target.shadowRoot?t.target.shadowRoot.activeElement:t.target;if(!(e?e.value:""))return this.fresh=!0,9!==t.keyCode&&this.clear(t),this._clearEl.style.display="none";if(!t.metaKey&&-1===[9,27,37,39,38,40].indexOf(t.keyCode)){if(13===t.keyCode){if(this.options.showResultsWhileTyping)return void(null==this._typeahead.selected&&this.geocoderApi.getSuggestions?this._geocode(e.value,!0):null==this._typeahead.selected&&this.options.showResultMarkers&&this._fitBoundsForMarkers());this._typeahead.selected||this._geocode(e.value)}e.value.length>=this.options.minLength&&this.options.showResultsWhileTyping&&this._geocode(e.value)}},_showButton:function(){this._inputEl.value.length>0&&(this._clearEl.style.display="block")},_hideButton:function(){this._typeahead.selected&&(this._clearEl.style.display="none")},_onBlur:function(t){this.options.clearOnBlur&&this._clearOnBlur(t),this.options.collapsed&&this._collapse()},_onChange:function(){var t=this._typeahead.selected;if(t&&!t.geometry)t.placeId?this._geocode(t.placeId,!0,!0):this._geocode(t.text,!0);else if(t&&JSON.stringify(t)!==this.lastSelected){if(this._clearEl.style.display="none",this.options.flyTo){var e;if(this._removeResultMarkers(),t.properties&&a[t.properties.short_code])e=o({},this.options.flyTo),this._map&&this._map.fitBounds(a[t.properties.short_code].bbox,e);else if(t.bbox){var i=t.bbox;e=o({},this.options.flyTo),this._map&&this._map.fitBounds([[i[0],i[1]],[i[2],i[3]]],e)}else{var n={zoom:this.options.zoom};e=o({},n,this.options.flyTo),t.center?e.center=t.center:t.geometry&&t.geometry.type&&"Point"===t.geometry.type&&t.geometry.coordinates&&(e.center=t.geometry.coordinates),this._map&&this._map.flyTo(e)}}this.options.marker&&this._maplibregl&&this._handleMarker(t),this._inputEl.focus(),this._inputEl.scrollLeft=0,this._inputEl.setSelectionRange(0,0),this.lastSelected=JSON.stringify(t),this._typeahead.selected=null,this._eventEmitter.emit("result",{result:t})}},_getConfigForRequest:function(){var t=["bbox","limit","proximity","countries","types","language","reverseMode"],e=this;return t.reduce(function(t,i){return e.options[i]&&(["countries","types","language"].indexOf(i)>-1?t[i]=e.options[i].split(/[\s,]+/):t[i]=e.options[i],"proximity"===i&&e.options[i]&&"number"==typeof e.options[i].longitude&&"number"==typeof e.options[i].latitude&&(t[i]=[e.options[i].longitude,e.options[i].latitude])),t},{})},_geocode:function(t,e,i){this._loadingEl.style.display="block",this._eventEmitter.emit("loading",{query:t}),this.inputString=t;var n,s=null,r=this._getConfigForRequest();if(this.options.localGeocoderOnly)n=Promise.resolve();else if(this.options.reverseGeocode&&/(-?\d+\.?\d*)[, ]+(-?\d+\.?\d*)[ ]*$/.test(t)){var l=t.split(/[\s(,)?]+/).map(function(t){return parseFloat(t,10)}).reverse();r.types&&r.types[0],r=o(r,{query:l,limit:1}),"proximity"in r&&delete r.proximity,n=this.geocoderApi.reverseGeocode(r)}else r=o(r,{query:t}),n=this.geocoderApi.getSuggestions?e?this.geocoderApi.searchByPlaceId&&i?this.geocoderApi.searchByPlaceId(r):this.geocoderApi.forwardGeocode(r):this.geocoderApi.getSuggestions(r):this.geocoderApi.forwardGeocode(r);var a=[];this.options.localGeocoder&&((a=this.options.localGeocoder(t))||(a=[]));var h=[];return n.catch(function(t){s=t}.bind(this)).then(function(e){this._loadingEl.style.display="none";var i={};return i=e||{type:"FeatureCollection",features:[]},i.config=r,this.fresh&&(this.fresh=!1),i.features=i.features?a.concat(i.features):a,this.options.externalGeocoder?(h=this.options.externalGeocoder(t,i.features,r)||[],h.then(function(t){return i.features=i.features?t.concat(i.features):t,i},function(){return i})):i}.bind(this)).then(function(t){if(s)throw s;this.options.filter&&t.features.length&&(t.features=t.features.filter(this.options.filter));var i=[];i=t.suggestions?t.suggestions:t.place?[t.place]:t.features,i.length?(this._clearEl.style.display="block",this._typeahead.update(i),(!this.options.showResultsWhileTyping||e)&&this.options.showResultMarkers&&(t.features.length>0||t.place)&&this._fitBoundsForMarkers(),this._eventEmitter.emit("results",t)):(this._clearEl.style.display="none",this._typeahead.selected=null,this._renderNoResults(),this._eventEmitter.emit("results",t))}.bind(this)).catch(function(t){this._loadingEl.style.display="none",a.length&&this.options.localGeocoder||h.length&&this.options.externalGeocoder?(this._clearEl.style.display="block",this._typeahead.update(a)):(this._clearEl.style.display="none",this._typeahead.selected=null,this._renderError()),this._eventEmitter.emit("results",{features:a}),this._eventEmitter.emit("error",{error:t})}.bind(this)),n},_clear:function(t){t&&t.preventDefault(),this._inputEl.value="",this._typeahead.selected=null,this._typeahead.clear(),this._onChange(),this._clearEl.style.display="none",this._removeMarker(),this._removeResultMarkers(),this.lastSelected=null,this._eventEmitter.emit("clear"),this.fresh=!0},clear:function(t){this._clear(t),this._inputEl.focus()},_clearOnBlur:function(t){var e=this;t.relatedTarget&&e._clear(t)},_onQueryResult:function(t){var e=t;if(e.features.length){var i=e.features[0];this._typeahead.selected=i,this._inputEl.value=i.place_name,this._onChange()}},_updateProximity:function(){if(this._map)if(this._map.getZoom()>9){var t=this._map.getCenter().wrap();this.setProximity({longitude:t.lng,latitude:t.lat})}else this.setProximity(null)},_collapse:function(){this._inputEl.value||this._inputEl===document.activeElement||this.container.classList.add("mapboxgl-ctrl-geocoder--collapsed","maplibregl-ctrl-geocoder--collapsed")},_unCollapse:function(){this.container.classList.remove("mapboxgl-ctrl-geocoder--collapsed","maplibregl-ctrl-geocoder--collapsed")},query:function(t){return this._geocode(t).then(this._onQueryResult),this},_renderError:function(){this._renderMessage("
There was an error reaching the server
")},_renderNoResults:function(){this._renderMessage("
No results found
")},_renderMessage:function(t){this._typeahead.update([]),this._typeahead.selected=null,this._typeahead.clear(),this._typeahead.renderError(t)},_getPlaceholderText:function(){if(this.options.placeholder)return this.options.placeholder;if(this.options.language){var t=this.options.language.split(",")[0],e=u.language(t),i=h.placeholder[e];if(i)return i}return"Search"},_fitBoundsForMarkers:function(){if(!(this._typeahead.data.length<1)){var t=this._typeahead.data.filter(function(t){return"string"!=typeof t}).slice(0,this.options.limit);if(this._clearEl.style.display="none",this.options.flyTo&&this._maplibregl&&this._map){var e={padding:100},i=o({},e,this.options.flyTo),n=new this._maplibregl.LngLatBounds;t.forEach(function(t){n.extend(t.geometry.coordinates)}),this._map.fitBounds(n.toArray(),i)}return t.length>0&&this._maplibregl&&this._handleResultMarkers(t),this}},setInput:function(t){return this._inputEl.value=t,this._typeahead.selected=null,this._typeahead.clear(),t.length>=this.options.minLength&&this.options.showResultsWhileTyping&&this._geocode(t),this},setProximity:function(t){return this.options.proximity=t,this},getProximity:function(){return this.options.proximity},setRenderFunction:function(t){return t&&"function"==typeof t&&(this._typeahead.render=t),this},getRenderFunction:function(){return this._typeahead.render},setLanguage:function(t){var e=navigator.language||navigator.userLanguage||navigator.browserLanguage;return this.options.language=t||this.options.language||e,this},getLanguage:function(){return this.options.language},getZoom:function(){return this.options.zoom},setZoom:function(t){return this.options.zoom=t,this},getFlyTo:function(){return this.options.flyTo},setFlyTo:function(t){return this.options.flyTo=t,this},getPlaceholder:function(){return this.options.placeholder},setPlaceholder:function(t){return this.placeholder=t||this._getPlaceholderText(),this._inputEl.placeholder=this.placeholder,this._inputEl.setAttribute("aria-label",this.placeholder),this},getBbox:function(){return this.options.bbox},setBbox:function(t){return this.options.bbox=t,this},getCountries:function(){return this.options.countries},setCountries:function(t){return this.options.countries=t,this},getTypes:function(){return this.options.types},setTypes:function(t){return this.options.types=t,this},getMinLength:function(){return this.options.minLength},setMinLength:function(t){return this.options.minLength=t,this._typeahead&&(this._typeahead.options.minLength=t),this},getLimit:function(){return this.options.limit},setLimit:function(t){return this.options.limit=t,this._typeahead&&(this._typeahead.options.limit=t),this},getFilter:function(){return this.options.filter},setFilter:function(t){return this.options.filter=t,this},setGeocoderApi:function(t){return this.geocoderApi=t,this},getGeocoderApi:function(){return this.geocoderApi},_handleMarker:function(t){if(this._map){this._removeMarker();var e={color:"#4668F2"},i=o({},e,this.options.marker);this.mapMarker=new this._maplibregl.Marker(i);var n;if(this.options.popup){var s={},r=o({},s,this.options.popup);n=new this._maplibregl.Popup(r).setHTML(this.options.popupRender(t))}return t.center?(this.mapMarker.setLngLat(t.center).addTo(this._map),this.options.popup&&this.mapMarker.setPopup(n)):t.geometry&&t.geometry.type&&"Point"===t.geometry.type&&t.geometry.coordinates&&(this.mapMarker.setLngLat(t.geometry.coordinates).addTo(this._map),this.options.popup&&this.mapMarker.setPopup(n)),this}},_removeMarker:function(){this.mapMarker&&(this.mapMarker.remove(),this.mapMarker=null)},_handleResultMarkers:function(t){if(this._map){this._removeResultMarkers();var e={color:"#4668F2"},i=o({},e,this.options.showResultMarkers);return t.forEach(function(t){if(this.options.showResultMarkers&&this.options.showResultMarkers.element){var e=this.options.showResultMarkers.element.cloneNode(!0);i=o(i,{element:e})}var n,s=new this._maplibregl.Marker(o({},i,{element:e}));if(this.options.popup){var r={},l=o({},r,this.options.popup);n=new this._maplibregl.Popup(l).setHTML(this.options.popupRender(t))}t.center?(s.setLngLat(t.center).addTo(this._map),this.options.popup&&s.setPopup(n)):t.geometry&&t.geometry.type&&"Point"===t.geometry.type&&t.geometry.coordinates&&(s.setLngLat(t.geometry.coordinates).addTo(this._map),this.options.popup&&s.setPopup(n)),this.resultMarkers.push(s)}.bind(this)),this}},_removeResultMarkers:function(){this.resultMarkers&&this.resultMarkers.length>0&&(this.resultMarkers.forEach(function(t){t.remove()}),this.resultMarkers=[])},on:function(t,e){return this._eventEmitter.on(t,e),this},off:function(t,e){return this._eventEmitter.removeListener(t,e),this}},e.exports=n},{"./exceptions":1,"./localization":3,events:4,"lodash.debounce":6,subtag:7,"suggestions-list":8,xtend:11}],3:[function(t,e,i){"use strict";var n={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:"Поиск"};e.exports={placeholder:n}},{}],4:[function(t,e,i){function n(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=w(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}function s(t){return void 0===t._maxListeners?n.defaultMaxListeners:t._maxListeners}function r(t,e,i){if(e)t.call(i);else for(var n=t.length,s=m(t,n),r=0;r0&&l.length>r){l.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+l.length+' "'+String(e)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=l.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",a.name,a.message)}}else l=o[e]=i,++t._eventsCount;return t}function c(){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 t=new Array(arguments.length),e=0;e1&&(e=arguments[1]),e instanceof Error)throw e;var d=new Error('Unhandled "error" event. ('+e+")");throw d.context=e,d}if(!(i=c[t]))return!1;var f="function"==typeof i;switch(n=arguments.length){case 1:r(i,f,this);break;case 2:o(i,f,this,arguments[1]);break;case 3:l(i,f,this,arguments[1],arguments[2]);break;case 4:a(i,f,this,arguments[1],arguments[2],arguments[3]);break;default:for(s=new Array(n-1),u=1;u=0;r--)if(i[r]===e||i[r].listener===e){o=i[r].listener,s=r;break}if(s<0)return this;0===s?i.shift():g(i,s),1===i.length&&(n[t]=i[0]),n.removeListener&&this.emit("removeListener",t,o||e)}return this},n.prototype.removeAllListeners=function(t){var e,i,n;if(!(i=this._events))return this;if(!i.removeListener)return 0===arguments.length?(this._events=w(null),this._eventsCount=0):i[t]&&(0==--this._eventsCount?this._events=w(null):delete i[t]),this;if(0===arguments.length){var s,r=x(i);for(n=0;n=0;n--)this.removeListener(t,e[n]);return this},n.prototype.listeners=function(t){return d(this,t,!0)},n.prototype.rawListeners=function(t){return d(this,t,!1)},n.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):f.call(t,e)},n.prototype.listenerCount=f,n.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],5:[function(t,e,i){!function(){var t=this,n={};void 0!==i?e.exports=n:t.fuzzy=n,n.simpleFilter=function(t,e){return e.filter(function(e){return n.test(t,e)})},n.test=function(t,e){return null!==n.match(t,e)},n.match=function(t,e,i){i=i||{};var n,s=0,r=[],o=e.length,l=0,a=0,h=i.pre||"",u=i.post||"",c=i.caseSensitive&&e||e.toLowerCase();t=i.caseSensitive&&t||t.toLowerCase();for(var p=0;p=e||i<0||C&&n>=v}function u(){var t=x();if(h(t))return c(t);_=setTimeout(u,a(t))}function c(t){return _=void 0,M&&g?s(t):(g=m=void 0,y)}function p(){void 0!==_&&clearTimeout(_),L=0,g=E=m=_=void 0}function d(){return void 0===_?y:c(x())}function f(){var t=x(),i=h(t);if(g=arguments,m=this,E=t,i){if(void 0===_)return r(E);if(C)return _=setTimeout(u,e),s(E)}return void 0===_&&(_=setTimeout(u,e)),y}var g,m,v,y,_,E,L=0,k=!1,C=!1,M=!0;if("function"!=typeof t)throw new TypeError(l);return e=o(e)||0,n(i)&&(k=!!i.leading,C="maxWait"in i,v=C?b(o(i.maxWait)||0,e):v,M="trailing"in i?!!i.trailing:M),f.cancel=p,f.flush=d,f}function n(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function s(t){return!!t&&"object"==typeof t}function r(t){return"symbol"==typeof t||s(t)&&_.call(t)==h}function o(t){if("number"==typeof t)return t;if(r(t))return a;if(n(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=n(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(u,"");var i=p.test(t);return i||d.test(t)?f(t.slice(2),i?2:8):c.test(t)?a:+t}var l="Expected a function",a=NaN,h="[object Symbol]",u=/^\s+|\s+$/g,c=/^[-+]0x[0-9a-f]+$/i,p=/^0b[01]+$/i,d=/^0o[0-7]+$/i,f=parseInt,g="object"==typeof t&&t&&t.Object===Object&&t,m="object"==typeof self&&self&&self.Object===Object&&self,v=g||m||Function("return this")(),y=Object.prototype,_=y.toString,b=Math.max,w=Math.min,x=function(){return v.Date.now()};e.exports=i}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],7:[function(t,e,i){!function(t,i,n){void 0!==e&&e.exports?e.exports=n():t.subtag=n()}(this,0,function(){function t(t){return t.match(o)||[]}function e(e){return t(e).filter(function(t,e){return t&&e})}function i(e){return e=t(e),{language:e[1]||r,extlang:e[2]||r,script:e[3]||r,region:e[4]||r}}function n(t,e,i){Object.defineProperty(t,e,{value:i,enumerable:!0})}function s(e,s,o){function l(i){return t(i)[e]||r}n(l,"pattern",s),n(i,o,l)}var r="",o=/^([a-zA-Z]{2,3})(?:[_-]+([a-zA-Z]{3})(?=$|[_-]+))?(?:[_-]+([a-zA-Z]{4})(?=$|[_-]+))?(?:[_-]+([a-zA-Z]{2}|[0-9]{3})(?=$|[_-]+))?/;return s(1,/^[a-zA-Z]{2,3}$/,"language"),s(2,/^[a-zA-Z]{3}$/,"extlang"),s(3,/^[a-zA-Z]{4}$/,"script"),s(4,/^[a-zA-Z]{2}$|^[0-9]{3}$/,"region"),n(i,"split",e),i})},{}],8:[function(t,e,i){"use strict";var n=t("./src/suggestions");e.exports=n,"undefined"!=typeof window&&(window.Suggestions=n)},{"./src/suggestions":10}],9:[function(t,e,i){"use strict";var n=function(t){return this.component=t,this.items=[],this.active=t.options.noInitialSelection?-1:0,this.wrapper=document.createElement("div"),this.wrapper.className="suggestions-wrapper",this.element=document.createElement("ul"),this.element.className="suggestions",this.wrapper.appendChild(this.element),this.selectingListItem=!1,t.el.parentNode.insertBefore(this.wrapper,t.el.nextSibling),this};n.prototype.show=function(){this.element.style.display="block"},n.prototype.hide=function(){this.element.style.display="none"},n.prototype.add=function(t){this.items.push(t)},n.prototype.clear=function(){this.items=[],this.active=this.component.options.noInitialSelection?-1:0},n.prototype.isEmpty=function(){return!this.items.length},n.prototype.isVisible=function(){return"block"===this.element.style.display},n.prototype.draw=function(){if(this.element.innerHTML="", 0===this.items.length)return void this.hide();for(var t=0;t=this.items.length-1?0:this.active+1)},n.prototype.drawError=function(t){var e=document.createElement("li");e.innerHTML=t,this.element.appendChild(e),this.show()},e.exports=n},{}],10:[function(t,e,i){"use strict";var n=t("xtend"),s=t("fuzzy"),r=t("./list"),o=function(t,e,i){return i=i||{},this.options=n({minLength:2,limit:5,filter:!0,hideOnBlur:!0,noInitialSelection:!0},i),this.el=t,this.data=e||[],this.list=new r(this),this.query="",this.selected=null,this.list.draw(),this.el.addEventListener("keyup",function(t){this.handleKeyUp(t.keyCode,t)}.bind(this),!1),this.el.addEventListener("keydown",function(t){this.handleKeyDown(t)}.bind(this)),this.el.addEventListener("focus",function(){this.handleFocus()}.bind(this)),this.el.addEventListener("blur",function(){this.handleBlur()}.bind(this)),this.el.addEventListener("paste",function(t){this.handlePaste(t)}.bind(this)),this.render=this.options.render?this.options.render.bind(this):this.render.bind(this),this.getItemValue=this.options.getItemValue?this.options.getItemValue.bind(this):this.getItemValue.bind(this),this};o.prototype.handleKeyUp=function(t,e){if(40!==t&&38!==t&&27!==t&&9!==t)return 13===t?void(this.list.items[this.list.active]&&(this.list.handleMouseUp(this.list.items[this.list.active]),e.stopPropagation())):void this.handleInputChange(this.el.value)},o.prototype.handleKeyDown=function(t){switch(t.keyCode){case 13:this.list.active>=0&&(this.list.selectingListItem=!0);break;case 9:this.list.isEmpty()||(this.list.isVisible()&&t.preventDefault(),this.value(this.list.active>=0?this.list.items[this.list.active].original:null),this.list.hide());break;case 27:this.list.isEmpty()||this.list.hide();break;case 38:this.list.previous();break;case 40:this.list.next()}},o.prototype.handleBlur=function(){!this.list.selectingListItem&&this.options.hideOnBlur&&this.list.hide()},o.prototype.handlePaste=function(t){if(t.clipboardData)this.handleInputChange(t.clipboardData.getData("Text"));else{var e=this;setTimeout(function(){e.handleInputChange(t.target.value)},100)}},o.prototype.handleInputChange=function(t){if(this.query=this.normalize(t),this.list.clear(),this.query.length-1},o.prototype.value=function(t){if(this.selected=t,this.el.value=this.getItemValue(t||{place_name:this.query}),document.createEvent){var e=document.createEvent("HTMLEvents");e.initEvent("change",!0,!1),this.el.dispatchEvent(e)}else this.el.fireEvent("onchange")},o.prototype.getCandidates=function(t){var e,i={pre:"",post:"",extract:function(t){return this.getItemValue(t)}.bind(this)};this.options.filter?(e=s.filter(this.query,this.data,i),e=e.map(function(t){return{original:t.original,string:this.render(t.original,t.string)}}.bind(this))):e=this.data.map(function(t){return{original:t,string:this.render(t)}}.bind(this)),t(e)},o.prototype.getItemValue=function(t){return t},o.prototype.render=function(t,e){if(e)return e;for(var i=t.original?this.getItemValue(t.original):this.getItemValue(t),n=this.normalize(i),s=n.lastIndexOf(this.query);s>-1;){var r=s+this.query.length;i=i.slice(0,s)+""+i.slice(s,r)+""+i.slice(r),s=n.slice(0,s).lastIndexOf(this.query)}return i},o.prototype.renderError=function(t){this.list.drawError(t)},e.exports=o},{"./list":9,fuzzy:5,xtend:11}],11:[function(t,e,i){function n(){for(var t={},e=0;e