!function(e,t){"object"==typeofexports&&"undefined"!=typeofmodule?t(exports):"function"==typeofdefine&&define.amd?define(["exports"],t):t((e="undefined"!=typeofglobalThis?globalThis:e||self).AlgoliaAnalytics={})}(this,function(e){"use strict";vart="2.13.0";functiono(e){returne.reduce(function(e,t){varn=e.events,e=e.additionalParams;return"index"int?{additionalParams:e,events:n.concat([t])}:{events:n,additionalParams:t}},{events:[],additionalParams:void0})}functionn(){try{returnBoolean(navigator.cookieEnabled)}catch(e){return}}functionl(e){returnvoid0===e}functionr(e){return"number"==typeofe}functions(e){return"function"==typeofe}functioni(e){varn,i,t=e.AlgoliaAnalyticsObject;t&&(i=this,n=function(e){for(vart=[],n=arguments.length-1;0<n--;)t[n]=arguments[n+1];e&&s(i[e])?i[e].apply(i,t):console.warn("The method `"+e+"` doesn't exist.")},(e=e[t]).queue=e.queue||[],(t=e.queue).forEach(function(e){vare=[].slice.call(e),t=e[0],e=e.slice(1);n.apply(void0,[t].concat(e))}),t.push=function(e){vare=[].slice.call(e),t=e[0],e=e.slice(1);n.apply(void0,[t].concat(e))})}vara=["insights-js ("+t+")","insights-js-browser-umd ("+t+")"];functionf(e,t){varn={};for(oine)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeofObject.getOwnPropertySymbols)for(vari=0,o=Object.getOwnPropertySymbols(e);i<o.length;i++)t.indexOf(o[i])<0&&Object.prototype.propertyIsEnumerable.call(e,o[i])&&(n[o[i]]=e[o[i]]);returnn}functionu(d){returnfunction(e,t){vari=this;if(!this._userHasOptedOut){if(!(!l(this._apiKey)&&!l(this._appId)||(null==(h=null==t?void0:t.headers)?void0:h["X-Algolia-Application-Id"])&&(null==(h=null==t?void0:t.headers)?void0:h["X-Algolia-API-Key"])))thrownewError("Before calling any methods on the analytics, you first need to call the 'init' function with appId and apiKey parameters or provide custom credentials in additional parameters.");!this._userToken&&this._anonymousUserToken&&this.setAnonymousUserToken(!0);varn,o,s,r,a,u,c,h=e.map(function(e){vart=e.filters,n=f(e,["filters"]),e=Object.assign(Object.assign({},n),{userToken:null!=(n=null==e?void0:e.userToken)?n:i._userToken,authenticatedUserToken:null!=(n=null==e?void0:e.authenticatedUserToken)?n:i._authenticatedUserToken});returnl(t)||(e.filters=t.map(encodeURIComponent)),e});returne=d,n=this._ua,o=this._endpointOrigin,h=h,s=this._appId,r=this._apiKey,t=null==t?void0:t.headers,a=(t=void0===t?{}:t)["X-Algolia-Application-Id"],u=t["X-Algolia-API-Key"],t=f(t,["X-Algolia-Application-Id","X-Algolia-API-Key"]),c=Object.assign({"X-Algolia-Application-Id":null!=a?a:s,"X-Algolia-API-Key":null!=u?u:r,"X-Algolia-Agent":encodeURIComponent(n.join("; "))},t),a=Object.keys(c).map(function(e){returne+"="+c[e]}).join("&"),e(o+"/1/events?"+a,{events:h})}}}functionc(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){vart=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}functionh(e,t,n){vari=newDate,n=(i.setTime(i.getTime()+n),"expires="+i.toUTCString());document.cookie=e+"="+t+";"+n+";path=/"}functiond(e){for(vart=e+"=",n=document.cookie.split(";"),i=0;i<n.length;i++){for(varo=n[i];" "===o.charAt(0);)o=o.substring(1);if(0===o.indexOf(t))returno.substring(t.length,o.length)}return""}varv="_ALGOLIA",p=2592e6;functiong(t,e){returne.map(function(e){returnObject.assign({eventType:t},e)})}functionk(t,n,e){returne.map(function(e){returnObject.assign({eventType:t,eventSubtype:n},e)})}varb=["de","us"];functionT(e){if(!l((e=void0===e?{}:e).region)&&-1===b.indexOf(e.region))thrownewError("optional region is incorrect, please provide either one of: "+b.join(", ")+".");if(!(l(e.cookieDuration)||r(e.cookieDuration)&&isFinite(e.cookieDuration)&&Math.floor(e.cookieDuration)===e.cookieDuration))thrownewError("optional cookieDuration is incorrect, expected an integer.");vart=this,n=e,i={_userHasOptedOut:Boolean(e.userHasOptedOut),_region:e.region,_host:e.host,_anonymousUserToken:null==(i=e.anonymousUserToken)||i,_useCookie:null!=(i=e.useCookie)&&i,_cookieDuration:e.cook