Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

algoliasearch-helper

Package Overview
Dependencies
Maintainers
5
Versions
147
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

algoliasearch-helper - npm Package Compare versions

Comparing version 3.13.3 to 3.13.4

4

dist/algoliasearch.helper.min.js

@@ -1,3 +0,3 @@

!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.algoliasearchHelper=e()}}(function(){return function e(t,i,n){function r(a,c){if(!i[a]){if(!t[a]){var u="function"==typeof require&&require;if(!c&&u)return u(a,!0);if(s)return s(a,!0);var o=new Error("Cannot find module '"+a+"'");throw o.code="MODULE_NOT_FOUND",o}var f=i[a]={exports:{}};t[a][0].call(f.exports,function(e){var i=t[a][1][e];return r(i||e)},f,f.exports,e,t,i,n)}return i[a].exports}for(var s="function"==typeof require&&require,a=0;a<n.length;a++)r(n[a]);return r}({1:[function(e,t,i){"use strict";function n(e,t,i){return new r(e,t,i)}var r=e("./src/algoliasearch.helper"),s=e("./src/SearchParameters"),a=e("./src/SearchResults");n.version=e("./src/version"),n.AlgoliaSearchHelper=r,n.SearchParameters=s,n.SearchResults=a,t.exports=n},{"./src/SearchParameters":5,"./src/SearchResults":7,"./src/algoliasearch.helper":8,"./src/version":24}],2:[function(e,t,i){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function s(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function c(e){return void 0===e}t.exports=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!s(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,i,n,s,u,o;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var f=new Error('Uncaught, unspecified "error" event. ('+t+")");throw f.context=t,f}if(i=this._events[e],c(i))return!1;if(r(i))switch(arguments.length){case 1:i.call(this);break;case 2:i.call(this,arguments[1]);break;case 3:i.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),i.apply(this,s)}else if(a(i))for(s=Array.prototype.slice.call(arguments,1),o=i.slice(),n=o.length,u=0;u<n;u++)o[u].apply(this,s);return!0},n.prototype.addListener=function(e,t){var i;if(!r(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,r(t.listener)?t.listener:t),this._events[e]?a(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,a(this._events[e])&&!this._events[e].warned&&(i=c(this._maxListeners)?n.defaultMaxListeners:this._maxListeners)&&i>0&&this._events[e].length>i&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function i(){this.removeListener(e,i),n||(n=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var n=!1;return i.listener=t,this.on(e,i),this},n.prototype.removeListener=function(e,t){var i,n,s,c;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(i=this._events[e],s=i.length,n=-1,i===t||r(i.listener)&&i.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(a(i)){for(c=s;c-- >0;)if(i[c]===t||i[c].listener&&i[c].listener===t){n=c;break}if(n<0)return this;1===i.length?(i.length=0,delete this._events[e]):i.splice(n,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,i;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(i=this._events[e],r(i))this.removeListener(e,i);else if(i)for(;i.length;)this.removeListener(e,i[i.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},{}],3:[function(e,t,i){"use strict";function n(e,t){this.main=e,this.fn=t,this.lastResults=null}var r=e("@algolia/events");e("../functions/inherits")(n,r),n.prototype.detach=function(){this.removeAllListeners(),this.main.detachDerivedHelper(this)},n.prototype.getModifiedState=function(e){return this.fn(e)},t.exports=n},{"../functions/inherits":15,"@algolia/events":2}],4:[function(e,t,i){"use strict";var n=e("../functions/defaultsPure"),r=e("../functions/omit"),s=e("../functions/objectHasKeys"),a={addRefinement:function(e,t,i){if(a.isRefined(e,t,i))return e;var r=""+i,s=e[t]?e[t].concat(r):[r],c={};return c[t]=s,n({},c,e)},removeRefinement:function(e,t,i){if(void 0===i)return a.clearRefinement(e,function(e,i){return t===i});var n=""+i;return a.clearRefinement(e,function(e,i){return t===i&&n===e})},toggleRefinement:function(e,t,i){if(void 0===i)throw new Error("toggleRefinement should be used with a value");return a.isRefined(e,t,i)?a.removeRefinement(e,t,i):a.addRefinement(e,t,i)},clearRefinement:function(e,t,i){if(void 0===t)return s(e)?{}:e;if("string"==typeof t)return r(e,[t]);if("function"==typeof t){var n=!1,a=Object.keys(e).reduce(function(r,s){var a=e[s]||[],c=a.filter(function(e){return!t(e,s,i)});return c.length!==a.length&&(n=!0),r[s]=c,r},{});return n?a:e}},isRefined:function(e,t,i){var n=Boolean(e[t])&&e[t].length>0;if(void 0===i||!n)return n;var r=""+i;return-1!==e[t].indexOf(r)}};t.exports=a},{"../functions/defaultsPure":10,"../functions/objectHasKeys":18,"../functions/omit":19}],5:[function(e,t,i){"use strict";function n(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every(function(e,i){return n(t[i],e)}):e===t}function r(e,t){return o(e,function(e){return n(e,t)})}function s(e){var t=e?s._parseNumbers(e):{};void 0===t.userToken||m(t.userToken)||console.warn("[algoliasearch-helper] The `userToken` parameter is invalid. This can lead to wrong analytics.\n - Format: [a-zA-Z0-9_-]{1,64}"),this.facets=t.facets||[],this.disjunctiveFacets=t.disjunctiveFacets||[],this.hierarchicalFacets=t.hierarchicalFacets||[],this.facetsRefinements=t.facetsRefinements||{},this.facetsExcludes=t.facetsExcludes||{},this.disjunctiveFacetsRefinements=t.disjunctiveFacetsRefinements||{},this.numericRefinements=t.numericRefinements||{},this.tagRefinements=t.tagRefinements||[],this.hierarchicalFacetsRefinements=t.hierarchicalFacetsRefinements||{};var i=this;Object.keys(t).forEach(function(e){var n=-1!==s.PARAMETERS.indexOf(e),r=void 0!==t[e];!n&&r&&(i[e]=t[e])})}var a=e("../functions/merge"),c=e("../functions/defaultsPure"),u=e("../functions/intersection"),o=e("../functions/find"),f=e("../functions/valToNumber"),h=e("../functions/omit"),l=e("../functions/objectHasKeys"),m=e("../utils/isValidUserToken"),d=e("./RefinementList");s.PARAMETERS=Object.keys(new s),s._parseNumbers=function(e){if(e instanceof s)return e;var t={};if(["aroundPrecision","aroundRadius","getRankingInfo","minWordSizefor2Typos","minWordSizefor1Typo","page","maxValuesPerFacet","distinct","minimumAroundRadius","hitsPerPage","minProximity"].forEach(function(i){var n=e[i];if("string"==typeof n){var r=parseFloat(n);t[i]=isNaN(r)?n:r}}),Array.isArray(e.insideBoundingBox)&&(t.insideBoundingBox=e.insideBoundingBox.map(function(e){return Array.isArray(e)?e.map(function(e){return parseFloat(e)}):e})),e.numericRefinements){var i={};Object.keys(e.numericRefinements).forEach(function(t){var n=e.numericRefinements[t]||{};i[t]={},Object.keys(n).forEach(function(e){var r=n[e],s=r.map(function(e){return Array.isArray(e)?e.map(function(e){return"string"==typeof e?parseFloat(e):e}):"string"==typeof e?parseFloat(e):e});i[t][e]=s})}),t.numericRefinements=i}return a({},e,t)},s.make=function(e){var t=new s(e);return(e.hierarchicalFacets||[]).forEach(function(e){if(e.rootPath){var i=t.getHierarchicalRefinement(e.name);i.length>0&&0!==i[0].indexOf(e.rootPath)&&(t=t.clearRefinements(e.name)),i=t.getHierarchicalRefinement(e.name),0===i.length&&(t=t.toggleHierarchicalFacetRefinement(e.name,e.rootPath))}}),t},s.validate=function(e,t){var i=t||{};return e.tagFilters&&i.tagRefinements&&i.tagRefinements.length>0?new Error("[Tags] Cannot switch from the managed tag API to the advanced API. It is probably an error, if it is really what you want, you should first clear the tags with clearTags method."):e.tagRefinements.length>0&&i.tagFilters?new Error("[Tags] Cannot switch from the advanced tag API to the managed API. It is probably an error, if it is not, you should first clear the tags with clearTags method."):e.numericFilters&&i.numericRefinements&&l(i.numericRefinements)?new Error("[Numeric filters] Can't switch from the advanced to the managed API. It is probably an error, if this is really what you want, you have to first clear the numeric filters."):l(e.numericRefinements)&&i.numericFilters?new Error("[Numeric filters] Can't switch from the managed API to the advanced. It is probably an error, if this is really what you want, you have to first clear the numeric filters."):null},s.prototype={constructor:s,clearRefinements:function(e){var t={numericRefinements:this._clearNumericRefinements(e),facetsRefinements:d.clearRefinement(this.facetsRefinements,e,"conjunctiveFacet"),facetsExcludes:d.clearRefinement(this.facetsExcludes,e,"exclude"),disjunctiveFacetsRefinements:d.clearRefinement(this.disjunctiveFacetsRefinements,e,"disjunctiveFacet"),hierarchicalFacetsRefinements:d.clearRefinement(this.hierarchicalFacetsRefinements,e,"hierarchicalFacet")};return t.numericRefinements===this.numericRefinements&&t.facetsRefinements===this.facetsRefinements&&t.facetsExcludes===this.facetsExcludes&&t.disjunctiveFacetsRefinements===this.disjunctiveFacetsRefinements&&t.hierarchicalFacetsRefinements===this.hierarchicalFacetsRefinements?this:this.setQueryParameters(t)},clearTags:function(){return void 0===this.tagFilters&&0===this.tagRefinements.length?this:this.setQueryParameters({tagFilters:void 0,tagRefinements:[]})},setIndex:function(e){return e===this.index?this:this.setQueryParameters({index:e})},setQuery:function(e){return e===this.query?this:this.setQueryParameters({query:e})},setPage:function(e){return e===this.page?this:this.setQueryParameters({page:e})},setFacets:function(e){return this.setQueryParameters({facets:e})},setDisjunctiveFacets:function(e){return this.setQueryParameters({disjunctiveFacets:e})},setHitsPerPage:function(e){return this.hitsPerPage===e?this:this.setQueryParameters({hitsPerPage:e})},setTypoTolerance:function(e){return this.typoTolerance===e?this:this.setQueryParameters({typoTolerance:e})},addNumericRefinement:function(e,t,i){var n=f(i);if(this.isNumericRefined(e,t,n))return this;var r=a({},this.numericRefinements);return r[e]=a({},r[e]),r[e][t]?(r[e][t]=r[e][t].slice(),r[e][t].push(n)):r[e][t]=[n],this.setQueryParameters({numericRefinements:r})},getConjunctiveRefinements:function(e){return this.isConjunctiveFacet(e)?this.facetsRefinements[e]||[]:[]},getDisjunctiveRefinements:function(e){return this.isDisjunctiveFacet(e)?this.disjunctiveFacetsRefinements[e]||[]:[]},getHierarchicalRefinement:function(e){return this.hierarchicalFacetsRefinements[e]||[]},getExcludeRefinements:function(e){return this.isConjunctiveFacet(e)?this.facetsExcludes[e]||[]:[]},removeNumericRefinement:function(e,t,i){var r=i;return void 0!==r?this.isNumericRefined(e,t,r)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements(function(i,s){return s===e&&i.op===t&&n(i.val,f(r))})}):this:void 0!==t?this.isNumericRefined(e,t)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements(function(i,n){return n===e&&i.op===t})}):this:this.isNumericRefined(e)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements(function(t,i){return i===e})}):this},getNumericRefinements:function(e){return this.numericRefinements[e]||{}},getNumericRefinement:function(e,t){return this.numericRefinements[e]&&this.numericRefinements[e][t]},_clearNumericRefinements:function(e){if(void 0===e)return l(this.numericRefinements)?{}:this.numericRefinements;if("string"==typeof e)return h(this.numericRefinements,[e]);if("function"==typeof e){var t=!1,i=this.numericRefinements,n=Object.keys(i).reduce(function(n,r){var s=i[r],a={};return s=s||{},Object.keys(s).forEach(function(i){var n=s[i]||[],c=[];n.forEach(function(t){e({val:t,op:i},r,"numeric")||c.push(t)}),c.length!==n.length&&(t=!0),a[i]=c}),n[r]=a,n},{});return t?n:this.numericRefinements}},addFacet:function(e){return this.isConjunctiveFacet(e)?this:this.setQueryParameters({facets:this.facets.concat([e])})},addDisjunctiveFacet:function(e){return this.isDisjunctiveFacet(e)?this:this.setQueryParameters({disjunctiveFacets:this.disjunctiveFacets.concat([e])})},addHierarchicalFacet:function(e){if(this.isHierarchicalFacet(e.name))throw new Error("Cannot declare two hierarchical facets with the same name: `"+e.name+"`");return this.setQueryParameters({hierarchicalFacets:this.hierarchicalFacets.concat([e])})},addFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return d.isRefined(this.facetsRefinements,e,t)?this:this.setQueryParameters({facetsRefinements:d.addRefinement(this.facetsRefinements,e,t)})},addExcludeRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return d.isRefined(this.facetsExcludes,e,t)?this:this.setQueryParameters({facetsExcludes:d.addRefinement(this.facetsExcludes,e,t)})},addDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return d.isRefined(this.disjunctiveFacetsRefinements,e,t)?this:this.setQueryParameters({disjunctiveFacetsRefinements:d.addRefinement(this.disjunctiveFacetsRefinements,e,t)})},addTagRefinement:function(e){if(this.isTagRefined(e))return this;var t={tagRefinements:this.tagRefinements.concat(e)};return this.setQueryParameters(t)},removeFacet:function(e){return this.isConjunctiveFacet(e)?this.clearRefinements(e).setQueryParameters({facets:this.facets.filter(function(t){return t!==e})}):this},removeDisjunctiveFacet:function(e){return this.isDisjunctiveFacet(e)?this.clearRefinements(e).setQueryParameters({disjunctiveFacets:this.disjunctiveFacets.filter(function(t){return t!==e})}):this},removeHierarchicalFacet:function(e){return this.isHierarchicalFacet(e)?this.clearRefinements(e).setQueryParameters({hierarchicalFacets:this.hierarchicalFacets.filter(function(t){return t.name!==e})}):this},removeFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return d.isRefined(this.facetsRefinements,e,t)?this.setQueryParameters({facetsRefinements:d.removeRefinement(this.facetsRefinements,e,t)}):this},removeExcludeRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return d.isRefined(this.facetsExcludes,e,t)?this.setQueryParameters({facetsExcludes:d.removeRefinement(this.facetsExcludes,e,t)}):this},removeDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return d.isRefined(this.disjunctiveFacetsRefinements,e,t)?this.setQueryParameters({disjunctiveFacetsRefinements:d.removeRefinement(this.disjunctiveFacetsRefinements,e,t)}):this},removeTagRefinement:function(e){if(!this.isTagRefined(e))return this;var t={tagRefinements:this.tagRefinements.filter(function(t){return t!==e})};return this.setQueryParameters(t)},toggleRefinement:function(e,t){return this.toggleFacetRefinement(e,t)},toggleFacetRefinement:function(e,t){if(this.isHierarchicalFacet(e))return this.toggleHierarchicalFacetRefinement(e,t);if(this.isConjunctiveFacet(e))return this.toggleConjunctiveFacetRefinement(e,t);if(this.isDisjunctiveFacet(e))return this.toggleDisjunctiveFacetRefinement(e,t);throw new Error("Cannot refine the undeclared facet "+e+"; it should be added to the helper options facets, disjunctiveFacets or hierarchicalFacets")},toggleConjunctiveFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return this.setQueryParameters({facetsRefinements:d.toggleRefinement(this.facetsRefinements,e,t)})},toggleExcludeFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return this.setQueryParameters({facetsExcludes:d.toggleRefinement(this.facetsExcludes,e,t)})},toggleDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return this.setQueryParameters({disjunctiveFacetsRefinements:d.toggleRefinement(this.disjunctiveFacetsRefinements,e,t)})},toggleHierarchicalFacetRefinement:function(e,t){if(!this.isHierarchicalFacet(e))throw new Error(e+" is not defined in the hierarchicalFacets attribute of the helper configuration");var i=this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(e)),n={};return void 0!==this.hierarchicalFacetsRefinements[e]&&this.hierarchicalFacetsRefinements[e].length>0&&(this.hierarchicalFacetsRefinements[e][0]===t||0===this.hierarchicalFacetsRefinements[e][0].indexOf(t+i))?-1===t.indexOf(i)?n[e]=[]:n[e]=[t.slice(0,t.lastIndexOf(i))]:n[e]=[t],this.setQueryParameters({hierarchicalFacetsRefinements:c({},n,this.hierarchicalFacetsRefinements)})},addHierarchicalFacetRefinement:function(e,t){if(this.isHierarchicalFacetRefined(e))throw new Error(e+" is already refined.");if(!this.isHierarchicalFacet(e))throw new Error(e+" is not defined in the hierarchicalFacets attribute of the helper configuration.");var i={};return i[e]=[t],this.setQueryParameters({hierarchicalFacetsRefinements:c({},i,this.hierarchicalFacetsRefinements)})},removeHierarchicalFacetRefinement:function(e){if(!this.isHierarchicalFacetRefined(e))return this;var t={};return t[e]=[],this.setQueryParameters({hierarchicalFacetsRefinements:c({},t,this.hierarchicalFacetsRefinements)})},toggleTagRefinement:function(e){return this.isTagRefined(e)?this.removeTagRefinement(e):this.addTagRefinement(e)},isDisjunctiveFacet:function(e){return this.disjunctiveFacets.indexOf(e)>-1},isHierarchicalFacet:function(e){return void 0!==this.getHierarchicalFacetByName(e)},isConjunctiveFacet:function(e){return this.facets.indexOf(e)>-1},isFacetRefined:function(e,t){return!!this.isConjunctiveFacet(e)&&d.isRefined(this.facetsRefinements,e,t)},isExcludeRefined:function(e,t){return!!this.isConjunctiveFacet(e)&&d.isRefined(this.facetsExcludes,e,t)},isDisjunctiveFacetRefined:function(e,t){return!!this.isDisjunctiveFacet(e)&&d.isRefined(this.disjunctiveFacetsRefinements,e,t)},isHierarchicalFacetRefined:function(e,t){if(!this.isHierarchicalFacet(e))return!1;var i=this.getHierarchicalRefinement(e);return t?-1!==i.indexOf(t):i.length>0},isNumericRefined:function(e,t,i){if(void 0===i&&void 0===t)return Boolean(this.numericRefinements[e]);var n=this.numericRefinements[e]&&void 0!==this.numericRefinements[e][t];if(void 0===i||!n)return n;var s=f(i),a=void 0!==r(this.numericRefinements[e][t],s);return n&&a},isTagRefined:function(e){return-1!==this.tagRefinements.indexOf(e)},getRefinedDisjunctiveFacets:function(){var e=this,t=u(Object.keys(this.numericRefinements).filter(function(t){return Object.keys(e.numericRefinements[t]).length>0}),this.disjunctiveFacets);return Object.keys(this.disjunctiveFacetsRefinements).filter(function(t){return e.disjunctiveFacetsRefinements[t].length>0}).concat(t).concat(this.getRefinedHierarchicalFacets())},getRefinedHierarchicalFacets:function(){var e=this;return u(this.hierarchicalFacets.map(function(e){return e.name}),Object.keys(this.hierarchicalFacetsRefinements).filter(function(t){return e.hierarchicalFacetsRefinements[t].length>0}))},getUnrefinedDisjunctiveFacets:function(){var e=this.getRefinedDisjunctiveFacets();return this.disjunctiveFacets.filter(function(t){return-1===e.indexOf(t)})},managedParameters:["index","facets","disjunctiveFacets","facetsRefinements","hierarchicalFacets","facetsExcludes","disjunctiveFacetsRefinements","numericRefinements","tagRefinements","hierarchicalFacetsRefinements"],getQueryParams:function(){var e=this.managedParameters,t={},i=this;return Object.keys(this).forEach(function(n){var r=i[n];-1===e.indexOf(n)&&void 0!==r&&(t[n]=r)}),t},setQueryParameter:function(e,t){if(this[e]===t)return this;var i={};return i[e]=t,this.setQueryParameters(i)},setQueryParameters:function(e){if(!e)return this;var t=s.validate(this,e);if(t)throw t;var i=this,n=s._parseNumbers(e),r=Object.keys(this).reduce(function(e,t){return e[t]=i[t],e},{}),a=Object.keys(n).reduce(function(e,t){var i=void 0!==e[t],r=void 0!==n[t];return i&&!r?h(e,[t]):(r&&(e[t]=n[t]),e)},r);return new this.constructor(a)},resetPage:function(){return void 0===this.page?this:this.setPage(0)},_getHierarchicalFacetSortBy:function(e){return e.sortBy||["isRefined:desc","name:asc"]},_getHierarchicalFacetSeparator:function(e){return e.separator||" > "},_getHierarchicalRootPath:function(e){return e.rootPath||null},_getHierarchicalShowParentLevel:function(e){return"boolean"!=typeof e.showParentLevel||e.showParentLevel},getHierarchicalFacetByName:function(e){return o(this.hierarchicalFacets,function(t){return t.name===e})},getHierarchicalFacetBreadcrumb:function(e){if(!this.isHierarchicalFacet(e))return[];var t=this.getHierarchicalRefinement(e)[0];if(!t)return[];var i=this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(e));return t.split(i).map(function(e){return e.trim()})},toString:function(){return JSON.stringify(this,null,2)}},t.exports=s},{"../functions/defaultsPure":10,"../functions/find":12,"../functions/intersection":16,"../functions/merge":17,"../functions/objectHasKeys":18,"../functions/omit":19,"../functions/valToNumber":21,"../utils/isValidUserToken":23,"./RefinementList":4}],6:[function(e,t,i){"use strict";function n(e){return function(t,i){var n=e.hierarchicalFacets[i],s=e.hierarchicalFacetsRefinements[n.name]&&e.hierarchicalFacetsRefinements[n.name][0]||"",a=e._getHierarchicalFacetSeparator(n),c=e._getHierarchicalRootPath(n),u=e._getHierarchicalShowParentLevel(n),f=o(e._getHierarchicalFacetSortBy(n)),h=t.every(function(e){return e.exhaustive}),l=r(f,a,c,u,s),m=t;return c&&(m=t.slice(c.split(a).length)),m.reduce(l,{name:e.hierarchicalFacets[i].name,count:null,isRefined:!0,path:null,escapedValue:null,exhaustive:h,data:null})}}function r(e,t,i,n,r){return function(o,f,h){var m=o;if(h>0){var d=0;for(m=o;d<h;){var v=m&&Array.isArray(m.data)?m.data:[];m=u(v,function(e){return e.isRefined}),d++}}if(m){var p=Object.keys(f.data).map(function(e){return[e,f.data[e]]}).filter(function(e){return s(e[0],m.path||i,r,t,i,n)});m.data=c(p.map(function(e){var i=e[0];return a(e[1],i,t,l(r),f.exhaustive)}),e[0],e[1])}return o}}function s(e,t,i,n,r,s){return(!r||0===e.indexOf(r)&&r!==e)&&(!r&&-1===e.indexOf(n)||r&&e.split(n).length-r.split(n).length==1||-1===e.indexOf(n)&&-1===i.indexOf(n)||0===i.indexOf(e)||0===e.indexOf(t+n)&&(s||0===e.indexOf(i)))}function a(e,t,i,n,r){var s=t.split(i);return{name:s[s.length-1].trim(),path:t,escapedValue:h(t),count:e,isRefined:n===t||0===n.indexOf(t+i),exhaustive:r,data:null}}t.exports=n;var c=e("../functions/orderBy"),u=e("../functions/find"),o=e("../functions/formatSort"),f=e("../functions/escapeFacetValue"),h=f.escapeFacetValue,l=f.unescapeFacetValue},{"../functions/escapeFacetValue":11,"../functions/find":12,"../functions/formatSort":14,"../functions/orderBy":20}],7:[function(e,t,i){"use strict";function n(e){var t={};return e.forEach(function(e,i){t[e]=i}),t}function r(e,t,i){t&&t[i]&&(e.stats=t[i])}function s(e,t){return F(e,function(e){return(e.attributes||[]).indexOf(t)>-1})}function a(e,t,i){var a=t[0];this._rawResults=t;var c=this;Object.keys(a).forEach(function(e){c[e]=a[e]}),Object.keys(i||{}).forEach(function(e){c[e]=i[e]}),this.processingTimeMS=t.reduce(function(e,t){return void 0===t.processingTimeMS?e:e+t.processingTimeMS},0),this.disjunctiveFacets=[],this.hierarchicalFacets=e.hierarchicalFacets.map(function(){return[]}),this.facets=[];var u=e.getRefinedDisjunctiveFacets(),o=n(e.facets),f=n(e.disjunctiveFacets),h=1,l=a.facets||{};Object.keys(l).forEach(function(t){var i=l[t],n=s(e.hierarchicalFacets,t);if(n){var u=n.attributes.indexOf(t),h=_(e.hierarchicalFacets,function(e){return e.name===n.name});c.hierarchicalFacets[h][u]={attribute:t,data:i,exhaustive:a.exhaustiveFacetsCount}}else{var m,d=-1!==e.disjunctiveFacets.indexOf(t),v=-1!==e.facets.indexOf(t);d&&(m=f[t],c.disjunctiveFacets[m]={name:t,data:i,exhaustive:a.exhaustiveFacetsCount},r(c.disjunctiveFacets[m],a.facets_stats,t)),v&&(m=o[t],c.facets[m]={name:t,data:i,exhaustive:a.exhaustiveFacetsCount},r(c.facets[m],a.facets_stats,t))}}),this.hierarchicalFacets=R(this.hierarchicalFacets),u.forEach(function(i){var n=t[h],s=n&&n.facets?n.facets:{},u=e.getHierarchicalFacetByName(i);Object.keys(s).forEach(function(t){var i,o=s[t];if(u){i=_(e.hierarchicalFacets,function(e){return e.name===u.name});var h=_(c.hierarchicalFacets[i],function(e){return e.attribute===t});if(-1===h)return;c.hierarchicalFacets[i][h].data=p({},c.hierarchicalFacets[i][h].data,o)}else{i=f[t];var l=a.facets&&a.facets[t]||{};c.disjunctiveFacets[i]={name:t,data:g({},o,l),exhaustive:n.exhaustiveFacetsCount},r(c.disjunctiveFacets[i],n.facets_stats,t),e.disjunctiveFacetsRefinements[t]&&e.disjunctiveFacetsRefinements[t].forEach(function(n){!c.disjunctiveFacets[i].data[n]&&e.disjunctiveFacetsRefinements[t].indexOf(P(n))>-1&&(c.disjunctiveFacets[i].data[n]=0)})}}),h++}),e.getRefinedHierarchicalFacets().forEach(function(i){var n=e.getHierarchicalFacetByName(i),r=e._getHierarchicalFacetSeparator(n),s=e.getHierarchicalRefinement(i);0===s.length||s[0].split(r).length<2||t.slice(h).forEach(function(t){var i=t&&t.facets?t.facets:{};Object.keys(i).forEach(function(t){var a=i[t],u=_(e.hierarchicalFacets,function(e){return e.name===n.name}),o=_(c.hierarchicalFacets[u],function(e){return e.attribute===t});if(-1!==o){var f={};if(s.length>0){var h=s[0].split(r)[0];f[h]=c.hierarchicalFacets[u][o].data[h]}c.hierarchicalFacets[u][o].data=g(f,a,c.hierarchicalFacets[u][o].data)}}),h++})}),Object.keys(e.facetsExcludes).forEach(function(t){var i=e.facetsExcludes[t],n=o[t];c.facets[n]={name:t,data:l[t],exhaustive:a.exhaustiveFacetsCount},i.forEach(function(e){c.facets[n]=c.facets[n]||{name:t},c.facets[n].data=c.facets[n].data||{},c.facets[n].data[e]=0})}),this.hierarchicalFacets=this.hierarchicalFacets.map(E(e)),this.facets=R(this.facets),this.disjunctiveFacets=R(this.disjunctiveFacets),this._state=e}function c(e,t){function i(e){return e.name===t}if(e._state.isConjunctiveFacet(t)){var n=F(e.facets,i);return n?Object.keys(n.data).map(function(i){var r=b(i);return{name:i,escapedValue:r,count:n.data[i],isRefined:e._state.isFacetRefined(t,r),isExcluded:e._state.isExcludeRefined(t,i)}}):[]}if(e._state.isDisjunctiveFacet(t)){var r=F(e.disjunctiveFacets,i);return r?Object.keys(r.data).map(function(i){var n=b(i);return{name:i,escapedValue:n,count:r.data[i],isRefined:e._state.isDisjunctiveFacetRefined(t,n)}}):[]}if(e._state.isHierarchicalFacet(t)){var s=F(e.hierarchicalFacets,i);if(!s)return s;var a=e._state.getHierarchicalFacetByName(t),c=e._state._getHierarchicalFacetSeparator(a),o=P(e._state.getHierarchicalRefinement(t)[0]||"");0===o.indexOf(a.rootPath)&&(o=o.replace(a.rootPath+c,""));var f=o.split(c);return f.unshift(t),u(s,f,0),s}}function u(e,t,i){e.isRefined=e.name===t[i],e.data&&e.data.forEach(function(e){u(e,t,i+1)})}function o(e,t,i,n){if(n=n||0,Array.isArray(t))return e(t,i[n]);if(!t.data||0===t.data.length)return t;var r=t.data.map(function(t){return o(e,t,i,n+1)}),s=e(r,i[n]);return g({data:s},t)}function f(e,t){return t.sort(e)}function h(e,t){var i=[],n=[],r=t.order||[],s=r.reduce(function(e,t,i){return e[t]=i,e},{});e.forEach(function(e){var t=e.path||e.name;void 0!==s[t]?i[s[t]]=e:n.push(e)}),i=i.filter(function(e){return e});var a,c=t.sortRemainingBy;return"hidden"===c?i:(a="alpha"===c?[["path","name"],["asc","asc"]]:[["count"],["desc"]],i.concat(y(n,a[0],a[1])))}function l(e,t){return e.renderingContent&&e.renderingContent.facetOrdering&&e.renderingContent.facetOrdering.values&&e.renderingContent.facetOrdering.values[t]}function m(e,t){var i=F(e,function(e){return e.name===t});return i&&i.stats}function d(e,t,i,n,r){var s=F(r,function(e){return e.name===i}),a=s&&s.data&&s.data[n]?s.data[n]:0,c=s&&s.exhaustive||!1;return{type:t,attributeName:i,name:n,count:a,exhaustive:c}}function v(e,t,i,n){var r=e.getHierarchicalFacetByName(t),s=e._getHierarchicalFacetSeparator(r),a=i.split(s),c=F(n,function(e){return e.name===t}),u=a.reduce(function(e,t){var i=e&&F(e.data,function(e){return e.name===t});return void 0!==i?i:e},c),o=u&&u.count||0,f=u&&u.exhaustive||!1,h=u&&u.path||"";return{type:"hierarchical",attributeName:t,name:h,count:o,exhaustive:f}}var p=e("../functions/merge"),g=e("../functions/defaultsPure"),y=e("../functions/orderBy"),R=e("../functions/compact"),F=e("../functions/find"),_=e("../functions/findIndex"),j=e("../functions/formatSort"),x=e("../functions/escapeFacetValue"),b=x.escapeFacetValue,P=x.unescapeFacetValue,E=e("./generate-hierarchical-tree");a.prototype.getFacetByName=function(e){function t(t){return t.name===e}return F(this.facets,t)||F(this.disjunctiveFacets,t)||F(this.hierarchicalFacets,t)},a.DEFAULT_SORT=["isRefined:desc","count:desc","name:asc"],a.prototype.getFacetValues=function(e,t){var i=c(this,e);if(i){var n,r=g({},t,{sortBy:a.DEFAULT_SORT,facetOrdering:!(t&&t.sortBy)}),s=this;if(Array.isArray(i))n=[e];else{n=s._state.getHierarchicalFacetByName(i.name).attributes}return o(function(e,t){if(r.facetOrdering){var i=l(s,t);if(i)return h(e,i)}if(Array.isArray(r.sortBy)){var n=j(r.sortBy,a.DEFAULT_SORT);return y(e,n[0],n[1])}if("function"==typeof r.sortBy)return f(r.sortBy,e);throw new Error("options.sortBy is optional but if defined it must be either an array of string (predicates) or a sorting function")},i,n)}},a.prototype.getFacetStats=function(e){return this._state.isConjunctiveFacet(e)?m(this.facets,e):this._state.isDisjunctiveFacet(e)?m(this.disjunctiveFacets,e):void 0},a.prototype.getRefinements=function(){var e=this._state,t=this,i=[];return Object.keys(e.facetsRefinements).forEach(function(n){e.facetsRefinements[n].forEach(function(r){i.push(d(e,"facet",n,r,t.facets))})}),Object.keys(e.facetsExcludes).forEach(function(n){e.facetsExcludes[n].forEach(function(r){i.push(d(e,"exclude",n,r,t.facets))})}),Object.keys(e.disjunctiveFacetsRefinements).forEach(function(n){e.disjunctiveFacetsRefinements[n].forEach(function(r){i.push(d(e,"disjunctive",n,r,t.disjunctiveFacets))})}),Object.keys(e.hierarchicalFacetsRefinements).forEach(function(n){e.hierarchicalFacetsRefinements[n].forEach(function(r){i.push(v(e,n,r,t.hierarchicalFacets))})}),Object.keys(e.numericRefinements).forEach(function(t){var n=e.numericRefinements[t];Object.keys(n).forEach(function(e){n[e].forEach(function(n){i.push({
type:"numeric",attributeName:t,name:n,numericValue:n,operator:e})})})}),e.tagRefinements.forEach(function(e){i.push({type:"tag",attributeName:"_tags",name:e})}),i},t.exports=a},{"../functions/compact":9,"../functions/defaultsPure":10,"../functions/escapeFacetValue":11,"../functions/find":12,"../functions/findIndex":13,"../functions/formatSort":14,"../functions/merge":17,"../functions/orderBy":20,"./generate-hierarchical-tree":6}],8:[function(e,t,i){"use strict";function n(e,t,i){"function"==typeof e.addAlgoliaAgent&&e.addAlgoliaAgent("JS Helper ("+v+")"),this.setClient(e);var n=i||{};n.index=t,this.state=a.make(n),this.lastResults=null,this._queryId=0,this._lastQueryIdReceived=-1,this.derivedHelpers=[],this._currentNbQueries=0}function r(e){if(e<0)throw new Error("Page requested below 0.");return this._change({state:this.state.setPage(e),isPageReset:!1}),this}function s(){return this.state.page}var a=e("./SearchParameters"),c=e("./SearchResults"),u=e("./DerivedHelper"),o=e("./requestBuilder"),f=e("@algolia/events"),h=e("./functions/inherits"),l=e("./functions/objectHasKeys"),m=e("./functions/omit"),d=e("./functions/merge"),v=e("./version"),p=e("./functions/escapeFacetValue").escapeFacetValue;h(n,f),n.prototype.search=function(){return this._search({onlyWithDerivedHelpers:!1}),this},n.prototype.searchOnlyWithDerivedHelpers=function(){return this._search({onlyWithDerivedHelpers:!0}),this},n.prototype.getQuery=function(){var e=this.state;return o._getHitsSearchParams(e)},n.prototype.searchOnce=function(e,t){var i=e?this.state.setQueryParameters(e):this.state,n=o._getQueries(i.index,i),r=this;return this._currentNbQueries++,this.emit("searchOnce",{state:i}),t?void this.client.search(n).then(function(e){r._currentNbQueries--,0===r._currentNbQueries&&r.emit("searchQueueEmpty"),t(null,new c(i,e.results),i)}).catch(function(e){r._currentNbQueries--,0===r._currentNbQueries&&r.emit("searchQueueEmpty"),t(e,null,i)}):this.client.search(n).then(function(e){return r._currentNbQueries--,0===r._currentNbQueries&&r.emit("searchQueueEmpty"),{content:new c(i,e.results),state:i,_originalResponse:e}},function(e){throw r._currentNbQueries--,0===r._currentNbQueries&&r.emit("searchQueueEmpty"),e})},n.prototype.findAnswers=function(e){console.warn("[algoliasearch-helper] answers is no longer supported");var t=this.state,i=this.derivedHelpers[0];if(!i)return Promise.resolve([]);var n=i.getModifiedState(t),r=d({attributesForPrediction:e.attributesForPrediction,nbHits:e.nbHits},{params:m(o._getHitsSearchParams(n),["attributesToSnippet","hitsPerPage","restrictSearchableAttributes","snippetEllipsisText"])}),s="search for answers was called, but this client does not have a function client.initIndex(index).findAnswers";if("function"!=typeof this.client.initIndex)throw new Error(s);var a=this.client.initIndex(n.index);if("function"!=typeof a.findAnswers)throw new Error(s);return a.findAnswers(n.query,e.queryLanguages,r)},n.prototype.searchForFacetValues=function(e,t,i,n){var r="function"==typeof this.client.searchForFacetValues,s="function"==typeof this.client.initIndex;if(!r&&!s&&"function"!=typeof this.client.search)throw new Error("search for facet values (searchable) was called, but this client does not have a function client.searchForFacetValues or client.initIndex(index).searchForFacetValues");var a=this.state.setQueryParameters(n||{}),c=a.isDisjunctiveFacet(e),u=o.getSearchForFacetQuery(e,t,i,a);this._currentNbQueries++;var f,h=this;return r?f=this.client.searchForFacetValues([{indexName:a.index,params:u}]):s?f=this.client.initIndex(a.index).searchForFacetValues(u):(delete u.facetName,f=this.client.search([{type:"facet",facet:e,indexName:a.index,params:u}]).then(function(e){return e.results[0]})),this.emit("searchForFacetValues",{state:a,facet:e,query:t}),f.then(function(t){return h._currentNbQueries--,0===h._currentNbQueries&&h.emit("searchQueueEmpty"),t=Array.isArray(t)?t[0]:t,t.facetHits.forEach(function(t){t.escapedValue=p(t.value),t.isRefined=c?a.isDisjunctiveFacetRefined(e,t.escapedValue):a.isFacetRefined(e,t.escapedValue)}),t},function(e){throw h._currentNbQueries--,0===h._currentNbQueries&&h.emit("searchQueueEmpty"),e})},n.prototype.setQuery=function(e){return this._change({state:this.state.resetPage().setQuery(e),isPageReset:!0}),this},n.prototype.clearRefinements=function(e){return this._change({state:this.state.resetPage().clearRefinements(e),isPageReset:!0}),this},n.prototype.clearTags=function(){return this._change({state:this.state.resetPage().clearTags(),isPageReset:!0}),this},n.prototype.addDisjunctiveFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addDisjunctiveFacetRefinement(e,t),isPageReset:!0}),this},n.prototype.addDisjunctiveRefine=function(){return this.addDisjunctiveFacetRefinement.apply(this,arguments)},n.prototype.addHierarchicalFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addHierarchicalFacetRefinement(e,t),isPageReset:!0}),this},n.prototype.addNumericRefinement=function(e,t,i){return this._change({state:this.state.resetPage().addNumericRefinement(e,t,i),isPageReset:!0}),this},n.prototype.addFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addFacetRefinement(e,t),isPageReset:!0}),this},n.prototype.addRefine=function(){return this.addFacetRefinement.apply(this,arguments)},n.prototype.addFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().addExcludeRefinement(e,t),isPageReset:!0}),this},n.prototype.addExclude=function(){return this.addFacetExclusion.apply(this,arguments)},n.prototype.addTag=function(e){return this._change({state:this.state.resetPage().addTagRefinement(e),isPageReset:!0}),this},n.prototype.removeNumericRefinement=function(e,t,i){return this._change({state:this.state.resetPage().removeNumericRefinement(e,t,i),isPageReset:!0}),this},n.prototype.removeDisjunctiveFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().removeDisjunctiveFacetRefinement(e,t),isPageReset:!0}),this},n.prototype.removeDisjunctiveRefine=function(){return this.removeDisjunctiveFacetRefinement.apply(this,arguments)},n.prototype.removeHierarchicalFacetRefinement=function(e){return this._change({state:this.state.resetPage().removeHierarchicalFacetRefinement(e),isPageReset:!0}),this},n.prototype.removeFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().removeFacetRefinement(e,t),isPageReset:!0}),this},n.prototype.removeRefine=function(){return this.removeFacetRefinement.apply(this,arguments)},n.prototype.removeFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().removeExcludeRefinement(e,t),isPageReset:!0}),this},n.prototype.removeExclude=function(){return this.removeFacetExclusion.apply(this,arguments)},n.prototype.removeTag=function(e){return this._change({state:this.state.resetPage().removeTagRefinement(e),isPageReset:!0}),this},n.prototype.toggleFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().toggleExcludeFacetRefinement(e,t),isPageReset:!0}),this},n.prototype.toggleExclude=function(){return this.toggleFacetExclusion.apply(this,arguments)},n.prototype.toggleRefinement=function(e,t){return this.toggleFacetRefinement(e,t)},n.prototype.toggleFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().toggleFacetRefinement(e,t),isPageReset:!0}),this},n.prototype.toggleRefine=function(){return this.toggleFacetRefinement.apply(this,arguments)},n.prototype.toggleTag=function(e){return this._change({state:this.state.resetPage().toggleTagRefinement(e),isPageReset:!0}),this},n.prototype.nextPage=function(){var e=this.state.page||0;return this.setPage(e+1)},n.prototype.previousPage=function(){var e=this.state.page||0;return this.setPage(e-1)},n.prototype.setCurrentPage=r,n.prototype.setPage=r,n.prototype.setIndex=function(e){return this._change({state:this.state.resetPage().setIndex(e),isPageReset:!0}),this},n.prototype.setQueryParameter=function(e,t){return this._change({state:this.state.resetPage().setQueryParameter(e,t),isPageReset:!0}),this},n.prototype.setState=function(e){return this._change({state:a.make(e),isPageReset:!1}),this},n.prototype.overrideStateWithoutTriggeringChangeEvent=function(e){return this.state=new a(e),this},n.prototype.hasRefinements=function(e){return!!l(this.state.getNumericRefinements(e))||(this.state.isConjunctiveFacet(e)?this.state.isFacetRefined(e):this.state.isDisjunctiveFacet(e)?this.state.isDisjunctiveFacetRefined(e):!!this.state.isHierarchicalFacet(e)&&this.state.isHierarchicalFacetRefined(e))},n.prototype.isExcluded=function(e,t){return this.state.isExcludeRefined(e,t)},n.prototype.isDisjunctiveRefined=function(e,t){return this.state.isDisjunctiveFacetRefined(e,t)},n.prototype.hasTag=function(e){return this.state.isTagRefined(e)},n.prototype.isTagRefined=function(){return this.hasTagRefinements.apply(this,arguments)},n.prototype.getIndex=function(){return this.state.index},n.prototype.getCurrentPage=s,n.prototype.getPage=s,n.prototype.getTags=function(){return this.state.tagRefinements},n.prototype.getRefinements=function(e){var t=[];if(this.state.isConjunctiveFacet(e)){this.state.getConjunctiveRefinements(e).forEach(function(e){t.push({value:e,type:"conjunctive"})});this.state.getExcludeRefinements(e).forEach(function(e){t.push({value:e,type:"exclude"})})}else if(this.state.isDisjunctiveFacet(e)){var i=this.state.getDisjunctiveRefinements(e);i.forEach(function(e){t.push({value:e,type:"disjunctive"})})}var n=this.state.getNumericRefinements(e);return Object.keys(n).forEach(function(e){var i=n[e];t.push({value:i,operator:e,type:"numeric"})}),t},n.prototype.getNumericRefinement=function(e,t){return this.state.getNumericRefinement(e,t)},n.prototype.getHierarchicalFacetBreadcrumb=function(e){return this.state.getHierarchicalFacetBreadcrumb(e)},n.prototype._search=function(e){var t=this.state,i=[],n=[];e.onlyWithDerivedHelpers||(n=o._getQueries(t.index,t),i.push({state:t,queriesCount:n.length,helper:this}),this.emit("search",{state:t,results:this.lastResults}));var r=this.derivedHelpers.map(function(e){var n=e.getModifiedState(t),r=n.index?o._getQueries(n.index,n):[];return i.push({state:n,queriesCount:r.length,helper:e}),e.emit("search",{state:n,results:e.lastResults}),r}),s=Array.prototype.concat.apply(n,r),a=this._queryId++;if(this._currentNbQueries++,!s.length)return Promise.resolve({results:[]}).then(this._dispatchAlgoliaResponse.bind(this,i,a));try{this.client.search(s).then(this._dispatchAlgoliaResponse.bind(this,i,a)).catch(this._dispatchAlgoliaError.bind(this,a))}catch(e){this.emit("error",{error:e})}},n.prototype._dispatchAlgoliaResponse=function(e,t,i){if(!(t<this._lastQueryIdReceived)){this._currentNbQueries-=t-this._lastQueryIdReceived,this._lastQueryIdReceived=t,0===this._currentNbQueries&&this.emit("searchQueueEmpty");var n=i.results.slice();e.forEach(function(e){var t=e.state,i=e.queriesCount,r=e.helper,s=n.splice(0,i);if(!t.index)return void r.emit("result",{results:null,state:t});r.lastResults=new c(t,s),r.emit("result",{results:r.lastResults,state:t})})}},n.prototype._dispatchAlgoliaError=function(e,t){e<this._lastQueryIdReceived||(this._currentNbQueries-=e-this._lastQueryIdReceived,this._lastQueryIdReceived=e,this.emit("error",{error:t}),0===this._currentNbQueries&&this.emit("searchQueueEmpty"))},n.prototype.containsRefinement=function(e,t,i,n){return e||0!==t.length||0!==i.length||0!==n.length},n.prototype._hasDisjunctiveRefinements=function(e){return this.state.disjunctiveRefinements[e]&&this.state.disjunctiveRefinements[e].length>0},n.prototype._change=function(e){var t=e.state,i=e.isPageReset;t!==this.state&&(this.state=t,this.emit("change",{state:this.state,results:this.lastResults,isPageReset:i}))},n.prototype.clearCache=function(){return this.client.clearCache&&this.client.clearCache(),this},n.prototype.setClient=function(e){return this.client===e?this:("function"==typeof e.addAlgoliaAgent&&e.addAlgoliaAgent("JS Helper ("+v+")"),this.client=e,this)},n.prototype.getClient=function(){return this.client},n.prototype.derive=function(e){var t=new u(this,e);return this.derivedHelpers.push(t),t},n.prototype.detachDerivedHelper=function(e){var t=this.derivedHelpers.indexOf(e);if(-1===t)throw new Error("Derived helper already detached");this.derivedHelpers.splice(t,1)},n.prototype.hasPendingRequests=function(){return this._currentNbQueries>0},t.exports=n},{"./DerivedHelper":3,"./SearchParameters":5,"./SearchResults":7,"./functions/escapeFacetValue":11,"./functions/inherits":15,"./functions/merge":17,"./functions/objectHasKeys":18,"./functions/omit":19,"./requestBuilder":22,"./version":24,"@algolia/events":2}],9:[function(e,t,i){"use strict";t.exports=function(e){return Array.isArray(e)?e.filter(Boolean):[]}},{}],10:[function(e,t,i){"use strict";t.exports=function(){return Array.prototype.slice.call(arguments).reduceRight(function(e,t){return Object.keys(Object(t)).forEach(function(i){void 0!==t[i]&&(void 0!==e[i]&&delete e[i],e[i]=t[i])}),e},{})}},{}],11:[function(e,t,i){"use strict";function n(e){return"string"!=typeof e?e:String(e).replace(/^-/,"\\-")}function r(e){return"string"!=typeof e?e:e.replace(/^\\-/,"-")}t.exports={escapeFacetValue:n,unescapeFacetValue:r}},{}],12:[function(e,t,i){"use strict";t.exports=function(e,t){if(Array.isArray(e))for(var i=0;i<e.length;i++)if(t(e[i]))return e[i]}},{}],13:[function(e,t,i){"use strict";t.exports=function(e,t){if(!Array.isArray(e))return-1;for(var i=0;i<e.length;i++)if(t(e[i]))return i;return-1}},{}],14:[function(e,t,i){"use strict";var n=e("./find");t.exports=function(e,t){var i=(t||[]).map(function(e){return e.split(":")});return e.reduce(function(e,t){var r=t.split(":"),s=n(i,function(e){return e[0]===r[0]});return r.length>1||!s?(e[0].push(r[0]),e[1].push(r[1]),e):(e[0].push(s[0]),e[1].push(s[1]),e)},[[],[]])}},{"./find":12}],15:[function(e,t,i){"use strict";function n(e,t){e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}t.exports=n},{}],16:[function(e,t,i){"use strict";function n(e,t){return e.filter(function(i,n){return t.indexOf(i)>-1&&e.indexOf(i)===n})}t.exports=n},{}],17:[function(e,t,i){"use strict";function n(e){return"object"==typeof e&&null!==e?s(Array.isArray(e)?[]:{},e):e}function r(e){return"function"==typeof e||Array.isArray(e)||"[object Object]"===Object.prototype.toString.call(e)}function s(e,t){if(e===t)return e;for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)&&"__proto__"!==i&&"constructor"!==i){var a=t[i],c=e[i];void 0!==c&&void 0===a||(r(c)&&r(a)?e[i]=s(c,a):e[i]=n(a))}return e}function a(e){r(e)||(e={});for(var t=1,i=arguments.length;t<i;t++){var n=arguments[t];r(n)&&s(e,n)}return e}t.exports=a},{}],18:[function(e,t,i){"use strict";function n(e){return e&&Object.keys(e).length>0}t.exports=n},{}],19:[function(e,t,i){"use strict";function n(e,t){if(null===e)return{};var i,n,r={},s=Object.keys(e);for(n=0;n<s.length;n++)i=s[n],t.indexOf(i)>=0||(r[i]=e[i]);return r}t.exports=n},{}],20:[function(e,t,i){"use strict";function n(e,t){if(e!==t){var i=void 0!==e,n=null===e,r=void 0!==t,s=null===t;if(!s&&e>t||n&&r||!i)return 1;if(!n&&e<t||s&&i||!r)return-1}return 0}function r(e,t,i){if(!Array.isArray(e))return[];Array.isArray(i)||(i=[]);var r=e.map(function(e,i){return{criteria:t.map(function(t){return e[t]}),index:i,value:e}});return r.sort(function(e,t){for(var r=-1;++r<e.criteria.length;){var s=n(e.criteria[r],t.criteria[r]);if(s)return r>=i.length?s:"desc"===i[r]?-s:s}return e.index-t.index}),r.map(function(e){return e.value})}t.exports=r},{}],21:[function(e,t,i){"use strict";function n(e){if("number"==typeof e)return e;if("string"==typeof e)return parseFloat(e);if(Array.isArray(e))return e.map(n);throw new Error("The value should be a number, a parsable string or an array of those.")}t.exports=n},{}],22:[function(e,t,i){"use strict";function n(e){return Object.keys(e).sort(function(e,t){return e.localeCompare(t)}).reduce(function(t,i){return t[i]=e[i],t},{})}var r=e("./functions/merge"),s={_getQueries:function(e,t){var i=[];return i.push({indexName:e,params:s._getHitsSearchParams(t)}),t.getRefinedDisjunctiveFacets().forEach(function(n){i.push({indexName:e,params:s._getDisjunctiveFacetSearchParams(t,n)})}),t.getRefinedHierarchicalFacets().forEach(function(n){var r=t.getHierarchicalFacetByName(n),a=t.getHierarchicalRefinement(n),c=t._getHierarchicalFacetSeparator(r);if(a.length>0&&a[0].split(c).length>1){var u=a[0].split(c).slice(0,-1).reduce(function(e,t,i){return e.concat({attribute:r.attributes[i],value:0===i?t:[e[e.length-1].value,t].join(c)})},[]);u.forEach(function(n,a){function c(e){return r.attributes.some(function(t){return t===e.split(":")[0]})}var o=s._getDisjunctiveFacetSearchParams(t,n.attribute,0===a),f=(o.facetFilters||[]).reduce(function(e,t){if(Array.isArray(t)){var i=t.filter(function(e){return!c(e)});i.length>0&&e.push(i)}return"string"!=typeof t||c(t)||e.push(t),e},[]),h=u[a-1];o.facetFilters=a>0?f.concat(h.attribute+":"+h.value):f.length>0?f:void 0,i.push({indexName:e,params:o})})}}),i},_getHitsSearchParams:function(e){var t=e.facets.concat(e.disjunctiveFacets).concat(s._getHitsHierarchicalFacetsAttributes(e)),i=s._getFacetFilters(e),a=s._getNumericFilters(e),c=s._getTagFilters(e),u={facets:t.indexOf("*")>-1?["*"]:t,tagFilters:c};return i.length>0&&(u.facetFilters=i),a.length>0&&(u.numericFilters=a),n(r({},e.getQueryParams(),u))},_getDisjunctiveFacetSearchParams:function(e,t,i){var a=s._getFacetFilters(e,t,i),c=s._getNumericFilters(e,t),u=s._getTagFilters(e),o={hitsPerPage:0,page:0,analytics:!1,clickAnalytics:!1};u.length>0&&(o.tagFilters=u);var f=e.getHierarchicalFacetByName(t);return o.facets=f?s._getDisjunctiveHierarchicalFacetAttribute(e,f,i):t,c.length>0&&(o.numericFilters=c),a.length>0&&(o.facetFilters=a),n(r({},e.getQueryParams(),o))},_getNumericFilters:function(e,t){if(e.numericFilters)return e.numericFilters;var i=[];return Object.keys(e.numericRefinements).forEach(function(n){var r=e.numericRefinements[n]||{};Object.keys(r).forEach(function(e){var s=r[e]||[];t!==n&&s.forEach(function(t){if(Array.isArray(t)){var r=t.map(function(t){return n+e+t});i.push(r)}else i.push(n+e+t)})})}),i},_getTagFilters:function(e){return e.tagFilters?e.tagFilters:e.tagRefinements.join(",")},_getFacetFilters:function(e,t,i){var n=[],r=e.facetsRefinements||{};Object.keys(r).forEach(function(e){(r[e]||[]).forEach(function(t){n.push(e+":"+t)})});var s=e.facetsExcludes||{};Object.keys(s).forEach(function(e){(s[e]||[]).forEach(function(t){n.push(e+":-"+t)})});var a=e.disjunctiveFacetsRefinements||{};Object.keys(a).forEach(function(e){var i=a[e]||[];if(e!==t&&i&&0!==i.length){var r=[];i.forEach(function(t){r.push(e+":"+t)}),n.push(r)}});var c=e.hierarchicalFacetsRefinements||{};return Object.keys(c).forEach(function(r){var s=c[r]||[],a=s[0];if(void 0!==a){var u,o,f=e.getHierarchicalFacetByName(r),h=e._getHierarchicalFacetSeparator(f),l=e._getHierarchicalRootPath(f);if(t===r){if(-1===a.indexOf(h)||!l&&!0===i||l&&l.split(h).length===a.split(h).length)return;l?(o=l.split(h).length-1,a=l):(o=a.split(h).length-2,a=a.slice(0,a.lastIndexOf(h))),u=f.attributes[o]}else o=a.split(h).length-1,u=f.attributes[o];u&&n.push([u+":"+a])}}),n},_getHitsHierarchicalFacetsAttributes:function(e){var t=[];return e.hierarchicalFacets.reduce(function(t,i){var n=e.getHierarchicalRefinement(i.name)[0];if(!n)return t.push(i.attributes[0]),t;var r=e._getHierarchicalFacetSeparator(i),s=n.split(r).length,a=i.attributes.slice(0,s+1);return t.concat(a)},t)},_getDisjunctiveHierarchicalFacetAttribute:function(e,t,i){var n=e._getHierarchicalFacetSeparator(t);if(!0===i){var r=e._getHierarchicalRootPath(t),s=0;return r&&(s=r.split(n).length),[t.attributes[s]]}var a=e.getHierarchicalRefinement(t.name)[0]||"",c=a.split(n).length-1;return t.attributes.slice(0,c+1)},getSearchForFacetQuery:function(e,t,i,a){var c=a.isDisjunctiveFacet(e)?a.clearRefinements(e):a,u={facetQuery:t,facetName:e};return"number"==typeof i&&(u.maxFacetHits=i),n(r({},s._getHitsSearchParams(c),u))}};t.exports=s},{"./functions/merge":17}],23:[function(e,t,i){"use strict";t.exports=function(e){return null!==e&&/^[a-zA-Z0-9_-]{1,64}$/.test(e)}},{}],24:[function(e,t,i){"use strict";t.exports="3.13.3"},{}]},{},[1])(1)});
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.algoliasearchHelper=e()}}(function(){return function(){function e(t,i,n){function r(a,c){if(!i[a]){if(!t[a]){var u="function"==typeof require&&require;if(!c&&u)return u(a,!0);if(s)return s(a,!0);var o=new Error("Cannot find module '"+a+"'");throw o.code="MODULE_NOT_FOUND",o}var f=i[a]={exports:{}};t[a][0].call(f.exports,function(e){return r(t[a][1][e]||e)},f,f.exports,e,t,i,n)}return i[a].exports}for(var s="function"==typeof require&&require,a=0;a<n.length;a++)r(n[a]);return r}return e}()({1:[function(e,t,i){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function s(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function c(e){return void 0===e}t.exports=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!s(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,i,n,s,u,o;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var f=new Error('Uncaught, unspecified "error" event. ('+t+")");throw f.context=t,f}if(i=this._events[e],c(i))return!1;if(r(i))switch(arguments.length){case 1:i.call(this);break;case 2:i.call(this,arguments[1]);break;case 3:i.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),i.apply(this,s)}else if(a(i))for(s=Array.prototype.slice.call(arguments,1),o=i.slice(),n=o.length,u=0;u<n;u++)o[u].apply(this,s);return!0},n.prototype.addListener=function(e,t){var i;if(!r(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,r(t.listener)?t.listener:t),this._events[e]?a(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,a(this._events[e])&&!this._events[e].warned&&(i=c(this._maxListeners)?n.defaultMaxListeners:this._maxListeners)&&i>0&&this._events[e].length>i&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function i(){this.removeListener(e,i),n||(n=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var n=!1;return i.listener=t,this.on(e,i),this},n.prototype.removeListener=function(e,t){var i,n,s,c;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(i=this._events[e],s=i.length,n=-1,i===t||r(i.listener)&&i.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(a(i)){for(c=s;c-- >0;)if(i[c]===t||i[c].listener&&i[c].listener===t){n=c;break}if(n<0)return this;1===i.length?(i.length=0,delete this._events[e]):i.splice(n,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,i;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(i=this._events[e],r(i))this.removeListener(e,i);else if(i)for(;i.length;)this.removeListener(e,i[i.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},{}],2:[function(e,t,i){"use strict";function n(e,t,i){return new r(e,t,i)}var r=e("./src/algoliasearch.helper"),s=e("./src/SearchParameters"),a=e("./src/SearchResults");n.version=e("./src/version"),n.AlgoliaSearchHelper=r,n.SearchParameters=s,n.SearchResults=a,t.exports=n},{"./src/SearchParameters":5,"./src/SearchResults":7,"./src/algoliasearch.helper":8,"./src/version":24}],3:[function(e,t,i){"use strict";function n(e,t){this.main=e,this.fn=t,this.lastResults=null}var r=e("@algolia/events");e("../functions/inherits")(n,r),n.prototype.detach=function(){this.removeAllListeners(),this.main.detachDerivedHelper(this)},n.prototype.getModifiedState=function(e){return this.fn(e)},t.exports=n},{"../functions/inherits":15,"@algolia/events":1}],4:[function(e,t,i){"use strict";var n=e("../functions/defaultsPure"),r=e("../functions/omit"),s=e("../functions/objectHasKeys"),a={addRefinement:function(e,t,i){if(a.isRefined(e,t,i))return e;var r=""+i,s=e[t]?e[t].concat(r):[r],c={};return c[t]=s,n({},c,e)},removeRefinement:function(e,t,i){if(void 0===i)return a.clearRefinement(e,function(e,i){return t===i});var n=""+i;return a.clearRefinement(e,function(e,i){return t===i&&n===e})},toggleRefinement:function(e,t,i){if(void 0===i)throw new Error("toggleRefinement should be used with a value");return a.isRefined(e,t,i)?a.removeRefinement(e,t,i):a.addRefinement(e,t,i)},clearRefinement:function(e,t,i){if(void 0===t)return s(e)?{}:e;if("string"==typeof t)return r(e,[t]);if("function"==typeof t){var n=!1,a=Object.keys(e).reduce(function(r,s){var a=e[s]||[],c=a.filter(function(e){return!t(e,s,i)});return c.length!==a.length&&(n=!0),r[s]=c,r},{});return n?a:e}},isRefined:function(e,t,i){var n=Boolean(e[t])&&e[t].length>0;if(void 0===i||!n)return n;var r=""+i;return-1!==e[t].indexOf(r)}};t.exports=a},{"../functions/defaultsPure":10,"../functions/objectHasKeys":18,"../functions/omit":19}],5:[function(e,t,i){"use strict";function n(e,t){return Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every(function(e,i){return n(t[i],e)}):e===t}function r(e,t){return o(e,function(e){return n(e,t)})}function s(e){var t=e?s._parseNumbers(e):{};void 0===t.userToken||m(t.userToken)||console.warn("[algoliasearch-helper] The `userToken` parameter is invalid. This can lead to wrong analytics.\n - Format: [a-zA-Z0-9_-]{1,64}"),this.facets=t.facets||[],this.disjunctiveFacets=t.disjunctiveFacets||[],this.hierarchicalFacets=t.hierarchicalFacets||[],this.facetsRefinements=t.facetsRefinements||{},this.facetsExcludes=t.facetsExcludes||{},this.disjunctiveFacetsRefinements=t.disjunctiveFacetsRefinements||{},this.numericRefinements=t.numericRefinements||{},this.tagRefinements=t.tagRefinements||[],this.hierarchicalFacetsRefinements=t.hierarchicalFacetsRefinements||{};var i=this;Object.keys(t).forEach(function(e){var n=-1!==s.PARAMETERS.indexOf(e),r=void 0!==t[e];!n&&r&&(i[e]=t[e])})}var a=e("../functions/merge"),c=e("../functions/defaultsPure"),u=e("../functions/intersection"),o=e("../functions/find"),f=e("../functions/valToNumber"),h=e("../functions/omit"),l=e("../functions/objectHasKeys"),m=e("../utils/isValidUserToken"),d=e("./RefinementList");s.PARAMETERS=Object.keys(new s),s._parseNumbers=function(e){if(e instanceof s)return e;var t={};if(["aroundPrecision","aroundRadius","getRankingInfo","minWordSizefor2Typos","minWordSizefor1Typo","page","maxValuesPerFacet","distinct","minimumAroundRadius","hitsPerPage","minProximity"].forEach(function(i){var n=e[i];if("string"==typeof n){var r=parseFloat(n);t[i]=isNaN(r)?n:r}}),Array.isArray(e.insideBoundingBox)&&(t.insideBoundingBox=e.insideBoundingBox.map(function(e){return Array.isArray(e)?e.map(function(e){return parseFloat(e)}):e})),e.numericRefinements){var i={};Object.keys(e.numericRefinements).forEach(function(t){var n=e.numericRefinements[t]||{};i[t]={},Object.keys(n).forEach(function(e){var r=n[e],s=r.map(function(e){return Array.isArray(e)?e.map(function(e){return"string"==typeof e?parseFloat(e):e}):"string"==typeof e?parseFloat(e):e});i[t][e]=s})}),t.numericRefinements=i}return a({},e,t)},s.make=function(e){var t=new s(e);return(e.hierarchicalFacets||[]).forEach(function(e){if(e.rootPath){var i=t.getHierarchicalRefinement(e.name);i.length>0&&0!==i[0].indexOf(e.rootPath)&&(t=t.clearRefinements(e.name)),i=t.getHierarchicalRefinement(e.name),0===i.length&&(t=t.toggleHierarchicalFacetRefinement(e.name,e.rootPath))}}),t},s.validate=function(e,t){var i=t||{};return e.tagFilters&&i.tagRefinements&&i.tagRefinements.length>0?new Error("[Tags] Cannot switch from the managed tag API to the advanced API. It is probably an error, if it is really what you want, you should first clear the tags with clearTags method."):e.tagRefinements.length>0&&i.tagFilters?new Error("[Tags] Cannot switch from the advanced tag API to the managed API. It is probably an error, if it is not, you should first clear the tags with clearTags method."):e.numericFilters&&i.numericRefinements&&l(i.numericRefinements)?new Error("[Numeric filters] Can't switch from the advanced to the managed API. It is probably an error, if this is really what you want, you have to first clear the numeric filters."):l(e.numericRefinements)&&i.numericFilters?new Error("[Numeric filters] Can't switch from the managed API to the advanced. It is probably an error, if this is really what you want, you have to first clear the numeric filters."):null},s.prototype={constructor:s,clearRefinements:function(e){var t={numericRefinements:this._clearNumericRefinements(e),facetsRefinements:d.clearRefinement(this.facetsRefinements,e,"conjunctiveFacet"),facetsExcludes:d.clearRefinement(this.facetsExcludes,e,"exclude"),disjunctiveFacetsRefinements:d.clearRefinement(this.disjunctiveFacetsRefinements,e,"disjunctiveFacet"),hierarchicalFacetsRefinements:d.clearRefinement(this.hierarchicalFacetsRefinements,e,"hierarchicalFacet")};return t.numericRefinements===this.numericRefinements&&t.facetsRefinements===this.facetsRefinements&&t.facetsExcludes===this.facetsExcludes&&t.disjunctiveFacetsRefinements===this.disjunctiveFacetsRefinements&&t.hierarchicalFacetsRefinements===this.hierarchicalFacetsRefinements?this:this.setQueryParameters(t)},clearTags:function(){return void 0===this.tagFilters&&0===this.tagRefinements.length?this:this.setQueryParameters({tagFilters:void 0,tagRefinements:[]})},setIndex:function(e){return e===this.index?this:this.setQueryParameters({index:e})},setQuery:function(e){return e===this.query?this:this.setQueryParameters({query:e})},setPage:function(e){return e===this.page?this:this.setQueryParameters({page:e})},setFacets:function(e){return this.setQueryParameters({facets:e})},setDisjunctiveFacets:function(e){return this.setQueryParameters({disjunctiveFacets:e})},setHitsPerPage:function(e){return this.hitsPerPage===e?this:this.setQueryParameters({hitsPerPage:e})},setTypoTolerance:function(e){return this.typoTolerance===e?this:this.setQueryParameters({typoTolerance:e})},addNumericRefinement:function(e,t,i){var n=f(i);if(this.isNumericRefined(e,t,n))return this;var r=a({},this.numericRefinements);return r[e]=a({},r[e]),r[e][t]?(r[e][t]=r[e][t].slice(),r[e][t].push(n)):r[e][t]=[n],this.setQueryParameters({numericRefinements:r})},getConjunctiveRefinements:function(e){return this.isConjunctiveFacet(e)?this.facetsRefinements[e]||[]:[]},getDisjunctiveRefinements:function(e){return this.isDisjunctiveFacet(e)?this.disjunctiveFacetsRefinements[e]||[]:[]},getHierarchicalRefinement:function(e){return this.hierarchicalFacetsRefinements[e]||[]},getExcludeRefinements:function(e){return this.isConjunctiveFacet(e)?this.facetsExcludes[e]||[]:[]},removeNumericRefinement:function(e,t,i){var r=i;return void 0!==r?this.isNumericRefined(e,t,r)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements(function(i,s){return s===e&&i.op===t&&n(i.val,f(r))})}):this:void 0!==t?this.isNumericRefined(e,t)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements(function(i,n){return n===e&&i.op===t})}):this:this.isNumericRefined(e)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements(function(t,i){return i===e})}):this},getNumericRefinements:function(e){return this.numericRefinements[e]||{}},getNumericRefinement:function(e,t){return this.numericRefinements[e]&&this.numericRefinements[e][t]},_clearNumericRefinements:function(e){if(void 0===e)return l(this.numericRefinements)?{}:this.numericRefinements;if("string"==typeof e)return h(this.numericRefinements,[e]);if("function"==typeof e){var t=!1,i=this.numericRefinements,n=Object.keys(i).reduce(function(n,r){var s=i[r],a={};return s=s||{},Object.keys(s).forEach(function(i){var n=s[i]||[],c=[];n.forEach(function(t){e({val:t,op:i},r,"numeric")||c.push(t)}),c.length!==n.length&&(t=!0),a[i]=c}),n[r]=a,n},{});return t?n:this.numericRefinements}},addFacet:function(e){return this.isConjunctiveFacet(e)?this:this.setQueryParameters({facets:this.facets.concat([e])})},addDisjunctiveFacet:function(e){return this.isDisjunctiveFacet(e)?this:this.setQueryParameters({disjunctiveFacets:this.disjunctiveFacets.concat([e])})},addHierarchicalFacet:function(e){if(this.isHierarchicalFacet(e.name))throw new Error("Cannot declare two hierarchical facets with the same name: `"+e.name+"`");return this.setQueryParameters({hierarchicalFacets:this.hierarchicalFacets.concat([e])})},addFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return d.isRefined(this.facetsRefinements,e,t)?this:this.setQueryParameters({facetsRefinements:d.addRefinement(this.facetsRefinements,e,t)})},addExcludeRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return d.isRefined(this.facetsExcludes,e,t)?this:this.setQueryParameters({facetsExcludes:d.addRefinement(this.facetsExcludes,e,t)})},addDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return d.isRefined(this.disjunctiveFacetsRefinements,e,t)?this:this.setQueryParameters({disjunctiveFacetsRefinements:d.addRefinement(this.disjunctiveFacetsRefinements,e,t)})},addTagRefinement:function(e){if(this.isTagRefined(e))return this;var t={tagRefinements:this.tagRefinements.concat(e)};return this.setQueryParameters(t)},removeFacet:function(e){return this.isConjunctiveFacet(e)?this.clearRefinements(e).setQueryParameters({facets:this.facets.filter(function(t){return t!==e})}):this},removeDisjunctiveFacet:function(e){return this.isDisjunctiveFacet(e)?this.clearRefinements(e).setQueryParameters({disjunctiveFacets:this.disjunctiveFacets.filter(function(t){return t!==e})}):this},removeHierarchicalFacet:function(e){return this.isHierarchicalFacet(e)?this.clearRefinements(e).setQueryParameters({hierarchicalFacets:this.hierarchicalFacets.filter(function(t){return t.name!==e})}):this},removeFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return d.isRefined(this.facetsRefinements,e,t)?this.setQueryParameters({facetsRefinements:d.removeRefinement(this.facetsRefinements,e,t)}):this},removeExcludeRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return d.isRefined(this.facetsExcludes,e,t)?this.setQueryParameters({facetsExcludes:d.removeRefinement(this.facetsExcludes,e,t)}):this},removeDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return d.isRefined(this.disjunctiveFacetsRefinements,e,t)?this.setQueryParameters({disjunctiveFacetsRefinements:d.removeRefinement(this.disjunctiveFacetsRefinements,e,t)}):this},removeTagRefinement:function(e){if(!this.isTagRefined(e))return this;var t={tagRefinements:this.tagRefinements.filter(function(t){return t!==e})};return this.setQueryParameters(t)},toggleRefinement:function(e,t){return this.toggleFacetRefinement(e,t)},toggleFacetRefinement:function(e,t){if(this.isHierarchicalFacet(e))return this.toggleHierarchicalFacetRefinement(e,t);if(this.isConjunctiveFacet(e))return this.toggleConjunctiveFacetRefinement(e,t);if(this.isDisjunctiveFacet(e))return this.toggleDisjunctiveFacetRefinement(e,t);throw new Error("Cannot refine the undeclared facet "+e+"; it should be added to the helper options facets, disjunctiveFacets or hierarchicalFacets")},toggleConjunctiveFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return this.setQueryParameters({facetsRefinements:d.toggleRefinement(this.facetsRefinements,e,t)})},toggleExcludeFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return this.setQueryParameters({facetsExcludes:d.toggleRefinement(this.facetsExcludes,e,t)})},toggleDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return this.setQueryParameters({disjunctiveFacetsRefinements:d.toggleRefinement(this.disjunctiveFacetsRefinements,e,t)})},toggleHierarchicalFacetRefinement:function(e,t){if(!this.isHierarchicalFacet(e))throw new Error(e+" is not defined in the hierarchicalFacets attribute of the helper configuration");var i=this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(e)),n={};return void 0!==this.hierarchicalFacetsRefinements[e]&&this.hierarchicalFacetsRefinements[e].length>0&&(this.hierarchicalFacetsRefinements[e][0]===t||0===this.hierarchicalFacetsRefinements[e][0].indexOf(t+i))?-1===t.indexOf(i)?n[e]=[]:n[e]=[t.slice(0,t.lastIndexOf(i))]:n[e]=[t],this.setQueryParameters({hierarchicalFacetsRefinements:c({},n,this.hierarchicalFacetsRefinements)})},addHierarchicalFacetRefinement:function(e,t){if(this.isHierarchicalFacetRefined(e))throw new Error(e+" is already refined.");if(!this.isHierarchicalFacet(e))throw new Error(e+" is not defined in the hierarchicalFacets attribute of the helper configuration.");var i={};return i[e]=[t],this.setQueryParameters({hierarchicalFacetsRefinements:c({},i,this.hierarchicalFacetsRefinements)})},removeHierarchicalFacetRefinement:function(e){if(!this.isHierarchicalFacetRefined(e))return this;var t={};return t[e]=[],this.setQueryParameters({hierarchicalFacetsRefinements:c({},t,this.hierarchicalFacetsRefinements)})},toggleTagRefinement:function(e){return this.isTagRefined(e)?this.removeTagRefinement(e):this.addTagRefinement(e)},isDisjunctiveFacet:function(e){return this.disjunctiveFacets.indexOf(e)>-1},isHierarchicalFacet:function(e){return void 0!==this.getHierarchicalFacetByName(e)},isConjunctiveFacet:function(e){return this.facets.indexOf(e)>-1},isFacetRefined:function(e,t){return!!this.isConjunctiveFacet(e)&&d.isRefined(this.facetsRefinements,e,t)},isExcludeRefined:function(e,t){return!!this.isConjunctiveFacet(e)&&d.isRefined(this.facetsExcludes,e,t)},isDisjunctiveFacetRefined:function(e,t){return!!this.isDisjunctiveFacet(e)&&d.isRefined(this.disjunctiveFacetsRefinements,e,t)},isHierarchicalFacetRefined:function(e,t){if(!this.isHierarchicalFacet(e))return!1;var i=this.getHierarchicalRefinement(e);return t?-1!==i.indexOf(t):i.length>0},isNumericRefined:function(e,t,i){if(void 0===i&&void 0===t)return Boolean(this.numericRefinements[e]);var n=this.numericRefinements[e]&&void 0!==this.numericRefinements[e][t];if(void 0===i||!n)return n;var s=f(i),a=void 0!==r(this.numericRefinements[e][t],s);return n&&a},isTagRefined:function(e){return-1!==this.tagRefinements.indexOf(e)},getRefinedDisjunctiveFacets:function(){var e=this,t=u(Object.keys(this.numericRefinements).filter(function(t){return Object.keys(e.numericRefinements[t]).length>0}),this.disjunctiveFacets);return Object.keys(this.disjunctiveFacetsRefinements).filter(function(t){return e.disjunctiveFacetsRefinements[t].length>0}).concat(t).concat(this.getRefinedHierarchicalFacets())},getRefinedHierarchicalFacets:function(){var e=this;return u(this.hierarchicalFacets.map(function(e){return e.name}),Object.keys(this.hierarchicalFacetsRefinements).filter(function(t){return e.hierarchicalFacetsRefinements[t].length>0}))},getUnrefinedDisjunctiveFacets:function(){var e=this.getRefinedDisjunctiveFacets();return this.disjunctiveFacets.filter(function(t){return-1===e.indexOf(t)})},managedParameters:["index","facets","disjunctiveFacets","facetsRefinements","hierarchicalFacets","facetsExcludes","disjunctiveFacetsRefinements","numericRefinements","tagRefinements","hierarchicalFacetsRefinements"],getQueryParams:function(){var e=this.managedParameters,t={},i=this;return Object.keys(this).forEach(function(n){var r=i[n];-1===e.indexOf(n)&&void 0!==r&&(t[n]=r)}),t},setQueryParameter:function(e,t){if(this[e]===t)return this;var i={};return i[e]=t,this.setQueryParameters(i)},setQueryParameters:function(e){if(!e)return this;var t=s.validate(this,e);if(t)throw t;var i=this,n=s._parseNumbers(e),r=Object.keys(this).reduce(function(e,t){return e[t]=i[t],e},{}),a=Object.keys(n).reduce(function(e,t){var i=void 0!==e[t],r=void 0!==n[t];return i&&!r?h(e,[t]):(r&&(e[t]=n[t]),e)},r);return new this.constructor(a)},resetPage:function(){return void 0===this.page?this:this.setPage(0)},_getHierarchicalFacetSortBy:function(e){return e.sortBy||["isRefined:desc","name:asc"]},_getHierarchicalFacetSeparator:function(e){return e.separator||" > "},_getHierarchicalRootPath:function(e){return e.rootPath||null},_getHierarchicalShowParentLevel:function(e){return"boolean"!=typeof e.showParentLevel||e.showParentLevel},getHierarchicalFacetByName:function(e){return o(this.hierarchicalFacets,function(t){return t.name===e})},getHierarchicalFacetBreadcrumb:function(e){if(!this.isHierarchicalFacet(e))return[];var t=this.getHierarchicalRefinement(e)[0];if(!t)return[];var i=this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(e));return t.split(i).map(function(e){return e.trim()})},toString:function(){return JSON.stringify(this,null,2)}},t.exports=s},{"../functions/defaultsPure":10,"../functions/find":12,"../functions/intersection":16,"../functions/merge":17,"../functions/objectHasKeys":18,"../functions/omit":19,"../functions/valToNumber":21,"../utils/isValidUserToken":23,"./RefinementList":4}],6:[function(e,t,i){"use strict";function n(e){return function(t,i){var n=e.hierarchicalFacets[i],s=e.hierarchicalFacetsRefinements[n.name]&&e.hierarchicalFacetsRefinements[n.name][0]||"",a=e._getHierarchicalFacetSeparator(n),c=e._getHierarchicalRootPath(n),u=e._getHierarchicalShowParentLevel(n),f=o(e._getHierarchicalFacetSortBy(n)),h=t.every(function(e){return e.exhaustive}),l=r(f,a,c,u,s),m=t;return c&&(m=t.slice(c.split(a).length)),m.reduce(l,{name:e.hierarchicalFacets[i].name,count:null,isRefined:!0,path:null,escapedValue:null,exhaustive:h,data:null})}}function r(e,t,i,n,r){return function(o,f,h){var m=o;if(h>0){var d=0;for(m=o;d<h;){var v=m&&Array.isArray(m.data)?m.data:[];m=u(v,function(e){return e.isRefined}),d++}}if(m){var p=Object.keys(f.data).map(function(e){return[e,f.data[e]]}).filter(function(e){return s(e[0],m.path||i,r,t,i,n)});m.data=c(p.map(function(e){var i=e[0];return a(e[1],i,t,l(r),f.exhaustive)}),e[0],e[1])}return o}}function s(e,t,i,n,r,s){return(!r||0===e.indexOf(r)&&r!==e)&&(!r&&-1===e.indexOf(n)||r&&e.split(n).length-r.split(n).length==1||-1===e.indexOf(n)&&-1===i.indexOf(n)||0===i.indexOf(e)||0===e.indexOf(t+n)&&(s||0===e.indexOf(i)))}function a(e,t,i,n,r){var s=t.split(i);return{name:s[s.length-1].trim(),path:t,escapedValue:h(t),count:e,isRefined:n===t||0===n.indexOf(t+i),exhaustive:r,data:null}}t.exports=n;var c=e("../functions/orderBy"),u=e("../functions/find"),o=e("../functions/formatSort"),f=e("../functions/escapeFacetValue"),h=f.escapeFacetValue,l=f.unescapeFacetValue},{"../functions/escapeFacetValue":11,"../functions/find":12,"../functions/formatSort":14,"../functions/orderBy":20}],7:[function(e,t,i){"use strict";function n(e){var t={};return e.forEach(function(e,i){t[e]=i}),t}function r(e,t,i){t&&t[i]&&(e.stats=t[i])}function s(e,t){return F(e,function(e){return(e.attributes||[]).indexOf(t)>-1})}function a(e,t,i){var a=t[0];this._rawResults=t;var c=this;Object.keys(a).forEach(function(e){c[e]=a[e]}),Object.keys(i||{}).forEach(function(e){c[e]=i[e]}),this.processingTimeMS=t.reduce(function(e,t){return void 0===t.processingTimeMS?e:e+t.processingTimeMS},0),this.disjunctiveFacets=[],this.hierarchicalFacets=e.hierarchicalFacets.map(function(){return[]}),this.facets=[];var u=e.getRefinedDisjunctiveFacets(),o=n(e.facets),f=n(e.disjunctiveFacets),h=1,l=a.facets||{};Object.keys(l).forEach(function(t){var i=l[t],n=s(e.hierarchicalFacets,t);if(n){var u=n.attributes.indexOf(t),h=_(e.hierarchicalFacets,function(e){return e.name===n.name});c.hierarchicalFacets[h][u]={attribute:t,data:i,exhaustive:a.exhaustiveFacetsCount}}else{var m,d=-1!==e.disjunctiveFacets.indexOf(t),v=-1!==e.facets.indexOf(t);d&&(m=f[t],c.disjunctiveFacets[m]={name:t,data:i,exhaustive:a.exhaustiveFacetsCount},r(c.disjunctiveFacets[m],a.facets_stats,t)),v&&(m=o[t],c.facets[m]={name:t,data:i,exhaustive:a.exhaustiveFacetsCount},r(c.facets[m],a.facets_stats,t))}}),this.hierarchicalFacets=R(this.hierarchicalFacets),u.forEach(function(i){var n=t[h],s=n&&n.facets?n.facets:{},u=e.getHierarchicalFacetByName(i);Object.keys(s).forEach(function(t){var i,o=s[t];if(u){i=_(e.hierarchicalFacets,function(e){return e.name===u.name});var h=_(c.hierarchicalFacets[i],function(e){return e.attribute===t});if(-1===h)return;c.hierarchicalFacets[i][h].data=p({},c.hierarchicalFacets[i][h].data,o)}else{i=f[t];var l=a.facets&&a.facets[t]||{};c.disjunctiveFacets[i]={name:t,data:g({},o,l),exhaustive:n.exhaustiveFacetsCount},r(c.disjunctiveFacets[i],n.facets_stats,t),e.disjunctiveFacetsRefinements[t]&&e.disjunctiveFacetsRefinements[t].forEach(function(n){!c.disjunctiveFacets[i].data[n]&&e.disjunctiveFacetsRefinements[t].indexOf(P(n))>-1&&(c.disjunctiveFacets[i].data[n]=0)})}}),h++}),e.getRefinedHierarchicalFacets().forEach(function(i){var n=e.getHierarchicalFacetByName(i),r=e._getHierarchicalFacetSeparator(n),s=e.getHierarchicalRefinement(i);0===s.length||s[0].split(r).length<2||t.slice(h).forEach(function(t){var i=t&&t.facets?t.facets:{};Object.keys(i).forEach(function(t){var a=i[t],u=_(e.hierarchicalFacets,function(e){return e.name===n.name}),o=_(c.hierarchicalFacets[u],function(e){return e.attribute===t});if(-1!==o){var f={};if(s.length>0){var h=s[0].split(r)[0];f[h]=c.hierarchicalFacets[u][o].data[h]}c.hierarchicalFacets[u][o].data=g(f,a,c.hierarchicalFacets[u][o].data)}}),h++})}),Object.keys(e.facetsExcludes).forEach(function(t){var i=e.facetsExcludes[t],n=o[t];c.facets[n]={name:t,data:l[t],exhaustive:a.exhaustiveFacetsCount},i.forEach(function(e){c.facets[n]=c.facets[n]||{name:t},c.facets[n].data=c.facets[n].data||{},c.facets[n].data[e]=0})}),this.hierarchicalFacets=this.hierarchicalFacets.map(E(e)),this.facets=R(this.facets),this.disjunctiveFacets=R(this.disjunctiveFacets),this._state=e}function c(e,t){function i(e){return e.name===t}if(e._state.isConjunctiveFacet(t)){var n=F(e.facets,i);return n?Object.keys(n.data).map(function(i){var r=b(i);return{name:i,escapedValue:r,count:n.data[i],isRefined:e._state.isFacetRefined(t,r),isExcluded:e._state.isExcludeRefined(t,i)}}):[]}if(e._state.isDisjunctiveFacet(t)){var r=F(e.disjunctiveFacets,i);return r?Object.keys(r.data).map(function(i){var n=b(i);return{name:i,escapedValue:n,count:r.data[i],isRefined:e._state.isDisjunctiveFacetRefined(t,n)}}):[]}if(e._state.isHierarchicalFacet(t)){var s=F(e.hierarchicalFacets,i);if(!s)return s;var a=e._state.getHierarchicalFacetByName(t),c=e._state._getHierarchicalFacetSeparator(a),o=P(e._state.getHierarchicalRefinement(t)[0]||"");0===o.indexOf(a.rootPath)&&(o=o.replace(a.rootPath+c,""));var f=o.split(c);return f.unshift(t),u(s,f,0),s}}function u(e,t,i){e.isRefined=e.name===t[i],e.data&&e.data.forEach(function(e){u(e,t,i+1)})}function o(e,t,i,n){if(n=n||0,Array.isArray(t))return e(t,i[n]);if(!t.data||0===t.data.length)return t;var r=t.data.map(function(t){return o(e,t,i,n+1)}),s=e(r,i[n]);return g({data:s},t)}function f(e,t){return t.sort(e)}function h(e,t){var i=[],n=[],r=t.order||[],s=r.reduce(function(e,t,i){return e[t]=i,e},{});e.forEach(function(e){var t=e.path||e.name;void 0!==s[t]?i[s[t]]=e:n.push(e)}),i=i.filter(function(e){return e});var a,c=t.sortRemainingBy;return"hidden"===c?i:(a="alpha"===c?[["path","name"],["asc","asc"]]:[["count"],["desc"]],i.concat(y(n,a[0],a[1])))}function l(e,t){return e.renderingContent&&e.renderingContent.facetOrdering&&e.renderingContent.facetOrdering.values&&e.renderingContent.facetOrdering.values[t]}function m(e,t){var i=F(e,function(e){return e.name===t});return i&&i.stats}function d(e,t,i,n,r){var s=F(r,function(e){return e.name===i}),a=s&&s.data&&s.data[n]?s.data[n]:0,c=s&&s.exhaustive||!1;return{type:t,attributeName:i,name:n,count:a,exhaustive:c}}function v(e,t,i,n){var r=e.getHierarchicalFacetByName(t),s=e._getHierarchicalFacetSeparator(r),a=i.split(s),c=F(n,function(e){return e.name===t}),u=a.reduce(function(e,t){var i=e&&F(e.data,function(e){return e.name===t});return void 0!==i?i:e},c),o=u&&u.count||0,f=u&&u.exhaustive||!1,h=u&&u.path||"";return{type:"hierarchical",attributeName:t,name:h,count:o,exhaustive:f}}var p=e("../functions/merge"),g=e("../functions/defaultsPure"),y=e("../functions/orderBy"),R=e("../functions/compact"),F=e("../functions/find"),_=e("../functions/findIndex"),j=e("../functions/formatSort"),x=e("../functions/escapeFacetValue"),b=x.escapeFacetValue,P=x.unescapeFacetValue,E=e("./generate-hierarchical-tree");a.prototype.getFacetByName=function(e){function t(t){return t.name===e}return F(this.facets,t)||F(this.disjunctiveFacets,t)||F(this.hierarchicalFacets,t)},a.DEFAULT_SORT=["isRefined:desc","count:desc","name:asc"],a.prototype.getFacetValues=function(e,t){var i=c(this,e);if(i){var n,r=g({},t,{sortBy:a.DEFAULT_SORT,facetOrdering:!(t&&t.sortBy)}),s=this;if(Array.isArray(i))n=[e];else{n=s._state.getHierarchicalFacetByName(i.name).attributes}return o(function(e,t){if(r.facetOrdering){var i=l(s,t);if(i)return h(e,i)}if(Array.isArray(r.sortBy)){var n=j(r.sortBy,a.DEFAULT_SORT);return y(e,n[0],n[1])}if("function"==typeof r.sortBy)return f(r.sortBy,e);throw new Error("options.sortBy is optional but if defined it must be either an array of string (predicates) or a sorting function")},i,n)}},a.prototype.getFacetStats=function(e){return this._state.isConjunctiveFacet(e)?m(this.facets,e):this._state.isDisjunctiveFacet(e)?m(this.disjunctiveFacets,e):void 0},a.prototype.getRefinements=function(){var e=this._state,t=this,i=[];return Object.keys(e.facetsRefinements).forEach(function(n){e.facetsRefinements[n].forEach(function(r){i.push(d(e,"facet",n,r,t.facets))})}),Object.keys(e.facetsExcludes).forEach(function(n){e.facetsExcludes[n].forEach(function(r){i.push(d(e,"exclude",n,r,t.facets))})}),Object.keys(e.disjunctiveFacetsRefinements).forEach(function(n){e.disjunctiveFacetsRefinements[n].forEach(function(r){i.push(d(e,"disjunctive",n,r,t.disjunctiveFacets))})}),Object.keys(e.hierarchicalFacetsRefinements).forEach(function(n){e.hierarchicalFacetsRefinements[n].forEach(function(r){i.push(v(e,n,r,t.hierarchicalFacets))})}),Object.keys(e.numericRefinements).forEach(function(t){var n=e.numericRefinements[t];Object.keys(n).forEach(function(e){
n[e].forEach(function(n){i.push({type:"numeric",attributeName:t,name:n,numericValue:n,operator:e})})})}),e.tagRefinements.forEach(function(e){i.push({type:"tag",attributeName:"_tags",name:e})}),i},t.exports=a},{"../functions/compact":9,"../functions/defaultsPure":10,"../functions/escapeFacetValue":11,"../functions/find":12,"../functions/findIndex":13,"../functions/formatSort":14,"../functions/merge":17,"../functions/orderBy":20,"./generate-hierarchical-tree":6}],8:[function(e,t,i){"use strict";function n(e,t,i){"function"==typeof e.addAlgoliaAgent&&e.addAlgoliaAgent("JS Helper ("+v+")"),this.setClient(e);var n=i||{};n.index=t,this.state=a.make(n),this.lastResults=null,this._queryId=0,this._lastQueryIdReceived=-1,this.derivedHelpers=[],this._currentNbQueries=0}function r(e){if(e<0)throw new Error("Page requested below 0.");return this._change({state:this.state.setPage(e),isPageReset:!1}),this}function s(){return this.state.page}var a=e("./SearchParameters"),c=e("./SearchResults"),u=e("./DerivedHelper"),o=e("./requestBuilder"),f=e("@algolia/events"),h=e("./functions/inherits"),l=e("./functions/objectHasKeys"),m=e("./functions/omit"),d=e("./functions/merge"),v=e("./version"),p=e("./functions/escapeFacetValue").escapeFacetValue;h(n,f),n.prototype.search=function(){return this._search({onlyWithDerivedHelpers:!1}),this},n.prototype.searchOnlyWithDerivedHelpers=function(){return this._search({onlyWithDerivedHelpers:!0}),this},n.prototype.getQuery=function(){var e=this.state;return o._getHitsSearchParams(e)},n.prototype.searchOnce=function(e,t){var i=e?this.state.setQueryParameters(e):this.state,n=o._getQueries(i.index,i),r=this;return this._currentNbQueries++,this.emit("searchOnce",{state:i}),t?void this.client.search(n).then(function(e){r._currentNbQueries--,0===r._currentNbQueries&&r.emit("searchQueueEmpty"),t(null,new c(i,e.results),i)}).catch(function(e){r._currentNbQueries--,0===r._currentNbQueries&&r.emit("searchQueueEmpty"),t(e,null,i)}):this.client.search(n).then(function(e){return r._currentNbQueries--,0===r._currentNbQueries&&r.emit("searchQueueEmpty"),{content:new c(i,e.results),state:i,_originalResponse:e}},function(e){throw r._currentNbQueries--,0===r._currentNbQueries&&r.emit("searchQueueEmpty"),e})},n.prototype.findAnswers=function(e){console.warn("[algoliasearch-helper] answers is no longer supported");var t=this.state,i=this.derivedHelpers[0];if(!i)return Promise.resolve([]);var n=i.getModifiedState(t),r=d({attributesForPrediction:e.attributesForPrediction,nbHits:e.nbHits},{params:m(o._getHitsSearchParams(n),["attributesToSnippet","hitsPerPage","restrictSearchableAttributes","snippetEllipsisText"])}),s="search for answers was called, but this client does not have a function client.initIndex(index).findAnswers";if("function"!=typeof this.client.initIndex)throw new Error(s);var a=this.client.initIndex(n.index);if("function"!=typeof a.findAnswers)throw new Error(s);return a.findAnswers(n.query,e.queryLanguages,r)},n.prototype.searchForFacetValues=function(e,t,i,n){var r="function"==typeof this.client.searchForFacetValues,s="function"==typeof this.client.initIndex;if(!r&&!s&&"function"!=typeof this.client.search)throw new Error("search for facet values (searchable) was called, but this client does not have a function client.searchForFacetValues or client.initIndex(index).searchForFacetValues");var a=this.state.setQueryParameters(n||{}),c=a.isDisjunctiveFacet(e),u=o.getSearchForFacetQuery(e,t,i,a);this._currentNbQueries++;var f,h=this;return r?f=this.client.searchForFacetValues([{indexName:a.index,params:u}]):s?f=this.client.initIndex(a.index).searchForFacetValues(u):(delete u.facetName,f=this.client.search([{type:"facet",facet:e,indexName:a.index,params:u}]).then(function(e){return e.results[0]})),this.emit("searchForFacetValues",{state:a,facet:e,query:t}),f.then(function(t){return h._currentNbQueries--,0===h._currentNbQueries&&h.emit("searchQueueEmpty"),t=Array.isArray(t)?t[0]:t,t.facetHits.forEach(function(t){t.escapedValue=p(t.value),t.isRefined=c?a.isDisjunctiveFacetRefined(e,t.escapedValue):a.isFacetRefined(e,t.escapedValue)}),t},function(e){throw h._currentNbQueries--,0===h._currentNbQueries&&h.emit("searchQueueEmpty"),e})},n.prototype.setQuery=function(e){return this._change({state:this.state.resetPage().setQuery(e),isPageReset:!0}),this},n.prototype.clearRefinements=function(e){return this._change({state:this.state.resetPage().clearRefinements(e),isPageReset:!0}),this},n.prototype.clearTags=function(){return this._change({state:this.state.resetPage().clearTags(),isPageReset:!0}),this},n.prototype.addDisjunctiveFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addDisjunctiveFacetRefinement(e,t),isPageReset:!0}),this},n.prototype.addDisjunctiveRefine=function(){return this.addDisjunctiveFacetRefinement.apply(this,arguments)},n.prototype.addHierarchicalFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addHierarchicalFacetRefinement(e,t),isPageReset:!0}),this},n.prototype.addNumericRefinement=function(e,t,i){return this._change({state:this.state.resetPage().addNumericRefinement(e,t,i),isPageReset:!0}),this},n.prototype.addFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().addFacetRefinement(e,t),isPageReset:!0}),this},n.prototype.addRefine=function(){return this.addFacetRefinement.apply(this,arguments)},n.prototype.addFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().addExcludeRefinement(e,t),isPageReset:!0}),this},n.prototype.addExclude=function(){return this.addFacetExclusion.apply(this,arguments)},n.prototype.addTag=function(e){return this._change({state:this.state.resetPage().addTagRefinement(e),isPageReset:!0}),this},n.prototype.removeNumericRefinement=function(e,t,i){return this._change({state:this.state.resetPage().removeNumericRefinement(e,t,i),isPageReset:!0}),this},n.prototype.removeDisjunctiveFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().removeDisjunctiveFacetRefinement(e,t),isPageReset:!0}),this},n.prototype.removeDisjunctiveRefine=function(){return this.removeDisjunctiveFacetRefinement.apply(this,arguments)},n.prototype.removeHierarchicalFacetRefinement=function(e){return this._change({state:this.state.resetPage().removeHierarchicalFacetRefinement(e),isPageReset:!0}),this},n.prototype.removeFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().removeFacetRefinement(e,t),isPageReset:!0}),this},n.prototype.removeRefine=function(){return this.removeFacetRefinement.apply(this,arguments)},n.prototype.removeFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().removeExcludeRefinement(e,t),isPageReset:!0}),this},n.prototype.removeExclude=function(){return this.removeFacetExclusion.apply(this,arguments)},n.prototype.removeTag=function(e){return this._change({state:this.state.resetPage().removeTagRefinement(e),isPageReset:!0}),this},n.prototype.toggleFacetExclusion=function(e,t){return this._change({state:this.state.resetPage().toggleExcludeFacetRefinement(e,t),isPageReset:!0}),this},n.prototype.toggleExclude=function(){return this.toggleFacetExclusion.apply(this,arguments)},n.prototype.toggleRefinement=function(e,t){return this.toggleFacetRefinement(e,t)},n.prototype.toggleFacetRefinement=function(e,t){return this._change({state:this.state.resetPage().toggleFacetRefinement(e,t),isPageReset:!0}),this},n.prototype.toggleRefine=function(){return this.toggleFacetRefinement.apply(this,arguments)},n.prototype.toggleTag=function(e){return this._change({state:this.state.resetPage().toggleTagRefinement(e),isPageReset:!0}),this},n.prototype.nextPage=function(){var e=this.state.page||0;return this.setPage(e+1)},n.prototype.previousPage=function(){var e=this.state.page||0;return this.setPage(e-1)},n.prototype.setCurrentPage=r,n.prototype.setPage=r,n.prototype.setIndex=function(e){return this._change({state:this.state.resetPage().setIndex(e),isPageReset:!0}),this},n.prototype.setQueryParameter=function(e,t){return this._change({state:this.state.resetPage().setQueryParameter(e,t),isPageReset:!0}),this},n.prototype.setState=function(e){return this._change({state:a.make(e),isPageReset:!1}),this},n.prototype.overrideStateWithoutTriggeringChangeEvent=function(e){return this.state=new a(e),this},n.prototype.hasRefinements=function(e){return!!l(this.state.getNumericRefinements(e))||(this.state.isConjunctiveFacet(e)?this.state.isFacetRefined(e):this.state.isDisjunctiveFacet(e)?this.state.isDisjunctiveFacetRefined(e):!!this.state.isHierarchicalFacet(e)&&this.state.isHierarchicalFacetRefined(e))},n.prototype.isExcluded=function(e,t){return this.state.isExcludeRefined(e,t)},n.prototype.isDisjunctiveRefined=function(e,t){return this.state.isDisjunctiveFacetRefined(e,t)},n.prototype.hasTag=function(e){return this.state.isTagRefined(e)},n.prototype.isTagRefined=function(){return this.hasTagRefinements.apply(this,arguments)},n.prototype.getIndex=function(){return this.state.index},n.prototype.getCurrentPage=s,n.prototype.getPage=s,n.prototype.getTags=function(){return this.state.tagRefinements},n.prototype.getRefinements=function(e){var t=[];if(this.state.isConjunctiveFacet(e)){this.state.getConjunctiveRefinements(e).forEach(function(e){t.push({value:e,type:"conjunctive"})});this.state.getExcludeRefinements(e).forEach(function(e){t.push({value:e,type:"exclude"})})}else if(this.state.isDisjunctiveFacet(e)){var i=this.state.getDisjunctiveRefinements(e);i.forEach(function(e){t.push({value:e,type:"disjunctive"})})}var n=this.state.getNumericRefinements(e);return Object.keys(n).forEach(function(e){var i=n[e];t.push({value:i,operator:e,type:"numeric"})}),t},n.prototype.getNumericRefinement=function(e,t){return this.state.getNumericRefinement(e,t)},n.prototype.getHierarchicalFacetBreadcrumb=function(e){return this.state.getHierarchicalFacetBreadcrumb(e)},n.prototype._search=function(e){var t=this.state,i=[],n=[];e.onlyWithDerivedHelpers||(n=o._getQueries(t.index,t),i.push({state:t,queriesCount:n.length,helper:this}),this.emit("search",{state:t,results:this.lastResults}));var r=this.derivedHelpers.map(function(e){var n=e.getModifiedState(t),r=n.index?o._getQueries(n.index,n):[];return i.push({state:n,queriesCount:r.length,helper:e}),e.emit("search",{state:n,results:e.lastResults}),r}),s=Array.prototype.concat.apply(n,r),a=this._queryId++;if(this._currentNbQueries++,!s.length)return Promise.resolve({results:[]}).then(this._dispatchAlgoliaResponse.bind(this,i,a));try{this.client.search(s).then(this._dispatchAlgoliaResponse.bind(this,i,a)).catch(this._dispatchAlgoliaError.bind(this,a))}catch(e){this.emit("error",{error:e})}},n.prototype._dispatchAlgoliaResponse=function(e,t,i){if(!(t<this._lastQueryIdReceived)){this._currentNbQueries-=t-this._lastQueryIdReceived,this._lastQueryIdReceived=t,0===this._currentNbQueries&&this.emit("searchQueueEmpty");var n=i.results.slice();e.forEach(function(e){var t=e.state,i=e.queriesCount,r=e.helper,s=n.splice(0,i);if(!t.index)return void r.emit("result",{results:null,state:t});r.lastResults=new c(t,s),r.emit("result",{results:r.lastResults,state:t})})}},n.prototype._dispatchAlgoliaError=function(e,t){e<this._lastQueryIdReceived||(this._currentNbQueries-=e-this._lastQueryIdReceived,this._lastQueryIdReceived=e,this.emit("error",{error:t}),0===this._currentNbQueries&&this.emit("searchQueueEmpty"))},n.prototype.containsRefinement=function(e,t,i,n){return e||0!==t.length||0!==i.length||0!==n.length},n.prototype._hasDisjunctiveRefinements=function(e){return this.state.disjunctiveRefinements[e]&&this.state.disjunctiveRefinements[e].length>0},n.prototype._change=function(e){var t=e.state,i=e.isPageReset;t!==this.state&&(this.state=t,this.emit("change",{state:this.state,results:this.lastResults,isPageReset:i}))},n.prototype.clearCache=function(){return this.client.clearCache&&this.client.clearCache(),this},n.prototype.setClient=function(e){return this.client===e?this:("function"==typeof e.addAlgoliaAgent&&e.addAlgoliaAgent("JS Helper ("+v+")"),this.client=e,this)},n.prototype.getClient=function(){return this.client},n.prototype.derive=function(e){var t=new u(this,e);return this.derivedHelpers.push(t),t},n.prototype.detachDerivedHelper=function(e){var t=this.derivedHelpers.indexOf(e);if(-1===t)throw new Error("Derived helper already detached");this.derivedHelpers.splice(t,1)},n.prototype.hasPendingRequests=function(){return this._currentNbQueries>0},t.exports=n},{"./DerivedHelper":3,"./SearchParameters":5,"./SearchResults":7,"./functions/escapeFacetValue":11,"./functions/inherits":15,"./functions/merge":17,"./functions/objectHasKeys":18,"./functions/omit":19,"./requestBuilder":22,"./version":24,"@algolia/events":1}],9:[function(e,t,i){"use strict";t.exports=function(e){return Array.isArray(e)?e.filter(Boolean):[]}},{}],10:[function(e,t,i){"use strict";t.exports=function(){return Array.prototype.slice.call(arguments).reduceRight(function(e,t){return Object.keys(Object(t)).forEach(function(i){void 0!==t[i]&&(void 0!==e[i]&&delete e[i],e[i]=t[i])}),e},{})}},{}],11:[function(e,t,i){"use strict";function n(e){return"string"!=typeof e?e:String(e).replace(/^-/,"\\-")}function r(e){return"string"!=typeof e?e:e.replace(/^\\-/,"-")}t.exports={escapeFacetValue:n,unescapeFacetValue:r}},{}],12:[function(e,t,i){"use strict";t.exports=function(e,t){if(Array.isArray(e))for(var i=0;i<e.length;i++)if(t(e[i]))return e[i]}},{}],13:[function(e,t,i){"use strict";t.exports=function(e,t){if(!Array.isArray(e))return-1;for(var i=0;i<e.length;i++)if(t(e[i]))return i;return-1}},{}],14:[function(e,t,i){"use strict";var n=e("./find");t.exports=function(e,t){var i=(t||[]).map(function(e){return e.split(":")});return e.reduce(function(e,t){var r=t.split(":"),s=n(i,function(e){return e[0]===r[0]});return r.length>1||!s?(e[0].push(r[0]),e[1].push(r[1]),e):(e[0].push(s[0]),e[1].push(s[1]),e)},[[],[]])}},{"./find":12}],15:[function(e,t,i){"use strict";function n(e,t){e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}t.exports=n},{}],16:[function(e,t,i){"use strict";function n(e,t){return e.filter(function(i,n){return t.indexOf(i)>-1&&e.indexOf(i)===n})}t.exports=n},{}],17:[function(e,t,i){"use strict";function n(e){return"object"==typeof e&&null!==e?s(Array.isArray(e)?[]:{},e):e}function r(e){return"function"==typeof e||Array.isArray(e)||"[object Object]"===Object.prototype.toString.call(e)}function s(e,t){if(e===t)return e;for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)&&"__proto__"!==i&&"constructor"!==i){var a=t[i],c=e[i];void 0!==c&&void 0===a||(r(c)&&r(a)?e[i]=s(c,a):e[i]=n(a))}return e}function a(e){r(e)||(e={});for(var t=1,i=arguments.length;t<i;t++){var n=arguments[t];r(n)&&s(e,n)}return e}t.exports=a},{}],18:[function(e,t,i){"use strict";function n(e){return e&&Object.keys(e).length>0}t.exports=n},{}],19:[function(e,t,i){"use strict";function n(e,t){if(null===e)return{};var i,n,r={},s=Object.keys(e);for(n=0;n<s.length;n++)i=s[n],t.indexOf(i)>=0||(r[i]=e[i]);return r}t.exports=n},{}],20:[function(e,t,i){"use strict";function n(e,t){if(e!==t){var i=void 0!==e,n=null===e,r=void 0!==t,s=null===t;if(!s&&e>t||n&&r||!i)return 1;if(!n&&e<t||s&&i||!r)return-1}return 0}function r(e,t,i){if(!Array.isArray(e))return[];Array.isArray(i)||(i=[]);var r=e.map(function(e,i){return{criteria:t.map(function(t){return e[t]}),index:i,value:e}});return r.sort(function(e,t){for(var r=-1;++r<e.criteria.length;){var s=n(e.criteria[r],t.criteria[r]);if(s)return r>=i.length?s:"desc"===i[r]?-s:s}return e.index-t.index}),r.map(function(e){return e.value})}t.exports=r},{}],21:[function(e,t,i){"use strict";function n(e){if("number"==typeof e)return e;if("string"==typeof e)return parseFloat(e);if(Array.isArray(e))return e.map(n);throw new Error("The value should be a number, a parsable string or an array of those.")}t.exports=n},{}],22:[function(e,t,i){"use strict";function n(e){return Object.keys(e).sort(function(e,t){return e.localeCompare(t)}).reduce(function(t,i){return t[i]=e[i],t},{})}var r=e("./functions/merge"),s={_getQueries:function(e,t){var i=[];return i.push({indexName:e,params:s._getHitsSearchParams(t)}),t.getRefinedDisjunctiveFacets().forEach(function(n){i.push({indexName:e,params:s._getDisjunctiveFacetSearchParams(t,n)})}),t.getRefinedHierarchicalFacets().forEach(function(n){var r=t.getHierarchicalFacetByName(n),a=t.getHierarchicalRefinement(n),c=t._getHierarchicalFacetSeparator(r);if(a.length>0&&a[0].split(c).length>1){var u=a[0].split(c).slice(0,-1).reduce(function(e,t,i){return e.concat({attribute:r.attributes[i],value:0===i?t:[e[e.length-1].value,t].join(c)})},[]);u.forEach(function(n,a){function c(e){return r.attributes.some(function(t){return t===e.split(":")[0]})}var o=s._getDisjunctiveFacetSearchParams(t,n.attribute,0===a),f=(o.facetFilters||[]).reduce(function(e,t){if(Array.isArray(t)){var i=t.filter(function(e){return!c(e)});i.length>0&&e.push(i)}return"string"!=typeof t||c(t)||e.push(t),e},[]),h=u[a-1];o.facetFilters=a>0?f.concat(h.attribute+":"+h.value):f.length>0?f:void 0,i.push({indexName:e,params:o})})}}),i},_getHitsSearchParams:function(e){var t=e.facets.concat(e.disjunctiveFacets).concat(s._getHitsHierarchicalFacetsAttributes(e)),i=s._getFacetFilters(e),a=s._getNumericFilters(e),c=s._getTagFilters(e),u={facets:t.indexOf("*")>-1?["*"]:t,tagFilters:c};return i.length>0&&(u.facetFilters=i),a.length>0&&(u.numericFilters=a),n(r({},e.getQueryParams(),u))},_getDisjunctiveFacetSearchParams:function(e,t,i){var a=s._getFacetFilters(e,t,i),c=s._getNumericFilters(e,t),u=s._getTagFilters(e),o={hitsPerPage:0,page:0,analytics:!1,clickAnalytics:!1};u.length>0&&(o.tagFilters=u);var f=e.getHierarchicalFacetByName(t);return o.facets=f?s._getDisjunctiveHierarchicalFacetAttribute(e,f,i):t,c.length>0&&(o.numericFilters=c),a.length>0&&(o.facetFilters=a),n(r({},e.getQueryParams(),o))},_getNumericFilters:function(e,t){if(e.numericFilters)return e.numericFilters;var i=[];return Object.keys(e.numericRefinements).forEach(function(n){var r=e.numericRefinements[n]||{};Object.keys(r).forEach(function(e){var s=r[e]||[];t!==n&&s.forEach(function(t){if(Array.isArray(t)){var r=t.map(function(t){return n+e+t});i.push(r)}else i.push(n+e+t)})})}),i},_getTagFilters:function(e){return e.tagFilters?e.tagFilters:e.tagRefinements.join(",")},_getFacetFilters:function(e,t,i){var n=[],r=e.facetsRefinements||{};Object.keys(r).forEach(function(e){(r[e]||[]).forEach(function(t){n.push(e+":"+t)})});var s=e.facetsExcludes||{};Object.keys(s).forEach(function(e){(s[e]||[]).forEach(function(t){n.push(e+":-"+t)})});var a=e.disjunctiveFacetsRefinements||{};Object.keys(a).forEach(function(e){var i=a[e]||[];if(e!==t&&i&&0!==i.length){var r=[];i.forEach(function(t){r.push(e+":"+t)}),n.push(r)}});var c=e.hierarchicalFacetsRefinements||{};return Object.keys(c).forEach(function(r){var s=c[r]||[],a=s[0];if(void 0!==a){var u,o,f=e.getHierarchicalFacetByName(r),h=e._getHierarchicalFacetSeparator(f),l=e._getHierarchicalRootPath(f);if(t===r){if(-1===a.indexOf(h)||!l&&!0===i||l&&l.split(h).length===a.split(h).length)return;l?(o=l.split(h).length-1,a=l):(o=a.split(h).length-2,a=a.slice(0,a.lastIndexOf(h))),u=f.attributes[o]}else o=a.split(h).length-1,u=f.attributes[o];u&&n.push([u+":"+a])}}),n},_getHitsHierarchicalFacetsAttributes:function(e){var t=[];return e.hierarchicalFacets.reduce(function(t,i){var n=e.getHierarchicalRefinement(i.name)[0];if(!n)return t.push(i.attributes[0]),t;var r=e._getHierarchicalFacetSeparator(i),s=n.split(r).length,a=i.attributes.slice(0,s+1);return t.concat(a)},t)},_getDisjunctiveHierarchicalFacetAttribute:function(e,t,i){var n=e._getHierarchicalFacetSeparator(t);if(!0===i){var r=e._getHierarchicalRootPath(t),s=0;return r&&(s=r.split(n).length),[t.attributes[s]]}var a=e.getHierarchicalRefinement(t.name)[0]||"",c=a.split(n).length-1;return t.attributes.slice(0,c+1)},getSearchForFacetQuery:function(e,t,i,a){var c=a.isDisjunctiveFacet(e)?a.clearRefinements(e):a,u={facetQuery:t,facetName:e};return"number"==typeof i&&(u.maxFacetHits=i),n(r({},s._getHitsSearchParams(c),u))}};t.exports=s},{"./functions/merge":17}],23:[function(e,t,i){"use strict";t.exports=function(e){return null!==e&&/^[a-zA-Z0-9_-]{1,64}$/.test(e)}},{}],24:[function(e,t,i){"use strict";t.exports="3.13.3"},{}]},{},[2])(2)});
//# sourceMappingURL=dist/algoliasearch.helper.min.js.map
import EventEmitter from '@algolia/events';
import {
import type {
FindAnswersResponse,

@@ -918,3 +918,3 @@ HighlightResult,

*/
insideBoundingBox?: [number, number, number, number][];
insideBoundingBox?: Array<[number, number, number, number]>;
/**

@@ -1161,9 +1161,11 @@ * Selects how the query words are interpreted

*/
hits: (T & {
readonly objectID: string;
readonly _highlightResult?: HighlightResult<T>;
readonly _snippetResult?: SnippetResult<T>;
readonly _rankingInfo?: RankingInfo;
readonly _distinctSeqID?: number;
})[];
hits: Array<
T & {
readonly objectID: string;
readonly _highlightResult?: HighlightResult<T>;
readonly _snippetResult?: SnippetResult<T>;
readonly _rankingInfo?: RankingInfo;
readonly _distinctSeqID?: number;
}
>;
/**

@@ -1319,3 +1321,3 @@ * index where the results come from

_rawResults: SearchResponse<T>[];
_rawResults: Array<SearchResponse<T>>;
_state: SearchParameters;

@@ -1331,3 +1333,3 @@

state: SearchParameters,
results: SearchResponse<T>[],
results: Array<SearchResponse<T>>,
options?: SearchResultsOptions

@@ -1334,0 +1336,0 @@ );

{
"name": "algoliasearch-helper",
"version": "3.13.3",
"version": "3.13.4",
"description": "Helper for implementing advanced search features with algolia",

@@ -12,12 +12,6 @@ "main": "index.js",

"doc": "node documentation-src/metalsmith.js",
"doc:publish": "yarn run doc && gh-pages -d documentation",
"doc:staging": "scripts/staging-doc.sh",
"readme:toc": "doctoc --notitle README.md --maxlevel 3",
"test": "scripts/retry.sh 3 'scripts/test.sh'",
"test": "../../scripts/retry.sh 3 'scripts/test.sh'",
"test:unit": "jest",
"test:watch": "jest --watch",
"release": "./scripts/release.js",
"changelog:view-last": "conventional-changelog -u -n scripts/conventional-changelog/",
"changelog:update": "conventional-changelog -i CHANGELOG -s -u -n scripts/conventional-changelog/",
"prepare": "patch-package"
"test:v3": "yarn run test"
},

@@ -31,3 +25,3 @@ "author": {

"type": "git",
"url": "https://github.com/algolia/algoliasearch-helper-js.git"
"url": "https://github.com/algolia/instantsearch/tree/master/packages/algoliasearch-helper"
},

@@ -43,39 +37,9 @@ "files": [

"devDependencies": {
"@metalsmith/sass": "1.4.0",
"@types/algoliasearch": "3.34.11",
"algoliasearch": "4.8.3",
"doctoc": "1.3.0",
"patch-package": "6.2.2",
"eslint": "6.8.0",
"eslint-config-algolia": "16.0.0",
"eslint-config-prettier": "6.15.0",
"eslint-import-resolver-typescript": "2.5.0",
"eslint-plugin-deprecation": "1.3.2",
"eslint-plugin-eslint-comments": "3.2.0",
"eslint-plugin-import": "2.24.2",
"eslint-plugin-jasmine": "4.1.0",
"eslint-plugin-jest": "27.0.4",
"eslint-plugin-prettier": "3.4.0",
"eslint-plugin-react": "7.26.0",
"eslint-plugin-react-hooks": "4.3.0",
"eslint-plugin-vue": "9.8.0",
"eslint-plugin-wdio": "5.11.0",
"@typescript-eslint/eslint-plugin": "5.38.1",
"@typescript-eslint/parser": "4.31.2",
"prettier": "2.4.1",
"gh-pages": "1.0.0",
"jest": "24.7.1",
"jest-watch-typeahead": "0.3.0",
"browserify": "14.5.0",
"exorcist": "1.0.1",
"uglify-js": "2.8.29",
"colors": "1.1.2",
"conventional-changelog-cli": "1.3.2",
"pretty-bytes-cli": "2.0.0",
"prompt": "1.0.0",
"semver": "5.3.0",
"shelljs": "0.7.8",
"mversion": "1.13.0",
"yargs": "13.2.4",
"handlebars": "4.1.0",
"jest-watch-typeahead": "0.3.0",
"jsdoc-to-markdown": "8.0.0",
"handlebars": "4.1.0",
"metalsmith": "2.5.1",

@@ -86,5 +50,5 @@ "metalsmith-in-place": "1.4.4",

"metalsmith-metallic": "1.0.0",
"@metalsmith/sass": "1.4.0",
"pretty-bytes-cli": "2.0.0",
"pug": "2.0.3",
"typescript": "5.1.3"
"uglify-js": "2.8.29"
},

@@ -96,3 +60,4 @@ "dependencies": {

"algoliasearch": ">= 3.1 < 6"
}
},
"gitHead": "eedac3a158042dac41cc818439e585ed1b482250"
}

@@ -5,14 +5,12 @@ _Coming from V1 (or js client v2)?_ Read the [migration guide](https://github.com/algolia/algoliasearch-helper-js/wiki/Migration-guide-:-V1-to-V2) to the new version of the Helper.

**The JavaScript helper is an advanced library we provide to our users. If you are looking to build a complete search interface, we recommend you to use [instantsearch.js](https://community.algolia.com/instantsearch.js/). If you want to build an autocomplete menu, see [autocomplete.js](https://github.com/algolia/autocomplete.js).**
**The JavaScript helper is an advanced library we provide to our users. If you are looking to build a complete search interface, we recommend you to use [InstantSearch](https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/). If you want to build an autocomplete menu, see [Autocomplete](https://github.com/algolia/autocomplete).**
# algoliasearch-helper-js
# algoliasearch-helper
This module is the companion of the [algolia/algoliasearch-client-js](https://github.com/algolia/algoliasearch-client-js). It helps you keep track of the search parameters and provides a higher level API.
This module is the companion of the [algolia/algoliasearch-client-javascript](https://github.com/algolia/algoliasearch-client-javascript). It helps you keep track of the search parameters and provides a higher level API.
[See the helper in action](https://community.algolia.com/algoliasearch-helper-js/)
[![Version][version-svg]][package-url] [![Build Status][travis-svg]][travis-url] [![License][license-image]][license-url] [![Downloads][downloads-image]][downloads-url] [![jsDelivr Hits][jsdelivr-badge]][jsdelivr-hits]
[![Version][version-svg]][package-url] [![License][license-image]][license-url] [![Downloads][downloads-image]][downloads-url] [![jsDelivr Hits][jsdelivr-badge]][jsdelivr-hits]
[travis-svg]: https://img.shields.io/travis/algolia/algoliasearch-helper-js/develop.svg?style=flat-square
[travis-url]: https://travis-ci.org/algolia/algoliasearch-helper-js
[license-image]: http://img.shields.io/badge/license-MIT-green.svg?style=flat-square

@@ -30,2 +28,3 @@ [license-url]: LICENSE

- [Features](#features)

@@ -1333,4 +1332,4 @@ - [Examples](#examples)

# Browser support
## Browser support
This project works on any [ES5](https://en.wikipedia.org/wiki/ECMAScript#5th_Edition) browser, basically >= IE9+.

@@ -411,9 +411,6 @@ 'use strict';

// eslint-disable-next-line no-param-reassign
content = Array.isArray(content) ? content[0] : content;
content.facetHits.forEach(function (f) {
// eslint-disable-next-line no-param-reassign
f.escapedValue = escapeFacetValue(f.value);
// eslint-disable-next-line no-param-reassign
f.isRefined = isDisjunctive

@@ -420,0 +417,0 @@ ? state.isDisjunctiveFacetRefined(facet, f.escapedValue)

@@ -15,6 +15,4 @@ 'use strict';

// remove if already added, so that we can add it in correct order
// eslint-disable-next-line no-param-reassign
delete acc[key];
}
// eslint-disable-next-line no-param-reassign
acc[key] = source[key];

@@ -21,0 +19,0 @@ });

'use strict';
function inherits(ctor, superCtor) {
// eslint-disable-next-line no-param-reassign
ctor.prototype = Object.create(superCtor.prototype, {

@@ -6,0 +5,0 @@ constructor: {

@@ -23,2 +23,3 @@ 'use strict';

// eslint-disable-next-line no-restricted-syntax
for (var key in source) {

@@ -46,6 +47,4 @@ if (

) {
// eslint-disable-next-line no-param-reassign
target[key] = _merge(targetVal, sourceVal);
} else {
// eslint-disable-next-line no-param-reassign
target[key] = clone(sourceVal);

@@ -74,3 +73,2 @@ }

if (!isObjectOrArrayOrFunction(target)) {
// eslint-disable-next-line no-param-reassign
target = {};

@@ -77,0 +75,0 @@ }

@@ -41,3 +41,2 @@ 'use strict';

if (!Array.isArray(orders)) {
// eslint-disable-next-line no-param-reassign
orders = [];

@@ -44,0 +43,0 @@ }

@@ -11,3 +11,2 @@ 'use strict';

.reduce(function (acc, curr) {
// eslint-disable-next-line no-param-reassign
acc[curr] = obj[curr];

@@ -14,0 +13,0 @@ return acc;

@@ -736,3 +736,2 @@ 'use strict';

// eslint-disable-next-line no-param-reassign
memo[key] = operatorList;

@@ -1559,3 +1558,2 @@

var previousPlainObject = Object.keys(this).reduce(function (acc, key) {
// eslint-disable-next-line no-param-reassign
acc[key] = self[key];

@@ -1577,3 +1575,2 @@ return acc;

if (isNextValueDefined) {
// eslint-disable-next-line no-param-reassign
previous[key] = nextWithNumbers[key];

@@ -1580,0 +1577,0 @@ }

@@ -133,3 +133,3 @@ 'use strict';

}
// eslint-disable-next-line no-param-reassign
memo[key] = facetList;

@@ -136,0 +136,0 @@

@@ -74,3 +74,2 @@ 'use strict';

if (facetStats && facetStats[key]) {
// eslint-disable-next-line no-param-reassign
dest.stats = facetStats[key];

@@ -750,3 +749,2 @@ }

function setIsRefined(item, currentRefinement, depth) {
// eslint-disable-next-line no-param-reassign
item.isRefined = item.name === currentRefinement[depth];

@@ -770,3 +768,2 @@ if (item.data) {

function recSort(sortFn, node, names, level) {
// eslint-disable-next-line no-param-reassign
level = level || 0;

@@ -819,3 +816,2 @@

var reverseOrder = order.reduce(function (acc, name, i) {
// eslint-disable-next-line no-param-reassign
acc[name] = i;

@@ -822,0 +818,0 @@ return acc;

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc