LocalCDN-Firefox-Chrome-Brave/resources/search-insights/2.6.0/search-insights.min.jsm

2 lines
8.3 KiB
JavaScript
Raw Normal View History

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self).AlgoliaAnalytics={})}(this,function(e){"use strict";function n(){"function"!=typeof Object.assign&&(Object.assign=function(e,n){var t=arguments;if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var i=Object(e),o=1;o<arguments.length;o++){var r=t[o];if(null!=r)for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i[s]=r[s])}return i})}function t(e,n){var t={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&n.indexOf(i)<0&&(t[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++)n.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(t[i[o]]=e[i[o]])}return t}function i(e){return e.reduce(function(e,n){var t=e.events,i=e.additionalParams;return"index"in n?{additionalParams:i,events:t.concat([n])}:{events:t,additionalParams:n}},{events:[],additionalParams:void 0})}var o=function(){try{return Boolean(navigator.cookieEnabled)}catch(e){return!1}},r=function(){try{return Boolean(navigator.sendBeacon)}catch(e){return!1}},s=function(){try{return Boolean(XMLHttpRequest)}catch(e){return!1}},a=function(e){return void 0===e},u=function(e){return"number"==typeof e},c=function(e){return"function"==typeof e};function l(e){return function(n,i){var o,r,s,u=this;if(!this._userHasOptedOut){if(!(!a(this._apiKey)&&!a(this._appId)||(null===(o=i)||void 0===o?void 0:o.headers["X-Algolia-Application-Id"])&&(null===(r=i)||void 0===r?void 0:r.headers["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 c=n.map(function(e){var n,i,o=e.filters,r=t(e,["filters"]),s=Object.assign(Object.assign({},r),{userToken:(i=null===(n=e)||void 0===n?void 0:n.userToken,null!==i&&void 0!==i?i:u._userToken)});return a(o)||(s.filters=o.map(encodeURIComponent)),s});return function(e,n,t,i,o,r,s){void 0===s&&(s={});var a=Object.assign({"X-Algolia-Application-Id":n,"X-Algolia-API-Key":t,"X-Algolia-Agent":encodeURIComponent(i.join("; "))},s),u=Object.keys(a).map(function(e){return e+"="+a[e]}).join("&");return e(o+"/1/events?"+u,{events:r})}(e,this._appId,this._apiKey,this._ua,this._endpointOrigin,c,null===(s=i)||void 0===s?void 0:s.headers)}}}var h="2.6.0",d=["insights-js ("+h+")","insights-js-browser-umd ("+h+")"];var f=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var n=16*Math.random()|0;return("x"===e?n:3&n|8).toString(16)})},v="_ALGOLIA",p=2592e6,g=function(e,n,t){var i=new Date;i.setTime(i.getTime()+t);var o="expires="+i.toUTCString();document.cookie=e+"="+n+";"+o+";path=/"},y=function(e){for(var n=e+"=",t=document.cookie.split(";"),i=0;i<t.length;i++){for(var o=t[i];" "===o.charAt(0);)o=o.substring(1);if(0===o.indexOf(n))return o.substring(n.length,o.length)}return""};n();var b,k,O,m,_=["de","us"];function x(e){var n,i;if(void 0===e&&(e={}),!a(e.region)&&-1===_.indexOf(e.region))throw new Error("optional region is incorrect, please provide either one of: "+_.join(", ")+".");if(!(a(e.cookieDuration)||u(e.cookieDuration)&&isFinite(e.cookieDuration)&&Math.floor(e.cookieDuration)===e.cookieDuration))throw new Error("optional cookieDuration is incorrect, expected an integer.");!function(e,n,i){var o=n.partial,r=t(n,["partial"]);o||Object.assign(e,i);Object.assign(e,Object.keys(r).reduce(function(e,n){var t;return Object.assign(Object.assign({},e),((t={})["_"+n]=r[n],t))},{}))}(this,e,{_userHasOptedOut:!!e.userHasOptedOut,_region:e.region,_host:e.host,_anonymousUserToken:(n=e.anonymousUserToken,null===n||void 0===n||n),_useCookie:(i=e.useCookie,null!==i&&void 0!==i&&i),_cookieDuration:e.cookieDuration||6*p}),this._endpointOrigin=this._host||(this._region?"https://insights."+this._region+".algolia.io":"htt