@helpdice/theme 1.0.5 → 1.1.0

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.
Files changed (36) hide show
  1. package/dist/css-baseline/index.js +87 -3
  2. package/dist/index.d.ts +1 -0
  3. package/dist/index.js +4162 -57
  4. package/dist/subscription/SubscriptionContext.d.ts +14 -0
  5. package/dist/subscription/SubscriptionError.d.ts +5 -0
  6. package/dist/subscription/UpgradeNotice.d.ts +3 -0
  7. package/dist/subscription/index.d.ts +3 -0
  8. package/dist/subscription/index.js +4072 -0
  9. package/dist/subscription/withSubscription.d.ts +2 -0
  10. package/dist/themes/index.js +87 -2
  11. package/dist/themes/presets/index.d.ts +9 -0
  12. package/dist/themes/shadows.d.ts +82 -0
  13. package/dist/ui-provider/index.js +4062 -6
  14. package/dist/use-all-themes/index.js +87 -2
  15. package/dist/use-media-query/index.js +87 -2
  16. package/dist/use-theme/index.js +87 -2
  17. package/esm/css-baseline/css-baseline.js +0 -1
  18. package/esm/index.d.ts +1 -0
  19. package/esm/index.js +2 -1
  20. package/esm/subscription/SubscriptionContext.d.ts +14 -0
  21. package/esm/subscription/SubscriptionContext.js +66 -0
  22. package/esm/subscription/SubscriptionError.d.ts +5 -0
  23. package/esm/subscription/SubscriptionError.js +13 -0
  24. package/esm/subscription/UpgradeNotice.d.ts +3 -0
  25. package/esm/subscription/UpgradeNotice.js +15 -0
  26. package/esm/subscription/index.d.ts +3 -0
  27. package/esm/subscription/index.js +3 -0
  28. package/esm/subscription/withSubscription.d.ts +2 -0
  29. package/esm/subscription/withSubscription.js +44 -0
  30. package/esm/themes/presets/dark.js +3 -1
  31. package/esm/themes/presets/default.js +3 -1
  32. package/esm/themes/presets/index.d.ts +9 -0
  33. package/esm/themes/shadows.d.ts +82 -0
  34. package/esm/themes/shadows.js +82 -0
  35. package/esm/ui-provider/ui-provider.js +2 -1
  36. package/package.json +4 -1
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  var React = require('react');
4
4
  var reactDom = require('react-dom');
5
+ var sdk = require('@helpdice/sdk');
5
6
 
