axe 7.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,15 +297,23 @@ 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.
303
307
  * `level` (String) - the default level of logging to capture (defaults to `info`, which includes all logs including info and higher in severity (e.g. `info`, `warn`, `error`, `fatal`)
304
- * `capture` (Boolean) - defaults to `false` in browser (all environments) and server-side (non-production only) environments, whether or not to `POST` logs to the `endpoint` (takes into consideration the `config.level` to only send valid capture levels
308
+ * `capture` (Boolean) - defaults to `false`, whether or not to `POST` logs to the `endpoint` (takes into consideration the `config.level` to only send valid capture levels)
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
@@ -4713,14 +4713,11 @@ exports.cleanHeader = function (header, changesOrigin) {
4713
4713
 
4714
4714
  var replace = String.prototype.replace;
4715
4715
  var percentTwenties = /%20/g;
4716
-
4717
- var util = require('./utils');
4718
-
4719
4716
  var Format = {
4720
4717
  RFC1738: 'RFC1738',
4721
4718
  RFC3986: 'RFC3986'
4722
4719
  };
4723
- module.exports = util.assign({
4720
+ module.exports = {
4724
4721
  'default': Format.RFC3986,
4725
4722
  formatters: {
4726
4723
  RFC1738: function RFC1738(value) {
@@ -4729,10 +4726,12 @@ module.exports = util.assign({
4729
4726
  RFC3986: function RFC3986(value) {
4730
4727
  return String(value);
4731
4728
  }
4732
- }
4733
- }, Format);
4729
+ },
4730
+ RFC1738: Format.RFC1738,
4731
+ RFC3986: Format.RFC3986
4732
+ };
4734
4733
 
4735
- },{"./utils":26}],23:[function(require,module,exports){
4734
+ },{}],23:[function(require,module,exports){
4736
4735
  'use strict';
4737
4736
 
4738
4737
  var stringify = require('./stringify');
@@ -4885,7 +4884,7 @@ var parseObject = function parseObject(chain, val, options, valuesParsed) {
4885
4884
  }
4886
4885
  }
4887
4886
 
4888
- leaf = obj; // eslint-disable-line no-param-reassign
4887
+ leaf = obj;
4889
4888
  }
4890
4889
 
4891
4890
  return leaf;
@@ -5051,7 +5050,7 @@ var isNonNullishPrimitive = function isNonNullishPrimitive(v) {
5051
5050
  return typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean' || _typeof(v) === 'symbol' || typeof v === 'bigint';
5052
5051
  };
5053
5052
 
5054
- var stringify = function stringify(object, prefix, generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots, serializeDate, formatter, encodeValuesOnly, charset) {
5053
+ var stringify = function stringify(object, prefix, generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset) {
5055
5054
  var obj = object;
5056
5055
 
5057
5056
  if (typeof filter === 'function') {
@@ -5065,12 +5064,12 @@ var stringify = function stringify(object, prefix, generateArrayPrefix, strictNu
5065
5064
  }
5066
5065
 
5067
5066
  return value;
5068
- }).join(',');
5067
+ });
5069
5068
  }
5070
5069
 
5071
5070
  if (obj === null) {
5072
5071
  if (strictNullHandling) {
5073
- return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, 'key') : prefix;
5072
+ return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, 'key', format) : prefix;
5074
5073
  }
5075
5074
 
5076
5075
  obj = '';
@@ -5078,8 +5077,8 @@ var stringify = function stringify(object, prefix, generateArrayPrefix, strictNu
5078
5077
 
5079
5078
  if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {
5080
5079
  if (encoder) {
5081
- var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key');
5082
- return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value'))];
5080
+ var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key', format);
5081
+ return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value', format))];
5083
5082
  }
5084
5083
 
5085
5084
  return [formatter(prefix) + '=' + formatter(String(obj))];
@@ -5093,7 +5092,12 @@ var stringify = function stringify(object, prefix, generateArrayPrefix, strictNu
5093
5092
 
5094
5093
  var objKeys;
5095
5094
 
5096
- if (isArray(filter)) {
5095
+ if (generateArrayPrefix === 'comma' && isArray(obj)) {
5096
+ // we need to join elements in
5097
+ objKeys = [{
5098
+ value: obj.length > 0 ? obj.join(',') || null : undefined
5099
+ }];
5100
+ } else if (isArray(filter)) {
5097
5101
  objKeys = filter;
5098
5102
  } else {
5099
5103
  var keys = Object.keys(obj);
@@ -5102,14 +5106,14 @@ var stringify = function stringify(object, prefix, generateArrayPrefix, strictNu
5102
5106
 
5103
5107
  for (var i = 0; i < objKeys.length; ++i) {
5104
5108
  var key = objKeys[i];
5105
- var value = obj[key];
5109
+ var value = _typeof(key) === 'object' && key.value !== undefined ? key.value : obj[key];
5106
5110
 
5107
5111
  if (skipNulls && value === null) {
5108
5112
  continue;
5109
5113
  }
5110
5114
 
5111
5115
  var keyPrefix = isArray(obj) ? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(prefix, key) : prefix : prefix + (allowDots ? '.' + key : '[' + key + ']');
5112
- pushToArray(values, stringify(value, keyPrefix, generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots, serializeDate, formatter, encodeValuesOnly, charset));
5116
+ pushToArray(values, stringify(value, keyPrefix, generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset));
5113
5117
  }
5114
5118
 
5115
5119
  return values;
@@ -5157,6 +5161,7 @@ var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
5157
5161
  encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults.encoder,
5158
5162
  encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults.encodeValuesOnly,
5159
5163
  filter: filter,
5164
+ format: format,
5160
5165
  formatter: formatter,
5161
5166
  serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults.serializeDate,
5162
5167
  skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults.skipNulls,
@@ -5212,7 +5217,7 @@ module.exports = function (object, opts) {
5212
5217
  continue;
5213
5218
  }
5214
5219
 
5215
- pushToArray(keys, stringify(obj[key], key, generateArrayPrefix, options.strictNullHandling, options.skipNulls, options.encode ? options.encoder : null, options.filter, options.sort, options.allowDots, options.serializeDate, options.formatter, options.encodeValuesOnly, options.charset));
5220
+ pushToArray(keys, stringify(obj[key], key, generateArrayPrefix, options.strictNullHandling, options.skipNulls, options.encode ? options.encoder : null, options.filter, options.sort, options.allowDots, options.serializeDate, options.format, options.formatter, options.encodeValuesOnly, options.charset));
5216
5221
  }
5217
5222
 
5218
5223
  var joined = keys.join(options.delimiter);
@@ -5236,6 +5241,8 @@ module.exports = function (object, opts) {
5236
5241
 
5237
5242
  function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
5238
5243
 
5244
+ var formats = require('./formats');
5245
+
5239
5246
  var has = Object.prototype.hasOwnProperty;
5240
5247
  var isArray = Array.isArray;
5241
5248
 
@@ -5363,7 +5370,7 @@ var decode = function decode(str, decoder, charset) {
5363
5370
  }
5364
5371
  };
5365
5372
 
5366
- var encode = function encode(str, defaultEncoder, charset) {
5373
+ var encode = function encode(str, defaultEncoder, charset, kind, format) {
5367
5374
  // This code was originally written by Brian White (mscdex) for the io.js core querystring library.
5368
5375
  // It has been adapted here for stricter adherence to RFC 3986
5369
5376
  if (str.length === 0) {
@@ -5396,6 +5403,7 @@ var encode = function encode(str, defaultEncoder, charset) {
5396
5403
  || c >= 0x30 && c <= 0x39 // 0-9
5397
5404
  || c >= 0x41 && c <= 0x5A // a-z
5398
5405
  || c >= 0x61 && c <= 0x7A // A-Z
5406
+ || format === formats.RFC1738 && (c === 0x28 || c === 0x29) // ( )
5399
5407
  ) {
5400
5408
  out += string.charAt(i);
5401
5409
  continue;
@@ -5499,11 +5507,11 @@ module.exports = {
5499
5507
  merge: merge
5500
5508
  };
5501
5509
 
5502
- },{}],27:[function(require,module,exports){
5510
+ },{"./formats":22}],27:[function(require,module,exports){
5503
5511
  module.exports={
5504
5512
  "name": "axe",
5505
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.",
5506
- "version": "6.0.7",
5514
+ "version": "8.0.0",
5507
5515
  "author": "Nick Baugh <niftylettuce@gmail.com> (http://niftylettuce.com)",
5508
5516
  "ava": {
5509
5517
  "serial": true,
@@ -5540,42 +5548,42 @@ module.exports={
5540
5548
  "format-specifiers": "^1.0.0",
5541
5549
  "iserror": "^0.0.2",
5542
5550
  "lodash.omit": "^4.5.0",
5543
- "parse-app-info": "^4.0.0",
5551
+ "parse-app-info": "^4.0.2",
5544
5552
  "parse-err": "^0.0.12",
5545
5553
  "superagent": "^6.1.0"
5546
5554
  },
5547
5555
  "devDependencies": {
5548
- "@babel/cli": "^7.12.7",
5549
- "@babel/core": "^7.12.7",
5550
- "@babel/preset-env": "^7.12.7",
5556
+ "@babel/cli": "^7.12.10",
5557
+ "@babel/core": "^7.12.10",
5558
+ "@babel/preset-env": "^7.12.11",
5551
5559
  "@commitlint/cli": "^11.0.0",
5552
5560
  "@commitlint/config-conventional": "^11.0.0",
5553
- "ava": "^3.13.0",
5561
+ "ava": "^3.15.0",
5554
5562
  "babelify": "^10.0.0",
5555
5563
  "browserify": "^17.0.0",
5556
5564
  "codecov": "^3.8.1",
5557
5565
  "consola": "^2.15.0",
5558
- "cross-env": "^7.0.2",
5559
- "eslint": "^7.14.0",
5566
+ "cross-env": "^7.0.3",
5567
+ "eslint": "^7.17.0",
5560
5568
  "eslint-config-xo-lass": "^1.0.4",
5561
- "eslint-plugin-compat": "^3.8.0",
5569
+ "eslint-plugin-compat": "^3.9.0",
5562
5570
  "eslint-plugin-node": "^11.1.0",
5563
5571
  "express": "^4.17.1",
5564
- "fixpack": "^3.0.6",
5565
- "husky": "^4.3.0",
5572
+ "fixpack": "^4.0.0",
5573
+ "husky": "^4.3.7",
5566
5574
  "jsdom": "15.x",
5567
- "koa": "^2.13.0",
5568
- "lint-staged": "^10.5.1",
5575
+ "koa": "^2.13.1",
5576
+ "lint-staged": "^10.5.3",
5569
5577
  "lodash": "^4.17.20",
5570
5578
  "nyc": "^15.1.0",
5571
- "pino": "^6.7.0",
5579
+ "pino": "^6.10.0",
5572
5580
  "remark-cli": "^9.0.0",
5573
- "remark-preset-github": "^3.0.4",
5581
+ "remark-preset-github": "^4.0.1",
5574
5582
  "rimraf": "^3.0.2",
5575
5583
  "signale": "^1.4.0",
5576
- "sinon": "^9.2.1",
5584
+ "sinon": "^9.2.3",
5577
5585
  "tinyify": "https://github.com/niftylettuce/tinyify",
5578
- "xo": "^0.35.0"
5586
+ "xo": "^0.37.1"
5579
5587
  },
5580
5588
  "engines": {
5581
5589
  "node": ">=7.0.0"
@@ -5734,7 +5742,6 @@ var aliases = {
5734
5742
  err: 'error'
5735
5743
  };
5736
5744
  var endpoint = 'https://api.cabinjs.com';
5737
- var env = process.env.NODE_ENV || 'development';
5738
5745
  var levelError = "`level` invalid, must be: ".concat(levels.join(', ')); // <https://stackoverflow.com/a/43233163>
5739
5746
 
5740
5747
  function isEmpty(value) {
@@ -5780,18 +5787,31 @@ var Axe = /*#__PURE__*/function () {
5780
5787
  timeout: 5000,
5781
5788
  retry: 3,
5782
5789
  showStack: process.env.SHOW_STACK ? boolean(process.env.SHOW_STACK) : true,
5783
- 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
+ },
5784
5797
  silent: false,
5785
5798
  logger: console,
5786
5799
  name: false,
5787
5800
  level: 'info',
5788
5801
  levels: ['info', 'warn', 'error', 'fatal'],
5789
- capture: process.browser ? false : env === 'production',
5802
+ // TODO: if user specifies `key` and it is `process.platform === 'browser' || process.browser || env === 'production'` then set `capture` to `true`
5803
+ capture: false,
5790
5804
  callback: false,
5791
5805
  appInfo: process.env.APP_INFO ? boolean(process.env.APP_INFO) : true
5792
- }, 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
+
5793
5813
  this.appInfo = this.config.appInfo ? isFunction(parseAppInfo) ? parseAppInfo() : false : false;
5794
- this.log = this.log.bind(this); // inherit methods from parent logger
5814
+ this.log = this.log.bind(this); // Inherit methods from parent logger
5795
5815
 
5796
5816
  var methods = Object.keys(this.config.logger).filter(function (key) {
5797
5817
  return !omittedLoggerKeys.has(key);
@@ -5804,7 +5824,7 @@ var Axe = /*#__PURE__*/function () {
5804
5824
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
5805
5825
  var element = _step.value;
5806
5826
  this[element] = this.config.logger[element];
5807
- } // bind helper functions for each log level
5827
+ } // Bind helper functions for each log level
5808
5828
 
5809
5829
  } catch (err) {
5810
5830
  _iterator.e(err);
@@ -5830,7 +5850,7 @@ var Axe = /*#__PURE__*/function () {
5830
5850
 
5831
5851
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
5832
5852
  _loop();
5833
- } // 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
5834
5854
 
5835
5855
  } catch (err) {
5836
5856
  _iterator2.e(err);
@@ -5841,11 +5861,11 @@ var Axe = /*#__PURE__*/function () {
5841
5861
  this.setLevel = this.setLevel.bind(this);
5842
5862
  this.getNormalizedLevel = this.getNormalizedLevel.bind(this);
5843
5863
  this.setName = this.setName.bind(this);
5844
- this.setCallback = this.setCallback.bind(this); // set the logger name
5864
+ this.setCallback = this.setCallback.bind(this); // Set the logger name
5845
5865
 
5846
- 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
5847
5867
 
5848
- this.setLevel(this.config.level); // aliases
5868
+ this.setLevel(this.config.level); // Aliases
5849
5869
 
5850
5870
  this.err = this.error;
5851
5871
  this.warning = this.warn;
@@ -5859,9 +5879,9 @@ var Axe = /*#__PURE__*/function () {
5859
5879
  }, {
5860
5880
  key: "setLevel",
5861
5881
  value: function setLevel(level) {
5862
- 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`
5863
5883
 
5864
- 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
5865
5885
  // so that it has all proceeding (inclusive)
5866
5886
 
5867
5887
  this.config.levels = levels.slice(levels.indexOf(level));
@@ -5877,7 +5897,7 @@ var Axe = /*#__PURE__*/function () {
5877
5897
  }, {
5878
5898
  key: "setName",
5879
5899
  value: function setName(name) {
5880
- 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`
5881
5901
 
5882
5902
  if (isString(this.config.logger.scope)) this.config.logger.scope = name;else this.config.logger.name = name;
5883
5903
  } // eslint-disable-next-line complexity
@@ -5911,7 +5931,7 @@ var Axe = /*#__PURE__*/function () {
5911
5931
  message = level;
5912
5932
  level = this.getNormalizedLevel(level);
5913
5933
  modifier = -1;
5914
- } // bunyan support (meta, message, ...args)
5934
+ } // Bunyan support (meta, message, ...args)
5915
5935
 
5916
5936
 
5917
5937
  var isBunyan = false;
@@ -5921,10 +5941,10 @@ var Axe = /*#__PURE__*/function () {
5921
5941
  var _meta = meta;
5922
5942
  meta = message;
5923
5943
  message = isString(_meta) && originalArgs.length >= 3 + modifier ? format.apply(void 0, _toConsumableArray(originalArgs.slice(2 + modifier))) : _meta;
5924
- } // if message was undefined then set it to level
5944
+ } // If message was undefined then set it to level
5925
5945
 
5926
5946
 
5927
- 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
5928
5948
  // preserve it as an Object by setting it as meta
5929
5949
 
5930
5950
  if (originalArgs.slice(1 + modifier).length === 1 && !isString(message) && !isError(message)) {
@@ -5933,14 +5953,14 @@ var Axe = /*#__PURE__*/function () {
5933
5953
  };
5934
5954
  message = level;
5935
5955
  } else if (!isBunyan && originalArgs.length >= 4 + modifier) {
5936
- // if there are four or more args
5956
+ // If there are four or more args
5937
5957
  // then infer to use util.format on everything
5938
5958
  message = format.apply(void 0, _toConsumableArray(originalArgs.slice(1 + modifier)));
5939
5959
  meta = {};
5940
5960
  } else if (!isBunyan && originalArgs.length === 3 + modifier && isString(message) && formatSpecifiers.filter(function (t) {
5941
5961
  return message.includes(t);
5942
5962
  }).length > 0) {
5943
- // otherwise if there are three args and if the `message` contains
5963
+ // Otherwise if there are three args and if the `message` contains
5944
5964
  // a placeholder token (e.g. '%s' or '%d' - see above `formatSpecifiers` variable)
5945
5965
  // then we can infer that the `meta` arg passed is used for formatting
5946
5966
  message = format(message, meta);
@@ -5951,71 +5971,71 @@ var Axe = /*#__PURE__*/function () {
5951
5971
  err: parseErr(meta)
5952
5972
  }; // } else if (!isPlainObject(meta) && !isUndefined(meta) && !isNull(meta)) {
5953
5973
  } else if (!isObject(meta) && !isUndefined(meta) && !isNull(meta)) {
5954
- // 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
5955
5975
  message = format(message, meta);
5956
5976
  meta = {};
5957
5977
  } else if (!isString(message)) {
5958
- // 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
5959
5979
  // assuming we're formatting it like it was another argument
5960
5980
  // (as opposed to using something like fast-json-stringify)
5961
5981
  message = format(message);
5962
5982
  }
5963
- } // if (!isPlainObject(meta)) meta = {};
5983
+ } // If (!isPlainObject(meta)) meta = {};
5964
5984
 
5965
5985
 
5966
5986
  if (!isUndefined(meta) && !isObject(meta)) meta = {
5967
5987
  meta: meta
5968
5988
  };else if (!isObject(meta)) meta = {};
5969
- var err;
5989
+ var error;
5970
5990
 
5971
5991
  if (isError(message)) {
5972
- err = message;
5973
- if (!isObject(meta.err)) meta.err = parseErr(err);
5992
+ error = message;
5993
+ if (!isObject(meta.err)) meta.err = parseErr(error);
5974
5994
  var _message = message;
5975
5995
  message = _message.message;
5976
5996
  } else if (isError(meta.err)) {
5977
- err = meta.err;
5978
- } // omit `callback` from `meta` if it was passed
5997
+ error = meta.err;
5998
+ } // Omit `callback` from `meta` if it was passed
5979
5999
 
5980
6000
 
5981
6001
  var callback = isFunction(config.callback) && (!isBoolean(meta.callback) || meta.callback);
5982
- meta = omit(meta, ['callback']); // set default level on meta
6002
+ meta = omit(meta, ['callback']); // Set default level on meta
5983
6003
 
5984
- meta.level = level; // add `app` object to metadata
6004
+ meta.level = level; // Add `app` object to metadata
5985
6005
 
5986
- 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
5987
6007
  // (and also remove circular references)
5988
6008
 
5989
6009
  var body = safeStringify({
5990
6010
  message: message,
5991
6011
  meta: meta
5992
- }); // 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`
5993
6013
 
5994
- if (config.capture && config.levels.includes(level) && (!isError(err) || !err._captureFailed)) {
5995
- // if the user didn't specify a key
6014
+ if (config.capture && config.levels.includes(level) && (!isError(error) || !error._captureFailed)) {
6015
+ // If the user didn't specify a key
5996
6016
  // and they are using the default endpoint
5997
6017
  // then we should throw an error to them
5998
- 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
5999
6019
 
6000
6020
  var request = superagent.post(config.endpoint).set('X-Request-Id', cuid()).timeout(config.timeout);
6001
- 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)
6002
6022
 
6003
- if (config.key) request.auth(config.key); // set headers if any
6023
+ if (config.key) request.auth(config.key); // Set headers if any
6004
6024
 
6005
6025
  if (!isEmpty(config.headers)) request.set(config.headers);
6006
- request.type('application/json').send(body).retry(config.retry).end(function (err) {
6007
- if (err) {
6008
- err._captureFailed = true;
6026
+ request.type('application/json').send(body).retry(config.retry).end(function (error_) {
6027
+ if (error_) {
6028
+ error_._captureFailed = true;
6009
6029
 
6010
- _this2.config.logger.error(err);
6030
+ _this2.config.logger.error(error_);
6011
6031
  }
6012
6032
  });
6013
- } // custom callback function (e.g. Slack message)
6033
+ } // Custom callback function (e.g. Slack message)
6014
6034
 
6015
6035
 
6016
- 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
6017
6037
 
6018
- 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
6019
6039
 
6020
6040
  if (!config.levels.includes(level)) return body; //
6021
6041
  // determine log method to use
@@ -6028,17 +6048,21 @@ var Axe = /*#__PURE__*/function () {
6028
6048
  //
6029
6049
 
6030
6050
  var method = level;
6031
- 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
6032
6055
 
6033
- 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)
6034
6058
 
6035
- if (method === 'error' && isError(err) && config.showStack) {
6036
- if (!config.showMeta || isEmpty(omitted)) this.config.logger.error(err);else this.config.logger.error(err, omitted);
6037
- } else if (!config.showMeta || isEmpty(omitted)) {
6059
+ if (method === 'error' && isError(error) && config.showStack) {
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)) {
6038
6062
  this.config.logger[method](message);
6039
6063
  } else {
6040
6064
  this.config.logger[method](message, omitted);
6041
- } // return the parsed body in case we need it
6065
+ } // Return the parsed body in case we need it
6042
6066
 
6043
6067
 
6044
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)}function N(t){return(N="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)}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 I=Object.prototype.hasOwnProperty,L=Array.isArray,q=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),H={assign:function(t,e){return Object.keys(e).reduce(function(t,r){return t[r]=e[r],t},t)},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"==N(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(L(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){if(0===t.length)return t;var n=t;if("symbol"==N(t)?n=Symbol.prototype.toString.call(t):"string"!=typeof t&&(n=String(t)),"iso-8859-1"===r)return escape(n).replace(/%u[0-9a-f]{4}/gi,function(t){return"%26%23"+parseInt(t.slice(2),16)+"%3B"});for(var o="",i=0;i<n.length;++i){var s=n.charCodeAt(i);45===s||46===s||95===s||126===s||s>=48&&s<=57||s>=65&&s<=90||s>=97&&s<=122?o+=n.charAt(i):s<128?o+=q[s]:s<2048?o+=q[192|s>>6]+q[128|63&s]:s<55296||s>=57344?o+=q[224|s>>12]+q[128|s>>6&63]+q[128|63&s]:(i+=1,s=65536+((1023&s)<<10|1023&n.charCodeAt(i)),o+=q[240|s>>18]+q[128|s>>12&63]+q[128|s>>6&63]+q[128|63&s])}return o},isBuffer:function(t){return!(!t||"object"!=N(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(L(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"!=N(r)){if(L(e))e.push(r);else{if(!e||"object"!=N(e))return[e,r];(n&&(n.plainObjects||n.allowPrototypes)||!I.call(Object.prototype,r))&&(e[r]=!0)}return e}if(!e||"object"!=N(e))return[e].concat(r);var o=e;return L(e)&&!L(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)),L(e)&&L(r)?(r.forEach(function(r,o){if(I.call(e,o)){var i=e[o];i&&"object"==N(i)&&r&&"object"==N(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 I.call(e,o)?e[o]=t(e[o],i,n):e[o]=i,e},o)}},M=String.prototype.replace,U=/%20/g,z={RFC1738:"RFC1738",RFC3986:"RFC3986"},F=H.assign({default:z.RFC3986,formatters:{RFC1738:function(t){return M.call(t,U,"+")},RFC3986:function(t){return String(t)}}},z);function $(t){return($="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 B=Object.prototype.hasOwnProperty,X={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},Q=Array.isArray,J=Array.prototype.push,G=function(t,e){J.apply(t,Q(e)?e:[e])},V=Date.prototype.toISOString,W=F.default,K={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:H.encode,encodeValuesOnly:!1,format:W,formatter:F.formatters[W],indices:!1,serializeDate:function(t){return V.call(t)},skipNulls:!1,strictNullHandling:!1},Y=function t(e,r,n,o,i,s,a,u,c,l,f,p,h){var y,d=e;if("function"==typeof a?d=a(r,d):d instanceof Date?d=l(d):"comma"===n&&Q(d)&&(d=H.maybeMap(d,function(t){return t instanceof Date?l(t):t}).join(",")),null===d){if(o)return s&&!p?s(r,K.encoder,h,"key"):r;d=""}if("string"==typeof(y=d)||"number"==typeof y||"boolean"==typeof y||"symbol"==$(y)||"bigint"==typeof y||H.isBuffer(d))return s?[f(p?r:s(r,K.encoder,h,"key"))+"="+f(s(d,K.encoder,h,"value"))]:[f(r)+"="+f(String(d))];var m,b=[];if(void 0===d)return b;if(Q(a))m=a;else{var v=Object.keys(d);m=u?v.sort(u):v}for(var g=0;g<m.length;++g){var _=m[g],w=d[_];if(!i||null!==w){var S=Q(d)?"function"==typeof n?n(r,_):r:r+(c?"."+_:"["+_+"]");G(b,t(w,S,n,o,i,s,a,u,c,l,f,p,h))}}return b},Z=(Object.prototype.hasOwnProperty,Array.isArray,{stringify:function(t,e){var r,n=t,o=function(t){if(!t)return K;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||K.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=F.default;if(void 0!==t.format){if(!B.call(F.formatters,t.format))throw new TypeError("Unknown format option provided.");r=t.format}var n=F.formatters[r],o=K.filter;return("function"==typeof t.filter||Q(t.filter))&&(o=t.filter),{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:K.addQueryPrefix,allowDots:void 0===t.allowDots?K.allowDots:!!t.allowDots,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:K.charsetSentinel,delimiter:void 0===t.delimiter?K.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:K.encode,encoder:"function"==typeof t.encoder?t.encoder:K.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:K.encodeValuesOnly,filter:o,formatter:n,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:K.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:K.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:K.strictNullHandling}}(e);"function"==typeof o.filter?n=(0,o.filter)("",n):Q(o.filter)&&(r=o.filter);var i,s=[];if("object"!=$(n)||null===n)return"";i=e&&e.arrayFormat in X?e.arrayFormat:e&&"indices"in e?e.indices?"indices":"repeat":"indices";var a=X[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]||G(s,Y(n[c],c,a,o.strictNullHandling,o.skipNulls,o.encode?o.encoder:null,o.filter,o.sort,o.allowDots,o.serializeDate,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 tt(t){return(tt="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 et(t){return(et="function"==typeof Symbol&&"symbol"==tt(Symbol.iterator)?function(t){return tt(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":tt(t)})(t)}var rt=function(t){return null!==t&&"object"===et(t)},nt={};function ot(t){return(ot="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 it(t){return(it="function"==typeof Symbol&&"symbol"==ot(Symbol.iterator)?function(t){return ot(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":ot(t)})(t)}function st(t){if(t)return function(t){for(var e in st.prototype)Object.prototype.hasOwnProperty.call(st.prototype,e)&&(t[e]=st.prototype[e]);return t}(t)}nt=st,st.prototype.clearTimeout=function(){return clearTimeout(this._timer),clearTimeout(this._responseTimeoutTimer),clearTimeout(this._uploadTimeoutTimer),delete this._timer,delete this._responseTimeoutTimer,delete this._uploadTimeoutTimer,this},st.prototype.parse=function(t){return this._parser=t,this},st.prototype.responseType=function(t){return this._responseType=t,this},st.prototype.serialize=function(t){return this._serializer=t,this},st.prototype.timeout=function(t){if(!t||"object"!==it(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},st.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 at=new Set(["ETIMEDOUT","ECONNRESET","EADDRINUSE","ECONNREFUSED","EPIPE","ENOTFOUND","ENETUNREACH","EAI_AGAIN"]),ut=new Set([408,413,429,500,502,503,504,521,522,524]);st.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&&ut.has(e.status))return!0;if(t){if(t.code&&at.has(t.code))return!0;if(t.timeout&&"ECONNABORTED"===t.code)return!0;if(t.crossDomain)return!0}return!1},st.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()},st.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)},st.prototype.catch=function(t){return this.then(void 0,t)},st.prototype.use=function(t){return t(this),this},st.prototype.ok=function(t){if("function"!=typeof t)throw new Error("Callback required");return this._okCallback=t,this},st.prototype._isResponseOK=function(t){return!!t&&(this._okCallback?this._okCallback(t):t.status>=200&&t.status<300)},st.prototype.get=function(t){return this._header[t.toLowerCase()]},st.prototype.getHeader=st.prototype.get,st.prototype.set=function(t,e){if(rt(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},st.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},st.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(rt(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},st.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)},st.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},st.prototype.withCredentials=function(t){return void 0===t&&(t=!0),this._withCredentials=t,this},st.prototype.redirects=function(t){return this._maxRedirects=t,this},st.prototype.maxResponseSize=function(t){if("number"!=typeof t)throw new TypeError("Invalid argument");return this._maxResponseSize=t,this},st.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},st.prototype.send=function(t){var e=rt(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&&rt(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)},st.prototype.sortQuery=function(t){return this._sort=void 0===t||t,this},st.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("&")}}},st.prototype._appendQueryString=function(){console.warn("Unsupported")},st.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)}},st.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 ct={};function lt(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 ft(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)?ft(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 ft(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}ct.type=function(t){return t.split(/ *; */).shift()},ct.params=function(t){var e,r={},n=lt(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},ct.parseLinks=function(t){var e,r={},n=lt(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 pt={};function ht(t){if(t)return function(t){for(var e in ht.prototype)Object.prototype.hasOwnProperty.call(ht.prototype,e)&&(t[e]=ht.prototype[e]);return t}(t)}pt=ht,ht.prototype.get=function(t){return this.header[t.toLowerCase()]},ht.prototype._setHeaderProperties=function(t){var e=t["content-type"]||"";this.type=ct.type(e);var r=ct.params(e);for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(this[n]=r[n]);this.links={};try{t.link&&(this.links=ct.parseLinks(t.link))}catch(o){}},ht.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 yt={};function dt(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 mt(){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){mt.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}}),mt.prototype._setDefaults=function(t){this._defaults.forEach(function(e){var r;t[e.fn].apply(t,function(t){if(Array.isArray(t))return dt(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 dt(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)?dt(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.")}())})},yt=mt;var bt,vt={};function gt(t){return(gt="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 _t(t){return(_t="function"==typeof Symbol&&"symbol"==gt(Symbol.iterator)?function(t){return gt(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":gt(t)})(t)}function wt(){}"undefined"!=typeof window?bt=window:"undefined"==typeof self?(console.warn("Using browser-only version of superagent in non-browser environment"),bt=void 0):bt=self;var St=vt=vt=function(t,e){return"function"==typeof e?new vt.Request("GET",t).end(e):1===arguments.length?new vt.Request("GET",t):new vt.Request(t,e)};vt.Request=xt,St.getXHR=function(){if(bt.XMLHttpRequest&&(!bt.location||"file:"!==bt.location.protocol||!bt.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 Ot="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};function Tt(t){if(!rt(t))return t;var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&jt(e,r,t[r]);return e.join("&")}function jt(t,e,r){if(void 0!==r)if(null!==r)if(Array.isArray(r))r.forEach(function(r){jt(t,e,r)});else if(rt(r))for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&jt(t,"".concat(e,"[").concat(n,"]"),r[n]);else t.push(encodeURI(e)+"="+encodeURIComponent(r));else t.push(encodeURI(e))}function Et(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 At(t){return/[/+]json($|[^-\w])/i.test(t)}function kt(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=Ot(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 xt(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 kt(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 Ct(t,e,r){var n=St("DELETE",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n}St.serializeObject=Tt,St.parseString=Et,St.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"},St.serialize={"application/x-www-form-urlencoded":Z.stringify,"application/json":T},St.parse={"application/x-www-form-urlencoded":Et,"application/json":JSON.parse},pt(kt.prototype),kt.prototype._parseBody=function(t){var e=St.parse[this.type];return this.req._parser?this.req._parser(this,t):(!e&&At(this.type)&&(e=St.parse["application/json"]),e&&t&&(t.length>0||t instanceof Object)?e(t):null)},kt.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},St.Response=kt,R(xt.prototype),nt(xt.prototype),xt.prototype.type=function(t){return this.set("Content-Type",St.types[t]||t),this},xt.prototype.accept=function(t){return this.set("Accept",St.types[t]||t),this},xt.prototype.auth=function(t,e,r){return 1===arguments.length&&(e=""),"object"===_t(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")})},xt.prototype.query=function(t){return"string"!=typeof t&&(t=Tt(t)),t&&this._query.push(t),this},xt.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},xt.prototype._getFormData=function(){return this._formData||(this._formData=new bt.FormData),this._formData},xt.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)},xt.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)},xt.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},xt.prototype.ca=xt.prototype.agent,xt.prototype.buffer=xt.prototype.ca,xt.prototype.write=function(){throw new Error("Streaming is not supported in browser version of superagent")},xt.prototype.pipe=xt.prototype.write,xt.prototype._isHost=function(t){return t&&"object"===_t(t)&&!Array.isArray(t)&&"[object Object]"!==Object.prototype.toString.call(t)},xt.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||wt,this._finalizeQueryString(),this._end()},xt.prototype._setUploadTimeout=function(){var t=this;this._uploadTimeout&&!this._uploadTimeoutTimer&&(this._uploadTimeoutTimer=setTimeout(function(){t._timeoutError("Upload timeout of ",t._uploadTimeout,"ETIMEDOUT")},this._uploadTimeout))},xt.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=St.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||St.serialize[o?o.split(";")[0]:""];!i&&At(o)&&(i=St.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)},St.agent=function(){return new yt},["GET","POST","OPTIONS","PATCH","PUT","DELETE"].forEach(function(t){yt.prototype[t.toLowerCase()]=function(e,r){var n=new St.Request(t,e);return this._setDefaults(n),r&&n.end(r),n}}),yt.prototype.del=yt.prototype.delete,St.get=function(t,e,r){var n=St("GET",t);return"function"==typeof e&&(r=e,e=null),e&&n.query(e),r&&n.end(r),n},St.head=function(t,e,r){var n=St("HEAD",t);return"function"==typeof e&&(r=e,e=null),e&&n.query(e),r&&n.end(r),n},St.options=function(t,e,r){var n=St("OPTIONS",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n},St.del=Ct,St.delete=Ct,St.patch=function(t,e,r){var n=St("PATCH",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n},St.post=function(t,e,r){var n=St("POST",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n},St.put=function(t,e,r){var n=St("PUT",t);return"function"==typeof e&&(r=e,e=null),e&&n.send(e),r&&n.end(r),n};var Pt={};Object.defineProperty(Pt,"__esModule",{value:!0}),Pt.boolean=void 0,Pt.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 Rt,Dt,Nt,It="6.0.7",Lt=Rt={};function qt(){throw new Error("setTimeout has not been defined")}function Ht(){throw new Error("clearTimeout has not been defined")}function Mt(t){if(Dt===setTimeout)return setTimeout(t,0);if((Dt===qt||!Dt)&&setTimeout)return Dt=setTimeout,setTimeout(t,0);try{return Dt(t,0)}catch(e){try{return Dt.call(null,t,0)}catch(e){return Dt.call(this,t,0)}}}!function(){try{Dt="function"==typeof setTimeout?setTimeout:qt}catch(t){Dt=qt}try{Nt="function"==typeof clearTimeout?clearTimeout:Ht}catch(t){Nt=Ht}}();var Ut,zt=[],Ft=!1,$t=-1;function Bt(){Ft&&Ut&&(Ft=!1,Ut.length?zt=Ut.concat(zt):$t=-1,zt.length&&Xt())}function Xt(){if(!Ft){var t=Mt(Bt);Ft=!0;for(var e=zt.length;e;){for(Ut=zt,zt=[];++$t<e;)Ut&&Ut[$t].run();$t=-1,e=zt.length}Ut=null,Ft=!1,function(t){if(Nt===clearTimeout)return clearTimeout(t);if((Nt===Ht||!Nt)&&clearTimeout)return Nt=clearTimeout,clearTimeout(t);try{Nt(t)}catch(e){try{return Nt.call(null,t)}catch(e){return Nt.call(this,t)}}}(t)}}function Qt(t,e){this.fun=t,this.array=e}function Jt(){}Lt.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];zt.push(new Qt(t,e)),1!==zt.length||Ft||Mt(Xt)},Qt.prototype.run=function(){this.fun.apply(null,this.array)},Lt.title="browser",Lt.browser=!0,Lt.env={},Lt.argv=[],Lt.version="",Lt.versions={},Lt.on=Jt,Lt.addListener=Jt,Lt.once=Jt,Lt.off=Jt,Lt.removeListener=Jt,Lt.removeAllListeners=Jt,Lt.emit=Jt,Lt.prependListener=Jt,Lt.prependOnceListener=Jt,Lt.listeners=function(t){return[]},Lt.binding=function(t){throw new Error("process.binding is not supported")},Lt.cwd=function(){return"/"},Lt.chdir=function(t){throw new Error("process.chdir is not supported")},Lt.umask=function(){return 0};var Gt={};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=Pt.boolean,u=new Set(["config","log"]),c=["trace","debug","info","warn","error","fatal"],f={warning:"warn",err:"error"},p="https://api.cabinjs.com",h="production",y="`level` invalid, must be: ".concat(c.join(", "));function d(t){return null==t||"object"==s(t)&&0===Object.keys(t).length||"string"==typeof t&&0===t.trim().length}function m(t){return void 0===t}function b(t){return"object"==s(t)&&null!==t&&!Array.isArray(t)}function j(t){return"string"==typeof t}function E(t){return"function"==typeof t}Gt=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:!t.browser&&"production"===h,callback:!1,appInfo:!t.env.APP_INFO||a(t.env.APP_INFO)},i),this.appInfo=!!this.config.appInfo&&!!E(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(b){l.e(b)}finally{l.f()}var y,d=r(c);try{var m=function(){var t=y.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(d.s();!(y=d.n()).done;)m()}catch(b){d.e(b)}finally{d.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,A;return o=n,(s=[{key:"setCallback",value:function(t){this.config.callback=t}},{key:"setLevel",value:function(t){if(!j(t)||!c.includes(t))throw new Error(y);j(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 j(t)?j(f[t])?f[t]:c.includes(t)?t:"info":"info"}},{key:"setName",value:function(t){if(!j(t))throw new Error("`name` must be a String");j(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];m(r)||s.push(r),m(n)||s.push(n),m(o)||s.push(o),s=s.concat([].slice.call(u));var y=this.config,S=0;j(r)&&j(f[r])?r=f[r]:_(r)?(o=n,n=r,r="error"):j(r)&&c.includes(r)||(o=n,n=r,r=this.getNormalizedLevel(r),S=-1);var A,k=!1;if((b(n)||Array.isArray(n))&&j(o)){k=!0;var x=o;o=n,n=j(x)&&s.length>=3+S?v.apply(void 0,e(s.slice(2+S))):x}m(n)&&(n=r),1!==s.slice(1+S).length||j(n)||_(n)?!k&&s.length>=4+S?(n=v.apply(void 0,e(s.slice(1+S))),o={}):!k&&s.length===3+S&&j(n)&&g.filter(function(t){return n.includes(t)}).length>0?(n=v(n,o),o={}):_(n)||(_(o)?o={err:O(o)}:b(o)||m(o)||null===o?j(n)||(n=v(n)):(n=v(n,o),o={})):(o={message:n},n=r),m(o)||b(o)?b(o)||(o={}):o={meta:o},_(n)?(A=n,b(o.err)||(o.err=O(A)),n=n.message):_(o.err)&&(A=o.err);var C=E(y.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(y.capture&&y.levels.includes(r)&&(!_(A)||!A._captureFailed)){if(y.endpoint===p&&!y.key)throw new Error("Cabin API key required (e.g. `{ key: 'YOUR-CABIN-API-KEY' })`)\n<https://cabinjs.com>");var R=vt.post(y.endpoint).set("X-Request-Id",l()).timeout(y.timeout);t.browser||R.set("User-Agent","axe/".concat(It)),y.key&&R.auth(y.key),d(y.headers)||R.set(y.headers),R.type("application/json").send(P).retry(y.retry).end(function(t){t&&(t._captureFailed=!0,i.config.logger.error(t))})}if(C&&y.callback(r,n,o),y.silent)return P;if(!y.levels.includes(r))return P;var D=r;-1===S?D="log":"fatal"===r&&(D="error");var N=w(o,["level","err"]);return"error"===D&&_(A)&&y.showStack?!y.showMeta||d(N)?this.config.logger.error(A):this.config.logger.error(A,N):!y.showMeta||d(N)?this.config.logger[D](n):this.config.logger[D](n,N),P}}])&&i(o.prototype,s),A&&i(o,A),n}()}).call(this)}.call(this,Rt),Gt});
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
@@ -55,7 +55,6 @@ var aliases = {
55
55
  err: 'error'
56
56
  };
57
57
  var endpoint = 'https://api.cabinjs.com';
58
- var env = process.env.NODE_ENV || 'development';
59
58
  var levelError = "`level` invalid, must be: ".concat(levels.join(', ')); // <https://stackoverflow.com/a/43233163>
60
59
 
61
60
  function isEmpty(value) {
@@ -101,18 +100,31 @@ var Axe = /*#__PURE__*/function () {
101
100
  timeout: 5000,
102
101
  retry: 3,
103
102
  showStack: process.env.SHOW_STACK ? boolean(process.env.SHOW_STACK) : true,
104
- 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
+ },
105
110
  silent: false,
106
111
  logger: console,
107
112
  name: false,
108
113
  level: 'info',
109
114
  levels: ['info', 'warn', 'error', 'fatal'],
110
- capture: process.browser ? false : env === 'production',
115
+ // TODO: if user specifies `key` and it is `process.platform === 'browser' || process.browser || env === 'production'` then set `capture` to `true`
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,71 +284,71 @@ 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 = {
288
300
  meta: meta
289
301
  };else if (!isObject(meta)) meta = {};
290
- var err;
302
+ var error;
291
303
 
292
304
  if (isError(message)) {
293
- err = message;
294
- if (!isObject(meta.err)) meta.err = parseErr(err);
305
+ error = message;
306
+ if (!isObject(meta.err)) meta.err = parseErr(error);
295
307
  var _message = message;
296
308
  message = _message.message;
297
309
  } else if (isError(meta.err)) {
298
- err = meta.err;
299
- } // omit `callback` from `meta` if it was passed
310
+ error = meta.err;
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
- if (config.capture && config.levels.includes(level) && (!isError(err) || !err._captureFailed)) {
316
- // if the user didn't specify a key
327
+ if (config.capture && config.levels.includes(level) && (!isError(error) || !error._captureFailed)) {
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
- request.type('application/json').send(body).retry(config.retry).end(function (err) {
328
- if (err) {
329
- err._captureFailed = true;
339
+ request.type('application/json').send(body).retry(config.retry).end(function (error_) {
340
+ if (error_) {
341
+ error_._captureFailed = true;
330
342
 
331
- _this2.config.logger.error(err);
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
- if (method === 'error' && isError(err) && config.showStack) {
357
- if (!config.showMeta || isEmpty(omitted)) this.config.logger.error(err);else this.config.logger.error(err, omitted);
358
- } else if (!config.showMeta || isEmpty(omitted)) {
372
+ if (method === 'error' && isError(error) && config.showStack) {
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": "7.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,
@@ -38,42 +38,42 @@
38
38
  "format-specifiers": "^1.0.0",
39
39
  "iserror": "^0.0.2",
40
40
  "lodash.omit": "^4.5.0",
41
- "parse-app-info": "^4.0.0",
41
+ "parse-app-info": "^4.0.2",
42
42
  "parse-err": "^0.0.12",
43
43
  "superagent": "^6.1.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@babel/cli": "^7.12.7",
47
- "@babel/core": "^7.12.7",
48
- "@babel/preset-env": "^7.12.7",
46
+ "@babel/cli": "^7.12.10",
47
+ "@babel/core": "^7.12.10",
48
+ "@babel/preset-env": "^7.12.11",
49
49
  "@commitlint/cli": "^11.0.0",
50
50
  "@commitlint/config-conventional": "^11.0.0",
51
- "ava": "^3.13.0",
51
+ "ava": "^3.15.0",
52
52
  "babelify": "^10.0.0",
53
53
  "browserify": "^17.0.0",
54
54
  "codecov": "^3.8.1",
55
55
  "consola": "^2.15.0",
56
- "cross-env": "^7.0.2",
57
- "eslint": "^7.14.0",
56
+ "cross-env": "^7.0.3",
57
+ "eslint": "^7.17.0",
58
58
  "eslint-config-xo-lass": "^1.0.4",
59
- "eslint-plugin-compat": "^3.8.0",
59
+ "eslint-plugin-compat": "^3.9.0",
60
60
  "eslint-plugin-node": "^11.1.0",
61
61
  "express": "^4.17.1",
62
- "fixpack": "^3.0.6",
63
- "husky": "^4.3.0",
62
+ "fixpack": "^4.0.0",
63
+ "husky": "^4.3.7",
64
64
  "jsdom": "15.x",
65
- "koa": "^2.13.0",
66
- "lint-staged": "^10.5.1",
65
+ "koa": "^2.13.1",
66
+ "lint-staged": "^10.5.3",
67
67
  "lodash": "^4.17.20",
68
68
  "nyc": "^15.1.0",
69
- "pino": "^6.7.0",
69
+ "pino": "^6.10.0",
70
70
  "remark-cli": "^9.0.0",
71
- "remark-preset-github": "^3.0.4",
71
+ "remark-preset-github": "^4.0.1",
72
72
  "rimraf": "^3.0.2",
73
73
  "signale": "^1.4.0",
74
- "sinon": "^9.2.1",
74
+ "sinon": "^9.2.3",
75
75
  "tinyify": "https://github.com/niftylettuce/tinyify",
76
- "xo": "^0.35.0"
76
+ "xo": "^0.37.1"
77
77
  },
78
78
  "engines": {
79
79
  "node": ">=7.0.0"