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_modules/@algolia/events/events.js","webpack://app/./node_modules/algoliasearch-helper/index.js","webpack://app/./node_modules/algoliasearch-helper/src/DerivedHelper/index.js","webpack://app/./node_modules/algoliasearch-helper/src/SearchParameters/RefinementList.js","webpack://app/./node_modules/algoliasearch-helper/src/SearchParameters/index.js","webpack://app/./node_modules/algoliasearch-helper/src/SearchResults/generate-hierarchical-tree.js","webpack://app/./node_modules/algoliasearch-helper/src/SearchResults/index.js","webpack://app/./node_modules/algoliasearch-helper/src/algoliasearch.helper.js","webpack://app/./node_modules/algoliasearch-helper/src/functions/compact.js","webpack://app/./node_modules/algoliasearch-helper/src/functions/defaultsPure.js","webpack://app/./node_modules/algoliasearch-helper/src/functions/escapeFacetValue.js","webpack://app/./node_modules/algoliasearch-helper/src/functions/find.js","webpack://app/./node_modules/algoliasearch-helper/src/functions/findIndex.js","webpack://app/./node_modules/algoliasearch-helper/src/functions/formatSort.js","webpack://app/./node_modules/algoliasearch-helper/src/functions/inherits.js","webpack://app/./node_modules/algoliasearch-helper/src/functions/intersection.js","webpack://app/./node_modules/algoliasearch-helper/src/functions/merge.js","webpack://app/./node_modules/algoliasearch-helper/src/functions/objectHasKeys.js","webpack://app/./node_modules/algoliasearch-helper/src/functions/omit.js","webpack://app/./node_modules/algoliasearch-helper/src/functions/orderBy.js","webpack://app/./node_modules/algoliasearch-helper/src/functions/valToNumber.js","webpack://app/./node_modules/algoliasearch-helper/src/requestBuilder.js","webpack://app/./node_modules/algoliasearch-helper/src/utils/isValidUserToken.js","webpack://app/./node_modules/algoliasearch-helper/src/version.js","webpack://app/./node_modules/instantsearch.js/node_modules/qs/lib/formats.js","webpack://app/./node_modules/instantsearch.js/node_modules/qs/lib/index.js","webpack://app/./node_modules/instantsearch.js/node_modules/qs/lib/parse.js","webpack://app/./node_modules/instantsearch.js/node_modules/qs/lib/stringify.js","webpack://app/./node_modules/instantsearch.js/node_modules/qs/lib/utils.js","webpack://app/./node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js","webpack://app/./node_modules/use-sync-external-store/shim/index.js","webpack://app/./node_modules/instantsearch.js/es/lib/utils/checkRendering.js","webpack://app/./node_modules/instantsearch.js/es/lib/utils/getObjectType.js","webpack://app/./node_modules/instantsearch.js/es/lib/utils/documentation.js","webpack://app/./node_modules/instantsearch.js/es/lib/utils/escape-highlight.js","webpack://app/./node_modules/instantsearch.js/es/lib/utils/escape-html.js","webpack://app/./node_modules/instantsearch.js/es/lib/utils/getHighlightedParts.js","webpack://app/./node_modules/instantsearch.js/es/lib/utils/getPropertyByPath.js","webpack://app/./node_modules/instantsearch.js/es/lib/utils/isPlainObject.js","webpack://app/./node_modules/instantsearch.js/es/lib/utils/mergeSearchParameters.js","webpack://app/./node_modules/instantsearch.js/es/lib/utils/findIndex.js","webpack://app/./node_modules/instantsearch.js/es/lib/utils/uniq.js","webpack://app/./node_modules/instantsearch.js/es/lib/utils/noop.js","webpack://app/./node_modules/instantsearch.js/es/lib/utils/serializer.js","webpack://app/./node_modules/instantsearch.js/es/connectors/configure/connectConfigure.js","webpack://app/./node_modules/react-instantsearch-core/dist/es/components/Configure.js","webpack://app/./node_modules/react-instantsearch-core/dist/es/connectors/useConfigure.js","webpack://app/./node_modules/instantsearch.js/es/helpers/get-insights-anonymous-user-token.js","webpack://app/./node_modules/instantsearch.js/es/lib/utils/safelyRunOnBrowser.js","webpack://app/./node_modules/instantsearch.js/es/middlewares/createInsightsMiddleware.js","webpack://app/./node_modules/instantsearch.js/es/lib/utils/render-args.js","webpack://app/./node_modules/instantsearch.js/es/middlewares/createMetadataMiddleware.js","webpack://app/./node_modules/instantsearch.js/es/lib/routers/history.js","webpack://app/./node_modules/instantsearch.js/es/lib/stateMappings/simple.js","webpack://app/./node_modules/instantsearch.js/es/lib/utils/isEqual.js","webpack://app/./node_modules/instantsearch.js/es/middlewares/createRouterMiddleware.js","webpack://app/./node_modules/instantsearch.js/es/lib/utils/isIndexWidget.js","webpack://app/./node_modules/instantsearch.js/es/widgets/index/index.js","webpack://app/./node_modules/instantsearch.js/es/lib/utils/resolveSearchParameters.js","webpack://app/./node_modules/instantsearch.js/es/lib/suit.js","webpack://app/./node_modules/instantsearch.js/es/helpers/highlight.js","webpack://app/./node_modules/instantsearch.js/es/lib/utils/concatHighlightedParts.js","webpack://app/./node_modules/instantsearch.js/es/lib/utils/getHighlightFromSiblings.js","webpack://app/./node_modules/instantsearch.js/es/lib/utils/reverseHighlightedParts.js","webpack://app/./node_modules/instantsearch.js/es/helpers/reverseHighlight.js","webpack://app/./node_modules/instantsearch.js/es/helpers/snippet.js","webpack://app/./node_modules/instantsearch.js/es/helpers/reverseSnippet.js","webpack://app/./node_modules/instantsearch.js/es/helpers/insights.js","webpack://app/./node_modules/instantsearch.js/es/lib/createHelpers.js","webpack://app/./node_modules/instantsearch.js/es/lib/formatNumber.js","webpack://app/./node_modules/instantsearch.js/es/lib/utils/defer.js","webpack://app/./node_modules/instantsearch.js/es/lib/utils/setIndexHelperState.js","webpack://app/./node_modules/instantsearch.js/es/lib/InstantSearch.js","webpack://app/./node_modules/instantsearch.js/es/lib/version.js","webpack://app/./node_modules/instantsearch.js/es/lib/utils/getAppIdAndApiKey.js","webpack://app/./node_modules/instantsearch.js/es/lib/utils/find.js","webpack://app/./node_modules/react-instantsearch-core/dist/es/lib/InstantSearchSSRContext.js","webpack://app/./node_modules/react-instantsearch-core/dist/es/version.js","webpack://app/./node_modules/react-instantsearch-core/dist/es/lib/useForceUpdate.js","webpack://app/./node_modules/react-instantsearch-core/dist/es/lib/useInstantSearchApi.js","webpack://app/./node_modules/react-instantsearch-core/dist/es/lib/useInstantSearchSSRContext.js","webpack://app/./node_modules/react-instantsearch-core/dist/es/components/InstantSearch.js","webpack://app/./node_modules/instantsearch.js/es/lib/utils/createSendEventForHits.js","webpack://app/./node_modules/instantsearch.js/es/lib/utils/hits-absolute-position.js","webpack://app/./node_modules/instantsearch.js/es/lib/utils/hits-query-id.js","webpack://app/./node_modules/instantsearch.js/es/connectors/hits/connectHits.js","webpack://app/./node_modules/react-instantsearch-core/dist/es/connectors/useHits.js","webpack://app/./node_modules/react-instantsearch-core/dist/es/lib/dequal.js","webpack://app/./node_modules/react-instantsearch-core/dist/es/lib/useStableValue.js","webpack://app/./node_modules/react-instantsearch-core/dist/es/hooks/useConnector.js","webpack://app/./node_modules/react-instantsearch-core/dist/es/lib/useWidget.js","webpack://app/./node_modules/react-instantsearch-core/dist/es/lib/IndexContext.js","webpack://app/./node_modules/react-instantsearch-core/dist/es/lib/InstantSearchContext.js","webpack://app/./node_modules/react-instantsearch-core/dist/es/lib/createSearchResults.js","webpack://app/./node_modules/react-instantsearch-core/dist/es/lib/getIndexSearchResults.js","webpack://app/./node_modules/react-instantsearch-core/dist/es/lib/invariant.js","webpack://app/./node_modules/react-instantsearch-core/dist/es/lib/useIndexContext.js","webpack://app/./node_modules/react-instantsearch-core/dist/es/lib/useInstantSearchContext.js","webpack://app/./node_modules/react-instantsearch-core/dist/es/components/InstantSearchServerContext.js","webpack://app/./node_modules/react-instantsearch-core/dist/es/lib/useInstantSearchServerContext.js","webpack://app/./node_modules/react-instantsearch-core/dist/es/lib/useIsomorphicLayoutEffect.js","webpack://app/./node_modules/react-instantsearch/dist/es/ui/SearchBox.js","webpack://app/./node_modules/react-instantsearch/dist/es/ui/lib/cx.js","webpack://app/./node_modules/instantsearch.js/es/connectors/search-box/connectSearchBox.js","webpack://app/./node_modules/react-instantsearch/dist/es/widgets/SearchBox.js","webpack://app/./node_modules/react-instantsearch-core/dist/es/connectors/useSearchBox.js"],"sourcesContent":["// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nfunction EventEmitter() {\n this._events = this._events || {};\n this._maxListeners = this._maxListeners || undefined;\n}\nmodule.exports = EventEmitter;\n\n// Backwards-compat with node 0.10.x\n// EventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nEventEmitter.defaultMaxListeners = 10;\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function(n) {\n if (!isNumber(n) || n < 0 || isNaN(n))\n throw TypeError('n must be a positive number');\n this._maxListeners = n;\n return this;\n};\n\nEventEmitter.prototype.emit = function(type) {\n var er, handler, len, args, i, listeners;\n\n if (!this._events)\n this._events = {};\n\n // If there is no 'error' event listener then throw.\n if (type === 'error') {\n if (!this._events.error ||\n (isObject(this._events.error) && !this._events.error.length)) {\n er = arguments[1];\n if (er instanceof Error) {\n throw er; // Unhandled 'error' event\n } else {\n // At least give some kind of context to the user\n var err = new Error('Uncaught, unspecified \"error\" event. (' + er + ')');\n err.context = er;\n throw err;\n }\n }\n }\n\n handler = this._events[type];\n\n if (isUndefined(handler))\n return false;\n\n if (isFunction(handler)) {\n switch (arguments.length) {\n // fast cases\n case 1:\n handler.call(this);\n break;\n case 2:\n handler.call(this, arguments[1]);\n break;\n case 3:\n handler.call(this, arguments[1], arguments[2]);\n break;\n // slower\n default:\n args = Array.prototype.slice.call(arguments, 1);\n handler.apply(this, args);\n }\n } else if (isObject(handler)) {\n args = Array.prototype.slice.call(arguments, 1);\n listeners = handler.slice();\n len = listeners.length;\n for (i = 0; i < len; i++)\n listeners[i].apply(this, args);\n }\n\n return true;\n};\n\nEventEmitter.prototype.addListener = function(type, listener) {\n var m;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events)\n this._events = {};\n\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (this._events.newListener)\n this.emit('newListener', type,\n isFunction(listener.listener) ?\n listener.listener : listener);\n\n if (!this._events[type])\n // Optimize the case of one listener. Don't need the extra array object.\n this._events[type] = listener;\n else if (isObject(this._events[type]))\n // If we've already got an array, just append.\n this._events[type].push(listener);\n else\n // Adding the second element, need to change to array.\n this._events[type] = [this._events[type], listener];\n\n // Check for listener leak\n if (isObject(this._events[type]) && !this._events[type].warned) {\n if (!isUndefined(this._maxListeners)) {\n m = this._maxListeners;\n } else {\n m = EventEmitter.defaultMaxListeners;\n }\n\n if (m && m > 0 && this._events[type].length > m) {\n this._events[type].warned = true;\n console.error('(node) warning: possible EventEmitter memory ' +\n 'leak detected. %d listeners added. ' +\n 'Use emitter.setMaxListeners() to increase limit.',\n this._events[type].length);\n if (typeof console.trace === 'function') {\n // not supported in IE 10\n console.trace();\n }\n }\n }\n\n return this;\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.once = function(type, listener) {\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n var fired = false;\n\n function g() {\n this.removeListener(type, g);\n\n if (!fired) {\n fired = true;\n listener.apply(this, arguments);\n }\n }\n\n g.listener = listener;\n this.on(type, g);\n\n return this;\n};\n\n// emits a 'removeListener' event iff the listener was removed\nEventEmitter.prototype.removeListener = function(type, listener) {\n var list, position, length, i;\n\n if (!isFunction(listener))\n throw TypeError('listener must be a function');\n\n if (!this._events || !this._events[type])\n return this;\n\n list = this._events[type];\n length = list.length;\n position = -1;\n\n if (list === listener ||\n (isFunction(list.listener) && list.listener === listener)) {\n delete this._events[type];\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n\n } else if (isObject(list)) {\n for (i = length; i-- > 0;) {\n if (list[i] === listener ||\n (list[i].listener && list[i].listener === listener)) {\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (list.length === 1) {\n list.length = 0;\n delete this._events[type];\n } else {\n list.splice(position, 1);\n }\n\n if (this._events.removeListener)\n this.emit('removeListener', type, listener);\n }\n\n return this;\n};\n\nEventEmitter.prototype.removeAllListeners = function(type) {\n var key, listeners;\n\n if (!this._events)\n return this;\n\n // not listening for removeListener, no need to emit\n if (!this._events.removeListener) {\n if (arguments.length === 0)\n this._events = {};\n else if (this._events[type])\n delete this._events[type];\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n for (key in this._events) {\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = {};\n return this;\n }\n\n listeners = this._events[type];\n\n if (isFunction(listeners)) {\n this.removeListener(type, listeners);\n } else if (listeners) {\n // LIFO order\n while (listeners.length)\n this.removeListener(type, listeners[listeners.length - 1]);\n }\n delete this._events[type];\n\n return this;\n};\n\nEventEmitter.prototype.listeners = function(type) {\n var ret;\n if (!this._events || !this._events[type])\n ret = [];\n else if (isFunction(this._events[type]))\n ret = [this._events[type]];\n else\n ret = this._events[type].slice();\n return ret;\n};\n\nEventEmitter.prototype.listenerCount = function(type) {\n if (this._events) {\n var evlistener = this._events[type];\n\n if (isFunction(evlistener))\n return 1;\n else if (evlistener)\n return evlistener.length;\n }\n return 0;\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n return emitter.listenerCount(type);\n};\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\n","'use strict';\n\nvar AlgoliaSearchHelper = require('./src/algoliasearch.helper');\nvar SearchParameters = require('./src/SearchParameters');\nvar SearchResults = require('./src/SearchResults');\n\n/**\n * The algoliasearchHelper module is the function that will let its\n * contains everything needed to use the Algoliasearch\n * Helper. It is a also a function that instanciate the helper.\n * To use the helper, you also need the Algolia JS client v3.\n * @example\n * //using the UMD build\n * var client = algoliasearch('latency', '6be0576ff61c053d5f9a3225e2a90f76');\n * var helper = algoliasearchHelper(client, 'bestbuy', {\n * facets: ['shipping'],\n * disjunctiveFacets: ['category']\n * });\n * helper.on('result', function(event) {\n * console.log(event.results);\n * });\n * helper\n * .toggleFacetRefinement('category', 'Movies & TV Shows')\n * .toggleFacetRefinement('shipping', 'Free shipping')\n * .search();\n * @example\n * // The helper is an event emitter using the node API\n * helper.on('result', updateTheResults);\n * helper.once('result', updateTheResults);\n * helper.removeListener('result', updateTheResults);\n * helper.removeAllListeners('result');\n * @module algoliasearchHelper\n * @param {AlgoliaSearch} client an AlgoliaSearch client\n * @param {string} index the name of the index to query\n * @param {SearchParameters|object} opts an object defining the initial config of the search. It doesn't have to be a {SearchParameters}, just an object containing the properties you need from it.\n * @return {AlgoliaSearchHelper} The helper instance\n */\nfunction algoliasearchHelper(client, index, opts) {\n return new AlgoliaSearchHelper(client, index, opts);\n}\n\n/**\n * The version currently used\n * @member module:algoliasearchHelper.version\n * @type {number}\n */\nalgoliasearchHelper.version = require('./src/version');\n\n/**\n * Constructor for the Helper.\n * @member module:algoliasearchHelper.AlgoliaSearchHelper\n * @type {AlgoliaSearchHelper}\n */\nalgoliasearchHelper.AlgoliaSearchHelper = AlgoliaSearchHelper;\n\n/**\n * Constructor for the object containing all the parameters of the search.\n * @member module:algoliasearchHelper.SearchParameters\n * @type {SearchParameters}\n */\nalgoliasearchHelper.SearchParameters = SearchParameters;\n\n/**\n * Constructor for the object containing the results of the search.\n * @member module:algoliasearchHelper.SearchResults\n * @type {SearchResults}\n */\nalgoliasearchHelper.SearchResults = SearchResults;\n\nmodule.exports = algoliasearchHelper;\n","'use strict';\n\nvar EventEmitter = require('@algolia/events');\n\nvar inherits = require('../functions/inherits');\n\n/**\n * A DerivedHelper is a way to create sub requests to\n * Algolia from a main helper.\n * @class\n * @classdesc The DerivedHelper provides an event based interface for search callbacks:\n * - search: when a search is triggered using the `search()` method.\n * - result: when the response is retrieved from Algolia and is processed.\n * This event contains a {@link SearchResults} object and the\n * {@link SearchParameters} corresponding to this answer.\n * @param {AlgoliaSearchHelper} mainHelper the main helper\n * @param {function} fn the function to create the derived state\n */\nfunction DerivedHelper(mainHelper, fn) {\n this.main = mainHelper;\n this.fn = fn;\n this.lastResults = null;\n}\n\ninherits(DerivedHelper, EventEmitter);\n\n/**\n * Detach this helper from the main helper\n * @return {undefined}\n * @throws Error if the derived helper is already detached\n */\nDerivedHelper.prototype.detach = function () {\n this.removeAllListeners();\n this.main.detachDerivedHelper(this);\n};\n\nDerivedHelper.prototype.getModifiedState = function (parameters) {\n return this.fn(parameters);\n};\n\nmodule.exports = DerivedHelper;\n","'use strict';\n\n/**\n * Functions to manipulate refinement lists\n *\n * The RefinementList is not formally defined through a prototype but is based\n * on a specific structure.\n *\n * @module SearchParameters.refinementList\n *\n * @typedef {string[]} SearchParameters.refinementList.Refinements\n * @typedef {Object.} SearchParameters.refinementList.RefinementList\n */\n\nvar defaultsPure = require('../functions/defaultsPure');\nvar objectHasKeys = require('../functions/objectHasKeys');\nvar omit = require('../functions/omit');\n\nvar lib = {\n /**\n * Adds a refinement to a RefinementList\n * @param {RefinementList} refinementList the initial list\n * @param {string} attribute the attribute to refine\n * @param {string} value the value of the refinement, if the value is not a string it will be converted\n * @return {RefinementList} a new and updated refinement list\n */\n addRefinement: function addRefinement(refinementList, attribute, value) {\n if (lib.isRefined(refinementList, attribute, value)) {\n return refinementList;\n }\n\n var valueAsString = '' + value;\n\n var facetRefinement = !refinementList[attribute]\n ? [valueAsString]\n : refinementList[attribute].concat(valueAsString);\n\n var mod = {};\n\n mod[attribute] = facetRefinement;\n\n return defaultsPure({}, mod, refinementList);\n },\n /**\n * Removes refinement(s) for an attribute:\n * - if the value is specified removes the refinement for the value on the attribute\n * - if no value is specified removes all the refinements for this attribute\n * @param {RefinementList} refinementList the initial list\n * @param {string} attribute the attribute to refine\n * @param {string} [value] the value of the refinement\n * @return {RefinementList} a new and updated refinement lst\n */\n removeRefinement: function removeRefinement(\n refinementList,\n attribute,\n value\n ) {\n if (value === undefined) {\n // we use the \"filter\" form of clearRefinement, since it leaves empty values as-is\n // the form with a string will remove the attribute completely\n return lib.clearRefinement(refinementList, function (v, f) {\n return attribute === f;\n });\n }\n\n var valueAsString = '' + value;\n\n return lib.clearRefinement(refinementList, function (v, f) {\n return attribute === f && valueAsString === v;\n });\n },\n /**\n * Toggles the refinement value for an attribute.\n * @param {RefinementList} refinementList the initial list\n * @param {string} attribute the attribute to refine\n * @param {string} value the value of the refinement\n * @return {RefinementList} a new and updated list\n */\n toggleRefinement: function toggleRefinement(\n refinementList,\n attribute,\n value\n ) {\n if (value === undefined)\n throw new Error('toggleRefinement should be used with a value');\n\n if (lib.isRefined(refinementList, attribute, value)) {\n return lib.removeRefinement(refinementList, attribute, value);\n }\n\n return lib.addRefinement(refinementList, attribute, value);\n },\n /**\n * Clear all or parts of a RefinementList. Depending on the arguments, three\n * kinds of behavior can happen:\n * - if no attribute is provided: clears the whole list\n * - if an attribute is provided as a string: clears the list for the specific attribute\n * - if an attribute is provided as a function: discards the elements for which the function returns true\n * @param {RefinementList} refinementList the initial list\n * @param {string} [attribute] the attribute or function to discard\n * @param {string} [refinementType] optional parameter to give more context to the attribute function\n * @return {RefinementList} a new and updated refinement list\n */\n clearRefinement: function clearRefinement(\n refinementList,\n attribute,\n refinementType\n ) {\n if (attribute === undefined) {\n // return the same object if the list is already empty\n // this is mainly for tests, as it doesn't have much impact on performance\n if (!objectHasKeys(refinementList)) {\n return refinementList;\n }\n return {};\n } else if (typeof attribute === 'string') {\n return omit(refinementList, [attribute]);\n } else if (typeof attribute === 'function') {\n var hasChanged = false;\n\n var newRefinementList = Object.keys(refinementList).reduce(function (\n memo,\n key\n ) {\n var values = refinementList[key] || [];\n var facetList = values.filter(function (value) {\n return !attribute(value, key, refinementType);\n });\n\n if (facetList.length !== values.length) {\n hasChanged = true;\n }\n\n memo[key] = facetList;\n\n return memo;\n },\n {});\n\n if (hasChanged) return newRefinementList;\n return refinementList;\n }\n\n // We return nothing if the attribute is not undefined, a string or a function,\n // as it is not a valid value for a refinement\n return undefined;\n },\n /**\n * Test if the refinement value is used for the attribute. If no refinement value\n * is provided, test if the refinementList contains any refinement for the\n * given attribute.\n * @param {RefinementList} refinementList the list of refinement\n * @param {string} attribute name of the attribute\n * @param {string} [refinementValue] value of the filter/refinement\n * @return {boolean} true if the attribute is refined, false otherwise\n */\n isRefined: function isRefined(refinementList, attribute, refinementValue) {\n var containsRefinements =\n Boolean(refinementList[attribute]) &&\n refinementList[attribute].length > 0;\n\n if (refinementValue === undefined || !containsRefinements) {\n return containsRefinements;\n }\n\n var refinementValueAsString = '' + refinementValue;\n\n return refinementList[attribute].indexOf(refinementValueAsString) !== -1;\n },\n};\n\nmodule.exports = lib;\n","'use strict';\n\nvar defaultsPure = require('../functions/defaultsPure');\nvar find = require('../functions/find');\nvar intersection = require('../functions/intersection');\nvar merge = require('../functions/merge');\nvar objectHasKeys = require('../functions/objectHasKeys');\nvar omit = require('../functions/omit');\nvar valToNumber = require('../functions/valToNumber');\nvar isValidUserToken = require('../utils/isValidUserToken');\n\nvar RefinementList = require('./RefinementList');\n\n/**\n * isEqual, but only for numeric refinement values, possible values:\n * - 5\n * - [5]\n * - [[5]]\n * - [[5,5],[4]]\n * @param {any} a numeric refinement value\n * @param {any} b numeric refinement value\n * @return {boolean} true if the values are equal\n */\nfunction isEqualNumericRefinement(a, b) {\n if (Array.isArray(a) && Array.isArray(b)) {\n return (\n a.length === b.length &&\n a.every(function (el, i) {\n return isEqualNumericRefinement(b[i], el);\n })\n );\n }\n return a === b;\n}\n\n/**\n * like _.find but using deep equality to be able to use it\n * to find arrays.\n * @private\n * @param {any[]} array array to search into (elements are base or array of base)\n * @param {any} searchedValue the value we're looking for (base or array of base)\n * @return {any} the searched value or undefined\n */\nfunction findArray(array, searchedValue) {\n return find(array, function (currentValue) {\n return isEqualNumericRefinement(currentValue, searchedValue);\n });\n}\n\n/**\n * The facet list is the structure used to store the list of values used to\n * filter a single attribute.\n * @typedef {string[]} SearchParameters.FacetList\n */\n\n/**\n * Structure to store numeric filters with the operator as the key. The supported operators\n * are `=`, `>`, `<`, `>=`, `<=` and `!=`.\n * @typedef {Object.>} SearchParameters.OperatorList\n */\n\n/**\n * SearchParameters is the data structure that contains all the information\n * usable for making a search to Algolia API. It doesn't do the search itself,\n * nor does it contains logic about the parameters.\n * It is an immutable object, therefore it has been created in a way that each\n * changes does not change the object itself but returns a copy with the\n * modification.\n * This object should probably not be instantiated outside of the helper. It will\n * be provided when needed. This object is documented for reference as you'll\n * get it from events generated by the {@link AlgoliaSearchHelper}.\n * If need be, instantiate the Helper from the factory function {@link SearchParameters.make}\n * @constructor\n * @classdesc contains all the parameters of a search\n * @param {object|SearchParameters} newParameters existing parameters or partial object\n * for the properties of a new SearchParameters\n * @see SearchParameters.make\n * @example SearchParameters of the first query in\n * the instant search demo\n{\n \"query\": \"\",\n \"disjunctiveFacets\": [\n \"customerReviewCount\",\n \"category\",\n \"salePrice_range\",\n \"manufacturer\"\n ],\n \"maxValuesPerFacet\": 30,\n \"page\": 0,\n \"hitsPerPage\": 10,\n \"facets\": [\n \"type\",\n \"shipping\"\n ]\n}\n */\nfunction SearchParameters(newParameters) {\n var params = newParameters\n ? SearchParameters._parseNumbers(newParameters)\n : {};\n\n if (params.userToken !== undefined && !isValidUserToken(params.userToken)) {\n // eslint-disable-next-line no-console\n console.warn(\n '[algoliasearch-helper] The `userToken` parameter is invalid. This can lead to wrong analytics.\\n - Format: [a-zA-Z0-9_-]{1,64}'\n );\n }\n /**\n * This attribute contains the list of all the conjunctive facets\n * used. This list will be added to requested facets in the\n * [facets attribute](https://www.algolia.com/doc/rest-api/search#param-facets) sent to algolia.\n * @member {string[]}\n */\n this.facets = params.facets || [];\n /**\n * This attribute contains the list of all the disjunctive facets\n * used. This list will be added to requested facets in the\n * [facets attribute](https://www.algolia.com/doc/rest-api/search#param-facets) sent to algolia.\n * @member {string[]}\n */\n this.disjunctiveFacets = params.disjunctiveFacets || [];\n /**\n * This attribute contains the list of all the hierarchical facets\n * used. This list will be added to requested facets in the\n * [facets attribute](https://www.algolia.com/doc/rest-api/search#param-facets) sent to algolia.\n * Hierarchical facets are a sub type of disjunctive facets that\n * let you filter faceted attributes hierarchically.\n * @member {string[]|object[]}\n */\n this.hierarchicalFacets = params.hierarchicalFacets || [];\n\n // Refinements\n /**\n * This attribute contains all the filters that need to be\n * applied on the conjunctive facets. Each facet must be properly\n * defined in the `facets` attribute.\n *\n * The key is the name of the facet, and the `FacetList` contains all\n * filters selected for the associated facet name.\n *\n * When querying algolia, the values stored in this attribute will\n * be translated into the `facetFilters` attribute.\n * @member {Object.}\n */\n this.facetsRefinements = params.facetsRefinements || {};\n /**\n * This attribute contains all the filters that need to be\n * excluded from the conjunctive facets. Each facet must be properly\n * defined in the `facets` attribute.\n *\n * The key is the name of the facet, and the `FacetList` contains all\n * filters excluded for the associated facet name.\n *\n * When querying algolia, the values stored in this attribute will\n * be translated into the `facetFilters` attribute.\n * @member {Object.}\n */\n this.facetsExcludes = params.facetsExcludes || {};\n /**\n * This attribute contains all the filters that need to be\n * applied on the disjunctive facets. Each facet must be properly\n * defined in the `disjunctiveFacets` attribute.\n *\n * The key is the name of the facet, and the `FacetList` contains all\n * filters selected for the associated facet name.\n *\n * When querying algolia, the values stored in this attribute will\n * be translated into the `facetFilters` attribute.\n * @member {Object.}\n */\n this.disjunctiveFacetsRefinements = params.disjunctiveFacetsRefinements || {};\n /**\n * This attribute contains all the filters that need to be\n * applied on the numeric attributes.\n *\n * The key is the name of the attribute, and the value is the\n * filters to apply to this attribute.\n *\n * When querying algolia, the values stored in this attribute will\n * be translated into the `numericFilters` attribute.\n * @member {Object.}\n */\n this.numericRefinements = params.numericRefinements || {};\n /**\n * This attribute contains all the tags used to refine the query.\n *\n * When querying algolia, the values stored in this attribute will\n * be translated into the `tagFilters` attribute.\n * @member {string[]}\n */\n this.tagRefinements = params.tagRefinements || [];\n /**\n * This attribute contains all the filters that need to be\n * applied on the hierarchical facets. Each facet must be properly\n * defined in the `hierarchicalFacets` attribute.\n *\n * The key is the name of the facet, and the `FacetList` contains all\n * filters selected for the associated facet name. The FacetList values\n * are structured as a string that contain the values for each level\n * separated by the configured separator.\n *\n * When querying algolia, the values stored in this attribute will\n * be translated into the `facetFilters` attribute.\n * @member {Object.}\n */\n this.hierarchicalFacetsRefinements =\n params.hierarchicalFacetsRefinements || {};\n\n // eslint-disable-next-line consistent-this\n var self = this;\n Object.keys(params).forEach(function (paramName) {\n var isKeyKnown = SearchParameters.PARAMETERS.indexOf(paramName) !== -1;\n var isValueDefined = params[paramName] !== undefined;\n\n if (!isKeyKnown && isValueDefined) {\n self[paramName] = params[paramName];\n }\n });\n}\n\n/**\n * List all the properties in SearchParameters and therefore all the known Algolia properties\n * This doesn't contain any beta/hidden features.\n * @private\n */\nSearchParameters.PARAMETERS = Object.keys(new SearchParameters());\n\n/**\n * @private\n * @param {object} partialState full or part of a state\n * @return {object} a new object with the number keys as number\n */\nSearchParameters._parseNumbers = function (partialState) {\n // Do not parse numbers again in SearchParameters, they ought to be parsed already\n if (partialState instanceof SearchParameters) return partialState;\n\n var numbers = {};\n\n var numberKeys = [\n 'aroundPrecision',\n 'aroundRadius',\n 'getRankingInfo',\n 'minWordSizefor2Typos',\n 'minWordSizefor1Typo',\n 'page',\n 'maxValuesPerFacet',\n 'distinct',\n 'minimumAroundRadius',\n 'hitsPerPage',\n 'minProximity',\n ];\n\n numberKeys.forEach(function (k) {\n var value = partialState[k];\n if (typeof value === 'string') {\n var parsedValue = parseFloat(value);\n // global isNaN is ok to use here, value is only number or NaN\n numbers[k] = isNaN(parsedValue) ? value : parsedValue;\n }\n });\n\n // there's two formats of insideBoundingBox, we need to parse\n // the one which is an array of float geo rectangles\n if (Array.isArray(partialState.insideBoundingBox)) {\n numbers.insideBoundingBox = partialState.insideBoundingBox.map(function (\n geoRect\n ) {\n if (Array.isArray(geoRect)) {\n return geoRect.map(function (value) {\n return parseFloat(value);\n });\n }\n return geoRect;\n });\n }\n\n if (partialState.numericRefinements) {\n var numericRefinements = {};\n Object.keys(partialState.numericRefinements).forEach(function (attribute) {\n var operators = partialState.numericRefinements[attribute] || {};\n numericRefinements[attribute] = {};\n Object.keys(operators).forEach(function (operator) {\n var values = operators[operator];\n var parsedValues = values.map(function (v) {\n if (Array.isArray(v)) {\n return v.map(function (vPrime) {\n if (typeof vPrime === 'string') {\n return parseFloat(vPrime);\n }\n return vPrime;\n });\n } else if (typeof v === 'string') {\n return parseFloat(v);\n }\n return v;\n });\n numericRefinements[attribute][operator] = parsedValues;\n });\n });\n numbers.numericRefinements = numericRefinements;\n }\n\n return merge({}, partialState, numbers);\n};\n\n/**\n * Factory for SearchParameters\n * @param {object|SearchParameters} newParameters existing parameters or partial\n * object for the properties of a new SearchParameters\n * @return {SearchParameters} frozen instance of SearchParameters\n */\nSearchParameters.make = function makeSearchParameters(newParameters) {\n var instance = new SearchParameters(newParameters);\n\n var hierarchicalFacets = newParameters.hierarchicalFacets || [];\n hierarchicalFacets.forEach(function (facet) {\n if (facet.rootPath) {\n var currentRefinement = instance.getHierarchicalRefinement(facet.name);\n\n if (\n currentRefinement.length > 0 &&\n currentRefinement[0].indexOf(facet.rootPath) !== 0\n ) {\n instance = instance.clearRefinements(facet.name);\n }\n\n // get it again in case it has been cleared\n currentRefinement = instance.getHierarchicalRefinement(facet.name);\n if (currentRefinement.length === 0) {\n instance = instance.toggleHierarchicalFacetRefinement(\n facet.name,\n facet.rootPath\n );\n }\n }\n });\n\n return instance;\n};\n\n/**\n * Validates the new parameters based on the previous state\n * @param {SearchParameters} currentState the current state\n * @param {object|SearchParameters} parameters the new parameters to set\n * @return {Error|null} Error if the modification is invalid, null otherwise\n */\nSearchParameters.validate = function (currentState, parameters) {\n var params = parameters || {};\n\n if (\n currentState.tagFilters &&\n params.tagRefinements &&\n params.tagRefinements.length > 0\n ) {\n return new Error(\n '[Tags] Cannot switch from the managed tag API to the advanced API. It is probably ' +\n 'an error, if it is really what you want, you should first clear the tags with clearTags method.'\n );\n }\n\n if (currentState.tagRefinements.length > 0 && params.tagFilters) {\n return new Error(\n '[Tags] Cannot switch from the advanced tag API to the managed API. It is probably ' +\n 'an error, if it is not, you should first clear the tags with clearTags method.'\n );\n }\n\n if (\n currentState.numericFilters &&\n params.numericRefinements &&\n objectHasKeys(params.numericRefinements)\n ) {\n return new Error(\n \"[Numeric filters] Can't switch from the advanced to the managed API. It\" +\n ' is probably an error, if this is really what you want, you have to first' +\n ' clear the numeric filters.'\n );\n }\n\n if (objectHasKeys(currentState.numericRefinements) && params.numericFilters) {\n return new Error(\n \"[Numeric filters] Can't switch from the managed API to the advanced. It\" +\n ' is probably an error, if this is really what you want, you have to first' +\n ' clear the numeric filters.'\n );\n }\n\n return null;\n};\n\nSearchParameters.prototype = {\n constructor: SearchParameters,\n\n /**\n * Remove all refinements (disjunctive + conjunctive + excludes + numeric filters)\n * @method\n * @param {undefined|string|SearchParameters.clearCallback} [attribute] optional string or function\n * - If not given, means to clear all the filters.\n * - If `string`, means to clear all refinements for the `attribute` named filter.\n * - If `function`, means to clear all the refinements that return truthy values.\n * @return {SearchParameters} new instance with filters cleared\n */\n clearRefinements: function clearRefinements(attribute) {\n var patch = {\n numericRefinements: this._clearNumericRefinements(attribute),\n facetsRefinements: RefinementList.clearRefinement(\n this.facetsRefinements,\n attribute,\n 'conjunctiveFacet'\n ),\n facetsExcludes: RefinementList.clearRefinement(\n this.facetsExcludes,\n attribute,\n 'exclude'\n ),\n disjunctiveFacetsRefinements: RefinementList.clearRefinement(\n this.disjunctiveFacetsRefinements,\n attribute,\n 'disjunctiveFacet'\n ),\n hierarchicalFacetsRefinements: RefinementList.clearRefinement(\n this.hierarchicalFacetsRefinements,\n attribute,\n 'hierarchicalFacet'\n ),\n };\n if (\n patch.numericRefinements === this.numericRefinements &&\n patch.facetsRefinements === this.facetsRefinements &&\n patch.facetsExcludes === this.facetsExcludes &&\n patch.disjunctiveFacetsRefinements ===\n this.disjunctiveFacetsRefinements &&\n patch.hierarchicalFacetsRefinements === this.hierarchicalFacetsRefinements\n ) {\n return this;\n }\n return this.setQueryParameters(patch);\n },\n /**\n * Remove all the refined tags from the SearchParameters\n * @method\n * @return {SearchParameters} new instance with tags cleared\n */\n clearTags: function clearTags() {\n if (this.tagFilters === undefined && this.tagRefinements.length === 0)\n return this;\n\n return this.setQueryParameters({\n tagFilters: undefined,\n tagRefinements: [],\n });\n },\n /**\n * Set the index.\n * @method\n * @param {string} index the index name\n * @return {SearchParameters} new instance\n */\n setIndex: function setIndex(index) {\n if (index === this.index) return this;\n\n return this.setQueryParameters({\n index: index,\n });\n },\n /**\n * Query setter\n * @method\n * @param {string} newQuery value for the new query\n * @return {SearchParameters} new instance\n */\n setQuery: function setQuery(newQuery) {\n if (newQuery === this.query) return this;\n\n return this.setQueryParameters({\n query: newQuery,\n });\n },\n /**\n * Page setter\n * @method\n * @param {number} newPage new page number\n * @return {SearchParameters} new instance\n */\n setPage: function setPage(newPage) {\n if (newPage === this.page) return this;\n\n return this.setQueryParameters({\n page: newPage,\n });\n },\n /**\n * Facets setter\n * The facets are the simple facets, used for conjunctive (and) faceting.\n * @method\n * @param {string[]} facets all the attributes of the algolia records used for conjunctive faceting\n * @return {SearchParameters} new instance\n */\n setFacets: function setFacets(facets) {\n return this.setQueryParameters({\n facets: facets,\n });\n },\n /**\n * Disjunctive facets setter\n * Change the list of disjunctive (or) facets the helper chan handle.\n * @method\n * @param {string[]} facets all the attributes of the algolia records used for disjunctive faceting\n * @return {SearchParameters} new instance\n */\n setDisjunctiveFacets: function setDisjunctiveFacets(facets) {\n return this.setQueryParameters({\n disjunctiveFacets: facets,\n });\n },\n /**\n * HitsPerPage setter\n * Hits per page represents the number of hits retrieved for this query\n * @method\n * @param {number} n number of hits retrieved per page of results\n * @return {SearchParameters} new instance\n */\n setHitsPerPage: function setHitsPerPage(n) {\n if (this.hitsPerPage === n) return this;\n\n return this.setQueryParameters({\n hitsPerPage: n,\n });\n },\n /**\n * typoTolerance setter\n * Set the value of typoTolerance\n * @method\n * @param {string} typoTolerance new value of typoTolerance (\"true\", \"false\", \"min\" or \"strict\")\n * @return {SearchParameters} new instance\n */\n setTypoTolerance: function setTypoTolerance(typoTolerance) {\n if (this.typoTolerance === typoTolerance) return this;\n\n return this.setQueryParameters({\n typoTolerance: typoTolerance,\n });\n },\n /**\n * Add a numeric filter for a given attribute\n * When value is an array, they are combined with OR\n * When value is a single value, it will combined with AND\n * @method\n * @param {string} attribute attribute to set the filter on\n * @param {string} operator operator of the filter (possible values: =, >, >=, <, <=, !=)\n * @param {number | number[]} value value of the filter\n * @return {SearchParameters} new instance\n * @example\n * // for price = 50 or 40\n * state.addNumericRefinement('price', '=', [50, 40]);\n * @example\n * // for size = 38 and 40\n * state.addNumericRefinement('size', '=', 38);\n * state.addNumericRefinement('size', '=', 40);\n */\n addNumericRefinement: function (attribute, operator, value) {\n var val = valToNumber(value);\n\n if (this.isNumericRefined(attribute, operator, val)) return this;\n\n var mod = merge({}, this.numericRefinements);\n\n mod[attribute] = merge({}, mod[attribute]);\n\n if (mod[attribute][operator]) {\n // Array copy\n mod[attribute][operator] = mod[attribute][operator].slice();\n // Add the element. Concat can't be used here because value can be an array.\n mod[attribute][operator].push(val);\n } else {\n mod[attribute][operator] = [val];\n }\n\n return this.setQueryParameters({\n numericRefinements: mod,\n });\n },\n /**\n * Get the list of conjunctive refinements for a single facet\n * @param {string} facetName name of the attribute used for faceting\n * @return {string[]} list of refinements\n */\n getConjunctiveRefinements: function (facetName) {\n if (!this.isConjunctiveFacet(facetName)) {\n return [];\n }\n return this.facetsRefinements[facetName] || [];\n },\n /**\n * Get the list of disjunctive refinements for a single facet\n * @param {string} facetName name of the attribute used for faceting\n * @return {string[]} list of refinements\n */\n getDisjunctiveRefinements: function (facetName) {\n if (!this.isDisjunctiveFacet(facetName)) {\n return [];\n }\n return this.disjunctiveFacetsRefinements[facetName] || [];\n },\n /**\n * Get the list of hierarchical refinements for a single facet\n * @param {string} facetName name of the attribute used for faceting\n * @return {string[]} list of refinements\n */\n getHierarchicalRefinement: function (facetName) {\n // we send an array but we currently do not support multiple\n // hierarchicalRefinements for a hierarchicalFacet\n return this.hierarchicalFacetsRefinements[facetName] || [];\n },\n /**\n * Get the list of exclude refinements for a single facet\n * @param {string} facetName name of the attribute used for faceting\n * @return {string[]} list of refinements\n */\n getExcludeRefinements: function (facetName) {\n if (!this.isConjunctiveFacet(facetName)) {\n return [];\n }\n return this.facetsExcludes[facetName] || [];\n },\n\n /**\n * Remove all the numeric filter for a given (attribute, operator)\n * @method\n * @param {string} attribute attribute to set the filter on\n * @param {string} [operator] operator of the filter (possible values: =, >, >=, <, <=, !=)\n * @param {number} [number] the value to be removed\n * @return {SearchParameters} new instance\n */\n removeNumericRefinement: function (attribute, operator, number) {\n var paramValue = number;\n if (paramValue !== undefined) {\n if (!this.isNumericRefined(attribute, operator, paramValue)) {\n return this;\n }\n return this.setQueryParameters({\n numericRefinements: this._clearNumericRefinements(function (\n value,\n key\n ) {\n return (\n key === attribute &&\n value.op === operator &&\n isEqualNumericRefinement(value.val, valToNumber(paramValue))\n );\n }),\n });\n } else if (operator !== undefined) {\n if (!this.isNumericRefined(attribute, operator)) return this;\n return this.setQueryParameters({\n numericRefinements: this._clearNumericRefinements(function (\n value,\n key\n ) {\n return key === attribute && value.op === operator;\n }),\n });\n }\n\n if (!this.isNumericRefined(attribute)) return this;\n return this.setQueryParameters({\n numericRefinements: this._clearNumericRefinements(function (value, key) {\n return key === attribute;\n }),\n });\n },\n /**\n * Get the list of numeric refinements for a single facet\n * @param {string} facetName name of the attribute used for faceting\n * @return {SearchParameters.OperatorList} list of refinements\n */\n getNumericRefinements: function (facetName) {\n return this.numericRefinements[facetName] || {};\n },\n /**\n * Return the current refinement for the (attribute, operator)\n * @param {string} attribute attribute in the record\n * @param {string} operator operator applied on the refined values\n * @return {Array.} refined values\n */\n getNumericRefinement: function (attribute, operator) {\n return (\n this.numericRefinements[attribute] &&\n this.numericRefinements[attribute][operator]\n );\n },\n /**\n * Clear numeric filters.\n * @method\n * @private\n * @param {string|SearchParameters.clearCallback} [attribute] optional string or function\n * - If not given, means to clear all the filters.\n * - If `string`, means to clear all refinements for the `attribute` named filter.\n * - If `function`, means to clear all the refinements that return truthy values.\n * @return {Object.} new numeric refinements\n */\n _clearNumericRefinements: function _clearNumericRefinements(attribute) {\n if (attribute === undefined) {\n if (!objectHasKeys(this.numericRefinements)) {\n return this.numericRefinements;\n }\n return {};\n } else if (typeof attribute === 'string') {\n return omit(this.numericRefinements, [attribute]);\n } else if (typeof attribute === 'function') {\n var hasChanged = false;\n var numericRefinements = this.numericRefinements;\n var newNumericRefinements = Object.keys(numericRefinements).reduce(\n function (memo, key) {\n var operators = numericRefinements[key];\n var operatorList = {};\n\n operators = operators || {};\n Object.keys(operators).forEach(function (operator) {\n var values = operators[operator] || [];\n var outValues = [];\n values.forEach(function (value) {\n var predicateResult = attribute(\n { val: value, op: operator },\n key,\n 'numeric'\n );\n if (!predicateResult) outValues.push(value);\n });\n if (outValues.length !== values.length) {\n hasChanged = true;\n }\n operatorList[operator] = outValues;\n });\n\n memo[key] = operatorList;\n\n return memo;\n },\n {}\n );\n\n if (hasChanged) return newNumericRefinements;\n return this.numericRefinements;\n }\n\n // We return nothing if the attribute is not undefined, a string or a function,\n // as it is not a valid value for a refinement\n return undefined;\n },\n /**\n * Add a facet to the facets attribute of the helper configuration, if it\n * isn't already present.\n * @method\n * @param {string} facet facet name to add\n * @return {SearchParameters} new instance\n */\n addFacet: function addFacet(facet) {\n if (this.isConjunctiveFacet(facet)) {\n return this;\n }\n\n return this.setQueryParameters({\n facets: this.facets.concat([facet]),\n });\n },\n /**\n * Add a disjunctive facet to the disjunctiveFacets attribute of the helper\n * configuration, if it isn't already present.\n * @method\n * @param {string} facet disjunctive facet name to add\n * @return {SearchParameters} new instance\n */\n addDisjunctiveFacet: function addDisjunctiveFacet(facet) {\n if (this.isDisjunctiveFacet(facet)) {\n return this;\n }\n\n return this.setQueryParameters({\n disjunctiveFacets: this.disjunctiveFacets.concat([facet]),\n });\n },\n /**\n * Add a hierarchical facet to the hierarchicalFacets attribute of the helper\n * configuration.\n * @method\n * @param {object} hierarchicalFacet hierarchical facet to add\n * @return {SearchParameters} new instance\n * @throws will throw an error if a hierarchical facet with the same name was already declared\n */\n addHierarchicalFacet: function addHierarchicalFacet(hierarchicalFacet) {\n if (this.isHierarchicalFacet(hierarchicalFacet.name)) {\n throw new Error(\n 'Cannot declare two hierarchical facets with the same name: `' +\n hierarchicalFacet.name +\n '`'\n );\n }\n\n return this.setQueryParameters({\n hierarchicalFacets: this.hierarchicalFacets.concat([hierarchicalFacet]),\n });\n },\n /**\n * Add a refinement on a \"normal\" facet\n * @method\n * @param {string} facet attribute to apply the faceting on\n * @param {string} value value of the attribute (will be converted to string)\n * @return {SearchParameters} new instance\n */\n addFacetRefinement: function addFacetRefinement(facet, value) {\n if (!this.isConjunctiveFacet(facet)) {\n throw new Error(\n facet +\n ' is not defined in the facets attribute of the helper configuration'\n );\n }\n if (RefinementList.isRefined(this.facetsRefinements, facet, value))\n return this;\n\n return this.setQueryParameters({\n facetsRefinements: RefinementList.addRefinement(\n this.facetsRefinements,\n facet,\n value\n ),\n });\n },\n /**\n * Exclude a value from a \"normal\" facet\n * @method\n * @param {string} facet attribute to apply the exclusion on\n * @param {string} value value of the attribute (will be converted to string)\n * @return {SearchParameters} new instance\n */\n addExcludeRefinement: function addExcludeRefinement(facet, value) {\n if (!this.isConjunctiveFacet(facet)) {\n throw new Error(\n facet +\n ' is not defined in the facets attribute of the helper configuration'\n );\n }\n if (RefinementList.isRefined(this.facetsExcludes, facet, value))\n return this;\n\n return this.setQueryParameters({\n facetsExcludes: RefinementList.addRefinement(\n this.facetsExcludes,\n facet,\n value\n ),\n });\n },\n /**\n * Adds a refinement on a disjunctive facet.\n * @method\n * @param {string} facet attribute to apply the faceting on\n * @param {string} value value of the attribute (will be converted to string)\n * @return {SearchParameters} new instance\n */\n addDisjunctiveFacetRefinement: function addDisjunctiveFacetRefinement(\n facet,\n value\n ) {\n if (!this.isDisjunctiveFacet(facet)) {\n throw new Error(\n facet +\n ' is not defined in the disjunctiveFacets attribute of the helper configuration'\n );\n }\n\n if (\n RefinementList.isRefined(this.disjunctiveFacetsRefinements, facet, value)\n )\n return this;\n\n return this.setQueryParameters({\n disjunctiveFacetsRefinements: RefinementList.addRefinement(\n this.disjunctiveFacetsRefinements,\n facet,\n value\n ),\n });\n },\n /**\n * addTagRefinement adds a tag to the list used to filter the results\n * @param {string} tag tag to be added\n * @return {SearchParameters} new instance\n */\n addTagRefinement: function addTagRefinement(tag) {\n if (this.isTagRefined(tag)) return this;\n\n var modification = {\n tagRefinements: this.tagRefinements.concat(tag),\n };\n\n return this.setQueryParameters(modification);\n },\n /**\n * Remove a facet from the facets attribute of the helper configuration, if it\n * is present.\n * @method\n * @param {string} facet facet name to remove\n * @return {SearchParameters} new instance\n */\n removeFacet: function removeFacet(facet) {\n if (!this.isConjunctiveFacet(facet)) {\n return this;\n }\n\n return this.clearRefinements(facet).setQueryParameters({\n facets: this.facets.filter(function (f) {\n return f !== facet;\n }),\n });\n },\n /**\n * Remove a disjunctive facet from the disjunctiveFacets attribute of the\n * helper configuration, if it is present.\n * @method\n * @param {string} facet disjunctive facet name to remove\n * @return {SearchParameters} new instance\n */\n removeDisjunctiveFacet: function removeDisjunctiveFacet(facet) {\n if (!this.isDisjunctiveFacet(facet)) {\n return this;\n }\n\n return this.clearRefinements(facet).setQueryParameters({\n disjunctiveFacets: this.disjunctiveFacets.filter(function (f) {\n return f !== facet;\n }),\n });\n },\n /**\n * Remove a hierarchical facet from the hierarchicalFacets attribute of the\n * helper configuration, if it is present.\n * @method\n * @param {string} facet hierarchical facet name to remove\n * @return {SearchParameters} new instance\n */\n removeHierarchicalFacet: function removeHierarchicalFacet(facet) {\n if (!this.isHierarchicalFacet(facet)) {\n return this;\n }\n\n return this.clearRefinements(facet).setQueryParameters({\n hierarchicalFacets: this.hierarchicalFacets.filter(function (f) {\n return f.name !== facet;\n }),\n });\n },\n /**\n * Remove a refinement set on facet. If a value is provided, it will clear the\n * refinement for the given value, otherwise it will clear all the refinement\n * values for the faceted attribute.\n * @method\n * @param {string} facet name of the attribute used for faceting\n * @param {string} [value] value used to filter\n * @return {SearchParameters} new instance\n */\n removeFacetRefinement: function removeFacetRefinement(facet, value) {\n if (!this.isConjunctiveFacet(facet)) {\n throw new Error(\n facet +\n ' is not defined in the facets attribute of the helper configuration'\n );\n }\n if (!RefinementList.isRefined(this.facetsRefinements, facet, value))\n return this;\n\n return this.setQueryParameters({\n facetsRefinements: RefinementList.removeRefinement(\n this.facetsRefinements,\n facet,\n value\n ),\n });\n },\n /**\n * Remove a negative refinement on a facet\n * @method\n * @param {string} facet name of the attribute used for faceting\n * @param {string} value value used to filter\n * @return {SearchParameters} new instance\n */\n removeExcludeRefinement: function removeExcludeRefinement(facet, value) {\n if (!this.isConjunctiveFacet(facet)) {\n throw new Error(\n facet +\n ' is not defined in the facets attribute of the helper configuration'\n );\n }\n if (!RefinementList.isRefined(this.facetsExcludes, facet, value))\n return this;\n\n return this.setQueryParameters({\n facetsExcludes: RefinementList.removeRefinement(\n this.facetsExcludes,\n facet,\n value\n ),\n });\n },\n /**\n * Remove a refinement on a disjunctive facet\n * @method\n * @param {string} facet name of the attribute used for faceting\n * @param {string} value value used to filter\n * @return {SearchParameters} new instance\n */\n removeDisjunctiveFacetRefinement: function removeDisjunctiveFacetRefinement(\n facet,\n value\n ) {\n if (!this.isDisjunctiveFacet(facet)) {\n throw new Error(\n facet +\n ' is not defined in the disjunctiveFacets attribute of the helper configuration'\n );\n }\n if (\n !RefinementList.isRefined(this.disjunctiveFacetsRefinements, facet, value)\n )\n return this;\n\n return this.setQueryParameters({\n disjunctiveFacetsRefinements: RefinementList.removeRefinement(\n this.disjunctiveFacetsRefinements,\n facet,\n value\n ),\n });\n },\n /**\n * Remove a tag from the list of tag refinements\n * @method\n * @param {string} tag the tag to remove\n * @return {SearchParameters} new instance\n */\n removeTagRefinement: function removeTagRefinement(tag) {\n if (!this.isTagRefined(tag)) return this;\n\n var modification = {\n tagRefinements: this.tagRefinements.filter(function (t) {\n return t !== tag;\n }),\n };\n\n return this.setQueryParameters(modification);\n },\n /**\n * Generic toggle refinement method to use with facet, disjunctive facets\n * and hierarchical facets\n * @param {string} facet the facet to refine\n * @param {string} value the associated value\n * @return {SearchParameters} new instance\n * @throws will throw an error if the facet is not declared in the settings of the helper\n * @deprecated since version 2.19.0, see {@link SearchParameters#toggleFacetRefinement}\n */\n toggleRefinement: function toggleRefinement(facet, value) {\n return this.toggleFacetRefinement(facet, value);\n },\n /**\n * Generic toggle refinement method to use with facet, disjunctive facets\n * and hierarchical facets\n * @param {string} facet the facet to refine\n * @param {string} value the associated value\n * @return {SearchParameters} new instance\n * @throws will throw an error if the facet is not declared in the settings of the helper\n */\n toggleFacetRefinement: function toggleFacetRefinement(facet, value) {\n if (this.isHierarchicalFacet(facet)) {\n return this.toggleHierarchicalFacetRefinement(facet, value);\n } else if (this.isConjunctiveFacet(facet)) {\n return this.toggleConjunctiveFacetRefinement(facet, value);\n } else if (this.isDisjunctiveFacet(facet)) {\n return this.toggleDisjunctiveFacetRefinement(facet, value);\n }\n\n throw new Error(\n 'Cannot refine the undeclared facet ' +\n facet +\n '; it should be added to the helper options facets, disjunctiveFacets or hierarchicalFacets'\n );\n },\n /**\n * Switch the refinement applied over a facet/value\n * @method\n * @param {string} facet name of the attribute used for faceting\n * @param {value} value value used for filtering\n * @return {SearchParameters} new instance\n */\n toggleConjunctiveFacetRefinement: function toggleConjunctiveFacetRefinement(\n facet,\n value\n ) {\n if (!this.isConjunctiveFacet(facet)) {\n throw new Error(\n facet +\n ' is not defined in the facets attribute of the helper configuration'\n );\n }\n\n return this.setQueryParameters({\n facetsRefinements: RefinementList.toggleRefinement(\n this.facetsRefinements,\n facet,\n value\n ),\n });\n },\n /**\n * Switch the refinement applied over a facet/value\n * @method\n * @param {string} facet name of the attribute used for faceting\n * @param {value} value value used for filtering\n * @return {SearchParameters} new instance\n */\n toggleExcludeFacetRefinement: function toggleExcludeFacetRefinement(\n facet,\n value\n ) {\n if (!this.isConjunctiveFacet(facet)) {\n throw new Error(\n facet +\n ' is not defined in the facets attribute of the helper configuration'\n );\n }\n\n return this.setQueryParameters({\n facetsExcludes: RefinementList.toggleRefinement(\n this.facetsExcludes,\n facet,\n value\n ),\n });\n },\n /**\n * Switch the refinement applied over a facet/value\n * @method\n * @param {string} facet name of the attribute used for faceting\n * @param {value} value value used for filtering\n * @return {SearchParameters} new instance\n */\n toggleDisjunctiveFacetRefinement: function toggleDisjunctiveFacetRefinement(\n facet,\n value\n ) {\n if (!this.isDisjunctiveFacet(facet)) {\n throw new Error(\n facet +\n ' is not defined in the disjunctiveFacets attribute of the helper configuration'\n );\n }\n\n return this.setQueryParameters({\n disjunctiveFacetsRefinements: RefinementList.toggleRefinement(\n this.disjunctiveFacetsRefinements,\n facet,\n value\n ),\n });\n },\n /**\n * Switch the refinement applied over a facet/value\n * @method\n * @param {string} facet name of the attribute used for faceting\n * @param {value} value value used for filtering\n * @return {SearchParameters} new instance\n */\n toggleHierarchicalFacetRefinement: function toggleHierarchicalFacetRefinement(\n facet,\n value\n ) {\n if (!this.isHierarchicalFacet(facet)) {\n throw new Error(\n facet +\n ' is not defined in the hierarchicalFacets attribute of the helper configuration'\n );\n }\n\n var separator = this._getHierarchicalFacetSeparator(\n this.getHierarchicalFacetByName(facet)\n );\n\n var mod = {};\n\n var upOneOrMultipleLevel =\n this.hierarchicalFacetsRefinements[facet] !== undefined &&\n this.hierarchicalFacetsRefinements[facet].length > 0 &&\n // remove current refinement:\n // refinement was 'beer > IPA', call is toggleRefine('beer > IPA'), refinement should be `beer`\n (this.hierarchicalFacetsRefinements[facet][0] === value ||\n // remove a parent refinement of the current refinement:\n // - refinement was 'beer > IPA > Flying dog'\n // - call is toggleRefine('beer > IPA')\n // - refinement should be `beer`\n this.hierarchicalFacetsRefinements[facet][0].indexOf(\n value + separator\n ) === 0);\n\n if (upOneOrMultipleLevel) {\n if (value.indexOf(separator) === -1) {\n // go back to root level\n mod[facet] = [];\n } else {\n mod[facet] = [value.slice(0, value.lastIndexOf(separator))];\n }\n } else {\n mod[facet] = [value];\n }\n\n return this.setQueryParameters({\n hierarchicalFacetsRefinements: defaultsPure(\n {},\n mod,\n this.hierarchicalFacetsRefinements\n ),\n });\n },\n\n /**\n * Adds a refinement on a hierarchical facet.\n * @param {string} facet the facet name\n * @param {string} path the hierarchical facet path\n * @return {SearchParameter} the new state\n * @throws Error if the facet is not defined or if the facet is refined\n */\n addHierarchicalFacetRefinement: function (facet, path) {\n if (this.isHierarchicalFacetRefined(facet)) {\n throw new Error(facet + ' is already refined.');\n }\n if (!this.isHierarchicalFacet(facet)) {\n throw new Error(\n facet +\n ' is not defined in the hierarchicalFacets attribute of the helper configuration.'\n );\n }\n var mod = {};\n mod[facet] = [path];\n return this.setQueryParameters({\n hierarchicalFacetsRefinements: defaultsPure(\n {},\n mod,\n this.hierarchicalFacetsRefinements\n ),\n });\n },\n\n /**\n * Removes the refinement set on a hierarchical facet.\n * @param {string} facet the facet name\n * @return {SearchParameter} the new state\n * @throws Error if the facet is not defined or if the facet is not refined\n */\n removeHierarchicalFacetRefinement: function (facet) {\n if (!this.isHierarchicalFacetRefined(facet)) {\n return this;\n }\n var mod = {};\n mod[facet] = [];\n return this.setQueryParameters({\n hierarchicalFacetsRefinements: defaultsPure(\n {},\n mod,\n this.hierarchicalFacetsRefinements\n ),\n });\n },\n /**\n * Switch the tag refinement\n * @method\n * @param {string} tag the tag to remove or add\n * @return {SearchParameters} new instance\n */\n toggleTagRefinement: function toggleTagRefinement(tag) {\n if (this.isTagRefined(tag)) {\n return this.removeTagRefinement(tag);\n }\n\n return this.addTagRefinement(tag);\n },\n /**\n * Test if the facet name is from one of the disjunctive facets\n * @method\n * @param {string} facet facet name to test\n * @return {boolean} true if facet is a disjunctive facet\n */\n isDisjunctiveFacet: function (facet) {\n return this.disjunctiveFacets.indexOf(facet) > -1;\n },\n /**\n * Test if the facet name is from one of the hierarchical facets\n * @method\n * @param {string} facetName facet name to test\n * @return {boolean} true if facetName is a hierarchical facet\n */\n isHierarchicalFacet: function (facetName) {\n return this.getHierarchicalFacetByName(facetName) !== undefined;\n },\n /**\n * Test if the facet name is from one of the conjunctive/normal facets\n * @method\n * @param {string} facet facet name to test\n * @return {boolean} true if facet is a conjunctive facet\n */\n isConjunctiveFacet: function (facet) {\n return this.facets.indexOf(facet) > -1;\n },\n /**\n * Returns true if the facet is refined, either for a specific value or in\n * general.\n * @method\n * @param {string} facet name of the attribute for used for faceting\n * @param {string} value, optional value. If passed will test that this value\n * is filtering the given facet.\n * @return {boolean} returns true if refined\n */\n isFacetRefined: function isFacetRefined(facet, value) {\n if (!this.isConjunctiveFacet(facet)) {\n return false;\n }\n return RefinementList.isRefined(this.facetsRefinements, facet, value);\n },\n /**\n * Returns true if the facet contains exclusions or if a specific value is\n * excluded.\n *\n * @method\n * @param {string} facet name of the attribute for used for faceting\n * @param {string} [value] optional value. If passed will test that this value\n * is filtering the given facet.\n * @return {boolean} returns true if refined\n */\n isExcludeRefined: function isExcludeRefined(facet, value) {\n if (!this.isConjunctiveFacet(facet)) {\n return false;\n }\n return RefinementList.isRefined(this.facetsExcludes, facet, value);\n },\n /**\n * Returns true if the facet contains a refinement, or if a value passed is a\n * refinement for the facet.\n * @method\n * @param {string} facet name of the attribute for used for faceting\n * @param {string} value optional, will test if the value is used for refinement\n * if there is one, otherwise will test if the facet contains any refinement\n * @return {boolean} true if the facet is refined\n */\n isDisjunctiveFacetRefined: function isDisjunctiveFacetRefined(facet, value) {\n if (!this.isDisjunctiveFacet(facet)) {\n return false;\n }\n return RefinementList.isRefined(\n this.disjunctiveFacetsRefinements,\n facet,\n value\n );\n },\n /**\n * Returns true if the facet contains a refinement, or if a value passed is a\n * refinement for the facet.\n * @method\n * @param {string} facet name of the attribute for used for faceting\n * @param {string} value optional, will test if the value is used for refinement\n * if there is one, otherwise will test if the facet contains any refinement\n * @return {boolean} true if the facet is refined\n */\n isHierarchicalFacetRefined: function isHierarchicalFacetRefined(\n facet,\n value\n ) {\n if (!this.isHierarchicalFacet(facet)) {\n return false;\n }\n\n var refinements = this.getHierarchicalRefinement(facet);\n\n if (!value) {\n return refinements.length > 0;\n }\n\n return refinements.indexOf(value) !== -1;\n },\n /**\n * Test if the triple (attribute, operator, value) is already refined.\n * If only the attribute and the operator are provided, it tests if the\n * contains any refinement value.\n * @method\n * @param {string} attribute attribute for which the refinement is applied\n * @param {string} [operator] operator of the refinement\n * @param {string} [value] value of the refinement\n * @return {boolean} true if it is refined\n */\n isNumericRefined: function isNumericRefined(attribute, operator, value) {\n if (value === undefined && operator === undefined) {\n return Boolean(this.numericRefinements[attribute]);\n }\n\n var isOperatorDefined =\n this.numericRefinements[attribute] &&\n this.numericRefinements[attribute][operator] !== undefined;\n\n if (value === undefined || !isOperatorDefined) {\n return isOperatorDefined;\n }\n\n var parsedValue = valToNumber(value);\n var isAttributeValueDefined =\n findArray(this.numericRefinements[attribute][operator], parsedValue) !==\n undefined;\n\n return isOperatorDefined && isAttributeValueDefined;\n },\n /**\n * Returns true if the tag refined, false otherwise\n * @method\n * @param {string} tag the tag to check\n * @return {boolean} true if tag is refined\n */\n isTagRefined: function isTagRefined(tag) {\n return this.tagRefinements.indexOf(tag) !== -1;\n },\n /**\n * Returns the list of all disjunctive facets refined\n * @method\n * @param {string} facet name of the attribute used for faceting\n * @param {value} value value used for filtering\n * @return {string[]} returns the list of refinements\n */\n getRefinedDisjunctiveFacets: function getRefinedDisjunctiveFacets() {\n // eslint-disable-next-line consistent-this\n var self = this;\n\n // attributes used for numeric filter can also be disjunctive\n var disjunctiveNumericRefinedFacets = intersection(\n Object.keys(this.numericRefinements).filter(function (facet) {\n return Object.keys(self.numericRefinements[facet]).length > 0;\n }),\n this.disjunctiveFacets\n );\n\n return Object.keys(this.disjunctiveFacetsRefinements)\n .filter(function (facet) {\n return self.disjunctiveFacetsRefinements[facet].length > 0;\n })\n .concat(disjunctiveNumericRefinedFacets)\n .concat(this.getRefinedHierarchicalFacets())\n .sort();\n },\n /**\n * Returns the list of all disjunctive facets refined\n * @method\n * @param {string} facet name of the attribute used for faceting\n * @param {value} value value used for filtering\n * @return {string[]} returns the list of refinements\n */\n getRefinedHierarchicalFacets: function getRefinedHierarchicalFacets() {\n // eslint-disable-next-line consistent-this\n var self = this;\n return intersection(\n // enforce the order between the two arrays,\n // so that refinement name index === hierarchical facet index\n this.hierarchicalFacets.map(function (facet) {\n return facet.name;\n }),\n Object.keys(this.hierarchicalFacetsRefinements).filter(function (facet) {\n return self.hierarchicalFacetsRefinements[facet].length > 0;\n })\n ).sort();\n },\n /**\n * Returned the list of all disjunctive facets not refined\n * @method\n * @return {string[]} returns the list of facets that are not refined\n */\n getUnrefinedDisjunctiveFacets: function () {\n var refinedFacets = this.getRefinedDisjunctiveFacets();\n\n return this.disjunctiveFacets.filter(function (f) {\n return refinedFacets.indexOf(f) === -1;\n });\n },\n\n managedParameters: [\n 'index',\n\n 'facets',\n 'disjunctiveFacets',\n 'facetsRefinements',\n 'hierarchicalFacets',\n 'facetsExcludes',\n\n 'disjunctiveFacetsRefinements',\n 'numericRefinements',\n 'tagRefinements',\n 'hierarchicalFacetsRefinements',\n ],\n\n getQueryParams: function getQueryParams() {\n var managedParameters = this.managedParameters;\n\n var queryParams = {};\n\n // eslint-disable-next-line consistent-this\n var self = this;\n Object.keys(this).forEach(function (paramName) {\n var paramValue = self[paramName];\n if (\n managedParameters.indexOf(paramName) === -1 &&\n paramValue !== undefined\n ) {\n queryParams[paramName] = paramValue;\n }\n });\n\n return queryParams;\n },\n /**\n * Let the user set a specific value for a given parameter. Will return the\n * same instance if the parameter is invalid or if the value is the same as the\n * previous one.\n * @method\n * @param {string} parameter the parameter name\n * @param {any} value the value to be set, must be compliant with the definition\n * of the attribute on the object\n * @return {SearchParameters} the updated state\n */\n setQueryParameter: function setParameter(parameter, value) {\n if (this[parameter] === value) return this;\n\n var modification = {};\n\n modification[parameter] = value;\n\n return this.setQueryParameters(modification);\n },\n /**\n * Let the user set any of the parameters with a plain object.\n * @method\n * @param {object} params all the keys and the values to be updated\n * @return {SearchParameters} a new updated instance\n */\n setQueryParameters: function setQueryParameters(params) {\n if (!params) return this;\n\n var error = SearchParameters.validate(this, params);\n\n if (error) {\n throw error;\n }\n\n // eslint-disable-next-line consistent-this\n var self = this;\n var nextWithNumbers = SearchParameters._parseNumbers(params);\n var previousPlainObject = Object.keys(this).reduce(function (acc, key) {\n acc[key] = self[key];\n return acc;\n }, {});\n\n var nextPlainObject = Object.keys(nextWithNumbers).reduce(function (\n previous,\n key\n ) {\n var isPreviousValueDefined = previous[key] !== undefined;\n var isNextValueDefined = nextWithNumbers[key] !== undefined;\n\n if (isPreviousValueDefined && !isNextValueDefined) {\n return omit(previous, [key]);\n }\n\n if (isNextValueDefined) {\n previous[key] = nextWithNumbers[key];\n }\n\n return previous;\n },\n previousPlainObject);\n\n return new this.constructor(nextPlainObject);\n },\n\n /**\n * Returns a new instance with the page reset. Two scenarios possible:\n * the page is omitted -> return the given instance\n * the page is set -> return a new instance with a page of 0\n * @return {SearchParameters} a new updated instance\n */\n resetPage: function () {\n if (this.page === undefined) {\n return this;\n }\n\n return this.setPage(0);\n },\n\n /**\n * Helper function to get the hierarchicalFacet separator or the default one (`>`)\n * @param {object} hierarchicalFacet the hierarchicalFacet object\n * @return {string} returns the hierarchicalFacet.separator or `>` as default\n */\n _getHierarchicalFacetSortBy: function (hierarchicalFacet) {\n return hierarchicalFacet.sortBy || ['isRefined:desc', 'name:asc'];\n },\n\n /**\n * Helper function to get the hierarchicalFacet separator or the default one (`>`)\n * @private\n * @param {object} hierarchicalFacet the hierarchicalFacet object\n * @return {string} returns the hierarchicalFacet.separator or `>` as default\n */\n _getHierarchicalFacetSeparator: function (hierarchicalFacet) {\n return hierarchicalFacet.separator || ' > ';\n },\n\n /**\n * Helper function to get the hierarchicalFacet prefix path or null\n * @private\n * @param {object} hierarchicalFacet the hierarchicalFacet object\n * @return {string} returns the hierarchicalFacet.rootPath or null as default\n */\n _getHierarchicalRootPath: function (hierarchicalFacet) {\n return hierarchicalFacet.rootPath || null;\n },\n\n /**\n * Helper function to check if we show the parent level of the hierarchicalFacet\n * @private\n * @param {object} hierarchicalFacet the hierarchicalFacet object\n * @return {string} returns the hierarchicalFacet.showParentLevel or true as default\n */\n _getHierarchicalShowParentLevel: function (hierarchicalFacet) {\n if (typeof hierarchicalFacet.showParentLevel === 'boolean') {\n return hierarchicalFacet.showParentLevel;\n }\n return true;\n },\n\n /**\n * Helper function to get the hierarchicalFacet by it's name\n * @param {string} hierarchicalFacetName the hierarchicalFacet name\n * @return {object} a hierarchicalFacet\n */\n getHierarchicalFacetByName: function (hierarchicalFacetName) {\n return find(this.hierarchicalFacets, function (f) {\n return f.name === hierarchicalFacetName;\n });\n },\n\n /**\n * Get the current breadcrumb for a hierarchical facet, as an array\n * @param {string} facetName Hierarchical facet name\n * @return {array.} the path as an array of string\n */\n getHierarchicalFacetBreadcrumb: function (facetName) {\n if (!this.isHierarchicalFacet(facetName)) {\n return [];\n }\n\n var refinement = this.getHierarchicalRefinement(facetName)[0];\n if (!refinement) return [];\n\n var separator = this._getHierarchicalFacetSeparator(\n this.getHierarchicalFacetByName(facetName)\n );\n var path = refinement.split(separator);\n return path.map(function (part) {\n return part.trim();\n });\n },\n\n toString: function () {\n return JSON.stringify(this, null, 2);\n },\n};\n\n/**\n * Callback used for clearRefinement method\n * @callback SearchParameters.clearCallback\n * @param {OperatorList|FacetList} value the value of the filter\n * @param {string} key the current attribute name\n * @param {string} type `numeric`, `disjunctiveFacet`, `conjunctiveFacet`, `hierarchicalFacet` or `exclude`\n * depending on the type of facet\n * @return {boolean} `true` if the element should be removed. `false` otherwise.\n */\nmodule.exports = SearchParameters;\n","'use strict';\n\nmodule.exports = generateTrees;\n\nvar fv = require('../functions/escapeFacetValue');\nvar find = require('../functions/find');\nvar prepareHierarchicalFacetSortBy = require('../functions/formatSort');\nvar orderBy = require('../functions/orderBy');\nvar escapeFacetValue = fv.escapeFacetValue;\nvar unescapeFacetValue = fv.unescapeFacetValue;\n\nfunction generateTrees(state) {\n return function generate(hierarchicalFacetResult, hierarchicalFacetIndex) {\n var hierarchicalFacet = state.hierarchicalFacets[hierarchicalFacetIndex];\n var hierarchicalFacetRefinement =\n (state.hierarchicalFacetsRefinements[hierarchicalFacet.name] &&\n state.hierarchicalFacetsRefinements[hierarchicalFacet.name][0]) ||\n '';\n var hierarchicalSeparator =\n state._getHierarchicalFacetSeparator(hierarchicalFacet);\n var hierarchicalRootPath =\n state._getHierarchicalRootPath(hierarchicalFacet);\n var hierarchicalShowParentLevel =\n state._getHierarchicalShowParentLevel(hierarchicalFacet);\n var sortBy = prepareHierarchicalFacetSortBy(\n state._getHierarchicalFacetSortBy(hierarchicalFacet)\n );\n\n var rootExhaustive = hierarchicalFacetResult.every(function (facetResult) {\n return facetResult.exhaustive;\n });\n\n var generateTreeFn = generateHierarchicalTree(\n sortBy,\n hierarchicalSeparator,\n hierarchicalRootPath,\n hierarchicalShowParentLevel,\n hierarchicalFacetRefinement\n );\n\n var results = hierarchicalFacetResult;\n\n if (hierarchicalRootPath) {\n results = hierarchicalFacetResult.slice(\n hierarchicalRootPath.split(hierarchicalSeparator).length\n );\n }\n\n return results.reduce(generateTreeFn, {\n name: state.hierarchicalFacets[hierarchicalFacetIndex].name,\n count: null, // root level, no count\n isRefined: true, // root level, always refined\n path: null, // root level, no path\n escapedValue: null,\n exhaustive: rootExhaustive,\n data: null,\n });\n };\n}\n\nfunction generateHierarchicalTree(\n sortBy,\n hierarchicalSeparator,\n hierarchicalRootPath,\n hierarchicalShowParentLevel,\n currentRefinement\n) {\n return function generateTree(\n hierarchicalTree,\n hierarchicalFacetResult,\n currentHierarchicalLevel\n ) {\n var parent = hierarchicalTree;\n\n if (currentHierarchicalLevel > 0) {\n var level = 0;\n\n parent = hierarchicalTree;\n\n while (level < currentHierarchicalLevel) {\n /**\n * @type {object[]]} hierarchical data\n */\n var data = parent && Array.isArray(parent.data) ? parent.data : [];\n parent = find(data, function (subtree) {\n return subtree.isRefined;\n });\n level++;\n }\n }\n\n // we found a refined parent, let's add current level data under it\n if (parent) {\n // filter values in case an object has multiple categories:\n // {\n // categories: {\n // level0: ['beers', 'bières'],\n // level1: ['beers > IPA', 'bières > Belges']\n // }\n // }\n //\n // If parent refinement is `beers`, then we do not want to have `bières > Belges`\n // showing up\n\n var picked = Object.keys(hierarchicalFacetResult.data)\n .map(function (facetValue) {\n return [facetValue, hierarchicalFacetResult.data[facetValue]];\n })\n .filter(function (tuple) {\n var facetValue = tuple[0];\n return onlyMatchingTree(\n facetValue,\n parent.path || hierarchicalRootPath,\n currentRefinement,\n hierarchicalSeparator,\n hierarchicalRootPath,\n hierarchicalShowParentLevel\n );\n });\n\n parent.data = orderBy(\n picked.map(function (tuple) {\n var facetValue = tuple[0];\n var facetCount = tuple[1];\n\n return format(\n facetCount,\n facetValue,\n hierarchicalSeparator,\n unescapeFacetValue(currentRefinement),\n hierarchicalFacetResult.exhaustive\n );\n }),\n sortBy[0],\n sortBy[1]\n );\n }\n\n return hierarchicalTree;\n };\n}\n\n// eslint-disable-next-line max-params\nfunction onlyMatchingTree(\n facetValue,\n parentPath,\n currentRefinement,\n hierarchicalSeparator,\n hierarchicalRootPath,\n hierarchicalShowParentLevel\n) {\n // we want the facetValue is a child of hierarchicalRootPath\n if (\n hierarchicalRootPath &&\n (facetValue.indexOf(hierarchicalRootPath) !== 0 ||\n hierarchicalRootPath === facetValue)\n ) {\n return false;\n }\n\n // we always want root levels (only when there is no prefix path)\n return (\n (!hierarchicalRootPath &&\n facetValue.indexOf(hierarchicalSeparator) === -1) ||\n // if there is a rootPath, being root level mean 1 level under rootPath\n (hierarchicalRootPath &&\n facetValue.split(hierarchicalSeparator).length -\n hierarchicalRootPath.split(hierarchicalSeparator).length ===\n 1) ||\n // if current refinement is a root level and current facetValue is a root level,\n // keep the facetValue\n (facetValue.indexOf(hierarchicalSeparator) === -1 &&\n currentRefinement.indexOf(hierarchicalSeparator) === -1) ||\n // currentRefinement is a child of the facet value\n currentRefinement.indexOf(facetValue) === 0 ||\n // facetValue is a child of the current parent, add it\n (facetValue.indexOf(parentPath + hierarchicalSeparator) === 0 &&\n (hierarchicalShowParentLevel ||\n facetValue.indexOf(currentRefinement) === 0))\n );\n}\n\nfunction format(\n facetCount,\n facetValue,\n hierarchicalSeparator,\n currentRefinement,\n exhaustive\n) {\n var parts = facetValue.split(hierarchicalSeparator);\n return {\n name: parts[parts.length - 1].trim(),\n path: facetValue,\n escapedValue: escapeFacetValue(facetValue),\n count: facetCount,\n isRefined:\n currentRefinement === facetValue ||\n currentRefinement.indexOf(facetValue + hierarchicalSeparator) === 0,\n exhaustive: exhaustive,\n data: null,\n };\n}\n","'use strict';\n\nvar compact = require('../functions/compact');\nvar defaultsPure = require('../functions/defaultsPure');\nvar fv = require('../functions/escapeFacetValue');\nvar find = require('../functions/find');\nvar findIndex = require('../functions/findIndex');\nvar formatSort = require('../functions/formatSort');\nvar merge = require('../functions/merge');\nvar orderBy = require('../functions/orderBy');\nvar escapeFacetValue = fv.escapeFacetValue;\nvar unescapeFacetValue = fv.unescapeFacetValue;\n\nvar generateHierarchicalTree = require('./generate-hierarchical-tree');\n\n/**\n * @typedef SearchResults.Facet\n * @type {object}\n * @property {string} name name of the attribute in the record\n * @property {object} data the faceting data: value, number of entries\n * @property {object} stats undefined unless facet_stats is retrieved from algolia\n */\n\n/**\n * @typedef SearchResults.HierarchicalFacet\n * @type {object}\n * @property {string} name name of the current value given the hierarchical level, trimmed.\n * If root node, you get the facet name\n * @property {number} count number of objects matching this hierarchical value\n * @property {string} path the current hierarchical value full path\n * @property {boolean} isRefined `true` if the current value was refined, `false` otherwise\n * @property {HierarchicalFacet[]} data sub values for the current level\n */\n\n/**\n * @typedef SearchResults.FacetValue\n * @type {object}\n * @property {string} name the facet value itself\n * @property {number} count times this facet appears in the results\n * @property {boolean} isRefined is the facet currently selected\n * @property {boolean} isExcluded is the facet currently excluded (only for conjunctive facets)\n */\n\n/**\n * @typedef Refinement\n * @type {object}\n * @property {string} type the type of filter used:\n * `numeric`, `facet`, `exclude`, `disjunctive`, `hierarchical`\n * @property {string} attributeName name of the attribute used for filtering\n * @property {string} name the value of the filter\n * @property {number} numericValue the value as a number. Only for numeric filters.\n * @property {string} operator the operator used. Only for numeric filters.\n * @property {number} count the number of computed hits for this filter. Only on facets.\n * @property {boolean} exhaustive if the count is exhaustive\n */\n\n/**\n * Turn an array of attributes in an object of attributes with their position in the array as value\n * @param {string[]} attributes the list of attributes in the record\n * @return {object} the list of attributes indexed by attribute name\n */\nfunction getIndices(attributes) {\n var indices = {};\n\n attributes.forEach(function (val, idx) {\n indices[val] = idx;\n });\n\n return indices;\n}\n\nfunction assignFacetStats(dest, facetStats, key) {\n if (facetStats && facetStats[key]) {\n dest.stats = facetStats[key];\n }\n}\n\n/**\n * @typedef {Object} HierarchicalFacet\n * @property {string} name\n * @property {string[]} attributes\n */\n\n/**\n * @param {HierarchicalFacet[]} hierarchicalFacets All hierarchical facets\n * @param {string} hierarchicalAttributeName The name of the hierarchical attribute\n * @return {HierarchicalFacet} The hierarchical facet matching the attribute name\n */\nfunction findMatchingHierarchicalFacetFromAttributeName(\n hierarchicalFacets,\n hierarchicalAttributeName\n) {\n return find(\n hierarchicalFacets,\n function facetKeyMatchesAttribute(hierarchicalFacet) {\n var facetNames = hierarchicalFacet.attributes || [];\n return facetNames.indexOf(hierarchicalAttributeName) > -1;\n }\n );\n}\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * Constructor for SearchResults\n * @class\n * @classdesc SearchResults contains the results of a query to Algolia using the\n * {@link AlgoliaSearchHelper}.\n * @param {SearchParameters} state state that led to the response\n * @param {array.} results the results from algolia client\n * @example SearchResults of the first query in\n * the instant search demo\n{\n \"hitsPerPage\": 10,\n \"processingTimeMS\": 2,\n \"facets\": [\n {\n \"name\": \"type\",\n \"data\": {\n \"HardGood\": 6627,\n \"BlackTie\": 550,\n \"Music\": 665,\n \"Software\": 131,\n \"Game\": 456,\n \"Movie\": 1571\n },\n \"exhaustive\": false\n },\n {\n \"exhaustive\": false,\n \"data\": {\n \"Free shipping\": 5507\n },\n \"name\": \"shipping\"\n }\n ],\n \"hits\": [\n {\n \"thumbnailImage\": \"http://img.bbystatic.com/BestBuy_US/images/products/1688/1688832_54x108_s.gif\",\n \"_highlightResult\": {\n \"shortDescription\": {\n \"matchLevel\": \"none\",\n \"value\": \"Safeguard your PC, Mac, Android and iOS devices with comprehensive Internet protection\",\n \"matchedWords\": []\n },\n \"category\": {\n \"matchLevel\": \"none\",\n \"value\": \"Computer Security Software\",\n \"matchedWords\": []\n },\n \"manufacturer\": {\n \"matchedWords\": [],\n \"value\": \"Webroot\",\n \"matchLevel\": \"none\"\n },\n \"name\": {\n \"value\": \"Webroot SecureAnywhere Internet Security (3-Device) (1-Year Subscription) - Mac/Windows\",\n \"matchedWords\": [],\n \"matchLevel\": \"none\"\n }\n },\n \"image\": \"http://img.bbystatic.com/BestBuy_US/images/products/1688/1688832_105x210_sc.jpg\",\n \"shipping\": \"Free shipping\",\n \"bestSellingRank\": 4,\n \"shortDescription\": \"Safeguard your PC, Mac, Android and iOS devices with comprehensive Internet protection\",\n \"url\": \"http://www.bestbuy.com/site/webroot-secureanywhere-internet-security-3-devi…d=1219060687969&skuId=1688832&cmp=RMX&ky=2d3GfEmNIzjA0vkzveHdZEBgpPCyMnLTJ\",\n \"name\": \"Webroot SecureAnywhere Internet Security (3-Device) (1-Year Subscription) - Mac/Windows\",\n \"category\": \"Computer Security Software\",\n \"salePrice_range\": \"1 - 50\",\n \"objectID\": \"1688832\",\n \"type\": \"Software\",\n \"customerReviewCount\": 5980,\n \"salePrice\": 49.99,\n \"manufacturer\": \"Webroot\"\n },\n ....\n ],\n \"nbHits\": 10000,\n \"disjunctiveFacets\": [\n {\n \"exhaustive\": false,\n \"data\": {\n \"5\": 183,\n \"12\": 112,\n \"7\": 149,\n ...\n },\n \"name\": \"customerReviewCount\",\n \"stats\": {\n \"max\": 7461,\n \"avg\": 157.939,\n \"min\": 1\n }\n },\n {\n \"data\": {\n \"Printer Ink\": 142,\n \"Wireless Speakers\": 60,\n \"Point & Shoot Cameras\": 48,\n ...\n },\n \"name\": \"category\",\n \"exhaustive\": false\n },\n {\n \"exhaustive\": false,\n \"data\": {\n \"> 5000\": 2,\n \"1 - 50\": 6524,\n \"501 - 2000\": 566,\n \"201 - 500\": 1501,\n \"101 - 200\": 1360,\n \"2001 - 5000\": 47\n },\n \"name\": \"salePrice_range\"\n },\n {\n \"data\": {\n \"Dynexâ„¢\": 202,\n \"Insigniaâ„¢\": 230,\n \"PNY\": 72,\n ...\n },\n \"name\": \"manufacturer\",\n \"exhaustive\": false\n }\n ],\n \"query\": \"\",\n \"nbPages\": 100,\n \"page\": 0,\n \"index\": \"bestbuy\"\n}\n **/\nfunction SearchResults(state, results, options) {\n var mainSubResponse = results[0];\n\n this._rawResults = results;\n\n // eslint-disable-next-line consistent-this\n var self = this;\n\n // https://www.algolia.com/doc/api-reference/api-methods/search/#response\n Object.keys(mainSubResponse).forEach(function (key) {\n self[key] = mainSubResponse[key];\n });\n\n // Make every key of the result options reachable from the instance\n Object.keys(options || {}).forEach(function (key) {\n self[key] = options[key];\n });\n\n /**\n * query used to generate the results\n * @name query\n * @member {string}\n * @memberof SearchResults\n * @instance\n */\n /**\n * The query as parsed by the engine given all the rules.\n * @name parsedQuery\n * @member {string}\n * @memberof SearchResults\n * @instance\n */\n /**\n * all the records that match the search parameters. Each record is\n * augmented with a new attribute `_highlightResult`\n * which is an object keyed by attribute and with the following properties:\n * - `value` : the value of the facet highlighted (html)\n * - `matchLevel`: `full`, `partial` or `none`, depending on how the query terms match\n * @name hits\n * @member {object[]}\n * @memberof SearchResults\n * @instance\n */\n /**\n * index where the results come from\n * @name index\n * @member {string}\n * @memberof SearchResults\n * @instance\n */\n /**\n * number of hits per page requested\n * @name hitsPerPage\n * @member {number}\n * @memberof SearchResults\n * @instance\n */\n /**\n * total number of hits of this query on the index\n * @name nbHits\n * @member {number}\n * @memberof SearchResults\n * @instance\n */\n /**\n * total number of pages with respect to the number of hits per page and the total number of hits\n * @name nbPages\n * @member {number}\n * @memberof SearchResults\n * @instance\n */\n /**\n * current page\n * @name page\n * @member {number}\n * @memberof SearchResults\n * @instance\n */\n /**\n * The position if the position was guessed by IP.\n * @name aroundLatLng\n * @member {string}\n * @memberof SearchResults\n * @instance\n * @example \"48.8637,2.3615\",\n */\n /**\n * The radius computed by Algolia.\n * @name automaticRadius\n * @member {string}\n * @memberof SearchResults\n * @instance\n * @example \"126792922\",\n */\n /**\n * String identifying the server used to serve this request.\n *\n * getRankingInfo needs to be set to `true` for this to be returned\n *\n * @name serverUsed\n * @member {string}\n * @memberof SearchResults\n * @instance\n * @example \"c7-use-2.algolia.net\",\n */\n /**\n * Boolean that indicates if the computation of the counts did time out.\n * @deprecated\n * @name timeoutCounts\n * @member {boolean}\n * @memberof SearchResults\n * @instance\n */\n /**\n * Boolean that indicates if the computation of the hits did time out.\n * @deprecated\n * @name timeoutHits\n * @member {boolean}\n * @memberof SearchResults\n * @instance\n */\n /**\n * True if the counts of the facets is exhaustive\n * @name exhaustiveFacetsCount\n * @member {boolean}\n * @memberof SearchResults\n * @instance\n */\n /**\n * True if the number of hits is exhaustive\n * @name exhaustiveNbHits\n * @member {boolean}\n * @memberof SearchResults\n * @instance\n */\n /**\n * Contains the userData if they are set by a [query rule](https://www.algolia.com/doc/guides/query-rules/query-rules-overview/).\n * @name userData\n * @member {object[]}\n * @memberof SearchResults\n * @instance\n */\n /**\n * queryID is the unique identifier of the query used to generate the current search results.\n * This value is only available if the `clickAnalytics` search parameter is set to `true`.\n * @name queryID\n * @member {string}\n * @memberof SearchResults\n * @instance\n */\n\n /**\n * sum of the processing time of all the queries\n * @name processingTimeMS\n * @member {number}\n * @memberof SearchResults\n * @instance\n */\n this.processingTimeMS = results.reduce(function (sum, result) {\n return result.processingTimeMS === undefined\n ? sum\n : sum + result.processingTimeMS;\n }, 0);\n\n /**\n * disjunctive facets results\n * @member {SearchResults.Facet[]}\n */\n this.disjunctiveFacets = [];\n /**\n * disjunctive facets results\n * @member {SearchResults.HierarchicalFacet[]}\n */\n this.hierarchicalFacets = state.hierarchicalFacets.map(\n function initFutureTree() {\n return [];\n }\n );\n /**\n * other facets results\n * @member {SearchResults.Facet[]}\n */\n this.facets = [];\n\n var disjunctiveFacets = state.getRefinedDisjunctiveFacets();\n\n var facetsIndices = getIndices(state.facets);\n var disjunctiveFacetsIndices = getIndices(state.disjunctiveFacets);\n var nextDisjunctiveResult = 1;\n\n // Since we send request only for disjunctive facets that have been refined,\n // we get the facets information from the first, general, response.\n\n var mainFacets = mainSubResponse.facets || {};\n\n Object.keys(mainFacets).forEach(function (facetKey) {\n var facetValueObject = mainFacets[facetKey];\n\n var hierarchicalFacet = findMatchingHierarchicalFacetFromAttributeName(\n state.hierarchicalFacets,\n facetKey\n );\n\n if (hierarchicalFacet) {\n // Place the hierarchicalFacet data at the correct index depending on\n // the attributes order that was defined at the helper initialization\n var facetIndex = hierarchicalFacet.attributes.indexOf(facetKey);\n var idxAttributeName = findIndex(state.hierarchicalFacets, function (f) {\n return f.name === hierarchicalFacet.name;\n });\n self.hierarchicalFacets[idxAttributeName][facetIndex] = {\n attribute: facetKey,\n data: facetValueObject,\n exhaustive: mainSubResponse.exhaustiveFacetsCount,\n };\n } else {\n var isFacetDisjunctive = state.disjunctiveFacets.indexOf(facetKey) !== -1;\n var isFacetConjunctive = state.facets.indexOf(facetKey) !== -1;\n var position;\n\n if (isFacetDisjunctive) {\n position = disjunctiveFacetsIndices[facetKey];\n self.disjunctiveFacets[position] = {\n name: facetKey,\n data: facetValueObject,\n exhaustive: mainSubResponse.exhaustiveFacetsCount,\n };\n assignFacetStats(\n self.disjunctiveFacets[position],\n mainSubResponse.facets_stats,\n facetKey\n );\n }\n if (isFacetConjunctive) {\n position = facetsIndices[facetKey];\n self.facets[position] = {\n name: facetKey,\n data: facetValueObject,\n exhaustive: mainSubResponse.exhaustiveFacetsCount,\n };\n assignFacetStats(\n self.facets[position],\n mainSubResponse.facets_stats,\n facetKey\n );\n }\n }\n });\n\n // Make sure we do not keep holes within the hierarchical facets\n this.hierarchicalFacets = compact(this.hierarchicalFacets);\n\n // aggregate the refined disjunctive facets\n disjunctiveFacets.forEach(function (disjunctiveFacet) {\n var result = results[nextDisjunctiveResult];\n var facets = result && result.facets ? result.facets : {};\n var hierarchicalFacet = state.getHierarchicalFacetByName(disjunctiveFacet);\n\n // There should be only item in facets.\n Object.keys(facets).forEach(function (dfacet) {\n var facetResults = facets[dfacet];\n\n var position;\n\n if (hierarchicalFacet) {\n position = findIndex(state.hierarchicalFacets, function (f) {\n return f.name === hierarchicalFacet.name;\n });\n var attributeIndex = findIndex(\n self.hierarchicalFacets[position],\n function (f) {\n return f.attribute === dfacet;\n }\n );\n\n // previous refinements and no results so not able to find it\n if (attributeIndex === -1) {\n return;\n }\n\n self.hierarchicalFacets[position][attributeIndex].data = merge(\n {},\n self.hierarchicalFacets[position][attributeIndex].data,\n facetResults\n );\n } else {\n position = disjunctiveFacetsIndices[dfacet];\n\n var dataFromMainRequest =\n (mainSubResponse.facets && mainSubResponse.facets[dfacet]) || {};\n\n self.disjunctiveFacets[position] = {\n name: dfacet,\n data: defaultsPure({}, facetResults, dataFromMainRequest),\n exhaustive: result.exhaustiveFacetsCount,\n };\n assignFacetStats(\n self.disjunctiveFacets[position],\n result.facets_stats,\n dfacet\n );\n\n if (state.disjunctiveFacetsRefinements[dfacet]) {\n state.disjunctiveFacetsRefinements[dfacet].forEach(function (\n refinementValue\n ) {\n // add the disjunctive refinements if it is no more retrieved\n if (\n !self.disjunctiveFacets[position].data[refinementValue] &&\n state.disjunctiveFacetsRefinements[dfacet].indexOf(\n unescapeFacetValue(refinementValue)\n ) > -1\n ) {\n self.disjunctiveFacets[position].data[refinementValue] = 0;\n }\n });\n }\n }\n });\n nextDisjunctiveResult++;\n });\n\n // if we have some parent level values for hierarchical facets, merge them\n state.getRefinedHierarchicalFacets().forEach(function (refinedFacet) {\n var hierarchicalFacet = state.getHierarchicalFacetByName(refinedFacet);\n var separator = state._getHierarchicalFacetSeparator(hierarchicalFacet);\n\n var currentRefinement = state.getHierarchicalRefinement(refinedFacet);\n // if we are already at a root refinement (or no refinement at all), there is no\n // root level values request\n if (\n currentRefinement.length === 0 ||\n currentRefinement[0].split(separator).length < 2\n ) {\n return;\n }\n\n results.slice(nextDisjunctiveResult).forEach(function (result) {\n var facets = result && result.facets ? result.facets : {};\n\n Object.keys(facets).forEach(function (dfacet) {\n var facetResults = facets[dfacet];\n var position = findIndex(state.hierarchicalFacets, function (f) {\n return f.name === hierarchicalFacet.name;\n });\n var attributeIndex = findIndex(\n self.hierarchicalFacets[position],\n function (f) {\n return f.attribute === dfacet;\n }\n );\n\n // previous refinements and no results so not able to find it\n if (attributeIndex === -1) {\n return;\n }\n\n // when we always get root levels, if the hits refinement is `beers > IPA` (count: 5),\n // then the disjunctive values will be `beers` (count: 100),\n // but we do not want to display\n // | beers (100)\n // > IPA (5)\n // We want\n // | beers (5)\n // > IPA (5)\n var defaultData = {};\n\n if (currentRefinement.length > 0) {\n var root = currentRefinement[0].split(separator)[0];\n defaultData[root] =\n self.hierarchicalFacets[position][attributeIndex].data[root];\n }\n\n self.hierarchicalFacets[position][attributeIndex].data = defaultsPure(\n defaultData,\n facetResults,\n self.hierarchicalFacets[position][attributeIndex].data\n );\n });\n\n nextDisjunctiveResult++;\n });\n });\n\n // add the excludes\n Object.keys(state.facetsExcludes).forEach(function (facetName) {\n var excludes = state.facetsExcludes[facetName];\n var position = facetsIndices[facetName];\n\n self.facets[position] = {\n name: facetName,\n data: mainFacets[facetName],\n exhaustive: mainSubResponse.exhaustiveFacetsCount,\n };\n excludes.forEach(function (facetValue) {\n self.facets[position] = self.facets[position] || { name: facetName };\n self.facets[position].data = self.facets[position].data || {};\n self.facets[position].data[facetValue] = 0;\n });\n });\n\n /**\n * @type {Array}\n */\n this.hierarchicalFacets = this.hierarchicalFacets.map(\n generateHierarchicalTree(state)\n );\n\n /**\n * @type {Array}\n */\n this.facets = compact(this.facets);\n /**\n * @type {Array}\n */\n this.disjunctiveFacets = compact(this.disjunctiveFacets);\n\n this._state = state;\n}\n\n/**\n * Get a facet object with its name\n * @deprecated\n * @param {string} name name of the faceted attribute\n * @return {SearchResults.Facet} the facet object\n */\nSearchResults.prototype.getFacetByName = function (name) {\n function predicate(facet) {\n return facet.name === name;\n }\n\n return (\n find(this.facets, predicate) ||\n find(this.disjunctiveFacets, predicate) ||\n find(this.hierarchicalFacets, predicate)\n );\n};\n\n/**\n * Get the facet values of a specified attribute from a SearchResults object.\n * @private\n * @param {SearchResults} results the search results to search in\n * @param {string} attribute name of the faceted attribute to search for\n * @return {array|object} facet values. For the hierarchical facets it is an object.\n */\nfunction extractNormalizedFacetValues(results, attribute) {\n function predicate(facet) {\n return facet.name === attribute;\n }\n\n if (results._state.isConjunctiveFacet(attribute)) {\n var facet = find(results.facets, predicate);\n if (!facet) return [];\n\n return Object.keys(facet.data).map(function (name) {\n var value = escapeFacetValue(name);\n return {\n name: name,\n escapedValue: value,\n count: facet.data[name],\n isRefined: results._state.isFacetRefined(attribute, value),\n isExcluded: results._state.isExcludeRefined(attribute, name),\n };\n });\n } else if (results._state.isDisjunctiveFacet(attribute)) {\n var disjunctiveFacet = find(results.disjunctiveFacets, predicate);\n if (!disjunctiveFacet) return [];\n\n return Object.keys(disjunctiveFacet.data).map(function (name) {\n var value = escapeFacetValue(name);\n return {\n name: name,\n escapedValue: value,\n count: disjunctiveFacet.data[name],\n isRefined: results._state.isDisjunctiveFacetRefined(attribute, value),\n };\n });\n } else if (results._state.isHierarchicalFacet(attribute)) {\n var hierarchicalFacetValues = find(results.hierarchicalFacets, predicate);\n if (!hierarchicalFacetValues) return hierarchicalFacetValues;\n\n var hierarchicalFacet =\n results._state.getHierarchicalFacetByName(attribute);\n var separator =\n results._state._getHierarchicalFacetSeparator(hierarchicalFacet);\n var currentRefinement = unescapeFacetValue(\n results._state.getHierarchicalRefinement(attribute)[0] || ''\n );\n\n if (currentRefinement.indexOf(hierarchicalFacet.rootPath) === 0) {\n currentRefinement = currentRefinement.replace(\n hierarchicalFacet.rootPath + separator,\n ''\n );\n }\n\n var currentRefinementSplit = currentRefinement.split(separator);\n currentRefinementSplit.unshift(attribute);\n\n setIsRefined(hierarchicalFacetValues, currentRefinementSplit, 0);\n\n return hierarchicalFacetValues;\n }\n\n return undefined;\n}\n\n/**\n * Set the isRefined of a hierarchical facet result based on the current state.\n * @param {SearchResults.HierarchicalFacet} item Hierarchical facet to fix\n * @param {string[]} currentRefinement array of parts of the current hierarchical refinement\n * @param {number} depth recursion depth in the currentRefinement\n * @return {undefined} function mutates the item\n */\nfunction setIsRefined(item, currentRefinement, depth) {\n item.isRefined = item.name === currentRefinement[depth];\n if (item.data) {\n item.data.forEach(function (child) {\n setIsRefined(child, currentRefinement, depth + 1);\n });\n }\n}\n\n/**\n * Sort nodes of a hierarchical or disjunctive facet results\n * @private\n * @param {function} sortFn sort function to apply\n * @param {HierarchicalFacet|Array} node node upon which we want to apply the sort\n * @param {string[]} names attribute names\n * @param {number} [level=0] current index in the names array\n * @return {HierarchicalFacet|Array} sorted node\n */\nfunction recSort(sortFn, node, names, level) {\n level = level || 0;\n\n if (Array.isArray(node)) {\n return sortFn(node, names[level]);\n }\n\n if (!node.data || node.data.length === 0) {\n return node;\n }\n\n var children = node.data.map(function (childNode) {\n return recSort(sortFn, childNode, names, level + 1);\n });\n var sortedChildren = sortFn(children, names[level]);\n var newNode = defaultsPure({ data: sortedChildren }, node);\n return newNode;\n}\n\nSearchResults.DEFAULT_SORT = ['isRefined:desc', 'count:desc', 'name:asc'];\n\nfunction vanillaSortFn(order, data) {\n return data.sort(order);\n}\n\n/**\n * @typedef FacetOrdering\n * @type {Object}\n * @property {string[]} [order]\n * @property {'count' | 'alpha' | 'hidden'} [sortRemainingBy]\n */\n\n/**\n * Sorts facet arrays via their facet ordering\n * @param {Array} facetValues the values\n * @param {FacetOrdering} facetOrdering the ordering\n * @returns {Array} the sorted facet values\n */\nfunction sortViaFacetOrdering(facetValues, facetOrdering) {\n var orderedFacets = [];\n var remainingFacets = [];\n\n var order = facetOrdering.order || [];\n /**\n * an object with the keys being the values in order, the values their index:\n * ['one', 'two'] -> { one: 0, two: 1 }\n */\n var reverseOrder = order.reduce(function (acc, name, i) {\n acc[name] = i;\n return acc;\n }, {});\n\n facetValues.forEach(function (item) {\n // hierarchical facets get sorted using their raw name\n var name = item.path || item.name;\n if (reverseOrder[name] !== undefined) {\n orderedFacets[reverseOrder[name]] = item;\n } else {\n remainingFacets.push(item);\n }\n });\n\n orderedFacets = orderedFacets.filter(function (facet) {\n return facet;\n });\n\n var sortRemainingBy = facetOrdering.sortRemainingBy;\n var ordering;\n if (sortRemainingBy === 'hidden') {\n return orderedFacets;\n } else if (sortRemainingBy === 'alpha') {\n ordering = [\n ['path', 'name'],\n ['asc', 'asc'],\n ];\n } else {\n ordering = [['count'], ['desc']];\n }\n\n return orderedFacets.concat(\n orderBy(remainingFacets, ordering[0], ordering[1])\n );\n}\n\n/**\n * @param {SearchResults} results the search results class\n * @param {string} attribute the attribute to retrieve ordering of\n * @returns {FacetOrdering | undefined} the facet ordering\n */\nfunction getFacetOrdering(results, attribute) {\n return (\n results.renderingContent &&\n results.renderingContent.facetOrdering &&\n results.renderingContent.facetOrdering.values &&\n results.renderingContent.facetOrdering.values[attribute]\n );\n}\n\n/**\n * Get a the list of values for a given facet attribute. Those values are sorted\n * refinement first, descending count (bigger value on top), and name ascending\n * (alphabetical order). The sort formula can overridden using either string based\n * predicates or a function.\n *\n * This method will return all the values returned by the Algolia engine plus all\n * the values already refined. This means that it can happen that the\n * `maxValuesPerFacet` [configuration](https://www.algolia.com/doc/rest-api/search#param-maxValuesPerFacet)\n * might not be respected if you have facet values that are already refined.\n * @param {string} attribute attribute name\n * @param {object} opts configuration options.\n * @param {boolean} [opts.facetOrdering]\n * Force the use of facetOrdering from the result if a sortBy is present. If\n * sortBy isn't present, facetOrdering will be used automatically.\n * @param {Array. | function} opts.sortBy\n * When using strings, it consists of\n * the name of the [FacetValue](#SearchResults.FacetValue) or the\n * [HierarchicalFacet](#SearchResults.HierarchicalFacet) attributes with the\n * order (`asc` or `desc`). For example to order the value by count, the\n * argument would be `['count:asc']`.\n *\n * If only the attribute name is specified, the ordering defaults to the one\n * specified in the default value for this attribute.\n *\n * When not specified, the order is\n * ascending. This parameter can also be a function which takes two facet\n * values and should return a number, 0 if equal, 1 if the first argument is\n * bigger or -1 otherwise.\n *\n * The default value for this attribute `['isRefined:desc', 'count:desc', 'name:asc']`\n * @return {FacetValue[]|HierarchicalFacet|undefined} depending on the type of facet of\n * the attribute requested (hierarchical, disjunctive or conjunctive)\n * @example\n * helper.on('result', function(event){\n * //get values ordered only by name ascending using the string predicate\n * event.results.getFacetValues('city', {sortBy: ['name:asc']});\n * //get values ordered only by count ascending using a function\n * event.results.getFacetValues('city', {\n * // this is equivalent to ['count:asc']\n * sortBy: function(a, b) {\n * if (a.count === b.count) return 0;\n * if (a.count > b.count) return 1;\n * if (b.count > a.count) return -1;\n * }\n * });\n * });\n */\nSearchResults.prototype.getFacetValues = function (attribute, opts) {\n var facetValues = extractNormalizedFacetValues(this, attribute);\n if (!facetValues) {\n return undefined;\n }\n\n var options = defaultsPure({}, opts, {\n sortBy: SearchResults.DEFAULT_SORT,\n // if no sortBy is given, attempt to sort based on facetOrdering\n // if it is given, we still allow to sort via facet ordering first\n facetOrdering: !(opts && opts.sortBy),\n });\n\n // eslint-disable-next-line consistent-this\n var results = this;\n var attributes;\n if (Array.isArray(facetValues)) {\n attributes = [attribute];\n } else {\n var config = results._state.getHierarchicalFacetByName(facetValues.name);\n attributes = config.attributes;\n }\n\n return recSort(\n function (data, facetName) {\n if (options.facetOrdering) {\n var facetOrdering = getFacetOrdering(results, facetName);\n if (facetOrdering) {\n return sortViaFacetOrdering(data, facetOrdering);\n }\n }\n\n if (Array.isArray(options.sortBy)) {\n var order = formatSort(options.sortBy, SearchResults.DEFAULT_SORT);\n return orderBy(data, order[0], order[1]);\n } else if (typeof options.sortBy === 'function') {\n return vanillaSortFn(options.sortBy, data);\n }\n throw new Error(\n 'options.sortBy is optional but if defined it must be ' +\n 'either an array of string (predicates) or a sorting function'\n );\n },\n facetValues,\n attributes\n );\n};\n\n/**\n * Returns the facet stats if attribute is defined and the facet contains some.\n * Otherwise returns undefined.\n * @param {string} attribute name of the faceted attribute\n * @return {object} The stats of the facet\n */\nSearchResults.prototype.getFacetStats = function (attribute) {\n if (this._state.isConjunctiveFacet(attribute)) {\n return getFacetStatsIfAvailable(this.facets, attribute);\n } else if (this._state.isDisjunctiveFacet(attribute)) {\n return getFacetStatsIfAvailable(this.disjunctiveFacets, attribute);\n }\n\n return undefined;\n};\n\n/**\n * @typedef {Object} FacetListItem\n * @property {string} name\n */\n\n/**\n * @param {FacetListItem[]} facetList (has more items, but enough for here)\n * @param {string} facetName The attribute to look for\n * @return {object|undefined} The stats of the facet\n */\nfunction getFacetStatsIfAvailable(facetList, facetName) {\n var data = find(facetList, function (facet) {\n return facet.name === facetName;\n });\n return data && data.stats;\n}\n\n/**\n * Returns all refinements for all filters + tags. It also provides\n * additional information: count and exhaustiveness for each filter.\n *\n * See the [refinement type](#Refinement) for an exhaustive view of the available\n * data.\n *\n * Note that for a numeric refinement, results are grouped per operator, this\n * means that it will return responses for operators which are empty.\n *\n * @return {Array.} all the refinements\n */\nSearchResults.prototype.getRefinements = function () {\n var state = this._state;\n // eslint-disable-next-line consistent-this\n var results = this;\n var res = [];\n\n Object.keys(state.facetsRefinements).forEach(function (attributeName) {\n state.facetsRefinements[attributeName].forEach(function (name) {\n res.push(\n getRefinement(state, 'facet', attributeName, name, results.facets)\n );\n });\n });\n\n Object.keys(state.facetsExcludes).forEach(function (attributeName) {\n state.facetsExcludes[attributeName].forEach(function (name) {\n res.push(\n getRefinement(state, 'exclude', attributeName, name, results.facets)\n );\n });\n });\n\n Object.keys(state.disjunctiveFacetsRefinements).forEach(function (\n attributeName\n ) {\n state.disjunctiveFacetsRefinements[attributeName].forEach(function (name) {\n res.push(\n getRefinement(\n state,\n 'disjunctive',\n attributeName,\n name,\n results.disjunctiveFacets\n )\n );\n });\n });\n\n Object.keys(state.hierarchicalFacetsRefinements).forEach(function (\n attributeName\n ) {\n state.hierarchicalFacetsRefinements[attributeName].forEach(function (name) {\n res.push(\n getHierarchicalRefinement(\n state,\n attributeName,\n name,\n results.hierarchicalFacets\n )\n );\n });\n });\n\n Object.keys(state.numericRefinements).forEach(function (attributeName) {\n var operators = state.numericRefinements[attributeName];\n Object.keys(operators).forEach(function (operator) {\n operators[operator].forEach(function (value) {\n res.push({\n type: 'numeric',\n attributeName: attributeName,\n name: value,\n numericValue: value,\n operator: operator,\n });\n });\n });\n });\n\n state.tagRefinements.forEach(function (name) {\n res.push({ type: 'tag', attributeName: '_tags', name: name });\n });\n\n return res;\n};\n\n/**\n * @typedef {Object} Facet\n * @property {string} name\n * @property {Object} data\n * @property {boolean} exhaustive\n */\n\n/**\n * @param {SearchParameters} state the current state\n * @param {string} type the type of the refinement\n * @param {string} attributeName The attribute of the facet\n * @param {*} name The name of the facet\n * @param {Facet[]} resultsFacets facets from the results\n * @return {Refinement} the refinement\n */\nfunction getRefinement(state, type, attributeName, name, resultsFacets) {\n var facet = find(resultsFacets, function (f) {\n return f.name === attributeName;\n });\n var count = facet && facet.data && facet.data[name] ? facet.data[name] : 0;\n var exhaustive = (facet && facet.exhaustive) || false;\n\n return {\n type: type,\n attributeName: attributeName,\n name: name,\n count: count,\n exhaustive: exhaustive,\n };\n}\n\n/**\n * @param {SearchParameters} state the current state\n * @param {string} attributeName the attribute of the hierarchical facet\n * @param {string} name the name of the facet\n * @param {Facet[]} resultsFacets facets from the results\n * @return {HierarchicalFacet} the hierarchical facet\n */\nfunction getHierarchicalRefinement(state, attributeName, name, resultsFacets) {\n var facetDeclaration = state.getHierarchicalFacetByName(attributeName);\n var separator = state._getHierarchicalFacetSeparator(facetDeclaration);\n var split = name.split(separator);\n var rootFacet = find(resultsFacets, function (facet) {\n return facet.name === attributeName;\n });\n\n var facet = split.reduce(function (intermediateFacet, part) {\n var newFacet =\n intermediateFacet &&\n find(intermediateFacet.data, function (f) {\n return f.name === part;\n });\n return newFacet !== undefined ? newFacet : intermediateFacet;\n }, rootFacet);\n\n var count = (facet && facet.count) || 0;\n var exhaustive = (facet && facet.exhaustive) || false;\n var path = (facet && facet.path) || '';\n\n return {\n type: 'hierarchical',\n attributeName: attributeName,\n name: path,\n count: count,\n exhaustive: exhaustive,\n };\n}\n\nmodule.exports = SearchResults;\n","'use strict';\n\nvar EventEmitter = require('@algolia/events');\n\nvar DerivedHelper = require('./DerivedHelper');\nvar escapeFacetValue = require('./functions/escapeFacetValue').escapeFacetValue;\nvar inherits = require('./functions/inherits');\nvar merge = require('./functions/merge');\nvar objectHasKeys = require('./functions/objectHasKeys');\nvar omit = require('./functions/omit');\nvar requestBuilder = require('./requestBuilder');\nvar SearchParameters = require('./SearchParameters');\nvar SearchResults = require('./SearchResults');\nvar version = require('./version');\n\n/**\n * Event triggered when a parameter is set or updated\n * @event AlgoliaSearchHelper#event:change\n * @property {object} event\n * @property {SearchParameters} event.state the current parameters with the latest changes applied\n * @property {SearchResults} event.results the previous results received from Algolia. `null` before the first request\n * @example\n * helper.on('change', function(event) {\n * console.log('The parameters have changed');\n * });\n */\n\n/**\n * Event triggered when a main search is sent to Algolia\n * @event AlgoliaSearchHelper#event:search\n * @property {object} event\n * @property {SearchParameters} event.state the parameters used for this search\n * @property {SearchResults} event.results the results from the previous search. `null` if it is the first search.\n * @example\n * helper.on('search', function(event) {\n * console.log('Search sent');\n * });\n */\n\n/**\n * Event triggered when a search using `searchForFacetValues` is sent to Algolia\n * @event AlgoliaSearchHelper#event:searchForFacetValues\n * @property {object} event\n * @property {SearchParameters} event.state the parameters used for this search it is the first search.\n * @property {string} event.facet the facet searched into\n * @property {string} event.query the query used to search in the facets\n * @example\n * helper.on('searchForFacetValues', function(event) {\n * console.log('searchForFacetValues sent');\n * });\n */\n\n/**\n * Event triggered when a search using `searchOnce` is sent to Algolia\n * @event AlgoliaSearchHelper#event:searchOnce\n * @property {object} event\n * @property {SearchParameters} event.state the parameters used for this search it is the first search.\n * @example\n * helper.on('searchOnce', function(event) {\n * console.log('searchOnce sent');\n * });\n */\n\n/**\n * Event triggered when the results are retrieved from Algolia\n * @event AlgoliaSearchHelper#event:result\n * @property {object} event\n * @property {SearchResults} event.results the results received from Algolia\n * @property {SearchParameters} event.state the parameters used to query Algolia. Those might be different from the one in the helper instance (for example if the network is unreliable).\n * @example\n * helper.on('result', function(event) {\n * console.log('Search results received');\n * });\n */\n\n/**\n * Event triggered when Algolia sends back an error. For example, if an unknown parameter is\n * used, the error can be caught using this event.\n * @event AlgoliaSearchHelper#event:error\n * @property {object} event\n * @property {Error} event.error the error returned by the Algolia.\n * @example\n * helper.on('error', function(event) {\n * console.log('Houston we got a problem.');\n * });\n */\n\n/**\n * Event triggered when the queue of queries have been depleted (with any result or outdated queries)\n * @event AlgoliaSearchHelper#event:searchQueueEmpty\n * @example\n * helper.on('searchQueueEmpty', function() {\n * console.log('No more search pending');\n * // This is received before the result event if we're not expecting new results\n * });\n *\n * helper.search();\n */\n\n/**\n * Initialize a new AlgoliaSearchHelper\n * @class\n * @classdesc The AlgoliaSearchHelper is a class that ease the management of the\n * search. It provides an event based interface for search callbacks:\n * - change: when the internal search state is changed.\n * This event contains a {@link SearchParameters} object and the\n * {@link SearchResults} of the last result if any.\n * - search: when a search is triggered using the `search()` method.\n * - result: when the response is retrieved from Algolia and is processed.\n * This event contains a {@link SearchResults} object and the\n * {@link SearchParameters} corresponding to this answer.\n * - error: when the response is an error. This event contains the error returned by the server.\n * @param {AlgoliaSearch} client an AlgoliaSearch client\n * @param {string} index the index name to query\n * @param {SearchParameters | object} options an object defining the initial\n * config of the search. It doesn't have to be a {SearchParameters},\n * just an object containing the properties you need from it.\n */\nfunction AlgoliaSearchHelper(client, index, options) {\n if (typeof client.addAlgoliaAgent === 'function') {\n client.addAlgoliaAgent('JS Helper (' + version + ')');\n }\n\n this.setClient(client);\n var opts = options || {};\n opts.index = index;\n this.state = SearchParameters.make(opts);\n this.lastResults = null;\n this._queryId = 0;\n this._lastQueryIdReceived = -1;\n this.derivedHelpers = [];\n this._currentNbQueries = 0;\n}\n\ninherits(AlgoliaSearchHelper, EventEmitter);\n\n/**\n * Start the search with the parameters set in the state. When the\n * method is called, it triggers a `search` event. The results will\n * be available through the `result` event. If an error occurs, an\n * `error` will be fired instead.\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires search\n * @fires result\n * @fires error\n * @chainable\n */\nAlgoliaSearchHelper.prototype.search = function () {\n this._search({ onlyWithDerivedHelpers: false });\n return this;\n};\n\nAlgoliaSearchHelper.prototype.searchOnlyWithDerivedHelpers = function () {\n this._search({ onlyWithDerivedHelpers: true });\n return this;\n};\n\n/**\n * Gets the search query parameters that would be sent to the Algolia Client\n * for the hits\n * @return {object} Query Parameters\n */\nAlgoliaSearchHelper.prototype.getQuery = function () {\n var state = this.state;\n return requestBuilder._getHitsSearchParams(state);\n};\n\n/**\n * Start a search using a modified version of the current state. This method does\n * not trigger the helper lifecycle and does not modify the state kept internally\n * by the helper. This second aspect means that the next search call will be the\n * same as a search call before calling searchOnce.\n * @param {object} options can contain all the parameters that can be set to SearchParameters\n * plus the index\n * @param {function} [cb] optional callback executed when the response from the\n * server is back.\n * @return {promise|undefined} if a callback is passed the method returns undefined\n * otherwise it returns a promise containing an object with two keys :\n * - content with a SearchResults\n * - state with the state used for the query as a SearchParameters\n * @example\n * // Changing the number of records returned per page to 1\n * // This example uses the callback API\n * var state = helper.searchOnce({hitsPerPage: 1},\n * function(error, content, state) {\n * // if an error occurred it will be passed in error, otherwise its value is null\n * // content contains the results formatted as a SearchResults\n * // state is the instance of SearchParameters used for this search\n * });\n * @example\n * // Changing the number of records returned per page to 1\n * // This example uses the promise API\n * var state1 = helper.searchOnce({hitsPerPage: 1})\n * .then(promiseHandler);\n *\n * function promiseHandler(res) {\n * // res contains\n * // {\n * // content : SearchResults\n * // state : SearchParameters (the one used for this specific search)\n * // }\n * }\n */\nAlgoliaSearchHelper.prototype.searchOnce = function (options, cb) {\n var tempState = !options\n ? this.state\n : this.state.setQueryParameters(options);\n var queries = requestBuilder._getQueries(tempState.index, tempState);\n // eslint-disable-next-line consistent-this\n var self = this;\n\n this._currentNbQueries++;\n\n this.emit('searchOnce', {\n state: tempState,\n });\n\n if (cb) {\n this.client\n .search(queries)\n .then(function (content) {\n self._currentNbQueries--;\n if (self._currentNbQueries === 0) {\n self.emit('searchQueueEmpty');\n }\n\n cb(null, new SearchResults(tempState, content.results), tempState);\n })\n .catch(function (err) {\n self._currentNbQueries--;\n if (self._currentNbQueries === 0) {\n self.emit('searchQueueEmpty');\n }\n\n cb(err, null, tempState);\n });\n\n return undefined;\n }\n\n return this.client.search(queries).then(\n function (content) {\n self._currentNbQueries--;\n if (self._currentNbQueries === 0) self.emit('searchQueueEmpty');\n return {\n content: new SearchResults(tempState, content.results),\n state: tempState,\n _originalResponse: content,\n };\n },\n function (e) {\n self._currentNbQueries--;\n if (self._currentNbQueries === 0) self.emit('searchQueueEmpty');\n throw e;\n }\n );\n};\n\n/**\n * Start the search for answers with the parameters set in the state.\n * This method returns a promise.\n * @param {Object} options - the options for answers API call\n * @param {string[]} options.attributesForPrediction - Attributes to use for predictions. If empty, `searchableAttributes` is used instead.\n * @param {string[]} options.queryLanguages - The languages in the query. Currently only supports ['en'].\n * @param {number} options.nbHits - Maximum number of answers to retrieve from the Answers Engine. Cannot be greater than 1000.\n *\n * @return {promise} the answer results\n * @deprecated answers is deprecated and will be replaced with new initiatives\n */\nAlgoliaSearchHelper.prototype.findAnswers = function (options) {\n // eslint-disable-next-line no-console\n console.warn('[algoliasearch-helper] answers is no longer supported');\n var state = this.state;\n var derivedHelper = this.derivedHelpers[0];\n if (!derivedHelper) {\n return Promise.resolve([]);\n }\n var derivedState = derivedHelper.getModifiedState(state);\n var data = merge(\n {\n attributesForPrediction: options.attributesForPrediction,\n nbHits: options.nbHits,\n },\n {\n params: omit(requestBuilder._getHitsSearchParams(derivedState), [\n 'attributesToSnippet',\n 'hitsPerPage',\n 'restrictSearchableAttributes',\n 'snippetEllipsisText',\n ]),\n }\n );\n\n var errorMessage =\n 'search for answers was called, but this client does not have a function client.initIndex(index).findAnswers';\n if (typeof this.client.initIndex !== 'function') {\n throw new Error(errorMessage);\n }\n var index = this.client.initIndex(derivedState.index);\n if (typeof index.findAnswers !== 'function') {\n throw new Error(errorMessage);\n }\n return index.findAnswers(derivedState.query, options.queryLanguages, data);\n};\n\n/**\n * Structure of each result when using\n * [`searchForFacetValues()`](reference.html#AlgoliaSearchHelper#searchForFacetValues)\n * @typedef FacetSearchHit\n * @type {object}\n * @property {string} value the facet value\n * @property {string} highlighted the facet value highlighted with the query string\n * @property {number} count number of occurrence of this facet value\n * @property {boolean} isRefined true if the value is already refined\n */\n\n/**\n * Structure of the data resolved by the\n * [`searchForFacetValues()`](reference.html#AlgoliaSearchHelper#searchForFacetValues)\n * promise.\n * @typedef FacetSearchResult\n * @type {object}\n * @property {FacetSearchHit} facetHits the results for this search for facet values\n * @property {number} processingTimeMS time taken by the query inside the engine\n */\n\n/**\n * Search for facet values based on an query and the name of a faceted attribute. This\n * triggers a search and will return a promise. On top of using the query, it also sends\n * the parameters from the state so that the search is narrowed down to only the possible values.\n *\n * See the description of [FacetSearchResult](reference.html#FacetSearchResult)\n * @param {string} facet the name of the faceted attribute\n * @param {string} query the string query for the search\n * @param {number} [maxFacetHits] the maximum number values returned. Should be > 0 and <= 100\n * @param {object} [userState] the set of custom parameters to use on top of the current state. Setting a property to `undefined` removes\n * it in the generated query.\n * @return {promise.} the results of the search\n */\nAlgoliaSearchHelper.prototype.searchForFacetValues = function (\n facet,\n query,\n maxFacetHits,\n userState\n) {\n var clientHasSFFV = typeof this.client.searchForFacetValues === 'function';\n var clientHasInitIndex = typeof this.client.initIndex === 'function';\n if (\n !clientHasSFFV &&\n !clientHasInitIndex &&\n typeof this.client.search !== 'function'\n ) {\n throw new Error(\n 'search for facet values (searchable) was called, but this client does not have a function client.searchForFacetValues or client.initIndex(index).searchForFacetValues'\n );\n }\n\n var state = this.state.setQueryParameters(userState || {});\n var isDisjunctive = state.isDisjunctiveFacet(facet);\n var algoliaQuery = requestBuilder.getSearchForFacetQuery(\n facet,\n query,\n maxFacetHits,\n state\n );\n\n this._currentNbQueries++;\n // eslint-disable-next-line consistent-this\n var self = this;\n var searchForFacetValuesPromise;\n // newer algoliasearch ^3.27.1 - ~4.0.0\n if (clientHasSFFV) {\n searchForFacetValuesPromise = this.client.searchForFacetValues([\n { indexName: state.index, params: algoliaQuery },\n ]);\n // algoliasearch < 3.27.1\n } else if (clientHasInitIndex) {\n searchForFacetValuesPromise = this.client\n .initIndex(state.index)\n .searchForFacetValues(algoliaQuery);\n // algoliasearch ~5.0.0\n } else {\n // @MAJOR only use client.search\n delete algoliaQuery.facetName;\n searchForFacetValuesPromise = this.client\n .search([\n {\n type: 'facet',\n facet: facet,\n indexName: state.index,\n params: algoliaQuery,\n },\n ])\n .then(function processResponse(response) {\n return response.results[0];\n });\n }\n\n this.emit('searchForFacetValues', {\n state: state,\n facet: facet,\n query: query,\n });\n\n return searchForFacetValuesPromise.then(\n function addIsRefined(content) {\n self._currentNbQueries--;\n if (self._currentNbQueries === 0) self.emit('searchQueueEmpty');\n\n content = Array.isArray(content) ? content[0] : content;\n\n content.facetHits.forEach(function (f) {\n f.escapedValue = escapeFacetValue(f.value);\n f.isRefined = isDisjunctive\n ? state.isDisjunctiveFacetRefined(facet, f.escapedValue)\n : state.isFacetRefined(facet, f.escapedValue);\n });\n\n return content;\n },\n function (e) {\n self._currentNbQueries--;\n if (self._currentNbQueries === 0) self.emit('searchQueueEmpty');\n throw e;\n }\n );\n};\n\n/**\n * Sets the text query used for the search.\n *\n * This method resets the current page to 0.\n * @param {string} q the user query\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.setQuery = function (q) {\n this._change({\n state: this.state.resetPage().setQuery(q),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Remove all the types of refinements except tags. A string can be provided to remove\n * only the refinements of a specific attribute. For more advanced use case, you can\n * provide a function instead. This function should follow the\n * [clearCallback definition](#SearchParameters.clearCallback).\n *\n * This method resets the current page to 0.\n * @param {string} [name] optional name of the facet / attribute on which we want to remove all refinements\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n * @example\n * // Removing all the refinements\n * helper.clearRefinements().search();\n * @example\n * // Removing all the filters on a the category attribute.\n * helper.clearRefinements('category').search();\n * @example\n * // Removing only the exclude filters on the category facet.\n * helper.clearRefinements(function(value, attribute, type) {\n * return type === 'exclude' && attribute === 'category';\n * }).search();\n */\nAlgoliaSearchHelper.prototype.clearRefinements = function (name) {\n this._change({\n state: this.state.resetPage().clearRefinements(name),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Remove all the tag filters.\n *\n * This method resets the current page to 0.\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.clearTags = function () {\n this._change({\n state: this.state.resetPage().clearTags(),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Adds a disjunctive filter to a faceted attribute with the `value` provided. If the\n * filter is already set, it doesn't change the filters.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} value the associated value (will be converted to string)\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.addDisjunctiveFacetRefinement = function (\n facet,\n value\n) {\n this._change({\n state: this.state.resetPage().addDisjunctiveFacetRefinement(facet, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#addDisjunctiveFacetRefinement}\n */\nAlgoliaSearchHelper.prototype.addDisjunctiveRefine = function () {\n return this.addDisjunctiveFacetRefinement.apply(this, arguments);\n};\n\n/**\n * Adds a refinement on a hierarchical facet. It will throw\n * an exception if the facet is not defined or if the facet\n * is already refined.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet name\n * @param {string} path the hierarchical facet path\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @throws Error if the facet is not defined or if the facet is refined\n * @chainable\n * @fires change\n */\nAlgoliaSearchHelper.prototype.addHierarchicalFacetRefinement = function (\n facet,\n path\n) {\n this._change({\n state: this.state.resetPage().addHierarchicalFacetRefinement(facet, path),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Adds a an numeric filter to an attribute with the `operator` and `value` provided. If the\n * filter is already set, it doesn't change the filters.\n *\n * This method resets the current page to 0.\n * @param {string} attribute the attribute on which the numeric filter applies\n * @param {string} operator the operator of the filter\n * @param {number} value the value of the filter\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.addNumericRefinement = function (\n attribute,\n operator,\n value\n) {\n this._change({\n state: this.state\n .resetPage()\n .addNumericRefinement(attribute, operator, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Adds a filter to a faceted attribute with the `value` provided. If the\n * filter is already set, it doesn't change the filters.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} value the associated value (will be converted to string)\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.addFacetRefinement = function (facet, value) {\n this._change({\n state: this.state.resetPage().addFacetRefinement(facet, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#addFacetRefinement}\n */\nAlgoliaSearchHelper.prototype.addRefine = function () {\n return this.addFacetRefinement.apply(this, arguments);\n};\n\n/**\n * Adds a an exclusion filter to a faceted attribute with the `value` provided. If the\n * filter is already set, it doesn't change the filters.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} value the associated value (will be converted to string)\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.addFacetExclusion = function (facet, value) {\n this._change({\n state: this.state.resetPage().addExcludeRefinement(facet, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#addFacetExclusion}\n */\nAlgoliaSearchHelper.prototype.addExclude = function () {\n return this.addFacetExclusion.apply(this, arguments);\n};\n\n/**\n * Adds a tag filter with the `tag` provided. If the\n * filter is already set, it doesn't change the filters.\n *\n * This method resets the current page to 0.\n * @param {string} tag the tag to add to the filter\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.addTag = function (tag) {\n this._change({\n state: this.state.resetPage().addTagRefinement(tag),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Removes an numeric filter to an attribute with the `operator` and `value` provided. If the\n * filter is not set, it doesn't change the filters.\n *\n * Some parameters are optional, triggering different behavior:\n * - if the value is not provided, then all the numeric value will be removed for the\n * specified attribute/operator couple.\n * - if the operator is not provided either, then all the numeric filter on this attribute\n * will be removed.\n *\n * This method resets the current page to 0.\n * @param {string} attribute the attribute on which the numeric filter applies\n * @param {string} [operator] the operator of the filter\n * @param {number} [value] the value of the filter\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeNumericRefinement = function (\n attribute,\n operator,\n value\n) {\n this._change({\n state: this.state\n .resetPage()\n .removeNumericRefinement(attribute, operator, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Removes a disjunctive filter to a faceted attribute with the `value` provided. If the\n * filter is not set, it doesn't change the filters.\n *\n * If the value is omitted, then this method will remove all the filters for the\n * attribute.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} [value] the associated value\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeDisjunctiveFacetRefinement = function (\n facet,\n value\n) {\n this._change({\n state: this.state\n .resetPage()\n .removeDisjunctiveFacetRefinement(facet, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#removeDisjunctiveFacetRefinement}\n */\nAlgoliaSearchHelper.prototype.removeDisjunctiveRefine = function () {\n return this.removeDisjunctiveFacetRefinement.apply(this, arguments);\n};\n\n/**\n * Removes the refinement set on a hierarchical facet.\n * @param {string} facet the facet name\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @throws Error if the facet is not defined or if the facet is not refined\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeHierarchicalFacetRefinement = function (\n facet\n) {\n this._change({\n state: this.state.resetPage().removeHierarchicalFacetRefinement(facet),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Removes a filter to a faceted attribute with the `value` provided. If the\n * filter is not set, it doesn't change the filters.\n *\n * If the value is omitted, then this method will remove all the filters for the\n * attribute.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} [value] the associated value\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeFacetRefinement = function (facet, value) {\n this._change({\n state: this.state.resetPage().removeFacetRefinement(facet, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#removeFacetRefinement}\n */\nAlgoliaSearchHelper.prototype.removeRefine = function () {\n return this.removeFacetRefinement.apply(this, arguments);\n};\n\n/**\n * Removes an exclusion filter to a faceted attribute with the `value` provided. If the\n * filter is not set, it doesn't change the filters.\n *\n * If the value is omitted, then this method will remove all the filters for the\n * attribute.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} [value] the associated value\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeFacetExclusion = function (facet, value) {\n this._change({\n state: this.state.resetPage().removeExcludeRefinement(facet, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#removeFacetExclusion}\n */\nAlgoliaSearchHelper.prototype.removeExclude = function () {\n return this.removeFacetExclusion.apply(this, arguments);\n};\n\n/**\n * Removes a tag filter with the `tag` provided. If the\n * filter is not set, it doesn't change the filters.\n *\n * This method resets the current page to 0.\n * @param {string} tag tag to remove from the filter\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeTag = function (tag) {\n this._change({\n state: this.state.resetPage().removeTagRefinement(tag),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Adds or removes an exclusion filter to a faceted attribute with the `value` provided. If\n * the value is set then it removes it, otherwise it adds the filter.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} value the associated value\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.toggleFacetExclusion = function (facet, value) {\n this._change({\n state: this.state.resetPage().toggleExcludeFacetRefinement(facet, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#toggleFacetExclusion}\n */\nAlgoliaSearchHelper.prototype.toggleExclude = function () {\n return this.toggleFacetExclusion.apply(this, arguments);\n};\n\n/**\n * Adds or removes a filter to a faceted attribute with the `value` provided. If\n * the value is set then it removes it, otherwise it adds the filter.\n *\n * This method can be used for conjunctive, disjunctive and hierarchical filters.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} value the associated value\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @throws Error will throw an error if the facet is not declared in the settings of the helper\n * @fires change\n * @chainable\n * @deprecated since version 2.19.0, see {@link AlgoliaSearchHelper#toggleFacetRefinement}\n */\nAlgoliaSearchHelper.prototype.toggleRefinement = function (facet, value) {\n return this.toggleFacetRefinement(facet, value);\n};\n\n/**\n * Adds or removes a filter to a faceted attribute with the `value` provided. If\n * the value is set then it removes it, otherwise it adds the filter.\n *\n * This method can be used for conjunctive, disjunctive and hierarchical filters.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} value the associated value\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @throws Error will throw an error if the facet is not declared in the settings of the helper\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.toggleFacetRefinement = function (facet, value) {\n this._change({\n state: this.state.resetPage().toggleFacetRefinement(facet, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#toggleFacetRefinement}\n */\nAlgoliaSearchHelper.prototype.toggleRefine = function () {\n return this.toggleFacetRefinement.apply(this, arguments);\n};\n\n/**\n * Adds or removes a tag filter with the `value` provided. If\n * the value is set then it removes it, otherwise it adds the filter.\n *\n * This method resets the current page to 0.\n * @param {string} tag tag to remove or add\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.toggleTag = function (tag) {\n this._change({\n state: this.state.resetPage().toggleTagRefinement(tag),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Increments the page number by one.\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n * @example\n * helper.setPage(0).nextPage().getPage();\n * // returns 1\n */\nAlgoliaSearchHelper.prototype.nextPage = function () {\n var page = this.state.page || 0;\n return this.setPage(page + 1);\n};\n\n/**\n * Decrements the page number by one.\n * @fires change\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @chainable\n * @example\n * helper.setPage(1).previousPage().getPage();\n * // returns 0\n */\nAlgoliaSearchHelper.prototype.previousPage = function () {\n var page = this.state.page || 0;\n return this.setPage(page - 1);\n};\n\n/**\n * @private\n * @param {number} page The page number\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @chainable\n * @fires change\n */\nfunction setCurrentPage(page) {\n if (page < 0) throw new Error('Page requested below 0.');\n\n this._change({\n state: this.state.setPage(page),\n isPageReset: false,\n });\n\n return this;\n}\n\n/**\n * Change the current page\n * @deprecated\n * @param {number} page The page number\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.setCurrentPage = setCurrentPage;\n\n/**\n * Updates the current page.\n * @function\n * @param {number} page The page number\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.setPage = setCurrentPage;\n\n/**\n * Updates the name of the index that will be targeted by the query.\n *\n * This method resets the current page to 0.\n * @param {string} name the index name\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.setIndex = function (name) {\n this._change({\n state: this.state.resetPage().setIndex(name),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Update a parameter of the search. This method reset the page\n *\n * The complete list of parameters is available on the\n * [Algolia website](https://www.algolia.com/doc/rest#query-an-index).\n * The most commonly used parameters have their own [shortcuts](#query-parameters-shortcuts)\n * or benefit from higher-level APIs (all the kind of filters and facets have their own API)\n *\n * This method resets the current page to 0.\n * @param {string} parameter name of the parameter to update\n * @param {any} value new value of the parameter\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n * @example\n * helper.setQueryParameter('hitsPerPage', 20).search();\n */\nAlgoliaSearchHelper.prototype.setQueryParameter = function (parameter, value) {\n this._change({\n state: this.state.resetPage().setQueryParameter(parameter, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Set the whole state (warning: will erase previous state)\n * @param {SearchParameters} newState the whole new state\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.setState = function (newState) {\n this._change({\n state: SearchParameters.make(newState),\n isPageReset: false,\n });\n\n return this;\n};\n\n/**\n * Override the current state without triggering a change event.\n * Do not use this method unless you know what you are doing. (see the example\n * for a legit use case)\n * @param {SearchParameters} newState the whole new state\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @example\n * helper.on('change', function(state){\n * // In this function you might want to find a way to store the state in the url/history\n * updateYourURL(state)\n * })\n * window.onpopstate = function(event){\n * // This is naive though as you should check if the state is really defined etc.\n * helper.overrideStateWithoutTriggeringChangeEvent(event.state).search()\n * }\n * @chainable\n */\nAlgoliaSearchHelper.prototype.overrideStateWithoutTriggeringChangeEvent =\n function (newState) {\n this.state = new SearchParameters(newState);\n return this;\n };\n\n/**\n * Check if an attribute has any numeric, conjunctive, disjunctive or hierarchical filters.\n * @param {string} attribute the name of the attribute\n * @return {boolean} true if the attribute is filtered by at least one value\n * @example\n * // hasRefinements works with numeric, conjunctive, disjunctive and hierarchical filters\n * helper.hasRefinements('price'); // false\n * helper.addNumericRefinement('price', '>', 100);\n * helper.hasRefinements('price'); // true\n *\n * helper.hasRefinements('color'); // false\n * helper.addFacetRefinement('color', 'blue');\n * helper.hasRefinements('color'); // true\n *\n * helper.hasRefinements('material'); // false\n * helper.addDisjunctiveFacetRefinement('material', 'plastic');\n * helper.hasRefinements('material'); // true\n *\n * helper.hasRefinements('categories'); // false\n * helper.toggleFacetRefinement('categories', 'kitchen > knife');\n * helper.hasRefinements('categories'); // true\n *\n */\nAlgoliaSearchHelper.prototype.hasRefinements = function (attribute) {\n if (objectHasKeys(this.state.getNumericRefinements(attribute))) {\n return true;\n } else if (this.state.isConjunctiveFacet(attribute)) {\n return this.state.isFacetRefined(attribute);\n } else if (this.state.isDisjunctiveFacet(attribute)) {\n return this.state.isDisjunctiveFacetRefined(attribute);\n } else if (this.state.isHierarchicalFacet(attribute)) {\n return this.state.isHierarchicalFacetRefined(attribute);\n }\n\n // there's currently no way to know that the user did call `addNumericRefinement` at some point\n // thus we cannot distinguish if there once was a numeric refinement that was cleared\n // so we will return false in every other situations to be consistent\n // while what we should do here is throw because we did not find the attribute in any type\n // of refinement\n return false;\n};\n\n/**\n * Check if a value is excluded for a specific faceted attribute. If the value\n * is omitted then the function checks if there is any excluding refinements.\n *\n * @param {string} facet name of the attribute for used for faceting\n * @param {string} [value] optional value. If passed will test that this value\n * is filtering the given facet.\n * @return {boolean} true if refined\n * @example\n * helper.isExcludeRefined('color'); // false\n * helper.isExcludeRefined('color', 'blue') // false\n * helper.isExcludeRefined('color', 'red') // false\n *\n * helper.addFacetExclusion('color', 'red');\n *\n * helper.isExcludeRefined('color'); // true\n * helper.isExcludeRefined('color', 'blue') // false\n * helper.isExcludeRefined('color', 'red') // true\n */\nAlgoliaSearchHelper.prototype.isExcluded = function (facet, value) {\n return this.state.isExcludeRefined(facet, value);\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since 2.4.0, see {@link AlgoliaSearchHelper#hasRefinements}\n */\nAlgoliaSearchHelper.prototype.isDisjunctiveRefined = function (facet, value) {\n return this.state.isDisjunctiveFacetRefined(facet, value);\n};\n\n/**\n * Check if the string is a currently filtering tag.\n * @param {string} tag tag to check\n * @return {boolean} true if the tag is currently refined\n */\nAlgoliaSearchHelper.prototype.hasTag = function (tag) {\n return this.state.isTagRefined(tag);\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since 2.4.0, see {@link AlgoliaSearchHelper#hasTag}\n */\nAlgoliaSearchHelper.prototype.isTagRefined = function () {\n return this.hasTagRefinements.apply(this, arguments);\n};\n\n/**\n * Get the name of the currently used index.\n * @return {string} name of the index\n * @example\n * helper.setIndex('highestPrice_products').getIndex();\n * // returns 'highestPrice_products'\n */\nAlgoliaSearchHelper.prototype.getIndex = function () {\n return this.state.index;\n};\n\nfunction getCurrentPage() {\n return this.state.page;\n}\n\n/**\n * Get the currently selected page\n * @deprecated\n * @return {number} the current page\n */\nAlgoliaSearchHelper.prototype.getCurrentPage = getCurrentPage;\n/**\n * Get the currently selected page\n * @function\n * @return {number} the current page\n */\nAlgoliaSearchHelper.prototype.getPage = getCurrentPage;\n\n/**\n * Get all the tags currently set to filters the results.\n *\n * @return {string[]} The list of tags currently set.\n */\nAlgoliaSearchHelper.prototype.getTags = function () {\n return this.state.tagRefinements;\n};\n\n/**\n * Get the list of refinements for a given attribute. This method works with\n * conjunctive, disjunctive, excluding and numerical filters.\n *\n * See also SearchResults#getRefinements\n *\n * @param {string} facetName attribute name used for faceting\n * @return {Array.} All Refinement are objects that contain a value, and\n * a type. Numeric also contains an operator.\n * @example\n * helper.addNumericRefinement('price', '>', 100);\n * helper.getRefinements('price');\n * // [\n * // {\n * // \"value\": [\n * // 100\n * // ],\n * // \"operator\": \">\",\n * // \"type\": \"numeric\"\n * // }\n * // ]\n * @example\n * helper.addFacetRefinement('color', 'blue');\n * helper.addFacetExclusion('color', 'red');\n * helper.getRefinements('color');\n * // [\n * // {\n * // \"value\": \"blue\",\n * // \"type\": \"conjunctive\"\n * // },\n * // {\n * // \"value\": \"red\",\n * // \"type\": \"exclude\"\n * // }\n * // ]\n * @example\n * helper.addDisjunctiveFacetRefinement('material', 'plastic');\n * // [\n * // {\n * // \"value\": \"plastic\",\n * // \"type\": \"disjunctive\"\n * // }\n * // ]\n */\nAlgoliaSearchHelper.prototype.getRefinements = function (facetName) {\n var refinements = [];\n\n if (this.state.isConjunctiveFacet(facetName)) {\n var conjRefinements = this.state.getConjunctiveRefinements(facetName);\n\n conjRefinements.forEach(function (r) {\n refinements.push({\n value: r,\n type: 'conjunctive',\n });\n });\n\n var excludeRefinements = this.state.getExcludeRefinements(facetName);\n\n excludeRefinements.forEach(function (r) {\n refinements.push({\n value: r,\n type: 'exclude',\n });\n });\n } else if (this.state.isDisjunctiveFacet(facetName)) {\n var disjunctiveRefinements =\n this.state.getDisjunctiveRefinements(facetName);\n\n disjunctiveRefinements.forEach(function (r) {\n refinements.push({\n value: r,\n type: 'disjunctive',\n });\n });\n }\n\n var numericRefinements = this.state.getNumericRefinements(facetName);\n\n Object.keys(numericRefinements).forEach(function (operator) {\n var value = numericRefinements[operator];\n\n refinements.push({\n value: value,\n operator: operator,\n type: 'numeric',\n });\n });\n\n return refinements;\n};\n\n/**\n * Return the current refinement for the (attribute, operator)\n * @param {string} attribute attribute in the record\n * @param {string} operator operator applied on the refined values\n * @return {Array.} refined values\n */\nAlgoliaSearchHelper.prototype.getNumericRefinement = function (\n attribute,\n operator\n) {\n return this.state.getNumericRefinement(attribute, operator);\n};\n\n/**\n * Get the current breadcrumb for a hierarchical facet, as an array\n * @param {string} facetName Hierarchical facet name\n * @return {array.} the path as an array of string\n */\nAlgoliaSearchHelper.prototype.getHierarchicalFacetBreadcrumb = function (\n facetName\n) {\n return this.state.getHierarchicalFacetBreadcrumb(facetName);\n};\n\n// /////////// PRIVATE\n\n/**\n * Perform the underlying queries\n * @private\n * @param {object} options options for the query\n * @param {boolean} [options.onlyWithDerivedHelpers=false] if true, only the derived helpers will be queried\n * @return {undefined} does not return anything\n * @fires search\n * @fires result\n * @fires error\n */\nAlgoliaSearchHelper.prototype._search = function (options) {\n var state = this.state;\n var states = [];\n var mainQueries = [];\n\n if (!options.onlyWithDerivedHelpers) {\n mainQueries = requestBuilder._getQueries(state.index, state);\n\n states.push({\n state: state,\n queriesCount: mainQueries.length,\n helper: this,\n });\n\n this.emit('search', {\n state: state,\n results: this.lastResults,\n });\n }\n\n var derivedQueries = this.derivedHelpers.map(function (derivedHelper) {\n var derivedState = derivedHelper.getModifiedState(state);\n var derivedStateQueries = derivedState.index\n ? requestBuilder._getQueries(derivedState.index, derivedState)\n : [];\n\n states.push({\n state: derivedState,\n queriesCount: derivedStateQueries.length,\n helper: derivedHelper,\n });\n\n derivedHelper.emit('search', {\n state: derivedState,\n results: derivedHelper.lastResults,\n });\n\n return derivedStateQueries;\n });\n\n var queries = Array.prototype.concat.apply(mainQueries, derivedQueries);\n\n var queryId = this._queryId++;\n this._currentNbQueries++;\n\n if (!queries.length) {\n return Promise.resolve({ results: [] }).then(\n this._dispatchAlgoliaResponse.bind(this, states, queryId)\n );\n }\n\n try {\n this.client\n .search(queries)\n .then(this._dispatchAlgoliaResponse.bind(this, states, queryId))\n .catch(this._dispatchAlgoliaError.bind(this, queryId));\n } catch (error) {\n // If we reach this part, we're in an internal error state\n this.emit('error', {\n error: error,\n });\n }\n\n return undefined;\n};\n\n/**\n * Transform the responses as sent by the server and transform them into a user\n * usable object that merge the results of all the batch requests. It will dispatch\n * over the different helper + derived helpers (when there are some).\n * @private\n * @param {array.<{SearchParameters, AlgoliaQueries, AlgoliaSearchHelper}>} states state used to generate the request\n * @param {number} queryId id of the current request\n * @param {object} content content of the response\n * @return {undefined}\n */\nAlgoliaSearchHelper.prototype._dispatchAlgoliaResponse = function (\n states,\n queryId,\n content\n) {\n // @TODO remove the number of outdated queries discarded instead of just one\n\n if (queryId < this._lastQueryIdReceived) {\n // Outdated answer\n return;\n }\n\n this._currentNbQueries -= queryId - this._lastQueryIdReceived;\n this._lastQueryIdReceived = queryId;\n\n if (this._currentNbQueries === 0) this.emit('searchQueueEmpty');\n\n var results = content.results.slice();\n\n states.forEach(function (s) {\n var state = s.state;\n var queriesCount = s.queriesCount;\n var helper = s.helper;\n var specificResults = results.splice(0, queriesCount);\n\n if (!state.index) {\n helper.emit('result', {\n results: null,\n state: state,\n });\n return;\n }\n\n helper.lastResults = new SearchResults(state, specificResults);\n\n helper.emit('result', {\n results: helper.lastResults,\n state: state,\n });\n });\n};\n\nAlgoliaSearchHelper.prototype._dispatchAlgoliaError = function (\n queryId,\n error\n) {\n if (queryId < this._lastQueryIdReceived) {\n // Outdated answer\n return;\n }\n\n this._currentNbQueries -= queryId - this._lastQueryIdReceived;\n this._lastQueryIdReceived = queryId;\n\n this.emit('error', {\n error: error,\n });\n\n if (this._currentNbQueries === 0) this.emit('searchQueueEmpty');\n};\n\nAlgoliaSearchHelper.prototype.containsRefinement = function (\n query,\n facetFilters,\n numericFilters,\n tagFilters\n) {\n return (\n query ||\n facetFilters.length !== 0 ||\n numericFilters.length !== 0 ||\n tagFilters.length !== 0\n );\n};\n\n/**\n * Test if there are some disjunctive refinements on the facet\n * @private\n * @param {string} facet the attribute to test\n * @return {boolean} true if there are refinements on this attribute\n */\nAlgoliaSearchHelper.prototype._hasDisjunctiveRefinements = function (facet) {\n return (\n this.state.disjunctiveRefinements[facet] &&\n this.state.disjunctiveRefinements[facet].length > 0\n );\n};\n\nAlgoliaSearchHelper.prototype._change = function (event) {\n var state = event.state;\n var isPageReset = event.isPageReset;\n\n if (state !== this.state) {\n this.state = state;\n\n this.emit('change', {\n state: this.state,\n results: this.lastResults,\n isPageReset: isPageReset,\n });\n }\n};\n\n/**\n * Clears the cache of the underlying Algolia client.\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n */\nAlgoliaSearchHelper.prototype.clearCache = function () {\n if (this.client.clearCache) this.client.clearCache();\n return this;\n};\n\n/**\n * Updates the internal client instance. If the reference of the clients\n * are equal then no update is actually done.\n * @param {AlgoliaSearch} newClient an AlgoliaSearch client\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n */\nAlgoliaSearchHelper.prototype.setClient = function (newClient) {\n if (this.client === newClient) return this;\n\n if (typeof newClient.addAlgoliaAgent === 'function') {\n newClient.addAlgoliaAgent('JS Helper (' + version + ')');\n }\n this.client = newClient;\n\n return this;\n};\n\n/**\n * Gets the instance of the currently used client.\n * @return {AlgoliaSearch} the currently used client\n */\nAlgoliaSearchHelper.prototype.getClient = function () {\n return this.client;\n};\n\n/**\n * Creates an derived instance of the Helper. A derived helper\n * is a way to request other indices synchronised with the lifecycle\n * of the main Helper. This mechanism uses the multiqueries feature\n * of Algolia to aggregate all the requests in a single network call.\n *\n * This method takes a function that is used to create a new SearchParameter\n * that will be used to create requests to Algolia. Those new requests\n * are created just before the `search` event. The signature of the function\n * is `SearchParameters -> SearchParameters`.\n *\n * This method returns a new DerivedHelper which is an EventEmitter\n * that fires the same `search`, `result` and `error` events. Those\n * events, however, will receive data specific to this DerivedHelper\n * and the SearchParameters that is returned by the call of the\n * parameter function.\n * @param {function} fn SearchParameters -> SearchParameters\n * @return {DerivedHelper} a new DerivedHelper\n */\nAlgoliaSearchHelper.prototype.derive = function (fn) {\n var derivedHelper = new DerivedHelper(this, fn);\n this.derivedHelpers.push(derivedHelper);\n return derivedHelper;\n};\n\n/**\n * This method detaches a derived Helper from the main one. Prefer using the one from the\n * derived helper itself, to remove the event listeners too.\n * @private\n * @param {DerivedHelper} derivedHelper the derived helper to detach\n * @return {undefined} nothing is returned\n * @throws Error\n */\nAlgoliaSearchHelper.prototype.detachDerivedHelper = function (derivedHelper) {\n var pos = this.derivedHelpers.indexOf(derivedHelper);\n if (pos === -1) throw new Error('Derived helper already detached');\n this.derivedHelpers.splice(pos, 1);\n};\n\n/**\n * This method returns true if there is currently at least one on-going search.\n * @return {boolean} true if there is a search pending\n */\nAlgoliaSearchHelper.prototype.hasPendingRequests = function () {\n return this._currentNbQueries > 0;\n};\n\n/**\n * @typedef AlgoliaSearchHelper.NumericRefinement\n * @type {object}\n * @property {number[]} value the numbers that are used for filtering this attribute with\n * the operator specified.\n * @property {string} operator the faceting data: value, number of entries\n * @property {string} type will be 'numeric'\n */\n\n/**\n * @typedef AlgoliaSearchHelper.FacetRefinement\n * @type {object}\n * @property {string} value the string use to filter the attribute\n * @property {string} type the type of filter: 'conjunctive', 'disjunctive', 'exclude'\n */\n\nmodule.exports = AlgoliaSearchHelper;\n","'use strict';\n\nmodule.exports = function compact(array) {\n if (!Array.isArray(array)) {\n return [];\n }\n\n return array.filter(Boolean);\n};\n","'use strict';\n\n// NOTE: this behaves like lodash/defaults, but doesn't mutate the target\n// it also preserve keys order\nmodule.exports = function defaultsPure() {\n var sources = Array.prototype.slice.call(arguments);\n\n return sources.reduceRight(function (acc, source) {\n Object.keys(Object(source)).forEach(function (key) {\n if (source[key] === undefined) {\n return;\n }\n if (acc[key] !== undefined) {\n // remove if already added, so that we can add it in correct order\n delete acc[key];\n }\n acc[key] = source[key];\n });\n return acc;\n }, {});\n};\n","'use strict';\n\n/**\n * Replaces a leading - with \\-\n * @private\n * @param {any} value the facet value to replace\n * @returns {any} the escaped facet value or the value if it was not a string\n */\nfunction escapeFacetValue(value) {\n if (typeof value !== 'string') return value;\n\n return String(value).replace(/^-/, '\\\\-');\n}\n\n/**\n * Replaces a leading \\- with -\n * @private\n * @param {any} value the escaped facet value\n * @returns {any} the unescaped facet value or the value if it was not a string\n */\nfunction unescapeFacetValue(value) {\n if (typeof value !== 'string') return value;\n\n return value.replace(/^\\\\-/, '-');\n}\n\nmodule.exports = {\n escapeFacetValue: escapeFacetValue,\n unescapeFacetValue: unescapeFacetValue,\n};\n","'use strict';\n\n// @MAJOR can be replaced by native Array#find when we change support\nmodule.exports = function find(array, comparator) {\n if (!Array.isArray(array)) {\n return undefined;\n }\n\n for (var i = 0; i < array.length; i++) {\n if (comparator(array[i])) {\n return array[i];\n }\n }\n\n return undefined;\n};\n","'use strict';\n\n// @MAJOR can be replaced by native Array#findIndex when we change support\nmodule.exports = function find(array, comparator) {\n if (!Array.isArray(array)) {\n return -1;\n }\n\n for (var i = 0; i < array.length; i++) {\n if (comparator(array[i])) {\n return i;\n }\n }\n return -1;\n};\n","'use strict';\n\nvar find = require('./find');\n\n/**\n * Transform sort format from user friendly notation to lodash format\n * @param {string[]} sortBy array of predicate of the form \"attribute:order\"\n * @param {string[]} [defaults] array of predicate of the form \"attribute:order\"\n * @return {array.} array containing 2 elements : attributes, orders\n */\nmodule.exports = function formatSort(sortBy, defaults) {\n var defaultInstructions = (defaults || []).map(function (sort) {\n return sort.split(':');\n });\n\n return sortBy.reduce(\n function preparePredicate(out, sort) {\n var sortInstruction = sort.split(':');\n\n var matchingDefault = find(\n defaultInstructions,\n function (defaultInstruction) {\n return defaultInstruction[0] === sortInstruction[0];\n }\n );\n\n if (sortInstruction.length > 1 || !matchingDefault) {\n out[0].push(sortInstruction[0]);\n out[1].push(sortInstruction[1]);\n return out;\n }\n\n out[0].push(matchingDefault[0]);\n out[1].push(matchingDefault[1]);\n return out;\n },\n [[], []]\n );\n};\n","'use strict';\n\nfunction inherits(ctor, superCtor) {\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true,\n },\n });\n}\n\nmodule.exports = inherits;\n","'use strict';\n\nfunction intersection(arr1, arr2) {\n return arr1.filter(function (value, index) {\n return (\n arr2.indexOf(value) > -1 &&\n arr1.indexOf(value) === index /* skips duplicates */\n );\n });\n}\n\nmodule.exports = intersection;\n","'use strict';\n\nfunction clone(value) {\n if (typeof value === 'object' && value !== null) {\n return _merge(Array.isArray(value) ? [] : {}, value);\n }\n return value;\n}\n\nfunction isObjectOrArrayOrFunction(value) {\n return (\n typeof value === 'function' ||\n Array.isArray(value) ||\n Object.prototype.toString.call(value) === '[object Object]'\n );\n}\n\nfunction _merge(target, source) {\n if (target === source) {\n return target;\n }\n\n // eslint-disable-next-line no-restricted-syntax\n for (var key in source) {\n if (\n !Object.prototype.hasOwnProperty.call(source, key) ||\n key === '__proto__' ||\n key === 'constructor'\n ) {\n // eslint-disable-next-line no-continue\n continue;\n }\n\n var sourceVal = source[key];\n var targetVal = target[key];\n\n if (typeof targetVal !== 'undefined' && typeof sourceVal === 'undefined') {\n // eslint-disable-next-line no-continue\n continue;\n }\n\n if (\n isObjectOrArrayOrFunction(targetVal) &&\n isObjectOrArrayOrFunction(sourceVal)\n ) {\n target[key] = _merge(targetVal, sourceVal);\n } else {\n target[key] = clone(sourceVal);\n }\n }\n return target;\n}\n\n/**\n * This method is like Object.assign, but recursively merges own and inherited\n * enumerable keyed properties of source objects into the destination object.\n *\n * NOTE: this behaves like lodash/merge, but:\n * - does mutate functions if they are a source\n * - treats non-plain objects as plain\n * - does not work for circular objects\n * - treats sparse arrays as sparse\n * - does not convert Array-like objects (Arguments, NodeLists, etc.) to arrays\n *\n * @param {Object} target The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n */\nfunction merge(target) {\n if (!isObjectOrArrayOrFunction(target)) {\n target = {};\n }\n\n for (var i = 1, l = arguments.length; i < l; i++) {\n var source = arguments[i];\n\n if (isObjectOrArrayOrFunction(source)) {\n _merge(target, source);\n }\n }\n return target;\n}\n\nmodule.exports = merge;\n","'use strict';\n\nfunction objectHasKeys(obj) {\n return obj && Object.keys(obj).length > 0;\n}\n\nmodule.exports = objectHasKeys;\n","'use strict';\n\n// https://github.com/babel/babel/blob/3aaafae053fa75febb3aa45d45b6f00646e30ba4/packages/babel-helpers/src/helpers.js#L604-L620\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source === null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key;\n var i;\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n // eslint-disable-next-line no-continue\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n return target;\n}\n\nmodule.exports = _objectWithoutPropertiesLoose;\n","'use strict';\n\nfunction compareAscending(value, other) {\n if (value !== other) {\n var valIsDefined = value !== undefined;\n var valIsNull = value === null;\n\n var othIsDefined = other !== undefined;\n var othIsNull = other === null;\n\n if (\n (!othIsNull && value > other) ||\n (valIsNull && othIsDefined) ||\n !valIsDefined\n ) {\n return 1;\n }\n if (\n (!valIsNull && value < other) ||\n (othIsNull && valIsDefined) ||\n !othIsDefined\n ) {\n return -1;\n }\n }\n return 0;\n}\n\n/**\n * @param {Array} collection object with keys in attributes\n * @param {Array} iteratees attributes\n * @param {Array} orders asc | desc\n * @return {Array} sorted collection\n */\nfunction orderBy(collection, iteratees, orders) {\n if (!Array.isArray(collection)) {\n return [];\n }\n\n if (!Array.isArray(orders)) {\n orders = [];\n }\n\n var result = collection.map(function (value, index) {\n return {\n criteria: iteratees.map(function (iteratee) {\n return value[iteratee];\n }),\n index: index,\n value: value,\n };\n });\n\n result.sort(function comparer(object, other) {\n var index = -1;\n\n while (++index < object.criteria.length) {\n var res = compareAscending(object.criteria[index], other.criteria[index]);\n if (res) {\n if (index >= orders.length) {\n return res;\n }\n if (orders[index] === 'desc') {\n return -res;\n }\n return res;\n }\n }\n\n // This ensures a stable sort in V8 and other engines.\n // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.\n return object.index - other.index;\n });\n\n return result.map(function (res) {\n return res.value;\n });\n}\n\nmodule.exports = orderBy;\n","'use strict';\n\nfunction valToNumber(v) {\n if (typeof v === 'number') {\n return v;\n } else if (typeof v === 'string') {\n return parseFloat(v);\n } else if (Array.isArray(v)) {\n return v.map(valToNumber);\n }\n\n throw new Error(\n 'The value should be a number, a parsable string or an array of those.'\n );\n}\n\nmodule.exports = valToNumber;\n","'use strict';\n\nvar merge = require('./functions/merge');\n\nfunction sortObject(obj) {\n return Object.keys(obj)\n .sort()\n .reduce(function (acc, curr) {\n acc[curr] = obj[curr];\n return acc;\n }, {});\n}\n\nvar requestBuilder = {\n /**\n * Get all the queries to send to the client, those queries can used directly\n * with the Algolia client.\n * @private\n * @param {string} index The name of the index\n * @param {SearchParameters} state The state from which to get the queries\n * @return {object[]} The queries\n */\n _getQueries: function getQueries(index, state) {\n var queries = [];\n\n // One query for the hits\n queries.push({\n indexName: index,\n params: requestBuilder._getHitsSearchParams(state),\n });\n\n // One for each disjunctive facets\n state.getRefinedDisjunctiveFacets().forEach(function (refinedFacet) {\n queries.push({\n indexName: index,\n params: requestBuilder._getDisjunctiveFacetSearchParams(\n state,\n refinedFacet\n ),\n });\n });\n\n // More to get the parent levels of the hierarchical facets when refined\n state.getRefinedHierarchicalFacets().forEach(function (refinedFacet) {\n var hierarchicalFacet = state.getHierarchicalFacetByName(refinedFacet);\n var currentRefinement = state.getHierarchicalRefinement(refinedFacet);\n var separator = state._getHierarchicalFacetSeparator(hierarchicalFacet);\n\n // If we are deeper than level 0 (starting from `beer > IPA`)\n // we want to get all parent values\n if (\n currentRefinement.length > 0 &&\n currentRefinement[0].split(separator).length > 1\n ) {\n // We generate a map of the filters we will use for our facet values queries\n var filtersMap = currentRefinement[0]\n .split(separator)\n .slice(0, -1)\n .reduce(function createFiltersMap(map, segment, level) {\n return map.concat({\n attribute: hierarchicalFacet.attributes[level],\n value:\n level === 0\n ? segment\n : [map[map.length - 1].value, segment].join(separator),\n });\n }, []);\n\n filtersMap.forEach(function (filter, level) {\n var params = requestBuilder._getDisjunctiveFacetSearchParams(\n state,\n filter.attribute,\n level === 0\n );\n\n // Keep facet filters unrelated to current hierarchical attributes\n function hasHierarchicalFacetFilter(value) {\n return hierarchicalFacet.attributes.some(function (attribute) {\n return attribute === value.split(':')[0];\n });\n }\n\n var filteredFacetFilters = (params.facetFilters || []).reduce(\n function (acc, facetFilter) {\n if (Array.isArray(facetFilter)) {\n var filtered = facetFilter.filter(function (filterValue) {\n return !hasHierarchicalFacetFilter(filterValue);\n });\n\n if (filtered.length > 0) {\n acc.push(filtered);\n }\n }\n\n if (\n typeof facetFilter === 'string' &&\n !hasHierarchicalFacetFilter(facetFilter)\n ) {\n acc.push(facetFilter);\n }\n\n return acc;\n },\n []\n );\n\n var parent = filtersMap[level - 1];\n if (level > 0) {\n params.facetFilters = filteredFacetFilters.concat(\n parent.attribute + ':' + parent.value\n );\n } else {\n params.facetFilters =\n filteredFacetFilters.length > 0\n ? filteredFacetFilters\n : undefined;\n }\n\n queries.push({ indexName: index, params: params });\n });\n }\n });\n\n return queries;\n },\n\n /**\n * Build search parameters used to fetch hits\n * @private\n * @param {SearchParameters} state The state from which to get the queries\n * @return {object.} The search parameters for hits\n */\n _getHitsSearchParams: function (state) {\n var facets = state.facets\n .concat(state.disjunctiveFacets)\n .concat(requestBuilder._getHitsHierarchicalFacetsAttributes(state))\n .sort();\n\n var facetFilters = requestBuilder._getFacetFilters(state);\n var numericFilters = requestBuilder._getNumericFilters(state);\n var tagFilters = requestBuilder._getTagFilters(state);\n var additionalParams = {\n facets: facets.indexOf('*') > -1 ? ['*'] : facets,\n tagFilters: tagFilters,\n };\n\n if (facetFilters.length > 0) {\n additionalParams.facetFilters = facetFilters;\n }\n\n if (numericFilters.length > 0) {\n additionalParams.numericFilters = numericFilters;\n }\n\n return sortObject(merge({}, state.getQueryParams(), additionalParams));\n },\n\n /**\n * Build search parameters used to fetch a disjunctive facet\n * @private\n * @param {SearchParameters} state The state from which to get the queries\n * @param {string} facet the associated facet name\n * @param {boolean} hierarchicalRootLevel ?? FIXME\n * @return {object} The search parameters for a disjunctive facet\n */\n _getDisjunctiveFacetSearchParams: function (\n state,\n facet,\n hierarchicalRootLevel\n ) {\n var facetFilters = requestBuilder._getFacetFilters(\n state,\n facet,\n hierarchicalRootLevel\n );\n var numericFilters = requestBuilder._getNumericFilters(state, facet);\n var tagFilters = requestBuilder._getTagFilters(state);\n var additionalParams = {\n hitsPerPage: 0,\n page: 0,\n analytics: false,\n clickAnalytics: false,\n };\n\n if (tagFilters.length > 0) {\n additionalParams.tagFilters = tagFilters;\n }\n\n var hierarchicalFacet = state.getHierarchicalFacetByName(facet);\n\n if (hierarchicalFacet) {\n additionalParams.facets =\n requestBuilder._getDisjunctiveHierarchicalFacetAttribute(\n state,\n hierarchicalFacet,\n hierarchicalRootLevel\n );\n } else {\n additionalParams.facets = facet;\n }\n\n if (numericFilters.length > 0) {\n additionalParams.numericFilters = numericFilters;\n }\n\n if (facetFilters.length > 0) {\n additionalParams.facetFilters = facetFilters;\n }\n\n return sortObject(merge({}, state.getQueryParams(), additionalParams));\n },\n\n /**\n * Return the numeric filters in an algolia request fashion\n * @private\n * @param {SearchParameters} state the state from which to get the filters\n * @param {string} [facetName] the name of the attribute for which the filters should be excluded\n * @return {string[]} the numeric filters in the algolia format\n */\n _getNumericFilters: function (state, facetName) {\n if (state.numericFilters) {\n return state.numericFilters;\n }\n\n var numericFilters = [];\n\n Object.keys(state.numericRefinements).forEach(function (attribute) {\n var operators = state.numericRefinements[attribute] || {};\n Object.keys(operators).forEach(function (operator) {\n var values = operators[operator] || [];\n if (facetName !== attribute) {\n values.forEach(function (value) {\n if (Array.isArray(value)) {\n var vs = value.map(function (v) {\n return attribute + operator + v;\n });\n numericFilters.push(vs);\n } else {\n numericFilters.push(attribute + operator + value);\n }\n });\n }\n });\n });\n\n return numericFilters;\n },\n\n /**\n * Return the tags filters depending on which format is used, either tagFilters or tagRefinements\n * @private\n * @param {SearchParameters} state the state from which to get the filters\n * @return {string} Tag filters in a single string\n */\n _getTagFilters: function (state) {\n if (state.tagFilters) {\n return state.tagFilters;\n }\n\n return state.tagRefinements.join(',');\n },\n\n /**\n * Build facetFilters parameter based on current refinements. The array returned\n * contains strings representing the facet filters in the algolia format.\n * @private\n * @param {SearchParameters} state The state from which to get the queries\n * @param {string} [facet] if set, the current disjunctive facet\n * @param {boolean} [hierarchicalRootLevel] ?? FIXME\n * @return {array.} The facet filters in the algolia format\n */\n _getFacetFilters: function (state, facet, hierarchicalRootLevel) {\n var facetFilters = [];\n\n var facetsRefinements = state.facetsRefinements || {};\n Object.keys(facetsRefinements)\n .sort()\n .forEach(function (facetName) {\n var facetValues = facetsRefinements[facetName] || [];\n facetValues.sort().forEach(function (facetValue) {\n facetFilters.push(facetName + ':' + facetValue);\n });\n });\n\n var facetsExcludes = state.facetsExcludes || {};\n Object.keys(facetsExcludes)\n .sort()\n .forEach(function (facetName) {\n var facetValues = facetsExcludes[facetName] || [];\n facetValues.sort().forEach(function (facetValue) {\n facetFilters.push(facetName + ':-' + facetValue);\n });\n });\n\n var disjunctiveFacetsRefinements = state.disjunctiveFacetsRefinements || {};\n Object.keys(disjunctiveFacetsRefinements)\n .sort()\n .forEach(function (facetName) {\n var facetValues = disjunctiveFacetsRefinements[facetName] || [];\n if (facetName === facet || !facetValues || facetValues.length === 0) {\n return;\n }\n var orFilters = [];\n\n facetValues.sort().forEach(function (facetValue) {\n orFilters.push(facetName + ':' + facetValue);\n });\n\n facetFilters.push(orFilters);\n });\n\n var hierarchicalFacetsRefinements =\n state.hierarchicalFacetsRefinements || {};\n Object.keys(hierarchicalFacetsRefinements)\n .sort()\n .forEach(function (facetName) {\n var facetValues = hierarchicalFacetsRefinements[facetName] || [];\n var facetValue = facetValues[0];\n\n if (facetValue === undefined) {\n return;\n }\n\n var hierarchicalFacet = state.getHierarchicalFacetByName(facetName);\n var separator = state._getHierarchicalFacetSeparator(hierarchicalFacet);\n var rootPath = state._getHierarchicalRootPath(hierarchicalFacet);\n var attributeToRefine;\n var attributesIndex;\n\n // we ask for parent facet values only when the `facet` is the current hierarchical facet\n if (facet === facetName) {\n // if we are at the root level already, no need to ask for facet values, we get them from\n // the hits query\n if (\n facetValue.indexOf(separator) === -1 ||\n (!rootPath && hierarchicalRootLevel === true) ||\n (rootPath &&\n rootPath.split(separator).length ===\n facetValue.split(separator).length)\n ) {\n return;\n }\n\n if (!rootPath) {\n attributesIndex = facetValue.split(separator).length - 2;\n facetValue = facetValue.slice(0, facetValue.lastIndexOf(separator));\n } else {\n attributesIndex = rootPath.split(separator).length - 1;\n facetValue = rootPath;\n }\n\n attributeToRefine = hierarchicalFacet.attributes[attributesIndex];\n } else {\n attributesIndex = facetValue.split(separator).length - 1;\n\n attributeToRefine = hierarchicalFacet.attributes[attributesIndex];\n }\n\n if (attributeToRefine) {\n facetFilters.push([attributeToRefine + ':' + facetValue]);\n }\n });\n\n return facetFilters;\n },\n\n _getHitsHierarchicalFacetsAttributes: function (state) {\n var out = [];\n\n return state.hierarchicalFacets.reduce(\n // ask for as much levels as there's hierarchical refinements\n function getHitsAttributesForHierarchicalFacet(\n allAttributes,\n hierarchicalFacet\n ) {\n var hierarchicalRefinement = state.getHierarchicalRefinement(\n hierarchicalFacet.name\n )[0];\n\n // if no refinement, ask for root level\n if (!hierarchicalRefinement) {\n allAttributes.push(hierarchicalFacet.attributes[0]);\n return allAttributes;\n }\n\n var separator = state._getHierarchicalFacetSeparator(hierarchicalFacet);\n var level = hierarchicalRefinement.split(separator).length;\n var newAttributes = hierarchicalFacet.attributes.slice(0, level + 1);\n\n return allAttributes.concat(newAttributes);\n },\n out\n );\n },\n\n _getDisjunctiveHierarchicalFacetAttribute: function (\n state,\n hierarchicalFacet,\n rootLevel\n ) {\n var separator = state._getHierarchicalFacetSeparator(hierarchicalFacet);\n if (rootLevel === true) {\n var rootPath = state._getHierarchicalRootPath(hierarchicalFacet);\n var attributeIndex = 0;\n\n if (rootPath) {\n attributeIndex = rootPath.split(separator).length;\n }\n return [hierarchicalFacet.attributes[attributeIndex]];\n }\n\n var hierarchicalRefinement =\n state.getHierarchicalRefinement(hierarchicalFacet.name)[0] || '';\n // if refinement is 'beers > IPA > Flying dog',\n // then we want `facets: ['beers > IPA']` as disjunctive facet (parent level values)\n\n var parentLevel = hierarchicalRefinement.split(separator).length - 1;\n return hierarchicalFacet.attributes.slice(0, parentLevel + 1);\n },\n\n getSearchForFacetQuery: function (facetName, query, maxFacetHits, state) {\n var stateForSearchForFacetValues = state.isDisjunctiveFacet(facetName)\n ? state.clearRefinements(facetName)\n : state;\n var searchForFacetSearchParameters = {\n facetQuery: query,\n facetName: facetName,\n };\n if (typeof maxFacetHits === 'number') {\n searchForFacetSearchParameters.maxFacetHits = maxFacetHits;\n }\n return sortObject(\n merge(\n {},\n requestBuilder._getHitsSearchParams(stateForSearchForFacetValues),\n searchForFacetSearchParameters\n )\n );\n },\n};\n\nmodule.exports = requestBuilder;\n","'use strict';\n\nmodule.exports = function isValidUserToken(userToken) {\n if (userToken === null) {\n return false;\n }\n return /^[a-zA-Z0-9_-]{1,64}$/.test(userToken);\n};\n","'use strict';\n\nmodule.exports = '3.14.0';\n","'use strict';\n\nvar replace = String.prototype.replace;\nvar percentTwenties = /%20/g;\n\nvar Format = {\n RFC1738: 'RFC1738',\n RFC3986: 'RFC3986'\n};\n\nmodule.exports = {\n 'default': Format.RFC3986,\n formatters: {\n RFC1738: function (value) {\n return replace.call(value, percentTwenties, '+');\n },\n RFC3986: function (value) {\n return String(value);\n }\n },\n RFC1738: Format.RFC1738,\n RFC3986: Format.RFC3986\n};\n","'use strict';\n\nvar stringify = require('./stringify');\nvar parse = require('./parse');\nvar formats = require('./formats');\n\nmodule.exports = {\n formats: formats,\n parse: parse,\n stringify: stringify\n};\n","'use strict';\n\nvar utils = require('./utils');\n\nvar has = Object.prototype.hasOwnProperty;\nvar isArray = Array.isArray;\n\nvar defaults = {\n allowDots: false,\n allowPrototypes: false,\n arrayLimit: 20,\n charset: 'utf-8',\n charsetSentinel: false,\n comma: false,\n decoder: utils.decode,\n delimiter: '&',\n depth: 5,\n ignoreQueryPrefix: false,\n interpretNumericEntities: false,\n parameterLimit: 1000,\n parseArrays: true,\n plainObjects: false,\n strictNullHandling: false\n};\n\nvar interpretNumericEntities = function (str) {\n return str.replace(/&#(\\d+);/g, function ($0, numberStr) {\n return String.fromCharCode(parseInt(numberStr, 10));\n });\n};\n\nvar parseArrayValue = function (val, options) {\n if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) {\n return val.split(',');\n }\n\n return val;\n};\n\n// This is what browsers will submit when the ✓ character occurs in an\n// application/x-www-form-urlencoded body and the encoding of the page containing\n// the form is iso-8859-1, or when the submitted form has an accept-charset\n// attribute of iso-8859-1. Presumably also with other charsets that do not contain\n// the ✓ character, such as us-ascii.\nvar isoSentinel = 'utf8=%26%2310003%3B'; // encodeURIComponent('✓')\n\n// These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded.\nvar charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓')\n\nvar parseValues = function parseQueryStringValues(str, options) {\n var obj = {};\n var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\\?/, '') : str;\n var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;\n var parts = cleanStr.split(options.delimiter, limit);\n var skipIndex = -1; // Keep track of where the utf8 sentinel was found\n var i;\n\n var charset = options.charset;\n if (options.charsetSentinel) {\n for (i = 0; i < parts.length; ++i) {\n if (parts[i].indexOf('utf8=') === 0) {\n if (parts[i] === charsetSentinel) {\n charset = 'utf-8';\n } else if (parts[i] === isoSentinel) {\n charset = 'iso-8859-1';\n }\n skipIndex = i;\n i = parts.length; // The eslint settings do not allow break;\n }\n }\n }\n\n for (i = 0; i < parts.length; ++i) {\n if (i === skipIndex) {\n continue;\n }\n var part = parts[i];\n\n var bracketEqualsPos = part.indexOf(']=');\n var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1;\n\n var key, val;\n if (pos === -1) {\n key = options.decoder(part, defaults.decoder, charset, 'key');\n val = options.strictNullHandling ? null : '';\n } else {\n key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key');\n val = utils.maybeMap(\n parseArrayValue(part.slice(pos + 1), options),\n function (encodedVal) {\n return options.decoder(encodedVal, defaults.decoder, charset, 'value');\n }\n );\n }\n\n if (val && options.interpretNumericEntities && charset === 'iso-8859-1') {\n val = interpretNumericEntities(val);\n }\n\n if (part.indexOf('[]=') > -1) {\n val = isArray(val) ? [val] : val;\n }\n\n if (has.call(obj, key)) {\n obj[key] = utils.combine(obj[key], val);\n } else {\n obj[key] = val;\n }\n }\n\n return obj;\n};\n\nvar parseObject = function (chain, val, options, valuesParsed) {\n var leaf = valuesParsed ? val : parseArrayValue(val, options);\n\n for (var i = chain.length - 1; i >= 0; --i) {\n var obj;\n var root = chain[i];\n\n if (root === '[]' && options.parseArrays) {\n obj = [].concat(leaf);\n } else {\n obj = options.plainObjects ? Object.create(null) : {};\n var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;\n var index = parseInt(cleanRoot, 10);\n if (!options.parseArrays && cleanRoot === '') {\n obj = { 0: leaf };\n } else if (\n !isNaN(index)\n && root !== cleanRoot\n && String(index) === cleanRoot\n && index >= 0\n && (options.parseArrays && index <= options.arrayLimit)\n ) {\n obj = [];\n obj[index] = leaf;\n } else if (cleanRoot !== '__proto__') {\n obj[cleanRoot] = leaf;\n }\n }\n\n leaf = obj;\n }\n\n return leaf;\n};\n\nvar parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {\n if (!givenKey) {\n return;\n }\n\n // Transform dot notation to bracket notation\n var key = options.allowDots ? givenKey.replace(/\\.([^.[]+)/g, '[$1]') : givenKey;\n\n // The regex chunks\n\n var brackets = /(\\[[^[\\]]*])/;\n var child = /(\\[[^[\\]]*])/g;\n\n // Get the parent\n\n var segment = options.depth > 0 && brackets.exec(key);\n var parent = segment ? key.slice(0, segment.index) : key;\n\n // Stash the parent if it exists\n\n var keys = [];\n if (parent) {\n // If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties\n if (!options.plainObjects && has.call(Object.prototype, parent)) {\n if (!options.allowPrototypes) {\n return;\n }\n }\n\n keys.push(parent);\n }\n\n // Loop through children appending to the array until we hit depth\n\n var i = 0;\n while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) {\n i += 1;\n if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {\n if (!options.allowPrototypes) {\n return;\n }\n }\n keys.push(segment[1]);\n }\n\n // If there's a remainder, just add whatever is left\n\n if (segment) {\n keys.push('[' + key.slice(segment.index) + ']');\n }\n\n return parseObject(keys, val, options, valuesParsed);\n};\n\nvar normalizeParseOptions = function normalizeParseOptions(opts) {\n if (!opts) {\n return defaults;\n }\n\n if (opts.decoder !== null && opts.decoder !== undefined && typeof opts.decoder !== 'function') {\n throw new TypeError('Decoder has to be a function.');\n }\n\n if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {\n throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');\n }\n var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset;\n\n return {\n allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots,\n allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults.allowPrototypes,\n arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults.arrayLimit,\n charset: charset,\n charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,\n comma: typeof opts.comma === 'boolean' ? opts.comma : defaults.comma,\n decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults.decoder,\n delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter,\n // eslint-disable-next-line no-implicit-coercion, no-extra-parens\n depth: (typeof opts.depth === 'number' || opts.depth === false) ? +opts.depth : defaults.depth,\n ignoreQueryPrefix: opts.ignoreQueryPrefix === true,\n interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults.interpretNumericEntities,\n parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults.parameterLimit,\n parseArrays: opts.parseArrays !== false,\n plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects,\n strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling\n };\n};\n\nmodule.exports = function (str, opts) {\n var options = normalizeParseOptions(opts);\n\n if (str === '' || str === null || typeof str === 'undefined') {\n return options.plainObjects ? Object.create(null) : {};\n }\n\n var tempObj = typeof str === 'string' ? parseValues(str, options) : str;\n var obj = options.plainObjects ? Object.create(null) : {};\n\n // Iterate over the keys and setup the new object\n\n var keys = Object.keys(tempObj);\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n var newObj = parseKeys(key, tempObj[key], options, typeof str === 'string');\n obj = utils.merge(obj, newObj, options);\n }\n\n return utils.compact(obj);\n};\n","'use strict';\n\nvar utils = require('./utils');\nvar formats = require('./formats');\nvar has = Object.prototype.hasOwnProperty;\n\nvar arrayPrefixGenerators = {\n brackets: function brackets(prefix) {\n return prefix + '[]';\n },\n comma: 'comma',\n indices: function indices(prefix, key) {\n return prefix + '[' + key + ']';\n },\n repeat: function repeat(prefix) {\n return prefix;\n }\n};\n\nvar isArray = Array.isArray;\nvar split = String.prototype.split;\nvar push = Array.prototype.push;\nvar pushToArray = function (arr, valueOrArray) {\n push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]);\n};\n\nvar toISO = Date.prototype.toISOString;\n\nvar defaultFormat = formats['default'];\nvar defaults = {\n addQueryPrefix: false,\n allowDots: false,\n charset: 'utf-8',\n charsetSentinel: false,\n delimiter: '&',\n encode: true,\n encoder: utils.encode,\n encodeValuesOnly: false,\n format: defaultFormat,\n formatter: formats.formatters[defaultFormat],\n // deprecated\n indices: false,\n serializeDate: function serializeDate(date) {\n return toISO.call(date);\n },\n skipNulls: false,\n strictNullHandling: false\n};\n\nvar isNonNullishPrimitive = function isNonNullishPrimitive(v) {\n return typeof v === 'string'\n || typeof v === 'number'\n || typeof v === 'boolean'\n || typeof v === 'symbol'\n || typeof v === 'bigint';\n};\n\nvar stringify = function stringify(\n object,\n prefix,\n generateArrayPrefix,\n strictNullHandling,\n skipNulls,\n encoder,\n filter,\n sort,\n allowDots,\n serializeDate,\n format,\n formatter,\n encodeValuesOnly,\n charset\n) {\n var obj = object;\n if (typeof filter === 'function') {\n obj = filter(prefix, obj);\n } else if (obj instanceof Date) {\n obj = serializeDate(obj);\n } else if (generateArrayPrefix === 'comma' && isArray(obj)) {\n obj = utils.maybeMap(obj, function (value) {\n if (value instanceof Date) {\n return serializeDate(value);\n }\n return value;\n });\n }\n\n if (obj === null) {\n if (strictNullHandling) {\n return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, 'key', format) : prefix;\n }\n\n obj = '';\n }\n\n if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {\n if (encoder) {\n var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key', format);\n if (generateArrayPrefix === 'comma' && encodeValuesOnly) {\n var valuesArray = split.call(String(obj), ',');\n var valuesJoined = '';\n for (var i = 0; i < valuesArray.length; ++i) {\n valuesJoined += (i === 0 ? '' : ',') + formatter(encoder(valuesArray[i], defaults.encoder, charset, 'value', format));\n }\n return [formatter(keyValue) + '=' + valuesJoined];\n }\n return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value', format))];\n }\n return [formatter(prefix) + '=' + formatter(String(obj))];\n }\n\n var values = [];\n\n if (typeof obj === 'undefined') {\n return values;\n }\n\n var objKeys;\n if (generateArrayPrefix === 'comma' && isArray(obj)) {\n // we need to join elements in\n objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }];\n } else if (isArray(filter)) {\n objKeys = filter;\n } else {\n var keys = Object.keys(obj);\n objKeys = sort ? keys.sort(sort) : keys;\n }\n\n for (var j = 0; j < objKeys.length; ++j) {\n var key = objKeys[j];\n var value = typeof key === 'object' && typeof key.value !== 'undefined' ? key.value : obj[key];\n\n if (skipNulls && value === null) {\n continue;\n }\n\n var keyPrefix = isArray(obj)\n ? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(prefix, key) : prefix\n : prefix + (allowDots ? '.' + key : '[' + key + ']');\n\n pushToArray(values, stringify(\n value,\n keyPrefix,\n generateArrayPrefix,\n strictNullHandling,\n skipNulls,\n encoder,\n filter,\n sort,\n allowDots,\n serializeDate,\n format,\n formatter,\n encodeValuesOnly,\n charset\n ));\n }\n\n return values;\n};\n\nvar normalizeStringifyOptions = function normalizeStringifyOptions(opts) {\n if (!opts) {\n return defaults;\n }\n\n if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') {\n throw new TypeError('Encoder has to be a function.');\n }\n\n var charset = opts.charset || defaults.charset;\n if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {\n throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');\n }\n\n var format = formats['default'];\n if (typeof opts.format !== 'undefined') {\n if (!has.call(formats.formatters, opts.format)) {\n throw new TypeError('Unknown format option provided.');\n }\n format = opts.format;\n }\n var formatter = formats.formatters[format];\n\n var filter = defaults.filter;\n if (typeof opts.filter === 'function' || isArray(opts.filter)) {\n filter = opts.filter;\n }\n\n return {\n addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults.addQueryPrefix,\n allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots,\n charset: charset,\n charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,\n delimiter: typeof opts.delimiter === 'undefined' ? defaults.delimiter : opts.delimiter,\n encode: typeof opts.encode === 'boolean' ? opts.encode : defaults.encode,\n encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults.encoder,\n encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults.encodeValuesOnly,\n filter: filter,\n format: format,\n formatter: formatter,\n serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults.serializeDate,\n skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults.skipNulls,\n sort: typeof opts.sort === 'function' ? opts.sort : null,\n strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling\n };\n};\n\nmodule.exports = function (object, opts) {\n var obj = object;\n var options = normalizeStringifyOptions(opts);\n\n var objKeys;\n var filter;\n\n if (typeof options.filter === 'function') {\n filter = options.filter;\n obj = filter('', obj);\n } else if (isArray(options.filter)) {\n filter = options.filter;\n objKeys = filter;\n }\n\n var keys = [];\n\n if (typeof obj !== 'object' || obj === null) {\n return '';\n }\n\n var arrayFormat;\n if (opts && opts.arrayFormat in arrayPrefixGenerators) {\n arrayFormat = opts.arrayFormat;\n } else if (opts && 'indices' in opts) {\n arrayFormat = opts.indices ? 'indices' : 'repeat';\n } else {\n arrayFormat = 'indices';\n }\n\n var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];\n\n if (!objKeys) {\n objKeys = Object.keys(obj);\n }\n\n if (options.sort) {\n objKeys.sort(options.sort);\n }\n\n for (var i = 0; i < objKeys.length; ++i) {\n var key = objKeys[i];\n\n if (options.skipNulls && obj[key] === null) {\n continue;\n }\n pushToArray(keys, stringify(\n obj[key],\n key,\n generateArrayPrefix,\n options.strictNullHandling,\n options.skipNulls,\n options.encode ? options.encoder : null,\n options.filter,\n options.sort,\n options.allowDots,\n options.serializeDate,\n options.format,\n options.formatter,\n options.encodeValuesOnly,\n options.charset\n ));\n }\n\n var joined = keys.join(options.delimiter);\n var prefix = options.addQueryPrefix === true ? '?' : '';\n\n if (options.charsetSentinel) {\n if (options.charset === 'iso-8859-1') {\n // encodeURIComponent('✓'), the \"numeric entity\" representation of a checkmark\n prefix += 'utf8=%26%2310003%3B&';\n } else {\n // encodeURIComponent('✓')\n prefix += 'utf8=%E2%9C%93&';\n }\n }\n\n return joined.length > 0 ? prefix + joined : '';\n};\n","'use strict';\n\nvar formats = require('./formats');\n\nvar has = Object.prototype.hasOwnProperty;\nvar isArray = Array.isArray;\n\nvar hexTable = (function () {\n var array = [];\n for (var i = 0; i < 256; ++i) {\n array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());\n }\n\n return array;\n}());\n\nvar compactQueue = function compactQueue(queue) {\n while (queue.length > 1) {\n var item = queue.pop();\n var obj = item.obj[item.prop];\n\n if (isArray(obj)) {\n var compacted = [];\n\n for (var j = 0; j < obj.length; ++j) {\n if (typeof obj[j] !== 'undefined') {\n compacted.push(obj[j]);\n }\n }\n\n item.obj[item.prop] = compacted;\n }\n }\n};\n\nvar arrayToObject = function arrayToObject(source, options) {\n var obj = options && options.plainObjects ? Object.create(null) : {};\n for (var i = 0; i < source.length; ++i) {\n if (typeof source[i] !== 'undefined') {\n obj[i] = source[i];\n }\n }\n\n return obj;\n};\n\nvar merge = function merge(target, source, options) {\n /* eslint no-param-reassign: 0 */\n if (!source) {\n return target;\n }\n\n if (typeof source !== 'object') {\n if (isArray(target)) {\n target.push(source);\n } else if (target && typeof target === 'object') {\n if ((options && (options.plainObjects || options.allowPrototypes)) || !has.call(Object.prototype, source)) {\n target[source] = true;\n }\n } else {\n return [target, source];\n }\n\n return target;\n }\n\n if (!target || typeof target !== 'object') {\n return [target].concat(source);\n }\n\n var mergeTarget = target;\n if (isArray(target) && !isArray(source)) {\n mergeTarget = arrayToObject(target, options);\n }\n\n if (isArray(target) && isArray(source)) {\n source.forEach(function (item, i) {\n if (has.call(target, i)) {\n var targetItem = target[i];\n if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {\n target[i] = merge(targetItem, item, options);\n } else {\n target.push(item);\n }\n } else {\n target[i] = item;\n }\n });\n return target;\n }\n\n return Object.keys(source).reduce(function (acc, key) {\n var value = source[key];\n\n if (has.call(acc, key)) {\n acc[key] = merge(acc[key], value, options);\n } else {\n acc[key] = value;\n }\n return acc;\n }, mergeTarget);\n};\n\nvar assign = function assignSingleSource(target, source) {\n return Object.keys(source).reduce(function (acc, key) {\n acc[key] = source[key];\n return acc;\n }, target);\n};\n\nvar decode = function (str, decoder, charset) {\n var strWithoutPlus = str.replace(/\\+/g, ' ');\n if (charset === 'iso-8859-1') {\n // unescape never throws, no try...catch needed:\n return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);\n }\n // utf-8\n try {\n return decodeURIComponent(strWithoutPlus);\n } catch (e) {\n return strWithoutPlus;\n }\n};\n\nvar encode = function encode(str, defaultEncoder, charset, kind, format) {\n // This code was originally written by Brian White (mscdex) for the io.js core querystring library.\n // It has been adapted here for stricter adherence to RFC 3986\n if (str.length === 0) {\n return str;\n }\n\n var string = str;\n if (typeof str === 'symbol') {\n string = Symbol.prototype.toString.call(str);\n } else if (typeof str !== 'string') {\n string = String(str);\n }\n\n if (charset === 'iso-8859-1') {\n return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {\n return '%26%23' + parseInt($0.slice(2), 16) + '%3B';\n });\n }\n\n var out = '';\n for (var i = 0; i < string.length; ++i) {\n var c = string.charCodeAt(i);\n\n if (\n c === 0x2D // -\n || c === 0x2E // .\n || c === 0x5F // _\n || c === 0x7E // ~\n || (c >= 0x30 && c <= 0x39) // 0-9\n || (c >= 0x41 && c <= 0x5A) // a-z\n || (c >= 0x61 && c <= 0x7A) // A-Z\n || (format === formats.RFC1738 && (c === 0x28 || c === 0x29)) // ( )\n ) {\n out += string.charAt(i);\n continue;\n }\n\n if (c < 0x80) {\n out = out + hexTable[c];\n continue;\n }\n\n if (c < 0x800) {\n out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]);\n continue;\n }\n\n if (c < 0xD800 || c >= 0xE000) {\n out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);\n continue;\n }\n\n i += 1;\n c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));\n /* eslint operator-linebreak: [2, \"before\"] */\n out += hexTable[0xF0 | (c >> 18)]\n + hexTable[0x80 | ((c >> 12) & 0x3F)]\n + hexTable[0x80 | ((c >> 6) & 0x3F)]\n + hexTable[0x80 | (c & 0x3F)];\n }\n\n return out;\n};\n\nvar compact = function compact(value) {\n var queue = [{ obj: { o: value }, prop: 'o' }];\n var refs = [];\n\n for (var i = 0; i < queue.length; ++i) {\n var item = queue[i];\n var obj = item.obj[item.prop];\n\n var keys = Object.keys(obj);\n for (var j = 0; j < keys.length; ++j) {\n var key = keys[j];\n var val = obj[key];\n if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {\n queue.push({ obj: obj, prop: key });\n refs.push(val);\n }\n }\n }\n\n compactQueue(queue);\n\n return value;\n};\n\nvar isRegExp = function isRegExp(obj) {\n return Object.prototype.toString.call(obj) === '[object RegExp]';\n};\n\nvar isBuffer = function isBuffer(obj) {\n if (!obj || typeof obj !== 'object') {\n return false;\n }\n\n return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));\n};\n\nvar combine = function combine(a, b) {\n return [].concat(a, b);\n};\n\nvar maybeMap = function maybeMap(val, fn) {\n if (isArray(val)) {\n var mapped = [];\n for (var i = 0; i < val.length; i += 1) {\n mapped.push(fn(val[i]));\n }\n return mapped;\n }\n return fn(val);\n};\n\nmodule.exports = {\n arrayToObject: arrayToObject,\n assign: assign,\n combine: combine,\n compact: compact,\n decode: decode,\n encode: encode,\n isBuffer: isBuffer,\n isRegExp: isRegExp,\n maybeMap: maybeMap,\n merge: merge\n};\n","/**\n * @license React\n * use-sync-external-store-shim.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var e=require(\"react\");function h(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k=\"function\"===typeof Object.is?Object.is:h,l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n(function(){c.value=d;c.getSnapshot=b;r(c)&&g({inst:c})},[a,d,b]);m(function(){r(c)&&g({inst:c});return a(function(){r(c)&&g({inst:c})})},[a]);p(d);return d}\nfunction r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!k(a,d)}catch(f){return!0}}function t(a,b){return b()}var u=\"undefined\"===typeof window||\"undefined\"===typeof window.document||\"undefined\"===typeof window.document.createElement?t:q;exports.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:u;\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim.production.min.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim.development.js');\n}\n","import { getObjectType } from \"./getObjectType.js\";\nexport function checkRendering(rendering, usage) {\n if (rendering === undefined || typeof rendering !== 'function') {\n throw new Error(\"The render function is not valid (received type \".concat(getObjectType(rendering), \").\\n\\n\").concat(usage));\n }\n}","export function getObjectType(object) {\n return Object.prototype.toString.call(object).slice(8, -1);\n}","export function createDocumentationLink(_ref) {\n var name = _ref.name,\n _ref$connector = _ref.connector,\n connector = _ref$connector === void 0 ? false : _ref$connector;\n return ['https://www.algolia.com/doc/api-reference/widgets/', name, '/js/', connector ? '#connector' : ''].join('');\n}\nexport function createDocumentationMessageGenerator() {\n for (var _len = arguments.length, widgets = new Array(_len), _key = 0; _key < _len; _key++) {\n widgets[_key] = arguments[_key];\n }\n var links = widgets.map(function (widget) {\n return createDocumentationLink(widget);\n }).join(', ');\n return function (message) {\n return [message, \"See documentation: \".concat(links)].filter(Boolean).join('\\n\\n');\n };\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError(\"Cannot destructure \" + obj); }\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nimport { escape } from \"./escape-html.js\";\nimport { isPlainObject } from \"./isPlainObject.js\";\nexport var TAG_PLACEHOLDER = {\n highlightPreTag: '__ais-highlight__',\n highlightPostTag: '__/ais-highlight__'\n};\nexport var TAG_REPLACEMENT = {\n highlightPreTag: '',\n highlightPostTag: ''\n};\n\n// @MAJOR: in the future, this should only escape, not replace\nfunction replaceTagsAndEscape(value) {\n return escape(value).replace(new RegExp(TAG_PLACEHOLDER.highlightPreTag, 'g'), TAG_REPLACEMENT.highlightPreTag).replace(new RegExp(TAG_PLACEHOLDER.highlightPostTag, 'g'), TAG_REPLACEMENT.highlightPostTag);\n}\nfunction recursiveEscape(input) {\n if (isPlainObject(input) && typeof input.value !== 'string') {\n return Object.keys(input).reduce(function (acc, key) {\n return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, key, recursiveEscape(input[key])));\n }, {});\n }\n if (Array.isArray(input)) {\n return input.map(recursiveEscape);\n }\n return _objectSpread(_objectSpread({}, input), {}, {\n value: replaceTagsAndEscape(input.value)\n });\n}\nexport function escapeHits(hits) {\n if (hits.__escaped === undefined) {\n // We don't override the value on hit because it will mutate the raw results\n // instead we make a shallow copy and we assign the escaped values on it.\n hits = hits.map(function (_ref) {\n var hit = _extends({}, (_objectDestructuringEmpty(_ref), _ref));\n if (hit._highlightResult) {\n hit._highlightResult = recursiveEscape(hit._highlightResult);\n }\n if (hit._snippetResult) {\n hit._snippetResult = recursiveEscape(hit._snippetResult);\n }\n return hit;\n });\n hits.__escaped = true;\n }\n return hits;\n}\nexport function escapeFacets(facetHits) {\n return facetHits.map(function (h) {\n return _objectSpread(_objectSpread({}, h), {}, {\n highlighted: replaceTagsAndEscape(h.highlighted)\n });\n });\n}","/**\n * This implementation is taken from Lodash implementation.\n * See: https://github.com/lodash/lodash/blob/4.17.11-npm/escape.js\n */\n\n// Used to map characters to HTML entities.\nvar htmlEntities = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n \"'\": '''\n};\n\n// Used to match HTML entities and HTML characters.\nvar regexUnescapedHtml = /[&<>\"']/g;\nvar regexHasUnescapedHtml = RegExp(regexUnescapedHtml.source);\n\n/**\n * Converts the characters \"&\", \"<\", \">\", '\"', and \"'\" in `string` to their\n * corresponding HTML entities.\n */\nexport function escape(value) {\n return value && regexHasUnescapedHtml.test(value) ? value.replace(regexUnescapedHtml, function (character) {\n return htmlEntities[character];\n }) : value;\n}\n\n/**\n * This implementation is taken from Lodash implementation.\n * See: https://github.com/lodash/lodash/blob/4.17.11-npm/unescape.js\n */\n\n// Used to map HTML entities to characters.\nvar htmlCharacters = {\n '&': '&',\n '<': '<',\n '>': '>',\n '"': '\"',\n ''': \"'\"\n};\n\n// Used to match HTML entities and HTML characters.\nvar regexEscapedHtml = /&(amp|quot|lt|gt|#39);/g;\nvar regexHasEscapedHtml = RegExp(regexEscapedHtml.source);\n\n/**\n * Converts the HTML entities \"&\", \"<\", \">\", '\"', and \"'\" in `string` to their\n * characters.\n */\nexport function unescape(value) {\n return value && regexHasEscapedHtml.test(value) ? value.replace(regexEscapedHtml, function (character) {\n return htmlCharacters[character];\n }) : value;\n}","import { TAG_REPLACEMENT } from \"./escape-highlight.js\";\nexport function getHighlightedParts(highlightedValue) {\n // @MAJOR: this should use TAG_PLACEHOLDER\n var highlightPostTag = TAG_REPLACEMENT.highlightPostTag,\n highlightPreTag = TAG_REPLACEMENT.highlightPreTag;\n var splitByPreTag = highlightedValue.split(highlightPreTag);\n var firstValue = splitByPreTag.shift();\n var elements = !firstValue ? [] : [{\n value: firstValue,\n isHighlighted: false\n }];\n splitByPreTag.forEach(function (split) {\n var splitByPostTag = split.split(highlightPostTag);\n elements.push({\n value: splitByPostTag[0],\n isHighlighted: true\n });\n if (splitByPostTag[1] !== '') {\n elements.push({\n value: splitByPostTag[1],\n isHighlighted: false\n });\n }\n });\n return elements;\n}","export function getPropertyByPath(object, path) {\n var parts = Array.isArray(path) ? path : path.split('.');\n return parts.reduce(function (current, key) {\n return current && current[key];\n }, object);\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n/**\n * This implementation is taken from Lodash implementation.\n * See: https://github.com/lodash/lodash/blob/master/isPlainObject.js\n */\n\nfunction getTag(value) {\n if (value === null) {\n return value === undefined ? '[object Undefined]' : '[object Null]';\n }\n return Object.prototype.toString.call(value);\n}\nfunction isObjectLike(value) {\n return _typeof(value) === 'object' && value !== null;\n}\n\n/**\n * Checks if `value` is a plain object.\n *\n * A plain object is an object created by the `Object`\n * constructor or with a `[[Prototype]]` of `null`.\n */\nexport function isPlainObject(value) {\n if (!isObjectLike(value) || getTag(value) !== '[object Object]') {\n return false;\n }\n if (Object.getPrototypeOf(value) === null) {\n return true;\n }\n var proto = value;\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n return Object.getPrototypeOf(value) === proto;\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nvar _excluded = [\"facets\", \"disjunctiveFacets\", \"facetsRefinements\", \"facetsExcludes\", \"disjunctiveFacetsRefinements\", \"numericRefinements\", \"tagRefinements\", \"hierarchicalFacets\", \"hierarchicalFacetsRefinements\", \"ruleContexts\"];\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\nimport { findIndex } from \"./findIndex.js\";\nimport { uniq } from \"./uniq.js\";\nvar mergeWithRest = function mergeWithRest(left, right) {\n var facets = right.facets,\n disjunctiveFacets = right.disjunctiveFacets,\n facetsRefinements = right.facetsRefinements,\n facetsExcludes = right.facetsExcludes,\n disjunctiveFacetsRefinements = right.disjunctiveFacetsRefinements,\n numericRefinements = right.numericRefinements,\n tagRefinements = right.tagRefinements,\n hierarchicalFacets = right.hierarchicalFacets,\n hierarchicalFacetsRefinements = right.hierarchicalFacetsRefinements,\n ruleContexts = right.ruleContexts,\n rest = _objectWithoutProperties(right, _excluded);\n return left.setQueryParameters(rest);\n};\n\n// Merge facets\nvar mergeFacets = function mergeFacets(left, right) {\n return right.facets.reduce(function (_, name) {\n return _.addFacet(name);\n }, left);\n};\nvar mergeDisjunctiveFacets = function mergeDisjunctiveFacets(left, right) {\n return right.disjunctiveFacets.reduce(function (_, name) {\n return _.addDisjunctiveFacet(name);\n }, left);\n};\nvar mergeHierarchicalFacets = function mergeHierarchicalFacets(left, right) {\n return left.setQueryParameters({\n hierarchicalFacets: right.hierarchicalFacets.reduce(function (facets, facet) {\n var index = findIndex(facets, function (_) {\n return _.name === facet.name;\n });\n if (index === -1) {\n return facets.concat(facet);\n }\n var nextFacets = facets.slice();\n nextFacets.splice(index, 1, facet);\n return nextFacets;\n }, left.hierarchicalFacets)\n });\n};\n\n// Merge facet refinements\nvar mergeTagRefinements = function mergeTagRefinements(left, right) {\n return right.tagRefinements.reduce(function (_, value) {\n return _.addTagRefinement(value);\n }, left);\n};\nvar mergeFacetRefinements = function mergeFacetRefinements(left, right) {\n return left.setQueryParameters({\n facetsRefinements: _objectSpread(_objectSpread({}, left.facetsRefinements), right.facetsRefinements)\n });\n};\nvar mergeFacetsExcludes = function mergeFacetsExcludes(left, right) {\n return left.setQueryParameters({\n facetsExcludes: _objectSpread(_objectSpread({}, left.facetsExcludes), right.facetsExcludes)\n });\n};\nvar mergeDisjunctiveFacetsRefinements = function mergeDisjunctiveFacetsRefinements(left, right) {\n return left.setQueryParameters({\n disjunctiveFacetsRefinements: _objectSpread(_objectSpread({}, left.disjunctiveFacetsRefinements), right.disjunctiveFacetsRefinements)\n });\n};\nvar mergeNumericRefinements = function mergeNumericRefinements(left, right) {\n return left.setQueryParameters({\n numericRefinements: _objectSpread(_objectSpread({}, left.numericRefinements), right.numericRefinements)\n });\n};\nvar mergeHierarchicalFacetsRefinements = function mergeHierarchicalFacetsRefinements(left, right) {\n return left.setQueryParameters({\n hierarchicalFacetsRefinements: _objectSpread(_objectSpread({}, left.hierarchicalFacetsRefinements), right.hierarchicalFacetsRefinements)\n });\n};\nvar mergeRuleContexts = function mergeRuleContexts(left, right) {\n var ruleContexts = uniq([].concat(left.ruleContexts).concat(right.ruleContexts).filter(Boolean));\n if (ruleContexts.length > 0) {\n return left.setQueryParameters({\n ruleContexts: ruleContexts\n });\n }\n return left;\n};\nexport var mergeSearchParameters = function mergeSearchParameters() {\n for (var _len = arguments.length, parameters = new Array(_len), _key = 0; _key < _len; _key++) {\n parameters[_key] = arguments[_key];\n }\n return parameters.reduce(function (left, right) {\n var hierarchicalFacetsRefinementsMerged = mergeHierarchicalFacetsRefinements(left, right);\n var hierarchicalFacetsMerged = mergeHierarchicalFacets(hierarchicalFacetsRefinementsMerged, right);\n var tagRefinementsMerged = mergeTagRefinements(hierarchicalFacetsMerged, right);\n var numericRefinementsMerged = mergeNumericRefinements(tagRefinementsMerged, right);\n var disjunctiveFacetsRefinementsMerged = mergeDisjunctiveFacetsRefinements(numericRefinementsMerged, right);\n var facetsExcludesMerged = mergeFacetsExcludes(disjunctiveFacetsRefinementsMerged, right);\n var facetRefinementsMerged = mergeFacetRefinements(facetsExcludesMerged, right);\n var disjunctiveFacetsMerged = mergeDisjunctiveFacets(facetRefinementsMerged, right);\n var ruleContextsMerged = mergeRuleContexts(disjunctiveFacetsMerged, right);\n var facetsMerged = mergeFacets(ruleContextsMerged, right);\n return mergeWithRest(facetsMerged, right);\n });\n};","// We aren't using the native `Array.prototype.findIndex` because the refactor away from Lodash is not\n// published as a major version.\n// Relying on the `findIndex` polyfill on user-land, which before was only required for niche use-cases,\n// was decided as too risky.\n// @MAJOR Replace with the native `Array.prototype.findIndex` method\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex\nexport function findIndex(array, comparator) {\n if (!Array.isArray(array)) {\n return -1;\n }\n for (var i = 0; i < array.length; i++) {\n if (comparator(array[i])) {\n return i;\n }\n }\n return -1;\n}","export function uniq(array) {\n return array.filter(function (value, index, self) {\n return self.indexOf(value) === index;\n });\n}","export function noop() {}","export function serializePayload(payload) {\n return btoa(encodeURIComponent(JSON.stringify(payload)));\n}\nexport function deserializePayload(serialized) {\n return JSON.parse(decodeURIComponent(atob(serialized)));\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nimport algoliasearchHelper from 'algoliasearch-helper';\nimport { createDocumentationMessageGenerator, isPlainObject, mergeSearchParameters, noop } from \"../../lib/utils/index.js\";\n\n/**\n * Refine the given search parameters.\n */\n\nvar withUsage = createDocumentationMessageGenerator({\n name: 'configure',\n connector: true\n});\nfunction getInitialSearchParameters(state, widgetParams) {\n // We leverage the helper internals to remove the `widgetParams` from\n // the state. The function `setQueryParameters` omits the values that\n // are `undefined` on the next state.\n return state.setQueryParameters(Object.keys(widgetParams.searchParameters).reduce(function (acc, key) {\n return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, key, undefined));\n }, {}));\n}\nvar connectConfigure = function connectConfigure() {\n var renderFn = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : noop;\n var unmountFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;\n return function (widgetParams) {\n if (!widgetParams || !isPlainObject(widgetParams.searchParameters)) {\n throw new Error(withUsage('The `searchParameters` option expects an object.'));\n }\n var connectorState = {};\n function refine(helper) {\n return function (searchParameters) {\n // Merge new `searchParameters` with the ones set from other widgets\n var actualState = getInitialSearchParameters(helper.state, widgetParams);\n var nextSearchParameters = mergeSearchParameters(actualState, new algoliasearchHelper.SearchParameters(searchParameters));\n\n // Update original `widgetParams.searchParameters` to the new refined one\n widgetParams.searchParameters = searchParameters;\n\n // Trigger a search with the resolved search parameters\n helper.setState(nextSearchParameters).search();\n };\n }\n return {\n $$type: 'ais.configure',\n init: function init(initOptions) {\n var instantSearchInstance = initOptions.instantSearchInstance;\n renderFn(_objectSpread(_objectSpread({}, this.getWidgetRenderState(initOptions)), {}, {\n instantSearchInstance: instantSearchInstance\n }), true);\n },\n render: function render(renderOptions) {\n var instantSearchInstance = renderOptions.instantSearchInstance;\n renderFn(_objectSpread(_objectSpread({}, this.getWidgetRenderState(renderOptions)), {}, {\n instantSearchInstance: instantSearchInstance\n }), false);\n },\n dispose: function dispose(_ref) {\n var state = _ref.state;\n unmountFn();\n return getInitialSearchParameters(state, widgetParams);\n },\n getRenderState: function getRenderState(renderState, renderOptions) {\n var _renderState$configur;\n var widgetRenderState = this.getWidgetRenderState(renderOptions);\n return _objectSpread(_objectSpread({}, renderState), {}, {\n configure: _objectSpread(_objectSpread({}, widgetRenderState), {}, {\n widgetParams: _objectSpread(_objectSpread({}, widgetRenderState.widgetParams), {}, {\n searchParameters: mergeSearchParameters(new algoliasearchHelper.SearchParameters((_renderState$configur = renderState.configure) === null || _renderState$configur === void 0 ? void 0 : _renderState$configur.widgetParams.searchParameters), new algoliasearchHelper.SearchParameters(widgetRenderState.widgetParams.searchParameters)).getQueryParams()\n })\n })\n });\n },\n getWidgetRenderState: function getWidgetRenderState(_ref2) {\n var helper = _ref2.helper;\n if (!connectorState.refine) {\n connectorState.refine = refine(helper);\n }\n return {\n refine: connectorState.refine,\n widgetParams: widgetParams\n };\n },\n getWidgetSearchParameters: function getWidgetSearchParameters(state, _ref3) {\n var uiState = _ref3.uiState;\n return mergeSearchParameters(state, new algoliasearchHelper.SearchParameters(_objectSpread(_objectSpread({}, uiState.configure), widgetParams.searchParameters)));\n },\n getWidgetUiState: function getWidgetUiState(uiState) {\n return _objectSpread(_objectSpread({}, uiState), {}, {\n configure: _objectSpread(_objectSpread({}, uiState.configure), widgetParams.searchParameters)\n });\n }\n };\n };\n};\nexport default connectConfigure;","import { useConfigure } from \"../connectors/useConfigure.js\";\nexport function Configure(props) {\n useConfigure(props, {\n $$widgetType: 'ais.configure'\n });\n return null;\n}","import connectConfigure from \"instantsearch.js/es/connectors/configure/connectConfigure.js\";\nimport { useConnector } from \"../hooks/useConnector.js\";\nexport function useConfigure(props, additionalWidgetProperties) {\n return useConnector(connectConfigure, {\n searchParameters: props\n }, additionalWidgetProperties);\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nimport { warning } from \"../lib/utils/index.js\";\nexport var ANONYMOUS_TOKEN_COOKIE_KEY = '_ALGOLIA';\nfunction getCookie(name) {\n if ((typeof document === \"undefined\" ? \"undefined\" : _typeof(document)) !== 'object' || typeof document.cookie !== 'string') {\n return undefined;\n }\n var prefix = \"\".concat(name, \"=\");\n var cookies = document.cookie.split(';');\n for (var i = 0; i < cookies.length; i++) {\n var cookie = cookies[i];\n while (cookie.charAt(0) === ' ') {\n cookie = cookie.substring(1);\n }\n if (cookie.indexOf(prefix) === 0) {\n return cookie.substring(prefix.length, cookie.length);\n }\n }\n return undefined;\n}\nexport function getInsightsAnonymousUserTokenInternal() {\n return getCookie(ANONYMOUS_TOKEN_COOKIE_KEY);\n}\n\n/**\n * @deprecated This function will be still supported in 4.x releases, but not further. It is replaced by the `insights` middleware. For 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/\n */\nexport default function getInsightsAnonymousUserToken() {\n process.env.NODE_ENV === 'development' ? warning(false, \"`getInsightsAnonymousUserToken` function 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/\") : void 0;\n return getInsightsAnonymousUserTokenInternal();\n}","// eslint-disable-next-line no-restricted-globals\n\n/**\n * Runs code on browser environments safely.\n */\nexport function safelyRunOnBrowser(callback) {\n var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n fallback: function fallback() {\n return undefined;\n }\n },\n fallback = _ref.fallback;\n // eslint-disable-next-line no-restricted-globals\n if (typeof window === 'undefined') {\n return fallback();\n }\n\n // eslint-disable-next-line no-restricted-globals\n return callback({\n window: window\n });\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : \"undefined\" != typeof Symbol && arr[Symbol.iterator] || arr[\"@@iterator\"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nimport { getInsightsAnonymousUserTokenInternal } from \"../helpers/index.js\";\nimport { warning, noop, getAppIdAndApiKey, find, safelyRunOnBrowser } from \"../lib/utils/index.js\";\nvar ALGOLIA_INSIGHTS_VERSION = '2.6.0';\nvar ALGOLIA_INSIGHTS_SRC = \"https://cdn.jsdelivr.net/npm/search-insights@\".concat(ALGOLIA_INSIGHTS_VERSION, \"/dist/search-insights.min.js\");\nexport function createInsightsMiddleware() {\n var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var _insightsClient = props.insightsClient,\n insightsInitParams = props.insightsInitParams,\n onEvent = props.onEvent,\n _props$$$internal = props.$$internal,\n $$internal = _props$$$internal === void 0 ? false : _props$$$internal;\n var potentialInsightsClient = _insightsClient;\n if (!_insightsClient && _insightsClient !== null) {\n safelyRunOnBrowser(function (_ref) {\n var window = _ref.window;\n var pointer = window.AlgoliaAnalyticsObject || 'aa';\n if (typeof pointer === 'string') {\n potentialInsightsClient = window[pointer];\n }\n if (!potentialInsightsClient) {\n window.AlgoliaAnalyticsObject = pointer;\n if (!window[pointer]) {\n window[pointer] = function () {\n if (!window[pointer].queue) {\n window[pointer].queue = [];\n }\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n window[pointer].queue.push(args);\n };\n window[pointer].version = ALGOLIA_INSIGHTS_VERSION;\n window[pointer].shouldAddScript = true;\n }\n potentialInsightsClient = window[pointer];\n }\n });\n }\n // if still no insightsClient was found, we use a noop\n var insightsClient = potentialInsightsClient || noop;\n return function (_ref2) {\n var instantSearchInstance = _ref2.instantSearchInstance;\n // remove existing default insights middleware\n // user-provided insights middleware takes precedence\n var existingInsightsMiddlewares = instantSearchInstance.middleware.filter(function (m) {\n return m.instance.$$type === 'ais.insights' && m.instance.$$internal;\n }).map(function (m) {\n return m.creator;\n });\n instantSearchInstance.unuse.apply(instantSearchInstance, _toConsumableArray(existingInsightsMiddlewares));\n var _getAppIdAndApiKey = getAppIdAndApiKey(instantSearchInstance.client),\n _getAppIdAndApiKey2 = _slicedToArray(_getAppIdAndApiKey, 2),\n appId = _getAppIdAndApiKey2[0],\n apiKey = _getAppIdAndApiKey2[1];\n\n // search-insights.js also throws an error so dev-only clarification is sufficient\n process.env.NODE_ENV === 'development' ? warning(Boolean(appId && apiKey), 'could not extract Algolia credentials from searchClient in insights middleware.') : void 0;\n var queuedUserToken = undefined;\n var userTokenBeforeInit = undefined;\n if (Array.isArray(insightsClient.queue)) {\n // Context: The umd build of search-insights is asynchronously loaded by the snippet.\n //\n // When user calls `aa('setUserToken', 'my-user-token')` before `search-insights` is loaded,\n // ['setUserToken', 'my-user-token'] gets stored in `aa.queue`.\n // Whenever `search-insights` is finally loaded, it will process the queue.\n //\n // But here's the reason why we handle it here:\n // At this point, even though `search-insights` is not loaded yet,\n // we still want to read the token from the queue.\n // Otherwise, the first search call will be fired without the token.\n var _ref3 = find(insightsClient.queue.slice().reverse(), function (_ref5) {\n var _ref6 = _slicedToArray(_ref5, 1),\n method = _ref6[0];\n return method === 'setUserToken';\n }) || [];\n var _ref4 = _slicedToArray(_ref3, 2);\n queuedUserToken = _ref4[1];\n }\n insightsClient('getUserToken', null, function (_error, userToken) {\n // If user has called `aa('setUserToken', 'my-user-token')` before creating\n // the `insights` middleware, we store them temporarily and\n // set it later on.\n //\n // Otherwise, the `init` call might override it with anonymous user token.\n userTokenBeforeInit = userToken;\n });\n\n // Only `init` if the `insightsInitParams` option is passed or\n // if the `insightsClient` version doesn't supports optional `init` calling.\n if (insightsInitParams || !isModernInsightsClient(insightsClient)) {\n insightsClient('init', _objectSpread({\n appId: appId,\n apiKey: apiKey,\n partial: true\n }, insightsInitParams));\n }\n var initialParameters;\n var helper;\n return {\n $$type: 'ais.insights',\n $$internal: $$internal,\n onStateChange: function onStateChange() {},\n subscribe: function subscribe() {\n if (!insightsClient.shouldAddScript) return;\n var errorMessage = '[insights middleware]: could not load search-insights.js. Please load it manually following https://alg.li/insights-init';\n try {\n var script = document.createElement('script');\n script.async = true;\n script.src = ALGOLIA_INSIGHTS_SRC;\n script.onerror = function () {\n instantSearchInstance.emit('error', new Error(errorMessage));\n };\n document.body.appendChild(script);\n insightsClient.shouldAddScript = false;\n } catch (cause) {\n insightsClient.shouldAddScript = false;\n instantSearchInstance.emit('error', new Error(errorMessage));\n }\n },\n started: function started() {\n insightsClient('addAlgoliaAgent', 'insights-middleware');\n helper = instantSearchInstance.helper;\n initialParameters = {\n userToken: helper.state.userToken,\n clickAnalytics: helper.state.clickAnalytics\n };\n helper.overrideStateWithoutTriggeringChangeEvent(_objectSpread(_objectSpread({}, helper.state), {}, {\n clickAnalytics: true\n }));\n if (!$$internal) {\n instantSearchInstance.scheduleSearch();\n }\n var setUserTokenToSearch = function setUserTokenToSearch(userToken) {\n var immediate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n if (!userToken) {\n return;\n }\n var existingToken = helper.state.userToken;\n function applyToken() {\n helper.overrideStateWithoutTriggeringChangeEvent(_objectSpread(_objectSpread({}, helper.state), {}, {\n userToken: userToken\n }));\n if (existingToken && existingToken !== userToken) {\n instantSearchInstance.scheduleSearch();\n }\n }\n\n // Delay the token application to the next render cycle\n if (!immediate) {\n setTimeout(applyToken, 0);\n } else {\n applyToken();\n }\n };\n var anonymousUserToken = getInsightsAnonymousUserTokenInternal();\n if (anonymousUserToken) {\n // When `aa('init', { ... })` is called, it creates an anonymous user token in cookie.\n // We can set it as userToken.\n setUserTokenToSearch(anonymousUserToken, true);\n }\n\n // We consider the `userToken` coming from a `init` call to have a higher\n // importance than the one coming from the queue.\n if (userTokenBeforeInit) {\n setUserTokenToSearch(userTokenBeforeInit, true);\n insightsClient('setUserToken', userTokenBeforeInit);\n } else if (queuedUserToken) {\n setUserTokenToSearch(queuedUserToken, true);\n insightsClient('setUserToken', queuedUserToken);\n }\n\n // This updates userToken which is set explicitly by `aa('setUserToken', userToken)`\n insightsClient('onUserTokenChange', setUserTokenToSearch, {\n immediate: true\n });\n var insightsClientWithLocalCredentials = insightsClient;\n if (isModernInsightsClient(insightsClient)) {\n insightsClientWithLocalCredentials = function insightsClientWithLocalCredentials(method, payload) {\n var extraParams = {\n headers: {\n 'X-Algolia-Application-Id': appId,\n 'X-Algolia-API-Key': apiKey\n }\n };\n\n // @ts-ignore we are calling this only when we know that the client actually is correct\n return insightsClient(method, payload, extraParams);\n };\n }\n instantSearchInstance.sendEventToInsights = function (event) {\n if (onEvent) {\n onEvent(event, insightsClientWithLocalCredentials);\n } else if (event.insightsMethod) {\n // Source is used to differentiate events sent by instantsearch from those sent manually.\n event.payload.algoliaSource = ['instantsearch'];\n if (event.eventModifier === 'internal') {\n event.payload.algoliaSource.push('instantsearch-internal');\n }\n insightsClientWithLocalCredentials(event.insightsMethod, event.payload);\n process.env.NODE_ENV === 'development' ? warning(Boolean(helper.state.userToken), \"\\nCannot send event to Algolia Insights because `userToken` is not set.\\n\\nSee documentation: https://www.algolia.com/doc/guides/building-search-ui/going-further/send-insights-events/js/#setting-the-usertoken\\n\") : void 0;\n } else {\n process.env.NODE_ENV === 'development' ? warning(false, 'Cannot send event to Algolia Insights because `insightsMethod` option is missing.') : void 0;\n }\n };\n },\n unsubscribe: function unsubscribe() {\n insightsClient('onUserTokenChange', undefined);\n instantSearchInstance.sendEventToInsights = noop;\n if (helper && initialParameters) {\n helper.overrideStateWithoutTriggeringChangeEvent(_objectSpread(_objectSpread({}, helper.state), initialParameters));\n instantSearchInstance.scheduleSearch();\n }\n }\n };\n };\n}\n\n/**\n * Determines if a given insights `client` supports the optional call to `init`\n * and the ability to set credentials via extra parameters when sending events.\n */\nfunction isModernInsightsClient(client) {\n var _split$map = (client.version || '').split('.').map(Number),\n _split$map2 = _slicedToArray(_split$map, 2),\n major = _split$map2[0],\n minor = _split$map2[1];\n\n /* eslint-disable @typescript-eslint/naming-convention */\n var v3 = major >= 3;\n var v2_6 = major === 2 && minor >= 6;\n var v1_10 = major === 1 && minor >= 10;\n /* eslint-enable @typescript-eslint/naming-convention */\n\n return v3 || v2_6 || v1_10;\n}","export function createInitArgs(instantSearchInstance, parent, uiState) {\n var helper = parent.getHelper();\n return {\n uiState: uiState,\n helper: helper,\n parent: parent,\n instantSearchInstance: instantSearchInstance,\n state: helper.state,\n renderState: instantSearchInstance.renderState,\n templatesConfig: instantSearchInstance.templatesConfig,\n createURL: parent.createURL,\n scopedResults: [],\n searchMetadata: {\n isSearchStalled: instantSearchInstance.status === 'stalled'\n },\n status: instantSearchInstance.status,\n error: instantSearchInstance.error\n };\n}\nexport function createRenderArgs(instantSearchInstance, parent) {\n var results = parent.getResults();\n var helper = parent.getHelper();\n return {\n helper: helper,\n parent: parent,\n instantSearchInstance: instantSearchInstance,\n results: results,\n scopedResults: parent.getScopedResults(),\n state: results ? results._state : helper.state,\n renderState: instantSearchInstance.renderState,\n templatesConfig: instantSearchInstance.templatesConfig,\n createURL: parent.createURL,\n searchMetadata: {\n isSearchStalled: instantSearchInstance.status === 'stalled'\n },\n status: instantSearchInstance.status,\n error: instantSearchInstance.error\n };\n}","import { createInitArgs, safelyRunOnBrowser } from \"../lib/utils/index.js\";\nfunction extractWidgetPayload(widgets, instantSearchInstance, payload) {\n var initOptions = createInitArgs(instantSearchInstance, instantSearchInstance.mainIndex, instantSearchInstance._initialUiState);\n widgets.forEach(function (widget) {\n var widgetParams = {};\n if (widget.getWidgetRenderState) {\n var renderState = widget.getWidgetRenderState(initOptions);\n if (renderState && renderState.widgetParams) {\n // casting, as we just earlier checked widgetParams exists, and thus an object\n widgetParams = renderState.widgetParams;\n }\n }\n\n // since we destructure in all widgets, the parameters with defaults are set to \"undefined\"\n var params = Object.keys(widgetParams).filter(function (key) {\n return widgetParams[key] !== undefined;\n });\n payload.widgets.push({\n type: widget.$$type,\n widgetType: widget.$$widgetType,\n params: params\n });\n if (widget.$$type === 'ais.index') {\n extractWidgetPayload(widget.getWidgets(), instantSearchInstance, payload);\n }\n });\n}\nexport function isMetadataEnabled() {\n return safelyRunOnBrowser(function (_ref) {\n var _window$navigator, _window$navigator$use;\n var window = _ref.window;\n return ((_window$navigator = window.navigator) === null || _window$navigator === void 0 ? void 0 : (_window$navigator$use = _window$navigator.userAgent) === null || _window$navigator$use === void 0 ? void 0 : _window$navigator$use.indexOf('Algolia Crawler')) > -1;\n }, {\n fallback: function fallback() {\n return false;\n }\n });\n}\n\n/**\n * Exposes the metadata of mounted widgets in a custom\n * `` tag. The metadata per widget is:\n * - applied parameters\n * - widget name\n * - connector name\n */\nexport function createMetadataMiddleware() {\n var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n _ref2$$$internal = _ref2.$$internal,\n $$internal = _ref2$$$internal === void 0 ? false : _ref2$$$internal;\n return function (_ref3) {\n var instantSearchInstance = _ref3.instantSearchInstance;\n var payload = {\n widgets: []\n };\n var payloadContainer = document.createElement('meta');\n var refNode = document.querySelector('head');\n payloadContainer.name = 'instantsearch:widgets';\n return {\n $$type: 'ais.metadata',\n $$internal: $$internal,\n onStateChange: function onStateChange() {},\n subscribe: function subscribe() {\n // using setTimeout here to delay extraction until widgets have been added in a tick (e.g. Vue)\n setTimeout(function () {\n var client = instantSearchInstance.client;\n payload.ua = client.transporter && client.transporter.userAgent ? client.transporter.userAgent.value : client._ua;\n extractWidgetPayload(instantSearchInstance.mainIndex.getWidgets(), instantSearchInstance, payload);\n instantSearchInstance.middleware.forEach(function (middleware) {\n return payload.widgets.push({\n middleware: true,\n type: middleware.instance.$$type,\n internal: middleware.instance.$$internal\n });\n });\n payloadContainer.content = JSON.stringify(payload);\n refNode.appendChild(payloadContainer);\n }, 0);\n },\n started: function started() {},\n unsubscribe: function unsubscribe() {\n payloadContainer.remove();\n }\n };\n };\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nimport qs from 'qs';\nimport { safelyRunOnBrowser, warning } from \"../utils/index.js\";\nvar setWindowTitle = function setWindowTitle(title) {\n if (title) {\n // This function is only executed on browsers so we can disable this check.\n // eslint-disable-next-line no-restricted-globals\n window.document.title = title;\n }\n};\nvar BrowserHistory = /*#__PURE__*/function () {\n /**\n * Initializes a new storage provider that syncs the search state to the URL\n * using web APIs (`window.location.pushState` and `onpopstate` event).\n */\n function BrowserHistory(_ref) {\n var _this = this;\n var windowTitle = _ref.windowTitle,\n _ref$writeDelay = _ref.writeDelay,\n writeDelay = _ref$writeDelay === void 0 ? 400 : _ref$writeDelay,\n createURL = _ref.createURL,\n parseURL = _ref.parseURL,\n getLocation = _ref.getLocation,\n start = _ref.start,\n dispose = _ref.dispose,\n push = _ref.push;\n _classCallCheck(this, BrowserHistory);\n _defineProperty(this, \"$$type\", 'ais.browser');\n /**\n * Transforms a UI state into a title for the page.\n */\n _defineProperty(this, \"windowTitle\", void 0);\n /**\n * Time in milliseconds before performing a write in the history.\n * It prevents from adding too many entries in the history and\n * makes the back button more usable.\n *\n * @default 400\n */\n _defineProperty(this, \"writeDelay\", void 0);\n /**\n * Creates a full URL based on the route state.\n * The storage adaptor maps all syncable keys to the query string of the URL.\n */\n _defineProperty(this, \"_createURL\", void 0);\n /**\n * Parses the URL into a route state.\n * It should be symmetrical to `createURL`.\n */\n _defineProperty(this, \"parseURL\", void 0);\n /**\n * Returns the location to store in the history.\n * @default () => window.location\n */\n _defineProperty(this, \"getLocation\", void 0);\n _defineProperty(this, \"writeTimer\", void 0);\n _defineProperty(this, \"_onPopState\", void 0);\n /**\n * Indicates if last action was back/forward in the browser.\n */\n _defineProperty(this, \"inPopState\", false);\n /**\n * Indicates whether the history router is disposed or not.\n */\n _defineProperty(this, \"isDisposed\", false);\n /**\n * Indicates the window.history.length before the last call to\n * window.history.pushState (called in `write`).\n * It allows to determine if a `pushState` has been triggered elsewhere,\n * and thus to prevent the `write` method from calling `pushState`.\n */\n _defineProperty(this, \"latestAcknowledgedHistory\", 0);\n _defineProperty(this, \"_start\", void 0);\n _defineProperty(this, \"_dispose\", void 0);\n _defineProperty(this, \"_push\", void 0);\n this.windowTitle = windowTitle;\n this.writeTimer = undefined;\n this.writeDelay = writeDelay;\n this._createURL = createURL;\n this.parseURL = parseURL;\n this.getLocation = getLocation;\n this._start = start;\n this._dispose = dispose;\n this._push = push;\n safelyRunOnBrowser(function (_ref2) {\n var window = _ref2.window;\n var title = _this.windowTitle && _this.windowTitle(_this.read());\n setWindowTitle(title);\n _this.latestAcknowledgedHistory = window.history.length;\n });\n }\n\n /**\n * Reads the URL and returns a syncable UI search state.\n */\n _createClass(BrowserHistory, [{\n key: \"read\",\n value: function read() {\n return this.parseURL({\n qsModule: qs,\n location: this.getLocation()\n });\n }\n\n /**\n * Pushes a search state into the URL.\n */\n }, {\n key: \"write\",\n value: function write(routeState) {\n var _this2 = this;\n safelyRunOnBrowser(function (_ref3) {\n var window = _ref3.window;\n var url = _this2.createURL(routeState);\n var title = _this2.windowTitle && _this2.windowTitle(routeState);\n if (_this2.writeTimer) {\n clearTimeout(_this2.writeTimer);\n }\n _this2.writeTimer = setTimeout(function () {\n setWindowTitle(title);\n if (_this2.shouldWrite(url)) {\n if (_this2._push) {\n _this2._push(url);\n } else {\n window.history.pushState(routeState, title || '', url);\n }\n _this2.latestAcknowledgedHistory = window.history.length;\n }\n _this2.inPopState = false;\n _this2.writeTimer = undefined;\n }, _this2.writeDelay);\n });\n }\n\n /**\n * Sets a callback on the `onpopstate` event of the history API of the current page.\n * It enables the URL sync to keep track of the changes.\n */\n }, {\n key: \"onUpdate\",\n value: function onUpdate(callback) {\n var _this3 = this;\n if (this._start) {\n this._start(function () {\n callback(_this3.read());\n });\n }\n this._onPopState = function () {\n if (_this3.writeTimer) {\n clearTimeout(_this3.writeTimer);\n _this3.writeTimer = undefined;\n }\n _this3.inPopState = true;\n\n // We always read the state from the URL because the state of the history\n // can be incorect in some cases (e.g. using React Router).\n callback(_this3.read());\n };\n safelyRunOnBrowser(function (_ref4) {\n var window = _ref4.window;\n window.addEventListener('popstate', _this3._onPopState);\n });\n }\n\n /**\n * Creates a complete URL from a given syncable UI state.\n *\n * It always generates the full URL, not a relative one.\n * This allows to handle cases like using a .\n * See: https://github.com/algolia/instantsearch.js/issues/790\n */\n }, {\n key: \"createURL\",\n value: function createURL(routeState) {\n var url = this._createURL({\n qsModule: qs,\n routeState: routeState,\n location: this.getLocation()\n });\n if (process.env.NODE_ENV === 'development') {\n try {\n // We just want to check if the URL is valid.\n // eslint-disable-next-line no-new\n new URL(url);\n } catch (e) {\n process.env.NODE_ENV === 'development' ? warning(false, \"The URL returned by the `createURL` function is invalid.\\nPlease make sure it returns an absolute URL to avoid issues, e.g: `https://algolia.com/search?query=iphone`.\") : void 0;\n }\n }\n return url;\n }\n\n /**\n * Removes the event listener and cleans up the URL.\n */\n }, {\n key: \"dispose\",\n value: function dispose() {\n var _this4 = this;\n if (this._dispose) {\n this._dispose();\n }\n this.isDisposed = true;\n safelyRunOnBrowser(function (_ref5) {\n var window = _ref5.window;\n if (_this4._onPopState) {\n window.removeEventListener('popstate', _this4._onPopState);\n }\n });\n if (this.writeTimer) {\n clearTimeout(this.writeTimer);\n }\n this.write({});\n }\n }, {\n key: \"start\",\n value: function start() {\n this.isDisposed = false;\n }\n }, {\n key: \"shouldWrite\",\n value: function shouldWrite(url) {\n var _this5 = this;\n return safelyRunOnBrowser(function (_ref6) {\n var window = _ref6.window;\n // We do want to `pushState` if:\n // - the router is not disposed, IS.js needs to update the URL\n // OR\n // - the last write was from InstantSearch.js\n // (unlike a SPA, where it would have last written)\n var lastPushWasByISAfterDispose = !(_this5.isDisposed && _this5.latestAcknowledgedHistory !== window.history.length);\n return (\n // When the last state change was through popstate, the IS.js state changes,\n // but that should not write the URL.\n !_this5.inPopState &&\n // When the previous pushState after dispose was by IS.js, we want to write the URL.\n lastPushWasByISAfterDispose &&\n // When the URL is the same as the current one, we do not want to write it.\n url !== window.location.href\n );\n });\n }\n }]);\n return BrowserHistory;\n}();\nexport default function historyRouter() {\n var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n _ref7$createURL = _ref7.createURL,\n createURL = _ref7$createURL === void 0 ? function (_ref8) {\n var qsModule = _ref8.qsModule,\n routeState = _ref8.routeState,\n location = _ref8.location;\n var protocol = location.protocol,\n hostname = location.hostname,\n _location$port = location.port,\n port = _location$port === void 0 ? '' : _location$port,\n pathname = location.pathname,\n hash = location.hash;\n var queryString = qsModule.stringify(routeState);\n var portWithPrefix = port === '' ? '' : \":\".concat(port);\n\n // IE <= 11 has no proper `location.origin` so we cannot rely on it.\n if (!queryString) {\n return \"\".concat(protocol, \"//\").concat(hostname).concat(portWithPrefix).concat(pathname).concat(hash);\n }\n return \"\".concat(protocol, \"//\").concat(hostname).concat(portWithPrefix).concat(pathname, \"?\").concat(queryString).concat(hash);\n } : _ref7$createURL,\n _ref7$parseURL = _ref7.parseURL,\n parseURL = _ref7$parseURL === void 0 ? function (_ref9) {\n var qsModule = _ref9.qsModule,\n location = _ref9.location;\n // `qs` by default converts arrays with more than 20 items to an object.\n // We want to avoid this because the data structure manipulated can therefore vary.\n // Setting the limit to `100` seems a good number because the engine's default is 100\n // (it can go up to 1000 but it is very unlikely to select more than 100 items in the UI).\n //\n // Using an `arrayLimit` of `n` allows `n + 1` items.\n //\n // See:\n // - https://github.com/ljharb/qs#parsing-arrays\n // - https://www.algolia.com/doc/api-reference/api-parameters/maxValuesPerFacet/\n return qsModule.parse(location.search.slice(1), {\n arrayLimit: 99\n });\n } : _ref7$parseURL,\n _ref7$writeDelay = _ref7.writeDelay,\n writeDelay = _ref7$writeDelay === void 0 ? 400 : _ref7$writeDelay,\n windowTitle = _ref7.windowTitle,\n _ref7$getLocation = _ref7.getLocation,\n getLocation = _ref7$getLocation === void 0 ? function () {\n return safelyRunOnBrowser(function (_ref10) {\n var window = _ref10.window;\n return window.location;\n }, {\n fallback: function fallback() {\n throw new Error('You need to provide `getLocation` to the `history` router in environments where `window` does not exist.');\n }\n });\n } : _ref7$getLocation,\n start = _ref7.start,\n dispose = _ref7.dispose,\n push = _ref7.push;\n return new BrowserHistory({\n createURL: createURL,\n parseURL: parseURL,\n writeDelay: writeDelay,\n windowTitle: windowTitle,\n getLocation: getLocation,\n start: start,\n dispose: dispose,\n push: push\n });\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nvar _excluded = [\"configure\"];\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\nfunction getIndexStateWithoutConfigure(uiState) {\n var configure = uiState.configure,\n trackedUiState = _objectWithoutProperties(uiState, _excluded);\n return trackedUiState;\n}\n\n// technically a URL could contain any key, since users provide it,\n// which is why the input to this function is UiState, not something\n// which excludes \"configure\" as this function does.\nexport default function simpleStateMapping() {\n return {\n $$type: 'ais.simple',\n stateToRoute: function stateToRoute(uiState) {\n return Object.keys(uiState).reduce(function (state, indexId) {\n return _objectSpread(_objectSpread({}, state), {}, _defineProperty({}, indexId, getIndexStateWithoutConfigure(uiState[indexId])));\n }, {});\n },\n routeToState: function routeToState() {\n var routeState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return Object.keys(routeState).reduce(function (state, indexId) {\n return _objectSpread(_objectSpread({}, state), {}, _defineProperty({}, indexId, getIndexStateWithoutConfigure(routeState[indexId])));\n }, {});\n }\n };\n}","function isPrimitive(obj) {\n return obj !== Object(obj);\n}\nexport function isEqual(first, second) {\n if (first === second) {\n return true;\n }\n if (isPrimitive(first) || isPrimitive(second) || typeof first === 'function' || typeof second === 'function') {\n return first === second;\n }\n if (Object.keys(first).length !== Object.keys(second).length) {\n return false;\n }\n\n // @TODO avoid for..of because of the large polyfill\n // eslint-disable-next-line no-restricted-syntax\n for (var _i = 0, _Object$keys = Object.keys(first); _i < _Object$keys.length; _i++) {\n var key = _Object$keys[_i];\n if (!(key in second)) {\n return false;\n }\n if (!isEqual(first[key], second[key])) {\n return false;\n }\n }\n return true;\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nimport historyRouter from \"../lib/routers/history.js\";\nimport simpleStateMapping from \"../lib/stateMappings/simple.js\";\nimport { isEqual } from \"../lib/utils/index.js\";\nexport var createRouterMiddleware = function createRouterMiddleware() {\n var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var _props$router = props.router,\n router = _props$router === void 0 ? historyRouter() : _props$router,\n _props$stateMapping = props.stateMapping,\n stateMapping = _props$stateMapping === void 0 ? simpleStateMapping() : _props$stateMapping,\n _props$$$internal = props.$$internal,\n $$internal = _props$$$internal === void 0 ? false : _props$$$internal;\n return function (_ref) {\n var instantSearchInstance = _ref.instantSearchInstance;\n function topLevelCreateURL(nextState) {\n var previousUiState =\n // If only the mainIndex is initialized, we don't yet know what other\n // index widgets are used. Therefore we fall back to the initialUiState.\n // We can't indiscriminately use the initialUiState because then we\n // reintroduce state that was changed by the user.\n // When there are no widgets, we are sure the user can't yet have made\n // any changes.\n instantSearchInstance.mainIndex.getWidgets().length === 0 ? instantSearchInstance._initialUiState : instantSearchInstance.mainIndex.getWidgetUiState({});\n var uiState = Object.keys(nextState).reduce(function (acc, indexId) {\n return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, indexId, nextState[indexId]));\n }, previousUiState);\n var route = stateMapping.stateToRoute(uiState);\n return router.createURL(route);\n }\n\n // casting to UiState here to keep createURL unaware of custom UiState\n // (as long as it's an object, it's ok)\n instantSearchInstance._createURL = topLevelCreateURL;\n var lastRouteState = undefined;\n var initialUiState = instantSearchInstance._initialUiState;\n return {\n $$type: \"ais.router({router:\".concat(router.$$type || '__unknown__', \", stateMapping:\").concat(stateMapping.$$type || '__unknown__', \"})\"),\n $$internal: $$internal,\n onStateChange: function onStateChange(_ref2) {\n var uiState = _ref2.uiState;\n var routeState = stateMapping.stateToRoute(uiState);\n if (lastRouteState === undefined || !isEqual(lastRouteState, routeState)) {\n router.write(routeState);\n lastRouteState = routeState;\n }\n },\n subscribe: function subscribe() {\n instantSearchInstance._initialUiState = _objectSpread(_objectSpread({}, initialUiState), stateMapping.routeToState(router.read()));\n router.onUpdate(function (route) {\n if (instantSearchInstance.mainIndex.getWidgets().length > 0) {\n instantSearchInstance.setUiState(stateMapping.routeToState(route));\n }\n });\n },\n started: function started() {\n var _router$start;\n (_router$start = router.start) === null || _router$start === void 0 ? void 0 : _router$start.call(router);\n },\n unsubscribe: function unsubscribe() {\n router.dispose();\n }\n };\n };\n};","export function isIndexWidget(widget) {\n return widget.$$type === 'ais.index';\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nvar _excluded = [\"initialSearchParameters\"];\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\nimport algoliasearchHelper from 'algoliasearch-helper';\nimport { checkIndexUiState, createDocumentationMessageGenerator, resolveSearchParameters, mergeSearchParameters, warning, isIndexWidget, createInitArgs, createRenderArgs } from \"../../lib/utils/index.js\";\nvar withUsage = createDocumentationMessageGenerator({\n name: 'index-widget'\n});\n/**\n * This is the same content as helper._change / setState, but allowing for extra\n * UiState to be synchronized.\n * see: https://github.com/algolia/algoliasearch-helper-js/blob/6b835ffd07742f2d6b314022cce6848f5cfecd4a/src/algoliasearch.helper.js#L1311-L1324\n */\nfunction privateHelperSetState(helper, _ref) {\n var state = _ref.state,\n isPageReset = _ref.isPageReset,\n _uiState = _ref._uiState;\n if (state !== helper.state) {\n helper.state = state;\n helper.emit('change', {\n state: helper.state,\n results: helper.lastResults,\n isPageReset: isPageReset,\n _uiState: _uiState\n });\n }\n}\nfunction getLocalWidgetsUiState(widgets, widgetStateOptions) {\n var initialUiState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n return widgets.reduce(function (uiState, widget) {\n if (isIndexWidget(widget)) {\n return uiState;\n }\n if (!widget.getWidgetUiState && !widget.getWidgetState) {\n return uiState;\n }\n if (widget.getWidgetUiState) {\n return widget.getWidgetUiState(uiState, widgetStateOptions);\n }\n return widget.getWidgetState(uiState, widgetStateOptions);\n }, initialUiState);\n}\nfunction getLocalWidgetsSearchParameters(widgets, widgetSearchParametersOptions) {\n var initialSearchParameters = widgetSearchParametersOptions.initialSearchParameters,\n rest = _objectWithoutProperties(widgetSearchParametersOptions, _excluded);\n return widgets.filter(function (widget) {\n return !isIndexWidget(widget);\n }).reduce(function (state, widget) {\n if (!widget.getWidgetSearchParameters) {\n return state;\n }\n return widget.getWidgetSearchParameters(state, rest);\n }, initialSearchParameters);\n}\nfunction resetPageFromWidgets(widgets) {\n var indexWidgets = widgets.filter(isIndexWidget);\n if (indexWidgets.length === 0) {\n return;\n }\n indexWidgets.forEach(function (widget) {\n var widgetHelper = widget.getHelper();\n privateHelperSetState(widgetHelper, {\n state: widgetHelper.state.resetPage(),\n isPageReset: true\n });\n resetPageFromWidgets(widget.getWidgets());\n });\n}\nfunction resolveScopedResultsFromWidgets(widgets) {\n var indexWidgets = widgets.filter(isIndexWidget);\n return indexWidgets.reduce(function (scopedResults, current) {\n return scopedResults.concat.apply(scopedResults, [{\n indexId: current.getIndexId(),\n results: current.getResults(),\n helper: current.getHelper()\n }].concat(_toConsumableArray(resolveScopedResultsFromWidgets(current.getWidgets()))));\n }, []);\n}\nvar index = function index(widgetParams) {\n if (widgetParams === undefined || widgetParams.indexName === undefined) {\n throw new Error(withUsage('The `indexName` option is required.'));\n }\n var indexName = widgetParams.indexName,\n _widgetParams$indexId = widgetParams.indexId,\n indexId = _widgetParams$indexId === void 0 ? indexName : _widgetParams$indexId;\n var localWidgets = [];\n var localUiState = {};\n var localInstantSearchInstance = null;\n var localParent = null;\n var helper = null;\n var derivedHelper = null;\n var lastValidSearchParameters = null;\n return {\n $$type: 'ais.index',\n $$widgetType: 'ais.index',\n getIndexName: function getIndexName() {\n return indexName;\n },\n getIndexId: function getIndexId() {\n return indexId;\n },\n getHelper: function getHelper() {\n return helper;\n },\n getResults: function getResults() {\n var _derivedHelper;\n if (!((_derivedHelper = derivedHelper) !== null && _derivedHelper !== void 0 && _derivedHelper.lastResults)) return null;\n\n // To make the UI optimistic, we patch the state to display to the current\n // one instead of the one associated with the latest results.\n // This means user-driven UI changes (e.g., checked checkbox) are reflected\n // immediately instead of waiting for Algolia to respond, regardless of\n // the status of the network request.\n derivedHelper.lastResults._state = helper.state;\n return derivedHelper.lastResults;\n },\n getPreviousState: function getPreviousState() {\n return lastValidSearchParameters;\n },\n getScopedResults: function getScopedResults() {\n var widgetParent = this.getParent();\n\n // If the widget is the root, we consider itself as the only sibling.\n var widgetSiblings = widgetParent ? widgetParent.getWidgets() : [this];\n return resolveScopedResultsFromWidgets(widgetSiblings);\n },\n getParent: function getParent() {\n return localParent;\n },\n createURL: function createURL(nextState) {\n if (typeof nextState === 'function') {\n return localInstantSearchInstance._createURL(_defineProperty({}, indexId, nextState(localUiState)));\n }\n return localInstantSearchInstance._createURL(_defineProperty({}, indexId, getLocalWidgetsUiState(localWidgets, {\n searchParameters: nextState,\n helper: helper\n })));\n },\n getWidgets: function getWidgets() {\n return localWidgets;\n },\n addWidgets: function addWidgets(widgets) {\n var _this = this;\n if (!Array.isArray(widgets)) {\n throw new Error(withUsage('The `addWidgets` method expects an array of widgets.'));\n }\n if (widgets.some(function (widget) {\n return typeof widget.init !== 'function' && typeof widget.render !== 'function';\n })) {\n throw new Error(withUsage('The widget definition expects a `render` and/or an `init` method.'));\n }\n localWidgets = localWidgets.concat(widgets);\n if (localInstantSearchInstance && Boolean(widgets.length)) {\n privateHelperSetState(helper, {\n state: getLocalWidgetsSearchParameters(localWidgets, {\n uiState: localUiState,\n initialSearchParameters: helper.state\n }),\n _uiState: localUiState\n });\n\n // We compute the render state before calling `init` in a separate loop\n // to construct the whole render state object that is then passed to\n // `init`.\n widgets.forEach(function (widget) {\n if (widget.getRenderState) {\n var renderState = widget.getRenderState(localInstantSearchInstance.renderState[_this.getIndexId()] || {}, createInitArgs(localInstantSearchInstance, _this, localInstantSearchInstance._initialUiState));\n storeRenderState({\n renderState: renderState,\n instantSearchInstance: localInstantSearchInstance,\n parent: _this\n });\n }\n });\n widgets.forEach(function (widget) {\n if (widget.init) {\n widget.init(createInitArgs(localInstantSearchInstance, _this, localInstantSearchInstance._initialUiState));\n }\n });\n localInstantSearchInstance.scheduleSearch();\n }\n return this;\n },\n removeWidgets: function removeWidgets(widgets) {\n var _this2 = this;\n if (!Array.isArray(widgets)) {\n throw new Error(withUsage('The `removeWidgets` method expects an array of widgets.'));\n }\n if (widgets.some(function (widget) {\n return typeof widget.dispose !== 'function';\n })) {\n throw new Error(withUsage('The widget definition expects a `dispose` method.'));\n }\n localWidgets = localWidgets.filter(function (widget) {\n return widgets.indexOf(widget) === -1;\n });\n if (localInstantSearchInstance && Boolean(widgets.length)) {\n var _nextState = widgets.reduce(function (state, widget) {\n // the `dispose` method exists at this point we already assert it\n var next = widget.dispose({\n helper: helper,\n state: state,\n parent: _this2\n });\n return next || state;\n }, helper.state);\n localUiState = getLocalWidgetsUiState(localWidgets, {\n searchParameters: _nextState,\n helper: helper\n });\n helper.setState(getLocalWidgetsSearchParameters(localWidgets, {\n uiState: localUiState,\n initialSearchParameters: _nextState\n }));\n if (localWidgets.length) {\n localInstantSearchInstance.scheduleSearch();\n }\n }\n return this;\n },\n init: function init(_ref2) {\n var _this3 = this,\n _instantSearchInstanc;\n var instantSearchInstance = _ref2.instantSearchInstance,\n parent = _ref2.parent,\n uiState = _ref2.uiState;\n if (helper !== null) {\n // helper is already initialized, therefore we do not need to set up\n // any listeners\n return;\n }\n localInstantSearchInstance = instantSearchInstance;\n localParent = parent;\n localUiState = uiState[indexId] || {};\n\n // The `mainHelper` is already defined at this point. The instance is created\n // inside InstantSearch at the `start` method, which occurs before the `init`\n // step.\n var mainHelper = instantSearchInstance.mainHelper;\n var parameters = getLocalWidgetsSearchParameters(localWidgets, {\n uiState: localUiState,\n initialSearchParameters: new algoliasearchHelper.SearchParameters({\n index: indexName\n })\n });\n\n // This Helper is only used for state management we do not care about the\n // `searchClient`. Only the \"main\" Helper created at the `InstantSearch`\n // level is aware of the client.\n helper = algoliasearchHelper({}, parameters.index, parameters);\n\n // We forward the call to `search` to the \"main\" instance of the Helper\n // which is responsible for managing the queries (it's the only one that is\n // aware of the `searchClient`).\n helper.search = function () {\n if (instantSearchInstance.onStateChange) {\n instantSearchInstance.onStateChange({\n uiState: instantSearchInstance.mainIndex.getWidgetUiState({}),\n setUiState: function setUiState(nextState) {\n return instantSearchInstance.setUiState(nextState, false);\n }\n });\n\n // We don't trigger a search when controlled because it becomes the\n // responsibility of `setUiState`.\n return mainHelper;\n }\n return mainHelper.search();\n };\n helper.searchWithoutTriggeringOnStateChange = function () {\n return mainHelper.search();\n };\n\n // We use the same pattern for the `searchForFacetValues`.\n helper.searchForFacetValues = function (facetName, facetValue, maxFacetHits, userState) {\n var state = helper.state.setQueryParameters(userState);\n return mainHelper.searchForFacetValues(facetName, facetValue, maxFacetHits, state);\n };\n derivedHelper = mainHelper.derive(function () {\n return mergeSearchParameters.apply(void 0, _toConsumableArray(resolveSearchParameters(_this3)));\n });\n var indexInitialResults = (_instantSearchInstanc = instantSearchInstance._initialResults) === null || _instantSearchInstanc === void 0 ? void 0 : _instantSearchInstanc[this.getIndexId()];\n if (indexInitialResults) {\n // We restore the shape of the results provided to the instance to respect\n // the helper's structure.\n var results = new algoliasearchHelper.SearchResults(new algoliasearchHelper.SearchParameters(indexInitialResults.state), indexInitialResults.results);\n derivedHelper.lastResults = results;\n helper.lastResults = results;\n }\n\n // Subscribe to the Helper state changes for the page before widgets\n // are initialized. This behavior mimics the original one of the Helper.\n // It makes sense to replicate it at the `init` step. We have another\n // listener on `change` below, once `init` is done.\n helper.on('change', function (_ref3) {\n var isPageReset = _ref3.isPageReset;\n if (isPageReset) {\n resetPageFromWidgets(localWidgets);\n }\n });\n derivedHelper.on('search', function () {\n // The index does not manage the \"staleness\" of the search. This is the\n // responsibility of the main instance. It does not make sense to manage\n // it at the index level because it's either: all of them or none of them\n // that are stalled. The queries are performed into a single network request.\n instantSearchInstance.scheduleStalledRender();\n if (process.env.NODE_ENV === 'development') {\n checkIndexUiState({\n index: _this3,\n indexUiState: localUiState\n });\n }\n });\n derivedHelper.on('result', function (_ref4) {\n var results = _ref4.results;\n // The index does not render the results it schedules a new render\n // to let all the other indices emit their own results. It allows us to\n // run the render process in one pass.\n instantSearchInstance.scheduleRender();\n\n // the derived helper is the one which actually searches, but the helper\n // which is exposed e.g. via instance.helper, doesn't search, and thus\n // does not have access to lastResults, which it used to in pre-federated\n // search behavior.\n helper.lastResults = results;\n lastValidSearchParameters = results === null || results === void 0 ? void 0 : results._state;\n });\n\n // We compute the render state before calling `init` in a separate loop\n // to construct the whole render state object that is then passed to\n // `init`.\n localWidgets.forEach(function (widget) {\n if (widget.getRenderState) {\n var renderState = widget.getRenderState(instantSearchInstance.renderState[_this3.getIndexId()] || {}, createInitArgs(instantSearchInstance, _this3, uiState));\n storeRenderState({\n renderState: renderState,\n instantSearchInstance: instantSearchInstance,\n parent: _this3\n });\n }\n });\n localWidgets.forEach(function (widget) {\n process.env.NODE_ENV === 'development' ? warning(\n // if it has NO getWidgetState or if it has getWidgetUiState, we don't warn\n // aka we warn if there's _only_ getWidgetState\n !widget.getWidgetState || Boolean(widget.getWidgetUiState), 'The `getWidgetState` method is renamed `getWidgetUiState` and will no longer exist under that name in InstantSearch.js 5.x. Please use `getWidgetUiState` instead.') : void 0;\n if (widget.init) {\n widget.init(createInitArgs(instantSearchInstance, _this3, uiState));\n }\n });\n\n // Subscribe to the Helper state changes for the `uiState` once widgets\n // are initialized. Until the first render, state changes are part of the\n // configuration step. This is mainly for backward compatibility with custom\n // widgets. When the subscription happens before the `init` step, the (static)\n // configuration of the widget is pushed in the URL. That's what we want to avoid.\n // https://github.com/algolia/instantsearch.js/pull/994/commits/4a672ae3fd78809e213de0368549ef12e9dc9454\n helper.on('change', function (event) {\n var state = event.state;\n var _uiState = event._uiState;\n localUiState = getLocalWidgetsUiState(localWidgets, {\n searchParameters: state,\n helper: helper\n }, _uiState || {});\n\n // We don't trigger an internal change when controlled because it\n // becomes the responsibility of `setUiState`.\n if (!instantSearchInstance.onStateChange) {\n instantSearchInstance.onInternalStateChange();\n }\n });\n if (indexInitialResults) {\n // If there are initial results, we're not notified of the next results\n // because we don't trigger an initial search. We therefore need to directly\n // schedule a render that will render the results injected on the helper.\n instantSearchInstance.scheduleRender();\n }\n },\n render: function render(_ref5) {\n var _this4 = this;\n var instantSearchInstance = _ref5.instantSearchInstance;\n // we can't attach a listener to the error event of search, as the error\n // then would no longer be thrown for global handlers.\n if (instantSearchInstance.status === 'error' && !instantSearchInstance.mainHelper.hasPendingRequests() && lastValidSearchParameters) {\n helper.setState(lastValidSearchParameters);\n }\n\n // We only render index widgets if there are no results.\n // This makes sure `render` is never called with `results` being `null`.\n var widgetsToRender = this.getResults() ? localWidgets : localWidgets.filter(isIndexWidget);\n widgetsToRender.forEach(function (widget) {\n if (widget.getRenderState) {\n var renderState = widget.getRenderState(instantSearchInstance.renderState[_this4.getIndexId()] || {}, createRenderArgs(instantSearchInstance, _this4));\n storeRenderState({\n renderState: renderState,\n instantSearchInstance: instantSearchInstance,\n parent: _this4\n });\n }\n });\n widgetsToRender.forEach(function (widget) {\n // At this point, all the variables used below are set. Both `helper`\n // and `derivedHelper` have been created at the `init` step. The attribute\n // `lastResults` might be `null` though. It's possible that a stalled render\n // happens before the result e.g with a dynamically added index the request might\n // be delayed. The render is triggered for the complete tree but some parts do\n // not have results yet.\n\n if (widget.render) {\n widget.render(createRenderArgs(instantSearchInstance, _this4));\n }\n });\n },\n dispose: function dispose() {\n var _this5 = this,\n _helper,\n _derivedHelper2;\n localWidgets.forEach(function (widget) {\n if (widget.dispose) {\n // The dispose function is always called once the instance is started\n // (it's an effect of `removeWidgets`). The index is initialized and\n // the Helper is available. We don't care about the return value of\n // `dispose` because the index is removed. We can't call `removeWidgets`\n // because we want to keep the widgets on the instance, to allow idempotent\n // operations on `add` & `remove`.\n widget.dispose({\n helper: helper,\n state: helper.state,\n parent: _this5\n });\n }\n });\n localInstantSearchInstance = null;\n localParent = null;\n (_helper = helper) === null || _helper === void 0 ? void 0 : _helper.removeAllListeners();\n helper = null;\n (_derivedHelper2 = derivedHelper) === null || _derivedHelper2 === void 0 ? void 0 : _derivedHelper2.detach();\n derivedHelper = null;\n },\n getWidgetUiState: function getWidgetUiState(uiState) {\n return localWidgets.filter(isIndexWidget).reduce(function (previousUiState, innerIndex) {\n return innerIndex.getWidgetUiState(previousUiState);\n }, _objectSpread(_objectSpread({}, uiState), {}, _defineProperty({}, indexId, _objectSpread(_objectSpread({}, uiState[indexId]), localUiState))));\n },\n getWidgetState: function getWidgetState(uiState) {\n process.env.NODE_ENV === 'development' ? warning(false, 'The `getWidgetState` method is renamed `getWidgetUiState` and will no longer exist under that name in InstantSearch.js 5.x. Please use `getWidgetUiState` instead.') : void 0;\n return this.getWidgetUiState(uiState);\n },\n getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref6) {\n var uiState = _ref6.uiState;\n return getLocalWidgetsSearchParameters(localWidgets, {\n uiState: uiState,\n initialSearchParameters: searchParameters\n });\n },\n refreshUiState: function refreshUiState() {\n localUiState = getLocalWidgetsUiState(localWidgets, {\n searchParameters: this.getHelper().state,\n helper: this.getHelper()\n }, localUiState);\n },\n setIndexUiState: function setIndexUiState(indexUiState) {\n var nextIndexUiState = typeof indexUiState === 'function' ? indexUiState(localUiState) : indexUiState;\n localInstantSearchInstance.setUiState(function (state) {\n return _objectSpread(_objectSpread({}, state), {}, _defineProperty({}, indexId, nextIndexUiState));\n });\n }\n };\n};\nexport default index;\nfunction storeRenderState(_ref7) {\n var renderState = _ref7.renderState,\n instantSearchInstance = _ref7.instantSearchInstance,\n parent = _ref7.parent;\n var parentIndexName = parent ? parent.getIndexId() : instantSearchInstance.mainIndex.getIndexId();\n instantSearchInstance.renderState = _objectSpread(_objectSpread({}, instantSearchInstance.renderState), {}, _defineProperty({}, parentIndexName, _objectSpread(_objectSpread({}, instantSearchInstance.renderState[parentIndexName]), renderState)));\n}","export function resolveSearchParameters(current) {\n var parent = current.getParent();\n var states = [current.getHelper().state];\n while (parent !== null) {\n states = [parent.getHelper().state].concat(states);\n parent = parent.getParent();\n }\n return states;\n}","var NAMESPACE = 'ais';\nexport var component = function component(componentName) {\n return function () {\n var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n descendantName = _ref.descendantName,\n modifierName = _ref.modifierName;\n var descendent = descendantName ? \"-\".concat(descendantName) : '';\n var modifier = modifierName ? \"--\".concat(modifierName) : '';\n return \"\".concat(NAMESPACE, \"-\").concat(componentName).concat(descendent).concat(modifier);\n };\n};","import { component } from \"../lib/suit.js\";\nimport { getPropertyByPath, TAG_REPLACEMENT, warning } from \"../lib/utils/index.js\";\nvar suit = component('Highlight');\n\n/**\n * @deprecated use html tagged templates and the Highlight component instead\n */\nexport default function highlight(_ref) {\n var attribute = _ref.attribute,\n _ref$highlightedTagNa = _ref.highlightedTagName,\n highlightedTagName = _ref$highlightedTagNa === void 0 ? 'mark' : _ref$highlightedTagNa,\n hit = _ref.hit,\n _ref$cssClasses = _ref.cssClasses,\n cssClasses = _ref$cssClasses === void 0 ? {} : _ref$cssClasses;\n process.env.NODE_ENV === 'development' ? warning(false, \"`instantsearch.highlight` function has been deprecated. It is still supported in 4.x releases, but not further. It is replaced by the `Highlight` component.\\n\\nFor more information, visit https://www.algolia.com/doc/guides/building-search-ui/upgrade-guides/js/?client=html+tagged+templates#upgrade-templates\") : void 0;\n var highlightAttributeResult = getPropertyByPath(hit._highlightResult, attribute);\n\n // @MAJOR fallback to attribute value if highlight is not found\n process.env.NODE_ENV === 'development' ? warning(highlightAttributeResult, \"Could not enable highlight for \\\"\".concat(attribute, \"\\\", 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\")) : void 0;\n var _ref2 = highlightAttributeResult || {},\n _ref2$value = _ref2.value,\n attributeValue = _ref2$value === void 0 ? '' : _ref2$value;\n\n // cx is not used, since it would be bundled as a dependency for Vue & Angular\n var className = suit({\n descendantName: 'highlighted'\n }) + (cssClasses.highlighted ? \" \".concat(cssClasses.highlighted) : '');\n return attributeValue.replace(new RegExp(TAG_REPLACEMENT.highlightPreTag, 'g'), \"<\".concat(highlightedTagName, \" class=\\\"\").concat(className, \"\\\">\")).replace(new RegExp(TAG_REPLACEMENT.highlightPostTag, 'g'), \"\"));\n}","import { TAG_REPLACEMENT } from \"./escape-highlight.js\";\nexport function concatHighlightedParts(parts) {\n var highlightPreTag = TAG_REPLACEMENT.highlightPreTag,\n highlightPostTag = TAG_REPLACEMENT.highlightPostTag;\n return parts.map(function (part) {\n return part.isHighlighted ? highlightPreTag + part.value + highlightPostTag : part.value;\n }).join('');\n}","import { unescape } from \"./escape-html.js\";\nvar hasAlphanumeric = new RegExp(/\\w/i);\nexport function getHighlightFromSiblings(parts, i) {\n var _parts, _parts2;\n var current = parts[i];\n var isNextHighlighted = ((_parts = parts[i + 1]) === null || _parts === void 0 ? void 0 : _parts.isHighlighted) || true;\n var isPreviousHighlighted = ((_parts2 = parts[i - 1]) === null || _parts2 === void 0 ? void 0 : _parts2.isHighlighted) || true;\n if (!hasAlphanumeric.test(unescape(current.value)) && isPreviousHighlighted === isNextHighlighted) {\n return isPreviousHighlighted;\n }\n return current.isHighlighted;\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nimport { getHighlightFromSiblings } from \"./getHighlightFromSiblings.js\";\nexport function reverseHighlightedParts(parts) {\n if (!parts.some(function (part) {\n return part.isHighlighted;\n })) {\n return parts.map(function (part) {\n return _objectSpread(_objectSpread({}, part), {}, {\n isHighlighted: false\n });\n });\n }\n return parts.map(function (part, i) {\n return _objectSpread(_objectSpread({}, part), {}, {\n isHighlighted: !getHighlightFromSiblings(parts, i)\n });\n });\n}","import { component } from \"../lib/suit.js\";\nimport { TAG_REPLACEMENT, getPropertyByPath, getHighlightedParts, reverseHighlightedParts, concatHighlightedParts, warning } from \"../lib/utils/index.js\";\nvar suit = component('ReverseHighlight');\n\n/**\n * @deprecated use html tagged templates and the ReverseHighlight component instead\n */\nexport default function reverseHighlight(_ref) {\n var attribute = _ref.attribute,\n _ref$highlightedTagNa = _ref.highlightedTagName,\n highlightedTagName = _ref$highlightedTagNa === void 0 ? 'mark' : _ref$highlightedTagNa,\n hit = _ref.hit,\n _ref$cssClasses = _ref.cssClasses,\n cssClasses = _ref$cssClasses === void 0 ? {} : _ref$cssClasses;\n process.env.NODE_ENV === 'development' ? warning(false, \"`instantsearch.reverseHighlight` function has been deprecated. It is still supported in 4.x releases, but not further. It is replaced by the `ReverseHighlight` component.\\n\\nFor more information, visit https://www.algolia.com/doc/guides/building-search-ui/upgrade-guides/js/?client=html+tagged+templates#upgrade-templates\") : void 0;\n var highlightAttributeResult = getPropertyByPath(hit._highlightResult, attribute);\n\n // @MAJOR fallback to attribute value if highlight is not found\n process.env.NODE_ENV === 'development' ? warning(highlightAttributeResult, \"Could not enable reverse highlight for \\\"\".concat(attribute, \"\\\", 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\")) : void 0;\n var _ref2 = highlightAttributeResult || {},\n _ref2$value = _ref2.value,\n attributeValue = _ref2$value === void 0 ? '' : _ref2$value;\n\n // cx is not used, since it would be bundled as a dependency for Vue & Angular\n var className = suit({\n descendantName: 'highlighted'\n }) + (cssClasses.highlighted ? \" \".concat(cssClasses.highlighted) : '');\n var reverseHighlightedValue = concatHighlightedParts(reverseHighlightedParts(getHighlightedParts(attributeValue)));\n return reverseHighlightedValue.replace(new RegExp(TAG_REPLACEMENT.highlightPreTag, 'g'), \"<\".concat(highlightedTagName, \" class=\\\"\").concat(className, \"\\\">\")).replace(new RegExp(TAG_REPLACEMENT.highlightPostTag, 'g'), \"\"));\n}","import { component } from \"../lib/suit.js\";\nimport { TAG_REPLACEMENT, getPropertyByPath, warning } from \"../lib/utils/index.js\";\nvar suit = component('Snippet');\n\n/**\n * @deprecated use html tagged templates and the Snippet component instead\n */\nexport default function snippet(_ref) {\n var attribute = _ref.attribute,\n _ref$highlightedTagNa = _ref.highlightedTagName,\n highlightedTagName = _ref$highlightedTagNa === void 0 ? 'mark' : _ref$highlightedTagNa,\n hit = _ref.hit,\n _ref$cssClasses = _ref.cssClasses,\n cssClasses = _ref$cssClasses === void 0 ? {} : _ref$cssClasses;\n process.env.NODE_ENV === 'development' ? warning(false, \"`instantsearch.snippet` function has been deprecated. It is still supported in 4.x releases, but not further. It is replaced by the `Snippet` component.\\n\\nFor more information, visit https://www.algolia.com/doc/guides/building-search-ui/upgrade-guides/js/?client=html+tagged+templates#upgrade-templates\") : void 0;\n var snippetAttributeResult = getPropertyByPath(hit._snippetResult, attribute);\n\n // @MAJOR fallback to attribute value if snippet is not found\n process.env.NODE_ENV === 'development' ? warning(snippetAttributeResult, \"Could not enable snippet for \\\"\".concat(attribute, \"\\\", will display an empty string.\\nPlease check whether this attribute exists and is specified in `attributesToSnippet`.\\n\\nSee: https://alg.li/highlighting\\n\")) : void 0;\n var _ref2 = snippetAttributeResult || {},\n _ref2$value = _ref2.value,\n attributeValue = _ref2$value === void 0 ? '' : _ref2$value;\n\n // cx is not used, since it would be bundled as a dependency for Vue & Angular\n var className = suit({\n descendantName: 'highlighted'\n }) + (cssClasses.highlighted ? \" \".concat(cssClasses.highlighted) : '');\n return attributeValue.replace(new RegExp(TAG_REPLACEMENT.highlightPreTag, 'g'), \"<\".concat(highlightedTagName, \" class=\\\"\").concat(className, \"\\\">\")).replace(new RegExp(TAG_REPLACEMENT.highlightPostTag, 'g'), \"\"));\n}","import { component } from \"../lib/suit.js\";\nimport { TAG_REPLACEMENT, getPropertyByPath, getHighlightedParts, reverseHighlightedParts, concatHighlightedParts, warning } from \"../lib/utils/index.js\";\nvar suit = component('ReverseSnippet');\n\n/**\n * @deprecated use html tagged templates and the ReverseSnippet component instead\n */\nexport default function reverseSnippet(_ref) {\n var attribute = _ref.attribute,\n _ref$highlightedTagNa = _ref.highlightedTagName,\n highlightedTagName = _ref$highlightedTagNa === void 0 ? 'mark' : _ref$highlightedTagNa,\n hit = _ref.hit,\n _ref$cssClasses = _ref.cssClasses,\n cssClasses = _ref$cssClasses === void 0 ? {} : _ref$cssClasses;\n process.env.NODE_ENV === 'development' ? warning(false, \"`instantsearch.reverseSnippet` function has been deprecated. It is still supported in 4.x releases, but not further. It is replaced by the `ReverseSnippet` component.\\n\\nFor more information, visit https://www.algolia.com/doc/guides/building-search-ui/upgrade-guides/js/?client=html+tagged+templates#upgrade-templates\") : void 0;\n var snippetAttributeResult = getPropertyByPath(hit._snippetResult, attribute);\n\n // @MAJOR fallback to attribute value if snippet is not found\n process.env.NODE_ENV === 'development' ? warning(snippetAttributeResult, \"Could not enable reverse snippet for \\\"\".concat(attribute, \"\\\", will display an empty string.\\nPlease check whether this attribute exists and is specified in `attributesToSnippet`.\\n\\nSee: https://alg.li/highlighting\\n\")) : void 0;\n var _ref2 = snippetAttributeResult || {},\n _ref2$value = _ref2.value,\n attributeValue = _ref2$value === void 0 ? '' : _ref2$value;\n\n // cx is not used, since it would be bundled as a dependency for Vue & Angular\n var className = suit({\n descendantName: 'highlighted'\n }) + (cssClasses.highlighted ? \" \".concat(cssClasses.highlighted) : '');\n var reverseHighlightedValue = concatHighlightedParts(reverseHighlightedParts(getHighlightedParts(attributeValue)));\n return reverseHighlightedValue.replace(new RegExp(TAG_REPLACEMENT.highlightPreTag, 'g'), \"<\".concat(highlightedTagName, \" class=\\\"\").concat(className, \"\\\">\")).replace(new RegExp(TAG_REPLACEMENT.highlightPostTag, 'g'), \"\"));\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nimport { warning, serializePayload, deserializePayload } from \"../lib/utils/index.js\";\n/** @deprecated use bindEvent instead */\nexport function readDataAttributes(domElement) {\n var method = domElement.getAttribute('data-insights-method');\n var serializedPayload = domElement.getAttribute('data-insights-payload');\n if (typeof serializedPayload !== 'string') {\n throw new Error('The insights helper expects `data-insights-payload` to be a base64-encoded JSON string.');\n }\n try {\n var payload = deserializePayload(serializedPayload);\n return {\n method: method,\n payload: payload\n };\n } catch (error) {\n throw new Error('The insights helper was unable to parse `data-insights-payload`.');\n }\n}\n\n/** @deprecated use bindEvent instead */\nexport function writeDataAttributes(_ref) {\n var method = _ref.method,\n payload = _ref.payload;\n if (_typeof(payload) !== 'object') {\n throw new Error(\"The insights helper expects the payload to be an object.\");\n }\n var serializedPayload;\n try {\n serializedPayload = serializePayload(payload);\n } catch (error) {\n throw new Error(\"Could not JSON serialize the payload object.\");\n }\n return \"data-insights-method=\\\"\".concat(method, \"\\\" data-insights-payload=\\\"\").concat(serializedPayload, \"\\\"\");\n}\n\n/**\n * @deprecated This function will be still supported in 4.x releases, but not further. It is replaced by the `insights` middleware. For 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/\n */\nexport default function insights(method, payload) {\n process.env.NODE_ENV === 'development' ? warning(false, \"`insights` function 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/\") : void 0;\n return writeDataAttributes({\n method: method,\n payload: payload\n });\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nimport { highlight as _highlight, reverseHighlight as _reverseHighlight, snippet as _snippet, reverseSnippet as _reverseSnippet, insights as _insights } from \"../helpers/index.js\";\nimport { formatNumber as _formatNumber } from \"./formatNumber.js\";\nexport default function hoganHelpers(_ref) {\n var numberLocale = _ref.numberLocale;\n return {\n formatNumber: function formatNumber(value, render) {\n return _formatNumber(Number(render(value)), numberLocale);\n },\n highlight: function highlight(options, render) {\n try {\n var highlightOptions = JSON.parse(options);\n return render(_highlight(_objectSpread(_objectSpread({}, highlightOptions), {}, {\n hit: this\n })));\n } catch (error) {\n throw new Error(\"\\nThe highlight helper expects a JSON object of the format:\\n{ \\\"attribute\\\": \\\"name\\\", \\\"highlightedTagName\\\": \\\"mark\\\" }\");\n }\n },\n reverseHighlight: function reverseHighlight(options, render) {\n try {\n var reverseHighlightOptions = JSON.parse(options);\n return render(_reverseHighlight(_objectSpread(_objectSpread({}, reverseHighlightOptions), {}, {\n hit: this\n })));\n } catch (error) {\n throw new Error(\"\\n The reverseHighlight helper expects a JSON object of the format:\\n { \\\"attribute\\\": \\\"name\\\", \\\"highlightedTagName\\\": \\\"mark\\\" }\");\n }\n },\n snippet: function snippet(options, render) {\n try {\n var snippetOptions = JSON.parse(options);\n return render(_snippet(_objectSpread(_objectSpread({}, snippetOptions), {}, {\n hit: this\n })));\n } catch (error) {\n throw new Error(\"\\nThe snippet helper expects a JSON object of the format:\\n{ \\\"attribute\\\": \\\"name\\\", \\\"highlightedTagName\\\": \\\"mark\\\" }\");\n }\n },\n reverseSnippet: function reverseSnippet(options, render) {\n try {\n var reverseSnippetOptions = JSON.parse(options);\n return render(_reverseSnippet(_objectSpread(_objectSpread({}, reverseSnippetOptions), {}, {\n hit: this\n })));\n } catch (error) {\n throw new Error(\"\\n The reverseSnippet helper expects a JSON object of the format:\\n { \\\"attribute\\\": \\\"name\\\", \\\"highlightedTagName\\\": \\\"mark\\\" }\");\n }\n },\n insights: function insights(options, render) {\n try {\n var _JSON$parse = JSON.parse(options),\n method = _JSON$parse.method,\n payload = _JSON$parse.payload;\n return render(_insights(method, _objectSpread({\n objectIDs: [this.objectID]\n }, payload)));\n } catch (error) {\n throw new Error(\"\\nThe insights helper expects a JSON object of the format:\\n{ \\\"method\\\": \\\"method-name\\\", \\\"payload\\\": { \\\"eventName\\\": \\\"name of the event\\\" } }\");\n }\n }\n };\n}","export function formatNumber(value, numberLocale) {\n return value.toLocaleString(numberLocale);\n}","var nextMicroTask = Promise.resolve();\nexport function defer(callback) {\n var progress = null;\n var cancelled = false;\n var fn = function fn() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n if (progress !== null) {\n return;\n }\n progress = nextMicroTask.then(function () {\n progress = null;\n if (cancelled) {\n cancelled = false;\n return;\n }\n callback.apply(void 0, args);\n });\n };\n fn.wait = function () {\n if (progress === null) {\n throw new Error('The deferred function should be called before calling `wait()`');\n }\n return progress;\n };\n fn.cancel = function () {\n if (progress === null) {\n return;\n }\n cancelled = true;\n };\n return fn;\n}","import { checkIndexUiState } from \"./checkIndexUiState.js\";\nimport { isIndexWidget } from \"./isIndexWidget.js\";\nexport function setIndexHelperState(finalUiState, indexWidget) {\n var nextIndexUiState = finalUiState[indexWidget.getIndexId()] || {};\n if (process.env.NODE_ENV === 'development') {\n checkIndexUiState({\n index: indexWidget,\n indexUiState: nextIndexUiState\n });\n }\n indexWidget.getHelper().setState(indexWidget.getWidgetSearchParameters(indexWidget.getHelper().state, {\n uiState: nextIndexUiState\n }));\n indexWidget.getWidgets().filter(isIndexWidget).forEach(function (widget) {\n return setIndexHelperState(finalUiState, widget);\n });\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nimport EventEmitter from '@algolia/events';\nimport algoliasearchHelper from 'algoliasearch-helper';\nimport { createInsightsMiddleware } from \"../middlewares/createInsightsMiddleware.js\";\nimport { createMetadataMiddleware, isMetadataEnabled } from \"../middlewares/createMetadataMiddleware.js\";\nimport { createRouterMiddleware } from \"../middlewares/createRouterMiddleware.js\";\nimport index from \"../widgets/index/index.js\";\nimport createHelpers from \"./createHelpers.js\";\nimport { createDocumentationMessageGenerator, createDocumentationLink, defer, noop, warning, setIndexHelperState, isIndexWidget } from \"./utils/index.js\";\nimport version from \"./version.js\";\nvar withUsage = createDocumentationMessageGenerator({\n name: 'instantsearch'\n});\nfunction defaultCreateURL() {\n return '#';\n}\n\n// this purposely breaks typescript's type inference to ensure it's not used\n// as it's used for a default parameter for example\n// source: https://github.com/Microsoft/TypeScript/issues/14829#issuecomment-504042546\n/**\n * Global options for an InstantSearch instance.\n */\n/**\n * The actual implementation of the InstantSearch. This is\n * created using the `instantsearch` factory function.\n * It emits the 'render' event every time a search is done\n */\nvar InstantSearch = /*#__PURE__*/function (_EventEmitter) {\n _inherits(InstantSearch, _EventEmitter);\n var _super = _createSuper(InstantSearch);\n function InstantSearch(options) {\n var _this;\n _classCallCheck(this, InstantSearch);\n _this = _super.call(this);\n\n // prevent `render` event listening from causing a warning\n _defineProperty(_assertThisInitialized(_this), \"client\", void 0);\n _defineProperty(_assertThisInitialized(_this), \"indexName\", void 0);\n _defineProperty(_assertThisInitialized(_this), \"insightsClient\", void 0);\n _defineProperty(_assertThisInitialized(_this), \"onStateChange\", null);\n _defineProperty(_assertThisInitialized(_this), \"helper\", void 0);\n _defineProperty(_assertThisInitialized(_this), \"mainHelper\", void 0);\n _defineProperty(_assertThisInitialized(_this), \"mainIndex\", void 0);\n _defineProperty(_assertThisInitialized(_this), \"started\", void 0);\n _defineProperty(_assertThisInitialized(_this), \"templatesConfig\", void 0);\n _defineProperty(_assertThisInitialized(_this), \"renderState\", {});\n _defineProperty(_assertThisInitialized(_this), \"_stalledSearchDelay\", void 0);\n _defineProperty(_assertThisInitialized(_this), \"_searchStalledTimer\", void 0);\n _defineProperty(_assertThisInitialized(_this), \"_initialUiState\", void 0);\n _defineProperty(_assertThisInitialized(_this), \"_initialResults\", void 0);\n _defineProperty(_assertThisInitialized(_this), \"_createURL\", void 0);\n _defineProperty(_assertThisInitialized(_this), \"_searchFunction\", void 0);\n _defineProperty(_assertThisInitialized(_this), \"_mainHelperSearch\", void 0);\n _defineProperty(_assertThisInitialized(_this), \"middleware\", []);\n _defineProperty(_assertThisInitialized(_this), \"sendEventToInsights\", void 0);\n /**\n * The status of the search. Can be \"idle\", \"loading\", \"stalled\", or \"error\".\n */\n _defineProperty(_assertThisInitialized(_this), \"status\", 'idle');\n /**\n * The last returned error from the Search API.\n * The error gets cleared when the next valid search response is rendered.\n */\n _defineProperty(_assertThisInitialized(_this), \"error\", undefined);\n _defineProperty(_assertThisInitialized(_this), \"scheduleSearch\", defer(function () {\n if (_this.started) {\n _this.mainHelper.search();\n }\n }));\n _defineProperty(_assertThisInitialized(_this), \"scheduleRender\", defer(function () {\n var _this$mainHelper;\n var shouldResetStatus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;\n if (!((_this$mainHelper = _this.mainHelper) !== null && _this$mainHelper !== void 0 && _this$mainHelper.hasPendingRequests())) {\n clearTimeout(_this._searchStalledTimer);\n _this._searchStalledTimer = null;\n if (shouldResetStatus) {\n _this.status = 'idle';\n _this.error = undefined;\n }\n }\n _this.mainIndex.render({\n instantSearchInstance: _assertThisInitialized(_this)\n });\n _this.emit('render');\n }));\n _defineProperty(_assertThisInitialized(_this), \"onInternalStateChange\", defer(function () {\n var nextUiState = _this.mainIndex.getWidgetUiState({});\n _this.middleware.forEach(function (_ref) {\n var instance = _ref.instance;\n instance.onStateChange({\n uiState: nextUiState\n });\n });\n }));\n _this.setMaxListeners(100);\n var _options$indexName = options.indexName,\n indexName = _options$indexName === void 0 ? '' : _options$indexName,\n numberLocale = options.numberLocale,\n _options$initialUiSta = options.initialUiState,\n initialUiState = _options$initialUiSta === void 0 ? {} : _options$initialUiSta,\n _options$routing = options.routing,\n routing = _options$routing === void 0 ? null : _options$routing,\n _options$insights = options.insights,\n insights = _options$insights === void 0 ? false : _options$insights,\n searchFunction = options.searchFunction,\n _options$stalledSearc = options.stalledSearchDelay,\n stalledSearchDelay = _options$stalledSearc === void 0 ? 200 : _options$stalledSearc,\n _options$searchClient = options.searchClient,\n searchClient = _options$searchClient === void 0 ? null : _options$searchClient,\n _options$insightsClie = options.insightsClient,\n insightsClient = _options$insightsClie === void 0 ? null : _options$insightsClie,\n _options$onStateChang = options.onStateChange,\n onStateChange = _options$onStateChang === void 0 ? null : _options$onStateChang;\n if (searchClient === null) {\n throw new Error(withUsage('The `searchClient` option is required.'));\n }\n if (typeof searchClient.search !== 'function') {\n 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/\");\n }\n if (typeof searchClient.addAlgoliaAgent === 'function') {\n searchClient.addAlgoliaAgent(\"instantsearch.js (\".concat(version, \")\"));\n }\n process.env.NODE_ENV === 'development' ? 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/\") : void 0;\n if (insightsClient && typeof insightsClient !== 'function') {\n throw new Error(withUsage('The `insightsClient` option should be a function.'));\n }\n process.env.NODE_ENV === 'development' ? 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({\n name: 'configure'\n }))) : void 0;\n _this.client = searchClient;\n _this.insightsClient = insightsClient;\n _this.indexName = indexName;\n _this.helper = null;\n _this.mainHelper = null;\n _this.mainIndex = index({\n indexName: indexName\n });\n _this.onStateChange = onStateChange;\n _this.started = false;\n _this.templatesConfig = {\n helpers: createHelpers({\n numberLocale: numberLocale\n }),\n compileOptions: {}\n };\n _this._stalledSearchDelay = stalledSearchDelay;\n _this._searchStalledTimer = null;\n _this._createURL = defaultCreateURL;\n _this._initialUiState = initialUiState;\n _this._initialResults = null;\n if (searchFunction) {\n process.env.NODE_ENV === 'development' ? warning(false, \"The `searchFunction` option is deprecated. Use `onStateChange` instead.\") : void 0;\n _this._searchFunction = searchFunction;\n }\n _this.sendEventToInsights = noop;\n if (routing) {\n var routerOptions = typeof routing === 'boolean' ? {} : routing;\n routerOptions.$$internal = true;\n _this.use(createRouterMiddleware(routerOptions));\n }\n\n // This is the default middleware,\n // any user-provided middleware will be added later and override this one.\n if (insights) {\n var insightsOptions = typeof insights === 'boolean' ? {} : insights;\n insightsOptions.$$internal = true;\n _this.use(createInsightsMiddleware(insightsOptions));\n }\n if (isMetadataEnabled()) {\n _this.use(createMetadataMiddleware({\n $$internal: true\n }));\n }\n return _this;\n }\n\n /**\n * Hooks a middleware into the InstantSearch lifecycle.\n */\n _createClass(InstantSearch, [{\n key: \"_isSearchStalled\",\n get:\n /**\n * @deprecated use `status === 'stalled'` instead\n */\n function get() {\n process.env.NODE_ENV === 'development' ? warning(false, \"`InstantSearch._isSearchStalled` is deprecated and will be removed in InstantSearch.js 5.0.\\n\\nUse `InstantSearch.status === \\\"stalled\\\"` instead.\") : void 0;\n return this.status === 'stalled';\n }\n }, {\n key: \"use\",\n value: function use() {\n var _this2 = this;\n for (var _len = arguments.length, middleware = new Array(_len), _key = 0; _key < _len; _key++) {\n middleware[_key] = arguments[_key];\n }\n var newMiddlewareList = middleware.map(function (fn) {\n var newMiddleware = _objectSpread({\n $$type: '__unknown__',\n $$internal: false,\n subscribe: noop,\n started: noop,\n unsubscribe: noop,\n onStateChange: noop\n }, fn({\n instantSearchInstance: _this2\n }));\n _this2.middleware.push({\n creator: fn,\n instance: newMiddleware\n });\n return newMiddleware;\n });\n\n // If the instance has already started, we directly subscribe the\n // middleware so they're notified of changes.\n if (this.started) {\n newMiddlewareList.forEach(function (m) {\n m.subscribe();\n m.started();\n });\n }\n return this;\n }\n\n /**\n * Removes a middleware from the InstantSearch lifecycle.\n */\n }, {\n key: \"unuse\",\n value: function unuse() {\n for (var _len2 = arguments.length, middlewareToUnuse = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n middlewareToUnuse[_key2] = arguments[_key2];\n }\n this.middleware.filter(function (m) {\n return middlewareToUnuse.includes(m.creator);\n }).forEach(function (m) {\n return m.instance.unsubscribe();\n });\n this.middleware = this.middleware.filter(function (m) {\n return !middlewareToUnuse.includes(m.creator);\n });\n return this;\n }\n\n // @major we shipped with EXPERIMENTAL_use, but have changed that to just `use` now\n }, {\n key: \"EXPERIMENTAL_use\",\n value: function EXPERIMENTAL_use() {\n process.env.NODE_ENV === 'development' ? warning(false, 'The middleware API is now considered stable, so we recommend replacing `EXPERIMENTAL_use` with `use` before upgrading to the next major version.') : void 0;\n return this.use.apply(this, arguments);\n }\n\n /**\n * Adds a widget to the search instance.\n * A widget can be added either before or after InstantSearch has started.\n * @param widget The widget to add to InstantSearch.\n *\n * @deprecated This method will still be supported in 4.x releases, but not further. It is replaced by `addWidgets([widget])`.\n */\n }, {\n key: \"addWidget\",\n value: function addWidget(widget) {\n process.env.NODE_ENV === 'development' ? warning(false, 'addWidget will still be supported in 4.x releases, but not further. It is replaced by `addWidgets([widget])`') : void 0;\n return this.addWidgets([widget]);\n }\n\n /**\n * Adds multiple widgets to the search instance.\n * Widgets can be added either before or after InstantSearch has started.\n * @param widgets The array of widgets to add to InstantSearch.\n */\n }, {\n key: \"addWidgets\",\n value: function addWidgets(widgets) {\n if (!Array.isArray(widgets)) {\n throw new Error(withUsage('The `addWidgets` method expects an array of widgets. Please use `addWidget`.'));\n }\n if (widgets.some(function (widget) {\n return typeof widget.init !== 'function' && typeof widget.render !== 'function';\n })) {\n throw new Error(withUsage('The widget definition expects a `render` and/or an `init` method.'));\n }\n this.mainIndex.addWidgets(widgets);\n return this;\n }\n\n /**\n * Removes a widget from the search instance.\n * @deprecated This method will still be supported in 4.x releases, but not further. It is replaced by `removeWidgets([widget])`\n * @param widget The widget instance to remove from InstantSearch.\n *\n * The widget must implement a `dispose()` method to clear its state.\n */\n }, {\n key: \"removeWidget\",\n value: function removeWidget(widget) {\n process.env.NODE_ENV === 'development' ? warning(false, 'removeWidget will still be supported in 4.x releases, but not further. It is replaced by `removeWidgets([widget])`') : void 0;\n return this.removeWidgets([widget]);\n }\n\n /**\n * Removes multiple widgets from the search instance.\n * @param widgets Array of widgets instances to remove from InstantSearch.\n *\n * The widgets must implement a `dispose()` method to clear their states.\n */\n }, {\n key: \"removeWidgets\",\n value: function removeWidgets(widgets) {\n if (!Array.isArray(widgets)) {\n throw new Error(withUsage('The `removeWidgets` method expects an array of widgets. Please use `removeWidget`.'));\n }\n if (widgets.some(function (widget) {\n return typeof widget.dispose !== 'function';\n })) {\n throw new Error(withUsage('The widget definition expects a `dispose` method.'));\n }\n this.mainIndex.removeWidgets(widgets);\n return this;\n }\n\n /**\n * Ends the initialization of InstantSearch.js and triggers the\n * first search. This method should be called after all widgets have been added\n * to the instance of InstantSearch.js. InstantSearch.js also supports adding and removing\n * widgets after the start as an **EXPERIMENTAL** feature.\n */\n }, {\n key: \"start\",\n value: function start() {\n var _this3 = this;\n if (this.started) {\n throw new Error(withUsage('The `start` method has already been called once.'));\n }\n\n // This Helper is used for the queries, we don't care about its state. The\n // states are managed at the `index` level. We use this Helper to create\n // DerivedHelper scoped into the `index` widgets.\n // In Vue InstantSearch' hydrate, a main helper gets set before start, so\n // we need to respect this helper as a way to keep all listeners correct.\n var mainHelper = this.mainHelper || algoliasearchHelper(this.client, this.indexName);\n mainHelper.search = function () {\n _this3.status = 'loading';\n _this3.scheduleRender(false);\n process.env.NODE_ENV === 'development' ? warning(Boolean(_this3.indexName) || _this3.mainIndex.getWidgets().some(isIndexWidget), 'No indexName provided, nor an explicit index widget in the widgets tree. This is required to be able to display results.') : void 0;\n\n // This solution allows us to keep the exact same API for the users but\n // under the hood, we have a different implementation. It should be\n // completely transparent for the rest of the codebase. Only this module\n // is impacted.\n return mainHelper.searchOnlyWithDerivedHelpers();\n };\n if (this._searchFunction) {\n // this client isn't used to actually search, but required for the helper\n // to not throw errors\n var fakeClient = {\n search: function search() {\n return new Promise(noop);\n }\n };\n this._mainHelperSearch = mainHelper.search.bind(mainHelper);\n mainHelper.search = function () {\n var mainIndexHelper = _this3.mainIndex.getHelper();\n var searchFunctionHelper = algoliasearchHelper(fakeClient, mainIndexHelper.state.index, mainIndexHelper.state);\n searchFunctionHelper.once('search', function (_ref2) {\n var state = _ref2.state;\n mainIndexHelper.overrideStateWithoutTriggeringChangeEvent(state);\n _this3._mainHelperSearch();\n });\n // Forward state changes from `searchFunctionHelper` to `mainIndexHelper`\n searchFunctionHelper.on('change', function (_ref3) {\n var state = _ref3.state;\n mainIndexHelper.setState(state);\n });\n _this3._searchFunction(searchFunctionHelper);\n return mainHelper;\n };\n }\n\n // Only the \"main\" Helper emits the `error` event vs the one for `search`\n // and `results` that are also emitted on the derived one.\n mainHelper.on('error', function (_ref4) {\n var error = _ref4.error;\n if (!(error instanceof Error)) {\n // typescript lies here, error is in some cases { name: string, message: string }\n var err = error;\n error = Object.keys(err).reduce(function (acc, key) {\n acc[key] = err[key];\n return acc;\n }, new Error(err.message));\n }\n // If an error is emitted, it is re-thrown by events. In previous versions\n // we emitted {error}, which is thrown as:\n // \"Uncaught, unspecified \\\"error\\\" event. ([object Object])\"\n // To avoid breaking changes, we make the error available in both\n // `error` and `error.error`\n // @MAJOR emit only error\n error.error = error;\n _this3.error = error;\n _this3.status = 'error';\n _this3.scheduleRender(false);\n\n // This needs to execute last because it throws the error.\n _this3.emit('error', error);\n });\n this.mainHelper = mainHelper;\n this.middleware.forEach(function (_ref5) {\n var instance = _ref5.instance;\n instance.subscribe();\n });\n this.mainIndex.init({\n instantSearchInstance: this,\n parent: null,\n uiState: this._initialUiState\n });\n if (this._initialResults) {\n var originalScheduleSearch = this.scheduleSearch;\n // We don't schedule a first search when initial results are provided\n // because we already have the results to render. This skips the initial\n // network request on the browser on `start`.\n this.scheduleSearch = defer(noop);\n // We also skip the initial network request when widgets are dynamically\n // added in the first tick (that's the case in all the framework-based flavors).\n // When we add a widget to `index`, it calls `scheduleSearch`. We can rely\n // on our `defer` util to restore the original `scheduleSearch` value once\n // widgets are added to hook back to the regular lifecycle.\n defer(function () {\n _this3.scheduleSearch = originalScheduleSearch;\n })();\n }\n // We only schedule a search when widgets have been added before `start()`\n // because there are listeners that can use these results.\n // This is especially useful in framework-based flavors that wait for\n // dynamically-added widgets to trigger a network request. It avoids\n // having to batch this initial network request with the one coming from\n // `addWidgets()`.\n // Later, we could also skip `index()` widgets and widgets that don't read\n // the results, but this is an optimization that has a very low impact for now.\n else if (this.mainIndex.getWidgets().length > 0) {\n this.scheduleSearch();\n }\n\n // Keep the previous reference for legacy purpose, some pattern use\n // the direct Helper access `search.helper` (e.g multi-index).\n this.helper = this.mainIndex.getHelper();\n\n // track we started the search if we add more widgets,\n // to init them directly after add\n this.started = true;\n this.middleware.forEach(function (_ref6) {\n var instance = _ref6.instance;\n instance.started();\n });\n }\n\n /**\n * Removes all widgets without triggering a search afterwards. This is an **EXPERIMENTAL** feature,\n * if you find an issue with it, please\n * [open an issue](https://github.com/algolia/instantsearch.js/issues/new?title=Problem%20with%20dispose).\n * @return {undefined} This method does not return anything\n */\n }, {\n key: \"dispose\",\n value: function dispose() {\n var _this$mainHelper2;\n this.scheduleSearch.cancel();\n this.scheduleRender.cancel();\n clearTimeout(this._searchStalledTimer);\n this.removeWidgets(this.mainIndex.getWidgets());\n this.mainIndex.dispose();\n\n // You can not start an instance two times, therefore a disposed instance\n // needs to set started as false otherwise this can not be restarted at a\n // later point.\n this.started = false;\n\n // The helper needs to be reset to perform the next search from a fresh state.\n // If not reset, it would use the state stored before calling `dispose()`.\n this.removeAllListeners();\n (_this$mainHelper2 = this.mainHelper) === null || _this$mainHelper2 === void 0 ? void 0 : _this$mainHelper2.removeAllListeners();\n this.mainHelper = null;\n this.helper = null;\n this.middleware.forEach(function (_ref7) {\n var instance = _ref7.instance;\n instance.unsubscribe();\n });\n }\n }, {\n key: \"scheduleStalledRender\",\n value: function scheduleStalledRender() {\n var _this4 = this;\n if (!this._searchStalledTimer) {\n this._searchStalledTimer = setTimeout(function () {\n _this4.status = 'stalled';\n _this4.scheduleRender();\n }, this._stalledSearchDelay);\n }\n }\n\n /**\n * Set the UI state and trigger a search.\n * @param uiState The next UI state or a function computing it from the current state\n * @param callOnStateChange private parameter used to know if the method is called from a state change\n */\n }, {\n key: \"setUiState\",\n value: function setUiState(uiState) {\n var _this5 = this;\n var callOnStateChange = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n if (!this.mainHelper) {\n throw new Error(withUsage('The `start` method needs to be called before `setUiState`.'));\n }\n\n // We refresh the index UI state to update the local UI state that the\n // main index passes to the function form of `setUiState`.\n this.mainIndex.refreshUiState();\n var nextUiState = typeof uiState === 'function' ? uiState(this.mainIndex.getWidgetUiState({})) : uiState;\n if (this.onStateChange && callOnStateChange) {\n this.onStateChange({\n uiState: nextUiState,\n setUiState: function setUiState(finalUiState) {\n setIndexHelperState(typeof finalUiState === 'function' ? finalUiState(nextUiState) : finalUiState, _this5.mainIndex);\n _this5.scheduleSearch();\n _this5.onInternalStateChange();\n }\n });\n } else {\n setIndexHelperState(nextUiState, this.mainIndex);\n this.scheduleSearch();\n this.onInternalStateChange();\n }\n }\n }, {\n key: \"getUiState\",\n value: function getUiState() {\n if (this.started) {\n // We refresh the index UI state to make sure changes from `refine` are taken in account\n this.mainIndex.refreshUiState();\n }\n return this.mainIndex.getWidgetUiState({});\n }\n }, {\n key: \"createURL\",\n value: function createURL() {\n var nextState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n if (!this.started) {\n throw new Error(withUsage('The `start` method needs to be called before `createURL`.'));\n }\n return this._createURL(nextState);\n }\n }, {\n key: \"refresh\",\n value: function refresh() {\n if (!this.mainHelper) {\n throw new Error(withUsage('The `start` method needs to be called before `refresh`.'));\n }\n this.mainHelper.clearCache().search();\n }\n }]);\n return InstantSearch;\n}(EventEmitter);\nexport default InstantSearch;","export default '4.56.9';","// typed as any, since it accepts the _real_ js clients, not the interface we otherwise expect\nexport function getAppIdAndApiKey(searchClient) {\n if (searchClient.transporter) {\n // searchClient v4\n var _searchClient$transpo = searchClient.transporter,\n headers = _searchClient$transpo.headers,\n queryParameters = _searchClient$transpo.queryParameters;\n var APP_ID = 'x-algolia-application-id';\n var API_KEY = 'x-algolia-api-key';\n var appId = headers[APP_ID] || queryParameters[APP_ID];\n var apiKey = headers[API_KEY] || queryParameters[API_KEY];\n return [appId, apiKey];\n } else {\n // searchClient v3\n return [searchClient.applicationID, searchClient.apiKey];\n }\n}","// We aren't using the native `Array.prototype.find` because the refactor away from Lodash is not\n// published as a major version.\n// Relying on the `find` polyfill on user-land, which before was only required for niche use-cases,\n// was decided as too risky.\n// @MAJOR Replace with the native `Array.prototype.find` method\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find\nexport function find(items, predicate) {\n var value;\n for (var i = 0; i < items.length; i++) {\n value = items[i];\n // inlined for performance: if (Call(predicate, thisArg, [value, i, list])) {\n if (predicate(value, i, items)) {\n return value;\n }\n }\n return undefined;\n}","import { createContext } from 'react';\nexport var InstantSearchSSRContext = /*#__PURE__*/createContext(null);\nif (process.env.NODE_ENV === 'development') {\n InstantSearchSSRContext.displayName = 'InstantSearchSSR';\n}","export default '7.0.1';","function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : \"undefined\" != typeof Symbol && arr[Symbol.iterator] || arr[\"@@iterator\"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nimport { useReducer } from 'react';\n\n/**\n * Forces a React update that triggers a rerender.\n * @link https://reactjs.org/docs/hooks-faq.html#is-there-something-like-forceupdate\n */\nexport function useForceUpdate() {\n var _useReducer = useReducer(function (x) {\n return x + 1;\n }, 0),\n _useReducer2 = _slicedToArray(_useReducer, 2),\n forceUpdate = _useReducer2[1];\n return forceUpdate;\n}","import InstantSearch from \"instantsearch.js/es/lib/InstantSearch.js\";\nimport { useCallback, useRef, version as ReactVersion } from 'react';\nimport { useSyncExternalStore } from \"use-sync-external-store/shim/index.js\";\nimport { useInstantSearchServerContext } from \"./useInstantSearchServerContext.js\";\nimport { useInstantSearchSSRContext } from \"./useInstantSearchSSRContext.js\";\nimport version from \"../version.js\";\nimport { useForceUpdate } from \"./useForceUpdate.js\";\nimport { warn } from \"./warn.js\";\nvar defaultUserAgents = [\"react (\".concat(ReactVersion, \")\"), \"react-instantsearch (\".concat(version, \")\"), \"react-instantsearch-core (\".concat(version, \")\")];\nvar serverUserAgent = \"react-instantsearch-server (\".concat(version, \")\");\nvar nextUserAgent = function nextUserAgent(nextVersion) {\n return nextVersion ? \"next.js (\".concat(nextVersion, \")\") : null;\n};\nexport function useInstantSearchApi(props) {\n var forceUpdate = useForceUpdate();\n var serverContext = useInstantSearchServerContext();\n var serverState = useInstantSearchSSRContext();\n var initialResults = serverState === null || serverState === void 0 ? void 0 : serverState.initialResults;\n var prevPropsRef = useRef(props);\n var searchRef = useRef(null);\n // As we need to render on mount with SSR, using the local ref above in `StrictMode` will\n // create and start two instances of InstantSearch. To avoid this, we instead discard it and use\n // an upward ref from `InstantSearchSSRContext` as it has already been mounted a second time at this point.\n if (serverState) {\n searchRef = serverState.ssrSearchRef;\n }\n if (searchRef.current === null) {\n // We don't use the `instantsearch()` function because it comes with other\n // top-level APIs that we don't need.\n // See https://github.com/algolia/instantsearch.js/blob/5b529f43d8acc680f85837eaaa41f7fd03a3f833/src/index.es.ts#L63-L86\n var search = new InstantSearch(props);\n search._schedule = function _schedule(cb) {\n search._schedule.queue.push(cb);\n clearTimeout(search._schedule.timer);\n search._schedule.timer = setTimeout(function () {\n search._schedule.queue.forEach(function (callback) {\n callback();\n });\n search._schedule.queue = [];\n }, 0);\n };\n search._schedule.queue = [];\n if (serverContext || initialResults) {\n // InstantSearch.js has a private Initial Results API that lets us inject\n // results on the search instance.\n // On the server, we default the initial results to an empty object so that\n // InstantSearch.js doesn't schedule a search that isn't used, leading to\n // an additional network request. (This is equivalent to monkey-patching\n // `scheduleSearch` to a noop.)\n search._initialResults = initialResults || {};\n }\n addAlgoliaAgents(props.searchClient, [].concat(defaultUserAgents, [serverContext && serverUserAgent, nextUserAgent(getNextVersion())]));\n\n // On the server, we start the search early to compute the search parameters.\n // On SSR, we start the search early to directly catch up with the lifecycle\n // and render.\n if (serverContext || initialResults) {\n search.start();\n }\n if (serverContext) {\n // We notify `getServerState()` of the InstantSearch internals to retrieve\n // the server state and pass it to the render on SSR.\n serverContext.notifyServer({\n search: search\n });\n }\n warnNextRouter(props.routing);\n searchRef.current = search;\n }\n {\n var _search = searchRef.current;\n var prevProps = prevPropsRef.current;\n if (prevProps.indexName !== props.indexName) {\n _search.helper.setIndex(props.indexName || '').search();\n prevPropsRef.current = props;\n }\n if (prevProps.searchClient !== props.searchClient) {\n process.env.NODE_ENV === 'development' ? warn(false, 'The `searchClient` prop of `` changed between renders, which may cause more search requests than necessary. If this is an unwanted behavior, please provide a stable reference: https://www.algolia.com/doc/api-reference/widgets/instantsearch/react/#widget-param-searchclient') : void 0;\n addAlgoliaAgents(props.searchClient, [].concat(defaultUserAgents, [serverContext && serverUserAgent]));\n _search.mainHelper.setClient(props.searchClient).search();\n prevPropsRef.current = props;\n }\n if (prevProps.onStateChange !== props.onStateChange) {\n _search.onStateChange = props.onStateChange;\n prevPropsRef.current = props;\n }\n if (prevProps.searchFunction !== props.searchFunction) {\n // Updating the `searchFunction` to `undefined` is not supported by\n // InstantSearch.js, so it will throw an error.\n // This is a fair behavior until we add an update API in InstantSearch.js.\n _search._searchFunction = props.searchFunction;\n prevPropsRef.current = props;\n }\n if (prevProps.stalledSearchDelay !== props.stalledSearchDelay) {\n var _props$stalledSearchD;\n // The default `stalledSearchDelay` in InstantSearch.js is 200ms.\n // We need to reset it when it's undefined to get back to the original value.\n _search._stalledSearchDelay = (_props$stalledSearchD = props.stalledSearchDelay) !== null && _props$stalledSearchD !== void 0 ? _props$stalledSearchD : 200;\n prevPropsRef.current = props;\n }\n\n // Updating the `routing` prop is not supported because InstantSearch.js\n // doesn't let us change it. This might not be a problem though, because `routing`\n // shouldn't need to be dynamic.\n // If we find scenarios where `routing` needs to change, we can always expose\n // it privately on the InstantSearch instance. Another way would be to\n // manually inject the routing middleware in this library, and not rely\n // on the provided `routing` prop.\n }\n\n var cleanupTimerRef = useRef(null);\n var store = useSyncExternalStore(useCallback(function () {\n var search = searchRef.current;\n\n // Scenario 1: the component mounts.\n if (cleanupTimerRef.current === null) {\n // On SSR, the instance is already started so we don't start it again.\n if (!search.started) {\n search.start();\n forceUpdate();\n }\n }\n // Scenario 2: the component updates.\n else {\n // We cancel the previous cleanup function because we don't want to\n // dispose the search during an update.\n clearTimeout(cleanupTimerRef.current);\n search._preventWidgetCleanup = false;\n }\n return function () {\n function cleanup() {\n search.dispose();\n }\n clearTimeout(search._schedule.timer);\n // We clean up only when the component that uses this subscription unmounts,\n // but not when it updates, because it would dispose the instance, which\n // would remove all the widgets and break routing.\n // Executing the cleanup function in a `setTimeout()` lets us cancel it\n // in the next effect.\n // (There might be better ways to do this.)\n cleanupTimerRef.current = setTimeout(cleanup);\n\n // We need to prevent the `useWidget` cleanup function so that widgets\n // are not removed before the instance is disposed, triggering\n // an unwanted search request.\n search._preventWidgetCleanup = true;\n };\n }, [forceUpdate]), function () {\n return searchRef.current;\n }, function () {\n return searchRef.current;\n });\n return store;\n}\nfunction addAlgoliaAgents(searchClient, userAgents) {\n if (typeof searchClient.addAlgoliaAgent !== 'function') {\n return;\n }\n userAgents.filter(Boolean).forEach(function (userAgent) {\n searchClient.addAlgoliaAgent(userAgent);\n });\n}\nfunction warnNextRouter(routing) {\n if (process.env.NODE_ENV === 'development') {\n var _routing$router;\n if (!routing || typeof window === 'undefined' || !('__NEXT_DATA__' in window)) {\n return;\n }\n var isUsingNextRouter =\n // @ts-expect-error: _isNextRouter is only set on the Next.js router\n routing !== true && (routing === null || routing === void 0 ? void 0 : (_routing$router = routing.router) === null || _routing$router === void 0 ? void 0 : _routing$router._isNextRouter);\n process.env.NODE_ENV === 'development' ? warn(isUsingNextRouter, \"\\nYou are using Next.js with InstantSearch without the \\\"react-instantsearch-router-nextjs\\\" package.\\nThis package is recommended to make the routing work correctly with Next.js.\\nPlease check its usage instructions: https://github.com/algolia/instantsearch/tree/master/packages/react-instantsearch-router-nextjs\\n\\nYou can ignore this warning if you are using a custom router that suits your needs, it won't be outputted in production builds.\") : void 0;\n }\n}\n\n/**\n * Gets the version of Next.js if it is available in the `window` object,\n * otherwise it returns the NEXT_RUNTIME environment variable (in SSR),\n * which is either `nodejs` or `edge`.\n */\nfunction getNextVersion() {\n var _next, _process$env;\n return typeof window !== 'undefined' && ((_next = window.next) === null || _next === void 0 ? void 0 : _next.version) || (typeof process !== 'undefined' ? (_process$env = process.env) === null || _process$env === void 0 ? void 0 : _process$env.NEXT_RUNTIME : undefined);\n}","import { useContext } from 'react';\nimport { InstantSearchSSRContext } from \"./InstantSearchSSRContext.js\";\nexport function useInstantSearchSSRContext() {\n return useContext(InstantSearchSSRContext);\n}","var _excluded = [\"children\"];\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\nimport React from 'react';\nimport { IndexContext } from \"../lib/IndexContext.js\";\nimport { InstantSearchContext } from \"../lib/InstantSearchContext.js\";\nimport { useInstantSearchApi } from \"../lib/useInstantSearchApi.js\";\nexport function InstantSearch(_ref) {\n var children = _ref.children,\n props = _objectWithoutProperties(_ref, _excluded);\n var search = useInstantSearchApi(props);\n if (!search.started) {\n return null;\n }\n return /*#__PURE__*/React.createElement(InstantSearchContext.Provider, {\n value: search\n }, /*#__PURE__*/React.createElement(IndexContext.Provider, {\n value: search.mainIndex\n }, children));\n}","function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : \"undefined\" != typeof Symbol && arr[Symbol.iterator] || arr[\"@@iterator\"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nimport { serializePayload } from \"./serializer.js\";\nfunction chunk(arr) {\n var chunkSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 20;\n var chunks = [];\n for (var i = 0; i < Math.ceil(arr.length / chunkSize); i++) {\n chunks.push(arr.slice(i * chunkSize, (i + 1) * chunkSize));\n }\n return chunks;\n}\nexport function _buildEventPayloadsForHits(_ref) {\n var index = _ref.index,\n widgetType = _ref.widgetType,\n methodName = _ref.methodName,\n args = _ref.args,\n instantSearchInstance = _ref.instantSearchInstance;\n // when there's only one argument, that means it's custom\n if (args.length === 1 && _typeof(args[0]) === 'object') {\n return [args[0]];\n }\n var _args$0$split = args[0].split(':'),\n _args$0$split2 = _slicedToArray(_args$0$split, 2),\n eventType = _args$0$split2[0],\n eventModifier = _args$0$split2[1];\n var hits = args[1];\n var eventName = args[2];\n if (!hits) {\n if (process.env.NODE_ENV === 'development') {\n throw new Error(\"You need to pass hit or hits as the second argument like:\\n \".concat(methodName, \"(eventType, hit);\\n \"));\n } else {\n return [];\n }\n }\n if ((eventType === 'click' || eventType === 'conversion') && !eventName) {\n if (process.env.NODE_ENV === 'development') {\n throw new Error(\"You need to pass eventName as the third argument for 'click' or 'conversion' events like:\\n \".concat(methodName, \"('click', hit, 'Product Purchased');\\n\\n To learn more about event naming: https://www.algolia.com/doc/guides/getting-insights-and-analytics/search-analytics/click-through-and-conversions/in-depth/clicks-conversions-best-practices/\\n \"));\n } else {\n return [];\n }\n }\n var hitsArray = Array.isArray(hits) ? hits : [hits];\n if (hitsArray.length === 0) {\n return [];\n }\n var queryID = hitsArray[0].__queryID;\n var hitsChunks = chunk(hitsArray);\n var objectIDsByChunk = hitsChunks.map(function (batch) {\n return batch.map(function (hit) {\n return hit.objectID;\n });\n });\n var positionsByChunk = hitsChunks.map(function (batch) {\n return batch.map(function (hit) {\n return hit.__position;\n });\n });\n if (eventType === 'view') {\n if (instantSearchInstance.status !== 'idle') {\n return [];\n }\n return hitsChunks.map(function (batch, i) {\n return {\n insightsMethod: 'viewedObjectIDs',\n widgetType: widgetType,\n eventType: eventType,\n payload: {\n eventName: eventName || 'Hits Viewed',\n index: index,\n objectIDs: objectIDsByChunk[i]\n },\n hits: batch,\n eventModifier: eventModifier\n };\n });\n } else if (eventType === 'click') {\n return hitsChunks.map(function (batch, i) {\n return {\n insightsMethod: 'clickedObjectIDsAfterSearch',\n widgetType: widgetType,\n eventType: eventType,\n payload: {\n eventName: eventName || 'Hit Clicked',\n index: index,\n queryID: queryID,\n objectIDs: objectIDsByChunk[i],\n positions: positionsByChunk[i]\n },\n hits: batch,\n eventModifier: eventModifier\n };\n });\n } else if (eventType === 'conversion') {\n return hitsChunks.map(function (batch, i) {\n return {\n insightsMethod: 'convertedObjectIDsAfterSearch',\n widgetType: widgetType,\n eventType: eventType,\n payload: {\n eventName: eventName || 'Hit Converted',\n index: index,\n queryID: queryID,\n objectIDs: objectIDsByChunk[i]\n },\n hits: batch,\n eventModifier: eventModifier\n };\n });\n } else if (process.env.NODE_ENV === 'development') {\n throw new Error(\"eventType(\\\"\".concat(eventType, \"\\\") is not supported.\\n If you want to send a custom payload, you can pass one object: \").concat(methodName, \"(customPayload);\\n \"));\n } else {\n return [];\n }\n}\nexport function createSendEventForHits(_ref2) {\n var instantSearchInstance = _ref2.instantSearchInstance,\n index = _ref2.index,\n widgetType = _ref2.widgetType;\n var sentEvents = {};\n var timer = undefined;\n var sendEventForHits = function sendEventForHits() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n var payloads = _buildEventPayloadsForHits({\n widgetType: widgetType,\n index: index,\n methodName: 'sendEvent',\n args: args,\n instantSearchInstance: instantSearchInstance\n });\n payloads.forEach(function (payload) {\n if (payload.eventType === 'click' && payload.eventModifier === 'internal' && sentEvents[payload.eventType]) {\n return;\n }\n sentEvents[payload.eventType] = true;\n instantSearchInstance.sendEventToInsights(payload);\n });\n clearTimeout(timer);\n timer = setTimeout(function () {\n sentEvents = {};\n }, 0);\n };\n return sendEventForHits;\n}\nexport function createBindEventForHits(_ref3) {\n var index = _ref3.index,\n widgetType = _ref3.widgetType,\n instantSearchInstance = _ref3.instantSearchInstance;\n var bindEventForHits = function bindEventForHits() {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n var payloads = _buildEventPayloadsForHits({\n widgetType: widgetType,\n index: index,\n methodName: 'bindEvent',\n args: args,\n instantSearchInstance: instantSearchInstance\n });\n return payloads.length ? \"data-insights-event=\".concat(serializePayload(payloads)) : '';\n };\n return bindEventForHits;\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nexport function addAbsolutePosition(hits, page, hitsPerPage) {\n return hits.map(function (hit, idx) {\n return _objectSpread(_objectSpread({}, hit), {}, {\n __position: hitsPerPage * page + idx + 1\n });\n });\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nexport function addQueryID(hits, queryID) {\n if (!queryID) {\n return hits;\n }\n return hits.map(function (hit) {\n return _objectSpread(_objectSpread({}, hit), {}, {\n __queryID: queryID\n });\n });\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nimport { escapeHits, TAG_PLACEHOLDER, checkRendering, createDocumentationMessageGenerator, addAbsolutePosition, addQueryID, createSendEventForHits, createBindEventForHits, noop } from \"../../lib/utils/index.js\";\nvar withUsage = createDocumentationMessageGenerator({\n name: 'hits',\n connector: true\n});\nvar connectHits = function connectHits(renderFn) {\n var unmountFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;\n checkRendering(renderFn, withUsage());\n return function (widgetParams) {\n var _ref = widgetParams || {},\n _ref$escapeHTML = _ref.escapeHTML,\n escapeHTML = _ref$escapeHTML === void 0 ? true : _ref$escapeHTML,\n _ref$transformItems = _ref.transformItems,\n transformItems = _ref$transformItems === void 0 ? function (items) {\n return items;\n } : _ref$transformItems;\n var sendEvent;\n var bindEvent;\n return {\n $$type: 'ais.hits',\n init: function init(initOptions) {\n renderFn(_objectSpread(_objectSpread({}, this.getWidgetRenderState(initOptions)), {}, {\n instantSearchInstance: initOptions.instantSearchInstance\n }), true);\n },\n render: function render(renderOptions) {\n var renderState = this.getWidgetRenderState(renderOptions);\n renderFn(_objectSpread(_objectSpread({}, renderState), {}, {\n instantSearchInstance: renderOptions.instantSearchInstance\n }), false);\n renderState.sendEvent('view:internal', renderState.hits);\n },\n getRenderState: function getRenderState(renderState, renderOptions) {\n return _objectSpread(_objectSpread({}, renderState), {}, {\n hits: this.getWidgetRenderState(renderOptions)\n });\n },\n getWidgetRenderState: function getWidgetRenderState(_ref2) {\n var results = _ref2.results,\n helper = _ref2.helper,\n instantSearchInstance = _ref2.instantSearchInstance;\n if (!sendEvent) {\n sendEvent = createSendEventForHits({\n instantSearchInstance: instantSearchInstance,\n index: helper.getIndex(),\n widgetType: this.$$type\n });\n }\n if (!bindEvent) {\n bindEvent = createBindEventForHits({\n index: helper.getIndex(),\n widgetType: this.$$type,\n instantSearchInstance: instantSearchInstance\n });\n }\n if (!results) {\n return {\n hits: [],\n results: undefined,\n sendEvent: sendEvent,\n bindEvent: bindEvent,\n widgetParams: widgetParams\n };\n }\n if (escapeHTML && results.hits.length > 0) {\n results.hits = escapeHits(results.hits);\n }\n var hitsWithAbsolutePosition = addAbsolutePosition(results.hits, results.page, results.hitsPerPage);\n var hitsWithAbsolutePositionAndQueryID = addQueryID(hitsWithAbsolutePosition, results.queryID);\n var transformedHits = transformItems(hitsWithAbsolutePositionAndQueryID, {\n results: results\n });\n return {\n hits: transformedHits,\n results: results,\n sendEvent: sendEvent,\n bindEvent: bindEvent,\n widgetParams: widgetParams\n };\n },\n dispose: function dispose(_ref3) {\n var state = _ref3.state;\n unmountFn();\n if (!escapeHTML) {\n return state;\n }\n return state.setQueryParameters(Object.keys(TAG_PLACEHOLDER).reduce(function (acc, key) {\n return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, key, undefined));\n }, {}));\n },\n getWidgetSearchParameters: function getWidgetSearchParameters(state) {\n if (!escapeHTML) {\n return state;\n }\n return state.setQueryParameters(TAG_PLACEHOLDER);\n }\n };\n };\n};\nexport default connectHits;","import connectHits from \"instantsearch.js/es/connectors/hits/connectHits.js\";\nimport { useConnector } from \"../hooks/useConnector.js\";\nexport function useHits(props, additionalWidgetProperties) {\n return useConnector(connectHits, props, additionalWidgetProperties);\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n/* eslint-disable complexity */\n\n/*\n * Code taken from dequal/lite v2.0.0\n * https://github.com/lukeed/dequal/blob/9aa73181ac7e081cd330cac67d313632ac04bb02/src/lite.js\n *\n * It adds a 3rd argument `compare(a, b)` that lets execute custom logic to\n * compare values.\n * We use it to skip comparing function references.\n */\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\nvar has = Object.prototype.hasOwnProperty;\nexport function dequal(foo, bar, compare) {\n // start of custom implementation\n if (compare !== null && compare !== void 0 && compare(foo, bar)) {\n return true;\n }\n // end of custom implementation\n\n var ctor;\n var len;\n if (foo === bar) return true;\n if (foo && bar && (ctor = foo.constructor) === bar.constructor) {\n if (ctor === Date) return foo.getTime() === bar.getTime();\n if (ctor === RegExp) return foo.toString() === bar.toString();\n if (ctor === Array) {\n if ((len = foo.length) === bar.length) {\n while (len-- && dequal(foo[len], bar[len], compare));\n }\n return len === -1;\n }\n if (!ctor || _typeof(foo) === 'object') {\n len = 0;\n // eslint-disable-next-line guard-for-in, no-restricted-syntax\n for (ctor in foo) {\n if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;\n if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor], compare)) return false;\n }\n return Object.keys(bar).length === len;\n }\n }\n\n // eslint-disable-next-line no-self-compare\n return foo !== foo && bar !== bar;\n}","function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : \"undefined\" != typeof Symbol && arr[Symbol.iterator] || arr[\"@@iterator\"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nimport { useState } from 'react';\nimport { dequal } from \"./dequal.js\";\nexport function useStableValue(value) {\n var _useState = useState(function () {\n return value;\n }),\n _useState2 = _slicedToArray(_useState, 2),\n stableValue = _useState2[0],\n setStableValue = _useState2[1];\n if (!dequal(stableValue, value)) {\n setStableValue(value);\n }\n return stableValue;\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nvar _excluded = [\"instantSearchInstance\", \"widgetParams\"],\n _excluded2 = [\"widgetParams\"];\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : \"undefined\" != typeof Symbol && arr[Symbol.iterator] || arr[\"@@iterator\"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\nimport { useMemo, useRef, useState } from 'react';\nimport { dequal } from \"../lib/dequal.js\";\nimport { getIndexSearchResults } from \"../lib/getIndexSearchResults.js\";\nimport { useIndexContext } from \"../lib/useIndexContext.js\";\nimport { useInstantSearchContext } from \"../lib/useInstantSearchContext.js\";\nimport { useInstantSearchServerContext } from \"../lib/useInstantSearchServerContext.js\";\nimport { useStableValue } from \"../lib/useStableValue.js\";\nimport { useWidget } from \"../lib/useWidget.js\";\nexport function useConnector(connector) {\n var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var additionalWidgetProperties = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var serverContext = useInstantSearchServerContext();\n var search = useInstantSearchContext();\n var parentIndex = useIndexContext();\n var stableProps = useStableValue(props);\n var stableAdditionalWidgetProperties = useStableValue(additionalWidgetProperties);\n var shouldSetStateRef = useRef(true);\n var previousRenderStateRef = useRef(null);\n var previousStatusRef = useRef(search.status);\n var widget = useMemo(function () {\n var createWidget = connector(function (connectorState, isFirstRender) {\n // We skip the `init` widget render because:\n // - We rely on `getWidgetRenderState` to compute the initial state before\n // the InstantSearch.js lifecycle starts.\n // - It prevents UI flashes when updating the widget props.\n if (isFirstRender) {\n shouldSetStateRef.current = true;\n return;\n }\n\n // There are situations where InstantSearch.js may render widgets slightly\n // after they're removed by React, and thus try to update the React state\n // on unmounted components. React 16 and 17 consider them as memory leaks\n // and display a warning.\n // This happens in when `attributesToRender` contains a\n // value without an attribute previously mounted. React will unmount the\n // component controlled by that attribute, but InstantSearch.js will stay\n // unaware of this change until the render pass finishes, and therefore\n // notifies of a state change.\n // This ref lets us track this situation and ignore these state updates.\n if (shouldSetStateRef.current) {\n var instantSearchInstance = connectorState.instantSearchInstance,\n widgetParams = connectorState.widgetParams,\n renderState = _objectWithoutProperties(connectorState, _excluded);\n\n // We only update the state when a widget render state param changes,\n // except for functions. We ignore function reference changes to avoid\n // infinite loops. It's safe to omit them because they get updated\n // every time another render param changes.\n if (!dequal(renderState, previousRenderStateRef.current, function (a, b) {\n return (a === null || a === void 0 ? void 0 : a.constructor) === Function && (b === null || b === void 0 ? void 0 : b.constructor) === Function;\n }) || instantSearchInstance.status !== previousStatusRef.current) {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n setState(renderState);\n previousRenderStateRef.current = renderState;\n previousStatusRef.current = instantSearchInstance.status;\n }\n }\n }, function () {\n // We'll ignore the next state update until we know for sure that\n // InstantSearch.js re-inits the component.\n shouldSetStateRef.current = false;\n });\n return _objectSpread(_objectSpread({}, createWidget(stableProps)), stableAdditionalWidgetProperties);\n }, [connector, stableProps, stableAdditionalWidgetProperties]);\n var _useState = useState(function () {\n if (widget.getWidgetRenderState) {\n var _widget$getWidgetSear;\n // The helper exists because we've started InstantSearch.\n var helper = parentIndex.getHelper();\n var uiState = parentIndex.getWidgetUiState({})[parentIndex.getIndexId()];\n helper.state = ((_widget$getWidgetSear = widget.getWidgetSearchParameters) === null || _widget$getWidgetSear === void 0 ? void 0 : _widget$getWidgetSear.call(widget, helper.state, {\n uiState: uiState\n })) || helper.state;\n var _getIndexSearchResult = getIndexSearchResults(parentIndex),\n results = _getIndexSearchResult.results,\n scopedResults = _getIndexSearchResult.scopedResults;\n\n // We get the widget render state by providing the same parameters as\n // InstantSearch provides to the widget's `render` method.\n // See https://github.com/algolia/instantsearch.js/blob/019cd18d0de6dd320284aa4890541b7fe2198c65/src/widgets/index/index.ts#L604-L617\n var _widget$getWidgetRend = widget.getWidgetRenderState({\n helper: helper,\n parent: parentIndex,\n instantSearchInstance: search,\n results: results,\n scopedResults: scopedResults,\n state: helper.state,\n renderState: search.renderState,\n templatesConfig: search.templatesConfig,\n createURL: parentIndex.createURL,\n searchMetadata: {\n isSearchStalled: search.status === 'stalled'\n },\n status: search.status,\n error: search.error\n }),\n widgetParams = _widget$getWidgetRend.widgetParams,\n renderState = _objectWithoutProperties(_widget$getWidgetRend, _excluded2);\n return renderState;\n }\n return {};\n }),\n _useState2 = _slicedToArray(_useState, 2),\n state = _useState2[0],\n setState = _useState2[1];\n useWidget({\n widget: widget,\n parentIndex: parentIndex,\n props: stableProps,\n shouldSsr: Boolean(serverContext)\n });\n return state;\n}","import { useEffect, useRef } from 'react';\nimport { dequal } from \"./dequal.js\";\nimport { useInstantSearchContext } from \"./useInstantSearchContext.js\";\nimport { useIsomorphicLayoutEffect } from \"./useIsomorphicLayoutEffect.js\";\nexport function useWidget(_ref) {\n var widget = _ref.widget,\n parentIndex = _ref.parentIndex,\n props = _ref.props,\n shouldSsr = _ref.shouldSsr;\n var prevPropsRef = useRef(props);\n useEffect(function () {\n prevPropsRef.current = props;\n }, [props]);\n var prevWidgetRef = useRef(widget);\n useEffect(function () {\n prevWidgetRef.current = widget;\n }, [widget]);\n var cleanupTimerRef = useRef(null);\n var shouldAddWidgetEarly = shouldSsr && !parentIndex.getWidgets().includes(widget);\n var search = useInstantSearchContext();\n\n // This effect is responsible for adding, removing, and updating the widget.\n // We need to support scenarios where the widget is remounted quickly, like in\n // Strict Mode, so that we don't lose its state, and therefore that we don't\n // break routing.\n useIsomorphicLayoutEffect(function () {\n var previousWidget = prevWidgetRef.current;\n\n // Scenario 1: the widget is added for the first time.\n if (!cleanupTimerRef.current) {\n if (!shouldAddWidgetEarly) {\n parentIndex.addWidgets([widget]);\n }\n }\n // Scenario 2: the widget is rerendered or updated.\n else {\n // We cancel the original effect cleanup because it may not be necessary if\n // props haven't changed. (We manually call it if it is below.)\n clearTimeout(cleanupTimerRef.current);\n\n // Warning: if an unstable function prop is provided, `dequal` is not able\n // to keep its reference and therefore will consider that props did change.\n // This could unsollicitely remove/add the widget, therefore forget its state,\n // and could be a source of confusion.\n // If users face this issue, we should advise them to provide stable function\n // references.\n var arePropsEqual = dequal(props, prevPropsRef.current);\n\n // If props did change, then we execute the cleanup function instantly\n // and then add the widget back. This lets us add the widget without\n // waiting for the scheduled cleanup function to finish (that we canceled\n // above).\n if (!arePropsEqual) {\n parentIndex.removeWidgets([previousWidget]);\n parentIndex.addWidgets([widget]);\n }\n }\n return function () {\n // We don't remove the widget right away, but rather schedule it so that\n // we're able to cancel it in the next effect.\n cleanupTimerRef.current = setTimeout(function () {\n search._schedule(function () {\n if (search._preventWidgetCleanup) return;\n parentIndex.removeWidgets([previousWidget]);\n });\n });\n };\n }, [parentIndex, widget, shouldAddWidgetEarly, search, props]);\n if (shouldAddWidgetEarly) {\n parentIndex.addWidgets([widget]);\n }\n}","import { createContext } from 'react';\nexport var IndexContext = /*#__PURE__*/createContext(null);\nif (process.env.NODE_ENV === 'development') {\n IndexContext.displayName = 'Index';\n}","import { createContext } from 'react';\nexport var InstantSearchContext = /*#__PURE__*/createContext(null);\nif (process.env.NODE_ENV === 'development') {\n InstantSearchContext.displayName = 'InstantSearch';\n}","import algoliasearchHelper from 'algoliasearch-helper';\nexport function createSearchResults(state) {\n var _state$query, _state$page, _state$hitsPerPage;\n return new algoliasearchHelper.SearchResults(state, [{\n query: (_state$query = state.query) !== null && _state$query !== void 0 ? _state$query : '',\n page: (_state$page = state.page) !== null && _state$page !== void 0 ? _state$page : 0,\n hitsPerPage: (_state$hitsPerPage = state.hitsPerPage) !== null && _state$hitsPerPage !== void 0 ? _state$hitsPerPage : 20,\n hits: [],\n nbHits: 0,\n nbPages: 0,\n params: '',\n exhaustiveNbHits: true,\n exhaustiveFacetsCount: true,\n processingTimeMS: 0,\n index: state.index\n }], {\n /** used by connectors to prevent persisting these results */\n __isArtificial: true\n });\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nimport { createSearchResults } from \"./createSearchResults.js\";\nexport function getIndexSearchResults(indexWidget) {\n var helper = indexWidget.getHelper();\n var results =\n // On SSR, we get the results injected on the Index.\n indexWidget.getResults() ||\n // On the browser, we create fallback results based on the helper state.\n createSearchResults(helper.state);\n var scopedResults = indexWidget.getScopedResults().map(function (scopedResult) {\n var fallbackResults = scopedResult.indexId === indexWidget.getIndexId() ? results : createSearchResults(scopedResult.helper.state);\n return _objectSpread(_objectSpread({}, scopedResult), {}, {\n // We keep `results` from being `null`.\n results: scopedResult.results || fallbackResults\n });\n });\n return {\n results: results,\n scopedResults: scopedResults\n };\n}","/**\n * Throws an error if the condition is not met.\n *\n * The error is exhaustive in development, and becomes generic in production.\n *\n * This is used to make development a better experience to provide guidance as\n * to where the error comes from.\n */\nexport function invariant(condition, message) {\n if (condition) {\n return;\n }\n if (!(process.env.NODE_ENV === 'development')) {\n throw new Error('Invariant failed');\n }\n if (process.env.NODE_ENV === 'development') {\n throw new Error(\"[InstantSearch] \".concat(typeof message === 'function' ? message() : message));\n }\n}","import { useContext } from 'react';\nimport { invariant } from \"./invariant.js\";\nimport { IndexContext } from \"./IndexContext.js\";\nexport function useIndexContext() {\n var context = useContext(IndexContext);\n invariant(context !== null, 'The component must be used within .');\n return context;\n}","import { useContext } from 'react';\nimport { invariant } from \"./invariant.js\";\nimport { InstantSearchContext } from \"./InstantSearchContext.js\";\nexport function useInstantSearchContext() {\n var search = useContext(InstantSearchContext);\n invariant(search !== null, 'Hooks must be used inside the component.\\n\\n' + 'They are not compatible with the `react-instantsearch-core@6.x` and `react-instantsearch-dom` packages, so make sure to use the component from `react-instantsearch-core@7.x`.');\n return search;\n}","import { createContext } from 'react';\nexport var InstantSearchServerContext = /*#__PURE__*/createContext(null);\nif (process.env.NODE_ENV === 'development') {\n InstantSearchServerContext.displayName = 'InstantSearchServer';\n}","import { useContext } from 'react';\nimport { InstantSearchServerContext } from \"../components/InstantSearchServerContext.js\";\nexport function useInstantSearchServerContext() {\n return useContext(InstantSearchServerContext);\n}","import { useEffect, useLayoutEffect } from 'react';\n\n/**\n * `useLayoutEffect` that doesn't show a warning when server-side rendering.\n *\n * It uses `useEffect` on the server (no-op), and `useLayoutEffect` on the browser.\n */\nexport var useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;","var _excluded = [\"formRef\", \"inputRef\", \"isSearchStalled\", \"onChange\", \"onReset\", \"onSubmit\", \"placeholder\", \"value\", \"autoFocus\", \"resetIconComponent\", \"submitIconComponent\", \"loadingIconComponent\", \"classNames\", \"translations\"];\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\nimport React from 'react';\nimport { cx } from \"./lib/cx.js\";\nvar _ref2 = /*#__PURE__*/React.createElement(\"path\", {\n d: \"M26.804 29.01c-2.832 2.34-6.465 3.746-10.426 3.746C7.333 32.756 0 25.424 0 16.378 0 7.333 7.333 0 16.378 0c9.046 0 16.378 7.333 16.378 16.378 0 3.96-1.406 7.594-3.746 10.426l10.534 10.534c.607.607.61 1.59-.004 2.202-.61.61-1.597.61-2.202.004L26.804 29.01zm-10.426.627c7.323 0 13.26-5.936 13.26-13.26 0-7.32-5.937-13.257-13.26-13.257C9.056 3.12 3.12 9.056 3.12 16.378c0 7.323 5.936 13.26 13.258 13.26z\"\n});\nfunction DefaultSubmitIcon(_ref) {\n var classNames = _ref.classNames;\n return /*#__PURE__*/React.createElement(\"svg\", {\n className: cx('ais-SearchBox-submitIcon', classNames.submitIcon),\n width: \"10\",\n height: \"10\",\n viewBox: \"0 0 40 40\",\n \"aria-hidden\": \"true\"\n }, _ref2);\n}\nvar _ref4 = /*#__PURE__*/React.createElement(\"path\", {\n d: \"M8.114 10L.944 2.83 0 1.885 1.886 0l.943.943L10 8.113l7.17-7.17.944-.943L20 1.886l-.943.943-7.17 7.17 7.17 7.17.943.944L18.114 20l-.943-.943-7.17-7.17-7.17 7.17-.944.943L0 18.114l.943-.943L8.113 10z\"\n});\nfunction DefaultResetIcon(_ref3) {\n var classNames = _ref3.classNames;\n return /*#__PURE__*/React.createElement(\"svg\", {\n className: cx('ais-SearchBox-resetIcon', classNames.resetIcon),\n viewBox: \"0 0 20 20\",\n width: \"10\",\n height: \"10\",\n \"aria-hidden\": \"true\"\n }, _ref4);\n}\nvar _ref6 = /*#__PURE__*/React.createElement(\"g\", {\n fill: \"none\",\n fillRule: \"evenodd\"\n}, /*#__PURE__*/React.createElement(\"g\", {\n transform: \"translate(1 1)\",\n strokeWidth: \"2\"\n}, /*#__PURE__*/React.createElement(\"circle\", {\n strokeOpacity: \".5\",\n cx: \"18\",\n cy: \"18\",\n r: \"18\"\n}), /*#__PURE__*/React.createElement(\"path\", {\n d: \"M36 18c0-9.94-8.06-18-18-18\"\n}, /*#__PURE__*/React.createElement(\"animateTransform\", {\n attributeName: \"transform\",\n type: \"rotate\",\n from: \"0 18 18\",\n to: \"360 18 18\",\n dur: \"1s\",\n repeatCount: \"indefinite\"\n}))));\nfunction DefaultLoadingIcon(_ref5) {\n var classNames = _ref5.classNames;\n return /*#__PURE__*/React.createElement(\"svg\", {\n width: \"16\",\n height: \"16\",\n viewBox: \"0 0 38 38\",\n stroke: \"#444\",\n className: cx('ais-SearchBox-loadingIcon', classNames.loadingIcon),\n \"aria-hidden\": \"true\"\n }, _ref6);\n}\nexport function SearchBox(_ref7) {\n var formRef = _ref7.formRef,\n inputRef = _ref7.inputRef,\n isSearchStalled = _ref7.isSearchStalled,\n onChange = _ref7.onChange,\n onReset = _ref7.onReset,\n onSubmit = _ref7.onSubmit,\n placeholder = _ref7.placeholder,\n value = _ref7.value,\n autoFocus = _ref7.autoFocus,\n _ref7$resetIconCompon = _ref7.resetIconComponent,\n ResetIcon = _ref7$resetIconCompon === void 0 ? DefaultResetIcon : _ref7$resetIconCompon,\n _ref7$submitIconCompo = _ref7.submitIconComponent,\n SubmitIcon = _ref7$submitIconCompo === void 0 ? DefaultSubmitIcon : _ref7$submitIconCompo,\n _ref7$loadingIconComp = _ref7.loadingIconComponent,\n LoadingIcon = _ref7$loadingIconComp === void 0 ? DefaultLoadingIcon : _ref7$loadingIconComp,\n _ref7$classNames = _ref7.classNames,\n classNames = _ref7$classNames === void 0 ? {} : _ref7$classNames,\n translations = _ref7.translations,\n props = _objectWithoutProperties(_ref7, _excluded);\n function handleSubmit(event) {\n event.preventDefault();\n event.stopPropagation();\n if (onSubmit) {\n onSubmit(event);\n }\n if (inputRef.current) {\n inputRef.current.blur();\n }\n }\n function handleReset(event) {\n event.preventDefault();\n event.stopPropagation();\n onReset(event);\n if (inputRef.current) {\n inputRef.current.focus();\n }\n }\n return /*#__PURE__*/React.createElement(\"div\", _extends({}, props, {\n className: cx('ais-SearchBox', classNames.root, props.className)\n }), /*#__PURE__*/React.createElement(\"form\", {\n ref: formRef,\n action: \"\",\n className: cx('ais-SearchBox-form', classNames.form),\n noValidate: true,\n onSubmit: handleSubmit,\n onReset: handleReset\n }, /*#__PURE__*/React.createElement(\"input\", {\n ref: inputRef,\n className: cx('ais-SearchBox-input', classNames.input),\n autoComplete: \"off\",\n autoCorrect: \"off\",\n autoCapitalize: \"off\",\n placeholder: placeholder,\n spellCheck: false,\n maxLength: 512,\n type: \"search\",\n value: value,\n onChange: onChange,\n autoFocus: autoFocus\n }), /*#__PURE__*/React.createElement(\"button\", {\n className: cx('ais-SearchBox-submit', classNames.submit),\n type: \"submit\",\n title: translations.submitButtonTitle\n }, /*#__PURE__*/React.createElement(SubmitIcon, {\n classNames: classNames\n })), /*#__PURE__*/React.createElement(\"button\", {\n className: cx('ais-SearchBox-reset', classNames.reset),\n type: \"reset\",\n title: translations.resetButtonTitle,\n hidden: value.length === 0 || isSearchStalled\n }, /*#__PURE__*/React.createElement(ResetIcon, {\n classNames: classNames\n })), /*#__PURE__*/React.createElement(\"span\", {\n className: cx('ais-SearchBox-loadingIndicator', classNames.loadingIndicator)\n // @ts-ignore (this error is due to conflict with @algolia/ui-components-highlight-vdom, which declares \"too global\" type for span in case there's no @types/react or preact)\n ,\n hidden: !isSearchStalled\n }, /*#__PURE__*/React.createElement(LoadingIcon, {\n classNames: classNames\n }))));\n}","export function cx() {\n for (var _len = arguments.length, classNames = new Array(_len), _key = 0; _key < _len; _key++) {\n classNames[_key] = arguments[_key];\n }\n return classNames.filter(Boolean).join(' ');\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nimport { checkRendering, createDocumentationMessageGenerator, noop } from \"../../lib/utils/index.js\";\nvar withUsage = createDocumentationMessageGenerator({\n name: 'search-box',\n connector: true\n});\n\n/**\n * @typedef {Object} CustomSearchBoxWidgetParams\n * @property {function(string, function(string))} [queryHook = undefined] A function that will be called every time\n * a new value for the query is set. The first parameter is the query and the second is a\n * function to actually trigger the search. The function takes the query as the parameter.\n *\n * This queryHook can be used to debounce the number of searches done from the searchBox.\n */\n\nvar defaultQueryHook = function defaultQueryHook(query, hook) {\n return hook(query);\n};\n\n/**\n * **SearchBox** connector provides the logic to build a widget that will let the user search for a query.\n *\n * The connector provides to the rendering: `refine()` to set the query. The behaviour of this function\n * may be impacted by the `queryHook` widget parameter.\n */\nvar connectSearchBox = function connectSearchBox(renderFn) {\n var unmountFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;\n checkRendering(renderFn, withUsage());\n return function (widgetParams) {\n var _ref = widgetParams || {},\n _ref$queryHook = _ref.queryHook,\n queryHook = _ref$queryHook === void 0 ? defaultQueryHook : _ref$queryHook;\n var _refine;\n var _clear;\n return {\n $$type: 'ais.searchBox',\n init: function init(initOptions) {\n var instantSearchInstance = initOptions.instantSearchInstance;\n renderFn(_objectSpread(_objectSpread({}, this.getWidgetRenderState(initOptions)), {}, {\n instantSearchInstance: instantSearchInstance\n }), true);\n },\n render: function render(renderOptions) {\n var instantSearchInstance = renderOptions.instantSearchInstance;\n renderFn(_objectSpread(_objectSpread({}, this.getWidgetRenderState(renderOptions)), {}, {\n instantSearchInstance: instantSearchInstance\n }), false);\n },\n dispose: function dispose(_ref2) {\n var state = _ref2.state;\n unmountFn();\n return state.setQueryParameter('query', undefined);\n },\n getRenderState: function getRenderState(renderState, renderOptions) {\n return _objectSpread(_objectSpread({}, renderState), {}, {\n searchBox: this.getWidgetRenderState(renderOptions)\n });\n },\n getWidgetRenderState: function getWidgetRenderState(_ref3) {\n var helper = _ref3.helper,\n searchMetadata = _ref3.searchMetadata,\n state = _ref3.state;\n if (!_refine) {\n _refine = function _refine(query) {\n queryHook(query, function (q) {\n return helper.setQuery(q).search();\n });\n };\n _clear = function _clear() {\n helper.setQuery('').search();\n };\n }\n return {\n query: state.query || '',\n refine: _refine,\n clear: _clear,\n widgetParams: widgetParams,\n isSearchStalled: searchMetadata.isSearchStalled\n };\n },\n getWidgetUiState: function getWidgetUiState(uiState, _ref4) {\n var searchParameters = _ref4.searchParameters;\n var query = searchParameters.query || '';\n if (query === '' || uiState && uiState.query === query) {\n return uiState;\n }\n return _objectSpread(_objectSpread({}, uiState), {}, {\n query: query\n });\n },\n getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref5) {\n var uiState = _ref5.uiState;\n return searchParameters.setQueryParameter('query', uiState.query || '');\n }\n };\n };\n};\nexport default connectSearchBox;","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nvar _excluded = [\"queryHook\", \"searchAsYouType\", \"translations\"];\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : \"undefined\" != typeof Symbol && arr[Symbol.iterator] || arr[\"@@iterator\"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\nimport React, { useRef, useState } from 'react';\nimport { useSearchBox } from 'react-instantsearch-core';\nimport { SearchBox as SearchBoxUiComponent } from \"../ui/SearchBox.js\";\nexport function SearchBox(_ref) {\n var queryHook = _ref.queryHook,\n _ref$searchAsYouType = _ref.searchAsYouType,\n searchAsYouType = _ref$searchAsYouType === void 0 ? true : _ref$searchAsYouType,\n translations = _ref.translations,\n props = _objectWithoutProperties(_ref, _excluded);\n var _useSearchBox = useSearchBox({\n queryHook: queryHook\n }, {\n $$widgetType: 'ais.searchBox'\n }),\n query = _useSearchBox.query,\n refine = _useSearchBox.refine,\n isSearchStalled = _useSearchBox.isSearchStalled;\n var _useState = useState(query),\n _useState2 = _slicedToArray(_useState, 2),\n inputValue = _useState2[0],\n setInputValue = _useState2[1];\n var inputRef = useRef(null);\n function setQuery(newQuery) {\n setInputValue(newQuery);\n if (searchAsYouType) {\n refine(newQuery);\n }\n }\n function onReset() {\n setQuery('');\n if (!searchAsYouType) {\n refine('');\n }\n }\n function onChange(event) {\n setQuery(event.currentTarget.value);\n }\n function onSubmit(event) {\n if (!searchAsYouType) {\n refine(inputValue);\n }\n if (props.onSubmit) {\n props.onSubmit(event);\n }\n }\n\n // Track when the InstantSearch query changes to synchronize it with\n // the React state.\n // We bypass the state update if the input is focused to avoid concurrent\n // updates when typing.\n if (query !== inputValue && document.activeElement !== inputRef.current) {\n setInputValue(query);\n }\n var uiProps = {\n inputRef: inputRef,\n isSearchStalled: isSearchStalled,\n onChange: onChange,\n onReset: onReset,\n onSubmit: onSubmit,\n value: inputValue,\n translations: _objectSpread({\n submitButtonTitle: 'Submit the search query',\n resetButtonTitle: 'Clear the search query'\n }, translations)\n };\n return /*#__PURE__*/React.createElement(SearchBoxUiComponent, _extends({}, props, uiProps));\n}","import connectSearchBox from \"instantsearch.js/es/connectors/search-box/connectSearchBox.js\";\nimport { useConnector } from \"../hooks/useConnector.js\";\nexport function useSearchBox(props, additionalWidgetProperties) {\n return useConnector(connectSearchBox, props, additionalWidgetProperties);\n}"],"names":["EventEmitter","this","_events","_maxListeners","undefined","isFunction","arg","isObject","isUndefined","module","exports","prototype","defaultMaxListeners","setMaxListeners","n","isNaN","TypeError","emit","type","er","handler","len","args","i","listeners","error","length","arguments","Error","err","context","call","Array","slice","apply","addListener","listener","m","newListener","push","warned","console","trace","on","once","fired","g","removeListener","list","position","splice","removeAllListeners","key","listenerCount","evlistener","emitter","AlgoliaSearchHelper","SearchParameters","SearchResults","algoliasearchHelper","client","index","opts","version","DerivedHelper","mainHelper","fn","main","lastResults","inherits","detach","detachDerivedHelper","getModifiedState","parameters","defaultsPure","objectHasKeys","omit","lib","addRefinement","refinementList","attribute","value","isRefined","valueAsString","facetRefinement","concat","mod","removeRefinement","clearRefinement","v","f","toggleRefinement","refinementType","hasChanged","newRefinementList","Object","keys","reduce","memo","values","facetList","filter","refinementValue","containsRefinements","Boolean","refinementValueAsString","indexOf","find","intersection","merge","valToNumber","isValidUserToken","RefinementList","isEqualNumericRefinement","a","b","isArray","every","el","newParameters","params","_parseNumbers","userToken","warn","facets","disjunctiveFacets","hierarchicalFacets","facetsRefinements","facetsExcludes","disjunctiveFacetsRefinements","numericRefinements","tagRefinements","hierarchicalFacetsRefinements","self","forEach","paramName","isKeyKnown","PARAMETERS","isValueDefined","partialState","numbers","k","parsedValue","parseFloat","insideBoundingBox","map","geoRect","operators","operator","parsedValues","vPrime","make","instance","facet","rootPath","currentRefinement","getHierarchicalRefinement","name","clearRefinements","toggleHierarchicalFacetRefinement","validate","currentState","tagFilters","numericFilters","constructor","patch","_clearNumericRefinements","setQueryParameters","clearTags","setIndex","setQuery","newQuery","query","setPage","newPage","page","setFacets","setDisjunctiveFacets","setHitsPerPage","hitsPerPage","setTypoTolerance","typoTolerance","addNumericRefinement","val","isNumericRefined","getConjunctiveRefinements","facetName","isConjunctiveFacet","getDisjunctiveRefinements","isDisjunctiveFacet","getExcludeRefinements","removeNumericRefinement","number","paramValue","op","getNumericRefinements","getNumericRefinement","newNumericRefinements","operatorList","outValues","addFacet","addDisjunctiveFacet","addHierarchicalFacet","hierarchicalFacet","isHierarchicalFacet","addFacetRefinement","addExcludeRefinement","addDisjunctiveFacetRefinement","addTagRefinement","tag","isTagRefined","modification","removeFacet","removeDisjunctiveFacet","removeHierarchicalFacet","removeFacetRefinement","removeExcludeRefinement","removeDisjunctiveFacetRefinement","removeTagRefinement","t","toggleFacetRefinement","toggleConjunctiveFacetRefinement","toggleDisjunctiveFacetRefinement","toggleExcludeFacetRefinement","separator","_getHierarchicalFacetSeparator","getHierarchicalFacetByName","lastIndexOf","addHierarchicalFacetRefinement","path","isHierarchicalFacetRefined","removeHierarchicalFacetRefinement","toggleTagRefinement","isFacetRefined","isExcludeRefined","isDisjunctiveFacetRefined","refinements","isOperatorDefined","array","searchedValue","isAttributeValueDefined","currentValue","getRefinedDisjunctiveFacets","disjunctiveNumericRefinedFacets","getRefinedHierarchicalFacets","sort","getUnrefinedDisjunctiveFacets","refinedFacets","managedParameters","getQueryParams","queryParams","setQueryParameter","parameter","nextWithNumbers","previousPlainObject","acc","nextPlainObject","previous","isPreviousValueDefined","isNextValueDefined","resetPage","_getHierarchicalFacetSortBy","sortBy","_getHierarchicalRootPath","_getHierarchicalShowParentLevel","showParentLevel","hierarchicalFacetName","getHierarchicalFacetBreadcrumb","refinement","split","part","trim","toString","JSON","stringify","state","hierarchicalFacetResult","hierarchicalFacetIndex","hierarchicalFacetRefinement","hierarchicalSeparator","hierarchicalRootPath","hierarchicalShowParentLevel","prepareHierarchicalFacetSortBy","rootExhaustive","facetResult","exhaustive","generateTreeFn","hierarchicalTree","currentHierarchicalLevel","parent","level","data","subtree","picked","facetValue","tuple","parentPath","onlyMatchingTree","orderBy","facetCount","parts","escapedValue","escapeFacetValue","count","format","unescapeFacetValue","generateHierarchicalTree","results","fv","compact","findIndex","formatSort","getIndices","attributes","indices","idx","assignFacetStats","dest","facetStats","stats","options","mainSubResponse","_rawResults","processingTimeMS","sum","result","facetsIndices","disjunctiveFacetsIndices","nextDisjunctiveResult","mainFacets","facetKey","hierarchicalAttributeName","facetValueObject","facetIndex","idxAttributeName","exhaustiveFacetsCount","isFacetDisjunctive","isFacetConjunctive","facets_stats","disjunctiveFacet","dfacet","facetResults","attributeIndex","dataFromMainRequest","refinedFacet","defaultData","root","excludes","_state","extractNormalizedFacetValues","predicate","isExcluded","hierarchicalFacetValues","replace","currentRefinementSplit","unshift","setIsRefined","item","depth","child","recSort","sortFn","node","names","children","childNode","sortedChildren","getFacetStatsIfAvailable","getRefinement","attributeName","resultsFacets","getFacetByName","DEFAULT_SORT","getFacetValues","facetValues","facetOrdering","renderingContent","getFacetOrdering","orderedFacets","remainingFacets","reverseOrder","order","ordering","sortRemainingBy","sortViaFacetOrdering","vanillaSortFn","getFacetStats","getRefinements","res","facetDeclaration","rootFacet","intermediateFacet","newFacet","numericValue","requestBuilder","addAlgoliaAgent","setClient","_queryId","_lastQueryIdReceived","derivedHelpers","_currentNbQueries","setCurrentPage","_change","isPageReset","getCurrentPage","search","_search","onlyWithDerivedHelpers","searchOnlyWithDerivedHelpers","getQuery","_getHitsSearchParams","searchOnce","cb","tempState","queries","_getQueries","then","content","_originalResponse","e","catch","findAnswers","derivedHelper","Promise","resolve","derivedState","attributesForPrediction","nbHits","errorMessage","initIndex","queryLanguages","searchForFacetValues","maxFacetHits","userState","clientHasSFFV","clientHasInitIndex","isDisjunctive","algoliaQuery","getSearchForFacetQuery","searchForFacetValuesPromise","indexName","response","facetHits","q","addDisjunctiveRefine","addRefine","addFacetExclusion","addExclude","addTag","removeDisjunctiveRefine","removeRefine","removeFacetExclusion","removeExclude","removeTag","toggleFacetExclusion","toggleExclude","toggleRefine","toggleTag","nextPage","previousPage","setState","newState","overrideStateWithoutTriggeringChangeEvent","hasRefinements","isDisjunctiveRefined","hasTag","hasTagRefinements","getIndex","getPage","getTags","r","states","mainQueries","queriesCount","helper","derivedQueries","derivedStateQueries","queryId","_dispatchAlgoliaResponse","bind","_dispatchAlgoliaError","s","specificResults","containsRefinement","facetFilters","_hasDisjunctiveRefinements","disjunctiveRefinements","event","clearCache","newClient","getClient","derive","pos","hasPendingRequests","reduceRight","source","String","comparator","defaults","defaultInstructions","out","sortInstruction","matchingDefault","defaultInstruction","ctor","superCtor","create","enumerable","writable","configurable","arr1","arr2","isObjectOrArrayOrFunction","_merge","target","hasOwnProperty","sourceVal","targetVal","l","obj","excluded","sourceKeys","compareAscending","other","valIsDefined","valIsNull","othIsDefined","othIsNull","collection","iteratees","orders","criteria","iteratee","object","sortObject","curr","_getDisjunctiveFacetSearchParams","filtersMap","segment","join","hasHierarchicalFacetFilter","some","filteredFacetFilters","facetFilter","filtered","filterValue","_getHitsHierarchicalFacetsAttributes","_getFacetFilters","_getNumericFilters","_getTagFilters","additionalParams","hierarchicalRootLevel","analytics","clickAnalytics","_getDisjunctiveHierarchicalFacetAttribute","vs","orFilters","attributeToRefine","attributesIndex","allAttributes","hierarchicalRefinement","newAttributes","rootLevel","parentLevel","stateForSearchForFacetValues","searchForFacetSearchParameters","facetQuery","test","percentTwenties","Format","formatters","RFC1738","RFC3986","parse","formats","utils","has","allowDots","allowPrototypes","arrayLimit","charset","charsetSentinel","comma","decoder","decode","delimiter","ignoreQueryPrefix","interpretNumericEntities","parameterLimit","parseArrays","plainObjects","strictNullHandling","str","$0","numberStr","fromCharCode","parseInt","parseArrayValue","parseKeys","givenKey","valuesParsed","exec","chain","leaf","cleanRoot","charAt","parseObject","isRegExp","normalizeParseOptions","tempObj","cleanStr","limit","Infinity","skipIndex","bracketEqualsPos","maybeMap","encodedVal","combine","parseValues","newObj","arrayPrefixGenerators","brackets","prefix","repeat","pushToArray","arr","valueOrArray","toISO","Date","toISOString","defaultFormat","addQueryPrefix","encode","encoder","encodeValuesOnly","formatter","serializeDate","date","skipNulls","generateArrayPrefix","isBuffer","keyValue","valuesArray","valuesJoined","objKeys","j","keyPrefix","normalizeStringifyOptions","arrayFormat","joined","hexTable","toUpperCase","arrayToObject","assign","queue","o","prop","refs","pop","compacted","compactQueue","strWithoutPlus","unescape","decodeURIComponent","defaultEncoder","kind","string","Symbol","escape","c","charCodeAt","mapped","mergeTarget","targetItem","is","useState","useEffect","useLayoutEffect","p","useDebugValue","getSnapshot","d","u","window","document","createElement","inst","useSyncExternalStore","checkRendering","rendering","usage","createDocumentationMessageGenerator","_len","widgets","_key","links","widget","_ref","_ref$connector","connector","message","_typeof","iterator","_extends","ownKeys","enumerableOnly","getOwnPropertySymbols","symbols","sym","getOwnPropertyDescriptor","_objectSpread","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","input","hint","prim","toPrimitive","Number","_toPrimitive","_toPropertyKey","TAG_PLACEHOLDER","highlightPreTag","highlightPostTag","TAG_REPLACEMENT","replaceTagsAndEscape","RegExp","recursiveEscape","escapeHits","hits","__escaped","hit","_objectDestructuringEmpty","_highlightResult","_snippetResult","escapeFacets","h","highlighted","htmlEntities","regexUnescapedHtml","regexHasUnescapedHtml","character","htmlCharacters","regexEscapedHtml","regexHasEscapedHtml","getHighlightedParts","highlightedValue","splitByPreTag","firstValue","shift","elements","isHighlighted","splitByPostTag","getPropertyByPath","current","isPlainObject","isObjectLike","getTag","getPrototypeOf","proto","_excluded","_objectWithoutProperties","_objectWithoutPropertiesLoose","sourceSymbolKeys","propertyIsEnumerable","mergeHierarchicalFacets","left","right","_","nextFacets","mergeSearchParameters","hierarchicalFacetsRefinementsMerged","mergeHierarchicalFacetsRefinements","tagRefinementsMerged","mergeTagRefinements","numericRefinementsMerged","mergeNumericRefinements","disjunctiveFacetsRefinementsMerged","mergeDisjunctiveFacetsRefinements","facetsExcludesMerged","mergeFacetsExcludes","facetRefinementsMerged","mergeFacetRefinements","disjunctiveFacetsMerged","mergeDisjunctiveFacets","ruleContextsMerged","ruleContexts","mergeRuleContexts","facetsMerged","mergeFacets","rest","mergeWithRest","noop","serializePayload","payload","btoa","encodeURIComponent","withUsage","getInitialSearchParameters","widgetParams","searchParameters","renderFn","unmountFn","connectorState","$$type","init","initOptions","instantSearchInstance","getWidgetRenderState","render","renderOptions","dispose","getRenderState","renderState","_renderState$configur","widgetRenderState","configure","_ref2","refine","actualState","nextSearchParameters","getWidgetSearchParameters","_ref3","uiState","getWidgetUiState","Configure","props","additionalWidgetProperties","useConnector","useConfigure","$$widgetType","ANONYMOUS_TOKEN_COOKIE_KEY","getInsightsAnonymousUserTokenInternal","cookie","cookies","substring","getCookie","safelyRunOnBrowser","callback","fallback","_slicedToArray","_arrayWithHoles","_i","_s","_e","_x","_r","_arr","_n","_d","next","done","return","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","_toConsumableArray","_arrayLikeToArray","_arrayWithoutHoles","iter","from","_iterableToArray","_nonIterableSpread","minLen","ALGOLIA_INSIGHTS_VERSION","ALGOLIA_INSIGHTS_SRC","isModernInsightsClient","_split$map2","major","minor","createInitArgs","getHelper","templatesConfig","createURL","scopedResults","searchMetadata","isSearchStalled","status","createRenderArgs","getResults","getScopedResults","extractWidgetPayload","mainIndex","_initialUiState","widgetType","getWidgets","createMetadataMiddleware","_ref2$$$internal","$$internal","payloadContainer","refNode","querySelector","onStateChange","subscribe","setTimeout","ua","transporter","userAgent","_ua","middleware","internal","appendChild","started","unsubscribe","remove","_defineProperties","descriptor","setWindowTitle","title","BrowserHistory","_this","windowTitle","_ref$writeDelay","writeDelay","parseURL","getLocation","start","Constructor","_classCallCheck","writeTimer","_createURL","_start","_dispose","_push","read","latestAcknowledgedHistory","history","protoProps","staticProps","qsModule","location","routeState","_this2","url","clearTimeout","shouldWrite","pushState","inPopState","_this3","_onPopState","_ref4","addEventListener","_this4","isDisposed","_ref5","removeEventListener","write","_this5","_ref6","lastPushWasByISAfterDispose","href","getIndexStateWithoutConfigure","isPrimitive","isEqual","first","second","_Object$keys","createRouterMiddleware","_props$router","router","_ref7","_ref7$createURL","_ref8","protocol","hostname","_location$port","port","pathname","hash","queryString","portWithPrefix","_ref7$parseURL","_ref9","_ref7$writeDelay","_ref7$getLocation","_ref10","historyRouter","_props$stateMapping","stateMapping","stateToRoute","indexId","routeToState","_props$$$internal","nextState","previousUiState","route","lastRouteState","initialUiState","onUpdate","setUiState","_router$start","isIndexWidget","privateHelperSetState","_uiState","getLocalWidgetsUiState","widgetStateOptions","getWidgetState","getLocalWidgetsSearchParameters","widgetSearchParametersOptions","initialSearchParameters","resetPageFromWidgets","indexWidgets","widgetHelper","resolveScopedResultsFromWidgets","getIndexId","_widgetParams$indexId","localWidgets","localUiState","localInstantSearchInstance","localParent","lastValidSearchParameters","getIndexName","_derivedHelper","getPreviousState","widgetParent","getParent","addWidgets","storeRenderState","scheduleSearch","removeWidgets","_nextState","_instantSearchInstanc","searchWithoutTriggeringOnStateChange","resolveSearchParameters","indexInitialResults","_initialResults","scheduleStalledRender","scheduleRender","onInternalStateChange","widgetsToRender","_helper","_derivedHelper2","innerIndex","refreshUiState","setIndexUiState","indexUiState","nextIndexUiState","parentIndexName","component","componentName","descendantName","modifierName","descendent","modifier","suit","concatHighlightedParts","hasAlphanumeric","getHighlightFromSiblings","_parts","_parts2","isNextHighlighted","isPreviousHighlighted","reverseHighlightedParts","method","serializedPayload","writeDataAttributes","hoganHelpers","numberLocale","formatNumber","toLocaleString","highlight","_ref$highlightedTagNa","highlightedTagName","_ref$cssClasses","cssClasses","_ref2$value","attributeValue","className","reverseHighlight","snippet","reverseSnippet","insights","_JSON$parse","objectIDs","objectID","nextMicroTask","defer","progress","cancelled","wait","cancel","setIndexHelperState","finalUiState","indexWidget","_setPrototypeOf","setPrototypeOf","__proto__","_createSuper","Derived","hasNativeReflectConstruct","Reflect","construct","sham","Proxy","valueOf","_isNativeReflectConstruct","Super","_getPrototypeOf","NewTarget","_assertThisInitialized","_possibleConstructorReturn","ReferenceError","defaultCreateURL","InstantSearch","_EventEmitter","subClass","superClass","_inherits","_super","_this$mainHelper","shouldResetStatus","_searchStalledTimer","nextUiState","_options$indexName","_options$initialUiSta","_options$routing","routing","_options$insights","searchFunction","_options$stalledSearc","stalledSearchDelay","_options$searchClient","searchClient","_options$insightsClie","insightsClient","_options$onStateChang","helpers","compileOptions","_stalledSearchDelay","_searchFunction","sendEventToInsights","routerOptions","use","insightsOptions","_insightsClient","insightsInitParams","onEvent","potentialInsightsClient","pointer","AlgoliaAnalyticsObject","shouldAddScript","existingInsightsMiddlewares","creator","unuse","initialParameters","_getAppIdAndApiKey2","_searchClient$transpo","headers","queryParameters","APP_ID","API_KEY","applicationID","apiKey","getAppIdAndApiKey","appId","queuedUserToken","userTokenBeforeInit","items","reverse","_error","partial","script","async","src","onerror","body","cause","setUserTokenToSearch","immediate","existingToken","applyToken","anonymousUserToken","insightsClientWithLocalCredentials","insightsMethod","algoliaSource","eventModifier","createInsightsMiddleware","_window$navigator","_window$navigator$use","navigator","get","newMiddlewareList","newMiddleware","_len2","middlewareToUnuse","_key2","includes","fakeClient","_mainHelperSearch","mainIndexHelper","searchFunctionHelper","originalScheduleSearch","_this$mainHelper2","callOnStateChange","InstantSearchSSRContext","createContext","defaultUserAgents","serverUserAgent","nextUserAgent","nextVersion","useInstantSearchApi","_next","_process$env","forceUpdate","useReducer","x","serverContext","useInstantSearchServerContext","serverState","useContext","initialResults","prevPropsRef","useRef","searchRef","ssrSearchRef","_schedule","timer","addAlgoliaAgents","process","NEXT_RUNTIME","notifyServer","_props$stalledSearchD","prevProps","cleanupTimerRef","store","useCallback","_preventWidgetCleanup","userAgents","InstantSearchContext","Provider","IndexContext","_buildEventPayloadsForHits","methodName","_args$0$split2","eventType","eventName","hitsArray","queryID","__queryID","hitsChunks","chunkSize","chunks","Math","ceil","chunk","objectIDsByChunk","batch","positionsByChunk","__position","positions","sendEvent","bindEvent","_ref$escapeHTML","escapeHTML","_ref$transformItems","transformItems","sentEvents","createSendEventForHits","payloads","createBindEventForHits","hitsWithAbsolutePositionAndQueryID","addQueryID","useHits","dequal","foo","bar","compare","getTime","useStableValue","_useState2","stableValue","setStableValue","_excluded2","useInstantSearchContext","parentIndex","useIndexContext","stableProps","stableAdditionalWidgetProperties","shouldSetStateRef","previousRenderStateRef","previousStatusRef","useMemo","isFirstRender","Function","createWidget","_widget$getWidgetSear","_getIndexSearchResult","getIndexSearchResults","_widget$getWidgetRend","shouldSsr","prevWidgetRef","shouldAddWidgetEarly","useIsomorphicLayoutEffect","previousWidget","useWidget","createSearchResults","_state$query","_state$page","_state$hitsPerPage","nbPages","exhaustiveNbHits","__isArtificial","scopedResult","fallbackResults","invariant","condition","InstantSearchServerContext","DefaultSubmitIcon","classNames","cx","submitIcon","width","height","viewBox","DefaultResetIcon","resetIcon","fill","fillRule","transform","strokeWidth","strokeOpacity","cy","to","dur","repeatCount","DefaultLoadingIcon","stroke","loadingIcon","SearchBox","formRef","inputRef","onChange","onReset","onSubmit","placeholder","autoFocus","_ref7$resetIconCompon","resetIconComponent","ResetIcon","_ref7$submitIconCompo","submitIconComponent","SubmitIcon","_ref7$loadingIconComp","loadingIconComponent","LoadingIcon","_ref7$classNames","translations","ref","action","form","noValidate","preventDefault","stopPropagation","blur","focus","autoComplete","autoCorrect","autoCapitalize","spellCheck","maxLength","submit","submitButtonTitle","reset","resetButtonTitle","hidden","loadingIndicator","defaultQueryHook","hook","_refine","_clear","_ref$queryHook","queryHook","searchBox","clear","_ref$searchAsYouType","searchAsYouType","_useSearchBox","useSearchBox","inputValue","setInputValue","activeElement","uiProps","currentTarget"],"sourceRoot":""}