6
7
  function _arrayLikeToArray(r, a) {
7
8
  (null == a || a > r.length) && (a = r.length);
@@ -172,6 +173,89 @@ var useHUIContext = function useHUIContext() {
172
173
  return React.useContext(HUIContent);
173
174
  };
174
175
 
176
+ var shadows = {
177
+ drop: {
178
+ z1: "0px 2px 8px rgba(0, 0, 0, 0.4)",
179
+ z2: "rgba(149, 157, 165, 0.2) 0px 8px 24px",
180
+ z3: "rgba(100, 100, 111, 0.2) 0px 7px 29px 0px"
181
+ },
182
+ level: {
183
+ z1: "rgba(0, 0, 0, 0.15) 1.95px 1.95px 2.6px",
184
+ z2: "rgba(0, 0, 0, 0.16) 0px 1px 4px",
185
+ z3: "rgba(0, 0, 0, 0.35) 0px 5px 15px",
186
+ z4: "rgba(0, 0, 0, 0.24) 0px 3px 8px",
187
+ z5: "rgba(60, 64, 67, 0.3) 0px 1px 2px 0px, rgba(60, 64, 67, 0.15) 0px 2px 6px 2px",
188
+ z6: "rgba(0, 0, 0, 0.25) 0px 14px 28px, rgba(0, 0, 0, 0.22) 0px 10px 10px",
189
+ z7: "rgba(0, 0, 0, 0.3) 0px 19px 38px, rgba(0, 0, 0, 0.22) 0px 15px 12px",
190
+ z8: "rgba(0, 0, 0, 0.1) 0px 20px 25px -5px, rgba(0, 0, 0, 0.04) 0px 10px 10px -5px",
191
+ z9: "rgba(0, 0, 0, 0.1) 0px 20px 25px -5px, rgba(0, 0, 0, 0.04) 0px 10px 10px -5px",
192
+ z10: "rgba(99, 99, 99, 0.2) 0px 2px 8px 0px",
193
+ z11: "rgba(0, 0, 0, 0.1) 0px 4px 12px",
194
+ z12: "rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px",
195
+ z13: "rgb(38, 57, 77) 0px 20px 30px -10px",
196
+ z14: "rgba(50, 50, 93, 0.25) 0px 6px 12px -2px, rgba(0, 0, 0, 0.3) 0px 3px 7px -3px",
197
+ z15: "rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px",
198
+ z16: "rgba(0, 0, 0, 0.16) 0px 3px 6px, rgba(0, 0, 0, 0.23) 0px 3px 6px",
199
+ z17: "rgba(0, 0, 0, 0.19) 0px 10px 20px, rgba(0, 0, 0, 0.23) 0px 6px 6px",
200
+ z18: "rgba(0, 0, 0, 0.07) 0px 1px 1px, rgba(0, 0, 0, 0.07) 0px 2px 2px, rgba(0, 0, 0, 0.07) 0px 4px 4px, rgba(0, 0, 0, 0.07) 0px 8px 8px, rgba(0, 0, 0, 0.07) 0px 16px 16px",
201
+ z19: "rgba(0, 0, 0, 0.25) 0px 0.0625em 0.0625em, rgba(0, 0, 0, 0.25) 0px 0.125em 0.5em, rgba(255, 255, 255, 0.1) 0px 0px 0px 1px inset",
202
+ z20: "rgba(0, 0, 0, 0.1) 0px 4px 6px -1px, rgba(0, 0, 0, 0.06) 0px 2px 4px -1px",
203
+ z21: "rgba(0, 0, 0, 0.1) 0px 10px 15px -3px, rgba(0, 0, 0, 0.05) 0px 4px 6px -2px",
204
+ z22: "rgba(14, 30, 37, 0.12) 0px 2px 4px 0px, rgba(14, 30, 37, 0.32) 0px 2px 16px 0px",
205
+ z23: "rgba(17, 17, 26, 0.05) 0px 1px 0px, rgba(17, 17, 26, 0.1) 0px 0px 8px",
206
+ z24: "rgba(17, 17, 26, 0.1) 0px 0px 16px",
207
+ z25: "rgba(17, 17, 26, 0.05) 0px 4px 16px, rgba(17, 17, 26, 0.05) 0px 8px 32px",
208
+ z26: "rgba(0, 0, 0, 0.15) 2.4px 2.4px 3.2px",
209
+ z27: "rgba(0, 0, 0, 0.15) 0px 3px 3px 0px",
210
+ z28: "rgba(0, 0, 0, 0.08) 0px 4px 12px",
211
+ z29: "rgba(9, 30, 66, 0.25) 0px 4px 8px -2px, rgba(9, 30, 66, 0.08) 0px 0px 0px 1px",
212
+ z30: "rgba(0, 0, 0, 0.12) 0px 1px 3px, rgba(0, 0, 0, 0.24) 0px 1px 2px",
213
+ z31: "rgba(136, 165, 191, 0.48) 6px 2px 16px 0px, rgba(255, 255, 255, 0.8) -6px -2px 16px 0px"
214
+ },
215
+ border: {
216
+ z1: "rgba(0, 0, 0, 0.05) 0px 0px 0px 1px",
217
+ z2: "rgba(9, 30, 66, 0.25) 0px 1px 1px, rgba(9, 30, 66, 0.13) 0px 0px 1px 1px",
218
+ z3: "rgba(0, 0, 0, 0.02) 0px 1px 3px 0px, rgba(27, 31, 35, 0.15) 0px 0px 0px 1px",
219
+ z4: "rgba(0, 0, 0, 0.05) 0px 6px 24px 0px, rgba(0, 0, 0, 0.08) 0px 0px 0px 1px",
220
+ z5: "rgba(50, 50, 93, 0.25) 0px 2px 5px -1px, rgba(0, 0, 0, 0.3) 0px 1px 3px -1px",
221
+ z6: "rgba(60, 64, 67, 0.3) 0px 1px 2px 0px, rgba(60, 64, 67, 0.15) 0px 1px 3px 1px",
222
+ z7: "rgba(0, 0, 0, 0.1) 0px 0px 5px 0px, rgba(0, 0, 0, 0.1) 0px 0px 1px 0px",
223
+ z8: "rgba(67, 71, 85, 0.27) 0px 0px 0.25em, rgba(90, 125, 188, 0.05) 0px 0.25em 1em",
224
+ z9: "rgba(17, 17, 26, 0.1) 0px 4px 16px, rgba(17, 17, 26, 0.05) 0px 8px 32px",
225
+ z10: "rgba(17, 17, 26, 0.1) 0px 1px 0px, rgba(17, 17, 26, 0.1) 0px 8px 24px, rgba(17, 17, 26, 0.1) 0px 16px 48px",
226
+ z11: "rgba(17, 17, 26, 0.1) 0px 4px 16px, rgba(17, 17, 26, 0.1) 0px 8px 24px, rgba(17, 17, 26, 0.1) 0px 16px 56px",
227
+ z12: "rgba(17, 17, 26, 0.1) 0px 8px 24px, rgba(17, 17, 26, 0.1) 0px 16px 56px, rgba(17, 17, 26, 0.1) 0px 24px 80px",
228
+ z13: "rgba(0, 0, 0, 0.15) 0px 2px 8px",
229
+ z14: "rgba(0, 0, 0, 0.18) 0px 2px 4px",
230
+ z15: "rgba(0, 0, 0, 0.16) 0px 10px 36px 0px, rgba(0, 0, 0, 0.06) 0px 0px 0px 1px",
231
+ z16: "rgba(0, 0, 0, 0.2) 0px 12px 28px 0px, rgba(0, 0, 0, 0.1) 0px 2px 4px 0px, rgba(255, 255, 255, 0.05) 0px 0px 0px 1px inset",
232
+ z17: "rgba(0, 0, 0, 0.15) 0px 5px 15px 0px"
233
+ },
234
+ inner: {
235
+ z1: "rgba(50, 50, 93, 0.25) 0px 30px 60px -12px inset, rgba(0, 0, 0, 0.3) 0px 18px 36px -18px inset",
236
+ z2: "rgba(0, 0, 0, 0.06) 0px 2px 4px 0px inset",
237
+ z3: "rgb(204, 219, 232) 3px 3px 6px 0px inset, rgba(255, 255, 255, 0.5) -3px -3px 6px 1px inset",
238
+ z4: "rgba(0, 0, 0, 0.35) 0px -50px 36px -28px inset"
239
+ },
240
+ "float": {
241
+ z1: "rgba(17, 12, 46, 0.15) 0px 48px 100px 0px",
242
+ z2: "rgba(50, 50, 93, 0.25) 0px 50px 100px -20px, rgba(0, 0, 0, 0.3) 0px 30px 60px -30px, rgba(10, 37, 64, 0.35) 0px -2px 6px 0px inset",
243
+ z3: "rgba(255, 255, 255, 0.1) 0px 1px 1px 0px inset, rgba(50, 50, 93, 0.25) 0px 50px 100px -20px, rgba(0, 0, 0, 0.3) 0px 30px 60px -30px",
244
+ z4: "rgba(50, 50, 93, 0.25) 0px 50px 100px -20px, rgba(0, 0, 0, 0.3) 0px 30px 60px -30px",
245
+ z5: "rgba(50, 50, 93, 0.25) 0px 50px 100px -20px, rgba(0, 0, 0, 0.3) 0px 30px 60px -30px",
246
+ z6: "rgba(50, 50, 93, 0.25) 0px 30px 60px -12px, rgba(0, 0, 0, 0.3) 0px 18px 36px -18px",
247
+ z7: "rgba(50, 50, 93, 0.25) 0px 50px 100px -20px, rgba(0, 0, 0, 0.3) 0px 30px 60px -30px",
248
+ z8: "rgba(0, 0, 0, 0.25) 0px 25px 50px -12px",
249
+ z9: "rgba(0, 0, 0, 0.1) 0px 10px 50px"
250
+ },
251
+ top: {
252
+ z1: "rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px",
253
+ z2: "rgba(50, 50, 105, 0.15) 0px 2px 5px 0px, rgba(0, 0, 0, 0.05) 0px 1px 1px 0px",
254
+ z3: "rgba(0, 0, 0, 0.1) -4px 9px 25px -6px",
255
+ z4: "rgba(0, 0, 0, 0.09) 0px 3px 12px"
256
+ }
257
+ };
258
+
175
259
  var defaultFont = {
176
260
  sans: '"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif',
177
261
  mono: 'Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace',
@@ -275,7 +359,8 @@ var themes$1 = {
275
359
  layout: layout$1,
276
360
  palette: palette$1,
277
361
  breakpoints: breakpoints$1,
278
- expressiveness: expressiveness$1
362
+ expressiveness: expressiveness$1,
363
+ shadows: shadows
279
364
  };
280
365
 
281
366
  var palette = {
@@ -338,14 +423,15 @@ var themes = {
338
423
  layout: layout,
339
424
  palette: palette,
340
425
  breakpoints: breakpoints,
341
- expressiveness: expressiveness
426
+ expressiveness: expressiveness,
427
+ shadows: shadows
342
428
  };
343
429
 
344
- var isObject = function isObject(target) {
430
+ var isObject$1 = function isObject(target) {
345
431
  return target && _typeof(target) === 'object';
346
432
  };
347
433
  var _deepDuplicable = function deepDuplicable(source, target) {
348
- if (!isObject(target) || !isObject(source)) return source;
434
+ if (!isObject$1(target) || !isObject$1(source)) return source;
349
435
  var sourceKeys = Object.keys(source);
350
436
  var result = {};
351
437
  for (var _i = 0, _sourceKeys = sourceKeys; _i < _sourceKeys.length; _i++) {
@@ -354,7 +440,7 @@ var _deepDuplicable = function deepDuplicable(source, target) {
354
440
  var targetValue = target[key];
355
441
  if (Array.isArray(sourceValue) && Array.isArray(targetValue)) {
356
442
  result[key] = targetValue.concat(sourceValue);
357
- } else if (isObject(sourceValue) && isObject(targetValue)) {
443
+ } else if (isObject$1(sourceValue) && isObject$1(targetValue)) {
358
444
  result[key] = _deepDuplicable(sourceValue, _objectSpread2({}, targetValue));
359
445
  } else if (targetValue) {
360
446
  result[key] = targetValue;
@@ -1401,68 +1487,4086 @@ var ToastContainer = function ToastContainer() {
1401
1487
  }, ".toasts.__jsx-style-dynamic-selector{position:fixed;width:auto;max-width:100%;right:".concat(theme.layout.gap, ";bottom:").concat(theme.layout.gap, ";z-index:2000;-webkit-transition:all 400ms ease;transition:all 400ms ease;box-sizing:border-box;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}.top.__jsx-style-dynamic-selector{bottom:unset;-webkit-flex-direction:column-reverse;-ms-flex-direction:column-reverse;flex-direction:column-reverse;top:").concat(theme.layout.gap, ";}.left.__jsx-style-dynamic-selector{right:unset;left:").concat(theme.layout.gap, ";}"))), portal);
1402
1488
  };
1403
1489
 
1404
- var HuiProvider = function HuiProvider(_ref) {
1405
- var themes = _ref.themes,
1406
- themeType = _ref.themeType,
1407
- children = _ref.children;
1408
- var _React$useState = React.useState(''),
1409
- _React$useState2 = _slicedToArray(_React$useState, 2),
1410
- lastUpdateToastId = _React$useState2[0],
1411
- setLastUpdateToastId = _React$useState2[1];
1412
- var _useCurrentState = useCurrentState([]),
1413
- _useCurrentState2 = _slicedToArray(_useCurrentState, 3),
1414
- toasts = _useCurrentState2[0],
1415
- setToasts = _useCurrentState2[1],
1416
- toastsRef = _useCurrentState2[2];
1417
- var _useCurrentState3 = useCurrentState(defaultToastLayout),
1418
- _useCurrentState4 = _slicedToArray(_useCurrentState3, 3),
1419
- toastLayout = _useCurrentState4[0],
1420
- setToastLayout = _useCurrentState4[1],
1421
- toastLayoutRef = _useCurrentState4[2];
1422
- var updateToasts = function updateToasts(fn) {
1423
- var nextToasts = fn(toastsRef.current);
1424
- setToasts(nextToasts);
1490
+ /**
1491
+ * Create a bound version of a function with a specified `this` context
1492
+ *
1493
+ * @param {Function} fn - The function to bind
1494
+ * @param {*} thisArg - The value to be passed as the `this` parameter
1495
+ * @returns {Function} A new function that will call the original function with the specified `this` context
1496
+ */
1497
+ function bind(fn, thisArg) {
1498
+ return function wrap() {
1499
+ return fn.apply(thisArg, arguments);
1425
1500
  };
1426
- var updateToastLayout = function updateToastLayout(fn) {
1427
- var nextLayout = fn(toastLayoutRef.current);
1428
- setToastLayout(nextLayout);
1501
+ }
1502
+
1503
+ // utils is a library of generic helper functions non-specific to axios
1504
+
1505
+ const {toString} = Object.prototype;
1506
+ const {getPrototypeOf} = Object;
1507
+ const {iterator, toStringTag} = Symbol;
1508
+
1509
+ const kindOf = (cache => thing => {
1510
+ const str = toString.call(thing);
1511
+ return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
1512
+ })(Object.create(null));
1513
+
1514
+ const kindOfTest = (type) => {
1515
+ type = type.toLowerCase();
1516
+ return (thing) => kindOf(thing) === type
1517
+ };
1518
+
1519
+ const typeOfTest = type => thing => typeof thing === type;
1520
+
1521
+ /**
1522
+ * Determine if a value is an Array
1523
+ *
1524
+ * @param {Object} val The value to test
1525
+ *
1526
+ * @returns {boolean} True if value is an Array, otherwise false
1527
+ */
1528
+ const {isArray} = Array;
1529
+
1530
+ /**
1531
+ * Determine if a value is undefined
1532
+ *
1533
+ * @param {*} val The value to test
1534
+ *
1535
+ * @returns {boolean} True if the value is undefined, otherwise false
1536
+ */
1537
+ const isUndefined = typeOfTest('undefined');
1538
+
1539
+ /**
1540
+ * Determine if a value is a Buffer
1541
+ *
1542
+ * @param {*} val The value to test
1543
+ *
1544
+ * @returns {boolean} True if value is a Buffer, otherwise false
1545
+ */
1546
+ function isBuffer(val) {
1547
+ return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
1548
+ && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
1549
+ }
1550
+
1551
+ /**
1552
+ * Determine if a value is an ArrayBuffer
1553
+ *
1554
+ * @param {*} val The value to test
1555
+ *
1556
+ * @returns {boolean} True if value is an ArrayBuffer, otherwise false
1557
+ */
1558
+ const isArrayBuffer = kindOfTest('ArrayBuffer');
1559
+
1560
+
1561
+ /**
1562
+ * Determine if a value is a view on an ArrayBuffer
1563
+ *
1564
+ * @param {*} val The value to test
1565
+ *
1566
+ * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
1567
+ */
1568
+ function isArrayBufferView(val) {
1569
+ let result;
1570
+ if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
1571
+ result = ArrayBuffer.isView(val);
1572
+ } else {
1573
+ result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
1574
+ }
1575
+ return result;
1576
+ }
1577
+
1578
+ /**
1579
+ * Determine if a value is a String
1580
+ *
1581
+ * @param {*} val The value to test
1582
+ *
1583
+ * @returns {boolean} True if value is a String, otherwise false
1584
+ */
1585
+ const isString = typeOfTest('string');
1586
+
1587
+ /**
1588
+ * Determine if a value is a Function
1589
+ *
1590
+ * @param {*} val The value to test
1591
+ * @returns {boolean} True if value is a Function, otherwise false
1592
+ */
1593
+ const isFunction$1 = typeOfTest('function');
1594
+
1595
+ /**
1596
+ * Determine if a value is a Number
1597
+ *
1598
+ * @param {*} val The value to test
1599
+ *
1600
+ * @returns {boolean} True if value is a Number, otherwise false
1601
+ */
1602
+ const isNumber = typeOfTest('number');
1603
+
1604
+ /**
1605
+ * Determine if a value is an Object
1606
+ *
1607
+ * @param {*} thing The value to test
1608
+ *
1609
+ * @returns {boolean} True if value is an Object, otherwise false
1610
+ */
1611
+ const isObject = (thing) => thing !== null && typeof thing === 'object';
1612
+
1613
+ /**
1614
+ * Determine if a value is a Boolean
1615
+ *
1616
+ * @param {*} thing The value to test
1617
+ * @returns {boolean} True if value is a Boolean, otherwise false
1618
+ */
1619
+ const isBoolean = thing => thing === true || thing === false;
1620
+
1621
+ /**
1622
+ * Determine if a value is a plain Object
1623
+ *
1624
+ * @param {*} val The value to test
1625
+ *
1626
+ * @returns {boolean} True if value is a plain Object, otherwise false
1627
+ */
1628
+ const isPlainObject = (val) => {
1629
+ if (kindOf(val) !== 'object') {
1630
+ return false;
1631
+ }
1632
+
1633
+ const prototype = getPrototypeOf(val);
1634
+ return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
1635
+ };
1636
+
1637
+ /**
1638
+ * Determine if a value is an empty object (safely handles Buffers)
1639
+ *
1640
+ * @param {*} val The value to test
1641
+ *
1642
+ * @returns {boolean} True if value is an empty object, otherwise false
1643
+ */
1644
+ const isEmptyObject = (val) => {
1645
+ // Early return for non-objects or Buffers to prevent RangeError
1646
+ if (!isObject(val) || isBuffer(val)) {
1647
+ return false;
1648
+ }
1649
+
1650
+ try {
1651
+ return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
1652
+ } catch (e) {
1653
+ // Fallback for any other objects that might cause RangeError with Object.keys()
1654
+ return false;
1655
+ }
1656
+ };
1657
+
1658
+ /**
1659
+ * Determine if a value is a Date
1660
+ *
1661
+ * @param {*} val The value to test
1662
+ *
1663
+ * @returns {boolean} True if value is a Date, otherwise false
1664
+ */
1665
+ const isDate = kindOfTest('Date');
1666
+
1667
+ /**
1668
+ * Determine if a value is a File
1669
+ *
1670
+ * @param {*} val The value to test
1671
+ *
1672
+ * @returns {boolean} True if value is a File, otherwise false
1673
+ */
1674
+ const isFile = kindOfTest('File');
1675
+
1676
+ /**
1677
+ * Determine if a value is a Blob
1678
+ *
1679
+ * @param {*} val The value to test
1680
+ *
1681
+ * @returns {boolean} True if value is a Blob, otherwise false
1682
+ */
1683
+ const isBlob = kindOfTest('Blob');
1684
+
1685
+ /**
1686
+ * Determine if a value is a FileList
1687
+ *
1688
+ * @param {*} val The value to test
1689
+ *
1690
+ * @returns {boolean} True if value is a File, otherwise false
1691
+ */
1692
+ const isFileList = kindOfTest('FileList');
1693
+
1694
+ /**
1695
+ * Determine if a value is a Stream
1696
+ *
1697
+ * @param {*} val The value to test
1698
+ *
1699
+ * @returns {boolean} True if value is a Stream, otherwise false
1700
+ */
1701
+ const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
1702
+
1703
+ /**
1704
+ * Determine if a value is a FormData
1705
+ *
1706
+ * @param {*} thing The value to test
1707
+ *
1708
+ * @returns {boolean} True if value is an FormData, otherwise false
1709
+ */
1710
+ const isFormData = (thing) => {
1711
+ let kind;
1712
+ return thing && (
1713
+ (typeof FormData === 'function' && thing instanceof FormData) || (
1714
+ isFunction$1(thing.append) && (
1715
+ (kind = kindOf(thing)) === 'formdata' ||
1716
+ // detect form-data instance
1717
+ (kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
1718
+ )
1719
+ )
1720
+ )
1721
+ };
1722
+
1723
+ /**
1724
+ * Determine if a value is a URLSearchParams object
1725
+ *
1726
+ * @param {*} val The value to test
1727
+ *
1728
+ * @returns {boolean} True if value is a URLSearchParams object, otherwise false
1729
+ */
1730
+ const isURLSearchParams = kindOfTest('URLSearchParams');
1731
+
1732
+ const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);
1733
+
1734
+ /**
1735
+ * Trim excess whitespace off the beginning and end of a string
1736
+ *
1737
+ * @param {String} str The String to trim
1738
+ *
1739
+ * @returns {String} The String freed of excess whitespace
1740
+ */
1741
+ const trim = (str) => str.trim ?
1742
+ str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
1743
+
1744
+ /**
1745
+ * Iterate over an Array or an Object invoking a function for each item.
1746
+ *
1747
+ * If `obj` is an Array callback will be called passing
1748
+ * the value, index, and complete array for each item.
1749
+ *
1750
+ * If 'obj' is an Object callback will be called passing
1751
+ * the value, key, and complete object for each property.
1752
+ *
1753
+ * @param {Object|Array} obj The object to iterate
1754
+ * @param {Function} fn The callback to invoke for each item
1755
+ *
1756
+ * @param {Boolean} [allOwnKeys = false]
1757
+ * @returns {any}
1758
+ */
1759
+ function forEach(obj, fn, {allOwnKeys = false} = {}) {
1760
+ // Don't bother if no value provided
1761
+ if (obj === null || typeof obj === 'undefined') {
1762
+ return;
1763
+ }
1764
+
1765
+ let i;
1766
+ let l;
1767
+
1768
+ // Force an array if not already something iterable
1769
+ if (typeof obj !== 'object') {
1770
+ /*eslint no-param-reassign:0*/
1771
+ obj = [obj];
1772
+ }
1773
+
1774
+ if (isArray(obj)) {
1775
+ // Iterate over array values
1776
+ for (i = 0, l = obj.length; i < l; i++) {
1777
+ fn.call(null, obj[i], i, obj);
1778
+ }
1779
+ } else {
1780
+ // Buffer check
1781
+ if (isBuffer(obj)) {
1782
+ return;
1783
+ }
1784
+
1785
+ // Iterate over object keys
1786
+ const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
1787
+ const len = keys.length;
1788
+ let key;
1789
+
1790
+ for (i = 0; i < len; i++) {
1791
+ key = keys[i];
1792
+ fn.call(null, obj[key], key, obj);
1793
+ }
1794
+ }
1795
+ }
1796
+
1797
+ function findKey(obj, key) {
1798
+ if (isBuffer(obj)){
1799
+ return null;
1800
+ }
1801
+
1802
+ key = key.toLowerCase();
1803
+ const keys = Object.keys(obj);
1804
+ let i = keys.length;
1805
+ let _key;
1806
+ while (i-- > 0) {
1807
+ _key = keys[i];
1808
+ if (key === _key.toLowerCase()) {
1809
+ return _key;
1810
+ }
1811
+ }
1812
+ return null;
1813
+ }
1814
+
1815
+ const _global = (() => {
1816
+ /*eslint no-undef:0*/
1817
+ if (typeof globalThis !== "undefined") return globalThis;
1818
+ return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global)
1819
+ })();
1820
+
1821
+ const isContextDefined = (context) => !isUndefined(context) && context !== _global;
1822
+
1823
+ /**
1824
+ * Accepts varargs expecting each argument to be an object, then
1825
+ * immutably merges the properties of each object and returns result.
1826
+ *
1827
+ * When multiple objects contain the same key the later object in
1828
+ * the arguments list will take precedence.
1829
+ *
1830
+ * Example:
1831
+ *
1832
+ * ```js
1833
+ * var result = merge({foo: 123}, {foo: 456});
1834
+ * console.log(result.foo); // outputs 456
1835
+ * ```
1836
+ *
1837
+ * @param {Object} obj1 Object to merge
1838
+ *
1839
+ * @returns {Object} Result of all merge properties
1840
+ */
1841
+ function merge(/* obj1, obj2, obj3, ... */) {
1842
+ const {caseless, skipUndefined} = isContextDefined(this) && this || {};
1843
+ const result = {};
1844
+ const assignValue = (val, key) => {
1845
+ const targetKey = caseless && findKey(result, key) || key;
1846
+ if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
1847
+ result[targetKey] = merge(result[targetKey], val);
1848
+ } else if (isPlainObject(val)) {
1849
+ result[targetKey] = merge({}, val);
1850
+ } else if (isArray(val)) {
1851
+ result[targetKey] = val.slice();
1852
+ } else if (!skipUndefined || !isUndefined(val)) {
1853
+ result[targetKey] = val;
1854
+ }
1429
1855
  };
1430
- var updateLastToastId = function updateLastToastId(fn) {
1431
- setLastUpdateToastId(fn());
1856
+
1857
+ for (let i = 0, l = arguments.length; i < l; i++) {
1858
+ arguments[i] && forEach(arguments[i], assignValue);
1859
+ }
1860
+ return result;
1861
+ }
1862
+
1863
+ /**
1864
+ * Extends object a by mutably adding to it the properties of object b.
1865
+ *
1866
+ * @param {Object} a The object to be extended
1867
+ * @param {Object} b The object to copy properties from
1868
+ * @param {Object} thisArg The object to bind function to
1869
+ *
1870
+ * @param {Boolean} [allOwnKeys]
1871
+ * @returns {Object} The resulting value of object a
1872
+ */
1873
+ const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
1874
+ forEach(b, (val, key) => {
1875
+ if (thisArg && isFunction$1(val)) {
1876
+ a[key] = bind(val, thisArg);
1877
+ } else {
1878
+ a[key] = val;
1879
+ }
1880
+ }, {allOwnKeys});
1881
+ return a;
1882
+ };
1883
+
1884
+ /**
1885
+ * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
1886
+ *
1887
+ * @param {string} content with BOM
1888
+ *
1889
+ * @returns {string} content value without BOM
1890
+ */
1891
+ const stripBOM = (content) => {
1892
+ if (content.charCodeAt(0) === 0xFEFF) {
1893
+ content = content.slice(1);
1894
+ }
1895
+ return content;
1896
+ };
1897
+
1898
+ /**
1899
+ * Inherit the prototype methods from one constructor into another
1900
+ * @param {function} constructor
1901
+ * @param {function} superConstructor
1902
+ * @param {object} [props]
1903
+ * @param {object} [descriptors]
1904
+ *
1905
+ * @returns {void}
1906
+ */
1907
+ const inherits = (constructor, superConstructor, props, descriptors) => {
1908
+ constructor.prototype = Object.create(superConstructor.prototype, descriptors);
1909
+ constructor.prototype.constructor = constructor;
1910
+ Object.defineProperty(constructor, 'super', {
1911
+ value: superConstructor.prototype
1912
+ });
1913
+ props && Object.assign(constructor.prototype, props);
1914
+ };
1915
+
1916
+ /**
1917
+ * Resolve object with deep prototype chain to a flat object
1918
+ * @param {Object} sourceObj source object
1919
+ * @param {Object} [destObj]
1920
+ * @param {Function|Boolean} [filter]
1921
+ * @param {Function} [propFilter]
1922
+ *
1923
+ * @returns {Object}
1924
+ */
1925
+ const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
1926
+ let props;
1927
+ let i;
1928
+ let prop;
1929
+ const merged = {};
1930
+
1931
+ destObj = destObj || {};
1932
+ // eslint-disable-next-line no-eq-null,eqeqeq
1933
+ if (sourceObj == null) return destObj;
1934
+
1935
+ do {
1936
+ props = Object.getOwnPropertyNames(sourceObj);
1937
+ i = props.length;
1938
+ while (i-- > 0) {
1939
+ prop = props[i];
1940
+ if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
1941
+ destObj[prop] = sourceObj[prop];
1942
+ merged[prop] = true;
1943
+ }
1944
+ }
1945
+ sourceObj = filter !== false && getPrototypeOf(sourceObj);
1946
+ } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
1947
+
1948
+ return destObj;
1949
+ };
1950
+
1951
+ /**
1952
+ * Determines whether a string ends with the characters of a specified string
1953
+ *
1954
+ * @param {String} str
1955
+ * @param {String} searchString
1956
+ * @param {Number} [position= 0]
1957
+ *
1958
+ * @returns {boolean}
1959
+ */
1960
+ const endsWith = (str, searchString, position) => {
1961
+ str = String(str);
1962
+ if (position === undefined || position > str.length) {
1963
+ position = str.length;
1964
+ }
1965
+ position -= searchString.length;
1966
+ const lastIndex = str.indexOf(searchString, position);
1967
+ return lastIndex !== -1 && lastIndex === position;
1968
+ };
1969
+
1970
+
1971
+ /**
1972
+ * Returns new array from array like object or null if failed
1973
+ *
1974
+ * @param {*} [thing]
1975
+ *
1976
+ * @returns {?Array}
1977
+ */
1978
+ const toArray = (thing) => {
1979
+ if (!thing) return null;
1980
+ if (isArray(thing)) return thing;
1981
+ let i = thing.length;
1982
+ if (!isNumber(i)) return null;
1983
+ const arr = new Array(i);
1984
+ while (i-- > 0) {
1985
+ arr[i] = thing[i];
1986
+ }
1987
+ return arr;
1988
+ };
1989
+
1990
+ /**
1991
+ * Checking if the Uint8Array exists and if it does, it returns a function that checks if the
1992
+ * thing passed in is an instance of Uint8Array
1993
+ *
1994
+ * @param {TypedArray}
1995
+ *
1996
+ * @returns {Array}
1997
+ */
1998
+ // eslint-disable-next-line func-names
1999
+ const isTypedArray = (TypedArray => {
2000
+ // eslint-disable-next-line func-names
2001
+ return thing => {
2002
+ return TypedArray && thing instanceof TypedArray;
1432
2003
  };
1433
- var initialValue = React.useMemo(function () {
1434
- return {
1435
- toasts: toasts,
1436
- toastLayout: toastLayout,
1437
- updateToasts: updateToasts,
1438
- lastUpdateToastId: lastUpdateToastId,
1439
- updateToastLayout: updateToastLayout,
1440
- updateLastToastId: updateLastToastId
1441
- };
1442
- }, [toasts, toastLayout, lastUpdateToastId]);
1443
- return /*#__PURE__*/React.createElement(HUIContent.Provider, {
1444
- value: initialValue
1445
- }, /*#__PURE__*/React.createElement(ThemeProvider, {
1446
- themes: themes,
1447
- themeType: themeType
1448
- }, children, /*#__PURE__*/React.createElement(ToastContainer, null)));
2004
+ })(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
2005
+
2006
+ /**
2007
+ * For each entry in the object, call the function with the key and value.
2008
+ *
2009
+ * @param {Object<any, any>} obj - The object to iterate over.
2010
+ * @param {Function} fn - The function to call for each entry.
2011
+ *
2012
+ * @returns {void}
2013
+ */
2014
+ const forEachEntry = (obj, fn) => {
2015
+ const generator = obj && obj[iterator];
2016
+
2017
+ const _iterator = generator.call(obj);
2018
+
2019
+ let result;
2020
+
2021
+ while ((result = _iterator.next()) && !result.done) {
2022
+ const pair = result.value;
2023
+ fn.call(obj, pair[0], pair[1]);
2024
+ }
1449
2025
  };
1450
2026
 
1451
- var styledJsx;
1452
- var hasRequiredStyledJsx;
2027
+ /**
2028
+ * It takes a regular expression and a string, and returns an array of all the matches
2029
+ *
2030
+ * @param {string} regExp - The regular expression to match against.
2031
+ * @param {string} str - The string to search.
2032
+ *
2033
+ * @returns {Array<boolean>}
2034
+ */
2035
+ const matchAll = (regExp, str) => {
2036
+ let matches;
2037
+ const arr = [];
1453
2038
 
1454
- function requireStyledJsx () {
1455
- if (hasRequiredStyledJsx) return styledJsx;
1456
- hasRequiredStyledJsx = 1;
1457
- styledJsx = requireIndex();
1458
- return styledJsx;
2039
+ while ((matches = regExp.exec(str)) !== null) {
2040
+ arr.push(matches);
2041
+ }
2042
+
2043
+ return arr;
2044
+ };
2045
+
2046
+ /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
2047
+ const isHTMLForm = kindOfTest('HTMLFormElement');
2048
+
2049
+ const toCamelCase = str => {
2050
+ return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,
2051
+ function replacer(m, p1, p2) {
2052
+ return p1.toUpperCase() + p2;
2053
+ }
2054
+ );
2055
+ };
2056
+
2057
+ /* Creating a function that will check if an object has a property. */
2058
+ const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
2059
+
2060
+ /**
2061
+ * Determine if a value is a RegExp object
2062
+ *
2063
+ * @param {*} val The value to test
2064
+ *
2065
+ * @returns {boolean} True if value is a RegExp object, otherwise false
2066
+ */
2067
+ const isRegExp = kindOfTest('RegExp');
2068
+
2069
+ const reduceDescriptors = (obj, reducer) => {
2070
+ const descriptors = Object.getOwnPropertyDescriptors(obj);
2071
+ const reducedDescriptors = {};
2072
+
2073
+ forEach(descriptors, (descriptor, name) => {
2074
+ let ret;
2075
+ if ((ret = reducer(descriptor, name, obj)) !== false) {
2076
+ reducedDescriptors[name] = ret || descriptor;
2077
+ }
2078
+ });
2079
+
2080
+ Object.defineProperties(obj, reducedDescriptors);
2081
+ };
2082
+
2083
+ /**
2084
+ * Makes all methods read-only
2085
+ * @param {Object} obj
2086
+ */
2087
+
2088
+ const freezeMethods = (obj) => {
2089
+ reduceDescriptors(obj, (descriptor, name) => {
2090
+ // skip restricted props in strict mode
2091
+ if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
2092
+ return false;
2093
+ }
2094
+
2095
+ const value = obj[name];
2096
+
2097
+ if (!isFunction$1(value)) return;
2098
+
2099
+ descriptor.enumerable = false;
2100
+
2101
+ if ('writable' in descriptor) {
2102
+ descriptor.writable = false;
2103
+ return;
2104
+ }
2105
+
2106
+ if (!descriptor.set) {
2107
+ descriptor.set = () => {
2108
+ throw Error('Can not rewrite read-only method \'' + name + '\'');
2109
+ };
2110
+ }
2111
+ });
2112
+ };
2113
+
2114
+ const toObjectSet = (arrayOrString, delimiter) => {
2115
+ const obj = {};
2116
+
2117
+ const define = (arr) => {
2118
+ arr.forEach(value => {
2119
+ obj[value] = true;
2120
+ });
2121
+ };
2122
+
2123
+ isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
2124
+
2125
+ return obj;
2126
+ };
2127
+
2128
+ const noop = () => {};
2129
+
2130
+ const toFiniteNumber = (value, defaultValue) => {
2131
+ return value != null && Number.isFinite(value = +value) ? value : defaultValue;
2132
+ };
2133
+
2134
+
2135
+
2136
+ /**
2137
+ * If the thing is a FormData object, return true, otherwise return false.
2138
+ *
2139
+ * @param {unknown} thing - The thing to check.
2140
+ *
2141
+ * @returns {boolean}
2142
+ */
2143
+ function isSpecCompliantForm(thing) {
2144
+ return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
1459
2145
  }
1460
2146
 
1461
- var styledJsxExports = requireStyledJsx();
1462
- var flush = /*@__PURE__*/getDefaultExportFromCjs(styledJsxExports);
2147
+ const toJSONObject = (obj) => {
2148
+ const stack = new Array(10);
1463
2149
 
1464
- // export type FlushToReact = <T>(opts?: { nonce?: string }) => Array<ReactElement<T>>
2150
+ const visit = (source, i) => {
2151
+
2152
+ if (isObject(source)) {
2153
+ if (stack.indexOf(source) >= 0) {
2154
+ return;
2155
+ }
2156
+
2157
+ //Buffer check
2158
+ if (isBuffer(source)) {
2159
+ return source;
2160
+ }
2161
+
2162
+ if(!('toJSON' in source)) {
2163
+ stack[i] = source;
2164
+ const target = isArray(source) ? [] : {};
2165
+
2166
+ forEach(source, (value, key) => {
2167
+ const reducedValue = visit(value, i + 1);
2168
+ !isUndefined(reducedValue) && (target[key] = reducedValue);
2169
+ });
2170
+
2171
+ stack[i] = undefined;
2172
+
2173
+ return target;
2174
+ }
2175
+ }
2176
+
2177
+ return source;
2178
+ };
2179
+
2180
+ return visit(obj, 0);
2181
+ };
2182
+
2183
+ const isAsyncFn = kindOfTest('AsyncFunction');
2184
+
2185
+ const isThenable = (thing) =>
2186
+ thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
2187
+
2188
+ // original code
2189
+ // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
2190
+
2191
+ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
2192
+ if (setImmediateSupported) {
2193
+ return setImmediate;
2194
+ }
2195
+
2196
+ return postMessageSupported ? ((token, callbacks) => {
2197
+ _global.addEventListener("message", ({source, data}) => {
2198
+ if (source === _global && data === token) {
2199
+ callbacks.length && callbacks.shift()();
2200
+ }
2201
+ }, false);
2202
+
2203
+ return (cb) => {
2204
+ callbacks.push(cb);
2205
+ _global.postMessage(token, "*");
2206
+ }
2207
+ })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
2208
+ })(
2209
+ typeof setImmediate === 'function',
2210
+ isFunction$1(_global.postMessage)
2211
+ );
1465
2212
 
