New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@krakenjs/beaver-logger

Package Overview
Dependencies
Maintainers
6
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@krakenjs/beaver-logger - npm Package Compare versions

Comparing version 5.2.0 to 5.2.1

5

CHANGELOG.md

@@ -5,2 +5,7 @@ # Changelog

### [5.2.1](https://github.com/krakenjs/beaver-logger/compare/v5.2.0...v5.2.1) (2023-03-07)
* **logger:** expose logger._buffer={}, add tests ([#69](https://github.com/krakenjs/beaver-logger/issues/69)) ([03cee51](https://github.com/krakenjs/beaver-logger/commit/03cee5197e23d3003aebab3fb94f444b09cbbacf))
## [5.2.0](https://github.com/krakenjs/beaver-logger/compare/v5.1.0...v5.2.0) (2023-02-21)

@@ -7,0 +12,0 @@

11

dist/beaver-logger.js

@@ -1251,3 +1251,3 @@ !function(root, factory) {

if (!dom_isBrowser()) return logger;
print(LOG_LEVEL.DEBUG, "metric." + metricPayload.name, metricPayload.dimensions);
print(LOG_LEVEL.DEBUG, "metric." + metricPayload.name, metricPayload.dimensions || {});
metrics.push(metricPayload);

@@ -1283,4 +1283,13 @@ return logger;

return logger;
},
__buffer__: {
events: events,
tracking: tracking,
metrics: metrics
}
};
Object.defineProperty(logger, "__buffer__", {
writable: !1
});
Object.freeze(logger.__buffer__);
return logger;

@@ -1287,0 +1296,0 @@ }

2

