@neurosity/sdk 6.5.8 → 6.5.10
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/browser/neurosity.iife.js +2322 -979
- package/dist/browser/neurosity.js +98 -66
- package/dist/browser/neurosity.js.map +1 -1
- package/dist/cjs/Neurosity.d.ts +5 -0
- package/dist/cjs/Neurosity.js +7 -1
- package/dist/electron/index.js +2 -2
- package/dist/electron/index.js.map +1 -1
- package/dist/esm/Neurosity.d.ts +5 -0
- package/dist/esm/Neurosity.js +5 -0
- package/dist/esm/neurosity.mjs +2359 -954
- package/dist/examples/neurosity.iife.js +2322 -979
- package/dist/examples/neurosity.js +98 -66
- package/dist/examples/neurosity.mjs +2359 -954
- package/package.json +2 -2
|
@@ -41775,6 +41775,7 @@ var Neurosity = (function (exports) {
|
|
|
41775
41775
|
};
|
|
41776
41776
|
|
|
41777
41777
|
const SERVER_TIMESTAMP$1 = firebase.database.ServerValue.TIMESTAMP;
|
|
41778
|
+
const __firebase = firebase;
|
|
41778
41779
|
/**
|
|
41779
41780
|
* @hidden
|
|
41780
41781
|
*/
|
|
@@ -43688,79 +43689,78 @@ var Neurosity = (function (exports) {
|
|
|
43688
43689
|
return new Error(`${prefix}You are trying to access data with an OAuth token without access to the following scopes: ${requiredScopes.join(", ")}.`);
|
|
43689
43690
|
}
|
|
43690
43691
|
|
|
43691
|
-
|
|
43692
|
+
function bind$1(fn, thisArg) {
|
|
43692
43693
|
return function wrap() {
|
|
43693
|
-
|
|
43694
|
-
for (var i = 0; i < args.length; i++) {
|
|
43695
|
-
args[i] = arguments[i];
|
|
43696
|
-
}
|
|
43697
|
-
return fn.apply(thisArg, args);
|
|
43694
|
+
return fn.apply(thisArg, arguments);
|
|
43698
43695
|
};
|
|
43699
|
-
}
|
|
43696
|
+
}
|
|
43700
43697
|
|
|
43701
43698
|
// utils is a library of generic helper functions non-specific to axios
|
|
43702
43699
|
|
|
43703
|
-
|
|
43700
|
+
const {toString} = Object.prototype;
|
|
43701
|
+
const {getPrototypeOf: getPrototypeOf$1} = Object;
|
|
43702
|
+
|
|
43703
|
+
const kindOf = (cache => thing => {
|
|
43704
|
+
const str = toString.call(thing);
|
|
43705
|
+
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
|
43706
|
+
})(Object.create(null));
|
|
43707
|
+
|
|
43708
|
+
const kindOfTest = (type) => {
|
|
43709
|
+
type = type.toLowerCase();
|
|
43710
|
+
return (thing) => kindOf(thing) === type
|
|
43711
|
+
};
|
|
43712
|
+
|
|
43713
|
+
const typeOfTest = type => thing => typeof thing === type;
|
|
43704
43714
|
|
|
43705
43715
|
/**
|
|
43706
43716
|
* Determine if a value is an Array
|
|
43707
43717
|
*
|
|
43708
43718
|
* @param {Object} val The value to test
|
|
43719
|
+
*
|
|
43709
43720
|
* @returns {boolean} True if value is an Array, otherwise false
|
|
43710
43721
|
*/
|
|
43711
|
-
|
|
43712
|
-
return Array.isArray(val);
|
|
43713
|
-
}
|
|
43722
|
+
const {isArray: isArray$4} = Array;
|
|
43714
43723
|
|
|
43715
43724
|
/**
|
|
43716
43725
|
* Determine if a value is undefined
|
|
43717
43726
|
*
|
|
43718
|
-
* @param {
|
|
43727
|
+
* @param {*} val The value to test
|
|
43728
|
+
*
|
|
43719
43729
|
* @returns {boolean} True if the value is undefined, otherwise false
|
|
43720
43730
|
*/
|
|
43721
|
-
|
|
43722
|
-
return typeof val === 'undefined';
|
|
43723
|
-
}
|
|
43731
|
+
const isUndefined = typeOfTest('undefined');
|
|
43724
43732
|
|
|
43725
43733
|
/**
|
|
43726
43734
|
* Determine if a value is a Buffer
|
|
43727
43735
|
*
|
|
43728
|
-
* @param {
|
|
43736
|
+
* @param {*} val The value to test
|
|
43737
|
+
*
|
|
43729
43738
|
* @returns {boolean} True if value is a Buffer, otherwise false
|
|
43730
43739
|
*/
|
|
43731
43740
|
function isBuffer(val) {
|
|
43732
43741
|
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
|
|
43733
|
-
&&
|
|
43742
|
+
&& isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
43734
43743
|
}
|
|
43735
43744
|
|
|
43736
43745
|
/**
|
|
43737
43746
|
* Determine if a value is an ArrayBuffer
|
|
43738
43747
|
*
|
|
43739
|
-
* @param {
|
|
43748
|
+
* @param {*} val The value to test
|
|
43749
|
+
*
|
|
43740
43750
|
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
|
43741
43751
|
*/
|
|
43742
|
-
|
|
43743
|
-
return toString.call(val) === '[object ArrayBuffer]';
|
|
43744
|
-
}
|
|
43752
|
+
const isArrayBuffer = kindOfTest('ArrayBuffer');
|
|
43745
43753
|
|
|
43746
|
-
/**
|
|
43747
|
-
* Determine if a value is a FormData
|
|
43748
|
-
*
|
|
43749
|
-
* @param {Object} val The value to test
|
|
43750
|
-
* @returns {boolean} True if value is an FormData, otherwise false
|
|
43751
|
-
*/
|
|
43752
|
-
function isFormData(val) {
|
|
43753
|
-
return toString.call(val) === '[object FormData]';
|
|
43754
|
-
}
|
|
43755
43754
|
|
|
43756
43755
|
/**
|
|
43757
43756
|
* Determine if a value is a view on an ArrayBuffer
|
|
43758
43757
|
*
|
|
43759
|
-
* @param {
|
|
43758
|
+
* @param {*} val The value to test
|
|
43759
|
+
*
|
|
43760
43760
|
* @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
|
|
43761
43761
|
*/
|
|
43762
43762
|
function isArrayBufferView(val) {
|
|
43763
|
-
|
|
43763
|
+
let result;
|
|
43764
43764
|
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
|
|
43765
43765
|
result = ArrayBuffer.isView(val);
|
|
43766
43766
|
} else {
|
|
@@ -43772,144 +43772,145 @@ var Neurosity = (function (exports) {
|
|
|
43772
43772
|
/**
|
|
43773
43773
|
* Determine if a value is a String
|
|
43774
43774
|
*
|
|
43775
|
-
* @param {
|
|
43775
|
+
* @param {*} val The value to test
|
|
43776
|
+
*
|
|
43776
43777
|
* @returns {boolean} True if value is a String, otherwise false
|
|
43777
43778
|
*/
|
|
43778
|
-
|
|
43779
|
-
|
|
43780
|
-
|
|
43779
|
+
const isString = typeOfTest('string');
|
|
43780
|
+
|
|
43781
|
+
/**
|
|
43782
|
+
* Determine if a value is a Function
|
|
43783
|
+
*
|
|
43784
|
+
* @param {*} val The value to test
|
|
43785
|
+
* @returns {boolean} True if value is a Function, otherwise false
|
|
43786
|
+
*/
|
|
43787
|
+
const isFunction$1 = typeOfTest('function');
|
|
43781
43788
|
|
|
43782
43789
|
/**
|
|
43783
43790
|
* Determine if a value is a Number
|
|
43784
43791
|
*
|
|
43785
|
-
* @param {
|
|
43792
|
+
* @param {*} val The value to test
|
|
43793
|
+
*
|
|
43786
43794
|
* @returns {boolean} True if value is a Number, otherwise false
|
|
43787
43795
|
*/
|
|
43788
|
-
|
|
43789
|
-
return typeof val === 'number';
|
|
43790
|
-
}
|
|
43796
|
+
const isNumber = typeOfTest('number');
|
|
43791
43797
|
|
|
43792
43798
|
/**
|
|
43793
43799
|
* Determine if a value is an Object
|
|
43794
43800
|
*
|
|
43795
|
-
* @param {
|
|
43801
|
+
* @param {*} thing The value to test
|
|
43802
|
+
*
|
|
43796
43803
|
* @returns {boolean} True if value is an Object, otherwise false
|
|
43797
43804
|
*/
|
|
43798
|
-
|
|
43799
|
-
|
|
43800
|
-
|
|
43805
|
+
const isObject$1 = (thing) => thing !== null && typeof thing === 'object';
|
|
43806
|
+
|
|
43807
|
+
/**
|
|
43808
|
+
* Determine if a value is a Boolean
|
|
43809
|
+
*
|
|
43810
|
+
* @param {*} thing The value to test
|
|
43811
|
+
* @returns {boolean} True if value is a Boolean, otherwise false
|
|
43812
|
+
*/
|
|
43813
|
+
const isBoolean = thing => thing === true || thing === false;
|
|
43801
43814
|
|
|
43802
43815
|
/**
|
|
43803
43816
|
* Determine if a value is a plain Object
|
|
43804
43817
|
*
|
|
43805
|
-
* @param {
|
|
43806
|
-
*
|
|
43818
|
+
* @param {*} val The value to test
|
|
43819
|
+
*
|
|
43820
|
+
* @returns {boolean} True if value is a plain Object, otherwise false
|
|
43807
43821
|
*/
|
|
43808
|
-
|
|
43809
|
-
if (
|
|
43822
|
+
const isPlainObject = (val) => {
|
|
43823
|
+
if (kindOf(val) !== 'object') {
|
|
43810
43824
|
return false;
|
|
43811
43825
|
}
|
|
43812
43826
|
|
|
43813
|
-
|
|
43814
|
-
return prototype === null || prototype === Object.prototype;
|
|
43815
|
-
}
|
|
43827
|
+
const prototype = getPrototypeOf$1(val);
|
|
43828
|
+
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
|
|
43829
|
+
};
|
|
43816
43830
|
|
|
43817
43831
|
/**
|
|
43818
43832
|
* Determine if a value is a Date
|
|
43819
43833
|
*
|
|
43820
|
-
* @param {
|
|
43834
|
+
* @param {*} val The value to test
|
|
43835
|
+
*
|
|
43821
43836
|
* @returns {boolean} True if value is a Date, otherwise false
|
|
43822
43837
|
*/
|
|
43823
|
-
|
|
43824
|
-
return toString.call(val) === '[object Date]';
|
|
43825
|
-
}
|
|
43838
|
+
const isDate = kindOfTest('Date');
|
|
43826
43839
|
|
|
43827
43840
|
/**
|
|
43828
43841
|
* Determine if a value is a File
|
|
43829
43842
|
*
|
|
43830
|
-
* @param {
|
|
43843
|
+
* @param {*} val The value to test
|
|
43844
|
+
*
|
|
43831
43845
|
* @returns {boolean} True if value is a File, otherwise false
|
|
43832
43846
|
*/
|
|
43833
|
-
|
|
43834
|
-
return toString.call(val) === '[object File]';
|
|
43835
|
-
}
|
|
43847
|
+
const isFile = kindOfTest('File');
|
|
43836
43848
|
|
|
43837
43849
|
/**
|
|
43838
43850
|
* Determine if a value is a Blob
|
|
43839
43851
|
*
|
|
43840
|
-
* @param {
|
|
43852
|
+
* @param {*} val The value to test
|
|
43853
|
+
*
|
|
43841
43854
|
* @returns {boolean} True if value is a Blob, otherwise false
|
|
43842
43855
|
*/
|
|
43843
|
-
|
|
43844
|
-
return toString.call(val) === '[object Blob]';
|
|
43845
|
-
}
|
|
43856
|
+
const isBlob = kindOfTest('Blob');
|
|
43846
43857
|
|
|
43847
43858
|
/**
|
|
43848
|
-
* Determine if a value is a
|
|
43859
|
+
* Determine if a value is a FileList
|
|
43849
43860
|
*
|
|
43850
|
-
* @param {
|
|
43851
|
-
*
|
|
43861
|
+
* @param {*} val The value to test
|
|
43862
|
+
*
|
|
43863
|
+
* @returns {boolean} True if value is a File, otherwise false
|
|
43852
43864
|
*/
|
|
43853
|
-
|
|
43854
|
-
return toString.call(val) === '[object Function]';
|
|
43855
|
-
}
|
|
43865
|
+
const isFileList = kindOfTest('FileList');
|
|
43856
43866
|
|
|
43857
43867
|
/**
|
|
43858
43868
|
* Determine if a value is a Stream
|
|
43859
43869
|
*
|
|
43860
|
-
* @param {
|
|
43870
|
+
* @param {*} val The value to test
|
|
43871
|
+
*
|
|
43861
43872
|
* @returns {boolean} True if value is a Stream, otherwise false
|
|
43862
43873
|
*/
|
|
43863
|
-
|
|
43864
|
-
return isObject$1(val) && isFunction$1(val.pipe);
|
|
43865
|
-
}
|
|
43874
|
+
const isStream = (val) => isObject$1(val) && isFunction$1(val.pipe);
|
|
43866
43875
|
|
|
43867
43876
|
/**
|
|
43868
|
-
* Determine if a value is a
|
|
43877
|
+
* Determine if a value is a FormData
|
|
43869
43878
|
*
|
|
43870
|
-
* @param {
|
|
43871
|
-
*
|
|
43879
|
+
* @param {*} thing The value to test
|
|
43880
|
+
*
|
|
43881
|
+
* @returns {boolean} True if value is an FormData, otherwise false
|
|
43872
43882
|
*/
|
|
43873
|
-
|
|
43874
|
-
|
|
43875
|
-
|
|
43883
|
+
const isFormData = (thing) => {
|
|
43884
|
+
let kind;
|
|
43885
|
+
return thing && (
|
|
43886
|
+
(typeof FormData === 'function' && thing instanceof FormData) || (
|
|
43887
|
+
isFunction$1(thing.append) && (
|
|
43888
|
+
(kind = kindOf(thing)) === 'formdata' ||
|
|
43889
|
+
// detect form-data instance
|
|
43890
|
+
(kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
|
|
43891
|
+
)
|
|
43892
|
+
)
|
|
43893
|
+
)
|
|
43894
|
+
};
|
|
43876
43895
|
|
|
43877
43896
|
/**
|
|
43878
|
-
*
|
|
43897
|
+
* Determine if a value is a URLSearchParams object
|
|
43879
43898
|
*
|
|
43880
|
-
* @param {
|
|
43881
|
-
*
|
|
43899
|
+
* @param {*} val The value to test
|
|
43900
|
+
*
|
|
43901
|
+
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
|
43882
43902
|
*/
|
|
43883
|
-
|
|
43884
|
-
return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, '');
|
|
43885
|
-
}
|
|
43903
|
+
const isURLSearchParams = kindOfTest('URLSearchParams');
|
|
43886
43904
|
|
|
43887
43905
|
/**
|
|
43888
|
-
*
|
|
43889
|
-
*
|
|
43890
|
-
* This allows axios to run in a web worker, and react-native.
|
|
43891
|
-
* Both environments support XMLHttpRequest, but not fully standard globals.
|
|
43906
|
+
* Trim excess whitespace off the beginning and end of a string
|
|
43892
43907
|
*
|
|
43893
|
-
*
|
|
43894
|
-
* typeof window -> undefined
|
|
43895
|
-
* typeof document -> undefined
|
|
43908
|
+
* @param {String} str The String to trim
|
|
43896
43909
|
*
|
|
43897
|
-
*
|
|
43898
|
-
* navigator.product -> 'ReactNative'
|
|
43899
|
-
* nativescript
|
|
43900
|
-
* navigator.product -> 'NativeScript' or 'NS'
|
|
43910
|
+
* @returns {String} The String freed of excess whitespace
|
|
43901
43911
|
*/
|
|
43902
|
-
|
|
43903
|
-
|
|
43904
|
-
navigator.product === 'NativeScript' ||
|
|
43905
|
-
navigator.product === 'NS')) {
|
|
43906
|
-
return false;
|
|
43907
|
-
}
|
|
43908
|
-
return (
|
|
43909
|
-
typeof window !== 'undefined' &&
|
|
43910
|
-
typeof document !== 'undefined'
|
|
43911
|
-
);
|
|
43912
|
-
}
|
|
43912
|
+
const trim = (str) => str.trim ?
|
|
43913
|
+
str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
|
43913
43914
|
|
|
43914
43915
|
/**
|
|
43915
43916
|
* Iterate over an Array or an Object invoking a function for each item.
|
|
@@ -43922,13 +43923,19 @@ var Neurosity = (function (exports) {
|
|
|
43922
43923
|
*
|
|
43923
43924
|
* @param {Object|Array} obj The object to iterate
|
|
43924
43925
|
* @param {Function} fn The callback to invoke for each item
|
|
43926
|
+
*
|
|
43927
|
+
* @param {Boolean} [allOwnKeys = false]
|
|
43928
|
+
* @returns {any}
|
|
43925
43929
|
*/
|
|
43926
|
-
function forEach(obj, fn) {
|
|
43930
|
+
function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
43927
43931
|
// Don't bother if no value provided
|
|
43928
43932
|
if (obj === null || typeof obj === 'undefined') {
|
|
43929
43933
|
return;
|
|
43930
43934
|
}
|
|
43931
43935
|
|
|
43936
|
+
let i;
|
|
43937
|
+
let l;
|
|
43938
|
+
|
|
43932
43939
|
// Force an array if not already something iterable
|
|
43933
43940
|
if (typeof obj !== 'object') {
|
|
43934
43941
|
/*eslint no-param-reassign:0*/
|
|
@@ -43937,19 +43944,44 @@ var Neurosity = (function (exports) {
|
|
|
43937
43944
|
|
|
43938
43945
|
if (isArray$4(obj)) {
|
|
43939
43946
|
// Iterate over array values
|
|
43940
|
-
for (
|
|
43947
|
+
for (i = 0, l = obj.length; i < l; i++) {
|
|
43941
43948
|
fn.call(null, obj[i], i, obj);
|
|
43942
43949
|
}
|
|
43943
43950
|
} else {
|
|
43944
43951
|
// Iterate over object keys
|
|
43945
|
-
|
|
43946
|
-
|
|
43947
|
-
|
|
43948
|
-
|
|
43952
|
+
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
43953
|
+
const len = keys.length;
|
|
43954
|
+
let key;
|
|
43955
|
+
|
|
43956
|
+
for (i = 0; i < len; i++) {
|
|
43957
|
+
key = keys[i];
|
|
43958
|
+
fn.call(null, obj[key], key, obj);
|
|
43959
|
+
}
|
|
43960
|
+
}
|
|
43961
|
+
}
|
|
43962
|
+
|
|
43963
|
+
function findKey(obj, key) {
|
|
43964
|
+
key = key.toLowerCase();
|
|
43965
|
+
const keys = Object.keys(obj);
|
|
43966
|
+
let i = keys.length;
|
|
43967
|
+
let _key;
|
|
43968
|
+
while (i-- > 0) {
|
|
43969
|
+
_key = keys[i];
|
|
43970
|
+
if (key === _key.toLowerCase()) {
|
|
43971
|
+
return _key;
|
|
43949
43972
|
}
|
|
43950
43973
|
}
|
|
43974
|
+
return null;
|
|
43951
43975
|
}
|
|
43952
43976
|
|
|
43977
|
+
const _global = (() => {
|
|
43978
|
+
/*eslint no-undef:0*/
|
|
43979
|
+
if (typeof globalThis !== "undefined") return globalThis;
|
|
43980
|
+
return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global)
|
|
43981
|
+
})();
|
|
43982
|
+
|
|
43983
|
+
const isContextDefined = (context) => !isUndefined(context) && context !== _global;
|
|
43984
|
+
|
|
43953
43985
|
/**
|
|
43954
43986
|
* Accepts varargs expecting each argument to be an object, then
|
|
43955
43987
|
* immutably merges the properties of each object and returns result.
|
|
@@ -43965,268 +43997,1619 @@ var Neurosity = (function (exports) {
|
|
|
43965
43997
|
* ```
|
|
43966
43998
|
*
|
|
43967
43999
|
* @param {Object} obj1 Object to merge
|
|
44000
|
+
*
|
|
43968
44001
|
* @returns {Object} Result of all merge properties
|
|
43969
44002
|
*/
|
|
43970
44003
|
function merge$2(/* obj1, obj2, obj3, ... */) {
|
|
43971
|
-
|
|
43972
|
-
|
|
43973
|
-
|
|
43974
|
-
|
|
44004
|
+
const {caseless} = isContextDefined(this) && this || {};
|
|
44005
|
+
const result = {};
|
|
44006
|
+
const assignValue = (val, key) => {
|
|
44007
|
+
const targetKey = caseless && findKey(result, key) || key;
|
|
44008
|
+
if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
|
|
44009
|
+
result[targetKey] = merge$2(result[targetKey], val);
|
|
43975
44010
|
} else if (isPlainObject(val)) {
|
|
43976
|
-
result[
|
|
44011
|
+
result[targetKey] = merge$2({}, val);
|
|
43977
44012
|
} else if (isArray$4(val)) {
|
|
43978
|
-
result[
|
|
44013
|
+
result[targetKey] = val.slice();
|
|
43979
44014
|
} else {
|
|
43980
|
-
result[
|
|
44015
|
+
result[targetKey] = val;
|
|
43981
44016
|
}
|
|
43982
|
-
}
|
|
44017
|
+
};
|
|
43983
44018
|
|
|
43984
|
-
for (
|
|
43985
|
-
forEach(arguments[i], assignValue);
|
|
44019
|
+
for (let i = 0, l = arguments.length; i < l; i++) {
|
|
44020
|
+
arguments[i] && forEach(arguments[i], assignValue);
|
|
43986
44021
|
}
|
|
43987
44022
|
return result;
|
|
43988
44023
|
}
|
|
43989
44024
|
|
|
43990
|
-
/**
|
|
43991
|
-
* Extends object a by mutably adding to it the properties of object b.
|
|
43992
|
-
*
|
|
43993
|
-
* @param {Object} a The object to be extended
|
|
43994
|
-
* @param {Object} b The object to copy properties from
|
|
43995
|
-
* @param {Object} thisArg The object to bind function to
|
|
43996
|
-
*
|
|
43997
|
-
|
|
43998
|
-
|
|
43999
|
-
|
|
44000
|
-
|
|
44001
|
-
|
|
44025
|
+
/**
|
|
44026
|
+
* Extends object a by mutably adding to it the properties of object b.
|
|
44027
|
+
*
|
|
44028
|
+
* @param {Object} a The object to be extended
|
|
44029
|
+
* @param {Object} b The object to copy properties from
|
|
44030
|
+
* @param {Object} thisArg The object to bind function to
|
|
44031
|
+
*
|
|
44032
|
+
* @param {Boolean} [allOwnKeys]
|
|
44033
|
+
* @returns {Object} The resulting value of object a
|
|
44034
|
+
*/
|
|
44035
|
+
const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
|
|
44036
|
+
forEach(b, (val, key) => {
|
|
44037
|
+
if (thisArg && isFunction$1(val)) {
|
|
44038
|
+
a[key] = bind$1(val, thisArg);
|
|
44039
|
+
} else {
|
|
44040
|
+
a[key] = val;
|
|
44041
|
+
}
|
|
44042
|
+
}, {allOwnKeys});
|
|
44043
|
+
return a;
|
|
44044
|
+
};
|
|
44045
|
+
|
|
44046
|
+
/**
|
|
44047
|
+
* Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
|
|
44048
|
+
*
|
|
44049
|
+
* @param {string} content with BOM
|
|
44050
|
+
*
|
|
44051
|
+
* @returns {string} content value without BOM
|
|
44052
|
+
*/
|
|
44053
|
+
const stripBOM = (content) => {
|
|
44054
|
+
if (content.charCodeAt(0) === 0xFEFF) {
|
|
44055
|
+
content = content.slice(1);
|
|
44056
|
+
}
|
|
44057
|
+
return content;
|
|
44058
|
+
};
|
|
44059
|
+
|
|
44060
|
+
/**
|
|
44061
|
+
* Inherit the prototype methods from one constructor into another
|
|
44062
|
+
* @param {function} constructor
|
|
44063
|
+
* @param {function} superConstructor
|
|
44064
|
+
* @param {object} [props]
|
|
44065
|
+
* @param {object} [descriptors]
|
|
44066
|
+
*
|
|
44067
|
+
* @returns {void}
|
|
44068
|
+
*/
|
|
44069
|
+
const inherits = (constructor, superConstructor, props, descriptors) => {
|
|
44070
|
+
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
|
44071
|
+
constructor.prototype.constructor = constructor;
|
|
44072
|
+
Object.defineProperty(constructor, 'super', {
|
|
44073
|
+
value: superConstructor.prototype
|
|
44074
|
+
});
|
|
44075
|
+
props && Object.assign(constructor.prototype, props);
|
|
44076
|
+
};
|
|
44077
|
+
|
|
44078
|
+
/**
|
|
44079
|
+
* Resolve object with deep prototype chain to a flat object
|
|
44080
|
+
* @param {Object} sourceObj source object
|
|
44081
|
+
* @param {Object} [destObj]
|
|
44082
|
+
* @param {Function|Boolean} [filter]
|
|
44083
|
+
* @param {Function} [propFilter]
|
|
44084
|
+
*
|
|
44085
|
+
* @returns {Object}
|
|
44086
|
+
*/
|
|
44087
|
+
const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
|
|
44088
|
+
let props;
|
|
44089
|
+
let i;
|
|
44090
|
+
let prop;
|
|
44091
|
+
const merged = {};
|
|
44092
|
+
|
|
44093
|
+
destObj = destObj || {};
|
|
44094
|
+
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
44095
|
+
if (sourceObj == null) return destObj;
|
|
44096
|
+
|
|
44097
|
+
do {
|
|
44098
|
+
props = Object.getOwnPropertyNames(sourceObj);
|
|
44099
|
+
i = props.length;
|
|
44100
|
+
while (i-- > 0) {
|
|
44101
|
+
prop = props[i];
|
|
44102
|
+
if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
|
|
44103
|
+
destObj[prop] = sourceObj[prop];
|
|
44104
|
+
merged[prop] = true;
|
|
44105
|
+
}
|
|
44106
|
+
}
|
|
44107
|
+
sourceObj = filter !== false && getPrototypeOf$1(sourceObj);
|
|
44108
|
+
} while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
|
44109
|
+
|
|
44110
|
+
return destObj;
|
|
44111
|
+
};
|
|
44112
|
+
|
|
44113
|
+
/**
|
|
44114
|
+
* Determines whether a string ends with the characters of a specified string
|
|
44115
|
+
*
|
|
44116
|
+
* @param {String} str
|
|
44117
|
+
* @param {String} searchString
|
|
44118
|
+
* @param {Number} [position= 0]
|
|
44119
|
+
*
|
|
44120
|
+
* @returns {boolean}
|
|
44121
|
+
*/
|
|
44122
|
+
const endsWith = (str, searchString, position) => {
|
|
44123
|
+
str = String(str);
|
|
44124
|
+
if (position === undefined || position > str.length) {
|
|
44125
|
+
position = str.length;
|
|
44126
|
+
}
|
|
44127
|
+
position -= searchString.length;
|
|
44128
|
+
const lastIndex = str.indexOf(searchString, position);
|
|
44129
|
+
return lastIndex !== -1 && lastIndex === position;
|
|
44130
|
+
};
|
|
44131
|
+
|
|
44132
|
+
|
|
44133
|
+
/**
|
|
44134
|
+
* Returns new array from array like object or null if failed
|
|
44135
|
+
*
|
|
44136
|
+
* @param {*} [thing]
|
|
44137
|
+
*
|
|
44138
|
+
* @returns {?Array}
|
|
44139
|
+
*/
|
|
44140
|
+
const toArray$1 = (thing) => {
|
|
44141
|
+
if (!thing) return null;
|
|
44142
|
+
if (isArray$4(thing)) return thing;
|
|
44143
|
+
let i = thing.length;
|
|
44144
|
+
if (!isNumber(i)) return null;
|
|
44145
|
+
const arr = new Array(i);
|
|
44146
|
+
while (i-- > 0) {
|
|
44147
|
+
arr[i] = thing[i];
|
|
44148
|
+
}
|
|
44149
|
+
return arr;
|
|
44150
|
+
};
|
|
44151
|
+
|
|
44152
|
+
/**
|
|
44153
|
+
* Checking if the Uint8Array exists and if it does, it returns a function that checks if the
|
|
44154
|
+
* thing passed in is an instance of Uint8Array
|
|
44155
|
+
*
|
|
44156
|
+
* @param {TypedArray}
|
|
44157
|
+
*
|
|
44158
|
+
* @returns {Array}
|
|
44159
|
+
*/
|
|
44160
|
+
// eslint-disable-next-line func-names
|
|
44161
|
+
const isTypedArray = (TypedArray => {
|
|
44162
|
+
// eslint-disable-next-line func-names
|
|
44163
|
+
return thing => {
|
|
44164
|
+
return TypedArray && thing instanceof TypedArray;
|
|
44165
|
+
};
|
|
44166
|
+
})(typeof Uint8Array !== 'undefined' && getPrototypeOf$1(Uint8Array));
|
|
44167
|
+
|
|
44168
|
+
/**
|
|
44169
|
+
* For each entry in the object, call the function with the key and value.
|
|
44170
|
+
*
|
|
44171
|
+
* @param {Object<any, any>} obj - The object to iterate over.
|
|
44172
|
+
* @param {Function} fn - The function to call for each entry.
|
|
44173
|
+
*
|
|
44174
|
+
* @returns {void}
|
|
44175
|
+
*/
|
|
44176
|
+
const forEachEntry = (obj, fn) => {
|
|
44177
|
+
const generator = obj && obj[Symbol.iterator];
|
|
44178
|
+
|
|
44179
|
+
const iterator = generator.call(obj);
|
|
44180
|
+
|
|
44181
|
+
let result;
|
|
44182
|
+
|
|
44183
|
+
while ((result = iterator.next()) && !result.done) {
|
|
44184
|
+
const pair = result.value;
|
|
44185
|
+
fn.call(obj, pair[0], pair[1]);
|
|
44186
|
+
}
|
|
44187
|
+
};
|
|
44188
|
+
|
|
44189
|
+
/**
|
|
44190
|
+
* It takes a regular expression and a string, and returns an array of all the matches
|
|
44191
|
+
*
|
|
44192
|
+
* @param {string} regExp - The regular expression to match against.
|
|
44193
|
+
* @param {string} str - The string to search.
|
|
44194
|
+
*
|
|
44195
|
+
* @returns {Array<boolean>}
|
|
44196
|
+
*/
|
|
44197
|
+
const matchAll = (regExp, str) => {
|
|
44198
|
+
let matches;
|
|
44199
|
+
const arr = [];
|
|
44200
|
+
|
|
44201
|
+
while ((matches = regExp.exec(str)) !== null) {
|
|
44202
|
+
arr.push(matches);
|
|
44203
|
+
}
|
|
44204
|
+
|
|
44205
|
+
return arr;
|
|
44206
|
+
};
|
|
44207
|
+
|
|
44208
|
+
/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
|
|
44209
|
+
const isHTMLForm = kindOfTest('HTMLFormElement');
|
|
44210
|
+
|
|
44211
|
+
const toCamelCase = str => {
|
|
44212
|
+
return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,
|
|
44213
|
+
function replacer(m, p1, p2) {
|
|
44214
|
+
return p1.toUpperCase() + p2;
|
|
44215
|
+
}
|
|
44216
|
+
);
|
|
44217
|
+
};
|
|
44218
|
+
|
|
44219
|
+
/* Creating a function that will check if an object has a property. */
|
|
44220
|
+
const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
|
|
44221
|
+
|
|
44222
|
+
/**
|
|
44223
|
+
* Determine if a value is a RegExp object
|
|
44224
|
+
*
|
|
44225
|
+
* @param {*} val The value to test
|
|
44226
|
+
*
|
|
44227
|
+
* @returns {boolean} True if value is a RegExp object, otherwise false
|
|
44228
|
+
*/
|
|
44229
|
+
const isRegExp = kindOfTest('RegExp');
|
|
44230
|
+
|
|
44231
|
+
const reduceDescriptors = (obj, reducer) => {
|
|
44232
|
+
const descriptors = Object.getOwnPropertyDescriptors(obj);
|
|
44233
|
+
const reducedDescriptors = {};
|
|
44234
|
+
|
|
44235
|
+
forEach(descriptors, (descriptor, name) => {
|
|
44236
|
+
let ret;
|
|
44237
|
+
if ((ret = reducer(descriptor, name, obj)) !== false) {
|
|
44238
|
+
reducedDescriptors[name] = ret || descriptor;
|
|
44239
|
+
}
|
|
44240
|
+
});
|
|
44241
|
+
|
|
44242
|
+
Object.defineProperties(obj, reducedDescriptors);
|
|
44243
|
+
};
|
|
44244
|
+
|
|
44245
|
+
/**
|
|
44246
|
+
* Makes all methods read-only
|
|
44247
|
+
* @param {Object} obj
|
|
44248
|
+
*/
|
|
44249
|
+
|
|
44250
|
+
const freezeMethods = (obj) => {
|
|
44251
|
+
reduceDescriptors(obj, (descriptor, name) => {
|
|
44252
|
+
// skip restricted props in strict mode
|
|
44253
|
+
if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
|
44254
|
+
return false;
|
|
44255
|
+
}
|
|
44256
|
+
|
|
44257
|
+
const value = obj[name];
|
|
44258
|
+
|
|
44259
|
+
if (!isFunction$1(value)) return;
|
|
44260
|
+
|
|
44261
|
+
descriptor.enumerable = false;
|
|
44262
|
+
|
|
44263
|
+
if ('writable' in descriptor) {
|
|
44264
|
+
descriptor.writable = false;
|
|
44265
|
+
return;
|
|
44266
|
+
}
|
|
44267
|
+
|
|
44268
|
+
if (!descriptor.set) {
|
|
44269
|
+
descriptor.set = () => {
|
|
44270
|
+
throw Error('Can not rewrite read-only method \'' + name + '\'');
|
|
44271
|
+
};
|
|
44272
|
+
}
|
|
44273
|
+
});
|
|
44274
|
+
};
|
|
44275
|
+
|
|
44276
|
+
const toObjectSet = (arrayOrString, delimiter) => {
|
|
44277
|
+
const obj = {};
|
|
44278
|
+
|
|
44279
|
+
const define = (arr) => {
|
|
44280
|
+
arr.forEach(value => {
|
|
44281
|
+
obj[value] = true;
|
|
44282
|
+
});
|
|
44283
|
+
};
|
|
44284
|
+
|
|
44285
|
+
isArray$4(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
|
|
44286
|
+
|
|
44287
|
+
return obj;
|
|
44288
|
+
};
|
|
44289
|
+
|
|
44290
|
+
const noop$2 = () => {};
|
|
44291
|
+
|
|
44292
|
+
const toFiniteNumber = (value, defaultValue) => {
|
|
44293
|
+
value = +value;
|
|
44294
|
+
return Number.isFinite(value) ? value : defaultValue;
|
|
44295
|
+
};
|
|
44296
|
+
|
|
44297
|
+
const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
|
|
44298
|
+
|
|
44299
|
+
const DIGIT = '0123456789';
|
|
44300
|
+
|
|
44301
|
+
const ALPHABET = {
|
|
44302
|
+
DIGIT,
|
|
44303
|
+
ALPHA,
|
|
44304
|
+
ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
|
|
44305
|
+
};
|
|
44306
|
+
|
|
44307
|
+
const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
|
|
44308
|
+
let str = '';
|
|
44309
|
+
const {length} = alphabet;
|
|
44310
|
+
while (size--) {
|
|
44311
|
+
str += alphabet[Math.random() * length|0];
|
|
44312
|
+
}
|
|
44313
|
+
|
|
44314
|
+
return str;
|
|
44315
|
+
};
|
|
44316
|
+
|
|
44317
|
+
/**
|
|
44318
|
+
* If the thing is a FormData object, return true, otherwise return false.
|
|
44319
|
+
*
|
|
44320
|
+
* @param {unknown} thing - The thing to check.
|
|
44321
|
+
*
|
|
44322
|
+
* @returns {boolean}
|
|
44323
|
+
*/
|
|
44324
|
+
function isSpecCompliantForm(thing) {
|
|
44325
|
+
return !!(thing && isFunction$1(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
|
|
44326
|
+
}
|
|
44327
|
+
|
|
44328
|
+
const toJSONObject = (obj) => {
|
|
44329
|
+
const stack = new Array(10);
|
|
44330
|
+
|
|
44331
|
+
const visit = (source, i) => {
|
|
44332
|
+
|
|
44333
|
+
if (isObject$1(source)) {
|
|
44334
|
+
if (stack.indexOf(source) >= 0) {
|
|
44335
|
+
return;
|
|
44336
|
+
}
|
|
44337
|
+
|
|
44338
|
+
if(!('toJSON' in source)) {
|
|
44339
|
+
stack[i] = source;
|
|
44340
|
+
const target = isArray$4(source) ? [] : {};
|
|
44341
|
+
|
|
44342
|
+
forEach(source, (value, key) => {
|
|
44343
|
+
const reducedValue = visit(value, i + 1);
|
|
44344
|
+
!isUndefined(reducedValue) && (target[key] = reducedValue);
|
|
44345
|
+
});
|
|
44346
|
+
|
|
44347
|
+
stack[i] = undefined;
|
|
44348
|
+
|
|
44349
|
+
return target;
|
|
44350
|
+
}
|
|
44351
|
+
}
|
|
44352
|
+
|
|
44353
|
+
return source;
|
|
44354
|
+
};
|
|
44355
|
+
|
|
44356
|
+
return visit(obj, 0);
|
|
44357
|
+
};
|
|
44358
|
+
|
|
44359
|
+
const isAsyncFn = kindOfTest('AsyncFunction');
|
|
44360
|
+
|
|
44361
|
+
const isThenable = (thing) =>
|
|
44362
|
+
thing && (isObject$1(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
|
|
44363
|
+
|
|
44364
|
+
var utils = {
|
|
44365
|
+
isArray: isArray$4,
|
|
44366
|
+
isArrayBuffer,
|
|
44367
|
+
isBuffer,
|
|
44368
|
+
isFormData,
|
|
44369
|
+
isArrayBufferView,
|
|
44370
|
+
isString,
|
|
44371
|
+
isNumber,
|
|
44372
|
+
isBoolean,
|
|
44373
|
+
isObject: isObject$1,
|
|
44374
|
+
isPlainObject,
|
|
44375
|
+
isUndefined,
|
|
44376
|
+
isDate,
|
|
44377
|
+
isFile,
|
|
44378
|
+
isBlob,
|
|
44379
|
+
isRegExp,
|
|
44380
|
+
isFunction: isFunction$1,
|
|
44381
|
+
isStream,
|
|
44382
|
+
isURLSearchParams,
|
|
44383
|
+
isTypedArray,
|
|
44384
|
+
isFileList,
|
|
44385
|
+
forEach,
|
|
44386
|
+
merge: merge$2,
|
|
44387
|
+
extend,
|
|
44388
|
+
trim,
|
|
44389
|
+
stripBOM,
|
|
44390
|
+
inherits,
|
|
44391
|
+
toFlatObject,
|
|
44392
|
+
kindOf,
|
|
44393
|
+
kindOfTest,
|
|
44394
|
+
endsWith,
|
|
44395
|
+
toArray: toArray$1,
|
|
44396
|
+
forEachEntry,
|
|
44397
|
+
matchAll,
|
|
44398
|
+
isHTMLForm,
|
|
44399
|
+
hasOwnProperty,
|
|
44400
|
+
hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection
|
|
44401
|
+
reduceDescriptors,
|
|
44402
|
+
freezeMethods,
|
|
44403
|
+
toObjectSet,
|
|
44404
|
+
toCamelCase,
|
|
44405
|
+
noop: noop$2,
|
|
44406
|
+
toFiniteNumber,
|
|
44407
|
+
findKey,
|
|
44408
|
+
global: _global,
|
|
44409
|
+
isContextDefined,
|
|
44410
|
+
ALPHABET,
|
|
44411
|
+
generateString,
|
|
44412
|
+
isSpecCompliantForm,
|
|
44413
|
+
toJSONObject,
|
|
44414
|
+
isAsyncFn,
|
|
44415
|
+
isThenable
|
|
44416
|
+
};
|
|
44417
|
+
|
|
44418
|
+
/**
|
|
44419
|
+
* Create an Error with the specified message, config, error code, request and response.
|
|
44420
|
+
*
|
|
44421
|
+
* @param {string} message The error message.
|
|
44422
|
+
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
44423
|
+
* @param {Object} [config] The config.
|
|
44424
|
+
* @param {Object} [request] The request.
|
|
44425
|
+
* @param {Object} [response] The response.
|
|
44426
|
+
*
|
|
44427
|
+
* @returns {Error} The created error.
|
|
44428
|
+
*/
|
|
44429
|
+
function AxiosError(message, code, config, request, response) {
|
|
44430
|
+
Error.call(this);
|
|
44431
|
+
|
|
44432
|
+
if (Error.captureStackTrace) {
|
|
44433
|
+
Error.captureStackTrace(this, this.constructor);
|
|
44434
|
+
} else {
|
|
44435
|
+
this.stack = (new Error()).stack;
|
|
44436
|
+
}
|
|
44437
|
+
|
|
44438
|
+
this.message = message;
|
|
44439
|
+
this.name = 'AxiosError';
|
|
44440
|
+
code && (this.code = code);
|
|
44441
|
+
config && (this.config = config);
|
|
44442
|
+
request && (this.request = request);
|
|
44443
|
+
response && (this.response = response);
|
|
44444
|
+
}
|
|
44445
|
+
|
|
44446
|
+
utils.inherits(AxiosError, Error, {
|
|
44447
|
+
toJSON: function toJSON() {
|
|
44448
|
+
return {
|
|
44449
|
+
// Standard
|
|
44450
|
+
message: this.message,
|
|
44451
|
+
name: this.name,
|
|
44452
|
+
// Microsoft
|
|
44453
|
+
description: this.description,
|
|
44454
|
+
number: this.number,
|
|
44455
|
+
// Mozilla
|
|
44456
|
+
fileName: this.fileName,
|
|
44457
|
+
lineNumber: this.lineNumber,
|
|
44458
|
+
columnNumber: this.columnNumber,
|
|
44459
|
+
stack: this.stack,
|
|
44460
|
+
// Axios
|
|
44461
|
+
config: utils.toJSONObject(this.config),
|
|
44462
|
+
code: this.code,
|
|
44463
|
+
status: this.response && this.response.status ? this.response.status : null
|
|
44464
|
+
};
|
|
44465
|
+
}
|
|
44466
|
+
});
|
|
44467
|
+
|
|
44468
|
+
const prototype = AxiosError.prototype;
|
|
44469
|
+
const descriptors = {};
|
|
44470
|
+
|
|
44471
|
+
[
|
|
44472
|
+
'ERR_BAD_OPTION_VALUE',
|
|
44473
|
+
'ERR_BAD_OPTION',
|
|
44474
|
+
'ECONNABORTED',
|
|
44475
|
+
'ETIMEDOUT',
|
|
44476
|
+
'ERR_NETWORK',
|
|
44477
|
+
'ERR_FR_TOO_MANY_REDIRECTS',
|
|
44478
|
+
'ERR_DEPRECATED',
|
|
44479
|
+
'ERR_BAD_RESPONSE',
|
|
44480
|
+
'ERR_BAD_REQUEST',
|
|
44481
|
+
'ERR_CANCELED',
|
|
44482
|
+
'ERR_NOT_SUPPORT',
|
|
44483
|
+
'ERR_INVALID_URL'
|
|
44484
|
+
// eslint-disable-next-line func-names
|
|
44485
|
+
].forEach(code => {
|
|
44486
|
+
descriptors[code] = {value: code};
|
|
44487
|
+
});
|
|
44488
|
+
|
|
44489
|
+
Object.defineProperties(AxiosError, descriptors);
|
|
44490
|
+
Object.defineProperty(prototype, 'isAxiosError', {value: true});
|
|
44491
|
+
|
|
44492
|
+
// eslint-disable-next-line func-names
|
|
44493
|
+
AxiosError.from = (error, code, config, request, response, customProps) => {
|
|
44494
|
+
const axiosError = Object.create(prototype);
|
|
44495
|
+
|
|
44496
|
+
utils.toFlatObject(error, axiosError, function filter(obj) {
|
|
44497
|
+
return obj !== Error.prototype;
|
|
44498
|
+
}, prop => {
|
|
44499
|
+
return prop !== 'isAxiosError';
|
|
44500
|
+
});
|
|
44501
|
+
|
|
44502
|
+
AxiosError.call(axiosError, error.message, code, config, request, response);
|
|
44503
|
+
|
|
44504
|
+
axiosError.cause = error;
|
|
44505
|
+
|
|
44506
|
+
axiosError.name = error.name;
|
|
44507
|
+
|
|
44508
|
+
customProps && Object.assign(axiosError, customProps);
|
|
44509
|
+
|
|
44510
|
+
return axiosError;
|
|
44511
|
+
};
|
|
44512
|
+
|
|
44513
|
+
// eslint-disable-next-line strict
|
|
44514
|
+
var PlatformFormData = null;
|
|
44515
|
+
|
|
44516
|
+
/**
|
|
44517
|
+
* Determines if the given thing is a array or js object.
|
|
44518
|
+
*
|
|
44519
|
+
* @param {string} thing - The object or array to be visited.
|
|
44520
|
+
*
|
|
44521
|
+
* @returns {boolean}
|
|
44522
|
+
*/
|
|
44523
|
+
function isVisitable(thing) {
|
|
44524
|
+
return utils.isPlainObject(thing) || utils.isArray(thing);
|
|
44525
|
+
}
|
|
44526
|
+
|
|
44527
|
+
/**
|
|
44528
|
+
* It removes the brackets from the end of a string
|
|
44529
|
+
*
|
|
44530
|
+
* @param {string} key - The key of the parameter.
|
|
44531
|
+
*
|
|
44532
|
+
* @returns {string} the key without the brackets.
|
|
44533
|
+
*/
|
|
44534
|
+
function removeBrackets(key) {
|
|
44535
|
+
return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;
|
|
44536
|
+
}
|
|
44537
|
+
|
|
44538
|
+
/**
|
|
44539
|
+
* It takes a path, a key, and a boolean, and returns a string
|
|
44540
|
+
*
|
|
44541
|
+
* @param {string} path - The path to the current key.
|
|
44542
|
+
* @param {string} key - The key of the current object being iterated over.
|
|
44543
|
+
* @param {string} dots - If true, the key will be rendered with dots instead of brackets.
|
|
44544
|
+
*
|
|
44545
|
+
* @returns {string} The path to the current key.
|
|
44546
|
+
*/
|
|
44547
|
+
function renderKey(path, key, dots) {
|
|
44548
|
+
if (!path) return key;
|
|
44549
|
+
return path.concat(key).map(function each(token, i) {
|
|
44550
|
+
// eslint-disable-next-line no-param-reassign
|
|
44551
|
+
token = removeBrackets(token);
|
|
44552
|
+
return !dots && i ? '[' + token + ']' : token;
|
|
44553
|
+
}).join(dots ? '.' : '');
|
|
44554
|
+
}
|
|
44555
|
+
|
|
44556
|
+
/**
|
|
44557
|
+
* If the array is an array and none of its elements are visitable, then it's a flat array.
|
|
44558
|
+
*
|
|
44559
|
+
* @param {Array<any>} arr - The array to check
|
|
44560
|
+
*
|
|
44561
|
+
* @returns {boolean}
|
|
44562
|
+
*/
|
|
44563
|
+
function isFlatArray(arr) {
|
|
44564
|
+
return utils.isArray(arr) && !arr.some(isVisitable);
|
|
44565
|
+
}
|
|
44566
|
+
|
|
44567
|
+
const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
|
|
44568
|
+
return /^is[A-Z]/.test(prop);
|
|
44569
|
+
});
|
|
44570
|
+
|
|
44571
|
+
/**
|
|
44572
|
+
* Convert a data object to FormData
|
|
44573
|
+
*
|
|
44574
|
+
* @param {Object} obj
|
|
44575
|
+
* @param {?Object} [formData]
|
|
44576
|
+
* @param {?Object} [options]
|
|
44577
|
+
* @param {Function} [options.visitor]
|
|
44578
|
+
* @param {Boolean} [options.metaTokens = true]
|
|
44579
|
+
* @param {Boolean} [options.dots = false]
|
|
44580
|
+
* @param {?Boolean} [options.indexes = false]
|
|
44581
|
+
*
|
|
44582
|
+
* @returns {Object}
|
|
44583
|
+
**/
|
|
44584
|
+
|
|
44585
|
+
/**
|
|
44586
|
+
* It converts an object into a FormData object
|
|
44587
|
+
*
|
|
44588
|
+
* @param {Object<any, any>} obj - The object to convert to form data.
|
|
44589
|
+
* @param {string} formData - The FormData object to append to.
|
|
44590
|
+
* @param {Object<string, any>} options
|
|
44591
|
+
*
|
|
44592
|
+
* @returns
|
|
44593
|
+
*/
|
|
44594
|
+
function toFormData(obj, formData, options) {
|
|
44595
|
+
if (!utils.isObject(obj)) {
|
|
44596
|
+
throw new TypeError('target must be an object');
|
|
44597
|
+
}
|
|
44598
|
+
|
|
44599
|
+
// eslint-disable-next-line no-param-reassign
|
|
44600
|
+
formData = formData || new (FormData)();
|
|
44601
|
+
|
|
44602
|
+
// eslint-disable-next-line no-param-reassign
|
|
44603
|
+
options = utils.toFlatObject(options, {
|
|
44604
|
+
metaTokens: true,
|
|
44605
|
+
dots: false,
|
|
44606
|
+
indexes: false
|
|
44607
|
+
}, false, function defined(option, source) {
|
|
44608
|
+
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
44609
|
+
return !utils.isUndefined(source[option]);
|
|
44610
|
+
});
|
|
44611
|
+
|
|
44612
|
+
const metaTokens = options.metaTokens;
|
|
44613
|
+
// eslint-disable-next-line no-use-before-define
|
|
44614
|
+
const visitor = options.visitor || defaultVisitor;
|
|
44615
|
+
const dots = options.dots;
|
|
44616
|
+
const indexes = options.indexes;
|
|
44617
|
+
const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
|
|
44618
|
+
const useBlob = _Blob && utils.isSpecCompliantForm(formData);
|
|
44619
|
+
|
|
44620
|
+
if (!utils.isFunction(visitor)) {
|
|
44621
|
+
throw new TypeError('visitor must be a function');
|
|
44622
|
+
}
|
|
44623
|
+
|
|
44624
|
+
function convertValue(value) {
|
|
44625
|
+
if (value === null) return '';
|
|
44626
|
+
|
|
44627
|
+
if (utils.isDate(value)) {
|
|
44628
|
+
return value.toISOString();
|
|
44629
|
+
}
|
|
44630
|
+
|
|
44631
|
+
if (!useBlob && utils.isBlob(value)) {
|
|
44632
|
+
throw new AxiosError('Blob is not supported. Use a Buffer instead.');
|
|
44633
|
+
}
|
|
44634
|
+
|
|
44635
|
+
if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
|
|
44636
|
+
return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
|
|
44637
|
+
}
|
|
44638
|
+
|
|
44639
|
+
return value;
|
|
44640
|
+
}
|
|
44641
|
+
|
|
44642
|
+
/**
|
|
44643
|
+
* Default visitor.
|
|
44644
|
+
*
|
|
44645
|
+
* @param {*} value
|
|
44646
|
+
* @param {String|Number} key
|
|
44647
|
+
* @param {Array<String|Number>} path
|
|
44648
|
+
* @this {FormData}
|
|
44649
|
+
*
|
|
44650
|
+
* @returns {boolean} return true to visit the each prop of the value recursively
|
|
44651
|
+
*/
|
|
44652
|
+
function defaultVisitor(value, key, path) {
|
|
44653
|
+
let arr = value;
|
|
44654
|
+
|
|
44655
|
+
if (value && !path && typeof value === 'object') {
|
|
44656
|
+
if (utils.endsWith(key, '{}')) {
|
|
44657
|
+
// eslint-disable-next-line no-param-reassign
|
|
44658
|
+
key = metaTokens ? key : key.slice(0, -2);
|
|
44659
|
+
// eslint-disable-next-line no-param-reassign
|
|
44660
|
+
value = JSON.stringify(value);
|
|
44661
|
+
} else if (
|
|
44662
|
+
(utils.isArray(value) && isFlatArray(value)) ||
|
|
44663
|
+
((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))
|
|
44664
|
+
)) {
|
|
44665
|
+
// eslint-disable-next-line no-param-reassign
|
|
44666
|
+
key = removeBrackets(key);
|
|
44667
|
+
|
|
44668
|
+
arr.forEach(function each(el, index) {
|
|
44669
|
+
!(utils.isUndefined(el) || el === null) && formData.append(
|
|
44670
|
+
// eslint-disable-next-line no-nested-ternary
|
|
44671
|
+
indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
|
|
44672
|
+
convertValue(el)
|
|
44673
|
+
);
|
|
44674
|
+
});
|
|
44675
|
+
return false;
|
|
44676
|
+
}
|
|
44677
|
+
}
|
|
44678
|
+
|
|
44679
|
+
if (isVisitable(value)) {
|
|
44680
|
+
return true;
|
|
44681
|
+
}
|
|
44682
|
+
|
|
44683
|
+
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
44684
|
+
|
|
44685
|
+
return false;
|
|
44686
|
+
}
|
|
44687
|
+
|
|
44688
|
+
const stack = [];
|
|
44689
|
+
|
|
44690
|
+
const exposedHelpers = Object.assign(predicates, {
|
|
44691
|
+
defaultVisitor,
|
|
44692
|
+
convertValue,
|
|
44693
|
+
isVisitable
|
|
44694
|
+
});
|
|
44695
|
+
|
|
44696
|
+
function build(value, path) {
|
|
44697
|
+
if (utils.isUndefined(value)) return;
|
|
44698
|
+
|
|
44699
|
+
if (stack.indexOf(value) !== -1) {
|
|
44700
|
+
throw Error('Circular reference detected in ' + path.join('.'));
|
|
44701
|
+
}
|
|
44702
|
+
|
|
44703
|
+
stack.push(value);
|
|
44704
|
+
|
|
44705
|
+
utils.forEach(value, function each(el, key) {
|
|
44706
|
+
const result = !(utils.isUndefined(el) || el === null) && visitor.call(
|
|
44707
|
+
formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers
|
|
44708
|
+
);
|
|
44709
|
+
|
|
44710
|
+
if (result === true) {
|
|
44711
|
+
build(el, path ? path.concat(key) : [key]);
|
|
44712
|
+
}
|
|
44713
|
+
});
|
|
44714
|
+
|
|
44715
|
+
stack.pop();
|
|
44716
|
+
}
|
|
44717
|
+
|
|
44718
|
+
if (!utils.isObject(obj)) {
|
|
44719
|
+
throw new TypeError('data must be an object');
|
|
44720
|
+
}
|
|
44721
|
+
|
|
44722
|
+
build(obj);
|
|
44723
|
+
|
|
44724
|
+
return formData;
|
|
44725
|
+
}
|
|
44726
|
+
|
|
44727
|
+
/**
|
|
44728
|
+
* It encodes a string by replacing all characters that are not in the unreserved set with
|
|
44729
|
+
* their percent-encoded equivalents
|
|
44730
|
+
*
|
|
44731
|
+
* @param {string} str - The string to encode.
|
|
44732
|
+
*
|
|
44733
|
+
* @returns {string} The encoded string.
|
|
44734
|
+
*/
|
|
44735
|
+
function encode(str) {
|
|
44736
|
+
const charMap = {
|
|
44737
|
+
'!': '%21',
|
|
44738
|
+
"'": '%27',
|
|
44739
|
+
'(': '%28',
|
|
44740
|
+
')': '%29',
|
|
44741
|
+
'~': '%7E',
|
|
44742
|
+
'%20': '+',
|
|
44743
|
+
'%00': '\x00'
|
|
44744
|
+
};
|
|
44745
|
+
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
|
44746
|
+
return charMap[match];
|
|
44747
|
+
});
|
|
44748
|
+
}
|
|
44749
|
+
|
|
44750
|
+
/**
|
|
44751
|
+
* It takes a params object and converts it to a FormData object
|
|
44752
|
+
*
|
|
44753
|
+
* @param {Object<string, any>} params - The parameters to be converted to a FormData object.
|
|
44754
|
+
* @param {Object<string, any>} options - The options object passed to the Axios constructor.
|
|
44755
|
+
*
|
|
44756
|
+
* @returns {void}
|
|
44757
|
+
*/
|
|
44758
|
+
function AxiosURLSearchParams(params, options) {
|
|
44759
|
+
this._pairs = [];
|
|
44760
|
+
|
|
44761
|
+
params && toFormData(params, this, options);
|
|
44762
|
+
}
|
|
44763
|
+
|
|
44764
|
+
const prototype$1 = AxiosURLSearchParams.prototype;
|
|
44765
|
+
|
|
44766
|
+
prototype$1.append = function append(name, value) {
|
|
44767
|
+
this._pairs.push([name, value]);
|
|
44768
|
+
};
|
|
44769
|
+
|
|
44770
|
+
prototype$1.toString = function toString(encoder) {
|
|
44771
|
+
const _encode = encoder ? function(value) {
|
|
44772
|
+
return encoder.call(this, value, encode);
|
|
44773
|
+
} : encode;
|
|
44774
|
+
|
|
44775
|
+
return this._pairs.map(function each(pair) {
|
|
44776
|
+
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
|
44777
|
+
}, '').join('&');
|
|
44778
|
+
};
|
|
44779
|
+
|
|
44780
|
+
/**
|
|
44781
|
+
* It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
|
|
44782
|
+
* URI encoded counterparts
|
|
44783
|
+
*
|
|
44784
|
+
* @param {string} val The value to be encoded.
|
|
44785
|
+
*
|
|
44786
|
+
* @returns {string} The encoded value.
|
|
44787
|
+
*/
|
|
44788
|
+
function encode$1(val) {
|
|
44789
|
+
return encodeURIComponent(val).
|
|
44790
|
+
replace(/%3A/gi, ':').
|
|
44791
|
+
replace(/%24/g, '$').
|
|
44792
|
+
replace(/%2C/gi, ',').
|
|
44793
|
+
replace(/%20/g, '+').
|
|
44794
|
+
replace(/%5B/gi, '[').
|
|
44795
|
+
replace(/%5D/gi, ']');
|
|
44796
|
+
}
|
|
44797
|
+
|
|
44798
|
+
/**
|
|
44799
|
+
* Build a URL by appending params to the end
|
|
44800
|
+
*
|
|
44801
|
+
* @param {string} url The base of the url (e.g., http://www.google.com)
|
|
44802
|
+
* @param {object} [params] The params to be appended
|
|
44803
|
+
* @param {?object} options
|
|
44804
|
+
*
|
|
44805
|
+
* @returns {string} The formatted url
|
|
44806
|
+
*/
|
|
44807
|
+
function buildURL(url, params, options) {
|
|
44808
|
+
/*eslint no-param-reassign:0*/
|
|
44809
|
+
if (!params) {
|
|
44810
|
+
return url;
|
|
44811
|
+
}
|
|
44812
|
+
|
|
44813
|
+
const _encode = options && options.encode || encode$1;
|
|
44814
|
+
|
|
44815
|
+
const serializeFn = options && options.serialize;
|
|
44816
|
+
|
|
44817
|
+
let serializedParams;
|
|
44818
|
+
|
|
44819
|
+
if (serializeFn) {
|
|
44820
|
+
serializedParams = serializeFn(params, options);
|
|
44821
|
+
} else {
|
|
44822
|
+
serializedParams = utils.isURLSearchParams(params) ?
|
|
44823
|
+
params.toString() :
|
|
44824
|
+
new AxiosURLSearchParams(params, options).toString(_encode);
|
|
44825
|
+
}
|
|
44826
|
+
|
|
44827
|
+
if (serializedParams) {
|
|
44828
|
+
const hashmarkIndex = url.indexOf("#");
|
|
44829
|
+
|
|
44830
|
+
if (hashmarkIndex !== -1) {
|
|
44831
|
+
url = url.slice(0, hashmarkIndex);
|
|
44832
|
+
}
|
|
44833
|
+
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
|
|
44834
|
+
}
|
|
44835
|
+
|
|
44836
|
+
return url;
|
|
44837
|
+
}
|
|
44838
|
+
|
|
44839
|
+
class InterceptorManager {
|
|
44840
|
+
constructor() {
|
|
44841
|
+
this.handlers = [];
|
|
44842
|
+
}
|
|
44843
|
+
|
|
44844
|
+
/**
|
|
44845
|
+
* Add a new interceptor to the stack
|
|
44846
|
+
*
|
|
44847
|
+
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
44848
|
+
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
44849
|
+
*
|
|
44850
|
+
* @return {Number} An ID used to remove interceptor later
|
|
44851
|
+
*/
|
|
44852
|
+
use(fulfilled, rejected, options) {
|
|
44853
|
+
this.handlers.push({
|
|
44854
|
+
fulfilled,
|
|
44855
|
+
rejected,
|
|
44856
|
+
synchronous: options ? options.synchronous : false,
|
|
44857
|
+
runWhen: options ? options.runWhen : null
|
|
44858
|
+
});
|
|
44859
|
+
return this.handlers.length - 1;
|
|
44860
|
+
}
|
|
44861
|
+
|
|
44862
|
+
/**
|
|
44863
|
+
* Remove an interceptor from the stack
|
|
44864
|
+
*
|
|
44865
|
+
* @param {Number} id The ID that was returned by `use`
|
|
44866
|
+
*
|
|
44867
|
+
* @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
|
|
44868
|
+
*/
|
|
44869
|
+
eject(id) {
|
|
44870
|
+
if (this.handlers[id]) {
|
|
44871
|
+
this.handlers[id] = null;
|
|
44872
|
+
}
|
|
44873
|
+
}
|
|
44874
|
+
|
|
44875
|
+
/**
|
|
44876
|
+
* Clear all interceptors from the stack
|
|
44877
|
+
*
|
|
44878
|
+
* @returns {void}
|
|
44879
|
+
*/
|
|
44880
|
+
clear() {
|
|
44881
|
+
if (this.handlers) {
|
|
44882
|
+
this.handlers = [];
|
|
44883
|
+
}
|
|
44884
|
+
}
|
|
44885
|
+
|
|
44886
|
+
/**
|
|
44887
|
+
* Iterate over all the registered interceptors
|
|
44888
|
+
*
|
|
44889
|
+
* This method is particularly useful for skipping over any
|
|
44890
|
+
* interceptors that may have become `null` calling `eject`.
|
|
44891
|
+
*
|
|
44892
|
+
* @param {Function} fn The function to call for each interceptor
|
|
44893
|
+
*
|
|
44894
|
+
* @returns {void}
|
|
44895
|
+
*/
|
|
44896
|
+
forEach(fn) {
|
|
44897
|
+
utils.forEach(this.handlers, function forEachHandler(h) {
|
|
44898
|
+
if (h !== null) {
|
|
44899
|
+
fn(h);
|
|
44900
|
+
}
|
|
44901
|
+
});
|
|
44902
|
+
}
|
|
44903
|
+
}
|
|
44904
|
+
|
|
44905
|
+
var transitionalDefaults = {
|
|
44906
|
+
silentJSONParsing: true,
|
|
44907
|
+
forcedJSONParsing: true,
|
|
44908
|
+
clarifyTimeoutError: false
|
|
44909
|
+
};
|
|
44910
|
+
|
|
44911
|
+
var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
|
|
44912
|
+
|
|
44913
|
+
var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
|
|
44914
|
+
|
|
44915
|
+
var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
|
|
44916
|
+
|
|
44917
|
+
var platform = {
|
|
44918
|
+
isBrowser: true,
|
|
44919
|
+
classes: {
|
|
44920
|
+
URLSearchParams: URLSearchParams$1,
|
|
44921
|
+
FormData: FormData$1,
|
|
44922
|
+
Blob: Blob$1
|
|
44923
|
+
},
|
|
44924
|
+
protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
|
|
44925
|
+
};
|
|
44926
|
+
|
|
44927
|
+
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
44928
|
+
|
|
44929
|
+
/**
|
|
44930
|
+
* Determine if we're running in a standard browser environment
|
|
44931
|
+
*
|
|
44932
|
+
* This allows axios to run in a web worker, and react-native.
|
|
44933
|
+
* Both environments support XMLHttpRequest, but not fully standard globals.
|
|
44934
|
+
*
|
|
44935
|
+
* web workers:
|
|
44936
|
+
* typeof window -> undefined
|
|
44937
|
+
* typeof document -> undefined
|
|
44938
|
+
*
|
|
44939
|
+
* react-native:
|
|
44940
|
+
* navigator.product -> 'ReactNative'
|
|
44941
|
+
* nativescript
|
|
44942
|
+
* navigator.product -> 'NativeScript' or 'NS'
|
|
44943
|
+
*
|
|
44944
|
+
* @returns {boolean}
|
|
44945
|
+
*/
|
|
44946
|
+
const hasStandardBrowserEnv = (
|
|
44947
|
+
(product) => {
|
|
44948
|
+
return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
|
|
44949
|
+
})(typeof navigator !== 'undefined' && navigator.product);
|
|
44950
|
+
|
|
44951
|
+
/**
|
|
44952
|
+
* Determine if we're running in a standard browser webWorker environment
|
|
44953
|
+
*
|
|
44954
|
+
* Although the `isStandardBrowserEnv` method indicates that
|
|
44955
|
+
* `allows axios to run in a web worker`, the WebWorker will still be
|
|
44956
|
+
* filtered out due to its judgment standard
|
|
44957
|
+
* `typeof window !== 'undefined' && typeof document !== 'undefined'`.
|
|
44958
|
+
* This leads to a problem when axios post `FormData` in webWorker
|
|
44959
|
+
*/
|
|
44960
|
+
const hasStandardBrowserWebWorkerEnv = (() => {
|
|
44961
|
+
return (
|
|
44962
|
+
typeof WorkerGlobalScope !== 'undefined' &&
|
|
44963
|
+
// eslint-disable-next-line no-undef
|
|
44964
|
+
self instanceof WorkerGlobalScope &&
|
|
44965
|
+
typeof self.importScripts === 'function'
|
|
44966
|
+
);
|
|
44967
|
+
})();
|
|
44968
|
+
|
|
44969
|
+
var utils$1 = /*#__PURE__*/Object.freeze({
|
|
44970
|
+
hasBrowserEnv: hasBrowserEnv,
|
|
44971
|
+
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
|
|
44972
|
+
hasStandardBrowserEnv: hasStandardBrowserEnv
|
|
44973
|
+
});
|
|
44974
|
+
|
|
44975
|
+
var platform$1 = {
|
|
44976
|
+
...utils$1,
|
|
44977
|
+
...platform
|
|
44978
|
+
};
|
|
44979
|
+
|
|
44980
|
+
function toURLEncodedForm(data, options) {
|
|
44981
|
+
return toFormData(data, new platform$1.classes.URLSearchParams(), Object.assign({
|
|
44982
|
+
visitor: function(value, key, path, helpers) {
|
|
44983
|
+
|
|
44984
|
+
return helpers.defaultVisitor.apply(this, arguments);
|
|
44985
|
+
}
|
|
44986
|
+
}, options));
|
|
44987
|
+
}
|
|
44988
|
+
|
|
44989
|
+
/**
|
|
44990
|
+
* It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
|
|
44991
|
+
*
|
|
44992
|
+
* @param {string} name - The name of the property to get.
|
|
44993
|
+
*
|
|
44994
|
+
* @returns An array of strings.
|
|
44995
|
+
*/
|
|
44996
|
+
function parsePropPath(name) {
|
|
44997
|
+
// foo[x][y][z]
|
|
44998
|
+
// foo.x.y.z
|
|
44999
|
+
// foo-x-y-z
|
|
45000
|
+
// foo x y z
|
|
45001
|
+
return utils.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
|
|
45002
|
+
return match[0] === '[]' ? '' : match[1] || match[0];
|
|
45003
|
+
});
|
|
45004
|
+
}
|
|
45005
|
+
|
|
45006
|
+
/**
|
|
45007
|
+
* Convert an array to an object.
|
|
45008
|
+
*
|
|
45009
|
+
* @param {Array<any>} arr - The array to convert to an object.
|
|
45010
|
+
*
|
|
45011
|
+
* @returns An object with the same keys and values as the array.
|
|
45012
|
+
*/
|
|
45013
|
+
function arrayToObject(arr) {
|
|
45014
|
+
const obj = {};
|
|
45015
|
+
const keys = Object.keys(arr);
|
|
45016
|
+
let i;
|
|
45017
|
+
const len = keys.length;
|
|
45018
|
+
let key;
|
|
45019
|
+
for (i = 0; i < len; i++) {
|
|
45020
|
+
key = keys[i];
|
|
45021
|
+
obj[key] = arr[key];
|
|
45022
|
+
}
|
|
45023
|
+
return obj;
|
|
45024
|
+
}
|
|
45025
|
+
|
|
45026
|
+
/**
|
|
45027
|
+
* It takes a FormData object and returns a JavaScript object
|
|
45028
|
+
*
|
|
45029
|
+
* @param {string} formData The FormData object to convert to JSON.
|
|
45030
|
+
*
|
|
45031
|
+
* @returns {Object<string, any> | null} The converted object.
|
|
45032
|
+
*/
|
|
45033
|
+
function formDataToJSON(formData) {
|
|
45034
|
+
function buildPath(path, value, target, index) {
|
|
45035
|
+
let name = path[index++];
|
|
45036
|
+
const isNumericKey = Number.isFinite(+name);
|
|
45037
|
+
const isLast = index >= path.length;
|
|
45038
|
+
name = !name && utils.isArray(target) ? target.length : name;
|
|
45039
|
+
|
|
45040
|
+
if (isLast) {
|
|
45041
|
+
if (utils.hasOwnProp(target, name)) {
|
|
45042
|
+
target[name] = [target[name], value];
|
|
45043
|
+
} else {
|
|
45044
|
+
target[name] = value;
|
|
45045
|
+
}
|
|
45046
|
+
|
|
45047
|
+
return !isNumericKey;
|
|
45048
|
+
}
|
|
45049
|
+
|
|
45050
|
+
if (!target[name] || !utils.isObject(target[name])) {
|
|
45051
|
+
target[name] = [];
|
|
45052
|
+
}
|
|
45053
|
+
|
|
45054
|
+
const result = buildPath(path, value, target[name], index);
|
|
45055
|
+
|
|
45056
|
+
if (result && utils.isArray(target[name])) {
|
|
45057
|
+
target[name] = arrayToObject(target[name]);
|
|
45058
|
+
}
|
|
45059
|
+
|
|
45060
|
+
return !isNumericKey;
|
|
45061
|
+
}
|
|
45062
|
+
|
|
45063
|
+
if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
|
|
45064
|
+
const obj = {};
|
|
45065
|
+
|
|
45066
|
+
utils.forEachEntry(formData, (name, value) => {
|
|
45067
|
+
buildPath(parsePropPath(name), value, obj, 0);
|
|
45068
|
+
});
|
|
45069
|
+
|
|
45070
|
+
return obj;
|
|
45071
|
+
}
|
|
45072
|
+
|
|
45073
|
+
return null;
|
|
45074
|
+
}
|
|
45075
|
+
|
|
45076
|
+
/**
|
|
45077
|
+
* It takes a string, tries to parse it, and if it fails, it returns the stringified version
|
|
45078
|
+
* of the input
|
|
45079
|
+
*
|
|
45080
|
+
* @param {any} rawValue - The value to be stringified.
|
|
45081
|
+
* @param {Function} parser - A function that parses a string into a JavaScript object.
|
|
45082
|
+
* @param {Function} encoder - A function that takes a value and returns a string.
|
|
45083
|
+
*
|
|
45084
|
+
* @returns {string} A stringified version of the rawValue.
|
|
45085
|
+
*/
|
|
45086
|
+
function stringifySafely(rawValue, parser, encoder) {
|
|
45087
|
+
if (utils.isString(rawValue)) {
|
|
45088
|
+
try {
|
|
45089
|
+
(parser || JSON.parse)(rawValue);
|
|
45090
|
+
return utils.trim(rawValue);
|
|
45091
|
+
} catch (e) {
|
|
45092
|
+
if (e.name !== 'SyntaxError') {
|
|
45093
|
+
throw e;
|
|
45094
|
+
}
|
|
45095
|
+
}
|
|
45096
|
+
}
|
|
45097
|
+
|
|
45098
|
+
return (encoder || JSON.stringify)(rawValue);
|
|
45099
|
+
}
|
|
45100
|
+
|
|
45101
|
+
const defaults = {
|
|
45102
|
+
|
|
45103
|
+
transitional: transitionalDefaults,
|
|
45104
|
+
|
|
45105
|
+
adapter: ['xhr', 'http'],
|
|
45106
|
+
|
|
45107
|
+
transformRequest: [function transformRequest(data, headers) {
|
|
45108
|
+
const contentType = headers.getContentType() || '';
|
|
45109
|
+
const hasJSONContentType = contentType.indexOf('application/json') > -1;
|
|
45110
|
+
const isObjectPayload = utils.isObject(data);
|
|
45111
|
+
|
|
45112
|
+
if (isObjectPayload && utils.isHTMLForm(data)) {
|
|
45113
|
+
data = new FormData(data);
|
|
45114
|
+
}
|
|
45115
|
+
|
|
45116
|
+
const isFormData = utils.isFormData(data);
|
|
45117
|
+
|
|
45118
|
+
if (isFormData) {
|
|
45119
|
+
if (!hasJSONContentType) {
|
|
45120
|
+
return data;
|
|
45121
|
+
}
|
|
45122
|
+
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
45123
|
+
}
|
|
45124
|
+
|
|
45125
|
+
if (utils.isArrayBuffer(data) ||
|
|
45126
|
+
utils.isBuffer(data) ||
|
|
45127
|
+
utils.isStream(data) ||
|
|
45128
|
+
utils.isFile(data) ||
|
|
45129
|
+
utils.isBlob(data)
|
|
45130
|
+
) {
|
|
45131
|
+
return data;
|
|
45132
|
+
}
|
|
45133
|
+
if (utils.isArrayBufferView(data)) {
|
|
45134
|
+
return data.buffer;
|
|
45135
|
+
}
|
|
45136
|
+
if (utils.isURLSearchParams(data)) {
|
|
45137
|
+
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
|
45138
|
+
return data.toString();
|
|
45139
|
+
}
|
|
45140
|
+
|
|
45141
|
+
let isFileList;
|
|
45142
|
+
|
|
45143
|
+
if (isObjectPayload) {
|
|
45144
|
+
if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
|
|
45145
|
+
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
45146
|
+
}
|
|
45147
|
+
|
|
45148
|
+
if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
|
|
45149
|
+
const _FormData = this.env && this.env.FormData;
|
|
45150
|
+
|
|
45151
|
+
return toFormData(
|
|
45152
|
+
isFileList ? {'files[]': data} : data,
|
|
45153
|
+
_FormData && new _FormData(),
|
|
45154
|
+
this.formSerializer
|
|
45155
|
+
);
|
|
45156
|
+
}
|
|
45157
|
+
}
|
|
45158
|
+
|
|
45159
|
+
if (isObjectPayload || hasJSONContentType ) {
|
|
45160
|
+
headers.setContentType('application/json', false);
|
|
45161
|
+
return stringifySafely(data);
|
|
45162
|
+
}
|
|
45163
|
+
|
|
45164
|
+
return data;
|
|
45165
|
+
}],
|
|
45166
|
+
|
|
45167
|
+
transformResponse: [function transformResponse(data) {
|
|
45168
|
+
const transitional = this.transitional || defaults.transitional;
|
|
45169
|
+
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
45170
|
+
const JSONRequested = this.responseType === 'json';
|
|
45171
|
+
|
|
45172
|
+
if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
|
|
45173
|
+
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
45174
|
+
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
45175
|
+
|
|
45176
|
+
try {
|
|
45177
|
+
return JSON.parse(data);
|
|
45178
|
+
} catch (e) {
|
|
45179
|
+
if (strictJSONParsing) {
|
|
45180
|
+
if (e.name === 'SyntaxError') {
|
|
45181
|
+
throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
|
|
45182
|
+
}
|
|
45183
|
+
throw e;
|
|
45184
|
+
}
|
|
45185
|
+
}
|
|
45186
|
+
}
|
|
45187
|
+
|
|
45188
|
+
return data;
|
|
45189
|
+
}],
|
|
45190
|
+
|
|
45191
|
+
/**
|
|
45192
|
+
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
45193
|
+
* timeout is not created.
|
|
45194
|
+
*/
|
|
45195
|
+
timeout: 0,
|
|
45196
|
+
|
|
45197
|
+
xsrfCookieName: 'XSRF-TOKEN',
|
|
45198
|
+
xsrfHeaderName: 'X-XSRF-TOKEN',
|
|
45199
|
+
|
|
45200
|
+
maxContentLength: -1,
|
|
45201
|
+
maxBodyLength: -1,
|
|
45202
|
+
|
|
45203
|
+
env: {
|
|
45204
|
+
FormData: platform$1.classes.FormData,
|
|
45205
|
+
Blob: platform$1.classes.Blob
|
|
45206
|
+
},
|
|
45207
|
+
|
|
45208
|
+
validateStatus: function validateStatus(status) {
|
|
45209
|
+
return status >= 200 && status < 300;
|
|
45210
|
+
},
|
|
45211
|
+
|
|
45212
|
+
headers: {
|
|
45213
|
+
common: {
|
|
45214
|
+
'Accept': 'application/json, text/plain, */*',
|
|
45215
|
+
'Content-Type': undefined
|
|
45216
|
+
}
|
|
45217
|
+
}
|
|
45218
|
+
};
|
|
45219
|
+
|
|
45220
|
+
utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
|
|
45221
|
+
defaults.headers[method] = {};
|
|
45222
|
+
});
|
|
45223
|
+
|
|
45224
|
+
// RawAxiosHeaders whose duplicates are ignored by node
|
|
45225
|
+
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
|
45226
|
+
const ignoreDuplicateOf = utils.toObjectSet([
|
|
45227
|
+
'age', 'authorization', 'content-length', 'content-type', 'etag',
|
|
45228
|
+
'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
|
|
45229
|
+
'last-modified', 'location', 'max-forwards', 'proxy-authorization',
|
|
45230
|
+
'referer', 'retry-after', 'user-agent'
|
|
45231
|
+
]);
|
|
45232
|
+
|
|
45233
|
+
/**
|
|
45234
|
+
* Parse headers into an object
|
|
45235
|
+
*
|
|
45236
|
+
* ```
|
|
45237
|
+
* Date: Wed, 27 Aug 2014 08:58:49 GMT
|
|
45238
|
+
* Content-Type: application/json
|
|
45239
|
+
* Connection: keep-alive
|
|
45240
|
+
* Transfer-Encoding: chunked
|
|
45241
|
+
* ```
|
|
45242
|
+
*
|
|
45243
|
+
* @param {String} rawHeaders Headers needing to be parsed
|
|
45244
|
+
*
|
|
45245
|
+
* @returns {Object} Headers parsed into an object
|
|
45246
|
+
*/
|
|
45247
|
+
var parseHeaders = rawHeaders => {
|
|
45248
|
+
const parsed = {};
|
|
45249
|
+
let key;
|
|
45250
|
+
let val;
|
|
45251
|
+
let i;
|
|
45252
|
+
|
|
45253
|
+
rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
|
|
45254
|
+
i = line.indexOf(':');
|
|
45255
|
+
key = line.substring(0, i).trim().toLowerCase();
|
|
45256
|
+
val = line.substring(i + 1).trim();
|
|
45257
|
+
|
|
45258
|
+
if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
|
|
45259
|
+
return;
|
|
45260
|
+
}
|
|
45261
|
+
|
|
45262
|
+
if (key === 'set-cookie') {
|
|
45263
|
+
if (parsed[key]) {
|
|
45264
|
+
parsed[key].push(val);
|
|
45265
|
+
} else {
|
|
45266
|
+
parsed[key] = [val];
|
|
45267
|
+
}
|
|
45268
|
+
} else {
|
|
45269
|
+
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
45270
|
+
}
|
|
45271
|
+
});
|
|
45272
|
+
|
|
45273
|
+
return parsed;
|
|
45274
|
+
};
|
|
45275
|
+
|
|
45276
|
+
const $internals = Symbol('internals');
|
|
45277
|
+
|
|
45278
|
+
function normalizeHeader(header) {
|
|
45279
|
+
return header && String(header).trim().toLowerCase();
|
|
45280
|
+
}
|
|
45281
|
+
|
|
45282
|
+
function normalizeValue(value) {
|
|
45283
|
+
if (value === false || value == null) {
|
|
45284
|
+
return value;
|
|
45285
|
+
}
|
|
45286
|
+
|
|
45287
|
+
return utils.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
45288
|
+
}
|
|
45289
|
+
|
|
45290
|
+
function parseTokens(str) {
|
|
45291
|
+
const tokens = Object.create(null);
|
|
45292
|
+
const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
45293
|
+
let match;
|
|
45294
|
+
|
|
45295
|
+
while ((match = tokensRE.exec(str))) {
|
|
45296
|
+
tokens[match[1]] = match[2];
|
|
45297
|
+
}
|
|
45298
|
+
|
|
45299
|
+
return tokens;
|
|
45300
|
+
}
|
|
45301
|
+
|
|
45302
|
+
const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
|
45303
|
+
|
|
45304
|
+
function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
45305
|
+
if (utils.isFunction(filter)) {
|
|
45306
|
+
return filter.call(this, value, header);
|
|
45307
|
+
}
|
|
45308
|
+
|
|
45309
|
+
if (isHeaderNameFilter) {
|
|
45310
|
+
value = header;
|
|
45311
|
+
}
|
|
45312
|
+
|
|
45313
|
+
if (!utils.isString(value)) return;
|
|
45314
|
+
|
|
45315
|
+
if (utils.isString(filter)) {
|
|
45316
|
+
return value.indexOf(filter) !== -1;
|
|
45317
|
+
}
|
|
45318
|
+
|
|
45319
|
+
if (utils.isRegExp(filter)) {
|
|
45320
|
+
return filter.test(value);
|
|
45321
|
+
}
|
|
45322
|
+
}
|
|
45323
|
+
|
|
45324
|
+
function formatHeader(header) {
|
|
45325
|
+
return header.trim()
|
|
45326
|
+
.toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
|
|
45327
|
+
return char.toUpperCase() + str;
|
|
45328
|
+
});
|
|
45329
|
+
}
|
|
45330
|
+
|
|
45331
|
+
function buildAccessors(obj, header) {
|
|
45332
|
+
const accessorName = utils.toCamelCase(' ' + header);
|
|
45333
|
+
|
|
45334
|
+
['get', 'set', 'has'].forEach(methodName => {
|
|
45335
|
+
Object.defineProperty(obj, methodName + accessorName, {
|
|
45336
|
+
value: function(arg1, arg2, arg3) {
|
|
45337
|
+
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
45338
|
+
},
|
|
45339
|
+
configurable: true
|
|
45340
|
+
});
|
|
45341
|
+
});
|
|
45342
|
+
}
|
|
45343
|
+
|
|
45344
|
+
class AxiosHeaders {
|
|
45345
|
+
constructor(headers) {
|
|
45346
|
+
headers && this.set(headers);
|
|
45347
|
+
}
|
|
45348
|
+
|
|
45349
|
+
set(header, valueOrRewrite, rewrite) {
|
|
45350
|
+
const self = this;
|
|
45351
|
+
|
|
45352
|
+
function setHeader(_value, _header, _rewrite) {
|
|
45353
|
+
const lHeader = normalizeHeader(_header);
|
|
45354
|
+
|
|
45355
|
+
if (!lHeader) {
|
|
45356
|
+
throw new Error('header name must be a non-empty string');
|
|
45357
|
+
}
|
|
45358
|
+
|
|
45359
|
+
const key = utils.findKey(self, lHeader);
|
|
45360
|
+
|
|
45361
|
+
if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
|
|
45362
|
+
self[key || _header] = normalizeValue(_value);
|
|
45363
|
+
}
|
|
45364
|
+
}
|
|
45365
|
+
|
|
45366
|
+
const setHeaders = (headers, _rewrite) =>
|
|
45367
|
+
utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
45368
|
+
|
|
45369
|
+
if (utils.isPlainObject(header) || header instanceof this.constructor) {
|
|
45370
|
+
setHeaders(header, valueOrRewrite);
|
|
45371
|
+
} else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
45372
|
+
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
45373
|
+
} else {
|
|
45374
|
+
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
45375
|
+
}
|
|
45376
|
+
|
|
45377
|
+
return this;
|
|
45378
|
+
}
|
|
45379
|
+
|
|
45380
|
+
get(header, parser) {
|
|
45381
|
+
header = normalizeHeader(header);
|
|
45382
|
+
|
|
45383
|
+
if (header) {
|
|
45384
|
+
const key = utils.findKey(this, header);
|
|
45385
|
+
|
|
45386
|
+
if (key) {
|
|
45387
|
+
const value = this[key];
|
|
45388
|
+
|
|
45389
|
+
if (!parser) {
|
|
45390
|
+
return value;
|
|
45391
|
+
}
|
|
45392
|
+
|
|
45393
|
+
if (parser === true) {
|
|
45394
|
+
return parseTokens(value);
|
|
45395
|
+
}
|
|
45396
|
+
|
|
45397
|
+
if (utils.isFunction(parser)) {
|
|
45398
|
+
return parser.call(this, value, key);
|
|
45399
|
+
}
|
|
45400
|
+
|
|
45401
|
+
if (utils.isRegExp(parser)) {
|
|
45402
|
+
return parser.exec(value);
|
|
45403
|
+
}
|
|
45404
|
+
|
|
45405
|
+
throw new TypeError('parser must be boolean|regexp|function');
|
|
45406
|
+
}
|
|
45407
|
+
}
|
|
45408
|
+
}
|
|
45409
|
+
|
|
45410
|
+
has(header, matcher) {
|
|
45411
|
+
header = normalizeHeader(header);
|
|
45412
|
+
|
|
45413
|
+
if (header) {
|
|
45414
|
+
const key = utils.findKey(this, header);
|
|
45415
|
+
|
|
45416
|
+
return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
|
45417
|
+
}
|
|
45418
|
+
|
|
45419
|
+
return false;
|
|
45420
|
+
}
|
|
45421
|
+
|
|
45422
|
+
delete(header, matcher) {
|
|
45423
|
+
const self = this;
|
|
45424
|
+
let deleted = false;
|
|
45425
|
+
|
|
45426
|
+
function deleteHeader(_header) {
|
|
45427
|
+
_header = normalizeHeader(_header);
|
|
45428
|
+
|
|
45429
|
+
if (_header) {
|
|
45430
|
+
const key = utils.findKey(self, _header);
|
|
45431
|
+
|
|
45432
|
+
if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
|
|
45433
|
+
delete self[key];
|
|
45434
|
+
|
|
45435
|
+
deleted = true;
|
|
45436
|
+
}
|
|
45437
|
+
}
|
|
45438
|
+
}
|
|
45439
|
+
|
|
45440
|
+
if (utils.isArray(header)) {
|
|
45441
|
+
header.forEach(deleteHeader);
|
|
44002
45442
|
} else {
|
|
44003
|
-
|
|
45443
|
+
deleteHeader(header);
|
|
44004
45444
|
}
|
|
44005
|
-
});
|
|
44006
|
-
return a;
|
|
44007
|
-
}
|
|
44008
45445
|
|
|
44009
|
-
|
|
44010
|
-
* Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
|
|
44011
|
-
*
|
|
44012
|
-
* @param {string} content with BOM
|
|
44013
|
-
* @return {string} content value without BOM
|
|
44014
|
-
*/
|
|
44015
|
-
function stripBOM(content) {
|
|
44016
|
-
if (content.charCodeAt(0) === 0xFEFF) {
|
|
44017
|
-
content = content.slice(1);
|
|
45446
|
+
return deleted;
|
|
44018
45447
|
}
|
|
44019
|
-
return content;
|
|
44020
|
-
}
|
|
44021
45448
|
|
|
44022
|
-
|
|
44023
|
-
|
|
44024
|
-
|
|
44025
|
-
|
|
44026
|
-
isFormData: isFormData,
|
|
44027
|
-
isArrayBufferView: isArrayBufferView,
|
|
44028
|
-
isString: isString,
|
|
44029
|
-
isNumber: isNumber,
|
|
44030
|
-
isObject: isObject$1,
|
|
44031
|
-
isPlainObject: isPlainObject,
|
|
44032
|
-
isUndefined: isUndefined,
|
|
44033
|
-
isDate: isDate,
|
|
44034
|
-
isFile: isFile,
|
|
44035
|
-
isBlob: isBlob,
|
|
44036
|
-
isFunction: isFunction$1,
|
|
44037
|
-
isStream: isStream,
|
|
44038
|
-
isURLSearchParams: isURLSearchParams,
|
|
44039
|
-
isStandardBrowserEnv: isStandardBrowserEnv,
|
|
44040
|
-
forEach: forEach,
|
|
44041
|
-
merge: merge$2,
|
|
44042
|
-
extend: extend,
|
|
44043
|
-
trim: trim,
|
|
44044
|
-
stripBOM: stripBOM
|
|
44045
|
-
};
|
|
45449
|
+
clear(matcher) {
|
|
45450
|
+
const keys = Object.keys(this);
|
|
45451
|
+
let i = keys.length;
|
|
45452
|
+
let deleted = false;
|
|
44046
45453
|
|
|
44047
|
-
|
|
44048
|
-
|
|
44049
|
-
|
|
44050
|
-
|
|
44051
|
-
|
|
44052
|
-
|
|
44053
|
-
|
|
44054
|
-
replace(/%5D/gi, ']');
|
|
44055
|
-
}
|
|
45454
|
+
while (i--) {
|
|
45455
|
+
const key = keys[i];
|
|
45456
|
+
if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
45457
|
+
delete this[key];
|
|
45458
|
+
deleted = true;
|
|
45459
|
+
}
|
|
45460
|
+
}
|
|
44056
45461
|
|
|
44057
|
-
|
|
44058
|
-
* Build a URL by appending params to the end
|
|
44059
|
-
*
|
|
44060
|
-
* @param {string} url The base of the url (e.g., http://www.google.com)
|
|
44061
|
-
* @param {object} [params] The params to be appended
|
|
44062
|
-
* @returns {string} The formatted url
|
|
44063
|
-
*/
|
|
44064
|
-
var buildURL = function buildURL(url, params, paramsSerializer) {
|
|
44065
|
-
/*eslint no-param-reassign:0*/
|
|
44066
|
-
if (!params) {
|
|
44067
|
-
return url;
|
|
45462
|
+
return deleted;
|
|
44068
45463
|
}
|
|
44069
45464
|
|
|
44070
|
-
|
|
44071
|
-
|
|
44072
|
-
|
|
44073
|
-
} else if (utils.isURLSearchParams(params)) {
|
|
44074
|
-
serializedParams = params.toString();
|
|
44075
|
-
} else {
|
|
44076
|
-
var parts = [];
|
|
45465
|
+
normalize(format) {
|
|
45466
|
+
const self = this;
|
|
45467
|
+
const headers = {};
|
|
44077
45468
|
|
|
44078
|
-
utils.forEach(
|
|
44079
|
-
|
|
45469
|
+
utils.forEach(this, (value, header) => {
|
|
45470
|
+
const key = utils.findKey(headers, header);
|
|
45471
|
+
|
|
45472
|
+
if (key) {
|
|
45473
|
+
self[key] = normalizeValue(value);
|
|
45474
|
+
delete self[header];
|
|
44080
45475
|
return;
|
|
44081
45476
|
}
|
|
44082
45477
|
|
|
44083
|
-
|
|
44084
|
-
|
|
44085
|
-
|
|
44086
|
-
|
|
45478
|
+
const normalized = format ? formatHeader(header) : String(header).trim();
|
|
45479
|
+
|
|
45480
|
+
if (normalized !== header) {
|
|
45481
|
+
delete self[header];
|
|
44087
45482
|
}
|
|
44088
45483
|
|
|
44089
|
-
|
|
44090
|
-
|
|
44091
|
-
|
|
44092
|
-
} else if (utils.isObject(v)) {
|
|
44093
|
-
v = JSON.stringify(v);
|
|
44094
|
-
}
|
|
44095
|
-
parts.push(encode(key) + '=' + encode(v));
|
|
44096
|
-
});
|
|
45484
|
+
self[normalized] = normalizeValue(value);
|
|
45485
|
+
|
|
45486
|
+
headers[normalized] = true;
|
|
44097
45487
|
});
|
|
44098
45488
|
|
|
44099
|
-
|
|
45489
|
+
return this;
|
|
44100
45490
|
}
|
|
44101
45491
|
|
|
44102
|
-
|
|
44103
|
-
|
|
44104
|
-
|
|
44105
|
-
url = url.slice(0, hashmarkIndex);
|
|
44106
|
-
}
|
|
45492
|
+
concat(...targets) {
|
|
45493
|
+
return this.constructor.concat(this, ...targets);
|
|
45494
|
+
}
|
|
44107
45495
|
|
|
44108
|
-
|
|
45496
|
+
toJSON(asStrings) {
|
|
45497
|
+
const obj = Object.create(null);
|
|
45498
|
+
|
|
45499
|
+
utils.forEach(this, (value, header) => {
|
|
45500
|
+
value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);
|
|
45501
|
+
});
|
|
45502
|
+
|
|
45503
|
+
return obj;
|
|
44109
45504
|
}
|
|
44110
45505
|
|
|
44111
|
-
|
|
44112
|
-
|
|
45506
|
+
[Symbol.iterator]() {
|
|
45507
|
+
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
45508
|
+
}
|
|
44113
45509
|
|
|
44114
|
-
|
|
44115
|
-
|
|
44116
|
-
|
|
45510
|
+
toString() {
|
|
45511
|
+
return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
|
|
45512
|
+
}
|
|
44117
45513
|
|
|
44118
|
-
|
|
44119
|
-
|
|
44120
|
-
|
|
44121
|
-
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
44122
|
-
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
44123
|
-
*
|
|
44124
|
-
* @return {Number} An ID used to remove interceptor later
|
|
44125
|
-
*/
|
|
44126
|
-
InterceptorManager.prototype.use = function use(fulfilled, rejected, options) {
|
|
44127
|
-
this.handlers.push({
|
|
44128
|
-
fulfilled: fulfilled,
|
|
44129
|
-
rejected: rejected,
|
|
44130
|
-
synchronous: options ? options.synchronous : false,
|
|
44131
|
-
runWhen: options ? options.runWhen : null
|
|
44132
|
-
});
|
|
44133
|
-
return this.handlers.length - 1;
|
|
44134
|
-
};
|
|
45514
|
+
get [Symbol.toStringTag]() {
|
|
45515
|
+
return 'AxiosHeaders';
|
|
45516
|
+
}
|
|
44135
45517
|
|
|
44136
|
-
|
|
44137
|
-
|
|
44138
|
-
*
|
|
44139
|
-
* @param {Number} id The ID that was returned by `use`
|
|
44140
|
-
*/
|
|
44141
|
-
InterceptorManager.prototype.eject = function eject(id) {
|
|
44142
|
-
if (this.handlers[id]) {
|
|
44143
|
-
this.handlers[id] = null;
|
|
45518
|
+
static from(thing) {
|
|
45519
|
+
return thing instanceof this ? thing : new this(thing);
|
|
44144
45520
|
}
|
|
44145
|
-
};
|
|
44146
45521
|
|
|
44147
|
-
|
|
44148
|
-
|
|
44149
|
-
|
|
44150
|
-
|
|
44151
|
-
|
|
44152
|
-
|
|
44153
|
-
|
|
44154
|
-
|
|
44155
|
-
|
|
44156
|
-
|
|
44157
|
-
|
|
44158
|
-
|
|
45522
|
+
static concat(first, ...targets) {
|
|
45523
|
+
const computed = new this(first);
|
|
45524
|
+
|
|
45525
|
+
targets.forEach((target) => computed.set(target));
|
|
45526
|
+
|
|
45527
|
+
return computed;
|
|
45528
|
+
}
|
|
45529
|
+
|
|
45530
|
+
static accessor(header) {
|
|
45531
|
+
const internals = this[$internals] = (this[$internals] = {
|
|
45532
|
+
accessors: {}
|
|
45533
|
+
});
|
|
45534
|
+
|
|
45535
|
+
const accessors = internals.accessors;
|
|
45536
|
+
const prototype = this.prototype;
|
|
45537
|
+
|
|
45538
|
+
function defineAccessor(_header) {
|
|
45539
|
+
const lHeader = normalizeHeader(_header);
|
|
45540
|
+
|
|
45541
|
+
if (!accessors[lHeader]) {
|
|
45542
|
+
buildAccessors(prototype, _header);
|
|
45543
|
+
accessors[lHeader] = true;
|
|
45544
|
+
}
|
|
44159
45545
|
}
|
|
44160
|
-
});
|
|
44161
|
-
};
|
|
44162
45546
|
|
|
44163
|
-
|
|
45547
|
+
utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
45548
|
+
|
|
45549
|
+
return this;
|
|
45550
|
+
}
|
|
45551
|
+
}
|
|
45552
|
+
|
|
45553
|
+
AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
|
|
44164
45554
|
|
|
44165
|
-
|
|
44166
|
-
|
|
44167
|
-
|
|
44168
|
-
|
|
44169
|
-
|
|
45555
|
+
// reserved names hotfix
|
|
45556
|
+
utils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
|
|
45557
|
+
let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
|
|
45558
|
+
return {
|
|
45559
|
+
get: () => value,
|
|
45560
|
+
set(headerValue) {
|
|
45561
|
+
this[mapped] = headerValue;
|
|
44170
45562
|
}
|
|
44171
|
-
}
|
|
44172
|
-
};
|
|
45563
|
+
}
|
|
45564
|
+
});
|
|
45565
|
+
|
|
45566
|
+
utils.freezeMethods(AxiosHeaders);
|
|
44173
45567
|
|
|
44174
45568
|
/**
|
|
44175
|
-
*
|
|
45569
|
+
* Transform the data for a request or a response
|
|
44176
45570
|
*
|
|
44177
|
-
* @param {
|
|
44178
|
-
* @param {Object}
|
|
44179
|
-
*
|
|
44180
|
-
* @
|
|
44181
|
-
* @param {Object} [response] The response.
|
|
44182
|
-
* @returns {Error} The error.
|
|
45571
|
+
* @param {Array|Function} fns A single function or Array of functions
|
|
45572
|
+
* @param {?Object} response The response object
|
|
45573
|
+
*
|
|
45574
|
+
* @returns {*} The resulting transformed data
|
|
44183
45575
|
*/
|
|
44184
|
-
|
|
44185
|
-
|
|
44186
|
-
|
|
44187
|
-
|
|
44188
|
-
|
|
45576
|
+
function transformData(fns, response) {
|
|
45577
|
+
const config = this || defaults;
|
|
45578
|
+
const context = response || config;
|
|
45579
|
+
const headers = AxiosHeaders.from(context.headers);
|
|
45580
|
+
let data = context.data;
|
|
44189
45581
|
|
|
44190
|
-
|
|
44191
|
-
|
|
44192
|
-
|
|
45582
|
+
utils.forEach(fns, function transform(fn) {
|
|
45583
|
+
data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
|
|
45584
|
+
});
|
|
44193
45585
|
|
|
44194
|
-
|
|
44195
|
-
|
|
44196
|
-
|
|
44197
|
-
|
|
44198
|
-
|
|
44199
|
-
|
|
44200
|
-
|
|
44201
|
-
|
|
44202
|
-
// Mozilla
|
|
44203
|
-
fileName: this.fileName,
|
|
44204
|
-
lineNumber: this.lineNumber,
|
|
44205
|
-
columnNumber: this.columnNumber,
|
|
44206
|
-
stack: this.stack,
|
|
44207
|
-
// Axios
|
|
44208
|
-
config: this.config,
|
|
44209
|
-
code: this.code,
|
|
44210
|
-
status: this.response && this.response.status ? this.response.status : null
|
|
44211
|
-
};
|
|
44212
|
-
};
|
|
44213
|
-
return error;
|
|
44214
|
-
};
|
|
45586
|
+
headers.normalize();
|
|
45587
|
+
|
|
45588
|
+
return data;
|
|
45589
|
+
}
|
|
45590
|
+
|
|
45591
|
+
function isCancel(value) {
|
|
45592
|
+
return !!(value && value.__CANCEL__);
|
|
45593
|
+
}
|
|
44215
45594
|
|
|
44216
45595
|
/**
|
|
44217
|
-
*
|
|
45596
|
+
* A `CanceledError` is an object that is thrown when an operation is canceled.
|
|
44218
45597
|
*
|
|
44219
|
-
* @param {string} message The
|
|
44220
|
-
* @param {Object} config The config.
|
|
44221
|
-
* @param {
|
|
44222
|
-
*
|
|
44223
|
-
* @
|
|
44224
|
-
* @returns {Error} The created error.
|
|
45598
|
+
* @param {string=} message The message.
|
|
45599
|
+
* @param {Object=} config The config.
|
|
45600
|
+
* @param {Object=} request The request.
|
|
45601
|
+
*
|
|
45602
|
+
* @returns {CanceledError} The created error.
|
|
44225
45603
|
*/
|
|
44226
|
-
|
|
44227
|
-
|
|
44228
|
-
|
|
44229
|
-
|
|
45604
|
+
function CanceledError(message, config, request) {
|
|
45605
|
+
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
45606
|
+
AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
|
|
45607
|
+
this.name = 'CanceledError';
|
|
45608
|
+
}
|
|
45609
|
+
|
|
45610
|
+
utils.inherits(CanceledError, AxiosError, {
|
|
45611
|
+
__CANCEL__: true
|
|
45612
|
+
});
|
|
44230
45613
|
|
|
44231
45614
|
/**
|
|
44232
45615
|
* Resolve or reject a Promise based on response status.
|
|
@@ -44234,97 +45617,51 @@ var Neurosity = (function (exports) {
|
|
|
44234
45617
|
* @param {Function} resolve A function that resolves the promise.
|
|
44235
45618
|
* @param {Function} reject A function that rejects the promise.
|
|
44236
45619
|
* @param {object} response The response.
|
|
45620
|
+
*
|
|
45621
|
+
* @returns {object} The response.
|
|
44237
45622
|
*/
|
|
44238
|
-
|
|
44239
|
-
|
|
45623
|
+
function settle(resolve, reject, response) {
|
|
45624
|
+
const validateStatus = response.config.validateStatus;
|
|
44240
45625
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
44241
45626
|
resolve(response);
|
|
44242
45627
|
} else {
|
|
44243
|
-
reject(
|
|
45628
|
+
reject(new AxiosError(
|
|
44244
45629
|
'Request failed with status code ' + response.status,
|
|
45630
|
+
[AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
|
44245
45631
|
response.config,
|
|
44246
|
-
null,
|
|
44247
45632
|
response.request,
|
|
44248
45633
|
response
|
|
44249
45634
|
));
|
|
44250
45635
|
}
|
|
44251
|
-
}
|
|
44252
|
-
|
|
44253
|
-
var cookies = (
|
|
44254
|
-
utils.isStandardBrowserEnv() ?
|
|
44255
|
-
|
|
44256
|
-
// Standard browser envs support document.cookie
|
|
44257
|
-
(function standardBrowserEnv() {
|
|
44258
|
-
return {
|
|
44259
|
-
write: function write(name, value, expires, path, domain, secure) {
|
|
44260
|
-
var cookie = [];
|
|
44261
|
-
cookie.push(name + '=' + encodeURIComponent(value));
|
|
44262
|
-
|
|
44263
|
-
if (utils.isNumber(expires)) {
|
|
44264
|
-
cookie.push('expires=' + new Date(expires).toGMTString());
|
|
44265
|
-
}
|
|
44266
|
-
|
|
44267
|
-
if (utils.isString(path)) {
|
|
44268
|
-
cookie.push('path=' + path);
|
|
44269
|
-
}
|
|
44270
|
-
|
|
44271
|
-
if (utils.isString(domain)) {
|
|
44272
|
-
cookie.push('domain=' + domain);
|
|
44273
|
-
}
|
|
44274
|
-
|
|
44275
|
-
if (secure === true) {
|
|
44276
|
-
cookie.push('secure');
|
|
44277
|
-
}
|
|
44278
|
-
|
|
44279
|
-
document.cookie = cookie.join('; ');
|
|
44280
|
-
},
|
|
44281
|
-
|
|
44282
|
-
read: function read(name) {
|
|
44283
|
-
var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
|
44284
|
-
return (match ? decodeURIComponent(match[3]) : null);
|
|
44285
|
-
},
|
|
44286
|
-
|
|
44287
|
-
remove: function remove(name) {
|
|
44288
|
-
this.write(name, '', Date.now() - 86400000);
|
|
44289
|
-
}
|
|
44290
|
-
};
|
|
44291
|
-
})() :
|
|
44292
|
-
|
|
44293
|
-
// Non standard browser env (web workers, react-native) lack needed support.
|
|
44294
|
-
(function nonStandardBrowserEnv() {
|
|
44295
|
-
return {
|
|
44296
|
-
write: function write() {},
|
|
44297
|
-
read: function read() { return null; },
|
|
44298
|
-
remove: function remove() {}
|
|
44299
|
-
};
|
|
44300
|
-
})()
|
|
44301
|
-
);
|
|
45636
|
+
}
|
|
44302
45637
|
|
|
44303
45638
|
/**
|
|
44304
45639
|
* Determines whether the specified URL is absolute
|
|
44305
45640
|
*
|
|
44306
45641
|
* @param {string} url The URL to test
|
|
45642
|
+
*
|
|
44307
45643
|
* @returns {boolean} True if the specified URL is absolute, otherwise false
|
|
44308
45644
|
*/
|
|
44309
|
-
|
|
45645
|
+
function isAbsoluteURL(url) {
|
|
44310
45646
|
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
|
44311
45647
|
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
|
44312
45648
|
// by any combination of letters, digits, plus, period, or hyphen.
|
|
44313
45649
|
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
44314
|
-
}
|
|
45650
|
+
}
|
|
44315
45651
|
|
|
44316
45652
|
/**
|
|
44317
45653
|
* Creates a new URL by combining the specified URLs
|
|
44318
45654
|
*
|
|
44319
45655
|
* @param {string} baseURL The base URL
|
|
44320
45656
|
* @param {string} relativeURL The relative URL
|
|
45657
|
+
*
|
|
44321
45658
|
* @returns {string} The combined URL
|
|
44322
45659
|
*/
|
|
44323
|
-
|
|
45660
|
+
function combineURLs(baseURL, relativeURL) {
|
|
44324
45661
|
return relativeURL
|
|
44325
45662
|
? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
|
|
44326
45663
|
: baseURL;
|
|
44327
|
-
}
|
|
45664
|
+
}
|
|
44328
45665
|
|
|
44329
45666
|
/**
|
|
44330
45667
|
* Creates a new URL by combining the baseURL with the requestedURL,
|
|
@@ -44333,154 +45670,110 @@ var Neurosity = (function (exports) {
|
|
|
44333
45670
|
*
|
|
44334
45671
|
* @param {string} baseURL The base URL
|
|
44335
45672
|
* @param {string} requestedURL Absolute or relative URL to combine
|
|
45673
|
+
*
|
|
44336
45674
|
* @returns {string} The combined full path
|
|
44337
45675
|
*/
|
|
44338
|
-
|
|
45676
|
+
function buildFullPath(baseURL, requestedURL) {
|
|
44339
45677
|
if (baseURL && !isAbsoluteURL(requestedURL)) {
|
|
44340
45678
|
return combineURLs(baseURL, requestedURL);
|
|
44341
45679
|
}
|
|
44342
45680
|
return requestedURL;
|
|
44343
|
-
}
|
|
45681
|
+
}
|
|
44344
45682
|
|
|
44345
|
-
|
|
44346
|
-
|
|
44347
|
-
|
|
44348
|
-
|
|
44349
|
-
'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
|
|
44350
|
-
'last-modified', 'location', 'max-forwards', 'proxy-authorization',
|
|
44351
|
-
'referer', 'retry-after', 'user-agent'
|
|
44352
|
-
];
|
|
45683
|
+
function parseProtocol(url) {
|
|
45684
|
+
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
45685
|
+
return match && match[1] || '';
|
|
45686
|
+
}
|
|
44353
45687
|
|
|
44354
45688
|
/**
|
|
44355
|
-
*
|
|
44356
|
-
*
|
|
44357
|
-
*
|
|
44358
|
-
*
|
|
44359
|
-
* Content-Type: application/json
|
|
44360
|
-
* Connection: keep-alive
|
|
44361
|
-
* Transfer-Encoding: chunked
|
|
44362
|
-
* ```
|
|
44363
|
-
*
|
|
44364
|
-
* @param {String} headers Headers needing to be parsed
|
|
44365
|
-
* @returns {Object} Headers parsed into an object
|
|
45689
|
+
* Calculate data maxRate
|
|
45690
|
+
* @param {Number} [samplesCount= 10]
|
|
45691
|
+
* @param {Number} [min= 1000]
|
|
45692
|
+
* @returns {Function}
|
|
44366
45693
|
*/
|
|
44367
|
-
|
|
44368
|
-
|
|
44369
|
-
|
|
44370
|
-
|
|
44371
|
-
|
|
45694
|
+
function speedometer(samplesCount, min) {
|
|
45695
|
+
samplesCount = samplesCount || 10;
|
|
45696
|
+
const bytes = new Array(samplesCount);
|
|
45697
|
+
const timestamps = new Array(samplesCount);
|
|
45698
|
+
let head = 0;
|
|
45699
|
+
let tail = 0;
|
|
45700
|
+
let firstSampleTS;
|
|
44372
45701
|
|
|
44373
|
-
|
|
45702
|
+
min = min !== undefined ? min : 1000;
|
|
44374
45703
|
|
|
44375
|
-
|
|
44376
|
-
|
|
44377
|
-
key = utils.trim(line.substr(0, i)).toLowerCase();
|
|
44378
|
-
val = utils.trim(line.substr(i + 1));
|
|
45704
|
+
return function push(chunkLength) {
|
|
45705
|
+
const now = Date.now();
|
|
44379
45706
|
|
|
44380
|
-
|
|
44381
|
-
|
|
44382
|
-
|
|
44383
|
-
|
|
44384
|
-
if (key === 'set-cookie') {
|
|
44385
|
-
parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
|
|
44386
|
-
} else {
|
|
44387
|
-
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
44388
|
-
}
|
|
45707
|
+
const startedAt = timestamps[tail];
|
|
45708
|
+
|
|
45709
|
+
if (!firstSampleTS) {
|
|
45710
|
+
firstSampleTS = now;
|
|
44389
45711
|
}
|
|
44390
|
-
});
|
|
44391
45712
|
|
|
44392
|
-
|
|
44393
|
-
|
|
45713
|
+
bytes[head] = chunkLength;
|
|
45714
|
+
timestamps[head] = now;
|
|
44394
45715
|
|
|
44395
|
-
|
|
44396
|
-
|
|
45716
|
+
let i = tail;
|
|
45717
|
+
let bytesCount = 0;
|
|
44397
45718
|
|
|
44398
|
-
|
|
44399
|
-
|
|
44400
|
-
|
|
44401
|
-
|
|
44402
|
-
var urlParsingNode = document.createElement('a');
|
|
44403
|
-
var originURL;
|
|
45719
|
+
while (i !== head) {
|
|
45720
|
+
bytesCount += bytes[i++];
|
|
45721
|
+
i = i % samplesCount;
|
|
45722
|
+
}
|
|
44404
45723
|
|
|
44405
|
-
|
|
44406
|
-
* Parse a URL to discover it's components
|
|
44407
|
-
*
|
|
44408
|
-
* @param {String} url The URL to be parsed
|
|
44409
|
-
* @returns {Object}
|
|
44410
|
-
*/
|
|
44411
|
-
function resolveURL(url) {
|
|
44412
|
-
var href = url;
|
|
45724
|
+
head = (head + 1) % samplesCount;
|
|
44413
45725
|
|
|
44414
|
-
|
|
44415
|
-
|
|
44416
|
-
|
|
44417
|
-
href = urlParsingNode.href;
|
|
44418
|
-
}
|
|
45726
|
+
if (head === tail) {
|
|
45727
|
+
tail = (tail + 1) % samplesCount;
|
|
45728
|
+
}
|
|
44419
45729
|
|
|
44420
|
-
|
|
45730
|
+
if (now - firstSampleTS < min) {
|
|
45731
|
+
return;
|
|
45732
|
+
}
|
|
44421
45733
|
|
|
44422
|
-
|
|
44423
|
-
return {
|
|
44424
|
-
href: urlParsingNode.href,
|
|
44425
|
-
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
|
|
44426
|
-
host: urlParsingNode.host,
|
|
44427
|
-
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
|
|
44428
|
-
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
|
|
44429
|
-
hostname: urlParsingNode.hostname,
|
|
44430
|
-
port: urlParsingNode.port,
|
|
44431
|
-
pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
|
|
44432
|
-
urlParsingNode.pathname :
|
|
44433
|
-
'/' + urlParsingNode.pathname
|
|
44434
|
-
};
|
|
44435
|
-
}
|
|
45734
|
+
const passed = startedAt && now - startedAt;
|
|
44436
45735
|
|
|
44437
|
-
|
|
44438
|
-
|
|
44439
|
-
|
|
44440
|
-
* Determine if a URL shares the same origin as the current location
|
|
44441
|
-
*
|
|
44442
|
-
* @param {String} requestURL The URL to test
|
|
44443
|
-
* @returns {boolean} True if URL shares the same origin, otherwise false
|
|
44444
|
-
*/
|
|
44445
|
-
return function isURLSameOrigin(requestURL) {
|
|
44446
|
-
var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
|
|
44447
|
-
return (parsed.protocol === originURL.protocol &&
|
|
44448
|
-
parsed.host === originURL.host);
|
|
44449
|
-
};
|
|
44450
|
-
})() :
|
|
45736
|
+
return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
|
|
45737
|
+
};
|
|
45738
|
+
}
|
|
44451
45739
|
|
|
44452
|
-
|
|
44453
|
-
|
|
44454
|
-
|
|
44455
|
-
return true;
|
|
44456
|
-
};
|
|
44457
|
-
})()
|
|
44458
|
-
);
|
|
45740
|
+
function progressEventReducer(listener, isDownloadStream) {
|
|
45741
|
+
let bytesNotified = 0;
|
|
45742
|
+
const _speedometer = speedometer(50, 250);
|
|
44459
45743
|
|
|
44460
|
-
|
|
44461
|
-
|
|
44462
|
-
|
|
44463
|
-
|
|
44464
|
-
|
|
44465
|
-
|
|
44466
|
-
function Cancel(message) {
|
|
44467
|
-
this.message = message;
|
|
44468
|
-
}
|
|
45744
|
+
return e => {
|
|
45745
|
+
const loaded = e.loaded;
|
|
45746
|
+
const total = e.lengthComputable ? e.total : undefined;
|
|
45747
|
+
const progressBytes = loaded - bytesNotified;
|
|
45748
|
+
const rate = _speedometer(progressBytes);
|
|
45749
|
+
const inRange = loaded <= total;
|
|
44469
45750
|
|
|
44470
|
-
|
|
44471
|
-
|
|
44472
|
-
|
|
45751
|
+
bytesNotified = loaded;
|
|
45752
|
+
|
|
45753
|
+
const data = {
|
|
45754
|
+
loaded,
|
|
45755
|
+
total,
|
|
45756
|
+
progress: total ? (loaded / total) : undefined,
|
|
45757
|
+
bytes: progressBytes,
|
|
45758
|
+
rate: rate ? rate : undefined,
|
|
45759
|
+
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
|
45760
|
+
event: e
|
|
45761
|
+
};
|
|
45762
|
+
|
|
45763
|
+
data[isDownloadStream ? 'download' : 'upload'] = true;
|
|
44473
45764
|
|
|
44474
|
-
|
|
45765
|
+
listener(data);
|
|
45766
|
+
};
|
|
45767
|
+
}
|
|
44475
45768
|
|
|
44476
|
-
|
|
45769
|
+
const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
|
|
44477
45770
|
|
|
44478
|
-
var
|
|
45771
|
+
var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
44479
45772
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
44480
|
-
|
|
44481
|
-
|
|
44482
|
-
|
|
44483
|
-
|
|
45773
|
+
let requestData = config.data;
|
|
45774
|
+
const requestHeaders = AxiosHeaders.from(config.headers).normalize();
|
|
45775
|
+
let {responseType, withXSRFToken} = config;
|
|
45776
|
+
let onCanceled;
|
|
44484
45777
|
function done() {
|
|
44485
45778
|
if (config.cancelToken) {
|
|
44486
45779
|
config.cancelToken.unsubscribe(onCanceled);
|
|
@@ -44491,20 +45784,27 @@ var Neurosity = (function (exports) {
|
|
|
44491
45784
|
}
|
|
44492
45785
|
}
|
|
44493
45786
|
|
|
45787
|
+
let contentType;
|
|
45788
|
+
|
|
44494
45789
|
if (utils.isFormData(requestData)) {
|
|
44495
|
-
|
|
45790
|
+
if ((contentType = requestHeaders.getContentType()) !== false) {
|
|
45791
|
+
// fix semicolon duplication issue for ReactNative FormData implementation
|
|
45792
|
+
const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
|
|
45793
|
+
requestHeaders.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
|
|
45794
|
+
}
|
|
44496
45795
|
}
|
|
44497
45796
|
|
|
44498
|
-
|
|
45797
|
+
let request = new XMLHttpRequest();
|
|
44499
45798
|
|
|
44500
45799
|
// HTTP basic authentication
|
|
44501
45800
|
if (config.auth) {
|
|
44502
|
-
|
|
44503
|
-
|
|
44504
|
-
requestHeaders.Authorization
|
|
45801
|
+
const username = config.auth.username || '';
|
|
45802
|
+
const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
|
|
45803
|
+
requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
|
|
44505
45804
|
}
|
|
44506
45805
|
|
|
44507
|
-
|
|
45806
|
+
const fullPath = buildFullPath(config.baseURL, config.url);
|
|
45807
|
+
|
|
44508
45808
|
request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
|
|
44509
45809
|
|
|
44510
45810
|
// Set the request timeout in MS
|
|
@@ -44515,16 +45815,18 @@ var Neurosity = (function (exports) {
|
|
|
44515
45815
|
return;
|
|
44516
45816
|
}
|
|
44517
45817
|
// Prepare the response
|
|
44518
|
-
|
|
44519
|
-
|
|
45818
|
+
const responseHeaders = AxiosHeaders.from(
|
|
45819
|
+
'getAllResponseHeaders' in request && request.getAllResponseHeaders()
|
|
45820
|
+
);
|
|
45821
|
+
const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
|
|
44520
45822
|
request.responseText : request.response;
|
|
44521
|
-
|
|
45823
|
+
const response = {
|
|
44522
45824
|
data: responseData,
|
|
44523
45825
|
status: request.status,
|
|
44524
45826
|
statusText: request.statusText,
|
|
44525
45827
|
headers: responseHeaders,
|
|
44526
|
-
config
|
|
44527
|
-
request
|
|
45828
|
+
config,
|
|
45829
|
+
request
|
|
44528
45830
|
};
|
|
44529
45831
|
|
|
44530
45832
|
settle(function _resolve(value) {
|
|
@@ -44568,7 +45870,7 @@ var Neurosity = (function (exports) {
|
|
|
44568
45870
|
return;
|
|
44569
45871
|
}
|
|
44570
45872
|
|
|
44571
|
-
reject(
|
|
45873
|
+
reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
|
|
44572
45874
|
|
|
44573
45875
|
// Clean up request
|
|
44574
45876
|
request = null;
|
|
@@ -44578,7 +45880,7 @@ var Neurosity = (function (exports) {
|
|
|
44578
45880
|
request.onerror = function handleError() {
|
|
44579
45881
|
// Real errors are hidden from us by the browser
|
|
44580
45882
|
// onerror should only fire if it's a network error
|
|
44581
|
-
reject(
|
|
45883
|
+
reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
|
|
44582
45884
|
|
|
44583
45885
|
// Clean up request
|
|
44584
45886
|
request = null;
|
|
@@ -44586,45 +45888,28 @@ var Neurosity = (function (exports) {
|
|
|
44586
45888
|
|
|
44587
45889
|
// Handle timeout
|
|
44588
45890
|
request.ontimeout = function handleTimeout() {
|
|
44589
|
-
|
|
44590
|
-
|
|
45891
|
+
let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
|
|
45892
|
+
const transitional = config.transitional || transitionalDefaults;
|
|
44591
45893
|
if (config.timeoutErrorMessage) {
|
|
44592
45894
|
timeoutErrorMessage = config.timeoutErrorMessage;
|
|
44593
45895
|
}
|
|
44594
|
-
reject(
|
|
45896
|
+
reject(new AxiosError(
|
|
44595
45897
|
timeoutErrorMessage,
|
|
45898
|
+
transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
|
|
44596
45899
|
config,
|
|
44597
|
-
transitional.clarifyTimeoutError ? 'ETIMEDOUT' : 'ECONNABORTED',
|
|
44598
45900
|
request));
|
|
44599
45901
|
|
|
44600
45902
|
// Clean up request
|
|
44601
45903
|
request = null;
|
|
44602
45904
|
};
|
|
44603
45905
|
|
|
44604
|
-
//
|
|
44605
|
-
|
|
44606
|
-
// Specifically not if we're in a web worker, or react-native.
|
|
44607
|
-
if (utils.isStandardBrowserEnv()) {
|
|
44608
|
-
// Add xsrf header
|
|
44609
|
-
var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
|
|
44610
|
-
cookies.read(config.xsrfCookieName) :
|
|
44611
|
-
undefined;
|
|
44612
|
-
|
|
44613
|
-
if (xsrfValue) {
|
|
44614
|
-
requestHeaders[config.xsrfHeaderName] = xsrfValue;
|
|
44615
|
-
}
|
|
44616
|
-
}
|
|
45906
|
+
// Remove Content-Type if data is undefined
|
|
45907
|
+
requestData === undefined && requestHeaders.setContentType(null);
|
|
44617
45908
|
|
|
44618
45909
|
// Add headers to the request
|
|
44619
45910
|
if ('setRequestHeader' in request) {
|
|
44620
|
-
utils.forEach(requestHeaders, function setRequestHeader(val, key) {
|
|
44621
|
-
|
|
44622
|
-
// Remove Content-Type if data is undefined
|
|
44623
|
-
delete requestHeaders[key];
|
|
44624
|
-
} else {
|
|
44625
|
-
// Otherwise add header to the request
|
|
44626
|
-
request.setRequestHeader(key, val);
|
|
44627
|
-
}
|
|
45911
|
+
utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
|
|
45912
|
+
request.setRequestHeader(key, val);
|
|
44628
45913
|
});
|
|
44629
45914
|
}
|
|
44630
45915
|
|
|
@@ -44640,22 +45925,22 @@ var Neurosity = (function (exports) {
|
|
|
44640
45925
|
|
|
44641
45926
|
// Handle progress if needed
|
|
44642
45927
|
if (typeof config.onDownloadProgress === 'function') {
|
|
44643
|
-
request.addEventListener('progress', config.onDownloadProgress);
|
|
45928
|
+
request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
|
|
44644
45929
|
}
|
|
44645
45930
|
|
|
44646
45931
|
// Not all browsers support upload events
|
|
44647
45932
|
if (typeof config.onUploadProgress === 'function' && request.upload) {
|
|
44648
|
-
request.upload.addEventListener('progress', config.onUploadProgress);
|
|
45933
|
+
request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
|
|
44649
45934
|
}
|
|
44650
45935
|
|
|
44651
45936
|
if (config.cancelToken || config.signal) {
|
|
44652
45937
|
// Handle cancellation
|
|
44653
45938
|
// eslint-disable-next-line func-names
|
|
44654
|
-
onCanceled =
|
|
45939
|
+
onCanceled = cancel => {
|
|
44655
45940
|
if (!request) {
|
|
44656
45941
|
return;
|
|
44657
45942
|
}
|
|
44658
|
-
reject(!cancel ||
|
|
45943
|
+
reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
|
|
44659
45944
|
request.abort();
|
|
44660
45945
|
request = null;
|
|
44661
45946
|
};
|
|
@@ -44666,168 +45951,98 @@ var Neurosity = (function (exports) {
|
|
|
44666
45951
|
}
|
|
44667
45952
|
}
|
|
44668
45953
|
|
|
44669
|
-
|
|
44670
|
-
|
|
45954
|
+
const protocol = parseProtocol(fullPath);
|
|
45955
|
+
|
|
45956
|
+
if (protocol && platform$1.protocols.indexOf(protocol) === -1) {
|
|
45957
|
+
reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
|
|
45958
|
+
return;
|
|
44671
45959
|
}
|
|
44672
45960
|
|
|
45961
|
+
|
|
44673
45962
|
// Send the request
|
|
44674
|
-
request.send(requestData);
|
|
45963
|
+
request.send(requestData || null);
|
|
44675
45964
|
});
|
|
44676
45965
|
};
|
|
44677
45966
|
|
|
44678
|
-
|
|
44679
|
-
|
|
45967
|
+
const knownAdapters = {
|
|
45968
|
+
http: PlatformFormData,
|
|
45969
|
+
xhr: xhrAdapter
|
|
44680
45970
|
};
|
|
44681
45971
|
|
|
44682
|
-
|
|
44683
|
-
if (
|
|
44684
|
-
headers['Content-Type'] = value;
|
|
44685
|
-
}
|
|
44686
|
-
}
|
|
44687
|
-
|
|
44688
|
-
function getDefaultAdapter() {
|
|
44689
|
-
var adapter;
|
|
44690
|
-
if (typeof XMLHttpRequest !== 'undefined') {
|
|
44691
|
-
// For browsers use XHR adapter
|
|
44692
|
-
adapter = xhr;
|
|
44693
|
-
} else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
|
|
44694
|
-
// For node use HTTP adapter
|
|
44695
|
-
adapter = xhr;
|
|
44696
|
-
}
|
|
44697
|
-
return adapter;
|
|
44698
|
-
}
|
|
44699
|
-
|
|
44700
|
-
function stringifySafely(rawValue, parser, encoder) {
|
|
44701
|
-
if (utils.isString(rawValue)) {
|
|
45972
|
+
utils.forEach(knownAdapters, (fn, value) => {
|
|
45973
|
+
if (fn) {
|
|
44702
45974
|
try {
|
|
44703
|
-
(
|
|
44704
|
-
return utils.trim(rawValue);
|
|
45975
|
+
Object.defineProperty(fn, 'name', {value});
|
|
44705
45976
|
} catch (e) {
|
|
44706
|
-
|
|
44707
|
-
throw e;
|
|
44708
|
-
}
|
|
45977
|
+
// eslint-disable-next-line no-empty
|
|
44709
45978
|
}
|
|
45979
|
+
Object.defineProperty(fn, 'adapterName', {value});
|
|
44710
45980
|
}
|
|
45981
|
+
});
|
|
44711
45982
|
|
|
44712
|
-
|
|
44713
|
-
}
|
|
45983
|
+
const renderReason = (reason) => `- ${reason}`;
|
|
44714
45984
|
|
|
44715
|
-
|
|
45985
|
+
const isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;
|
|
44716
45986
|
|
|
44717
|
-
|
|
44718
|
-
|
|
44719
|
-
|
|
44720
|
-
clarifyTimeoutError: false
|
|
44721
|
-
},
|
|
45987
|
+
var adapters = {
|
|
45988
|
+
getAdapter: (adapters) => {
|
|
45989
|
+
adapters = utils.isArray(adapters) ? adapters : [adapters];
|
|
44722
45990
|
|
|
44723
|
-
|
|
45991
|
+
const {length} = adapters;
|
|
45992
|
+
let nameOrAdapter;
|
|
45993
|
+
let adapter;
|
|
44724
45994
|
|
|
44725
|
-
|
|
44726
|
-
normalizeHeaderName(headers, 'Accept');
|
|
44727
|
-
normalizeHeaderName(headers, 'Content-Type');
|
|
45995
|
+
const rejectedReasons = {};
|
|
44728
45996
|
|
|
44729
|
-
|
|
44730
|
-
|
|
44731
|
-
|
|
44732
|
-
utils.isStream(data) ||
|
|
44733
|
-
utils.isFile(data) ||
|
|
44734
|
-
utils.isBlob(data)
|
|
44735
|
-
) {
|
|
44736
|
-
return data;
|
|
44737
|
-
}
|
|
44738
|
-
if (utils.isArrayBufferView(data)) {
|
|
44739
|
-
return data.buffer;
|
|
44740
|
-
}
|
|
44741
|
-
if (utils.isURLSearchParams(data)) {
|
|
44742
|
-
setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
|
|
44743
|
-
return data.toString();
|
|
44744
|
-
}
|
|
44745
|
-
if (utils.isObject(data) || (headers && headers['Content-Type'] === 'application/json')) {
|
|
44746
|
-
setContentTypeIfUnset(headers, 'application/json');
|
|
44747
|
-
return stringifySafely(data);
|
|
44748
|
-
}
|
|
44749
|
-
return data;
|
|
44750
|
-
}],
|
|
45997
|
+
for (let i = 0; i < length; i++) {
|
|
45998
|
+
nameOrAdapter = adapters[i];
|
|
45999
|
+
let id;
|
|
44751
46000
|
|
|
44752
|
-
|
|
44753
|
-
var transitional = this.transitional || defaults.transitional;
|
|
44754
|
-
var silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
44755
|
-
var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
44756
|
-
var strictJSONParsing = !silentJSONParsing && this.responseType === 'json';
|
|
46001
|
+
adapter = nameOrAdapter;
|
|
44757
46002
|
|
|
44758
|
-
|
|
44759
|
-
|
|
44760
|
-
|
|
44761
|
-
|
|
44762
|
-
|
|
44763
|
-
if (e.name === 'SyntaxError') {
|
|
44764
|
-
throw enhanceError(e, this, 'E_JSON_PARSE');
|
|
44765
|
-
}
|
|
44766
|
-
throw e;
|
|
46003
|
+
if (!isResolvedHandle(nameOrAdapter)) {
|
|
46004
|
+
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
46005
|
+
|
|
46006
|
+
if (adapter === undefined) {
|
|
46007
|
+
throw new AxiosError(`Unknown adapter '${id}'`);
|
|
44767
46008
|
}
|
|
44768
46009
|
}
|
|
44769
|
-
}
|
|
44770
|
-
|
|
44771
|
-
return data;
|
|
44772
|
-
}],
|
|
44773
|
-
|
|
44774
|
-
/**
|
|
44775
|
-
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
44776
|
-
* timeout is not created.
|
|
44777
|
-
*/
|
|
44778
|
-
timeout: 0,
|
|
44779
|
-
|
|
44780
|
-
xsrfCookieName: 'XSRF-TOKEN',
|
|
44781
|
-
xsrfHeaderName: 'X-XSRF-TOKEN',
|
|
44782
|
-
|
|
44783
|
-
maxContentLength: -1,
|
|
44784
|
-
maxBodyLength: -1,
|
|
44785
46010
|
|
|
44786
|
-
|
|
44787
|
-
|
|
44788
|
-
|
|
46011
|
+
if (adapter) {
|
|
46012
|
+
break;
|
|
46013
|
+
}
|
|
44789
46014
|
|
|
44790
|
-
|
|
44791
|
-
common: {
|
|
44792
|
-
'Accept': 'application/json, text/plain, */*'
|
|
46015
|
+
rejectedReasons[id || '#' + i] = adapter;
|
|
44793
46016
|
}
|
|
44794
|
-
}
|
|
44795
|
-
};
|
|
44796
46017
|
|
|
44797
|
-
|
|
44798
|
-
defaults.headers[method] = {};
|
|
44799
|
-
});
|
|
44800
|
-
|
|
44801
|
-
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
44802
|
-
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
|
|
44803
|
-
});
|
|
46018
|
+
if (!adapter) {
|
|
44804
46019
|
|
|
44805
|
-
|
|
46020
|
+
const reasons = Object.entries(rejectedReasons)
|
|
46021
|
+
.map(([id, state]) => `adapter ${id} ` +
|
|
46022
|
+
(state === false ? 'is not supported by the environment' : 'is not available in the build')
|
|
46023
|
+
);
|
|
44806
46024
|
|
|
44807
|
-
|
|
44808
|
-
|
|
44809
|
-
|
|
44810
|
-
* @param {Object|String} data The data to be transformed
|
|
44811
|
-
* @param {Array} headers The headers for the request or response
|
|
44812
|
-
* @param {Array|Function} fns A single function or Array of functions
|
|
44813
|
-
* @returns {*} The resulting transformed data
|
|
44814
|
-
*/
|
|
44815
|
-
var transformData = function transformData(data, headers, fns) {
|
|
44816
|
-
var context = this || defaults_1;
|
|
44817
|
-
/*eslint no-param-reassign:0*/
|
|
44818
|
-
utils.forEach(fns, function transform(fn) {
|
|
44819
|
-
data = fn.call(context, data, headers);
|
|
44820
|
-
});
|
|
46025
|
+
let s = length ?
|
|
46026
|
+
(reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
|
|
46027
|
+
'as no adapter specified';
|
|
44821
46028
|
|
|
44822
|
-
|
|
44823
|
-
|
|
46029
|
+
throw new AxiosError(
|
|
46030
|
+
`There is no suitable adapter to dispatch the request ` + s,
|
|
46031
|
+
'ERR_NOT_SUPPORT'
|
|
46032
|
+
);
|
|
46033
|
+
}
|
|
44824
46034
|
|
|
44825
|
-
|
|
44826
|
-
|
|
46035
|
+
return adapter;
|
|
46036
|
+
},
|
|
46037
|
+
adapters: knownAdapters
|
|
44827
46038
|
};
|
|
44828
46039
|
|
|
44829
46040
|
/**
|
|
44830
|
-
* Throws a `
|
|
46041
|
+
* Throws a `CanceledError` if cancellation has been requested.
|
|
46042
|
+
*
|
|
46043
|
+
* @param {Object} config The config that is to be used for the request
|
|
46044
|
+
*
|
|
46045
|
+
* @returns {void}
|
|
44831
46046
|
*/
|
|
44832
46047
|
function throwIfCancellationRequested(config) {
|
|
44833
46048
|
if (config.cancelToken) {
|
|
@@ -44835,7 +46050,7 @@ var Neurosity = (function (exports) {
|
|
|
44835
46050
|
}
|
|
44836
46051
|
|
|
44837
46052
|
if (config.signal && config.signal.aborted) {
|
|
44838
|
-
throw new
|
|
46053
|
+
throw new CanceledError(null, config);
|
|
44839
46054
|
}
|
|
44840
46055
|
}
|
|
44841
46056
|
|
|
@@ -44843,37 +46058,25 @@ var Neurosity = (function (exports) {
|
|
|
44843
46058
|
* Dispatch a request to the server using the configured adapter.
|
|
44844
46059
|
*
|
|
44845
46060
|
* @param {object} config The config that is to be used for the request
|
|
46061
|
+
*
|
|
44846
46062
|
* @returns {Promise} The Promise to be fulfilled
|
|
44847
46063
|
*/
|
|
44848
|
-
|
|
46064
|
+
function dispatchRequest(config) {
|
|
44849
46065
|
throwIfCancellationRequested(config);
|
|
44850
46066
|
|
|
44851
|
-
|
|
44852
|
-
config.headers = config.headers || {};
|
|
46067
|
+
config.headers = AxiosHeaders.from(config.headers);
|
|
44853
46068
|
|
|
44854
46069
|
// Transform request data
|
|
44855
46070
|
config.data = transformData.call(
|
|
44856
46071
|
config,
|
|
44857
|
-
config.data,
|
|
44858
|
-
config.headers,
|
|
44859
46072
|
config.transformRequest
|
|
44860
46073
|
);
|
|
44861
46074
|
|
|
44862
|
-
|
|
44863
|
-
|
|
44864
|
-
|
|
44865
|
-
config.headers[config.method] || {},
|
|
44866
|
-
config.headers
|
|
44867
|
-
);
|
|
44868
|
-
|
|
44869
|
-
utils.forEach(
|
|
44870
|
-
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
|
44871
|
-
function cleanHeaderConfig(method) {
|
|
44872
|
-
delete config.headers[method];
|
|
44873
|
-
}
|
|
44874
|
-
);
|
|
46075
|
+
if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
|
|
46076
|
+
config.headers.setContentType('application/x-www-form-urlencoded', false);
|
|
46077
|
+
}
|
|
44875
46078
|
|
|
44876
|
-
|
|
46079
|
+
const adapter = adapters.getAdapter(config.adapter || defaults.adapter);
|
|
44877
46080
|
|
|
44878
46081
|
return adapter(config).then(function onAdapterResolution(response) {
|
|
44879
46082
|
throwIfCancellationRequested(config);
|
|
@@ -44881,11 +46084,12 @@ var Neurosity = (function (exports) {
|
|
|
44881
46084
|
// Transform response data
|
|
44882
46085
|
response.data = transformData.call(
|
|
44883
46086
|
config,
|
|
44884
|
-
|
|
44885
|
-
response
|
|
44886
|
-
config.transformResponse
|
|
46087
|
+
config.transformResponse,
|
|
46088
|
+
response
|
|
44887
46089
|
);
|
|
44888
46090
|
|
|
46091
|
+
response.headers = AxiosHeaders.from(response.headers);
|
|
46092
|
+
|
|
44889
46093
|
return response;
|
|
44890
46094
|
}, function onAdapterRejection(reason) {
|
|
44891
46095
|
if (!isCancel(reason)) {
|
|
@@ -44895,16 +46099,18 @@ var Neurosity = (function (exports) {
|
|
|
44895
46099
|
if (reason && reason.response) {
|
|
44896
46100
|
reason.response.data = transformData.call(
|
|
44897
46101
|
config,
|
|
44898
|
-
|
|
44899
|
-
reason.response
|
|
44900
|
-
config.transformResponse
|
|
46102
|
+
config.transformResponse,
|
|
46103
|
+
reason.response
|
|
44901
46104
|
);
|
|
46105
|
+
reason.response.headers = AxiosHeaders.from(reason.response.headers);
|
|
44902
46106
|
}
|
|
44903
46107
|
}
|
|
44904
46108
|
|
|
44905
46109
|
return Promise.reject(reason);
|
|
44906
46110
|
});
|
|
44907
|
-
}
|
|
46111
|
+
}
|
|
46112
|
+
|
|
46113
|
+
const headersToObject = (thing) => thing instanceof AxiosHeaders ? thing.toJSON() : thing;
|
|
44908
46114
|
|
|
44909
46115
|
/**
|
|
44910
46116
|
* Config-specific merge-function which creates a new config-object
|
|
@@ -44912,16 +46118,17 @@ var Neurosity = (function (exports) {
|
|
|
44912
46118
|
*
|
|
44913
46119
|
* @param {Object} config1
|
|
44914
46120
|
* @param {Object} config2
|
|
46121
|
+
*
|
|
44915
46122
|
* @returns {Object} New object resulting from merging config2 to config1
|
|
44916
46123
|
*/
|
|
44917
|
-
|
|
46124
|
+
function mergeConfig(config1, config2) {
|
|
44918
46125
|
// eslint-disable-next-line no-param-reassign
|
|
44919
46126
|
config2 = config2 || {};
|
|
44920
|
-
|
|
46127
|
+
const config = {};
|
|
44921
46128
|
|
|
44922
|
-
function getMergedValue(target, source) {
|
|
46129
|
+
function getMergedValue(target, source, caseless) {
|
|
44923
46130
|
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
|
44924
|
-
return utils.merge(target, source);
|
|
46131
|
+
return utils.merge.call({caseless}, target, source);
|
|
44925
46132
|
} else if (utils.isPlainObject(source)) {
|
|
44926
46133
|
return utils.merge({}, source);
|
|
44927
46134
|
} else if (utils.isArray(source)) {
|
|
@@ -44931,99 +46138,100 @@ var Neurosity = (function (exports) {
|
|
|
44931
46138
|
}
|
|
44932
46139
|
|
|
44933
46140
|
// eslint-disable-next-line consistent-return
|
|
44934
|
-
function mergeDeepProperties(
|
|
44935
|
-
if (!utils.isUndefined(
|
|
44936
|
-
return getMergedValue(
|
|
44937
|
-
} else if (!utils.isUndefined(
|
|
44938
|
-
return getMergedValue(undefined,
|
|
46141
|
+
function mergeDeepProperties(a, b, caseless) {
|
|
46142
|
+
if (!utils.isUndefined(b)) {
|
|
46143
|
+
return getMergedValue(a, b, caseless);
|
|
46144
|
+
} else if (!utils.isUndefined(a)) {
|
|
46145
|
+
return getMergedValue(undefined, a, caseless);
|
|
44939
46146
|
}
|
|
44940
46147
|
}
|
|
44941
46148
|
|
|
44942
46149
|
// eslint-disable-next-line consistent-return
|
|
44943
|
-
function valueFromConfig2(
|
|
44944
|
-
if (!utils.isUndefined(
|
|
44945
|
-
return getMergedValue(undefined,
|
|
46150
|
+
function valueFromConfig2(a, b) {
|
|
46151
|
+
if (!utils.isUndefined(b)) {
|
|
46152
|
+
return getMergedValue(undefined, b);
|
|
44946
46153
|
}
|
|
44947
46154
|
}
|
|
44948
46155
|
|
|
44949
46156
|
// eslint-disable-next-line consistent-return
|
|
44950
|
-
function defaultToConfig2(
|
|
44951
|
-
if (!utils.isUndefined(
|
|
44952
|
-
return getMergedValue(undefined,
|
|
44953
|
-
} else if (!utils.isUndefined(
|
|
44954
|
-
return getMergedValue(undefined,
|
|
46157
|
+
function defaultToConfig2(a, b) {
|
|
46158
|
+
if (!utils.isUndefined(b)) {
|
|
46159
|
+
return getMergedValue(undefined, b);
|
|
46160
|
+
} else if (!utils.isUndefined(a)) {
|
|
46161
|
+
return getMergedValue(undefined, a);
|
|
44955
46162
|
}
|
|
44956
46163
|
}
|
|
44957
46164
|
|
|
44958
46165
|
// eslint-disable-next-line consistent-return
|
|
44959
|
-
function mergeDirectKeys(prop) {
|
|
46166
|
+
function mergeDirectKeys(a, b, prop) {
|
|
44960
46167
|
if (prop in config2) {
|
|
44961
|
-
return getMergedValue(
|
|
46168
|
+
return getMergedValue(a, b);
|
|
44962
46169
|
} else if (prop in config1) {
|
|
44963
|
-
return getMergedValue(undefined,
|
|
46170
|
+
return getMergedValue(undefined, a);
|
|
44964
46171
|
}
|
|
44965
46172
|
}
|
|
44966
46173
|
|
|
44967
|
-
|
|
44968
|
-
|
|
44969
|
-
|
|
44970
|
-
|
|
44971
|
-
|
|
44972
|
-
|
|
44973
|
-
|
|
44974
|
-
|
|
44975
|
-
|
|
44976
|
-
|
|
44977
|
-
|
|
44978
|
-
|
|
44979
|
-
|
|
44980
|
-
|
|
44981
|
-
|
|
44982
|
-
|
|
44983
|
-
|
|
44984
|
-
|
|
44985
|
-
|
|
44986
|
-
|
|
44987
|
-
|
|
44988
|
-
|
|
44989
|
-
|
|
44990
|
-
|
|
44991
|
-
|
|
44992
|
-
|
|
44993
|
-
|
|
46174
|
+
const mergeMap = {
|
|
46175
|
+
url: valueFromConfig2,
|
|
46176
|
+
method: valueFromConfig2,
|
|
46177
|
+
data: valueFromConfig2,
|
|
46178
|
+
baseURL: defaultToConfig2,
|
|
46179
|
+
transformRequest: defaultToConfig2,
|
|
46180
|
+
transformResponse: defaultToConfig2,
|
|
46181
|
+
paramsSerializer: defaultToConfig2,
|
|
46182
|
+
timeout: defaultToConfig2,
|
|
46183
|
+
timeoutMessage: defaultToConfig2,
|
|
46184
|
+
withCredentials: defaultToConfig2,
|
|
46185
|
+
withXSRFToken: defaultToConfig2,
|
|
46186
|
+
adapter: defaultToConfig2,
|
|
46187
|
+
responseType: defaultToConfig2,
|
|
46188
|
+
xsrfCookieName: defaultToConfig2,
|
|
46189
|
+
xsrfHeaderName: defaultToConfig2,
|
|
46190
|
+
onUploadProgress: defaultToConfig2,
|
|
46191
|
+
onDownloadProgress: defaultToConfig2,
|
|
46192
|
+
decompress: defaultToConfig2,
|
|
46193
|
+
maxContentLength: defaultToConfig2,
|
|
46194
|
+
maxBodyLength: defaultToConfig2,
|
|
46195
|
+
beforeRedirect: defaultToConfig2,
|
|
46196
|
+
transport: defaultToConfig2,
|
|
46197
|
+
httpAgent: defaultToConfig2,
|
|
46198
|
+
httpsAgent: defaultToConfig2,
|
|
46199
|
+
cancelToken: defaultToConfig2,
|
|
46200
|
+
socketPath: defaultToConfig2,
|
|
46201
|
+
responseEncoding: defaultToConfig2,
|
|
46202
|
+
validateStatus: mergeDirectKeys,
|
|
46203
|
+
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
|
|
44994
46204
|
};
|
|
44995
46205
|
|
|
44996
|
-
utils.forEach(Object.keys(
|
|
44997
|
-
|
|
44998
|
-
|
|
46206
|
+
utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
|
46207
|
+
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
46208
|
+
const configValue = merge(config1[prop], config2[prop], prop);
|
|
44999
46209
|
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
45000
46210
|
});
|
|
45001
46211
|
|
|
45002
46212
|
return config;
|
|
45003
|
-
}
|
|
45004
|
-
|
|
45005
|
-
var data = {
|
|
45006
|
-
"version": "0.25.0"
|
|
45007
|
-
};
|
|
46213
|
+
}
|
|
45008
46214
|
|
|
45009
|
-
|
|
46215
|
+
const VERSION = "1.6.2";
|
|
45010
46216
|
|
|
45011
|
-
|
|
46217
|
+
const validators = {};
|
|
45012
46218
|
|
|
45013
46219
|
// eslint-disable-next-line func-names
|
|
45014
|
-
['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(
|
|
46220
|
+
['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {
|
|
45015
46221
|
validators[type] = function validator(thing) {
|
|
45016
46222
|
return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
|
|
45017
46223
|
};
|
|
45018
46224
|
});
|
|
45019
46225
|
|
|
45020
|
-
|
|
46226
|
+
const deprecatedWarnings = {};
|
|
45021
46227
|
|
|
45022
46228
|
/**
|
|
45023
46229
|
* Transitional option validator
|
|
46230
|
+
*
|
|
45024
46231
|
* @param {function|boolean?} validator - set to false if the transitional option has been removed
|
|
45025
46232
|
* @param {string?} version - deprecated version / removed since version
|
|
45026
46233
|
* @param {string?} message - some message with additional info
|
|
46234
|
+
*
|
|
45027
46235
|
* @returns {function}
|
|
45028
46236
|
*/
|
|
45029
46237
|
validators.transitional = function transitional(validator, version, message) {
|
|
@@ -45032,9 +46240,12 @@ var Neurosity = (function (exports) {
|
|
|
45032
46240
|
}
|
|
45033
46241
|
|
|
45034
46242
|
// eslint-disable-next-line func-names
|
|
45035
|
-
return
|
|
46243
|
+
return (value, opt, opts) => {
|
|
45036
46244
|
if (validator === false) {
|
|
45037
|
-
throw new
|
|
46245
|
+
throw new AxiosError(
|
|
46246
|
+
formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
|
|
46247
|
+
AxiosError.ERR_DEPRECATED
|
|
46248
|
+
);
|
|
45038
46249
|
}
|
|
45039
46250
|
|
|
45040
46251
|
if (version && !deprecatedWarnings[opt]) {
|
|
@@ -45054,168 +46265,205 @@ var Neurosity = (function (exports) {
|
|
|
45054
46265
|
|
|
45055
46266
|
/**
|
|
45056
46267
|
* Assert object's properties type
|
|
46268
|
+
*
|
|
45057
46269
|
* @param {object} options
|
|
45058
46270
|
* @param {object} schema
|
|
45059
46271
|
* @param {boolean?} allowUnknown
|
|
46272
|
+
*
|
|
46273
|
+
* @returns {object}
|
|
45060
46274
|
*/
|
|
45061
46275
|
|
|
45062
46276
|
function assertOptions(options, schema, allowUnknown) {
|
|
45063
46277
|
if (typeof options !== 'object') {
|
|
45064
|
-
throw new
|
|
46278
|
+
throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
|
|
45065
46279
|
}
|
|
45066
|
-
|
|
45067
|
-
|
|
46280
|
+
const keys = Object.keys(options);
|
|
46281
|
+
let i = keys.length;
|
|
45068
46282
|
while (i-- > 0) {
|
|
45069
|
-
|
|
45070
|
-
|
|
46283
|
+
const opt = keys[i];
|
|
46284
|
+
const validator = schema[opt];
|
|
45071
46285
|
if (validator) {
|
|
45072
|
-
|
|
45073
|
-
|
|
46286
|
+
const value = options[opt];
|
|
46287
|
+
const result = value === undefined || validator(value, opt, options);
|
|
45074
46288
|
if (result !== true) {
|
|
45075
|
-
throw new
|
|
46289
|
+
throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
|
|
45076
46290
|
}
|
|
45077
46291
|
continue;
|
|
45078
46292
|
}
|
|
45079
46293
|
if (allowUnknown !== true) {
|
|
45080
|
-
throw
|
|
46294
|
+
throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
|
|
45081
46295
|
}
|
|
45082
46296
|
}
|
|
45083
46297
|
}
|
|
45084
46298
|
|
|
45085
46299
|
var validator = {
|
|
45086
|
-
assertOptions
|
|
45087
|
-
validators
|
|
46300
|
+
assertOptions,
|
|
46301
|
+
validators
|
|
45088
46302
|
};
|
|
45089
46303
|
|
|
45090
|
-
|
|
46304
|
+
const validators$1 = validator.validators;
|
|
46305
|
+
|
|
45091
46306
|
/**
|
|
45092
46307
|
* Create a new instance of Axios
|
|
45093
46308
|
*
|
|
45094
46309
|
* @param {Object} instanceConfig The default config for the instance
|
|
45095
|
-
*/
|
|
45096
|
-
function Axios(instanceConfig) {
|
|
45097
|
-
this.defaults = instanceConfig;
|
|
45098
|
-
this.interceptors = {
|
|
45099
|
-
request: new InterceptorManager_1(),
|
|
45100
|
-
response: new InterceptorManager_1()
|
|
45101
|
-
};
|
|
45102
|
-
}
|
|
45103
|
-
|
|
45104
|
-
/**
|
|
45105
|
-
* Dispatch a request
|
|
45106
46310
|
*
|
|
45107
|
-
* @
|
|
46311
|
+
* @return {Axios} A new instance of Axios
|
|
45108
46312
|
*/
|
|
45109
|
-
Axios
|
|
45110
|
-
|
|
45111
|
-
|
|
45112
|
-
|
|
45113
|
-
|
|
45114
|
-
|
|
45115
|
-
|
|
45116
|
-
config = configOrUrl || {};
|
|
45117
|
-
}
|
|
45118
|
-
|
|
45119
|
-
if (!config.url) {
|
|
45120
|
-
throw new Error('Provided config url is not valid');
|
|
46313
|
+
class Axios {
|
|
46314
|
+
constructor(instanceConfig) {
|
|
46315
|
+
this.defaults = instanceConfig;
|
|
46316
|
+
this.interceptors = {
|
|
46317
|
+
request: new InterceptorManager(),
|
|
46318
|
+
response: new InterceptorManager()
|
|
46319
|
+
};
|
|
45121
46320
|
}
|
|
45122
46321
|
|
|
45123
|
-
|
|
46322
|
+
/**
|
|
46323
|
+
* Dispatch a request
|
|
46324
|
+
*
|
|
46325
|
+
* @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
|
|
46326
|
+
* @param {?Object} config
|
|
46327
|
+
*
|
|
46328
|
+
* @returns {Promise} The Promise to be fulfilled
|
|
46329
|
+
*/
|
|
46330
|
+
request(configOrUrl, config) {
|
|
46331
|
+
/*eslint no-param-reassign:0*/
|
|
46332
|
+
// Allow for axios('example/url'[, config]) a la fetch API
|
|
46333
|
+
if (typeof configOrUrl === 'string') {
|
|
46334
|
+
config = config || {};
|
|
46335
|
+
config.url = configOrUrl;
|
|
46336
|
+
} else {
|
|
46337
|
+
config = configOrUrl || {};
|
|
46338
|
+
}
|
|
45124
46339
|
|
|
45125
|
-
|
|
45126
|
-
if (config.method) {
|
|
45127
|
-
config.method = config.method.toLowerCase();
|
|
45128
|
-
} else if (this.defaults.method) {
|
|
45129
|
-
config.method = this.defaults.method.toLowerCase();
|
|
45130
|
-
} else {
|
|
45131
|
-
config.method = 'get';
|
|
45132
|
-
}
|
|
46340
|
+
config = mergeConfig(this.defaults, config);
|
|
45133
46341
|
|
|
45134
|
-
|
|
46342
|
+
const {transitional, paramsSerializer, headers} = config;
|
|
45135
46343
|
|
|
45136
|
-
|
|
45137
|
-
|
|
45138
|
-
|
|
45139
|
-
|
|
45140
|
-
|
|
45141
|
-
|
|
45142
|
-
|
|
46344
|
+
if (transitional !== undefined) {
|
|
46345
|
+
validator.assertOptions(transitional, {
|
|
46346
|
+
silentJSONParsing: validators$1.transitional(validators$1.boolean),
|
|
46347
|
+
forcedJSONParsing: validators$1.transitional(validators$1.boolean),
|
|
46348
|
+
clarifyTimeoutError: validators$1.transitional(validators$1.boolean)
|
|
46349
|
+
}, false);
|
|
46350
|
+
}
|
|
45143
46351
|
|
|
45144
|
-
|
|
45145
|
-
|
|
45146
|
-
|
|
45147
|
-
|
|
45148
|
-
|
|
45149
|
-
|
|
46352
|
+
if (paramsSerializer != null) {
|
|
46353
|
+
if (utils.isFunction(paramsSerializer)) {
|
|
46354
|
+
config.paramsSerializer = {
|
|
46355
|
+
serialize: paramsSerializer
|
|
46356
|
+
};
|
|
46357
|
+
} else {
|
|
46358
|
+
validator.assertOptions(paramsSerializer, {
|
|
46359
|
+
encode: validators$1.function,
|
|
46360
|
+
serialize: validators$1.function
|
|
46361
|
+
}, true);
|
|
46362
|
+
}
|
|
45150
46363
|
}
|
|
45151
46364
|
|
|
45152
|
-
|
|
46365
|
+
// Set config.method
|
|
46366
|
+
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
|
45153
46367
|
|
|
45154
|
-
|
|
45155
|
-
|
|
46368
|
+
// Flatten headers
|
|
46369
|
+
let contextHeaders = headers && utils.merge(
|
|
46370
|
+
headers.common,
|
|
46371
|
+
headers[config.method]
|
|
46372
|
+
);
|
|
45156
46373
|
|
|
45157
|
-
|
|
45158
|
-
|
|
45159
|
-
|
|
45160
|
-
|
|
46374
|
+
headers && utils.forEach(
|
|
46375
|
+
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
|
46376
|
+
(method) => {
|
|
46377
|
+
delete headers[method];
|
|
46378
|
+
}
|
|
46379
|
+
);
|
|
46380
|
+
|
|
46381
|
+
config.headers = AxiosHeaders.concat(contextHeaders, headers);
|
|
46382
|
+
|
|
46383
|
+
// filter out skipped interceptors
|
|
46384
|
+
const requestInterceptorChain = [];
|
|
46385
|
+
let synchronousRequestInterceptors = true;
|
|
46386
|
+
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
|
46387
|
+
if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
|
|
46388
|
+
return;
|
|
46389
|
+
}
|
|
46390
|
+
|
|
46391
|
+
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
46392
|
+
|
|
46393
|
+
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
46394
|
+
});
|
|
46395
|
+
|
|
46396
|
+
const responseInterceptorChain = [];
|
|
46397
|
+
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
|
46398
|
+
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
46399
|
+
});
|
|
46400
|
+
|
|
46401
|
+
let promise;
|
|
46402
|
+
let i = 0;
|
|
46403
|
+
let len;
|
|
45161
46404
|
|
|
45162
|
-
|
|
46405
|
+
if (!synchronousRequestInterceptors) {
|
|
46406
|
+
const chain = [dispatchRequest.bind(this), undefined];
|
|
46407
|
+
chain.unshift.apply(chain, requestInterceptorChain);
|
|
46408
|
+
chain.push.apply(chain, responseInterceptorChain);
|
|
46409
|
+
len = chain.length;
|
|
45163
46410
|
|
|
45164
|
-
|
|
45165
|
-
var chain = [dispatchRequest, undefined];
|
|
46411
|
+
promise = Promise.resolve(config);
|
|
45166
46412
|
|
|
45167
|
-
|
|
45168
|
-
|
|
46413
|
+
while (i < len) {
|
|
46414
|
+
promise = promise.then(chain[i++], chain[i++]);
|
|
46415
|
+
}
|
|
45169
46416
|
|
|
45170
|
-
|
|
45171
|
-
while (chain.length) {
|
|
45172
|
-
promise = promise.then(chain.shift(), chain.shift());
|
|
46417
|
+
return promise;
|
|
45173
46418
|
}
|
|
45174
46419
|
|
|
45175
|
-
|
|
45176
|
-
}
|
|
46420
|
+
len = requestInterceptorChain.length;
|
|
45177
46421
|
|
|
46422
|
+
let newConfig = config;
|
|
46423
|
+
|
|
46424
|
+
i = 0;
|
|
46425
|
+
|
|
46426
|
+
while (i < len) {
|
|
46427
|
+
const onFulfilled = requestInterceptorChain[i++];
|
|
46428
|
+
const onRejected = requestInterceptorChain[i++];
|
|
46429
|
+
try {
|
|
46430
|
+
newConfig = onFulfilled(newConfig);
|
|
46431
|
+
} catch (error) {
|
|
46432
|
+
onRejected.call(this, error);
|
|
46433
|
+
break;
|
|
46434
|
+
}
|
|
46435
|
+
}
|
|
45178
46436
|
|
|
45179
|
-
var newConfig = config;
|
|
45180
|
-
while (requestInterceptorChain.length) {
|
|
45181
|
-
var onFulfilled = requestInterceptorChain.shift();
|
|
45182
|
-
var onRejected = requestInterceptorChain.shift();
|
|
45183
46437
|
try {
|
|
45184
|
-
|
|
46438
|
+
promise = dispatchRequest.call(this, newConfig);
|
|
45185
46439
|
} catch (error) {
|
|
45186
|
-
|
|
45187
|
-
break;
|
|
46440
|
+
return Promise.reject(error);
|
|
45188
46441
|
}
|
|
45189
|
-
}
|
|
45190
46442
|
|
|
45191
|
-
|
|
45192
|
-
|
|
45193
|
-
} catch (error) {
|
|
45194
|
-
return Promise.reject(error);
|
|
45195
|
-
}
|
|
46443
|
+
i = 0;
|
|
46444
|
+
len = responseInterceptorChain.length;
|
|
45196
46445
|
|
|
45197
|
-
|
|
45198
|
-
|
|
45199
|
-
|
|
46446
|
+
while (i < len) {
|
|
46447
|
+
promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
|
|
46448
|
+
}
|
|
45200
46449
|
|
|
45201
|
-
|
|
45202
|
-
|
|
46450
|
+
return promise;
|
|
46451
|
+
}
|
|
45203
46452
|
|
|
45204
|
-
|
|
45205
|
-
|
|
45206
|
-
|
|
46453
|
+
getUri(config) {
|
|
46454
|
+
config = mergeConfig(this.defaults, config);
|
|
46455
|
+
const fullPath = buildFullPath(config.baseURL, config.url);
|
|
46456
|
+
return buildURL(fullPath, config.params, config.paramsSerializer);
|
|
45207
46457
|
}
|
|
45208
|
-
|
|
45209
|
-
return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
|
|
45210
|
-
};
|
|
46458
|
+
}
|
|
45211
46459
|
|
|
45212
46460
|
// Provide aliases for supported request methods
|
|
45213
46461
|
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
|
45214
46462
|
/*eslint func-names:0*/
|
|
45215
46463
|
Axios.prototype[method] = function(url, config) {
|
|
45216
46464
|
return this.request(mergeConfig(config || {}, {
|
|
45217
|
-
method
|
|
45218
|
-
url
|
|
46465
|
+
method,
|
|
46466
|
+
url,
|
|
45219
46467
|
data: (config || {}).data
|
|
45220
46468
|
}));
|
|
45221
46469
|
};
|
|
@@ -45223,132 +46471,140 @@ var Neurosity = (function (exports) {
|
|
|
45223
46471
|
|
|
45224
46472
|
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
45225
46473
|
/*eslint func-names:0*/
|
|
45226
|
-
Axios.prototype[method] = function(url, data, config) {
|
|
45227
|
-
return this.request(mergeConfig(config || {}, {
|
|
45228
|
-
method: method,
|
|
45229
|
-
url: url,
|
|
45230
|
-
data: data
|
|
45231
|
-
}));
|
|
45232
|
-
};
|
|
45233
|
-
});
|
|
45234
46474
|
|
|
45235
|
-
|
|
46475
|
+
function generateHTTPMethod(isForm) {
|
|
46476
|
+
return function httpMethod(url, data, config) {
|
|
46477
|
+
return this.request(mergeConfig(config || {}, {
|
|
46478
|
+
method,
|
|
46479
|
+
headers: isForm ? {
|
|
46480
|
+
'Content-Type': 'multipart/form-data'
|
|
46481
|
+
} : {},
|
|
46482
|
+
url,
|
|
46483
|
+
data
|
|
46484
|
+
}));
|
|
46485
|
+
};
|
|
46486
|
+
}
|
|
46487
|
+
|
|
46488
|
+
Axios.prototype[method] = generateHTTPMethod();
|
|
46489
|
+
|
|
46490
|
+
Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
|
|
46491
|
+
});
|
|
45236
46492
|
|
|
45237
46493
|
/**
|
|
45238
46494
|
* A `CancelToken` is an object that can be used to request cancellation of an operation.
|
|
45239
46495
|
*
|
|
45240
|
-
* @class
|
|
45241
46496
|
* @param {Function} executor The executor function.
|
|
46497
|
+
*
|
|
46498
|
+
* @returns {CancelToken}
|
|
45242
46499
|
*/
|
|
45243
|
-
|
|
45244
|
-
|
|
45245
|
-
|
|
45246
|
-
|
|
46500
|
+
class CancelToken {
|
|
46501
|
+
constructor(executor) {
|
|
46502
|
+
if (typeof executor !== 'function') {
|
|
46503
|
+
throw new TypeError('executor must be a function.');
|
|
46504
|
+
}
|
|
45247
46505
|
|
|
45248
|
-
|
|
46506
|
+
let resolvePromise;
|
|
45249
46507
|
|
|
45250
|
-
|
|
45251
|
-
|
|
45252
|
-
|
|
46508
|
+
this.promise = new Promise(function promiseExecutor(resolve) {
|
|
46509
|
+
resolvePromise = resolve;
|
|
46510
|
+
});
|
|
45253
46511
|
|
|
45254
|
-
|
|
46512
|
+
const token = this;
|
|
45255
46513
|
|
|
45256
|
-
|
|
45257
|
-
|
|
45258
|
-
|
|
46514
|
+
// eslint-disable-next-line func-names
|
|
46515
|
+
this.promise.then(cancel => {
|
|
46516
|
+
if (!token._listeners) return;
|
|
45259
46517
|
|
|
45260
|
-
|
|
45261
|
-
var l = token._listeners.length;
|
|
46518
|
+
let i = token._listeners.length;
|
|
45262
46519
|
|
|
45263
|
-
|
|
45264
|
-
|
|
45265
|
-
|
|
45266
|
-
|
|
45267
|
-
|
|
46520
|
+
while (i-- > 0) {
|
|
46521
|
+
token._listeners[i](cancel);
|
|
46522
|
+
}
|
|
46523
|
+
token._listeners = null;
|
|
46524
|
+
});
|
|
45268
46525
|
|
|
45269
|
-
// eslint-disable-next-line func-names
|
|
45270
|
-
this.promise.then = function(onfulfilled) {
|
|
45271
|
-
var _resolve;
|
|
45272
46526
|
// eslint-disable-next-line func-names
|
|
45273
|
-
|
|
45274
|
-
|
|
45275
|
-
|
|
45276
|
-
|
|
46527
|
+
this.promise.then = onfulfilled => {
|
|
46528
|
+
let _resolve;
|
|
46529
|
+
// eslint-disable-next-line func-names
|
|
46530
|
+
const promise = new Promise(resolve => {
|
|
46531
|
+
token.subscribe(resolve);
|
|
46532
|
+
_resolve = resolve;
|
|
46533
|
+
}).then(onfulfilled);
|
|
45277
46534
|
|
|
45278
|
-
|
|
45279
|
-
|
|
45280
|
-
|
|
46535
|
+
promise.cancel = function reject() {
|
|
46536
|
+
token.unsubscribe(_resolve);
|
|
46537
|
+
};
|
|
45281
46538
|
|
|
45282
|
-
|
|
45283
|
-
|
|
46539
|
+
return promise;
|
|
46540
|
+
};
|
|
45284
46541
|
|
|
45285
|
-
|
|
45286
|
-
|
|
45287
|
-
|
|
45288
|
-
|
|
45289
|
-
|
|
46542
|
+
executor(function cancel(message, config, request) {
|
|
46543
|
+
if (token.reason) {
|
|
46544
|
+
// Cancellation has already been requested
|
|
46545
|
+
return;
|
|
46546
|
+
}
|
|
45290
46547
|
|
|
45291
|
-
|
|
45292
|
-
|
|
45293
|
-
|
|
45294
|
-
|
|
46548
|
+
token.reason = new CanceledError(message, config, request);
|
|
46549
|
+
resolvePromise(token.reason);
|
|
46550
|
+
});
|
|
46551
|
+
}
|
|
45295
46552
|
|
|
45296
|
-
|
|
45297
|
-
|
|
45298
|
-
|
|
45299
|
-
|
|
45300
|
-
|
|
45301
|
-
|
|
46553
|
+
/**
|
|
46554
|
+
* Throws a `CanceledError` if cancellation has been requested.
|
|
46555
|
+
*/
|
|
46556
|
+
throwIfRequested() {
|
|
46557
|
+
if (this.reason) {
|
|
46558
|
+
throw this.reason;
|
|
46559
|
+
}
|
|
45302
46560
|
}
|
|
45303
|
-
};
|
|
45304
46561
|
|
|
45305
|
-
|
|
45306
|
-
|
|
45307
|
-
|
|
46562
|
+
/**
|
|
46563
|
+
* Subscribe to the cancel signal
|
|
46564
|
+
*/
|
|
45308
46565
|
|
|
45309
|
-
|
|
45310
|
-
|
|
45311
|
-
|
|
45312
|
-
|
|
45313
|
-
|
|
46566
|
+
subscribe(listener) {
|
|
46567
|
+
if (this.reason) {
|
|
46568
|
+
listener(this.reason);
|
|
46569
|
+
return;
|
|
46570
|
+
}
|
|
45314
46571
|
|
|
45315
|
-
|
|
45316
|
-
|
|
45317
|
-
|
|
45318
|
-
|
|
46572
|
+
if (this._listeners) {
|
|
46573
|
+
this._listeners.push(listener);
|
|
46574
|
+
} else {
|
|
46575
|
+
this._listeners = [listener];
|
|
46576
|
+
}
|
|
45319
46577
|
}
|
|
45320
|
-
};
|
|
45321
46578
|
|
|
45322
|
-
|
|
45323
|
-
|
|
45324
|
-
|
|
46579
|
+
/**
|
|
46580
|
+
* Unsubscribe from the cancel signal
|
|
46581
|
+
*/
|
|
45325
46582
|
|
|
45326
|
-
|
|
45327
|
-
|
|
45328
|
-
|
|
45329
|
-
|
|
45330
|
-
|
|
45331
|
-
|
|
45332
|
-
|
|
46583
|
+
unsubscribe(listener) {
|
|
46584
|
+
if (!this._listeners) {
|
|
46585
|
+
return;
|
|
46586
|
+
}
|
|
46587
|
+
const index = this._listeners.indexOf(listener);
|
|
46588
|
+
if (index !== -1) {
|
|
46589
|
+
this._listeners.splice(index, 1);
|
|
46590
|
+
}
|
|
45333
46591
|
}
|
|
45334
|
-
};
|
|
45335
|
-
|
|
45336
|
-
/**
|
|
45337
|
-
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
45338
|
-
* cancels the `CancelToken`.
|
|
45339
|
-
*/
|
|
45340
|
-
CancelToken.source = function source() {
|
|
45341
|
-
var cancel;
|
|
45342
|
-
var token = new CancelToken(function executor(c) {
|
|
45343
|
-
cancel = c;
|
|
45344
|
-
});
|
|
45345
|
-
return {
|
|
45346
|
-
token: token,
|
|
45347
|
-
cancel: cancel
|
|
45348
|
-
};
|
|
45349
|
-
};
|
|
45350
46592
|
|
|
45351
|
-
|
|
46593
|
+
/**
|
|
46594
|
+
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
46595
|
+
* cancels the `CancelToken`.
|
|
46596
|
+
*/
|
|
46597
|
+
static source() {
|
|
46598
|
+
let cancel;
|
|
46599
|
+
const token = new CancelToken(function executor(c) {
|
|
46600
|
+
cancel = c;
|
|
46601
|
+
});
|
|
46602
|
+
return {
|
|
46603
|
+
token,
|
|
46604
|
+
cancel
|
|
46605
|
+
};
|
|
46606
|
+
}
|
|
46607
|
+
}
|
|
45352
46608
|
|
|
45353
46609
|
/**
|
|
45354
46610
|
* Syntactic sugar for invoking a function and expanding an array for arguments.
|
|
@@ -45368,39 +46624,112 @@ var Neurosity = (function (exports) {
|
|
|
45368
46624
|
* ```
|
|
45369
46625
|
*
|
|
45370
46626
|
* @param {Function} callback
|
|
46627
|
+
*
|
|
45371
46628
|
* @returns {Function}
|
|
45372
46629
|
*/
|
|
45373
|
-
|
|
46630
|
+
function spread(callback) {
|
|
45374
46631
|
return function wrap(arr) {
|
|
45375
46632
|
return callback.apply(null, arr);
|
|
45376
46633
|
};
|
|
45377
|
-
}
|
|
46634
|
+
}
|
|
45378
46635
|
|
|
45379
46636
|
/**
|
|
45380
46637
|
* Determines whether the payload is an error thrown by Axios
|
|
45381
46638
|
*
|
|
45382
46639
|
* @param {*} payload The value to test
|
|
46640
|
+
*
|
|
45383
46641
|
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
|
45384
46642
|
*/
|
|
45385
|
-
|
|
46643
|
+
function isAxiosError(payload) {
|
|
45386
46644
|
return utils.isObject(payload) && (payload.isAxiosError === true);
|
|
46645
|
+
}
|
|
46646
|
+
|
|
46647
|
+
const HttpStatusCode = {
|
|
46648
|
+
Continue: 100,
|
|
46649
|
+
SwitchingProtocols: 101,
|
|
46650
|
+
Processing: 102,
|
|
46651
|
+
EarlyHints: 103,
|
|
46652
|
+
Ok: 200,
|
|
46653
|
+
Created: 201,
|
|
46654
|
+
Accepted: 202,
|
|
46655
|
+
NonAuthoritativeInformation: 203,
|
|
46656
|
+
NoContent: 204,
|
|
46657
|
+
ResetContent: 205,
|
|
46658
|
+
PartialContent: 206,
|
|
46659
|
+
MultiStatus: 207,
|
|
46660
|
+
AlreadyReported: 208,
|
|
46661
|
+
ImUsed: 226,
|
|
46662
|
+
MultipleChoices: 300,
|
|
46663
|
+
MovedPermanently: 301,
|
|
46664
|
+
Found: 302,
|
|
46665
|
+
SeeOther: 303,
|
|
46666
|
+
NotModified: 304,
|
|
46667
|
+
UseProxy: 305,
|
|
46668
|
+
Unused: 306,
|
|
46669
|
+
TemporaryRedirect: 307,
|
|
46670
|
+
PermanentRedirect: 308,
|
|
46671
|
+
BadRequest: 400,
|
|
46672
|
+
Unauthorized: 401,
|
|
46673
|
+
PaymentRequired: 402,
|
|
46674
|
+
Forbidden: 403,
|
|
46675
|
+
NotFound: 404,
|
|
46676
|
+
MethodNotAllowed: 405,
|
|
46677
|
+
NotAcceptable: 406,
|
|
46678
|
+
ProxyAuthenticationRequired: 407,
|
|
46679
|
+
RequestTimeout: 408,
|
|
46680
|
+
Conflict: 409,
|
|
46681
|
+
Gone: 410,
|
|
46682
|
+
LengthRequired: 411,
|
|
46683
|
+
PreconditionFailed: 412,
|
|
46684
|
+
PayloadTooLarge: 413,
|
|
46685
|
+
UriTooLong: 414,
|
|
46686
|
+
UnsupportedMediaType: 415,
|
|
46687
|
+
RangeNotSatisfiable: 416,
|
|
46688
|
+
ExpectationFailed: 417,
|
|
46689
|
+
ImATeapot: 418,
|
|
46690
|
+
MisdirectedRequest: 421,
|
|
46691
|
+
UnprocessableEntity: 422,
|
|
46692
|
+
Locked: 423,
|
|
46693
|
+
FailedDependency: 424,
|
|
46694
|
+
TooEarly: 425,
|
|
46695
|
+
UpgradeRequired: 426,
|
|
46696
|
+
PreconditionRequired: 428,
|
|
46697
|
+
TooManyRequests: 429,
|
|
46698
|
+
RequestHeaderFieldsTooLarge: 431,
|
|
46699
|
+
UnavailableForLegalReasons: 451,
|
|
46700
|
+
InternalServerError: 500,
|
|
46701
|
+
NotImplemented: 501,
|
|
46702
|
+
BadGateway: 502,
|
|
46703
|
+
ServiceUnavailable: 503,
|
|
46704
|
+
GatewayTimeout: 504,
|
|
46705
|
+
HttpVersionNotSupported: 505,
|
|
46706
|
+
VariantAlsoNegotiates: 506,
|
|
46707
|
+
InsufficientStorage: 507,
|
|
46708
|
+
LoopDetected: 508,
|
|
46709
|
+
NotExtended: 510,
|
|
46710
|
+
NetworkAuthenticationRequired: 511,
|
|
45387
46711
|
};
|
|
45388
46712
|
|
|
46713
|
+
Object.entries(HttpStatusCode).forEach(([key, value]) => {
|
|
46714
|
+
HttpStatusCode[value] = key;
|
|
46715
|
+
});
|
|
46716
|
+
|
|
45389
46717
|
/**
|
|
45390
46718
|
* Create an instance of Axios
|
|
45391
46719
|
*
|
|
45392
46720
|
* @param {Object} defaultConfig The default config for the instance
|
|
45393
|
-
*
|
|
46721
|
+
*
|
|
46722
|
+
* @returns {Axios} A new instance of Axios
|
|
45394
46723
|
*/
|
|
45395
46724
|
function createInstance(defaultConfig) {
|
|
45396
|
-
|
|
45397
|
-
|
|
46725
|
+
const context = new Axios(defaultConfig);
|
|
46726
|
+
const instance = bind$1(Axios.prototype.request, context);
|
|
45398
46727
|
|
|
45399
46728
|
// Copy axios.prototype to instance
|
|
45400
|
-
utils.extend(instance,
|
|
46729
|
+
utils.extend(instance, Axios.prototype, context, {allOwnKeys: true});
|
|
45401
46730
|
|
|
45402
46731
|
// Copy context to instance
|
|
45403
|
-
utils.extend(instance, context);
|
|
46732
|
+
utils.extend(instance, context, null, {allOwnKeys: true});
|
|
45404
46733
|
|
|
45405
46734
|
// Factory for creating new instances
|
|
45406
46735
|
instance.create = function create(instanceConfig) {
|
|
@@ -45411,33 +46740,46 @@ var Neurosity = (function (exports) {
|
|
|
45411
46740
|
}
|
|
45412
46741
|
|
|
45413
46742
|
// Create the default instance to be exported
|
|
45414
|
-
|
|
46743
|
+
const axios = createInstance(defaults);
|
|
45415
46744
|
|
|
45416
46745
|
// Expose Axios class to allow class inheritance
|
|
45417
|
-
axios.Axios =
|
|
46746
|
+
axios.Axios = Axios;
|
|
45418
46747
|
|
|
45419
46748
|
// Expose Cancel & CancelToken
|
|
45420
|
-
axios.
|
|
45421
|
-
axios.CancelToken =
|
|
46749
|
+
axios.CanceledError = CanceledError;
|
|
46750
|
+
axios.CancelToken = CancelToken;
|
|
45422
46751
|
axios.isCancel = isCancel;
|
|
45423
|
-
axios.VERSION =
|
|
46752
|
+
axios.VERSION = VERSION;
|
|
46753
|
+
axios.toFormData = toFormData;
|
|
46754
|
+
|
|
46755
|
+
// Expose AxiosError class
|
|
46756
|
+
axios.AxiosError = AxiosError;
|
|
46757
|
+
|
|
46758
|
+
// alias for CanceledError for backward compatibility
|
|
46759
|
+
axios.Cancel = axios.CanceledError;
|
|
45424
46760
|
|
|
45425
46761
|
// Expose all/spread
|
|
45426
46762
|
axios.all = function all(promises) {
|
|
45427
46763
|
return Promise.all(promises);
|
|
45428
46764
|
};
|
|
46765
|
+
|
|
45429
46766
|
axios.spread = spread;
|
|
45430
46767
|
|
|
45431
46768
|
// Expose isAxiosError
|
|
45432
46769
|
axios.isAxiosError = isAxiosError;
|
|
45433
46770
|
|
|
45434
|
-
|
|
46771
|
+
// Expose mergeConfig
|
|
46772
|
+
axios.mergeConfig = mergeConfig;
|
|
46773
|
+
|
|
46774
|
+
axios.AxiosHeaders = AxiosHeaders;
|
|
46775
|
+
|
|
46776
|
+
axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
46777
|
+
|
|
46778
|
+
axios.getAdapter = adapters.getAdapter;
|
|
45435
46779
|
|
|
45436
|
-
|
|
45437
|
-
var default_1 = axios;
|
|
45438
|
-
axios_1.default = default_1;
|
|
46780
|
+
axios.HttpStatusCode = HttpStatusCode;
|
|
45439
46781
|
|
|
45440
|
-
|
|
46782
|
+
axios.default = axios;
|
|
45441
46783
|
|
|
45442
46784
|
const prodFunctionsBaseUrl = "https://us-central1-neurosity-device.cloudfunctions.net";
|
|
45443
46785
|
|
|
@@ -45453,7 +46795,7 @@ var Neurosity = (function (exports) {
|
|
|
45453
46795
|
function createOAuthURL(config, sdkOptions) {
|
|
45454
46796
|
const { clientId, clientSecret, responseType, redirectUri, scope, state } = config;
|
|
45455
46797
|
const baseUrl = getFunctionsBaseURL(sdkOptions);
|
|
45456
|
-
return axios
|
|
46798
|
+
return axios
|
|
45457
46799
|
.get(`${baseUrl}/authorize/entry`, {
|
|
45458
46800
|
params: Object.assign(Object.assign({ client_id: clientId }, (clientSecret ? { client_secret: clientSecret } : {})), { response_type: responseType, redirect_uri: redirectUri, scope: scope.join(","), state: state, redirect: "false" })
|
|
45459
46801
|
})
|
|
@@ -45473,9 +46815,9 @@ var Neurosity = (function (exports) {
|
|
|
45473
46815
|
return __awaiter$a(this, void 0, void 0, function* () {
|
|
45474
46816
|
const baseUrl = getFunctionsBaseURL(sdkOptions);
|
|
45475
46817
|
// Get refresh token
|
|
45476
|
-
const refreshResponse = yield axios
|
|
46818
|
+
const refreshResponse = yield axios.post(`${baseUrl}/getOAuthRefreshToken`, query);
|
|
45477
46819
|
const refreshToken = refreshResponse.data;
|
|
45478
|
-
return axios
|
|
46820
|
+
return axios
|
|
45479
46821
|
.post(`${baseUrl}/token`, {
|
|
45480
46822
|
grant_type: "refresh_token",
|
|
45481
46823
|
refresh_token: refreshToken.data,
|
|
@@ -51085,6 +52427,7 @@ var Neurosity = (function (exports) {
|
|
|
51085
52427
|
|
|
51086
52428
|
exports.Neurosity = Neurosity;
|
|
51087
52429
|
exports.Notion = Notion;
|
|
52430
|
+
exports.__firebase = __firebase;
|
|
51088
52431
|
exports.BluetoothClient = BluetoothClient;
|
|
51089
52432
|
exports.WebBluetoothTransport = WebBluetoothTransport;
|
|
51090
52433
|
exports.ReactNativeTransport = ReactNativeTransport;
|