2213
+ const asap = typeof queueMicrotask !== 'undefined' ?
2214
+ queueMicrotask.bind(_global) : ( typeof process !== 'undefined' && process.nextTick || _setImmediate);
2215
+
2216
+ // *********************
2217
+
2218
+
2219
+ const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
2220
+
2221
+
2222
+ var utils$1 = {
2223
+ isArray,
2224
+ isArrayBuffer,
2225
+ isBuffer,
2226
+ isFormData,
2227
+ isArrayBufferView,
2228
+ isString,
2229
+ isNumber,
2230
+ isBoolean,
2231
+ isObject,
2232
+ isPlainObject,
2233
+ isEmptyObject,
2234
+ isReadableStream,
2235
+ isRequest,
2236
+ isResponse,
2237
+ isHeaders,
2238
+ isUndefined,
2239
+ isDate,
2240
+ isFile,
2241
+ isBlob,
2242
+ isRegExp,
2243
+ isFunction: isFunction$1,
2244
+ isStream,
2245
+ isURLSearchParams,
2246
+ isTypedArray,
2247
+ isFileList,
2248
+ forEach,
2249
+ merge,
2250
+ extend,
2251
+ trim,
2252
+ stripBOM,
2253
+ inherits,
2254
+ toFlatObject,
2255
+ kindOf,
2256
+ kindOfTest,
2257
+ endsWith,
2258
+ toArray,
2259
+ forEachEntry,
2260
+ matchAll,
2261
+ isHTMLForm,
2262
+ hasOwnProperty,
2263
+ hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection
2264
+ reduceDescriptors,
2265
+ freezeMethods,
2266
+ toObjectSet,
2267
+ toCamelCase,
2268
+ noop,
2269
+ toFiniteNumber,
2270
+ findKey,
2271
+ global: _global,
2272
+ isContextDefined,
2273
+ isSpecCompliantForm,
2274
+ toJSONObject,
2275
+ isAsyncFn,
2276
+ isThenable,
2277
+ setImmediate: _setImmediate,
2278
+ asap,
2279
+ isIterable
2280
+ };
2281
+
2282
+ /**
2283
+ * Create an Error with the specified message, config, error code, request and response.
2284
+ *
2285
+ * @param {string} message The error message.
2286
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
2287
+ * @param {Object} [config] The config.
2288
+ * @param {Object} [request] The request.
2289
+ * @param {Object} [response] The response.
2290
+ *
2291
+ * @returns {Error} The created error.
2292
+ */
2293
+ function AxiosError$1(message, code, config, request, response) {
2294
+ Error.call(this);
2295
+
2296
+ if (Error.captureStackTrace) {
2297
+ Error.captureStackTrace(this, this.constructor);
2298
+ } else {
2299
+ this.stack = (new Error()).stack;
2300
+ }
2301
+
2302
+ this.message = message;
2303
+ this.name = 'AxiosError';
2304
+ code && (this.code = code);
2305
+ config && (this.config = config);
2306
+ request && (this.request = request);
2307
+ if (response) {
2308
+ this.response = response;
2309
+ this.status = response.status ? response.status : null;
2310
+ }
2311
+ }
2312
+
2313
+ utils$1.inherits(AxiosError$1, Error, {
2314
+ toJSON: function toJSON() {
2315
+ return {
2316
+ // Standard
2317
+ message: this.message,
2318
+ name: this.name,
2319
+ // Microsoft
2320
+ description: this.description,
2321
+ number: this.number,
2322
+ // Mozilla
2323
+ fileName: this.fileName,
2324
+ lineNumber: this.lineNumber,
2325
+ columnNumber: this.columnNumber,
2326
+ stack: this.stack,
2327
+ // Axios
2328
+ config: utils$1.toJSONObject(this.config),
2329
+ code: this.code,
2330
+ status: this.status
2331
+ };
2332
+ }
2333
+ });
2334
+
2335
+ const prototype$1 = AxiosError$1.prototype;
2336
+ const descriptors = {};
2337
+
2338
+ [
2339
+ 'ERR_BAD_OPTION_VALUE',
2340
+ 'ERR_BAD_OPTION',
2341
+ 'ECONNABORTED',
2342
+ 'ETIMEDOUT',
2343
+ 'ERR_NETWORK',
2344
+ 'ERR_FR_TOO_MANY_REDIRECTS',
2345
+ 'ERR_DEPRECATED',
2346
+ 'ERR_BAD_RESPONSE',
2347
+ 'ERR_BAD_REQUEST',
2348
+ 'ERR_CANCELED',
2349
+ 'ERR_NOT_SUPPORT',
2350
+ 'ERR_INVALID_URL'
2351
+ // eslint-disable-next-line func-names
2352
+ ].forEach(code => {
2353
+ descriptors[code] = {value: code};
2354
+ });
2355
+
2356
+ Object.defineProperties(AxiosError$1, descriptors);
2357
+ Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
2358
+
2359
+ // eslint-disable-next-line func-names
2360
+ AxiosError$1.from = (error, code, config, request, response, customProps) => {
2361
+ const axiosError = Object.create(prototype$1);
2362
+
2363
+ utils$1.toFlatObject(error, axiosError, function filter(obj) {
2364
+ return obj !== Error.prototype;
2365
+ }, prop => {
2366
+ return prop !== 'isAxiosError';
2367
+ });
2368
+
2369
+ const msg = error && error.message ? error.message : 'Error';
2370
+
2371
+ // Prefer explicit code; otherwise copy the low-level error's code (e.g. ECONNREFUSED)
2372
+ const errCode = code == null && error ? error.code : code;
2373
+ AxiosError$1.call(axiosError, msg, errCode, config, request, response);
2374
+
2375
+ // Chain the original error on the standard field; non-enumerable to avoid JSON noise
2376
+ if (error && axiosError.cause == null) {
2377
+ Object.defineProperty(axiosError, 'cause', { value: error, configurable: true });
2378
+ }
2379
+
2380
+ axiosError.name = (error && error.name) || 'Error';
2381
+
2382
+ customProps && Object.assign(axiosError, customProps);
2383
+
2384
+ return axiosError;
2385
+ };
2386
+
2387
+ // eslint-disable-next-line strict
2388
+ var httpAdapter = null;
2389
+
2390
+ /**
2391
+ * Determines if the given thing is a array or js object.
2392
+ *
2393
+ * @param {string} thing - The object or array to be visited.
2394
+ *
2395
+ * @returns {boolean}
2396
+ */
2397
+ function isVisitable(thing) {
2398
+ return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
2399
+ }
2400
+
2401
+ /**
2402
+ * It removes the brackets from the end of a string
2403
+ *
2404
+ * @param {string} key - The key of the parameter.
2405
+ *
2406
+ * @returns {string} the key without the brackets.
2407
+ */
2408
+ function removeBrackets(key) {
2409
+ return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
2410
+ }
2411
+
2412
+ /**
2413
+ * It takes a path, a key, and a boolean, and returns a string
2414
+ *
2415
+ * @param {string} path - The path to the current key.
2416
+ * @param {string} key - The key of the current object being iterated over.
2417
+ * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
2418
+ *
2419
+ * @returns {string} The path to the current key.
2420
+ */
2421
+ function renderKey(path, key, dots) {
2422
+ if (!path) return key;
2423
+ return path.concat(key).map(function each(token, i) {
2424
+ // eslint-disable-next-line no-param-reassign
2425
+ token = removeBrackets(token);
2426
+ return !dots && i ? '[' + token + ']' : token;
2427
+ }).join(dots ? '.' : '');
2428
+ }
2429
+
2430
+ /**
2431
+ * If the array is an array and none of its elements are visitable, then it's a flat array.
2432
+ *
2433
+ * @param {Array<any>} arr - The array to check
2434
+ *
2435
+ * @returns {boolean}
2436
+ */
2437
+ function isFlatArray(arr) {
2438
+ return utils$1.isArray(arr) && !arr.some(isVisitable);
2439
+ }
2440
+
2441
+ const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
2442
+ return /^is[A-Z]/.test(prop);
2443
+ });
2444
+
2445
+ /**
2446
+ * Convert a data object to FormData
2447
+ *
2448
+ * @param {Object} obj
2449
+ * @param {?Object} [formData]
2450
+ * @param {?Object} [options]
2451
+ * @param {Function} [options.visitor]
2452
+ * @param {Boolean} [options.metaTokens = true]
2453
+ * @param {Boolean} [options.dots = false]
2454
+ * @param {?Boolean} [options.indexes = false]
2455
+ *
2456
+ * @returns {Object}
2457
+ **/
2458
+
2459
+ /**
2460
+ * It converts an object into a FormData object
2461
+ *
2462
+ * @param {Object<any, any>} obj - The object to convert to form data.
2463
+ * @param {string} formData - The FormData object to append to.
2464
+ * @param {Object<string, any>} options
2465
+ *
2466
+ * @returns
2467
+ */
2468
+ function toFormData$1(obj, formData, options) {
2469
+ if (!utils$1.isObject(obj)) {
2470
+ throw new TypeError('target must be an object');
2471
+ }
2472
+
2473
+ // eslint-disable-next-line no-param-reassign
2474
+ formData = formData || new (FormData)();
2475
+
2476
+ // eslint-disable-next-line no-param-reassign
2477
+ options = utils$1.toFlatObject(options, {
2478
+ metaTokens: true,
2479
+ dots: false,
2480
+ indexes: false
2481
+ }, false, function defined(option, source) {
2482
+ // eslint-disable-next-line no-eq-null,eqeqeq
2483
+ return !utils$1.isUndefined(source[option]);
2484
+ });
2485
+
2486
+ const metaTokens = options.metaTokens;
2487
+ // eslint-disable-next-line no-use-before-define
2488
+ const visitor = options.visitor || defaultVisitor;
2489
+ const dots = options.dots;
2490
+ const indexes = options.indexes;
2491
+ const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
2492
+ const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
2493
+
2494
+ if (!utils$1.isFunction(visitor)) {
2495
+ throw new TypeError('visitor must be a function');
2496
+ }
2497
+
2498
+ function convertValue(value) {
2499
+ if (value === null) return '';
2500
+
2501
+ if (utils$1.isDate(value)) {
2502
+ return value.toISOString();
2503
+ }
2504
+
2505
+ if (utils$1.isBoolean(value)) {
2506
+ return value.toString();
2507
+ }
2508
+
2509
+ if (!useBlob && utils$1.isBlob(value)) {
2510
+ throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
2511
+ }
2512
+
2513
+ if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
2514
+ return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
2515
+ }
2516
+
2517
+ return value;
2518
+ }
2519
+
2520
+ /**
2521
+ * Default visitor.
2522
+ *
2523
+ * @param {*} value
2524
+ * @param {String|Number} key
2525
+ * @param {Array<String|Number>} path
2526
+ * @this {FormData}
2527
+ *
2528
+ * @returns {boolean} return true to visit the each prop of the value recursively
2529
+ */
2530
+ function defaultVisitor(value, key, path) {
2531
+ let arr = value;
2532
+
2533
+ if (value && !path && typeof value === 'object') {
2534
+ if (utils$1.endsWith(key, '{}')) {
2535
+ // eslint-disable-next-line no-param-reassign
2536
+ key = metaTokens ? key : key.slice(0, -2);
2537
+ // eslint-disable-next-line no-param-reassign
2538
+ value = JSON.stringify(value);
2539
+ } else if (
2540
+ (utils$1.isArray(value) && isFlatArray(value)) ||
2541
+ ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
2542
+ )) {
2543
+ // eslint-disable-next-line no-param-reassign
2544
+ key = removeBrackets(key);
2545
+
2546
+ arr.forEach(function each(el, index) {
2547
+ !(utils$1.isUndefined(el) || el === null) && formData.append(
2548
+ // eslint-disable-next-line no-nested-ternary
2549
+ indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
2550
+ convertValue(el)
2551
+ );
2552
+ });
2553
+ return false;
2554
+ }
2555
+ }
2556
+
2557
+ if (isVisitable(value)) {
2558
+ return true;
2559
+ }
2560
+
2561
+ formData.append(renderKey(path, key, dots), convertValue(value));
2562
+
2563
+ return false;
2564
+ }
2565
+
2566
+ const stack = [];
2567
+
2568
+ const exposedHelpers = Object.assign(predicates, {
2569
+ defaultVisitor,
2570
+ convertValue,
2571
+ isVisitable
2572
+ });
2573
+
2574
+ function build(value, path) {
2575
+ if (utils$1.isUndefined(value)) return;
2576
+
2577
+ if (stack.indexOf(value) !== -1) {
2578
+ throw Error('Circular reference detected in ' + path.join('.'));
2579
+ }
2580
+
2581
+ stack.push(value);
2582
+
2583
+ utils$1.forEach(value, function each(el, key) {
2584
+ const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
2585
+ formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers
2586
+ );
2587
+
2588
+ if (result === true) {
2589
+ build(el, path ? path.concat(key) : [key]);
2590
+ }
2591
+ });
2592
+
2593
+ stack.pop();
2594
+ }
2595
+
2596
+ if (!utils$1.isObject(obj)) {
2597
+ throw new TypeError('data must be an object');
2598
+ }
2599
+
2600
+ build(obj);
2601
+
2602
+ return formData;
2603
+ }
2604
+
2605
+ /**
2606
+ * It encodes a string by replacing all characters that are not in the unreserved set with
2607
+ * their percent-encoded equivalents
2608
+ *
2609
+ * @param {string} str - The string to encode.
2610
+ *
2611
+ * @returns {string} The encoded string.
2612
+ */
2613
+ function encode$1(str) {
2614
+ const charMap = {
2615
+ '!': '%21',
2616
+ "'": '%27',
2617
+ '(': '%28',
2618
+ ')': '%29',
2619
+ '~': '%7E',
2620
+ '%20': '+',
2621
+ '%00': '\x00'
2622
+ };
2623
+ return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
2624
+ return charMap[match];
2625
+ });
2626
+ }
2627
+
2628
+ /**
2629
+ * It takes a params object and converts it to a FormData object
2630
+ *
2631
+ * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
2632
+ * @param {Object<string, any>} options - The options object passed to the Axios constructor.
2633
+ *
2634
+ * @returns {void}
2635
+ */
2636
+ function AxiosURLSearchParams(params, options) {
2637
+ this._pairs = [];
2638
+
2639
+ params && toFormData$1(params, this, options);
2640
+ }
2641
+
2642
+ const prototype = AxiosURLSearchParams.prototype;
2643
+
2644
+ prototype.append = function append(name, value) {
2645
+ this._pairs.push([name, value]);
2646
+ };
2647
+
2648
+ prototype.toString = function toString(encoder) {
2649
+ const _encode = encoder ? function(value) {
2650
+ return encoder.call(this, value, encode$1);
2651
+ } : encode$1;
2652
+
2653
+ return this._pairs.map(function each(pair) {
2654
+ return _encode(pair[0]) + '=' + _encode(pair[1]);
2655
+ }, '').join('&');
2656
+ };
2657
+
2658
+ /**
2659
+ * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
2660
+ * URI encoded counterparts
2661
+ *
2662
+ * @param {string} val The value to be encoded.
2663
+ *
2664
+ * @returns {string} The encoded value.
2665
+ */
2666
+ function encode(val) {
2667
+ return encodeURIComponent(val).
2668
+ replace(/%3A/gi, ':').
2669
+ replace(/%24/g, '$').
2670
+ replace(/%2C/gi, ',').
2671
+ replace(/%20/g, '+');
2672
+ }
2673
+
2674
+ /**
2675
+ * Build a URL by appending params to the end
2676
+ *
2677
+ * @param {string} url The base of the url (e.g., http://www.google.com)
2678
+ * @param {object} [params] The params to be appended
2679
+ * @param {?(object|Function)} options
2680
+ *
2681
+ * @returns {string} The formatted url
2682
+ */
2683
+ function buildURL(url, params, options) {
2684
+ /*eslint no-param-reassign:0*/
2685
+ if (!params) {
2686
+ return url;
2687
+ }
2688
+
2689
+ const _encode = options && options.encode || encode;
2690
+
2691
+ if (utils$1.isFunction(options)) {
2692
+ options = {
2693
+ serialize: options
2694
+ };
2695
+ }
2696
+
2697
+ const serializeFn = options && options.serialize;
2698
+
2699
+ let serializedParams;
2700
+
2701
+ if (serializeFn) {
2702
+ serializedParams = serializeFn(params, options);
2703
+ } else {
2704
+ serializedParams = utils$1.isURLSearchParams(params) ?
2705
+ params.toString() :
2706
+ new AxiosURLSearchParams(params, options).toString(_encode);
2707
+ }
2708
+
2709
+ if (serializedParams) {
2710
+ const hashmarkIndex = url.indexOf("#");
2711
+
2712
+ if (hashmarkIndex !== -1) {
2713
+ url = url.slice(0, hashmarkIndex);
2714
+ }
2715
+ url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
2716
+ }
2717
+
2718
+ return url;
2719
+ }
2720
+
2721
+ class InterceptorManager {
2722
+ constructor() {
2723
+ this.handlers = [];
2724
+ }
2725
+
2726
+ /**
2727
+ * Add a new interceptor to the stack
2728
+ *
2729
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
2730
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
2731
+ *
2732
+ * @return {Number} An ID used to remove interceptor later
2733
+ */
2734
+ use(fulfilled, rejected, options) {
2735
+ this.handlers.push({
2736
+ fulfilled,
2737
+ rejected,
2738
+ synchronous: options ? options.synchronous : false,
2739
+ runWhen: options ? options.runWhen : null
2740
+ });
2741
+ return this.handlers.length - 1;
2742
+ }
2743
+
2744
+ /**
2745
+ * Remove an interceptor from the stack
2746
+ *
2747
+ * @param {Number} id The ID that was returned by `use`
2748
+ *
2749
+ * @returns {void}
2750
+ */
2751
+ eject(id) {
2752
+ if (this.handlers[id]) {
2753
+ this.handlers[id] = null;
2754
+ }
2755
+ }
2756
+
2757
+ /**
2758
+ * Clear all interceptors from the stack
2759
+ *
2760
+ * @returns {void}
2761
+ */
2762
+ clear() {
2763
+ if (this.handlers) {
2764
+ this.handlers = [];
2765
+ }
2766
+ }
2767
+
2768
+ /**
2769
+ * Iterate over all the registered interceptors
2770
+ *
2771
+ * This method is particularly useful for skipping over any
2772
+ * interceptors that may have become `null` calling `eject`.
2773
+ *
2774
+ * @param {Function} fn The function to call for each interceptor
2775
+ *
2776
+ * @returns {void}
2777
+ */
2778
+ forEach(fn) {
2779
+ utils$1.forEach(this.handlers, function forEachHandler(h) {
2780
+ if (h !== null) {
2781
+ fn(h);
2782
+ }
2783
+ });
2784
+ }
2785
+ }
2786
+
2787
+ var transitionalDefaults = {
2788
+ silentJSONParsing: true,
2789
+ forcedJSONParsing: true,
2790
+ clarifyTimeoutError: false
2791
+ };
2792
+
2793
+ var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
2794
+
2795
+ var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
2796
+
2797
+ var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
2798
+
2799
+ var platform$1 = {
2800
+ isBrowser: true,
2801
+ classes: {
2802
+ URLSearchParams: URLSearchParams$1,
2803
+ FormData: FormData$1,
2804
+ Blob: Blob$1
2805
+ },
2806
+ protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
2807
+ };
2808
+
2809
+ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
2810
+
2811
+ const _navigator = typeof navigator === 'object' && navigator || undefined;
2812
+
2813
+ /**
2814
+ * Determine if we're running in a standard browser environment
2815
+ *
2816
+ * This allows axios to run in a web worker, and react-native.
2817
+ * Both environments support XMLHttpRequest, but not fully standard globals.
2818
+ *
2819
+ * web workers:
2820
+ * typeof window -> undefined
2821
+ * typeof document -> undefined
2822
+ *
2823
+ * react-native:
2824
+ * navigator.product -> 'ReactNative'
2825
+ * nativescript
2826
+ * navigator.product -> 'NativeScript' or 'NS'
2827
+ *
2828
+ * @returns {boolean}
2829
+ */
2830
+ const hasStandardBrowserEnv = hasBrowserEnv &&
2831
+ (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
2832
+
2833
+ /**
2834
+ * Determine if we're running in a standard browser webWorker environment
2835
+ *
2836
+ * Although the `isStandardBrowserEnv` method indicates that
2837
+ * `allows axios to run in a web worker`, the WebWorker will still be
2838
+ * filtered out due to its judgment standard
2839
+ * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
2840
+ * This leads to a problem when axios post `FormData` in webWorker
2841
+ */
2842
+ const hasStandardBrowserWebWorkerEnv = (() => {
2843
+ return (
2844
+ typeof WorkerGlobalScope !== 'undefined' &&
2845
+ // eslint-disable-next-line no-undef
2846
+ self instanceof WorkerGlobalScope &&
2847
+ typeof self.importScripts === 'function'
2848
+ );
2849
+ })();
2850
+
2851
+ const origin = hasBrowserEnv && window.location.href || 'http://localhost';
2852
+
2853
+ var utils = /*#__PURE__*/Object.freeze({
2854
+ __proto__: null,
2855
+ hasBrowserEnv: hasBrowserEnv,
2856
+ hasStandardBrowserEnv: hasStandardBrowserEnv,
2857
+ hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
2858
+ navigator: _navigator,
2859
+ origin: origin
2860
+ });
2861
+
2862
+ var platform = {
2863
+ ...utils,
2864
+ ...platform$1
2865
+ };
2866
+
2867
+ function toURLEncodedForm(data, options) {
2868
+ return toFormData$1(data, new platform.classes.URLSearchParams(), {
2869
+ visitor: function(value, key, path, helpers) {
2870
+ if (platform.isNode && utils$1.isBuffer(value)) {
2871
+ this.append(key, value.toString('base64'));
2872
+ return false;
2873
+ }
2874
+
2875
+ return helpers.defaultVisitor.apply(this, arguments);
2876
+ },
2877
+ ...options
2878
+ });
2879
+ }
2880
+
2881
+ /**
2882
+ * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
2883
+ *
2884
+ * @param {string} name - The name of the property to get.
2885
+ *
2886
+ * @returns An array of strings.
2887
+ */
2888
+ function parsePropPath(name) {
2889
+ // foo[x][y][z]
2890
+ // foo.x.y.z
2891
+ // foo-x-y-z
2892
+ // foo x y z
2893
+ return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
2894
+ return match[0] === '[]' ? '' : match[1] || match[0];
2895
+ });
2896
+ }
2897
+
2898
+ /**
2899
+ * Convert an array to an object.
2900
+ *
2901
+ * @param {Array<any>} arr - The array to convert to an object.
2902
+ *
2903
+ * @returns An object with the same keys and values as the array.
2904
+ */
2905
+ function arrayToObject(arr) {
2906
+ const obj = {};
2907
+ const keys = Object.keys(arr);
2908
+ let i;
2909
+ const len = keys.length;
2910
+ let key;
2911
+ for (i = 0; i < len; i++) {
2912
+ key = keys[i];
2913
+ obj[key] = arr[key];
2914
+ }
2915
+ return obj;
2916
+ }
2917
+
2918
+ /**
2919
+ * It takes a FormData object and returns a JavaScript object
2920
+ *
2921
+ * @param {string} formData The FormData object to convert to JSON.
2922
+ *
2923
+ * @returns {Object<string, any> | null} The converted object.
2924
+ */
2925
+ function formDataToJSON(formData) {
2926
+ function buildPath(path, value, target, index) {
2927
+ let name = path[index++];
2928
+
2929
+ if (name === '__proto__') return true;
2930
+
2931
+ const isNumericKey = Number.isFinite(+name);
2932
+ const isLast = index >= path.length;
2933
+ name = !name && utils$1.isArray(target) ? target.length : name;
2934
+
2935
+ if (isLast) {
2936
+ if (utils$1.hasOwnProp(target, name)) {
2937
+ target[name] = [target[name], value];
2938
+ } else {
2939
+ target[name] = value;
2940
+ }
2941
+
2942
+ return !isNumericKey;
2943
+ }
2944
+
2945
+ if (!target[name] || !utils$1.isObject(target[name])) {
2946
+ target[name] = [];
2947
+ }
2948
+
2949
+ const result = buildPath(path, value, target[name], index);
2950
+
2951
+ if (result && utils$1.isArray(target[name])) {
2952
+ target[name] = arrayToObject(target[name]);
2953
+ }
2954
+
2955
+ return !isNumericKey;
2956
+ }
2957
+
2958
+ if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
2959
+ const obj = {};
2960
+
2961
+ utils$1.forEachEntry(formData, (name, value) => {
2962
+ buildPath(parsePropPath(name), value, obj, 0);
2963
+ });
2964
+
2965
+ return obj;
2966
+ }
2967
+
2968
+ return null;
2969
+ }
2970
+
2971
+ /**
2972
+ * It takes a string, tries to parse it, and if it fails, it returns the stringified version
2973
+ * of the input
2974
+ *
2975
+ * @param {any} rawValue - The value to be stringified.
2976
+ * @param {Function} parser - A function that parses a string into a JavaScript object.
2977
+ * @param {Function} encoder - A function that takes a value and returns a string.
2978
+ *
2979
+ * @returns {string} A stringified version of the rawValue.
2980
+ */
2981
+ function stringifySafely(rawValue, parser, encoder) {
2982
+ if (utils$1.isString(rawValue)) {
2983
+ try {
2984
+ (parser || JSON.parse)(rawValue);
2985
+ return utils$1.trim(rawValue);
2986
+ } catch (e) {
2987
+ if (e.name !== 'SyntaxError') {
2988
+ throw e;
2989
+ }
2990
+ }
2991
+ }
2992
+
2993
+ return (encoder || JSON.stringify)(rawValue);
2994
+ }
2995
+
2996
+ const defaults = {
2997
+
2998
+ transitional: transitionalDefaults,
2999
+
3000
+ adapter: ['xhr', 'http', 'fetch'],
3001
+
3002
+ transformRequest: [function transformRequest(data, headers) {
3003
+ const contentType = headers.getContentType() || '';
3004
+ const hasJSONContentType = contentType.indexOf('application/json') > -1;
3005
+ const isObjectPayload = utils$1.isObject(data);
3006
+
3007
+ if (isObjectPayload && utils$1.isHTMLForm(data)) {
3008
+ data = new FormData(data);
3009
+ }
3010
+
3011
+ const isFormData = utils$1.isFormData(data);
3012
+
3013
+ if (isFormData) {
3014
+ return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
3015
+ }
3016
+
3017
+ if (utils$1.isArrayBuffer(data) ||
3018
+ utils$1.isBuffer(data) ||
3019
+ utils$1.isStream(data) ||
3020
+ utils$1.isFile(data) ||
3021
+ utils$1.isBlob(data) ||
3022
+ utils$1.isReadableStream(data)
3023
+ ) {
3024
+ return data;
3025
+ }
3026
+ if (utils$1.isArrayBufferView(data)) {
3027
+ return data.buffer;
3028
+ }
3029
+ if (utils$1.isURLSearchParams(data)) {
3030
+ headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
3031
+ return data.toString();
3032
+ }
3033
+
3034
+ let isFileList;
3035
+
3036
+ if (isObjectPayload) {
3037
+ if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
3038
+ return toURLEncodedForm(data, this.formSerializer).toString();
3039
+ }
3040
+
3041
+ if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
3042
+ const _FormData = this.env && this.env.FormData;
3043
+
3044
+ return toFormData$1(
3045
+ isFileList ? {'files[]': data} : data,
3046
+ _FormData && new _FormData(),
3047
+ this.formSerializer
3048
+ );
3049
+ }
3050
+ }
3051
+
3052
+ if (isObjectPayload || hasJSONContentType ) {
3053
+ headers.setContentType('application/json', false);
3054
+ return stringifySafely(data);
3055
+ }
3056
+
3057
+ return data;
3058
+ }],
3059
+
3060
+ transformResponse: [function transformResponse(data) {
3061
+ const transitional = this.transitional || defaults.transitional;
3062
+ const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
3063
+ const JSONRequested = this.responseType === 'json';
3064
+
3065
+ if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
3066
+ return data;
3067
+ }
3068
+
3069
+ if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
3070
+ const silentJSONParsing = transitional && transitional.silentJSONParsing;
3071
+ const strictJSONParsing = !silentJSONParsing && JSONRequested;
3072
+
3073
+ try {
3074
+ return JSON.parse(data, this.parseReviver);
3075
+ } catch (e) {
3076
+ if (strictJSONParsing) {
3077
+ if (e.name === 'SyntaxError') {
3078
+ throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
3079
+ }
3080
+ throw e;
3081
+ }
3082
+ }
3083
+ }
3084
+
3085
+ return data;
3086
+ }],
3087
+
3088
+ /**
3089
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
3090
+ * timeout is not created.
3091
+ */
3092
+ timeout: 0,
3093
+
3094
+ xsrfCookieName: 'XSRF-TOKEN',
3095
+ xsrfHeaderName: 'X-XSRF-TOKEN',
3096
+
3097
+ maxContentLength: -1,
3098
+ maxBodyLength: -1,
3099
+
3100
+ env: {
3101
+ FormData: platform.classes.FormData,
3102
+ Blob: platform.classes.Blob
3103
+ },
3104
+
3105
+ validateStatus: function validateStatus(status) {
3106
+ return status >= 200 && status < 300;
3107
+ },
3108
+
3109
+ headers: {
3110
+ common: {
3111
+ 'Accept': 'application/json, text/plain, */*',
3112
+ 'Content-Type': undefined
3113
+ }
3114
+ }
3115
+ };
3116
+
3117
+ utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
3118
+ defaults.headers[method] = {};
3119
+ });
3120
+
3121
+ // RawAxiosHeaders whose duplicates are ignored by node
3122
+ // c.f. https://nodejs.org/api/http.html#http_message_headers
3123
+ const ignoreDuplicateOf = utils$1.toObjectSet([
3124
+ 'age', 'authorization', 'content-length', 'content-type', 'etag',
3125
+ 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
3126
+ 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
3127
+ 'referer', 'retry-after', 'user-agent'
3128
+ ]);
3129
+
3130
+ /**
3131
+ * Parse headers into an object
3132
+ *
3133
+ * ```
3134
+ * Date: Wed, 27 Aug 2014 08:58:49 GMT
3135
+ * Content-Type: application/json
3136
+ * Connection: keep-alive
3137
+ * Transfer-Encoding: chunked
3138
+ * ```
3139
+ *
3140
+ * @param {String} rawHeaders Headers needing to be parsed
3141
+ *
3142
+ * @returns {Object} Headers parsed into an object
3143
+ */
3144
+ var parseHeaders = rawHeaders => {
3145
+ const parsed = {};
3146
+ let key;
3147
+ let val;
3148
+ let i;
3149
+
3150
+ rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
3151
+ i = line.indexOf(':');
3152
+ key = line.substring(0, i).trim().toLowerCase();
3153
+ val = line.substring(i + 1).trim();
3154
+
3155
+ if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
3156
+ return;
3157
+ }
3158
+
3159
+ if (key === 'set-cookie') {
3160
+ if (parsed[key]) {
3161
+ parsed[key].push(val);
3162
+ } else {
3163
+ parsed[key] = [val];
3164
+ }
3165
+ } else {
3166
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
3167
+ }
3168
+ });
3169
+
3170
+ return parsed;
3171
+ };
3172
+
3173
+ const $internals = Symbol('internals');
3174
+
3175
+ function normalizeHeader(header) {
3176
+ return header && String(header).trim().toLowerCase();
3177
+ }
3178
+
3179
+ function normalizeValue(value) {
3180
+ if (value === false || value == null) {
3181
+ return value;
3182
+ }
3183
+
3184
+ return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
3185
+ }
3186
+
3187
+ function parseTokens(str) {
3188
+ const tokens = Object.create(null);
3189
+ const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
3190
+ let match;
3191
+
3192
+ while ((match = tokensRE.exec(str))) {
3193
+ tokens[match[1]] = match[2];
3194
+ }
3195
+
3196
+ return tokens;
3197
+ }
3198
+
3199
+ const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
3200
+
3201
+ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
3202
+ if (utils$1.isFunction(filter)) {
3203
+ return filter.call(this, value, header);
3204
+ }
3205
+
3206
+ if (isHeaderNameFilter) {
3207
+ value = header;
3208
+ }
3209
+
3210
+ if (!utils$1.isString(value)) return;
3211
+
3212
+ if (utils$1.isString(filter)) {
3213
+ return value.indexOf(filter) !== -1;
3214
+ }
3215
+
3216
+ if (utils$1.isRegExp(filter)) {
3217
+ return filter.test(value);
3218
+ }
3219
+ }
3220
+
3221
+ function formatHeader(header) {
3222
+ return header.trim()
3223
+ .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
3224
+ return char.toUpperCase() + str;
3225
+ });
3226
+ }
3227
+
3228
+ function buildAccessors(obj, header) {
3229
+ const accessorName = utils$1.toCamelCase(' ' + header);
3230
+
3231
+ ['get', 'set', 'has'].forEach(methodName => {
3232
+ Object.defineProperty(obj, methodName + accessorName, {
3233
+ value: function(arg1, arg2, arg3) {
3234
+ return this[methodName].call(this, header, arg1, arg2, arg3);
3235
+ },
3236
+ configurable: true
3237
+ });
3238
+ });
3239
+ }
3240
+
3241
+ let AxiosHeaders$1 = class AxiosHeaders {
3242
+ constructor(headers) {
3243
+ headers && this.set(headers);
3244
+ }
3245
+
3246
+ set(header, valueOrRewrite, rewrite) {
3247
+ const self = this;
3248
+
3249
+ function setHeader(_value, _header, _rewrite) {
3250
+ const lHeader = normalizeHeader(_header);
3251
+
3252
+ if (!lHeader) {
3253
+ throw new Error('header name must be a non-empty string');
3254
+ }
3255
+
3256
+ const key = utils$1.findKey(self, lHeader);
3257
+
3258
+ if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
3259
+ self[key || _header] = normalizeValue(_value);
3260
+ }
3261
+ }
3262
+
3263
+ const setHeaders = (headers, _rewrite) =>
3264
+ utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
3265
+
3266
+ if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
3267
+ setHeaders(header, valueOrRewrite);
3268
+ } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
3269
+ setHeaders(parseHeaders(header), valueOrRewrite);
3270
+ } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
3271
+ let obj = {}, dest, key;
3272
+ for (const entry of header) {
3273
+ if (!utils$1.isArray(entry)) {
3274
+ throw TypeError('Object iterator must return a key-value pair');
3275
+ }
3276
+
3277
+ obj[key = entry[0]] = (dest = obj[key]) ?
3278
+ (utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]]) : entry[1];
3279
+ }
3280
+
3281
+ setHeaders(obj, valueOrRewrite);
3282
+ } else {
3283
+ header != null && setHeader(valueOrRewrite, header, rewrite);
3284
+ }
3285
+
3286
+ return this;
3287
+ }
3288
+
3289
+ get(header, parser) {
3290
+ header = normalizeHeader(header);
3291
+
3292
+ if (header) {
3293
+ const key = utils$1.findKey(this, header);
3294
+
3295
+ if (key) {
3296
+ const value = this[key];
3297
+
3298
+ if (!parser) {
3299
+ return value;
3300
+ }
3301
+
3302
+ if (parser === true) {
3303
+ return parseTokens(value);
3304
+ }
3305
+
3306
+ if (utils$1.isFunction(parser)) {
3307
+ return parser.call(this, value, key);
3308
+ }
3309
+
3310
+ if (utils$1.isRegExp(parser)) {
3311
+ return parser.exec(value);
3312
+ }
3313
+
3314
+ throw new TypeError('parser must be boolean|regexp|function');
3315
+ }
3316
+ }
3317
+ }
3318
+
3319
+ has(header, matcher) {
3320
+ header = normalizeHeader(header);
3321
+
3322
+ if (header) {
3323
+ const key = utils$1.findKey(this, header);
3324
+
3325
+ return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
3326
+ }
3327
+
3328
+ return false;
3329
+ }
3330
+
3331
+ delete(header, matcher) {
3332
+ const self = this;
3333
+ let deleted = false;
3334
+
3335
+ function deleteHeader(_header) {
3336
+ _header = normalizeHeader(_header);
3337
+
3338
+ if (_header) {
3339
+ const key = utils$1.findKey(self, _header);
3340
+
3341
+ if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
3342
+ delete self[key];
3343
+
3344
+ deleted = true;
3345
+ }
3346
+ }
3347
+ }
3348
+
3349
+ if (utils$1.isArray(header)) {
3350
+ header.forEach(deleteHeader);
3351
+ } else {
3352
+ deleteHeader(header);
3353
+ }
3354
+
3355
+ return deleted;
3356
+ }
3357
+
3358
+ clear(matcher) {
3359
+ const keys = Object.keys(this);
3360
+ let i = keys.length;
3361
+ let deleted = false;
3362
+
3363
+ while (i--) {
3364
+ const key = keys[i];
3365
+ if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
3366
+ delete this[key];
3367
+ deleted = true;
3368
+ }
3369
+ }
3370
+
3371
+ return deleted;
3372
+ }
3373
+
3374
+ normalize(format) {
3375
+ const self = this;
3376
+ const headers = {};
3377
+
3378
+ utils$1.forEach(this, (value, header) => {
3379
+ const key = utils$1.findKey(headers, header);
3380
+
3381
+ if (key) {
3382
+ self[key] = normalizeValue(value);
3383
+ delete self[header];
3384
+ return;
3385
+ }
3386
+
3387
+ const normalized = format ? formatHeader(header) : String(header).trim();
3388
+
3389
+ if (normalized !== header) {
3390
+ delete self[header];
3391
+ }
3392
+
3393
+ self[normalized] = normalizeValue(value);
3394
+
3395
+ headers[normalized] = true;
3396
+ });
3397
+
3398
+ return this;
3399
+ }
3400
+
3401
+ concat(...targets) {
3402
+ return this.constructor.concat(this, ...targets);
3403
+ }
3404
+
3405
+ toJSON(asStrings) {
3406
+ const obj = Object.create(null);
3407
+
3408
+ utils$1.forEach(this, (value, header) => {
3409
+ value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
3410
+ });
3411
+
3412
+ return obj;
3413
+ }
3414
+
3415
+ [Symbol.iterator]() {
3416
+ return Object.entries(this.toJSON())[Symbol.iterator]();
3417
+ }
3418
+
3419
+ toString() {
3420
+ return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
3421
+ }
3422
+
3423
+ getSetCookie() {
3424
+ return this.get("set-cookie") || [];
3425
+ }
3426
+
3427
+ get [Symbol.toStringTag]() {
3428
+ return 'AxiosHeaders';
3429
+ }
3430
+
3431
+ static from(thing) {
3432
+ return thing instanceof this ? thing : new this(thing);
3433
+ }
3434
+
3435
+ static concat(first, ...targets) {
3436
+ const computed = new this(first);
3437
+
3438
+ targets.forEach((target) => computed.set(target));
3439
+
3440
+ return computed;
3441
+ }
3442
+
3443
+ static accessor(header) {
3444
+ const internals = this[$internals] = (this[$internals] = {
3445
+ accessors: {}
3446
+ });
3447
+
3448
+ const accessors = internals.accessors;
3449
+ const prototype = this.prototype;
3450
+
3451
+ function defineAccessor(_header) {
3452
+ const lHeader = normalizeHeader(_header);
3453
+
3454
+ if (!accessors[lHeader]) {
3455
+ buildAccessors(prototype, _header);
3456
+ accessors[lHeader] = true;
3457
+ }
3458
+ }
3459
+
3460
+ utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
3461
+
3462
+ return this;
3463
+ }
3464
+ };
3465
+
3466
+ AxiosHeaders$1.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
3467
+
3468
+ // reserved names hotfix
3469
+ utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({value}, key) => {
3470
+ let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
3471
+ return {
3472
+ get: () => value,
3473
+ set(headerValue) {
3474
+ this[mapped] = headerValue;
3475
+ }
3476
+ }
3477
+ });
3478
+
3479
+ utils$1.freezeMethods(AxiosHeaders$1);
3480
+
3481
+ /**
3482
+ * Transform the data for a request or a response
3483
+ *
3484
+ * @param {Array|Function} fns A single function or Array of functions
3485
+ * @param {?Object} response The response object
3486
+ *
3487
+ * @returns {*} The resulting transformed data
3488
+ */
3489
+ function transformData(fns, response) {
3490
+ const config = this || defaults;
3491
+ const context = response || config;
3492
+ const headers = AxiosHeaders$1.from(context.headers);
3493
+ let data = context.data;
3494
+
3495
+ utils$1.forEach(fns, function transform(fn) {
3496
+ data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
3497
+ });
3498
+
3499
+ headers.normalize();
3500
+
3501
+ return data;
3502
+ }
3503
+
3504
+ function isCancel$1(value) {
3505
+ return !!(value && value.__CANCEL__);
3506
+ }
3507
+
3508
+ /**
3509
+ * A `CanceledError` is an object that is thrown when an operation is canceled.
3510
+ *
3511
+ * @param {string=} message The message.
3512
+ * @param {Object=} config The config.
3513
+ * @param {Object=} request The request.
3514
+ *
3515
+ * @returns {CanceledError} The created error.
3516
+ */
3517
+ function CanceledError$1(message, config, request) {
3518
+ // eslint-disable-next-line no-eq-null,eqeqeq
3519
+ AxiosError$1.call(this, message == null ? 'canceled' : message, AxiosError$1.ERR_CANCELED, config, request);
3520
+ this.name = 'CanceledError';
3521
+ }
3522
+
3523
+ utils$1.inherits(CanceledError$1, AxiosError$1, {
3524
+ __CANCEL__: true
3525
+ });
3526
+
3527
+ /**
3528
+ * Resolve or reject a Promise based on response status.
3529
+ *
3530
+ * @param {Function} resolve A function that resolves the promise.
3531
+ * @param {Function} reject A function that rejects the promise.
3532
+ * @param {object} response The response.
3533
+ *
3534
+ * @returns {object} The response.
3535
+ */
3536
+ function settle(resolve, reject, response) {
3537
+ const validateStatus = response.config.validateStatus;
3538
+ if (!response.status || !validateStatus || validateStatus(response.status)) {
3539
+ resolve(response);
3540
+ } else {
3541
+ reject(new AxiosError$1(
3542
+ 'Request failed with status code ' + response.status,
3543
+ [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
3544
+ response.config,
3545
+ response.request,
3546
+ response
3547
+ ));
3548
+ }
3549
+ }
3550
+
3551
+ function parseProtocol(url) {
3552
+ const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
3553
+ return match && match[1] || '';
3554
+ }
3555
+
3556
+ /**
3557
+ * Calculate data maxRate
3558
+ * @param {Number} [samplesCount= 10]
3559
+ * @param {Number} [min= 1000]
3560
+ * @returns {Function}
3561
+ */
3562
+ function speedometer(samplesCount, min) {
3563
+ samplesCount = samplesCount || 10;
3564
+ const bytes = new Array(samplesCount);
3565
+ const timestamps = new Array(samplesCount);
3566
+ let head = 0;
3567
+ let tail = 0;
3568
+ let firstSampleTS;
3569
+
3570
+ min = min !== undefined ? min : 1000;
3571
+
3572
+ return function push(chunkLength) {
3573
+ const now = Date.now();
3574
+
3575
+ const startedAt = timestamps[tail];
3576
+
3577
+ if (!firstSampleTS) {
3578
+ firstSampleTS = now;
3579
+ }
3580
+
3581
+ bytes[head] = chunkLength;
3582
+ timestamps[head] = now;
3583
+
3584
+ let i = tail;
3585
+ let bytesCount = 0;
3586
+
3587
+ while (i !== head) {
3588
+ bytesCount += bytes[i++];
3589
+ i = i % samplesCount;
3590
+ }
3591
+
3592
+ head = (head + 1) % samplesCount;
3593
+
3594
+ if (head === tail) {
3595
+ tail = (tail + 1) % samplesCount;
3596
+ }
3597
+
3598
+ if (now - firstSampleTS < min) {
3599
+ return;
3600
+ }
3601
+
3602
+ const passed = startedAt && now - startedAt;
3603
+
3604
+ return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
3605
+ };
3606
+ }
3607
+
3608
+ /**
3609
+ * Throttle decorator
3610
+ * @param {Function} fn
3611
+ * @param {Number} freq
3612
+ * @return {Function}
3613
+ */
3614
+ function throttle(fn, freq) {
3615
+ let timestamp = 0;
3616
+ let threshold = 1000 / freq;
3617
+ let lastArgs;
3618
+ let timer;
3619
+
3620
+ const invoke = (args, now = Date.now()) => {
3621
+ timestamp = now;
3622
+ lastArgs = null;
3623
+ if (timer) {
3624
+ clearTimeout(timer);
3625
+ timer = null;
3626
+ }
3627
+ fn(...args);
3628
+ };
3629
+
3630
+ const throttled = (...args) => {
3631
+ const now = Date.now();
3632
+ const passed = now - timestamp;
3633
+ if ( passed >= threshold) {
3634
+ invoke(args, now);
3635
+ } else {
3636
+ lastArgs = args;
3637
+ if (!timer) {
3638
+ timer = setTimeout(() => {
3639
+ timer = null;
3640
+ invoke(lastArgs);
3641
+ }, threshold - passed);
3642
+ }
3643
+ }
3644
+ };
3645
+
3646
+ const flush = () => lastArgs && invoke(lastArgs);
3647
+
3648
+ return [throttled, flush];
3649
+ }
3650
+
3651
+ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
3652
+ let bytesNotified = 0;
3653
+ const _speedometer = speedometer(50, 250);
3654
+
3655
+ return throttle(e => {
3656
+ const loaded = e.loaded;
3657
+ const total = e.lengthComputable ? e.total : undefined;
3658
+ const progressBytes = loaded - bytesNotified;
3659
+ const rate = _speedometer(progressBytes);
3660
+ const inRange = loaded <= total;
3661
+
3662
+ bytesNotified = loaded;
3663
+
3664
+ const data = {
3665
+ loaded,
3666
+ total,
3667
+ progress: total ? (loaded / total) : undefined,
3668
+ bytes: progressBytes,
3669
+ rate: rate ? rate : undefined,
3670
+ estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
3671
+ event: e,
3672
+ lengthComputable: total != null,
3673
+ [isDownloadStream ? 'download' : 'upload']: true
3674
+ };
3675
+
3676
+ listener(data);
3677
+ }, freq);
3678
+ };
3679
+
3680
+ const progressEventDecorator = (total, throttled) => {
3681
+ const lengthComputable = total != null;
3682
+
3683
+ return [(loaded) => throttled[0]({
3684
+ lengthComputable,
3685
+ total,
3686
+ loaded
3687
+ }), throttled[1]];
3688
+ };
3689
+
3690
+ const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
3691
+
3692
+ var isURLSameOrigin = platform.hasStandardBrowserEnv ? ((origin, isMSIE) => (url) => {
3693
+ url = new URL(url, platform.origin);
3694
+
3695
+ return (
3696
+ origin.protocol === url.protocol &&
3697
+ origin.host === url.host &&
3698
+ (isMSIE || origin.port === url.port)
3699
+ );
3700
+ })(
3701
+ new URL(platform.origin),
3702
+ platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
3703
+ ) : () => true;
3704
+
3705
+ var cookies = platform.hasStandardBrowserEnv ?
3706
+
3707
+ // Standard browser envs support document.cookie
3708
+ {
3709
+ write(name, value, expires, path, domain, secure, sameSite) {
3710
+ if (typeof document === 'undefined') return;
3711
+
3712
+ const cookie = [`${name}=${encodeURIComponent(value)}`];
3713
+
3714
+ if (utils$1.isNumber(expires)) {
3715
+ cookie.push(`expires=${new Date(expires).toUTCString()}`);
3716
+ }
3717
+ if (utils$1.isString(path)) {
3718
+ cookie.push(`path=${path}`);
3719
+ }
3720
+ if (utils$1.isString(domain)) {
3721
+ cookie.push(`domain=${domain}`);
3722
+ }
3723
+ if (secure === true) {
3724
+ cookie.push('secure');
3725
+ }
3726
+ if (utils$1.isString(sameSite)) {
3727
+ cookie.push(`SameSite=${sameSite}`);
3728
+ }
3729
+
3730
+ document.cookie = cookie.join('; ');
3731
+ },
3732
+
3733
+ read(name) {
3734
+ if (typeof document === 'undefined') return null;
3735
+ const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
3736
+ return match ? decodeURIComponent(match[1]) : null;
3737
+ },
3738
+
3739
+ remove(name) {
3740
+ this.write(name, '', Date.now() - 86400000, '/');
3741
+ }
3742
+ }
3743
+
3744
+ :
3745
+
3746
+ // Non-standard browser env (web workers, react-native) lack needed support.
3747
+ {
3748
+ write() {},
3749
+ read() {
3750
+ return null;
3751
+ },
3752
+ remove() {}
3753
+ };
3754
+
3755
+ /**
3756
+ * Determines whether the specified URL is absolute
3757
+ *
3758
+ * @param {string} url The URL to test
3759
+ *
3760
+ * @returns {boolean} True if the specified URL is absolute, otherwise false
3761
+ */
3762
+ function isAbsoluteURL(url) {
3763
+ // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
3764
+ // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
3765
+ // by any combination of letters, digits, plus, period, or hyphen.
3766
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
3767
+ }
3768
+
3769
+ /**
3770
+ * Creates a new URL by combining the specified URLs
3771
+ *
3772
+ * @param {string} baseURL The base URL
3773
+ * @param {string} relativeURL The relative URL
3774
+ *
3775
+ * @returns {string} The combined URL
3776
+ */
3777
+ function combineURLs(baseURL, relativeURL) {
3778
+ return relativeURL
3779
+ ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
3780
+ : baseURL;
3781
+ }
3782
+
3783
+ /**
3784
+ * Creates a new URL by combining the baseURL with the requestedURL,
3785
+ * only when the requestedURL is not already an absolute URL.
3786
+ * If the requestURL is absolute, this function returns the requestedURL untouched.
3787
+ *
3788
+ * @param {string} baseURL The base URL
3789
+ * @param {string} requestedURL Absolute or relative URL to combine
3790
+ *
3791
+ * @returns {string} The combined full path
3792
+ */
3793
+ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
3794
+ let isRelativeUrl = !isAbsoluteURL(requestedURL);
3795
+ if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
3796
+ return combineURLs(baseURL, requestedURL);
3797
+ }
3798
+ return requestedURL;
3799
+ }
3800
+
3801
+ const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
3802
+
3803
+ /**
3804
+ * Config-specific merge-function which creates a new config-object
3805
+ * by merging two configuration objects together.
3806
+ *
3807
+ * @param {Object} config1
3808
+ * @param {Object} config2
3809
+ *
3810
+ * @returns {Object} New object resulting from merging config2 to config1
3811
+ */
3812
+ function mergeConfig$1(config1, config2) {
3813
+ // eslint-disable-next-line no-param-reassign
3814
+ config2 = config2 || {};
3815
+ const config = {};
3816
+
3817
+ function getMergedValue(target, source, prop, caseless) {
3818
+ if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
3819
+ return utils$1.merge.call({caseless}, target, source);
3820
+ } else if (utils$1.isPlainObject(source)) {
3821
+ return utils$1.merge({}, source);
3822
+ } else if (utils$1.isArray(source)) {
3823
+ return source.slice();
3824
+ }
3825
+ return source;
3826
+ }
3827
+
3828
+ // eslint-disable-next-line consistent-return
3829
+ function mergeDeepProperties(a, b, prop, caseless) {
3830
+ if (!utils$1.isUndefined(b)) {
3831
+ return getMergedValue(a, b, prop, caseless);
3832
+ } else if (!utils$1.isUndefined(a)) {
3833
+ return getMergedValue(undefined, a, prop, caseless);
3834
+ }
3835
+ }
3836
+
3837
+ // eslint-disable-next-line consistent-return
3838
+ function valueFromConfig2(a, b) {
3839
+ if (!utils$1.isUndefined(b)) {
3840
+ return getMergedValue(undefined, b);
3841
+ }
3842
+ }
3843
+
3844
+ // eslint-disable-next-line consistent-return
3845
+ function defaultToConfig2(a, b) {
3846
+ if (!utils$1.isUndefined(b)) {
3847
+ return getMergedValue(undefined, b);
3848
+ } else if (!utils$1.isUndefined(a)) {
3849
+ return getMergedValue(undefined, a);
3850
+ }
3851
+ }
3852
+
3853
+ // eslint-disable-next-line consistent-return
3854
+ function mergeDirectKeys(a, b, prop) {
3855
+ if (prop in config2) {
3856
+ return getMergedValue(a, b);
3857
+ } else if (prop in config1) {
3858
+ return getMergedValue(undefined, a);
3859
+ }
3860
+ }
3861
+
3862
+ const mergeMap = {
3863
+ url: valueFromConfig2,
3864
+ method: valueFromConfig2,
3865
+ data: valueFromConfig2,
3866
+ baseURL: defaultToConfig2,
3867
+ transformRequest: defaultToConfig2,
3868
+ transformResponse: defaultToConfig2,
3869
+ paramsSerializer: defaultToConfig2,
3870
+ timeout: defaultToConfig2,
3871
+ timeoutMessage: defaultToConfig2,
3872
+ withCredentials: defaultToConfig2,
3873
+ withXSRFToken: defaultToConfig2,
3874
+ adapter: defaultToConfig2,
3875
+ responseType: defaultToConfig2,
3876
+ xsrfCookieName: defaultToConfig2,
3877
+ xsrfHeaderName: defaultToConfig2,
3878
+ onUploadProgress: defaultToConfig2,
3879
+ onDownloadProgress: defaultToConfig2,
3880
+ decompress: defaultToConfig2,
3881
+ maxContentLength: defaultToConfig2,
3882
+ maxBodyLength: defaultToConfig2,
3883
+ beforeRedirect: defaultToConfig2,
3884
+ transport: defaultToConfig2,
3885
+ httpAgent: defaultToConfig2,
3886
+ httpsAgent: defaultToConfig2,
3887
+ cancelToken: defaultToConfig2,
3888
+ socketPath: defaultToConfig2,
3889
+ responseEncoding: defaultToConfig2,
3890
+ validateStatus: mergeDirectKeys,
3891
+ headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
3892
+ };
3893
+
3894
+ utils$1.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
3895
+ const merge = mergeMap[prop] || mergeDeepProperties;
3896
+ const configValue = merge(config1[prop], config2[prop], prop);
3897
+ (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
3898
+ });
3899
+
3900
+ return config;
3901
+ }
3902
+
3903
+ var resolveConfig = (config) => {
3904
+ const newConfig = mergeConfig$1({}, config);
3905
+
3906
+ let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
3907
+
3908
+ newConfig.headers = headers = AxiosHeaders$1.from(headers);
3909
+
3910
+ newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
3911
+
3912
+ // HTTP basic authentication
3913
+ if (auth) {
3914
+ headers.set('Authorization', 'Basic ' +
3915
+ btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))
3916
+ );
3917
+ }
3918
+
3919
+ if (utils$1.isFormData(data)) {
3920
+ if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
3921
+ headers.setContentType(undefined); // browser handles it
3922
+ } else if (utils$1.isFunction(data.getHeaders)) {
3923
+ // Node.js FormData (like form-data package)
3924
+ const formHeaders = data.getHeaders();
3925
+ // Only set safe headers to avoid overwriting security headers
3926
+ const allowedHeaders = ['content-type', 'content-length'];
3927
+ Object.entries(formHeaders).forEach(([key, val]) => {
3928
+ if (allowedHeaders.includes(key.toLowerCase())) {
3929
+ headers.set(key, val);
3930
+ }
3931
+ });
3932
+ }
3933
+ }
3934
+
3935
+ // Add xsrf header
3936
+ // This is only done if running in a standard browser environment.
3937
+ // Specifically not if we're in a web worker, or react-native.
3938
+
3939
+ if (platform.hasStandardBrowserEnv) {
3940
+ withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
3941
+
3942
+ if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
3943
+ // Add xsrf header
3944
+ const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
3945
+
3946
+ if (xsrfValue) {
3947
+ headers.set(xsrfHeaderName, xsrfValue);
3948
+ }
3949
+ }
3950
+ }
3951
+
3952
+ return newConfig;
3953
+ };
3954
+
3955
+ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
3956
+
3957
+ var xhrAdapter = isXHRAdapterSupported && function (config) {
3958
+ return new Promise(function dispatchXhrRequest(resolve, reject) {
3959
+ const _config = resolveConfig(config);
3960
+ let requestData = _config.data;
3961
+ const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
3962
+ let {responseType, onUploadProgress, onDownloadProgress} = _config;
3963
+ let onCanceled;
3964
+ let uploadThrottled, downloadThrottled;
3965
+ let flushUpload, flushDownload;
3966
+
3967
+ function done() {
3968
+ flushUpload && flushUpload(); // flush events
3969
+ flushDownload && flushDownload(); // flush events
3970
+
3971
+ _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
3972
+
3973
+ _config.signal && _config.signal.removeEventListener('abort', onCanceled);
3974
+ }
3975
+
3976
+ let request = new XMLHttpRequest();
3977
+
3978
+ request.open(_config.method.toUpperCase(), _config.url, true);
3979
+
3980
+ // Set the request timeout in MS
3981
+ request.timeout = _config.timeout;
3982
+
3983
+ function onloadend() {
3984
+ if (!request) {
3985
+ return;
3986
+ }
3987
+ // Prepare the response
3988
+ const responseHeaders = AxiosHeaders$1.from(
3989
+ 'getAllResponseHeaders' in request && request.getAllResponseHeaders()
3990
+ );
3991
+ const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
3992
+ request.responseText : request.response;
3993
+ const response = {
3994
+ data: responseData,
3995
+ status: request.status,
3996
+ statusText: request.statusText,
3997
+ headers: responseHeaders,
3998
+ config,
3999
+ request
4000
+ };
4001
+
4002
+ settle(function _resolve(value) {
4003
+ resolve(value);
4004
+ done();
4005
+ }, function _reject(err) {
4006
+ reject(err);
4007
+ done();
4008
+ }, response);
4009
+
4010
+ // Clean up request
4011
+ request = null;
4012
+ }
4013
+
4014
+ if ('onloadend' in request) {
4015
+ // Use onloadend if available
4016
+ request.onloadend = onloadend;
4017
+ } else {
4018
+ // Listen for ready state to emulate onloadend
4019
+ request.onreadystatechange = function handleLoad() {
4020
+ if (!request || request.readyState !== 4) {
4021
+ return;
4022
+ }
4023
+
4024
+ // The request errored out and we didn't get a response, this will be
4025
+ // handled by onerror instead
4026
+ // With one exception: request that using file: protocol, most browsers
4027
+ // will return status as 0 even though it's a successful request
4028
+ if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
4029
+ return;
4030
+ }
4031
+ // readystate handler is calling before onerror or ontimeout handlers,
4032
+ // so we should call onloadend on the next 'tick'
4033
+ setTimeout(onloadend);
4034
+ };
4035
+ }
4036
+
4037
+ // Handle browser request cancellation (as opposed to a manual cancellation)
4038
+ request.onabort = function handleAbort() {
4039
+ if (!request) {
4040
+ return;
4041
+ }
4042
+
4043
+ reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
4044
+
4045
+ // Clean up request
4046
+ request = null;
4047
+ };
4048
+
4049
+ // Handle low level network errors
4050
+ request.onerror = function handleError(event) {
4051
+ // Browsers deliver a ProgressEvent in XHR onerror
4052
+ // (message may be empty; when present, surface it)
4053
+ // See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
4054
+ const msg = event && event.message ? event.message : 'Network Error';
4055
+ const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
4056
+ // attach the underlying event for consumers who want details
4057
+ err.event = event || null;
4058
+ reject(err);
4059
+ request = null;
4060
+ };
4061
+
4062
+ // Handle timeout
4063
+ request.ontimeout = function handleTimeout() {
4064
+ let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
4065
+ const transitional = _config.transitional || transitionalDefaults;
4066
+ if (_config.timeoutErrorMessage) {
4067
+ timeoutErrorMessage = _config.timeoutErrorMessage;
4068
+ }
4069
+ reject(new AxiosError$1(
4070
+ timeoutErrorMessage,
4071
+ transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
4072
+ config,
4073
+ request));
4074
+
4075
+ // Clean up request
4076
+ request = null;
4077
+ };
4078
+
4079
+ // Remove Content-Type if data is undefined
4080
+ requestData === undefined && requestHeaders.setContentType(null);
4081
+
4082
+ // Add headers to the request
4083
+ if ('setRequestHeader' in request) {
4084
+ utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
4085
+ request.setRequestHeader(key, val);
4086
+ });
4087
+ }
4088
+
4089
+ // Add withCredentials to request if needed
4090
+ if (!utils$1.isUndefined(_config.withCredentials)) {
4091
+ request.withCredentials = !!_config.withCredentials;
4092
+ }
4093
+
4094
+ // Add responseType to request if needed
4095
+ if (responseType && responseType !== 'json') {
4096
+ request.responseType = _config.responseType;
4097
+ }
4098
+
4099
+ // Handle progress if needed
4100
+ if (onDownloadProgress) {
4101
+ ([downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true));
4102
+ request.addEventListener('progress', downloadThrottled);
4103
+ }
4104
+
4105
+ // Not all browsers support upload events
4106
+ if (onUploadProgress && request.upload) {
4107
+ ([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress));
4108
+
4109
+ request.upload.addEventListener('progress', uploadThrottled);
4110
+
4111
+ request.upload.addEventListener('loadend', flushUpload);
4112
+ }
4113
+
4114
+ if (_config.cancelToken || _config.signal) {
4115
+ // Handle cancellation
4116
+ // eslint-disable-next-line func-names
4117
+ onCanceled = cancel => {
4118
+ if (!request) {
4119
+ return;
4120
+ }
4121
+ reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
4122
+ request.abort();
4123
+ request = null;
4124
+ };
4125
+
4126
+ _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
4127
+ if (_config.signal) {
4128
+ _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
4129
+ }
4130
+ }
4131
+
4132
+ const protocol = parseProtocol(_config.url);
4133
+
4134
+ if (protocol && platform.protocols.indexOf(protocol) === -1) {
4135
+ reject(new AxiosError$1('Unsupported protocol ' + protocol + ':', AxiosError$1.ERR_BAD_REQUEST, config));
4136
+ return;
4137
+ }
4138
+
4139
+
4140
+ // Send the request
4141
+ request.send(requestData || null);
4142
+ });
4143
+ };
4144
+
4145
+ const composeSignals = (signals, timeout) => {
4146
+ const {length} = (signals = signals ? signals.filter(Boolean) : []);
4147
+
4148
+ if (timeout || length) {
4149
+ let controller = new AbortController();
4150
+
4151
+ let aborted;
4152
+
4153
+ const onabort = function (reason) {
4154
+ if (!aborted) {
4155
+ aborted = true;
4156
+ unsubscribe();
4157
+ const err = reason instanceof Error ? reason : this.reason;
4158
+ controller.abort(err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err));
4159
+ }
4160
+ };
4161
+
4162
+ let timer = timeout && setTimeout(() => {
4163
+ timer = null;
4164
+ onabort(new AxiosError$1(`timeout ${timeout} of ms exceeded`, AxiosError$1.ETIMEDOUT));
4165
+ }, timeout);
4166
+
4167
+ const unsubscribe = () => {
4168
+ if (signals) {
4169
+ timer && clearTimeout(timer);
4170
+ timer = null;
4171
+ signals.forEach(signal => {
4172
+ signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
4173
+ });
4174
+ signals = null;
4175
+ }
4176
+ };
4177
+
4178
+ signals.forEach((signal) => signal.addEventListener('abort', onabort));
4179
+
4180
+ const {signal} = controller;
4181
+
4182
+ signal.unsubscribe = () => utils$1.asap(unsubscribe);
4183
+
4184
+ return signal;
4185
+ }
4186
+ };
4187
+
4188
+ const streamChunk = function* (chunk, chunkSize) {
4189
+ let len = chunk.byteLength;
4190
+
4191
+ if (len < chunkSize) {
4192
+ yield chunk;
4193
+ return;
4194
+ }
4195
+
4196
+ let pos = 0;
4197
+ let end;
4198
+
4199
+ while (pos < len) {
4200
+ end = pos + chunkSize;
4201
+ yield chunk.slice(pos, end);
4202
+ pos = end;
4203
+ }
4204
+ };
4205
+
4206
+ const readBytes = async function* (iterable, chunkSize) {
4207
+ for await (const chunk of readStream(iterable)) {
4208
+ yield* streamChunk(chunk, chunkSize);
4209
+ }
4210
+ };
4211
+
4212
+ const readStream = async function* (stream) {
4213
+ if (stream[Symbol.asyncIterator]) {
4214
+ yield* stream;
4215
+ return;
4216
+ }
4217
+
4218
+ const reader = stream.getReader();
4219
+ try {
4220
+ for (;;) {
4221
+ const {done, value} = await reader.read();
4222
+ if (done) {
4223
+ break;
4224
+ }
4225
+ yield value;
4226
+ }
4227
+ } finally {
4228
+ await reader.cancel();
4229
+ }
4230
+ };
4231
+
4232
+ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
4233
+ const iterator = readBytes(stream, chunkSize);
4234
+
4235
+ let bytes = 0;
4236
+ let done;
4237
+ let _onFinish = (e) => {
4238
+ if (!done) {
4239
+ done = true;
4240
+ onFinish && onFinish(e);
4241
+ }
4242
+ };
4243
+
4244
+ return new ReadableStream({
4245
+ async pull(controller) {
4246
+ try {
4247
+ const {done, value} = await iterator.next();
4248
+
4249
+ if (done) {
4250
+ _onFinish();
4251
+ controller.close();
4252
+ return;
4253
+ }
4254
+
4255
+ let len = value.byteLength;
4256
+ if (onProgress) {
4257
+ let loadedBytes = bytes += len;
4258
+ onProgress(loadedBytes);
4259
+ }
4260
+ controller.enqueue(new Uint8Array(value));
4261
+ } catch (err) {
4262
+ _onFinish(err);
4263
+ throw err;
4264
+ }
4265
+ },
4266
+ cancel(reason) {
4267
+ _onFinish(reason);
4268
+ return iterator.return();
4269
+ }
4270
+ }, {
4271
+ highWaterMark: 2
4272
+ })
4273
+ };
4274
+
4275
+ const DEFAULT_CHUNK_SIZE = 64 * 1024;
4276
+
4277
+ const {isFunction} = utils$1;
4278
+
4279
+ const globalFetchAPI = (({Request, Response}) => ({
4280
+ Request, Response
4281
+ }))(utils$1.global);
4282
+
4283
+ const {
4284
+ ReadableStream: ReadableStream$1, TextEncoder
4285
+ } = utils$1.global;
4286
+
4287
+
4288
+ const test = (fn, ...args) => {
4289
+ try {
4290
+ return !!fn(...args);
4291
+ } catch (e) {
4292
+ return false
4293
+ }
4294
+ };
4295
+
4296
+ const factory = (env) => {
4297
+ env = utils$1.merge.call({
4298
+ skipUndefined: true
4299
+ }, globalFetchAPI, env);
4300
+
4301
+ const {fetch: envFetch, Request, Response} = env;
4302
+ const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
4303
+ const isRequestSupported = isFunction(Request);
4304
+ const isResponseSupported = isFunction(Response);
4305
+
4306
+ if (!isFetchSupported) {
4307
+ return false;
4308
+ }
4309
+
4310
+ const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
4311
+
4312
+ const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
4313
+ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
4314
+ async (str) => new Uint8Array(await new Request(str).arrayBuffer())
4315
+ );
4316
+
4317
+ const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
4318
+ let duplexAccessed = false;
4319
+
4320
+ const hasContentType = new Request(platform.origin, {
4321
+ body: new ReadableStream$1(),
4322
+ method: 'POST',
4323
+ get duplex() {
4324
+ duplexAccessed = true;
4325
+ return 'half';
4326
+ },
4327
+ }).headers.has('Content-Type');
4328
+
4329
+ return duplexAccessed && !hasContentType;
4330
+ });
4331
+
4332
+ const supportsResponseStream = isResponseSupported && isReadableStreamSupported &&
4333
+ test(() => utils$1.isReadableStream(new Response('').body));
4334
+
4335
+ const resolvers = {
4336
+ stream: supportsResponseStream && ((res) => res.body)
4337
+ };
4338
+
4339
+ isFetchSupported && ((() => {
4340
+ ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
4341
+ !resolvers[type] && (resolvers[type] = (res, config) => {
4342
+ let method = res && res[type];
4343
+
4344
+ if (method) {
4345
+ return method.call(res);
4346
+ }
4347
+
4348
+ throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
4349
+ });
4350
+ });
4351
+ })());
4352
+
4353
+ const getBodyLength = async (body) => {
4354
+ if (body == null) {
4355
+ return 0;
4356
+ }
4357
+
4358
+ if (utils$1.isBlob(body)) {
4359
+ return body.size;
4360
+ }
4361
+
4362
+ if (utils$1.isSpecCompliantForm(body)) {
4363
+ const _request = new Request(platform.origin, {
4364
+ method: 'POST',
4365
+ body,
4366
+ });
4367
+ return (await _request.arrayBuffer()).byteLength;
4368
+ }
4369
+
4370
+ if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
4371
+ return body.byteLength;
4372
+ }
4373
+
4374
+ if (utils$1.isURLSearchParams(body)) {
4375
+ body = body + '';
4376
+ }
4377
+
4378
+ if (utils$1.isString(body)) {
4379
+ return (await encodeText(body)).byteLength;
4380
+ }
4381
+ };
4382
+
4383
+ const resolveBodyLength = async (headers, body) => {
4384
+ const length = utils$1.toFiniteNumber(headers.getContentLength());
4385
+
4386
+ return length == null ? getBodyLength(body) : length;
4387
+ };
4388
+
4389
+ return async (config) => {
4390
+ let {
4391
+ url,
4392
+ method,
4393
+ data,
4394
+ signal,
4395
+ cancelToken,
4396
+ timeout,
4397
+ onDownloadProgress,
4398
+ onUploadProgress,
4399
+ responseType,
4400
+ headers,
4401
+ withCredentials = 'same-origin',
4402
+ fetchOptions
4403
+ } = resolveConfig(config);
4404
+
4405
+ let _fetch = envFetch || fetch;
4406
+
4407
+ responseType = responseType ? (responseType + '').toLowerCase() : 'text';
4408
+
4409
+ let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
4410
+
4411
+ let request = null;
4412
+
4413
+ const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
4414
+ composedSignal.unsubscribe();
4415
+ });
4416
+
4417
+ let requestContentLength;
4418
+
4419
+ try {
4420
+ if (
4421
+ onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
4422
+ (requestContentLength = await resolveBodyLength(headers, data)) !== 0
4423
+ ) {
4424
+ let _request = new Request(url, {
4425
+ method: 'POST',
4426
+ body: data,
4427
+ duplex: "half"
4428
+ });
4429
+
4430
+ let contentTypeHeader;
4431
+
4432
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
4433
+ headers.setContentType(contentTypeHeader);
4434
+ }
4435
+
4436
+ if (_request.body) {
4437
+ const [onProgress, flush] = progressEventDecorator(
4438
+ requestContentLength,
4439
+ progressEventReducer(asyncDecorator(onUploadProgress))
4440
+ );
4441
+
4442
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
4443
+ }
4444
+ }
4445
+
4446
+ if (!utils$1.isString(withCredentials)) {
4447
+ withCredentials = withCredentials ? 'include' : 'omit';
4448
+ }
4449
+
4450
+ // Cloudflare Workers throws when credentials are defined
4451
+ // see https://github.com/cloudflare/workerd/issues/902
4452
+ const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
4453
+
4454
+ const resolvedOptions = {
4455
+ ...fetchOptions,
4456
+ signal: composedSignal,
4457
+ method: method.toUpperCase(),
4458
+ headers: headers.normalize().toJSON(),
4459
+ body: data,
4460
+ duplex: "half",
4461
+ credentials: isCredentialsSupported ? withCredentials : undefined
4462
+ };
4463
+
4464
+ request = isRequestSupported && new Request(url, resolvedOptions);
4465
+
4466
+ let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
4467
+
4468
+ const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
4469
+
4470
+ if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
4471
+ const options = {};
4472
+
4473
+ ['status', 'statusText', 'headers'].forEach(prop => {
4474
+ options[prop] = response[prop];
4475
+ });
4476
+
4477
+ const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
4478
+
4479
+ const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
4480
+ responseContentLength,
4481
+ progressEventReducer(asyncDecorator(onDownloadProgress), true)
4482
+ ) || [];
4483
+
4484
+ response = new Response(
4485
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
4486
+ flush && flush();
4487
+ unsubscribe && unsubscribe();
4488
+ }),
4489
+ options
4490
+ );
4491
+ }
4492
+
4493
+ responseType = responseType || 'text';
4494
+
4495
+ let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
4496
+
4497
+ !isStreamResponse && unsubscribe && unsubscribe();
4498
+
4499
+ return await new Promise((resolve, reject) => {
4500
+ settle(resolve, reject, {
4501
+ data: responseData,
4502
+ headers: AxiosHeaders$1.from(response.headers),
4503
+ status: response.status,
4504
+ statusText: response.statusText,
4505
+ config,
4506
+ request
4507
+ });
4508
+ })
4509
+ } catch (err) {
4510
+ unsubscribe && unsubscribe();
4511
+
4512
+ if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
4513
+ throw Object.assign(
4514
+ new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request),
4515
+ {
4516
+ cause: err.cause || err
4517
+ }
4518
+ )
4519
+ }
4520
+
4521
+ throw AxiosError$1.from(err, err && err.code, config, request);
4522
+ }
4523
+ }
4524
+ };
4525
+
4526
+ const seedCache = new Map();
4527
+
4528
+ const getFetch = (config) => {
4529
+ let env = (config && config.env) || {};
4530
+ const {fetch, Request, Response} = env;
4531
+ const seeds = [
4532
+ Request, Response, fetch
4533
+ ];
4534
+
4535
+ let len = seeds.length, i = len,
4536
+ seed, target, map = seedCache;
4537
+
4538
+ while (i--) {
4539
+ seed = seeds[i];
4540
+ target = map.get(seed);
4541
+
4542
+ target === undefined && map.set(seed, target = (i ? new Map() : factory(env)));
4543
+
4544
+ map = target;
4545
+ }
4546
+
4547
+ return target;
4548
+ };
4549
+
4550
+ getFetch();
4551
+
4552
+ /**
4553
+ * Known adapters mapping.
4554
+ * Provides environment-specific adapters for Axios:
4555
+ * - `http` for Node.js
4556
+ * - `xhr` for browsers
4557
+ * - `fetch` for fetch API-based requests
4558
+ *
4559
+ * @type {Object<string, Function|Object>}
4560
+ */
4561
+ const knownAdapters = {
4562
+ http: httpAdapter,
4563
+ xhr: xhrAdapter,
4564
+ fetch: {
4565
+ get: getFetch,
4566
+ }
4567
+ };
4568
+
4569
+ // Assign adapter names for easier debugging and identification
4570
+ utils$1.forEach(knownAdapters, (fn, value) => {
4571
+ if (fn) {
4572
+ try {
4573
+ Object.defineProperty(fn, 'name', { value });
4574
+ } catch (e) {
4575
+ // eslint-disable-next-line no-empty
4576
+ }
4577
+ Object.defineProperty(fn, 'adapterName', { value });
4578
+ }
4579
+ });
4580
+
4581
+ /**
4582
+ * Render a rejection reason string for unknown or unsupported adapters
4583
+ *
4584
+ * @param {string} reason
4585
+ * @returns {string}
4586
+ */
4587
+ const renderReason = (reason) => `- ${reason}`;
4588
+
4589
+ /**
4590
+ * Check if the adapter is resolved (function, null, or false)
4591
+ *
4592
+ * @param {Function|null|false} adapter
4593
+ * @returns {boolean}
4594
+ */
4595
+ const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
4596
+
4597
+ /**
4598
+ * Get the first suitable adapter from the provided list.
4599
+ * Tries each adapter in order until a supported one is found.
4600
+ * Throws an AxiosError if no adapter is suitable.
4601
+ *
4602
+ * @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
4603
+ * @param {Object} config - Axios request configuration
4604
+ * @throws {AxiosError} If no suitable adapter is available
4605
+ * @returns {Function} The resolved adapter function
4606
+ */
4607
+ function getAdapter$1(adapters, config) {
4608
+ adapters = utils$1.isArray(adapters) ? adapters : [adapters];
4609
+
4610
+ const { length } = adapters;
4611
+ let nameOrAdapter;
4612
+ let adapter;
4613
+
4614
+ const rejectedReasons = {};
4615
+
4616
+ for (let i = 0; i < length; i++) {
4617
+ nameOrAdapter = adapters[i];
4618
+ let id;
4619
+
4620
+ adapter = nameOrAdapter;
4621
+
4622
+ if (!isResolvedHandle(nameOrAdapter)) {
4623
+ adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
4624
+
4625
+ if (adapter === undefined) {
4626
+ throw new AxiosError$1(`Unknown adapter '${id}'`);
4627
+ }
4628
+ }
4629
+
4630
+ if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
4631
+ break;
4632
+ }
4633
+
4634
+ rejectedReasons[id || '#' + i] = adapter;
4635
+ }
4636
+
4637
+ if (!adapter) {
4638
+ const reasons = Object.entries(rejectedReasons)
4639
+ .map(([id, state]) => `adapter ${id} ` +
4640
+ (state === false ? 'is not supported by the environment' : 'is not available in the build')
4641
+ );
4642
+
4643
+ let s = length ?
4644
+ (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
4645
+ 'as no adapter specified';
4646
+
4647
+ throw new AxiosError$1(
4648
+ `There is no suitable adapter to dispatch the request ` + s,
4649
+ 'ERR_NOT_SUPPORT'
4650
+ );
4651
+ }
4652
+
4653
+ return adapter;
4654
+ }
4655
+
4656
+ /**
4657
+ * Exports Axios adapters and utility to resolve an adapter
4658
+ */
4659
+ var adapters = {
4660
+ /**
4661
+ * Resolve an adapter from a list of adapter names or functions.
4662
+ * @type {Function}
4663
+ */
4664
+ getAdapter: getAdapter$1,
4665
+
4666
+ /**
4667
+ * Exposes all known adapters
4668
+ * @type {Object<string, Function|Object>}
4669
+ */
4670
+ adapters: knownAdapters
4671
+ };
4672
+
4673
+ /**
4674
+ * Throws a `CanceledError` if cancellation has been requested.
4675
+ *
4676
+ * @param {Object} config The config that is to be used for the request
4677
+ *
4678
+ * @returns {void}
4679
+ */
4680
+ function throwIfCancellationRequested(config) {
4681
+ if (config.cancelToken) {
4682
+ config.cancelToken.throwIfRequested();
4683
+ }
4684
+
4685
+ if (config.signal && config.signal.aborted) {
4686
+ throw new CanceledError$1(null, config);
4687
+ }
4688
+ }
4689
+
4690
+ /**
4691
+ * Dispatch a request to the server using the configured adapter.
4692
+ *
4693
+ * @param {object} config The config that is to be used for the request
4694
+ *
4695
+ * @returns {Promise} The Promise to be fulfilled
4696
+ */
4697
+ function dispatchRequest(config) {
4698
+ throwIfCancellationRequested(config);
4699
+
4700
+ config.headers = AxiosHeaders$1.from(config.headers);
4701
+
4702
+ // Transform request data
4703
+ config.data = transformData.call(
4704
+ config,
4705
+ config.transformRequest
4706
+ );
4707
+
4708
+ if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
4709
+ config.headers.setContentType('application/x-www-form-urlencoded', false);
4710
+ }
4711
+
4712
+ const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
4713
+
4714
+ return adapter(config).then(function onAdapterResolution(response) {
4715
+ throwIfCancellationRequested(config);
4716
+
4717
+ // Transform response data
4718
+ response.data = transformData.call(
4719
+ config,
4720
+ config.transformResponse,
4721
+ response
4722
+ );
4723
+
4724
+ response.headers = AxiosHeaders$1.from(response.headers);
4725
+
4726
+ return response;
4727
+ }, function onAdapterRejection(reason) {
4728
+ if (!isCancel$1(reason)) {
4729
+ throwIfCancellationRequested(config);
4730
+
4731
+ // Transform response data
4732
+ if (reason && reason.response) {
4733
+ reason.response.data = transformData.call(
4734
+ config,
4735
+ config.transformResponse,
4736
+ reason.response
4737
+ );
4738
+ reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
4739
+ }
4740
+ }
4741
+
4742
+ return Promise.reject(reason);
4743
+ });
4744
+ }
4745
+
4746
+ const VERSION$1 = "1.13.2";
4747
+
4748
+ const validators$1 = {};
4749
+
4750
+ // eslint-disable-next-line func-names
4751
+ ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {
4752
+ validators$1[type] = function validator(thing) {
4753
+ return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
4754
+ };
4755
+ });
4756
+
4757
+ const deprecatedWarnings = {};
4758
+
4759
+ /**
4760
+ * Transitional option validator
4761
+ *
4762
+ * @param {function|boolean?} validator - set to false if the transitional option has been removed
4763
+ * @param {string?} version - deprecated version / removed since version
4764
+ * @param {string?} message - some message with additional info
4765
+ *
4766
+ * @returns {function}
4767
+ */
4768
+ validators$1.transitional = function transitional(validator, version, message) {
4769
+ function formatMessage(opt, desc) {
4770
+ return '[Axios v' + VERSION$1 + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
4771
+ }
4772
+
4773
+ // eslint-disable-next-line func-names
4774
+ return (value, opt, opts) => {
4775
+ if (validator === false) {
4776
+ throw new AxiosError$1(
4777
+ formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
4778
+ AxiosError$1.ERR_DEPRECATED
4779
+ );
4780
+ }
4781
+
4782
+ if (version && !deprecatedWarnings[opt]) {
4783
+ deprecatedWarnings[opt] = true;
4784
+ // eslint-disable-next-line no-console
4785
+ console.warn(
4786
+ formatMessage(
4787
+ opt,
4788
+ ' has been deprecated since v' + version + ' and will be removed in the near future'
4789
+ )
4790
+ );
4791
+ }
4792
+
4793
+ return validator ? validator(value, opt, opts) : true;
4794
+ };
4795
+ };
4796
+
4797
+ validators$1.spelling = function spelling(correctSpelling) {
4798
+ return (value, opt) => {
4799
+ // eslint-disable-next-line no-console
4800
+ console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
4801
+ return true;
4802
+ }
4803
+ };
4804
+
4805
+ /**
4806
+ * Assert object's properties type
4807
+ *
4808
+ * @param {object} options
4809
+ * @param {object} schema
4810
+ * @param {boolean?} allowUnknown
4811
+ *
4812
+ * @returns {object}
4813
+ */
4814
+
4815
+ function assertOptions(options, schema, allowUnknown) {
4816
+ if (typeof options !== 'object') {
4817
+ throw new AxiosError$1('options must be an object', AxiosError$1.ERR_BAD_OPTION_VALUE);
4818
+ }
4819
+ const keys = Object.keys(options);
4820
+ let i = keys.length;
4821
+ while (i-- > 0) {
4822
+ const opt = keys[i];
4823
+ const validator = schema[opt];
4824
+ if (validator) {
4825
+ const value = options[opt];
4826
+ const result = value === undefined || validator(value, opt, options);
4827
+ if (result !== true) {
4828
+ throw new AxiosError$1('option ' + opt + ' must be ' + result, AxiosError$1.ERR_BAD_OPTION_VALUE);
4829
+ }
4830
+ continue;
4831
+ }
4832
+ if (allowUnknown !== true) {
4833
+ throw new AxiosError$1('Unknown option ' + opt, AxiosError$1.ERR_BAD_OPTION);
4834
+ }
4835
+ }
4836
+ }
4837
+
4838
+ var validator = {
4839
+ assertOptions,
4840
+ validators: validators$1
4841
+ };
4842
+
4843
+ const validators = validator.validators;
4844
+
4845
+ /**
4846
+ * Create a new instance of Axios
4847
+ *
4848
+ * @param {Object} instanceConfig The default config for the instance
4849
+ *
4850
+ * @return {Axios} A new instance of Axios
4851
+ */
4852
+ let Axios$1 = class Axios {
4853
+ constructor(instanceConfig) {
4854
+ this.defaults = instanceConfig || {};
4855
+ this.interceptors = {
4856
+ request: new InterceptorManager(),
4857
+ response: new InterceptorManager()
4858
+ };
4859
+ }
4860
+
4861
+ /**
4862
+ * Dispatch a request
4863
+ *
4864
+ * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
4865
+ * @param {?Object} config
4866
+ *
4867
+ * @returns {Promise} The Promise to be fulfilled
4868
+ */
4869
+ async request(configOrUrl, config) {
4870
+ try {
4871
+ return await this._request(configOrUrl, config);
4872
+ } catch (err) {
4873
+ if (err instanceof Error) {
4874
+ let dummy = {};
4875
+
4876
+ Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
4877
+
4878
+ // slice off the Error: ... line
4879
+ const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
4880
+ try {
4881
+ if (!err.stack) {
4882
+ err.stack = stack;
4883
+ // match without the 2 top stack lines
4884
+ } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
4885
+ err.stack += '\n' + stack;
4886
+ }
4887
+ } catch (e) {
4888
+ // ignore the case where "stack" is an un-writable property
4889
+ }
4890
+ }
4891
+
4892
+ throw err;
4893
+ }
4894
+ }
4895
+
4896
+ _request(configOrUrl, config) {
4897
+ /*eslint no-param-reassign:0*/
4898
+ // Allow for axios('example/url'[, config]) a la fetch API
4899
+ if (typeof configOrUrl === 'string') {
4900
+ config = config || {};
4901
+ config.url = configOrUrl;
4902
+ } else {
4903
+ config = configOrUrl || {};
4904
+ }
4905
+
4906
+ config = mergeConfig$1(this.defaults, config);
4907
+
4908
+ const {transitional, paramsSerializer, headers} = config;
4909
+
4910
+ if (transitional !== undefined) {
4911
+ validator.assertOptions(transitional, {
4912
+ silentJSONParsing: validators.transitional(validators.boolean),
4913
+ forcedJSONParsing: validators.transitional(validators.boolean),
4914
+ clarifyTimeoutError: validators.transitional(validators.boolean)
4915
+ }, false);
4916
+ }
4917
+
4918
+ if (paramsSerializer != null) {
4919
+ if (utils$1.isFunction(paramsSerializer)) {
4920
+ config.paramsSerializer = {
4921
+ serialize: paramsSerializer
4922
+ };
4923
+ } else {
4924
+ validator.assertOptions(paramsSerializer, {
4925
+ encode: validators.function,
4926
+ serialize: validators.function
4927
+ }, true);
4928
+ }
4929
+ }
4930
+
4931
+ // Set config.allowAbsoluteUrls
4932
+ if (config.allowAbsoluteUrls !== undefined) ; else if (this.defaults.allowAbsoluteUrls !== undefined) {
4933
+ config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
4934
+ } else {
4935
+ config.allowAbsoluteUrls = true;
4936
+ }
4937
+
4938
+ validator.assertOptions(config, {
4939
+ baseUrl: validators.spelling('baseURL'),
4940
+ withXsrfToken: validators.spelling('withXSRFToken')
4941
+ }, true);
4942
+
4943
+ // Set config.method
4944
+ config.method = (config.method || this.defaults.method || 'get').toLowerCase();
4945
+
4946
+ // Flatten headers
4947
+ let contextHeaders = headers && utils$1.merge(
4948
+ headers.common,
4949
+ headers[config.method]
4950
+ );
4951
+
4952
+ headers && utils$1.forEach(
4953
+ ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
4954
+ (method) => {
4955
+ delete headers[method];
4956
+ }
4957
+ );
4958
+
4959
+ config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
4960
+
4961
+ // filter out skipped interceptors
4962
+ const requestInterceptorChain = [];
4963
+ let synchronousRequestInterceptors = true;
4964
+ this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
4965
+ if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
4966
+ return;
4967
+ }
4968
+
4969
+ synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
4970
+
4971
+ requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
4972
+ });
4973
+
4974
+ const responseInterceptorChain = [];
4975
+ this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
4976
+ responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
4977
+ });
4978
+
4979
+ let promise;
4980
+ let i = 0;
4981
+ let len;
4982
+
4983
+ if (!synchronousRequestInterceptors) {
4984
+ const chain = [dispatchRequest.bind(this), undefined];
4985
+ chain.unshift(...requestInterceptorChain);
4986
+ chain.push(...responseInterceptorChain);
4987
+ len = chain.length;
4988
+
4989
+ promise = Promise.resolve(config);
4990
+
4991
+ while (i < len) {
4992
+ promise = promise.then(chain[i++], chain[i++]);
4993
+ }
4994
+
4995
+ return promise;
4996
+ }
4997
+
4998
+ len = requestInterceptorChain.length;
4999
+
5000
+ let newConfig = config;
5001
+
5002
+ while (i < len) {
5003
+ const onFulfilled = requestInterceptorChain[i++];
5004
+ const onRejected = requestInterceptorChain[i++];
5005
+ try {
5006
+ newConfig = onFulfilled(newConfig);
5007
+ } catch (error) {
5008
+ onRejected.call(this, error);
5009
+ break;
5010
+ }
5011
+ }
5012
+
5013
+ try {
5014
+ promise = dispatchRequest.call(this, newConfig);
5015
+ } catch (error) {
5016
+ return Promise.reject(error);
5017
+ }
5018
+
5019
+ i = 0;
5020
+ len = responseInterceptorChain.length;
5021
+
5022
+ while (i < len) {
5023
+ promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
5024
+ }
5025
+
5026
+ return promise;
5027
+ }
5028
+
5029
+ getUri(config) {
5030
+ config = mergeConfig$1(this.defaults, config);
5031
+ const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
5032
+ return buildURL(fullPath, config.params, config.paramsSerializer);
5033
+ }
5034
+ };
5035
+
5036
+ // Provide aliases for supported request methods
5037
+ utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
5038
+ /*eslint func-names:0*/
5039
+ Axios$1.prototype[method] = function(url, config) {
5040
+ return this.request(mergeConfig$1(config || {}, {
5041
+ method,
5042
+ url,
5043
+ data: (config || {}).data
5044
+ }));
5045
+ };
5046
+ });
5047
+
5048
+ utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
5049
+ /*eslint func-names:0*/
5050
+
5051
+ function generateHTTPMethod(isForm) {
5052
+ return function httpMethod(url, data, config) {
5053
+ return this.request(mergeConfig$1(config || {}, {
5054
+ method,
5055
+ headers: isForm ? {
5056
+ 'Content-Type': 'multipart/form-data'
5057
+ } : {},
5058
+ url,
5059
+ data
5060
+ }));
5061
+ };
5062
+ }
5063
+
5064
+ Axios$1.prototype[method] = generateHTTPMethod();
5065
+
5066
+ Axios$1.prototype[method + 'Form'] = generateHTTPMethod(true);
5067
+ });
5068
+
5069
+ /**
5070
+ * A `CancelToken` is an object that can be used to request cancellation of an operation.
5071
+ *
5072
+ * @param {Function} executor The executor function.
5073
+ *
5074
+ * @returns {CancelToken}
5075
+ */
5076
+ let CancelToken$1 = class CancelToken {
5077
+ constructor(executor) {
5078
+ if (typeof executor !== 'function') {
5079
+ throw new TypeError('executor must be a function.');
5080
+ }
5081
+
5082
+ let resolvePromise;
5083
+
5084
+ this.promise = new Promise(function promiseExecutor(resolve) {
5085
+ resolvePromise = resolve;
5086
+ });
5087
+
5088
+ const token = this;
5089
+
5090
+ // eslint-disable-next-line func-names
5091
+ this.promise.then(cancel => {
5092
+ if (!token._listeners) return;
5093
+
5094
+ let i = token._listeners.length;
5095
+
5096
+ while (i-- > 0) {
5097
+ token._listeners[i](cancel);
5098
+ }
5099
+ token._listeners = null;
5100
+ });
5101
+
5102
+ // eslint-disable-next-line func-names
5103
+ this.promise.then = onfulfilled => {
5104
+ let _resolve;
5105
+ // eslint-disable-next-line func-names
5106
+ const promise = new Promise(resolve => {
5107
+ token.subscribe(resolve);
5108
+ _resolve = resolve;
5109
+ }).then(onfulfilled);
5110
+
5111
+ promise.cancel = function reject() {
5112
+ token.unsubscribe(_resolve);
5113
+ };
5114
+
5115
+ return promise;
5116
+ };
5117
+
5118
+ executor(function cancel(message, config, request) {
5119
+ if (token.reason) {
5120
+ // Cancellation has already been requested
5121
+ return;
5122
+ }
5123
+
5124
+ token.reason = new CanceledError$1(message, config, request);
5125
+ resolvePromise(token.reason);
5126
+ });
5127
+ }
5128
+
5129
+ /**
5130
+ * Throws a `CanceledError` if cancellation has been requested.
5131
+ */
5132
+ throwIfRequested() {
5133
+ if (this.reason) {
5134
+ throw this.reason;
5135
+ }
5136
+ }
5137
+
5138
+ /**
5139
+ * Subscribe to the cancel signal
5140
+ */
5141
+
5142
+ subscribe(listener) {
5143
+ if (this.reason) {
5144
+ listener(this.reason);
5145
+ return;
5146
+ }
5147
+
5148
+ if (this._listeners) {
5149
+ this._listeners.push(listener);
5150
+ } else {
5151
+ this._listeners = [listener];
5152
+ }
5153
+ }
5154
+
5155
+ /**
5156
+ * Unsubscribe from the cancel signal
5157
+ */
5158
+
5159
+ unsubscribe(listener) {
5160
+ if (!this._listeners) {
5161
+ return;
5162
+ }
5163
+ const index = this._listeners.indexOf(listener);
5164
+ if (index !== -1) {
5165
+ this._listeners.splice(index, 1);
5166
+ }
5167
+ }
5168
+
5169
+ toAbortSignal() {
5170
+ const controller = new AbortController();
5171
+
5172
+ const abort = (err) => {
5173
+ controller.abort(err);
5174
+ };
5175
+
5176
+ this.subscribe(abort);
5177
+
5178
+ controller.signal.unsubscribe = () => this.unsubscribe(abort);
5179
+
5180
+ return controller.signal;
5181
+ }
5182
+
5183
+ /**
5184
+ * Returns an object that contains a new `CancelToken` and a function that, when called,
5185
+ * cancels the `CancelToken`.
5186
+ */
5187
+ static source() {
5188
+ let cancel;
5189
+ const token = new CancelToken(function executor(c) {
5190
+ cancel = c;
5191
+ });
5192
+ return {
5193
+ token,
5194
+ cancel
5195
+ };
5196
+ }
5197
+ };
5198
+
5199
+ /**
5200
+ * Syntactic sugar for invoking a function and expanding an array for arguments.
5201
+ *
5202
+ * Common use case would be to use `Function.prototype.apply`.
5203
+ *
5204
+ * ```js
5205
+ * function f(x, y, z) {}
5206
+ * var args = [1, 2, 3];
5207
+ * f.apply(null, args);
5208
+ * ```
5209
+ *
5210
+ * With `spread` this example can be re-written.
5211
+ *
5212
+ * ```js
5213
+ * spread(function(x, y, z) {})([1, 2, 3]);
5214
+ * ```
5215
+ *
5216
+ * @param {Function} callback
5217
+ *
5218
+ * @returns {Function}
5219
+ */
5220
+ function spread$1(callback) {
5221
+ return function wrap(arr) {
5222
+ return callback.apply(null, arr);
5223
+ };
5224
+ }
5225
+
5226
+ /**
5227
+ * Determines whether the payload is an error thrown by Axios
5228
+ *
5229
+ * @param {*} payload The value to test
5230
+ *
5231
+ * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
5232
+ */
5233
+ function isAxiosError$1(payload) {
5234
+ return utils$1.isObject(payload) && (payload.isAxiosError === true);
5235
+ }
5236
+
5237
+ const HttpStatusCode$1 = {
5238
+ Continue: 100,
5239
+ SwitchingProtocols: 101,
5240
+ Processing: 102,
5241
+ EarlyHints: 103,
5242
+ Ok: 200,
5243
+ Created: 201,
5244
+ Accepted: 202,
5245
+ NonAuthoritativeInformation: 203,
5246
+ NoContent: 204,
5247
+ ResetContent: 205,
5248
+ PartialContent: 206,
5249
+ MultiStatus: 207,
5250
+ AlreadyReported: 208,
5251
+ ImUsed: 226,
5252
+ MultipleChoices: 300,
5253
+ MovedPermanently: 301,
5254
+ Found: 302,
5255
+ SeeOther: 303,
5256
+ NotModified: 304,
5257
+ UseProxy: 305,
5258
+ Unused: 306,
5259
+ TemporaryRedirect: 307,
5260
+ PermanentRedirect: 308,
5261
+ BadRequest: 400,
5262
+ Unauthorized: 401,
5263
+ PaymentRequired: 402,
5264
+ Forbidden: 403,
5265
+ NotFound: 404,
5266
+ MethodNotAllowed: 405,
5267
+ NotAcceptable: 406,
5268
+ ProxyAuthenticationRequired: 407,
5269
+ RequestTimeout: 408,
5270
+ Conflict: 409,
5271
+ Gone: 410,
5272
+ LengthRequired: 411,
5273
+ PreconditionFailed: 412,
5274
+ PayloadTooLarge: 413,
5275
+ UriTooLong: 414,
5276
+ UnsupportedMediaType: 415,
5277
+ RangeNotSatisfiable: 416,
5278
+ ExpectationFailed: 417,
5279
+ ImATeapot: 418,
5280
+ MisdirectedRequest: 421,
5281
+ UnprocessableEntity: 422,
5282
+ Locked: 423,
5283
+ FailedDependency: 424,
5284
+ TooEarly: 425,
5285
+ UpgradeRequired: 426,
5286
+ PreconditionRequired: 428,
5287
+ TooManyRequests: 429,
5288
+ RequestHeaderFieldsTooLarge: 431,
5289
+ UnavailableForLegalReasons: 451,
5290
+ InternalServerError: 500,
5291
+ NotImplemented: 501,
5292
+ BadGateway: 502,
5293
+ ServiceUnavailable: 503,
5294
+ GatewayTimeout: 504,
5295
+ HttpVersionNotSupported: 505,
5296
+ VariantAlsoNegotiates: 506,
5297
+ InsufficientStorage: 507,
5298
+ LoopDetected: 508,
5299
+ NotExtended: 510,
5300
+ NetworkAuthenticationRequired: 511,
5301
+ WebServerIsDown: 521,
5302
+ ConnectionTimedOut: 522,
5303
+ OriginIsUnreachable: 523,
5304
+ TimeoutOccurred: 524,
5305
+ SslHandshakeFailed: 525,
5306
+ InvalidSslCertificate: 526,
5307
+ };
5308
+
5309
+ Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
5310
+ HttpStatusCode$1[value] = key;
5311
+ });
5312
+
5313
+ /**
5314
+ * Create an instance of Axios
5315
+ *
5316
+ * @param {Object} defaultConfig The default config for the instance
5317
+ *
5318
+ * @returns {Axios} A new instance of Axios
5319
+ */
5320
+ function createInstance(defaultConfig) {
5321
+ const context = new Axios$1(defaultConfig);
5322
+ const instance = bind(Axios$1.prototype.request, context);
5323
+
5324
+ // Copy axios.prototype to instance
5325
+ utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
5326
+
5327
+ // Copy context to instance
5328
+ utils$1.extend(instance, context, null, {allOwnKeys: true});
5329
+
5330
+ // Factory for creating new instances
5331
+ instance.create = function create(instanceConfig) {
5332
+ return createInstance(mergeConfig$1(defaultConfig, instanceConfig));
5333
+ };
5334
+
5335
+ return instance;
5336
+ }
5337
+
5338
+ // Create the default instance to be exported
5339
+ const axios = createInstance(defaults);
5340
+
5341
+ // Expose Axios class to allow class inheritance
5342
+ axios.Axios = Axios$1;
5343
+
5344
+ // Expose Cancel & CancelToken
5345
+ axios.CanceledError = CanceledError$1;
5346
+ axios.CancelToken = CancelToken$1;
5347
+ axios.isCancel = isCancel$1;
5348
+ axios.VERSION = VERSION$1;
5349
+ axios.toFormData = toFormData$1;
5350
+
5351
+ // Expose AxiosError class
5352
+ axios.AxiosError = AxiosError$1;
5353
+
5354
+ // alias for CanceledError for backward compatibility
5355
+ axios.Cancel = axios.CanceledError;
5356
+
5357
+ // Expose all/spread
5358
+ axios.all = function all(promises) {
5359
+ return Promise.all(promises);
5360
+ };
5361
+
5362
+ axios.spread = spread$1;
5363
+
5364
+ // Expose isAxiosError
5365
+ axios.isAxiosError = isAxiosError$1;
5366
+
5367
+ // Expose mergeConfig
5368
+ axios.mergeConfig = mergeConfig$1;
5369
+
5370
+ axios.AxiosHeaders = AxiosHeaders$1;
5371
+
5372
+ axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
5373
+
5374
+ axios.getAdapter = adapters.getAdapter;
5375
+
5376
+ axios.HttpStatusCode = HttpStatusCode$1;
5377
+
5378
+ axios.default = axios;
5379
+
5380
+ // This module is intended to unwrap Axios default export as named.
5381
+ // Keep top-level export same with static properties
5382
+ // so that it can keep same with es module or cjs
5383
+ const {
5384
+ Axios,
5385
+ AxiosError,
5386
+ CanceledError,
5387
+ isCancel,
5388
+ CancelToken,
5389
+ VERSION,
5390
+ all,
5391
+ Cancel,
5392
+ isAxiosError,
5393
+ spread,
5394
+ toFormData,
5395
+ AxiosHeaders,
5396
+ HttpStatusCode,
5397
+ formToJSON,
5398
+ getAdapter,
5399
+ mergeConfig
5400
+ } = axios;
5401
+
5402
+ var SubscriptionContext = /*#__PURE__*/React.createContext({
5403
+ status: 'loading'
5404
+ });
5405
+ var SubscriptionProvider = function SubscriptionProvider(_ref) {
5406
+ var children = _ref.children;
5407
+ var _useState = React.useState({
5408
+ status: 'loading'
5409
+ }),
5410
+ _useState2 = _slicedToArray(_useState, 2),
5411
+ state = _useState2[0],
5412
+ setState = _useState2[1];
5413
+ React.useEffect(function () {
5414
+ var controller = new AbortController();
5415
+ try {
5416
+ sdk.Account.verifySubscription({
5417
+ config: {
5418
+ signal: controller.signal,
5419
+ // AbortController supported in axios v1+
5420
+ timeout: 8000 // prevents hanging forever
5421
+ },
5422
+ onSuccess: function onSuccess(res) {
5423
+ setState({
5424
+ status: res === null || res === void 0 ? void 0 : res.data.status
5425
+ });
5426
+ },
5427
+ onError: function onError(err) {
5428
+ // Request cancelled
5429
+ if (axios.isCancel(err)) {
5430
+ throw err;
5431
+ }
5432
+
5433
+ // No response → server down or CORS or offline
5434
+ if (!err.response) {
5435
+ if (!navigator.onLine) throw 'OFFLINE';
5436
+ throw 'SERVER_DOWN';
5437
+ }
5438
+ if (err.response.status === 401) throw 'UNAUTHORIZED';
5439
+ if (err.response.status >= 500) throw 'SERVER_DOWN';
5440
+ throw 'UNKNOWN';
5441
+ }
5442
+ });
5443
+ } catch (reason) {
5444
+ if (reason !== 'AbortError') {
5445
+ setState({
5446
+ status: 'error',
5447
+ reason: reason !== null && reason !== void 0 ? reason : 'SERVER_DOWN'
5448
+ });
5449
+ }
5450
+ }
5451
+ return function () {
5452
+ return controller.abort();
5453
+ };
5454
+ }, []);
5455
+ return /*#__PURE__*/React.createElement(SubscriptionContext.Provider, {
5456
+ value: state
5457
+ }, children);
5458
+ };
5459
+ var useSubscription = function useSubscription() {
5460
+ return React.useContext(SubscriptionContext);
5461
+ };
5462
+
5463
+ // components/UpgradeNotice.tsx
5464
+ var UpgradeNotice = function UpgradeNotice() {
5465
+ return /*#__PURE__*/React.createElement("div", {
5466
+ style: {
5467
+ padding: 24,
5468
+ textAlign: 'center'
5469
+ }
5470
+ }, /*#__PURE__*/React.createElement("h2", null, "Upgrade Required"), /*#__PURE__*/React.createElement("p", null, "This feature is available for pro users."), /*#__PURE__*/React.createElement("button", {
5471
+ onClick: function onClick() {
5472
+ return window.location.href = 'https://ui.helpdice.com/pro';
5473
+ }
5474
+ }, "Upgrade Now"));
5475
+ };
5476
+
5477
+ // components/SubscriptionError.tsx
5478
+ var SubscriptionError = function SubscriptionError(_ref) {
5479
+ var reason = _ref.reason;
5480
+ if (reason === 'OFFLINE') {
5481
+ return /*#__PURE__*/React.createElement("p", null, "No internet connection. Please check your network.");
5482
+ }
5483
+ if (reason === 'SERVER_DOWN') {
5484
+ return /*#__PURE__*/React.createElement("p", null, "Service temporarily unavailable. Try again later.");
5485
+ }
5486
+ return /*#__PURE__*/React.createElement("p", null, "Unable to verify subscription.");
5487
+ };
5488
+
5489
+ // hoc/withSubscription.tsx
5490
+
5491
+ var withSubscription = function withSubscription(Component) {
5492
+ return function (props) {
5493
+ var sub = useSubscription();
5494
+ if (sub.status === 'loading') {
5495
+ return /*#__PURE__*/React.createElement("div", null, "Checking subscription...");
5496
+ }
5497
+ if (sub.status === 'error') {
5498
+ return /*#__PURE__*/React.createElement(SubscriptionError, {
5499
+ reason: sub.reason
5500
+ });
5501
+ }
5502
+ if (sub.status !== 'active') {
5503
+ return /*#__PURE__*/React.createElement(UpgradeNotice, null);
5504
+ }
5505
+ return /*#__PURE__*/React.createElement(Component, props);
5506
+ };
5507
+ };
5508
+
5509
+ var HuiProvider = function HuiProvider(_ref) {
5510
+ var themes = _ref.themes,
5511
+ themeType = _ref.themeType,
5512
+ children = _ref.children;
5513
+ var _React$useState = React.useState(''),
5514
+ _React$useState2 = _slicedToArray(_React$useState, 2),
5515
+ lastUpdateToastId = _React$useState2[0],
5516
+ setLastUpdateToastId = _React$useState2[1];
5517
+ var _useCurrentState = useCurrentState([]),
5518
+ _useCurrentState2 = _slicedToArray(_useCurrentState, 3),
5519
+ toasts = _useCurrentState2[0],
5520
+ setToasts = _useCurrentState2[1],
5521
+ toastsRef = _useCurrentState2[2];
5522
+ var _useCurrentState3 = useCurrentState(defaultToastLayout),
5523
+ _useCurrentState4 = _slicedToArray(_useCurrentState3, 3),
5524
+ toastLayout = _useCurrentState4[0],
5525
+ setToastLayout = _useCurrentState4[1],
5526
+ toastLayoutRef = _useCurrentState4[2];
5527
+ var updateToasts = function updateToasts(fn) {
5528
+ var nextToasts = fn(toastsRef.current);
5529
+ setToasts(nextToasts);
5530
+ };
5531
+ var updateToastLayout = function updateToastLayout(fn) {
5532
+ var nextLayout = fn(toastLayoutRef.current);
5533
+ setToastLayout(nextLayout);
5534
+ };
5535
+ var updateLastToastId = function updateLastToastId(fn) {
5536
+ setLastUpdateToastId(fn());
5537
+ };
5538
+ var initialValue = React.useMemo(function () {
5539
+ return {
5540
+ toasts: toasts,
5541
+ toastLayout: toastLayout,
5542
+ updateToasts: updateToasts,
5543
+ lastUpdateToastId: lastUpdateToastId,
5544
+ updateToastLayout: updateToastLayout,
5545
+ updateLastToastId: updateLastToastId
5546
+ };
5547
+ }, [toasts, toastLayout, lastUpdateToastId]);
5548
+ return /*#__PURE__*/React.createElement(HUIContent.Provider, {
5549
+ value: initialValue
5550
+ }, /*#__PURE__*/React.createElement(ThemeProvider, {
5551
+ themes: themes,
5552
+ themeType: themeType
5553
+ }, /*#__PURE__*/React.createElement(SubscriptionProvider, null, children), /*#__PURE__*/React.createElement(ToastContainer, null)));
5554
+ };
5555
+
5556
+ var styledJsx;
5557
+ var hasRequiredStyledJsx;
5558
+
5559
+ function requireStyledJsx () {
5560
+ if (hasRequiredStyledJsx) return styledJsx;
5561
+ hasRequiredStyledJsx = 1;
5562
+ styledJsx = requireIndex();
5563
+ return styledJsx;
5564
+ }
5565
+
5566
+ var styledJsxExports = requireStyledJsx();
5567
+ var flush = /*@__PURE__*/getDefaultExportFromCjs(styledJsxExports);
5568
+
5569
+ // export type FlushToReact = <T>(opts?: { nonce?: string }) => Array<ReactElement<T>>
1466
5570
  // export type FlushToHTML = (opts?: { nonce?: string }) => string
1467
5571
 
1468
5572
  var CssBaseline = function CssBaseline(_ref) {
@@ -2161,3 +6265,4 @@ exports.useMediaQuery = useMediaQuery;
2161
6265
  exports.useRect = useRect;
2162
6266
  exports.useTheme = useTheme;
2163
6267
  exports.useToasts = useToasts;
6268
+ exports.withSubscription = withSubscription;