Skip to content

Instantly share code, notes, and snippets.

@diervo
Created February 8, 2021 08:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diervo/6b97c272526a470253e3d78a2a5dd6c7 to your computer and use it in GitHub Desktop.
Save diervo/6b97c272526a470253e3d78a2a5dd6c7 to your computer and use it in GitHub Desktop.
coveo headless npm entry
function e(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];throw Error("[Immer] minified error nr: "+e+(r.length?" "+r.join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function t(e){return!!e&&!!e[L]}function r(e){return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);return!t||t===Object.prototype}(e)||Array.isArray(e)||!!e[$]||!!e.constructor[$]||c(e)||u(e))}function n(e,t,r){void 0===r&&(r=!1),0===i(e)?(r?Object.keys:N)(e).forEach((function(n){r&&"symbol"==typeof n||t(n,e[n],e)})):e.forEach((function(r,n){return t(n,r,e)}))}function i(e){var t=e[L];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:c(e)?2:u(e)?3:0}function a(e,t){return 2===i(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function o(e,t,r){var n=i(e);2===n?e.set(t,r):3===n?(e.delete(t),e.add(r)):e[t]=r}function s(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function c(e){return M&&e instanceof Map}function u(e){return V&&e instanceof Set}function l(e){return e.o||e.t}function d(e){if(Array.isArray(e))return e.slice();var t=U(e);delete t[L];for(var r=N(t),n=0;n<r.length;n++){var i=r[n],a=t[i];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[i]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[i]})}return Object.create(Object.getPrototypeOf(e),t)}function f(e,a){h(e)||t(e)||!r(e)||(i(e)>1&&(e.set=e.add=e.clear=e.delete=p),Object.freeze(e),a&&n(e,(function(e,t){return f(t,!0)}),!0))}function p(){e(2)}function h(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function g(t){var r=z[t];return r||e(19,t),r}function y(){return T}function m(e,t){t&&(g("Patches"),e.u=[],e.s=[],e.v=t)}function v(e){b(e),e.p.forEach(S),e.p=null}function b(e){e===T&&(T=e.l)}function w(e){return T={p:[],l:T,h:e,m:!0,_:0}}function S(e){var t=e[L];0===t.i||1===t.i?t.j():t.g=!0}function O(t,n){n._=n.p.length;var i=n.p[0],a=void 0!==t&&t!==i;return n.h.O||g("ES5").S(n,t,a),a?(i[L].P&&(v(n),e(4)),r(t)&&(t=C(n,t),n.l||I(n,t)),n.u&&g("Patches").M(i[L],t,n.u,n.s)):t=C(n,i,[]),v(n),n.u&&n.v(n.u,n.s),t!==_?t:void 0}function C(e,t,r){if(h(t))return t;var i=t[L];if(!i)return n(t,(function(n,a){return x(e,i,t,n,a,r)}),!0),t;if(i.A!==e)return t;if(!i.P)return I(e,i.t,!0),i.t;if(!i.I){i.I=!0,i.A._--;var a=4===i.i||5===i.i?i.o=d(i.k):i.o;n(a,(function(t,n){return x(e,i,a,t,n,r)})),I(e,a,!1),r&&e.u&&g("Patches").R(i,r,e.u,e.s)}return i.o}function x(e,n,i,s,c,u){if(t(c)){var l=C(e,c,u&&n&&3!==n.i&&!a(n.D,s)?u.concat(s):void 0);if(o(i,s,l),!t(l))return;e.m=!1}if(r(c)&&!h(c)){if(!e.h.N&&e._<1)return;C(e,c),n&&n.A.l||I(e,c)}}function I(e,t,r){void 0===r&&(r=!1),e.h.N&&e.m&&f(t,r)}function q(e,t){var r=e[L];return(r?l(r):e)[t]}function A(e){e.P||(e.P=!0,e.l&&A(e.l))}function E(e){e.o||(e.o=d(e.t))}function R(e,t,r){var n=c(t)?g("MapSet").T(t,r):u(t)?g("MapSet").F(t,r):e.O?function(e,t){var r=Array.isArray(e),n={i:r?1:0,A:t?t.A:y(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},i=n,a=H;r&&(i=[n],a=Q);var o=Proxy.revocable(i,a),s=o.revoke,c=o.proxy;return n.k=c,n.j=s,c}(t,r):g("ES5").J(t,r);return(r?r.A:y()).p.push(n),n}function j(a){return t(a)||e(22,a),function e(t){if(!r(t))return t;var a,s=t[L],c=i(t);if(s){if(!s.P&&(s.i<4||!g("ES5").K(s)))return s.t;s.I=!0,a=k(t,c),s.I=!1}else a=k(t,c);return n(a,(function(t,r){s&&function(e,t){return 2===i(e)?e.get(t):e[t]}(s.t,t)===r||o(a,t,e(r))})),3===c?new Set(a):a}(a)}function k(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return d(e)}var P,T,F="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),M="undefined"!=typeof Map,V="undefined"!=typeof Set,D="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,_=F?Symbol("immer-nothing"):((P={})["immer-nothing"]=!0,P),$=F?Symbol("immer-draftable"):"__$immer_draftable",L=F?Symbol("immer-state"):"__$immer_state",N="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,U=Object.getOwnPropertyDescriptors||function(e){var t={};return N(e).forEach((function(r){t[r]=Object.getOwnPropertyDescriptor(e,r)})),t},z={},H={get:function(e,t){if(t===L)return e;var n=l(e);if(!a(n,t))return function(e,t,r){if(r in t)for(var n=Object.getPrototypeOf(t);n;){var i,a=Object.getOwnPropertyDescriptor(n,r);if(a)return"value"in a?a.value:null===(i=a.get)||void 0===i?void 0:i.call(e.k);n=Object.getPrototypeOf(n)}}(e,n,t);var i=n[t];return e.I||!r(i)?i:i===q(e.t,t)?(E(e),e.o[t]=R(e.A.h,i,e)):i},has:function(e,t){return t in l(e)},ownKeys:function(e){return Reflect.ownKeys(l(e))},set:function(e,t,r){if(e.D[t]=!0,!e.P){if(s(r,q(l(e),t))&&void 0!==r)return!0;E(e),A(e)}return e.o[t]=r,!0},deleteProperty:function(e,t){return void 0!==q(e.t,t)||t in e.t?(e.D[t]=!1,E(e),A(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var r=l(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:n.enumerable,value:r[t]}:n},defineProperty:function(){e(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){e(12)}},Q={};n(H,(function(e,t){Q[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Q.deleteProperty=function(e,t){return H.deleteProperty.call(this,e[0],t)},Q.set=function(e,t,r){return H.set.call(this,e[0],t,r,e[0])};var Y=new(function(){function n(e){this.O=D,this.N=!1,"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),this.produce=this.produce.bind(this),this.produceWithPatches=this.produceWithPatches.bind(this)}var i=n.prototype;return i.produce=function(t,n,i){if("function"==typeof t&&"function"!=typeof n){var a=n;n=t;var o=this;return function(e){var t=this;void 0===e&&(e=a);for(var r=arguments.length,i=Array(r>1?r-1:0),s=1;s<r;s++)i[s-1]=arguments[s];return o.produce(e,(function(e){var r;return(r=n).call.apply(r,[t,e].concat(i))}))}}var s;if("function"!=typeof n&&e(6),void 0!==i&&"function"!=typeof i&&e(7),r(t)){var c=w(this),u=R(this,t,void 0),l=!0;try{s=n(u),l=!1}finally{l?v(c):b(c)}return"undefined"!=typeof Promise&&s instanceof Promise?s.then((function(e){return m(c,i),O(e,c)}),(function(e){throw v(c),e})):(m(c,i),O(s,c))}if(!t||"object"!=typeof t){if((s=n(t))===_)return;return void 0===s&&(s=t),this.N&&f(s,!0),s}e(21,t)},i.produceWithPatches=function(e,t){var r,n,i=this;return"function"==typeof e?function(t){for(var r=arguments.length,n=Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];return i.produceWithPatches(t,(function(t){return e.apply(void 0,[t].concat(n))}))}:[this.produce(e,t,(function(e,t){r=e,n=t})),r,n]},i.createDraft=function(n){r(n)||e(8),t(n)&&(n=j(n));var i=w(this),a=R(this,n,void 0);return a[L].C=!0,b(i),a},i.finishDraft=function(e,t){var r=(e&&e[L]).A;return m(r,t),O(void 0,r)},i.setAutoFreeze=function(e){this.N=e},i.setUseProxies=function(t){t&&!D&&e(20),this.O=t},i.applyPatches=function(e,r){var n;for(n=r.length-1;n>=0;n--){var i=r[n];if(0===i.path.length&&"replace"===i.op){e=i.value;break}}var a=g("Patches").$;return t(e)?a(e,r):this.produce(e,(function(e){return a(e,r.slice(n+1))}))},n}()),B=Y.produce;Y.produceWithPatches.bind(Y),Y.setAutoFreeze.bind(Y),Y.setUseProxies.bind(Y),Y.applyPatches.bind(Y),Y.createDraft.bind(Y),Y.finishDraft.bind(Y);var W=function(e){var t,r=e.Symbol;return"function"==typeof r?r.observable?t=r.observable:(t=r("observable"),r.observable=t):t="@@observable",t}("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof module?module:Function("return this")()),J=function(){return Math.random().toString(36).substring(7).split("").join(".")},K={INIT:"@@redux/INIT"+J(),REPLACE:"@@redux/REPLACE"+J(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+J()}};function Z(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function X(e,t,r){var n;if("function"==typeof t&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])throw new Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function.");if("function"==typeof t&&void 0===r&&(r=t,t=void 0),void 0!==r){if("function"!=typeof r)throw new Error("Expected the enhancer to be a function.");return r(X)(e,t)}if("function"!=typeof e)throw new Error("Expected the reducer to be a function.");var i=e,a=t,o=[],s=o,c=!1;function u(){s===o&&(s=o.slice())}function l(){if(c)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return a}function d(e){if("function"!=typeof e)throw new Error("Expected the listener to be a function.");if(c)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribelistener for more details.");var t=!0;return u(),s.push(e),function(){if(t){if(c)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribelistener for more details.");t=!1,u();var r=s.indexOf(e);s.splice(r,1),o=null}}}function f(e){if(!Z(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===e.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(c)throw new Error("Reducers may not dispatch actions.");try{c=!0,a=i(a,e)}finally{c=!1}for(var t=o=s,r=0;r<t.length;r++){(0,t[r])()}return e}function p(e){if("function"!=typeof e)throw new Error("Expected the nextReducer to be a function.");i=e,f({type:K.REPLACE})}function h(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new TypeError("Expected the observer to be an object.");function r(){e.next&&e.next(l())}return r(),{unsubscribe:t(r)}}})[W]=function(){return this},e}return f({type:K.INIT}),(n={dispatch:f,subscribe:d,getState:l,replaceReducer:p})[W]=h,n}function G(e,t){var r=t&&t.type;return"Given "+(r&&'action "'+String(r)+'"'||"an action")+', reducer "'+e+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}function ee(e){for(var t=Object.keys(e),r={},n=0;n<t.length;n++){var i=t[n];"function"==typeof e[i]&&(r[i]=e[i])}var a,o=Object.keys(r);try{!function(e){Object.keys(e).forEach((function(t){var r=e[t];if(void 0===r(void 0,{type:K.INIT}))throw new Error('Reducer "'+t+"\" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.");if(void 0===r(void 0,{type:K.PROBE_UNKNOWN_ACTION()}))throw new Error('Reducer "'+t+"\" returned undefined when probed with a random type. Don't try to handle "+K.INIT+' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.')}))}(r)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var n=!1,i={},s=0;s<o.length;s++){var c=o[s],u=r[c],l=e[c],d=u(l,t);if(void 0===d){var f=G(c,t);throw new Error(f)}i[c]=d,n=n||d!==l}return(n=n||o.length!==Object.keys(e).length)?i:e}}function te(e,t){return function(){return t(e.apply(this,arguments))}}function re(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ne(e,t){var r=Object.keys(e);return Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(e)),t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r}function ie(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ne(r,!0).forEach((function(t){re(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ne(r).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ae(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function oe(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){return function(){var r=e.apply(void 0,arguments),n=function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},i={getState:r.getState,dispatch:function(){return n.apply(void 0,arguments)}},a=t.map((function(e){return e(i)}));return ie({},r,{dispatch:n=ae.apply(void 0,a)(r.dispatch)})}}}var se=Object.freeze({__proto__:null,__DO_NOT_USE__ActionTypes:K,applyMiddleware:oe,bindActionCreators:function(e,t){if("function"==typeof e)return te(e,t);if("object"!=typeof e||null===e)throw new Error("bindActionCreators expected an object or a function, instead received "+(null===e?"null":typeof e)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');var r={};for(var n in e){var i=e[n];"function"==typeof i&&(r[n]=te(i,t))}return r},combineReducers:ee,compose:ae,createStore:X});function ce(e,t){return e===t}function ue(e,t,r){if(null===t||null===r||t.length!==r.length)return!1;for(var n=t.length,i=0;i<n;i++)if(!e(t[i],r[i]))return!1;return!0}function le(e){var t=Array.isArray(e[0])?e[0]:e;if(!t.every((function(e){return"function"==typeof e}))){var r=t.map((function(e){return typeof e})).join(", ");throw new Error("Selector creators expect all input-selectors to be functions, instead received the following types: ["+r+"]")}return t}var de=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return function(){for(var t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];var a=0,o=n.pop(),s=le(n),c=e.apply(void 0,[function(){return a++,o.apply(null,arguments)}].concat(r)),u=e((function(){for(var e=[],t=s.length,r=0;r<t;r++)e.push(s[r].apply(null,arguments));return c.apply(null,e)}));return u.resultFunc=o,u.dependencies=s,u.recomputations=function(){return a},u.resetRecomputations=function(){return a=0},u}}((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ce,r=null,n=null;return function(){return ue(t,r,arguments)||(n=e.apply(null,arguments)),r=arguments,n}}));function fe(e){return function(t){var r=t.dispatch,n=t.getState;return function(t){return function(i){return"function"==typeof i?i(r,n,e):t(i)}}}}var pe=fe();function he(){return(he=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function ge(e){return(ge=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ye(e,t){return(ye=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function me(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function ve(e,t,r){return(ve=me()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&ye(i,r.prototype),i}).apply(null,arguments)}function be(e){var t="function"==typeof Map?new Map:void 0;return(be=function(e){if(null===e||!function(e){return-1!==Function.toString.call(e).indexOf("[native code]")}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return ve(e,arguments,ge(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),ye(r,e)})(e)}pe.withExtraArgument=fe;var we="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?ae:ae.apply(null,arguments)};var Se=function(e){var t,r;function n(){return e.apply(this,arguments)||this}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var i=n.prototype;return i.concat=function(){for(var t,r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return ve(n,(t=e.prototype.concat).call.apply(t,[this].concat(i)))},i.prepend=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return 1===t.length&&Array.isArray(t[0])?ve(n,t[0].concat(this)):ve(n,t.concat(this))},n}(be(Array));function Oe(e){void 0===e&&(e={});var t=e,r=t.thunk,n=void 0===r||r,i=(t.immutableCheck,t.serializableCheck,new Se);return n&&(!function(e){return"boolean"==typeof e}(n)?i.push(pe.withExtraArgument(n.extraArgument)):i.push(pe)),i}function Ce(e){var t,r=function(e){return Oe(e)},n=e||{},i=n.reducer,a=void 0===i?void 0:i,o=n.middleware,s=void 0===o?r():o,c=n.devTools,u=void 0===c||c,l=n.preloadedState,d=void 0===l?void 0:l,f=n.enhancers,p=void 0===f?void 0:f;if("function"==typeof a)t=a;else{if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(a))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=ee(a)}var h=oe.apply(void 0,"function"==typeof s?s(r):s),g=ae;u&&(g=we(he({trace:!1},"object"==typeof u&&u)));var y=[h];return Array.isArray(p)?y=[h].concat(p):"function"==typeof p&&(y=p(y)),X(t,d,g.apply(void 0,y))}function xe(e,t){function r(){if(t){var r=t.apply(void 0,arguments);if(!r)throw new Error("prepareAction did not return an object");return he({type:e,payload:r.payload},"meta"in r&&{meta:r.meta},{},"error"in r&&{error:r.error})}return{type:e,payload:arguments.length<=0?void 0:arguments[0]}}return r.toString=function(){return""+e},r.type=e,r.match=function(t){return t.type===e},r}function Ie(e,n,i,a){void 0===i&&(i=[]);var o="function"==typeof n?function(e){var t,r={},n=[],i={addCase:function(e,t){var n="string"==typeof e?e:e.type;if(n in r)throw new Error("addCase cannot be called with two reducers for the same action type");return r[n]=t,i},addMatcher:function(e,t){return n.push({matcher:e,reducer:t}),i},addDefaultCase:function(e){return t=e,i}};return e(i),[r,n,t]}(n):[n,i,a],s=o[0],c=o[1],u=o[2];return function(n,i){void 0===n&&(n=e);var a=[s[i.type]].concat(c.filter((function(e){return(0,e.matcher)(i)})).map((function(e){return e.reducer})));return 0===a.filter((function(e){return!!e})).length&&(a=[u]),a.reduce((function(e,n){if(n){if(t(e)){var a=n(e,i);return void 0===a?e:a}if(r(e))return B(e,(function(e){return n(e,i)}));var o=n(e,i);if(void 0===o)throw Error("A case reducer on a non-draftable value must not return undefined");return o}return e}),n)}}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var qe=["name","message","stack","code"],Ae=function(e){this.value=e},Ee=function(e){if("object"==typeof e&&null!==e){var t={},r=qe,n=Array.isArray(r),i=0;for(r=n?r:r[Symbol.iterator]();;){var a;if(n){if(i>=r.length)break;a=r[i++]}else{if((i=r.next()).done)break;a=i.value}var o=a;"string"==typeof e[o]&&(t[o]=e[o])}return t}return{message:String(e)}};function Re(e,t,r){var n=xe(e+"/fulfilled",(function(e,t,r){return{payload:e,meta:{arg:r,requestId:t}}})),i=xe(e+"/pending",(function(e,t){return{payload:void 0,meta:{arg:t,requestId:e}}})),a=xe(e+"/rejected",(function(e,t,r,n){var i=!!e&&"AbortError"===e.name,a=!!e&&"ConditionError"===e.name;return{payload:n,error:Ee(e||"Rejected"),meta:{arg:r,requestId:t,aborted:i,condition:a}}})),o="undefined"!=typeof AbortController?AbortController:function(){function e(){this.signal={aborted:!1,addEventListener:function(){},dispatchEvent:function(){return!1},onabort:function(){},removeEventListener:function(){}}}return e.prototype.abort=function(){},e}();return Object.assign((function(e){return function(s,c,u){var l,d=function(e){void 0===e&&(e=21);for(var t="",r=e;r--;)t+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return t}(),f=new o,p=new Promise((function(e,t){return f.signal.addEventListener("abort",(function(){return t({name:"AbortError",message:l||"Aborted"})}))})),h=!1;var g=function(){try{var o,l=function(e){return g?e:(r&&!r.dispatchConditionRejection&&a.match(o)&&o.meta.condition||s(o),o)},g=!1,y=function(e,t){try{var r=e()}catch(e){return t(e)}return r&&r.then?r.then(void 0,t):r}((function(){if(r&&r.condition&&!1===r.condition(e,{getState:c,extra:u}))throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};return h=!0,s(i(d,e)),Promise.resolve(Promise.race([p,Promise.resolve(t(e,{dispatch:s,getState:c,extra:u,requestId:d,signal:f.signal,rejectWithValue:function(e){return new Ae(e)}})).then((function(t){return t instanceof Ae?a(null,d,e,t.value):n(t,d,e)}))])).then((function(e){o=e}))}),(function(t){o=a(t,d,e)}));return Promise.resolve(y&&y.then?y.then(l):l(y))}catch(e){return Promise.reject(e)}}();return Object.assign(g,{abort:function(e){h&&(l=e,f.abort())}})}}),{pending:i,rejected:a,fulfilled:n,typePrefix:e})}!function(){function e(e,t){var r=c[e];return r?r.enumerable=t:c[e]=r={configurable:!0,enumerable:t,get:function(){var t=this[L];return H.get(t,e)},set:function(t){var r=this[L];H.set(r,e,t)}},r}function r(e){for(var t=e.length-1;t>=0;t--){var r=e[t][L];if(!r.P)switch(r.i){case 5:o(r)&&A(r);break;case 4:i(r)&&A(r)}}}function i(e){for(var t=e.t,r=e.k,n=N(r),i=n.length-1;i>=0;i--){var o=n[i];if(o!==L){var c=t[o];if(void 0===c&&!a(t,o))return!0;var u=r[o],l=u&&u[L];if(l?l.t!==c:!s(u,c))return!0}}var d=!!t[L];return n.length!==N(t).length+(d?0:1)}function o(e){var t=e.k;if(t.length!==e.t.length)return!0;var r=Object.getOwnPropertyDescriptor(t,t.length-1);return!(!r||r.get)}var c={};!function(e,t){z[e]=t}("ES5",{J:function(t,r){var n=Array.isArray(t),i=function(t,r){var n=U(r);t&&delete n.length,delete n[L];for(var i=N(n),a=0;a<i.length;a++){var o=i[a];n[o]=e(o,t||!!n[o].enumerable)}if(t){var s=Array(r.length);return Object.defineProperties(s,n),s}return Object.create(Object.getPrototypeOf(r),n)}(n,t),a={i:n?5:4,A:r?r.A:y(),P:!1,I:!1,D:{},l:r,t:t,k:i,o:null,g:!1,C:!1};return Object.defineProperty(i,L,{value:a,writable:!0}),i},S:function(e,i,s){s?t(i)&&i[L].A===e&&r(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var r=t[L];if(r){var i=r.t,s=r.k,c=r.D,u=r.i;if(4===u)n(s,(function(t){t!==L&&(void 0!==i[t]||a(i,t)?c[t]||e(s[t]):(c[t]=!0,A(r)))})),n(i,(function(e){void 0!==s[e]||a(s,e)||(c[e]=!1,A(r))}));else if(5===u){if(o(r)&&(A(r),c.length=!0),s.length<i.length)for(var l=s.length;l<i.length;l++)c[l]=!1;else for(var d=i.length;d<s.length;d++)c[d]=!0;for(var f=Math.min(s.length,i.length),p=0;p<f;p++)void 0===c[p]&&e(s[p])}}}}(e.p[0]),r(e.p))},K:function(e){return 4===e.i?i(e):o(e)}})}();class je extends Error{constructor(e){super(e),this.name="SchemaValidationError"}}class ke{constructor(e){this.definition=e}validate(e={},t=""){const r={...this.default,...e},n=[];for(const e in this.definition){const t=this.definition[e].validate(r[e]);t&&n.push(`${e}: ${t}`)}if(n.length)throw function(e,t){const r=`\n The following properties are invalid:\n\n ${e.join("\n\t")}\n \n ${t}\n `;return new je(r)}(n,t);return r}get default(){const e={};for(const t in this.definition){const r=this.definition[t].default;void 0!==r&&(e[t]=r)}return e}}class Pe{constructor(e={}){this.baseConfig=e}validate(e){return this.baseConfig.required&&Fe(e)?"value is required.":null}get default(){return this.baseConfig.default instanceof Function?this.baseConfig.default():this.baseConfig.default}get required(){return!0===this.baseConfig.required}}function Te(e){return void 0===e}function Fe(e){return Te(e)||function(e){return null===e}(e)}class Me{constructor(e={}){this.config=e,this.value=new Pe(e)}validate(e){return this.value.validate(e)||(function(e){return Te(e)||Ve(e)}(e)?e<this.config.min?`minimum value of ${this.config.min} not respected.`:e>this.config.max?`maximum value of ${this.config.max} not respected.`:null:"value is not a number.")}get default(){return this.value.default}get required(){return this.value.required}}function Ve(e){return"number"==typeof e}class De{constructor(e={}){this.value=new Pe(e)}validate(e){return this.value.validate(e)||(function(e){return Te(e)||_e(e)}(e)?null:"value is not a boolean.")}get default(){return this.value.default}get required(){return this.value.required}}function _e(e){return"boolean"==typeof e}const $e=/^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[/?#]\S*)?$/i;class Le{constructor(e={}){this.config={emptyAllowed:!0,url:!1,...e},this.value=new Pe(this.config)}validate(e){const{emptyAllowed:t,url:r,regex:n,constrainTo:i}=this.config,a=this.value.validate(e);return a||(Te(e)?null:Ne(e)?t||e.length?r&&!$e.test(e)?"value is not a valid URL.":n&&!n.test(e)?"value did not match provided regex "+n:i&&!i.includes(e)?`value should be one of: ${i.join(", ")}.`:null:"value is an empty string.":"value is not a string.")}get default(){return this.value.default}get required(){return this.value.required}}function Ne(e){return"[object String]"===Object.prototype.toString.call(e)}class Ue{constructor(e={}){this.config={options:{required:!1},values:{},...e}}validate(e){if(Te(e))return this.config.options.required?"value is required and is currently undefined":null;if(!ze(e))return"value is not an object";for(const[t,r]of Object.entries(this.config.values))if(r.required&&Fe(e[t]))return"value does not contain "+t;let t="";for(const[r,n]of Object.entries(this.config.values)){const i=e[r],a=n.validate(i);null!==a&&(t+=" "+a)}return""===t?null:t}get default(){}get required(){return!!this.config.options.required}}function ze(e){return void 0!==e&&"object"==typeof e}class He{constructor(e={}){this.config=e,this.value=new Pe(this.config)}validate(e){if(!Fe(e)&&!Array.isArray(e))return"value is not an array";const t=this.value.validate(e);if(null!==t)return t;if(Fe(e))return null;if(void 0!==this.config.max&&e.length>this.config.max)return"value contains more than "+this.config.max;if(void 0!==this.config.min&&e.length<this.config.min)return"value contains less than "+this.config.min;if(void 0!==this.config.each){let t="";return e.forEach((r=>{this.config.each.required&&Fe(r)&&(t="value is null or undefined: "+e.join(","));const n=this.validatePrimitiveValue(r,this.config.each);null!==n&&(t+=" "+n)})),""===t?null:t}return null}validatePrimitiveValue(e,t){return _e(e)||Ne(e)||Ve(e)||ze(e)?t.validate(e):"value is not a primitive value"}get default(){}get required(){return this.value.required}}function Qe(e){return Array.isArray(e)}class Ye{constructor(e){this.config=e,this.value=new Pe(e)}validate(e){const t=this.value.validate(e);return null!==t?t:Te(e)||Object.values(this.config.enum).find((t=>t===e))?null:"value is not in enum."}get default(){return this.value.default}get required(){return this.value.required}}const Be=new Le({required:!0,emptyAllowed:!1}),We=new Le({required:!0,emptyAllowed:!0}),Je=({message:e,name:t,stack:r})=>({message:e,name:t,stack:r}),Ke=(e,t)=>"required"in t?{payload:new ke({value:t}).validate({value:e}).value}:{payload:new ke(t).validate(e)},Ze=(e,t)=>{try{return Ke(e,t)}catch(t){return{payload:e,error:Je(t)}}},Xe=(e,t,r,n)=>et(e,t,r,"Check the initialState of "+n,"Controller initialization error"),Ge=(e,t,r,n)=>et(e,t,r,"Check the options of "+n,"Controller initialization error"),et=(e,t,r,n,i)=>{try{return t.validate(r,n)}catch(t){throw e.logger.error(t,i),t}},tt=()=>new Le({emptyAllowed:!1,required:!1}),rt=()=>new Le({emptyAllowed:!1,required:!0}),nt=xe("configuration/updateBasicConfiguration",(e=>Ze(e,{accessToken:new Le({emptyAllowed:!1}),organizationId:new Le({emptyAllowed:!1}),platformUrl:new Le({url:!0,emptyAllowed:!1})}))),it=xe("configuration/updateSearchConfiguration",(e=>Ze(e,{apiBaseUrl:new Le({url:!0,emptyAllowed:!1}),pipeline:new Le({emptyAllowed:!1}),searchHub:new Le({emptyAllowed:!1})}))),at=xe("configuration/updateAnalyticsConfiguration",(e=>Ze(e,{enabled:new De({default:!0}),originLevel2:tt(),originLevel3:tt(),apiBaseUrl:new Le({url:!0,emptyAllowed:!1}),runtimeEnvironment:new Pe}))),ot=Re("configuration/renewAccessToken",(async e=>await e())),st=xe("configuration/analytics/disable"),ct=xe("configuration/analytics/enable"),ut=xe("configuration/analytics/originlevel2",(e=>Ze(e,{originLevel2:rt()}))),lt=xe("configuration/analytics/originlevel3",(e=>Ze(e,{originLevel3:rt()})));var dt=fetch,ft="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function pt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ht(e,t,r){return e(r={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&r.path)}},r.exports),r.exports}var gt=ht((function(e,t){var r=ft&&ft.__assign||function(){return(r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var n={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};t.getSanitizedOptions=function(e){var t=r(r({},n),e);return t.numOfAttempts<1&&(t.numOfAttempts=1),t}}));pt(gt);gt.getSanitizedOptions;var yt=ht((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.fullJitter=function(e){var t=Math.random()*e;return Math.round(t)}}));pt(yt);yt.fullJitter;var mt=ht((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.noJitter=function(e){return e}}));pt(mt);mt.noJitter;var vt=ht((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.JitterFactory=function(e){switch(e.jitter){case"full":return yt.fullJitter;case"none":default:return mt.noJitter}}}));pt(vt);vt.JitterFactory;var bt=ht((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this.options=e,this.attempt=0}return e.prototype.apply=function(){var e=this;return new Promise((function(t){return setTimeout(t,e.jitteredDelay)}))},e.prototype.setAttemptNumber=function(e){this.attempt=e},Object.defineProperty(e.prototype,"jitteredDelay",{get:function(){return vt.JitterFactory(this.options)(this.delay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"delay",{get:function(){var e=this.options.startingDelay,t=this.options.timeMultiple,r=this.numOfDelayedAttempts,n=e*Math.pow(t,r);return Math.min(n,this.options.maxDelay)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt},enumerable:!0,configurable:!0}),e}();t.Delay=r}));pt(bt);bt.Delay;var wt=ht((function(e,t){var r,n=ft&&ft.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=ft&&ft.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))},a=ft&&ft.__generator||function(e,t){var r,n,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.apply=function(){return i(this,void 0,void 0,(function(){return a(this,(function(t){return[2,!!this.isFirstAttempt||e.prototype.apply.call(this)]}))}))},Object.defineProperty(t.prototype,"isFirstAttempt",{get:function(){return 0===this.attempt},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt-1},enumerable:!0,configurable:!0}),t}(bt.Delay);t.SkipFirstDelay=o}));pt(wt);wt.SkipFirstDelay;var St=ht((function(e,t){var r,n=ft&&ft.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t}(bt.Delay);t.AlwaysDelay=i}));pt(St);St.AlwaysDelay;var Ot=ht((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.DelayFactory=function(e,t){var r=function(e){if(!e.delayFirstAttempt)return new wt.SkipFirstDelay(e);return new St.AlwaysDelay(e)}(e);return r.setAttemptNumber(t),r}}));pt(Ot);Ot.DelayFactory;var Ct=ht((function(e,t){var r=ft&&ft.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))},n=ft&&ft.__generator||function(e,t){var r,n,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.backOff=function(e,t){return void 0===t&&(t={}),r(this,void 0,void 0,(function(){var r;return n(this,(function(n){switch(n.label){case 0:return r=gt.getSanitizedOptions(t),[4,new i(e,r).execute()];case 1:return[2,n.sent()]}}))}))};var i=function(){function e(e,t){this.request=e,this.options=t,this.attemptNumber=0}return e.prototype.execute=function(){return r(this,void 0,void 0,(function(){var e;return n(this,(function(t){switch(t.label){case 0:if(this.attemptLimitReached)return[3,7];t.label=1;case 1:return t.trys.push([1,4,,6]),[4,this.applyDelay()];case 2:return t.sent(),[4,this.request()];case 3:return[2,t.sent()];case 4:return e=t.sent(),this.attemptNumber++,[4,this.options.retry(e,this.attemptNumber)];case 5:if(!t.sent()||this.attemptLimitReached)throw e;return[3,6];case 6:return[3,0];case 7:throw new Error("Something went wrong.")}}))}))},Object.defineProperty(e.prototype,"attemptLimitReached",{get:function(){return this.attemptNumber>=this.options.numOfAttempts},enumerable:!0,configurable:!0}),e.prototype.applyDelay=function(){return r(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,Ot.DelayFactory(this.options,this.attemptNumber).apply()];case 1:return e.sent(),[2]}}))}))},e}()}));pt(Ct);var xt=Ct.backOff;function It(e){return 429===e}const qt=e=>e;class At{static async call(e){const t={...e,...await e.preprocessRequest(e)},r={url:t.url,method:t.method,headers:{"Content-Type":t.contentType,Authorization:"Bearer "+t.accessToken,...t.headers},body:t.requestParams};t.logger.info(r,"Platform request");const n=async()=>{const r=await dt(t.url,{method:t.method,headers:{"Content-Type":t.contentType,Authorization:"Bearer "+t.accessToken,...t.headers},body:JSON.stringify(t.requestParams),signal:e.signal});if(It(r.status))throw r;return r};try{const i=await xt(n,{retry:t=>{const r=t&&It(t.status);return r&&e.logger.info("Platform retrying request"),r}});if(419===i.status){t.logger.info("Platform renewing token");const e=await t.renewAccessToken();if(""!==e)return At.call({...t,accessToken:e})}const a=await i.json();return e.logger.info({response:i,body:a,requestInfo:r},"Platform response"),{response:i,body:a}}catch(e){if(e.body)return{response:e,body:await e.json()};throw e}}}function Et(e){return`https://platform${e&&e.environment&&"prod"!==e.environment?e.environment:""}${e&&e.region&&"us-east-1"!==e.region?"-"+e.region:""}.cloud.coveo.com`}const Rt=()=>({organizationId:"",accessToken:"",platformUrl:Et(),search:{apiBaseUrl:Et()+"/rest/search/v2"},analytics:{enabled:!0,apiBaseUrl:Et()+"/rest/ua",originLevel2:"default",originLevel3:"default"}}),jt=Ie(Rt(),(e=>e.addCase(nt,((e,t)=>{t.payload.accessToken&&(e.accessToken=t.payload.accessToken),t.payload.organizationId&&(e.organizationId=t.payload.organizationId),t.payload.platformUrl&&(e.platformUrl=t.payload.platformUrl,e.search.apiBaseUrl=t.payload.platformUrl+"/rest/search/v2",e.analytics.apiBaseUrl=t.payload.platformUrl+"/rest/ua")})).addCase(it,((e,t)=>{t.payload.apiBaseUrl&&(e.search.apiBaseUrl=t.payload.apiBaseUrl)})).addCase(at,((e,t)=>{void 0!==t.payload.enabled&&(e.analytics.enabled=t.payload.enabled),void 0!==t.payload.originLevel2&&(e.analytics.originLevel2=t.payload.originLevel2),void 0!==t.payload.originLevel3&&(e.analytics.originLevel3=t.payload.originLevel3),void 0!==t.payload.apiBaseUrl&&(e.analytics.apiBaseUrl=t.payload.apiBaseUrl),void 0!==t.payload.runtimeEnvironment&&(e.analytics.runtimeEnvironment=t.payload.runtimeEnvironment)})).addCase(ot.fulfilled,((e,t)=>{e.accessToken=t.payload})).addCase(st,(e=>{e.analytics.enabled=!1})).addCase(ct,(e=>{e.analytics.enabled=!0})).addCase(ut,((e,t)=>{e.analytics.originLevel2=t.payload.originLevel2})).addCase(lt,((e,t)=>{e.analytics.originLevel3=t.payload.originLevel3})))),kt=new He({each:Be,required:!0}),Pt=(e,t)=>(Ze(e,Be),Ne(t)?Ze(t,Be):Ze(t,kt),{payload:{contextKey:e,contextValue:t}}),Tt=xe("context/set",(e=>{for(const[t,r]of Object.entries(e))Pt(t,r);return{payload:e}})),Ft=xe("context/add",(e=>Pt(e.contextKey,e.contextValue))),Mt=xe("context/remove",(e=>Ze(e,Be))),Vt="@@undoable/UNDO",Dt="@@undoable/REDO",_t=e=>({past:[],present:e,future:[]}),$t={undo:xe(Vt),redo:xe(Dt)},Lt=xe("history/snapshot"),Nt=Re("history/back",(async(e,{dispatch:t})=>{await t($t.undo()),await t(zt())})),Ut=Re("history/forward",(async(e,{dispatch:t})=>{await t($t.redo()),await t(zt())})),zt=Re("history/change",(async(e,{getState:t})=>t().history.present));const Ht=Ie({contextValues:{}},(e=>{e.addCase(Tt,((e,t)=>{e.contextValues=t.payload})).addCase(Ft,((e,t)=>{e.contextValues[t.payload.contextKey]=t.payload.contextValue})).addCase(Mt,((e,t)=>{delete e.contextValues[t.payload]})).addCase(zt.fulfilled,((e,t)=>{e.contextValues=t.payload.context.contextValues}))})),Qt="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0;if(!Qt)throw new Error("Unable to find global scope. Are you sure this is running in the browser?");if(!Qt.AbortController)throw new Error('Could not find "AbortController" in the global scope. You need to polyfill it first');var Yt=Qt.AbortController,Bt=Qt.AbortController;Yt.default=Bt;const Wt=(e,t,r,n)=>({accessToken:e.accessToken,method:t,contentType:r,url:`${e.url}${n}?${Jt(e)}`}),Jt=e=>"organizationId="+e.organizationId;class Kt{constructor(e){this.options=e,this.searchAbortController=null}async plan(e){const t=await At.call({...Wt(e,"POST","application/json","/plan"),requestParams:rr(e),...this.options});return function(e){return void 0!==e.body.preprocessingOutput}(t)?{success:t.body}:{error:Zt(t)}}async querySuggest(e){const t=await At.call({...Wt(e,"POST","application/json","/querySuggest"),requestParams:rr(e),...this.options});if(function(e){return void 0!==e.body.completions}(t)){return{success:(await this.options.postprocessQuerySuggestResponseMiddleware(t)).body}}return{error:Zt(t)}}async search(e){this.searchAbortController&&(this.options.logger.warn("Cancelling current pending search query"),this.searchAbortController.abort()),this.searchAbortController=new Yt;const t=await At.call({...Wt(e,"POST","application/json",""),requestParams:rr(e),...this.options,signal:this.searchAbortController.signal});if(this.searchAbortController=null,tr(t)){return{success:(await this.options.postprocessSearchResponseMiddleware(t)).body}}return{error:Zt(t)}}async facetSearch(e){const t=await At.call({...Wt(e,"POST","application/json","/facet"),requestParams:rr(e),...this.options});return(await this.options.postprocessFacetSearchResponseMiddleware(t)).body}async recommendations(e){const t=await At.call({...Wt(e,"POST","application/json",""),requestParams:rr(e),...this.options});return tr(t)?{success:t.body}:{error:Zt(t)}}async productRecommendations(e){const t=await At.call({...Wt(e,"POST","application/json",""),requestParams:rr(e),...this.options});return tr(t)?{success:t.body}:{error:Zt(t)}}}const Zt=e=>function(e){return void 0!==e.body.exception}(e)?Xt(e):function(e){return void 0!==e.body.statusCode}(e)?Gt(e):{message:"unknown",statusCode:0,type:"unknown"},Xt=e=>({message:e.body.exception.code,statusCode:e.response.status,type:e.body.exception.code}),Gt=e=>({message:e.body.message,statusCode:e.body.statusCode,type:e.body.type}),er=e=>void 0!==e.error;function tr(e){return void 0!==e.body.results}function rr(e){const{url:t,accessToken:r,organizationId:n,...i}=e;return i}
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */function nr(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}function ir(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}c((n=n.apply(e,t||[])).next())}))}var ar;!function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"}(ar||(ar={}));class or{constructor(e){this.opts=e}sendEvent(e,t){return ir(this,void 0,void 0,(function*(){const{baseUrl:r,visitorIdProvider:n}=this.opts,i=this.shouldAppendVisitorId(e)?yield this.getVisitorIdParam():"",a=yield fetch(`${r}/analytics/${e}${i}`,{method:"POST",headers:this.getHeaders(),mode:"cors",body:JSON.stringify(t),credentials:"include"});if(a.ok){const e=yield a.json();return e.visitorId&&n.setCurrentVisitorId(e.visitorId),e}try{a.json()}catch(e){}throw console.error(`An error has occured when sending the "${e}" event.`,a,t),new Error(`An error has occurred when sending the "${e}" event. Check the console logs for more details.`)}))}shouldAppendVisitorId(e){return-1!==[ar.click,ar.custom,ar.search,ar.view].indexOf(e)}getVisitorIdParam(){return ir(this,void 0,void 0,(function*(){const{visitorIdProvider:e}=this.opts,t=yield e.getCurrentVisitorId();return t?"?visitor="+t:""}))}getHeaders(){const{token:e}=this.opts;return Object.assign(Object.assign({},e?{Authorization:"Bearer "+e}:{}),{"Content-Type":"application/json"})}}function sr(){return"undefined"!=typeof localStorage}function cr(){return"undefined"!=typeof navigator&&navigator.cookieEnabled}function ur(){return"undefined"!=typeof crypto&&void 0!==crypto.getRandomValues}const lr=[ar.click,ar.custom,ar.search,ar.view],dr=(e,t)=>-1!==lr.indexOf(e)?Object.assign({language:document.documentElement.lang,userAgent:navigator.userAgent},t):t;class fr{static set(e,t,r){var n,i,a,o,s;r?((a=new Date).setTime(a.getTime()+r),o="; expires="+a.toGMTString()):o="",-1===(s=location.hostname).indexOf(".")?document.cookie=e+"="+t+o+"; path=/":((i=s.split(".")).shift(),n="."+i.join("."),document.cookie=e+"="+t+o+"; path=/; domain="+n,null!=fr.get(e)&&fr.get(e)==t||(n="."+s,document.cookie=e+"="+t+o+"; path=/; domain="+n))}static get(e){for(var t=e+"=",r=document.cookie.split(";"),n=0;n<r.length;n++){var i=r[n];if(0==(i=i.replace(/^\s+/,"")).indexOf(t))return i.substring(t.length,i.length)}return null}static erase(e){fr.set(e,"",-1)}}function pr(){return sr()?localStorage:cr()?new hr:"undefined"!=typeof sessionStorage?sessionStorage:new yr}class hr{getItem(e){return fr.get(`${hr.prefix}${e}`)}removeItem(e){fr.erase(`${hr.prefix}${e}`)}setItem(e,t){fr.set(`${hr.prefix}${e}`,t)}}hr.prefix="coveo_";class gr{constructor(){this.cookieStorage=new hr}getItem(e){return localStorage.getItem(e)||this.cookieStorage.getItem(e)}removeItem(e){this.cookieStorage.removeItem(e),localStorage.removeItem(e)}setItem(e,t){localStorage.setItem(e,t),this.cookieStorage.setItem(e,t)}}class yr{getItem(e){return null}removeItem(e){}setItem(e,t){}}const mr="__coveo.analytics.history";class vr{constructor(e){this.store=e||pr()}addElement(e){e.internalTime=(new Date).getTime(),this.cropQueryElement(e);let t=this.getHistoryWithInternalTime();null!=t?this.isValidEntry(e)&&this.setHistory([e].concat(t)):this.setHistory([e])}addElementAsync(e){return ir(this,void 0,void 0,(function*(){e.internalTime=(new Date).getTime(),this.cropQueryElement(e);let t=yield this.getHistoryWithInternalTimeAsync();null!=t?this.isValidEntry(e)&&this.setHistory([e].concat(t)):this.setHistory([e])}))}getHistory(){const e=this.getHistoryWithInternalTime();return this.stripInternalTime(e)}getHistoryAsync(){return ir(this,void 0,void 0,(function*(){const e=yield this.getHistoryWithInternalTimeAsync();return this.stripInternalTime(e)}))}getHistoryWithInternalTime(){try{const e=this.store.getItem(mr);return e&&"string"==typeof e?JSON.parse(e):[]}catch(e){return[]}}getHistoryWithInternalTimeAsync(){return ir(this,void 0,void 0,(function*(){try{const e=yield this.store.getItem(mr);return e?JSON.parse(e):[]}catch(e){return[]}}))}setHistory(e){try{this.store.setItem(mr,JSON.stringify(e.slice(0,20)))}catch(e){}}clear(){try{this.store.removeItem(mr)}catch(e){}}getMostRecentElement(){let e=this.getHistoryWithInternalTime();if(null!=e){return e.sort(((e,t)=>(t.internalTime||0)-(e.internalTime||0)))[0]}return null}cropQueryElement(e){e.name&&"query"==e.name.toLowerCase()&&null!=e.value&&(e.value=e.value.slice(0,75))}isValidEntry(e){let t=this.getMostRecentElement();return!t||t.value!=e.value||(e.internalTime||0)-(t.internalTime||0)>6e4}stripInternalTime(e){return e.map((e=>{const{name:t,time:r,value:n}=e;return{name:t,time:r,value:n}}))}}var br=Object.freeze({__proto__:null,STORE_KEY:mr,MAX_NUMBER_OF_HISTORY_ELEMENTS:20,MIN_THRESHOLD_FOR_DUPLICATE_VALUE:6e4,MAX_VALUE_SIZE:75,HistoryStore:vr,default:vr});const wr=(e,t)=>ir(void 0,void 0,void 0,(function*(){return e===ar.view?(yield Sr(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t})),Sr=e=>ir(void 0,void 0,void 0,(function*(){const t=new vr,r={name:"PageView",value:e,time:JSON.stringify(new Date)};yield t.addElementAsync(r)})),Or=e=>e?(Number(e)^Cr(new Uint8Array(1))[0]%16>>Number(e)/4).toString(16):"10000000-1000-4000-8000-100000000000".replace(/[018]/g,Or),Cr=e=>{if(ur())return crypto.getRandomValues(e);for(var t=0,r=0;t<e.length;t++)0==(3&t)&&(r=4294967296*Math.random()),e[t]=r>>>((3&t)<<3)&255;return e},xr=Object.keys,Ir={id:"svc_ticket_id",subject:"svc_ticket_subject",description:"svc_ticket_description",category:"svc_ticket_category",productId:"svc_ticket_product_id",custom:"svc_ticket_custom"},qr=[...xr(Ir).map((e=>Ir[e]))].join("|"),Ar=new RegExp(`^(${qr}$)`),Er=e=>Ar.test(e),Rr={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps"},jr={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr"},kr=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},{eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"}),{action:"pa",list:"pal",listSource:"pls"}),{id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"}),{hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"}),{anonymizeIp:"aip"}),{svcAction:"svc_action",svcActionData:"svc_action_data"}),Pr=xr(kr).map((e=>kr[e])),Tr=xr(Rr).map((e=>Rr[e])),Fr=xr(jr).map((e=>jr[e])),Mr=[...Tr,"custom"].join("|"),Vr=[...Fr,"custom"].join("|"),Dr=new RegExp(`^(pr[0-9]+)(${Mr})$`),_r=new RegExp(`^((il[0-9]+pi[0-9]+)(${Vr}))|(il[0-9]+nm)$`),$r=new RegExp("^(pr[0-9]+)custom$"),Lr=new RegExp("^(il[0-9]+pi[0-9]+)custom$"),Nr=e=>Dr.test(e),Ur=e=>_r.test(e),zr=e=>-1!==Pr.indexOf(e),Hr=e=>"custom"===e,Qr=(e,t)=>xr(t).reduce(((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]})),{});class Yr{constructor(e){this.opts=e}sendEvent(e,t){return ir(this,void 0,void 0,(function*(){if(!navigator.sendBeacon)throw new Error('navigator.sendBeacon is not supported in this browser. Consider adding a polyfill like "sendbeacon-polyfill".');const{baseUrl:r}=this.opts,n=this.encodeForEventType(e,t),i=yield this.getQueryParamsForEventType(e),a=`${r}/analytics/${e}?${i}`;console.log(`Sending beacon for "${e}" with: `,JSON.stringify(t)),navigator.sendBeacon(a,new Blob([n],{type:"application/x-www-form-urlencoded"}))}))}encodeForEventType(e,t){return this.isEventTypeLegacy(e)?this.encodeForLegacyType(e,t):this.encodeForFormUrlEncoded(Object.assign({access_token:this.opts.token},t))}getQueryParamsForEventType(e){return ir(this,void 0,void 0,(function*(){const{token:t,visitorIdProvider:r}=this.opts,n=yield r.getCurrentVisitorId();return[t&&this.isEventTypeLegacy(e)?"access_token="+t:"",n?"visitorId="+n:"","discardVisitInfo=true"].filter((e=>!!e)).join("&")}))}isEventTypeLegacy(e){return-1!==[ar.click,ar.custom,ar.search,ar.view].indexOf(e)}encodeForLegacyType(e,t){return`${e}Event=${encodeURIComponent(JSON.stringify(t))}`}encodeForFormUrlEncoded(e){return Object.keys(e).filter((t=>!!e[t])).map((t=>`${encodeURIComponent(t)}=${encodeURIComponent(this.encodeValue(e[t]))}`)).join("&")}encodeValue(e){return"number"==typeof e||"string"==typeof e||"boolean"==typeof e?e:JSON.stringify(e)}}class Br{sendEvent(e,t){return ir(this,void 0,void 0,(function*(){return Promise.resolve()}))}}class Wr{constructor(e,t){sr()&&cr()?this.storage=new gr:sr()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new yr),this.beaconClient=new Yr(e),window.addEventListener("beforeunload",(()=>t()))}}class Jr{constructor(e,t){this.storage=t||new yr,this.beaconClient=new or(e)}}class Kr{constructor(){this.storage=new yr,this.beaconClient=new Br}}const Zr="https://platform.cloud.coveo.com/rest/ua";class Xr{constructor(e){if(!e)throw new Error("You have to pass options to this constructor");this.options=Object.assign(Object.assign({},this.defaultOptions),e),this.visitorId="",this.bufferedRequests=[],this.beforeSendHooks=[wr,dr].concat(this.options.beforeSendHooks),this.eventTypeMapping={};const t={baseUrl:this.baseUrl,token:this.options.token,visitorIdProvider:this};this.runtime=this.options.runtimeEnvironment||this.initRuntime(t),this.analyticsFetchClient=new or(t)}get defaultOptions(){return{endpoint:Zr,token:"",version:"v15",beforeSendHooks:[]}}initRuntime(e){return"undefined"!=typeof window&&"undefined"!=typeof document?new Wr(e,(()=>this.flushBufferWithBeacon())):("undefined"!=typeof navigator&&"ReactNative"==navigator.product&&console.warn("\n We've detected you're using React Native but have not provided the corresponding runtime, \n for an optimal experience please install @react-native-async-storage/async-storage and instantiate \n your analytics client as follows:\n \n import {ReactNativeRuntime} from 'coveo.analytics/react-native';\n \n const analytics = new CoveoAnalytics({\n ...your options,\n runtimeEnvironment: new ReactNativeRuntime();\n })\n "),new Jr(e))}get analyticsBeaconClient(){return this.runtime.beaconClient}get storage(){return this.runtime.storage}determineVisitorId(){return ir(this,void 0,void 0,(function*(){try{return(yield this.storage.getItem("visitorId"))||Or()}catch(e){return console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",e),Or()}}))}getCurrentVisitorId(){return ir(this,void 0,void 0,(function*(){if(!this.visitorId){const e=yield this.determineVisitorId();yield this.setCurrentVisitorId(e)}return this.visitorId}))}setCurrentVisitorId(e){return ir(this,void 0,void 0,(function*(){this.visitorId=e,yield this.storage.setItem("visitorId",e)}))}get currentVisitorId(){return"string"!=typeof(this.visitorId||this.storage.getItem("visitorId"))&&this.setCurrentVisitorId(Or()),this.visitorId}set currentVisitorId(e){this.visitorId=e,this.storage.setItem("visitorId",e)}sendEvent(e,...t){return ir(this,void 0,void 0,(function*(){const{newEventType:r=e,variableLengthArgumentsNames:n=[],addVisitorIdParameter:i=!1,usesMeasurementProtocol:a=!1}=this.eventTypeMapping[e]||{},o=yield[e=>n.length>0?this.parseVariableArgumentsPayload(n,e):e[0],e=>ir(this,void 0,void 0,(function*(){return Object.assign({visitorId:i?yield this.getCurrentVisitorId():""},e)})),e=>a?this.ensureAnonymousUserWhenUsingApiKey(e):e,t=>this.beforeSendHooks.reduce(((t,r)=>ir(this,void 0,void 0,(function*(){const n=yield t;return yield r(e,n)}))),t),t=>this.removeEmptyPayloadValues(t,e),e=>this.validateParams(e),e=>{return a?xr(t=e).reduce(((e,r)=>{const n=kr[r]||r;return Object.assign(Object.assign({},e),{[n]:t[r]})}),{}):e;var t},e=>a?this.removeUnknownParameters(e):e,e=>a?this.processCustomParameters(e):e].reduce(((e,t)=>ir(this,void 0,void 0,(function*(){const r=yield e;return yield t(r)}))),Promise.resolve(t));return this.bufferedRequests.push({eventType:r,payload:o,handled:!1}),yield this.deferExecution(),yield this.sendFromBufferWithFetch()}))}deferExecution(){return new Promise((e=>setTimeout(e,0)))}flushBufferWithBeacon(){for(;this.hasPendingRequests();){const{eventType:e,payload:t}=this.bufferedRequests.pop();this.analyticsBeaconClient.sendEvent(e,t)}}sendFromBufferWithFetch(){return ir(this,void 0,void 0,(function*(){const e=this.bufferedRequests.shift();if(e){const{eventType:t,payload:r}=e;return this.analyticsFetchClient.sendEvent(t,r)}}))}hasPendingRequests(){return this.bufferedRequests.length>0}clear(){this.storage.removeItem("visitorId");(new vr).clear()}sendSearchEvent(e){return ir(this,void 0,void 0,(function*(){return this.sendEvent(ar.search,e)}))}sendClickEvent(e){return ir(this,void 0,void 0,(function*(){return this.sendEvent(ar.click,e)}))}sendCustomEvent(e){return ir(this,void 0,void 0,(function*(){return this.sendEvent(ar.custom,e)}))}sendViewEvent(e){return ir(this,void 0,void 0,(function*(){return this.sendEvent(ar.view,e)}))}getVisit(){return ir(this,void 0,void 0,(function*(){const e=yield fetch(this.baseUrl+"/analytics/visit"),t=yield e.json();return this.visitorId=t.visitorId,t}))}getHealth(){return ir(this,void 0,void 0,(function*(){const e=yield fetch(this.baseUrl+"/analytics/monitoring/health");return yield e.json()}))}registerBeforeSendEventHook(e){this.beforeSendHooks.push(e)}addEventTypeMapping(e,t){this.eventTypeMapping[e]=t}parseVariableArgumentsPayload(e,t){const r={};for(let n=0,i=t.length;n<i;n++){const i=t[n];if("string"==typeof i)r[e[n]]=i;else if("object"==typeof i)return Object.assign(Object.assign({},r),i)}return r}isKeyAllowedEmpty(e,t){return-1!==({[ar.search]:["queryText"]}[e]||[]).indexOf(t)}removeEmptyPayloadValues(e,t){return Object.keys(e).filter((r=>{return this.isKeyAllowedEmpty(t,r)||null!=(n=e[r])&&""!==n;var n})).reduce(((t,r)=>Object.assign(Object.assign({},t),{[r]:e[r]})),{})}removeUnknownParameters(e){return Object.keys(e).filter((e=>{if((e=>[Nr,Er,Ur,zr,Hr].some((t=>t(e))))(e))return!0;console.log(e,"is not processed by coveoua")})).reduce(((t,r)=>Object.assign(Object.assign({},t),{[r]:e[r]})),{})}processCustomParameters(e){const{custom:t}=e,r=nr(e,["custom"]),n=this.lowercaseKeys(t),i=xr(a=r).reduce(((e,t)=>{const r=$r.exec(t)||Lr.exec(t);if(r){const n=r[1];return Object.assign(Object.assign({},e),Qr(n,a[t]))}return Object.assign(Object.assign({},e),{[t]:a[t]})}),{});var a;return Object.assign(Object.assign({},n),i)}lowercaseKeys(e){return Object.keys(e||{}).reduce(((t,r)=>Object.assign(Object.assign({},t),{[r.toLowerCase()]:e[r]})),{})}validateParams(e){const{anonymizeIp:t}=e,r=nr(e,["anonymizeIp"]);return void 0!==t&&-1==["0","false","undefined","null","{}","[]",""].indexOf((""+t).toLowerCase())&&(r.anonymizeIp=1),r}ensureAnonymousUserWhenUsingApiKey(e){const{userId:t}=e,r=nr(e,["userId"]);return(null==(n=this.options.token)?void 0:n.startsWith("xx"))&&!t?(r.userId="anonymous",r):e;var n}get baseUrl(){const{version:e,endpoint:t}=this.options,r=-1!==t.indexOf(".cloud.coveo.com");return`${t}${r?"":"/rest"}/${e}`}}var Gr;!function(e){e.interfaceLoad="interfaceLoad",e.interfaceChange="interfaceChange",e.didyoumeanAutomatic="didyoumeanAutomatic",e.didyoumeanClick="didyoumeanClick",e.resultsSort="resultsSort",e.searchboxSubmit="searchboxSubmit",e.searchboxClear="searchboxClear",e.searchboxAsYouType="searchboxAsYouType",e.breadcrumbFacet="breadcrumbFacet",e.breadcrumbResetAll="breadcrumbResetAll",e.documentQuickview="documentQuickview",e.documentOpen="documentOpen",e.omniboxAnalytics="omniboxAnalytics",e.omniboxFromLink="omniboxFromLink",e.triggerNotify="notify",e.triggerExecute="execute",e.triggerQuery="query",e.triggerRedirect="redirect",e.pagerResize="pagerResize",e.pagerNumber="pagerNumber",e.pagerNext="pagerNext",e.pagerPrevious="pagerPrevious",e.pagerScrolling="pagerScrolling",e.facetClearAll="facetClearAll",e.facetSearch="facetSearch",e.facetSelect="facetSelect",e.facetSelectAll="facetSelectAll",e.facetDeselect="facetDeselect",e.facetExclude="facetExclude",e.facetUnexclude="facetUnexclude",e.facetUpdateSort="facetUpdateSort",e.facetShowMore="showMoreFacetResults",e.facetShowLess="showLessFacetResults",e.queryError="query",e.queryErrorBack="errorBack",e.queryErrorClear="errorClearQuery",e.queryErrorRetry="errorRetry",e.recommendation="recommendation",e.recommendationInterfaceLoad="recommendationInterfaceLoad"}(Gr||(Gr={}));const en={[Gr.triggerNotify]:"queryPipelineTriggers",[Gr.triggerExecute]:"queryPipelineTriggers",[Gr.triggerQuery]:"queryPipelineTriggers",[Gr.triggerRedirect]:"queryPipelineTriggers",[Gr.queryError]:"errors",[Gr.queryErrorBack]:"errors",[Gr.queryErrorClear]:"errors",[Gr.queryErrorRetry]:"errors",[Gr.pagerNext]:"getMoreResults",[Gr.pagerPrevious]:"getMoreResults",[Gr.pagerNumber]:"getMoreResults",[Gr.pagerResize]:"getMoreResults",[Gr.pagerScrolling]:"getMoreResults",[Gr.facetSearch]:"facet",[Gr.facetShowLess]:"facet",[Gr.facetShowMore]:"facet",[Gr.recommendation]:"recommendation"};class tn{constructor(){this.runtime=new Kr,this.currentVisitorId=""}sendEvent(){return Promise.resolve()}sendSearchEvent(){return Promise.resolve()}sendClickEvent(){return Promise.resolve()}sendCustomEvent(){return Promise.resolve()}sendViewEvent(){return Promise.resolve()}getVisit(){return Promise.resolve({id:"",visitorId:""})}getHealth(){return Promise.resolve({status:""})}registerBeforeSendEventHook(){}addEventTypeMapping(){}}function rn(e){const t=e.join(";");return t.length<=256?t:rn(e.slice(1))}const nn=e=>rn(function(e){let t="";return e.filter((e=>{const r=e!==t;return t=e,r}))}(function(e){return e.map((e=>e.replace(/;/g,"")))}(e)));function an(e){const t="string"==typeof e.partialQueries?e.partialQueries:nn(e.partialQueries),r="string"==typeof e.suggestions?e.suggestions:nn(e.suggestions);return Object.assign(Object.assign({},e),{partialQueries:t,suggestions:r})}class on{constructor(e,t){this.opts=e,this.provider=t,this.coveoAnalyticsClient=!1===e.enableAnalytics?new tn:new Xr(e)}disable(){this.coveoAnalyticsClient instanceof Xr&&this.coveoAnalyticsClient.clear(),this.coveoAnalyticsClient=new tn}enable(){this.coveoAnalyticsClient=new Xr(this.opts)}logInterfaceLoad(){return this.logSearchEvent(Gr.interfaceLoad)}logRecommendationInterfaceLoad(){return this.logSearchEvent(Gr.recommendationInterfaceLoad)}logRecommendation(){return this.logCustomEvent(Gr.recommendation)}logFetchMoreResults(){return this.logCustomEvent(Gr.pagerScrolling,{type:"getMoreResults"})}logInterfaceChange(e){return this.logSearchEvent(Gr.interfaceChange,e)}logDidYouMeanAutomatic(){return this.logSearchEvent(Gr.didyoumeanAutomatic)}logDidYouMeanClick(){return this.logSearchEvent(Gr.didyoumeanClick)}logResultsSort(e){return this.logSearchEvent(Gr.resultsSort,e)}logSearchboxSubmit(){return this.logSearchEvent(Gr.searchboxSubmit)}logSearchboxClear(){return this.logSearchEvent(Gr.searchboxClear)}logSearchboxAsYouType(){return this.logSearchEvent(Gr.searchboxAsYouType)}logBreadcrumbFacet(e,t){return this.logFacetSearchEvent(Gr.breadcrumbFacet,e,t)}logBreadcrumbResetAll(){return this.logSearchEvent(Gr.breadcrumbResetAll)}logDocumentQuickview(e,t){return this.logClickEvent(Gr.documentQuickview,e,t)}logDocumentOpen(e,t){return this.logClickEvent(Gr.documentOpen,e,t)}logOmniboxAnalytics(e){return this.logSearchEvent(Gr.omniboxAnalytics,an(e))}logOmniboxFromLink(e){return this.logSearchEvent(Gr.omniboxFromLink,an(e))}logTriggerNotify(e){return this.logCustomEvent(Gr.triggerNotify,e)}logTriggerExecute(e){return this.logCustomEvent(Gr.triggerExecute,e)}logTriggerQuery(){const e={query:this.provider.getSearchEventRequestPayload().queryText};return this.logCustomEvent(Gr.triggerQuery,e)}logTriggerRedirect(e){const t=Object.assign(Object.assign({},e),{query:this.provider.getSearchEventRequestPayload().queryText});return this.logCustomEvent(Gr.triggerRedirect,t)}logPagerResize(e){return this.logCustomEvent(Gr.pagerResize,e)}logPagerNumber(e){return this.logCustomEvent(Gr.pagerNumber,e)}logPagerNext(e){return this.logCustomEvent(Gr.pagerNext,e)}logPagerPrevious(e){return this.logCustomEvent(Gr.pagerPrevious,e)}logPagerScrolling(){return this.logCustomEvent(Gr.pagerScrolling)}logFacetClearAll(e,t){return this.logFacetSearchEvent(Gr.facetClearAll,e,t)}logFacetSearch(e,t){return this.logFacetSearchEvent(Gr.facetSearch,e,t)}logFacetSelect(e,t){return this.logFacetSearchEvent(Gr.facetSelect,e,t)}logFacetDeselect(e,t){return this.logFacetSearchEvent(Gr.facetDeselect,e,t)}logFacetExclude(e,t){return this.logFacetSearchEvent(Gr.facetExclude,e,t)}logFacetUnexclude(e,t){return this.logFacetSearchEvent(Gr.facetUnexclude,e,t)}logFacetSelectAll(e,t){return this.logFacetSearchEvent(Gr.facetSelectAll,e,t)}logFacetUpdateSort(e,t){return this.logFacetSearchEvent(Gr.facetUpdateSort,e,t)}logFacetShowMore(e){return this.logCustomEvent(Gr.facetShowMore,e)}logFacetShowLess(e){return this.logCustomEvent(Gr.facetShowLess,e)}logQueryError(e){return this.logCustomEvent(Gr.queryError,e)}logQueryErrorBack(){return ir(this,void 0,void 0,(function*(){return yield this.logCustomEvent(Gr.queryErrorBack),this.logSearchEvent(Gr.queryErrorBack)}))}logQueryErrorRetry(){return ir(this,void 0,void 0,(function*(){return yield this.logCustomEvent(Gr.queryErrorRetry),this.logSearchEvent(Gr.queryErrorRetry)}))}logQueryErrorClear(){return ir(this,void 0,void 0,(function*(){return yield this.logCustomEvent(Gr.queryErrorClear),this.logSearchEvent(Gr.queryErrorClear)}))}logCustomEvent(e,t){const r=Object.assign(Object.assign({},this.provider.getBaseMetadata()),t),n=Object.assign(Object.assign({},this.getOrigins()),{eventType:en[e],eventValue:e,lastSearchQueryUid:this.provider.getSearchUID(),customData:r});return this.coveoAnalyticsClient.sendCustomEvent(n)}logCustomEventWithType(e,t,r){const n=Object.assign(Object.assign({},this.provider.getBaseMetadata()),r),i=Object.assign(Object.assign({},this.getOrigins()),{eventType:t,eventValue:e,lastSearchQueryUid:this.provider.getSearchUID(),customData:n});return this.coveoAnalyticsClient.sendCustomEvent(i)}logSearchEvent(e,t){return this.coveoAnalyticsClient.sendSearchEvent(this.getBaseSearchEventRequest(e,t))}logClickEvent(e,t,r,n){const i=Object.assign(Object.assign(Object.assign({},this.provider.getBaseMetadata()),r),n),a=Object.assign(Object.assign(Object.assign({},t),this.getOrigins()),{searchQueryUid:this.provider.getSearchUID(),queryPipeline:this.provider.getPipeline(),actionCause:e,customData:i});return this.coveoAnalyticsClient.sendClickEvent(a)}logFacetSearchEvent(e,t,r){const n=Object.assign(Object.assign({},this.getBaseSearchEventRequest(e,t)),{facetState:r});return this.coveoAnalyticsClient.sendSearchEvent(n)}getBaseSearchEventRequest(e,t){const r=Object.assign(Object.assign({},this.provider.getBaseMetadata()),t);return Object.assign(Object.assign(Object.assign({},this.provider.getSearchEventRequestPayload()),this.getOrigins()),{searchQueryUid:this.provider.getSearchUID(),queryPipeline:this.provider.getPipeline(),customData:r,actionCause:e})}getOrigins(){return{originLevel1:this.provider.getOriginLevel1(),originLevel2:this.provider.getOriginLevel2(),originLevel3:this.provider.getOriginLevel3()}}}class sn{constructor(e){this.state=e}getSearchEventRequestPayload(){return{queryText:this.queryText,responseTime:this.responseTime,results:this.mapResultsToAnalyticsDocument(),numberOfResults:this.numberOfResults}}getBaseMetadata(){return{}}getSearchUID(){var e;return(null===(e=this.state.search)||void 0===e?void 0:e.response.searchUid)||""}getPipeline(){return this.state.pipeline||"default"}getOriginLevel1(){return this.state.searchHub||"default"}getOriginLevel2(){return this.state.configuration.analytics.originLevel2||"default"}getOriginLevel3(){return this.state.configuration.analytics.originLevel3||"default"}mapResultsToAnalyticsDocument(){var e;return null===(e=this.state.search)||void 0===e?void 0:e.response.results.map((e=>({documentUri:e.uri,documentUriHash:e.raw.urihash})))}get queryText(){var e;return(null===(e=this.state.query)||void 0===e?void 0:e.q)||""}get responseTime(){var e;return(null===(e=this.state.search)||void 0===e?void 0:e.duration)||0}get numberOfResults(){var e;return(null===(e=this.state.search)||void 0===e?void 0:e.response.results.length)||[].length}}const cn=()=>new Xr({}).currentVisitorId,un=new br.HistoryStore;class ln{constructor(e){this.state=e,this.initialState={id:"",skus:[],maxNumberOfRecommendations:5,filter:{brand:"",category:""},recommendations:[],error:null,isLoading:!1,searchUid:"",duration:0}}getSearchEventRequestPayload(){return{queryText:"",responseTime:this.responseTime,results:this.mapResultsToAnalyticsDocument(),numberOfResults:this.numberOfResults}}getBaseMetadata(){var e;return{recommendation:(null===(e=this.state.productRecommendations)||void 0===e?void 0:e.id)||this.initialState.id}}getSearchUID(){var e;return(null===(e=this.state.productRecommendations)||void 0===e?void 0:e.searchUid)||this.initialState.searchUid}getPipeline(){return""}getOriginLevel1(){return this.state.searchHub||"default"}getOriginLevel2(){return this.state.configuration.analytics.originLevel2||"default"}getOriginLevel3(){return this.state.configuration.analytics.originLevel3||"default"}mapResultsToAnalyticsDocument(){return[]}get responseTime(){var e;return(null===(e=this.state.productRecommendations)||void 0===e?void 0:e.duration)||this.initialState.duration}get numberOfResults(){var e;return(null===(e=this.state.productRecommendations)||void 0===e?void 0:e.recommendations.length)||this.initialState.recommendations.length}}var dn;!function(e){e[e.Search=0]="Search",e[e.Custom=1]="Custom",e[e.Click=2]="Click"}(dn||(dn={}));const fn=(e,t,r,n=(e=>new sn(e)))=>Re(e,(async(e,{getState:i,extra:{analyticsClientMiddleware:a,logger:o}})=>{const s=(e=>e())(i),c=(({logger:e,state:t,analyticsClientMiddleware:r=((e,t)=>t),provider:n=new sn(t)})=>{const i=t.configuration.accessToken,a=t.configuration.analytics.apiBaseUrl,o=t.configuration.analytics.runtimeEnvironment,s=new on({token:i,endpoint:a,runtimeEnvironment:o,beforeSendHooks:[r,(t,r)=>(e.info({...r,type:t,endpoint:a,token:i},"Analytics request"),r)]},n);return!1===t.configuration.analytics.enabled&&s.disable(),s})({state:s,logger:o,analyticsClientMiddleware:a,provider:n(s)}),u=await r(c,s);return o.info({client:c.coveoAnalyticsClient,response:u},"Analytics response"),{analyticsType:t}})),pn=(e,t)=>{var r;const n=(null===(r=t.search)||void 0===r?void 0:r.response.results.findIndex((({uniqueId:t})=>e.uniqueId===t)))||0;return{collectionName:e.raw.collection||"default",documentAuthor:e.raw.author,documentPosition:n+1,documentTitle:e.title,documentUri:e.uri,documentUriHash:e.raw.urihash,documentUrl:e.clickUri,rankingModifier:e.rankingModifier||"",sourceName:e.raw.source,queryPipeline:t.pipeline||"default"}},hn=e=>({contentIDKey:"@permanentid",contentIDValue:e.raw.permanentid}),gn=new Le({required:!0,emptyAllowed:!1}),yn={collection:new Le,author:new Le,urihash:new Le,source:new Le,permanentid:new Le},mn={uniqueId:gn,raw:new Ue({values:yn}),title:gn,uri:gn,clickUri:gn,rankingModifier:new Le({required:!1,emptyAllowed:!0})};const vn=e=>new ke(mn).validate(function(e){return Object.assign({},...Object.keys(mn).map((t=>({[t]:e[t]}))),{raw:(t=e.raw,Object.assign({},...Object.keys(yn).map((e=>({[e]:t[e]})))))});var t}(e)),bn=fn("analytics/productrecommendations/load",dn.Search,(e=>e.logRecommendationInterfaceLoad()),(e=>new ln(e))),wn=xe("productrecommendations/setId",(e=>Ze(e,{id:Be}))),Sn=xe("productrecommendations/setSku",(e=>Ze(e,{skus:new He({required:!0,min:1,each:new Le({emptyAllowed:!1})})}))),On=xe("productrecommendations/setBrand",(e=>Ze(e,{brand:new Le({required:!0,emptyAllowed:!0})}))),Cn=xe("productrecommendations/setCategory",(e=>Ze(e,{category:new Le({required:!0,emptyAllowed:!0})}))),xn=xe("productrecommendations/setMaxNumberOfRecommendations",(e=>Ze(e,{number:new Me({required:!0,max:50,min:1})}))),In=Re("productrecommendations/get",(async(e,{getState:t,rejectWithValue:r,extra:{searchAPIClient:n}})=>{const i=t(),a=(new Date).getTime(),o=await n.productRecommendations(An(i)),s=(new Date).getTime()-a;return er(o)?r(o.error):{recommendations:o.success.results.map(qn),analyticsAction:bn(),searchUid:o.success.searchUid,duration:s}})),qn=e=>({sku:e.raw.productid||e.raw.sku,name:e.raw.ec_name||e.title,thumbnailUrl:e.raw.ec_image||e.raw.image,link:e.clickUri,price:e.raw.ec_price||e.raw.price,promoPrice:e.raw.ec_promo_price||e.raw.promo_price,rating:e.raw.ec_rating||e.raw.rating,tags:e.raw.tags,brand:e.raw.ec_brand||e.raw.brand,categories:e.raw.ec_categories||e.raw.categories,inStock:e.raw.ec_in_stock||e.raw.in_stock}),An=e=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl,...e.configuration.analytics.enabled&&{visitorId:cn()},recommendation:e.productRecommendations.id,numberOfResults:e.productRecommendations.maxNumberOfRecommendations,mlParameters:{...e.productRecommendations.skus&&e.productRecommendations.skus.length>0&&{itemIds:e.productRecommendations.skus},...e.productRecommendations.filter.brand&&{brandFilter:e.productRecommendations.filter.brand},...e.productRecommendations.filter.category&&{categoryFilter:e.productRecommendations.filter.category}},actionsHistory:e.configuration.analytics.enabled?un.getHistory():[],...e.context&&{context:e.context.contextValues},...e.searchHub&&{searchHub:e.searchHub}}),En=Ie({id:"",skus:[],maxNumberOfRecommendations:5,filter:{brand:"",category:""},recommendations:[],error:null,isLoading:!1,searchUid:"",duration:0},(e=>{e.addCase(wn,((e,t)=>{e.id=t.payload.id})).addCase(Sn,((e,t)=>{e.skus=t.payload.skus})).addCase(On,((e,t)=>{e.filter.brand=t.payload.brand})).addCase(Cn,((e,t)=>{e.filter.category=t.payload.category})).addCase(xn,((e,t)=>{e.maxNumberOfRecommendations=t.payload.number})).addCase(In.rejected,((e,t)=>{e.error=t.payload?t.payload:null,e.isLoading=!1})).addCase(In.fulfilled,((e,t)=>{e.error=null,e.searchUid=t.payload.searchUid,e.recommendations=t.payload.recommendations,e.isLoading=!1})).addCase(In.pending,(e=>{e.isLoading=!0}))})),Rn=xe("searchHub/set",(e=>Ze(e,new Le({required:!0,emptyAllowed:!0})))),jn=Ie("default",(e=>{e.addCase(Rn,((e,t)=>t.payload)).addCase(zt.fulfilled,((e,t)=>t.payload.searchHub)).addCase(it,((e,t)=>t.payload.searchHub||e))})),kn={configuration:jt,productRecommendations:En,context:Ht,searchHub:jn},Pn=fn("analytics/recommendation/update",dn.Search,(e=>e.logRecommendationInterfaceLoad())),Tn=xe("recommendation/set",(e=>Ze(e,{id:Be}))),Fn=Re("recommendation/get",(async(e,{getState:t,rejectWithValue:r,extra:{searchAPIClient:n}})=>{const i=t(),a=(new Date).getTime(),o=await n.recommendations(Mn(i)),s=(new Date).getTime()-a;return er(o)?r(o.error):{recommendations:o.success.results,analyticsAction:Pn(),duration:s}})),Mn=e=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl,recommendation:e.recommendation.id,actionsHistory:e.configuration.analytics.enabled?un.getHistory():[],...e.advancedSearchQueries&&{aq:e.advancedSearchQueries.aq,cq:e.advancedSearchQueries.cq},...e.pipeline&&{pipeline:e.pipeline},...e.searchHub&&{searchHub:e.searchHub},...e.context&&{context:e.context.contextValues},...e.fields&&{fieldsToInclude:e.fields.fieldsToInclude}}),Vn=fn("analytics/didyoumean/click",dn.Search,(e=>e.logDidYouMeanClick())),Dn=fn("analytics/didyoumean/automatic",dn.Search,(e=>e.logDidYouMeanAutomatic())),_n=xe("didYouMean/enable"),$n=xe("didYouMean/disable"),Ln=xe("didYouMean/correction",(e=>Ze(e,Be))),Nn=xe("query/updateQuery",(e=>Ze(e,{q:new Le,enableQuerySyntax:new De})));var Un,zn;!function(e){e.Ascending="ascending",e.Descending="descending"}(Un||(Un={})),function(e){e.Relevancy="relevancy",e.QRE="qre",e.Date="date",e.Field="field",e.NoSort="nosort"}(zn||(zn={}));const Hn=e=>{if(Qe(e))return e.map((e=>Hn(e))).join(",");switch(e.by){case zn.Relevancy:case zn.QRE:case zn.NoSort:return e.by;case zn.Date:return"date "+e.order;case zn.Field:return`@${e.field} ${e.order}`;default:return console.error("Unknown criterion: "+e),""}},Qn=()=>({by:zn.Relevancy}),Yn=e=>({by:zn.Date,order:e}),Bn=(e,t)=>({by:zn.Field,order:t,field:e}),Wn=()=>({by:zn.QRE}),Jn=()=>({by:zn.NoSort});function Kn(){return Hn(Qn())}const Zn=fn("search/logFetchMoreResults",dn.Search,(e=>e.logFetchMoreResults())),Xn=e=>fn("search/queryError",dn.Search,((t,r)=>{var n,i,a;return t.logQueryError({query:(null===(n=r.query)||void 0===n?void 0:n.q)||"",aq:(null===(i=r.advancedSearchQueries)||void 0===i?void 0:i.aq)||"",cq:(null===(a=r.advancedSearchQueries)||void 0===a?void 0:a.cq)||"",dq:"",errorType:e.type,errorMessage:e.message})}))();function Gn(e,t){const r={};return e.forEach((e=>r[e.facetId]=e)),t.map((e=>r[e])).filter((e=>void 0!==e))}const ei=async(e,t,r)=>{var n;const i=(new Date).getTime();return{response:await e.search(r),duration:(new Date).getTime()-i,queryExecuted:(null===(n=t.query)||void 0===n?void 0:n.q)||"",requestExecuted:r}},ti=Re("search/executeSearch",(async(e,{getState:t,dispatch:r,rejectWithValue:n,extra:{searchAPIClient:i}})=>{const a=t();pi(a);const o=await ei(i,a,oi(a));if(er(o.response))return r(Xn(o.response.error)),n(o.response.error);if(!ii(a,o.response.success))return r(Lt(ai(a))),{...o,response:o.response.success,automaticallyCorrected:!1,analyticsAction:e};r(e);const s=await ni(i,o.response.success.queryCorrections[0].correctedQuery,t,r);return er(s.response)?(r(Xn(s.response.error)),n(s.response.error)):(r(Lt(ai(t()))),{...s,response:{...s.response.success,queryCorrections:o.response.success.queryCorrections},automaticallyCorrected:!0,analyticsAction:Dn()})})),ri=Re("search/fetchMoreResults",(async(e,{getState:t,dispatch:r,rejectWithValue:n,extra:{searchAPIClient:i}})=>{const a=t(),o=await ei(i,a,si(a));return er(o.response)?(r(Xn(o.response.error)),n(o.response.error)):(r(Lt(ai(a))),{...o,response:o.response.success,automaticallyCorrected:!1,analyticsAction:Zn()})})),ni=async(e,t,r,n)=>{n(Nn({q:t}));const i=await ei(e,r(),oi(r()));return n(Ln(t)),i},ii=(e,t)=>{var r;return!0===(null===(r=e.didYouMean)||void 0===r?void 0:r.enableDidYouMean)&&0===t.results.length&&0!==t.queryCorrections.length},ai=e=>{var t,r;return{context:e.context||{contextValues:{}},facetSet:e.facetSet||{},numericFacetSet:e.numericFacetSet||{},dateFacetSet:e.dateFacetSet||{},categoryFacetSet:e.categoryFacetSet||{},pagination:e.pagination||{firstResult:0,numberOfResults:10,totalCountFiltered:0},query:e.query||{q:"",enableQuerySyntax:!1},advancedSearchQueries:e.advancedSearchQueries||{cq:"",aq:""},querySet:e.querySet||{},sortCriteria:e.sortCriteria||Kn(),pipeline:e.pipeline||"default",searchHub:e.searchHub||"default",facetOptions:e.facetOptions||{freezeFacetOrder:!1},facetOrder:null!==(t=e.facetOrder)&&void 0!==t?t:[],debug:null!==(r=e.debug)&&void 0!==r&&r}},oi=e=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl,debug:e.debug,...e.configuration.analytics.enabled&&{visitorId:cn()},...e.advancedSearchQueries&&{aq:e.advancedSearchQueries.aq,cq:e.advancedSearchQueries.cq},...e.context&&{context:e.context.contextValues},...e.didYouMean&&{enableDidYouMean:e.didYouMean.enableDidYouMean},...e.facetSet&&{facets:ci(e)},...e.fields&&{fieldsToInclude:e.fields.fieldsToInclude},...e.pagination&&{numberOfResults:e.pagination.numberOfResults,firstResult:e.pagination.firstResult},...e.pipeline&&{pipeline:e.pipeline},...e.query&&{q:e.query.q,enableQuerySyntax:e.query.enableQuerySyntax},...e.searchHub&&{searchHub:e.searchHub},...e.sortCriteria&&{sortCriteria:e.sortCriteria},...e.facetOptions&&{facetOptions:e.facetOptions}}),si=e=>{var t,r,n,i;return{...oi(e),firstResult:(null!==(r=null===(t=e.pagination)||void 0===t?void 0:t.firstResult)&&void 0!==r?r:0)+(null!==(i=null===(n=e.search)||void 0===n?void 0:n.results.length)&&void 0!==i?i:0)}};function ci(e){return[...ui(e),...li(e)]}function ui(e){var t;return Gn(di(e),null!==(t=e.facetOrder)&&void 0!==t?t:[])}function li(e){var t;const r=null!==(t=e.facetOrder)&&void 0!==t?t:[];return di(e).filter((e=>-1===r.indexOf(e.facetId)))}function di(e){return[...fi(e.facetSet),...fi(e.numericFacetSet),...fi(e.dateFacetSet),...fi(e.categoryFacetSet)]}function fi(e={}){return Object.keys(e).map((t=>e[t]))}const pi=e=>{var t;e.configuration.analytics.enabled&&un.addElement({name:"Query",value:(null===(t=e.query)||void 0===t?void 0:t.q)||"",time:JSON.stringify(new Date)})},hi=e=>t=>r=>{var n,i;const a=null===(n=r.payload)||void 0===n?void 0:n.analyticsAction;void 0!==a&&(null===(i=r.payload)||void 0===i||delete i.analyticsAction);const o=t(r);return r.type===ti.fulfilled.type&&void 0===a&&console.error("No analytics action associated with search:",r),r.type===Fn.fulfilled&&void 0===a&&console.error("No analytics action associated with recommendation:",r),r.type===In.fulfilled&&void 0===a&&console.error("No analytics action associated with product recommendation:",r),void 0!==a&&e.dispatch(a),o},gi=e=>()=>t=>r=>{if(!r.error)return t(r);const n=r.error;return e.error(n.stack||n.message||n.name||"Error","Action dispatch error "+r.type,r),"SchemaValidationError"!==r.error.name?t(r):void 0},yi=e=>t=>r=>n=>(e.debug({action:n,nextState:t.getState()},"Action dispatched: "+n.type),r(n));function mi(e){try{return JSON.stringify(e)}catch(e){return'"[Circular]"'}}var vi=function(e,t,r){var n=r&&r.stringify||mi;if("object"==typeof e&&null!==e){var i=t.length+1;if(1===i)return e;var a=new Array(i);a[0]=n(e);for(var o=1;o<i;o++)a[o]=n(t[o]);return a.join(" ")}if("string"!=typeof e)return e;var s=t.length;if(0===s)return e;for(var c="",u=0,l=-1,d=e&&e.length||0,f=0;f<d;){if(37===e.charCodeAt(f)&&f+1<d){switch(l=l>-1?l:0,e.charCodeAt(f+1)){case 100:if(u>=s)break;if(l<f&&(c+=e.slice(l,f)),null==t[u])break;c+=Number(t[u]),l=f+=2;break;case 79:case 111:case 106:if(u>=s)break;if(l<f&&(c+=e.slice(l,f)),void 0===t[u])break;var p=typeof t[u];if("string"===p){c+="'"+t[u]+"'",l=f+2,f++;break}if("function"===p){c+=t[u].name||"<anonymous>",l=f+2,f++;break}c+=n(t[u]),l=f+2,f++;break;case 115:if(u>=s)break;l<f&&(c+=e.slice(l,f)),c+=String(t[u]),l=f+2,f++;break;case 37:l<f&&(c+=e.slice(l,f)),c+="%",l=f+2,f++}++u}++f}if(-1===l)return e;l<d&&(c+=e.slice(l));return c};var bi=Oi,wi=function(){function e(e){return void 0!==e&&e}try{return"undefined"!=typeof globalThis||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch(t){return e(self)||e(window)||e(this)||{}}}().console||{},Si={mapHttpRequest:ji,mapHttpResponse:ji,wrapRequestSerializer:ki,wrapResponseSerializer:ki,wrapErrorSerializer:ki,req:ji,res:ji,err:function(e){var t={type:e.constructor.name,msg:e.message,stack:e.stack};for(var r in e)void 0===t[r]&&(t[r]=e[r]);return t}};function Oi(e){(e=e||{}).browser=e.browser||{};var t=e.browser.transmit;if(t&&"function"!=typeof t.send)throw Error("pino: transmit option must have a send function");var r=e.browser.write||wi;e.browser.write&&(e.browser.asObject=!0);var n=e.serializers||{},i=Array.isArray(e.browser.serialize)?e.browser.serialize.filter((function(e){return"!stdSerializers.err"!==e})):!0===e.browser.serialize&&Object.keys(n),a=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(a=!1);"function"==typeof r&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),!1===e.enabled&&(e.level="silent");var o=e.level||"info",s=Object.create(r);s.log||(s.log=Pi),Object.defineProperty(s,"levelVal",{get:function(){return"silent"===this.level?1/0:this.levels.values[this.level]}}),Object.defineProperty(s,"level",{get:function(){return this._level},set:function(e){if("silent"!==e&&!this.levels.values[e])throw Error("unknown level "+e);this._level=e,Ci(c,s,"error","log"),Ci(c,s,"fatal","error"),Ci(c,s,"warn","error"),Ci(c,s,"info","log"),Ci(c,s,"debug","log"),Ci(c,s,"trace","log")}});var c={transmit:t,serialize:i,asObject:e.browser.asObject,levels:["error","fatal","warn","info","debug","trace"],timestamp:Ri(e)};return s.levels=Oi.levels,s.level=o,s.setMaxListeners=s.getMaxListeners=s.emit=s.addListener=s.on=s.prependListener=s.once=s.prependOnceListener=s.removeListener=s.removeAllListeners=s.listeners=s.listenerCount=s.eventNames=s.write=s.flush=Pi,s.serializers=n,s._serialize=i,s._stdErrSerialize=a,s.child=function(r){if(!r)throw new Error("missing bindings for child Pino");var a=r.serializers;if(i&&a){var o=Object.assign({},n,a),s=!0===e.browser.serialize?Object.keys(o):i;delete r.serializers,Ii([r],s,o,this._stdErrSerialize)}function c(e){this._childLevel=1+(0|e._childLevel),this.error=qi(e,r,"error"),this.fatal=qi(e,r,"fatal"),this.warn=qi(e,r,"warn"),this.info=qi(e,r,"info"),this.debug=qi(e,r,"debug"),this.trace=qi(e,r,"trace"),o&&(this.serializers=o,this._serialize=s),t&&(this._logEvent=Ei([].concat(e._logEvent.bindings,r)))}return c.prototype=this,new c(this)},t&&(s._logEvent=Ei()),s}function Ci(e,t,r,n){var i=Object.getPrototypeOf(t);t[r]=t.levelVal>t.levels.values[r]?Pi:i[r]?i[r]:wi[r]||wi[n]||Pi,function(e,t,r){if(!e.transmit&&t[r]===Pi)return;t[r]=(n=t[r],function(){for(var i=e.timestamp(),a=new Array(arguments.length),o=Object.getPrototypeOf&&Object.getPrototypeOf(this)===wi?wi:this,s=0;s<a.length;s++)a[s]=arguments[s];if(e.serialize&&!e.asObject&&Ii(a,this._serialize,this.serializers,this._stdErrSerialize),e.asObject?n.call(o,xi(this,r,a,i)):n.apply(o,a),e.transmit){var c=e.transmit.level||t.level,u=Oi.levels.values[c],l=Oi.levels.values[r];if(l<u)return;Ai(this,{ts:i,methodLevel:r,methodValue:l,transmitLevel:c,transmitValue:Oi.levels.values[e.transmit.level||t.level],send:e.transmit.send,val:t.levelVal},a)}});var n}(e,t,r)}function xi(e,t,r,n){e._serialize&&Ii(r,e._serialize,e.serializers,e._stdErrSerialize);var i=r.slice(),a=i[0],o={};n&&(o.time=n),o.level=Oi.levels.values[t];var s=1+(0|e._childLevel);if(s<1&&(s=1),null!==a&&"object"==typeof a){for(;s--&&"object"==typeof i[0];)Object.assign(o,i.shift());a=i.length?vi(i.shift(),i):void 0}else"string"==typeof a&&(a=vi(i.shift(),i));return void 0!==a&&(o.msg=a),o}function Ii(e,t,r,n){for(var i in e)if(n&&e[i]instanceof Error)e[i]=Oi.stdSerializers.err(e[i]);else if("object"==typeof e[i]&&!Array.isArray(e[i]))for(var a in e[i])t&&t.indexOf(a)>-1&&a in r&&(e[i][a]=r[a](e[i][a]))}function qi(e,t,r){return function(){var n=new Array(1+arguments.length);n[0]=t;for(var i=1;i<n.length;i++)n[i]=arguments[i-1];return e[r].apply(this,n)}}function Ai(e,t,r){var n=t.send,i=t.ts,a=t.methodLevel,o=t.methodValue,s=t.val,c=e._logEvent.bindings;Ii(r,e._serialize||Object.keys(e.serializers),e.serializers,void 0===e._stdErrSerialize||e._stdErrSerialize),e._logEvent.ts=i,e._logEvent.messages=r.filter((function(e){return-1===c.indexOf(e)})),e._logEvent.level.label=a,e._logEvent.level.value=o,n(a,e._logEvent,s),e._logEvent=Ei(c)}function Ei(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function Ri(e){return"function"==typeof e.timestamp?e.timestamp:!1===e.timestamp?Ti:Fi}function ji(){return{}}function ki(e){return e}function Pi(){}function Ti(){return!1}function Fi(){return Date.now()}Oi.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},Oi.stdSerializers=Si,Oi.stdTimeFunctions=Object.assign({},{nullTime:Ti,epochTime:Fi,unixTime:function(){return Math.round(Date.now()/1e3)},isoTime:function(){return new Date(Date.now()).toISOString()}});const Mi=e=>e,Vi=e=>e,Di=e=>e;class _i{constructor(e){if(this.options=e,this.accessTokenRenewalsAttempts=0,this.resetRenewalTriesAfterDelay=function(e,t,r){var n;return void 0===t&&(t=50),void 0===r&&(r={isImmediate:!1}),function(){for(var i=[],a=arguments.length;a--;)i[a]=arguments[a];var o=this,s=r.isImmediate&&void 0===n;void 0!==n&&clearTimeout(n),n=setTimeout((function(){n=void 0,r.isImmediate||e.apply(o,i)}),t),s&&e.apply(o,i)}}((()=>this.accessTokenRenewalsAttempts=0),500),this.initLogger(),this.validateConfiguration(e),this.initStore(),this.reduxStore.dispatch(nt({accessToken:e.configuration.accessToken,platformUrl:e.configuration.platformUrl,organizationId:e.configuration.organizationId})),e.configuration.search&&this.reduxStore.dispatch(it(e.configuration.search)),e.configuration.analytics){const{analyticsClientMiddleware:t,...r}=e.configuration.analytics;this.reduxStore.dispatch(at(r))}}validateConfiguration(e){const t=new ke({organizationId:new Le({required:!0,emptyAllowed:!1}),accessToken:new Le({required:!0,emptyAllowed:!1}),platformUrl:new Le({required:!1,emptyAllowed:!1}),search:new Ue({options:{required:!1},values:{pipeline:new Le({required:!1,emptyAllowed:!1}),searchHub:new Le({required:!1,emptyAllowed:!1})}})});try{t.validate(e.configuration)}catch(e){throw this.logger.error(e,"Headless engine configuration error"),e}}initLogger(){var e,t,r;this.logger=bi({name:"@coveo/headless",level:(null===(e=this.options.loggerOptions)||void 0===e?void 0:e.level)||"warn",formatters:{log:null===(t=this.options.loggerOptions)||void 0===t?void 0:t.logFormatter},browser:{transmit:{send:(null===(r=this.options.loggerOptions)||void 0===r?void 0:r.browserPostLogHook)||(()=>{})}}})}initStore(){const{search:e}=this.options.configuration;this.reduxStore=function({reducers:e,preloadedState:t,middlewares:r=[],thunkExtraArguments:n}){return Ce({reducer:ee(e),preloadedState:t,devTools:{stateSanitizer:e=>e.history?{...e,history:"<<OMIT>>"}:e},middleware:e=>[gi(n.logger),hi,...r,...e({thunk:{extraArgument:n}}),yi(n.logger)]})}({preloadedState:this.options.preloadedState,reducers:this.options.reducers,middlewares:this.options.middlewares,thunkExtraArguments:{searchAPIClient:new Kt({logger:this.logger,renewAccessToken:()=>this.renewAccessToken(),preprocessRequest:(null==e?void 0:e.preprocessRequestMiddleware)||qt,postprocessSearchResponseMiddleware:(null==e?void 0:e.preprocessSearchResponseMiddleware)||Mi,postprocessFacetSearchResponseMiddleware:(null==e?void 0:e.preprocessFacetSearchResponseMiddleware)||Vi,postprocessQuerySuggestResponseMiddleware:(null==e?void 0:e.preprocessQuerySuggestResponseMiddleware)||Di}),analyticsClientMiddleware:this.analyticsClientMiddleware(this.options),logger:this.logger,validatePayload:Ke}})}static getSampleConfiguration(){return{organizationId:"searchuisamples",accessToken:"xx564559b1-0045-48e1-953c-3addd1ee4457",search:{pipeline:"default",searchHub:"default"}}}enableAnalytics(){this.dispatch(ct())}disableAnalytics(){this.dispatch(st())}get store(){return this.reduxStore}get dispatch(){return this.reduxStore.dispatch}get subscribe(){return this.reduxStore.subscribe}get state(){return this.reduxStore.getState()}async renewAccessToken(){if(!this.options.configuration.renewAccessToken)return"";if(this.accessTokenRenewalsAttempts++,this.resetRenewalTriesAfterDelay(),this.accessTokenRenewalsAttempts>5)return"";try{const e=await this.options.configuration.renewAccessToken();return this.dispatch(nt({accessToken:e})),e}catch(e){return""}}analyticsClientMiddleware(e){var t;return(null===(t=e.configuration.analytics)||void 0===t?void 0:t.analyticsClientMiddleware)||((e,t)=>t)}}const $i={id:Be},Li=xe("querySuggest/register",(e=>Ze(e,{...$i,q:new Le,count:new Me({min:0})}))),Ni=xe("querySuggest/unregister",(e=>Ze(e,$i))),Ui=xe("querySuggest/selectSuggestion",(e=>Ze(e,{...$i,expression:We}))),zi=xe("querySuggest/clear",(e=>Ze(e,$i))),Hi=xe("querySuggest/clearSuggestions",(e=>Ze(e,$i))),Qi=Re("querySuggest/fetch",(async(e,{getState:t,rejectWithValue:r,extra:{searchAPIClient:n,validatePayload:i}})=>{i(e,$i);const a=e.id,o=await n.querySuggest(Yi(a,t()));return er(o)?r({id:a,...o.error}):{id:a,...o.success}})),Yi=(e,t)=>({accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,url:t.configuration.search.apiBaseUrl,count:t.querySuggest[e].count,q:t.querySuggest[e].q,actionsHistory:t.configuration.analytics.enabled?un.getHistory():[],...t.context&&{context:t.context.contextValues},...t.pipeline&&{pipeline:t.pipeline},...t.searchHub&&{searchHub:t.searchHub}}),Bi={q:new Le,enableQuerySyntax:new De,aq:new Le,cq:new Le,firstResult:new Me({min:0}),numberOfResults:new Me({min:0}),sortCriteria:new Le,f:new Ue,cf:new Ue,nf:new Ue,df:new Ue,debug:new De},Wi=xe("searchParameters/restore",(e=>Ze(e,Bi))),Ji=Ie({q:"",enableQuerySyntax:!1},(e=>e.addCase(Nn,((e,t)=>({...e,...t.payload}))).addCase(Ln,((e,t)=>{e.q=t.payload})).addCase(Ui,((e,t)=>{e.q=t.payload.expression})).addCase(zt.fulfilled,((e,t)=>t.payload.query)).addCase(Wi,((e,t)=>{var r,n;e.q=null!==(r=t.payload.q)&&void 0!==r?r:e.q,e.enableQuerySyntax=null!==(n=t.payload.enableQuerySyntax)&&void 0!==n?n:e.enableQuerySyntax}))));function Ki(e){return"redirect"===e.type}class Zi{constructor(e){this.response=e}get basicExpression(){return this.response.parsedInput.basicExpression}get largeExpression(){return this.response.parsedInput.largeExpression}get redirectionUrl(){const e=this.response.preprocessingOutput.triggers.filter(Ki);return e.length?e[0].content:null}}const Xi=fn("analytics/trigger/redirection",dn.Search,((e,t)=>{if(t.redirection&&null!==t.redirection.redirectTo)return e.logTriggerRedirect({redirectedTo:t.redirection.redirectTo})})),Gi=Re("redirection/check",(async(e,{dispatch:t,getState:r,rejectWithValue:n,extra:{searchAPIClient:i,validatePayload:a}})=>{a(e,{defaultRedirectionUrl:new Le({emptyAllowed:!1,url:!0})});const o=await i.plan(ea(r()));if(er(o))return n(o.error);const s=new Zi(o.success).redirectionUrl;return s&&t(Xi()),s||e.defaultRedirectionUrl})),ea=e=>({accessToken:e.configuration.accessToken,organizationId:e.configuration.organizationId,url:e.configuration.search.apiBaseUrl,q:e.query.q,...e.context&&{context:e.context.contextValues},...e.pipeline&&{pipeline:e.pipeline},...e.searchHub&&{searchHub:e.searchHub}}),ta=Ie({redirectTo:null},(e=>e.addCase(Gi.fulfilled,((e,t)=>{e.redirectTo=t.payload})))),ra={id:Be,query:We},na=xe("querySet/register",(e=>Ze(e,ra))),ia=xe("querySet/update",(e=>Ze(e,ra))),aa=Ie({},(e=>e.addCase(Li,((e,t)=>{e[t.payload.id]={id:"",completions:[],count:5,q:"",currentRequestId:"",error:null,partialQueries:[],...t.payload}})).addCase(Ni,((e,t)=>{delete e[t.payload.id]})).addCase(Qi.pending,((e,t)=>{e[t.meta.arg.id].currentRequestId=t.meta.requestId})).addCase(Qi.fulfilled,((e,t)=>{var r;const n=t.meta.arg.id;if(t.meta.requestId===(null===(r=e[n])||void 0===r?void 0:r.currentRequestId)){const{q:r}=e[n];r&&e[n].partialQueries.push(r),e[n].completions=t.payload.completions}})).addCase(Qi.rejected,((e,t)=>{e[t.payload.id].error=t.payload})).addCase(ia,((e,t)=>{const{id:r,query:n}=t.payload;r in e&&(e[r].q=n)})).addCase(zi,((e,t)=>{const{id:r}=t.payload;e[r].q="",e[r].completions=[]})).addCase(Hi,((e,t)=>{e[t.payload.id].completions=[]})).addCase(Ui,((e,t)=>{const{id:r,expression:n}=t.payload;e[r].q=n,e[r].completions=[]})).addCase(ti.fulfilled,(e=>{for(const t of Object.values(e))t&&(t.partialQueries=[])})))),oa=Ie({},(e=>{e.addCase(na,((e,t)=>{const{id:r,query:n}=t.payload;r in e||(e[r]=n)})).addCase(ia,((e,t)=>{const{id:r,query:n}=t.payload;sa(e,r,n)})).addCase(Ui,((e,t)=>{const{id:r,expression:n}=t.payload;sa(e,r,n)})).addCase(ti.fulfilled,((e,t)=>{const{queryExecuted:r}=t.payload;Object.keys(e).forEach((t=>e[t]=r))})).addCase(zt.fulfilled,((e,t)=>{for(const[r,n]of Object.entries(t.payload.querySet))sa(e,r,n)}))})),sa=(e,t,r)=>{t in e&&(e[t]=r)};function ca(e,t){e.error=t.payload?t.payload:null,e.isLoading=!1}function ua(e,t){e.error=null,e.response=t.payload.response,e.queryExecuted=t.payload.queryExecuted,e.duration=t.payload.duration,e.isLoading=!1}function la(e){e.isLoading=!0}const da=Ie({response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],queryCorrections:[]},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[]},(e=>{e.addCase(ti.rejected,ca),e.addCase(ri.rejected,ca),e.addCase(ti.fulfilled,((e,t)=>{ua(e,t),e.results=t.payload.response.results})),e.addCase(ri.fulfilled,((e,t)=>{ua(e,t),e.results=[...e.results,...t.payload.response.results]})),e.addCase(ti.pending,la),e.addCase(ri.pending,la)})),fa=new Me({required:!0,min:0}),pa=xe("pagination/registerNumberOfResults",(e=>Ze(e,fa))),ha=xe("pagination/updateNumberOfResults",(e=>Ze(e,fa))),ga=xe("pagination/registerPage",(e=>Ze(e,fa))),ya=xe("pagination/updatePage",(e=>Ze(e,fa))),ma=xe("pagination/nextPage"),va=xe("pagination/previousPage"),ba=Ie({firstResult:0,numberOfResults:10,totalCountFiltered:0},(e=>{e.addCase(pa,((e,t)=>{const r=wa(e),n=t.payload;e.numberOfResults=n,e.firstResult=Sa(r,n)})).addCase(ha,((e,t)=>{e.numberOfResults=t.payload,e.firstResult=0})).addCase(ga,((e,t)=>{const r=t.payload;e.firstResult=Sa(r,e.numberOfResults)})).addCase(ya,((e,t)=>{const r=t.payload;e.firstResult=Sa(r,e.numberOfResults)})).addCase(va,(e=>{const t=wa(e),r=Math.max(t-1,1);e.firstResult=Sa(r,e.numberOfResults)})).addCase(ma,(e=>{const t=wa(e),r=function(e){const{totalCountFiltered:t,numberOfResults:r}=e;return Ca(t,r)}(e),n=Math.min(t+1,r);e.firstResult=Sa(n,e.numberOfResults)})).addCase(zt.fulfilled,((e,t)=>{e.numberOfResults=t.payload.pagination.numberOfResults,e.firstResult=t.payload.pagination.firstResult})).addCase(Wi,((e,t)=>{var r,n;e.firstResult=null!==(r=t.payload.firstResult)&&void 0!==r?r:e.firstResult,e.numberOfResults=null!==(n=t.payload.numberOfResults)&&void 0!==n?n:e.numberOfResults})).addCase(ti.fulfilled,((e,t)=>{const{response:r}=t.payload;e.totalCountFiltered=r.totalCountFiltered}))}));function wa(e){const{firstResult:t,numberOfResults:r}=e;return Oa(t,r)}function Sa(e,t){return(e-1)*t}function Oa(e,t){return e/t+1}function Ca(e,t){const r=Math.min(e,1e3);return Math.ceil(r/t)}const xa={by:new Ye({enum:zn,required:!0})},Ia=xe("sortCriteria/register",(e=>Aa(e))),qa=xe("sortCriteria/update",(e=>Aa(e))),Aa=e=>Qe(e)?(e.forEach((e=>Ze(e,xa))),{payload:e}):Ze(e,xa),Ea=Ie(Kn(),(e=>{e.addCase(Ia,((e,t)=>Hn(t.payload))).addCase(qa,((e,t)=>Hn(t.payload))).addCase(zt.fulfilled,((e,t)=>t.payload.sortCriteria)).addCase(Wi,((e,t)=>{var r;return null!==(r=t.payload.sortCriteria)&&void 0!==r?r:e}))})),Ra=Be,ja={value:Be,numberOfResults:new Me({min:0}),state:Be},ka={facetId:Ra,field:new Le({required:!0,emptyAllowed:!0}),delimitingCharacter:new Le({required:!1,emptyAllowed:!0}),filterFacetCount:new De({required:!1}),injectionDepth:new Me({required:!1,min:0}),numberOfValues:new Me({required:!1,min:1}),sortCriteria:new Pe({required:!1})},Pa=xe("facet/register",(e=>Ze(e,ka))),Ta=xe("facet/toggleSelectValue",(e=>Ze(e,{facetId:Ra,selection:new Ue({values:ja})}))),Fa=xe("facet/deselectAll",(e=>Ze(e,Ra))),Ma=xe("facet/updateSortCriterion",(e=>Ze(e,{facetId:Ra,criterion:new Pe({required:!0})}))),Va=xe("facet/updateNumberOfValues",(e=>Ze(e,{facetId:Ra,numberOfValues:new Me({required:!0,min:1})}))),Da=xe("facet/updateIsFieldExpanded",(e=>Ze(e,{facetId:Ra,isFieldExpanded:new De({required:!0})}))),_a={facetId:Ra,captions:new Ue({options:{required:!1}}),numberOfValues:new Me({required:!1,min:1}),query:new Le({required:!1,emptyAllowed:!0})},$a={facetId:Ra,value:new Ue({values:{displayValue:We,rawValue:We,count:new Me({required:!0,min:0})}})},La=xe("facetSearch/register",(e=>Ze(e,_a))),Na=xe("facetSearch/update",(e=>Ze(e,_a))),Ua=xe("facetSearch/toggleSelectValue",(e=>Ze(e,$a)));function za(e,t){const{facetId:r,criterion:n}=t,i=e[r];i&&(i.sortCriteria=n)}function Ha(e,t){const r=e[t];r&&(r.currentValues=[],r.preventAutoSelect=!0)}function Qa(e,t){const{facetId:r,numberOfValues:n}=t,i=e[r];i&&(i.numberOfValues=n)}const Ya=xe("facet/deselectAllFacets"),Ba=Ie({},(e=>{e.addCase(Pa,((e,t)=>{const{facetId:r}=t.payload;var n;r in e||(e[r]=(n=t.payload,{...Wa,type:"specific",currentValues:[],freezeCurrentValues:!1,isFieldExpanded:!1,preventAutoSelect:!1,...n}))})).addCase(zt.fulfilled,((e,t)=>{if(0!==Object.keys(t.payload.facetSet).length)return t.payload.facetSet})).addCase(Wi,((e,t)=>{const r=t.payload.f||{};Object.keys(e).forEach((t=>{const n=e[t],i=r[t]||[];n.currentValues=i.map(Ka),n.preventAutoSelect=!0,n.numberOfValues=Math.max(i.length,n.numberOfValues)}))})).addCase(Ta,((e,t)=>{const{facetId:r,selection:n}=t.payload,i=e[r];if(!i)return;const a=i.currentValues.find((e=>e.value===n.value));if(!a)return;const o="selected"===a.state;a.state=o?"idle":"selected",i.freezeCurrentValues=!0,i.preventAutoSelect=!0})).addCase(Fa,((e,t)=>{Ha(e,t.payload)})).addCase(Ya,(e=>{Object.keys(e).forEach((t=>{Ha(e,t)}))})).addCase(Ma,((e,t)=>{za(e,t.payload)})).addCase(Va,((e,t)=>{Qa(e,t.payload)})).addCase(Da,((e,t)=>{const{facetId:r,isFieldExpanded:n}=t.payload,i=e[r];i&&(i.isFieldExpanded=n)})).addCase(ti.fulfilled,((e,t)=>{t.payload.response.facets.forEach((t=>{const r=t.facetId,n=e[r];n&&(n.currentValues=t.values.map(Ja),n.freezeCurrentValues=!1,n.preventAutoSelect=!1)}))})).addCase(Ua,((e,t)=>{const{facetId:r,value:n}=t.payload,i=e[r];if(!i)return;const{rawValue:a}=n,{currentValues:o}=i,s=o.find((e=>e.value===a));if(s)return void(s.state="selected");const c=Ka(a),u=o.findIndex((e=>"idle"===e.state)),l=-1===u?o.length:u,d=o.slice(0,l),f=o.slice(l+1);i.currentValues=[...d,c,...f],i.numberOfValues=i.currentValues.length}))})),Wa={delimitingCharacter:">",filterFacetCount:!0,injectionDepth:1e3,numberOfValues:8,sortCriteria:"automatic"};function Ja(e){const{value:t,state:r}=e;return{value:t,state:r}}function Ka(e){return{value:e,state:"selected"}}function Za(){return{context:{contextValues:{}},facetSet:{},dateFacetSet:{},numericFacetSet:{},categoryFacetSet:{},facetOptions:{freezeFacetOrder:!1},pagination:{firstResult:0,numberOfResults:10,totalCountFiltered:0},query:{q:"",enableQuerySyntax:!1},advancedSearchQueries:{cq:"",aq:""},sortCriteria:Kn(),querySet:{},pipeline:"default",searchHub:"default",debug:!1,facetOrder:[]}}const Xa=(e,t=5)=>e+Math.random().toString(36).substr(2,2+t);const Ga=Ie(Za(),(e=>{e.addCase(Lt,((e,t)=>eo(e,t.payload)?void 0:t.payload))})),eo=(e,t)=>to(e.context,t.context)&&uo(e.advancedSearchQueries,t.advancedSearchQueries)&&ro(e.facetSet,t.facetSet)&&no(e.dateFacetSet,t.dateFacetSet)&&io(e.numericFacetSet,t.numericFacetSet)&&ao(e.categoryFacetSet,t.categoryFacetSet)&&oo(e.facetOptions,t.facetOptions)&&so(e.pagination,t.pagination)&&co(e.query,t.query)&&lo(e,t)&&fo(e.pipeline,t.pipeline)&&po(e.searchHub,t.searchHub)&&ho(e.facetOrder,t.facetOrder)&&go(e.debug,t.debug),to=(e,t)=>JSON.stringify(e.contextValues)===JSON.stringify(t.contextValues),ro=(e,t)=>JSON.stringify(e)===JSON.stringify(t),no=(e,t)=>JSON.stringify(e)===JSON.stringify(t),io=(e,t)=>JSON.stringify(e)===JSON.stringify(t),ao=(e,t)=>JSON.stringify(e)===JSON.stringify(t),oo=(e,t)=>JSON.stringify(e)===JSON.stringify(t),so=(e,t)=>e.firstResult===t.firstResult&&e.numberOfResults===t.numberOfResults,co=(e,t)=>JSON.stringify(e)===JSON.stringify(t),uo=(e,t)=>JSON.stringify(e)===JSON.stringify(t),lo=(e,t)=>e.sortCriteria===t.sortCriteria,fo=(e,t)=>e===t,po=(e,t)=>e===t,ho=(e,t)=>{return n=t,(r=e).length===n.length&&-1===r.findIndex(((e,t)=>n[t]!==e));var r,n},go=(e,t)=>e===t;const yo=Ie({enableDidYouMean:!1,wasCorrectedTo:"",wasAutomaticallyCorrected:!1,queryCorrection:{correctedQuery:"",wordCorrections:[]}},(e=>{e.addCase(_n,(e=>{e.enableDidYouMean=!0})).addCase($n,(e=>{e.enableDidYouMean=!1})).addCase(ti.pending,(e=>{e.queryCorrection={correctedQuery:"",wordCorrections:[]},e.wasAutomaticallyCorrected=!1,e.wasCorrectedTo=""})).addCase(ti.fulfilled,((e,t)=>{e.queryCorrection=t.payload.response.queryCorrections[0]||{correctedQuery:"",wordCorrections:[]},e.wasAutomaticallyCorrected=t.payload.automaticallyCorrected})).addCase(Ln,((e,t)=>{e.wasCorrectedTo=t.payload}))}));function mo(e,t,r){const{facetId:n}=t;if(e[n])return;const i=function(e={}){return{...Oo,...e}}(t),a=r();e[n]={options:i,isLoading:!1,response:a}}function vo(e,t){const{facetId:r,...n}=t,i=e[r];i&&(i.options={...i.options,...n})}function bo(e,t){const r=e[t];r&&(r.isLoading=!0)}function wo(e,t){const r=e[t];r&&(r.isLoading=!1)}function So(e,t){const{facetId:r,response:n}=t,i=e[r];i&&(i.isLoading=!1,i.response=n)}const Oo={captions:{},numberOfValues:10,query:""};const Co=(e,t)=>{const r=ko(t,e).field;return{facetId:e,facetField:r,facetTitle:`${r}_${e}`}};function xo(e,t){const{facetId:r,facetValue:n}=e;return{...Co(r,t),facetValue:n}}function Io(e){return{facetSet:e.facetSet||{},categoryFacetSet:e.categoryFacetSet||{},dateFacetSet:e.dateFacetSet||{},numericFacetSet:e.numericFacetSet||{},search:e.search||{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],queryCorrections:[]},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[]}}}const qo=e=>{const t=[];return e.search.response.facets.forEach(((r,n)=>{r.values.forEach(((i,a)=>{if("selected"===i.state){const o=Po(e,r.facetId),s=jo(r,n+1),c=Ao(i,a+1,o),u="hierarchical"===o||"specific"===o?Ro(i):Eo(i);t.push({...s,...c,...u})}}))})),t},Ao=(e,t,r)=>({state:e.state,valuePosition:t,facetType:r}),Eo=e=>({displayValue:`${e.start}..${e.end}`,value:`${e.start}..${e.end}`,start:e.start,end:e.end,endInclusive:e.endInclusive}),Ro=e=>({displayValue:e.value,value:e.value}),jo=(e,t)=>({title:e.facetId,field:e.field,id:e.facetId,facetPosition:t}),ko=(e,t)=>e.facetSet[t]||e.categoryFacetSet[t]||e.dateFacetSet[t]||e.numericFacetSet[t],Po=(e,t)=>{const r=ko(e,t);return r?r.type:"specific"},To=e=>fn("analytics/facet/showMore",dn.Search,((t,r)=>{Ze(e,Ra);const n=Co(e,Io(r));return t.logFacetShowMore(n)}))(),Fo=e=>fn("analytics/facet/showLess",dn.Search,((t,r)=>{Ze(e,Ra);const n=Co(e,Io(r));return t.logFacetShowLess(n)}))(),Mo=e=>fn("analytics/facet/search",dn.Search,((t,r)=>{Ze(e,Ra);const n=Io(r),i=Co(e,n),a=qo(n);return t.logFacetSearch(i,a)}))(),Vo=e=>fn("analytics/facet/sortChange",dn.Search,((t,r)=>{Ze(e,{facetId:Ra,criterion:new Pe({required:!0})});const{facetId:n,criterion:i}=e,a=Io(r),o={...Co(n,a),criteria:i},s=qo(a);return t.logFacetUpdateSort(o,s)}))(),Do=e=>fn("analytics/facet/reset",dn.Search,((t,r)=>{Ze(e,Ra);const n=Io(r),i=Co(e,n),a=qo(n);return t.logFacetClearAll(i,a)}))(),_o=e=>fn("analytics/facet/select",dn.Search,((t,r)=>{Ze(e,{facetId:Ra,facetValue:Be});const n=Io(r),i=xo(e,n),a=qo(n);return t.logFacetSelect(i,a)}))(),$o=e=>fn("analytics/facet/deselect",dn.Search,((t,r)=>{Ze(e,{facetId:Ra,facetValue:Be});const n=Io(r),i=xo(e,n),a=qo(n);return t.logFacetDeselect(i,a)}))(),Lo=e=>{const t=[];let r=e.currentValues[0];for(;r;)t.push(r.value),r=r.children[0];return t},No=Re("facetSearch/executeSearch",(async(e,{dispatch:t,getState:r,extra:{searchAPIClient:n,validatePayload:i}})=>{const a=r();let o;i(e,Be),o=Uo(a,e)?((e,t)=>{const{captions:r,query:n,numberOfValues:i}=t.facetSearchSet[e].options,{field:a,delimitingCharacter:o,currentValues:s}=t.facetSet[e],c=oi(t),u=s.filter((e=>"idle"!==e.state)).map((e=>e.value));return{url:t.configuration.search.apiBaseUrl,accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,captions:r,numberOfValues:i,query:n,field:a,delimitingCharacter:o,ignoreValues:u,searchContext:c,type:"specific"}})(e,a):((e,t)=>{const r=t.categoryFacetSearchSet[e].options,n=t.categoryFacetSet[e],{captions:i,query:a,numberOfValues:o}=r,{field:s,delimitingCharacter:c,basePath:u}=n,l=oi(t),d=Lo(n),f=d.length?[d]:[];return{url:t.configuration.search.apiBaseUrl,accessToken:t.configuration.accessToken,organizationId:t.configuration.organizationId,basePath:u,captions:i,numberOfValues:o,query:a,field:s,delimitingCharacter:c,ignorePaths:f,searchContext:l,type:"hierarchical"}})(e,a);const s=await n.facetSearch(o);return t(Mo(e)),{facetId:e,response:s}})),Uo=(e,t)=>void 0!==e.facetSearchSet&&void 0!==e.facetSet&&void 0!==e.facetSet[t],zo=Ie({},(e=>{e.addCase(La,((e,t)=>{mo(e,t.payload,Ho)})).addCase(Na,((e,t)=>{vo(e,t.payload)})).addCase(No.pending,((e,t)=>{bo(e,t.meta.arg)})).addCase(No.rejected,((e,t)=>{wo(e,t.meta.arg)})).addCase(No.fulfilled,((e,t)=>{So(e,t.payload)}))}));function Ho(){return{moreValuesAvailable:!1,values:[]}}const Qo=new He({each:Be,required:!0}),Yo=xe("fields/registerFieldsToInclude",(e=>Ze(e,Qo))),Bo=Ie({fieldsToInclude:["author","language","urihash","objecttype","collection","source","permanentid"]},(e=>e.addCase(Yo,((e,t)=>{e.fieldsToInclude=[...new Set(e.fieldsToInclude.concat(t.payload))]})))),Wo=xe("pipeline/set",(e=>Ze(e,new Le({required:!0,emptyAllowed:!0})))),Jo=Ie("default",(e=>{e.addCase(Wo,((e,t)=>t.payload)).addCase(zt.fulfilled,((e,t)=>t.payload.pipeline)).addCase(it,((e,t)=>t.payload.pipeline||e))})),Ko=xe("rangeFacet/updateSortCriterion",(e=>Ze(e,{facetId:Ra,criterion:new Pe({required:!0})}))),Zo={state:Be,start:new Me({required:!0}),end:new Me({required:!0}),endInclusive:new De({required:!0}),numberOfResults:new Me({required:!0,min:0})},Xo={start:Be,end:Be,endInclusive:new De({required:!0}),state:Be,numberOfResults:new Me({required:!0,min:0})},Go={start:Be,end:Be,endInclusive:new De({required:!0}),state:Be},es={facetId:Ra,field:Be,currentValues:new He({required:!1,each:new Ue({values:Go})}),generateAutomaticRanges:new De({required:!0}),filterFacetCount:new De({required:!1}),injectionDepth:new Me({required:!1,min:0}),numberOfValues:new Me({required:!1,min:1}),sortCriteria:new Pe({required:!1})},ts=xe("dateFacet/register",(e=>Ze(e,es))),rs=xe("dateFacet/toggleSelectValue",(e=>Ze(e,{facetId:Ra,selection:new Ue({values:Xo})}))),ns=Ko,is=Fa,as={filterFacetCount:!0,injectionDepth:1e3,numberOfValues:8,sortCriteria:"ascending"};function os(e,t){const{facetId:r}=t;if(r in e)return;const n=function(e){const{generateAutomaticRanges:t,currentValues:r,numberOfValues:n}=e;return t?Math.max(n,r.length):r.length}(t);e[r]={...t,numberOfValues:n}}function ss(e,t,r){const n=e[t];if(!n)return;const i=ds(n.currentValues,r);if(!i)return;const a="selected"===i.state;i.state=a?"idle":"selected",n.preventAutoSelect=!0}function cs(e,t){const r=e[t];r&&r.currentValues.forEach((e=>e.state="idle"))}function us(e,t){Object.entries(e).forEach((([e,r])=>{const n=t[e]||[];r.currentValues.forEach((e=>{const t=!!ds(n,e);return e.state=t?"selected":"idle",e}));const i=n.filter((e=>!ds(r.currentValues,e))),a=r.currentValues;a.push(...i),r.numberOfValues=Math.max(r.numberOfValues,a.length)}))}function ls(e,t,r){t.forEach((t=>{const n=t.facetId,i=e[n];if(!i)return;const a=r(t.values);i.currentValues=a,i.preventAutoSelect=!1}))}function ds(e,t){const{start:r,end:n}=t;return e.find((e=>e.start===r&&e.end===n))}const fs=Ie({},(e=>{e.addCase(ts,((e,t)=>{const{payload:r}=t;var n;os(e,(n=r,{...as,currentValues:[],preventAutoSelect:!1,type:"dateRange",...n}))})).addCase(zt.fulfilled,((e,t)=>t.payload.dateFacetSet)).addCase(Wi,((e,t)=>{us(e,t.payload.df||{})})).addCase(rs,((e,t)=>{const{facetId:r,selection:n}=t.payload;ss(e,r,n)})).addCase(is,((e,t)=>{cs(e,t.payload)})).addCase(Ya,(e=>{Object.keys(e).forEach((t=>{cs(e,t)}))})).addCase(ns,((e,t)=>{za(e,t.payload)})).addCase(ti.fulfilled,((e,t)=>{ls(e,t.payload.response.facets,ps)}))}));function ps(e){return e.map((e=>{const{numberOfResults:t,...r}=e;return r}))}const hs={state:Be,start:new Me({required:!0}),end:new Me({required:!0}),endInclusive:new De({required:!0})},gs={facetId:Ra,field:Be,currentValues:new He({required:!1,each:new Ue({values:hs})}),generateAutomaticRanges:new De({required:!0}),filterFacetCount:new De({required:!1}),injectionDepth:new Me({required:!1,min:0}),numberOfValues:new Me({required:!1,min:1}),sortCriteria:new Pe({required:!1})},ys=xe("numericFacet/register",(e=>Ze(e,gs))),ms=xe("numericFacet/toggleSelectValue",(e=>Ze(e,{facetId:Ra,selection:new Ue({values:Zo})}))),vs=Ko,bs=Fa,ws=Ie({},(e=>{e.addCase(ys,((e,t)=>{const{payload:r}=t;var n;os(e,(n=r,{...as,currentValues:[],preventAutoSelect:!1,type:"numericalRange",...n}))})).addCase(zt.fulfilled,((e,t)=>t.payload.numericFacetSet)).addCase(Wi,((e,t)=>{us(e,t.payload.nf||{})})).addCase(ms,((e,t)=>{const{facetId:r,selection:n}=t.payload;ss(e,r,n)})).addCase(bs,((e,t)=>{cs(e,t.payload)})).addCase(Ya,(e=>{Object.keys(e).forEach((t=>{cs(e,t)}))})).addCase(vs,((e,t)=>{za(e,t.payload)})).addCase(ti.fulfilled,((e,t)=>{ls(e,t.payload.response.facets,Ss)}))}));function Ss(e){return e.map((e=>{const{numberOfResults:t,...r}=e;return r}))}const Os={state:new Pe({required:!0}),numberOfResults:new Me({required:!0,min:0}),value:new Le({required:!0,emptyAllowed:!0}),path:new He({required:!0,each:Be}),moreValuesAvailable:new De({required:!1})};function Cs(e){e.children.forEach((e=>{Cs(e)})),Ke({state:e.state,numberOfResults:e.numberOfResults,value:e.value,path:e.path,moreValuesAvailable:e.moreValuesAvailable},Os)}const xs={facetId:Ra,field:Be,delimitingCharacter:new Le({required:!1,emptyAllowed:!0}),filterFacetCount:new De({required:!1}),injectionDepth:new Me({required:!1,min:0}),numberOfValues:new Me({required:!1,min:1}),sortCriteria:new Pe({required:!1}),basePath:new He({required:!1,each:Be}),filterByBasePath:new De({required:!1})},Is=xe("categoryFacet/register",(e=>Ze(e,xs))),qs=xe("categoryFacet/toggleSelectValue",(e=>{try{return Ke(e.facetId,Be),Cs(e.selection),{payload:e,error:null}}catch(t){return{payload:e,error:Je(t)}}})),As=Fa,Es=Va,Rs=xe("categoryFacet/updateSortCriterion",(e=>Ze(e,{facetId:Ra,criterion:new Pe}))),js={path:new He({required:!0,each:Be}),displayValue:We,rawValue:We,count:new Me({required:!0,min:0})},ks=xe("categoryFacet/selectSearchResult",(e=>Ze(e,{facetId:Ra,value:new Ue({values:js}),retrieveCount:new Me({min:1})}))),Ps=xe("categoryFacetSearch/register",(e=>Ze(e,_a)));function Ts(e,t,r){e.currentValues=function(e,t){if(!e.length)return[];const r=Fs(e[0],t);let n=r;for(const r of e.splice(1)){const e=Fs(r,t);n.children.push(e),n=e}return n.state="selected",n.retrieveChildren=!0,[r]}(t,r),e.numberOfValues=t.length?1:e.numberOfValues,e.preventAutoSelect=!0}function Fs(e,t){return{value:e,retrieveCount:t,children:[],state:"idle",retrieveChildren:!1}}function Ms(e){if(!e)return{parents:[],values:[]};let t=[],r=e;for(;r.length&&r[0].children.length;)t=[...t,...r],r=r[0].children;const n=r.find((e=>"selected"===e.state));return n&&(t=[...t,n],r=[]),{parents:t,values:r}}const Vs=Ie({},(e=>{e.addCase(Is,((e,t)=>{const r=t.payload,{facetId:n}=r;var i;n in e||(e[n]=(i=r,{...Ds,currentValues:[],preventAutoSelect:!1,type:"hierarchical",...i}))})).addCase(zt.fulfilled,((e,t)=>t.payload.categoryFacetSet)).addCase(Wi,((e,t)=>{const r=t.payload.cf||{};Object.keys(e).forEach((t=>{const n=e[t];Ts(n,r[t]||[],n.numberOfValues)}))})).addCase(Rs,((e,t)=>{const{facetId:r,criterion:n}=t.payload,i=e[r];i&&(i.sortCriteria=n)})).addCase(qs,((e,t)=>{const{facetId:r,selection:n,retrieveCount:i}=t.payload,a=e[r];if(!a)return;let o=a.currentValues;const{path:s}=n,c=s.slice(0,s.length-1);for(const e of c){const t=o[0];if(e!==t.value)return;t.retrieveChildren=!1,t.state="idle",o=t.children}if(o.length){const e=o[0];return e.retrieveChildren=!0,e.state="selected",void(e.children=[])}const u=function(e,t){const{value:r}=e;return{value:r,state:"selected",children:[],retrieveChildren:!0,retrieveCount:t}}(n,i);o.push(u),a.numberOfValues=1})).addCase(As,((e,t)=>{Ha(e,t.payload)})).addCase(Ya,(e=>{Object.keys(e).forEach((t=>{Ha(e,t)}))})).addCase(Es,((e,t)=>{const{facetId:r}=t.payload,n=e[r];if(n)return n.currentValues.length?void function(e,t){var r;const{facetId:n,numberOfValues:i}=t;let a=null===(r=e[n])||void 0===r?void 0:r.currentValues[0];if(!a)return;for(;a.children.length&&"selected"!==(null==a?void 0:a.state);)a=a.children[0];a.retrieveCount=i}(e,t.payload):Qa(e,t.payload)})).addCase(ks,((e,t)=>{const{facetId:r,value:n,retrieveCount:i}=t.payload,a=e[r];if(!a)return;Ts(a,[...n.path,n.rawValue],i)})).addCase(ti.fulfilled,((e,t)=>{const{facets:r}=t.payload.response;r.forEach((t=>{if(!function(e,t){return t.facetId in e}(e,t))return;const r=t.facetId,n=e[r],i=function(e,t){const r=Ms(e.currentValues).parents,n=Ms(t.values).parents;return r.length!==n.length}(n,t);n.currentValues=i?[]:n.currentValues,n.preventAutoSelect=!1}))}))})),Ds={delimitingCharacter:";",filterFacetCount:!0,injectionDepth:1e3,numberOfValues:5,sortCriteria:"occurrences",basePath:[],filterByBasePath:!0};const _s=Ie({},(e=>{e.addCase(Ps,((e,t)=>{mo(e,t.payload,$s)})).addCase(Na,((e,t)=>{vo(e,t.payload)})).addCase(No.pending,((e,t)=>{bo(e,t.meta.arg)})).addCase(No.rejected,((e,t)=>{wo(e,t.meta.arg)})).addCase(No.fulfilled,((e,t)=>{So(e,t.payload)}))}));function $s(){return{moreValuesAvailable:!1,values:[]}}const Ls=xe("facetOptions/update",(e=>Ze(e,{freezeFacetOrder:new De({required:!1})}))),Ns=Ie({freezeFacetOrder:!1},(e=>{e.addCase(Ls,((e,t)=>({...e,...t.payload}))).addCase(ti.fulfilled,(e=>{e.freezeFacetOrder=!1})).addCase(ti.rejected,(e=>{e.freezeFacetOrder=!1})).addCase(zt.fulfilled,((e,t)=>t.payload.facetOptions))})),Us=xe("advancedSearchQueries/update",(e=>Ze(e,{aq:new Le({required:!1,emptyAllowed:!0}),cq:new Le({required:!1,emptyAllowed:!0})}))),zs=Ie({cq:"",aq:""},(e=>{e.addCase(Us,((e,t)=>{Te(t.payload.aq)||(e.aq=t.payload.aq),Te(t.payload.cq)||(e.cq=t.payload.cq)})).addCase(zt.fulfilled,((e,t)=>t.payload.advancedSearchQueries)).addCase(Wi,((e,t)=>{var r,n;e.aq=null!==(r=t.payload.aq)&&void 0!==r?r:e.aq,e.cq=null!==(n=t.payload.cq)&&void 0!==n?n:e.cq}))})),Hs=xe("debug/enable"),Qs=xe("debug/disable"),Ys=Ie(!1,(e=>{e.addCase(Hs,(()=>!0)).addCase(Qs,(()=>!1)).addCase(Wi,((e,t)=>{var r;return null!==(r=t.payload.debug)&&void 0!==r?r:e}))})),Bs={configuration:jt,facetSet:Ba,dateFacetSet:fs,facetOrder:Ie([],(e=>{e.addCase(ti.fulfilled,((e,t)=>t.payload.response.facets.map((e=>e.facetId)))),e.addCase(zt.fulfilled,((e,t)=>t.payload.facetOrder))})),numericFacetSet:ws,categoryFacetSet:Vs,facetSearchSet:zo,facetOptions:Ns,categoryFacetSearchSet:_s,query:Ji,advancedSearchQueries:zs,querySet:oa,pagination:ba,redirection:ta,querySuggest:aa,search:da,sortCriteria:Ea,context:Ht,history:((e,t)=>{const r=_t(t);return(t=r,n)=>{switch(n.type){case Vt:return(e=>{const{past:t,present:r,future:n}=e;if(0===t.length)return e;const i=t[t.length-1];return{past:t.slice(0,t.length-1),present:i,future:[r,...n]}})(t);case Dt:return(e=>{const{past:t,present:r,future:n}=e;return 0===n.length?e:{past:[...t,r],present:n[0],future:n.slice(1)}})(t);default:return((e,t,r,n)=>{const{past:i,present:a}=e,o=r(a,n);return o===t.present||a===o?e:a===t.present?_t(o):{past:[...i,a],present:o,future:[]}})(t,r,e,n)}}})(Ga,Za()),didYouMean:yo,fields:Bo,pipeline:Jo,searchHub:jn,debug:Ys},Ws={configuration:jt,advancedSearchQueries:zs,fields:Bo,context:Ht,pipeline:Jo,searchHub:jn,debug:Ys,recommendation:Ie({duration:0,error:null,isLoading:!1,id:"Recommendation",recommendations:[]},(e=>{e.addCase(Tn,((e,t)=>{e.id=t.payload.id})).addCase(Fn.rejected,((e,t)=>{e.error=t.payload?t.payload:null,e.isLoading=!1})).addCase(Fn.fulfilled,((e,t)=>{e.error=null,e.recommendations=t.payload.recommendations,e.duration=t.payload.duration,e.isLoading=!1})).addCase(Fn.pending,(e=>{e.isLoading=!0}))}))};function Js(e){let t="{}";return{subscribe(r){return r(),e.subscribe((()=>{(e=>{try{const r=JSON.stringify(e),n=t!==r;return t=r,n}catch(e){return console.warn('Could not detect if state has changed, check the controller "get state method"',e),!0}})(this.state)&&r()}))},get state(){return{}}}}const Ks=e=>{const t=/^(\w+(?:\s\w+)*): ([-0-9]+)$/;if(!e)return null;const r=e.match(/(\w+(?:\s\w+)*): ([-0-9]+)/g);if(!r)return null;const n={};for(const e of r){const r=e.match(t);if(r){const e=r[1],t=r[2];n[e]=Number(t)}}return n},Zs=(e,t)=>{const r=[];let n;for(;null!==(n=t.exec(e));)r.push(n);return r},Xs=e=>{const t=/([^:]+): ([0-9]+), ([0-9]+); /g;if(!e||!e[1])return null;const r=Zs(e[1],/((?:[^:]+: [0-9]+, [0-9]+; )+)\n((?:\w+: [0-9]+; )+)/g);if(!r)return null;const n={};for(const e of r){const r=Zs(e[1],t),i={};for(const e of r)i[e[1]]={Correlation:Number(e[2]),"TF-IDF":Number(e[3])};const a=Ks(e[2]);n[Object.keys(i).join(", ")]={terms:i,Weights:a}}return n},Gs=e=>{const t=/(Expression:\s".*")\sScore:\s(?!0)([0-9]+)\n+/g;let r=t.exec(e);const n=[];for(;r;)n.push({expression:r[1],score:parseInt(r[2],10)}),r=t.exec(e);return n};function ec(e){return e.search.response.results.map((e=>({result:e,ranking:(e=>{if(!e)return null;const t=/Document weights:\n((?:.)*?)\n+/g.exec(e),r=/Terms weights:\n((?:.|\n)*)\n+/g.exec(e),n=/Total weight: ([0-9]+)/g.exec(e),i=Gs(e);return{documentWeights:Ks(t?t[1]:null),termsWeight:Xs(r),totalWeight:n?Number(n[1]):null,qreWeights:i}})(e.rankingInfo)})))}const tc=new ke({enabled:new De({default:!1})}),rc=new ke({automaticallyLogInformation:new De({default:!0})});function nc(e,t={}){let r="";const n=Js(e),{dispatch:i}=e,a=Xe(e,tc,t.initialState,nc.name),o=Ge(e,rc,t.options,nc.name);let s=!1;return a.enabled&&i(Hs()),{...n,get state(){const t=e.state.debug;if(!e.state.debug)return{isEnabled:t};const{executionReport:r,basicExpression:n,advancedExpression:i,constantExpression:a,userIdentities:o,rankingExpressions:s}=e.state.search.response;return{isEnabled:t,rankingInformation:ec(e.state),executionReport:r,expressions:{basicExpression:n,advancedExpression:i,constantExpression:a},userIdentities:o,rankingExpressions:s}},enable(){i(Hs())},disable(){i(Qs())},logInformation(){var t;this.state.isEnabled?e.logger.info(this.state,"Relevance inspector information for new query"):(e.logger.warn('Relevance inspector "logInformation" has been called without debug being enabled. Enabling debug and triggering a query'),s=!0,this.enable(),i(ti((t=dn.Search,Re("analytics/noop",(async()=>({analyticsType:t}))))())))},subscribe(t){return t(),e.subscribe((()=>{(e=>{const t=e!==r;return r=e,t})(e.state.search.response.searchUid)&&(this.state.isEnabled&&(o.automaticallyLogInformation||s)&&(s=!1,this.logInformation()),t())}))}}}const ic=e=>{const t=Js(e),{dispatch:r}=e;return{...t,get state(){return{values:e.state.context.contextValues}},set(e){r(Tt(e))},add(e,t){r(Ft({contextKey:e,contextValue:t}))},remove(e){r(Mt(e))}}},ac=e=>{const t=Js(e),{dispatch:r}=e;return r(_n()),{...t,get state(){const t=e.state;return{wasCorrectedTo:t.didYouMean.wasCorrectedTo,wasAutomaticallyCorrected:t.didYouMean.wasAutomaticallyCorrected,queryCorrection:t.didYouMean.queryCorrection,hasQueryCorrection:""!==t.didYouMean.queryCorrection.correctedQuery||""!==t.didYouMean.wasCorrectedTo}},applyCorrection(){r(Ln(this.state.queryCorrection.correctedQuery)),r(ti(Vn()))}}},oc=(e,t)=>e.search.response.facets.find((e=>e.facetId===t)),sc=(e,t)=>e.facetSet[t];const cc=(e,t)=>{const r=oc(e,t);if(function(e,t){return!!t&&t.facetId in e.facetSet}(e,r))return r},uc=(e,t)=>{const r=cc(e,t);return r?r.values.filter((e=>"selected"===e.state)):[]};const lc=(e,t)=>{const r=oc(e,t);if(function(e,t){return!!t&&t.facetId in e.categoryFacetSet}(e,r))return r},dc=(e,t)=>{const r=lc(e,t);return Ms(null==r?void 0:r.values).parents};function fc(e,t){const r=e.dispatch,{options:n,getFacetSearch:i}=t,a=n.facetId,o=n.numberOfValues||10;return{updateText(e){r(Na({facetId:a,query:`*${e}*`,numberOfValues:o}))},showMoreResults(){const{numberOfValues:e}=i().options;r(Na({facetId:a,numberOfValues:e+o})),r(No(a))},search(){r(No(a))},select(e){const t=e.rawValue;r(Ls({freezeFacetOrder:!0})),r(ti(_o({facetId:a,facetValue:t})))},get state(){const{response:e,isLoading:t}=i(),r=e.values;return{...e,values:r,isLoading:t}}}}const pc=Re("categoryFacetController/executeToggleSelect",(({facetId:e,selection:t,retrieveCount:r},{dispatch:n,extra:{validatePayload:i}})=>{i(e,Be),Cs(t);const a=((e,t)=>{const r={facetId:e,facetValue:t.value};return"selected"===t.state?$o(r):_o(r)})(e,t);n(qs({facetId:e,selection:t,retrieveCount:r})),n(Ls({freezeFacetOrder:!0})),n(ti(a))})),hc=Re("categoryFacetController/executeDeselectAll",(({facetId:e,numberOfValues:t},{dispatch:r,extra:{validatePayload:n}})=>{n({facetId:e,numberOfValues:t},{facetId:Ra,numberOfValues:new Me({required:!0})}),r(As(e)),r(Es({facetId:e,numberOfValues:t})),r(Ls({freezeFacetOrder:!0})),r(ti(Do(e)))})),gc=new Le({regex:/^[a-zA-Z0-9-_]+$/}),yc=new Le({required:!0}),mc=new He({each:new Le}),vc=new Le,bc=new De,wc=new De,Sc=new Me({min:0}),Oc=new Me({min:1}),Cc=new De({required:!0}),xc=new Ue,Ic=new Le,qc=new Ue({values:{captions:xc,numberOfValues:Oc,query:Ic}}),Ac=new ke({facetId:gc,field:yc,basePath:mc,delimitingCharacter:vc,filterByBasePath:bc,filterFacetCount:wc,injectionDepth:Sc,numberOfValues:Oc,sortCriteria:new Le({constrainTo:["alphanumeric","occurrences"]}),facetSearch:qc});function Ec(e,t){const{field:r,state:n}=e;if(!function(e){const{field:t,state:r}=e;return Rc(r).some((e=>e&&t in e))}(e))return r;const i=r+"_",a=function(e,t){const r=Rc(t);return function(e,t){const r=0,n=e.map((e=>{const n=e.split(t)[1],i=parseInt(n,10);return Number.isNaN(i)?r:i})).sort().pop();return null!=n?n:r}(r.map((e=>Object.keys(e||{}))).reduce(((e,t)=>e.concat(t)),[]),e)+1}(i,n);return function(e,t){const r=`A facet with field "${e}" already exists.\n To avoid unexpected behaviour, configure the #id option on the facet controller.`;t.warn(r)}(r,t),`${i}${a}`}function Rc(e){const{facetSet:t,numericFacetSet:r,dateFacetSet:n,categoryFacetSet:i}=e;return[t,r,n,i]}function jc(e,t){const{state:r,logger:n}=e,{field:i,facetId:a}=t;return a||Ec({field:i,state:r},n)}function kc(e,t){const r=Js(e),{dispatch:n}=e,i=jc(e,t.options),a={...Ds,...t.options,facetId:i};Ge(e,Ac,a,kc.name);const o=()=>((e,t)=>e.categoryFacetSet[t])(e.state,i);n(Is(a));const s=(()=>{const{facetSearch:r}=t.options,n={facetId:i,...r};return function(e,t){const{dispatch:r}=e,n={...Oo,...t.options},{facetId:i}=n;r(Ps(n));const a=fc(e,{options:n,getFacetSearch:()=>e.state.categoryFacetSearchSet[i]});return{...a,select(e){r(ks({facetId:i,value:e,retrieveCount:n.numberOfValues})),a.select(e)},get state(){return a.state}}}(e,{options:n})})(),{state:c,...u}=s;return{...r,facetSearch:u,toggleSelect:e=>n(pc({facetId:i,selection:e,retrieveCount:a.numberOfValues})),deselectAll:()=>n(hc({facetId:i,numberOfValues:a.numberOfValues})),sortBy(e){const t=a.facetId;n(Rs({facetId:t,criterion:e})),n(Ls({freezeFacetOrder:!0})),n(ti(Vo({facetId:t,criterion:e})))},isSortedBy:e=>o().sortCriteria===e,showMoreValues(){const{facetId:e,numberOfValues:t}=a,{values:r}=this.state,i=r.length+t;n(Es({facetId:e,numberOfValues:i})),n(Ls({freezeFacetOrder:!0})),n(ti(To(e)))},showLessValues(){const{facetId:e,numberOfValues:t}=a;n(Es({facetId:e,numberOfValues:t})),n(Ls({freezeFacetOrder:!0})),n(ti(Fo(e)))},get state(){const t=o(),r=lc(e.state,i),{parents:n,values:c}=Ms(null==r?void 0:r.values),u=e.state.search.isLoading,l=0!==n.length,d=n.length>0?n[n.length-1].moreValuesAvailable:(null==r?void 0:r.moreValuesAvailable)||!1,f=c.length>a.numberOfValues;return{facetId:i,parents:n,values:c,isLoading:u,hasActiveValues:l,canShowMoreValues:d,canShowLessValues:f,sortCriteria:t.sortCriteria,facetSearch:s.state}}}}const Pc=e=>"selected"===e.state,Tc=Re("facet/executeToggleSelect",(({facetId:e,selection:t},{dispatch:r,extra:{validatePayload:n}})=>{const i=((e,t)=>{const r={facetId:e,facetValue:t.value};return Pc(t)?$o(r):_o(r)})(e,t);n({facetId:e,selection:t},{facetId:Ra,selection:new Ue({values:ja})}),r(Ta({facetId:e,selection:t})),r(Ls({freezeFacetOrder:!0})),r(ti(i))})),Fc=new ke({facetId:gc,field:yc,delimitingCharacter:vc,filterFacetCount:wc,injectionDepth:Sc,numberOfValues:Oc,sortCriteria:new Le({constrainTo:["score","alphanumeric","occurrences","automatic"]}),facetSearch:qc});function Mc(e,t){const{dispatch:r}=e,n=Js(e),i=jc(e,t.options),a={facetSearch:{...Oo},...Wa,...t.options,facetId:i};Ge(e,Fc,a,Mc.name);const o=()=>sc(e.state,i),s=()=>{const{currentValues:e}=o(),t=a.numberOfValues,r=!!e.find((e=>"idle"===e.state));return t<e.length&&r};r(Pa(a));const c=(()=>{const{facetId:t,facetSearch:r}=a,n={facetId:t,...r};return function(e,t){const{dispatch:r}=e,{options:n}=t,{facetId:i}=n;r(La(n));const a=fc(e,{options:n,getFacetSearch:()=>e.state.facetSearchSet[i]});return{...a,select(e){r(Ua({facetId:i,value:e})),a.select(e)},get state(){return a.state}}}(e,{options:n})})(),{state:u,...l}=c;return{...n,facetSearch:l,toggleSelect:e=>r(Tc({facetId:a.facetId,selection:e})),isValueSelected:Pc,deselectAll(){r(Fa(i)),r(Ls({freezeFacetOrder:!0})),r(ti(Do(i)))},sortBy(e){r(Ma({facetId:i,criterion:e})),r(Ls({freezeFacetOrder:!0})),r(ti(Vo({facetId:i,criterion:e})))},isSortedBy(e){return this.state.sortCriterion===e},showMoreValues(){const e=o().numberOfValues,t=a.numberOfValues;r(Va({facetId:i,numberOfValues:e+(t-e%t)})),r(Da({facetId:i,isFieldExpanded:!0})),r(Ls({freezeFacetOrder:!0})),r(ti(To(i)))},showLessValues(){const e=a.numberOfValues,t=Math.max(e,(()=>{const{currentValues:e}=o();return e.filter((e=>"idle"!==e.state)).length})());r(Va({facetId:i,numberOfValues:t})),r(Da({facetId:i,isFieldExpanded:!1})),r(Ls({freezeFacetOrder:!0})),r(ti(Fo(i)))},get state(){const t=o(),r=cc(e.state,i),n=e.state.search.isLoading,a=t.sortCriteria,u=r?r.values:[],l=u.some((e=>"idle"!==e.state)),d=!!r&&r.moreValuesAvailable;return{facetId:i,values:u,sortCriterion:a,isLoading:n,hasActiveValues:l,canShowMoreValues:d,canShowLessValues:s(),facetSearch:c.state}}}}const Vc=e=>"selected"===e.state,Dc=Re("rangeFacet/executeToggleSelect",(({facetId:e,selection:t},{dispatch:r,extra:{validatePayload:n}})=>{n({facetId:e,selection:t},{facetId:Ra,selection:_c(t)});const i=((e,t)=>{const{start:r,end:n}=t,i={facetId:e,facetValue:`${r}..${n}`};return Vc(t)?$o(i):_o(i)})(e,t);r(Ls({freezeFacetOrder:!0})),r(ti(i))})),_c=e=>"string"==typeof e.start?new Ue({values:Xo}):new Ue({values:Zo});function $c(e,t){const{facetId:r,getRequest:n}=t,i=Js(e),a=e.dispatch;return{...i,toggleSelect:e=>a(Dc({facetId:r,selection:e})),isValueSelected:Vc,deselectAll(){a(Fa(r)),a(Ls({freezeFacetOrder:!0})),a(ti(Do(r)))},sortBy(e){a(Ko({facetId:r,criterion:e})),a(Ls({freezeFacetOrder:!0})),a(ti(Vo({facetId:r,criterion:e})))},isSortedBy(e){return this.state.sortCriterion===e},get state(){const t=n(),i=oc(e.state,r),a=t.sortCriteria,o=i?i.values:[],s=e.state.search.isLoading,c=o.some((e=>"idle"!==e.state));return{facetId:r,values:o,sortCriterion:a,hasActiveValues:c,isLoading:s}}}}const Lc=Re("dateFacet/executeToggleSelect",(({facetId:e,selection:t},{dispatch:r,extra:{validatePayload:n}})=>{n({facetId:e,selection:t},{facetId:Ra,selection:new Ue({values:Xo})}),r(rs({facetId:e,selection:t})),r(Dc({facetId:e,selection:t}))})),Nc=["idle","selected"],Uc=["ascending","descending"],zc={start:new Le,end:new Le,endInclusive:new De,state:new Le({constrainTo:Nc})},Hc=new ke({facetId:gc,field:yc,generateAutomaticRanges:Cc,filterFacetCount:wc,injectionDepth:Sc,numberOfValues:Oc,currentValues:new He({each:new Ue({values:zc})}),sortCriteria:new Le({constrainTo:Uc})});var Qc=ht((function(e,t){e.exports=function(){var e="millisecond",t="second",r="minute",n="hour",i="day",a="week",o="month",s="quarter",c="year",u="date",l=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[^0-9]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?.?(\d+)?$/,d=/\[([^\]]+)]|Y{2,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,f={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},p=function(e,t,r){var n=String(e);return!n||n.length>=t?e:""+Array(t+1-n.length).join(r)+e},h={s:p,z:function(e){var t=-e.utcOffset(),r=Math.abs(t),n=Math.floor(r/60),i=r%60;return(t<=0?"+":"-")+p(n,2,"0")+":"+p(i,2,"0")},m:function e(t,r){if(t.date()<r.date())return-e(r,t);var n=12*(r.year()-t.year())+(r.month()-t.month()),i=t.clone().add(n,o),a=r-i<0,s=t.clone().add(n+(a?-1:1),o);return+(-(n+(r-i)/(a?i-s:s-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(l){return{M:o,y:c,w:a,d:i,D:u,h:n,m:r,s:t,ms:e,Q:s}[l]||String(l||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},g="en",y={};y[g]=f;var m=function(e){return e instanceof S},v=function(e,t,r){var n;if(!e)return g;if("string"==typeof e)y[e]&&(n=e),t&&(y[e]=t,n=e);else{var i=e.name;y[i]=e,n=i}return!r&&n&&(g=n),n||!r&&g},b=function(e,t){if(m(e))return e.clone();var r="object"==typeof t?t:{};return r.date=e,r.args=arguments,new S(r)},w=h;w.l=v,w.i=m,w.w=function(e,t){return b(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var S=function(){function f(e){this.$L=v(e.locale,null,!0),this.parse(e)}var p=f.prototype;return p.parse=function(e){this.$d=function(e){var t=e.date,r=e.utc;if(null===t)return new Date(NaN);if(w.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var n=t.match(l);if(n){var i=n[2]-1||0,a=(n[7]||"0").substring(0,3);return r?new Date(Date.UTC(n[1],i,n[3]||1,n[4]||0,n[5]||0,n[6]||0,a)):new Date(n[1],i,n[3]||1,n[4]||0,n[5]||0,n[6]||0,a)}}return new Date(t)}(e),this.$x=e.x||{},this.init()},p.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},p.$utils=function(){return w},p.isValid=function(){return!("Invalid Date"===this.$d.toString())},p.isSame=function(e,t){var r=b(e);return this.startOf(t)<=r&&r<=this.endOf(t)},p.isAfter=function(e,t){return b(e)<this.startOf(t)},p.isBefore=function(e,t){return this.endOf(t)<b(e)},p.$g=function(e,t,r){return w.u(e)?this[t]:this.set(r,e)},p.unix=function(){return Math.floor(this.valueOf()/1e3)},p.valueOf=function(){return this.$d.getTime()},p.startOf=function(e,s){var l=this,d=!!w.u(s)||s,f=w.p(e),p=function(e,t){var r=w.w(l.$u?Date.UTC(l.$y,t,e):new Date(l.$y,t,e),l);return d?r:r.endOf(i)},h=function(e,t){return w.w(l.toDate()[e].apply(l.toDate("s"),(d?[0,0,0,0]:[23,59,59,999]).slice(t)),l)},g=this.$W,y=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case c:return d?p(1,0):p(31,11);case o:return d?p(1,y):p(0,y+1);case a:var b=this.$locale().weekStart||0,S=(g<b?g+7:g)-b;return p(d?m-S:m+(6-S),y);case i:case u:return h(v+"Hours",0);case n:return h(v+"Minutes",1);case r:return h(v+"Seconds",2);case t:return h(v+"Milliseconds",3);default:return this.clone()}},p.endOf=function(e){return this.startOf(e,!1)},p.$set=function(a,s){var l,d=w.p(a),f="set"+(this.$u?"UTC":""),p=(l={},l[i]=f+"Date",l[u]=f+"Date",l[o]=f+"Month",l[c]=f+"FullYear",l[n]=f+"Hours",l[r]=f+"Minutes",l[t]=f+"Seconds",l[e]=f+"Milliseconds",l)[d],h=d===i?this.$D+(s-this.$W):s;if(d===o||d===c){var g=this.clone().set(u,1);g.$d[p](h),g.init(),this.$d=g.set(u,Math.min(this.$D,g.daysInMonth())).$d}else p&&this.$d[p](h);return this.init(),this},p.set=function(e,t){return this.clone().$set(e,t)},p.get=function(e){return this[w.p(e)]()},p.add=function(e,s){var u,l=this;e=Number(e);var d=w.p(s),f=function(t){var r=b(l);return w.w(r.date(r.date()+Math.round(t*e)),l)};if(d===o)return this.set(o,this.$M+e);if(d===c)return this.set(c,this.$y+e);if(d===i)return f(1);if(d===a)return f(7);var p=(u={},u[r]=6e4,u[n]=36e5,u[t]=1e3,u)[d]||1,h=this.$d.getTime()+e*p;return w.w(h,this)},p.subtract=function(e,t){return this.add(-1*e,t)},p.format=function(e){var t=this;if(!this.isValid())return"Invalid Date";var r=e||"YYYY-MM-DDTHH:mm:ssZ",n=w.z(this),i=this.$locale(),a=this.$H,o=this.$m,s=this.$M,c=i.weekdays,u=i.months,l=function(e,n,i,a){return e&&(e[n]||e(t,r))||i[n].substr(0,a)},f=function(e){return w.s(a%12||12,e,"0")},p=i.meridiem||function(e,t,r){var n=e<12?"AM":"PM";return r?n.toLowerCase():n},h={YY:String(this.$y).slice(-2),YYYY:this.$y,M:s+1,MM:w.s(s+1,2,"0"),MMM:l(i.monthsShort,s,u,3),MMMM:l(u,s),D:this.$D,DD:w.s(this.$D,2,"0"),d:String(this.$W),dd:l(i.weekdaysMin,this.$W,c,2),ddd:l(i.weekdaysShort,this.$W,c,3),dddd:c[this.$W],H:String(a),HH:w.s(a,2,"0"),h:f(1),hh:f(2),a:p(a,o,!0),A:p(a,o,!1),m:String(o),mm:w.s(o,2,"0"),s:String(this.$s),ss:w.s(this.$s,2,"0"),SSS:w.s(this.$ms,3,"0"),Z:n};return r.replace(d,(function(e,t){return t||h[e]||n.replace(":","")}))},p.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},p.diff=function(e,u,l){var d,f=w.p(u),p=b(e),h=6e4*(p.utcOffset()-this.utcOffset()),g=this-p,y=w.m(this,p);return y=(d={},d[c]=y/12,d[o]=y,d[s]=y/3,d[a]=(g-h)/6048e5,d[i]=(g-h)/864e5,d[n]=g/36e5,d[r]=g/6e4,d[t]=g/1e3,d)[f]||g,l?y:w.a(y)},p.daysInMonth=function(){return this.endOf(o).$D},p.$locale=function(){return y[this.$L]},p.locale=function(e,t){if(!e)return this.$L;var r=this.clone(),n=v(e,t,!0);return n&&(r.$L=n),r},p.clone=function(){return w.w(this.$d,this)},p.toDate=function(){return new Date(this.valueOf())},p.toJSON=function(){return this.isValid()?this.toISOString():null},p.toISOString=function(){return this.$d.toISOString()},p.toString=function(){return this.$d.toUTCString()},f}(),O=S.prototype;return b.prototype=O,[["$ms",e],["$s",t],["$m",r],["$H",n],["$W",i],["$M",o],["$y",c],["$D",u]].forEach((function(e){O[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),b.extend=function(e,t){return e(t,S,b),b},b.locale=v,b.isDayjs=m,b.unix=function(e){return b(1e3*e)},b.en=y[g],b.Ls=y,b.p={},b}()})),Yc=ht((function(e,t){e.exports=function(e,t,r){var n=t.prototype;r.utc=function(e){return new t({date:e,utc:!0,args:arguments})},n.utc=function(e){var t=r(this.toDate(),{locale:this.$L,utc:!0});return e?t.add(this.utcOffset(),"minute"):t},n.local=function(){return r(this.toDate(),{locale:this.$L,utc:!1})};var i=n.parse;n.parse=function(e){e.utc&&(this.$u=!0),this.$utils().u(e.$offset)||(this.$offset=e.$offset),i.call(this,e)};var a=n.init;n.init=function(){if(this.$u){var e=this.$d;this.$y=e.getUTCFullYear(),this.$M=e.getUTCMonth(),this.$D=e.getUTCDate(),this.$W=e.getUTCDay(),this.$H=e.getUTCHours(),this.$m=e.getUTCMinutes(),this.$s=e.getUTCSeconds(),this.$ms=e.getUTCMilliseconds()}else a.call(this)};var o=n.utcOffset;n.utcOffset=function(e,t){var r=this.$utils().u;if(r(e))return this.$u?0:r(this.$offset)?o.call(this):this.$offset;var n=Math.abs(e)<=16?60*e:e,i=this;if(t)return i.$offset=n,i.$u=0===e,i;if(0!==e){var a=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(i=this.local().add(n+a,"minute")).$offset=n,i.$x.$localOffset=a}else i=this.utc();return i};var s=n.format;n.format=function(e){var t=e||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return s.call(this,t)},n.valueOf=function(){var e=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||(new Date).getTimezoneOffset());return this.$d.valueOf()-6e4*e},n.isUTC=function(){return!!this.$u},n.toISOString=function(){return this.toDate().toISOString()},n.toString=function(){return this.toDate().toUTCString()};var c=n.toDate;n.toDate=function(e){return"s"===e&&this.$offset?r(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():c.call(this)};var u=n.diff;n.diff=function(e,t,n){if(this.$u===e.$u)return u.call(this,e,t,n);var i=this.local(),a=r(e).local();return u.call(i,a,t,n)}}})),Bc=ht((function(e,t){e.exports=function(){var e,t={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=function(e,r){return e.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(e,n,i){var a=i&&i.toUpperCase();return n||r[i]||t[i]||r[a].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(e,t,r){return t||r.slice(1)}))}))},n=/(\[[^[]*\])|([-:/.()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,i=/\d\d/,a=/\d\d?/,o=/\d*[^\s\d-:/()]+/,s=function(e){return function(t){this[e]=+t}},c=[/[+-]\d\d:?\d\d/,function(e){var t,r;(this.zone||(this.zone={})).offset=0==(r=60*(t=e.match(/([+-]|\d\d)/g))[1]+ +t[2])?0:"+"===t[0]?-r:r}],u=function(t){var r=e[t];return r&&(r.indexOf?r:r.s.concat(r.f))},l=function(t,r){var n,i=e.meridiem;if(i){for(var a=1;a<=24;a+=1)if(t.indexOf(i(a,0,r))>-1){n=a>12;break}}else n=t===(r?"pm":"PM");return n},d={A:[o,function(e){this.afternoon=l(e,!1)}],a:[o,function(e){this.afternoon=l(e,!0)}],S:[/\d/,function(e){this.milliseconds=100*+e}],SS:[i,function(e){this.milliseconds=10*+e}],SSS:[/\d{3}/,function(e){this.milliseconds=+e}],s:[a,s("seconds")],ss:[a,s("seconds")],m:[a,s("minutes")],mm:[a,s("minutes")],H:[a,s("hours")],h:[a,s("hours")],HH:[a,s("hours")],hh:[a,s("hours")],D:[a,s("day")],DD:[i,s("day")],Do:[o,function(t){var r=e.ordinal,n=t.match(/\d+/);if(this.day=n[0],r)for(var i=1;i<=31;i+=1)r(i).replace(/\[|\]/g,"")===t&&(this.day=i)}],M:[a,s("month")],MM:[i,s("month")],MMM:[o,function(e){var t=u("months"),r=(u("monthsShort")||t.map((function(e){return e.substr(0,3)}))).indexOf(e)+1;if(r<1)throw new Error;this.month=r%12||r}],MMMM:[o,function(e){var t=u("months").indexOf(e)+1;if(t<1)throw new Error;this.month=t%12||t}],Y:[/[+-]?\d+/,s("year")],YY:[i,function(e){e=+e,this.year=e+(e>68?1900:2e3)}],YYYY:[/\d{4}/,s("year")],Z:c,ZZ:c},f=function(t,i,a){try{var o=function(t){for(var i=(t=r(t,e&&e.formats)).match(n),a=i.length,o=0;o<a;o+=1){var s=i[o],c=d[s],u=c&&c[0],l=c&&c[1];i[o]=l?{regex:u,parser:l}:s.replace(/^\[|\]$/g,"")}return function(e){for(var t={},r=0,n=0;r<a;r+=1){var o=i[r];if("string"==typeof o)n+=o.length;else{var s=o.regex,c=o.parser,u=e.substr(n),l=s.exec(u)[0];c.call(t,l),e=e.replace(l,"")}}return function(e){var t=e.afternoon;if(void 0!==t){var r=e.hours;t?r<12&&(e.hours+=12):12===r&&(e.hours=0),delete e.afternoon}}(t),t}}(i)(t),s=o.year,c=o.month,u=o.day,l=o.hours,f=o.minutes,p=o.seconds,h=o.milliseconds,g=o.zone,y=new Date,m=u||(s||c?1:y.getDate()),v=s||y.getFullYear(),b=0;s&&!c||(b=c>0?c-1:y.getMonth());var w=l||0,S=f||0,O=p||0,C=h||0;return g?new Date(Date.UTC(v,b,m,w,S,O,C+60*g.offset*1e3)):a?new Date(Date.UTC(v,b,m,w,S,O,C)):new Date(v,b,m,w,S,O,C)}catch(e){return new Date("")}};return function(t,r,n){n.p.customParseFormat=!0;var i=r.prototype,a=i.parse;i.parse=function(t){var r=t.date,i=t.utc,o=t.args;this.$u=i;var s=o[1];if("string"==typeof s){var c=!0===o[2],u=!0===o[3],l=c||u,d=o[2];u&&(d=o[2]),c||(e=d?n.Ls[d]:this.$locale()),this.$d=f(r,s,i),this.init(),d&&!0!==d&&(this.$L=this.locale(d).$L),l&&r!==this.format(s)&&(this.$d=new Date("")),e=void 0}else if(s instanceof Array)for(var p=s.length,h=1;h<=p;h+=1){o[1]=s[h-1];var g=n.apply(this,o);if(g.isValid()){this.$d=g.$d,this.$L=g.$L,this.init();break}h===p&&(this.$d=new Date(""))}else a.call(this,t)}}}()}));function Wc(e){return Zc(Qc(e))===e}function Jc(e){var t,r;return{start:Kc(e.start,e),end:Kc(e.end,e),endInclusive:null!==(t=e.endInclusive)&&void 0!==t&&t,state:null!==(r=e.state)&&void 0!==r?r:"idle"}}function Kc(e,t){const{dateFormat:r,useLocalTime:n}=t,i=Qc(e,r);if(!i.isValid())throw new Error(`Could not parse the provided date "${e}".\n Please provide a dateFormat string in the configuration options.\n See https://day.js.org/docs/en/parse/string-format for more information.\n `);return Zc(n?i:i.utc())}function Zc(e){return e.format("YYYY/MM/DD@HH:mm:ss")}function Xc(e,t){const r=e.dispatch,n=jc(e,t.options),i={...t.options,facetId:n};Ge(e,Hc,i,Xc.name),r(ts(i));const a=$c(e,{facetId:n,getRequest:()=>e.state.dateFacetSet[n]});return{...a,toggleSelect:e=>r(Lc({facetId:n,selection:e})),get state(){return{...a.state,isLoading:e.state.search.isLoading}}}}Qc.extend(Yc),Qc.extend(Bc);const Gc=Re("numericFacet/executeToggleSelect",((e,{dispatch:t,extra:{validatePayload:r}})=>{r(e,{facetId:Ra,selection:new Ue({values:Zo})}),t(ms(e)),t(Dc(e))})),eu={start:new Me,end:new Me,endInclusive:new De,state:new Le({constrainTo:Nc})},tu=new ke({facetId:gc,field:yc,generateAutomaticRanges:Cc,filterFacetCount:wc,injectionDepth:Sc,numberOfValues:Oc,currentValues:new He({each:new Ue({values:eu})}),sortCriteria:new Le({constrainTo:Uc})});function ru(e){return{endInclusive:!1,state:"idle",...e}}function nu(e,t){const r=e.dispatch,n=jc(e,t.options),i={...t.options,facetId:n};Ge(e,tu,i,nu.name),r(ys(i));const a=$c(e,{facetId:n,getRequest:()=>e.state.numericFacetSet[n]});return{...a,toggleSelect:e=>r(Gc({facetId:n,selection:e})),get state(){return a.state}}}const iu=fn("history/analytics/forward",dn.Search,(e=>e.logSearchEvent("historyForward"))),au=fn("history/analytics/backward",dn.Search,(e=>e.logSearchEvent("historyBackward"))),ou=e=>{const t=Js(e),{dispatch:r}=e;return{...t,get state(){return e.state.history},async back(){await r(Nt()),r(ti(au()))},async forward(){await r(Ut()),r(ti(iu()))}}};function su(e){return e.pagination.numberOfResults}const cu=de((function(e){return e.pagination.firstResult}),su,Oa),uu=de((function(e){return e.pagination.totalCountFiltered}),su,Ca),lu=de(cu,uu,((e,t)=>t),((e,t,r)=>{let n=function(e,t){const r=t%2==0,n=Math.floor(t/2);return{start:e-n,end:e+(r?n-1:n)}}(e,r);return n=function(e){const t=Math.max(1-e.start,0),r=e.start+t,n=e.end+t;return{start:r,end:n}}(n),n=function(e,t){const r=Math.max(e.end-t,0),n=Math.max(e.start-r,1),i=e.end-r;return{start:n,end:i}}(n,t),function(e){const t=[];for(let r=e.start;r<=e.end;++r)t.push(r);return t}(n)}));const du=fn("analytics/pager/resize",dn.Search,((e,t)=>{var r;return e.logPagerResize({currentResultsPerPage:(null===(r=t.pagination)||void 0===r?void 0:r.numberOfResults)||10})})),fu=fn("analytics/pager/number",dn.Search,((e,t)=>e.logPagerNumber({pagerNumber:cu(t)}))),pu=fn("analytics/pager/next",dn.Search,((e,t)=>e.logPagerNext({pagerNumber:cu(t)}))),hu=fn("analytics/pager/previous",dn.Search,((e,t)=>e.logPagerPrevious({pagerNumber:cu(t)}))),gu=new ke({numberOfPages:new Me({default:5,min:0})}),yu=new ke({page:new Me({min:1})});function mu(e,t={}){const r=Js(e),{dispatch:n}=e,i=Ge(e,gu,t.options,mu.name),a=Xe(e,yu,t.initialState,mu.name).page;a&&n(ga(a));const o=()=>{const{numberOfPages:t}=i;return lu(e.state,t)};return{...r,get state(){const t=cu(e.state),r=uu(e.state),n=t>1&&r>0,i=t<r;return{currentPage:t,currentPages:o(),maxPage:r,hasPreviousPage:n,hasNextPage:i}},selectPage(e){n(ya(e)),n(ti(fu()))},nextPage(){n(ma()),n(ti(pu()))},previousPage(){n(va()),n(ti(hu()))},isCurrentPage(e){return e===this.state.currentPage}}}const vu=e=>({...Js(e),get state(){return{hasError:null!==e.state.search.error,error:e.state.search.error}}}),bu=e=>{const t=Js(e),r=()=>{const t=e.state.search.duration/1e3;return Math.round(100*(t+Number.EPSILON))/100};return{...t,get state(){const t=e.state;return{firstResult:t.pagination.firstResult+1,lastResult:t.pagination.firstResult+t.search.results.length,total:t.pagination.totalCountFiltered,query:t.search.queryExecuted,hasQuery:""!==t.search.queryExecuted,hasDuration:0!==t.search.duration,hasResults:0!==t.search.results.length,durationInMilliseconds:t.search.duration,durationInSeconds:r()}}}},wu=new ke({fieldsToInclude:new He({required:!1,each:new Le({required:!0,emptyAllowed:!1})})});function Su(e,t){const r=Js(e),{dispatch:n}=e,i=Ge(e,wu,null==t?void 0:t.options,Su.name);i.fieldsToInclude&&n(Yo(i.fieldsToInclude));let a=0,o=0;let s=!1;return{...r,get state(){const t=e.state;return{results:t.search.results,isLoading:t.search.isLoading}},fetchMoreResults:()=>{if(e.state.search.isLoading)return;if(Date.now()-a<200){if(o++,o>=5)return a=Date.now(),!s&&e.logger.error('The result list method "fetchMoreResults" execution prevented because it has been triggered consecutively 5 times, with little delay. Please verify the conditions under which the function is called.'),void(s=!0)}else o=0;s=!1,n(ri()).then((()=>a=Date.now()))}}}const Ou=new ke({numberOfResults:new Me({min:0})});function Cu(e,t={}){const r=Js(e),{dispatch:n}=e,i=Xe(e,Ou,t.initialState,Cu.name).numberOfResults;return void 0!==i&&n(pa(i)),{...r,get state(){return{numberOfResults:e.state.pagination.numberOfResults}},set(e){n(ha(e)),n(ti(du()))},isSetTo(e){return e===this.state.numberOfResults}}}const xu=fn("analytics/searchbox/submit",dn.Search,(e=>e.logSearchboxSubmit())),Iu={enableQuerySyntax:!1,numberOfSuggestions:5},qu={open:new Le,close:new Le},Au={id:Be,numberOfSuggestions:new Me({min:0}),enableQuerySyntax:new De,highlightOptions:new Ue({values:{notMatchDelimiters:new Ue({values:qu}),exactMatchDelimiters:new Ue({values:qu}),correctionDelimiters:new Ue({values:qu})}})},Eu=new ke(Au),Ru=({id:e,suggestion:t})=>fn("analytics/querySuggest",dn.Search,((r,n)=>{const i=n.querySuggest&&n.querySuggest[e];if(null!=i){const e=i.completions.map((e=>e.expression)),n={suggestionRanking:e.indexOf(t),partialQuery:i.q,partialQueries:i.partialQueries,suggestions:e};return r.logOmniboxAnalytics(n)}}))();function ju(e){return""===e}function ku(e,t){return(e=Tu(e)).replace(/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g,((e,r,n,i)=>r?Pu(r,t.notMatchDelimiters):n?Pu(n,t.exactMatchDelimiters):i?Pu(i,t.correctionDelimiters):e))}function Pu(e,t){return t?t.open+e+t.close:e}function Tu(e){return e.replace(/&/g,"&amp").replace(/</g,"&lt").replace(/>/g,"&gt").replace(/"/g,"&quot").replace(/`/g,"&#96").replace(/'/g,"&#x27")}var Fu=Object.freeze({__proto__:null,highlightString:function(e){if(ju(e.openingDelimiter)||ju(e.closingDelimiter))throw Error("delimiters should be a non-empty string");if(Fe(e.content)||ju(e.content))return e.content;const t=e.content.length;let r="",n=0;for(let i=0;i<e.highlights.length;i++){const a=e.highlights[i],o=a.offset,s=o+a.length;if(s>t)break;r+=e.content.slice(n,o),r+=e.openingDelimiter,r+=e.content.slice(o,s),r+=e.closingDelimiter,n=s}return n!==t&&(r+=e.content.slice(n)),r},getHighlightedSuggestion:ku,escape:Tu});function Mu(e,t={}){var r,n;const i=Js(e),{dispatch:a}=e,o=(null===(r=t.options)||void 0===r?void 0:r.id)||Xa("search_box"),s={id:o,highlightOptions:{...null===(n=t.options)||void 0===n?void 0:n.highlightOptions},...Iu,...t.options};Ge(e,Eu,s,Mu.name),a(na({id:o,query:""})),a(Li({id:o,q:e.state.query.q,count:s.numberOfSuggestions}));const c=()=>e.state.querySet[s.id],u=e=>{const{enableQuerySyntax:t}=s;a(Nn({q:c(),enableQuerySyntax:t})),a(ya(1)),a(ti(e))};return{...i,updateText(e){a(ia({id:o,query:e})),this.showSuggestions()},clear(){a(ia({id:o,query:""})),a(zi({id:o}))},hideSuggestions(){a(Hi({id:o}))},showSuggestions(){s.numberOfSuggestions&&a(Qi({id:o}))},selectSuggestion(e){a(Ui({id:o,expression:e})),u(Ru({id:o,suggestion:e}))},submit(){u(xu())},get state(){const t=e.state,r=function(e,t){if(!e)return[];return e.completions.map((e=>({highlightedValue:ku(e.highlighted,t),rawValue:e.expression})))}(t.querySuggest[s.id],s.highlightOptions);return{value:c(),suggestions:r,isLoading:t.search.isLoading}}}}const Vu=fn("analytics/sort/results",dn.Search,((e,t)=>e.logResultsSort({resultsSortBy:t.sortCriteria||Kn()}))),Du=new Ue({values:{by:new Ye({enum:zn,required:!0}),order:new Ye({enum:Un}),field:new Le}});function _u(e,t){if(!t)return;const r=new ke({criterion:new He({each:Du})}),n=function(e){if(!e.criterion)return[];return Qe(e.criterion)?e.criterion:[e.criterion]}(t),i={...t,criterion:n};Xe(e,r,i,$u.name)}function $u(e,t={}){var r;const n=Js(e),{dispatch:i}=e;_u(e,t.initialState);const a=null===(r=t.initialState)||void 0===r?void 0:r.criterion;return a&&i(Ia(a)),{...n,sortBy(e){i(qa(e)),i(ya(1)),i(ti(Vu()))},isSortedBy(e){return this.state.sortCriteria===Hn(e)},get state(){return{sortCriteria:e.state.sortCriteria}}}}const Lu=e=>Ze(e,{evt:Be,type:new Le({required:!1,emptyAllowed:!1})}),Nu=e=>fn("analytics/generic/search",dn.Search,(t=>{Lu(e);const{evt:r,meta:n}=e;return t.logSearchEvent(r,n)}))(),Uu=e=>fn("analytics/generic/click",dn.Click,((t,r)=>(vn(e.result),Lu(e),t.logClickEvent(e.evt,pn(e.result,r),hn(e.result)))))(),zu=e=>fn("analytics/generic/custom",dn.Custom,(t=>(Lu(e),t.logCustomEventWithType(e.evt,e.type,e.meta))))(),Hu=fn("analytics/interface/load",dn.Search,(e=>e.logInterfaceLoad())),Qu=fn("analytics/interface/change",dn.Search,((e,t)=>{var r;return e.logInterfaceChange({interfaceChangeTo:(null===(r=t.advancedSearchQueries)||void 0===r?void 0:r.cq)||""})})),Yu=new ke({expression:new Le}),Bu=new ke({isActive:new De});function Wu(e,t){const r=Js(e),{dispatch:n}=e,i=Ge(e,Yu,t.options,Wu.name);return Xe(e,Bu,t.initialState,Wu.name).isActive&&n(Us({cq:i.expression})),{...r,select(){n(Us({cq:i.expression})),n(ti(Qu()))},get state(){return{isActive:e.state.advancedSearchQueries.cq===i.expression}}}}function Ju(e){return{...Js(e),sort(e){return Gn(e,this.state.facetIds)},get state(){return{facetIds:e.state.search.response.facets.map((e=>e.facetId))}}}}const Ku=(e,t)=>{const r=((e,t)=>{const r=oc(e,t);if(function(e,t){return!!t&&t.facetId in e.numericFacetSet}(e,r))return r})(e,t);return r?r.values.filter((e=>"selected"===e.state)):[]};const Zu=(e,t)=>{const r=((e,t)=>{const r=oc(e,t);if(function(e,t){return!!t&&t.facetId in e.dateFacetSet}(e,r))return r})(e,t);return r?r.values.filter((e=>"selected"===e.state)):[]},Xu=()=>fn("analytics/facet/deselectAllFacets",dn.Search,(e=>e.logBreadcrumbResetAll()))(),Gu=e=>{const t=Js(e),{dispatch:r}=e;function n(t,n,i){return Object.keys(t).map((a=>{const o=i(e.state,a).map((e=>({value:e,deselect:()=>r(n({facetId:a,selection:e}))})));return{field:t[a].field,values:o}})).filter((e=>e.values.length))}function i(){return n(e.state.facetSet,Tc,uc)}function a(){return n(e.state.numericFacetSet,Gc,Ku)}function o(){return n(e.state.dateFacetSet,Lc,Zu)}function s(){return Object.keys(e.state.categoryFacetSet).map((t=>({field:e.state.categoryFacetSet[t].field,path:dc(e.state,t),deselect:()=>{r(hc({facetId:t,numberOfValues:5}))}}))).filter((e=>e.path.length))}return{...t,get state(){return{facetBreadcrumbs:i(),categoryFacetBreadcrumbs:s(),numericFacetBreadcrumbs:a(),dateFacetBreadcrumbs:o()}},hasBreadcrumbs:function(){return!![...i(),...a(),...o(),...s()].length},deselectAll:()=>{r(Ya()),r(ti(Xu()))}}},el=new ke({id:new Le({emptyAllowed:!0,required:!1,default:""})});function tl(e,t={}){const r=Js(e),{dispatch:n}=e,i=Ge(e,el,t.options,tl.name);return""!==i.id&&n(Tn({id:i.id})),{...r,refresh(){n(Fn())},get state(){const t=e.state;return{recommendations:t.recommendation.recommendations,error:t.recommendation.error,isLoading:t.recommendation.isLoading}}}}const rl=new ke({...Au,redirectionUrl:new Le({required:!0,emptyAllowed:!1,url:!0})});function nl(e,t){const{dispatch:r}=e,n=t.options.id||Xa("standalone_search_box"),i={id:n,highlightOptions:{...t.options.highlightOptions},...Iu,...t.options};Ge(e,rl,i,nl.name);const a=Mu(e,{options:i});return{...a,selectSuggestion(e){r(Ui({id:n,expression:e})),this.submit()},submit(){r(Nn({q:this.state.value,enableQuerySyntax:i.enableQuerySyntax})),r(Gi({defaultRedirectionUrl:i.redirectionUrl}))},get state(){const t=e.state;return{...a.state,redirectTo:t.redirection.redirectTo}}}}const il={skus:new He({required:!1,each:new Le({emptyAllowed:!1})}),maxNumberOfRecommendations:new Me({required:!1,max:50,min:1,default:5})},al=new ke({id:new Le({required:!0,emptyAllowed:!1}),...il}),ol=(e,t={})=>{const r=Js(e),{dispatch:n}=e,i=Ge(e,al,t.options,ol.name);return n(wn({id:i.id})),n(xn({number:i.maxNumberOfRecommendations})),i.skus&&n(Sn({skus:i.skus})),{...r,setSkus(e){n(Sn({skus:e}))},refresh(){n(In())},get state(){const{skus:t,maxNumberOfRecommendations:r,recommendations:n,error:i,isLoading:a}=e.state.productRecommendations;return{skus:t,maxNumberOfRecommendations:r,recommendations:n,error:i,isLoading:a}}}},sl=new ke({sku:new Le({required:!0,emptyAllowed:!1}),maxNumberOfRecommendations:il.maxNumberOfRecommendations}),cl=(e,t)=>{const r=Ge(e,sl,t.options,cl.name),n=ol(e,{...t,options:{maxNumberOfRecommendations:r.maxNumberOfRecommendations,skus:[r.sku],id:"frequentBought"}}),{setSkus:i,...a}=n;return{...a,setSku(e){i([e])},get state(){const{skus:e,...t}=n.state;return{...t,sku:e[0]}}}},ul=new ke({...il}),ll=(e,t)=>{const r=Ge(e,ul,t.options,ll.name);return ol(e,{...t,options:{...r,id:"cart"}})},dl=new ke({...il}),fl=(e,t)=>{const r=Ge(e,dl,t.options,fl.name);return ol(e,{...t,options:{...r,id:"frequentViewed"}})},pl=new ke({maxNumberOfRecommendations:il.maxNumberOfRecommendations}),hl=(e,t={})=>{const r=Ge(e,pl,t.options,hl.name),n=ol(e,{...t,options:{...r,id:"popularBought"}}),{setSkus:i,...a}=n;return{...a,get state(){const{skus:e,...t}=n.state;return{...t}}}},gl=new ke({maxNumberOfRecommendations:il.maxNumberOfRecommendations});function yl(e,t={}){const r=Ge(e,gl,t.options,yl.name),n=ol(e,{...t,options:{...r,id:"popularViewed"}}),{setSkus:i,...a}=n;return{...a,get state(){const{skus:e,...t}=n.state;return{...t}}}}const ml=new ke({maxNumberOfRecommendations:il.maxNumberOfRecommendations});function vl(e,t){const r=Ge(e,ml,t.options,vl.name),n=ol(e,{...t,options:{...r,id:"user"}}),{setSkus:i,...a}=n;return{...a,get state(){const{skus:e,...t}=n.state;return{...t}}}}const bl=new ke({parameters:new Ue({options:{required:!0},values:Bi})});function wl(e,t){const{dispatch:r}=e,n=Js(e);return Xe(e,bl,t.initialState,wl.name),r(Wi(t.initialState.parameters)),{...n,get state(){const t=e.state;return{parameters:{...Sl(t),...Ol(t),...Cl(t),...xl(t),...Il(t),...ql(t),...Al(t),...El(t),...Rl(t),...jl(t),...kl(t),...Tl(t)}}}}}function Sl(e){if(void 0===e.query)return{};const t=e.query.q;return""!==t?{q:t}:{}}function Ol(e){if(void 0===e.query)return{};const t=e.query.enableQuerySyntax;return!1!==t?{enableQuerySyntax:t}:{}}function Cl(e){if(void 0===e.advancedSearchQueries)return{};const t=e.advancedSearchQueries.aq;return""!==t?{aq:t}:{}}function xl(e){if(void 0===e.advancedSearchQueries)return{};const t=e.advancedSearchQueries.cq;return""!==t?{cq:t}:{}}function Il(e){if(void 0===e.pagination)return{};const t=e.pagination.firstResult;return 0!==t?{firstResult:t}:{}}function ql(e){if(void 0===e.pagination)return{};const t=e.pagination.numberOfResults;return 10!==t?{numberOfResults:t}:{}}function Al(e){if(void 0===e.sortCriteria)return{};const t=e.sortCriteria;return t!==Kn()?{sortCriteria:t}:{}}function El(e){if(void 0===e.facetSet)return{};const t=Object.entries(e.facetSet).map((([e,t])=>{const r=t.currentValues.filter((e=>"selected"===e.state)).map((e=>e.value));return r.length?{[e]:r}:{}})).reduce(((e,t)=>({...e,...t})),{});return Object.keys(t).length?{f:t}:{}}function Rl(e){if(void 0===e.categoryFacetSet)return{};const t=Object.entries(e.categoryFacetSet).map((([e,t])=>{const{parents:r}=Ms(t.currentValues),n=r.map((e=>e.value));return n.length?{[e]:n}:{}})).reduce(((e,t)=>({...e,...t})),{});return Object.keys(t).length?{cf:t}:{}}function jl(e){if(void 0===e.numericFacetSet)return{};const t=Object.entries(e.numericFacetSet).map((([e,t])=>{const r=Pl(t.currentValues);return r.length?{[e]:r}:{}})).reduce(((e,t)=>({...e,...t})),{});return Object.keys(t).length?{nf:t}:{}}function kl(e){if(void 0===e.dateFacetSet)return{};const t=Object.entries(e.dateFacetSet).map((([e,t])=>{const r=Pl(t.currentValues);return r.length?{[e]:r}:{}})).reduce(((e,t)=>({...e,...t})),{});return Object.keys(t).length?{df:t}:{}}function Pl(e){return e.filter((e=>"selected"===e.state))}function Tl(e){if(void 0===e.debug)return{};const t=e.debug;return!1!==t?{debug:t}:{}}const Fl=new ke({priority:new Me({required:!1,default:0,min:0}),fields:new He({required:!1,each:new Le({required:!0,emptyAllowed:!1})})});function Ml(e){const t=[];return{registerTemplates(...r){const n=[];try{(e=>{e.forEach((e=>{if(Fl.validate(e,"Check the arguments of registerTemplates"),!e.conditions.every((e=>e instanceof Function)))throw new je("Each result template conditions should be a function that takes a result as an argument and returns a boolean")}))})(r)}catch(t){return void e.logger.error(t,"Result template manager error")}r.forEach((e=>{const r={...e,priority:e.priority||0,fields:e.fields||[]};t.push(r),n.push(...r.fields)})),t.sort(((e,t)=>t.priority-e.priority)),n.length&&e.dispatch(Yo(n))},selectTemplate(e){const r=t.find((t=>t.conditions.every((t=>t(e)))));return r?r.content:null}}}const Vl=(e,t)=>t in e?e[t]:t in e.raw?e.raw[t]:null,Dl=e=>t=>e.every((e=>void 0!==t.raw[e])),_l=e=>t=>e.every((e=>void 0===t.raw[e])),$l=(e,t)=>r=>{const n=Nl(e,r);return t.some((e=>n.some((t=>(""+t).toLowerCase()===e.toLowerCase()))))},Ll=(e,t)=>r=>{const n=Nl(e,r);return t.every((e=>n.every((t=>(""+t).toLowerCase()!==e.toLowerCase()))))},Nl=(e,t)=>{const r=t.raw[e];return n=r,Array.isArray(n)?r:[r];var n};var Ul,zl,Hl,Ql,Yl,Bl,Wl,Jl,Kl,Zl,Xl,Gl,ed,td,rd,nd,id,ad,od,sd,cd;!function(e){e.updateAdvancedSearchQueries=Us}(Ul||(Ul={})),function(e){e.registerCategoryFacet=Is,e.toggleSelectCategoryFacetValue=qs,e.deselectAllCategoryFacetValues=As,e.updateCategoryFacetNumberOfValues=Es,e.updateCategoryFacetSortCriterion=Rs}(zl||(zl={})),function(e){e.updateBasicConfiguration=nt,e.updateSearchConfiguration=it,e.updateAnalyticsConfiguration=at,e.renewAccessToken=ot,e.disableAnalytics=st,e.enableAnalytics=ct,e.setOriginLevel2=ut,e.setOriginLevel3=lt}(Hl||(Hl={})),function(e){e.setContext=Tt,e.addContext=Ft,e.removeContext=Mt}(Ql||(Ql={})),function(e){e.registerDateFacet=ts,e.toggleSelectDateFacetValue=rs,e.updateDateFacetSortCriterion=ns,e.deselectAllDateFacetValues=is}(Yl||(Yl={})),function(e){e.enableDidYouMean=_n,e.applyDidYouMeanCorrection=Ln,e.disableDidYouMean=$n}(Bl||(Bl={})),function(e){e.registerFieldsToInclude=Yo}(Wl||(Wl={})),function(e){e.snapshot=Lt,e.back=Nt,e.change=zt,e.forward=Ut}(Jl||(Jl={})),function(e){e.registerNumericFacet=ys,e.deselectAllNumericFacetValues=bs,e.toggleSelectNumericFacetValue=ms,e.updateNumericFacetSortCriterion=vs}(Kl||(Kl={})),function(e){e.registerNumberOfResults=pa,e.registerPage=ga,e.nextPage=ma,e.previousPage=va,e.updateNumberOfResults=ha,e.updatePage=ya}(Zl||(Zl={})),function(e){e.setPipeline=Wo}(Xl||(Xl={})),function(e){e.updateQuery=Nn}(Gl||(Gl={})),function(e){e.registerQuerySetQuery=na,e.updateQuerySetQuery=ia}(ed||(ed={})),function(e){e.registerQuerySuggest=Li,e.buildQuerySuggestRequest=Yi,e.clearQuerySuggest=zi,e.clearQuerySuggestCompletions=Hi,e.fetchQuerySuggestions=Qi,e.selectQuerySuggestion=Ui,e.unregisterQuerySuggest=Ni}(td||(td={})),function(e){e.checkForRedirection=Gi,e.buildPlanRequest=ea}(rd||(rd={})),function(e){e.executeSearch=ti,e.buildSearchRequest=oi,e.fetchMoreResults=ri}(nd||(nd={})),function(e){e.setSearchHub=Rn}(id||(id={})),function(e){e.registerSortCriterion=Ia,e.updateSortCriterion=qa}(ad||(ad={})),function(e){e.buildRecommendationRequest=Mn,e.getRecommendations=Fn,e.setRecommendationId=Tn}(od||(od={})),function(e){e.setProductRecommendationsBrandFilter=On,e.buildProductRecommendationsRequest=An,e.getProductRecommendations=In,e.setProductRecommendationsCategoryFilter=Cn,e.setProductRecommendationsMaxNumberOfRecommendations=xn,e.setProductRecommendationsRecommenderId=wn,e.setProductRecommendationsSkus=Sn}(sd||(sd={})),function(e){e.getResultProperty=Vl,e.fieldsMustBeDefined=Dl,e.fieldsMustNotBeDefined=_l,e.fieldMustMatch=$l,e.fieldMustNotMatch=Ll}(cd||(cd={}));const ud=e=>fn("analytics/result/open",dn.Click,((t,r)=>(vn(e),t.logDocumentOpen(pn(e,r),hn(e)))))();var ld,dd,fd,pd,hd,gd,yd,md,vd,bd,wd,Sd,Od,Cd;function xd(e={}){return{configuration:Rt(),advancedSearchQueries:{cq:"",aq:""},facetSet:{},dateFacetSet:{},numericFacetSet:{},categoryFacetSet:{},facetSearchSet:{},categoryFacetSearchSet:{},facetOptions:{freezeFacetOrder:!1},pagination:{firstResult:0,numberOfResults:10,totalCountFiltered:0},query:{q:"",enableQuerySyntax:!1},querySet:{},querySuggest:{},redirection:{redirectTo:null},search:{response:{results:[],searchUid:"",totalCountFiltered:0,facets:[],queryCorrections:[]},duration:0,queryExecuted:"",error:null,automaticallyCorrected:!1,isLoading:!1,results:[]},sortCriteria:Kn(),context:{contextValues:{}},didYouMean:{enableDidYouMean:!1,wasCorrectedTo:"",wasAutomaticallyCorrected:!1,queryCorrection:{correctedQuery:"",wordCorrections:[]}},fields:{fieldsToInclude:["author","language","urihash","objecttype","collection","source","permanentid"]},history:_t(Za()),pipeline:"default",facetOrder:[],searchHub:"default",debug:!1,...e}}!function(e){e.logInterfaceLoad=Hu,e.logInterfaceChange=Qu,e.logClickEvent=Uu,e.logCustomEvent=zu,e.logSearchEvent=Nu}(ld||(ld={})),function(e){e.logDidYouMeanClick=Vn,e.logDidYouMeanAutomatic=Dn}(dd||(dd={})),function(e){e.logFacetShowMore=To,e.logFacetShowLess=Fo,e.logFacetSelect=_o,e.logFacetDeselect=$o,e.logFacetClearAll=Do,e.logFacetSearch=Mo,e.logFacetUpdateSort=Vo}(fd||(fd={})),function(e){e.logClearBreadcrumbs=Xu}(pd||(pd={})),function(e){e.logNavigateForward=iu,e.logNavigateBackward=au}(hd||(hd={})),function(e){e.logPageNext=pu,e.logPagePrevious=hu,e.logPageNumber=fu,e.logPagerResize=du}(gd||(gd={})),function(e){e.logProductRecommendations=bn}(yd||(yd={})),function(e){e.logSearchboxSubmit=xu}(md||(md={})),function(e){e.logQuerySuggestionClick=Ru}(vd||(vd={})),function(e){e.logRecommendationUpdate=Pn}(bd||(bd={})),function(e){e.logTriggerRedirect=Xi}(wd||(wd={})),function(e){e.logDocumentOpen=ud}(Sd||(Sd={})),function(e){e.logResultsSort=Vu}(Od||(Od={})),function(e){e.logFetchMoreResults=Zn,e.logQueryError=Xn}(Cd||(Cd={}));var Id,qd,Ad=Function.prototype,Ed=Object.prototype,Rd=Ad.toString,jd=Ed.hasOwnProperty,kd=Rd.call(Object),Pd=Ed.toString,Td=(Id=Object.getPrototypeOf,qd=Object,function(e){return Id(qd(e))});var Fd=function(e){if(!function(e){return!!e&&"object"==typeof e}(e)||"[object Object]"!=Pd.call(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e))return!1;var t=Td(e);if(null===t)return!0;var r=jd.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&Rd.call(r)==kd},Md=pt(ht((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};function r(){var e=[],r=[];return{getState:function(){return a(t)?t(e):t},getActions:function(){return e},dispatch:function(t){if(!(0,n.default)(t))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===t.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant? Action: '+JSON.stringify(t));e.push(t);for(var i=0;i<r.length;i++)r[i]();return t},clearActions:function(){e=[]},subscribe:function(e){return a(e)&&r.push(e),function(){var t=r.indexOf(e);t<0||r.splice(t,1)}},replaceReducer:function(e){if(!a(e))throw new Error("Expected the nextReducer to be a function.")}}}var o=se.applyMiddleware.apply(void 0,i(e))(r);return o()}};var r,n=(r=Fd)&&r.__esModule?r:{default:r};function i(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}var a=function(e){return"function"==typeof e}})));function Vd(e={}){return{configuration:Rt(),advancedSearchQueries:{cq:"",aq:""},context:{contextValues:{}},fields:{fieldsToInclude:["author","language","urihash","objecttype","collection","source","permanentid"]},searchHub:"default",pipeline:"default",recommendation:{duration:0,error:null,isLoading:!1,id:"Recommendation",recommendations:[]},debug:!1,...e}}function Dd(e={}){return{configuration:Rt(),context:{contextValues:{}},searchHub:"default",productRecommendations:{id:"",skus:[],maxNumberOfRecommendations:5,filter:{brand:"",category:""},recommendations:[],error:null,isLoading:!1,searchUid:"",duration:0},...e}}const _d=async()=>"";function $d(e={},t){const r=bi({level:"silent"}),n=Ld(r)(e.state||t()),i=()=>{};return{mockStore:n,store:n,state:t(),subscribe:jest.fn((()=>i)),get dispatch(){return n.dispatch},get actions(){return n.getActions()},findAsyncAction(e){const t=this.actions.find((t=>t.type===e.type));return function(e){return!!e&&"meta"in e}(t)?t:void 0},...e,renewAccessToken:_d,logger:r}}const Ld=e=>Md([gi(e),hi,pe.withExtraArgument({searchAPIClient:new Kt({logger:e,renewAccessToken:_d,preprocessRequest:qt,postprocessSearchResponseMiddleware:Mi,postprocessQuerySuggestResponseMiddleware:Di,postprocessFacetSearchResponseMiddleware:Vi}),validatePayload:Ke,logger:e}),...Oe(),yi(e)]);function Nd(e={}){return{urihash:"",parents:"",sfid:"",sfparentid:"",sfinsertedbyid:"",documenttype:"",sfcreatedbyid:"",permanentid:"",date:0,objecttype:"",sourcetype:"",sftitle:"",size:0,sffeeditemid:"",clickableuri:"",sfcreatedby:"",source:"",collection:"",connectortype:"",filetype:"",sfcreatedbyname:"",sflikecount:0,language:[],...e}}var Ud=Object.freeze({__proto__:null,buildMockSearchAppEngine:function(e={}){return $d(e,xd)},buildMockRecommendationAppEngine:function(e={}){return $d(e,Vd)},buildMockProductRecommendationsAppEngine:function(e={}){return $d(e,Dd)},createMockState:xd,buildMockResult:function(e={}){return{title:"",uri:"",printableUri:"",clickUri:"",uniqueId:"",excerpt:"",firstSentences:"",summary:null,flags:"",hasHtmlVersion:!1,score:0,percentScore:0,rankingInfo:null,isTopResult:!1,isRecommendation:!1,titleHighlights:[],firstSentencesHighlights:[],excerptHighlights:[],printableUriHighlights:[],summaryHighlights:[],absentTerms:[],raw:Nd(),...e}},buildMockRaw:Nd});function zd(){return{serialize:Hd,deserialize:Wd}}function Hd(e){return Object.entries(e).map(Qd).filter((e=>e)).join("&")}function Qd(e){const[t,r]=e;return Zd(t)?"f"===t||"cf"===t?function(e){if(!Yd(e))return!1;return Bd(e,(e=>"string"==typeof e))}(r)?function(e,t){return Object.entries(t).map((([t,r])=>`${e}[${t}]=${r.join(",")}`)).join("&")}(t,r):"":"nf"===t||"df"===t?function(e){if(!Yd(e))return!1;return Bd(e,(e=>Yd(e)&&"start"in e&&"end"in e))}(r)?function(e,t){return Object.entries(t).map((([t,r])=>{const n=r.map((({start:e,end:t})=>`${e}..${t}`)).join(",");return`${e}[${t}]=${n}`})).join("&")}(t,r):"":`${t}=${r}`:""}function Yd(e){return!(!e||"object"!=typeof e)}function Bd(e,t){return 0===Object.entries(e).filter((e=>{const r=e[1];return!Array.isArray(r)||!r.every(t)})).length}function Wd(e){return e.split("&").map((e=>function(e){const[t,...r]=e.split("="),n=r.join("=");return[t,n]}(e))).map(Jd).filter(Kd).map(Xd).reduce(((e,t)=>{const[r,n]=t;if("f"===r||"cf"===r||"nf"===r||"df"===r){const t={...e[r],...n};return{...e,[r]:t}}return{...e,[r]:n}}),{})}function Jd(e){const[t,r]=e,n=/^(f|cf|nf|df)\[(.+)\]$/.exec(t);if(!n)return e;const i=n[1],a={[n[2]]:function(e,t){if("nf"===e)return t.map((e=>e.split("..").map(parseFloat))).filter((e=>2===e.length&&e.every(Number.isFinite))).map((([e,t])=>ru({start:e,end:t,state:"selected"})));if("df"===e)return function(e){return e.map((e=>e.split(".."))).filter((e=>2===e.length&&e.every(Wc))).map((([e,t])=>Jc({start:e,end:t,useLocalTime:!0,state:"selected"})))}(t);return t}(i,r.split(","))};return[i,JSON.stringify(a)]}function Kd(e){const t=Zd(e[0]),r=2===e.length;return t&&r}function Zd(e){return e in{q:!0,aq:!0,cq:!0,enableQuerySyntax:!0,firstResult:!0,numberOfResults:!0,sortCriteria:!0,f:!0,cf:!0,nf:!0,df:!0,debug:!0}}function Xd(e){const[t,r]=e;return"enableQuerySyntax"===t||"debug"===t?[t,"true"===r]:"firstResult"===t||"numberOfResults"===t?[t,parseInt(r)]:"f"===t||"cf"===t||"nf"===t||"df"===t?[t,JSON.parse(r)]:e}export{Ul as AdvancedSearchQueriesActions,ld as AnalyticsActions,zl as CategoryFacetSetActions,Hl as ConfigurationActions,Ql as ContextActions,Yl as DateFacetActions,Bl as DidYouMeanActions,dd as DidYouMeanAnalyticsActions,fd as FacetAnalyticsActions,pd as FacetGenericAnalyticsActions,Wl as FieldActions,_i as HeadlessEngine,Fu as HighlightUtils,Jl as HistoryActions,hd as HistoryAnalyticsActions,Kl as NumericFacetActions,Zl as PaginationActions,gd as PaginationAnalyticsActions,Xl as PipelineActions,yd as ProductRecommendationAnalyticsActions,sd as ProductRecommendationsActions,Gl as QueryActions,md as QueryAnalyticsActions,ed as QuerySetActions,td as QuerySuggestActions,vd as QuerySuggestAnalyticsActions,od as RecommendationActions,bd as RecommendationAnalyticsActions,rd as RedirectionActions,wd as RedirectionAnalyticsActions,Sd as ResultAnalyticsActions,cd as ResultTemplatesHelpers,nd as SearchActions,Cd as SearchAnalyticsActions,id as SearchHubActions,zn as SortBy,ad as SortCriterionActions,Od as SortCriterionAnalyticsActions,Un as SortOrder,Ud as TestUtils,oc as baseFacetResponseSelector,Gu as buildBreadcrumbManager,ll as buildCartRecommendationsList,kc as buildCategoryFacet,ic as buildContext,Js as buildController,Hn as buildCriterionExpression,Xc as buildDateFacet,Jc as buildDateRange,Yn as buildDateSortCriterion,ac as buildDidYouMean,Mc as buildFacet,Ju as buildFacetManager,Bn as buildFieldSortCriterion,cl as buildFrequentlyBoughtTogetherList,fl as buildFrequentlyViewedTogetherList,ou as buildHistory,Jn as buildNoSortCriterion,nu as buildNumericFacet,ru as buildNumericRange,mu as buildPager,hl as buildPopularBoughtRecommendationsList,yl as buildPopularViewedRecommendationsList,vu as buildQueryError,Wn as buildQueryRankingExpressionSortCriterion,bu as buildQuerySummary,tl as buildRecommendationList,nc as buildRelevanceInspector,Qn as buildRelevanceSortCriterion,Su as buildResultList,Ml as buildResultTemplatesManager,Cu as buildResultsPerPage,Mu as buildSearchBox,wl as buildSearchParameterManager,zd as buildSearchParameterSerializer,$u as buildSort,nl as buildStandaloneSearchBox,Wu as buildTab,vl as buildUserInterestRecommendationsList,xe as createAction,Re as createAsyncThunk,Ie as createReducer,cu as currentPageSelector,lu as currentPagesSelector,sc as facetRequestSelector,uc as facetResponseSelectedValuesSelector,cc as facetResponseSelector,uu as maxPageSelector,Et as platformUrl,kn as productRecommendationsAppReducers,Ws as recommendationAppReducers,Bs as searchAppReducers};
//# sourceMappingURL=headless.esm.js.map
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment