@sunrise-upc/sales-static-components 4.0.1 → 4.1.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/dist/cjs/components/BadgeContainer/BadgeContainer.css +41 -0
- package/dist/cjs/components/BadgeContainer/BadgeContainer.js +3 -0
- package/dist/cjs/components/BadgeContainer/BadgeContainer.js.map +1 -0
- package/dist/cjs/components/BadgeContainer/BadgeContainer.module.scss.css +41 -0
- package/dist/cjs/components/BadgeContainer/BadgeContainer.module.scss.js +3 -0
- package/dist/cjs/components/BadgeContainer/BadgeContainer.module.scss.js.map +1 -0
- package/dist/cjs/components/ButtonGroup/ButtonGroup.css +95 -95
- package/dist/cjs/components/Constants.js +1 -1
- package/dist/cjs/components/Constants.js.map +1 -1
- package/dist/cjs/components/DeviceGallery/DeviceGalleryItem/DeviceGalleryItem.css +239 -0
- package/dist/cjs/components/DeviceGallery/DeviceGalleryItem/DeviceGalleryItem.js +3 -0
- package/dist/cjs/components/DeviceGallery/DeviceGalleryItem/DeviceGalleryItem.js.map +1 -0
- package/dist/cjs/components/DeviceGallery/DeviceGalleryItem/DeviceGalleryItem.module.scss.css +239 -0
- package/dist/cjs/components/DeviceGallery/DeviceGalleryItem/DeviceGalleryItem.module.scss.js +3 -0
- package/dist/cjs/components/DeviceGallery/DeviceGalleryItem/DeviceGalleryItem.module.scss.js.map +1 -0
- package/dist/cjs/components/DeviceGallery/DeviceGalleryList.css +190 -0
- package/dist/cjs/components/DeviceGallery/DeviceGalleryList.js +3 -0
- package/dist/cjs/components/DeviceGallery/DeviceGalleryList.js.map +1 -0
- package/dist/cjs/components/DeviceGallery/DeviceGalleryList.module.scss.css +190 -0
- package/dist/cjs/components/DeviceGallery/DeviceGalleryList.module.scss.js +3 -0
- package/dist/cjs/components/DeviceGallery/DeviceGalleryList.module.scss.js.map +1 -0
- 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/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/FalconHeader/LocaleSelector/useLocaleService.js +1 -1
- package/dist/cjs/components/FalconMainNavigation/FalconHeader/LocaleSelector/useLocaleService.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/GlobalPromoRibbon/GlobalPromoRibbon.css +22 -0
- package/dist/cjs/components/GlobalPromoRibbon/GlobalPromoRibbon.js +1 -1
- package/dist/cjs/components/GlobalPromoRibbon/GlobalPromoRibbon.js.map +1 -1
- package/dist/cjs/components/GlobalPromoRibbon/GlobalPromoRibbon.module.scss.css +22 -0
- package/dist/cjs/components/GlobalPromoRibbon/GlobalPromoRibbon.module.scss.js +1 -1
- package/dist/cjs/components/ImageWithTextWrapper/ImageWithTextWrapper.js +1 -1
- package/dist/cjs/components/ImageWithTextWrapper/ImageWithTextWrapper.js.map +1 -1
- package/dist/cjs/components/InternetAndTvCardsBenefits/InternetAndTvCardItemBenefits.js.map +1 -1
- package/dist/cjs/components/InternetAndTvCardsBenefits/InternetAndTvCardsBenefits.js +1 -1
- package/dist/cjs/components/InternetAndTvCardsBenefits/InternetAndTvCardsBenefits.js.map +1 -1
- package/dist/cjs/components/QuickLinks/QuickLinkItem.css +170 -0
- package/dist/cjs/components/QuickLinks/QuickLinkItem.js +3 -0
- package/dist/cjs/components/QuickLinks/QuickLinkItem.js.map +1 -0
- package/dist/cjs/components/QuickLinks/QuickLinkItem.module.scss.css +170 -0
- package/dist/cjs/components/QuickLinks/QuickLinkItem.module.scss.js +3 -0
- package/dist/cjs/components/QuickLinks/QuickLinkItem.module.scss.js.map +1 -0
- package/dist/cjs/components/QuickLinks/QuickLinks.css +170 -0
- package/dist/cjs/components/QuickLinks/QuickLinks.js +3 -0
- package/dist/cjs/components/QuickLinks/QuickLinks.js.map +1 -0
- 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 +115 -90
- package/dist/cjs/components/StageTeaserV3/SingleGrid/SingleGridComponent.js +1 -1
- package/dist/cjs/components/StageTeaserV3/SingleGrid/SingleGridComponent.js.map +1 -1
- package/dist/cjs/components/StageTeaserV3/SingleGrid/SingleGridComponent.module.scss.css +28 -3
- package/dist/cjs/components/StageTeaserV3/SingleGrid/SingleGridComponent.module.scss.js +1 -1
- package/dist/cjs/components/StageTeaserV3/StageTeaserSwiperV3.css +5 -0
- package/dist/cjs/components/StageTeaserV3/StageTeaserSwiperV3Style.module.scss.css +5 -0
- package/dist/cjs/components/StageTeaserV3/StageTeaserV3.js +1 -1
- package/dist/cjs/components/StageTeaserV3/StageTeaserV3.js.map +1 -1
- 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/index.js +1 -1
- 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/addInsightsToRecommendParameters.js +2 -0
- package/dist/cjs/node_modules/instantsearch.js/es/lib/utils/addInsightsToRecommendParameters.js.map +1 -0
- package/dist/cjs/node_modules/instantsearch.js/es/lib/utils/buildWidgetTree.js +2 -0
- package/dist/cjs/node_modules/instantsearch.js/es/lib/utils/buildWidgetTree.js.map +1 -0
- 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/extractWidgetPayload.js +2 -0
- package/dist/cjs/node_modules/instantsearch.js/es/lib/utils/extractWidgetPayload.js.map +1 -0
- 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/utils/now.js +2 -0
- package/dist/cjs/node_modules/instantsearch.js/es/lib/utils/now.js.map +1 -0
- package/dist/cjs/node_modules/instantsearch.js/es/lib/utils/omit.js +2 -0
- package/dist/cjs/node_modules/instantsearch.js/es/lib/utils/omit.js.map +1 -0
- 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/customerSegmentSync.js +1 -1
- package/dist/cjs/services/customerSegmentSync.js.map +1 -1
- package/dist/cjs/utils/AnalyticUtils.js +1 -1
- package/dist/cjs/utils/AnalyticUtils.js.map +1 -1
- package/dist/cjs/utils/AnalyticsConstants.js +1 -1
- package/dist/cjs/utils/AnalyticsConstants.js.map +1 -1
- package/dist/esm/components/BadgeContainer/BadgeContainer.css +41 -0
- package/dist/esm/components/BadgeContainer/BadgeContainer.js +3 -0
- package/dist/esm/components/BadgeContainer/BadgeContainer.js.map +1 -0
- package/dist/esm/components/BadgeContainer/BadgeContainer.module.scss.css +41 -0
- package/dist/esm/components/BadgeContainer/BadgeContainer.module.scss.js +3 -0
- package/dist/esm/components/BadgeContainer/BadgeContainer.module.scss.js.map +1 -0
- package/dist/esm/components/ButtonGroup/ButtonGroup.css +95 -95
- package/dist/esm/components/Constants.js +1 -1
- package/dist/esm/components/Constants.js.map +1 -1
- package/dist/esm/components/DeviceGallery/DeviceGalleryItem/DeviceGalleryItem.css +239 -0
- package/dist/esm/components/DeviceGallery/DeviceGalleryItem/DeviceGalleryItem.js +3 -0
- package/dist/esm/components/DeviceGallery/DeviceGalleryItem/DeviceGalleryItem.js.map +1 -0
- package/dist/esm/components/DeviceGallery/DeviceGalleryItem/DeviceGalleryItem.module.scss.css +239 -0
- package/dist/esm/components/DeviceGallery/DeviceGalleryItem/DeviceGalleryItem.module.scss.js +3 -0
- package/dist/esm/components/DeviceGallery/DeviceGalleryItem/DeviceGalleryItem.module.scss.js.map +1 -0
- package/dist/esm/components/DeviceGallery/DeviceGalleryList.css +190 -0
- package/dist/esm/components/DeviceGallery/DeviceGalleryList.js +3 -0
- package/dist/esm/components/DeviceGallery/DeviceGalleryList.js.map +1 -0
- package/dist/esm/components/DeviceGallery/DeviceGalleryList.module.scss.css +190 -0
- package/dist/esm/components/DeviceGallery/DeviceGalleryList.module.scss.js +3 -0
- package/dist/esm/components/DeviceGallery/DeviceGalleryList.module.scss.js.map +1 -0
- 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/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/FalconHeader/LocaleSelector/useLocaleService.js +1 -1
- package/dist/esm/components/FalconMainNavigation/FalconHeader/LocaleSelector/useLocaleService.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/GlobalPromoRibbon/GlobalPromoRibbon.css +22 -0
- package/dist/esm/components/GlobalPromoRibbon/GlobalPromoRibbon.js +1 -1
- package/dist/esm/components/GlobalPromoRibbon/GlobalPromoRibbon.js.map +1 -1
- package/dist/esm/components/GlobalPromoRibbon/GlobalPromoRibbon.module.scss.css +22 -0
- package/dist/esm/components/GlobalPromoRibbon/GlobalPromoRibbon.module.scss.js +1 -1
- package/dist/esm/components/ImageWithTextWrapper/ImageWithTextWrapper.js +1 -1
- package/dist/esm/components/ImageWithTextWrapper/ImageWithTextWrapper.js.map +1 -1
- package/dist/esm/components/InternetAndTvCardsBenefits/InternetAndTvCardsBenefits.js +1 -1
- package/dist/esm/components/InternetAndTvCardsBenefits/InternetAndTvCardsBenefits.js.map +1 -1
- package/dist/esm/components/QuickLinks/QuickLinkItem.css +170 -0
- package/dist/esm/components/QuickLinks/QuickLinkItem.js +3 -0
- package/dist/esm/components/QuickLinks/QuickLinkItem.js.map +1 -0
- package/dist/esm/components/QuickLinks/QuickLinkItem.module.scss.css +170 -0
- package/dist/esm/components/QuickLinks/QuickLinkItem.module.scss.js +3 -0
- package/dist/esm/components/QuickLinks/QuickLinkItem.module.scss.js.map +1 -0
- package/dist/esm/components/QuickLinks/QuickLinks.css +170 -0
- package/dist/esm/components/QuickLinks/QuickLinks.js +3 -0
- package/dist/esm/components/QuickLinks/QuickLinks.js.map +1 -0
- 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 +115 -90
- package/dist/esm/components/StageTeaserV3/SingleGrid/SingleGridComponent.js +1 -1
- package/dist/esm/components/StageTeaserV3/SingleGrid/SingleGridComponent.js.map +1 -1
- package/dist/esm/components/StageTeaserV3/SingleGrid/SingleGridComponent.module.scss.css +28 -3
- package/dist/esm/components/StageTeaserV3/SingleGrid/SingleGridComponent.module.scss.js +1 -1
- package/dist/esm/components/StageTeaserV3/StageTeaserSwiperV3.css +5 -0
- package/dist/esm/components/StageTeaserV3/StageTeaserSwiperV3Style.module.scss.css +5 -0
- package/dist/esm/components/StageTeaserV3/StageTeaserV3.js +1 -1
- package/dist/esm/components/StageTeaserV3/StageTeaserV3.js.map +1 -1
- 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/index.js +1 -1
- 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/addInsightsToRecommendParameters.js +2 -0
- package/dist/esm/node_modules/instantsearch.js/es/lib/utils/addInsightsToRecommendParameters.js.map +1 -0
- package/dist/esm/node_modules/instantsearch.js/es/lib/utils/buildWidgetTree.js +2 -0
- package/dist/esm/node_modules/instantsearch.js/es/lib/utils/buildWidgetTree.js.map +1 -0
- 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/extractWidgetPayload.js +2 -0
- package/dist/esm/node_modules/instantsearch.js/es/lib/utils/extractWidgetPayload.js.map +1 -0
- 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/utils/now.js +2 -0
- package/dist/esm/node_modules/instantsearch.js/es/lib/utils/now.js.map +1 -0
- package/dist/esm/node_modules/instantsearch.js/es/lib/utils/omit.js +2 -0
- package/dist/esm/node_modules/instantsearch.js/es/lib/utils/omit.js.map +1 -0
- 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/customerSegmentSync.js +1 -1
- package/dist/esm/services/customerSegmentSync.js.map +1 -1
- package/dist/esm/utils/AnalyticUtils.js +1 -1
- package/dist/esm/utils/AnalyticUtils.js.map +1 -1
- package/dist/esm/utils/AnalyticsConstants.js +1 -1
- package/dist/esm/utils/AnalyticsConstants.js.map +1 -1
- package/dist/index.d.ts +97 -5
- package/dist/navigation.css +373 -373
- package/package.json +115 -115
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"algoliasearch.helper.js","sources":["../../../../../node_modules/algoliasearch-helper/src/algoliasearch.helper.js"],"sourcesContent":["'use strict';\n\nvar EventEmitter = require('@algolia/events');\n\nvar DerivedHelper = require('./DerivedHelper');\nvar escapeFacetValue = require('./functions/escapeFacetValue').escapeFacetValue;\nvar inherits = require('./functions/inherits');\nvar merge = require('./functions/merge');\nvar objectHasKeys = require('./functions/objectHasKeys');\nvar omit = require('./functions/omit');\nvar RecommendParameters = require('./RecommendParameters');\nvar RecommendResults = require('./RecommendResults');\nvar requestBuilder = require('./requestBuilder');\nvar SearchParameters = require('./SearchParameters');\nvar SearchResults = require('./SearchResults');\nvar sortAndMergeRecommendations = require('./utils/sortAndMergeRecommendations');\nvar version = require('./version');\n\n/**\n * Event triggered when a parameter is set or updated\n * @event AlgoliaSearchHelper#event:change\n * @property {object} event\n * @property {SearchParameters} event.state the current parameters with the latest changes applied\n * @property {SearchResults} event.results the previous results received from Algolia. `null` before the first request\n * @example\n * helper.on('change', function(event) {\n * console.log('The parameters have changed');\n * });\n */\n\n/**\n * Event triggered when a main search is sent to Algolia\n * @event AlgoliaSearchHelper#event:search\n * @property {object} event\n * @property {SearchParameters} event.state the parameters used for this search\n * @property {SearchResults} event.results the results from the previous search. `null` if it is the first search.\n * @example\n * helper.on('search', function(event) {\n * console.log('Search sent');\n * });\n */\n\n/**\n * Event triggered when a search using `searchForFacetValues` is sent to Algolia\n * @event AlgoliaSearchHelper#event:searchForFacetValues\n * @property {object} event\n * @property {SearchParameters} event.state the parameters used for this search it is the first search.\n * @property {string} event.facet the facet searched into\n * @property {string} event.query the query used to search in the facets\n * @example\n * helper.on('searchForFacetValues', function(event) {\n * console.log('searchForFacetValues sent');\n * });\n */\n\n/**\n * Event triggered when a search using `searchOnce` is sent to Algolia\n * @event AlgoliaSearchHelper#event:searchOnce\n * @property {object} event\n * @property {SearchParameters} event.state the parameters used for this search it is the first search.\n * @example\n * helper.on('searchOnce', function(event) {\n * console.log('searchOnce sent');\n * });\n */\n\n/**\n * Event triggered when the results are retrieved from Algolia\n * @event AlgoliaSearchHelper#event:result\n * @property {object} event\n * @property {SearchResults} event.results the results received from Algolia\n * @property {SearchParameters} event.state the parameters used to query Algolia. Those might be different from the one in the helper instance (for example if the network is unreliable).\n * @example\n * helper.on('result', function(event) {\n * console.log('Search results received');\n * });\n */\n\n/**\n * Event triggered when Algolia sends back an error. For example, if an unknown parameter is\n * used, the error can be caught using this event.\n * @event AlgoliaSearchHelper#event:error\n * @property {object} event\n * @property {Error} event.error the error returned by the Algolia.\n * @example\n * helper.on('error', function(event) {\n * console.log('Houston we got a problem.');\n * });\n */\n\n/**\n * Event triggered when the queue of queries have been depleted (with any result or outdated queries)\n * @event AlgoliaSearchHelper#event:searchQueueEmpty\n * @example\n * helper.on('searchQueueEmpty', function() {\n * console.log('No more search pending');\n * // This is received before the result event if we're not expecting new results\n * });\n *\n * helper.search();\n */\n\n/**\n * Initialize a new AlgoliaSearchHelper\n * @class\n * @classdesc The AlgoliaSearchHelper is a class that ease the management of the\n * search. It provides an event based interface for search callbacks:\n * - change: when the internal search state is changed.\n * This event contains a {@link SearchParameters} object and the\n * {@link SearchResults} of the last result if any.\n * - search: when a search is triggered using the `search()` method.\n * - result: when the response is retrieved from Algolia and is processed.\n * This event contains a {@link SearchResults} object and the\n * {@link SearchParameters} corresponding to this answer.\n * - error: when the response is an error. This event contains the error returned by the server.\n * @param {AlgoliaSearch} client an AlgoliaSearch client\n * @param {string} index the index name to query\n * @param {SearchParameters | object} options an object defining the initial\n * config of the search. It doesn't have to be a {SearchParameters},\n * just an object containing the properties you need from it.\n * @param {SearchResultsOptions|object} searchResultsOptions an object defining the options to use when creating the search results.\n */\nfunction AlgoliaSearchHelper(client, index, options, searchResultsOptions) {\n if (typeof client.addAlgoliaAgent === 'function') {\n client.addAlgoliaAgent('JS Helper (' + version + ')');\n }\n\n this.setClient(client);\n var opts = options || {};\n opts.index = index;\n this.state = SearchParameters.make(opts);\n this.recommendState = new RecommendParameters({\n params: opts.recommendState,\n });\n this.lastResults = null;\n this.lastRecommendResults = null;\n this._queryId = 0;\n this._recommendQueryId = 0;\n this._lastQueryIdReceived = -1;\n this._lastRecommendQueryIdReceived = -1;\n this.derivedHelpers = [];\n this._currentNbQueries = 0;\n this._currentNbRecommendQueries = 0;\n this._searchResultsOptions = searchResultsOptions;\n this._recommendCache = {};\n}\n\ninherits(AlgoliaSearchHelper, EventEmitter);\n\n/**\n * Start the search with the parameters set in the state. When the\n * method is called, it triggers a `search` event. The results will\n * be available through the `result` event. If an error occurs, an\n * `error` will be fired instead.\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires search\n * @fires result\n * @fires error\n * @chainable\n */\nAlgoliaSearchHelper.prototype.search = function () {\n this._search({ onlyWithDerivedHelpers: false });\n return this;\n};\n\nAlgoliaSearchHelper.prototype.searchOnlyWithDerivedHelpers = function () {\n this._search({ onlyWithDerivedHelpers: true });\n return this;\n};\n\nAlgoliaSearchHelper.prototype.searchWithComposition = function () {\n this._runComposition({ onlyWithDerivedHelpers: true });\n return this;\n};\n/**\n * Sends the recommendation queries set in the state. When the method is\n * called, it triggers a `fetch` event. The results will be available through\n * the `result` event. If an error occurs, an `error` will be fired instead.\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires fetch\n * @fires result\n * @fires error\n * @chainable\n */\nAlgoliaSearchHelper.prototype.recommend = function () {\n this._recommend();\n return this;\n};\n\n/**\n * Gets the search query parameters that would be sent to the Algolia Client\n * for the hits\n * @return {object} Query Parameters\n */\nAlgoliaSearchHelper.prototype.getQuery = function () {\n var state = this.state;\n return requestBuilder._getHitsSearchParams(state);\n};\n\n/**\n * Start a search using a modified version of the current state. This method does\n * not trigger the helper lifecycle and does not modify the state kept internally\n * by the helper. This second aspect means that the next search call will be the\n * same as a search call before calling searchOnce.\n * @param {object} options can contain all the parameters that can be set to SearchParameters\n * plus the index\n * @param {function} [cb] optional callback executed when the response from the\n * server is back.\n * @return {promise|undefined} if a callback is passed the method returns undefined\n * otherwise it returns a promise containing an object with two keys :\n * - content with a SearchResults\n * - state with the state used for the query as a SearchParameters\n * @example\n * // Changing the number of records returned per page to 1\n * // This example uses the callback API\n * var state = helper.searchOnce({hitsPerPage: 1},\n * function(error, content, state) {\n * // if an error occurred it will be passed in error, otherwise its value is null\n * // content contains the results formatted as a SearchResults\n * // state is the instance of SearchParameters used for this search\n * });\n * @example\n * // Changing the number of records returned per page to 1\n * // This example uses the promise API\n * var state1 = helper.searchOnce({hitsPerPage: 1})\n * .then(promiseHandler);\n *\n * function promiseHandler(res) {\n * // res contains\n * // {\n * // content : SearchResults\n * // state : SearchParameters (the one used for this specific search)\n * // }\n * }\n */\nAlgoliaSearchHelper.prototype.searchOnce = function (options, cb) {\n var tempState = !options\n ? this.state\n : this.state.setQueryParameters(options);\n var queries = requestBuilder._getQueries(tempState.index, tempState);\n // eslint-disable-next-line consistent-this\n var self = this;\n\n this._currentNbQueries++;\n\n this.emit('searchOnce', {\n state: tempState,\n });\n\n if (cb) {\n this.client\n .search(queries)\n .then(function (content) {\n self._currentNbQueries--;\n if (self._currentNbQueries === 0) {\n self.emit('searchQueueEmpty');\n }\n\n cb(null, new SearchResults(tempState, content.results), tempState);\n })\n .catch(function (err) {\n self._currentNbQueries--;\n if (self._currentNbQueries === 0) {\n self.emit('searchQueueEmpty');\n }\n\n cb(err, null, tempState);\n });\n\n return undefined;\n }\n\n return this.client.search(queries).then(\n function (content) {\n self._currentNbQueries--;\n if (self._currentNbQueries === 0) self.emit('searchQueueEmpty');\n return {\n content: new SearchResults(tempState, content.results),\n state: tempState,\n _originalResponse: content,\n };\n },\n function (e) {\n self._currentNbQueries--;\n if (self._currentNbQueries === 0) self.emit('searchQueueEmpty');\n throw e;\n }\n );\n};\n\n/**\n * Start the search for answers with the parameters set in the state.\n * This method returns a promise.\n * @param {Object} options - the options for answers API call\n * @param {string[]} options.attributesForPrediction - Attributes to use for predictions. If empty, `searchableAttributes` is used instead.\n * @param {string[]} options.queryLanguages - The languages in the query. Currently only supports ['en'].\n * @param {number} options.nbHits - Maximum number of answers to retrieve from the Answers Engine. Cannot be greater than 1000.\n *\n * @return {promise} the answer results\n * @deprecated answers is deprecated and will be replaced with new initiatives\n */\nAlgoliaSearchHelper.prototype.findAnswers = function (options) {\n // eslint-disable-next-line no-console\n console.warn('[algoliasearch-helper] answers is no longer supported');\n var state = this.state;\n var derivedHelper = this.derivedHelpers[0];\n if (!derivedHelper) {\n return Promise.resolve([]);\n }\n var derivedState = derivedHelper.getModifiedState(state);\n var data = merge(\n {\n attributesForPrediction: options.attributesForPrediction,\n nbHits: options.nbHits,\n },\n {\n params: omit(requestBuilder._getHitsSearchParams(derivedState), [\n 'attributesToSnippet',\n 'hitsPerPage',\n 'restrictSearchableAttributes',\n 'snippetEllipsisText',\n ]),\n }\n );\n\n var errorMessage =\n 'search for answers was called, but this client does not have a function client.initIndex(index).findAnswers';\n if (typeof this.client.initIndex !== 'function') {\n throw new Error(errorMessage);\n }\n var index = this.client.initIndex(derivedState.index);\n if (typeof index.findAnswers !== 'function') {\n throw new Error(errorMessage);\n }\n return index.findAnswers(derivedState.query, options.queryLanguages, data);\n};\n\n/**\n * Structure of each result when using\n * [`searchForFacetValues()`](reference.html#AlgoliaSearchHelper#searchForFacetValues)\n * @typedef FacetSearchHit\n * @type {object}\n * @property {string} value the facet value\n * @property {string} highlighted the facet value highlighted with the query string\n * @property {number} count number of occurrence of this facet value\n * @property {boolean} isRefined true if the value is already refined\n */\n\n/**\n * Structure of the data resolved by the\n * [`searchForFacetValues()`](reference.html#AlgoliaSearchHelper#searchForFacetValues)\n * promise.\n * @typedef FacetSearchResult\n * @type {object}\n * @property {FacetSearchHit} facetHits the results for this search for facet values\n * @property {number} processingTimeMS time taken by the query inside the engine\n */\n\n/**\n * Search for facet values based on an query and the name of a faceted attribute. This\n * triggers a search and will return a promise. On top of using the query, it also sends\n * the parameters from the state so that the search is narrowed down to only the possible values.\n *\n * See the description of [FacetSearchResult](reference.html#FacetSearchResult)\n * @param {string} facet the name of the faceted attribute\n * @param {string} query the string query for the search\n * @param {number} [maxFacetHits] the maximum number values returned. Should be > 0 and <= 100\n * @param {object} [userState] the set of custom parameters to use on top of the current state. Setting a property to `undefined` removes\n * it in the generated query.\n * @return {promise.<FacetSearchResult>} the results of the search\n */\nAlgoliaSearchHelper.prototype.searchForFacetValues = function (\n facet,\n query,\n maxFacetHits,\n userState\n) {\n var clientHasSFFV =\n typeof this.client.searchForFacetValues === 'function' &&\n // v5 has a wrong sffv signature\n typeof this.client.searchForFacets !== 'function';\n var clientHasInitIndex = typeof this.client.initIndex === 'function';\n if (\n !clientHasSFFV &&\n !clientHasInitIndex &&\n typeof this.client.search !== 'function'\n ) {\n throw new Error(\n 'search for facet values (searchable) was called, but this client does not have a function client.searchForFacetValues or client.initIndex(index).searchForFacetValues'\n );\n }\n\n var state = this.state.setQueryParameters(userState || {});\n var isDisjunctive = state.isDisjunctiveFacet(facet);\n var algoliaQuery = requestBuilder.getSearchForFacetQuery(\n facet,\n query,\n maxFacetHits,\n state\n );\n\n this._currentNbQueries++;\n // eslint-disable-next-line consistent-this\n var self = this;\n var searchForFacetValuesPromise;\n // newer algoliasearch ^3.27.1 - ~4.0.0\n if (clientHasSFFV) {\n searchForFacetValuesPromise = this.client.searchForFacetValues([\n { indexName: state.index, params: algoliaQuery },\n ]);\n // algoliasearch < 3.27.1\n } else if (clientHasInitIndex) {\n searchForFacetValuesPromise = this.client\n .initIndex(state.index)\n .searchForFacetValues(algoliaQuery);\n // algoliasearch ~5.0.0\n } else {\n // @MAJOR only use client.search\n delete algoliaQuery.facetName;\n searchForFacetValuesPromise = this.client\n .search([\n {\n type: 'facet',\n facet: facet,\n indexName: state.index,\n params: algoliaQuery,\n },\n ])\n .then(function processResponse(response) {\n return response.results[0];\n });\n }\n\n this.emit('searchForFacetValues', {\n state: state,\n facet: facet,\n query: query,\n });\n\n var hide =\n (this.lastResults &&\n this.lastResults.index === state.index &&\n this.lastResults.renderingContent &&\n this.lastResults.renderingContent.facetOrdering &&\n this.lastResults.renderingContent.facetOrdering.values &&\n this.lastResults.renderingContent.facetOrdering.values[facet] &&\n this.lastResults.renderingContent.facetOrdering.values[facet].hide) ||\n [];\n\n return searchForFacetValuesPromise.then(\n function addIsRefined(content) {\n self._currentNbQueries--;\n if (self._currentNbQueries === 0) self.emit('searchQueueEmpty');\n\n content = Array.isArray(content) ? content[0] : content;\n\n content.facetHits = content.facetHits.reduce(function (acc, f) {\n if (hide.indexOf(f.value) > -1) {\n return acc;\n }\n\n f.escapedValue = escapeFacetValue(f.value);\n f.isRefined = isDisjunctive\n ? state.isDisjunctiveFacetRefined(facet, f.escapedValue)\n : state.isFacetRefined(facet, f.escapedValue);\n\n acc.push(f);\n return acc;\n }, []);\n\n return content;\n },\n function (e) {\n self._currentNbQueries--;\n if (self._currentNbQueries === 0) self.emit('searchQueueEmpty');\n throw e;\n }\n );\n};\n\n/**\n * Search for facet values using the Composition API & based on a query and the name of a faceted attribute.\n * This triggers a search and will return a promise. On top of using the query, it also sends\n * the parameters from the state so that the search is narrowed down to only the possible values.\n *\n * See the description of [FacetSearchResult](reference.html#FacetSearchResult)\n * @param {string} facet the name of the faceted attribute\n * @param {string} query the string query for the search\n * @param {number} [maxFacetHits] the maximum number values returned. Should be > 0 and <= 100\n * @param {object} [userState] the set of custom parameters to use on top of the current state. Setting a property to `undefined` removes\n * it in the generated query.\n * @return {promise.<FacetSearchResult>} the results of the search\n */\nAlgoliaSearchHelper.prototype.searchForCompositionFacetValues = function (\n facet,\n query,\n maxFacetHits,\n userState\n) {\n if (typeof this.client.searchForFacetValues !== 'function') {\n throw new Error(\n 'search for facet values (searchable) was called, but this client does not have a function client.searchForFacetValues'\n );\n }\n\n var state = this.state.setQueryParameters(userState || {});\n var isDisjunctive = state.isDisjunctiveFacet(facet);\n\n this._currentNbQueries++;\n // eslint-disable-next-line consistent-this\n var self = this;\n var searchForFacetValuesPromise;\n\n searchForFacetValuesPromise = this.client.searchForFacetValues({\n compositionID: state.index,\n facetName: facet,\n searchForFacetValuesRequest: {\n params: {\n query: query,\n maxFacetHits: maxFacetHits,\n searchQuery: requestBuilder._getCompositionHitsSearchParams(state),\n },\n },\n });\n\n this.emit('searchForFacetValues', {\n state: state,\n facet: facet,\n query: query,\n });\n\n return searchForFacetValuesPromise.then(\n function addIsRefined(content) {\n self._currentNbQueries--;\n if (self._currentNbQueries === 0) self.emit('searchQueueEmpty');\n\n content = content.results[0];\n\n content.facetHits.forEach(function (f) {\n f.escapedValue = escapeFacetValue(f.value);\n f.isRefined = isDisjunctive\n ? state.isDisjunctiveFacetRefined(facet, f.escapedValue)\n : state.isFacetRefined(facet, f.escapedValue);\n });\n\n return content;\n },\n function (e) {\n self._currentNbQueries--;\n if (self._currentNbQueries === 0) self.emit('searchQueueEmpty');\n throw e;\n }\n );\n};\n\n/**\n * Sets the text query used for the search.\n *\n * This method resets the current page to 0.\n * @param {string} q the user query\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.setQuery = function (q) {\n this._change({\n state: this.state.resetPage().setQuery(q),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Remove all the types of refinements except tags. A string can be provided to remove\n * only the refinements of a specific attribute. For more advanced use case, you can\n * provide a function instead. This function should follow the\n * [clearCallback definition](#SearchParameters.clearCallback).\n *\n * This method resets the current page to 0.\n * @param {string} [name] optional name of the facet / attribute on which we want to remove all refinements\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n * @example\n * // Removing all the refinements\n * helper.clearRefinements().search();\n * @example\n * // Removing all the filters on a the category attribute.\n * helper.clearRefinements('category').search();\n * @example\n * // Removing only the exclude filters on the category facet.\n * helper.clearRefinements(function(value, attribute, type) {\n * return type === 'exclude' && attribute === 'category';\n * }).search();\n */\nAlgoliaSearchHelper.prototype.clearRefinements = function (name) {\n this._change({\n state: this.state.resetPage().clearRefinements(name),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Remove all the tag filters.\n *\n * This method resets the current page to 0.\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.clearTags = function () {\n this._change({\n state: this.state.resetPage().clearTags(),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Adds a disjunctive filter to a faceted attribute with the `value` provided. If the\n * filter is already set, it doesn't change the filters.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} value the associated value (will be converted to string)\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.addDisjunctiveFacetRefinement = function (\n facet,\n value\n) {\n this._change({\n state: this.state.resetPage().addDisjunctiveFacetRefinement(facet, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#addDisjunctiveFacetRefinement}\n */\nAlgoliaSearchHelper.prototype.addDisjunctiveRefine = function () {\n return this.addDisjunctiveFacetRefinement.apply(this, arguments);\n};\n\n/**\n * Adds a refinement on a hierarchical facet. It will throw\n * an exception if the facet is not defined or if the facet\n * is already refined.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet name\n * @param {string} path the hierarchical facet path\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @throws Error if the facet is not defined or if the facet is refined\n * @chainable\n * @fires change\n */\nAlgoliaSearchHelper.prototype.addHierarchicalFacetRefinement = function (\n facet,\n path\n) {\n this._change({\n state: this.state.resetPage().addHierarchicalFacetRefinement(facet, path),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Adds a an numeric filter to an attribute with the `operator` and `value` provided. If the\n * filter is already set, it doesn't change the filters.\n *\n * This method resets the current page to 0.\n * @param {string} attribute the attribute on which the numeric filter applies\n * @param {string} operator the operator of the filter\n * @param {number} value the value of the filter\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.addNumericRefinement = function (\n attribute,\n operator,\n value\n) {\n this._change({\n state: this.state\n .resetPage()\n .addNumericRefinement(attribute, operator, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Adds a filter to a faceted attribute with the `value` provided. If the\n * filter is already set, it doesn't change the filters.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} value the associated value (will be converted to string)\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.addFacetRefinement = function (facet, value) {\n this._change({\n state: this.state.resetPage().addFacetRefinement(facet, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#addFacetRefinement}\n */\nAlgoliaSearchHelper.prototype.addRefine = function () {\n return this.addFacetRefinement.apply(this, arguments);\n};\n\n/**\n * Adds a an exclusion filter to a faceted attribute with the `value` provided. If the\n * filter is already set, it doesn't change the filters.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} value the associated value (will be converted to string)\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.addFacetExclusion = function (facet, value) {\n this._change({\n state: this.state.resetPage().addExcludeRefinement(facet, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#addFacetExclusion}\n */\nAlgoliaSearchHelper.prototype.addExclude = function () {\n return this.addFacetExclusion.apply(this, arguments);\n};\n\n/**\n * Adds a tag filter with the `tag` provided. If the\n * filter is already set, it doesn't change the filters.\n *\n * This method resets the current page to 0.\n * @param {string} tag the tag to add to the filter\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.addTag = function (tag) {\n this._change({\n state: this.state.resetPage().addTagRefinement(tag),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Adds a \"frequently bought together\" recommendation query.\n *\n * @param {FrequentlyBoughtTogetherQuery} params the parameters for the recommendation\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.addFrequentlyBoughtTogether = function (params) {\n this._recommendChange({\n state: this.recommendState.addFrequentlyBoughtTogether(params),\n });\n\n return this;\n};\n\n/**\n * Adds a \"related products\" recommendation query.\n *\n * @param {RelatedProductsQuery} params the parameters for the recommendation\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.addRelatedProducts = function (params) {\n this._recommendChange({\n state: this.recommendState.addRelatedProducts(params),\n });\n\n return this;\n};\n\n/**\n * Adds a \"trending items\" recommendation query.\n *\n * @param {TrendingItemsQuery} params the parameters for the recommendation\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.addTrendingItems = function (params) {\n this._recommendChange({\n state: this.recommendState.addTrendingItems(params),\n });\n\n return this;\n};\n\n/**\n * Adds a \"trending facets\" recommendation query.\n *\n * @param {TrendingFacetsQuery} params the parameters for the recommendation\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.addTrendingFacets = function (params) {\n this._recommendChange({\n state: this.recommendState.addTrendingFacets(params),\n });\n\n return this;\n};\n\n/**\n * Adds a \"looking similar\" recommendation query.\n *\n * @param {LookingSimilarQuery} params the parameters for the recommendation\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.addLookingSimilar = function (params) {\n this._recommendChange({\n state: this.recommendState.addLookingSimilar(params),\n });\n\n return this;\n};\n\n/**\n * Removes an numeric filter to an attribute with the `operator` and `value` provided. If the\n * filter is not set, it doesn't change the filters.\n *\n * Some parameters are optional, triggering different behavior:\n * - if the value is not provided, then all the numeric value will be removed for the\n * specified attribute/operator couple.\n * - if the operator is not provided either, then all the numeric filter on this attribute\n * will be removed.\n *\n * This method resets the current page to 0.\n * @param {string} attribute the attribute on which the numeric filter applies\n * @param {string} [operator] the operator of the filter\n * @param {number} [value] the value of the filter\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeNumericRefinement = function (\n attribute,\n operator,\n value\n) {\n this._change({\n state: this.state\n .resetPage()\n .removeNumericRefinement(attribute, operator, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Removes a disjunctive filter to a faceted attribute with the `value` provided. If the\n * filter is not set, it doesn't change the filters.\n *\n * If the value is omitted, then this method will remove all the filters for the\n * attribute.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} [value] the associated value\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeDisjunctiveFacetRefinement = function (\n facet,\n value\n) {\n this._change({\n state: this.state\n .resetPage()\n .removeDisjunctiveFacetRefinement(facet, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#removeDisjunctiveFacetRefinement}\n */\nAlgoliaSearchHelper.prototype.removeDisjunctiveRefine = function () {\n return this.removeDisjunctiveFacetRefinement.apply(this, arguments);\n};\n\n/**\n * Removes the refinement set on a hierarchical facet.\n * @param {string} facet the facet name\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @throws Error if the facet is not defined or if the facet is not refined\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeHierarchicalFacetRefinement = function (\n facet\n) {\n this._change({\n state: this.state.resetPage().removeHierarchicalFacetRefinement(facet),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Removes a filter to a faceted attribute with the `value` provided. If the\n * filter is not set, it doesn't change the filters.\n *\n * If the value is omitted, then this method will remove all the filters for the\n * attribute.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} [value] the associated value\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeFacetRefinement = function (facet, value) {\n this._change({\n state: this.state.resetPage().removeFacetRefinement(facet, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#removeFacetRefinement}\n */\nAlgoliaSearchHelper.prototype.removeRefine = function () {\n return this.removeFacetRefinement.apply(this, arguments);\n};\n\n/**\n * Removes an exclusion filter to a faceted attribute with the `value` provided. If the\n * filter is not set, it doesn't change the filters.\n *\n * If the value is omitted, then this method will remove all the filters for the\n * attribute.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} [value] the associated value\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeFacetExclusion = function (facet, value) {\n this._change({\n state: this.state.resetPage().removeExcludeRefinement(facet, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#removeFacetExclusion}\n */\nAlgoliaSearchHelper.prototype.removeExclude = function () {\n return this.removeFacetExclusion.apply(this, arguments);\n};\n\n/**\n * Removes a tag filter with the `tag` provided. If the\n * filter is not set, it doesn't change the filters.\n *\n * This method resets the current page to 0.\n * @param {string} tag tag to remove from the filter\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeTag = function (tag) {\n this._change({\n state: this.state.resetPage().removeTagRefinement(tag),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Removes a \"frequently bought together\" recommendation query.\n *\n * @param {number} id identifier of the recommendation widget\n * @returns {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeFrequentlyBoughtTogether = function (id) {\n this._recommendChange({\n state: this.recommendState.removeParams(id),\n });\n\n return this;\n};\n\n/**\n * Removes a \"related products\" recommendation query.\n *\n * @param {number} id identifier of the recommendation widget\n * @returns {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeRelatedProducts = function (id) {\n this._recommendChange({\n state: this.recommendState.removeParams(id),\n });\n\n return this;\n};\n\n/**\n * Removes a \"trending items\" recommendation query.\n *\n * @param {number} id identifier of the recommendation widget\n * @returns {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeTrendingItems = function (id) {\n this._recommendChange({\n state: this.recommendState.removeParams(id),\n });\n\n return this;\n};\n\n/**\n * Removes a \"trending facets\" recommendation query.\n *\n * @param {number} id identifier of the recommendation widget\n * @returns {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeTrendingFacets = function (id) {\n this._recommendChange({\n state: this.recommendState.removeParams(id),\n });\n\n return this;\n};\n\n/**\n * Removes a \"looking similar\" recommendation query.\n *\n * @param {number} id identifier of the recommendation widget\n * @returns {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeLookingSimilar = function (id) {\n this._recommendChange({\n state: this.recommendState.removeParams(id),\n });\n\n return this;\n};\n\n/**\n * Adds or removes an exclusion filter to a faceted attribute with the `value` provided. If\n * the value is set then it removes it, otherwise it adds the filter.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} value the associated value\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.toggleFacetExclusion = function (facet, value) {\n this._change({\n state: this.state.resetPage().toggleExcludeFacetRefinement(facet, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#toggleFacetExclusion}\n */\nAlgoliaSearchHelper.prototype.toggleExclude = function () {\n return this.toggleFacetExclusion.apply(this, arguments);\n};\n\n/**\n * Adds or removes a filter to a faceted attribute with the `value` provided. If\n * the value is set then it removes it, otherwise it adds the filter.\n *\n * This method can be used for conjunctive, disjunctive and hierarchical filters.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} value the associated value\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @throws Error will throw an error if the facet is not declared in the settings of the helper\n * @fires change\n * @chainable\n * @deprecated since version 2.19.0, see {@link AlgoliaSearchHelper#toggleFacetRefinement}\n */\nAlgoliaSearchHelper.prototype.toggleRefinement = function (facet, value) {\n return this.toggleFacetRefinement(facet, value);\n};\n\n/**\n * Adds or removes a filter to a faceted attribute with the `value` provided. If\n * the value is set then it removes it, otherwise it adds the filter.\n *\n * This method can be used for conjunctive, disjunctive and hierarchical filters.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} value the associated value\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @throws Error will throw an error if the facet is not declared in the settings of the helper\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.toggleFacetRefinement = function (facet, value) {\n this._change({\n state: this.state.resetPage().toggleFacetRefinement(facet, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#toggleFacetRefinement}\n */\nAlgoliaSearchHelper.prototype.toggleRefine = function () {\n return this.toggleFacetRefinement.apply(this, arguments);\n};\n\n/**\n * Adds or removes a tag filter with the `value` provided. If\n * the value is set then it removes it, otherwise it adds the filter.\n *\n * This method resets the current page to 0.\n * @param {string} tag tag to remove or add\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.toggleTag = function (tag) {\n this._change({\n state: this.state.resetPage().toggleTagRefinement(tag),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Increments the page number by one.\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n * @example\n * helper.setPage(0).nextPage().getPage();\n * // returns 1\n */\nAlgoliaSearchHelper.prototype.nextPage = function () {\n var page = this.state.page || 0;\n return this.setPage(page + 1);\n};\n\n/**\n * Decrements the page number by one.\n * @fires change\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @chainable\n * @example\n * helper.setPage(1).previousPage().getPage();\n * // returns 0\n */\nAlgoliaSearchHelper.prototype.previousPage = function () {\n var page = this.state.page || 0;\n return this.setPage(page - 1);\n};\n\n/**\n * @private\n * @param {number} page The page number\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @chainable\n * @fires change\n */\nfunction setCurrentPage(page) {\n if (page < 0) throw new Error('Page requested below 0.');\n\n this._change({\n state: this.state.setPage(page),\n isPageReset: false,\n });\n\n return this;\n}\n\n/**\n * Change the current page\n * @deprecated\n * @param {number} page The page number\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.setCurrentPage = setCurrentPage;\n\n/**\n * Updates the current page.\n * @function\n * @param {number} page The page number\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.setPage = setCurrentPage;\n\n/**\n * Updates the name of the index that will be targeted by the query.\n *\n * This method resets the current page to 0.\n * @param {string} name the index name\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.setIndex = function (name) {\n this._change({\n state: this.state.resetPage().setIndex(name),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Update a parameter of the search. This method reset the page\n *\n * The complete list of parameters is available on the\n * [Algolia website](https://www.algolia.com/doc/rest#query-an-index).\n * The most commonly used parameters have their own [shortcuts](#query-parameters-shortcuts)\n * or benefit from higher-level APIs (all the kind of filters and facets have their own API)\n *\n * This method resets the current page to 0.\n * @param {string} parameter name of the parameter to update\n * @param {any} value new value of the parameter\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n * @example\n * helper.setQueryParameter('hitsPerPage', 20).search();\n */\nAlgoliaSearchHelper.prototype.setQueryParameter = function (parameter, value) {\n this._change({\n state: this.state.resetPage().setQueryParameter(parameter, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Set the whole state (warning: will erase previous state)\n * @param {SearchParameters} newState the whole new state\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.setState = function (newState) {\n this._change({\n state: SearchParameters.make(newState),\n isPageReset: false,\n });\n\n return this;\n};\n\n/**\n * Override the current state without triggering a change event.\n * Do not use this method unless you know what you are doing. (see the example\n * for a legit use case)\n * @param {SearchParameters} newState the whole new state\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @example\n * helper.on('change', function(state){\n * // In this function you might want to find a way to store the state in the url/history\n * updateYourURL(state)\n * })\n * window.onpopstate = function(event){\n * // This is naive though as you should check if the state is really defined etc.\n * helper.overrideStateWithoutTriggeringChangeEvent(event.state).search()\n * }\n * @chainable\n */\nAlgoliaSearchHelper.prototype.overrideStateWithoutTriggeringChangeEvent =\n function (newState) {\n this.state = new SearchParameters(newState);\n return this;\n };\n\n/**\n * Check if an attribute has any numeric, conjunctive, disjunctive or hierarchical filters.\n * @param {string} attribute the name of the attribute\n * @return {boolean} true if the attribute is filtered by at least one value\n * @example\n * // hasRefinements works with numeric, conjunctive, disjunctive and hierarchical filters\n * helper.hasRefinements('price'); // false\n * helper.addNumericRefinement('price', '>', 100);\n * helper.hasRefinements('price'); // true\n *\n * helper.hasRefinements('color'); // false\n * helper.addFacetRefinement('color', 'blue');\n * helper.hasRefinements('color'); // true\n *\n * helper.hasRefinements('material'); // false\n * helper.addDisjunctiveFacetRefinement('material', 'plastic');\n * helper.hasRefinements('material'); // true\n *\n * helper.hasRefinements('categories'); // false\n * helper.toggleFacetRefinement('categories', 'kitchen > knife');\n * helper.hasRefinements('categories'); // true\n *\n */\nAlgoliaSearchHelper.prototype.hasRefinements = function (attribute) {\n if (objectHasKeys(this.state.getNumericRefinements(attribute))) {\n return true;\n } else if (this.state.isConjunctiveFacet(attribute)) {\n return this.state.isFacetRefined(attribute);\n } else if (this.state.isDisjunctiveFacet(attribute)) {\n return this.state.isDisjunctiveFacetRefined(attribute);\n } else if (this.state.isHierarchicalFacet(attribute)) {\n return this.state.isHierarchicalFacetRefined(attribute);\n }\n\n // there's currently no way to know that the user did call `addNumericRefinement` at some point\n // thus we cannot distinguish if there once was a numeric refinement that was cleared\n // so we will return false in every other situations to be consistent\n // while what we should do here is throw because we did not find the attribute in any type\n // of refinement\n return false;\n};\n\n/**\n * Check if a value is excluded for a specific faceted attribute. If the value\n * is omitted then the function checks if there is any excluding refinements.\n *\n * @param {string} facet name of the attribute for used for faceting\n * @param {string} [value] optional value. If passed will test that this value\n * is filtering the given facet.\n * @return {boolean} true if refined\n * @example\n * helper.isExcludeRefined('color'); // false\n * helper.isExcludeRefined('color', 'blue') // false\n * helper.isExcludeRefined('color', 'red') // false\n *\n * helper.addFacetExclusion('color', 'red');\n *\n * helper.isExcludeRefined('color'); // true\n * helper.isExcludeRefined('color', 'blue') // false\n * helper.isExcludeRefined('color', 'red') // true\n */\nAlgoliaSearchHelper.prototype.isExcluded = function (facet, value) {\n return this.state.isExcludeRefined(facet, value);\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since 2.4.0, see {@link AlgoliaSearchHelper#hasRefinements}\n */\nAlgoliaSearchHelper.prototype.isDisjunctiveRefined = function (facet, value) {\n return this.state.isDisjunctiveFacetRefined(facet, value);\n};\n\n/**\n * Check if the string is a currently filtering tag.\n * @param {string} tag tag to check\n * @return {boolean} true if the tag is currently refined\n */\nAlgoliaSearchHelper.prototype.hasTag = function (tag) {\n return this.state.isTagRefined(tag);\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since 2.4.0, see {@link AlgoliaSearchHelper#hasTag}\n */\nAlgoliaSearchHelper.prototype.isTagRefined = function () {\n return this.hasTagRefinements.apply(this, arguments);\n};\n\n/**\n * Get the name of the currently used index.\n * @return {string} name of the index\n * @example\n * helper.setIndex('highestPrice_products').getIndex();\n * // returns 'highestPrice_products'\n */\nAlgoliaSearchHelper.prototype.getIndex = function () {\n return this.state.index;\n};\n\nfunction getCurrentPage() {\n return this.state.page;\n}\n\n/**\n * Get the currently selected page\n * @deprecated\n * @return {number} the current page\n */\nAlgoliaSearchHelper.prototype.getCurrentPage = getCurrentPage;\n/**\n * Get the currently selected page\n * @function\n * @return {number} the current page\n */\nAlgoliaSearchHelper.prototype.getPage = getCurrentPage;\n\n/**\n * Get all the tags currently set to filters the results.\n *\n * @return {string[]} The list of tags currently set.\n */\nAlgoliaSearchHelper.prototype.getTags = function () {\n return this.state.tagRefinements;\n};\n\n/**\n * Get the list of refinements for a given attribute. This method works with\n * conjunctive, disjunctive, excluding and numerical filters.\n *\n * See also SearchResults#getRefinements\n *\n * @param {string} facetName attribute name used for faceting\n * @return {Array.<FacetRefinement|NumericRefinement>} All Refinement are objects that contain a value, and\n * a type. Numeric also contains an operator.\n * @example\n * helper.addNumericRefinement('price', '>', 100);\n * helper.getRefinements('price');\n * // [\n * // {\n * // \"value\": [\n * // 100\n * // ],\n * // \"operator\": \">\",\n * // \"type\": \"numeric\"\n * // }\n * // ]\n * @example\n * helper.addFacetRefinement('color', 'blue');\n * helper.addFacetExclusion('color', 'red');\n * helper.getRefinements('color');\n * // [\n * // {\n * // \"value\": \"blue\",\n * // \"type\": \"conjunctive\"\n * // },\n * // {\n * // \"value\": \"red\",\n * // \"type\": \"exclude\"\n * // }\n * // ]\n * @example\n * helper.addDisjunctiveFacetRefinement('material', 'plastic');\n * // [\n * // {\n * // \"value\": \"plastic\",\n * // \"type\": \"disjunctive\"\n * // }\n * // ]\n */\nAlgoliaSearchHelper.prototype.getRefinements = function (facetName) {\n var refinements = [];\n\n if (this.state.isConjunctiveFacet(facetName)) {\n var conjRefinements = this.state.getConjunctiveRefinements(facetName);\n\n conjRefinements.forEach(function (r) {\n refinements.push({\n value: r,\n type: 'conjunctive',\n });\n });\n\n var excludeRefinements = this.state.getExcludeRefinements(facetName);\n\n excludeRefinements.forEach(function (r) {\n refinements.push({\n value: r,\n type: 'exclude',\n });\n });\n } else if (this.state.isDisjunctiveFacet(facetName)) {\n var disjunctiveRefinements =\n this.state.getDisjunctiveRefinements(facetName);\n\n disjunctiveRefinements.forEach(function (r) {\n refinements.push({\n value: r,\n type: 'disjunctive',\n });\n });\n }\n\n var numericRefinements = this.state.getNumericRefinements(facetName);\n\n Object.keys(numericRefinements).forEach(function (operator) {\n var value = numericRefinements[operator];\n\n refinements.push({\n value: value,\n operator: operator,\n type: 'numeric',\n });\n });\n\n return refinements;\n};\n\n/**\n * Return the current refinement for the (attribute, operator)\n * @param {string} attribute attribute in the record\n * @param {string} operator operator applied on the refined values\n * @return {Array.<number|number[]>} refined values\n */\nAlgoliaSearchHelper.prototype.getNumericRefinement = function (\n attribute,\n operator\n) {\n return this.state.getNumericRefinement(attribute, operator);\n};\n\n/**\n * Get the current breadcrumb for a hierarchical facet, as an array\n * @param {string} facetName Hierarchical facet name\n * @return {array.<string>} the path as an array of string\n */\nAlgoliaSearchHelper.prototype.getHierarchicalFacetBreadcrumb = function (\n facetName\n) {\n return this.state.getHierarchicalFacetBreadcrumb(facetName);\n};\n\n// /////////// PRIVATE\n\n/**\n * Perform the underlying queries\n * @private\n * @param {object} options options for the query\n * @param {boolean} [options.onlyWithDerivedHelpers=false] if true, only the derived helpers will be queried\n * @return {undefined} does not return anything\n * @fires search\n * @fires result\n * @fires error\n */\nAlgoliaSearchHelper.prototype._search = function (options) {\n var state = this.state;\n var states = [];\n var mainQueries = [];\n\n if (!options.onlyWithDerivedHelpers) {\n mainQueries = requestBuilder._getQueries(state.index, state);\n\n states.push({\n state: state,\n queriesCount: mainQueries.length,\n helper: this,\n });\n\n this.emit('search', {\n state: state,\n results: this.lastResults,\n });\n }\n\n var derivedQueries = this.derivedHelpers.map(function (derivedHelper) {\n var derivedState = derivedHelper.getModifiedState(state);\n var derivedStateQueries = derivedState.index\n ? requestBuilder._getQueries(derivedState.index, derivedState)\n : [];\n\n states.push({\n state: derivedState,\n queriesCount: derivedStateQueries.length,\n helper: derivedHelper,\n });\n\n derivedHelper.emit('search', {\n state: derivedState,\n results: derivedHelper.lastResults,\n });\n\n return derivedStateQueries;\n });\n\n var queries = Array.prototype.concat.apply(mainQueries, derivedQueries);\n\n var queryId = this._queryId++;\n this._currentNbQueries++;\n\n if (!queries.length) {\n return Promise.resolve({ results: [] }).then(\n this._dispatchAlgoliaResponse.bind(this, states, queryId)\n );\n }\n\n try {\n this.client\n .search(queries)\n .then(this._dispatchAlgoliaResponse.bind(this, states, queryId))\n .catch(this._dispatchAlgoliaError.bind(this, queryId));\n } catch (error) {\n // If we reach this part, we're in an internal error state\n this.emit('error', {\n error: error,\n });\n }\n\n return undefined;\n};\n\n/**\n * Perform the underlying queries\n * @private\n * @param {boolean} [options.onlyWithDerivedHelpers=false] if true, only the derived helpers will be queried\n * @return {undefined} does not return anything\n * @fires search\n * @fires result\n * @fires error\n */\nAlgoliaSearchHelper.prototype._runComposition = function () {\n var state = this.state;\n var states = [];\n var mainQueries = [];\n\n var derivedQueries = this.derivedHelpers.map(function (derivedHelper) {\n var derivedState = derivedHelper.getModifiedState(state);\n var derivedStateQueries =\n requestBuilder._getCompositionQueries(derivedState);\n\n states.push({\n state: derivedState,\n helper: derivedHelper,\n });\n\n derivedHelper.emit('search', {\n state: derivedState,\n results: derivedHelper.lastResults,\n });\n\n return derivedStateQueries;\n });\n\n var queries = Array.prototype.concat.apply(mainQueries, derivedQueries);\n\n var queryId = this._queryId++;\n this._currentNbQueries++;\n\n if (!queries.length) {\n return Promise.resolve({ results: [] }).then(\n this._dispatchAlgoliaResponse.bind(this, states, queryId)\n );\n }\n\n if (queries.length > 1) {\n throw new Error('Only one query is allowed when using a composition.');\n }\n\n var query = queries[0];\n\n try {\n this.client\n .search(query)\n .then(this._dispatchAlgoliaResponse.bind(this, states, queryId))\n .catch(this._dispatchAlgoliaError.bind(this, queryId));\n } catch (error) {\n // If we reach this part, we're in an internal error state\n this.emit('error', {\n error: error,\n });\n }\n\n return undefined;\n};\n\nAlgoliaSearchHelper.prototype._recommend = function () {\n var searchState = this.state;\n var recommendState = this.recommendState;\n var index = this.getIndex();\n var states = [{ state: recommendState, index: index, helper: this }];\n var ids = recommendState.params.map(function (param) {\n return param.$$id;\n });\n\n this.emit('fetch', {\n recommend: {\n state: recommendState,\n results: this.lastRecommendResults,\n },\n });\n\n var cache = this._recommendCache;\n\n var derivedQueries = this.derivedHelpers.map(function (derivedHelper) {\n var derivedIndex = derivedHelper.getModifiedState(searchState).index;\n if (!derivedIndex) {\n return [];\n }\n\n // Contrary to what is done when deriving the search state, we don't want to\n // provide the current recommend state to the derived helper, as it would\n // inherit unwanted queries. We instead provide an empty recommend state.\n var derivedState = derivedHelper.getModifiedRecommendState(\n new RecommendParameters()\n );\n states.push({\n state: derivedState,\n index: derivedIndex,\n helper: derivedHelper,\n });\n\n ids = Array.prototype.concat.apply(\n ids,\n derivedState.params.map(function (param) {\n return param.$$id;\n })\n );\n\n derivedHelper.emit('fetch', {\n recommend: {\n state: derivedState,\n results: derivedHelper.lastRecommendResults,\n },\n });\n\n return derivedState._buildQueries(derivedIndex, cache);\n });\n\n var queries = Array.prototype.concat.apply(\n this.recommendState._buildQueries(index, cache),\n derivedQueries\n );\n\n if (queries.length === 0) {\n return;\n }\n\n if (\n queries.length > 0 &&\n typeof this.client.getRecommendations === 'undefined'\n ) {\n // eslint-disable-next-line no-console\n console.warn(\n 'Please update algoliasearch/lite to the latest version in order to use recommend widgets.'\n );\n return;\n }\n\n var queryId = this._recommendQueryId++;\n this._currentNbRecommendQueries++;\n\n try {\n this.client\n .getRecommendations(queries)\n .then(this._dispatchRecommendResponse.bind(this, queryId, states, ids))\n .catch(this._dispatchRecommendError.bind(this, queryId));\n } catch (error) {\n // If we reach this part, we're in an internal error state\n this.emit('error', {\n error: error,\n });\n }\n\n return;\n};\n\n/**\n * Transform the responses as sent by the server and transform them into a user\n * usable object that merge the results of all the batch requests. It will dispatch\n * over the different helper + derived helpers (when there are some).\n * @private\n * @param {array.<{SearchParameters, AlgoliaQueries, AlgoliaSearchHelper}>} states state used to generate the request\n * @param {number} queryId id of the current request\n * @param {object} content content of the response\n * @return {undefined}\n */\nAlgoliaSearchHelper.prototype._dispatchAlgoliaResponse = function (\n states,\n queryId,\n content\n) {\n // eslint-disable-next-line consistent-this\n var self = this;\n\n // @TODO remove the number of outdated queries discarded instead of just one\n\n if (queryId < this._lastQueryIdReceived) {\n // Outdated answer\n return;\n }\n\n this._currentNbQueries -= queryId - this._lastQueryIdReceived;\n this._lastQueryIdReceived = queryId;\n\n if (this._currentNbQueries === 0) this.emit('searchQueueEmpty');\n\n var results = content.results.slice();\n var rawContent = Object.keys(content).reduce(function (value, key) {\n if (key !== 'results') value[key] = content[key];\n return value;\n }, {});\n\n if (Object.keys(rawContent).length <= 0) {\n rawContent = undefined;\n }\n\n states.forEach(function (s) {\n var state = s.state;\n var queriesCount = s.queriesCount;\n var helper = s.helper;\n var specificResults = queriesCount !== undefined\n ? results.splice(0, queriesCount)\n : results;\n\n if (!state.index) {\n helper.emit('result', {\n results: null,\n state: state,\n });\n return;\n }\n\n // Multifeed composition: build ordered SearchResults array on lastResults\n if (specificResults.length > 0 && specificResults[0].feedID) {\n var feeds = specificResults.map(function (r) {\n var sr = new SearchResults(state, [r], self._searchResultsOptions);\n if (rawContent !== undefined) sr._rawContent = rawContent;\n return sr;\n });\n helper.lastResults = new SearchResults(\n state,\n [specificResults[0]],\n self._searchResultsOptions\n );\n helper.lastResults.feeds = feeds;\n if (rawContent !== undefined) helper.lastResults._rawContent = rawContent;\n } else {\n helper.lastResults = new SearchResults(\n state,\n specificResults,\n self._searchResultsOptions\n );\n if (rawContent !== undefined) helper.lastResults._rawContent = rawContent;\n }\n\n helper.emit('result', {\n results: helper.lastResults,\n state: state,\n });\n });\n};\n\nAlgoliaSearchHelper.prototype._dispatchRecommendResponse = function (\n queryId,\n states,\n ids,\n content\n) {\n // @TODO remove the number of outdated queries discarded instead of just one\n\n if (queryId < this._lastRecommendQueryIdReceived) {\n // Outdated answer\n return;\n }\n\n this._currentNbRecommendQueries -=\n queryId - this._lastRecommendQueryIdReceived;\n this._lastRecommendQueryIdReceived = queryId;\n\n if (this._currentNbRecommendQueries === 0) this.emit('recommendQueueEmpty');\n\n var cache = this._recommendCache;\n\n var idsMap = {};\n ids\n .filter(function (id) {\n return cache[id] === undefined;\n })\n .forEach(function (id, index) {\n if (!idsMap[id]) idsMap[id] = [];\n\n idsMap[id].push(index);\n });\n\n Object.keys(idsMap).forEach(function (id) {\n var indices = idsMap[id];\n var firstResult = content.results[indices[0]];\n if (indices.length === 1) {\n cache[id] = firstResult;\n return;\n }\n cache[id] = Object.assign({}, firstResult, {\n hits: sortAndMergeRecommendations(\n ids,\n indices.map(function (idx) {\n return content.results[idx].hits;\n })\n ),\n });\n });\n\n var results = {};\n ids.forEach(function (id) {\n results[id] = cache[id];\n });\n\n states.forEach(function (s) {\n var state = s.state;\n var helper = s.helper;\n\n if (!s.index) {\n // eslint-disable-next-line no-warning-comments\n // TODO: emit \"result\" event when events for Recommend are implemented\n helper.emit('recommend:result', {\n results: null,\n state: state,\n });\n return;\n }\n\n helper.lastRecommendResults = new RecommendResults(state, results);\n\n // eslint-disable-next-line no-warning-comments\n // TODO: emit \"result\" event when events for Recommend are implemented\n helper.emit('recommend:result', {\n recommend: {\n results: helper.lastRecommendResults,\n state: state,\n },\n });\n });\n};\n\nAlgoliaSearchHelper.prototype._dispatchAlgoliaError = function (\n queryId,\n error\n) {\n if (queryId < this._lastQueryIdReceived) {\n // Outdated answer\n return;\n }\n\n this._currentNbQueries -= queryId - this._lastQueryIdReceived;\n this._lastQueryIdReceived = queryId;\n\n this.emit('error', {\n error: error,\n });\n\n if (this._currentNbQueries === 0) this.emit('searchQueueEmpty');\n};\n\nAlgoliaSearchHelper.prototype._dispatchRecommendError = function (\n queryId,\n error\n) {\n if (queryId < this._lastRecommendQueryIdReceived) {\n // Outdated answer\n return;\n }\n\n this._currentNbRecommendQueries -=\n queryId - this._lastRecommendQueryIdReceived;\n this._lastRecommendQueryIdReceived = queryId;\n\n this.emit('error', {\n error: error,\n });\n\n if (this._currentNbRecommendQueries === 0) this.emit('recommendQueueEmpty');\n};\n\nAlgoliaSearchHelper.prototype.containsRefinement = function (\n query,\n facetFilters,\n numericFilters,\n tagFilters\n) {\n return (\n query ||\n facetFilters.length !== 0 ||\n numericFilters.length !== 0 ||\n tagFilters.length !== 0\n );\n};\n\n/**\n * Test if there are some disjunctive refinements on the facet\n * @private\n * @param {string} facet the attribute to test\n * @return {boolean} true if there are refinements on this attribute\n */\nAlgoliaSearchHelper.prototype._hasDisjunctiveRefinements = function (facet) {\n return (\n this.state.disjunctiveRefinements[facet] &&\n this.state.disjunctiveRefinements[facet].length > 0\n );\n};\n\nAlgoliaSearchHelper.prototype._change = function (event) {\n var state = event.state;\n var isPageReset = event.isPageReset;\n\n if (state !== this.state) {\n this.state = state;\n\n this.emit('change', {\n state: this.state,\n results: this.lastResults,\n isPageReset: isPageReset,\n });\n }\n};\n\nAlgoliaSearchHelper.prototype._recommendChange = function (event) {\n var state = event.state;\n\n if (state !== this.recommendState) {\n this.recommendState = state;\n\n // eslint-disable-next-line no-warning-comments\n // TODO: emit \"change\" event when events for Recommend are implemented\n this.emit('recommend:change', {\n search: {\n results: this.lastResults,\n state: this.state,\n },\n recommend: {\n results: this.lastRecommendResults,\n state: this.recommendState,\n },\n });\n }\n};\n\n/**\n * Clears the cache of the underlying Algolia client.\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n */\nAlgoliaSearchHelper.prototype.clearCache = function () {\n if (this.client.clearCache) this.client.clearCache();\n return this;\n};\n\n/**\n * Updates the internal client instance. If the reference of the clients\n * are equal then no update is actually done.\n * @param {AlgoliaSearch} newClient an AlgoliaSearch client\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n */\nAlgoliaSearchHelper.prototype.setClient = function (newClient) {\n if (this.client === newClient) return this;\n\n if (typeof newClient.addAlgoliaAgent === 'function') {\n newClient.addAlgoliaAgent('JS Helper (' + version + ')');\n }\n this.client = newClient;\n\n return this;\n};\n\n/**\n * Gets the instance of the currently used client.\n * @return {AlgoliaSearch} the currently used client\n */\nAlgoliaSearchHelper.prototype.getClient = function () {\n return this.client;\n};\n\n/**\n * Creates an derived instance of the Helper. A derived helper\n * is a way to request other indices synchronised with the lifecycle\n * of the main Helper. This mechanism uses the multiqueries feature\n * of Algolia to aggregate all the requests in a single network call.\n *\n * This method takes a function that is used to create a new SearchParameter\n * that will be used to create requests to Algolia. Those new requests\n * are created just before the `search` event. The signature of the function\n * is `SearchParameters -> SearchParameters`.\n *\n * This method returns a new DerivedHelper which is an EventEmitter\n * that fires the same `search`, `result` and `error` events. Those\n * events, however, will receive data specific to this DerivedHelper\n * and the SearchParameters that is returned by the call of the\n * parameter function.\n * @param {function} fn SearchParameters -> SearchParameters\n * @param {function} recommendFn RecommendParameters -> RecommendParameters\n * @return {DerivedHelper} a new DerivedHelper\n */\nAlgoliaSearchHelper.prototype.derive = function (fn, recommendFn) {\n var derivedHelper = new DerivedHelper(this, fn, recommendFn);\n this.derivedHelpers.push(derivedHelper);\n return derivedHelper;\n};\n\n/**\n * This method detaches a derived Helper from the main one. Prefer using the one from the\n * derived helper itself, to remove the event listeners too.\n * @private\n * @param {DerivedHelper} derivedHelper the derived helper to detach\n * @return {undefined} nothing is returned\n * @throws Error\n */\nAlgoliaSearchHelper.prototype.detachDerivedHelper = function (derivedHelper) {\n var pos = this.derivedHelpers.indexOf(derivedHelper);\n if (pos === -1) throw new Error('Derived helper already detached');\n this.derivedHelpers.splice(pos, 1);\n};\n\n/**\n * This method returns true if there is currently at least one on-going search.\n * @return {boolean} true if there is a search pending\n */\nAlgoliaSearchHelper.prototype.hasPendingRequests = function () {\n return this._currentNbQueries > 0;\n};\n\n/**\n * @typedef AlgoliaSearchHelper.NumericRefinement\n * @type {object}\n * @property {number[]} value the numbers that are used for filtering this attribute with\n * the operator specified.\n * @property {string} operator the faceting data: value, number of entries\n * @property {string} type will be 'numeric'\n */\n\n/**\n * @typedef AlgoliaSearchHelper.FacetRefinement\n * @type {object}\n * @property {string} value the string use to filter the attribute\n * @property {string} type the type of filter: 'conjunctive', 'disjunctive', 'exclude'\n */\n\nmodule.exports = AlgoliaSearchHelper;\n"],"names":["EventEmitter","require$$0","DerivedHelper","require$$1","escapeFacetValue","require$$2","inherits","require$$3","merge","require$$4","objectHasKeys","require$$5","omit","require$$6","RecommendParameters","require$$7","RecommendResults","require$$8","requestBuilder","require$$9","SearchParameters","require$$10","SearchResults","require$$11","sortAndMergeRecommendations","require$$12","version","require$$13","AlgoliaSearchHelper","client","index","options","searchResultsOptions","addAlgoliaAgent","this","setClient","opts","state","make","recommendState","params","lastResults","lastRecommendResults","_queryId","_recommendQueryId","_lastQueryIdReceived","_lastRecommendQueryIdReceived","derivedHelpers","_currentNbQueries","_currentNbRecommendQueries","_searchResultsOptions","_recommendCache","setCurrentPage","page","Error","_change","setPage","isPageReset","getCurrentPage","prototype","search","_search","onlyWithDerivedHelpers","searchOnlyWithDerivedHelpers","searchWithComposition","_runComposition","recommend","_recommend","getQuery","_getHitsSearchParams","searchOnce","cb","tempState","setQueryParameters","queries","_getQueries","self","emit","then","content","results","_originalResponse","e","catch","err","findAnswers","console","warn","derivedHelper","Promise","resolve","derivedState","getModifiedState","data","attributesForPrediction","nbHits","errorMessage","initIndex","query","queryLanguages","searchForFacetValues","facet","maxFacetHits","userState","clientHasSFFV","searchForFacets","clientHasInitIndex","isDisjunctive","isDisjunctiveFacet","algoliaQuery","getSearchForFacetQuery","searchForFacetValuesPromise","indexName","facetName","type","response","hide","renderingContent","facetOrdering","values","Array","isArray","facetHits","reduce","acc","f","indexOf","value","escapedValue","isRefined","isDisjunctiveFacetRefined","isFacetRefined","push","searchForCompositionFacetValues","compositionID","searchForFacetValuesRequest","searchQuery","_getCompositionHitsSearchParams","forEach","setQuery","q","resetPage","clearRefinements","name","clearTags","addDisjunctiveFacetRefinement","addDisjunctiveRefine","apply","arguments","addHierarchicalFacetRefinement","path","addNumericRefinement","attribute","operator","addFacetRefinement","addRefine","addFacetExclusion","addExcludeRefinement","addExclude","addTag","tag","addTagRefinement","addFrequentlyBoughtTogether","_recommendChange","addRelatedProducts","addTrendingItems","addTrendingFacets","addLookingSimilar","removeNumericRefinement","removeDisjunctiveFacetRefinement","removeDisjunctiveRefine","removeHierarchicalFacetRefinement","removeFacetRefinement","removeRefine","removeFacetExclusion","removeExcludeRefinement","removeExclude","removeTag","removeTagRefinement","removeFrequentlyBoughtTogether","id","removeParams","removeRelatedProducts","removeTrendingItems","removeTrendingFacets","removeLookingSimilar","toggleFacetExclusion","toggleExcludeFacetRefinement","toggleExclude","toggleRefinement","toggleFacetRefinement","toggleRefine","toggleTag","toggleTagRefinement","nextPage","previousPage","setIndex","setQueryParameter","parameter","setState","newState","overrideStateWithoutTriggeringChangeEvent","hasRefinements","getNumericRefinements","isConjunctiveFacet","isHierarchicalFacet","isHierarchicalFacetRefined","isExcluded","isExcludeRefined","isDisjunctiveRefined","hasTag","isTagRefined","hasTagRefinements","getIndex","getPage","getTags","tagRefinements","getRefinements","refinements","getConjunctiveRefinements","r","getExcludeRefinements","getDisjunctiveRefinements","numericRefinements","Object","keys","getNumericRefinement","getHierarchicalFacetBreadcrumb","states","mainQueries","queriesCount","length","helper","derivedQueries","map","derivedStateQueries","concat","queryId","_dispatchAlgoliaResponse","bind","_dispatchAlgoliaError","error","_getCompositionQueries","searchState","ids","param","$$id","cache","derivedIndex","getModifiedRecommendState","_buildQueries","getRecommendations","_dispatchRecommendResponse","_dispatchRecommendError","slice","rawContent","key","undefined","s","specificResults","splice","feedID","feeds","sr","_rawContent","idsMap","filter","indices","firstResult","assign","hits","idx","containsRefinement","facetFilters","numericFilters","tagFilters","_hasDisjunctiveRefinements","disjunctiveRefinements","event","clearCache","newClient","getClient","derive","fn","recommendFn","detachDerivedHelper","pos","hasPendingRequests","algoliasearch_helper"],"mappings":"8xBAEA,IAAIA,EAAeC,IAEfC,EAAgBC,IAChBC,EAAmBC,IAAwCD,iBAC3DE,EAAWC,IACXC,EAAQC,IACRC,EAAgBC,I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B,EAAK,EAClC,EAMAlQ,EAAoB+B,UAAUoO,mBAAqB,WACjD,OAAO7P,KAAKc,kBAAoB,CAClC,EAkBAgP,EAAiBpQ","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"algoliasearch.helper.js","sources":["../../../../../node_modules/algoliasearch-helper/src/algoliasearch.helper.js"],"sourcesContent":["'use strict';\n\nvar EventEmitter = require('@algolia/events');\n\nvar DerivedHelper = require('./DerivedHelper');\nvar escapeFacetValue = require('./functions/escapeFacetValue').escapeFacetValue;\nvar inherits = require('./functions/inherits');\nvar merge = require('./functions/merge');\nvar objectHasKeys = require('./functions/objectHasKeys');\nvar omit = require('./functions/omit');\nvar RecommendParameters = require('./RecommendParameters');\nvar RecommendResults = require('./RecommendResults');\nvar requestBuilder = require('./requestBuilder');\nvar SearchParameters = require('./SearchParameters');\nvar SearchResults = require('./SearchResults');\nvar sortAndMergeRecommendations = require('./utils/sortAndMergeRecommendations');\nvar version = require('./version');\n\n/**\n * Event triggered when a parameter is set or updated\n * @event AlgoliaSearchHelper#event:change\n * @property {object} event\n * @property {SearchParameters} event.state the current parameters with the latest changes applied\n * @property {SearchResults} event.results the previous results received from Algolia. `null` before the first request\n * @example\n * helper.on('change', function(event) {\n * console.log('The parameters have changed');\n * });\n */\n\n/**\n * Event triggered when a main search is sent to Algolia\n * @event AlgoliaSearchHelper#event:search\n * @property {object} event\n * @property {SearchParameters} event.state the parameters used for this search\n * @property {SearchResults} event.results the results from the previous search. `null` if it is the first search.\n * @example\n * helper.on('search', function(event) {\n * console.log('Search sent');\n * });\n */\n\n/**\n * Event triggered when a search using `searchForFacetValues` is sent to Algolia\n * @event AlgoliaSearchHelper#event:searchForFacetValues\n * @property {object} event\n * @property {SearchParameters} event.state the parameters used for this search it is the first search.\n * @property {string} event.facet the facet searched into\n * @property {string} event.query the query used to search in the facets\n * @example\n * helper.on('searchForFacetValues', function(event) {\n * console.log('searchForFacetValues sent');\n * });\n */\n\n/**\n * Event triggered when a search using `searchOnce` is sent to Algolia\n * @event AlgoliaSearchHelper#event:searchOnce\n * @property {object} event\n * @property {SearchParameters} event.state the parameters used for this search it is the first search.\n * @example\n * helper.on('searchOnce', function(event) {\n * console.log('searchOnce sent');\n * });\n */\n\n/**\n * Event triggered when the results are retrieved from Algolia\n * @event AlgoliaSearchHelper#event:result\n * @property {object} event\n * @property {SearchResults} event.results the results received from Algolia\n * @property {SearchParameters} event.state the parameters used to query Algolia. Those might be different from the one in the helper instance (for example if the network is unreliable).\n * @example\n * helper.on('result', function(event) {\n * console.log('Search results received');\n * });\n */\n\n/**\n * Event triggered when Algolia sends back an error. For example, if an unknown parameter is\n * used, the error can be caught using this event.\n * @event AlgoliaSearchHelper#event:error\n * @property {object} event\n * @property {Error} event.error the error returned by the Algolia.\n * @example\n * helper.on('error', function(event) {\n * console.log('Houston we got a problem.');\n * });\n */\n\n/**\n * Event triggered when the queue of queries have been depleted (with any result or outdated queries)\n * @event AlgoliaSearchHelper#event:searchQueueEmpty\n * @example\n * helper.on('searchQueueEmpty', function() {\n * console.log('No more search pending');\n * // This is received before the result event if we're not expecting new results\n * });\n *\n * helper.search();\n */\n\n/**\n * Initialize a new AlgoliaSearchHelper\n * @class\n * @classdesc The AlgoliaSearchHelper is a class that ease the management of the\n * search. It provides an event based interface for search callbacks:\n * - change: when the internal search state is changed.\n * This event contains a {@link SearchParameters} object and the\n * {@link SearchResults} of the last result if any.\n * - search: when a search is triggered using the `search()` method.\n * - result: when the response is retrieved from Algolia and is processed.\n * This event contains a {@link SearchResults} object and the\n * {@link SearchParameters} corresponding to this answer.\n * - error: when the response is an error. This event contains the error returned by the server.\n * @param {AlgoliaSearch} client an AlgoliaSearch client\n * @param {string} index the index name to query\n * @param {SearchParameters | object} options an object defining the initial\n * config of the search. It doesn't have to be a {SearchParameters},\n * just an object containing the properties you need from it.\n * @param {SearchResultsOptions|object} searchResultsOptions an object defining the options to use when creating the search results.\n */\nfunction AlgoliaSearchHelper(client, index, options, searchResultsOptions) {\n if (typeof client.addAlgoliaAgent === 'function') {\n client.addAlgoliaAgent('JS Helper (' + version + ')');\n }\n\n this.setClient(client);\n var opts = options || {};\n opts.index = index;\n this.state = SearchParameters.make(opts);\n this.recommendState = new RecommendParameters({\n params: opts.recommendState,\n });\n this.lastResults = null;\n this.lastRecommendResults = null;\n this._queryId = 0;\n this._recommendQueryId = 0;\n this._lastQueryIdReceived = -1;\n this._lastRecommendQueryIdReceived = -1;\n this.derivedHelpers = [];\n this._currentNbQueries = 0;\n this._currentNbRecommendQueries = 0;\n this._searchResultsOptions = searchResultsOptions;\n this._recommendCache = {};\n}\n\ninherits(AlgoliaSearchHelper, EventEmitter);\n\n/**\n * Start the search with the parameters set in the state. When the\n * method is called, it triggers a `search` event. The results will\n * be available through the `result` event. If an error occurs, an\n * `error` will be fired instead.\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires search\n * @fires result\n * @fires error\n * @chainable\n */\nAlgoliaSearchHelper.prototype.search = function () {\n this._search({ onlyWithDerivedHelpers: false });\n return this;\n};\n\nAlgoliaSearchHelper.prototype.searchOnlyWithDerivedHelpers = function () {\n this._search({ onlyWithDerivedHelpers: true });\n return this;\n};\n\nAlgoliaSearchHelper.prototype.searchWithComposition = function () {\n this._runComposition({ onlyWithDerivedHelpers: true });\n return this;\n};\n/**\n * Sends the recommendation queries set in the state. When the method is\n * called, it triggers a `fetch` event. The results will be available through\n * the `result` event. If an error occurs, an `error` will be fired instead.\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires fetch\n * @fires result\n * @fires error\n * @chainable\n */\nAlgoliaSearchHelper.prototype.recommend = function () {\n this._recommend();\n return this;\n};\n\n/**\n * Gets the search query parameters that would be sent to the Algolia Client\n * for the hits\n * @return {object} Query Parameters\n */\nAlgoliaSearchHelper.prototype.getQuery = function () {\n var state = this.state;\n return requestBuilder._getHitsSearchParams(state);\n};\n\n/**\n * Start a search using a modified version of the current state. This method does\n * not trigger the helper lifecycle and does not modify the state kept internally\n * by the helper. This second aspect means that the next search call will be the\n * same as a search call before calling searchOnce.\n * @param {object} options can contain all the parameters that can be set to SearchParameters\n * plus the index\n * @param {function} [cb] optional callback executed when the response from the\n * server is back.\n * @return {promise|undefined} if a callback is passed the method returns undefined\n * otherwise it returns a promise containing an object with two keys :\n * - content with a SearchResults\n * - state with the state used for the query as a SearchParameters\n * @example\n * // Changing the number of records returned per page to 1\n * // This example uses the callback API\n * var state = helper.searchOnce({hitsPerPage: 1},\n * function(error, content, state) {\n * // if an error occurred it will be passed in error, otherwise its value is null\n * // content contains the results formatted as a SearchResults\n * // state is the instance of SearchParameters used for this search\n * });\n * @example\n * // Changing the number of records returned per page to 1\n * // This example uses the promise API\n * var state1 = helper.searchOnce({hitsPerPage: 1})\n * .then(promiseHandler);\n *\n * function promiseHandler(res) {\n * // res contains\n * // {\n * // content : SearchResults\n * // state : SearchParameters (the one used for this specific search)\n * // }\n * }\n */\nAlgoliaSearchHelper.prototype.searchOnce = function (options, cb) {\n var tempState = !options\n ? this.state\n : this.state.setQueryParameters(options);\n var queries = requestBuilder._getQueries(tempState.index, tempState);\n // eslint-disable-next-line consistent-this\n var self = this;\n\n this._currentNbQueries++;\n\n this.emit('searchOnce', {\n state: tempState,\n });\n\n if (cb) {\n this.client\n .search(queries)\n .then(function (content) {\n self._currentNbQueries--;\n if (self._currentNbQueries === 0) {\n self.emit('searchQueueEmpty');\n }\n\n cb(null, new SearchResults(tempState, content.results), tempState);\n })\n .catch(function (err) {\n self._currentNbQueries--;\n if (self._currentNbQueries === 0) {\n self.emit('searchQueueEmpty');\n }\n\n cb(err, null, tempState);\n });\n\n return undefined;\n }\n\n return this.client.search(queries).then(\n function (content) {\n self._currentNbQueries--;\n if (self._currentNbQueries === 0) self.emit('searchQueueEmpty');\n return {\n content: new SearchResults(tempState, content.results),\n state: tempState,\n _originalResponse: content,\n };\n },\n function (e) {\n self._currentNbQueries--;\n if (self._currentNbQueries === 0) self.emit('searchQueueEmpty');\n throw e;\n }\n );\n};\n\n/**\n * Start the search for answers with the parameters set in the state.\n * This method returns a promise.\n * @param {Object} options - the options for answers API call\n * @param {string[]} options.attributesForPrediction - Attributes to use for predictions. If empty, `searchableAttributes` is used instead.\n * @param {string[]} options.queryLanguages - The languages in the query. Currently only supports ['en'].\n * @param {number} options.nbHits - Maximum number of answers to retrieve from the Answers Engine. Cannot be greater than 1000.\n *\n * @return {promise} the answer results\n * @deprecated answers is deprecated and will be replaced with new initiatives\n */\nAlgoliaSearchHelper.prototype.findAnswers = function (options) {\n // eslint-disable-next-line no-console\n console.warn('[algoliasearch-helper] answers is no longer supported');\n var state = this.state;\n var derivedHelper = this.derivedHelpers[0];\n if (!derivedHelper) {\n return Promise.resolve([]);\n }\n var derivedState = derivedHelper.getModifiedState(state);\n var data = merge(\n {\n attributesForPrediction: options.attributesForPrediction,\n nbHits: options.nbHits,\n },\n {\n params: omit(requestBuilder._getHitsSearchParams(derivedState), [\n 'attributesToSnippet',\n 'hitsPerPage',\n 'restrictSearchableAttributes',\n 'snippetEllipsisText',\n ]),\n }\n );\n\n var errorMessage =\n 'search for answers was called, but this client does not have a function client.initIndex(index).findAnswers';\n if (typeof this.client.initIndex !== 'function') {\n throw new Error(errorMessage);\n }\n var index = this.client.initIndex(derivedState.index);\n if (typeof index.findAnswers !== 'function') {\n throw new Error(errorMessage);\n }\n return index.findAnswers(derivedState.query, options.queryLanguages, data);\n};\n\n/**\n * Structure of each result when using\n * [`searchForFacetValues()`](reference.html#AlgoliaSearchHelper#searchForFacetValues)\n * @typedef FacetSearchHit\n * @type {object}\n * @property {string} value the facet value\n * @property {string} highlighted the facet value highlighted with the query string\n * @property {number} count number of occurrence of this facet value\n * @property {boolean} isRefined true if the value is already refined\n */\n\n/**\n * Structure of the data resolved by the\n * [`searchForFacetValues()`](reference.html#AlgoliaSearchHelper#searchForFacetValues)\n * promise.\n * @typedef FacetSearchResult\n * @type {object}\n * @property {FacetSearchHit} facetHits the results for this search for facet values\n * @property {number} processingTimeMS time taken by the query inside the engine\n */\n\n/**\n * Search for facet values based on an query and the name of a faceted attribute. This\n * triggers a search and will return a promise. On top of using the query, it also sends\n * the parameters from the state so that the search is narrowed down to only the possible values.\n *\n * See the description of [FacetSearchResult](reference.html#FacetSearchResult)\n * @param {string} facet the name of the faceted attribute\n * @param {string} query the string query for the search\n * @param {number} [maxFacetHits] the maximum number values returned. Should be > 0 and <= 100\n * @param {object} [userState] the set of custom parameters to use on top of the current state. Setting a property to `undefined` removes\n * it in the generated query.\n * @return {promise.<FacetSearchResult>} the results of the search\n */\nAlgoliaSearchHelper.prototype.searchForFacetValues = function (\n facet,\n query,\n maxFacetHits,\n userState\n) {\n var clientHasSFFV =\n typeof this.client.searchForFacetValues === 'function' &&\n // v5 has a wrong sffv signature\n typeof this.client.searchForFacets !== 'function';\n var clientHasInitIndex = typeof this.client.initIndex === 'function';\n if (\n !clientHasSFFV &&\n !clientHasInitIndex &&\n typeof this.client.search !== 'function'\n ) {\n throw new Error(\n 'search for facet values (searchable) was called, but this client does not have a function client.searchForFacetValues or client.initIndex(index).searchForFacetValues'\n );\n }\n\n var state = this.state.setQueryParameters(userState || {});\n var isDisjunctive = state.isDisjunctiveFacet(facet);\n var algoliaQuery = requestBuilder.getSearchForFacetQuery(\n facet,\n query,\n maxFacetHits,\n state\n );\n\n this._currentNbQueries++;\n // eslint-disable-next-line consistent-this\n var self = this;\n var searchForFacetValuesPromise;\n // newer algoliasearch ^3.27.1 - ~4.0.0\n if (clientHasSFFV) {\n searchForFacetValuesPromise = this.client.searchForFacetValues([\n { indexName: state.index, params: algoliaQuery },\n ]);\n // algoliasearch < 3.27.1\n } else if (clientHasInitIndex) {\n searchForFacetValuesPromise = this.client\n .initIndex(state.index)\n .searchForFacetValues(algoliaQuery);\n // algoliasearch ~5.0.0\n } else {\n // @MAJOR only use client.search\n delete algoliaQuery.facetName;\n searchForFacetValuesPromise = this.client\n .search([\n {\n type: 'facet',\n facet: facet,\n indexName: state.index,\n params: algoliaQuery,\n },\n ])\n .then(function processResponse(response) {\n return response.results[0];\n });\n }\n\n this.emit('searchForFacetValues', {\n state: state,\n facet: facet,\n query: query,\n });\n\n var hide =\n (this.lastResults &&\n this.lastResults.index === state.index &&\n this.lastResults.renderingContent &&\n this.lastResults.renderingContent.facetOrdering &&\n this.lastResults.renderingContent.facetOrdering.values &&\n this.lastResults.renderingContent.facetOrdering.values[facet] &&\n this.lastResults.renderingContent.facetOrdering.values[facet].hide) ||\n [];\n\n return searchForFacetValuesPromise.then(\n function addIsRefined(content) {\n self._currentNbQueries--;\n if (self._currentNbQueries === 0) self.emit('searchQueueEmpty');\n\n content = Array.isArray(content) ? content[0] : content;\n\n content.facetHits = content.facetHits.reduce(function (acc, f) {\n if (hide.indexOf(f.value) > -1) {\n return acc;\n }\n\n f.escapedValue = escapeFacetValue(f.value);\n f.isRefined = isDisjunctive\n ? state.isDisjunctiveFacetRefined(facet, f.escapedValue)\n : state.isFacetRefined(facet, f.escapedValue);\n\n acc.push(f);\n return acc;\n }, []);\n\n return content;\n },\n function (e) {\n self._currentNbQueries--;\n if (self._currentNbQueries === 0) self.emit('searchQueueEmpty');\n throw e;\n }\n );\n};\n\n/**\n * Search for facet values using the Composition API & based on a query and the name of a faceted attribute.\n * This triggers a search and will return a promise. On top of using the query, it also sends\n * the parameters from the state so that the search is narrowed down to only the possible values.\n *\n * See the description of [FacetSearchResult](reference.html#FacetSearchResult)\n * @param {string} facet the name of the faceted attribute\n * @param {string} query the string query for the search\n * @param {number} [maxFacetHits] the maximum number values returned. Should be > 0 and <= 100\n * @param {object} [userState] the set of custom parameters to use on top of the current state. Setting a property to `undefined` removes\n * it in the generated query.\n * @return {promise.<FacetSearchResult>} the results of the search\n */\nAlgoliaSearchHelper.prototype.searchForCompositionFacetValues = function (\n facet,\n query,\n maxFacetHits,\n userState\n) {\n if (typeof this.client.searchForFacetValues !== 'function') {\n throw new Error(\n 'search for facet values (searchable) was called, but this client does not have a function client.searchForFacetValues'\n );\n }\n\n var state = this.state.setQueryParameters(userState || {});\n var isDisjunctive = state.isDisjunctiveFacet(facet);\n\n this._currentNbQueries++;\n // eslint-disable-next-line consistent-this\n var self = this;\n var searchForFacetValuesPromise;\n\n searchForFacetValuesPromise = this.client.searchForFacetValues({\n compositionID: state.index,\n facetName: facet,\n searchForFacetValuesRequest: {\n params: {\n query: query,\n maxFacetHits: maxFacetHits,\n searchQuery: requestBuilder._getCompositionHitsSearchParams(state),\n },\n },\n });\n\n this.emit('searchForFacetValues', {\n state: state,\n facet: facet,\n query: query,\n });\n\n return searchForFacetValuesPromise.then(\n function addIsRefined(content) {\n self._currentNbQueries--;\n if (self._currentNbQueries === 0) self.emit('searchQueueEmpty');\n\n content = content.results[0];\n\n content.facetHits.forEach(function (f) {\n f.escapedValue = escapeFacetValue(f.value);\n f.isRefined = isDisjunctive\n ? state.isDisjunctiveFacetRefined(facet, f.escapedValue)\n : state.isFacetRefined(facet, f.escapedValue);\n });\n\n return content;\n },\n function (e) {\n self._currentNbQueries--;\n if (self._currentNbQueries === 0) self.emit('searchQueueEmpty');\n throw e;\n }\n );\n};\n\n/**\n * Sets the text query used for the search.\n *\n * This method resets the current page to 0.\n * @param {string} q the user query\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.setQuery = function (q) {\n this._change({\n state: this.state.resetPage().setQuery(q),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Remove all the types of refinements except tags. A string can be provided to remove\n * only the refinements of a specific attribute. For more advanced use case, you can\n * provide a function instead. This function should follow the\n * [clearCallback definition](#SearchParameters.clearCallback).\n *\n * This method resets the current page to 0.\n * @param {string} [name] optional name of the facet / attribute on which we want to remove all refinements\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n * @example\n * // Removing all the refinements\n * helper.clearRefinements().search();\n * @example\n * // Removing all the filters on a the category attribute.\n * helper.clearRefinements('category').search();\n * @example\n * // Removing only the exclude filters on the category facet.\n * helper.clearRefinements(function(value, attribute, type) {\n * return type === 'exclude' && attribute === 'category';\n * }).search();\n */\nAlgoliaSearchHelper.prototype.clearRefinements = function (name) {\n this._change({\n state: this.state.resetPage().clearRefinements(name),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Remove all the tag filters.\n *\n * This method resets the current page to 0.\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.clearTags = function () {\n this._change({\n state: this.state.resetPage().clearTags(),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Adds a disjunctive filter to a faceted attribute with the `value` provided. If the\n * filter is already set, it doesn't change the filters.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} value the associated value (will be converted to string)\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.addDisjunctiveFacetRefinement = function (\n facet,\n value\n) {\n this._change({\n state: this.state.resetPage().addDisjunctiveFacetRefinement(facet, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#addDisjunctiveFacetRefinement}\n */\nAlgoliaSearchHelper.prototype.addDisjunctiveRefine = function () {\n return this.addDisjunctiveFacetRefinement.apply(this, arguments);\n};\n\n/**\n * Adds a refinement on a hierarchical facet. It will throw\n * an exception if the facet is not defined or if the facet\n * is already refined.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet name\n * @param {string} path the hierarchical facet path\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @throws Error if the facet is not defined or if the facet is refined\n * @chainable\n * @fires change\n */\nAlgoliaSearchHelper.prototype.addHierarchicalFacetRefinement = function (\n facet,\n path\n) {\n this._change({\n state: this.state.resetPage().addHierarchicalFacetRefinement(facet, path),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Adds a an numeric filter to an attribute with the `operator` and `value` provided. If the\n * filter is already set, it doesn't change the filters.\n *\n * This method resets the current page to 0.\n * @param {string} attribute the attribute on which the numeric filter applies\n * @param {string} operator the operator of the filter\n * @param {number} value the value of the filter\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.addNumericRefinement = function (\n attribute,\n operator,\n value\n) {\n this._change({\n state: this.state\n .resetPage()\n .addNumericRefinement(attribute, operator, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Adds a filter to a faceted attribute with the `value` provided. If the\n * filter is already set, it doesn't change the filters.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} value the associated value (will be converted to string)\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.addFacetRefinement = function (facet, value) {\n this._change({\n state: this.state.resetPage().addFacetRefinement(facet, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#addFacetRefinement}\n */\nAlgoliaSearchHelper.prototype.addRefine = function () {\n return this.addFacetRefinement.apply(this, arguments);\n};\n\n/**\n * Adds a an exclusion filter to a faceted attribute with the `value` provided. If the\n * filter is already set, it doesn't change the filters.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} value the associated value (will be converted to string)\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.addFacetExclusion = function (facet, value) {\n this._change({\n state: this.state.resetPage().addExcludeRefinement(facet, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#addFacetExclusion}\n */\nAlgoliaSearchHelper.prototype.addExclude = function () {\n return this.addFacetExclusion.apply(this, arguments);\n};\n\n/**\n * Adds a tag filter with the `tag` provided. If the\n * filter is already set, it doesn't change the filters.\n *\n * This method resets the current page to 0.\n * @param {string} tag the tag to add to the filter\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.addTag = function (tag) {\n this._change({\n state: this.state.resetPage().addTagRefinement(tag),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Adds a \"frequently bought together\" recommendation query.\n *\n * @param {FrequentlyBoughtTogetherQuery} params the parameters for the recommendation\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.addFrequentlyBoughtTogether = function (params) {\n this._recommendChange({\n state: this.recommendState.addFrequentlyBoughtTogether(params),\n });\n\n return this;\n};\n\n/**\n * Adds a \"related products\" recommendation query.\n *\n * @param {RelatedProductsQuery} params the parameters for the recommendation\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.addRelatedProducts = function (params) {\n this._recommendChange({\n state: this.recommendState.addRelatedProducts(params),\n });\n\n return this;\n};\n\n/**\n * Adds a \"trending items\" recommendation query.\n *\n * @param {TrendingItemsQuery} params the parameters for the recommendation\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.addTrendingItems = function (params) {\n this._recommendChange({\n state: this.recommendState.addTrendingItems(params),\n });\n\n return this;\n};\n\n/**\n * Adds a \"trending facets\" recommendation query.\n *\n * @param {TrendingFacetsQuery} params the parameters for the recommendation\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.addTrendingFacets = function (params) {\n this._recommendChange({\n state: this.recommendState.addTrendingFacets(params),\n });\n\n return this;\n};\n\n/**\n * Adds a \"looking similar\" recommendation query.\n *\n * @param {LookingSimilarQuery} params the parameters for the recommendation\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.addLookingSimilar = function (params) {\n this._recommendChange({\n state: this.recommendState.addLookingSimilar(params),\n });\n\n return this;\n};\n\n/**\n * Removes an numeric filter to an attribute with the `operator` and `value` provided. If the\n * filter is not set, it doesn't change the filters.\n *\n * Some parameters are optional, triggering different behavior:\n * - if the value is not provided, then all the numeric value will be removed for the\n * specified attribute/operator couple.\n * - if the operator is not provided either, then all the numeric filter on this attribute\n * will be removed.\n *\n * This method resets the current page to 0.\n * @param {string} attribute the attribute on which the numeric filter applies\n * @param {string} [operator] the operator of the filter\n * @param {number} [value] the value of the filter\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeNumericRefinement = function (\n attribute,\n operator,\n value\n) {\n this._change({\n state: this.state\n .resetPage()\n .removeNumericRefinement(attribute, operator, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Removes a disjunctive filter to a faceted attribute with the `value` provided. If the\n * filter is not set, it doesn't change the filters.\n *\n * If the value is omitted, then this method will remove all the filters for the\n * attribute.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} [value] the associated value\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeDisjunctiveFacetRefinement = function (\n facet,\n value\n) {\n this._change({\n state: this.state\n .resetPage()\n .removeDisjunctiveFacetRefinement(facet, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#removeDisjunctiveFacetRefinement}\n */\nAlgoliaSearchHelper.prototype.removeDisjunctiveRefine = function () {\n return this.removeDisjunctiveFacetRefinement.apply(this, arguments);\n};\n\n/**\n * Removes the refinement set on a hierarchical facet.\n * @param {string} facet the facet name\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @throws Error if the facet is not defined or if the facet is not refined\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeHierarchicalFacetRefinement = function (\n facet\n) {\n this._change({\n state: this.state.resetPage().removeHierarchicalFacetRefinement(facet),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Removes a filter to a faceted attribute with the `value` provided. If the\n * filter is not set, it doesn't change the filters.\n *\n * If the value is omitted, then this method will remove all the filters for the\n * attribute.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} [value] the associated value\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeFacetRefinement = function (facet, value) {\n this._change({\n state: this.state.resetPage().removeFacetRefinement(facet, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#removeFacetRefinement}\n */\nAlgoliaSearchHelper.prototype.removeRefine = function () {\n return this.removeFacetRefinement.apply(this, arguments);\n};\n\n/**\n * Removes an exclusion filter to a faceted attribute with the `value` provided. If the\n * filter is not set, it doesn't change the filters.\n *\n * If the value is omitted, then this method will remove all the filters for the\n * attribute.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} [value] the associated value\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeFacetExclusion = function (facet, value) {\n this._change({\n state: this.state.resetPage().removeExcludeRefinement(facet, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#removeFacetExclusion}\n */\nAlgoliaSearchHelper.prototype.removeExclude = function () {\n return this.removeFacetExclusion.apply(this, arguments);\n};\n\n/**\n * Removes a tag filter with the `tag` provided. If the\n * filter is not set, it doesn't change the filters.\n *\n * This method resets the current page to 0.\n * @param {string} tag tag to remove from the filter\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeTag = function (tag) {\n this._change({\n state: this.state.resetPage().removeTagRefinement(tag),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Removes a \"frequently bought together\" recommendation query.\n *\n * @param {number} id identifier of the recommendation widget\n * @returns {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeFrequentlyBoughtTogether = function (id) {\n this._recommendChange({\n state: this.recommendState.removeParams(id),\n });\n\n return this;\n};\n\n/**\n * Removes a \"related products\" recommendation query.\n *\n * @param {number} id identifier of the recommendation widget\n * @returns {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeRelatedProducts = function (id) {\n this._recommendChange({\n state: this.recommendState.removeParams(id),\n });\n\n return this;\n};\n\n/**\n * Removes a \"trending items\" recommendation query.\n *\n * @param {number} id identifier of the recommendation widget\n * @returns {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeTrendingItems = function (id) {\n this._recommendChange({\n state: this.recommendState.removeParams(id),\n });\n\n return this;\n};\n\n/**\n * Removes a \"trending facets\" recommendation query.\n *\n * @param {number} id identifier of the recommendation widget\n * @returns {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeTrendingFacets = function (id) {\n this._recommendChange({\n state: this.recommendState.removeParams(id),\n });\n\n return this;\n};\n\n/**\n * Removes a \"looking similar\" recommendation query.\n *\n * @param {number} id identifier of the recommendation widget\n * @returns {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.removeLookingSimilar = function (id) {\n this._recommendChange({\n state: this.recommendState.removeParams(id),\n });\n\n return this;\n};\n\n/**\n * Adds or removes an exclusion filter to a faceted attribute with the `value` provided. If\n * the value is set then it removes it, otherwise it adds the filter.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} value the associated value\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.toggleFacetExclusion = function (facet, value) {\n this._change({\n state: this.state.resetPage().toggleExcludeFacetRefinement(facet, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#toggleFacetExclusion}\n */\nAlgoliaSearchHelper.prototype.toggleExclude = function () {\n return this.toggleFacetExclusion.apply(this, arguments);\n};\n\n/**\n * Adds or removes a filter to a faceted attribute with the `value` provided. If\n * the value is set then it removes it, otherwise it adds the filter.\n *\n * This method can be used for conjunctive, disjunctive and hierarchical filters.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} value the associated value\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @throws Error will throw an error if the facet is not declared in the settings of the helper\n * @fires change\n * @chainable\n * @deprecated since version 2.19.0, see {@link AlgoliaSearchHelper#toggleFacetRefinement}\n */\nAlgoliaSearchHelper.prototype.toggleRefinement = function (facet, value) {\n return this.toggleFacetRefinement(facet, value);\n};\n\n/**\n * Adds or removes a filter to a faceted attribute with the `value` provided. If\n * the value is set then it removes it, otherwise it adds the filter.\n *\n * This method can be used for conjunctive, disjunctive and hierarchical filters.\n *\n * This method resets the current page to 0.\n * @param {string} facet the facet to refine\n * @param {string} value the associated value\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @throws Error will throw an error if the facet is not declared in the settings of the helper\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.toggleFacetRefinement = function (facet, value) {\n this._change({\n state: this.state.resetPage().toggleFacetRefinement(facet, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since version 2.4.0, see {@link AlgoliaSearchHelper#toggleFacetRefinement}\n */\nAlgoliaSearchHelper.prototype.toggleRefine = function () {\n return this.toggleFacetRefinement.apply(this, arguments);\n};\n\n/**\n * Adds or removes a tag filter with the `value` provided. If\n * the value is set then it removes it, otherwise it adds the filter.\n *\n * This method resets the current page to 0.\n * @param {string} tag tag to remove or add\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.toggleTag = function (tag) {\n this._change({\n state: this.state.resetPage().toggleTagRefinement(tag),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Increments the page number by one.\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n * @example\n * helper.setPage(0).nextPage().getPage();\n * // returns 1\n */\nAlgoliaSearchHelper.prototype.nextPage = function () {\n var page = this.state.page || 0;\n return this.setPage(page + 1);\n};\n\n/**\n * Decrements the page number by one.\n * @fires change\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @chainable\n * @example\n * helper.setPage(1).previousPage().getPage();\n * // returns 0\n */\nAlgoliaSearchHelper.prototype.previousPage = function () {\n var page = this.state.page || 0;\n return this.setPage(page - 1);\n};\n\n/**\n * @private\n * @param {number} page The page number\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @chainable\n * @fires change\n */\nfunction setCurrentPage(page) {\n if (page < 0) throw new Error('Page requested below 0.');\n\n this._change({\n state: this.state.setPage(page),\n isPageReset: false,\n });\n\n return this;\n}\n\n/**\n * Change the current page\n * @deprecated\n * @param {number} page The page number\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.setCurrentPage = setCurrentPage;\n\n/**\n * Updates the current page.\n * @function\n * @param {number} page The page number\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.setPage = setCurrentPage;\n\n/**\n * Updates the name of the index that will be targeted by the query.\n *\n * This method resets the current page to 0.\n * @param {string} name the index name\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.setIndex = function (name) {\n this._change({\n state: this.state.resetPage().setIndex(name),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Update a parameter of the search. This method reset the page\n *\n * The complete list of parameters is available on the\n * [Algolia website](https://www.algolia.com/doc/rest#query-an-index).\n * The most commonly used parameters have their own [shortcuts](#query-parameters-shortcuts)\n * or benefit from higher-level APIs (all the kind of filters and facets have their own API)\n *\n * This method resets the current page to 0.\n * @param {string} parameter name of the parameter to update\n * @param {any} value new value of the parameter\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n * @example\n * helper.setQueryParameter('hitsPerPage', 20).search();\n */\nAlgoliaSearchHelper.prototype.setQueryParameter = function (parameter, value) {\n this._change({\n state: this.state.resetPage().setQueryParameter(parameter, value),\n isPageReset: true,\n });\n\n return this;\n};\n\n/**\n * Set the whole state (warning: will erase previous state)\n * @param {SearchParameters} newState the whole new state\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @fires change\n * @chainable\n */\nAlgoliaSearchHelper.prototype.setState = function (newState) {\n this._change({\n state: SearchParameters.make(newState),\n isPageReset: false,\n });\n\n return this;\n};\n\n/**\n * Override the current state without triggering a change event.\n * Do not use this method unless you know what you are doing. (see the example\n * for a legit use case)\n * @param {SearchParameters} newState the whole new state\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n * @example\n * helper.on('change', function(state){\n * // In this function you might want to find a way to store the state in the url/history\n * updateYourURL(state)\n * })\n * window.onpopstate = function(event){\n * // This is naive though as you should check if the state is really defined etc.\n * helper.overrideStateWithoutTriggeringChangeEvent(event.state).search()\n * }\n * @chainable\n */\nAlgoliaSearchHelper.prototype.overrideStateWithoutTriggeringChangeEvent =\n function (newState) {\n this.state = new SearchParameters(newState);\n return this;\n };\n\n/**\n * Check if an attribute has any numeric, conjunctive, disjunctive or hierarchical filters.\n * @param {string} attribute the name of the attribute\n * @return {boolean} true if the attribute is filtered by at least one value\n * @example\n * // hasRefinements works with numeric, conjunctive, disjunctive and hierarchical filters\n * helper.hasRefinements('price'); // false\n * helper.addNumericRefinement('price', '>', 100);\n * helper.hasRefinements('price'); // true\n *\n * helper.hasRefinements('color'); // false\n * helper.addFacetRefinement('color', 'blue');\n * helper.hasRefinements('color'); // true\n *\n * helper.hasRefinements('material'); // false\n * helper.addDisjunctiveFacetRefinement('material', 'plastic');\n * helper.hasRefinements('material'); // true\n *\n * helper.hasRefinements('categories'); // false\n * helper.toggleFacetRefinement('categories', 'kitchen > knife');\n * helper.hasRefinements('categories'); // true\n *\n */\nAlgoliaSearchHelper.prototype.hasRefinements = function (attribute) {\n if (objectHasKeys(this.state.getNumericRefinements(attribute))) {\n return true;\n } else if (this.state.isConjunctiveFacet(attribute)) {\n return this.state.isFacetRefined(attribute);\n } else if (this.state.isDisjunctiveFacet(attribute)) {\n return this.state.isDisjunctiveFacetRefined(attribute);\n } else if (this.state.isHierarchicalFacet(attribute)) {\n return this.state.isHierarchicalFacetRefined(attribute);\n }\n\n // there's currently no way to know that the user did call `addNumericRefinement` at some point\n // thus we cannot distinguish if there once was a numeric refinement that was cleared\n // so we will return false in every other situations to be consistent\n // while what we should do here is throw because we did not find the attribute in any type\n // of refinement\n return false;\n};\n\n/**\n * Check if a value is excluded for a specific faceted attribute. If the value\n * is omitted then the function checks if there is any excluding refinements.\n *\n * @param {string} facet name of the attribute for used for faceting\n * @param {string} [value] optional value. If passed will test that this value\n * is filtering the given facet.\n * @return {boolean} true if refined\n * @example\n * helper.isExcludeRefined('color'); // false\n * helper.isExcludeRefined('color', 'blue') // false\n * helper.isExcludeRefined('color', 'red') // false\n *\n * helper.addFacetExclusion('color', 'red');\n *\n * helper.isExcludeRefined('color'); // true\n * helper.isExcludeRefined('color', 'blue') // false\n * helper.isExcludeRefined('color', 'red') // true\n */\nAlgoliaSearchHelper.prototype.isExcluded = function (facet, value) {\n return this.state.isExcludeRefined(facet, value);\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since 2.4.0, see {@link AlgoliaSearchHelper#hasRefinements}\n */\nAlgoliaSearchHelper.prototype.isDisjunctiveRefined = function (facet, value) {\n return this.state.isDisjunctiveFacetRefined(facet, value);\n};\n\n/**\n * Check if the string is a currently filtering tag.\n * @param {string} tag tag to check\n * @return {boolean} true if the tag is currently refined\n */\nAlgoliaSearchHelper.prototype.hasTag = function (tag) {\n return this.state.isTagRefined(tag);\n};\n\n// eslint-disable-next-line valid-jsdoc\n/**\n * @deprecated since 2.4.0, see {@link AlgoliaSearchHelper#hasTag}\n */\nAlgoliaSearchHelper.prototype.isTagRefined = function () {\n return this.hasTagRefinements.apply(this, arguments);\n};\n\n/**\n * Get the name of the currently used index.\n * @return {string} name of the index\n * @example\n * helper.setIndex('highestPrice_products').getIndex();\n * // returns 'highestPrice_products'\n */\nAlgoliaSearchHelper.prototype.getIndex = function () {\n return this.state.index;\n};\n\nfunction getCurrentPage() {\n return this.state.page;\n}\n\n/**\n * Get the currently selected page\n * @deprecated\n * @return {number} the current page\n */\nAlgoliaSearchHelper.prototype.getCurrentPage = getCurrentPage;\n/**\n * Get the currently selected page\n * @function\n * @return {number} the current page\n */\nAlgoliaSearchHelper.prototype.getPage = getCurrentPage;\n\n/**\n * Get all the tags currently set to filters the results.\n *\n * @return {string[]} The list of tags currently set.\n */\nAlgoliaSearchHelper.prototype.getTags = function () {\n return this.state.tagRefinements;\n};\n\n/**\n * Get the list of refinements for a given attribute. This method works with\n * conjunctive, disjunctive, excluding and numerical filters.\n *\n * See also SearchResults#getRefinements\n *\n * @param {string} facetName attribute name used for faceting\n * @return {Array.<FacetRefinement|NumericRefinement>} All Refinement are objects that contain a value, and\n * a type. Numeric also contains an operator.\n * @example\n * helper.addNumericRefinement('price', '>', 100);\n * helper.getRefinements('price');\n * // [\n * // {\n * // \"value\": [\n * // 100\n * // ],\n * // \"operator\": \">\",\n * // \"type\": \"numeric\"\n * // }\n * // ]\n * @example\n * helper.addFacetRefinement('color', 'blue');\n * helper.addFacetExclusion('color', 'red');\n * helper.getRefinements('color');\n * // [\n * // {\n * // \"value\": \"blue\",\n * // \"type\": \"conjunctive\"\n * // },\n * // {\n * // \"value\": \"red\",\n * // \"type\": \"exclude\"\n * // }\n * // ]\n * @example\n * helper.addDisjunctiveFacetRefinement('material', 'plastic');\n * // [\n * // {\n * // \"value\": \"plastic\",\n * // \"type\": \"disjunctive\"\n * // }\n * // ]\n */\nAlgoliaSearchHelper.prototype.getRefinements = function (facetName) {\n var refinements = [];\n\n if (this.state.isConjunctiveFacet(facetName)) {\n var conjRefinements = this.state.getConjunctiveRefinements(facetName);\n\n conjRefinements.forEach(function (r) {\n refinements.push({\n value: r,\n type: 'conjunctive',\n });\n });\n\n var excludeRefinements = this.state.getExcludeRefinements(facetName);\n\n excludeRefinements.forEach(function (r) {\n refinements.push({\n value: r,\n type: 'exclude',\n });\n });\n } else if (this.state.isDisjunctiveFacet(facetName)) {\n var disjunctiveRefinements =\n this.state.getDisjunctiveRefinements(facetName);\n\n disjunctiveRefinements.forEach(function (r) {\n refinements.push({\n value: r,\n type: 'disjunctive',\n });\n });\n }\n\n var numericRefinements = this.state.getNumericRefinements(facetName);\n\n Object.keys(numericRefinements).forEach(function (operator) {\n var value = numericRefinements[operator];\n\n refinements.push({\n value: value,\n operator: operator,\n type: 'numeric',\n });\n });\n\n return refinements;\n};\n\n/**\n * Return the current refinement for the (attribute, operator)\n * @param {string} attribute attribute in the record\n * @param {string} operator operator applied on the refined values\n * @return {Array.<number|number[]>} refined values\n */\nAlgoliaSearchHelper.prototype.getNumericRefinement = function (\n attribute,\n operator\n) {\n return this.state.getNumericRefinement(attribute, operator);\n};\n\n/**\n * Get the current breadcrumb for a hierarchical facet, as an array\n * @param {string} facetName Hierarchical facet name\n * @return {array.<string>} the path as an array of string\n */\nAlgoliaSearchHelper.prototype.getHierarchicalFacetBreadcrumb = function (\n facetName\n) {\n return this.state.getHierarchicalFacetBreadcrumb(facetName);\n};\n\n// /////////// PRIVATE\n\n/**\n * Perform the underlying queries\n * @private\n * @param {object} options options for the query\n * @param {boolean} [options.onlyWithDerivedHelpers=false] if true, only the derived helpers will be queried\n * @return {undefined} does not return anything\n * @fires search\n * @fires result\n * @fires error\n */\nAlgoliaSearchHelper.prototype._search = function (options) {\n var state = this.state;\n var states = [];\n var mainQueries = [];\n\n if (!options.onlyWithDerivedHelpers) {\n mainQueries = requestBuilder._getQueries(state.index, state);\n\n states.push({\n state: state,\n queriesCount: mainQueries.length,\n helper: this,\n });\n\n this.emit('search', {\n state: state,\n results: this.lastResults,\n });\n }\n\n var derivedQueries = this.derivedHelpers.map(function (derivedHelper) {\n var derivedState = derivedHelper.getModifiedState(state);\n var derivedStateQueries = derivedState.index\n ? requestBuilder._getQueries(derivedState.index, derivedState)\n : [];\n\n states.push({\n state: derivedState,\n queriesCount: derivedStateQueries.length,\n helper: derivedHelper,\n });\n\n derivedHelper.emit('search', {\n state: derivedState,\n results: derivedHelper.lastResults,\n });\n\n return derivedStateQueries;\n });\n\n var queries = Array.prototype.concat.apply(mainQueries, derivedQueries);\n\n var queryId = this._queryId++;\n this._currentNbQueries++;\n\n if (!queries.length) {\n return Promise.resolve({ results: [] }).then(\n this._dispatchAlgoliaResponse.bind(this, states, queryId)\n );\n }\n\n try {\n this.client\n .search(queries)\n .then(this._dispatchAlgoliaResponse.bind(this, states, queryId))\n .catch(this._dispatchAlgoliaError.bind(this, queryId));\n } catch (error) {\n // If we reach this part, we're in an internal error state\n this.emit('error', {\n error: error,\n });\n }\n\n return undefined;\n};\n\n/**\n * Perform the underlying queries\n * @private\n * @param {boolean} [options.onlyWithDerivedHelpers=false] if true, only the derived helpers will be queried\n * @return {undefined} does not return anything\n * @fires search\n * @fires result\n * @fires error\n */\nAlgoliaSearchHelper.prototype._runComposition = function () {\n var state = this.state;\n var states = [];\n var mainQueries = [];\n\n var derivedQueries = this.derivedHelpers.map(function (derivedHelper) {\n var derivedState = derivedHelper.getModifiedState(state);\n var derivedStateQueries =\n requestBuilder._getCompositionQueries(derivedState);\n\n states.push({\n state: derivedState,\n helper: derivedHelper,\n });\n\n derivedHelper.emit('search', {\n state: derivedState,\n results: derivedHelper.lastResults,\n });\n\n return derivedStateQueries;\n });\n\n var queries = Array.prototype.concat.apply(mainQueries, derivedQueries);\n\n var queryId = this._queryId++;\n this._currentNbQueries++;\n\n if (!queries.length) {\n return Promise.resolve({ results: [] }).then(\n this._dispatchAlgoliaResponse.bind(this, states, queryId)\n );\n }\n\n if (queries.length > 1) {\n throw new Error('Only one query is allowed when using a composition.');\n }\n\n var query = queries[0];\n\n try {\n this.client\n .search(query)\n .then(this._dispatchAlgoliaResponse.bind(this, states, queryId))\n .catch(this._dispatchAlgoliaError.bind(this, queryId));\n } catch (error) {\n // If we reach this part, we're in an internal error state\n this.emit('error', {\n error: error,\n });\n }\n\n return undefined;\n};\n\nAlgoliaSearchHelper.prototype._recommend = function () {\n var searchState = this.state;\n var recommendState = this.recommendState;\n var index = this.getIndex();\n var states = [{ state: recommendState, index: index, helper: this }];\n var ids = recommendState.params.map(function (param) {\n return param.$$id;\n });\n\n this.emit('fetch', {\n recommend: {\n state: recommendState,\n results: this.lastRecommendResults,\n },\n });\n\n var cache = this._recommendCache;\n\n var derivedQueries = this.derivedHelpers.map(function (derivedHelper) {\n var derivedIndex = derivedHelper.getModifiedState(searchState).index;\n if (!derivedIndex) {\n return [];\n }\n\n // Contrary to what is done when deriving the search state, we don't want to\n // provide the current recommend state to the derived helper, as it would\n // inherit unwanted queries. We instead provide an empty recommend state.\n var derivedState = derivedHelper.getModifiedRecommendState(\n new RecommendParameters()\n );\n states.push({\n state: derivedState,\n index: derivedIndex,\n helper: derivedHelper,\n });\n\n ids = Array.prototype.concat.apply(\n ids,\n derivedState.params.map(function (param) {\n return param.$$id;\n })\n );\n\n derivedHelper.emit('fetch', {\n recommend: {\n state: derivedState,\n results: derivedHelper.lastRecommendResults,\n },\n });\n\n return derivedState._buildQueries(derivedIndex, cache);\n });\n\n var queries = Array.prototype.concat.apply(\n this.recommendState._buildQueries(index, cache),\n derivedQueries\n );\n\n if (queries.length === 0) {\n return;\n }\n\n if (\n queries.length > 0 &&\n typeof this.client.getRecommendations === 'undefined'\n ) {\n // eslint-disable-next-line no-console\n console.warn(\n 'Please update algoliasearch/lite to the latest version in order to use recommend widgets.'\n );\n return;\n }\n\n var queryId = this._recommendQueryId++;\n this._currentNbRecommendQueries++;\n\n try {\n this.client\n .getRecommendations(queries)\n .then(this._dispatchRecommendResponse.bind(this, queryId, states, ids))\n .catch(this._dispatchRecommendError.bind(this, queryId));\n } catch (error) {\n // If we reach this part, we're in an internal error state\n this.emit('error', {\n error: error,\n });\n }\n\n return;\n};\n\n/**\n * Transform the responses as sent by the server and transform them into a user\n * usable object that merge the results of all the batch requests. It will dispatch\n * over the different helper + derived helpers (when there are some).\n * @private\n * @param {array.<{SearchParameters, AlgoliaQueries, AlgoliaSearchHelper}>} states state used to generate the request\n * @param {number} queryId id of the current request\n * @param {object} content content of the response\n * @return {undefined}\n */\nAlgoliaSearchHelper.prototype._dispatchAlgoliaResponse = function (\n states,\n queryId,\n content\n) {\n // eslint-disable-next-line consistent-this\n var self = this;\n\n // @TODO remove the number of outdated queries discarded instead of just one\n\n if (queryId < this._lastQueryIdReceived) {\n // Outdated answer\n return;\n }\n\n this._currentNbQueries -= queryId - this._lastQueryIdReceived;\n this._lastQueryIdReceived = queryId;\n\n if (this._currentNbQueries === 0) this.emit('searchQueueEmpty');\n\n var results = content.results.slice();\n var rawContent = Object.keys(content).reduce(function (value, key) {\n if (key !== 'results') value[key] = content[key];\n return value;\n }, {});\n\n if (Object.keys(rawContent).length <= 0) {\n rawContent = undefined;\n }\n\n states.forEach(function (s) {\n var state = s.state;\n var queriesCount = s.queriesCount;\n var helper = s.helper;\n var specificResults =\n queriesCount !== undefined ? results.splice(0, queriesCount) : results;\n\n if (!state.index) {\n helper.emit('result', {\n results: null,\n state: state,\n });\n return;\n }\n\n // Multifeed composition: build ordered SearchResults array on lastResults\n if (specificResults.length > 0 && specificResults[0].feedID) {\n var feeds = specificResults.map(function (r) {\n var sr = new SearchResults(state, [r], self._searchResultsOptions);\n if (rawContent !== undefined) sr._rawContent = rawContent;\n return sr;\n });\n helper.lastResults = new SearchResults(\n state,\n [specificResults[0]],\n self._searchResultsOptions\n );\n helper.lastResults.feeds = feeds;\n if (rawContent !== undefined) helper.lastResults._rawContent = rawContent;\n } else {\n helper.lastResults = new SearchResults(\n state,\n specificResults,\n self._searchResultsOptions\n );\n if (rawContent !== undefined) helper.lastResults._rawContent = rawContent;\n }\n\n helper.emit('result', {\n results: helper.lastResults,\n state: state,\n });\n });\n};\n\nAlgoliaSearchHelper.prototype._dispatchRecommendResponse = function (\n queryId,\n states,\n ids,\n content\n) {\n // @TODO remove the number of outdated queries discarded instead of just one\n\n if (queryId < this._lastRecommendQueryIdReceived) {\n // Outdated answer\n return;\n }\n\n this._currentNbRecommendQueries -=\n queryId - this._lastRecommendQueryIdReceived;\n this._lastRecommendQueryIdReceived = queryId;\n\n if (this._currentNbRecommendQueries === 0) this.emit('recommendQueueEmpty');\n\n var cache = this._recommendCache;\n\n var idsMap = {};\n ids\n .filter(function (id) {\n return cache[id] === undefined;\n })\n .forEach(function (id, index) {\n if (!idsMap[id]) idsMap[id] = [];\n\n idsMap[id].push(index);\n });\n\n Object.keys(idsMap).forEach(function (id) {\n var indices = idsMap[id];\n var firstResult = content.results[indices[0]];\n if (indices.length === 1) {\n cache[id] = firstResult;\n return;\n }\n cache[id] = Object.assign({}, firstResult, {\n hits: sortAndMergeRecommendations(\n ids,\n indices.map(function (idx) {\n return content.results[idx].hits;\n })\n ),\n });\n });\n\n var results = {};\n ids.forEach(function (id) {\n results[id] = cache[id];\n });\n\n states.forEach(function (s) {\n var state = s.state;\n var helper = s.helper;\n\n if (!s.index) {\n // eslint-disable-next-line no-warning-comments\n // TODO: emit \"result\" event when events for Recommend are implemented\n helper.emit('recommend:result', {\n results: null,\n state: state,\n });\n return;\n }\n\n helper.lastRecommendResults = new RecommendResults(state, results);\n\n // eslint-disable-next-line no-warning-comments\n // TODO: emit \"result\" event when events for Recommend are implemented\n helper.emit('recommend:result', {\n recommend: {\n results: helper.lastRecommendResults,\n state: state,\n },\n });\n });\n};\n\nAlgoliaSearchHelper.prototype._dispatchAlgoliaError = function (\n queryId,\n error\n) {\n if (queryId < this._lastQueryIdReceived) {\n // Outdated answer\n return;\n }\n\n this._currentNbQueries -= queryId - this._lastQueryIdReceived;\n this._lastQueryIdReceived = queryId;\n\n this.emit('error', {\n error: error,\n });\n\n if (this._currentNbQueries === 0) this.emit('searchQueueEmpty');\n};\n\nAlgoliaSearchHelper.prototype._dispatchRecommendError = function (\n queryId,\n error\n) {\n if (queryId < this._lastRecommendQueryIdReceived) {\n // Outdated answer\n return;\n }\n\n this._currentNbRecommendQueries -=\n queryId - this._lastRecommendQueryIdReceived;\n this._lastRecommendQueryIdReceived = queryId;\n\n this.emit('error', {\n error: error,\n });\n\n if (this._currentNbRecommendQueries === 0) this.emit('recommendQueueEmpty');\n};\n\nAlgoliaSearchHelper.prototype.containsRefinement = function (\n query,\n facetFilters,\n numericFilters,\n tagFilters\n) {\n return (\n query ||\n facetFilters.length !== 0 ||\n numericFilters.length !== 0 ||\n tagFilters.length !== 0\n );\n};\n\n/**\n * Test if there are some disjunctive refinements on the facet\n * @private\n * @param {string} facet the attribute to test\n * @return {boolean} true if there are refinements on this attribute\n */\nAlgoliaSearchHelper.prototype._hasDisjunctiveRefinements = function (facet) {\n return (\n this.state.disjunctiveRefinements[facet] &&\n this.state.disjunctiveRefinements[facet].length > 0\n );\n};\n\nAlgoliaSearchHelper.prototype._change = function (event) {\n var state = event.state;\n var isPageReset = event.isPageReset;\n\n if (state !== this.state) {\n this.state = state;\n\n this.emit('change', {\n state: this.state,\n results: this.lastResults,\n isPageReset: isPageReset,\n });\n }\n};\n\nAlgoliaSearchHelper.prototype._recommendChange = function (event) {\n var state = event.state;\n\n if (state !== this.recommendState) {\n this.recommendState = state;\n\n // eslint-disable-next-line no-warning-comments\n // TODO: emit \"change\" event when events for Recommend are implemented\n this.emit('recommend:change', {\n search: {\n results: this.lastResults,\n state: this.state,\n },\n recommend: {\n results: this.lastRecommendResults,\n state: this.recommendState,\n },\n });\n }\n};\n\n/**\n * Clears the cache of the underlying Algolia client.\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n */\nAlgoliaSearchHelper.prototype.clearCache = function () {\n if (this.client.clearCache) this.client.clearCache();\n return this;\n};\n\n/**\n * Updates the internal client instance. If the reference of the clients\n * are equal then no update is actually done.\n * @param {AlgoliaSearch} newClient an AlgoliaSearch client\n * @return {AlgoliaSearchHelper} Method is chainable, it returns itself\n */\nAlgoliaSearchHelper.prototype.setClient = function (newClient) {\n if (this.client === newClient) return this;\n\n if (typeof newClient.addAlgoliaAgent === 'function') {\n newClient.addAlgoliaAgent('JS Helper (' + version + ')');\n }\n this.client = newClient;\n\n return this;\n};\n\n/**\n * Gets the instance of the currently used client.\n * @return {AlgoliaSearch} the currently used client\n */\nAlgoliaSearchHelper.prototype.getClient = function () {\n return this.client;\n};\n\n/**\n * Creates an derived instance of the Helper. A derived helper\n * is a way to request other indices synchronised with the lifecycle\n * of the main Helper. This mechanism uses the multiqueries feature\n * of Algolia to aggregate all the requests in a single network call.\n *\n * This method takes a function that is used to create a new SearchParameter\n * that will be used to create requests to Algolia. Those new requests\n * are created just before the `search` event. The signature of the function\n * is `SearchParameters -> SearchParameters`.\n *\n * This method returns a new DerivedHelper which is an EventEmitter\n * that fires the same `search`, `result` and `error` events. Those\n * events, however, will receive data specific to this DerivedHelper\n * and the SearchParameters that is returned by the call of the\n * parameter function.\n * @param {function} fn SearchParameters -> SearchParameters\n * @param {function} recommendFn RecommendParameters -> RecommendParameters\n * @return {DerivedHelper} a new DerivedHelper\n */\nAlgoliaSearchHelper.prototype.derive = function (fn, recommendFn) {\n var derivedHelper = new DerivedHelper(this, fn, recommendFn);\n this.derivedHelpers.push(derivedHelper);\n return derivedHelper;\n};\n\n/**\n * This method detaches a derived Helper from the main one. Prefer using the one from the\n * derived helper itself, to remove the event listeners too.\n * @private\n * @param {DerivedHelper} derivedHelper the derived helper to detach\n * @return {undefined} nothing is returned\n * @throws Error\n */\nAlgoliaSearchHelper.prototype.detachDerivedHelper = function (derivedHelper) {\n var pos = this.derivedHelpers.indexOf(derivedHelper);\n if (pos === -1) throw new Error('Derived helper already detached');\n this.derivedHelpers.splice(pos, 1);\n};\n\n/**\n * This method returns true if there is currently at least one on-going search.\n * @return {boolean} true if there is a search pending\n */\nAlgoliaSearchHelper.prototype.hasPendingRequests = function () {\n return this._currentNbQueries > 0;\n};\n\n/**\n * @typedef AlgoliaSearchHelper.NumericRefinement\n * @type {object}\n * @property {number[]} value the numbers that are used for filtering this attribute with\n * the operator specified.\n * @property {string} operator the faceting data: value, number of entries\n * @property {string} type will be 'numeric'\n */\n\n/**\n * @typedef AlgoliaSearchHelper.FacetRefinement\n * @type {object}\n * @property {string} value the string use to filter the attribute\n * @property {string} type the type of filter: 'conjunctive', 'disjunctive', 'exclude'\n */\n\nmodule.exports = AlgoliaSearchHelper;\n"],"names":["EventEmitter","require$$0","DerivedHelper","require$$1","escapeFacetValue","require$$2","inherits","require$$3","merge","require$$4","objectHasKeys","require$$5","omit","require$$6","RecommendParameters","require$$7","RecommendResults","require$$8","requestBuilder","require$$9","SearchParameters","require$$10","SearchResults","require$$11","sortAndMergeRecommendations","require$$12","version","require$$13","AlgoliaSearchHelper","client","index","options","searchResultsOptions","addAlgoliaAgent","this","setClient","opts","state","make","recommendState","params","lastResults","lastRecommendResults","_queryId","_recommendQueryId","_lastQueryIdReceived","_lastRecommendQueryIdReceived","derivedHelpers","_currentNbQueries","_currentNbRecommendQueries","_searchResultsOptions","_recommendCache","setCurrentPage","page","Error","_change","setPage","isPageReset","getCurrentPage","prototype","search","_search","onlyWithDerivedHelpers","searchOnlyWithDerivedHelpers","searchWithComposition","_runComposition","recommend","_recommend","getQuery","_getHitsSearchParams","searchOnce","cb","tempState","setQueryParameters","queries","_getQueries","self","emit","then","content","results","_originalResponse","e","catch","err","findAnswers","console","warn","derivedHelper","Promise","resolve","derivedState","getModifiedState","data","attributesForPrediction","nbHits","errorMessage","initIndex","query","queryLanguages","searchForFacetValues","facet","maxFacetHits","userState","clientHasSFFV","searchForFacets","clientHasInitIndex","isDisjunctive","isDisjunctiveFacet","algoliaQuery","getSearchForFacetQuery","searchForFacetValuesPromise","indexName","facetName","type","response","hide","renderingContent","facetOrdering","values","Array","isArray","facetHits","reduce","acc","f","indexOf","value","escapedValue","isRefined","isDisjunctiveFacetRefined","isFacetRefined","push","searchForCompositionFacetValues","compositionID","searchForFacetValuesRequest","searchQuery","_getCompositionHitsSearchParams","forEach","setQuery","q","resetPage","clearRefinements","name","clearTags","addDisjunctiveFacetRefinement","addDisjunctiveRefine","apply","arguments","addHierarchicalFacetRefinement","path","addNumericRefinement","attribute","operator","addFacetRefinement","addRefine","addFacetExclusion","addExcludeRefinement","addExclude","addTag","tag","addTagRefinement","addFrequentlyBoughtTogether","_recommendChange","addRelatedProducts","addTrendingItems","addTrendingFacets","addLookingSimilar","removeNumericRefinement","removeDisjunctiveFacetRefinement","removeDisjunctiveRefine","removeHierarchicalFacetRefinement","removeFacetRefinement","removeRefine","removeFacetExclusion","removeExcludeRefinement","removeExclude","removeTag","removeTagRefinement","removeFrequentlyBoughtTogether","id","removeParams","removeRelatedProducts","removeTrendingItems","removeTrendingFacets","removeLookingSimilar","toggleFacetExclusion","toggleExcludeFacetRefinement","toggleExclude","toggleRefinement","toggleFacetRefinement","toggleRefine","toggleTag","toggleTagRefinement","nextPage","previousPage","setIndex","setQueryParameter","parameter","setState","newState","overrideStateWithoutTriggeringChangeEvent","hasRefinements","getNumericRefinements","isConjunctiveFacet","isHierarchicalFacet","isHierarchicalFacetRefined","isExcluded","isExcludeRefined","isDisjunctiveRefined","hasTag","isTagRefined","hasTagRefinements","getIndex","getPage","getTags","tagRefinements","getRefinements","refinements","getConjunctiveRefinements","r","getExcludeRefinements","getDisjunctiveRefinements","numericRefinements","Object","keys","getNumericRefinement","getHierarchicalFacetBreadcrumb","states","mainQueries","queriesCount","length","helper","derivedQueries","map","derivedStateQueries","concat","queryId","_dispatchAlgoliaResponse","bind","_dispatchAlgoliaError","error","_getCompositionQueries","searchState","ids","param","$$id","cache","derivedIndex","getModifiedRecommendState","_buildQueries","getRecommendations","_dispatchRecommendResponse","_dispatchRecommendError","slice","rawContent","key","undefined","s","specificResults","splice","feedID","feeds","sr","_rawContent","idsMap","filter","indices","firstResult","assign","hits","idx","containsRefinement","facetFilters","numericFilters","tagFilters","_hasDisjunctiveRefinements","disjunctiveRefinements","event","clearCache","newClient","getClient","derive","fn","recommendFn","detachDerivedHelper","pos","hasPendingRequests","algoliasearch_helper"],"mappings":"8xBAEA,IAAIA,EAAeC,IAEfC,EAAgBC,IAChBC,EAAmBC,IAAwCD,iBAC3DE,EAAWC,IACXC,EAAQC,IACRC,EAAgBC,IAChBC,EAAOC,IACPC,EAAsBC,IACtBC,EAAmBC,IACnBC,EAAiBC,IACjBC,EAAmBC,IACnBC,EAAgBC,IAChBC,EAA8BC,IAC9BC,EAAUC,IA0Gd,SAASC,EAAoBC,EAAQC,EAAOC,EAASC,GACb,mBAA3BH,EAAOI,iBAChBJ,EAAOI,gBAAgB,cAAgBP,EAAU,KAGnDQ,KAAKC,UAAUN,GACf,IAAIO,EAAOL,GAAW,CAAA,EACtBK,EAAKN,MAAQA,EACbI,KAAKG,MAAQjB,EAAiBkB,KAAKF,GACnCF,KAAKK,eAAiB,IAAIzB,EAAoB,CAC5C0B,OAAQJ,EAAKG,iBAEfL,KAAKO,YAAc,KACnBP,KAAKQ,qBAAuB,KAC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AC5BjB,OAAQ,CACNoB,QAAS9C,KAAKO,YACdJ,MAAOH,KAAKG,OAEd6B,UAAW,CACTc,QAAS9C,KAAKQ,qBACdL,MAAOH,KAAKK,kBAIpB,EAMAX,EAAoB+B,UAAU4N,WAAa,WAEzC,OADIrP,KAAKL,OAAO0P,YAAYrP,KAAKL,OAAO0P,aACjCrP,IACT,EAQAN,EAAoB+B,UAAUxB,UAAY,SAAUqP,GAClD,OAAItP,KAAKL,SAAW2P,IAEqB,mBAA9BA,EAAUvP,iBACnBuP,EAAUvP,gBAAgB,cAAgBP,EAAU,KAEtDQ,KAAKL,OAAS2P,GALwBtP,IAQxC,EAMAN,EAAoB+B,UAAU8N,UAAY,WACxC,OAAOvP,KAAKL,MACd,EAsBAD,EAAoB+B,UAAU+N,OAAS,SAAUC,EAAIC,GACnD,IAAIpM,EAAgB,IAAItF,EAAcgC,KAAMyP,EAAIC,GAEhD,OADA1P,KAAKa,eAAeqF,KAAK5C,GAClBA,CACT,EAUA5D,EAAoB+B,UAAUkO,oBAAsB,SAAUrM,GAC5D,IAAIsM,EAAM5P,KAAKa,eAAe+E,QAAQtC,GACtC,IAAY,IAARsM,EAAY,MAAM,IAAIxO,MAAM,mCAChCpB,KAAKa,eAAeqN,OAAO0B,EAAK,EAClC,EAMAlQ,EAAoB+B,UAAUoO,mBAAqB,WACjD,OAAO7P,KAAKc,kBAAoB,CAClC,EAkBAgP,EAAiBpQ","x_google_ignoreList":[0]}
|
package/dist/esm/node_modules/algoliasearch-helper/src/utils/sortAndMergeRecommendations.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sortAndMergeRecommendations.js","sources":["../../../../../../node_modules/algoliasearch-helper/src/utils/sortAndMergeRecommendations.js"],"sourcesContent":["'use strict';\n\nvar find = require('../functions/find');\nvar flat = require('../functions/flat');\n\nfunction getAverageIndices(indexTracker, nrOfObjs) {\n var avgIndices = [];\n\n Object.keys(indexTracker).forEach(function (key) {\n if (indexTracker[key].count < 2) {\n indexTracker[key].indexSum += 100;\n }\n avgIndices.push({\n objectID: key,\n avgOfIndices: indexTracker[key].indexSum / nrOfObjs,\n });\n });\n\n return avgIndices.sort(function (a, b) {\n return a.avgOfIndices > b.avgOfIndices ? 1 : -1;\n });\n}\n\nfunction sortAndMergeRecommendations(objectIDs, results) {\n var indexTracker = {};\n\n results.forEach(function (hits) {\n hits.forEach(function (hit, index) {\n if (objectIDs.includes(hit.objectID)) return;\n\n if (!indexTracker[hit.objectID]) {\n indexTracker[hit.objectID] = { indexSum: index, count: 1 };\n } else {\n indexTracker[hit.objectID] = {\n indexSum: indexTracker[hit.objectID].indexSum + index,\n count: indexTracker[hit.objectID].count + 1,\n };\n }\n });\n });\n\n var sortedAverageIndices = getAverageIndices(indexTracker, results.length);\n\n var finalOrder = sortedAverageIndices.reduce(function (\n orderedHits,\n avgIndexRef\n ) {\n var result = find(flat(results), function (hit) {\n return hit.objectID === avgIndexRef.objectID;\n });\n return result ? orderedHits.concat(result) : orderedHits;\n }
|
|
1
|
+
{"version":3,"file":"sortAndMergeRecommendations.js","sources":["../../../../../../node_modules/algoliasearch-helper/src/utils/sortAndMergeRecommendations.js"],"sourcesContent":["'use strict';\n\nvar find = require('../functions/find');\nvar flat = require('../functions/flat');\n\nfunction getAverageIndices(indexTracker, nrOfObjs) {\n var avgIndices = [];\n\n Object.keys(indexTracker).forEach(function (key) {\n if (indexTracker[key].count < 2) {\n indexTracker[key].indexSum += 100;\n }\n avgIndices.push({\n objectID: key,\n avgOfIndices: indexTracker[key].indexSum / nrOfObjs,\n });\n });\n\n return avgIndices.sort(function (a, b) {\n return a.avgOfIndices > b.avgOfIndices ? 1 : -1;\n });\n}\n\nfunction sortAndMergeRecommendations(objectIDs, results) {\n var indexTracker = {};\n\n results.forEach(function (hits) {\n hits.forEach(function (hit, index) {\n if (objectIDs.includes(hit.objectID)) return;\n\n if (!indexTracker[hit.objectID]) {\n indexTracker[hit.objectID] = { indexSum: index, count: 1 };\n } else {\n indexTracker[hit.objectID] = {\n indexSum: indexTracker[hit.objectID].indexSum + index,\n count: indexTracker[hit.objectID].count + 1,\n };\n }\n });\n });\n\n var sortedAverageIndices = getAverageIndices(indexTracker, results.length);\n\n var finalOrder = sortedAverageIndices.reduce(function (\n orderedHits,\n avgIndexRef\n ) {\n var result = find(flat(results), function (hit) {\n return hit.objectID === avgIndexRef.objectID;\n });\n return result ? orderedHits.concat(result) : orderedHits;\n }, []);\n\n return finalOrder;\n}\n\nmodule.exports = sortAndMergeRecommendations;\n"],"names":["find","require$$0","flat","require$$1","sortAndMergeRecommendations_1","objectIDs","results","indexTracker","forEach","hits","hit","index","includes","objectID","indexSum","count","nrOfObjs","avgIndices","Object","keys","key","push","avgOfIndices","sort","a","b","getAverageIndices","length","reduce","orderedHits","avgIndexRef","result","concat"],"mappings":"yIAEA,IAAIA,EAAOC,IACPC,EAAOC,WAqDXC,EAjCA,SAAqCC,EAAWC,GAC9C,IAAIC,EAAe,CAAA,EA6BnB,OA3BAD,EAAQE,QAAQ,SAAUC,GACxBA,EAAKD,QAAQ,SAAUE,EAAKC,GACtBN,EAAUO,SAASF,EAAIG,YAEtBN,EAAaG,EAAIG,UAGpBN,EAAaG,EAAIG,UAAY,CAC3BC,SAAUP,EAAaG,EAAIG,UAAUC,SAAWH,EAChDI,MAAOR,EAAaG,EAAIG,UAAUE,MAAQ,GAJ5CR,EAAaG,EAAIG,UAAY,CAAEC,SAAUH,EAAOI,MAAO,GAO/D,EACA,GAlCA,SAA2BR,EAAcS,GACvC,IAAIC,EAAa,GAYjB,OAVAC,OAAOC,KAAKZ,GAAcC,QAAQ,SAAUY,GACtCb,EAAaa,GAAKL,MAAQ,IAC5BR,EAAaa,GAAKN,UAAY,KAEhCG,EAAWI,KAAK,CACdR,SAAUO,EACVE,aAAcf,EAAaa,GAAKN,SAAWE,GAEjD,GAESC,EAAWM,KAAK,SAAUC,EAAGC,GAClC,OAAOD,EAAEF,aAAeG,EAAEH,aAAe,GAAI,CACjD,EACA,CAoB6BI,CAAkBnB,EAAcD,EAAQqB,QAE7BC,OAAO,SAC3CC,EACAC,GAEA,IAAIC,EAAS/B,EAAKE,EAAKI,GAAU,SAAUI,GACzC,OAAOA,EAAIG,WAAaiB,EAAYjB,QAC1C,GACI,OAAOkB,EAASF,EAAYG,OAAOD,GAAUF,CACjD,EAAK,GAGL","x_google_ignoreList":[0]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var r,e;function n(){return e?r:(e=1,r="3.29.
|
|
1
|
+
var r,e;function n(){return e?r:(e=1,r="3.29.3")}export{n as __require};
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sources":["../../../../../node_modules/algoliasearch-helper/src/version.js"],"sourcesContent":["'use strict';\n\nmodule.exports = '3.29.
|
|
1
|
+
{"version":3,"file":"version.js","sources":["../../../../../node_modules/algoliasearch-helper/src/version.js"],"sourcesContent":["'use strict';\n\nmodule.exports = '3.29.3';\n"],"names":["version"],"mappings":"qCAEAA,EAAiB","x_google_ignoreList":[0]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=Symbol.for("immer-nothing"),t=Symbol.for("immer-draftable"),r=Symbol.for("immer-state"),n="production"!==process.env.NODE_ENV?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function o(e,...t){if("production"!==process.env.NODE_ENV){const r=n[e],o=O(r)?r.apply(null,t):r;throw new Error(`[Immer] ${o}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var i=Object,a=i.getPrototypeOf,s="constructor",c="prototype",u="configurable",f="enumerable",l="writable",_="value",p=e=>!!e&&!!e[r];function d(e){return!!e&&(m(e)||w(e)||!!e[t]||!!e[s]?.[t]||z(e)||I(e))}var h=i[c][s].toString(),y=new WeakMap;function m(e){if(!e||!M(e))return!1;const t=a(e);if(null===t||t===i[c])return!0;const r=i.hasOwnProperty.call(t,s)&&t[s];if(r===Object)return!0;if(!O(r))return!1;let n=y.get(r);return void 0===n&&(n=Function.toString.call(r),y.set(r,n)),n===h}function g(e,t,r=!0){if(0===b(e)){(r?Reflect.ownKeys(e):i.keys(e)).forEach(r=>{t(r,e[r],e)})}else e.forEach((r,n)=>t(n,r,e))}function b(e){const t=e[r];return t?t.type_:w(e)?1:z(e)?2:I(e)?3:0}var v=(e,t,r=b(e))=>2===r?e.has(t):i[c].hasOwnProperty.call(e,t),S=(e,t,r=b(e))=>2===r?e.get(t):e[t],P=(e,t,r,n=b(e))=>{2===n?e.set(t,r):3===n?e.add(r):e[t]=r};var w=Array.isArray,z=e=>e instanceof Map,I=e=>e instanceof Set,M=e=>"object"==typeof e,O=e=>"function"==typeof e,k=e=>"boolean"==typeof e;var N=e=>e.copy_||e.base_,D=e=>e.modified_?e.copy_:e.base_;function F(e,t){if(z(e))return new Map(e);if(I(e))return new Set(e);if(w(e))return Array[c].slice.call(e);const n=m(e);if(!0===t||"class_only"===t&&!n){const t=i.getOwnPropertyDescriptors(e);delete t[r];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){const o=n[r],i=t[o];!1===i[l]&&(i[l]=!0,i[u]=!0),(i.get||i.set)&&(t[o]={[u]:!0,[l]:!0,[f]:i[f],[_]:e[o]})}return i.create(a(e),t)}{const t=a(e);if(null!==t&&n)return{...e};const r=i.create(t);return i.assign(r,e)}}function E(e,t=!1){return A(e)||p(e)||!d(e)||(b(e)>1&&i.defineProperties(e,{set:j,add:j,clear:j,delete:j}),i.freeze(e),t&&g(e,(e,t)=>{E(t,!0)},!1)),e}var j={[_]:function(){o(2)}};function A(e){return null===e||!M(e)||i.isFrozen(e)}var C="MapSet",x="Patches",R="ArrayMethods",$={};function U(e){const t=$[e];return t||o(0,e),t}var K,L=e=>!!$[e],T=()=>K;function V(e,t){t&&(e.patchPlugin_=U(x),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function W(e){G(e),e.drafts_.forEach(q),e.drafts_=null}function G(e){e===K&&(K=e.parent_)}var X=e=>K={drafts_:[],parent_:K,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:L(C)?U(C):void 0,arrayMethodsPlugin_:L(R)?U(R):void 0};function q(e){const t=e[r];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function B(t,n){n.unfinalizedDrafts_=n.drafts_.length;const i=n.drafts_[0];if(void 0!==t&&t!==i){i[r].modified_&&(W(n),o(4)),d(t)&&(t=H(n,t));const{patchPlugin_:e}=n;e&&e.generateReplacementPatches_(i[r].base_,t,n)}else t=H(n,i);return function(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&E(t,r)}(n,t,!0),W(n),n.patches_&&n.patchListener_(n.patches_,n.inversePatches_),t!==e?t:void 0}function H(e,t){if(A(t))return t;const n=t[r];if(!n){return te(t,e.handledSet_,e)}if(!Q(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:t}=n;if(t)for(;t.length>0;){t.pop()(e)}ee(n,e)}return n.copy_}function J(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Q=(e,t)=>e.scope_===t,Y=[];function Z(e,t,r,n){const o=N(e),i=e.type_;if(void 0!==n){if(S(o,n,i)===t)return void P(o,n,r,i)}if(!e.draftLocations_){const t=e.draftLocations_=new Map;g(o,(e,r)=>{if(p(r)){const n=t.get(r)||[];n.push(e),t.set(r,n)}})}const a=e.draftLocations_.get(t)??Y;for(const e of a)P(o,e,r,i)}function ee(e,t){if(e.modified_&&!e.finalized_&&(3===e.type_||1===e.type_&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){const{patchPlugin_:r}=t;if(r){const n=r.getPath(e);n&&r.generatePatches_(e,n,t)}J(e)}}function te(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||p(e)||t.has(e)||!d(e)||A(e)||(t.add(e),g(e,(o,i)=>{if(p(i)){const t=i[r];if(Q(t,n)){const r=D(t);P(e,o,r,e.type_),J(t)}}else d(i)&&te(i,t,n)})),e}var re={get(e,t){if(t===r)return e;let n=e.scope_.arrayMethodsPlugin_;const o=1===e.type_&&"string"==typeof t;if(o&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);const i=N(e);if(!v(i,t,e.type_))return function(e,t,r){const n=ie(t,r);return n?_ in n?n[_]:n.get?.call(e.draft_):void 0}(e,i,t);const a=i[t];if(e.finalized_||!d(a))return a;if(o&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&function(e){const t=+e;return Number.isInteger(t)&&String(t)===e}(t))return a;if(a===oe(e.base_,t)){se(e);const r=1===e.type_?+t:t,n=ue(e.scope_,a,e,r);return e.copy_[r]=n}return a},has:(e,t)=>t in N(e),ownKeys:e=>Reflect.ownKeys(N(e)),set(e,t,n){const o=ie(N(e),t);if(o?.set)return o.set.call(e.draft_,n),!0;if(!e.modified_){const o=oe(N(e),t),s=o?.[r];if(s&&s.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(((i=n)===(a=o)?0!==i||1/i==1/a:i!=i&&a!=a)&&(void 0!==n||v(e.base_,t,e.type_)))return!0;se(e),ae(e)}var i,a;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),function(e,t,n){const{scope_:o}=e;if(p(n)){const i=n[r];Q(i,o)&&i.callbacks_.push(function(){se(e);const r=D(i);Z(e,n,r,t)})}else d(n)&&e.callbacks_.push(function(){const r=N(e);3===e.type_?r.has(n)&&te(n,o.handledSet_,o):S(r,t,e.type_)===n&&o.drafts_.length>1&&!0===(e.assigned_.get(t)??!1)&&e.copy_&&te(S(e.copy_,t,e.type_),o.handledSet_,o)})}(e,t,n)),!0},deleteProperty:(e,t)=>(se(e),void 0!==oe(e.base_,t)||t in e.base_?(e.assigned_.set(t,!1),ae(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const r=N(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n?{[l]:!0,[u]:1!==e.type_||"length"!==t,[f]:n[f],[_]:r[t]}:n},defineProperty(){o(11)},getPrototypeOf:e=>a(e.base_),setPrototypeOf(){o(12)}},ne={};for(let e in re){let t=re[e];ne[e]=function(){const e=arguments;return e[0]=e[0][0],t.apply(this,e)}}function oe(e,t){const n=e[r];return(n?N(n):e)[t]}function ie(e,t){if(!(t in e))return;let r=a(e);for(;r;){const e=Object.getOwnPropertyDescriptor(r,t);if(e)return e;r=a(r)}}function ae(e){e.modified_||(e.modified_=!0,e.parent_&&ae(e.parent_))}function se(e){e.copy_||(e.assigned_=new Map,e.copy_=F(e.base_,e.scope_.immer_.useStrictShallowCopy_))}ne.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&o(13),ne.set.call(this,e,t,void 0)},ne.set=function(e,t,r){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&o(14),re.set.call(this,e[0],t,r,e[0])};var ce=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(O(t)&&!O(r)){const e=r;r=t;const n=this;return function(t=e,...o){return n.produce(t,e=>r.call(this,e,...o))}}let i;if(O(r)||o(6),void 0===n||O(n)||o(7),d(t)){const e=X(this),o=ue(e,t,void 0);let a=!0;try{i=r(o),a=!1}finally{a?W(e):G(e)}return V(e,n),B(i,e)}if(!t||!M(t)){if(i=r(t),void 0===i&&(i=t),i===e&&(i=void 0),this.autoFreeze_&&E(i,!0),n){const e=[],r=[];U(x).generateReplacementPatches_(t,i,{patches_:e,inversePatches_:r}),n(e,r)}return i}o(1,t)},this.produceWithPatches=(e,t)=>{if(O(e))return(t,...r)=>this.produceWithPatches(t,t=>e(t,...r));let r,n;return[this.produce(e,t,(e,t)=>{r=e,n=t}),r,n]},k(t?.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),k(t?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),k(t?.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(e){d(e)||o(8),p(e)&&(e=fe(e));const t=X(this),n=ue(t,e,void 0);return n[r].isManual_=!0,G(t),n}finishDraft(e,t){const n=e&&e[r];n&&n.isManual_||o(9);const{scope_:i}=n;return V(i,t),B(void 0,i)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const n=t[r];if(0===n.path.length&&"replace"===n.op){e=n.value;break}}r>-1&&(t=t.slice(r+1));const n=U(x).applyPatches_;return p(e)?n(e,t):this.produce(e,e=>n(e,t))}};function ue(e,t,r,n){const[o,i]=z(t)?U(C).proxyMap_(t,r):I(t)?U(C).proxySet_(t,r):function(e,t){const r=w(e),n={type_:r?1:0,scope_:t?t.scope_:T(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let o=n,i=re;r&&(o=[n],i=ne);const{revoke:a,proxy:s}=Proxy.revocable(o,i);return n.draft_=s,n.revoke_=a,[s,n]}(t,r);return(r?.scope_??T()).drafts_.push(o),i.callbacks_=r?.callbacks_??[],i.key_=n,r&&void 0!==n?function(e,t,r){e.callbacks_.push(function(n){const o=t;if(!o||!Q(o,n))return;n.mapSetPlugin_?.fixSetContents(o);const i=D(o);Z(e,o.draft_??o,i,r),ee(o,n)})}(r,i,n):i.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(i);const{patchPlugin_:t}=e;i.modified_&&t&&t.generatePatches_(i,[],e)}),o}function fe(e){return p(e)||o(10,e),le(e)}function le(e){if(!d(e)||A(e))return e;const t=e[r];let n,o=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=F(e,t.scope_.immer_.useStrictShallowCopy_),o=t.scope_.immer_.shouldUseStrictIteration()}else n=F(e,!0);return g(n,(e,t)=>{P(n,e,le(t))},o),t&&(t.finalized_=!1),n}var _e=(new ce).produce;export{ce as Immer,fe as current,E as freeze,t as immerable,p as isDraft,d as isDraftable,e as nothing,_e as produce};
|
|
1
|
+
var e=Symbol.for("immer-nothing"),t=Symbol.for("immer-draftable"),r=Symbol.for("immer-state"),n="production"!==process.env.NODE_ENV?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function o(e,...t){if("production"!==process.env.NODE_ENV){const r=n[e],o=O(r)?r.apply(null,t):r;throw new Error(`[Immer] ${o}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var i=Object,s=i.getPrototypeOf,a="constructor",c="prototype",u="configurable",f="enumerable",l="writable",_="value",p=e=>!!e&&!!e[r];function d(e){return!!e&&(m(e)||w(e)||!!e[t]||!!e[a]?.[t]||z(e)||I(e))}var h=i[c][a].toString(),y=new WeakMap;function m(e){if(!e||!M(e))return!1;const t=s(e);if(null===t||t===i[c])return!0;const r=i.hasOwnProperty.call(t,a)&&t[a];if(r===Object)return!0;if(!O(r))return!1;let n=y.get(r);return void 0===n&&(n=Function.toString.call(r),y.set(r,n)),n===h}function g(e,t,r=!0){if(0===b(e)){(r?Reflect.ownKeys(e):i.keys(e)).forEach(r=>{t(r,e[r],e)})}else e.forEach((r,n)=>t(n,r,e))}function b(e){const t=e[r];return t?t.type_:w(e)?1:z(e)?2:I(e)?3:0}var v=(e,t,r=b(e))=>2===r?e.has(t):i[c].hasOwnProperty.call(e,t),S=(e,t,r=b(e))=>2===r?e.get(t):e[t],P=(e,t,r,n=b(e))=>{2===n?e.set(t,r):3===n?e.add(r):e[t]=r};var w=Array.isArray,z=e=>e instanceof Map,I=e=>e instanceof Set,M=e=>"object"==typeof e,O=e=>"function"==typeof e,k=e=>"boolean"==typeof e;var N=e=>e.copy_||e.base_,D=e=>e.modified_?e.copy_:e.base_;function F(e,t){if(z(e))return new Map(e);if(I(e))return new Set(e);if(w(e))return Array[c].slice.call(e);const n=m(e);if(!0===t||"class_only"===t&&!n){const t=i.getOwnPropertyDescriptors(e);delete t[r];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){const o=n[r],i=t[o];!1===i[l]&&(i[l]=!0,i[u]=!0),(i.get||i.set)&&(t[o]={[u]:!0,[l]:!0,[f]:i[f],[_]:e[o]})}return i.create(s(e),t)}{const t=s(e);if(null!==t&&n)return{...e};const r=i.create(t);return i.assign(r,e)}}function E(e,t=!1){return A(e)||p(e)||!d(e)||(b(e)>1&&i.defineProperties(e,{set:j,add:j,clear:j,delete:j}),i.freeze(e),t&&g(e,(e,t)=>{E(t,!0)},!1)),e}var j={[_]:function(){o(2)}};function A(e){return null===e||!M(e)||i.isFrozen(e)}var C="MapSet",x="Patches",R="ArrayMethods",$={};function T(e){const t=$[e];return t||o(0,e),t}var U,K=e=>!!$[e],L=()=>U;function V(e,t){t&&(e.patchPlugin_=T(x),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function W(e){G(e),e.drafts_.forEach(q),e.drafts_=null}function G(e){e===U&&(U=e.parent_)}var X=e=>U={drafts_:[],parent_:U,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:K(C)?T(C):void 0,arrayMethodsPlugin_:K(R)?T(R):void 0};function q(e){const t=e[r];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function B(t,n){n.unfinalizedDrafts_=n.drafts_.length;const i=n.drafts_[0];if(void 0!==t&&t!==i){i[r].modified_&&(W(n),o(4)),d(t)&&(t=H(n,t));const{patchPlugin_:e}=n;e&&e.generateReplacementPatches_(i[r].base_,t,n)}else t=H(n,i);return function(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&E(t,r)}(n,t,!0),W(n),n.patches_&&n.patchListener_(n.patches_,n.inversePatches_),t!==e?t:void 0}function H(e,t){if(A(t))return t;const n=t[r];if(!n){return te(t,e.handledSet_,e)}if(!Q(n,e))return t;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:t}=n;if(t)for(;t.length>0;){t.pop()(e)}ee(n,e)}return n.copy_}function J(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Q=(e,t)=>e.scope_===t,Y=[];function Z(e,t,r,n){const o=N(e),i=e.type_;if(void 0!==n){if(S(o,n,i)===t)return void P(o,n,r,i)}if(!e.draftLocations_){const t=e.draftLocations_=new Map;g(o,(e,r)=>{if(p(r)){const n=t.get(r)||[];n.push(e),t.set(r,n)}})}const s=e.draftLocations_.get(t)??Y;for(const e of s)P(o,e,r,i)}function ee(e,t){if(e.modified_&&!e.finalized_&&(3===e.type_||1===e.type_&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){const{patchPlugin_:r}=t;if(r){const n=r.getPath(e);n&&r.generatePatches_(e,n,t)}J(e)}}function te(e,t,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||p(e)||t.has(e)||!d(e)||A(e)||(t.add(e),g(e,(o,i)=>{if(p(i)){const t=i[r];if(Q(t,n)){const r=D(t);P(e,o,r,e.type_),J(t)}}else d(i)&&te(i,t,n)})),e}var re={get(e,t){if(t===r)return e;let n=e.scope_.arrayMethodsPlugin_;const o=1===e.type_&&"string"==typeof t;if(o&&n?.isArrayOperationMethod(t))return n.createMethodInterceptor(e,t);const i=N(e);if(!v(i,t,e.type_))return function(e,t,r){const n=ie(t,r);return n?_ in n?n[_]:n.get?.call(e.draft_):void 0}(e,i,t);const s=i[t];if(e.finalized_||!d(s))return s;if(o&&e.operationMethod&&n?.isMutatingArrayMethod(e.operationMethod)&&function(e){const t=+e;return Number.isInteger(t)&&String(t)===e}(t))return s;if(s===oe(e.base_,t)||function(e,t,n){if(1!==e.type_||!e.allIndicesReassigned_||e.assigned_?.get(t)||!d(n)||n[r])return!1;return e.baseRefs_.has(n)}(e,t,s)){ae(e);const r=1===e.type_?+t:t,n=ue(e.scope_,s,e,r);return e.copy_[r]=n}return s},has:(e,t)=>t in N(e),ownKeys:e=>Reflect.ownKeys(N(e)),set(e,t,n){const o=ie(N(e),t);if(o?.set)return o.set.call(e.draft_,n),!0;if(!e.modified_){const o=oe(N(e),t),a=o?.[r];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_.set(t,!1),!0;if(((i=n)===(s=o)?0!==i||1/i==1/s:i!=i&&s!=s)&&(void 0!==n||v(e.base_,t,e.type_)))return!0;ae(e),se(e)}var i,s;return e.copy_[t]===n&&(void 0!==n||v(e.copy_,t,e.type_))||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_.set(t,!0),function(e,t,n){const{scope_:o}=e;if(p(n)){const i=n[r];Q(i,o)&&i.callbacks_.push(function(){ae(e);const r=D(i);Z(e,n,r,t)})}else d(n)&&e.callbacks_.push(function(){const r=N(e);3===e.type_?r.has(n)&&te(n,o.handledSet_,o):S(r,t,e.type_)===n&&o.drafts_.length>1&&!0===(e.assigned_.get(t)??!1)&&e.copy_&&te(S(e.copy_,t,e.type_),o.handledSet_,o)})}(e,t,n)),!0},deleteProperty:(e,t)=>(ae(e),void 0!==oe(e.base_,t)||t in e.base_?(e.assigned_.set(t,!1),se(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const r=N(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n?{[l]:!0,[u]:1!==e.type_||"length"!==t,[f]:n[f],[_]:r[t]}:n},defineProperty(){o(11)},getPrototypeOf:e=>s(e.base_),setPrototypeOf(){o(12)}},ne={};for(let e in re){let t=re[e];ne[e]=function(){const e=arguments;return e[0]=e[0][0],t.apply(this,e)}}function oe(e,t){const n=e[r];return(n?N(n):e)[t]}function ie(e,t){if(!(t in e))return;let r=s(e);for(;r;){const e=Object.getOwnPropertyDescriptor(r,t);if(e)return e;r=s(r)}}function se(e){e.modified_||(e.modified_=!0,e.parent_&&se(e.parent_))}function ae(e){e.copy_||(e.assigned_=new Map,e.copy_=F(e.base_,e.scope_.immer_.useStrictShallowCopy_))}ne.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&o(13),ne.set.call(this,e,t,void 0)},ne.set=function(e,t,r){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&o(14),re.set.call(this,e[0],t,r,e[0])};var ce=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,n)=>{if(O(t)&&!O(r)){const e=r;r=t;const n=this;return function(t=e,...o){return n.produce(t,e=>r.call(this,e,...o))}}let i;if(O(r)||o(6),void 0===n||O(n)||o(7),d(t)){const e=X(this),o=ue(e,t,void 0);let s=!0;try{i=r(o),s=!1}finally{s?W(e):G(e)}return V(e,n),B(i,e)}if(!t||!M(t)){if(i=r(t),void 0===i&&(i=t),i===e&&(i=void 0),this.autoFreeze_&&E(i,!0),n){const e=[],r=[];T(x).generateReplacementPatches_(t,i,{patches_:e,inversePatches_:r}),n(e,r)}return i}o(1,t)},this.produceWithPatches=(e,t)=>{if(O(e))return(t,...r)=>this.produceWithPatches(t,t=>e(t,...r));let r,n;return[this.produce(e,t,(e,t)=>{r=e,n=t}),r,n]},k(t?.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),k(t?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),k(t?.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(e){d(e)||o(8),p(e)&&(e=fe(e));const t=X(this),n=ue(t,e,void 0);return n[r].isManual_=!0,G(t),n}finishDraft(e,t){const n=e&&e[r];n&&n.isManual_||o(9);const{scope_:i}=n;return V(i,t),B(void 0,i)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const n=t[r];if(0===n.path.length&&"replace"===n.op){e=n.value;break}}r>-1&&(t=t.slice(r+1));const n=T(x).applyPatches_;return p(e)?n(e,t):this.produce(e,e=>n(e,t))}};function ue(e,t,r,n){const[o,i]=z(t)?T(C).proxyMap_(t,r):I(t)?T(C).proxySet_(t,r):function(e,t){const r=w(e),n={type_:r?1:0,scope_:t?t.scope_:L(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let o=n,i=re;r&&(o=[n],i=ne);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return n.draft_=a,n.revoke_=s,[a,n]}(t,r);return(r?.scope_??L()).drafts_.push(o),i.callbacks_=r?.callbacks_??[],i.key_=n,r&&void 0!==n?function(e,t,r){e.callbacks_.push(function(n){const o=t;if(!o||!Q(o,n))return;n.mapSetPlugin_?.fixSetContents(o);const i=D(o);Z(e,o.draft_??o,i,r),ee(o,n)})}(r,i,n):i.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(i);const{patchPlugin_:t}=e;i.modified_&&t&&t.generatePatches_(i,[],e)}),o}function fe(e){return p(e)||o(10,e),le(e)}function le(e){if(!d(e)||A(e))return e;const t=e[r];let n,o=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=F(e,t.scope_.immer_.useStrictShallowCopy_),o=t.scope_.immer_.shouldUseStrictIteration()}else n=F(e,!0);return g(n,(e,t)=>{P(n,e,le(t))},o),t&&(t.finalized_=!1),n}globalThis.Iterator;var _e=(new ce).produce;export{ce as Immer,fe as current,E as freeze,t as immerable,p as isDraft,d as isDraftable,e as nothing,_e as produce};
|
|
2
2
|
//# sourceMappingURL=immer.js.map
|