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