@neurosity/sdk 7.0.1 → 7.2.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 (170) hide show
  1. package/dist/index.js +2155 -970
  2. package/dist/index.js.map +1 -1
  3. package/dist/index.mjs +2155 -970
  4. package/dist/index.mjs.map +1 -1
  5. package/dist/neurosity.iife.js +2155 -970
  6. package/dist/neurosity.iife.js.map +1 -1
  7. package/dist/neurosity.umd.js +2155 -970
  8. package/dist/neurosity.umd.js.map +1 -1
  9. package/dist/types/Neurosity.d.ts +102 -0
  10. package/dist/types/Neurosity.d.ts.map +1 -0
  11. package/dist/types/api/bluetooth/BluetoothClient.d.ts +77 -0
  12. package/dist/types/api/bluetooth/BluetoothClient.d.ts.map +1 -0
  13. package/dist/types/api/bluetooth/BluetoothTransport.d.ts +31 -0
  14. package/dist/types/api/bluetooth/BluetoothTransport.d.ts.map +1 -0
  15. package/dist/types/api/bluetooth/constants.d.ts +5 -0
  16. package/dist/types/api/bluetooth/constants.d.ts.map +1 -0
  17. package/dist/types/api/bluetooth/index.d.ts +6 -0
  18. package/dist/types/api/bluetooth/index.d.ts.map +1 -0
  19. package/dist/types/api/bluetooth/react-native/ReactNativeTransport.d.ts +73 -0
  20. package/dist/types/api/bluetooth/react-native/ReactNativeTransport.d.ts.map +1 -0
  21. package/dist/types/api/bluetooth/react-native/index.d.ts +3 -0
  22. package/dist/types/api/bluetooth/react-native/index.d.ts.map +1 -0
  23. package/dist/types/api/bluetooth/react-native/types/BleManagerTypes.d.ts +64 -0
  24. package/dist/types/api/bluetooth/react-native/types/BleManagerTypes.d.ts.map +1 -0
  25. package/dist/types/api/bluetooth/react-native/types/ReactNativeTypes.d.ts +41 -0
  26. package/dist/types/api/bluetooth/react-native/types/ReactNativeTypes.d.ts.map +1 -0
  27. package/dist/types/api/bluetooth/react-native/types/index.d.ts +3 -0
  28. package/dist/types/api/bluetooth/react-native/types/index.d.ts.map +1 -0
  29. package/dist/types/api/bluetooth/types/index.d.ts +21 -0
  30. package/dist/types/api/bluetooth/types/index.d.ts.map +1 -0
  31. package/dist/types/api/bluetooth/utils/binaryBufferToEpoch.d.ts +10 -0
  32. package/dist/types/api/bluetooth/utils/binaryBufferToEpoch.d.ts.map +1 -0
  33. package/dist/types/api/bluetooth/utils/create6DigitPin.d.ts +2 -0
  34. package/dist/types/api/bluetooth/utils/create6DigitPin.d.ts.map +1 -0
  35. package/dist/types/api/bluetooth/utils/csvBufferToEpoch.d.ts +6 -0
  36. package/dist/types/api/bluetooth/utils/csvBufferToEpoch.d.ts.map +1 -0
  37. package/dist/types/api/bluetooth/utils/decodeJSONChunks.d.ts +10 -0
  38. package/dist/types/api/bluetooth/utils/decodeJSONChunks.d.ts.map +1 -0
  39. package/dist/types/api/bluetooth/utils/osHasBluetoothSupport.d.ts +3 -0
  40. package/dist/types/api/bluetooth/utils/osHasBluetoothSupport.d.ts.map +1 -0
  41. package/dist/types/api/bluetooth/utils/stitch.d.ts +6 -0
  42. package/dist/types/api/bluetooth/utils/stitch.d.ts.map +1 -0
  43. package/dist/types/api/bluetooth/utils/textCodec.d.ts +11 -0
  44. package/dist/types/api/bluetooth/utils/textCodec.d.ts.map +1 -0
  45. package/dist/types/api/bluetooth/web/WebBluetoothTransport.d.ts +48 -0
  46. package/dist/types/api/bluetooth/web/WebBluetoothTransport.d.ts.map +1 -0
  47. package/dist/types/api/bluetooth/web/isMaybeWebWorkerContext.d.ts +2 -0
  48. package/dist/types/api/bluetooth/web/isMaybeWebWorkerContext.d.ts.map +1 -0
  49. package/dist/types/api/bluetooth/web/isWebBluetoothSupported.d.ts +2 -0
  50. package/dist/types/api/bluetooth/web/isWebBluetoothSupported.d.ts.map +1 -0
  51. package/dist/types/api/firebase/FirebaseApp.d.ts +13 -0
  52. package/dist/types/api/firebase/FirebaseApp.d.ts.map +1 -0
  53. package/dist/types/api/firebase/FirebaseDevice.d.ts +35 -0
  54. package/dist/types/api/firebase/FirebaseDevice.d.ts.map +1 -0
  55. package/dist/types/api/firebase/FirebaseUser.d.ts +50 -0
  56. package/dist/types/api/firebase/FirebaseUser.d.ts.map +1 -0
  57. package/dist/types/api/firebase/config.d.ts +9 -0
  58. package/dist/types/api/firebase/config.d.ts.map +1 -0
  59. package/dist/types/api/firebase/deviceStore.d.ts +24 -0
  60. package/dist/types/api/firebase/deviceStore.d.ts.map +1 -0
  61. package/dist/types/api/firebase/index.d.ts +4 -0
  62. package/dist/types/api/firebase/index.d.ts.map +1 -0
  63. package/dist/types/api/https/config.d.ts +2 -0
  64. package/dist/types/api/https/config.d.ts.map +1 -0
  65. package/dist/types/api/https/createOAuthURL.d.ts +4 -0
  66. package/dist/types/api/https/createOAuthURL.d.ts.map +1 -0
  67. package/dist/types/api/https/getOAuthToken.d.ts +4 -0
  68. package/dist/types/api/https/getOAuthToken.d.ts.map +1 -0
  69. package/dist/types/api/https/utils.d.ts +3 -0
  70. package/dist/types/api/https/utils.d.ts.map +1 -0
  71. package/dist/types/api/index.d.ts +74 -0
  72. package/dist/types/api/index.d.ts.map +1 -0
  73. package/dist/types/index.d.ts +4 -0
  74. package/dist/types/index.d.ts.map +1 -0
  75. package/dist/types/subscriptions/SubscriptionManager.d.ts +9 -0
  76. package/dist/types/subscriptions/SubscriptionManager.d.ts.map +1 -0
  77. package/dist/types/timesync/Timesync.d.ts +21 -0
  78. package/dist/types/timesync/Timesync.d.ts.map +1 -0
  79. package/dist/types/timesync/index.d.ts +2 -0
  80. package/dist/types/timesync/index.d.ts.map +1 -0
  81. package/dist/types/types/accelerometer.d.ts +12 -0
  82. package/dist/types/types/accelerometer.d.ts.map +1 -0
  83. package/dist/types/types/actions.d.ts +11 -0
  84. package/dist/types/types/actions.d.ts.map +1 -0
  85. package/dist/types/types/apiKey.d.ts +31 -0
  86. package/dist/types/types/apiKey.d.ts.map +1 -0
  87. package/dist/types/types/awareness.d.ts +2 -0
  88. package/dist/types/types/awareness.d.ts.map +1 -0
  89. package/dist/types/types/brainwaves.d.ts +40 -0
  90. package/dist/types/types/brainwaves.d.ts.map +1 -0
  91. package/dist/types/types/calm.d.ts +7 -0
  92. package/dist/types/types/calm.d.ts.map +1 -0
  93. package/dist/types/types/client.d.ts +20 -0
  94. package/dist/types/types/client.d.ts.map +1 -0
  95. package/dist/types/types/credentials.d.ts +16 -0
  96. package/dist/types/types/credentials.d.ts.map +1 -0
  97. package/dist/types/types/deviceInfo.d.ts +20 -0
  98. package/dist/types/types/deviceInfo.d.ts.map +1 -0
  99. package/dist/types/types/epoch.d.ts +10 -0
  100. package/dist/types/types/epoch.d.ts.map +1 -0
  101. package/dist/types/types/experiment.d.ts +10 -0
  102. package/dist/types/types/experiment.d.ts.map +1 -0
  103. package/dist/types/types/focus.d.ts +7 -0
  104. package/dist/types/types/focus.d.ts.map +1 -0
  105. package/dist/types/types/hapticEffects.d.ts +126 -0
  106. package/dist/types/types/hapticEffects.d.ts.map +1 -0
  107. package/dist/types/types/index.d.ts +27 -0
  108. package/dist/types/types/index.d.ts.map +1 -0
  109. package/dist/types/types/kinesis.d.ts +7 -0
  110. package/dist/types/types/kinesis.d.ts.map +1 -0
  111. package/dist/types/types/marker.d.ts +5 -0
  112. package/dist/types/types/marker.d.ts.map +1 -0
  113. package/dist/types/types/metrics.d.ts +13 -0
  114. package/dist/types/types/metrics.d.ts.map +1 -0
  115. package/dist/types/types/oauth.d.ts +21 -0
  116. package/dist/types/types/oauth.d.ts.map +1 -0
  117. package/dist/types/types/options.d.ts +25 -0
  118. package/dist/types/types/options.d.ts.map +1 -0
  119. package/dist/types/types/recording.d.ts +26 -0
  120. package/dist/types/types/recording.d.ts.map +1 -0
  121. package/dist/types/types/sample.d.ts +10 -0
  122. package/dist/types/types/sample.d.ts.map +1 -0
  123. package/dist/types/types/settings.d.ts +8 -0
  124. package/dist/types/types/settings.d.ts.map +1 -0
  125. package/dist/types/types/signalQuality.d.ts +9 -0
  126. package/dist/types/types/signalQuality.d.ts.map +1 -0
  127. package/dist/types/types/signalQualityV2.d.ts +14 -0
  128. package/dist/types/types/signalQualityV2.d.ts.map +1 -0
  129. package/dist/types/types/skill.d.ts +45 -0
  130. package/dist/types/types/skill.d.ts.map +1 -0
  131. package/dist/types/types/status.d.ts +21 -0
  132. package/dist/types/types/status.d.ts.map +1 -0
  133. package/dist/types/types/streaming.d.ts +10 -0
  134. package/dist/types/types/streaming.d.ts.map +1 -0
  135. package/dist/types/types/subscriptions.d.ts +15 -0
  136. package/dist/types/types/subscriptions.d.ts.map +1 -0
  137. package/dist/types/types/training.d.ts +14 -0
  138. package/dist/types/types/training.d.ts.map +1 -0
  139. package/dist/types/types/user.d.ts +10 -0
  140. package/dist/types/types/user.d.ts.map +1 -0
  141. package/dist/types/utils/errors.d.ts +6 -0
  142. package/dist/types/utils/errors.d.ts.map +1 -0
  143. package/dist/types/utils/filterInternalKeys.d.ts +4 -0
  144. package/dist/types/utils/filterInternalKeys.d.ts.map +1 -0
  145. package/dist/types/utils/hapticEffects.d.ts +124 -0
  146. package/dist/types/utils/hapticEffects.d.ts.map +1 -0
  147. package/dist/types/utils/heartbeat.d.ts +5 -0
  148. package/dist/types/utils/heartbeat.d.ts.map +1 -0
  149. package/dist/types/utils/index.d.ts +14 -0
  150. package/dist/types/utils/index.d.ts.map +1 -0
  151. package/dist/types/utils/is-node.d.ts +2 -0
  152. package/dist/types/utils/is-node.d.ts.map +1 -0
  153. package/dist/types/utils/metrics.d.ts +4 -0
  154. package/dist/types/utils/metrics.d.ts.map +1 -0
  155. package/dist/types/utils/permissions.d.ts +16 -0
  156. package/dist/types/utils/permissions.d.ts.map +1 -0
  157. package/dist/types/utils/pick.d.ts +2 -0
  158. package/dist/types/utils/pick.d.ts.map +1 -0
  159. package/dist/types/utils/pipes.d.ts +18 -0
  160. package/dist/types/utils/pipes.d.ts.map +1 -0
  161. package/dist/types/utils/platform.d.ts +31 -0
  162. package/dist/types/utils/platform.d.ts.map +1 -0
  163. package/dist/types/utils/subscription.d.ts +7 -0
  164. package/dist/types/utils/subscription.d.ts.map +1 -0
  165. package/dist/types/utils/transferDevice.d.ts +10 -0
  166. package/dist/types/utils/transferDevice.d.ts.map +1 -0
  167. package/dist/types/utils/whileOnline.d.ts +9 -0
  168. package/dist/types/utils/whileOnline.d.ts.map +1 -0
  169. package/package.json +13 -9
  170. package/dist/index.d.ts +0 -1067
package/dist/index.mjs CHANGED
@@ -136,7 +136,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
136
136
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
137
137
  };
138
138
 
139
- function isFunction$2(value) {
139
+ function isFunction$3(value) {
140
140
  return typeof value === 'function';
141
141
  }
142
142
 
@@ -204,7 +204,7 @@ var Subscription$1 = (function () {
204
204
  }
205
205
  }
206
206
  var initialFinalizer = this.initialTeardown;
207
- if (isFunction$2(initialFinalizer)) {
207
+ if (isFunction$3(initialFinalizer)) {
208
208
  try {
209
209
  initialFinalizer();
210
210
  }
@@ -296,10 +296,10 @@ var Subscription$1 = (function () {
296
296
  var EMPTY_SUBSCRIPTION = Subscription$1.EMPTY;
297
297
  function isSubscription(value) {
298
298
  return (value instanceof Subscription$1 ||
299
- (value && 'closed' in value && isFunction$2(value.remove) && isFunction$2(value.add) && isFunction$2(value.unsubscribe)));
299
+ (value && 'closed' in value && isFunction$3(value.remove) && isFunction$3(value.add) && isFunction$3(value.unsubscribe)));
300
300
  }
301
301
  function execFinalizer(finalizer) {
302
- if (isFunction$2(finalizer)) {
302
+ if (isFunction$3(finalizer)) {
303
303
  finalizer();
304
304
  }
305
305
  else {
@@ -454,7 +454,7 @@ var SafeSubscriber = (function (_super) {
454
454
  function SafeSubscriber(observerOrNext, error, complete) {
455
455
  var _this = _super.call(this) || this;
456
456
  var partialObserver;
457
- if (isFunction$2(observerOrNext) || !observerOrNext) {
457
+ if (isFunction$3(observerOrNext) || !observerOrNext) {
458
458
  partialObserver = {
459
459
  next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
460
460
  error: error !== null && error !== void 0 ? error : undefined,
@@ -599,14 +599,14 @@ function getPromiseCtor(promiseCtor) {
599
599
  return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config$1.Promise) !== null && _a !== void 0 ? _a : Promise;
600
600
  }
601
601
  function isObserver(value) {
602
- return value && isFunction$2(value.next) && isFunction$2(value.error) && isFunction$2(value.complete);
602
+ return value && isFunction$3(value.next) && isFunction$3(value.error) && isFunction$3(value.complete);
603
603
  }
604
604
  function isSubscriber(value) {
605
605
  return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));
606
606
  }
607
607
 
608
608
  function hasLift(source) {
609
- return isFunction$2(source === null || source === void 0 ? void 0 : source.lift);
609
+ return isFunction$3(source === null || source === void 0 ? void 0 : source.lift);
610
610
  }
611
611
  function operate(init) {
612
612
  return function (source) {
@@ -1101,14 +1101,14 @@ var async = asyncScheduler;
1101
1101
  var EMPTY = new Observable(function (subscriber) { return subscriber.complete(); });
1102
1102
 
1103
1103
  function isScheduler(value) {
1104
- return value && isFunction$2(value.schedule);
1104
+ return value && isFunction$3(value.schedule);
1105
1105
  }
1106
1106
 
1107
1107
  function last(arr) {
1108
1108
  return arr[arr.length - 1];
1109
1109
  }
1110
1110
  function popResultSelector(args) {
1111
- return isFunction$2(last(args)) ? args.pop() : undefined;
1111
+ return isFunction$3(last(args)) ? args.pop() : undefined;
1112
1112
  }
1113
1113
  function popScheduler(args) {
1114
1114
  return isScheduler(last(args)) ? args.pop() : undefined;
@@ -1120,15 +1120,15 @@ function popNumber(args, defaultValue) {
1120
1120
  var isArrayLike = (function (x) { return x && typeof x.length === 'number' && typeof x !== 'function'; });
1121
1121
 
1122
1122
  function isPromise(value) {
1123
- return isFunction$2(value === null || value === void 0 ? void 0 : value.then);
1123
+ return isFunction$3(value === null || value === void 0 ? void 0 : value.then);
1124
1124
  }
1125
1125
 
1126
1126
  function isInteropObservable(input) {
1127
- return isFunction$2(input[observable]);
1127
+ return isFunction$3(input[observable]);
1128
1128
  }
1129
1129
 
1130
1130
  function isAsyncIterable(obj) {
1131
- return Symbol.asyncIterator && isFunction$2(obj === null || obj === void 0 ? void 0 : obj[Symbol.asyncIterator]);
1131
+ return Symbol.asyncIterator && isFunction$3(obj === null || obj === void 0 ? void 0 : obj[Symbol.asyncIterator]);
1132
1132
  }
1133
1133
 
1134
1134
  function createInvalidObservableTypeError(input) {
@@ -1141,10 +1141,10 @@ function getSymbolIterator() {
1141
1141
  }
1142
1142
  return Symbol.iterator;
1143
1143
  }
1144
- var iterator = getSymbolIterator();
1144
+ var iterator$1 = getSymbolIterator();
1145
1145
 
1146
- function isIterable(input) {
1147
- return isFunction$2(input === null || input === void 0 ? void 0 : input[iterator]);
1146
+ function isIterable$1(input) {
1147
+ return isFunction$3(input === null || input === void 0 ? void 0 : input[iterator$1]);
1148
1148
  }
1149
1149
 
1150
1150
  function readableStreamLikeToAsyncGenerator(readableStream) {
@@ -1180,7 +1180,7 @@ function readableStreamLikeToAsyncGenerator(readableStream) {
1180
1180
  });
1181
1181
  }
1182
1182
  function isReadableStreamLike(obj) {
1183
- return isFunction$2(obj === null || obj === void 0 ? void 0 : obj.getReader);
1183
+ return isFunction$3(obj === null || obj === void 0 ? void 0 : obj.getReader);
1184
1184
  }
1185
1185
 
1186
1186
  function innerFrom(input) {
@@ -1200,7 +1200,7 @@ function innerFrom(input) {
1200
1200
  if (isAsyncIterable(input)) {
1201
1201
  return fromAsyncIterable(input);
1202
1202
  }
1203
- if (isIterable(input)) {
1203
+ if (isIterable$1(input)) {
1204
1204
  return fromIterable(input);
1205
1205
  }
1206
1206
  if (isReadableStreamLike(input)) {
@@ -1212,7 +1212,7 @@ function innerFrom(input) {
1212
1212
  function fromInteropObservable(obj) {
1213
1213
  return new Observable(function (subscriber) {
1214
1214
  var obs = obj[observable]();
1215
- if (isFunction$2(obs.subscribe)) {
1215
+ if (isFunction$3(obs.subscribe)) {
1216
1216
  return obs.subscribe(subscriber);
1217
1217
  }
1218
1218
  throw new TypeError('Provided object does not correctly implement Symbol.observable');
@@ -1373,15 +1373,15 @@ function scheduleArray(input, scheduler) {
1373
1373
 
1374
1374
  function scheduleIterable(input, scheduler) {
1375
1375
  return new Observable(function (subscriber) {
1376
- var iterator$1;
1376
+ var iterator;
1377
1377
  executeSchedule(subscriber, scheduler, function () {
1378
- iterator$1 = input[iterator]();
1378
+ iterator = input[iterator$1]();
1379
1379
  executeSchedule(subscriber, scheduler, function () {
1380
1380
  var _a;
1381
1381
  var value;
1382
1382
  var done;
1383
1383
  try {
1384
- (_a = iterator$1.next(), value = _a.value, done = _a.done);
1384
+ (_a = iterator.next(), value = _a.value, done = _a.done);
1385
1385
  }
1386
1386
  catch (err) {
1387
1387
  subscriber.error(err);
@@ -1395,7 +1395,7 @@ function scheduleIterable(input, scheduler) {
1395
1395
  }
1396
1396
  }, 0, true);
1397
1397
  });
1398
- return function () { return isFunction$2(iterator$1 === null || iterator$1 === void 0 ? void 0 : iterator$1.return) && iterator$1.return(); };
1398
+ return function () { return isFunction$3(iterator === null || iterator === void 0 ? void 0 : iterator.return) && iterator.return(); };
1399
1399
  });
1400
1400
  }
1401
1401
 
@@ -1438,7 +1438,7 @@ function scheduled(input, scheduler) {
1438
1438
  if (isAsyncIterable(input)) {
1439
1439
  return scheduleAsyncIterable(input, scheduler);
1440
1440
  }
1441
- if (isIterable(input)) {
1441
+ if (isIterable$1(input)) {
1442
1442
  return scheduleIterable(input, scheduler);
1443
1443
  }
1444
1444
  if (isReadableStreamLike(input)) {
@@ -1462,7 +1462,7 @@ function of() {
1462
1462
  }
1463
1463
 
1464
1464
  function throwError(errorOrErrorFactory, scheduler) {
1465
- var errorFactory = isFunction$2(errorOrErrorFactory) ? errorOrErrorFactory : function () { return errorOrErrorFactory; };
1465
+ var errorFactory = isFunction$3(errorOrErrorFactory) ? errorOrErrorFactory : function () { return errorOrErrorFactory; };
1466
1466
  var init = function (subscriber) { return subscriber.error(errorFactory()); };
1467
1467
  return new Observable(init);
1468
1468
  }
@@ -1653,7 +1653,7 @@ function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, e
1653
1653
 
1654
1654
  function mergeMap(project, resultSelector, concurrent) {
1655
1655
  if (concurrent === void 0) { concurrent = Infinity; }
1656
- if (isFunction$2(resultSelector)) {
1656
+ if (isFunction$3(resultSelector)) {
1657
1657
  return mergeMap(function (a, i) { return map$1(function (b, ii) { return resultSelector(a, b, i, ii); })(innerFrom(project(a, i))); }, concurrent);
1658
1658
  }
1659
1659
  else if (typeof resultSelector === 'number') {
@@ -1695,7 +1695,7 @@ function fromEventPattern(addHandler, removeHandler, resultSelector) {
1695
1695
  return subscriber.next(e.length === 1 ? e[0] : e);
1696
1696
  };
1697
1697
  var retValue = addHandler(handler);
1698
- return isFunction$2(removeHandler) ? function () { return removeHandler(handler, retValue); } : undefined;
1698
+ return isFunction$3(removeHandler) ? function () { return removeHandler(handler, retValue); } : undefined;
1699
1699
  });
1700
1700
  }
1701
1701
 
@@ -1861,7 +1861,7 @@ function scanInternals(accumulator, seed, hasSeed, emitOnNext, emitBeforeComplet
1861
1861
  }
1862
1862
 
1863
1863
  function concatMap(project, resultSelector) {
1864
- return isFunction$2(resultSelector) ? mergeMap(project, resultSelector, 1) : mergeMap(project, 1);
1864
+ return isFunction$3(resultSelector) ? mergeMap(project, resultSelector, 1) : mergeMap(project, 1);
1865
1865
  }
1866
1866
 
1867
1867
  function concat() {
@@ -2083,7 +2083,7 @@ function takeUntil(notifier) {
2083
2083
  }
2084
2084
 
2085
2085
  function tap(observerOrNext, error, complete) {
2086
- var tapObserver = isFunction$2(observerOrNext) || error || complete
2086
+ var tapObserver = isFunction$3(observerOrNext) || error || complete
2087
2087
  ?
2088
2088
  { next: observerOrNext, error: error, complete: complete }
2089
2089
  : observerOrNext;
@@ -2628,7 +2628,7 @@ function isValidKey$1(key) {
2628
2628
  * @returns the `globalThis` object for the given environment.
2629
2629
  * @public
2630
2630
  */
2631
- function getGlobal() {
2631
+ function getGlobal$1() {
2632
2632
  if (typeof self !== 'undefined') {
2633
2633
  return self;
2634
2634
  }
@@ -2657,7 +2657,7 @@ function getGlobal() {
2657
2657
  * See the License for the specific language governing permissions and
2658
2658
  * limitations under the License.
2659
2659
  */
2660
- const getDefaultsFromGlobal = () => getGlobal().__FIREBASE_DEFAULTS__;
2660
+ const getDefaultsFromGlobal = () => getGlobal$1().__FIREBASE_DEFAULTS__;
2661
2661
  /**
2662
2662
  * Attempt to read defaults from a JSON string provided to
2663
2663
  * process(.)env(.)__FIREBASE_DEFAULTS__ or a JSON file whose path is in
@@ -3127,7 +3127,7 @@ function isBrowserExtension() {
3127
3127
  *
3128
3128
  * @return true if ReactNative environment is detected.
3129
3129
  */
3130
- function isReactNative() {
3130
+ function isReactNative$1() {
3131
3131
  return (typeof navigator === 'object' && navigator['product'] === 'ReactNative');
3132
3132
  }
3133
3133
  /** Detects Internet Explorer. */
@@ -9826,7 +9826,7 @@ class PersistentConnection extends ServerActions {
9826
9826
  if (isMobileCordova()) {
9827
9827
  stats['framework.cordova'] = 1;
9828
9828
  }
9829
- else if (isReactNative()) {
9829
+ else if (isReactNative$1()) {
9830
9830
  stats['framework.reactnative'] = 1;
9831
9831
  }
9832
9832
  this.reportStats(stats);
@@ -19387,7 +19387,7 @@ class Delay {
19387
19387
  this.longDelay = longDelay;
19388
19388
  // Internal error when improperly initialized.
19389
19389
  debugAssert(longDelay > shortDelay, 'Short delay should be less than long delay!');
19390
- this.isMobile = isMobileCordova() || isReactNative();
19390
+ this.isMobile = isMobileCordova() || isReactNative$1();
19391
19391
  }
19392
19392
  get() {
19393
19393
  if (!_isOnline()) {
@@ -30520,8 +30520,9 @@ QuerySnapshot._jsonSchemaVersion = "firestore/querySnapshot/1.0", QuerySnapshot.
30520
30520
  registerVersion(F, M, "esm2020");
30521
30521
  }();
30522
30522
 
30523
+ const productionApiKey = ["AIza", "SyB0TkZ83Fj0CIzn8AAmE-Osc92s3ER8hy8"].join("");
30523
30524
  const config = {
30524
- apiKey: "AIzaSyB0TkZ83Fj0CIzn8AAmE-Osc92s3ER8hy8",
30525
+ apiKey: productionApiKey,
30525
30526
  authDomain: "neurosity-device.firebaseapp.com",
30526
30527
  databaseURL: "https://neurosity-device.firebaseio.com",
30527
30528
  projectId: "neurosity-device",
@@ -31541,16 +31542,14 @@ class CloudClient {
31541
31542
  this.firebaseUser.onUserClaimsChange().subscribe((userClaims) => {
31542
31543
  this.userClaims = userClaims;
31543
31544
  });
31544
- this.onDeviceChange().subscribe(async (device) => {
31545
+ this.onDeviceChange().subscribe((device) => {
31545
31546
  if (this.firebaseDevice) {
31546
- try {
31547
- await this.firebaseDevice.disconnect();
31548
- }
31549
- catch (error) {
31547
+ this.firebaseDevice.disconnect().catch((error) => {
31550
31548
  console.error("Error disconnecting from device", error);
31551
- }
31549
+ });
31552
31550
  }
31553
31551
  if (!device) {
31552
+ this.firebaseDevice = undefined;
31554
31553
  return;
31555
31554
  }
31556
31555
  this.firebaseDevice = new FirebaseDevice({
@@ -31837,6 +31836,7 @@ const BLUETOOTH_CHARACTERISTICS = {
31837
31836
  calm: "7d47617d-a60a-41d1-8df6-cfb78d02ffeb",
31838
31837
  accelerometer: "84501dee-8665-4073-b111-bdecd69fb489",
31839
31838
  signalQuality: "cf28ed0c-20cd-48ed-93c5-ee2fb265099a",
31839
+ signalQualityV2: "902ac5f3-ce59-4c11-94fa-437e89f90630",
31840
31840
  raw: "009cf0bb-b68d-4af1-a0e5-625f2eb964a6",
31841
31841
  rawUnfiltered: "5472432e-3313-4169-add8-6fcb29accb0e",
31842
31842
  psd: "d6684fb0-8518-40c0-8e88-4634e762435d",
@@ -31897,20 +31897,14 @@ const channelNames = {
31897
31897
  const metrics = {
31898
31898
  kinesis,
31899
31899
  predictions: kinesis,
31900
- channelAnalysis: channelNames,
31901
31900
  signalQuality: channelNames,
31902
- status: {
31903
- state: {},
31904
- battery: {},
31905
- charging: {},
31906
- connected: {},
31907
- connectedSince: {},
31908
- connectedLast: {},
31909
- updatingProgress: {},
31910
- simulate: {},
31911
- ssid: {}
31901
+ signalQualityV2: {
31902
+ timestamp: {},
31903
+ overall: {},
31904
+ byChannel: {}
31912
31905
  },
31913
31906
  accelerometer: {
31907
+ timestamp: {},
31914
31908
  acceleration: {},
31915
31909
  inclination: {},
31916
31910
  orientation: {},
@@ -32348,6 +32342,13 @@ function getScopeError(...requiredScopes) {
32348
32342
  return new Error(`${prefix}You are trying to access data with an OAuth token or API key without access to the following scopes: ${requiredScopes.join(", ")}.`);
32349
32343
  }
32350
32344
 
32345
+ /**
32346
+ * Create a bound version of a function with a specified `this` context
32347
+ *
32348
+ * @param {Function} fn - The function to bind
32349
+ * @param {*} thisArg - The value to be passed as the `this` parameter
32350
+ * @returns {Function} A new function that will call the original function with the specified `this` context
32351
+ */
32351
32352
  function bind(fn, thisArg) {
32352
32353
  return function wrap() {
32353
32354
  return fn.apply(thisArg, arguments);
@@ -32356,29 +32357,30 @@ function bind(fn, thisArg) {
32356
32357
 
32357
32358
  // utils is a library of generic helper functions non-specific to axios
32358
32359
 
32359
- const {toString} = Object.prototype;
32360
- const {getPrototypeOf} = Object;
32360
+ const { toString } = Object.prototype;
32361
+ const { getPrototypeOf } = Object;
32362
+ const { iterator, toStringTag } = Symbol;
32361
32363
 
32362
- const kindOf = (cache => thing => {
32363
- const str = toString.call(thing);
32364
- return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
32364
+ const kindOf = ((cache) => (thing) => {
32365
+ const str = toString.call(thing);
32366
+ return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
32365
32367
  })(Object.create(null));
32366
32368
 
32367
32369
  const kindOfTest = (type) => {
32368
32370
  type = type.toLowerCase();
32369
- return (thing) => kindOf(thing) === type
32371
+ return (thing) => kindOf(thing) === type;
32370
32372
  };
32371
32373
 
32372
- const typeOfTest = type => thing => typeof thing === type;
32374
+ const typeOfTest = (type) => (thing) => typeof thing === type;
32373
32375
 
32374
32376
  /**
32375
- * Determine if a value is an Array
32377
+ * Determine if a value is a non-null object
32376
32378
  *
32377
32379
  * @param {Object} val The value to test
32378
32380
  *
32379
32381
  * @returns {boolean} True if value is an Array, otherwise false
32380
32382
  */
32381
- const {isArray} = Array;
32383
+ const { isArray } = Array;
32382
32384
 
32383
32385
  /**
32384
32386
  * Determine if a value is undefined
@@ -32397,8 +32399,14 @@ const isUndefined = typeOfTest('undefined');
32397
32399
  * @returns {boolean} True if value is a Buffer, otherwise false
32398
32400
  */
32399
32401
  function isBuffer(val) {
32400
- return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
32401
- && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
32402
+ return (
32403
+ val !== null &&
32404
+ !isUndefined(val) &&
32405
+ val.constructor !== null &&
32406
+ !isUndefined(val.constructor) &&
32407
+ isFunction$2(val.constructor.isBuffer) &&
32408
+ val.constructor.isBuffer(val)
32409
+ );
32402
32410
  }
32403
32411
 
32404
32412
  /**
@@ -32410,7 +32418,6 @@ function isBuffer(val) {
32410
32418
  */
32411
32419
  const isArrayBuffer = kindOfTest('ArrayBuffer');
32412
32420
 
32413
-
32414
32421
  /**
32415
32422
  * Determine if a value is a view on an ArrayBuffer
32416
32423
  *
@@ -32420,10 +32427,10 @@ const isArrayBuffer = kindOfTest('ArrayBuffer');
32420
32427
  */
32421
32428
  function isArrayBufferView(val) {
32422
32429
  let result;
32423
- if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
32430
+ if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
32424
32431
  result = ArrayBuffer.isView(val);
32425
32432
  } else {
32426
- result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
32433
+ result = val && val.buffer && isArrayBuffer(val.buffer);
32427
32434
  }
32428
32435
  return result;
32429
32436
  }
@@ -32443,7 +32450,7 @@ const isString = typeOfTest('string');
32443
32450
  * @param {*} val The value to test
32444
32451
  * @returns {boolean} True if value is a Function, otherwise false
32445
32452
  */
32446
- const isFunction$1 = typeOfTest('function');
32453
+ const isFunction$2 = typeOfTest('function');
32447
32454
 
32448
32455
  /**
32449
32456
  * Determine if a value is a Number
@@ -32469,7 +32476,7 @@ const isObject$1 = (thing) => thing !== null && typeof thing === 'object';
32469
32476
  * @param {*} thing The value to test
32470
32477
  * @returns {boolean} True if value is a Boolean, otherwise false
32471
32478
  */
32472
- const isBoolean = thing => thing === true || thing === false;
32479
+ const isBoolean = (thing) => thing === true || thing === false;
32473
32480
 
32474
32481
  /**
32475
32482
  * Determine if a value is a plain Object
@@ -32484,7 +32491,34 @@ const isPlainObject = (val) => {
32484
32491
  }
32485
32492
 
32486
32493
  const prototype = getPrototypeOf(val);
32487
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
32494
+ return (
32495
+ (prototype === null ||
32496
+ prototype === Object.prototype ||
32497
+ Object.getPrototypeOf(prototype) === null) &&
32498
+ !(toStringTag in val) &&
32499
+ !(iterator in val)
32500
+ );
32501
+ };
32502
+
32503
+ /**
32504
+ * Determine if a value is an empty object (safely handles Buffers)
32505
+ *
32506
+ * @param {*} val The value to test
32507
+ *
32508
+ * @returns {boolean} True if value is an empty object, otherwise false
32509
+ */
32510
+ const isEmptyObject = (val) => {
32511
+ // Early return for non-objects or Buffers to prevent RangeError
32512
+ if (!isObject$1(val) || isBuffer(val)) {
32513
+ return false;
32514
+ }
32515
+
32516
+ try {
32517
+ return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
32518
+ } catch (e) {
32519
+ // Fallback for any other objects that might cause RangeError with Object.keys()
32520
+ return false;
32521
+ }
32488
32522
  };
32489
32523
 
32490
32524
  /**
@@ -32505,6 +32539,31 @@ const isDate = kindOfTest('Date');
32505
32539
  */
32506
32540
  const isFile = kindOfTest('File');
32507
32541
 
32542
+ /**
32543
+ * Determine if a value is a React Native Blob
32544
+ * React Native "blob": an object with a `uri` attribute. Optionally, it can
32545
+ * also have a `name` and `type` attribute to specify filename and content type
32546
+ *
32547
+ * @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71
32548
+ *
32549
+ * @param {*} value The value to test
32550
+ *
32551
+ * @returns {boolean} True if value is a React Native Blob, otherwise false
32552
+ */
32553
+ const isReactNativeBlob = (value) => {
32554
+ return !!(value && typeof value.uri !== 'undefined');
32555
+ };
32556
+
32557
+ /**
32558
+ * Determine if environment is React Native
32559
+ * ReactNative `FormData` has a non-standard `getParts()` method
32560
+ *
32561
+ * @param {*} formData The formData to test
32562
+ *
32563
+ * @returns {boolean} True if environment is React Native, otherwise false
32564
+ */
32565
+ const isReactNative = (formData) => formData && typeof formData.getParts !== 'undefined';
32566
+
32508
32567
  /**
32509
32568
  * Determine if a value is a Blob
32510
32569
  *
@@ -32530,7 +32589,7 @@ const isFileList = kindOfTest('FileList');
32530
32589
  *
32531
32590
  * @returns {boolean} True if value is a Stream, otherwise false
32532
32591
  */
32533
- const isStream = (val) => isObject$1(val) && isFunction$1(val.pipe);
32592
+ const isStream = (val) => isObject$1(val) && isFunction$2(val.pipe);
32534
32593
 
32535
32594
  /**
32536
32595
  * Determine if a value is a FormData
@@ -32539,17 +32598,28 @@ const isStream = (val) => isObject$1(val) && isFunction$1(val.pipe);
32539
32598
  *
32540
32599
  * @returns {boolean} True if value is an FormData, otherwise false
32541
32600
  */
32601
+ function getGlobal() {
32602
+ if (typeof globalThis !== 'undefined') return globalThis;
32603
+ if (typeof self !== 'undefined') return self;
32604
+ if (typeof window !== 'undefined') return window;
32605
+ if (typeof global !== 'undefined') return global;
32606
+ return {};
32607
+ }
32608
+
32609
+ const G = getGlobal();
32610
+ const FormDataCtor = typeof G.FormData !== 'undefined' ? G.FormData : undefined;
32611
+
32542
32612
  const isFormData = (thing) => {
32543
32613
  let kind;
32544
32614
  return thing && (
32545
- (typeof FormData === 'function' && thing instanceof FormData) || (
32546
- isFunction$1(thing.append) && (
32615
+ (FormDataCtor && thing instanceof FormDataCtor) || (
32616
+ isFunction$2(thing.append) && (
32547
32617
  (kind = kindOf(thing)) === 'formdata' ||
32548
32618
  // detect form-data instance
32549
- (kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
32619
+ (kind === 'object' && isFunction$2(thing.toString) && thing.toString() === '[object FormData]')
32550
32620
  )
32551
32621
  )
32552
- )
32622
+ );
32553
32623
  };
32554
32624
 
32555
32625
  /**
@@ -32561,6 +32631,13 @@ const isFormData = (thing) => {
32561
32631
  */
32562
32632
  const isURLSearchParams = kindOfTest('URLSearchParams');
32563
32633
 
32634
+ const [isReadableStream, isRequest, isResponse, isHeaders] = [
32635
+ 'ReadableStream',
32636
+ 'Request',
32637
+ 'Response',
32638
+ 'Headers',
32639
+ ].map(kindOfTest);
32640
+
32564
32641
  /**
32565
32642
  * Trim excess whitespace off the beginning and end of a string
32566
32643
  *
@@ -32568,9 +32645,9 @@ const isURLSearchParams = kindOfTest('URLSearchParams');
32568
32645
  *
32569
32646
  * @returns {String} The String freed of excess whitespace
32570
32647
  */
32571
- const trim = (str) => str.trim ?
32572
- str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
32573
-
32648
+ const trim = (str) => {
32649
+ return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
32650
+ };
32574
32651
  /**
32575
32652
  * Iterate over an Array or an Object invoking a function for each item.
32576
32653
  *
@@ -32580,13 +32657,14 @@ const trim = (str) => str.trim ?
32580
32657
  * If 'obj' is an Object callback will be called passing
32581
32658
  * the value, key, and complete object for each property.
32582
32659
  *
32583
- * @param {Object|Array} obj The object to iterate
32660
+ * @param {Object|Array<unknown>} obj The object to iterate
32584
32661
  * @param {Function} fn The callback to invoke for each item
32585
32662
  *
32586
- * @param {Boolean} [allOwnKeys = false]
32663
+ * @param {Object} [options]
32664
+ * @param {Boolean} [options.allOwnKeys = false]
32587
32665
  * @returns {any}
32588
32666
  */
32589
- function forEach(obj, fn, {allOwnKeys = false} = {}) {
32667
+ function forEach(obj, fn, { allOwnKeys = false } = {}) {
32590
32668
  // Don't bother if no value provided
32591
32669
  if (obj === null || typeof obj === 'undefined') {
32592
32670
  return;
@@ -32607,6 +32685,11 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
32607
32685
  fn.call(null, obj[i], i, obj);
32608
32686
  }
32609
32687
  } else {
32688
+ // Buffer check
32689
+ if (isBuffer(obj)) {
32690
+ return;
32691
+ }
32692
+
32610
32693
  // Iterate over object keys
32611
32694
  const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
32612
32695
  const len = keys.length;
@@ -32619,7 +32702,19 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
32619
32702
  }
32620
32703
  }
32621
32704
 
32705
+ /**
32706
+ * Finds a key in an object, case-insensitive, returning the actual key name.
32707
+ * Returns null if the object is a Buffer or if no match is found.
32708
+ *
32709
+ * @param {Object} obj - The object to search.
32710
+ * @param {string} key - The key to find (case-insensitive).
32711
+ * @returns {?string} The actual key name if found, otherwise null.
32712
+ */
32622
32713
  function findKey(obj, key) {
32714
+ if (isBuffer(obj)) {
32715
+ return null;
32716
+ }
32717
+
32623
32718
  key = key.toLowerCase();
32624
32719
  const keys = Object.keys(obj);
32625
32720
  let i = keys.length;
@@ -32635,8 +32730,8 @@ function findKey(obj, key) {
32635
32730
 
32636
32731
  const _global = (() => {
32637
32732
  /*eslint no-undef:0*/
32638
- if (typeof globalThis !== "undefined") return globalThis;
32639
- return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global)
32733
+ if (typeof globalThis !== 'undefined') return globalThis;
32734
+ return typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : global;
32640
32735
  })();
32641
32736
 
32642
32737
  const isContextDefined = (context) => !isUndefined(context) && context !== _global;
@@ -32651,7 +32746,7 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
32651
32746
  * Example:
32652
32747
  *
32653
32748
  * ```js
32654
- * var result = merge({foo: 123}, {foo: 456});
32749
+ * const result = merge({foo: 123}, {foo: 456});
32655
32750
  * console.log(result.foo); // outputs 456
32656
32751
  * ```
32657
32752
  *
@@ -32660,17 +32755,22 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
32660
32755
  * @returns {Object} Result of all merge properties
32661
32756
  */
32662
32757
  function merge(/* obj1, obj2, obj3, ... */) {
32663
- const {caseless} = isContextDefined(this) && this || {};
32758
+ const { caseless, skipUndefined } = (isContextDefined(this) && this) || {};
32664
32759
  const result = {};
32665
32760
  const assignValue = (val, key) => {
32666
- const targetKey = caseless && findKey(result, key) || key;
32761
+ // Skip dangerous property names to prevent prototype pollution
32762
+ if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
32763
+ return;
32764
+ }
32765
+
32766
+ const targetKey = (caseless && findKey(result, key)) || key;
32667
32767
  if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
32668
32768
  result[targetKey] = merge(result[targetKey], val);
32669
32769
  } else if (isPlainObject(val)) {
32670
32770
  result[targetKey] = merge({}, val);
32671
32771
  } else if (isArray(val)) {
32672
32772
  result[targetKey] = val.slice();
32673
- } else {
32773
+ } else if (!skipUndefined || !isUndefined(val)) {
32674
32774
  result[targetKey] = val;
32675
32775
  }
32676
32776
  };
@@ -32688,17 +32788,32 @@ function merge(/* obj1, obj2, obj3, ... */) {
32688
32788
  * @param {Object} b The object to copy properties from
32689
32789
  * @param {Object} thisArg The object to bind function to
32690
32790
  *
32691
- * @param {Boolean} [allOwnKeys]
32791
+ * @param {Object} [options]
32792
+ * @param {Boolean} [options.allOwnKeys]
32692
32793
  * @returns {Object} The resulting value of object a
32693
32794
  */
32694
- const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
32695
- forEach(b, (val, key) => {
32696
- if (thisArg && isFunction$1(val)) {
32697
- a[key] = bind(val, thisArg);
32698
- } else {
32699
- a[key] = val;
32700
- }
32701
- }, {allOwnKeys});
32795
+ const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
32796
+ forEach(
32797
+ b,
32798
+ (val, key) => {
32799
+ if (thisArg && isFunction$2(val)) {
32800
+ Object.defineProperty(a, key, {
32801
+ value: bind(val, thisArg),
32802
+ writable: true,
32803
+ enumerable: true,
32804
+ configurable: true,
32805
+ });
32806
+ } else {
32807
+ Object.defineProperty(a, key, {
32808
+ value: val,
32809
+ writable: true,
32810
+ enumerable: true,
32811
+ configurable: true,
32812
+ });
32813
+ }
32814
+ },
32815
+ { allOwnKeys }
32816
+ );
32702
32817
  return a;
32703
32818
  };
32704
32819
 
@@ -32710,7 +32825,7 @@ const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
32710
32825
  * @returns {string} content value without BOM
32711
32826
  */
32712
32827
  const stripBOM = (content) => {
32713
- if (content.charCodeAt(0) === 0xFEFF) {
32828
+ if (content.charCodeAt(0) === 0xfeff) {
32714
32829
  content = content.slice(1);
32715
32830
  }
32716
32831
  return content;
@@ -32727,9 +32842,14 @@ const stripBOM = (content) => {
32727
32842
  */
32728
32843
  const inherits = (constructor, superConstructor, props, descriptors) => {
32729
32844
  constructor.prototype = Object.create(superConstructor.prototype, descriptors);
32730
- constructor.prototype.constructor = constructor;
32845
+ Object.defineProperty(constructor.prototype, 'constructor', {
32846
+ value: constructor,
32847
+ writable: true,
32848
+ enumerable: false,
32849
+ configurable: true,
32850
+ });
32731
32851
  Object.defineProperty(constructor, 'super', {
32732
- value: superConstructor.prototype
32852
+ value: superConstructor.prototype,
32733
32853
  });
32734
32854
  props && Object.assign(constructor.prototype, props);
32735
32855
  };
@@ -32788,7 +32908,6 @@ const endsWith = (str, searchString, position) => {
32788
32908
  return lastIndex !== -1 && lastIndex === position;
32789
32909
  };
32790
32910
 
32791
-
32792
32911
  /**
32793
32912
  * Returns new array from array like object or null if failed
32794
32913
  *
@@ -32817,9 +32936,9 @@ const toArray = (thing) => {
32817
32936
  * @returns {Array}
32818
32937
  */
32819
32938
  // eslint-disable-next-line func-names
32820
- const isTypedArray = (TypedArray => {
32939
+ const isTypedArray = ((TypedArray) => {
32821
32940
  // eslint-disable-next-line func-names
32822
- return thing => {
32941
+ return (thing) => {
32823
32942
  return TypedArray && thing instanceof TypedArray;
32824
32943
  };
32825
32944
  })(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
@@ -32833,13 +32952,13 @@ const isTypedArray = (TypedArray => {
32833
32952
  * @returns {void}
32834
32953
  */
32835
32954
  const forEachEntry = (obj, fn) => {
32836
- const generator = obj && obj[Symbol.iterator];
32955
+ const generator = obj && obj[iterator];
32837
32956
 
32838
- const iterator = generator.call(obj);
32957
+ const _iterator = generator.call(obj);
32839
32958
 
32840
32959
  let result;
32841
32960
 
32842
- while ((result = iterator.next()) && !result.done) {
32961
+ while ((result = _iterator.next()) && !result.done) {
32843
32962
  const pair = result.value;
32844
32963
  fn.call(obj, pair[0], pair[1]);
32845
32964
  }
@@ -32867,16 +32986,18 @@ const matchAll = (regExp, str) => {
32867
32986
  /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
32868
32987
  const isHTMLForm = kindOfTest('HTMLFormElement');
32869
32988
 
32870
- const toCamelCase = str => {
32871
- return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,
32872
- function replacer(m, p1, p2) {
32873
- return p1.toUpperCase() + p2;
32874
- }
32875
- );
32989
+ const toCamelCase = (str) => {
32990
+ return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
32991
+ return p1.toUpperCase() + p2;
32992
+ });
32876
32993
  };
32877
32994
 
32878
32995
  /* Creating a function that will check if an object has a property. */
32879
- const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
32996
+ const hasOwnProperty = (
32997
+ ({ hasOwnProperty }) =>
32998
+ (obj, prop) =>
32999
+ hasOwnProperty.call(obj, prop)
33000
+ )(Object.prototype);
32880
33001
 
32881
33002
  /**
32882
33003
  * Determine if a value is a RegExp object
@@ -32909,13 +33030,13 @@ const reduceDescriptors = (obj, reducer) => {
32909
33030
  const freezeMethods = (obj) => {
32910
33031
  reduceDescriptors(obj, (descriptor, name) => {
32911
33032
  // skip restricted props in strict mode
32912
- if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
33033
+ if (isFunction$2(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
32913
33034
  return false;
32914
33035
  }
32915
33036
 
32916
33037
  const value = obj[name];
32917
33038
 
32918
- if (!isFunction$1(value)) return;
33039
+ if (!isFunction$2(value)) return;
32919
33040
 
32920
33041
  descriptor.enumerable = false;
32921
33042
 
@@ -32926,17 +33047,25 @@ const freezeMethods = (obj) => {
32926
33047
 
32927
33048
  if (!descriptor.set) {
32928
33049
  descriptor.set = () => {
32929
- throw Error('Can not rewrite read-only method \'' + name + '\'');
33050
+ throw Error("Can not rewrite read-only method '" + name + "'");
32930
33051
  };
32931
33052
  }
32932
33053
  });
32933
33054
  };
32934
33055
 
33056
+ /**
33057
+ * Converts an array or a delimited string into an object set with values as keys and true as values.
33058
+ * Useful for fast membership checks.
33059
+ *
33060
+ * @param {Array|string} arrayOrString - The array or string to convert.
33061
+ * @param {string} delimiter - The delimiter to use if input is a string.
33062
+ * @returns {Object} An object with keys from the array or string, values set to true.
33063
+ */
32935
33064
  const toObjectSet = (arrayOrString, delimiter) => {
32936
33065
  const obj = {};
32937
33066
 
32938
33067
  const define = (arr) => {
32939
- arr.forEach(value => {
33068
+ arr.forEach((value) => {
32940
33069
  obj[value] = true;
32941
33070
  });
32942
33071
  };
@@ -32949,28 +33078,7 @@ const toObjectSet = (arrayOrString, delimiter) => {
32949
33078
  const noop = () => {};
32950
33079
 
32951
33080
  const toFiniteNumber = (value, defaultValue) => {
32952
- value = +value;
32953
- return Number.isFinite(value) ? value : defaultValue;
32954
- };
32955
-
32956
- const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
32957
-
32958
- const DIGIT = '0123456789';
32959
-
32960
- const ALPHABET = {
32961
- DIGIT,
32962
- ALPHA,
32963
- ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
32964
- };
32965
-
32966
- const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
32967
- let str = '';
32968
- const {length} = alphabet;
32969
- while (size--) {
32970
- str += alphabet[Math.random() * length|0];
32971
- }
32972
-
32973
- return str;
33081
+ return value != null && Number.isFinite((value = +value)) ? value : defaultValue;
32974
33082
  };
32975
33083
 
32976
33084
  /**
@@ -32981,20 +33089,35 @@ const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
32981
33089
  * @returns {boolean}
32982
33090
  */
32983
33091
  function isSpecCompliantForm(thing) {
32984
- return !!(thing && isFunction$1(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
33092
+ return !!(
33093
+ thing &&
33094
+ isFunction$2(thing.append) &&
33095
+ thing[toStringTag] === 'FormData' &&
33096
+ thing[iterator]
33097
+ );
32985
33098
  }
32986
33099
 
33100
+ /**
33101
+ * Recursively converts an object to a JSON-compatible object, handling circular references and Buffers.
33102
+ *
33103
+ * @param {Object} obj - The object to convert.
33104
+ * @returns {Object} The JSON-compatible object.
33105
+ */
32987
33106
  const toJSONObject = (obj) => {
32988
33107
  const stack = new Array(10);
32989
33108
 
32990
33109
  const visit = (source, i) => {
32991
-
32992
33110
  if (isObject$1(source)) {
32993
33111
  if (stack.indexOf(source) >= 0) {
32994
33112
  return;
32995
33113
  }
32996
33114
 
32997
- if(!('toJSON' in source)) {
33115
+ //Buffer check
33116
+ if (isBuffer(source)) {
33117
+ return source;
33118
+ }
33119
+
33120
+ if (!('toJSON' in source)) {
32998
33121
  stack[i] = source;
32999
33122
  const target = isArray(source) ? [] : {};
33000
33123
 
@@ -33015,10 +33138,76 @@ const toJSONObject = (obj) => {
33015
33138
  return visit(obj, 0);
33016
33139
  };
33017
33140
 
33141
+ /**
33142
+ * Determines if a value is an async function.
33143
+ *
33144
+ * @param {*} thing - The value to test.
33145
+ * @returns {boolean} True if value is an async function, otherwise false.
33146
+ */
33018
33147
  const isAsyncFn = kindOfTest('AsyncFunction');
33019
33148
 
33149
+ /**
33150
+ * Determines if a value is thenable (has then and catch methods).
33151
+ *
33152
+ * @param {*} thing - The value to test.
33153
+ * @returns {boolean} True if value is thenable, otherwise false.
33154
+ */
33020
33155
  const isThenable = (thing) =>
33021
- thing && (isObject$1(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
33156
+ thing &&
33157
+ (isObject$1(thing) || isFunction$2(thing)) &&
33158
+ isFunction$2(thing.then) &&
33159
+ isFunction$2(thing.catch);
33160
+
33161
+ // original code
33162
+ // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
33163
+
33164
+ /**
33165
+ * Provides a cross-platform setImmediate implementation.
33166
+ * Uses native setImmediate if available, otherwise falls back to postMessage or setTimeout.
33167
+ *
33168
+ * @param {boolean} setImmediateSupported - Whether setImmediate is supported.
33169
+ * @param {boolean} postMessageSupported - Whether postMessage is supported.
33170
+ * @returns {Function} A function to schedule a callback asynchronously.
33171
+ */
33172
+ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
33173
+ if (setImmediateSupported) {
33174
+ return setImmediate;
33175
+ }
33176
+
33177
+ return postMessageSupported
33178
+ ? ((token, callbacks) => {
33179
+ _global.addEventListener(
33180
+ 'message',
33181
+ ({ source, data }) => {
33182
+ if (source === _global && data === token) {
33183
+ callbacks.length && callbacks.shift()();
33184
+ }
33185
+ },
33186
+ false
33187
+ );
33188
+
33189
+ return (cb) => {
33190
+ callbacks.push(cb);
33191
+ _global.postMessage(token, '*');
33192
+ };
33193
+ })(`axios@${Math.random()}`, [])
33194
+ : (cb) => setTimeout(cb);
33195
+ })(typeof setImmediate === 'function', isFunction$2(_global.postMessage));
33196
+
33197
+ /**
33198
+ * Schedules a microtask or asynchronous callback as soon as possible.
33199
+ * Uses queueMicrotask if available, otherwise falls back to process.nextTick or _setImmediate.
33200
+ *
33201
+ * @type {Function}
33202
+ */
33203
+ const asap =
33204
+ typeof queueMicrotask !== 'undefined'
33205
+ ? queueMicrotask.bind(_global)
33206
+ : (typeof process !== 'undefined' && process.nextTick) || _setImmediate;
33207
+
33208
+ // *********************
33209
+
33210
+ const isIterable = (thing) => thing != null && isFunction$2(thing[iterator]);
33022
33211
 
33023
33212
  var utils$1 = {
33024
33213
  isArray,
@@ -33031,12 +33220,19 @@ var utils$1 = {
33031
33220
  isBoolean,
33032
33221
  isObject: isObject$1,
33033
33222
  isPlainObject,
33223
+ isEmptyObject,
33224
+ isReadableStream,
33225
+ isRequest,
33226
+ isResponse,
33227
+ isHeaders,
33034
33228
  isUndefined,
33035
33229
  isDate,
33036
33230
  isFile,
33231
+ isReactNativeBlob,
33232
+ isReactNative,
33037
33233
  isBlob,
33038
33234
  isRegExp,
33039
- isFunction: isFunction$1,
33235
+ isFunction: isFunction$2,
33040
33236
  isStream,
33041
33237
  isURLSearchParams,
33042
33238
  isTypedArray,
@@ -33066,44 +33262,66 @@ var utils$1 = {
33066
33262
  findKey,
33067
33263
  global: _global,
33068
33264
  isContextDefined,
33069
- ALPHABET,
33070
- generateString,
33071
33265
  isSpecCompliantForm,
33072
33266
  toJSONObject,
33073
33267
  isAsyncFn,
33074
- isThenable
33268
+ isThenable,
33269
+ setImmediate: _setImmediate,
33270
+ asap,
33271
+ isIterable,
33075
33272
  };
33076
33273
 
33077
- /**
33078
- * Create an Error with the specified message, config, error code, request and response.
33079
- *
33080
- * @param {string} message The error message.
33081
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
33082
- * @param {Object} [config] The config.
33083
- * @param {Object} [request] The request.
33084
- * @param {Object} [response] The response.
33085
- *
33086
- * @returns {Error} The created error.
33087
- */
33088
- function AxiosError$1(message, code, config, request, response) {
33089
- Error.call(this);
33274
+ let AxiosError$1 = class AxiosError extends Error {
33275
+ static from(error, code, config, request, response, customProps) {
33276
+ const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
33277
+ axiosError.cause = error;
33278
+ axiosError.name = error.name;
33090
33279
 
33091
- if (Error.captureStackTrace) {
33092
- Error.captureStackTrace(this, this.constructor);
33093
- } else {
33094
- this.stack = (new Error()).stack;
33280
+ // Preserve status from the original error if not already set from response
33281
+ if (error.status != null && axiosError.status == null) {
33282
+ axiosError.status = error.status;
33283
+ }
33284
+
33285
+ customProps && Object.assign(axiosError, customProps);
33286
+ return axiosError;
33095
33287
  }
33096
33288
 
33097
- this.message = message;
33098
- this.name = 'AxiosError';
33099
- code && (this.code = code);
33100
- config && (this.config = config);
33101
- request && (this.request = request);
33102
- response && (this.response = response);
33103
- }
33289
+ /**
33290
+ * Create an Error with the specified message, config, error code, request and response.
33291
+ *
33292
+ * @param {string} message The error message.
33293
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
33294
+ * @param {Object} [config] The config.
33295
+ * @param {Object} [request] The request.
33296
+ * @param {Object} [response] The response.
33297
+ *
33298
+ * @returns {Error} The created error.
33299
+ */
33300
+ constructor(message, code, config, request, response) {
33301
+ super(message);
33302
+
33303
+ // Make message enumerable to maintain backward compatibility
33304
+ // The native Error constructor sets message as non-enumerable,
33305
+ // but axios < v1.13.3 had it as enumerable
33306
+ Object.defineProperty(this, 'message', {
33307
+ value: message,
33308
+ enumerable: true,
33309
+ writable: true,
33310
+ configurable: true
33311
+ });
33312
+
33313
+ this.name = 'AxiosError';
33314
+ this.isAxiosError = true;
33315
+ code && (this.code = code);
33316
+ config && (this.config = config);
33317
+ request && (this.request = request);
33318
+ if (response) {
33319
+ this.response = response;
33320
+ this.status = response.status;
33321
+ }
33322
+ }
33104
33323
 
33105
- utils$1.inherits(AxiosError$1, Error, {
33106
- toJSON: function toJSON() {
33324
+ toJSON() {
33107
33325
  return {
33108
33326
  // Standard
33109
33327
  message: this.message,
@@ -33119,56 +33337,25 @@ utils$1.inherits(AxiosError$1, Error, {
33119
33337
  // Axios
33120
33338
  config: utils$1.toJSONObject(this.config),
33121
33339
  code: this.code,
33122
- status: this.response && this.response.status ? this.response.status : null
33340
+ status: this.status,
33123
33341
  };
33124
33342
  }
33125
- });
33126
-
33127
- const prototype$1 = AxiosError$1.prototype;
33128
- const descriptors = {};
33129
-
33130
- [
33131
- 'ERR_BAD_OPTION_VALUE',
33132
- 'ERR_BAD_OPTION',
33133
- 'ECONNABORTED',
33134
- 'ETIMEDOUT',
33135
- 'ERR_NETWORK',
33136
- 'ERR_FR_TOO_MANY_REDIRECTS',
33137
- 'ERR_DEPRECATED',
33138
- 'ERR_BAD_RESPONSE',
33139
- 'ERR_BAD_REQUEST',
33140
- 'ERR_CANCELED',
33141
- 'ERR_NOT_SUPPORT',
33142
- 'ERR_INVALID_URL'
33143
- // eslint-disable-next-line func-names
33144
- ].forEach(code => {
33145
- descriptors[code] = {value: code};
33146
- });
33147
-
33148
- Object.defineProperties(AxiosError$1, descriptors);
33149
- Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
33150
-
33151
- // eslint-disable-next-line func-names
33152
- AxiosError$1.from = (error, code, config, request, response, customProps) => {
33153
- const axiosError = Object.create(prototype$1);
33154
-
33155
- utils$1.toFlatObject(error, axiosError, function filter(obj) {
33156
- return obj !== Error.prototype;
33157
- }, prop => {
33158
- return prop !== 'isAxiosError';
33159
- });
33160
-
33161
- AxiosError$1.call(axiosError, error.message, code, config, request, response);
33162
-
33163
- axiosError.cause = error;
33164
-
33165
- axiosError.name = error.name;
33166
-
33167
- customProps && Object.assign(axiosError, customProps);
33168
-
33169
- return axiosError;
33170
33343
  };
33171
33344
 
33345
+ // This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
33346
+ AxiosError$1.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
33347
+ AxiosError$1.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
33348
+ AxiosError$1.ECONNABORTED = 'ECONNABORTED';
33349
+ AxiosError$1.ETIMEDOUT = 'ETIMEDOUT';
33350
+ AxiosError$1.ERR_NETWORK = 'ERR_NETWORK';
33351
+ AxiosError$1.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
33352
+ AxiosError$1.ERR_DEPRECATED = 'ERR_DEPRECATED';
33353
+ AxiosError$1.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
33354
+ AxiosError$1.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
33355
+ AxiosError$1.ERR_CANCELED = 'ERR_CANCELED';
33356
+ AxiosError$1.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
33357
+ AxiosError$1.ERR_INVALID_URL = 'ERR_INVALID_URL';
33358
+
33172
33359
  // eslint-disable-next-line strict
33173
33360
  var httpAdapter = null;
33174
33361
 
@@ -33205,11 +33392,14 @@ function removeBrackets(key) {
33205
33392
  */
33206
33393
  function renderKey(path, key, dots) {
33207
33394
  if (!path) return key;
33208
- return path.concat(key).map(function each(token, i) {
33209
- // eslint-disable-next-line no-param-reassign
33210
- token = removeBrackets(token);
33211
- return !dots && i ? '[' + token + ']' : token;
33212
- }).join(dots ? '.' : '');
33395
+ return path
33396
+ .concat(key)
33397
+ .map(function each(token, i) {
33398
+ // eslint-disable-next-line no-param-reassign
33399
+ token = removeBrackets(token);
33400
+ return !dots && i ? '[' + token + ']' : token;
33401
+ })
33402
+ .join(dots ? '.' : '');
33213
33403
  }
33214
33404
 
33215
33405
  /**
@@ -33259,21 +33449,26 @@ function toFormData$1(obj, formData, options) {
33259
33449
  formData = formData || new (FormData)();
33260
33450
 
33261
33451
  // eslint-disable-next-line no-param-reassign
33262
- options = utils$1.toFlatObject(options, {
33263
- metaTokens: true,
33264
- dots: false,
33265
- indexes: false
33266
- }, false, function defined(option, source) {
33267
- // eslint-disable-next-line no-eq-null,eqeqeq
33268
- return !utils$1.isUndefined(source[option]);
33269
- });
33452
+ options = utils$1.toFlatObject(
33453
+ options,
33454
+ {
33455
+ metaTokens: true,
33456
+ dots: false,
33457
+ indexes: false,
33458
+ },
33459
+ false,
33460
+ function defined(option, source) {
33461
+ // eslint-disable-next-line no-eq-null,eqeqeq
33462
+ return !utils$1.isUndefined(source[option]);
33463
+ }
33464
+ );
33270
33465
 
33271
33466
  const metaTokens = options.metaTokens;
33272
33467
  // eslint-disable-next-line no-use-before-define
33273
33468
  const visitor = options.visitor || defaultVisitor;
33274
33469
  const dots = options.dots;
33275
33470
  const indexes = options.indexes;
33276
- const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
33471
+ const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
33277
33472
  const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
33278
33473
 
33279
33474
  if (!utils$1.isFunction(visitor)) {
@@ -33287,6 +33482,10 @@ function toFormData$1(obj, formData, options) {
33287
33482
  return value.toISOString();
33288
33483
  }
33289
33484
 
33485
+ if (utils$1.isBoolean(value)) {
33486
+ return value.toString();
33487
+ }
33488
+
33290
33489
  if (!useBlob && utils$1.isBlob(value)) {
33291
33490
  throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
33292
33491
  }
@@ -33311,6 +33510,11 @@ function toFormData$1(obj, formData, options) {
33311
33510
  function defaultVisitor(value, key, path) {
33312
33511
  let arr = value;
33313
33512
 
33513
+ if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
33514
+ formData.append(renderKey(path, key, dots), convertValue(value));
33515
+ return false;
33516
+ }
33517
+
33314
33518
  if (value && !path && typeof value === 'object') {
33315
33519
  if (utils$1.endsWith(key, '{}')) {
33316
33520
  // eslint-disable-next-line no-param-reassign
@@ -33319,17 +33523,22 @@ function toFormData$1(obj, formData, options) {
33319
33523
  value = JSON.stringify(value);
33320
33524
  } else if (
33321
33525
  (utils$1.isArray(value) && isFlatArray(value)) ||
33322
- ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
33323
- )) {
33526
+ ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
33527
+ ) {
33324
33528
  // eslint-disable-next-line no-param-reassign
33325
33529
  key = removeBrackets(key);
33326
33530
 
33327
33531
  arr.forEach(function each(el, index) {
33328
- !(utils$1.isUndefined(el) || el === null) && formData.append(
33329
- // eslint-disable-next-line no-nested-ternary
33330
- indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
33331
- convertValue(el)
33332
- );
33532
+ !(utils$1.isUndefined(el) || el === null) &&
33533
+ formData.append(
33534
+ // eslint-disable-next-line no-nested-ternary
33535
+ indexes === true
33536
+ ? renderKey([key], index, dots)
33537
+ : indexes === null
33538
+ ? key
33539
+ : key + '[]',
33540
+ convertValue(el)
33541
+ );
33333
33542
  });
33334
33543
  return false;
33335
33544
  }
@@ -33349,7 +33558,7 @@ function toFormData$1(obj, formData, options) {
33349
33558
  const exposedHelpers = Object.assign(predicates, {
33350
33559
  defaultVisitor,
33351
33560
  convertValue,
33352
- isVisitable
33561
+ isVisitable,
33353
33562
  });
33354
33563
 
33355
33564
  function build(value, path) {
@@ -33362,9 +33571,9 @@ function toFormData$1(obj, formData, options) {
33362
33571
  stack.push(value);
33363
33572
 
33364
33573
  utils$1.forEach(value, function each(el, key) {
33365
- const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
33366
- formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers
33367
- );
33574
+ const result =
33575
+ !(utils$1.isUndefined(el) || el === null) &&
33576
+ visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
33368
33577
 
33369
33578
  if (result === true) {
33370
33579
  build(el, path ? path.concat(key) : [key]);
@@ -33399,7 +33608,7 @@ function encode$1(str) {
33399
33608
  ')': '%29',
33400
33609
  '~': '%7E',
33401
33610
  '%20': '+',
33402
- '%00': '\x00'
33611
+ '%00': '\x00',
33403
33612
  };
33404
33613
  return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
33405
33614
  return charMap[match];
@@ -33427,31 +33636,33 @@ prototype.append = function append(name, value) {
33427
33636
  };
33428
33637
 
33429
33638
  prototype.toString = function toString(encoder) {
33430
- const _encode = encoder ? function(value) {
33431
- return encoder.call(this, value, encode$1);
33432
- } : encode$1;
33639
+ const _encode = encoder
33640
+ ? function (value) {
33641
+ return encoder.call(this, value, encode$1);
33642
+ }
33643
+ : encode$1;
33433
33644
 
33434
- return this._pairs.map(function each(pair) {
33435
- return _encode(pair[0]) + '=' + _encode(pair[1]);
33436
- }, '').join('&');
33645
+ return this._pairs
33646
+ .map(function each(pair) {
33647
+ return _encode(pair[0]) + '=' + _encode(pair[1]);
33648
+ }, '')
33649
+ .join('&');
33437
33650
  };
33438
33651
 
33439
33652
  /**
33440
- * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
33441
- * URI encoded counterparts
33653
+ * It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
33654
+ * their plain counterparts (`:`, `$`, `,`, `+`).
33442
33655
  *
33443
33656
  * @param {string} val The value to be encoded.
33444
33657
  *
33445
33658
  * @returns {string} The encoded value.
33446
33659
  */
33447
33660
  function encode(val) {
33448
- return encodeURIComponent(val).
33449
- replace(/%3A/gi, ':').
33450
- replace(/%24/g, '$').
33451
- replace(/%2C/gi, ',').
33452
- replace(/%20/g, '+').
33453
- replace(/%5B/gi, '[').
33454
- replace(/%5D/gi, ']');
33661
+ return encodeURIComponent(val)
33662
+ .replace(/%3A/gi, ':')
33663
+ .replace(/%24/g, '$')
33664
+ .replace(/%2C/gi, ',')
33665
+ .replace(/%20/g, '+');
33455
33666
  }
33456
33667
 
33457
33668
  /**
@@ -33459,32 +33670,37 @@ function encode(val) {
33459
33670
  *
33460
33671
  * @param {string} url The base of the url (e.g., http://www.google.com)
33461
33672
  * @param {object} [params] The params to be appended
33462
- * @param {?object} options
33673
+ * @param {?(object|Function)} options
33463
33674
  *
33464
33675
  * @returns {string} The formatted url
33465
33676
  */
33466
33677
  function buildURL(url, params, options) {
33467
- /*eslint no-param-reassign:0*/
33468
33678
  if (!params) {
33469
33679
  return url;
33470
33680
  }
33471
-
33472
- const _encode = options && options.encode || encode;
33473
33681
 
33474
- const serializeFn = options && options.serialize;
33682
+ const _encode = (options && options.encode) || encode;
33683
+
33684
+ const _options = utils$1.isFunction(options)
33685
+ ? {
33686
+ serialize: options,
33687
+ }
33688
+ : options;
33689
+
33690
+ const serializeFn = _options && _options.serialize;
33475
33691
 
33476
33692
  let serializedParams;
33477
33693
 
33478
33694
  if (serializeFn) {
33479
- serializedParams = serializeFn(params, options);
33695
+ serializedParams = serializeFn(params, _options);
33480
33696
  } else {
33481
- serializedParams = utils$1.isURLSearchParams(params) ?
33482
- params.toString() :
33483
- new AxiosURLSearchParams(params, options).toString(_encode);
33697
+ serializedParams = utils$1.isURLSearchParams(params)
33698
+ ? params.toString()
33699
+ : new AxiosURLSearchParams(params, _options).toString(_encode);
33484
33700
  }
33485
33701
 
33486
33702
  if (serializedParams) {
33487
- const hashmarkIndex = url.indexOf("#");
33703
+ const hashmarkIndex = url.indexOf('#');
33488
33704
 
33489
33705
  if (hashmarkIndex !== -1) {
33490
33706
  url = url.slice(0, hashmarkIndex);
@@ -33505,6 +33721,7 @@ class InterceptorManager {
33505
33721
  *
33506
33722
  * @param {Function} fulfilled The function to handle `then` for a `Promise`
33507
33723
  * @param {Function} rejected The function to handle `reject` for a `Promise`
33724
+ * @param {Object} options The options for the interceptor, synchronous and runWhen
33508
33725
  *
33509
33726
  * @return {Number} An ID used to remove interceptor later
33510
33727
  */
@@ -33513,7 +33730,7 @@ class InterceptorManager {
33513
33730
  fulfilled,
33514
33731
  rejected,
33515
33732
  synchronous: options ? options.synchronous : false,
33516
- runWhen: options ? options.runWhen : null
33733
+ runWhen: options ? options.runWhen : null,
33517
33734
  });
33518
33735
  return this.handlers.length - 1;
33519
33736
  }
@@ -33523,7 +33740,7 @@ class InterceptorManager {
33523
33740
  *
33524
33741
  * @param {Number} id The ID that was returned by `use`
33525
33742
  *
33526
- * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
33743
+ * @returns {void}
33527
33744
  */
33528
33745
  eject(id) {
33529
33746
  if (this.handlers[id]) {
@@ -33564,7 +33781,8 @@ class InterceptorManager {
33564
33781
  var transitionalDefaults = {
33565
33782
  silentJSONParsing: true,
33566
33783
  forcedJSONParsing: true,
33567
- clarifyTimeoutError: false
33784
+ clarifyTimeoutError: false,
33785
+ legacyInterceptorReqResOrdering: true,
33568
33786
  };
33569
33787
 
33570
33788
  var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
@@ -33578,13 +33796,15 @@ var platform$1 = {
33578
33796
  classes: {
33579
33797
  URLSearchParams: URLSearchParams$1,
33580
33798
  FormData: FormData$1,
33581
- Blob: Blob$1
33799
+ Blob: Blob$1,
33582
33800
  },
33583
- protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
33801
+ protocols: ['http', 'https', 'file', 'blob', 'url', 'data'],
33584
33802
  };
33585
33803
 
33586
33804
  const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
33587
33805
 
33806
+ const _navigator = (typeof navigator === 'object' && navigator) || undefined;
33807
+
33588
33808
  /**
33589
33809
  * Determine if we're running in a standard browser environment
33590
33810
  *
@@ -33602,10 +33822,9 @@ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'unde
33602
33822
  *
33603
33823
  * @returns {boolean}
33604
33824
  */
33605
- const hasStandardBrowserEnv = (
33606
- (product) => {
33607
- return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
33608
- })(typeof navigator !== 'undefined' && navigator.product);
33825
+ const hasStandardBrowserEnv =
33826
+ hasBrowserEnv &&
33827
+ (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
33609
33828
 
33610
33829
  /**
33611
33830
  * Determine if we're running in a standard browser webWorker environment
@@ -33625,29 +33844,34 @@ const hasStandardBrowserWebWorkerEnv = (() => {
33625
33844
  );
33626
33845
  })();
33627
33846
 
33847
+ const origin = (hasBrowserEnv && window.location.href) || 'http://localhost';
33848
+
33628
33849
  var utils = /*#__PURE__*/Object.freeze({
33629
33850
  __proto__: null,
33630
33851
  hasBrowserEnv: hasBrowserEnv,
33631
33852
  hasStandardBrowserEnv: hasStandardBrowserEnv,
33632
- hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv
33853
+ hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
33854
+ navigator: _navigator,
33855
+ origin: origin
33633
33856
  });
33634
33857
 
33635
33858
  var platform = {
33636
33859
  ...utils,
33637
- ...platform$1
33860
+ ...platform$1,
33638
33861
  };
33639
33862
 
33640
33863
  function toURLEncodedForm(data, options) {
33641
- return toFormData$1(data, new platform.classes.URLSearchParams(), Object.assign({
33642
- visitor: function(value, key, path, helpers) {
33864
+ return toFormData$1(data, new platform.classes.URLSearchParams(), {
33865
+ visitor: function (value, key, path, helpers) {
33643
33866
  if (platform.isNode && utils$1.isBuffer(value)) {
33644
33867
  this.append(key, value.toString('base64'));
33645
33868
  return false;
33646
33869
  }
33647
33870
 
33648
33871
  return helpers.defaultVisitor.apply(this, arguments);
33649
- }
33650
- }, options));
33872
+ },
33873
+ ...options,
33874
+ });
33651
33875
  }
33652
33876
 
33653
33877
  /**
@@ -33662,7 +33886,7 @@ function parsePropPath(name) {
33662
33886
  // foo.x.y.z
33663
33887
  // foo-x-y-z
33664
33888
  // foo x y z
33665
- return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
33889
+ return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
33666
33890
  return match[0] === '[]' ? '' : match[1] || match[0];
33667
33891
  });
33668
33892
  }
@@ -33697,6 +33921,9 @@ function arrayToObject(arr) {
33697
33921
  function formDataToJSON(formData) {
33698
33922
  function buildPath(path, value, target, index) {
33699
33923
  let name = path[index++];
33924
+
33925
+ if (name === '__proto__') return true;
33926
+
33700
33927
  const isNumericKey = Number.isFinite(+name);
33701
33928
  const isLast = index >= path.length;
33702
33929
  name = !name && utils$1.isArray(target) ? target.length : name;
@@ -33763,94 +33990,107 @@ function stringifySafely(rawValue, parser, encoder) {
33763
33990
  }
33764
33991
 
33765
33992
  const defaults = {
33766
-
33767
33993
  transitional: transitionalDefaults,
33768
33994
 
33769
- adapter: ['xhr', 'http'],
33995
+ adapter: ['xhr', 'http', 'fetch'],
33770
33996
 
33771
- transformRequest: [function transformRequest(data, headers) {
33772
- const contentType = headers.getContentType() || '';
33773
- const hasJSONContentType = contentType.indexOf('application/json') > -1;
33774
- const isObjectPayload = utils$1.isObject(data);
33997
+ transformRequest: [
33998
+ function transformRequest(data, headers) {
33999
+ const contentType = headers.getContentType() || '';
34000
+ const hasJSONContentType = contentType.indexOf('application/json') > -1;
34001
+ const isObjectPayload = utils$1.isObject(data);
33775
34002
 
33776
- if (isObjectPayload && utils$1.isHTMLForm(data)) {
33777
- data = new FormData(data);
33778
- }
34003
+ if (isObjectPayload && utils$1.isHTMLForm(data)) {
34004
+ data = new FormData(data);
34005
+ }
34006
+
34007
+ const isFormData = utils$1.isFormData(data);
33779
34008
 
33780
- const isFormData = utils$1.isFormData(data);
34009
+ if (isFormData) {
34010
+ return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
34011
+ }
33781
34012
 
33782
- if (isFormData) {
33783
- if (!hasJSONContentType) {
34013
+ if (
34014
+ utils$1.isArrayBuffer(data) ||
34015
+ utils$1.isBuffer(data) ||
34016
+ utils$1.isStream(data) ||
34017
+ utils$1.isFile(data) ||
34018
+ utils$1.isBlob(data) ||
34019
+ utils$1.isReadableStream(data)
34020
+ ) {
33784
34021
  return data;
33785
34022
  }
33786
- return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
33787
- }
34023
+ if (utils$1.isArrayBufferView(data)) {
34024
+ return data.buffer;
34025
+ }
34026
+ if (utils$1.isURLSearchParams(data)) {
34027
+ headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
34028
+ return data.toString();
34029
+ }
33788
34030
 
33789
- if (utils$1.isArrayBuffer(data) ||
33790
- utils$1.isBuffer(data) ||
33791
- utils$1.isStream(data) ||
33792
- utils$1.isFile(data) ||
33793
- utils$1.isBlob(data)
33794
- ) {
33795
- return data;
33796
- }
33797
- if (utils$1.isArrayBufferView(data)) {
33798
- return data.buffer;
33799
- }
33800
- if (utils$1.isURLSearchParams(data)) {
33801
- headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
33802
- return data.toString();
33803
- }
34031
+ let isFileList;
33804
34032
 
33805
- let isFileList;
34033
+ if (isObjectPayload) {
34034
+ if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
34035
+ return toURLEncodedForm(data, this.formSerializer).toString();
34036
+ }
33806
34037
 
33807
- if (isObjectPayload) {
33808
- if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
33809
- return toURLEncodedForm(data, this.formSerializer).toString();
33810
- }
34038
+ if (
34039
+ (isFileList = utils$1.isFileList(data)) ||
34040
+ contentType.indexOf('multipart/form-data') > -1
34041
+ ) {
34042
+ const _FormData = this.env && this.env.FormData;
33811
34043
 
33812
- if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
33813
- const _FormData = this.env && this.env.FormData;
34044
+ return toFormData$1(
34045
+ isFileList ? { 'files[]': data } : data,
34046
+ _FormData && new _FormData(),
34047
+ this.formSerializer
34048
+ );
34049
+ }
34050
+ }
33814
34051
 
33815
- return toFormData$1(
33816
- isFileList ? {'files[]': data} : data,
33817
- _FormData && new _FormData(),
33818
- this.formSerializer
33819
- );
34052
+ if (isObjectPayload || hasJSONContentType) {
34053
+ headers.setContentType('application/json', false);
34054
+ return stringifySafely(data);
33820
34055
  }
33821
- }
33822
34056
 
33823
- if (isObjectPayload || hasJSONContentType ) {
33824
- headers.setContentType('application/json', false);
33825
- return stringifySafely(data);
33826
- }
34057
+ return data;
34058
+ },
34059
+ ],
33827
34060
 
33828
- return data;
33829
- }],
34061
+ transformResponse: [
34062
+ function transformResponse(data) {
34063
+ const transitional = this.transitional || defaults.transitional;
34064
+ const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
34065
+ const JSONRequested = this.responseType === 'json';
33830
34066
 
33831
- transformResponse: [function transformResponse(data) {
33832
- const transitional = this.transitional || defaults.transitional;
33833
- const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
33834
- const JSONRequested = this.responseType === 'json';
34067
+ if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
34068
+ return data;
34069
+ }
33835
34070
 
33836
- if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
33837
- const silentJSONParsing = transitional && transitional.silentJSONParsing;
33838
- const strictJSONParsing = !silentJSONParsing && JSONRequested;
34071
+ if (
34072
+ data &&
34073
+ utils$1.isString(data) &&
34074
+ ((forcedJSONParsing && !this.responseType) || JSONRequested)
34075
+ ) {
34076
+ const silentJSONParsing = transitional && transitional.silentJSONParsing;
34077
+ const strictJSONParsing = !silentJSONParsing && JSONRequested;
33839
34078
 
33840
- try {
33841
- return JSON.parse(data);
33842
- } catch (e) {
33843
- if (strictJSONParsing) {
33844
- if (e.name === 'SyntaxError') {
33845
- throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
34079
+ try {
34080
+ return JSON.parse(data, this.parseReviver);
34081
+ } catch (e) {
34082
+ if (strictJSONParsing) {
34083
+ if (e.name === 'SyntaxError') {
34084
+ throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
34085
+ }
34086
+ throw e;
33846
34087
  }
33847
- throw e;
33848
34088
  }
33849
34089
  }
33850
- }
33851
34090
 
33852
- return data;
33853
- }],
34091
+ return data;
34092
+ },
34093
+ ],
33854
34094
 
33855
34095
  /**
33856
34096
  * A timeout in milliseconds to abort a request. If set to 0 (default) a
@@ -33866,7 +34106,7 @@ const defaults = {
33866
34106
 
33867
34107
  env: {
33868
34108
  FormData: platform.classes.FormData,
33869
- Blob: platform.classes.Blob
34109
+ Blob: platform.classes.Blob,
33870
34110
  },
33871
34111
 
33872
34112
  validateStatus: function validateStatus(status) {
@@ -33875,10 +34115,10 @@ const defaults = {
33875
34115
 
33876
34116
  headers: {
33877
34117
  common: {
33878
- 'Accept': 'application/json, text/plain, */*',
33879
- 'Content-Type': undefined
33880
- }
33881
- }
34118
+ Accept: 'application/json, text/plain, */*',
34119
+ 'Content-Type': undefined,
34120
+ },
34121
+ },
33882
34122
  };
33883
34123
 
33884
34124
  utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
@@ -33888,10 +34128,23 @@ utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
33888
34128
  // RawAxiosHeaders whose duplicates are ignored by node
33889
34129
  // c.f. https://nodejs.org/api/http.html#http_message_headers
33890
34130
  const ignoreDuplicateOf = utils$1.toObjectSet([
33891
- 'age', 'authorization', 'content-length', 'content-type', 'etag',
33892
- 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
33893
- 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
33894
- 'referer', 'retry-after', 'user-agent'
34131
+ 'age',
34132
+ 'authorization',
34133
+ 'content-length',
34134
+ 'content-type',
34135
+ 'etag',
34136
+ 'expires',
34137
+ 'from',
34138
+ 'host',
34139
+ 'if-modified-since',
34140
+ 'if-unmodified-since',
34141
+ 'last-modified',
34142
+ 'location',
34143
+ 'max-forwards',
34144
+ 'proxy-authorization',
34145
+ 'referer',
34146
+ 'retry-after',
34147
+ 'user-agent',
33895
34148
  ]);
33896
34149
 
33897
34150
  /**
@@ -33908,47 +34161,81 @@ const ignoreDuplicateOf = utils$1.toObjectSet([
33908
34161
  *
33909
34162
  * @returns {Object} Headers parsed into an object
33910
34163
  */
33911
- var parseHeaders = rawHeaders => {
34164
+ var parseHeaders = (rawHeaders) => {
33912
34165
  const parsed = {};
33913
34166
  let key;
33914
34167
  let val;
33915
34168
  let i;
33916
34169
 
33917
- rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
33918
- i = line.indexOf(':');
33919
- key = line.substring(0, i).trim().toLowerCase();
33920
- val = line.substring(i + 1).trim();
34170
+ rawHeaders &&
34171
+ rawHeaders.split('\n').forEach(function parser(line) {
34172
+ i = line.indexOf(':');
34173
+ key = line.substring(0, i).trim().toLowerCase();
34174
+ val = line.substring(i + 1).trim();
33921
34175
 
33922
- if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
33923
- return;
33924
- }
34176
+ if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
34177
+ return;
34178
+ }
33925
34179
 
33926
- if (key === 'set-cookie') {
33927
- if (parsed[key]) {
33928
- parsed[key].push(val);
34180
+ if (key === 'set-cookie') {
34181
+ if (parsed[key]) {
34182
+ parsed[key].push(val);
34183
+ } else {
34184
+ parsed[key] = [val];
34185
+ }
33929
34186
  } else {
33930
- parsed[key] = [val];
34187
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
33931
34188
  }
33932
- } else {
33933
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
33934
- }
33935
- });
34189
+ });
33936
34190
 
33937
34191
  return parsed;
33938
34192
  };
33939
34193
 
33940
34194
  const $internals = Symbol('internals');
33941
34195
 
34196
+ const isValidHeaderValue = (value) => !/[\r\n]/.test(value);
34197
+
34198
+ function assertValidHeaderValue(value, header) {
34199
+ if (value === false || value == null) {
34200
+ return;
34201
+ }
34202
+
34203
+ if (utils$1.isArray(value)) {
34204
+ value.forEach((v) => assertValidHeaderValue(v, header));
34205
+ return;
34206
+ }
34207
+
34208
+ if (!isValidHeaderValue(String(value))) {
34209
+ throw new Error(`Invalid character in header content ["${header}"]`);
34210
+ }
34211
+ }
34212
+
33942
34213
  function normalizeHeader(header) {
33943
34214
  return header && String(header).trim().toLowerCase();
33944
34215
  }
33945
34216
 
34217
+ function stripTrailingCRLF(str) {
34218
+ let end = str.length;
34219
+
34220
+ while (end > 0) {
34221
+ const charCode = str.charCodeAt(end - 1);
34222
+
34223
+ if (charCode !== 10 && charCode !== 13) {
34224
+ break;
34225
+ }
34226
+
34227
+ end -= 1;
34228
+ }
34229
+
34230
+ return end === str.length ? str : str.slice(0, end);
34231
+ }
34232
+
33946
34233
  function normalizeValue(value) {
33947
34234
  if (value === false || value == null) {
33948
34235
  return value;
33949
34236
  }
33950
34237
 
33951
- return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
34238
+ return utils$1.isArray(value) ? value.map(normalizeValue) : stripTrailingCRLF(String(value));
33952
34239
  }
33953
34240
 
33954
34241
  function parseTokens(str) {
@@ -33986,8 +34273,10 @@ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
33986
34273
  }
33987
34274
 
33988
34275
  function formatHeader(header) {
33989
- return header.trim()
33990
- .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
34276
+ return header
34277
+ .trim()
34278
+ .toLowerCase()
34279
+ .replace(/([a-z\d])(\w*)/g, (w, char, str) => {
33991
34280
  return char.toUpperCase() + str;
33992
34281
  });
33993
34282
  }
@@ -33995,12 +34284,12 @@ function formatHeader(header) {
33995
34284
  function buildAccessors(obj, header) {
33996
34285
  const accessorName = utils$1.toCamelCase(' ' + header);
33997
34286
 
33998
- ['get', 'set', 'has'].forEach(methodName => {
34287
+ ['get', 'set', 'has'].forEach((methodName) => {
33999
34288
  Object.defineProperty(obj, methodName + accessorName, {
34000
- value: function(arg1, arg2, arg3) {
34289
+ value: function (arg1, arg2, arg3) {
34001
34290
  return this[methodName].call(this, header, arg1, arg2, arg3);
34002
34291
  },
34003
- configurable: true
34292
+ configurable: true,
34004
34293
  });
34005
34294
  });
34006
34295
  }
@@ -34022,7 +34311,13 @@ let AxiosHeaders$1 = class AxiosHeaders {
34022
34311
 
34023
34312
  const key = utils$1.findKey(self, lHeader);
34024
34313
 
34025
- if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
34314
+ if (
34315
+ !key ||
34316
+ self[key] === undefined ||
34317
+ _rewrite === true ||
34318
+ (_rewrite === undefined && self[key] !== false)
34319
+ ) {
34320
+ assertValidHeaderValue(_value, _header);
34026
34321
  self[key || _header] = normalizeValue(_value);
34027
34322
  }
34028
34323
  }
@@ -34032,8 +34327,25 @@ let AxiosHeaders$1 = class AxiosHeaders {
34032
34327
 
34033
34328
  if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
34034
34329
  setHeaders(header, valueOrRewrite);
34035
- } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
34330
+ } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
34036
34331
  setHeaders(parseHeaders(header), valueOrRewrite);
34332
+ } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
34333
+ let obj = {},
34334
+ dest,
34335
+ key;
34336
+ for (const entry of header) {
34337
+ if (!utils$1.isArray(entry)) {
34338
+ throw TypeError('Object iterator must return a key-value pair');
34339
+ }
34340
+
34341
+ obj[(key = entry[0])] = (dest = obj[key])
34342
+ ? utils$1.isArray(dest)
34343
+ ? [...dest, entry[1]]
34344
+ : [dest, entry[1]]
34345
+ : entry[1];
34346
+ }
34347
+
34348
+ setHeaders(obj, valueOrRewrite);
34037
34349
  } else {
34038
34350
  header != null && setHeader(valueOrRewrite, header, rewrite);
34039
34351
  }
@@ -34077,7 +34389,11 @@ let AxiosHeaders$1 = class AxiosHeaders {
34077
34389
  if (header) {
34078
34390
  const key = utils$1.findKey(this, header);
34079
34391
 
34080
- return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
34392
+ return !!(
34393
+ key &&
34394
+ this[key] !== undefined &&
34395
+ (!matcher || matchHeaderValue(this, this[key], key, matcher))
34396
+ );
34081
34397
  }
34082
34398
 
34083
34399
  return false;
@@ -34117,7 +34433,7 @@ let AxiosHeaders$1 = class AxiosHeaders {
34117
34433
 
34118
34434
  while (i--) {
34119
34435
  const key = keys[i];
34120
- if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
34436
+ if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
34121
34437
  delete this[key];
34122
34438
  deleted = true;
34123
34439
  }
@@ -34161,7 +34477,9 @@ let AxiosHeaders$1 = class AxiosHeaders {
34161
34477
  const obj = Object.create(null);
34162
34478
 
34163
34479
  utils$1.forEach(this, (value, header) => {
34164
- value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
34480
+ value != null &&
34481
+ value !== false &&
34482
+ (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
34165
34483
  });
34166
34484
 
34167
34485
  return obj;
@@ -34172,7 +34490,13 @@ let AxiosHeaders$1 = class AxiosHeaders {
34172
34490
  }
34173
34491
 
34174
34492
  toString() {
34175
- return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
34493
+ return Object.entries(this.toJSON())
34494
+ .map(([header, value]) => header + ': ' + value)
34495
+ .join('\n');
34496
+ }
34497
+
34498
+ getSetCookie() {
34499
+ return this.get('set-cookie') || [];
34176
34500
  }
34177
34501
 
34178
34502
  get [Symbol.toStringTag]() {
@@ -34192,9 +34516,12 @@ let AxiosHeaders$1 = class AxiosHeaders {
34192
34516
  }
34193
34517
 
34194
34518
  static accessor(header) {
34195
- const internals = this[$internals] = (this[$internals] = {
34196
- accessors: {}
34197
- });
34519
+ const internals =
34520
+ (this[$internals] =
34521
+ this[$internals] =
34522
+ {
34523
+ accessors: {},
34524
+ });
34198
34525
 
34199
34526
  const accessors = internals.accessors;
34200
34527
  const prototype = this.prototype;
@@ -34214,17 +34541,24 @@ let AxiosHeaders$1 = class AxiosHeaders {
34214
34541
  }
34215
34542
  };
34216
34543
 
34217
- AxiosHeaders$1.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
34544
+ AxiosHeaders$1.accessor([
34545
+ 'Content-Type',
34546
+ 'Content-Length',
34547
+ 'Accept',
34548
+ 'Accept-Encoding',
34549
+ 'User-Agent',
34550
+ 'Authorization',
34551
+ ]);
34218
34552
 
34219
34553
  // reserved names hotfix
34220
- utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({value}, key) => {
34554
+ utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value }, key) => {
34221
34555
  let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
34222
34556
  return {
34223
34557
  get: () => value,
34224
34558
  set(headerValue) {
34225
34559
  this[mapped] = headerValue;
34226
- }
34227
- }
34560
+ },
34561
+ };
34228
34562
  });
34229
34563
 
34230
34564
  utils$1.freezeMethods(AxiosHeaders$1);
@@ -34256,24 +34590,22 @@ function isCancel$1(value) {
34256
34590
  return !!(value && value.__CANCEL__);
34257
34591
  }
34258
34592
 
34259
- /**
34260
- * A `CanceledError` is an object that is thrown when an operation is canceled.
34261
- *
34262
- * @param {string=} message The message.
34263
- * @param {Object=} config The config.
34264
- * @param {Object=} request The request.
34265
- *
34266
- * @returns {CanceledError} The created error.
34267
- */
34268
- function CanceledError$1(message, config, request) {
34269
- // eslint-disable-next-line no-eq-null,eqeqeq
34270
- AxiosError$1.call(this, message == null ? 'canceled' : message, AxiosError$1.ERR_CANCELED, config, request);
34271
- this.name = 'CanceledError';
34272
- }
34273
-
34274
- utils$1.inherits(CanceledError$1, AxiosError$1, {
34275
- __CANCEL__: true
34276
- });
34593
+ let CanceledError$1 = class CanceledError extends AxiosError$1 {
34594
+ /**
34595
+ * A `CanceledError` is an object that is thrown when an operation is canceled.
34596
+ *
34597
+ * @param {string=} message The message.
34598
+ * @param {Object=} config The config.
34599
+ * @param {Object=} request The request.
34600
+ *
34601
+ * @returns {CanceledError} The created error.
34602
+ */
34603
+ constructor(message, config, request) {
34604
+ super(message == null ? 'canceled' : message, AxiosError$1.ERR_CANCELED, config, request);
34605
+ this.name = 'CanceledError';
34606
+ this.__CANCEL__ = true;
34607
+ }
34608
+ };
34277
34609
 
34278
34610
  /**
34279
34611
  * Resolve or reject a Promise based on response status.
@@ -34289,166 +34621,23 @@ function settle(resolve, reject, response) {
34289
34621
  if (!response.status || !validateStatus || validateStatus(response.status)) {
34290
34622
  resolve(response);
34291
34623
  } else {
34292
- reject(new AxiosError$1(
34293
- 'Request failed with status code ' + response.status,
34294
- [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
34295
- response.config,
34296
- response.request,
34297
- response
34298
- ));
34299
- }
34300
- }
34301
-
34302
- var cookies = platform.hasStandardBrowserEnv ?
34303
-
34304
- // Standard browser envs support document.cookie
34305
- {
34306
- write(name, value, expires, path, domain, secure) {
34307
- const cookie = [name + '=' + encodeURIComponent(value)];
34308
-
34309
- utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
34310
-
34311
- utils$1.isString(path) && cookie.push('path=' + path);
34312
-
34313
- utils$1.isString(domain) && cookie.push('domain=' + domain);
34314
-
34315
- secure === true && cookie.push('secure');
34316
-
34317
- document.cookie = cookie.join('; ');
34318
- },
34319
-
34320
- read(name) {
34321
- const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
34322
- return (match ? decodeURIComponent(match[3]) : null);
34323
- },
34324
-
34325
- remove(name) {
34326
- this.write(name, '', Date.now() - 86400000);
34327
- }
34328
- }
34329
-
34330
- :
34331
-
34332
- // Non-standard browser env (web workers, react-native) lack needed support.
34333
- {
34334
- write() {},
34335
- read() {
34336
- return null;
34337
- },
34338
- remove() {}
34339
- };
34340
-
34341
- /**
34342
- * Determines whether the specified URL is absolute
34343
- *
34344
- * @param {string} url The URL to test
34345
- *
34346
- * @returns {boolean} True if the specified URL is absolute, otherwise false
34347
- */
34348
- function isAbsoluteURL(url) {
34349
- // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
34350
- // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
34351
- // by any combination of letters, digits, plus, period, or hyphen.
34352
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
34353
- }
34354
-
34355
- /**
34356
- * Creates a new URL by combining the specified URLs
34357
- *
34358
- * @param {string} baseURL The base URL
34359
- * @param {string} relativeURL The relative URL
34360
- *
34361
- * @returns {string} The combined URL
34362
- */
34363
- function combineURLs(baseURL, relativeURL) {
34364
- return relativeURL
34365
- ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
34366
- : baseURL;
34367
- }
34368
-
34369
- /**
34370
- * Creates a new URL by combining the baseURL with the requestedURL,
34371
- * only when the requestedURL is not already an absolute URL.
34372
- * If the requestURL is absolute, this function returns the requestedURL untouched.
34373
- *
34374
- * @param {string} baseURL The base URL
34375
- * @param {string} requestedURL Absolute or relative URL to combine
34376
- *
34377
- * @returns {string} The combined full path
34378
- */
34379
- function buildFullPath(baseURL, requestedURL) {
34380
- if (baseURL && !isAbsoluteURL(requestedURL)) {
34381
- return combineURLs(baseURL, requestedURL);
34624
+ reject(
34625
+ new AxiosError$1(
34626
+ 'Request failed with status code ' + response.status,
34627
+ [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][
34628
+ Math.floor(response.status / 100) - 4
34629
+ ],
34630
+ response.config,
34631
+ response.request,
34632
+ response
34633
+ )
34634
+ );
34382
34635
  }
34383
- return requestedURL;
34384
34636
  }
34385
34637
 
34386
- var isURLSameOrigin = platform.hasStandardBrowserEnv ?
34387
-
34388
- // Standard browser envs have full support of the APIs needed to test
34389
- // whether the request URL is of the same origin as current location.
34390
- (function standardBrowserEnv() {
34391
- const msie = /(msie|trident)/i.test(navigator.userAgent);
34392
- const urlParsingNode = document.createElement('a');
34393
- let originURL;
34394
-
34395
- /**
34396
- * Parse a URL to discover its components
34397
- *
34398
- * @param {String} url The URL to be parsed
34399
- * @returns {Object}
34400
- */
34401
- function resolveURL(url) {
34402
- let href = url;
34403
-
34404
- if (msie) {
34405
- // IE needs attribute set twice to normalize properties
34406
- urlParsingNode.setAttribute('href', href);
34407
- href = urlParsingNode.href;
34408
- }
34409
-
34410
- urlParsingNode.setAttribute('href', href);
34411
-
34412
- // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
34413
- return {
34414
- href: urlParsingNode.href,
34415
- protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
34416
- host: urlParsingNode.host,
34417
- search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
34418
- hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
34419
- hostname: urlParsingNode.hostname,
34420
- port: urlParsingNode.port,
34421
- pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
34422
- urlParsingNode.pathname :
34423
- '/' + urlParsingNode.pathname
34424
- };
34425
- }
34426
-
34427
- originURL = resolveURL(window.location.href);
34428
-
34429
- /**
34430
- * Determine if a URL shares the same origin as the current location
34431
- *
34432
- * @param {String} requestURL The URL to test
34433
- * @returns {boolean} True if URL shares the same origin, otherwise false
34434
- */
34435
- return function isURLSameOrigin(requestURL) {
34436
- const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
34437
- return (parsed.protocol === originURL.protocol &&
34438
- parsed.host === originURL.host);
34439
- };
34440
- })() :
34441
-
34442
- // Non standard browser envs (web workers, react-native) lack needed support.
34443
- (function nonStandardBrowserEnv() {
34444
- return function isURLSameOrigin() {
34445
- return true;
34446
- };
34447
- })();
34448
-
34449
34638
  function parseProtocol(url) {
34450
34639
  const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
34451
- return match && match[1] || '';
34640
+ return (match && match[1]) || '';
34452
34641
  }
34453
34642
 
34454
34643
  /**
@@ -34499,15 +34688,58 @@ function speedometer(samplesCount, min) {
34499
34688
 
34500
34689
  const passed = startedAt && now - startedAt;
34501
34690
 
34502
- return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
34691
+ return passed ? Math.round((bytesCount * 1000) / passed) : undefined;
34503
34692
  };
34504
34693
  }
34505
34694
 
34506
- function progressEventReducer(listener, isDownloadStream) {
34695
+ /**
34696
+ * Throttle decorator
34697
+ * @param {Function} fn
34698
+ * @param {Number} freq
34699
+ * @return {Function}
34700
+ */
34701
+ function throttle(fn, freq) {
34702
+ let timestamp = 0;
34703
+ let threshold = 1000 / freq;
34704
+ let lastArgs;
34705
+ let timer;
34706
+
34707
+ const invoke = (args, now = Date.now()) => {
34708
+ timestamp = now;
34709
+ lastArgs = null;
34710
+ if (timer) {
34711
+ clearTimeout(timer);
34712
+ timer = null;
34713
+ }
34714
+ fn(...args);
34715
+ };
34716
+
34717
+ const throttled = (...args) => {
34718
+ const now = Date.now();
34719
+ const passed = now - timestamp;
34720
+ if (passed >= threshold) {
34721
+ invoke(args, now);
34722
+ } else {
34723
+ lastArgs = args;
34724
+ if (!timer) {
34725
+ timer = setTimeout(() => {
34726
+ timer = null;
34727
+ invoke(lastArgs);
34728
+ }, threshold - passed);
34729
+ }
34730
+ }
34731
+ };
34732
+
34733
+ const flush = () => lastArgs && invoke(lastArgs);
34734
+
34735
+ return [throttled, flush];
34736
+ }
34737
+
34738
+ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
34507
34739
  let bytesNotified = 0;
34508
34740
  const _speedometer = speedometer(50, 250);
34509
34741
 
34510
- return e => {
34742
+ return throttle((e) => {
34511
34743
  const loaded = e.loaded;
34512
34744
  const total = e.lengthComputable ? e.total : undefined;
34513
34745
  const progressBytes = loaded - bytesNotified;
@@ -34519,306 +34751,1113 @@ function progressEventReducer(listener, isDownloadStream) {
34519
34751
  const data = {
34520
34752
  loaded,
34521
34753
  total,
34522
- progress: total ? (loaded / total) : undefined,
34754
+ progress: total ? loaded / total : undefined,
34523
34755
  bytes: progressBytes,
34524
34756
  rate: rate ? rate : undefined,
34525
34757
  estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
34526
- event: e
34758
+ event: e,
34759
+ lengthComputable: total != null,
34760
+ [isDownloadStream ? 'download' : 'upload']: true,
34527
34761
  };
34528
34762
 
34529
- data[isDownloadStream ? 'download' : 'upload'] = true;
34530
-
34531
34763
  listener(data);
34764
+ }, freq);
34765
+ };
34766
+
34767
+ const progressEventDecorator = (total, throttled) => {
34768
+ const lengthComputable = total != null;
34769
+
34770
+ return [
34771
+ (loaded) =>
34772
+ throttled[0]({
34773
+ lengthComputable,
34774
+ total,
34775
+ loaded,
34776
+ }),
34777
+ throttled[1],
34778
+ ];
34779
+ };
34780
+
34781
+ const asyncDecorator =
34782
+ (fn) =>
34783
+ (...args) =>
34784
+ utils$1.asap(() => fn(...args));
34785
+
34786
+ var isURLSameOrigin = platform.hasStandardBrowserEnv
34787
+ ? ((origin, isMSIE) => (url) => {
34788
+ url = new URL(url, platform.origin);
34789
+
34790
+ return (
34791
+ origin.protocol === url.protocol &&
34792
+ origin.host === url.host &&
34793
+ (isMSIE || origin.port === url.port)
34794
+ );
34795
+ })(
34796
+ new URL(platform.origin),
34797
+ platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
34798
+ )
34799
+ : () => true;
34800
+
34801
+ var cookies = platform.hasStandardBrowserEnv
34802
+ ? // Standard browser envs support document.cookie
34803
+ {
34804
+ write(name, value, expires, path, domain, secure, sameSite) {
34805
+ if (typeof document === 'undefined') return;
34806
+
34807
+ const cookie = [`${name}=${encodeURIComponent(value)}`];
34808
+
34809
+ if (utils$1.isNumber(expires)) {
34810
+ cookie.push(`expires=${new Date(expires).toUTCString()}`);
34811
+ }
34812
+ if (utils$1.isString(path)) {
34813
+ cookie.push(`path=${path}`);
34814
+ }
34815
+ if (utils$1.isString(domain)) {
34816
+ cookie.push(`domain=${domain}`);
34817
+ }
34818
+ if (secure === true) {
34819
+ cookie.push('secure');
34820
+ }
34821
+ if (utils$1.isString(sameSite)) {
34822
+ cookie.push(`SameSite=${sameSite}`);
34823
+ }
34824
+
34825
+ document.cookie = cookie.join('; ');
34826
+ },
34827
+
34828
+ read(name) {
34829
+ if (typeof document === 'undefined') return null;
34830
+ const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
34831
+ return match ? decodeURIComponent(match[1]) : null;
34832
+ },
34833
+
34834
+ remove(name) {
34835
+ this.write(name, '', Date.now() - 86400000, '/');
34836
+ },
34837
+ }
34838
+ : // Non-standard browser env (web workers, react-native) lack needed support.
34839
+ {
34840
+ write() {},
34841
+ read() {
34842
+ return null;
34843
+ },
34844
+ remove() {},
34845
+ };
34846
+
34847
+ /**
34848
+ * Determines whether the specified URL is absolute
34849
+ *
34850
+ * @param {string} url The URL to test
34851
+ *
34852
+ * @returns {boolean} True if the specified URL is absolute, otherwise false
34853
+ */
34854
+ function isAbsoluteURL(url) {
34855
+ // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
34856
+ // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
34857
+ // by any combination of letters, digits, plus, period, or hyphen.
34858
+ if (typeof url !== 'string') {
34859
+ return false;
34860
+ }
34861
+
34862
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
34863
+ }
34864
+
34865
+ /**
34866
+ * Creates a new URL by combining the specified URLs
34867
+ *
34868
+ * @param {string} baseURL The base URL
34869
+ * @param {string} relativeURL The relative URL
34870
+ *
34871
+ * @returns {string} The combined URL
34872
+ */
34873
+ function combineURLs(baseURL, relativeURL) {
34874
+ return relativeURL
34875
+ ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
34876
+ : baseURL;
34877
+ }
34878
+
34879
+ /**
34880
+ * Creates a new URL by combining the baseURL with the requestedURL,
34881
+ * only when the requestedURL is not already an absolute URL.
34882
+ * If the requestURL is absolute, this function returns the requestedURL untouched.
34883
+ *
34884
+ * @param {string} baseURL The base URL
34885
+ * @param {string} requestedURL Absolute or relative URL to combine
34886
+ *
34887
+ * @returns {string} The combined full path
34888
+ */
34889
+ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
34890
+ let isRelativeUrl = !isAbsoluteURL(requestedURL);
34891
+ if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
34892
+ return combineURLs(baseURL, requestedURL);
34893
+ }
34894
+ return requestedURL;
34895
+ }
34896
+
34897
+ const headersToObject = (thing) => (thing instanceof AxiosHeaders$1 ? { ...thing } : thing);
34898
+
34899
+ /**
34900
+ * Config-specific merge-function which creates a new config-object
34901
+ * by merging two configuration objects together.
34902
+ *
34903
+ * @param {Object} config1
34904
+ * @param {Object} config2
34905
+ *
34906
+ * @returns {Object} New object resulting from merging config2 to config1
34907
+ */
34908
+ function mergeConfig$1(config1, config2) {
34909
+ // eslint-disable-next-line no-param-reassign
34910
+ config2 = config2 || {};
34911
+ const config = {};
34912
+
34913
+ function getMergedValue(target, source, prop, caseless) {
34914
+ if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
34915
+ return utils$1.merge.call({ caseless }, target, source);
34916
+ } else if (utils$1.isPlainObject(source)) {
34917
+ return utils$1.merge({}, source);
34918
+ } else if (utils$1.isArray(source)) {
34919
+ return source.slice();
34920
+ }
34921
+ return source;
34922
+ }
34923
+
34924
+ function mergeDeepProperties(a, b, prop, caseless) {
34925
+ if (!utils$1.isUndefined(b)) {
34926
+ return getMergedValue(a, b, prop, caseless);
34927
+ } else if (!utils$1.isUndefined(a)) {
34928
+ return getMergedValue(undefined, a, prop, caseless);
34929
+ }
34930
+ }
34931
+
34932
+ // eslint-disable-next-line consistent-return
34933
+ function valueFromConfig2(a, b) {
34934
+ if (!utils$1.isUndefined(b)) {
34935
+ return getMergedValue(undefined, b);
34936
+ }
34937
+ }
34938
+
34939
+ // eslint-disable-next-line consistent-return
34940
+ function defaultToConfig2(a, b) {
34941
+ if (!utils$1.isUndefined(b)) {
34942
+ return getMergedValue(undefined, b);
34943
+ } else if (!utils$1.isUndefined(a)) {
34944
+ return getMergedValue(undefined, a);
34945
+ }
34946
+ }
34947
+
34948
+ // eslint-disable-next-line consistent-return
34949
+ function mergeDirectKeys(a, b, prop) {
34950
+ if (prop in config2) {
34951
+ return getMergedValue(a, b);
34952
+ } else if (prop in config1) {
34953
+ return getMergedValue(undefined, a);
34954
+ }
34955
+ }
34956
+
34957
+ const mergeMap = {
34958
+ url: valueFromConfig2,
34959
+ method: valueFromConfig2,
34960
+ data: valueFromConfig2,
34961
+ baseURL: defaultToConfig2,
34962
+ transformRequest: defaultToConfig2,
34963
+ transformResponse: defaultToConfig2,
34964
+ paramsSerializer: defaultToConfig2,
34965
+ timeout: defaultToConfig2,
34966
+ timeoutMessage: defaultToConfig2,
34967
+ withCredentials: defaultToConfig2,
34968
+ withXSRFToken: defaultToConfig2,
34969
+ adapter: defaultToConfig2,
34970
+ responseType: defaultToConfig2,
34971
+ xsrfCookieName: defaultToConfig2,
34972
+ xsrfHeaderName: defaultToConfig2,
34973
+ onUploadProgress: defaultToConfig2,
34974
+ onDownloadProgress: defaultToConfig2,
34975
+ decompress: defaultToConfig2,
34976
+ maxContentLength: defaultToConfig2,
34977
+ maxBodyLength: defaultToConfig2,
34978
+ beforeRedirect: defaultToConfig2,
34979
+ transport: defaultToConfig2,
34980
+ httpAgent: defaultToConfig2,
34981
+ httpsAgent: defaultToConfig2,
34982
+ cancelToken: defaultToConfig2,
34983
+ socketPath: defaultToConfig2,
34984
+ responseEncoding: defaultToConfig2,
34985
+ validateStatus: mergeDirectKeys,
34986
+ headers: (a, b, prop) =>
34987
+ mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true),
34532
34988
  };
34989
+
34990
+ utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
34991
+ if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
34992
+ const merge = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
34993
+ const configValue = merge(config1[prop], config2[prop], prop);
34994
+ (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
34995
+ });
34996
+
34997
+ return config;
34533
34998
  }
34534
34999
 
34535
- const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
35000
+ var resolveConfig = (config) => {
35001
+ const newConfig = mergeConfig$1({}, config);
34536
35002
 
34537
- var xhrAdapter = isXHRAdapterSupported && function (config) {
34538
- return new Promise(function dispatchXhrRequest(resolve, reject) {
34539
- let requestData = config.data;
34540
- const requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
34541
- let {responseType, withXSRFToken} = config;
34542
- let onCanceled;
34543
- function done() {
34544
- if (config.cancelToken) {
34545
- config.cancelToken.unsubscribe(onCanceled);
34546
- }
35003
+ let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
34547
35004
 
34548
- if (config.signal) {
34549
- config.signal.removeEventListener('abort', onCanceled);
34550
- }
35005
+ newConfig.headers = headers = AxiosHeaders$1.from(headers);
35006
+
35007
+ newConfig.url = buildURL(
35008
+ buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls),
35009
+ config.params,
35010
+ config.paramsSerializer
35011
+ );
35012
+
35013
+ // HTTP basic authentication
35014
+ if (auth) {
35015
+ headers.set(
35016
+ 'Authorization',
35017
+ 'Basic ' +
35018
+ btoa(
35019
+ (auth.username || '') +
35020
+ ':' +
35021
+ (auth.password ? unescape(encodeURIComponent(auth.password)) : '')
35022
+ )
35023
+ );
35024
+ }
35025
+
35026
+ if (utils$1.isFormData(data)) {
35027
+ if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
35028
+ headers.setContentType(undefined); // browser handles it
35029
+ } else if (utils$1.isFunction(data.getHeaders)) {
35030
+ // Node.js FormData (like form-data package)
35031
+ const formHeaders = data.getHeaders();
35032
+ // Only set safe headers to avoid overwriting security headers
35033
+ const allowedHeaders = ['content-type', 'content-length'];
35034
+ Object.entries(formHeaders).forEach(([key, val]) => {
35035
+ if (allowedHeaders.includes(key.toLowerCase())) {
35036
+ headers.set(key, val);
35037
+ }
35038
+ });
34551
35039
  }
35040
+ }
35041
+
35042
+ // Add xsrf header
35043
+ // This is only done if running in a standard browser environment.
35044
+ // Specifically not if we're in a web worker, or react-native.
34552
35045
 
34553
- let contentType;
35046
+ if (platform.hasStandardBrowserEnv) {
35047
+ withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
34554
35048
 
34555
- if (utils$1.isFormData(requestData)) {
34556
- if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
34557
- requestHeaders.setContentType(false); // Let the browser set it
34558
- } else if ((contentType = requestHeaders.getContentType()) !== false) {
34559
- // fix semicolon duplication issue for ReactNative FormData implementation
34560
- const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
34561
- requestHeaders.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
35049
+ if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
35050
+ // Add xsrf header
35051
+ const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
35052
+
35053
+ if (xsrfValue) {
35054
+ headers.set(xsrfHeaderName, xsrfValue);
34562
35055
  }
34563
35056
  }
35057
+ }
34564
35058
 
34565
- let request = new XMLHttpRequest();
35059
+ return newConfig;
35060
+ };
34566
35061
 
34567
- // HTTP basic authentication
34568
- if (config.auth) {
34569
- const username = config.auth.username || '';
34570
- const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
34571
- requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
34572
- }
35062
+ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
34573
35063
 
34574
- const fullPath = buildFullPath(config.baseURL, config.url);
35064
+ var xhrAdapter = isXHRAdapterSupported &&
35065
+ function (config) {
35066
+ return new Promise(function dispatchXhrRequest(resolve, reject) {
35067
+ const _config = resolveConfig(config);
35068
+ let requestData = _config.data;
35069
+ const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
35070
+ let { responseType, onUploadProgress, onDownloadProgress } = _config;
35071
+ let onCanceled;
35072
+ let uploadThrottled, downloadThrottled;
35073
+ let flushUpload, flushDownload;
34575
35074
 
34576
- request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
35075
+ function done() {
35076
+ flushUpload && flushUpload(); // flush events
35077
+ flushDownload && flushDownload(); // flush events
34577
35078
 
34578
- // Set the request timeout in MS
34579
- request.timeout = config.timeout;
35079
+ _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
34580
35080
 
34581
- function onloadend() {
34582
- if (!request) {
34583
- return;
35081
+ _config.signal && _config.signal.removeEventListener('abort', onCanceled);
34584
35082
  }
34585
- // Prepare the response
34586
- const responseHeaders = AxiosHeaders$1.from(
34587
- 'getAllResponseHeaders' in request && request.getAllResponseHeaders()
34588
- );
34589
- const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
34590
- request.responseText : request.response;
34591
- const response = {
34592
- data: responseData,
34593
- status: request.status,
34594
- statusText: request.statusText,
34595
- headers: responseHeaders,
34596
- config,
34597
- request
34598
- };
34599
35083
 
34600
- settle(function _resolve(value) {
34601
- resolve(value);
34602
- done();
34603
- }, function _reject(err) {
34604
- reject(err);
34605
- done();
34606
- }, response);
35084
+ let request = new XMLHttpRequest();
34607
35085
 
34608
- // Clean up request
34609
- request = null;
34610
- }
35086
+ request.open(_config.method.toUpperCase(), _config.url, true);
34611
35087
 
34612
- if ('onloadend' in request) {
34613
- // Use onloadend if available
34614
- request.onloadend = onloadend;
34615
- } else {
34616
- // Listen for ready state to emulate onloadend
34617
- request.onreadystatechange = function handleLoad() {
34618
- if (!request || request.readyState !== 4) {
35088
+ // Set the request timeout in MS
35089
+ request.timeout = _config.timeout;
35090
+
35091
+ function onloadend() {
35092
+ if (!request) {
34619
35093
  return;
34620
35094
  }
35095
+ // Prepare the response
35096
+ const responseHeaders = AxiosHeaders$1.from(
35097
+ 'getAllResponseHeaders' in request && request.getAllResponseHeaders()
35098
+ );
35099
+ const responseData =
35100
+ !responseType || responseType === 'text' || responseType === 'json'
35101
+ ? request.responseText
35102
+ : request.response;
35103
+ const response = {
35104
+ data: responseData,
35105
+ status: request.status,
35106
+ statusText: request.statusText,
35107
+ headers: responseHeaders,
35108
+ config,
35109
+ request,
35110
+ };
35111
+
35112
+ settle(
35113
+ function _resolve(value) {
35114
+ resolve(value);
35115
+ done();
35116
+ },
35117
+ function _reject(err) {
35118
+ reject(err);
35119
+ done();
35120
+ },
35121
+ response
35122
+ );
35123
+
35124
+ // Clean up request
35125
+ request = null;
35126
+ }
34621
35127
 
34622
- // The request errored out and we didn't get a response, this will be
34623
- // handled by onerror instead
34624
- // With one exception: request that using file: protocol, most browsers
34625
- // will return status as 0 even though it's a successful request
34626
- if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
35128
+ if ('onloadend' in request) {
35129
+ // Use onloadend if available
35130
+ request.onloadend = onloadend;
35131
+ } else {
35132
+ // Listen for ready state to emulate onloadend
35133
+ request.onreadystatechange = function handleLoad() {
35134
+ if (!request || request.readyState !== 4) {
35135
+ return;
35136
+ }
35137
+
35138
+ // The request errored out and we didn't get a response, this will be
35139
+ // handled by onerror instead
35140
+ // With one exception: request that using file: protocol, most browsers
35141
+ // will return status as 0 even though it's a successful request
35142
+ if (
35143
+ request.status === 0 &&
35144
+ !(request.responseURL && request.responseURL.indexOf('file:') === 0)
35145
+ ) {
35146
+ return;
35147
+ }
35148
+ // readystate handler is calling before onerror or ontimeout handlers,
35149
+ // so we should call onloadend on the next 'tick'
35150
+ setTimeout(onloadend);
35151
+ };
35152
+ }
35153
+
35154
+ // Handle browser request cancellation (as opposed to a manual cancellation)
35155
+ request.onabort = function handleAbort() {
35156
+ if (!request) {
34627
35157
  return;
34628
35158
  }
34629
- // readystate handler is calling before onerror or ontimeout handlers,
34630
- // so we should call onloadend on the next 'tick'
34631
- setTimeout(onloadend);
35159
+
35160
+ reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
35161
+
35162
+ // Clean up request
35163
+ request = null;
35164
+ };
35165
+
35166
+ // Handle low level network errors
35167
+ request.onerror = function handleError(event) {
35168
+ // Browsers deliver a ProgressEvent in XHR onerror
35169
+ // (message may be empty; when present, surface it)
35170
+ // See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
35171
+ const msg = event && event.message ? event.message : 'Network Error';
35172
+ const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
35173
+ // attach the underlying event for consumers who want details
35174
+ err.event = event || null;
35175
+ reject(err);
35176
+ request = null;
34632
35177
  };
34633
- }
34634
35178
 
34635
- // Handle browser request cancellation (as opposed to a manual cancellation)
34636
- request.onabort = function handleAbort() {
34637
- if (!request) {
35179
+ // Handle timeout
35180
+ request.ontimeout = function handleTimeout() {
35181
+ let timeoutErrorMessage = _config.timeout
35182
+ ? 'timeout of ' + _config.timeout + 'ms exceeded'
35183
+ : 'timeout exceeded';
35184
+ const transitional = _config.transitional || transitionalDefaults;
35185
+ if (_config.timeoutErrorMessage) {
35186
+ timeoutErrorMessage = _config.timeoutErrorMessage;
35187
+ }
35188
+ reject(
35189
+ new AxiosError$1(
35190
+ timeoutErrorMessage,
35191
+ transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
35192
+ config,
35193
+ request
35194
+ )
35195
+ );
35196
+
35197
+ // Clean up request
35198
+ request = null;
35199
+ };
35200
+
35201
+ // Remove Content-Type if data is undefined
35202
+ requestData === undefined && requestHeaders.setContentType(null);
35203
+
35204
+ // Add headers to the request
35205
+ if ('setRequestHeader' in request) {
35206
+ utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
35207
+ request.setRequestHeader(key, val);
35208
+ });
35209
+ }
35210
+
35211
+ // Add withCredentials to request if needed
35212
+ if (!utils$1.isUndefined(_config.withCredentials)) {
35213
+ request.withCredentials = !!_config.withCredentials;
35214
+ }
35215
+
35216
+ // Add responseType to request if needed
35217
+ if (responseType && responseType !== 'json') {
35218
+ request.responseType = _config.responseType;
35219
+ }
35220
+
35221
+ // Handle progress if needed
35222
+ if (onDownloadProgress) {
35223
+ [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
35224
+ request.addEventListener('progress', downloadThrottled);
35225
+ }
35226
+
35227
+ // Not all browsers support upload events
35228
+ if (onUploadProgress && request.upload) {
35229
+ [uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
35230
+
35231
+ request.upload.addEventListener('progress', uploadThrottled);
35232
+
35233
+ request.upload.addEventListener('loadend', flushUpload);
35234
+ }
35235
+
35236
+ if (_config.cancelToken || _config.signal) {
35237
+ // Handle cancellation
35238
+ // eslint-disable-next-line func-names
35239
+ onCanceled = (cancel) => {
35240
+ if (!request) {
35241
+ return;
35242
+ }
35243
+ reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
35244
+ request.abort();
35245
+ request = null;
35246
+ };
35247
+
35248
+ _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
35249
+ if (_config.signal) {
35250
+ _config.signal.aborted
35251
+ ? onCanceled()
35252
+ : _config.signal.addEventListener('abort', onCanceled);
35253
+ }
35254
+ }
35255
+
35256
+ const protocol = parseProtocol(_config.url);
35257
+
35258
+ if (protocol && platform.protocols.indexOf(protocol) === -1) {
35259
+ reject(
35260
+ new AxiosError$1(
35261
+ 'Unsupported protocol ' + protocol + ':',
35262
+ AxiosError$1.ERR_BAD_REQUEST,
35263
+ config
35264
+ )
35265
+ );
34638
35266
  return;
34639
35267
  }
34640
35268
 
34641
- reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
35269
+ // Send the request
35270
+ request.send(requestData || null);
35271
+ });
35272
+ };
34642
35273
 
34643
- // Clean up request
34644
- request = null;
34645
- };
35274
+ const composeSignals = (signals, timeout) => {
35275
+ const { length } = (signals = signals ? signals.filter(Boolean) : []);
35276
+
35277
+ if (timeout || length) {
35278
+ let controller = new AbortController();
34646
35279
 
34647
- // Handle low level network errors
34648
- request.onerror = function handleError() {
34649
- // Real errors are hidden from us by the browser
34650
- // onerror should only fire if it's a network error
34651
- reject(new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request));
35280
+ let aborted;
34652
35281
 
34653
- // Clean up request
34654
- request = null;
35282
+ const onabort = function (reason) {
35283
+ if (!aborted) {
35284
+ aborted = true;
35285
+ unsubscribe();
35286
+ const err = reason instanceof Error ? reason : this.reason;
35287
+ controller.abort(
35288
+ err instanceof AxiosError$1
35289
+ ? err
35290
+ : new CanceledError$1(err instanceof Error ? err.message : err)
35291
+ );
35292
+ }
34655
35293
  };
34656
35294
 
34657
- // Handle timeout
34658
- request.ontimeout = function handleTimeout() {
34659
- let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
34660
- const transitional = config.transitional || transitionalDefaults;
34661
- if (config.timeoutErrorMessage) {
34662
- timeoutErrorMessage = config.timeoutErrorMessage;
35295
+ let timer =
35296
+ timeout &&
35297
+ setTimeout(() => {
35298
+ timer = null;
35299
+ onabort(new AxiosError$1(`timeout of ${timeout}ms exceeded`, AxiosError$1.ETIMEDOUT));
35300
+ }, timeout);
35301
+
35302
+ const unsubscribe = () => {
35303
+ if (signals) {
35304
+ timer && clearTimeout(timer);
35305
+ timer = null;
35306
+ signals.forEach((signal) => {
35307
+ signal.unsubscribe
35308
+ ? signal.unsubscribe(onabort)
35309
+ : signal.removeEventListener('abort', onabort);
35310
+ });
35311
+ signals = null;
34663
35312
  }
34664
- reject(new AxiosError$1(
34665
- timeoutErrorMessage,
34666
- transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
34667
- config,
34668
- request));
34669
-
34670
- // Clean up request
34671
- request = null;
34672
35313
  };
34673
35314
 
34674
- // Add xsrf header
34675
- // This is only done if running in a standard browser environment.
34676
- // Specifically not if we're in a web worker, or react-native.
34677
- if(platform.hasStandardBrowserEnv) {
34678
- withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
35315
+ signals.forEach((signal) => signal.addEventListener('abort', onabort));
34679
35316
 
34680
- if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {
34681
- // Add xsrf header
34682
- const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
35317
+ const { signal } = controller;
34683
35318
 
34684
- if (xsrfValue) {
34685
- requestHeaders.set(config.xsrfHeaderName, xsrfValue);
34686
- }
35319
+ signal.unsubscribe = () => utils$1.asap(unsubscribe);
35320
+
35321
+ return signal;
35322
+ }
35323
+ };
35324
+
35325
+ const streamChunk = function* (chunk, chunkSize) {
35326
+ let len = chunk.byteLength;
35327
+
35328
+ if (len < chunkSize) {
35329
+ yield chunk;
35330
+ return;
35331
+ }
35332
+
35333
+ let pos = 0;
35334
+ let end;
35335
+
35336
+ while (pos < len) {
35337
+ end = pos + chunkSize;
35338
+ yield chunk.slice(pos, end);
35339
+ pos = end;
35340
+ }
35341
+ };
35342
+
35343
+ const readBytes = async function* (iterable, chunkSize) {
35344
+ for await (const chunk of readStream(iterable)) {
35345
+ yield* streamChunk(chunk, chunkSize);
35346
+ }
35347
+ };
35348
+
35349
+ const readStream = async function* (stream) {
35350
+ if (stream[Symbol.asyncIterator]) {
35351
+ yield* stream;
35352
+ return;
35353
+ }
35354
+
35355
+ const reader = stream.getReader();
35356
+ try {
35357
+ for (;;) {
35358
+ const { done, value } = await reader.read();
35359
+ if (done) {
35360
+ break;
34687
35361
  }
35362
+ yield value;
34688
35363
  }
35364
+ } finally {
35365
+ await reader.cancel();
35366
+ }
35367
+ };
35368
+
35369
+ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
35370
+ const iterator = readBytes(stream, chunkSize);
35371
+
35372
+ let bytes = 0;
35373
+ let done;
35374
+ let _onFinish = (e) => {
35375
+ if (!done) {
35376
+ done = true;
35377
+ onFinish && onFinish(e);
35378
+ }
35379
+ };
35380
+
35381
+ return new ReadableStream(
35382
+ {
35383
+ async pull(controller) {
35384
+ try {
35385
+ const { done, value } = await iterator.next();
35386
+
35387
+ if (done) {
35388
+ _onFinish();
35389
+ controller.close();
35390
+ return;
35391
+ }
35392
+
35393
+ let len = value.byteLength;
35394
+ if (onProgress) {
35395
+ let loadedBytes = (bytes += len);
35396
+ onProgress(loadedBytes);
35397
+ }
35398
+ controller.enqueue(new Uint8Array(value));
35399
+ } catch (err) {
35400
+ _onFinish(err);
35401
+ throw err;
35402
+ }
35403
+ },
35404
+ cancel(reason) {
35405
+ _onFinish(reason);
35406
+ return iterator.return();
35407
+ },
35408
+ },
35409
+ {
35410
+ highWaterMark: 2,
35411
+ }
35412
+ );
35413
+ };
35414
+
35415
+ const DEFAULT_CHUNK_SIZE = 64 * 1024;
35416
+
35417
+ const { isFunction: isFunction$1 } = utils$1;
35418
+
35419
+ const globalFetchAPI = (({ Request, Response }) => ({
35420
+ Request,
35421
+ Response,
35422
+ }))(utils$1.global);
35423
+
35424
+ const { ReadableStream: ReadableStream$1, TextEncoder: TextEncoder$1 } = utils$1.global;
35425
+
35426
+ const test = (fn, ...args) => {
35427
+ try {
35428
+ return !!fn(...args);
35429
+ } catch (e) {
35430
+ return false;
35431
+ }
35432
+ };
35433
+
35434
+ const factory = (env) => {
35435
+ env = utils$1.merge.call(
35436
+ {
35437
+ skipUndefined: true,
35438
+ },
35439
+ globalFetchAPI,
35440
+ env
35441
+ );
35442
+
35443
+ const { fetch: envFetch, Request, Response } = env;
35444
+ const isFetchSupported = envFetch ? isFunction$1(envFetch) : typeof fetch === 'function';
35445
+ const isRequestSupported = isFunction$1(Request);
35446
+ const isResponseSupported = isFunction$1(Response);
35447
+
35448
+ if (!isFetchSupported) {
35449
+ return false;
35450
+ }
35451
+
35452
+ const isReadableStreamSupported = isFetchSupported && isFunction$1(ReadableStream$1);
35453
+
35454
+ const encodeText =
35455
+ isFetchSupported &&
35456
+ (typeof TextEncoder$1 === 'function'
35457
+ ? (
35458
+ (encoder) => (str) =>
35459
+ encoder.encode(str)
35460
+ )(new TextEncoder$1())
35461
+ : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
35462
+
35463
+ const supportsRequestStream =
35464
+ isRequestSupported &&
35465
+ isReadableStreamSupported &&
35466
+ test(() => {
35467
+ let duplexAccessed = false;
35468
+
35469
+ const body = new ReadableStream$1();
35470
+
35471
+ const hasContentType = new Request(platform.origin, {
35472
+ body,
35473
+ method: 'POST',
35474
+ get duplex() {
35475
+ duplexAccessed = true;
35476
+ return 'half';
35477
+ },
35478
+ }).headers.has('Content-Type');
35479
+
35480
+ body.cancel();
35481
+
35482
+ return duplexAccessed && !hasContentType;
35483
+ });
35484
+
35485
+ const supportsResponseStream =
35486
+ isResponseSupported &&
35487
+ isReadableStreamSupported &&
35488
+ test(() => utils$1.isReadableStream(new Response('').body));
34689
35489
 
34690
- // Remove Content-Type if data is undefined
34691
- requestData === undefined && requestHeaders.setContentType(null);
35490
+ const resolvers = {
35491
+ stream: supportsResponseStream && ((res) => res.body),
35492
+ };
35493
+
35494
+ isFetchSupported &&
35495
+ (() => {
35496
+ ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach((type) => {
35497
+ !resolvers[type] &&
35498
+ (resolvers[type] = (res, config) => {
35499
+ let method = res && res[type];
35500
+
35501
+ if (method) {
35502
+ return method.call(res);
35503
+ }
34692
35504
 
34693
- // Add headers to the request
34694
- if ('setRequestHeader' in request) {
34695
- utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
34696
- request.setRequestHeader(key, val);
35505
+ throw new AxiosError$1(
35506
+ `Response type '${type}' is not supported`,
35507
+ AxiosError$1.ERR_NOT_SUPPORT,
35508
+ config
35509
+ );
35510
+ });
34697
35511
  });
35512
+ })();
35513
+
35514
+ const getBodyLength = async (body) => {
35515
+ if (body == null) {
35516
+ return 0;
34698
35517
  }
34699
35518
 
34700
- // Add withCredentials to request if needed
34701
- if (!utils$1.isUndefined(config.withCredentials)) {
34702
- request.withCredentials = !!config.withCredentials;
35519
+ if (utils$1.isBlob(body)) {
35520
+ return body.size;
34703
35521
  }
34704
35522
 
34705
- // Add responseType to request if needed
34706
- if (responseType && responseType !== 'json') {
34707
- request.responseType = config.responseType;
35523
+ if (utils$1.isSpecCompliantForm(body)) {
35524
+ const _request = new Request(platform.origin, {
35525
+ method: 'POST',
35526
+ body,
35527
+ });
35528
+ return (await _request.arrayBuffer()).byteLength;
34708
35529
  }
34709
35530
 
34710
- // Handle progress if needed
34711
- if (typeof config.onDownloadProgress === 'function') {
34712
- request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
35531
+ if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
35532
+ return body.byteLength;
34713
35533
  }
34714
35534
 
34715
- // Not all browsers support upload events
34716
- if (typeof config.onUploadProgress === 'function' && request.upload) {
34717
- request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
35535
+ if (utils$1.isURLSearchParams(body)) {
35536
+ body = body + '';
34718
35537
  }
34719
35538
 
34720
- if (config.cancelToken || config.signal) {
34721
- // Handle cancellation
34722
- // eslint-disable-next-line func-names
34723
- onCanceled = cancel => {
34724
- if (!request) {
34725
- return;
35539
+ if (utils$1.isString(body)) {
35540
+ return (await encodeText(body)).byteLength;
35541
+ }
35542
+ };
35543
+
35544
+ const resolveBodyLength = async (headers, body) => {
35545
+ const length = utils$1.toFiniteNumber(headers.getContentLength());
35546
+
35547
+ return length == null ? getBodyLength(body) : length;
35548
+ };
35549
+
35550
+ return async (config) => {
35551
+ let {
35552
+ url,
35553
+ method,
35554
+ data,
35555
+ signal,
35556
+ cancelToken,
35557
+ timeout,
35558
+ onDownloadProgress,
35559
+ onUploadProgress,
35560
+ responseType,
35561
+ headers,
35562
+ withCredentials = 'same-origin',
35563
+ fetchOptions,
35564
+ } = resolveConfig(config);
35565
+
35566
+ let _fetch = envFetch || fetch;
35567
+
35568
+ responseType = responseType ? (responseType + '').toLowerCase() : 'text';
35569
+
35570
+ let composedSignal = composeSignals(
35571
+ [signal, cancelToken && cancelToken.toAbortSignal()],
35572
+ timeout
35573
+ );
35574
+
35575
+ let request = null;
35576
+
35577
+ const unsubscribe =
35578
+ composedSignal &&
35579
+ composedSignal.unsubscribe &&
35580
+ (() => {
35581
+ composedSignal.unsubscribe();
35582
+ });
35583
+
35584
+ let requestContentLength;
35585
+
35586
+ try {
35587
+ if (
35588
+ onUploadProgress &&
35589
+ supportsRequestStream &&
35590
+ method !== 'get' &&
35591
+ method !== 'head' &&
35592
+ (requestContentLength = await resolveBodyLength(headers, data)) !== 0
35593
+ ) {
35594
+ let _request = new Request(url, {
35595
+ method: 'POST',
35596
+ body: data,
35597
+ duplex: 'half',
35598
+ });
35599
+
35600
+ let contentTypeHeader;
35601
+
35602
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
35603
+ headers.setContentType(contentTypeHeader);
34726
35604
  }
34727
- reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
34728
- request.abort();
34729
- request = null;
35605
+
35606
+ if (_request.body) {
35607
+ const [onProgress, flush] = progressEventDecorator(
35608
+ requestContentLength,
35609
+ progressEventReducer(asyncDecorator(onUploadProgress))
35610
+ );
35611
+
35612
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
35613
+ }
35614
+ }
35615
+
35616
+ if (!utils$1.isString(withCredentials)) {
35617
+ withCredentials = withCredentials ? 'include' : 'omit';
35618
+ }
35619
+
35620
+ // Cloudflare Workers throws when credentials are defined
35621
+ // see https://github.com/cloudflare/workerd/issues/902
35622
+ const isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype;
35623
+
35624
+ const resolvedOptions = {
35625
+ ...fetchOptions,
35626
+ signal: composedSignal,
35627
+ method: method.toUpperCase(),
35628
+ headers: headers.normalize().toJSON(),
35629
+ body: data,
35630
+ duplex: 'half',
35631
+ credentials: isCredentialsSupported ? withCredentials : undefined,
34730
35632
  };
34731
35633
 
34732
- config.cancelToken && config.cancelToken.subscribe(onCanceled);
34733
- if (config.signal) {
34734
- config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
35634
+ request = isRequestSupported && new Request(url, resolvedOptions);
35635
+
35636
+ let response = await (isRequestSupported
35637
+ ? _fetch(request, fetchOptions)
35638
+ : _fetch(url, resolvedOptions));
35639
+
35640
+ const isStreamResponse =
35641
+ supportsResponseStream && (responseType === 'stream' || responseType === 'response');
35642
+
35643
+ if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
35644
+ const options = {};
35645
+
35646
+ ['status', 'statusText', 'headers'].forEach((prop) => {
35647
+ options[prop] = response[prop];
35648
+ });
35649
+
35650
+ const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
35651
+
35652
+ const [onProgress, flush] =
35653
+ (onDownloadProgress &&
35654
+ progressEventDecorator(
35655
+ responseContentLength,
35656
+ progressEventReducer(asyncDecorator(onDownloadProgress), true)
35657
+ )) ||
35658
+ [];
35659
+
35660
+ response = new Response(
35661
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
35662
+ flush && flush();
35663
+ unsubscribe && unsubscribe();
35664
+ }),
35665
+ options
35666
+ );
34735
35667
  }
34736
- }
34737
35668
 
34738
- const protocol = parseProtocol(fullPath);
35669
+ responseType = responseType || 'text';
34739
35670
 
34740
- if (protocol && platform.protocols.indexOf(protocol) === -1) {
34741
- reject(new AxiosError$1('Unsupported protocol ' + protocol + ':', AxiosError$1.ERR_BAD_REQUEST, config));
34742
- return;
35671
+ let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](
35672
+ response,
35673
+ config
35674
+ );
35675
+
35676
+ !isStreamResponse && unsubscribe && unsubscribe();
35677
+
35678
+ return await new Promise((resolve, reject) => {
35679
+ settle(resolve, reject, {
35680
+ data: responseData,
35681
+ headers: AxiosHeaders$1.from(response.headers),
35682
+ status: response.status,
35683
+ statusText: response.statusText,
35684
+ config,
35685
+ request,
35686
+ });
35687
+ });
35688
+ } catch (err) {
35689
+ unsubscribe && unsubscribe();
35690
+
35691
+ if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
35692
+ throw Object.assign(
35693
+ new AxiosError$1(
35694
+ 'Network Error',
35695
+ AxiosError$1.ERR_NETWORK,
35696
+ config,
35697
+ request,
35698
+ err && err.response
35699
+ ),
35700
+ {
35701
+ cause: err.cause || err,
35702
+ }
35703
+ );
35704
+ }
35705
+
35706
+ throw AxiosError$1.from(err, err && err.code, config, request, err && err.response);
34743
35707
  }
35708
+ };
35709
+ };
34744
35710
 
35711
+ const seedCache = new Map();
34745
35712
 
34746
- // Send the request
34747
- request.send(requestData || null);
34748
- });
35713
+ const getFetch = (config) => {
35714
+ let env = (config && config.env) || {};
35715
+ const { fetch, Request, Response } = env;
35716
+ const seeds = [Request, Response, fetch];
35717
+
35718
+ let len = seeds.length,
35719
+ i = len,
35720
+ seed,
35721
+ target,
35722
+ map = seedCache;
35723
+
35724
+ while (i--) {
35725
+ seed = seeds[i];
35726
+ target = map.get(seed);
35727
+
35728
+ target === undefined && map.set(seed, (target = i ? new Map() : factory(env)));
35729
+
35730
+ map = target;
35731
+ }
35732
+
35733
+ return target;
34749
35734
  };
34750
35735
 
35736
+ getFetch();
35737
+
35738
+ /**
35739
+ * Known adapters mapping.
35740
+ * Provides environment-specific adapters for Axios:
35741
+ * - `http` for Node.js
35742
+ * - `xhr` for browsers
35743
+ * - `fetch` for fetch API-based requests
35744
+ *
35745
+ * @type {Object<string, Function|Object>}
35746
+ */
34751
35747
  const knownAdapters = {
34752
35748
  http: httpAdapter,
34753
- xhr: xhrAdapter
35749
+ xhr: xhrAdapter,
35750
+ fetch: {
35751
+ get: getFetch,
35752
+ },
34754
35753
  };
34755
35754
 
35755
+ // Assign adapter names for easier debugging and identification
34756
35756
  utils$1.forEach(knownAdapters, (fn, value) => {
34757
35757
  if (fn) {
34758
35758
  try {
34759
- Object.defineProperty(fn, 'name', {value});
35759
+ Object.defineProperty(fn, 'name', { value });
34760
35760
  } catch (e) {
34761
35761
  // eslint-disable-next-line no-empty
34762
35762
  }
34763
- Object.defineProperty(fn, 'adapterName', {value});
35763
+ Object.defineProperty(fn, 'adapterName', { value });
34764
35764
  }
34765
35765
  });
34766
35766
 
35767
+ /**
35768
+ * Render a rejection reason string for unknown or unsupported adapters
35769
+ *
35770
+ * @param {string} reason
35771
+ * @returns {string}
35772
+ */
34767
35773
  const renderReason = (reason) => `- ${reason}`;
34768
35774
 
34769
- const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
35775
+ /**
35776
+ * Check if the adapter is resolved (function, null, or false)
35777
+ *
35778
+ * @param {Function|null|false} adapter
35779
+ * @returns {boolean}
35780
+ */
35781
+ const isResolvedHandle = (adapter) =>
35782
+ utils$1.isFunction(adapter) || adapter === null || adapter === false;
34770
35783
 
34771
- var adapters = {
34772
- getAdapter: (adapters) => {
34773
- adapters = utils$1.isArray(adapters) ? adapters : [adapters];
35784
+ /**
35785
+ * Get the first suitable adapter from the provided list.
35786
+ * Tries each adapter in order until a supported one is found.
35787
+ * Throws an AxiosError if no adapter is suitable.
35788
+ *
35789
+ * @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
35790
+ * @param {Object} config - Axios request configuration
35791
+ * @throws {AxiosError} If no suitable adapter is available
35792
+ * @returns {Function} The resolved adapter function
35793
+ */
35794
+ function getAdapter$1(adapters, config) {
35795
+ adapters = utils$1.isArray(adapters) ? adapters : [adapters];
34774
35796
 
34775
- const {length} = adapters;
34776
- let nameOrAdapter;
34777
- let adapter;
35797
+ const { length } = adapters;
35798
+ let nameOrAdapter;
35799
+ let adapter;
34778
35800
 
34779
- const rejectedReasons = {};
35801
+ const rejectedReasons = {};
34780
35802
 
34781
- for (let i = 0; i < length; i++) {
34782
- nameOrAdapter = adapters[i];
34783
- let id;
35803
+ for (let i = 0; i < length; i++) {
35804
+ nameOrAdapter = adapters[i];
35805
+ let id;
34784
35806
 
34785
- adapter = nameOrAdapter;
35807
+ adapter = nameOrAdapter;
34786
35808
 
34787
- if (!isResolvedHandle(nameOrAdapter)) {
34788
- adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
35809
+ if (!isResolvedHandle(nameOrAdapter)) {
35810
+ adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
34789
35811
 
34790
- if (adapter === undefined) {
34791
- throw new AxiosError$1(`Unknown adapter '${id}'`);
34792
- }
34793
- }
34794
-
34795
- if (adapter) {
34796
- break;
35812
+ if (adapter === undefined) {
35813
+ throw new AxiosError$1(`Unknown adapter '${id}'`);
34797
35814
  }
35815
+ }
34798
35816
 
34799
- rejectedReasons[id || '#' + i] = adapter;
35817
+ if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
35818
+ break;
34800
35819
  }
34801
35820
 
34802
- if (!adapter) {
35821
+ rejectedReasons[id || '#' + i] = adapter;
35822
+ }
34803
35823
 
34804
- const reasons = Object.entries(rejectedReasons)
34805
- .map(([id, state]) => `adapter ${id} ` +
34806
- (state === false ? 'is not supported by the environment' : 'is not available in the build')
34807
- );
35824
+ if (!adapter) {
35825
+ const reasons = Object.entries(rejectedReasons).map(
35826
+ ([id, state]) =>
35827
+ `adapter ${id} ` +
35828
+ (state === false ? 'is not supported by the environment' : 'is not available in the build')
35829
+ );
34808
35830
 
34809
- let s = length ?
34810
- (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
34811
- 'as no adapter specified';
35831
+ let s = length
35832
+ ? reasons.length > 1
35833
+ ? 'since :\n' + reasons.map(renderReason).join('\n')
35834
+ : ' ' + renderReason(reasons[0])
35835
+ : 'as no adapter specified';
34812
35836
 
34813
- throw new AxiosError$1(
34814
- `There is no suitable adapter to dispatch the request ` + s,
34815
- 'ERR_NOT_SUPPORT'
34816
- );
34817
- }
35837
+ throw new AxiosError$1(
35838
+ `There is no suitable adapter to dispatch the request ` + s,
35839
+ 'ERR_NOT_SUPPORT'
35840
+ );
35841
+ }
34818
35842
 
34819
- return adapter;
34820
- },
34821
- adapters: knownAdapters
35843
+ return adapter;
35844
+ }
35845
+
35846
+ /**
35847
+ * Exports Axios adapters and utility to resolve an adapter
35848
+ */
35849
+ var adapters = {
35850
+ /**
35851
+ * Resolve an adapter from a list of adapter names or functions.
35852
+ * @type {Function}
35853
+ */
35854
+ getAdapter: getAdapter$1,
35855
+
35856
+ /**
35857
+ * Exposes all known adapters
35858
+ * @type {Object<string, Function|Object>}
35859
+ */
35860
+ adapters: knownAdapters,
34822
35861
  };
34823
35862
 
34824
35863
  /**
@@ -34851,152 +35890,46 @@ function dispatchRequest(config) {
34851
35890
  config.headers = AxiosHeaders$1.from(config.headers);
34852
35891
 
34853
35892
  // Transform request data
34854
- config.data = transformData.call(
34855
- config,
34856
- config.transformRequest
34857
- );
35893
+ config.data = transformData.call(config, config.transformRequest);
34858
35894
 
34859
35895
  if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
34860
35896
  config.headers.setContentType('application/x-www-form-urlencoded', false);
34861
35897
  }
34862
35898
 
34863
- const adapter = adapters.getAdapter(config.adapter || defaults.adapter);
34864
-
34865
- return adapter(config).then(function onAdapterResolution(response) {
34866
- throwIfCancellationRequested(config);
34867
-
34868
- // Transform response data
34869
- response.data = transformData.call(
34870
- config,
34871
- config.transformResponse,
34872
- response
34873
- );
35899
+ const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
34874
35900
 
34875
- response.headers = AxiosHeaders$1.from(response.headers);
34876
-
34877
- return response;
34878
- }, function onAdapterRejection(reason) {
34879
- if (!isCancel$1(reason)) {
35901
+ return adapter(config).then(
35902
+ function onAdapterResolution(response) {
34880
35903
  throwIfCancellationRequested(config);
34881
35904
 
34882
35905
  // Transform response data
34883
- if (reason && reason.response) {
34884
- reason.response.data = transformData.call(
34885
- config,
34886
- config.transformResponse,
34887
- reason.response
34888
- );
34889
- reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
34890
- }
34891
- }
35906
+ response.data = transformData.call(config, config.transformResponse, response);
34892
35907
 
34893
- return Promise.reject(reason);
34894
- });
34895
- }
34896
-
34897
- const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? thing.toJSON() : thing;
35908
+ response.headers = AxiosHeaders$1.from(response.headers);
34898
35909
 
34899
- /**
34900
- * Config-specific merge-function which creates a new config-object
34901
- * by merging two configuration objects together.
34902
- *
34903
- * @param {Object} config1
34904
- * @param {Object} config2
34905
- *
34906
- * @returns {Object} New object resulting from merging config2 to config1
34907
- */
34908
- function mergeConfig$1(config1, config2) {
34909
- // eslint-disable-next-line no-param-reassign
34910
- config2 = config2 || {};
34911
- const config = {};
34912
-
34913
- function getMergedValue(target, source, caseless) {
34914
- if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
34915
- return utils$1.merge.call({caseless}, target, source);
34916
- } else if (utils$1.isPlainObject(source)) {
34917
- return utils$1.merge({}, source);
34918
- } else if (utils$1.isArray(source)) {
34919
- return source.slice();
34920
- }
34921
- return source;
34922
- }
34923
-
34924
- // eslint-disable-next-line consistent-return
34925
- function mergeDeepProperties(a, b, caseless) {
34926
- if (!utils$1.isUndefined(b)) {
34927
- return getMergedValue(a, b, caseless);
34928
- } else if (!utils$1.isUndefined(a)) {
34929
- return getMergedValue(undefined, a, caseless);
34930
- }
34931
- }
34932
-
34933
- // eslint-disable-next-line consistent-return
34934
- function valueFromConfig2(a, b) {
34935
- if (!utils$1.isUndefined(b)) {
34936
- return getMergedValue(undefined, b);
34937
- }
34938
- }
34939
-
34940
- // eslint-disable-next-line consistent-return
34941
- function defaultToConfig2(a, b) {
34942
- if (!utils$1.isUndefined(b)) {
34943
- return getMergedValue(undefined, b);
34944
- } else if (!utils$1.isUndefined(a)) {
34945
- return getMergedValue(undefined, a);
34946
- }
34947
- }
35910
+ return response;
35911
+ },
35912
+ function onAdapterRejection(reason) {
35913
+ if (!isCancel$1(reason)) {
35914
+ throwIfCancellationRequested(config);
35915
+
35916
+ // Transform response data
35917
+ if (reason && reason.response) {
35918
+ reason.response.data = transformData.call(
35919
+ config,
35920
+ config.transformResponse,
35921
+ reason.response
35922
+ );
35923
+ reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
35924
+ }
35925
+ }
34948
35926
 
34949
- // eslint-disable-next-line consistent-return
34950
- function mergeDirectKeys(a, b, prop) {
34951
- if (prop in config2) {
34952
- return getMergedValue(a, b);
34953
- } else if (prop in config1) {
34954
- return getMergedValue(undefined, a);
35927
+ return Promise.reject(reason);
34955
35928
  }
34956
- }
34957
-
34958
- const mergeMap = {
34959
- url: valueFromConfig2,
34960
- method: valueFromConfig2,
34961
- data: valueFromConfig2,
34962
- baseURL: defaultToConfig2,
34963
- transformRequest: defaultToConfig2,
34964
- transformResponse: defaultToConfig2,
34965
- paramsSerializer: defaultToConfig2,
34966
- timeout: defaultToConfig2,
34967
- timeoutMessage: defaultToConfig2,
34968
- withCredentials: defaultToConfig2,
34969
- withXSRFToken: defaultToConfig2,
34970
- adapter: defaultToConfig2,
34971
- responseType: defaultToConfig2,
34972
- xsrfCookieName: defaultToConfig2,
34973
- xsrfHeaderName: defaultToConfig2,
34974
- onUploadProgress: defaultToConfig2,
34975
- onDownloadProgress: defaultToConfig2,
34976
- decompress: defaultToConfig2,
34977
- maxContentLength: defaultToConfig2,
34978
- maxBodyLength: defaultToConfig2,
34979
- beforeRedirect: defaultToConfig2,
34980
- transport: defaultToConfig2,
34981
- httpAgent: defaultToConfig2,
34982
- httpsAgent: defaultToConfig2,
34983
- cancelToken: defaultToConfig2,
34984
- socketPath: defaultToConfig2,
34985
- responseEncoding: defaultToConfig2,
34986
- validateStatus: mergeDirectKeys,
34987
- headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
34988
- };
34989
-
34990
- utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
34991
- const merge = mergeMap[prop] || mergeDeepProperties;
34992
- const configValue = merge(config1[prop], config2[prop], prop);
34993
- (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
34994
- });
34995
-
34996
- return config;
35929
+ );
34997
35930
  }
34998
35931
 
34999
- const VERSION$1 = "1.6.2";
35932
+ const VERSION$1 = "1.15.0";
35000
35933
 
35001
35934
  const validators$1 = {};
35002
35935
 
@@ -35020,7 +35953,15 @@ const deprecatedWarnings = {};
35020
35953
  */
35021
35954
  validators$1.transitional = function transitional(validator, version, message) {
35022
35955
  function formatMessage(opt, desc) {
35023
- return '[Axios v' + VERSION$1 + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
35956
+ return (
35957
+ '[Axios v' +
35958
+ VERSION$1 +
35959
+ "] Transitional option '" +
35960
+ opt +
35961
+ "'" +
35962
+ desc +
35963
+ (message ? '. ' + message : '')
35964
+ );
35024
35965
  }
35025
35966
 
35026
35967
  // eslint-disable-next-line func-names
@@ -35047,6 +35988,14 @@ validators$1.transitional = function transitional(validator, version, message) {
35047
35988
  };
35048
35989
  };
35049
35990
 
35991
+ validators$1.spelling = function spelling(correctSpelling) {
35992
+ return (value, opt) => {
35993
+ // eslint-disable-next-line no-console
35994
+ console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
35995
+ return true;
35996
+ };
35997
+ };
35998
+
35050
35999
  /**
35051
36000
  * Assert object's properties type
35052
36001
  *
@@ -35070,7 +36019,10 @@ function assertOptions(options, schema, allowUnknown) {
35070
36019
  const value = options[opt];
35071
36020
  const result = value === undefined || validator(value, opt, options);
35072
36021
  if (result !== true) {
35073
- throw new AxiosError$1('option ' + opt + ' must be ' + result, AxiosError$1.ERR_BAD_OPTION_VALUE);
36022
+ throw new AxiosError$1(
36023
+ 'option ' + opt + ' must be ' + result,
36024
+ AxiosError$1.ERR_BAD_OPTION_VALUE
36025
+ );
35074
36026
  }
35075
36027
  continue;
35076
36028
  }
@@ -35082,7 +36034,7 @@ function assertOptions(options, schema, allowUnknown) {
35082
36034
 
35083
36035
  var validator = {
35084
36036
  assertOptions,
35085
- validators: validators$1
36037
+ validators: validators$1,
35086
36038
  };
35087
36039
 
35088
36040
  const validators = validator.validators;
@@ -35096,10 +36048,10 @@ const validators = validator.validators;
35096
36048
  */
35097
36049
  let Axios$1 = class Axios {
35098
36050
  constructor(instanceConfig) {
35099
- this.defaults = instanceConfig;
36051
+ this.defaults = instanceConfig || {};
35100
36052
  this.interceptors = {
35101
36053
  request: new InterceptorManager(),
35102
- response: new InterceptorManager()
36054
+ response: new InterceptorManager(),
35103
36055
  };
35104
36056
  }
35105
36057
 
@@ -35111,7 +36063,50 @@ let Axios$1 = class Axios {
35111
36063
  *
35112
36064
  * @returns {Promise} The Promise to be fulfilled
35113
36065
  */
35114
- request(configOrUrl, config) {
36066
+ async request(configOrUrl, config) {
36067
+ try {
36068
+ return await this._request(configOrUrl, config);
36069
+ } catch (err) {
36070
+ if (err instanceof Error) {
36071
+ let dummy = {};
36072
+
36073
+ Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
36074
+
36075
+ // slice off the Error: ... line
36076
+ const stack = (() => {
36077
+ if (!dummy.stack) {
36078
+ return '';
36079
+ }
36080
+
36081
+ const firstNewlineIndex = dummy.stack.indexOf('\n');
36082
+
36083
+ return firstNewlineIndex === -1 ? '' : dummy.stack.slice(firstNewlineIndex + 1);
36084
+ })();
36085
+ try {
36086
+ if (!err.stack) {
36087
+ err.stack = stack;
36088
+ // match without the 2 top stack lines
36089
+ } else if (stack) {
36090
+ const firstNewlineIndex = stack.indexOf('\n');
36091
+ const secondNewlineIndex =
36092
+ firstNewlineIndex === -1 ? -1 : stack.indexOf('\n', firstNewlineIndex + 1);
36093
+ const stackWithoutTwoTopLines =
36094
+ secondNewlineIndex === -1 ? '' : stack.slice(secondNewlineIndex + 1);
36095
+
36096
+ if (!String(err.stack).endsWith(stackWithoutTwoTopLines)) {
36097
+ err.stack += '\n' + stack;
36098
+ }
36099
+ }
36100
+ } catch (e) {
36101
+ // ignore the case where "stack" is an un-writable property
36102
+ }
36103
+ }
36104
+
36105
+ throw err;
36106
+ }
36107
+ }
36108
+
36109
+ _request(configOrUrl, config) {
35115
36110
  /*eslint no-param-reassign:0*/
35116
36111
  // Allow for axios('example/url'[, config]) a la fetch API
35117
36112
  if (typeof configOrUrl === 'string') {
@@ -35123,44 +36118,64 @@ let Axios$1 = class Axios {
35123
36118
 
35124
36119
  config = mergeConfig$1(this.defaults, config);
35125
36120
 
35126
- const {transitional, paramsSerializer, headers} = config;
36121
+ const { transitional, paramsSerializer, headers } = config;
35127
36122
 
35128
36123
  if (transitional !== undefined) {
35129
- validator.assertOptions(transitional, {
35130
- silentJSONParsing: validators.transitional(validators.boolean),
35131
- forcedJSONParsing: validators.transitional(validators.boolean),
35132
- clarifyTimeoutError: validators.transitional(validators.boolean)
35133
- }, false);
36124
+ validator.assertOptions(
36125
+ transitional,
36126
+ {
36127
+ silentJSONParsing: validators.transitional(validators.boolean),
36128
+ forcedJSONParsing: validators.transitional(validators.boolean),
36129
+ clarifyTimeoutError: validators.transitional(validators.boolean),
36130
+ legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),
36131
+ },
36132
+ false
36133
+ );
35134
36134
  }
35135
36135
 
35136
36136
  if (paramsSerializer != null) {
35137
36137
  if (utils$1.isFunction(paramsSerializer)) {
35138
36138
  config.paramsSerializer = {
35139
- serialize: paramsSerializer
36139
+ serialize: paramsSerializer,
35140
36140
  };
35141
36141
  } else {
35142
- validator.assertOptions(paramsSerializer, {
35143
- encode: validators.function,
35144
- serialize: validators.function
35145
- }, true);
36142
+ validator.assertOptions(
36143
+ paramsSerializer,
36144
+ {
36145
+ encode: validators.function,
36146
+ serialize: validators.function,
36147
+ },
36148
+ true
36149
+ );
35146
36150
  }
35147
36151
  }
35148
36152
 
36153
+ // Set config.allowAbsoluteUrls
36154
+ if (config.allowAbsoluteUrls !== undefined) ; else if (this.defaults.allowAbsoluteUrls !== undefined) {
36155
+ config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
36156
+ } else {
36157
+ config.allowAbsoluteUrls = true;
36158
+ }
36159
+
36160
+ validator.assertOptions(
36161
+ config,
36162
+ {
36163
+ baseUrl: validators.spelling('baseURL'),
36164
+ withXsrfToken: validators.spelling('withXSRFToken'),
36165
+ },
36166
+ true
36167
+ );
36168
+
35149
36169
  // Set config.method
35150
36170
  config.method = (config.method || this.defaults.method || 'get').toLowerCase();
35151
36171
 
35152
36172
  // Flatten headers
35153
- let contextHeaders = headers && utils$1.merge(
35154
- headers.common,
35155
- headers[config.method]
35156
- );
36173
+ let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
35157
36174
 
35158
- headers && utils$1.forEach(
35159
- ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
35160
- (method) => {
36175
+ headers &&
36176
+ utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], (method) => {
35161
36177
  delete headers[method];
35162
- }
35163
- );
36178
+ });
35164
36179
 
35165
36180
  config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
35166
36181
 
@@ -35174,7 +36189,15 @@ let Axios$1 = class Axios {
35174
36189
 
35175
36190
  synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
35176
36191
 
35177
- requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
36192
+ const transitional = config.transitional || transitionalDefaults;
36193
+ const legacyInterceptorReqResOrdering =
36194
+ transitional && transitional.legacyInterceptorReqResOrdering;
36195
+
36196
+ if (legacyInterceptorReqResOrdering) {
36197
+ requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
36198
+ } else {
36199
+ requestInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
36200
+ }
35178
36201
  });
35179
36202
 
35180
36203
  const responseInterceptorChain = [];
@@ -35188,8 +36211,8 @@ let Axios$1 = class Axios {
35188
36211
 
35189
36212
  if (!synchronousRequestInterceptors) {
35190
36213
  const chain = [dispatchRequest.bind(this), undefined];
35191
- chain.unshift.apply(chain, requestInterceptorChain);
35192
- chain.push.apply(chain, responseInterceptorChain);
36214
+ chain.unshift(...requestInterceptorChain);
36215
+ chain.push(...responseInterceptorChain);
35193
36216
  len = chain.length;
35194
36217
 
35195
36218
  promise = Promise.resolve(config);
@@ -35205,8 +36228,6 @@ let Axios$1 = class Axios {
35205
36228
 
35206
36229
  let newConfig = config;
35207
36230
 
35208
- i = 0;
35209
-
35210
36231
  while (i < len) {
35211
36232
  const onFulfilled = requestInterceptorChain[i++];
35212
36233
  const onRejected = requestInterceptorChain[i++];
@@ -35236,7 +36257,7 @@ let Axios$1 = class Axios {
35236
36257
 
35237
36258
  getUri(config) {
35238
36259
  config = mergeConfig$1(this.defaults, config);
35239
- const fullPath = buildFullPath(config.baseURL, config.url);
36260
+ const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
35240
36261
  return buildURL(fullPath, config.params, config.paramsSerializer);
35241
36262
  }
35242
36263
  };
@@ -35244,28 +36265,32 @@ let Axios$1 = class Axios {
35244
36265
  // Provide aliases for supported request methods
35245
36266
  utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
35246
36267
  /*eslint func-names:0*/
35247
- Axios$1.prototype[method] = function(url, config) {
35248
- return this.request(mergeConfig$1(config || {}, {
35249
- method,
35250
- url,
35251
- data: (config || {}).data
35252
- }));
36268
+ Axios$1.prototype[method] = function (url, config) {
36269
+ return this.request(
36270
+ mergeConfig$1(config || {}, {
36271
+ method,
36272
+ url,
36273
+ data: (config || {}).data,
36274
+ })
36275
+ );
35253
36276
  };
35254
36277
  });
35255
36278
 
35256
36279
  utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
35257
- /*eslint func-names:0*/
35258
-
35259
36280
  function generateHTTPMethod(isForm) {
35260
36281
  return function httpMethod(url, data, config) {
35261
- return this.request(mergeConfig$1(config || {}, {
35262
- method,
35263
- headers: isForm ? {
35264
- 'Content-Type': 'multipart/form-data'
35265
- } : {},
35266
- url,
35267
- data
35268
- }));
36282
+ return this.request(
36283
+ mergeConfig$1(config || {}, {
36284
+ method,
36285
+ headers: isForm
36286
+ ? {
36287
+ 'Content-Type': 'multipart/form-data',
36288
+ }
36289
+ : {},
36290
+ url,
36291
+ data,
36292
+ })
36293
+ );
35269
36294
  };
35270
36295
  }
35271
36296
 
@@ -35296,7 +36321,7 @@ let CancelToken$1 = class CancelToken {
35296
36321
  const token = this;
35297
36322
 
35298
36323
  // eslint-disable-next-line func-names
35299
- this.promise.then(cancel => {
36324
+ this.promise.then((cancel) => {
35300
36325
  if (!token._listeners) return;
35301
36326
 
35302
36327
  let i = token._listeners.length;
@@ -35308,10 +36333,10 @@ let CancelToken$1 = class CancelToken {
35308
36333
  });
35309
36334
 
35310
36335
  // eslint-disable-next-line func-names
35311
- this.promise.then = onfulfilled => {
36336
+ this.promise.then = (onfulfilled) => {
35312
36337
  let _resolve;
35313
36338
  // eslint-disable-next-line func-names
35314
- const promise = new Promise(resolve => {
36339
+ const promise = new Promise((resolve) => {
35315
36340
  token.subscribe(resolve);
35316
36341
  _resolve = resolve;
35317
36342
  }).then(onfulfilled);
@@ -35374,6 +36399,20 @@ let CancelToken$1 = class CancelToken {
35374
36399
  }
35375
36400
  }
35376
36401
 
36402
+ toAbortSignal() {
36403
+ const controller = new AbortController();
36404
+
36405
+ const abort = (err) => {
36406
+ controller.abort(err);
36407
+ };
36408
+
36409
+ this.subscribe(abort);
36410
+
36411
+ controller.signal.unsubscribe = () => this.unsubscribe(abort);
36412
+
36413
+ return controller.signal;
36414
+ }
36415
+
35377
36416
  /**
35378
36417
  * Returns an object that contains a new `CancelToken` and a function that, when called,
35379
36418
  * cancels the `CancelToken`.
@@ -35385,7 +36424,7 @@ let CancelToken$1 = class CancelToken {
35385
36424
  });
35386
36425
  return {
35387
36426
  token,
35388
- cancel
36427
+ cancel,
35389
36428
  };
35390
36429
  }
35391
36430
  };
@@ -35397,7 +36436,7 @@ let CancelToken$1 = class CancelToken {
35397
36436
  *
35398
36437
  * ```js
35399
36438
  * function f(x, y, z) {}
35400
- * var args = [1, 2, 3];
36439
+ * const args = [1, 2, 3];
35401
36440
  * f.apply(null, args);
35402
36441
  * ```
35403
36442
  *
@@ -35425,7 +36464,7 @@ function spread$1(callback) {
35425
36464
  * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
35426
36465
  */
35427
36466
  function isAxiosError$1(payload) {
35428
- return utils$1.isObject(payload) && (payload.isAxiosError === true);
36467
+ return utils$1.isObject(payload) && payload.isAxiosError === true;
35429
36468
  }
35430
36469
 
35431
36470
  const HttpStatusCode$1 = {
@@ -35492,6 +36531,12 @@ const HttpStatusCode$1 = {
35492
36531
  LoopDetected: 508,
35493
36532
  NotExtended: 510,
35494
36533
  NetworkAuthenticationRequired: 511,
36534
+ WebServerIsDown: 521,
36535
+ ConnectionTimedOut: 522,
36536
+ OriginIsUnreachable: 523,
36537
+ TimeoutOccurred: 524,
36538
+ SslHandshakeFailed: 525,
36539
+ InvalidSslCertificate: 526,
35495
36540
  };
35496
36541
 
35497
36542
  Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
@@ -35510,10 +36555,10 @@ function createInstance(defaultConfig) {
35510
36555
  const instance = bind(Axios$1.prototype.request, context);
35511
36556
 
35512
36557
  // Copy axios.prototype to instance
35513
- utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
36558
+ utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
35514
36559
 
35515
36560
  // Copy context to instance
35516
- utils$1.extend(instance, context, null, {allOwnKeys: true});
36561
+ utils$1.extend(instance, context, null, { allOwnKeys: true });
35517
36562
 
35518
36563
  // Factory for creating new instances
35519
36564
  instance.create = function create(instanceConfig) {
@@ -35557,7 +36602,7 @@ axios.mergeConfig = mergeConfig$1;
35557
36602
 
35558
36603
  axios.AxiosHeaders = AxiosHeaders$1;
35559
36604
 
35560
- axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
36605
+ axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
35561
36606
 
35562
36607
  axios.getAdapter = adapters.getAdapter;
35563
36608
 
@@ -35584,7 +36629,7 @@ const {
35584
36629
  HttpStatusCode,
35585
36630
  formToJSON,
35586
36631
  getAdapter,
35587
- mergeConfig
36632
+ mergeConfig,
35588
36633
  } = axios;
35589
36634
 
35590
36635
  const prodFunctionsBaseUrl = "https://us-central1-neurosity-device.cloudfunctions.net";
@@ -35976,7 +37021,7 @@ var hasRequiredBuffer;
35976
37021
  function requireBuffer () {
35977
37022
  if (hasRequiredBuffer) return buffer;
35978
37023
  hasRequiredBuffer = 1;
35979
- (function (exports) {
37024
+ (function (exports$1) {
35980
37025
 
35981
37026
  const base64 = requireBase64Js();
35982
37027
  const ieee754 = requireIeee754();
@@ -35985,12 +37030,12 @@ function requireBuffer () {
35985
37030
  ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation
35986
37031
  : null;
35987
37032
 
35988
- exports.Buffer = Buffer;
35989
- exports.SlowBuffer = SlowBuffer;
35990
- exports.INSPECT_MAX_BYTES = 50;
37033
+ exports$1.Buffer = Buffer;
37034
+ exports$1.SlowBuffer = SlowBuffer;
37035
+ exports$1.INSPECT_MAX_BYTES = 50;
35991
37036
 
35992
37037
  const K_MAX_LENGTH = 0x7fffffff;
35993
- exports.kMaxLength = K_MAX_LENGTH;
37038
+ exports$1.kMaxLength = K_MAX_LENGTH;
35994
37039
 
35995
37040
  /**
35996
37041
  * If `Buffer.TYPED_ARRAY_SUPPORT`:
@@ -36586,7 +37631,7 @@ function requireBuffer () {
36586
37631
 
36587
37632
  Buffer.prototype.inspect = function inspect () {
36588
37633
  let str = '';
36589
- const max = exports.INSPECT_MAX_BYTES;
37634
+ const max = exports$1.INSPECT_MAX_BYTES;
36590
37635
  str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim();
36591
37636
  if (this.length > max) str += ' ... ';
36592
37637
  return '<Buffer ' + str + '>'
@@ -39011,6 +40056,7 @@ class BluetoothClient {
39011
40056
  this._brainwavesPowerByBand$ =
39012
40057
  this._subscribeWhileAuthenticated("powerByBand");
39013
40058
  this._signalQuality$ = this._subscribeWhileAuthenticated("signalQuality");
40059
+ this._signalQualityV2$ = this._subscribeWhileAuthenticated("signalQualityV2");
39014
40060
  this._status$ = this._subscribeWhileAuthenticated("status");
39015
40061
  this._settings$ = this._subscribeWhileAuthenticated("settings");
39016
40062
  this._wifiNearbyNetworks$ =
@@ -39147,6 +40193,9 @@ class BluetoothClient {
39147
40193
  signalQuality() {
39148
40194
  return this._signalQuality$;
39149
40195
  }
40196
+ signalQualityV2() {
40197
+ return this._signalQualityV2$;
40198
+ }
39150
40199
  async addMarker(label) {
39151
40200
  await this.dispatchAction({
39152
40201
  action: "marker",
@@ -39309,20 +40358,20 @@ var hasRequiredRe;
39309
40358
  function requireRe () {
39310
40359
  if (hasRequiredRe) return re.exports;
39311
40360
  hasRequiredRe = 1;
39312
- (function (module, exports) {
40361
+ (function (module, exports$1) {
39313
40362
  const {
39314
40363
  MAX_SAFE_COMPONENT_LENGTH,
39315
40364
  MAX_SAFE_BUILD_LENGTH,
39316
40365
  MAX_LENGTH,
39317
40366
  } = requireConstants();
39318
40367
  const debug = requireDebug();
39319
- exports = module.exports = {};
40368
+ exports$1 = module.exports = {};
39320
40369
 
39321
40370
  // The actual regexps go on exports.re
39322
- const re = exports.re = [];
39323
- const safeRe = exports.safeRe = [];
39324
- const src = exports.src = [];
39325
- const t = exports.t = {};
40371
+ const re = exports$1.re = [];
40372
+ const safeRe = exports$1.safeRe = [];
40373
+ const src = exports$1.src = [];
40374
+ const t = exports$1.t = {};
39326
40375
  let R = 0;
39327
40376
 
39328
40377
  const LETTERDASHNUMBER = '[a-zA-Z0-9-]';
@@ -39483,7 +40532,7 @@ function requireRe () {
39483
40532
  createToken('LONETILDE', '(?:~>?)');
39484
40533
 
39485
40534
  createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true);
39486
- exports.tildeTrimReplace = '$1~';
40535
+ exports$1.tildeTrimReplace = '$1~';
39487
40536
 
39488
40537
  createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
39489
40538
  createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
@@ -39493,7 +40542,7 @@ function requireRe () {
39493
40542
  createToken('LONECARET', '(?:\\^)');
39494
40543
 
39495
40544
  createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true);
39496
- exports.caretTrimReplace = '$1^';
40545
+ exports$1.caretTrimReplace = '$1^';
39497
40546
 
39498
40547
  createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
39499
40548
  createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
@@ -39506,7 +40555,7 @@ function requireRe () {
39506
40555
  // it modifies, so that `> 1.2.3` ==> `>1.2.3`
39507
40556
  createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
39508
40557
  }\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
39509
- exports.comparatorTrimReplace = '$1$2$3';
40558
+ exports$1.comparatorTrimReplace = '$1$2$3';
39510
40559
 
39511
40560
  // Something like `1.2.3 - 1.2.4`
39512
40561
  // Note that these all use the loose form, because they'll be
@@ -40288,6 +41337,127 @@ class Neurosity {
40288
41337
  bluetooth: () => this.bluetoothClient.brainwaves(label)
40289
41338
  });
40290
41339
  }
41340
+ async record(options) {
41341
+ var _a;
41342
+ if (!(await this.cloudClient.didSelectDevice())) {
41343
+ return Promise.reject(mustSelectDevice);
41344
+ }
41345
+ const [hasOAuthError, OAuthError] = validateScopeBasedPermissionForAction(this.cloudClient.userClaims, {
41346
+ command: "brainwaves",
41347
+ action: "record"});
41348
+ if (hasOAuthError) {
41349
+ return Promise.reject(OAuthError);
41350
+ }
41351
+ if (!options.label) {
41352
+ return Promise.reject(new Error(`${prefix}A label is required for record.`));
41353
+ }
41354
+ if (!options.duration || options.duration <= 0) {
41355
+ return Promise.reject(new Error(`${prefix}A positive duration is required for record.`));
41356
+ }
41357
+ const MAX_DURATION = 30 * 60 * 1000;
41358
+ if (options.duration > MAX_DURATION) {
41359
+ return Promise.reject(new Error(`${prefix}Duration ${options.duration}ms exceeds maximum of ${MAX_DURATION}ms (30 minutes).`));
41360
+ }
41361
+ const response = await this.dispatchAction({
41362
+ command: "brainwaves",
41363
+ action: "record",
41364
+ message: {
41365
+ name: options.name || options.label,
41366
+ label: options.label,
41367
+ duration: options.duration,
41368
+ experimentId: options.experimentId || "sdk-recording"
41369
+ },
41370
+ responseRequired: true,
41371
+ responseTimeout: options.duration + 90000
41372
+ });
41373
+ return (_a = response === null || response === void 0 ? void 0 : response.message) !== null && _a !== void 0 ? _a : response;
41374
+ }
41375
+ async startRecording(options) {
41376
+ var _a;
41377
+ if (!(await this.cloudClient.didSelectDevice())) {
41378
+ return Promise.reject(mustSelectDevice);
41379
+ }
41380
+ const [hasOAuthError, OAuthError] = validateScopeBasedPermissionForAction(this.cloudClient.userClaims, {
41381
+ command: "brainwaves",
41382
+ action: "startRecording"});
41383
+ if (hasOAuthError) {
41384
+ return Promise.reject(OAuthError);
41385
+ }
41386
+ if (!options.label) {
41387
+ return Promise.reject(new Error(`${prefix}A label is required for startRecording.`));
41388
+ }
41389
+ if (!options.maxDuration || options.maxDuration <= 0) {
41390
+ return Promise.reject(new Error(`${prefix}A positive maxDuration is required for startRecording.`));
41391
+ }
41392
+ const MAX_DURATION = 30 * 60 * 1000;
41393
+ if (options.maxDuration > MAX_DURATION) {
41394
+ return Promise.reject(new Error(`${prefix}Duration ${options.maxDuration}ms exceeds maximum of ${MAX_DURATION}ms (30 minutes).`));
41395
+ }
41396
+ const response = await this.dispatchAction({
41397
+ command: "brainwaves",
41398
+ action: "startRecording",
41399
+ message: {
41400
+ name: options.name || options.label,
41401
+ label: options.label,
41402
+ maxDuration: options.maxDuration,
41403
+ experimentId: options.experimentId || "sdk-recording"
41404
+ },
41405
+ responseRequired: true,
41406
+ responseTimeout: options.maxDuration + 10000
41407
+ });
41408
+ const startResponse = (_a = response === null || response === void 0 ? void 0 : response.message) !== null && _a !== void 0 ? _a : response;
41409
+ if (!(startResponse === null || startResponse === void 0 ? void 0 : startResponse.ok)) {
41410
+ return Promise.reject(new Error(`${prefix}Failed to start recording: ${(startResponse === null || startResponse === void 0 ? void 0 : startResponse.error) || "unknown error"}`));
41411
+ }
41412
+ const { cancel: cancelAction, complete: completeAction } = startResponse;
41413
+ const startTime = Date.now();
41414
+ let stopped = false;
41415
+ let resolveResult;
41416
+ const resultPromise = new Promise((resolve) => {
41417
+ resolveResult = resolve;
41418
+ });
41419
+ const elapsedSubscribers = new Set();
41420
+ const elapsed$ = new Observable((subscriber) => {
41421
+ elapsedSubscribers.add(subscriber);
41422
+ const timer = setInterval(() => {
41423
+ subscriber.next(Date.now() - startTime);
41424
+ }, 1000);
41425
+ return () => {
41426
+ clearInterval(timer);
41427
+ elapsedSubscribers.delete(subscriber);
41428
+ };
41429
+ });
41430
+ const completeAllElapsed = () => {
41431
+ for (const sub of elapsedSubscribers) {
41432
+ sub.complete();
41433
+ }
41434
+ };
41435
+ const stop = async () => {
41436
+ var _a, _b;
41437
+ if (stopped)
41438
+ return resultPromise;
41439
+ stopped = true;
41440
+ completeAllElapsed();
41441
+ const stopResponse = await this.dispatchAction(completeAction);
41442
+ const result = (_b = (_a = stopResponse === null || stopResponse === void 0 ? void 0 : stopResponse.message) !== null && _a !== void 0 ? _a : stopResponse) !== null && _b !== void 0 ? _b : { ok: true };
41443
+ resolveResult(result);
41444
+ return result;
41445
+ };
41446
+ const cancel = async () => {
41447
+ if (stopped)
41448
+ return;
41449
+ stopped = true;
41450
+ completeAllElapsed();
41451
+ await this.dispatchAction(cancelAction);
41452
+ resolveResult({ ok: false, error: "cancelled" });
41453
+ };
41454
+ return {
41455
+ elapsed$,
41456
+ stop,
41457
+ cancel,
41458
+ result: resultPromise
41459
+ };
41460
+ }
40291
41461
  calm() {
40292
41462
  const [hasOAuthError, OAuthError] = validateScopeBasedPermissionForFunctionName(this.cloudClient.userClaims, "calm");
40293
41463
  if (hasOAuthError) {
@@ -40317,6 +41487,21 @@ class Neurosity {
40317
41487
  bluetooth: () => this.bluetoothClient.signalQuality()
40318
41488
  });
40319
41489
  }
41490
+ signalQualityV2() {
41491
+ const metric = "signalQualityV2";
41492
+ const [hasOAuthError, OAuthError] = validateScopeBasedPermissionForFunctionName(this.cloudClient.userClaims, "signalQuality");
41493
+ if (hasOAuthError) {
41494
+ return throwError(() => OAuthError);
41495
+ }
41496
+ return this._withStreamingModeObservable({
41497
+ wifi: () => getCloudMetric(this._getCloudMetricDependencies(), {
41498
+ metric,
41499
+ labels: getLabels(metric),
41500
+ atomic: true
41501
+ }),
41502
+ bluetooth: () => this.bluetoothClient.signalQualityV2()
41503
+ });
41504
+ }
40320
41505
  settings() {
40321
41506
  const [hasOAuthError, OAuthError] = validateScopeBasedPermissionForFunctionName(this.cloudClient.userClaims, "settings");
40322
41507
  if (hasOAuthError) {