axe 8.0.0 → 8.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -25,6 +25,7 @@
25
25
  * [Suppress logs](#suppress-logs)
26
26
  * [Stack Traces and Error Handling](#stack-traces-and-error-handling)
27
27
  * [Options](#options)
28
+ * [DEPRECATED](#deprecated)
28
29
  * [Aliases](#aliases)
29
30
  * [Methods](#methods)
30
31
  * [Send Logs To Slack](#send-logs-to-slack)
@@ -296,7 +297,10 @@ Please see Cabin's documentation for [stack traces and error handling](https://g
296
297
  * `timeout` (Number) - defaults to `5000`, number of milliseconds to wait for a response
297
298
  * `retry` (Number) - defaults to `3`, number of attempts to retry sending log over HTTP
298
299
  * `showStack` (Boolean) - defaults to `true` (attempts to parse a boolean value from `process.env.SHOW_STACK`) - whether or not to output a stack trace
299
- * `showMeta` (Boolean) - defaults to `true` (attempts to parse a boolean value from `process.env.SHOW_META` – meaning you can pass a flag `SHOW_META=true node app.js` when needed for debugging), whether or not to output metadata to logger methods
300
+ * `meta` (Object) - stores all meta config information
301
+ * `show` (Boolean) - defaults to `true` (attempts to parse a boolean value from `process.env.SHOW_META` – meaning you can pass a flag `SHOW_META=true node app.js` when needed for debugging), whether or not to output metadata to logger methods.
302
+ * `showApp` (Boolean) - defaults to `true` (attempts to parse a boolean value from `process.env.SHOW_META_APP` – meaning you can pass a flag `SHOW_META_APP=true node app.js` when needed for debugging), whether or not to output `appInfo` in the metadata to logger methods.
303
+ * `omittedFields` (Array) - defaults to `[]` (attempts to parse an array value from `process.env.OMIT_META_FIELDS` (`,` delimited) - meaning you can pass a flag `OMIT_META_FIELDS=user,id node app.js`), determining which fields to omit in the metadata passed to logger methods.
300
304
  * `silent` (Boolean) - defaults to `false`, whether or not to suppress log output to console
301
305
  * `logger` (Object) - defaults to `console` (with [console-polyfill][] added automatically), but you may wish to use a [custom logger](#custom-logger)
302
306
  * `name` (String) - the default name for the logger (defaults to `false`, which does not set `logger.name`). If you wish to pass a name such as `os.hostname()`, then set `name: os.hostname()` – this is useful if you are using a logger like `pino` which prefixes log output with the name set here.
@@ -305,6 +309,11 @@ Please see Cabin's documentation for [stack traces and error handling](https://g
305
309
  * `callback` (Function) - defaults to `false`, but if it is a `Function`, then it will be called with `callback(level, message, meta)` – this is super useful for [sending messages to Slack when errors occur (see below)](#send-logs-to-slack). Note that if you specify `{ callback: false }` in the meta object when logging, it will prevent the callback function from being invoked (e.g. `axe.error(new Error('Slack callback failed'), { callback: false })` ‐ see below example). The `callback` property is always purged from `meta` object for sanity.
306
310
  * `appInfo` (Boolean) - defaults to `true` (attempts to parse a boolean value from `process.env.APP_INFO`) - whether or not to parse application information (using [parse-app-info][]).
307
311
 
312
+ ### DEPRECATED
313
+
314
+ * `showMeta` (Boolean) - defaults to `true` (attempts to parse a boolean value from `process.env.SHOW_META` – meaning you can pass a flag `SHOW_META=true node app.js` when needed for debugging), whether or not to output metadata to logger methods.
315
+ * This will be automatically assigned to `meta.show` when passed as part of config.
316
+
308
317
 
309
318
  ## Aliases
310
319
 
package/dist/axe.js CHANGED
@@ -5511,7 +5511,7 @@ module.exports = {
5511
5511
  module.exports={
5512
5512
  "name": "axe",
5513
5513
  "description": "Logging add-on to send logs over HTTP to your server in Node and Browser environments. Works with any logger! Chop up your logs consistently! Made for Cabin and Lad.",
5514
- "version": "7.0.2",
5514
+ "version": "8.0.0",
5515
5515
  "author": "Nick Baugh <niftylettuce@gmail.com> (http://niftylettuce.com)",
5516
5516
  "ava": {
5517
5517
  "serial": true,
@@ -5787,7 +5787,13 @@ var Axe = /*#__PURE__*/function () {
5787
5787
  timeout: 5000,
5788
5788
  retry: 3,
5789
5789
  showStack: process.env.SHOW_STACK ? boolean(process.env.SHOW_STACK) : true,
5790
- showMeta: process.env.SHOW_META ? boolean(process.env.SHOW_META) : true,
5790
+ meta: {
5791
+ show: process.env.SHOW_META ? boolean(process.env.SHOW_META) : true,
5792
+ showApp: process.env.SHOW_META_APP ? boolean(process.env.SHOW_META_APP) : true,
5793
+ omittedFields: process.env.OMIT_META_FIELDS ? process.env.OMIT_META_FIELDS.split(',').map(function (s) {
5794
+ return s.trim();
5795
+ }) : []
5796
+ },
5791
5797
  silent: false,
5792
5798
  logger: console,
5793
5799
  name: false,
@@ -5797,9 +5803,15 @@ var Axe = /*#__PURE__*/function () {
5797
5803
  capture: false,
5798
5804
  callback: false,
5799
5805
  appInfo: process.env.APP_INFO ? boolean(process.env.APP_INFO) : true
5800
- }, config);
5806
+ }, config); // For backwards compatability
5807
+
5808
+ if (this.config.showMeta) {
5809
+ this.config.meta.show = this.config.showMeta;
5810
+ delete this.config.showMeta;
5811
+ }
5812
+
5801
5813
  this.appInfo = this.config.appInfo ? isFunction(parseAppInfo) ? parseAppInfo() : false : false;
5802
- this.log = this.log.bind(this); // inherit methods from parent logger
5814
+ this.log = this.log.bind(this); // Inherit methods from parent logger
5803
5815
 
5804
5816
  var methods = Object.keys(this.config.logger).filter(function (key) {
5805
5817
  return !omittedLoggerKeys.has(key);
@@ -5812,7 +5824,7 @@ var Axe = /*#__PURE__*/function () {
5812
5824
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
5813
5825
  var element = _step.value;
5814
5826
  this[element] = this.config.logger[element];
5815
- } // bind helper functions for each log level
5827
+ } // Bind helper functions for each log level
5816
5828
 
5817
5829
  } catch (err) {
5818
5830
  _iterator.e(err);
@@ -5838,7 +5850,7 @@ var Axe = /*#__PURE__*/function () {
5838
5850
 
5839
5851
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
5840
5852
  _loop();
5841
- } // we could have used `auto-bind` but it's not compiled for browser
5853
+ } // We could have used `auto-bind` but it's not compiled for browser
5842
5854
 
5843
5855
  } catch (err) {
5844
5856
  _iterator2.e(err);
@@ -5849,11 +5861,11 @@ var Axe = /*#__PURE__*/function () {
5849
5861
  this.setLevel = this.setLevel.bind(this);
5850
5862
  this.getNormalizedLevel = this.getNormalizedLevel.bind(this);
5851
5863
  this.setName = this.setName.bind(this);
5852
- this.setCallback = this.setCallback.bind(this); // set the logger name
5864
+ this.setCallback = this.setCallback.bind(this); // Set the logger name
5853
5865
 
5854
- if (this.config.name) this.setName(this.config.name); // set the logger level
5866
+ if (this.config.name) this.setName(this.config.name); // Set the logger level
5855
5867
 
5856
- this.setLevel(this.config.level); // aliases
5868
+ this.setLevel(this.config.level); // Aliases
5857
5869
 
5858
5870
  this.err = this.error;
5859
5871
  this.warning = this.warn;
@@ -5867,9 +5879,9 @@ var Axe = /*#__PURE__*/function () {
5867
5879
  }, {
5868
5880
  key: "setLevel",
5869
5881
  value: function setLevel(level) {
5870
- if (!isString(level) || !levels.includes(level)) throw new Error(levelError); // support signale logger and other loggers that use `logLevel`
5882
+ if (!isString(level) || !levels.includes(level)) throw new Error(levelError); // Support signale logger and other loggers that use `logLevel`
5871
5883
 
5872
- if (isString(this.config.logger.logLevel)) this.config.logger.logLevel = level;else this.config.logger.level = level; // adjusts `this.config.levels` array
5884
+ if (isString(this.config.logger.logLevel)) this.config.logger.logLevel = level;else this.config.logger.level = level; // Adjusts `this.config.levels` array
5873
5885
  // so that it has all proceeding (inclusive)
5874
5886
 
5875
5887
  this.config.levels = levels.slice(levels.indexOf(level));
@@ -5885,7 +5897,7 @@ var Axe = /*#__PURE__*/function () {
5885
5897
  }, {
5886
5898
  key: "setName",
5887
5899
  value: function setName(name) {
5888
- if (!isString(name)) throw new Error('`name` must be a String'); // support signale logger and other loggers that use `scope`
5900
+ if (!isString(name)) throw new Error('`name` must be a String'); // Support signale logger and other loggers that use `scope`
5889
5901
 
5890
5902
  if (isString(this.config.logger.scope)) this.config.logger.scope = name;else this.config.logger.name = name;
5891
5903
  } // eslint-disable-next-line complexity
@@ -5919,7 +5931,7 @@ var Axe = /*#__PURE__*/function () {
5919
5931
  message = level;
5920
5932
  level = this.getNormalizedLevel(level);
5921
5933
  modifier = -1;
5922
- } // bunyan support (meta, message, ...args)
5934
+ } // Bunyan support (meta, message, ...args)
5923
5935
 
5924
5936
 
5925
5937
  var isBunyan = false;
@@ -5929,10 +5941,10 @@ var Axe = /*#__PURE__*/function () {
5929
5941
  var _meta = meta;
5930
5942
  meta = message;
5931
5943
  message = isString(_meta) && originalArgs.length >= 3 + modifier ? format.apply(void 0, _toConsumableArray(originalArgs.slice(2 + modifier))) : _meta;
5932
- } // if message was undefined then set it to level
5944
+ } // If message was undefined then set it to level
5933
5945
 
5934
5946
 
5935
- if (isUndefined(message)) message = level; // if only `message` was passed then if it was an Object
5947
+ if (isUndefined(message)) message = level; // If only `message` was passed then if it was an Object
5936
5948
  // preserve it as an Object by setting it as meta
5937
5949
 
5938
5950
  if (originalArgs.slice(1 + modifier).length === 1 && !isString(message) && !isError(message)) {
@@ -5941,14 +5953,14 @@ var Axe = /*#__PURE__*/function () {
5941
5953
  };
5942
5954
  message = level;
5943
5955
  } else if (!isBunyan && originalArgs.length >= 4 + modifier) {
5944
- // if there are four or more args
5956
+ // If there are four or more args
5945
5957
  // then infer to use util.format on everything
5946
5958
  message = format.apply(void 0, _toConsumableArray(originalArgs.slice(1 + modifier)));
5947
5959
  meta = {};
5948
5960
  } else if (!isBunyan && originalArgs.length === 3 + modifier && isString(message) && formatSpecifiers.filter(function (t) {
5949
5961
  return message.includes(t);
5950
5962
  }).length > 0) {
5951
- // otherwise if there are three args and if the `message` contains
5963
+ // Otherwise if there are three args and if the `message` contains
5952
5964
  // a placeholder token (e.g. '%s' or '%d' - see above `formatSpecifiers` variable)
5953
5965
  // then we can infer that the `meta` arg passed is used for formatting
5954
5966
  message = format(message, meta);
@@ -5959,16 +5971,16 @@ var Axe = /*#__PURE__*/function () {
5959
5971
  err: parseErr(meta)
5960
5972
  }; // } else if (!isPlainObject(meta) && !isUndefined(meta) && !isNull(meta)) {
5961
5973
  } else if (!isObject(meta) && !isUndefined(meta) && !isNull(meta)) {
5962
- // if the `meta` variable passed was not an Object then convert it
5974
+ // If the `meta` variable passed was not an Object then convert it
5963
5975
  message = format(message, meta);
5964
5976
  meta = {};
5965
5977
  } else if (!isString(message)) {
5966
- // if the message is not a string then we should run `util.format` on it
5978
+ // If the message is not a string then we should run `util.format` on it
5967
5979
  // assuming we're formatting it like it was another argument
5968
5980
  // (as opposed to using something like fast-json-stringify)
5969
5981
  message = format(message);
5970
5982
  }
5971
- } // if (!isPlainObject(meta)) meta = {};
5983
+ } // If (!isPlainObject(meta)) meta = {};
5972
5984
 
5973
5985
 
5974
5986
  if (!isUndefined(meta) && !isObject(meta)) meta = {
@@ -5983,32 +5995,32 @@ var Axe = /*#__PURE__*/function () {
5983
5995
  message = _message.message;
5984
5996
  } else if (isError(meta.err)) {
5985
5997
  error = meta.err;
5986
- } // omit `callback` from `meta` if it was passed
5998
+ } // Omit `callback` from `meta` if it was passed
5987
5999
 
5988
6000
 
5989
6001
  var callback = isFunction(config.callback) && (!isBoolean(meta.callback) || meta.callback);
5990
- meta = omit(meta, ['callback']); // set default level on meta
6002
+ meta = omit(meta, ['callback']); // Set default level on meta
5991
6003
 
5992
- meta.level = level; // add `app` object to metadata
6004
+ meta.level = level; // Add `app` object to metadata
5993
6005
 
5994
- if (this.appInfo) meta.app = this.appInfo; // set the body used for returning with and sending logs
6006
+ if (this.appInfo) meta.app = this.appInfo; // Set the body used for returning with and sending logs
5995
6007
  // (and also remove circular references)
5996
6008
 
5997
6009
  var body = safeStringify({
5998
6010
  message: message,
5999
6011
  meta: meta
6000
- }); // send to Cabin or other logging service here the `message` and `meta`
6012
+ }); // Send to Cabin or other logging service here the `message` and `meta`
6001
6013
 
6002
6014
  if (config.capture && config.levels.includes(level) && (!isError(error) || !error._captureFailed)) {
6003
- // if the user didn't specify a key
6015
+ // If the user didn't specify a key
6004
6016
  // and they are using the default endpoint
6005
6017
  // then we should throw an error to them
6006
- if (config.endpoint === endpoint && !config.key) throw new Error("Cabin API key required (e.g. `{ key: 'YOUR-CABIN-API-KEY' })`)\n<https://cabinjs.com>"); // capture the log over HTTP
6018
+ if (config.endpoint === endpoint && !config.key) throw new Error("Cabin API key required (e.g. `{ key: 'YOUR-CABIN-API-KEY' })`)\n<https://cabinjs.com>"); // Capture the log over HTTP
6007
6019
 
6008
6020
  var request = superagent.post(config.endpoint).set('X-Request-Id', cuid()).timeout(config.timeout);
6009
- if (!process.browser) request.set('User-Agent', "axe/".concat(pkg.version)); // basic auth (e.g. Cabin API key)
6021
+ if (!process.browser) request.set('User-Agent', "axe/".concat(pkg.version)); // Basic auth (e.g. Cabin API key)
6010
6022
 
6011
- if (config.key) request.auth(config.key); // set headers if any
6023
+ if (config.key) request.auth(config.key); // Set headers if any
6012
6024
 
6013
6025
  if (!isEmpty(config.headers)) request.set(config.headers);
6014
6026
  request.type('application/json').send(body).retry(config.retry).end(function (error_) {
@@ -6018,12 +6030,12 @@ var Axe = /*#__PURE__*/function () {
6018
6030
  _this2.config.logger.error(error_);
6019
6031
  }
6020
6032
  });
6021
- } // custom callback function (e.g. Slack message)
6033
+ } // Custom callback function (e.g. Slack message)
6022
6034
 
6023
6035
 
6024
- if (callback) config.callback(level, message, meta); // suppress logs if it was silent
6036
+ if (callback) config.callback(level, message, meta); // Suppress logs if it was silent
6025
6037
 
6026
- if (config.silent) return body; // return early if it is not a valid logging level
6038
+ if (config.silent) return body; // Return early if it is not a valid logging level
6027
6039
 
6028
6040
  if (!config.levels.includes(level)) return body; //
6029
6041
  // determine log method to use
@@ -6036,17 +6048,21 @@ var Axe = /*#__PURE__*/function () {
6036
6048
  //
6037
6049
 
6038
6050
  var method = level;
6039
- if (modifier === -1) method = 'log';else if (level === 'fatal') method = 'error'; // if there was meta information then output it
6051
+ if (modifier === -1) method = 'log';else if (level === 'fatal') method = 'error'; // If there was meta information then output it
6052
+ // setup ommitted fields
6053
+
6054
+ var omittedFields = ['level', 'err'].concat(this.config.meta.omittedFields); // Omit app is configured
6040
6055
 
6041
- var omitted = omit(meta, ['level', 'err']); // show stack trace if necessary (along with any metadata)
6056
+ if (!this.config.meta.showApp) omittedFields.push('app');
6057
+ var omitted = omit(meta, omittedFields); // Show stack trace if necessary (along with any metadata)
6042
6058
 
6043
6059
  if (method === 'error' && isError(error) && config.showStack) {
6044
- if (!config.showMeta || isEmpty(omitted)) this.config.logger.error(error);else this.config.logger.error(error, omitted);
6045
- } else if (!config.showMeta || isEmpty(omitted)) {
6060
+ if (!config.meta.show || isEmpty(omitted)) this.config.logger.error(error);else this.config.logger.error(error, omitted);
6061
+ } else if (!config.meta.show || isEmpty(omitted)) {
6046
6062
  this.config.logger[method](message);
6047
6063
  } else {
6048
6064
  this.config.logger[method](message, omitted);
6049
- } // return the parsed body in case we need it
6065
+ } // Return the parsed body in case we need it
6050
6066
 
6051
6067
 
6052
6068
  return body;
package/dist/axe.min.js CHANGED
@@ -1 +1 @@
1
- !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Axe=t()}}(function(){!function(t){"use strict";t.console||(t.console={});for(var e,r,n=t.console,o=function(){},i=["memory"],s="assert,clear,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn".split(",");e=i.pop();)n[e]||(n[e]={});for(;r=s.pop();)n[r]||(n[r]=o)}("undefined"==typeof window?void 0:window);var t=function(t,e){var r="000000000"+t;return r.substr(r.length-e)};function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var r,n="object"==("undefined"==typeof window?"undefined":e(window))?window:self,o=Object.keys(n).length,i=t(((navigator.mimeTypes?navigator.mimeTypes.length:0)+navigator.userAgent.length).toString(36)+o.toString(36),4),s=function(){return i},a="undefined"!=typeof window&&(window.crypto||window.msCrypto)||"undefined"!=typeof self&&self.crypto;if(a){var u=Math.pow(2,32)-1;r=function(){return Math.abs(a.getRandomValues(new Uint32Array(1))[0]/u)}}else r=Math.random;var c=r,l={},f=0,p=4,h=36,y=Math.pow(h,p);function d(){return t((c()*y<<0).toString(h),p)}function m(){return f=f<y?f:0,++f-1}function b(){return"c"+(new Date).getTime().toString(h)+t(m().toString(h),p)+s()+(d()+d())}b.slug=function(){var t=(new Date).getTime().toString(36),e=m().toString(36).slice(-4),r=s().slice(0,1)+s().slice(-1),n=d().slice(-2);return t.slice(-2)+e+r+n},b.isCuid=function(t){return"string"==typeof t&&!!t.startsWith("c")},b.isSlug=function(t){if("string"!=typeof t)return!1;var e=t.length;return e>=7&&e<=10},b.fingerprint=s,l=b;var v=function(t){var e=Array.prototype.slice.call(arguments,1);return e.length&&(t=t.toString().replace(/(%?)(%([jds]))/g,function(t,r,n,o){var i=e.shift();switch(o){case"s":i=""+i;break;case"d":i=Number(i);break;case"j":i=JSON.stringify(i)}return r?(e.unshift(i),t):i})),e.length&&(t=t.toString()+" "+e.join(" ")),""+t.toString().replace(/%{2,2}/g,"%")},g=["%s","%d","%i","%f","%j","%o","%O","%%"],_=function(t){switch(Object.prototype.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return t instanceof Error}},w={};(function(t){(function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var r=1/0,n=9007199254740991,o="[object Arguments]",i="[object Function]",s="[object GeneratorFunction]",a="[object Symbol]",u=/^\[object .+?Constructor\]$/,c=/^(?:0|[1-9]\d*)$/,l="object"==(void 0===t?"undefined":e(t))&&t&&t.Object===Object&&t,f="object"==("undefined"==typeof self?"undefined":e(self))&&self&&self.Object===Object&&self,p=l||f||Function("return this")();function h(t,e){return!(!t||!t.length)&&function(t,e,r){if(e!=e)return function(t,e,r,n){for(var o=t.length,i=-1;++i<o;)if(e(t[i],i,t))return i;return-1}(t,m);for(var n=-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1}(t,e)>-1}function y(t,e){for(var r=-1,n=t?t.length:0,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}function d(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}function m(t){return t!=t}function b(t,e){return t.has(e)}function v(t,e){return function(r){return t(e(r))}}var g,_=Array.prototype,S=Function.prototype,O=Object.prototype,T=p["__core-js_shared__"],j=(g=/[^.]+$/.exec(T&&T.keys&&T.keys.IE_PROTO||""))?"Symbol(src)_1."+g:"",E=S.toString,A=O.hasOwnProperty,k=O.toString,x=RegExp("^"+E.call(A).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),C=p.Symbol,P=v(Object.getPrototypeOf,Object),R=O.propertyIsEnumerable,D=_.splice,N=C?C.isConcatSpreadable:void 0,I=Object.getOwnPropertySymbols,L=Math.max,q=X(p,"Map"),H=X(Object,"create");function M(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function U(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function z(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function F(t){var e=-1,r=t?t.length:0;for(this.__data__=new z;++e<r;)this.add(t[e])}function $(t,e){for(var r,n,o=t.length;o--;)if((r=t[o][0])===(n=e)||r!=r&&n!=n)return o;return-1}function B(t,r){var n,o,i=t.__data__;return("string"==(o=e(n=r))||"number"==o||"symbol"==o||"boolean"==o?"__proto__"!==n:null===n)?i["string"==typeof r?"string":"hash"]:i.map}function X(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){return!(!et(t)||(e=t,j&&j in e))&&(tt(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(r){}return e}(t)?x:u).test(function(t){if(null!=t){try{return E.call(t)}catch(e){}try{return t+""}catch(e){}}return""}(t));var e}(r)?r:void 0}M.prototype.clear=function(){this.__data__=H?H(null):{}},M.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},M.prototype.get=function(t){var e=this.__data__;if(H){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return A.call(e,t)?e[t]:void 0},M.prototype.has=function(t){var e=this.__data__;return H?void 0!==e[t]:A.call(e,t)},M.prototype.set=function(t,e){return this.__data__[t]=H&&void 0===e?"__lodash_hash_undefined__":e,this},U.prototype.clear=function(){this.__data__=[]},U.prototype.delete=function(t){var e=this.__data__,r=$(e,t);return!(r<0||(r==e.length-1?e.pop():D.call(e,r,1),0))},U.prototype.get=function(t){var e=this.__data__,r=$(e,t);return r<0?void 0:e[r][1]},U.prototype.has=function(t){return $(this.__data__,t)>-1},U.prototype.set=function(t,e){var r=this.__data__,n=$(r,t);return n<0?r.push([t,e]):r[n][1]=e,this},z.prototype.clear=function(){this.__data__={hash:new M,map:new(q||U),string:new M}},z.prototype.delete=function(t){return B(this,t).delete(t)},z.prototype.get=function(t){return B(this,t).get(t)},z.prototype.has=function(t){return B(this,t).has(t)},z.prototype.set=function(t,e){return B(this,t).set(t,e),this},F.prototype.add=F.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},F.prototype.has=function(t){return this.__data__.has(t)};var Q=I?v(I,Object):at,J=I?function(t){for(var e=[];t;)d(e,Q(t)),t=P(t);return e}:at;function G(t){return Y(t)||K(t)||!!(N&&t&&t[N])}function V(t,e){return!!(e=null==e?n:e)&&("number"==typeof t||c.test(t))&&t>-1&&t%1==0&&t<e}function W(t){if("string"==typeof t||function(t){return"symbol"==e(t)||rt(t)&&k.call(t)==a}(t))return t;var n=t+"";return"0"==n&&1/t==-r?"-0":n}function K(t){return function(t){return rt(t)&&Z(t)}(t)&&A.call(t,"callee")&&(!R.call(t,"callee")||k.call(t)==o)}var Y=Array.isArray;function Z(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=n}(t.length)&&!tt(t)}function tt(t){var e=et(t)?k.call(t):"";return e==i||e==s}function et(t){var r=e(t);return!!t&&("object"==r||"function"==r)}function rt(t){return!!t&&"object"==e(t)}function nt(t){return Z(t)?function(t,e){var r=Y(t)||K(t)?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],n=r.length,o=!!n;for(var i in t)!e&&!A.call(t,i)||o&&("length"==i||V(i,n))||r.push(i);return r}(t,!0):function(t){if(!et(t))return function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}(t);var e,r,n=(r=(e=t)&&e.constructor,e===("function"==typeof r&&r.prototype||O)),o=[];for(var i in t)("constructor"!=i||!n&&A.call(t,i))&&o.push(i);return o}(t)}var ot,it,st=(ot=function(t,e){return null==t?{}:(e=y(function t(e,r,n,o,i){var s=-1,a=e.length;for(n||(n=G),i||(i=[]);++s<a;){var u=e[s];r>0&&n(u)?r>1?t(u,r-1,n,o,i):d(i,u):o||(i[i.length]=u)}return i}(e,1),W),function(t,e){return function(t,e,r){for(var n=-1,o=e.length,i={};++n<o;){var s=e[n],a=t[s];r(a,s)&&(i[s]=a)}return i}(t=Object(t),e,function(e,r){return r in t})}(t,function(t,e,r,n){var o=-1,i=h,s=!0,a=t.length,u=[],c=e.length;if(!a)return u;e.length>=200&&(i=b,s=!1,e=new F(e));t:for(;++o<a;){var l=t[o],f=l;if(l=0!==l?l:0,s&&f==f){for(var p=c;p--;)if(e[p]===f)continue t;u.push(l)}else i(e,f,void 0)||u.push(l)}return u}(function(t){return function(t,e,r){var n=nt(t);return Y(t)?n:d(n,r(t))}(t,0,J)}(t),e)))},it=L(void 0===it?ot.length-1:it,0),function(){for(var t=arguments,e=-1,r=L(t.length-it,0),n=Array(r);++e<r;)n[e]=t[it+e];e=-1;for(var o=Array(it+1);++e<it;)o[e]=t[e];return o[it]=n,function(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}(ot,this,o)});function at(){return[]}w=st}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var S={},O=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!_(t))throw new Error("`err` must be an Error");if(!Array.isArray(e))throw new Error("`fields` must be an Array");var r={};return Object.getOwnPropertyNames(Object.getPrototypeOf(t)).concat(Object.getOwnPropertyNames(t)).forEach(function(e){"function"!=typeof t[e]&&(r[e]=t[e])}),!r.name&&t.constructor.name&&(r.name=t.constructor.name),Array.isArray(e)&&0!==e.length?r.filter(function(t){return e.includes(t)}):r},T={};function j(t){return(j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}T=k,k.default=k,k.stable=C,k.stableStringify=C;var E=[],A=[];function k(t,e,r){var n;for(function t(e,r,n,o){var i;if("object"==j(e)&&null!==e){for(i=0;i<n.length;i++)if(n[i]===e){var s=Object.getOwnPropertyDescriptor(o,r);return void(void 0!==s.get?s.configurable?(Object.defineProperty(o,r,{value:"[Circular]"}),E.push([o,r,e,s])):A.push([e,r]):(o[r]="[Circular]",E.push([o,r,e])))}if(n.push(e),Array.isArray(e))for(i=0;i<e.length;i++)t(e[i],i,n,e);else{var a=Object.keys(e);for(i=0;i<a.length;i++){var u=a[i];t(e[u],u,n,e)}}n.pop()}}(t,"",[],void 0),n=0===A.length?JSON.stringify(t,e,r):JSON.stringify(t,P(e),r);0!==E.length;){var o=E.pop();4===o.length?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}return n}function x(t,e){return t<e?-1:t>e?1:0}function C(t,e,r){var n,o=function t(e,r,n,o){var i;if("object"==j(e)&&null!==e){for(i=0;i<n.length;i++)if(n[i]===e){var s=Object.getOwnPropertyDescriptor(o,r);return void(void 0!==s.get?s.configurable?(Object.defineProperty(o,r,{value:"[Circular]"}),E.push([o,r,e,s])):A.push([e,r]):(o[r]="[Circular]",E.push([o,r,e])))}if("function"==typeof e.toJSON)return;if(n.push(e),Array.isArray(e))for(i=0;i<e.length;i++)t(e[i],i,n,e);else{var a={},u=Object.keys(e).sort(x);for(i=0;i<u.length;i++){var c=u[i];t(e[c],c,n,e),a[c]=e[c]}if(void 0===o)return a;E.push([o,r,e]),o[r]=a}n.pop()}}(t,"",[],void 0)||t;for(n=0===A.length?JSON.stringify(o,e,r):JSON.stringify(o,P(e),r);0!==E.length;){var i=E.pop();4===i.length?Object.defineProperty(i[0],i[1],i[3]):i[0][i[1]]=i[2]}return n}function P(t){return t=void 0!==t?t:function(t,e){return e},function(e,r){if(A.length>0)for(var n=0;n<A.length;n++){var o=A[n];if(o[1]===e&&o[0]===r){r="[Circular]",A.splice(n,1);break}}return t.call(this,e,r)}}var R={exports:{}};function D(t){if(t)return function(t){for(var e in D.prototype)t[e]=D.prototype[e];return t}(t)}R.exports=D,D.prototype.on=D.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},D.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this},D.prototype.off=D.prototype.removeListener=D.prototype.removeAllListeners=D.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var o=0;o<n.length;o++)if((r=n[o])===e||r.fn===e){n.splice(o,1);break}return 0===n.length&&delete this._callbacks["$"+t],this},D.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),r=this._callbacks["$"+t],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(r){n=0;for(var o=(r=r.slice(0)).length;n<o;++n)r[n].apply(this,e)}return this},D.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},D.prototype.hasListeners=function(t){return!!this.listeners(t).length},R=R.exports;var N=String.prototype.replace,I=/%20/g,L={default:"RFC3986",formatters:{RFC1738:function(t){return N.call(t,I,"+")},RFC3986:function(t){return String(t)}},RFC1738:"RFC1738",RFC3986:"RFC3986"};function q(t){return(q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var H=Object.prototype.hasOwnProperty,M=Array.isArray,U=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),z={combine:function(t,e){return[].concat(t,e)},compact:function(t){for(var e=[{obj:{o:t},prop:"o"}],r=[],n=0;n<e.length;++n)for(var o=e[n],i=o.obj[o.prop],s=Object.keys(i),a=0;a<s.length;++a){var u=s[a],c=i[u];"object"==q(c)&&null!==c&&-1===r.indexOf(c)&&(e.push({obj:i,prop:u}),r.push(c))}return function(t){for(;t.length>1;){var e=t.pop(),r=e.obj[e.prop];if(M(r)){for(var n=[],o=0;o<r.length;++o)void 0!==r[o]&&n.push(r[o]);e.obj[e.prop]=n}}}(e),t},decode:function(t,e,r){var n=t.replace(/\+/g," ");if("iso-8859-1"===r)return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch(o){return n}},encode:function(t,e,r,n,o){if(0===t.length)return t;var i=t;if("symbol"==q(t)?i=Symbol.prototype.toString.call(t):"string"!=typeof t&&(i=String(t)),"iso-8859-1"===r)return escape(i).replace(/%u[0-9a-f]{4}/gi,function(t){return"%26%23"+parseInt(t.slice(2),16)+"%3B"});for(var s="",a=0;a<i.length;++a){var u=i.charCodeAt(a);45===u||46===u||95===u||126===u||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||o===L.RFC1738&&(40===u||41===u)?s+=i.charAt(a):u<128?s+=U[u]:u<2048?s+=U[192|u>>6]+U[128|63&u]:u<55296||u>=57344?s+=U[224|u>>12]+U[128|u>>6&63]+U[128|63&u]:(a+=1,u=65536+((1023&u)<<10|1023&i.charCodeAt(a)),s+=U[240|u>>18]+U[128|u>>12&63]+U[128|u>>6&63]+U[128|63&u])}return s},isBuffer:function(t){return!(!t||"object"!=q(t)||!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t)))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,e){if(M(t)){for(var r=[],n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)},merge:function t(e,r,n){if(!r)return e;if("object"!=q(r)){if(M(e))e.push(r);else{if(!e||"object"!=q(e))return[e,r];(n&&(n.plainObjects||n.allowPrototypes)||!H.call(Object.prototype,r))&&(e[r]=!0)}return e}if(!e||"object"!=q(e))return[e].concat(r);var o=e;return M(e)&&!M(r)&&(o=function(t,e){for(var r=e&&e.plainObjects?Object.create(null):{},n=0;n<t.length;++n)void 0!==t[n]&&(r[n]=t[n]);return r}(e,n)),M(e)&&M(r)?(r.forEach(function(r,o){if(H.call(e,o)){var i=e[o];i&&"object"==q(i)&&r&&"object"==q(r)?e[o]=t(i,r,n):e.push(r)}else e[o]=r}),e):Object.keys(r).reduce(function(e,o){var i=r[o];return H.call(e,o)?e[o]=t(e[o],i,n):e[o]=i,e},o)}};function F(t){return(F="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var $=Object.prototype.hasOwnProperty,B={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},X=Array.isArray,Q=Array.prototype.push,J=function(t,e){Q.apply(t,X(e)?e:[e])},G=Date.prototype.toISOString,V=L.default,W={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:z.encode,encodeValuesOnly:!1,format:V,formatter:L.formatters[V],indices:!1,serializeDate:function(t){return G.call(t)},skipNulls:!1,strictNullHandling:!1},K=function t(e,r,n,o,i,s,a,u,c,l,f,p,h,y){var d,m=e;if("function"==typeof a?m=a(r,m):m instanceof Date?m=l(m):"comma"===n&&X(m)&&(m=z.maybeMap(m,function(t){return t instanceof Date?l(t):t})),null===m){if(o)return s&&!h?s(r,W.encoder,y,"key",f):r;m=""}if("string"==typeof(d=m)||"number"==typeof d||"boolean"==typeof d||"symbol"==F(d)||"bigint"==typeof d||z.isBuffer(m))return s?[p(h?r:s(r,W.encoder,y,"key",f))+"="+p(s(m,W.encoder,y,"value",f))]:[p(r)+"="+p(String(m))];var b,v=[];if(void 0===m)return v;if("comma"===n&&X(m))b=[{value:m.length>0?m.join(",")||null:void 0}];else if(X(a))b=a;else{var g=Object.keys(m);b=u?g.sort(u):g}for(var _=0;_<b.length;++_){var w=b[_],S="object"==F(w)&&void 0!==w.value?w.value:m[w];if(!i||null!==S){var O=X(m)?"function"==typeof n?n(r,w):r:r+(c?"."+w:"["+w+"]");J(v,t(S,O,n,o,i,s,a,u,c,l,f,p,h,y))}}return v},Y=(Object.prototype.hasOwnProperty,Array.isArray,{stringify:function(t,e){var r,n=t,o=function(t){if(!t)return W;if(null!==t.encoder&&void 0!==t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var e=t.charset||W.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=L.default;if(void 0!==t.format){if(!$.call(L.formatters,t.format))throw new TypeError("Unknown format option provided.");r=t.format}var n=L.formatters[r],o=W.filter;return("function"==typeof t.filter||X(t.filter))&&(o=t.filter),{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:W.addQueryPrefix,allowDots:void 0===t.allowDots?W.allowDots:!!t.allowDots,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:W.charsetSentinel,delimiter:void 0===t.delimiter?W.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:W.encode,encoder:"function"==typeof t.encoder?t.encoder:W.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:W.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:W.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:W.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:W.strictNullHandling}}(e);"function"==typeof o.filter?n=(0,o.filter)("",n):X(o.filter)&&(r=o.filter);var i,s=[];if("object"!=F(n)||null===n)return"";i=e&&e.arrayFormat in B?e.arrayFormat:e&&"indices"in e?e.indices?"indices":"repeat":"indices";var a=B[i];r||(r=Object.keys(n)),o.sort&&r.sort(o.sort);for(var u=0;u<r.length;++u){var c=r[u];o.skipNulls&&null===n[c]||J(s,K(n[c],c,a,o.strictNullHandling,o.skipNulls,o.encode?o.encoder:null,o.filter,o.sort,o.allowDots,o.serializeDate,o.format,o.formatter,o.encodeValuesOnly,o.charset))}var l=s.join(o.delimiter),f=!0===o.addQueryPrefix?"?":"";return o.charsetSentinel&&("iso-8859-1"===o.charset?f+="utf8=%26%2310003%3B&":f+="utf8=%E2%9C%93&"),l.length>0?f+l:""}});function Z(t){return(Z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function tt(t){return(tt="function"==typeof Symbol&&"symbol"==Z(Symbol.iterator)?function(t){return Z(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":Z(t)})(t)}var et=function(t){return null!==t&&"object"===tt(t)},rt={};function nt(t){return(nt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ot(t){return(ot="function"==typeof Symbol&&"symbol"==nt(Symbol.iterator)?function(t){return nt(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":nt(t)})(t)}function it(t){if(t)return function(t){for(var e in it.prototype)Object.prototype.hasOwnProperty.call(it.prototype,e)&&(t[e]=it.prototype[e]);return t}(t)}rt=it,it.prototype.clearTimeout=function(){return clearTimeout(this._timer),clearTimeout(this._responseTimeoutTimer),clearTimeout(this._uploadTimeoutTimer),delete this._timer,delete this._responseTimeoutTimer,delete this._uploadTimeoutTimer,this},it.prototype.parse=function(t){return this._parser=t,this},it.prototype.responseType=function(t){return this._responseType=t,this},it.prototype.serialize=function(t){return this._serializer=t,this},it.prototype.timeout=function(t){if(!t||"object"!==ot(t))return this._timeout=t,this._responseTimeout=0,this._uploadTimeout=0,this;for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))switch(e){case"deadline":this._timeout=t.deadline;break;case"response":this._responseTimeout=t.response;break;case"upload":this._uploadTimeout=t.upload;break;default:console.warn("Unknown timeout option",e)}return this},it.prototype.retry=function(t,e){return 0!==arguments.length&&!0!==t||(t=1),t<=0&&(t=0),this._maxRetries=t,this._retries=0,this._retryCallback=e,this};var st=new Set(["ETIMEDOUT","ECONNRESET","EADDRINUSE","ECONNREFUSED","EPIPE","ENOTFOUND","ENETUNREACH","EAI_AGAIN"]),at=new Set([408,413,429,500,502,503,504,521,522,524]);it.prototype._shouldRetry=function(t,e){if(!this._maxRetries||this._retries++>=this._maxRetries)return!1;if(this._retryCallback)try{var r=this._retryCallback(t,e);if(!0===r)return!0;if(!1===r)return!1}catch(n){console.error(n)}if(e&&e.status&&at.has(e.status))return!0;if(t){if(t.code&&st.has(t.code))return!0;if(t.timeout&&"ECONNABORTED"===t.code)return!0;if(t.crossDomain)return!0}return!1},it.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this.timedoutError=null,this._end()},it.prototype.then=function(t,e){var r=this;if(!this._fullfilledPromise){var n=this;this._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise(function(t,e){n.on("abort",function(){if(!(r._maxRetries&&r._maxRetries>r._retries))if(r.timedout&&r.timedoutError)e(r.timedoutError);else{var t=new Error("Aborted");t.code="ABORTED",t.status=r.status,t.method=r.method,t.url=r.url,e(t)}}),n.end(function(r,n){r?e(r):t(n)})})}return this._fullfilledPromise.then(t,e)},it.prototype.catch=function(t){return this.then(void 0,t)},it.prototype.use=function(t){return t(this),this},it.prototype.ok=function(t){if("function"!=typeof t)throw new Error("Callback required");return this._okCallback=t,this},it.prototype._isResponseOK=function(t){return!!t&&(this._okCallback?this._okCallback(t):t.status>=200&&t.status<300)},it.prototype.get=function(t){return this._header[t.toLowerCase()]},it.prototype.getHeader=it.prototype.get,it.prototype.set=function(t,e){if(et(t)){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&this.set(r,t[r]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},it.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},it.prototype.field=function(t,e){if(null==t)throw new Error(".field(name, val) name can not be empty");if(this._data)throw new Error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()");if(et(t)){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&this.field(r,t[r]);return this}if(Array.isArray(e)){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&this.field(t,e[n]);return this}if(null==e)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof e&&(e=String(e)),this._getFormData().append(t,e),this},it.prototype.abort=function(){return this._aborted?this:(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort"),this)},it.prototype._auth=function(t,e,r,n){switch(r.type){case"basic":this.set("Authorization","Basic ".concat(n("".concat(t,":").concat(e))));break;case"auto":this.username=t,this.password=e;break;case"bearer":this.set("Authorization","Bearer ".concat(t))}return this},it.prototype.withCredentials=function(t){return void 0===t&&(t=!0),this._withCredentials=t,this},it.prototype.redirects=function(t){return this._maxRedirects=t,this},it.prototype.maxResponseSize=function(t){if("number"!=typeof t)throw new TypeError("Invalid argument");return this._maxResponseSize=t,this},it.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},it.prototype.send=function(t){var e=et(t),r=this._header["content-type"];if(this._formData)throw new Error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()");if(e&&!this._data)Array.isArray(t)?this._data=[]:this._isHost(t)||(this._data={});else if(t&&this._data&&this._isHost(this._data))throw new Error("Can't merge these send calls");if(e&&et(this._data))for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(this._data[n]=t[n]);else"string"==typeof t?(r||this.type("form"),(r=this._header["content-type"])&&(r=r.toLowerCase().trim()),this._data="application/x-www-form-urlencoded"===r?this._data?"".concat(this._data,"&").concat(t):t:(this._data||"")+t):this._data=t;return!e||this._isHost(t)?this:(r||this.type("json"),this)},it.prototype.sortQuery=function(t){return this._sort=void 0===t||t,this},it.prototype._finalizeQueryString=function(){var t=this._query.join("&");if(t&&(this.url+=(this.url.includes("?")?"&":"?")+t),this._query.length=0,this._sort){var e=this.url.indexOf("?");if(e>=0){var r=this.url.slice(e+1).split("&");"function"==typeof this._sort?r.sort(this._sort):r.sort(),this.url=this.url.slice(0,e)+"?"+r.join("&")}}},it.prototype._appendQueryString=function(){console.warn("Unsupported")},it.prototype._timeoutError=function(t,e,r){if(!this._aborted){var n=new Error("".concat(t+e,"ms exceeded"));n.timeout=e,n.code="ECONNABORTED",n.errno=r,this.timedout=!0,this.timedoutError=n,this.abort(),this.callback(n)}},it.prototype._setTimeouts=function(){var t=this;this._timeout&&!this._timer&&(this._timer=setTimeout(function(){t._timeoutError("Timeout of ",t._timeout,"ETIME")},this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout(function(){t._timeoutError("Response timeout of ",t._responseTimeout,"ETIMEDOUT")},this._responseTimeout))};var ut={};function ct(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return lt(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?lt(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,a=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return s=t.done,t},e:function(t){a=!0,i=t},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw i}}}}function lt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}ut.type=function(t){return t.split(/ *; */).shift()},ut.params=function(t){var e,r={},n=ct(t.split(/ *; */));try{for(n.s();!(e=n.n()).done;){var o=e.value.split(/ *= */),i=o.shift(),s=o.shift();i&&s&&(r[i]=s)}}catch(a){n.e(a)}finally{n.f()}return r},ut.parseLinks=function(t){var e,r={},n=ct(t.split(/ *, */));try{for(n.s();!(e=n.n()).done;){var o=e.value.split(/ *; */),i=o[0].slice(1,-1);r[o[1].split(/ *= */)[1].slice(1,-1)]=i}}catch(s){n.e(s)}finally{n.f()}return r};var ft={};function pt(t){if(t)return function(t){for(var e in pt.prototype)Object.prototype.hasOwnProperty.call(pt.prototype,e)&&(t[e]=pt.prototype[e]);return t}(t)}ft=pt,pt.prototype.get=function(t){return this.header[t.toLowerCase()]},pt.prototype._setHeaderProperties=function(t){var e=t["content-type"]||"";this.type=ut.type(e);var r=ut.params(e);for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(this[n]=r[n]);this.links={};try{t.link&&(this.links=ut.parseLinks(t.link))}catch(o){}},pt.prototype._setStatusProperties=function(t){var e=t/100|0;this.statusCode=t,this.status=this.statusCode,this.statusType=e,this.info=1===e,this.ok=2===e,this.redirect=3===e,this.clientError=4===e,this.serverError=5===e,this.error=(4===e||5===e)&&this.toError(),this.created=201===t,this.accepted=202===t,this.noContent=204===t,this.badRequest=400===t,this.unauthorized=401===t,this.notAcceptable=406===t,this.forbidden=403===t,this.notFound=404===t,this.unprocessableEntity=422===t};var ht={};function yt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function dt(){this._defaults=[]}["use","on","once","set","query","type","accept","auth","withCredentials","sortQuery","retry","ok","redirects","timeout","buffer","serialize","parse","ca","key","pfx","cert","disableTLSCerts"].forEach(function(t){dt.prototype[t]=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return this._defaults.push({fn:t,args:r}),this}}),dt.prototype._setDefaults=function(t){this._defaults.forEach(function(e){var r;t[e.fn].apply(t,function(t){if(Array.isArray(t))return yt(t)}(r=e.args)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(r)||function(t,e){if(t){if("string"==typeof t)return yt(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?yt(t,void 0):void 0}}(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())})},ht=dt;var mt,bt={};function vt(t){return(vt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function gt(t){return(gt="function"==typeof Symbol&&"symbol"==vt(Symbol.iterator)?function(t){return vt(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":vt(t)})(t)}function _t(){}"undefined"!=typeof window?mt=window:"undefined"==typeof self?(console.warn("Using browser-only version of superagent in non-browser environment"),mt=void 0):mt=self;var wt=bt=bt=function(t,e){return"function"==typeof e?new bt.Request("GET",t).end(e):1===arguments.length?new bt.Request("GET",t):new bt.Request(t,e)};bt.Request=kt,wt.getXHR=function(){if(mt.XMLHttpRequest&&(!mt.location||"file:"!==mt.location.protocol||!mt.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(r){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(n){}throw new Error("Browser-only version of superagent could not find XHR")};var St="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};function Ot(t){if(!et(t))return t;var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&Tt(e,r,t[r]);return e.join("&")}function Tt(t,e,r){if(void 0!==r)if(null!==r)if(Array.isArray(r))r.forEach(function(r){Tt(t,e,r)});else if(et(r))for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&Tt(t,"".concat(e,"[").concat(n,"]"),r[n]);else t.push(encodeURI(e)+"="+encodeURIComponent(r));else t.push(encodeURI(e))}function jt(t){for(var e,r,n={},o=t.split("&"),i=0,s=o.length;i<s;++i)-1===(r=(e=o[i]).indexOf("="))?n[decodeURIComponent(e)]="":n[decodeURIComponent(e.slice(0,r))]=decodeURIComponent(e.slice(r+1));return n}function Et(t){return/[/+]json($|[^-\w])/i.test(t)}function At(t){this.req=t,this.xhr=this.req.xhr,this.text="HEAD"!==this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||void 0===this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText;var e=this.xhr.status;1223===e&&(e=204),this._setStatusProperties(e),this.headers=function(t){for(var e,r,n,o,i=t.split(/\r?\n/),s={},a=0,u=i.length;a<u;++a)-1!==(e=(r=i[a]).indexOf(":"))&&(n=r.slice(0,e).toLowerCase(),o=St(r.slice(e+1)),s[n]=o);return s}(this.xhr.getAllResponseHeaders()),this.header=this.headers,this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this._setHeaderProperties(this.header),null===this.text&&t._responseType?this.body=this.xhr.response:this.body="HEAD"===this.req.method?null:this._parseBody(this.text?this.text:this.xhr.response)}function kt(t,e){var r=this;this._query=this._query||[],this.method=t,this.url=e,this.header={},this._header={},this.on("end",function(){var t,e=null,n=null;try{n=new At(r)}catch(o){return(e=new Error("Parser is unable to parse the response")).parse=!0,e.original=o,r.xhr?(e.rawResponse=void 0===r.xhr.responseType?r.xhr.responseText:r.xhr.response,e.status=r.xhr.status?r.xhr.status:null,e.statusCode=e.status):(e.rawResponse=null,e.status=null),r.callback(e)}r.emit("response",n);try{r._isResponseOK(n)||(t=new Error(n.statusText||n.text||"Unsuccessful HTTP response"))}catch(o){t=o}t?(t.original=e,t.response=n,t.status=n.status,r.callback(t,n)):r.callback(null,n)})}function xt(t,e,r){var n=wt("DELETE",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n}wt.serializeObject=Ot,wt.parseString=jt,wt.types={html:"text/html",json:"application/json",xml:"text/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},wt.serialize={"application/x-www-form-urlencoded":Y.stringify,"application/json":T},wt.parse={"application/x-www-form-urlencoded":jt,"application/json":JSON.parse},ft(At.prototype),At.prototype._parseBody=function(t){var e=wt.parse[this.type];return this.req._parser?this.req._parser(this,t):(!e&&Et(this.type)&&(e=wt.parse["application/json"]),e&&t&&(t.length>0||t instanceof Object)?e(t):null)},At.prototype.toError=function(){var t=this.req,e=t.method,r=t.url,n="cannot ".concat(e," ").concat(r," (").concat(this.status,")"),o=new Error(n);return o.status=this.status,o.method=e,o.url=r,o},wt.Response=At,R(kt.prototype),rt(kt.prototype),kt.prototype.type=function(t){return this.set("Content-Type",wt.types[t]||t),this},kt.prototype.accept=function(t){return this.set("Accept",wt.types[t]||t),this},kt.prototype.auth=function(t,e,r){return 1===arguments.length&&(e=""),"object"===gt(e)&&null!==e&&(r=e,e=""),r||(r={type:"function"==typeof btoa?"basic":"auto"}),this._auth(t,e,r,function(t){if("function"==typeof btoa)return btoa(t);throw new Error("Cannot use basic auth, btoa is not a function")})},kt.prototype.query=function(t){return"string"!=typeof t&&(t=Ot(t)),t&&this._query.push(t),this},kt.prototype.attach=function(t,e,r){if(e){if(this._data)throw new Error("superagent can't mix .send() and .attach()");this._getFormData().append(t,e,r||e.name)}return this},kt.prototype._getFormData=function(){return this._formData||(this._formData=new mt.FormData),this._formData},kt.prototype.callback=function(t,e){if(this._shouldRetry(t,e))return this._retry();var r=this._callback;this.clearTimeout(),t&&(this._maxRetries&&(t.retries=this._retries-1),this.emit("error",t)),r(t,e)},kt.prototype.crossDomainError=function(){var t=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");t.crossDomain=!0,t.status=this.status,t.method=this.method,t.url=this.url,this.callback(t)},kt.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},kt.prototype.ca=kt.prototype.agent,kt.prototype.buffer=kt.prototype.ca,kt.prototype.write=function(){throw new Error("Streaming is not supported in browser version of superagent")},kt.prototype.pipe=kt.prototype.write,kt.prototype._isHost=function(t){return t&&"object"===gt(t)&&!Array.isArray(t)&&"[object Object]"!==Object.prototype.toString.call(t)},kt.prototype.end=function(t){this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=t||_t,this._finalizeQueryString(),this._end()},kt.prototype._setUploadTimeout=function(){var t=this;this._uploadTimeout&&!this._uploadTimeoutTimer&&(this._uploadTimeoutTimer=setTimeout(function(){t._timeoutError("Upload timeout of ",t._uploadTimeout,"ETIMEDOUT")},this._uploadTimeout))},kt.prototype._end=function(){if(this._aborted)return this.callback(new Error("The request has been aborted even before .end() was called"));var t=this;this.xhr=wt.getXHR();var e=this.xhr,r=this._formData||this._data;this._setTimeouts(),e.onreadystatechange=function(){var r=e.readyState;if(r>=2&&t._responseTimeoutTimer&&clearTimeout(t._responseTimeoutTimer),4===r){var n;try{n=e.status}catch(o){n=0}if(!n){if(t.timedout||t._aborted)return;return t.crossDomainError()}t.emit("end")}};var n=function(e,r){r.total>0&&(r.percent=r.loaded/r.total*100,100===r.percent&&clearTimeout(t._uploadTimeoutTimer)),r.direction=e,t.emit("progress",r)};if(this.hasListeners("progress"))try{e.addEventListener("progress",n.bind(null,"download")),e.upload&&e.upload.addEventListener("progress",n.bind(null,"upload"))}catch(a){}e.upload&&this._setUploadTimeout();try{this.username&&this.password?e.open(this.method,this.url,!0,this.username,this.password):e.open(this.method,this.url,!0)}catch(u){return this.callback(u)}if(this._withCredentials&&(e.withCredentials=!0),!this._formData&&"GET"!==this.method&&"HEAD"!==this.method&&"string"!=typeof r&&!this._isHost(r)){var o=this._header["content-type"],i=this._serializer||wt.serialize[o?o.split(";")[0]:""];!i&&Et(o)&&(i=wt.serialize["application/json"]),i&&(r=i(r))}for(var s in this.header)null!==this.header[s]&&Object.prototype.hasOwnProperty.call(this.header,s)&&e.setRequestHeader(s,this.header[s]);this._responseType&&(e.responseType=this._responseType),this.emit("request",this),e.send(void 0===r?null:r)},wt.agent=function(){return new ht},["GET","POST","OPTIONS","PATCH","PUT","DELETE"].forEach(function(t){ht.prototype[t.toLowerCase()]=function(e,r){var n=new wt.Request(t,e);return this._setDefaults(n),r&&n.end(r),n}}),ht.prototype.del=ht.prototype.delete,wt.get=function(t,e,r){var n=wt("GET",t);return"function"==typeof e&&(r=e,e=null),e&&n.query(e),r&&n.end(r),n},wt.head=function(t,e,r){var n=wt("HEAD",t);return"function"==typeof e&&(r=e,e=null),e&&n.query(e),r&&n.end(r),n},wt.options=function(t,e,r){var n=wt("OPTIONS",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n},wt.del=xt,wt.delete=xt,wt.patch=function(t,e,r){var n=wt("PATCH",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n},wt.post=function(t,e,r){var n=wt("POST",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n},wt.put=function(t,e,r){var n=wt("PUT",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n};var Ct={};Object.defineProperty(Ct,"__esModule",{value:!0}),Ct.boolean=void 0,Ct.boolean=function(t){return"string"==typeof t?["true","t","yes","y","on","1"].includes(t.trim().toLowerCase()):"number"==typeof t?1===t:"boolean"==typeof t&&t};var Pt,Rt,Dt,Nt="7.0.2",It=Pt={};function Lt(){throw new Error("setTimeout has not been defined")}function qt(){throw new Error("clearTimeout has not been defined")}function Ht(t){if(Rt===setTimeout)return setTimeout(t,0);if((Rt===Lt||!Rt)&&setTimeout)return Rt=setTimeout,setTimeout(t,0);try{return Rt(t,0)}catch(e){try{return Rt.call(null,t,0)}catch(e){return Rt.call(this,t,0)}}}!function(){try{Rt="function"==typeof setTimeout?setTimeout:Lt}catch(t){Rt=Lt}try{Dt="function"==typeof clearTimeout?clearTimeout:qt}catch(t){Dt=qt}}();var Mt,Ut=[],zt=!1,Ft=-1;function $t(){zt&&Mt&&(zt=!1,Mt.length?Ut=Mt.concat(Ut):Ft=-1,Ut.length&&Bt())}function Bt(){if(!zt){var t=Ht($t);zt=!0;for(var e=Ut.length;e;){for(Mt=Ut,Ut=[];++Ft<e;)Mt&&Mt[Ft].run();Ft=-1,e=Ut.length}Mt=null,zt=!1,function(t){if(Dt===clearTimeout)return clearTimeout(t);if((Dt===qt||!Dt)&&clearTimeout)return Dt=clearTimeout,clearTimeout(t);try{Dt(t)}catch(e){try{return Dt.call(null,t)}catch(e){return Dt.call(this,t)}}}(t)}}function Xt(t,e){this.fun=t,this.array=e}function Qt(){}It.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];Ut.push(new Xt(t,e)),1!==Ut.length||zt||Ht(Bt)},Xt.prototype.run=function(){this.fun.apply(null,this.array)},It.title="browser",It.browser=!0,It.env={},It.argv=[],It.version="",It.versions={},It.on=Qt,It.addListener=Qt,It.once=Qt,It.off=Qt,It.removeListener=Qt,It.removeAllListeners=Qt,It.emit=Qt,It.prependListener=Qt,It.prependOnceListener=Qt,It.listeners=function(t){return[]},It.binding=function(t){throw new Error("process.binding is not supported")},It.cwd=function(){return"/"},It.chdir=function(t){throw new Error("process.chdir is not supported")},It.umask=function(){return 0};var Jt={};return function(t){(function(){"use strict";function e(t){return function(t){if(Array.isArray(t))return o(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||n(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=n(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var o=0,i=function(){};return{s:i,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function n(t,e){if(t){if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var a=Ct.boolean,u=new Set(["config","log"]),c=["trace","debug","info","warn","error","fatal"],f={warning:"warn",err:"error"},p="https://api.cabinjs.com",h="`level` invalid, must be: ".concat(c.join(", "));function y(t){return null==t||"object"==s(t)&&0===Object.keys(t).length||"string"==typeof t&&0===t.trim().length}function d(t){return void 0===t}function m(t){return"object"==s(t)&&null!==t&&!Array.isArray(t)}function b(t){return"string"==typeof t}function j(t){return"function"==typeof t}Jt=function(){function n(){var o=this,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),this.config=Object.assign({key:"",endpoint:p,headers:{},timeout:5e3,retry:3,showStack:!t.env.SHOW_STACK||a(t.env.SHOW_STACK),showMeta:!t.env.SHOW_META||a(t.env.SHOW_META),silent:!1,logger:console,name:!1,level:"info",levels:["info","warn","error","fatal"],capture:!1,callback:!1,appInfo:!t.env.APP_INFO||a(t.env.APP_INFO)},i),this.appInfo=!!this.config.appInfo&&!!j(S)&&S(),this.log=this.log.bind(this);var s,l=r(Object.keys(this.config.logger).filter(function(t){return!u.has(t)}));try{for(l.s();!(s=l.n()).done;){var f=s.value;this[f]=this.config.logger[f]}}catch(m){l.e(m)}finally{l.f()}var h,y=r(c);try{var d=function(){var t=h.value;o[t]=function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return o.log.apply(o,e([t].concat([].slice.call(n))))}};for(y.s();!(h=y.n()).done;)d()}catch(m){y.e(m)}finally{y.f()}this.setLevel=this.setLevel.bind(this),this.getNormalizedLevel=this.getNormalizedLevel.bind(this),this.setName=this.setName.bind(this),this.setCallback=this.setCallback.bind(this),this.config.name&&this.setName(this.config.name),this.setLevel(this.config.level),this.err=this.error,this.warning=this.warn}var o,s,E;return o=n,(s=[{key:"setCallback",value:function(t){this.config.callback=t}},{key:"setLevel",value:function(t){if(!b(t)||!c.includes(t))throw new Error(h);b(this.config.logger.logLevel)?this.config.logger.logLevel=t:this.config.logger.level=t,this.config.levels=c.slice(c.indexOf(t))}},{key:"getNormalizedLevel",value:function(t){return b(t)?b(f[t])?f[t]:c.includes(t)?t:"info":"info"}},{key:"setName",value:function(t){if(!b(t))throw new Error("`name` must be a String");b(this.config.logger.scope)?this.config.logger.scope=t:this.config.logger.name=t}},{key:"log",value:function(r,n,o){for(var i=this,s=[],a=arguments.length,u=new Array(a>3?a-3:0),h=3;h<a;h++)u[h-3]=arguments[h];d(r)||s.push(r),d(n)||s.push(n),d(o)||s.push(o),s=s.concat([].slice.call(u));var S=this.config,E=0;b(r)&&b(f[r])?r=f[r]:_(r)?(o=n,n=r,r="error"):b(r)&&c.includes(r)||(o=n,n=r,r=this.getNormalizedLevel(r),E=-1);var A,k=!1;if((m(n)||Array.isArray(n))&&b(o)){k=!0;var x=o;o=n,n=b(x)&&s.length>=3+E?v.apply(void 0,e(s.slice(2+E))):x}d(n)&&(n=r),1!==s.slice(1+E).length||b(n)||_(n)?!k&&s.length>=4+E?(n=v.apply(void 0,e(s.slice(1+E))),o={}):!k&&s.length===3+E&&b(n)&&g.filter(function(t){return n.includes(t)}).length>0?(n=v(n,o),o={}):_(n)||(_(o)?o={err:O(o)}:m(o)||d(o)||null===o?b(n)||(n=v(n)):(n=v(n,o),o={})):(o={message:n},n=r),d(o)||m(o)?m(o)||(o={}):o={meta:o},_(n)?(A=n,m(o.err)||(o.err=O(A)),n=n.message):_(o.err)&&(A=o.err);var C=j(S.callback)&&(!("boolean"==typeof o.callback)||o.callback);(o=w(o,["callback"])).level=r,this.appInfo&&(o.app=this.appInfo);var P=T({message:n,meta:o});if(S.capture&&S.levels.includes(r)&&(!_(A)||!A._captureFailed)){if(S.endpoint===p&&!S.key)throw new Error("Cabin API key required (e.g. `{ key: 'YOUR-CABIN-API-KEY' })`)\n<https://cabinjs.com>");var R=bt.post(S.endpoint).set("X-Request-Id",l()).timeout(S.timeout);t.browser||R.set("User-Agent","axe/".concat(Nt)),S.key&&R.auth(S.key),y(S.headers)||R.set(S.headers),R.type("application/json").send(P).retry(S.retry).end(function(t){t&&(t._captureFailed=!0,i.config.logger.error(t))})}if(C&&S.callback(r,n,o),S.silent)return P;if(!S.levels.includes(r))return P;var D=r;-1===E?D="log":"fatal"===r&&(D="error");var N=w(o,["level","err"]);return"error"===D&&_(A)&&S.showStack?!S.showMeta||y(N)?this.config.logger.error(A):this.config.logger.error(A,N):!S.showMeta||y(N)?this.config.logger[D](n):this.config.logger[D](n,N),P}}])&&i(o.prototype,s),E&&i(o,E),n}()}).call(this)}.call(this,Pt),Jt});
1
+ !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Axe=t()}}(function(){!function(t){"use strict";t.console||(t.console={});for(var e,r,n=t.console,o=function(){},i=["memory"],s="assert,clear,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn".split(",");e=i.pop();)n[e]||(n[e]={});for(;r=s.pop();)n[r]||(n[r]=o)}("undefined"==typeof window?void 0:window);var t=function(t,e){var r="000000000"+t;return r.substr(r.length-e)};function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var r,n="object"==("undefined"==typeof window?"undefined":e(window))?window:self,o=Object.keys(n).length,i=t(((navigator.mimeTypes?navigator.mimeTypes.length:0)+navigator.userAgent.length).toString(36)+o.toString(36),4),s=function(){return i},a="undefined"!=typeof window&&(window.crypto||window.msCrypto)||"undefined"!=typeof self&&self.crypto;if(a){var u=Math.pow(2,32)-1;r=function(){return Math.abs(a.getRandomValues(new Uint32Array(1))[0]/u)}}else r=Math.random;var c=r,l={},f=0,p=4,h=36,y=Math.pow(h,p);function d(){return t((c()*y<<0).toString(h),p)}function m(){return f=f<y?f:0,++f-1}function b(){return"c"+(new Date).getTime().toString(h)+t(m().toString(h),p)+s()+(d()+d())}b.slug=function(){var t=(new Date).getTime().toString(36),e=m().toString(36).slice(-4),r=s().slice(0,1)+s().slice(-1),n=d().slice(-2);return t.slice(-2)+e+r+n},b.isCuid=function(t){return"string"==typeof t&&!!t.startsWith("c")},b.isSlug=function(t){if("string"!=typeof t)return!1;var e=t.length;return e>=7&&e<=10},b.fingerprint=s,l=b;var v=function(t){var e=Array.prototype.slice.call(arguments,1);return e.length&&(t=t.toString().replace(/(%?)(%([jds]))/g,function(t,r,n,o){var i=e.shift();switch(o){case"s":i=""+i;break;case"d":i=Number(i);break;case"j":i=JSON.stringify(i)}return r?(e.unshift(i),t):i})),e.length&&(t=t.toString()+" "+e.join(" ")),""+t.toString().replace(/%{2,2}/g,"%")},g=["%s","%d","%i","%f","%j","%o","%O","%%"],_=function(t){switch(Object.prototype.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return t instanceof Error}},w={};(function(t){(function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var r=1/0,n=9007199254740991,o="[object Arguments]",i="[object Function]",s="[object GeneratorFunction]",a="[object Symbol]",u=/^\[object .+?Constructor\]$/,c=/^(?:0|[1-9]\d*)$/,l="object"==(void 0===t?"undefined":e(t))&&t&&t.Object===Object&&t,f="object"==("undefined"==typeof self?"undefined":e(self))&&self&&self.Object===Object&&self,p=l||f||Function("return this")();function h(t,e){return!(!t||!t.length)&&function(t,e,r){if(e!=e)return function(t,e,r,n){for(var o=t.length,i=-1;++i<o;)if(e(t[i],i,t))return i;return-1}(t,m);for(var n=-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1}(t,e)>-1}function y(t,e){for(var r=-1,n=t?t.length:0,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}function d(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}function m(t){return t!=t}function b(t,e){return t.has(e)}function v(t,e){return function(r){return t(e(r))}}var g,_=Array.prototype,S=Function.prototype,O=Object.prototype,T=p["__core-js_shared__"],j=(g=/[^.]+$/.exec(T&&T.keys&&T.keys.IE_PROTO||""))?"Symbol(src)_1."+g:"",E=S.toString,A=O.hasOwnProperty,k=O.toString,x=RegExp("^"+E.call(A).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),C=p.Symbol,P=v(Object.getPrototypeOf,Object),R=O.propertyIsEnumerable,D=_.splice,N=C?C.isConcatSpreadable:void 0,I=Object.getOwnPropertySymbols,L=Math.max,H=X(p,"Map"),q=X(Object,"create");function M(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function U(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function F(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function z(t){var e=-1,r=t?t.length:0;for(this.__data__=new F;++e<r;)this.add(t[e])}function $(t,e){for(var r,n,o=t.length;o--;)if((r=t[o][0])===(n=e)||r!=r&&n!=n)return o;return-1}function B(t,r){var n,o,i=t.__data__;return("string"==(o=e(n=r))||"number"==o||"symbol"==o||"boolean"==o?"__proto__"!==n:null===n)?i["string"==typeof r?"string":"hash"]:i.map}function X(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){return!(!et(t)||(e=t,j&&j in e))&&(tt(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(r){}return e}(t)?x:u).test(function(t){if(null!=t){try{return E.call(t)}catch(e){}try{return t+""}catch(e){}}return""}(t));var e}(r)?r:void 0}M.prototype.clear=function(){this.__data__=q?q(null):{}},M.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},M.prototype.get=function(t){var e=this.__data__;if(q){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return A.call(e,t)?e[t]:void 0},M.prototype.has=function(t){var e=this.__data__;return q?void 0!==e[t]:A.call(e,t)},M.prototype.set=function(t,e){return this.__data__[t]=q&&void 0===e?"__lodash_hash_undefined__":e,this},U.prototype.clear=function(){this.__data__=[]},U.prototype.delete=function(t){var e=this.__data__,r=$(e,t);return!(r<0||(r==e.length-1?e.pop():D.call(e,r,1),0))},U.prototype.get=function(t){var e=this.__data__,r=$(e,t);return r<0?void 0:e[r][1]},U.prototype.has=function(t){return $(this.__data__,t)>-1},U.prototype.set=function(t,e){var r=this.__data__,n=$(r,t);return n<0?r.push([t,e]):r[n][1]=e,this},F.prototype.clear=function(){this.__data__={hash:new M,map:new(H||U),string:new M}},F.prototype.delete=function(t){return B(this,t).delete(t)},F.prototype.get=function(t){return B(this,t).get(t)},F.prototype.has=function(t){return B(this,t).has(t)},F.prototype.set=function(t,e){return B(this,t).set(t,e),this},z.prototype.add=z.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},z.prototype.has=function(t){return this.__data__.has(t)};var Q=I?v(I,Object):at,W=I?function(t){for(var e=[];t;)d(e,Q(t)),t=P(t);return e}:at;function J(t){return Y(t)||K(t)||!!(N&&t&&t[N])}function G(t,e){return!!(e=null==e?n:e)&&("number"==typeof t||c.test(t))&&t>-1&&t%1==0&&t<e}function V(t){if("string"==typeof t||function(t){return"symbol"==e(t)||rt(t)&&k.call(t)==a}(t))return t;var n=t+"";return"0"==n&&1/t==-r?"-0":n}function K(t){return function(t){return rt(t)&&Z(t)}(t)&&A.call(t,"callee")&&(!R.call(t,"callee")||k.call(t)==o)}var Y=Array.isArray;function Z(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=n}(t.length)&&!tt(t)}function tt(t){var e=et(t)?k.call(t):"";return e==i||e==s}function et(t){var r=e(t);return!!t&&("object"==r||"function"==r)}function rt(t){return!!t&&"object"==e(t)}function nt(t){return Z(t)?function(t,e){var r=Y(t)||K(t)?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],n=r.length,o=!!n;for(var i in t)!e&&!A.call(t,i)||o&&("length"==i||G(i,n))||r.push(i);return r}(t,!0):function(t){if(!et(t))return function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}(t);var e,r,n=(r=(e=t)&&e.constructor,e===("function"==typeof r&&r.prototype||O)),o=[];for(var i in t)("constructor"!=i||!n&&A.call(t,i))&&o.push(i);return o}(t)}var ot,it,st=(ot=function(t,e){return null==t?{}:(e=y(function t(e,r,n,o,i){var s=-1,a=e.length;for(n||(n=J),i||(i=[]);++s<a;){var u=e[s];r>0&&n(u)?r>1?t(u,r-1,n,o,i):d(i,u):o||(i[i.length]=u)}return i}(e,1),V),function(t,e){return function(t,e,r){for(var n=-1,o=e.length,i={};++n<o;){var s=e[n],a=t[s];r(a,s)&&(i[s]=a)}return i}(t=Object(t),e,function(e,r){return r in t})}(t,function(t,e,r,n){var o=-1,i=h,s=!0,a=t.length,u=[],c=e.length;if(!a)return u;e.length>=200&&(i=b,s=!1,e=new z(e));t:for(;++o<a;){var l=t[o],f=l;if(l=0!==l?l:0,s&&f==f){for(var p=c;p--;)if(e[p]===f)continue t;u.push(l)}else i(e,f,void 0)||u.push(l)}return u}(function(t){return function(t,e,r){var n=nt(t);return Y(t)?n:d(n,r(t))}(t,0,W)}(t),e)))},it=L(void 0===it?ot.length-1:it,0),function(){for(var t=arguments,e=-1,r=L(t.length-it,0),n=Array(r);++e<r;)n[e]=t[it+e];e=-1;for(var o=Array(it+1);++e<it;)o[e]=t[e];return o[it]=n,function(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}(ot,this,o)});function at(){return[]}w=st}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var S={},O=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!_(t))throw new Error("`err` must be an Error");if(!Array.isArray(e))throw new Error("`fields` must be an Array");var r={};return Object.getOwnPropertyNames(Object.getPrototypeOf(t)).concat(Object.getOwnPropertyNames(t)).forEach(function(e){"function"!=typeof t[e]&&(r[e]=t[e])}),!r.name&&t.constructor.name&&(r.name=t.constructor.name),Array.isArray(e)&&0!==e.length?r.filter(function(t){return e.includes(t)}):r},T={};function j(t){return(j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}T=k,k.default=k,k.stable=C,k.stableStringify=C;var E=[],A=[];function k(t,e,r){var n;for(function t(e,r,n,o){var i;if("object"==j(e)&&null!==e){for(i=0;i<n.length;i++)if(n[i]===e){var s=Object.getOwnPropertyDescriptor(o,r);return void(void 0!==s.get?s.configurable?(Object.defineProperty(o,r,{value:"[Circular]"}),E.push([o,r,e,s])):A.push([e,r]):(o[r]="[Circular]",E.push([o,r,e])))}if(n.push(e),Array.isArray(e))for(i=0;i<e.length;i++)t(e[i],i,n,e);else{var a=Object.keys(e);for(i=0;i<a.length;i++){var u=a[i];t(e[u],u,n,e)}}n.pop()}}(t,"",[],void 0),n=0===A.length?JSON.stringify(t,e,r):JSON.stringify(t,P(e),r);0!==E.length;){var o=E.pop();4===o.length?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}return n}function x(t,e){return t<e?-1:t>e?1:0}function C(t,e,r){var n,o=function t(e,r,n,o){var i;if("object"==j(e)&&null!==e){for(i=0;i<n.length;i++)if(n[i]===e){var s=Object.getOwnPropertyDescriptor(o,r);return void(void 0!==s.get?s.configurable?(Object.defineProperty(o,r,{value:"[Circular]"}),E.push([o,r,e,s])):A.push([e,r]):(o[r]="[Circular]",E.push([o,r,e])))}if("function"==typeof e.toJSON)return;if(n.push(e),Array.isArray(e))for(i=0;i<e.length;i++)t(e[i],i,n,e);else{var a={},u=Object.keys(e).sort(x);for(i=0;i<u.length;i++){var c=u[i];t(e[c],c,n,e),a[c]=e[c]}if(void 0===o)return a;E.push([o,r,e]),o[r]=a}n.pop()}}(t,"",[],void 0)||t;for(n=0===A.length?JSON.stringify(o,e,r):JSON.stringify(o,P(e),r);0!==E.length;){var i=E.pop();4===i.length?Object.defineProperty(i[0],i[1],i[3]):i[0][i[1]]=i[2]}return n}function P(t){return t=void 0!==t?t:function(t,e){return e},function(e,r){if(A.length>0)for(var n=0;n<A.length;n++){var o=A[n];if(o[1]===e&&o[0]===r){r="[Circular]",A.splice(n,1);break}}return t.call(this,e,r)}}var R={exports:{}};function D(t){if(t)return function(t){for(var e in D.prototype)t[e]=D.prototype[e];return t}(t)}R.exports=D,D.prototype.on=D.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},D.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this},D.prototype.off=D.prototype.removeListener=D.prototype.removeAllListeners=D.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var o=0;o<n.length;o++)if((r=n[o])===e||r.fn===e){n.splice(o,1);break}return 0===n.length&&delete this._callbacks["$"+t],this},D.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),r=this._callbacks["$"+t],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(r){n=0;for(var o=(r=r.slice(0)).length;n<o;++n)r[n].apply(this,e)}return this},D.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},D.prototype.hasListeners=function(t){return!!this.listeners(t).length},R=R.exports;var N=String.prototype.replace,I=/%20/g,L={default:"RFC3986",formatters:{RFC1738:function(t){return N.call(t,I,"+")},RFC3986:function(t){return String(t)}},RFC1738:"RFC1738",RFC3986:"RFC3986"};function H(t){return(H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var q=Object.prototype.hasOwnProperty,M=Array.isArray,U=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),F={combine:function(t,e){return[].concat(t,e)},compact:function(t){for(var e=[{obj:{o:t},prop:"o"}],r=[],n=0;n<e.length;++n)for(var o=e[n],i=o.obj[o.prop],s=Object.keys(i),a=0;a<s.length;++a){var u=s[a],c=i[u];"object"==H(c)&&null!==c&&-1===r.indexOf(c)&&(e.push({obj:i,prop:u}),r.push(c))}return function(t){for(;t.length>1;){var e=t.pop(),r=e.obj[e.prop];if(M(r)){for(var n=[],o=0;o<r.length;++o)void 0!==r[o]&&n.push(r[o]);e.obj[e.prop]=n}}}(e),t},decode:function(t,e,r){var n=t.replace(/\+/g," ");if("iso-8859-1"===r)return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch(o){return n}},encode:function(t,e,r,n,o){if(0===t.length)return t;var i=t;if("symbol"==H(t)?i=Symbol.prototype.toString.call(t):"string"!=typeof t&&(i=String(t)),"iso-8859-1"===r)return escape(i).replace(/%u[0-9a-f]{4}/gi,function(t){return"%26%23"+parseInt(t.slice(2),16)+"%3B"});for(var s="",a=0;a<i.length;++a){var u=i.charCodeAt(a);45===u||46===u||95===u||126===u||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||o===L.RFC1738&&(40===u||41===u)?s+=i.charAt(a):u<128?s+=U[u]:u<2048?s+=U[192|u>>6]+U[128|63&u]:u<55296||u>=57344?s+=U[224|u>>12]+U[128|u>>6&63]+U[128|63&u]:(a+=1,u=65536+((1023&u)<<10|1023&i.charCodeAt(a)),s+=U[240|u>>18]+U[128|u>>12&63]+U[128|u>>6&63]+U[128|63&u])}return s},isBuffer:function(t){return!(!t||"object"!=H(t)||!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t)))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,e){if(M(t)){for(var r=[],n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)},merge:function t(e,r,n){if(!r)return e;if("object"!=H(r)){if(M(e))e.push(r);else{if(!e||"object"!=H(e))return[e,r];(n&&(n.plainObjects||n.allowPrototypes)||!q.call(Object.prototype,r))&&(e[r]=!0)}return e}if(!e||"object"!=H(e))return[e].concat(r);var o=e;return M(e)&&!M(r)&&(o=function(t,e){for(var r=e&&e.plainObjects?Object.create(null):{},n=0;n<t.length;++n)void 0!==t[n]&&(r[n]=t[n]);return r}(e,n)),M(e)&&M(r)?(r.forEach(function(r,o){if(q.call(e,o)){var i=e[o];i&&"object"==H(i)&&r&&"object"==H(r)?e[o]=t(i,r,n):e.push(r)}else e[o]=r}),e):Object.keys(r).reduce(function(e,o){var i=r[o];return q.call(e,o)?e[o]=t(e[o],i,n):e[o]=i,e},o)}};function z(t){return(z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var $=Object.prototype.hasOwnProperty,B={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},X=Array.isArray,Q=Array.prototype.push,W=function(t,e){Q.apply(t,X(e)?e:[e])},J=Date.prototype.toISOString,G=L.default,V={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:F.encode,encodeValuesOnly:!1,format:G,formatter:L.formatters[G],indices:!1,serializeDate:function(t){return J.call(t)},skipNulls:!1,strictNullHandling:!1},K=function t(e,r,n,o,i,s,a,u,c,l,f,p,h,y){var d,m=e;if("function"==typeof a?m=a(r,m):m instanceof Date?m=l(m):"comma"===n&&X(m)&&(m=F.maybeMap(m,function(t){return t instanceof Date?l(t):t})),null===m){if(o)return s&&!h?s(r,V.encoder,y,"key",f):r;m=""}if("string"==typeof(d=m)||"number"==typeof d||"boolean"==typeof d||"symbol"==z(d)||"bigint"==typeof d||F.isBuffer(m))return s?[p(h?r:s(r,V.encoder,y,"key",f))+"="+p(s(m,V.encoder,y,"value",f))]:[p(r)+"="+p(String(m))];var b,v=[];if(void 0===m)return v;if("comma"===n&&X(m))b=[{value:m.length>0?m.join(",")||null:void 0}];else if(X(a))b=a;else{var g=Object.keys(m);b=u?g.sort(u):g}for(var _=0;_<b.length;++_){var w=b[_],S="object"==z(w)&&void 0!==w.value?w.value:m[w];if(!i||null!==S){var O=X(m)?"function"==typeof n?n(r,w):r:r+(c?"."+w:"["+w+"]");W(v,t(S,O,n,o,i,s,a,u,c,l,f,p,h,y))}}return v},Y=(Object.prototype.hasOwnProperty,Array.isArray,{stringify:function(t,e){var r,n=t,o=function(t){if(!t)return V;if(null!==t.encoder&&void 0!==t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var e=t.charset||V.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=L.default;if(void 0!==t.format){if(!$.call(L.formatters,t.format))throw new TypeError("Unknown format option provided.");r=t.format}var n=L.formatters[r],o=V.filter;return("function"==typeof t.filter||X(t.filter))&&(o=t.filter),{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:V.addQueryPrefix,allowDots:void 0===t.allowDots?V.allowDots:!!t.allowDots,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:V.charsetSentinel,delimiter:void 0===t.delimiter?V.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:V.encode,encoder:"function"==typeof t.encoder?t.encoder:V.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:V.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:V.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:V.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:V.strictNullHandling}}(e);"function"==typeof o.filter?n=(0,o.filter)("",n):X(o.filter)&&(r=o.filter);var i,s=[];if("object"!=z(n)||null===n)return"";i=e&&e.arrayFormat in B?e.arrayFormat:e&&"indices"in e?e.indices?"indices":"repeat":"indices";var a=B[i];r||(r=Object.keys(n)),o.sort&&r.sort(o.sort);for(var u=0;u<r.length;++u){var c=r[u];o.skipNulls&&null===n[c]||W(s,K(n[c],c,a,o.strictNullHandling,o.skipNulls,o.encode?o.encoder:null,o.filter,o.sort,o.allowDots,o.serializeDate,o.format,o.formatter,o.encodeValuesOnly,o.charset))}var l=s.join(o.delimiter),f=!0===o.addQueryPrefix?"?":"";return o.charsetSentinel&&("iso-8859-1"===o.charset?f+="utf8=%26%2310003%3B&":f+="utf8=%E2%9C%93&"),l.length>0?f+l:""}});function Z(t){return(Z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function tt(t){return(tt="function"==typeof Symbol&&"symbol"==Z(Symbol.iterator)?function(t){return Z(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":Z(t)})(t)}var et=function(t){return null!==t&&"object"===tt(t)},rt={};function nt(t){return(nt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ot(t){return(ot="function"==typeof Symbol&&"symbol"==nt(Symbol.iterator)?function(t){return nt(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":nt(t)})(t)}function it(t){if(t)return function(t){for(var e in it.prototype)Object.prototype.hasOwnProperty.call(it.prototype,e)&&(t[e]=it.prototype[e]);return t}(t)}rt=it,it.prototype.clearTimeout=function(){return clearTimeout(this._timer),clearTimeout(this._responseTimeoutTimer),clearTimeout(this._uploadTimeoutTimer),delete this._timer,delete this._responseTimeoutTimer,delete this._uploadTimeoutTimer,this},it.prototype.parse=function(t){return this._parser=t,this},it.prototype.responseType=function(t){return this._responseType=t,this},it.prototype.serialize=function(t){return this._serializer=t,this},it.prototype.timeout=function(t){if(!t||"object"!==ot(t))return this._timeout=t,this._responseTimeout=0,this._uploadTimeout=0,this;for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))switch(e){case"deadline":this._timeout=t.deadline;break;case"response":this._responseTimeout=t.response;break;case"upload":this._uploadTimeout=t.upload;break;default:console.warn("Unknown timeout option",e)}return this},it.prototype.retry=function(t,e){return 0!==arguments.length&&!0!==t||(t=1),t<=0&&(t=0),this._maxRetries=t,this._retries=0,this._retryCallback=e,this};var st=new Set(["ETIMEDOUT","ECONNRESET","EADDRINUSE","ECONNREFUSED","EPIPE","ENOTFOUND","ENETUNREACH","EAI_AGAIN"]),at=new Set([408,413,429,500,502,503,504,521,522,524]);it.prototype._shouldRetry=function(t,e){if(!this._maxRetries||this._retries++>=this._maxRetries)return!1;if(this._retryCallback)try{var r=this._retryCallback(t,e);if(!0===r)return!0;if(!1===r)return!1}catch(n){console.error(n)}if(e&&e.status&&at.has(e.status))return!0;if(t){if(t.code&&st.has(t.code))return!0;if(t.timeout&&"ECONNABORTED"===t.code)return!0;if(t.crossDomain)return!0}return!1},it.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this.timedoutError=null,this._end()},it.prototype.then=function(t,e){var r=this;if(!this._fullfilledPromise){var n=this;this._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise(function(t,e){n.on("abort",function(){if(!(r._maxRetries&&r._maxRetries>r._retries))if(r.timedout&&r.timedoutError)e(r.timedoutError);else{var t=new Error("Aborted");t.code="ABORTED",t.status=r.status,t.method=r.method,t.url=r.url,e(t)}}),n.end(function(r,n){r?e(r):t(n)})})}return this._fullfilledPromise.then(t,e)},it.prototype.catch=function(t){return this.then(void 0,t)},it.prototype.use=function(t){return t(this),this},it.prototype.ok=function(t){if("function"!=typeof t)throw new Error("Callback required");return this._okCallback=t,this},it.prototype._isResponseOK=function(t){return!!t&&(this._okCallback?this._okCallback(t):t.status>=200&&t.status<300)},it.prototype.get=function(t){return this._header[t.toLowerCase()]},it.prototype.getHeader=it.prototype.get,it.prototype.set=function(t,e){if(et(t)){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&this.set(r,t[r]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},it.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},it.prototype.field=function(t,e){if(null==t)throw new Error(".field(name, val) name can not be empty");if(this._data)throw new Error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()");if(et(t)){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&this.field(r,t[r]);return this}if(Array.isArray(e)){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&this.field(t,e[n]);return this}if(null==e)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof e&&(e=String(e)),this._getFormData().append(t,e),this},it.prototype.abort=function(){return this._aborted?this:(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort"),this)},it.prototype._auth=function(t,e,r,n){switch(r.type){case"basic":this.set("Authorization","Basic ".concat(n("".concat(t,":").concat(e))));break;case"auto":this.username=t,this.password=e;break;case"bearer":this.set("Authorization","Bearer ".concat(t))}return this},it.prototype.withCredentials=function(t){return void 0===t&&(t=!0),this._withCredentials=t,this},it.prototype.redirects=function(t){return this._maxRedirects=t,this},it.prototype.maxResponseSize=function(t){if("number"!=typeof t)throw new TypeError("Invalid argument");return this._maxResponseSize=t,this},it.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},it.prototype.send=function(t){var e=et(t),r=this._header["content-type"];if(this._formData)throw new Error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()");if(e&&!this._data)Array.isArray(t)?this._data=[]:this._isHost(t)||(this._data={});else if(t&&this._data&&this._isHost(this._data))throw new Error("Can't merge these send calls");if(e&&et(this._data))for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(this._data[n]=t[n]);else"string"==typeof t?(r||this.type("form"),(r=this._header["content-type"])&&(r=r.toLowerCase().trim()),this._data="application/x-www-form-urlencoded"===r?this._data?"".concat(this._data,"&").concat(t):t:(this._data||"")+t):this._data=t;return!e||this._isHost(t)?this:(r||this.type("json"),this)},it.prototype.sortQuery=function(t){return this._sort=void 0===t||t,this},it.prototype._finalizeQueryString=function(){var t=this._query.join("&");if(t&&(this.url+=(this.url.includes("?")?"&":"?")+t),this._query.length=0,this._sort){var e=this.url.indexOf("?");if(e>=0){var r=this.url.slice(e+1).split("&");"function"==typeof this._sort?r.sort(this._sort):r.sort(),this.url=this.url.slice(0,e)+"?"+r.join("&")}}},it.prototype._appendQueryString=function(){console.warn("Unsupported")},it.prototype._timeoutError=function(t,e,r){if(!this._aborted){var n=new Error("".concat(t+e,"ms exceeded"));n.timeout=e,n.code="ECONNABORTED",n.errno=r,this.timedout=!0,this.timedoutError=n,this.abort(),this.callback(n)}},it.prototype._setTimeouts=function(){var t=this;this._timeout&&!this._timer&&(this._timer=setTimeout(function(){t._timeoutError("Timeout of ",t._timeout,"ETIME")},this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout(function(){t._timeoutError("Response timeout of ",t._responseTimeout,"ETIMEDOUT")},this._responseTimeout))};var ut={};function ct(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return lt(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?lt(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,a=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return s=t.done,t},e:function(t){a=!0,i=t},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw i}}}}function lt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}ut.type=function(t){return t.split(/ *; */).shift()},ut.params=function(t){var e,r={},n=ct(t.split(/ *; */));try{for(n.s();!(e=n.n()).done;){var o=e.value.split(/ *= */),i=o.shift(),s=o.shift();i&&s&&(r[i]=s)}}catch(a){n.e(a)}finally{n.f()}return r},ut.parseLinks=function(t){var e,r={},n=ct(t.split(/ *, */));try{for(n.s();!(e=n.n()).done;){var o=e.value.split(/ *; */),i=o[0].slice(1,-1);r[o[1].split(/ *= */)[1].slice(1,-1)]=i}}catch(s){n.e(s)}finally{n.f()}return r};var ft={};function pt(t){if(t)return function(t){for(var e in pt.prototype)Object.prototype.hasOwnProperty.call(pt.prototype,e)&&(t[e]=pt.prototype[e]);return t}(t)}ft=pt,pt.prototype.get=function(t){return this.header[t.toLowerCase()]},pt.prototype._setHeaderProperties=function(t){var e=t["content-type"]||"";this.type=ut.type(e);var r=ut.params(e);for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(this[n]=r[n]);this.links={};try{t.link&&(this.links=ut.parseLinks(t.link))}catch(o){}},pt.prototype._setStatusProperties=function(t){var e=t/100|0;this.statusCode=t,this.status=this.statusCode,this.statusType=e,this.info=1===e,this.ok=2===e,this.redirect=3===e,this.clientError=4===e,this.serverError=5===e,this.error=(4===e||5===e)&&this.toError(),this.created=201===t,this.accepted=202===t,this.noContent=204===t,this.badRequest=400===t,this.unauthorized=401===t,this.notAcceptable=406===t,this.forbidden=403===t,this.notFound=404===t,this.unprocessableEntity=422===t};var ht={};function yt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function dt(){this._defaults=[]}["use","on","once","set","query","type","accept","auth","withCredentials","sortQuery","retry","ok","redirects","timeout","buffer","serialize","parse","ca","key","pfx","cert","disableTLSCerts"].forEach(function(t){dt.prototype[t]=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return this._defaults.push({fn:t,args:r}),this}}),dt.prototype._setDefaults=function(t){this._defaults.forEach(function(e){var r;t[e.fn].apply(t,function(t){if(Array.isArray(t))return yt(t)}(r=e.args)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(r)||function(t,e){if(t){if("string"==typeof t)return yt(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?yt(t,void 0):void 0}}(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())})},ht=dt;var mt,bt={};function vt(t){return(vt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function gt(t){return(gt="function"==typeof Symbol&&"symbol"==vt(Symbol.iterator)?function(t){return vt(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":vt(t)})(t)}function _t(){}"undefined"!=typeof window?mt=window:"undefined"==typeof self?(console.warn("Using browser-only version of superagent in non-browser environment"),mt=void 0):mt=self;var wt=bt=bt=function(t,e){return"function"==typeof e?new bt.Request("GET",t).end(e):1===arguments.length?new bt.Request("GET",t):new bt.Request(t,e)};bt.Request=kt,wt.getXHR=function(){if(mt.XMLHttpRequest&&(!mt.location||"file:"!==mt.location.protocol||!mt.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(r){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(n){}throw new Error("Browser-only version of superagent could not find XHR")};var St="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};function Ot(t){if(!et(t))return t;var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&Tt(e,r,t[r]);return e.join("&")}function Tt(t,e,r){if(void 0!==r)if(null!==r)if(Array.isArray(r))r.forEach(function(r){Tt(t,e,r)});else if(et(r))for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&Tt(t,"".concat(e,"[").concat(n,"]"),r[n]);else t.push(encodeURI(e)+"="+encodeURIComponent(r));else t.push(encodeURI(e))}function jt(t){for(var e,r,n={},o=t.split("&"),i=0,s=o.length;i<s;++i)-1===(r=(e=o[i]).indexOf("="))?n[decodeURIComponent(e)]="":n[decodeURIComponent(e.slice(0,r))]=decodeURIComponent(e.slice(r+1));return n}function Et(t){return/[/+]json($|[^-\w])/i.test(t)}function At(t){this.req=t,this.xhr=this.req.xhr,this.text="HEAD"!==this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||void 0===this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText;var e=this.xhr.status;1223===e&&(e=204),this._setStatusProperties(e),this.headers=function(t){for(var e,r,n,o,i=t.split(/\r?\n/),s={},a=0,u=i.length;a<u;++a)-1!==(e=(r=i[a]).indexOf(":"))&&(n=r.slice(0,e).toLowerCase(),o=St(r.slice(e+1)),s[n]=o);return s}(this.xhr.getAllResponseHeaders()),this.header=this.headers,this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this._setHeaderProperties(this.header),null===this.text&&t._responseType?this.body=this.xhr.response:this.body="HEAD"===this.req.method?null:this._parseBody(this.text?this.text:this.xhr.response)}function kt(t,e){var r=this;this._query=this._query||[],this.method=t,this.url=e,this.header={},this._header={},this.on("end",function(){var t,e=null,n=null;try{n=new At(r)}catch(o){return(e=new Error("Parser is unable to parse the response")).parse=!0,e.original=o,r.xhr?(e.rawResponse=void 0===r.xhr.responseType?r.xhr.responseText:r.xhr.response,e.status=r.xhr.status?r.xhr.status:null,e.statusCode=e.status):(e.rawResponse=null,e.status=null),r.callback(e)}r.emit("response",n);try{r._isResponseOK(n)||(t=new Error(n.statusText||n.text||"Unsuccessful HTTP response"))}catch(o){t=o}t?(t.original=e,t.response=n,t.status=n.status,r.callback(t,n)):r.callback(null,n)})}function xt(t,e,r){var n=wt("DELETE",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n}wt.serializeObject=Ot,wt.parseString=jt,wt.types={html:"text/html",json:"application/json",xml:"text/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},wt.serialize={"application/x-www-form-urlencoded":Y.stringify,"application/json":T},wt.parse={"application/x-www-form-urlencoded":jt,"application/json":JSON.parse},ft(At.prototype),At.prototype._parseBody=function(t){var e=wt.parse[this.type];return this.req._parser?this.req._parser(this,t):(!e&&Et(this.type)&&(e=wt.parse["application/json"]),e&&t&&(t.length>0||t instanceof Object)?e(t):null)},At.prototype.toError=function(){var t=this.req,e=t.method,r=t.url,n="cannot ".concat(e," ").concat(r," (").concat(this.status,")"),o=new Error(n);return o.status=this.status,o.method=e,o.url=r,o},wt.Response=At,R(kt.prototype),rt(kt.prototype),kt.prototype.type=function(t){return this.set("Content-Type",wt.types[t]||t),this},kt.prototype.accept=function(t){return this.set("Accept",wt.types[t]||t),this},kt.prototype.auth=function(t,e,r){return 1===arguments.length&&(e=""),"object"===gt(e)&&null!==e&&(r=e,e=""),r||(r={type:"function"==typeof btoa?"basic":"auto"}),this._auth(t,e,r,function(t){if("function"==typeof btoa)return btoa(t);throw new Error("Cannot use basic auth, btoa is not a function")})},kt.prototype.query=function(t){return"string"!=typeof t&&(t=Ot(t)),t&&this._query.push(t),this},kt.prototype.attach=function(t,e,r){if(e){if(this._data)throw new Error("superagent can't mix .send() and .attach()");this._getFormData().append(t,e,r||e.name)}return this},kt.prototype._getFormData=function(){return this._formData||(this._formData=new mt.FormData),this._formData},kt.prototype.callback=function(t,e){if(this._shouldRetry(t,e))return this._retry();var r=this._callback;this.clearTimeout(),t&&(this._maxRetries&&(t.retries=this._retries-1),this.emit("error",t)),r(t,e)},kt.prototype.crossDomainError=function(){var t=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");t.crossDomain=!0,t.status=this.status,t.method=this.method,t.url=this.url,this.callback(t)},kt.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},kt.prototype.ca=kt.prototype.agent,kt.prototype.buffer=kt.prototype.ca,kt.prototype.write=function(){throw new Error("Streaming is not supported in browser version of superagent")},kt.prototype.pipe=kt.prototype.write,kt.prototype._isHost=function(t){return t&&"object"===gt(t)&&!Array.isArray(t)&&"[object Object]"!==Object.prototype.toString.call(t)},kt.prototype.end=function(t){this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=t||_t,this._finalizeQueryString(),this._end()},kt.prototype._setUploadTimeout=function(){var t=this;this._uploadTimeout&&!this._uploadTimeoutTimer&&(this._uploadTimeoutTimer=setTimeout(function(){t._timeoutError("Upload timeout of ",t._uploadTimeout,"ETIMEDOUT")},this._uploadTimeout))},kt.prototype._end=function(){if(this._aborted)return this.callback(new Error("The request has been aborted even before .end() was called"));var t=this;this.xhr=wt.getXHR();var e=this.xhr,r=this._formData||this._data;this._setTimeouts(),e.onreadystatechange=function(){var r=e.readyState;if(r>=2&&t._responseTimeoutTimer&&clearTimeout(t._responseTimeoutTimer),4===r){var n;try{n=e.status}catch(o){n=0}if(!n){if(t.timedout||t._aborted)return;return t.crossDomainError()}t.emit("end")}};var n=function(e,r){r.total>0&&(r.percent=r.loaded/r.total*100,100===r.percent&&clearTimeout(t._uploadTimeoutTimer)),r.direction=e,t.emit("progress",r)};if(this.hasListeners("progress"))try{e.addEventListener("progress",n.bind(null,"download")),e.upload&&e.upload.addEventListener("progress",n.bind(null,"upload"))}catch(a){}e.upload&&this._setUploadTimeout();try{this.username&&this.password?e.open(this.method,this.url,!0,this.username,this.password):e.open(this.method,this.url,!0)}catch(u){return this.callback(u)}if(this._withCredentials&&(e.withCredentials=!0),!this._formData&&"GET"!==this.method&&"HEAD"!==this.method&&"string"!=typeof r&&!this._isHost(r)){var o=this._header["content-type"],i=this._serializer||wt.serialize[o?o.split(";")[0]:""];!i&&Et(o)&&(i=wt.serialize["application/json"]),i&&(r=i(r))}for(var s in this.header)null!==this.header[s]&&Object.prototype.hasOwnProperty.call(this.header,s)&&e.setRequestHeader(s,this.header[s]);this._responseType&&(e.responseType=this._responseType),this.emit("request",this),e.send(void 0===r?null:r)},wt.agent=function(){return new ht},["GET","POST","OPTIONS","PATCH","PUT","DELETE"].forEach(function(t){ht.prototype[t.toLowerCase()]=function(e,r){var n=new wt.Request(t,e);return this._setDefaults(n),r&&n.end(r),n}}),ht.prototype.del=ht.prototype.delete,wt.get=function(t,e,r){var n=wt("GET",t);return"function"==typeof e&&(r=e,e=null),e&&n.query(e),r&&n.end(r),n},wt.head=function(t,e,r){var n=wt("HEAD",t);return"function"==typeof e&&(r=e,e=null),e&&n.query(e),r&&n.end(r),n},wt.options=function(t,e,r){var n=wt("OPTIONS",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n},wt.del=xt,wt.delete=xt,wt.patch=function(t,e,r){var n=wt("PATCH",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n},wt.post=function(t,e,r){var n=wt("POST",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n},wt.put=function(t,e,r){var n=wt("PUT",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n};var Ct={};Object.defineProperty(Ct,"__esModule",{value:!0}),Ct.boolean=void 0,Ct.boolean=function(t){return"string"==typeof t?["true","t","yes","y","on","1"].includes(t.trim().toLowerCase()):"number"==typeof t?1===t:"boolean"==typeof t&&t};var Pt,Rt,Dt,Nt="8.0.0",It=Pt={};function Lt(){throw new Error("setTimeout has not been defined")}function Ht(){throw new Error("clearTimeout has not been defined")}function qt(t){if(Rt===setTimeout)return setTimeout(t,0);if((Rt===Lt||!Rt)&&setTimeout)return Rt=setTimeout,setTimeout(t,0);try{return Rt(t,0)}catch(e){try{return Rt.call(null,t,0)}catch(e){return Rt.call(this,t,0)}}}!function(){try{Rt="function"==typeof setTimeout?setTimeout:Lt}catch(t){Rt=Lt}try{Dt="function"==typeof clearTimeout?clearTimeout:Ht}catch(t){Dt=Ht}}();var Mt,Ut=[],Ft=!1,zt=-1;function $t(){Ft&&Mt&&(Ft=!1,Mt.length?Ut=Mt.concat(Ut):zt=-1,Ut.length&&Bt())}function Bt(){if(!Ft){var t=qt($t);Ft=!0;for(var e=Ut.length;e;){for(Mt=Ut,Ut=[];++zt<e;)Mt&&Mt[zt].run();zt=-1,e=Ut.length}Mt=null,Ft=!1,function(t){if(Dt===clearTimeout)return clearTimeout(t);if((Dt===Ht||!Dt)&&clearTimeout)return Dt=clearTimeout,clearTimeout(t);try{Dt(t)}catch(e){try{return Dt.call(null,t)}catch(e){return Dt.call(this,t)}}}(t)}}function Xt(t,e){this.fun=t,this.array=e}function Qt(){}It.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];Ut.push(new Xt(t,e)),1!==Ut.length||Ft||qt(Bt)},Xt.prototype.run=function(){this.fun.apply(null,this.array)},It.title="browser",It.browser=!0,It.env={},It.argv=[],It.version="",It.versions={},It.on=Qt,It.addListener=Qt,It.once=Qt,It.off=Qt,It.removeListener=Qt,It.removeAllListeners=Qt,It.emit=Qt,It.prependListener=Qt,It.prependOnceListener=Qt,It.listeners=function(t){return[]},It.binding=function(t){throw new Error("process.binding is not supported")},It.cwd=function(){return"/"},It.chdir=function(t){throw new Error("process.chdir is not supported")},It.umask=function(){return 0};var Wt={};return function(t){(function(){"use strict";function e(t){return function(t){if(Array.isArray(t))return o(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||n(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=n(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var o=0,i=function(){};return{s:i,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,u=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw s}}}}function n(t,e){if(t){if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var a=Ct.boolean,u=new Set(["config","log"]),c=["trace","debug","info","warn","error","fatal"],f={warning:"warn",err:"error"},p="https://api.cabinjs.com",h="`level` invalid, must be: ".concat(c.join(", "));function y(t){return null==t||"object"==s(t)&&0===Object.keys(t).length||"string"==typeof t&&0===t.trim().length}function d(t){return void 0===t}function m(t){return"object"==s(t)&&null!==t&&!Array.isArray(t)}function b(t){return"string"==typeof t}function j(t){return"function"==typeof t}Wt=function(){function n(){var o=this,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),this.config=Object.assign({key:"",endpoint:p,headers:{},timeout:5e3,retry:3,showStack:!t.env.SHOW_STACK||a(t.env.SHOW_STACK),meta:{show:!t.env.SHOW_META||a(t.env.SHOW_META),showApp:!t.env.SHOW_META_APP||a(t.env.SHOW_META_APP),omittedFields:t.env.OMIT_META_FIELDS?t.env.OMIT_META_FIELDS.split(",").map(function(t){return t.trim()}):[]},silent:!1,logger:console,name:!1,level:"info",levels:["info","warn","error","fatal"],capture:!1,callback:!1,appInfo:!t.env.APP_INFO||a(t.env.APP_INFO)},i),this.config.showMeta&&(this.config.meta.show=this.config.showMeta,delete this.config.showMeta),this.appInfo=!!this.config.appInfo&&!!j(S)&&S(),this.log=this.log.bind(this);var s,l=r(Object.keys(this.config.logger).filter(function(t){return!u.has(t)}));try{for(l.s();!(s=l.n()).done;){var f=s.value;this[f]=this.config.logger[f]}}catch(m){l.e(m)}finally{l.f()}var h,y=r(c);try{var d=function(){var t=h.value;o[t]=function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return o.log.apply(o,e([t].concat([].slice.call(n))))}};for(y.s();!(h=y.n()).done;)d()}catch(m){y.e(m)}finally{y.f()}this.setLevel=this.setLevel.bind(this),this.getNormalizedLevel=this.getNormalizedLevel.bind(this),this.setName=this.setName.bind(this),this.setCallback=this.setCallback.bind(this),this.config.name&&this.setName(this.config.name),this.setLevel(this.config.level),this.err=this.error,this.warning=this.warn}var o,s,E;return o=n,(s=[{key:"setCallback",value:function(t){this.config.callback=t}},{key:"setLevel",value:function(t){if(!b(t)||!c.includes(t))throw new Error(h);b(this.config.logger.logLevel)?this.config.logger.logLevel=t:this.config.logger.level=t,this.config.levels=c.slice(c.indexOf(t))}},{key:"getNormalizedLevel",value:function(t){return b(t)?b(f[t])?f[t]:c.includes(t)?t:"info":"info"}},{key:"setName",value:function(t){if(!b(t))throw new Error("`name` must be a String");b(this.config.logger.scope)?this.config.logger.scope=t:this.config.logger.name=t}},{key:"log",value:function(r,n,o){for(var i=this,s=[],a=arguments.length,u=new Array(a>3?a-3:0),h=3;h<a;h++)u[h-3]=arguments[h];d(r)||s.push(r),d(n)||s.push(n),d(o)||s.push(o),s=s.concat([].slice.call(u));var S=this.config,E=0;b(r)&&b(f[r])?r=f[r]:_(r)?(o=n,n=r,r="error"):b(r)&&c.includes(r)||(o=n,n=r,r=this.getNormalizedLevel(r),E=-1);var A,k=!1;if((m(n)||Array.isArray(n))&&b(o)){k=!0;var x=o;o=n,n=b(x)&&s.length>=3+E?v.apply(void 0,e(s.slice(2+E))):x}d(n)&&(n=r),1!==s.slice(1+E).length||b(n)||_(n)?!k&&s.length>=4+E?(n=v.apply(void 0,e(s.slice(1+E))),o={}):!k&&s.length===3+E&&b(n)&&g.filter(function(t){return n.includes(t)}).length>0?(n=v(n,o),o={}):_(n)||(_(o)?o={err:O(o)}:m(o)||d(o)||null===o?b(n)||(n=v(n)):(n=v(n,o),o={})):(o={message:n},n=r),d(o)||m(o)?m(o)||(o={}):o={meta:o},_(n)?(A=n,m(o.err)||(o.err=O(A)),n=n.message):_(o.err)&&(A=o.err);var C=j(S.callback)&&(!("boolean"==typeof o.callback)||o.callback);(o=w(o,["callback"])).level=r,this.appInfo&&(o.app=this.appInfo);var P=T({message:n,meta:o});if(S.capture&&S.levels.includes(r)&&(!_(A)||!A._captureFailed)){if(S.endpoint===p&&!S.key)throw new Error("Cabin API key required (e.g. `{ key: 'YOUR-CABIN-API-KEY' })`)\n<https://cabinjs.com>");var R=bt.post(S.endpoint).set("X-Request-Id",l()).timeout(S.timeout);t.browser||R.set("User-Agent","axe/".concat(Nt)),S.key&&R.auth(S.key),y(S.headers)||R.set(S.headers),R.type("application/json").send(P).retry(S.retry).end(function(t){t&&(t._captureFailed=!0,i.config.logger.error(t))})}if(C&&S.callback(r,n,o),S.silent)return P;if(!S.levels.includes(r))return P;var D=r;-1===E?D="log":"fatal"===r&&(D="error");var N=["level","err"].concat(this.config.meta.omittedFields);this.config.meta.showApp||N.push("app");var I=w(o,N);return"error"===D&&_(A)&&S.showStack?!S.meta.show||y(I)?this.config.logger.error(A):this.config.logger.error(A,I):!S.meta.show||y(I)?this.config.logger[D](n):this.config.logger[D](n,I),P}}])&&i(o.prototype,s),E&&i(o,E),n}()}).call(this)}.call(this,Pt),Wt});
package/lib/index.js CHANGED
@@ -100,7 +100,13 @@ var Axe = /*#__PURE__*/function () {
100
100
  timeout: 5000,
101
101
  retry: 3,
102
102
  showStack: process.env.SHOW_STACK ? boolean(process.env.SHOW_STACK) : true,
103
- showMeta: process.env.SHOW_META ? boolean(process.env.SHOW_META) : true,
103
+ meta: {
104
+ show: process.env.SHOW_META ? boolean(process.env.SHOW_META) : true,
105
+ showApp: process.env.SHOW_META_APP ? boolean(process.env.SHOW_META_APP) : true,
106
+ omittedFields: process.env.OMIT_META_FIELDS ? process.env.OMIT_META_FIELDS.split(',').map(function (s) {
107
+ return s.trim();
108
+ }) : []
109
+ },
104
110
  silent: false,
105
111
  logger: console,
106
112
  name: false,
@@ -110,9 +116,15 @@ var Axe = /*#__PURE__*/function () {
110
116
  capture: false,
111
117
  callback: false,
112
118
  appInfo: process.env.APP_INFO ? boolean(process.env.APP_INFO) : true
113
- }, config);
119
+ }, config); // For backwards compatability
120
+
121
+ if (this.config.showMeta) {
122
+ this.config.meta.show = this.config.showMeta;
123
+ delete this.config.showMeta;
124
+ }
125
+
114
126
  this.appInfo = this.config.appInfo ? isFunction(parseAppInfo) ? parseAppInfo() : false : false;
115
- this.log = this.log.bind(this); // inherit methods from parent logger
127
+ this.log = this.log.bind(this); // Inherit methods from parent logger
116
128
 
117
129
  var methods = Object.keys(this.config.logger).filter(function (key) {
118
130
  return !omittedLoggerKeys.has(key);
@@ -125,7 +137,7 @@ var Axe = /*#__PURE__*/function () {
125
137
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
126
138
  var element = _step.value;
127
139
  this[element] = this.config.logger[element];
128
- } // bind helper functions for each log level
140
+ } // Bind helper functions for each log level
129
141
 
130
142
  } catch (err) {
131
143
  _iterator.e(err);
@@ -151,7 +163,7 @@ var Axe = /*#__PURE__*/function () {
151
163
 
152
164
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
153
165
  _loop();
154
- } // we could have used `auto-bind` but it's not compiled for browser
166
+ } // We could have used `auto-bind` but it's not compiled for browser
155
167
 
156
168
  } catch (err) {
157
169
  _iterator2.e(err);
@@ -162,11 +174,11 @@ var Axe = /*#__PURE__*/function () {
162
174
  this.setLevel = this.setLevel.bind(this);
163
175
  this.getNormalizedLevel = this.getNormalizedLevel.bind(this);
164
176
  this.setName = this.setName.bind(this);
165
- this.setCallback = this.setCallback.bind(this); // set the logger name
177
+ this.setCallback = this.setCallback.bind(this); // Set the logger name
166
178
 
167
- if (this.config.name) this.setName(this.config.name); // set the logger level
179
+ if (this.config.name) this.setName(this.config.name); // Set the logger level
168
180
 
169
- this.setLevel(this.config.level); // aliases
181
+ this.setLevel(this.config.level); // Aliases
170
182
 
171
183
  this.err = this.error;
172
184
  this.warning = this.warn;
@@ -180,9 +192,9 @@ var Axe = /*#__PURE__*/function () {
180
192
  }, {
181
193
  key: "setLevel",
182
194
  value: function setLevel(level) {
183
- if (!isString(level) || !levels.includes(level)) throw new Error(levelError); // support signale logger and other loggers that use `logLevel`
195
+ if (!isString(level) || !levels.includes(level)) throw new Error(levelError); // Support signale logger and other loggers that use `logLevel`
184
196
 
185
- if (isString(this.config.logger.logLevel)) this.config.logger.logLevel = level;else this.config.logger.level = level; // adjusts `this.config.levels` array
197
+ if (isString(this.config.logger.logLevel)) this.config.logger.logLevel = level;else this.config.logger.level = level; // Adjusts `this.config.levels` array
186
198
  // so that it has all proceeding (inclusive)
187
199
 
188
200
  this.config.levels = levels.slice(levels.indexOf(level));
@@ -198,7 +210,7 @@ var Axe = /*#__PURE__*/function () {
198
210
  }, {
199
211
  key: "setName",
200
212
  value: function setName(name) {
201
- if (!isString(name)) throw new Error('`name` must be a String'); // support signale logger and other loggers that use `scope`
213
+ if (!isString(name)) throw new Error('`name` must be a String'); // Support signale logger and other loggers that use `scope`
202
214
 
203
215
  if (isString(this.config.logger.scope)) this.config.logger.scope = name;else this.config.logger.name = name;
204
216
  } // eslint-disable-next-line complexity
@@ -232,7 +244,7 @@ var Axe = /*#__PURE__*/function () {
232
244
  message = level;
233
245
  level = this.getNormalizedLevel(level);
234
246
  modifier = -1;
235
- } // bunyan support (meta, message, ...args)
247
+ } // Bunyan support (meta, message, ...args)
236
248
 
237
249
 
238
250
  var isBunyan = false;
@@ -242,10 +254,10 @@ var Axe = /*#__PURE__*/function () {
242
254
  var _meta = meta;
243
255
  meta = message;
244
256
  message = isString(_meta) && originalArgs.length >= 3 + modifier ? format.apply(void 0, _toConsumableArray(originalArgs.slice(2 + modifier))) : _meta;
245
- } // if message was undefined then set it to level
257
+ } // If message was undefined then set it to level
246
258
 
247
259
 
248
- if (isUndefined(message)) message = level; // if only `message` was passed then if it was an Object
260
+ if (isUndefined(message)) message = level; // If only `message` was passed then if it was an Object
249
261
  // preserve it as an Object by setting it as meta
250
262
 
251
263
  if (originalArgs.slice(1 + modifier).length === 1 && !isString(message) && !isError(message)) {
@@ -254,14 +266,14 @@ var Axe = /*#__PURE__*/function () {
254
266
  };
255
267
  message = level;
256
268
  } else if (!isBunyan && originalArgs.length >= 4 + modifier) {
257
- // if there are four or more args
269
+ // If there are four or more args
258
270
  // then infer to use util.format on everything
259
271
  message = format.apply(void 0, _toConsumableArray(originalArgs.slice(1 + modifier)));
260
272
  meta = {};
261
273
  } else if (!isBunyan && originalArgs.length === 3 + modifier && isString(message) && formatSpecifiers.filter(function (t) {
262
274
  return message.includes(t);
263
275
  }).length > 0) {
264
- // otherwise if there are three args and if the `message` contains
276
+ // Otherwise if there are three args and if the `message` contains
265
277
  // a placeholder token (e.g. '%s' or '%d' - see above `formatSpecifiers` variable)
266
278
  // then we can infer that the `meta` arg passed is used for formatting
267
279
  message = format(message, meta);
@@ -272,16 +284,16 @@ var Axe = /*#__PURE__*/function () {
272
284
  err: parseErr(meta)
273
285
  }; // } else if (!isPlainObject(meta) && !isUndefined(meta) && !isNull(meta)) {
274
286
  } else if (!isObject(meta) && !isUndefined(meta) && !isNull(meta)) {
275
- // if the `meta` variable passed was not an Object then convert it
287
+ // If the `meta` variable passed was not an Object then convert it
276
288
  message = format(message, meta);
277
289
  meta = {};
278
290
  } else if (!isString(message)) {
279
- // if the message is not a string then we should run `util.format` on it
291
+ // If the message is not a string then we should run `util.format` on it
280
292
  // assuming we're formatting it like it was another argument
281
293
  // (as opposed to using something like fast-json-stringify)
282
294
  message = format(message);
283
295
  }
284
- } // if (!isPlainObject(meta)) meta = {};
296
+ } // If (!isPlainObject(meta)) meta = {};
285
297
 
286
298
 
287
299
  if (!isUndefined(meta) && !isObject(meta)) meta = {
@@ -296,32 +308,32 @@ var Axe = /*#__PURE__*/function () {
296
308
  message = _message.message;
297
309
  } else if (isError(meta.err)) {
298
310
  error = meta.err;
299
- } // omit `callback` from `meta` if it was passed
311
+ } // Omit `callback` from `meta` if it was passed
300
312
 
301
313
 
302
314
  var callback = isFunction(config.callback) && (!isBoolean(meta.callback) || meta.callback);
303
- meta = omit(meta, ['callback']); // set default level on meta
315
+ meta = omit(meta, ['callback']); // Set default level on meta
304
316
 
305
- meta.level = level; // add `app` object to metadata
317
+ meta.level = level; // Add `app` object to metadata
306
318
 
307
- if (this.appInfo) meta.app = this.appInfo; // set the body used for returning with and sending logs
319
+ if (this.appInfo) meta.app = this.appInfo; // Set the body used for returning with and sending logs
308
320
  // (and also remove circular references)
309
321
 
310
322
  var body = safeStringify({
311
323
  message: message,
312
324
  meta: meta
313
- }); // send to Cabin or other logging service here the `message` and `meta`
325
+ }); // Send to Cabin or other logging service here the `message` and `meta`
314
326
 
315
327
  if (config.capture && config.levels.includes(level) && (!isError(error) || !error._captureFailed)) {
316
- // if the user didn't specify a key
328
+ // If the user didn't specify a key
317
329
  // and they are using the default endpoint
318
330
  // then we should throw an error to them
319
- if (config.endpoint === endpoint && !config.key) throw new Error("Cabin API key required (e.g. `{ key: 'YOUR-CABIN-API-KEY' })`)\n<https://cabinjs.com>"); // capture the log over HTTP
331
+ if (config.endpoint === endpoint && !config.key) throw new Error("Cabin API key required (e.g. `{ key: 'YOUR-CABIN-API-KEY' })`)\n<https://cabinjs.com>"); // Capture the log over HTTP
320
332
 
321
333
  var request = superagent.post(config.endpoint).set('X-Request-Id', cuid()).timeout(config.timeout);
322
- if (!process.browser) request.set('User-Agent', "axe/".concat(pkg.version)); // basic auth (e.g. Cabin API key)
334
+ if (!process.browser) request.set('User-Agent', "axe/".concat(pkg.version)); // Basic auth (e.g. Cabin API key)
323
335
 
324
- if (config.key) request.auth(config.key); // set headers if any
336
+ if (config.key) request.auth(config.key); // Set headers if any
325
337
 
326
338
  if (!isEmpty(config.headers)) request.set(config.headers);
327
339
  request.type('application/json').send(body).retry(config.retry).end(function (error_) {
@@ -331,12 +343,12 @@ var Axe = /*#__PURE__*/function () {
331
343
  _this2.config.logger.error(error_);
332
344
  }
333
345
  });
334
- } // custom callback function (e.g. Slack message)
346
+ } // Custom callback function (e.g. Slack message)
335
347
 
