vue-intergrall-plugins 0.0.160 → 0.0.163

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