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

2 lines
11 KiB
JavaScript
Raw Normal View History

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).AlgoliaAnalytics={})}(this,function(e){"use strict";function t(){"function"!=typeof Object.assign&&(Object.assign=function(e,t){var r=arguments;if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var n=Object(e),o=1;o<arguments.length;o++){var i=r[o];if(null!=i)for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(n[s]=i[s])}return n})}var r=function(){try{return Boolean(navigator.cookieEnabled)}catch(e){return!1}},n=function(){try{return Boolean(navigator.sendBeacon)}catch(e){return!1}},o=function(){try{return Boolean(XMLHttpRequest)}catch(e){return!1}},i=function(e){return void 0===e},s=function(e){return"string"==typeof e},a=function(e){return"number"==typeof e},c=function(e){return"function"==typeof e};function u(e){return function(t,r,n){var o,c,u;if(!this._userHasOptedOut){if(!(!i(this._apiKey)&&!i(this._appId)||(null===(o=n)||void 0===o?void 0:o.headers["X-Algolia-Application-Id"])&&(null===(c=n)||void 0===c?void 0:c.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.");if(""===r.userToken||""===this._userToken)throw new Error("`userToken` cannot be an empty string.");var h=r.userToken||this._userToken;if(i(h))throw new Error("Before calling any methods on the analytics, you first need to call 'setUserToken' function or include 'userToken' in the event payload.");if(!s(r.index))throw new TypeError("expected required parameter `index` to be a string");if(!s(r.eventName))throw new TypeError("expected required parameter `eventName` to be a string");if(!i(r.userToken)&&!s(r.userToken))throw new TypeError("expected optional parameter `userToken` to be a string");var p={eventType:t,eventName:r.eventName,userToken:h,index:r.index};if(!i(r.timestamp)){if(!a(r.timestamp))throw new TypeError("expected optional parameter `timestamp` to be a number");p.timestamp=r.timestamp}if(!i(r.queryID)){if(!s(r.queryID))throw new TypeError("expected optional parameter `queryID` to be a string");p.queryID=r.queryID}if(!i(r.objectIDs)){if(!Array.isArray(r.objectIDs))throw new TypeError("expected optional parameter `objectIDs` to be an array");p.objectIDs=r.objectIDs}if(!i(r.positions)){if(!Array.isArray(r.positions))throw new TypeError("expected optional parameter `positions` to be an array");if(i(r.objectIDs))throw new Error("cannot use `positions` without providing `objectIDs`");if(r.objectIDs.length!==r.positions.length)throw new Error("objectIDs and positions need to be of the same size");p.positions=r.positions}if(!i(r.filters)){if(!i(r.objectIDs))throw new Error("cannot use `objectIDs` and `filters` for the same event");if(!Array.isArray(r.filters))throw new TypeError("expected optional parameter `filters` to be an array");p.filters=r.filters}if(i(r.objectIDs)&&i(r.filters))throw new Error("expected either `objectIDs` or `filters` to be provided");return function(e,t,r,n,o,i,s){void 0===s&&(s={});var a=Object.assign({"X-Algolia-Application-Id":t,"X-Algolia-API-Key":r,"X-Algolia-Agent":n},s),c=Object.keys(a).map(function(e){return e+"="+a[e]}).join("&");return e(o+"/1/events?"+c,{events:i})}(e,this._appId,this._apiKey,this._uaURIEncoded,this._endpointOrigin,[p],null===(u=n)||void 0===u?void 0:u.headers)}}}var h="1.10.0",p="insights-js ("+h+")";var l=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},f="_ALGOLIA",d=2592e6,w=function(e,t,r){var n=new Date;n.setTime(n.getTime()+r);var o="expires="+n.toUTCString();document.cookie=e+"="+t+";"+o+";path=/"},b=function(e){for(var t=e+"=",r=document.cookie.split(";"),n=0;n<r.length;n++){for(var o=r[n];" "===o.charAt(0);)o=o.substring(1);if(0===o.indexOf(t))return o.substring(t.length,o.length)}return""};t();var v,y,g,m,I=["de","us"];function k