@algolia/autocomplete-js 1.3.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/esm/autocomplete.js +6 -1
  2. package/dist/esm/createAutocompleteDom.js +1 -1
  3. package/dist/esm/elements/Input.js +4 -2
  4. package/dist/esm/getCreateDomElement.js +4 -2
  5. package/dist/esm/getDefaultOptions.d.ts +10 -10
  6. package/dist/esm/getDefaultOptions.js +4 -2
  7. package/dist/esm/render.js +1 -1
  8. package/dist/esm/requesters/createAlgoliaRequester.js +3 -6
  9. package/dist/esm/requesters/getAlgoliaFacets.js +1 -1
  10. package/dist/esm/types/AutocompleteApi.js +1 -0
  11. package/dist/esm/types/AutocompleteClassNames.js +1 -0
  12. package/dist/esm/types/AutocompleteCollection.js +1 -0
  13. package/dist/esm/types/AutocompleteComponents.js +1 -0
  14. package/dist/esm/types/AutocompleteDom.js +1 -0
  15. package/dist/esm/types/AutocompleteElement.js +1 -0
  16. package/dist/esm/types/AutocompleteOptions.js +1 -0
  17. package/dist/esm/types/AutocompletePlugin.js +1 -0
  18. package/dist/esm/types/AutocompletePropGetters.js +1 -0
  19. package/dist/esm/types/AutocompleteRender.js +1 -0
  20. package/dist/esm/types/AutocompleteRenderer.js +1 -0
  21. package/dist/esm/types/AutocompleteSource.js +1 -0
  22. package/dist/esm/types/AutocompleteState.js +1 -0
  23. package/dist/esm/types/AutocompleteTranslations.js +1 -0
  24. package/dist/esm/types/HighlightHitParams.js +1 -0
  25. package/dist/esm/userAgents.d.ts +4 -0
  26. package/dist/esm/userAgents.js +5 -0
  27. package/dist/esm/utils/mergeDeep.js +4 -4
  28. package/dist/esm/utils/setProperties.js +27 -27
  29. package/dist/umd/index.development.js +746 -455
  30. package/dist/umd/index.development.js.map +1 -1
  31. package/dist/umd/index.production.js +2 -2
  32. package/dist/umd/index.production.js.map +1 -1
  33. package/package.json +4 -4
  34. package/dist/esm/version.d.ts +0 -1
  35. package/dist/esm/version.js +0 -1
