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