glitch-javascript-sdk 0.6.5 → 0.6.7

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/dist/esm/index.js CHANGED
@@ -26,75 +26,75 @@ var LabelManager = /** @class */ (function () {
26
26
  return LabelManager;
27
27
  }());
28
28
 
29
- /******************************************************************************
30
- Copyright (c) Microsoft Corporation.
31
-
32
- Permission to use, copy, modify, and/or distribute this software for any
33
- purpose with or without fee is hereby granted.
34
-
35
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
36
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
37
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
38
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
39
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
40
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
41
- PERFORMANCE OF THIS SOFTWARE.
42
- ***************************************************************************** */
43
- /* global Reflect, Promise, SuppressedError, Symbol */
44
-
45
-
46
- var __assign = function() {
47
- __assign = Object.assign || function __assign(t) {
48
- for (var s, i = 1, n = arguments.length; i < n; i++) {
49
- s = arguments[i];
50
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
51
- }
52
- return t;
53
- };
54
- return __assign.apply(this, arguments);
55
- };
56
-
57
- function __awaiter(thisArg, _arguments, P, generator) {
58
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
59
- return new (P || (P = Promise))(function (resolve, reject) {
60
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
61
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
62
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
63
- step((generator = generator.apply(thisArg, _arguments || [])).next());
64
- });
65
- }
66
-
67
- function __generator(thisArg, body) {
68
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
69
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
70
- function verb(n) { return function (v) { return step([n, v]); }; }
71
- function step(op) {
72
- if (f) throw new TypeError("Generator is already executing.");
73
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
74
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
75
- if (y = 0, t) op = [op[0] & 2, t.value];
76
- switch (op[0]) {
77
- case 0: case 1: t = op; break;
78
- case 4: _.label++; return { value: op[1], done: false };
79
- case 5: _.label++; y = op[1]; op = [0]; continue;
80
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
81
- default:
82
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
83
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
84
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
85
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
86
- if (t[2]) _.ops.pop();
87
- _.trys.pop(); continue;
88
- }
89
- op = body.call(thisArg, _);
90
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
91
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
92
- }
93
- }
94
-
95
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
96
- var e = new Error(message);
97
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
29
+ /******************************************************************************
30
+ Copyright (c) Microsoft Corporation.
31
+
32
+ Permission to use, copy, modify, and/or distribute this software for any
33
+ purpose with or without fee is hereby granted.
34
+
35
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
36
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
37
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
38
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
39
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
40
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
41
+ PERFORMANCE OF THIS SOFTWARE.
42
+ ***************************************************************************** */
43
+ /* global Reflect, Promise, SuppressedError, Symbol */
44
+
45
+
46
+ var __assign = function() {
47
+ __assign = Object.assign || function __assign(t) {
48
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
49
+ s = arguments[i];
50
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
51
+ }
52
+ return t;
53
+ };
54
+ return __assign.apply(this, arguments);
55
+ };
56
+
57
+ function __awaiter(thisArg, _arguments, P, generator) {
58
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
59
+ return new (P || (P = Promise))(function (resolve, reject) {
60
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
61
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
62
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
63
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
64
+ });
65
+ }
66
+
67
+ function __generator(thisArg, body) {
68
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
69
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
70
+ function verb(n) { return function (v) { return step([n, v]); }; }
71
+ function step(op) {
72
+ if (f) throw new TypeError("Generator is already executing.");
73
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
74
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
75
+ if (y = 0, t) op = [op[0] & 2, t.value];
76
+ switch (op[0]) {
77
+ case 0: case 1: t = op; break;
78
+ case 4: _.label++; return { value: op[1], done: false };
79
+ case 5: _.label++; y = op[1]; op = [0]; continue;
80
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
81
+ default:
82
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
83
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
84
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
85
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
86
+ if (t[2]) _.ops.pop();
87
+ _.trys.pop(); continue;
88
+ }
89
+ op = body.call(thisArg, _);
90
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
91
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
92
+ }
93
+ }
94
+
95
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
96
+ var e = new Error(message);
97
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
98
98
  };
99
99
 
100
100
  var global$1 = (typeof global !== "undefined" ? global :
@@ -773,7 +773,7 @@ const isAsyncFn = kindOfTest('AsyncFunction');
773
773
  const isThenable = (thing) =>
774
774
  thing && (isObject(thing) || isFunction$2(thing)) && isFunction$2(thing.then) && isFunction$2(thing.catch);
775
775
 
776
- var utils = {
776
+ var utils$1 = {
777
777
  isArray: isArray$2,
778
778
  isArrayBuffer,
779
779
  isBuffer: isBuffer$2,
@@ -1034,6 +1034,8 @@ var isArray$1 = Array.isArray || function (arr) {
1034
1034
  * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
1035
1035
  * @license MIT
1036
1036
  */
1037
+ /* eslint-disable no-proto */
1038
+
1037
1039
 
1038
1040
  var INSPECT_MAX_BYTES = 50;
1039
1041
 
@@ -2830,7 +2832,7 @@ function AxiosError(message, code, config, request, response) {
2830
2832
  response && (this.response = response);
2831
2833
  }
2832
2834
 
2833
- utils.inherits(AxiosError, Error, {
2835
+ utils$1.inherits(AxiosError, Error, {
2834
2836
  toJSON: function toJSON() {
2835
2837
  return {
2836
2838
  // Standard
@@ -2845,7 +2847,7 @@ utils.inherits(AxiosError, Error, {
2845
2847
  columnNumber: this.columnNumber,
2846
2848
  stack: this.stack,
2847
2849
  // Axios
2848
- config: utils.toJSONObject(this.config),
2850
+ config: utils$1.toJSONObject(this.config),
2849
2851
  code: this.code,
2850
2852
  status: this.response && this.response.status ? this.response.status : null
2851
2853
  };
@@ -2880,7 +2882,7 @@ Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
2880
2882
  AxiosError.from = (error, code, config, request, response, customProps) => {
2881
2883
  const axiosError = Object.create(prototype$1);
2882
2884
 
2883
- utils.toFlatObject(error, axiosError, function filter(obj) {
2885
+ utils$1.toFlatObject(error, axiosError, function filter(obj) {
2884
2886
  return obj !== Error.prototype;
2885
2887
  }, prop => {
2886
2888
  return prop !== 'isAxiosError';
@@ -3031,7 +3033,7 @@ Item.prototype.run = function () {
3031
3033
  this.fun.apply(null, this.array);
3032
3034
  };
3033
3035
  var title = 'browser';
3034
- var platform$2 = 'browser';
3036
+ var platform$3 = 'browser';
3035
3037
  var browser$1 = true;
3036
3038
  var env = {};
3037
3039
  var argv = [];
@@ -3113,7 +3115,7 @@ var browser$1$1 = {
3113
3115
  chdir: chdir,
3114
3116
  umask: umask,
3115
3117
  hrtime: hrtime,
3116
- platform: platform$2,
3118
+ platform: platform$3,
3117
3119
  release: release$1,
3118
3120
  config: config,
3119
3121
  uptime: uptime$1
@@ -3904,6 +3906,10 @@ function base64DetectIncompleteChar(buffer) {
3904
3906
 
3905
3907
  Readable.ReadableState = ReadableState;
3906
3908
 
3909
+ text_min.debuglog = function(empty) {
3910
+
3911
+ }
3912
+
3907
3913
  var debug$2 = text_min.debuglog('stream');
3908
3914
  text_min.inherits(Readable, EventEmitter);
3909
3915
 
@@ -20008,7 +20014,7 @@ var FormData$2 = /*@__PURE__*/getDefaultExportFromCjs(form_data);
20008
20014
  * @returns {boolean}
20009
20015
  */
20010
20016
  function isVisitable(thing) {
20011
- return utils.isPlainObject(thing) || utils.isArray(thing);
20017
+ return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
20012
20018
  }
20013
20019
 
20014
20020
  /**
@@ -20019,7 +20025,7 @@ function isVisitable(thing) {
20019
20025
  * @returns {string} the key without the brackets.
20020
20026
  */
20021
20027
  function removeBrackets(key) {
20022
- return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;
20028
+ return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
20023
20029
  }
20024
20030
 
20025
20031
  /**
@@ -20048,10 +20054,10 @@ function renderKey(path, key, dots) {
20048
20054
  * @returns {boolean}
20049
20055
  */
20050
20056
  function isFlatArray(arr) {
20051
- return utils.isArray(arr) && !arr.some(isVisitable);
20057
+ return utils$1.isArray(arr) && !arr.some(isVisitable);
20052
20058
  }
20053
20059
 
20054
- const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
20060
+ const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
20055
20061
  return /^is[A-Z]/.test(prop);
20056
20062
  });
20057
20063
 
@@ -20079,7 +20085,7 @@ const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
20079
20085
  * @returns
20080
20086
  */
20081
20087
  function toFormData(obj, formData, options) {
20082
- if (!utils.isObject(obj)) {
20088
+ if (!utils$1.isObject(obj)) {
20083
20089
  throw new TypeError('target must be an object');
20084
20090
  }
20085
20091
 
@@ -20087,13 +20093,13 @@ function toFormData(obj, formData, options) {
20087
20093
  formData = formData || new (FormData$2 || FormData)();
20088
20094
 
20089
20095
  // eslint-disable-next-line no-param-reassign
20090
- options = utils.toFlatObject(options, {
20096
+ options = utils$1.toFlatObject(options, {
20091
20097
  metaTokens: true,
20092
20098
  dots: false,
20093
20099
  indexes: false
20094
20100
  }, false, function defined(option, source) {
20095
20101
  // eslint-disable-next-line no-eq-null,eqeqeq
20096
- return !utils.isUndefined(source[option]);
20102
+ return !utils$1.isUndefined(source[option]);
20097
20103
  });
20098
20104
 
20099
20105
  const metaTokens = options.metaTokens;
@@ -20102,24 +20108,24 @@ function toFormData(obj, formData, options) {
20102
20108
  const dots = options.dots;
20103
20109
  const indexes = options.indexes;
20104
20110
  const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
20105
- const useBlob = _Blob && utils.isSpecCompliantForm(formData);
20111
+ const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
20106
20112
 
20107
- if (!utils.isFunction(visitor)) {
20113
+ if (!utils$1.isFunction(visitor)) {
20108
20114
  throw new TypeError('visitor must be a function');
20109
20115
  }
20110
20116
 
20111
20117
  function convertValue(value) {
20112
20118
  if (value === null) return '';
20113
20119
 
20114
- if (utils.isDate(value)) {
20120
+ if (utils$1.isDate(value)) {
20115
20121
  return value.toISOString();
20116
20122
  }
20117
20123
 
20118
- if (!useBlob && utils.isBlob(value)) {
20124
+ if (!useBlob && utils$1.isBlob(value)) {
20119
20125
  throw new AxiosError('Blob is not supported. Use a Buffer instead.');
20120
20126
  }
20121
20127
 
20122
- if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
20128
+ if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
20123
20129
  return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
20124
20130
  }
20125
20131
 
@@ -20140,20 +20146,20 @@ function toFormData(obj, formData, options) {
20140
20146
  let arr = value;
20141
20147
 
20142
20148
  if (value && !path && typeof value === 'object') {
20143
- if (utils.endsWith(key, '{}')) {
20149
+ if (utils$1.endsWith(key, '{}')) {
20144
20150
  // eslint-disable-next-line no-param-reassign
20145
20151
  key = metaTokens ? key : key.slice(0, -2);
20146
20152
  // eslint-disable-next-line no-param-reassign
20147
20153
  value = JSON.stringify(value);
20148
20154
  } else if (
20149
- (utils.isArray(value) && isFlatArray(value)) ||
20150
- ((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))
20155
+ (utils$1.isArray(value) && isFlatArray(value)) ||
20156
+ ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
20151
20157
  )) {
20152
20158
  // eslint-disable-next-line no-param-reassign
20153
20159
  key = removeBrackets(key);
20154
20160
 
20155
20161
  arr.forEach(function each(el, index) {
20156
- !(utils.isUndefined(el) || el === null) && formData.append(
20162
+ !(utils$1.isUndefined(el) || el === null) && formData.append(
20157
20163
  // eslint-disable-next-line no-nested-ternary
20158
20164
  indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
20159
20165
  convertValue(el)
@@ -20181,7 +20187,7 @@ function toFormData(obj, formData, options) {
20181
20187
  });
20182
20188
 
20183
20189
  function build(value, path) {
20184
- if (utils.isUndefined(value)) return;
20190
+ if (utils$1.isUndefined(value)) return;
20185
20191
 
20186
20192
  if (stack.indexOf(value) !== -1) {
20187
20193
  throw Error('Circular reference detected in ' + path.join('.'));
@@ -20189,9 +20195,9 @@ function toFormData(obj, formData, options) {
20189
20195
 
20190
20196
  stack.push(value);
20191
20197
 
20192
- utils.forEach(value, function each(el, key) {
20193
- const result = !(utils.isUndefined(el) || el === null) && visitor.call(
20194
- formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers
20198
+ utils$1.forEach(value, function each(el, key) {
20199
+ const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
20200
+ formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers
20195
20201
  );
20196
20202
 
20197
20203
  if (result === true) {
@@ -20202,7 +20208,7 @@ function toFormData(obj, formData, options) {
20202
20208
  stack.pop();
20203
20209
  }
20204
20210
 
20205
- if (!utils.isObject(obj)) {
20211
+ if (!utils$1.isObject(obj)) {
20206
20212
  throw new TypeError('data must be an object');
20207
20213
  }
20208
20214
 
@@ -20306,7 +20312,7 @@ function buildURL(url, params, options) {
20306
20312
  if (serializeFn) {
20307
20313
  serializedParams = serializeFn(params, options);
20308
20314
  } else {
20309
- serializedParams = utils.isURLSearchParams(params) ?
20315
+ serializedParams = utils$1.isURLSearchParams(params) ?
20310
20316
  params.toString() :
20311
20317
  new AxiosURLSearchParams(params, options).toString(_encode);
20312
20318
  }
@@ -20381,7 +20387,7 @@ class InterceptorManager {
20381
20387
  * @returns {void}
20382
20388
  */
20383
20389
  forEach(fn) {
20384
- utils.forEach(this.handlers, function forEachHandler(h) {
20390
+ utils$1.forEach(this.handlers, function forEachHandler(h) {
20385
20391
  if (h !== null) {
20386
20392
  fn(h);
20387
20393
  }
@@ -20399,7 +20405,7 @@ var transitionalDefaults = {
20399
20405
 
20400
20406
  var URLSearchParams = url$1.URLSearchParams;
20401
20407
 
20402
- var platform$1 = {
20408
+ var platform$2 = {
20403
20409
  isNode: true,
20404
20410
  classes: {
20405
20411
  URLSearchParams,
@@ -20409,10 +20415,64 @@ var platform$1 = {
20409
20415
  protocols: [ 'http', 'https', 'file', 'data' ]
20410
20416
  };
20411
20417
 
20418
+ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
20419
+
20420
+ /**
20421
+ * Determine if we're running in a standard browser environment
20422
+ *
20423
+ * This allows axios to run in a web worker, and react-native.
20424
+ * Both environments support XMLHttpRequest, but not fully standard globals.
20425
+ *
20426
+ * web workers:
20427
+ * typeof window -> undefined
20428
+ * typeof document -> undefined
20429
+ *
20430
+ * react-native:
20431
+ * navigator.product -> 'ReactNative'
20432
+ * nativescript
20433
+ * navigator.product -> 'NativeScript' or 'NS'
20434
+ *
20435
+ * @returns {boolean}
20436
+ */
20437
+ const hasStandardBrowserEnv = (
20438
+ (product) => {
20439
+ return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
20440
+ })(typeof navigator !== 'undefined' && navigator.product);
20441
+
20442
+ /**
20443
+ * Determine if we're running in a standard browser webWorker environment
20444
+ *
20445
+ * Although the `isStandardBrowserEnv` method indicates that
20446
+ * `allows axios to run in a web worker`, the WebWorker will still be
20447
+ * filtered out due to its judgment standard
20448
+ * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
20449
+ * This leads to a problem when axios post `FormData` in webWorker
20450
+ */
20451
+ const hasStandardBrowserWebWorkerEnv = (() => {
20452
+ return (
20453
+ typeof WorkerGlobalScope !== 'undefined' &&
20454
+ // eslint-disable-next-line no-undef
20455
+ self instanceof WorkerGlobalScope &&
20456
+ typeof self.importScripts === 'function'
20457
+ );
20458
+ })();
20459
+
20460
+ var utils = /*#__PURE__*/Object.freeze({
20461
+ __proto__: null,
20462
+ hasBrowserEnv: hasBrowserEnv,
20463
+ hasStandardBrowserEnv: hasStandardBrowserEnv,
20464
+ hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv
20465
+ });
20466
+
20467
+ var platform$1 = {
20468
+ ...utils,
20469
+ ...platform$2
20470
+ };
20471
+
20412
20472
  function toURLEncodedForm(data, options) {
20413
20473
  return toFormData(data, new platform$1.classes.URLSearchParams(), Object.assign({
20414
20474
  visitor: function(value, key, path, helpers) {
20415
- if (utils.isBuffer(value)) {
20475
+ if (platform$1.isNode && utils$1.isBuffer(value)) {
20416
20476
  this.append(key, value.toString('base64'));
20417
20477
  return false;
20418
20478
  }
@@ -20434,7 +20494,7 @@ function parsePropPath(name) {
20434
20494
  // foo.x.y.z
20435
20495
  // foo-x-y-z
20436
20496
  // foo x y z
20437
- return utils.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
20497
+ return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
20438
20498
  return match[0] === '[]' ? '' : match[1] || match[0];
20439
20499
  });
20440
20500
  }
@@ -20471,10 +20531,10 @@ function formDataToJSON(formData) {
20471
20531
  let name = path[index++];
20472
20532
  const isNumericKey = Number.isFinite(+name);
20473
20533
  const isLast = index >= path.length;
20474
- name = !name && utils.isArray(target) ? target.length : name;
20534
+ name = !name && utils$1.isArray(target) ? target.length : name;
20475
20535
 
20476
20536
  if (isLast) {
20477
- if (utils.hasOwnProp(target, name)) {
20537
+ if (utils$1.hasOwnProp(target, name)) {
20478
20538
  target[name] = [target[name], value];
20479
20539
  } else {
20480
20540
  target[name] = value;
@@ -20483,23 +20543,23 @@ function formDataToJSON(formData) {
20483
20543
  return !isNumericKey;
20484
20544
  }
20485
20545
 
20486
- if (!target[name] || !utils.isObject(target[name])) {
20546
+ if (!target[name] || !utils$1.isObject(target[name])) {
20487
20547
  target[name] = [];
20488
20548
  }
20489
20549
 
20490
20550
  const result = buildPath(path, value, target[name], index);
20491
20551
 
20492
- if (result && utils.isArray(target[name])) {
20552
+ if (result && utils$1.isArray(target[name])) {
20493
20553
  target[name] = arrayToObject(target[name]);
20494
20554
  }
20495
20555
 
20496
20556
  return !isNumericKey;
20497
20557
  }
20498
20558
 
20499
- if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
20559
+ if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
20500
20560
  const obj = {};
20501
20561
 
20502
- utils.forEachEntry(formData, (name, value) => {
20562
+ utils$1.forEachEntry(formData, (name, value) => {
20503
20563
  buildPath(parsePropPath(name), value, obj, 0);
20504
20564
  });
20505
20565
 
@@ -20520,10 +20580,10 @@ function formDataToJSON(formData) {
20520
20580
  * @returns {string} A stringified version of the rawValue.
20521
20581
  */
20522
20582
  function stringifySafely(rawValue, parser, encoder) {
20523
- if (utils.isString(rawValue)) {
20583
+ if (utils$1.isString(rawValue)) {
20524
20584
  try {
20525
20585
  (parser || JSON.parse)(rawValue);
20526
- return utils.trim(rawValue);
20586
+ return utils$1.trim(rawValue);
20527
20587
  } catch (e) {
20528
20588
  if (e.name !== 'SyntaxError') {
20529
20589
  throw e;
@@ -20543,13 +20603,13 @@ const defaults = {
20543
20603
  transformRequest: [function transformRequest(data, headers) {
20544
20604
  const contentType = headers.getContentType() || '';
20545
20605
  const hasJSONContentType = contentType.indexOf('application/json') > -1;
20546
- const isObjectPayload = utils.isObject(data);
20606
+ const isObjectPayload = utils$1.isObject(data);
20547
20607
 
20548
- if (isObjectPayload && utils.isHTMLForm(data)) {
20608
+ if (isObjectPayload && utils$1.isHTMLForm(data)) {
20549
20609
  data = new FormData(data);
20550
20610
  }
20551
20611
 
20552
- const isFormData = utils.isFormData(data);
20612
+ const isFormData = utils$1.isFormData(data);
20553
20613
 
20554
20614
  if (isFormData) {
20555
20615
  if (!hasJSONContentType) {
@@ -20558,18 +20618,18 @@ const defaults = {
20558
20618
  return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
20559
20619
  }
20560
20620
 
20561
- if (utils.isArrayBuffer(data) ||
20562
- utils.isBuffer(data) ||
20563
- utils.isStream(data) ||
20564
- utils.isFile(data) ||
20565
- utils.isBlob(data)
20621
+ if (utils$1.isArrayBuffer(data) ||
20622
+ utils$1.isBuffer(data) ||
20623
+ utils$1.isStream(data) ||
20624
+ utils$1.isFile(data) ||
20625
+ utils$1.isBlob(data)
20566
20626
  ) {
20567
20627
  return data;
20568
20628
  }
20569
- if (utils.isArrayBufferView(data)) {
20629
+ if (utils$1.isArrayBufferView(data)) {
20570
20630
  return data.buffer;
20571
20631
  }
20572
- if (utils.isURLSearchParams(data)) {
20632
+ if (utils$1.isURLSearchParams(data)) {
20573
20633
  headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
20574
20634
  return data.toString();
20575
20635
  }
@@ -20581,7 +20641,7 @@ const defaults = {
20581
20641
  return toURLEncodedForm(data, this.formSerializer).toString();
20582
20642
  }
20583
20643
 
20584
- if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
20644
+ if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
20585
20645
  const _FormData = this.env && this.env.FormData;
20586
20646
 
20587
20647
  return toFormData(
@@ -20605,7 +20665,7 @@ const defaults = {
20605
20665
  const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
20606
20666
  const JSONRequested = this.responseType === 'json';
20607
20667
 
20608
- if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
20668
+ if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
20609
20669
  const silentJSONParsing = transitional && transitional.silentJSONParsing;
20610
20670
  const strictJSONParsing = !silentJSONParsing && JSONRequested;
20611
20671
 
@@ -20653,7 +20713,7 @@ const defaults = {
20653
20713
  }
20654
20714
  };
20655
20715
 
20656
- utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
20716
+ utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
20657
20717
  defaults.headers[method] = {};
20658
20718
  });
20659
20719
 
@@ -20661,7 +20721,7 @@ var defaults$1 = defaults;
20661
20721
 
20662
20722
  // RawAxiosHeaders whose duplicates are ignored by node
20663
20723
  // c.f. https://nodejs.org/api/http.html#http_message_headers
20664
- const ignoreDuplicateOf = utils.toObjectSet([
20724
+ const ignoreDuplicateOf = utils$1.toObjectSet([
20665
20725
  'age', 'authorization', 'content-length', 'content-type', 'etag',
20666
20726
  'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
20667
20727
  'last-modified', 'location', 'max-forwards', 'proxy-authorization',
@@ -20722,7 +20782,7 @@ function normalizeValue(value) {
20722
20782
  return value;
20723
20783
  }
20724
20784
 
20725
- return utils.isArray(value) ? value.map(normalizeValue) : String(value);
20785
+ return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
20726
20786
  }
20727
20787
 
20728
20788
  function parseTokens(str) {
@@ -20740,7 +20800,7 @@ function parseTokens(str) {
20740
20800
  const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
20741
20801
 
20742
20802
  function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
20743
- if (utils.isFunction(filter)) {
20803
+ if (utils$1.isFunction(filter)) {
20744
20804
  return filter.call(this, value, header);
20745
20805
  }
20746
20806
 
@@ -20748,13 +20808,13 @@ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
20748
20808
  value = header;
20749
20809
  }
20750
20810
 
20751
- if (!utils.isString(value)) return;
20811
+ if (!utils$1.isString(value)) return;
20752
20812
 
20753
- if (utils.isString(filter)) {
20813
+ if (utils$1.isString(filter)) {
20754
20814
  return value.indexOf(filter) !== -1;
20755
20815
  }
20756
20816
 
20757
- if (utils.isRegExp(filter)) {
20817
+ if (utils$1.isRegExp(filter)) {
20758
20818
  return filter.test(value);
20759
20819
  }
20760
20820
  }
@@ -20767,7 +20827,7 @@ function formatHeader(header) {
20767
20827
  }
20768
20828
 
20769
20829
  function buildAccessors(obj, header) {
20770
- const accessorName = utils.toCamelCase(' ' + header);
20830
+ const accessorName = utils$1.toCamelCase(' ' + header);
20771
20831
 
20772
20832
  ['get', 'set', 'has'].forEach(methodName => {
20773
20833
  Object.defineProperty(obj, methodName + accessorName, {
@@ -20794,7 +20854,7 @@ class AxiosHeaders {
20794
20854
  throw new Error('header name must be a non-empty string');
20795
20855
  }
20796
20856
 
20797
- const key = utils.findKey(self, lHeader);
20857
+ const key = utils$1.findKey(self, lHeader);
20798
20858
 
20799
20859
  if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
20800
20860
  self[key || _header] = normalizeValue(_value);
@@ -20802,11 +20862,11 @@ class AxiosHeaders {
20802
20862
  }
20803
20863
 
20804
20864
  const setHeaders = (headers, _rewrite) =>
20805
- utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
20865
+ utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
20806
20866
 
20807
- if (utils.isPlainObject(header) || header instanceof this.constructor) {
20867
+ if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
20808
20868
  setHeaders(header, valueOrRewrite);
20809
- } else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
20869
+ } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
20810
20870
  setHeaders(parseHeaders(header), valueOrRewrite);
20811
20871
  } else {
20812
20872
  header != null && setHeader(valueOrRewrite, header, rewrite);
@@ -20819,7 +20879,7 @@ class AxiosHeaders {
20819
20879
  header = normalizeHeader(header);
20820
20880
 
20821
20881
  if (header) {
20822
- const key = utils.findKey(this, header);
20882
+ const key = utils$1.findKey(this, header);
20823
20883
 
20824
20884
  if (key) {
20825
20885
  const value = this[key];
@@ -20832,11 +20892,11 @@ class AxiosHeaders {
20832
20892
  return parseTokens(value);
20833
20893
  }
20834
20894
 
20835
- if (utils.isFunction(parser)) {
20895
+ if (utils$1.isFunction(parser)) {
20836
20896
  return parser.call(this, value, key);
20837
20897
  }
20838
20898
 
20839
- if (utils.isRegExp(parser)) {
20899
+ if (utils$1.isRegExp(parser)) {
20840
20900
  return parser.exec(value);
20841
20901
  }
20842
20902
 
@@ -20849,7 +20909,7 @@ class AxiosHeaders {
20849
20909
  header = normalizeHeader(header);
20850
20910
 
20851
20911
  if (header) {
20852
- const key = utils.findKey(this, header);
20912
+ const key = utils$1.findKey(this, header);
20853
20913
 
20854
20914
  return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
20855
20915
  }
@@ -20865,7 +20925,7 @@ class AxiosHeaders {
20865
20925
  _header = normalizeHeader(_header);
20866
20926
 
20867
20927
  if (_header) {
20868
- const key = utils.findKey(self, _header);
20928
+ const key = utils$1.findKey(self, _header);
20869
20929
 
20870
20930
  if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
20871
20931
  delete self[key];
@@ -20875,7 +20935,7 @@ class AxiosHeaders {
20875
20935
  }
20876
20936
  }
20877
20937
 
20878
- if (utils.isArray(header)) {
20938
+ if (utils$1.isArray(header)) {
20879
20939
  header.forEach(deleteHeader);
20880
20940
  } else {
20881
20941
  deleteHeader(header);
@@ -20904,8 +20964,8 @@ class AxiosHeaders {
20904
20964
  const self = this;
20905
20965
  const headers = {};
20906
20966
 
20907
- utils.forEach(this, (value, header) => {
20908
- const key = utils.findKey(headers, header);
20967
+ utils$1.forEach(this, (value, header) => {
20968
+ const key = utils$1.findKey(headers, header);
20909
20969
 
20910
20970
  if (key) {
20911
20971
  self[key] = normalizeValue(value);
@@ -20934,8 +20994,8 @@ class AxiosHeaders {
20934
20994
  toJSON(asStrings) {
20935
20995
  const obj = Object.create(null);
20936
20996
 
20937
- utils.forEach(this, (value, header) => {
20938
- value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);
20997
+ utils$1.forEach(this, (value, header) => {
20998
+ value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
20939
20999
  });
20940
21000
 
20941
21001
  return obj;
@@ -20982,7 +21042,7 @@ class AxiosHeaders {
20982
21042
  }
20983
21043
  }
20984
21044
 
20985
- utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
21045
+ utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
20986
21046
 
20987
21047
  return this;
20988
21048
  }
@@ -20991,7 +21051,7 @@ class AxiosHeaders {
20991
21051
  AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
20992
21052
 
20993
21053
  // reserved names hotfix
20994
- utils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
21054
+ utils$1.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
20995
21055
  let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
20996
21056
  return {
20997
21057
  get: () => value,
@@ -21001,7 +21061,7 @@ utils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
21001
21061
  }
21002
21062
  });
21003
21063
 
21004
- utils.freezeMethods(AxiosHeaders);
21064
+ utils$1.freezeMethods(AxiosHeaders);
21005
21065
 
21006
21066
  var AxiosHeaders$1 = AxiosHeaders;
21007
21067
 
@@ -21019,7 +21079,7 @@ function transformData(fns, response) {
21019
21079
  const headers = AxiosHeaders$1.from(context.headers);
21020
21080
  let data = context.data;
21021
21081
 
21022
- utils.forEach(fns, function transform(fn) {
21082
+ utils$1.forEach(fns, function transform(fn) {
21023
21083
  data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
21024
21084
  });
21025
21085
 
@@ -21047,7 +21107,7 @@ function CanceledError(message, config, request) {
21047
21107
  this.name = 'CanceledError';
21048
21108
  }
21049
21109
 
21050
- utils.inherits(CanceledError, AxiosError, {
21110
+ utils$1.inherits(CanceledError, AxiosError, {
21051
21111
  __CANCEL__: true
21052
21112
  });
21053
21113
 
@@ -21712,1077 +21772,796 @@ var require$$4 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_assert);
21712
21772
 
21713
21773
  var src = {exports: {}};
21714
21774
 
21715
- var browser = {exports: {}};
21775
+ var node = {exports: {}};
21716
21776
 
21717
- /**
21718
- * Helpers.
21719
- */
21777
+ // MIT lisence
21778
+ // from https://github.com/substack/tty-browserify/blob/1ba769a6429d242f36226538835b4034bf6b7886/index.js
21720
21779
 
21721
- var ms;
21722
- var hasRequiredMs;
21780
+ function isatty() {
21781
+ return false;
21782
+ }
21723
21783
 
21724
- function requireMs () {
21725
- if (hasRequiredMs) return ms;
21726
- hasRequiredMs = 1;
21727
- var s = 1000;
21728
- var m = s * 60;
21729
- var h = m * 60;
21730
- var d = h * 24;
21731
- var w = d * 7;
21732
- var y = d * 365.25;
21784
+ function ReadStream() {
21785
+ throw new Error('tty.ReadStream is not implemented');
21786
+ }
21733
21787
 
21734
- /**
21735
- * Parse or format the given `val`.
21736
- *
21737
- * Options:
21738
- *
21739
- * - `long` verbose formatting [false]
21740
- *
21741
- * @param {String|Number} val
21742
- * @param {Object} [options]
21743
- * @throws {Error} throw an error if val is not a non-empty string or a number
21744
- * @return {String|Number}
21745
- * @api public
21746
- */
21788
+ function WriteStream() {
21789
+ throw new Error('tty.ReadStream is not implemented');
21790
+ }
21747
21791
 
21748
- ms = function(val, options) {
21749
- options = options || {};
21750
- var type = typeof val;
21751
- if (type === 'string' && val.length > 0) {
21752
- return parse(val);
21753
- } else if (type === 'number' && isFinite(val)) {
21754
- return options.long ? fmtLong(val) : fmtShort(val);
21755
- }
21756
- throw new Error(
21757
- 'val is not a non-empty string or a valid number. val=' +
21758
- JSON.stringify(val)
21759
- );
21760
- };
21792
+ var _polyfillNode_tty = {
21793
+ isatty: isatty,
21794
+ ReadStream: ReadStream,
21795
+ WriteStream: WriteStream
21796
+ };
21761
21797
 
21762
- /**
21763
- * Parse the given `str` and return milliseconds.
21764
- *
21765
- * @param {String} str
21766
- * @return {Number}
21767
- * @api private
21768
- */
21798
+ var _polyfillNode_tty$1 = /*#__PURE__*/Object.freeze({
21799
+ __proto__: null,
21800
+ ReadStream: ReadStream,
21801
+ WriteStream: WriteStream,
21802
+ default: _polyfillNode_tty,
21803
+ isatty: isatty
21804
+ });
21769
21805
 
21770
- function parse(str) {
21771
- str = String(str);
21772
- if (str.length > 100) {
21773
- return;
21774
- }
21775
- var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
21776
- str
21777
- );
21778
- if (!match) {
21779
- return;
21780
- }
21781
- var n = parseFloat(match[1]);
21782
- var type = (match[2] || 'ms').toLowerCase();
21783
- switch (type) {
21784
- case 'years':
21785
- case 'year':
21786
- case 'yrs':
21787
- case 'yr':
21788
- case 'y':
21789
- return n * y;
21790
- case 'weeks':
21791
- case 'week':
21792
- case 'w':
21793
- return n * w;
21794
- case 'days':
21795
- case 'day':
21796
- case 'd':
21797
- return n * d;
21798
- case 'hours':
21799
- case 'hour':
21800
- case 'hrs':
21801
- case 'hr':
21802
- case 'h':
21803
- return n * h;
21804
- case 'minutes':
21805
- case 'minute':
21806
- case 'mins':
21807
- case 'min':
21808
- case 'm':
21809
- return n * m;
21810
- case 'seconds':
21811
- case 'second':
21812
- case 'secs':
21813
- case 'sec':
21814
- case 's':
21815
- return n * s;
21816
- case 'milliseconds':
21817
- case 'millisecond':
21818
- case 'msecs':
21819
- case 'msec':
21820
- case 'ms':
21821
- return n;
21822
- default:
21823
- return undefined;
21824
- }
21825
- }
21806
+ var require$$0$1 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_tty$1);
21826
21807
 
21827
- /**
21828
- * Short format for `ms`.
21829
- *
21830
- * @param {Number} ms
21831
- * @return {String}
21832
- * @api private
21833
- */
21808
+ /*
21809
+ The MIT License (MIT)
21834
21810
 
21835
- function fmtShort(ms) {
21836
- var msAbs = Math.abs(ms);
21837
- if (msAbs >= d) {
21838
- return Math.round(ms / d) + 'd';
21839
- }
21840
- if (msAbs >= h) {
21841
- return Math.round(ms / h) + 'h';
21842
- }
21843
- if (msAbs >= m) {
21844
- return Math.round(ms / m) + 'm';
21845
- }
21846
- if (msAbs >= s) {
21847
- return Math.round(ms / s) + 's';
21848
- }
21849
- return ms + 'ms';
21850
- }
21811
+ Copyright (c) 2016 CoderPuppy
21851
21812
 
21852
- /**
21853
- * Long format for `ms`.
21854
- *
21855
- * @param {Number} ms
21856
- * @return {String}
21857
- * @api private
21858
- */
21813
+ Permission is hereby granted, free of charge, to any person obtaining a copy
21814
+ of this software and associated documentation files (the "Software"), to deal
21815
+ in the Software without restriction, including without limitation the rights
21816
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21817
+ copies of the Software, and to permit persons to whom the Software is
21818
+ furnished to do so, subject to the following conditions:
21859
21819
 
21860
- function fmtLong(ms) {
21861
- var msAbs = Math.abs(ms);
21862
- if (msAbs >= d) {
21863
- return plural(ms, msAbs, d, 'day');
21864
- }
21865
- if (msAbs >= h) {
21866
- return plural(ms, msAbs, h, 'hour');
21867
- }
21868
- if (msAbs >= m) {
21869
- return plural(ms, msAbs, m, 'minute');
21870
- }
21871
- if (msAbs >= s) {
21872
- return plural(ms, msAbs, s, 'second');
21873
- }
21874
- return ms + ' ms';
21875
- }
21820
+ The above copyright notice and this permission notice shall be included in all
21821
+ copies or substantial portions of the Software.
21876
21822
 
21877
- /**
21878
- * Pluralization helper.
21879
- */
21823
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21824
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21825
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21826
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21827
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21828
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21829
+ SOFTWARE.
21880
21830
 
21881
- function plural(ms, msAbs, n, name) {
21882
- var isPlural = msAbs >= n * 1.5;
21883
- return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
21884
- }
21885
- return ms;
21831
+ */
21832
+ var _endianness;
21833
+ function endianness() {
21834
+ if (typeof _endianness === 'undefined') {
21835
+ var a = new ArrayBuffer(2);
21836
+ var b = new Uint8Array(a);
21837
+ var c = new Uint16Array(a);
21838
+ b[0] = 1;
21839
+ b[1] = 2;
21840
+ if (c[0] === 258) {
21841
+ _endianness = 'BE';
21842
+ } else if (c[0] === 513){
21843
+ _endianness = 'LE';
21844
+ } else {
21845
+ throw new Error('unable to figure out endianess');
21846
+ }
21847
+ }
21848
+ return _endianness;
21886
21849
  }
21887
21850
 
21888
- var common;
21889
- var hasRequiredCommon;
21851
+ function hostname() {
21852
+ if (typeof global$1.location !== 'undefined') {
21853
+ return global$1.location.hostname
21854
+ } else return '';
21855
+ }
21890
21856
 
21891
- function requireCommon () {
21892
- if (hasRequiredCommon) return common;
21893
- hasRequiredCommon = 1;
21894
- /**
21895
- * This is the common logic for both the Node.js and web browser
21896
- * implementations of `debug()`.
21897
- */
21857
+ function loadavg() {
21858
+ return [];
21859
+ }
21898
21860
 
21899
- function setup(env) {
21900
- createDebug.debug = createDebug;
21901
- createDebug.default = createDebug;
21902
- createDebug.coerce = coerce;
21903
- createDebug.disable = disable;
21904
- createDebug.enable = enable;
21905
- createDebug.enabled = enabled;
21906
- createDebug.humanize = requireMs();
21907
- createDebug.destroy = destroy;
21861
+ function uptime() {
21862
+ return 0;
21863
+ }
21908
21864
 
21909
- Object.keys(env).forEach(key => {
21910
- createDebug[key] = env[key];
21911
- });
21865
+ function freemem() {
21866
+ return Number.MAX_VALUE;
21867
+ }
21912
21868
 
21913
- /**
21914
- * The currently active debug mode names, and names to skip.
21915
- */
21869
+ function totalmem() {
21870
+ return Number.MAX_VALUE;
21871
+ }
21916
21872
 
21917
- createDebug.names = [];
21918
- createDebug.skips = [];
21873
+ function cpus() {
21874
+ return [];
21875
+ }
21919
21876
 
21920
- /**
21921
- * Map of special "%n" handling functions, for the debug "format" argument.
21922
- *
21923
- * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
21924
- */
21925
- createDebug.formatters = {};
21877
+ function type() {
21878
+ return 'Browser';
21879
+ }
21926
21880
 
21927
- /**
21928
- * Selects a color for a debug namespace
21929
- * @param {String} namespace The namespace string for the debug instance to be colored
21930
- * @return {Number|String} An ANSI color code for the given namespace
21931
- * @api private
21932
- */
21933
- function selectColor(namespace) {
21934
- let hash = 0;
21881
+ function release () {
21882
+ if (typeof global$1.navigator !== 'undefined') {
21883
+ return global$1.navigator.appVersion;
21884
+ }
21885
+ return '';
21886
+ }
21935
21887
 
21936
- for (let i = 0; i < namespace.length; i++) {
21937
- hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
21938
- hash |= 0; // Convert to 32bit integer
21939
- }
21888
+ function networkInterfaces () {
21889
+ return {};
21890
+ }
21940
21891
 
21941
- return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
21942
- }
21943
- createDebug.selectColor = selectColor;
21892
+ function getNetworkInterfaces () {
21893
+ return {};
21894
+ }
21944
21895
 
21945
- /**
21946
- * Create a debugger with the given `namespace`.
21947
- *
21948
- * @param {String} namespace
21949
- * @return {Function}
21950
- * @api public
21951
- */
21952
- function createDebug(namespace) {
21953
- let prevTime;
21954
- let enableOverride = null;
21955
- let namespacesCache;
21956
- let enabledCache;
21896
+ function arch() {
21897
+ return 'javascript';
21898
+ }
21957
21899
 
21958
- function debug(...args) {
21959
- // Disabled?
21960
- if (!debug.enabled) {
21961
- return;
21962
- }
21900
+ function platform() {
21901
+ return 'browser';
21902
+ }
21963
21903
 
21964
- const self = debug;
21904
+ function tmpDir() {
21905
+ return '/tmp';
21906
+ }
21907
+ var tmpdir = tmpDir;
21965
21908
 
21966
- // Set `diff` timestamp
21967
- const curr = Number(new Date());
21968
- const ms = curr - (prevTime || curr);
21969
- self.diff = ms;
21970
- self.prev = prevTime;
21971
- self.curr = curr;
21972
- prevTime = curr;
21909
+ var EOL = '\n';
21973
21910
 
21974
- args[0] = createDebug.coerce(args[0]);
21911
+ function homedir(){
21912
+ return '$HOME'
21913
+ }
21975
21914
 
21976
- if (typeof args[0] !== 'string') {
21977
- // Anything else let's inspect with %O
21978
- args.unshift('%O');
21979
- }
21915
+ var _polyfillNode_os = {
21916
+ homedir: homedir,
21917
+ EOL: EOL,
21918
+ arch: arch,
21919
+ platform: platform,
21920
+ tmpdir: tmpdir,
21921
+ tmpDir: tmpDir,
21922
+ networkInterfaces:networkInterfaces,
21923
+ getNetworkInterfaces: getNetworkInterfaces,
21924
+ release: release,
21925
+ type: type,
21926
+ cpus: cpus,
21927
+ totalmem: totalmem,
21928
+ freemem: freemem,
21929
+ uptime: uptime,
21930
+ loadavg: loadavg,
21931
+ hostname: hostname,
21932
+ endianness: endianness,
21933
+ };
21980
21934
 
21981
- // Apply any `formatters` transformations
21982
- let index = 0;
21983
- args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
21984
- // If we encounter an escaped % then don't increase the array index
21985
- if (match === '%%') {
21986
- return '%';
21987
- }
21988
- index++;
21989
- const formatter = createDebug.formatters[format];
21990
- if (typeof formatter === 'function') {
21991
- const val = args[index];
21992
- match = formatter.call(self, val);
21935
+ var _polyfillNode_os$1 = /*#__PURE__*/Object.freeze({
21936
+ __proto__: null,
21937
+ EOL: EOL,
21938
+ arch: arch,
21939
+ cpus: cpus,
21940
+ default: _polyfillNode_os,
21941
+ endianness: endianness,
21942
+ freemem: freemem,
21943
+ getNetworkInterfaces: getNetworkInterfaces,
21944
+ homedir: homedir,
21945
+ hostname: hostname,
21946
+ loadavg: loadavg,
21947
+ networkInterfaces: networkInterfaces,
21948
+ platform: platform,
21949
+ release: release,
21950
+ tmpDir: tmpDir,
21951
+ tmpdir: tmpdir,
21952
+ totalmem: totalmem,
21953
+ type: type,
21954
+ uptime: uptime
21955
+ });
21993
21956
 
21994
- // Now we need to remove `args[index]` since it's inlined in the `format`
21995
- args.splice(index, 1);
21996
- index--;
21997
- }
21998
- return match;
21999
- });
21957
+ var require$$0 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_os$1);
22000
21958
 
22001
- // Apply env-specific formatting (colors, etc.)
22002
- createDebug.formatArgs.call(self, args);
21959
+ var hasFlag;
21960
+ var hasRequiredHasFlag;
22003
21961
 
22004
- const logFn = self.log || createDebug.log;
22005
- logFn.apply(self, args);
22006
- }
21962
+ function requireHasFlag () {
21963
+ if (hasRequiredHasFlag) return hasFlag;
21964
+ hasRequiredHasFlag = 1;
21965
+ hasFlag = (flag, argv) => {
21966
+ argv = argv || process.argv;
21967
+ const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
21968
+ const pos = argv.indexOf(prefix + flag);
21969
+ const terminatorPos = argv.indexOf('--');
21970
+ return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
21971
+ };
21972
+ return hasFlag;
21973
+ }
22007
21974
 
22008
- debug.namespace = namespace;
22009
- debug.useColors = createDebug.useColors();
22010
- debug.color = createDebug.selectColor(namespace);
22011
- debug.extend = extend;
22012
- debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
21975
+ var supportsColor_1;
21976
+ var hasRequiredSupportsColor;
22013
21977
 
22014
- Object.defineProperty(debug, 'enabled', {
22015
- enumerable: true,
22016
- configurable: false,
22017
- get: () => {
22018
- if (enableOverride !== null) {
22019
- return enableOverride;
22020
- }
22021
- if (namespacesCache !== createDebug.namespaces) {
22022
- namespacesCache = createDebug.namespaces;
22023
- enabledCache = createDebug.enabled(namespace);
22024
- }
21978
+ function requireSupportsColor () {
21979
+ if (hasRequiredSupportsColor) return supportsColor_1;
21980
+ hasRequiredSupportsColor = 1;
21981
+ const os = require$$0;
21982
+ const hasFlag = requireHasFlag();
22025
21983
 
22026
- return enabledCache;
22027
- },
22028
- set: v => {
22029
- enableOverride = v;
22030
- }
22031
- });
21984
+ const env = process.env;
22032
21985
 
22033
- // Env-specific initialization logic for debug instances
22034
- if (typeof createDebug.init === 'function') {
22035
- createDebug.init(debug);
22036
- }
21986
+ let forceColor;
21987
+ if (hasFlag('no-color') ||
21988
+ hasFlag('no-colors') ||
21989
+ hasFlag('color=false')) {
21990
+ forceColor = false;
21991
+ } else if (hasFlag('color') ||
21992
+ hasFlag('colors') ||
21993
+ hasFlag('color=true') ||
21994
+ hasFlag('color=always')) {
21995
+ forceColor = true;
21996
+ }
21997
+ if ('FORCE_COLOR' in env) {
21998
+ forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
21999
+ }
22037
22000
 
22038
- return debug;
22001
+ function translateLevel(level) {
22002
+ if (level === 0) {
22003
+ return false;
22039
22004
  }
22040
22005
 
22041
- function extend(namespace, delimiter) {
22042
- const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
22043
- newDebug.log = this.log;
22044
- return newDebug;
22045
- }
22006
+ return {
22007
+ level,
22008
+ hasBasic: true,
22009
+ has256: level >= 2,
22010
+ has16m: level >= 3
22011
+ };
22012
+ }
22046
22013
 
22047
- /**
22048
- * Enables a debug mode by namespaces. This can include modes
22049
- * separated by a colon and wildcards.
22050
- *
22051
- * @param {String} namespaces
22052
- * @api public
22053
- */
22054
- function enable(namespaces) {
22055
- createDebug.save(namespaces);
22056
- createDebug.namespaces = namespaces;
22014
+ function supportsColor(stream) {
22015
+ if (forceColor === false) {
22016
+ return 0;
22017
+ }
22057
22018
 
22058
- createDebug.names = [];
22059
- createDebug.skips = [];
22019
+ if (hasFlag('color=16m') ||
22020
+ hasFlag('color=full') ||
22021
+ hasFlag('color=truecolor')) {
22022
+ return 3;
22023
+ }
22060
22024
 
22061
- let i;
22062
- const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
22063
- const len = split.length;
22025
+ if (hasFlag('color=256')) {
22026
+ return 2;
22027
+ }
22064
22028
 
22065
- for (i = 0; i < len; i++) {
22066
- if (!split[i]) {
22067
- // ignore empty strings
22068
- continue;
22069
- }
22029
+ if (stream && !stream.isTTY && forceColor !== true) {
22030
+ return 0;
22031
+ }
22070
22032
 
22071
- namespaces = split[i].replace(/\*/g, '.*?');
22033
+ const min = forceColor ? 1 : 0;
22072
22034
 
22073
- if (namespaces[0] === '-') {
22074
- createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
22075
- } else {
22076
- createDebug.names.push(new RegExp('^' + namespaces + '$'));
22077
- }
22035
+ if (process.platform === 'win32') {
22036
+ // Node.js 7.5.0 is the first version of Node.js to include a patch to
22037
+ // libuv that enables 256 color output on Windows. Anything earlier and it
22038
+ // won't work. However, here we target Node.js 8 at minimum as it is an LTS
22039
+ // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows
22040
+ // release that supports 256 colors. Windows 10 build 14931 is the first release
22041
+ // that supports 16m/TrueColor.
22042
+ const osRelease = os.release().split('.');
22043
+ if (
22044
+ Number(process.versions.node.split('.')[0]) >= 8 &&
22045
+ Number(osRelease[0]) >= 10 &&
22046
+ Number(osRelease[2]) >= 10586
22047
+ ) {
22048
+ return Number(osRelease[2]) >= 14931 ? 3 : 2;
22078
22049
  }
22079
- }
22080
22050
 
22081
- /**
22082
- * Disable debug output.
22083
- *
22084
- * @return {String} namespaces
22085
- * @api public
22086
- */
22087
- function disable() {
22088
- const namespaces = [
22089
- ...createDebug.names.map(toNamespace),
22090
- ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
22091
- ].join(',');
22092
- createDebug.enable('');
22093
- return namespaces;
22051
+ return 1;
22094
22052
  }
22095
22053
 
22096
- /**
22097
- * Returns true if the given mode name is enabled, false otherwise.
22098
- *
22099
- * @param {String} name
22100
- * @return {Boolean}
22101
- * @api public
22102
- */
22103
- function enabled(name) {
22104
- if (name[name.length - 1] === '*') {
22105
- return true;
22054
+ if ('CI' in env) {
22055
+ if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
22056
+ return 1;
22106
22057
  }
22107
22058
 
22108
- let i;
22109
- let len;
22059
+ return min;
22060
+ }
22110
22061
 
22111
- for (i = 0, len = createDebug.skips.length; i < len; i++) {
22112
- if (createDebug.skips[i].test(name)) {
22113
- return false;
22114
- }
22115
- }
22062
+ if ('TEAMCITY_VERSION' in env) {
22063
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
22064
+ }
22116
22065
 
22117
- for (i = 0, len = createDebug.names.length; i < len; i++) {
22118
- if (createDebug.names[i].test(name)) {
22119
- return true;
22120
- }
22066
+ if (env.COLORTERM === 'truecolor') {
22067
+ return 3;
22068
+ }
22069
+
22070
+ if ('TERM_PROGRAM' in env) {
22071
+ const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
22072
+
22073
+ switch (env.TERM_PROGRAM) {
22074
+ case 'iTerm.app':
22075
+ return version >= 3 ? 3 : 2;
22076
+ case 'Apple_Terminal':
22077
+ return 2;
22078
+ // No default
22121
22079
  }
22080
+ }
22122
22081
 
22123
- return false;
22082
+ if (/-256(color)?$/i.test(env.TERM)) {
22083
+ return 2;
22124
22084
  }
22125
22085
 
22126
- /**
22127
- * Convert regexp to namespace
22128
- *
22129
- * @param {RegExp} regxep
22130
- * @return {String} namespace
22131
- * @api private
22132
- */
22133
- function toNamespace(regexp) {
22134
- return regexp.toString()
22135
- .substring(2, regexp.toString().length - 2)
22136
- .replace(/\.\*\?$/, '*');
22086
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
22087
+ return 1;
22137
22088
  }
22138
22089
 
22139
- /**
22140
- * Coerce `val`.
22141
- *
22142
- * @param {Mixed} val
22143
- * @return {Mixed}
22144
- * @api private
22145
- */
22146
- function coerce(val) {
22147
- if (val instanceof Error) {
22148
- return val.stack || val.message;
22149
- }
22150
- return val;
22090
+ if ('COLORTERM' in env) {
22091
+ return 1;
22151
22092
  }
22152
22093
 
22153
- /**
22154
- * XXX DO NOT USE. This is a temporary stub function.
22155
- * XXX It WILL be removed in the next major release.
22156
- */
22157
- function destroy() {
22158
- console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
22094
+ if (env.TERM === 'dumb') {
22095
+ return min;
22159
22096
  }
22160
22097
 
22161
- createDebug.enable(createDebug.load());
22098
+ return min;
22099
+ }
22162
22100
 
22163
- return createDebug;
22101
+ function getSupportLevel(stream) {
22102
+ const level = supportsColor(stream);
22103
+ return translateLevel(level);
22164
22104
  }
22165
22105
 
22166
- common = setup;
22167
- return common;
22106
+ supportsColor_1 = {
22107
+ supportsColor: getSupportLevel,
22108
+ stdout: getSupportLevel(process.stdout),
22109
+ stderr: getSupportLevel(process.stderr)
22110
+ };
22111
+ return supportsColor_1;
22168
22112
  }
22169
22113
 
22170
- /* eslint-env browser */
22114
+ /**
22115
+ * Helpers.
22116
+ */
22171
22117
 
22172
- var hasRequiredBrowser;
22118
+ var ms;
22119
+ var hasRequiredMs;
22173
22120
 
22174
- function requireBrowser () {
22175
- if (hasRequiredBrowser) return browser.exports;
22176
- hasRequiredBrowser = 1;
22177
- (function (module, exports) {
22178
- /**
22179
- * This is the web browser implementation of `debug()`.
22180
- */
22121
+ function requireMs () {
22122
+ if (hasRequiredMs) return ms;
22123
+ hasRequiredMs = 1;
22124
+ var s = 1000;
22125
+ var m = s * 60;
22126
+ var h = m * 60;
22127
+ var d = h * 24;
22128
+ var w = d * 7;
22129
+ var y = d * 365.25;
22181
22130
 
22182
- exports.formatArgs = formatArgs;
22183
- exports.save = save;
22184
- exports.load = load;
22185
- exports.useColors = useColors;
22186
- exports.storage = localstorage();
22187
- exports.destroy = (() => {
22188
- let warned = false;
22131
+ /**
22132
+ * Parse or format the given `val`.
22133
+ *
22134
+ * Options:
22135
+ *
22136
+ * - `long` verbose formatting [false]
22137
+ *
22138
+ * @param {String|Number} val
22139
+ * @param {Object} [options]
22140
+ * @throws {Error} throw an error if val is not a non-empty string or a number
22141
+ * @return {String|Number}
22142
+ * @api public
22143
+ */
22189
22144
 
22190
- return () => {
22191
- if (!warned) {
22192
- warned = true;
22193
- console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
22194
- }
22195
- };
22196
- })();
22145
+ ms = function(val, options) {
22146
+ options = options || {};
22147
+ var type = typeof val;
22148
+ if (type === 'string' && val.length > 0) {
22149
+ return parse(val);
22150
+ } else if (type === 'number' && isFinite(val)) {
22151
+ return options.long ? fmtLong(val) : fmtShort(val);
22152
+ }
22153
+ throw new Error(
22154
+ 'val is not a non-empty string or a valid number. val=' +
22155
+ JSON.stringify(val)
22156
+ );
22157
+ };
22197
22158
 
22198
- /**
22199
- * Colors.
22200
- */
22159
+ /**
22160
+ * Parse the given `str` and return milliseconds.
22161
+ *
22162
+ * @param {String} str
22163
+ * @return {Number}
22164
+ * @api private
22165
+ */
22201
22166
 
22202
- exports.colors = [
22203
- '#0000CC',
22204
- '#0000FF',
22205
- '#0033CC',
22206
- '#0033FF',
22207
- '#0066CC',
22208
- '#0066FF',
22209
- '#0099CC',
22210
- '#0099FF',
22211
- '#00CC00',
22212
- '#00CC33',
22213
- '#00CC66',
22214
- '#00CC99',
22215
- '#00CCCC',
22216
- '#00CCFF',
22217
- '#3300CC',
22218
- '#3300FF',
22219
- '#3333CC',
22220
- '#3333FF',
22221
- '#3366CC',
22222
- '#3366FF',
22223
- '#3399CC',
22224
- '#3399FF',
22225
- '#33CC00',
22226
- '#33CC33',
22227
- '#33CC66',
22228
- '#33CC99',
22229
- '#33CCCC',
22230
- '#33CCFF',
22231
- '#6600CC',
22232
- '#6600FF',
22233
- '#6633CC',
22234
- '#6633FF',
22235
- '#66CC00',
22236
- '#66CC33',
22237
- '#9900CC',
22238
- '#9900FF',
22239
- '#9933CC',
22240
- '#9933FF',
22241
- '#99CC00',
22242
- '#99CC33',
22243
- '#CC0000',
22244
- '#CC0033',
22245
- '#CC0066',
22246
- '#CC0099',
22247
- '#CC00CC',
22248
- '#CC00FF',
22249
- '#CC3300',
22250
- '#CC3333',
22251
- '#CC3366',
22252
- '#CC3399',
22253
- '#CC33CC',
22254
- '#CC33FF',
22255
- '#CC6600',
22256
- '#CC6633',
22257
- '#CC9900',
22258
- '#CC9933',
22259
- '#CCCC00',
22260
- '#CCCC33',
22261
- '#FF0000',
22262
- '#FF0033',
22263
- '#FF0066',
22264
- '#FF0099',
22265
- '#FF00CC',
22266
- '#FF00FF',
22267
- '#FF3300',
22268
- '#FF3333',
22269
- '#FF3366',
22270
- '#FF3399',
22271
- '#FF33CC',
22272
- '#FF33FF',
22273
- '#FF6600',
22274
- '#FF6633',
22275
- '#FF9900',
22276
- '#FF9933',
22277
- '#FFCC00',
22278
- '#FFCC33'
22279
- ];
22280
-
22281
- /**
22282
- * Currently only WebKit-based Web Inspectors, Firefox >= v31,
22283
- * and the Firebug extension (any Firefox version) are known
22284
- * to support "%c" CSS customizations.
22285
- *
22286
- * TODO: add a `localStorage` variable to explicitly enable/disable colors
22287
- */
22288
-
22289
- // eslint-disable-next-line complexity
22290
- function useColors() {
22291
- // NB: In an Electron preload script, document will be defined but not fully
22292
- // initialized. Since we know we're in Chrome, we'll just detect this case
22293
- // explicitly
22294
- if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
22295
- return true;
22296
- }
22297
-
22298
- // Internet Explorer and Edge do not support colors.
22299
- if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
22300
- return false;
22301
- }
22302
-
22303
- // Is webkit? http://stackoverflow.com/a/16459606/376773
22304
- // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
22305
- return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
22306
- // Is firebug? http://stackoverflow.com/a/398120/376773
22307
- (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
22308
- // Is firefox >= v31?
22309
- // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
22310
- (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
22311
- // Double check webkit in userAgent just in case we are in a worker
22312
- (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
22313
- }
22314
-
22315
- /**
22316
- * Colorize log arguments if enabled.
22317
- *
22318
- * @api public
22319
- */
22320
-
22321
- function formatArgs(args) {
22322
- args[0] = (this.useColors ? '%c' : '') +
22323
- this.namespace +
22324
- (this.useColors ? ' %c' : ' ') +
22325
- args[0] +
22326
- (this.useColors ? '%c ' : ' ') +
22327
- '+' + module.exports.humanize(this.diff);
22328
-
22329
- if (!this.useColors) {
22330
- return;
22331
- }
22332
-
22333
- const c = 'color: ' + this.color;
22334
- args.splice(1, 0, c, 'color: inherit');
22335
-
22336
- // The final "%c" is somewhat tricky, because there could be other
22337
- // arguments passed either before or after the %c, so we need to
22338
- // figure out the correct index to insert the CSS into
22339
- let index = 0;
22340
- let lastC = 0;
22341
- args[0].replace(/%[a-zA-Z%]/g, match => {
22342
- if (match === '%%') {
22343
- return;
22344
- }
22345
- index++;
22346
- if (match === '%c') {
22347
- // We only are interested in the *last* %c
22348
- // (the user may have provided their own)
22349
- lastC = index;
22350
- }
22351
- });
22352
-
22353
- args.splice(lastC, 0, c);
22354
- }
22355
-
22356
- /**
22357
- * Invokes `console.debug()` when available.
22358
- * No-op when `console.debug` is not a "function".
22359
- * If `console.debug` is not available, falls back
22360
- * to `console.log`.
22361
- *
22362
- * @api public
22363
- */
22364
- exports.log = console.debug || console.log || (() => {});
22365
-
22366
- /**
22367
- * Save `namespaces`.
22368
- *
22369
- * @param {String} namespaces
22370
- * @api private
22371
- */
22372
- function save(namespaces) {
22373
- try {
22374
- if (namespaces) {
22375
- exports.storage.setItem('debug', namespaces);
22376
- } else {
22377
- exports.storage.removeItem('debug');
22378
- }
22379
- } catch (error) {
22380
- // Swallow
22381
- // XXX (@Qix-) should we be logging these?
22382
- }
22383
- }
22384
-
22385
- /**
22386
- * Load `namespaces`.
22387
- *
22388
- * @return {String} returns the previously persisted debug modes
22389
- * @api private
22390
- */
22391
- function load() {
22392
- let r;
22393
- try {
22394
- r = exports.storage.getItem('debug');
22395
- } catch (error) {
22396
- // Swallow
22397
- // XXX (@Qix-) should we be logging these?
22398
- }
22399
-
22400
- // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
22401
- if (!r && typeof process !== 'undefined' && 'env' in process) {
22402
- r = process.env.DEBUG;
22403
- }
22404
-
22405
- return r;
22406
- }
22407
-
22408
- /**
22409
- * Localstorage attempts to return the localstorage.
22410
- *
22411
- * This is necessary because safari throws
22412
- * when a user disables cookies/localstorage
22413
- * and you attempt to access it.
22414
- *
22415
- * @return {LocalStorage}
22416
- * @api private
22417
- */
22418
-
22419
- function localstorage() {
22420
- try {
22421
- // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
22422
- // The Browser also has localStorage in the global context.
22423
- return localStorage;
22424
- } catch (error) {
22425
- // Swallow
22426
- // XXX (@Qix-) should we be logging these?
22427
- }
22428
- }
22429
-
22430
- module.exports = requireCommon()(exports);
22431
-
22432
- const {formatters} = module.exports;
22433
-
22434
- /**
22435
- * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
22436
- */
22437
-
22438
- formatters.j = function (v) {
22439
- try {
22440
- return JSON.stringify(v);
22441
- } catch (error) {
22442
- return '[UnexpectedJSONParseError]: ' + error.message;
22443
- }
22444
- };
22445
- } (browser, browser.exports));
22446
- return browser.exports;
22447
- }
22448
-
22449
- var node = {exports: {}};
22450
-
22451
- // MIT lisence
22452
- // from https://github.com/substack/tty-browserify/blob/1ba769a6429d242f36226538835b4034bf6b7886/index.js
22453
-
22454
- function isatty() {
22455
- return false;
22456
- }
22457
-
22458
- function ReadStream() {
22459
- throw new Error('tty.ReadStream is not implemented');
22460
- }
22461
-
22462
- function WriteStream() {
22463
- throw new Error('tty.ReadStream is not implemented');
22464
- }
22465
-
22466
- var _polyfillNode_tty = {
22467
- isatty: isatty,
22468
- ReadStream: ReadStream,
22469
- WriteStream: WriteStream
22470
- };
22471
-
22472
- var _polyfillNode_tty$1 = /*#__PURE__*/Object.freeze({
22473
- __proto__: null,
22474
- ReadStream: ReadStream,
22475
- WriteStream: WriteStream,
22476
- default: _polyfillNode_tty,
22477
- isatty: isatty
22478
- });
22479
-
22480
- var require$$0$1 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_tty$1);
22481
-
22482
- /*
22483
- The MIT License (MIT)
22484
-
22485
- Copyright (c) 2016 CoderPuppy
22167
+ function parse(str) {
22168
+ str = String(str);
22169
+ if (str.length > 100) {
22170
+ return;
22171
+ }
22172
+ var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
22173
+ str
22174
+ );
22175
+ if (!match) {
22176
+ return;
22177
+ }
22178
+ var n = parseFloat(match[1]);
22179
+ var type = (match[2] || 'ms').toLowerCase();
22180
+ switch (type) {
22181
+ case 'years':
22182
+ case 'year':
22183
+ case 'yrs':
22184
+ case 'yr':
22185
+ case 'y':
22186
+ return n * y;
22187
+ case 'weeks':
22188
+ case 'week':
22189
+ case 'w':
22190
+ return n * w;
22191
+ case 'days':
22192
+ case 'day':
22193
+ case 'd':
22194
+ return n * d;
22195
+ case 'hours':
22196
+ case 'hour':
22197
+ case 'hrs':
22198
+ case 'hr':
22199
+ case 'h':
22200
+ return n * h;
22201
+ case 'minutes':
22202
+ case 'minute':
22203
+ case 'mins':
22204
+ case 'min':
22205
+ case 'm':
22206
+ return n * m;
22207
+ case 'seconds':
22208
+ case 'second':
22209
+ case 'secs':
22210
+ case 'sec':
22211
+ case 's':
22212
+ return n * s;
22213
+ case 'milliseconds':
22214
+ case 'millisecond':
22215
+ case 'msecs':
22216
+ case 'msec':
22217
+ case 'ms':
22218
+ return n;
22219
+ default:
22220
+ return undefined;
22221
+ }
22222
+ }
22486
22223
 
22487
- Permission is hereby granted, free of charge, to any person obtaining a copy
22488
- of this software and associated documentation files (the "Software"), to deal
22489
- in the Software without restriction, including without limitation the rights
22490
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
22491
- copies of the Software, and to permit persons to whom the Software is
22492
- furnished to do so, subject to the following conditions:
22224
+ /**
22225
+ * Short format for `ms`.
22226
+ *
22227
+ * @param {Number} ms
22228
+ * @return {String}
22229
+ * @api private
22230
+ */
22493
22231
 
22494
- The above copyright notice and this permission notice shall be included in all
22495
- copies or substantial portions of the Software.
22232
+ function fmtShort(ms) {
22233
+ var msAbs = Math.abs(ms);
22234
+ if (msAbs >= d) {
22235
+ return Math.round(ms / d) + 'd';
22236
+ }
22237
+ if (msAbs >= h) {
22238
+ return Math.round(ms / h) + 'h';
22239
+ }
22240
+ if (msAbs >= m) {
22241
+ return Math.round(ms / m) + 'm';
22242
+ }
22243
+ if (msAbs >= s) {
22244
+ return Math.round(ms / s) + 's';
22245
+ }
22246
+ return ms + 'ms';
22247
+ }
22496
22248
 
22497
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22498
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22499
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22500
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22501
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22502
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22503
- SOFTWARE.
22249
+ /**
22250
+ * Long format for `ms`.
22251
+ *
22252
+ * @param {Number} ms
22253
+ * @return {String}
22254
+ * @api private
22255
+ */
22504
22256
 
22505
- */
22506
- var _endianness;
22507
- function endianness() {
22508
- if (typeof _endianness === 'undefined') {
22509
- var a = new ArrayBuffer(2);
22510
- var b = new Uint8Array(a);
22511
- var c = new Uint16Array(a);
22512
- b[0] = 1;
22513
- b[1] = 2;
22514
- if (c[0] === 258) {
22515
- _endianness = 'BE';
22516
- } else if (c[0] === 513){
22517
- _endianness = 'LE';
22518
- } else {
22519
- throw new Error('unable to figure out endianess');
22520
- }
22521
- }
22522
- return _endianness;
22523
- }
22257
+ function fmtLong(ms) {
22258
+ var msAbs = Math.abs(ms);
22259
+ if (msAbs >= d) {
22260
+ return plural(ms, msAbs, d, 'day');
22261
+ }
22262
+ if (msAbs >= h) {
22263
+ return plural(ms, msAbs, h, 'hour');
22264
+ }
22265
+ if (msAbs >= m) {
22266
+ return plural(ms, msAbs, m, 'minute');
22267
+ }
22268
+ if (msAbs >= s) {
22269
+ return plural(ms, msAbs, s, 'second');
22270
+ }
22271
+ return ms + ' ms';
22272
+ }
22524
22273
 
22525
- function hostname() {
22526
- if (typeof global$1.location !== 'undefined') {
22527
- return global$1.location.hostname
22528
- } else return '';
22529
- }
22274
+ /**
22275
+ * Pluralization helper.
22276
+ */
22530
22277
 
22531
- function loadavg() {
22532
- return [];
22278
+ function plural(ms, msAbs, n, name) {
22279
+ var isPlural = msAbs >= n * 1.5;
22280
+ return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
22281
+ }
22282
+ return ms;
22533
22283
  }
22534
22284
 
22535
- function uptime() {
22536
- return 0;
22537
- }
22285
+ var common;
22286
+ var hasRequiredCommon;
22538
22287
 
22539
- function freemem() {
22540
- return Number.MAX_VALUE;
22541
- }
22288
+ function requireCommon () {
22289
+ if (hasRequiredCommon) return common;
22290
+ hasRequiredCommon = 1;
22291
+ /**
22292
+ * This is the common logic for both the Node.js and web browser
22293
+ * implementations of `debug()`.
22294
+ */
22542
22295
 
22543
- function totalmem() {
22544
- return Number.MAX_VALUE;
22545
- }
22296
+ function setup(env) {
22297
+ createDebug.debug = createDebug;
22298
+ createDebug.default = createDebug;
22299
+ createDebug.coerce = coerce;
22300
+ createDebug.disable = disable;
22301
+ createDebug.enable = enable;
22302
+ createDebug.enabled = enabled;
22303
+ createDebug.humanize = requireMs();
22304
+ createDebug.destroy = destroy;
22546
22305
 
22547
- function cpus() {
22548
- return [];
22549
- }
22306
+ Object.keys(env).forEach(key => {
22307
+ createDebug[key] = env[key];
22308
+ });
22550
22309
 
22551
- function type() {
22552
- return 'Browser';
22553
- }
22310
+ /**
22311
+ * The currently active debug mode names, and names to skip.
22312
+ */
22554
22313
 
22555
- function release () {
22556
- if (typeof global$1.navigator !== 'undefined') {
22557
- return global$1.navigator.appVersion;
22558
- }
22559
- return '';
22560
- }
22314
+ createDebug.names = [];
22315
+ createDebug.skips = [];
22561
22316
 
22562
- function networkInterfaces () {
22563
- return {};
22564
- }
22317
+ /**
22318
+ * Map of special "%n" handling functions, for the debug "format" argument.
22319
+ *
22320
+ * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
22321
+ */
22322
+ createDebug.formatters = {};
22565
22323
 
22566
- function getNetworkInterfaces () {
22567
- return {};
22568
- }
22324
+ /**
22325
+ * Selects a color for a debug namespace
22326
+ * @param {String} namespace The namespace string for the debug instance to be colored
22327
+ * @return {Number|String} An ANSI color code for the given namespace
22328
+ * @api private
22329
+ */
22330
+ function selectColor(namespace) {
22331
+ let hash = 0;
22569
22332
 
22570
- function arch() {
22571
- return 'javascript';
22572
- }
22333
+ for (let i = 0; i < namespace.length; i++) {
22334
+ hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
22335
+ hash |= 0; // Convert to 32bit integer
22336
+ }
22573
22337
 
22574
- function platform() {
22575
- return 'browser';
22576
- }
22338
+ return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
22339
+ }
22340
+ createDebug.selectColor = selectColor;
22577
22341
 
22578
- function tmpDir() {
22579
- return '/tmp';
22580
- }
22581
- var tmpdir = tmpDir;
22342
+ /**
22343
+ * Create a debugger with the given `namespace`.
22344
+ *
22345
+ * @param {String} namespace
22346
+ * @return {Function}
22347
+ * @api public
22348
+ */
22349
+ function createDebug(namespace) {
22350
+ let prevTime;
22351
+ let enableOverride = null;
22352
+ let namespacesCache;
22353
+ let enabledCache;
22582
22354
 
22583
- var EOL = '\n';
22355
+ function debug(...args) {
22356
+ // Disabled?
22357
+ if (!debug.enabled) {
22358
+ return;
22359
+ }
22584
22360
 
22585
- function homedir(){
22586
- return '$HOME'
22587
- }
22361
+ const self = debug;
22588
22362
 
22589
- var _polyfillNode_os = {
22590
- homedir: homedir,
22591
- EOL: EOL,
22592
- arch: arch,
22593
- platform: platform,
22594
- tmpdir: tmpdir,
22595
- tmpDir: tmpDir,
22596
- networkInterfaces:networkInterfaces,
22597
- getNetworkInterfaces: getNetworkInterfaces,
22598
- release: release,
22599
- type: type,
22600
- cpus: cpus,
22601
- totalmem: totalmem,
22602
- freemem: freemem,
22603
- uptime: uptime,
22604
- loadavg: loadavg,
22605
- hostname: hostname,
22606
- endianness: endianness,
22607
- };
22363
+ // Set `diff` timestamp
22364
+ const curr = Number(new Date());
22365
+ const ms = curr - (prevTime || curr);
22366
+ self.diff = ms;
22367
+ self.prev = prevTime;
22368
+ self.curr = curr;
22369
+ prevTime = curr;
22608
22370
 
22609
- var _polyfillNode_os$1 = /*#__PURE__*/Object.freeze({
22610
- __proto__: null,
22611
- EOL: EOL,
22612
- arch: arch,
22613
- cpus: cpus,
22614
- default: _polyfillNode_os,
22615
- endianness: endianness,
22616
- freemem: freemem,
22617
- getNetworkInterfaces: getNetworkInterfaces,
22618
- homedir: homedir,
22619
- hostname: hostname,
22620
- loadavg: loadavg,
22621
- networkInterfaces: networkInterfaces,
22622
- platform: platform,
22623
- release: release,
22624
- tmpDir: tmpDir,
22625
- tmpdir: tmpdir,
22626
- totalmem: totalmem,
22627
- type: type,
22628
- uptime: uptime
22629
- });
22371
+ args[0] = createDebug.coerce(args[0]);
22630
22372
 
22631
- var require$$0 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_os$1);
22373
+ if (typeof args[0] !== 'string') {
22374
+ // Anything else let's inspect with %O
22375
+ args.unshift('%O');
22376
+ }
22632
22377
 
22633
- var hasFlag;
22634
- var hasRequiredHasFlag;
22378
+ // Apply any `formatters` transformations
22379
+ let index = 0;
22380
+ args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
22381
+ // If we encounter an escaped % then don't increase the array index
22382
+ if (match === '%%') {
22383
+ return '%';
22384
+ }
22385
+ index++;
22386
+ const formatter = createDebug.formatters[format];
22387
+ if (typeof formatter === 'function') {
22388
+ const val = args[index];
22389
+ match = formatter.call(self, val);
22635
22390
 
22636
- function requireHasFlag () {
22637
- if (hasRequiredHasFlag) return hasFlag;
22638
- hasRequiredHasFlag = 1;
22639
- hasFlag = (flag, argv) => {
22640
- argv = argv || process.argv;
22641
- const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
22642
- const pos = argv.indexOf(prefix + flag);
22643
- const terminatorPos = argv.indexOf('--');
22644
- return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
22645
- };
22646
- return hasFlag;
22647
- }
22391
+ // Now we need to remove `args[index]` since it's inlined in the `format`
22392
+ args.splice(index, 1);
22393
+ index--;
22394
+ }
22395
+ return match;
22396
+ });
22648
22397
 
22649
- var supportsColor_1;
22650
- var hasRequiredSupportsColor;
22398
+ // Apply env-specific formatting (colors, etc.)
22399
+ createDebug.formatArgs.call(self, args);
22651
22400
 
22652
- function requireSupportsColor () {
22653
- if (hasRequiredSupportsColor) return supportsColor_1;
22654
- hasRequiredSupportsColor = 1;
22655
- const os = require$$0;
22656
- const hasFlag = requireHasFlag();
22401
+ const logFn = self.log || createDebug.log;
22402
+ logFn.apply(self, args);
22403
+ }
22657
22404
 
22658
- const env = process.env;
22405
+ debug.namespace = namespace;
22406
+ debug.useColors = createDebug.useColors();
22407
+ debug.color = createDebug.selectColor(namespace);
22408
+ debug.extend = extend;
22409
+ debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
22659
22410
 
22660
- let forceColor;
22661
- if (hasFlag('no-color') ||
22662
- hasFlag('no-colors') ||
22663
- hasFlag('color=false')) {
22664
- forceColor = false;
22665
- } else if (hasFlag('color') ||
22666
- hasFlag('colors') ||
22667
- hasFlag('color=true') ||
22668
- hasFlag('color=always')) {
22669
- forceColor = true;
22670
- }
22671
- if ('FORCE_COLOR' in env) {
22672
- forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
22673
- }
22411
+ Object.defineProperty(debug, 'enabled', {
22412
+ enumerable: true,
22413
+ configurable: false,
22414
+ get: () => {
22415
+ if (enableOverride !== null) {
22416
+ return enableOverride;
22417
+ }
22418
+ if (namespacesCache !== createDebug.namespaces) {
22419
+ namespacesCache = createDebug.namespaces;
22420
+ enabledCache = createDebug.enabled(namespace);
22421
+ }
22674
22422
 
22675
- function translateLevel(level) {
22676
- if (level === 0) {
22677
- return false;
22678
- }
22423
+ return enabledCache;
22424
+ },
22425
+ set: v => {
22426
+ enableOverride = v;
22427
+ }
22428
+ });
22679
22429
 
22680
- return {
22681
- level,
22682
- hasBasic: true,
22683
- has256: level >= 2,
22684
- has16m: level >= 3
22685
- };
22686
- }
22430
+ // Env-specific initialization logic for debug instances
22431
+ if (typeof createDebug.init === 'function') {
22432
+ createDebug.init(debug);
22433
+ }
22687
22434
 
22688
- function supportsColor(stream) {
22689
- if (forceColor === false) {
22690
- return 0;
22435
+ return debug;
22691
22436
  }
22692
22437
 
22693
- if (hasFlag('color=16m') ||
22694
- hasFlag('color=full') ||
22695
- hasFlag('color=truecolor')) {
22696
- return 3;
22438
+ function extend(namespace, delimiter) {
22439
+ const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
22440
+ newDebug.log = this.log;
22441
+ return newDebug;
22697
22442
  }
22698
22443
 
22699
- if (hasFlag('color=256')) {
22700
- return 2;
22701
- }
22444
+ /**
22445
+ * Enables a debug mode by namespaces. This can include modes
22446
+ * separated by a colon and wildcards.
22447
+ *
22448
+ * @param {String} namespaces
22449
+ * @api public
22450
+ */
22451
+ function enable(namespaces) {
22452
+ createDebug.save(namespaces);
22453
+ createDebug.namespaces = namespaces;
22702
22454
 
22703
- if (stream && !stream.isTTY && forceColor !== true) {
22704
- return 0;
22705
- }
22455
+ createDebug.names = [];
22456
+ createDebug.skips = [];
22706
22457
 
22707
- const min = forceColor ? 1 : 0;
22458
+ let i;
22459
+ const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
22460
+ const len = split.length;
22708
22461
 
22709
- if (process.platform === 'win32') {
22710
- // Node.js 7.5.0 is the first version of Node.js to include a patch to
22711
- // libuv that enables 256 color output on Windows. Anything earlier and it
22712
- // won't work. However, here we target Node.js 8 at minimum as it is an LTS
22713
- // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows
22714
- // release that supports 256 colors. Windows 10 build 14931 is the first release
22715
- // that supports 16m/TrueColor.
22716
- const osRelease = os.release().split('.');
22717
- if (
22718
- Number(process.versions.node.split('.')[0]) >= 8 &&
22719
- Number(osRelease[0]) >= 10 &&
22720
- Number(osRelease[2]) >= 10586
22721
- ) {
22722
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
22723
- }
22462
+ for (i = 0; i < len; i++) {
22463
+ if (!split[i]) {
22464
+ // ignore empty strings
22465
+ continue;
22466
+ }
22724
22467
 
22725
- return 1;
22726
- }
22468
+ namespaces = split[i].replace(/\*/g, '.*?');
22727
22469
 
22728
- if ('CI' in env) {
22729
- if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
22730
- return 1;
22470
+ if (namespaces[0] === '-') {
22471
+ createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
22472
+ } else {
22473
+ createDebug.names.push(new RegExp('^' + namespaces + '$'));
22474
+ }
22731
22475
  }
22732
-
22733
- return min;
22734
22476
  }
22735
22477
 
22736
- if ('TEAMCITY_VERSION' in env) {
22737
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
22478
+ /**
22479
+ * Disable debug output.
22480
+ *
22481
+ * @return {String} namespaces
22482
+ * @api public
22483
+ */
22484
+ function disable() {
22485
+ const namespaces = [
22486
+ ...createDebug.names.map(toNamespace),
22487
+ ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
22488
+ ].join(',');
22489
+ createDebug.enable('');
22490
+ return namespaces;
22738
22491
  }
22739
22492
 
22740
- if (env.COLORTERM === 'truecolor') {
22741
- return 3;
22742
- }
22493
+ /**
22494
+ * Returns true if the given mode name is enabled, false otherwise.
22495
+ *
22496
+ * @param {String} name
22497
+ * @return {Boolean}
22498
+ * @api public
22499
+ */
22500
+ function enabled(name) {
22501
+ if (name[name.length - 1] === '*') {
22502
+ return true;
22503
+ }
22743
22504
 
22744
- if ('TERM_PROGRAM' in env) {
22745
- const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
22505
+ let i;
22506
+ let len;
22746
22507
 
22747
- switch (env.TERM_PROGRAM) {
22748
- case 'iTerm.app':
22749
- return version >= 3 ? 3 : 2;
22750
- case 'Apple_Terminal':
22751
- return 2;
22752
- // No default
22508
+ for (i = 0, len = createDebug.skips.length; i < len; i++) {
22509
+ if (createDebug.skips[i].test(name)) {
22510
+ return false;
22511
+ }
22753
22512
  }
22754
- }
22755
22513
 
22756
- if (/-256(color)?$/i.test(env.TERM)) {
22757
- return 2;
22514
+ for (i = 0, len = createDebug.names.length; i < len; i++) {
22515
+ if (createDebug.names[i].test(name)) {
22516
+ return true;
22517
+ }
22518
+ }
22519
+
22520
+ return false;
22758
22521
  }
22759
22522
 
22760
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
22761
- return 1;
22523
+ /**
22524
+ * Convert regexp to namespace
22525
+ *
22526
+ * @param {RegExp} regxep
22527
+ * @return {String} namespace
22528
+ * @api private
22529
+ */
22530
+ function toNamespace(regexp) {
22531
+ return regexp.toString()
22532
+ .substring(2, regexp.toString().length - 2)
22533
+ .replace(/\.\*\?$/, '*');
22762
22534
  }
22763
22535
 
22764
- if ('COLORTERM' in env) {
22765
- return 1;
22536
+ /**
22537
+ * Coerce `val`.
22538
+ *
22539
+ * @param {Mixed} val
22540
+ * @return {Mixed}
22541
+ * @api private
22542
+ */
22543
+ function coerce(val) {
22544
+ if (val instanceof Error) {
22545
+ return val.stack || val.message;
22546
+ }
22547
+ return val;
22766
22548
  }
22767
22549
 
22768
- if (env.TERM === 'dumb') {
22769
- return min;
22550
+ /**
22551
+ * XXX DO NOT USE. This is a temporary stub function.
22552
+ * XXX It WILL be removed in the next major release.
22553
+ */
22554
+ function destroy() {
22555
+ console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
22770
22556
  }
22771
22557
 
22772
- return min;
22773
- }
22558
+ createDebug.enable(createDebug.load());
22774
22559
 
22775
- function getSupportLevel(stream) {
22776
- const level = supportsColor(stream);
22777
- return translateLevel(level);
22560
+ return createDebug;
22778
22561
  }
22779
22562
 
22780
- supportsColor_1 = {
22781
- supportsColor: getSupportLevel,
22782
- stdout: getSupportLevel(process.stdout),
22783
- stderr: getSupportLevel(process.stderr)
22784
- };
22785
- return supportsColor_1;
22563
+ common = setup;
22564
+ return common;
22786
22565
  }
22787
22566
 
22788
22567
  /**
@@ -22909,83 +22688,352 @@ function requireNode () {
22909
22688
  }
22910
22689
 
22911
22690
  /**
22912
- * Build up the default `inspectOpts` object from the environment variables.
22691
+ * Build up the default `inspectOpts` object from the environment variables.
22692
+ *
22693
+ * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
22694
+ */
22695
+
22696
+ exports.inspectOpts = Object.keys(process.env).filter(key => {
22697
+ return /^debug_/i.test(key);
22698
+ }).reduce((obj, key) => {
22699
+ // Camel-case
22700
+ const prop = key
22701
+ .substring(6)
22702
+ .toLowerCase()
22703
+ .replace(/_([a-z])/g, (_, k) => {
22704
+ return k.toUpperCase();
22705
+ });
22706
+
22707
+ // Coerce string value into JS value
22708
+ let val = process.env[key];
22709
+ if (/^(yes|on|true|enabled)$/i.test(val)) {
22710
+ val = true;
22711
+ } else if (/^(no|off|false|disabled)$/i.test(val)) {
22712
+ val = false;
22713
+ } else if (val === 'null') {
22714
+ val = null;
22715
+ } else {
22716
+ val = Number(val);
22717
+ }
22718
+
22719
+ obj[prop] = val;
22720
+ return obj;
22721
+ }, {});
22722
+
22723
+ /**
22724
+ * Is stdout a TTY? Colored output is enabled when `true`.
22725
+ */
22726
+
22727
+ function useColors() {
22728
+ return 'colors' in exports.inspectOpts ?
22729
+ Boolean(exports.inspectOpts.colors) :
22730
+ tty.isatty(process.stderr.fd);
22731
+ }
22732
+
22733
+ /**
22734
+ * Adds ANSI color escape codes if enabled.
22735
+ *
22736
+ * @api public
22737
+ */
22738
+
22739
+ function formatArgs(args) {
22740
+ const {namespace: name, useColors} = this;
22741
+
22742
+ if (useColors) {
22743
+ const c = this.color;
22744
+ const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
22745
+ const prefix = ` ${colorCode};1m${name} \u001B[0m`;
22746
+
22747
+ args[0] = prefix + args[0].split('\n').join('\n' + prefix);
22748
+ args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
22749
+ } else {
22750
+ args[0] = getDate() + name + ' ' + args[0];
22751
+ }
22752
+ }
22753
+
22754
+ function getDate() {
22755
+ if (exports.inspectOpts.hideDate) {
22756
+ return '';
22757
+ }
22758
+ return new Date().toISOString() + ' ';
22759
+ }
22760
+
22761
+ /**
22762
+ * Invokes `util.format()` with the specified arguments and writes to stderr.
22763
+ */
22764
+
22765
+ function log(...args) {
22766
+ return process.stderr.write(util.format(...args) + '\n');
22767
+ }
22768
+
22769
+ /**
22770
+ * Save `namespaces`.
22771
+ *
22772
+ * @param {String} namespaces
22773
+ * @api private
22774
+ */
22775
+ function save(namespaces) {
22776
+ if (namespaces) {
22777
+ process.env.DEBUG = namespaces;
22778
+ } else {
22779
+ // If you set a process.env field to null or undefined, it gets cast to the
22780
+ // string 'null' or 'undefined'. Just delete instead.
22781
+ delete process.env.DEBUG;
22782
+ }
22783
+ }
22784
+
22785
+ /**
22786
+ * Load `namespaces`.
22787
+ *
22788
+ * @return {String} returns the previously persisted debug modes
22789
+ * @api private
22790
+ */
22791
+
22792
+ function load() {
22793
+ return process.env.DEBUG;
22794
+ }
22795
+
22796
+ /**
22797
+ * Init logic for `debug` instances.
22798
+ *
22799
+ * Create a new `inspectOpts` object in case `useColors` is set
22800
+ * differently for a particular `debug` instance.
22801
+ */
22802
+
22803
+ function init(debug) {
22804
+ debug.inspectOpts = {};
22805
+
22806
+ const keys = Object.keys(exports.inspectOpts);
22807
+ for (let i = 0; i < keys.length; i++) {
22808
+ debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
22809
+ }
22810
+ }
22811
+
22812
+ module.exports = requireCommon()(exports);
22813
+
22814
+ const {formatters} = module.exports;
22815
+
22816
+ /**
22817
+ * Map %o to `util.inspect()`, all on a single line.
22818
+ */
22819
+
22820
+ formatters.o = function (v) {
22821
+ this.inspectOpts.colors = this.useColors;
22822
+ return util.inspect(v, this.inspectOpts)
22823
+ .split('\n')
22824
+ .map(str => str.trim())
22825
+ .join(' ');
22826
+ };
22827
+
22828
+ /**
22829
+ * Map %O to `util.inspect()`, allowing multiple lines if needed.
22830
+ */
22831
+
22832
+ formatters.O = function (v) {
22833
+ this.inspectOpts.colors = this.useColors;
22834
+ return util.inspect(v, this.inspectOpts);
22835
+ };
22836
+ } (node, node.exports));
22837
+ return node.exports;
22838
+ }
22839
+
22840
+ var browser = {exports: {}};
22841
+
22842
+ /* eslint-env browser */
22843
+
22844
+ var hasRequiredBrowser;
22845
+
22846
+ function requireBrowser () {
22847
+ if (hasRequiredBrowser) return browser.exports;
22848
+ hasRequiredBrowser = 1;
22849
+ (function (module, exports) {
22850
+ /**
22851
+ * This is the web browser implementation of `debug()`.
22852
+ */
22853
+
22854
+ exports.formatArgs = formatArgs;
22855
+ exports.save = save;
22856
+ exports.load = load;
22857
+ exports.useColors = useColors;
22858
+ exports.storage = localstorage();
22859
+ exports.destroy = (() => {
22860
+ let warned = false;
22861
+
22862
+ return () => {
22863
+ if (!warned) {
22864
+ warned = true;
22865
+ console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
22866
+ }
22867
+ };
22868
+ })();
22869
+
22870
+ /**
22871
+ * Colors.
22872
+ */
22873
+
22874
+ exports.colors = [
22875
+ '#0000CC',
22876
+ '#0000FF',
22877
+ '#0033CC',
22878
+ '#0033FF',
22879
+ '#0066CC',
22880
+ '#0066FF',
22881
+ '#0099CC',
22882
+ '#0099FF',
22883
+ '#00CC00',
22884
+ '#00CC33',
22885
+ '#00CC66',
22886
+ '#00CC99',
22887
+ '#00CCCC',
22888
+ '#00CCFF',
22889
+ '#3300CC',
22890
+ '#3300FF',
22891
+ '#3333CC',
22892
+ '#3333FF',
22893
+ '#3366CC',
22894
+ '#3366FF',
22895
+ '#3399CC',
22896
+ '#3399FF',
22897
+ '#33CC00',
22898
+ '#33CC33',
22899
+ '#33CC66',
22900
+ '#33CC99',
22901
+ '#33CCCC',
22902
+ '#33CCFF',
22903
+ '#6600CC',
22904
+ '#6600FF',
22905
+ '#6633CC',
22906
+ '#6633FF',
22907
+ '#66CC00',
22908
+ '#66CC33',
22909
+ '#9900CC',
22910
+ '#9900FF',
22911
+ '#9933CC',
22912
+ '#9933FF',
22913
+ '#99CC00',
22914
+ '#99CC33',
22915
+ '#CC0000',
22916
+ '#CC0033',
22917
+ '#CC0066',
22918
+ '#CC0099',
22919
+ '#CC00CC',
22920
+ '#CC00FF',
22921
+ '#CC3300',
22922
+ '#CC3333',
22923
+ '#CC3366',
22924
+ '#CC3399',
22925
+ '#CC33CC',
22926
+ '#CC33FF',
22927
+ '#CC6600',
22928
+ '#CC6633',
22929
+ '#CC9900',
22930
+ '#CC9933',
22931
+ '#CCCC00',
22932
+ '#CCCC33',
22933
+ '#FF0000',
22934
+ '#FF0033',
22935
+ '#FF0066',
22936
+ '#FF0099',
22937
+ '#FF00CC',
22938
+ '#FF00FF',
22939
+ '#FF3300',
22940
+ '#FF3333',
22941
+ '#FF3366',
22942
+ '#FF3399',
22943
+ '#FF33CC',
22944
+ '#FF33FF',
22945
+ '#FF6600',
22946
+ '#FF6633',
22947
+ '#FF9900',
22948
+ '#FF9933',
22949
+ '#FFCC00',
22950
+ '#FFCC33'
22951
+ ];
22952
+
22953
+ /**
22954
+ * Currently only WebKit-based Web Inspectors, Firefox >= v31,
22955
+ * and the Firebug extension (any Firefox version) are known
22956
+ * to support "%c" CSS customizations.
22913
22957
  *
22914
- * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
22958
+ * TODO: add a `localStorage` variable to explicitly enable/disable colors
22915
22959
  */
22916
22960
 
22917
- exports.inspectOpts = Object.keys(process.env).filter(key => {
22918
- return /^debug_/i.test(key);
22919
- }).reduce((obj, key) => {
22920
- // Camel-case
22921
- const prop = key
22922
- .substring(6)
22923
- .toLowerCase()
22924
- .replace(/_([a-z])/g, (_, k) => {
22925
- return k.toUpperCase();
22926
- });
22927
-
22928
- // Coerce string value into JS value
22929
- let val = process.env[key];
22930
- if (/^(yes|on|true|enabled)$/i.test(val)) {
22931
- val = true;
22932
- } else if (/^(no|off|false|disabled)$/i.test(val)) {
22933
- val = false;
22934
- } else if (val === 'null') {
22935
- val = null;
22936
- } else {
22937
- val = Number(val);
22961
+ // eslint-disable-next-line complexity
22962
+ function useColors() {
22963
+ // NB: In an Electron preload script, document will be defined but not fully
22964
+ // initialized. Since we know we're in Chrome, we'll just detect this case
22965
+ // explicitly
22966
+ if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
22967
+ return true;
22938
22968
  }
22939
22969
 
22940
- obj[prop] = val;
22941
- return obj;
22942
- }, {});
22943
-
22944
- /**
22945
- * Is stdout a TTY? Colored output is enabled when `true`.
22946
- */
22970
+ // Internet Explorer and Edge do not support colors.
22971
+ if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
22972
+ return false;
22973
+ }
22947
22974
 
22948
- function useColors() {
22949
- return 'colors' in exports.inspectOpts ?
22950
- Boolean(exports.inspectOpts.colors) :
22951
- tty.isatty(process.stderr.fd);
22975
+ // Is webkit? http://stackoverflow.com/a/16459606/376773
22976
+ // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
22977
+ return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
22978
+ // Is firebug? http://stackoverflow.com/a/398120/376773
22979
+ (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
22980
+ // Is firefox >= v31?
22981
+ // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
22982
+ (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
22983
+ // Double check webkit in userAgent just in case we are in a worker
22984
+ (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
22952
22985
  }
22953
22986
 
22954
22987
  /**
22955
- * Adds ANSI color escape codes if enabled.
22988
+ * Colorize log arguments if enabled.
22956
22989
  *
22957
22990
  * @api public
22958
22991
  */
22959
22992
 
22960
22993
  function formatArgs(args) {
22961
- const {namespace: name, useColors} = this;
22962
-
22963
- if (useColors) {
22964
- const c = this.color;
22965
- const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
22966
- const prefix = ` ${colorCode};1m${name} \u001B[0m`;
22994
+ args[0] = (this.useColors ? '%c' : '') +
22995
+ this.namespace +
22996
+ (this.useColors ? ' %c' : ' ') +
22997
+ args[0] +
22998
+ (this.useColors ? '%c ' : ' ') +
22999
+ '+' + module.exports.humanize(this.diff);
22967
23000
 
22968
- args[0] = prefix + args[0].split('\n').join('\n' + prefix);
22969
- args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
22970
- } else {
22971
- args[0] = getDate() + name + ' ' + args[0];
23001
+ if (!this.useColors) {
23002
+ return;
22972
23003
  }
22973
- }
22974
23004
 
22975
- function getDate() {
22976
- if (exports.inspectOpts.hideDate) {
22977
- return '';
22978
- }
22979
- return new Date().toISOString() + ' ';
23005
+ const c = 'color: ' + this.color;
23006
+ args.splice(1, 0, c, 'color: inherit');
23007
+
23008
+ // The final "%c" is somewhat tricky, because there could be other
23009
+ // arguments passed either before or after the %c, so we need to
23010
+ // figure out the correct index to insert the CSS into
23011
+ let index = 0;
23012
+ let lastC = 0;
23013
+ args[0].replace(/%[a-zA-Z%]/g, match => {
23014
+ if (match === '%%') {
23015
+ return;
23016
+ }
23017
+ index++;
23018
+ if (match === '%c') {
23019
+ // We only are interested in the *last* %c
23020
+ // (the user may have provided their own)
23021
+ lastC = index;
23022
+ }
23023
+ });
23024
+
23025
+ args.splice(lastC, 0, c);
22980
23026
  }
22981
23027
 
22982
23028
  /**
22983
- * Invokes `util.format()` with the specified arguments and writes to stderr.
23029
+ * Invokes `console.debug()` when available.
23030
+ * No-op when `console.debug` is not a "function".
23031
+ * If `console.debug` is not available, falls back
23032
+ * to `console.log`.
23033
+ *
23034
+ * @api public
22984
23035
  */
22985
-
22986
- function log(...args) {
22987
- return process.stderr.write(util.format(...args) + '\n');
22988
- }
23036
+ exports.log = console.debug || console.log || (() => {});
22989
23037
 
22990
23038
  /**
22991
23039
  * Save `namespaces`.
@@ -22994,12 +23042,15 @@ function requireNode () {
22994
23042
  * @api private
22995
23043
  */
22996
23044
  function save(namespaces) {
22997
- if (namespaces) {
22998
- process.env.DEBUG = namespaces;
22999
- } else {
23000
- // If you set a process.env field to null or undefined, it gets cast to the
23001
- // string 'null' or 'undefined'. Just delete instead.
23002
- delete process.env.DEBUG;
23045
+ try {
23046
+ if (namespaces) {
23047
+ exports.storage.setItem('debug', namespaces);
23048
+ } else {
23049
+ exports.storage.removeItem('debug');
23050
+ }
23051
+ } catch (error) {
23052
+ // Swallow
23053
+ // XXX (@Qix-) should we be logging these?
23003
23054
  }
23004
23055
  }
23005
23056
 
@@ -23009,24 +23060,42 @@ function requireNode () {
23009
23060
  * @return {String} returns the previously persisted debug modes
23010
23061
  * @api private
23011
23062
  */
23012
-
23013
23063
  function load() {
23014
- return process.env.DEBUG;
23064
+ let r;
23065
+ try {
23066
+ r = exports.storage.getItem('debug');
23067
+ } catch (error) {
23068
+ // Swallow
23069
+ // XXX (@Qix-) should we be logging these?
23070
+ }
23071
+
23072
+ // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
23073
+ if (!r && typeof process !== 'undefined' && 'env' in process) {
23074
+ r = process.env.DEBUG;
23075
+ }
23076
+
23077
+ return r;
23015
23078
  }
23016
23079
 
23017
23080
  /**
23018
- * Init logic for `debug` instances.
23081
+ * Localstorage attempts to return the localstorage.
23019
23082
  *
23020
- * Create a new `inspectOpts` object in case `useColors` is set
23021
- * differently for a particular `debug` instance.
23083
+ * This is necessary because safari throws
23084
+ * when a user disables cookies/localstorage
23085
+ * and you attempt to access it.
23086
+ *
23087
+ * @return {LocalStorage}
23088
+ * @api private
23022
23089
  */
23023
23090
 
23024
- function init(debug) {
23025
- debug.inspectOpts = {};
23026
-
23027
- const keys = Object.keys(exports.inspectOpts);
23028
- for (let i = 0; i < keys.length; i++) {
23029
- debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
23091
+ function localstorage() {
23092
+ try {
23093
+ // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
23094
+ // The Browser also has localStorage in the global context.
23095
+ return localStorage;
23096
+ } catch (error) {
23097
+ // Swallow
23098
+ // XXX (@Qix-) should we be logging these?
23030
23099
  }
23031
23100
  }
23032
23101
 
@@ -23035,27 +23104,18 @@ function requireNode () {
23035
23104
  const {formatters} = module.exports;
23036
23105
 
23037
23106
  /**
23038
- * Map %o to `util.inspect()`, all on a single line.
23039
- */
23040
-
23041
- formatters.o = function (v) {
23042
- this.inspectOpts.colors = this.useColors;
23043
- return util.inspect(v, this.inspectOpts)
23044
- .split('\n')
23045
- .map(str => str.trim())
23046
- .join(' ');
23047
- };
23048
-
23049
- /**
23050
- * Map %O to `util.inspect()`, allowing multiple lines if needed.
23107
+ * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
23051
23108
  */
23052
23109
 
23053
- formatters.O = function (v) {
23054
- this.inspectOpts.colors = this.useColors;
23055
- return util.inspect(v, this.inspectOpts);
23110
+ formatters.j = function (v) {
23111
+ try {
23112
+ return JSON.stringify(v);
23113
+ } catch (error) {
23114
+ return '[UnexpectedJSONParseError]: ' + error.message;
23115
+ }
23056
23116
  };
23057
- } (node, node.exports));
23058
- return node.exports;
23117
+ } (browser, browser.exports));
23118
+ return browser.exports;
23059
23119
  }
23060
23120
 
23061
23121
  /**
@@ -23132,6 +23192,9 @@ var WriteAfterEndError = createErrorType(
23132
23192
  "write after end"
23133
23193
  );
23134
23194
 
23195
+ // istanbul ignore next
23196
+ var destroy = Writable.prototype.destroy || noop;
23197
+
23135
23198
  // An HTTP(S) request that can be redirected
23136
23199
  function RedirectableRequest(options, responseCallback) {
23137
23200
  // Initialize the request
@@ -23162,10 +23225,17 @@ function RedirectableRequest(options, responseCallback) {
23162
23225
  RedirectableRequest.prototype = Object.create(Writable.prototype);
23163
23226
 
23164
23227
  RedirectableRequest.prototype.abort = function () {
23165
- abortRequest(this._currentRequest);
23228
+ destroyRequest(this._currentRequest);
23229
+ this._currentRequest.abort();
23166
23230
  this.emit("abort");
23167
23231
  };
23168
23232
 
23233
+ RedirectableRequest.prototype.destroy = function (error) {
23234
+ destroyRequest(this._currentRequest, error);
23235
+ destroy.call(this, error);
23236
+ return this;
23237
+ };
23238
+
23169
23239
  // Writes buffered data to the current native request
23170
23240
  RedirectableRequest.prototype.write = function (data, encoding, callback) {
23171
23241
  // Writing is not allowed if end has been called
@@ -23278,6 +23348,7 @@ RedirectableRequest.prototype.setTimeout = function (msecs, callback) {
23278
23348
  self.removeListener("abort", clearTimer);
23279
23349
  self.removeListener("error", clearTimer);
23280
23350
  self.removeListener("response", clearTimer);
23351
+ self.removeListener("close", clearTimer);
23281
23352
  if (callback) {
23282
23353
  self.removeListener("timeout", callback);
23283
23354
  }
@@ -23304,6 +23375,7 @@ RedirectableRequest.prototype.setTimeout = function (msecs, callback) {
23304
23375
  this.on("abort", clearTimer);
23305
23376
  this.on("error", clearTimer);
23306
23377
  this.on("response", clearTimer);
23378
+ this.on("close", clearTimer);
23307
23379
 
23308
23380
  return this;
23309
23381
  };
@@ -23455,7 +23527,7 @@ RedirectableRequest.prototype._processResponse = function (response) {
23455
23527
  }
23456
23528
 
23457
23529
  // The response is a redirect, so abort the current request
23458
- abortRequest(this._currentRequest);
23530
+ destroyRequest(this._currentRequest);
23459
23531
  // Discard the remainder of the response to avoid waiting for data
23460
23532
  response.destroy();
23461
23533
 
@@ -23684,12 +23756,12 @@ function createErrorType(code, message, baseClass) {
23684
23756
  return CustomError;
23685
23757
  }
23686
23758
 
23687
- function abortRequest(request) {
23759
+ function destroyRequest(request, error) {
23688
23760
  for (var event of events) {
23689
23761
  request.removeListener(event, eventHandlers[event]);
23690
23762
  }
23691
23763
  request.on("error", noop);
23692
- request.abort();
23764
+ request.destroy(error);
23693
23765
  }
23694
23766
 
23695
23767
  function isSubdomain(subdomain, domain) {
@@ -29238,7 +29310,7 @@ Zlib$1.prototype._write = function(flush, input, in_off, in_len, out, out_off, o
29238
29310
  throw new Error('Unknown mode ' + this.mode);
29239
29311
  }
29240
29312
 
29241
- if (status !== Z_STREAM_END && status !== Z_OK) {
29313
+ if (!this._checkError(status, strm, flush)) {
29242
29314
  this._error(status);
29243
29315
  }
29244
29316
 
@@ -29246,6 +29318,27 @@ Zlib$1.prototype._write = function(flush, input, in_off, in_len, out, out_off, o
29246
29318
  return [strm.avail_in, strm.avail_out];
29247
29319
  };
29248
29320
 
29321
+ Zlib$1.prototype._checkError = function (status, strm, flush) {
29322
+ // Acceptable error states depend on the type of zlib stream.
29323
+ switch (status) {
29324
+ case Z_OK:
29325
+ case Z_BUF_ERROR:
29326
+ if (strm.avail_out !== 0 && flush === Z_FINISH) {
29327
+ return false
29328
+ }
29329
+ break
29330
+ case Z_STREAM_END:
29331
+ // normal statuses, not fatal
29332
+ break
29333
+ case Z_NEED_DICT:
29334
+ return false
29335
+ default:
29336
+ return false
29337
+ }
29338
+
29339
+ return true
29340
+ };
29341
+
29249
29342
  Zlib$1.prototype.close = function() {
29250
29343
  if (this.write_in_progress) {
29251
29344
  this.pending_close = true;
@@ -29660,7 +29753,7 @@ function Zlib(opts, mode) {
29660
29753
 
29661
29754
  var error = new Error(message);
29662
29755
  error.errno = errno;
29663
- error.code = binding.codes[errno];
29756
+ error.code = codes[errno];
29664
29757
  self.emit('error', error);
29665
29758
  };
29666
29759
 
@@ -29940,7 +30033,7 @@ var zlib = {
29940
30033
  Zlib: Zlib
29941
30034
  };
29942
30035
 
29943
- const VERSION = "1.5.1";
30036
+ const VERSION = "1.6.2";
29944
30037
 
29945
30038
  function parseProtocol(url) {
29946
30039
  const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
@@ -30081,7 +30174,7 @@ const kInternals = Symbol('internals');
30081
30174
 
30082
30175
  class AxiosTransformStream extends Stream$3.Transform{
30083
30176
  constructor(options) {
30084
- options = utils.toFlatObject(options, {
30177
+ options = utils$1.toFlatObject(options, {
30085
30178
  maxRate: 0,
30086
30179
  chunkSize: 64 * 1024,
30087
30180
  minChunkSize: 100,
@@ -30089,7 +30182,7 @@ class AxiosTransformStream extends Stream$3.Transform{
30089
30182
  ticksRate: 2,
30090
30183
  samplesCount: 15
30091
30184
  }, null, (prop, source) => {
30092
- return !utils.isUndefined(source[prop]);
30185
+ return !utils$1.isUndefined(source[prop]);
30093
30186
  });
30094
30187
 
30095
30188
  super({
@@ -30278,7 +30371,7 @@ const readBlob = async function* (blob) {
30278
30371
 
30279
30372
  var readBlob$1 = readBlob;
30280
30373
 
30281
- const BOUNDARY_ALPHABET = utils.ALPHABET.ALPHA_DIGIT + '-_';
30374
+ const BOUNDARY_ALPHABET = utils$1.ALPHABET.ALPHA_DIGIT + '-_';
30282
30375
 
30283
30376
  const textEncoder = new text_min.TextEncoder();
30284
30377
 
@@ -30289,7 +30382,7 @@ const CRLF_BYTES_COUNT = 2;
30289
30382
  class FormDataPart {
30290
30383
  constructor(name, value) {
30291
30384
  const {escapeName} = this.constructor;
30292
- const isStringValue = utils.isString(value);
30385
+ const isStringValue = utils$1.isString(value);
30293
30386
 
30294
30387
  let headers = `Content-Disposition: form-data; name="${escapeName(name)}"${
30295
30388
  !isStringValue && value.name ? `; filename="${escapeName(value.name)}"` : ''
@@ -30316,7 +30409,7 @@ class FormDataPart {
30316
30409
 
30317
30410
  const {value} = this;
30318
30411
 
30319
- if(utils.isTypedArray(value)) {
30412
+ if(utils$1.isTypedArray(value)) {
30320
30413
  yield value;
30321
30414
  } else {
30322
30415
  yield* readBlob$1(value);
@@ -30338,10 +30431,10 @@ const formDataToStream = (form, headersHandler, options) => {
30338
30431
  const {
30339
30432
  tag = 'form-data-boundary',
30340
30433
  size = 25,
30341
- boundary = tag + '-' + utils.generateString(size, BOUNDARY_ALPHABET)
30434
+ boundary = tag + '-' + utils$1.generateString(size, BOUNDARY_ALPHABET)
30342
30435
  } = options || {};
30343
30436
 
30344
- if(!utils.isFormData(form)) {
30437
+ if(!utils$1.isFormData(form)) {
30345
30438
  throw TypeError('FormData instance required');
30346
30439
  }
30347
30440
 
@@ -30361,7 +30454,7 @@ const formDataToStream = (form, headersHandler, options) => {
30361
30454
 
30362
30455
  contentLength += boundaryBytes.byteLength * parts.length;
30363
30456
 
30364
- contentLength = utils.toFiniteNumber(contentLength);
30457
+ contentLength = utils$1.toFiniteNumber(contentLength);
30365
30458
 
30366
30459
  const computedHeaders = {
30367
30460
  'Content-Type': `multipart/form-data; boundary=${boundary}`
@@ -30411,7 +30504,7 @@ class ZlibHeaderTransformStream extends Stream$3.Transform {
30411
30504
  var ZlibHeaderTransformStream$1 = ZlibHeaderTransformStream;
30412
30505
 
30413
30506
  const callbackify = (fn, reducer) => {
30414
- return utils.isAsyncFn(fn) ? function (...args) {
30507
+ return utils$1.isAsyncFn(fn) ? function (...args) {
30415
30508
  const cb = args.pop();
30416
30509
  fn.apply(this, args).then((value) => {
30417
30510
  try {
@@ -30435,7 +30528,7 @@ const brotliOptions = {
30435
30528
  finishFlush: zlib.constants.BROTLI_OPERATION_FLUSH
30436
30529
  };
30437
30530
 
30438
- const isBrotliSupported = utils.isFunction(zlib.createBrotliDecompress);
30531
+ const isBrotliSupported = utils$1.isFunction(zlib.createBrotliDecompress);
30439
30532
 
30440
30533
  const {http: httpFollow, https: httpsFollow} = followRedirects;
30441
30534
 
@@ -30515,7 +30608,7 @@ function setProxy(options, configProxy, location) {
30515
30608
  };
30516
30609
  }
30517
30610
 
30518
- const isHttpAdapterSupported = typeof browser$1$1 !== 'undefined' && utils.kindOf(browser$1$1) === 'process';
30611
+ const isHttpAdapterSupported = typeof browser$1$1 !== 'undefined' && utils$1.kindOf(browser$1$1) === 'process';
30519
30612
 
30520
30613
  // temporary hotfix
30521
30614
 
@@ -30544,6 +30637,18 @@ const wrapAsync = (asyncExecutor) => {
30544
30637
  })
30545
30638
  };
30546
30639
 
30640
+ const resolveFamily = ({address, family}) => {
30641
+ if (!utils$1.isString(address)) {
30642
+ throw TypeError('address must be a string');
30643
+ }
30644
+ return ({
30645
+ address,
30646
+ family: family || (address.indexOf('.') < 0 ? 6 : 4)
30647
+ });
30648
+ };
30649
+
30650
+ const buildAddressEntry = (address, family) => resolveFamily(utils$1.isObject(address) ? address : {address, family});
30651
+
30547
30652
  /*eslint consistent-return:0*/
30548
30653
  var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
30549
30654
  return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) {
@@ -30554,15 +30659,16 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
30554
30659
  let rejected = false;
30555
30660
  let req;
30556
30661
 
30557
- if (lookup && utils.isAsyncFn(lookup)) {
30558
- lookup = callbackify$1(lookup, (entry) => {
30559
- if(utils.isString(entry)) {
30560
- entry = [entry, entry.indexOf('.') < 0 ? 6 : 4];
30561
- } else if (!utils.isArray(entry)) {
30562
- throw new TypeError('lookup async function must return an array [ip: string, family: number]]')
30563
- }
30564
- return entry;
30565
- });
30662
+ if (lookup) {
30663
+ const _lookup = callbackify$1(lookup, (value) => utils$1.isArray(value) ? value : [value]);
30664
+ // hotfix to support opt.all option which is required for node 20.x
30665
+ lookup = (hostname, opt, cb) => {
30666
+ _lookup(hostname, opt, (err, arg0, arg1) => {
30667
+ const addresses = utils$1.isArray(arg0) ? arg0.map(addr => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
30668
+
30669
+ opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
30670
+ });
30671
+ };
30566
30672
  }
30567
30673
 
30568
30674
  // temporary internal emitter until the AxiosRequest class will be implemented
@@ -30630,7 +30736,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
30630
30736
  convertedData = convertedData.toString(responseEncoding);
30631
30737
 
30632
30738
  if (!responseEncoding || responseEncoding === 'utf8') {
30633
- convertedData = utils.stripBOM(convertedData);
30739
+ convertedData = utils$1.stripBOM(convertedData);
30634
30740
  }
30635
30741
  } else if (responseType === 'stream') {
30636
30742
  convertedData = Stream$3.Readable.from(convertedData);
@@ -30668,7 +30774,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
30668
30774
  let maxDownloadRate = undefined;
30669
30775
 
30670
30776
  // support for spec compliant FormData objects
30671
- if (utils.isSpecCompliantForm(data)) {
30777
+ if (utils$1.isSpecCompliantForm(data)) {
30672
30778
  const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i);
30673
30779
 
30674
30780
  data = formDataToStream$1(data, (formHeaders) => {
@@ -30678,7 +30784,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
30678
30784
  boundary: userBoundary && userBoundary[1] || undefined
30679
30785
  });
30680
30786
  // support for https://www.npmjs.com/package/form-data api
30681
- } else if (utils.isFormData(data) && utils.isFunction(data.getHeaders)) {
30787
+ } else if (utils$1.isFormData(data) && utils$1.isFunction(data.getHeaders)) {
30682
30788
  headers.set(data.getHeaders());
30683
30789
 
30684
30790
  if (!headers.hasContentLength()) {
@@ -30689,14 +30795,14 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
30689
30795
  } catch (e) {
30690
30796
  }
30691
30797
  }
30692
- } else if (utils.isBlob(data)) {
30798
+ } else if (utils$1.isBlob(data)) {
30693
30799
  data.size && headers.setContentType(data.type || 'application/octet-stream');
30694
30800
  headers.setContentLength(data.size || 0);
30695
30801
  data = Stream$3.Readable.from(readBlob$1(data));
30696
- } else if (data && !utils.isStream(data)) {
30697
- if (Buffer.isBuffer(data)) ; else if (utils.isArrayBuffer(data)) {
30802
+ } else if (data && !utils$1.isStream(data)) {
30803
+ if (Buffer.isBuffer(data)) ; else if (utils$1.isArrayBuffer(data)) {
30698
30804
  data = Buffer.from(new Uint8Array(data));
30699
- } else if (utils.isString(data)) {
30805
+ } else if (utils$1.isString(data)) {
30700
30806
  data = Buffer.from(data, 'utf-8');
30701
30807
  } else {
30702
30808
  return reject(new AxiosError(
@@ -30718,9 +30824,9 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
30718
30824
  }
30719
30825
  }
30720
30826
 
30721
- const contentLength = utils.toFiniteNumber(headers.getContentLength());
30827
+ const contentLength = utils$1.toFiniteNumber(headers.getContentLength());
30722
30828
 
30723
- if (utils.isArray(maxRate)) {
30829
+ if (utils$1.isArray(maxRate)) {
30724
30830
  maxUploadRate = maxRate[0];
30725
30831
  maxDownloadRate = maxRate[1];
30726
30832
  } else {
@@ -30728,14 +30834,14 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
30728
30834
  }
30729
30835
 
30730
30836
  if (data && (onUploadProgress || maxUploadRate)) {
30731
- if (!utils.isStream(data)) {
30837
+ if (!utils$1.isStream(data)) {
30732
30838
  data = Stream$3.Readable.from(data, {objectMode: false});
30733
30839
  }
30734
30840
 
30735
30841
  data = Stream$3.pipeline([data, new AxiosTransformStream$1({
30736
30842
  length: contentLength,
30737
- maxRate: utils.toFiniteNumber(maxUploadRate)
30738
- })], utils.noop);
30843
+ maxRate: utils$1.toFiniteNumber(maxUploadRate)
30844
+ })], utils$1.noop);
30739
30845
 
30740
30846
  onUploadProgress && data.on('progress', progress => {
30741
30847
  onUploadProgress(Object.assign(progress, {
@@ -30794,7 +30900,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
30794
30900
  };
30795
30901
 
30796
30902
  // cacheable-lookup integration hotfix
30797
- !utils.isUndefined(lookup) && (options.lookup = lookup);
30903
+ !utils$1.isUndefined(lookup) && (options.lookup = lookup);
30798
30904
 
30799
30905
  if (config.socketPath) {
30800
30906
  options.socketPath = config.socketPath;
@@ -30842,8 +30948,8 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
30842
30948
 
30843
30949
  if (onDownloadProgress) {
30844
30950
  const transformStream = new AxiosTransformStream$1({
30845
- length: utils.toFiniteNumber(responseLength),
30846
- maxRate: utils.toFiniteNumber(maxDownloadRate)
30951
+ length: utils$1.toFiniteNumber(responseLength),
30952
+ maxRate: utils$1.toFiniteNumber(maxDownloadRate)
30847
30953
  });
30848
30954
 
30849
30955
  onDownloadProgress && transformStream.on('progress', progress => {
@@ -30898,7 +31004,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
30898
31004
  }
30899
31005
  }
30900
31006
 
30901
- responseStream = streams.length > 1 ? Stream$3.pipeline(streams, utils.noop) : streams[0];
31007
+ responseStream = streams.length > 1 ? Stream$3.pipeline(streams, utils$1.noop) : streams[0];
30902
31008
 
30903
31009
  const offListeners = Stream$3.finished(responseStream, () => {
30904
31010
  offListeners();
@@ -30960,12 +31066,12 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
30960
31066
  if (responseType !== 'arraybuffer') {
30961
31067
  responseData = responseData.toString(responseEncoding);
30962
31068
  if (!responseEncoding || responseEncoding === 'utf8') {
30963
- responseData = utils.stripBOM(responseData);
31069
+ responseData = utils$1.stripBOM(responseData);
30964
31070
  }
30965
31071
  }
30966
31072
  response.data = responseData;
30967
31073
  } catch (err) {
30968
- reject(AxiosError.from(err, null, config, response.request, response));
31074
+ return reject(AxiosError.from(err, null, config, response.request, response));
30969
31075
  }
30970
31076
  settle(resolve, reject, response);
30971
31077
  });
@@ -31037,7 +31143,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
31037
31143
 
31038
31144
 
31039
31145
  // Send the request
31040
- if (utils.isStream(data)) {
31146
+ if (utils$1.isStream(data)) {
31041
31147
  let ended = false;
31042
31148
  let errored = false;
31043
31149
 
@@ -31063,55 +31169,46 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
31063
31169
  });
31064
31170
  };
31065
31171
 
31066
- var cookies = platform$1.isStandardBrowserEnv ?
31172
+ var cookies = platform$1.hasStandardBrowserEnv ?
31067
31173
 
31068
- // Standard browser envs support document.cookie
31069
- (function standardBrowserEnv() {
31070
- return {
31071
- write: function write(name, value, expires, path, domain, secure) {
31072
- const cookie = [];
31073
- cookie.push(name + '=' + encodeURIComponent(value));
31174
+ // Standard browser envs support document.cookie
31175
+ {
31176
+ write(name, value, expires, path, domain, secure) {
31177
+ const cookie = [name + '=' + encodeURIComponent(value)];
31074
31178
 
31075
- if (utils.isNumber(expires)) {
31076
- cookie.push('expires=' + new Date(expires).toGMTString());
31077
- }
31179
+ utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
31078
31180
 
31079
- if (utils.isString(path)) {
31080
- cookie.push('path=' + path);
31081
- }
31181
+ utils$1.isString(path) && cookie.push('path=' + path);
31082
31182
 
31083
- if (utils.isString(domain)) {
31084
- cookie.push('domain=' + domain);
31085
- }
31183
+ utils$1.isString(domain) && cookie.push('domain=' + domain);
31086
31184
 
31087
- if (secure === true) {
31088
- cookie.push('secure');
31089
- }
31185
+ secure === true && cookie.push('secure');
31090
31186
 
31091
- document.cookie = cookie.join('; ');
31092
- },
31187
+ document.cookie = cookie.join('; ');
31188
+ },
31093
31189
 
31094
- read: function read(name) {
31095
- const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
31096
- return (match ? decodeURIComponent(match[3]) : null);
31097
- },
31190
+ read(name) {
31191
+ const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
31192
+ return (match ? decodeURIComponent(match[3]) : null);
31193
+ },
31098
31194
 
31099
- remove: function remove(name) {
31100
- this.write(name, '', Date.now() - 86400000);
31101
- }
31102
- };
31103
- })() :
31195
+ remove(name) {
31196
+ this.write(name, '', Date.now() - 86400000);
31197
+ }
31198
+ }
31104
31199
 
31105
- // Non standard browser env (web workers, react-native) lack needed support.
31106
- (function nonStandardBrowserEnv() {
31107
- return {
31108
- write: function write() {},
31109
- read: function read() { return null; },
31110
- remove: function remove() {}
31111
- };
31112
- })();
31200
+ :
31201
+
31202
+ // Non-standard browser env (web workers, react-native) lack needed support.
31203
+ {
31204
+ write() {},
31205
+ read() {
31206
+ return null;
31207
+ },
31208
+ remove() {}
31209
+ };
31113
31210
 
31114
- var isURLSameOrigin = platform$1.isStandardBrowserEnv ?
31211
+ var isURLSameOrigin = platform$1.hasStandardBrowserEnv ?
31115
31212
 
31116
31213
  // Standard browser envs have full support of the APIs needed to test
31117
31214
  // whether the request URL is of the same origin as current location.
@@ -31121,7 +31218,7 @@ var isURLSameOrigin = platform$1.isStandardBrowserEnv ?
31121
31218
  let originURL;
31122
31219
 
31123
31220
  /**
31124
- * Parse a URL to discover it's components
31221
+ * Parse a URL to discover its components
31125
31222
  *
31126
31223
  * @param {String} url The URL to be parsed
31127
31224
  * @returns {Object}
@@ -31161,7 +31258,7 @@ var isURLSameOrigin = platform$1.isStandardBrowserEnv ?
31161
31258
  * @returns {boolean} True if URL shares the same origin, otherwise false
31162
31259
  */
31163
31260
  return function isURLSameOrigin(requestURL) {
31164
- const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
31261
+ const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
31165
31262
  return (parsed.protocol === originURL.protocol &&
31166
31263
  parsed.host === originURL.host);
31167
31264
  };
@@ -31209,7 +31306,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
31209
31306
  return new Promise(function dispatchXhrRequest(resolve, reject) {
31210
31307
  let requestData = config.data;
31211
31308
  const requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
31212
- const responseType = config.responseType;
31309
+ let {responseType, withXSRFToken} = config;
31213
31310
  let onCanceled;
31214
31311
  function done() {
31215
31312
  if (config.cancelToken) {
@@ -31223,14 +31320,13 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
31223
31320
 
31224
31321
  let contentType;
31225
31322
 
31226
- if (utils.isFormData(requestData)) {
31227
- if (platform$1.isStandardBrowserEnv || platform$1.isStandardBrowserWebWorkerEnv) {
31323
+ if (utils$1.isFormData(requestData)) {
31324
+ if (platform$1.hasStandardBrowserEnv || platform$1.hasStandardBrowserWebWorkerEnv) {
31228
31325
  requestHeaders.setContentType(false); // Let the browser set it
31229
- } else if(!requestHeaders.getContentType(/^\s*multipart\/form-data/)){
31230
- requestHeaders.setContentType('multipart/form-data'); // mobile/desktop app frameworks
31231
- } else if(utils.isString(contentType = requestHeaders.getContentType())){
31326
+ } else if ((contentType = requestHeaders.getContentType()) !== false) {
31232
31327
  // fix semicolon duplication issue for ReactNative FormData implementation
31233
- requestHeaders.setContentType(contentType.replace(/^\s*(multipart\/form-data);+/, '$1'));
31328
+ const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
31329
+ requestHeaders.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
31234
31330
  }
31235
31331
  }
31236
31332
 
@@ -31346,13 +31442,16 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
31346
31442
  // Add xsrf header
31347
31443
  // This is only done if running in a standard browser environment.
31348
31444
  // Specifically not if we're in a web worker, or react-native.
31349
- if (platform$1.isStandardBrowserEnv) {
31350
- // Add xsrf header
31351
- const xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath))
31352
- && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
31445
+ if(platform$1.hasStandardBrowserEnv) {
31446
+ withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
31353
31447
 
31354
- if (xsrfValue) {
31355
- requestHeaders.set(config.xsrfHeaderName, xsrfValue);
31448
+ if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {
31449
+ // Add xsrf header
31450
+ const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
31451
+
31452
+ if (xsrfValue) {
31453
+ requestHeaders.set(config.xsrfHeaderName, xsrfValue);
31454
+ }
31356
31455
  }
31357
31456
  }
31358
31457
 
@@ -31361,13 +31460,13 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
31361
31460
 
31362
31461
  // Add headers to the request
31363
31462
  if ('setRequestHeader' in request) {
31364
- utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
31463
+ utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
31365
31464
  request.setRequestHeader(key, val);
31366
31465
  });
31367
31466
  }
31368
31467
 
31369
31468
  // Add withCredentials to request if needed
31370
- if (!utils.isUndefined(config.withCredentials)) {
31469
+ if (!utils$1.isUndefined(config.withCredentials)) {
31371
31470
  request.withCredentials = !!config.withCredentials;
31372
31471
  }
31373
31472
 
@@ -31422,7 +31521,7 @@ const knownAdapters = {
31422
31521
  xhr: xhrAdapter
31423
31522
  };
31424
31523
 
31425
- utils.forEach(knownAdapters, (fn, value) => {
31524
+ utils$1.forEach(knownAdapters, (fn, value) => {
31426
31525
  if (fn) {
31427
31526
  try {
31428
31527
  Object.defineProperty(fn, 'name', {value});
@@ -31435,11 +31534,11 @@ utils.forEach(knownAdapters, (fn, value) => {
31435
31534
 
31436
31535
  const renderReason = (reason) => `- ${reason}`;
31437
31536
 
31438
- const isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;
31537
+ const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
31439
31538
 
31440
31539
  var adapters = {
31441
31540
  getAdapter: (adapters) => {
31442
- adapters = utils.isArray(adapters) ? adapters : [adapters];
31541
+ adapters = utils$1.isArray(adapters) ? adapters : [adapters];
31443
31542
 
31444
31543
  const {length} = adapters;
31445
31544
  let nameOrAdapter;
@@ -31580,11 +31679,11 @@ function mergeConfig(config1, config2) {
31580
31679
  const config = {};
31581
31680
 
31582
31681
  function getMergedValue(target, source, caseless) {
31583
- if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
31584
- return utils.merge.call({caseless}, target, source);
31585
- } else if (utils.isPlainObject(source)) {
31586
- return utils.merge({}, source);
31587
- } else if (utils.isArray(source)) {
31682
+ if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
31683
+ return utils$1.merge.call({caseless}, target, source);
31684
+ } else if (utils$1.isPlainObject(source)) {
31685
+ return utils$1.merge({}, source);
31686
+ } else if (utils$1.isArray(source)) {
31588
31687
  return source.slice();
31589
31688
  }
31590
31689
  return source;
@@ -31592,25 +31691,25 @@ function mergeConfig(config1, config2) {
31592
31691
 
31593
31692
  // eslint-disable-next-line consistent-return
31594
31693
  function mergeDeepProperties(a, b, caseless) {
31595
- if (!utils.isUndefined(b)) {
31694
+ if (!utils$1.isUndefined(b)) {
31596
31695
  return getMergedValue(a, b, caseless);
31597
- } else if (!utils.isUndefined(a)) {
31696
+ } else if (!utils$1.isUndefined(a)) {
31598
31697
  return getMergedValue(undefined, a, caseless);
31599
31698
  }
31600
31699
  }
31601
31700
 
31602
31701
  // eslint-disable-next-line consistent-return
31603
31702
  function valueFromConfig2(a, b) {
31604
- if (!utils.isUndefined(b)) {
31703
+ if (!utils$1.isUndefined(b)) {
31605
31704
  return getMergedValue(undefined, b);
31606
31705
  }
31607
31706
  }
31608
31707
 
31609
31708
  // eslint-disable-next-line consistent-return
31610
31709
  function defaultToConfig2(a, b) {
31611
- if (!utils.isUndefined(b)) {
31710
+ if (!utils$1.isUndefined(b)) {
31612
31711
  return getMergedValue(undefined, b);
31613
- } else if (!utils.isUndefined(a)) {
31712
+ } else if (!utils$1.isUndefined(a)) {
31614
31713
  return getMergedValue(undefined, a);
31615
31714
  }
31616
31715
  }
@@ -31635,6 +31734,7 @@ function mergeConfig(config1, config2) {
31635
31734
  timeout: defaultToConfig2,
31636
31735
  timeoutMessage: defaultToConfig2,
31637
31736
  withCredentials: defaultToConfig2,
31737
+ withXSRFToken: defaultToConfig2,
31638
31738
  adapter: defaultToConfig2,
31639
31739
  responseType: defaultToConfig2,
31640
31740
  xsrfCookieName: defaultToConfig2,
@@ -31655,10 +31755,10 @@ function mergeConfig(config1, config2) {
31655
31755
  headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
31656
31756
  };
31657
31757
 
31658
- utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
31758
+ utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
31659
31759
  const merge = mergeMap[prop] || mergeDeepProperties;
31660
31760
  const configValue = merge(config1[prop], config2[prop], prop);
31661
- (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
31761
+ (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
31662
31762
  });
31663
31763
 
31664
31764
  return config;
@@ -31800,7 +31900,7 @@ class Axios {
31800
31900
  }
31801
31901
 
31802
31902
  if (paramsSerializer != null) {
31803
- if (utils.isFunction(paramsSerializer)) {
31903
+ if (utils$1.isFunction(paramsSerializer)) {
31804
31904
  config.paramsSerializer = {
31805
31905
  serialize: paramsSerializer
31806
31906
  };
@@ -31816,12 +31916,12 @@ class Axios {
31816
31916
  config.method = (config.method || this.defaults.method || 'get').toLowerCase();
31817
31917
 
31818
31918
  // Flatten headers
31819
- let contextHeaders = headers && utils.merge(
31919
+ let contextHeaders = headers && utils$1.merge(
31820
31920
  headers.common,
31821
31921
  headers[config.method]
31822
31922
  );
31823
31923
 
31824
- headers && utils.forEach(
31924
+ headers && utils$1.forEach(
31825
31925
  ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
31826
31926
  (method) => {
31827
31927
  delete headers[method];
@@ -31908,7 +32008,7 @@ class Axios {
31908
32008
  }
31909
32009
 
31910
32010
  // Provide aliases for supported request methods
31911
- utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
32011
+ utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
31912
32012
  /*eslint func-names:0*/
31913
32013
  Axios.prototype[method] = function(url, config) {
31914
32014
  return this.request(mergeConfig(config || {}, {
@@ -31919,7 +32019,7 @@ utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData
31919
32019
  };
31920
32020
  });
31921
32021
 
31922
- utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
32022
+ utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
31923
32023
  /*eslint func-names:0*/
31924
32024
 
31925
32025
  function generateHTTPMethod(isForm) {
@@ -32095,7 +32195,7 @@ function spread(callback) {
32095
32195
  * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
32096
32196
  */
32097
32197
  function isAxiosError(payload) {
32098
- return utils.isObject(payload) && (payload.isAxiosError === true);
32198
+ return utils$1.isObject(payload) && (payload.isAxiosError === true);
32099
32199
  }
32100
32200
 
32101
32201
  const HttpStatusCode = {
@@ -32182,10 +32282,10 @@ function createInstance(defaultConfig) {
32182
32282
  const instance = bind(Axios$1.prototype.request, context);
32183
32283
 
32184
32284
  // Copy axios.prototype to instance
32185
- utils.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
32285
+ utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
32186
32286
 
32187
32287
  // Copy context to instance
32188
- utils.extend(instance, context, null, {allOwnKeys: true});
32288
+ utils$1.extend(instance, context, null, {allOwnKeys: true});
32189
32289
 
32190
32290
  // Factory for creating new instances
32191
32291
  instance.create = function create(instanceConfig) {
@@ -32229,7 +32329,7 @@ axios.mergeConfig = mergeConfig;
32229
32329
 
32230
32330
  axios.AxiosHeaders = AxiosHeaders$1;
32231
32331
 
32232
- axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
32332
+ axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
32233
32333
 
32234
32334
  axios.getAdapter = adapters.getAdapter;
32235
32335