You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					802 lines
				
				44 KiB
			
		
		
			
		
	
	
					802 lines
				
				44 KiB
			| 
											3 years ago
										 | /*!  1.19.0 | © Algolia | github.com/algolia/places */
 | ||
|  | (function webpackUniversalModuleDefinition(root, factory) {
 | ||
|  | 	if(typeof exports === 'object' && typeof module === 'object')
 | ||
|  | 		module.exports = factory();
 | ||
|  | 	else if(typeof define === 'function' && define.amd)
 | ||
|  | 		define([], factory);
 | ||
|  | 	else if(typeof exports === 'object')
 | ||
|  | 		exports["placesAutocompleteDataset"] = factory();
 | ||
|  | 	else
 | ||
|  | 		root["placesAutocompleteDataset"] = factory();
 | ||
|  | })(window, function() {
 | ||
|  | return /******/ (function(modules) { // webpackBootstrap
 | ||
|  | /******/ 	// The module cache
 | ||
|  | /******/ 	var installedModules = {};
 | ||
|  | /******/
 | ||
|  | /******/ 	// The require function
 | ||
|  | /******/ 	function __webpack_require__(moduleId) {
 | ||
|  | /******/
 | ||
|  | /******/ 		// Check if module is in cache
 | ||
|  | /******/ 		if(installedModules[moduleId]) {
 | ||
|  | /******/ 			return installedModules[moduleId].exports;
 | ||
|  | /******/ 		}
 | ||
|  | /******/ 		// Create a new module (and put it into the cache)
 | ||
|  | /******/ 		var module = installedModules[moduleId] = {
 | ||
|  | /******/ 			i: moduleId,
 | ||
|  | /******/ 			l: false,
 | ||
|  | /******/ 			exports: {}
 | ||
|  | /******/ 		};
 | ||
|  | /******/
 | ||
|  | /******/ 		// Execute the module function
 | ||
|  | /******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
 | ||
|  | /******/
 | ||
|  | /******/ 		// Flag the module as loaded
 | ||
|  | /******/ 		module.l = true;
 | ||
|  | /******/
 | ||
|  | /******/ 		// Return the exports of the module
 | ||
|  | /******/ 		return module.exports;
 | ||
|  | /******/ 	}
 | ||
|  | /******/
 | ||
|  | /******/
 | ||
|  | /******/ 	// expose the modules object (__webpack_modules__)
 | ||
|  | /******/ 	__webpack_require__.m = modules;
 | ||
|  | /******/
 | ||
|  | /******/ 	// expose the module cache
 | ||
|  | /******/ 	__webpack_require__.c = installedModules;
 | ||
|  | /******/
 | ||
|  | /******/ 	// define getter function for harmony exports
 | ||
|  | /******/ 	__webpack_require__.d = function(exports, name, getter) {
 | ||
|  | /******/ 		if(!__webpack_require__.o(exports, name)) {
 | ||
|  | /******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
 | ||
|  | /******/ 		}
 | ||
|  | /******/ 	};
 | ||
|  | /******/
 | ||
|  | /******/ 	// define __esModule on exports
 | ||
|  | /******/ 	__webpack_require__.r = function(exports) {
 | ||
|  | /******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
 | ||
|  | /******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
 | ||
|  | /******/ 		}
 | ||
|  | /******/ 		Object.defineProperty(exports, '__esModule', { value: true });
 | ||
|  | /******/ 	};
 | ||
|  | /******/
 | ||
|  | /******/ 	// create a fake namespace object
 | ||
|  | /******/ 	// mode & 1: value is a module id, require it
 | ||
|  | /******/ 	// mode & 2: merge all properties of value into the ns
 | ||
|  | /******/ 	// mode & 4: return value when already ns object
 | ||
|  | /******/ 	// mode & 8|1: behave like require
 | ||
|  | /******/ 	__webpack_require__.t = function(value, mode) {
 | ||
|  | /******/ 		if(mode & 1) value = __webpack_require__(value);
 | ||
|  | /******/ 		if(mode & 8) return value;
 | ||
|  | /******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
 | ||
|  | /******/ 		var ns = Object.create(null);
 | ||
|  | /******/ 		__webpack_require__.r(ns);
 | ||
|  | /******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
 | ||
|  | /******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
 | ||
|  | /******/ 		return ns;
 | ||
|  | /******/ 	};
 | ||
|  | /******/
 | ||
|  | /******/ 	// getDefaultExport function for compatibility with non-harmony modules
 | ||
|  | /******/ 	__webpack_require__.n = function(module) {
 | ||
|  | /******/ 		var getter = module && module.__esModule ?
 | ||
|  | /******/ 			function getDefault() { return module['default']; } :
 | ||
|  | /******/ 			function getModuleExports() { return module; };
 | ||
|  | /******/ 		__webpack_require__.d(getter, 'a', getter);
 | ||
|  | /******/ 		return getter;
 | ||
|  | /******/ 	};
 | ||
|  | /******/
 | ||
|  | /******/ 	// Object.prototype.hasOwnProperty.call
 | ||
|  | /******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
 | ||
|  | /******/
 | ||
|  | /******/ 	// __webpack_public_path__
 | ||
|  | /******/ 	__webpack_require__.p = "";
 | ||
|  | /******/
 | ||
|  | /******/
 | ||
|  | /******/ 	// Load entry module and return exports
 | ||
|  | /******/ 	return __webpack_require__(__webpack_require__.s = 70);
 | ||
|  | /******/ })
 | ||
|  | /************************************************************************/
 | ||
|  | /******/ ({
 | ||
|  | 
 | ||
|  | /***/ 1:
 | ||
|  | /***/ (function(module, __webpack_exports__, __webpack_require__) {
 | ||
|  | 
 | ||
|  | "use strict";
 | ||
|  | function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
 | ||
|  | 
 | ||
|  | function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
 | ||
|  | 
 | ||
|  | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
 | ||
|  | 
 | ||
|  | var extractParams = function extractParams(_ref) {
 | ||
|  |   var hitsPerPage = _ref.hitsPerPage,
 | ||
|  |       postcodeSearch = _ref.postcodeSearch,
 | ||
|  |       aroundLatLng = _ref.aroundLatLng,
 | ||
|  |       aroundRadius = _ref.aroundRadius,
 | ||
|  |       aroundLatLngViaIP = _ref.aroundLatLngViaIP,
 | ||
|  |       insideBoundingBox = _ref.insideBoundingBox,
 | ||
|  |       insidePolygon = _ref.insidePolygon,
 | ||
|  |       getRankingInfo = _ref.getRankingInfo,
 | ||
|  |       countries = _ref.countries,
 | ||
|  |       language = _ref.language,
 | ||
|  |       type = _ref.type;
 | ||
|  |   var extracted = {
 | ||
|  |     countries: countries,
 | ||
|  |     hitsPerPage: hitsPerPage || 5,
 | ||
|  |     language: language || navigator.language.split('-')[0],
 | ||
|  |     type: type
 | ||
|  |   };
 | ||
|  | 
 | ||
|  |   if (Array.isArray(countries)) {
 | ||
|  |     extracted.countries = extracted.countries.map(function (country) {
 | ||
|  |       return country.toLowerCase();
 | ||
|  |     });
 | ||
|  |   }
 | ||
|  | 
 | ||
|  |   if (typeof extracted.language === 'string') {
 | ||
|  |     extracted.language = extracted.language.toLowerCase();
 | ||
|  |   }
 | ||
|  | 
 | ||
|  |   if (aroundLatLng) {
 | ||
|  |     extracted.aroundLatLng = aroundLatLng;
 | ||
|  |   } else if (aroundLatLngViaIP !== undefined) {
 | ||
|  |     extracted.aroundLatLngViaIP = aroundLatLngViaIP;
 | ||
|  |   }
 | ||
|  | 
 | ||
|  |   if (postcodeSearch) {
 | ||
|  |     extracted.restrictSearchableAttributes = 'postcode';
 | ||
|  |   }
 | ||
|  | 
 | ||
|  |   return _objectSpread(_objectSpread({}, extracted), {}, {
 | ||
|  |     aroundRadius: aroundRadius,
 | ||
|  |     insideBoundingBox: insideBoundingBox,
 | ||
|  |     insidePolygon: insidePolygon,
 | ||
|  |     getRankingInfo: getRankingInfo
 | ||
|  |   });
 | ||
|  | };
 | ||
|  | 
 | ||
|  | var extractControls = function extractControls(_ref2) {
 | ||
|  |   var _ref2$useDeviceLocati = _ref2.useDeviceLocation,
 | ||
|  |       useDeviceLocation = _ref2$useDeviceLocati === void 0 ? false : _ref2$useDeviceLocati,
 | ||
|  |       _ref2$computeQueryPar = _ref2.computeQueryParams,
 | ||
|  |       computeQueryParams = _ref2$computeQueryPar === void 0 ? function (params) {
 | ||
|  |     return params;
 | ||
|  |   } : _ref2$computeQueryPar,
 | ||
|  |       formatInputValue = _ref2.formatInputValue,
 | ||
|  |       _ref2$onHits = _ref2.onHits,
 | ||
|  |       onHits = _ref2$onHits === void 0 ? function () {} : _ref2$onHits,
 | ||
|  |       _ref2$onError = _ref2.onError,
 | ||
|  |       onError = _ref2$onError === void 0 ? function (e) {
 | ||
|  |     throw e;
 | ||
|  |   } : _ref2$onError,
 | ||
|  |       onRateLimitReached = _ref2.onRateLimitReached,
 | ||
|  |       onInvalidCredentials = _ref2.onInvalidCredentials;
 | ||
|  |   return {
 | ||
|  |     useDeviceLocation: useDeviceLocation,
 | ||
|  |     computeQueryParams: computeQueryParams,
 | ||
|  |     formatInputValue: formatInputValue,
 | ||
|  |     onHits: onHits,
 | ||
|  |     onError: onError,
 | ||
|  |     onRateLimitReached: onRateLimitReached,
 | ||
|  |     onInvalidCredentials: onInvalidCredentials
 | ||
|  |   };
 | ||
|  | };
 | ||
|  | 
 | ||
|  | var params = {};
 | ||
|  | var controls = {};
 | ||
|  | 
 | ||
|  | var configure = function configure(configuration) {
 | ||
|  |   params = extractParams(_objectSpread(_objectSpread({}, params), configuration));
 | ||
|  |   controls = extractControls(_objectSpread(_objectSpread({}, controls), configuration));
 | ||
|  |   return {
 | ||
|  |     params: params,
 | ||
|  |     controls: controls
 | ||
|  |   };
 | ||
|  | };
 | ||
|  | 
 | ||
|  | /* harmony default export */ __webpack_exports__["a"] = (configure);
 | ||
|  | 
 | ||
|  | /***/ }),
 | ||
|  | 
 | ||
|  | /***/ 15:
 | ||
|  | /***/ (function(module, __webpack_exports__, __webpack_require__) {
 | ||
|  | 
 | ||
|  | "use strict";
 | ||
|  | /* harmony default export */ __webpack_exports__["a"] = (".algolia-places {\n  width: 100%;\n}\n\n.ap-input, .ap-hint {\n  width: 100%;\n  padding-right: 35px;\n  padding-left: 16px;\n  line-height: 40px;\n  height: 40px;\n  border: 1px solid #CCC;\n  border-radius: 3px;\n  outline: none;\n  font: inherit;\n  appearance: none;\n  -webkit-appearance: none;\n  box-sizing: border-box;\n}\n\n.ap-input::-webkit-search-decoration {\n  -webkit-appearance: none;\n}\n\n.ap-input::-ms-clear {\n  display: none;\n}\n\n.ap-input:hover ~ .ap-input-icon svg,\n.ap-input:focus ~ .ap-input-icon svg,\n.ap-input-icon:hover svg {\n  fill: #aaaaaa;\n}\n\n.ap-dropdown-menu {\n  width: 100%;\n  background: #ffffff;\n  box-shadow: 0 1px 10px rgba(0, 0, 0, 0.2), 0 2px 4px 0 rgba(0, 0, 0, 0.1);\n  border-radius: 3px;\n  margin-top: 3px;\n  overflow: hidden;\n}\n\n.ap-suggestion {\n  cursor: pointer;\n  height: 46px;\n  line-height: 46px;\n  padding-left: 18px;\n  overflow: hidden;\n}\n\n.ap-suggestion em {\n  font-weight: bold;\n  font-style: normal;\n}\n\n.ap-address {\n  font-size: smaller;\n  margin-left: 12px;\n  color: #aaaaaa;\n}\n\n.ap-suggestion-icon {\n  margin-right: 10px;\n  width: 14px;\n  height: 20px;\n  vertical-align: middle;\n}\n\n.ap-suggestion-icon svg {\n  display: inherit;\n  -webkit-transform: scale(0.9) translateY(2px);\n          transform: scale(0.9) translateY(2px);\n  fill: #cfcfcf;\n}\n\n.ap-input-icon {\n  border: 0;\n  background: transparent;\n  position: absolute;\n  top: 0;\n  bottom: 0;\n  right: 16px;\n  outline: none;\n}\n\n.ap-input-icon.ap-icon-pin {\n  cursor: pointer;\n}\n\n.ap-input-icon svg {\n  fill: #cfcfcf;\n  position: absolute;\n  top: 50%;\n  right: 0;\n  -webkit-transform: translateY(-50%);\n          transform: translateY(-50%);\n}\n\n.ap-cursor {\n  background: #efefef;\n}\n\n.ap-cursor .ap-suggestion-icon svg {\n  -webkit-transform: scale(1) translateY(2px);\n          transform: scale(1) translateY(2px);\n  fill: #aaaaaa;\n}\n\n.ap-footer {\n  opacity: .8;\n  text-align: right;\n  padding: .5em 1em .5em 0;\n  font-size: 12px;\n  line-height: 12px;\n}\n\n.ap-footer a {\n  color: inherit;\n  text-decoration: none;\n}\n\n.ap-footer a svg {\n  vertical-align: middle;\n}\n\n.ap-footer:hover {\n  opacity: 1;\n}\n");
 | ||
|  | 
 | ||
|  | /***/ }),
 | ||
|  | 
 | ||
|  | /***/ 18:
 | ||
|  | /***/ (function(module, exports) {
 | ||
|  | 
 | ||
|  | var containers = []; // will store container HTMLElement references
 | ||
|  | var styleElements = []; // will store {prepend: HTMLElement, append: HTMLElement}
 | ||
|  | 
 | ||
|  | var usage = 'insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).';
 | ||
|  | 
 | ||
|  | function insertCss(css, options) {
 | ||
|  |     options = options || {};
 | ||
|  | 
 | ||
|  |     if (css === undefined) {
 | ||
|  |         throw new Error(usage);
 | ||
|  |     }
 | ||
|  | 
 | ||
|  |     var position = options.prepend === true ? 'prepend' : 'append';
 | ||
|  |     var container = options.container !== undefined ? options.container : document.querySelector('head');
 | ||
|  |     var containerId = containers.indexOf(container);
 | ||
|  | 
 | ||
|  |     // first time we see this container, create the necessary entries
 | ||
|  |     if (containerId === -1) {
 | ||
|  |         containerId = containers.push(container) - 1;
 | ||
|  |         styleElements[containerId] = {};
 | ||
|  |     }
 | ||
|  | 
 | ||
|  |     // try to get the correponding container + position styleElement, create it otherwise
 | ||
|  |     var styleElement;
 | ||
|  | 
 | ||
|  |     if (styleElements[containerId] !== undefined && styleElements[containerId][position] !== undefined) {
 | ||
|  |         styleElement = styleElements[containerId][position];
 | ||
|  |     } else {
 | ||
|  |         styleElement = styleElements[containerId][position] = createStyleElement();
 | ||
|  | 
 | ||
|  |         if (position === 'prepend') {
 | ||
|  |             container.insertBefore(styleElement, container.childNodes[0]);
 | ||
|  |         } else {
 | ||
|  |             container.appendChild(styleElement);
 | ||
|  |         }
 | ||
|  |     }
 | ||
|  | 
 | ||
|  |     // strip potential UTF-8 BOM if css was read from a file
 | ||
|  |     if (css.charCodeAt(0) === 0xFEFF) { css = css.substr(1, css.length); }
 | ||
|  | 
 | ||
|  |     // actually add the stylesheet
 | ||
|  |     if (styleElement.styleSheet) {
 | ||
|  |         styleElement.styleSheet.cssText += css
 | ||
|  |     } else {
 | ||
|  |         styleElement.textContent += css;
 | ||
|  |     }
 | ||
|  | 
 | ||
|  |     return styleElement;
 | ||
|  | };
 | ||
|  | 
 | ||
|  | function createStyleElement() {
 | ||
|  |     var styleElement = document.createElement('style');
 | ||
|  |     styleElement.setAttribute('type', 'text/css');
 | ||
|  |     return styleElement;
 | ||
|  | }
 | ||
|  | 
 | ||
|  | module.exports = insertCss;
 | ||
|  | module.exports.insertCss = insertCss;
 | ||
|  | 
 | ||
|  | 
 | ||
|  | /***/ }),
 | ||
|  | 
 | ||
|  | /***/ 19:
 | ||
|  | /***/ (function(module, __webpack_exports__, __webpack_require__) {
 | ||
|  | 
 | ||
|  | "use strict";
 | ||
|  | // ESM COMPAT FLAG
 | ||
|  | __webpack_require__.r(__webpack_exports__);
 | ||
|  | 
 | ||
|  | // EXPORTS
 | ||
|  | __webpack_require__.d(__webpack_exports__, "default", function() { return /* binding */ createAutocompleteDataset; });
 | ||
|  | 
 | ||
|  | // EXTERNAL MODULE: ./src/configure/index.js
 | ||
|  | var configure = __webpack_require__(1);
 | ||
|  | 
 | ||
|  | // EXTERNAL MODULE: ./src/formatHit.js + 2 modules
 | ||
|  | var formatHit = __webpack_require__(9);
 | ||
|  | 
 | ||
|  | // EXTERNAL MODULE: ./src/version.js
 | ||
|  | var version = __webpack_require__(6);
 | ||
|  | 
 | ||
|  | // CONCATENATED MODULE: ./src/createAutocompleteSource.js
 | ||
|  | function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
 | ||
|  | 
 | ||
|  | function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
 | ||
|  | 
 | ||
|  | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
 | ||
|  | 
 | ||
|  | 
 | ||
|  | 
 | ||
|  | 
 | ||
|  | function createAutocompleteSource(_ref) {
 | ||
|  |   var algoliasearch = _ref.algoliasearch,
 | ||
|  |       clientOptions = _ref.clientOptions,
 | ||
|  |       apiKey = _ref.apiKey,
 | ||
|  |       appId = _ref.appId,
 | ||
|  |       hitsPerPage = _ref.hitsPerPage,
 | ||
|  |       postcodeSearch = _ref.postcodeSearch,
 | ||
|  |       aroundLatLng = _ref.aroundLatLng,
 | ||
|  |       aroundRadius = _ref.aroundRadius,
 | ||
|  |       aroundLatLngViaIP = _ref.aroundLatLngViaIP,
 | ||
|  |       insideBoundingBox = _ref.insideBoundingBox,
 | ||
|  |       insidePolygon = _ref.insidePolygon,
 | ||
|  |       getRankingInfo = _ref.getRankingInfo,
 | ||
|  |       countries = _ref.countries,
 | ||
|  |       formatInputValue = _ref.formatInputValue,
 | ||
|  |       _ref$computeQueryPara = _ref.computeQueryParams,
 | ||
|  |       computeQueryParams = _ref$computeQueryPara === void 0 ? function (params) {
 | ||
|  |     return params;
 | ||
|  |   } : _ref$computeQueryPara,
 | ||
|  |       _ref$useDeviceLocatio = _ref.useDeviceLocation,
 | ||
|  |       useDeviceLocation = _ref$useDeviceLocatio === void 0 ? false : _ref$useDeviceLocatio,
 | ||
|  |       _ref$language = _ref.language,
 | ||
|  |       language = _ref$language === void 0 ? navigator.language.split('-')[0] : _ref$language,
 | ||
|  |       _ref$onHits = _ref.onHits,
 | ||
|  |       onHits = _ref$onHits === void 0 ? function () {} : _ref$onHits,
 | ||
|  |       _ref$onError = _ref.onError,
 | ||
|  |       onError = _ref$onError === void 0 ? function (e) {
 | ||
|  |     throw e;
 | ||
|  |   } : _ref$onError,
 | ||
|  |       onRateLimitReached = _ref.onRateLimitReached,
 | ||
|  |       onInvalidCredentials = _ref.onInvalidCredentials,
 | ||
|  |       type = _ref.type;
 | ||
|  |   var placesClient = algoliasearch.initPlaces(appId, apiKey, clientOptions);
 | ||
|  |   placesClient.as.addAlgoliaAgent("Algolia Places ".concat(version["default"]));
 | ||
|  |   var configuration = Object(configure["a" /* default */])({
 | ||
|  |     hitsPerPage: hitsPerPage,
 | ||
|  |     type: type,
 | ||
|  |     postcodeSearch: postcodeSearch,
 | ||
|  |     countries: countries,
 | ||
|  |     language: language,
 | ||
|  |     aroundLatLng: aroundLatLng,
 | ||
|  |     aroundRadius: aroundRadius,
 | ||
|  |     aroundLatLngViaIP: aroundLatLngViaIP,
 | ||
|  |     insideBoundingBox: insideBoundingBox,
 | ||
|  |     insidePolygon: insidePolygon,
 | ||
|  |     getRankingInfo: getRankingInfo,
 | ||
|  |     formatInputValue: formatInputValue,
 | ||
|  |     computeQueryParams: computeQueryParams,
 | ||
|  |     useDeviceLocation: useDeviceLocation,
 | ||
|  |     onHits: onHits,
 | ||
|  |     onError: onError,
 | ||
|  |     onRateLimitReached: onRateLimitReached,
 | ||
|  |     onInvalidCredentials: onInvalidCredentials
 | ||
|  |   });
 | ||
|  |   var params = configuration.params;
 | ||
|  |   var controls = configuration.controls;
 | ||
|  |   var userCoords;
 | ||
|  |   var tracker = null;
 | ||
|  | 
 | ||
|  |   if (controls.useDeviceLocation) {
 | ||
|  |     tracker = navigator.geolocation.watchPosition(function (_ref2) {
 | ||
|  |       var coords = _ref2.coords;
 | ||
|  |       userCoords = "".concat(coords.latitude, ",").concat(coords.longitude);
 | ||
|  |     });
 | ||
|  |   }
 | ||
|  | 
 | ||
|  |   function searcher(query, cb) {
 | ||
|  |     var searchParams = _objectSpread(_objectSpread({}, params), {}, {
 | ||
|  |       query: query
 | ||
|  |     });
 | ||
|  | 
 | ||
|  |     if (userCoords) {
 | ||
|  |       searchParams.aroundLatLng = userCoords;
 | ||
|  |     }
 | ||
|  | 
 | ||
|  |     return placesClient.search(controls.computeQueryParams(searchParams)).then(function (content) {
 | ||
|  |       var hits = content.hits.map(function (hit, hitIndex) {
 | ||
|  |         return Object(formatHit["a" /* default */])({
 | ||
|  |           formatInputValue: controls.formatInputValue,
 | ||
|  |           hit: hit,
 | ||
|  |           hitIndex: hitIndex,
 | ||
|  |           query: query,
 | ||
|  |           rawAnswer: content
 | ||
|  |         });
 | ||
|  |       });
 | ||
|  |       controls.onHits({
 | ||
|  |         hits: hits,
 | ||
|  |         query: query,
 | ||
|  |         rawAnswer: content
 | ||
|  |       });
 | ||
|  |       return hits;
 | ||
|  |     }).then(cb)["catch"](function (e) {
 | ||
|  |       if (e.statusCode === 403 && e.message === 'Invalid Application-ID or API key') {
 | ||
|  |         controls.onInvalidCredentials();
 | ||
|  |         return;
 | ||
|  |       } else if (e.statusCode === 429) {
 | ||
|  |         controls.onRateLimitReached();
 | ||
|  |         return;
 | ||
|  |       }
 | ||
|  | 
 | ||
|  |       controls.onError(e);
 | ||
|  |     });
 | ||
|  |   }
 | ||
|  | 
 | ||
|  |   searcher.configure = function (partial) {
 | ||
|  |     var updated = Object(configure["a" /* default */])(_objectSpread(_objectSpread(_objectSpread({}, params), controls), partial));
 | ||
|  |     params = updated.params;
 | ||
|  |     controls = updated.controls;
 | ||
|  | 
 | ||
|  |     if (controls.useDeviceLocation && tracker === null) {
 | ||
|  |       tracker = navigator.geolocation.watchPosition(function (_ref3) {
 | ||
|  |         var coords = _ref3.coords;
 | ||
|  |         userCoords = "".concat(coords.latitude, ",").concat(coords.longitude);
 | ||
|  |       });
 | ||
|  |     } else if (!controls.useDeviceLocation && tracker !== null) {
 | ||
|  |       navigator.geolocation.clearWatch(tracker);
 | ||
|  |       tracker = null;
 | ||
|  |       userCoords = null;
 | ||
|  |     }
 | ||
|  |   };
 | ||
|  | 
 | ||
|  |   return searcher;
 | ||
|  | }
 | ||
|  | // EXTERNAL MODULE: ./src/defaultTemplates.js + 10 modules
 | ||
|  | var defaultTemplates = __webpack_require__(8);
 | ||
|  | 
 | ||
|  | // CONCATENATED MODULE: ./src/createAutocompleteDataset.js
 | ||
|  | function createAutocompleteDataset_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
 | ||
|  | 
 | ||
|  | function createAutocompleteDataset_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { createAutocompleteDataset_ownKeys(Object(source), true).forEach(function (key) { createAutocompleteDataset_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { createAutocompleteDataset_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
 | ||
|  | 
 | ||
|  | function createAutocompleteDataset_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
 | ||
|  | 
 | ||
|  | 
 | ||
|  | 
 | ||
|  | function createAutocompleteDataset(options) {
 | ||
|  |   var templates = createAutocompleteDataset_objectSpread(createAutocompleteDataset_objectSpread({}, defaultTemplates["a" /* default */]), options.templates);
 | ||
|  | 
 | ||
|  |   var source = createAutocompleteSource(createAutocompleteDataset_objectSpread(createAutocompleteDataset_objectSpread({}, options), {}, {
 | ||
|  |     formatInputValue: templates.value,
 | ||
|  |     templates: undefined
 | ||
|  |   }));
 | ||
|  |   return {
 | ||
|  |     source: source,
 | ||
|  |     templates: templates,
 | ||
|  |     displayKey: 'value',
 | ||
|  |     name: 'places',
 | ||
|  |     cache: false
 | ||
|  |   };
 | ||
|  | }
 | ||
|  | 
 | ||
|  | /***/ }),
 | ||
|  | 
 | ||
|  | /***/ 30:
 | ||
|  | /***/ (function(module, exports) {
 | ||
|  | 
 | ||
|  | // polyfill for navigator.language (IE <= 10)
 | ||
|  | // not polyfilled by https://cdn.polyfill.io/v2/docs/
 | ||
|  | // Defined: http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#navigatorlanguage
 | ||
|  | //   with allowable values at http://www.ietf.org/rfc/bcp/bcp47.txt
 | ||
|  | // Note that the HTML spec suggests that anonymizing services return "en-US" by default for
 | ||
|  | //   user privacy (so your app may wish to provide a means of changing the locale)
 | ||
|  | if (!('language' in navigator)) {
 | ||
|  |   navigator.language = // IE 10 in IE8 mode on Windows 7 uses upper-case in
 | ||
|  |   // navigator.userLanguage country codes but per
 | ||
|  |   // http://msdn.microsoft.com/en-us/library/ie/ms533052.aspx (via
 | ||
|  |   // http://msdn.microsoft.com/en-us/library/ie/ms534713.aspx), they
 | ||
|  |   // appear to be in lower case, so we bring them into harmony with navigator.language.
 | ||
|  |   navigator.userLanguage && navigator.userLanguage.replace(/-[a-z]{2}$/, String.prototype.toUpperCase) || 'en-US'; // Default for anonymizing services: http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#navigatorlanguage
 | ||
|  | }
 | ||
|  | 
 | ||
|  | /***/ }),
 | ||
|  | 
 | ||
|  | /***/ 6:
 | ||
|  | /***/ (function(module, __webpack_exports__, __webpack_require__) {
 | ||
|  | 
 | ||
|  | "use strict";
 | ||
|  | __webpack_require__.r(__webpack_exports__);
 | ||
|  | /* harmony default export */ __webpack_exports__["default"] = ('1.19.0');
 | ||
|  | 
 | ||
|  | /***/ }),
 | ||
|  | 
 | ||
|  | /***/ 7:
 | ||
|  | /***/ (function(module, __webpack_exports__, __webpack_require__) {
 | ||
|  | 
 | ||
|  | "use strict";
 | ||
|  | /* harmony default export */ __webpack_exports__["a"] = ("<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 14 20\"><path d=\"M7 0C3.13 0 0 3.13 0 7c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5C5.62 9.5 4.5 8.38 4.5 7S5.62 4.5 7 4.5 9.5 5.62 9.5 7 8.38 9.5 7 9.5z\"/></svg>\n");
 | ||
|  | 
 | ||
|  | /***/ }),
 | ||
|  | 
 | ||
|  | /***/ 70:
 | ||
|  | /***/ (function(module, exports, __webpack_require__) {
 | ||
|  | 
 | ||
|  | // we need to export using commonjs for ease of usage in all
 | ||
|  | // JavaScript environments
 | ||
|  | 
 | ||
|  | /* eslint-disable import/no-commonjs */
 | ||
|  | __webpack_require__(30);
 | ||
|  | 
 | ||
|  | var createAutocompleteDataset = __webpack_require__(19)["default"];
 | ||
|  | 
 | ||
|  | var css = __webpack_require__(71)["default"];
 | ||
|  | 
 | ||
|  | var insertCss = __webpack_require__(18);
 | ||
|  | 
 | ||
|  | insertCss(css, {
 | ||
|  |   prepend: true
 | ||
|  | }); // must use module.exports to be commonJS compatible
 | ||
|  | 
 | ||
|  | module.exports = createAutocompleteDataset;
 | ||
|  | /* eslint-enable import/no-commonjs */
 | ||
|  | 
 | ||
|  | /***/ }),
 | ||
|  | 
 | ||
|  | /***/ 71:
 | ||
|  | /***/ (function(module, __webpack_exports__, __webpack_require__) {
 | ||
|  | 
 | ||
|  | "use strict";
 | ||
|  | __webpack_require__.r(__webpack_exports__);
 | ||
|  | /* harmony import */ var _src_places_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15);
 | ||
|  | // this is proxy file so that babel inlines src/places.css into the css variable
 | ||
|  | // since it is not a commonjs file
 | ||
|  | 
 | ||
|  | /* harmony default export */ __webpack_exports__["default"] = (_src_places_css__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"]);
 | ||
|  | 
 | ||
|  | /***/ }),
 | ||
|  | 
 | ||
|  | /***/ 8:
 | ||
|  | /***/ (function(module, __webpack_exports__, __webpack_require__) {
 | ||
|  | 
 | ||
|  | "use strict";
 | ||
|  | 
 | ||
|  | // CONCATENATED MODULE: ./src/formatInputValue.js
 | ||
|  | function formatInputValue(_ref) {
 | ||
|  |   var administrative = _ref.administrative,
 | ||
|  |       city = _ref.city,
 | ||
|  |       country = _ref.country,
 | ||
|  |       name = _ref.name,
 | ||
|  |       type = _ref.type;
 | ||
|  |   var out = "".concat(name).concat(type !== 'country' && country !== undefined ? ',' : '', "\n ").concat(city ? "".concat(city, ",") : '', "\n ").concat(administrative ? "".concat(administrative, ",") : '', "\n ").concat(country ? country : '').replace(/\s*\n\s*/g, ' ').trim();
 | ||
|  |   return out;
 | ||
|  | }
 | ||
|  | // EXTERNAL MODULE: ./src/icons/address.svg
 | ||
|  | var address = __webpack_require__(7);
 | ||
|  | 
 | ||
|  | // CONCATENATED MODULE: ./src/icons/city.svg
 | ||
|  | /* harmony default export */ var city = ("<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 18 19\"><path d=\"M12 9V3L9 0 6 3v2H0v14h18V9h-6zm-8 8H2v-2h2v2zm0-4H2v-2h2v2zm0-4H2V7h2v2zm6 8H8v-2h2v2zm0-4H8v-2h2v2zm0-4H8V7h2v2zm0-4H8V3h2v2zm6 12h-2v-2h2v2zm0-4h-2v-2h2v2z\"/></svg>\n");
 | ||
|  | // CONCATENATED MODULE: ./src/icons/country.svg
 | ||
|  | /* harmony default export */ var country = ("<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\">\n  <path d=\"M10 0C4.48 0 0 4.48 0 10s4.48 10 10 10 10-4.48 10-10S15.52 0 10 0zM9 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L7 13v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H6V8h2c.55 0 1-.45 1-1V5h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z\"/>\n</svg>\n");
 | ||
|  | // CONCATENATED MODULE: ./src/icons/bus.svg
 | ||
|  | /* harmony default export */ var bus = ("<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 54.9 50.5\"><path d=\"M9.6 12.7H8.5c-2.3 0-4.1 1.9-4.1 4.1v1.1c0 2.2 1.8 4 4 4.1v21.7h-.7c-1.3 0-2.3 1-2.3 2.3h7.1c0-1.3-1-2.3-2.3-2.3h-.5V22.1c2.2-.1 4-1.9 4-4.1v-1.1c0-2.3-1.8-4.2-4.1-4.2zM46 7.6h-7.5c0-1.8-1.5-3.3-3.3-3.3h-3.6c-1.8 0-3.3 1.5-3.3 3.3H21c-2.5 0-4.6 2-4.6 4.6v26.3c0 1.7 1.3 3.1 3 3.1h.8v1.6c0 1.7 1.4 3.1 3.1 3.1 1.7 0 3-1.4 3-3.1v-1.6h14.3v1.6c0 1.7 1.4 3.1 3.1 3.1 1.7 0 3.1-1.4 3.1-3.1v-1.6h.8c1.7 0 3.1-1.4 3.1-3.1V12.2c-.2-2.5-2.2-4.6-4.7-4.6zm-27.4 4.6c0-1.3 1.1-2.4 2.4-2.4h25c1.3 0 2.4 1.1 2.4 2.4v.3c0 1.3-1.1 2.4-2.4 2.4H21c-1.3 0-2.4-1.1-2.4-2.4v-.3zM21 38c-1.5 0-2.7-1.2-2.7-2.7 0-1.5 1.2-2.7 2.7-2.7 1.5 0 2.7 1.2 2.7 2.7 0 1.5-1.2 2.7-2.7 2.7zm0-10.1c-1.3 0-2.4-1.1-2.4-2.4v-6.6c0-1.3 1.1-2.4 2.4-2.4h25c1.3 0 2.4 1.1 2.4 2.4v6.6c0 1.3-1.1 2.4-2.4 2.4H21zm24.8 10c-1.5 0-2.7-1.2-2.7-2.7 0-1.5 1.2-2.7 2.7-2.7 1.5 0 2.7 1.2 2.7 2.7 0 1.5-1.2 2.7-2.7 2.7z\"/></svg>\n");
 | ||
|  | // CONCATENATED MODULE: ./src/icons/train.svg
 | ||
|  | /* harmony default export */ var train = ("<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 15 20\">\n  <path d=\"M13.105 20l-2.366-3.354H4.26L1.907 20H0l3.297-4.787c-1.1-.177-2.196-1.287-2.194-2.642V2.68C1.1 1.28 2.317-.002 3.973 0h7.065c1.647-.002 2.863 1.28 2.86 2.676v9.895c.003 1.36-1.094 2.47-2.194 2.647L15 20h-1.895zM6.11 2h2.78c.264 0 .472-.123.472-.27v-.46c0-.147-.22-.268-.472-.27H6.11c-.252.002-.47.123-.47.27v.46c0 .146.206.27.47.27zm6.26 3.952V4.175c-.004-.74-.5-1.387-1.436-1.388H4.066c-.936 0-1.43.648-1.436 1.388v1.777c-.002.86.644 1.384 1.436 1.388h6.868c.793-.004 1.44-.528 1.436-1.388zm-8.465 5.386c-.69-.003-1.254.54-1.252 1.21-.002.673.56 1.217 1.252 1.222.697-.006 1.26-.55 1.262-1.22-.002-.672-.565-1.215-1.262-1.212zm8.42 1.21c-.005-.67-.567-1.213-1.265-1.21-.69-.003-1.253.54-1.25 1.21-.003.673.56 1.217 1.25 1.222.698-.006 1.26-.55 1.264-1.22z\"/>\n</svg>\n");
 | ||
|  | // CONCATENATED MODULE: ./src/icons/townhall.svg
 | ||
|  | /* harmony default export */ var townhall = ("<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\"><path d=\"M12 .6L2.5 6.9h18.9L12 .6zM3.8 8.2c-.7 0-1.3.6-1.3 1.3v8.8L.3 22.1c-.2.3-.3.5-.3.6 0 .6.8.6 1.3.6h21.5c.4 0 1.3 0 1.3-.6 0-.2-.1-.3-.3-.6l-2.2-3.8V9.5c0-.7-.6-1.3-1.3-1.3H3.8zm2.5 2.5c.7 0 1.1.6 1.3 1.3v7.6H5.1V12c0-.7.5-1.3 1.2-1.3zm5.7 0c.7 0 1.3.6 1.3 1.3v7.6h-2.5V12c-.1-.7.5-1.3 1.2-1.3zm5.7 0c.7 0 1.3.6 1.3 1.3v7.6h-2.5V12c-.1-.7.5-1.3 1.2-1.3z\"/></svg>\n");
 | ||
|  | // CONCATENATED MODULE: ./src/icons/plane.svg
 | ||
|  | /* harmony default export */ var plane = ("<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 24 24\"><path d=\"M22.9 1.1s1.3.3-4.3 6.5l.7 3.8.2-.2c.4-.4 1-.4 1.3 0 .4.4.4 1 0 1.3l-1.2 1.2.3 1.7.1-.1c.4-.4 1-.4 1.3 0 .4.4.4 1 0 1.3l-1.1 1.1c.2 1.9.3 3.6.1 4.5 0 0-1.2 1.2-1.8.5 0 0-2.3-7.7-3.8-11.1-5.9 6-6.4 5.6-6.4 5.6s1.2 3.8-.2 5.2l-2.3-4.3h.1l-4.3-2.3c1.3-1.3 5.2-.2 5.2-.2s-.5-.4 5.6-6.3C8.9 7.7 1.2 5.5 1.2 5.5c-.7-.7.5-1.8.5-1.8.9-.2 2.6-.1 4.5.1l1.1-1.1c.4-.4 1-.4 1.3 0 .4.4.4 1 0 1.3l1.7.3 1.2-1.2c.4-.4 1-.4 1.3 0 .4.4.4 1 0 1.3l-.2.2 3.8.7c6.2-5.5 6.5-4.2 6.5-4.2z\"/></svg>\n");
 | ||
|  | // CONCATENATED MODULE: ./src/formatDropdownValue.js
 | ||
|  | 
 | ||
|  | 
 | ||
|  | 
 | ||
|  | 
 | ||
|  | 
 | ||
|  | 
 | ||
|  | 
 | ||
|  | var icons = {
 | ||
|  |   address: address["a" /* default */],
 | ||
|  |   city: city,
 | ||
|  |   country: country,
 | ||
|  |   busStop: bus,
 | ||
|  |   trainStation: train,
 | ||
|  |   townhall: townhall,
 | ||
|  |   airport: plane
 | ||
|  | };
 | ||
|  | function formatDropdownValue(_ref) {
 | ||
|  |   var type = _ref.type,
 | ||
|  |       highlight = _ref.highlight;
 | ||
|  |   var name = highlight.name,
 | ||
|  |       administrative = highlight.administrative,
 | ||
|  |       city = highlight.city,
 | ||
|  |       country = highlight.country;
 | ||
|  |   var out = "<span class=\"ap-suggestion-icon\">".concat(icons[type].trim(), "</span>\n<span class=\"ap-name\">").concat(name, "</span>\n<span class=\"ap-address\">\n  ").concat([city, administrative, country].filter(function (token) {
 | ||
|  |     return token !== undefined;
 | ||
|  |   }).join(', '), "</span>").replace(/\s*\n\s*/g, ' ');
 | ||
|  |   return out;
 | ||
|  | }
 | ||
|  | // CONCATENATED MODULE: ./src/icons/algolia.svg
 | ||
|  | /* harmony default export */ var algolia = ("<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"117\" height=\"17\" viewBox=\"0 0 130 19\"><g fill=\"none\" fill-rule=\"evenodd\"><g fill-rule=\"nonzero\"><path fill=\"#5468FF\" d=\"M59.399.044h13.299a2.372 2.372 0 0 1 2.377 2.364v13.234a2.372 2.372 0 0 1-2.377 2.364H59.399a2.372 2.372 0 0 1-2.377-2.364V2.403A2.368 2.368 0 0 1 59.399.044z\"/><path fill=\"#FFF\" d=\"M66.257 4.582c-2.815 0-5.1 2.272-5.1 5.078 0 2.806 2.284 5.072 5.1 5.072 2.815 0 5.1-2.272 5.1-5.078 0-2.806-2.279-5.072-5.1-5.072zm0 8.652c-1.983 0-3.593-1.602-3.593-3.574 0-1.972 1.61-3.574 3.593-3.574 1.983 0 3.593 1.602 3.593 3.574a3.582 3.582 0 0 1-3.593 3.574zm0-6.418V9.48c0 .076.082.131.153.093l2.377-1.226c.055-.027.071-.093.044-.147a2.96 2.96 0 0 0-2.465-1.487c-.055 0-.11.044-.11.104h.001zm-3.33-1.956l-.312-.31a.783.783 0 0 0-1.106 0l-.372.37a.773.773 0 0 0 0 1.1l.307.305c.049.05.121.038.164-.01.181-.246.378-.48.597-.698.225-.223.455-.42.707-.599.055-.033.06-.109.016-.158h-.001zm5.001-.806v-.616a.781.781 0 0 0-.783-.779h-1.824a.78.78 0 0 0-.783.78v.631c0 .071.066.12.137.104a5.736 5.736 0 0 1 1.588-.223c.52 0 1.035.071 1.534.207a.106.106 0 0 0 .131-.104z\"/><path fill=\"#252C61\" d=\"M5.027 10.246c0 .698-.252 1.246-.757 1.644-.505.397-1.201.596-2.089.596-.888 0-1.615-.138-2.181-.414v-1.214c.358.168.739.301 1.141.397.403.097.778.145 1.125.145.508 0 .884-.097 1.125-.29a.945.945 0 0 0 .363-.779.978.978 0 0 0-.333-.747c-.222-.204-.68-.446-1.375-.725C1.33 8.57.825 8.24.531 7.865c-.294-.372-.44-.82-.44-1.343 0-.655.233-1.17.698-1.547.465-.376 1.09-.564 1.875-.564.752 0 1.5.165 2.245.494l-.408 1.047c-.698-.294-1.321-.44-1.869-.44-.415 0-.73.09-.945.271a.89.89 0 0 0-.322.717c0 .204.043.38.129.524.086.145.227.282.424.411.197.13.551.3 1.063.51.577.24.999.464 1.268.671.269.208.465.442.591.704.125.261.188.57.188.924l-.001.002zm3.98 2.24c-.924 0-1.646-.269-2.167-.808-.521-.539-.781-1.28-.781-2.226 0-.97.242-1.733.725-2.288.483-.555 1.148-.833 1.993-.833.784 0 1.404.238 1.858.714.455.476.682 1.132.682 1.966v.682H7.359c.018.577.174 1.02.467 1.33.294.31.707.464 1.241.464.351 0 .678-.033.98-.099a5.1 5.1 0 0 0 .975-.33v1.026a3.865 3.865 0 0 1-.935.312 5.723 5.723 0 0 1-1.08.091zm7.46-.107l-.252-.827h-.043c-.286.362-.575.608-.865.74-.29.13-.662.195-1.117.195-.584 0-1.039-.158-1.367-.473-.328-.315-.491-.76-.491-1.337 0-.612.227-1.074.682-1.386.455-.312 1.148-.482 2.079-.51l1.026-.032v-.317c0-.38-.089-.663-.266-.85-.177-.189-.452-.283-.824-.283-.304 0-.596.045-.875.134a6.68 6.68 0 0 0-.806.317l-.408-.902a4.414 4.414 0 0 1 1.058-.384 4.856 4.856 0 0 1 1.085-.132c.756 0 1.326.165 1.711.494.385.33.577.847.577 1.552v4.001h-.904zm5.677-6.048c.254 0 .464.018.628.054l-.124 1.176a2.383 2.383 0 0 0-.559-.064c-.505 0-.914.165-1.227.494-.313.33-.47.757-.47 1.284v3.104H19.13V6.44h.988l.167 1.047h.064c.197-.354.454-.636.771-.843a1.83 1.83 0 0 1 1.023-.312h.001zm4.125 6.155c-.899 0-1.582-.262-2.049-.787-.467-.525-.701-1.277-.701-2.259 0-.999.244-1.767.733-2.304.489-.537 1.195-.806 2.119-.806.627 0 1.191.116 1.692.35l-.381 1.014c-.534-.208-.974-.312-1.321-.312-1.028 0-1.542.682-1.542 2.046 0 .666.128 1.166.384 1.501.256.335.631.502 1.125.502a3.23 3.23 0 0 0 1.595-.419v1.101a2.53 2.53 0 0 1-.722.285 4.356 4.356 0 0 1-.932.086v.002zm8.277-.107h-1.268V8.727c0-.458-.092-.8-.277-1.026-.184-.226-.477-.338-.878-.338-.53 0-.919.158-1.168.475-.249.317-.373.848-.373 1.593v2.95H29.32V4.022h1.262v2.122c0 .34-.021.704-.064 1.09h.081a1.76 1.76 0 0 1 .717-.666c.306-.158.663-.236 1.072-.236 1.439 0 2.159.725 2.159 2.175v3.873l-.001-.002zm7.648-6.048c.741 0 1.319.27 1.732.806.414.537.62 1.291.62 2.261 0 .974-.209 1.732-.628 2.275-.419.542-1.001.814-1.746.814-.752 0-1.336-.27-1.751-.81h-.086l-.231.703h-.945V4.023h1.262V6.01l-.021.655-.032.553h.054c.401-.59.992-.886 1.772-.886zm2.917.107h1.375l1.208 3.368c.183.48.304.931.365 1.354h.043c.032-.197.091-.436.177-.717.086-.28.541-1.616 1.364-4.004h1.364l-2.541 6.73c-.462 1.235-1.232 1.853-2.31 1.853-.279 0-.551-.03-.816-.09v-1c.19.043.406.064.65.064.609 0 1.037-.353 1.284-1.058l.22-.559-2.385-5.94h.002zm-3.244.924c
 | ||
|  | // CONCATENATED MODULE: ./src/icons/osm.svg
 | ||
|  | /* harmony default export */ var osm = ("<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\">\n  <path fill=\"#797979\" fill-rule=\"evenodd\" d=\"M6.577.5L5.304.005 2.627 1.02 0 0l.992 2.767-.986 2.685.998 2.76-1 2.717.613.22 3.39-3.45.563.06.726-.69s-.717-.92-.91-1.86c.193-.146.184-.14.355-.285C4.1 1.93 6.58.5 6.58.5zm-4.17 11.354l.22.12 2.68-1.05 2.62 1.04 2.644-1.03 1.02-2.717-.33-.944s-1.13 1.26-3.44.878c-.174.29-.25.37-.25.37s-1.11-.31-1.683-.89c-.573.58-.795.71-.795.71l.08.634-2.76 2.89zm6.26-4.395c1.817 0 3.29-1.53 3.29-3.4 0-1.88-1.473-3.4-3.29-3.4s-3.29 1.52-3.29 3.4c0 1.87 1.473 3.4 3.29 3.4z\"/>\n</svg>\n");
 | ||
|  | // CONCATENATED MODULE: ./src/defaultTemplates.js
 | ||
|  | 
 | ||
|  | 
 | ||
|  | 
 | ||
|  | 
 | ||
|  | /* harmony default export */ var defaultTemplates = __webpack_exports__["a"] = ({
 | ||
|  |   footer: "<div class=\"ap-footer\">\n  <a href=\"https://www.algolia.com/places\" title=\"Search by Algolia\" class=\"ap-footer-algolia\">".concat(algolia.trim(), "</a>\n  using <a href=\"https://community.algolia.com/places/documentation.html#license\" class=\"ap-footer-osm\" title=\"Algolia Places data \xA9 OpenStreetMap contributors\">").concat(osm.trim(), " <span>data</span></a>\n  </div>"),
 | ||
|  |   value: formatInputValue,
 | ||
|  |   suggestion: formatDropdownValue
 | ||
|  | });
 | ||
|  | 
 | ||
|  | /***/ }),
 | ||
|  | 
 | ||
|  | /***/ 9:
 | ||
|  | /***/ (function(module, __webpack_exports__, __webpack_require__) {
 | ||
|  | 
 | ||
|  | "use strict";
 | ||
|  | 
 | ||
|  | // EXPORTS
 | ||
|  | __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ formatHit; });
 | ||
|  | 
 | ||
|  | // CONCATENATED MODULE: ./src/findCountryCode.js
 | ||
|  | function findCountryCode(tags) {
 | ||
|  |   for (var tagIndex = 0; tagIndex < tags.length; tagIndex++) {
 | ||
|  |     var tag = tags[tagIndex];
 | ||
|  |     var find = tag.match(/country\/(.*)?/);
 | ||
|  | 
 | ||
|  |     if (find) {
 | ||
|  |       return find[1];
 | ||
|  |     }
 | ||
|  |   }
 | ||
|  | 
 | ||
|  |   return undefined;
 | ||
|  | }
 | ||
|  | // CONCATENATED MODULE: ./src/findType.js
 | ||
|  | function findType(tags) {
 | ||
|  |   var types = {
 | ||
|  |     country: 'country',
 | ||
|  |     city: 'city',
 | ||
|  |     'amenity/bus_station': 'busStop',
 | ||
|  |     'amenity/townhall': 'townhall',
 | ||
|  |     'railway/station': 'trainStation',
 | ||
|  |     'aeroway/aerodrome': 'airport',
 | ||
|  |     'aeroway/terminal': 'airport',
 | ||
|  |     'aeroway/gate': 'airport'
 | ||
|  |   };
 | ||
|  | 
 | ||
|  |   for (var t in types) {
 | ||
|  |     if (tags.indexOf(t) !== -1) {
 | ||
|  |       return types[t];
 | ||
|  |     }
 | ||
|  |   }
 | ||
|  | 
 | ||
|  |   return 'address';
 | ||
|  | }
 | ||
|  | // CONCATENATED MODULE: ./src/formatHit.js
 | ||
|  | function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
 | ||
|  | 
 | ||
|  | function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
 | ||
|  | 
 | ||
|  | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
 | ||
|  | 
 | ||
|  | 
 | ||
|  | 
 | ||
|  | 
 | ||
|  | function getBestHighlightedForm(highlightedValues) {
 | ||
|  |   var defaultValue = highlightedValues[0].value; // collect all other matches
 | ||
|  | 
 | ||
|  |   var bestAttributes = [];
 | ||
|  | 
 | ||
|  |   for (var i = 1; i < highlightedValues.length; ++i) {
 | ||
|  |     if (highlightedValues[i].matchLevel !== 'none') {
 | ||
|  |       bestAttributes.push({
 | ||
|  |         index: i,
 | ||
|  |         words: highlightedValues[i].matchedWords
 | ||
|  |       });
 | ||
|  |     }
 | ||
|  |   } // no matches in this attribute, retrieve first value
 | ||
|  | 
 | ||
|  | 
 | ||
|  |   if (bestAttributes.length === 0) {
 | ||
|  |     return defaultValue;
 | ||
|  |   } // sort the matches by `desc(words), asc(index)`
 | ||
|  | 
 | ||
|  | 
 | ||
|  |   bestAttributes.sort(function (a, b) {
 | ||
|  |     if (a.words > b.words) {
 | ||
|  |       return -1;
 | ||
|  |     } else if (a.words < b.words) {
 | ||
|  |       return 1;
 | ||
|  |     }
 | ||
|  | 
 | ||
|  |     return a.index - b.index;
 | ||
|  |   }); // and append the best match to the first value
 | ||
|  | 
 | ||
|  |   return bestAttributes[0].index === 0 ? "".concat(defaultValue, " (").concat(highlightedValues[bestAttributes[1].index].value, ")") : "".concat(highlightedValues[bestAttributes[0].index].value, " (").concat(defaultValue, ")");
 | ||
|  | }
 | ||
|  | 
 | ||
|  | function getBestPostcode(postcodes, highlightedPostcodes) {
 | ||
|  |   var defaultValue = highlightedPostcodes[0].value; // collect all other matches
 | ||
|  | 
 | ||
|  |   var bestAttributes = [];
 | ||
|  | 
 | ||
|  |   for (var i = 1; i < highlightedPostcodes.length; ++i) {
 | ||
|  |     if (highlightedPostcodes[i].matchLevel !== 'none') {
 | ||
|  |       bestAttributes.push({
 | ||
|  |         index: i,
 | ||
|  |         words: highlightedPostcodes[i].matchedWords
 | ||
|  |       });
 | ||
|  |     }
 | ||
|  |   } // no matches in this attribute, retrieve first value
 | ||
|  | 
 | ||
|  | 
 | ||
|  |   if (bestAttributes.length === 0) {
 | ||
|  |     return {
 | ||
|  |       postcode: postcodes[0],
 | ||
|  |       highlightedPostcode: defaultValue
 | ||
|  |     };
 | ||
|  |   } // sort the matches by `desc(words)`
 | ||
|  | 
 | ||
|  | 
 | ||
|  |   bestAttributes.sort(function (a, b) {
 | ||
|  |     if (a.words > b.words) {
 | ||
|  |       return -1;
 | ||
|  |     } else if (a.words < b.words) {
 | ||
|  |       return 1;
 | ||
|  |     }
 | ||
|  | 
 | ||
|  |     return a.index - b.index;
 | ||
|  |   });
 | ||
|  |   var postcode = postcodes[bestAttributes[0].index];
 | ||
|  |   return {
 | ||
|  |     postcode: postcode,
 | ||
|  |     highlightedPostcode: highlightedPostcodes[bestAttributes[0].index].value
 | ||
|  |   };
 | ||
|  | }
 | ||
|  | 
 | ||
|  | function formatHit(_ref) {
 | ||
|  |   var formatInputValue = _ref.formatInputValue,
 | ||
|  |       hit = _ref.hit,
 | ||
|  |       hitIndex = _ref.hitIndex,
 | ||
|  |       query = _ref.query,
 | ||
|  |       rawAnswer = _ref.rawAnswer;
 | ||
|  | 
 | ||
|  |   try {
 | ||
|  |     var name = hit.locale_names[0];
 | ||
|  |     var country = hit.country;
 | ||
|  |     var administrative = hit.administrative && hit.administrative[0] !== name ? hit.administrative[0] : undefined;
 | ||
|  |     var city = hit.city && hit.city[0] !== name ? hit.city[0] : undefined;
 | ||
|  |     var suburb = hit.suburb && hit.suburb[0] !== name ? hit.suburb[0] : undefined;
 | ||
|  |     var county = hit.county && hit.county[0] !== name ? hit.county[0] : undefined;
 | ||
|  | 
 | ||
|  |     var _ref2 = hit.postcode && hit.postcode.length ? getBestPostcode(hit.postcode, hit._highlightResult.postcode) : {
 | ||
|  |       postcode: undefined,
 | ||
|  |       highlightedPostcode: undefined
 | ||
|  |     },
 | ||
|  |         postcode = _ref2.postcode,
 | ||
|  |         highlightedPostcode = _ref2.highlightedPostcode;
 | ||
|  | 
 | ||
|  |     var highlight = {
 | ||
|  |       name: getBestHighlightedForm(hit._highlightResult.locale_names),
 | ||
|  |       city: city ? getBestHighlightedForm(hit._highlightResult.city) : undefined,
 | ||
|  |       administrative: administrative ? getBestHighlightedForm(hit._highlightResult.administrative) : undefined,
 | ||
|  |       country: country ? hit._highlightResult.country.value : undefined,
 | ||
|  |       suburb: suburb ? getBestHighlightedForm(hit._highlightResult.suburb) : undefined,
 | ||
|  |       county: county ? getBestHighlightedForm(hit._highlightResult.county) : undefined,
 | ||
|  |       postcode: highlightedPostcode
 | ||
|  |     };
 | ||
|  |     var suggestion = {
 | ||
|  |       name: name,
 | ||
|  |       administrative: administrative,
 | ||
|  |       county: county,
 | ||
|  |       city: city,
 | ||
|  |       suburb: suburb,
 | ||
|  |       country: country,
 | ||
|  |       countryCode: findCountryCode(hit._tags),
 | ||
|  |       type: findType(hit._tags),
 | ||
|  |       latlng: {
 | ||
|  |         lat: hit._geoloc.lat,
 | ||
|  |         lng: hit._geoloc.lng
 | ||
|  |       },
 | ||
|  |       postcode: postcode,
 | ||
|  |       postcodes: hit.postcode && hit.postcode.length ? hit.postcode : undefined
 | ||
|  |     }; // this is the value to put inside the <input value=
 | ||
|  | 
 | ||
|  |     var value = formatInputValue(suggestion);
 | ||
|  |     return _objectSpread(_objectSpread({}, suggestion), {}, {
 | ||
|  |       highlight: highlight,
 | ||
|  |       hit: hit,
 | ||
|  |       hitIndex: hitIndex,
 | ||
|  |       query: query,
 | ||
|  |       rawAnswer: rawAnswer,
 | ||
|  |       value: value
 | ||
|  |     });
 | ||
|  |   } catch (e) {
 | ||
|  |     /* eslint-disable no-console */
 | ||
|  |     console.error('Could not parse object', hit);
 | ||
|  |     console.error(e);
 | ||
|  |     /* eslint-enable no-console */
 | ||
|  | 
 | ||
|  |     return {
 | ||
|  |       value: 'Could not parse object'
 | ||
|  |     };
 | ||
|  |   }
 | ||
|  | }
 | ||
|  | 
 | ||
|  | /***/ })
 | ||
|  | 
 | ||
|  | /******/ });
 | ||
|  | });
 | ||
|  | //# sourceMappingURL=placesAutocompleteDataset.js.map
 |