instantsearch.js 4.86.1 → 4.87.0

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 (47) hide show
  1. package/cjs/connectors/autocomplete/connectAutocomplete.js +13 -5
  2. package/cjs/connectors/chat/connectChat.js +89 -17
  3. package/cjs/connectors/filter-suggestions/connectFilterSuggestions.js +255 -0
  4. package/cjs/connectors/index.js +7 -0
  5. package/cjs/connectors/index.umd.js +7 -0
  6. package/cjs/lib/chat/chat.js +3 -3
  7. package/cjs/lib/chat/index.js +5 -2
  8. package/cjs/lib/version.js +1 -1
  9. package/cjs/widgets/autocomplete/autocomplete.js +15 -6
  10. package/cjs/widgets/chat/chat.js +32 -3
  11. package/cjs/widgets/filter-suggestions/filter-suggestions.js +131 -0
  12. package/cjs/widgets/index.js +7 -0
  13. package/cjs/widgets/index.umd.js +7 -0
  14. package/dist/instantsearch.development.d.ts +885 -72
  15. package/dist/instantsearch.development.js +731 -184
  16. package/dist/instantsearch.development.js.map +1 -1
  17. package/dist/instantsearch.production.d.ts +885 -72
  18. package/dist/instantsearch.production.min.d.ts +885 -72
  19. package/dist/instantsearch.production.min.js +2 -2
  20. package/dist/instantsearch.production.min.js.map +1 -1
  21. package/es/connectors/autocomplete/connectAutocomplete.d.ts +10 -0
  22. package/es/connectors/autocomplete/connectAutocomplete.js +13 -5
  23. package/es/connectors/chat/connectChat.d.ts +10 -0
  24. package/es/connectors/chat/connectChat.js +89 -17
  25. package/es/connectors/filter-suggestions/connectFilterSuggestions.d.ts +95 -0
  26. package/es/connectors/filter-suggestions/connectFilterSuggestions.js +249 -0
  27. package/es/connectors/index.d.ts +1 -0
  28. package/es/connectors/index.js +2 -1
  29. package/es/connectors/index.umd.d.ts +1 -0
  30. package/es/connectors/index.umd.js +2 -1
  31. package/es/lib/chat/chat.d.ts +1 -1
  32. package/es/lib/chat/chat.js +3 -3
  33. package/es/lib/chat/index.d.ts +3 -0
  34. package/es/lib/chat/index.js +4 -1
  35. package/es/lib/version.d.ts +1 -1
  36. package/es/lib/version.js +1 -1
  37. package/es/widgets/autocomplete/autocomplete.d.ts +2 -1
  38. package/es/widgets/autocomplete/autocomplete.js +15 -6
  39. package/es/widgets/chat/chat.d.ts +8 -0
  40. package/es/widgets/chat/chat.js +33 -4
  41. package/es/widgets/filter-suggestions/filter-suggestions.d.ts +689 -0
  42. package/es/widgets/filter-suggestions/filter-suggestions.js +124 -0
  43. package/es/widgets/index.d.ts +1 -0
  44. package/es/widgets/index.js +2 -1
  45. package/es/widgets/index.umd.d.ts +1 -0
  46. package/es/widgets/index.umd.js +2 -1
  47. package/package.json +6 -6
@@ -1,4 +1,4 @@
1
- /*! InstantSearch.js 4.86.1 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch */
1
+ /*! InstantSearch.js 4.87.0 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -13152,7 +13152,11 @@
13152
13152
  return function (widgetParams) {
13153
13153
  var _ref = widgetParams || {},
13154
13154
  _ref$escapeHTML = _ref.escapeHTML,
13155
- escapeHTML = _ref$escapeHTML === void 0 ? true : _ref$escapeHTML;
13155
+ escapeHTML = _ref$escapeHTML === void 0 ? true : _ref$escapeHTML,
13156
+ _ref$transformItems = _ref.transformItems,
13157
+ transformItems = _ref$transformItems === void 0 ? function (indices) {
13158
+ return indices;
13159
+ } : _ref$transformItems;
13156
13160
  _warning(!widgetParams.indices, "\nThe option `indices` has been removed from the Autocomplete connector.\n\nThe indices to target are now inferred from the widgets tree.\n".concat(Array.isArray(widgetParams.indices) ? "\nAn alternative would be:\n\nconst autocomplete = connectAutocomplete(renderer);\n\nsearch.addWidgets([\n ".concat(widgetParams.indices.map(function (_ref2) {
13157
13161
  var value = _ref2.value;
13158
13162
  return "index({ indexName: '".concat(value, "' }),");
@@ -13194,6 +13198,7 @@
13194
13198
  helper.setQuery(query).search();
13195
13199
  };
13196
13200
  }
13201
+ var sendEventMap = {};
13197
13202
  var indices = scopedResults.map(function (scopedResult) {
13198
13203
  var _scopedResult$results, _scopedResult$results2;
13199
13204
  // We need to escape the hits because highlighting
@@ -13201,7 +13206,7 @@
13201
13206
  if (scopedResult.results) {
13202
13207
  scopedResult.results.hits = escapeHTML ? escapeHits(scopedResult.results.hits) : scopedResult.results.hits;
13203
13208
  }
13204
- var sendEvent = createSendEventForHits({
13209
+ sendEventMap[scopedResult.indexId] = createSendEventForHits({
13205
13210
  instantSearchInstance: instantSearchInstance,
13206
13211
  helper: scopedResult.helper,
13207
13212
  widgetType: _this.$$type
@@ -13210,13 +13215,16 @@
13210
13215
  indexId: scopedResult.indexId,
13211
13216
  indexName: ((_scopedResult$results = scopedResult.results) === null || _scopedResult$results === void 0 ? void 0 : _scopedResult$results.index) || '',
13212
13217
  hits: ((_scopedResult$results2 = scopedResult.results) === null || _scopedResult$results2 === void 0 ? void 0 : _scopedResult$results2.hits) || [],
13213
- results: scopedResult.results || {},
13214
- sendEvent: sendEvent
13218
+ results: scopedResult.results || {}
13215
13219
  };
13216
13220
  });
13217
13221
  return {
13218
13222
  currentRefinement: state.query || '',
13219
- indices: indices,
13223
+ indices: transformItems(indices).map(function (transformedIndex) {
13224
+ return _objectSpread2(_objectSpread2({}, transformedIndex), {}, {
13225
+ sendEvent: sendEventMap[transformedIndex.indexId]
13226
+ });
13227
+ }),
13220
13228
  refine: connectorState.refine,
13221
13229
  widgetParams: widgetParams
13222
13230
  };
@@ -13912,6 +13920,242 @@
13912
13920
  };
13913
13921
  });
13914
13922
 
13923
+ var withUsage$u = createDocumentationMessageGenerator({
13924
+ name: 'filter-suggestions',
13925
+ connector: true
13926
+ });
13927
+ var connectFilterSuggestions = function connectFilterSuggestions(renderFn) {
13928
+ var unmountFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
13929
+ checkRendering(renderFn, withUsage$u());
13930
+ return function (widgetParams) {
13931
+ var agentId = widgetParams.agentId,
13932
+ attributes = widgetParams.attributes,
13933
+ _widgetParams$maxSugg = widgetParams.maxSuggestions,
13934
+ maxSuggestions = _widgetParams$maxSugg === void 0 ? 3 : _widgetParams$maxSugg,
13935
+ _widgetParams$debounc = widgetParams.debounceMs,
13936
+ debounceMs = _widgetParams$debounc === void 0 ? 300 : _widgetParams$debounc,
13937
+ _widgetParams$hitsToS = widgetParams.hitsToSample,
13938
+ hitsToSample = _widgetParams$hitsToS === void 0 ? 5 : _widgetParams$hitsToS,
13939
+ _widgetParams$transfo = widgetParams.transformItems,
13940
+ transformItems = _widgetParams$transfo === void 0 ? function (items) {
13941
+ return items;
13942
+ } : _widgetParams$transfo,
13943
+ transport = widgetParams.transport;
13944
+ if (!agentId && !transport) {
13945
+ throw new Error(withUsage$u('The `agentId` option is required unless a custom `transport` is provided.'));
13946
+ }
13947
+ var endpoint;
13948
+ var headers;
13949
+ var suggestions = [];
13950
+ var isLoading = false;
13951
+ var debounceTimer;
13952
+ var lastStateSignature = null; // null means never fetched
13953
+ var refine;
13954
+ var searchHelper = null;
13955
+ var latestRenderOptions = null;
13956
+
13957
+ // Create a signature of the current search state (query + refinements)
13958
+ var getStateSignature = function getStateSignature(results) {
13959
+ var query = results.query || '';
13960
+ var refinements = searchHelper ? JSON.stringify(searchHelper.state.facetsRefinements) + JSON.stringify(searchHelper.state.disjunctiveFacetsRefinements) + JSON.stringify(searchHelper.state.hierarchicalFacetsRefinements) : '';
13961
+ return "".concat(query, "|").concat(refinements);
13962
+ };
13963
+ var _getWidgetRenderState = function getWidgetRenderState(renderOptions) {
13964
+ var results = 'results' in renderOptions ? renderOptions.results : undefined;
13965
+ var transformedSuggestions = transformItems(suggestions, {
13966
+ results: results
13967
+ });
13968
+ return {
13969
+ suggestions: transformedSuggestions,
13970
+ isLoading: isLoading,
13971
+ refine: refine,
13972
+ widgetParams: widgetParams
13973
+ };
13974
+ };
13975
+
13976
+ // Minimum duration to show skeleton to avoid flash when results are cached
13977
+ var MIN_SKELETON_DURATION_MS = 300;
13978
+ var fetchSuggestions = function fetchSuggestions(results, renderOptions) {
13979
+ var _results$hits, _rawResults$;
13980
+ if (!(results !== null && results !== void 0 && (_results$hits = results.hits) !== null && _results$hits !== void 0 && _results$hits.length)) {
13981
+ suggestions = [];
13982
+ isLoading = false;
13983
+ renderFn(_objectSpread2(_objectSpread2({}, _getWidgetRenderState(renderOptions)), {}, {
13984
+ instantSearchInstance: renderOptions.instantSearchInstance
13985
+ }), false);
13986
+ return;
13987
+ }
13988
+ var loadingStartTime = Date.now();
13989
+ isLoading = true;
13990
+ renderFn(_objectSpread2(_objectSpread2({}, _getWidgetRenderState(renderOptions)), {}, {
13991
+ instantSearchInstance: renderOptions.instantSearchInstance
13992
+ }), false);
13993
+
13994
+ // Get facets from raw results (results.facets is processed differently)
13995
+ var rawResults = results._rawResults;
13996
+ var rawFacets = (rawResults === null || rawResults === void 0 ? void 0 : (_rawResults$ = rawResults[0]) === null || _rawResults$ === void 0 ? void 0 : _rawResults$.facets) || {};
13997
+ var facetsToSend = attributes ? Object.fromEntries(Object.entries(rawFacets).filter(function (_ref) {
13998
+ var _ref2 = _slicedToArray(_ref, 1),
13999
+ key = _ref2[0];
14000
+ return attributes.includes(key);
14001
+ })) : rawFacets;
14002
+
14003
+ // Collect current refinements to exclude from suggestions
14004
+ var currentRefinements = searchHelper ? getRefinements(results, searchHelper.state).map(function (refinement) {
14005
+ return {
14006
+ attribute: refinement.attribute,
14007
+ value: refinement.name
14008
+ };
14009
+ }) : [];
14010
+ var messageText = JSON.stringify({
14011
+ query: results.query,
14012
+ facets: facetsToSend,
14013
+ hitsSample: results.hits.slice(0, hitsToSample),
14014
+ currentRefinements: currentRefinements,
14015
+ maxSuggestions: maxSuggestions
14016
+ });
14017
+ var payload = {
14018
+ messages: [{
14019
+ id: "sr-".concat(Date.now()),
14020
+ createdAt: new Date().toISOString(),
14021
+ role: 'user',
14022
+ parts: [{
14023
+ type: 'text',
14024
+ text: messageText
14025
+ }]
14026
+ }]
14027
+ };
14028
+
14029
+ // Apply custom body transformation if provided
14030
+ var finalPayload = transport !== null && transport !== void 0 && transport.prepareSendMessagesRequest ? transport.prepareSendMessagesRequest(payload).body : payload;
14031
+ fetch(endpoint, {
14032
+ method: 'POST',
14033
+ headers: _objectSpread2(_objectSpread2({}, headers), {}, {
14034
+ 'Content-Type': 'application/json'
14035
+ }),
14036
+ body: JSON.stringify(finalPayload)
14037
+ }).then(function (response) {
14038
+ if (!response.ok) {
14039
+ throw new Error("HTTP error ".concat(response.status));
14040
+ }
14041
+ return response.json();
14042
+ }).then(function (data) {
14043
+ var parsedSuggestions = JSON.parse(data.parts[1].text);
14044
+ var validSuggestions = (Array.isArray(parsedSuggestions) ? parsedSuggestions : []).filter(function (suggestion) {
14045
+ if (!(suggestion !== null && suggestion !== void 0 && suggestion.attribute) || !(suggestion !== null && suggestion !== void 0 && suggestion.value) || !(suggestion !== null && suggestion !== void 0 && suggestion.label)) {
14046
+ return false;
14047
+ }
14048
+ // If attributes filter is specified, only allow suggestions for those attributes
14049
+ if (attributes && !attributes.includes(suggestion.attribute)) {
14050
+ return false;
14051
+ }
14052
+ return true;
14053
+ }).slice(0, maxSuggestions);
14054
+ suggestions = validSuggestions;
14055
+ }).catch(function () {
14056
+ suggestions = [];
14057
+ }).finally(function () {
14058
+ var elapsed = Date.now() - loadingStartTime;
14059
+ var remainingDelay = Math.max(0, MIN_SKELETON_DURATION_MS - elapsed);
14060
+ var finishLoading = function finishLoading() {
14061
+ isLoading = false;
14062
+ renderFn(_objectSpread2(_objectSpread2({}, _getWidgetRenderState(renderOptions)), {}, {
14063
+ instantSearchInstance: renderOptions.instantSearchInstance
14064
+ }), false);
14065
+ };
14066
+ if (remainingDelay > 0) {
14067
+ setTimeout(finishLoading, remainingDelay);
14068
+ } else {
14069
+ finishLoading();
14070
+ }
14071
+ });
14072
+ };
14073
+ return {
14074
+ $$type: 'ais.filterSuggestions',
14075
+ init: function init(initOptions) {
14076
+ var instantSearchInstance = initOptions.instantSearchInstance,
14077
+ helper = initOptions.helper;
14078
+ searchHelper = helper;
14079
+ if (transport) {
14080
+ // Use custom transport configuration
14081
+ endpoint = transport.api;
14082
+ headers = transport.headers || {};
14083
+ } else {
14084
+ // Use default Algolia agent endpoint
14085
+ var _getAppIdAndApiKey = getAppIdAndApiKey(instantSearchInstance.client),
14086
+ _getAppIdAndApiKey2 = _slicedToArray(_getAppIdAndApiKey, 2),
14087
+ appId = _getAppIdAndApiKey2[0],
14088
+ apiKey = _getAppIdAndApiKey2[1];
14089
+ if (!appId || !apiKey) {
14090
+ throw new Error(withUsage$u('Could not extract Algolia credentials from the search client.'));
14091
+ }
14092
+ endpoint = "https://".concat(appId, ".algolia.net/agent-studio/1/agents/").concat(agentId, "/completions?compatibilityMode=ai-sdk-5&stream=false");
14093
+ headers = {
14094
+ 'x-algolia-application-id': appId,
14095
+ 'x-algolia-api-key': apiKey,
14096
+ 'x-algolia-agent': getAlgoliaAgent(instantSearchInstance.client)
14097
+ };
14098
+ }
14099
+ refine = function refine(attribute, value) {
14100
+ var _helper$state$hierarc;
14101
+ // Check if the attribute belongs to a hierarchical facet
14102
+ // by finding a hierarchical facet that includes this attribute
14103
+ var attr = ((_helper$state$hierarc = helper.state.hierarchicalFacets.find(function (facet) {
14104
+ return facet.attributes.includes(attribute);
14105
+ })) === null || _helper$state$hierarc === void 0 ? void 0 : _helper$state$hierarc.name) || attribute;
14106
+ helper.toggleFacetRefinement(attr, value);
14107
+ helper.search();
14108
+ };
14109
+ renderFn(_objectSpread2(_objectSpread2({}, _getWidgetRenderState(initOptions)), {}, {
14110
+ instantSearchInstance: instantSearchInstance
14111
+ }), true);
14112
+ },
14113
+ render: function render(renderOptions) {
14114
+ var results = renderOptions.results,
14115
+ instantSearchInstance = renderOptions.instantSearchInstance;
14116
+
14117
+ // Always store the latest render options
14118
+ latestRenderOptions = renderOptions;
14119
+ if (!results) {
14120
+ renderFn(_objectSpread2(_objectSpread2({}, _getWidgetRenderState(renderOptions)), {}, {
14121
+ instantSearchInstance: instantSearchInstance
14122
+ }), false);
14123
+ return;
14124
+ }
14125
+
14126
+ // Debounce: only fetch if search state changed (query or refinements) and after delay
14127
+ var stateSignature = getStateSignature(results);
14128
+ if (stateSignature !== lastStateSignature) {
14129
+ lastStateSignature = stateSignature;
14130
+ clearTimeout(debounceTimer);
14131
+ debounceTimer = setTimeout(function () {
14132
+ var _latestRenderOptions;
14133
+ // Use the latest render options when the timeout fires
14134
+ if ((_latestRenderOptions = latestRenderOptions) !== null && _latestRenderOptions !== void 0 && _latestRenderOptions.results) {
14135
+ fetchSuggestions(latestRenderOptions.results, latestRenderOptions);
14136
+ }
14137
+ }, debounceMs);
14138
+ }
14139
+ renderFn(_objectSpread2(_objectSpread2({}, _getWidgetRenderState(renderOptions)), {}, {
14140
+ instantSearchInstance: instantSearchInstance
14141
+ }), false);
14142
+ },
14143
+ dispose: function dispose() {
14144
+ clearTimeout(debounceTimer);
14145
+ unmountFn();
14146
+ },
14147
+ getRenderState: function getRenderState(renderState, renderOptions) {
14148
+ return _objectSpread2(_objectSpread2({}, renderState), {}, {
14149
+ filterSuggestions: this.getWidgetRenderState(renderOptions)
14150
+ });
14151
+ },
14152
+ getWidgetRenderState: function getWidgetRenderState(renderOptions) {
14153
+ return _getWidgetRenderState(renderOptions);
14154
+ }
14155
+ };
14156
+ };
14157
+ };
14158
+
13915
14159
  /** @deprecated answers is no longer supported */
