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