vue-intergrall-plugins 0.0.160 → 0.0.161

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