!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,n,r){function i(s,o){if(!n[s]){if(!t[s]){var c="function"==typeof require&&require;if(!o&&c)return c(s,!0);if(a)return a(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var l=n[s]={exports:{}};t[s][0].call(l.exports,function(e){var n=t[s][1][e];return i(n?n:e)},l,l.exports,e,t,n,r)}return n[s].exports}for(var a="function"==typeof require&&require,s=0;se||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,n,r,a,c,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||s(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;throw TypeError('Uncaught, unspecified "error" event.')}if(n=this._events[e],o(n))return!1;if(i(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:for(r=arguments.length,a=new Array(r-1),c=1;r>c;c++)a[c-1]=arguments[c];n.apply(this,a)}else if(s(n)){for(r=arguments.length,a=new Array(r-1),c=1;r>c;c++)a[c-1]=arguments[c];for(u=n.slice(),r=u.length,c=0;r>c;c++)u[c].apply(this,a)}return!0},r.prototype.addListener=function(e,t){var n;if(!i(t))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,i(t.listener)?t.listener:t),this._events[e]?s(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,s(this._events[e])&&!this._events[e].warned){var n;n=o(this._maxListeners)?r.defaultMaxListeners:this._maxListeners,n&&n>0&&this._events[e].length>n&&(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())}return this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function n(){this.removeListener(e,n),r||(r=!0,t.apply(this,arguments))}if(!i(t))throw TypeError("listener must be a function");var r=!1;return n.listener=t,this.on(e,n),this},r.prototype.removeListener=function(e,t){var n,r,a,o;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],a=n.length,r=-1,n===t||i(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(s(n)){for(o=a;o-->0;)if(n[o]===t||n[o].listener&&n[o].listener===t){r=o;break}if(0>r)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,n;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(n=this._events[e],i(n))this.removeListener(e,n);else for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?i(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.listenerCount=function(e,t){var n;return n=e._events&&e._events[t]?i(e._events[t])?1:e._events[t].length:0}},{}],3:[function(e,t,n){"function"==typeof Object.create?t.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},{}],4:[function(e,t,n){function r(){l=!1,o.length?u=o.concat(u):f=-1,u.length&&i()}function i(){if(!l){var e=setTimeout(r);l=!0;for(var t=u.length;t;){for(o=u,u=[];++f1)for(var n=1;n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),g(t)?r.showHidden=t:t&&n._extend(r,t),j(r.showHidden)&&(r.showHidden=!1),j(r.depth)&&(r.depth=2),j(r.colors)&&(r.colors=!1),j(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=a),c(r,e,r.depth)}function a(e,t){var n=i.styles[t];return n?"["+i.colors[n][0]+"m"+e+"["+i.colors[n][1]+"m":e}function s(e,t){return e}function o(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}function c(e,t,r){if(e.customInspect&&t&&O(t.inspect)&&t.inspect!==n.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(r,e);return b(i)||(i=c(e,i,r)),i}var a=u(e,t);if(a)return a;var s=Object.keys(t),g=o(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(t)),w(t)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return l(t);if(0===s.length){if(O(t)){var v=t.name?": "+t.name:"";return e.stylize("[Function"+v+"]","special")}if(F(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(_(t))return e.stylize(Date.prototype.toString.call(t),"date");if(w(t))return l(t)}var y="",m=!1,x=["{","}"];if(d(t)&&(m=!0,x=["[","]"]),O(t)){var j=t.name?": "+t.name:"";y=" [Function"+j+"]"}if(F(t)&&(y=" "+RegExp.prototype.toString.call(t)),_(t)&&(y=" "+Date.prototype.toUTCString.call(t)),w(t)&&(y=" "+l(t)),0===s.length&&(!m||0==t.length))return x[0]+y+x[1];if(0>r)return F(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var R;return R=m?f(e,t,r,g,s):s.map(function(n){return h(e,t,r,g,n,m)}),e.seen.pop(),p(R,y,x)}function u(e,t){if(j(t))return e.stylize("undefined","undefined");if(b(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return m(t)?e.stylize(""+t,"number"):g(t)?e.stylize(""+t,"boolean"):v(t)?e.stylize("null","null"):void 0}function l(e){return"["+Error.prototype.toString.call(e)+"]"}function f(e,t,n,r,i){for(var a=[],s=0,o=t.length;o>s;++s)S(t,String(s))?a.push(h(e,t,n,r,String(s),!0)):a.push("");return i.forEach(function(i){i.match(/^\d+$/)||a.push(h(e,t,n,r,i,!0))}),a}function h(e,t,n,r,i,a){var s,o,u;if(u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]},u.get?o=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(o=e.stylize("[Setter]","special")),S(r,i)||(s="["+i+"]"),o||(e.seen.indexOf(u.value)<0?(o=v(n)?c(e,u.value,null):c(e,u.value,n-1),o.indexOf("\n")>-1&&(o=a?o.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+o.split("\n").map(function(e){return" "+e}).join("\n"))):o=e.stylize("[Circular]","special")),j(s)){if(a&&i.match(/^\d+$/))return o;s=JSON.stringify(""+i),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+o}function p(e,t,n){var r=0,i=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function d(e){return Array.isArray(e)}function g(e){return"boolean"==typeof e}function v(e){return null===e}function y(e){return null==e}function m(e){return"number"==typeof e}function b(e){return"string"==typeof e}function x(e){return"symbol"==typeof e}function j(e){return void 0===e}function F(e){return R(e)&&"[object RegExp]"===P(e)}function R(e){return"object"==typeof e&&null!==e}function _(e){return R(e)&&"[object Date]"===P(e)}function w(e){return R(e)&&("[object Error]"===P(e)||e instanceof Error)}function O(e){return"function"==typeof e}function A(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function P(e){return Object.prototype.toString.call(e)}function E(e){return 10>e?"0"+e.toString(10):e.toString(10)}function k(){var e=new Date,t=[E(e.getHours()),E(e.getMinutes()),E(e.getSeconds())].join(":");return[e.getDate(),T[e.getMonth()],t].join(" ")}function S(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var L=/%[sdj%]/g;n.format=function(e){if(!b(e)){for(var t=[],n=0;n=a)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return e}}),o=r[n];a>n;o=r[++n])s+=v(o)||!R(o)?" "+o:" "+i(o);return s},n.deprecate=function(e,i){function a(){if(!s){if(t.throwDeprecation)throw new Error(i);t.traceDeprecation?console.trace(i):console.error(i),s=!0}return e.apply(this,arguments)}if(j(r.process))return function(){return n.deprecate(e,i).apply(this,arguments)};if(t.noDeprecation===!0)return e;var s=!1;return a};var C,I={};n.debuglog=function(e){if(j(C)&&(C=t.env.NODE_DEBUG||""),e=e.toUpperCase(),!I[e])if(new RegExp("\\b"+e+"\\b","i").test(C)){var r=t.pid;I[e]=function(){var t=n.format.apply(n,arguments);console.error("%s %d: %s",e,r,t)}}else I[e]=function(){};return I[e]},n.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},n.isArray=d,n.isBoolean=g,n.isNull=v,n.isNullOrUndefined=y,n.isNumber=m,n.isString=b,n.isSymbol=x,n.isUndefined=j,n.isRegExp=F,n.isObject=R,n.isDate=_,n.isError=w,n.isFunction=O,n.isPrimitive=A,n.isBuffer=e("./support/isBuffer");var T=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];n.log=function(){console.log("%s - %s",k(),n.format.apply(n,arguments))},n.inherits=e("inherits"),n._extend=function(e,t){if(!t||!R(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":5,_process:4,inherits:3}],7:[function(e,t,n){function r(e){for(var t=-1,n=e?e.length:0,r=-1,i=[];++tn?s(r+n,0):n;else if(n){var o=a(e,t);return r>o&&(t===t?t===e[o]:e[o]!==e[o])?o:-1}return i(e,t,n||0)}var i=e("../internal/baseIndexOf"),a=e("../internal/binaryIndex"),s=Math.max;t.exports=r},{"../internal/baseIndexOf":53,"../internal/binaryIndex":73}],10:[function(e,t,n){var r=e("../internal/baseIndexOf"),i=e("../internal/cacheIndexOf"),a=e("../internal/createCache"),s=e("../internal/isArrayLike"),o=e("../function/restParam"),c=o(function(e){for(var t=e.length,n=t,o=Array(d),c=r,u=!0,l=[];n--;){var f=e[n]=s(f=e[n])?f:[];o[n]=u&&f.length>=120?a(n&&f):null}var h=e[0],p=-1,d=h?h.length:0,g=o[0];e:for(;++pn?f(h+n,0):n||0,"string"==typeof e||!s(e)&&u(e)?h>=n&&e.indexOf(t,n)>-1:!!h&&i(e,t,n)>-1}var i=e("../internal/baseIndexOf"),a=e("../internal/getLength"),s=e("../lang/isArray"),o=e("../internal/isIterateeCall"),c=e("../internal/isLength"),u=e("../lang/isString"),l=e("../object/values"),f=Math.max;t.exports=r},{"../internal/baseIndexOf":53,"../internal/getLength":102,"../internal/isIterateeCall":108,"../internal/isLength":111,"../lang/isArray":131,"../lang/isString":137,"../object/values":150}],17:[function(e,t,n){function r(e,t,n){var r=o(e)?i:s;return t=a(t,n,3),r(e,t)}var i=e("../internal/arrayMap"),a=e("../internal/baseCallback"),s=e("../internal/baseMap"),o=e("../lang/isArray");t.exports=r},{"../internal/arrayMap":31,"../internal/baseCallback":39,"../internal/baseMap":58,"../lang/isArray":131}],18:[function(e,t,n){function r(e,t){return i(e,a(t))}var i=e("./map"),a=e("../utility/property");t.exports=r},{"../utility/property":154,"./map":17}],19:[function(e,t,n){var r=e("../internal/arrayReduce"),i=e("../internal/baseEach"),a=e("../internal/createReduce"),s=a(r,i);t.exports=s},{"../internal/arrayReduce":33,"../internal/baseEach":44,"../internal/createReduce":95}],20:[function(e,t,n){function r(e,t,n,r){return null==e?[]:(r&&s(t,n,r)&&(n=void 0),a(t)||(t=null==t?[]:[t]),a(n)||(n=null==n?[]:[n]),i(e,t,n))}var i=e("../internal/baseSortByOrder"),a=e("../lang/isArray"),s=e("../internal/isIterateeCall");t.exports=r},{"../internal/baseSortByOrder":69,"../internal/isIterateeCall":108,"../lang/isArray":131}],21:[function(e,t,n){t.exports=e("../math/sum")},{"../math/sum":141}],22:[function(e,t,n){var r=e("../internal/getNative"),i=r(Date,"now"),a=i||function(){return(new Date).getTime()};t.exports=a},{"../internal/getNative":104}],23:[function(e,t,n){var r=e("../internal/createWrapper"),i=e("../internal/replaceHolders"),a=e("./restParam"),s=1,o=32,c=a(function(e,t,n){var a=s;if(n.length){var u=i(n,c.placeholder);a|=o}return r(e,a,t,n,u)});c.placeholder={},t.exports=c},{"../internal/createWrapper":96,"../internal/replaceHolders":121,"./restParam":24}],24:[function(e,t,n){function r(e,t){if("function"!=typeof e)throw new TypeError(i);return t=a(void 0===t?e.length-1:+t||0,0),function(){for(var n=arguments,r=-1,i=a(n.length-t,0),s=Array(i);++rt&&!a||!i||n&&!s&&o||r&&o)return 1;if(t>e&&!n||!o||a&&!r&&i||s&&i)return-1}return 0}t.exports=r},{}],41:[function(e,t,n){function r(e,t,n){n||(n={});for(var r=-1,i=t.length;++r=o?s(t):null,h=t.length;f&&(u=a,l=!1,t=f);e:for(;++cr;)e=e[t[r++]];return r&&r==a?e:void 0}}var i=e("./toObject");t.exports=r},{"./toObject":125}],53:[function(e,t,n){function r(e,t,n){if(t!==t)return i(e,n);for(var r=n-1,a=e.length;++rt&&(t=-t>i?0:i+t),n=void 0===n||n>i?i:+n||0,0>n&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(i);++r=s){for(;s>r;){var c=r+s>>>1,u=e[c];(n?t>=u:t>u)&&null!==u?r=c+1:s=c}return s}return i(e,t,a,n)}var i=e("./binaryIndexBy"),a=e("../utility/identity"),s=4294967295,o=s>>>1;t.exports=r},{"../utility/identity":152,"./binaryIndexBy":74}],74:[function(e,t,n){function r(e,t,n,r){t=n(t);for(var s=0,c=e?e.length:0,u=t!==t,l=null===t,f=void 0===t;c>s;){var h=i((s+c)/2),p=n(e[h]),d=void 0!==p,g=p===p;if(u)var v=g||r;else v=l?g&&d&&(r||null!=p):f?g&&(r||d):null==p?!1:r?t>=p:t>p;v?s=h+1:c=h}return a(c,o)}var i=Math.floor,a=Math.min,s=4294967295,o=s-1;t.exports=r},{}],75:[function(e,t,n){function r(e,t,n){if("function"!=typeof e)return i;if(void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 3:return function(n,r,i){return e.call(t,n,r,i)};case 4:return function(n,r,i,a){return e.call(t,n,r,i,a)};case 5:return function(n,r,i,a,s){return e.call(t,n,r,i,a,s)}}return function(){return e.apply(t,arguments)}}var i=e("../utility/identity");t.exports=r},{"../utility/identity":152}],76:[function(e,t,n){function r(e,t){var n=e.data,r="string"==typeof t||i(t)?n.set.has(t):n.hash[t];return r?0:-1}var i=e("../lang/isObject");t.exports=r},{"../lang/isObject":135}],77:[function(e,t,n){function r(e){var t=this.data;"string"==typeof e||i(e)?t.set.add(e):t.hash[e]=!0}var i=e("../lang/isObject");t.exports=r},{"../lang/isObject":135}],78:[function(e,t,n){function r(e,t){for(var n=-1,r=e.length;++n-1;);return n}t.exports=r},{}],79:[function(e,t,n){function r(e,t){for(var n=e.length;n--&&t.indexOf(e.charAt(n))>-1;);return n}t.exports=r},{}],80:[function(e,t,n){function r(e,t,n){for(var r=-1,a=e.criteria,s=t.criteria,o=a.length,c=n.length;++r=c)return u;var l=n[r];return u*("asc"===l||l===!0?1:-1)}}return e.index-t.index}var i=e("./baseCompareAscending");t.exports=r},{"./baseCompareAscending":40}],81:[function(e,t,n){function r(e,t,n){for(var r=n.length,a=-1,s=i(e.length-r,0),o=-1,c=t.length,u=Array(c+s);++o2?n[s-2]:void 0,c=s>2?n[2]:void 0,u=s>1?n[s-1]:void 0;for("function"==typeof o?(o=i(o,u,5),s-=2):(o="function"==typeof u?u:void 0,s-=o?1:0),c&&a(n[0],n[1],c)&&(o=3>s?void 0:o,s=1);++r-1?n[u]:void 0}return a(n,r,e)}}var i=e("./baseCallback"),a=e("./baseFind"),s=e("./baseFindIndex"),o=e("../lang/isArray");t.exports=r},{"../lang/isArray":131,"./baseCallback":39,"./baseFind":46,"./baseFindIndex":47}],91:[function(e,t,n){function r(e){return function(t,n,r){return t&&t.length?(n=i(n,r,3),a(t,n,e)):-1}}var i=e("./baseCallback"),a=e("./baseFindIndex");t.exports=r},{"./baseCallback":39,"./baseFindIndex":47}],92:[function(e,t,n){function r(e,t){return function(n,r,s){return"function"==typeof r&&void 0===s&&a(n)?e(n,r):t(n,i(r,s,3))}}var i=e("./bindCallback"),a=e("../lang/isArray");t.exports=r},{"../lang/isArray":131,"./bindCallback":75}],93:[function(e,t,n){(function(n){function r(e,t,j,F,R,_,w,O,A,P){function E(){for(var d=arguments.length,g=d,v=Array(d);g--;)v[g]=arguments[g];if(F&&(v=a(v,F,R)),_&&(v=s(v,_,w)),C||T){var b=E.placeholder,N=l(v,b);if(d-=N.length,P>d){var H=O?i(O):void 0,M=x(P-d,0),B=C?N:void 0,Q=C?void 0:N,z=C?v:void 0,W=C?void 0:v;t|=C?y:m,t&=~(C?m:y),I||(t&=~(h|p));var q=[e,t,j,z,B,W,Q,H,A,M],U=r.apply(void 0,q);return c(e)&&f(U,q),U.placeholder=b,U}}var $=S?j:this,G=L?$[e]:e;return O&&(v=u(v,O)),k&&Au))return!1;for(;++c-1&&e%1==0&&t>e}var i=/^\d+$/,a=9007199254740991;t.exports=r},{}],108:[function(e,t,n){function r(e,t,n){if(!s(n))return!1;var r=typeof t;if("number"==r?i(n)&&a(t,n.length):"string"==r&&t in n){var o=n[t];return e===e?e===o:o!==o}return!1}var i=e("./isArrayLike"),a=e("./isIndex"),s=e("../lang/isObject");t.exports=r},{"../lang/isObject":135,"./isArrayLike":106,"./isIndex":107}],109:[function(e,t,n){function r(e,t){var n=typeof e;if("string"==n&&o.test(e)||"number"==n)return!0;if(i(e))return!1;var r=!s.test(e);return r||null!=t&&e in a(t)}var i=e("../lang/isArray"),a=e("./toObject"),s=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,o=/^\w*$/;t.exports=r},{"../lang/isArray":131,"./toObject":125}],110:[function(e,t,n){function r(e){var t=s(e);if(!(t in i.prototype))return!1;var n=o[t];if(e===n)return!0;var r=a(n);return!!r&&e===r[0]}var i=e("./LazyWrapper"),a=e("./getData"),s=e("./getFuncName"),o=e("../chain/lodash");t.exports=r},{"../chain/lodash":12,"./LazyWrapper":25,"./getData":100,"./getFuncName":101}],111:[function(e,t,n){function r(e){return"number"==typeof e&&e>-1&&e%1==0&&i>=e}var i=9007199254740991;t.exports=r},{}],112:[function(e,t,n){function r(e){return!!e&&"object"==typeof e}t.exports=r},{}],113:[function(e,t,n){function r(e){return 160>=e&&e>=9&&13>=e||32==e||160==e||5760==e||6158==e||e>=8192&&(8202>=e||8232==e||8233==e||8239==e||8287==e||12288==e||65279==e)}t.exports=r},{}],114:[function(e,t,n){function r(e){return e===e&&!i(e)}var i=e("../lang/isObject");t.exports=r},{"../lang/isObject":135}],115:[function(e,t,n){function r(e,t){var n=e[1],r=t[1],g=n|r,v=f>g,y=r==f&&n==l||r==f&&n==h&&e[7].length<=t[8]||r==(f|h)&&n==l;if(!v&&!y)return e;r&c&&(e[2]=t[2],g|=n&c?0:u);var m=t[3];if(m){var b=e[3];e[3]=b?a(b,m,t[4]):i(m),e[4]=b?o(e[3],p):i(t[4])}return m=t[5],m&&(b=e[5],e[5]=b?s(b,m,t[6]):i(m),e[6]=b?o(e[5],p):i(t[6])),m=t[7],m&&(e[7]=i(m)),r&f&&(e[8]=null==e[8]?t[8]:d(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=g,e}var i=e("./arrayCopy"),a=e("./composeArgs"),s=e("./composeArgsRight"),o=e("./replaceHolders"),c=1,u=4,l=8,f=128,h=256,p="__lodash_placeholder__",d=Math.min;t.exports=r},{"./arrayCopy":28,"./composeArgs":81,"./composeArgsRight":82,"./replaceHolders":121}],116:[function(e,t,n){(function(n){var r=e("./getNative"),i=r(n,"WeakMap"),a=i&&new i;t.exports=a}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./getNative":104}],117:[function(e,t,n){function r(e,t){e=i(e);for(var n=-1,r=t.length,a={};++n0){if(++e>=a)return n}else e=0;return r(n,o)}}();t.exports=o},{"../date/now":22,"./baseSetData":66}],123:[function(e,t,n){function r(e){for(var t=c(e),n=t.length,r=n&&e.length,u=!!r&&o(r)&&(a(e)||i(e)),f=-1,h=[];++f0;++r0;if(r(i)||!s)return s;var o=""+i;return-1!==a(t[n],o)}};t.exports=f},{"lodash/array/indexOf":9,"lodash/collection/filter":13,"lodash/collection/reduce":19,"lodash/lang/isEmpty":132,"lodash/lang/isFunction":133,"lodash/lang/isString":137,"lodash/lang/isUndefined":139,"lodash/object/defaults":143,"lodash/object/omit":147}],156:[function(e,t,n){"use strict";function r(e){var t=e||{};this.query=t.query||"",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||{},this.tagFilters=t.tagFilters,this.hitsPerPage=t.hitsPerPage,this.maxValuesPerFacet=t.maxValuesPerFacet,this.page=t.page||0,this.queryType=t.queryType,this.typoTolerance=t.typoTolerance,this.minWordSizefor1Typo=t.minWordSizefor1Typo,this.minWordSizefor2Typos=t.minWordSizefor2Typos,this.allowTyposOnNumericTokens=t.allowTyposOnNumericTokens,this.ignorePlurals=t.ignorePlurals,this.restrictSearchableAttributes=t.restrictSearchableAttributes,this.advancedSyntax=t.advancedSyntax,this.analytics=t.analytics,this.analyticsTags=t.analyticsTags,this.synonyms=t.synonyms,this.replaceSynonymsInHighlight=t.replaceSynonymsInHighlight,this.optionalWords=t.optionalWords,this.removeWordsIfNoResults=t.removeWordsIfNoResults,this.attributesToRetrieve=t.attributesToRetrieve,this.attributesToHighlight=t.attributesToHighlight,this.highlightPreTag=t.highlightPreTag,this.highlightPostTag=t.highlightPostTag,this.attributesToSnippet=t.attributesToSnippet,this.getRankingInfo=t.getRankingInfo,this.distinct=t.distinct,this.aroundLatLng=t.aroundLatLng,this.aroundLatLngViaIP=t.aroundLatLngViaIP,this.aroundRadius=t.aroundRadius,this.aroundPrecision=t.aroundPrecision,this.insideBoundingBox=t.insideBoundingBox}var i=e("lodash/object/keys"),a=e("lodash/array/intersection"),s=e("lodash/collection/forEach"),o=e("lodash/collection/reduce"),c=e("lodash/collection/filter"),u=e("lodash/object/omit"),l=e("lodash/array/indexOf"),f=e("lodash/lang/isEmpty"),h=e("lodash/lang/isUndefined"),p=e("lodash/lang/isString"),d=e("lodash/lang/isFunction"),g=e("lodash/collection/find"),v=e("lodash/collection/pluck"),y=e("lodash/object/defaults"),m=e("lodash/object/merge"),b=e("../functions/deepFreeze"),x=e("./RefinementList");r.make=function(e){var t=new r(e);return b(t)},r.validate=function(e,t){var n=t||{},r=i(n),a=c(r,function(t){return!e.hasOwnProperty(t)});return 1===a.length?new Error("Property "+a[0]+" is not defined on SearchParameters (see http://algolia.github.io/algoliasearch-helper-js/docs/SearchParameters.html)"):a.length>1?new Error("Properties "+a.join(" ")+" are not defined on SearchParameters (see http://algolia.github.io/algoliasearch-helper-js/docs/SearchParameters.html)"):e.tagFilters&&n.tagRefinements&&n.tagRefinements.length>0?new Error("[Tags] Can't switch from the managed tag API to the advanced API. It is probably an error, if it's really what you want, you should first clear the tags with clearTags method."):e.tagRefinements.length>0&&n.tagFilters?new Error("[Tags] Can't switch from the advanced tag API to the managed API. It is probably an error, if it's not, you should first clear the tags with clearTags method."):null},r.prototype={constructor:r,clearRefinements:function(e){return this.setQueryParameters({page:0,numericRefinements:this._clearNumericRefinements(e),facetsRefinements:x.clearRefinement(this.facetsRefinements,e,"conjunctiveFacet"),facetsExcludes:x.clearRefinement(this.facetsExcludes,e,"exclude"),disjunctiveFacetsRefinements:x.clearRefinement(this.disjunctiveFacetsRefinements,e,"disjunctiveFacet"),hierarchicalFacetsRefinements:x.clearRefinement(this.hierarchicalFacetsRefinements,e,"hierarchicalFacet")})},clearTags:function(){return void 0===this.tagFilters&&0===this.tagRefinements.length?this:this.setQueryParameters({page:0,tagFilters:void 0,tagRefinements:[]})},setQuery:function(e){return e===this.query?this:this.setQueryParameters({query:e,page:0})},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,page:0})},setTypoTolerance:function(e){return this.typoTolerance===e?this:this.setQueryParameters({typoTolerance:e,page:0})},addNumericRefinement:function(e,t,n){if(this.isNumericRefined(e,t,n))return this;var r=m({},this.numericRefinements);return r[e]=m({},r[e]),r[e][t]=n,this.setQueryParameters({page:0,numericRefinements:r})},getConjunctiveRefinements:function(e){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return this.facetsRefinements[e]||[]},getDisjunctiveRefinements:function(e){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return this.disjunctiveFacetsRefinements[e]||[]},getHierarchicalRefinement:function(e){return this.hierarchicalFacetsRefinements[e]||[]},getExcludeRefinements:function(e){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return this.facetsExcludes[e]||[]},removeNumericRefinement:function(e,t){return this.isNumericRefined(e,t)?this.setQueryParameters({page:0,numericRefinements:this._clearNumericRefinements(function(n,r){return r===e&&n.op===t})}):this},getNumericRefinements:function(e){return this.numericRefinements[e]||[]},getNumericRefinement:function(e,t){return this.numericRefinements[e]&&this.numericRefinements[e][t]},_clearNumericRefinements:function(e){return h(e)?{}:p(e)?u(this.numericRefinements,e):d(e)?o(this.numericRefinements,function(t,n,r){var i=u(n,function(t,n){return e({val:t,op:n},r,"numeric")});return f(i)||(t[r]=i),t},{}):void 0},addFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return x.isRefined(this.facetsRefinements,e,t)?this:this.setQueryParameters({page:0,facetsRefinements:x.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 x.isRefined(this.facetsExcludes,e,t)?this:this.setQueryParameters({page:0,facetsExcludes:x.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 x.isRefined(this.disjunctiveFacetsRefinements,e,t)?this:this.setQueryParameters({page:0,disjunctiveFacetsRefinements:x.addRefinement(this.disjunctiveFacetsRefinements,e,t)})},addTagRefinement:function(e){if(this.isTagRefined(e))return this;var t={page:0,tagRefinements:this.tagRefinements.concat(e)};return this.setQueryParameters(t)},removeFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return x.isRefined(this.facetsRefinements,e,t)?this.setQueryParameters({page:0,facetsRefinements:x.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 x.isRefined(this.facetsExcludes,e,t)?this.setQueryParameters({page:0,facetsExcludes:x.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 x.isRefined(this.disjunctiveFacetsRefinements,e,t)?this.setQueryParameters({page:0,disjunctiveFacetsRefinements:x.removeRefinement(this.disjunctiveFacetsRefinements,e,t)}):this},removeTagRefinement:function(e){if(!this.isTagRefined(e))return this;var t={page:0,tagRefinements:c(this.tagRefinements,function(t){return t!==e})};return this.setQueryParameters(t)},toggleFacetRefinement: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({page:0,facetsRefinements:x.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({page:0,facetsExcludes:x.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({page:0,disjunctiveFacetsRefinements:x.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 n=this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(e)),r={},i=void 0!==this.hierarchicalFacetsRefinements[e]&&this.hierarchicalFacetsRefinements[e].length>0&&(this.hierarchicalFacetsRefinements[e][0]===t||0===this.hierarchicalFacetsRefinements[e][0].indexOf(t+n));return i?-1===t.indexOf(n)?r[e]=[]:r[e]=[t.slice(0,t.lastIndexOf(n))]:r[e]=[t], this.setQueryParameters({hierarchicalFacetsRefinements:y({},r,this.hierarchicalFacetsRefinements)})},toggleTagRefinement:function(e){return this.isTagRefined(e)?this.removeTagRefinement(e):this.addTagRefinement(e)},isDisjunctiveFacet:function(e){return l(this.disjunctiveFacets,e)>-1},isHierarchicalFacet:function(e){return void 0!==this.getHierarchicalFacetByName(e)},isConjunctiveFacet:function(e){return l(this.facets,e)>-1},isFacetRefined:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return x.isRefined(this.facetsRefinements,e,t)},isExcludeRefined:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return x.isRefined(this.facetsExcludes,e,t)},isDisjunctiveFacetRefined:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return x.isRefined(this.disjunctiveFacetsRefinements,e,t)},isNumericRefined:function(e,t,n){return h(n)?this.numericRefinements[e]&&!h(this.numericRefinements[e][t]):this.numericRefinements[e]&&!h(this.numericRefinements[e][t])&&this.numericRefinements[e][t]===n},isTagRefined:function(e){return-1!==l(this.tagRefinements,e)},getRefinedDisjunctiveFacets:function(){var e=a(i(this.numericRefinements),this.disjunctiveFacets);return i(this.disjunctiveFacetsRefinements).concat(e).concat(this.getRefinedHierarchicalFacets())},getRefinedHierarchicalFacets:function(){return a(v(this.hierarchicalFacets,"name"),i(this.hierarchicalFacetsRefinements))},getUnrefinedDisjunctiveFacets:function(){var e=this.getRefinedDisjunctiveFacets();return c(this.disjunctiveFacets,function(t){return-1===l(e,t)})},managedParameters:["facets","disjunctiveFacets","facetsRefinements","facetsExcludes","disjunctiveFacetsRefinements","numericRefinements","tagRefinements","hierarchicalFacets","hierarchicalFacetsRefinements"],getQueryParams:function(){var e=this.managedParameters;return o(this,function(t,n,r,i){return-1===l(e,r)&&void 0!==i[r]&&(t[r]=n),t},{})},getQueryParameter:function(e){if(!this.hasOwnProperty(e))throw new Error("Parameter '"+e+"' is not an attribute of SearchParameters (http://algolia.github.io/algoliasearch-helper-js/docs/SearchParameters.html)");return this[e]},setQueryParameter:function(e,t){if(this[e]===t)return this;var n={};return n[e]=t,this.setQueryParameters(n)},setQueryParameters:function(e){var t=r.validate(this,e);if(t)throw t;return this.mutateMe(function(t){var n=i(e);return s(n,function(n){t[n]=e[n]}),t})},mutateMe:function(e){var t=new this.constructor(this);return e(t,this),b(t)},_getHierarchicalFacetSortBy:function(e){return e.sortBy||["isRefined:desc","name:asc"]},_getHierarchicalFacetSeparator:function(e){return e.separator||" > "},getHierarchicalFacetByName:function(e){return g(this.hierarchicalFacets,{name:e})}},t.exports=r},{"../functions/deepFreeze":160,"./RefinementList":155,"lodash/array/indexOf":9,"lodash/array/intersection":10,"lodash/collection/filter":13,"lodash/collection/find":14,"lodash/collection/forEach":15,"lodash/collection/pluck":18,"lodash/collection/reduce":19,"lodash/lang/isEmpty":132,"lodash/lang/isFunction":133,"lodash/lang/isString":137,"lodash/lang/isUndefined":139,"lodash/object/defaults":143,"lodash/object/keys":144,"lodash/object/merge":146,"lodash/object/omit":147}],157:[function(e,t,n){"use strict";function r(e){return function(t,n){var r=e.hierarchicalFacets[n],a=e.hierarchicalFacetsRefinements[r.name]&&e.hierarchicalFacetsRefinements[r.name][0]||"",s=e._getHierarchicalFacetSeparator(r),c=o(e._getHierarchicalFacetSortBy(r)),u=i(c,s,a);return l(t,u,{name:e.hierarchicalFacets[n].name,count:null,isRefined:!0,path:null,data:null})}}function i(e,t,n){return function(r,i,o){var c=r;if(o>0){var l=0;for(c=r;o>l;)c=c&&p(c.data,{isRefined:!0}),l++}if(c){var h=a(c.path,n,t);c.data=f(u(d(i.data,h),s(t,n)),e[0],e[1])}return r}}function a(e,t,n){return function(r,i){return-1===i.indexOf(n)||-1===i.indexOf(n)&&-1===t.indexOf(n)||0===t.indexOf(i+n)||0===i.indexOf(e+n)}}function s(e,t){return function(n,r){return{name:h(c(r.split(e))),path:r,count:n,isRefined:t===r||0===t.indexOf(r+e),data:null}}}function o(e){return l(e,function(e,t){var n=t.split(":");return e[0].push(n[0]),e[1].push(n[1]),e},[[],[]])}t.exports=r;var c=e("lodash/array/last"),u=e("lodash/collection/map"),l=e("lodash/collection/reduce"),f=e("lodash/collection/sortByOrder"),h=e("lodash/string/trim"),p=e("lodash/collection/find"),d=e("lodash/object/pick")},{"lodash/array/last":11,"lodash/collection/find":14,"lodash/collection/map":17,"lodash/collection/reduce":19,"lodash/collection/sortByOrder":20,"lodash/object/pick":149,"lodash/string/trim":151}],158:[function(e,t,n){"use strict";function r(e){var t={};return o(e,function(e,n){t[e]=n}),t}function i(e,t,n){t&&t[n]&&(e.stats=t[n])}function a(e,t){return f(e,function(e){return h(e.attributes,t)})}function s(e,t){var n=t.results[0];this.query=n.query,this.hits=n.hits,this.index=n.index,this.hitsPerPage=n.hitsPerPage,this.nbHits=n.nbHits,this.nbPages=n.nbPages,this.page=n.page,this.processingTimeMS=l(t.results,"processingTimeMS"),this.disjunctiveFacets=[],this.hierarchicalFacets=p(e.hierarchicalFacets,function(){return[]}),this.facets=[];var s=e.getRefinedDisjunctiveFacets(),f=r(e.facets),h=r(e.disjunctiveFacets),m=1;o(n.facets,function(t,r){var s;if(s=a(e.hierarchicalFacets,r))this.hierarchicalFacets[d(e.hierarchicalFacets,{name:s.name})].push({attribute:r,data:t,exhaustive:n.exhaustiveFacetsCount});else{var o=-1!==u(e.disjunctiveFacets,r),c=o?h[r]:f[r];o?(this.disjunctiveFacets[c]={name:r,data:t,exhaustive:n.exhaustiveFacetsCount},i(this.disjunctiveFacets[c],n.facets_stats,r)):(this.facets[c]={name:r,data:t,exhaustive:n.exhaustiveFacetsCount},i(this.facets[c],n.facets_stats,r))}},this),o(s,function(r){var a=t.results[m],s=e.getHierarchicalFacetByName(r);o(a.facets,function(t,r){var c;if(s){c=d(e.hierarchicalFacets,{name:s.name});var l=d(this.hierarchicalFacets[c],{attribute:r});this.hierarchicalFacets[c][l].data=v({},this.hierarchicalFacets[c][l].data,t)}else{c=h[r];var f=n.facets&&n.facets[r]||{};this.disjunctiveFacets[c]={name:r,data:g({},t,f),exhaustive:a.exhaustiveFacetsCount},i(this.disjunctiveFacets[c],a.facets_stats,r),e.disjunctiveFacetsRefinements[r]&&o(e.disjunctiveFacetsRefinements[r],function(t){!this.disjunctiveFacets[c].data[t]&&u(e.disjunctiveFacetsRefinements[r],t)>-1&&(this.disjunctiveFacets[c].data[t]=0)},this)}},this),m++},this),o(e.getRefinedHierarchicalFacets(),function(n){var r=e.getHierarchicalFacetByName(n),i=e.getHierarchicalRefinement(n);if(!(0===i.length||i[0].split(e._getHierarchicalFacetSeparator(r)).length<2)){var a=t.results[m];o(a.facets,function(t,n){var a=d(e.hierarchicalFacets,{name:r.name}),s=d(this.hierarchicalFacets[a],{attribute:n}),o={};if(i.length>0){var c=i[0].split(e._getHierarchicalFacetSeparator(r))[0];o[c]=this.hierarchicalFacets[a][s].data[c]}this.hierarchicalFacets[a][s].data=g(o,t,this.hierarchicalFacets[a][s].data)},this),m++}},this),o(e.facetsExcludes,function(e,t){var r=f[t];this.facets[r]={name:t,data:n.facets[t],exhaustive:n.exhaustiveFacetsCount},o(e,function(e){this.facets[r]=this.facets[r]||{name:t},this.facets[r].data=this.facets[r].data||{},this.facets[r].data[e]=0},this)},this),this.hierarchicalFacets=p(this.hierarchicalFacets,y(e)),this.facets=c(this.facets),this.disjunctiveFacets=c(this.disjunctiveFacets),this._state=e}var o=e("lodash/collection/forEach"),c=e("lodash/array/compact"),u=e("lodash/array/indexOf"),l=e("lodash/collection/sum"),f=e("lodash/collection/find"),h=e("lodash/collection/includes"),p=e("lodash/collection/map"),d=e("lodash/array/findIndex"),g=e("lodash/object/defaults"),v=e("lodash/object/merge"),y=e("./generate-hierarchical-tree");s.prototype.getFacetByName=function(e){var t={name:e};return f(this.facets,t)||f(this.disjunctiveFacets,t)||f(this.hierarchicalFacets,t)},t.exports=s},{"./generate-hierarchical-tree":157,"lodash/array/compact":7,"lodash/array/findIndex":8,"lodash/array/indexOf":9,"lodash/collection/find":14,"lodash/collection/forEach":15,"lodash/collection/includes":16,"lodash/collection/map":17,"lodash/collection/sum":21,"lodash/object/defaults":143,"lodash/object/merge":146}],159:[function(e,t,n){"use strict";function r(e,t,n){this.client=e,this.index=t,this.state=i.make(n),this.lastResults=null,this._queryId=0,this._lastQueryIdReceived=-1}var i=e("./SearchParameters"),a=e("./SearchResults"),s=e("util"),o=e("events"),c=e("lodash/collection/forEach"),u=e("lodash/lang/isEmpty"),l=e("lodash/function/bind"),f=e("lodash/collection/reduce"),h=e("lodash/collection/map"),p=e("lodash/string/trim"),d=e("lodash/object/merge");s.inherits(r,o.EventEmitter),r.prototype.search=function(){return this._search(),this},r.prototype.setQuery=function(e){return this.state=this.state.setQuery(e),this._change(),this},r.prototype.clearRefinements=function(e){return this.state=this.state.clearRefinements(e),this._change(),this},r.prototype.clearTags=function(){return this.state=this.state.clearTags(),this._change(),this},r.prototype.addDisjunctiveRefine=function(e,t){return this.state=this.state.addDisjunctiveFacetRefinement(e,t),this._change(),this},r.prototype.addNumericRefinement=function(e,t,n){return this.state=this.state.addNumericRefinement(e,t,n),this._change(),this},r.prototype.addRefine=function(e,t){return this.state=this.state.addFacetRefinement(e,t),this._change(),this},r.prototype.addExclude=function(e,t){return this.state=this.state.addExcludeRefinement(e,t),this._change(),this},r.prototype.addTag=function(e){return this.state=this.state.addTagRefinement(e),this._change(),this},r.prototype.removeNumericRefinement=function(e,t,n){return this.state=this.state.removeNumericRefinement(e,t,n),this._change(),this},r.prototype.removeDisjunctiveRefine=function(e,t){return this.state=this.state.removeDisjunctiveFacetRefinement(e,t),this._change(),this},r.prototype.removeRefine=function(e,t){return this.state=this.state.removeFacetRefinement(e,t),this._change(),this},r.prototype.removeExclude=function(e,t){return this.state=this.state.removeExcludeRefinement(e,t),this._change(),this},r.prototype.removeTag=function(e){return this.state=this.state.removeTagRefinement(e),this._change(),this},r.prototype.toggleExclude=function(e,t){return this.state=this.state.toggleExcludeFacetRefinement(e,t),this._change(),this},r.prototype.toggleRefine=function(e,t){if(this.state.isHierarchicalFacet(e))this.state=this.state.toggleHierarchicalFacetRefinement(e,t);else if(this.state.isConjunctiveFacet(e))this.state=this.state.toggleFacetRefinement(e,t);else{if(!this.state.isDisjunctiveFacet(e))throw new Error("Cannot refine the undeclared facet "+e+"; it should be added to the helper options facets or disjunctiveFacets");this.state=this.state.toggleDisjunctiveFacetRefinement(e,t)}return this._change(),this},r.prototype.toggleTag=function(e){return this.state=this.state.toggleTagRefinement(e),this._change(),this},r.prototype.nextPage=function(){return this.setCurrentPage(this.state.page+1)},r.prototype.previousPage=function(){return this.setCurrentPage(this.state.page-1)},r.prototype.setCurrentPage=function(e){if(0>e)throw new Error("Page requested below 0.");return this.state=this.state.setPage(e),this._change(),this},r.prototype.setIndex=function(e){return this.index=e,this.setCurrentPage(0),this},r.prototype.setQueryParameter=function(e,t){var n=this.state.setQueryParameter(e,t);return this.state===n?this:(this.state=n,this._change(),this)},r.prototype.setState=function(e){return this.state=new i(e),this._change(),this},r.prototype.getState=function(){return this.state},r.prototype.overrideStateWithoutTriggeringChangeEvent=function(e){return this.state=new i(e),this},r.prototype.isRefined=function(e,t){if(this.state.isConjunctiveFacet(e))return this.state.isFacetRefined(e,t);if(this.state.isDisjunctiveFacet(e))return this.state.isDisjunctiveFacetRefined(e,t);throw new Error(e+" is not properly defined in this helper configuration(use the facets or disjunctiveFacets keys to configure it)")},r.prototype.hasRefinements=function(e){var t=!u(this.state.getNumericRefinements(e)),n=this.state.isConjunctiveFacet(e)||this.state.isDisjunctiveFacet(e);return!t&&n?this.state.isFacetRefined(e):t},r.prototype.isExcluded=function(e,t){return this.state.isExcludeRefined(e,t)},r.prototype.isDisjunctiveRefined=function(e,t){return this.state.isDisjunctiveFacetRefined(e,t)},r.prototype.isTagRefined=function(e){return this.state.isTagRefined(e)},r.prototype.getIndex=function(){return this.index},r.prototype.getCurrentPage=function(){return this.state.page},r.prototype.getTags=function(){return this.state.tagRefinements},r.prototype.getQueryParameter=function(e){return this.state.getQueryParameter(e)},r.prototype.getRefinements=function(e){var t=[];if(this.state.isConjunctiveFacet(e)){var n=this.state.getConjunctiveRefinements(e);c(n,function(e){t.push({value:e,type:"conjunctive"})});var r=this.state.getExcludeRefinements(e);c(r,function(e){t.push({value:e,type:"exclude"})})}else if(this.state.isDisjunctiveFacet(e)){var i=this.state.getDisjunctiveRefinements(e);c(i,function(e){t.push({value:e,type:"disjunctive"})})}var a=this.state.getNumericRefinements(e);return c(a,function(e,n){t.push({value:e,operator:n,type:"numeric"})}),t},r.prototype.getHierarchicalFacetBreadcrumb=function(e){return h(this.state.getHierarchicalRefinement(e)[0].split(this.state._getHierarchicalFacetSeparator(this.state.getHierarchicalFacetByName(e))),function(e){return p(e)})},r.prototype._search=function(){var e=this.state;this.client.search(this._getQueries(),l(this._handleResponse,this,e,this._queryId++))},r.prototype._getQueries=function(){var e=[];return e.push({indexName:this.index,query:this.state.query,params:this._getHitsSearchParams()}),c(this.state.getRefinedDisjunctiveFacets(),function(t){e.push({indexName:this.index,query:this.state.query,params:this._getDisjunctiveFacetSearchParams(t)})},this),c(this.state.getRefinedHierarchicalFacets(),function(t){var n=this.state.getHierarchicalFacetByName(t),r=this.state.getHierarchicalRefinement(t);r.length>0&&r[0].split(this.state._getHierarchicalFacetSeparator(n)).length>1&&e.push({indexName:this.index,query:this.state.query,params:this._getDisjunctiveFacetSearchParams(t,!0)})},this),e},r.prototype._handleResponse=function(e,t,n,r){if(!(t0&&(i.facetFilters=t),n.length>0&&(i.numericFilters=n),d(this.state.getQueryParams(),i)},r.prototype._getDisjunctiveFacetSearchParams=function(e,t){var n=this._getFacetFilters(e,t),r=this._getNumericFilters(e),i=this._getTagFilters(),a={hitsPerPage:1,page:0,attributesToRetrieve:[],attributesToHighlight:[],attributesToSnippet:[],tagFilters:i},s=this.state.getHierarchicalFacetByName(e);return s?a.facets=this._getDisjunctiveHierarchicalFacetAttribute(s,t):a.facets=e,(this.state.distinct===!0||this.state.distinct===!1)&&(a.distinct=this.state.distinct),r.length>0&&(a.numericFilters=r),n.length>0&&(a.facetFilters=n),d(this.state.getQueryParams(),a)},r.prototype.containsRefinement=function(e,t,n,r){return e||0!==t.length||0!==n.length||0!==r.length},r.prototype._getNumericFilters=function(e){var t=[];return c(this.state.numericRefinements,function(n,r){c(n,function(n,i){e!==r&&t.push(r+i+n)})}),t},r.prototype._getTagFilters=function(){return this.state.tagFilters?this.state.tagFilters:this.state.tagRefinements.join(",")},r.prototype._hasDisjunctiveRefinements=function(e){return this.state.disjunctiveRefinements[e]&&this.state.disjunctiveRefinements[e].length>0},r.prototype._getFacetFilters=function(e,t){var n=[];return c(this.state.facetsRefinements,function(e,t){c(e,function(e){n.push(t+":"+e)})}),c(this.state.facetsExcludes,function(e,t){c(e,function(e){n.push(t+":-"+e)})}),c(this.state.disjunctiveFacetsRefinements,function(t,r){if(r!==e&&t&&0!==t.length){var i=[];c(t,function(e){i.push(r+":"+e)}),n.push(i)}}),c(this.state.hierarchicalFacetsRefinements,function(r,i){var a=r[0];if(void 0!==a){var s,o=this.state.getHierarchicalFacetByName(i),c=this.state._getHierarchicalFacetSeparator(o);if(e===i){if(-1===a.indexOf(c)||t===!0)return;s=o.attributes[a.split(c).length-2],a=a.slice(0,a.lastIndexOf(c))}else s=o.attributes[a.split(c).length-1];n.push([s+":"+a])}},this),n},r.prototype._change=function(){this.emit("change",this.state,this.lastResults)},r.prototype._getHitsHierarchicalFacetsAttributes=function(){var e=[];return f(this.state.hierarchicalFacets,function(e,t){var n=this.state.getHierarchicalRefinement(t.name)[0];if(!n)return e.push(t.attributes[0]),e;var r=n.split(this.state._getHierarchicalFacetSeparator(t)).length,i=t.attributes.slice(0,r+1);return e.concat(i)},e,this)},r.prototype._getDisjunctiveHierarchicalFacetAttribute=function(e,t){if(t===!0)return[e.attributes[0]];var n=this.state.getHierarchicalRefinement(e.name)[0]||"",r=n.split(this.state._getHierarchicalFacetSeparator(e)).length-1;return e.attributes.slice(0,r+1)},t.exports=r},{"./SearchParameters":156,"./SearchResults":158,events:2,"lodash/collection/forEach":15,"lodash/collection/map":17,"lodash/collection/reduce":19,"lodash/function/bind":23,"lodash/lang/isEmpty":132,"lodash/object/merge":146,"lodash/string/trim":151,util:6}],160:[function(e,t,n){"use strict";var r=e("lodash/collection/forEach"),i=e("lodash/utility/identity"),a=e("lodash/lang/isObject"),s=function(e){return a(e)?(r(e,s),Object.isFrozen(e)||Object.freeze(e),e):e};t.exports=Object.freeze?s:i},{"lodash/collection/forEach":15,"lodash/lang/isObject":135,"lodash/utility/identity":152}],161:[function(e,t,n){t.exports="2.2.0"},{}]},{},[1])(1)});