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

2 lines
7.2 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";var n=function(){try{return Boolean(navigator.cookieEnabled)}catch(e){return!1}},t=function(){try{return Boolean(navigator.sendBeacon)}catch(e){return!1}},i=function(){try{return Boolean(XMLHttpRequest)}catch(e){return!1}},o=function(e){return void 0===e},r=function(e){return"string"==typeof e},s=function(e){return"number"==typeof e},a=function(e){return"function"==typeof e};function u(e){return function(n){var t=this;if(!this._userHasOptedOut){if(!this._hasCredentials)throw new Error("Before calling any methods on the analytics, you first need to call the 'init' function with appId and apiKey parameters");var i=n.map(function(e){var n,i,r=e.filters,s=function(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}(e,["filters"]),a=Object.assign(Object.assign({},s),{userToken:(i=null===(n=e)||void 0===n?void 0:n.userToken,null!==i&&void 0!==i?i:t._userToken)});return o(r)||(a.filters=r.map(encodeURIComponent)),a});return function(e,n,t,i,o,r){var s=encodeURIComponent(i.join("; "));return e(o+"/1/events?X-Algolia-Application-Id="+n+"&X-Algolia-API-Key="+t+"&X-Algolia-Agent="+s,{events:r})}(e,this._appId,this._apiKey,this._ua,this._endpointOrigin,i)}}}var c=["insights-js (2.2.1)","insights-js-browser-umd (2.2.1)"];var h=["de","us"],l=2592e6;function f(e,n){return n.map(function(n){return Object.assign({eventType:e},n)})}var p,d,v,g,y=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)})},b="_ALGOLIA",k=function(e,n,t){var i=new Date;i.setTime(i.getTime()+t);var o="expires="+i.toUTCString();document.cookie=e+"="+n+";"+o+";path=/"},O=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""};Object.keys||(Object.keys=(p=Object.prototype.hasOwnProperty,d=!{toString:null}.propertyIsEnumerable("toString"),g=(v=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"]).length,function(e){if("function"!=typeof e&&("object"!=typeof e||null===e))throw new TypeError("Object.keys called on non-object");var n,t,i=[];for(n in e)p.call(e,n)&&i.push(n);if(d)for(t=0;t<g;t++)p.call(e,v[t])&&i.push(v[t]);return i})),"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});var x=function(e){var t=e.requestFn;this._ua=[],this.version="2.2.1",this._hasCredentials=!1,this.sendEvents=u(t).bind(this),this.init=function(e){var n;if(!e)throw new Error("Init function should be called with an object argument containing your apiKey and appId");if(o(e.apiKey)||!r(e.apiKey))throw new Error("apiKey is missing, please provide it so we can authenticate the application");if(o(e.appId)||!r(e.appId))throw new Error("appId is missing, please provide it, so we can properly attribute data to your application");if(!o(e.region)&&-1===h.indexOf(e.region))throw new Error("optional region is incorrect, please provide either one of: "+h.join(", ")+".");if(!(o(e.cookieDuration)||s(e.cookieDuration)&&isFinite(e.cookieDuration)&&Math.floor(e.cookieDuration)===e.cookieDuration))throw new Error("optional cookieDuration is incorrect, expected an integer.");this._apiKey=e.apiKey,this._appId=e.appId,this._userHasOptedOut=!!e.userHasOptedOut,this._region=e.region,this._endpointOrigin=e.region