13916
14160
  var EXPERIMENTAL_connectAnswers = deprecate(connectAnswers, 'answers is no longer supported');
13917
14161
 
@@ -13960,7 +14204,8 @@
13960
14204
  connectVoiceSearch: connectVoiceSearch,
13961
14205
  connectRelevantSort: connectRelevantSort,
13962
14206
  connectFrequentlyBoughtTogether: connectFrequentlyBoughtTogether,
13963
- connectLookingSimilar: connectLookingSimilar
14207
+ connectLookingSimilar: connectLookingSimilar,
14208
+ connectFilterSuggestions: connectFilterSuggestions
13964
14209
  });
13965
14210
 
13966
14211
  var NAMESPACE = 'ais';
@@ -15860,7 +16105,7 @@
15860
16105
 
15861
16106
  var _excluded$7 = ["initialSearchParameters"],
15862
16107
  _excluded2$2 = ["initialRecommendParameters"];
15863
- var withUsage$u = createDocumentationMessageGenerator({
16108
+ var withUsage$v = createDocumentationMessageGenerator({
15864
16109
  name: 'index-widget'
15865
16110
  });
15866
16111
  /**
@@ -15954,7 +16199,7 @@
15954
16199
  }
15955
16200
  var index = function index(widgetParams) {
15956
16201
  if (widgetParams === undefined || widgetParams.indexName === undefined && !widgetParams.EXPERIMENTAL_isolated) {
15957
- throw new Error(withUsage$u('The `indexName` option is required.'));
16202
+ throw new Error(withUsage$v('The `indexName` option is required.'));
15958
16203
  }
15959
16204
 
15960
16205
  // When isolated=true, we use an empty string as the default indexName.
@@ -16052,7 +16297,7 @@
16052
16297
  addWidgets: function addWidgets(widgets) {
16053
16298
  var _this = this;
16054
16299
  if (!Array.isArray(widgets)) {
16055
- throw new Error(withUsage$u('The `addWidgets` method expects an array of widgets.'));
16300
+ throw new Error(withUsage$v('The `addWidgets` method expects an array of widgets.'));
16056
16301
  }
16057
16302
  var flatWidgets = widgets.reduce(function (acc, w) {
16058
16303
  return acc.concat(Array.isArray(w) ? w : [w]);
@@ -16060,7 +16305,7 @@
16060
16305
  if (flatWidgets.some(function (widget) {
16061
16306
  return typeof widget.init !== 'function' && typeof widget.render !== 'function';
16062
16307
  })) {
16063
- throw new Error(withUsage$u('The widget definition expects a `render` and/or an `init` method.'));
16308
+ throw new Error(withUsage$v('The widget definition expects a `render` and/or an `init` method.'));
16064
16309
  }
16065
16310
  flatWidgets.forEach(function (widget) {
16066
16311
  widget.parent = _this;
@@ -16121,7 +16366,7 @@
16121
16366
  removeWidgets: function removeWidgets(widgets) {
16122
16367
  var _this2 = this;
16123
16368
  if (!Array.isArray(widgets)) {
16124
- throw new Error(withUsage$u('The `removeWidgets` method expects an array of widgets.'));
16369
+ throw new Error(withUsage$v('The `removeWidgets` method expects an array of widgets.'));
16125
16370
  }
16126
16371
  var flatWidgets = widgets.reduce(function (acc, w) {
16127
16372
  return acc.concat(Array.isArray(w) ? w : [w]);
@@ -16129,7 +16374,7 @@
16129
16374
  if (flatWidgets.some(function (widget) {
16130
16375
  return typeof widget.dispose !== 'function';
16131
16376
  })) {
16132
- throw new Error(withUsage$u('The widget definition expects a `dispose` method.'));
16377
+ throw new Error(withUsage$v('The widget definition expects a `dispose` method.'));
16133
16378
  }
16134
16379
  localWidgets = localWidgets.filter(function (widget) {
16135
16380
  return flatWidgets.indexOf(widget) === -1;
@@ -16590,9 +16835,9 @@
16590
16835
  };
16591
16836
  }
16592
16837
 
16593
- var version$1 = '4.86.1';
16838
+ var version$1 = '4.87.0';
16594
16839
 
16595
- var withUsage$v = createDocumentationMessageGenerator({
16840
+ var withUsage$w = createDocumentationMessageGenerator({
16596
16841
  name: 'instantsearch'
16597
16842
  });
16598
16843
  function defaultCreateURL() {
@@ -16715,7 +16960,7 @@
16715
16960
  _options$future = options.future,
16716
16961
  future = _options$future === void 0 ? _objectSpread2(_objectSpread2({}, INSTANTSEARCH_FUTURE_DEFAULTS), options.future || {}) : _options$future;
16717
16962
  if (searchClient === null) {
16718
- throw new Error(withUsage$v('The `searchClient` option is required.'));
16963
+ throw new Error(withUsage$w('The `searchClient` option is required.'));
16719
16964
  }
16720
16965
  if (typeof searchClient.search !== 'function') {
16721
16966
  throw new Error("The `searchClient` must implement a `search` method.\n\nSee: https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/backend-instantsearch/js/");
@@ -16725,7 +16970,7 @@
16725
16970
  }
16726
16971
  _warning(insightsClient === null, "`insightsClient` property has been deprecated. It is still supported in 4.x releases, but not further. It is replaced by the `insights` middleware.\n\nFor more information, visit https://www.algolia.com/doc/guides/getting-insights-and-analytics/search-analytics/click-through-and-conversions/how-to/send-click-and-conversion-events-with-instantsearch/js/") ;
16727
16972
  if (insightsClient && typeof insightsClient !== 'function') {
16728
- throw new Error(withUsage$v('The `insightsClient` option should be a function.'));
16973
+ throw new Error(withUsage$w('The `insightsClient` option should be a function.'));
16729
16974
  }
16730
16975
  _warning(!options.searchParameters, "The `searchParameters` option is deprecated and will not be supported in InstantSearch.js 4.x.\n\nYou can replace it with the `configure` widget:\n\n```\nsearch.addWidgets([\n configure(".concat(JSON.stringify(options.searchParameters, null, 2), ")\n]);\n```\n\nSee ").concat(createDocumentationLink({
16731
16976
  name: 'configure'
@@ -16889,12 +17134,12 @@
16889
17134
  key: "addWidgets",
16890
17135
  value: function addWidgets(widgets) {
16891
17136
  if (!Array.isArray(widgets)) {
16892
- throw new Error(withUsage$v('The `addWidgets` method expects an array of widgets. Please use `addWidget`.'));
17137
+ throw new Error(withUsage$w('The `addWidgets` method expects an array of widgets. Please use `addWidget`.'));
16893
17138
  }
16894
17139
  if (this.compositionID && widgets.some(function (w) {
16895
17140
  return !Array.isArray(w) && isIndexWidget(w) && !w._isolated;
16896
17141
  })) {
16897
- throw new Error(withUsage$v('The `index` widget cannot be used with a composition-based InstantSearch implementation.'));
17142
+ throw new Error(withUsage$w('The `index` widget cannot be used with a composition-based InstantSearch implementation.'));
16898
17143
  }
16899
17144
  this.mainIndex.addWidgets(widgets);
16900
17145
  return this;
@@ -16924,7 +17169,7 @@
16924
17169
  key: "removeWidgets",
16925
17170
  value: function removeWidgets(widgets) {
16926
17171
  if (!Array.isArray(widgets)) {
16927
- throw new Error(withUsage$v('The `removeWidgets` method expects an array of widgets. Please use `removeWidget`.'));
17172
+ throw new Error(withUsage$w('The `removeWidgets` method expects an array of widgets. Please use `removeWidget`.'));
16928
17173
  }
16929
17174
  this.mainIndex.removeWidgets(widgets);
16930
17175
  return this;
@@ -16939,7 +17184,7 @@
16939
17184
  value: function start() {
16940
17185
  var _this3 = this;
16941
17186
  if (this.started) {
16942
- throw new Error(withUsage$v('The `start` method has already been called once.'));
17187
+ throw new Error(withUsage$w('The `start` method has already been called once.'));
16943
17188
  }
16944
17189
 
16945
17190
  // This Helper is used for the queries, we don't care about its state. The
@@ -17161,7 +17406,7 @@
17161
17406
  var _this5 = this;
17162
17407
  var callOnStateChange = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
17163
17408
  if (!this.mainHelper) {
17164
- throw new Error(withUsage$v('The `start` method needs to be called before `setUiState`.'));
17409
+ throw new Error(withUsage$w('The `start` method needs to be called before `setUiState`.'));
17165
17410
  }
17166
17411
 
17167
17412
  // We refresh the index UI state to update the local UI state that the
@@ -17197,7 +17442,7 @@
17197
17442
  value: function createURL() {
17198
17443
  var nextState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
17199
17444
  if (!this.started) {
17200
- throw new Error(withUsage$v('The `start` method needs to be called before `createURL`.'));
17445
+ throw new Error(withUsage$w('The `start` method needs to be called before `createURL`.'));
17201
17446
  }
17202
17447
  return this._createURL(nextState);
17203
17448
  }
@@ -17205,7 +17450,7 @@
17205
17450
  key: "refresh",
17206
17451
  value: function refresh() {
17207
17452
  if (!this.mainHelper) {
17208
- throw new Error(withUsage$v('The `start` method needs to be called before `refresh`.'));
17453
+ throw new Error(withUsage$w('The `start` method needs to be called before `refresh`.'));
17209
17454
  }
17210
17455
  this.mainHelper.clearCache().search();
17211
17456
  }
@@ -17544,6 +17789,16 @@
17544
17789
 
17545
17790
  var _slicedToArray$1 = unwrapExports(slicedToArray);
17546
17791
 
17792
+ function find$2(array, predicate) {
17793
+ for (var index = 0; index < array.length; index++) {
17794
+ var item = array[index];
17795
+ if (predicate(item, index, array)) {
17796
+ return item;
17797
+ }
17798
+ }
17799
+ return undefined;
17800
+ }
17801
+
17547
17802
  function SubmitIcon(_ref) {
17548
17803
  var createElement = _ref.createElement;
17549
17804
  return createElement("svg", {
@@ -17972,18 +18227,23 @@
17972
18227
  getElementId = _ref5.getElementId;
17973
18228
  var itemsIds = [];
17974
18229
  var items = new Map();
17975
- for (var i = 0; i < indicesConfig.length; i++) {
18230
+ var _loop = function _loop(i) {
17976
18231
  var _indices$i;
17977
- var config = indicesConfig[i];
18232
+ var currentIndexConfig = find$2(indicesConfig, function (config) {
18233
+ return config.indexName === indices[i].indexName;
18234
+ });
17978
18235
  var hits = ((_indices$i = indices[i]) === null || _indices$i === void 0 ? void 0 : _indices$i.hits) || [];
17979
18236
  for (var position = 0; position < hits.length; position++) {
17980
- var itemId = getElementId('item', config.indexName, position);
18237
+ var itemId = getElementId('item', (currentIndexConfig === null || currentIndexConfig === void 0 ? void 0 : currentIndexConfig.indexName) || indices[i].indexName, position);
17981
18238
  items.set(itemId, {
17982
18239
  item: hits[position],
17983
- config: config
18240
+ config: currentIndexConfig
17984
18241
  });
17985
18242
  itemsIds.push(itemId);
17986
18243
  }
18244
+ };
18245
+ for (var i = 0; i < indices.length; i++) {
18246
+ _loop(i);
17987
18247
  }
17988
18248
  return {
17989
18249
  items: items,
@@ -18044,6 +18304,27 @@
18044
18304
 
18045
18305
  var _toConsumableArray$1 = unwrapExports(toConsumableArray);
18046
18306
 
18307
+ function ownKeys$1(e, r) {
18308
+ var t = Object.keys(e);
18309
+ if (Object.getOwnPropertySymbols) {
18310
+ var o = Object.getOwnPropertySymbols(e);
18311
+ r && (o = o.filter(function (r) {
18312
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
18313
+ })), t.push.apply(t, o);
18314
+ }
18315
+ return t;
18316
+ }
18317
+ function _objectSpread(e) {
18318
+ for (var r = 1; r < arguments.length; r++) {
18319
+ var t = null != arguments[r] ? arguments[r] : {};
18320
+ r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) {
18321
+ _defineProperty$1(e, r, t[r]);
18322
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) {
18323
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
18324
+ });
18325
+ }
18326
+ return e;
18327
+ }
18047
18328
  function createAutocompleteStorage(_ref) {
18048
18329
  var useEffect = _ref.useEffect,
18049
18330
  useMemo = _ref.useMemo,
@@ -18052,7 +18333,8 @@
18052
18333
  var showRecent = _ref2.showRecent,
18053
18334
  query = _ref2.query,
18054
18335
  indices = _ref2.indices,
18055
- indicesConfig = _ref2.indicesConfig;
18336
+ indicesConfig = _ref2.indicesConfig,
18337
+ suggestionsIndexName = _ref2.suggestionsIndexName;
18056
18338
  var storageKey = showRecent && _typeof$1(showRecent) === 'object' ? showRecent.storageKey : undefined;
18057
18339
  var storage = useMemo(function () {
18058
18340
  return createStorage({
@@ -18096,7 +18378,15 @@
18096
18378
  })
18097
18379
  };
18098
18380
  });
18099
- var indicesForPropGetters = _toConsumableArray$1(indices);
18381
+ var indicesForPropGetters = _toConsumableArray$1(indices.map(function (index) {
18382
+ return index.indexName === suggestionsIndexName ? _objectSpread(_objectSpread({}, index), {}, {
18383
+ hits: index.hits.filter(function (hit) {
18384
+ return !find$2(storageHits, function (storageHit) {
18385
+ return storageHit.query === hit.query;
18386
+ });
18387
+ })
18388
+ }) : index;
18389
+ }));
18100
18390
  var indicesConfigForPropGetters = _toConsumableArray$1(indicesConfig);
18101
18391
  indicesForPropGetters.unshift({
18102
18392
  indexName: 'recent-searches',
@@ -18208,6 +18498,26 @@
18208
18498
  };
18209
18499
  }
18210
18500
 
18501
+ var _excluded$c = ["variant", "size", "iconOnly", "className", "children"];
18502
+ function createButtonComponent(_ref) {
18503
+ var createElement = _ref.createElement;
18504
+ return function Button(userProps) {
18505
+ var _userProps$variant = userProps.variant,
18506
+ variant = _userProps$variant === void 0 ? 'primary' : _userProps$variant,
18507
+ _userProps$size = userProps.size,
18508
+ size = _userProps$size === void 0 ? 'md' : _userProps$size,
18509
+ _userProps$iconOnly = userProps.iconOnly,
18510
+ iconOnly = _userProps$iconOnly === void 0 ? false : _userProps$iconOnly,
18511
+ className = userProps.className,
18512
+ children = userProps.children,
18513
+ props = _objectWithoutProperties$1(userProps, _excluded$c);
18514
+ return createElement("button", _extends$1({
18515
+ type: "button",
18516
+ className: cx('ais-Button', "ais-Button--".concat(variant), "ais-Button--".concat(size), iconOnly && 'ais-Button--icon-only', className)
18517
+ }, props), children);
18518
+ };
18519
+ }
18520
+
18211
18521
  function createDefaultEmptyComponent(_ref) {
18212
18522
  var createElement = _ref.createElement,
18213
18523
  Fragment = _ref.Fragment;
@@ -18273,8 +18583,8 @@
18273
18583
  };
18274
18584
  }
18275
18585
 
18276
- var _excluded$c = ["listRef", "nextButtonRef", "previousButtonRef", "carouselIdRef", "canScrollLeft", "canScrollRight", "setCanScrollLeft", "setCanScrollRight", "classNames", "itemComponent", "previousIconComponent", "nextIconComponent", "headerComponent", "showNavigation", "items", "translations", "sendEvent"];
18277
- function ownKeys$1(e, r) {
18586
+ var _excluded$d = ["listRef", "nextButtonRef", "previousButtonRef", "carouselIdRef", "canScrollLeft", "canScrollRight", "setCanScrollLeft", "setCanScrollRight", "classNames", "itemComponent", "previousIconComponent", "nextIconComponent", "headerComponent", "showNavigation", "items", "translations", "sendEvent"];
18587
+ function ownKeys$2(e, r) {
18278
18588
  var t = Object.keys(e);
18279
18589
  if (Object.getOwnPropertySymbols) {
18280
18590
  var o = Object.getOwnPropertySymbols(e);
@@ -18284,12 +18594,12 @@
18284
18594
  }
18285
18595
  return t;
18286
18596
  }
18287
- function _objectSpread(e) {
18597
+ function _objectSpread$1(e) {
18288
18598
  for (var r = 1; r < arguments.length; r++) {
18289
18599
  var t = null != arguments[r] ? arguments[r] : {};
18290
- r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) {
18600
+ r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) {
18291
18601
  _defineProperty$1(e, r, t[r]);
18292
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) {
18602
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) {
18293
18603
  Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
18294
18604
  });
18295
18605
  }
@@ -18356,8 +18666,8 @@
18356
18666
  items = userProps.items,
18357
18667
  userTranslations = userProps.translations,
18358
18668
  sendEvent = userProps.sendEvent,
18359
- props = _objectWithoutProperties$1(userProps, _excluded$c);
18360
- var translations = _objectSpread({
18669
+ props = _objectWithoutProperties$1(userProps, _excluded$d);
18670
+ var translations = _objectSpread$1({
18361
18671
  listLabel: 'Items',
18362
18672
  nextButtonLabel: 'Next',
18363
18673
  nextButtonTitle: 'Next',
@@ -18470,8 +18780,27 @@
18470
18780
  };
18471
18781
  }
18472
18782
 
18473
- var _excluded$d = ["classNames", "emptyComponent", "headerComponent", "itemComponent", "layout", "items", "status", "translations", "sendEvent"];
18474
- function ownKeys$2(e, r) {
18783
+ function SparklesIcon(_ref) {
18784
+ var createElement = _ref.createElement;
18785
+ return createElement("svg", {
18786
+ xmlns: "http://www.w3.org/2000/svg",
18787
+ fill: "none",
18788
+ viewBox: "0 0 20 20"
18789
+ }, createElement("path", {
18790
+ fill: "currentColor",
18791
+ fillRule: "evenodd",
18792
+ d: "M10 1.875c.27 0 .51.173.594.43l1.593 4.844a1.043 1.043 0 0 0 .664.664l4.844 1.593a.625.625 0 0 1 0 1.188l-4.844 1.593a1.043 1.043 0 0 0-.664.664l-1.593 4.844a.625.625 0 0 1-1.188 0l-1.593-4.844a1.042 1.042 0 0 0-.664-.664l-4.844-1.593a.625.625 0 0 1 0-1.188l4.844-1.593a1.042 1.042 0 0 0 .664-.664l1.593-4.844a.625.625 0 0 1 .594-.43ZM9 7.539A2.292 2.292 0 0 1 7.54 9L4.5 10l3.04 1A2.292 2.292 0 0 1 9 12.46l1 3.04 1-3.04A2.293 2.293 0 0 1 12.46 11l3.04-1-3.04-1A2.292 2.292 0 0 1 11 7.54L10 4.5 9 7.54ZM4.167 1.875c.345 0 .625.28.625.625v3.333a.625.625 0 0 1-1.25 0V2.5c0-.345.28-.625.625-.625ZM15.833 13.542c.345 0 .625.28.625.625V17.5a.625.625 0 1 1-1.25 0v-3.333c0-.345.28-.625.625-.625Z",
18793
+ clipRule: "evenodd"
18794
+ }), createElement("path", {
18795
+ fill: "currentColor",
18796
+ fillRule: "evenodd",
18797
+ d: "M1.875 4.167c0-.346.28-.625.625-.625h3.333a.625.625 0 1 1 0 1.25H2.5a.625.625 0 0 1-.625-.625ZM13.542 15.833c0-.345.28-.625.625-.625H17.5a.625.625 0 0 1 0 1.25h-3.333a.625.625 0 0 1-.625-.625Z",
18798
+ clipRule: "evenodd"
18799
+ }));
18800
+ }
18801
+
18802
+ var _excluded$e = ["classNames", "emptyComponent", "headerComponent", "itemComponent", "layout", "items", "status", "translations", "sendEvent"];
18803
+ function ownKeys$3(e, r) {
18475
18804
  var t = Object.keys(e);
18476
18805
  if (Object.getOwnPropertySymbols) {
18477
18806
  var o = Object.getOwnPropertySymbols(e);
@@ -18481,12 +18810,12 @@
18481
18810
  }
18482
18811
  return t;
18483
18812
  }
18484
- function _objectSpread$1(e) {
18813
+ function _objectSpread$2(e) {
18485
18814
  for (var r = 1; r < arguments.length; r++) {
18486
18815
  var t = null != arguments[r] ? arguments[r] : {};
18487
- r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) {
18816
+ r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) {
18488
18817
  _defineProperty$1(e, r, t[r]);
18489
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) {
18818
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) {
18490
18819
  Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
18491
18820
  });
18492
18821
  }
@@ -18522,8 +18851,8 @@
18522
18851
  status = userProps.status,
18523
18852
  userTranslations = userProps.translations,
18524
18853
  sendEvent = userProps.sendEvent,
18525
- props = _objectWithoutProperties$1(userProps, _excluded$d);
18526
- var translations = _objectSpread$1({
18854
+ props = _objectWithoutProperties$1(userProps, _excluded$e);
18855
+ var translations = _objectSpread$2({
18527
18856
  title: 'Frequently bought together',
18528
18857
  sliderLabel: 'Frequently bought together products'
18529
18858
  }, userTranslations);
@@ -18555,7 +18884,7 @@
18555
18884
  };
18556
18885
  }
18557
18886
 
18558
- var _excluded$e = ["parts", "highlightedTagName", "nonHighlightedTagName", "separator", "className", "classNames"];
18887
+ var _excluded$f = ["parts", "highlightedTagName", "nonHighlightedTagName", "separator", "className", "classNames"];
18559
18888
  function createHighlightPartComponent(_ref) {
18560
18889
  var createElement = _ref.createElement;
18561
18890
  return function HighlightPart(_ref2) {
@@ -18588,7 +18917,7 @@
18588
18917
  className = userProps.className,
18589
18918
  _userProps$classNames = userProps.classNames,
18590
18919
  classNames = _userProps$classNames === void 0 ? {} : _userProps$classNames,
18591
- props = _objectWithoutProperties$1(userProps, _excluded$e);
18920
+ props = _objectWithoutProperties$1(userProps, _excluded$f);
18592
18921
  return createElement("span", _extends$1({}, props, {
18593
18922
  className: cx(classNames.root, className)
18594
18923
  }), parts.map(function (part, partIndex) {
@@ -18610,7 +18939,7 @@
18610
18939
  };
18611
18940
  }
18612
18941
 
18613
- var _excluded$f = ["classNames", "hits", "itemComponent", "sendEvent", "emptyComponent", "banner", "bannerComponent"];
18942
+ var _excluded$g = ["classNames", "hits", "itemComponent", "sendEvent", "emptyComponent", "banner", "bannerComponent"];
18614
18943
 
18615
18944
  // Should be imported from a shared package in the future
18616
18945
 
@@ -18655,7 +18984,7 @@
18655
18984
  EmptyComponent = userProps.emptyComponent,
18656
18985
  banner = userProps.banner,
18657
18986
  BannerComponent = userProps.bannerComponent,
18658
- props = _objectWithoutProperties$1(userProps, _excluded$f);
18987
+ props = _objectWithoutProperties$1(userProps, _excluded$g);
18659
18988
  return createElement("div", _extends$1({}, props, {
18660
18989
  className: cx('ais-Hits', classNames.root, hits.length === 0 && cx('ais-Hits--empty', classNames.emptyRoot), props.className)
18661
18990
  }), banner && (BannerComponent ? createElement(BannerComponent, {
@@ -18683,8 +19012,8 @@
18683
19012
  };
18684
19013
  }
18685
19014
 
18686
- var _excluded$g = ["classNames", "emptyComponent", "headerComponent", "itemComponent", "layout", "items", "status", "translations", "sendEvent"];
18687
- function ownKeys$3(e, r) {
19015
+ var _excluded$h = ["classNames", "emptyComponent", "headerComponent", "itemComponent", "layout", "items", "status", "translations", "sendEvent"];
19016
+ function ownKeys$4(e, r) {
18688
19017
  var t = Object.keys(e);
18689
19018
  if (Object.getOwnPropertySymbols) {
18690
19019
  var o = Object.getOwnPropertySymbols(e);
@@ -18694,12 +19023,12 @@
18694
19023
  }
18695
19024
  return t;
18696
19025
  }
18697
- function _objectSpread$2(e) {
19026
+ function _objectSpread$3(e) {
18698
19027
  for (var r = 1; r < arguments.length; r++) {
18699
19028
  var t = null != arguments[r] ? arguments[r] : {};
18700
- r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) {
19029
+ r % 2 ? ownKeys$4(Object(t), !0).forEach(function (r) {
18701
19030
  _defineProperty$1(e, r, t[r]);
18702
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) {
19031
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) {
18703
19032
  Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
18704
19033
  });
18705
19034
  }
@@ -18735,8 +19064,8 @@
18735
19064
  status = userProps.status,
18736
19065
  userTranslations = userProps.translations,
18737
19066
  sendEvent = userProps.sendEvent,
18738
- props = _objectWithoutProperties$1(userProps, _excluded$g);
18739
- var translations = _objectSpread$2({
19067
+ props = _objectWithoutProperties$1(userProps, _excluded$h);
19068
+ var translations = _objectSpread$3({
18740
19069
  title: 'Looking similar',
18741
19070
  sliderLabel: 'Looking similar'
18742
19071
  }, userTranslations);
@@ -18768,8 +19097,8 @@
18768
19097
  };
18769
19098
  }
18770
19099
 
18771
- var _excluded$h = ["classNames", "emptyComponent", "headerComponent", "itemComponent", "layout", "items", "status", "translations", "sendEvent"];
18772
- function ownKeys$4(e, r) {
19100
+ var _excluded$i = ["classNames", "emptyComponent", "headerComponent", "itemComponent", "layout", "items", "status", "translations", "sendEvent"];
19101
+ function ownKeys$5(e, r) {
18773
19102
  var t = Object.keys(e);
18774
19103
  if (Object.getOwnPropertySymbols) {
18775
19104
  var o = Object.getOwnPropertySymbols(e);
@@ -18779,12 +19108,12 @@
18779
19108
  }
18780
19109
  return t;
18781
19110
  }
18782
- function _objectSpread$3(e) {
19111
+ function _objectSpread$4(e) {
18783
19112
  for (var r = 1; r < arguments.length; r++) {
18784
19113
  var t = null != arguments[r] ? arguments[r] : {};
18785
- r % 2 ? ownKeys$4(Object(t), !0).forEach(function (r) {
19114
+ r % 2 ? ownKeys$5(Object(t), !0).forEach(function (r) {
18786
19115
  _defineProperty$1(e, r, t[r]);
18787
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) {
19116
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$5(Object(t)).forEach(function (r) {
18788
19117
  Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
18789
19118
  });
18790
19119
  }
@@ -18820,8 +19149,8 @@
18820
19149
  status = userProps.status,
18821
19150
  userTranslations = userProps.translations,
18822
19151
  sendEvent = userProps.sendEvent,
18823
- props = _objectWithoutProperties$1(userProps, _excluded$h);
18824
- var translations = _objectSpread$3({
19152
+ props = _objectWithoutProperties$1(userProps, _excluded$i);
19153
+ var translations = _objectSpread$4({
18825
19154
  title: 'Related products',
18826
19155
  sliderLabel: 'Related products'
18827
19156
  }, userTranslations);
@@ -18853,8 +19182,8 @@
18853
19182
  };
18854
19183
  }
18855
19184
 
18856
- var _excluded$i = ["classNames", "emptyComponent", "headerComponent", "itemComponent", "layout", "items", "status", "translations", "sendEvent"];
18857
- function ownKeys$5(e, r) {
19185
+ var _excluded$j = ["classNames", "emptyComponent", "headerComponent", "itemComponent", "layout", "items", "status", "translations", "sendEvent"];
19186
+ function ownKeys$6(e, r) {
18858
19187
  var t = Object.keys(e);
18859
19188
  if (Object.getOwnPropertySymbols) {
18860
19189
  var o = Object.getOwnPropertySymbols(e);
@@ -18864,12 +19193,12 @@
18864
19193
  }
18865
19194
  return t;
18866
19195
  }
18867
- function _objectSpread$4(e) {
19196
+ function _objectSpread$5(e) {
18868
19197
  for (var r = 1; r < arguments.length; r++) {
18869
19198
  var t = null != arguments[r] ? arguments[r] : {};
18870
- r % 2 ? ownKeys$5(Object(t), !0).forEach(function (r) {
19199
+ r % 2 ? ownKeys$6(Object(t), !0).forEach(function (r) {
18871
19200
  _defineProperty$1(e, r, t[r]);
18872
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$5(Object(t)).forEach(function (r) {
19201
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$6(Object(t)).forEach(function (r) {
18873
19202
  Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
18874
19203
  });
18875
19204
  }
@@ -18905,8 +19234,8 @@
18905
19234
  status = userProps.status,
18906
19235
  userTranslations = userProps.translations,
18907
19236
  sendEvent = userProps.sendEvent,
18908
- props = _objectWithoutProperties$1(userProps, _excluded$i);
18909
- var translations = _objectSpread$4({
19237
+ props = _objectWithoutProperties$1(userProps, _excluded$j);
19238
+ var translations = _objectSpread$5({
18910
19239
  title: 'Trending items',
18911
19240
  sliderLabel: 'Trending items'
18912
19241
  }, userTranslations);
@@ -18938,6 +19267,102 @@
18938
19267
  };
18939
19268
  }
18940
19269
 
19270
+ var _excluded$k = ["classNames", "suggestions", "isLoading", "refine", "skeletonCount", "itemComponent", "headerComponent", "emptyComponent"];
19271
+ function createFilterSuggestionsComponent(_ref) {
19272
+ var createElement = _ref.createElement;
19273
+ var Button = createButtonComponent({
19274
+ createElement: createElement
19275
+ });
19276
+ function DefaultHeader(_ref2) {
19277
+ var classNames = _ref2.classNames;
19278
+ return createElement("div", {
19279
+ className: cx('ais-FilterSuggestions-header', classNames.header)
19280
+ }, createElement("span", {
19281
+ className: cx('ais-FilterSuggestions-headerIcon', classNames.headerIcon)
19282
+ }, createElement(SparklesIcon, {
19283
+ createElement: createElement
19284
+ })), createElement("span", {
19285
+ className: cx('ais-FilterSuggestions-headerTitle', classNames.headerTitle)
19286
+ }, "Filter suggestions"));
19287
+ }
19288
+ function DefaultItem(_ref3) {
19289
+ var suggestion = _ref3.suggestion,
19290
+ classNames = _ref3.classNames,
19291
+ refine = _ref3.refine;
19292
+ return createElement(Button, {
19293
+ variant: "outline",
19294
+ size: "sm",
19295
+ className: cx(classNames.button),
19296
+ onClick: refine
19297
+ }, createElement("span", {
19298
+ className: cx('ais-FilterSuggestions-label', classNames.label)
19299
+ }, suggestion.label, ": ", suggestion.value), createElement("span", {
19300
+ className: cx('ais-FilterSuggestions-count', classNames.count)
19301
+ }, suggestion.count));
19302
+ }
19303
+ return function FilterSuggestions(userProps) {
19304
+ var _userProps$classNames = userProps.classNames,
19305
+ classNames = _userProps$classNames === void 0 ? {} : _userProps$classNames,
19306
+ suggestions = userProps.suggestions,
19307
+ isLoading = userProps.isLoading,
19308
+ _refine = userProps.refine,
19309
+ _userProps$skeletonCo = userProps.skeletonCount,
19310
+ skeletonCount = _userProps$skeletonCo === void 0 ? 3 : _userProps$skeletonCo,
19311
+ _userProps$itemCompon = userProps.itemComponent,
19312
+ ItemComponent = _userProps$itemCompon === void 0 ? DefaultItem : _userProps$itemCompon,
19313
+ headerComponent = userProps.headerComponent,
19314
+ EmptyComponent = userProps.emptyComponent,
19315
+ props = _objectWithoutProperties$1(userProps, _excluded$k);
19316
+ var HeaderComponent = headerComponent === false ? null : headerComponent !== null && headerComponent !== void 0 ? headerComponent : DefaultHeader;
19317
+ var isEmpty = suggestions.length === 0;
19318
+ if (isEmpty && !isLoading) {
19319
+ return createElement("div", _extends$1({}, props, {
19320
+ className: cx('ais-FilterSuggestions', classNames.root, 'ais-FilterSuggestions--empty', classNames.emptyRoot, props.className)
19321
+ }), EmptyComponent && createElement(EmptyComponent, {
19322
+ classNames: {
19323
+ emptyRoot: classNames.emptyRoot
19324
+ }
19325
+ }));
19326
+ }
19327
+ var headerClassNames = {
19328
+ header: classNames.header,
19329
+ headerIcon: classNames.headerIcon,
19330
+ headerTitle: classNames.headerTitle
19331
+ };
19332
+ var itemClassNames = {
19333
+ item: classNames.item,
19334
+ button: classNames.button,
19335
+ label: classNames.label,
19336
+ count: classNames.count
19337
+ };
19338
+ return createElement("div", _extends$1({}, props, {
19339
+ className: cx('ais-FilterSuggestions', classNames.root, isLoading && cx('ais-FilterSuggestions--loading', classNames.loadingRoot), props.className)
19340
+ }), HeaderComponent && createElement(HeaderComponent, {
19341
+ classNames: headerClassNames
19342
+ }), isLoading ? createElement("div", {
19343
+ className: cx('ais-FilterSuggestions-skeleton', classNames.skeleton)
19344
+ }, _toConsumableArray$1(new Array(skeletonCount)).map(function (_, i) {
19345
+ return createElement("div", {
19346
+ key: i,
19347
+ className: cx('ais-FilterSuggestions-skeletonItem', classNames.skeletonItem)
19348
+ });
19349
+ })) : createElement("ul", {
19350
+ className: cx('ais-FilterSuggestions-list', classNames.list)
19351
+ }, suggestions.map(function (suggestion) {
19352
+ return createElement("li", {
19353
+ key: "".concat(suggestion.attribute, "-").concat(suggestion.value),
19354
+ className: cx('ais-FilterSuggestions-item', classNames.item)
19355
+ }, createElement(ItemComponent, {
19356
+ suggestion: suggestion,
19357
+ classNames: itemClassNames,
19358
+ refine: function refine() {
19359
+ return _refine(suggestion.attribute, suggestion.value);
19360
+ }
19361
+ }));
19362
+ })));
19363
+ };
19364
+ }
19365
+
18941
19366
  var r$1,u$1,i,o$1,f$1=0,c$1=[],e$2=[],a$1=l.__b,v$1=l.__r,l$1=l.diffed,m$2=l.__c,d$1=l.unmount;function p$1(t,r){l.__h&&l.__h(u$1,t,f$1||r),f$1=0;var i=u$1.__H||(u$1.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({__V:e$2}),i.__[t]}function y$1(n){return f$1=1,h$1(C$1,n)}function h$1(n,t,i){var o=p$1(r$1++,2);if(o.t=n,!o.__c&&(o.__=[i?i(t):C$1(void 0,t),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}));}],o.__c=u$1,!u$1.u)){u$1.u=!0;var f=u$1.shouldComponentUpdate;u$1.shouldComponentUpdate=function(n,t,r){if(!o.__c.__H)return !0;var u=o.__c.__H.__.filter(function(n){return n.__c});if(u.every(function(n){return !n.__N}))return !f||f.call(this,n,t,r);var i=!1;return u.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=!0);}}),!!i&&(!f||f.call(this,n,t,r))};}return o.__N||o.__}function s$1(t,i){var o=p$1(r$1++,3);!l.__s&&B(o.__H,i)&&(o.__=t,o.i=i,u$1.__H.__h.push(o));}function A$1(n){return f$1=5,T$1(function(){return {current:n}},[])}function T$1(n,t){var u=p$1(r$1++,7);return B(u.__H,t)?(u.__V=n(),u.i=t,u.__h=n,u.__V):u.__}function b$1(){var n=p$1(r$1++,11);return n.__||(n.__="P"+function(n){for(var t=0,r=n.length;r>0;)t=(t<<5)-t+n.charCodeAt(--r)|0;return t}(u$1.__v.o)+r$1),n.__}function g$1(){for(var t;t=c$1.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(w$1),t.__H.__h.forEach(z$1),t.__H.__h=[];}catch(r){t.__H.__h=[],l.__e(r,t.__v);}}l.__b=function(n){"function"!=typeof n.type||n.o||n.type===p?n.o||(n.o=n.__&&n.__.o?n.__.o:""):n.o=(n.__&&n.__.o?n.__.o:"")+(n.__&&n.__.__k?n.__.__k.indexOf(n):0),u$1=null,a$1&&a$1(n);},l.__r=function(n){v$1&&v$1(n),r$1=0;var t=(u$1=n.__c).__H;t&&(i===u$1?(t.__h=[],u$1.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=e$2,n.__N=n.i=void 0;})):(t.__h.forEach(w$1),t.__h.forEach(z$1),t.__h=[])),i=u$1;},l.diffed=function(t){l$1&&l$1(t);var r=t.__c;r&&r.__H&&(r.__H.__h.length&&(1!==c$1.push(r)&&o$1===l.requestAnimationFrame||((o$1=l.requestAnimationFrame)||k$1)(g$1)),r.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==e$2&&(n.__=n.__V),n.i=void 0,n.__V=e$2;})),i=u$1=null;},l.__c=function(t,r){r.some(function(t){try{t.__h.forEach(w$1),t.__h=t.__h.filter(function(n){return !n.__||z$1(n)});}catch(u){r.some(function(n){n.__h&&(n.__h=[]);}),r=[],l.__e(u,t.__v);}}),m$2&&m$2(t,r);},l.unmount=function(t){d$1&&d$1(t);var r,u=t.__c;u&&u.__H&&(u.__H.__.forEach(function(n){try{w$1(n);}catch(n){r=n;}}),u.__H=void 0,r&&l.__e(r,u.__v));};var j$1="function"==typeof requestAnimationFrame;function k$1(n){var t,r=function(){clearTimeout(u),j$1&&cancelAnimationFrame(t),setTimeout(n);},u=setTimeout(r,100);j$1&&(t=requestAnimationFrame(r));}function w$1(n){var t=u$1,r=n.__c;"function"==typeof r&&(n.__c=void 0,r()),u$1=t;}function z$1(n){var t=u$1;n.__c=n.__(),u$1=t;}function B(n,t){return !n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function C$1(n,t){return "function"==typeof t?t(n):t}
18942
19367
 
18943
19368
  var Carousel = createCarouselComponent({
@@ -19829,11 +20254,11 @@
19829
20254
  Fragment: p
19830
20255
  });
19831
20256
 
19832
- var _excluded$j = ["classNames"];
20257
+ var _excluded$l = ["classNames"];
19833
20258
  function Highlight(_ref) {
19834
20259
  var _ref$classNames = _ref.classNames,
19835
20260
  classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
19836
- props = _objectWithoutProperties(_ref, _excluded$j);
20261
+ props = _objectWithoutProperties(_ref, _excluded$l);
19837
20262
  return h(InternalHighlight, _extends({
19838
20263
  classNames: {
19839
20264
  root: cx('ais-Highlight', classNames.root),
@@ -19844,12 +20269,12 @@
19844
20269
  }, props));
19845
20270
  }
19846
20271
 
19847
- var _excluded$k = ["hit", "attribute", "cssClasses"];
20272
+ var _excluded$m = ["hit", "attribute", "cssClasses"];
19848
20273
  function Highlight$1(_ref) {
19849
20274
  var hit = _ref.hit,
19850
20275
  attribute = _ref.attribute,
19851
20276
  cssClasses = _ref.cssClasses,
19852
- props = _objectWithoutProperties(_ref, _excluded$k);
20277
+ props = _objectWithoutProperties(_ref, _excluded$m);
19853
20278
  var property = getPropertyByPath(hit._highlightResult, attribute) || [];
19854
20279
  var properties = toArray(property);
19855
20280
  _warning(Boolean(properties.length), "Could not enable highlight for \"".concat(attribute.toString(), "\", will display an empty string.\nPlease check whether this attribute exists and is either searchable or specified in `attributesToHighlight`.\n\nSee: https://alg.li/highlighting\n")) ;
@@ -19863,11 +20288,11 @@
19863
20288
  }));
19864
20289
  }
19865
20290
 
19866
- var _excluded$l = ["classNames"];
20291
+ var _excluded$n = ["classNames"];
19867
20292
  function ReverseHighlight(_ref) {
19868
20293
  var _ref$classNames = _ref.classNames,
19869
20294
  classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
19870
- props = _objectWithoutProperties(_ref, _excluded$l);
20295
+ props = _objectWithoutProperties(_ref, _excluded$n);
19871
20296
  return h(InternalHighlight, _extends({
19872
20297
  classNames: {
19873
20298
  root: cx('ais-ReverseHighlight', classNames.root),
@@ -19878,13 +20303,13 @@
19878
20303
  }, props));
19879
20304
  }
19880
20305
 
19881
- var _excluded$m = ["hit", "attribute", "cssClasses"],
20306
+ var _excluded$o = ["hit", "attribute", "cssClasses"],
19882
20307
  _excluded2$3 = ["isHighlighted"];
19883
20308
  function ReverseHighlight$1(_ref) {
19884
20309
  var hit = _ref.hit,
19885
20310
  attribute = _ref.attribute,
19886
20311
  cssClasses = _ref.cssClasses,
19887
- props = _objectWithoutProperties(_ref, _excluded$m);
20312
+ props = _objectWithoutProperties(_ref, _excluded$o);
19888
20313
  var property = getPropertyByPath(hit._highlightResult, attribute) || [];
19889
20314
  var properties = toArray(property);
19890
20315
  _warning(Boolean(properties.length), "Could not enable highlight for \"".concat(attribute.toString(), "\", will display an empty string.\nPlease check whether this attribute exists and is either searchable or specified in `attributesToHighlight`.\n\nSee: https://alg.li/highlighting\n")) ;
@@ -19904,11 +20329,11 @@
19904
20329
  }));
19905
20330
  }
19906
20331
 
19907
- var _excluded$n = ["classNames"];
20332
+ var _excluded$p = ["classNames"];
19908
20333
  function ReverseSnippet(_ref) {
19909
20334
  var _ref$classNames = _ref.classNames,
19910
20335
  classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
19911
- props = _objectWithoutProperties(_ref, _excluded$n);
20336
+ props = _objectWithoutProperties(_ref, _excluded$p);
19912
20337
  return h(InternalHighlight, _extends({
19913
20338
  classNames: {
19914
20339
  root: cx('ais-ReverseSnippet', classNames.root),
@@ -19919,13 +20344,13 @@
19919
20344
  }, props));
19920
20345
  }
19921
20346
 
19922
- var _excluded$o = ["hit", "attribute", "cssClasses"],
20347
+ var _excluded$q = ["hit", "attribute", "cssClasses"],
19923
20348
  _excluded2$4 = ["isHighlighted"];
19924
20349
  function ReverseSnippet$1(_ref) {
19925
20350
  var hit = _ref.hit,
19926
20351
  attribute = _ref.attribute,
19927
20352
  cssClasses = _ref.cssClasses,
19928
- props = _objectWithoutProperties(_ref, _excluded$o);
20353
+ props = _objectWithoutProperties(_ref, _excluded$q);
19929
20354
  var property = getPropertyByPath(hit._snippetResult, attribute) || [];
19930
20355
  var properties = toArray(property);
19931
20356
  _warning(Boolean(properties.length), "Could not enable snippet for \"".concat(attribute.toString(), "\", will display an empty string.\nPlease check whether this attribute exists and is specified in `attributesToSnippet`.\n\nSee: https://alg.li/highlighting\n")) ;
@@ -19945,11 +20370,11 @@
19945
20370
  }));
19946
20371
  }
19947
20372
 
19948
- var _excluded$p = ["classNames"];
20373
+ var _excluded$r = ["classNames"];
19949
20374
  function Snippet(_ref) {
19950
20375
  var _ref$classNames = _ref.classNames,
19951
20376
  classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
19952
- props = _objectWithoutProperties(_ref, _excluded$p);
20377
+ props = _objectWithoutProperties(_ref, _excluded$r);
19953
20378
  return h(InternalHighlight, _extends({
19954
20379
  classNames: {
19955
20380
  root: cx('ais-Snippet', classNames.root),
@@ -19960,12 +20385,12 @@
19960
20385
  }, props));
19961
20386
  }
19962
20387
 
19963
- var _excluded$q = ["hit", "attribute", "cssClasses"];
20388
+ var _excluded$s = ["hit", "attribute", "cssClasses"];
19964
20389
  function Snippet$1(_ref) {
19965
20390
  var hit = _ref.hit,
19966
20391
  attribute = _ref.attribute,
19967
20392
  cssClasses = _ref.cssClasses,
19968
- props = _objectWithoutProperties(_ref, _excluded$q);
20393
+ props = _objectWithoutProperties(_ref, _excluded$s);
19969
20394
  var property = getPropertyByPath(hit._snippetResult, attribute) || [];
19970
20395
  var properties = toArray(property);
19971
20396
  _warning(Boolean(properties.length), "Could not enable snippet for \"".concat(attribute.toString(), "\", will display an empty string.\nPlease check whether this attribute exists and is specified in `attributesToSnippet`.\n\nSee: https://alg.li/highlighting\n")) ;
@@ -20209,7 +20634,7 @@
20209
20634
  }
20210
20635
  };
20211
20636
 
20212
- var withUsage$w = createDocumentationMessageGenerator({
20637
+ var withUsage$x = createDocumentationMessageGenerator({
20213
20638
  name: 'answers'
20214
20639
  });
20215
20640
  var suit$4 = component('Answers');
@@ -20256,7 +20681,7 @@
20256
20681
  _ref3$cssClasses = _ref3.cssClasses,
20257
20682
  userCssClasses = _ref3$cssClasses === void 0 ? {} : _ref3$cssClasses;
20258
20683
  if (!container) {
20259
- throw new Error(withUsage$w('The `container` option is required.'));
20684
+ throw new Error(withUsage$x('The `container` option is required.'));
20260
20685
  }
20261
20686
  var containerNode = getContainerNode(container);
20262
20687
  var cssClasses = {
@@ -20307,8 +20732,8 @@
20307
20732
  });
20308
20733
  };
20309
20734
 
20310
- var _excluded$r = ["container", "widgets", "fallbackWidget"];
20311
- var withUsage$x = createDocumentationMessageGenerator({
20735
+ var _excluded$t = ["container", "widgets", "fallbackWidget"];
20736
+ var withUsage$y = createDocumentationMessageGenerator({
20312
20737
  name: 'dynamic-widgets'
20313
20738
  });
20314
20739
  var suit$5 = component('DynamicWidgets');
@@ -20325,14 +20750,14 @@
20325
20750
  containerSelector = _ref.container,
20326
20751
  widgets = _ref.widgets,
20327
20752
  fallbackWidget = _ref.fallbackWidget,
20328
- otherWidgetParams = _objectWithoutProperties(_ref, _excluded$r);
20753
+ otherWidgetParams = _objectWithoutProperties(_ref, _excluded$t);
20329
20754
  if (!containerSelector) {
20330
- throw new Error(withUsage$x('The `container` option is required.'));
20755
+ throw new Error(withUsage$y('The `container` option is required.'));
20331
20756
  }
20332
20757
  if (!(widgets && Array.isArray(widgets) && widgets.every(function (widget) {
20333
20758
  return typeof widget === 'function';
20334
20759
  }))) {
20335
- throw new Error(withUsage$x('The `widgets` option expects an array of callbacks.'));
20760
+ throw new Error(withUsage$y('The `widgets` option expects an array of callbacks.'));
20336
20761
  }
20337
20762
  var userContainer = getContainerNode(containerSelector);
20338
20763
  var rootContainer = document.createElement('div');
@@ -20381,7 +20806,7 @@
20381
20806
  });
20382
20807
  };
20383
20808
 
20384
- var withUsage$y = createDocumentationMessageGenerator({
20809
+ var withUsage$z = createDocumentationMessageGenerator({
20385
20810
  name: 'analytics'
20386
20811
  });
20387
20812
  // @major this widget will be removed from the next major version.
@@ -20397,7 +20822,7 @@
20397
20822
  _ref$pushPagination = _ref.pushPagination,
20398
20823
  pushPagination = _ref$pushPagination === void 0 ? false : _ref$pushPagination;
20399
20824
  if (!pushFunction) {
20400
- throw new Error(withUsage$y('The `pushFunction` option is required.'));
20825
+ throw new Error(withUsage$z('The `pushFunction` option is required.'));
20401
20826
  }
20402
20827
  _warning(false, "`analytics` widget has been deprecated. It is still supported in 4.x releases, but not further. It is replaced by the `insights` middleware.\n\nFor the migration, visit https://www.algolia.com/doc/guides/building-search-ui/upgrade-guides/js/#analytics-widget") ;
20403
20828
  var cachedState = null;
@@ -20547,9 +20972,9 @@
20547
20972
  });
20548
20973
  };
20549
20974
 
20550
- var _excluded$s = ["instanceId", "containerNode"];
20975
+ var _excluded$u = ["instanceId", "containerNode"];
20551
20976
  var autocompleteInstanceId = 0;
20552
- var withUsage$z = createDocumentationMessageGenerator({
20977
+ var withUsage$A = createDocumentationMessageGenerator({
20553
20978
  name: 'autocomplete'
20554
20979
  });
20555
20980
  var suit$6 = component('Autocomplete');
@@ -20592,7 +21017,7 @@
20592
21017
  var createRenderer = function createRenderer(params) {
20593
21018
  var instanceId = params.instanceId,
20594
21019
  containerNode = params.containerNode,
20595
- rendererParams = _objectWithoutProperties(params, _excluded$s);
21020
+ rendererParams = _objectWithoutProperties(params, _excluded$u);
20596
21021
  return function (connectorParams, isFirstRendering) {
20597
21022
  if (isFirstRendering) {
20598
21023
  var _targetIndex$getHelpe, _targetIndex$getHelpe2;
@@ -20694,7 +21119,8 @@
20694
21119
  query: searchboxQuery,
20695
21120
  showRecent: showRecent,
20696
21121
  indices: indices,
20697
- indicesConfig: indicesConfig
21122
+ indicesConfig: indicesConfig,
21123
+ suggestionsIndexName: showSuggestions === null || showSuggestions === void 0 ? void 0 : showSuggestions.indexName
20698
21124
  }),
20699
21125
  storage = _useStorage.storage,
20700
21126
  storageHits = _useStorage.storageHits,
@@ -20778,18 +21204,24 @@
20778
21204
  });
20779
21205
  }
20780
21206
  indices.forEach(function (_ref8, i) {
20781
- var _indicesConfig$i$temp;
21207
+ var _currentIndexConfig$t;
20782
21208
  var indexId = _ref8.indexId,
20783
21209
  indexName = _ref8.indexName,
20784
21210
  hits = _ref8.hits;
21211
+ var currentIndexConfig = find(indicesConfig, function (config) {
21212
+ return config.indexName === indexName;
21213
+ });
21214
+ if (!currentIndexConfig) {
21215
+ return;
21216
+ }
20785
21217
  if (!renderState.indexTemplateProps[i]) {
20786
21218
  renderState.indexTemplateProps[i] = prepareTemplateProps({
20787
21219
  defaultTemplates: {},
20788
21220
  templatesConfig: instantSearchInstance.templatesConfig,
20789
- templates: indicesConfig[i].templates
21221
+ templates: currentIndexConfig.templates
20790
21222
  });
20791
21223
  }
20792
- var headerComponent = (_indicesConfig$i$temp = indicesConfig[i].templates) !== null && _indicesConfig$i$temp !== void 0 && _indicesConfig$i$temp.header ? function (_ref9) {
21224
+ var headerComponent = (_currentIndexConfig$t = currentIndexConfig.templates) !== null && _currentIndexConfig$t !== void 0 && _currentIndexConfig$t.header ? function (_ref9) {
20793
21225
  var items = _ref9.items;
20794
21226
  return h(Template, _extends({}, renderState.indexTemplateProps[i], {
20795
21227
  templateKey: "header",
@@ -20829,7 +21261,7 @@
20829
21261
  });
20830
21262
  }),
20831
21263
  getItemProps: getItemProps,
20832
- classNames: indicesConfig[i].cssClasses
21264
+ classNames: currentIndexConfig.cssClasses
20833
21265
  });
20834
21266
  });
20835
21267
  return h(Autocomplete, _extends({}, getRootProps(), {
@@ -20869,11 +21301,12 @@
20869
21301
  onSelect = _ref1.onSelect,
20870
21302
  _ref1$templates = _ref1.templates,
20871
21303
  templates = _ref1$templates === void 0 ? {} : _ref1$templates,
21304
+ transformItems = _ref1.transformItems,
20872
21305
  _ref1$cssClasses = _ref1.cssClasses,
20873
21306
  userCssClasses = _ref1$cssClasses === void 0 ? {} : _ref1$cssClasses,
20874
21307
  placeholder = _ref1.placeholder;
20875
21308
  if (!container) {
20876
- throw new Error(withUsage$z('The `container` option is required.'));
21309
+ throw new Error(withUsage$A('The `container` option is required.'));
20877
21310
  }
20878
21311
  var containerNode = getContainerNode(container);
20879
21312
  var searchParameters = _objectSpread2({
@@ -20953,7 +21386,8 @@
20953
21386
  indexId: indexName
20954
21387
  }).addWidgets([configure(indexSearchParameters || {})]);
20955
21388
  })), [_objectSpread2(_objectSpread2({}, makeWidget({
20956
- escapeHTML: escapeHTML
21389
+ escapeHTML: escapeHTML,
21390
+ transformItems: transformItems
20957
21391
  })), {}, {
20958
21392
  $$widgetType: 'ais.autocomplete'
20959
21393
  })]))];
@@ -21033,7 +21467,7 @@
21033
21467
  }
21034
21468
  };
21035
21469
 
21036
- var withUsage$A = createDocumentationMessageGenerator({
21470
+ var withUsage$B = createDocumentationMessageGenerator({
21037
21471
  name: 'breadcrumb'
21038
21472
  });
21039
21473
  var suit$7 = component('Breadcrumb');
@@ -21078,7 +21512,7 @@
21078
21512
  _ref3$cssClasses = _ref3.cssClasses,
21079
21513
  userCssClasses = _ref3$cssClasses === void 0 ? {} : _ref3$cssClasses;
21080
21514
  if (!container) {
21081
- throw new Error(withUsage$A('The `container` option is required.'));
21515
+ throw new Error(withUsage$B('The `container` option is required.'));
21082
21516
  }
21083
21517
  var containerNode = getContainerNode(container);
21084
21518
  var cssClasses = {
@@ -21149,7 +21583,7 @@
21149
21583
  }
21150
21584
  };
21151
21585
 
21152
- var withUsage$B = createDocumentationMessageGenerator({
21586
+ var withUsage$C = createDocumentationMessageGenerator({
21153
21587
  name: 'clear-refinements'
21154
21588
  });
21155
21589
  var suit$8 = component('ClearRefinements');
@@ -21189,7 +21623,7 @@
21189
21623
  _ref3$cssClasses = _ref3.cssClasses,
21190
21624
  userCssClasses = _ref3$cssClasses === void 0 ? {} : _ref3$cssClasses;
21191
21625
  if (!container) {
21192
- throw new Error(withUsage$B('The `container` option is required.'));
21626
+ throw new Error(withUsage$C('The `container` option is required.'));
21193
21627
  }
21194
21628
  var containerNode = getContainerNode(container);
21195
21629
  var cssClasses = {
@@ -21267,7 +21701,7 @@
21267
21701
  })));
21268
21702
  };
21269
21703
 
21270
- var withUsage$C = createDocumentationMessageGenerator({
21704
+ var withUsage$D = createDocumentationMessageGenerator({
21271
21705
  name: 'current-refinements'
21272
21706
  });
21273
21707
  var suit$9 = component('CurrentRefinements');
@@ -21296,7 +21730,7 @@
21296
21730
  userCssClasses = _ref3$cssClasses === void 0 ? {} : _ref3$cssClasses,
21297
21731
  transformItems = _ref3.transformItems;
21298
21732
  if (!container) {
21299
- throw new Error(withUsage$C('The `container` option is required.'));
21733
+ throw new Error(withUsage$D('The `container` option is required.'));
21300
21734
  }
21301
21735
  var containerNode = getContainerNode(container);
21302
21736
  var cssClasses = {
@@ -21726,10 +22160,10 @@
21726
22160
  }), container.querySelector(".".concat(cssClasses.tree)));
21727
22161
  };
21728
22162
 
21729
- var _excluded$t = ["initialZoom", "initialPosition", "templates", "cssClasses", "builtInMarker", "customHTMLMarker", "enableRefine", "enableClearMapRefinement", "enableRefineControl", "container", "googleReference"],
22163
+ var _excluded$v = ["initialZoom", "initialPosition", "templates", "cssClasses", "builtInMarker", "customHTMLMarker", "enableRefine", "enableClearMapRefinement", "enableRefineControl", "container", "googleReference"],
21730
22164
  _excluded2$5 = ["item"],
21731
22165
  _excluded3 = ["item"];
21732
- var withUsage$D = createDocumentationMessageGenerator({
22166
+ var withUsage$E = createDocumentationMessageGenerator({
21733
22167
  name: 'geo-search'
21734
22168
  });
21735
22169
  var suit$a = component('GeoSearch');
@@ -21770,7 +22204,7 @@
21770
22204
  enableRefineControl = _ref$enableRefineCont === void 0 ? true : _ref$enableRefineCont,
21771
22205
  container = _ref.container,
21772
22206
  googleReference = _ref.googleReference,
21773
- otherWidgetParams = _objectWithoutProperties(_ref, _excluded$t);
22207
+ otherWidgetParams = _objectWithoutProperties(_ref, _excluded$v);
21774
22208
  var defaultBuiltInMarker = {
21775
22209
  createOptions: function createOptions() {
21776
22210
  return {};
@@ -21784,10 +22218,10 @@
21784
22218
  events: {}
21785
22219
  };
21786
22220
  if (!container) {
21787
- throw new Error(withUsage$D('The `container` option is required.'));
22221
+ throw new Error(withUsage$E('The `container` option is required.'));
21788
22222
  }
21789
22223
  if (!googleReference) {
21790
- throw new Error(withUsage$D('The `googleReference` option is required.'));
22224
+ throw new Error(withUsage$E('The `googleReference` option is required.'));
21791
22225
  }
21792
22226
  var containerNode = getContainerNode(container);
21793
22227
  var cssClasses = {
@@ -22120,7 +22554,7 @@
22120
22554
  })), subItems);
22121
22555
  }
22122
22556
 
22123
- var _excluded$u = ["root"];
22557
+ var _excluded$w = ["root"];
22124
22558
 
22125
22559
  // CSS types
22126
22560
 
@@ -22149,7 +22583,7 @@
22149
22583
  if (isHierarchicalMenuItem(facetValue) && Array.isArray(facetValue.data) && facetValue.data.length > 0) {
22150
22584
  var _this$props$cssClasse = _this.props.cssClasses,
22151
22585
  root = _this$props$cssClasse.root,
22152
- cssClasses = _objectWithoutProperties(_this$props$cssClasse, _excluded$u);
22586
+ cssClasses = _objectWithoutProperties(_this$props$cssClasse, _excluded$w);
22153
22587
  subItems = h(RefinementList, _extends({}, _this.props, {
22154
22588
  // We want to keep `root` required for external usage but not for the
22155
22589
  // sub items.
@@ -22364,7 +22798,7 @@
22364
22798
  }
22365
22799
  };
22366
22800
 
22367
- var withUsage$E = createDocumentationMessageGenerator({
22801
+ var withUsage$F = createDocumentationMessageGenerator({
22368
22802
  name: 'hierarchical-menu'
22369
22803
  });
22370
22804
  var suit$b = component('HierarchicalMenu');
@@ -22474,7 +22908,7 @@
22474
22908
  _ref3$cssClasses = _ref3.cssClasses,
22475
22909
  userCssClasses = _ref3$cssClasses === void 0 ? {} : _ref3$cssClasses;
22476
22910
  if (!container) {
22477
- throw new Error(withUsage$E('The `container` option is required.'));
22911
+ throw new Error(withUsage$F('The `container` option is required.'));
22478
22912
  }
22479
22913
  var containerNode = getContainerNode(container);
22480
22914
  var cssClasses = {
@@ -22558,8 +22992,8 @@
22558
22992
  }
22559
22993
  };
22560
22994
 
22561
- var _excluded$v = ["hit", "index"];
22562
- var withUsage$F = createDocumentationMessageGenerator({
22995
+ var _excluded$x = ["hit", "index"];
22996
+ var withUsage$G = createDocumentationMessageGenerator({
22563
22997
  name: 'hits'
22564
22998
  });
22565
22999
  var Hits = createHitsComponent({
@@ -22606,7 +23040,7 @@
22606
23040
  var itemComponent = function itemComponent(_ref4) {
22607
23041
  var hit = _ref4.hit,
22608
23042
  index = _ref4.index,
22609
- rootProps = _objectWithoutProperties(_ref4, _excluded$v);
23043
+ rootProps = _objectWithoutProperties(_ref4, _excluded$x);
22610
23044
  return h(Template, _extends({}, renderState.templateProps, {
22611
23045
  templateKey: "item",
22612
23046
  rootTagName: "li",
@@ -22658,7 +23092,7 @@
22658
23092
  _ref5$cssClasses = _ref5.cssClasses,
22659
23093
  cssClasses = _ref5$cssClasses === void 0 ? {} : _ref5$cssClasses;
22660
23094
  if (!container) {
22661
- throw new Error(withUsage$F('The `container` option is required.'));
23095
+ throw new Error(withUsage$G('The `container` option is required.'));
22662
23096
  }
22663
23097
  var containerNode = getContainerNode(container);
22664
23098
  var specializedRenderer = renderer$6({
@@ -22700,7 +23134,7 @@
22700
23134
  }));
22701
23135
  }
22702
23136
 
22703
- var withUsage$G = createDocumentationMessageGenerator({
23137
+ var withUsage$H = createDocumentationMessageGenerator({
22704
23138
  name: 'hits-per-page'
22705
23139
  });
22706
23140
  var suit$c = component('HitsPerPage');
@@ -22736,7 +23170,7 @@
22736
23170
  userCssClasses = _ref5$cssClasses === void 0 ? {} : _ref5$cssClasses,
22737
23171
  transformItems = _ref5.transformItems;
22738
23172
  if (!container) {
22739
- throw new Error(withUsage$G('The `container` option is required.'));
23173
+ throw new Error(withUsage$H('The `container` option is required.'));
22740
23174
  }
22741
23175
  var containerNode = getContainerNode(container);
22742
23176
  var cssClasses = {
@@ -22896,7 +23330,7 @@
22896
23330
  }
22897
23331
  };
22898
23332
 
22899
- var withUsage$H = createDocumentationMessageGenerator({
23333
+ var withUsage$I = createDocumentationMessageGenerator({
22900
23334
  name: 'infinite-hits'
22901
23335
  });
22902
23336
  var suit$d = component('InfiniteHits');
@@ -22955,7 +23389,7 @@
22955
23389
  showPrevious = _ref3.showPrevious,
22956
23390
  cache = _ref3.cache;
22957
23391
  if (!container) {
22958
- throw new Error(withUsage$H('The `container` option is required.'));
23392
+ throw new Error(withUsage$I('The `container` option is required.'));
22959
23393
  }
22960
23394
  var containerNode = getContainerNode(container);
22961
23395
  var cssClasses = {
@@ -23034,7 +23468,7 @@
23034
23468
  }
23035
23469
  };
23036
23470
 
23037
- var withUsage$I = createDocumentationMessageGenerator({
23471
+ var withUsage$J = createDocumentationMessageGenerator({
23038
23472
  name: 'menu'
23039
23473
  });
23040
23474
  var suit$e = component('Menu');
@@ -23092,7 +23526,7 @@
23092
23526
  templates = _ref3$templates === void 0 ? {} : _ref3$templates,
23093
23527
  transformItems = _ref3.transformItems;
23094
23528
  if (!container) {
23095
- throw new Error(withUsage$I('The `container` option is required.'));
23529
+ throw new Error(withUsage$J('The `container` option is required.'));
23096
23530
  }
23097
23531
  var containerNode = getContainerNode(container);
23098
23532
  var cssClasses = {
@@ -23200,7 +23634,7 @@
23200
23634
  }
23201
23635
  };
23202
23636
 
23203
- var withUsage$J = createDocumentationMessageGenerator({
23637
+ var withUsage$K = createDocumentationMessageGenerator({
23204
23638
  name: 'menu-select'
23205
23639
  });
23206
23640
  var suit$f = component('MenuSelect');
@@ -23243,7 +23677,7 @@
23243
23677
  templates = _ref3$templates === void 0 ? {} : _ref3$templates,
23244
23678
  transformItems = _ref3.transformItems;
23245
23679
  if (!container) {
23246
- throw new Error(withUsage$J('The `container` option is required.'));
23680
+ throw new Error(withUsage$K('The `container` option is required.'));
23247
23681
  }
23248
23682
  var containerNode = getContainerNode(container);
23249
23683
  var cssClasses = {
@@ -23296,7 +23730,7 @@
23296
23730
  }
23297
23731
  };
23298
23732
 
23299
- var withUsage$K = createDocumentationMessageGenerator({
23733
+ var withUsage$L = createDocumentationMessageGenerator({
23300
23734
  name: 'numeric-menu'
23301
23735
  });
23302
23736
  var suit$g = component('NumericMenu');
@@ -23340,7 +23774,7 @@
23340
23774
  templates = _ref3$templates === void 0 ? {} : _ref3$templates,
23341
23775
  transformItems = _ref3.transformItems;
23342
23776
  if (!container) {
23343
- throw new Error(withUsage$K('The `container` option is required.'));
23777
+ throw new Error(withUsage$L('The `container` option is required.'));
23344
23778
  }
23345
23779
  var containerNode = getContainerNode(container);
23346
23780
  var cssClasses = {
@@ -23501,7 +23935,7 @@
23501
23935
  }
23502
23936
 
23503
23937
  var suit$h = component('Pagination');
23504
- var withUsage$L = createDocumentationMessageGenerator({
23938
+ var withUsage$M = createDocumentationMessageGenerator({
23505
23939
  name: 'pagination'
23506
23940
  });
23507
23941
  var defaultTemplates$a = {
@@ -23583,7 +24017,7 @@
23583
24017
  _ref4$scrollTo = _ref4.scrollTo,
23584
24018
  userScrollTo = _ref4$scrollTo === void 0 ? 'body' : _ref4$scrollTo;
23585
24019
  if (!container) {
23586
- throw new Error(withUsage$L('The `container` option is required.'));
24020
+ throw new Error(withUsage$M('The `container` option is required.'));
23587
24021
  }
23588
24022
  var containerNode = getContainerNode(container);
23589
24023
  var scrollTo = userScrollTo === true ? 'body' : userScrollTo;
@@ -23716,7 +24150,7 @@
23716
24150
  }));
23717
24151
  }
23718
24152
 
23719
- var withUsage$M = createDocumentationMessageGenerator({
24153
+ var withUsage$N = createDocumentationMessageGenerator({
23720
24154
  name: 'panel'
23721
24155
  });
23722
24156
  var suit$i = component('Panel');
@@ -23793,7 +24227,7 @@
23793
24227
  return function (widgetFactory) {
23794
24228
  return function (widgetParams) {
23795
24229
  if (!(widgetParams && widgetParams.container)) {
23796
- throw new Error(withUsage$M("The `container` option is required in the widget within the panel."));
24230
+ throw new Error(withUsage$N("The `container` option is required in the widget within the panel."));
23797
24231
  }
23798
24232
  var containerNode = getContainerNode(widgetParams.container);
23799
24233
  var defaultTemplates = {
@@ -23867,7 +24301,7 @@
23867
24301
  };
23868
24302
  };
23869
24303
 
23870
- var _excluded$w = ["placesReference", "defaultPosition"],
24304
+ var _excluded$y = ["placesReference", "defaultPosition"],
23871
24305
  _excluded2$6 = ["places"];
23872
24306
 
23873
24307
  /* Places.js is an optional dependency, no error should be reported if the package is missing */
@@ -23885,7 +24319,7 @@
23885
24319
  placesReference = _ref.placesReference,
23886
24320
  _ref$defaultPosition = _ref.defaultPosition,
23887
24321
  defaultPosition = _ref$defaultPosition === void 0 ? [] : _ref$defaultPosition,
23888
- placesOptions = _objectWithoutProperties(_ref, _excluded$w);
24322
+ placesOptions = _objectWithoutProperties(_ref, _excluded$y);
23889
24323
  if (typeof placesReference !== 'function') {
23890
24324
  throw new Error('The `placesReference` option requires a valid Places.js reference.');
23891
24325
  }
@@ -23998,7 +24432,7 @@
23998
24432
  };
23999
24433
 
24000
24434
  var suit$j = component('PoweredBy');
24001
- var withUsage$N = createDocumentationMessageGenerator({
24435
+ var withUsage$O = createDocumentationMessageGenerator({
24002
24436
  name: 'powered-by'
24003
24437
  });
24004
24438
  var renderer$e = function renderer(_ref) {
@@ -24027,7 +24461,7 @@
24027
24461
  _ref3$theme = _ref3.theme,
24028
24462
  theme = _ref3$theme === void 0 ? 'light' : _ref3$theme;
24029
24463
  if (!container) {
24030
- throw new Error(withUsage$N('The `container` option is required.'));
24464
+ throw new Error(withUsage$O('The `container` option is required.'));
24031
24465
  }
24032
24466
  var containerNode = getContainerNode(container);
24033
24467
  var cssClasses = {
@@ -24055,13 +24489,13 @@
24055
24489
  });
24056
24490
  };
24057
24491
 
24058
- var withUsage$O = createDocumentationMessageGenerator({
24492
+ var withUsage$P = createDocumentationMessageGenerator({
24059
24493
  name: 'query-rule-context'
24060
24494
  });
24061
24495
  var queryRuleContext = function queryRuleContext() {
24062
24496
  var widgetParams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
24063
24497
  if (!widgetParams.trackedFilters) {
24064
- throw new Error(withUsage$O('The `trackedFilters` option is required.'));
24498
+ throw new Error(withUsage$P('The `trackedFilters` option is required.'));
24065
24499
  }
24066
24500
  return _objectSpread2(_objectSpread2({}, connectQueryRules(noop)(widgetParams)), {}, {
24067
24501
  $$widgetType: 'ais.queryRuleContext'
@@ -24090,7 +24524,7 @@
24090
24524
  return JSON.stringify(items, null, 2);
24091
24525
  }
24092
24526
  };
24093
- var withUsage$P = createDocumentationMessageGenerator({
24527
+ var withUsage$Q = createDocumentationMessageGenerator({
24094
24528
  name: 'query-rule-custom-data'
24095
24529
  });
24096
24530
  var suit$k = component('QueryRuleCustomData');
@@ -24119,7 +24553,7 @@
24119
24553
  return items;
24120
24554
  } : _ref4$transformItems;
24121
24555
  if (!container) {
24122
- throw new Error(withUsage$P('The `container` option is required.'));
24556
+ throw new Error(withUsage$Q('The `container` option is required.'));
24123
24557
  }
24124
24558
  var cssClasses = {
24125
24559
  root: cx(suit$k(), userCssClasses.root)
@@ -24142,8 +24576,8 @@
24142
24576
  });
24143
24577
  };
24144
24578
 
24145
- var _excluded$x = ["item", "sendEvent"];
24146
- var withUsage$Q = createDocumentationMessageGenerator({
24579
+ var _excluded$z = ["item", "sendEvent"];
24580
+ var withUsage$R = createDocumentationMessageGenerator({
24147
24581
  name: 'related-products'
24148
24582
  });
24149
24583
  var RelatedProducts = createRelatedProductsComponent({
@@ -24181,7 +24615,7 @@
24181
24615
  var itemComponent = templates.item ? function (_ref3) {
24182
24616
  var item = _ref3.item,
24183
24617
  _sendEvent = _ref3.sendEvent,
24184
- rootProps = _objectWithoutProperties(_ref3, _excluded$x);
24618
+ rootProps = _objectWithoutProperties(_ref3, _excluded$z);
24185
24619
  return h(Template, _extends({}, renderState.templateProps, {
24186
24620
  templateKey: "item",
24187
24621
  rootTagName: "fragment",
@@ -24250,7 +24684,7 @@
24250
24684
  _ref5$cssClasses = _ref5.cssClasses,
24251
24685
  cssClasses = _ref5$cssClasses === void 0 ? {} : _ref5$cssClasses;
24252
24686
  if (!container) {
24253
- throw new Error(withUsage$Q('The `container` option is required.'));
24687
+ throw new Error(withUsage$R('The `container` option is required.'));
24254
24688
  }
24255
24689
  var containerNode = getContainerNode(container);
24256
24690
  var specializedRenderer = createRenderer$1({
@@ -24385,7 +24819,7 @@
24385
24819
  return RangeInput;
24386
24820
  }(d);
24387
24821
 
24388
- var withUsage$R = createDocumentationMessageGenerator({
24822
+ var withUsage$S = createDocumentationMessageGenerator({
24389
24823
  name: 'range-input'
24390
24824
  });
24391
24825
  var suit$l = component('RangeInput');
@@ -24450,7 +24884,7 @@
24450
24884
  _ref3$templates = _ref3.templates,
24451
24885
  templates = _ref3$templates === void 0 ? {} : _ref3$templates;
24452
24886
  if (!container) {
24453
- throw new Error(withUsage$R('The `container` option is required.'));
24887
+ throw new Error(withUsage$S('The `container` option is required.'));
24454
24888
  }
24455
24889
  var containerNode = getContainerNode(container);
24456
24890
  var cssClasses = {
@@ -25173,7 +25607,7 @@
25173
25607
  return Slider;
25174
25608
  }(d);
25175
25609
 
25176
- var withUsage$S = createDocumentationMessageGenerator({
25610
+ var withUsage$T = createDocumentationMessageGenerator({
25177
25611
  name: 'range-slider'
25178
25612
  });
25179
25613
  var suit$m = component('RangeSlider');
@@ -25242,7 +25676,7 @@
25242
25676
  _ref3$tooltips = _ref3.tooltips,
25243
25677
  tooltips = _ref3$tooltips === void 0 ? true : _ref3$tooltips;
25244
25678
  if (!container) {
25245
- throw new Error(withUsage$S('The `container` option is required.'));
25679
+ throw new Error(withUsage$T('The `container` option is required.'));
25246
25680
  }
25247
25681
  var containerNode = getContainerNode(container);
25248
25682
  var cssClasses = {
@@ -25322,7 +25756,7 @@
25322
25756
  }
25323
25757
  };
25324
25758
 
25325
- var withUsage$T = createDocumentationMessageGenerator({
25759
+ var withUsage$U = createDocumentationMessageGenerator({
25326
25760
  name: 'rating-menu'
25327
25761
  });
25328
25762
  var suit$n = component('RatingMenu');
@@ -25410,7 +25844,7 @@
25410
25844
  _ref5$templates = _ref5.templates,
25411
25845
  templates = _ref5$templates === void 0 ? {} : _ref5$templates;
25412
25846
  if (!container) {
25413
- throw new Error(withUsage$T('The `container` option is required.'));
25847
+ throw new Error(withUsage$U('The `container` option is required.'));
25414
25848
  }
25415
25849
  var containerNode = getContainerNode(container);
25416
25850
  var cssClasses = {
@@ -25570,7 +26004,7 @@
25570
26004
  }
25571
26005
  };
25572
26006
 
25573
- var withUsage$U = createDocumentationMessageGenerator({
26007
+ var withUsage$V = createDocumentationMessageGenerator({
25574
26008
  name: 'refinement-list'
25575
26009
  });
25576
26010
  var suit$o = component('RefinementList');
@@ -25674,7 +26108,7 @@
25674
26108
  templates = _ref3$templates === void 0 ? {} : _ref3$templates,
25675
26109
  transformItems = _ref3.transformItems;
25676
26110
  if (!container) {
25677
- throw new Error(withUsage$U('The `container` option is required.'));
26111
+ throw new Error(withUsage$V('The `container` option is required.'));
25678
26112
  }
25679
26113
  var escapeFacetValues = searchable ? Boolean(searchableEscapeFacetValues) : false;
25680
26114
  var containerNode = getContainerNode(container);
@@ -25826,7 +26260,7 @@
25826
26260
  }
25827
26261
  };
25828
26262
 
25829
- var withUsage$V = createDocumentationMessageGenerator({
26263
+ var withUsage$W = createDocumentationMessageGenerator({
25830
26264
  name: 'relevant-sort'
25831
26265
  });
25832
26266
  var suit$p = component('RelevantSort');
@@ -25854,7 +26288,7 @@
25854
26288
  _widgetParams$cssClas = widgetParams.cssClasses,
25855
26289
  userCssClasses = _widgetParams$cssClas === void 0 ? {} : _widgetParams$cssClas;
25856
26290
  if (!container) {
25857
- throw new Error(withUsage$V('The `container` option is required.'));
26291
+ throw new Error(withUsage$W('The `container` option is required.'));
25858
26292
  }
25859
26293
  var containerNode = getContainerNode(container);
25860
26294
  var cssClasses = {
@@ -25881,7 +26315,7 @@
25881
26315
  });
25882
26316
  };
25883
26317
 
25884
- var withUsage$W = createDocumentationMessageGenerator({
26318
+ var withUsage$X = createDocumentationMessageGenerator({
25885
26319
  name: 'search-box'
25886
26320
  });
25887
26321
  var suit$q = component('SearchBox');
@@ -25949,7 +26383,7 @@
25949
26383
  _ref3$templates = _ref3.templates,
25950
26384
  userTemplates = _ref3$templates === void 0 ? {} : _ref3$templates;
25951
26385
  if (!container) {
25952
- throw new Error(withUsage$W('The `container` option is required.'));
26386
+ throw new Error(withUsage$X('The `container` option is required.'));
25953
26387
  }
25954
26388
  var containerNode = getContainerNode(container);
25955
26389
  var cssClasses = {
@@ -26002,7 +26436,7 @@
26002
26436
  });
26003
26437
  };
26004
26438
 
26005
- var withUsage$X = createDocumentationMessageGenerator({
26439
+ var withUsage$Y = createDocumentationMessageGenerator({
26006
26440
  name: 'sort-by'
26007
26441
  });
26008
26442
  var suit$r = component('SortBy');
@@ -26040,7 +26474,7 @@
26040
26474
  userCssClasses = _ref3$cssClasses === void 0 ? {} : _ref3$cssClasses,
26041
26475
  transformItems = _ref3.transformItems;
26042
26476
  if (!container) {
26043
- throw new Error(withUsage$X('The `container` option is required.'));
26477
+ throw new Error(withUsage$Y('The `container` option is required.'));
26044
26478
  }
26045
26479
  var containerNode = getContainerNode(container);
26046
26480
  var cssClasses = {
@@ -26068,13 +26502,13 @@
26068
26502
  });
26069
26503
  };
26070
26504
 
26071
- var _excluded$y = ["nbHits", "nbSortedHits", "cssClasses", "templateProps"];
26505
+ var _excluded$A = ["nbHits", "nbSortedHits", "cssClasses", "templateProps"];
26072
26506
  var Stats = function Stats(_ref) {
26073
26507
  var nbHits = _ref.nbHits,
26074
26508
  nbSortedHits = _ref.nbSortedHits,
26075
26509
  cssClasses = _ref.cssClasses,
26076
26510
  templateProps = _ref.templateProps,
26077
- rest = _objectWithoutProperties(_ref, _excluded$y);
26511
+ rest = _objectWithoutProperties(_ref, _excluded$A);
26078
26512
  return h("div", {
26079
26513
  className: cx(cssClasses.root)
26080
26514
  }, h(Template, _extends({}, templateProps, {
@@ -26097,7 +26531,7 @@
26097
26531
  })));
26098
26532
  };
26099
26533
 
26100
- var withUsage$Y = createDocumentationMessageGenerator({
26534
+ var withUsage$Z = createDocumentationMessageGenerator({
26101
26535
  name: 'stats'
26102
26536
  });
26103
26537
  var suit$s = component('Stats');
@@ -26192,7 +26626,7 @@
26192
26626
  _ref5$templates = _ref5.templates,
26193
26627
  templates = _ref5$templates === void 0 ? {} : _ref5$templates;
26194
26628
  if (!container) {
26195
- throw new Error(withUsage$Y('The `container` option is required.'));
26629
+ throw new Error(withUsage$Z('The `container` option is required.'));
26196
26630
  }
26197
26631
  var containerNode = getContainerNode(container);
26198
26632
  var cssClasses = {
@@ -26250,7 +26684,7 @@
26250
26684
  }
26251
26685
  };
26252
26686
 
26253
- var withUsage$Z = createDocumentationMessageGenerator({
26687
+ var withUsage$_ = createDocumentationMessageGenerator({
26254
26688
  name: 'toggle-refinement'
26255
26689
  });
26256
26690
  var suit$t = component('ToggleRefinement');
@@ -26303,7 +26737,7 @@
26303
26737
  on = _ref3$on === void 0 ? true : _ref3$on,
26304
26738
  off = _ref3.off;
26305
26739
  if (!container) {
26306
- throw new Error(withUsage$Z('The `container` option is required.'));
26740
+ throw new Error(withUsage$_('The `container` option is required.'));
26307
26741
  }
26308
26742
  var containerNode = getContainerNode(container);
26309
26743
  var cssClasses = {
@@ -26336,8 +26770,8 @@
26336
26770
  });
26337
26771
  };
26338
26772
 
26339
- var _excluded$z = ["item", "sendEvent"];
26340
- var withUsage$_ = createDocumentationMessageGenerator({
26773
+ var _excluded$B = ["item", "sendEvent"];
26774
+ var withUsage$$ = createDocumentationMessageGenerator({
26341
26775
  name: 'trending-items'
26342
26776
  });
26343
26777
  var TrendingItems = createTrendingItemsComponent({
@@ -26375,7 +26809,7 @@
26375
26809
  var itemComponent = templates.item ? function (_ref3) {
26376
26810
  var item = _ref3.item,
26377
26811
  _sendEvent = _ref3.sendEvent,
26378
- rootProps = _objectWithoutProperties(_ref3, _excluded$z);
26812
+ rootProps = _objectWithoutProperties(_ref3, _excluded$B);
26379
26813
  return h(Template, _extends({}, renderState.templateProps, {
26380
26814
  templateKey: "item",
26381
26815
  rootTagName: "fragment",
@@ -26445,7 +26879,7 @@
26445
26879
  _ref5$cssClasses = _ref5.cssClasses,
26446
26880
  cssClasses = _ref5$cssClasses === void 0 ? {} : _ref5$cssClasses;
26447
26881
  if (!container) {
26448
- throw new Error(withUsage$_('The `container` option is required.'));
26882
+ throw new Error(withUsage$$('The `container` option is required.'));
26449
26883
  }
26450
26884
  var containerNode = getContainerNode(container);
26451
26885
  var specializedRenderer = createRenderer$2({
@@ -26607,7 +27041,7 @@
26607
27041
  }
26608
27042
  };
26609
27043
 
26610
- var withUsage$$ = createDocumentationMessageGenerator({
27044
+ var withUsage$10 = createDocumentationMessageGenerator({
26611
27045
  name: 'voice-search'
26612
27046
  });
26613
27047
  var suit$u = component('VoiceSearch');
@@ -26643,7 +27077,7 @@
26643
27077
  additionalQueryParameters = _ref3.additionalQueryParameters,
26644
27078
  createVoiceSearchHelper = _ref3.createVoiceSearchHelper;
26645
27079
  if (!container) {
26646
- throw new Error(withUsage$$('The `container` option is required.'));
27080
+ throw new Error(withUsage$10('The `container` option is required.'));
26647
27081
  }
26648
27082
  var containerNode = getContainerNode(container);
26649
27083
  var cssClasses = {
@@ -26677,8 +27111,8 @@
26677
27111
  });
26678
27112
  };
26679
27113
 
26680
- var _excluded$A = ["item", "sendEvent"];
26681
- var withUsage$10 = createDocumentationMessageGenerator({
27114
+ var _excluded$C = ["item", "sendEvent"];
27115
+ var withUsage$11 = createDocumentationMessageGenerator({
26682
27116
  name: 'frequently-bought-together'
26683
27117
  });
26684
27118
  var FrequentlyBoughtTogether = createFrequentlyBoughtTogetherComponent({
@@ -26716,7 +27150,7 @@
26716
27150
  var itemComponent = templates.item ? function (_ref3) {
26717
27151
  var item = _ref3.item,
26718
27152
  _sendEvent = _ref3.sendEvent,
26719
- rootProps = _objectWithoutProperties(_ref3, _excluded$A);
27153
+ rootProps = _objectWithoutProperties(_ref3, _excluded$C);
26720
27154
  return h(Template, _extends({}, renderState.templateProps, {
26721
27155
  templateKey: "item",
26722
27156
  rootTagName: "fragment",
@@ -26785,7 +27219,7 @@
26785
27219
  _ref5$cssClasses = _ref5.cssClasses,
26786
27220
  cssClasses = _ref5$cssClasses === void 0 ? {} : _ref5$cssClasses;
26787
27221
  if (!container) {
26788
- throw new Error(withUsage$10('The `container` option is required.'));
27222
+ throw new Error(withUsage$11('The `container` option is required.'));
26789
27223
  }
26790
27224
  var containerNode = getContainerNode(container);
26791
27225
  var specializedRenderer = renderer$q({
@@ -26810,8 +27244,8 @@
26810
27244
  });
26811
27245
  });
26812
27246
 
26813
- var _excluded$B = ["item", "sendEvent"];
26814
- var withUsage$11 = createDocumentationMessageGenerator({
27247
+ var _excluded$D = ["item", "sendEvent"];
27248
+ var withUsage$12 = createDocumentationMessageGenerator({
26815
27249
  name: 'looking-similar'
26816
27250
  });
26817
27251
  var LookingSimilar = createLookingSimilarComponent({
@@ -26849,7 +27283,7 @@
26849
27283
  var itemComponent = templates.item ? function (_ref3) {
26850
27284
  var item = _ref3.item,
26851
27285
  _sendEvent = _ref3.sendEvent,
26852
- rootProps = _objectWithoutProperties(_ref3, _excluded$B);
27286
+ rootProps = _objectWithoutProperties(_ref3, _excluded$D);
26853
27287
  return h(Template, _extends({}, renderState.templateProps, {
26854
27288
  templateKey: "item",
26855
27289
  rootTagName: "fragment",
@@ -26918,7 +27352,7 @@
26918
27352
  _ref5$cssClasses = _ref5.cssClasses,
26919
27353
  cssClasses = _ref5$cssClasses === void 0 ? {} : _ref5$cssClasses;
26920
27354
  if (!container) {
26921
- throw new Error(withUsage$11('The `container` option is required.'));
27355
+ throw new Error(withUsage$12('The `container` option is required.'));
26922
27356
  }
26923
27357
  var containerNode = getContainerNode(container);
26924
27358
  var specializedRenderer = createRenderer$3({
@@ -26943,6 +27377,118 @@
26943
27377
  });
26944
27378
  });
26945
27379
 
27380
+ var withUsage$13 = createDocumentationMessageGenerator({
27381
+ name: 'filter-suggestions'
27382
+ });
27383
+ var FilterSuggestions = createFilterSuggestionsComponent({
27384
+ createElement: h,
27385
+ Fragment: 'fragment'
27386
+ });
27387
+ var createRenderer$4 = function createRenderer(_ref) {
27388
+ var renderState = _ref.renderState,
27389
+ cssClasses = _ref.cssClasses,
27390
+ containerNode = _ref.containerNode,
27391
+ templates = _ref.templates,
27392
+ maxSuggestions = _ref.maxSuggestions;
27393
+ return function (props, isFirstRendering) {
27394
+ var suggestions = props.suggestions,
27395
+ isLoading = props.isLoading,
27396
+ refine = props.refine,
27397
+ instantSearchInstance = props.instantSearchInstance;
27398
+ var headerTemplate = templates.header === false ? undefined : templates.header;
27399
+ if (isFirstRendering) {
27400
+ renderState.templateProps = prepareTemplateProps({
27401
+ defaultTemplates: {},
27402
+ templatesConfig: instantSearchInstance.templatesConfig,
27403
+ templates: {
27404
+ header: headerTemplate,
27405
+ item: templates.item,
27406
+ empty: templates.empty
27407
+ }
27408
+ });
27409
+ return;
27410
+ }
27411
+ var headerComponent;
27412
+ if (templates.header === false) {
27413
+ headerComponent = false;
27414
+ } else if (headerTemplate) {
27415
+ headerComponent = function headerComponent(headerProps) {
27416
+ return h(Template, _extends({}, renderState.templateProps, {
27417
+ templateKey: "header",
27418
+ rootTagName: "div",
27419
+ data: headerProps
27420
+ }));
27421
+ };
27422
+ }
27423
+ var itemComponent = templates.item ? function (itemProps) {
27424
+ return h(Template, _extends({}, renderState.templateProps, {
27425
+ templateKey: "item",
27426
+ rootTagName: "fragment",
27427
+ data: itemProps
27428
+ }));
27429
+ } : undefined;
27430
+ var emptyComponent = templates.empty ? function (emptyProps) {
27431
+ return h(Template, _extends({}, renderState.templateProps, {
27432
+ templateKey: "empty",
27433
+ rootTagName: "div",
27434
+ data: emptyProps
27435
+ }));
27436
+ } : undefined;
27437
+ var uiProps = {
27438
+ suggestions: suggestions,
27439
+ isLoading: isLoading,
27440
+ refine: refine,
27441
+ skeletonCount: maxSuggestions,
27442
+ itemComponent: itemComponent,
27443
+ headerComponent: headerComponent,
27444
+ emptyComponent: emptyComponent
27445
+ };
27446
+ P(h(FilterSuggestions, _extends({
27447
+ classNames: cssClasses
27448
+ }, uiProps)), containerNode);
27449
+ };
27450
+ };
27451
+ var filterSuggestions = (function filterSuggestions(widgetParams) {
27452
+ var _ref2 = widgetParams || {},
27453
+ container = _ref2.container,
27454
+ _ref2$templates = _ref2.templates,
27455
+ templates = _ref2$templates === void 0 ? {} : _ref2$templates,
27456
+ _ref2$cssClasses = _ref2.cssClasses,
27457
+ cssClasses = _ref2$cssClasses === void 0 ? {} : _ref2$cssClasses,
27458
+ agentId = _ref2.agentId,
27459
+ attributes = _ref2.attributes,
27460
+ maxSuggestions = _ref2.maxSuggestions,
27461
+ debounceMs = _ref2.debounceMs,
27462
+ hitsToSample = _ref2.hitsToSample,
27463
+ transformItems = _ref2.transformItems,
27464
+ transport = _ref2.transport;
27465
+ if (!container) {
27466
+ throw new Error(withUsage$13('The `container` option is required.'));
27467
+ }
27468
+ var containerNode = getContainerNode(container);
27469
+ var specializedRenderer = createRenderer$4({
27470
+ containerNode: containerNode,
27471
+ cssClasses: cssClasses,
27472
+ renderState: {},
27473
+ templates: templates,
27474
+ maxSuggestions: maxSuggestions
27475
+ });
27476
+ var makeWidget = connectFilterSuggestions(specializedRenderer, function () {
27477
+ return P(null, containerNode);
27478
+ });
27479
+ return _objectSpread2(_objectSpread2({}, makeWidget({
27480
+ agentId: agentId,
27481
+ attributes: attributes,
27482
+ maxSuggestions: maxSuggestions,
27483
+ debounceMs: debounceMs,
27484
+ hitsToSample: hitsToSample,
27485
+ transformItems: transformItems,
27486
+ transport: transport
27487
+ })), {}, {
27488
+ $$widgetType: 'ais.filterSuggestions'
27489
+ });
27490
+ });
27491
+
26946
27492
  /** @deprecated answers is no longer supported */
26947
27493
  var EXPERIMENTAL_answers = deprecate(answers, 'answers is no longer supported');
26948
27494
 
@@ -26996,7 +27542,8 @@
26996
27542
  trendingItems: trendingItems,
26997
27543
  voiceSearch: voiceSearch,
26998
27544
  frequentlyBoughtTogether: frequentlyBoughtTogether,
26999
- lookingSimilar: lookingSimilar
27545
+ lookingSimilar: lookingSimilar,
27546
+ filterSuggestions: filterSuggestions
27000
27547
  });
27001
27548
 
27002
27549
  /**