@sunrise-upc/sales-static-components 4.1.1 → 4.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/dist/cjs/components/ButtonGroup/ButtonGroup.css +95 -95
- package/dist/cjs/components/FalconButton/falconButton.js.map +1 -1
- package/dist/cjs/components/FalconButtonV3/FalconButtonV3.css +12 -0
- package/dist/cjs/components/FalconButtonV3/FalconButtonV3.js +1 -1
- package/dist/cjs/components/FalconButtonV3/FalconButtonV3.js.map +1 -1
- package/dist/cjs/components/FalconButtonV3/FalconButtonV3.module.scss.css +12 -0
- package/dist/cjs/components/FalconButtonV3/FalconButtonV3.module.scss.js +1 -1
- package/dist/cjs/components/FalconMainNavigation/CartOverlay/CartFooter/CartFooter.js +1 -1
- package/dist/cjs/components/FalconMainNavigation/CartOverlay/CartFooter/CartFooter.js.map +1 -1
- package/dist/cjs/components/FalconMainNavigation/CartOverlay/CartItems/CartItems.js +1 -1
- package/dist/cjs/components/FalconMainNavigation/CartOverlay/CartItems/CartItems.js.map +1 -1
- package/dist/cjs/components/FalconMainNavigation/CartOverlay/CartOverlay.js +1 -1
- package/dist/cjs/components/FalconMainNavigation/CartOverlay/CartOverlay.js.map +1 -1
- package/dist/cjs/components/FalconMainNavigation/CartOverlay/useCartData.js +1 -1
- package/dist/cjs/components/FalconMainNavigation/CartOverlay/useCartData.js.map +1 -1
- package/dist/cjs/components/FalconMainNavigation/FalconHeader/BusinessCustomerLinkOut/BusinessCustomerLinkOut.js.map +1 -1
- package/dist/cjs/components/FalconMainNavigation/FalconMainNavigation.js +1 -1
- package/dist/cjs/components/FalconMainNavigation/FalconMainNavigation.js.map +1 -1
- package/dist/cjs/components/FalconMainNavigation/MobileNavigation/MobileMenuItem/MobileMenuItem.js.map +1 -1
- package/dist/cjs/components/FalconMainNavigation/ProfileLinkOut/ProfileLinkOut.js +1 -1
- package/dist/cjs/components/FalconMainNavigation/ProfileLinkOut/ProfileLinkOut.js.map +1 -1
- package/dist/cjs/components/InternetAndTvCardsBenefits/InternetAndTvCardItemBenefits.js.map +1 -1
- package/dist/cjs/components/RibbonComponent/RibbonComponent.css +389 -389
- package/dist/cjs/components/RibbonComponent/RibbonComponentTimer/RibbonComponentTimer.css +68 -68
- package/dist/cjs/components/StageTeaserComponent/DoubleGrid/DoubleGridComponent.css +937 -937
- package/dist/cjs/components/StageTeaserComponent/SingleGrid/SingleGridRedefined.js.map +1 -1
- package/dist/cjs/components/StageTeaserV3/DoubleGrid/DoubleGridComponent.css +87 -87
- package/dist/cjs/components/StageTeaserV3/SingleGrid/SingleGridComponent.css +87 -87
- package/dist/cjs/components/linecheck/AutoComplete.css +515 -515
- package/dist/cjs/components/linecheck/FiberUpgradeInfo.css +515 -515
- package/dist/cjs/components/linecheck/LineCheckV2.css +515 -515
- package/dist/cjs/components/linecheck/Success.css +515 -515
- package/dist/cjs/node_modules/@algolia/client-common/dist/common.js +1 -1
- package/dist/cjs/node_modules/@algolia/client-common/dist/common.js.map +1 -1
- package/dist/cjs/node_modules/@algolia/requester-browser-xhr/dist/requester.xhr.js +1 -1
- package/dist/cjs/node_modules/@algolia/requester-browser-xhr/dist/requester.xhr.js.map +1 -1
- package/dist/cjs/node_modules/algoliasearch/dist/lite/builds/browser.js +1 -1
- package/dist/cjs/node_modules/algoliasearch/dist/lite/builds/browser.js.map +1 -1
- package/dist/cjs/node_modules/algoliasearch-helper/src/SearchParameters/RefinementList.js.map +1 -1
- package/dist/cjs/node_modules/algoliasearch-helper/src/SearchParameters/index.js.map +1 -1
- package/dist/cjs/node_modules/algoliasearch-helper/src/SearchResults/index.js.map +1 -1
- package/dist/cjs/node_modules/algoliasearch-helper/src/algoliasearch.helper.js.map +1 -1
- package/dist/cjs/node_modules/algoliasearch-helper/src/utils/sortAndMergeRecommendations.js.map +1 -1
- package/dist/cjs/node_modules/algoliasearch-helper/src/version.js +1 -1
- package/dist/cjs/node_modules/algoliasearch-helper/src/version.js.map +1 -1
- package/dist/cjs/node_modules/immer/dist/immer.js +1 -1
- package/dist/cjs/node_modules/immer/dist/immer.js.map +1 -1
- package/dist/cjs/node_modules/instantsearch.js/es/helpers/insights.js +1 -1
- package/dist/cjs/node_modules/instantsearch.js/es/helpers/insights.js.map +1 -1
- package/dist/cjs/node_modules/instantsearch.js/es/lib/InstantSearch.js +1 -1
- package/dist/cjs/node_modules/instantsearch.js/es/lib/InstantSearch.js.map +1 -1
- package/dist/cjs/node_modules/instantsearch.js/es/lib/chat/openChat.js +1 -1
- package/dist/cjs/node_modules/instantsearch.js/es/lib/chat/openChat.js.map +1 -1
- package/dist/cjs/node_modules/instantsearch.js/es/lib/utils/defer.js +1 -1
- package/dist/cjs/node_modules/instantsearch.js/es/lib/utils/defer.js.map +1 -1
- package/dist/cjs/node_modules/instantsearch.js/es/lib/utils/getHighlightFromSiblings.js +1 -1
- package/dist/cjs/node_modules/instantsearch.js/es/lib/utils/getHighlightFromSiblings.js.map +1 -1
- package/dist/cjs/node_modules/instantsearch.js/es/lib/version.js +1 -1
- package/dist/cjs/node_modules/instantsearch.js/es/lib/version.js.map +1 -1
- package/dist/cjs/node_modules/instantsearch.js/es/middlewares/createInsightsMiddleware.js +1 -1
- package/dist/cjs/node_modules/instantsearch.js/es/middlewares/createInsightsMiddleware.js.map +1 -1
- package/dist/cjs/node_modules/instantsearch.js/es/middlewares/createMetadataMiddleware.js +1 -1
- package/dist/cjs/node_modules/instantsearch.js/es/middlewares/createMetadataMiddleware.js.map +1 -1
- package/dist/cjs/node_modules/instantsearch.js/es/widgets/index/index.js +1 -1
- package/dist/cjs/node_modules/instantsearch.js/es/widgets/index/index.js.map +1 -1
- package/dist/cjs/node_modules/qs/lib/parse.js +1 -1
- package/dist/cjs/node_modules/qs/lib/parse.js.map +1 -1
- package/dist/cjs/node_modules/qs/lib/stringify.js +1 -1
- package/dist/cjs/node_modules/qs/lib/stringify.js.map +1 -1
- package/dist/cjs/node_modules/qs/lib/utils.js +1 -1
- package/dist/cjs/node_modules/qs/lib/utils.js.map +1 -1
- package/dist/cjs/node_modules/react-instantsearch/dist/es/ui/SearchBox.js +1 -1
- package/dist/cjs/node_modules/react-instantsearch/dist/es/ui/SearchBox.js.map +1 -1
- package/dist/cjs/node_modules/react-instantsearch-core/dist/es/hooks/useConnector.js +1 -1
- package/dist/cjs/node_modules/react-instantsearch-core/dist/es/hooks/useConnector.js.map +1 -1
- package/dist/cjs/node_modules/react-instantsearch-core/dist/es/lib/InstantSearchRSCContext.js +1 -1
- package/dist/cjs/node_modules/react-instantsearch-core/dist/es/lib/InstantSearchRSCContext.js.map +1 -1
- package/dist/cjs/node_modules/react-instantsearch-core/dist/es/lib/useWidget.js +1 -1
- package/dist/cjs/node_modules/react-instantsearch-core/dist/es/lib/useWidget.js.map +1 -1
- package/dist/cjs/node_modules/react-instantsearch-core/dist/es/version.js +1 -1
- package/dist/cjs/node_modules/react-instantsearch-core/dist/es/version.js.map +1 -1
- package/dist/cjs/services/api-constants.js +1 -1
- package/dist/cjs/services/api-constants.js.map +1 -1
- package/dist/cjs/utils/utilities.js +1 -1
- package/dist/cjs/utils/utilities.js.map +1 -1
- package/dist/cjs/utils/wonderfulChat.js +2 -0
- package/dist/cjs/utils/wonderfulChat.js.map +1 -0
- package/dist/esm/components/ButtonGroup/ButtonGroup.css +95 -95
- package/dist/esm/components/FalconButtonV3/FalconButtonV3.css +12 -0
- package/dist/esm/components/FalconButtonV3/FalconButtonV3.js +1 -1
- package/dist/esm/components/FalconButtonV3/FalconButtonV3.js.map +1 -1
- package/dist/esm/components/FalconButtonV3/FalconButtonV3.module.scss.css +12 -0
- package/dist/esm/components/FalconButtonV3/FalconButtonV3.module.scss.js +1 -1
- package/dist/esm/components/FalconMainNavigation/CartOverlay/CartFooter/CartFooter.js +1 -1
- package/dist/esm/components/FalconMainNavigation/CartOverlay/CartFooter/CartFooter.js.map +1 -1
- package/dist/esm/components/FalconMainNavigation/CartOverlay/CartItems/CartItems.js +1 -1
- package/dist/esm/components/FalconMainNavigation/CartOverlay/CartItems/CartItems.js.map +1 -1
- package/dist/esm/components/FalconMainNavigation/CartOverlay/CartOverlay.js +1 -1
- package/dist/esm/components/FalconMainNavigation/CartOverlay/CartOverlay.js.map +1 -1
- package/dist/esm/components/FalconMainNavigation/CartOverlay/useCartData.js +1 -1
- package/dist/esm/components/FalconMainNavigation/CartOverlay/useCartData.js.map +1 -1
- package/dist/esm/components/FalconMainNavigation/FalconMainNavigation.js +1 -1
- package/dist/esm/components/FalconMainNavigation/FalconMainNavigation.js.map +1 -1
- package/dist/esm/components/FalconMainNavigation/ProfileLinkOut/ProfileLinkOut.js +1 -1
- package/dist/esm/components/FalconMainNavigation/ProfileLinkOut/ProfileLinkOut.js.map +1 -1
- package/dist/esm/components/RibbonComponent/RibbonComponent.css +389 -389
- package/dist/esm/components/RibbonComponent/RibbonComponentTimer/RibbonComponentTimer.css +68 -68
- package/dist/esm/components/StageTeaserComponent/DoubleGrid/DoubleGridComponent.css +937 -937
- package/dist/esm/components/StageTeaserV3/DoubleGrid/DoubleGridComponent.css +87 -87
- package/dist/esm/components/StageTeaserV3/SingleGrid/SingleGridComponent.css +87 -87
- package/dist/esm/components/linecheck/AutoComplete.css +515 -515
- package/dist/esm/components/linecheck/FiberUpgradeInfo.css +515 -515
- package/dist/esm/components/linecheck/LineCheckV2.css +515 -515
- package/dist/esm/components/linecheck/Success.css +515 -515
- package/dist/esm/node_modules/@algolia/client-common/dist/common.js +1 -1
- package/dist/esm/node_modules/@algolia/client-common/dist/common.js.map +1 -1
- package/dist/esm/node_modules/@algolia/requester-browser-xhr/dist/requester.xhr.js +1 -1
- package/dist/esm/node_modules/@algolia/requester-browser-xhr/dist/requester.xhr.js.map +1 -1
- package/dist/esm/node_modules/algoliasearch/dist/lite/builds/browser.js +1 -1
- package/dist/esm/node_modules/algoliasearch/dist/lite/builds/browser.js.map +1 -1
- package/dist/esm/node_modules/algoliasearch-helper/src/SearchParameters/RefinementList.js.map +1 -1
- package/dist/esm/node_modules/algoliasearch-helper/src/SearchParameters/index.js.map +1 -1
- package/dist/esm/node_modules/algoliasearch-helper/src/SearchResults/index.js.map +1 -1
- package/dist/esm/node_modules/algoliasearch-helper/src/algoliasearch.helper.js.map +1 -1
- package/dist/esm/node_modules/algoliasearch-helper/src/utils/sortAndMergeRecommendations.js.map +1 -1
- package/dist/esm/node_modules/algoliasearch-helper/src/version.js +1 -1
- package/dist/esm/node_modules/algoliasearch-helper/src/version.js.map +1 -1
- package/dist/esm/node_modules/immer/dist/immer.js +1 -1
- package/dist/esm/node_modules/immer/dist/immer.js.map +1 -1
- package/dist/esm/node_modules/instantsearch.js/es/helpers/insights.js +1 -1
- package/dist/esm/node_modules/instantsearch.js/es/helpers/insights.js.map +1 -1
- package/dist/esm/node_modules/instantsearch.js/es/lib/InstantSearch.js +1 -1
- package/dist/esm/node_modules/instantsearch.js/es/lib/InstantSearch.js.map +1 -1
- package/dist/esm/node_modules/instantsearch.js/es/lib/chat/openChat.js +1 -1
- package/dist/esm/node_modules/instantsearch.js/es/lib/chat/openChat.js.map +1 -1
- package/dist/esm/node_modules/instantsearch.js/es/lib/utils/defer.js +1 -1
- package/dist/esm/node_modules/instantsearch.js/es/lib/utils/defer.js.map +1 -1
- package/dist/esm/node_modules/instantsearch.js/es/lib/utils/getHighlightFromSiblings.js +1 -1
- package/dist/esm/node_modules/instantsearch.js/es/lib/utils/getHighlightFromSiblings.js.map +1 -1
- package/dist/esm/node_modules/instantsearch.js/es/lib/version.js +1 -1
- package/dist/esm/node_modules/instantsearch.js/es/lib/version.js.map +1 -1
- package/dist/esm/node_modules/instantsearch.js/es/middlewares/createInsightsMiddleware.js +1 -1
- package/dist/esm/node_modules/instantsearch.js/es/middlewares/createInsightsMiddleware.js.map +1 -1
- package/dist/esm/node_modules/instantsearch.js/es/middlewares/createMetadataMiddleware.js +1 -1
- package/dist/esm/node_modules/instantsearch.js/es/middlewares/createMetadataMiddleware.js.map +1 -1
- package/dist/esm/node_modules/instantsearch.js/es/widgets/index/index.js +1 -1
- package/dist/esm/node_modules/instantsearch.js/es/widgets/index/index.js.map +1 -1
- package/dist/esm/node_modules/qs/lib/parse.js +1 -1
- package/dist/esm/node_modules/qs/lib/parse.js.map +1 -1
- package/dist/esm/node_modules/qs/lib/stringify.js +1 -1
- package/dist/esm/node_modules/qs/lib/stringify.js.map +1 -1
- package/dist/esm/node_modules/qs/lib/utils.js +1 -1
- package/dist/esm/node_modules/qs/lib/utils.js.map +1 -1
- package/dist/esm/node_modules/react-instantsearch/dist/es/ui/SearchBox.js +1 -1
- package/dist/esm/node_modules/react-instantsearch/dist/es/ui/SearchBox.js.map +1 -1
- package/dist/esm/node_modules/react-instantsearch-core/dist/es/hooks/useConnector.js +1 -1
- package/dist/esm/node_modules/react-instantsearch-core/dist/es/hooks/useConnector.js.map +1 -1
- package/dist/esm/node_modules/react-instantsearch-core/dist/es/lib/InstantSearchRSCContext.js +1 -1
- package/dist/esm/node_modules/react-instantsearch-core/dist/es/lib/InstantSearchRSCContext.js.map +1 -1
- package/dist/esm/node_modules/react-instantsearch-core/dist/es/lib/useWidget.js +1 -1
- package/dist/esm/node_modules/react-instantsearch-core/dist/es/lib/useWidget.js.map +1 -1
- package/dist/esm/node_modules/react-instantsearch-core/dist/es/version.js +1 -1
- package/dist/esm/node_modules/react-instantsearch-core/dist/es/version.js.map +1 -1
- package/dist/esm/services/api-constants.js +1 -1
- package/dist/esm/services/api-constants.js.map +1 -1
- package/dist/esm/utils/utilities.js +1 -1
- package/dist/esm/utils/utilities.js.map +1 -1
- package/dist/esm/utils/wonderfulChat.js +2 -0
- package/dist/esm/utils/wonderfulChat.js.map +1 -0
- package/dist/index.d.ts +2 -3
- package/dist/navigation.css +160 -160
- package/package.json +115 -115
- package/dist/cjs/node_modules/instantsearch.js/es/lib/utils/addInsightsToRecommendParameters.js +0 -2
- package/dist/cjs/node_modules/instantsearch.js/es/lib/utils/addInsightsToRecommendParameters.js.map +0 -1
- package/dist/cjs/node_modules/instantsearch.js/es/lib/utils/buildWidgetTree.js +0 -2
- package/dist/cjs/node_modules/instantsearch.js/es/lib/utils/buildWidgetTree.js.map +0 -1
- package/dist/cjs/node_modules/instantsearch.js/es/lib/utils/extractWidgetPayload.js +0 -2
- package/dist/cjs/node_modules/instantsearch.js/es/lib/utils/extractWidgetPayload.js.map +0 -1
- package/dist/cjs/node_modules/instantsearch.js/es/lib/utils/now.js +0 -2
- package/dist/cjs/node_modules/instantsearch.js/es/lib/utils/now.js.map +0 -1
- package/dist/cjs/node_modules/instantsearch.js/es/lib/utils/omit.js +0 -2
- package/dist/cjs/node_modules/instantsearch.js/es/lib/utils/omit.js.map +0 -1
- package/dist/esm/node_modules/instantsearch.js/es/lib/utils/addInsightsToRecommendParameters.js +0 -2
- package/dist/esm/node_modules/instantsearch.js/es/lib/utils/addInsightsToRecommendParameters.js.map +0 -1
- package/dist/esm/node_modules/instantsearch.js/es/lib/utils/buildWidgetTree.js +0 -2
- package/dist/esm/node_modules/instantsearch.js/es/lib/utils/buildWidgetTree.js.map +0 -1
- package/dist/esm/node_modules/instantsearch.js/es/lib/utils/extractWidgetPayload.js +0 -2
- package/dist/esm/node_modules/instantsearch.js/es/lib/utils/extractWidgetPayload.js.map +0 -1
- package/dist/esm/node_modules/instantsearch.js/es/lib/utils/now.js +0 -2
- package/dist/esm/node_modules/instantsearch.js/es/lib/utils/now.js.map +0 -1
- package/dist/esm/node_modules/instantsearch.js/es/lib/utils/omit.js +0 -2
- package/dist/esm/node_modules/instantsearch.js/es/lib/utils/omit.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../node_modules/algoliasearch-helper/src/SearchResults/index.js"],"sourcesContent":["'use strict';\n\nvar compact = require('../functions/compact');\nvar defaultsPure = require('../functions/defaultsPure');\nvar fv = require('../functions/escapeFacetValue');\nvar find = require('../functions/find');\nvar findIndex = require('../functions/findIndex');\nvar formatSort = require('../functions/formatSort');\nvar mergeNumericMax = require('../functions/mergeNumericMax');\nvar orderBy = require('../functions/orderBy');\nvar escapeFacetValue = fv.escapeFacetValue;\nvar unescapeFacetValue = fv.unescapeFacetValue;\n\nvar generateHierarchicalTree = require('./generate-hierarchical-tree');\n\n/**\n * @typedef SearchResults.Facet\n * @type {object}\n * @property {string} name name of the attribute in the record\n * @property {object} data the faceting data: value, number of entries\n * @property {object} stats undefined unless facet_stats is retrieved from algolia\n */\n\n/**\n * @typedef SearchResults.HierarchicalFacet\n * @type {object}\n * @property {string} name name of the current value given the hierarchical level, trimmed.\n * If root node, you get the facet name\n * @property {number} count number of objects matching this hierarchical value\n * @property {string} path the current hierarchical value full path\n * @property {boolean} isRefined `true` if the current value was refined, `false` otherwise\n * @property {HierarchicalFacet[]} data sub values for the current level\n */\n\n/**\n * @typedef SearchResults.FacetValue\n * @type {object}\n * @property {string} name the facet value itself\n * @property {number} count times this facet appears in the results\n * @property {boolean} isRefined is the facet currently selected\n * @property {boolean} isExcluded is the facet currently excluded (only for conjunctive facets)\n */\n\n/**\n * @typedef Refinement\n * @type {object}\n * @property {string} type the type of filter used:\n * `numeric`, `facet`, `exclude`, `disjunctive`, `hierarchical`\n * @property {string} attributeName name of the attribute used for filtering\n * @property {string} name the value of the filter\n * @property {number} numericValue the value as a number. Only for numeric filters.\n * @property {string} operator the operator used. Only for numeric filters.\n * @property {number} count the number of computed hits for this filter. Only on facets.\n * @property {boolean} exhaustive if the count is exhaustive\n */\n\n/**\n * Turn an array of attributes in an object of attributes with their position in the array as value\n * @param {string[]} attributes the list of attributes in the record\n * @return {object} the list of attributes indexed by attribute name\n */\nfunction getIndices(attributes) {\n var indices = {};\n\n attributes.forEach(function (val, idx) {\n indices[val] = idx;\n });\n\n return indices;\n}\n\nfunction assignFacetStats(dest, facetStats, key) {\n if (facetStats && facetStats[key]) {\n dest.stats = facetStats[key];\n }\n}\n\n/**\n * @typedef {Object} HierarchicalFacet\n * @property {string} name\n * @property {string[]} attributes\n */\n\n/**\n * @param {HierarchicalFacet[]} hierarchicalFacets All hierarchical facets\n * @param {string} hierarchicalAttributeName The name of the hierarchical attribute\n * @return {HierarchicalFacet} The hierarchical facet matching the attribute name\n */\nfunction findMatchingHierarchicalFacetFromAttributeName(\n hierarchicalFacets,\n hierarchicalAttributeName\n) {\n return find(\n hierarchicalFacets,\n function facetKeyMatchesAttribute(hierarchicalFacet) {\n var facetNames = hierarchicalFacet.attributes || [];\n return facetNames.indexOf(hierarchicalAttributeName) > -1;\n }\n );\n}\n\n/**\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.<object>} results the results from algolia client\n * @param {object} options options to control results content\n * @example <caption>SearchResults of the first query in\n * <a href=\"http://demos.algolia.com/instant-search-demo\">the instant search demo</a></caption>\n{\n \"hitsPerPage\": 10,\n \"processingTimeMS\": 2,\n \"facets\": [\n {\n \"name\": \"type\",\n \"data\": {\n \"HardGood\": 6627,\n \"BlackTie\": 550,\n \"Music\": 665,\n \"Software\": 131,\n \"Game\": 456,\n \"Movie\": 1571\n },\n \"exhaustive\": false\n },\n {\n \"exhaustive\": false,\n \"data\": {\n \"Free shipping\": 5507\n },\n \"name\": \"shipping\"\n }\n ],\n \"hits\": [\n {\n \"thumbnailImage\": \"http://img.bbystatic.com/BestBuy_US/images/products/1688/1688832_54x108_s.gif\",\n \"_highlightResult\": {\n \"shortDescription\": {\n \"matchLevel\": \"none\",\n \"value\": \"Safeguard your PC, Mac, Android and iOS devices with comprehensive Internet protection\",\n \"matchedWords\": []\n },\n \"category\": {\n \"matchLevel\": \"none\",\n \"value\": \"Computer Security Software\",\n \"matchedWords\": []\n },\n \"manufacturer\": {\n \"matchedWords\": [],\n \"value\": \"Webroot\",\n \"matchLevel\": \"none\"\n },\n \"name\": {\n \"value\": \"Webroot SecureAnywhere Internet Security (3-Device) (1-Year Subscription) - Mac/Windows\",\n \"matchedWords\": [],\n \"matchLevel\": \"none\"\n }\n },\n \"image\": \"http://img.bbystatic.com/BestBuy_US/images/products/1688/1688832_105x210_sc.jpg\",\n \"shipping\": \"Free shipping\",\n \"bestSellingRank\": 4,\n \"shortDescription\": \"Safeguard your PC, Mac, Android and iOS devices with comprehensive Internet protection\",\n \"url\": \"http://www.bestbuy.com/site/webroot-secureanywhere-internet-security-3-devi…d=1219060687969&skuId=1688832&cmp=RMX&ky=2d3GfEmNIzjA0vkzveHdZEBgpPCyMnLTJ\",\n \"name\": \"Webroot SecureAnywhere Internet Security (3-Device) (1-Year Subscription) - Mac/Windows\",\n \"category\": \"Computer Security Software\",\n \"salePrice_range\": \"1 - 50\",\n \"objectID\": \"1688832\",\n \"type\": \"Software\",\n \"customerReviewCount\": 5980,\n \"salePrice\": 49.99,\n \"manufacturer\": \"Webroot\"\n },\n ....\n ],\n \"nbHits\": 10000,\n \"disjunctiveFacets\": [\n {\n \"exhaustive\": false,\n \"data\": {\n \"5\": 183,\n \"12\": 112,\n \"7\": 149,\n ...\n },\n \"name\": \"customerReviewCount\",\n \"stats\": {\n \"max\": 7461,\n \"avg\": 157.939,\n \"min\": 1\n }\n },\n {\n \"data\": {\n \"Printer Ink\": 142,\n \"Wireless Speakers\": 60,\n \"Point & Shoot Cameras\": 48,\n ...\n },\n \"name\": \"category\",\n \"exhaustive\": false\n },\n {\n \"exhaustive\": false,\n \"data\": {\n \"> 5000\": 2,\n \"1 - 50\": 6524,\n \"501 - 2000\": 566,\n \"201 - 500\": 1501,\n \"101 - 200\": 1360,\n \"2001 - 5000\": 47\n },\n \"name\": \"salePrice_range\"\n },\n {\n \"data\": {\n \"Dynex™\": 202,\n \"Insignia™\": 230,\n \"PNY\": 72,\n ...\n },\n \"name\": \"manufacturer\",\n \"exhaustive\": false\n }\n ],\n \"query\": \"\",\n \"nbPages\": 100,\n \"page\": 0,\n \"index\": \"bestbuy\"\n}\n **/\nfunction SearchResults(state, results, options) {\n var mainSubResponse = results[0] || {};\n\n this._rawResults = results;\n\n // eslint-disable-next-line consistent-this\n var self = this;\n\n // https://www.algolia.com/doc/api-reference/api-methods/search/#response\n Object.keys(mainSubResponse).forEach(function (key) {\n self[key] = mainSubResponse[key];\n });\n\n // Make every key of the result options reachable from the instance\n var opts = defaultsPure(options, {\n persistHierarchicalRootCount: false,\n });\n Object.keys(opts).forEach(function (key) {\n self[key] = opts[key];\n });\n\n /**\n * query used to generate the results\n * @name query\n * @member {string}\n * @memberof SearchResults\n * @instance\n */\n /**\n * The query as parsed by the engine given all the rules.\n * @name parsedQuery\n * @member {string}\n * @memberof SearchResults\n * @instance\n */\n /**\n * all the records that match the search parameters. Each record is\n * augmented with a new attribute `_highlightResult`\n * which is an object keyed by attribute and with the following properties:\n * - `value` : the value of the facet highlighted (html)\n * - `matchLevel`: `full`, `partial` or `none`, depending on how the query terms match\n * @name hits\n * @member {object[]}\n * @memberof SearchResults\n * @instance\n */\n /**\n * index where the results come from\n * @name index\n * @member {string}\n * @memberof SearchResults\n * @instance\n */\n /**\n * number of hits per page requested\n * @name hitsPerPage\n * @member {number}\n * @memberof SearchResults\n * @instance\n */\n /**\n * total number of hits of this query on the index\n * @name nbHits\n * @member {number}\n * @memberof SearchResults\n * @instance\n */\n /**\n * total number of pages with respect to the number of hits per page and the total number of hits\n * @name nbPages\n * @member {number}\n * @memberof SearchResults\n * @instance\n */\n /**\n * current page\n * @name page\n * @member {number}\n * @memberof SearchResults\n * @instance\n */\n /**\n * The position if the position was guessed by IP.\n * @name aroundLatLng\n * @member {string}\n * @memberof SearchResults\n * @instance\n * @example \"48.8637,2.3615\",\n */\n /**\n * The radius computed by Algolia.\n * @name automaticRadius\n * @member {string}\n * @memberof SearchResults\n * @instance\n * @example \"126792922\",\n */\n /**\n * String identifying the server used to serve this request.\n *\n * getRankingInfo needs to be set to `true` for this to be returned\n *\n * @name serverUsed\n * @member {string}\n * @memberof SearchResults\n * @instance\n * @example \"c7-use-2.algolia.net\",\n */\n /**\n * Boolean that indicates if the computation of the counts did time out.\n * @deprecated\n * @name timeoutCounts\n * @member {boolean}\n * @memberof SearchResults\n * @instance\n */\n /**\n * Boolean that indicates if the computation of the hits did time out.\n * @deprecated\n * @name timeoutHits\n * @member {boolean}\n * @memberof SearchResults\n * @instance\n */\n /**\n * True if the counts of the facets is exhaustive\n * @name exhaustiveFacetsCount\n * @member {boolean}\n * @memberof SearchResults\n * @instance\n */\n /**\n * True if the number of hits is exhaustive\n * @name exhaustiveNbHits\n * @member {boolean}\n * @memberof SearchResults\n * @instance\n */\n /**\n * Contains the userData if they are set by a [query rule](https://www.algolia.com/doc/guides/query-rules/query-rules-overview/).\n * @name userData\n * @member {object[]}\n * @memberof SearchResults\n * @instance\n */\n /**\n * queryID is the unique identifier of the query used to generate the current search results.\n * This value is only available if the `clickAnalytics` search parameter is set to `true`.\n * @name queryID\n * @member {string}\n * @memberof SearchResults\n * @instance\n */\n\n /**\n * sum of the processing time of all the queries\n * @name processingTimeMS\n * @member {number}\n * @memberof SearchResults\n * @instance\n */\n this.processingTimeMS = results.reduce(function (sum, result) {\n return result.processingTimeMS === undefined\n ? sum\n : sum + result.processingTimeMS;\n }, 0);\n\n /**\n * disjunctive facets results\n * @member {SearchResults.Facet[]}\n */\n this.disjunctiveFacets = [];\n /**\n * disjunctive facets results\n * @member {SearchResults.HierarchicalFacet[]}\n */\n this.hierarchicalFacets = state.hierarchicalFacets.map(\n function initFutureTree() {\n return [];\n }\n );\n /**\n * other facets results\n * @member {SearchResults.Facet[]}\n */\n this.facets = [];\n\n var disjunctiveFacets = state.getRefinedDisjunctiveFacets();\n\n var facetsIndices = getIndices(state.facets);\n var disjunctiveFacetsIndices = getIndices(state.disjunctiveFacets);\n var nextDisjunctiveResult = 1;\n\n // Since we send request only for disjunctive facets that have been refined,\n // we get the facets information from the first, general, response.\n\n var mainFacets = mainSubResponse.facets || {};\n\n Object.keys(mainFacets).forEach(function (facetKey) {\n var facetValueObject = mainFacets[facetKey];\n\n var hierarchicalFacet = findMatchingHierarchicalFacetFromAttributeName(\n state.hierarchicalFacets,\n facetKey\n );\n\n if (hierarchicalFacet) {\n // Place the hierarchicalFacet data at the correct index depending on\n // the attributes order that was defined at the helper initialization\n var facetIndex = hierarchicalFacet.attributes.indexOf(facetKey);\n var idxAttributeName = findIndex(state.hierarchicalFacets, function (f) {\n return f.name === hierarchicalFacet.name;\n });\n self.hierarchicalFacets[idxAttributeName][facetIndex] = {\n attribute: facetKey,\n data: facetValueObject,\n exhaustive: mainSubResponse.exhaustiveFacetsCount,\n };\n } else {\n var isFacetDisjunctive = state.disjunctiveFacets.indexOf(facetKey) !== -1;\n var isFacetConjunctive = state.facets.indexOf(facetKey) !== -1;\n var position;\n\n if (isFacetDisjunctive) {\n position = disjunctiveFacetsIndices[facetKey];\n self.disjunctiveFacets[position] = {\n name: facetKey,\n data: facetValueObject,\n exhaustive: mainSubResponse.exhaustiveFacetsCount,\n };\n assignFacetStats(\n self.disjunctiveFacets[position],\n mainSubResponse.facets_stats,\n facetKey\n );\n }\n if (isFacetConjunctive) {\n position = facetsIndices[facetKey];\n self.facets[position] = {\n name: facetKey,\n data: facetValueObject,\n exhaustive: mainSubResponse.exhaustiveFacetsCount,\n };\n assignFacetStats(\n self.facets[position],\n mainSubResponse.facets_stats,\n facetKey\n );\n }\n }\n });\n\n // Make sure we do not keep holes within the hierarchical facets\n this.hierarchicalFacets = compact(this.hierarchicalFacets);\n\n // aggregate the refined disjunctive facets\n disjunctiveFacets.forEach(function (disjunctiveFacet) {\n var result = results[nextDisjunctiveResult];\n var facets = result && result.facets ? result.facets : {};\n var hierarchicalFacet = state.getHierarchicalFacetByName(disjunctiveFacet);\n\n // There should be only item in facets.\n Object.keys(facets).forEach(function (dfacet) {\n var facetResults = facets[dfacet];\n\n var position;\n\n if (hierarchicalFacet) {\n position = findIndex(state.hierarchicalFacets, function (f) {\n return f.name === hierarchicalFacet.name;\n });\n var attributeIndex = findIndex(\n self.hierarchicalFacets[position],\n function (f) {\n return f.attribute === dfacet;\n }\n );\n\n // previous refinements and no results so not able to find it\n if (attributeIndex === -1) {\n return;\n }\n\n self.hierarchicalFacets[position][attributeIndex].data =\n self.persistHierarchicalRootCount\n ? mergeNumericMax(\n self.hierarchicalFacets[position][attributeIndex].data,\n facetResults\n )\n : defaultsPure(\n facetResults,\n self.hierarchicalFacets[position][attributeIndex].data\n );\n } else {\n position = disjunctiveFacetsIndices[dfacet];\n\n var dataFromMainRequest =\n (mainSubResponse.facets && mainSubResponse.facets[dfacet]) || {};\n\n self.disjunctiveFacets[position] = {\n name: dfacet,\n data: mergeNumericMax(dataFromMainRequest, facetResults),\n exhaustive: result.exhaustiveFacetsCount,\n };\n assignFacetStats(\n self.disjunctiveFacets[position],\n result.facets_stats,\n dfacet\n );\n\n if (state.disjunctiveFacetsRefinements[dfacet]) {\n state.disjunctiveFacetsRefinements[dfacet].forEach(\n function (refinementValue) {\n // add the disjunctive refinements if it is no more retrieved\n if (\n !self.disjunctiveFacets[position].data[refinementValue] &&\n state.disjunctiveFacetsRefinements[dfacet].indexOf(\n unescapeFacetValue(refinementValue)\n ) > -1\n ) {\n self.disjunctiveFacets[position].data[refinementValue] = 0;\n }\n }\n );\n }\n }\n });\n nextDisjunctiveResult++;\n });\n\n // if we have some parent level values for hierarchical facets, merge them\n state.getRefinedHierarchicalFacets().forEach(function (refinedFacet) {\n var hierarchicalFacet = state.getHierarchicalFacetByName(refinedFacet);\n var separator = state._getHierarchicalFacetSeparator(hierarchicalFacet);\n\n var currentRefinement = state.getHierarchicalRefinement(refinedFacet);\n // if we are already at a root refinement (or no refinement at all), there is no\n // root level values request\n if (\n currentRefinement.length === 0 ||\n currentRefinement[0].split(separator).length < 2\n ) {\n return;\n }\n\n results.slice(nextDisjunctiveResult).forEach(function (result) {\n var facets = result && result.facets ? result.facets : {};\n\n Object.keys(facets).forEach(function (dfacet) {\n var facetResults = facets[dfacet];\n var position = findIndex(state.hierarchicalFacets, function (f) {\n return f.name === hierarchicalFacet.name;\n });\n var attributeIndex = findIndex(\n self.hierarchicalFacets[position],\n function (f) {\n return f.attribute === dfacet;\n }\n );\n\n // previous refinements and no results so not able to find it\n if (attributeIndex === -1) {\n return;\n }\n\n // when we always get root levels, if the hits refinement is `beers > IPA` (count: 5),\n // then the disjunctive values will be `beers` (count: 100),\n // but we do not want to display\n // | beers (100)\n // > IPA (5)\n // We want\n // | beers (5)\n // > IPA (5)\n // @MAJOR: remove this legacy behaviour in next major version\n var defaultData = {};\n\n if (\n currentRefinement.length > 0 &&\n !self.persistHierarchicalRootCount\n ) {\n var root = currentRefinement[0].split(separator)[0];\n defaultData[root] =\n self.hierarchicalFacets[position][attributeIndex].data[root];\n }\n\n self.hierarchicalFacets[position][attributeIndex].data = defaultsPure(\n defaultData,\n facetResults,\n self.hierarchicalFacets[position][attributeIndex].data\n );\n });\n\n nextDisjunctiveResult++;\n });\n });\n\n // add the excludes\n Object.keys(state.facetsExcludes).forEach(function (facetName) {\n var excludes = state.facetsExcludes[facetName];\n var position = facetsIndices[facetName];\n\n self.facets[position] = {\n name: facetName,\n data: mainFacets[facetName],\n exhaustive: mainSubResponse.exhaustiveFacetsCount,\n };\n excludes.forEach(function (facetValue) {\n self.facets[position] = self.facets[position] || { name: facetName };\n self.facets[position].data = self.facets[position].data || {};\n self.facets[position].data[facetValue] = 0;\n });\n });\n\n /**\n * @type {Array}\n */\n this.hierarchicalFacets = this.hierarchicalFacets.map(\n generateHierarchicalTree(state)\n );\n\n /**\n * @type {Array}\n */\n this.facets = compact(this.facets);\n /**\n * @type {Array}\n */\n this.disjunctiveFacets = compact(this.disjunctiveFacets);\n\n this._state = state;\n}\n\n/**\n * Get a facet object with its name\n * @deprecated\n * @param {string} name name of the faceted attribute\n * @return {SearchResults.Facet} the facet object\n */\nSearchResults.prototype.getFacetByName = function (name) {\n function predicate(facet) {\n return facet.name === name;\n }\n\n return (\n find(this.facets, predicate) ||\n find(this.disjunctiveFacets, predicate) ||\n find(this.hierarchicalFacets, predicate)\n );\n};\n\n/**\n * Get the facet values of a specified attribute from a SearchResults object.\n * @private\n * @param {SearchResults} results the search results to search in\n * @param {string} attribute name of the faceted attribute to search for\n * @return {array|object} facet values. For the hierarchical facets it is an object.\n */\nfunction extractNormalizedFacetValues(results, attribute) {\n function predicate(facet) {\n return facet.name === attribute;\n }\n\n if (results._state.isConjunctiveFacet(attribute)) {\n var facet = find(results.facets, predicate);\n if (!facet) return [];\n\n return Object.keys(facet.data).map(function (name) {\n var value = escapeFacetValue(name);\n return {\n name: name,\n escapedValue: value,\n count: facet.data[name],\n isRefined: results._state.isFacetRefined(attribute, value),\n isExcluded: results._state.isExcludeRefined(attribute, name),\n };\n });\n } else if (results._state.isDisjunctiveFacet(attribute)) {\n var disjunctiveFacet = find(results.disjunctiveFacets, predicate);\n if (!disjunctiveFacet) return [];\n\n return Object.keys(disjunctiveFacet.data).map(function (name) {\n var value = escapeFacetValue(name);\n return {\n name: name,\n escapedValue: value,\n count: disjunctiveFacet.data[name],\n isRefined: results._state.isDisjunctiveFacetRefined(attribute, value),\n };\n });\n } else if (results._state.isHierarchicalFacet(attribute)) {\n var hierarchicalFacetValues = find(results.hierarchicalFacets, predicate);\n if (!hierarchicalFacetValues) return hierarchicalFacetValues;\n\n var hierarchicalFacet =\n results._state.getHierarchicalFacetByName(attribute);\n var separator =\n results._state._getHierarchicalFacetSeparator(hierarchicalFacet);\n var currentRefinement = unescapeFacetValue(\n results._state.getHierarchicalRefinement(attribute)[0] || ''\n );\n\n if (currentRefinement.indexOf(hierarchicalFacet.rootPath) === 0) {\n currentRefinement = currentRefinement.replace(\n hierarchicalFacet.rootPath + separator,\n ''\n );\n }\n\n var currentRefinementSplit = currentRefinement.split(separator);\n currentRefinementSplit.unshift(attribute);\n\n setIsRefined(hierarchicalFacetValues, currentRefinementSplit, 0);\n\n return hierarchicalFacetValues;\n }\n\n return undefined;\n}\n\n/**\n * Set the isRefined of a hierarchical facet result based on the current state.\n * @param {SearchResults.HierarchicalFacet} item Hierarchical facet to fix\n * @param {string[]} currentRefinement array of parts of the current hierarchical refinement\n * @param {number} depth recursion depth in the currentRefinement\n * @return {undefined} function mutates the item\n */\nfunction setIsRefined(item, currentRefinement, depth) {\n item.isRefined =\n item.name === (currentRefinement[depth] && currentRefinement[depth].trim());\n if (item.data) {\n item.data.forEach(function (child) {\n setIsRefined(child, currentRefinement, depth + 1);\n });\n }\n}\n\n/**\n * Sort nodes of a hierarchical or disjunctive facet results\n * @private\n * @param {function} sortFn sort function to apply\n * @param {HierarchicalFacet|Array} node node upon which we want to apply the sort\n * @param {string[]} names attribute names\n * @param {number} [level=0] current index in the names array\n * @return {HierarchicalFacet|Array} sorted node\n */\nfunction recSort(sortFn, node, names, level) {\n level = level || 0;\n\n if (Array.isArray(node)) {\n return sortFn(node, names[level]);\n }\n\n if (!node.data || node.data.length === 0) {\n return node;\n }\n\n var children = node.data.map(function (childNode) {\n return recSort(sortFn, childNode, names, level + 1);\n });\n var sortedChildren = sortFn(children, names[level]);\n var newNode = defaultsPure({ data: sortedChildren }, node);\n return newNode;\n}\n\nSearchResults.DEFAULT_SORT = ['isRefined:desc', 'count:desc', 'name:asc'];\n\nfunction vanillaSortFn(order, data) {\n return data.sort(order);\n}\n\n/**\n * @typedef FacetOrdering\n * @type {Object}\n * @property {string[]} [order]\n * @property {'count' | 'alpha' | 'hidden'} [sortRemainingBy]\n */\n\n/**\n * Sorts facet arrays via their facet ordering\n * @param {Array} facetValues the values\n * @param {FacetOrdering} facetOrdering the ordering\n * @returns {Array} the sorted facet values\n */\nfunction sortViaFacetOrdering(facetValues, facetOrdering) {\n var orderedFacets = [];\n var remainingFacets = [];\n var hide = facetOrdering.hide || [];\n var order = facetOrdering.order || [];\n\n /**\n * an object with the keys being the values in order, the values their index:\n * ['one', 'two'] -> { one: 0, two: 1 }\n */\n var reverseOrder = order.reduce(function (acc, name, i) {\n acc[name] = i;\n return acc;\n }, {});\n\n facetValues.forEach(function (item) {\n // hierarchical facets get sorted using their raw name\n var name = item.path || item.name;\n var hidden = hide.indexOf(name) > -1;\n if (!hidden && reverseOrder[name] !== undefined) {\n orderedFacets[reverseOrder[name]] = item;\n } else if (!hidden) {\n remainingFacets.push(item);\n }\n });\n\n orderedFacets = orderedFacets.filter(function (facet) {\n return facet;\n });\n\n var sortRemainingBy = facetOrdering.sortRemainingBy;\n var ordering;\n if (sortRemainingBy === 'hidden') {\n return orderedFacets;\n } else if (sortRemainingBy === 'alpha') {\n ordering = [\n ['path', 'name'],\n ['asc', 'asc'],\n ];\n } else {\n ordering = [['count'], ['desc']];\n }\n\n return orderedFacets.concat(\n orderBy(remainingFacets, ordering[0], ordering[1])\n );\n}\n\n/**\n * @param {SearchResults} results the search results class\n * @param {string} attribute the attribute to retrieve ordering of\n * @returns {FacetOrdering | undefined} the facet ordering\n */\nfunction getFacetOrdering(results, attribute) {\n return (\n results.renderingContent &&\n results.renderingContent.facetOrdering &&\n results.renderingContent.facetOrdering.values &&\n results.renderingContent.facetOrdering.values[attribute]\n );\n}\n\n/**\n * Get a the list of values for a given facet attribute. Those values are sorted\n * refinement first, descending count (bigger value on top), and name ascending\n * (alphabetical order). The sort formula can overridden using either string based\n * predicates or a function.\n *\n * This method will return all the values returned by the Algolia engine plus all\n * the values already refined. This means that it can happen that the\n * `maxValuesPerFacet` [configuration](https://www.algolia.com/doc/rest-api/search#param-maxValuesPerFacet)\n * might not be respected if you have facet values that are already refined.\n * @param {string} attribute attribute name\n * @param {object} opts configuration options.\n * @param {boolean} [opts.facetOrdering]\n * Force the use of facetOrdering from the result if a sortBy is present. If\n * sortBy isn't present, facetOrdering will be used automatically.\n * @param {Array.<string> | function} opts.sortBy\n * When using strings, it consists of\n * the name of the [FacetValue](#SearchResults.FacetValue) or the\n * [HierarchicalFacet](#SearchResults.HierarchicalFacet) attributes with the\n * order (`asc` or `desc`). For example to order the value by count, the\n * argument would be `['count:asc']`.\n *\n * If only the attribute name is specified, the ordering defaults to the one\n * specified in the default value for this attribute.\n *\n * When not specified, the order is\n * ascending. This parameter can also be a function which takes two facet\n * values and should return a number, 0 if equal, 1 if the first argument is\n * bigger or -1 otherwise.\n *\n * The default value for this attribute `['isRefined:desc', 'count:desc', 'name:asc']`\n * @return {FacetValue[]|HierarchicalFacet|undefined} depending on the type of facet of\n * the attribute requested (hierarchical, disjunctive or conjunctive)\n * @example\n * helper.on('result', function(event){\n * //get values ordered only by name ascending using the string predicate\n * event.results.getFacetValues('city', {sortBy: ['name:asc']});\n * //get values ordered only by count ascending using a function\n * event.results.getFacetValues('city', {\n * // this is equivalent to ['count:asc']\n * sortBy: function(a, b) {\n * if (a.count === b.count) return 0;\n * if (a.count > b.count) return 1;\n * if (b.count > a.count) return -1;\n * }\n * });\n * });\n */\nSearchResults.prototype.getFacetValues = function (attribute, opts) {\n var facetValues = extractNormalizedFacetValues(this, attribute);\n if (!facetValues) {\n return undefined;\n }\n\n var options = defaultsPure(opts, {\n sortBy: SearchResults.DEFAULT_SORT,\n // if no sortBy is given, attempt to sort based on facetOrdering\n // if it is given, we still allow to sort via facet ordering first\n facetOrdering: !(opts && opts.sortBy),\n });\n\n // eslint-disable-next-line consistent-this\n var results = this;\n var attributes;\n if (Array.isArray(facetValues)) {\n attributes = [attribute];\n } else {\n var config = results._state.getHierarchicalFacetByName(facetValues.name);\n attributes = config.attributes;\n }\n\n return recSort(\n function (data, facetName) {\n var facetOrdering = getFacetOrdering(results, facetName);\n if (options.facetOrdering) {\n if (facetOrdering) {\n return sortViaFacetOrdering(data, facetOrdering);\n }\n }\n\n if (Array.isArray(options.sortBy)) {\n var order = formatSort(options.sortBy, SearchResults.DEFAULT_SORT);\n var items = orderBy(data, order[0], order[1]);\n\n var hide =\n facetOrdering && facetOrdering.hide ? facetOrdering.hide : [];\n if (hide.length > 0) {\n var visible = [];\n items.forEach(function (item) {\n // hierarchical facets get sorted using their raw name\n var name = item.path || item.name;\n if (hide.indexOf(name) === -1) {\n visible.push(item);\n }\n });\n\n return visible;\n }\n\n return items;\n } else if (typeof options.sortBy === 'function') {\n return vanillaSortFn(options.sortBy, data);\n }\n throw new Error(\n 'options.sortBy is optional but if defined it must be ' +\n 'either an array of string (predicates) or a sorting function'\n );\n },\n facetValues,\n attributes\n );\n};\n\n/**\n * Returns the facet stats if attribute is defined and the facet contains some.\n * Otherwise returns undefined.\n * @param {string} attribute name of the faceted attribute\n * @return {object} The stats of the facet\n */\nSearchResults.prototype.getFacetStats = function (attribute) {\n if (this._state.isConjunctiveFacet(attribute)) {\n return getFacetStatsIfAvailable(this.facets, attribute);\n } else if (this._state.isDisjunctiveFacet(attribute)) {\n return getFacetStatsIfAvailable(this.disjunctiveFacets, attribute);\n }\n\n return undefined;\n};\n\n/**\n * @typedef {Object} FacetListItem\n * @property {string} name\n */\n\n/**\n * @param {FacetListItem[]} facetList (has more items, but enough for here)\n * @param {string} facetName The attribute to look for\n * @return {object|undefined} The stats of the facet\n */\nfunction getFacetStatsIfAvailable(facetList, facetName) {\n var data = find(facetList, function (facet) {\n return facet.name === facetName;\n });\n return data && data.stats;\n}\n\n/**\n * Returns all refinements for all filters + tags. It also provides\n * additional information: count and exhaustiveness for each filter.\n *\n * See the [refinement type](#Refinement) for an exhaustive view of the available\n * data.\n *\n * Note that for a numeric refinement, results are grouped per operator, this\n * means that it will return responses for operators which are empty.\n *\n * @return {Array.<Refinement>} all the refinements\n */\nSearchResults.prototype.getRefinements = function () {\n var state = this._state;\n // eslint-disable-next-line consistent-this\n var results = this;\n var res = [];\n\n Object.keys(state.facetsRefinements).forEach(function (attributeName) {\n state.facetsRefinements[attributeName].forEach(function (name) {\n res.push(\n getRefinement(state, 'facet', attributeName, name, results.facets)\n );\n });\n });\n\n Object.keys(state.facetsExcludes).forEach(function (attributeName) {\n state.facetsExcludes[attributeName].forEach(function (name) {\n res.push(\n getRefinement(state, 'exclude', attributeName, name, results.facets)\n );\n });\n });\n\n Object.keys(state.disjunctiveFacetsRefinements).forEach(\n function (attributeName) {\n state.disjunctiveFacetsRefinements[attributeName].forEach(\n function (name) {\n res.push(\n getRefinement(\n state,\n 'disjunctive',\n attributeName,\n name,\n results.disjunctiveFacets\n )\n );\n }\n );\n }\n );\n\n Object.keys(state.hierarchicalFacetsRefinements).forEach(\n function (attributeName) {\n state.hierarchicalFacetsRefinements[attributeName].forEach(\n function (name) {\n res.push(\n getHierarchicalRefinement(\n state,\n attributeName,\n name,\n results.hierarchicalFacets\n )\n );\n }\n );\n }\n );\n\n Object.keys(state.numericRefinements).forEach(function (attributeName) {\n var operators = state.numericRefinements[attributeName];\n Object.keys(operators).forEach(function (operator) {\n operators[operator].forEach(function (value) {\n res.push({\n type: 'numeric',\n attributeName: attributeName,\n name: value,\n numericValue: value,\n operator: operator,\n });\n });\n });\n });\n\n state.tagRefinements.forEach(function (name) {\n res.push({ type: 'tag', attributeName: '_tags', name: name });\n });\n\n return res;\n};\n\n/**\n * @typedef {Object} Facet\n * @property {string} name\n * @property {Object} data\n * @property {boolean} exhaustive\n */\n\n/**\n * @param {SearchParameters} state the current state\n * @param {string} type the type of the refinement\n * @param {string} attributeName The attribute of the facet\n * @param {*} name The name of the facet\n * @param {Facet[]} resultsFacets facets from the results\n * @return {Refinement} the refinement\n */\nfunction getRefinement(state, type, attributeName, name, resultsFacets) {\n var facet = find(resultsFacets, function (f) {\n return f.name === attributeName;\n });\n var count = facet && facet.data && facet.data[name] ? facet.data[name] : 0;\n var exhaustive = (facet && facet.exhaustive) || false;\n\n return {\n type: type,\n attributeName: attributeName,\n name: name,\n count: count,\n exhaustive: exhaustive,\n };\n}\n\n/**\n * @param {SearchParameters} state the current state\n * @param {string} attributeName the attribute of the hierarchical facet\n * @param {string} name the name of the facet\n * @param {Facet[]} resultsFacets facets from the results\n * @return {HierarchicalFacet} the hierarchical facet\n */\nfunction getHierarchicalRefinement(state, attributeName, name, resultsFacets) {\n var facetDeclaration = state.getHierarchicalFacetByName(attributeName);\n var separator = state._getHierarchicalFacetSeparator(facetDeclaration);\n var split = name.split(separator);\n var rootFacet = find(resultsFacets, function (facet) {\n return facet.name === attributeName;\n });\n\n var facet = split.reduce(function (intermediateFacet, part) {\n var newFacet =\n intermediateFacet &&\n find(intermediateFacet.data, function (f) {\n return f.name === part;\n });\n return newFacet !== undefined ? newFacet : intermediateFacet;\n }, rootFacet);\n\n var count = (facet && facet.count) || 0;\n var exhaustive = (facet && facet.exhaustive) || false;\n var path = (facet && facet.path) || '';\n\n return {\n type: 'hierarchical',\n attributeName: attributeName,\n name: path,\n count: count,\n exhaustive: exhaustive,\n };\n}\n\nmodule.exports = SearchResults;\n"],"names":["compact","require$$0","defaultsPure","require$$1","fv","require$$2","find","require$$3","findIndex","require$$4","formatSort","require$$5","mergeNumericMax","require$$6","orderBy","require$$7","escapeFacetValue","unescapeFacetValue","generateHierarchicalTree","require$$8","getIndices","attributes","indices","forEach","val","idx","assignFacetStats","dest","facetStats","key","stats","SearchResults","state","results","options","mainSubResponse","this","_rawResults","self","Object","keys","opts","persistHierarchicalRootCount","processingTimeMS","reduce","sum","result","undefined","disjunctiveFacets","hierarchicalFacets","map","facets","getRefinedDisjunctiveFacets","facetsIndices","disjunctiveFacetsIndices","nextDisjunctiveResult","mainFacets","facetKey","hierarchicalAttributeName","facetValueObject","hierarchicalFacet","indexOf","facetIndex","idxAttributeName","f","name","attribute","data","exhaustive","exhaustiveFacetsCount","position","isFacetDisjunctive","isFacetConjunctive","facets_stats","disjunctiveFacet","getHierarchicalFacetByName","dfacet","facetResults","attributeIndex","dataFromMainRequest","disjunctiveFacetsRefinements","refinementValue","getRefinedHierarchicalFacets","refinedFacet","separator","_getHierarchicalFacetSeparator","currentRefinement","getHierarchicalRefinement","length","split","slice","defaultData","root","facetsExcludes","facetName","excludes","facetValue","_state","extractNormalizedFacetValues","predicate","facet","isConjunctiveFacet","value","escapedValue","count","isRefined","isFacetRefined","isExcluded","isExcludeRefined","isDisjunctiveFacet","isDisjunctiveFacetRefined","isHierarchicalFacet","hierarchicalFacetValues","rootPath","replace","currentRefinementSplit","unshift","setIsRefined","item","depth","trim","child","recSort","sortFn","node","names","level","Array","isArray","children","childNode","sortedChildren","getFacetStatsIfAvailable","facetList","getRefinement","type","attributeName","resultsFacets","prototype","getFacetByName","DEFAULT_SORT","getFacetValues","facetValues","sortBy","facetOrdering","renderingContent","values","getFacetOrdering","orderedFacets","remainingFacets","hide","reverseOrder","order","acc","i","path","hidden","push","filter","ordering","sortRemainingBy","concat","sortViaFacetOrdering","items","visible","sort","vanillaSortFn","Error","getFacetStats","getRefinements","res","facetsRefinements","hierarchicalFacetsRefinements","facetDeclaration","rootFacet","intermediateFacet","part","newFacet","numericRefinements","operators","operator","numericValue","tagRefinements","SearchResults_1"],"mappings":"ibAEA,IAAIA,EAAUC,EAAAA,YACVC,EAAeC,EAAAA,YACfC,EAAKC,EAAAA,YACLC,EAAOC,EAAAA,YACPC,EAAYC,EAAAA,YACZC,EAAaC,EAAAA,YACbC,EAAkBC,EAAAA,YAClBC,EAAUC,EAAAA,YACVC,EAAmBZ,EAAGY,iBACtBC,EAAqBb,EAAGa,mBAExBC,EAA2BC,EAAAA,YAgD/B,SAASC,EAAWC,GAClB,IAAIC,EAAU,CAAA,EAMd,OAJAD,EAAWE,QAAQ,SAAUC,EAAKC,GAChCH,EAAQE,GAAOC,CACnB,GAESH,CACT,CAEA,SAASI,EAAiBC,EAAMC,EAAYC,GACtCD,GAAcA,EAAWC,KAC3BF,EAAKG,MAAQF,EAAWC,GAE5B,CA6JA,SAASE,EAAcC,EAAOC,EAASC,GACrC,IAAIC,EAAkBF,EAAQ,IAAM,CAAA,EAEpCG,KAAKC,YAAcJ,EAGnB,IAAIK,EAAOF,KAGXG,OAAOC,KAAKL,GAAiBZ,QAAQ,SAAUM,GAC7CS,EAAKT,GAAOM,EAAgBN,EAChC,GAGE,IAAIY,EAAOvC,EAAagC,EAAS,CAC/BQ,8BAA8B,IAEhCH,OAAOC,KAAKC,GAAMlB,QAAQ,SAAUM,GAClCS,EAAKT,GAAOY,EAAKZ,EACrB,GA8IEO,KAAKO,iBAAmBV,EAAQW,OAAO,SAAUC,EAAKC,GACpD,YA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,EAAYpD,EAAMqD,+BAA+BwF,GACjDpF,EAAQxB,EAAKwB,MAAML,GACnB0F,EAAYxK,EAAKmI,EAAe,SAAUrC,GAC5C,OAAOA,EAAMnC,OAASuE,CAC1B,GAEMpC,EAAQX,EAAM7C,OAAO,SAAUmI,EAAmBC,GACpD,IAAIC,EACFF,GACAzK,EAAKyK,EAAkB5G,KAAM,SAAUH,GACrC,OAAOA,EAAEC,OAAS+G,CAC1B,GACI,YAAoBjI,IAAbkI,EAAyBA,EAAWF,CAC/C,EAAKD,GAECtE,EAASJ,GAASA,EAAMI,OAAU,EAClCpC,EAAcgC,GAASA,EAAMhC,aAAe,EAC5CuF,EAAQvD,GAASA,EAAMuD,MAAS,GAEpC,MAAO,CACLpB,KAAM,eACNC,cAAeA,EACfvE,KAAM0F,EACNnD,MAAOA,EACPpC,WAAYA,EAEhB,CApGYmB,CACEvD,EACAwG,EACAvE,EACAhC,EAAQgB,oBAGtB,EAEA,GAGEV,OAAOC,KAAKR,EAAMkJ,oBAAoB3J,QAAQ,SAAUiH,GACtD,IAAI2C,EAAYnJ,EAAMkJ,mBAAmB1C,GACzCjG,OAAOC,KAAK2I,GAAW5J,QAAQ,SAAU6J,GACvCD,EAAUC,GAAU7J,QAAQ,SAAU+E,GACpCoE,EAAIb,KAAK,CACPtB,KAAM,UACNC,cAAeA,EACfvE,KAAMqC,EACN+E,aAAc/E,EACd8E,SAAUA,GAEpB,EACA,EACA,GAEEpJ,EAAMsJ,eAAe/J,QAAQ,SAAU0C,GACrCyG,EAAIb,KAAK,CAAEtB,KAAM,MAAOC,cAAe,QAASvE,KAAMA,GAC1D,GAESyG,CACT,EAsEAa,EAAiBxJ","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../node_modules/algoliasearch-helper/src/SearchResults/index.js"],"sourcesContent":["'use strict';\n\nvar compact = require('../functions/compact');\nvar defaultsPure = require('../functions/defaultsPure');\nvar fv = require('../functions/escapeFacetValue');\nvar find = require('../functions/find');\nvar findIndex = require('../functions/findIndex');\nvar formatSort = require('../functions/formatSort');\nvar mergeNumericMax = require('../functions/mergeNumericMax');\nvar orderBy = require('../functions/orderBy');\nvar escapeFacetValue = fv.escapeFacetValue;\nvar unescapeFacetValue = fv.unescapeFacetValue;\n\nvar generateHierarchicalTree = require('./generate-hierarchical-tree');\n\n/**\n * @typedef SearchResults.Facet\n * @type {object}\n * @property {string} name name of the attribute in the record\n * @property {object} data the faceting data: value, number of entries\n * @property {object} stats undefined unless facet_stats is retrieved from algolia\n */\n\n/**\n * @typedef SearchResults.HierarchicalFacet\n * @type {object}\n * @property {string} name name of the current value given the hierarchical level, trimmed.\n * If root node, you get the facet name\n * @property {number} count number of objects matching this hierarchical value\n * @property {string} path the current hierarchical value full path\n * @property {boolean} isRefined `true` if the current value was refined, `false` otherwise\n * @property {HierarchicalFacet[]} data sub values for the current level\n */\n\n/**\n * @typedef SearchResults.FacetValue\n * @type {object}\n * @property {string} name the facet value itself\n * @property {number} count times this facet appears in the results\n * @property {boolean} isRefined is the facet currently selected\n * @property {boolean} isExcluded is the facet currently excluded (only for conjunctive facets)\n */\n\n/**\n * @typedef Refinement\n * @type {object}\n * @property {string} type the type of filter used:\n * `numeric`, `facet`, `exclude`, `disjunctive`, `hierarchical`\n * @property {string} attributeName name of the attribute used for filtering\n * @property {string} name the value of the filter\n * @property {number} numericValue the value as a number. Only for numeric filters.\n * @property {string} operator the operator used. Only for numeric filters.\n * @property {number} count the number of computed hits for this filter. Only on facets.\n * @property {boolean} exhaustive if the count is exhaustive\n */\n\n/**\n * Turn an array of attributes in an object of attributes with their position in the array as value\n * @param {string[]} attributes the list of attributes in the record\n * @return {object} the list of attributes indexed by attribute name\n */\nfunction getIndices(attributes) {\n var indices = {};\n\n attributes.forEach(function (val, idx) {\n indices[val] = idx;\n });\n\n return indices;\n}\n\nfunction assignFacetStats(dest, facetStats, key) {\n if (facetStats && facetStats[key]) {\n dest.stats = facetStats[key];\n }\n}\n\n/**\n * @typedef {Object} HierarchicalFacet\n * @property {string} name\n * @property {string[]} attributes\n */\n\n/**\n * @param {HierarchicalFacet[]} hierarchicalFacets All hierarchical facets\n * @param {string} hierarchicalAttributeName The name of the hierarchical attribute\n * @return {HierarchicalFacet} The hierarchical facet matching the attribute name\n */\nfunction findMatchingHierarchicalFacetFromAttributeName(\n hierarchicalFacets,\n hierarchicalAttributeName\n) {\n return find(\n hierarchicalFacets,\n function facetKeyMatchesAttribute(hierarchicalFacet) {\n var facetNames = hierarchicalFacet.attributes || [];\n return facetNames.indexOf(hierarchicalAttributeName) > -1;\n }\n );\n}\n\n/**\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.<object>} results the results from algolia client\n * @param {object} options options to control results content\n * @example <caption>SearchResults of the first query in\n * <a href=\"http://demos.algolia.com/instant-search-demo\">the instant search demo</a></caption>\n{\n \"hitsPerPage\": 10,\n \"processingTimeMS\": 2,\n \"facets\": [\n {\n \"name\": \"type\",\n \"data\": {\n \"HardGood\": 6627,\n \"BlackTie\": 550,\n \"Music\": 665,\n \"Software\": 131,\n \"Game\": 456,\n \"Movie\": 1571\n },\n \"exhaustive\": false\n },\n {\n \"exhaustive\": false,\n \"data\": {\n \"Free shipping\": 5507\n },\n \"name\": \"shipping\"\n }\n ],\n \"hits\": [\n {\n \"thumbnailImage\": \"http://img.bbystatic.com/BestBuy_US/images/products/1688/1688832_54x108_s.gif\",\n \"_highlightResult\": {\n \"shortDescription\": {\n \"matchLevel\": \"none\",\n \"value\": \"Safeguard your PC, Mac, Android and iOS devices with comprehensive Internet protection\",\n \"matchedWords\": []\n },\n \"category\": {\n \"matchLevel\": \"none\",\n \"value\": \"Computer Security Software\",\n \"matchedWords\": []\n },\n \"manufacturer\": {\n \"matchedWords\": [],\n \"value\": \"Webroot\",\n \"matchLevel\": \"none\"\n },\n \"name\": {\n \"value\": \"Webroot SecureAnywhere Internet Security (3-Device) (1-Year Subscription) - Mac/Windows\",\n \"matchedWords\": [],\n \"matchLevel\": \"none\"\n }\n },\n \"image\": \"http://img.bbystatic.com/BestBuy_US/images/products/1688/1688832_105x210_sc.jpg\",\n \"shipping\": \"Free shipping\",\n \"bestSellingRank\": 4,\n \"shortDescription\": \"Safeguard your PC, Mac, Android and iOS devices with comprehensive Internet protection\",\n \"url\": \"http://www.bestbuy.com/site/webroot-secureanywhere-internet-security-3-devi…d=1219060687969&skuId=1688832&cmp=RMX&ky=2d3GfEmNIzjA0vkzveHdZEBgpPCyMnLTJ\",\n \"name\": \"Webroot SecureAnywhere Internet Security (3-Device) (1-Year Subscription) - Mac/Windows\",\n \"category\": \"Computer Security Software\",\n \"salePrice_range\": \"1 - 50\",\n \"objectID\": \"1688832\",\n \"type\": \"Software\",\n \"customerReviewCount\": 5980,\n \"salePrice\": 49.99,\n \"manufacturer\": \"Webroot\"\n },\n ....\n ],\n \"nbHits\": 10000,\n \"disjunctiveFacets\": [\n {\n \"exhaustive\": false,\n \"data\": {\n \"5\": 183,\n \"12\": 112,\n \"7\": 149,\n ...\n },\n \"name\": \"customerReviewCount\",\n \"stats\": {\n \"max\": 7461,\n \"avg\": 157.939,\n \"min\": 1\n }\n },\n {\n \"data\": {\n \"Printer Ink\": 142,\n \"Wireless Speakers\": 60,\n \"Point & Shoot Cameras\": 48,\n ...\n },\n \"name\": \"category\",\n \"exhaustive\": false\n },\n {\n \"exhaustive\": false,\n \"data\": {\n \"> 5000\": 2,\n \"1 - 50\": 6524,\n \"501 - 2000\": 566,\n \"201 - 500\": 1501,\n \"101 - 200\": 1360,\n \"2001 - 5000\": 47\n },\n \"name\": \"salePrice_range\"\n },\n {\n \"data\": {\n \"Dynex™\": 202,\n \"Insignia™\": 230,\n \"PNY\": 72,\n ...\n },\n \"name\": \"manufacturer\",\n \"exhaustive\": false\n }\n ],\n \"query\": \"\",\n \"nbPages\": 100,\n \"page\": 0,\n \"index\": \"bestbuy\"\n}\n **/\nfunction SearchResults(state, results, options) {\n var mainSubResponse = results[0] || {};\n\n this._rawResults = results;\n\n // eslint-disable-next-line consistent-this\n var self = this;\n\n // https://www.algolia.com/doc/api-reference/api-methods/search/#response\n Object.keys(mainSubResponse).forEach(function (key) {\n self[key] = mainSubResponse[key];\n });\n\n // Make every key of the result options reachable from the instance\n var opts = defaultsPure(options, {\n persistHierarchicalRootCount: false,\n });\n Object.keys(opts).forEach(function (key) {\n self[key] = opts[key];\n });\n\n /**\n * query used to generate the results\n * @name query\n * @member {string}\n * @memberof SearchResults\n * @instance\n */\n /**\n * The query as parsed by the engine given all the rules.\n * @name parsedQuery\n * @member {string}\n * @memberof SearchResults\n * @instance\n */\n /**\n * all the records that match the search parameters. Each record is\n * augmented with a new attribute `_highlightResult`\n * which is an object keyed by attribute and with the following properties:\n * - `value` : the value of the facet highlighted (html)\n * - `matchLevel`: `full`, `partial` or `none`, depending on how the query terms match\n * @name hits\n * @member {object[]}\n * @memberof SearchResults\n * @instance\n */\n /**\n * index where the results come from\n * @name index\n * @member {string}\n * @memberof SearchResults\n * @instance\n */\n /**\n * number of hits per page requested\n * @name hitsPerPage\n * @member {number}\n * @memberof SearchResults\n * @instance\n */\n /**\n * total number of hits of this query on the index\n * @name nbHits\n * @member {number}\n * @memberof SearchResults\n * @instance\n */\n /**\n * total number of pages with respect to the number of hits per page and the total number of hits\n * @name nbPages\n * @member {number}\n * @memberof SearchResults\n * @instance\n */\n /**\n * current page\n * @name page\n * @member {number}\n * @memberof SearchResults\n * @instance\n */\n /**\n * The position if the position was guessed by IP.\n * @name aroundLatLng\n * @member {string}\n * @memberof SearchResults\n * @instance\n * @example \"48.8637,2.3615\",\n */\n /**\n * The radius computed by Algolia.\n * @name automaticRadius\n * @member {string}\n * @memberof SearchResults\n * @instance\n * @example \"126792922\",\n */\n /**\n * String identifying the server used to serve this request.\n *\n * getRankingInfo needs to be set to `true` for this to be returned\n *\n * @name serverUsed\n * @member {string}\n * @memberof SearchResults\n * @instance\n * @example \"c7-use-2.algolia.net\",\n */\n /**\n * Boolean that indicates if the computation of the counts did time out.\n * @deprecated\n * @name timeoutCounts\n * @member {boolean}\n * @memberof SearchResults\n * @instance\n */\n /**\n * Boolean that indicates if the computation of the hits did time out.\n * @deprecated\n * @name timeoutHits\n * @member {boolean}\n * @memberof SearchResults\n * @instance\n */\n /**\n * True if the counts of the facets is exhaustive\n * @name exhaustiveFacetsCount\n * @member {boolean}\n * @memberof SearchResults\n * @instance\n */\n /**\n * True if the number of hits is exhaustive\n * @name exhaustiveNbHits\n * @member {boolean}\n * @memberof SearchResults\n * @instance\n */\n /**\n * Contains the userData if they are set by a [query rule](https://www.algolia.com/doc/guides/query-rules/query-rules-overview/).\n * @name userData\n * @member {object[]}\n * @memberof SearchResults\n * @instance\n */\n /**\n * queryID is the unique identifier of the query used to generate the current search results.\n * This value is only available if the `clickAnalytics` search parameter is set to `true`.\n * @name queryID\n * @member {string}\n * @memberof SearchResults\n * @instance\n */\n\n /**\n * sum of the processing time of all the queries\n * @name processingTimeMS\n * @member {number}\n * @memberof SearchResults\n * @instance\n */\n this.processingTimeMS = results.reduce(function (sum, result) {\n return result.processingTimeMS === undefined\n ? sum\n : sum + result.processingTimeMS;\n }, 0);\n\n /**\n * disjunctive facets results\n * @member {SearchResults.Facet[]}\n */\n this.disjunctiveFacets = [];\n /**\n * disjunctive facets results\n * @member {SearchResults.HierarchicalFacet[]}\n */\n this.hierarchicalFacets = state.hierarchicalFacets.map(\n function initFutureTree() {\n return [];\n }\n );\n /**\n * other facets results\n * @member {SearchResults.Facet[]}\n */\n this.facets = [];\n\n var disjunctiveFacets = state.getRefinedDisjunctiveFacets();\n\n var facetsIndices = getIndices(state.facets);\n var disjunctiveFacetsIndices = getIndices(state.disjunctiveFacets);\n var nextDisjunctiveResult = 1;\n\n // Since we send request only for disjunctive facets that have been refined,\n // we get the facets information from the first, general, response.\n\n var mainFacets = mainSubResponse.facets || {};\n\n Object.keys(mainFacets).forEach(function (facetKey) {\n var facetValueObject = mainFacets[facetKey];\n\n var hierarchicalFacet = findMatchingHierarchicalFacetFromAttributeName(\n state.hierarchicalFacets,\n facetKey\n );\n\n if (hierarchicalFacet) {\n // Place the hierarchicalFacet data at the correct index depending on\n // the attributes order that was defined at the helper initialization\n var facetIndex = hierarchicalFacet.attributes.indexOf(facetKey);\n var idxAttributeName = findIndex(state.hierarchicalFacets, function (f) {\n return f.name === hierarchicalFacet.name;\n });\n self.hierarchicalFacets[idxAttributeName][facetIndex] = {\n attribute: facetKey,\n data: facetValueObject,\n exhaustive: mainSubResponse.exhaustiveFacetsCount,\n };\n } else {\n var isFacetDisjunctive = state.disjunctiveFacets.indexOf(facetKey) !== -1;\n var isFacetConjunctive = state.facets.indexOf(facetKey) !== -1;\n var position;\n\n if (isFacetDisjunctive) {\n position = disjunctiveFacetsIndices[facetKey];\n self.disjunctiveFacets[position] = {\n name: facetKey,\n data: facetValueObject,\n exhaustive: mainSubResponse.exhaustiveFacetsCount,\n };\n assignFacetStats(\n self.disjunctiveFacets[position],\n mainSubResponse.facets_stats,\n facetKey\n );\n }\n if (isFacetConjunctive) {\n position = facetsIndices[facetKey];\n self.facets[position] = {\n name: facetKey,\n data: facetValueObject,\n exhaustive: mainSubResponse.exhaustiveFacetsCount,\n };\n assignFacetStats(\n self.facets[position],\n mainSubResponse.facets_stats,\n facetKey\n );\n }\n }\n });\n\n // Make sure we do not keep holes within the hierarchical facets\n this.hierarchicalFacets = compact(this.hierarchicalFacets);\n\n // aggregate the refined disjunctive facets\n disjunctiveFacets.forEach(function (disjunctiveFacet) {\n var result = results[nextDisjunctiveResult];\n var facets = result && result.facets ? result.facets : {};\n var hierarchicalFacet = state.getHierarchicalFacetByName(disjunctiveFacet);\n\n // There should be only item in facets.\n Object.keys(facets).forEach(function (dfacet) {\n var facetResults = facets[dfacet];\n\n var position;\n\n if (hierarchicalFacet) {\n position = findIndex(state.hierarchicalFacets, function (f) {\n return f.name === hierarchicalFacet.name;\n });\n var attributeIndex = findIndex(\n self.hierarchicalFacets[position],\n function (f) {\n return f.attribute === dfacet;\n }\n );\n\n // previous refinements and no results so not able to find it\n if (attributeIndex === -1) {\n return;\n }\n\n self.hierarchicalFacets[position][attributeIndex].data =\n self.persistHierarchicalRootCount\n ? mergeNumericMax(\n self.hierarchicalFacets[position][attributeIndex].data,\n facetResults\n )\n : defaultsPure(\n facetResults,\n self.hierarchicalFacets[position][attributeIndex].data\n );\n } else {\n position = disjunctiveFacetsIndices[dfacet];\n\n var dataFromMainRequest =\n (mainSubResponse.facets && mainSubResponse.facets[dfacet]) || {};\n\n self.disjunctiveFacets[position] = {\n name: dfacet,\n data: mergeNumericMax(dataFromMainRequest, facetResults),\n exhaustive: result.exhaustiveFacetsCount,\n };\n assignFacetStats(\n self.disjunctiveFacets[position],\n result.facets_stats,\n dfacet\n );\n\n if (state.disjunctiveFacetsRefinements[dfacet]) {\n state.disjunctiveFacetsRefinements[dfacet].forEach(function (\n refinementValue\n ) {\n // add the disjunctive refinements if it is no more retrieved\n if (\n !self.disjunctiveFacets[position].data[refinementValue] &&\n state.disjunctiveFacetsRefinements[dfacet].indexOf(\n unescapeFacetValue(refinementValue)\n ) > -1\n ) {\n self.disjunctiveFacets[position].data[refinementValue] = 0;\n }\n });\n }\n }\n });\n nextDisjunctiveResult++;\n });\n\n // if we have some parent level values for hierarchical facets, merge them\n state.getRefinedHierarchicalFacets().forEach(function (refinedFacet) {\n var hierarchicalFacet = state.getHierarchicalFacetByName(refinedFacet);\n var separator = state._getHierarchicalFacetSeparator(hierarchicalFacet);\n\n var currentRefinement = state.getHierarchicalRefinement(refinedFacet);\n // if we are already at a root refinement (or no refinement at all), there is no\n // root level values request\n if (\n currentRefinement.length === 0 ||\n currentRefinement[0].split(separator).length < 2\n ) {\n return;\n }\n\n results.slice(nextDisjunctiveResult).forEach(function (result) {\n var facets = result && result.facets ? result.facets : {};\n\n Object.keys(facets).forEach(function (dfacet) {\n var facetResults = facets[dfacet];\n var position = findIndex(state.hierarchicalFacets, function (f) {\n return f.name === hierarchicalFacet.name;\n });\n var attributeIndex = findIndex(\n self.hierarchicalFacets[position],\n function (f) {\n return f.attribute === dfacet;\n }\n );\n\n // previous refinements and no results so not able to find it\n if (attributeIndex === -1) {\n return;\n }\n\n // when we always get root levels, if the hits refinement is `beers > IPA` (count: 5),\n // then the disjunctive values will be `beers` (count: 100),\n // but we do not want to display\n // | beers (100)\n // > IPA (5)\n // We want\n // | beers (5)\n // > IPA (5)\n // @MAJOR: remove this legacy behaviour in next major version\n var defaultData = {};\n\n if (\n currentRefinement.length > 0 &&\n !self.persistHierarchicalRootCount\n ) {\n var root = currentRefinement[0].split(separator)[0];\n defaultData[root] =\n self.hierarchicalFacets[position][attributeIndex].data[root];\n }\n\n self.hierarchicalFacets[position][attributeIndex].data = defaultsPure(\n defaultData,\n facetResults,\n self.hierarchicalFacets[position][attributeIndex].data\n );\n });\n\n nextDisjunctiveResult++;\n });\n });\n\n // add the excludes\n Object.keys(state.facetsExcludes).forEach(function (facetName) {\n var excludes = state.facetsExcludes[facetName];\n var position = facetsIndices[facetName];\n\n self.facets[position] = {\n name: facetName,\n data: mainFacets[facetName],\n exhaustive: mainSubResponse.exhaustiveFacetsCount,\n };\n excludes.forEach(function (facetValue) {\n self.facets[position] = self.facets[position] || { name: facetName };\n self.facets[position].data = self.facets[position].data || {};\n self.facets[position].data[facetValue] = 0;\n });\n });\n\n /**\n * @type {Array}\n */\n this.hierarchicalFacets = this.hierarchicalFacets.map(\n generateHierarchicalTree(state)\n );\n\n /**\n * @type {Array}\n */\n this.facets = compact(this.facets);\n /**\n * @type {Array}\n */\n this.disjunctiveFacets = compact(this.disjunctiveFacets);\n\n this._state = state;\n}\n\n/**\n * Get a facet object with its name\n * @deprecated\n * @param {string} name name of the faceted attribute\n * @return {SearchResults.Facet} the facet object\n */\nSearchResults.prototype.getFacetByName = function (name) {\n function predicate(facet) {\n return facet.name === name;\n }\n\n return (\n find(this.facets, predicate) ||\n find(this.disjunctiveFacets, predicate) ||\n find(this.hierarchicalFacets, predicate)\n );\n};\n\n/**\n * Get the facet values of a specified attribute from a SearchResults object.\n * @private\n * @param {SearchResults} results the search results to search in\n * @param {string} attribute name of the faceted attribute to search for\n * @return {array|object} facet values. For the hierarchical facets it is an object.\n */\nfunction extractNormalizedFacetValues(results, attribute) {\n function predicate(facet) {\n return facet.name === attribute;\n }\n\n if (results._state.isConjunctiveFacet(attribute)) {\n var facet = find(results.facets, predicate);\n if (!facet) return [];\n\n return Object.keys(facet.data).map(function (name) {\n var value = escapeFacetValue(name);\n return {\n name: name,\n escapedValue: value,\n count: facet.data[name],\n isRefined: results._state.isFacetRefined(attribute, value),\n isExcluded: results._state.isExcludeRefined(attribute, name),\n };\n });\n } else if (results._state.isDisjunctiveFacet(attribute)) {\n var disjunctiveFacet = find(results.disjunctiveFacets, predicate);\n if (!disjunctiveFacet) return [];\n\n return Object.keys(disjunctiveFacet.data).map(function (name) {\n var value = escapeFacetValue(name);\n return {\n name: name,\n escapedValue: value,\n count: disjunctiveFacet.data[name],\n isRefined: results._state.isDisjunctiveFacetRefined(attribute, value),\n };\n });\n } else if (results._state.isHierarchicalFacet(attribute)) {\n var hierarchicalFacetValues = find(results.hierarchicalFacets, predicate);\n if (!hierarchicalFacetValues) return hierarchicalFacetValues;\n\n var hierarchicalFacet =\n results._state.getHierarchicalFacetByName(attribute);\n var separator =\n results._state._getHierarchicalFacetSeparator(hierarchicalFacet);\n var currentRefinement = unescapeFacetValue(\n results._state.getHierarchicalRefinement(attribute)[0] || ''\n );\n\n if (currentRefinement.indexOf(hierarchicalFacet.rootPath) === 0) {\n currentRefinement = currentRefinement.replace(\n hierarchicalFacet.rootPath + separator,\n ''\n );\n }\n\n var currentRefinementSplit = currentRefinement.split(separator);\n currentRefinementSplit.unshift(attribute);\n\n setIsRefined(hierarchicalFacetValues, currentRefinementSplit, 0);\n\n return hierarchicalFacetValues;\n }\n\n return undefined;\n}\n\n/**\n * Set the isRefined of a hierarchical facet result based on the current state.\n * @param {SearchResults.HierarchicalFacet} item Hierarchical facet to fix\n * @param {string[]} currentRefinement array of parts of the current hierarchical refinement\n * @param {number} depth recursion depth in the currentRefinement\n * @return {undefined} function mutates the item\n */\nfunction setIsRefined(item, currentRefinement, depth) {\n item.isRefined =\n item.name === (currentRefinement[depth] && currentRefinement[depth].trim());\n if (item.data) {\n item.data.forEach(function (child) {\n setIsRefined(child, currentRefinement, depth + 1);\n });\n }\n}\n\n/**\n * Sort nodes of a hierarchical or disjunctive facet results\n * @private\n * @param {function} sortFn sort function to apply\n * @param {HierarchicalFacet|Array} node node upon which we want to apply the sort\n * @param {string[]} names attribute names\n * @param {number} [level=0] current index in the names array\n * @return {HierarchicalFacet|Array} sorted node\n */\nfunction recSort(sortFn, node, names, level) {\n level = level || 0;\n\n if (Array.isArray(node)) {\n return sortFn(node, names[level]);\n }\n\n if (!node.data || node.data.length === 0) {\n return node;\n }\n\n var children = node.data.map(function (childNode) {\n return recSort(sortFn, childNode, names, level + 1);\n });\n var sortedChildren = sortFn(children, names[level]);\n var newNode = defaultsPure({ data: sortedChildren }, node);\n return newNode;\n}\n\nSearchResults.DEFAULT_SORT = ['isRefined:desc', 'count:desc', 'name:asc'];\n\nfunction vanillaSortFn(order, data) {\n return data.sort(order);\n}\n\n/**\n * @typedef FacetOrdering\n * @type {Object}\n * @property {string[]} [order]\n * @property {'count' | 'alpha' | 'hidden'} [sortRemainingBy]\n */\n\n/**\n * Sorts facet arrays via their facet ordering\n * @param {Array} facetValues the values\n * @param {FacetOrdering} facetOrdering the ordering\n * @returns {Array} the sorted facet values\n */\nfunction sortViaFacetOrdering(facetValues, facetOrdering) {\n var orderedFacets = [];\n var remainingFacets = [];\n var hide = facetOrdering.hide || [];\n var order = facetOrdering.order || [];\n\n /**\n * an object with the keys being the values in order, the values their index:\n * ['one', 'two'] -> { one: 0, two: 1 }\n */\n var reverseOrder = order.reduce(function (acc, name, i) {\n acc[name] = i;\n return acc;\n }, {});\n\n facetValues.forEach(function (item) {\n // hierarchical facets get sorted using their raw name\n var name = item.path || item.name;\n var hidden = hide.indexOf(name) > -1;\n if (!hidden && reverseOrder[name] !== undefined) {\n orderedFacets[reverseOrder[name]] = item;\n } else if (!hidden) {\n remainingFacets.push(item);\n }\n });\n\n orderedFacets = orderedFacets.filter(function (facet) {\n return facet;\n });\n\n var sortRemainingBy = facetOrdering.sortRemainingBy;\n var ordering;\n if (sortRemainingBy === 'hidden') {\n return orderedFacets;\n } else if (sortRemainingBy === 'alpha') {\n ordering = [\n ['path', 'name'],\n ['asc', 'asc'],\n ];\n } else {\n ordering = [['count'], ['desc']];\n }\n\n return orderedFacets.concat(\n orderBy(remainingFacets, ordering[0], ordering[1])\n );\n}\n\n/**\n * @param {SearchResults} results the search results class\n * @param {string} attribute the attribute to retrieve ordering of\n * @returns {FacetOrdering | undefined} the facet ordering\n */\nfunction getFacetOrdering(results, attribute) {\n return (\n results.renderingContent &&\n results.renderingContent.facetOrdering &&\n results.renderingContent.facetOrdering.values &&\n results.renderingContent.facetOrdering.values[attribute]\n );\n}\n\n/**\n * Get a the list of values for a given facet attribute. Those values are sorted\n * refinement first, descending count (bigger value on top), and name ascending\n * (alphabetical order). The sort formula can overridden using either string based\n * predicates or a function.\n *\n * This method will return all the values returned by the Algolia engine plus all\n * the values already refined. This means that it can happen that the\n * `maxValuesPerFacet` [configuration](https://www.algolia.com/doc/rest-api/search#param-maxValuesPerFacet)\n * might not be respected if you have facet values that are already refined.\n * @param {string} attribute attribute name\n * @param {object} opts configuration options.\n * @param {boolean} [opts.facetOrdering]\n * Force the use of facetOrdering from the result if a sortBy is present. If\n * sortBy isn't present, facetOrdering will be used automatically.\n * @param {Array.<string> | function} opts.sortBy\n * When using strings, it consists of\n * the name of the [FacetValue](#SearchResults.FacetValue) or the\n * [HierarchicalFacet](#SearchResults.HierarchicalFacet) attributes with the\n * order (`asc` or `desc`). For example to order the value by count, the\n * argument would be `['count:asc']`.\n *\n * If only the attribute name is specified, the ordering defaults to the one\n * specified in the default value for this attribute.\n *\n * When not specified, the order is\n * ascending. This parameter can also be a function which takes two facet\n * values and should return a number, 0 if equal, 1 if the first argument is\n * bigger or -1 otherwise.\n *\n * The default value for this attribute `['isRefined:desc', 'count:desc', 'name:asc']`\n * @return {FacetValue[]|HierarchicalFacet|undefined} depending on the type of facet of\n * the attribute requested (hierarchical, disjunctive or conjunctive)\n * @example\n * helper.on('result', function(event){\n * //get values ordered only by name ascending using the string predicate\n * event.results.getFacetValues('city', {sortBy: ['name:asc']});\n * //get values ordered only by count ascending using a function\n * event.results.getFacetValues('city', {\n * // this is equivalent to ['count:asc']\n * sortBy: function(a, b) {\n * if (a.count === b.count) return 0;\n * if (a.count > b.count) return 1;\n * if (b.count > a.count) return -1;\n * }\n * });\n * });\n */\nSearchResults.prototype.getFacetValues = function (attribute, opts) {\n var facetValues = extractNormalizedFacetValues(this, attribute);\n if (!facetValues) {\n return undefined;\n }\n\n var options = defaultsPure(opts, {\n sortBy: SearchResults.DEFAULT_SORT,\n // if no sortBy is given, attempt to sort based on facetOrdering\n // if it is given, we still allow to sort via facet ordering first\n facetOrdering: !(opts && opts.sortBy),\n });\n\n // eslint-disable-next-line consistent-this\n var results = this;\n var attributes;\n if (Array.isArray(facetValues)) {\n attributes = [attribute];\n } else {\n var config = results._state.getHierarchicalFacetByName(facetValues.name);\n attributes = config.attributes;\n }\n\n return recSort(\n function (data, facetName) {\n var facetOrdering = getFacetOrdering(results, facetName);\n if (options.facetOrdering) {\n if (facetOrdering) {\n return sortViaFacetOrdering(data, facetOrdering);\n }\n }\n\n if (Array.isArray(options.sortBy)) {\n var order = formatSort(options.sortBy, SearchResults.DEFAULT_SORT);\n var items = orderBy(data, order[0], order[1]);\n\n var hide =\n facetOrdering && facetOrdering.hide ? facetOrdering.hide : [];\n if (hide.length > 0) {\n var visible = [];\n items.forEach(function (item) {\n // hierarchical facets get sorted using their raw name\n var name = item.path || item.name;\n if (hide.indexOf(name) === -1) {\n visible.push(item);\n }\n });\n\n return visible;\n }\n\n return items;\n } else if (typeof options.sortBy === 'function') {\n return vanillaSortFn(options.sortBy, data);\n }\n throw new Error(\n 'options.sortBy is optional but if defined it must be ' +\n 'either an array of string (predicates) or a sorting function'\n );\n },\n facetValues,\n attributes\n );\n};\n\n/**\n * Returns the facet stats if attribute is defined and the facet contains some.\n * Otherwise returns undefined.\n * @param {string} attribute name of the faceted attribute\n * @return {object} The stats of the facet\n */\nSearchResults.prototype.getFacetStats = function (attribute) {\n if (this._state.isConjunctiveFacet(attribute)) {\n return getFacetStatsIfAvailable(this.facets, attribute);\n } else if (this._state.isDisjunctiveFacet(attribute)) {\n return getFacetStatsIfAvailable(this.disjunctiveFacets, attribute);\n }\n\n return undefined;\n};\n\n/**\n * @typedef {Object} FacetListItem\n * @property {string} name\n */\n\n/**\n * @param {FacetListItem[]} facetList (has more items, but enough for here)\n * @param {string} facetName The attribute to look for\n * @return {object|undefined} The stats of the facet\n */\nfunction getFacetStatsIfAvailable(facetList, facetName) {\n var data = find(facetList, function (facet) {\n return facet.name === facetName;\n });\n return data && data.stats;\n}\n\n/**\n * Returns all refinements for all filters + tags. It also provides\n * additional information: count and exhaustiveness for each filter.\n *\n * See the [refinement type](#Refinement) for an exhaustive view of the available\n * data.\n *\n * Note that for a numeric refinement, results are grouped per operator, this\n * means that it will return responses for operators which are empty.\n *\n * @return {Array.<Refinement>} all the refinements\n */\nSearchResults.prototype.getRefinements = function () {\n var state = this._state;\n // eslint-disable-next-line consistent-this\n var results = this;\n var res = [];\n\n Object.keys(state.facetsRefinements).forEach(function (attributeName) {\n state.facetsRefinements[attributeName].forEach(function (name) {\n res.push(\n getRefinement(state, 'facet', attributeName, name, results.facets)\n );\n });\n });\n\n Object.keys(state.facetsExcludes).forEach(function (attributeName) {\n state.facetsExcludes[attributeName].forEach(function (name) {\n res.push(\n getRefinement(state, 'exclude', attributeName, name, results.facets)\n );\n });\n });\n\n Object.keys(state.disjunctiveFacetsRefinements).forEach(function (\n attributeName\n ) {\n state.disjunctiveFacetsRefinements[attributeName].forEach(function (name) {\n res.push(\n getRefinement(\n state,\n 'disjunctive',\n attributeName,\n name,\n results.disjunctiveFacets\n )\n );\n });\n });\n\n Object.keys(state.hierarchicalFacetsRefinements).forEach(function (\n attributeName\n ) {\n state.hierarchicalFacetsRefinements[attributeName].forEach(function (name) {\n res.push(\n getHierarchicalRefinement(\n state,\n attributeName,\n name,\n results.hierarchicalFacets\n )\n );\n });\n });\n\n Object.keys(state.numericRefinements).forEach(function (attributeName) {\n var operators = state.numericRefinements[attributeName];\n Object.keys(operators).forEach(function (operator) {\n operators[operator].forEach(function (value) {\n res.push({\n type: 'numeric',\n attributeName: attributeName,\n name: value,\n numericValue: value,\n operator: operator,\n });\n });\n });\n });\n\n state.tagRefinements.forEach(function (name) {\n res.push({ type: 'tag', attributeName: '_tags', name: name });\n });\n\n return res;\n};\n\n/**\n * @typedef {Object} Facet\n * @property {string} name\n * @property {Object} data\n * @property {boolean} exhaustive\n */\n\n/**\n * @param {SearchParameters} state the current state\n * @param {string} type the type of the refinement\n * @param {string} attributeName The attribute of the facet\n * @param {*} name The name of the facet\n * @param {Facet[]} resultsFacets facets from the results\n * @return {Refinement} the refinement\n */\nfunction getRefinement(state, type, attributeName, name, resultsFacets) {\n var facet = find(resultsFacets, function (f) {\n return f.name === attributeName;\n });\n var count = facet && facet.data && facet.data[name] ? facet.data[name] : 0;\n var exhaustive = (facet && facet.exhaustive) || false;\n\n return {\n type: type,\n attributeName: attributeName,\n name: name,\n count: count,\n exhaustive: exhaustive,\n };\n}\n\n/**\n * @param {SearchParameters} state the current state\n * @param {string} attributeName the attribute of the hierarchical facet\n * @param {string} name the name of the facet\n * @param {Facet[]} resultsFacets facets from the results\n * @return {HierarchicalFacet} the hierarchical facet\n */\nfunction getHierarchicalRefinement(state, attributeName, name, resultsFacets) {\n var facetDeclaration = state.getHierarchicalFacetByName(attributeName);\n var separator = state._getHierarchicalFacetSeparator(facetDeclaration);\n var split = name.split(separator);\n var rootFacet = find(resultsFacets, function (facet) {\n return facet.name === attributeName;\n });\n\n var facet = split.reduce(function (intermediateFacet, part) {\n var newFacet =\n intermediateFacet &&\n find(intermediateFacet.data, function (f) {\n return f.name === part;\n });\n return newFacet !== undefined ? newFacet : intermediateFacet;\n }, rootFacet);\n\n var count = (facet && facet.count) || 0;\n var exhaustive = (facet && facet.exhaustive) || false;\n var path = (facet && facet.path) || '';\n\n return {\n type: 'hierarchical',\n attributeName: attributeName,\n name: path,\n count: count,\n exhaustive: exhaustive,\n };\n}\n\nmodule.exports = SearchResults;\n"],"names":["compact","require$$0","defaultsPure","require$$1","fv","require$$2","find","require$$3","findIndex","require$$4","formatSort","require$$5","mergeNumericMax","require$$6","orderBy","require$$7","escapeFacetValue","unescapeFacetValue","generateHierarchicalTree","require$$8","getIndices","attributes","indices","forEach","val","idx","assignFacetStats","dest","facetStats","key","stats","SearchResults","state","results","options","mainSubResponse","this","_rawResults","self","Object","keys","opts","persistHierarchicalRootCount","processingTimeMS","reduce","sum","result","undefined","disjunctiveFacets","hierarchicalFacets","map","facets","getRefinedDisjunctiveFacets","facetsIndices","disjunctiveFacetsIndices","nextDisjunctiveResult","mainFacets","facetKey","hierarchicalAttributeName","facetValueObject","hierarchicalFacet","indexOf","facetIndex","idxAttributeName","f","name","attribute","data","exhaustive","exhaustiveFacetsCount","position","isFacetDisjunctive","isFacetConjunctive","facets_stats","disjunctiveFacet","getHierarchicalFacetByName","dfacet","facetResults","attributeIndex","dataFromMainRequest","disjunctiveFacetsRefinements","refinementValue","getRefinedHierarchicalFacets","refinedFacet","separator","_getHierarchicalFacetSeparator","currentRefinement","getHierarchicalRefinement","length","split","slice","defaultData","root","facetsExcludes","facetName","excludes","facetValue","_state","extractNormalizedFacetValues","predicate","facet","isConjunctiveFacet","value","escapedValue","count","isRefined","isFacetRefined","isExcluded","isExcludeRefined","isDisjunctiveFacet","isDisjunctiveFacetRefined","isHierarchicalFacet","hierarchicalFacetValues","rootPath","replace","currentRefinementSplit","unshift","setIsRefined","item","depth","trim","child","recSort","sortFn","node","names","level","Array","isArray","children","childNode","sortedChildren","getFacetStatsIfAvailable","facetList","getRefinement","type","attributeName","resultsFacets","prototype","getFacetByName","DEFAULT_SORT","getFacetValues","facetValues","sortBy","facetOrdering","renderingContent","values","getFacetOrdering","orderedFacets","remainingFacets","hide","reverseOrder","order","acc","i","path","hidden","push","filter","ordering","sortRemainingBy","concat","sortViaFacetOrdering","items","visible","sort","vanillaSortFn","Error","getFacetStats","getRefinements","res","facetsRefinements","hierarchicalFacetsRefinements","facetDeclaration","rootFacet","intermediateFacet","part","newFacet","numericRefinements","operators","operator","numericValue","tagRefinements","SearchResults_1"],"mappings":"ibAEA,IAAIA,EAAUC,EAAAA,YACVC,EAAeC,EAAAA,YACfC,EAAKC,EAAAA,YACLC,EAAOC,EAAAA,YACPC,EAAYC,EAAAA,YACZC,EAAaC,EAAAA,YACbC,EAAkBC,EAAAA,YAClBC,EAAUC,EAAAA,YACVC,EAAmBZ,EAAGY,iBACtBC,EAAqBb,EAAGa,mBAExBC,EAA2BC,EAAAA,YAgD/B,SAASC,EAAWC,GAClB,IAAIC,EAAU,CAAA,EAMd,OAJAD,EAAWE,QAAQ,SAAUC,EAAKC,GAChCH,EAAQE,GAAOC,CACnB,GAESH,CACT,CAEA,SAASI,EAAiBC,EAAMC,EAAYC,GACtCD,GAAcA,EAAWC,KAC3BF,EAAKG,MAAQF,EAAWC,GAE5B,CA6JA,SAASE,EAAcC,EAAOC,EAASC,GACrC,IAAIC,EAAkBF,EAAQ,IAAM,CAAA,EAEpCG,KAAKC,YAAcJ,EAGnB,IAAIK,EAAOF,KAGXG,OAAOC,KAAKL,GAAiBZ,QAAQ,SAAUM,GAC7CS,EAAKT,GAAOM,EAAgBN,EAChC,GAGE,IAAIY,EAAOvC,EAAagC,EAAS,CAC/BQ,8BAA8B,IAEhCH,OAAOC,KAAKC,GAAMlB,QAAQ,SAAUM,GAClCS,EAAKT,GAAOY,EAAKZ,EACrB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