@neurosity/sdk 7.0.0 → 7.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (306) hide show
  1. package/dist/examples/node/accelerometer.d.ts +5 -0
  2. package/dist/examples/node/accelerometer.d.ts.map +1 -0
  3. package/dist/examples/node/accelerometer.js +12 -0
  4. package/dist/examples/node/accelerometer.js.map +1 -0
  5. package/dist/examples/node/authApiKey.d.ts +4 -0
  6. package/dist/examples/node/authApiKey.d.ts.map +1 -0
  7. package/dist/examples/node/authApiKey.js +17 -0
  8. package/dist/examples/node/authApiKey.js.map +1 -0
  9. package/dist/examples/node/authCustomToken.d.ts +4 -0
  10. package/dist/examples/node/authCustomToken.d.ts.map +1 -0
  11. package/dist/examples/node/authCustomToken.js +11 -0
  12. package/dist/examples/node/authCustomToken.js.map +1 -0
  13. package/dist/examples/node/authEmailPassword.d.ts +5 -0
  14. package/dist/examples/node/authEmailPassword.d.ts.map +1 -0
  15. package/dist/examples/node/authEmailPassword.js +12 -0
  16. package/dist/examples/node/authEmailPassword.js.map +1 -0
  17. package/dist/examples/node/authIdToken.d.ts +5 -0
  18. package/dist/examples/node/authIdToken.d.ts.map +1 -0
  19. package/dist/examples/node/authIdToken.js +12 -0
  20. package/dist/examples/node/authIdToken.js.map +1 -0
  21. package/dist/examples/node/authInheritance.d.ts +5 -0
  22. package/dist/examples/node/authInheritance.d.ts.map +1 -0
  23. package/dist/examples/node/authInheritance.js +17 -0
  24. package/dist/examples/node/authInheritance.js.map +1 -0
  25. package/dist/examples/node/autoSelectDevice.d.ts +5 -0
  26. package/dist/examples/node/autoSelectDevice.d.ts.map +1 -0
  27. package/dist/examples/node/autoSelectDevice.js +16 -0
  28. package/dist/examples/node/autoSelectDevice.js.map +1 -0
  29. package/dist/examples/node/brainwaves.d.ts +5 -0
  30. package/dist/examples/node/brainwaves.d.ts.map +1 -0
  31. package/dist/examples/node/brainwaves.js +12 -0
  32. package/dist/examples/node/brainwaves.js.map +1 -0
  33. package/dist/examples/node/calm.d.ts +5 -0
  34. package/dist/examples/node/calm.d.ts.map +1 -0
  35. package/dist/examples/node/calm.js +12 -0
  36. package/dist/examples/node/calm.js.map +1 -0
  37. package/dist/examples/node/clients.d.ts +5 -0
  38. package/dist/examples/node/clients.d.ts.map +1 -0
  39. package/dist/examples/node/clients.js +10 -0
  40. package/dist/examples/node/clients.js.map +1 -0
  41. package/dist/examples/node/createAccount.d.ts +2 -0
  42. package/dist/examples/node/createAccount.d.ts.map +1 -0
  43. package/dist/examples/node/createAccount.js +16 -0
  44. package/dist/examples/node/createAccount.js.map +1 -0
  45. package/dist/examples/node/createApiKey.d.ts +5 -0
  46. package/dist/examples/node/createApiKey.d.ts.map +1 -0
  47. package/dist/examples/node/createApiKey.js +24 -0
  48. package/dist/examples/node/createApiKey.js.map +1 -0
  49. package/dist/examples/node/createCustomToken.d.ts +5 -0
  50. package/dist/examples/node/createCustomToken.d.ts.map +1 -0
  51. package/dist/examples/node/createCustomToken.js +17 -0
  52. package/dist/examples/node/createCustomToken.js.map +1 -0
  53. package/dist/examples/node/deleteAccount.d.ts +2 -0
  54. package/dist/examples/node/deleteAccount.d.ts.map +1 -0
  55. package/dist/examples/node/deleteAccount.js +21 -0
  56. package/dist/examples/node/deleteAccount.js.map +1 -0
  57. package/dist/examples/node/focus.d.ts +5 -0
  58. package/dist/examples/node/focus.d.ts.map +1 -0
  59. package/dist/examples/node/focus.js +12 -0
  60. package/dist/examples/node/focus.js.map +1 -0
  61. package/dist/examples/node/getDevices.d.ts +2 -0
  62. package/dist/examples/node/getDevices.d.ts.map +1 -0
  63. package/dist/examples/node/getDevices.js +27 -0
  64. package/dist/examples/node/getDevices.js.map +1 -0
  65. package/dist/examples/node/haptics.d.ts +5 -0
  66. package/dist/examples/node/haptics.d.ts.map +1 -0
  67. package/dist/examples/node/haptics.js +25 -0
  68. package/dist/examples/node/haptics.js.map +1 -0
  69. package/dist/examples/node/index.d.ts +2 -0
  70. package/dist/examples/node/index.d.ts.map +1 -0
  71. package/dist/examples/node/index.js +62 -0
  72. package/dist/examples/node/index.js.map +1 -0
  73. package/dist/examples/node/kinesis.d.ts +5 -0
  74. package/dist/examples/node/kinesis.d.ts.map +1 -0
  75. package/dist/examples/node/kinesis.js +12 -0
  76. package/dist/examples/node/kinesis.js.map +1 -0
  77. package/dist/examples/node/manuallySelectDevice.d.ts +5 -0
  78. package/dist/examples/node/manuallySelectDevice.d.ts.map +1 -0
  79. package/dist/examples/node/manuallySelectDevice.js +18 -0
  80. package/dist/examples/node/manuallySelectDevice.js.map +1 -0
  81. package/dist/examples/node/markers.d.ts +5 -0
  82. package/dist/examples/node/markers.d.ts.map +1 -0
  83. package/dist/examples/node/markers.js +27 -0
  84. package/dist/examples/node/markers.js.map +1 -0
  85. package/dist/examples/node/multipleDevices.d.ts +5 -0
  86. package/dist/examples/node/multipleDevices.d.ts.map +1 -0
  87. package/dist/examples/node/multipleDevices.js +33 -0
  88. package/dist/examples/node/multipleDevices.js.map +1 -0
  89. package/dist/examples/node/oauth.d.ts +5 -0
  90. package/dist/examples/node/oauth.d.ts.map +1 -0
  91. package/dist/examples/node/oauth.js +21 -0
  92. package/dist/examples/node/oauth.js.map +1 -0
  93. package/dist/examples/node/osVersion.d.ts +5 -0
  94. package/dist/examples/node/osVersion.d.ts.map +1 -0
  95. package/dist/examples/node/osVersion.js +12 -0
  96. package/dist/examples/node/osVersion.js.map +1 -0
  97. package/dist/examples/node/predictions.d.ts +5 -0
  98. package/dist/examples/node/predictions.d.ts.map +1 -0
  99. package/dist/examples/node/predictions.js +12 -0
  100. package/dist/examples/node/predictions.js.map +1 -0
  101. package/dist/examples/node/rawUnfiltered.d.ts +5 -0
  102. package/dist/examples/node/rawUnfiltered.d.ts.map +1 -0
  103. package/dist/examples/node/rawUnfiltered.js +12 -0
  104. package/dist/examples/node/rawUnfiltered.js.map +1 -0
  105. package/dist/examples/node/removeApiKey.d.ts +5 -0
  106. package/dist/examples/node/removeApiKey.d.ts.map +1 -0
  107. package/dist/examples/node/removeApiKey.js +17 -0
  108. package/dist/examples/node/removeApiKey.js.map +1 -0
  109. package/dist/examples/node/settings.d.ts +5 -0
  110. package/dist/examples/node/settings.d.ts.map +1 -0
  111. package/dist/examples/node/settings.js +19 -0
  112. package/dist/examples/node/settings.js.map +1 -0
  113. package/dist/examples/node/signalQuality.d.ts +5 -0
  114. package/dist/examples/node/signalQuality.d.ts.map +1 -0
  115. package/dist/examples/node/signalQuality.js +12 -0
  116. package/dist/examples/node/signalQuality.js.map +1 -0
  117. package/dist/examples/node/status.d.ts +5 -0
  118. package/dist/examples/node/status.d.ts.map +1 -0
  119. package/dist/examples/node/status.js +12 -0
  120. package/dist/examples/node/status.js.map +1 -0
  121. package/dist/examples/node/switchSelectedDevice.d.ts +5 -0
  122. package/dist/examples/node/switchSelectedDevice.d.ts.map +1 -0
  123. package/dist/examples/node/switchSelectedDevice.js +25 -0
  124. package/dist/examples/node/switchSelectedDevice.js.map +1 -0
  125. package/dist/examples/node/timesync.d.ts +5 -0
  126. package/dist/examples/node/timesync.d.ts.map +1 -0
  127. package/dist/examples/node/timesync.js +12 -0
  128. package/dist/examples/node/timesync.js.map +1 -0
  129. package/dist/examples/node/training.d.ts +5 -0
  130. package/dist/examples/node/training.d.ts.map +1 -0
  131. package/dist/examples/node/training.js +30 -0
  132. package/dist/examples/node/training.js.map +1 -0
  133. package/dist/examples/node/transferDevice.d.ts +5 -0
  134. package/dist/examples/node/transferDevice.d.ts.map +1 -0
  135. package/dist/examples/node/transferDevice.js +27 -0
  136. package/dist/examples/node/transferDevice.js.map +1 -0
  137. package/dist/index.js +2186 -979
  138. package/dist/index.js.map +1 -1
  139. package/dist/index.mjs +2186 -979
  140. package/dist/index.mjs.map +1 -1
  141. package/dist/neurosity.iife.js +2186 -979
  142. package/dist/neurosity.iife.js.map +1 -1
  143. package/dist/neurosity.umd.js +2186 -979
  144. package/dist/neurosity.umd.js.map +1 -1
  145. package/dist/types/Neurosity.d.ts +102 -0
  146. package/dist/types/Neurosity.d.ts.map +1 -0
  147. package/dist/types/api/bluetooth/BluetoothClient.d.ts +77 -0
  148. package/dist/types/api/bluetooth/BluetoothClient.d.ts.map +1 -0
  149. package/dist/types/api/bluetooth/BluetoothTransport.d.ts +31 -0
  150. package/dist/types/api/bluetooth/BluetoothTransport.d.ts.map +1 -0
  151. package/dist/types/api/bluetooth/constants.d.ts +5 -0
  152. package/dist/types/api/bluetooth/constants.d.ts.map +1 -0
  153. package/dist/types/api/bluetooth/index.d.ts +6 -0
  154. package/dist/types/api/bluetooth/index.d.ts.map +1 -0
  155. package/dist/types/api/bluetooth/react-native/ReactNativeTransport.d.ts +73 -0
  156. package/dist/types/api/bluetooth/react-native/ReactNativeTransport.d.ts.map +1 -0
  157. package/dist/types/api/bluetooth/react-native/index.d.ts +3 -0
  158. package/dist/types/api/bluetooth/react-native/index.d.ts.map +1 -0
  159. package/dist/types/api/bluetooth/react-native/types/BleManagerTypes.d.ts +64 -0
  160. package/dist/types/api/bluetooth/react-native/types/BleManagerTypes.d.ts.map +1 -0
  161. package/dist/types/api/bluetooth/react-native/types/ReactNativeTypes.d.ts +41 -0
  162. package/dist/types/api/bluetooth/react-native/types/ReactNativeTypes.d.ts.map +1 -0
  163. package/dist/types/api/bluetooth/react-native/types/index.d.ts +3 -0
  164. package/dist/types/api/bluetooth/react-native/types/index.d.ts.map +1 -0
  165. package/dist/types/api/bluetooth/types/index.d.ts +21 -0
  166. package/dist/types/api/bluetooth/types/index.d.ts.map +1 -0
  167. package/dist/types/api/bluetooth/utils/binaryBufferToEpoch.d.ts +10 -0
  168. package/dist/types/api/bluetooth/utils/binaryBufferToEpoch.d.ts.map +1 -0
  169. package/dist/types/api/bluetooth/utils/create6DigitPin.d.ts +2 -0
  170. package/dist/types/api/bluetooth/utils/create6DigitPin.d.ts.map +1 -0
  171. package/dist/types/api/bluetooth/utils/csvBufferToEpoch.d.ts +6 -0
  172. package/dist/types/api/bluetooth/utils/csvBufferToEpoch.d.ts.map +1 -0
  173. package/dist/types/api/bluetooth/utils/decodeJSONChunks.d.ts +10 -0
  174. package/dist/types/api/bluetooth/utils/decodeJSONChunks.d.ts.map +1 -0
  175. package/dist/types/api/bluetooth/utils/osHasBluetoothSupport.d.ts +3 -0
  176. package/dist/types/api/bluetooth/utils/osHasBluetoothSupport.d.ts.map +1 -0
  177. package/dist/types/api/bluetooth/utils/stitch.d.ts +6 -0
  178. package/dist/types/api/bluetooth/utils/stitch.d.ts.map +1 -0
  179. package/dist/types/api/bluetooth/utils/textCodec.d.ts +11 -0
  180. package/dist/types/api/bluetooth/utils/textCodec.d.ts.map +1 -0
  181. package/dist/types/api/bluetooth/web/WebBluetoothTransport.d.ts +48 -0
  182. package/dist/types/api/bluetooth/web/WebBluetoothTransport.d.ts.map +1 -0
  183. package/dist/types/api/bluetooth/web/isMaybeWebWorkerContext.d.ts +2 -0
  184. package/dist/types/api/bluetooth/web/isMaybeWebWorkerContext.d.ts.map +1 -0
  185. package/dist/types/api/bluetooth/web/isWebBluetoothSupported.d.ts +2 -0
  186. package/dist/types/api/bluetooth/web/isWebBluetoothSupported.d.ts.map +1 -0
  187. package/dist/types/api/firebase/FirebaseApp.d.ts +13 -0
  188. package/dist/types/api/firebase/FirebaseApp.d.ts.map +1 -0
  189. package/dist/types/api/firebase/FirebaseDevice.d.ts +35 -0
  190. package/dist/types/api/firebase/FirebaseDevice.d.ts.map +1 -0
  191. package/dist/types/api/firebase/FirebaseUser.d.ts +50 -0
  192. package/dist/types/api/firebase/FirebaseUser.d.ts.map +1 -0
  193. package/dist/types/api/firebase/config.d.ts +9 -0
  194. package/dist/types/api/firebase/config.d.ts.map +1 -0
  195. package/dist/types/api/firebase/deviceStore.d.ts +24 -0
  196. package/dist/types/api/firebase/deviceStore.d.ts.map +1 -0
  197. package/dist/types/api/firebase/index.d.ts +4 -0
  198. package/dist/types/api/firebase/index.d.ts.map +1 -0
  199. package/dist/types/api/https/config.d.ts +2 -0
  200. package/dist/types/api/https/config.d.ts.map +1 -0
  201. package/dist/types/api/https/createOAuthURL.d.ts +4 -0
  202. package/dist/types/api/https/createOAuthURL.d.ts.map +1 -0
  203. package/dist/types/api/https/getOAuthToken.d.ts +4 -0
  204. package/dist/types/api/https/getOAuthToken.d.ts.map +1 -0
  205. package/dist/types/api/https/utils.d.ts +3 -0
  206. package/dist/types/api/https/utils.d.ts.map +1 -0
  207. package/dist/types/api/index.d.ts +74 -0
  208. package/dist/types/api/index.d.ts.map +1 -0
  209. package/dist/types/index.d.ts +4 -0
  210. package/dist/types/index.d.ts.map +1 -0
  211. package/dist/types/subscriptions/SubscriptionManager.d.ts +9 -0
  212. package/dist/types/subscriptions/SubscriptionManager.d.ts.map +1 -0
  213. package/dist/types/timesync/Timesync.d.ts +21 -0
  214. package/dist/types/timesync/Timesync.d.ts.map +1 -0
  215. package/dist/types/timesync/index.d.ts +2 -0
  216. package/dist/types/timesync/index.d.ts.map +1 -0
  217. package/dist/types/types/accelerometer.d.ts +12 -0
  218. package/dist/types/types/accelerometer.d.ts.map +1 -0
  219. package/dist/types/types/actions.d.ts +11 -0
  220. package/dist/types/types/actions.d.ts.map +1 -0
  221. package/dist/types/types/apiKey.d.ts +31 -0
  222. package/dist/types/types/apiKey.d.ts.map +1 -0
  223. package/dist/types/types/awareness.d.ts +2 -0
  224. package/dist/types/types/awareness.d.ts.map +1 -0
  225. package/dist/types/types/brainwaves.d.ts +40 -0
  226. package/dist/types/types/brainwaves.d.ts.map +1 -0
  227. package/dist/types/types/calm.d.ts +7 -0
  228. package/dist/types/types/calm.d.ts.map +1 -0
  229. package/dist/types/types/client.d.ts +20 -0
  230. package/dist/types/types/client.d.ts.map +1 -0
  231. package/dist/types/types/credentials.d.ts +16 -0
  232. package/dist/types/types/credentials.d.ts.map +1 -0
  233. package/dist/types/types/deviceInfo.d.ts +20 -0
  234. package/dist/types/types/deviceInfo.d.ts.map +1 -0
  235. package/dist/types/types/epoch.d.ts +10 -0
  236. package/dist/types/types/epoch.d.ts.map +1 -0
  237. package/dist/types/types/experiment.d.ts +10 -0
  238. package/dist/types/types/experiment.d.ts.map +1 -0
  239. package/dist/types/types/focus.d.ts +7 -0
  240. package/dist/types/types/focus.d.ts.map +1 -0
  241. package/dist/types/types/hapticEffects.d.ts +126 -0
  242. package/dist/types/types/hapticEffects.d.ts.map +1 -0
  243. package/dist/types/types/index.d.ts +27 -0
  244. package/dist/types/types/index.d.ts.map +1 -0
  245. package/dist/types/types/kinesis.d.ts +7 -0
  246. package/dist/types/types/kinesis.d.ts.map +1 -0
  247. package/dist/types/types/marker.d.ts +5 -0
  248. package/dist/types/types/marker.d.ts.map +1 -0
  249. package/dist/types/types/metrics.d.ts +13 -0
  250. package/dist/types/types/metrics.d.ts.map +1 -0
  251. package/dist/types/types/oauth.d.ts +21 -0
  252. package/dist/types/types/oauth.d.ts.map +1 -0
  253. package/dist/types/types/options.d.ts +25 -0
  254. package/dist/types/types/options.d.ts.map +1 -0
  255. package/dist/types/types/recording.d.ts +26 -0
  256. package/dist/types/types/recording.d.ts.map +1 -0
  257. package/dist/types/types/sample.d.ts +10 -0
  258. package/dist/types/types/sample.d.ts.map +1 -0
  259. package/dist/types/types/settings.d.ts +8 -0
  260. package/dist/types/types/settings.d.ts.map +1 -0
  261. package/dist/types/types/signalQuality.d.ts +9 -0
  262. package/dist/types/types/signalQuality.d.ts.map +1 -0
  263. package/dist/types/types/signalQualityV2.d.ts +14 -0
  264. package/dist/types/types/signalQualityV2.d.ts.map +1 -0
  265. package/dist/types/types/skill.d.ts +45 -0
  266. package/dist/types/types/skill.d.ts.map +1 -0
  267. package/dist/types/types/status.d.ts +21 -0
  268. package/dist/types/types/status.d.ts.map +1 -0
  269. package/dist/types/types/streaming.d.ts +10 -0
  270. package/dist/types/types/streaming.d.ts.map +1 -0
  271. package/dist/types/types/subscriptions.d.ts +15 -0
  272. package/dist/types/types/subscriptions.d.ts.map +1 -0
  273. package/dist/types/types/training.d.ts +14 -0
  274. package/dist/types/types/training.d.ts.map +1 -0
  275. package/dist/types/types/user.d.ts +10 -0
  276. package/dist/types/types/user.d.ts.map +1 -0
  277. package/dist/types/utils/errors.d.ts +6 -0
  278. package/dist/types/utils/errors.d.ts.map +1 -0
  279. package/dist/types/utils/filterInternalKeys.d.ts +4 -0
  280. package/dist/types/utils/filterInternalKeys.d.ts.map +1 -0
  281. package/dist/types/utils/hapticEffects.d.ts +124 -0
  282. package/dist/types/utils/hapticEffects.d.ts.map +1 -0
  283. package/dist/types/utils/heartbeat.d.ts +5 -0
  284. package/dist/types/utils/heartbeat.d.ts.map +1 -0
  285. package/dist/types/utils/index.d.ts +14 -0
  286. package/dist/types/utils/index.d.ts.map +1 -0
  287. package/dist/types/utils/is-node.d.ts +2 -0
  288. package/dist/types/utils/is-node.d.ts.map +1 -0
  289. package/dist/types/utils/metrics.d.ts +4 -0
  290. package/dist/types/utils/metrics.d.ts.map +1 -0
  291. package/dist/types/utils/permissions.d.ts +16 -0
  292. package/dist/types/utils/permissions.d.ts.map +1 -0
  293. package/dist/types/utils/pick.d.ts +2 -0
  294. package/dist/types/utils/pick.d.ts.map +1 -0
  295. package/dist/types/utils/pipes.d.ts +18 -0
  296. package/dist/types/utils/pipes.d.ts.map +1 -0
  297. package/dist/types/utils/platform.d.ts +31 -0
  298. package/dist/types/utils/platform.d.ts.map +1 -0
  299. package/dist/types/utils/subscription.d.ts +7 -0
  300. package/dist/types/utils/subscription.d.ts.map +1 -0
  301. package/dist/types/utils/transferDevice.d.ts +10 -0
  302. package/dist/types/utils/transferDevice.d.ts.map +1 -0
  303. package/dist/types/utils/whileOnline.d.ts +9 -0
  304. package/dist/types/utils/whileOnline.d.ts.map +1 -0
  305. package/package.json +9 -9
  306. package/dist/index.d.ts +0 -1067
@@ -139,7 +139,7 @@ var Neurosity = (function (exports) {
139
139
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
140
140
  };
141
141
 
142
- function isFunction$2(value) {
142
+ function isFunction$3(value) {
143
143
  return typeof value === 'function';
144
144
  }
145
145
 
@@ -207,7 +207,7 @@ var Neurosity = (function (exports) {
207
207
  }
208
208
  }
209
209
  var initialFinalizer = this.initialTeardown;
210
- if (isFunction$2(initialFinalizer)) {
210
+ if (isFunction$3(initialFinalizer)) {
211
211
  try {
212
212
  initialFinalizer();
213
213
  }
@@ -299,10 +299,10 @@ var Neurosity = (function (exports) {
299
299
  var EMPTY_SUBSCRIPTION = Subscription$1.EMPTY;
300
300
  function isSubscription(value) {
301
301
  return (value instanceof Subscription$1 ||
302
- (value && 'closed' in value && isFunction$2(value.remove) && isFunction$2(value.add) && isFunction$2(value.unsubscribe)));
302
+ (value && 'closed' in value && isFunction$3(value.remove) && isFunction$3(value.add) && isFunction$3(value.unsubscribe)));
303
303
  }
304
304
  function execFinalizer(finalizer) {
305
- if (isFunction$2(finalizer)) {
305
+ if (isFunction$3(finalizer)) {
306
306
  finalizer();
307
307
  }
308
308
  else {
@@ -457,7 +457,7 @@ var Neurosity = (function (exports) {
457
457
  function SafeSubscriber(observerOrNext, error, complete) {
458
458
  var _this = _super.call(this) || this;
459
459
  var partialObserver;
460
- if (isFunction$2(observerOrNext) || !observerOrNext) {
460
+ if (isFunction$3(observerOrNext) || !observerOrNext) {
461
461
  partialObserver = {
462
462
  next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
463
463
  error: error !== null && error !== void 0 ? error : undefined,
@@ -602,14 +602,14 @@ var Neurosity = (function (exports) {
602
602
  return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config$1.Promise) !== null && _a !== void 0 ? _a : Promise;
603
603
  }
604
604
  function isObserver(value) {
605
- return value && isFunction$2(value.next) && isFunction$2(value.error) && isFunction$2(value.complete);
605
+ return value && isFunction$3(value.next) && isFunction$3(value.error) && isFunction$3(value.complete);
606
606
  }
607
607
  function isSubscriber(value) {
608
608
  return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));
609
609
  }
610
610
 
611
611
  function hasLift(source) {
612
- return isFunction$2(source === null || source === void 0 ? void 0 : source.lift);
612
+ return isFunction$3(source === null || source === void 0 ? void 0 : source.lift);
613
613
  }
614
614
  function operate(init) {
615
615
  return function (source) {
@@ -1104,14 +1104,14 @@ var Neurosity = (function (exports) {
1104
1104
  var EMPTY = new Observable(function (subscriber) { return subscriber.complete(); });
1105
1105
 
1106
1106
  function isScheduler(value) {
1107
- return value && isFunction$2(value.schedule);
1107
+ return value && isFunction$3(value.schedule);
1108
1108
  }
1109
1109
 
1110
1110
  function last(arr) {
1111
1111
  return arr[arr.length - 1];
1112
1112
  }
1113
1113
  function popResultSelector(args) {
1114
- return isFunction$2(last(args)) ? args.pop() : undefined;
1114
+ return isFunction$3(last(args)) ? args.pop() : undefined;
1115
1115
  }
1116
1116
  function popScheduler(args) {
1117
1117
  return isScheduler(last(args)) ? args.pop() : undefined;
@@ -1123,15 +1123,15 @@ var Neurosity = (function (exports) {
1123
1123
  var isArrayLike = (function (x) { return x && typeof x.length === 'number' && typeof x !== 'function'; });
1124
1124
 
1125
1125
  function isPromise(value) {
1126
- return isFunction$2(value === null || value === void 0 ? void 0 : value.then);
1126
+ return isFunction$3(value === null || value === void 0 ? void 0 : value.then);
1127
1127
  }
1128
1128
 
1129
1129
  function isInteropObservable(input) {
1130
- return isFunction$2(input[observable]);
1130
+ return isFunction$3(input[observable]);
1131
1131
  }
1132
1132
 
1133
1133
  function isAsyncIterable(obj) {
1134
- return Symbol.asyncIterator && isFunction$2(obj === null || obj === void 0 ? void 0 : obj[Symbol.asyncIterator]);
1134
+ return Symbol.asyncIterator && isFunction$3(obj === null || obj === void 0 ? void 0 : obj[Symbol.asyncIterator]);
1135
1135
  }
1136
1136
 
1137
1137
  function createInvalidObservableTypeError(input) {
@@ -1144,10 +1144,10 @@ var Neurosity = (function (exports) {
1144
1144
  }
1145
1145
  return Symbol.iterator;
1146
1146
  }
1147
- var iterator = getSymbolIterator();
1147
+ var iterator$1 = getSymbolIterator();
1148
1148
 
1149
- function isIterable(input) {
1150
- return isFunction$2(input === null || input === void 0 ? void 0 : input[iterator]);
1149
+ function isIterable$1(input) {
1150
+ return isFunction$3(input === null || input === void 0 ? void 0 : input[iterator$1]);
1151
1151
  }
1152
1152
 
1153
1153
  function readableStreamLikeToAsyncGenerator(readableStream) {
@@ -1183,7 +1183,7 @@ var Neurosity = (function (exports) {
1183
1183
  });
1184
1184
  }
1185
1185
  function isReadableStreamLike(obj) {
1186
- return isFunction$2(obj === null || obj === void 0 ? void 0 : obj.getReader);
1186
+ return isFunction$3(obj === null || obj === void 0 ? void 0 : obj.getReader);
1187
1187
  }
1188
1188
 
1189
1189
  function innerFrom(input) {
@@ -1203,7 +1203,7 @@ var Neurosity = (function (exports) {
1203
1203
  if (isAsyncIterable(input)) {
1204
1204
  return fromAsyncIterable(input);
1205
1205
  }
1206
- if (isIterable(input)) {
1206
+ if (isIterable$1(input)) {
1207
1207
  return fromIterable(input);
1208
1208
  }
1209
1209
  if (isReadableStreamLike(input)) {
@@ -1215,7 +1215,7 @@ var Neurosity = (function (exports) {
1215
1215
  function fromInteropObservable(obj) {
1216
1216
  return new Observable(function (subscriber) {
1217
1217
  var obs = obj[observable]();
1218
- if (isFunction$2(obs.subscribe)) {
1218
+ if (isFunction$3(obs.subscribe)) {
1219
1219
  return obs.subscribe(subscriber);
1220
1220
  }
1221
1221
  throw new TypeError('Provided object does not correctly implement Symbol.observable');
@@ -1376,15 +1376,15 @@ var Neurosity = (function (exports) {
1376
1376
 
1377
1377
  function scheduleIterable(input, scheduler) {
1378
1378
  return new Observable(function (subscriber) {
1379
- var iterator$1;
1379
+ var iterator;
1380
1380
  executeSchedule(subscriber, scheduler, function () {
1381
- iterator$1 = input[iterator]();
1381
+ iterator = input[iterator$1]();
1382
1382
  executeSchedule(subscriber, scheduler, function () {
1383
1383
  var _a;
1384
1384
  var value;
1385
1385
  var done;
1386
1386
  try {
1387
- (_a = iterator$1.next(), value = _a.value, done = _a.done);
1387
+ (_a = iterator.next(), value = _a.value, done = _a.done);
1388
1388
  }
1389
1389
  catch (err) {
1390
1390
  subscriber.error(err);
@@ -1398,7 +1398,7 @@ var Neurosity = (function (exports) {
1398
1398
  }
1399
1399
  }, 0, true);
1400
1400
  });
1401
- return function () { return isFunction$2(iterator$1 === null || iterator$1 === void 0 ? void 0 : iterator$1.return) && iterator$1.return(); };
1401
+ return function () { return isFunction$3(iterator === null || iterator === void 0 ? void 0 : iterator.return) && iterator.return(); };
1402
1402
  });
1403
1403
  }
1404
1404
 
@@ -1441,7 +1441,7 @@ var Neurosity = (function (exports) {
1441
1441
  if (isAsyncIterable(input)) {
1442
1442
  return scheduleAsyncIterable(input, scheduler);
1443
1443
  }
1444
- if (isIterable(input)) {
1444
+ if (isIterable$1(input)) {
1445
1445
  return scheduleIterable(input, scheduler);
1446
1446
  }
1447
1447
  if (isReadableStreamLike(input)) {
@@ -1465,7 +1465,7 @@ var Neurosity = (function (exports) {
1465
1465
  }
1466
1466
 
1467
1467
  function throwError(errorOrErrorFactory, scheduler) {
1468
- var errorFactory = isFunction$2(errorOrErrorFactory) ? errorOrErrorFactory : function () { return errorOrErrorFactory; };
1468
+ var errorFactory = isFunction$3(errorOrErrorFactory) ? errorOrErrorFactory : function () { return errorOrErrorFactory; };
1469
1469
  var init = function (subscriber) { return subscriber.error(errorFactory()); };
1470
1470
  return new Observable(init);
1471
1471
  }
@@ -1656,7 +1656,7 @@ var Neurosity = (function (exports) {
1656
1656
 
1657
1657
  function mergeMap(project, resultSelector, concurrent) {
1658
1658
  if (concurrent === void 0) { concurrent = Infinity; }
1659
- if (isFunction$2(resultSelector)) {
1659
+ if (isFunction$3(resultSelector)) {
1660
1660
  return mergeMap(function (a, i) { return map$1(function (b, ii) { return resultSelector(a, b, i, ii); })(innerFrom(project(a, i))); }, concurrent);
1661
1661
  }
1662
1662
  else if (typeof resultSelector === 'number') {
@@ -1698,7 +1698,7 @@ var Neurosity = (function (exports) {
1698
1698
  return subscriber.next(e.length === 1 ? e[0] : e);
1699
1699
  };
1700
1700
  var retValue = addHandler(handler);
1701
- return isFunction$2(removeHandler) ? function () { return removeHandler(handler, retValue); } : undefined;
1701
+ return isFunction$3(removeHandler) ? function () { return removeHandler(handler, retValue); } : undefined;
1702
1702
  });
1703
1703
  }
1704
1704
 
@@ -1864,7 +1864,7 @@ var Neurosity = (function (exports) {
1864
1864
  }
1865
1865
 
1866
1866
  function concatMap(project, resultSelector) {
1867
- return isFunction$2(resultSelector) ? mergeMap(project, resultSelector, 1) : mergeMap(project, 1);
1867
+ return isFunction$3(resultSelector) ? mergeMap(project, resultSelector, 1) : mergeMap(project, 1);
1868
1868
  }
1869
1869
 
1870
1870
  function concat() {
@@ -2086,7 +2086,7 @@ var Neurosity = (function (exports) {
2086
2086
  }
2087
2087
 
2088
2088
  function tap(observerOrNext, error, complete) {
2089
- var tapObserver = isFunction$2(observerOrNext) || error || complete
2089
+ var tapObserver = isFunction$3(observerOrNext) || error || complete
2090
2090
  ?
2091
2091
  { next: observerOrNext, error: error, complete: complete }
2092
2092
  : observerOrNext;
@@ -2631,7 +2631,7 @@ var Neurosity = (function (exports) {
2631
2631
  * @returns the `globalThis` object for the given environment.
2632
2632
  * @public
2633
2633
  */
2634
- function getGlobal() {
2634
+ function getGlobal$1() {
2635
2635
  if (typeof self !== 'undefined') {
2636
2636
  return self;
2637
2637
  }
@@ -2660,7 +2660,7 @@ var Neurosity = (function (exports) {
2660
2660
  * See the License for the specific language governing permissions and
2661
2661
  * limitations under the License.
2662
2662
  */
2663
- const getDefaultsFromGlobal = () => getGlobal().__FIREBASE_DEFAULTS__;
2663
+ const getDefaultsFromGlobal = () => getGlobal$1().__FIREBASE_DEFAULTS__;
2664
2664
  /**
2665
2665
  * Attempt to read defaults from a JSON string provided to
2666
2666
  * process(.)env(.)__FIREBASE_DEFAULTS__ or a JSON file whose path is in
@@ -3130,7 +3130,7 @@ var Neurosity = (function (exports) {
3130
3130
  *
3131
3131
  * @return true if ReactNative environment is detected.
3132
3132
  */
3133
- function isReactNative() {
3133
+ function isReactNative$1() {
3134
3134
  return (typeof navigator === 'object' && navigator['product'] === 'ReactNative');
3135
3135
  }
3136
3136
  /** Detects Internet Explorer. */
@@ -9829,7 +9829,7 @@ var Neurosity = (function (exports) {
9829
9829
  if (isMobileCordova()) {
9830
9830
  stats['framework.cordova'] = 1;
9831
9831
  }
9832
- else if (isReactNative()) {
9832
+ else if (isReactNative$1()) {
9833
9833
  stats['framework.reactnative'] = 1;
9834
9834
  }
9835
9835
  this.reportStats(stats);
@@ -19390,7 +19390,7 @@ var Neurosity = (function (exports) {
19390
19390
  this.longDelay = longDelay;
19391
19391
  // Internal error when improperly initialized.
19392
19392
  debugAssert(longDelay > shortDelay, 'Short delay should be less than long delay!');
19393
- this.isMobile = isMobileCordova() || isReactNative();
19393
+ this.isMobile = isMobileCordova() || isReactNative$1();
19394
19394
  }
19395
19395
  get() {
19396
19396
  if (!_isOnline()) {
@@ -30523,8 +30523,9 @@ var Neurosity = (function (exports) {
30523
30523
  registerVersion(F, M, "esm2020");
30524
30524
  }();
30525
30525
 
30526
+ const productionApiKey = ["AIza", "SyB0TkZ83Fj0CIzn8AAmE-Osc92s3ER8hy8"].join("");
30526
30527
  const config = {
30527
- apiKey: "AIzaSyB0TkZ83Fj0CIzn8AAmE-Osc92s3ER8hy8",
30528
+ apiKey: productionApiKey,
30528
30529
  authDomain: "neurosity-device.firebaseapp.com",
30529
30530
  databaseURL: "https://neurosity-device.firebaseio.com",
30530
30531
  projectId: "neurosity-device",
@@ -31163,19 +31164,21 @@ var Neurosity = (function (exports) {
31163
31164
  : `metrics/${metric}/${labels[0]}`;
31164
31165
  offData(child, "value", listener);
31165
31166
  },
31166
- disconnect() {
31167
- remove(clientRef);
31167
+ async disconnect() {
31168
31168
  listenersToRemove.forEach((removeListener) => {
31169
31169
  removeListener();
31170
31170
  });
31171
- subscriptionManager
31172
- .toList()
31173
- .filter((subscription) => subscription.clientId === clientId)
31174
- .forEach((subscription) => {
31175
- const childPath = `subscriptions/${subscription.id}`;
31176
- const subscriptionRef = child(deviceRef, childPath);
31177
- remove(subscriptionRef);
31178
- });
31171
+ return await Promise.all([
31172
+ remove(clientRef),
31173
+ ...subscriptionManager
31174
+ .toList()
31175
+ .filter((subscription) => subscription.clientId === clientId)
31176
+ .map((subscription) => {
31177
+ const childPath = `subscriptions/${subscription.id}`;
31178
+ const subscriptionRef = child(deviceRef, childPath);
31179
+ return remove(subscriptionRef);
31180
+ })
31181
+ ]);
31179
31182
  }
31180
31183
  };
31181
31184
  };
@@ -31258,8 +31261,8 @@ var Neurosity = (function (exports) {
31258
31261
  }
31259
31262
  return token;
31260
31263
  }
31261
- disconnect() {
31262
- this.deviceStore.disconnect();
31264
+ async disconnect() {
31265
+ await this.deviceStore.disconnect();
31263
31266
  }
31264
31267
  }
31265
31268
  FirebaseDevice.serverType = "firebase";
@@ -31542,9 +31545,14 @@ var Neurosity = (function (exports) {
31542
31545
  this.firebaseUser.onUserClaimsChange().subscribe((userClaims) => {
31543
31546
  this.userClaims = userClaims;
31544
31547
  });
31545
- this.onDeviceChange().subscribe((device) => {
31548
+ this.onDeviceChange().subscribe(async (device) => {
31546
31549
  if (this.firebaseDevice) {
31547
- this.firebaseDevice.disconnect();
31550
+ try {
31551
+ await this.firebaseDevice.disconnect();
31552
+ }
31553
+ catch (error) {
31554
+ console.error("Error disconnecting from device", error);
31555
+ }
31548
31556
  }
31549
31557
  if (!device) {
31550
31558
  return;
@@ -31596,6 +31604,14 @@ var Neurosity = (function (exports) {
31596
31604
  return await this.firebaseDevice.dispatchAction(action);
31597
31605
  }
31598
31606
  async disconnect() {
31607
+ if (this.firebaseDevice) {
31608
+ try {
31609
+ await this.firebaseDevice.disconnect();
31610
+ }
31611
+ catch (error) {
31612
+ console.error("Error disconnecting from device", error);
31613
+ }
31614
+ }
31599
31615
  return this.firebaseApp.disconnect();
31600
31616
  }
31601
31617
  async getInfo() {
@@ -31618,7 +31634,12 @@ var Neurosity = (function (exports) {
31618
31634
  }
31619
31635
  async logout() {
31620
31636
  if (this.firebaseDevice) {
31621
- this.firebaseDevice.disconnect();
31637
+ try {
31638
+ await this.firebaseDevice.disconnect();
31639
+ }
31640
+ catch (error) {
31641
+ console.error("Error disconnecting from device", error);
31642
+ }
31622
31643
  }
31623
31644
  return await this.firebaseUser.logout();
31624
31645
  }
@@ -31820,6 +31841,7 @@ var Neurosity = (function (exports) {
31820
31841
  calm: "7d47617d-a60a-41d1-8df6-cfb78d02ffeb",
31821
31842
  accelerometer: "84501dee-8665-4073-b111-bdecd69fb489",
31822
31843
  signalQuality: "cf28ed0c-20cd-48ed-93c5-ee2fb265099a",
31844
+ signalQualityV2: "902ac5f3-ce59-4c11-94fa-437e89f90630",
31823
31845
  raw: "009cf0bb-b68d-4af1-a0e5-625f2eb964a6",
31824
31846
  rawUnfiltered: "5472432e-3313-4169-add8-6fcb29accb0e",
31825
31847
  psd: "d6684fb0-8518-40c0-8e88-4634e762435d",
@@ -31880,20 +31902,14 @@ var Neurosity = (function (exports) {
31880
31902
  const metrics = {
31881
31903
  kinesis,
31882
31904
  predictions: kinesis,
31883
- channelAnalysis: channelNames,
31884
31905
  signalQuality: channelNames,
31885
- status: {
31886
- state: {},
31887
- battery: {},
31888
- charging: {},
31889
- connected: {},
31890
- connectedSince: {},
31891
- connectedLast: {},
31892
- updatingProgress: {},
31893
- simulate: {},
31894
- ssid: {}
31906
+ signalQualityV2: {
31907
+ timestamp: {},
31908
+ overall: {},
31909
+ byChannel: {}
31895
31910
  },
31896
31911
  accelerometer: {
31912
+ timestamp: {},
31897
31913
  acceleration: {},
31898
31914
  inclination: {},
31899
31915
  orientation: {},
@@ -32331,6 +32347,13 @@ var Neurosity = (function (exports) {
32331
32347
  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(", ")}.`);
32332
32348
  }
32333
32349
 
32350
+ /**
32351
+ * Create a bound version of a function with a specified `this` context
32352
+ *
32353
+ * @param {Function} fn - The function to bind
32354
+ * @param {*} thisArg - The value to be passed as the `this` parameter
32355
+ * @returns {Function} A new function that will call the original function with the specified `this` context
32356
+ */
32334
32357
  function bind(fn, thisArg) {
32335
32358
  return function wrap() {
32336
32359
  return fn.apply(thisArg, arguments);
@@ -32339,29 +32362,30 @@ var Neurosity = (function (exports) {
32339
32362
 
32340
32363
  // utils is a library of generic helper functions non-specific to axios
32341
32364
 
32342
- const {toString} = Object.prototype;
32343
- const {getPrototypeOf} = Object;
32365
+ const { toString } = Object.prototype;
32366
+ const { getPrototypeOf } = Object;
32367
+ const { iterator, toStringTag } = Symbol;
32344
32368
 
32345
- const kindOf = (cache => thing => {
32346
- const str = toString.call(thing);
32347
- return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
32369
+ const kindOf = ((cache) => (thing) => {
32370
+ const str = toString.call(thing);
32371
+ return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
32348
32372
  })(Object.create(null));
32349
32373
 
32350
32374
  const kindOfTest = (type) => {
32351
32375
  type = type.toLowerCase();
32352
- return (thing) => kindOf(thing) === type
32376
+ return (thing) => kindOf(thing) === type;
32353
32377
  };
32354
32378
 
32355
- const typeOfTest = type => thing => typeof thing === type;
32379
+ const typeOfTest = (type) => (thing) => typeof thing === type;
32356
32380
 
32357
32381
  /**
32358
- * Determine if a value is an Array
32382
+ * Determine if a value is a non-null object
32359
32383
  *
32360
32384
  * @param {Object} val The value to test
32361
32385
  *
32362
32386
  * @returns {boolean} True if value is an Array, otherwise false
32363
32387
  */
32364
- const {isArray} = Array;
32388
+ const { isArray } = Array;
32365
32389
 
32366
32390
  /**
32367
32391
  * Determine if a value is undefined
@@ -32380,8 +32404,14 @@ var Neurosity = (function (exports) {
32380
32404
  * @returns {boolean} True if value is a Buffer, otherwise false
32381
32405
  */
32382
32406
  function isBuffer(val) {
32383
- return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
32384
- && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
32407
+ return (
32408
+ val !== null &&
32409
+ !isUndefined(val) &&
32410
+ val.constructor !== null &&
32411
+ !isUndefined(val.constructor) &&
32412
+ isFunction$2(val.constructor.isBuffer) &&
32413
+ val.constructor.isBuffer(val)
32414
+ );
32385
32415
  }
32386
32416
 
32387
32417
  /**
@@ -32393,7 +32423,6 @@ var Neurosity = (function (exports) {
32393
32423
  */
32394
32424
  const isArrayBuffer = kindOfTest('ArrayBuffer');
32395
32425
 
32396
-
32397
32426
  /**
32398
32427
  * Determine if a value is a view on an ArrayBuffer
32399
32428
  *
@@ -32403,10 +32432,10 @@ var Neurosity = (function (exports) {
32403
32432
  */
32404
32433
  function isArrayBufferView(val) {
32405
32434
  let result;
32406
- if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
32435
+ if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
32407
32436
  result = ArrayBuffer.isView(val);
32408
32437
  } else {
32409
- result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
32438
+ result = val && val.buffer && isArrayBuffer(val.buffer);
32410
32439
  }
32411
32440
  return result;
32412
32441
  }
@@ -32426,7 +32455,7 @@ var Neurosity = (function (exports) {
32426
32455
  * @param {*} val The value to test
32427
32456
  * @returns {boolean} True if value is a Function, otherwise false
32428
32457
  */
32429
- const isFunction$1 = typeOfTest('function');
32458
+ const isFunction$2 = typeOfTest('function');
32430
32459
 
32431
32460
  /**
32432
32461
  * Determine if a value is a Number
@@ -32452,7 +32481,7 @@ var Neurosity = (function (exports) {
32452
32481
  * @param {*} thing The value to test
32453
32482
  * @returns {boolean} True if value is a Boolean, otherwise false
32454
32483
  */
32455
- const isBoolean = thing => thing === true || thing === false;
32484
+ const isBoolean = (thing) => thing === true || thing === false;
32456
32485
 
32457
32486
  /**
32458
32487
  * Determine if a value is a plain Object
@@ -32467,7 +32496,34 @@ var Neurosity = (function (exports) {
32467
32496
  }
32468
32497
 
32469
32498
  const prototype = getPrototypeOf(val);
32470
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
32499
+ return (
32500
+ (prototype === null ||
32501
+ prototype === Object.prototype ||
32502
+ Object.getPrototypeOf(prototype) === null) &&
32503
+ !(toStringTag in val) &&
32504
+ !(iterator in val)
32505
+ );
32506
+ };
32507
+
32508
+ /**
32509
+ * Determine if a value is an empty object (safely handles Buffers)
32510
+ *
32511
+ * @param {*} val The value to test
32512
+ *
32513
+ * @returns {boolean} True if value is an empty object, otherwise false
32514
+ */
32515
+ const isEmptyObject = (val) => {
32516
+ // Early return for non-objects or Buffers to prevent RangeError
32517
+ if (!isObject$1(val) || isBuffer(val)) {
32518
+ return false;
32519
+ }
32520
+
32521
+ try {
32522
+ return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
32523
+ } catch (e) {
32524
+ // Fallback for any other objects that might cause RangeError with Object.keys()
32525
+ return false;
32526
+ }
32471
32527
  };
32472
32528
 
32473
32529
  /**
@@ -32488,6 +32544,31 @@ var Neurosity = (function (exports) {
32488
32544
  */
32489
32545
  const isFile = kindOfTest('File');
32490
32546
 
32547
+ /**
32548
+ * Determine if a value is a React Native Blob
32549
+ * React Native "blob": an object with a `uri` attribute. Optionally, it can
32550
+ * also have a `name` and `type` attribute to specify filename and content type
32551
+ *
32552
+ * @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71
32553
+ *
32554
+ * @param {*} value The value to test
32555
+ *
32556
+ * @returns {boolean} True if value is a React Native Blob, otherwise false
32557
+ */
32558
+ const isReactNativeBlob = (value) => {
32559
+ return !!(value && typeof value.uri !== 'undefined');
32560
+ };
32561
+
32562
+ /**
32563
+ * Determine if environment is React Native
32564
+ * ReactNative `FormData` has a non-standard `getParts()` method
32565
+ *
32566
+ * @param {*} formData The formData to test
32567
+ *
32568
+ * @returns {boolean} True if environment is React Native, otherwise false
32569
+ */
32570
+ const isReactNative = (formData) => formData && typeof formData.getParts !== 'undefined';
32571
+
32491
32572
  /**
32492
32573
  * Determine if a value is a Blob
32493
32574
  *
@@ -32513,7 +32594,7 @@ var Neurosity = (function (exports) {
32513
32594
  *
32514
32595
  * @returns {boolean} True if value is a Stream, otherwise false
32515
32596
  */
32516
- const isStream = (val) => isObject$1(val) && isFunction$1(val.pipe);
32597
+ const isStream = (val) => isObject$1(val) && isFunction$2(val.pipe);
32517
32598
 
32518
32599
  /**
32519
32600
  * Determine if a value is a FormData
@@ -32522,17 +32603,28 @@ var Neurosity = (function (exports) {
32522
32603
  *
32523
32604
  * @returns {boolean} True if value is an FormData, otherwise false
32524
32605
  */
32606
+ function getGlobal() {
32607
+ if (typeof globalThis !== 'undefined') return globalThis;
32608
+ if (typeof self !== 'undefined') return self;
32609
+ if (typeof window !== 'undefined') return window;
32610
+ if (typeof global !== 'undefined') return global;
32611
+ return {};
32612
+ }
32613
+
32614
+ const G = getGlobal();
32615
+ const FormDataCtor = typeof G.FormData !== 'undefined' ? G.FormData : undefined;
32616
+
32525
32617
  const isFormData = (thing) => {
32526
32618
  let kind;
32527
32619
  return thing && (
32528
- (typeof FormData === 'function' && thing instanceof FormData) || (
32529
- isFunction$1(thing.append) && (
32620
+ (FormDataCtor && thing instanceof FormDataCtor) || (
32621
+ isFunction$2(thing.append) && (
32530
32622
  (kind = kindOf(thing)) === 'formdata' ||
32531
32623
  // detect form-data instance
32532
- (kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
32624
+ (kind === 'object' && isFunction$2(thing.toString) && thing.toString() === '[object FormData]')
32533
32625
  )
32534
32626
  )
32535
- )
32627
+ );
32536
32628
  };
32537
32629
 
32538
32630
  /**
@@ -32544,6 +32636,13 @@ var Neurosity = (function (exports) {
32544
32636
  */
32545
32637
  const isURLSearchParams = kindOfTest('URLSearchParams');
32546
32638
 
32639
+ const [isReadableStream, isRequest, isResponse, isHeaders] = [
32640
+ 'ReadableStream',
32641
+ 'Request',
32642
+ 'Response',
32643
+ 'Headers',
32644
+ ].map(kindOfTest);
32645
+
32547
32646
  /**
32548
32647
  * Trim excess whitespace off the beginning and end of a string
32549
32648
  *
@@ -32551,9 +32650,9 @@ var Neurosity = (function (exports) {
32551
32650
  *
32552
32651
  * @returns {String} The String freed of excess whitespace
32553
32652
  */
32554
- const trim = (str) => str.trim ?
32555
- str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
32556
-
32653
+ const trim = (str) => {
32654
+ return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
32655
+ };
32557
32656
  /**
32558
32657
  * Iterate over an Array or an Object invoking a function for each item.
32559
32658
  *
@@ -32563,13 +32662,14 @@ var Neurosity = (function (exports) {
32563
32662
  * If 'obj' is an Object callback will be called passing
32564
32663
  * the value, key, and complete object for each property.
32565
32664
  *
32566
- * @param {Object|Array} obj The object to iterate
32665
+ * @param {Object|Array<unknown>} obj The object to iterate
32567
32666
  * @param {Function} fn The callback to invoke for each item
32568
32667
  *
32569
- * @param {Boolean} [allOwnKeys = false]
32668
+ * @param {Object} [options]
32669
+ * @param {Boolean} [options.allOwnKeys = false]
32570
32670
  * @returns {any}
32571
32671
  */
32572
- function forEach(obj, fn, {allOwnKeys = false} = {}) {
32672
+ function forEach(obj, fn, { allOwnKeys = false } = {}) {
32573
32673
  // Don't bother if no value provided
32574
32674
  if (obj === null || typeof obj === 'undefined') {
32575
32675
  return;
@@ -32590,6 +32690,11 @@ var Neurosity = (function (exports) {
32590
32690
  fn.call(null, obj[i], i, obj);
32591
32691
  }
32592
32692
  } else {
32693
+ // Buffer check
32694
+ if (isBuffer(obj)) {
32695
+ return;
32696
+ }
32697
+
32593
32698
  // Iterate over object keys
32594
32699
  const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
32595
32700
  const len = keys.length;
@@ -32602,7 +32707,19 @@ var Neurosity = (function (exports) {
32602
32707
  }
32603
32708
  }
32604
32709
 
32710
+ /**
32711
+ * Finds a key in an object, case-insensitive, returning the actual key name.
32712
+ * Returns null if the object is a Buffer or if no match is found.
32713
+ *
32714
+ * @param {Object} obj - The object to search.
32715
+ * @param {string} key - The key to find (case-insensitive).
32716
+ * @returns {?string} The actual key name if found, otherwise null.
32717
+ */
32605
32718
  function findKey(obj, key) {
32719
+ if (isBuffer(obj)) {
32720
+ return null;
32721
+ }
32722
+
32606
32723
  key = key.toLowerCase();
32607
32724
  const keys = Object.keys(obj);
32608
32725
  let i = keys.length;
@@ -32618,8 +32735,8 @@ var Neurosity = (function (exports) {
32618
32735
 
32619
32736
  const _global = (() => {
32620
32737
  /*eslint no-undef:0*/
32621
- if (typeof globalThis !== "undefined") return globalThis;
32622
- return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global)
32738
+ if (typeof globalThis !== 'undefined') return globalThis;
32739
+ return typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : global;
32623
32740
  })();
32624
32741
 
32625
32742
  const isContextDefined = (context) => !isUndefined(context) && context !== _global;
@@ -32634,7 +32751,7 @@ var Neurosity = (function (exports) {
32634
32751
  * Example:
32635
32752
  *
32636
32753
  * ```js
32637
- * var result = merge({foo: 123}, {foo: 456});
32754
+ * const result = merge({foo: 123}, {foo: 456});
32638
32755
  * console.log(result.foo); // outputs 456
32639
32756
  * ```
32640
32757
  *
@@ -32643,17 +32760,22 @@ var Neurosity = (function (exports) {
32643
32760
  * @returns {Object} Result of all merge properties
32644
32761
  */
32645
32762
  function merge(/* obj1, obj2, obj3, ... */) {
32646
- const {caseless} = isContextDefined(this) && this || {};
32763
+ const { caseless, skipUndefined } = (isContextDefined(this) && this) || {};
32647
32764
  const result = {};
32648
32765
  const assignValue = (val, key) => {
32649
- const targetKey = caseless && findKey(result, key) || key;
32766
+ // Skip dangerous property names to prevent prototype pollution
32767
+ if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
32768
+ return;
32769
+ }
32770
+
32771
+ const targetKey = (caseless && findKey(result, key)) || key;
32650
32772
  if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
32651
32773
  result[targetKey] = merge(result[targetKey], val);
32652
32774
  } else if (isPlainObject(val)) {
32653
32775
  result[targetKey] = merge({}, val);
32654
32776
  } else if (isArray(val)) {
32655
32777
  result[targetKey] = val.slice();
32656
- } else {
32778
+ } else if (!skipUndefined || !isUndefined(val)) {
32657
32779
  result[targetKey] = val;
32658
32780
  }
32659
32781
  };
@@ -32671,17 +32793,32 @@ var Neurosity = (function (exports) {
32671
32793
  * @param {Object} b The object to copy properties from
32672
32794
  * @param {Object} thisArg The object to bind function to
32673
32795
  *
32674
- * @param {Boolean} [allOwnKeys]
32796
+ * @param {Object} [options]
32797
+ * @param {Boolean} [options.allOwnKeys]
32675
32798
  * @returns {Object} The resulting value of object a
32676
32799
  */
32677
- const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
32678
- forEach(b, (val, key) => {
32679
- if (thisArg && isFunction$1(val)) {
32680
- a[key] = bind(val, thisArg);
32681
- } else {
32682
- a[key] = val;
32683
- }
32684
- }, {allOwnKeys});
32800
+ const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
32801
+ forEach(
32802
+ b,
32803
+ (val, key) => {
32804
+ if (thisArg && isFunction$2(val)) {
32805
+ Object.defineProperty(a, key, {
32806
+ value: bind(val, thisArg),
32807
+ writable: true,
32808
+ enumerable: true,
32809
+ configurable: true,
32810
+ });
32811
+ } else {
32812
+ Object.defineProperty(a, key, {
32813
+ value: val,
32814
+ writable: true,
32815
+ enumerable: true,
32816
+ configurable: true,
32817
+ });
32818
+ }
32819
+ },
32820
+ { allOwnKeys }
32821
+ );
32685
32822
  return a;
32686
32823
  };
32687
32824
 
@@ -32693,7 +32830,7 @@ var Neurosity = (function (exports) {
32693
32830
  * @returns {string} content value without BOM
32694
32831
  */
32695
32832
  const stripBOM = (content) => {
32696
- if (content.charCodeAt(0) === 0xFEFF) {
32833
+ if (content.charCodeAt(0) === 0xfeff) {
32697
32834
  content = content.slice(1);
32698
32835
  }
32699
32836
  return content;
@@ -32710,9 +32847,14 @@ var Neurosity = (function (exports) {
32710
32847
  */
32711
32848
  const inherits = (constructor, superConstructor, props, descriptors) => {
32712
32849
  constructor.prototype = Object.create(superConstructor.prototype, descriptors);
32713
- constructor.prototype.constructor = constructor;
32850
+ Object.defineProperty(constructor.prototype, 'constructor', {
32851
+ value: constructor,
32852
+ writable: true,
32853
+ enumerable: false,
32854
+ configurable: true,
32855
+ });
32714
32856
  Object.defineProperty(constructor, 'super', {
32715
- value: superConstructor.prototype
32857
+ value: superConstructor.prototype,
32716
32858
  });
32717
32859
  props && Object.assign(constructor.prototype, props);
32718
32860
  };
@@ -32771,7 +32913,6 @@ var Neurosity = (function (exports) {
32771
32913
  return lastIndex !== -1 && lastIndex === position;
32772
32914
  };
32773
32915
 
32774
-
32775
32916
  /**
32776
32917
  * Returns new array from array like object or null if failed
32777
32918
  *
@@ -32800,9 +32941,9 @@ var Neurosity = (function (exports) {
32800
32941
  * @returns {Array}
32801
32942
  */
32802
32943
  // eslint-disable-next-line func-names
32803
- const isTypedArray = (TypedArray => {
32944
+ const isTypedArray = ((TypedArray) => {
32804
32945
  // eslint-disable-next-line func-names
32805
- return thing => {
32946
+ return (thing) => {
32806
32947
  return TypedArray && thing instanceof TypedArray;
32807
32948
  };
32808
32949
  })(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
@@ -32816,13 +32957,13 @@ var Neurosity = (function (exports) {
32816
32957
  * @returns {void}
32817
32958
  */
32818
32959
  const forEachEntry = (obj, fn) => {
32819
- const generator = obj && obj[Symbol.iterator];
32960
+ const generator = obj && obj[iterator];
32820
32961
 
32821
- const iterator = generator.call(obj);
32962
+ const _iterator = generator.call(obj);
32822
32963
 
32823
32964
  let result;
32824
32965
 
32825
- while ((result = iterator.next()) && !result.done) {
32966
+ while ((result = _iterator.next()) && !result.done) {
32826
32967
  const pair = result.value;
32827
32968
  fn.call(obj, pair[0], pair[1]);
32828
32969
  }
@@ -32850,16 +32991,18 @@ var Neurosity = (function (exports) {
32850
32991
  /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
32851
32992
  const isHTMLForm = kindOfTest('HTMLFormElement');
32852
32993
 
32853
- const toCamelCase = str => {
32854
- return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,
32855
- function replacer(m, p1, p2) {
32856
- return p1.toUpperCase() + p2;
32857
- }
32858
- );
32994
+ const toCamelCase = (str) => {
32995
+ return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
32996
+ return p1.toUpperCase() + p2;
32997
+ });
32859
32998
  };
32860
32999
 
32861
33000
  /* Creating a function that will check if an object has a property. */
32862
- const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
33001
+ const hasOwnProperty = (
33002
+ ({ hasOwnProperty }) =>
33003
+ (obj, prop) =>
33004
+ hasOwnProperty.call(obj, prop)
33005
+ )(Object.prototype);
32863
33006
 
32864
33007
  /**
32865
33008
  * Determine if a value is a RegExp object
@@ -32892,13 +33035,13 @@ var Neurosity = (function (exports) {
32892
33035
  const freezeMethods = (obj) => {
32893
33036
  reduceDescriptors(obj, (descriptor, name) => {
32894
33037
  // skip restricted props in strict mode
32895
- if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
33038
+ if (isFunction$2(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
32896
33039
  return false;
32897
33040
  }
32898
33041
 
32899
33042
  const value = obj[name];
32900
33043
 
32901
- if (!isFunction$1(value)) return;
33044
+ if (!isFunction$2(value)) return;
32902
33045
 
32903
33046
  descriptor.enumerable = false;
32904
33047
 
@@ -32909,17 +33052,25 @@ var Neurosity = (function (exports) {
32909
33052
 
32910
33053
  if (!descriptor.set) {
32911
33054
  descriptor.set = () => {
32912
- throw Error('Can not rewrite read-only method \'' + name + '\'');
33055
+ throw Error("Can not rewrite read-only method '" + name + "'");
32913
33056
  };
32914
33057
  }
32915
33058
  });
32916
33059
  };
32917
33060
 
33061
+ /**
33062
+ * Converts an array or a delimited string into an object set with values as keys and true as values.
33063
+ * Useful for fast membership checks.
33064
+ *
33065
+ * @param {Array|string} arrayOrString - The array or string to convert.
33066
+ * @param {string} delimiter - The delimiter to use if input is a string.
33067
+ * @returns {Object} An object with keys from the array or string, values set to true.
33068
+ */
32918
33069
  const toObjectSet = (arrayOrString, delimiter) => {
32919
33070
  const obj = {};
32920
33071
 
32921
33072
  const define = (arr) => {
32922
- arr.forEach(value => {
33073
+ arr.forEach((value) => {
32923
33074
  obj[value] = true;
32924
33075
  });
32925
33076
  };
@@ -32932,28 +33083,7 @@ var Neurosity = (function (exports) {
32932
33083
  const noop = () => {};
32933
33084
 
32934
33085
  const toFiniteNumber = (value, defaultValue) => {
32935
- value = +value;
32936
- return Number.isFinite(value) ? value : defaultValue;
32937
- };
32938
-
32939
- const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
32940
-
32941
- const DIGIT = '0123456789';
32942
-
32943
- const ALPHABET = {
32944
- DIGIT,
32945
- ALPHA,
32946
- ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
32947
- };
32948
-
32949
- const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
32950
- let str = '';
32951
- const {length} = alphabet;
32952
- while (size--) {
32953
- str += alphabet[Math.random() * length|0];
32954
- }
32955
-
32956
- return str;
33086
+ return value != null && Number.isFinite((value = +value)) ? value : defaultValue;
32957
33087
  };
32958
33088
 
32959
33089
  /**
@@ -32964,20 +33094,35 @@ var Neurosity = (function (exports) {
32964
33094
  * @returns {boolean}
32965
33095
  */
32966
33096
  function isSpecCompliantForm(thing) {
32967
- return !!(thing && isFunction$1(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
33097
+ return !!(
33098
+ thing &&
33099
+ isFunction$2(thing.append) &&
33100
+ thing[toStringTag] === 'FormData' &&
33101
+ thing[iterator]
33102
+ );
32968
33103
  }
32969
33104
 
33105
+ /**
33106
+ * Recursively converts an object to a JSON-compatible object, handling circular references and Buffers.
33107
+ *
33108
+ * @param {Object} obj - The object to convert.
33109
+ * @returns {Object} The JSON-compatible object.
33110
+ */
32970
33111
  const toJSONObject = (obj) => {
32971
33112
  const stack = new Array(10);
32972
33113
 
32973
33114
  const visit = (source, i) => {
32974
-
32975
33115
  if (isObject$1(source)) {
32976
33116
  if (stack.indexOf(source) >= 0) {
32977
33117
  return;
32978
33118
  }
32979
33119
 
32980
- if(!('toJSON' in source)) {
33120
+ //Buffer check
33121
+ if (isBuffer(source)) {
33122
+ return source;
33123
+ }
33124
+
33125
+ if (!('toJSON' in source)) {
32981
33126
  stack[i] = source;
32982
33127
  const target = isArray(source) ? [] : {};
32983
33128
 
@@ -32998,10 +33143,76 @@ var Neurosity = (function (exports) {
32998
33143
  return visit(obj, 0);
32999
33144
  };
33000
33145
 
33146
+ /**
33147
+ * Determines if a value is an async function.
33148
+ *
33149
+ * @param {*} thing - The value to test.
33150
+ * @returns {boolean} True if value is an async function, otherwise false.
33151
+ */
33001
33152
  const isAsyncFn = kindOfTest('AsyncFunction');
33002
33153
 
33154
+ /**
33155
+ * Determines if a value is thenable (has then and catch methods).
33156
+ *
33157
+ * @param {*} thing - The value to test.
33158
+ * @returns {boolean} True if value is thenable, otherwise false.
33159
+ */
33003
33160
  const isThenable = (thing) =>
33004
- thing && (isObject$1(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
33161
+ thing &&
33162
+ (isObject$1(thing) || isFunction$2(thing)) &&
33163
+ isFunction$2(thing.then) &&
33164
+ isFunction$2(thing.catch);
33165
+
33166
+ // original code
33167
+ // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
33168
+
33169
+ /**
33170
+ * Provides a cross-platform setImmediate implementation.
33171
+ * Uses native setImmediate if available, otherwise falls back to postMessage or setTimeout.
33172
+ *
33173
+ * @param {boolean} setImmediateSupported - Whether setImmediate is supported.
33174
+ * @param {boolean} postMessageSupported - Whether postMessage is supported.
33175
+ * @returns {Function} A function to schedule a callback asynchronously.
33176
+ */
33177
+ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
33178
+ if (setImmediateSupported) {
33179
+ return setImmediate;
33180
+ }
33181
+
33182
+ return postMessageSupported
33183
+ ? ((token, callbacks) => {
33184
+ _global.addEventListener(
33185
+ 'message',
33186
+ ({ source, data }) => {
33187
+ if (source === _global && data === token) {
33188
+ callbacks.length && callbacks.shift()();
33189
+ }
33190
+ },
33191
+ false
33192
+ );
33193
+
33194
+ return (cb) => {
33195
+ callbacks.push(cb);
33196
+ _global.postMessage(token, '*');
33197
+ };
33198
+ })(`axios@${Math.random()}`, [])
33199
+ : (cb) => setTimeout(cb);
33200
+ })(typeof setImmediate === 'function', isFunction$2(_global.postMessage));
33201
+
33202
+ /**
33203
+ * Schedules a microtask or asynchronous callback as soon as possible.
33204
+ * Uses queueMicrotask if available, otherwise falls back to process.nextTick or _setImmediate.
33205
+ *
33206
+ * @type {Function}
33207
+ */
33208
+ const asap =
33209
+ typeof queueMicrotask !== 'undefined'
33210
+ ? queueMicrotask.bind(_global)
33211
+ : (typeof process !== 'undefined' && process.nextTick) || _setImmediate;
33212
+
33213
+ // *********************
33214
+
33215
+ const isIterable = (thing) => thing != null && isFunction$2(thing[iterator]);
33005
33216
 
33006
33217
  var utils$1 = {
33007
33218
  isArray,
@@ -33014,12 +33225,19 @@ var Neurosity = (function (exports) {
33014
33225
  isBoolean,
33015
33226
  isObject: isObject$1,
33016
33227
  isPlainObject,
33228
+ isEmptyObject,
33229
+ isReadableStream,
33230
+ isRequest,
33231
+ isResponse,
33232
+ isHeaders,
33017
33233
  isUndefined,
33018
33234
  isDate,
33019
33235
  isFile,
33236
+ isReactNativeBlob,
33237
+ isReactNative,
33020
33238
  isBlob,
33021
33239
  isRegExp,
33022
- isFunction: isFunction$1,
33240
+ isFunction: isFunction$2,
33023
33241
  isStream,
33024
33242
  isURLSearchParams,
33025
33243
  isTypedArray,
@@ -33049,44 +33267,66 @@ var Neurosity = (function (exports) {
33049
33267
  findKey,
33050
33268
  global: _global,
33051
33269
  isContextDefined,
33052
- ALPHABET,
33053
- generateString,
33054
33270
  isSpecCompliantForm,
33055
33271
  toJSONObject,
33056
33272
  isAsyncFn,
33057
- isThenable
33273
+ isThenable,
33274
+ setImmediate: _setImmediate,
33275
+ asap,
33276
+ isIterable,
33058
33277
  };
33059
33278
 
33060
- /**
33061
- * Create an Error with the specified message, config, error code, request and response.
33062
- *
33063
- * @param {string} message The error message.
33064
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
33065
- * @param {Object} [config] The config.
33066
- * @param {Object} [request] The request.
33067
- * @param {Object} [response] The response.
33068
- *
33069
- * @returns {Error} The created error.
33070
- */
33071
- function AxiosError$1(message, code, config, request, response) {
33072
- Error.call(this);
33279
+ let AxiosError$1 = class AxiosError extends Error {
33280
+ static from(error, code, config, request, response, customProps) {
33281
+ const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
33282
+ axiosError.cause = error;
33283
+ axiosError.name = error.name;
33073
33284
 
33074
- if (Error.captureStackTrace) {
33075
- Error.captureStackTrace(this, this.constructor);
33076
- } else {
33077
- this.stack = (new Error()).stack;
33285
+ // Preserve status from the original error if not already set from response
33286
+ if (error.status != null && axiosError.status == null) {
33287
+ axiosError.status = error.status;
33288
+ }
33289
+
33290
+ customProps && Object.assign(axiosError, customProps);
33291
+ return axiosError;
33078
33292
  }
33079
33293
 
33080
- this.message = message;
33081
- this.name = 'AxiosError';
33082
- code && (this.code = code);
33083
- config && (this.config = config);
33084
- request && (this.request = request);
33085
- response && (this.response = response);
33086
- }
33294
+ /**
33295
+ * Create an Error with the specified message, config, error code, request and response.
33296
+ *
33297
+ * @param {string} message The error message.
33298
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
33299
+ * @param {Object} [config] The config.
33300
+ * @param {Object} [request] The request.
33301
+ * @param {Object} [response] The response.
33302
+ *
33303
+ * @returns {Error} The created error.
33304
+ */
33305
+ constructor(message, code, config, request, response) {
33306
+ super(message);
33307
+
33308
+ // Make message enumerable to maintain backward compatibility
33309
+ // The native Error constructor sets message as non-enumerable,
33310
+ // but axios < v1.13.3 had it as enumerable
33311
+ Object.defineProperty(this, 'message', {
33312
+ value: message,
33313
+ enumerable: true,
33314
+ writable: true,
33315
+ configurable: true
33316
+ });
33317
+
33318
+ this.name = 'AxiosError';
33319
+ this.isAxiosError = true;
33320
+ code && (this.code = code);
33321
+ config && (this.config = config);
33322
+ request && (this.request = request);
33323
+ if (response) {
33324
+ this.response = response;
33325
+ this.status = response.status;
33326
+ }
33327
+ }
33087
33328
 
33088
- utils$1.inherits(AxiosError$1, Error, {
33089
- toJSON: function toJSON() {
33329
+ toJSON() {
33090
33330
  return {
33091
33331
  // Standard
33092
33332
  message: this.message,
@@ -33102,56 +33342,25 @@ var Neurosity = (function (exports) {
33102
33342
  // Axios
33103
33343
  config: utils$1.toJSONObject(this.config),
33104
33344
  code: this.code,
33105
- status: this.response && this.response.status ? this.response.status : null
33345
+ status: this.status,
33106
33346
  };
33107
33347
  }
33108
- });
33109
-
33110
- const prototype$1 = AxiosError$1.prototype;
33111
- const descriptors = {};
33112
-
33113
- [
33114
- 'ERR_BAD_OPTION_VALUE',
33115
- 'ERR_BAD_OPTION',
33116
- 'ECONNABORTED',
33117
- 'ETIMEDOUT',
33118
- 'ERR_NETWORK',
33119
- 'ERR_FR_TOO_MANY_REDIRECTS',
33120
- 'ERR_DEPRECATED',
33121
- 'ERR_BAD_RESPONSE',
33122
- 'ERR_BAD_REQUEST',
33123
- 'ERR_CANCELED',
33124
- 'ERR_NOT_SUPPORT',
33125
- 'ERR_INVALID_URL'
33126
- // eslint-disable-next-line func-names
33127
- ].forEach(code => {
33128
- descriptors[code] = {value: code};
33129
- });
33130
-
33131
- Object.defineProperties(AxiosError$1, descriptors);
33132
- Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
33133
-
33134
- // eslint-disable-next-line func-names
33135
- AxiosError$1.from = (error, code, config, request, response, customProps) => {
33136
- const axiosError = Object.create(prototype$1);
33137
-
33138
- utils$1.toFlatObject(error, axiosError, function filter(obj) {
33139
- return obj !== Error.prototype;
33140
- }, prop => {
33141
- return prop !== 'isAxiosError';
33142
- });
33143
-
33144
- AxiosError$1.call(axiosError, error.message, code, config, request, response);
33145
-
33146
- axiosError.cause = error;
33147
-
33148
- axiosError.name = error.name;
33149
-
33150
- customProps && Object.assign(axiosError, customProps);
33151
-
33152
- return axiosError;
33153
33348
  };
33154
33349
 
33350
+ // This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
33351
+ AxiosError$1.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
33352
+ AxiosError$1.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
33353
+ AxiosError$1.ECONNABORTED = 'ECONNABORTED';
33354
+ AxiosError$1.ETIMEDOUT = 'ETIMEDOUT';
33355
+ AxiosError$1.ERR_NETWORK = 'ERR_NETWORK';
33356
+ AxiosError$1.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
33357
+ AxiosError$1.ERR_DEPRECATED = 'ERR_DEPRECATED';
33358
+ AxiosError$1.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
33359
+ AxiosError$1.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
33360
+ AxiosError$1.ERR_CANCELED = 'ERR_CANCELED';
33361
+ AxiosError$1.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
33362
+ AxiosError$1.ERR_INVALID_URL = 'ERR_INVALID_URL';
33363
+
33155
33364
  // eslint-disable-next-line strict
33156
33365
  var httpAdapter = null;
33157
33366
 
@@ -33188,11 +33397,14 @@ var Neurosity = (function (exports) {
33188
33397
  */
33189
33398
  function renderKey(path, key, dots) {
33190
33399
  if (!path) return key;
33191
- return path.concat(key).map(function each(token, i) {
33192
- // eslint-disable-next-line no-param-reassign
33193
- token = removeBrackets(token);
33194
- return !dots && i ? '[' + token + ']' : token;
33195
- }).join(dots ? '.' : '');
33400
+ return path
33401
+ .concat(key)
33402
+ .map(function each(token, i) {
33403
+ // eslint-disable-next-line no-param-reassign
33404
+ token = removeBrackets(token);
33405
+ return !dots && i ? '[' + token + ']' : token;
33406
+ })
33407
+ .join(dots ? '.' : '');
33196
33408
  }
33197
33409
 
33198
33410
  /**
@@ -33242,21 +33454,26 @@ var Neurosity = (function (exports) {
33242
33454
  formData = formData || new (FormData)();
33243
33455
 
33244
33456
  // eslint-disable-next-line no-param-reassign
33245
- options = utils$1.toFlatObject(options, {
33246
- metaTokens: true,
33247
- dots: false,
33248
- indexes: false
33249
- }, false, function defined(option, source) {
33250
- // eslint-disable-next-line no-eq-null,eqeqeq
33251
- return !utils$1.isUndefined(source[option]);
33252
- });
33457
+ options = utils$1.toFlatObject(
33458
+ options,
33459
+ {
33460
+ metaTokens: true,
33461
+ dots: false,
33462
+ indexes: false,
33463
+ },
33464
+ false,
33465
+ function defined(option, source) {
33466
+ // eslint-disable-next-line no-eq-null,eqeqeq
33467
+ return !utils$1.isUndefined(source[option]);
33468
+ }
33469
+ );
33253
33470
 
33254
33471
  const metaTokens = options.metaTokens;
33255
33472
  // eslint-disable-next-line no-use-before-define
33256
33473
  const visitor = options.visitor || defaultVisitor;
33257
33474
  const dots = options.dots;
33258
33475
  const indexes = options.indexes;
33259
- const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
33476
+ const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
33260
33477
  const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
33261
33478
 
33262
33479
  if (!utils$1.isFunction(visitor)) {
@@ -33270,6 +33487,10 @@ var Neurosity = (function (exports) {
33270
33487
  return value.toISOString();
33271
33488
  }
33272
33489
 
33490
+ if (utils$1.isBoolean(value)) {
33491
+ return value.toString();
33492
+ }
33493
+
33273
33494
  if (!useBlob && utils$1.isBlob(value)) {
33274
33495
  throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
33275
33496
  }
@@ -33294,6 +33515,11 @@ var Neurosity = (function (exports) {
33294
33515
  function defaultVisitor(value, key, path) {
33295
33516
  let arr = value;
33296
33517
 
33518
+ if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
33519
+ formData.append(renderKey(path, key, dots), convertValue(value));
33520
+ return false;
33521
+ }
33522
+
33297
33523
  if (value && !path && typeof value === 'object') {
33298
33524
  if (utils$1.endsWith(key, '{}')) {
33299
33525
  // eslint-disable-next-line no-param-reassign
@@ -33302,17 +33528,22 @@ var Neurosity = (function (exports) {
33302
33528
  value = JSON.stringify(value);
33303
33529
  } else if (
33304
33530
  (utils$1.isArray(value) && isFlatArray(value)) ||
33305
- ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
33306
- )) {
33531
+ ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
33532
+ ) {
33307
33533
  // eslint-disable-next-line no-param-reassign
33308
33534
  key = removeBrackets(key);
33309
33535
 
33310
33536
  arr.forEach(function each(el, index) {
33311
- !(utils$1.isUndefined(el) || el === null) && formData.append(
33312
- // eslint-disable-next-line no-nested-ternary
33313
- indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
33314
- convertValue(el)
33315
- );
33537
+ !(utils$1.isUndefined(el) || el === null) &&
33538
+ formData.append(
33539
+ // eslint-disable-next-line no-nested-ternary
33540
+ indexes === true
33541
+ ? renderKey([key], index, dots)
33542
+ : indexes === null
33543
+ ? key
33544
+ : key + '[]',
33545
+ convertValue(el)
33546
+ );
33316
33547
  });
33317
33548
  return false;
33318
33549
  }
@@ -33332,7 +33563,7 @@ var Neurosity = (function (exports) {
33332
33563
  const exposedHelpers = Object.assign(predicates, {
33333
33564
  defaultVisitor,
33334
33565
  convertValue,
33335
- isVisitable
33566
+ isVisitable,
33336
33567
  });
33337
33568
 
33338
33569
  function build(value, path) {
@@ -33345,9 +33576,9 @@ var Neurosity = (function (exports) {
33345
33576
  stack.push(value);
33346
33577
 
33347
33578
  utils$1.forEach(value, function each(el, key) {
33348
- const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
33349
- formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers
33350
- );
33579
+ const result =
33580
+ !(utils$1.isUndefined(el) || el === null) &&
33581
+ visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
33351
33582
 
33352
33583
  if (result === true) {
33353
33584
  build(el, path ? path.concat(key) : [key]);
@@ -33382,7 +33613,7 @@ var Neurosity = (function (exports) {
33382
33613
  ')': '%29',
33383
33614
  '~': '%7E',
33384
33615
  '%20': '+',
33385
- '%00': '\x00'
33616
+ '%00': '\x00',
33386
33617
  };
33387
33618
  return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
33388
33619
  return charMap[match];
@@ -33410,31 +33641,33 @@ var Neurosity = (function (exports) {
33410
33641
  };
33411
33642
 
33412
33643
  prototype.toString = function toString(encoder) {
33413
- const _encode = encoder ? function(value) {
33414
- return encoder.call(this, value, encode$1);
33415
- } : encode$1;
33644
+ const _encode = encoder
33645
+ ? function (value) {
33646
+ return encoder.call(this, value, encode$1);
33647
+ }
33648
+ : encode$1;
33416
33649
 
33417
- return this._pairs.map(function each(pair) {
33418
- return _encode(pair[0]) + '=' + _encode(pair[1]);
33419
- }, '').join('&');
33650
+ return this._pairs
33651
+ .map(function each(pair) {
33652
+ return _encode(pair[0]) + '=' + _encode(pair[1]);
33653
+ }, '')
33654
+ .join('&');
33420
33655
  };
33421
33656
 
33422
33657
  /**
33423
- * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
33424
- * URI encoded counterparts
33658
+ * It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
33659
+ * their plain counterparts (`:`, `$`, `,`, `+`).
33425
33660
  *
33426
33661
  * @param {string} val The value to be encoded.
33427
33662
  *
33428
33663
  * @returns {string} The encoded value.
33429
33664
  */
33430
33665
  function encode(val) {
33431
- return encodeURIComponent(val).
33432
- replace(/%3A/gi, ':').
33433
- replace(/%24/g, '$').
33434
- replace(/%2C/gi, ',').
33435
- replace(/%20/g, '+').
33436
- replace(/%5B/gi, '[').
33437
- replace(/%5D/gi, ']');
33666
+ return encodeURIComponent(val)
33667
+ .replace(/%3A/gi, ':')
33668
+ .replace(/%24/g, '$')
33669
+ .replace(/%2C/gi, ',')
33670
+ .replace(/%20/g, '+');
33438
33671
  }
33439
33672
 
33440
33673
  /**
@@ -33442,32 +33675,37 @@ var Neurosity = (function (exports) {
33442
33675
  *
33443
33676
  * @param {string} url The base of the url (e.g., http://www.google.com)
33444
33677
  * @param {object} [params] The params to be appended
33445
- * @param {?object} options
33678
+ * @param {?(object|Function)} options
33446
33679
  *
33447
33680
  * @returns {string} The formatted url
33448
33681
  */
33449
33682
  function buildURL(url, params, options) {
33450
- /*eslint no-param-reassign:0*/
33451
33683
  if (!params) {
33452
33684
  return url;
33453
33685
  }
33454
-
33455
- const _encode = options && options.encode || encode;
33456
33686
 
33457
- const serializeFn = options && options.serialize;
33687
+ const _encode = (options && options.encode) || encode;
33688
+
33689
+ const _options = utils$1.isFunction(options)
33690
+ ? {
33691
+ serialize: options,
33692
+ }
33693
+ : options;
33694
+
33695
+ const serializeFn = _options && _options.serialize;
33458
33696
 
33459
33697
  let serializedParams;
33460
33698
 
33461
33699
  if (serializeFn) {
33462
- serializedParams = serializeFn(params, options);
33700
+ serializedParams = serializeFn(params, _options);
33463
33701
  } else {
33464
- serializedParams = utils$1.isURLSearchParams(params) ?
33465
- params.toString() :
33466
- new AxiosURLSearchParams(params, options).toString(_encode);
33702
+ serializedParams = utils$1.isURLSearchParams(params)
33703
+ ? params.toString()
33704
+ : new AxiosURLSearchParams(params, _options).toString(_encode);
33467
33705
  }
33468
33706
 
33469
33707
  if (serializedParams) {
33470
- const hashmarkIndex = url.indexOf("#");
33708
+ const hashmarkIndex = url.indexOf('#');
33471
33709
 
33472
33710
  if (hashmarkIndex !== -1) {
33473
33711
  url = url.slice(0, hashmarkIndex);
@@ -33488,6 +33726,7 @@ var Neurosity = (function (exports) {
33488
33726
  *
33489
33727
  * @param {Function} fulfilled The function to handle `then` for a `Promise`
33490
33728
  * @param {Function} rejected The function to handle `reject` for a `Promise`
33729
+ * @param {Object} options The options for the interceptor, synchronous and runWhen
33491
33730
  *
33492
33731
  * @return {Number} An ID used to remove interceptor later
33493
33732
  */
@@ -33496,7 +33735,7 @@ var Neurosity = (function (exports) {
33496
33735
  fulfilled,
33497
33736
  rejected,
33498
33737
  synchronous: options ? options.synchronous : false,
33499
- runWhen: options ? options.runWhen : null
33738
+ runWhen: options ? options.runWhen : null,
33500
33739
  });
33501
33740
  return this.handlers.length - 1;
33502
33741
  }
@@ -33506,7 +33745,7 @@ var Neurosity = (function (exports) {
33506
33745
  *
33507
33746
  * @param {Number} id The ID that was returned by `use`
33508
33747
  *
33509
- * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
33748
+ * @returns {void}
33510
33749
  */
33511
33750
  eject(id) {
33512
33751
  if (this.handlers[id]) {
@@ -33547,7 +33786,8 @@ var Neurosity = (function (exports) {
33547
33786
  var transitionalDefaults = {
33548
33787
  silentJSONParsing: true,
33549
33788
  forcedJSONParsing: true,
33550
- clarifyTimeoutError: false
33789
+ clarifyTimeoutError: false,
33790
+ legacyInterceptorReqResOrdering: true,
33551
33791
  };
33552
33792
 
33553
33793
  var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
@@ -33561,13 +33801,15 @@ var Neurosity = (function (exports) {
33561
33801
  classes: {
33562
33802
  URLSearchParams: URLSearchParams$1,
33563
33803
  FormData: FormData$1,
33564
- Blob: Blob$1
33804
+ Blob: Blob$1,
33565
33805
  },
33566
- protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
33806
+ protocols: ['http', 'https', 'file', 'blob', 'url', 'data'],
33567
33807
  };
33568
33808
 
33569
33809
  const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
33570
33810
 
33811
+ const _navigator = (typeof navigator === 'object' && navigator) || undefined;
33812
+
33571
33813
  /**
33572
33814
  * Determine if we're running in a standard browser environment
33573
33815
  *
@@ -33585,10 +33827,9 @@ var Neurosity = (function (exports) {
33585
33827
  *
33586
33828
  * @returns {boolean}
33587
33829
  */
33588
- const hasStandardBrowserEnv = (
33589
- (product) => {
33590
- return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
33591
- })(typeof navigator !== 'undefined' && navigator.product);
33830
+ const hasStandardBrowserEnv =
33831
+ hasBrowserEnv &&
33832
+ (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
33592
33833
 
33593
33834
  /**
33594
33835
  * Determine if we're running in a standard browser webWorker environment
@@ -33608,29 +33849,34 @@ var Neurosity = (function (exports) {
33608
33849
  );
33609
33850
  })();
33610
33851
 
33852
+ const origin = (hasBrowserEnv && window.location.href) || 'http://localhost';
33853
+
33611
33854
  var utils = /*#__PURE__*/Object.freeze({
33612
33855
  __proto__: null,
33613
33856
  hasBrowserEnv: hasBrowserEnv,
33614
33857
  hasStandardBrowserEnv: hasStandardBrowserEnv,
33615
- hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv
33858
+ hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
33859
+ navigator: _navigator,
33860
+ origin: origin
33616
33861
  });
33617
33862
 
33618
33863
  var platform = {
33619
33864
  ...utils,
33620
- ...platform$1
33865
+ ...platform$1,
33621
33866
  };
33622
33867
 
33623
33868
  function toURLEncodedForm(data, options) {
33624
- return toFormData$1(data, new platform.classes.URLSearchParams(), Object.assign({
33625
- visitor: function(value, key, path, helpers) {
33869
+ return toFormData$1(data, new platform.classes.URLSearchParams(), {
33870
+ visitor: function (value, key, path, helpers) {
33626
33871
  if (platform.isNode && utils$1.isBuffer(value)) {
33627
33872
  this.append(key, value.toString('base64'));
33628
33873
  return false;
33629
33874
  }
33630
33875
 
33631
33876
  return helpers.defaultVisitor.apply(this, arguments);
33632
- }
33633
- }, options));
33877
+ },
33878
+ ...options,
33879
+ });
33634
33880
  }
33635
33881
 
33636
33882
  /**
@@ -33645,7 +33891,7 @@ var Neurosity = (function (exports) {
33645
33891
  // foo.x.y.z
33646
33892
  // foo-x-y-z
33647
33893
  // foo x y z
33648
- return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
33894
+ return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
33649
33895
  return match[0] === '[]' ? '' : match[1] || match[0];
33650
33896
  });
33651
33897
  }
@@ -33680,6 +33926,9 @@ var Neurosity = (function (exports) {
33680
33926
  function formDataToJSON(formData) {
33681
33927
  function buildPath(path, value, target, index) {
33682
33928
  let name = path[index++];
33929
+
33930
+ if (name === '__proto__') return true;
33931
+
33683
33932
  const isNumericKey = Number.isFinite(+name);
33684
33933
  const isLast = index >= path.length;
33685
33934
  name = !name && utils$1.isArray(target) ? target.length : name;
@@ -33746,94 +33995,107 @@ var Neurosity = (function (exports) {
33746
33995
  }
33747
33996
 
33748
33997
  const defaults = {
33749
-
33750
33998
  transitional: transitionalDefaults,
33751
33999
 
33752
- adapter: ['xhr', 'http'],
34000
+ adapter: ['xhr', 'http', 'fetch'],
33753
34001
 
33754
- transformRequest: [function transformRequest(data, headers) {
33755
- const contentType = headers.getContentType() || '';
33756
- const hasJSONContentType = contentType.indexOf('application/json') > -1;
33757
- const isObjectPayload = utils$1.isObject(data);
34002
+ transformRequest: [
34003
+ function transformRequest(data, headers) {
34004
+ const contentType = headers.getContentType() || '';
34005
+ const hasJSONContentType = contentType.indexOf('application/json') > -1;
34006
+ const isObjectPayload = utils$1.isObject(data);
33758
34007
 
33759
- if (isObjectPayload && utils$1.isHTMLForm(data)) {
33760
- data = new FormData(data);
33761
- }
34008
+ if (isObjectPayload && utils$1.isHTMLForm(data)) {
34009
+ data = new FormData(data);
34010
+ }
33762
34011
 
33763
- const isFormData = utils$1.isFormData(data);
34012
+ const isFormData = utils$1.isFormData(data);
33764
34013
 
33765
- if (isFormData) {
33766
- if (!hasJSONContentType) {
34014
+ if (isFormData) {
34015
+ return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
34016
+ }
34017
+
34018
+ if (
34019
+ utils$1.isArrayBuffer(data) ||
34020
+ utils$1.isBuffer(data) ||
34021
+ utils$1.isStream(data) ||
34022
+ utils$1.isFile(data) ||
34023
+ utils$1.isBlob(data) ||
34024
+ utils$1.isReadableStream(data)
34025
+ ) {
33767
34026
  return data;
33768
34027
  }
33769
- return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
33770
- }
34028
+ if (utils$1.isArrayBufferView(data)) {
34029
+ return data.buffer;
34030
+ }
34031
+ if (utils$1.isURLSearchParams(data)) {
34032
+ headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
34033
+ return data.toString();
34034
+ }
33771
34035
 
33772
- if (utils$1.isArrayBuffer(data) ||
33773
- utils$1.isBuffer(data) ||
33774
- utils$1.isStream(data) ||
33775
- utils$1.isFile(data) ||
33776
- utils$1.isBlob(data)
33777
- ) {
33778
- return data;
33779
- }
33780
- if (utils$1.isArrayBufferView(data)) {
33781
- return data.buffer;
33782
- }
33783
- if (utils$1.isURLSearchParams(data)) {
33784
- headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
33785
- return data.toString();
33786
- }
34036
+ let isFileList;
33787
34037
 
33788
- let isFileList;
34038
+ if (isObjectPayload) {
34039
+ if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
34040
+ return toURLEncodedForm(data, this.formSerializer).toString();
34041
+ }
33789
34042
 
33790
- if (isObjectPayload) {
33791
- if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
33792
- return toURLEncodedForm(data, this.formSerializer).toString();
33793
- }
34043
+ if (
34044
+ (isFileList = utils$1.isFileList(data)) ||
34045
+ contentType.indexOf('multipart/form-data') > -1
34046
+ ) {
34047
+ const _FormData = this.env && this.env.FormData;
33794
34048
 
33795
- if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
33796
- const _FormData = this.env && this.env.FormData;
34049
+ return toFormData$1(
34050
+ isFileList ? { 'files[]': data } : data,
34051
+ _FormData && new _FormData(),
34052
+ this.formSerializer
34053
+ );
34054
+ }
34055
+ }
33797
34056
 
33798
- return toFormData$1(
33799
- isFileList ? {'files[]': data} : data,
33800
- _FormData && new _FormData(),
33801
- this.formSerializer
33802
- );
34057
+ if (isObjectPayload || hasJSONContentType) {
34058
+ headers.setContentType('application/json', false);
34059
+ return stringifySafely(data);
33803
34060
  }
33804
- }
33805
34061
 
33806
- if (isObjectPayload || hasJSONContentType ) {
33807
- headers.setContentType('application/json', false);
33808
- return stringifySafely(data);
33809
- }
34062
+ return data;
34063
+ },
34064
+ ],
33810
34065
 
33811
- return data;
33812
- }],
34066
+ transformResponse: [
34067
+ function transformResponse(data) {
34068
+ const transitional = this.transitional || defaults.transitional;
34069
+ const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
34070
+ const JSONRequested = this.responseType === 'json';
33813
34071
 
33814
- transformResponse: [function transformResponse(data) {
33815
- const transitional = this.transitional || defaults.transitional;
33816
- const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
33817
- const JSONRequested = this.responseType === 'json';
34072
+ if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
34073
+ return data;
34074
+ }
33818
34075
 
33819
- if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
33820
- const silentJSONParsing = transitional && transitional.silentJSONParsing;
33821
- const strictJSONParsing = !silentJSONParsing && JSONRequested;
34076
+ if (
34077
+ data &&
34078
+ utils$1.isString(data) &&
34079
+ ((forcedJSONParsing && !this.responseType) || JSONRequested)
34080
+ ) {
34081
+ const silentJSONParsing = transitional && transitional.silentJSONParsing;
34082
+ const strictJSONParsing = !silentJSONParsing && JSONRequested;
33822
34083
 
33823
- try {
33824
- return JSON.parse(data);
33825
- } catch (e) {
33826
- if (strictJSONParsing) {
33827
- if (e.name === 'SyntaxError') {
33828
- throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
34084
+ try {
34085
+ return JSON.parse(data, this.parseReviver);
34086
+ } catch (e) {
34087
+ if (strictJSONParsing) {
34088
+ if (e.name === 'SyntaxError') {
34089
+ throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
34090
+ }
34091
+ throw e;
33829
34092
  }
33830
- throw e;
33831
34093
  }
33832
34094
  }
33833
- }
33834
34095
 
33835
- return data;
33836
- }],
34096
+ return data;
34097
+ },
34098
+ ],
33837
34099
 
33838
34100
  /**
33839
34101
  * A timeout in milliseconds to abort a request. If set to 0 (default) a
@@ -33849,7 +34111,7 @@ var Neurosity = (function (exports) {
33849
34111
 
33850
34112
  env: {
33851
34113
  FormData: platform.classes.FormData,
33852
- Blob: platform.classes.Blob
34114
+ Blob: platform.classes.Blob,
33853
34115
  },
33854
34116
 
33855
34117
  validateStatus: function validateStatus(status) {
@@ -33858,10 +34120,10 @@ var Neurosity = (function (exports) {
33858
34120
 
33859
34121
  headers: {
33860
34122
  common: {
33861
- 'Accept': 'application/json, text/plain, */*',
33862
- 'Content-Type': undefined
33863
- }
33864
- }
34123
+ Accept: 'application/json, text/plain, */*',
34124
+ 'Content-Type': undefined,
34125
+ },
34126
+ },
33865
34127
  };
33866
34128
 
33867
34129
  utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
@@ -33871,10 +34133,23 @@ var Neurosity = (function (exports) {
33871
34133
  // RawAxiosHeaders whose duplicates are ignored by node
33872
34134
  // c.f. https://nodejs.org/api/http.html#http_message_headers
33873
34135
  const ignoreDuplicateOf = utils$1.toObjectSet([
33874
- 'age', 'authorization', 'content-length', 'content-type', 'etag',
33875
- 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
33876
- 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
33877
- 'referer', 'retry-after', 'user-agent'
34136
+ 'age',
34137
+ 'authorization',
34138
+ 'content-length',
34139
+ 'content-type',
34140
+ 'etag',
34141
+ 'expires',
34142
+ 'from',
34143
+ 'host',
34144
+ 'if-modified-since',
34145
+ 'if-unmodified-since',
34146
+ 'last-modified',
34147
+ 'location',
34148
+ 'max-forwards',
34149
+ 'proxy-authorization',
34150
+ 'referer',
34151
+ 'retry-after',
34152
+ 'user-agent',
33878
34153
  ]);
33879
34154
 
33880
34155
  /**
@@ -33891,47 +34166,81 @@ var Neurosity = (function (exports) {
33891
34166
  *
33892
34167
  * @returns {Object} Headers parsed into an object
33893
34168
  */
33894
- var parseHeaders = rawHeaders => {
34169
+ var parseHeaders = (rawHeaders) => {
33895
34170
  const parsed = {};
33896
34171
  let key;
33897
34172
  let val;
33898
34173
  let i;
33899
34174
 
33900
- rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
33901
- i = line.indexOf(':');
33902
- key = line.substring(0, i).trim().toLowerCase();
33903
- val = line.substring(i + 1).trim();
34175
+ rawHeaders &&
34176
+ rawHeaders.split('\n').forEach(function parser(line) {
34177
+ i = line.indexOf(':');
34178
+ key = line.substring(0, i).trim().toLowerCase();
34179
+ val = line.substring(i + 1).trim();
33904
34180
 
33905
- if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
33906
- return;
33907
- }
34181
+ if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
34182
+ return;
34183
+ }
33908
34184
 
33909
- if (key === 'set-cookie') {
33910
- if (parsed[key]) {
33911
- parsed[key].push(val);
34185
+ if (key === 'set-cookie') {
34186
+ if (parsed[key]) {
34187
+ parsed[key].push(val);
34188
+ } else {
34189
+ parsed[key] = [val];
34190
+ }
33912
34191
  } else {
33913
- parsed[key] = [val];
34192
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
33914
34193
  }
33915
- } else {
33916
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
33917
- }
33918
- });
34194
+ });
33919
34195
 
33920
34196
  return parsed;
33921
34197
  };
33922
34198
 
33923
34199
  const $internals = Symbol('internals');
33924
34200
 
34201
+ const isValidHeaderValue = (value) => !/[\r\n]/.test(value);
34202
+
34203
+ function assertValidHeaderValue(value, header) {
34204
+ if (value === false || value == null) {
34205
+ return;
34206
+ }
34207
+
34208
+ if (utils$1.isArray(value)) {
34209
+ value.forEach((v) => assertValidHeaderValue(v, header));
34210
+ return;
34211
+ }
34212
+
34213
+ if (!isValidHeaderValue(String(value))) {
34214
+ throw new Error(`Invalid character in header content ["${header}"]`);
34215
+ }
34216
+ }
34217
+
33925
34218
  function normalizeHeader(header) {
33926
34219
  return header && String(header).trim().toLowerCase();
33927
34220
  }
33928
34221
 
34222
+ function stripTrailingCRLF(str) {
34223
+ let end = str.length;
34224
+
34225
+ while (end > 0) {
34226
+ const charCode = str.charCodeAt(end - 1);
34227
+
34228
+ if (charCode !== 10 && charCode !== 13) {
34229
+ break;
34230
+ }
34231
+
34232
+ end -= 1;
34233
+ }
34234
+
34235
+ return end === str.length ? str : str.slice(0, end);
34236
+ }
34237
+
33929
34238
  function normalizeValue(value) {
33930
34239
  if (value === false || value == null) {
33931
34240
  return value;
33932
34241
  }
33933
34242
 
33934
- return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
34243
+ return utils$1.isArray(value) ? value.map(normalizeValue) : stripTrailingCRLF(String(value));
33935
34244
  }
33936
34245
 
33937
34246
  function parseTokens(str) {
@@ -33969,8 +34278,10 @@ var Neurosity = (function (exports) {
33969
34278
  }
33970
34279
 
33971
34280
  function formatHeader(header) {
33972
- return header.trim()
33973
- .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
34281
+ return header
34282
+ .trim()
34283
+ .toLowerCase()
34284
+ .replace(/([a-z\d])(\w*)/g, (w, char, str) => {
33974
34285
  return char.toUpperCase() + str;
33975
34286
  });
33976
34287
  }
@@ -33978,12 +34289,12 @@ var Neurosity = (function (exports) {
33978
34289
  function buildAccessors(obj, header) {
33979
34290
  const accessorName = utils$1.toCamelCase(' ' + header);
33980
34291
 
33981
- ['get', 'set', 'has'].forEach(methodName => {
34292
+ ['get', 'set', 'has'].forEach((methodName) => {
33982
34293
  Object.defineProperty(obj, methodName + accessorName, {
33983
- value: function(arg1, arg2, arg3) {
34294
+ value: function (arg1, arg2, arg3) {
33984
34295
  return this[methodName].call(this, header, arg1, arg2, arg3);
33985
34296
  },
33986
- configurable: true
34297
+ configurable: true,
33987
34298
  });
33988
34299
  });
33989
34300
  }
@@ -34005,7 +34316,13 @@ var Neurosity = (function (exports) {
34005
34316
 
34006
34317
  const key = utils$1.findKey(self, lHeader);
34007
34318
 
34008
- if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
34319
+ if (
34320
+ !key ||
34321
+ self[key] === undefined ||
34322
+ _rewrite === true ||
34323
+ (_rewrite === undefined && self[key] !== false)
34324
+ ) {
34325
+ assertValidHeaderValue(_value, _header);
34009
34326
  self[key || _header] = normalizeValue(_value);
34010
34327
  }
34011
34328
  }
@@ -34015,8 +34332,25 @@ var Neurosity = (function (exports) {
34015
34332
 
34016
34333
  if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
34017
34334
  setHeaders(header, valueOrRewrite);
34018
- } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
34335
+ } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
34019
34336
  setHeaders(parseHeaders(header), valueOrRewrite);
34337
+ } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
34338
+ let obj = {},
34339
+ dest,
34340
+ key;
34341
+ for (const entry of header) {
34342
+ if (!utils$1.isArray(entry)) {
34343
+ throw TypeError('Object iterator must return a key-value pair');
34344
+ }
34345
+
34346
+ obj[(key = entry[0])] = (dest = obj[key])
34347
+ ? utils$1.isArray(dest)
34348
+ ? [...dest, entry[1]]
34349
+ : [dest, entry[1]]
34350
+ : entry[1];
34351
+ }
34352
+
34353
+ setHeaders(obj, valueOrRewrite);
34020
34354
  } else {
34021
34355
  header != null && setHeader(valueOrRewrite, header, rewrite);
34022
34356
  }
@@ -34060,7 +34394,11 @@ var Neurosity = (function (exports) {
34060
34394
  if (header) {
34061
34395
  const key = utils$1.findKey(this, header);
34062
34396
 
34063
- return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
34397
+ return !!(
34398
+ key &&
34399
+ this[key] !== undefined &&
34400
+ (!matcher || matchHeaderValue(this, this[key], key, matcher))
34401
+ );
34064
34402
  }
34065
34403
 
34066
34404
  return false;
@@ -34100,7 +34438,7 @@ var Neurosity = (function (exports) {
34100
34438
 
34101
34439
  while (i--) {
34102
34440
  const key = keys[i];
34103
- if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
34441
+ if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
34104
34442
  delete this[key];
34105
34443
  deleted = true;
34106
34444
  }
@@ -34144,7 +34482,9 @@ var Neurosity = (function (exports) {
34144
34482
  const obj = Object.create(null);
34145
34483
 
34146
34484
  utils$1.forEach(this, (value, header) => {
34147
- value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
34485
+ value != null &&
34486
+ value !== false &&
34487
+ (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
34148
34488
  });
34149
34489
 
34150
34490
  return obj;
@@ -34155,7 +34495,13 @@ var Neurosity = (function (exports) {
34155
34495
  }
34156
34496
 
34157
34497
  toString() {
34158
- return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
34498
+ return Object.entries(this.toJSON())
34499
+ .map(([header, value]) => header + ': ' + value)
34500
+ .join('\n');
34501
+ }
34502
+
34503
+ getSetCookie() {
34504
+ return this.get('set-cookie') || [];
34159
34505
  }
34160
34506
 
34161
34507
  get [Symbol.toStringTag]() {
@@ -34175,9 +34521,12 @@ var Neurosity = (function (exports) {
34175
34521
  }
34176
34522
 
34177
34523
  static accessor(header) {
34178
- const internals = this[$internals] = (this[$internals] = {
34179
- accessors: {}
34180
- });
34524
+ const internals =
34525
+ (this[$internals] =
34526
+ this[$internals] =
34527
+ {
34528
+ accessors: {},
34529
+ });
34181
34530
 
34182
34531
  const accessors = internals.accessors;
34183
34532
  const prototype = this.prototype;
@@ -34197,17 +34546,24 @@ var Neurosity = (function (exports) {
34197
34546
  }
34198
34547
  };
34199
34548
 
34200
- AxiosHeaders$1.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
34549
+ AxiosHeaders$1.accessor([
34550
+ 'Content-Type',
34551
+ 'Content-Length',
34552
+ 'Accept',
34553
+ 'Accept-Encoding',
34554
+ 'User-Agent',
34555
+ 'Authorization',
34556
+ ]);
34201
34557
 
34202
34558
  // reserved names hotfix
34203
- utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({value}, key) => {
34559
+ utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value }, key) => {
34204
34560
  let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
34205
34561
  return {
34206
34562
  get: () => value,
34207
34563
  set(headerValue) {
34208
34564
  this[mapped] = headerValue;
34209
- }
34210
- }
34565
+ },
34566
+ };
34211
34567
  });
34212
34568
 
34213
34569
  utils$1.freezeMethods(AxiosHeaders$1);
@@ -34239,24 +34595,22 @@ var Neurosity = (function (exports) {
34239
34595
  return !!(value && value.__CANCEL__);
34240
34596
  }
34241
34597
 
34242
- /**
34243
- * A `CanceledError` is an object that is thrown when an operation is canceled.
34244
- *
34245
- * @param {string=} message The message.
34246
- * @param {Object=} config The config.
34247
- * @param {Object=} request The request.
34248
- *
34249
- * @returns {CanceledError} The created error.
34250
- */
34251
- function CanceledError$1(message, config, request) {
34252
- // eslint-disable-next-line no-eq-null,eqeqeq
34253
- AxiosError$1.call(this, message == null ? 'canceled' : message, AxiosError$1.ERR_CANCELED, config, request);
34254
- this.name = 'CanceledError';
34255
- }
34256
-
34257
- utils$1.inherits(CanceledError$1, AxiosError$1, {
34258
- __CANCEL__: true
34259
- });
34598
+ let CanceledError$1 = class CanceledError extends AxiosError$1 {
34599
+ /**
34600
+ * A `CanceledError` is an object that is thrown when an operation is canceled.
34601
+ *
34602
+ * @param {string=} message The message.
34603
+ * @param {Object=} config The config.
34604
+ * @param {Object=} request The request.
34605
+ *
34606
+ * @returns {CanceledError} The created error.
34607
+ */
34608
+ constructor(message, config, request) {
34609
+ super(message == null ? 'canceled' : message, AxiosError$1.ERR_CANCELED, config, request);
34610
+ this.name = 'CanceledError';
34611
+ this.__CANCEL__ = true;
34612
+ }
34613
+ };
34260
34614
 
34261
34615
  /**
34262
34616
  * Resolve or reject a Promise based on response status.
@@ -34272,166 +34626,23 @@ var Neurosity = (function (exports) {
34272
34626
  if (!response.status || !validateStatus || validateStatus(response.status)) {
34273
34627
  resolve(response);
34274
34628
  } else {
34275
- reject(new AxiosError$1(
34276
- 'Request failed with status code ' + response.status,
34277
- [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
34278
- response.config,
34279
- response.request,
34280
- response
34281
- ));
34282
- }
34283
- }
34284
-
34285
- var cookies = platform.hasStandardBrowserEnv ?
34286
-
34287
- // Standard browser envs support document.cookie
34288
- {
34289
- write(name, value, expires, path, domain, secure) {
34290
- const cookie = [name + '=' + encodeURIComponent(value)];
34291
-
34292
- utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
34293
-
34294
- utils$1.isString(path) && cookie.push('path=' + path);
34295
-
34296
- utils$1.isString(domain) && cookie.push('domain=' + domain);
34297
-
34298
- secure === true && cookie.push('secure');
34299
-
34300
- document.cookie = cookie.join('; ');
34301
- },
34302
-
34303
- read(name) {
34304
- const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
34305
- return (match ? decodeURIComponent(match[3]) : null);
34306
- },
34307
-
34308
- remove(name) {
34309
- this.write(name, '', Date.now() - 86400000);
34310
- }
34311
- }
34312
-
34313
- :
34314
-
34315
- // Non-standard browser env (web workers, react-native) lack needed support.
34316
- {
34317
- write() {},
34318
- read() {
34319
- return null;
34320
- },
34321
- remove() {}
34322
- };
34323
-
34324
- /**
34325
- * Determines whether the specified URL is absolute
34326
- *
34327
- * @param {string} url The URL to test
34328
- *
34329
- * @returns {boolean} True if the specified URL is absolute, otherwise false
34330
- */
34331
- function isAbsoluteURL(url) {
34332
- // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
34333
- // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
34334
- // by any combination of letters, digits, plus, period, or hyphen.
34335
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
34336
- }
34337
-
34338
- /**
34339
- * Creates a new URL by combining the specified URLs
34340
- *
34341
- * @param {string} baseURL The base URL
34342
- * @param {string} relativeURL The relative URL
34343
- *
34344
- * @returns {string} The combined URL
34345
- */
34346
- function combineURLs(baseURL, relativeURL) {
34347
- return relativeURL
34348
- ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
34349
- : baseURL;
34350
- }
34351
-
34352
- /**
34353
- * Creates a new URL by combining the baseURL with the requestedURL,
34354
- * only when the requestedURL is not already an absolute URL.
34355
- * If the requestURL is absolute, this function returns the requestedURL untouched.
34356
- *
34357
- * @param {string} baseURL The base URL
34358
- * @param {string} requestedURL Absolute or relative URL to combine
34359
- *
34360
- * @returns {string} The combined full path
34361
- */
34362
- function buildFullPath(baseURL, requestedURL) {
34363
- if (baseURL && !isAbsoluteURL(requestedURL)) {
34364
- return combineURLs(baseURL, requestedURL);
34629
+ reject(
34630
+ new AxiosError$1(
34631
+ 'Request failed with status code ' + response.status,
34632
+ [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][
34633
+ Math.floor(response.status / 100) - 4
34634
+ ],
34635
+ response.config,
34636
+ response.request,
34637
+ response
34638
+ )
34639
+ );
34365
34640
  }
34366
- return requestedURL;
34367
34641
  }
34368
34642
 
34369
- var isURLSameOrigin = platform.hasStandardBrowserEnv ?
34370
-
34371
- // Standard browser envs have full support of the APIs needed to test
34372
- // whether the request URL is of the same origin as current location.
34373
- (function standardBrowserEnv() {
34374
- const msie = /(msie|trident)/i.test(navigator.userAgent);
34375
- const urlParsingNode = document.createElement('a');
34376
- let originURL;
34377
-
34378
- /**
34379
- * Parse a URL to discover its components
34380
- *
34381
- * @param {String} url The URL to be parsed
34382
- * @returns {Object}
34383
- */
34384
- function resolveURL(url) {
34385
- let href = url;
34386
-
34387
- if (msie) {
34388
- // IE needs attribute set twice to normalize properties
34389
- urlParsingNode.setAttribute('href', href);
34390
- href = urlParsingNode.href;
34391
- }
34392
-
34393
- urlParsingNode.setAttribute('href', href);
34394
-
34395
- // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
34396
- return {
34397
- href: urlParsingNode.href,
34398
- protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
34399
- host: urlParsingNode.host,
34400
- search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
34401
- hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
34402
- hostname: urlParsingNode.hostname,
34403
- port: urlParsingNode.port,
34404
- pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
34405
- urlParsingNode.pathname :
34406
- '/' + urlParsingNode.pathname
34407
- };
34408
- }
34409
-
34410
- originURL = resolveURL(window.location.href);
34411
-
34412
- /**
34413
- * Determine if a URL shares the same origin as the current location
34414
- *
34415
- * @param {String} requestURL The URL to test
34416
- * @returns {boolean} True if URL shares the same origin, otherwise false
34417
- */
34418
- return function isURLSameOrigin(requestURL) {
34419
- const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
34420
- return (parsed.protocol === originURL.protocol &&
34421
- parsed.host === originURL.host);
34422
- };
34423
- })() :
34424
-
34425
- // Non standard browser envs (web workers, react-native) lack needed support.
34426
- (function nonStandardBrowserEnv() {
34427
- return function isURLSameOrigin() {
34428
- return true;
34429
- };
34430
- })();
34431
-
34432
34643
  function parseProtocol(url) {
34433
34644
  const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
34434
- return match && match[1] || '';
34645
+ return (match && match[1]) || '';
34435
34646
  }
34436
34647
 
34437
34648
  /**
@@ -34482,15 +34693,58 @@ var Neurosity = (function (exports) {
34482
34693
 
34483
34694
  const passed = startedAt && now - startedAt;
34484
34695
 
34485
- return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
34696
+ return passed ? Math.round((bytesCount * 1000) / passed) : undefined;
34486
34697
  };
34487
34698
  }
34488
34699
 
34489
- function progressEventReducer(listener, isDownloadStream) {
34700
+ /**
34701
+ * Throttle decorator
34702
+ * @param {Function} fn
34703
+ * @param {Number} freq
34704
+ * @return {Function}
34705
+ */
34706
+ function throttle(fn, freq) {
34707
+ let timestamp = 0;
34708
+ let threshold = 1000 / freq;
34709
+ let lastArgs;
34710
+ let timer;
34711
+
34712
+ const invoke = (args, now = Date.now()) => {
34713
+ timestamp = now;
34714
+ lastArgs = null;
34715
+ if (timer) {
34716
+ clearTimeout(timer);
34717
+ timer = null;
34718
+ }
34719
+ fn(...args);
34720
+ };
34721
+
34722
+ const throttled = (...args) => {
34723
+ const now = Date.now();
34724
+ const passed = now - timestamp;
34725
+ if (passed >= threshold) {
34726
+ invoke(args, now);
34727
+ } else {
34728
+ lastArgs = args;
34729
+ if (!timer) {
34730
+ timer = setTimeout(() => {
34731
+ timer = null;
34732
+ invoke(lastArgs);
34733
+ }, threshold - passed);
34734
+ }
34735
+ }
34736
+ };
34737
+
34738
+ const flush = () => lastArgs && invoke(lastArgs);
34739
+
34740
+ return [throttled, flush];
34741
+ }
34742
+
34743
+ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
34490
34744
  let bytesNotified = 0;
34491
34745
  const _speedometer = speedometer(50, 250);
34492
34746
 
34493
- return e => {
34747
+ return throttle((e) => {
34494
34748
  const loaded = e.loaded;
34495
34749
  const total = e.lengthComputable ? e.total : undefined;
34496
34750
  const progressBytes = loaded - bytesNotified;
@@ -34502,306 +34756,1113 @@ var Neurosity = (function (exports) {
34502
34756
  const data = {
34503
34757
  loaded,
34504
34758
  total,
34505
- progress: total ? (loaded / total) : undefined,
34759
+ progress: total ? loaded / total : undefined,
34506
34760
  bytes: progressBytes,
34507
34761
  rate: rate ? rate : undefined,
34508
34762
  estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
34509
- event: e
34763
+ event: e,
34764
+ lengthComputable: total != null,
34765
+ [isDownloadStream ? 'download' : 'upload']: true,
34510
34766
  };
34511
34767
 
34512
- data[isDownloadStream ? 'download' : 'upload'] = true;
34513
-
34514
34768
  listener(data);
34769
+ }, freq);
34770
+ };
34771
+
34772
+ const progressEventDecorator = (total, throttled) => {
34773
+ const lengthComputable = total != null;
34774
+
34775
+ return [
34776
+ (loaded) =>
34777
+ throttled[0]({
34778
+ lengthComputable,
34779
+ total,
34780
+ loaded,
34781
+ }),
34782
+ throttled[1],
34783
+ ];
34784
+ };
34785
+
34786
+ const asyncDecorator =
34787
+ (fn) =>
34788
+ (...args) =>
34789
+ utils$1.asap(() => fn(...args));
34790
+
34791
+ var isURLSameOrigin = platform.hasStandardBrowserEnv
34792
+ ? ((origin, isMSIE) => (url) => {
34793
+ url = new URL(url, platform.origin);
34794
+
34795
+ return (
34796
+ origin.protocol === url.protocol &&
34797
+ origin.host === url.host &&
34798
+ (isMSIE || origin.port === url.port)
34799
+ );
34800
+ })(
34801
+ new URL(platform.origin),
34802
+ platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
34803
+ )
34804
+ : () => true;
34805
+
34806
+ var cookies = platform.hasStandardBrowserEnv
34807
+ ? // Standard browser envs support document.cookie
34808
+ {
34809
+ write(name, value, expires, path, domain, secure, sameSite) {
34810
+ if (typeof document === 'undefined') return;
34811
+
34812
+ const cookie = [`${name}=${encodeURIComponent(value)}`];
34813
+
34814
+ if (utils$1.isNumber(expires)) {
34815
+ cookie.push(`expires=${new Date(expires).toUTCString()}`);
34816
+ }
34817
+ if (utils$1.isString(path)) {
34818
+ cookie.push(`path=${path}`);
34819
+ }
34820
+ if (utils$1.isString(domain)) {
34821
+ cookie.push(`domain=${domain}`);
34822
+ }
34823
+ if (secure === true) {
34824
+ cookie.push('secure');
34825
+ }
34826
+ if (utils$1.isString(sameSite)) {
34827
+ cookie.push(`SameSite=${sameSite}`);
34828
+ }
34829
+
34830
+ document.cookie = cookie.join('; ');
34831
+ },
34832
+
34833
+ read(name) {
34834
+ if (typeof document === 'undefined') return null;
34835
+ const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
34836
+ return match ? decodeURIComponent(match[1]) : null;
34837
+ },
34838
+
34839
+ remove(name) {
34840
+ this.write(name, '', Date.now() - 86400000, '/');
34841
+ },
34842
+ }
34843
+ : // Non-standard browser env (web workers, react-native) lack needed support.
34844
+ {
34845
+ write() {},
34846
+ read() {
34847
+ return null;
34848
+ },
34849
+ remove() {},
34850
+ };
34851
+
34852
+ /**
34853
+ * Determines whether the specified URL is absolute
34854
+ *
34855
+ * @param {string} url The URL to test
34856
+ *
34857
+ * @returns {boolean} True if the specified URL is absolute, otherwise false
34858
+ */
34859
+ function isAbsoluteURL(url) {
34860
+ // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
34861
+ // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
34862
+ // by any combination of letters, digits, plus, period, or hyphen.
34863
+ if (typeof url !== 'string') {
34864
+ return false;
34865
+ }
34866
+
34867
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
34868
+ }
34869
+
34870
+ /**
34871
+ * Creates a new URL by combining the specified URLs
34872
+ *
34873
+ * @param {string} baseURL The base URL
34874
+ * @param {string} relativeURL The relative URL
34875
+ *
34876
+ * @returns {string} The combined URL
34877
+ */
34878
+ function combineURLs(baseURL, relativeURL) {
34879
+ return relativeURL
34880
+ ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
34881
+ : baseURL;
34882
+ }
34883
+
34884
+ /**
34885
+ * Creates a new URL by combining the baseURL with the requestedURL,
34886
+ * only when the requestedURL is not already an absolute URL.
34887
+ * If the requestURL is absolute, this function returns the requestedURL untouched.
34888
+ *
34889
+ * @param {string} baseURL The base URL
34890
+ * @param {string} requestedURL Absolute or relative URL to combine
34891
+ *
34892
+ * @returns {string} The combined full path
34893
+ */
34894
+ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
34895
+ let isRelativeUrl = !isAbsoluteURL(requestedURL);
34896
+ if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
34897
+ return combineURLs(baseURL, requestedURL);
34898
+ }
34899
+ return requestedURL;
34900
+ }
34901
+
34902
+ const headersToObject = (thing) => (thing instanceof AxiosHeaders$1 ? { ...thing } : thing);
34903
+
34904
+ /**
34905
+ * Config-specific merge-function which creates a new config-object
34906
+ * by merging two configuration objects together.
34907
+ *
34908
+ * @param {Object} config1
34909
+ * @param {Object} config2
34910
+ *
34911
+ * @returns {Object} New object resulting from merging config2 to config1
34912
+ */
34913
+ function mergeConfig$1(config1, config2) {
34914
+ // eslint-disable-next-line no-param-reassign
34915
+ config2 = config2 || {};
34916
+ const config = {};
34917
+
34918
+ function getMergedValue(target, source, prop, caseless) {
34919
+ if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
34920
+ return utils$1.merge.call({ caseless }, target, source);
34921
+ } else if (utils$1.isPlainObject(source)) {
34922
+ return utils$1.merge({}, source);
34923
+ } else if (utils$1.isArray(source)) {
34924
+ return source.slice();
34925
+ }
34926
+ return source;
34927
+ }
34928
+
34929
+ function mergeDeepProperties(a, b, prop, caseless) {
34930
+ if (!utils$1.isUndefined(b)) {
34931
+ return getMergedValue(a, b, prop, caseless);
34932
+ } else if (!utils$1.isUndefined(a)) {
34933
+ return getMergedValue(undefined, a, prop, caseless);
34934
+ }
34935
+ }
34936
+
34937
+ // eslint-disable-next-line consistent-return
34938
+ function valueFromConfig2(a, b) {
34939
+ if (!utils$1.isUndefined(b)) {
34940
+ return getMergedValue(undefined, b);
34941
+ }
34942
+ }
34943
+
34944
+ // eslint-disable-next-line consistent-return
34945
+ function defaultToConfig2(a, b) {
34946
+ if (!utils$1.isUndefined(b)) {
34947
+ return getMergedValue(undefined, b);
34948
+ } else if (!utils$1.isUndefined(a)) {
34949
+ return getMergedValue(undefined, a);
34950
+ }
34951
+ }
34952
+
34953
+ // eslint-disable-next-line consistent-return
34954
+ function mergeDirectKeys(a, b, prop) {
34955
+ if (prop in config2) {
34956
+ return getMergedValue(a, b);
34957
+ } else if (prop in config1) {
34958
+ return getMergedValue(undefined, a);
34959
+ }
34960
+ }
34961
+
34962
+ const mergeMap = {
34963
+ url: valueFromConfig2,
34964
+ method: valueFromConfig2,
34965
+ data: valueFromConfig2,
34966
+ baseURL: defaultToConfig2,
34967
+ transformRequest: defaultToConfig2,
34968
+ transformResponse: defaultToConfig2,
34969
+ paramsSerializer: defaultToConfig2,
34970
+ timeout: defaultToConfig2,
34971
+ timeoutMessage: defaultToConfig2,
34972
+ withCredentials: defaultToConfig2,
34973
+ withXSRFToken: defaultToConfig2,
34974
+ adapter: defaultToConfig2,
34975
+ responseType: defaultToConfig2,
34976
+ xsrfCookieName: defaultToConfig2,
34977
+ xsrfHeaderName: defaultToConfig2,
34978
+ onUploadProgress: defaultToConfig2,
34979
+ onDownloadProgress: defaultToConfig2,
34980
+ decompress: defaultToConfig2,
34981
+ maxContentLength: defaultToConfig2,
34982
+ maxBodyLength: defaultToConfig2,
34983
+ beforeRedirect: defaultToConfig2,
34984
+ transport: defaultToConfig2,
34985
+ httpAgent: defaultToConfig2,
34986
+ httpsAgent: defaultToConfig2,
34987
+ cancelToken: defaultToConfig2,
34988
+ socketPath: defaultToConfig2,
34989
+ responseEncoding: defaultToConfig2,
34990
+ validateStatus: mergeDirectKeys,
34991
+ headers: (a, b, prop) =>
34992
+ mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true),
34515
34993
  };
34994
+
34995
+ utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
34996
+ if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
34997
+ const merge = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
34998
+ const configValue = merge(config1[prop], config2[prop], prop);
34999
+ (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
35000
+ });
35001
+
35002
+ return config;
34516
35003
  }
34517
35004
 
34518
- const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
35005
+ var resolveConfig = (config) => {
35006
+ const newConfig = mergeConfig$1({}, config);
34519
35007
 
34520
- var xhrAdapter = isXHRAdapterSupported && function (config) {
34521
- return new Promise(function dispatchXhrRequest(resolve, reject) {
34522
- let requestData = config.data;
34523
- const requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
34524
- let {responseType, withXSRFToken} = config;
34525
- let onCanceled;
34526
- function done() {
34527
- if (config.cancelToken) {
34528
- config.cancelToken.unsubscribe(onCanceled);
34529
- }
35008
+ let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
34530
35009
 
34531
- if (config.signal) {
34532
- config.signal.removeEventListener('abort', onCanceled);
34533
- }
35010
+ newConfig.headers = headers = AxiosHeaders$1.from(headers);
35011
+
35012
+ newConfig.url = buildURL(
35013
+ buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls),
35014
+ config.params,
35015
+ config.paramsSerializer
35016
+ );
35017
+
35018
+ // HTTP basic authentication
35019
+ if (auth) {
35020
+ headers.set(
35021
+ 'Authorization',
35022
+ 'Basic ' +
35023
+ btoa(
35024
+ (auth.username || '') +
35025
+ ':' +
35026
+ (auth.password ? unescape(encodeURIComponent(auth.password)) : '')
35027
+ )
35028
+ );
35029
+ }
35030
+
35031
+ if (utils$1.isFormData(data)) {
35032
+ if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
35033
+ headers.setContentType(undefined); // browser handles it
35034
+ } else if (utils$1.isFunction(data.getHeaders)) {
35035
+ // Node.js FormData (like form-data package)
35036
+ const formHeaders = data.getHeaders();
35037
+ // Only set safe headers to avoid overwriting security headers
35038
+ const allowedHeaders = ['content-type', 'content-length'];
35039
+ Object.entries(formHeaders).forEach(([key, val]) => {
35040
+ if (allowedHeaders.includes(key.toLowerCase())) {
35041
+ headers.set(key, val);
35042
+ }
35043
+ });
34534
35044
  }
35045
+ }
35046
+
35047
+ // Add xsrf header
35048
+ // This is only done if running in a standard browser environment.
35049
+ // Specifically not if we're in a web worker, or react-native.
34535
35050
 
34536
- let contentType;
35051
+ if (platform.hasStandardBrowserEnv) {
35052
+ withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
34537
35053
 
34538
- if (utils$1.isFormData(requestData)) {
34539
- if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
34540
- requestHeaders.setContentType(false); // Let the browser set it
34541
- } else if ((contentType = requestHeaders.getContentType()) !== false) {
34542
- // fix semicolon duplication issue for ReactNative FormData implementation
34543
- const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
34544
- requestHeaders.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
35054
+ if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
35055
+ // Add xsrf header
35056
+ const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
35057
+
35058
+ if (xsrfValue) {
35059
+ headers.set(xsrfHeaderName, xsrfValue);
34545
35060
  }
34546
35061
  }
35062
+ }
34547
35063
 
34548
- let request = new XMLHttpRequest();
35064
+ return newConfig;
35065
+ };
34549
35066
 
34550
- // HTTP basic authentication
34551
- if (config.auth) {
34552
- const username = config.auth.username || '';
34553
- const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
34554
- requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
34555
- }
35067
+ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
34556
35068
 
34557
- const fullPath = buildFullPath(config.baseURL, config.url);
35069
+ var xhrAdapter = isXHRAdapterSupported &&
35070
+ function (config) {
35071
+ return new Promise(function dispatchXhrRequest(resolve, reject) {
35072
+ const _config = resolveConfig(config);
35073
+ let requestData = _config.data;
35074
+ const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
35075
+ let { responseType, onUploadProgress, onDownloadProgress } = _config;
35076
+ let onCanceled;
35077
+ let uploadThrottled, downloadThrottled;
35078
+ let flushUpload, flushDownload;
34558
35079
 
34559
- request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
35080
+ function done() {
35081
+ flushUpload && flushUpload(); // flush events
35082
+ flushDownload && flushDownload(); // flush events
34560
35083
 
34561
- // Set the request timeout in MS
34562
- request.timeout = config.timeout;
35084
+ _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
34563
35085
 
34564
- function onloadend() {
34565
- if (!request) {
34566
- return;
35086
+ _config.signal && _config.signal.removeEventListener('abort', onCanceled);
34567
35087
  }
34568
- // Prepare the response
34569
- const responseHeaders = AxiosHeaders$1.from(
34570
- 'getAllResponseHeaders' in request && request.getAllResponseHeaders()
34571
- );
34572
- const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
34573
- request.responseText : request.response;
34574
- const response = {
34575
- data: responseData,
34576
- status: request.status,
34577
- statusText: request.statusText,
34578
- headers: responseHeaders,
34579
- config,
34580
- request
34581
- };
34582
35088
 
34583
- settle(function _resolve(value) {
34584
- resolve(value);
34585
- done();
34586
- }, function _reject(err) {
34587
- reject(err);
34588
- done();
34589
- }, response);
35089
+ let request = new XMLHttpRequest();
34590
35090
 
34591
- // Clean up request
34592
- request = null;
34593
- }
35091
+ request.open(_config.method.toUpperCase(), _config.url, true);
34594
35092
 
34595
- if ('onloadend' in request) {
34596
- // Use onloadend if available
34597
- request.onloadend = onloadend;
34598
- } else {
34599
- // Listen for ready state to emulate onloadend
34600
- request.onreadystatechange = function handleLoad() {
34601
- if (!request || request.readyState !== 4) {
35093
+ // Set the request timeout in MS
35094
+ request.timeout = _config.timeout;
35095
+
35096
+ function onloadend() {
35097
+ if (!request) {
34602
35098
  return;
34603
35099
  }
35100
+ // Prepare the response
35101
+ const responseHeaders = AxiosHeaders$1.from(
35102
+ 'getAllResponseHeaders' in request && request.getAllResponseHeaders()
35103
+ );
35104
+ const responseData =
35105
+ !responseType || responseType === 'text' || responseType === 'json'
35106
+ ? request.responseText
35107
+ : request.response;
35108
+ const response = {
35109
+ data: responseData,
35110
+ status: request.status,
35111
+ statusText: request.statusText,
35112
+ headers: responseHeaders,
35113
+ config,
35114
+ request,
35115
+ };
35116
+
35117
+ settle(
35118
+ function _resolve(value) {
35119
+ resolve(value);
35120
+ done();
35121
+ },
35122
+ function _reject(err) {
35123
+ reject(err);
35124
+ done();
35125
+ },
35126
+ response
35127
+ );
35128
+
35129
+ // Clean up request
35130
+ request = null;
35131
+ }
34604
35132
 
34605
- // The request errored out and we didn't get a response, this will be
34606
- // handled by onerror instead
34607
- // With one exception: request that using file: protocol, most browsers
34608
- // will return status as 0 even though it's a successful request
34609
- if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
35133
+ if ('onloadend' in request) {
35134
+ // Use onloadend if available
35135
+ request.onloadend = onloadend;
35136
+ } else {
35137
+ // Listen for ready state to emulate onloadend
35138
+ request.onreadystatechange = function handleLoad() {
35139
+ if (!request || request.readyState !== 4) {
35140
+ return;
35141
+ }
35142
+
35143
+ // The request errored out and we didn't get a response, this will be
35144
+ // handled by onerror instead
35145
+ // With one exception: request that using file: protocol, most browsers
35146
+ // will return status as 0 even though it's a successful request
35147
+ if (
35148
+ request.status === 0 &&
35149
+ !(request.responseURL && request.responseURL.indexOf('file:') === 0)
35150
+ ) {
35151
+ return;
35152
+ }
35153
+ // readystate handler is calling before onerror or ontimeout handlers,
35154
+ // so we should call onloadend on the next 'tick'
35155
+ setTimeout(onloadend);
35156
+ };
35157
+ }
35158
+
35159
+ // Handle browser request cancellation (as opposed to a manual cancellation)
35160
+ request.onabort = function handleAbort() {
35161
+ if (!request) {
34610
35162
  return;
34611
35163
  }
34612
- // readystate handler is calling before onerror or ontimeout handlers,
34613
- // so we should call onloadend on the next 'tick'
34614
- setTimeout(onloadend);
35164
+
35165
+ reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
35166
+
35167
+ // Clean up request
35168
+ request = null;
35169
+ };
35170
+
35171
+ // Handle low level network errors
35172
+ request.onerror = function handleError(event) {
35173
+ // Browsers deliver a ProgressEvent in XHR onerror
35174
+ // (message may be empty; when present, surface it)
35175
+ // See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
35176
+ const msg = event && event.message ? event.message : 'Network Error';
35177
+ const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
35178
+ // attach the underlying event for consumers who want details
35179
+ err.event = event || null;
35180
+ reject(err);
35181
+ request = null;
34615
35182
  };
34616
- }
34617
35183
 
34618
- // Handle browser request cancellation (as opposed to a manual cancellation)
34619
- request.onabort = function handleAbort() {
34620
- if (!request) {
35184
+ // Handle timeout
35185
+ request.ontimeout = function handleTimeout() {
35186
+ let timeoutErrorMessage = _config.timeout
35187
+ ? 'timeout of ' + _config.timeout + 'ms exceeded'
35188
+ : 'timeout exceeded';
35189
+ const transitional = _config.transitional || transitionalDefaults;
35190
+ if (_config.timeoutErrorMessage) {
35191
+ timeoutErrorMessage = _config.timeoutErrorMessage;
35192
+ }
35193
+ reject(
35194
+ new AxiosError$1(
35195
+ timeoutErrorMessage,
35196
+ transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
35197
+ config,
35198
+ request
35199
+ )
35200
+ );
35201
+
35202
+ // Clean up request
35203
+ request = null;
35204
+ };
35205
+
35206
+ // Remove Content-Type if data is undefined
35207
+ requestData === undefined && requestHeaders.setContentType(null);
35208
+
35209
+ // Add headers to the request
35210
+ if ('setRequestHeader' in request) {
35211
+ utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
35212
+ request.setRequestHeader(key, val);
35213
+ });
35214
+ }
35215
+
35216
+ // Add withCredentials to request if needed
35217
+ if (!utils$1.isUndefined(_config.withCredentials)) {
35218
+ request.withCredentials = !!_config.withCredentials;
35219
+ }
35220
+
35221
+ // Add responseType to request if needed
35222
+ if (responseType && responseType !== 'json') {
35223
+ request.responseType = _config.responseType;
35224
+ }
35225
+
35226
+ // Handle progress if needed
35227
+ if (onDownloadProgress) {
35228
+ [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
35229
+ request.addEventListener('progress', downloadThrottled);
35230
+ }
35231
+
35232
+ // Not all browsers support upload events
35233
+ if (onUploadProgress && request.upload) {
35234
+ [uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
35235
+
35236
+ request.upload.addEventListener('progress', uploadThrottled);
35237
+
35238
+ request.upload.addEventListener('loadend', flushUpload);
35239
+ }
35240
+
35241
+ if (_config.cancelToken || _config.signal) {
35242
+ // Handle cancellation
35243
+ // eslint-disable-next-line func-names
35244
+ onCanceled = (cancel) => {
35245
+ if (!request) {
35246
+ return;
35247
+ }
35248
+ reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
35249
+ request.abort();
35250
+ request = null;
35251
+ };
35252
+
35253
+ _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
35254
+ if (_config.signal) {
35255
+ _config.signal.aborted
35256
+ ? onCanceled()
35257
+ : _config.signal.addEventListener('abort', onCanceled);
35258
+ }
35259
+ }
35260
+
35261
+ const protocol = parseProtocol(_config.url);
35262
+
35263
+ if (protocol && platform.protocols.indexOf(protocol) === -1) {
35264
+ reject(
35265
+ new AxiosError$1(
35266
+ 'Unsupported protocol ' + protocol + ':',
35267
+ AxiosError$1.ERR_BAD_REQUEST,
35268
+ config
35269
+ )
35270
+ );
34621
35271
  return;
34622
35272
  }
34623
35273
 
34624
- reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
35274
+ // Send the request
35275
+ request.send(requestData || null);
35276
+ });
35277
+ };
34625
35278
 
34626
- // Clean up request
34627
- request = null;
34628
- };
35279
+ const composeSignals = (signals, timeout) => {
35280
+ const { length } = (signals = signals ? signals.filter(Boolean) : []);
35281
+
35282
+ if (timeout || length) {
35283
+ let controller = new AbortController();
34629
35284
 
34630
- // Handle low level network errors
34631
- request.onerror = function handleError() {
34632
- // Real errors are hidden from us by the browser
34633
- // onerror should only fire if it's a network error
34634
- reject(new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request));
35285
+ let aborted;
34635
35286
 
34636
- // Clean up request
34637
- request = null;
35287
+ const onabort = function (reason) {
35288
+ if (!aborted) {
35289
+ aborted = true;
35290
+ unsubscribe();
35291
+ const err = reason instanceof Error ? reason : this.reason;
35292
+ controller.abort(
35293
+ err instanceof AxiosError$1
35294
+ ? err
35295
+ : new CanceledError$1(err instanceof Error ? err.message : err)
35296
+ );
35297
+ }
34638
35298
  };
34639
35299
 
34640
- // Handle timeout
34641
- request.ontimeout = function handleTimeout() {
34642
- let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
34643
- const transitional = config.transitional || transitionalDefaults;
34644
- if (config.timeoutErrorMessage) {
34645
- timeoutErrorMessage = config.timeoutErrorMessage;
35300
+ let timer =
35301
+ timeout &&
35302
+ setTimeout(() => {
35303
+ timer = null;
35304
+ onabort(new AxiosError$1(`timeout of ${timeout}ms exceeded`, AxiosError$1.ETIMEDOUT));
35305
+ }, timeout);
35306
+
35307
+ const unsubscribe = () => {
35308
+ if (signals) {
35309
+ timer && clearTimeout(timer);
35310
+ timer = null;
35311
+ signals.forEach((signal) => {
35312
+ signal.unsubscribe
35313
+ ? signal.unsubscribe(onabort)
35314
+ : signal.removeEventListener('abort', onabort);
35315
+ });
35316
+ signals = null;
34646
35317
  }
34647
- reject(new AxiosError$1(
34648
- timeoutErrorMessage,
34649
- transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
34650
- config,
34651
- request));
34652
-
34653
- // Clean up request
34654
- request = null;
34655
35318
  };
34656
35319
 
34657
- // Add xsrf header
34658
- // This is only done if running in a standard browser environment.
34659
- // Specifically not if we're in a web worker, or react-native.
34660
- if(platform.hasStandardBrowserEnv) {
34661
- withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
35320
+ signals.forEach((signal) => signal.addEventListener('abort', onabort));
34662
35321
 
34663
- if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(fullPath))) {
34664
- // Add xsrf header
34665
- const xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
35322
+ const { signal } = controller;
34666
35323
 
34667
- if (xsrfValue) {
34668
- requestHeaders.set(config.xsrfHeaderName, xsrfValue);
34669
- }
35324
+ signal.unsubscribe = () => utils$1.asap(unsubscribe);
35325
+
35326
+ return signal;
35327
+ }
35328
+ };
35329
+
35330
+ const streamChunk = function* (chunk, chunkSize) {
35331
+ let len = chunk.byteLength;
35332
+
35333
+ if (len < chunkSize) {
35334
+ yield chunk;
35335
+ return;
35336
+ }
35337
+
35338
+ let pos = 0;
35339
+ let end;
35340
+
35341
+ while (pos < len) {
35342
+ end = pos + chunkSize;
35343
+ yield chunk.slice(pos, end);
35344
+ pos = end;
35345
+ }
35346
+ };
35347
+
35348
+ const readBytes = async function* (iterable, chunkSize) {
35349
+ for await (const chunk of readStream(iterable)) {
35350
+ yield* streamChunk(chunk, chunkSize);
35351
+ }
35352
+ };
35353
+
35354
+ const readStream = async function* (stream) {
35355
+ if (stream[Symbol.asyncIterator]) {
35356
+ yield* stream;
35357
+ return;
35358
+ }
35359
+
35360
+ const reader = stream.getReader();
35361
+ try {
35362
+ for (;;) {
35363
+ const { done, value } = await reader.read();
35364
+ if (done) {
35365
+ break;
34670
35366
  }
35367
+ yield value;
34671
35368
  }
35369
+ } finally {
35370
+ await reader.cancel();
35371
+ }
35372
+ };
35373
+
35374
+ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
35375
+ const iterator = readBytes(stream, chunkSize);
35376
+
35377
+ let bytes = 0;
35378
+ let done;
35379
+ let _onFinish = (e) => {
35380
+ if (!done) {
35381
+ done = true;
35382
+ onFinish && onFinish(e);
35383
+ }
35384
+ };
35385
+
35386
+ return new ReadableStream(
35387
+ {
35388
+ async pull(controller) {
35389
+ try {
35390
+ const { done, value } = await iterator.next();
35391
+
35392
+ if (done) {
35393
+ _onFinish();
35394
+ controller.close();
35395
+ return;
35396
+ }
35397
+
35398
+ let len = value.byteLength;
35399
+ if (onProgress) {
35400
+ let loadedBytes = (bytes += len);
35401
+ onProgress(loadedBytes);
35402
+ }
35403
+ controller.enqueue(new Uint8Array(value));
35404
+ } catch (err) {
35405
+ _onFinish(err);
35406
+ throw err;
35407
+ }
35408
+ },
35409
+ cancel(reason) {
35410
+ _onFinish(reason);
35411
+ return iterator.return();
35412
+ },
35413
+ },
35414
+ {
35415
+ highWaterMark: 2,
35416
+ }
35417
+ );
35418
+ };
35419
+
35420
+ const DEFAULT_CHUNK_SIZE = 64 * 1024;
35421
+
35422
+ const { isFunction: isFunction$1 } = utils$1;
35423
+
35424
+ const globalFetchAPI = (({ Request, Response }) => ({
35425
+ Request,
35426
+ Response,
35427
+ }))(utils$1.global);
35428
+
35429
+ const { ReadableStream: ReadableStream$1, TextEncoder: TextEncoder$1 } = utils$1.global;
35430
+
35431
+ const test = (fn, ...args) => {
35432
+ try {
35433
+ return !!fn(...args);
35434
+ } catch (e) {
35435
+ return false;
35436
+ }
35437
+ };
35438
+
35439
+ const factory = (env) => {
35440
+ env = utils$1.merge.call(
35441
+ {
35442
+ skipUndefined: true,
35443
+ },
35444
+ globalFetchAPI,
35445
+ env
35446
+ );
35447
+
35448
+ const { fetch: envFetch, Request, Response } = env;
35449
+ const isFetchSupported = envFetch ? isFunction$1(envFetch) : typeof fetch === 'function';
35450
+ const isRequestSupported = isFunction$1(Request);
35451
+ const isResponseSupported = isFunction$1(Response);
35452
+
35453
+ if (!isFetchSupported) {
35454
+ return false;
35455
+ }
35456
+
35457
+ const isReadableStreamSupported = isFetchSupported && isFunction$1(ReadableStream$1);
35458
+
35459
+ const encodeText =
35460
+ isFetchSupported &&
35461
+ (typeof TextEncoder$1 === 'function'
35462
+ ? (
35463
+ (encoder) => (str) =>
35464
+ encoder.encode(str)
35465
+ )(new TextEncoder$1())
35466
+ : async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
35467
+
35468
+ const supportsRequestStream =
35469
+ isRequestSupported &&
35470
+ isReadableStreamSupported &&
35471
+ test(() => {
35472
+ let duplexAccessed = false;
35473
+
35474
+ const body = new ReadableStream$1();
35475
+
35476
+ const hasContentType = new Request(platform.origin, {
35477
+ body,
35478
+ method: 'POST',
35479
+ get duplex() {
35480
+ duplexAccessed = true;
35481
+ return 'half';
35482
+ },
35483
+ }).headers.has('Content-Type');
35484
+
35485
+ body.cancel();
35486
+
35487
+ return duplexAccessed && !hasContentType;
35488
+ });
35489
+
35490
+ const supportsResponseStream =
35491
+ isResponseSupported &&
35492
+ isReadableStreamSupported &&
35493
+ test(() => utils$1.isReadableStream(new Response('').body));
34672
35494
 
34673
- // Remove Content-Type if data is undefined
34674
- requestData === undefined && requestHeaders.setContentType(null);
35495
+ const resolvers = {
35496
+ stream: supportsResponseStream && ((res) => res.body),
35497
+ };
35498
+
35499
+ isFetchSupported &&
35500
+ (() => {
35501
+ ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach((type) => {
35502
+ !resolvers[type] &&
35503
+ (resolvers[type] = (res, config) => {
35504
+ let method = res && res[type];
35505
+
35506
+ if (method) {
35507
+ return method.call(res);
35508
+ }
34675
35509
 
34676
- // Add headers to the request
34677
- if ('setRequestHeader' in request) {
34678
- utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
34679
- request.setRequestHeader(key, val);
35510
+ throw new AxiosError$1(
35511
+ `Response type '${type}' is not supported`,
35512
+ AxiosError$1.ERR_NOT_SUPPORT,
35513
+ config
35514
+ );
35515
+ });
34680
35516
  });
35517
+ })();
35518
+
35519
+ const getBodyLength = async (body) => {
35520
+ if (body == null) {
35521
+ return 0;
34681
35522
  }
34682
35523
 
34683
- // Add withCredentials to request if needed
34684
- if (!utils$1.isUndefined(config.withCredentials)) {
34685
- request.withCredentials = !!config.withCredentials;
35524
+ if (utils$1.isBlob(body)) {
35525
+ return body.size;
34686
35526
  }
34687
35527
 
34688
- // Add responseType to request if needed
34689
- if (responseType && responseType !== 'json') {
34690
- request.responseType = config.responseType;
35528
+ if (utils$1.isSpecCompliantForm(body)) {
35529
+ const _request = new Request(platform.origin, {
35530
+ method: 'POST',
35531
+ body,
35532
+ });
35533
+ return (await _request.arrayBuffer()).byteLength;
34691
35534
  }
34692
35535
 
34693
- // Handle progress if needed
34694
- if (typeof config.onDownloadProgress === 'function') {
34695
- request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
35536
+ if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
35537
+ return body.byteLength;
34696
35538
  }
34697
35539
 
34698
- // Not all browsers support upload events
34699
- if (typeof config.onUploadProgress === 'function' && request.upload) {
34700
- request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
35540
+ if (utils$1.isURLSearchParams(body)) {
35541
+ body = body + '';
34701
35542
  }
34702
35543
 
34703
- if (config.cancelToken || config.signal) {
34704
- // Handle cancellation
34705
- // eslint-disable-next-line func-names
34706
- onCanceled = cancel => {
34707
- if (!request) {
34708
- return;
35544
+ if (utils$1.isString(body)) {
35545
+ return (await encodeText(body)).byteLength;
35546
+ }
35547
+ };
35548
+
35549
+ const resolveBodyLength = async (headers, body) => {
35550
+ const length = utils$1.toFiniteNumber(headers.getContentLength());
35551
+
35552
+ return length == null ? getBodyLength(body) : length;
35553
+ };
35554
+
35555
+ return async (config) => {
35556
+ let {
35557
+ url,
35558
+ method,
35559
+ data,
35560
+ signal,
35561
+ cancelToken,
35562
+ timeout,
35563
+ onDownloadProgress,
35564
+ onUploadProgress,
35565
+ responseType,
35566
+ headers,
35567
+ withCredentials = 'same-origin',
35568
+ fetchOptions,
35569
+ } = resolveConfig(config);
35570
+
35571
+ let _fetch = envFetch || fetch;
35572
+
35573
+ responseType = responseType ? (responseType + '').toLowerCase() : 'text';
35574
+
35575
+ let composedSignal = composeSignals(
35576
+ [signal, cancelToken && cancelToken.toAbortSignal()],
35577
+ timeout
35578
+ );
35579
+
35580
+ let request = null;
35581
+
35582
+ const unsubscribe =
35583
+ composedSignal &&
35584
+ composedSignal.unsubscribe &&
35585
+ (() => {
35586
+ composedSignal.unsubscribe();
35587
+ });
35588
+
35589
+ let requestContentLength;
35590
+
35591
+ try {
35592
+ if (
35593
+ onUploadProgress &&
35594
+ supportsRequestStream &&
35595
+ method !== 'get' &&
35596
+ method !== 'head' &&
35597
+ (requestContentLength = await resolveBodyLength(headers, data)) !== 0
35598
+ ) {
35599
+ let _request = new Request(url, {
35600
+ method: 'POST',
35601
+ body: data,
35602
+ duplex: 'half',
35603
+ });
35604
+
35605
+ let contentTypeHeader;
35606
+
35607
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
35608
+ headers.setContentType(contentTypeHeader);
34709
35609
  }
34710
- reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
34711
- request.abort();
34712
- request = null;
35610
+
35611
+ if (_request.body) {
35612
+ const [onProgress, flush] = progressEventDecorator(
35613
+ requestContentLength,
35614
+ progressEventReducer(asyncDecorator(onUploadProgress))
35615
+ );
35616
+
35617
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
35618
+ }
35619
+ }
35620
+
35621
+ if (!utils$1.isString(withCredentials)) {
35622
+ withCredentials = withCredentials ? 'include' : 'omit';
35623
+ }
35624
+
35625
+ // Cloudflare Workers throws when credentials are defined
35626
+ // see https://github.com/cloudflare/workerd/issues/902
35627
+ const isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype;
35628
+
35629
+ const resolvedOptions = {
35630
+ ...fetchOptions,
35631
+ signal: composedSignal,
35632
+ method: method.toUpperCase(),
35633
+ headers: headers.normalize().toJSON(),
35634
+ body: data,
35635
+ duplex: 'half',
35636
+ credentials: isCredentialsSupported ? withCredentials : undefined,
34713
35637
  };
34714
35638
 
34715
- config.cancelToken && config.cancelToken.subscribe(onCanceled);
34716
- if (config.signal) {
34717
- config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
35639
+ request = isRequestSupported && new Request(url, resolvedOptions);
35640
+
35641
+ let response = await (isRequestSupported
35642
+ ? _fetch(request, fetchOptions)
35643
+ : _fetch(url, resolvedOptions));
35644
+
35645
+ const isStreamResponse =
35646
+ supportsResponseStream && (responseType === 'stream' || responseType === 'response');
35647
+
35648
+ if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
35649
+ const options = {};
35650
+
35651
+ ['status', 'statusText', 'headers'].forEach((prop) => {
35652
+ options[prop] = response[prop];
35653
+ });
35654
+
35655
+ const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
35656
+
35657
+ const [onProgress, flush] =
35658
+ (onDownloadProgress &&
35659
+ progressEventDecorator(
35660
+ responseContentLength,
35661
+ progressEventReducer(asyncDecorator(onDownloadProgress), true)
35662
+ )) ||
35663
+ [];
35664
+
35665
+ response = new Response(
35666
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
35667
+ flush && flush();
35668
+ unsubscribe && unsubscribe();
35669
+ }),
35670
+ options
35671
+ );
34718
35672
  }
34719
- }
34720
35673
 
34721
- const protocol = parseProtocol(fullPath);
35674
+ responseType = responseType || 'text';
34722
35675
 
34723
- if (protocol && platform.protocols.indexOf(protocol) === -1) {
34724
- reject(new AxiosError$1('Unsupported protocol ' + protocol + ':', AxiosError$1.ERR_BAD_REQUEST, config));
34725
- return;
35676
+ let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](
35677
+ response,
35678
+ config
35679
+ );
35680
+
35681
+ !isStreamResponse && unsubscribe && unsubscribe();
35682
+
35683
+ return await new Promise((resolve, reject) => {
35684
+ settle(resolve, reject, {
35685
+ data: responseData,
35686
+ headers: AxiosHeaders$1.from(response.headers),
35687
+ status: response.status,
35688
+ statusText: response.statusText,
35689
+ config,
35690
+ request,
35691
+ });
35692
+ });
35693
+ } catch (err) {
35694
+ unsubscribe && unsubscribe();
35695
+
35696
+ if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
35697
+ throw Object.assign(
35698
+ new AxiosError$1(
35699
+ 'Network Error',
35700
+ AxiosError$1.ERR_NETWORK,
35701
+ config,
35702
+ request,
35703
+ err && err.response
35704
+ ),
35705
+ {
35706
+ cause: err.cause || err,
35707
+ }
35708
+ );
35709
+ }
35710
+
35711
+ throw AxiosError$1.from(err, err && err.code, config, request, err && err.response);
34726
35712
  }
35713
+ };
35714
+ };
34727
35715
 
35716
+ const seedCache = new Map();
34728
35717
 
34729
- // Send the request
34730
- request.send(requestData || null);
34731
- });
35718
+ const getFetch = (config) => {
35719
+ let env = (config && config.env) || {};
35720
+ const { fetch, Request, Response } = env;
35721
+ const seeds = [Request, Response, fetch];
35722
+
35723
+ let len = seeds.length,
35724
+ i = len,
35725
+ seed,
35726
+ target,
35727
+ map = seedCache;
35728
+
35729
+ while (i--) {
35730
+ seed = seeds[i];
35731
+ target = map.get(seed);
35732
+
35733
+ target === undefined && map.set(seed, (target = i ? new Map() : factory(env)));
35734
+
35735
+ map = target;
35736
+ }
35737
+
35738
+ return target;
34732
35739
  };
34733
35740
 
35741
+ getFetch();
35742
+
35743
+ /**
35744
+ * Known adapters mapping.
35745
+ * Provides environment-specific adapters for Axios:
35746
+ * - `http` for Node.js
35747
+ * - `xhr` for browsers
35748
+ * - `fetch` for fetch API-based requests
35749
+ *
35750
+ * @type {Object<string, Function|Object>}
35751
+ */
34734
35752
  const knownAdapters = {
34735
35753
  http: httpAdapter,
34736
- xhr: xhrAdapter
35754
+ xhr: xhrAdapter,
35755
+ fetch: {
35756
+ get: getFetch,
35757
+ },
34737
35758
  };
34738
35759
 
35760
+ // Assign adapter names for easier debugging and identification
34739
35761
  utils$1.forEach(knownAdapters, (fn, value) => {
34740
35762
  if (fn) {
34741
35763
  try {
34742
- Object.defineProperty(fn, 'name', {value});
35764
+ Object.defineProperty(fn, 'name', { value });
34743
35765
  } catch (e) {
34744
35766
  // eslint-disable-next-line no-empty
34745
35767
  }
34746
- Object.defineProperty(fn, 'adapterName', {value});
35768
+ Object.defineProperty(fn, 'adapterName', { value });
34747
35769
  }
34748
35770
  });
34749
35771
 
35772
+ /**
35773
+ * Render a rejection reason string for unknown or unsupported adapters
35774
+ *
35775
+ * @param {string} reason
35776
+ * @returns {string}
35777
+ */
34750
35778
  const renderReason = (reason) => `- ${reason}`;
34751
35779
 
34752
- const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
35780
+ /**
35781
+ * Check if the adapter is resolved (function, null, or false)
35782
+ *
35783
+ * @param {Function|null|false} adapter
35784
+ * @returns {boolean}
35785
+ */
35786
+ const isResolvedHandle = (adapter) =>
35787
+ utils$1.isFunction(adapter) || adapter === null || adapter === false;
34753
35788
 
34754
- var adapters = {
34755
- getAdapter: (adapters) => {
34756
- adapters = utils$1.isArray(adapters) ? adapters : [adapters];
35789
+ /**
35790
+ * Get the first suitable adapter from the provided list.
35791
+ * Tries each adapter in order until a supported one is found.
35792
+ * Throws an AxiosError if no adapter is suitable.
35793
+ *
35794
+ * @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
35795
+ * @param {Object} config - Axios request configuration
35796
+ * @throws {AxiosError} If no suitable adapter is available
35797
+ * @returns {Function} The resolved adapter function
35798
+ */
35799
+ function getAdapter$1(adapters, config) {
35800
+ adapters = utils$1.isArray(adapters) ? adapters : [adapters];
34757
35801
 
34758
- const {length} = adapters;
34759
- let nameOrAdapter;
34760
- let adapter;
35802
+ const { length } = adapters;
35803
+ let nameOrAdapter;
35804
+ let adapter;
34761
35805
 
34762
- const rejectedReasons = {};
35806
+ const rejectedReasons = {};
34763
35807
 
34764
- for (let i = 0; i < length; i++) {
34765
- nameOrAdapter = adapters[i];
34766
- let id;
35808
+ for (let i = 0; i < length; i++) {
35809
+ nameOrAdapter = adapters[i];
35810
+ let id;
34767
35811
 
34768
- adapter = nameOrAdapter;
35812
+ adapter = nameOrAdapter;
34769
35813
 
34770
- if (!isResolvedHandle(nameOrAdapter)) {
34771
- adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
35814
+ if (!isResolvedHandle(nameOrAdapter)) {
35815
+ adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
34772
35816
 
34773
- if (adapter === undefined) {
34774
- throw new AxiosError$1(`Unknown adapter '${id}'`);
34775
- }
34776
- }
34777
-
34778
- if (adapter) {
34779
- break;
35817
+ if (adapter === undefined) {
35818
+ throw new AxiosError$1(`Unknown adapter '${id}'`);
34780
35819
  }
35820
+ }
34781
35821
 
34782
- rejectedReasons[id || '#' + i] = adapter;
35822
+ if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
35823
+ break;
34783
35824
  }
34784
35825
 
34785
- if (!adapter) {
35826
+ rejectedReasons[id || '#' + i] = adapter;
35827
+ }
34786
35828
 
34787
- const reasons = Object.entries(rejectedReasons)
34788
- .map(([id, state]) => `adapter ${id} ` +
34789
- (state === false ? 'is not supported by the environment' : 'is not available in the build')
34790
- );
35829
+ if (!adapter) {
35830
+ const reasons = Object.entries(rejectedReasons).map(
35831
+ ([id, state]) =>
35832
+ `adapter ${id} ` +
35833
+ (state === false ? 'is not supported by the environment' : 'is not available in the build')
35834
+ );
34791
35835
 
34792
- let s = length ?
34793
- (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
34794
- 'as no adapter specified';
35836
+ let s = length
35837
+ ? reasons.length > 1
35838
+ ? 'since :\n' + reasons.map(renderReason).join('\n')
35839
+ : ' ' + renderReason(reasons[0])
35840
+ : 'as no adapter specified';
34795
35841
 
34796
- throw new AxiosError$1(
34797
- `There is no suitable adapter to dispatch the request ` + s,
34798
- 'ERR_NOT_SUPPORT'
34799
- );
34800
- }
35842
+ throw new AxiosError$1(
35843
+ `There is no suitable adapter to dispatch the request ` + s,
35844
+ 'ERR_NOT_SUPPORT'
35845
+ );
35846
+ }
34801
35847
 
34802
- return adapter;
34803
- },
34804
- adapters: knownAdapters
35848
+ return adapter;
35849
+ }
35850
+
35851
+ /**
35852
+ * Exports Axios adapters and utility to resolve an adapter
35853
+ */
35854
+ var adapters = {
35855
+ /**
35856
+ * Resolve an adapter from a list of adapter names or functions.
35857
+ * @type {Function}
35858
+ */
35859
+ getAdapter: getAdapter$1,
35860
+
35861
+ /**
35862
+ * Exposes all known adapters
35863
+ * @type {Object<string, Function|Object>}
35864
+ */
35865
+ adapters: knownAdapters,
34805
35866
  };
34806
35867
 
34807
35868
  /**
@@ -34834,152 +35895,46 @@ var Neurosity = (function (exports) {
34834
35895
  config.headers = AxiosHeaders$1.from(config.headers);
34835
35896
 
34836
35897
  // Transform request data
34837
- config.data = transformData.call(
34838
- config,
34839
- config.transformRequest
34840
- );
35898
+ config.data = transformData.call(config, config.transformRequest);
34841
35899
 
34842
35900
  if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
34843
35901
  config.headers.setContentType('application/x-www-form-urlencoded', false);
34844
35902
  }
34845
35903
 
34846
- const adapter = adapters.getAdapter(config.adapter || defaults.adapter);
34847
-
34848
- return adapter(config).then(function onAdapterResolution(response) {
34849
- throwIfCancellationRequested(config);
34850
-
34851
- // Transform response data
34852
- response.data = transformData.call(
34853
- config,
34854
- config.transformResponse,
34855
- response
34856
- );
35904
+ const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
34857
35905
 
34858
- response.headers = AxiosHeaders$1.from(response.headers);
34859
-
34860
- return response;
34861
- }, function onAdapterRejection(reason) {
34862
- if (!isCancel$1(reason)) {
35906
+ return adapter(config).then(
35907
+ function onAdapterResolution(response) {
34863
35908
  throwIfCancellationRequested(config);
34864
35909
 
34865
35910
  // Transform response data
34866
- if (reason && reason.response) {
34867
- reason.response.data = transformData.call(
34868
- config,
34869
- config.transformResponse,
34870
- reason.response
34871
- );
34872
- reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
34873
- }
34874
- }
35911
+ response.data = transformData.call(config, config.transformResponse, response);
34875
35912
 
34876
- return Promise.reject(reason);
34877
- });
34878
- }
34879
-
34880
- const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? thing.toJSON() : thing;
35913
+ response.headers = AxiosHeaders$1.from(response.headers);
34881
35914
 
34882
- /**
34883
- * Config-specific merge-function which creates a new config-object
34884
- * by merging two configuration objects together.
34885
- *
34886
- * @param {Object} config1
34887
- * @param {Object} config2
34888
- *
34889
- * @returns {Object} New object resulting from merging config2 to config1
34890
- */
34891
- function mergeConfig$1(config1, config2) {
34892
- // eslint-disable-next-line no-param-reassign
34893
- config2 = config2 || {};
34894
- const config = {};
34895
-
34896
- function getMergedValue(target, source, caseless) {
34897
- if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
34898
- return utils$1.merge.call({caseless}, target, source);
34899
- } else if (utils$1.isPlainObject(source)) {
34900
- return utils$1.merge({}, source);
34901
- } else if (utils$1.isArray(source)) {
34902
- return source.slice();
34903
- }
34904
- return source;
34905
- }
34906
-
34907
- // eslint-disable-next-line consistent-return
34908
- function mergeDeepProperties(a, b, caseless) {
34909
- if (!utils$1.isUndefined(b)) {
34910
- return getMergedValue(a, b, caseless);
34911
- } else if (!utils$1.isUndefined(a)) {
34912
- return getMergedValue(undefined, a, caseless);
34913
- }
34914
- }
34915
-
34916
- // eslint-disable-next-line consistent-return
34917
- function valueFromConfig2(a, b) {
34918
- if (!utils$1.isUndefined(b)) {
34919
- return getMergedValue(undefined, b);
34920
- }
34921
- }
34922
-
34923
- // eslint-disable-next-line consistent-return
34924
- function defaultToConfig2(a, b) {
34925
- if (!utils$1.isUndefined(b)) {
34926
- return getMergedValue(undefined, b);
34927
- } else if (!utils$1.isUndefined(a)) {
34928
- return getMergedValue(undefined, a);
34929
- }
34930
- }
35915
+ return response;
35916
+ },
35917
+ function onAdapterRejection(reason) {
35918
+ if (!isCancel$1(reason)) {
35919
+ throwIfCancellationRequested(config);
35920
+
35921
+ // Transform response data
35922
+ if (reason && reason.response) {
35923
+ reason.response.data = transformData.call(
35924
+ config,
35925
+ config.transformResponse,
35926
+ reason.response
35927
+ );
35928
+ reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
35929
+ }
35930
+ }
34931
35931
 
34932
- // eslint-disable-next-line consistent-return
34933
- function mergeDirectKeys(a, b, prop) {
34934
- if (prop in config2) {
34935
- return getMergedValue(a, b);
34936
- } else if (prop in config1) {
34937
- return getMergedValue(undefined, a);
35932
+ return Promise.reject(reason);
34938
35933
  }
34939
- }
34940
-
34941
- const mergeMap = {
34942
- url: valueFromConfig2,
34943
- method: valueFromConfig2,
34944
- data: valueFromConfig2,
34945
- baseURL: defaultToConfig2,
34946
- transformRequest: defaultToConfig2,
34947
- transformResponse: defaultToConfig2,
34948
- paramsSerializer: defaultToConfig2,
34949
- timeout: defaultToConfig2,
34950
- timeoutMessage: defaultToConfig2,
34951
- withCredentials: defaultToConfig2,
34952
- withXSRFToken: defaultToConfig2,
34953
- adapter: defaultToConfig2,
34954
- responseType: defaultToConfig2,
34955
- xsrfCookieName: defaultToConfig2,
34956
- xsrfHeaderName: defaultToConfig2,
34957
- onUploadProgress: defaultToConfig2,
34958
- onDownloadProgress: defaultToConfig2,
34959
- decompress: defaultToConfig2,
34960
- maxContentLength: defaultToConfig2,
34961
- maxBodyLength: defaultToConfig2,
34962
- beforeRedirect: defaultToConfig2,
34963
- transport: defaultToConfig2,
34964
- httpAgent: defaultToConfig2,
34965
- httpsAgent: defaultToConfig2,
34966
- cancelToken: defaultToConfig2,
34967
- socketPath: defaultToConfig2,
34968
- responseEncoding: defaultToConfig2,
34969
- validateStatus: mergeDirectKeys,
34970
- headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
34971
- };
34972
-
34973
- utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
34974
- const merge = mergeMap[prop] || mergeDeepProperties;
34975
- const configValue = merge(config1[prop], config2[prop], prop);
34976
- (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
34977
- });
34978
-
34979
- return config;
35934
+ );
34980
35935
  }
34981
35936
 
34982
- const VERSION$1 = "1.6.2";
35937
+ const VERSION$1 = "1.15.0";
34983
35938
 
34984
35939
  const validators$1 = {};
34985
35940
 
@@ -35003,7 +35958,15 @@ var Neurosity = (function (exports) {
35003
35958
  */
35004
35959
  validators$1.transitional = function transitional(validator, version, message) {
35005
35960
  function formatMessage(opt, desc) {
35006
- return '[Axios v' + VERSION$1 + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
35961
+ return (
35962
+ '[Axios v' +
35963
+ VERSION$1 +
35964
+ "] Transitional option '" +
35965
+ opt +
35966
+ "'" +
35967
+ desc +
35968
+ (message ? '. ' + message : '')
35969
+ );
35007
35970
  }
35008
35971
 
35009
35972
  // eslint-disable-next-line func-names
@@ -35030,6 +35993,14 @@ var Neurosity = (function (exports) {
35030
35993
  };
35031
35994
  };
35032
35995
 
35996
+ validators$1.spelling = function spelling(correctSpelling) {
35997
+ return (value, opt) => {
35998
+ // eslint-disable-next-line no-console
35999
+ console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
36000
+ return true;
36001
+ };
36002
+ };
36003
+
35033
36004
  /**
35034
36005
  * Assert object's properties type
35035
36006
  *
@@ -35053,7 +36024,10 @@ var Neurosity = (function (exports) {
35053
36024
  const value = options[opt];
35054
36025
  const result = value === undefined || validator(value, opt, options);
35055
36026
  if (result !== true) {
35056
- throw new AxiosError$1('option ' + opt + ' must be ' + result, AxiosError$1.ERR_BAD_OPTION_VALUE);
36027
+ throw new AxiosError$1(
36028
+ 'option ' + opt + ' must be ' + result,
36029
+ AxiosError$1.ERR_BAD_OPTION_VALUE
36030
+ );
35057
36031
  }
35058
36032
  continue;
35059
36033
  }
@@ -35065,7 +36039,7 @@ var Neurosity = (function (exports) {
35065
36039
 
35066
36040
  var validator = {
35067
36041
  assertOptions,
35068
- validators: validators$1
36042
+ validators: validators$1,
35069
36043
  };
35070
36044
 
35071
36045
  const validators = validator.validators;
@@ -35079,10 +36053,10 @@ var Neurosity = (function (exports) {
35079
36053
  */
35080
36054
  let Axios$1 = class Axios {
35081
36055
  constructor(instanceConfig) {
35082
- this.defaults = instanceConfig;
36056
+ this.defaults = instanceConfig || {};
35083
36057
  this.interceptors = {
35084
36058
  request: new InterceptorManager(),
35085
- response: new InterceptorManager()
36059
+ response: new InterceptorManager(),
35086
36060
  };
35087
36061
  }
35088
36062
 
@@ -35094,7 +36068,50 @@ var Neurosity = (function (exports) {
35094
36068
  *
35095
36069
  * @returns {Promise} The Promise to be fulfilled
35096
36070
  */
35097
- request(configOrUrl, config) {
36071
+ async request(configOrUrl, config) {
36072
+ try {
36073
+ return await this._request(configOrUrl, config);
36074
+ } catch (err) {
36075
+ if (err instanceof Error) {
36076
+ let dummy = {};
36077
+
36078
+ Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
36079
+
36080
+ // slice off the Error: ... line
36081
+ const stack = (() => {
36082
+ if (!dummy.stack) {
36083
+ return '';
36084
+ }
36085
+
36086
+ const firstNewlineIndex = dummy.stack.indexOf('\n');
36087
+
36088
+ return firstNewlineIndex === -1 ? '' : dummy.stack.slice(firstNewlineIndex + 1);
36089
+ })();
36090
+ try {
36091
+ if (!err.stack) {
36092
+ err.stack = stack;
36093
+ // match without the 2 top stack lines
36094
+ } else if (stack) {
36095
+ const firstNewlineIndex = stack.indexOf('\n');
36096
+ const secondNewlineIndex =
36097
+ firstNewlineIndex === -1 ? -1 : stack.indexOf('\n', firstNewlineIndex + 1);
36098
+ const stackWithoutTwoTopLines =
36099
+ secondNewlineIndex === -1 ? '' : stack.slice(secondNewlineIndex + 1);
36100
+
36101
+ if (!String(err.stack).endsWith(stackWithoutTwoTopLines)) {
36102
+ err.stack += '\n' + stack;
36103
+ }
36104
+ }
36105
+ } catch (e) {
36106
+ // ignore the case where "stack" is an un-writable property
36107
+ }
36108
+ }
36109
+
36110
+ throw err;
36111
+ }
36112
+ }
36113
+
36114
+ _request(configOrUrl, config) {
35098
36115
  /*eslint no-param-reassign:0*/
35099
36116
  // Allow for axios('example/url'[, config]) a la fetch API
35100
36117
  if (typeof configOrUrl === 'string') {
@@ -35106,44 +36123,64 @@ var Neurosity = (function (exports) {
35106
36123
 
35107
36124
  config = mergeConfig$1(this.defaults, config);
35108
36125
 
35109
- const {transitional, paramsSerializer, headers} = config;
36126
+ const { transitional, paramsSerializer, headers } = config;
35110
36127
 
35111
36128
  if (transitional !== undefined) {
35112
- validator.assertOptions(transitional, {
35113
- silentJSONParsing: validators.transitional(validators.boolean),
35114
- forcedJSONParsing: validators.transitional(validators.boolean),
35115
- clarifyTimeoutError: validators.transitional(validators.boolean)
35116
- }, false);
36129
+ validator.assertOptions(
36130
+ transitional,
36131
+ {
36132
+ silentJSONParsing: validators.transitional(validators.boolean),
36133
+ forcedJSONParsing: validators.transitional(validators.boolean),
36134
+ clarifyTimeoutError: validators.transitional(validators.boolean),
36135
+ legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),
36136
+ },
36137
+ false
36138
+ );
35117
36139
  }
35118
36140
 
35119
36141
  if (paramsSerializer != null) {
35120
36142
  if (utils$1.isFunction(paramsSerializer)) {
35121
36143
  config.paramsSerializer = {
35122
- serialize: paramsSerializer
36144
+ serialize: paramsSerializer,
35123
36145
  };
35124
36146
  } else {
35125
- validator.assertOptions(paramsSerializer, {
35126
- encode: validators.function,
35127
- serialize: validators.function
35128
- }, true);
36147
+ validator.assertOptions(
36148
+ paramsSerializer,
36149
+ {
36150
+ encode: validators.function,
36151
+ serialize: validators.function,
36152
+ },
36153
+ true
36154
+ );
35129
36155
  }
35130
36156
  }
35131
36157
 
36158
+ // Set config.allowAbsoluteUrls
36159
+ if (config.allowAbsoluteUrls !== undefined) ; else if (this.defaults.allowAbsoluteUrls !== undefined) {
36160
+ config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
36161
+ } else {
36162
+ config.allowAbsoluteUrls = true;
36163
+ }
36164
+
36165
+ validator.assertOptions(
36166
+ config,
36167
+ {
36168
+ baseUrl: validators.spelling('baseURL'),
36169
+ withXsrfToken: validators.spelling('withXSRFToken'),
36170
+ },
36171
+ true
36172
+ );
36173
+
35132
36174
  // Set config.method
35133
36175
  config.method = (config.method || this.defaults.method || 'get').toLowerCase();
35134
36176
 
35135
36177
  // Flatten headers
35136
- let contextHeaders = headers && utils$1.merge(
35137
- headers.common,
35138
- headers[config.method]
35139
- );
36178
+ let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
35140
36179
 
35141
- headers && utils$1.forEach(
35142
- ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
35143
- (method) => {
36180
+ headers &&
36181
+ utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], (method) => {
35144
36182
  delete headers[method];
35145
- }
35146
- );
36183
+ });
35147
36184
 
35148
36185
  config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
35149
36186
 
@@ -35157,7 +36194,15 @@ var Neurosity = (function (exports) {
35157
36194
 
35158
36195
  synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
35159
36196
 
35160
- requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
36197
+ const transitional = config.transitional || transitionalDefaults;
36198
+ const legacyInterceptorReqResOrdering =
36199
+ transitional && transitional.legacyInterceptorReqResOrdering;
36200
+
36201
+ if (legacyInterceptorReqResOrdering) {
36202
+ requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
36203
+ } else {
36204
+ requestInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
36205
+ }
35161
36206
  });
35162
36207
 
35163
36208
  const responseInterceptorChain = [];
@@ -35171,8 +36216,8 @@ var Neurosity = (function (exports) {
35171
36216
 
35172
36217
  if (!synchronousRequestInterceptors) {
35173
36218
  const chain = [dispatchRequest.bind(this), undefined];
35174
- chain.unshift.apply(chain, requestInterceptorChain);
35175
- chain.push.apply(chain, responseInterceptorChain);
36219
+ chain.unshift(...requestInterceptorChain);
36220
+ chain.push(...responseInterceptorChain);
35176
36221
  len = chain.length;
35177
36222
 
35178
36223
  promise = Promise.resolve(config);
@@ -35188,8 +36233,6 @@ var Neurosity = (function (exports) {
35188
36233
 
35189
36234
  let newConfig = config;
35190
36235
 
35191
- i = 0;
35192
-
35193
36236
  while (i < len) {
35194
36237
  const onFulfilled = requestInterceptorChain[i++];
35195
36238
  const onRejected = requestInterceptorChain[i++];
@@ -35219,7 +36262,7 @@ var Neurosity = (function (exports) {
35219
36262
 
35220
36263
  getUri(config) {
35221
36264
  config = mergeConfig$1(this.defaults, config);
35222
- const fullPath = buildFullPath(config.baseURL, config.url);
36265
+ const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
35223
36266
  return buildURL(fullPath, config.params, config.paramsSerializer);
35224
36267
  }
35225
36268
  };
@@ -35227,28 +36270,32 @@ var Neurosity = (function (exports) {
35227
36270
  // Provide aliases for supported request methods
35228
36271
  utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
35229
36272
  /*eslint func-names:0*/
35230
- Axios$1.prototype[method] = function(url, config) {
35231
- return this.request(mergeConfig$1(config || {}, {
35232
- method,
35233
- url,
35234
- data: (config || {}).data
35235
- }));
36273
+ Axios$1.prototype[method] = function (url, config) {
36274
+ return this.request(
36275
+ mergeConfig$1(config || {}, {
36276
+ method,
36277
+ url,
36278
+ data: (config || {}).data,
36279
+ })
36280
+ );
35236
36281
  };
35237
36282
  });
35238
36283
 
35239
36284
  utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
35240
- /*eslint func-names:0*/
35241
-
35242
36285
  function generateHTTPMethod(isForm) {
35243
36286
  return function httpMethod(url, data, config) {
35244
- return this.request(mergeConfig$1(config || {}, {
35245
- method,
35246
- headers: isForm ? {
35247
- 'Content-Type': 'multipart/form-data'
35248
- } : {},
35249
- url,
35250
- data
35251
- }));
36287
+ return this.request(
36288
+ mergeConfig$1(config || {}, {
36289
+ method,
36290
+ headers: isForm
36291
+ ? {
36292
+ 'Content-Type': 'multipart/form-data',
36293
+ }
36294
+ : {},
36295
+ url,
36296
+ data,
36297
+ })
36298
+ );
35252
36299
  };
35253
36300
  }
35254
36301
 
@@ -35279,7 +36326,7 @@ var Neurosity = (function (exports) {
35279
36326
  const token = this;
35280
36327
 
35281
36328
  // eslint-disable-next-line func-names
35282
- this.promise.then(cancel => {
36329
+ this.promise.then((cancel) => {
35283
36330
  if (!token._listeners) return;
35284
36331
 
35285
36332
  let i = token._listeners.length;
@@ -35291,10 +36338,10 @@ var Neurosity = (function (exports) {
35291
36338
  });
35292
36339
 
35293
36340
  // eslint-disable-next-line func-names
35294
- this.promise.then = onfulfilled => {
36341
+ this.promise.then = (onfulfilled) => {
35295
36342
  let _resolve;
35296
36343
  // eslint-disable-next-line func-names
35297
- const promise = new Promise(resolve => {
36344
+ const promise = new Promise((resolve) => {
35298
36345
  token.subscribe(resolve);
35299
36346
  _resolve = resolve;
35300
36347
  }).then(onfulfilled);
@@ -35357,6 +36404,20 @@ var Neurosity = (function (exports) {
35357
36404
  }
35358
36405
  }
35359
36406
 
36407
+ toAbortSignal() {
36408
+ const controller = new AbortController();
36409
+
36410
+ const abort = (err) => {
36411
+ controller.abort(err);
36412
+ };
36413
+
36414
+ this.subscribe(abort);
36415
+
36416
+ controller.signal.unsubscribe = () => this.unsubscribe(abort);
36417
+
36418
+ return controller.signal;
36419
+ }
36420
+
35360
36421
  /**
35361
36422
  * Returns an object that contains a new `CancelToken` and a function that, when called,
35362
36423
  * cancels the `CancelToken`.
@@ -35368,7 +36429,7 @@ var Neurosity = (function (exports) {
35368
36429
  });
35369
36430
  return {
35370
36431
  token,
35371
- cancel
36432
+ cancel,
35372
36433
  };
35373
36434
  }
35374
36435
  };
@@ -35380,7 +36441,7 @@ var Neurosity = (function (exports) {
35380
36441
  *
35381
36442
  * ```js
35382
36443
  * function f(x, y, z) {}
35383
- * var args = [1, 2, 3];
36444
+ * const args = [1, 2, 3];
35384
36445
  * f.apply(null, args);
35385
36446
  * ```
35386
36447
  *
@@ -35408,7 +36469,7 @@ var Neurosity = (function (exports) {
35408
36469
  * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
35409
36470
  */
35410
36471
  function isAxiosError$1(payload) {
35411
- return utils$1.isObject(payload) && (payload.isAxiosError === true);
36472
+ return utils$1.isObject(payload) && payload.isAxiosError === true;
35412
36473
  }
35413
36474
 
35414
36475
  const HttpStatusCode$1 = {
@@ -35475,6 +36536,12 @@ var Neurosity = (function (exports) {
35475
36536
  LoopDetected: 508,
35476
36537
  NotExtended: 510,
35477
36538
  NetworkAuthenticationRequired: 511,
36539
+ WebServerIsDown: 521,
36540
+ ConnectionTimedOut: 522,
36541
+ OriginIsUnreachable: 523,
36542
+ TimeoutOccurred: 524,
36543
+ SslHandshakeFailed: 525,
36544
+ InvalidSslCertificate: 526,
35478
36545
  };
35479
36546
 
35480
36547
  Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
@@ -35493,10 +36560,10 @@ var Neurosity = (function (exports) {
35493
36560
  const instance = bind(Axios$1.prototype.request, context);
35494
36561
 
35495
36562
  // Copy axios.prototype to instance
35496
- utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
36563
+ utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
35497
36564
 
35498
36565
  // Copy context to instance
35499
- utils$1.extend(instance, context, null, {allOwnKeys: true});
36566
+ utils$1.extend(instance, context, null, { allOwnKeys: true });
35500
36567
 
35501
36568
  // Factory for creating new instances
35502
36569
  instance.create = function create(instanceConfig) {
@@ -35540,7 +36607,7 @@ var Neurosity = (function (exports) {
35540
36607
 
35541
36608
  axios.AxiosHeaders = AxiosHeaders$1;
35542
36609
 
35543
- axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
36610
+ axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
35544
36611
 
35545
36612
  axios.getAdapter = adapters.getAdapter;
35546
36613
 
@@ -35567,7 +36634,7 @@ var Neurosity = (function (exports) {
35567
36634
  HttpStatusCode,
35568
36635
  formToJSON,
35569
36636
  getAdapter,
35570
- mergeConfig
36637
+ mergeConfig,
35571
36638
  } = axios;
35572
36639
 
35573
36640
  const prodFunctionsBaseUrl = "https://us-central1-neurosity-device.cloudfunctions.net";
@@ -35959,7 +37026,7 @@ var Neurosity = (function (exports) {
35959
37026
  function requireBuffer () {
35960
37027
  if (hasRequiredBuffer) return buffer;
35961
37028
  hasRequiredBuffer = 1;
35962
- (function (exports) {
37029
+ (function (exports$1) {
35963
37030
 
35964
37031
  const base64 = requireBase64Js();
35965
37032
  const ieee754 = requireIeee754();
@@ -35968,12 +37035,12 @@ var Neurosity = (function (exports) {
35968
37035
  ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation
35969
37036
  : null;
35970
37037
 
35971
- exports.Buffer = Buffer;
35972
- exports.SlowBuffer = SlowBuffer;
35973
- exports.INSPECT_MAX_BYTES = 50;
37038
+ exports$1.Buffer = Buffer;
37039
+ exports$1.SlowBuffer = SlowBuffer;
37040
+ exports$1.INSPECT_MAX_BYTES = 50;
35974
37041
 
35975
37042
  const K_MAX_LENGTH = 0x7fffffff;
35976
- exports.kMaxLength = K_MAX_LENGTH;
37043
+ exports$1.kMaxLength = K_MAX_LENGTH;
35977
37044
 
35978
37045
  /**
35979
37046
  * If `Buffer.TYPED_ARRAY_SUPPORT`:
@@ -36569,7 +37636,7 @@ var Neurosity = (function (exports) {
36569
37636
 
36570
37637
  Buffer.prototype.inspect = function inspect () {
36571
37638
  let str = '';
36572
- const max = exports.INSPECT_MAX_BYTES;
37639
+ const max = exports$1.INSPECT_MAX_BYTES;
36573
37640
  str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim();
36574
37641
  if (this.length > max) str += ' ... ';
36575
37642
  return '<Buffer ' + str + '>'
@@ -38994,6 +40061,7 @@ var Neurosity = (function (exports) {
38994
40061
  this._brainwavesPowerByBand$ =
38995
40062
  this._subscribeWhileAuthenticated("powerByBand");
38996
40063
  this._signalQuality$ = this._subscribeWhileAuthenticated("signalQuality");
40064
+ this._signalQualityV2$ = this._subscribeWhileAuthenticated("signalQualityV2");
38997
40065
  this._status$ = this._subscribeWhileAuthenticated("status");
38998
40066
  this._settings$ = this._subscribeWhileAuthenticated("settings");
38999
40067
  this._wifiNearbyNetworks$ =
@@ -39130,6 +40198,9 @@ var Neurosity = (function (exports) {
39130
40198
  signalQuality() {
39131
40199
  return this._signalQuality$;
39132
40200
  }
40201
+ signalQualityV2() {
40202
+ return this._signalQualityV2$;
40203
+ }
39133
40204
  async addMarker(label) {
39134
40205
  await this.dispatchAction({
39135
40206
  action: "marker",
@@ -39292,20 +40363,20 @@ var Neurosity = (function (exports) {
39292
40363
  function requireRe () {
39293
40364
  if (hasRequiredRe) return re.exports;
39294
40365
  hasRequiredRe = 1;
39295
- (function (module, exports) {
40366
+ (function (module, exports$1) {
39296
40367
  const {
39297
40368
  MAX_SAFE_COMPONENT_LENGTH,
39298
40369
  MAX_SAFE_BUILD_LENGTH,
39299
40370
  MAX_LENGTH,
39300
40371
  } = requireConstants();
39301
40372
  const debug = requireDebug();
39302
- exports = module.exports = {};
40373
+ exports$1 = module.exports = {};
39303
40374
 
39304
40375
  // The actual regexps go on exports.re
39305
- const re = exports.re = [];
39306
- const safeRe = exports.safeRe = [];
39307
- const src = exports.src = [];
39308
- const t = exports.t = {};
40376
+ const re = exports$1.re = [];
40377
+ const safeRe = exports$1.safeRe = [];
40378
+ const src = exports$1.src = [];
40379
+ const t = exports$1.t = {};
39309
40380
  let R = 0;
39310
40381
 
39311
40382
  const LETTERDASHNUMBER = '[a-zA-Z0-9-]';
@@ -39466,7 +40537,7 @@ var Neurosity = (function (exports) {
39466
40537
  createToken('LONETILDE', '(?:~>?)');
39467
40538
 
39468
40539
  createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true);
39469
- exports.tildeTrimReplace = '$1~';
40540
+ exports$1.tildeTrimReplace = '$1~';
39470
40541
 
39471
40542
  createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
39472
40543
  createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
@@ -39476,7 +40547,7 @@ var Neurosity = (function (exports) {
39476
40547
  createToken('LONECARET', '(?:\\^)');
39477
40548
 
39478
40549
  createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true);
39479
- exports.caretTrimReplace = '$1^';
40550
+ exports$1.caretTrimReplace = '$1^';
39480
40551
 
39481
40552
  createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
39482
40553
  createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
@@ -39489,7 +40560,7 @@ var Neurosity = (function (exports) {
39489
40560
  // it modifies, so that `> 1.2.3` ==> `>1.2.3`
39490
40561
  createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
39491
40562
  }\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
39492
- exports.comparatorTrimReplace = '$1$2$3';
40563
+ exports$1.comparatorTrimReplace = '$1$2$3';
39493
40564
 
39494
40565
  // Something like `1.2.3 - 1.2.4`
39495
40566
  // Note that these all use the loose form, because they'll be
@@ -40271,6 +41342,127 @@ var Neurosity = (function (exports) {
40271
41342
  bluetooth: () => this.bluetoothClient.brainwaves(label)
40272
41343
  });
40273
41344
  }
41345
+ async record(options) {
41346
+ var _a;
41347
+ if (!(await this.cloudClient.didSelectDevice())) {
41348
+ return Promise.reject(mustSelectDevice);
41349
+ }
41350
+ const [hasOAuthError, OAuthError] = validateScopeBasedPermissionForAction(this.cloudClient.userClaims, {
41351
+ command: "brainwaves",
41352
+ action: "record"});
41353
+ if (hasOAuthError) {
41354
+ return Promise.reject(OAuthError);
41355
+ }
41356
+ if (!options.label) {
41357
+ return Promise.reject(new Error(`${prefix}A label is required for record.`));
41358
+ }
41359
+ if (!options.duration || options.duration <= 0) {
41360
+ return Promise.reject(new Error(`${prefix}A positive duration is required for record.`));
41361
+ }
41362
+ const MAX_DURATION = 30 * 60 * 1000;
41363
+ if (options.duration > MAX_DURATION) {
41364
+ return Promise.reject(new Error(`${prefix}Duration ${options.duration}ms exceeds maximum of ${MAX_DURATION}ms (30 minutes).`));
41365
+ }
41366
+ const response = await this.dispatchAction({
41367
+ command: "brainwaves",
41368
+ action: "record",
41369
+ message: {
41370
+ name: options.name || options.label,
41371
+ label: options.label,
41372
+ duration: options.duration,
41373
+ experimentId: options.experimentId || "sdk-recording"
41374
+ },
41375
+ responseRequired: true,
41376
+ responseTimeout: options.duration + 90000
41377
+ });
41378
+ return (_a = response === null || response === void 0 ? void 0 : response.message) !== null && _a !== void 0 ? _a : response;
41379
+ }
41380
+ async startRecording(options) {
41381
+ var _a;
41382
+ if (!(await this.cloudClient.didSelectDevice())) {
41383
+ return Promise.reject(mustSelectDevice);
41384
+ }
41385
+ const [hasOAuthError, OAuthError] = validateScopeBasedPermissionForAction(this.cloudClient.userClaims, {
41386
+ command: "brainwaves",
41387
+ action: "startRecording"});
41388
+ if (hasOAuthError) {
41389
+ return Promise.reject(OAuthError);
41390
+ }
41391
+ if (!options.label) {
41392
+ return Promise.reject(new Error(`${prefix}A label is required for startRecording.`));
41393
+ }
41394
+ if (!options.maxDuration || options.maxDuration <= 0) {
41395
+ return Promise.reject(new Error(`${prefix}A positive maxDuration is required for startRecording.`));
41396
+ }
41397
+ const MAX_DURATION = 30 * 60 * 1000;
41398
+ if (options.maxDuration > MAX_DURATION) {
41399
+ return Promise.reject(new Error(`${prefix}Duration ${options.maxDuration}ms exceeds maximum of ${MAX_DURATION}ms (30 minutes).`));
41400
+ }
41401
+ const response = await this.dispatchAction({
41402
+ command: "brainwaves",
41403
+ action: "startRecording",
41404
+ message: {
41405
+ name: options.name || options.label,
41406
+ label: options.label,
41407
+ maxDuration: options.maxDuration,
41408
+ experimentId: options.experimentId || "sdk-recording"
41409
+ },
41410
+ responseRequired: true,
41411
+ responseTimeout: options.maxDuration + 10000
41412
+ });
41413
+ const startResponse = (_a = response === null || response === void 0 ? void 0 : response.message) !== null && _a !== void 0 ? _a : response;
41414
+ if (!(startResponse === null || startResponse === void 0 ? void 0 : startResponse.ok)) {
41415
+ return Promise.reject(new Error(`${prefix}Failed to start recording: ${(startResponse === null || startResponse === void 0 ? void 0 : startResponse.error) || "unknown error"}`));
41416
+ }
41417
+ const { cancel: cancelAction, complete: completeAction } = startResponse;
41418
+ const startTime = Date.now();
41419
+ let stopped = false;
41420
+ let resolveResult;
41421
+ const resultPromise = new Promise((resolve) => {
41422
+ resolveResult = resolve;
41423
+ });
41424
+ const elapsedSubscribers = new Set();
41425
+ const elapsed$ = new Observable((subscriber) => {
41426
+ elapsedSubscribers.add(subscriber);
41427
+ const timer = setInterval(() => {
41428
+ subscriber.next(Date.now() - startTime);
41429
+ }, 1000);
41430
+ return () => {
41431
+ clearInterval(timer);
41432
+ elapsedSubscribers.delete(subscriber);
41433
+ };
41434
+ });
41435
+ const completeAllElapsed = () => {
41436
+ for (const sub of elapsedSubscribers) {
41437
+ sub.complete();
41438
+ }
41439
+ };
41440
+ const stop = async () => {
41441
+ var _a, _b;
41442
+ if (stopped)
41443
+ return resultPromise;
41444
+ stopped = true;
41445
+ completeAllElapsed();
41446
+ const stopResponse = await this.dispatchAction(completeAction);
41447
+ 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 };
41448
+ resolveResult(result);
41449
+ return result;
41450
+ };
41451
+ const cancel = async () => {
41452
+ if (stopped)
41453
+ return;
41454
+ stopped = true;
41455
+ completeAllElapsed();
41456
+ await this.dispatchAction(cancelAction);
41457
+ resolveResult({ ok: false, error: "cancelled" });
41458
+ };
41459
+ return {
41460
+ elapsed$,
41461
+ stop,
41462
+ cancel,
41463
+ result: resultPromise
41464
+ };
41465
+ }
40274
41466
  calm() {
40275
41467
  const [hasOAuthError, OAuthError] = validateScopeBasedPermissionForFunctionName(this.cloudClient.userClaims, "calm");
40276
41468
  if (hasOAuthError) {
@@ -40300,6 +41492,21 @@ var Neurosity = (function (exports) {
40300
41492
  bluetooth: () => this.bluetoothClient.signalQuality()
40301
41493
  });
40302
41494
  }
41495
+ signalQualityV2() {
41496
+ const metric = "signalQualityV2";
41497
+ const [hasOAuthError, OAuthError] = validateScopeBasedPermissionForFunctionName(this.cloudClient.userClaims, "signalQuality");
41498
+ if (hasOAuthError) {
41499
+ return throwError(() => OAuthError);
41500
+ }
41501
+ return this._withStreamingModeObservable({
41502
+ wifi: () => getCloudMetric(this._getCloudMetricDependencies(), {
41503
+ metric,
41504
+ labels: getLabels(metric),
41505
+ atomic: true
41506
+ }),
41507
+ bluetooth: () => this.bluetoothClient.signalQualityV2()
41508
+ });
41509
+ }
40303
41510
  settings() {
40304
41511
  const [hasOAuthError, OAuthError] = validateScopeBasedPermissionForFunctionName(this.cloudClient.userClaims, "settings");
40305
41512
  if (hasOAuthError) {