1var k="2.17.3";function h(e){return e.reduce(function(r,i){var t=r.events,r=r.additionalParams;return"index"in i?{additionalParams:r,events:t.concat([i])}:{events:t,additionalParams:i}},{events:[],additionalParams:void 0})}var S=function(){try{return!!navigator.cookieEnabled}catch{return!1}},P=function(){try{return!!navigator.sendBeacon}catch{return!1}},q=function(){try{return!!XMLHttpRequest}catch{return!1}},F=function(){try{return fetch!==void 0}catch{return!1}},g=function(){};function H(){try{var e="__test_localStorage__";return globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),globalThis.localStorage}catch{}}g.get=function(e){var n=(n=this.store)==null?void 0:n.getItem(e);if(!n)return null;try{return JSON.parse(n)}catch{return null}},g.set=function(e,n){var i;try{(i=this.store)!=null&&i.setItem(e,JSON.stringify(n))}catch{console.error("Unable to set "+e+" in localStorage, storage may be full.")}},g.remove=function(e){var n;(n=this.store)!=null&&n.removeItem(e)},g.store=H();var I="AlgoliaObjectQueryCache",L=5e3,R=1e3;function O(){var e;return(e=g.get(I))!=null?e:{}}function U(e){g.set(I,X(e))}function X(e){return Object.keys(e).length>L?B(e):e}function B(e){return e=Object.entries(e).sort(function(n,i){return n=n[1][1],i[1][1]-n}),e.slice(0,e.length-R-1).reduce(function(n,r){var t=r[0],r=r[1];return Object.assign(Object.assign({},n),((n={})[t]=r,n))},{})}function y(e,n){return e+"_"+n}function _(e,n,i){var t=O();t[y(e,n)]=[i,Date.now()],U(t)}function N(e,n){return O()[y(e,n)]}function K(e,n){var i=O();n.forEach(function(t){delete i[y(e,t)]}),U(i)}var p=function(e){return e===void 0},Q=function(e){return typeof e=="number"},f=function(e){return typeof e=="function"},M=function(e){return typeof e?.then=="function"};function D(e){return function(n){for(var i=[],t=arguments.length-1;0<t--;)i[t]=arguments[t+1];if(n&&f(e[n]))return e[n].apply(e,i);console.warn("The method `"+n+"` doesn't exist.")}}var J=["insights-js ("+k+")","insights-js-browser-esm ("+k+")"];function G(e){this._ua.indexOf(e)===-1&&this._ua.push(e)}function W(e){return f(e)&&e(this.version),this.version}function A(e,n){var i={};for(r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(i[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var t=0,r=Object.getOwnPropertySymbols(e);t<r.length;t++)n.indexOf(r[t])<0&&Object.prototype.propertyIsEnumerable.call(e,r[t])&&(i[r[t]]=e[r[t]]);return i}function V(e){return e.map(function(n){var i,t;return!Y(n)||(i=[],t=(t=n.objectIDs)==null?void 0:t.map(function(r,o){var a=(a=n.objectData)==null?void 0:a[o];return a!=null&&a.queryID?a:((o=((o=N(n.index,r))!=null?o:[])[0])&&i.push(r),Object.assign(Object.assign({},a),{queryID:o}))}),i.length===0)?n:Object.assign(Object.assign({},n),{objectData:t,objectIDsWithInferredQueryID:i})})}function Y(e){return!e.queryID&&e.eventType==="conversion"}function z(e){return function(n,i){var t=this;if(this._userHasOptedOut)return Promise.resolve(!1);if(!(!p(this._apiKey)&&!p(this._appId)||(r=i?.headers)!=null&&r["X-Algolia-Application-Id"]&&((r=i?.headers)!=null&&r["X-Algolia-API-Key"])))throw new Error("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);var r=(i!=null&&i.inferQueryID?V(n):n).map(function(s){var a=s.filters,u=A(s,["filters"]),s=Object.assign(Object.assign({},u),{userToken:(u=s?.userToken)!=null?u:t._userToken,authenticatedUserToken:(u=s?.authenticatedUserToken)!=null?u:t._authenticatedUserToken});return p(a)||(s.filters=a.map(encodeURIComponent)),s});return r.length===0?Promise.resolve(!1):(n=$(e,this._ua,this._endpointOrigin,r,this._appId,this._apiKey,i?.headers),M(n)?n.then(Z(r)):n)}}function Z(e){return function(n){return n&&e.filter(function(o){var t=o.eventType,r=o.eventSubtype,o=o.objectIDs;return t==="conversion"&&r==="purchase"&&o?.length}).forEach(function(i){return K(i.index,i.objectIDs)}),n}}function $(e,n,i,t,r,o,c){var u=(c=c===void 0?{}:c)["X-Algolia-Application-Id"],s=c["X-Algolia-API-Key"],c=A(c,["X-Algolia-Application-Id","X-Algolia-API-Key"]),l=Object.assign({"X-Algolia-Application-Id":u??r,"X-Algolia-API-Key":s??o,"X-Algolia-Agent":encodeURIComponent(n.join("; "))},c);return e(i+"/1/events?"+Object.keys(l).map(function(d){return d+"="+l[d]}).join("&"),{events:t})}function T(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var n=16*Math.random()|0;return(e==="x"?n:3&n|8).toString(16)})}var b="_ALGOLIA",C=2592e6,x=function(e,n,r){var t=new Date,r=(t.setTime(t.getTime()+r),"expires="+t.toUTCString());document.cookie=e+"="+n+";"+r+";path=/"},E=function(e){for(var n=e+"=",i=document.cookie.split(";"),t=0;t<i.length;t++){for(var r=i[t];r.charAt(0)===" ";)r=r.substring(1);if(r.indexOf(n)===0)return r.substring(n.length,r.length)}return""};function ee(e){return typeof e!="number"&&e.indexOf("anonymous-")===0}function ne(){var e=E(b);!this._userToken||e&&e!==""&&e.indexOf("anonymous-")===0||x(b,this._userToken,this._cookieDuration)}function te(e){(e=e!==void 0&&e)?this.setUserToken("anonymous-"+T()):S()&&((e=E(b))&&e!==""&&e.indexOf("anonymous-")===0?this.setUserToken(e):(e=this.setUserToken("anonymous-"+T()),x(b,e,this._cookieDuration)))}function ie(e){return this._userToken=e,f(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken),this._userToken}function re(e,n){return f(n)&&n(null,this._userToken),this._userToken}function oe(e,n){this._onUserTokenChangeCallback=e,n&&n.immediate&&f(this._onUserTokenChangeCallback)&&this._onUserTokenChangeCallback(this._userToken)}function se(e){return this._authenticatedUserToken=e,f(this._onAuthenticatedUserTokenChangeCallback)&&this._onAuthenticatedUserTokenChangeCallback(this._authenticatedUserToken),this._authenticatedUserToken}function ae(e,n){return f(n)&&n(null,this._authenticatedUserToken),this._authenticatedUserToken}function ue(e,n){this._onAuthenticatedUserTokenChangeCallback=e,n&&n.immediate&&f(this._onAuthenticatedUserTokenChangeCallback)&&this._onAuthenticatedUserTokenChangeCallback(this._authenticatedUserToken)}function v(e,n){return n.map(function(i){return Object.assign({eventType:e},i)})}function m(e,n,i){return i.map(function(t){return Object.assign({eventType:e,eventSubtype:n},t)})}function ce(){for(var e=this,n=[],i=arguments.length;i--;)n[i]=arguments[i];var r=h(n),t=r.events,r=r.additionalParams;return t.forEach(function(o){var a=o.index,u=o.queryID;return o.objectIDs.forEach(function(s){return!e._userHasOptedOut&&_(a,s,u)})}),this.sendEvents(v("click",t),r)}function he(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var t=h(e),i=t.events,t=t.additionalParams;return this.sendEvents(v("click",i),t)}function le(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var t=h(e),i=t.events,t=t.additionalParams;return this.sendEvents(v("click",i),t)}function de(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var t=h(e),i=t.events,t=t.additionalParams;return this.sendEvents(v("conversion",i),t)}function fe(){for(var e=this,n=[],i=arguments.length;i--;)n[i]=arguments[i];var r=h(n),t=r.events,r=r.additionalParams;return t.forEach(function(o){var a=o.index,u=o.queryID,s=o.objectIDs,c=o.objectData;
1return s.forEach(function(l,d){d=(d=(d=c?.[d])==null?void 0:d.queryID)!=null?d:u,!e._userHasOptedOut&&d&&_(a,l,d)})}),this.sendEvents(m("conversion","addToCart",t),r)}function ve(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var t=h(e),i=t.events,t=t.additionalParams;return this.sendEvents(m("conversion","purchase",i),t)}function ge(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var t=h(e),i=t.events,t=t.additionalParams;return this.sendEvents(v("conversion",i),t)}function pe(){for(var e=this,n=[],i=arguments.length;i--;)n[i]=arguments[i];var r=h(n),t=r.events,r=r.additionalParams;return t.forEach(function(o){var a=o.index,u=o.objectIDs,s=o.objectData;return u.forEach(function(c,l){l=(l=s?.[l])==null?void 0:l.queryID,!e._userHasOptedOut&&l&&_(a,c,l)})}),this.sendEvents(m("conversion","addToCart",t),r)}function ke(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var t=h(e),i=t.events,t=t.additionalParams;return this.sendEvents(m("conversion","purchase",i),t)}function be(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var t=h(e),i=t.events,t=t.additionalParams;return this.sendEvents(v("conversion",i),t)}var j=["de","us"];function me(e){var n;if(!p((e=e===void 0?{}:e).region)&&j.indexOf(e.region)===-1)throw new Error("optional region is incorrect, please provide either one of: "+j.join(", ")+".");if(!(p(e.cookieDuration)||Q(e.cookieDuration)&&isFinite(e.cookieDuration)&&Math.floor(e.cookieDuration)===e.cookieDuration))throw new Error("optional cookieDuration is incorrect, expected an integer.");Te(this,e,{_userHasOptedOut:!!e.userHasOptedOut,_region:e.region,_host:e.host,_anonymousUserToken:(n=e.anonymousUserToken)==null||n,_useCookie:(n=e.useCookie)!=null&&n,_cookieDuration:e.cookieDuration||6*C}),this._endpointOrigin=this._host||(this._region?"https://insights."+this._region+".algolia.io":"https://insights.algolia.io"),this._ua=[].concat(J),e.authenticatedUserToken&&this.setAuthenticatedUserToken(e.authenticatedUserToken),e.userToken?this.setUserToken(e.userToken):this._userToken||this._userHasOptedOut||!this._useCookie?Oe(this)&&this.saveTokenAsCookie():this.setAnonymousUserToken()}function Te(e,n,i){var t=n.partial,r=A(n,["partial"]);t||Object.assign(e,i),Object.assign(e,Object.keys(r).reduce(function(o,a){return Object.assign(Object.assign({},o),((o={})["_"+a]=r[a],o))},{}))}function Oe(e){return e._userToken!==void 0&&ee(e._userToken)&&e._useCookie&&!e._userHasOptedOut}function ye(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var t=h(e),i=t.events,t=t.additionalParams;return this.sendEvents(v("view",i),t)}function _e(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var t=h(e),i=t.events,t=t.additionalParams;return this.sendEvents(v("view",i),t)}var Ae=function(e){e=e.requestFn,this._endpointOrigin="https://insights.algolia.io",this._anonymousUserToken=!0,this._userHasOptedOut=!1,this._useCookie=!1,this._cookieDuration=6*C,this._ua=[],this.version=k,this.sendEvents=z(e).bind(this),this.init=me.bind(this),this.addAlgoliaAgent=G.bind(this),this.saveTokenAsCookie=ne.bind(this),this.setUserToken=ie.bind(this),this.setAnonymousUserToken=te.bind(this),this.getUserToken=re.bind(this),this.onUserTokenChange=oe.bind(this),this.setAuthenticatedUserToken=se.bind(this),this.getAuthenticatedUserToken=ae.bind(this),this.onAuthenticatedUserTokenChange=ue.bind(this),this.clickedObjectIDsAfterSearch=ce.bind(this),this.clickedObjectIDs=he.bind(this),this.clickedFilters=le.bind(this),this.convertedObjectIDsAfterSearch=de.bind(this),this.purchasedObjectIDsAfterSearch=ve.bind(this),this.addedToCartObjectIDsAfterSearch=fe.bind(this),this.convertedObjectIDs=ge.bind(this),this.addedToCartObjectIDs=pe.bind(this),this.purchasedObjectIDs=ke.bind(this),this.convertedFilters=be.bind(this),this.viewedObjectIDs=ye.bind(this),this.viewedFilters=_e.bind(this),this.getVersion=W.bind(this)};function je(i){var n,i=D(new Ae({requestFn:i}));if(typeof window=="object"&&!window.AlgoliaAnalyticsObject){for(;n=T(),window[n]!==void 0;);window.AlgoliaAnalyticsObject=n,window[window.AlgoliaAnalyticsObject]=i}return i.version=k,i}function Ce(e){var n,i=e.AlgoliaAnalyticsObject;i&&(n=D(this),(e=e[i]).queue=e.queue||[],(i=e.queue).forEach(function(o){var o=[].slice.call(o),r=o[0],o=o.slice(1);n.apply(void 0,[r].concat(o))}),i.push=function(o){var o=[].slice.call(o),r=o[0],o=o.slice(1);n.apply(void 0,[r].concat(o))})}var w=function(e,n){return new Promise(function(i,t){var r=JSON.stringify(n),o=new XMLHttpRequest;o.addEventListener("readystatechange",function(){o.readyState===4&&o.status===200?i(!0):o.readyState===4&&i(!1)}),o.addEventListener("error",function(){return t()}),o.addEventListener("timeout",function(){return i(!1)}),o.open("POST",e),o.setRequestHeader("Content-Type","application/json"),o.send(r)})},Ie=function(e,n){var i=JSON.stringify(n),i=navigator.sendBeacon(e,i);return Promise.resolve(!!i||w(e,n))},Ue=function(e,n){return new Promise(function(i,t){fetch(e,{method:"POST",body:JSON.stringify(n),headers:{"Content-Type":"application/json"}}).then(function(r){i(r.status===200)}).catch(function(r){t(r)})})};function De(){if(P())return Ie;if(q())return w;if(F())return Ue;
1throw new Error("Could not find a supported HTTP request client in this environment.")}var xe=je(De());export{Ae as AlgoliaAnalytics,g as LocalStorage,je as createInsightsClient,xe as default,D as getFunctionalInterface,De as getRequesterForBrowser,Ce as processQueue};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.