336
348
 
337
- if (callback) config.callback(level, message, meta); // suppress logs if it was silent
349
+ if (callback) config.callback(level, message, meta); // Suppress logs if it was silent
338
350
 
339
- if (config.silent) return body; // return early if it is not a valid logging level
351
+ if (config.silent) return body; // Return early if it is not a valid logging level
340
352
 
341
353
  if (!config.levels.includes(level)) return body; //
342
354
  // determine log method to use
@@ -349,17 +361,21 @@ var Axe = /*#__PURE__*/function () {
349
361
  //
350
362
 
351
363
  var method = level;
352
- if (modifier === -1) method = 'log';else if (level === 'fatal') method = 'error'; // if there was meta information then output it
364
+ if (modifier === -1) method = 'log';else if (level === 'fatal') method = 'error'; // If there was meta information then output it
365
+ // setup ommitted fields
366
+
367
+ var omittedFields = ['level', 'err'].concat(this.config.meta.omittedFields); // Omit app is configured
353
368
 
354
- var omitted = omit(meta, ['level', 'err']); // show stack trace if necessary (along with any metadata)
369
+ if (!this.config.meta.showApp) omittedFields.push('app');
370
+ var omitted = omit(meta, omittedFields); // Show stack trace if necessary (along with any metadata)
355
371
 
356
372
  if (method === 'error' && isError(error) && config.showStack) {
357
- if (!config.showMeta || isEmpty(omitted)) this.config.logger.error(error);else this.config.logger.error(error, omitted);
358
- } else if (!config.showMeta || isEmpty(omitted)) {
373
+ if (!config.meta.show || isEmpty(omitted)) this.config.logger.error(error);else this.config.logger.error(error, omitted);
374
+ } else if (!config.meta.show || isEmpty(omitted)) {
359
375
  this.config.logger[method](message);
360
376
  } else {
361
377
  this.config.logger[method](message, omitted);
362
- } // return the parsed body in case we need it
378
+ } // Return the parsed body in case we need it
363
379
 
364
380
 
365
381
  return body;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "axe",
3
3
  "description": "Logging add-on to send logs over HTTP to your server in Node and Browser environments. Works with any logger! Chop up your logs consistently! Made for Cabin and Lad.",
4
- "version": "8.0.0",
4
+ "version": "8.1.0",
5
5
  "author": "Nick Baugh <niftylettuce@gmail.com> (http://niftylettuce.com)",
6
6
  "ava": {
7
7
  "serial": true,