vue-laravel-crud 1.4.4 → 1.4.5

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.
@@ -1,13 +1,3 @@
1
- import http from 'http';
2
- import https from 'https';
3
- import url from 'url';
4
- import require$$0$1 from 'stream';
5
- import assert from 'assert';
6
- import tty from 'tty';
7
- import util from 'util';
8
- import os from 'os';
9
- import zlib from 'zlib';
10
-
11
1
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
12
2
 
13
3
  function getDefaultExportFromCjs (x) {
@@ -188,11 +178,11 @@ var captureMode = {
188
178
  passive: false
189
179
  };
190
180
 
191
- function on(el, event, fn) {
181
+ function on$1(el, event, fn) {
192
182
  el.addEventListener(event, fn, !IE11OrLess && captureMode);
193
183
  }
194
184
 
195
- function off(el, event, fn) {
185
+ function off$1(el, event, fn) {
196
186
  el.removeEventListener(event, fn, !IE11OrLess && captureMode);
197
187
  }
198
188
 
@@ -814,15 +804,15 @@ function calculateRealTime(animatingRect, fromRect, toRect, options) {
814
804
  }
815
805
 
816
806
  var plugins = [];
817
- var defaults$1 = {
807
+ var defaults$3 = {
818
808
  initializeByDefault: true
819
809
  };
820
810
  var PluginManager = {
821
811
  mount: function mount(plugin) {
822
812
  // Set default static properties
823
- for (var option in defaults$1) {
824
- if (defaults$1.hasOwnProperty(option) && !(option in plugin)) {
825
- plugin[option] = defaults$1[option];
813
+ for (var option in defaults$3) {
814
+ if (defaults$3.hasOwnProperty(option) && !(option in plugin)) {
815
+ plugin[option] = defaults$3[option];
826
816
  }
827
817
  }
828
818
 
@@ -1297,15 +1287,15 @@ function Sortable(el, options) {
1297
1287
 
1298
1288
 
1299
1289
  if (options.supportPointer) {
1300
- on(el, 'pointerdown', this._onTapStart);
1290
+ on$1(el, 'pointerdown', this._onTapStart);
1301
1291
  } else {
1302
- on(el, 'mousedown', this._onTapStart);
1303
- on(el, 'touchstart', this._onTapStart);
1292
+ on$1(el, 'mousedown', this._onTapStart);
1293
+ on$1(el, 'touchstart', this._onTapStart);
1304
1294
  }
1305
1295
 
1306
1296
  if (this.nativeDraggable) {
1307
- on(el, 'dragover', this);
1308
- on(el, 'dragenter', this);
1297
+ on$1(el, 'dragover', this);
1298
+ on$1(el, 'dragenter', this);
1309
1299
  }
1310
1300
 
1311
1301
  sortables.push(this.el); // Restore sorting
@@ -1494,12 +1484,12 @@ Sortable.prototype =
1494
1484
  options.ignore.split(',').forEach(function (criteria) {
1495
1485
  find(dragEl, criteria.trim(), _disableDraggable);
1496
1486
  });
1497
- on(ownerDocument, 'dragover', nearestEmptyInsertDetectEvent);
1498
- on(ownerDocument, 'mousemove', nearestEmptyInsertDetectEvent);
1499
- on(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent);
1500
- on(ownerDocument, 'mouseup', _this._onDrop);
1501
- on(ownerDocument, 'touchend', _this._onDrop);
1502
- on(ownerDocument, 'touchcancel', _this._onDrop); // Make dragEl draggable (must be before delay for FireFox)
1487
+ on$1(ownerDocument, 'dragover', nearestEmptyInsertDetectEvent);
1488
+ on$1(ownerDocument, 'mousemove', nearestEmptyInsertDetectEvent);
1489
+ on$1(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent);
1490
+ on$1(ownerDocument, 'mouseup', _this._onDrop);
1491
+ on$1(ownerDocument, 'touchend', _this._onDrop);
1492
+ on$1(ownerDocument, 'touchcancel', _this._onDrop); // Make dragEl draggable (must be before delay for FireFox)
1503
1493
 
1504
1494
  if (FireFox && this.nativeDraggable) {
1505
1495
  this.options.touchStartThreshold = 4;
@@ -1520,12 +1510,12 @@ Sortable.prototype =
1520
1510
  // disable the delayed drag
1521
1511
 
1522
1512
 
1523
- on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
1524
- on(ownerDocument, 'touchend', _this._disableDelayedDrag);
1525
- on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
1526
- on(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler);
1527
- on(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler);
1528
- options.supportPointer && on(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler);
1513
+ on$1(ownerDocument, 'mouseup', _this._disableDelayedDrag);
1514
+ on$1(ownerDocument, 'touchend', _this._disableDelayedDrag);
1515
+ on$1(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
1516
+ on$1(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler);
1517
+ on$1(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler);
1518
+ options.supportPointer && on$1(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler);
1529
1519
  _this._dragStartTimer = setTimeout(dragStartFn, options.delay);
1530
1520
  } else {
1531
1521
  dragStartFn();
@@ -1549,12 +1539,12 @@ Sortable.prototype =
1549
1539
  },
1550
1540
  _disableDelayedDragEvents: function _disableDelayedDragEvents() {
1551
1541
  var ownerDocument = this.el.ownerDocument;
1552
- off(ownerDocument, 'mouseup', this._disableDelayedDrag);
1553
- off(ownerDocument, 'touchend', this._disableDelayedDrag);
1554
- off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
1555
- off(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler);
1556
- off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler);
1557
- off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler);
1542
+ off$1(ownerDocument, 'mouseup', this._disableDelayedDrag);
1543
+ off$1(ownerDocument, 'touchend', this._disableDelayedDrag);
1544
+ off$1(ownerDocument, 'touchcancel', this._disableDelayedDrag);
1545
+ off$1(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler);
1546
+ off$1(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler);
1547
+ off$1(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler);
1558
1548
  },
1559
1549
  _triggerDragStart: function _triggerDragStart(
1560
1550
  /** Event */
@@ -1565,15 +1555,15 @@ Sortable.prototype =
1565
1555
 
1566
1556
  if (!this.nativeDraggable || touch) {
1567
1557
  if (this.options.supportPointer) {
1568
- on(document, 'pointermove', this._onTouchMove);
1558
+ on$1(document, 'pointermove', this._onTouchMove);
1569
1559
  } else if (touch) {
1570
- on(document, 'touchmove', this._onTouchMove);
1560
+ on$1(document, 'touchmove', this._onTouchMove);
1571
1561
  } else {
1572
- on(document, 'mousemove', this._onTouchMove);
1562
+ on$1(document, 'mousemove', this._onTouchMove);
1573
1563
  }
1574
1564
  } else {
1575
- on(dragEl, 'dragend', this);
1576
- on(rootEl, 'dragstart', this._onDragStart);
1565
+ on$1(dragEl, 'dragend', this);
1566
+ on$1(rootEl, 'dragstart', this._onDragStart);
1577
1567
  }
1578
1568
 
1579
1569
  try {
@@ -1597,7 +1587,7 @@ Sortable.prototype =
1597
1587
  });
1598
1588
 
1599
1589
  if (this.nativeDraggable) {
1600
- on(document, 'dragover', _checkOutsideTargetEl);
1590
+ on$1(document, 'dragover', _checkOutsideTargetEl);
1601
1591
  }
1602
1592
 
1603
1593
  var options = this.options; // Apply effect
@@ -1814,23 +1804,23 @@ Sortable.prototype =
1814
1804
  _this._loopId = setInterval(_this._emulateDragOver, 50);
1815
1805
  } else {
1816
1806
  // Undo what was set in _prepareDragStart before drag started
1817
- off(document, 'mouseup', _this._onDrop);
1818
- off(document, 'touchend', _this._onDrop);
1819
- off(document, 'touchcancel', _this._onDrop);
1807
+ off$1(document, 'mouseup', _this._onDrop);
1808
+ off$1(document, 'touchend', _this._onDrop);
1809
+ off$1(document, 'touchcancel', _this._onDrop);
1820
1810
 
1821
1811
  if (dataTransfer) {
1822
1812
  dataTransfer.effectAllowed = 'move';
1823
1813
  options.setData && options.setData.call(_this, dataTransfer, dragEl);
1824
1814
  }
1825
1815
 
1826
- on(document, 'drop', _this); // #1276 fix:
1816
+ on$1(document, 'drop', _this); // #1276 fix:
1827
1817
 
1828
1818
  css(dragEl, 'transform', 'translateZ(0)');
1829
1819
  }
1830
1820
 
1831
1821
  awaitingDragStarted = true;
1832
1822
  _this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt));
1833
- on(document, 'selectstart', _this);
1823
+ on$1(document, 'selectstart', _this);
1834
1824
  moved = true;
1835
1825
 
1836
1826
  if (Safari) {
@@ -2111,20 +2101,20 @@ Sortable.prototype =
2111
2101
  },
2112
2102
  _ignoreWhileAnimating: null,
2113
2103
  _offMoveEvents: function _offMoveEvents() {
2114
- off(document, 'mousemove', this._onTouchMove);
2115
- off(document, 'touchmove', this._onTouchMove);
2116
- off(document, 'pointermove', this._onTouchMove);
2117
- off(document, 'dragover', nearestEmptyInsertDetectEvent);
2118
- off(document, 'mousemove', nearestEmptyInsertDetectEvent);
2119
- off(document, 'touchmove', nearestEmptyInsertDetectEvent);
2104
+ off$1(document, 'mousemove', this._onTouchMove);
2105
+ off$1(document, 'touchmove', this._onTouchMove);
2106
+ off$1(document, 'pointermove', this._onTouchMove);
2107
+ off$1(document, 'dragover', nearestEmptyInsertDetectEvent);
2108
+ off$1(document, 'mousemove', nearestEmptyInsertDetectEvent);
2109
+ off$1(document, 'touchmove', nearestEmptyInsertDetectEvent);
2120
2110
  },
2121
2111
  _offUpEvents: function _offUpEvents() {
2122
2112
  var ownerDocument = this.el.ownerDocument;
2123
- off(ownerDocument, 'mouseup', this._onDrop);
2124
- off(ownerDocument, 'touchend', this._onDrop);
2125
- off(ownerDocument, 'pointerup', this._onDrop);
2126
- off(ownerDocument, 'touchcancel', this._onDrop);
2127
- off(document, 'selectstart', this);
2113
+ off$1(ownerDocument, 'mouseup', this._onDrop);
2114
+ off$1(ownerDocument, 'touchend', this._onDrop);
2115
+ off$1(ownerDocument, 'pointerup', this._onDrop);
2116
+ off$1(ownerDocument, 'touchcancel', this._onDrop);
2117
+ off$1(document, 'selectstart', this);
2128
2118
  },
2129
2119
  _onDrop: function _onDrop(
2130
2120
  /**Event*/
@@ -2160,8 +2150,8 @@ Sortable.prototype =
2160
2150
 
2161
2151
 
2162
2152
  if (this.nativeDraggable) {
2163
- off(document, 'drop', this);
2164
- off(el, 'dragstart', this._onDragStart);
2153
+ off$1(document, 'drop', this);
2154
+ off$1(el, 'dragstart', this._onDragStart);
2165
2155
  }
2166
2156
 
2167
2157
  this._offMoveEvents();
@@ -2189,7 +2179,7 @@ Sortable.prototype =
2189
2179
 
2190
2180
  if (dragEl) {
2191
2181
  if (this.nativeDraggable) {
2192
- off(dragEl, 'dragend', this);
2182
+ off$1(dragEl, 'dragend', this);
2193
2183
  }
2194
2184
 
2195
2185
  _disableDraggable(dragEl);
@@ -2422,13 +2412,13 @@ Sortable.prototype =
2422
2412
  pluginEvent('destroy', this);
2423
2413
  var el = this.el;
2424
2414
  el[expando] = null;
2425
- off(el, 'mousedown', this._onTapStart);
2426
- off(el, 'touchstart', this._onTapStart);
2427
- off(el, 'pointerdown', this._onTapStart);
2415
+ off$1(el, 'mousedown', this._onTapStart);
2416
+ off$1(el, 'touchstart', this._onTapStart);
2417
+ off$1(el, 'pointerdown', this._onTapStart);
2428
2418
 
2429
2419
  if (this.nativeDraggable) {
2430
- off(el, 'dragover', this);
2431
- off(el, 'dragenter', this);
2420
+ off$1(el, 'dragover', this);
2421
+ off$1(el, 'dragenter', this);
2432
2422
  } // Remove draggable attributes
2433
2423
 
2434
2424
 
@@ -2643,7 +2633,7 @@ function _cancelNextTick(id) {
2643
2633
 
2644
2634
 
2645
2635
  if (documentExists) {
2646
- on(document, 'touchmove', function (evt) {
2636
+ on$1(document, 'touchmove', function (evt) {
2647
2637
  if ((Sortable.active || awaitingDragStarted) && evt.cancelable) {
2648
2638
  evt.preventDefault();
2649
2639
  }
@@ -2652,8 +2642,8 @@ if (documentExists) {
2652
2642
 
2653
2643
 
2654
2644
  Sortable.utils = {
2655
- on: on,
2656
- off: off,
2645
+ on: on$1,
2646
+ off: off$1,
2657
2647
  css: css,
2658
2648
  find: find,
2659
2649
  is: function is(el, selector) {
@@ -2744,14 +2734,14 @@ function AutoScrollPlugin() {
2744
2734
  var originalEvent = _ref.originalEvent;
2745
2735
 
2746
2736
  if (this.sortable.nativeDraggable) {
2747
- on(document, 'dragover', this._handleAutoScroll);
2737
+ on$1(document, 'dragover', this._handleAutoScroll);
2748
2738
  } else {
2749
2739
  if (this.options.supportPointer) {
2750
- on(document, 'pointermove', this._handleFallbackAutoScroll);
2740
+ on$1(document, 'pointermove', this._handleFallbackAutoScroll);
2751
2741
  } else if (originalEvent.touches) {
2752
- on(document, 'touchmove', this._handleFallbackAutoScroll);
2742
+ on$1(document, 'touchmove', this._handleFallbackAutoScroll);
2753
2743
  } else {
2754
- on(document, 'mousemove', this._handleFallbackAutoScroll);
2744
+ on$1(document, 'mousemove', this._handleFallbackAutoScroll);
2755
2745
  }
2756
2746
  }
2757
2747
  },
@@ -2765,11 +2755,11 @@ function AutoScrollPlugin() {
2765
2755
  },
2766
2756
  drop: function drop() {
2767
2757
  if (this.sortable.nativeDraggable) {
2768
- off(document, 'dragover', this._handleAutoScroll);
2758
+ off$1(document, 'dragover', this._handleAutoScroll);
2769
2759
  } else {
2770
- off(document, 'pointermove', this._handleFallbackAutoScroll);
2771
- off(document, 'touchmove', this._handleFallbackAutoScroll);
2772
- off(document, 'mousemove', this._handleFallbackAutoScroll);
2760
+ off$1(document, 'pointermove', this._handleFallbackAutoScroll);
2761
+ off$1(document, 'touchmove', this._handleFallbackAutoScroll);
2762
+ off$1(document, 'mousemove', this._handleFallbackAutoScroll);
2773
2763
  }
2774
2764
 
2775
2765
  clearPointerElemChangedInterval();
@@ -3140,14 +3130,14 @@ function MultiDragPlugin() {
3140
3130
  }
3141
3131
 
3142
3132
  if (sortable.options.supportPointer) {
3143
- on(document, 'pointerup', this._deselectMultiDrag);
3133
+ on$1(document, 'pointerup', this._deselectMultiDrag);
3144
3134
  } else {
3145
- on(document, 'mouseup', this._deselectMultiDrag);
3146
- on(document, 'touchend', this._deselectMultiDrag);
3135
+ on$1(document, 'mouseup', this._deselectMultiDrag);
3136
+ on$1(document, 'touchend', this._deselectMultiDrag);
3147
3137
  }
3148
3138
 
3149
- on(document, 'keydown', this._checkKeyDown);
3150
- on(document, 'keyup', this._checkKeyUp);
3139
+ on$1(document, 'keydown', this._checkKeyDown);
3140
+ on$1(document, 'keyup', this._checkKeyUp);
3151
3141
  this.defaults = {
3152
3142
  selectedClass: 'sortable-selected',
3153
3143
  multiDragKey: null,
@@ -3573,11 +3563,11 @@ function MultiDragPlugin() {
3573
3563
  destroyGlobal: function destroyGlobal() {
3574
3564
  this._deselectMultiDrag();
3575
3565
 
3576
- off(document, 'pointerup', this._deselectMultiDrag);
3577
- off(document, 'mouseup', this._deselectMultiDrag);
3578
- off(document, 'touchend', this._deselectMultiDrag);
3579
- off(document, 'keydown', this._checkKeyDown);
3580
- off(document, 'keyup', this._checkKeyUp);
3566
+ off$1(document, 'pointerup', this._deselectMultiDrag);
3567
+ off$1(document, 'mouseup', this._deselectMultiDrag);
3568
+ off$1(document, 'touchend', this._deselectMultiDrag);
3569
+ off$1(document, 'keydown', this._checkKeyDown);
3570
+ off$1(document, 'keyup', this._checkKeyUp);
3581
3571
  },
3582
3572
  _deselectMultiDrag: function _deselectMultiDrag(evt) {
3583
3573
  if (typeof dragStarted !== "undefined" && dragStarted) return; // Only deselect if selection is in this sortable
@@ -6209,7 +6199,7 @@ function isUndefined(val) {
6209
6199
  * @param {Object} val The value to test
6210
6200
  * @returns {boolean} True if value is a Buffer, otherwise false
6211
6201
  */
6212
- function isBuffer$1(val) {
6202
+ function isBuffer(val) {
6213
6203
  return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
6214
6204
  && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
6215
6205
  }
@@ -6256,7 +6246,7 @@ function isArrayBufferView(val) {
6256
6246
  * @param {Object} val The value to test
6257
6247
  * @returns {boolean} True if value is a String, otherwise false
6258
6248
  */
6259
- function isString$1(val) {
6249
+ function isString(val) {
6260
6250
  return typeof val === 'string';
6261
6251
  }
6262
6252
 
@@ -6331,7 +6321,7 @@ function isBlob(val) {
6331
6321
  * @param {Object} val The value to test
6332
6322
  * @returns {boolean} True if value is a Function, otherwise false
6333
6323
  */
6334
- function isFunction$1(val) {
6324
+ function isFunction(val) {
6335
6325
  return toString.call(val) === '[object Function]';
6336
6326
  }
6337
6327
 
@@ -6342,7 +6332,7 @@ function isFunction$1(val) {
6342
6332
  * @returns {boolean} True if value is a Stream, otherwise false
6343
6333
  */
6344
6334
  function isStream(val) {
6345
- return isObject(val) && isFunction$1(val.pipe);
6335
+ return isObject(val) && isFunction(val.pipe);
6346
6336
  }
6347
6337
 
6348
6338
  /**
@@ -6500,13 +6490,13 @@ function stripBOM(content) {
6500
6490
  return content;
6501
6491
  }
6502
6492
 
6503
- var utils = {
6493
+ var utils$1 = {
6504
6494
  isArray: isArray,
6505
6495
  isArrayBuffer: isArrayBuffer,
6506
- isBuffer: isBuffer$1,
6496
+ isBuffer: isBuffer,
6507
6497
  isFormData: isFormData,
6508
6498
  isArrayBufferView: isArrayBufferView,
6509
- isString: isString$1,
6499
+ isString: isString,
6510
6500
  isNumber: isNumber,
6511
6501
  isObject: isObject,
6512
6502
  isPlainObject: isPlainObject,
@@ -6514,7 +6504,7 @@ var utils = {
6514
6504
  isDate: isDate,
6515
6505
  isFile: isFile,
6516
6506
  isBlob: isBlob,
6517
- isFunction: isFunction$1,
6507
+ isFunction: isFunction,
6518
6508
  isStream: isStream,
6519
6509
  isURLSearchParams: isURLSearchParams,
6520
6510
  isStandardBrowserEnv: isStandardBrowserEnv,
@@ -6551,26 +6541,26 @@ var buildURL = function buildURL(url, params, paramsSerializer) {
6551
6541
  var serializedParams;
6552
6542
  if (paramsSerializer) {
6553
6543
  serializedParams = paramsSerializer(params);
6554
- } else if (utils.isURLSearchParams(params)) {
6544
+ } else if (utils$1.isURLSearchParams(params)) {
6555
6545
  serializedParams = params.toString();
6556
6546
  } else {
6557
6547
  var parts = [];
6558
6548
 
6559
- utils.forEach(params, function serialize(val, key) {
6549
+ utils$1.forEach(params, function serialize(val, key) {
6560
6550
  if (val === null || typeof val === 'undefined') {
6561
6551
  return;
6562
6552
  }
6563
6553
 
6564
- if (utils.isArray(val)) {
6554
+ if (utils$1.isArray(val)) {
6565
6555
  key = key + '[]';
6566
6556
  } else {
6567
6557
  val = [val];
6568
6558
  }
6569
6559
 
6570
- utils.forEach(val, function parseValue(v) {
6571
- if (utils.isDate(v)) {
6560
+ utils$1.forEach(val, function parseValue(v) {
6561
+ if (utils$1.isDate(v)) {
6572
6562
  v = v.toISOString();
6573
- } else if (utils.isObject(v)) {
6563
+ } else if (utils$1.isObject(v)) {
6574
6564
  v = JSON.stringify(v);
6575
6565
  }
6576
6566
  parts.push(encode(key) + '=' + encode(v));
@@ -6632,7 +6622,7 @@ InterceptorManager.prototype.eject = function eject(id) {
6632
6622
  * @param {Function} fn The function to call for each interceptor
6633
6623
  */
6634
6624
  InterceptorManager.prototype.forEach = function forEach(fn) {
6635
- utils.forEach(this.handlers, function forEachHandler(h) {
6625
+ utils$1.forEach(this.handlers, function forEachHandler(h) {
6636
6626
  if (h !== null) {
6637
6627
  fn(h);
6638
6628
  }
@@ -6651,7 +6641,7 @@ var InterceptorManager_1 = InterceptorManager;
6651
6641
  */
6652
6642
  var transformData = function transformData(data, headers, fns) {
6653
6643
  /*eslint no-param-reassign:0*/
6654
- utils.forEach(fns, function transform(fn) {
6644
+ utils$1.forEach(fns, function transform(fn) {
6655
6645
  data = fn(data, headers);
6656
6646
  });
6657
6647
 
@@ -6662,2534 +6652,349 @@ var isCancel = function isCancel(value) {
6662
6652
  return !!(value && value.__CANCEL__);
6663
6653
  };
6664
6654
 
6665
- var normalizeHeaderName = function normalizeHeaderName(headers, normalizedName) {
6666
- utils.forEach(headers, function processHeader(value, name) {
6667
- if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
6668
- headers[normalizedName] = value;
6669
- delete headers[name];
6670
- }
6671
- });
6672
- };
6673
-
6674
- /**
6675
- * Update an Error with the specified config, error code, and response.
6676
- *
6677
- * @param {Error} error The error to update.
6678
- * @param {Object} config The config.
6679
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
6680
- * @param {Object} [request] The request.
6681
- * @param {Object} [response] The response.
6682
- * @returns {Error} The error.
6683
- */
6684
- var enhanceError = function enhanceError(error, config, code, request, response) {
6685
- error.config = config;
6686
- if (code) {
6687
- error.code = code;
6688
- }
6689
-
6690
- error.request = request;
6691
- error.response = response;
6692
- error.isAxiosError = true;
6693
-
6694
- error.toJSON = function toJSON() {
6695
- return {
6696
- // Standard
6697
- message: this.message,
6698
- name: this.name,
6699
- // Microsoft
6700
- description: this.description,
6701
- number: this.number,
6702
- // Mozilla
6703
- fileName: this.fileName,
6704
- lineNumber: this.lineNumber,
6705
- columnNumber: this.columnNumber,
6706
- stack: this.stack,
6707
- // Axios
6708
- config: this.config,
6709
- code: this.code
6710
- };
6711
- };
6712
- return error;
6713
- };
6714
-
6715
- /**
6716
- * Create an Error with the specified message, config, error code, request and response.
6717
- *
6718
- * @param {string} message The error message.
6719
- * @param {Object} config The config.
6720
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
6721
- * @param {Object} [request] The request.
6722
- * @param {Object} [response] The response.
6723
- * @returns {Error} The created error.
6724
- */
6725
- var createError = function createError(message, config, code, request, response) {
6726
- var error = new Error(message);
6727
- return enhanceError(error, config, code, request, response);
6728
- };
6729
-
6730
- /**
6731
- * Resolve or reject a Promise based on response status.
6732
- *
6733
- * @param {Function} resolve A function that resolves the promise.
6734
- * @param {Function} reject A function that rejects the promise.
6735
- * @param {object} response The response.
6736
- */
6737
- var settle = function settle(resolve, reject, response) {
6738
- var validateStatus = response.config.validateStatus;
6739
- if (!response.status || !validateStatus || validateStatus(response.status)) {
6740
- resolve(response);
6741
- } else {
6742
- reject(createError(
6743
- 'Request failed with status code ' + response.status,
6744
- response.config,
6745
- null,
6746
- response.request,
6747
- response
6748
- ));
6749
- }
6750
- };
6751
-
6752
- var cookies = (
6753
- utils.isStandardBrowserEnv() ?
6754
-
6755
- // Standard browser envs support document.cookie
6756
- (function standardBrowserEnv() {
6757
- return {
6758
- write: function write(name, value, expires, path, domain, secure) {
6759
- var cookie = [];
6760
- cookie.push(name + '=' + encodeURIComponent(value));
6761
-
6762
- if (utils.isNumber(expires)) {
6763
- cookie.push('expires=' + new Date(expires).toGMTString());
6764
- }
6765
-
6766
- if (utils.isString(path)) {
6767
- cookie.push('path=' + path);
6768
- }
6769
-
6770
- if (utils.isString(domain)) {
6771
- cookie.push('domain=' + domain);
6772
- }
6773
-
6774
- if (secure === true) {
6775
- cookie.push('secure');
6776
- }
6777
-
6778
- document.cookie = cookie.join('; ');
6779
- },
6780
-
6781
- read: function read(name) {
6782
- var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
6783
- return (match ? decodeURIComponent(match[3]) : null);
6784
- },
6785
-
6786
- remove: function remove(name) {
6787
- this.write(name, '', Date.now() - 86400000);
6788
- }
6789
- };
6790
- })() :
6791
-
6792
- // Non standard browser env (web workers, react-native) lack needed support.
6793
- (function nonStandardBrowserEnv() {
6794
- return {
6795
- write: function write() {},
6796
- read: function read() { return null; },
6797
- remove: function remove() {}
6798
- };
6799
- })()
6800
- );
6801
-
6802
- /**
6803
- * Determines whether the specified URL is absolute
6804
- *
6805
- * @param {string} url The URL to test
6806
- * @returns {boolean} True if the specified URL is absolute, otherwise false
6807
- */
6808
- var isAbsoluteURL = function isAbsoluteURL(url) {
6809
- // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
6810
- // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
6811
- // by any combination of letters, digits, plus, period, or hyphen.
6812
- return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
6813
- };
6814
-
6815
- /**
6816
- * Creates a new URL by combining the specified URLs
6817
- *
6818
- * @param {string} baseURL The base URL
6819
- * @param {string} relativeURL The relative URL
6820
- * @returns {string} The combined URL
6821
- */
6822
- var combineURLs = function combineURLs(baseURL, relativeURL) {
6823
- return relativeURL
6824
- ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
6825
- : baseURL;
6826
- };
6827
-
6828
- /**
6829
- * Creates a new URL by combining the baseURL with the requestedURL,
6830
- * only when the requestedURL is not already an absolute URL.
6831
- * If the requestURL is absolute, this function returns the requestedURL untouched.
6832
- *
6833
- * @param {string} baseURL The base URL
6834
- * @param {string} requestedURL Absolute or relative URL to combine
6835
- * @returns {string} The combined full path
6836
- */
6837
- var buildFullPath = function buildFullPath(baseURL, requestedURL) {
6838
- if (baseURL && !isAbsoluteURL(requestedURL)) {
6839
- return combineURLs(baseURL, requestedURL);
6840
- }
6841
- return requestedURL;
6842
- };
6843
-
6844
- // Headers whose duplicates are ignored by node
6845
- // c.f. https://nodejs.org/api/http.html#http_message_headers
6846
- var ignoreDuplicateOf = [
6847
- 'age', 'authorization', 'content-length', 'content-type', 'etag',
6848
- 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
6849
- 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
6850
- 'referer', 'retry-after', 'user-agent'
6851
- ];
6852
-
6853
- /**
6854
- * Parse headers into an object
6855
- *
6856
- * ```
6857
- * Date: Wed, 27 Aug 2014 08:58:49 GMT
6858
- * Content-Type: application/json
6859
- * Connection: keep-alive
6860
- * Transfer-Encoding: chunked
6861
- * ```
6862
- *
6863
- * @param {String} headers Headers needing to be parsed
6864
- * @returns {Object} Headers parsed into an object
6865
- */
6866
- var parseHeaders = function parseHeaders(headers) {
6867
- var parsed = {};
6868
- var key;
6869
- var val;
6870
- var i;
6655
+ var global$1 = (typeof global !== "undefined" ? global :
6656
+ typeof self !== "undefined" ? self :
6657
+ typeof window !== "undefined" ? window : {});
6871
6658
 
6872
- if (!headers) { return parsed; }
6659
+ // shim for using process in browser
6660
+ // based off https://github.com/defunctzombie/node-process/blob/master/browser.js
6873
6661
 
6874
- utils.forEach(headers.split('\n'), function parser(line) {
6875
- i = line.indexOf(':');
6876
- key = utils.trim(line.substr(0, i)).toLowerCase();
6877
- val = utils.trim(line.substr(i + 1));
6662
+ function defaultSetTimout() {
6663
+ throw new Error('setTimeout has not been defined');
6664
+ }
6665
+ function defaultClearTimeout () {
6666
+ throw new Error('clearTimeout has not been defined');
6667
+ }
6668
+ var cachedSetTimeout = defaultSetTimout;
6669
+ var cachedClearTimeout = defaultClearTimeout;
6670
+ if (typeof global$1.setTimeout === 'function') {
6671
+ cachedSetTimeout = setTimeout;
6672
+ }
6673
+ if (typeof global$1.clearTimeout === 'function') {
6674
+ cachedClearTimeout = clearTimeout;
6675
+ }
6878
6676
 
6879
- if (key) {
6880
- if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
6881
- return;
6882
- }
6883
- if (key === 'set-cookie') {
6884
- parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
6885
- } else {
6886
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
6887
- }
6677
+ function runTimeout(fun) {
6678
+ if (cachedSetTimeout === setTimeout) {
6679
+ //normal enviroments in sane situations
6680
+ return setTimeout(fun, 0);
6888
6681
  }
6889
- });
6890
-
6891
- return parsed;
6892
- };
6893
-
6894
- var isURLSameOrigin = (
6895
- utils.isStandardBrowserEnv() ?
6896
-
6897
- // Standard browser envs have full support of the APIs needed to test
6898
- // whether the request URL is of the same origin as current location.
6899
- (function standardBrowserEnv() {
6900
- var msie = /(msie|trident)/i.test(navigator.userAgent);
6901
- var urlParsingNode = document.createElement('a');
6902
- var originURL;
6903
-
6904
- /**
6905
- * Parse a URL to discover it's components
6906
- *
6907
- * @param {String} url The URL to be parsed
6908
- * @returns {Object}
6909
- */
6910
- function resolveURL(url) {
6911
- var href = url;
6912
-
6913
- if (msie) {
6914
- // IE needs attribute set twice to normalize properties
6915
- urlParsingNode.setAttribute('href', href);
6916
- href = urlParsingNode.href;
6682
+ // if setTimeout wasn't available but was latter defined
6683
+ if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
6684
+ cachedSetTimeout = setTimeout;
6685
+ return setTimeout(fun, 0);
6686
+ }
6687
+ try {
6688
+ // when when somebody has screwed with setTimeout but no I.E. maddness
6689
+ return cachedSetTimeout(fun, 0);
6690
+ } catch(e){
6691
+ try {
6692
+ // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
6693
+ return cachedSetTimeout.call(null, fun, 0);
6694
+ } catch(e){
6695
+ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
6696
+ return cachedSetTimeout.call(this, fun, 0);
6917
6697
  }
6918
-
6919
- urlParsingNode.setAttribute('href', href);
6920
-
6921
- // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
6922
- return {
6923
- href: urlParsingNode.href,
6924
- protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
6925
- host: urlParsingNode.host,
6926
- search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
6927
- hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
6928
- hostname: urlParsingNode.hostname,
6929
- port: urlParsingNode.port,
6930
- pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
6931
- urlParsingNode.pathname :
6932
- '/' + urlParsingNode.pathname
6933
- };
6934
- }
6935
-
6936
- originURL = resolveURL(window.location.href);
6937
-
6938
- /**
6939
- * Determine if a URL shares the same origin as the current location
6940
- *
6941
- * @param {String} requestURL The URL to test
6942
- * @returns {boolean} True if URL shares the same origin, otherwise false
6943
- */
6944
- return function isURLSameOrigin(requestURL) {
6945
- var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
6946
- return (parsed.protocol === originURL.protocol &&
6947
- parsed.host === originURL.host);
6948
- };
6949
- })() :
6950
-
6951
- // Non standard browser envs (web workers, react-native) lack needed support.
6952
- (function nonStandardBrowserEnv() {
6953
- return function isURLSameOrigin() {
6954
- return true;
6955
- };
6956
- })()
6957
- );
6958
-
6959
- var xhr = function xhrAdapter(config) {
6960
- return new Promise(function dispatchXhrRequest(resolve, reject) {
6961
- var requestData = config.data;
6962
- var requestHeaders = config.headers;
6963
-
6964
- if (utils.isFormData(requestData)) {
6965
- delete requestHeaders['Content-Type']; // Let the browser set it
6966
6698
  }
6967
6699
 
6968
- var request = new XMLHttpRequest();
6969
6700
 
6970
- // HTTP basic authentication
6971
- if (config.auth) {
6972
- var username = config.auth.username || '';
6973
- var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
6974
- requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
6701
+ }
6702
+ function runClearTimeout(marker) {
6703
+ if (cachedClearTimeout === clearTimeout) {
6704
+ //normal enviroments in sane situations
6705
+ return clearTimeout(marker);
6706
+ }
6707
+ // if clearTimeout wasn't available but was latter defined
6708
+ if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
6709
+ cachedClearTimeout = clearTimeout;
6710
+ return clearTimeout(marker);
6711
+ }
6712
+ try {
6713
+ // when when somebody has screwed with setTimeout but no I.E. maddness
6714
+ return cachedClearTimeout(marker);
6715
+ } catch (e){
6716
+ try {
6717
+ // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
6718
+ return cachedClearTimeout.call(null, marker);
6719
+ } catch (e){
6720
+ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
6721
+ // Some versions of I.E. have different rules for clearTimeout vs setTimeout
6722
+ return cachedClearTimeout.call(this, marker);
6723
+ }
6975
6724
  }
6976
6725
 
6977
- var fullPath = buildFullPath(config.baseURL, config.url);
6978
- request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
6979
6726
 
6980
- // Set the request timeout in MS
6981
- request.timeout = config.timeout;
6982
6727
 
6983
- // Listen for ready state
6984
- request.onreadystatechange = function handleLoad() {
6985
- if (!request || request.readyState !== 4) {
6986
- return;
6987
- }
6728
+ }
6729
+ var queue = [];
6730
+ var draining = false;
6731
+ var currentQueue;
6732
+ var queueIndex = -1;
6988
6733
 
6989
- // The request errored out and we didn't get a response, this will be
6990
- // handled by onerror instead
6991
- // With one exception: request that using file: protocol, most browsers
6992
- // will return status as 0 even though it's a successful request
6993
- if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
6734
+ function cleanUpNextTick() {
6735
+ if (!draining || !currentQueue) {
6994
6736
  return;
6995
- }
6996
-
6997
- // Prepare the response
6998
- var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
6999
- var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
7000
- var response = {
7001
- data: responseData,
7002
- status: request.status,
7003
- statusText: request.statusText,
7004
- headers: responseHeaders,
7005
- config: config,
7006
- request: request
7007
- };
7008
-
7009
- settle(resolve, reject, response);
7010
-
7011
- // Clean up request
7012
- request = null;
7013
- };
6737
+ }
6738
+ draining = false;
6739
+ if (currentQueue.length) {
6740
+ queue = currentQueue.concat(queue);
6741
+ } else {
6742
+ queueIndex = -1;
6743
+ }
6744
+ if (queue.length) {
6745
+ drainQueue();
6746
+ }
6747
+ }
7014
6748
 
7015
- // Handle browser request cancellation (as opposed to a manual cancellation)
7016
- request.onabort = function handleAbort() {
7017
- if (!request) {
6749
+ function drainQueue() {
6750
+ if (draining) {
7018
6751
  return;
7019
- }
6752
+ }
6753
+ var timeout = runTimeout(cleanUpNextTick);
6754
+ draining = true;
7020
6755
 
7021
- reject(createError('Request aborted', config, 'ECONNABORTED', request));
6756
+ var len = queue.length;
6757
+ while(len) {
6758
+ currentQueue = queue;
6759
+ queue = [];
6760
+ while (++queueIndex < len) {
6761
+ if (currentQueue) {
6762
+ currentQueue[queueIndex].run();
6763
+ }
6764
+ }
6765
+ queueIndex = -1;
6766
+ len = queue.length;
6767
+ }
6768
+ currentQueue = null;
6769
+ draining = false;
6770
+ runClearTimeout(timeout);
6771
+ }
6772
+ function nextTick(fun) {
6773
+ var args = new Array(arguments.length - 1);
6774
+ if (arguments.length > 1) {
6775
+ for (var i = 1; i < arguments.length; i++) {
6776
+ args[i - 1] = arguments[i];
6777
+ }
6778
+ }
6779
+ queue.push(new Item(fun, args));
6780
+ if (queue.length === 1 && !draining) {
6781
+ runTimeout(drainQueue);
6782
+ }
6783
+ }
6784
+ // v8 likes predictible objects
6785
+ function Item(fun, array) {
6786
+ this.fun = fun;
6787
+ this.array = array;
6788
+ }
6789
+ Item.prototype.run = function () {
6790
+ this.fun.apply(null, this.array);
6791
+ };
6792
+ var title = 'browser';
6793
+ var platform = 'browser';
6794
+ var browser = true;
6795
+ var env = {};
6796
+ var argv = [];
6797
+ var version = ''; // empty string to avoid regexp issues
6798
+ var versions = {};
6799
+ var release = {};
6800
+ var config = {};
6801
+
6802
+ function noop() {}
6803
+
6804
+ var on = noop;
6805
+ var addListener = noop;
6806
+ var once = noop;
6807
+ var off = noop;
6808
+ var removeListener = noop;
6809
+ var removeAllListeners = noop;
6810
+ var emit = noop;
6811
+
6812
+ function binding(name) {
6813
+ throw new Error('process.binding is not supported');
6814
+ }
6815
+
6816
+ function cwd () { return '/' }
6817
+ function chdir (dir) {
6818
+ throw new Error('process.chdir is not supported');
6819
+ }function umask() { return 0; }
6820
+
6821
+ // from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js
6822
+ var performance = global$1.performance || {};
6823
+ var performanceNow =
6824
+ performance.now ||
6825
+ performance.mozNow ||
6826
+ performance.msNow ||
6827
+ performance.oNow ||
6828
+ performance.webkitNow ||
6829
+ function(){ return (new Date()).getTime() };
6830
+
6831
+ // generate timestamp or delta
6832
+ // see http://nodejs.org/api/process.html#process_process_hrtime
6833
+ function hrtime(previousTimestamp){
6834
+ var clocktime = performanceNow.call(performance)*1e-3;
6835
+ var seconds = Math.floor(clocktime);
6836
+ var nanoseconds = Math.floor((clocktime%1)*1e9);
6837
+ if (previousTimestamp) {
6838
+ seconds = seconds - previousTimestamp[0];
6839
+ nanoseconds = nanoseconds - previousTimestamp[1];
6840
+ if (nanoseconds<0) {
6841
+ seconds--;
6842
+ nanoseconds += 1e9;
6843
+ }
6844
+ }
6845
+ return [seconds,nanoseconds]
6846
+ }
6847
+
6848
+ var startTime = new Date();
6849
+ function uptime() {
6850
+ var currentTime = new Date();
6851
+ var dif = currentTime - startTime;
6852
+ return dif / 1000;
6853
+ }
6854
+
6855
+ var browser$1 = {
6856
+ nextTick: nextTick,
6857
+ title: title,
6858
+ browser: browser,
6859
+ env: env,
6860
+ argv: argv,
6861
+ version: version,
6862
+ versions: versions,
6863
+ on: on,
6864
+ addListener: addListener,
6865
+ once: once,
6866
+ off: off,
6867
+ removeListener: removeListener,
6868
+ removeAllListeners: removeAllListeners,
6869
+ emit: emit,
6870
+ binding: binding,
6871
+ cwd: cwd,
6872
+ chdir: chdir,
6873
+ umask: umask,
6874
+ hrtime: hrtime,
6875
+ platform: platform,
6876
+ release: release,
6877
+ config: config,
6878
+ uptime: uptime
6879
+ };
7022
6880
 
7023
- // Clean up request
7024
- request = null;
7025
- };
6881
+ var utils = require('./utils');
6882
+ var normalizeHeaderName = require('./helpers/normalizeHeaderName');
7026
6883
 
7027
- // Handle low level network errors
7028
- request.onerror = function handleError() {
7029
- // Real errors are hidden from us by the browser
7030
- // onerror should only fire if it's a network error
7031
- reject(createError('Network Error', config, null, request));
6884
+ var DEFAULT_CONTENT_TYPE = {
6885
+ 'Content-Type': 'application/x-www-form-urlencoded'
6886
+ };
7032
6887
 
7033
- // Clean up request
7034
- request = null;
7035
- };
6888
+ function setContentTypeIfUnset(headers, value) {
6889
+ if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
6890
+ headers['Content-Type'] = value;
6891
+ }
6892
+ }
7036
6893
 
7037
- // Handle timeout
7038
- request.ontimeout = function handleTimeout() {
7039
- var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
7040
- if (config.timeoutErrorMessage) {
7041
- timeoutErrorMessage = config.timeoutErrorMessage;
7042
- }
7043
- reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
7044
- request));
6894
+ function getDefaultAdapter() {
6895
+ var adapter;
6896
+ if (typeof XMLHttpRequest !== 'undefined') {
6897
+ // For browsers use XHR adapter
6898
+ adapter = require('./adapters/xhr');
6899
+ } else if (typeof browser$1 !== 'undefined' && Object.prototype.toString.call(browser$1) === '[object process]') {
6900
+ // For node use HTTP adapter
6901
+ adapter = require('./adapters/http');
6902
+ }
6903
+ return adapter;
6904
+ }
7045
6905
 
7046
- // Clean up request
7047
- request = null;
7048
- };
6906
+ var defaults$1 = {
6907
+ adapter: getDefaultAdapter(),
7049
6908
 
7050
- // Add xsrf header
7051
- // This is only done if running in a standard browser environment.
7052
- // Specifically not if we're in a web worker, or react-native.
7053
- if (utils.isStandardBrowserEnv()) {
7054
- // Add xsrf header
7055
- var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
7056
- cookies.read(config.xsrfCookieName) :
7057
- undefined;
7058
-
7059
- if (xsrfValue) {
7060
- requestHeaders[config.xsrfHeaderName] = xsrfValue;
7061
- }
6909
+ transformRequest: [function transformRequest(data, headers) {
6910
+ normalizeHeaderName(headers, 'Accept');
6911
+ normalizeHeaderName(headers, 'Content-Type');
6912
+ if (utils.isFormData(data) ||
6913
+ utils.isArrayBuffer(data) ||
6914
+ utils.isBuffer(data) ||
6915
+ utils.isStream(data) ||
6916
+ utils.isFile(data) ||
6917
+ utils.isBlob(data)
6918
+ ) {
6919
+ return data;
7062
6920
  }
7063
-
7064
- // Add headers to the request
7065
- if ('setRequestHeader' in request) {
7066
- utils.forEach(requestHeaders, function setRequestHeader(val, key) {
7067
- if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
7068
- // Remove Content-Type if data is undefined
7069
- delete requestHeaders[key];
7070
- } else {
7071
- // Otherwise add header to the request
7072
- request.setRequestHeader(key, val);
7073
- }
7074
- });
6921
+ if (utils.isArrayBufferView(data)) {
6922
+ return data.buffer;
7075
6923
  }
7076
-
7077
- // Add withCredentials to request if needed
7078
- if (!utils.isUndefined(config.withCredentials)) {
7079
- request.withCredentials = !!config.withCredentials;
6924
+ if (utils.isURLSearchParams(data)) {
6925
+ setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
6926
+ return data.toString();
7080
6927
  }
7081
-
7082
- // Add responseType to request if needed
7083
- if (config.responseType) {
7084
- try {
7085
- request.responseType = config.responseType;
7086
- } catch (e) {
7087
- // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
7088
- // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
7089
- if (config.responseType !== 'json') {
7090
- throw e;
7091
- }
7092
- }
6928
+ if (utils.isObject(data)) {
6929
+ setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
6930
+ return JSON.stringify(data);
7093
6931
  }
6932
+ return data;
6933
+ }],
7094
6934
 
7095
- // Handle progress if needed
7096
- if (typeof config.onDownloadProgress === 'function') {
7097
- request.addEventListener('progress', config.onDownloadProgress);
6935
+ transformResponse: [function transformResponse(data) {
6936
+ /*eslint no-param-reassign:0*/
6937
+ if (typeof data === 'string') {
6938
+ try {
6939
+ data = JSON.parse(data);
6940
+ } catch (e) { /* Ignore */ }
7098
6941
  }
6942
+ return data;
6943
+ }],
7099
6944
 
7100
- // Not all browsers support upload events
7101
- if (typeof config.onUploadProgress === 'function' && request.upload) {
7102
- request.upload.addEventListener('progress', config.onUploadProgress);
7103
- }
6945
+ /**
6946
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
6947
+ * timeout is not created.
6948
+ */
6949
+ timeout: 0,
7104
6950
 
7105
- if (config.cancelToken) {
7106
- // Handle cancellation
7107
- config.cancelToken.promise.then(function onCanceled(cancel) {
7108
- if (!request) {
7109
- return;
7110
- }
6951
+ xsrfCookieName: 'XSRF-TOKEN',
6952
+ xsrfHeaderName: 'X-XSRF-TOKEN',
7111
6953
 
7112
- request.abort();
7113
- reject(cancel);
7114
- // Clean up request
7115
- request = null;
7116
- });
7117
- }
6954
+ maxContentLength: -1,
6955
+ maxBodyLength: -1,
7118
6956
 
7119
- if (!requestData) {
7120
- requestData = null;
7121
- }
6957
+ validateStatus: function validateStatus(status) {
6958
+ return status >= 200 && status < 300;
6959
+ }
6960
+ };
7122
6961
 
7123
- // Send the request
7124
- request.send(requestData);
7125
- });
6962
+ defaults$1.headers = {
6963
+ common: {
6964
+ 'Accept': 'application/json, text/plain, */*'
6965
+ }
7126
6966
  };
7127
6967
 
7128
- /**
7129
- * Helpers.
7130
- */
7131
- var s = 1000;
7132
- var m = s * 60;
7133
- var h = m * 60;
7134
- var d = h * 24;
7135
- var y = d * 365.25;
6968
+ utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
6969
+ defaults$1.headers[method] = {};
6970
+ });
7136
6971
 
7137
- /**
7138
- * Parse or format the given `val`.
7139
- *
7140
- * Options:
7141
- *
7142
- * - `long` verbose formatting [false]
7143
- *
7144
- * @param {String|Number} val
7145
- * @param {Object} [options]
7146
- * @throws {Error} throw an error if val is not a non-empty string or a number
7147
- * @return {String|Number}
7148
- * @api public
7149
- */
6972
+ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
6973
+ defaults$1.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
6974
+ });
7150
6975
 
7151
- var ms = function(val, options) {
7152
- options = options || {};
7153
- var type = typeof val;
7154
- if (type === 'string' && val.length > 0) {
7155
- return parse(val);
7156
- } else if (type === 'number' && isNaN(val) === false) {
7157
- return options.long ? fmtLong(val) : fmtShort(val);
7158
- }
7159
- throw new Error(
7160
- 'val is not a non-empty string or a valid number. val=' +
7161
- JSON.stringify(val)
7162
- );
7163
- };
6976
+ module.exports = defaults$1;
6977
+
6978
+ var defaults$2 = /*#__PURE__*/Object.freeze({
6979
+ __proto__: null
6980
+ });
6981
+
6982
+ var defaults = /*@__PURE__*/getAugmentedNamespace(defaults$2);
7164
6983
 
7165
6984
  /**
7166
- * Parse the given `str` and return milliseconds.
7167
- *
7168
- * @param {String} str
7169
- * @return {Number}
7170
- * @api private
6985
+ * Throws a `Cancel` if cancellation has been requested.
7171
6986
  */
7172
-
7173
- function parse(str) {
7174
- str = String(str);
7175
- if (str.length > 100) {
7176
- return;
7177
- }
7178
- var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(
7179
- str
7180
- );
7181
- if (!match) {
7182
- return;
7183
- }
7184
- var n = parseFloat(match[1]);
7185
- var type = (match[2] || 'ms').toLowerCase();
7186
- switch (type) {
7187
- case 'years':
7188
- case 'year':
7189
- case 'yrs':
7190
- case 'yr':
7191
- case 'y':
7192
- return n * y;
7193
- case 'days':
7194
- case 'day':
7195
- case 'd':
7196
- return n * d;
7197
- case 'hours':
7198
- case 'hour':
7199
- case 'hrs':
7200
- case 'hr':
7201
- case 'h':
7202
- return n * h;
7203
- case 'minutes':
7204
- case 'minute':
7205
- case 'mins':
7206
- case 'min':
7207
- case 'm':
7208
- return n * m;
7209
- case 'seconds':
7210
- case 'second':
7211
- case 'secs':
7212
- case 'sec':
7213
- case 's':
7214
- return n * s;
7215
- case 'milliseconds':
7216
- case 'millisecond':
7217
- case 'msecs':
7218
- case 'msec':
7219
- case 'ms':
7220
- return n;
7221
- default:
7222
- return undefined;
6987
+ function throwIfCancellationRequested(config) {
6988
+ if (config.cancelToken) {
6989
+ config.cancelToken.throwIfRequested();
7223
6990
  }
7224
6991
  }
7225
6992
 
7226
6993
  /**
7227
- * Short format for `ms`.
6994
+ * Dispatch a request to the server using the configured adapter.
7228
6995
  *
7229
- * @param {Number} ms
7230
- * @return {String}
7231
- * @api private
7232
- */
7233
-
7234
- function fmtShort(ms) {
7235
- if (ms >= d) {
7236
- return Math.round(ms / d) + 'd';
7237
- }
7238
- if (ms >= h) {
7239
- return Math.round(ms / h) + 'h';
7240
- }
7241
- if (ms >= m) {
7242
- return Math.round(ms / m) + 'm';
7243
- }
7244
- if (ms >= s) {
7245
- return Math.round(ms / s) + 's';
7246
- }
7247
- return ms + 'ms';
7248
- }
7249
-
7250
- /**
7251
- * Long format for `ms`.
7252
- *
7253
- * @param {Number} ms
7254
- * @return {String}
7255
- * @api private
7256
- */
7257
-
7258
- function fmtLong(ms) {
7259
- return plural(ms, d, 'day') ||
7260
- plural(ms, h, 'hour') ||
7261
- plural(ms, m, 'minute') ||
7262
- plural(ms, s, 'second') ||
7263
- ms + ' ms';
7264
- }
7265
-
7266
- /**
7267
- * Pluralization helper.
7268
- */
7269
-
7270
- function plural(ms, n, name) {
7271
- if (ms < n) {
7272
- return;
7273
- }
7274
- if (ms < n * 1.5) {
7275
- return Math.floor(ms / n) + ' ' + name;
7276
- }
7277
- return Math.ceil(ms / n) + ' ' + name + 's';
7278
- }
7279
-
7280
- var debug$1 = createCommonjsModule(function (module, exports) {
7281
- /**
7282
- * This is the common logic for both the Node.js and web browser
7283
- * implementations of `debug()`.
7284
- *
7285
- * Expose `debug()` as the module.
7286
- */
7287
-
7288
- exports = module.exports = createDebug.debug = createDebug['default'] = createDebug;
7289
- exports.coerce = coerce;
7290
- exports.disable = disable;
7291
- exports.enable = enable;
7292
- exports.enabled = enabled;
7293
- exports.humanize = ms;
7294
-
7295
- /**
7296
- * Active `debug` instances.
7297
- */
7298
- exports.instances = [];
7299
-
7300
- /**
7301
- * The currently active debug mode names, and names to skip.
7302
- */
7303
-
7304
- exports.names = [];
7305
- exports.skips = [];
7306
-
7307
- /**
7308
- * Map of special "%n" handling functions, for the debug "format" argument.
7309
- *
7310
- * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
7311
- */
7312
-
7313
- exports.formatters = {};
7314
-
7315
- /**
7316
- * Select a color.
7317
- * @param {String} namespace
7318
- * @return {Number}
7319
- * @api private
7320
- */
7321
-
7322
- function selectColor(namespace) {
7323
- var hash = 0, i;
7324
-
7325
- for (i in namespace) {
7326
- hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
7327
- hash |= 0; // Convert to 32bit integer
7328
- }
7329
-
7330
- return exports.colors[Math.abs(hash) % exports.colors.length];
7331
- }
7332
-
7333
- /**
7334
- * Create a debugger with the given `namespace`.
7335
- *
7336
- * @param {String} namespace
7337
- * @return {Function}
7338
- * @api public
7339
- */
7340
-
7341
- function createDebug(namespace) {
7342
-
7343
- var prevTime;
7344
-
7345
- function debug() {
7346
- // disabled?
7347
- if (!debug.enabled) return;
7348
-
7349
- var self = debug;
7350
-
7351
- // set `diff` timestamp
7352
- var curr = +new Date();
7353
- var ms = curr - (prevTime || curr);
7354
- self.diff = ms;
7355
- self.prev = prevTime;
7356
- self.curr = curr;
7357
- prevTime = curr;
7358
-
7359
- // turn the `arguments` into a proper Array
7360
- var args = new Array(arguments.length);
7361
- for (var i = 0; i < args.length; i++) {
7362
- args[i] = arguments[i];
7363
- }
7364
-
7365
- args[0] = exports.coerce(args[0]);
7366
-
7367
- if ('string' !== typeof args[0]) {
7368
- // anything else let's inspect with %O
7369
- args.unshift('%O');
7370
- }
7371
-
7372
- // apply any `formatters` transformations
7373
- var index = 0;
7374
- args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {
7375
- // if we encounter an escaped % then don't increase the array index
7376
- if (match === '%%') return match;
7377
- index++;
7378
- var formatter = exports.formatters[format];
7379
- if ('function' === typeof formatter) {
7380
- var val = args[index];
7381
- match = formatter.call(self, val);
7382
-
7383
- // now we need to remove `args[index]` since it's inlined in the `format`
7384
- args.splice(index, 1);
7385
- index--;
7386
- }
7387
- return match;
7388
- });
7389
-
7390
- // apply env-specific formatting (colors, etc.)
7391
- exports.formatArgs.call(self, args);
7392
-
7393
- var logFn = debug.log || exports.log || console.log.bind(console);
7394
- logFn.apply(self, args);
7395
- }
7396
-
7397
- debug.namespace = namespace;
7398
- debug.enabled = exports.enabled(namespace);
7399
- debug.useColors = exports.useColors();
7400
- debug.color = selectColor(namespace);
7401
- debug.destroy = destroy;
7402
-
7403
- // env-specific initialization logic for debug instances
7404
- if ('function' === typeof exports.init) {
7405
- exports.init(debug);
7406
- }
7407
-
7408
- exports.instances.push(debug);
7409
-
7410
- return debug;
7411
- }
7412
-
7413
- function destroy () {
7414
- var index = exports.instances.indexOf(this);
7415
- if (index !== -1) {
7416
- exports.instances.splice(index, 1);
7417
- return true;
7418
- } else {
7419
- return false;
7420
- }
7421
- }
7422
-
7423
- /**
7424
- * Enables a debug mode by namespaces. This can include modes
7425
- * separated by a colon and wildcards.
7426
- *
7427
- * @param {String} namespaces
7428
- * @api public
7429
- */
7430
-
7431
- function enable(namespaces) {
7432
- exports.save(namespaces);
7433
-
7434
- exports.names = [];
7435
- exports.skips = [];
7436
-
7437
- var i;
7438
- var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
7439
- var len = split.length;
7440
-
7441
- for (i = 0; i < len; i++) {
7442
- if (!split[i]) continue; // ignore empty strings
7443
- namespaces = split[i].replace(/\*/g, '.*?');
7444
- if (namespaces[0] === '-') {
7445
- exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
7446
- } else {
7447
- exports.names.push(new RegExp('^' + namespaces + '$'));
7448
- }
7449
- }
7450
-
7451
- for (i = 0; i < exports.instances.length; i++) {
7452
- var instance = exports.instances[i];
7453
- instance.enabled = exports.enabled(instance.namespace);
7454
- }
7455
- }
7456
-
7457
- /**
7458
- * Disable debug output.
7459
- *
7460
- * @api public
7461
- */
7462
-
7463
- function disable() {
7464
- exports.enable('');
7465
- }
7466
-
7467
- /**
7468
- * Returns true if the given mode name is enabled, false otherwise.
7469
- *
7470
- * @param {String} name
7471
- * @return {Boolean}
7472
- * @api public
7473
- */
7474
-
7475
- function enabled(name) {
7476
- if (name[name.length - 1] === '*') {
7477
- return true;
7478
- }
7479
- var i, len;
7480
- for (i = 0, len = exports.skips.length; i < len; i++) {
7481
- if (exports.skips[i].test(name)) {
7482
- return false;
7483
- }
7484
- }
7485
- for (i = 0, len = exports.names.length; i < len; i++) {
7486
- if (exports.names[i].test(name)) {
7487
- return true;
7488
- }
7489
- }
7490
- return false;
7491
- }
7492
-
7493
- /**
7494
- * Coerce `val`.
7495
- *
7496
- * @param {Mixed} val
7497
- * @return {Mixed}
7498
- * @api private
7499
- */
7500
-
7501
- function coerce(val) {
7502
- if (val instanceof Error) return val.stack || val.message;
7503
- return val;
7504
- }
7505
- });
7506
-
7507
- /**
7508
- * This is the web browser implementation of `debug()`.
7509
- *
7510
- * Expose `debug()` as the module.
7511
- */
7512
-
7513
- var browser$1 = createCommonjsModule(function (module, exports) {
7514
- exports = module.exports = debug$1;
7515
- exports.log = log;
7516
- exports.formatArgs = formatArgs;
7517
- exports.save = save;
7518
- exports.load = load;
7519
- exports.useColors = useColors;
7520
- exports.storage = 'undefined' != typeof chrome
7521
- && 'undefined' != typeof chrome.storage
7522
- ? chrome.storage.local
7523
- : localstorage();
7524
-
7525
- /**
7526
- * Colors.
7527
- */
7528
-
7529
- exports.colors = [
7530
- '#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC',
7531
- '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF',
7532
- '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC',
7533
- '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF',
7534
- '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC',
7535
- '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033',
7536
- '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366',
7537
- '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933',
7538
- '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC',
7539
- '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF',
7540
- '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'
7541
- ];
7542
-
7543
- /**
7544
- * Currently only WebKit-based Web Inspectors, Firefox >= v31,
7545
- * and the Firebug extension (any Firefox version) are known
7546
- * to support "%c" CSS customizations.
7547
- *
7548
- * TODO: add a `localStorage` variable to explicitly enable/disable colors
7549
- */
7550
-
7551
- function useColors() {
7552
- // NB: In an Electron preload script, document will be defined but not fully
7553
- // initialized. Since we know we're in Chrome, we'll just detect this case
7554
- // explicitly
7555
- if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') {
7556
- return true;
7557
- }
7558
-
7559
- // Internet Explorer and Edge do not support colors.
7560
- if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
7561
- return false;
7562
- }
7563
-
7564
- // is webkit? http://stackoverflow.com/a/16459606/376773
7565
- // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
7566
- return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
7567
- // is firebug? http://stackoverflow.com/a/398120/376773
7568
- (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
7569
- // is firefox >= v31?
7570
- // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
7571
- (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
7572
- // double check webkit in userAgent just in case we are in a worker
7573
- (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
7574
- }
7575
-
7576
- /**
7577
- * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
7578
- */
7579
-
7580
- exports.formatters.j = function(v) {
7581
- try {
7582
- return JSON.stringify(v);
7583
- } catch (err) {
7584
- return '[UnexpectedJSONParseError]: ' + err.message;
7585
- }
7586
- };
7587
-
7588
-
7589
- /**
7590
- * Colorize log arguments if enabled.
7591
- *
7592
- * @api public
7593
- */
7594
-
7595
- function formatArgs(args) {
7596
- var useColors = this.useColors;
7597
-
7598
- args[0] = (useColors ? '%c' : '')
7599
- + this.namespace
7600
- + (useColors ? ' %c' : ' ')
7601
- + args[0]
7602
- + (useColors ? '%c ' : ' ')
7603
- + '+' + exports.humanize(this.diff);
7604
-
7605
- if (!useColors) return;
7606
-
7607
- var c = 'color: ' + this.color;
7608
- args.splice(1, 0, c, 'color: inherit');
7609
-
7610
- // the final "%c" is somewhat tricky, because there could be other
7611
- // arguments passed either before or after the %c, so we need to
7612
- // figure out the correct index to insert the CSS into
7613
- var index = 0;
7614
- var lastC = 0;
7615
- args[0].replace(/%[a-zA-Z%]/g, function(match) {
7616
- if ('%%' === match) return;
7617
- index++;
7618
- if ('%c' === match) {
7619
- // we only are interested in the *last* %c
7620
- // (the user may have provided their own)
7621
- lastC = index;
7622
- }
7623
- });
7624
-
7625
- args.splice(lastC, 0, c);
7626
- }
7627
-
7628
- /**
7629
- * Invokes `console.log()` when available.
7630
- * No-op when `console.log` is not a "function".
7631
- *
7632
- * @api public
7633
- */
7634
-
7635
- function log() {
7636
- // this hackery is required for IE8/9, where
7637
- // the `console.log` function doesn't have 'apply'
7638
- return 'object' === typeof console
7639
- && console.log
7640
- && Function.prototype.apply.call(console.log, console, arguments);
7641
- }
7642
-
7643
- /**
7644
- * Save `namespaces`.
7645
- *
7646
- * @param {String} namespaces
7647
- * @api private
7648
- */
7649
-
7650
- function save(namespaces) {
7651
- try {
7652
- if (null == namespaces) {
7653
- exports.storage.removeItem('debug');
7654
- } else {
7655
- exports.storage.debug = namespaces;
7656
- }
7657
- } catch(e) {}
7658
- }
7659
-
7660
- /**
7661
- * Load `namespaces`.
7662
- *
7663
- * @return {String} returns the previously persisted debug modes
7664
- * @api private
7665
- */
7666
-
7667
- function load() {
7668
- var r;
7669
- try {
7670
- r = exports.storage.debug;
7671
- } catch(e) {}
7672
-
7673
- // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
7674
- if (!r && typeof process !== 'undefined' && 'env' in process) {
7675
- r = process.env.DEBUG;
7676
- }
7677
-
7678
- return r;
7679
- }
7680
-
7681
- /**
7682
- * Enable namespaces listed in `localStorage.debug` initially.
7683
- */
7684
-
7685
- exports.enable(load());
7686
-
7687
- /**
7688
- * Localstorage attempts to return the localstorage.
7689
- *
7690
- * This is necessary because safari throws
7691
- * when a user disables cookies/localstorage
7692
- * and you attempt to access it.
7693
- *
7694
- * @return {LocalStorage}
7695
- * @api private
7696
- */
7697
-
7698
- function localstorage() {
7699
- try {
7700
- return window.localStorage;
7701
- } catch (e) {}
7702
- }
7703
- });
7704
-
7705
- var hasFlag = (flag, argv = process.argv) => {
7706
- const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
7707
- const position = argv.indexOf(prefix + flag);
7708
- const terminatorPosition = argv.indexOf('--');
7709
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
7710
- };
7711
-
7712
- const {env} = process;
7713
-
7714
- let forceColor;
7715
- if (hasFlag('no-color') ||
7716
- hasFlag('no-colors') ||
7717
- hasFlag('color=false') ||
7718
- hasFlag('color=never')) {
7719
- forceColor = 0;
7720
- } else if (hasFlag('color') ||
7721
- hasFlag('colors') ||
7722
- hasFlag('color=true') ||
7723
- hasFlag('color=always')) {
7724
- forceColor = 1;
7725
- }
7726
-
7727
- if ('FORCE_COLOR' in env) {
7728
- if (env.FORCE_COLOR === 'true') {
7729
- forceColor = 1;
7730
- } else if (env.FORCE_COLOR === 'false') {
7731
- forceColor = 0;
7732
- } else {
7733
- forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
7734
- }
7735
- }
7736
-
7737
- function translateLevel(level) {
7738
- if (level === 0) {
7739
- return false;
7740
- }
7741
-
7742
- return {
7743
- level,
7744
- hasBasic: true,
7745
- has256: level >= 2,
7746
- has16m: level >= 3
7747
- };
7748
- }
7749
-
7750
- function supportsColor(haveStream, streamIsTTY) {
7751
- if (forceColor === 0) {
7752
- return 0;
7753
- }
7754
-
7755
- if (hasFlag('color=16m') ||
7756
- hasFlag('color=full') ||
7757
- hasFlag('color=truecolor')) {
7758
- return 3;
7759
- }
7760
-
7761
- if (hasFlag('color=256')) {
7762
- return 2;
7763
- }
7764
-
7765
- if (haveStream && !streamIsTTY && forceColor === undefined) {
7766
- return 0;
7767
- }
7768
-
7769
- const min = forceColor || 0;
7770
-
7771
- if (env.TERM === 'dumb') {
7772
- return min;
7773
- }
7774
-
7775
- if (process.platform === 'win32') {
7776
- // Windows 10 build 10586 is the first Windows release that supports 256 colors.
7777
- // Windows 10 build 14931 is the first release that supports 16m/TrueColor.
7778
- const osRelease = os.release().split('.');
7779
- if (
7780
- Number(osRelease[0]) >= 10 &&
7781
- Number(osRelease[2]) >= 10586
7782
- ) {
7783
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
7784
- }
7785
-
7786
- return 1;
7787
- }
7788
-
7789
- if ('CI' in env) {
7790
- if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
7791
- return 1;
7792
- }
7793
-
7794
- return min;
7795
- }
7796
-
7797
- if ('TEAMCITY_VERSION' in env) {
7798
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
7799
- }
7800
-
7801
- if (env.COLORTERM === 'truecolor') {
7802
- return 3;
7803
- }
7804
-
7805
- if ('TERM_PROGRAM' in env) {
7806
- const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
7807
-
7808
- switch (env.TERM_PROGRAM) {
7809
- case 'iTerm.app':
7810
- return version >= 3 ? 3 : 2;
7811
- case 'Apple_Terminal':
7812
- return 2;
7813
- // No default
7814
- }
7815
- }
7816
-
7817
- if (/-256(color)?$/i.test(env.TERM)) {
7818
- return 2;
7819
- }
7820
-
7821
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
7822
- return 1;
7823
- }
7824
-
7825
- if ('COLORTERM' in env) {
7826
- return 1;
7827
- }
7828
-
7829
- return min;
7830
- }
7831
-
7832
- function getSupportLevel(stream) {
7833
- const level = supportsColor(stream, stream && stream.isTTY);
7834
- return translateLevel(level);
7835
- }
7836
-
7837
- var supportsColor_1 = {
7838
- supportsColor: getSupportLevel,
7839
- stdout: translateLevel(supportsColor(true, tty.isatty(1))),
7840
- stderr: translateLevel(supportsColor(true, tty.isatty(2)))
7841
- };
7842
-
7843
- /**
7844
- * Module dependencies.
7845
- */
7846
-
7847
- var node = createCommonjsModule(function (module, exports) {
7848
- /**
7849
- * This is the Node.js implementation of `debug()`.
7850
- *
7851
- * Expose `debug()` as the module.
7852
- */
7853
-
7854
- exports = module.exports = debug$1;
7855
- exports.init = init;
7856
- exports.log = log;
7857
- exports.formatArgs = formatArgs;
7858
- exports.save = save;
7859
- exports.load = load;
7860
- exports.useColors = useColors;
7861
-
7862
- /**
7863
- * Colors.
7864
- */
7865
-
7866
- exports.colors = [ 6, 2, 3, 4, 5, 1 ];
7867
-
7868
- try {
7869
- var supportsColor = supportsColor_1;
7870
- if (supportsColor && supportsColor.level >= 2) {
7871
- exports.colors = [
7872
- 20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68,
7873
- 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134,
7874
- 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171,
7875
- 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204,
7876
- 205, 206, 207, 208, 209, 214, 215, 220, 221
7877
- ];
7878
- }
7879
- } catch (err) {
7880
- // swallow - we only care if `supports-color` is available; it doesn't have to be.
7881
- }
7882
-
7883
- /**
7884
- * Build up the default `inspectOpts` object from the environment variables.
7885
- *
7886
- * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
7887
- */
7888
-
7889
- exports.inspectOpts = Object.keys(process.env).filter(function (key) {
7890
- return /^debug_/i.test(key);
7891
- }).reduce(function (obj, key) {
7892
- // camel-case
7893
- var prop = key
7894
- .substring(6)
7895
- .toLowerCase()
7896
- .replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() });
7897
-
7898
- // coerce string value into JS value
7899
- var val = process.env[key];
7900
- if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
7901
- else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
7902
- else if (val === 'null') val = null;
7903
- else val = Number(val);
7904
-
7905
- obj[prop] = val;
7906
- return obj;
7907
- }, {});
7908
-
7909
- /**
7910
- * Is stdout a TTY? Colored output is enabled when `true`.
7911
- */
7912
-
7913
- function useColors() {
7914
- return 'colors' in exports.inspectOpts
7915
- ? Boolean(exports.inspectOpts.colors)
7916
- : tty.isatty(process.stderr.fd);
7917
- }
7918
-
7919
- /**
7920
- * Map %o to `util.inspect()`, all on a single line.
7921
- */
7922
-
7923
- exports.formatters.o = function(v) {
7924
- this.inspectOpts.colors = this.useColors;
7925
- return util.inspect(v, this.inspectOpts)
7926
- .split('\n').map(function(str) {
7927
- return str.trim()
7928
- }).join(' ');
7929
- };
7930
-
7931
- /**
7932
- * Map %o to `util.inspect()`, allowing multiple lines if needed.
7933
- */
7934
-
7935
- exports.formatters.O = function(v) {
7936
- this.inspectOpts.colors = this.useColors;
7937
- return util.inspect(v, this.inspectOpts);
7938
- };
7939
-
7940
- /**
7941
- * Adds ANSI color escape codes if enabled.
7942
- *
7943
- * @api public
7944
- */
7945
-
7946
- function formatArgs(args) {
7947
- var name = this.namespace;
7948
- var useColors = this.useColors;
7949
-
7950
- if (useColors) {
7951
- var c = this.color;
7952
- var colorCode = '\u001b[3' + (c < 8 ? c : '8;5;' + c);
7953
- var prefix = ' ' + colorCode + ';1m' + name + ' ' + '\u001b[0m';
7954
-
7955
- args[0] = prefix + args[0].split('\n').join('\n' + prefix);
7956
- args.push(colorCode + 'm+' + exports.humanize(this.diff) + '\u001b[0m');
7957
- } else {
7958
- args[0] = getDate() + name + ' ' + args[0];
7959
- }
7960
- }
7961
-
7962
- function getDate() {
7963
- if (exports.inspectOpts.hideDate) {
7964
- return '';
7965
- } else {
7966
- return new Date().toISOString() + ' ';
7967
- }
7968
- }
7969
-
7970
- /**
7971
- * Invokes `util.format()` with the specified arguments and writes to stderr.
7972
- */
7973
-
7974
- function log() {
7975
- return process.stderr.write(util.format.apply(util, arguments) + '\n');
7976
- }
7977
-
7978
- /**
7979
- * Save `namespaces`.
7980
- *
7981
- * @param {String} namespaces
7982
- * @api private
7983
- */
7984
-
7985
- function save(namespaces) {
7986
- if (null == namespaces) {
7987
- // If you set a process.env field to null or undefined, it gets cast to the
7988
- // string 'null' or 'undefined'. Just delete instead.
7989
- delete process.env.DEBUG;
7990
- } else {
7991
- process.env.DEBUG = namespaces;
7992
- }
7993
- }
7994
-
7995
- /**
7996
- * Load `namespaces`.
7997
- *
7998
- * @return {String} returns the previously persisted debug modes
7999
- * @api private
8000
- */
8001
-
8002
- function load() {
8003
- return process.env.DEBUG;
8004
- }
8005
-
8006
- /**
8007
- * Init logic for `debug` instances.
8008
- *
8009
- * Create a new `inspectOpts` object in case `useColors` is set
8010
- * differently for a particular `debug` instance.
8011
- */
8012
-
8013
- function init (debug) {
8014
- debug.inspectOpts = {};
8015
-
8016
- var keys = Object.keys(exports.inspectOpts);
8017
- for (var i = 0; i < keys.length; i++) {
8018
- debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
8019
- }
8020
- }
8021
-
8022
- /**
8023
- * Enable namespaces listed in `process.env.DEBUG` initially.
8024
- */
8025
-
8026
- exports.enable(load());
8027
- });
8028
-
8029
- /**
8030
- * Detect Electron renderer process, which is node, but we should
8031
- * treat as a browser.
8032
- */
8033
-
8034
- var src = createCommonjsModule(function (module) {
8035
- if (typeof process === 'undefined' || process.type === 'renderer') {
8036
- module.exports = browser$1;
8037
- } else {
8038
- module.exports = node;
8039
- }
8040
- });
8041
-
8042
- var debug;
8043
-
8044
- var debug_1 = function () {
8045
- if (!debug) {
8046
- try {
8047
- /* eslint global-require: off */
8048
- debug = src("follow-redirects");
8049
- }
8050
- catch (error) { /* */ }
8051
- if (typeof debug !== "function") {
8052
- debug = function () { /* */ };
8053
- }
8054
- }
8055
- debug.apply(null, arguments);
8056
- };
8057
-
8058
- var URL = url.URL;
8059
-
8060
-
8061
- var Writable = require$$0$1.Writable;
8062
-
8063
-
8064
-
8065
- // Create handlers that pass events from native requests
8066
- var events = ["abort", "aborted", "connect", "error", "socket", "timeout"];
8067
- var eventHandlers = Object.create(null);
8068
- events.forEach(function (event) {
8069
- eventHandlers[event] = function (arg1, arg2, arg3) {
8070
- this._redirectable.emit(event, arg1, arg2, arg3);
8071
- };
8072
- });
8073
-
8074
- var InvalidUrlError = createErrorType(
8075
- "ERR_INVALID_URL",
8076
- "Invalid URL",
8077
- TypeError
8078
- );
8079
- // Error types with codes
8080
- var RedirectionError = createErrorType(
8081
- "ERR_FR_REDIRECTION_FAILURE",
8082
- "Redirected request failed"
8083
- );
8084
- var TooManyRedirectsError = createErrorType(
8085
- "ERR_FR_TOO_MANY_REDIRECTS",
8086
- "Maximum number of redirects exceeded"
8087
- );
8088
- var MaxBodyLengthExceededError = createErrorType(
8089
- "ERR_FR_MAX_BODY_LENGTH_EXCEEDED",
8090
- "Request body larger than maxBodyLength limit"
8091
- );
8092
- var WriteAfterEndError = createErrorType(
8093
- "ERR_STREAM_WRITE_AFTER_END",
8094
- "write after end"
8095
- );
8096
-
8097
- // An HTTP(S) request that can be redirected
8098
- function RedirectableRequest(options, responseCallback) {
8099
- // Initialize the request
8100
- Writable.call(this);
8101
- this._sanitizeOptions(options);
8102
- this._options = options;
8103
- this._ended = false;
8104
- this._ending = false;
8105
- this._redirectCount = 0;
8106
- this._redirects = [];
8107
- this._requestBodyLength = 0;
8108
- this._requestBodyBuffers = [];
8109
-
8110
- // Attach a callback if passed
8111
- if (responseCallback) {
8112
- this.on("response", responseCallback);
8113
- }
8114
-
8115
- // React to responses of native requests
8116
- var self = this;
8117
- this._onNativeResponse = function (response) {
8118
- self._processResponse(response);
8119
- };
8120
-
8121
- // Perform the first request
8122
- this._performRequest();
8123
- }
8124
- RedirectableRequest.prototype = Object.create(Writable.prototype);
8125
-
8126
- RedirectableRequest.prototype.abort = function () {
8127
- abortRequest(this._currentRequest);
8128
- this.emit("abort");
8129
- };
8130
-
8131
- // Writes buffered data to the current native request
8132
- RedirectableRequest.prototype.write = function (data, encoding, callback) {
8133
- // Writing is not allowed if end has been called
8134
- if (this._ending) {
8135
- throw new WriteAfterEndError();
8136
- }
8137
-
8138
- // Validate input and shift parameters if necessary
8139
- if (!isString(data) && !isBuffer(data)) {
8140
- throw new TypeError("data should be a string, Buffer or Uint8Array");
8141
- }
8142
- if (isFunction(encoding)) {
8143
- callback = encoding;
8144
- encoding = null;
8145
- }
8146
-
8147
- // Ignore empty buffers, since writing them doesn't invoke the callback
8148
- // https://github.com/nodejs/node/issues/22066
8149
- if (data.length === 0) {
8150
- if (callback) {
8151
- callback();
8152
- }
8153
- return;
8154
- }
8155
- // Only write when we don't exceed the maximum body length
8156
- if (this._requestBodyLength + data.length <= this._options.maxBodyLength) {
8157
- this._requestBodyLength += data.length;
8158
- this._requestBodyBuffers.push({ data: data, encoding: encoding });
8159
- this._currentRequest.write(data, encoding, callback);
8160
- }
8161
- // Error when we exceed the maximum body length
8162
- else {
8163
- this.emit("error", new MaxBodyLengthExceededError());
8164
- this.abort();
8165
- }
8166
- };
8167
-
8168
- // Ends the current native request
8169
- RedirectableRequest.prototype.end = function (data, encoding, callback) {
8170
- // Shift parameters if necessary
8171
- if (isFunction(data)) {
8172
- callback = data;
8173
- data = encoding = null;
8174
- }
8175
- else if (isFunction(encoding)) {
8176
- callback = encoding;
8177
- encoding = null;
8178
- }
8179
-
8180
- // Write data if needed and end
8181
- if (!data) {
8182
- this._ended = this._ending = true;
8183
- this._currentRequest.end(null, null, callback);
8184
- }
8185
- else {
8186
- var self = this;
8187
- var currentRequest = this._currentRequest;
8188
- this.write(data, encoding, function () {
8189
- self._ended = true;
8190
- currentRequest.end(null, null, callback);
8191
- });
8192
- this._ending = true;
8193
- }
8194
- };
8195
-
8196
- // Sets a header value on the current native request
8197
- RedirectableRequest.prototype.setHeader = function (name, value) {
8198
- this._options.headers[name] = value;
8199
- this._currentRequest.setHeader(name, value);
8200
- };
8201
-
8202
- // Clears a header value on the current native request
8203
- RedirectableRequest.prototype.removeHeader = function (name) {
8204
- delete this._options.headers[name];
8205
- this._currentRequest.removeHeader(name);
8206
- };
8207
-
8208
- // Global timeout for all underlying requests
8209
- RedirectableRequest.prototype.setTimeout = function (msecs, callback) {
8210
- var self = this;
8211
-
8212
- // Destroys the socket on timeout
8213
- function destroyOnTimeout(socket) {
8214
- socket.setTimeout(msecs);
8215
- socket.removeListener("timeout", socket.destroy);
8216
- socket.addListener("timeout", socket.destroy);
8217
- }
8218
-
8219
- // Sets up a timer to trigger a timeout event
8220
- function startTimer(socket) {
8221
- if (self._timeout) {
8222
- clearTimeout(self._timeout);
8223
- }
8224
- self._timeout = setTimeout(function () {
8225
- self.emit("timeout");
8226
- clearTimer();
8227
- }, msecs);
8228
- destroyOnTimeout(socket);
8229
- }
8230
-
8231
- // Stops a timeout from triggering
8232
- function clearTimer() {
8233
- // Clear the timeout
8234
- if (self._timeout) {
8235
- clearTimeout(self._timeout);
8236
- self._timeout = null;
8237
- }
8238
-
8239
- // Clean up all attached listeners
8240
- self.removeListener("abort", clearTimer);
8241
- self.removeListener("error", clearTimer);
8242
- self.removeListener("response", clearTimer);
8243
- if (callback) {
8244
- self.removeListener("timeout", callback);
8245
- }
8246
- if (!self.socket) {
8247
- self._currentRequest.removeListener("socket", startTimer);
8248
- }
8249
- }
8250
-
8251
- // Attach callback if passed
8252
- if (callback) {
8253
- this.on("timeout", callback);
8254
- }
8255
-
8256
- // Start the timer if or when the socket is opened
8257
- if (this.socket) {
8258
- startTimer(this.socket);
8259
- }
8260
- else {
8261
- this._currentRequest.once("socket", startTimer);
8262
- }
8263
-
8264
- // Clean up on events
8265
- this.on("socket", destroyOnTimeout);
8266
- this.on("abort", clearTimer);
8267
- this.on("error", clearTimer);
8268
- this.on("response", clearTimer);
8269
-
8270
- return this;
8271
- };
8272
-
8273
- // Proxy all other public ClientRequest methods
8274
- [
8275
- "flushHeaders", "getHeader",
8276
- "setNoDelay", "setSocketKeepAlive",
8277
- ].forEach(function (method) {
8278
- RedirectableRequest.prototype[method] = function (a, b) {
8279
- return this._currentRequest[method](a, b);
8280
- };
8281
- });
8282
-
8283
- // Proxy all public ClientRequest properties
8284
- ["aborted", "connection", "socket"].forEach(function (property) {
8285
- Object.defineProperty(RedirectableRequest.prototype, property, {
8286
- get: function () { return this._currentRequest[property]; },
8287
- });
8288
- });
8289
-
8290
- RedirectableRequest.prototype._sanitizeOptions = function (options) {
8291
- // Ensure headers are always present
8292
- if (!options.headers) {
8293
- options.headers = {};
8294
- }
8295
-
8296
- // Since http.request treats host as an alias of hostname,
8297
- // but the url module interprets host as hostname plus port,
8298
- // eliminate the host property to avoid confusion.
8299
- if (options.host) {
8300
- // Use hostname if set, because it has precedence
8301
- if (!options.hostname) {
8302
- options.hostname = options.host;
8303
- }
8304
- delete options.host;
8305
- }
8306
-
8307
- // Complete the URL object when necessary
8308
- if (!options.pathname && options.path) {
8309
- var searchPos = options.path.indexOf("?");
8310
- if (searchPos < 0) {
8311
- options.pathname = options.path;
8312
- }
8313
- else {
8314
- options.pathname = options.path.substring(0, searchPos);
8315
- options.search = options.path.substring(searchPos);
8316
- }
8317
- }
8318
- };
8319
-
8320
-
8321
- // Executes the next native request (initial or redirect)
8322
- RedirectableRequest.prototype._performRequest = function () {
8323
- // Load the native protocol
8324
- var protocol = this._options.protocol;
8325
- var nativeProtocol = this._options.nativeProtocols[protocol];
8326
- if (!nativeProtocol) {
8327
- this.emit("error", new TypeError("Unsupported protocol " + protocol));
8328
- return;
8329
- }
8330
-
8331
- // If specified, use the agent corresponding to the protocol
8332
- // (HTTP and HTTPS use different types of agents)
8333
- if (this._options.agents) {
8334
- var scheme = protocol.slice(0, -1);
8335
- this._options.agent = this._options.agents[scheme];
8336
- }
8337
-
8338
- // Create the native request and set up its event handlers
8339
- var request = this._currentRequest =
8340
- nativeProtocol.request(this._options, this._onNativeResponse);
8341
- request._redirectable = this;
8342
- for (var event of events) {
8343
- request.on(event, eventHandlers[event]);
8344
- }
8345
-
8346
- // RFC7230§5.3.1: When making a request directly to an origin server, […]
8347
- // a client MUST send only the absolute path […] as the request-target.
8348
- this._currentUrl = /^\//.test(this._options.path) ?
8349
- url.format(this._options) :
8350
- // When making a request to a proxy, […]
8351
- // a client MUST send the target URI in absolute-form […].
8352
- this._options.path;
8353
-
8354
- // End a redirected request
8355
- // (The first request must be ended explicitly with RedirectableRequest#end)
8356
- if (this._isRedirect) {
8357
- // Write the request entity and end
8358
- var i = 0;
8359
- var self = this;
8360
- var buffers = this._requestBodyBuffers;
8361
- (function writeNext(error) {
8362
- // Only write if this request has not been redirected yet
8363
- /* istanbul ignore else */
8364
- if (request === self._currentRequest) {
8365
- // Report any write errors
8366
- /* istanbul ignore if */
8367
- if (error) {
8368
- self.emit("error", error);
8369
- }
8370
- // Write the next buffer if there are still left
8371
- else if (i < buffers.length) {
8372
- var buffer = buffers[i++];
8373
- /* istanbul ignore else */
8374
- if (!request.finished) {
8375
- request.write(buffer.data, buffer.encoding, writeNext);
8376
- }
8377
- }
8378
- // End the request if `end` has been called on us
8379
- else if (self._ended) {
8380
- request.end();
8381
- }
8382
- }
8383
- }());
8384
- }
8385
- };
8386
-
8387
- // Processes a response from the current native request
8388
- RedirectableRequest.prototype._processResponse = function (response) {
8389
- // Store the redirected response
8390
- var statusCode = response.statusCode;
8391
- if (this._options.trackRedirects) {
8392
- this._redirects.push({
8393
- url: this._currentUrl,
8394
- headers: response.headers,
8395
- statusCode: statusCode,
8396
- });
8397
- }
8398
-
8399
- // RFC7231§6.4: The 3xx (Redirection) class of status code indicates
8400
- // that further action needs to be taken by the user agent in order to
8401
- // fulfill the request. If a Location header field is provided,
8402
- // the user agent MAY automatically redirect its request to the URI
8403
- // referenced by the Location field value,
8404
- // even if the specific status code is not understood.
8405
-
8406
- // If the response is not a redirect; return it as-is
8407
- var location = response.headers.location;
8408
- if (!location || this._options.followRedirects === false ||
8409
- statusCode < 300 || statusCode >= 400) {
8410
- response.responseUrl = this._currentUrl;
8411
- response.redirects = this._redirects;
8412
- this.emit("response", response);
8413
-
8414
- // Clean up
8415
- this._requestBodyBuffers = [];
8416
- return;
8417
- }
8418
-
8419
- // The response is a redirect, so abort the current request
8420
- abortRequest(this._currentRequest);
8421
- // Discard the remainder of the response to avoid waiting for data
8422
- response.destroy();
8423
-
8424
- // RFC7231§6.4: A client SHOULD detect and intervene
8425
- // in cyclical redirections (i.e., "infinite" redirection loops).
8426
- if (++this._redirectCount > this._options.maxRedirects) {
8427
- this.emit("error", new TooManyRedirectsError());
8428
- return;
8429
- }
8430
-
8431
- // Store the request headers if applicable
8432
- var requestHeaders;
8433
- var beforeRedirect = this._options.beforeRedirect;
8434
- if (beforeRedirect) {
8435
- requestHeaders = Object.assign({
8436
- // The Host header was set by nativeProtocol.request
8437
- Host: response.req.getHeader("host"),
8438
- }, this._options.headers);
8439
- }
8440
-
8441
- // RFC7231§6.4: Automatic redirection needs to done with
8442
- // care for methods not known to be safe, […]
8443
- // RFC7231§6.4.2–3: For historical reasons, a user agent MAY change
8444
- // the request method from POST to GET for the subsequent request.
8445
- var method = this._options.method;
8446
- if ((statusCode === 301 || statusCode === 302) && this._options.method === "POST" ||
8447
- // RFC7231§6.4.4: The 303 (See Other) status code indicates that
8448
- // the server is redirecting the user agent to a different resource […]
8449
- // A user agent can perform a retrieval request targeting that URI
8450
- // (a GET or HEAD request if using HTTP) […]
8451
- (statusCode === 303) && !/^(?:GET|HEAD)$/.test(this._options.method)) {
8452
- this._options.method = "GET";
8453
- // Drop a possible entity and headers related to it
8454
- this._requestBodyBuffers = [];
8455
- removeMatchingHeaders(/^content-/i, this._options.headers);
8456
- }
8457
-
8458
- // Drop the Host header, as the redirect might lead to a different host
8459
- var currentHostHeader = removeMatchingHeaders(/^host$/i, this._options.headers);
8460
-
8461
- // If the redirect is relative, carry over the host of the last request
8462
- var currentUrlParts = url.parse(this._currentUrl);
8463
- var currentHost = currentHostHeader || currentUrlParts.host;
8464
- var currentUrl = /^\w+:/.test(location) ? this._currentUrl :
8465
- url.format(Object.assign(currentUrlParts, { host: currentHost }));
8466
-
8467
- // Determine the URL of the redirection
8468
- var redirectUrl;
8469
- try {
8470
- redirectUrl = url.resolve(currentUrl, location);
8471
- }
8472
- catch (cause) {
8473
- this.emit("error", new RedirectionError({ cause: cause }));
8474
- return;
8475
- }
8476
-
8477
- // Create the redirected request
8478
- debug_1("redirecting to", redirectUrl);
8479
- this._isRedirect = true;
8480
- var redirectUrlParts = url.parse(redirectUrl);
8481
- Object.assign(this._options, redirectUrlParts);
8482
-
8483
- // Drop confidential headers when redirecting to a less secure protocol
8484
- // or to a different domain that is not a superdomain
8485
- if (redirectUrlParts.protocol !== currentUrlParts.protocol &&
8486
- redirectUrlParts.protocol !== "https:" ||
8487
- redirectUrlParts.host !== currentHost &&
8488
- !isSubdomain(redirectUrlParts.host, currentHost)) {
8489
- removeMatchingHeaders(/^(?:authorization|cookie)$/i, this._options.headers);
8490
- }
8491
-
8492
- // Evaluate the beforeRedirect callback
8493
- if (isFunction(beforeRedirect)) {
8494
- var responseDetails = {
8495
- headers: response.headers,
8496
- statusCode: statusCode,
8497
- };
8498
- var requestDetails = {
8499
- url: currentUrl,
8500
- method: method,
8501
- headers: requestHeaders,
8502
- };
8503
- try {
8504
- beforeRedirect(this._options, responseDetails, requestDetails);
8505
- }
8506
- catch (err) {
8507
- this.emit("error", err);
8508
- return;
8509
- }
8510
- this._sanitizeOptions(this._options);
8511
- }
8512
-
8513
- // Perform the redirected request
8514
- try {
8515
- this._performRequest();
8516
- }
8517
- catch (cause) {
8518
- this.emit("error", new RedirectionError({ cause: cause }));
8519
- }
8520
- };
8521
-
8522
- // Wraps the key/value object of protocols with redirect functionality
8523
- function wrap(protocols) {
8524
- // Default settings
8525
- var exports = {
8526
- maxRedirects: 21,
8527
- maxBodyLength: 10 * 1024 * 1024,
8528
- };
8529
-
8530
- // Wrap each protocol
8531
- var nativeProtocols = {};
8532
- Object.keys(protocols).forEach(function (scheme) {
8533
- var protocol = scheme + ":";
8534
- var nativeProtocol = nativeProtocols[protocol] = protocols[scheme];
8535
- var wrappedProtocol = exports[scheme] = Object.create(nativeProtocol);
8536
-
8537
- // Executes a request, following redirects
8538
- function request(input, options, callback) {
8539
- // Parse parameters
8540
- if (isString(input)) {
8541
- var parsed;
8542
- try {
8543
- parsed = urlToOptions(new URL(input));
8544
- }
8545
- catch (err) {
8546
- /* istanbul ignore next */
8547
- parsed = url.parse(input);
8548
- }
8549
- if (!isString(parsed.protocol)) {
8550
- throw new InvalidUrlError({ input });
8551
- }
8552
- input = parsed;
8553
- }
8554
- else if (URL && (input instanceof URL)) {
8555
- input = urlToOptions(input);
8556
- }
8557
- else {
8558
- callback = options;
8559
- options = input;
8560
- input = { protocol: protocol };
8561
- }
8562
- if (isFunction(options)) {
8563
- callback = options;
8564
- options = null;
8565
- }
8566
-
8567
- // Set defaults
8568
- options = Object.assign({
8569
- maxRedirects: exports.maxRedirects,
8570
- maxBodyLength: exports.maxBodyLength,
8571
- }, input, options);
8572
- options.nativeProtocols = nativeProtocols;
8573
- if (!isString(options.host) && !isString(options.hostname)) {
8574
- options.hostname = "::1";
8575
- }
8576
-
8577
- assert.equal(options.protocol, protocol, "protocol mismatch");
8578
- debug_1("options", options);
8579
- return new RedirectableRequest(options, callback);
8580
- }
8581
-
8582
- // Executes a GET request, following redirects
8583
- function get(input, options, callback) {
8584
- var wrappedRequest = wrappedProtocol.request(input, options, callback);
8585
- wrappedRequest.end();
8586
- return wrappedRequest;
8587
- }
8588
-
8589
- // Expose the properties on the wrapped protocol
8590
- Object.defineProperties(wrappedProtocol, {
8591
- request: { value: request, configurable: true, enumerable: true, writable: true },
8592
- get: { value: get, configurable: true, enumerable: true, writable: true },
8593
- });
8594
- });
8595
- return exports;
8596
- }
8597
-
8598
- /* istanbul ignore next */
8599
- function noop() { /* empty */ }
8600
-
8601
- // from https://github.com/nodejs/node/blob/master/lib/internal/url.js
8602
- function urlToOptions(urlObject) {
8603
- var options = {
8604
- protocol: urlObject.protocol,
8605
- hostname: urlObject.hostname.startsWith("[") ?
8606
- /* istanbul ignore next */
8607
- urlObject.hostname.slice(1, -1) :
8608
- urlObject.hostname,
8609
- hash: urlObject.hash,
8610
- search: urlObject.search,
8611
- pathname: urlObject.pathname,
8612
- path: urlObject.pathname + urlObject.search,
8613
- href: urlObject.href,
8614
- };
8615
- if (urlObject.port !== "") {
8616
- options.port = Number(urlObject.port);
8617
- }
8618
- return options;
8619
- }
8620
-
8621
- function removeMatchingHeaders(regex, headers) {
8622
- var lastValue;
8623
- for (var header in headers) {
8624
- if (regex.test(header)) {
8625
- lastValue = headers[header];
8626
- delete headers[header];
8627
- }
8628
- }
8629
- return (lastValue === null || typeof lastValue === "undefined") ?
8630
- undefined : String(lastValue).trim();
8631
- }
8632
-
8633
- function createErrorType(code, message, baseClass) {
8634
- // Create constructor
8635
- function CustomError(properties) {
8636
- Error.captureStackTrace(this, this.constructor);
8637
- Object.assign(this, properties || {});
8638
- this.code = code;
8639
- this.message = this.cause ? message + ": " + this.cause.message : message;
8640
- }
8641
-
8642
- // Attach constructor and set default properties
8643
- CustomError.prototype = new (baseClass || Error)();
8644
- CustomError.prototype.constructor = CustomError;
8645
- CustomError.prototype.name = "Error [" + code + "]";
8646
- return CustomError;
8647
- }
8648
-
8649
- function abortRequest(request) {
8650
- for (var event of events) {
8651
- request.removeListener(event, eventHandlers[event]);
8652
- }
8653
- request.on("error", noop);
8654
- request.abort();
8655
- }
8656
-
8657
- function isSubdomain(subdomain, domain) {
8658
- assert(isString(subdomain) && isString(domain));
8659
- var dot = subdomain.length - domain.length - 1;
8660
- return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain);
8661
- }
8662
-
8663
- function isString(value) {
8664
- return typeof value === "string" || value instanceof String;
8665
- }
8666
-
8667
- function isFunction(value) {
8668
- return typeof value === "function";
8669
- }
8670
-
8671
- function isBuffer(value) {
8672
- return typeof value === "object" && ("length" in value);
8673
- }
8674
-
8675
- // Exports
8676
- var followRedirects = wrap({ http: http, https: https });
8677
- var wrap_1 = wrap;
8678
- followRedirects.wrap = wrap_1;
8679
-
8680
- var name = "axios";
8681
- var version = "0.21.1";
8682
- var description = "Promise based HTTP client for the browser and node.js";
8683
- var main = "index.js";
8684
- var scripts = {
8685
- test: "grunt test && bundlesize",
8686
- start: "node ./sandbox/server.js",
8687
- build: "NODE_ENV=production grunt build",
8688
- preversion: "npm test",
8689
- version: "npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json",
8690
- postversion: "git push && git push --tags",
8691
- examples: "node ./examples/server.js",
8692
- coveralls: "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
8693
- fix: "eslint --fix lib/**/*.js"
8694
- };
8695
- var repository = {
8696
- type: "git",
8697
- url: "https://github.com/axios/axios.git"
8698
- };
8699
- var keywords = [
8700
- "xhr",
8701
- "http",
8702
- "ajax",
8703
- "promise",
8704
- "node"
8705
- ];
8706
- var author = "Matt Zabriskie";
8707
- var license = "MIT";
8708
- var bugs = {
8709
- url: "https://github.com/axios/axios/issues"
8710
- };
8711
- var homepage = "https://github.com/axios/axios";
8712
- var devDependencies = {
8713
- bundlesize: "^0.17.0",
8714
- coveralls: "^3.0.0",
8715
- "es6-promise": "^4.2.4",
8716
- grunt: "^1.0.2",
8717
- "grunt-banner": "^0.6.0",
8718
- "grunt-cli": "^1.2.0",
8719
- "grunt-contrib-clean": "^1.1.0",
8720
- "grunt-contrib-watch": "^1.0.0",
8721
- "grunt-eslint": "^20.1.0",
8722
- "grunt-karma": "^2.0.0",
8723
- "grunt-mocha-test": "^0.13.3",
8724
- "grunt-ts": "^6.0.0-beta.19",
8725
- "grunt-webpack": "^1.0.18",
8726
- "istanbul-instrumenter-loader": "^1.0.0",
8727
- "jasmine-core": "^2.4.1",
8728
- karma: "^1.3.0",
8729
- "karma-chrome-launcher": "^2.2.0",
8730
- "karma-coverage": "^1.1.1",
8731
- "karma-firefox-launcher": "^1.1.0",
8732
- "karma-jasmine": "^1.1.1",
8733
- "karma-jasmine-ajax": "^0.1.13",
8734
- "karma-opera-launcher": "^1.0.0",
8735
- "karma-safari-launcher": "^1.0.0",
8736
- "karma-sauce-launcher": "^1.2.0",
8737
- "karma-sinon": "^1.0.5",
8738
- "karma-sourcemap-loader": "^0.3.7",
8739
- "karma-webpack": "^1.7.0",
8740
- "load-grunt-tasks": "^3.5.2",
8741
- minimist: "^1.2.0",
8742
- mocha: "^5.2.0",
8743
- sinon: "^4.5.0",
8744
- typescript: "^2.8.1",
8745
- "url-search-params": "^0.10.0",
8746
- webpack: "^1.13.1",
8747
- "webpack-dev-server": "^1.14.1"
8748
- };
8749
- var browser = {
8750
- "./lib/adapters/http.js": "./lib/adapters/xhr.js"
8751
- };
8752
- var jsdelivr = "dist/axios.min.js";
8753
- var unpkg = "dist/axios.min.js";
8754
- var typings = "./index.d.ts";
8755
- var dependencies = {
8756
- "follow-redirects": "^1.10.0"
8757
- };
8758
- var bundlesize = [
8759
- {
8760
- path: "./dist/axios.min.js",
8761
- threshold: "5kB"
8762
- }
8763
- ];
8764
- var _resolved = "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz";
8765
- var _integrity = "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==";
8766
- var _from = "axios@0.21.1";
8767
- var pkg = {
8768
- name: name,
8769
- version: version,
8770
- description: description,
8771
- main: main,
8772
- scripts: scripts,
8773
- repository: repository,
8774
- keywords: keywords,
8775
- author: author,
8776
- license: license,
8777
- bugs: bugs,
8778
- homepage: homepage,
8779
- devDependencies: devDependencies,
8780
- browser: browser,
8781
- jsdelivr: jsdelivr,
8782
- unpkg: unpkg,
8783
- typings: typings,
8784
- dependencies: dependencies,
8785
- bundlesize: bundlesize,
8786
- _resolved: _resolved,
8787
- _integrity: _integrity,
8788
- _from: _from
8789
- };
8790
-
8791
- var httpFollow = followRedirects.http;
8792
- var httpsFollow = followRedirects.https;
8793
-
8794
-
8795
-
8796
-
8797
-
8798
-
8799
- var isHttps = /https:?/;
8800
-
8801
- /**
8802
- *
8803
- * @param {http.ClientRequestArgs} options
8804
- * @param {AxiosProxyConfig} proxy
8805
- * @param {string} location
8806
- */
8807
- function setProxy(options, proxy, location) {
8808
- options.hostname = proxy.host;
8809
- options.host = proxy.host;
8810
- options.port = proxy.port;
8811
- options.path = location;
8812
-
8813
- // Basic proxy authorization
8814
- if (proxy.auth) {
8815
- var base64 = Buffer.from(proxy.auth.username + ':' + proxy.auth.password, 'utf8').toString('base64');
8816
- options.headers['Proxy-Authorization'] = 'Basic ' + base64;
8817
- }
8818
-
8819
- // If a proxy is used, any redirects must also pass through the proxy
8820
- options.beforeRedirect = function beforeRedirect(redirection) {
8821
- redirection.headers.host = redirection.host;
8822
- setProxy(redirection, proxy, redirection.href);
8823
- };
8824
- }
8825
-
8826
- /*eslint consistent-return:0*/
8827
- var http_1 = function httpAdapter(config) {
8828
- return new Promise(function dispatchHttpRequest(resolvePromise, rejectPromise) {
8829
- var resolve = function resolve(value) {
8830
- resolvePromise(value);
8831
- };
8832
- var reject = function reject(value) {
8833
- rejectPromise(value);
8834
- };
8835
- var data = config.data;
8836
- var headers = config.headers;
8837
-
8838
- // Set User-Agent (required by some servers)
8839
- // Only set header if it hasn't been set in config
8840
- // See https://github.com/axios/axios/issues/69
8841
- if (!headers['User-Agent'] && !headers['user-agent']) {
8842
- headers['User-Agent'] = 'axios/' + pkg.version;
8843
- }
8844
-
8845
- if (data && !utils.isStream(data)) {
8846
- if (Buffer.isBuffer(data)) ; else if (utils.isArrayBuffer(data)) {
8847
- data = Buffer.from(new Uint8Array(data));
8848
- } else if (utils.isString(data)) {
8849
- data = Buffer.from(data, 'utf-8');
8850
- } else {
8851
- return reject(createError(
8852
- 'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream',
8853
- config
8854
- ));
8855
- }
8856
-
8857
- // Add Content-Length header if data exists
8858
- headers['Content-Length'] = data.length;
8859
- }
8860
-
8861
- // HTTP basic authentication
8862
- var auth = undefined;
8863
- if (config.auth) {
8864
- var username = config.auth.username || '';
8865
- var password = config.auth.password || '';
8866
- auth = username + ':' + password;
8867
- }
8868
-
8869
- // Parse url
8870
- var fullPath = buildFullPath(config.baseURL, config.url);
8871
- var parsed = url.parse(fullPath);
8872
- var protocol = parsed.protocol || 'http:';
8873
-
8874
- if (!auth && parsed.auth) {
8875
- var urlAuth = parsed.auth.split(':');
8876
- var urlUsername = urlAuth[0] || '';
8877
- var urlPassword = urlAuth[1] || '';
8878
- auth = urlUsername + ':' + urlPassword;
8879
- }
8880
-
8881
- if (auth) {
8882
- delete headers.Authorization;
8883
- }
8884
-
8885
- var isHttpsRequest = isHttps.test(protocol);
8886
- var agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
8887
-
8888
- var options = {
8889
- path: buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, ''),
8890
- method: config.method.toUpperCase(),
8891
- headers: headers,
8892
- agent: agent,
8893
- agents: { http: config.httpAgent, https: config.httpsAgent },
8894
- auth: auth
8895
- };
8896
-
8897
- if (config.socketPath) {
8898
- options.socketPath = config.socketPath;
8899
- } else {
8900
- options.hostname = parsed.hostname;
8901
- options.port = parsed.port;
8902
- }
8903
-
8904
- var proxy = config.proxy;
8905
- if (!proxy && proxy !== false) {
8906
- var proxyEnv = protocol.slice(0, -1) + '_proxy';
8907
- var proxyUrl = process.env[proxyEnv] || process.env[proxyEnv.toUpperCase()];
8908
- if (proxyUrl) {
8909
- var parsedProxyUrl = url.parse(proxyUrl);
8910
- var noProxyEnv = process.env.no_proxy || process.env.NO_PROXY;
8911
- var shouldProxy = true;
8912
-
8913
- if (noProxyEnv) {
8914
- var noProxy = noProxyEnv.split(',').map(function trim(s) {
8915
- return s.trim();
8916
- });
8917
-
8918
- shouldProxy = !noProxy.some(function proxyMatch(proxyElement) {
8919
- if (!proxyElement) {
8920
- return false;
8921
- }
8922
- if (proxyElement === '*') {
8923
- return true;
8924
- }
8925
- if (proxyElement[0] === '.' &&
8926
- parsed.hostname.substr(parsed.hostname.length - proxyElement.length) === proxyElement) {
8927
- return true;
8928
- }
8929
-
8930
- return parsed.hostname === proxyElement;
8931
- });
8932
- }
8933
-
8934
- if (shouldProxy) {
8935
- proxy = {
8936
- host: parsedProxyUrl.hostname,
8937
- port: parsedProxyUrl.port,
8938
- protocol: parsedProxyUrl.protocol
8939
- };
8940
-
8941
- if (parsedProxyUrl.auth) {
8942
- var proxyUrlAuth = parsedProxyUrl.auth.split(':');
8943
- proxy.auth = {
8944
- username: proxyUrlAuth[0],
8945
- password: proxyUrlAuth[1]
8946
- };
8947
- }
8948
- }
8949
- }
8950
- }
8951
-
8952
- if (proxy) {
8953
- options.headers.host = parsed.hostname + (parsed.port ? ':' + parsed.port : '');
8954
- setProxy(options, proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);
8955
- }
8956
-
8957
- var transport;
8958
- var isHttpsProxy = isHttpsRequest && (proxy ? isHttps.test(proxy.protocol) : true);
8959
- if (config.transport) {
8960
- transport = config.transport;
8961
- } else if (config.maxRedirects === 0) {
8962
- transport = isHttpsProxy ? https : http;
8963
- } else {
8964
- if (config.maxRedirects) {
8965
- options.maxRedirects = config.maxRedirects;
8966
- }
8967
- transport = isHttpsProxy ? httpsFollow : httpFollow;
8968
- }
8969
-
8970
- if (config.maxBodyLength > -1) {
8971
- options.maxBodyLength = config.maxBodyLength;
8972
- }
8973
-
8974
- // Create the request
8975
- var req = transport.request(options, function handleResponse(res) {
8976
- if (req.aborted) return;
8977
-
8978
- // uncompress the response body transparently if required
8979
- var stream = res;
8980
-
8981
- // return the last request in case of redirects
8982
- var lastRequest = res.req || req;
8983
-
8984
-
8985
- // if no content, is HEAD request or decompress disabled we should not decompress
8986
- if (res.statusCode !== 204 && lastRequest.method !== 'HEAD' && config.decompress !== false) {
8987
- switch (res.headers['content-encoding']) {
8988
- /*eslint default-case:0*/
8989
- case 'gzip':
8990
- case 'compress':
8991
- case 'deflate':
8992
- // add the unzipper to the body stream processing pipeline
8993
- stream = stream.pipe(zlib.createUnzip());
8994
-
8995
- // remove the content-encoding in order to not confuse downstream operations
8996
- delete res.headers['content-encoding'];
8997
- break;
8998
- }
8999
- }
9000
-
9001
- var response = {
9002
- status: res.statusCode,
9003
- statusText: res.statusMessage,
9004
- headers: res.headers,
9005
- config: config,
9006
- request: lastRequest
9007
- };
9008
-
9009
- if (config.responseType === 'stream') {
9010
- response.data = stream;
9011
- settle(resolve, reject, response);
9012
- } else {
9013
- var responseBuffer = [];
9014
- stream.on('data', function handleStreamData(chunk) {
9015
- responseBuffer.push(chunk);
9016
-
9017
- // make sure the content length is not over the maxContentLength if specified
9018
- if (config.maxContentLength > -1 && Buffer.concat(responseBuffer).length > config.maxContentLength) {
9019
- stream.destroy();
9020
- reject(createError('maxContentLength size of ' + config.maxContentLength + ' exceeded',
9021
- config, null, lastRequest));
9022
- }
9023
- });
9024
-
9025
- stream.on('error', function handleStreamError(err) {
9026
- if (req.aborted) return;
9027
- reject(enhanceError(err, config, null, lastRequest));
9028
- });
9029
-
9030
- stream.on('end', function handleStreamEnd() {
9031
- var responseData = Buffer.concat(responseBuffer);
9032
- if (config.responseType !== 'arraybuffer') {
9033
- responseData = responseData.toString(config.responseEncoding);
9034
- if (!config.responseEncoding || config.responseEncoding === 'utf8') {
9035
- responseData = utils.stripBOM(responseData);
9036
- }
9037
- }
9038
-
9039
- response.data = responseData;
9040
- settle(resolve, reject, response);
9041
- });
9042
- }
9043
- });
9044
-
9045
- // Handle errors
9046
- req.on('error', function handleRequestError(err) {
9047
- if (req.aborted && err.code !== 'ERR_FR_TOO_MANY_REDIRECTS') return;
9048
- reject(enhanceError(err, config, null, req));
9049
- });
9050
-
9051
- // Handle request timeout
9052
- if (config.timeout) {
9053
- // Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system.
9054
- // And timer callback will be fired, and abort() will be invoked before connection, then get "socket hang up" and code ECONNRESET.
9055
- // At this time, if we have a large number of request, nodejs will hang up some socket on background. and the number will up and up.
9056
- // And then these socket which be hang up will devoring CPU little by little.
9057
- // ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect.
9058
- req.setTimeout(config.timeout, function handleRequestTimeout() {
9059
- req.abort();
9060
- reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED', req));
9061
- });
9062
- }
9063
-
9064
- if (config.cancelToken) {
9065
- // Handle cancellation
9066
- config.cancelToken.promise.then(function onCanceled(cancel) {
9067
- if (req.aborted) return;
9068
-
9069
- req.abort();
9070
- reject(cancel);
9071
- });
9072
- }
9073
-
9074
- // Send the request
9075
- if (utils.isStream(data)) {
9076
- data.on('error', function handleStreamError(err) {
9077
- reject(enhanceError(err, config, null, req));
9078
- }).pipe(req);
9079
- } else {
9080
- req.end(data);
9081
- }
9082
- });
9083
- };
9084
-
9085
- var DEFAULT_CONTENT_TYPE = {
9086
- 'Content-Type': 'application/x-www-form-urlencoded'
9087
- };
9088
-
9089
- function setContentTypeIfUnset(headers, value) {
9090
- if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
9091
- headers['Content-Type'] = value;
9092
- }
9093
- }
9094
-
9095
- function getDefaultAdapter() {
9096
- var adapter;
9097
- if (typeof XMLHttpRequest !== 'undefined') {
9098
- // For browsers use XHR adapter
9099
- adapter = xhr;
9100
- } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
9101
- // For node use HTTP adapter
9102
- adapter = http_1;
9103
- }
9104
- return adapter;
9105
- }
9106
-
9107
- var defaults = {
9108
- adapter: getDefaultAdapter(),
9109
-
9110
- transformRequest: [function transformRequest(data, headers) {
9111
- normalizeHeaderName(headers, 'Accept');
9112
- normalizeHeaderName(headers, 'Content-Type');
9113
- if (utils.isFormData(data) ||
9114
- utils.isArrayBuffer(data) ||
9115
- utils.isBuffer(data) ||
9116
- utils.isStream(data) ||
9117
- utils.isFile(data) ||
9118
- utils.isBlob(data)
9119
- ) {
9120
- return data;
9121
- }
9122
- if (utils.isArrayBufferView(data)) {
9123
- return data.buffer;
9124
- }
9125
- if (utils.isURLSearchParams(data)) {
9126
- setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
9127
- return data.toString();
9128
- }
9129
- if (utils.isObject(data)) {
9130
- setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
9131
- return JSON.stringify(data);
9132
- }
9133
- return data;
9134
- }],
9135
-
9136
- transformResponse: [function transformResponse(data) {
9137
- /*eslint no-param-reassign:0*/
9138
- if (typeof data === 'string') {
9139
- try {
9140
- data = JSON.parse(data);
9141
- } catch (e) { /* Ignore */ }
9142
- }
9143
- return data;
9144
- }],
9145
-
9146
- /**
9147
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
9148
- * timeout is not created.
9149
- */
9150
- timeout: 0,
9151
-
9152
- xsrfCookieName: 'XSRF-TOKEN',
9153
- xsrfHeaderName: 'X-XSRF-TOKEN',
9154
-
9155
- maxContentLength: -1,
9156
- maxBodyLength: -1,
9157
-
9158
- validateStatus: function validateStatus(status) {
9159
- return status >= 200 && status < 300;
9160
- }
9161
- };
9162
-
9163
- defaults.headers = {
9164
- common: {
9165
- 'Accept': 'application/json, text/plain, */*'
9166
- }
9167
- };
9168
-
9169
- utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
9170
- defaults.headers[method] = {};
9171
- });
9172
-
9173
- utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
9174
- defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
9175
- });
9176
-
9177
- var defaults_1 = defaults;
9178
-
9179
- /**
9180
- * Throws a `Cancel` if cancellation has been requested.
9181
- */
9182
- function throwIfCancellationRequested(config) {
9183
- if (config.cancelToken) {
9184
- config.cancelToken.throwIfRequested();
9185
- }
9186
- }
9187
-
9188
- /**
9189
- * Dispatch a request to the server using the configured adapter.
9190
- *
9191
- * @param {object} config The config that is to be used for the request
9192
- * @returns {Promise} The Promise to be fulfilled
6996
+ * @param {object} config The config that is to be used for the request
6997
+ * @returns {Promise} The Promise to be fulfilled
9193
6998
  */
9194
6999
  var dispatchRequest = function dispatchRequest(config) {
9195
7000
  throwIfCancellationRequested(config);
@@ -9205,20 +7010,20 @@ var dispatchRequest = function dispatchRequest(config) {
9205
7010
  );
9206
7011
 
9207
7012
  // Flatten headers
9208
- config.headers = utils.merge(
7013
+ config.headers = utils$1.merge(
9209
7014
  config.headers.common || {},
9210
7015
  config.headers[config.method] || {},
9211
7016
  config.headers
9212
7017
  );
9213
7018
 
9214
- utils.forEach(
7019
+ utils$1.forEach(
9215
7020
  ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
9216
7021
  function cleanHeaderConfig(method) {
9217
7022
  delete config.headers[method];
9218
7023
  }
9219
7024
  );
9220
7025
 
9221
- var adapter = config.adapter || defaults_1.adapter;
7026
+ var adapter = config.adapter || defaults.adapter;
9222
7027
 
9223
7028
  return adapter(config).then(function onAdapterResolution(response) {
9224
7029
  throwIfCancellationRequested(config);
@@ -9274,41 +7079,41 @@ var mergeConfig = function mergeConfig(config1, config2) {
9274
7079
  var directMergeKeys = ['validateStatus'];
9275
7080
 
9276
7081
  function getMergedValue(target, source) {
9277
- if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
9278
- return utils.merge(target, source);
9279
- } else if (utils.isPlainObject(source)) {
9280
- return utils.merge({}, source);
9281
- } else if (utils.isArray(source)) {
7082
+ if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
7083
+ return utils$1.merge(target, source);
7084
+ } else if (utils$1.isPlainObject(source)) {
7085
+ return utils$1.merge({}, source);
7086
+ } else if (utils$1.isArray(source)) {
9282
7087
  return source.slice();
9283
7088
  }
9284
7089
  return source;
9285
7090
  }
9286
7091
 
9287
7092
  function mergeDeepProperties(prop) {
9288
- if (!utils.isUndefined(config2[prop])) {
7093
+ if (!utils$1.isUndefined(config2[prop])) {
9289
7094
  config[prop] = getMergedValue(config1[prop], config2[prop]);
9290
- } else if (!utils.isUndefined(config1[prop])) {
7095
+ } else if (!utils$1.isUndefined(config1[prop])) {
9291
7096
  config[prop] = getMergedValue(undefined, config1[prop]);
9292
7097
  }
9293
7098
  }
9294
7099
 
9295
- utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
9296
- if (!utils.isUndefined(config2[prop])) {
7100
+ utils$1.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
7101
+ if (!utils$1.isUndefined(config2[prop])) {
9297
7102
  config[prop] = getMergedValue(undefined, config2[prop]);
9298
7103
  }
9299
7104
  });
9300
7105
 
9301
- utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);
7106
+ utils$1.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);
9302
7107
 
9303
- utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
9304
- if (!utils.isUndefined(config2[prop])) {
7108
+ utils$1.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
7109
+ if (!utils$1.isUndefined(config2[prop])) {
9305
7110
  config[prop] = getMergedValue(undefined, config2[prop]);
9306
- } else if (!utils.isUndefined(config1[prop])) {
7111
+ } else if (!utils$1.isUndefined(config1[prop])) {
9307
7112
  config[prop] = getMergedValue(undefined, config1[prop]);
9308
7113
  }
9309
7114
  });
9310
7115
 
9311
- utils.forEach(directMergeKeys, function merge(prop) {
7116
+ utils$1.forEach(directMergeKeys, function merge(prop) {
9312
7117
  if (prop in config2) {
9313
7118
  config[prop] = getMergedValue(config1[prop], config2[prop]);
9314
7119
  } else if (prop in config1) {
@@ -9328,7 +7133,7 @@ var mergeConfig = function mergeConfig(config1, config2) {
9328
7133
  return axiosKeys.indexOf(key) === -1;
9329
7134
  });
9330
7135
 
9331
- utils.forEach(otherKeys, mergeDeepProperties);
7136
+ utils$1.forEach(otherKeys, mergeDeepProperties);
9332
7137
 
9333
7138
  return config;
9334
7139
  };
@@ -9397,7 +7202,7 @@ Axios.prototype.getUri = function getUri(config) {
9397
7202
  };
9398
7203
 
9399
7204
  // Provide aliases for supported request methods
9400
- utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
7205
+ utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
9401
7206
  /*eslint func-names:0*/
9402
7207
  Axios.prototype[method] = function(url, config) {
9403
7208
  return this.request(mergeConfig(config || {}, {
@@ -9408,7 +7213,7 @@ utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData
9408
7213
  };
9409
7214
  });
9410
7215
 
9411
- utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
7216
+ utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
9412
7217
  /*eslint func-names:0*/
9413
7218
  Axios.prototype[method] = function(url, data, config) {
9414
7219
  return this.request(mergeConfig(config || {}, {
@@ -9540,16 +7345,16 @@ function createInstance(defaultConfig) {
9540
7345
  var instance = bind(Axios_1.prototype.request, context);
9541
7346
 
9542
7347
  // Copy axios.prototype to instance
9543
- utils.extend(instance, Axios_1.prototype, context);
7348
+ utils$1.extend(instance, Axios_1.prototype, context);
9544
7349
 
9545
7350
  // Copy context to instance
9546
- utils.extend(instance, context);
7351
+ utils$1.extend(instance, context);
9547
7352
 
9548
7353
  return instance;
9549
7354
  }
9550
7355
 
9551
7356
  // Create the default instance to be exported
9552
- var axios$1 = createInstance(defaults_1);
7357
+ var axios$1 = createInstance(defaults);
9553
7358
 
9554
7359
  // Expose Axios class to allow class inheritance
9555
7360
  axios$1.Axios = Axios_1;