@@ -1,27 +1,65 @@
1
- /*! @algolia/autocomplete-js 1.3.0 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/autocomplete */
1
+ /*! @algolia/autocomplete-js 1.5.1 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/autocomplete */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
4
4
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
5
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['@algolia/autocomplete-js'] = {}));
6
- }(this, (function (exports) { 'use strict';
5
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@algolia/autocomplete-js"] = {}));
6
+ })(this, (function (exports) { 'use strict';
7
7
 
8
- function _typeof(obj) {
8
+ function ownKeys$g(object, enumerableOnly) {
9
+ var keys = Object.keys(object);
10
+
11
+ if (Object.getOwnPropertySymbols) {
12
+ var symbols = Object.getOwnPropertySymbols(object);
13
+
14
+ if (enumerableOnly) {
15
+ symbols = symbols.filter(function (sym) {
16
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
17
+ });
18
+ }
19
+
20
+ keys.push.apply(keys, symbols);
21
+ }
22
+
23
+ return keys;
24
+ }
25
+
26
+ function _objectSpread2(target) {
27
+ for (var i = 1; i < arguments.length; i++) {
28
+ var source = arguments[i] != null ? arguments[i] : {};
29
+
30
+ if (i % 2) {
31
+ ownKeys$g(Object(source), true).forEach(function (key) {
32
+ _defineProperty$g(target, key, source[key]);
33
+ });
34
+ } else if (Object.getOwnPropertyDescriptors) {
35
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
36
+ } else {
37
+ ownKeys$g(Object(source)).forEach(function (key) {
38
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
39
+ });
40
+ }
41
+ }
42
+
43
+ return target;
44
+ }
45
+
46
+ function _typeof$3(obj) {
9
47
  "@babel/helpers - typeof";
10
48
 
11
49
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
12
- _typeof = function (obj) {
50
+ _typeof$3 = function (obj) {
13
51
  return typeof obj;
14
52
  };
15
53
  } else {
16
- _typeof = function (obj) {
54
+ _typeof$3 = function (obj) {
17
55
  return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
18
56
  };
19
57
  }
20
58
 
21
- return _typeof(obj);
59
+ return _typeof$3(obj);
22
60
  }
23
61
 
24
- function _defineProperty(obj, key, value) {
62
+ function _defineProperty$g(obj, key, value) {
25
63
  if (key in obj) {
26
64
  Object.defineProperty(obj, key, {
27
65
  value: value,
@@ -54,41 +92,7 @@
54
92
  return _extends.apply(this, arguments);
55
93
  }
56
94
 
57
- function ownKeys(object, enumerableOnly) {
58
- var keys = Object.keys(object);
59
-
60
- if (Object.getOwnPropertySymbols) {
61
- var symbols = Object.getOwnPropertySymbols(object);
62
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
63
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
64
- });
65
- keys.push.apply(keys, symbols);
66
- }
67
-
68
- return keys;
69
- }
70
-
71
- function _objectSpread2(target) {
72
- for (var i = 1; i < arguments.length; i++) {
73
- var source = arguments[i] != null ? arguments[i] : {};
74
-
75
- if (i % 2) {
76
- ownKeys(Object(source), true).forEach(function (key) {
77
- _defineProperty(target, key, source[key]);
78
- });
79
- } else if (Object.getOwnPropertyDescriptors) {
80
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
81
- } else {
82
- ownKeys(Object(source)).forEach(function (key) {
83
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
84
- });
85
- }
86
- }
87
-
88
- return target;
89
- }
90
-
91
- function _objectWithoutPropertiesLoose(source, excluded) {
95
+ function _objectWithoutPropertiesLoose$4(source, excluded) {
92
96
  if (source == null) return {};
93
97
  var target = {};
94
98
  var sourceKeys = Object.keys(source);
@@ -103,10 +107,10 @@
103
107
  return target;
104
108
  }
105
109
 
106
- function _objectWithoutProperties(source, excluded) {
110
+ function _objectWithoutProperties$4(source, excluded) {
107
111
  if (source == null) return {};
108
112
 
109
- var target = _objectWithoutPropertiesLoose(source, excluded);
113
+ var target = _objectWithoutPropertiesLoose$4(source, excluded);
110
114
 
111
115
  var key, i;
112
116
 
@@ -124,28 +128,28 @@
124
128
  return target;
125
129
  }
126
130
 
127
- function _toConsumableArray(arr) {
128
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
131
+ function _toConsumableArray$5(arr) {
132
+ return _arrayWithoutHoles$5(arr) || _iterableToArray$5(arr) || _unsupportedIterableToArray$6(arr) || _nonIterableSpread$5();
129
133
  }
130
134
 
131
- function _arrayWithoutHoles(arr) {
132
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
135
+ function _arrayWithoutHoles$5(arr) {
136
+ if (Array.isArray(arr)) return _arrayLikeToArray$6(arr);
133
137
  }
134
138
 
135
- function _iterableToArray(iter) {
136
- if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
139
+ function _iterableToArray$5(iter) {
140
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
137
141
  }
138
142
 
139
- function _unsupportedIterableToArray(o, minLen) {
143
+ function _unsupportedIterableToArray$6(o, minLen) {
140
144
  if (!o) return;
141
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
145
+ if (typeof o === "string") return _arrayLikeToArray$6(o, minLen);
142
146
  var n = Object.prototype.toString.call(o).slice(8, -1);
143
147
  if (n === "Object" && o.constructor) n = o.constructor.name;
144
148
  if (n === "Map" || n === "Set") return Array.from(o);
145
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
149
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$6(o, minLen);
146
150
  }
147
151
 
148
- function _arrayLikeToArray(arr, len) {
152
+ function _arrayLikeToArray$6(arr, len) {
149
153
  if (len == null || len > arr.length) len = arr.length;
150
154
 
151
155
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
@@ -153,7 +157,7 @@
153
157
  return arr2;
154
158
  }
155
159
 
156
- function _nonIterableSpread() {
160
+ function _nonIterableSpread$5() {
157
161
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
158
162
  }
159
163
 
@@ -181,23 +185,23 @@
181
185
  }
182
186
 
183
187
  function _slicedToArray(arr, i) {
184
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest();
188
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray$5(arr, i) || _nonIterableRest();
185
189
  }
186
190
 
187
191
  function _nonIterableRest() {
188
192
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
189
193
  }
190
194
 
191
- function _unsupportedIterableToArray$1(o, minLen) {
195
+ function _unsupportedIterableToArray$5(o, minLen) {
192
196
  if (!o) return;
193
- if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
197
+ if (typeof o === "string") return _arrayLikeToArray$5(o, minLen);
194
198
  var n = Object.prototype.toString.call(o).slice(8, -1);
195
199
  if (n === "Object" && o.constructor) n = o.constructor.name;
196
200
  if (n === "Map" || n === "Set") return Array.from(o);
197
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
201
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$5(o, minLen);
198
202
  }
199
203
 
200
- function _arrayLikeToArray$1(arr, len) {
204
+ function _arrayLikeToArray$5(arr, len) {
201
205
  if (len == null || len > arr.length) len = arr.length;
202
206
 
203
207
  for (var i = 0, arr2 = new Array(len); i < len; i++) {
@@ -208,14 +212,17 @@
208
212
  }
209
213
 
210
214
  function _iterableToArrayLimit(arr, i) {
211
- if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
215
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
216
+
217
+ if (_i == null) return;
212
218
  var _arr = [];
213
219
  var _n = true;
214
220
  var _d = false;
215
- var _e = undefined;
221
+
222
+ var _s, _e;
216
223
 
217
224
  try {
218
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
225
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
219
226
  _arr.push(_s.value);
220
227
 
221
228
  if (i && _arr.length === i) break;
@@ -238,20 +245,20 @@
238
245
  if (Array.isArray(arr)) return arr;
239
246
  }
240
247
 
241
- function _typeof$1(obj) {
248
+ function _typeof$2(obj) {
242
249
  "@babel/helpers - typeof";
243
250
 
244
251
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
245
- _typeof$1 = function _typeof(obj) {
252
+ _typeof$2 = function _typeof(obj) {
246
253
  return typeof obj;
247
254
  };
248
255
  } else {
249
- _typeof$1 = function _typeof(obj) {
256
+ _typeof$2 = function _typeof(obj) {
250
257
  return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
251
258
  };
252
259
  }
253
260
 
254
- return _typeof$1(obj);
261
+ return _typeof$2(obj);
255
262
  }
256
263
  /**
257
264
  * Decycles objects with circular references.
@@ -262,7 +269,7 @@
262
269
  function decycle(obj) {
263
270
  var seen = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Set();
264
271
 
265
- if ( !obj || _typeof$1(obj) !== 'object') {
272
+ if (!obj || _typeof$2(obj) !== 'object') {
266
273
  return obj;
267
274
  }
268
275
 
@@ -326,6 +333,15 @@
326
333
  }
327
334
  }
328
335
 
336
+ var noop = function noop() {};
337
+
338
+ var version = '1.5.1';
339
+
340
+ var userAgents$1 = [{
341
+ segment: 'autocomplete-core',
342
+ version: version
343
+ }];
344
+
329
345
  var warnCache = {
330
346
  current: {}
331
347
  };
@@ -351,35 +367,39 @@
351
367
  }
352
368
 
353
369
  function checkOptions(options) {
354
- "development" !== 'production' ? warn(!options.debug, 'The `debug` option is meant for development debugging and should not be used in production.') : void 0 ;
370
+ "development" !== 'production' ? warn(!options.debug, 'The `debug` option is meant for development debugging and should not be used in production.') : void 0 ;
355
371
  }
356
372
 
357
- function ownKeys$1(object, enumerableOnly) {
373
+ function ownKeys$f(object, enumerableOnly) {
358
374
  var keys = Object.keys(object);
359
375
 
360
376
  if (Object.getOwnPropertySymbols) {
361
377
  var symbols = Object.getOwnPropertySymbols(object);
362
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
363
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
364
- });
378
+
379
+ if (enumerableOnly) {
380
+ symbols = symbols.filter(function (sym) {
381
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
382
+ });
383
+ }
384
+
365
385
  keys.push.apply(keys, symbols);
366
386
  }
367
387
 
368
388
  return keys;
369
389
  }
370
390
 
371
- function _objectSpread(target) {
391
+ function _objectSpread$f(target) {
372
392
  for (var i = 1; i < arguments.length; i++) {
373
393
  var source = arguments[i] != null ? arguments[i] : {};
374
394
 
375
395
  if (i % 2) {
376
- ownKeys$1(Object(source), true).forEach(function (key) {
377
- _defineProperty$1(target, key, source[key]);
396
+ ownKeys$f(Object(source), true).forEach(function (key) {
397
+ _defineProperty$f(target, key, source[key]);
378
398
  });
379
399
  } else if (Object.getOwnPropertyDescriptors) {
380
400
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
381
401
  } else {
382
- ownKeys$1(Object(source)).forEach(function (key) {
402
+ ownKeys$f(Object(source)).forEach(function (key) {
383
403
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
384
404
  });
385
405
  }
@@ -388,7 +408,7 @@
388
408
  return target;
389
409
  }
390
410
 
391
- function _defineProperty$1(obj, key, value) {
411
+ function _defineProperty$f(obj, key, value) {
392
412
  if (key in obj) {
393
413
  Object.defineProperty(obj, key, {
394
414
  value: value,
@@ -410,7 +430,7 @@
410
430
  return state;
411
431
  },
412
432
  dispatch: function dispatch(action, payload) {
413
- var prevState = _objectSpread({}, state);
433
+ var prevState = _objectSpread$f({}, state);
414
434
 
415
435
  state = reducer(state, {
416
436
  type: action,
@@ -421,36 +441,41 @@
421
441
  state: state,
422
442
  prevState: prevState
423
443
  });
424
- }
444
+ },
445
+ shouldSkipPendingUpdate: false
425
446
  };
426
447
  }
427
448
 
428
- function ownKeys$2(object, enumerableOnly) {
449
+ function ownKeys$e(object, enumerableOnly) {
429
450
  var keys = Object.keys(object);
430
451
 
431
452
  if (Object.getOwnPropertySymbols) {
432
453
  var symbols = Object.getOwnPropertySymbols(object);
433
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
434
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
435
- });
454
+
455
+ if (enumerableOnly) {
456
+ symbols = symbols.filter(function (sym) {
457
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
458
+ });
459
+ }
460
+
436
461
  keys.push.apply(keys, symbols);
437
462
  }
438
463
 
439
464
  return keys;
440
465
  }
441
466
 
442
- function _objectSpread$1(target) {
467
+ function _objectSpread$e(target) {
443
468
  for (var i = 1; i < arguments.length; i++) {
444
469
  var source = arguments[i] != null ? arguments[i] : {};
445
470
 
446
471
  if (i % 2) {
447
- ownKeys$2(Object(source), true).forEach(function (key) {
448
- _defineProperty$2(target, key, source[key]);
472
+ ownKeys$e(Object(source), true).forEach(function (key) {
473
+ _defineProperty$e(target, key, source[key]);
449
474
  });
450
475
  } else if (Object.getOwnPropertyDescriptors) {
451
476
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
452
477
  } else {
453
- ownKeys$2(Object(source)).forEach(function (key) {
478
+ ownKeys$e(Object(source)).forEach(function (key) {
454
479
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
455
480
  });
456
481
  }
@@ -459,7 +484,7 @@
459
484
  return target;
460
485
  }
461
486
 
462
- function _defineProperty$2(obj, key, value) {
487
+ function _defineProperty$e(obj, key, value) {
463
488
  if (key in obj) {
464
489
  Object.defineProperty(obj, key, {
465
490
  value: value,
@@ -487,11 +512,11 @@
487
512
  var setCollections = function setCollections(rawValue) {
488
513
  var baseItemId = 0;
489
514
  var value = rawValue.map(function (collection) {
490
- return _objectSpread$1(_objectSpread$1({}, collection), {}, {
515
+ return _objectSpread$e(_objectSpread$e({}, collection), {}, {
491
516
  // We flatten the stored items to support calling `getAlgoliaResults`
492
517
  // from the source itself.
493
518
  items: flatten(collection.items).map(function (item) {
494
- return _objectSpread$1(_objectSpread$1({}, item), {}, {
519
+ return _objectSpread$e(_objectSpread$e({}, item), {}, {
495
520
  __autocomplete_id: baseItemId++
496
521
  });
497
522
  })
@@ -522,6 +547,55 @@
522
547
  };
523
548
  }
524
549
 
550
+ /**
551
+ * Creates a runner that executes promises in a concurrent-safe way.
552
+ *
553
+ * This is useful to prevent older promises to resolve after a newer promise,
554
+ * otherwise resulting in stale resolved values.
555
+ */
556
+ function createConcurrentSafePromise() {
557
+ var basePromiseId = -1;
558
+ var latestResolvedId = -1;
559
+ var latestResolvedValue = undefined;
560
+ var runningPromisesCount = 0;
561
+
562
+ function runConcurrentSafePromise(promise) {
563
+ basePromiseId++;
564
+ runningPromisesCount++;
565
+ var currentPromiseId = basePromiseId;
566
+ return Promise.resolve(promise).then(function (x) {
567
+ // The promise might take too long to resolve and get outdated. This would
568
+ // result in resolving stale values.
569
+ // When this happens, we ignore the promise value and return the one
570
+ // coming from the latest resolved value.
571
+ //
572
+ // +----------------------------------+
573
+ // | 100ms |
574
+ // | run(1) +---> R1 |
575
+ // | 300ms |
576
+ // | run(2) +-------------> R2 (SKIP) |
577
+ // | 200ms |
578
+ // | run(3) +--------> R3 |
579
+ // +----------------------------------+
580
+ if (latestResolvedValue && currentPromiseId < latestResolvedId) {
581
+ return latestResolvedValue;
582
+ }
583
+
584
+ latestResolvedId = currentPromiseId;
585
+ latestResolvedValue = x;
586
+ return x;
587
+ }).finally(function () {
588
+ return runningPromisesCount--;
589
+ });
590
+ }
591
+
592
+ runConcurrentSafePromise.isRunning = function () {
593
+ return runningPromisesCount > 0;
594
+ };
595
+
596
+ return runConcurrentSafePromise;
597
+ }
598
+
525
599
  /**
526
600
  * Returns the next active item ID from the current state.
527
601
  *
@@ -556,34 +630,36 @@
556
630
  return numericIndex;
557
631
  }
558
632
 
559
- var noop = function noop() {};
560
-
561
- function ownKeys$3(object, enumerableOnly) {
633
+ function ownKeys$d(object, enumerableOnly) {
562
634
  var keys = Object.keys(object);
563
635
 
564
636
  if (Object.getOwnPropertySymbols) {
565
637
  var symbols = Object.getOwnPropertySymbols(object);
566
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
567
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
568
- });
638
+
639
+ if (enumerableOnly) {
640
+ symbols = symbols.filter(function (sym) {
641
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
642
+ });
643
+ }
644
+
569
645
  keys.push.apply(keys, symbols);
570
646
  }
571
647
 
572
648
  return keys;
573
649
  }
574
650
 
575
- function _objectSpread$2(target) {
651
+ function _objectSpread$d(target) {
576
652
  for (var i = 1; i < arguments.length; i++) {
577
653
  var source = arguments[i] != null ? arguments[i] : {};
578
654
 
579
655
  if (i % 2) {
580
- ownKeys$3(Object(source), true).forEach(function (key) {
581
- _defineProperty$3(target, key, source[key]);
656
+ ownKeys$d(Object(source), true).forEach(function (key) {
657
+ _defineProperty$d(target, key, source[key]);
582
658
  });
583
659
  } else if (Object.getOwnPropertyDescriptors) {
584
660
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
585
661
  } else {
586
- ownKeys$3(Object(source)).forEach(function (key) {
662
+ ownKeys$d(Object(source)).forEach(function (key) {
587
663
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
588
664
  });
589
665
  }
@@ -592,7 +668,7 @@
592
668
  return target;
593
669
  }
594
670
 
595
- function _defineProperty$3(obj, key, value) {
671
+ function _defineProperty$d(obj, key, value) {
596
672
  if (key in obj) {
597
673
  Object.defineProperty(obj, key, {
598
674
  value: value,
@@ -607,26 +683,26 @@
607
683
  return obj;
608
684
  }
609
685
 
610
- function _typeof$2(obj) {
686
+ function _typeof$1(obj) {
611
687
  "@babel/helpers - typeof";
612
688
 
613
689
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
614
- _typeof$2 = function _typeof(obj) {
690
+ _typeof$1 = function _typeof(obj) {
615
691
  return typeof obj;
616
692
  };
617
693
  } else {
618
- _typeof$2 = function _typeof(obj) {
694
+ _typeof$1 = function _typeof(obj) {
619
695
  return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
620
696
  };
621
697
  }
622
698
 
623
- return _typeof$2(obj);
699
+ return _typeof$1(obj);
624
700
  }
625
701
  function getNormalizedSources(getSources, params) {
626
702
  var seenSourceIds = [];
627
703
  return Promise.resolve(getSources(params)).then(function (sources) {
628
704
  invariant(Array.isArray(sources), function () {
629
- return "The `getSources` function must return an array of sources but returned type ".concat(JSON.stringify(_typeof$2(sources)), ":\n\n").concat(JSON.stringify(decycle(sources), null, 2));
705
+ return "The `getSources` function must return an array of sources but returned type ".concat(JSON.stringify(_typeof$1(sources)), ":\n\n").concat(JSON.stringify(decycle(sources), null, 2));
630
706
  });
631
707
  return Promise.all(sources // We allow `undefined` and `false` sources to allow users to use
632
708
  // `Boolean(query) && source` (=> `false`).
@@ -642,7 +718,7 @@
642
718
 
643
719
  seenSourceIds.push(source.sourceId);
644
720
 
645
- var normalizedSource = _objectSpread$2({
721
+ var normalizedSource = _objectSpread$d({
646
722
  getItemInputValue: function getItemInputValue(_ref) {
647
723
  var state = _ref.state;
648
724
  return state.query;
@@ -752,32 +828,36 @@
752
828
  return parent === child || parent.contains(child);
753
829
  }
754
830
 
755
- function ownKeys$4(object, enumerableOnly) {
831
+ function ownKeys$c(object, enumerableOnly) {
756
832
  var keys = Object.keys(object);
757
833
 
758
834
  if (Object.getOwnPropertySymbols) {
759
835
  var symbols = Object.getOwnPropertySymbols(object);
760
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
761
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
762
- });
836
+
837
+ if (enumerableOnly) {
838
+ symbols = symbols.filter(function (sym) {
839
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
840
+ });
841
+ }
842
+
763
843
  keys.push.apply(keys, symbols);
764
844
  }
765
845
 
766
846
  return keys;
767
847
  }
768
848
 
769
- function _objectSpread$3(target) {
849
+ function _objectSpread$c(target) {
770
850
  for (var i = 1; i < arguments.length; i++) {
771
851
  var source = arguments[i] != null ? arguments[i] : {};
772
852
 
773
853
  if (i % 2) {
774
- ownKeys$4(Object(source), true).forEach(function (key) {
775
- _defineProperty$4(target, key, source[key]);
854
+ ownKeys$c(Object(source), true).forEach(function (key) {
855
+ _defineProperty$c(target, key, source[key]);
776
856
  });
777
857
  } else if (Object.getOwnPropertyDescriptors) {
778
858
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
779
859
  } else {
780
- ownKeys$4(Object(source)).forEach(function (key) {
860
+ ownKeys$c(Object(source)).forEach(function (key) {
781
861
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
782
862
  });
783
863
  }
@@ -786,7 +866,7 @@
786
866
  return target;
787
867
  }
788
868
 
789
- function _defineProperty$4(obj, key, value) {
869
+ function _defineProperty$c(obj, key, value) {
790
870
  if (key in obj) {
791
871
  Object.defineProperty(obj, key, {
792
872
  value: value,
@@ -805,10 +885,10 @@
805
885
  var results = rawResults.map(function (result) {
806
886
  var _hits;
807
887
 
808
- return _objectSpread$3(_objectSpread$3({}, result), {}, {
888
+ return _objectSpread$c(_objectSpread$c({}, result), {}, {
809
889
  hits: (_hits = result.hits) === null || _hits === void 0 ? void 0 : _hits.map(function (hit) {
810
890
  // Bring support for the Insights plugin.
811
- return _objectSpread$3(_objectSpread$3({}, hit), {}, {
891
+ return _objectSpread$c(_objectSpread$c({}, hit), {}, {
812
892
  __autocomplete_indexName: result.index,
813
893
  __autocomplete_queryID: result.queryID
814
894
  });
@@ -839,32 +919,32 @@
839
919
  };
840
920
  }
841
921
 
842
- function _toConsumableArray$1(arr) {
843
- return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$2(arr) || _nonIterableSpread$1();
922
+ function _toConsumableArray$4(arr) {
923
+ return _arrayWithoutHoles$4(arr) || _iterableToArray$4(arr) || _unsupportedIterableToArray$4(arr) || _nonIterableSpread$4();
844
924
  }
845
925
 
846
- function _nonIterableSpread$1() {
926
+ function _nonIterableSpread$4() {
847
927
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
848
928
  }
849
929
 
850
- function _unsupportedIterableToArray$2(o, minLen) {
930
+ function _unsupportedIterableToArray$4(o, minLen) {
851
931
  if (!o) return;
852
- if (typeof o === "string") return _arrayLikeToArray$2(o, minLen);
932
+ if (typeof o === "string") return _arrayLikeToArray$4(o, minLen);
853
933
  var n = Object.prototype.toString.call(o).slice(8, -1);
854
934
  if (n === "Object" && o.constructor) n = o.constructor.name;
855
935
  if (n === "Map" || n === "Set") return Array.from(o);
856
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen);
936
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$4(o, minLen);
857
937
  }
858
938
 
859
- function _iterableToArray$1(iter) {
860
- if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
939
+ function _iterableToArray$4(iter) {
940
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
861
941
  }
862
942
 
863
- function _arrayWithoutHoles$1(arr) {
864
- if (Array.isArray(arr)) return _arrayLikeToArray$2(arr);
943
+ function _arrayWithoutHoles$4(arr) {
944
+ if (Array.isArray(arr)) return _arrayLikeToArray$4(arr);
865
945
  }
866
946
 
867
- function _arrayLikeToArray$2(arr, len) {
947
+ function _arrayLikeToArray$4(arr, len) {
868
948
  if (len == null || len > arr.length) len = arr.length;
869
949
 
870
950
  for (var i = 0, arr2 = new Array(len); i < len; i++) {
@@ -874,32 +954,36 @@
874
954
  return arr2;
875
955
  }
876
956
 
877
- function ownKeys$5(object, enumerableOnly) {
957
+ function ownKeys$b(object, enumerableOnly) {
878
958
  var keys = Object.keys(object);
879
959
 
880
960
  if (Object.getOwnPropertySymbols) {
881
961
  var symbols = Object.getOwnPropertySymbols(object);
882
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
883
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
884
- });
962
+
963
+ if (enumerableOnly) {
964
+ symbols = symbols.filter(function (sym) {
965
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
966
+ });
967
+ }
968
+
885
969
  keys.push.apply(keys, symbols);
886
970
  }
887
971
 
888
972
  return keys;
889
973
  }
890
974
 
891
- function _objectSpread$4(target) {
975
+ function _objectSpread$b(target) {
892
976
  for (var i = 1; i < arguments.length; i++) {
893
977
  var source = arguments[i] != null ? arguments[i] : {};
894
978
 
895
979
  if (i % 2) {
896
- ownKeys$5(Object(source), true).forEach(function (key) {
897
- _defineProperty$5(target, key, source[key]);
980
+ ownKeys$b(Object(source), true).forEach(function (key) {
981
+ _defineProperty$b(target, key, source[key]);
898
982
  });
899
983
  } else if (Object.getOwnPropertyDescriptors) {
900
984
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
901
985
  } else {
902
- ownKeys$5(Object(source)).forEach(function (key) {
986
+ ownKeys$b(Object(source)).forEach(function (key) {
903
987
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
904
988
  });
905
989
  }
@@ -908,7 +992,7 @@
908
992
  return target;
909
993
  }
910
994
 
911
- function _defineProperty$5(obj, key, value) {
995
+ function _defineProperty$b(obj, key, value) {
912
996
  if (key in obj) {
913
997
  Object.defineProperty(obj, key, {
914
998
  value: value,
@@ -931,7 +1015,7 @@
931
1015
  /* eslint-enable no-restricted-globals */
932
1016
 
933
1017
  var plugins = props.plugins || [];
934
- return _objectSpread$4(_objectSpread$4({
1018
+ return _objectSpread$b(_objectSpread$b({
935
1019
  debug: false,
936
1020
  openOnFocus: false,
937
1021
  placeholder: '',
@@ -953,7 +1037,7 @@
953
1037
  id: (_props$id = props.id) !== null && _props$id !== void 0 ? _props$id : generateAutocompleteId(),
954
1038
  plugins: plugins,
955
1039
  // The following props need to be deeply defaulted.
956
- initialState: _objectSpread$4({
1040
+ initialState: _objectSpread$b({
957
1041
  activeItemId: null,
958
1042
  query: '',
959
1043
  completion: null,
@@ -993,7 +1077,7 @@
993
1077
  });
994
1078
  },
995
1079
  getSources: function getSources(params) {
996
- return Promise.all([].concat(_toConsumableArray$1(plugins.map(function (plugin) {
1080
+ return Promise.all([].concat(_toConsumableArray$4(plugins.map(function (plugin) {
997
1081
  return plugin.getSources;
998
1082
  })), [props.getSources]).filter(Boolean).map(function (getSources) {
999
1083
  return getNormalizedSources(getSources, params);
@@ -1001,7 +1085,7 @@
1001
1085
  return flatten(nested);
1002
1086
  }).then(function (sources) {
1003
1087
  return sources.map(function (source) {
1004
- return _objectSpread$4(_objectSpread$4({}, source), {}, {
1088
+ return _objectSpread$b(_objectSpread$b({}, source), {}, {
1005
1089
  onSelect: function onSelect(params) {
1006
1090
  source.onSelect(params);
1007
1091
  pluginSubscribers.forEach(function (x) {
@@ -1022,7 +1106,7 @@
1022
1106
  });
1023
1107
  });
1024
1108
  },
1025
- navigator: _objectSpread$4({
1109
+ navigator: _objectSpread$b({
1026
1110
  navigate: function navigate(_ref3) {
1027
1111
  var itemUrl = _ref3.itemUrl;
1028
1112
  environment.location.assign(itemUrl);
@@ -1040,32 +1124,36 @@
1040
1124
  });
1041
1125
  }
1042
1126
 
1043
- function ownKeys$6(object, enumerableOnly) {
1127
+ function ownKeys$a(object, enumerableOnly) {
1044
1128
  var keys = Object.keys(object);
1045
1129
 
1046
1130
  if (Object.getOwnPropertySymbols) {
1047
1131
  var symbols = Object.getOwnPropertySymbols(object);
1048
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
1049
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
1050
- });
1132
+
1133
+ if (enumerableOnly) {
1134
+ symbols = symbols.filter(function (sym) {
1135
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
1136
+ });
1137
+ }
1138
+
1051
1139
  keys.push.apply(keys, symbols);
1052
1140
  }
1053
1141
 
1054
1142
  return keys;
1055
1143
  }
1056
1144
 
1057
- function _objectSpread$5(target) {
1145
+ function _objectSpread$a(target) {
1058
1146
  for (var i = 1; i < arguments.length; i++) {
1059
1147
  var source = arguments[i] != null ? arguments[i] : {};
1060
1148
 
1061
1149
  if (i % 2) {
1062
- ownKeys$6(Object(source), true).forEach(function (key) {
1063
- _defineProperty$6(target, key, source[key]);
1150
+ ownKeys$a(Object(source), true).forEach(function (key) {
1151
+ _defineProperty$a(target, key, source[key]);
1064
1152
  });
1065
1153
  } else if (Object.getOwnPropertyDescriptors) {
1066
1154
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1067
1155
  } else {
1068
- ownKeys$6(Object(source)).forEach(function (key) {
1156
+ ownKeys$a(Object(source)).forEach(function (key) {
1069
1157
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1070
1158
  });
1071
1159
  }
@@ -1074,7 +1162,7 @@
1074
1162
  return target;
1075
1163
  }
1076
1164
 
1077
- function _defineProperty$6(obj, key, value) {
1165
+ function _defineProperty$a(obj, key, value) {
1078
1166
  if (key in obj) {
1079
1167
  Object.defineProperty(obj, key, {
1080
1168
  value: value,
@@ -1095,7 +1183,7 @@
1095
1183
  // Example: `const { recentSearchesPlugin } = sourcesBySourceId`
1096
1184
 
1097
1185
  var sourcesBySourceId = collections.reduce(function (acc, collection) {
1098
- return _objectSpread$5(_objectSpread$5({}, acc), {}, _defineProperty$6({}, collection.source.sourceId, _objectSpread$5(_objectSpread$5({}, collection.source), {}, {
1186
+ return _objectSpread$a(_objectSpread$a({}, acc), {}, _defineProperty$a({}, collection.source.sourceId, _objectSpread$a(_objectSpread$a({}, collection.source), {}, {
1099
1187
  getItems: function getItems() {
1100
1188
  // We provide the resolved items from the collection to the `reshape` prop.
1101
1189
  return flatten(collection.items);
@@ -1116,27 +1204,27 @@
1116
1204
  });
1117
1205
  }
1118
1206
 
1119
- function _typeof$3(obj) {
1207
+ function _typeof(obj) {
1120
1208
  "@babel/helpers - typeof";
1121
1209
 
1122
1210
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
1123
- _typeof$3 = function _typeof(obj) {
1211
+ _typeof = function _typeof(obj) {
1124
1212
  return typeof obj;
1125
1213
  };
1126
1214
  } else {
1127
- _typeof$3 = function _typeof(obj) {
1215
+ _typeof = function _typeof(obj) {
1128
1216
  return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1129
1217
  };
1130
1218
  }
1131
1219
 
1132
- return _typeof$3(obj);
1220
+ return _typeof(obj);
1133
1221
  }
1134
1222
 
1135
- function _toConsumableArray$2(arr) {
1136
- return _arrayWithoutHoles$2(arr) || _iterableToArray$2(arr) || _unsupportedIterableToArray$3(arr) || _nonIterableSpread$2();
1223
+ function _toConsumableArray$3(arr) {
1224
+ return _arrayWithoutHoles$3(arr) || _iterableToArray$3(arr) || _unsupportedIterableToArray$3(arr) || _nonIterableSpread$3();
1137
1225
  }
1138
1226
 
1139
- function _nonIterableSpread$2() {
1227
+ function _nonIterableSpread$3() {
1140
1228
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1141
1229
  }
1142
1230
 
@@ -1149,11 +1237,11 @@
1149
1237
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen);
1150
1238
  }
1151
1239
 
1152
- function _iterableToArray$2(iter) {
1153
- if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
1240
+ function _iterableToArray$3(iter) {
1241
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
1154
1242
  }
1155
1243
 
1156
- function _arrayWithoutHoles$2(arr) {
1244
+ function _arrayWithoutHoles$3(arr) {
1157
1245
  if (Array.isArray(arr)) return _arrayLikeToArray$3(arr);
1158
1246
  }
1159
1247
 
@@ -1167,32 +1255,36 @@
1167
1255
  return arr2;
1168
1256
  }
1169
1257
 
1170
- function ownKeys$7(object, enumerableOnly) {
1258
+ function ownKeys$9(object, enumerableOnly) {
1171
1259
  var keys = Object.keys(object);
1172
1260
 
1173
1261
  if (Object.getOwnPropertySymbols) {
1174
1262
  var symbols = Object.getOwnPropertySymbols(object);
1175
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
1176
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
1177
- });
1263
+
1264
+ if (enumerableOnly) {
1265
+ symbols = symbols.filter(function (sym) {
1266
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
1267
+ });
1268
+ }
1269
+
1178
1270
  keys.push.apply(keys, symbols);
1179
1271
  }
1180
1272
 
1181
1273
  return keys;
1182
1274
  }
1183
1275
 
1184
- function _objectSpread$6(target) {
1276
+ function _objectSpread$9(target) {
1185
1277
  for (var i = 1; i < arguments.length; i++) {
1186
1278
  var source = arguments[i] != null ? arguments[i] : {};
1187
1279
 
1188
1280
  if (i % 2) {
1189
- ownKeys$7(Object(source), true).forEach(function (key) {
1190
- _defineProperty$7(target, key, source[key]);
1281
+ ownKeys$9(Object(source), true).forEach(function (key) {
1282
+ _defineProperty$9(target, key, source[key]);
1191
1283
  });
1192
1284
  } else if (Object.getOwnPropertyDescriptors) {
1193
1285
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1194
1286
  } else {
1195
- ownKeys$7(Object(source)).forEach(function (key) {
1287
+ ownKeys$9(Object(source)).forEach(function (key) {
1196
1288
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1197
1289
  });
1198
1290
  }
@@ -1201,7 +1293,7 @@
1201
1293
  return target;
1202
1294
  }
1203
1295
 
1204
- function _defineProperty$7(obj, key, value) {
1296
+ function _defineProperty$9(obj, key, value) {
1205
1297
  if (key in obj) {
1206
1298
  Object.defineProperty(obj, key, {
1207
1299
  value: value,
@@ -1226,7 +1318,7 @@
1226
1318
 
1227
1319
  function preResolve(itemsOrDescription, sourceId) {
1228
1320
  if (isRequesterDescription(itemsOrDescription)) {
1229
- return _objectSpread$6(_objectSpread$6({}, itemsOrDescription), {}, {
1321
+ return _objectSpread$9(_objectSpread$9({}, itemsOrDescription), {}, {
1230
1322
  requests: itemsOrDescription.queries.map(function (query) {
1231
1323
  return {
1232
1324
  query: query,
@@ -1259,7 +1351,7 @@
1259
1351
  if (container) {
1260
1352
  var _container$items;
1261
1353
 
1262
- (_container$items = container.items).push.apply(_container$items, _toConsumableArray$2(requests));
1354
+ (_container$items = container.items).push.apply(_container$items, _toConsumableArray$3(requests));
1263
1355
  } else {
1264
1356
  var request = {
1265
1357
  execute: execute,
@@ -1301,7 +1393,7 @@
1301
1393
  var transform = matches[0].transformResponse;
1302
1394
  var items = transform ? transform(mapToAlgoliaResponse(results)) : results;
1303
1395
  invariant(Array.isArray(items), function () {
1304
- return "The `getItems` function from source \"".concat(source.sourceId, "\" must return an array of items but returned type ").concat(JSON.stringify(_typeof$3(items)), ":\n\n").concat(JSON.stringify(decycle(items), null, 2), ".\n\nSee: https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/sources/#param-getitems");
1396
+ return "The `getItems` function from source \"".concat(source.sourceId, "\" must return an array of items but returned type ").concat(JSON.stringify(_typeof(items)), ":\n\n").concat(JSON.stringify(decycle(items), null, 2), ".\n\nSee: https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/sources/#param-getitems");
1305
1397
  });
1306
1398
  invariant(items.every(Boolean), "The `getItems` function from source \"".concat(source.sourceId, "\" must return an array of items but returned ").concat(JSON.stringify(undefined), ".\n\nDid you forget to return items?\n\nSee: https://www.algolia.com/doc/ui-libraries/autocomplete/core-concepts/sources/#param-getitems"));
1307
1399
  return {
@@ -1311,21 +1403,27 @@
1311
1403
  });
1312
1404
  }
1313
1405
 
1406
+ var _excluded$6 = ["event", "nextState", "props", "query", "refresh", "store"];
1407
+
1314
1408
  function ownKeys$8(object, enumerableOnly) {
1315
1409
  var keys = Object.keys(object);
1316
1410
 
1317
1411
  if (Object.getOwnPropertySymbols) {
1318
1412
  var symbols = Object.getOwnPropertySymbols(object);
1319
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
1320
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
1321
- });
1413
+
1414
+ if (enumerableOnly) {
1415
+ symbols = symbols.filter(function (sym) {
1416
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
1417
+ });
1418
+ }
1419
+
1322
1420
  keys.push.apply(keys, symbols);
1323
1421
  }
1324
1422
 
1325
1423
  return keys;
1326
1424
  }
1327
1425
 
1328
- function _objectSpread$7(target) {
1426
+ function _objectSpread$8(target) {
1329
1427
  for (var i = 1; i < arguments.length; i++) {
1330
1428
  var source = arguments[i] != null ? arguments[i] : {};
1331
1429
 
@@ -1360,10 +1458,10 @@
1360
1458
  return obj;
1361
1459
  }
1362
1460
 
1363
- function _objectWithoutProperties$1(source, excluded) {
1461
+ function _objectWithoutProperties$3(source, excluded) {
1364
1462
  if (source == null) return {};
1365
1463
 
1366
- var target = _objectWithoutPropertiesLoose$1(source, excluded);
1464
+ var target = _objectWithoutPropertiesLoose$3(source, excluded);
1367
1465
 
1368
1466
  var key, i;
1369
1467
 
@@ -1381,7 +1479,7 @@
1381
1479
  return target;
1382
1480
  }
1383
1481
 
1384
- function _objectWithoutPropertiesLoose$1(source, excluded) {
1482
+ function _objectWithoutPropertiesLoose$3(source, excluded) {
1385
1483
  if (source == null) return {};
1386
1484
  var target = {};
1387
1485
  var sourceKeys = Object.keys(source);
@@ -1396,6 +1494,7 @@
1396
1494
  return target;
1397
1495
  }
1398
1496
  var lastStalledId = null;
1497
+ var runConcurrentSafePromise = createConcurrentSafePromise();
1399
1498
  function onInput(_ref) {
1400
1499
  var event = _ref.event,
1401
1500
  _ref$nextState = _ref.nextState,
@@ -1404,7 +1503,7 @@
1404
1503
  query = _ref.query,
1405
1504
  refresh = _ref.refresh,
1406
1505
  store = _ref.store,
1407
- setters = _objectWithoutProperties$1(_ref, ["event", "nextState", "props", "query", "refresh", "store"]);
1506
+ setters = _objectWithoutProperties$3(_ref, _excluded$6);
1408
1507
 
1409
1508
  if (lastStalledId) {
1410
1509
  props.environment.clearTimeout(lastStalledId);
@@ -1421,30 +1520,42 @@
1421
1520
  if (!query && props.openOnFocus === false) {
1422
1521
  var _nextState$isOpen;
1423
1522
 
1424
- setStatus('idle');
1425
- setCollections(store.getState().collections.map(function (collection) {
1426
- return _objectSpread$7(_objectSpread$7({}, collection), {}, {
1523
+ var collections = store.getState().collections.map(function (collection) {
1524
+ return _objectSpread$8(_objectSpread$8({}, collection), {}, {
1427
1525
  items: []
1428
1526
  });
1429
- }));
1527
+ });
1528
+ setStatus('idle');
1529
+ setCollections(collections);
1430
1530
  setIsOpen((_nextState$isOpen = nextState.isOpen) !== null && _nextState$isOpen !== void 0 ? _nextState$isOpen : props.shouldPanelOpen({
1431
1531
  state: store.getState()
1432
- }));
1433
- return Promise.resolve();
1532
+ })); // We make sure to update the latest resolved value of the tracked
1533
+ // promises to keep late resolving promises from "cancelling" the state
1534
+ // updates performed in this code path.
1535
+ // We chain with a void promise to respect `onInput`'s expected return type.
1536
+
1537
+ return runConcurrentSafePromise(collections).then(function () {
1538
+ return Promise.resolve();
1539
+ });
1434
1540
  }
1435
1541
 
1436
1542
  setStatus('loading');
1437
1543
  lastStalledId = props.environment.setTimeout(function () {
1438
1544
  setStatus('stalled');
1439
- }, props.stallThreshold);
1440
- return props.getSources(_objectSpread$7({
1545
+ }, props.stallThreshold); // We track the entire promise chain triggered by `onInput` before mutating
1546
+ // the Autocomplete state to make sure that any state manipulation is based on
1547
+ // fresh data regardless of when promises individually resolve.
1548
+ // We don't track nested promises and only rely on the full chain resolution,
1549
+ // meaning we should only ever manipulate the state once this concurrent-safe
1550
+ // promise is resolved.
1551
+
1552
+ return runConcurrentSafePromise(props.getSources(_objectSpread$8({
1441
1553
  query: query,
1442
1554
  refresh: refresh,
1443
1555
  state: store.getState()
1444
1556
  }, setters)).then(function (sources) {
1445
- setStatus('loading');
1446
1557
  return Promise.all(sources.map(function (source) {
1447
- return Promise.resolve(source.getItems(_objectSpread$7({
1558
+ return Promise.resolve(source.getItems(_objectSpread$8({
1448
1559
  query: query,
1449
1560
  refresh: refresh,
1450
1561
  state: store.getState()
@@ -1459,66 +1570,86 @@
1459
1570
  props: props,
1460
1571
  state: store.getState()
1461
1572
  });
1462
- }).then(function (collections) {
1463
- var _nextState$isOpen2;
1573
+ });
1574
+ })).then(function (collections) {
1575
+ var _nextState$isOpen2; // Parameters passed to `onInput` could be stale when the following code
1576
+ // executes, because `onInput` calls may not resolve in order.
1577
+ // If it becomes a problem we'll need to save the last passed parameters.
1578
+ // See: https://codesandbox.io/s/agitated-cookies-y290z
1464
1579
 
1465
- setStatus('idle');
1466
- setCollections(collections);
1467
- var isPanelOpen = props.shouldPanelOpen({
1468
- state: store.getState()
1469
- });
1470
- setIsOpen((_nextState$isOpen2 = nextState.isOpen) !== null && _nextState$isOpen2 !== void 0 ? _nextState$isOpen2 : props.openOnFocus && !query && isPanelOpen || isPanelOpen);
1471
- var highlightedItem = getActiveItem(store.getState());
1472
1580
 
1473
- if (store.getState().activeItemId !== null && highlightedItem) {
1474
- var item = highlightedItem.item,
1475
- itemInputValue = highlightedItem.itemInputValue,
1476
- itemUrl = highlightedItem.itemUrl,
1477
- source = highlightedItem.source;
1478
- source.onActive(_objectSpread$7({
1479
- event: event,
1480
- item: item,
1481
- itemInputValue: itemInputValue,
1482
- itemUrl: itemUrl,
1483
- refresh: refresh,
1484
- source: source,
1485
- state: store.getState()
1486
- }, setters));
1487
- }
1488
- }).finally(function () {
1489
- if (lastStalledId) {
1490
- props.environment.clearTimeout(lastStalledId);
1581
+ setStatus('idle');
1582
+
1583
+ if (store.shouldSkipPendingUpdate) {
1584
+ if (!runConcurrentSafePromise.isRunning()) {
1585
+ store.shouldSkipPendingUpdate = false;
1491
1586
  }
1587
+
1588
+ return;
1589
+ }
1590
+
1591
+ setCollections(collections);
1592
+ var isPanelOpen = props.shouldPanelOpen({
1593
+ state: store.getState()
1492
1594
  });
1595
+ setIsOpen((_nextState$isOpen2 = nextState.isOpen) !== null && _nextState$isOpen2 !== void 0 ? _nextState$isOpen2 : props.openOnFocus && !query && isPanelOpen || isPanelOpen);
1596
+ var highlightedItem = getActiveItem(store.getState());
1597
+
1598
+ if (store.getState().activeItemId !== null && highlightedItem) {
1599
+ var item = highlightedItem.item,
1600
+ itemInputValue = highlightedItem.itemInputValue,
1601
+ itemUrl = highlightedItem.itemUrl,
1602
+ source = highlightedItem.source;
1603
+ source.onActive(_objectSpread$8({
1604
+ event: event,
1605
+ item: item,
1606
+ itemInputValue: itemInputValue,
1607
+ itemUrl: itemUrl,
1608
+ refresh: refresh,
1609
+ source: source,
1610
+ state: store.getState()
1611
+ }, setters));
1612
+ }
1613
+ }).finally(function () {
1614
+ if (lastStalledId) {
1615
+ props.environment.clearTimeout(lastStalledId);
1616
+ }
1493
1617
  });
1494
1618
  }
1619
+ onInput.isRunning = runConcurrentSafePromise.isRunning;
1495
1620
 
1496
- function ownKeys$9(object, enumerableOnly) {
1621
+ var _excluded$5 = ["event", "props", "refresh", "store"];
1622
+
1623
+ function ownKeys$7(object, enumerableOnly) {
1497
1624
  var keys = Object.keys(object);
1498
1625
 
1499
1626
  if (Object.getOwnPropertySymbols) {
1500
1627
  var symbols = Object.getOwnPropertySymbols(object);
1501
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
1502
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
1503
- });
1628
+
1629
+ if (enumerableOnly) {
1630
+ symbols = symbols.filter(function (sym) {
1631
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
1632
+ });
1633
+ }
1634
+
1504
1635
  keys.push.apply(keys, symbols);
1505
1636
  }
1506
1637
 
1507
1638
  return keys;
1508
1639
  }
1509
1640
 
1510
- function _objectSpread$8(target) {
1641
+ function _objectSpread$7(target) {
1511
1642
  for (var i = 1; i < arguments.length; i++) {
1512
1643
  var source = arguments[i] != null ? arguments[i] : {};
1513
1644
 
1514
1645
  if (i % 2) {
1515
- ownKeys$9(Object(source), true).forEach(function (key) {
1516
- _defineProperty$9(target, key, source[key]);
1646
+ ownKeys$7(Object(source), true).forEach(function (key) {
1647
+ _defineProperty$7(target, key, source[key]);
1517
1648
  });
1518
1649
  } else if (Object.getOwnPropertyDescriptors) {
1519
1650
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1520
1651
  } else {
1521
- ownKeys$9(Object(source)).forEach(function (key) {
1652
+ ownKeys$7(Object(source)).forEach(function (key) {
1522
1653
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1523
1654
  });
1524
1655
  }
@@ -1527,7 +1658,7 @@
1527
1658
  return target;
1528
1659
  }
1529
1660
 
1530
- function _defineProperty$9(obj, key, value) {
1661
+ function _defineProperty$7(obj, key, value) {
1531
1662
  if (key in obj) {
1532
1663
  Object.defineProperty(obj, key, {
1533
1664
  value: value,
@@ -1582,7 +1713,7 @@
1582
1713
  props = _ref.props,
1583
1714
  refresh = _ref.refresh,
1584
1715
  store = _ref.store,
1585
- setters = _objectWithoutProperties$2(_ref, ["event", "props", "refresh", "store"]);
1716
+ setters = _objectWithoutProperties$2(_ref, _excluded$5);
1586
1717
 
1587
1718
  if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {
1588
1719
  // eslint-disable-next-line no-inner-declarations
@@ -1607,7 +1738,7 @@
1607
1738
  itemInputValue = highlightedItem.itemInputValue,
1608
1739
  itemUrl = highlightedItem.itemUrl,
1609
1740
  source = highlightedItem.source;
1610
- source.onActive(_objectSpread$8({
1741
+ source.onActive(_objectSpread$7({
1611
1742
  event: event,
1612
1743
  item: item,
1613
1744
  itemInputValue: itemInputValue,
@@ -1625,7 +1756,7 @@
1625
1756
  // synchronized as `onInput` returns a promise.
1626
1757
 
1627
1758
  if (store.getState().isOpen === false && (props.openOnFocus || Boolean(store.getState().query))) {
1628
- onInput(_objectSpread$8({
1759
+ onInput(_objectSpread$7({
1629
1760
  event: event,
1630
1761
  props: props,
1631
1762
  query: store.getState().query,
@@ -1651,7 +1782,14 @@
1651
1782
  // from removing the query right away because we first want to close the
1652
1783
  // panel.
1653
1784
  event.preventDefault();
1654
- store.dispatch(event.key, null);
1785
+ store.dispatch(event.key, null); // Hitting the `Escape` key signals the end of a user interaction with the
1786
+ // autocomplete. At this point, we should ignore any requests that are still
1787
+ // running and could reopen the panel once they resolve, because that would
1788
+ // result in an unsolicited UI behavior.
1789
+
1790
+ if (onInput.isRunning()) {
1791
+ store.shouldSkipPendingUpdate = true;
1792
+ }
1655
1793
  } else if (event.key === 'Enter') {
1656
1794
  // No active item, so we let the browser handle the native `onSubmit` form
1657
1795
  // event.
@@ -1673,7 +1811,7 @@
1673
1811
 
1674
1812
  if (event.metaKey || event.ctrlKey) {
1675
1813
  if (itemUrl !== undefined) {
1676
- source.onSelect(_objectSpread$8({
1814
+ source.onSelect(_objectSpread$7({
1677
1815
  event: event,
1678
1816
  item: item,
1679
1817
  itemInputValue: itemInputValue,
@@ -1690,7 +1828,7 @@
1690
1828
  }
1691
1829
  } else if (event.shiftKey) {
1692
1830
  if (itemUrl !== undefined) {
1693
- source.onSelect(_objectSpread$8({
1831
+ source.onSelect(_objectSpread$7({
1694
1832
  event: event,
1695
1833
  item: item,
1696
1834
  itemInputValue: itemInputValue,
@@ -1707,7 +1845,7 @@
1707
1845
  }
1708
1846
  } else if (event.altKey) ; else {
1709
1847
  if (itemUrl !== undefined) {
1710
- source.onSelect(_objectSpread$8({
1848
+ source.onSelect(_objectSpread$7({
1711
1849
  event: event,
1712
1850
  item: item,
1713
1851
  itemInputValue: itemInputValue,
@@ -1724,7 +1862,7 @@
1724
1862
  return;
1725
1863
  }
1726
1864
 
1727
- onInput(_objectSpread$8({
1865
+ onInput(_objectSpread$7({
1728
1866
  event: event,
1729
1867
  nextState: {
1730
1868
  isOpen: false
@@ -1734,7 +1872,7 @@
1734
1872
  refresh: refresh,
1735
1873
  store: store
1736
1874
  }, setters)).then(function () {
1737
- source.onSelect(_objectSpread$8({
1875
+ source.onSelect(_objectSpread$7({
1738
1876
  event: event,
1739
1877
  item: item,
1740
1878
  itemInputValue: itemInputValue,
@@ -1748,32 +1886,42 @@
1748
1886
  }
1749
1887
  }
1750
1888
 
1751
- function ownKeys$a(object, enumerableOnly) {
1889
+ var _excluded$4 = ["props", "refresh", "store"],
1890
+ _excluded2 = ["inputElement", "formElement", "panelElement"],
1891
+ _excluded3 = ["inputElement"],
1892
+ _excluded4 = ["inputElement", "maxLength"],
1893
+ _excluded5 = ["item", "source"];
1894
+
1895
+ function ownKeys$6(object, enumerableOnly) {
1752
1896
  var keys = Object.keys(object);
1753
1897
 
1754
1898
  if (Object.getOwnPropertySymbols) {
1755
1899
  var symbols = Object.getOwnPropertySymbols(object);
1756
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
1757
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
1758
- });
1900
+
1901
+ if (enumerableOnly) {
1902
+ symbols = symbols.filter(function (sym) {
1903
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
1904
+ });
1905
+ }
1906
+
1759
1907
  keys.push.apply(keys, symbols);
1760
1908
  }
1761
1909
 
1762
1910
  return keys;
1763
1911
  }
1764
1912
 
1765
- function _objectSpread$9(target) {
1913
+ function _objectSpread$6(target) {
1766
1914
  for (var i = 1; i < arguments.length; i++) {
1767
1915
  var source = arguments[i] != null ? arguments[i] : {};
1768
1916
 
1769
1917
  if (i % 2) {
1770
- ownKeys$a(Object(source), true).forEach(function (key) {
1771
- _defineProperty$a(target, key, source[key]);
1918
+ ownKeys$6(Object(source), true).forEach(function (key) {
1919
+ _defineProperty$6(target, key, source[key]);
1772
1920
  });
1773
1921
  } else if (Object.getOwnPropertyDescriptors) {
1774
1922
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1775
1923
  } else {
1776
- ownKeys$a(Object(source)).forEach(function (key) {
1924
+ ownKeys$6(Object(source)).forEach(function (key) {
1777
1925
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1778
1926
  });
1779
1927
  }
@@ -1782,7 +1930,7 @@
1782
1930
  return target;
1783
1931
  }
1784
1932
 
1785
- function _defineProperty$a(obj, key, value) {
1933
+ function _defineProperty$6(obj, key, value) {
1786
1934
  if (key in obj) {
1787
1935
  Object.defineProperty(obj, key, {
1788
1936
  value: value,
@@ -1797,10 +1945,10 @@
1797
1945
  return obj;
1798
1946
  }
1799
1947
 
1800
- function _objectWithoutProperties$3(source, excluded) {
1948
+ function _objectWithoutProperties$1(source, excluded) {
1801
1949
  if (source == null) return {};
1802
1950
 
1803
- var target = _objectWithoutPropertiesLoose$3(source, excluded);
1951
+ var target = _objectWithoutPropertiesLoose$1(source, excluded);
1804
1952
 
1805
1953
  var key, i;
1806
1954
 
@@ -1818,7 +1966,7 @@
1818
1966
  return target;
1819
1967
  }
1820
1968
 
1821
- function _objectWithoutPropertiesLoose$3(source, excluded) {
1969
+ function _objectWithoutPropertiesLoose$1(source, excluded) {
1822
1970
  if (source == null) return {};
1823
1971
  var target = {};
1824
1972
  var sourceKeys = Object.keys(source);
@@ -1836,33 +1984,48 @@
1836
1984
  var props = _ref.props,
1837
1985
  refresh = _ref.refresh,
1838
1986
  store = _ref.store,
1839
- setters = _objectWithoutProperties$3(_ref, ["props", "refresh", "store"]);
1987
+ setters = _objectWithoutProperties$1(_ref, _excluded$4);
1840
1988
 
1841
1989
  var getEnvironmentProps = function getEnvironmentProps(providedProps) {
1842
1990
  var inputElement = providedProps.inputElement,
1843
1991
  formElement = providedProps.formElement,
1844
1992
  panelElement = providedProps.panelElement,
1845
- rest = _objectWithoutProperties$3(providedProps, ["inputElement", "formElement", "panelElement"]);
1993
+ rest = _objectWithoutProperties$1(providedProps, _excluded2);
1846
1994
 
1847
- return _objectSpread$9({
1995
+ return _objectSpread$6({
1848
1996
  // On touch devices, we do not rely on the native `blur` event of the
1849
1997
  // input to close the panel, but rather on a custom `touchstart` event
1850
1998
  // outside of the autocomplete elements.
1851
1999
  // This ensures a working experience on mobile because we blur the input
1852
2000
  // on touch devices when the user starts scrolling (`touchmove`).
2001
+ // @TODO: support cases where there are multiple Autocomplete instances.
2002
+ // Right now, a second instance makes this computation return false.
1853
2003
  onTouchStart: function onTouchStart(event) {
1854
- if (store.getState().isOpen === false || event.target === inputElement) {
2004
+ // The `onTouchStart` event shouldn't trigger the `blur` handler when
2005
+ // it's not an interaction with Autocomplete. We detect it with the
2006
+ // following heuristics:
2007
+ // - the panel is closed AND there are no running requests
2008
+ // (no interaction with the autocomplete, no future state updates)
2009
+ // - OR the touched target is the input element (should open the panel)
2010
+ var isNotAutocompleteInteraction = store.getState().isOpen === false && !onInput.isRunning();
2011
+
2012
+ if (isNotAutocompleteInteraction || event.target === inputElement) {
1855
2013
  return;
1856
- } // @TODO: support cases where there are multiple Autocomplete instances.
1857
- // Right now, a second instance makes this computation return false.
1858
-
2014
+ }
1859
2015
 
1860
2016
  var isTargetWithinAutocomplete = [formElement, panelElement].some(function (contextNode) {
1861
- return isOrContainsNode(contextNode, event.target) || isOrContainsNode(contextNode, props.environment.document.activeElement);
2017
+ return isOrContainsNode(contextNode, event.target);
1862
2018
  });
1863
2019
 
1864
2020
  if (isTargetWithinAutocomplete === false) {
1865
- store.dispatch('blur', null);
2021
+ store.dispatch('blur', null); // If requests are still running when the user closes the panel, they
2022
+ // could reopen the panel once they resolve.
2023
+ // We want to prevent any subsequent query from reopening the panel
2024
+ // because it would result in an unsolicited UI behavior.
2025
+
2026
+ if (!props.debug && onInput.isRunning()) {
2027
+ store.shouldSkipPendingUpdate = true;
2028
+ }
1866
2029
  }
1867
2030
  },
1868
2031
  // When scrolling on touch devices (mobiles, tablets, etc.), we want to
@@ -1880,7 +2043,7 @@
1880
2043
  };
1881
2044
 
1882
2045
  var getRootProps = function getRootProps(rest) {
1883
- return _objectSpread$9({
2046
+ return _objectSpread$6({
1884
2047
  role: 'combobox',
1885
2048
  'aria-expanded': store.getState().isOpen,
1886
2049
  'aria-haspopup': 'listbox',
@@ -1890,10 +2053,10 @@
1890
2053
  };
1891
2054
 
1892
2055
  var getFormProps = function getFormProps(providedProps) {
1893
- var inputElement = providedProps.inputElement,
1894
- rest = _objectWithoutProperties$3(providedProps, ["inputElement"]);
2056
+ providedProps.inputElement;
2057
+ var rest = _objectWithoutProperties$1(providedProps, _excluded3);
1895
2058
 
1896
- return _objectSpread$9({
2059
+ return _objectSpread$6({
1897
2060
  action: '',
1898
2061
  noValidate: true,
1899
2062
  role: 'search',
@@ -1901,7 +2064,7 @@
1901
2064
  var _providedProps$inputE;
1902
2065
 
1903
2066
  event.preventDefault();
1904
- props.onSubmit(_objectSpread$9({
2067
+ props.onSubmit(_objectSpread$6({
1905
2068
  event: event,
1906
2069
  refresh: refresh,
1907
2070
  state: store.getState()
@@ -1913,7 +2076,7 @@
1913
2076
  var _providedProps$inputE2;
1914
2077
 
1915
2078
  event.preventDefault();
1916
- props.onReset(_objectSpread$9({
2079
+ props.onReset(_objectSpread$6({
1917
2080
  event: event,
1918
2081
  refresh: refresh,
1919
2082
  state: store.getState()
@@ -1929,7 +2092,7 @@
1929
2092
  // We want to trigger a query when `openOnFocus` is true
1930
2093
  // because the panel should open with the current query.
1931
2094
  if (props.openOnFocus || Boolean(store.getState().query)) {
1932
- onInput(_objectSpread$9({
2095
+ onInput(_objectSpread$6({
1933
2096
  event: event,
1934
2097
  props: props,
1935
2098
  query: store.getState().completion || store.getState().query,
@@ -1943,14 +2106,14 @@
1943
2106
 
1944
2107
  var isTouchDevice = ('ontouchstart' in props.environment);
1945
2108
 
1946
- var _ref2 = providedProps || {},
1947
- inputElement = _ref2.inputElement,
1948
- _ref2$maxLength = _ref2.maxLength,
2109
+ var _ref2 = providedProps || {};
2110
+ _ref2.inputElement;
2111
+ var _ref2$maxLength = _ref2.maxLength,
1949
2112
  maxLength = _ref2$maxLength === void 0 ? 512 : _ref2$maxLength,
1950
- rest = _objectWithoutProperties$3(_ref2, ["inputElement", "maxLength"]);
2113
+ rest = _objectWithoutProperties$1(_ref2, _excluded4);
1951
2114
 
1952
2115
  var activeItem = getActiveItem(store.getState());
1953
- return _objectSpread$9({
2116
+ return _objectSpread$6({
1954
2117
  'aria-autocomplete': 'both',
1955
2118
  'aria-activedescendant': store.getState().isOpen && store.getState().activeItemId !== null ? "".concat(props.id, "-item-").concat(store.getState().activeItemId) : undefined,
1956
2119
  'aria-controls': store.getState().isOpen ? "".concat(props.id, "-list") : undefined,
@@ -1967,7 +2130,7 @@
1967
2130
  maxLength: maxLength,
1968
2131
  type: 'search',
1969
2132
  onChange: function onChange(event) {
1970
- onInput(_objectSpread$9({
2133
+ onInput(_objectSpread$6({
1971
2134
  event: event,
1972
2135
  props: props,
1973
2136
  query: event.currentTarget.value.slice(0, maxLength),
@@ -1976,7 +2139,7 @@
1976
2139
  }, setters));
1977
2140
  },
1978
2141
  onKeyDown: function onKeyDown$1(event) {
1979
- onKeyDown(_objectSpread$9({
2142
+ onKeyDown(_objectSpread$6({
1980
2143
  event: event,
1981
2144
  props: props,
1982
2145
  refresh: refresh,
@@ -1988,7 +2151,14 @@
1988
2151
  // We do rely on the `blur` event on touch devices.
1989
2152
  // See explanation in `onTouchStart`.
1990
2153
  if (!isTouchDevice) {
1991
- store.dispatch('blur', null);
2154
+ store.dispatch('blur', null); // If requests are still running when the user closes the panel, they
2155
+ // could reopen the panel once they resolve.
2156
+ // We want to prevent any subsequent query from reopening the panel
2157
+ // because it would result in an unsolicited UI behavior.
2158
+
2159
+ if (!props.debug && onInput.isRunning()) {
2160
+ store.shouldSkipPendingUpdate = true;
2161
+ }
1992
2162
  }
1993
2163
  },
1994
2164
  onClick: function onClick(event) {
@@ -2007,14 +2177,14 @@
2007
2177
  };
2008
2178
 
2009
2179
  var getLabelProps = function getLabelProps(rest) {
2010
- return _objectSpread$9({
2180
+ return _objectSpread$6({
2011
2181
  htmlFor: "".concat(props.id, "-input"),
2012
2182
  id: "".concat(props.id, "-label")
2013
2183
  }, rest);
2014
2184
  };
2015
2185
 
2016
2186
  var getListProps = function getListProps(rest) {
2017
- return _objectSpread$9({
2187
+ return _objectSpread$6({
2018
2188
  role: 'listbox',
2019
2189
  'aria-labelledby': "".concat(props.id, "-label"),
2020
2190
  id: "".concat(props.id, "-list")
@@ -2022,7 +2192,7 @@
2022
2192
  };
2023
2193
 
2024
2194
  var getPanelProps = function getPanelProps(rest) {
2025
- return _objectSpread$9({
2195
+ return _objectSpread$6({
2026
2196
  onMouseDown: function onMouseDown(event) {
2027
2197
  // Prevents the `activeElement` from being changed to the panel so
2028
2198
  // that the blur event is not triggered, otherwise it closes the
@@ -2038,9 +2208,9 @@
2038
2208
  var getItemProps = function getItemProps(providedProps) {
2039
2209
  var item = providedProps.item,
2040
2210
  source = providedProps.source,
2041
- rest = _objectWithoutProperties$3(providedProps, ["item", "source"]);
2211
+ rest = _objectWithoutProperties$1(providedProps, _excluded5);
2042
2212
 
2043
- return _objectSpread$9({
2213
+ return _objectSpread$6({
2044
2214
  id: "".concat(props.id, "-item-").concat(item.__autocomplete_id),
2045
2215
  role: 'option',
2046
2216
  'aria-selected': store.getState().activeItemId === item.__autocomplete_id,
@@ -2058,7 +2228,7 @@
2058
2228
  itemUrl = activeItem.itemUrl,
2059
2229
  _source = activeItem.source;
2060
2230
 
2061
- _source.onActive(_objectSpread$9({
2231
+ _source.onActive(_objectSpread$6({
2062
2232
  event: event,
2063
2233
  item: _item,
2064
2234
  itemInputValue: itemInputValue,
@@ -2088,7 +2258,7 @@
2088
2258
  // the `activeItemId`, resulting in a UI flash, especially
2089
2259
  // noticeable on mobile.
2090
2260
 
2091
- var runPreCommand = itemUrl ? Promise.resolve() : onInput(_objectSpread$9({
2261
+ var runPreCommand = itemUrl ? Promise.resolve() : onInput(_objectSpread$6({
2092
2262
  event: event,
2093
2263
  nextState: {
2094
2264
  isOpen: false
@@ -2099,7 +2269,7 @@
2099
2269
  store: store
2100
2270
  }, setters));
2101
2271
  runPreCommand.then(function () {
2102
- source.onSelect(_objectSpread$9({
2272
+ source.onSelect(_objectSpread$6({
2103
2273
  event: event,
2104
2274
  item: item,
2105
2275
  itemInputValue: itemInputValue,
@@ -2125,6 +2295,96 @@
2125
2295
  };
2126
2296
  }
2127
2297
 
2298
+ function ownKeys$5(object, enumerableOnly) {
2299
+ var keys = Object.keys(object);
2300
+
2301
+ if (Object.getOwnPropertySymbols) {
2302
+ var symbols = Object.getOwnPropertySymbols(object);
2303
+
2304
+ if (enumerableOnly) {
2305
+ symbols = symbols.filter(function (sym) {
2306
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
2307
+ });
2308
+ }
2309
+
2310
+ keys.push.apply(keys, symbols);
2311
+ }
2312
+
2313
+ return keys;
2314
+ }
2315
+
2316
+ function _objectSpread$5(target) {
2317
+ for (var i = 1; i < arguments.length; i++) {
2318
+ var source = arguments[i] != null ? arguments[i] : {};
2319
+
2320
+ if (i % 2) {
2321
+ ownKeys$5(Object(source), true).forEach(function (key) {
2322
+ _defineProperty$5(target, key, source[key]);
2323
+ });
2324
+ } else if (Object.getOwnPropertyDescriptors) {
2325
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2326
+ } else {
2327
+ ownKeys$5(Object(source)).forEach(function (key) {
2328
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2329
+ });
2330
+ }
2331
+ }
2332
+
2333
+ return target;
2334
+ }
2335
+
2336
+ function _defineProperty$5(obj, key, value) {
2337
+ if (key in obj) {
2338
+ Object.defineProperty(obj, key, {
2339
+ value: value,
2340
+ enumerable: true,
2341
+ configurable: true,
2342
+ writable: true
2343
+ });
2344
+ } else {
2345
+ obj[key] = value;
2346
+ }
2347
+
2348
+ return obj;
2349
+ }
2350
+ function getMetadata(_ref) {
2351
+ var _, _options$__autocomple, _options$__autocomple2, _options$__autocomple3;
2352
+
2353
+ var plugins = _ref.plugins,
2354
+ options = _ref.options;
2355
+ var optionsKey = (_ = (((_options$__autocomple = options.__autocomplete_metadata) === null || _options$__autocomple === void 0 ? void 0 : _options$__autocomple.userAgents) || [])[0]) === null || _ === void 0 ? void 0 : _.segment;
2356
+ var extraOptions = optionsKey ? _defineProperty$5({}, optionsKey, Object.keys(((_options$__autocomple2 = options.__autocomplete_metadata) === null || _options$__autocomple2 === void 0 ? void 0 : _options$__autocomple2.options) || {})) : {};
2357
+ return {
2358
+ plugins: plugins.map(function (plugin) {
2359
+ return {
2360
+ name: plugin.name,
2361
+ options: Object.keys(plugin.__autocomplete_pluginOptions || [])
2362
+ };
2363
+ }),
2364
+ options: _objectSpread$5({
2365
+ 'autocomplete-core': Object.keys(options)
2366
+ }, extraOptions),
2367
+ ua: userAgents$1.concat(((_options$__autocomple3 = options.__autocomplete_metadata) === null || _options$__autocomple3 === void 0 ? void 0 : _options$__autocomple3.userAgents) || [])
2368
+ };
2369
+ }
2370
+ function injectMetadata(_ref3) {
2371
+ var _environment$navigato;
2372
+
2373
+ var metadata = _ref3.metadata,
2374
+ environment = _ref3.environment;
2375
+ var isMetadataEnabled = (_environment$navigato = environment.navigator) === null || _environment$navigato === void 0 ? void 0 : _environment$navigato.userAgent.includes('Algolia Crawler');
2376
+
2377
+ if (isMetadataEnabled) {
2378
+ var metadataContainer = environment.document.createElement('meta');
2379
+ var headRef = environment.document.querySelector('head');
2380
+ metadataContainer.name = 'algolia:metadata';
2381
+ setTimeout(function () {
2382
+ metadataContainer.content = JSON.stringify(metadata);
2383
+ headRef.appendChild(metadataContainer);
2384
+ }, 0);
2385
+ }
2386
+ }
2387
+
2128
2388
  function getCompletion(_ref) {
2129
2389
  var _getActiveItem;
2130
2390
 
@@ -2137,32 +2397,36 @@
2137
2397
  return ((_getActiveItem = getActiveItem(state)) === null || _getActiveItem === void 0 ? void 0 : _getActiveItem.itemInputValue) || null;
2138
2398
  }
2139
2399
 
2140
- function ownKeys$b(object, enumerableOnly) {
2400
+ function ownKeys$4(object, enumerableOnly) {
2141
2401
  var keys = Object.keys(object);
2142
2402
 
2143
2403
  if (Object.getOwnPropertySymbols) {
2144
2404
  var symbols = Object.getOwnPropertySymbols(object);
2145
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
2146
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
2147
- });
2405
+
2406
+ if (enumerableOnly) {
2407
+ symbols = symbols.filter(function (sym) {
2408
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
2409
+ });
2410
+ }
2411
+
2148
2412
  keys.push.apply(keys, symbols);
2149
2413
  }
2150
2414
 
2151
2415
  return keys;
2152
2416
  }
2153
2417
 
2154
- function _objectSpread$a(target) {
2418
+ function _objectSpread$4(target) {
2155
2419
  for (var i = 1; i < arguments.length; i++) {
2156
2420
  var source = arguments[i] != null ? arguments[i] : {};
2157
2421
 
2158
2422
  if (i % 2) {
2159
- ownKeys$b(Object(source), true).forEach(function (key) {
2160
- _defineProperty$b(target, key, source[key]);
2423
+ ownKeys$4(Object(source), true).forEach(function (key) {
2424
+ _defineProperty$4(target, key, source[key]);
2161
2425
  });
2162
2426
  } else if (Object.getOwnPropertyDescriptors) {
2163
2427
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2164
2428
  } else {
2165
- ownKeys$b(Object(source)).forEach(function (key) {
2429
+ ownKeys$4(Object(source)).forEach(function (key) {
2166
2430
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2167
2431
  });
2168
2432
  }
@@ -2171,7 +2435,7 @@
2171
2435
  return target;
2172
2436
  }
2173
2437
 
2174
- function _defineProperty$b(obj, key, value) {
2438
+ function _defineProperty$4(obj, key, value) {
2175
2439
  if (key in obj) {
2176
2440
  Object.defineProperty(obj, key, {
2177
2441
  value: value,
@@ -2189,14 +2453,14 @@
2189
2453
  switch (action.type) {
2190
2454
  case 'setActiveItemId':
2191
2455
  {
2192
- return _objectSpread$a(_objectSpread$a({}, state), {}, {
2456
+ return _objectSpread$4(_objectSpread$4({}, state), {}, {
2193
2457
  activeItemId: action.payload
2194
2458
  });
2195
2459
  }
2196
2460
 
2197
2461
  case 'setQuery':
2198
2462
  {
2199
- return _objectSpread$a(_objectSpread$a({}, state), {}, {
2463
+ return _objectSpread$4(_objectSpread$4({}, state), {}, {
2200
2464
  query: action.payload,
2201
2465
  completion: null
2202
2466
  });
@@ -2204,39 +2468,39 @@
2204
2468
 
2205
2469
  case 'setCollections':
2206
2470
  {
2207
- return _objectSpread$a(_objectSpread$a({}, state), {}, {
2471
+ return _objectSpread$4(_objectSpread$4({}, state), {}, {
2208
2472
  collections: action.payload
2209
2473
  });
2210
2474
  }
2211
2475
 
2212
2476
  case 'setIsOpen':
2213
2477
  {
2214
- return _objectSpread$a(_objectSpread$a({}, state), {}, {
2478
+ return _objectSpread$4(_objectSpread$4({}, state), {}, {
2215
2479
  isOpen: action.payload
2216
2480
  });
2217
2481
  }
2218
2482
 
2219
2483
  case 'setStatus':
2220
2484
  {
2221
- return _objectSpread$a(_objectSpread$a({}, state), {}, {
2485
+ return _objectSpread$4(_objectSpread$4({}, state), {}, {
2222
2486
  status: action.payload
2223
2487
  });
2224
2488
  }
2225
2489
 
2226
2490
  case 'setContext':
2227
2491
  {
2228
- return _objectSpread$a(_objectSpread$a({}, state), {}, {
2229
- context: _objectSpread$a(_objectSpread$a({}, state.context), action.payload)
2492
+ return _objectSpread$4(_objectSpread$4({}, state), {}, {
2493
+ context: _objectSpread$4(_objectSpread$4({}, state.context), action.payload)
2230
2494
  });
2231
2495
  }
2232
2496
 
2233
2497
  case 'ArrowDown':
2234
2498
  {
2235
- var nextState = _objectSpread$a(_objectSpread$a({}, state), {}, {
2499
+ var nextState = _objectSpread$4(_objectSpread$4({}, state), {}, {
2236
2500
  activeItemId: action.payload.hasOwnProperty('nextActiveItemId') ? action.payload.nextActiveItemId : getNextActiveItemId(1, state.activeItemId, getItemsCount(state), action.props.defaultActiveItemId)
2237
2501
  });
2238
2502
 
2239
- return _objectSpread$a(_objectSpread$a({}, nextState), {}, {
2503
+ return _objectSpread$4(_objectSpread$4({}, nextState), {}, {
2240
2504
  completion: getCompletion({
2241
2505
  state: nextState
2242
2506
  })
@@ -2245,11 +2509,11 @@
2245
2509
 
2246
2510
  case 'ArrowUp':
2247
2511
  {
2248
- var _nextState = _objectSpread$a(_objectSpread$a({}, state), {}, {
2512
+ var _nextState = _objectSpread$4(_objectSpread$4({}, state), {}, {
2249
2513
  activeItemId: getNextActiveItemId(-1, state.activeItemId, getItemsCount(state), action.props.defaultActiveItemId)
2250
2514
  });
2251
2515
 
2252
- return _objectSpread$a(_objectSpread$a({}, _nextState), {}, {
2516
+ return _objectSpread$4(_objectSpread$4({}, _nextState), {}, {
2253
2517
  completion: getCompletion({
2254
2518
  state: _nextState
2255
2519
  })
@@ -2259,14 +2523,14 @@
2259
2523
  case 'Escape':
2260
2524
  {
2261
2525
  if (state.isOpen) {
2262
- return _objectSpread$a(_objectSpread$a({}, state), {}, {
2526
+ return _objectSpread$4(_objectSpread$4({}, state), {}, {
2263
2527
  activeItemId: null,
2264
2528
  isOpen: false,
2265
2529
  completion: null
2266
2530
  });
2267
2531
  }
2268
2532
 
2269
- return _objectSpread$a(_objectSpread$a({}, state), {}, {
2533
+ return _objectSpread$4(_objectSpread$4({}, state), {}, {
2270
2534
  activeItemId: null,
2271
2535
  query: '',
2272
2536
  status: 'idle',
@@ -2276,7 +2540,7 @@
2276
2540
 
2277
2541
  case 'submit':
2278
2542
  {
2279
- return _objectSpread$a(_objectSpread$a({}, state), {}, {
2543
+ return _objectSpread$4(_objectSpread$4({}, state), {}, {
2280
2544
  activeItemId: null,
2281
2545
  isOpen: false,
2282
2546
  status: 'idle'
@@ -2285,7 +2549,7 @@
2285
2549
 
2286
2550
  case 'reset':
2287
2551
  {
2288
- return _objectSpread$a(_objectSpread$a({}, state), {}, {
2552
+ return _objectSpread$4(_objectSpread$4({}, state), {}, {
2289
2553
  activeItemId: // Since we open the panel on reset when openOnFocus=true
2290
2554
  // we need to restore the highlighted index to the defaultActiveItemId. (DocSearch use-case)
2291
2555
  // Since we close the panel when openOnFocus=false
@@ -2298,7 +2562,7 @@
2298
2562
 
2299
2563
  case 'focus':
2300
2564
  {
2301
- return _objectSpread$a(_objectSpread$a({}, state), {}, {
2565
+ return _objectSpread$4(_objectSpread$4({}, state), {}, {
2302
2566
  activeItemId: action.props.defaultActiveItemId,
2303
2567
  isOpen: (action.props.openOnFocus || Boolean(state.query)) && action.props.shouldPanelOpen({
2304
2568
  state: state
@@ -2312,7 +2576,7 @@
2312
2576
  return state;
2313
2577
  }
2314
2578
 
2315
- return _objectSpread$a(_objectSpread$a({}, state), {}, {
2579
+ return _objectSpread$4(_objectSpread$4({}, state), {}, {
2316
2580
  isOpen: false,
2317
2581
  activeItemId: null
2318
2582
  });
@@ -2320,14 +2584,14 @@
2320
2584
 
2321
2585
  case 'mousemove':
2322
2586
  {
2323
- return _objectSpread$a(_objectSpread$a({}, state), {}, {
2587
+ return _objectSpread$4(_objectSpread$4({}, state), {}, {
2324
2588
  activeItemId: action.payload
2325
2589
  });
2326
2590
  }
2327
2591
 
2328
2592
  case 'mouseleave':
2329
2593
  {
2330
- return _objectSpread$a(_objectSpread$a({}, state), {}, {
2594
+ return _objectSpread$4(_objectSpread$4({}, state), {}, {
2331
2595
  activeItemId: action.props.defaultActiveItemId
2332
2596
  });
2333
2597
  }
@@ -2338,32 +2602,36 @@
2338
2602
  }
2339
2603
  };
2340
2604
 
2341
- function ownKeys$c(object, enumerableOnly) {
2605
+ function ownKeys$3(object, enumerableOnly) {
2342
2606
  var keys = Object.keys(object);
2343
2607
 
2344
2608
  if (Object.getOwnPropertySymbols) {
2345
2609
  var symbols = Object.getOwnPropertySymbols(object);
2346
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
2347
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
2348
- });
2610
+
2611
+ if (enumerableOnly) {
2612
+ symbols = symbols.filter(function (sym) {
2613
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
2614
+ });
2615
+ }
2616
+
2349
2617
  keys.push.apply(keys, symbols);
2350
2618
  }
2351
2619
 
2352
2620
  return keys;
2353
2621
  }
2354
2622
 
2355
- function _objectSpread$b(target) {
2623
+ function _objectSpread$3(target) {
2356
2624
  for (var i = 1; i < arguments.length; i++) {
2357
2625
  var source = arguments[i] != null ? arguments[i] : {};
2358
2626
 
2359
2627
  if (i % 2) {
2360
- ownKeys$c(Object(source), true).forEach(function (key) {
2361
- _defineProperty$c(target, key, source[key]);
2628
+ ownKeys$3(Object(source), true).forEach(function (key) {
2629
+ _defineProperty$3(target, key, source[key]);
2362
2630
  });
2363
2631
  } else if (Object.getOwnPropertyDescriptors) {
2364
2632
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2365
2633
  } else {
2366
- ownKeys$c(Object(source)).forEach(function (key) {
2634
+ ownKeys$3(Object(source)).forEach(function (key) {
2367
2635
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2368
2636
  });
2369
2637
  }
@@ -2372,7 +2640,7 @@
2372
2640
  return target;
2373
2641
  }
2374
2642
 
2375
- function _defineProperty$c(obj, key, value) {
2643
+ function _defineProperty$3(obj, key, value) {
2376
2644
  if (key in obj) {
2377
2645
  Object.defineProperty(obj, key, {
2378
2646
  value: value,
@@ -2394,7 +2662,7 @@
2394
2662
  var setters = getAutocompleteSetters({
2395
2663
  store: store
2396
2664
  });
2397
- var propGetters = getPropGetters(_objectSpread$b({
2665
+ var propGetters = getPropGetters(_objectSpread$3({
2398
2666
  props: props,
2399
2667
  refresh: refresh,
2400
2668
  store: store
@@ -2403,7 +2671,7 @@
2403
2671
  function onStoreStateChange(_ref) {
2404
2672
  var prevState = _ref.prevState,
2405
2673
  state = _ref.state;
2406
- props.onStateChange(_objectSpread$b({
2674
+ props.onStateChange(_objectSpread$3({
2407
2675
  prevState: prevState,
2408
2676
  state: state,
2409
2677
  refresh: refresh
@@ -2411,7 +2679,7 @@
2411
2679
  }
2412
2680
 
2413
2681
  function refresh() {
2414
- return onInput(_objectSpread$b({
2682
+ return onInput(_objectSpread$3({
2415
2683
  event: new Event('input'),
2416
2684
  nextState: {
2417
2685
  isOpen: store.getState().isOpen
@@ -2426,7 +2694,7 @@
2426
2694
  props.plugins.forEach(function (plugin) {
2427
2695
  var _plugin$subscribe;
2428
2696
 
2429
- return (_plugin$subscribe = plugin.subscribe) === null || _plugin$subscribe === void 0 ? void 0 : _plugin$subscribe.call(plugin, _objectSpread$b(_objectSpread$b({}, setters), {}, {
2697
+ return (_plugin$subscribe = plugin.subscribe) === null || _plugin$subscribe === void 0 ? void 0 : _plugin$subscribe.call(plugin, _objectSpread$3(_objectSpread$3({}, setters), {}, {
2430
2698
  refresh: refresh,
2431
2699
  onSelect: function onSelect(fn) {
2432
2700
  subscribers.push({
@@ -2440,7 +2708,14 @@
2440
2708
  }
2441
2709
  }));
2442
2710
  });
2443
- return _objectSpread$b(_objectSpread$b({
2711
+ injectMetadata({
2712
+ metadata: getMetadata({
2713
+ plugins: props.plugins,
2714
+ options: options
2715
+ }),
2716
+ environment: props.environment
2717
+ });
2718
+ return _objectSpread$3(_objectSpread$3({
2444
2719
  refresh: refresh
2445
2720
  }, propGetters), setters);
2446
2721
  }
@@ -2487,8 +2762,8 @@
2487
2762
  }, {});
2488
2763
  }
2489
2764
 
2490
- var isObject = function isObject(value) {
2491
- return value && _typeof(value) === 'object';
2765
+ var isPlainObject = function isPlainObject(value) {
2766
+ return value && _typeof$3(value) === 'object' && Object.prototype.toString.call(value) === '[object Object]';
2492
2767
  };
2493
2768
 
2494
2769
  function mergeDeep() {
@@ -2502,8 +2777,8 @@
2502
2777
  var currentValue = current[key];
2503
2778
 
2504
2779
  if (Array.isArray(accValue) && Array.isArray(currentValue)) {
2505
- acc[key] = accValue.concat.apply(accValue, _toConsumableArray(currentValue));
2506
- } else if (isObject(accValue) && isObject(currentValue)) {
2780
+ acc[key] = accValue.concat.apply(accValue, _toConsumableArray$5(currentValue));
2781
+ } else if (isPlainObject(accValue) && isPlainObject(currentValue)) {
2507
2782
  acc[key] = mergeDeep(accValue, currentValue);
2508
2783
  } else {
2509
2784
  acc[key] = currentValue;
@@ -2563,35 +2838,35 @@
2563
2838
  }
2564
2839
  } // Benchmark for comparison: https://esbench.com/bench/574c954bdb965b9a00965ac6
2565
2840
  else if (name[0] === 'o' && name[1] === 'n') {
2566
- useCapture = name !== (name = name.replace(/Capture$/, ''));
2567
- nameLower = name.toLowerCase();
2568
- if (nameLower in dom) name = nameLower;
2569
- name = name.slice(2);
2570
- if (!dom._listeners) dom._listeners = {};
2571
- dom._listeners[name] = value;
2572
-
2573
- if (value) {
2574
- if (!oldValue) dom.addEventListener(name, eventProxy, useCapture);
2575
- } else {
2576
- dom.removeEventListener(name, eventProxy, useCapture);
2577
- }
2578
- } else if (name !== 'list' && name !== 'tagName' && // HTMLButtonElement.form and HTMLInputElement.form are read-only but can be set using
2579
- // setAttribute
2580
- name !== 'form' && name !== 'type' && name !== 'size' && name !== 'download' && name !== 'href' && name in dom) {
2581
- dom[name] = value == null ? '' : value;
2582
- } else if (typeof value != 'function' && name !== 'dangerouslySetInnerHTML') {
2583
- if (value == null || value === false && // ARIA-attributes have a different notion of boolean values.
2584
- // The value `false` is different from the attribute not
2585
- // existing on the DOM, so we can't remove it. For non-boolean
2586
- // ARIA-attributes we could treat false as a removal, but the
2587
- // amount of exceptions would cost us too many bytes. On top of
2588
- // that other VDOM frameworks also always stringify `false`.
2589
- !/^ar/.test(name)) {
2590
- dom.removeAttribute(name);
2591
- } else {
2592
- dom.setAttribute(name, value);
2593
- }
2841
+ useCapture = name !== (name = name.replace(/Capture$/, ''));
2842
+ nameLower = name.toLowerCase();
2843
+ if (nameLower in dom) name = nameLower;
2844
+ name = name.slice(2);
2845
+ if (!dom._listeners) dom._listeners = {};
2846
+ dom._listeners[name] = value;
2847
+
2848
+ if (value) {
2849
+ if (!oldValue) dom.addEventListener(name, eventProxy, useCapture);
2850
+ } else {
2851
+ dom.removeEventListener(name, eventProxy, useCapture);
2594
2852
  }
2853
+ } else if (name !== 'list' && name !== 'tagName' && // HTMLButtonElement.form and HTMLInputElement.form are read-only but can be set using
2854
+ // setAttribute
2855
+ name !== 'form' && name !== 'type' && name !== 'size' && name !== 'download' && name !== 'href' && name in dom) {
2856
+ dom[name] = value == null ? '' : value;
2857
+ } else if (typeof value != 'function' && name !== 'dangerouslySetInnerHTML') {
2858
+ if (value == null || value === false && // ARIA-attributes have a different notion of boolean values.
2859
+ // The value `false` is different from the attribute not
2860
+ // existing on the DOM, so we can't remove it. For non-boolean
2861
+ // ARIA-attributes we could treat false as a removal, but the
2862
+ // amount of exceptions would cost us too many bytes. On top of
2863
+ // that other VDOM frameworks also always stringify `false`.
2864
+ !/^ar/.test(name)) {
2865
+ dom.removeAttribute(name);
2866
+ } else {
2867
+ dom.setAttribute(name, value);
2868
+ }
2869
+ }
2595
2870
  }
2596
2871
 
2597
2872
  function getNormalizedName(name) {
@@ -2617,28 +2892,30 @@
2617
2892
  }
2618
2893
  }
2619
2894
 
2895
+ var _excluded$3 = ["children"];
2620
2896
  function getCreateDomElement(environment) {
2621
2897
  return function createDomElement(tagName, _ref) {
2622
2898
  var _ref$children = _ref.children,
2623
2899
  children = _ref$children === void 0 ? [] : _ref$children,
2624
- props = _objectWithoutProperties(_ref, ["children"]);
2900
+ props = _objectWithoutProperties$4(_ref, _excluded$3);
2625
2901
 
2626
2902
  var element = environment.document.createElement(tagName);
2627
2903
  setProperties(element, props);
2628
- element.append.apply(element, _toConsumableArray(children));
2904
+ element.append.apply(element, _toConsumableArray$5(children));
2629
2905
  return element;
2630
2906
  };
2631
2907
  }
2632
2908
 
2909
+ var _excluded$2 = ["autocompleteScopeApi", "environment", "classNames", "getInputProps", "getInputPropsCore", "onDetachedEscape", "state"];
2633
2910
  var Input = function Input(_ref) {
2634
2911
  var autocompleteScopeApi = _ref.autocompleteScopeApi,
2635
- environment = _ref.environment,
2636
- classNames = _ref.classNames,
2637
- getInputProps = _ref.getInputProps,
2912
+ environment = _ref.environment;
2913
+ _ref.classNames;
2914
+ var getInputProps = _ref.getInputProps,
2638
2915
  getInputPropsCore = _ref.getInputPropsCore,
2639
2916
  onDetachedEscape = _ref.onDetachedEscape,
2640
2917
  state = _ref.state,
2641
- props = _objectWithoutProperties(_ref, ["autocompleteScopeApi", "environment", "classNames", "getInputProps", "getInputPropsCore", "onDetachedEscape", "state"]);
2918
+ props = _objectWithoutProperties$4(_ref, _excluded$2);
2642
2919
 
2643
2920
  var createDomElement = getCreateDomElement(environment);
2644
2921
  var element = createDomElement('input', props);
@@ -2912,7 +3189,7 @@
2912
3189
  };
2913
3190
  }
2914
3191
 
2915
- var n,u,i,t,o,r={},f=[],e=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function c(n,l){for(var u in l)n[u]=l[u];return n}function s(n){var l=n.parentNode;l&&l.removeChild(n);}function a(n,l,u){var i,t,o,r=arguments,f={};for(o in l)"key"==o?i=l[o]:"ref"==o?t=l[o]:f[o]=l[o];if(arguments.length>3)for(u=[u],o=3;o<arguments.length;o++)u.push(r[o]);if(null!=u&&(f.children=u),"function"==typeof n&&null!=n.defaultProps)for(o in n.defaultProps)void 0===f[o]&&(f[o]=n.defaultProps[o]);return v(n,f,i,t,null)}function v(l,u,i,t,o){var r={type:l,props:u,key:i,ref:t,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==o?++n.__v:o};return null!=n.vnode&&n.vnode(r),r}function y(n){return n.children}function p(n,l){this.props=n,this.context=l;}function d(n,l){if(null==l)return n.__?d(n.__,n.__.__k.indexOf(n)+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return "function"==typeof n.type?d(n):null}function _(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return _(n)}}function k(l){(!l.__d&&(l.__d=!0)&&u.push(l)&&!b.__r++||t!==n.debounceRendering)&&((t=n.debounceRendering)||i)(b);}function b(){for(var n;b.__r=u.length;)n=u.sort(function(n,l){return n.__v.__b-l.__v.__b}),u=[],n.some(function(n){var l,u,i,t,o,r;n.__d&&(o=(t=(l=n).__v).__e,(r=l.__P)&&(u=[],(i=c({},t)).__v=t.__v+1,I(r,t,i,l.__n,void 0!==r.ownerSVGElement,null!=t.__h?[o]:null,u,null==o?d(t):o,t.__h),T(u,t),t.__e!=o&&_(t)));});}function m(n,l,u,i,t,o,e,c,s,a){var h,p,_,k,b,m,w,A=i&&i.__k||f,P=A.length;for(u.__k=[],h=0;h<l.length;h++)if(null!=(k=u.__k[h]=null==(k=l[h])||"boolean"==typeof k?null:"string"==typeof k||"number"==typeof k||"bigint"==typeof k?v(null,k,null,null,k):Array.isArray(k)?v(y,{children:k},null,null,null):k.__b>0?v(k.type,k.props,k.key,null,k.__v):k)){if(k.__=u,k.__b=u.__b+1,null===(_=A[h])||_&&k.key==_.key&&k.type===_.type)A[h]=void 0;else for(p=0;p<P;p++){if((_=A[p])&&k.key==_.key&&k.type===_.type){A[p]=void 0;break}_=null;}I(n,k,_=_||r,t,o,e,c,s,a),b=k.__e,(p=k.ref)&&_.ref!=p&&(w||(w=[]),_.ref&&w.push(_.ref,null,k),w.push(p,k.__c||b,k)),null!=b?(null==m&&(m=b),"function"==typeof k.type&&null!=k.__k&&k.__k===_.__k?k.__d=s=g(k,s,n):s=x(n,k,_,A,b,s),a||"option"!==u.type?"function"==typeof u.type&&(u.__d=s):n.value=""):s&&_.__e==s&&s.parentNode!=n&&(s=d(_));}for(u.__e=m,h=P;h--;)null!=A[h]&&("function"==typeof u.type&&null!=A[h].__e&&A[h].__e==u.__d&&(u.__d=d(i,h+1)),L(A[h],A[h]));if(w)for(h=0;h<w.length;h++)z(w[h],w[++h],w[++h]);}function g(n,l,u){var i,t;for(i=0;i<n.__k.length;i++)(t=n.__k[i])&&(t.__=n,l="function"==typeof t.type?g(t,l,u):x(u,t,t,n.__k,t.__e,l));return l}function x(n,l,u,i,t,o){var r,f,e;if(void 0!==l.__d)r=l.__d,l.__d=void 0;else if(null==u||t!=o||null==t.parentNode)n:if(null==o||o.parentNode!==n)n.appendChild(t),r=null;else {for(f=o,e=0;(f=f.nextSibling)&&e<i.length;e+=2)if(f==t)break n;n.insertBefore(t,o),r=o;}return void 0!==r?r:t.nextSibling}function A(n,l,u,i,t){var o;for(o in u)"children"===o||"key"===o||o in l||C(n,o,null,u[o],i);for(o in l)t&&"function"!=typeof l[o]||"children"===o||"key"===o||"value"===o||"checked"===o||u[o]===l[o]||C(n,o,l[o],u[o],i);}function P(n,l,u){"-"===l[0]?n.setProperty(l,u):n[l]=null==u?"":"number"!=typeof u||e.test(l)?u:u+"px";}function C(n,l,u,i,t){var o;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof i&&(n.style.cssText=i=""),i)for(l in i)u&&l in u||P(n.style,l,"");if(u)for(l in u)i&&u[l]===i[l]||P(n.style,l,u[l]);}else if("o"===l[0]&&"n"===l[1])o=l!==(l=l.replace(/Capture$/,"")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?i||n.addEventListener(l,o?H:$,o):n.removeEventListener(l,o?H:$,o);else if("dangerouslySetInnerHTML"!==l){if(t)l=l.replace(/xlink[H:h]/,"h").replace(/sName$/,"s");else if("href"!==l&&"list"!==l&&"form"!==l&&"tabIndex"!==l&&"download"!==l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null!=u&&(!1!==u||"a"===l[0]&&"r"===l[1])?n.setAttribute(l,u):n.removeAttribute(l));}}function $(l){this.l[l.type+!1](n.event?n.event(l):l);}function H(l){this.l[l.type+!0](n.event?n.event(l):l);}function I(l,u,i,t,o,r,f,e,s){var a,v,h,d,_,k,b,g,w,x,A,P=u.type;if(void 0!==u.constructor)return null;null!=i.__h&&(s=i.__h,e=u.__e=i.__e,u.__h=null,r=[e]),(a=n.__b)&&a(u);try{n:if("function"==typeof P){if(g=u.props,w=(a=P.contextType)&&t[a.__c],x=a?w?w.props.value:a.__:t,i.__c?b=(v=u.__c=i.__c).__=v.__E:("prototype"in P&&P.prototype.render?u.__c=v=new P(g,x):(u.__c=v=new p(g,x),v.constructor=P,v.render=M),w&&w.sub(v),v.props=g,v.state||(v.state={}),v.context=x,v.__n=t,h=v.__d=!0,v.__h=[]),null==v.__s&&(v.__s=v.state),null!=P.getDerivedStateFromProps&&(v.__s==v.state&&(v.__s=c({},v.__s)),c(v.__s,P.getDerivedStateFromProps(g,v.__s))),d=v.props,_=v.state,h)null==P.getDerivedStateFromProps&&null!=v.componentWillMount&&v.componentWillMount(),null!=v.componentDidMount&&v.__h.push(v.componentDidMount);else {if(null==P.getDerivedStateFromProps&&g!==d&&null!=v.componentWillReceiveProps&&v.componentWillReceiveProps(g,x),!v.__e&&null!=v.shouldComponentUpdate&&!1===v.shouldComponentUpdate(g,v.__s,x)||u.__v===i.__v){v.props=g,v.state=v.__s,u.__v!==i.__v&&(v.__d=!1),v.__v=u,u.__e=i.__e,u.__k=i.__k,u.__k.forEach(function(n){n&&(n.__=u);}),v.__h.length&&f.push(v);break n}null!=v.componentWillUpdate&&v.componentWillUpdate(g,v.__s,x),null!=v.componentDidUpdate&&v.__h.push(function(){v.componentDidUpdate(d,_,k);});}v.context=x,v.props=g,v.state=v.__s,(a=n.__r)&&a(u),v.__d=!1,v.__v=u,v.__P=l,a=v.render(v.props,v.state,v.context),v.state=v.__s,null!=v.getChildContext&&(t=c(c({},t),v.getChildContext())),h||null==v.getSnapshotBeforeUpdate||(k=v.getSnapshotBeforeUpdate(d,_)),A=null!=a&&a.type===y&&null==a.key?a.props.children:a,m(l,Array.isArray(A)?A:[A],u,i,t,o,r,f,e,s),v.base=u.__e,u.__h=null,v.__h.length&&f.push(v),b&&(v.__E=v.__=null),v.__e=!1;}else null==r&&u.__v===i.__v?(u.__k=i.__k,u.__e=i.__e):u.__e=j(i.__e,u,i,t,o,r,f,s);(a=n.diffed)&&a(u);}catch(l){u.__v=null,(s||null!=r)&&(u.__e=e,u.__h=!!s,r[r.indexOf(e)]=null),n.__e(l,u,i);}}function T(l,u){n.__c&&n.__c(u,l),l.some(function(u){try{l=u.__h,u.__h=[],l.some(function(n){n.call(u);});}catch(l){n.__e(l,u.__v);}});}function j(n,l,u,i,t,o,e,c){var a,v,h,y,p=u.props,d=l.props,_=l.type,k=0;if("svg"===_&&(t=!0),null!=o)for(;k<o.length;k++)if((a=o[k])&&(a===n||(_?a.localName==_:3==a.nodeType))){n=a,o[k]=null;break}if(null==n){if(null===_)return document.createTextNode(d);n=t?document.createElementNS("http://www.w3.org/2000/svg",_):document.createElement(_,d.is&&d),o=null,c=!1;}if(null===_)p===d||c&&n.data===d||(n.data=d);else {if(o=o&&f.slice.call(n.childNodes),v=(p=u.props||r).dangerouslySetInnerHTML,h=d.dangerouslySetInnerHTML,!c){if(null!=o)for(p={},y=0;y<n.attributes.length;y++)p[n.attributes[y].name]=n.attributes[y].value;(h||v)&&(h&&(v&&h.__html==v.__html||h.__html===n.innerHTML)||(n.innerHTML=h&&h.__html||""));}if(A(n,d,p,t,c),h)l.__k=[];else if(k=l.props.children,m(n,Array.isArray(k)?k:[k],l,u,i,t&&"foreignObject"!==_,o,e,n.firstChild,c),null!=o)for(k=o.length;k--;)null!=o[k]&&s(o[k]);c||("value"in d&&void 0!==(k=d.value)&&(k!==n.value||"progress"===_&&!k)&&C(n,"value",k,p.value,!1),"checked"in d&&void 0!==(k=d.checked)&&k!==n.checked&&C(n,"checked",k,p.checked,!1));}return n}function z(l,u,i){try{"function"==typeof l?l(u):l.current=u;}catch(l){n.__e(l,i);}}function L(l,u,i){var t,o,r;if(n.unmount&&n.unmount(l),(t=l.ref)&&(t.current&&t.current!==l.__e||z(t,null,u)),i||"function"==typeof l.type||(i=null!=(o=l.__e)),l.__e=l.__d=void 0,null!=(t=l.__c)){if(t.componentWillUnmount)try{t.componentWillUnmount();}catch(l){n.__e(l,u);}t.base=t.__P=null;}if(t=l.__k)for(r=0;r<t.length;r++)t[r]&&L(t[r],u,i);null!=o&&s(o);}function M(n,l,u){return this.constructor(n,u)}function N(l,u,i){var t,o,e;n.__&&n.__(l,u),o=(t="function"==typeof i)?null:i&&i.__k||u.__k,e=[],I(u,l=(!t&&i||u).__k=a(y,null,[l]),o||r,r,void 0!==u.ownerSVGElement,!t&&i?[i]:o?null:u.firstChild?f.slice.call(u.childNodes):null,e,!t&&i?i:o?o.__e:u.firstChild,t),T(e,l);}n={__e:function(n,l){for(var u,i,t;l=l.__;)if((u=l.__c)&&!u.__)try{if((i=u.constructor)&&null!=i.getDerivedStateFromError&&(u.setState(i.getDerivedStateFromError(n)),t=u.__d),null!=u.componentDidCatch&&(u.componentDidCatch(n),t=u.__d),t)return u.__E=u}catch(l){n=l;}throw n},__v:0},p.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=c({},this.state),"function"==typeof n&&(n=n(c({},u),this.props)),n&&c(u,n),null!=n&&this.__v&&(l&&this.__h.push(l),k(this));},p.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),k(this));},p.prototype.render=y,u=[],i="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,b.__r=0,o=0;
3192
+ var n,l,u,t,r,o,e={},c=[],s=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function a(n,l){for(var u in l)n[u]=l[u];return n}function h(n){var l=n.parentNode;l&&l.removeChild(n);}function v(l,u,i){var t,r,o,f={};for(o in u)"key"==o?t=u[o]:"ref"==o?r=u[o]:f[o]=u[o];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):i),"function"==typeof l&&null!=l.defaultProps)for(o in l.defaultProps)void 0===f[o]&&(f[o]=l.defaultProps[o]);return y(l,f,t,r,null)}function y(n,i,t,r,o){var f={type:n,props:i,key:t,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==o?++u:o};return null==o&&null!=l.vnode&&l.vnode(f),f}function d(n){return n.children}function _(n,l){this.props=n,this.context=l;}function k(n,l){if(null==l)return n.__?k(n.__,n.__.__k.indexOf(n)+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return "function"==typeof n.type?k(n):null}function b(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return b(n)}}function m(n){(!n.__d&&(n.__d=!0)&&t.push(n)&&!g.__r++||o!==l.debounceRendering)&&((o=l.debounceRendering)||r)(g);}function g(){for(var n;g.__r=t.length;)n=t.sort(function(n,l){return n.__v.__b-l.__v.__b}),t=[],n.some(function(n){var l,u,i,t,r,o;n.__d&&(r=(t=(l=n).__v).__e,(o=l.__P)&&(u=[],(i=a({},t)).__v=t.__v+1,j(o,t,i,l.__n,void 0!==o.ownerSVGElement,null!=t.__h?[r]:null,u,null==r?k(t):r,t.__h),z(u,t),t.__e!=r&&b(t)));});}function w(n,l,u,i,t,r,o,f,s,a){var h,v,p,_,b,m,g,w=i&&i.__k||c,A=w.length;for(u.__k=[],h=0;h<l.length;h++)if(null!=(_=u.__k[h]=null==(_=l[h])||"boolean"==typeof _?null:"string"==typeof _||"number"==typeof _||"bigint"==typeof _?y(null,_,null,null,_):Array.isArray(_)?y(d,{children:_},null,null,null):_.__b>0?y(_.type,_.props,_.key,null,_.__v):_)){if(_.__=u,_.__b=u.__b+1,null===(p=w[h])||p&&_.key==p.key&&_.type===p.type)w[h]=void 0;else for(v=0;v<A;v++){if((p=w[v])&&_.key==p.key&&_.type===p.type){w[v]=void 0;break}p=null;}j(n,_,p=p||e,t,r,o,f,s,a),b=_.__e,(v=_.ref)&&p.ref!=v&&(g||(g=[]),p.ref&&g.push(p.ref,null,_),g.push(v,_.__c||b,_)),null!=b?(null==m&&(m=b),"function"==typeof _.type&&_.__k===p.__k?_.__d=s=x(_,s,n):s=P(n,_,p,w,b,s),"function"==typeof u.type&&(u.__d=s)):s&&p.__e==s&&s.parentNode!=n&&(s=k(p));}for(u.__e=m,h=A;h--;)null!=w[h]&&("function"==typeof u.type&&null!=w[h].__e&&w[h].__e==u.__d&&(u.__d=k(i,h+1)),N(w[h],w[h]));if(g)for(h=0;h<g.length;h++)M(g[h],g[++h],g[++h]);}function x(n,l,u){for(var i,t=n.__k,r=0;t&&r<t.length;r++)(i=t[r])&&(i.__=n,l="function"==typeof i.type?x(i,l,u):P(u,i,i,t,i.__e,l));return l}function P(n,l,u,i,t,r){var o,f,e;if(void 0!==l.__d)o=l.__d,l.__d=void 0;else if(null==u||t!=r||null==t.parentNode)n:if(null==r||r.parentNode!==n)n.appendChild(t),o=null;else {for(f=r,e=0;(f=f.nextSibling)&&e<i.length;e+=2)if(f==t)break n;n.insertBefore(t,r),o=r;}return void 0!==o?o:t.nextSibling}function C(n,l,u,i,t){var r;for(r in u)"children"===r||"key"===r||r in l||H(n,r,null,u[r],i);for(r in l)t&&"function"!=typeof l[r]||"children"===r||"key"===r||"value"===r||"checked"===r||u[r]===l[r]||H(n,r,l[r],u[r],i);}function $(n,l,u){"-"===l[0]?n.setProperty(l,u):n[l]=null==u?"":"number"!=typeof u||s.test(l)?u:u+"px";}function H(n,l,u,i,t){var r;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof i&&(n.style.cssText=i=""),i)for(l in i)u&&l in u||$(n.style,l,"");if(u)for(l in u)i&&u[l]===i[l]||$(n.style,l,u[l]);}else if("o"===l[0]&&"n"===l[1])r=l!==(l=l.replace(/Capture$/,"")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+r]=u,u?i||n.addEventListener(l,r?T:I,r):n.removeEventListener(l,r?T:I,r);else if("dangerouslySetInnerHTML"!==l){if(t)l=l.replace(/xlink[H:h]/,"h").replace(/sName$/,"s");else if("href"!==l&&"list"!==l&&"form"!==l&&"tabIndex"!==l&&"download"!==l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null!=u&&(!1!==u||"a"===l[0]&&"r"===l[1])?n.setAttribute(l,u):n.removeAttribute(l));}}function I(n){this.l[n.type+!1](l.event?l.event(n):n);}function T(n){this.l[n.type+!0](l.event?l.event(n):n);}function j(n,u,i,t,r,o,f,e,c){var s,h,v,y,p,k,b,m,g,x,A,P=u.type;if(void 0!==u.constructor)return null;null!=i.__h&&(c=i.__h,e=u.__e=i.__e,u.__h=null,o=[e]),(s=l.__b)&&s(u);try{n:if("function"==typeof P){if(m=u.props,g=(s=P.contextType)&&t[s.__c],x=s?g?g.props.value:s.__:t,i.__c?b=(h=u.__c=i.__c).__=h.__E:("prototype"in P&&P.prototype.render?u.__c=h=new P(m,x):(u.__c=h=new _(m,x),h.constructor=P,h.render=O),g&&g.sub(h),h.props=m,h.state||(h.state={}),h.context=x,h.__n=t,v=h.__d=!0,h.__h=[]),null==h.__s&&(h.__s=h.state),null!=P.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=a({},h.__s)),a(h.__s,P.getDerivedStateFromProps(m,h.__s))),y=h.props,p=h.state,v)null==P.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else {if(null==P.getDerivedStateFromProps&&m!==y&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(m,x),!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(m,h.__s,x)||u.__v===i.__v){h.props=m,h.state=h.__s,u.__v!==i.__v&&(h.__d=!1),h.__v=u,u.__e=i.__e,u.__k=i.__k,u.__k.forEach(function(n){n&&(n.__=u);}),h.__h.length&&f.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(m,h.__s,x),null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(y,p,k);});}h.context=x,h.props=m,h.state=h.__s,(s=l.__r)&&s(u),h.__d=!1,h.__v=u,h.__P=n,s=h.render(h.props,h.state,h.context),h.state=h.__s,null!=h.getChildContext&&(t=a(a({},t),h.getChildContext())),v||null==h.getSnapshotBeforeUpdate||(k=h.getSnapshotBeforeUpdate(y,p)),A=null!=s&&s.type===d&&null==s.key?s.props.children:s,w(n,Array.isArray(A)?A:[A],u,i,t,r,o,f,e,c),h.base=u.__e,u.__h=null,h.__h.length&&f.push(h),b&&(h.__E=h.__=null),h.__e=!1;}else null==o&&u.__v===i.__v?(u.__k=i.__k,u.__e=i.__e):u.__e=L(i.__e,u,i,t,r,o,f,c);(s=l.diffed)&&s(u);}catch(n){u.__v=null,(c||null!=o)&&(u.__e=e,u.__h=!!c,o[o.indexOf(e)]=null),l.__e(n,u,i);}}function z(n,u){l.__c&&l.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u);});}catch(n){l.__e(n,u.__v);}});}function L(l,u,i,t,r,o,f,c){var s,a,v,y=i.props,p=u.props,d=u.type,_=0;if("svg"===d&&(r=!0),null!=o)for(;_<o.length;_++)if((s=o[_])&&"setAttribute"in s==!!d&&(d?s.localName===d:3===s.nodeType)){l=s,o[_]=null;break}if(null==l){if(null===d)return document.createTextNode(p);l=r?document.createElementNS("http://www.w3.org/2000/svg",d):document.createElement(d,p.is&&p),o=null,c=!1;}if(null===d)y===p||c&&l.data===p||(l.data=p);else {if(o=o&&n.call(l.childNodes),a=(y=i.props||e).dangerouslySetInnerHTML,v=p.dangerouslySetInnerHTML,!c){if(null!=o)for(y={},_=0;_<l.attributes.length;_++)y[l.attributes[_].name]=l.attributes[_].value;(v||a)&&(v&&(a&&v.__html==a.__html||v.__html===l.innerHTML)||(l.innerHTML=v&&v.__html||""));}if(C(l,p,y,r,c),v)u.__k=[];else if(_=u.props.children,w(l,Array.isArray(_)?_:[_],u,i,t,r&&"foreignObject"!==d,o,f,o?o[0]:i.__k&&k(i,0),c),null!=o)for(_=o.length;_--;)null!=o[_]&&h(o[_]);c||("value"in p&&void 0!==(_=p.value)&&(_!==y.value||_!==l.value||"progress"===d&&!_)&&H(l,"value",_,y.value,!1),"checked"in p&&void 0!==(_=p.checked)&&_!==l.checked&&H(l,"checked",_,y.checked,!1));}return l}function M(n,u,i){try{"function"==typeof n?n(u):n.current=u;}catch(n){l.__e(n,i);}}function N(n,u,i){var t,r;if(l.unmount&&l.unmount(n),(t=n.ref)&&(t.current&&t.current!==n.__e||M(t,null,u)),null!=(t=n.__c)){if(t.componentWillUnmount)try{t.componentWillUnmount();}catch(n){l.__e(n,u);}t.base=t.__P=null;}if(t=n.__k)for(r=0;r<t.length;r++)t[r]&&N(t[r],u,"function"!=typeof n.type);i||null==n.__e||h(n.__e),n.__e=n.__d=void 0;}function O(n,l,u){return this.constructor(n,u)}function S(u,i,t){var r,o,f;l.__&&l.__(u,i),o=(r="function"==typeof t)?null:t&&t.__k||i.__k,f=[],j(i,u=(!r&&t||i).__k=v(d,null,[u]),o||e,e,void 0!==i.ownerSVGElement,!r&&t?[t]:o?null:i.firstChild?n.call(i.childNodes):null,f,!r&&t?t:o?o.__e:i.firstChild,r),z(f,u);}n=c.slice,l={__e:function(n,l){for(var u,i,t;l=l.__;)if((u=l.__c)&&!u.__)try{if((i=u.constructor)&&null!=i.getDerivedStateFromError&&(u.setState(i.getDerivedStateFromError(n)),t=u.__d),null!=u.componentDidCatch&&(u.componentDidCatch(n),t=u.__d),t)return u.__E=u}catch(l){n=l;}throw n}},u=0,_.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=a({},this.state),"function"==typeof n&&(n=n(a({},u),this.props)),n&&a(u,n),null!=n&&this.__v&&(l&&this.__h.push(l),m(this));},_.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),m(this));},_.prototype.render=d,t=[],r="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,g.__r=0;
2916
3193
 
2917
3194
  var HIGHLIGHT_PRE_TAG = '__aa-highlight__';
2918
3195
  var HIGHLIGHT_POST_TAG = '__/aa-highlight__';
@@ -2969,32 +3246,32 @@
2969
3246
  return parts.get();
2970
3247
  }
2971
3248
 
2972
- function _toConsumableArray$3(arr) {
2973
- return _arrayWithoutHoles$3(arr) || _iterableToArray$3(arr) || _unsupportedIterableToArray$4(arr) || _nonIterableSpread$3();
3249
+ function _toConsumableArray$2(arr) {
3250
+ return _arrayWithoutHoles$2(arr) || _iterableToArray$2(arr) || _unsupportedIterableToArray$2(arr) || _nonIterableSpread$2();
2974
3251
  }
2975
3252
 
2976
- function _nonIterableSpread$3() {
3253
+ function _nonIterableSpread$2() {
2977
3254
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2978
3255
  }
2979
3256
 
2980
- function _unsupportedIterableToArray$4(o, minLen) {
3257
+ function _unsupportedIterableToArray$2(o, minLen) {
2981
3258
  if (!o) return;
2982
- if (typeof o === "string") return _arrayLikeToArray$4(o, minLen);
3259
+ if (typeof o === "string") return _arrayLikeToArray$2(o, minLen);
2983
3260
  var n = Object.prototype.toString.call(o).slice(8, -1);
2984
3261
  if (n === "Object" && o.constructor) n = o.constructor.name;
2985
3262
  if (n === "Map" || n === "Set") return Array.from(o);
2986
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$4(o, minLen);
3263
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen);
2987
3264
  }
2988
3265
 
2989
- function _iterableToArray$3(iter) {
2990
- if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
3266
+ function _iterableToArray$2(iter) {
3267
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
2991
3268
  }
2992
3269
 
2993
- function _arrayWithoutHoles$3(arr) {
2994
- if (Array.isArray(arr)) return _arrayLikeToArray$4(arr);
3270
+ function _arrayWithoutHoles$2(arr) {
3271
+ if (Array.isArray(arr)) return _arrayLikeToArray$2(arr);
2995
3272
  }
2996
3273
 
2997
- function _arrayLikeToArray$4(arr, len) {
3274
+ function _arrayLikeToArray$2(arr, len) {
2998
3275
  if (len == null || len > arr.length) len = arr.length;
2999
3276
 
3000
3277
  for (var i = 0, arr2 = new Array(len); i < len; i++) {
@@ -3007,10 +3284,10 @@
3007
3284
  var hit = _ref.hit,
3008
3285
  attribute = _ref.attribute;
3009
3286
  var path = Array.isArray(attribute) ? attribute : [attribute];
3010
- var highlightedValue = getAttributeValueByPath(hit, ['_highlightResult'].concat(_toConsumableArray$3(path), ['value']));
3287
+ var highlightedValue = getAttributeValueByPath(hit, ['_highlightResult'].concat(_toConsumableArray$2(path), ['value']));
3011
3288
 
3012
3289
  if (typeof highlightedValue !== 'string') {
3013
- "development" !== 'production' ? warn(false, "The attribute \"".concat(path.join('.'), "\" described by the path ").concat(JSON.stringify(path), " does not exist on the hit. Did you set it in `attributesToHighlight`?") + '\nSee https://www.algolia.com/doc/api-reference/api-parameters/attributesToHighlight/') : void 0 ;
3290
+ "development" !== 'production' ? warn(false, "The attribute \"".concat(path.join('.'), "\" described by the path ").concat(JSON.stringify(path), " does not exist on the hit. Did you set it in `attributesToHighlight`?") + '\nSee https://www.algolia.com/doc/api-reference/api-parameters/attributesToHighlight/') : void 0 ;
3014
3291
  highlightedValue = getAttributeValueByPath(hit, path) || '';
3015
3292
  }
3016
3293
 
@@ -3050,32 +3327,36 @@
3050
3327
  return current.isHighlighted;
3051
3328
  }
3052
3329
 
3053
- function ownKeys$d(object, enumerableOnly) {
3330
+ function ownKeys$2(object, enumerableOnly) {
3054
3331
  var keys = Object.keys(object);
3055
3332
 
3056
3333
  if (Object.getOwnPropertySymbols) {
3057
3334
  var symbols = Object.getOwnPropertySymbols(object);
3058
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
3059
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
3060
- });
3335
+
3336
+ if (enumerableOnly) {
3337
+ symbols = symbols.filter(function (sym) {
3338
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
3339
+ });
3340
+ }
3341
+
3061
3342
  keys.push.apply(keys, symbols);
3062
3343
  }
3063
3344
 
3064
3345
  return keys;
3065
3346
  }
3066
3347
 
3067
- function _objectSpread$c(target) {
3348
+ function _objectSpread$2(target) {
3068
3349
  for (var i = 1; i < arguments.length; i++) {
3069
3350
  var source = arguments[i] != null ? arguments[i] : {};
3070
3351
 
3071
3352
  if (i % 2) {
3072
- ownKeys$d(Object(source), true).forEach(function (key) {
3073
- _defineProperty$d(target, key, source[key]);
3353
+ ownKeys$2(Object(source), true).forEach(function (key) {
3354
+ _defineProperty$2(target, key, source[key]);
3074
3355
  });
3075
3356
  } else if (Object.getOwnPropertyDescriptors) {
3076
3357
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
3077
3358
  } else {
3078
- ownKeys$d(Object(source)).forEach(function (key) {
3359
+ ownKeys$2(Object(source)).forEach(function (key) {
3079
3360
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
3080
3361
  });
3081
3362
  }
@@ -3084,7 +3365,7 @@
3084
3365
  return target;
3085
3366
  }
3086
3367
 
3087
- function _defineProperty$d(obj, key, value) {
3368
+ function _defineProperty$2(obj, key, value) {
3088
3369
  if (key in obj) {
3089
3370
  Object.defineProperty(obj, key, {
3090
3371
  value: value,
@@ -3104,14 +3385,14 @@
3104
3385
  return part.isHighlighted;
3105
3386
  })) {
3106
3387
  return parts.map(function (part) {
3107
- return _objectSpread$c(_objectSpread$c({}, part), {}, {
3388
+ return _objectSpread$2(_objectSpread$2({}, part), {}, {
3108
3389
  isHighlighted: false
3109
3390
  });
3110
3391
  });
3111
3392
  }
3112
3393
 
3113
3394
  return parts.map(function (part, i) {
3114
- return _objectSpread$c(_objectSpread$c({}, part), {}, {
3395
+ return _objectSpread$2(_objectSpread$2({}, part), {}, {
3115
3396
  isHighlighted: !isPartHighlighted(parts, i)
3116
3397
  });
3117
3398
  });
@@ -3121,32 +3402,32 @@
3121
3402
  return reverseHighlightedParts(parseAlgoliaHitHighlight(props));
3122
3403
  }
3123
3404
 
3124
- function _toConsumableArray$4(arr) {
3125
- return _arrayWithoutHoles$4(arr) || _iterableToArray$4(arr) || _unsupportedIterableToArray$5(arr) || _nonIterableSpread$4();
3405
+ function _toConsumableArray$1(arr) {
3406
+ return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableSpread$1();
3126
3407
  }
3127
3408
 
3128
- function _nonIterableSpread$4() {
3409
+ function _nonIterableSpread$1() {
3129
3410
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3130
3411
  }
3131
3412
 
3132
- function _unsupportedIterableToArray$5(o, minLen) {
3413
+ function _unsupportedIterableToArray$1(o, minLen) {
3133
3414
  if (!o) return;
3134
- if (typeof o === "string") return _arrayLikeToArray$5(o, minLen);
3415
+ if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
3135
3416
  var n = Object.prototype.toString.call(o).slice(8, -1);
3136
3417
  if (n === "Object" && o.constructor) n = o.constructor.name;
3137
3418
  if (n === "Map" || n === "Set") return Array.from(o);
3138
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$5(o, minLen);
3419
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
3139
3420
  }
3140
3421
 
3141
- function _iterableToArray$4(iter) {
3142
- if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
3422
+ function _iterableToArray$1(iter) {
3423
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
3143
3424
  }
3144
3425
 
3145
- function _arrayWithoutHoles$4(arr) {
3146
- if (Array.isArray(arr)) return _arrayLikeToArray$5(arr);
3426
+ function _arrayWithoutHoles$1(arr) {
3427
+ if (Array.isArray(arr)) return _arrayLikeToArray$1(arr);
3147
3428
  }
3148
3429
 
3149
- function _arrayLikeToArray$5(arr, len) {
3430
+ function _arrayLikeToArray$1(arr, len) {
3150
3431
  if (len == null || len > arr.length) len = arr.length;
3151
3432
 
3152
3433
  for (var i = 0, arr2 = new Array(len); i < len; i++) {
@@ -3159,10 +3440,10 @@
3159
3440
  var hit = _ref.hit,
3160
3441
  attribute = _ref.attribute;
3161
3442
  var path = Array.isArray(attribute) ? attribute : [attribute];
3162
- var highlightedValue = getAttributeValueByPath(hit, ['_snippetResult'].concat(_toConsumableArray$4(path), ['value']));
3443
+ var highlightedValue = getAttributeValueByPath(hit, ['_snippetResult'].concat(_toConsumableArray$1(path), ['value']));
3163
3444
 
3164
3445
  if (typeof highlightedValue !== 'string') {
3165
- "development" !== 'production' ? warn(false, "The attribute \"".concat(path.join('.'), "\" described by the path ").concat(JSON.stringify(path), " does not exist on the hit. Did you set it in `attributesToSnippet`?") + '\nSee https://www.algolia.com/doc/api-reference/api-parameters/attributesToSnippet/') : void 0 ;
3446
+ "development" !== 'production' ? warn(false, "The attribute \"".concat(path.join('.'), "\" described by the path ").concat(JSON.stringify(path), " does not exist on the hit. Did you set it in `attributesToSnippet`?") + '\nSee https://www.algolia.com/doc/api-reference/api-parameters/attributesToSnippet/') : void 0 ;
3166
3447
  highlightedValue = getAttributeValueByPath(hit, path) || '';
3167
3448
  }
3168
3449
 
@@ -3175,32 +3456,36 @@
3175
3456
  return reverseHighlightedParts(parseAlgoliaHitSnippet(props));
3176
3457
  }
3177
3458
 
3178
- function ownKeys$e(object, enumerableOnly) {
3459
+ function ownKeys$1(object, enumerableOnly) {
3179
3460
  var keys = Object.keys(object);
3180
3461
 
3181
3462
  if (Object.getOwnPropertySymbols) {
3182
3463
  var symbols = Object.getOwnPropertySymbols(object);
3183
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
3184
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
3185
- });
3464
+
3465
+ if (enumerableOnly) {
3466
+ symbols = symbols.filter(function (sym) {
3467
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
3468
+ });
3469
+ }
3470
+
3186
3471
  keys.push.apply(keys, symbols);
3187
3472
  }
3188
3473
 
3189
3474
  return keys;
3190
3475
  }
3191
3476
 
3192
- function _objectSpread$d(target) {
3477
+ function _objectSpread$1(target) {
3193
3478
  for (var i = 1; i < arguments.length; i++) {
3194
3479
  var source = arguments[i] != null ? arguments[i] : {};
3195
3480
 
3196
3481
  if (i % 2) {
3197
- ownKeys$e(Object(source), true).forEach(function (key) {
3198
- _defineProperty$e(target, key, source[key]);
3482
+ ownKeys$1(Object(source), true).forEach(function (key) {
3483
+ _defineProperty$1(target, key, source[key]);
3199
3484
  });
3200
3485
  } else if (Object.getOwnPropertyDescriptors) {
3201
3486
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
3202
3487
  } else {
3203
- ownKeys$e(Object(source)).forEach(function (key) {
3488
+ ownKeys$1(Object(source)).forEach(function (key) {
3204
3489
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
3205
3490
  });
3206
3491
  }
@@ -3209,7 +3494,7 @@
3209
3494
  return target;
3210
3495
  }
3211
3496
 
3212
- function _defineProperty$e(obj, key, value) {
3497
+ function _defineProperty$1(obj, key, value) {
3213
3498
  if (key in obj) {
3214
3499
  Object.defineProperty(obj, key, {
3215
3500
  value: value,
@@ -3247,41 +3532,45 @@
3247
3532
 
3248
3533
  return function createSpecifiedRequester(requesterParams) {
3249
3534
  return function requester(requestParams) {
3250
- return _objectSpread$d(_objectSpread$d({
3535
+ return _objectSpread$1(_objectSpread$1({
3251
3536
  execute: execute
3252
3537
  }, requesterParams), requestParams);
3253
3538
  };
3254
3539
  };
3255
3540
  }
3256
3541
 
3257
- var version = '1.3.0';
3542
+ var _excluded$1 = ["params"];
3258
3543
 
3259
- function ownKeys$f(object, enumerableOnly) {
3544
+ function ownKeys(object, enumerableOnly) {
3260
3545
  var keys = Object.keys(object);
3261
3546
 
3262
3547
  if (Object.getOwnPropertySymbols) {
3263
3548
  var symbols = Object.getOwnPropertySymbols(object);
3264
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
3265
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
3266
- });
3549
+
3550
+ if (enumerableOnly) {
3551
+ symbols = symbols.filter(function (sym) {
3552
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
3553
+ });
3554
+ }
3555
+
3267
3556
  keys.push.apply(keys, symbols);
3268
3557
  }
3269
3558
 
3270
3559
  return keys;
3271
3560
  }
3272
3561
 
3273
- function _objectSpread$e(target) {
3562
+ function _objectSpread(target) {
3274
3563
  for (var i = 1; i < arguments.length; i++) {
3275
3564
  var source = arguments[i] != null ? arguments[i] : {};
3276
3565
 
3277
3566
  if (i % 2) {
3278
- ownKeys$f(Object(source), true).forEach(function (key) {
3279
- _defineProperty$f(target, key, source[key]);
3567
+ ownKeys(Object(source), true).forEach(function (key) {
3568
+ _defineProperty(target, key, source[key]);
3280
3569
  });
3281
3570
  } else if (Object.getOwnPropertyDescriptors) {
3282
3571
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
3283
3572
  } else {
3284
- ownKeys$f(Object(source)).forEach(function (key) {
3573
+ ownKeys(Object(source)).forEach(function (key) {
3285
3574
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
3286
3575
  });
3287
3576
  }
@@ -3290,7 +3579,7 @@
3290
3579
  return target;
3291
3580
  }
3292
3581
 
3293
- function _defineProperty$f(obj, key, value) {
3582
+ function _defineProperty(obj, key, value) {
3294
3583
  if (key in obj) {
3295
3584
  Object.defineProperty(obj, key, {
3296
3585
  value: value,
@@ -3305,10 +3594,10 @@
3305
3594
  return obj;
3306
3595
  }
3307
3596
 
3308
- function _objectWithoutProperties$4(source, excluded) {
3597
+ function _objectWithoutProperties(source, excluded) {
3309
3598
  if (source == null) return {};
3310
3599
 
3311
- var target = _objectWithoutPropertiesLoose$4(source, excluded);
3600
+ var target = _objectWithoutPropertiesLoose(source, excluded);
3312
3601
 
3313
3602
  var key, i;
3314
3603
 
@@ -3326,7 +3615,7 @@
3326
3615
  return target;
3327
3616
  }
3328
3617
 
3329
- function _objectWithoutPropertiesLoose$4(source, excluded) {
3618
+ function _objectWithoutPropertiesLoose(source, excluded) {
3330
3619
  if (source == null) return {};
3331
3620
  var target = {};
3332
3621
  var sourceKeys = Object.keys(source);
@@ -3341,32 +3630,32 @@
3341
3630
  return target;
3342
3631
  }
3343
3632
 
3344
- function _toConsumableArray$5(arr) {
3345
- return _arrayWithoutHoles$5(arr) || _iterableToArray$5(arr) || _unsupportedIterableToArray$6(arr) || _nonIterableSpread$5();
3633
+ function _toConsumableArray(arr) {
3634
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
3346
3635
  }
3347
3636
 
3348
- function _nonIterableSpread$5() {
3637
+ function _nonIterableSpread() {
3349
3638
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3350
3639
  }
3351
3640
 
3352
- function _unsupportedIterableToArray$6(o, minLen) {
3641
+ function _unsupportedIterableToArray(o, minLen) {
3353
3642
  if (!o) return;
3354
- if (typeof o === "string") return _arrayLikeToArray$6(o, minLen);
3643
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
3355
3644
  var n = Object.prototype.toString.call(o).slice(8, -1);
3356
3645
  if (n === "Object" && o.constructor) n = o.constructor.name;
3357
3646
  if (n === "Map" || n === "Set") return Array.from(o);
3358
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$6(o, minLen);
3647
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
3359
3648
  }
3360
3649
 
3361
- function _iterableToArray$5(iter) {
3362
- if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
3650
+ function _iterableToArray(iter) {
3651
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
3363
3652
  }
3364
3653
 
3365
- function _arrayWithoutHoles$5(arr) {
3366
- if (Array.isArray(arr)) return _arrayLikeToArray$6(arr);
3654
+ function _arrayWithoutHoles(arr) {
3655
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
3367
3656
  }
3368
3657
 
3369
- function _arrayLikeToArray$6(arr, len) {
3658
+ function _arrayLikeToArray(arr, len) {
3370
3659
  if (len == null || len > arr.length) len = arr.length;
3371
3660
 
3372
3661
  for (var i = 0, arr2 = new Array(len); i < len; i++) {
@@ -3382,10 +3671,7 @@
3382
3671
  userAgents = _ref$userAgents === void 0 ? [] : _ref$userAgents;
3383
3672
 
3384
3673
  if (typeof searchClient.addAlgoliaAgent === 'function') {
3385
- var algoliaAgents = [{
3386
- segment: 'autocomplete-core',
3387
- version: version
3388
- }].concat(_toConsumableArray$5(userAgents));
3674
+ var algoliaAgents = [].concat(_toConsumableArray(userAgents$1), _toConsumableArray(userAgents));
3389
3675
  algoliaAgents.forEach(function (_ref2) {
3390
3676
  var segment = _ref2.segment,
3391
3677
  version = _ref2.version;
@@ -3395,10 +3681,10 @@
3395
3681
 
3396
3682
  return searchClient.search(queries.map(function (searchParameters) {
3397
3683
  var params = searchParameters.params,
3398
- headers = _objectWithoutProperties$4(searchParameters, ["params"]);
3684
+ headers = _objectWithoutProperties(searchParameters, _excluded$1);
3399
3685
 
3400
- return _objectSpread$e(_objectSpread$e({}, headers), {}, {
3401
- params: _objectSpread$e({
3686
+ return _objectSpread(_objectSpread({}, headers), {}, {
3687
+ params: _objectSpread({
3402
3688
  hitsPerPage: 5,
3403
3689
  highlightPreTag: HIGHLIGHT_PRE_TAG,
3404
3690
  highlightPostTag: HIGHLIGHT_POST_TAG
@@ -3485,6 +3771,7 @@
3485
3771
  };
3486
3772
  }
3487
3773
 
3774
+ var _excluded = ["classNames", "container", "getEnvironmentProps", "getFormProps", "getInputProps", "getItemProps", "getLabelProps", "getListProps", "getPanelProps", "getRootProps", "panelContainer", "panelPlacement", "render", "renderNoResults", "renderer", "detachedMediaQuery", "components", "translations"];
3488
3775
  var defaultClassNames = {
3489
3776
  clearButton: 'aa-ClearButton',
3490
3777
  detachedCancelButton: 'aa-DetachedCancelButton',
@@ -3515,12 +3802,12 @@
3515
3802
 
3516
3803
  var defaultRender = function defaultRender(_ref, root) {
3517
3804
  var children = _ref.children;
3518
- N(children, root);
3805
+ S(children, root);
3519
3806
  };
3520
3807
 
3521
3808
  var defaultRenderer = {
3522
- createElement: a,
3523
- Fragment: y
3809
+ createElement: v,
3810
+ Fragment: d
3524
3811
  };
3525
3812
  function getDefaultOptions(options) {
3526
3813
  var _core$id;
@@ -3543,7 +3830,7 @@
3543
3830
  detachedMediaQuery = options.detachedMediaQuery,
3544
3831
  components = options.components,
3545
3832
  translations = options.translations,
3546
- core = _objectWithoutProperties(options, ["classNames", "container", "getEnvironmentProps", "getFormProps", "getInputProps", "getItemProps", "getLabelProps", "getListProps", "getPanelProps", "getRootProps", "panelContainer", "panelPlacement", "render", "renderNoResults", "renderer", "detachedMediaQuery", "components", "translations"]);
3833
+ core = _objectWithoutProperties$4(options, _excluded);
3547
3834
  /* eslint-disable no-restricted-globals */
3548
3835
 
3549
3836
 
@@ -3810,6 +4097,11 @@
3810
4097
  }, autocompleteScopeApi), dom.panel);
3811
4098
  }
3812
4099
 
4100
+ var userAgents = [{
4101
+ segment: 'autocomplete-js',
4102
+ version: version
4103
+ }];
4104
+
3813
4105
  function autocomplete(options) {
3814
4106
  var _createEffectWrapper = createEffectWrapper(),
3815
4107
  runEffect = _createEffectWrapper.runEffect,
@@ -3855,6 +4147,10 @@
3855
4147
 
3856
4148
  var hasNoResultsTemplate = Boolean(hasNoResultsSourceTemplateRef.current || props.value.renderer.renderNoResults);
3857
4149
  return !hasItems && hasNoResultsTemplate || hasItems;
4150
+ },
4151
+ __autocomplete_metadata: {
4152
+ userAgents: userAgents,
4153
+ options: options
3858
4154
  }
3859
4155
  }));
3860
4156
  });
@@ -3941,7 +4237,7 @@
3941
4237
  setProperties(props.value.core.environment, environmentProps);
3942
4238
  return function () {
3943
4239
  setProperties(props.value.core.environment, Object.keys(environmentProps).reduce(function (acc, key) {
3944
- return _objectSpread2(_objectSpread2({}, acc), {}, _defineProperty({}, key, undefined));
4240
+ return _objectSpread2(_objectSpread2({}, acc), {}, _defineProperty$g({}, key, undefined));
3945
4241
  }, {}));
3946
4242
  };
3947
4243
  });
@@ -4098,14 +4394,9 @@
4098
4394
  });
4099
4395
  }
4100
4396
 
4101
- var version$1 = '1.3.0';
4102
-
4103
4397
  var createAlgoliaRequester = createRequester(function (params) {
4104
4398
  return fetchAlgoliaResults(_objectSpread2(_objectSpread2({}, params), {}, {
4105
- userAgents: [{
4106
- segment: 'autocomplete-js',
4107
- version: version$1
4108
- }]
4399
+ userAgents: userAgents
4109
4400
  }));
4110
4401
  });
4111
4402
 
@@ -4145,5 +4436,5 @@
4145
4436
 
4146
4437
  Object.defineProperty(exports, '__esModule', { value: true });
4147
4438
 
4148
- })));
4439
+ }));
4149
4440
  //# sourceMappingURL=index.development.js.map