vue-intergrall-plugins 0.0.159 → 0.0.160

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,5 @@
1
1
  import vue from 'vue';
2
- import http from 'http';
3
- import https from 'https';
4
- import url from 'url';
5
- import stream from 'stream';
6
- import assert from 'assert';
7
- import tty from 'tty';
8
- import util from 'util';
9
- import os from 'os';
10
- import zlib from 'zlib';
2
+ import axios from 'axios';
11
3
 
12
4
  var top = 'top';
13
5
  var bottom = 'bottom';
@@ -165,32 +157,29 @@ function getBasePlacement(placement) {
165
157
  return placement.split('-')[0];
166
158
  }
167
159
 
168
- var max = Math.max;
169
- var min = Math.min;
170
- var round = Math.round;
171
-
172
- function getBoundingClientRect(element, includeScale) {
173
- if (includeScale === void 0) {
174
- includeScale = false;
175
- }
160
+ // import { isHTMLElement } from './instanceOf';
161
+ function getBoundingClientRect(element, // eslint-disable-next-line unused-imports/no-unused-vars
162
+ includeScale) {
176
163
 
177
164
  var rect = element.getBoundingClientRect();
178
165
  var scaleX = 1;
179
- var scaleY = 1;
180
-
181
- if (isHTMLElement(element) && includeScale) {
182
- var offsetHeight = element.offsetHeight;
183
- var offsetWidth = element.offsetWidth; // Do not attempt to divide by 0, otherwise we get `Infinity` as scale
184
- // Fallback to 1 in case both values are `0`
185
-
186
- if (offsetWidth > 0) {
187
- scaleX = round(rect.width) / offsetWidth || 1;
188
- }
189
-
190
- if (offsetHeight > 0) {
191
- scaleY = round(rect.height) / offsetHeight || 1;
192
- }
193
- }
166
+ var scaleY = 1; // FIXME:
167
+ // `offsetWidth` returns an integer while `getBoundingClientRect`
168
+ // returns a float. This results in `scaleX` or `scaleY` being
169
+ // non-1 when it should be for elements that aren't a full pixel in
170
+ // width or height.
171
+ // if (isHTMLElement(element) && includeScale) {
172
+ // const offsetHeight = element.offsetHeight;
173
+ // const offsetWidth = element.offsetWidth;
174
+ // // Do not attempt to divide by 0, otherwise we get `Infinity` as scale
175
+ // // Fallback to 1 in case both values are `0`
176
+ // if (offsetWidth > 0) {
177
+ // scaleX = rect.width / offsetWidth || 1;
178
+ // }
179
+ // if (offsetHeight > 0) {
180
+ // scaleY = rect.height / offsetHeight || 1;
181
+ // }
182
+ // }
194
183
 
195
184
  return {
196
185
  width: rect.width / scaleX,
@@ -345,13 +334,13 @@ function getMainAxisFromPlacement(placement) {
345
334
  return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
346
335
  }
347
336
 
337
+ var max = Math.max;
338
+ var min = Math.min;
339
+ var round = Math.round;
340
+
348
341
  function within(min$1, value, max$1) {
349
342
  return max(min$1, min(value, max$1));
350
343
  }
351
- function withinMaxClamp(min, value, max) {
352
- var v = within(min, value, max);
353
- return v > max ? max : v;
354
- }
355
344
 
356
345
  function getFreshSideObject() {
357
346
  return {
@@ -474,8 +463,8 @@ function roundOffsetsByDPR(_ref) {
474
463
  var win = window;
475
464
  var dpr = win.devicePixelRatio || 1;
476
465
  return {
477
- x: round(x * dpr) / dpr || 0,
478
- y: round(y * dpr) / dpr || 0
466
+ x: round(round(x * dpr) / dpr) || 0,
467
+ y: round(round(y * dpr) / dpr) || 0
479
468
  };
480
469
  }
481
470
 
@@ -490,23 +479,14 @@ function mapToStyles(_ref2) {
490
479
  position = _ref2.position,
491
480
  gpuAcceleration = _ref2.gpuAcceleration,
492
481
  adaptive = _ref2.adaptive,
493
- roundOffsets = _ref2.roundOffsets,
494
- isFixed = _ref2.isFixed;
495
- var _offsets$x = offsets.x,
496
- x = _offsets$x === void 0 ? 0 : _offsets$x,
497
- _offsets$y = offsets.y,
498
- y = _offsets$y === void 0 ? 0 : _offsets$y;
499
-
500
- var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({
501
- x: x,
502
- y: y
503
- }) : {
504
- x: x,
505
- y: y
506
- };
482
+ roundOffsets = _ref2.roundOffsets;
483
+
484
+ var _ref3 = roundOffsets === true ? roundOffsetsByDPR(offsets) : typeof roundOffsets === 'function' ? roundOffsets(offsets) : offsets,
485
+ _ref3$x = _ref3.x,
486
+ x = _ref3$x === void 0 ? 0 : _ref3$x,
487
+ _ref3$y = _ref3.y,
488
+ y = _ref3$y === void 0 ? 0 : _ref3$y;
507
489
 
508
- x = _ref3.x;
509
- y = _ref3.y;
510
490
  var hasX = offsets.hasOwnProperty('x');
511
491
  var hasY = offsets.hasOwnProperty('y');
512
492
  var sideX = left;
@@ -531,18 +511,16 @@ function mapToStyles(_ref2) {
531
511
  offsetParent = offsetParent;
532
512
 
533
513
  if (placement === top || (placement === left || placement === right) && variation === end) {
534
- sideY = bottom;
535
- var offsetY = isFixed && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
536
- offsetParent[heightProp];
537
- y -= offsetY - popperRect.height;
514
+ sideY = bottom; // $FlowFixMe[prop-missing]
515
+
516
+ y -= offsetParent[heightProp] - popperRect.height;
538
517
  y *= gpuAcceleration ? 1 : -1;
539
518
  }
540
519
 
541
520
  if (placement === left || (placement === top || placement === bottom) && variation === end) {
542
- sideX = right;
543
- var offsetX = isFixed && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
544
- offsetParent[widthProp];
545
- x -= offsetX - popperRect.width;
521
+ sideX = right; // $FlowFixMe[prop-missing]
522
+
523
+ x -= offsetParent[widthProp] - popperRect.width;
546
524
  x *= gpuAcceleration ? 1 : -1;
547
525
  }
548
526
  }
@@ -551,17 +529,6 @@ function mapToStyles(_ref2) {
551
529
  position: position
552
530
  }, adaptive && unsetSides);
553
531
 
554
- var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
555
- x: x,
556
- y: y
557
- }) : {
558
- x: x,
559
- y: y
560
- };
561
-
562
- x = _ref4.x;
563
- y = _ref4.y;
564
-
565
532
  if (gpuAcceleration) {
566
533
  var _Object$assign;
567
534
 
@@ -571,9 +538,9 @@ function mapToStyles(_ref2) {
571
538
  return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
572
539
  }
573
540
 
574
- function computeStyles(_ref5) {
575
- var state = _ref5.state,
576
- options = _ref5.options;
541
+ function computeStyles(_ref4) {
542
+ var state = _ref4.state,
543
+ options = _ref4.options;
577
544
  var _options$gpuAccelerat = options.gpuAcceleration,
578
545
  gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
579
546
  _options$adaptive = options.adaptive,
@@ -586,8 +553,7 @@ function computeStyles(_ref5) {
586
553
  variation: getVariation(state.placement),
587
554
  popper: state.elements.popper,
588
555
  popperRect: state.rects.popper,
589
- gpuAcceleration: gpuAcceleration,
590
- isFixed: state.options.strategy === 'fixed'
556
+ gpuAcceleration: gpuAcceleration
591
557
  };
592
558
 
593
559
  if (state.modifiersData.popperOffsets != null) {
@@ -845,7 +811,7 @@ function getInnerBoundingClientRect(element) {
845
811
  }
846
812
 
847
813
  function getClientRectFromMixedType(element, clippingParent) {
848
- return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
814
+ return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isHTMLElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
849
815
  } // A "clipping parent" is an overflowable container with the characteristic of
850
816
  // clipping (or hiding) overflowing elements with a position different from
851
817
  // `initial`
@@ -1358,14 +1324,6 @@ function preventOverflow(_ref) {
1358
1324
  var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
1359
1325
  placement: state.placement
1360
1326
  })) : tetherOffset;
1361
- var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
1362
- mainAxis: tetherOffsetValue,
1363
- altAxis: tetherOffsetValue
1364
- } : Object.assign({
1365
- mainAxis: 0,
1366
- altAxis: 0
1367
- }, tetherOffsetValue);
1368
- var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
1369
1327
  var data = {
1370
1328
  x: 0,
1371
1329
  y: 0
@@ -1375,15 +1333,13 @@ function preventOverflow(_ref) {
1375
1333
  return;
1376
1334
  }
1377
1335
 
1378
- if (checkMainAxis) {
1379
- var _offsetModifierState$;
1380
-
1336
+ if (checkMainAxis || checkAltAxis) {
1381
1337
  var mainSide = mainAxis === 'y' ? top : left;
1382
1338
  var altSide = mainAxis === 'y' ? bottom : right;
1383
1339
  var len = mainAxis === 'y' ? 'height' : 'width';
1384
1340
  var offset = popperOffsets[mainAxis];
1385
- var min$1 = offset + overflow[mainSide];
1386
- var max$1 = offset - overflow[altSide];
1341
+ var min$1 = popperOffsets[mainAxis] + overflow[mainSide];
1342
+ var max$1 = popperOffsets[mainAxis] - overflow[altSide];
1387
1343
  var additive = tether ? -popperRect[len] / 2 : 0;
1388
1344
  var minLen = variation === start ? referenceRect[len] : popperRect[len];
1389
1345
  var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
@@ -1403,45 +1359,36 @@ function preventOverflow(_ref) {
1403
1359
  // width or height)
1404
1360
 
1405
1361
  var arrowLen = within(0, referenceRect[len], arrowRect[len]);
1406
- var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
1407
- var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
1362
+ var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - tetherOffsetValue : minLen - arrowLen - arrowPaddingMin - tetherOffsetValue;
1363
+ var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + tetherOffsetValue : maxLen + arrowLen + arrowPaddingMax + tetherOffsetValue;
1408
1364
  var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
1409
1365
  var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
1410
- var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
1411
- var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
1412
- var tetherMax = offset + maxOffset - offsetModifierValue;
1413
- var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
1414
- popperOffsets[mainAxis] = preventedOffset;
1415
- data[mainAxis] = preventedOffset - offset;
1416
- }
1417
-
1418
- if (checkAltAxis) {
1419
- var _offsetModifierState$2;
1420
-
1421
- var _mainSide = mainAxis === 'x' ? top : left;
1422
-
1423
- var _altSide = mainAxis === 'x' ? bottom : right;
1366
+ var offsetModifierValue = state.modifiersData.offset ? state.modifiersData.offset[state.placement][mainAxis] : 0;
1367
+ var tetherMin = popperOffsets[mainAxis] + minOffset - offsetModifierValue - clientOffset;
1368
+ var tetherMax = popperOffsets[mainAxis] + maxOffset - offsetModifierValue;
1424
1369
 
1425
- var _offset = popperOffsets[altAxis];
1426
-
1427
- var _len = altAxis === 'y' ? 'height' : 'width';
1428
-
1429
- var _min = _offset + overflow[_mainSide];
1370
+ if (checkMainAxis) {
1371
+ var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
1372
+ popperOffsets[mainAxis] = preventedOffset;
1373
+ data[mainAxis] = preventedOffset - offset;
1374
+ }
1430
1375
 
1431
- var _max = _offset - overflow[_altSide];
1376
+ if (checkAltAxis) {
1377
+ var _mainSide = mainAxis === 'x' ? top : left;
1432
1378
 
1433
- var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
1379
+ var _altSide = mainAxis === 'x' ? bottom : right;
1434
1380
 
1435
- var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
1381
+ var _offset = popperOffsets[altAxis];
1436
1382
 
1437
- var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
1383
+ var _min = _offset + overflow[_mainSide];
1438
1384
 
1439
- var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
1385
+ var _max = _offset - overflow[_altSide];
1440
1386
 
1441
- var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
1387
+ var _preventedOffset = within(tether ? min(_min, tetherMin) : _min, _offset, tether ? max(_max, tetherMax) : _max);
1442
1388
 
1443
- popperOffsets[altAxis] = _preventedOffset;
1444
- data[altAxis] = _preventedOffset - _offset;
1389
+ popperOffsets[altAxis] = _preventedOffset;
1390
+ data[altAxis] = _preventedOffset - _offset;
1391
+ }
1445
1392
  }
1446
1393
 
1447
1394
  state.modifiersData[name] = data;
@@ -1473,8 +1420,8 @@ function getNodeScroll(node) {
1473
1420
 
1474
1421
  function isElementScaled(element) {
1475
1422
  var rect = element.getBoundingClientRect();
1476
- var scaleX = round(rect.width) / element.offsetWidth || 1;
1477
- var scaleY = round(rect.height) / element.offsetHeight || 1;
1423
+ var scaleX = rect.width / element.offsetWidth || 1;
1424
+ var scaleY = rect.height / element.offsetHeight || 1;
1478
1425
  return scaleX !== 1 || scaleY !== 1;
1479
1426
  } // Returns the composite rect of an element relative to its offsetParent.
1480
1427
  // Composite means it takes into account transforms as well as layout.
@@ -1486,9 +1433,9 @@ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
1486
1433
  }
1487
1434
 
1488
1435
  var isOffsetParentAnElement = isHTMLElement(offsetParent);
1489
- var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
1436
+ isHTMLElement(offsetParent) && isElementScaled(offsetParent);
1490
1437
  var documentElement = getDocumentElement(offsetParent);
1491
- var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
1438
+ var rect = getBoundingClientRect(elementOrVirtualElement);
1492
1439
  var scroll = {
1493
1440
  scrollLeft: 0,
1494
1441
  scrollTop: 0
@@ -1505,7 +1452,7 @@ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
1505
1452
  }
1506
1453
 
1507
1454
  if (isHTMLElement(offsetParent)) {
1508
- offsets = getBoundingClientRect(offsetParent, true);
1455
+ offsets = getBoundingClientRect(offsetParent);
1509
1456
  offsets.x += offsetParent.clientLeft;
1510
1457
  offsets.y += offsetParent.clientTop;
1511
1458
  } else if (documentElement) {
@@ -2308,7 +2255,7 @@ if (!compatible) {
2308
2255
 
2309
2256
  var HANDLER = '_vue_clickaway_handler';
2310
2257
 
2311
- function bind$1(el, binding, vnode) {
2258
+ function bind(el, binding, vnode) {
2312
2259
  unbind(el);
2313
2260
 
2314
2261
  var vm = vnode.context;
@@ -2351,10 +2298,10 @@ function unbind(el) {
2351
2298
  }
2352
2299
 
2353
2300
  var directive = {
2354
- bind: bind$1,
2301
+ bind: bind,
2355
2302
  update: function(el, binding) {
2356
2303
  if (binding.value === binding.oldValue) return;
2357
- bind$1(el, binding);
2304
+ bind(el, binding);
2358
2305
  },
2359
2306
  unbind: unbind,
2360
2307
  };
@@ -3622,7 +3569,7 @@ var script$k = {
3622
3569
  required: true
3623
3570
  },
3624
3571
  file: {
3625
- type: File,
3572
+ type: Array,
3626
3573
  required: true
3627
3574
  },
3628
3575
  fileFormatError: {
@@ -3763,7 +3710,7 @@ var __vue_staticRenderFns__$k = [];
3763
3710
 
3764
3711
  const __vue_inject_styles__$k = function (inject) {
3765
3712
  if (!inject) return;
3766
- inject("data-v-7c17339e_0", {
3713
+ inject("data-v-55cbc293_0", {
3767
3714
  source: ".multiple-file-preview{position:relative;display:flex;flex-direction:column;width:100%;height:100%;max-height:100%;overflow-y:auto;overflow-x:hidden;border-top-left-radius:2.5px;border-top-right-radius:2.5px;transition:background-color 150ms;scrollbar-color:#888 rgba(0,0,0,.2);scrollbar-width:4px}.multiple-file-preview::-webkit-scrollbar{width:4px}.multiple-file-preview::-webkit-scrollbar-track{background-color:rgba(0,0,0,.2)}.multiple-file-preview::-webkit-scrollbar-thumb{transition-duration:.5s;background-color:#222}.multiple-file-preview::-webkit-scrollbar-thumb:hover{background-color:#555}.text-footer-invalid-format{color:#222;padding:10px}.text-footer-invalid-format h3{font-weight:500}.text-footer-invalid-format h4{font-size:.9rem}.text-footer-exclude-file{position:absolute;top:5px;right:5px;cursor:pointer;display:flex;justify-content:center;align-items:center;min-width:1rem;min-height:1rem;background-color:#fff;border-radius:50%}.text-footer-exclude-file svg{transition:color .2s;color:#e9594a}.text-footer-exclude-file svg:hover{color:#e74c3c}.file-preview{display:flex;width:100%;align-items:center;padding:5px 10px;transition:background-color 150ms}.file-preview:hover{background-color:rgba(0,0,0,.1)}.file-title{color:#222;display:flex;align-items:center;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;padding:4px 10px;background-color:#fff;border-radius:30px;display:inline-block}.file-title.red{color:#e74c3c;margin-left:5px}.file-title>svg{margin-right:5px}.small-img{flex:1;margin:0 15px;display:flex;justify-content:center;align-items:center;position:relative}.small-img img{height:40px;cursor:pointer}.small-img .pdf{display:flex;justify-content:center;align-items:center;font-size:30px;color:#e74c3c}.small-img .pdf svg{z-index:1}.small-img .pdf::after{content:\"\";position:absolute;bottom:2px;transform:translateY(2px);width:20px;height:20px;background-color:#fff}.img-container{padding:5px;border-radius:2.5px;background-color:rgba(0,0,0,.15);display:flex;justify-content:center;align-items:center}.delete-file{display:flex;justify-content:center;align-items:center;border-radius:50%;background-color:#fff;min-width:1rem;min-height:1rem;cursor:pointer}.delete-file>svg{font-size:1rem;color:#e74c3c}",
3768
3715
  map: undefined,
3769
3716
  media: undefined
@@ -3823,6 +3770,7 @@ var script$j = {
3823
3770
  data() {
3824
3771
  return {
3825
3772
  file: [],
3773
+ fileSize: 0,
3826
3774
  openFiles: false,
3827
3775
  showFilePreview: false,
3828
3776
  imagePreview: "",
@@ -3865,6 +3813,10 @@ var script$j = {
3865
3813
  return false;
3866
3814
  }
3867
3815
 
3816
+ if (this.fileSettings.multiple) {
3817
+ type = 'both';
3818
+ }
3819
+
3868
3820
  const fileInput = document.querySelector(`#${type}-${this.textId}`);
3869
3821
  if (fileInput) fileInput.click();
3870
3822
  if (!fileInput) if (!document.querySelector(".toasted.toasted-primary.error")) this.$toasted.global.defaultError();
@@ -3894,12 +3846,14 @@ var script$j = {
3894
3846
 
3895
3847
  fileUpload(event, type, externalCall) {
3896
3848
  try {
3849
+ this.fileSize = 0;
3897
3850
  if (this.fileFormatError) this.file = [];
3898
3851
  this.openFiles = false;
3899
3852
  let filesAux = !externalCall ? event.target.files ? event.target.files : event.dataTransfer.files : event;
3900
3853
  this.file = filesAux.length ? filesAux : this.file;
3901
3854
  if (!this.file.length) return;
3902
3855
  this.hasAnyFile = true;
3856
+ this.fileSize = this.file.length;
3903
3857
 
3904
3858
  if (!this.fileSettings.multiple) {
3905
3859
  this.file = this.file[0];
@@ -4048,13 +4002,13 @@ var __vue_render__$j = function () {
4048
4002
  attrs: {
4049
4003
  "name": "fade"
4050
4004
  }
4051
- }, [_vm.file.length ? _c('span', {
4005
+ }, [_vm.fileSize > 0 ? _c('span', {
4052
4006
  staticClass: "files-counter",
4053
4007
  attrs: {
4054
4008
  "title": _vm.dictionary.msg_abrir_anexos
4055
4009
  },
4056
4010
  domProps: {
4057
- "textContent": _vm._s(_vm.file.length)
4011
+ "textContent": _vm._s(_vm.fileSize)
4058
4012
  },
4059
4013
  on: {
4060
4014
  "click": function ($event) {
@@ -4213,7 +4167,7 @@ var __vue_staticRenderFns__$j = [];
4213
4167
 
4214
4168
  const __vue_inject_styles__$j = function (inject) {
4215
4169
  if (!inject) return;
4216
- inject("data-v-d44243ce_0", {
4170
+ inject("data-v-797c22f2_0", {
4217
4171
  source: ".fade-enter-active,.fade-leave-active{transition:opacity .3s}.fade-enter,.fade-leave-to{opacity:0}.files-counter{position:absolute;top:unset;transform:translate(17.5px,-15px);background-color:#888;z-index:1;font-size:.5rem;width:15px;height:15px;border-radius:50%;display:flex;justify-content:center;align-items:center;cursor:pointer;opacity:.9;transition:all .3s;color:#fff;font-weight:900}.files-counter:hover{opacity:1}",
4218
4172
  map: undefined,
4219
4173
  media: undefined
@@ -4380,3876 +4334,6 @@ const __vue_component__$o = /*#__PURE__*/normalizeComponent({
4380
4334
 
4381
4335
  var BtnStandardMessages = __vue_component__$o;
4382
4336
 
4383
- var bind = function bind(fn, thisArg) {
4384
- return function wrap() {
4385
- var args = new Array(arguments.length);
4386
- for (var i = 0; i < args.length; i++) {
4387
- args[i] = arguments[i];
4388
- }
4389
- return fn.apply(thisArg, args);
4390
- };
4391
- };
4392
-
4393
- // utils is a library of generic helper functions non-specific to axios
4394
-
4395
- var toString = Object.prototype.toString;
4396
-
4397
- /**
4398
- * Determine if a value is an Array
4399
- *
4400
- * @param {Object} val The value to test
4401
- * @returns {boolean} True if value is an Array, otherwise false
4402
- */
4403
- function isArray(val) {
4404
- return Array.isArray(val);
4405
- }
4406
-
4407
- /**
4408
- * Determine if a value is undefined
4409
- *
4410
- * @param {Object} val The value to test
4411
- * @returns {boolean} True if the value is undefined, otherwise false
4412
- */
4413
- function isUndefined(val) {
4414
- return typeof val === 'undefined';
4415
- }
4416
-
4417
- /**
4418
- * Determine if a value is a Buffer
4419
- *
4420
- * @param {Object} val The value to test
4421
- * @returns {boolean} True if value is a Buffer, otherwise false
4422
- */
4423
- function isBuffer(val) {
4424
- return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
4425
- && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
4426
- }
4427
-
4428
- /**
4429
- * Determine if a value is an ArrayBuffer
4430
- *
4431
- * @param {Object} val The value to test
4432
- * @returns {boolean} True if value is an ArrayBuffer, otherwise false
4433
- */
4434
- function isArrayBuffer(val) {
4435
- return toString.call(val) === '[object ArrayBuffer]';
4436
- }
4437
-
4438
- /**
4439
- * Determine if a value is a FormData
4440
- *
4441
- * @param {Object} val The value to test
4442
- * @returns {boolean} True if value is an FormData, otherwise false
4443
- */
4444
- function isFormData(val) {
4445
- return toString.call(val) === '[object FormData]';
4446
- }
4447
-
4448
- /**
4449
- * Determine if a value is a view on an ArrayBuffer
4450
- *
4451
- * @param {Object} val The value to test
4452
- * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
4453
- */
4454
- function isArrayBufferView(val) {
4455
- var result;
4456
- if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
4457
- result = ArrayBuffer.isView(val);
4458
- } else {
4459
- result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
4460
- }
4461
- return result;
4462
- }
4463
-
4464
- /**
4465
- * Determine if a value is a String
4466
- *
4467
- * @param {Object} val The value to test
4468
- * @returns {boolean} True if value is a String, otherwise false
4469
- */
4470
- function isString(val) {
4471
- return typeof val === 'string';
4472
- }
4473
-
4474
- /**
4475
- * Determine if a value is a Number
4476
- *
4477
- * @param {Object} val The value to test
4478
- * @returns {boolean} True if value is a Number, otherwise false
4479
- */
4480
- function isNumber(val) {
4481
- return typeof val === 'number';
4482
- }
4483
-
4484
- /**
4485
- * Determine if a value is an Object
4486
- *
4487
- * @param {Object} val The value to test
4488
- * @returns {boolean} True if value is an Object, otherwise false
4489
- */
4490
- function isObject(val) {
4491
- return val !== null && typeof val === 'object';
4492
- }
4493
-
4494
- /**
4495
- * Determine if a value is a plain Object
4496
- *
4497
- * @param {Object} val The value to test
4498
- * @return {boolean} True if value is a plain Object, otherwise false
4499
- */
4500
- function isPlainObject(val) {
4501
- if (toString.call(val) !== '[object Object]') {
4502
- return false;
4503
- }
4504
-
4505
- var prototype = Object.getPrototypeOf(val);
4506
- return prototype === null || prototype === Object.prototype;
4507
- }
4508
-
4509
- /**
4510
- * Determine if a value is a Date
4511
- *
4512
- * @param {Object} val The value to test
4513
- * @returns {boolean} True if value is a Date, otherwise false
4514
- */
4515
- function isDate(val) {
4516
- return toString.call(val) === '[object Date]';
4517
- }
4518
-
4519
- /**
4520
- * Determine if a value is a File
4521
- *
4522
- * @param {Object} val The value to test
4523
- * @returns {boolean} True if value is a File, otherwise false
4524
- */
4525
- function isFile(val) {
4526
- return toString.call(val) === '[object File]';
4527
- }
4528
-
4529
- /**
4530
- * Determine if a value is a Blob
4531
- *
4532
- * @param {Object} val The value to test
4533
- * @returns {boolean} True if value is a Blob, otherwise false
4534
- */
4535
- function isBlob(val) {
4536
- return toString.call(val) === '[object Blob]';
4537
- }
4538
-
4539
- /**
4540
- * Determine if a value is a Function
4541
- *
4542
- * @param {Object} val The value to test
4543
- * @returns {boolean} True if value is a Function, otherwise false
4544
- */
4545
- function isFunction(val) {
4546
- return toString.call(val) === '[object Function]';
4547
- }
4548
-
4549
- /**
4550
- * Determine if a value is a Stream
4551
- *
4552
- * @param {Object} val The value to test
4553
- * @returns {boolean} True if value is a Stream, otherwise false
4554
- */
4555
- function isStream(val) {
4556
- return isObject(val) && isFunction(val.pipe);
4557
- }
4558
-
4559
- /**
4560
- * Determine if a value is a URLSearchParams object
4561
- *
4562
- * @param {Object} val The value to test
4563
- * @returns {boolean} True if value is a URLSearchParams object, otherwise false
4564
- */
4565
- function isURLSearchParams(val) {
4566
- return toString.call(val) === '[object URLSearchParams]';
4567
- }
4568
-
4569
- /**
4570
- * Trim excess whitespace off the beginning and end of a string
4571
- *
4572
- * @param {String} str The String to trim
4573
- * @returns {String} The String freed of excess whitespace
4574
- */
4575
- function trim(str) {
4576
- return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, '');
4577
- }
4578
-
4579
- /**
4580
- * Determine if we're running in a standard browser environment
4581
- *
4582
- * This allows axios to run in a web worker, and react-native.
4583
- * Both environments support XMLHttpRequest, but not fully standard globals.
4584
- *
4585
- * web workers:
4586
- * typeof window -> undefined
4587
- * typeof document -> undefined
4588
- *
4589
- * react-native:
4590
- * navigator.product -> 'ReactNative'
4591
- * nativescript
4592
- * navigator.product -> 'NativeScript' or 'NS'
4593
- */
4594
- function isStandardBrowserEnv() {
4595
- if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
4596
- navigator.product === 'NativeScript' ||
4597
- navigator.product === 'NS')) {
4598
- return false;
4599
- }
4600
- return (
4601
- typeof window !== 'undefined' &&
4602
- typeof document !== 'undefined'
4603
- );
4604
- }
4605
-
4606
- /**
4607
- * Iterate over an Array or an Object invoking a function for each item.
4608
- *
4609
- * If `obj` is an Array callback will be called passing
4610
- * the value, index, and complete array for each item.
4611
- *
4612
- * If 'obj' is an Object callback will be called passing
4613
- * the value, key, and complete object for each property.
4614
- *
4615
- * @param {Object|Array} obj The object to iterate
4616
- * @param {Function} fn The callback to invoke for each item
4617
- */
4618
- function forEach(obj, fn) {
4619
- // Don't bother if no value provided
4620
- if (obj === null || typeof obj === 'undefined') {
4621
- return;
4622
- }
4623
-
4624
- // Force an array if not already something iterable
4625
- if (typeof obj !== 'object') {
4626
- /*eslint no-param-reassign:0*/
4627
- obj = [obj];
4628
- }
4629
-
4630
- if (isArray(obj)) {
4631
- // Iterate over array values
4632
- for (var i = 0, l = obj.length; i < l; i++) {
4633
- fn.call(null, obj[i], i, obj);
4634
- }
4635
- } else {
4636
- // Iterate over object keys
4637
- for (var key in obj) {
4638
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
4639
- fn.call(null, obj[key], key, obj);
4640
- }
4641
- }
4642
- }
4643
- }
4644
-
4645
- /**
4646
- * Accepts varargs expecting each argument to be an object, then
4647
- * immutably merges the properties of each object and returns result.
4648
- *
4649
- * When multiple objects contain the same key the later object in
4650
- * the arguments list will take precedence.
4651
- *
4652
- * Example:
4653
- *
4654
- * ```js
4655
- * var result = merge({foo: 123}, {foo: 456});
4656
- * console.log(result.foo); // outputs 456
4657
- * ```
4658
- *
4659
- * @param {Object} obj1 Object to merge
4660
- * @returns {Object} Result of all merge properties
4661
- */
4662
- function merge(/* obj1, obj2, obj3, ... */) {
4663
- var result = {};
4664
- function assignValue(val, key) {
4665
- if (isPlainObject(result[key]) && isPlainObject(val)) {
4666
- result[key] = merge(result[key], val);
4667
- } else if (isPlainObject(val)) {
4668
- result[key] = merge({}, val);
4669
- } else if (isArray(val)) {
4670
- result[key] = val.slice();
4671
- } else {
4672
- result[key] = val;
4673
- }
4674
- }
4675
-
4676
- for (var i = 0, l = arguments.length; i < l; i++) {
4677
- forEach(arguments[i], assignValue);
4678
- }
4679
- return result;
4680
- }
4681
-
4682
- /**
4683
- * Extends object a by mutably adding to it the properties of object b.
4684
- *
4685
- * @param {Object} a The object to be extended
4686
- * @param {Object} b The object to copy properties from
4687
- * @param {Object} thisArg The object to bind function to
4688
- * @return {Object} The resulting value of object a
4689
- */
4690
- function extend(a, b, thisArg) {
4691
- forEach(b, function assignValue(val, key) {
4692
- if (thisArg && typeof val === 'function') {
4693
- a[key] = bind(val, thisArg);
4694
- } else {
4695
- a[key] = val;
4696
- }
4697
- });
4698
- return a;
4699
- }
4700
-
4701
- /**
4702
- * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
4703
- *
4704
- * @param {string} content with BOM
4705
- * @return {string} content value without BOM
4706
- */
4707
- function stripBOM(content) {
4708
- if (content.charCodeAt(0) === 0xFEFF) {
4709
- content = content.slice(1);
4710
- }
4711
- return content;
4712
- }
4713
-
4714
- var utils = {
4715
- isArray: isArray,
4716
- isArrayBuffer: isArrayBuffer,
4717
- isBuffer: isBuffer,
4718
- isFormData: isFormData,
4719
- isArrayBufferView: isArrayBufferView,
4720
- isString: isString,
4721
- isNumber: isNumber,
4722
- isObject: isObject,
4723
- isPlainObject: isPlainObject,
4724
- isUndefined: isUndefined,
4725
- isDate: isDate,
4726
- isFile: isFile,
4727
- isBlob: isBlob,
4728
- isFunction: isFunction,
4729
- isStream: isStream,
4730
- isURLSearchParams: isURLSearchParams,
4731
- isStandardBrowserEnv: isStandardBrowserEnv,
4732
- forEach: forEach,
4733
- merge: merge,
4734
- extend: extend,
4735
- trim: trim,
4736
- stripBOM: stripBOM
4737
- };
4738
-
4739
- function encode(val) {
4740
- return encodeURIComponent(val).
4741
- replace(/%3A/gi, ':').
4742
- replace(/%24/g, '$').
4743
- replace(/%2C/gi, ',').
4744
- replace(/%20/g, '+').
4745
- replace(/%5B/gi, '[').
4746
- replace(/%5D/gi, ']');
4747
- }
4748
-
4749
- /**
4750
- * Build a URL by appending params to the end
4751
- *
4752
- * @param {string} url The base of the url (e.g., http://www.google.com)
4753
- * @param {object} [params] The params to be appended
4754
- * @returns {string} The formatted url
4755
- */
4756
- var buildURL = function buildURL(url, params, paramsSerializer) {
4757
- /*eslint no-param-reassign:0*/
4758
- if (!params) {
4759
- return url;
4760
- }
4761
-
4762
- var serializedParams;
4763
- if (paramsSerializer) {
4764
- serializedParams = paramsSerializer(params);
4765
- } else if (utils.isURLSearchParams(params)) {
4766
- serializedParams = params.toString();
4767
- } else {
4768
- var parts = [];
4769
-
4770
- utils.forEach(params, function serialize(val, key) {
4771
- if (val === null || typeof val === 'undefined') {
4772
- return;
4773
- }
4774
-
4775
- if (utils.isArray(val)) {
4776
- key = key + '[]';
4777
- } else {
4778
- val = [val];
4779
- }
4780
-
4781
- utils.forEach(val, function parseValue(v) {
4782
- if (utils.isDate(v)) {
4783
- v = v.toISOString();
4784
- } else if (utils.isObject(v)) {
4785
- v = JSON.stringify(v);
4786
- }
4787
- parts.push(encode(key) + '=' + encode(v));
4788
- });
4789
- });
4790
-
4791
- serializedParams = parts.join('&');
4792
- }
4793
-
4794
- if (serializedParams) {
4795
- var hashmarkIndex = url.indexOf('#');
4796
- if (hashmarkIndex !== -1) {
4797
- url = url.slice(0, hashmarkIndex);
4798
- }
4799
-
4800
- url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
4801
- }
4802
-
4803
- return url;
4804
- };
4805
-
4806
- function InterceptorManager() {
4807
- this.handlers = [];
4808
- }
4809
-
4810
- /**
4811
- * Add a new interceptor to the stack
4812
- *
4813
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
4814
- * @param {Function} rejected The function to handle `reject` for a `Promise`
4815
- *
4816
- * @return {Number} An ID used to remove interceptor later
4817
- */
4818
- InterceptorManager.prototype.use = function use(fulfilled, rejected, options) {
4819
- this.handlers.push({
4820
- fulfilled: fulfilled,
4821
- rejected: rejected,
4822
- synchronous: options ? options.synchronous : false,
4823
- runWhen: options ? options.runWhen : null
4824
- });
4825
- return this.handlers.length - 1;
4826
- };
4827
-
4828
- /**
4829
- * Remove an interceptor from the stack
4830
- *
4831
- * @param {Number} id The ID that was returned by `use`
4832
- */
4833
- InterceptorManager.prototype.eject = function eject(id) {
4834
- if (this.handlers[id]) {
4835
- this.handlers[id] = null;
4836
- }
4837
- };
4838
-
4839
- /**
4840
- * Iterate over all the registered interceptors
4841
- *
4842
- * This method is particularly useful for skipping over any
4843
- * interceptors that may have become `null` calling `eject`.
4844
- *
4845
- * @param {Function} fn The function to call for each interceptor
4846
- */
4847
- InterceptorManager.prototype.forEach = function forEach(fn) {
4848
- utils.forEach(this.handlers, function forEachHandler(h) {
4849
- if (h !== null) {
4850
- fn(h);
4851
- }
4852
- });
4853
- };
4854
-
4855
- var InterceptorManager_1 = InterceptorManager;
4856
-
4857
- var normalizeHeaderName = function normalizeHeaderName(headers, normalizedName) {
4858
- utils.forEach(headers, function processHeader(value, name) {
4859
- if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
4860
- headers[normalizedName] = value;
4861
- delete headers[name];
4862
- }
4863
- });
4864
- };
4865
-
4866
- /**
4867
- * Update an Error with the specified config, error code, and response.
4868
- *
4869
- * @param {Error} error The error to update.
4870
- * @param {Object} config The config.
4871
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
4872
- * @param {Object} [request] The request.
4873
- * @param {Object} [response] The response.
4874
- * @returns {Error} The error.
4875
- */
4876
- var enhanceError = function enhanceError(error, config, code, request, response) {
4877
- error.config = config;
4878
- if (code) {
4879
- error.code = code;
4880
- }
4881
-
4882
- error.request = request;
4883
- error.response = response;
4884
- error.isAxiosError = true;
4885
-
4886
- error.toJSON = function toJSON() {
4887
- return {
4888
- // Standard
4889
- message: this.message,
4890
- name: this.name,
4891
- // Microsoft
4892
- description: this.description,
4893
- number: this.number,
4894
- // Mozilla
4895
- fileName: this.fileName,
4896
- lineNumber: this.lineNumber,
4897
- columnNumber: this.columnNumber,
4898
- stack: this.stack,
4899
- // Axios
4900
- config: this.config,
4901
- code: this.code,
4902
- status: this.response && this.response.status ? this.response.status : null
4903
- };
4904
- };
4905
- return error;
4906
- };
4907
-
4908
- /**
4909
- * Create an Error with the specified message, config, error code, request and response.
4910
- *
4911
- * @param {string} message The error message.
4912
- * @param {Object} config The config.
4913
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
4914
- * @param {Object} [request] The request.
4915
- * @param {Object} [response] The response.
4916
- * @returns {Error} The created error.
4917
- */
4918
- var createError = function createError(message, config, code, request, response) {
4919
- var error = new Error(message);
4920
- return enhanceError(error, config, code, request, response);
4921
- };
4922
-
4923
- /**
4924
- * Resolve or reject a Promise based on response status.
4925
- *
4926
- * @param {Function} resolve A function that resolves the promise.
4927
- * @param {Function} reject A function that rejects the promise.
4928
- * @param {object} response The response.
4929
- */
4930
- var settle = function settle(resolve, reject, response) {
4931
- var validateStatus = response.config.validateStatus;
4932
- if (!response.status || !validateStatus || validateStatus(response.status)) {
4933
- resolve(response);
4934
- } else {
4935
- reject(createError(
4936
- 'Request failed with status code ' + response.status,
4937
- response.config,
4938
- null,
4939
- response.request,
4940
- response
4941
- ));
4942
- }
4943
- };
4944
-
4945
- var cookies = (
4946
- utils.isStandardBrowserEnv() ?
4947
-
4948
- // Standard browser envs support document.cookie
4949
- (function standardBrowserEnv() {
4950
- return {
4951
- write: function write(name, value, expires, path, domain, secure) {
4952
- var cookie = [];
4953
- cookie.push(name + '=' + encodeURIComponent(value));
4954
-
4955
- if (utils.isNumber(expires)) {
4956
- cookie.push('expires=' + new Date(expires).toGMTString());
4957
- }
4958
-
4959
- if (utils.isString(path)) {
4960
- cookie.push('path=' + path);
4961
- }
4962
-
4963
- if (utils.isString(domain)) {
4964
- cookie.push('domain=' + domain);
4965
- }
4966
-
4967
- if (secure === true) {
4968
- cookie.push('secure');
4969
- }
4970
-
4971
- document.cookie = cookie.join('; ');
4972
- },
4973
-
4974
- read: function read(name) {
4975
- var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
4976
- return (match ? decodeURIComponent(match[3]) : null);
4977
- },
4978
-
4979
- remove: function remove(name) {
4980
- this.write(name, '', Date.now() - 86400000);
4981
- }
4982
- };
4983
- })() :
4984
-
4985
- // Non standard browser env (web workers, react-native) lack needed support.
4986
- (function nonStandardBrowserEnv() {
4987
- return {
4988
- write: function write() {},
4989
- read: function read() { return null; },
4990
- remove: function remove() {}
4991
- };
4992
- })()
4993
- );
4994
-
4995
- /**
4996
- * Determines whether the specified URL is absolute
4997
- *
4998
- * @param {string} url The URL to test
4999
- * @returns {boolean} True if the specified URL is absolute, otherwise false
5000
- */
5001
- var isAbsoluteURL = function isAbsoluteURL(url) {
5002
- // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
5003
- // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
5004
- // by any combination of letters, digits, plus, period, or hyphen.
5005
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
5006
- };
5007
-
5008
- /**
5009
- * Creates a new URL by combining the specified URLs
5010
- *
5011
- * @param {string} baseURL The base URL
5012
- * @param {string} relativeURL The relative URL
5013
- * @returns {string} The combined URL
5014
- */
5015
- var combineURLs = function combineURLs(baseURL, relativeURL) {
5016
- return relativeURL
5017
- ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
5018
- : baseURL;
5019
- };
5020
-
5021
- /**
5022
- * Creates a new URL by combining the baseURL with the requestedURL,
5023
- * only when the requestedURL is not already an absolute URL.
5024
- * If the requestURL is absolute, this function returns the requestedURL untouched.
5025
- *
5026
- * @param {string} baseURL The base URL
5027
- * @param {string} requestedURL Absolute or relative URL to combine
5028
- * @returns {string} The combined full path
5029
- */
5030
- var buildFullPath = function buildFullPath(baseURL, requestedURL) {
5031
- if (baseURL && !isAbsoluteURL(requestedURL)) {
5032
- return combineURLs(baseURL, requestedURL);
5033
- }
5034
- return requestedURL;
5035
- };
5036
-
5037
- // Headers whose duplicates are ignored by node
5038
- // c.f. https://nodejs.org/api/http.html#http_message_headers
5039
- var ignoreDuplicateOf = [
5040
- 'age', 'authorization', 'content-length', 'content-type', 'etag',
5041
- 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
5042
- 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
5043
- 'referer', 'retry-after', 'user-agent'
5044
- ];
5045
-
5046
- /**
5047
- * Parse headers into an object
5048
- *
5049
- * ```
5050
- * Date: Wed, 27 Aug 2014 08:58:49 GMT
5051
- * Content-Type: application/json
5052
- * Connection: keep-alive
5053
- * Transfer-Encoding: chunked
5054
- * ```
5055
- *
5056
- * @param {String} headers Headers needing to be parsed
5057
- * @returns {Object} Headers parsed into an object
5058
- */
5059
- var parseHeaders = function parseHeaders(headers) {
5060
- var parsed = {};
5061
- var key;
5062
- var val;
5063
- var i;
5064
-
5065
- if (!headers) { return parsed; }
5066
-
5067
- utils.forEach(headers.split('\n'), function parser(line) {
5068
- i = line.indexOf(':');
5069
- key = utils.trim(line.substr(0, i)).toLowerCase();
5070
- val = utils.trim(line.substr(i + 1));
5071
-
5072
- if (key) {
5073
- if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
5074
- return;
5075
- }
5076
- if (key === 'set-cookie') {
5077
- parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
5078
- } else {
5079
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
5080
- }
5081
- }
5082
- });
5083
-
5084
- return parsed;
5085
- };
5086
-
5087
- var isURLSameOrigin = (
5088
- utils.isStandardBrowserEnv() ?
5089
-
5090
- // Standard browser envs have full support of the APIs needed to test
5091
- // whether the request URL is of the same origin as current location.
5092
- (function standardBrowserEnv() {
5093
- var msie = /(msie|trident)/i.test(navigator.userAgent);
5094
- var urlParsingNode = document.createElement('a');
5095
- var originURL;
5096
-
5097
- /**
5098
- * Parse a URL to discover it's components
5099
- *
5100
- * @param {String} url The URL to be parsed
5101
- * @returns {Object}
5102
- */
5103
- function resolveURL(url) {
5104
- var href = url;
5105
-
5106
- if (msie) {
5107
- // IE needs attribute set twice to normalize properties
5108
- urlParsingNode.setAttribute('href', href);
5109
- href = urlParsingNode.href;
5110
- }
5111
-
5112
- urlParsingNode.setAttribute('href', href);
5113
-
5114
- // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
5115
- return {
5116
- href: urlParsingNode.href,
5117
- protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
5118
- host: urlParsingNode.host,
5119
- search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
5120
- hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
5121
- hostname: urlParsingNode.hostname,
5122
- port: urlParsingNode.port,
5123
- pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
5124
- urlParsingNode.pathname :
5125
- '/' + urlParsingNode.pathname
5126
- };
5127
- }
5128
-
5129
- originURL = resolveURL(window.location.href);
5130
-
5131
- /**
5132
- * Determine if a URL shares the same origin as the current location
5133
- *
5134
- * @param {String} requestURL The URL to test
5135
- * @returns {boolean} True if URL shares the same origin, otherwise false
5136
- */
5137
- return function isURLSameOrigin(requestURL) {
5138
- var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
5139
- return (parsed.protocol === originURL.protocol &&
5140
- parsed.host === originURL.host);
5141
- };
5142
- })() :
5143
-
5144
- // Non standard browser envs (web workers, react-native) lack needed support.
5145
- (function nonStandardBrowserEnv() {
5146
- return function isURLSameOrigin() {
5147
- return true;
5148
- };
5149
- })()
5150
- );
5151
-
5152
- /**
5153
- * A `Cancel` is an object that is thrown when an operation is canceled.
5154
- *
5155
- * @class
5156
- * @param {string=} message The message.
5157
- */
5158
- function Cancel(message) {
5159
- this.message = message;
5160
- }
5161
-
5162
- Cancel.prototype.toString = function toString() {
5163
- return 'Cancel' + (this.message ? ': ' + this.message : '');
5164
- };
5165
-
5166
- Cancel.prototype.__CANCEL__ = true;
5167
-
5168
- var Cancel_1 = Cancel;
5169
-
5170
- var defaults$1 = defaults_1;
5171
-
5172
- var xhr = function xhrAdapter(config) {
5173
- return new Promise(function dispatchXhrRequest(resolve, reject) {
5174
- var requestData = config.data;
5175
- var requestHeaders = config.headers;
5176
- var responseType = config.responseType;
5177
- var onCanceled;
5178
- function done() {
5179
- if (config.cancelToken) {
5180
- config.cancelToken.unsubscribe(onCanceled);
5181
- }
5182
-
5183
- if (config.signal) {
5184
- config.signal.removeEventListener('abort', onCanceled);
5185
- }
5186
- }
5187
-
5188
- if (utils.isFormData(requestData)) {
5189
- delete requestHeaders['Content-Type']; // Let the browser set it
5190
- }
5191
-
5192
- var request = new XMLHttpRequest();
5193
-
5194
- // HTTP basic authentication
5195
- if (config.auth) {
5196
- var username = config.auth.username || '';
5197
- var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
5198
- requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
5199
- }
5200
-
5201
- var fullPath = buildFullPath(config.baseURL, config.url);
5202
- request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
5203
-
5204
- // Set the request timeout in MS
5205
- request.timeout = config.timeout;
5206
-
5207
- function onloadend() {
5208
- if (!request) {
5209
- return;
5210
- }
5211
- // Prepare the response
5212
- var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
5213
- var responseData = !responseType || responseType === 'text' || responseType === 'json' ?
5214
- request.responseText : request.response;
5215
- var response = {
5216
- data: responseData,
5217
- status: request.status,
5218
- statusText: request.statusText,
5219
- headers: responseHeaders,
5220
- config: config,
5221
- request: request
5222
- };
5223
-
5224
- settle(function _resolve(value) {
5225
- resolve(value);
5226
- done();
5227
- }, function _reject(err) {
5228
- reject(err);
5229
- done();
5230
- }, response);
5231
-
5232
- // Clean up request
5233
- request = null;
5234
- }
5235
-
5236
- if ('onloadend' in request) {
5237
- // Use onloadend if available
5238
- request.onloadend = onloadend;
5239
- } else {
5240
- // Listen for ready state to emulate onloadend
5241
- request.onreadystatechange = function handleLoad() {
5242
- if (!request || request.readyState !== 4) {
5243
- return;
5244
- }
5245
-
5246
- // The request errored out and we didn't get a response, this will be
5247
- // handled by onerror instead
5248
- // With one exception: request that using file: protocol, most browsers
5249
- // will return status as 0 even though it's a successful request
5250
- if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
5251
- return;
5252
- }
5253
- // readystate handler is calling before onerror or ontimeout handlers,
5254
- // so we should call onloadend on the next 'tick'
5255
- setTimeout(onloadend);
5256
- };
5257
- }
5258
-
5259
- // Handle browser request cancellation (as opposed to a manual cancellation)
5260
- request.onabort = function handleAbort() {
5261
- if (!request) {
5262
- return;
5263
- }
5264
-
5265
- reject(createError('Request aborted', config, 'ECONNABORTED', request));
5266
-
5267
- // Clean up request
5268
- request = null;
5269
- };
5270
-
5271
- // Handle low level network errors
5272
- request.onerror = function handleError() {
5273
- // Real errors are hidden from us by the browser
5274
- // onerror should only fire if it's a network error
5275
- reject(createError('Network Error', config, null, request));
5276
-
5277
- // Clean up request
5278
- request = null;
5279
- };
5280
-
5281
- // Handle timeout
5282
- request.ontimeout = function handleTimeout() {
5283
- var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
5284
- var transitional = config.transitional || defaults$1.transitional;
5285
- if (config.timeoutErrorMessage) {
5286
- timeoutErrorMessage = config.timeoutErrorMessage;
5287
- }
5288
- reject(createError(
5289
- timeoutErrorMessage,
5290
- config,
5291
- transitional.clarifyTimeoutError ? 'ETIMEDOUT' : 'ECONNABORTED',
5292
- request));
5293
-
5294
- // Clean up request
5295
- request = null;
5296
- };
5297
-
5298
- // Add xsrf header
5299
- // This is only done if running in a standard browser environment.
5300
- // Specifically not if we're in a web worker, or react-native.
5301
- if (utils.isStandardBrowserEnv()) {
5302
- // Add xsrf header
5303
- var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
5304
- cookies.read(config.xsrfCookieName) :
5305
- undefined;
5306
-
5307
- if (xsrfValue) {
5308
- requestHeaders[config.xsrfHeaderName] = xsrfValue;
5309
- }
5310
- }
5311
-
5312
- // Add headers to the request
5313
- if ('setRequestHeader' in request) {
5314
- utils.forEach(requestHeaders, function setRequestHeader(val, key) {
5315
- if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
5316
- // Remove Content-Type if data is undefined
5317
- delete requestHeaders[key];
5318
- } else {
5319
- // Otherwise add header to the request
5320
- request.setRequestHeader(key, val);
5321
- }
5322
- });
5323
- }
5324
-
5325
- // Add withCredentials to request if needed
5326
- if (!utils.isUndefined(config.withCredentials)) {
5327
- request.withCredentials = !!config.withCredentials;
5328
- }
5329
-
5330
- // Add responseType to request if needed
5331
- if (responseType && responseType !== 'json') {
5332
- request.responseType = config.responseType;
5333
- }
5334
-
5335
- // Handle progress if needed
5336
- if (typeof config.onDownloadProgress === 'function') {
5337
- request.addEventListener('progress', config.onDownloadProgress);
5338
- }
5339
-
5340
- // Not all browsers support upload events
5341
- if (typeof config.onUploadProgress === 'function' && request.upload) {
5342
- request.upload.addEventListener('progress', config.onUploadProgress);
5343
- }
5344
-
5345
- if (config.cancelToken || config.signal) {
5346
- // Handle cancellation
5347
- // eslint-disable-next-line func-names
5348
- onCanceled = function(cancel) {
5349
- if (!request) {
5350
- return;
5351
- }
5352
- reject(!cancel || (cancel && cancel.type) ? new Cancel_1('canceled') : cancel);
5353
- request.abort();
5354
- request = null;
5355
- };
5356
-
5357
- config.cancelToken && config.cancelToken.subscribe(onCanceled);
5358
- if (config.signal) {
5359
- config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
5360
- }
5361
- }
5362
-
5363
- if (!requestData) {
5364
- requestData = null;
5365
- }
5366
-
5367
- // Send the request
5368
- request.send(requestData);
5369
- });
5370
- };
5371
-
5372
- function createCommonjsModule(fn, basedir, module) {
5373
- return module = {
5374
- path: basedir,
5375
- exports: {},
5376
- require: function (path, base) {
5377
- return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
5378
- }
5379
- }, fn(module, module.exports), module.exports;
5380
- }
5381
-
5382
- function commonjsRequire () {
5383
- throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
5384
- }
5385
-
5386
- /**
5387
- * Helpers.
5388
- */
5389
-
5390
- var s = 1000;
5391
- var m = s * 60;
5392
- var h = m * 60;
5393
- var d = h * 24;
5394
- var w = d * 7;
5395
- var y = d * 365.25;
5396
-
5397
- /**
5398
- * Parse or format the given `val`.
5399
- *
5400
- * Options:
5401
- *
5402
- * - `long` verbose formatting [false]
5403
- *
5404
- * @param {String|Number} val
5405
- * @param {Object} [options]
5406
- * @throws {Error} throw an error if val is not a non-empty string or a number
5407
- * @return {String|Number}
5408
- * @api public
5409
- */
5410
-
5411
- var ms = function(val, options) {
5412
- options = options || {};
5413
- var type = typeof val;
5414
- if (type === 'string' && val.length > 0) {
5415
- return parse(val);
5416
- } else if (type === 'number' && isFinite(val)) {
5417
- return options.long ? fmtLong(val) : fmtShort(val);
5418
- }
5419
- throw new Error(
5420
- 'val is not a non-empty string or a valid number. val=' +
5421
- JSON.stringify(val)
5422
- );
5423
- };
5424
-
5425
- /**
5426
- * Parse the given `str` and return milliseconds.
5427
- *
5428
- * @param {String} str
5429
- * @return {Number}
5430
- * @api private
5431
- */
5432
-
5433
- function parse(str) {
5434
- str = String(str);
5435
- if (str.length > 100) {
5436
- return;
5437
- }
5438
- var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
5439
- str
5440
- );
5441
- if (!match) {
5442
- return;
5443
- }
5444
- var n = parseFloat(match[1]);
5445
- var type = (match[2] || 'ms').toLowerCase();
5446
- switch (type) {
5447
- case 'years':
5448
- case 'year':
5449
- case 'yrs':
5450
- case 'yr':
5451
- case 'y':
5452
- return n * y;
5453
- case 'weeks':
5454
- case 'week':
5455
- case 'w':
5456
- return n * w;
5457
- case 'days':
5458
- case 'day':
5459
- case 'd':
5460
- return n * d;
5461
- case 'hours':
5462
- case 'hour':
5463
- case 'hrs':
5464
- case 'hr':
5465
- case 'h':
5466
- return n * h;
5467
- case 'minutes':
5468
- case 'minute':
5469
- case 'mins':
5470
- case 'min':
5471
- case 'm':
5472
- return n * m;
5473
- case 'seconds':
5474
- case 'second':
5475
- case 'secs':
5476
- case 'sec':
5477
- case 's':
5478
- return n * s;
5479
- case 'milliseconds':
5480
- case 'millisecond':
5481
- case 'msecs':
5482
- case 'msec':
5483
- case 'ms':
5484
- return n;
5485
- default:
5486
- return undefined;
5487
- }
5488
- }
5489
-
5490
- /**
5491
- * Short format for `ms`.
5492
- *
5493
- * @param {Number} ms
5494
- * @return {String}
5495
- * @api private
5496
- */
5497
-
5498
- function fmtShort(ms) {
5499
- var msAbs = Math.abs(ms);
5500
- if (msAbs >= d) {
5501
- return Math.round(ms / d) + 'd';
5502
- }
5503
- if (msAbs >= h) {
5504
- return Math.round(ms / h) + 'h';
5505
- }
5506
- if (msAbs >= m) {
5507
- return Math.round(ms / m) + 'm';
5508
- }
5509
- if (msAbs >= s) {
5510
- return Math.round(ms / s) + 's';
5511
- }
5512
- return ms + 'ms';
5513
- }
5514
-
5515
- /**
5516
- * Long format for `ms`.
5517
- *
5518
- * @param {Number} ms
5519
- * @return {String}
5520
- * @api private
5521
- */
5522
-
5523
- function fmtLong(ms) {
5524
- var msAbs = Math.abs(ms);
5525
- if (msAbs >= d) {
5526
- return plural(ms, msAbs, d, 'day');
5527
- }
5528
- if (msAbs >= h) {
5529
- return plural(ms, msAbs, h, 'hour');
5530
- }
5531
- if (msAbs >= m) {
5532
- return plural(ms, msAbs, m, 'minute');
5533
- }
5534
- if (msAbs >= s) {
5535
- return plural(ms, msAbs, s, 'second');
5536
- }
5537
- return ms + ' ms';
5538
- }
5539
-
5540
- /**
5541
- * Pluralization helper.
5542
- */
5543
-
5544
- function plural(ms, msAbs, n, name) {
5545
- var isPlural = msAbs >= n * 1.5;
5546
- return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
5547
- }
5548
-
5549
- /**
5550
- * This is the common logic for both the Node.js and web browser
5551
- * implementations of `debug()`.
5552
- */
5553
-
5554
- function setup(env) {
5555
- createDebug.debug = createDebug;
5556
- createDebug.default = createDebug;
5557
- createDebug.coerce = coerce;
5558
- createDebug.disable = disable;
5559
- createDebug.enable = enable;
5560
- createDebug.enabled = enabled;
5561
- createDebug.humanize = ms;
5562
- createDebug.destroy = destroy;
5563
-
5564
- Object.keys(env).forEach(key => {
5565
- createDebug[key] = env[key];
5566
- });
5567
-
5568
- /**
5569
- * The currently active debug mode names, and names to skip.
5570
- */
5571
-
5572
- createDebug.names = [];
5573
- createDebug.skips = [];
5574
-
5575
- /**
5576
- * Map of special "%n" handling functions, for the debug "format" argument.
5577
- *
5578
- * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
5579
- */
5580
- createDebug.formatters = {};
5581
-
5582
- /**
5583
- * Selects a color for a debug namespace
5584
- * @param {String} namespace The namespace string for the for the debug instance to be colored
5585
- * @return {Number|String} An ANSI color code for the given namespace
5586
- * @api private
5587
- */
5588
- function selectColor(namespace) {
5589
- let hash = 0;
5590
-
5591
- for (let i = 0; i < namespace.length; i++) {
5592
- hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
5593
- hash |= 0; // Convert to 32bit integer
5594
- }
5595
-
5596
- return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
5597
- }
5598
- createDebug.selectColor = selectColor;
5599
-
5600
- /**
5601
- * Create a debugger with the given `namespace`.
5602
- *
5603
- * @param {String} namespace
5604
- * @return {Function}
5605
- * @api public
5606
- */
5607
- function createDebug(namespace) {
5608
- let prevTime;
5609
- let enableOverride = null;
5610
- let namespacesCache;
5611
- let enabledCache;
5612
-
5613
- function debug(...args) {
5614
- // Disabled?
5615
- if (!debug.enabled) {
5616
- return;
5617
- }
5618
-
5619
- const self = debug;
5620
-
5621
- // Set `diff` timestamp
5622
- const curr = Number(new Date());
5623
- const ms = curr - (prevTime || curr);
5624
- self.diff = ms;
5625
- self.prev = prevTime;
5626
- self.curr = curr;
5627
- prevTime = curr;
5628
-
5629
- args[0] = createDebug.coerce(args[0]);
5630
-
5631
- if (typeof args[0] !== 'string') {
5632
- // Anything else let's inspect with %O
5633
- args.unshift('%O');
5634
- }
5635
-
5636
- // Apply any `formatters` transformations
5637
- let index = 0;
5638
- args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
5639
- // If we encounter an escaped % then don't increase the array index
5640
- if (match === '%%') {
5641
- return '%';
5642
- }
5643
- index++;
5644
- const formatter = createDebug.formatters[format];
5645
- if (typeof formatter === 'function') {
5646
- const val = args[index];
5647
- match = formatter.call(self, val);
5648
-
5649
- // Now we need to remove `args[index]` since it's inlined in the `format`
5650
- args.splice(index, 1);
5651
- index--;
5652
- }
5653
- return match;
5654
- });
5655
-
5656
- // Apply env-specific formatting (colors, etc.)
5657
- createDebug.formatArgs.call(self, args);
5658
-
5659
- const logFn = self.log || createDebug.log;
5660
- logFn.apply(self, args);
5661
- }
5662
-
5663
- debug.namespace = namespace;
5664
- debug.useColors = createDebug.useColors();
5665
- debug.color = createDebug.selectColor(namespace);
5666
- debug.extend = extend;
5667
- debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
5668
-
5669
- Object.defineProperty(debug, 'enabled', {
5670
- enumerable: true,
5671
- configurable: false,
5672
- get: () => {
5673
- if (enableOverride !== null) {
5674
- return enableOverride;
5675
- }
5676
- if (namespacesCache !== createDebug.namespaces) {
5677
- namespacesCache = createDebug.namespaces;
5678
- enabledCache = createDebug.enabled(namespace);
5679
- }
5680
-
5681
- return enabledCache;
5682
- },
5683
- set: v => {
5684
- enableOverride = v;
5685
- }
5686
- });
5687
-
5688
- // Env-specific initialization logic for debug instances
5689
- if (typeof createDebug.init === 'function') {
5690
- createDebug.init(debug);
5691
- }
5692
-
5693
- return debug;
5694
- }
5695
-
5696
- function extend(namespace, delimiter) {
5697
- const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
5698
- newDebug.log = this.log;
5699
- return newDebug;
5700
- }
5701
-
5702
- /**
5703
- * Enables a debug mode by namespaces. This can include modes
5704
- * separated by a colon and wildcards.
5705
- *
5706
- * @param {String} namespaces
5707
- * @api public
5708
- */
5709
- function enable(namespaces) {
5710
- createDebug.save(namespaces);
5711
- createDebug.namespaces = namespaces;
5712
-
5713
- createDebug.names = [];
5714
- createDebug.skips = [];
5715
-
5716
- let i;
5717
- const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
5718
- const len = split.length;
5719
-
5720
- for (i = 0; i < len; i++) {
5721
- if (!split[i]) {
5722
- // ignore empty strings
5723
- continue;
5724
- }
5725
-
5726
- namespaces = split[i].replace(/\*/g, '.*?');
5727
-
5728
- if (namespaces[0] === '-') {
5729
- createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
5730
- } else {
5731
- createDebug.names.push(new RegExp('^' + namespaces + '$'));
5732
- }
5733
- }
5734
- }
5735
-
5736
- /**
5737
- * Disable debug output.
5738
- *
5739
- * @return {String} namespaces
5740
- * @api public
5741
- */
5742
- function disable() {
5743
- const namespaces = [
5744
- ...createDebug.names.map(toNamespace),
5745
- ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
5746
- ].join(',');
5747
- createDebug.enable('');
5748
- return namespaces;
5749
- }
5750
-
5751
- /**
5752
- * Returns true if the given mode name is enabled, false otherwise.
5753
- *
5754
- * @param {String} name
5755
- * @return {Boolean}
5756
- * @api public
5757
- */
5758
- function enabled(name) {
5759
- if (name[name.length - 1] === '*') {
5760
- return true;
5761
- }
5762
-
5763
- let i;
5764
- let len;
5765
-
5766
- for (i = 0, len = createDebug.skips.length; i < len; i++) {
5767
- if (createDebug.skips[i].test(name)) {
5768
- return false;
5769
- }
5770
- }
5771
-
5772
- for (i = 0, len = createDebug.names.length; i < len; i++) {
5773
- if (createDebug.names[i].test(name)) {
5774
- return true;
5775
- }
5776
- }
5777
-
5778
- return false;
5779
- }
5780
-
5781
- /**
5782
- * Convert regexp to namespace
5783
- *
5784
- * @param {RegExp} regxep
5785
- * @return {String} namespace
5786
- * @api private
5787
- */
5788
- function toNamespace(regexp) {
5789
- return regexp.toString()
5790
- .substring(2, regexp.toString().length - 2)
5791
- .replace(/\.\*\?$/, '*');
5792
- }
5793
-
5794
- /**
5795
- * Coerce `val`.
5796
- *
5797
- * @param {Mixed} val
5798
- * @return {Mixed}
5799
- * @api private
5800
- */
5801
- function coerce(val) {
5802
- if (val instanceof Error) {
5803
- return val.stack || val.message;
5804
- }
5805
- return val;
5806
- }
5807
-
5808
- /**
5809
- * XXX DO NOT USE. This is a temporary stub function.
5810
- * XXX It WILL be removed in the next major release.
5811
- */
5812
- function destroy() {
5813
- console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
5814
- }
5815
-
5816
- createDebug.enable(createDebug.load());
5817
-
5818
- return createDebug;
5819
- }
5820
-
5821
- var common = setup;
5822
-
5823
- var browser = createCommonjsModule(function (module, exports) {
5824
- /* eslint-env browser */
5825
-
5826
- /**
5827
- * This is the web browser implementation of `debug()`.
5828
- */
5829
-
5830
- exports.formatArgs = formatArgs;
5831
- exports.save = save;
5832
- exports.load = load;
5833
- exports.useColors = useColors;
5834
- exports.storage = localstorage();
5835
- exports.destroy = (() => {
5836
- let warned = false;
5837
-
5838
- return () => {
5839
- if (!warned) {
5840
- warned = true;
5841
- console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
5842
- }
5843
- };
5844
- })();
5845
-
5846
- /**
5847
- * Colors.
5848
- */
5849
-
5850
- exports.colors = [
5851
- '#0000CC',
5852
- '#0000FF',
5853
- '#0033CC',
5854
- '#0033FF',
5855
- '#0066CC',
5856
- '#0066FF',
5857
- '#0099CC',
5858
- '#0099FF',
5859
- '#00CC00',
5860
- '#00CC33',
5861
- '#00CC66',
5862
- '#00CC99',
5863
- '#00CCCC',
5864
- '#00CCFF',
5865
- '#3300CC',
5866
- '#3300FF',
5867
- '#3333CC',
5868
- '#3333FF',
5869
- '#3366CC',
5870
- '#3366FF',
5871
- '#3399CC',
5872
- '#3399FF',
5873
- '#33CC00',
5874
- '#33CC33',
5875
- '#33CC66',
5876
- '#33CC99',
5877
- '#33CCCC',
5878
- '#33CCFF',
5879
- '#6600CC',
5880
- '#6600FF',
5881
- '#6633CC',
5882
- '#6633FF',
5883
- '#66CC00',
5884
- '#66CC33',
5885
- '#9900CC',
5886
- '#9900FF',
5887
- '#9933CC',
5888
- '#9933FF',
5889
- '#99CC00',
5890
- '#99CC33',
5891
- '#CC0000',
5892
- '#CC0033',
5893
- '#CC0066',
5894
- '#CC0099',
5895
- '#CC00CC',
5896
- '#CC00FF',
5897
- '#CC3300',
5898
- '#CC3333',
5899
- '#CC3366',
5900
- '#CC3399',
5901
- '#CC33CC',
5902
- '#CC33FF',
5903
- '#CC6600',
5904
- '#CC6633',
5905
- '#CC9900',
5906
- '#CC9933',
5907
- '#CCCC00',
5908
- '#CCCC33',
5909
- '#FF0000',
5910
- '#FF0033',
5911
- '#FF0066',
5912
- '#FF0099',
5913
- '#FF00CC',
5914
- '#FF00FF',
5915
- '#FF3300',
5916
- '#FF3333',
5917
- '#FF3366',
5918
- '#FF3399',
5919
- '#FF33CC',
5920
- '#FF33FF',
5921
- '#FF6600',
5922
- '#FF6633',
5923
- '#FF9900',
5924
- '#FF9933',
5925
- '#FFCC00',
5926
- '#FFCC33'
5927
- ];
5928
-
5929
- /**
5930
- * Currently only WebKit-based Web Inspectors, Firefox >= v31,
5931
- * and the Firebug extension (any Firefox version) are known
5932
- * to support "%c" CSS customizations.
5933
- *
5934
- * TODO: add a `localStorage` variable to explicitly enable/disable colors
5935
- */
5936
-
5937
- // eslint-disable-next-line complexity
5938
- function useColors() {
5939
- // NB: In an Electron preload script, document will be defined but not fully
5940
- // initialized. Since we know we're in Chrome, we'll just detect this case
5941
- // explicitly
5942
- if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
5943
- return true;
5944
- }
5945
-
5946
- // Internet Explorer and Edge do not support colors.
5947
- if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
5948
- return false;
5949
- }
5950
-
5951
- // Is webkit? http://stackoverflow.com/a/16459606/376773
5952
- // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
5953
- return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
5954
- // Is firebug? http://stackoverflow.com/a/398120/376773
5955
- (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
5956
- // Is firefox >= v31?
5957
- // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
5958
- (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
5959
- // Double check webkit in userAgent just in case we are in a worker
5960
- (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
5961
- }
5962
-
5963
- /**
5964
- * Colorize log arguments if enabled.
5965
- *
5966
- * @api public
5967
- */
5968
-
5969
- function formatArgs(args) {
5970
- args[0] = (this.useColors ? '%c' : '') +
5971
- this.namespace +
5972
- (this.useColors ? ' %c' : ' ') +
5973
- args[0] +
5974
- (this.useColors ? '%c ' : ' ') +
5975
- '+' + module.exports.humanize(this.diff);
5976
-
5977
- if (!this.useColors) {
5978
- return;
5979
- }
5980
-
5981
- const c = 'color: ' + this.color;
5982
- args.splice(1, 0, c, 'color: inherit');
5983
-
5984
- // The final "%c" is somewhat tricky, because there could be other
5985
- // arguments passed either before or after the %c, so we need to
5986
- // figure out the correct index to insert the CSS into
5987
- let index = 0;
5988
- let lastC = 0;
5989
- args[0].replace(/%[a-zA-Z%]/g, match => {
5990
- if (match === '%%') {
5991
- return;
5992
- }
5993
- index++;
5994
- if (match === '%c') {
5995
- // We only are interested in the *last* %c
5996
- // (the user may have provided their own)
5997
- lastC = index;
5998
- }
5999
- });
6000
-
6001
- args.splice(lastC, 0, c);
6002
- }
6003
-
6004
- /**
6005
- * Invokes `console.debug()` when available.
6006
- * No-op when `console.debug` is not a "function".
6007
- * If `console.debug` is not available, falls back
6008
- * to `console.log`.
6009
- *
6010
- * @api public
6011
- */
6012
- exports.log = console.debug || console.log || (() => {});
6013
-
6014
- /**
6015
- * Save `namespaces`.
6016
- *
6017
- * @param {String} namespaces
6018
- * @api private
6019
- */
6020
- function save(namespaces) {
6021
- try {
6022
- if (namespaces) {
6023
- exports.storage.setItem('debug', namespaces);
6024
- } else {
6025
- exports.storage.removeItem('debug');
6026
- }
6027
- } catch (error) {
6028
- // Swallow
6029
- // XXX (@Qix-) should we be logging these?
6030
- }
6031
- }
6032
-
6033
- /**
6034
- * Load `namespaces`.
6035
- *
6036
- * @return {String} returns the previously persisted debug modes
6037
- * @api private
6038
- */
6039
- function load() {
6040
- let r;
6041
- try {
6042
- r = exports.storage.getItem('debug');
6043
- } catch (error) {
6044
- // Swallow
6045
- // XXX (@Qix-) should we be logging these?
6046
- }
6047
-
6048
- // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
6049
- if (!r && typeof process !== 'undefined' && 'env' in process) {
6050
- r = process.env.DEBUG;
6051
- }
6052
-
6053
- return r;
6054
- }
6055
-
6056
- /**
6057
- * Localstorage attempts to return the localstorage.
6058
- *
6059
- * This is necessary because safari throws
6060
- * when a user disables cookies/localstorage
6061
- * and you attempt to access it.
6062
- *
6063
- * @return {LocalStorage}
6064
- * @api private
6065
- */
6066
-
6067
- function localstorage() {
6068
- try {
6069
- // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
6070
- // The Browser also has localStorage in the global context.
6071
- return localStorage;
6072
- } catch (error) {
6073
- // Swallow
6074
- // XXX (@Qix-) should we be logging these?
6075
- }
6076
- }
6077
-
6078
- module.exports = common(exports);
6079
-
6080
- const {formatters} = module.exports;
6081
-
6082
- /**
6083
- * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
6084
- */
6085
-
6086
- formatters.j = function (v) {
6087
- try {
6088
- return JSON.stringify(v);
6089
- } catch (error) {
6090
- return '[UnexpectedJSONParseError]: ' + error.message;
6091
- }
6092
- };
6093
- });
6094
-
6095
- var hasFlag = (flag, argv) => {
6096
- argv = argv || process.argv;
6097
- const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
6098
- const pos = argv.indexOf(prefix + flag);
6099
- const terminatorPos = argv.indexOf('--');
6100
- return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
6101
- };
6102
-
6103
- const env = process.env;
6104
-
6105
- let forceColor;
6106
- if (hasFlag('no-color') ||
6107
- hasFlag('no-colors') ||
6108
- hasFlag('color=false')) {
6109
- forceColor = false;
6110
- } else if (hasFlag('color') ||
6111
- hasFlag('colors') ||
6112
- hasFlag('color=true') ||
6113
- hasFlag('color=always')) {
6114
- forceColor = true;
6115
- }
6116
- if ('FORCE_COLOR' in env) {
6117
- forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
6118
- }
6119
-
6120
- function translateLevel(level) {
6121
- if (level === 0) {
6122
- return false;
6123
- }
6124
-
6125
- return {
6126
- level,
6127
- hasBasic: true,
6128
- has256: level >= 2,
6129
- has16m: level >= 3
6130
- };
6131
- }
6132
-
6133
- function supportsColor(stream) {
6134
- if (forceColor === false) {
6135
- return 0;
6136
- }
6137
-
6138
- if (hasFlag('color=16m') ||
6139
- hasFlag('color=full') ||
6140
- hasFlag('color=truecolor')) {
6141
- return 3;
6142
- }
6143
-
6144
- if (hasFlag('color=256')) {
6145
- return 2;
6146
- }
6147
-
6148
- if (stream && !stream.isTTY && forceColor !== true) {
6149
- return 0;
6150
- }
6151
-
6152
- const min = forceColor ? 1 : 0;
6153
-
6154
- if (process.platform === 'win32') {
6155
- // Node.js 7.5.0 is the first version of Node.js to include a patch to
6156
- // libuv that enables 256 color output on Windows. Anything earlier and it
6157
- // won't work. However, here we target Node.js 8 at minimum as it is an LTS
6158
- // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows
6159
- // release that supports 256 colors. Windows 10 build 14931 is the first release
6160
- // that supports 16m/TrueColor.
6161
- const osRelease = os.release().split('.');
6162
- if (
6163
- Number(process.versions.node.split('.')[0]) >= 8 &&
6164
- Number(osRelease[0]) >= 10 &&
6165
- Number(osRelease[2]) >= 10586
6166
- ) {
6167
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
6168
- }
6169
-
6170
- return 1;
6171
- }
6172
-
6173
- if ('CI' in env) {
6174
- if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
6175
- return 1;
6176
- }
6177
-
6178
- return min;
6179
- }
6180
-
6181
- if ('TEAMCITY_VERSION' in env) {
6182
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
6183
- }
6184
-
6185
- if (env.COLORTERM === 'truecolor') {
6186
- return 3;
6187
- }
6188
-
6189
- if ('TERM_PROGRAM' in env) {
6190
- const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
6191
-
6192
- switch (env.TERM_PROGRAM) {
6193
- case 'iTerm.app':
6194
- return version >= 3 ? 3 : 2;
6195
- case 'Apple_Terminal':
6196
- return 2;
6197
- // No default
6198
- }
6199
- }
6200
-
6201
- if (/-256(color)?$/i.test(env.TERM)) {
6202
- return 2;
6203
- }
6204
-
6205
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
6206
- return 1;
6207
- }
6208
-
6209
- if ('COLORTERM' in env) {
6210
- return 1;
6211
- }
6212
-
6213
- if (env.TERM === 'dumb') {
6214
- return min;
6215
- }
6216
-
6217
- return min;
6218
- }
6219
-
6220
- function getSupportLevel(stream) {
6221
- const level = supportsColor(stream);
6222
- return translateLevel(level);
6223
- }
6224
-
6225
- var supportsColor_1 = {
6226
- supportsColor: getSupportLevel,
6227
- stdout: getSupportLevel(process.stdout),
6228
- stderr: getSupportLevel(process.stderr)
6229
- };
6230
-
6231
- var node = createCommonjsModule(function (module, exports) {
6232
- /**
6233
- * Module dependencies.
6234
- */
6235
-
6236
-
6237
-
6238
-
6239
- /**
6240
- * This is the Node.js implementation of `debug()`.
6241
- */
6242
-
6243
- exports.init = init;
6244
- exports.log = log;
6245
- exports.formatArgs = formatArgs;
6246
- exports.save = save;
6247
- exports.load = load;
6248
- exports.useColors = useColors;
6249
- exports.destroy = util.deprecate(
6250
- () => {},
6251
- 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
6252
- );
6253
-
6254
- /**
6255
- * Colors.
6256
- */
6257
-
6258
- exports.colors = [6, 2, 3, 4, 5, 1];
6259
-
6260
- try {
6261
- // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
6262
- // eslint-disable-next-line import/no-extraneous-dependencies
6263
- const supportsColor = supportsColor_1;
6264
-
6265
- if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
6266
- exports.colors = [
6267
- 20,
6268
- 21,
6269
- 26,
6270
- 27,
6271
- 32,
6272
- 33,
6273
- 38,
6274
- 39,
6275
- 40,
6276
- 41,
6277
- 42,
6278
- 43,
6279
- 44,
6280
- 45,
6281
- 56,
6282
- 57,
6283
- 62,
6284
- 63,
6285
- 68,
6286
- 69,
6287
- 74,
6288
- 75,
6289
- 76,
6290
- 77,
6291
- 78,
6292
- 79,
6293
- 80,
6294
- 81,
6295
- 92,
6296
- 93,
6297
- 98,
6298
- 99,
6299
- 112,
6300
- 113,
6301
- 128,
6302
- 129,
6303
- 134,
6304
- 135,
6305
- 148,
6306
- 149,
6307
- 160,
6308
- 161,
6309
- 162,
6310
- 163,
6311
- 164,
6312
- 165,
6313
- 166,
6314
- 167,
6315
- 168,
6316
- 169,
6317
- 170,
6318
- 171,
6319
- 172,
6320
- 173,
6321
- 178,
6322
- 179,
6323
- 184,
6324
- 185,
6325
- 196,
6326
- 197,
6327
- 198,
6328
- 199,
6329
- 200,
6330
- 201,
6331
- 202,
6332
- 203,
6333
- 204,
6334
- 205,
6335
- 206,
6336
- 207,
6337
- 208,
6338
- 209,
6339
- 214,
6340
- 215,
6341
- 220,
6342
- 221
6343
- ];
6344
- }
6345
- } catch (error) {
6346
- // Swallow - we only care if `supports-color` is available; it doesn't have to be.
6347
- }
6348
-
6349
- /**
6350
- * Build up the default `inspectOpts` object from the environment variables.
6351
- *
6352
- * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
6353
- */
6354
-
6355
- exports.inspectOpts = Object.keys(process.env).filter(key => {
6356
- return /^debug_/i.test(key);
6357
- }).reduce((obj, key) => {
6358
- // Camel-case
6359
- const prop = key
6360
- .substring(6)
6361
- .toLowerCase()
6362
- .replace(/_([a-z])/g, (_, k) => {
6363
- return k.toUpperCase();
6364
- });
6365
-
6366
- // Coerce string value into JS value
6367
- let val = process.env[key];
6368
- if (/^(yes|on|true|enabled)$/i.test(val)) {
6369
- val = true;
6370
- } else if (/^(no|off|false|disabled)$/i.test(val)) {
6371
- val = false;
6372
- } else if (val === 'null') {
6373
- val = null;
6374
- } else {
6375
- val = Number(val);
6376
- }
6377
-
6378
- obj[prop] = val;
6379
- return obj;
6380
- }, {});
6381
-
6382
- /**
6383
- * Is stdout a TTY? Colored output is enabled when `true`.
6384
- */
6385
-
6386
- function useColors() {
6387
- return 'colors' in exports.inspectOpts ?
6388
- Boolean(exports.inspectOpts.colors) :
6389
- tty.isatty(process.stderr.fd);
6390
- }
6391
-
6392
- /**
6393
- * Adds ANSI color escape codes if enabled.
6394
- *
6395
- * @api public
6396
- */
6397
-
6398
- function formatArgs(args) {
6399
- const {namespace: name, useColors} = this;
6400
-
6401
- if (useColors) {
6402
- const c = this.color;
6403
- const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
6404
- const prefix = ` ${colorCode};1m${name} \u001B[0m`;
6405
-
6406
- args[0] = prefix + args[0].split('\n').join('\n' + prefix);
6407
- args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
6408
- } else {
6409
- args[0] = getDate() + name + ' ' + args[0];
6410
- }
6411
- }
6412
-
6413
- function getDate() {
6414
- if (exports.inspectOpts.hideDate) {
6415
- return '';
6416
- }
6417
- return new Date().toISOString() + ' ';
6418
- }
6419
-
6420
- /**
6421
- * Invokes `util.format()` with the specified arguments and writes to stderr.
6422
- */
6423
-
6424
- function log(...args) {
6425
- return process.stderr.write(util.format(...args) + '\n');
6426
- }
6427
-
6428
- /**
6429
- * Save `namespaces`.
6430
- *
6431
- * @param {String} namespaces
6432
- * @api private
6433
- */
6434
- function save(namespaces) {
6435
- if (namespaces) {
6436
- process.env.DEBUG = namespaces;
6437
- } else {
6438
- // If you set a process.env field to null or undefined, it gets cast to the
6439
- // string 'null' or 'undefined'. Just delete instead.
6440
- delete process.env.DEBUG;
6441
- }
6442
- }
6443
-
6444
- /**
6445
- * Load `namespaces`.
6446
- *
6447
- * @return {String} returns the previously persisted debug modes
6448
- * @api private
6449
- */
6450
-
6451
- function load() {
6452
- return process.env.DEBUG;
6453
- }
6454
-
6455
- /**
6456
- * Init logic for `debug` instances.
6457
- *
6458
- * Create a new `inspectOpts` object in case `useColors` is set
6459
- * differently for a particular `debug` instance.
6460
- */
6461
-
6462
- function init(debug) {
6463
- debug.inspectOpts = {};
6464
-
6465
- const keys = Object.keys(exports.inspectOpts);
6466
- for (let i = 0; i < keys.length; i++) {
6467
- debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
6468
- }
6469
- }
6470
-
6471
- module.exports = common(exports);
6472
-
6473
- const {formatters} = module.exports;
6474
-
6475
- /**
6476
- * Map %o to `util.inspect()`, all on a single line.
6477
- */
6478
-
6479
- formatters.o = function (v) {
6480
- this.inspectOpts.colors = this.useColors;
6481
- return util.inspect(v, this.inspectOpts)
6482
- .split('\n')
6483
- .map(str => str.trim())
6484
- .join(' ');
6485
- };
6486
-
6487
- /**
6488
- * Map %O to `util.inspect()`, allowing multiple lines if needed.
6489
- */
6490
-
6491
- formatters.O = function (v) {
6492
- this.inspectOpts.colors = this.useColors;
6493
- return util.inspect(v, this.inspectOpts);
6494
- };
6495
- });
6496
-
6497
- var src = createCommonjsModule(function (module) {
6498
- /**
6499
- * Detect Electron renderer / nwjs process, which is node, but we should
6500
- * treat as a browser.
6501
- */
6502
-
6503
- if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
6504
- module.exports = browser;
6505
- } else {
6506
- module.exports = node;
6507
- }
6508
- });
6509
-
6510
- var debug;
6511
-
6512
- var debug_1 = function () {
6513
- if (!debug) {
6514
- try {
6515
- /* eslint global-require: off */
6516
- debug = src("follow-redirects");
6517
- }
6518
- catch (error) { /* */ }
6519
- if (typeof debug !== "function") {
6520
- debug = function () { /* */ };
6521
- }
6522
- }
6523
- debug.apply(null, arguments);
6524
- };
6525
-
6526
- var URL = url.URL;
6527
-
6528
-
6529
- var Writable = stream.Writable;
6530
-
6531
-
6532
-
6533
- // Create handlers that pass events from native requests
6534
- var events = ["abort", "aborted", "connect", "error", "socket", "timeout"];
6535
- var eventHandlers = Object.create(null);
6536
- events.forEach(function (event) {
6537
- eventHandlers[event] = function (arg1, arg2, arg3) {
6538
- this._redirectable.emit(event, arg1, arg2, arg3);
6539
- };
6540
- });
6541
-
6542
- // Error types with codes
6543
- var RedirectionError = createErrorType(
6544
- "ERR_FR_REDIRECTION_FAILURE",
6545
- "Redirected request failed"
6546
- );
6547
- var TooManyRedirectsError = createErrorType(
6548
- "ERR_FR_TOO_MANY_REDIRECTS",
6549
- "Maximum number of redirects exceeded"
6550
- );
6551
- var MaxBodyLengthExceededError = createErrorType(
6552
- "ERR_FR_MAX_BODY_LENGTH_EXCEEDED",
6553
- "Request body larger than maxBodyLength limit"
6554
- );
6555
- var WriteAfterEndError = createErrorType(
6556
- "ERR_STREAM_WRITE_AFTER_END",
6557
- "write after end"
6558
- );
6559
-
6560
- // An HTTP(S) request that can be redirected
6561
- function RedirectableRequest(options, responseCallback) {
6562
- // Initialize the request
6563
- Writable.call(this);
6564
- this._sanitizeOptions(options);
6565
- this._options = options;
6566
- this._ended = false;
6567
- this._ending = false;
6568
- this._redirectCount = 0;
6569
- this._redirects = [];
6570
- this._requestBodyLength = 0;
6571
- this._requestBodyBuffers = [];
6572
-
6573
- // Attach a callback if passed
6574
- if (responseCallback) {
6575
- this.on("response", responseCallback);
6576
- }
6577
-
6578
- // React to responses of native requests
6579
- var self = this;
6580
- this._onNativeResponse = function (response) {
6581
- self._processResponse(response);
6582
- };
6583
-
6584
- // Perform the first request
6585
- this._performRequest();
6586
- }
6587
- RedirectableRequest.prototype = Object.create(Writable.prototype);
6588
-
6589
- RedirectableRequest.prototype.abort = function () {
6590
- abortRequest(this._currentRequest);
6591
- this.emit("abort");
6592
- };
6593
-
6594
- // Writes buffered data to the current native request
6595
- RedirectableRequest.prototype.write = function (data, encoding, callback) {
6596
- // Writing is not allowed if end has been called
6597
- if (this._ending) {
6598
- throw new WriteAfterEndError();
6599
- }
6600
-
6601
- // Validate input and shift parameters if necessary
6602
- if (!(typeof data === "string" || typeof data === "object" && ("length" in data))) {
6603
- throw new TypeError("data should be a string, Buffer or Uint8Array");
6604
- }
6605
- if (typeof encoding === "function") {
6606
- callback = encoding;
6607
- encoding = null;
6608
- }
6609
-
6610
- // Ignore empty buffers, since writing them doesn't invoke the callback
6611
- // https://github.com/nodejs/node/issues/22066
6612
- if (data.length === 0) {
6613
- if (callback) {
6614
- callback();
6615
- }
6616
- return;
6617
- }
6618
- // Only write when we don't exceed the maximum body length
6619
- if (this._requestBodyLength + data.length <= this._options.maxBodyLength) {
6620
- this._requestBodyLength += data.length;
6621
- this._requestBodyBuffers.push({ data: data, encoding: encoding });
6622
- this._currentRequest.write(data, encoding, callback);
6623
- }
6624
- // Error when we exceed the maximum body length
6625
- else {
6626
- this.emit("error", new MaxBodyLengthExceededError());
6627
- this.abort();
6628
- }
6629
- };
6630
-
6631
- // Ends the current native request
6632
- RedirectableRequest.prototype.end = function (data, encoding, callback) {
6633
- // Shift parameters if necessary
6634
- if (typeof data === "function") {
6635
- callback = data;
6636
- data = encoding = null;
6637
- }
6638
- else if (typeof encoding === "function") {
6639
- callback = encoding;
6640
- encoding = null;
6641
- }
6642
-
6643
- // Write data if needed and end
6644
- if (!data) {
6645
- this._ended = this._ending = true;
6646
- this._currentRequest.end(null, null, callback);
6647
- }
6648
- else {
6649
- var self = this;
6650
- var currentRequest = this._currentRequest;
6651
- this.write(data, encoding, function () {
6652
- self._ended = true;
6653
- currentRequest.end(null, null, callback);
6654
- });
6655
- this._ending = true;
6656
- }
6657
- };
6658
-
6659
- // Sets a header value on the current native request
6660
- RedirectableRequest.prototype.setHeader = function (name, value) {
6661
- this._options.headers[name] = value;
6662
- this._currentRequest.setHeader(name, value);
6663
- };
6664
-
6665
- // Clears a header value on the current native request
6666
- RedirectableRequest.prototype.removeHeader = function (name) {
6667
- delete this._options.headers[name];
6668
- this._currentRequest.removeHeader(name);
6669
- };
6670
-
6671
- // Global timeout for all underlying requests
6672
- RedirectableRequest.prototype.setTimeout = function (msecs, callback) {
6673
- var self = this;
6674
-
6675
- // Destroys the socket on timeout
6676
- function destroyOnTimeout(socket) {
6677
- socket.setTimeout(msecs);
6678
- socket.removeListener("timeout", socket.destroy);
6679
- socket.addListener("timeout", socket.destroy);
6680
- }
6681
-
6682
- // Sets up a timer to trigger a timeout event
6683
- function startTimer(socket) {
6684
- if (self._timeout) {
6685
- clearTimeout(self._timeout);
6686
- }
6687
- self._timeout = setTimeout(function () {
6688
- self.emit("timeout");
6689
- clearTimer();
6690
- }, msecs);
6691
- destroyOnTimeout(socket);
6692
- }
6693
-
6694
- // Stops a timeout from triggering
6695
- function clearTimer() {
6696
- // Clear the timeout
6697
- if (self._timeout) {
6698
- clearTimeout(self._timeout);
6699
- self._timeout = null;
6700
- }
6701
-
6702
- // Clean up all attached listeners
6703
- self.removeListener("abort", clearTimer);
6704
- self.removeListener("error", clearTimer);
6705
- self.removeListener("response", clearTimer);
6706
- if (callback) {
6707
- self.removeListener("timeout", callback);
6708
- }
6709
- if (!self.socket) {
6710
- self._currentRequest.removeListener("socket", startTimer);
6711
- }
6712
- }
6713
-
6714
- // Attach callback if passed
6715
- if (callback) {
6716
- this.on("timeout", callback);
6717
- }
6718
-
6719
- // Start the timer if or when the socket is opened
6720
- if (this.socket) {
6721
- startTimer(this.socket);
6722
- }
6723
- else {
6724
- this._currentRequest.once("socket", startTimer);
6725
- }
6726
-
6727
- // Clean up on events
6728
- this.on("socket", destroyOnTimeout);
6729
- this.on("abort", clearTimer);
6730
- this.on("error", clearTimer);
6731
- this.on("response", clearTimer);
6732
-
6733
- return this;
6734
- };
6735
-
6736
- // Proxy all other public ClientRequest methods
6737
- [
6738
- "flushHeaders", "getHeader",
6739
- "setNoDelay", "setSocketKeepAlive",
6740
- ].forEach(function (method) {
6741
- RedirectableRequest.prototype[method] = function (a, b) {
6742
- return this._currentRequest[method](a, b);
6743
- };
6744
- });
6745
-
6746
- // Proxy all public ClientRequest properties
6747
- ["aborted", "connection", "socket"].forEach(function (property) {
6748
- Object.defineProperty(RedirectableRequest.prototype, property, {
6749
- get: function () { return this._currentRequest[property]; },
6750
- });
6751
- });
6752
-
6753
- RedirectableRequest.prototype._sanitizeOptions = function (options) {
6754
- // Ensure headers are always present
6755
- if (!options.headers) {
6756
- options.headers = {};
6757
- }
6758
-
6759
- // Since http.request treats host as an alias of hostname,
6760
- // but the url module interprets host as hostname plus port,
6761
- // eliminate the host property to avoid confusion.
6762
- if (options.host) {
6763
- // Use hostname if set, because it has precedence
6764
- if (!options.hostname) {
6765
- options.hostname = options.host;
6766
- }
6767
- delete options.host;
6768
- }
6769
-
6770
- // Complete the URL object when necessary
6771
- if (!options.pathname && options.path) {
6772
- var searchPos = options.path.indexOf("?");
6773
- if (searchPos < 0) {
6774
- options.pathname = options.path;
6775
- }
6776
- else {
6777
- options.pathname = options.path.substring(0, searchPos);
6778
- options.search = options.path.substring(searchPos);
6779
- }
6780
- }
6781
- };
6782
-
6783
-
6784
- // Executes the next native request (initial or redirect)
6785
- RedirectableRequest.prototype._performRequest = function () {
6786
- // Load the native protocol
6787
- var protocol = this._options.protocol;
6788
- var nativeProtocol = this._options.nativeProtocols[protocol];
6789
- if (!nativeProtocol) {
6790
- this.emit("error", new TypeError("Unsupported protocol " + protocol));
6791
- return;
6792
- }
6793
-
6794
- // If specified, use the agent corresponding to the protocol
6795
- // (HTTP and HTTPS use different types of agents)
6796
- if (this._options.agents) {
6797
- var scheme = protocol.substr(0, protocol.length - 1);
6798
- this._options.agent = this._options.agents[scheme];
6799
- }
6800
-
6801
- // Create the native request
6802
- var request = this._currentRequest =
6803
- nativeProtocol.request(this._options, this._onNativeResponse);
6804
- this._currentUrl = url.format(this._options);
6805
-
6806
- // Set up event handlers
6807
- request._redirectable = this;
6808
- for (var e = 0; e < events.length; e++) {
6809
- request.on(events[e], eventHandlers[events[e]]);
6810
- }
6811
-
6812
- // End a redirected request
6813
- // (The first request must be ended explicitly with RedirectableRequest#end)
6814
- if (this._isRedirect) {
6815
- // Write the request entity and end.
6816
- var i = 0;
6817
- var self = this;
6818
- var buffers = this._requestBodyBuffers;
6819
- (function writeNext(error) {
6820
- // Only write if this request has not been redirected yet
6821
- /* istanbul ignore else */
6822
- if (request === self._currentRequest) {
6823
- // Report any write errors
6824
- /* istanbul ignore if */
6825
- if (error) {
6826
- self.emit("error", error);
6827
- }
6828
- // Write the next buffer if there are still left
6829
- else if (i < buffers.length) {
6830
- var buffer = buffers[i++];
6831
- /* istanbul ignore else */
6832
- if (!request.finished) {
6833
- request.write(buffer.data, buffer.encoding, writeNext);
6834
- }
6835
- }
6836
- // End the request if `end` has been called on us
6837
- else if (self._ended) {
6838
- request.end();
6839
- }
6840
- }
6841
- }());
6842
- }
6843
- };
6844
-
6845
- // Processes a response from the current native request
6846
- RedirectableRequest.prototype._processResponse = function (response) {
6847
- // Store the redirected response
6848
- var statusCode = response.statusCode;
6849
- if (this._options.trackRedirects) {
6850
- this._redirects.push({
6851
- url: this._currentUrl,
6852
- headers: response.headers,
6853
- statusCode: statusCode,
6854
- });
6855
- }
6856
-
6857
- // RFC7231§6.4: The 3xx (Redirection) class of status code indicates
6858
- // that further action needs to be taken by the user agent in order to
6859
- // fulfill the request. If a Location header field is provided,
6860
- // the user agent MAY automatically redirect its request to the URI
6861
- // referenced by the Location field value,
6862
- // even if the specific status code is not understood.
6863
-
6864
- // If the response is not a redirect; return it as-is
6865
- var location = response.headers.location;
6866
- if (!location || this._options.followRedirects === false ||
6867
- statusCode < 300 || statusCode >= 400) {
6868
- response.responseUrl = this._currentUrl;
6869
- response.redirects = this._redirects;
6870
- this.emit("response", response);
6871
-
6872
- // Clean up
6873
- this._requestBodyBuffers = [];
6874
- return;
6875
- }
6876
-
6877
- // The response is a redirect, so abort the current request
6878
- abortRequest(this._currentRequest);
6879
- // Discard the remainder of the response to avoid waiting for data
6880
- response.destroy();
6881
-
6882
- // RFC7231§6.4: A client SHOULD detect and intervene
6883
- // in cyclical redirections (i.e., "infinite" redirection loops).
6884
- if (++this._redirectCount > this._options.maxRedirects) {
6885
- this.emit("error", new TooManyRedirectsError());
6886
- return;
6887
- }
6888
-
6889
- // RFC7231§6.4: Automatic redirection needs to done with
6890
- // care for methods not known to be safe, […]
6891
- // RFC7231§6.4.2–3: For historical reasons, a user agent MAY change
6892
- // the request method from POST to GET for the subsequent request.
6893
- if ((statusCode === 301 || statusCode === 302) && this._options.method === "POST" ||
6894
- // RFC7231§6.4.4: The 303 (See Other) status code indicates that
6895
- // the server is redirecting the user agent to a different resource […]
6896
- // A user agent can perform a retrieval request targeting that URI
6897
- // (a GET or HEAD request if using HTTP) […]
6898
- (statusCode === 303) && !/^(?:GET|HEAD)$/.test(this._options.method)) {
6899
- this._options.method = "GET";
6900
- // Drop a possible entity and headers related to it
6901
- this._requestBodyBuffers = [];
6902
- removeMatchingHeaders(/^content-/i, this._options.headers);
6903
- }
6904
-
6905
- // Drop the Host header, as the redirect might lead to a different host
6906
- var currentHostHeader = removeMatchingHeaders(/^host$/i, this._options.headers);
6907
-
6908
- // If the redirect is relative, carry over the host of the last request
6909
- var currentUrlParts = url.parse(this._currentUrl);
6910
- var currentHost = currentHostHeader || currentUrlParts.host;
6911
- var currentUrl = /^\w+:/.test(location) ? this._currentUrl :
6912
- url.format(Object.assign(currentUrlParts, { host: currentHost }));
6913
-
6914
- // Determine the URL of the redirection
6915
- var redirectUrl;
6916
- try {
6917
- redirectUrl = url.resolve(currentUrl, location);
6918
- }
6919
- catch (cause) {
6920
- this.emit("error", new RedirectionError(cause));
6921
- return;
6922
- }
6923
-
6924
- // Create the redirected request
6925
- debug_1("redirecting to", redirectUrl);
6926
- this._isRedirect = true;
6927
- var redirectUrlParts = url.parse(redirectUrl);
6928
- Object.assign(this._options, redirectUrlParts);
6929
-
6930
- // Drop confidential headers when redirecting to a less secure protocol
6931
- // or to a different domain that is not a superdomain
6932
- if (redirectUrlParts.protocol !== currentUrlParts.protocol &&
6933
- redirectUrlParts.protocol !== "https:" ||
6934
- redirectUrlParts.host !== currentHost &&
6935
- !isSubdomain(redirectUrlParts.host, currentHost)) {
6936
- removeMatchingHeaders(/^(?:authorization|cookie)$/i, this._options.headers);
6937
- }
6938
-
6939
- // Evaluate the beforeRedirect callback
6940
- if (typeof this._options.beforeRedirect === "function") {
6941
- var responseDetails = { headers: response.headers };
6942
- try {
6943
- this._options.beforeRedirect.call(null, this._options, responseDetails);
6944
- }
6945
- catch (err) {
6946
- this.emit("error", err);
6947
- return;
6948
- }
6949
- this._sanitizeOptions(this._options);
6950
- }
6951
-
6952
- // Perform the redirected request
6953
- try {
6954
- this._performRequest();
6955
- }
6956
- catch (cause) {
6957
- this.emit("error", new RedirectionError(cause));
6958
- }
6959
- };
6960
-
6961
- // Wraps the key/value object of protocols with redirect functionality
6962
- function wrap(protocols) {
6963
- // Default settings
6964
- var exports = {
6965
- maxRedirects: 21,
6966
- maxBodyLength: 10 * 1024 * 1024,
6967
- };
6968
-
6969
- // Wrap each protocol
6970
- var nativeProtocols = {};
6971
- Object.keys(protocols).forEach(function (scheme) {
6972
- var protocol = scheme + ":";
6973
- var nativeProtocol = nativeProtocols[protocol] = protocols[scheme];
6974
- var wrappedProtocol = exports[scheme] = Object.create(nativeProtocol);
6975
-
6976
- // Executes a request, following redirects
6977
- function request(input, options, callback) {
6978
- // Parse parameters
6979
- if (typeof input === "string") {
6980
- var urlStr = input;
6981
- try {
6982
- input = urlToOptions(new URL(urlStr));
6983
- }
6984
- catch (err) {
6985
- /* istanbul ignore next */
6986
- input = url.parse(urlStr);
6987
- }
6988
- }
6989
- else if (URL && (input instanceof URL)) {
6990
- input = urlToOptions(input);
6991
- }
6992
- else {
6993
- callback = options;
6994
- options = input;
6995
- input = { protocol: protocol };
6996
- }
6997
- if (typeof options === "function") {
6998
- callback = options;
6999
- options = null;
7000
- }
7001
-
7002
- // Set defaults
7003
- options = Object.assign({
7004
- maxRedirects: exports.maxRedirects,
7005
- maxBodyLength: exports.maxBodyLength,
7006
- }, input, options);
7007
- options.nativeProtocols = nativeProtocols;
7008
-
7009
- assert.equal(options.protocol, protocol, "protocol mismatch");
7010
- debug_1("options", options);
7011
- return new RedirectableRequest(options, callback);
7012
- }
7013
-
7014
- // Executes a GET request, following redirects
7015
- function get(input, options, callback) {
7016
- var wrappedRequest = wrappedProtocol.request(input, options, callback);
7017
- wrappedRequest.end();
7018
- return wrappedRequest;
7019
- }
7020
-
7021
- // Expose the properties on the wrapped protocol
7022
- Object.defineProperties(wrappedProtocol, {
7023
- request: { value: request, configurable: true, enumerable: true, writable: true },
7024
- get: { value: get, configurable: true, enumerable: true, writable: true },
7025
- });
7026
- });
7027
- return exports;
7028
- }
7029
-
7030
- /* istanbul ignore next */
7031
- function noop() { /* empty */ }
7032
-
7033
- // from https://github.com/nodejs/node/blob/master/lib/internal/url.js
7034
- function urlToOptions(urlObject) {
7035
- var options = {
7036
- protocol: urlObject.protocol,
7037
- hostname: urlObject.hostname.startsWith("[") ?
7038
- /* istanbul ignore next */
7039
- urlObject.hostname.slice(1, -1) :
7040
- urlObject.hostname,
7041
- hash: urlObject.hash,
7042
- search: urlObject.search,
7043
- pathname: urlObject.pathname,
7044
- path: urlObject.pathname + urlObject.search,
7045
- href: urlObject.href,
7046
- };
7047
- if (urlObject.port !== "") {
7048
- options.port = Number(urlObject.port);
7049
- }
7050
- return options;
7051
- }
7052
-
7053
- function removeMatchingHeaders(regex, headers) {
7054
- var lastValue;
7055
- for (var header in headers) {
7056
- if (regex.test(header)) {
7057
- lastValue = headers[header];
7058
- delete headers[header];
7059
- }
7060
- }
7061
- return (lastValue === null || typeof lastValue === "undefined") ?
7062
- undefined : String(lastValue).trim();
7063
- }
7064
-
7065
- function createErrorType(code, defaultMessage) {
7066
- function CustomError(cause) {
7067
- Error.captureStackTrace(this, this.constructor);
7068
- if (!cause) {
7069
- this.message = defaultMessage;
7070
- }
7071
- else {
7072
- this.message = defaultMessage + ": " + cause.message;
7073
- this.cause = cause;
7074
- }
7075
- }
7076
- CustomError.prototype = new Error();
7077
- CustomError.prototype.constructor = CustomError;
7078
- CustomError.prototype.name = "Error [" + code + "]";
7079
- CustomError.prototype.code = code;
7080
- return CustomError;
7081
- }
7082
-
7083
- function abortRequest(request) {
7084
- for (var e = 0; e < events.length; e++) {
7085
- request.removeListener(events[e], eventHandlers[events[e]]);
7086
- }
7087
- request.on("error", noop);
7088
- request.abort();
7089
- }
7090
-
7091
- function isSubdomain(subdomain, domain) {
7092
- const dot = subdomain.length - domain.length - 1;
7093
- return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain);
7094
- }
7095
-
7096
- // Exports
7097
- var followRedirects = wrap({ http: http, https: https });
7098
- var wrap_1 = wrap;
7099
- followRedirects.wrap = wrap_1;
7100
-
7101
- var data = {
7102
- "version": "0.26.0"
7103
- };
7104
-
7105
- var httpFollow = followRedirects.http;
7106
- var httpsFollow = followRedirects.https;
7107
-
7108
-
7109
- var VERSION$1 = data.version;
7110
-
7111
-
7112
-
7113
-
7114
-
7115
- var isHttps = /https:?/;
7116
-
7117
- /**
7118
- *
7119
- * @param {http.ClientRequestArgs} options
7120
- * @param {AxiosProxyConfig} proxy
7121
- * @param {string} location
7122
- */
7123
- function setProxy(options, proxy, location) {
7124
- options.hostname = proxy.host;
7125
- options.host = proxy.host;
7126
- options.port = proxy.port;
7127
- options.path = location;
7128
-
7129
- // Basic proxy authorization
7130
- if (proxy.auth) {
7131
- var base64 = Buffer.from(proxy.auth.username + ':' + proxy.auth.password, 'utf8').toString('base64');
7132
- options.headers['Proxy-Authorization'] = 'Basic ' + base64;
7133
- }
7134
-
7135
- // If a proxy is used, any redirects must also pass through the proxy
7136
- options.beforeRedirect = function beforeRedirect(redirection) {
7137
- redirection.headers.host = redirection.host;
7138
- setProxy(redirection, proxy, redirection.href);
7139
- };
7140
- }
7141
-
7142
- /*eslint consistent-return:0*/
7143
- var http_1 = function httpAdapter(config) {
7144
- return new Promise(function dispatchHttpRequest(resolvePromise, rejectPromise) {
7145
- var onCanceled;
7146
- function done() {
7147
- if (config.cancelToken) {
7148
- config.cancelToken.unsubscribe(onCanceled);
7149
- }
7150
-
7151
- if (config.signal) {
7152
- config.signal.removeEventListener('abort', onCanceled);
7153
- }
7154
- }
7155
- var resolve = function resolve(value) {
7156
- done();
7157
- resolvePromise(value);
7158
- };
7159
- var rejected = false;
7160
- var reject = function reject(value) {
7161
- done();
7162
- rejected = true;
7163
- rejectPromise(value);
7164
- };
7165
- var data = config.data;
7166
- var headers = config.headers;
7167
- var headerNames = {};
7168
-
7169
- Object.keys(headers).forEach(function storeLowerName(name) {
7170
- headerNames[name.toLowerCase()] = name;
7171
- });
7172
-
7173
- // Set User-Agent (required by some servers)
7174
- // See https://github.com/axios/axios/issues/69
7175
- if ('user-agent' in headerNames) {
7176
- // User-Agent is specified; handle case where no UA header is desired
7177
- if (!headers[headerNames['user-agent']]) {
7178
- delete headers[headerNames['user-agent']];
7179
- }
7180
- // Otherwise, use specified value
7181
- } else {
7182
- // Only set header if it hasn't been set in config
7183
- headers['User-Agent'] = 'axios/' + VERSION$1;
7184
- }
7185
-
7186
- if (data && !utils.isStream(data)) {
7187
- if (Buffer.isBuffer(data)) ; else if (utils.isArrayBuffer(data)) {
7188
- data = Buffer.from(new Uint8Array(data));
7189
- } else if (utils.isString(data)) {
7190
- data = Buffer.from(data, 'utf-8');
7191
- } else {
7192
- return reject(createError(
7193
- 'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream',
7194
- config
7195
- ));
7196
- }
7197
-
7198
- if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) {
7199
- return reject(createError('Request body larger than maxBodyLength limit', config));
7200
- }
7201
-
7202
- // Add Content-Length header if data exists
7203
- if (!headerNames['content-length']) {
7204
- headers['Content-Length'] = data.length;
7205
- }
7206
- }
7207
-
7208
- // HTTP basic authentication
7209
- var auth = undefined;
7210
- if (config.auth) {
7211
- var username = config.auth.username || '';
7212
- var password = config.auth.password || '';
7213
- auth = username + ':' + password;
7214
- }
7215
-
7216
- // Parse url
7217
- var fullPath = buildFullPath(config.baseURL, config.url);
7218
- var parsed = url.parse(fullPath);
7219
- var protocol = parsed.protocol || 'http:';
7220
-
7221
- if (!auth && parsed.auth) {
7222
- var urlAuth = parsed.auth.split(':');
7223
- var urlUsername = urlAuth[0] || '';
7224
- var urlPassword = urlAuth[1] || '';
7225
- auth = urlUsername + ':' + urlPassword;
7226
- }
7227
-
7228
- if (auth && headerNames.authorization) {
7229
- delete headers[headerNames.authorization];
7230
- }
7231
-
7232
- var isHttpsRequest = isHttps.test(protocol);
7233
- var agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
7234
-
7235
- try {
7236
- buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, '');
7237
- } catch (err) {
7238
- var customErr = new Error(err.message);
7239
- customErr.config = config;
7240
- customErr.url = config.url;
7241
- customErr.exists = true;
7242
- reject(customErr);
7243
- }
7244
-
7245
- var options = {
7246
- path: buildURL(parsed.path, config.params, config.paramsSerializer).replace(/^\?/, ''),
7247
- method: config.method.toUpperCase(),
7248
- headers: headers,
7249
- agent: agent,
7250
- agents: { http: config.httpAgent, https: config.httpsAgent },
7251
- auth: auth
7252
- };
7253
-
7254
- if (config.socketPath) {
7255
- options.socketPath = config.socketPath;
7256
- } else {
7257
- options.hostname = parsed.hostname;
7258
- options.port = parsed.port;
7259
- }
7260
-
7261
- var proxy = config.proxy;
7262
- if (!proxy && proxy !== false) {
7263
- var proxyEnv = protocol.slice(0, -1) + '_proxy';
7264
- var proxyUrl = process.env[proxyEnv] || process.env[proxyEnv.toUpperCase()];
7265
- if (proxyUrl) {
7266
- var parsedProxyUrl = url.parse(proxyUrl);
7267
- var noProxyEnv = process.env.no_proxy || process.env.NO_PROXY;
7268
- var shouldProxy = true;
7269
-
7270
- if (noProxyEnv) {
7271
- var noProxy = noProxyEnv.split(',').map(function trim(s) {
7272
- return s.trim();
7273
- });
7274
-
7275
- shouldProxy = !noProxy.some(function proxyMatch(proxyElement) {
7276
- if (!proxyElement) {
7277
- return false;
7278
- }
7279
- if (proxyElement === '*') {
7280
- return true;
7281
- }
7282
- if (proxyElement[0] === '.' &&
7283
- parsed.hostname.substr(parsed.hostname.length - proxyElement.length) === proxyElement) {
7284
- return true;
7285
- }
7286
-
7287
- return parsed.hostname === proxyElement;
7288
- });
7289
- }
7290
-
7291
- if (shouldProxy) {
7292
- proxy = {
7293
- host: parsedProxyUrl.hostname,
7294
- port: parsedProxyUrl.port,
7295
- protocol: parsedProxyUrl.protocol
7296
- };
7297
-
7298
- if (parsedProxyUrl.auth) {
7299
- var proxyUrlAuth = parsedProxyUrl.auth.split(':');
7300
- proxy.auth = {
7301
- username: proxyUrlAuth[0],
7302
- password: proxyUrlAuth[1]
7303
- };
7304
- }
7305
- }
7306
- }
7307
- }
7308
-
7309
- if (proxy) {
7310
- options.headers.host = parsed.hostname + (parsed.port ? ':' + parsed.port : '');
7311
- setProxy(options, proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);
7312
- }
7313
-
7314
- var transport;
7315
- var isHttpsProxy = isHttpsRequest && (proxy ? isHttps.test(proxy.protocol) : true);
7316
- if (config.transport) {
7317
- transport = config.transport;
7318
- } else if (config.maxRedirects === 0) {
7319
- transport = isHttpsProxy ? https : http;
7320
- } else {
7321
- if (config.maxRedirects) {
7322
- options.maxRedirects = config.maxRedirects;
7323
- }
7324
- transport = isHttpsProxy ? httpsFollow : httpFollow;
7325
- }
7326
-
7327
- if (config.maxBodyLength > -1) {
7328
- options.maxBodyLength = config.maxBodyLength;
7329
- }
7330
-
7331
- if (config.insecureHTTPParser) {
7332
- options.insecureHTTPParser = config.insecureHTTPParser;
7333
- }
7334
-
7335
- // Create the request
7336
- var req = transport.request(options, function handleResponse(res) {
7337
- if (req.aborted) return;
7338
-
7339
- // uncompress the response body transparently if required
7340
- var stream = res;
7341
-
7342
- // return the last request in case of redirects
7343
- var lastRequest = res.req || req;
7344
-
7345
-
7346
- // if no content, is HEAD request or decompress disabled we should not decompress
7347
- if (res.statusCode !== 204 && lastRequest.method !== 'HEAD' && config.decompress !== false) {
7348
- switch (res.headers['content-encoding']) {
7349
- /*eslint default-case:0*/
7350
- case 'gzip':
7351
- case 'compress':
7352
- case 'deflate':
7353
- // add the unzipper to the body stream processing pipeline
7354
- stream = stream.pipe(zlib.createUnzip());
7355
-
7356
- // remove the content-encoding in order to not confuse downstream operations
7357
- delete res.headers['content-encoding'];
7358
- break;
7359
- }
7360
- }
7361
-
7362
- var response = {
7363
- status: res.statusCode,
7364
- statusText: res.statusMessage,
7365
- headers: res.headers,
7366
- config: config,
7367
- request: lastRequest
7368
- };
7369
-
7370
- if (config.responseType === 'stream') {
7371
- response.data = stream;
7372
- settle(resolve, reject, response);
7373
- } else {
7374
- var responseBuffer = [];
7375
- var totalResponseBytes = 0;
7376
- stream.on('data', function handleStreamData(chunk) {
7377
- responseBuffer.push(chunk);
7378
- totalResponseBytes += chunk.length;
7379
-
7380
- // make sure the content length is not over the maxContentLength if specified
7381
- if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) {
7382
- // stream.destoy() emit aborted event before calling reject() on Node.js v16
7383
- rejected = true;
7384
- stream.destroy();
7385
- reject(createError('maxContentLength size of ' + config.maxContentLength + ' exceeded',
7386
- config, null, lastRequest));
7387
- }
7388
- });
7389
-
7390
- stream.on('aborted', function handlerStreamAborted() {
7391
- if (rejected) {
7392
- return;
7393
- }
7394
- stream.destroy();
7395
- reject(createError('error request aborted', config, 'ERR_REQUEST_ABORTED', lastRequest));
7396
- });
7397
-
7398
- stream.on('error', function handleStreamError(err) {
7399
- if (req.aborted) return;
7400
- reject(enhanceError(err, config, null, lastRequest));
7401
- });
7402
-
7403
- stream.on('end', function handleStreamEnd() {
7404
- try {
7405
- var responseData = responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer);
7406
- if (config.responseType !== 'arraybuffer') {
7407
- responseData = responseData.toString(config.responseEncoding);
7408
- if (!config.responseEncoding || config.responseEncoding === 'utf8') {
7409
- responseData = utils.stripBOM(responseData);
7410
- }
7411
- }
7412
- response.data = responseData;
7413
- } catch (err) {
7414
- reject(enhanceError(err, config, err.code, response.request, response));
7415
- }
7416
- settle(resolve, reject, response);
7417
- });
7418
- }
7419
- });
7420
-
7421
- // Handle errors
7422
- req.on('error', function handleRequestError(err) {
7423
- if (req.aborted && err.code !== 'ERR_FR_TOO_MANY_REDIRECTS') return;
7424
- reject(enhanceError(err, config, null, req));
7425
- });
7426
-
7427
- // set tcp keep alive to prevent drop connection by peer
7428
- req.on('socket', function handleRequestSocket(socket) {
7429
- // default interval of sending ack packet is 1 minute
7430
- socket.setKeepAlive(true, 1000 * 60);
7431
- });
7432
-
7433
- // Handle request timeout
7434
- if (config.timeout) {
7435
- // This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types.
7436
- var timeout = parseInt(config.timeout, 10);
7437
-
7438
- if (isNaN(timeout)) {
7439
- reject(createError(
7440
- 'error trying to parse `config.timeout` to int',
7441
- config,
7442
- 'ERR_PARSE_TIMEOUT',
7443
- req
7444
- ));
7445
-
7446
- return;
7447
- }
7448
-
7449
- // Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system.
7450
- // And timer callback will be fired, and abort() will be invoked before connection, then get "socket hang up" and code ECONNRESET.
7451
- // 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.
7452
- // And then these socket which be hang up will devoring CPU little by little.
7453
- // ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect.
7454
- req.setTimeout(timeout, function handleRequestTimeout() {
7455
- req.abort();
7456
- var timeoutErrorMessage = '';
7457
- if (config.timeoutErrorMessage) {
7458
- timeoutErrorMessage = config.timeoutErrorMessage;
7459
- } else {
7460
- timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
7461
- }
7462
- var transitional = config.transitional || defaults$1.transitional;
7463
- reject(createError(
7464
- timeoutErrorMessage,
7465
- config,
7466
- transitional.clarifyTimeoutError ? 'ETIMEDOUT' : 'ECONNABORTED',
7467
- req
7468
- ));
7469
- });
7470
- }
7471
-
7472
- if (config.cancelToken || config.signal) {
7473
- // Handle cancellation
7474
- // eslint-disable-next-line func-names
7475
- onCanceled = function(cancel) {
7476
- if (req.aborted) return;
7477
-
7478
- req.abort();
7479
- reject(!cancel || (cancel && cancel.type) ? new Cancel_1('canceled') : cancel);
7480
- };
7481
-
7482
- config.cancelToken && config.cancelToken.subscribe(onCanceled);
7483
- if (config.signal) {
7484
- config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
7485
- }
7486
- }
7487
-
7488
-
7489
- // Send the request
7490
- if (utils.isStream(data)) {
7491
- data.on('error', function handleStreamError(err) {
7492
- reject(enhanceError(err, config, null, req));
7493
- }).pipe(req);
7494
- } else {
7495
- req.end(data);
7496
- }
7497
- });
7498
- };
7499
-
7500
- var DEFAULT_CONTENT_TYPE = {
7501
- 'Content-Type': 'application/x-www-form-urlencoded'
7502
- };
7503
-
7504
- function setContentTypeIfUnset(headers, value) {
7505
- if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
7506
- headers['Content-Type'] = value;
7507
- }
7508
- }
7509
-
7510
- function getDefaultAdapter() {
7511
- var adapter;
7512
- if (typeof XMLHttpRequest !== 'undefined') {
7513
- // For browsers use XHR adapter
7514
- adapter = xhr;
7515
- } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
7516
- // For node use HTTP adapter
7517
- adapter = http_1;
7518
- }
7519
- return adapter;
7520
- }
7521
-
7522
- function stringifySafely(rawValue, parser, encoder) {
7523
- if (utils.isString(rawValue)) {
7524
- try {
7525
- (parser || JSON.parse)(rawValue);
7526
- return utils.trim(rawValue);
7527
- } catch (e) {
7528
- if (e.name !== 'SyntaxError') {
7529
- throw e;
7530
- }
7531
- }
7532
- }
7533
-
7534
- return (encoder || JSON.stringify)(rawValue);
7535
- }
7536
-
7537
- var defaults = {
7538
-
7539
- transitional: {
7540
- silentJSONParsing: true,
7541
- forcedJSONParsing: true,
7542
- clarifyTimeoutError: false
7543
- },
7544
-
7545
- adapter: getDefaultAdapter(),
7546
-
7547
- transformRequest: [function transformRequest(data, headers) {
7548
- normalizeHeaderName(headers, 'Accept');
7549
- normalizeHeaderName(headers, 'Content-Type');
7550
-
7551
- if (utils.isFormData(data) ||
7552
- utils.isArrayBuffer(data) ||
7553
- utils.isBuffer(data) ||
7554
- utils.isStream(data) ||
7555
- utils.isFile(data) ||
7556
- utils.isBlob(data)
7557
- ) {
7558
- return data;
7559
- }
7560
- if (utils.isArrayBufferView(data)) {
7561
- return data.buffer;
7562
- }
7563
- if (utils.isURLSearchParams(data)) {
7564
- setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
7565
- return data.toString();
7566
- }
7567
- if (utils.isObject(data) || (headers && headers['Content-Type'] === 'application/json')) {
7568
- setContentTypeIfUnset(headers, 'application/json');
7569
- return stringifySafely(data);
7570
- }
7571
- return data;
7572
- }],
7573
-
7574
- transformResponse: [function transformResponse(data) {
7575
- var transitional = this.transitional || defaults.transitional;
7576
- var silentJSONParsing = transitional && transitional.silentJSONParsing;
7577
- var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
7578
- var strictJSONParsing = !silentJSONParsing && this.responseType === 'json';
7579
-
7580
- if (strictJSONParsing || (forcedJSONParsing && utils.isString(data) && data.length)) {
7581
- try {
7582
- return JSON.parse(data);
7583
- } catch (e) {
7584
- if (strictJSONParsing) {
7585
- if (e.name === 'SyntaxError') {
7586
- throw enhanceError(e, this, 'E_JSON_PARSE');
7587
- }
7588
- throw e;
7589
- }
7590
- }
7591
- }
7592
-
7593
- return data;
7594
- }],
7595
-
7596
- /**
7597
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
7598
- * timeout is not created.
7599
- */
7600
- timeout: 0,
7601
-
7602
- xsrfCookieName: 'XSRF-TOKEN',
7603
- xsrfHeaderName: 'X-XSRF-TOKEN',
7604
-
7605
- maxContentLength: -1,
7606
- maxBodyLength: -1,
7607
-
7608
- validateStatus: function validateStatus(status) {
7609
- return status >= 200 && status < 300;
7610
- },
7611
-
7612
- headers: {
7613
- common: {
7614
- 'Accept': 'application/json, text/plain, */*'
7615
- }
7616
- }
7617
- };
7618
-
7619
- utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
7620
- defaults.headers[method] = {};
7621
- });
7622
-
7623
- utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
7624
- defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
7625
- });
7626
-
7627
- var defaults_1 = defaults;
7628
-
7629
- /**
7630
- * Transform the data for a request or a response
7631
- *
7632
- * @param {Object|String} data The data to be transformed
7633
- * @param {Array} headers The headers for the request or response
7634
- * @param {Array|Function} fns A single function or Array of functions
7635
- * @returns {*} The resulting transformed data
7636
- */
7637
- var transformData = function transformData(data, headers, fns) {
7638
- var context = this || defaults$1;
7639
- /*eslint no-param-reassign:0*/
7640
- utils.forEach(fns, function transform(fn) {
7641
- data = fn.call(context, data, headers);
7642
- });
7643
-
7644
- return data;
7645
- };
7646
-
7647
- var isCancel = function isCancel(value) {
7648
- return !!(value && value.__CANCEL__);
7649
- };
7650
-
7651
- /**
7652
- * Throws a `Cancel` if cancellation has been requested.
7653
- */
7654
- function throwIfCancellationRequested(config) {
7655
- if (config.cancelToken) {
7656
- config.cancelToken.throwIfRequested();
7657
- }
7658
-
7659
- if (config.signal && config.signal.aborted) {
7660
- throw new Cancel_1('canceled');
7661
- }
7662
- }
7663
-
7664
- /**
7665
- * Dispatch a request to the server using the configured adapter.
7666
- *
7667
- * @param {object} config The config that is to be used for the request
7668
- * @returns {Promise} The Promise to be fulfilled
7669
- */
7670
- var dispatchRequest = function dispatchRequest(config) {
7671
- throwIfCancellationRequested(config);
7672
-
7673
- // Ensure headers exist
7674
- config.headers = config.headers || {};
7675
-
7676
- // Transform request data
7677
- config.data = transformData.call(
7678
- config,
7679
- config.data,
7680
- config.headers,
7681
- config.transformRequest
7682
- );
7683
-
7684
- // Flatten headers
7685
- config.headers = utils.merge(
7686
- config.headers.common || {},
7687
- config.headers[config.method] || {},
7688
- config.headers
7689
- );
7690
-
7691
- utils.forEach(
7692
- ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
7693
- function cleanHeaderConfig(method) {
7694
- delete config.headers[method];
7695
- }
7696
- );
7697
-
7698
- var adapter = config.adapter || defaults$1.adapter;
7699
-
7700
- return adapter(config).then(function onAdapterResolution(response) {
7701
- throwIfCancellationRequested(config);
7702
-
7703
- // Transform response data
7704
- response.data = transformData.call(
7705
- config,
7706
- response.data,
7707
- response.headers,
7708
- config.transformResponse
7709
- );
7710
-
7711
- return response;
7712
- }, function onAdapterRejection(reason) {
7713
- if (!isCancel(reason)) {
7714
- throwIfCancellationRequested(config);
7715
-
7716
- // Transform response data
7717
- if (reason && reason.response) {
7718
- reason.response.data = transformData.call(
7719
- config,
7720
- reason.response.data,
7721
- reason.response.headers,
7722
- config.transformResponse
7723
- );
7724
- }
7725
- }
7726
-
7727
- return Promise.reject(reason);
7728
- });
7729
- };
7730
-
7731
- /**
7732
- * Config-specific merge-function which creates a new config-object
7733
- * by merging two configuration objects together.
7734
- *
7735
- * @param {Object} config1
7736
- * @param {Object} config2
7737
- * @returns {Object} New object resulting from merging config2 to config1
7738
- */
7739
- var mergeConfig = function mergeConfig(config1, config2) {
7740
- // eslint-disable-next-line no-param-reassign
7741
- config2 = config2 || {};
7742
- var config = {};
7743
-
7744
- function getMergedValue(target, source) {
7745
- if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
7746
- return utils.merge(target, source);
7747
- } else if (utils.isPlainObject(source)) {
7748
- return utils.merge({}, source);
7749
- } else if (utils.isArray(source)) {
7750
- return source.slice();
7751
- }
7752
- return source;
7753
- }
7754
-
7755
- // eslint-disable-next-line consistent-return
7756
- function mergeDeepProperties(prop) {
7757
- if (!utils.isUndefined(config2[prop])) {
7758
- return getMergedValue(config1[prop], config2[prop]);
7759
- } else if (!utils.isUndefined(config1[prop])) {
7760
- return getMergedValue(undefined, config1[prop]);
7761
- }
7762
- }
7763
-
7764
- // eslint-disable-next-line consistent-return
7765
- function valueFromConfig2(prop) {
7766
- if (!utils.isUndefined(config2[prop])) {
7767
- return getMergedValue(undefined, config2[prop]);
7768
- }
7769
- }
7770
-
7771
- // eslint-disable-next-line consistent-return
7772
- function defaultToConfig2(prop) {
7773
- if (!utils.isUndefined(config2[prop])) {
7774
- return getMergedValue(undefined, config2[prop]);
7775
- } else if (!utils.isUndefined(config1[prop])) {
7776
- return getMergedValue(undefined, config1[prop]);
7777
- }
7778
- }
7779
-
7780
- // eslint-disable-next-line consistent-return
7781
- function mergeDirectKeys(prop) {
7782
- if (prop in config2) {
7783
- return getMergedValue(config1[prop], config2[prop]);
7784
- } else if (prop in config1) {
7785
- return getMergedValue(undefined, config1[prop]);
7786
- }
7787
- }
7788
-
7789
- var mergeMap = {
7790
- 'url': valueFromConfig2,
7791
- 'method': valueFromConfig2,
7792
- 'data': valueFromConfig2,
7793
- 'baseURL': defaultToConfig2,
7794
- 'transformRequest': defaultToConfig2,
7795
- 'transformResponse': defaultToConfig2,
7796
- 'paramsSerializer': defaultToConfig2,
7797
- 'timeout': defaultToConfig2,
7798
- 'timeoutMessage': defaultToConfig2,
7799
- 'withCredentials': defaultToConfig2,
7800
- 'adapter': defaultToConfig2,
7801
- 'responseType': defaultToConfig2,
7802
- 'xsrfCookieName': defaultToConfig2,
7803
- 'xsrfHeaderName': defaultToConfig2,
7804
- 'onUploadProgress': defaultToConfig2,
7805
- 'onDownloadProgress': defaultToConfig2,
7806
- 'decompress': defaultToConfig2,
7807
- 'maxContentLength': defaultToConfig2,
7808
- 'maxBodyLength': defaultToConfig2,
7809
- 'transport': defaultToConfig2,
7810
- 'httpAgent': defaultToConfig2,
7811
- 'httpsAgent': defaultToConfig2,
7812
- 'cancelToken': defaultToConfig2,
7813
- 'socketPath': defaultToConfig2,
7814
- 'responseEncoding': defaultToConfig2,
7815
- 'validateStatus': mergeDirectKeys
7816
- };
7817
-
7818
- utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
7819
- var merge = mergeMap[prop] || mergeDeepProperties;
7820
- var configValue = merge(prop);
7821
- (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
7822
- });
7823
-
7824
- return config;
7825
- };
7826
-
7827
- var VERSION = data.version;
7828
-
7829
- var validators$1 = {};
7830
-
7831
- // eslint-disable-next-line func-names
7832
- ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function(type, i) {
7833
- validators$1[type] = function validator(thing) {
7834
- return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
7835
- };
7836
- });
7837
-
7838
- var deprecatedWarnings = {};
7839
-
7840
- /**
7841
- * Transitional option validator
7842
- * @param {function|boolean?} validator - set to false if the transitional option has been removed
7843
- * @param {string?} version - deprecated version / removed since version
7844
- * @param {string?} message - some message with additional info
7845
- * @returns {function}
7846
- */
7847
- validators$1.transitional = function transitional(validator, version, message) {
7848
- function formatMessage(opt, desc) {
7849
- return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
7850
- }
7851
-
7852
- // eslint-disable-next-line func-names
7853
- return function(value, opt, opts) {
7854
- if (validator === false) {
7855
- throw new Error(formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')));
7856
- }
7857
-
7858
- if (version && !deprecatedWarnings[opt]) {
7859
- deprecatedWarnings[opt] = true;
7860
- // eslint-disable-next-line no-console
7861
- console.warn(
7862
- formatMessage(
7863
- opt,
7864
- ' has been deprecated since v' + version + ' and will be removed in the near future'
7865
- )
7866
- );
7867
- }
7868
-
7869
- return validator ? validator(value, opt, opts) : true;
7870
- };
7871
- };
7872
-
7873
- /**
7874
- * Assert object's properties type
7875
- * @param {object} options
7876
- * @param {object} schema
7877
- * @param {boolean?} allowUnknown
7878
- */
7879
-
7880
- function assertOptions(options, schema, allowUnknown) {
7881
- if (typeof options !== 'object') {
7882
- throw new TypeError('options must be an object');
7883
- }
7884
- var keys = Object.keys(options);
7885
- var i = keys.length;
7886
- while (i-- > 0) {
7887
- var opt = keys[i];
7888
- var validator = schema[opt];
7889
- if (validator) {
7890
- var value = options[opt];
7891
- var result = value === undefined || validator(value, opt, options);
7892
- if (result !== true) {
7893
- throw new TypeError('option ' + opt + ' must be ' + result);
7894
- }
7895
- continue;
7896
- }
7897
- if (allowUnknown !== true) {
7898
- throw Error('Unknown option ' + opt);
7899
- }
7900
- }
7901
- }
7902
-
7903
- var validator = {
7904
- assertOptions: assertOptions,
7905
- validators: validators$1
7906
- };
7907
-
7908
- var validators = validator.validators;
7909
- /**
7910
- * Create a new instance of Axios
7911
- *
7912
- * @param {Object} instanceConfig The default config for the instance
7913
- */
7914
- function Axios(instanceConfig) {
7915
- this.defaults = instanceConfig;
7916
- this.interceptors = {
7917
- request: new InterceptorManager_1(),
7918
- response: new InterceptorManager_1()
7919
- };
7920
- }
7921
-
7922
- /**
7923
- * Dispatch a request
7924
- *
7925
- * @param {Object} config The config specific for this request (merged with this.defaults)
7926
- */
7927
- Axios.prototype.request = function request(configOrUrl, config) {
7928
- /*eslint no-param-reassign:0*/
7929
- // Allow for axios('example/url'[, config]) a la fetch API
7930
- if (typeof configOrUrl === 'string') {
7931
- config = config || {};
7932
- config.url = configOrUrl;
7933
- } else {
7934
- config = configOrUrl || {};
7935
- }
7936
-
7937
- config = mergeConfig(this.defaults, config);
7938
-
7939
- // Set config.method
7940
- if (config.method) {
7941
- config.method = config.method.toLowerCase();
7942
- } else if (this.defaults.method) {
7943
- config.method = this.defaults.method.toLowerCase();
7944
- } else {
7945
- config.method = 'get';
7946
- }
7947
-
7948
- var transitional = config.transitional;
7949
-
7950
- if (transitional !== undefined) {
7951
- validator.assertOptions(transitional, {
7952
- silentJSONParsing: validators.transitional(validators.boolean),
7953
- forcedJSONParsing: validators.transitional(validators.boolean),
7954
- clarifyTimeoutError: validators.transitional(validators.boolean)
7955
- }, false);
7956
- }
7957
-
7958
- // filter out skipped interceptors
7959
- var requestInterceptorChain = [];
7960
- var synchronousRequestInterceptors = true;
7961
- this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
7962
- if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
7963
- return;
7964
- }
7965
-
7966
- synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
7967
-
7968
- requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
7969
- });
7970
-
7971
- var responseInterceptorChain = [];
7972
- this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
7973
- responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
7974
- });
7975
-
7976
- var promise;
7977
-
7978
- if (!synchronousRequestInterceptors) {
7979
- var chain = [dispatchRequest, undefined];
7980
-
7981
- Array.prototype.unshift.apply(chain, requestInterceptorChain);
7982
- chain = chain.concat(responseInterceptorChain);
7983
-
7984
- promise = Promise.resolve(config);
7985
- while (chain.length) {
7986
- promise = promise.then(chain.shift(), chain.shift());
7987
- }
7988
-
7989
- return promise;
7990
- }
7991
-
7992
-
7993
- var newConfig = config;
7994
- while (requestInterceptorChain.length) {
7995
- var onFulfilled = requestInterceptorChain.shift();
7996
- var onRejected = requestInterceptorChain.shift();
7997
- try {
7998
- newConfig = onFulfilled(newConfig);
7999
- } catch (error) {
8000
- onRejected(error);
8001
- break;
8002
- }
8003
- }
8004
-
8005
- try {
8006
- promise = dispatchRequest(newConfig);
8007
- } catch (error) {
8008
- return Promise.reject(error);
8009
- }
8010
-
8011
- while (responseInterceptorChain.length) {
8012
- promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift());
8013
- }
8014
-
8015
- return promise;
8016
- };
8017
-
8018
- Axios.prototype.getUri = function getUri(config) {
8019
- config = mergeConfig(this.defaults, config);
8020
- return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
8021
- };
8022
-
8023
- // Provide aliases for supported request methods
8024
- utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
8025
- /*eslint func-names:0*/
8026
- Axios.prototype[method] = function(url, config) {
8027
- return this.request(mergeConfig(config || {}, {
8028
- method: method,
8029
- url: url,
8030
- data: (config || {}).data
8031
- }));
8032
- };
8033
- });
8034
-
8035
- utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
8036
- /*eslint func-names:0*/
8037
- Axios.prototype[method] = function(url, data, config) {
8038
- return this.request(mergeConfig(config || {}, {
8039
- method: method,
8040
- url: url,
8041
- data: data
8042
- }));
8043
- };
8044
- });
8045
-
8046
- var Axios_1 = Axios;
8047
-
8048
- /**
8049
- * A `CancelToken` is an object that can be used to request cancellation of an operation.
8050
- *
8051
- * @class
8052
- * @param {Function} executor The executor function.
8053
- */
8054
- function CancelToken(executor) {
8055
- if (typeof executor !== 'function') {
8056
- throw new TypeError('executor must be a function.');
8057
- }
8058
-
8059
- var resolvePromise;
8060
-
8061
- this.promise = new Promise(function promiseExecutor(resolve) {
8062
- resolvePromise = resolve;
8063
- });
8064
-
8065
- var token = this;
8066
-
8067
- // eslint-disable-next-line func-names
8068
- this.promise.then(function(cancel) {
8069
- if (!token._listeners) return;
8070
-
8071
- var i;
8072
- var l = token._listeners.length;
8073
-
8074
- for (i = 0; i < l; i++) {
8075
- token._listeners[i](cancel);
8076
- }
8077
- token._listeners = null;
8078
- });
8079
-
8080
- // eslint-disable-next-line func-names
8081
- this.promise.then = function(onfulfilled) {
8082
- var _resolve;
8083
- // eslint-disable-next-line func-names
8084
- var promise = new Promise(function(resolve) {
8085
- token.subscribe(resolve);
8086
- _resolve = resolve;
8087
- }).then(onfulfilled);
8088
-
8089
- promise.cancel = function reject() {
8090
- token.unsubscribe(_resolve);
8091
- };
8092
-
8093
- return promise;
8094
- };
8095
-
8096
- executor(function cancel(message) {
8097
- if (token.reason) {
8098
- // Cancellation has already been requested
8099
- return;
8100
- }
8101
-
8102
- token.reason = new Cancel_1(message);
8103
- resolvePromise(token.reason);
8104
- });
8105
- }
8106
-
8107
- /**
8108
- * Throws a `Cancel` if cancellation has been requested.
8109
- */
8110
- CancelToken.prototype.throwIfRequested = function throwIfRequested() {
8111
- if (this.reason) {
8112
- throw this.reason;
8113
- }
8114
- };
8115
-
8116
- /**
8117
- * Subscribe to the cancel signal
8118
- */
8119
-
8120
- CancelToken.prototype.subscribe = function subscribe(listener) {
8121
- if (this.reason) {
8122
- listener(this.reason);
8123
- return;
8124
- }
8125
-
8126
- if (this._listeners) {
8127
- this._listeners.push(listener);
8128
- } else {
8129
- this._listeners = [listener];
8130
- }
8131
- };
8132
-
8133
- /**
8134
- * Unsubscribe from the cancel signal
8135
- */
8136
-
8137
- CancelToken.prototype.unsubscribe = function unsubscribe(listener) {
8138
- if (!this._listeners) {
8139
- return;
8140
- }
8141
- var index = this._listeners.indexOf(listener);
8142
- if (index !== -1) {
8143
- this._listeners.splice(index, 1);
8144
- }
8145
- };
8146
-
8147
- /**
8148
- * Returns an object that contains a new `CancelToken` and a function that, when called,
8149
- * cancels the `CancelToken`.
8150
- */
8151
- CancelToken.source = function source() {
8152
- var cancel;
8153
- var token = new CancelToken(function executor(c) {
8154
- cancel = c;
8155
- });
8156
- return {
8157
- token: token,
8158
- cancel: cancel
8159
- };
8160
- };
8161
-
8162
- var CancelToken_1 = CancelToken;
8163
-
8164
- /**
8165
- * Syntactic sugar for invoking a function and expanding an array for arguments.
8166
- *
8167
- * Common use case would be to use `Function.prototype.apply`.
8168
- *
8169
- * ```js
8170
- * function f(x, y, z) {}
8171
- * var args = [1, 2, 3];
8172
- * f.apply(null, args);
8173
- * ```
8174
- *
8175
- * With `spread` this example can be re-written.
8176
- *
8177
- * ```js
8178
- * spread(function(x, y, z) {})([1, 2, 3]);
8179
- * ```
8180
- *
8181
- * @param {Function} callback
8182
- * @returns {Function}
8183
- */
8184
- var spread = function spread(callback) {
8185
- return function wrap(arr) {
8186
- return callback.apply(null, arr);
8187
- };
8188
- };
8189
-
8190
- /**
8191
- * Determines whether the payload is an error thrown by Axios
8192
- *
8193
- * @param {*} payload The value to test
8194
- * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
8195
- */
8196
- var isAxiosError = function isAxiosError(payload) {
8197
- return utils.isObject(payload) && (payload.isAxiosError === true);
8198
- };
8199
-
8200
- /**
8201
- * Create an instance of Axios
8202
- *
8203
- * @param {Object} defaultConfig The default config for the instance
8204
- * @return {Axios} A new instance of Axios
8205
- */
8206
- function createInstance(defaultConfig) {
8207
- var context = new Axios_1(defaultConfig);
8208
- var instance = bind(Axios_1.prototype.request, context);
8209
-
8210
- // Copy axios.prototype to instance
8211
- utils.extend(instance, Axios_1.prototype, context);
8212
-
8213
- // Copy context to instance
8214
- utils.extend(instance, context);
8215
-
8216
- // Factory for creating new instances
8217
- instance.create = function create(instanceConfig) {
8218
- return createInstance(mergeConfig(defaultConfig, instanceConfig));
8219
- };
8220
-
8221
- return instance;
8222
- }
8223
-
8224
- // Create the default instance to be exported
8225
- var axios$1 = createInstance(defaults$1);
8226
-
8227
- // Expose Axios class to allow class inheritance
8228
- axios$1.Axios = Axios_1;
8229
-
8230
- // Expose Cancel & CancelToken
8231
- axios$1.Cancel = Cancel_1;
8232
- axios$1.CancelToken = CancelToken_1;
8233
- axios$1.isCancel = isCancel;
8234
- axios$1.VERSION = data.version;
8235
-
8236
- // Expose all/spread
8237
- axios$1.all = function all(promises) {
8238
- return Promise.all(promises);
8239
- };
8240
- axios$1.spread = spread;
8241
-
8242
- // Expose isAxiosError
8243
- axios$1.isAxiosError = isAxiosError;
8244
-
8245
- var axios_1 = axios$1;
8246
-
8247
- // Allow use of default import syntax in TypeScript
8248
- var _default = axios$1;
8249
- axios_1.default = _default;
8250
-
8251
- var axios = axios_1;
8252
-
8253
4337
  vue.prototype.$httpRequest = axios;
8254
4338
  const baseURL = window.location.hostname == 'localhost' ? `https://linux07/im/atdHumano/middleware/atd_api.php` : `https://${window.location.hostname}`;
8255
4339
  const dev = window.location.hostname == 'localhost' ? '&teste=levchat2' : '';