dist/beaver-logger.min.js

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("beaver",[],t):"object"==typeof exports?exports.beaver=t():e.beaver=t()}("undefined"!=typeof self?self:this,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return{}.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function o(e){try{if(!e)return!1;if("undefined"!=typeof Promise&&e instanceof Promise)return!0;if("undefined"!=typeof window&&"function"==typeof window.Window&&e instanceof window.Window)return!1;if("undefined"!=typeof window&&"function"==typeof window.constructor&&e instanceof window.constructor)return!1;var t={}.toString;if(t){var n=t.call(e);if("[object Window]"===n||"[object global]"===n||"[object DOMWindow]"===n)return!1}if("function"==typeof e.then)return!0}catch(e){return!1}return!1}n.r(t),n.d(t,"Logger",(function(){return fe})),n.d(t,"LOG_LEVEL",(function(){return Y})),n.d(t,"PROTOCOL",(function(){return ee})),n.d(t,"canUseSendBeacon",(function(){return oe})),n.d(t,"extendIfDefined",(function(){return ue})),n.d(t,"isAmplitude",(function(){return ie})),n.d(t,"sendBeacon",(function(){return ae})),n.d(t,"getHTTPTransport",(function(){return ce}));var i,a=[],u=[],c=0;function f(){if(!c&&i){var e=i;i=null,e.resolve()}}function s(){c+=1}function d(){c-=1,f()}var l=function(){function e(e){var t=this;if(this.resolved=void 0,this.rejected=void 0,this.errorHandled=void 0,this.value=void 0,this.error=void 0,this.handlers=void 0,this.dispatching=void 0,this.stack=void 0,this.resolved=!1,this.rejected=!1,this.errorHandled=!1,this.handlers=[],e){var n,r,o=!1,i=!1,a=!1;s();try{e((function(e){a?t.resolve(e):(o=!0,n=e)}),(function(e){a?t.reject(e):(i=!0,r=e)}))}catch(e){return d(),void this.reject(e)}d(),a=!0,o?this.resolve(n):i&&this.reject(r)}}var t=e.prototype;return t.resolve=function(e){if(this.resolved||this.rejected)return this;if(o(e))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=e,this.dispatch(),this},t.reject=function(e){var t=this;if(this.resolved||this.rejected)return this;if(o(e))throw new Error("Can not reject promise with another promise");if(!e){var n=e&&"function"==typeof e.toString?e.toString():{}.toString.call(e);e=new Error("Expected reject to be called with Error, got "+n)}return this.rejected=!0,this.error=e,this.errorHandled||setTimeout((function(){t.errorHandled||function(e,t){if(-1===a.indexOf(e)){a.push(e),setTimeout((function(){throw e}),1);for(var n=0;n<u.length;n++)u[n](e,t)}}(e,t)}),1),this.dispatch(),this},t.asyncReject=function(e){return this.errorHandled=!0,this.reject(e),this},t.dispatch=function(){var t=this.resolved,n=this.rejected,r=this.handlers;if(!this.dispatching&&(t||n)){this.dispatching=!0,s();for(var i=function(e,t){return e.then((function(e){t.resolve(e)}),(function(e){t.reject(e)}))},a=0;a<r.length;a++){var u=r[a],c=u.onSuccess,f=u.onError,l=u.promise,h=void 0;if(t)try{h=c?c(this.value):this.value}catch(e){l.reject(e);continue}else if(n){if(!f){l.reject(this.error);continue}try{h=f(this.error)}catch(e){l.reject(e);continue}}if(h instanceof e&&(h.resolved||h.rejected)){var p=h;p.resolved?l.resolve(p.value):l.reject(p.error),p.errorHandled=!0}else o(h)?h instanceof e&&(h.resolved||h.rejected)?h.resolved?l.resolve(h.value):l.reject(h.error):i(h,l):l.resolve(h)}r.length=0,this.dispatching=!1,d()}},t.then=function(t,n){if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.then expected a function for success handler");if(n&&"function"!=typeof n&&!n.call)throw new Error("Promise.then expected a function for error handler");var r=new e;return this.handlers.push({promise:r,onSuccess:t,onError:n}),this.errorHandled=!0,this.dispatch(),r},t.catch=function(e){return this.then(void 0,e)},t.finally=function(t){if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.finally expected a function");return this.then((function(n){return e.try(t).then((function(){return n}))}),(function(n){return e.try(t).then((function(){throw n}))}))},t.timeout=function(e,t){var n=this;if(this.resolved||this.rejected)return this;var r=setTimeout((function(){n.resolved||n.rejected||n.reject(t||new Error("Promise timed out after "+e+"ms"))}),e);return this.then((function(e){return clearTimeout(r),e}))},t.toPromise=function(){if("undefined"==typeof Promise)throw new TypeError("Could not find Promise");return Promise.resolve(this)},t.lazy=function(){return this.errorHandled=!0,this},e.resolve=function(t){return t instanceof e?t:o(t)?new e((function(e,n){return t.then(e,n)})):(new e).resolve(t)},e.reject=function(t){return(new e).reject(t)},e.asyncReject=function(t){return(new e).asyncReject(t)},e.all=function(t){var n=new e,r=t.length,i=[].slice();if(!r)return n.resolve(i),n;for(var a=function(e,t,o){return t.then((function(t){i[e]=t,0==(r-=1)&&n.resolve(i)}),(function(e){o.reject(e)}))},u=0;u<t.length;u++){var c=t[u];if(c instanceof e){if(c.resolved){i[u]=c.value,r-=1;continue}}else if(!o(c)){i[u]=c,r-=1;continue}a(u,e.resolve(c),n)}return 0===r&&n.resolve(i),n},e.hash=function(t){var n={},r=[],i=function(e){if(t.hasOwnProperty(e)){var i=t[e];o(i)?r.push(i.then((function(t){n[e]=t}))):n[e]=i}};for(var a in t)i(a);return e.all(r).then((function(){return n}))},e.map=function(t,n){return e.all(t.map(n))},e.onPossiblyUnhandledException=function(e){return function(e){return u.push(e),{cancel:function(){u.splice(u.indexOf(e),1)}}}(e)},e.try=function(t,n,r){if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.try expected a function");var o;s();try{o=t.apply(n,r||[])}catch(t){return d(),e.reject(t)}return d(),e.resolve(o)},e.delay=function(t){return new e((function(e){setTimeout(e,t)}))},e.isPromise=function(t){return!!(t&&t instanceof e)||o(t)},e.flush=function(){return t=i=i||new e,f(),t;var t},e}();function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,h(e,t)}var v="Call was rejected by callee.\r\n";function w(e){return void 0===e&&(e=window),e.location.protocol}function y(e){if(void 0===e&&(e=window),e.mockDomain){var t=e.mockDomain.split("//")[0];if(t)return t}return w(e)}function m(e){return void 0===e&&(e=window),"about:"===y(e)}function g(e){try{return!0}catch(e){}return!1}function b(e){void 0===e&&(e=window);var t=e.location;if(!t)throw new Error("Can not read window location");var n=w(e);if(!n)throw new Error("Can not read window protocol");if("file:"===n)return"file://";if("about:"===n){var r=function(e){if(void 0===e&&(e=window),e)try{if(e.parent&&e.parent!==e)return e.parent}catch(e){}}(e);return r&&g()?b(r):"about://"}var o=t.host;if(!o)throw new Error("Can not read window host");return n+"//"+o}function j(e){void 0===e&&(e=window);var t=b(e);return t&&e.mockDomain&&0===e.mockDomain.indexOf("mock:")?e.mockDomain:t}function O(e){if(!function(e){try{if(e===window)return!0}catch(e){}try{var t=Object.getOwnPropertyDescriptor(e,"location");if(t&&!1===t.enumerable)return!1}catch(e){}try{if(m(e)&&g())return!0}catch(e){}try{if(function(e){return void 0===e&&(e=window),"mock:"===y(e)}(e)&&g())return!0}catch(e){}try{if(b(e)===b(window))return!0}catch(e){}return!1}(e))return!1;try{if(e===window)return!0;if(m(e)&&g())return!0;if(j(window)===j(e))return!0}catch(e){}return!1}var E=[],_=[];function k(e,t){void 0===t&&(t=!0);try{if(e===window)return!1}catch(e){return!0}try{if(!e)return!0}catch(e){return!0}try{if(e.closed)return!0}catch(e){return!e||e.message!==v}if(t&&O(e))try{if(e.mockclosed)return!0}catch(e){}try{if(!e.parent||!e.top)return!0}catch(e){}var n=function(e,t){for(var n=0;n<e.length;n++)try{if(e[n]===t)return n}catch(e){}return-1}(E,e);if(-1!==n){var r=_[n];if(r&&function(e){if(!e.contentWindow)return!0;if(!e.parentNode)return!0;var t=e.ownerDocument;if(t&&t.documentElement&&!t.documentElement.contains(e)){for(var n=e;n.parentNode&&n.parentNode!==n;)n=n.parentNode;if(!n.host||!t.documentElement.contains(n.host))return!0}return!1}(r))return!0}return!1}function x(e){try{if(e===window)return!0}catch(e){if(e&&e.message===v)return!0}try{if("[object Window]"==={}.toString.call(e))return!0}catch(e){if(e&&e.message===v)return!0}try{if(window.Window&&e instanceof window.Window)return!0}catch(e){if(e&&e.message===v)return!0}try{if(e&&e.self===e)return!0}catch(e){if(e&&e.message===v)return!0}try{if(e&&e.parent===e)return!0}catch(e){if(e&&e.message===v)return!0}try{if(e&&e.top===e)return!0}catch(e){if(e&&e.message===v)return!0}try{if(e&&"__unlikely_value__"===e.__cross_domain_utils_window_check__)return!1}catch(e){return!0}try{if("postMessage"in e&&"self"in e&&"location"in e)return!0}catch(e){}return!1}function S(e,t){for(var n=0;n<e.length;n++)try{if(e[n]===t)return n}catch(e){}return-1}var R,B=function(){function e(){if(this.name=void 0,this.weakmap=void 0,this.keys=void 0,this.values=void 0,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__",function(){if("undefined"==typeof WeakMap)return!1;if(void 0===Object.freeze)return!1;try{var e=new WeakMap,t={};return Object.freeze(t),e.set(t,"__testvalue__"),"__testvalue__"===e.get(t)}catch(e){return!1}}())try{this.weakmap=new WeakMap}catch(e){}this.keys=[],this.values=[]}var t=e.prototype;return t._cleanupClosedWindows=function(){for(var e=this.weakmap,t=this.keys,n=0;n<t.length;n++){var r=t[n];if(x(r)&&k(r)){if(e)try{e.delete(r)}catch(e){}t.splice(n,1),this.values.splice(n,1),n-=1}}},t.isSafeToReadWrite=function(e){return!x(e)},t.set=function(e,t){if(!e)throw new Error("WeakMap expected key");var n=this.weakmap;if(n)try{n.set(e,t)}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e))try{var r=this.name,o=e[r];return void(o&&o[0]===e?o[1]=t:Object.defineProperty(e,r,{value:[e,t],writable:!0}))}catch(e){}this._cleanupClosedWindows();var i=this.keys,a=this.values,u=S(i,e);-1===u?(i.push(e),a.push(t)):a[u]=t},t.get=function(e){if(!e)throw new Error("WeakMap expected key");var t=this.weakmap;if(t)try{if(t.has(e))return t.get(e)}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e))try{var n=e[this.name];return n&&n[0]===e?n[1]:void 0}catch(e){}this._cleanupClosedWindows();var r=S(this.keys,e);if(-1!==r)return this.values[r]},t.delete=function(e){if(!e)throw new Error("WeakMap expected key");var t=this.weakmap;if(t)try{t.delete(e)}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e))try{var n=e[this.name];n&&n[0]===e&&(n[0]=n[1]=void 0)}catch(e){}this._cleanupClosedWindows();var r=this.keys,o=S(r,e);-1!==o&&(r.splice(o,1),this.values.splice(o,1))},t.has=function(e){if(!e)throw new Error("WeakMap expected key");var t=this.weakmap;if(t)try{if(t.has(e))return!0}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e))try{var n=e[this.name];return!(!n||n[0]!==e)}catch(e){}return this._cleanupClosedWindows(),-1!==S(this.keys,e)},t.getOrSet=function(e,t){if(this.has(e))return this.get(e);var n=t();return this.set(e,n),n},e}();function P(e){return(P=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function T(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function C(e,t,n){return(C=T()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&h(o,n.prototype),o}).apply(null,arguments)}function W(e){var t="function"==typeof Map?new Map:void 0;return(W=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return C(e,arguments,P(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),h(n,e)})(e)}function L(e){return e.name||e.__name__||e.displayName||"anonymous"}function D(e,t){try{delete e.name,e.name=t}catch(e){}return e.__name__=e.displayName=t,e}function N(){var e="0123456789abcdef";return"uid_"+"xxxxxxxxxx".replace(/./g,(function(){return e.charAt(Math.floor(Math.random()*e.length))}))+"_"+function(e){if("function"==typeof btoa)return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(function(e,t){return String.fromCharCode(parseInt(t,16))}))).replace(/[=]/g,"");if("undefined"!=typeof Buffer)return Buffer.from(e,"utf8").toString("base64").replace(/[=]/g,"");throw new Error("Can not find window.btoa or Buffer")}((new Date).toISOString().slice(11,19).replace("T",".")).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}function M(e){try{return JSON.stringify([].slice.call(e),(function(e,t){return"function"==typeof t?"memoize["+function(e){if(R=R||new B,null==e||"object"!=typeof e&&"function"!=typeof e)throw new Error("Invalid object");var t=R.get(e);return t||(t=typeof e+":"+N(),R.set(e,t)),t}(t)+"]":function(e){var t=!1;try{(e instanceof window.Element||null!==e&&"object"==typeof e&&1===e.nodeType&&"object"==typeof e.style&&"object"==typeof e.ownerDocument)&&(t=!0)}catch(e){}return t}(t)?{}:t}))}catch(e){throw new Error("Arguments not serializable -- can not be used to memoize")}}function A(){return{}}var I=0,H=0;function U(e,t){void 0===t&&(t={});var n,r,o=t.thisNamespace,i=void 0!==o&&o,a=t.time,u=I;I+=1;var c=function(){for(var t=arguments.length,o=new Array(t),c=0;c<t;c++)o[c]=arguments[c];var f,s;u<H&&(n=null,r=null,u=I,I+=1),f=i?(r=r||new B).getOrSet(this,A):n=n||{};try{s=M(o)}catch(t){return e.apply(this,arguments)}var d=f[s];if(d&&a&&Date.now()-d.time<a&&(delete f[s],d=null),d)return d.value;var l=Date.now(),h=e.apply(this,arguments);return f[s]={time:l,value:h},h};return c.reset=function(){n=null,r=null},D(c,(t.name||L(e))+"::memoized")}function F(){}function z(e,t){void 0===t&&(t=Boolean);var n={};for(var r in e)e.hasOwnProperty(r)&&t(e[r],r)&&(n[r]=e[r]);return n}U.clear=function(){H=I},U((function(e){if(Object.values)return Object.values(e);var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t}));var G,q=function(e){function t(t){var n;return(n=e.call(this,t)||this).name=n.constructor.name,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n),n.constructor):n.stack=new Error(t).stack,n}return p(t,e),t}(W(Error));function J(){return Boolean(document.body)&&"complete"===document.readyState}function K(){return Boolean(document.body)&&"interactive"===document.readyState}function V(){return"undefined"!=typeof window&&void 0!==window.location}U((function(){return new l((function(e){if(J()||K())return e();var t=setInterval((function(){if(J()||K())return clearInterval(t),e()}),10)}))})),p((function(){return G.apply(this,arguments)||this}),G=q);var X="undefined"!=typeof document?document.currentScript:null,Z=U((function(){if(X)return X;if(X=function(){try{var e=function(){try{throw new Error("_")}catch(e){return e.stack||""}}(),t=/.*at [^(]*\((.*):(.+):(.+)\)$/gi.exec(e),n=t&&t[1];if(!n)return;for(var r=0,o=[].slice.call(document.getElementsByTagName("script")).reverse();r<o.length;r++){var i=o[r];if(i.src&&i.src===n)return i}}catch(e){}}())return X;throw new Error("Can not determine current script")})),$=N();U((function(){var e;try{e=Z()}catch(e){return $}var t=e.getAttribute("data-uid");if(t&&"string"==typeof t)return t;if((t=e.getAttribute("data-uid-auto"))&&"string"==typeof t)return t;if(e.src){var n=function(e){for(var t="",n=0;n<e.length;n++){var r=e[n].charCodeAt(0)*n;e[n+1]&&(r+=e[n+1].charCodeAt(0)*(n-1)),t+=String.fromCharCode(97+Math.abs(r)%26)}return t}(JSON.stringify({src:e.src,dataset:e.dataset}));t="uid_"+n.slice(n.length-30)}else t=N();return e.setAttribute("data-uid-auto",t),t}));var Q=[],Y={DEBUG:"debug",INFO:"info",WARN:"warn",ERROR:"error"},ee={FILE:"file:"},te=[Y.WARN,Y.ERROR],ne=[Y.ERROR,Y.WARN,Y.INFO,Y.DEBUG],re=Y.WARN,oe=function(e){var t=e.headers,n=e.enableSendBeacon,r=t&&Object.keys(t).length;return!!(window&&window.navigator.sendBeacon&&!r&&n&&window.Blob)},ie=function(e){return"https://api2.amplitude.com/2/httpapi"===e},ae=function(e){var t=e.win,n=void 0===t?window:t,r=e.url,o=e.data,i=e.useBlob,a=void 0===i||i;try{var u=JSON.stringify(o);if(!n.navigator.sendBeacon)throw new Error("No sendBeacon available");if(a){var c=new Blob([u],{type:"application/json"});return n.navigator.sendBeacon(r,c)}return n.navigator.sendBeacon(r,u)}catch(e){return!1}},ue=function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};function ce(e){return function(t){var n=t.url,r=t.method,o=t.headers,i=t.json,a=t.enableSendBeacon,u=void 0!==a&&a;return l.try((function(){var t=e||window,a=O(t)?function(e){if(!O(e))throw new Error("Expected window to be same domain");return e}(t):window,c=!1;return oe({headers:o,enableSendBeacon:u})&&(c=ie(n)?ae({win:a,url:n,data:i,useBlob:!1}):ae({win:a,url:n,data:i,useBlob:!0})),c||function(e){var t=e.url,n=e.method,r=void 0===n?"get":n,o=e.headers,i=void 0===o?{}:o,a=e.json,u=e.data,c=e.body,f=e.win,s=void 0===f?window:f,d=e.timeout,h=void 0===d?0:d;return new l((function(e,n){if(a&&u||a&&c||u&&a)throw new Error("Only options.json or options.data or options.body should be passed");for(var o={},f=0,d=Object.keys(i);f<d.length;f++){var l=d[f];o[l.toLowerCase()]=i[l]}a?o["content-type"]=o["content-type"]||"application/json":(u||c)&&(o["content-type"]=o["content-type"]||"application/x-www-form-urlencoded; charset=utf-8"),o.accept=o.accept||"application/json";for(var p=0;p<Q.length;p++)for(var v=(0,Q[p])(),w=0,y=Object.keys(v);w<y.length;w++){var m=y[w];o[m.toLowerCase()]=v[m]}var g=new s.XMLHttpRequest;for(var b in g.addEventListener("load",(function(){var o=function(e){void 0===e&&(e="");for(var t={},n=0,r=e.trim().split("\n");n<r.length;n++){var o=r[n].split(":"),i=o[0],a=o.slice(1);t[i.toLowerCase()]=a.join(":").trim()}return t}(this.getAllResponseHeaders());if(!this.status)return n(new Error("Request to "+r.toLowerCase()+" "+t+" failed: no response status code."));var i=o["content-type"],a=i&&(0===i.indexOf("application/json")||0===i.indexOf("text/json")),u=this.responseText;try{u=JSON.parse(u)}catch(e){if(a)return n(new Error("Invalid json: "+this.responseText+"."))}return e({status:this.status,headers:o,body:u})}),!1),g.addEventListener("error",(function(e){n(new Error("Request to "+r.toLowerCase()+" "+t+" failed: "+e.toString()+"."))}),!1),g.open(r,t,!0),o)o.hasOwnProperty(b)&&g.setRequestHeader(b,o[b]);a?c=JSON.stringify(a):u&&(c=Object.keys(u).map((function(e){return encodeURIComponent(e)+"="+(u?encodeURIComponent(u[e]):"")})).join("&")),g.timeout=h,g.ontimeout=function(){n(new Error("Request to "+r.toLowerCase()+" "+t+" has timed out"))},g.send(c)}))}({win:a,url:n,method:r,headers:o,json:i})})).then(F)}}function fe(e){var t=e.url,n=e.prefix,o=e.logLevel,i=void 0===o?re:o,a=e.transport,u=void 0===a?ce():a,c=e.amplitudeApiKey,f=e.flushInterval,s=void 0===f?6e4:f,d=e.enableSendBeacon,h=void 0!==d&&d,p=[],v=[],w=[],y=[],m=[],g=[],b=[];function j(e,t,n){if(V()&&window.console&&window.console.log&&!(ne.indexOf(e)>ne.indexOf(i))){var r=[t];r.push(n),(n.error||n.warning)&&r.push("\n\n",n.error||n.warning);try{window.console[e]&&window.console[e].apply?window.console[e].apply(window.console,r):window.console.log&&window.console.log.apply&&window.console.log.apply(window.console,r)}catch(e){}}}function O(){return l.try((function(){if(V()&&window.location.protocol!==ee.FILE&&(p.length||v.length||w.length)){for(var e={},n=0;n<m.length;n++)ue(e,(0,m[n])(e));for(var o,i={},a=0;a<b.length;a++)ue(i,(0,b[a])(i));return t&&(o=u({method:"POST",url:t,headers:i,json:{events:p,meta:e,tracking:v,metrics:w},enableSendBeacon:h}).catch(F)),c&&u({method:"POST",url:"https://api2.amplitude.com/2/httpapi",headers:{},json:{api_key:c,events:v.map((function(e){return r({event_type:e.transition_name||"event",event_properties:e},e)}))},enableSendBeacon:h}).catch(F),p=[],v=[],w=[],l.resolve(o).then(F)}}))}var E,_,k,x,S=(void 0===_&&(_=50),D((function(){x&&clearTimeout(x);var e=k=k||new l;return x=setTimeout((function(){k=null,x=null,l.try(E).then((function(t){e.resolve(t)}),(function(t){e.reject(t)}))}),_),e}),L(E=O)+"::promiseDebounced"));function R(e,t,o){if(void 0===o&&(o={}),!V())return P;n&&(t=n+"_"+t);for(var i=r({},z(o),{timestamp:Date.now().toString()}),a=0;a<y.length;a++)ue(i,(0,y[a])(i));return function(e,t,n){p.push({level:e,event:t,payload:n}),-1!==te.indexOf(e)&&S()}(e,t,i),j(e,t,i),P}function B(e,t){return e.push(t),P}V()&&function(e,t){!function n(){setTimeout((function(){e(),n()}),t)}()}(S,s),"object"==typeof window&&(window.addEventListener("beforeunload",(function(){O()})),window.addEventListener("unload",(function(){O()})),window.addEventListener("pagehide",(function(){O()})));var P={debug:function(e,t){return R(Y.DEBUG,e,t)},info:function(e,t){return R(Y.INFO,e,t)},warn:function(e,t){return R(Y.WARN,e,t)},error:function(e,t){return R(Y.ERROR,e,t)},track:function(e){if(void 0===e&&(e={}),!V())return P;for(var t=z(e),n=0;n<g.length;n++)ue(t,(0,g[n])(t));return j(Y.DEBUG,"track",t),v.push(t),P},metric:function(e){return V()?(j(Y.DEBUG,"metric."+e.name,e.dimensions),w.push(e),P):P},flush:S,immediateFlush:O,addPayloadBuilder:function(e){return B(y,e)},addMetaBuilder:function(e){return B(m,e)},addTrackingBuilder:function(e){return B(g,e)},addHeaderBuilder:function(e){return B(b,e)},setTransport:function(e){return u=e,P},configure:function(e){return e.url&&(t=e.url),e.prefix&&(n=e.prefix),e.logLevel&&(i=e.logLevel),e.transport&&(u=e.transport),e.amplitudeApiKey&&(c=e.amplitudeApiKey),e.flushInterval&&(s=e.flushInterval),e.enableSendBeacon&&(h=e.enableSendBeacon),P}};return P}}])}));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("beaver",[],t):"object"==typeof exports?exports.beaver=t():e.beaver=t()}("undefined"!=typeof self?self:this,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return{}.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function o(e){try{if(!e)return!1;if("undefined"!=typeof Promise&&e instanceof Promise)return!0;if("undefined"!=typeof window&&"function"==typeof window.Window&&e instanceof window.Window)return!1;if("undefined"!=typeof window&&"function"==typeof window.constructor&&e instanceof window.constructor)return!1;var t={}.toString;if(t){var n=t.call(e);if("[object Window]"===n||"[object global]"===n||"[object DOMWindow]"===n)return!1}if("function"==typeof e.then)return!0}catch(e){return!1}return!1}n.r(t),n.d(t,"Logger",(function(){return fe})),n.d(t,"LOG_LEVEL",(function(){return Y})),n.d(t,"PROTOCOL",(function(){return ee})),n.d(t,"canUseSendBeacon",(function(){return oe})),n.d(t,"extendIfDefined",(function(){return ue})),n.d(t,"isAmplitude",(function(){return ie})),n.d(t,"sendBeacon",(function(){return ae})),n.d(t,"getHTTPTransport",(function(){return ce}));var i,a=[],u=[],c=0;function f(){if(!c&&i){var e=i;i=null,e.resolve()}}function s(){c+=1}function d(){c-=1,f()}var l=function(){function e(e){var t=this;if(this.resolved=void 0,this.rejected=void 0,this.errorHandled=void 0,this.value=void 0,this.error=void 0,this.handlers=void 0,this.dispatching=void 0,this.stack=void 0,this.resolved=!1,this.rejected=!1,this.errorHandled=!1,this.handlers=[],e){var n,r,o=!1,i=!1,a=!1;s();try{e((function(e){a?t.resolve(e):(o=!0,n=e)}),(function(e){a?t.reject(e):(i=!0,r=e)}))}catch(e){return d(),void this.reject(e)}d(),a=!0,o?this.resolve(n):i&&this.reject(r)}}var t=e.prototype;return t.resolve=function(e){if(this.resolved||this.rejected)return this;if(o(e))throw new Error("Can not resolve promise with another promise");return this.resolved=!0,this.value=e,this.dispatch(),this},t.reject=function(e){var t=this;if(this.resolved||this.rejected)return this;if(o(e))throw new Error("Can not reject promise with another promise");if(!e){var n=e&&"function"==typeof e.toString?e.toString():{}.toString.call(e);e=new Error("Expected reject to be called with Error, got "+n)}return this.rejected=!0,this.error=e,this.errorHandled||setTimeout((function(){t.errorHandled||function(e,t){if(-1===a.indexOf(e)){a.push(e),setTimeout((function(){throw e}),1);for(var n=0;n<u.length;n++)u[n](e,t)}}(e,t)}),1),this.dispatch(),this},t.asyncReject=function(e){return this.errorHandled=!0,this.reject(e),this},t.dispatch=function(){var t=this.resolved,n=this.rejected,r=this.handlers;if(!this.dispatching&&(t||n)){this.dispatching=!0,s();for(var i=function(e,t){return e.then((function(e){t.resolve(e)}),(function(e){t.reject(e)}))},a=0;a<r.length;a++){var u=r[a],c=u.onSuccess,f=u.onError,l=u.promise,h=void 0;if(t)try{h=c?c(this.value):this.value}catch(e){l.reject(e);continue}else if(n){if(!f){l.reject(this.error);continue}try{h=f(this.error)}catch(e){l.reject(e);continue}}if(h instanceof e&&(h.resolved||h.rejected)){var p=h;p.resolved?l.resolve(p.value):l.reject(p.error),p.errorHandled=!0}else o(h)?h instanceof e&&(h.resolved||h.rejected)?h.resolved?l.resolve(h.value):l.reject(h.error):i(h,l):l.resolve(h)}r.length=0,this.dispatching=!1,d()}},t.then=function(t,n){if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.then expected a function for success handler");if(n&&"function"!=typeof n&&!n.call)throw new Error("Promise.then expected a function for error handler");var r=new e;return this.handlers.push({promise:r,onSuccess:t,onError:n}),this.errorHandled=!0,this.dispatch(),r},t.catch=function(e){return this.then(void 0,e)},t.finally=function(t){if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.finally expected a function");return this.then((function(n){return e.try(t).then((function(){return n}))}),(function(n){return e.try(t).then((function(){throw n}))}))},t.timeout=function(e,t){var n=this;if(this.resolved||this.rejected)return this;var r=setTimeout((function(){n.resolved||n.rejected||n.reject(t||new Error("Promise timed out after "+e+"ms"))}),e);return this.then((function(e){return clearTimeout(r),e}))},t.toPromise=function(){if("undefined"==typeof Promise)throw new TypeError("Could not find Promise");return Promise.resolve(this)},t.lazy=function(){return this.errorHandled=!0,this},e.resolve=function(t){return t instanceof e?t:o(t)?new e((function(e,n){return t.then(e,n)})):(new e).resolve(t)},e.reject=function(t){return(new e).reject(t)},e.asyncReject=function(t){return(new e).asyncReject(t)},e.all=function(t){var n=new e,r=t.length,i=[].slice();if(!r)return n.resolve(i),n;for(var a=function(e,t,o){return t.then((function(t){i[e]=t,0==(r-=1)&&n.resolve(i)}),(function(e){o.reject(e)}))},u=0;u<t.length;u++){var c=t[u];if(c instanceof e){if(c.resolved){i[u]=c.value,r-=1;continue}}else if(!o(c)){i[u]=c,r-=1;continue}a(u,e.resolve(c),n)}return 0===r&&n.resolve(i),n},e.hash=function(t){var n={},r=[],i=function(e){if(t.hasOwnProperty(e)){var i=t[e];o(i)?r.push(i.then((function(t){n[e]=t}))):n[e]=i}};for(var a in t)i(a);return e.all(r).then((function(){return n}))},e.map=function(t,n){return e.all(t.map(n))},e.onPossiblyUnhandledException=function(e){return function(e){return u.push(e),{cancel:function(){u.splice(u.indexOf(e),1)}}}(e)},e.try=function(t,n,r){if(t&&"function"!=typeof t&&!t.call)throw new Error("Promise.try expected a function");var o;s();try{o=t.apply(n,r||[])}catch(t){return d(),e.reject(t)}return d(),e.resolve(o)},e.delay=function(t){return new e((function(e){setTimeout(e,t)}))},e.isPromise=function(t){return!!(t&&t instanceof e)||o(t)},e.flush=function(){return t=i=i||new e,f(),t;var t},e}();function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,h(e,t)}var v="Call was rejected by callee.\r\n";function w(e){return void 0===e&&(e=window),e.location.protocol}function y(e){if(void 0===e&&(e=window),e.mockDomain){var t=e.mockDomain.split("//")[0];if(t)return t}return w(e)}function m(e){return void 0===e&&(e=window),"about:"===y(e)}function g(e){try{return!0}catch(e){}return!1}function b(e){void 0===e&&(e=window);var t=e.location;if(!t)throw new Error("Can not read window location");var n=w(e);if(!n)throw new Error("Can not read window protocol");if("file:"===n)return"file://";if("about:"===n){var r=function(e){if(void 0===e&&(e=window),e)try{if(e.parent&&e.parent!==e)return e.parent}catch(e){}}(e);return r&&g()?b(r):"about://"}var o=t.host;if(!o)throw new Error("Can not read window host");return n+"//"+o}function j(e){void 0===e&&(e=window);var t=b(e);return t&&e.mockDomain&&0===e.mockDomain.indexOf("mock:")?e.mockDomain:t}function _(e){if(!function(e){try{if(e===window)return!0}catch(e){}try{var t=Object.getOwnPropertyDescriptor(e,"location");if(t&&!1===t.enumerable)return!1}catch(e){}try{if(m(e)&&g())return!0}catch(e){}try{if(function(e){return void 0===e&&(e=window),"mock:"===y(e)}(e)&&g())return!0}catch(e){}try{if(b(e)===b(window))return!0}catch(e){}return!1}(e))return!1;try{if(e===window)return!0;if(m(e)&&g())return!0;if(j(window)===j(e))return!0}catch(e){}return!1}var O=[],E=[];function k(e,t){void 0===t&&(t=!0);try{if(e===window)return!1}catch(e){return!0}try{if(!e)return!0}catch(e){return!0}try{if(e.closed)return!0}catch(e){return!e||e.message!==v}if(t&&_(e))try{if(e.mockclosed)return!0}catch(e){}try{if(!e.parent||!e.top)return!0}catch(e){}var n=function(e,t){for(var n=0;n<e.length;n++)try{if(e[n]===t)return n}catch(e){}return-1}(O,e);if(-1!==n){var r=E[n];if(r&&function(e){if(!e.contentWindow)return!0;if(!e.parentNode)return!0;var t=e.ownerDocument;if(t&&t.documentElement&&!t.documentElement.contains(e)){for(var n=e;n.parentNode&&n.parentNode!==n;)n=n.parentNode;if(!n.host||!t.documentElement.contains(n.host))return!0}return!1}(r))return!0}return!1}function x(e){try{if(e===window)return!0}catch(e){if(e&&e.message===v)return!0}try{if("[object Window]"==={}.toString.call(e))return!0}catch(e){if(e&&e.message===v)return!0}try{if(window.Window&&e instanceof window.Window)return!0}catch(e){if(e&&e.message===v)return!0}try{if(e&&e.self===e)return!0}catch(e){if(e&&e.message===v)return!0}try{if(e&&e.parent===e)return!0}catch(e){if(e&&e.message===v)return!0}try{if(e&&e.top===e)return!0}catch(e){if(e&&e.message===v)return!0}try{if(e&&"__unlikely_value__"===e.__cross_domain_utils_window_check__)return!1}catch(e){return!0}try{if("postMessage"in e&&"self"in e&&"location"in e)return!0}catch(e){}return!1}function S(e,t){for(var n=0;n<e.length;n++)try{if(e[n]===t)return n}catch(e){}return-1}var R,P=function(){function e(){if(this.name=void 0,this.weakmap=void 0,this.keys=void 0,this.values=void 0,this.name="__weakmap_"+(1e9*Math.random()>>>0)+"__",function(){if("undefined"==typeof WeakMap)return!1;if(void 0===Object.freeze)return!1;try{var e=new WeakMap,t={};return Object.freeze(t),e.set(t,"__testvalue__"),"__testvalue__"===e.get(t)}catch(e){return!1}}())try{this.weakmap=new WeakMap}catch(e){}this.keys=[],this.values=[]}var t=e.prototype;return t._cleanupClosedWindows=function(){for(var e=this.weakmap,t=this.keys,n=0;n<t.length;n++){var r=t[n];if(x(r)&&k(r)){if(e)try{e.delete(r)}catch(e){}t.splice(n,1),this.values.splice(n,1),n-=1}}},t.isSafeToReadWrite=function(e){return!x(e)},t.set=function(e,t){if(!e)throw new Error("WeakMap expected key");var n=this.weakmap;if(n)try{n.set(e,t)}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e))try{var r=this.name,o=e[r];return void(o&&o[0]===e?o[1]=t:Object.defineProperty(e,r,{value:[e,t],writable:!0}))}catch(e){}this._cleanupClosedWindows();var i=this.keys,a=this.values,u=S(i,e);-1===u?(i.push(e),a.push(t)):a[u]=t},t.get=function(e){if(!e)throw new Error("WeakMap expected key");var t=this.weakmap;if(t)try{if(t.has(e))return t.get(e)}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e))try{var n=e[this.name];return n&&n[0]===e?n[1]:void 0}catch(e){}this._cleanupClosedWindows();var r=S(this.keys,e);if(-1!==r)return this.values[r]},t.delete=function(e){if(!e)throw new Error("WeakMap expected key");var t=this.weakmap;if(t)try{t.delete(e)}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e))try{var n=e[this.name];n&&n[0]===e&&(n[0]=n[1]=void 0)}catch(e){}this._cleanupClosedWindows();var r=this.keys,o=S(r,e);-1!==o&&(r.splice(o,1),this.values.splice(o,1))},t.has=function(e){if(!e)throw new Error("WeakMap expected key");var t=this.weakmap;if(t)try{if(t.has(e))return!0}catch(e){delete this.weakmap}if(this.isSafeToReadWrite(e))try{var n=e[this.name];return!(!n||n[0]!==e)}catch(e){}return this._cleanupClosedWindows(),-1!==S(this.keys,e)},t.getOrSet=function(e,t){if(this.has(e))return this.get(e);var n=t();return this.set(e,n),n},e}();function B(e){return(B=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function T(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function C(e,t,n){return(C=T()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&h(o,n.prototype),o}).apply(null,arguments)}function W(e){var t="function"==typeof Map?new Map:void 0;return(W=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return C(e,arguments,B(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),h(n,e)})(e)}function L(e){return e.name||e.__name__||e.displayName||"anonymous"}function D(e,t){try{delete e.name,e.name=t}catch(e){}return e.__name__=e.displayName=t,e}function N(){var e="0123456789abcdef";return"uid_"+"xxxxxxxxxx".replace(/./g,(function(){return e.charAt(Math.floor(Math.random()*e.length))}))+"_"+function(e){if("function"==typeof btoa)return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(function(e,t){return String.fromCharCode(parseInt(t,16))}))).replace(/[=]/g,"");if("undefined"!=typeof Buffer)return Buffer.from(e,"utf8").toString("base64").replace(/[=]/g,"");throw new Error("Can not find window.btoa or Buffer")}((new Date).toISOString().slice(11,19).replace("T",".")).replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}function M(e){try{return JSON.stringify([].slice.call(e),(function(e,t){return"function"==typeof t?"memoize["+function(e){if(R=R||new P,null==e||"object"!=typeof e&&"function"!=typeof e)throw new Error("Invalid object");var t=R.get(e);return t||(t=typeof e+":"+N(),R.set(e,t)),t}(t)+"]":function(e){var t=!1;try{(e instanceof window.Element||null!==e&&"object"==typeof e&&1===e.nodeType&&"object"==typeof e.style&&"object"==typeof e.ownerDocument)&&(t=!0)}catch(e){}return t}(t)?{}:t}))}catch(e){throw new Error("Arguments not serializable -- can not be used to memoize")}}function A(){return{}}var I=0,H=0;function U(e,t){void 0===t&&(t={});var n,r,o=t.thisNamespace,i=void 0!==o&&o,a=t.time,u=I;I+=1;var c=function(){for(var t=arguments.length,o=new Array(t),c=0;c<t;c++)o[c]=arguments[c];var f,s;u<H&&(n=null,r=null,u=I,I+=1),f=i?(r=r||new P).getOrSet(this,A):n=n||{};try{s=M(o)}catch(t){return e.apply(this,arguments)}var d=f[s];if(d&&a&&Date.now()-d.time<a&&(delete f[s],d=null),d)return d.value;var l=Date.now(),h=e.apply(this,arguments);return f[s]={time:l,value:h},h};return c.reset=function(){n=null,r=null},D(c,(t.name||L(e))+"::memoized")}function z(){}function F(e,t){void 0===t&&(t=Boolean);var n={};for(var r in e)e.hasOwnProperty(r)&&t(e[r],r)&&(n[r]=e[r]);return n}U.clear=function(){H=I},U((function(e){if(Object.values)return Object.values(e);var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t}));var G,q=function(e){function t(t){var n;return(n=e.call(this,t)||this).name=n.constructor.name,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n),n.constructor):n.stack=new Error(t).stack,n}return p(t,e),t}(W(Error));function J(){return Boolean(document.body)&&"complete"===document.readyState}function K(){return Boolean(document.body)&&"interactive"===document.readyState}function V(){return"undefined"!=typeof window&&void 0!==window.location}U((function(){return new l((function(e){if(J()||K())return e();var t=setInterval((function(){if(J()||K())return clearInterval(t),e()}),10)}))})),p((function(){return G.apply(this,arguments)||this}),G=q);var X="undefined"!=typeof document?document.currentScript:null,Z=U((function(){if(X)return X;if(X=function(){try{var e=function(){try{throw new Error("_")}catch(e){return e.stack||""}}(),t=/.*at [^(]*\((.*):(.+):(.+)\)$/gi.exec(e),n=t&&t[1];if(!n)return;for(var r=0,o=[].slice.call(document.getElementsByTagName("script")).reverse();r<o.length;r++){var i=o[r];if(i.src&&i.src===n)return i}}catch(e){}}())return X;throw new Error("Can not determine current script")})),$=N();U((function(){var e;try{e=Z()}catch(e){return $}var t=e.getAttribute("data-uid");if(t&&"string"==typeof t)return t;if((t=e.getAttribute("data-uid-auto"))&&"string"==typeof t)return t;if(e.src){var n=function(e){for(var t="",n=0;n<e.length;n++){var r=e[n].charCodeAt(0)*n;e[n+1]&&(r+=e[n+1].charCodeAt(0)*(n-1)),t+=String.fromCharCode(97+Math.abs(r)%26)}return t}(JSON.stringify({src:e.src,dataset:e.dataset}));t="uid_"+n.slice(n.length-30)}else t=N();return e.setAttribute("data-uid-auto",t),t}));var Q=[],Y={DEBUG:"debug",INFO:"info",WARN:"warn",ERROR:"error"},ee={FILE:"file:"},te=[Y.WARN,Y.ERROR],ne=[Y.ERROR,Y.WARN,Y.INFO,Y.DEBUG],re=Y.WARN,oe=function(e){var t=e.headers,n=e.enableSendBeacon,r=t&&Object.keys(t).length;return!!(window&&window.navigator.sendBeacon&&!r&&n&&window.Blob)},ie=function(e){return"https://api2.amplitude.com/2/httpapi"===e},ae=function(e){var t=e.win,n=void 0===t?window:t,r=e.url,o=e.data,i=e.useBlob,a=void 0===i||i;try{var u=JSON.stringify(o);if(!n.navigator.sendBeacon)throw new Error("No sendBeacon available");if(a){var c=new Blob([u],{type:"application/json"});return n.navigator.sendBeacon(r,c)}return n.navigator.sendBeacon(r,u)}catch(e){return!1}},ue=function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};function ce(e){return function(t){var n=t.url,r=t.method,o=t.headers,i=t.json,a=t.enableSendBeacon,u=void 0!==a&&a;return l.try((function(){var t=e||window,a=_(t)?function(e){if(!_(e))throw new Error("Expected window to be same domain");return e}(t):window,c=!1;return oe({headers:o,enableSendBeacon:u})&&(c=ie(n)?ae({win:a,url:n,data:i,useBlob:!1}):ae({win:a,url:n,data:i,useBlob:!0})),c||function(e){var t=e.url,n=e.method,r=void 0===n?"get":n,o=e.headers,i=void 0===o?{}:o,a=e.json,u=e.data,c=e.body,f=e.win,s=void 0===f?window:f,d=e.timeout,h=void 0===d?0:d;return new l((function(e,n){if(a&&u||a&&c||u&&a)throw new Error("Only options.json or options.data or options.body should be passed");for(var o={},f=0,d=Object.keys(i);f<d.length;f++){var l=d[f];o[l.toLowerCase()]=i[l]}a?o["content-type"]=o["content-type"]||"application/json":(u||c)&&(o["content-type"]=o["content-type"]||"application/x-www-form-urlencoded; charset=utf-8"),o.accept=o.accept||"application/json";for(var p=0;p<Q.length;p++)for(var v=(0,Q[p])(),w=0,y=Object.keys(v);w<y.length;w++){var m=y[w];o[m.toLowerCase()]=v[m]}var g=new s.XMLHttpRequest;for(var b in g.addEventListener("load",(function(){var o=function(e){void 0===e&&(e="");for(var t={},n=0,r=e.trim().split("\n");n<r.length;n++){var o=r[n].split(":"),i=o[0],a=o.slice(1);t[i.toLowerCase()]=a.join(":").trim()}return t}(this.getAllResponseHeaders());if(!this.status)return n(new Error("Request to "+r.toLowerCase()+" "+t+" failed: no response status code."));var i=o["content-type"],a=i&&(0===i.indexOf("application/json")||0===i.indexOf("text/json")),u=this.responseText;try{u=JSON.parse(u)}catch(e){if(a)return n(new Error("Invalid json: "+this.responseText+"."))}return e({status:this.status,headers:o,body:u})}),!1),g.addEventListener("error",(function(e){n(new Error("Request to "+r.toLowerCase()+" "+t+" failed: "+e.toString()+"."))}),!1),g.open(r,t,!0),o)o.hasOwnProperty(b)&&g.setRequestHeader(b,o[b]);a?c=JSON.stringify(a):u&&(c=Object.keys(u).map((function(e){return encodeURIComponent(e)+"="+(u?encodeURIComponent(u[e]):"")})).join("&")),g.timeout=h,g.ontimeout=function(){n(new Error("Request to "+r.toLowerCase()+" "+t+" has timed out"))},g.send(c)}))}({win:a,url:n,method:r,headers:o,json:i})})).then(z)}}function fe(e){var t=e.url,n=e.prefix,o=e.logLevel,i=void 0===o?re:o,a=e.transport,u=void 0===a?ce():a,c=e.amplitudeApiKey,f=e.flushInterval,s=void 0===f?6e4:f,d=e.enableSendBeacon,h=void 0!==d&&d,p=[],v=[],w=[],y=[],m=[],g=[],b=[];function j(e,t,n){if(V()&&window.console&&window.console.log&&!(ne.indexOf(e)>ne.indexOf(i))){var r=[t];r.push(n),(n.error||n.warning)&&r.push("\n\n",n.error||n.warning);try{window.console[e]&&window.console[e].apply?window.console[e].apply(window.console,r):window.console.log&&window.console.log.apply&&window.console.log.apply(window.console,r)}catch(e){}}}function _(){return l.try((function(){if(V()&&window.location.protocol!==ee.FILE&&(p.length||v.length||w.length)){for(var e={},n=0;n<m.length;n++)ue(e,(0,m[n])(e));for(var o,i={},a=0;a<b.length;a++)ue(i,(0,b[a])(i));return t&&(o=u({method:"POST",url:t,headers:i,json:{events:p,meta:e,tracking:v,metrics:w},enableSendBeacon:h}).catch(z)),c&&u({method:"POST",url:"https://api2.amplitude.com/2/httpapi",headers:{},json:{api_key:c,events:v.map((function(e){return r({event_type:e.transition_name||"event",event_properties:e},e)}))},enableSendBeacon:h}).catch(z),p=[],v=[],w=[],l.resolve(o).then(z)}}))}var O,E,k,x,S=(void 0===E&&(E=50),D((function(){x&&clearTimeout(x);var e=k=k||new l;return x=setTimeout((function(){k=null,x=null,l.try(O).then((function(t){e.resolve(t)}),(function(t){e.reject(t)}))}),E),e}),L(O=_)+"::promiseDebounced"));function R(e,t,o){if(void 0===o&&(o={}),!V())return B;n&&(t=n+"_"+t);for(var i=r({},F(o),{timestamp:Date.now().toString()}),a=0;a<y.length;a++)ue(i,(0,y[a])(i));return function(e,t,n){p.push({level:e,event:t,payload:n}),-1!==te.indexOf(e)&&S()}(e,t,i),j(e,t,i),B}function P(e,t){return e.push(t),B}V()&&function(e,t){!function n(){setTimeout((function(){e(),n()}),t)}()}(S,s),"object"==typeof window&&(window.addEventListener("beforeunload",(function(){_()})),window.addEventListener("unload",(function(){_()})),window.addEventListener("pagehide",(function(){_()})));var B={debug:function(e,t){return R(Y.DEBUG,e,t)},info:function(e,t){return R(Y.INFO,e,t)},warn:function(e,t){return R(Y.WARN,e,t)},error:function(e,t){return R(Y.ERROR,e,t)},track:function(e){if(void 0===e&&(e={}),!V())return B;for(var t=F(e),n=0;n<g.length;n++)ue(t,(0,g[n])(t));return j(Y.DEBUG,"track",t),v.push(t),B},metric:function(e){return V()?(j(Y.DEBUG,"metric."+e.name,e.dimensions||{}),w.push(e),B):B},flush:S,immediateFlush:_,addPayloadBuilder:function(e){return P(y,e)},addMetaBuilder:function(e){return P(m,e)},addTrackingBuilder:function(e){return P(g,e)},addHeaderBuilder:function(e){return P(b,e)},setTransport:function(e){return u=e,B},configure:function(e){return e.url&&(t=e.url),e.prefix&&(n=e.prefix),e.logLevel&&(i=e.logLevel),e.transport&&(u=e.transport),e.amplitudeApiKey&&(c=e.amplitudeApiKey),e.flushInterval&&(s=e.flushInterval),e.enableSendBeacon&&(h=e.enableSendBeacon),B},__buffer__:{events:p,tracking:v,metrics:w}};return Object.defineProperty(B,"__buffer__",{writable:!1}),Object.freeze(B.__buffer__),B}}])}));
//# sourceMappingURL=beaver-logger.min.js.map

@@ -183,3 +183,3 @@ import _extends from "@babel/runtime/helpers/esm/extends";

}
print(LOG_LEVEL.DEBUG, "metric." + metricPayload.name, metricPayload.dimensions);
print(LOG_LEVEL.DEBUG, "metric." + metricPayload.name, metricPayload.dimensions || {});
metrics.push(metricPayload);

@@ -244,5 +244,14 @@ return logger;

setTransport: setTransport,
configure: configure
configure: configure,
__buffer__: {
events: events,
tracking: tracking,
metrics: metrics
}
};
Object.defineProperty(logger, "__buffer__", {
writable: false
});
Object.freeze(logger.__buffer__);
return logger;
}
{
"name": "@krakenjs/beaver-logger",
"version": "5.2.0",
"version": "5.2.1",
"description": "Client side logger.",

@@ -102,2 +102,3 @@ "main": "dist/beaver-logger.js",

"@krakenjs/sync-browser-mocks": "^3.0.0",
"@storybook/expect": "^27.5.2-0",
"cross-env": "^7.0.3",

@@ -104,0 +105,0 @@ "flow-bin": "0.135.0",

@@ -61,2 +61,12 @@ /* @flow */

configure: (LoggerOptions) => LoggerType,
__buffer__: {|
events: $ReadOnlyArray<{|
level: $Values<typeof LOG_LEVEL>,
event: string,
payload: Payload,
|}>,
tracking: $ReadOnlyArray<Payload>,
metrics: $ReadOnlyArray<Metric>,
|},
|};

@@ -293,3 +303,3 @@

`metric.${metricPayload.name}`,
metricPayload.dimensions
metricPayload.dimensions || {}
);

@@ -372,5 +382,18 @@

configure,
// exposed primarily for testing
__buffer__: {
events,
tracking,
metrics,
},
};
// mark the __buffer__ prop as readonly
Object.defineProperty(logger, "__buffer__", { writable: false });
// mark logger.__buffer__ props as readOnly, though array methods on the children still work.
Object.freeze(logger.__buffer__);
return logger;
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc