{"version":3,"file":"Connectors.min.js","sources":["../../../../node_modules/@babel/runtime/helpers/esm/extends.js","../../../../node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js","../../../../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js","../../../../node_modules/@babel/runtime/helpers/esm/defineProperty.js","../../../../node_modules/@babel/runtime/helpers/esm/objectSpread.js","../../../../node_modules/@babel/runtime/helpers/esm/createClass.js","../../../../node_modules/@babel/runtime/helpers/esm/typeof.js","../../../../node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js","../../../../node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js","../../../../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","../../../../node_modules/react-fast-compare/index.js","../../../react-instantsearch-core/dist/es/core/utils.js","../../../react-instantsearch-core/dist/es/core/context.js","../../../react-instantsearch-core/dist/es/core/createConnector.js","../../../../node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js","../../../../node_modules/@babel/runtime/helpers/esm/classCallCheck.js","../../../../node_modules/@babel/runtime/helpers/esm/inherits.js","../../../react-instantsearch-core/dist/es/core/highlight.js","../../../react-instantsearch-core/dist/es/core/indexUtils.js","../../../react-instantsearch-core/dist/es/connectors/connectConfigure.js","../../../../node_modules/rollup-plugin-node-globals/src/global.js","../../../../node_modules/process-es6/browser.js","../../../../node_modules/@babel/runtime/helpers/esm/toConsumableArray.js","../../../../node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js","../../../../node_modules/@babel/runtime/helpers/esm/iterableToArray.js","../../../../node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js","../../../../node_modules/algoliasearch-helper/src/functions/merge.js","../../../../node_modules/algoliasearch-helper/src/functions/defaultsPure.js","../../../../node_modules/algoliasearch-helper/src/functions/intersection.js","../../../../node_modules/algoliasearch-helper/src/functions/find.js","../../../../node_modules/algoliasearch-helper/src/functions/valToNumber.js","../../../../node_modules/algoliasearch-helper/src/functions/omit.js","../../../../node_modules/algoliasearch-helper/src/functions/objectHasKeys.js","../../../../node_modules/algoliasearch-helper/src/SearchParameters/RefinementList.js","../../../../node_modules/algoliasearch-helper/src/SearchParameters/index.js","../../../../node_modules/algoliasearch-helper/src/functions/orderBy.js","../../../../node_modules/algoliasearch-helper/src/functions/compact.js","../../../../node_modules/algoliasearch-helper/src/functions/findIndex.js","../../../../node_modules/algoliasearch-helper/src/functions/formatSort.js","../../../../node_modules/algoliasearch-helper/src/SearchResults/generate-hierarchical-tree.js","../../../../node_modules/algoliasearch-helper/src/SearchResults/index.js","../../../../node_modules/events/events.js","../../../../node_modules/algoliasearch-helper/src/functions/inherits.js","../../../../node_modules/algoliasearch-helper/src/DerivedHelper/index.js","../../../../node_modules/algoliasearch-helper/src/requestBuilder.js","../../../../node_modules/algoliasearch-helper/src/version.js","../../../../node_modules/algoliasearch-helper/src/algoliasearch.helper.js","../../../../node_modules/algoliasearch-helper/index.js","../../../react-instantsearch-core/dist/es/connectors/connectConfigureRelatedItems.js","../../../../node_modules/object-assign/index.js","../../../../node_modules/prop-types/factoryWithThrowingShims.js","../../../../node_modules/prop-types/index.js","../../../../node_modules/prop-types/lib/ReactPropTypesSecret.js","../../../react-instantsearch-core/dist/es/connectors/connectAutoComplete.js","../../../react-instantsearch-core/dist/es/connectors/connectBreadcrumb.js","../../../react-instantsearch-core/dist/es/connectors/connectCurrentRefinements.js","../../../react-instantsearch-core/dist/es/connectors/connectGeoSearch.js","../../../react-instantsearch-core/dist/es/connectors/connectHierarchicalMenu.js","../../../react-instantsearch-core/dist/es/connectors/connectHighlight.js","../../../react-instantsearch-core/dist/es/connectors/connectHits.js","../../../react-instantsearch-core/dist/es/connectors/connectHitsPerPage.js","../../../react-instantsearch-core/dist/es/connectors/connectInfiniteHits.js","../../../react-instantsearch-core/dist/es/connectors/connectMenu.js","../../../../node_modules/@babel/runtime/helpers/esm/slicedToArray.js","../../../../node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js","../../../../node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js","../../../../node_modules/@babel/runtime/helpers/esm/nonIterableRest.js","../../../react-instantsearch-core/dist/es/connectors/connectNumericMenu.js","../../../react-instantsearch-core/dist/es/connectors/connectPagination.js","../../../react-instantsearch-core/dist/es/connectors/connectPoweredBy.js","../../../react-instantsearch-core/dist/es/connectors/connectRange.js","../../../react-instantsearch-core/dist/es/connectors/connectRefinementList.js","../../../react-instantsearch-core/dist/es/connectors/connectScrollTo.js","../../../react-instantsearch-core/dist/es/connectors/connectSearchBox.js","../../../react-instantsearch-core/dist/es/connectors/connectSortBy.js","../../../react-instantsearch-core/dist/es/connectors/connectStateResults.js","../../../react-instantsearch-core/dist/es/connectors/connectStats.js","../../../react-instantsearch-core/dist/es/connectors/connectToggleRefinement.js","../../../react-instantsearch-core/dist/es/connectors/connectHitInsights.js"],"sourcesContent":["export default function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}","import objectWithoutPropertiesLoose from \"./objectWithoutPropertiesLoose\";\nexport default function _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}","export default function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}","export default function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}","import defineProperty from \"./defineProperty\";\nexport default function _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n var ownKeys = Object.keys(source);\n\n if (typeof Object.getOwnPropertySymbols === 'function') {\n ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {\n return Object.getOwnPropertyDescriptor(source, sym).enumerable;\n }));\n }\n\n ownKeys.forEach(function (key) {\n defineProperty(target, key, source[key]);\n });\n }\n\n return target;\n}","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nexport default function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}","function _typeof2(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof2(obj); }\n\nexport default function _typeof(obj) {\n if (typeof Symbol === \"function\" && _typeof2(Symbol.iterator) === \"symbol\") {\n _typeof = function _typeof(obj) {\n return _typeof2(obj);\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : _typeof2(obj);\n };\n }\n\n return _typeof(obj);\n}","export default function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}","export default function _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","/* global Map:readonly, Set:readonly, ArrayBuffer:readonly */\n\nvar hasElementType = typeof Element !== 'undefined';\nvar hasMap = typeof Map === 'function';\nvar hasSet = typeof Set === 'function';\nvar hasArrayBuffer = typeof ArrayBuffer === 'function';\n\n// Note: We **don't** need `envHasBigInt64Array` in fde es6/index.js\n\nfunction equal(a, b) {\n // START: fast-deep-equal es6/index.js 3.1.1\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) return false;\n\n var length, i, keys;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (!equal(a[i], b[i])) return false;\n return true;\n }\n\n // START: Modifications:\n // 1. Extra `has &&` helpers in initial condition allow es6 code\n // to co-exist with es5.\n // 2. Replace `for of` with es5 compliant iteration using `for`.\n // Basically, take:\n //\n // ```js\n // for (i of a.entries())\n // if (!b.has(i[0])) return false;\n // ```\n //\n // ... and convert to:\n //\n // ```js\n // it = a.entries();\n // while (!(i = it.next()).done)\n // if (!b.has(i.value[0])) return false;\n // ```\n //\n // **Note**: `i` access switches to `i.value`.\n var it;\n if (hasMap && (a instanceof Map) && (b instanceof Map)) {\n if (a.size !== b.size) return false;\n it = a.entries();\n while (!(i = it.next()).done)\n if (!b.has(i.value[0])) return false;\n it = a.entries();\n while (!(i = it.next()).done)\n if (!equal(i.value[1], b.get(i.value[0]))) return false;\n return true;\n }\n\n if (hasSet && (a instanceof Set) && (b instanceof Set)) {\n if (a.size !== b.size) return false;\n it = a.entries();\n while (!(i = it.next()).done)\n if (!b.has(i.value[0])) return false;\n return true;\n }\n // END: Modifications\n\n if (hasArrayBuffer && ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (a[i] !== b[i]) return false;\n return true;\n }\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();\n\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\n // END: fast-deep-equal\n\n // START: react-fast-compare\n // custom handling for DOM elements\n if (hasElementType && a instanceof Element) return false;\n\n // custom handling for React\n for (i = length; i-- !== 0;) {\n if (keys[i] === '_owner' && a.$$typeof) {\n // React-specific: avoid traversing React elements' _owner.\n // _owner contains circular references\n // and is not needed when comparing the actual elements (and not their owners)\n // .$$typeof and ._store on just reasonable markers of a react element\n continue;\n }\n\n // all other properties should be traversed as usual\n if (!equal(a[keys[i]], b[keys[i]])) return false;\n }\n // END: react-fast-compare\n\n // START: fast-deep-equal\n return true;\n }\n\n return a !== a && b !== b;\n}\n// end fast-deep-equal\n\nmodule.exports = function isEqual(a, b) {\n try {\n return equal(a, b);\n } catch (error) {\n if (((error.message || '').match(/stack|recursion/i))) {\n // warn on circular references, don't crash\n // browsers give this different errors name and messages:\n // chrome/safari: \"RangeError\", \"Maximum call stack size exceeded\"\n // firefox: \"InternalError\", too much recursion\"\n // edge: \"Error\", \"Out of stack space\"\n console.warn('react-fast-compare cannot handle circular refs');\n return false;\n }\n // some other error. we should definitely know about these\n throw error;\n }\n};\n","import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread\";\nimport _typeof from \"@babel/runtime/helpers/esm/typeof\";\n// From https://github.com/reactjs/react-redux/blob/master/src/utils/shallowEqual.js\nexport var shallowEqual = function shallowEqual(objA, objB) {\n if (objA === objB) {\n return true;\n }\n\n var keysA = Object.keys(objA);\n var keysB = Object.keys(objB);\n\n if (keysA.length !== keysB.length) {\n return false;\n } // Test for A's keys different from B.\n\n\n var hasOwn = Object.prototype.hasOwnProperty;\n\n for (var i = 0; i < keysA.length; i++) {\n if (!hasOwn.call(objB, keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {\n return false;\n }\n }\n\n return true;\n};\nexport var getDisplayName = function getDisplayName(Component) {\n return Component.displayName || Component.name || 'UnknownComponent';\n};\nvar resolved = Promise.resolve();\nexport var defer = function defer(f) {\n resolved.then(f);\n};\n\nvar isPlainObject = function isPlainObject(value) {\n return _typeof(value) === 'object' && value !== null && !Array.isArray(value);\n};\n\nexport var removeEmptyKey = function removeEmptyKey(obj) {\n Object.keys(obj).forEach(function (key) {\n var value = obj[key];\n\n if (!isPlainObject(value)) {\n return;\n }\n\n if (!objectHasKeys(value)) {\n delete obj[key];\n } else {\n removeEmptyKey(value);\n }\n });\n return obj;\n};\nexport var removeEmptyArraysFromObject = function removeEmptyArraysFromObject(obj) {\n Object.keys(obj).forEach(function (key) {\n var value = obj[key];\n\n if (Array.isArray(value) && value.length === 0) {\n delete obj[key];\n }\n });\n return obj;\n};\nexport function addAbsolutePositions(hits, hitsPerPage, page) {\n return hits.map(function (hit, index) {\n return _objectSpread({}, hit, {\n __position: hitsPerPage * page + index + 1\n });\n });\n}\nexport function addQueryID(hits, queryID) {\n if (!queryID) {\n return hits;\n }\n\n return hits.map(function (hit) {\n return _objectSpread({}, hit, {\n __queryID: queryID\n });\n });\n}\nexport 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}\nexport function objectHasKeys(object) {\n return object && Object.keys(object).length > 0;\n} // https://github.com/babel/babel/blob/3aaafae053fa75febb3aa45d45b6f00646e30ba4/packages/babel-helpers/src/helpers.js#L604-L620\n\nexport function omit(source, excluded) {\n if (source === null || source === undefined) {\n return {};\n }\n\n var target = {};\n var sourceKeys = Object.keys(source);\n\n for (var i = 0; i < sourceKeys.length; i++) {\n var _key = sourceKeys[i];\n\n if (excluded.indexOf(_key) >= 0) {\n // eslint-disable-next-line no-continue\n continue;\n }\n\n target[_key] = source[_key];\n }\n\n return target;\n}\n/**\n * Retrieve the value at a path of the object:\n *\n * @example\n * getPropertyByPath(\n * { test: { this: { function: [{ now: { everyone: true } }] } } },\n * 'test.this.function[0].now.everyone'\n * ); // true\n *\n * getPropertyByPath(\n * { test: { this: { function: [{ now: { everyone: true } }] } } },\n * ['test', 'this', 'function', 0, 'now', 'everyone']\n * ); // true\n *\n * @param object Source object to query\n * @param path either an array of properties, or a string form of the properties, separated by .\n */\n\nexport var getPropertyByPath = function getPropertyByPath(object, path) {\n return (Array.isArray(path) ? path : path.replace(/\\[(\\d+)]/g, '.$1').split('.')).reduce(function (current, key) {\n return current ? current[key] : undefined;\n }, object);\n};\nexport function getObjectType(object) {\n return Object.prototype.toString.call(object).slice(8, -1);\n}","import { createContext } from 'react';\n\nvar _createContext = createContext({\n onInternalStateUpdate: function onInternalStateUpdate() {\n return undefined;\n },\n createHrefForState: function createHrefForState() {\n return '#';\n },\n onSearchForFacetValues: function onSearchForFacetValues() {\n return undefined;\n },\n onSearchStateChange: function onSearchStateChange() {\n return undefined;\n },\n onSearchParameters: function onSearchParameters() {\n return undefined;\n },\n store: {},\n widgetsManager: {},\n mainTargetedIndex: ''\n}),\n InstantSearchConsumer = _createContext.Consumer,\n InstantSearchProvider = _createContext.Provider;\n\nexport { InstantSearchConsumer, InstantSearchProvider };\n\nvar _createContext2 = createContext(undefined),\n IndexConsumer = _createContext2.Consumer,\n IndexProvider = _createContext2.Provider;\n\nexport { IndexConsumer, IndexProvider };","import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread\";\nimport _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _possibleConstructorReturn from \"@babel/runtime/helpers/esm/possibleConstructorReturn\";\nimport _getPrototypeOf from \"@babel/runtime/helpers/esm/getPrototypeOf\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport React, { Component } from 'react';\nimport isEqual from 'react-fast-compare';\nimport { shallowEqual, getDisplayName, removeEmptyKey } from './utils';\nimport { InstantSearchConsumer, IndexConsumer } from './context';\n\n/**\n * Connectors are the HOC used to transform React components\n * into InstantSearch widgets.\n * In order to simplify the construction of such connectors\n * `createConnector` takes a description and transform it into\n * a connector.\n * @param {ConnectorDescription} connectorDesc the description of the connector\n * @return {Connector} a function that wraps a component into\n * an instantsearch connected one.\n */\nexport function createConnectorWithoutContext(connectorDesc) {\n if (!connectorDesc.displayName) {\n throw new Error('`createConnector` requires you to provide a `displayName` property.');\n }\n\n var isWidget = typeof connectorDesc.getSearchParameters === 'function' || typeof connectorDesc.getMetadata === 'function' || typeof connectorDesc.transitionState === 'function';\n return function (Composed) {\n var Connector =\n /*#__PURE__*/\n function (_Component) {\n _inherits(Connector, _Component);\n\n function Connector(props) {\n var _this;\n\n _classCallCheck(this, Connector);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(Connector).call(this, props));\n\n _defineProperty(_assertThisInitialized(_this), \"unsubscribe\", void 0);\n\n _defineProperty(_assertThisInitialized(_this), \"unregisterWidget\", void 0);\n\n _defineProperty(_assertThisInitialized(_this), \"isUnmounting\", false);\n\n _defineProperty(_assertThisInitialized(_this), \"state\", {\n providedProps: _this.getProvidedProps(_this.props)\n });\n\n _defineProperty(_assertThisInitialized(_this), \"refine\", function () {\n var _ref;\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this.props.contextValue.onInternalStateUpdate( // refine will always be defined here because the prop is only given conditionally\n (_ref = connectorDesc.refine).call.apply(_ref, [_assertThisInitialized(_this), _this.props, _this.props.contextValue.store.getState().widgets].concat(args)));\n });\n\n _defineProperty(_assertThisInitialized(_this), \"createURL\", function () {\n var _ref2;\n\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n return _this.props.contextValue.createHrefForState( // refine will always be defined here because the prop is only given conditionally\n (_ref2 = connectorDesc.refine).call.apply(_ref2, [_assertThisInitialized(_this), _this.props, _this.props.contextValue.store.getState().widgets].concat(args)));\n });\n\n _defineProperty(_assertThisInitialized(_this), \"searchForFacetValues\", function () {\n var _ref3;\n\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n\n _this.props.contextValue.onSearchForFacetValues( // searchForFacetValues will always be defined here because the prop is only given conditionally\n (_ref3 = connectorDesc.searchForFacetValues).call.apply(_ref3, [_assertThisInitialized(_this), _this.props, _this.props.contextValue.store.getState().widgets].concat(args)));\n });\n\n if (connectorDesc.getSearchParameters) {\n _this.props.contextValue.onSearchParameters(connectorDesc.getSearchParameters.bind(_assertThisInitialized(_this)), {\n ais: _this.props.contextValue,\n multiIndexContext: _this.props.indexContextValue\n }, _this.props);\n }\n\n return _this;\n }\n\n _createClass(Connector, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n var _this2 = this;\n\n this.unsubscribe = this.props.contextValue.store.subscribe(function () {\n if (!_this2.isUnmounting) {\n _this2.setState({\n providedProps: _this2.getProvidedProps(_this2.props)\n });\n }\n });\n\n if (isWidget) {\n this.unregisterWidget = this.props.contextValue.widgetsManager.registerWidget(this);\n }\n }\n }, {\n key: \"shouldComponentUpdate\",\n value: function shouldComponentUpdate(nextProps, nextState) {\n if (typeof connectorDesc.shouldComponentUpdate === 'function') {\n return connectorDesc.shouldComponentUpdate.call(this, this.props, nextProps, this.state, nextState);\n }\n\n var propsEqual = shallowEqual(this.props, nextProps);\n\n if (this.state.providedProps === null || nextState.providedProps === null) {\n if (this.state.providedProps === nextState.providedProps) {\n return !propsEqual;\n }\n\n return true;\n }\n\n return !propsEqual || !shallowEqual(this.state.providedProps, nextState.providedProps);\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(prevProps) {\n if (!isEqual(prevProps, this.props)) {\n this.setState({\n providedProps: this.getProvidedProps(this.props)\n });\n\n if (isWidget) {\n this.props.contextValue.widgetsManager.update();\n\n if (typeof connectorDesc.transitionState === 'function') {\n this.props.contextValue.onSearchStateChange(connectorDesc.transitionState.call(this, this.props, this.props.contextValue.store.getState().widgets, this.props.contextValue.store.getState().widgets));\n }\n }\n }\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n this.isUnmounting = true;\n\n if (this.unsubscribe) {\n this.unsubscribe();\n }\n\n if (this.unregisterWidget) {\n this.unregisterWidget();\n\n if (typeof connectorDesc.cleanUp === 'function') {\n var nextState = connectorDesc.cleanUp.call(this, this.props, this.props.contextValue.store.getState().widgets);\n this.props.contextValue.store.setState(_objectSpread({}, this.props.contextValue.store.getState(), {\n widgets: nextState\n }));\n this.props.contextValue.onSearchStateChange(removeEmptyKey(nextState));\n }\n }\n }\n }, {\n key: \"getProvidedProps\",\n value: function getProvidedProps(props) {\n var _this$props$contextVa = this.props.contextValue.store.getState(),\n widgets = _this$props$contextVa.widgets,\n results = _this$props$contextVa.results,\n resultsFacetValues = _this$props$contextVa.resultsFacetValues,\n searching = _this$props$contextVa.searching,\n searchingForFacetValues = _this$props$contextVa.searchingForFacetValues,\n isSearchStalled = _this$props$contextVa.isSearchStalled,\n metadata = _this$props$contextVa.metadata,\n error = _this$props$contextVa.error;\n\n var searchResults = {\n results: results,\n searching: searching,\n searchingForFacetValues: searchingForFacetValues,\n isSearchStalled: isSearchStalled,\n error: error\n };\n return connectorDesc.getProvidedProps.call(this, props, widgets, searchResults, metadata, // @MAJOR: move this attribute on the `searchResults` it doesn't\n // makes sense to have it into a separate argument. The search\n // flags are on the object why not the results?\n resultsFacetValues);\n }\n }, {\n key: \"getSearchParameters\",\n value: function getSearchParameters(searchParameters) {\n if (typeof connectorDesc.getSearchParameters === 'function') {\n return connectorDesc.getSearchParameters.call(this, searchParameters, this.props, this.props.contextValue.store.getState().widgets);\n }\n\n return null;\n }\n }, {\n key: \"getMetadata\",\n value: function getMetadata(nextWidgetsState) {\n if (typeof connectorDesc.getMetadata === 'function') {\n return connectorDesc.getMetadata.call(this, this.props, nextWidgetsState);\n }\n\n return {};\n }\n }, {\n key: \"transitionState\",\n value: function transitionState(prevWidgetsState, nextWidgetsState) {\n if (typeof connectorDesc.transitionState === 'function') {\n return connectorDesc.transitionState.call(this, this.props, prevWidgetsState, nextWidgetsState);\n }\n\n return nextWidgetsState;\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this$props = this.props,\n contextValue = _this$props.contextValue,\n props = _objectWithoutProperties(_this$props, [\"contextValue\"]);\n\n var providedProps = this.state.providedProps;\n\n if (providedProps === null) {\n return null;\n }\n\n var refineProps = typeof connectorDesc.refine === 'function' ? {\n refine: this.refine,\n createURL: this.createURL\n } : {};\n var searchForFacetValuesProps = typeof connectorDesc.searchForFacetValues === 'function' ? {\n searchForItems: this.searchForFacetValues\n } : {};\n return React.createElement(Composed, _extends({}, props, providedProps, refineProps, searchForFacetValuesProps));\n }\n }]);\n\n return Connector;\n }(Component);\n\n _defineProperty(Connector, \"displayName\", \"\".concat(connectorDesc.displayName, \"(\").concat(getDisplayName(Composed), \")\"));\n\n _defineProperty(Connector, \"propTypes\", connectorDesc.propTypes);\n\n _defineProperty(Connector, \"defaultProps\", connectorDesc.defaultProps);\n\n return Connector;\n };\n}\n\nvar createConnectorWithContext = function createConnectorWithContext(connectorDesc) {\n return function (Composed) {\n var Connector = createConnectorWithoutContext(connectorDesc)(Composed);\n\n var ConnectorWrapper = function ConnectorWrapper(props) {\n return React.createElement(InstantSearchConsumer, null, function (contextValue) {\n return React.createElement(IndexConsumer, null, function (indexContextValue) {\n return React.createElement(Connector, _extends({\n contextValue: contextValue,\n indexContextValue: indexContextValue\n }, props));\n });\n });\n };\n\n return ConnectorWrapper;\n };\n};\n\nexport default createConnectorWithContext;","import _typeof from \"../../helpers/esm/typeof\";\nimport assertThisInitialized from \"./assertThisInitialized\";\nexport default function _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}","export default function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}","import setPrototypeOf from \"./setPrototypeOf\";\nexport default function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}","import { getPropertyByPath } from './utils';\nexport var HIGHLIGHT_TAGS = {\n highlightPreTag: \"\",\n highlightPostTag: \"\"\n};\n/**\n * Parses an highlighted attribute into an array of objects with the string value, and\n * a boolean that indicated if this part is highlighted.\n *\n * @param {string} preTag - string used to identify the start of an highlighted value\n * @param {string} postTag - string used to identify the end of an highlighted value\n * @param {string} highlightedValue - highlighted attribute as returned by Algolia highlight feature\n * @return {object[]} - An array of {value: string, isHighlighted: boolean}.\n */\n\nfunction parseHighlightedAttribute(_ref) {\n var preTag = _ref.preTag,\n postTag = _ref.postTag,\n _ref$highlightedValue = _ref.highlightedValue,\n highlightedValue = _ref$highlightedValue === void 0 ? '' : _ref$highlightedValue;\n var splitByPreTag = highlightedValue.split(preTag);\n var firstValue = splitByPreTag.shift();\n var elements = firstValue === '' ? [] : [{\n value: firstValue,\n isHighlighted: false\n }];\n\n if (postTag === preTag) {\n var isHighlighted = true;\n splitByPreTag.forEach(function (split) {\n elements.push({\n value: split,\n isHighlighted: isHighlighted\n });\n isHighlighted = !isHighlighted;\n });\n } else {\n splitByPreTag.forEach(function (split) {\n var splitByPostTag = split.split(postTag);\n elements.push({\n value: splitByPostTag[0],\n isHighlighted: true\n });\n\n if (splitByPostTag[1] !== '') {\n elements.push({\n value: splitByPostTag[1],\n isHighlighted: false\n });\n }\n });\n }\n\n return elements;\n}\n/**\n * Find an highlighted attribute given an `attribute` and an `highlightProperty`, parses it,\n * and provided an array of objects with the string value and a boolean if this\n * value is highlighted.\n *\n * In order to use this feature, highlight must be activated in the configuration of\n * the index. The `preTag` and `postTag` attributes are respectively highlightPreTag and\n * highlightPostTag in Algolia configuration.\n *\n * @param {string} preTag - string used to identify the start of an highlighted value\n * @param {string} postTag - string used to identify the end of an highlighted value\n * @param {string} highlightProperty - the property that contains the highlight structure in the results\n * @param {string} attribute - the highlighted attribute to look for\n * @param {object} hit - the actual hit returned by Algolia.\n * @return {object[]} - An array of {value: string, isHighlighted: boolean}.\n */\n\n\nexport function parseAlgoliaHit(_ref2) {\n var _ref2$preTag = _ref2.preTag,\n preTag = _ref2$preTag === void 0 ? '' : _ref2$preTag,\n _ref2$postTag = _ref2.postTag,\n postTag = _ref2$postTag === void 0 ? '' : _ref2$postTag,\n highlightProperty = _ref2.highlightProperty,\n attribute = _ref2.attribute,\n hit = _ref2.hit;\n if (!hit) throw new Error('`hit`, the matching record, must be provided');\n var highlightObject = getPropertyByPath(hit[highlightProperty], attribute) || {};\n\n if (Array.isArray(highlightObject)) {\n return highlightObject.map(function (item) {\n return parseHighlightedAttribute({\n preTag: preTag,\n postTag: postTag,\n highlightedValue: item.value\n });\n });\n }\n\n return parseHighlightedAttribute({\n preTag: preTag,\n postTag: postTag,\n highlightedValue: highlightObject.value\n });\n}","import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread\";\nimport { omit } from './utils';\nexport function getIndexId(context) {\n return hasMultipleIndices(context) ? context.multiIndexContext.targetedIndex : context.ais.mainTargetedIndex;\n}\nexport function getResults(searchResults, context) {\n if (searchResults.results) {\n if (searchResults.results.hits) {\n return searchResults.results;\n }\n\n var indexId = getIndexId(context);\n\n if (searchResults.results[indexId]) {\n return searchResults.results[indexId];\n }\n }\n\n return null;\n}\nexport function hasMultipleIndices(context) {\n return context && context.multiIndexContext;\n} // eslint-disable-next-line max-params\n\nexport function refineValue(searchState, nextRefinement, context, resetPage, namespace) {\n if (hasMultipleIndices(context)) {\n var indexId = getIndexId(context);\n return namespace ? refineMultiIndexWithNamespace(searchState, nextRefinement, indexId, resetPage, namespace) : refineMultiIndex(searchState, nextRefinement, indexId, resetPage);\n } else {\n // When we have a multi index page with shared widgets we should also\n // reset their page to 1 if the resetPage is provided. Otherwise the\n // indices will always be reset\n // see: https://github.com/algolia/react-instantsearch/issues/310\n // see: https://github.com/algolia/react-instantsearch/issues/637\n if (searchState.indices && resetPage) {\n Object.keys(searchState.indices).forEach(function (targetedIndex) {\n searchState = refineValue(searchState, {\n page: 1\n }, {\n multiIndexContext: {\n targetedIndex: targetedIndex\n }\n }, true, namespace);\n });\n }\n\n return namespace ? refineSingleIndexWithNamespace(searchState, nextRefinement, resetPage, namespace) : refineSingleIndex(searchState, nextRefinement, resetPage);\n }\n}\n\nfunction refineMultiIndex(searchState, nextRefinement, indexId, resetPage) {\n var page = resetPage ? {\n page: 1\n } : undefined;\n var state = searchState.indices && searchState.indices[indexId] ? _objectSpread({}, searchState.indices, _defineProperty({}, indexId, _objectSpread({}, searchState.indices[indexId], nextRefinement, page))) : _objectSpread({}, searchState.indices, _defineProperty({}, indexId, _objectSpread({}, nextRefinement, page)));\n return _objectSpread({}, searchState, {\n indices: state\n });\n}\n\nfunction refineSingleIndex(searchState, nextRefinement, resetPage) {\n var page = resetPage ? {\n page: 1\n } : undefined;\n return _objectSpread({}, searchState, nextRefinement, page);\n} // eslint-disable-next-line max-params\n\n\nfunction refineMultiIndexWithNamespace(searchState, nextRefinement, indexId, resetPage, namespace) {\n var _objectSpread4;\n\n var page = resetPage ? {\n page: 1\n } : undefined;\n var state = searchState.indices && searchState.indices[indexId] ? _objectSpread({}, searchState.indices, _defineProperty({}, indexId, _objectSpread({}, searchState.indices[indexId], (_objectSpread4 = {}, _defineProperty(_objectSpread4, namespace, _objectSpread({}, searchState.indices[indexId][namespace], nextRefinement)), _defineProperty(_objectSpread4, \"page\", 1), _objectSpread4)))) : _objectSpread({}, searchState.indices, _defineProperty({}, indexId, _objectSpread(_defineProperty({}, namespace, nextRefinement), page)));\n return _objectSpread({}, searchState, {\n indices: state\n });\n}\n\nfunction refineSingleIndexWithNamespace(searchState, nextRefinement, resetPage, namespace) {\n var page = resetPage ? {\n page: 1\n } : undefined;\n return _objectSpread({}, searchState, _defineProperty({}, namespace, _objectSpread({}, searchState[namespace], nextRefinement)), page);\n}\n\nfunction getNamespaceAndAttributeName(id) {\n var parts = id.match(/^([^.]*)\\.(.*)/);\n var namespace = parts && parts[1];\n var attributeName = parts && parts[2];\n return {\n namespace: namespace,\n attributeName: attributeName\n };\n}\n\nfunction hasRefinements(_ref) {\n var multiIndex = _ref.multiIndex,\n indexId = _ref.indexId,\n namespace = _ref.namespace,\n attributeName = _ref.attributeName,\n id = _ref.id,\n searchState = _ref.searchState;\n\n if (multiIndex && namespace) {\n return searchState.indices && searchState.indices[indexId] && searchState.indices[indexId][namespace] && Object.hasOwnProperty.call(searchState.indices[indexId][namespace], attributeName);\n }\n\n if (multiIndex) {\n return searchState.indices && searchState.indices[indexId] && Object.hasOwnProperty.call(searchState.indices[indexId], id);\n }\n\n if (namespace) {\n return searchState[namespace] && Object.hasOwnProperty.call(searchState[namespace], attributeName);\n }\n\n return Object.hasOwnProperty.call(searchState, id);\n}\n\nfunction getRefinements(_ref2) {\n var multiIndex = _ref2.multiIndex,\n indexId = _ref2.indexId,\n namespace = _ref2.namespace,\n attributeName = _ref2.attributeName,\n id = _ref2.id,\n searchState = _ref2.searchState;\n\n if (multiIndex && namespace) {\n return searchState.indices[indexId][namespace][attributeName];\n }\n\n if (multiIndex) {\n return searchState.indices[indexId][id];\n }\n\n if (namespace) {\n return searchState[namespace][attributeName];\n }\n\n return searchState[id];\n}\n\nexport function getCurrentRefinementValue(props, searchState, context, id, defaultValue) {\n var indexId = getIndexId(context);\n\n var _getNamespaceAndAttri = getNamespaceAndAttributeName(id),\n namespace = _getNamespaceAndAttri.namespace,\n attributeName = _getNamespaceAndAttri.attributeName;\n\n var multiIndex = hasMultipleIndices(context);\n var args = {\n multiIndex: multiIndex,\n indexId: indexId,\n namespace: namespace,\n attributeName: attributeName,\n id: id,\n searchState: searchState\n };\n var hasRefinementsValue = hasRefinements(args);\n\n if (hasRefinementsValue) {\n return getRefinements(args);\n }\n\n if (props.defaultRefinement) {\n return props.defaultRefinement;\n }\n\n return defaultValue;\n}\nexport function cleanUpValue(searchState, context, id) {\n var indexId = getIndexId(context);\n\n var _getNamespaceAndAttri2 = getNamespaceAndAttributeName(id),\n namespace = _getNamespaceAndAttri2.namespace,\n attributeName = _getNamespaceAndAttri2.attributeName;\n\n if (hasMultipleIndices(context) && Boolean(searchState.indices)) {\n return cleanUpValueWithMultiIndex({\n attribute: attributeName,\n searchState: searchState,\n indexId: indexId,\n id: id,\n namespace: namespace\n });\n }\n\n return cleanUpValueWithSingleIndex({\n attribute: attributeName,\n searchState: searchState,\n id: id,\n namespace: namespace\n });\n}\n\nfunction cleanUpValueWithSingleIndex(_ref3) {\n var searchState = _ref3.searchState,\n id = _ref3.id,\n namespace = _ref3.namespace,\n attribute = _ref3.attribute;\n\n if (namespace) {\n return _objectSpread({}, searchState, _defineProperty({}, namespace, omit(searchState[namespace], [attribute])));\n }\n\n return omit(searchState, [id]);\n}\n\nfunction cleanUpValueWithMultiIndex(_ref4) {\n var searchState = _ref4.searchState,\n indexId = _ref4.indexId,\n id = _ref4.id,\n namespace = _ref4.namespace,\n attribute = _ref4.attribute;\n var indexSearchState = searchState.indices[indexId];\n\n if (namespace && indexSearchState) {\n return _objectSpread({}, searchState, {\n indices: _objectSpread({}, searchState.indices, _defineProperty({}, indexId, _objectSpread({}, indexSearchState, _defineProperty({}, namespace, omit(indexSearchState[namespace], [attribute])))))\n });\n }\n\n if (indexSearchState) {\n return _objectSpread({}, searchState, {\n indices: _objectSpread({}, searchState.indices, _defineProperty({}, indexId, omit(indexSearchState, [id])))\n });\n }\n\n return searchState;\n}","import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport { omit } from '../core/utils';\nimport createConnector from '../core/createConnector';\nimport { refineValue, getIndexId, hasMultipleIndices } from '../core/indexUtils';\n\nfunction getId() {\n return 'configure';\n}\n\nexport default createConnector({\n displayName: 'AlgoliaConfigure',\n getProvidedProps: function getProvidedProps() {\n return {};\n },\n getSearchParameters: function getSearchParameters(searchParameters, props) {\n var children = props.children,\n contextValue = props.contextValue,\n indexContextValue = props.indexContextValue,\n items = _objectWithoutProperties(props, [\"children\", \"contextValue\", \"indexContextValue\"]);\n\n return searchParameters.setQueryParameters(items);\n },\n transitionState: function transitionState(props, prevSearchState, nextSearchState) {\n var id = getId();\n\n var children = props.children,\n contextValue = props.contextValue,\n indexContextValue = props.indexContextValue,\n items = _objectWithoutProperties(props, [\"children\", \"contextValue\", \"indexContextValue\"]);\n\n var propKeys = Object.keys(props);\n var nonPresentKeys = this._props ? Object.keys(this._props).filter(function (prop) {\n return propKeys.indexOf(prop) === -1;\n }) : [];\n this._props = props;\n\n var nextValue = _defineProperty({}, id, _objectSpread({}, omit(nextSearchState[id], nonPresentKeys), items));\n\n return refineValue(nextSearchState, nextValue, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n },\n cleanUp: function cleanUp(props, searchState) {\n var id = getId();\n var indexId = getIndexId({\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n var subState = hasMultipleIndices({\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }) && searchState.indices ? searchState.indices[indexId] : searchState;\n var configureKeys = subState && subState[id] ? Object.keys(subState[id]) : [];\n var configureState = configureKeys.reduce(function (acc, item) {\n if (!props[item]) {\n acc[item] = subState[id][item];\n }\n\n return acc;\n }, {});\n\n var nextValue = _defineProperty({}, id, configureState);\n\n return refineValue(searchState, nextValue, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n }\n});","export default (typeof global !== \"undefined\" ? global :\n typeof self !== \"undefined\" ? self :\n typeof window !== \"undefined\" ? window : {});\n","// shim for using process in browser\n// based off https://github.com/defunctzombie/node-process/blob/master/browser.js\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\nvar cachedSetTimeout = defaultSetTimout;\nvar cachedClearTimeout = defaultClearTimeout;\nif (typeof global.setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n}\nif (typeof global.clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n}\n\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\nexport function nextTick(fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n}\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nexport var title = 'browser';\nexport var platform = 'browser';\nexport var browser = true;\nexport var env = {};\nexport var argv = [];\nexport var version = ''; // empty string to avoid regexp issues\nexport var versions = {};\nexport var release = {};\nexport var config = {};\n\nfunction noop() {}\n\nexport var on = noop;\nexport var addListener = noop;\nexport var once = noop;\nexport var off = noop;\nexport var removeListener = noop;\nexport var removeAllListeners = noop;\nexport var emit = noop;\n\nexport function binding(name) {\n throw new Error('process.binding is not supported');\n}\n\nexport function cwd () { return '/' }\nexport function chdir (dir) {\n throw new Error('process.chdir is not supported');\n};\nexport function umask() { return 0; }\n\n// from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js\nvar performance = global.performance || {}\nvar performanceNow =\n performance.now ||\n performance.mozNow ||\n performance.msNow ||\n performance.oNow ||\n performance.webkitNow ||\n function(){ return (new Date()).getTime() }\n\n// generate timestamp or delta\n// see http://nodejs.org/api/process.html#process_process_hrtime\nexport function hrtime(previousTimestamp){\n var clocktime = performanceNow.call(performance)*1e-3\n var seconds = Math.floor(clocktime)\n var nanoseconds = Math.floor((clocktime%1)*1e9)\n if (previousTimestamp) {\n seconds = seconds - previousTimestamp[0]\n nanoseconds = nanoseconds - previousTimestamp[1]\n if (nanoseconds<0) {\n seconds--\n nanoseconds += 1e9\n }\n }\n return [seconds,nanoseconds]\n}\n\nvar startTime = new Date();\nexport function uptime() {\n var currentTime = new Date();\n var dif = currentTime - startTime;\n return dif / 1000;\n}\n\nexport default {\n nextTick: nextTick,\n title: title,\n browser: browser,\n env: env,\n argv: argv,\n version: version,\n versions: versions,\n on: on,\n addListener: addListener,\n once: once,\n off: off,\n removeListener: removeListener,\n removeAllListeners: removeAllListeners,\n emit: emit,\n binding: binding,\n cwd: cwd,\n chdir: chdir,\n umask: umask,\n hrtime: hrtime,\n platform: platform,\n release: release,\n config: config,\n uptime: uptime\n};\n","import arrayWithoutHoles from \"./arrayWithoutHoles\";\nimport iterableToArray from \"./iterableToArray\";\nimport nonIterableSpread from \"./nonIterableSpread\";\nexport default function _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || nonIterableSpread();\n}","export default function _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n }\n}","export default function _iterableToArray(iter) {\n if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter);\n}","export default function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance\");\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 for (var key in source) {\n if (!Object.prototype.hasOwnProperty.call(source, key)) {\n continue;\n }\n\n var sourceVal = source[key];\n var targetVal = target[key];\n\n if (typeof targetVal !== 'undefined' && typeof sourceVal === 'undefined') {\n continue;\n }\n\n if (isObjectOrArrayOrFunction(targetVal) && isObjectOrArrayOrFunction(sourceVal)) {\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} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n */\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\n// NOTE: this behaves like lodash/defaults, but doesn't mutate the target\nmodule.exports = function defaultsPure() {\n var sources = Array.prototype.slice.call(arguments);\n return sources.reduceRight(function(acc, source) {\n Object.keys(Object(source)).forEach(function(key) {\n if (source[key] !== undefined) {\n acc[key] = source[key];\n }\n });\n return acc;\n }, {});\n};\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\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","'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('The value should be a number, a parsable string or an array of those.');\n}\n\nmodule.exports = valToNumber;\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 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 objectHasKeys(obj) {\n return obj && Object.keys(obj).length > 0;\n}\n\nmodule.exports = objectHasKeys;\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 omit = require('../functions/omit');\nvar objectHasKeys = require('../functions/objectHasKeys');\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(refinementList, attribute, value) {\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(refinementList, attribute, value) {\n if (value === undefined) 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(refinementList, attribute, refinementType) {\n if (attribute === undefined) {\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(memo, key) {\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 memo[key] = facetList;\n\n return memo;\n }, {});\n\n if (hasChanged) return newRefinementList;\n return refinementList;\n }\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}\n */\n isRefined: function isRefined(refinementList, attribute, refinementValue) {\n var containsRefinements = !!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 merge = require('../functions/merge');\nvar defaultsPure = require('../functions/defaultsPure');\nvar intersection = require('../functions/intersection');\nvar find = require('../functions/find');\nvar valToNumber = require('../functions/valToNumber');\nvar omit = require('../functions/omit');\nvar objectHasKeys = require('../functions/objectHasKeys');\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 */\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 ? SearchParameters._parseNumbers(newParameters) : {};\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 = params.hierarchicalFacetsRefinements || {};\n\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 reparse numbers 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(geoRect) {\n return geoRect.map(function(value) {\n return parseFloat(value);\n });\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 (currentRefinement.length > 0 && currentRefinement[0].indexOf(facet.rootPath) !== 0) {\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(facet.name, facet.rootPath);\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 (currentState.tagFilters && params.tagRefinements && params.tagRefinements.length > 0) {\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 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 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 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}\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 === 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}\n */\n clearTags: function clearTags() {\n if (this.tagFilters === undefined && this.tagRefinements.length === 0) 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}\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}\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}\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}\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}\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}\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}\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}\n * @example\n * // for price = 50 or 40\n * searchparameter.addNumericRefinement('price', '=', [50, 40]);\n * @example\n * // for size = 38 and 40\n * searchparameter.addNumericRefinement('size', '=', 38);\n * searchparameter.addNumericRefinement('size', '=', 40);\n */\n addNumericRefinement: function(attribute, operator, v) {\n var value = valToNumber(v);\n\n if (this.isNumericRefined(attribute, operator, value)) 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(value);\n } else {\n mod[attribute][operator] = [value];\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}\n */\n removeNumericRefinement: function(attribute, operator, paramValue) {\n if (paramValue !== undefined) {\n if (!this.isNumericRefined(attribute, operator, paramValue)) {\n return this;\n }\n return this.setQueryParameters({\n numericRefinements: this._clearNumericRefinements(function(value, key) {\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(value, key) {\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 this.numericRefinements[attribute] && this.numericRefinements[attribute][operator];\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.}\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 if (!objectHasKeys(this.numericRefinements[attribute])) {\n return this.numericRefinements;\n }\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(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({val: value, op: operator}, key, 'numeric');\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 if (hasChanged) return newNumericRefinements;\n return this.numericRefinements;\n }\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}\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}\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}\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: `' + hierarchicalFacet.name + '`');\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}\n */\n addFacetRefinement: function addFacetRefinement(facet, value) {\n if (!this.isConjunctiveFacet(facet)) {\n throw new Error(facet + ' is not defined in the facets attribute of the helper configuration');\n }\n if (RefinementList.isRefined(this.facetsRefinements, facet, value)) return this;\n\n return this.setQueryParameters({\n facetsRefinements: RefinementList.addRefinement(this.facetsRefinements, facet, value)\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}\n */\n addExcludeRefinement: function addExcludeRefinement(facet, value) {\n if (!this.isConjunctiveFacet(facet)) {\n throw new Error(facet + ' is not defined in the facets attribute of the helper configuration');\n }\n if (RefinementList.isRefined(this.facetsExcludes, facet, value)) return this;\n\n return this.setQueryParameters({\n facetsExcludes: RefinementList.addRefinement(this.facetsExcludes, facet, value)\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}\n */\n addDisjunctiveFacetRefinement: function addDisjunctiveFacetRefinement(facet, value) {\n if (!this.isDisjunctiveFacet(facet)) {\n throw new Error(\n facet + ' is not defined in the disjunctiveFacets attribute of the helper configuration');\n }\n\n if (RefinementList.isRefined(this.disjunctiveFacetsRefinements, facet, value)) return this;\n\n return this.setQueryParameters({\n disjunctiveFacetsRefinements: RefinementList.addRefinement(\n this.disjunctiveFacetsRefinements, facet, value)\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}\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}\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}\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}\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}\n */\n removeFacetRefinement: function removeFacetRefinement(facet, value) {\n if (!this.isConjunctiveFacet(facet)) {\n throw new Error(facet + ' is not defined in the facets attribute of the helper configuration');\n }\n if (!RefinementList.isRefined(this.facetsRefinements, facet, value)) return this;\n\n return this.setQueryParameters({\n facetsRefinements: RefinementList.removeRefinement(this.facetsRefinements, facet, value)\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}\n */\n removeExcludeRefinement: function removeExcludeRefinement(facet, value) {\n if (!this.isConjunctiveFacet(facet)) {\n throw new Error(facet + ' is not defined in the facets attribute of the helper configuration');\n }\n if (!RefinementList.isRefined(this.facetsExcludes, facet, value)) return this;\n\n return this.setQueryParameters({\n facetsExcludes: RefinementList.removeRefinement(this.facetsExcludes, facet, value)\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}\n */\n removeDisjunctiveFacetRefinement: function removeDisjunctiveFacetRefinement(facet, value) {\n if (!this.isDisjunctiveFacet(facet)) {\n throw new Error(\n facet + ' is not defined in the disjunctiveFacets attribute of the helper configuration');\n }\n if (!RefinementList.isRefined(this.disjunctiveFacetsRefinements, facet, value)) return this;\n\n return this.setQueryParameters({\n disjunctiveFacetsRefinements: RefinementList.removeRefinement(\n this.disjunctiveFacetsRefinements, facet, value)\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}\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}\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}\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('Cannot refine the undeclared facet ' + facet +\n '; it should be added to the helper options facets, disjunctiveFacets or hierarchicalFacets');\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}\n */\n toggleConjunctiveFacetRefinement: function toggleConjunctiveFacetRefinement(facet, value) {\n if (!this.isConjunctiveFacet(facet)) {\n throw new Error(facet + ' is not defined in the facets attribute of the helper configuration');\n }\n\n return this.setQueryParameters({\n facetsRefinements: RefinementList.toggleRefinement(this.facetsRefinements, facet, value)\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}\n */\n toggleExcludeFacetRefinement: function toggleExcludeFacetRefinement(facet, value) {\n if (!this.isConjunctiveFacet(facet)) {\n throw new Error(facet + ' is not defined in the facets attribute of the helper configuration');\n }\n\n return this.setQueryParameters({\n facetsExcludes: RefinementList.toggleRefinement(this.facetsExcludes, facet, value)\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}\n */\n toggleDisjunctiveFacetRefinement: function toggleDisjunctiveFacetRefinement(facet, value) {\n if (!this.isDisjunctiveFacet(facet)) {\n throw new Error(\n facet + ' is not defined in the disjunctiveFacets attribute of the helper configuration');\n }\n\n return this.setQueryParameters({\n disjunctiveFacetsRefinements: RefinementList.toggleRefinement(\n this.disjunctiveFacetsRefinements, facet, value)\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}\n */\n toggleHierarchicalFacetRefinement: function toggleHierarchicalFacetRefinement(facet, value) {\n if (!this.isHierarchicalFacet(facet)) {\n throw new Error(\n facet + ' is not defined in the hierarchicalFacets attribute of the helper configuration');\n }\n\n var separator = this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(facet));\n\n var mod = {};\n\n var upOneOrMultipleLevel = 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(value + separator) === 0\n );\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({}, mod, this.hierarchicalFacetsRefinements)\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(facet + ' is not defined in the hierarchicalFacets attribute of the helper configuration.');\n }\n var mod = {};\n mod[facet] = [path];\n return this.setQueryParameters({\n hierarchicalFacetsRefinements: defaultsPure({}, mod, this.hierarchicalFacetsRefinements)\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({}, mod, this.hierarchicalFacetsRefinements)\n });\n },\n /**\n * Switch the tag refinement\n * @method\n * @param {string} tag the tag to remove or add\n * @return {SearchParameters}\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}\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}\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}\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}\n */\n isDisjunctiveFacetRefined: function isDisjunctiveFacetRefined(facet, value) {\n if (!this.isDisjunctiveFacet(facet)) {\n return false;\n }\n return RefinementList.isRefined(this.disjunctiveFacetsRefinements, 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}\n */\n isHierarchicalFacetRefined: function isHierarchicalFacetRefined(facet, value) {\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 !!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}\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[]}\n */\n getRefinedDisjunctiveFacets: function getRefinedDisjunctiveFacets() {\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).filter(function(facet) {\n return self.disjunctiveFacetsRefinements[facet].length > 0;\n })\n .concat(disjunctiveNumericRefinedFacets)\n .concat(this.getRefinedHierarchicalFacets());\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[]}\n */\n getRefinedHierarchicalFacets: function getRefinedHierarchicalFacets() {\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) { return facet.name; }),\n Object.keys(this.hierarchicalFacetsRefinements).filter(function(facet) {\n return self.hierarchicalFacetsRefinements[facet].length > 0;\n })\n );\n },\n /**\n * Returned the list of all disjunctive facets not refined\n * @method\n * @return {string[]}\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 'facets', 'disjunctiveFacets', 'facetsRefinements',\n 'facetsExcludes', 'disjunctiveFacetsRefinements',\n 'numericRefinements', 'tagRefinements', 'hierarchicalFacets', 'hierarchicalFacetsRefinements'\n ],\n getQueryParams: function getQueryParams() {\n var managedParameters = this.managedParameters;\n\n var queryParams = {};\n\n var self = this;\n Object.keys(this).forEach(function(paramName) {\n var paramValue = self[paramName];\n if (managedParameters.indexOf(paramName) === -1 && paramValue !== undefined) {\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 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(\n function(previous, key) {\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\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\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\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\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\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\n * @return {object} a hierarchicalFacet\n */\n getHierarchicalFacetByName: function(hierarchicalFacetName) {\n return find(\n this.hierarchicalFacets,\n function(f) {\n return f.name === hierarchicalFacetName;\n }\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\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 */\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\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// @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(defaultInstructions, function(\n defaultInstruction\n ) {\n return defaultInstruction[0] === sortInstruction[0];\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\nmodule.exports = generateTrees;\n\nvar orderBy = require('../functions/orderBy');\nvar find = require('../functions/find');\nvar prepareHierarchicalFacetSortBy = require('../functions/formatSort');\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 = state._getHierarchicalFacetSeparator(\n hierarchicalFacet\n );\n var hierarchicalRootPath = state._getHierarchicalRootPath(\n hierarchicalFacet\n );\n var hierarchicalShowParentLevel = state._getHierarchicalShowParentLevel(\n hierarchicalFacet\n );\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 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 currentRefinement,\n hierarchicalFacetResult.exhaustive\n );\n }),\n sortBy[0],\n sortBy[1]\n );\n }\n\n return hierarchicalTree;\n };\n}\n\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 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 merge = require('../functions/merge');\nvar defaultsPure = require('../functions/defaultsPure');\nvar orderBy = require('../functions/orderBy');\nvar compact = require('../functions/compact');\nvar find = require('../functions/find');\nvar findIndex = require('../functions/findIndex');\nvar formatSort = require('../functions/formatSort');\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 * @param {string[]} attributes\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\n * @param {string} hierarchicalAttributeName\n */\nfunction findMatchingHierarchicalFacetFromAttributeName(\n hierarchicalFacets,\n hierarchicalAttributeName\n) {\n return find(hierarchicalFacets, function facetKeyMatchesAttribute(\n hierarchicalFacet\n ) {\n var facetNames = hierarchicalFacet.attributes || [];\n return facetNames.indexOf(hierarchicalAttributeName) > -1;\n });\n}\n\n/*eslint-disable */\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 **/\n/*eslint-enable */\nfunction SearchResults(state, results) {\n var mainSubResponse = results[0];\n\n this._rawResults = results;\n\n /**\n * query used to generate the results\n * @member {string}\n */\n this.query = mainSubResponse.query;\n /**\n * The query as parsed by the engine given all the rules.\n * @member {string}\n */\n this.parsedQuery = mainSubResponse.parsedQuery;\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 * @member {object[]}\n */\n this.hits = mainSubResponse.hits;\n /**\n * index where the results come from\n * @member {string}\n */\n this.index = mainSubResponse.index;\n /**\n * number of hits per page requested\n * @member {number}\n */\n this.hitsPerPage = mainSubResponse.hitsPerPage;\n /**\n * total number of hits of this query on the index\n * @member {number}\n */\n this.nbHits = mainSubResponse.nbHits;\n /**\n * total number of pages with respect to the number of hits per page and the total number of hits\n * @member {number}\n */\n this.nbPages = mainSubResponse.nbPages;\n /**\n * current page\n * @member {number}\n */\n this.page = mainSubResponse.page;\n /**\n * sum of the processing time of all the queries\n * @member {number}\n */\n this.processingTimeMS = results.reduce(function(sum, result) {\n return result.processingTimeMS === undefined\n ? sum\n : sum + result.processingTimeMS;\n }, 0);\n /**\n * The position if the position was guessed by IP.\n * @member {string}\n * @example \"48.8637,2.3615\",\n */\n this.aroundLatLng = mainSubResponse.aroundLatLng;\n /**\n * The radius computed by Algolia.\n * @member {string}\n * @example \"126792922\",\n */\n this.automaticRadius = mainSubResponse.automaticRadius;\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 * @member {string}\n * @example \"c7-use-2.algolia.net\",\n */\n this.serverUsed = mainSubResponse.serverUsed;\n /**\n * Boolean that indicates if the computation of the counts did time out.\n * @deprecated\n * @member {boolean}\n */\n this.timeoutCounts = mainSubResponse.timeoutCounts;\n /**\n * Boolean that indicates if the computation of the hits did time out.\n * @deprecated\n * @member {boolean}\n */\n this.timeoutHits = mainSubResponse.timeoutHits;\n\n /**\n * True if the counts of the facets is exhaustive\n * @member {boolean}\n */\n this.exhaustiveFacetsCount = mainSubResponse.exhaustiveFacetsCount;\n\n /**\n * True if the number of hits is exhaustive\n * @member {boolean}\n */\n this.exhaustiveNbHits = mainSubResponse.exhaustiveNbHits;\n\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 * @member {object[]}\n */\n this.userData = mainSubResponse.userData;\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 * @member {string}\n */\n this.queryID = mainSubResponse.queryID;\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(function initFutureTree() {\n return [];\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 var self = this;\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(self.disjunctiveFacets[position], mainSubResponse.facets_stats, facetKey);\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(self.facets[position], mainSubResponse.facets_stats, facetKey);\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(self.hierarchicalFacets[position], function(f) {\n return f.attribute === dfacet;\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 = 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(self.disjunctiveFacets[position], result.facets_stats, dfacet);\n\n if (state.disjunctiveFacetsRefinements[dfacet]) {\n state.disjunctiveFacetsRefinements[dfacet].forEach(function(refinementValue) {\n // add the disjunctive refinements if it is no more retrieved\n if (!self.disjunctiveFacets[position].data[refinementValue] &&\n state.disjunctiveFacetsRefinements[dfacet].indexOf(refinementValue) > -1) {\n self.disjunctiveFacets[position].data[refinementValue] = 0;\n }\n });\n }\n }\n });\n nextDisjunctiveResult++;\n });\n\n // if we have some root 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 (currentRefinement.length === 0 || currentRefinement[0].split(separator).length < 2) {\n return;\n }\n\n var result = results[nextDisjunctiveResult];\n var facets = result && result.facets\n ? 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(self.hierarchicalFacets[position], function(f) {\n return f.attribute === dfacet;\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] = 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 // 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: mainSubResponse.facets[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(generateHierarchicalTree(state));\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 find(this.facets, predicate) ||\n find(this.disjunctiveFacets, predicate) ||\n find(this.hierarchicalFacets, predicate);\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 return {\n name: name,\n count: facet.data[name],\n isRefined: results._state.isFacetRefined(attribute, name),\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 return {\n name: name,\n count: disjunctiveFacet.data[name],\n isRefined: results._state.isDisjunctiveFacetRefined(attribute, name)\n };\n });\n } else if (results._state.isHierarchicalFacet(attribute)) {\n return find(results.hierarchicalFacets, predicate);\n }\n}\n\n/**\n * Sort nodes of a hierarchical facet results\n * @private\n * @param {HierarchicalFacet} node node to upon which we want to apply the sort\n */\nfunction recSort(sortFn, node) {\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);\n });\n var sortedChildren = sortFn(children);\n var newNode = merge({}, node, {data: sortedChildren});\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 * 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 {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, {sortBy: SearchResults.DEFAULT_SORT});\n\n if (Array.isArray(options.sortBy)) {\n var order = formatSort(options.sortBy, SearchResults.DEFAULT_SORT);\n if (Array.isArray(facetValues)) {\n return orderBy(facetValues, order[0], order[1]);\n }\n // If facetValues is not an array, it's an object thus a hierarchical facet object\n return recSort(function(hierarchicalFacetValues) {\n return orderBy(hierarchicalFacetValues, order[0], order[1]);\n }, facetValues);\n } else if (typeof options.sortBy === 'function') {\n if (Array.isArray(facetValues)) {\n return facetValues.sort(options.sortBy);\n }\n // If facetValues is not an array, it's an object thus a hierarchical facet object\n return recSort(function(data) {\n return vanillaSortFn(options.sortBy, data);\n }, facetValues);\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\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\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 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(getRefinement(state, 'facet', attributeName, name, results.facets));\n });\n });\n\n Object.keys(state.facetsExcludes).forEach(function(attributeName) {\n state.facetsExcludes[attributeName].forEach(function(name) {\n res.push(getRefinement(state, 'exclude', attributeName, name, results.facets));\n });\n });\n\n Object.keys(state.disjunctiveFacetsRefinements).forEach(function(attributeName) {\n state.disjunctiveFacetsRefinements[attributeName].forEach(function(name) {\n res.push(getRefinement(state, 'disjunctive', attributeName, name, results.disjunctiveFacets));\n });\n });\n\n Object.keys(state.hierarchicalFacetsRefinements).forEach(function(attributeName) {\n state.hierarchicalFacetsRefinements[attributeName].forEach(function(name) {\n res.push(getHierarchicalRefinement(state, attributeName, name, results.hierarchicalFacets));\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 {*} state\n * @param {*} type\n * @param {string} attributeName\n * @param {*} name\n * @param {Facet[]} resultsFacets\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 {*} state\n * @param {string} attributeName\n * @param {*} name\n * @param {Facet[]} resultsFacets\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 && 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","// 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\nEventEmitter.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\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\nvar events = require('events');\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 */\nfunction DerivedHelper(mainHelper, fn) {\n this.main = mainHelper;\n this.fn = fn;\n this.lastResults = null;\n}\n\ninherits(DerivedHelper, events.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\nvar merge = require('./functions/merge');\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 * @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(state, refinedFacet)\n });\n });\n\n // maybe more to get the root level of hierarchical facets when activated\n state.getRefinedHierarchicalFacets().forEach(function(refinedFacet) {\n var hierarchicalFacet = state.getHierarchicalFacetByName(refinedFacet);\n\n var currentRefinement = state.getHierarchicalRefinement(refinedFacet);\n // if we are deeper than level 0 (starting from `beer > IPA`)\n // we want to get the root values\n var separator = state._getHierarchicalFacetSeparator(hierarchicalFacet);\n if (currentRefinement.length > 0 && currentRefinement[0].split(separator).length > 1) {\n queries.push({\n indexName: index,\n params: requestBuilder._getDisjunctiveFacetSearchParams(state, refinedFacet, true)\n });\n }\n });\n\n return queries;\n },\n\n /**\n * Build search parameters used to fetch hits\n * @private\n * @return {object.}\n */\n _getHitsSearchParams: function(state) {\n var facets = state.facets\n .concat(state.disjunctiveFacets)\n .concat(requestBuilder._getHitsHierarchicalFacetsAttributes(state));\n\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,\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 merge({}, state.getQueryParams(), additionalParams);\n },\n\n /**\n * Build search parameters used to fetch a disjunctive facet\n * @private\n * @param {string} facet the associated facet name\n * @param {boolean} hierarchicalRootLevel ?? FIXME\n * @return {object}\n */\n _getDisjunctiveFacetSearchParams: function(state, facet, hierarchicalRootLevel) {\n var facetFilters = requestBuilder._getFacetFilters(state, facet, hierarchicalRootLevel);\n var numericFilters = requestBuilder._getNumericFilters(state, facet);\n var tagFilters = requestBuilder._getTagFilters(state);\n var additionalParams = {\n hitsPerPage: 1,\n page: 0,\n attributesToRetrieve: [],\n attributesToHighlight: [],\n attributesToSnippet: [],\n tagFilters: tagFilters,\n analytics: false,\n clickAnalytics: false\n };\n\n var hierarchicalFacet = state.getHierarchicalFacetByName(facet);\n\n if (hierarchicalFacet) {\n additionalParams.facets = 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 merge({}, state.getQueryParams(), additionalParams);\n },\n\n /**\n * Return the numeric filters in an algolia request fashion\n * @private\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\n * @private\n * @return {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 /**\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 {string} [facet] if set, the current disjunctive facet\n * @return {array.}\n */\n _getFacetFilters: function(state, facet, hierarchicalRootLevel) {\n var facetFilters = [];\n\n var facetsRefinements = state.facetsRefinements || {};\n Object.keys(facetsRefinements).forEach(function(facetName) {\n var facetValues = facetsRefinements[facetName] || [];\n facetValues.forEach(function(facetValue) {\n facetFilters.push(facetName + ':' + facetValue);\n });\n });\n\n var facetsExcludes = state.facetsExcludes || {};\n Object.keys(facetsExcludes).forEach(function(facetName) {\n var facetValues = facetsExcludes[facetName] || [];\n facetValues.forEach(function(facetValue) {\n facetFilters.push(facetName + ':-' + facetValue);\n });\n });\n\n var disjunctiveFacetsRefinements = state.disjunctiveFacetsRefinements || {};\n Object.keys(disjunctiveFacetsRefinements).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.forEach(function(facetValue) {\n orFilters.push(facetName + ':' + facetValue);\n });\n\n facetFilters.push(orFilters);\n });\n\n var hierarchicalFacetsRefinements = state.hierarchicalFacetsRefinements || {};\n Object.keys(hierarchicalFacetsRefinements).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 (facetValue.indexOf(separator) === -1 || (!rootPath && hierarchicalRootLevel === true) ||\n (rootPath && rootPath.split(separator).length === facetValue.split(separator).length)) {\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(allAttributes, hierarchicalFacet) {\n var hierarchicalRefinement = state.getHierarchicalRefinement(hierarchicalFacet.name)[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 }, out);\n },\n\n _getDisjunctiveHierarchicalFacetAttribute: function(state, hierarchicalFacet, rootLevel) {\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 = 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 merge(\n {},\n requestBuilder._getHitsSearchParams(stateForSearchForFacetValues),\n searchForFacetSearchParameters\n );\n }\n};\n\nmodule.exports = requestBuilder;\n","'use strict';\n\nmodule.exports = '3.1.0';\n","'use strict';\n\nvar SearchParameters = require('./SearchParameters');\nvar SearchResults = require('./SearchResults');\nvar DerivedHelper = require('./DerivedHelper');\nvar requestBuilder = require('./requestBuilder');\n\nvar events = require('events');\nvar inherits = require('./functions/inherits');\nvar objectHasKeys = require('./functions/objectHasKeys');\n\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, events.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}\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} [callback] 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 ? this.state : this.state.setQueryParameters(options);\n var queries = requestBuilder._getQueries(tempState.index, tempState);\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(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 }, function(e) {\n self._currentNbQueries--;\n if (self._currentNbQueries === 0) self.emit('searchQueueEmpty');\n throw e;\n });\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(facet, query, maxFacetHits, userState) {\n var clientHasSFFV = typeof this.client.searchForFacetValues === 'function';\n if (\n !clientHasSFFV &&\n typeof this.client.initIndex !== '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 var state = this.state.setQueryParameters(userState || {});\n var isDisjunctive = state.isDisjunctiveFacet(facet);\n var algoliaQuery = requestBuilder.getSearchForFacetQuery(facet, query, maxFacetHits, state);\n\n this._currentNbQueries++;\n var self = this;\n\n this.emit('searchForFacetValues', {\n state: state,\n facet: facet,\n query: query\n });\n\n var searchForFacetValuesPromise = clientHasSFFV\n ? this.client.searchForFacetValues([{indexName: state.index, params: algoliaQuery}])\n : this.client.initIndex(state.index).searchForFacetValues(algoliaQuery);\n\n return searchForFacetValuesPromise.then(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.isRefined = isDisjunctive\n ? state.isDisjunctiveFacetRefined(facet, f.value)\n : state.isFacetRefined(facet, f.value);\n });\n\n return content;\n }, function(e) {\n self._currentNbQueries--;\n if (self._currentNbQueries === 0) self.emit('searchQueueEmpty');\n throw e;\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}\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}\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}\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}\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.addDisjunctiveFacetRefinement = function(facet, value) {\n this._change({\n state: this.state.resetPage().addDisjunctiveFacetRefinement(facet, value),\n isPageReset: true\n });\n\n return this;\n};\n\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}\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(facet, value) {\n this._change({\n state: this.state.resetPage().addHierarchicalFacetRefinement(facet, value),\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}\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.addNumericRefinement = function(attribute, operator, value) {\n this._change({\n state: this.state.resetPage().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}\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/**\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/**\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}\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/**\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}\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}\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeNumericRefinement = function(attribute, operator, value) {\n this._change({\n state: this.state.resetPage().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}\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeDisjunctiveFacetRefinement = function(facet, value) {\n this._change({\n state: this.state.resetPage().removeDisjunctiveFacetRefinement(facet, value),\n isPageReset: true\n });\n\n return this;\n};\n\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}\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(facet) {\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}\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/**\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}\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/**\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}\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}\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/**\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}\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}\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/**\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}\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}\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}\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 */\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}\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}\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}\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}\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}\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}\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 = 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/**\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}\n */\nAlgoliaSearchHelper.prototype.hasTag = function(tag) {\n return this.state.isTagRefined(tag);\n};\n\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/**\n * Get the name of the currently used index.\n * @return {string}\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 disjRefinements = this.state.getDisjunctiveRefinements(facetName);\n\n disjRefinements.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(attribute, operator) {\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(facetName) {\n return this.state.getHierarchicalFacetBreadcrumb(facetName);\n};\n\n// /////////// PRIVATE\n\n/**\n * Perform the underlying queries\n * @private\n * @return {undefined}\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 = requestBuilder._getQueries(derivedState.index, derivedState);\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 var queryId = this._queryId++;\n\n this._currentNbQueries++;\n\n try {\n this.client.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\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}>}\n * state state used for 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(states, queryId, content) {\n // FIXME 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 var formattedResponse = helper.lastResults = new SearchResults(state, specificResults);\n\n helper.emit('result', {\n results: formattedResponse,\n state: state\n });\n });\n};\n\nAlgoliaSearchHelper.prototype._dispatchAlgoliaError = function(queryId, error) {\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(query, facetFilters, numericFilters, tagFilters) {\n return query ||\n facetFilters.length !== 0 ||\n numericFilters.length !== 0 ||\n tagFilters.length !== 0;\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}\n */\nAlgoliaSearchHelper.prototype._hasDisjunctiveRefinements = function(facet) {\n return this.state.disjunctiveRefinements[facet] &&\n this.state.disjunctiveRefinements[facet].length > 0;\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}\n */\nAlgoliaSearchHelper.prototype.clearCache = function() {\n 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}\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}\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}\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 * @return {undefined}\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\nvar AlgoliaSearchHelper = require('./src/algoliasearch.helper');\n\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}\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.js');\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","import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread\";\nimport algoliasearchHelper from 'algoliasearch-helper';\nimport createConnector from '../core/createConnector';\nimport { omit, getObjectType, removeEmptyKey, removeEmptyArraysFromObject } from '../core/utils';\nimport { refineValue, getIndexId, hasMultipleIndices } from '../core/indexUtils';\n\nfunction createOptionalFilter(_ref) {\n var attributeName = _ref.attributeName,\n attributeValue = _ref.attributeValue,\n attributeScore = _ref.attributeScore;\n return \"\".concat(attributeName, \":\").concat(attributeValue, \"\");\n}\n\nvar defaultProps = {\n transformSearchParameters: function transformSearchParameters(x) {\n return _objectSpread({}, x);\n }\n};\n\nfunction getId() {\n // We store the search state of this widget in `configure`.\n return 'configure';\n}\n\nfunction getSearchParametersFromProps(props) {\n var optionalFilters = Object.keys(props.matchingPatterns).reduce(function (acc, attributeName) {\n var attributePattern = props.matchingPatterns[attributeName];\n var attributeValue = props.hit[attributeName];\n var attributeScore = attributePattern.score;\n\n if (Array.isArray(attributeValue)) {\n return [].concat(_toConsumableArray(acc), [attributeValue.map(function (attributeSubValue) {\n return createOptionalFilter({\n attributeName: attributeName,\n attributeValue: attributeSubValue,\n attributeScore: attributeScore\n });\n })]);\n }\n\n if (typeof attributeValue === 'string') {\n return [].concat(_toConsumableArray(acc), [createOptionalFilter({\n attributeName: attributeName,\n attributeValue: attributeValue,\n attributeScore: attributeScore\n })]);\n }\n\n if (process.env.NODE_ENV === 'development') {\n // eslint-disable-next-line no-console\n console.warn(\"The `matchingPatterns` option returned a value of type \".concat(getObjectType(attributeValue), \" for the \\\"\").concat(attributeName, \"\\\" key. This value was not sent to Algolia because `optionalFilters` only supports strings and array of strings.\\n\\nYou can remove the \\\"\").concat(attributeName, \"\\\" key from the `matchingPatterns` option.\\n\\nSee https://www.algolia.com/doc/api-reference/api-parameters/optionalFilters/\"));\n }\n\n return acc;\n }, []);\n return props.transformSearchParameters(new algoliasearchHelper.SearchParameters({\n // @ts-ignore @TODO algoliasearch-helper@3.0.1 will contain the type\n // `sumOrFiltersScores`.\n // See https://github.com/algolia/algoliasearch-helper-js/pull/753\n sumOrFiltersScores: true,\n facetFilters: [\"objectID:-\".concat(props.hit.objectID)],\n optionalFilters: optionalFilters\n }));\n}\n\nexport default createConnector({\n displayName: 'AlgoliaConfigureRelatedItems',\n defaultProps: defaultProps,\n getProvidedProps: function getProvidedProps() {\n return {};\n },\n getSearchParameters: function getSearchParameters(searchParameters, props) {\n return searchParameters.setQueryParameters(getSearchParametersFromProps(props));\n },\n transitionState: function transitionState(props, _prevSearchState, nextSearchState) {\n var id = getId(); // We need to transform the exhaustive search parameters back to clean\n // search parameters without the empty default keys so we don't pollute the\n // `configure` search state.\n\n var searchParameters = removeEmptyArraysFromObject(removeEmptyKey(getSearchParametersFromProps(props)));\n var searchParametersKeys = Object.keys(searchParameters);\n var nonPresentKeys = this._searchParameters ? Object.keys(this._searchParameters).filter(function (prop) {\n return searchParametersKeys.indexOf(prop) === -1;\n }) : [];\n this._searchParameters = searchParameters;\n\n var nextValue = _defineProperty({}, id, _objectSpread({}, omit(nextSearchState[id], nonPresentKeys), searchParameters));\n\n return refineValue(nextSearchState, nextValue, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n },\n cleanUp: function cleanUp(props, searchState) {\n var _this = this;\n\n var id = getId();\n var indexId = getIndexId({\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n var subState = hasMultipleIndices({\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }) && searchState.indices ? searchState.indices[indexId] : searchState;\n var configureKeys = subState && subState[id] ? Object.keys(subState[id]) : [];\n var configureState = configureKeys.reduce(function (acc, item) {\n if (!_this._searchParameters[item]) {\n acc[item] = subState[id][item];\n }\n\n return acc;\n }, {});\n\n var nextValue = _defineProperty({}, id, configureState);\n\n return refineValue(searchState, nextValue, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n }\n});","/*\nobject-assign\n(c) Sindre Sorhus\n@license MIT\n*/\n\n'use strict';\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nfunction shouldUseNative() {\n\ttry {\n\t\tif (!Object.assign) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Detect buggy property enumeration order in older V8 versions.\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=4118\n\t\tvar test1 = new String('abc'); // eslint-disable-line no-new-wrappers\n\t\ttest1[5] = 'de';\n\t\tif (Object.getOwnPropertyNames(test1)[0] === '5') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test2 = {};\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\ttest2['_' + String.fromCharCode(i)] = i;\n\t\t}\n\t\tvar order2 = Object.getOwnPropertyNames(test2).map(function (n) {\n\t\t\treturn test2[n];\n\t\t});\n\t\tif (order2.join('') !== '0123456789') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test3 = {};\n\t\t'abcdefghijklmnopqrst'.split('').forEach(function (letter) {\n\t\t\ttest3[letter] = letter;\n\t\t});\n\t\tif (Object.keys(Object.assign({}, test3)).join('') !==\n\t\t\t\t'abcdefghijklmnopqrst') {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (err) {\n\t\t// We don't expect any of the above to throw, but better to be safe.\n\t\treturn false;\n\t}\n}\n\nmodule.exports = shouldUseNative() ? Object.assign : function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (getOwnPropertySymbols) {\n\t\t\tsymbols = getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\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\n'use strict';\n\nvar ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');\n\nfunction emptyFunction() {}\n\nmodule.exports = function() {\n function shim(props, propName, componentName, location, propFullName, secret) {\n if (secret === ReactPropTypesSecret) {\n // It is still safe when called from React.\n return;\n }\n var err = new Error(\n 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +\n 'Use PropTypes.checkPropTypes() to call them. ' +\n 'Read more at http://fb.me/use-check-prop-types'\n );\n err.name = 'Invariant Violation';\n throw err;\n };\n shim.isRequired = shim;\n function getShim() {\n return shim;\n };\n // Important!\n // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.\n var ReactPropTypes = {\n array: shim,\n bool: shim,\n func: shim,\n number: shim,\n object: shim,\n string: shim,\n symbol: shim,\n\n any: shim,\n arrayOf: getShim,\n element: shim,\n instanceOf: getShim,\n node: shim,\n objectOf: getShim,\n oneOf: getShim,\n oneOfType: getShim,\n shape: getShim,\n exact: getShim\n };\n\n ReactPropTypes.checkPropTypes = emptyFunction;\n ReactPropTypes.PropTypes = ReactPropTypes;\n\n return ReactPropTypes;\n};\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\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\nif (process.env.NODE_ENV !== 'production') {\n var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&\n Symbol.for &&\n Symbol.for('react.element')) ||\n 0xeac7;\n\n var isValidElement = function(object) {\n return typeof object === 'object' &&\n object !== null &&\n object.$$typeof === REACT_ELEMENT_TYPE;\n };\n\n // By explicitly using `prop-types` you are opting into new development behavior.\n // http://fb.me/prop-types-in-prod\n var throwOnDirectAccess = true;\n module.exports = require('./factoryWithTypeCheckers')(isValidElement, throwOnDirectAccess);\n} else {\n // By explicitly using `prop-types` you are opting into new production behavior.\n // http://fb.me/prop-types-in-prod\n module.exports = require('./factoryWithThrowingShims')();\n}\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\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\n'use strict';\n\nvar ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\n\nmodule.exports = ReactPropTypesSecret;\n","import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport createConnector from '../core/createConnector';\nimport { cleanUpValue, refineValue, getCurrentRefinementValue } from '../core/indexUtils';\nimport { addQueryID, addAbsolutePositions } from '../core/utils';\n\nvar getId = function getId() {\n return 'query';\n};\n\nfunction getCurrentRefinement(props, searchState, context) {\n var id = getId();\n var currentRefinement = getCurrentRefinementValue(props, searchState, context, id, '');\n\n if (currentRefinement) {\n return currentRefinement;\n }\n\n return '';\n}\n\nfunction getHits(searchResults) {\n if (searchResults.results) {\n if (searchResults.results.hits && Array.isArray(searchResults.results.hits)) {\n return addAbsolutePositions(addQueryID(searchResults.results.hits, searchResults.results.queryID), searchResults.results.hitsPerPage, searchResults.results.page);\n } else {\n return Object.keys(searchResults.results).reduce(function (hits, index) {\n return [].concat(_toConsumableArray(hits), [{\n index: index,\n hits: addAbsolutePositions(addQueryID(searchResults.results[index].hits, searchResults.results[index].queryID), searchResults.results[index].hitsPerPage, searchResults.results[index].page)\n }]);\n }, []);\n }\n } else {\n return [];\n }\n}\n\nfunction _refine(props, searchState, nextRefinement, context) {\n var id = getId();\n\n var nextValue = _defineProperty({}, id, nextRefinement);\n\n var resetPage = true;\n return refineValue(searchState, nextValue, context, resetPage);\n}\n\nfunction _cleanUp(props, searchState, context) {\n return cleanUpValue(searchState, context, getId());\n}\n/**\n * connectAutoComplete connector provides the logic to create connected\n * components that will render the results retrieved from\n * Algolia.\n *\n * To configure the number of hits retrieved, use [HitsPerPage widget](widgets/HitsPerPage.html),\n * [connectHitsPerPage connector](connectors/connectHitsPerPage.html) or pass the hitsPerPage\n * prop to a [Configure](guide/Search_parameters.html) widget.\n * @name connectAutoComplete\n * @kind connector\n * @propType {string} [defaultRefinement] - Provide a default value for the query\n * @providedPropType {array.} hits - the records that matched the search state\n * @providedPropType {function} refine - a function to change the query\n * @providedPropType {string} currentRefinement - the query to search for\n */\n\n\nexport default createConnector({\n displayName: 'AlgoliaAutoComplete',\n getProvidedProps: function getProvidedProps(props, searchState, searchResults) {\n return {\n hits: getHits(searchResults),\n currentRefinement: getCurrentRefinement(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n })\n };\n },\n refine: function refine(props, searchState, nextRefinement) {\n return _refine(props, searchState, nextRefinement, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n },\n cleanUp: function cleanUp(props, searchState) {\n return _cleanUp(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n },\n\n /**\n * AutoComplete needs to be considered as a widget to trigger a search,\n * even if no other widgets are used.\n *\n * To be considered as a widget you need either:\n * - getSearchParameters\n * - getMetadata\n * - transitionState\n *\n * See: createConnector.tsx\n */\n getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {\n return searchParameters.setQuery(getCurrentRefinement(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }));\n }\n});","import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport PropTypes from 'prop-types';\nimport createConnector from '../core/createConnector';\nimport { refineValue, getResults } from '../core/indexUtils';\nexport var getId = function getId(props) {\n return props.attributes[0];\n};\nvar namespace = 'hierarchicalMenu';\n\nfunction _refine(props, searchState, nextRefinement, context) {\n var id = getId(props);\n\n var nextValue = _defineProperty({}, id, nextRefinement || '');\n\n var resetPage = true;\n return refineValue(searchState, nextValue, context, resetPage, namespace);\n}\n\nfunction transformValue(values) {\n return values.reduce(function (acc, item) {\n if (item.isRefined) {\n acc.push({\n label: item.name,\n // If dealing with a nested \"items\", \"value\" is equal to the previous value concatenated with the current label\n // If dealing with the first level, \"value\" is equal to the current label\n value: item.path\n }); // Create a variable in order to keep the same acc for the recursion, otherwise \"reduce\" returns a new one\n\n if (item.data) {\n acc = acc.concat(transformValue(item.data, acc));\n }\n }\n\n return acc;\n }, []);\n}\n/**\n * The breadcrumb component is s a type of secondary navigation scheme that\n * reveals the user’s location in a website or web application.\n *\n * @name connectBreadcrumb\n * @requirements To use this widget, your attributes must be formatted in a specific way.\n * If you want for example to have a Breadcrumb of categories, objects in your index\n * should be formatted this way:\n *\n * ```json\n * {\n * \"categories.lvl0\": \"products\",\n * \"categories.lvl1\": \"products > fruits\",\n * \"categories.lvl2\": \"products > fruits > citrus\"\n * }\n * ```\n *\n * It's also possible to provide more than one path for each level:\n *\n * ```json\n * {\n * \"categories.lvl0\": [\"products\", \"goods\"],\n * \"categories.lvl1\": [\"products > fruits\", \"goods > to eat\"]\n * }\n * ```\n *\n * All attributes passed to the `attributes` prop must be present in \"attributes for faceting\"\n * on the Algolia dashboard or configured as `attributesForFaceting` via a set settings call to the Algolia API.\n *\n * @kind connector\n * @propType {array.} attributes - List of attributes to use to generate the hierarchy of the menu. See the example for the convention to follow.\n * @propType {function} [transformItems] - Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return.\n * @providedPropType {function} refine - a function to toggle a refinement\n * @providedPropType {function} createURL - a function to generate a URL for the corresponding search state\n * @providedPropType {array.<{items: object, count: number, isRefined: boolean, label: string, value: string}>} items - the list of items the Breadcrumb can display.\n */\n\n\nexport default createConnector({\n displayName: 'AlgoliaBreadcrumb',\n propTypes: {\n attributes: function attributes(props, propName, componentName) {\n var isNotString = function isNotString(val) {\n return typeof val !== 'string';\n };\n\n if (!Array.isArray(props[propName]) || props[propName].some(isNotString) || props[propName].length < 1) {\n return new Error(\"Invalid prop \".concat(propName, \" supplied to \").concat(componentName, \". Expected an Array of Strings\"));\n }\n\n return undefined;\n },\n transformItems: PropTypes.func\n },\n getProvidedProps: function getProvidedProps(props, searchState, searchResults) {\n var id = getId(props);\n var results = getResults(searchResults, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n var isFacetPresent = Boolean(results) && Boolean(results.getFacetByName(id));\n\n if (!isFacetPresent) {\n return {\n items: [],\n canRefine: false\n };\n }\n\n var values = results.getFacetValues(id);\n var items = values.data ? transformValue(values.data) : [];\n var transformedItems = props.transformItems ? props.transformItems(items) : items;\n return {\n canRefine: transformedItems.length > 0,\n items: transformedItems\n };\n },\n refine: function refine(props, searchState, nextRefinement) {\n return _refine(props, searchState, nextRefinement, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n }\n});","import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread\";\nimport PropTypes from 'prop-types';\nimport createConnector from '../core/createConnector';\n/**\n * connectCurrentRefinements connector provides the logic to build a widget that will\n * give the user the ability to remove all or some of the filters that were\n * set.\n * @name connectCurrentRefinements\n * @kind connector\n * @propType {function} [transformItems] - Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return.\n * @propType {function} [clearsQuery=false] - Pass true to also clear the search query\n * @providedPropType {function} refine - a function to remove a single filter\n * @providedPropType {array.<{label: string, attribute: string, currentRefinement: string || object, items: array, value: function}>} items - all the filters, the `value` is to pass to the `refine` function for removing all currentrefinements, `label` is for the display. When existing several refinements for the same atribute name, then you get a nested `items` object that contains a `label` and a `value` function to use to remove a single filter. `attribute` and `currentRefinement` are metadata containing row values.\n * @providedPropType {string} query - the search query\n */\n\nexport default createConnector({\n displayName: 'AlgoliaCurrentRefinements',\n propTypes: {\n transformItems: PropTypes.func\n },\n getProvidedProps: function getProvidedProps(props, searchState, searchResults, metadata) {\n var items = metadata.reduce(function (res, meta) {\n if (typeof meta.items !== 'undefined') {\n if (!props.clearsQuery && meta.id === 'query') {\n return res;\n } else {\n if (props.clearsQuery && meta.id === 'query' && meta.items[0].currentRefinement === '') {\n return res;\n }\n\n return res.concat(meta.items.map(function (item) {\n return _objectSpread({}, item, {\n id: meta.id,\n index: meta.index\n });\n }));\n }\n }\n\n return res;\n }, []);\n var transformedItems = props.transformItems ? props.transformItems(items) : items;\n return {\n items: transformedItems,\n canRefine: transformedItems.length > 0\n };\n },\n refine: function refine(props, searchState, items) {\n // `value` corresponds to our internal clear function computed in each connector metadata.\n var refinementsToClear = items instanceof Array ? items.map(function (item) {\n return item.value;\n }) : [items];\n return refinementsToClear.reduce(function (res, clear) {\n return clear(res);\n }, searchState);\n }\n});","import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport { objectHasKeys } from '../core/utils';\nimport createConnector from '../core/createConnector';\nimport { getResults, getCurrentRefinementValue, getIndexId, refineValue, cleanUpValue } from '../core/indexUtils';\n/**\n * The GeoSearch connector provides the logic to build a widget that will display the results on a map.\n * It also provides a way to search for results based on their position. The connector provides function to manage the search experience (search on map interaction).\n * @name connectGeoSearch\n * @kind connector\n * @requirements Note that the GeoSearch connector uses the [geosearch](https://www.algolia.com/doc/guides/searching/geo-search) capabilities of Algolia.\n * Your hits **must** have a `_geoloc` attribute in order to be passed to the rendering function. Currently, the feature is not compatible with multiple values in the `_geoloc` attribute\n * (e.g. a restaurant with multiple locations). In that case you can duplicate your records and use the [distinct](https://www.algolia.com/doc/guides/ranking/distinct) feature of Algolia to only retrieve unique results.\n * @propType {{ northEast: { lat: number, lng: number }, southWest: { lat: number, lng: number } }} [defaultRefinement] - Default search state of the widget containing the bounds for the map\n * @providedPropType {function({ northEast: { lat: number, lng: number }, southWest: { lat: number, lng: number } })} refine - a function to toggle the refinement\n * @providedPropType {function} createURL - a function to generate a URL for the corresponding search state\n * @providedPropType {array.} hits - the records that matched the search\n * @providedPropType {boolean} isRefinedWithMap - true if the current refinement is set with the map bounds\n * @providedPropType {{ northEast: { lat: number, lng: number }, southWest: { lat: number, lng: number } }} [currentRefinement] - the refinement currently applied\n * @providedPropType {{ lat: number, lng: number }} [position] - the position of the search\n */\n// To control the map with an external widget the other widget\n// **must** write the value in the attribute `aroundLatLng`\n\nvar getBoundingBoxId = function getBoundingBoxId() {\n return 'boundingBox';\n};\n\nvar getAroundLatLngId = function getAroundLatLngId() {\n return 'aroundLatLng';\n};\n\nvar getConfigureAroundLatLngId = function getConfigureAroundLatLngId() {\n return 'configure.aroundLatLng';\n};\n\nvar currentRefinementToString = function currentRefinementToString(currentRefinement) {\n return [currentRefinement.northEast.lat, currentRefinement.northEast.lng, currentRefinement.southWest.lat, currentRefinement.southWest.lng].join();\n};\n\nvar stringToCurrentRefinement = function stringToCurrentRefinement(value) {\n var values = value.split(',');\n return {\n northEast: {\n lat: parseFloat(values[0]),\n lng: parseFloat(values[1])\n },\n southWest: {\n lat: parseFloat(values[2]),\n lng: parseFloat(values[3])\n }\n };\n};\n\nvar latLngRegExp = /^(-?\\d+(?:\\.\\d+)?),\\s*(-?\\d+(?:\\.\\d+)?)$/;\n\nvar stringToPosition = function stringToPosition(value) {\n var pattern = value.match(latLngRegExp);\n return {\n lat: parseFloat(pattern[1]),\n lng: parseFloat(pattern[2])\n };\n};\n\nvar getCurrentRefinement = function getCurrentRefinement(props, searchState, context) {\n var refinement = getCurrentRefinementValue(props, searchState, context, getBoundingBoxId(), {});\n\n if (!objectHasKeys(refinement)) {\n return;\n } // eslint-disable-next-line consistent-return\n\n\n return {\n northEast: {\n lat: parseFloat(refinement.northEast.lat),\n lng: parseFloat(refinement.northEast.lng)\n },\n southWest: {\n lat: parseFloat(refinement.southWest.lat),\n lng: parseFloat(refinement.southWest.lng)\n }\n };\n};\n\nvar getCurrentPosition = function getCurrentPosition(props, searchState, context) {\n var defaultRefinement = props.defaultRefinement,\n propsWithoutDefaultRefinement = _objectWithoutProperties(props, [\"defaultRefinement\"]);\n\n var aroundLatLng = getCurrentRefinementValue(propsWithoutDefaultRefinement, searchState, context, getAroundLatLngId());\n\n if (!aroundLatLng) {\n // Fallback on `configure.aroundLatLng`\n var configureAroundLatLng = getCurrentRefinementValue(propsWithoutDefaultRefinement, searchState, context, getConfigureAroundLatLngId());\n return configureAroundLatLng && stringToPosition(configureAroundLatLng);\n }\n\n return aroundLatLng;\n};\n\nvar _refine = function refine(searchState, nextValue, context) {\n var resetPage = true;\n\n var nextRefinement = _defineProperty({}, getBoundingBoxId(), nextValue);\n\n return refineValue(searchState, nextRefinement, context, resetPage);\n};\n\nexport default createConnector({\n displayName: 'AlgoliaGeoSearch',\n getProvidedProps: function getProvidedProps(props, searchState, searchResults) {\n var context = {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n };\n var results = getResults(searchResults, context); // We read it from both because the SearchParameters & the searchState are not always\n // in sync. When we set the refinement the searchState is used but when we clear the refinement\n // the SearchParameters is used. In the first case when we render, the results are not there\n // so we can't find the value from the results. The most up to date value is the searchState.\n // But when we clear the refinement the searchState is immediately cleared even when the items\n // retrieved are still the one from the previous query with the bounding box. It leads to some\n // issue with the position of the map. We should rely on 1 source of truth or at least always\n // be sync.\n\n var currentRefinementFromSearchState = getCurrentRefinement(props, searchState, context);\n var currentRefinementFromSearchParameters = results && results._state.insideBoundingBox && stringToCurrentRefinement(results._state.insideBoundingBox) || undefined;\n var currentPositionFromSearchState = getCurrentPosition(props, searchState, context);\n var currentPositionFromSearchParameters = results && results._state.aroundLatLng && stringToPosition(results._state.aroundLatLng) || undefined;\n var currentRefinement = currentRefinementFromSearchState || currentRefinementFromSearchParameters;\n var position = currentPositionFromSearchState || currentPositionFromSearchParameters;\n return {\n hits: !results ? [] : results.hits.filter(function (_) {\n return Boolean(_._geoloc);\n }),\n isRefinedWithMap: Boolean(currentRefinement),\n currentRefinement: currentRefinement,\n position: position\n };\n },\n refine: function refine(props, searchState, nextValue) {\n return _refine(searchState, nextValue, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n },\n getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {\n var currentRefinement = getCurrentRefinement(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n\n if (!currentRefinement) {\n return searchParameters;\n }\n\n return searchParameters.setQueryParameter('insideBoundingBox', currentRefinementToString(currentRefinement));\n },\n cleanUp: function cleanUp(props, searchState) {\n return cleanUpValue(searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }, getBoundingBoxId());\n },\n getMetadata: function getMetadata(props, searchState) {\n var items = [];\n var id = getBoundingBoxId();\n var context = {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n };\n var index = getIndexId(context);\n var nextRefinement = {};\n var currentRefinement = getCurrentRefinement(props, searchState, context);\n\n if (currentRefinement) {\n items.push({\n label: \"\".concat(id, \": \").concat(currentRefinementToString(currentRefinement)),\n value: function value(nextState) {\n return _refine(nextState, nextRefinement, context);\n },\n currentRefinement: currentRefinement\n });\n }\n\n return {\n id: id,\n index: index,\n items: items\n };\n },\n shouldComponentUpdate: function shouldComponentUpdate() {\n return true;\n }\n});","import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread\";\nimport PropTypes from 'prop-types';\nimport algoliasearchHelper from 'algoliasearch-helper';\nimport createConnector from '../core/createConnector';\nimport { cleanUpValue, getIndexId, refineValue, getCurrentRefinementValue, getResults } from '../core/indexUtils';\nexport var getId = function getId(props) {\n return props.attributes[0];\n};\nvar namespace = 'hierarchicalMenu';\n\nfunction getCurrentRefinement(props, searchState, context) {\n var currentRefinement = getCurrentRefinementValue(props, searchState, context, \"\".concat(namespace, \".\").concat(getId(props)), null);\n\n if (currentRefinement === '') {\n return null;\n }\n\n return currentRefinement;\n}\n\nfunction getValue(path, props, searchState, context) {\n var id = props.id,\n attributes = props.attributes,\n separator = props.separator,\n rootPath = props.rootPath,\n showParentLevel = props.showParentLevel;\n var currentRefinement = getCurrentRefinement(props, searchState, context);\n var nextRefinement;\n\n if (currentRefinement === null) {\n nextRefinement = path;\n } else {\n var tmpSearchParameters = new algoliasearchHelper.SearchParameters({\n hierarchicalFacets: [{\n name: id,\n attributes: attributes,\n separator: separator,\n rootPath: rootPath,\n showParentLevel: showParentLevel\n }]\n });\n nextRefinement = tmpSearchParameters.toggleHierarchicalFacetRefinement(id, currentRefinement).toggleHierarchicalFacetRefinement(id, path).getHierarchicalRefinement(id)[0];\n }\n\n return nextRefinement;\n}\n\nfunction transformValue(value, props, searchState, context) {\n return value.map(function (v) {\n return {\n label: v.name,\n value: getValue(v.path, props, searchState, context),\n count: v.count,\n isRefined: v.isRefined,\n items: v.data && transformValue(v.data, props, searchState, context)\n };\n });\n}\n\nvar truncate = function truncate() {\n var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var limit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;\n return items.slice(0, limit).map(function () {\n var item = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return Array.isArray(item.items) ? _objectSpread({}, item, {\n items: truncate(item.items, limit)\n }) : item;\n });\n};\n\nfunction _refine(props, searchState, nextRefinement, context) {\n var id = getId(props);\n\n var nextValue = _defineProperty({}, id, nextRefinement || '');\n\n var resetPage = true;\n return refineValue(searchState, nextValue, context, resetPage, namespace);\n}\n\nfunction _cleanUp(props, searchState, context) {\n return cleanUpValue(searchState, context, \"\".concat(namespace, \".\").concat(getId(props)));\n}\n\nvar sortBy = ['name:asc'];\n/**\n * connectHierarchicalMenu connector provides the logic to build a widget that will\n * give the user the ability to explore a tree-like structure.\n * This is commonly used for multi-level categorization of products on e-commerce\n * websites. From a UX point of view, we suggest not displaying more than two levels deep.\n * @name connectHierarchicalMenu\n * @requirements To use this widget, your attributes must be formatted in a specific way.\n * If you want for example to have a hiearchical menu of categories, objects in your index\n * should be formatted this way:\n *\n * ```json\n * {\n * \"categories.lvl0\": \"products\",\n * \"categories.lvl1\": \"products > fruits\",\n * \"categories.lvl2\": \"products > fruits > citrus\"\n * }\n * ```\n *\n * It's also possible to provide more than one path for each level:\n *\n * ```json\n * {\n * \"categories.lvl0\": [\"products\", \"goods\"],\n * \"categories.lvl1\": [\"products > fruits\", \"goods > to eat\"]\n * }\n * ```\n *\n * All attributes passed to the `attributes` prop must be present in \"attributes for faceting\"\n * on the Algolia dashboard or configured as `attributesForFaceting` via a set settings call to the Algolia API.\n *\n * @kind connector\n * @propType {array.} attributes - List of attributes to use to generate the hierarchy of the menu. See the example for the convention to follow.\n * @propType {string} [defaultRefinement] - the item value selected by default\n * @propType {boolean} [showMore=false] - Flag to activate the show more button, for toggling the number of items between limit and showMoreLimit.\n * @propType {number} [limit=10] - The maximum number of items displayed.\n * @propType {number} [showMoreLimit=20] - The maximum number of items displayed when the user triggers the show more. Not considered if `showMore` is false.\n * @propType {string} [separator='>'] - Specifies the level separator used in the data.\n * @propType {string} [rootPath=null] - The path to use if the first level is not the root level.\n * @propType {boolean} [showParentLevel=true] - Flag to set if the parent level should be displayed.\n * @propType {function} [transformItems] - Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return.\n * @providedPropType {function} refine - a function to toggle a refinement\n * @providedPropType {function} createURL - a function to generate a URL for the corresponding search state\n * @providedPropType {string} currentRefinement - the refinement currently applied\n * @providedPropType {array.<{items: object, count: number, isRefined: boolean, label: string, value: string}>} items - the list of items the HierarchicalMenu can display. items has the same shape as parent items.\n */\n\nexport default createConnector({\n displayName: 'AlgoliaHierarchicalMenu',\n propTypes: {\n attributes: function attributes(props, propName, componentName) {\n var isNotString = function isNotString(val) {\n return typeof val !== 'string';\n };\n\n if (!Array.isArray(props[propName]) || props[propName].some(isNotString) || props[propName].length < 1) {\n return new Error(\"Invalid prop \".concat(propName, \" supplied to \").concat(componentName, \". Expected an Array of Strings\"));\n }\n\n return undefined;\n },\n separator: PropTypes.string,\n rootPath: PropTypes.string,\n showParentLevel: PropTypes.bool,\n defaultRefinement: PropTypes.string,\n showMore: PropTypes.bool,\n limit: PropTypes.number,\n showMoreLimit: PropTypes.number,\n transformItems: PropTypes.func\n },\n defaultProps: {\n showMore: false,\n limit: 10,\n showMoreLimit: 20,\n separator: ' > ',\n rootPath: null,\n showParentLevel: true\n },\n getProvidedProps: function getProvidedProps(props, searchState, searchResults) {\n var showMore = props.showMore,\n limit = props.limit,\n showMoreLimit = props.showMoreLimit;\n var id = getId(props);\n var results = getResults(searchResults, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n var isFacetPresent = Boolean(results) && Boolean(results.getFacetByName(id));\n\n if (!isFacetPresent) {\n return {\n items: [],\n currentRefinement: getCurrentRefinement(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }),\n canRefine: false\n };\n }\n\n var itemsLimit = showMore ? showMoreLimit : limit;\n var value = results.getFacetValues(id, {\n sortBy: sortBy\n });\n var items = value.data ? transformValue(value.data, props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }) : [];\n var transformedItems = props.transformItems ? props.transformItems(items) : items;\n return {\n items: truncate(transformedItems, itemsLimit),\n currentRefinement: getCurrentRefinement(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }),\n canRefine: transformedItems.length > 0\n };\n },\n refine: function refine(props, searchState, nextRefinement) {\n return _refine(props, searchState, nextRefinement, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n },\n cleanUp: function cleanUp(props, searchState) {\n return _cleanUp(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n },\n getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {\n var attributes = props.attributes,\n separator = props.separator,\n rootPath = props.rootPath,\n showParentLevel = props.showParentLevel,\n showMore = props.showMore,\n limit = props.limit,\n showMoreLimit = props.showMoreLimit,\n contextValue = props.contextValue;\n var id = getId(props);\n var itemsLimit = showMore ? showMoreLimit : limit;\n searchParameters = searchParameters.addHierarchicalFacet({\n name: id,\n attributes: attributes,\n separator: separator,\n rootPath: rootPath,\n showParentLevel: showParentLevel\n }).setQueryParameters({\n maxValuesPerFacet: Math.max(searchParameters.maxValuesPerFacet || 0, itemsLimit)\n });\n var currentRefinement = getCurrentRefinement(props, searchState, {\n ais: contextValue,\n multiIndexContext: props.indexContextValue\n });\n\n if (currentRefinement !== null) {\n searchParameters = searchParameters.toggleHierarchicalFacetRefinement(id, currentRefinement);\n }\n\n return searchParameters;\n },\n getMetadata: function getMetadata(props, searchState) {\n var rootAttribute = props.attributes[0];\n var id = getId(props);\n var currentRefinement = getCurrentRefinement(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n var items = !currentRefinement ? [] : [{\n label: \"\".concat(rootAttribute, \": \").concat(currentRefinement),\n attribute: rootAttribute,\n value: function value(nextState) {\n return _refine(props, nextState, '', {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n },\n currentRefinement: currentRefinement\n }];\n return {\n id: id,\n index: getIndexId({\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }),\n items: items\n };\n }\n});","import createConnector from '../core/createConnector';\nimport { HIGHLIGHT_TAGS, parseAlgoliaHit } from '../core/highlight';\n\nvar highlight = function highlight(_ref) {\n var attribute = _ref.attribute,\n hit = _ref.hit,\n highlightProperty = _ref.highlightProperty,\n _ref$preTag = _ref.preTag,\n preTag = _ref$preTag === void 0 ? HIGHLIGHT_TAGS.highlightPreTag : _ref$preTag,\n _ref$postTag = _ref.postTag,\n postTag = _ref$postTag === void 0 ? HIGHLIGHT_TAGS.highlightPostTag : _ref$postTag;\n return parseAlgoliaHit({\n attribute: attribute,\n highlightProperty: highlightProperty,\n hit: hit,\n preTag: preTag,\n postTag: postTag\n });\n};\n/**\n * connectHighlight connector provides the logic to create an highlighter\n * component that will retrieve, parse and render an highlighted attribute\n * from an Algolia hit.\n * @name connectHighlight\n * @kind connector\n * @category connector\n * @providedPropType {function} highlight - function to retrieve and parse an attribute from a hit. It takes a configuration object with 3 attributes: `highlightProperty` which is the property that contains the highlight structure from the records, `attribute` which is the name of the attribute (it can be either a string or an array of strings) to look for and `hit` which is the hit from Algolia. It returns an array of objects `{value: string, isHighlighted: boolean}`. If the element that corresponds to the attribute is an array of strings, it will return a nested array of objects.\n * @example\n * import React from 'react';\n * import algoliasearch from 'algoliasearch/lite';\n * import { InstantSearch, SearchBox, Hits, connectHighlight } from 'react-instantsearch-dom';\n *\n * const searchClient = algoliasearch(\n * 'latency',\n * '6be0576ff61c053d5f9a3225e2a90f76'\n * );\n *\n * const CustomHighlight = connectHighlight(\n * ({ highlight, attribute, hit, highlightProperty }) => {\n * const highlights = highlight({\n * highlightProperty: '_highlightResult',\n * attribute,\n * hit\n * });\n *\n * return highlights.map(part => part.isHighlighted ? (\n * {part.value}\n * ) : (\n * {part.value}\n * ));\n * }\n * );\n *\n * const Hit = ({ hit }) => (\n *

\n * \n *

\n * );\n *\n * const App = () => (\n * \n * \n * \n * \n * );\n */\n\n\nexport default createConnector({\n displayName: 'AlgoliaHighlighter',\n propTypes: {},\n getProvidedProps: function getProvidedProps() {\n return {\n highlight: highlight\n };\n }\n});","import createConnector from '../core/createConnector';\nimport { getResults } from '../core/indexUtils';\nimport { addAbsolutePositions, addQueryID } from '../core/utils';\n/**\n * connectHits connector provides the logic to create connected\n * components that will render the results retrieved from\n * Algolia.\n *\n * To configure the number of hits retrieved, use [HitsPerPage widget](widgets/HitsPerPage.html),\n * [connectHitsPerPage connector](connectors/connectHitsPerPage.html) or pass the hitsPerPage\n * prop to a [Configure](guide/Search_parameters.html) widget.\n *\n * **Warning:** you will need to use the **objectID** property available on every hit as a key\n * when iterating over them. This will ensure you have the best possible UI experience\n * especially on slow networks.\n * @name connectHits\n * @kind connector\n * @providedPropType {array.} hits - the records that matched the search state\n * @example\n * import React from 'react';\n * import algoliasearch from 'algoliasearch/lite';\n * import { InstantSearch, Highlight, connectHits } from 'react-instantsearch-dom';\n *\n * const searchClient = algoliasearch(\n * 'latency',\n * '6be0576ff61c053d5f9a3225e2a90f76'\n * );\n * const CustomHits = connectHits(({ hits }) => (\n *
\n * {hits.map(hit =>\n *

\n * \n *

\n * )}\n *
\n * ));\n *\n * const App = () => (\n * \n * \n * \n * );\n */\n\nexport default createConnector({\n displayName: 'AlgoliaHits',\n getProvidedProps: function getProvidedProps(props, searchState, searchResults) {\n var results = getResults(searchResults, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n\n if (!results) {\n return {\n hits: []\n };\n }\n\n var hitsWithPositions = addAbsolutePositions(results.hits, results.hitsPerPage, results.page);\n var hitsWithPositionsAndQueryID = addQueryID(hitsWithPositions, results.queryID);\n return {\n hits: hitsWithPositionsAndQueryID\n };\n },\n\n /**\n * Hits needs to be considered as a widget to trigger a search,\n * even if no other widgets are used.\n *\n * To be considered as a widget you need either:\n * - getSearchParameters\n * - getMetadata\n * - transitionState\n *\n * See: createConnector.tsx\n */\n getSearchParameters: function getSearchParameters(searchParameters) {\n return searchParameters;\n }\n});","import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread\";\nimport PropTypes from 'prop-types';\nimport createConnector from '../core/createConnector';\nimport { cleanUpValue, refineValue, getCurrentRefinementValue } from '../core/indexUtils';\n\nfunction getId() {\n return 'hitsPerPage';\n}\n\nfunction getCurrentRefinement(props, searchState, context) {\n var id = getId();\n var currentRefinement = getCurrentRefinementValue(props, searchState, context, id, null);\n\n if (typeof currentRefinement === 'string') {\n return parseInt(currentRefinement, 10);\n }\n\n return currentRefinement;\n}\n/**\n * connectHitsPerPage connector provides the logic to create connected\n * components that will allow a user to choose to display more or less results from Algolia.\n * @name connectHitsPerPage\n * @kind connector\n * @propType {number} defaultRefinement - The number of items selected by default\n * @propType {{value: number, label: string}[]} items - List of hits per page options.\n * @propType {function} [transformItems] - Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return.\n * @providedPropType {function} refine - a function to remove a single filter\n * @providedPropType {function} createURL - a function to generate a URL for the corresponding search state\n * @providedPropType {string} currentRefinement - the refinement currently applied\n * @providedPropType {array.<{isRefined: boolean, label?: string, value: number}>} items - the list of items the HitsPerPage can display. If no label provided, the value will be displayed.\n */\n\n\nexport default createConnector({\n displayName: 'AlgoliaHitsPerPage',\n propTypes: {\n defaultRefinement: PropTypes.number.isRequired,\n items: PropTypes.arrayOf(PropTypes.shape({\n label: PropTypes.string,\n value: PropTypes.number.isRequired\n })).isRequired,\n transformItems: PropTypes.func\n },\n getProvidedProps: function getProvidedProps(props, searchState) {\n var currentRefinement = getCurrentRefinement(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n var items = props.items.map(function (item) {\n return item.value === currentRefinement ? _objectSpread({}, item, {\n isRefined: true\n }) : _objectSpread({}, item, {\n isRefined: false\n });\n });\n return {\n items: props.transformItems ? props.transformItems(items) : items,\n currentRefinement: currentRefinement\n };\n },\n refine: function refine(props, searchState, nextRefinement) {\n var id = getId();\n\n var nextValue = _defineProperty({}, id, nextRefinement);\n\n var resetPage = true;\n return refineValue(searchState, nextValue, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }, resetPage);\n },\n cleanUp: function cleanUp(props, searchState) {\n return cleanUpValue(searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }, getId());\n },\n getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {\n return searchParameters.setHitsPerPage(getCurrentRefinement(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }));\n },\n getMetadata: function getMetadata() {\n return {\n id: getId()\n };\n }\n});","import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport isEqual from 'react-fast-compare';\nimport createConnector from '../core/createConnector';\nimport { getCurrentRefinementValue, refineValue, getResults } from '../core/indexUtils';\nimport { addAbsolutePositions, addQueryID } from '../core/utils';\n\nfunction getId() {\n return 'page';\n}\n\nfunction getCurrentRefinement(props, searchState, context) {\n var id = getId();\n var page = 1;\n var currentRefinement = getCurrentRefinementValue(props, searchState, context, id, page);\n\n if (typeof currentRefinement === 'string') {\n return parseInt(currentRefinement, 10);\n }\n\n return currentRefinement;\n}\n\nfunction getStateWithoutPage(state) {\n var _ref = state || {},\n page = _ref.page,\n rest = _objectWithoutProperties(_ref, [\"page\"]);\n\n return rest;\n}\n\nfunction getInMemoryCache() {\n var cachedHits = undefined;\n var cachedState = undefined;\n return {\n read: function read(_ref2) {\n var state = _ref2.state;\n return isEqual(cachedState, getStateWithoutPage(state)) ? cachedHits : null;\n },\n write: function write(_ref3) {\n var state = _ref3.state,\n hits = _ref3.hits;\n cachedState = getStateWithoutPage(state);\n cachedHits = hits;\n }\n };\n}\n\nfunction extractHitsFromCachedHits(cachedHits) {\n return Object.keys(cachedHits).map(Number).sort(function (a, b) {\n return a - b;\n }).reduce(function (acc, page) {\n return acc.concat(cachedHits[page]);\n }, []);\n}\n/**\n * InfiniteHits connector provides the logic to create connected\n * components that will render an continuous list of results retrieved from\n * Algolia. This connector provides a function to load more results.\n * @name connectInfiniteHits\n * @kind connector\n * @providedPropType {array.} hits - the records that matched the search state\n * @providedPropType {boolean} hasMore - indicates if there are more pages to load\n * @providedPropType {function} refine - call to load more results\n */\n\n\nexport default createConnector({\n displayName: 'AlgoliaInfiniteHits',\n getProvidedProps: function getProvidedProps(props, searchState, searchResults) {\n var _this = this;\n\n var results = getResults(searchResults, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n this._prevState = this._prevState || {};\n var cache = props.cache || getInMemoryCache();\n\n if (this._cachedHits === undefined) {\n this._cachedHits = cache.read({\n state: searchState\n }) || {};\n }\n\n if (!results) {\n return {\n hits: extractHitsFromCachedHits(this._cachedHits),\n hasPrevious: false,\n hasMore: false,\n refine: function refine() {},\n refinePrevious: function refinePrevious() {},\n refineNext: function refineNext() {}\n };\n }\n\n var page = results.page,\n hits = results.hits,\n hitsPerPage = results.hitsPerPage,\n nbPages = results.nbPages,\n _results$_state = results._state;\n _results$_state = _results$_state === void 0 ? {} : _results$_state;\n\n var p = _results$_state.page,\n currentState = _objectWithoutProperties(_results$_state, [\"page\"]);\n\n var hitsWithPositions = addAbsolutePositions(hits, hitsPerPage, page);\n var hitsWithPositionsAndQueryID = addQueryID(hitsWithPositions, results.queryID);\n\n if (!isEqual(currentState, this._prevState)) {\n this._cachedHits = cache.read({\n state: searchState\n }) || {};\n }\n\n if (this._cachedHits[page] === undefined) {\n this._cachedHits[page] = hitsWithPositionsAndQueryID;\n cache.write({\n state: searchState,\n hits: this._cachedHits\n });\n }\n\n this._prevState = currentState;\n /*\n Math.min() and Math.max() returns Infinity or -Infinity when no argument is given.\n But there is always something in this point because of `this._cachedHits[page]`.\n */\n\n var firstReceivedPage = Math.min.apply(Math, _toConsumableArray(Object.keys(this._cachedHits).map(Number)));\n var lastReceivedPage = Math.max.apply(Math, _toConsumableArray(Object.keys(this._cachedHits).map(Number)));\n var hasPrevious = firstReceivedPage > 0;\n var lastPageIndex = nbPages - 1;\n var hasMore = lastReceivedPage < lastPageIndex;\n\n var refinePrevious = function refinePrevious(event) {\n return _this.refine(event, firstReceivedPage - 1);\n };\n\n var refineNext = function refineNext(event) {\n return _this.refine(event, lastReceivedPage + 1);\n };\n\n return {\n hits: extractHitsFromCachedHits(this._cachedHits),\n hasPrevious: hasPrevious,\n hasMore: hasMore,\n refinePrevious: refinePrevious,\n refineNext: refineNext\n };\n },\n getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {\n return searchParameters.setQueryParameters({\n page: getCurrentRefinement(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }) - 1\n });\n },\n refine: function refine(props, searchState, event, index) {\n var pages = Object.keys(this._cachedHits || {}).map(Number);\n var lastReceivedPage = pages.length === 0 ? undefined : Math.max.apply(Math, _toConsumableArray(pages)); // If there is no key in `this._cachedHits`,\n // then `lastReceivedPage` should be `undefined`.\n\n if (index === undefined && lastReceivedPage !== undefined) {\n index = lastReceivedPage + 1;\n } else if (index === undefined) {\n index = getCurrentRefinement(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n }\n\n var id = getId();\n\n var nextValue = _defineProperty({}, id, index + 1);\n\n var resetPage = false;\n return refineValue(searchState, nextValue, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }, resetPage);\n }\n});","import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport PropTypes from 'prop-types';\nimport createConnector from '../core/createConnector';\nimport { getIndexId, cleanUpValue, refineValue, getCurrentRefinementValue, getResults } from '../core/indexUtils';\nvar namespace = 'menu';\n\nfunction getId(props) {\n return props.attribute;\n}\n\nfunction getCurrentRefinement(props, searchState, context) {\n var currentRefinement = getCurrentRefinementValue(props, searchState, context, \"\".concat(namespace, \".\").concat(getId(props)), null);\n\n if (currentRefinement === '') {\n return null;\n }\n\n return currentRefinement;\n}\n\nfunction getValue(name, props, searchState, context) {\n var currentRefinement = getCurrentRefinement(props, searchState, context);\n return name === currentRefinement ? '' : name;\n}\n\nfunction getLimit(_ref) {\n var showMore = _ref.showMore,\n limit = _ref.limit,\n showMoreLimit = _ref.showMoreLimit;\n return showMore ? showMoreLimit : limit;\n}\n\nfunction _refine(props, searchState, nextRefinement, context) {\n var id = getId(props);\n\n var nextValue = _defineProperty({}, id, nextRefinement ? nextRefinement : '');\n\n var resetPage = true;\n return refineValue(searchState, nextValue, context, resetPage, namespace);\n}\n\nfunction _cleanUp(props, searchState, context) {\n return cleanUpValue(searchState, context, \"\".concat(namespace, \".\").concat(getId(props)));\n}\n\nvar defaultSortBy = ['count:desc', 'name:asc'];\n/**\n * connectMenu connector provides the logic to build a widget that will\n * give the user the ability to choose a single value for a specific facet.\n * @name connectMenu\n * @requirements The attribute passed to the `attribute` prop must be present in \"attributes for faceting\"\n * on the Algolia dashboard or configured as `attributesForFaceting` via a set settings call to the Algolia API.\n * @kind connector\n * @propType {string} attribute - the name of the attribute in the record\n * @propType {boolean} [showMore=false] - true if the component should display a button that will expand the number of items\n * @propType {number} [limit=10] - the minimum number of diplayed items\n * @propType {number} [showMoreLimit=20] - the maximun number of displayed items. Only used when showMore is set to `true`\n * @propType {string} [defaultRefinement] - the value of the item selected by default\n * @propType {boolean} [searchable=false] - allow search inside values\n * @providedPropType {function} refine - a function to toggle a refinement\n * @providedPropType {function} createURL - a function to generate a URL for the corresponding search state\n * @providedPropType {string} currentRefinement - the refinement currently applied\n * @providedPropType {array.<{count: number, isRefined: boolean, label: string, value: string}>} items - the list of items the Menu can display.\n * @providedPropType {function} searchForItems - a function to toggle a search inside items values\n * @providedPropType {boolean} isFromSearch - a boolean that says if the `items` props contains facet values from the global search or from the search inside items.\n */\n\nexport default createConnector({\n displayName: 'AlgoliaMenu',\n propTypes: {\n attribute: PropTypes.string.isRequired,\n showMore: PropTypes.bool,\n limit: PropTypes.number,\n showMoreLimit: PropTypes.number,\n defaultRefinement: PropTypes.string,\n transformItems: PropTypes.func,\n searchable: PropTypes.bool\n },\n defaultProps: {\n showMore: false,\n limit: 10,\n showMoreLimit: 20\n },\n getProvidedProps: function getProvidedProps(props, searchState, searchResults, meta, searchForFacetValuesResults) {\n var attribute = props.attribute,\n searchable = props.searchable,\n indexContextValue = props.indexContextValue;\n var results = getResults(searchResults, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n var canRefine = Boolean(results) && Boolean(results.getFacetByName(attribute));\n var isFromSearch = Boolean(searchForFacetValuesResults && searchForFacetValuesResults[attribute] && searchForFacetValuesResults.query !== ''); // Search For Facet Values is not available with derived helper (used for multi index search)\n\n if (searchable && indexContextValue) {\n throw new Error('react-instantsearch: searching in *List is not available when used inside a' + ' multi index context');\n }\n\n if (!canRefine) {\n return {\n items: [],\n currentRefinement: getCurrentRefinement(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }),\n isFromSearch: isFromSearch,\n searchable: searchable,\n canRefine: canRefine\n };\n }\n\n var items;\n\n if (isFromSearch) {\n items = searchForFacetValuesResults[attribute].map(function (v) {\n return {\n label: v.value,\n value: getValue(v.value, props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }),\n _highlightResult: {\n label: {\n value: v.highlighted\n }\n },\n count: v.count,\n isRefined: v.isRefined\n };\n });\n } else {\n items = results.getFacetValues(attribute, {\n sortBy: searchable ? undefined : defaultSortBy\n }).map(function (v) {\n return {\n label: v.name,\n value: getValue(v.name, props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }),\n count: v.count,\n isRefined: v.isRefined\n };\n });\n }\n\n var transformedItems = props.transformItems ? props.transformItems(items) : items;\n return {\n items: transformedItems.slice(0, getLimit(props)),\n currentRefinement: getCurrentRefinement(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }),\n isFromSearch: isFromSearch,\n searchable: searchable,\n canRefine: transformedItems.length > 0\n };\n },\n refine: function refine(props, searchState, nextRefinement) {\n return _refine(props, searchState, nextRefinement, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n },\n searchForFacetValues: function searchForFacetValues(props, searchState, nextRefinement) {\n return {\n facetName: props.attribute,\n query: nextRefinement,\n maxFacetHits: getLimit(props)\n };\n },\n cleanUp: function cleanUp(props, searchState) {\n return _cleanUp(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n },\n getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {\n var attribute = props.attribute;\n searchParameters = searchParameters.setQueryParameters({\n maxValuesPerFacet: Math.max(searchParameters.maxValuesPerFacet || 0, getLimit(props))\n });\n searchParameters = searchParameters.addDisjunctiveFacet(attribute);\n var currentRefinement = getCurrentRefinement(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n\n if (currentRefinement !== null) {\n searchParameters = searchParameters.addDisjunctiveFacetRefinement(attribute, currentRefinement);\n }\n\n return searchParameters;\n },\n getMetadata: function getMetadata(props, searchState) {\n var id = getId(props);\n var currentRefinement = getCurrentRefinement(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n return {\n id: id,\n index: getIndexId({\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }),\n items: currentRefinement === null ? [] : [{\n label: \"\".concat(props.attribute, \": \").concat(currentRefinement),\n attribute: props.attribute,\n value: function value(nextState) {\n return _refine(props, nextState, '', {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n },\n currentRefinement: currentRefinement\n }]\n };\n }\n});","import arrayWithHoles from \"./arrayWithHoles\";\nimport iterableToArrayLimit from \"./iterableToArrayLimit\";\nimport nonIterableRest from \"./nonIterableRest\";\nexport default function _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || nonIterableRest();\n}","export default function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}","export default function _iterableToArrayLimit(arr, i) {\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}","export default function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n}","import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport PropTypes from 'prop-types';\nimport createConnector from '../core/createConnector';\nimport { find } from '../core/utils';\nimport { cleanUpValue, refineValue, getCurrentRefinementValue, getResults, getIndexId } from '../core/indexUtils';\n\nfunction stringifyItem(item) {\n if (typeof item.start === 'undefined' && typeof item.end === 'undefined') {\n return '';\n }\n\n var start = typeof item.start !== 'undefined' ? item.start : '';\n var end = typeof item.end !== 'undefined' ? item.end : '';\n return \"\".concat(start, \":\").concat(end);\n}\n\nfunction parseItem(value) {\n if (value.length === 0) {\n return {\n start: null,\n end: null\n };\n }\n\n var _value$split = value.split(':'),\n _value$split2 = _slicedToArray(_value$split, 2),\n startStr = _value$split2[0],\n endStr = _value$split2[1];\n\n return {\n start: startStr.length > 0 ? parseInt(startStr, 10) : null,\n end: endStr.length > 0 ? parseInt(endStr, 10) : null\n };\n}\n\nvar namespace = 'multiRange';\n\nfunction getId(props) {\n return props.attribute;\n}\n\nfunction getCurrentRefinement(props, searchState, context) {\n return getCurrentRefinementValue(props, searchState, context, \"\".concat(namespace, \".\").concat(getId(props)), '', function (currentRefinement) {\n if (currentRefinement === '') {\n return '';\n }\n\n return currentRefinement;\n });\n}\n\nfunction isRefinementsRangeIncludesInsideItemRange(stats, start, end) {\n return stats.min > start && stats.min < end || stats.max > start && stats.max < end;\n}\n\nfunction isItemRangeIncludedInsideRefinementsRange(stats, start, end) {\n return start > stats.min && start < stats.max || end > stats.min && end < stats.max;\n}\n\nfunction itemHasRefinement(attribute, results, value) {\n var stats = results.getFacetByName(attribute) ? results.getFacetStats(attribute) : null;\n var range = value.split(':');\n var start = Number(range[0]) === 0 || value === '' ? Number.NEGATIVE_INFINITY : Number(range[0]);\n var end = Number(range[1]) === 0 || value === '' ? Number.POSITIVE_INFINITY : Number(range[1]);\n return !(Boolean(stats) && (isRefinementsRangeIncludesInsideItemRange(stats, start, end) || isItemRangeIncludedInsideRefinementsRange(stats, start, end)));\n}\n\nfunction _refine(props, searchState, nextRefinement, context) {\n var nextValue = _defineProperty({}, getId(props, searchState), nextRefinement);\n\n var resetPage = true;\n return refineValue(searchState, nextValue, context, resetPage, namespace);\n}\n\nfunction _cleanUp(props, searchState, context) {\n return cleanUpValue(searchState, context, \"\".concat(namespace, \".\").concat(getId(props)));\n}\n/**\n * connectNumericMenu connector provides the logic to build a widget that will\n * give the user the ability to select a range value for a numeric attribute.\n * Ranges are defined statically.\n * @name connectNumericMenu\n * @requirements The attribute passed to the `attribute` prop must be holding numerical values.\n * @kind connector\n * @propType {string} attribute - the name of the attribute in the records\n * @propType {{label: string, start: number, end: number}[]} items - List of options. With a text label, and upper and lower bounds.\n * @propType {string} [defaultRefinement] - the value of the item selected by default, follow the shape of a `string` with a pattern of `'{start}:{end}'`.\n * @propType {function} [transformItems] - Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return.\n * @providedPropType {function} refine - a function to select a range.\n * @providedPropType {function} createURL - a function to generate a URL for the corresponding search state\n * @providedPropType {string} currentRefinement - the refinement currently applied. follow the shape of a `string` with a pattern of `'{start}:{end}'` which corresponds to the current selected item. For instance, when the selected item is `{start: 10, end: 20}`, the searchState of the widget is `'10:20'`. When `start` isn't defined, the searchState of the widget is `':{end}'`, and the same way around when `end` isn't defined. However, when neither `start` nor `end` are defined, the searchState is an empty string.\n * @providedPropType {array.<{isRefined: boolean, label: string, value: string, isRefined: boolean, noRefinement: boolean}>} items - the list of ranges the NumericMenu can display.\n */\n\n\nexport default createConnector({\n displayName: 'AlgoliaNumericMenu',\n propTypes: {\n id: PropTypes.string,\n attribute: PropTypes.string.isRequired,\n items: PropTypes.arrayOf(PropTypes.shape({\n label: PropTypes.node,\n start: PropTypes.number,\n end: PropTypes.number\n })).isRequired,\n transformItems: PropTypes.func\n },\n getProvidedProps: function getProvidedProps(props, searchState, searchResults) {\n var attribute = props.attribute;\n var currentRefinement = getCurrentRefinement(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n var results = getResults(searchResults, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n var items = props.items.map(function (item) {\n var value = stringifyItem(item);\n return {\n label: item.label,\n value: value,\n isRefined: value === currentRefinement,\n noRefinement: results ? itemHasRefinement(getId(props), results, value) : false\n };\n });\n var stats = results && results.getFacetByName(attribute) ? results.getFacetStats(attribute) : null;\n var refinedItem = find(items, function (item) {\n return item.isRefined === true;\n });\n\n if (!items.some(function (item) {\n return item.value === '';\n })) {\n items.push({\n value: '',\n isRefined: refinedItem === undefined,\n noRefinement: !stats,\n label: 'All'\n });\n }\n\n var transformedItems = props.transformItems ? props.transformItems(items) : items;\n return {\n items: transformedItems,\n currentRefinement: currentRefinement,\n canRefine: transformedItems.length > 0 && transformedItems.some(function (item) {\n return item.noRefinement === false;\n })\n };\n },\n refine: function refine(props, searchState, nextRefinement) {\n return _refine(props, searchState, nextRefinement, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n },\n cleanUp: function cleanUp(props, searchState) {\n return _cleanUp(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n },\n getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {\n var attribute = props.attribute;\n\n var _parseItem = parseItem(getCurrentRefinement(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n })),\n start = _parseItem.start,\n end = _parseItem.end;\n\n searchParameters = searchParameters.addDisjunctiveFacet(attribute);\n\n if (typeof start === 'number') {\n searchParameters = searchParameters.addNumericRefinement(attribute, '>=', start);\n }\n\n if (typeof end === 'number') {\n searchParameters = searchParameters.addNumericRefinement(attribute, '<=', end);\n }\n\n return searchParameters;\n },\n getMetadata: function getMetadata(props, searchState) {\n var id = getId(props);\n var value = getCurrentRefinement(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n var items = [];\n var index = getIndexId({\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n\n if (value !== '') {\n var _find = find(props.items, function (item) {\n return stringifyItem(item) === value;\n }),\n label = _find.label;\n\n items.push({\n label: \"\".concat(props.attribute, \": \").concat(label),\n attribute: props.attribute,\n currentRefinement: label,\n value: function value(nextState) {\n return _refine(props, nextState, '', {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n }\n });\n }\n\n return {\n id: id,\n index: index,\n items: items\n };\n }\n});","import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport createConnector from '../core/createConnector';\nimport { cleanUpValue, refineValue, getCurrentRefinementValue, getResults } from '../core/indexUtils';\n\nfunction getId() {\n return 'page';\n}\n\nfunction getCurrentRefinement(props, searchState, context) {\n var id = getId();\n var page = 1;\n var currentRefinement = getCurrentRefinementValue(props, searchState, context, id, page);\n\n if (typeof currentRefinement === 'string') {\n return parseInt(currentRefinement, 10);\n }\n\n return currentRefinement;\n}\n\nfunction _refine(props, searchState, nextPage, context) {\n var id = getId();\n\n var nextValue = _defineProperty({}, id, nextPage);\n\n var resetPage = false;\n return refineValue(searchState, nextValue, context, resetPage);\n}\n/**\n * connectPagination connector provides the logic to build a widget that will\n * let the user displays hits corresponding to a certain page.\n * @name connectPagination\n * @kind connector\n * @propType {boolean} [showFirst=true] - Display the first page link.\n * @propType {boolean} [showLast=false] - Display the last page link.\n * @propType {boolean} [showPrevious=true] - Display the previous page link.\n * @propType {boolean} [showNext=true] - Display the next page link.\n * @propType {number} [padding=3] - How many page links to display around the current page.\n * @propType {number} [totalPages=Infinity] - Maximum number of pages to display.\n * @providedPropType {function} refine - a function to remove a single filter\n * @providedPropType {function} createURL - a function to generate a URL for the corresponding search state\n * @providedPropType {number} nbPages - the total of existing pages\n * @providedPropType {number} currentRefinement - the page refinement currently applied\n */\n\n\nexport default createConnector({\n displayName: 'AlgoliaPagination',\n getProvidedProps: function getProvidedProps(props, searchState, searchResults) {\n var results = getResults(searchResults, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n\n if (!results) {\n return null;\n }\n\n var nbPages = results.nbPages;\n return {\n nbPages: nbPages,\n currentRefinement: getCurrentRefinement(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }),\n canRefine: nbPages > 1\n };\n },\n refine: function refine(props, searchState, nextPage) {\n return _refine(props, searchState, nextPage, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n },\n cleanUp: function cleanUp(props, searchState) {\n return cleanUpValue(searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }, getId());\n },\n getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {\n return searchParameters.setPage(getCurrentRefinement(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }) - 1);\n },\n getMetadata: function getMetadata() {\n return {\n id: getId()\n };\n }\n});","import createConnector from '../core/createConnector';\n/**\n * connectPoweredBy connector provides the logic to build a widget that\n * will display a link to algolia.\n * @name connectPoweredBy\n * @kind connector\n * @providedPropType {string} url - the url to redirect to algolia\n */\n\nexport default createConnector({\n displayName: 'AlgoliaPoweredBy',\n getProvidedProps: function getProvidedProps() {\n var hostname = typeof window === 'undefined' ? '' : window.location.hostname;\n var url = 'https://www.algolia.com/?' + 'utm_source=react-instantsearch&' + 'utm_medium=website&' + \"utm_content=\".concat(hostname, \"&\") + 'utm_campaign=poweredby';\n return {\n url: url\n };\n }\n});","import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport PropTypes from 'prop-types';\nimport createConnector from '../core/createConnector';\nimport { cleanUpValue, getIndexId, refineValue, getCurrentRefinementValue, getResults } from '../core/indexUtils';\n/**\n * connectRange connector provides the logic to create connected\n * components that will give the ability for a user to refine results using\n * a numeric range.\n * @name connectRange\n * @kind connector\n * @requirements The attribute passed to the `attribute` prop must be present in “attributes for faceting”\n * on the Algolia dashboard or configured as `attributesForFaceting` via a set settings call to the Algolia API.\n * The values inside the attribute must be JavaScript numbers (not strings).\n * @propType {string} attribute - Name of the attribute for faceting\n * @propType {{min?: number, max?: number}} [defaultRefinement] - Default searchState of the widget containing the start and the end of the range.\n * @propType {number} [min] - Minimum value. When this isn't set, the minimum value will be automatically computed by Algolia using the data in the index.\n * @propType {number} [max] - Maximum value. When this isn't set, the maximum value will be automatically computed by Algolia using the data in the index.\n * @propType {number} [precision=0] - Number of digits after decimal point to use.\n * @providedPropType {function} refine - a function to select a range.\n * @providedPropType {function} createURL - a function to generate a URL for the corresponding search state\n * @providedPropType {string} currentRefinement - the refinement currently applied\n * @providedPropType {number} min - the minimum value available.\n * @providedPropType {number} max - the maximum value available.\n * @providedPropType {number} precision - Number of digits after decimal point to use.\n */\n\nfunction getId(props) {\n return props.attribute;\n}\n\nvar namespace = 'range';\n\nfunction getCurrentRange(boundaries, stats, precision) {\n var pow = Math.pow(10, precision);\n var min;\n\n if (typeof boundaries.min === 'number' && isFinite(boundaries.min)) {\n min = boundaries.min;\n } else if (typeof stats.min === 'number' && isFinite(stats.min)) {\n min = stats.min;\n } else {\n min = undefined;\n }\n\n var max;\n\n if (typeof boundaries.max === 'number' && isFinite(boundaries.max)) {\n max = boundaries.max;\n } else if (typeof stats.max === 'number' && isFinite(stats.max)) {\n max = stats.max;\n } else {\n max = undefined;\n }\n\n return {\n min: min !== undefined ? Math.floor(min * pow) / pow : min,\n max: max !== undefined ? Math.ceil(max * pow) / pow : max\n };\n}\n\nfunction getCurrentRefinement(props, searchState, currentRange, context) {\n var _getCurrentRefinement = getCurrentRefinementValue(props, searchState, context, \"\".concat(namespace, \".\").concat(getId(props)), {}),\n min = _getCurrentRefinement.min,\n max = _getCurrentRefinement.max;\n\n var isFloatPrecision = Boolean(props.precision);\n var nextMin = min;\n\n if (typeof nextMin === 'string') {\n nextMin = isFloatPrecision ? parseFloat(nextMin) : parseInt(nextMin, 10);\n }\n\n var nextMax = max;\n\n if (typeof nextMax === 'string') {\n nextMax = isFloatPrecision ? parseFloat(nextMax) : parseInt(nextMax, 10);\n }\n\n var refinement = {\n min: nextMin,\n max: nextMax\n };\n var hasMinBound = props.min !== undefined;\n var hasMaxBound = props.max !== undefined;\n var hasMinRefinment = refinement.min !== undefined;\n var hasMaxRefinment = refinement.max !== undefined;\n\n if (hasMinBound && hasMinRefinment && refinement.min < currentRange.min) {\n throw Error(\"You can't provide min value lower than range.\");\n }\n\n if (hasMaxBound && hasMaxRefinment && refinement.max > currentRange.max) {\n throw Error(\"You can't provide max value greater than range.\");\n }\n\n if (hasMinBound && !hasMinRefinment) {\n refinement.min = currentRange.min;\n }\n\n if (hasMaxBound && !hasMaxRefinment) {\n refinement.max = currentRange.max;\n }\n\n return refinement;\n}\n\nfunction getCurrentRefinementWithRange(refinement, range) {\n return {\n min: refinement.min !== undefined ? refinement.min : range.min,\n max: refinement.max !== undefined ? refinement.max : range.max\n };\n}\n\nfunction nextValueForRefinement(hasBound, isReset, range, value) {\n var next;\n\n if (!hasBound && range === value) {\n next = undefined;\n } else if (hasBound && isReset) {\n next = range;\n } else {\n next = value;\n }\n\n return next;\n}\n\nfunction _refine(props, searchState, nextRefinement, currentRange, context) {\n var nextMin = nextRefinement.min,\n nextMax = nextRefinement.max;\n var currentMinRange = currentRange.min,\n currentMaxRange = currentRange.max;\n var isMinReset = nextMin === undefined || nextMin === '';\n var isMaxReset = nextMax === undefined || nextMax === '';\n var nextMinAsNumber = !isMinReset ? parseFloat(nextMin) : undefined;\n var nextMaxAsNumber = !isMaxReset ? parseFloat(nextMax) : undefined;\n var isNextMinValid = isMinReset || isFinite(nextMinAsNumber);\n var isNextMaxValid = isMaxReset || isFinite(nextMaxAsNumber);\n\n if (!isNextMinValid || !isNextMaxValid) {\n throw Error(\"You can't provide non finite values to the range connector.\");\n }\n\n if (nextMinAsNumber < currentMinRange) {\n throw Error(\"You can't provide min value lower than range.\");\n }\n\n if (nextMaxAsNumber > currentMaxRange) {\n throw Error(\"You can't provide max value greater than range.\");\n }\n\n var id = getId(props);\n var resetPage = true;\n\n var nextValue = _defineProperty({}, id, {\n min: nextValueForRefinement(props.min !== undefined, isMinReset, currentMinRange, nextMinAsNumber),\n max: nextValueForRefinement(props.max !== undefined, isMaxReset, currentMaxRange, nextMaxAsNumber)\n });\n\n return refineValue(searchState, nextValue, context, resetPage, namespace);\n}\n\nfunction _cleanUp(props, searchState, context) {\n return cleanUpValue(searchState, context, \"\".concat(namespace, \".\").concat(getId(props)));\n}\n\nexport default createConnector({\n displayName: 'AlgoliaRange',\n propTypes: {\n id: PropTypes.string,\n attribute: PropTypes.string.isRequired,\n defaultRefinement: PropTypes.shape({\n min: PropTypes.number,\n max: PropTypes.number\n }),\n min: PropTypes.number,\n max: PropTypes.number,\n precision: PropTypes.number,\n header: PropTypes.node,\n footer: PropTypes.node\n },\n defaultProps: {\n precision: 0\n },\n getProvidedProps: function getProvidedProps(props, searchState, searchResults) {\n var attribute = props.attribute,\n precision = props.precision,\n minBound = props.min,\n maxBound = props.max;\n var results = getResults(searchResults, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n var hasFacet = results && results.getFacetByName(attribute);\n var stats = hasFacet ? results.getFacetStats(attribute) || {} : {};\n var facetValues = hasFacet ? results.getFacetValues(attribute) : [];\n var count = facetValues.map(function (v) {\n return {\n value: v.name,\n count: v.count\n };\n });\n\n var _getCurrentRange = getCurrentRange({\n min: minBound,\n max: maxBound\n }, stats, precision),\n rangeMin = _getCurrentRange.min,\n rangeMax = _getCurrentRange.max; // The searchState is not always in sync with the helper state. For example\n // when we set boundaries on the first render the searchState don't have\n // the correct refinement. If this behavior change in the upcoming version\n // we could store the range inside the searchState instead of rely on `this`.\n\n\n this._currentRange = {\n min: rangeMin,\n max: rangeMax\n };\n var currentRefinement = getCurrentRefinement(props, searchState, this._currentRange, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n return {\n min: rangeMin,\n max: rangeMax,\n canRefine: count.length > 0,\n currentRefinement: getCurrentRefinementWithRange(currentRefinement, this._currentRange),\n count: count,\n precision: precision\n };\n },\n refine: function refine(props, searchState, nextRefinement) {\n return _refine(props, searchState, nextRefinement, this._currentRange, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n },\n cleanUp: function cleanUp(props, searchState) {\n return _cleanUp(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n },\n getSearchParameters: function getSearchParameters(params, props, searchState) {\n var attribute = props.attribute;\n\n var _getCurrentRefinement2 = getCurrentRefinement(props, searchState, this._currentRange, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }),\n min = _getCurrentRefinement2.min,\n max = _getCurrentRefinement2.max;\n\n params = params.addDisjunctiveFacet(attribute);\n\n if (min !== undefined) {\n params = params.addNumericRefinement(attribute, '>=', min);\n }\n\n if (max !== undefined) {\n params = params.addNumericRefinement(attribute, '<=', max);\n }\n\n return params;\n },\n getMetadata: function getMetadata(props, searchState) {\n var _this = this;\n\n var _this$_currentRange = this._currentRange,\n minRange = _this$_currentRange.min,\n maxRange = _this$_currentRange.max;\n\n var _getCurrentRefinement3 = getCurrentRefinement(props, searchState, this._currentRange, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }),\n minValue = _getCurrentRefinement3.min,\n maxValue = _getCurrentRefinement3.max;\n\n var items = [];\n var hasMin = minValue !== undefined;\n var hasMax = maxValue !== undefined;\n var shouldDisplayMinLabel = hasMin && minValue !== minRange;\n var shouldDisplayMaxLabel = hasMax && maxValue !== maxRange;\n\n if (shouldDisplayMinLabel || shouldDisplayMaxLabel) {\n var fragments = [hasMin ? \"\".concat(minValue, \" <= \") : '', props.attribute, hasMax ? \" <= \".concat(maxValue) : ''];\n items.push({\n label: fragments.join(''),\n attribute: props.attribute,\n value: function value(nextState) {\n return _refine(props, nextState, {}, _this._currentRange, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n },\n currentRefinement: getCurrentRefinementWithRange({\n min: minValue,\n max: maxValue\n }, {\n min: minRange,\n max: maxRange\n })\n });\n }\n\n return {\n id: getId(props),\n index: getIndexId({\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }),\n items: items\n };\n }\n});","import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport PropTypes from 'prop-types';\nimport createConnector from '../core/createConnector';\nimport { cleanUpValue, getIndexId, refineValue, getCurrentRefinementValue, getResults } from '../core/indexUtils';\nvar namespace = 'refinementList';\n\nfunction getId(props) {\n return props.attribute;\n}\n\nfunction getCurrentRefinement(props, searchState, context) {\n var currentRefinement = getCurrentRefinementValue(props, searchState, context, \"\".concat(namespace, \".\").concat(getId(props)), []);\n\n if (typeof currentRefinement !== 'string') {\n return currentRefinement;\n }\n\n if (currentRefinement) {\n return [currentRefinement];\n }\n\n return [];\n}\n\nfunction getValue(name, props, searchState, context) {\n var currentRefinement = getCurrentRefinement(props, searchState, context);\n var isAnewValue = currentRefinement.indexOf(name) === -1;\n var nextRefinement = isAnewValue ? currentRefinement.concat([name]) // cannot use .push(), it mutates\n : currentRefinement.filter(function (selectedValue) {\n return selectedValue !== name;\n }); // cannot use .splice(), it mutates\n\n return nextRefinement;\n}\n\nfunction getLimit(_ref) {\n var showMore = _ref.showMore,\n limit = _ref.limit,\n showMoreLimit = _ref.showMoreLimit;\n return showMore ? showMoreLimit : limit;\n}\n\nfunction _refine(props, searchState, nextRefinement, context) {\n var id = getId(props); // Setting the value to an empty string ensures that it is persisted in\n // the URL as an empty value.\n // This is necessary in the case where `defaultRefinement` contains one\n // item and we try to deselect it. `nextSelected` would be an empty array,\n // which would not be persisted to the URL.\n // {foo: ['bar']} => \"foo[0]=bar\"\n // {foo: []} => \"\"\n\n var nextValue = _defineProperty({}, id, nextRefinement.length > 0 ? nextRefinement : '');\n\n var resetPage = true;\n return refineValue(searchState, nextValue, context, resetPage, namespace);\n}\n\nfunction _cleanUp(props, searchState, context) {\n return cleanUpValue(searchState, context, \"\".concat(namespace, \".\").concat(getId(props)));\n}\n/**\n * connectRefinementList connector provides the logic to build a widget that will\n * give the user the ability to choose multiple values for a specific facet.\n * @name connectRefinementList\n * @kind connector\n * @requirements The attribute passed to the `attribute` prop must be present in \"attributes for faceting\"\n * on the Algolia dashboard or configured as `attributesForFaceting` via a set settings call to the Algolia API.\n * @propType {string} attribute - the name of the attribute in the record\n * @propType {boolean} [searchable=false] - allow search inside values\n * @propType {string} [operator=or] - How to apply the refinements. Possible values: 'or' or 'and'.\n * @propType {boolean} [showMore=false] - true if the component should display a button that will expand the number of items\n * @propType {number} [limit=10] - the minimum number of displayed items\n * @propType {number} [showMoreLimit=20] - the maximun number of displayed items. Only used when showMore is set to `true`\n * @propType {string[]} defaultRefinement - the values of the items selected by default. The searchState of this widget takes the form of a list of `string`s, which correspond to the values of all selected refinements. However, when there are no refinements selected, the value of the searchState is an empty string.\n * @propType {function} [transformItems] - Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return.\n * @providedPropType {function} refine - a function to toggle a refinement\n * @providedPropType {function} createURL - a function to generate a URL for the corresponding search state\n * @providedPropType {string[]} currentRefinement - the refinement currently applied\n * @providedPropType {array.<{count: number, isRefined: boolean, label: string, value: string}>} items - the list of items the RefinementList can display.\n * @providedPropType {function} searchForItems - a function to toggle a search inside items values\n * @providedPropType {boolean} isFromSearch - a boolean that says if the `items` props contains facet values from the global search or from the search inside items.\n * @providedPropType {boolean} canRefine - a boolean that says whether you can refine\n */\n\n\nvar sortBy = ['isRefined', 'count:desc', 'name:asc'];\nexport default createConnector({\n displayName: 'AlgoliaRefinementList',\n propTypes: {\n id: PropTypes.string,\n attribute: PropTypes.string.isRequired,\n operator: PropTypes.oneOf(['and', 'or']),\n showMore: PropTypes.bool,\n limit: PropTypes.number,\n showMoreLimit: PropTypes.number,\n defaultRefinement: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])),\n searchable: PropTypes.bool,\n transformItems: PropTypes.func\n },\n defaultProps: {\n operator: 'or',\n showMore: false,\n limit: 10,\n showMoreLimit: 20\n },\n getProvidedProps: function getProvidedProps(props, searchState, searchResults, metadata, searchForFacetValuesResults) {\n var attribute = props.attribute,\n searchable = props.searchable,\n indexContextValue = props.indexContextValue;\n var results = getResults(searchResults, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n var canRefine = Boolean(results) && Boolean(results.getFacetByName(attribute));\n var isFromSearch = Boolean(searchForFacetValuesResults && searchForFacetValuesResults[attribute] && searchForFacetValuesResults.query !== ''); // Search For Facet Values is not available with derived helper (used for multi index search)\n\n if (searchable && indexContextValue) {\n throw new Error('react-instantsearch: searching in *List is not available when used inside a' + ' multi index context');\n }\n\n if (!canRefine) {\n return {\n items: [],\n currentRefinement: getCurrentRefinement(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }),\n canRefine: canRefine,\n isFromSearch: isFromSearch,\n searchable: searchable\n };\n }\n\n var items = isFromSearch ? searchForFacetValuesResults[attribute].map(function (v) {\n return {\n label: v.value,\n value: getValue(v.value, props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }),\n _highlightResult: {\n label: {\n value: v.highlighted\n }\n },\n count: v.count,\n isRefined: v.isRefined\n };\n }) : results.getFacetValues(attribute, {\n sortBy: sortBy\n }).map(function (v) {\n return {\n label: v.name,\n value: getValue(v.name, props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }),\n count: v.count,\n isRefined: v.isRefined\n };\n });\n var transformedItems = props.transformItems ? props.transformItems(items) : items;\n return {\n items: transformedItems.slice(0, getLimit(props)),\n currentRefinement: getCurrentRefinement(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }),\n isFromSearch: isFromSearch,\n searchable: searchable,\n canRefine: transformedItems.length > 0\n };\n },\n refine: function refine(props, searchState, nextRefinement) {\n return _refine(props, searchState, nextRefinement, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n },\n searchForFacetValues: function searchForFacetValues(props, searchState, nextRefinement) {\n return {\n facetName: props.attribute,\n query: nextRefinement,\n maxFacetHits: getLimit(props)\n };\n },\n cleanUp: function cleanUp(props, searchState) {\n return _cleanUp(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n },\n getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {\n var attribute = props.attribute,\n operator = props.operator;\n var addKey = operator === 'and' ? 'addFacet' : 'addDisjunctiveFacet';\n var addRefinementKey = \"\".concat(addKey, \"Refinement\");\n searchParameters = searchParameters.setQueryParameters({\n maxValuesPerFacet: Math.max(searchParameters.maxValuesPerFacet || 0, getLimit(props))\n });\n searchParameters = searchParameters[addKey](attribute);\n return getCurrentRefinement(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }).reduce(function (res, val) {\n return res[addRefinementKey](attribute, val);\n }, searchParameters);\n },\n getMetadata: function getMetadata(props, searchState) {\n var id = getId(props);\n var context = {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n };\n return {\n id: id,\n index: getIndexId(context),\n items: getCurrentRefinement(props, searchState, context).length > 0 ? [{\n attribute: props.attribute,\n label: \"\".concat(props.attribute, \": \"),\n currentRefinement: getCurrentRefinement(props, searchState, context),\n value: function value(nextState) {\n return _refine(props, nextState, [], context);\n },\n items: getCurrentRefinement(props, searchState, context).map(function (item) {\n return {\n label: \"\".concat(item),\n value: function value(nextState) {\n var nextSelectedItems = getCurrentRefinement(props, nextState, context).filter(function (other) {\n return other !== item;\n });\n return _refine(props, searchState, nextSelectedItems, context);\n }\n };\n })\n }] : []\n };\n }\n});","import PropTypes from 'prop-types';\nimport createConnector from '../core/createConnector';\nimport { getCurrentRefinementValue, hasMultipleIndices, getIndexId } from '../core/indexUtils';\nimport { shallowEqual, omit } from '../core/utils';\n/**\n * connectScrollTo connector provides the logic to build a widget that will\n * let the page scroll to a certain point.\n * @name connectScrollTo\n * @kind connector\n * @propType {string} [scrollOn=\"page\"] - Widget searchState key on which to listen for changes, default to the pagination widget.\n * @providedPropType {any} value - the current refinement applied to the widget listened by scrollTo\n * @providedPropType {boolean} hasNotChanged - indicates whether the refinement came from the scrollOn argument (for instance page by default)\n */\n\nexport default createConnector({\n displayName: 'AlgoliaScrollTo',\n propTypes: {\n scrollOn: PropTypes.string\n },\n defaultProps: {\n scrollOn: 'page'\n },\n getProvidedProps: function getProvidedProps(props, searchState) {\n var id = props.scrollOn;\n var value = getCurrentRefinementValue(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }, id, null);\n\n if (!this._prevSearchState) {\n this._prevSearchState = {};\n } // Get the subpart of the state that interest us\n\n\n if (hasMultipleIndices({\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n })) {\n searchState = searchState.indices ? searchState.indices[getIndexId({\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n })] : {};\n } // if there is a change in the app that has been triggered by another element\n // than \"props.scrollOn (id) or the Configure widget, we need to keep track of\n // the search state to know if there's a change in the app that was not triggered\n // by the props.scrollOn (id) or the Configure widget. This is useful when\n // using ScrollTo in combination of Pagination. As pagination can be change\n // by every widget, we want to scroll only if it cames from the pagination\n // widget itself. We also remove the configure key from the search state to\n // do this comparison because for now configure values are not present in the\n // search state before a first refinement has been made and will false the results.\n // See: https://github.com/algolia/react-instantsearch/issues/164\n\n\n var cleanedSearchState = omit(searchState, ['configure', id]);\n var hasNotChanged = shallowEqual(this._prevSearchState, cleanedSearchState);\n this._prevSearchState = cleanedSearchState;\n return {\n value: value,\n hasNotChanged: hasNotChanged\n };\n }\n});","import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport PropTypes from 'prop-types';\nimport createConnector from '../core/createConnector';\nimport { cleanUpValue, refineValue, getCurrentRefinementValue, getIndexId } from '../core/indexUtils';\n\nfunction getId() {\n return 'query';\n}\n\nfunction getCurrentRefinement(props, searchState, context) {\n var id = getId(props);\n var currentRefinement = getCurrentRefinementValue(props, searchState, context, id, '');\n\n if (currentRefinement) {\n return currentRefinement;\n }\n\n return '';\n}\n\nfunction _refine(props, searchState, nextRefinement, context) {\n var id = getId();\n\n var nextValue = _defineProperty({}, id, nextRefinement);\n\n var resetPage = true;\n return refineValue(searchState, nextValue, context, resetPage);\n}\n\nfunction _cleanUp(props, searchState, context) {\n return cleanUpValue(searchState, context, getId());\n}\n/**\n * connectSearchBox connector provides the logic to build a widget that will\n * let the user search for a query\n * @name connectSearchBox\n * @kind connector\n * @propType {string} [defaultRefinement] - Provide a default value for the query\n * @providedPropType {function} refine - a function to change the current query\n * @providedPropType {string} currentRefinement - the current query used\n * @providedPropType {boolean} isSearchStalled - a flag that indicates if InstantSearch has detected that searches are stalled\n */\n\n\nexport default createConnector({\n displayName: 'AlgoliaSearchBox',\n propTypes: {\n defaultRefinement: PropTypes.string\n },\n getProvidedProps: function getProvidedProps(props, searchState, searchResults) {\n return {\n currentRefinement: getCurrentRefinement(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }),\n isSearchStalled: searchResults.isSearchStalled\n };\n },\n refine: function refine(props, searchState, nextRefinement) {\n return _refine(props, searchState, nextRefinement, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n },\n cleanUp: function cleanUp(props, searchState) {\n return _cleanUp(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n },\n getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {\n return searchParameters.setQuery(getCurrentRefinement(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }));\n },\n getMetadata: function getMetadata(props, searchState) {\n var id = getId(props);\n var currentRefinement = getCurrentRefinement(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n return {\n id: id,\n index: getIndexId({\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }),\n items: currentRefinement === null ? [] : [{\n label: \"\".concat(id, \": \").concat(currentRefinement),\n value: function value(nextState) {\n return _refine(props, nextState, '', {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n },\n currentRefinement: currentRefinement\n }]\n };\n }\n});","import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread\";\nimport PropTypes from 'prop-types';\nimport createConnector from '../core/createConnector';\nimport { cleanUpValue, refineValue, getCurrentRefinementValue } from '../core/indexUtils';\n\nfunction getId() {\n return 'sortBy';\n}\n\nfunction getCurrentRefinement(props, searchState, context) {\n var id = getId(props);\n var currentRefinement = getCurrentRefinementValue(props, searchState, context, id, null);\n\n if (currentRefinement) {\n return currentRefinement;\n }\n\n return null;\n}\n/**\n * The connectSortBy connector provides the logic to build a widget that will\n * display a list of indices. This allows a user to change how the hits are being sorted.\n * @name connectSortBy\n * @requirements Algolia handles sorting by creating replica indices. [Read more about sorting](https://www.algolia.com/doc/guides/relevance/sorting/) on\n * the Algolia website.\n * @kind connector\n * @propType {string} defaultRefinement - The default selected index.\n * @propType {{value: string, label: string}[]} items - The list of indexes to search in.\n * @propType {function} [transformItems] - Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return.\n * @providedPropType {function} refine - a function to remove a single filter\n * @providedPropType {function} createURL - a function to generate a URL for the corresponding search state\n * @providedPropType {string[]} currentRefinement - the refinement currently applied\n * @providedPropType {array.<{isRefined: boolean, label?: string, value: string}>} items - the list of items the HitsPerPage can display. If no label provided, the value will be displayed.\n */\n\n\nexport default createConnector({\n displayName: 'AlgoliaSortBy',\n propTypes: {\n defaultRefinement: PropTypes.string,\n items: PropTypes.arrayOf(PropTypes.shape({\n label: PropTypes.string,\n value: PropTypes.string.isRequired\n })).isRequired,\n transformItems: PropTypes.func\n },\n getProvidedProps: function getProvidedProps(props, searchState) {\n var currentRefinement = getCurrentRefinement(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n var items = props.items.map(function (item) {\n return item.value === currentRefinement ? _objectSpread({}, item, {\n isRefined: true\n }) : _objectSpread({}, item, {\n isRefined: false\n });\n });\n return {\n items: props.transformItems ? props.transformItems(items) : items,\n currentRefinement: currentRefinement\n };\n },\n refine: function refine(props, searchState, nextRefinement) {\n var id = getId();\n\n var nextValue = _defineProperty({}, id, nextRefinement);\n\n var resetPage = true;\n return refineValue(searchState, nextValue, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }, resetPage);\n },\n cleanUp: function cleanUp(props, searchState) {\n return cleanUpValue(searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n }, getId());\n },\n getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {\n var selectedIndex = getCurrentRefinement(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n return searchParameters.setIndex(selectedIndex);\n },\n getMetadata: function getMetadata() {\n return {\n id: getId()\n };\n }\n});","import createConnector from '../core/createConnector';\nimport { getResults } from '../core/indexUtils';\n/**\n * The `connectStateResults` connector provides a way to access the `searchState` and the `searchResults`\n * of InstantSearch.\n * For instance this connector allows you to create results/noResults or query/noQuery pages.\n * @name connectStateResults\n * @kind connector\n * @providedPropType {object} searchState - The search state of the instant search component.

See: [Search state structure](https://community.algolia.com/react-instantsearch/guide/Search_state.html)\n * @providedPropType {object} searchResults - The search results.

In case of multiple indices: if used under ``, results will be those of the corresponding index otherwise it'll be those of the root index See: [Search results structure](https://community.algolia.com/algoliasearch-helper-js/reference.html#searchresults)\n * @providedPropType {object} allSearchResults - In case of multiple indices you can retrieve all the results\n * @providedPropType {string} error - If the search failed, the error will be logged here.\n * @providedPropType {boolean} searching - If there is a search in progress.\n * @providedPropType {boolean} isSearchStalled - Flag that indicates if React InstantSearch has detected that searches are stalled.\n * @providedPropType {boolean} searchingForFacetValues - If there is a search in a list in progress.\n * @providedPropType {object} props - component props.\n * @example\n * import React from 'react';\n * import algoliasearch from 'algoliasearch/lite';\n * import { InstantSearch, SearchBox, Hits, connectStateResults } from 'react-instantsearch-dom';\n *\n * const searchClient = algoliasearch(\n * 'latency',\n * '6be0576ff61c053d5f9a3225e2a90f76'\n * );\n *\n * const Content = connectStateResults(({ searchState, searchResults }) => {\n * const hasResults = searchResults && searchResults.nbHits !== 0;\n *\n * return (\n *
\n * \n * \n *
\n * );\n * });\n *\n * const App = () => (\n * \n * \n * \n * \n * );\n */\n\nexport default createConnector({\n displayName: 'AlgoliaStateResults',\n getProvidedProps: function getProvidedProps(props, searchState, searchResults) {\n var results = getResults(searchResults, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n return {\n searchState: searchState,\n searchResults: results,\n allSearchResults: searchResults.results,\n searching: searchResults.searching,\n isSearchStalled: searchResults.isSearchStalled,\n error: searchResults.error,\n searchingForFacetValues: searchResults.searchingForFacetValues,\n props: props\n };\n }\n});","import createConnector from '../core/createConnector';\nimport { getResults } from '../core/indexUtils';\n/**\n * connectStats connector provides the logic to build a widget that will\n * displays algolia search statistics (hits number and processing time).\n * @name connectStats\n * @kind connector\n * @providedPropType {number} nbHits - number of hits returned by Algolia.\n * @providedPropType {number} processingTimeMS - the time in ms took by Algolia to search for results.\n */\n\nexport default createConnector({\n displayName: 'AlgoliaStats',\n getProvidedProps: function getProvidedProps(props, searchState, searchResults) {\n var results = getResults(searchResults, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n\n if (!results) {\n return null;\n }\n\n return {\n nbHits: results.nbHits,\n processingTimeMS: results.processingTimeMS\n };\n }\n});","import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport PropTypes from 'prop-types';\nimport { find } from '../core/utils';\nimport createConnector from '../core/createConnector';\nimport { cleanUpValue, getIndexId, getResults, refineValue, getCurrentRefinementValue } from '../core/indexUtils';\n\nfunction getId(props) {\n return props.attribute;\n}\n\nvar namespace = 'toggle';\nvar falsyStrings = ['0', 'false', 'null', 'undefined'];\n\nfunction getCurrentRefinement(props, searchState, context) {\n var currentRefinement = getCurrentRefinementValue(props, searchState, context, \"\".concat(namespace, \".\").concat(getId(props)), false);\n\n if (falsyStrings.indexOf(currentRefinement) !== -1) {\n return false;\n }\n\n return Boolean(currentRefinement);\n}\n\nfunction _refine(props, searchState, nextRefinement, context) {\n var id = getId(props);\n\n var nextValue = _defineProperty({}, id, nextRefinement ? nextRefinement : false);\n\n var resetPage = true;\n return refineValue(searchState, nextValue, context, resetPage, namespace);\n}\n\nfunction _cleanUp(props, searchState, context) {\n return cleanUpValue(searchState, context, \"\".concat(namespace, \".\").concat(getId(props)));\n}\n/**\n * connectToggleRefinement connector provides the logic to build a widget that will\n * provides an on/off filtering feature based on an attribute value.\n * @name connectToggleRefinement\n * @kind connector\n * @requirements To use this widget, you'll need an attribute to toggle on.\n *\n * You can't toggle on null or not-null values. If you want to address this particular use-case you'll need to compute an\n * extra boolean attribute saying if the value exists or not. See this [thread](https://discourse.algolia.com/t/how-to-create-a-toggle-for-the-absence-of-a-string-attribute/2460) for more details.\n *\n * @propType {string} attribute - Name of the attribute on which to apply the `value` refinement. Required when `value` is present.\n * @propType {string} label - Label for the toggle.\n * @propType {string} value - Value of the refinement to apply on `attribute`.\n * @propType {boolean} [defaultRefinement=false] - Default searchState of the widget. Should the toggle be checked by default?\n * @providedPropType {boolean} currentRefinement - `true` when the refinement is applied, `false` otherwise\n * @providedPropType {object} count - an object that contains the count for `checked` and `unchecked` state\n * @providedPropType {function} refine - a function to toggle a refinement\n * @providedPropType {function} createURL - a function to generate a URL for the corresponding search state\n */\n\n\nexport default createConnector({\n displayName: 'AlgoliaToggle',\n propTypes: {\n label: PropTypes.string.isRequired,\n attribute: PropTypes.string.isRequired,\n value: PropTypes.any.isRequired,\n filter: PropTypes.func,\n defaultRefinement: PropTypes.bool\n },\n getProvidedProps: function getProvidedProps(props, searchState, searchResults) {\n var attribute = props.attribute,\n value = props.value;\n var results = getResults(searchResults, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n var currentRefinement = getCurrentRefinement(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n var allFacetValues = results && results.getFacetByName(attribute) ? results.getFacetValues(attribute) : null;\n var facetValue = // Use null to always be consistent with type of the value\n // count: number | null\n allFacetValues && allFacetValues.length ? find(allFacetValues, function (item) {\n return item.name === value.toString();\n }) : null;\n var facetValueCount = facetValue && facetValue.count;\n var allFacetValuesCount = // Use null to always be consistent with type of the value\n // count: number | null\n allFacetValues && allFacetValues.length ? allFacetValues.reduce(function (acc, item) {\n return acc + item.count;\n }, 0) : null;\n var canRefine = currentRefinement ? allFacetValuesCount !== null && allFacetValuesCount > 0 : facetValueCount !== null && facetValueCount > 0;\n var count = {\n checked: allFacetValuesCount,\n unchecked: facetValueCount\n };\n return {\n currentRefinement: currentRefinement,\n canRefine: canRefine,\n count: count\n };\n },\n refine: function refine(props, searchState, nextRefinement) {\n return _refine(props, searchState, nextRefinement, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n },\n cleanUp: function cleanUp(props, searchState) {\n return _cleanUp(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n },\n getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {\n var attribute = props.attribute,\n value = props.value,\n filter = props.filter;\n var checked = getCurrentRefinement(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n var nextSearchParameters = searchParameters.addDisjunctiveFacet(attribute);\n\n if (checked) {\n nextSearchParameters = nextSearchParameters.addDisjunctiveFacetRefinement(attribute, value);\n\n if (filter) {\n nextSearchParameters = filter(nextSearchParameters);\n }\n }\n\n return nextSearchParameters;\n },\n getMetadata: function getMetadata(props, searchState) {\n var id = getId(props);\n var checked = getCurrentRefinement(props, searchState, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n var items = [];\n var index = getIndexId({\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n\n if (checked) {\n items.push({\n label: props.label,\n currentRefinement: checked,\n attribute: props.attribute,\n value: function value(nextState) {\n return _refine(props, nextState, false, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n }\n });\n }\n\n return {\n id: id,\n index: index,\n items: items\n };\n }\n});","import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread\";\nimport createConnector from '../core/createConnector';\nimport { getResults } from '../core/indexUtils';\n\nfunction inferPayload(_ref) {\n var method = _ref.method,\n results = _ref.results,\n currentHit = _ref.currentHit;\n var index = results.index;\n var queryID = currentHit.__queryID;\n var objectIDs = [currentHit.objectID];\n\n if (!queryID) {\n throw new Error(\"Could not infer `queryID`. Ensure `clickAnalytics: true` was added with the Configure widget.\\nSee: https://alg.li/VpPpLt\");\n }\n\n switch (method) {\n case 'clickedObjectIDsAfterSearch':\n {\n var positions = [currentHit.__position];\n return {\n index: index,\n queryID: queryID,\n objectIDs: objectIDs,\n positions: positions\n };\n }\n\n case 'convertedObjectIDsAfterSearch':\n return {\n index: index,\n queryID: queryID,\n objectIDs: objectIDs\n };\n\n default:\n throw new Error(\"Unsupported method \\\"\".concat(method, \"\\\" passed to the insights function. The supported methods are: \\\"clickedObjectIDsAfterSearch\\\", \\\"convertedObjectIDsAfterSearch\\\".\"));\n }\n}\n\nvar wrapInsightsClient = function wrapInsightsClient(aa, results, currentHit) {\n return function (method, payload) {\n if (typeof aa !== 'function') {\n throw new TypeError(\"Expected insightsClient to be a Function\");\n }\n\n var inferredPayload = inferPayload({\n method: method,\n results: results,\n currentHit: currentHit\n });\n aa(method, _objectSpread({}, inferredPayload, payload));\n };\n};\n\nexport default (function (insightsClient) {\n return createConnector({\n displayName: 'AlgoliaInsights',\n getProvidedProps: function getProvidedProps(props, _, searchResults) {\n var results = getResults(searchResults, {\n ais: props.contextValue,\n multiIndexContext: props.indexContextValue\n });\n var insights = wrapInsightsClient(insightsClient, results, props.hit);\n return {\n insights: insights\n };\n }\n });\n});"],"names":["_extends","Object","assign","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","this","_objectWithoutProperties","excluded","sourceKeys","keys","indexOf","objectWithoutPropertiesLoose","getOwnPropertySymbols","sourceSymbolKeys","propertyIsEnumerable","_defineProperty","obj","value","defineProperty","enumerable","configurable","writable","_objectSpread","ownKeys","concat","filter","sym","getOwnPropertyDescriptor","forEach","_defineProperties","props","descriptor","_typeof2","Symbol","iterator","constructor","_typeof","_assertThisInitialized","self","ReferenceError","_getPrototypeOf","o","setPrototypeOf","getPrototypeOf","__proto__","_setPrototypeOf","p","hasElementType","Element","hasMap","Map","hasSet","Set","hasArrayBuffer","ArrayBuffer","a","b","equal","it","Array","isArray","size","entries","next","done","has","get","isView","RegExp","flags","valueOf","toString","$$typeof","error","message","match","console","warn","shallowEqual","objA","objB","keysA","keysB","hasOwn","removeEmptyKey","objectHasKeys","addAbsolutePositions","hits","hitsPerPage","page","map","hit","index","__position","addQueryID","queryID","__queryID","find","array","comparator","object","omit","_key","_createContext","createContext","onInternalStateUpdate","createHrefForState","onSearchForFacetValues","onSearchStateChange","onSearchParameters","store","widgetsManager","mainTargetedIndex","InstantSearchConsumer","Consumer","_createContext2","Provider","undefined","IndexConsumer","createConnectorWithoutContext","connectorDesc","displayName","Error","isWidget","getSearchParameters","getMetadata","transitionState","Composed","Component","Connector","_Component","_this","instance","Constructor","TypeError","_classCallCheck","assertThisInitialized","providedProps","getProvidedProps","_ref","_len","args","contextValue","refine","getState","widgets","_ref2","_len2","_key2","_ref3","_len3","_key3","searchForFacetValues","bind","ais","multiIndexContext","indexContextValue","protoProps","staticProps","subClass","superClass","create","_inherits","_this2","unsubscribe","subscribe","isUnmounting","setState","unregisterWidget","registerWidget","nextProps","nextState","shouldComponentUpdate","state","propsEqual","prevProps","isEqual","update","cleanUp","_this$props$contextVa","results","resultsFacetValues","searching","searchingForFacetValues","isSearchStalled","metadata","searchResults","searchParameters","nextWidgetsState","prevWidgetsState","_this$props","refineProps","createURL","searchForFacetValuesProps","searchForItems","React","createElement","name","propTypes","defaultProps","createConnectorWithContext","HIGHLIGHT_TAGS","parseHighlightedAttribute","preTag","postTag","_ref$highlightedValue","highlightedValue","splitByPreTag","split","firstValue","shift","elements","isHighlighted","push","splitByPostTag","parseAlgoliaHit","_ref2$preTag","_ref2$postTag","highlightProperty","attribute","path","highlightObject","replace","reduce","current","item","getIndexId","context","hasMultipleIndices","targetedIndex","getResults","indexId","refineValue","searchState","nextRefinement","resetPage","namespace","indices","_objectSpread4","getNamespaceAndAttributeName","id","parts","attributeName","getCurrentRefinementValue","defaultValue","multiIndex","_getNamespaceAndAttri","defaultRefinement","cleanUpValue","_getNamespaceAndAttri2","Boolean","_ref4","indexSearchState","cleanUpValueWithMultiIndex","cleanUpValueWithSingleIndex","createConnector","children","items","setQueryParameters","prevSearchState","nextSearchState","propKeys","nonPresentKeys","_props","prop","subState","configureState","acc","global","window","setTimeout","clearTimeout","performance","now","mozNow","msNow","oNow","webkitNow","_toConsumableArray","arr","arr2","arrayWithoutHoles","iter","from","iterableToArray","nonIterableSpread","isObjectOrArrayOrFunction","_merge","sourceVal","targetVal","l","slice","reduceRight","arr1","valToNumber","v","parseFloat","lib","addRefinement","refinementList","isRefined","valueAsString","facetRefinement","mod","defaultsPure","removeRefinement","clearRefinement","f","toggleRefinement","refinementType","hasChanged","newRefinementList","memo","values","facetList","refinementValue","containsRefinements","refinementValueAsString","isEqualNumericRefinement","every","el","SearchParameters","newParameters","params","_parseNumbers","facets","disjunctiveFacets","hierarchicalFacets","facetsRefinements","facetsExcludes","disjunctiveFacetsRefinements","numericRefinements","tagRefinements","hierarchicalFacetsRefinements","paramName","isKeyKnown","PARAMETERS","isValueDefined","partialState","numbers","k","parsedValue","isNaN","insideBoundingBox","geoRect","operators","operator","parsedValues","vPrime","merge","make","facet","rootPath","currentRefinement","getHierarchicalRefinement","clearRefinements","toggleHierarchicalFacetRefinement","validate","currentState","parameters","tagFilters","numericFilters","patch","_clearNumericRefinements","RefinementList","clearTags","setIndex","setQuery","newQuery","query","setPage","newPage","setFacets","setDisjunctiveFacets","setHitsPerPage","n","setTypoTolerance","typoTolerance","addNumericRefinement","isNumericRefined","getConjunctiveRefinements","facetName","isConjunctiveFacet","getDisjunctiveRefinements","isDisjunctiveFacet","getExcludeRefinements","removeNumericRefinement","paramValue","op","val","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","isHierarchicalFacetRefined","removeHierarchicalFacetRefinement","toggleTagRefinement","isFacetRefined","isExcludeRefined","isDisjunctiveFacetRefined","refinements","isOperatorDefined","searchedValue","isAttributeValueDefined","currentValue","getRefinedDisjunctiveFacets","disjunctiveNumericRefinedFacets","intersection","getRefinedHierarchicalFacets","getUnrefinedDisjunctiveFacets","refinedFacets","managedParameters","getQueryParams","queryParams","setQueryParameter","parameter","nextWithNumbers","previousPlainObject","nextPlainObject","previous","isPreviousValueDefined","isNextValueDefined","_getHierarchicalFacetSortBy","sortBy","_getHierarchicalRootPath","_getHierarchicalShowParentLevel","showParentLevel","hierarchicalFacetName","getHierarchicalFacetBreadcrumb","refinement","part","trim","JSON","stringify","compareAscending","other","valIsDefined","valIsNull","othIsDefined","othIsNull","collection","iteratees","orders","result","criteria","iteratee","sort","res","defaults","defaultInstructions","out","sortInstruction","matchingDefault","defaultInstruction","hierarchicalFacetResult","hierarchicalFacetIndex","hierarchicalSeparator","hierarchicalRootPath","hierarchicalShowParentLevel","hierarchicalFacetRefinement","prepareHierarchicalFacetSortBy","rootExhaustive","facetResult","exhaustive","generateTreeFn","hierarchicalTree","currentHierarchicalLevel","parent","level","data","subtree","picked","facetValue","tuple","parentPath","orderBy","facetCount","count","getIndices","attributes","idx","assignFacetStats","dest","facetStats","stats","SearchResults","mainSubResponse","_rawResults","parsedQuery","nbHits","nbPages","processingTimeMS","sum","aroundLatLng","automaticRadius","serverUsed","timeoutCounts","timeoutHits","exhaustiveFacetsCount","exhaustiveNbHits","userData","facetsIndices","disjunctiveFacetsIndices","nextDisjunctiveResult","mainFacets","facetKey","hierarchicalAttributeName","facetValueObject","facetIndex","idxAttributeName","findIndex","position","isFacetDisjunctive","isFacetConjunctive","facets_stats","compact","disjunctiveFacet","dfacet","facetResults","attributeIndex","dataFromMainRequest","refinedFacet","defaultData","root","excludes","generateHierarchicalTree","_state","recSort","sortFn","node","childNode","sortedChildren","getFacetStatsIfAvailable","getRefinement","type","resultsFacets","getFacetByName","predicate","DEFAULT_SORT","getFacetValues","opts","facetValues","isExcluded","extractNormalizedFacetValues","options","order","formatSort","hierarchicalFacetValues","getFacetStats","getRefinements","facetDeclaration","rootFacet","intermediateFacet","newFacet","numericValue","EventEmitter","_events","_maxListeners","isFunction","arg","isObject","isUndefined","defaultMaxListeners","setMaxListeners","emit","er","handler","len","listeners","err","on","addListener","listener","m","newListener","warned","trace","once","fired","g","removeListener","list","splice","removeAllListeners","listenerCount","evlistener","emitter","ctor","superCtor","DerivedHelper","mainHelper","fn","main","lastResults","events","detach","detachDerivedHelper","getModifiedState","requestBuilder","_getQueries","queries","indexName","_getHitsSearchParams","_getDisjunctiveFacetSearchParams","_getHitsHierarchicalFacetsAttributes","facetFilters","_getFacetFilters","_getNumericFilters","additionalParams","_getTagFilters","hierarchicalRootLevel","attributesToRetrieve","attributesToHighlight","attributesToSnippet","analytics","clickAnalytics","_getDisjunctiveHierarchicalFacetAttribute","vs","join","orFilters","attributeToRefine","attributesIndex","allAttributes","hierarchicalRefinement","newAttributes","rootLevel","parentLevel","getSearchForFacetQuery","maxFacetHits","stateForSearchForFacetValues","searchForFacetSearchParameters","facetQuery","AlgoliaSearchHelper","client","addAlgoliaAgent","setClient","_queryId","_lastQueryIdReceived","derivedHelpers","_currentNbQueries","setCurrentPage","_change","isPageReset","getCurrentPage","search","_search","onlyWithDerivedHelpers","searchOnlyWithDerivedHelpers","getQuery","searchOnce","cb","tempState","then","content","_originalResponse","e","catch","userState","clientHasSFFV","initIndex","isDisjunctive","algoliaQuery","facetHits","q","addDisjunctiveRefine","addRefine","addFacetExclusion","addExclude","addTag","removeDisjunctiveRefine","removeRefine","removeFacetExclusion","removeExclude","removeTag","toggleFacetExclusion","toggleExclude","toggleRefine","toggleTag","nextPage","previousPage","newState","overrideStateWithoutTriggeringChangeEvent","hasRefinements","isDisjunctiveRefined","hasTag","hasTagRefinements","getIndex","getPage","getTags","r","states","mainQueries","queriesCount","helper","derivedQueries","derivedHelper","derivedState","derivedStateQueries","queryId","_dispatchAlgoliaResponse","_dispatchAlgoliaError","s","specificResults","formattedResponse","containsRefinement","_hasDisjunctiveRefinements","disjunctiveRefinements","event","clearCache","newClient","getClient","derive","pos","hasPendingRequests","algoliasearchHelper","version","require$$0","createOptionalFilter","attributeValue","attributeScore","getSearchParametersFromProps","optionalFilters","matchingPatterns","attributePattern","score","attributeSubValue","transformSearchParameters","sumOrFiltersScores","objectID","x","_prevSearchState","searchParametersKeys","_searchParameters","propIsEnumerable","test1","String","getOwnPropertyNames","test2","fromCharCode","test3","letter","shouldUseNative","emptyFunction","module","shim","propName","componentName","location","propFullName","secret","getShim","ReactPropTypes","isRequired","bool","func","number","string","symbol","any","arrayOf","element","instanceOf","objectOf","oneOf","oneOfType","shape","exact","checkPropTypes","PropTypes","require$$1","getCurrentRefinement","getId","some","transformItems","canRefine","transformValue","label","transformedItems","meta","clearsQuery","clear","currentRefinementToString","northEast","lat","lng","southWest","latLngRegExp","stringToPosition","pattern","_refine","nextValue","currentRefinementFromSearchState","currentRefinementFromSearchParameters","currentPositionFromSearchState","propsWithoutDefaultRefinement","configureAroundLatLng","getCurrentPosition","currentPositionFromSearchParameters","_","_geoloc","isRefinedWithMap","showMore","limit","showMoreLimit","itemsLimit","truncate","maxValuesPerFacet","Math","max","rootAttribute","highlight","_ref$preTag","_ref$postTag","parseInt","getStateWithoutPage","extractHitsFromCachedHits","cachedHits","Number","_prevState","cachedState","cache","read","write","_cachedHits","hasPrevious","hasMore","refinePrevious","refineNext","_results$_state","hitsWithPositionsAndQueryID","firstReceivedPage","min","lastReceivedPage","pages","getValue","getLimit","defaultSortBy","searchable","searchForFacetValuesResults","isFromSearch","_highlightResult","highlighted","_slicedToArray","arrayWithHoles","_arr","_n","_d","_e","_s","_i","iterableToArrayLimit","nonIterableRest","stringifyItem","start","end","range","noRefinement","NEGATIVE_INFINITY","POSITIVE_INFINITY","refinedItem","_parseItem","_value$split2","startStr","endStr","parseItem","hostname","url","currentRange","_getCurrentRefinement","isFloatPrecision","precision","nextMin","nextMax","hasMinBound","hasMaxBound","hasMinRefinment","hasMaxRefinment","getCurrentRefinementWithRange","nextValueForRefinement","hasBound","isReset","currentMinRange","currentMaxRange","isMinReset","isMaxReset","nextMinAsNumber","nextMaxAsNumber","isNextMinValid","isFinite","isNextMaxValid","header","footer","boundaries","pow","minBound","maxBound","hasFacet","_getCurrentRange","floor","ceil","rangeMin","rangeMax","_currentRange","_getCurrentRefinement2","_this$_currentRange","minRange","maxRange","_getCurrentRefinement3","minValue","maxValue","hasMin","hasMax","fragments","selectedValue","addKey","addRefinementKey","nextSelectedItems","scrollOn","cleanedSearchState","hasNotChanged","selectedIndex","allSearchResults","falsyStrings","allFacetValues","facetValueCount","allFacetValuesCount","checked","unchecked","nextSearchParameters","wrapInsightsClient","aa","currentHit","method","payload","inferredPayload","objectIDs","positions","inferP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