@neurosity/sdk 6.5.9 → 6.5.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/dist/browser/neurosity.iife.js +2419 -1009
  2. package/dist/browser/neurosity.js +180 -148
  3. package/dist/browser/neurosity.js.map +1 -1
  4. package/dist/cjs/__tests__/Neurosity.test.d.ts +1 -0
  5. package/dist/cjs/__tests__/Neurosity.test.js +201 -0
  6. package/dist/cjs/__tests__/WebBluetoothTransport.test.d.ts +1 -0
  7. package/dist/cjs/__tests__/WebBluetoothTransport.test.js +201 -0
  8. package/dist/cjs/__tests__/accelerometer.test.d.ts +1 -0
  9. package/dist/cjs/__tests__/accelerometer.test.js +158 -0
  10. package/dist/cjs/__tests__/auth.test.d.ts +1 -0
  11. package/dist/cjs/__tests__/auth.test.js +239 -0
  12. package/dist/cjs/__tests__/brainwaves.test.d.ts +1 -0
  13. package/dist/cjs/__tests__/brainwaves.test.js +291 -0
  14. package/dist/cjs/__tests__/device.test.d.ts +1 -0
  15. package/dist/cjs/__tests__/device.test.js +281 -0
  16. package/dist/cjs/__tests__/haptics.test.d.ts +1 -0
  17. package/dist/cjs/__tests__/haptics.test.js +162 -0
  18. package/dist/cjs/__tests__/metrics.test.d.ts +1 -0
  19. package/dist/cjs/__tests__/metrics.test.js +178 -0
  20. package/dist/cjs/__tests__/oauth.test.d.ts +1 -0
  21. package/dist/cjs/__tests__/oauth.test.js +138 -0
  22. package/dist/cjs/__tests__/settings.test.d.ts +1 -0
  23. package/dist/cjs/__tests__/settings.test.js +130 -0
  24. package/dist/cjs/__tests__/setup/webBluetooth.setup.d.ts +11 -0
  25. package/dist/cjs/__tests__/setup/webBluetooth.setup.js +35 -0
  26. package/dist/cjs/__tests__/setup.d.ts +0 -0
  27. package/dist/cjs/__tests__/setup.js +7 -0
  28. package/dist/cjs/__tests__/streaming.test.d.ts +1 -0
  29. package/dist/cjs/__tests__/streaming.test.js +259 -0
  30. package/dist/cjs/__tests__/timesync.test.d.ts +1 -0
  31. package/dist/cjs/__tests__/timesync.test.js +54 -0
  32. package/dist/cjs/__tests__/utils.test.d.ts +1 -0
  33. package/dist/cjs/__tests__/utils.test.js +281 -0
  34. package/dist/cjs/api/bluetooth/BluetoothClient.d.ts +6 -6
  35. package/dist/cjs/api/bluetooth/BluetoothTransport.d.ts +1 -1
  36. package/dist/cjs/api/bluetooth/react-native/ReactNativeTransport.d.ts +4 -4
  37. package/dist/cjs/api/bluetooth/react-native/types/ReactNativeTypes.d.ts +2 -2
  38. package/dist/cjs/api/bluetooth/types/index.d.ts +2 -2
  39. package/dist/cjs/api/bluetooth/utils/decodeJSONChunks.d.ts +1 -1
  40. package/dist/cjs/api/bluetooth/utils/stitch.d.ts +1 -1
  41. package/dist/cjs/api/bluetooth/utils/textCodec.d.ts +1 -1
  42. package/dist/cjs/api/bluetooth/web/WebBluetoothTransport.d.ts +1 -1
  43. package/dist/cjs/api/firebase/FirebaseDevice.d.ts +1 -1
  44. package/dist/cjs/api/firebase/FirebaseUser.d.ts +1 -1
  45. package/dist/cjs/api/index.js +1 -1
  46. package/dist/cjs/timesync/Timesync.d.ts +1 -1
  47. package/dist/cjs/types/awareness.d.ts +1 -1
  48. package/dist/cjs/types/brainwaves.d.ts +25 -12
  49. package/dist/cjs/types/credentials.d.ts +4 -4
  50. package/dist/cjs/types/deviceInfo.d.ts +4 -4
  51. package/dist/cjs/types/epoch.d.ts +1 -1
  52. package/dist/cjs/types/experiment.d.ts +1 -1
  53. package/dist/cjs/types/hapticEffects.d.ts +1 -1
  54. package/dist/cjs/types/marker.d.ts +1 -1
  55. package/dist/cjs/types/metrics.d.ts +2 -2
  56. package/dist/cjs/types/oauth.d.ts +4 -4
  57. package/dist/cjs/types/sample.d.ts +2 -2
  58. package/dist/cjs/types/signalQuality.d.ts +1 -1
  59. package/dist/cjs/types/skill.d.ts +2 -2
  60. package/dist/cjs/types/user.d.ts +3 -3
  61. package/dist/cjs/utils/oauth.d.ts +1 -1
  62. package/dist/cjs/utils/transferDevice.d.ts +3 -3
  63. package/dist/cjs/utils/whileOnline.d.ts +1 -1
  64. package/dist/electron/index.js +1 -1
  65. package/dist/electron/index.js.map +1 -1
  66. package/dist/esm/__tests__/Neurosity.test.d.ts +1 -0
  67. package/dist/esm/__tests__/Neurosity.test.js +199 -0
  68. package/dist/esm/__tests__/WebBluetoothTransport.test.d.ts +1 -0
  69. package/dist/esm/__tests__/WebBluetoothTransport.test.js +199 -0
  70. package/dist/esm/__tests__/accelerometer.test.d.ts +1 -0
  71. package/dist/esm/__tests__/accelerometer.test.js +156 -0
  72. package/dist/esm/__tests__/auth.test.d.ts +1 -0
  73. package/dist/esm/__tests__/auth.test.js +237 -0
  74. package/dist/esm/__tests__/brainwaves.test.d.ts +1 -0
  75. package/dist/esm/__tests__/brainwaves.test.js +289 -0
  76. package/dist/esm/__tests__/device.test.d.ts +1 -0
  77. package/dist/esm/__tests__/device.test.js +279 -0
  78. package/dist/esm/__tests__/haptics.test.d.ts +1 -0
  79. package/dist/esm/__tests__/haptics.test.js +160 -0
  80. package/dist/esm/__tests__/metrics.test.d.ts +1 -0
  81. package/dist/esm/__tests__/metrics.test.js +176 -0
  82. package/dist/esm/__tests__/oauth.test.d.ts +1 -0
  83. package/dist/esm/__tests__/oauth.test.js +133 -0
  84. package/dist/esm/__tests__/settings.test.d.ts +1 -0
  85. package/dist/esm/__tests__/settings.test.js +128 -0
  86. package/dist/esm/__tests__/setup/webBluetooth.setup.d.ts +11 -0
  87. package/dist/esm/__tests__/setup/webBluetooth.setup.js +35 -0
  88. package/dist/esm/__tests__/setup.d.ts +0 -0
  89. package/dist/esm/__tests__/setup.js +7 -0
  90. package/dist/esm/__tests__/streaming.test.d.ts +1 -0
  91. package/dist/esm/__tests__/streaming.test.js +257 -0
  92. package/dist/esm/__tests__/timesync.test.d.ts +1 -0
  93. package/dist/esm/__tests__/timesync.test.js +52 -0
  94. package/dist/esm/__tests__/utils.test.d.ts +1 -0
  95. package/dist/esm/__tests__/utils.test.js +279 -0
  96. package/dist/esm/api/bluetooth/BluetoothClient.d.ts +6 -6
  97. package/dist/esm/api/bluetooth/BluetoothTransport.d.ts +1 -1
  98. package/dist/esm/api/bluetooth/react-native/ReactNativeTransport.d.ts +4 -4
  99. package/dist/esm/api/bluetooth/react-native/types/ReactNativeTypes.d.ts +2 -2
  100. package/dist/esm/api/bluetooth/types/index.d.ts +2 -2
  101. package/dist/esm/api/bluetooth/utils/decodeJSONChunks.d.ts +1 -1
  102. package/dist/esm/api/bluetooth/utils/stitch.d.ts +1 -1
  103. package/dist/esm/api/bluetooth/utils/textCodec.d.ts +1 -1
  104. package/dist/esm/api/bluetooth/web/WebBluetoothTransport.d.ts +1 -1
  105. package/dist/esm/api/firebase/FirebaseDevice.d.ts +1 -1
  106. package/dist/esm/api/firebase/FirebaseUser.d.ts +1 -1
  107. package/dist/esm/api/index.js +2 -2
  108. package/dist/esm/neurosity.mjs +2480 -1007
  109. package/dist/esm/timesync/Timesync.d.ts +1 -1
  110. package/dist/esm/types/awareness.d.ts +1 -1
  111. package/dist/esm/types/brainwaves.d.ts +25 -12
  112. package/dist/esm/types/credentials.d.ts +4 -4
  113. package/dist/esm/types/deviceInfo.d.ts +4 -4
  114. package/dist/esm/types/epoch.d.ts +1 -1
  115. package/dist/esm/types/experiment.d.ts +1 -1
  116. package/dist/esm/types/hapticEffects.d.ts +1 -1
  117. package/dist/esm/types/marker.d.ts +1 -1
  118. package/dist/esm/types/metrics.d.ts +2 -2
  119. package/dist/esm/types/oauth.d.ts +4 -4
  120. package/dist/esm/types/sample.d.ts +2 -2
  121. package/dist/esm/types/signalQuality.d.ts +1 -1
  122. package/dist/esm/types/skill.d.ts +2 -2
  123. package/dist/esm/types/user.d.ts +3 -3
  124. package/dist/esm/utils/oauth.d.ts +1 -1
  125. package/dist/esm/utils/transferDevice.d.ts +3 -3
  126. package/dist/esm/utils/whileOnline.d.ts +1 -1
  127. package/dist/examples/neurosity.iife.js +2419 -1009
  128. package/dist/examples/neurosity.js +180 -148
  129. package/dist/examples/neurosity.mjs +2480 -1007
  130. package/package.json +17 -5
@@ -42868,7 +42868,7 @@ class CloudClient {
42868
42868
  this.firebaseApp = new FirebaseApp(options);
42869
42869
  this.firebaseUser = new FirebaseUser(this.firebaseApp);
42870
42870
  this._selectedDevice.next(undefined);
42871
- this.status$ = heartbeatAwareStatus(this.observeNamespace("status").pipe(share())).pipe(filterInternalKeys(), shareReplay(1));
42871
+ this.status$ = heartbeatAwareStatus(this.observeNamespace("status").pipe(shareReplay(1))).pipe(filterInternalKeys(), shareReplay(1));
42872
42872
  this.osVersion$ = this.observeNamespace("info/osVersion").pipe(shareReplay(1));
42873
42873
  this.firebaseUser.onAuthStateChanged().subscribe((user) => {
42874
42874
  this.user = user;
@@ -43686,79 +43686,78 @@ function getScopeError(...requiredScopes) {
43686
43686
  return new Error(`${prefix}You are trying to access data with an OAuth token without access to the following scopes: ${requiredScopes.join(", ")}.`);
43687
43687
  }
43688
43688
 
43689
- var bind$1 = function bind(fn, thisArg) {
43689
+ function bind$1(fn, thisArg) {
43690
43690
  return function wrap() {
43691
- var args = new Array(arguments.length);
43692
- for (var i = 0; i < args.length; i++) {
43693
- args[i] = arguments[i];
43694
- }
43695
- return fn.apply(thisArg, args);
43691
+ return fn.apply(thisArg, arguments);
43696
43692
  };
43697
- };
43693
+ }
43698
43694
 
43699
43695
  // utils is a library of generic helper functions non-specific to axios
43700
43696
 
43701
- var toString = Object.prototype.toString;
43697
+ const {toString} = Object.prototype;
43698
+ const {getPrototypeOf: getPrototypeOf$1} = Object;
43699
+
43700
+ const kindOf = (cache => thing => {
43701
+ const str = toString.call(thing);
43702
+ return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
43703
+ })(Object.create(null));
43704
+
43705
+ const kindOfTest = (type) => {
43706
+ type = type.toLowerCase();
43707
+ return (thing) => kindOf(thing) === type
43708
+ };
43709
+
43710
+ const typeOfTest = type => thing => typeof thing === type;
43702
43711
 
43703
43712
  /**
43704
43713
  * Determine if a value is an Array
43705
43714
  *
43706
43715
  * @param {Object} val The value to test
43716
+ *
43707
43717
  * @returns {boolean} True if value is an Array, otherwise false
43708
43718
  */
43709
- function isArray$4(val) {
43710
- return Array.isArray(val);
43711
- }
43719
+ const {isArray: isArray$4} = Array;
43712
43720
 
43713
43721
  /**
43714
43722
  * Determine if a value is undefined
43715
43723
  *
43716
- * @param {Object} val The value to test
43724
+ * @param {*} val The value to test
43725
+ *
43717
43726
  * @returns {boolean} True if the value is undefined, otherwise false
43718
43727
  */
43719
- function isUndefined(val) {
43720
- return typeof val === 'undefined';
43721
- }
43728
+ const isUndefined = typeOfTest('undefined');
43722
43729
 
43723
43730
  /**
43724
43731
  * Determine if a value is a Buffer
43725
43732
  *
43726
- * @param {Object} val The value to test
43733
+ * @param {*} val The value to test
43734
+ *
43727
43735
  * @returns {boolean} True if value is a Buffer, otherwise false
43728
43736
  */
43729
43737
  function isBuffer(val) {
43730
43738
  return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
43731
- && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
43739
+ && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
43732
43740
  }
43733
43741
 
43734
43742
  /**
43735
43743
  * Determine if a value is an ArrayBuffer
43736
43744
  *
43737
- * @param {Object} val The value to test
43745
+ * @param {*} val The value to test
43746
+ *
43738
43747
  * @returns {boolean} True if value is an ArrayBuffer, otherwise false
43739
43748
  */
43740
- function isArrayBuffer(val) {
43741
- return toString.call(val) === '[object ArrayBuffer]';
43742
- }
43749
+ const isArrayBuffer = kindOfTest('ArrayBuffer');
43743
43750
 
43744
- /**
43745
- * Determine if a value is a FormData
43746
- *
43747
- * @param {Object} val The value to test
43748
- * @returns {boolean} True if value is an FormData, otherwise false
43749
- */
43750
- function isFormData(val) {
43751
- return toString.call(val) === '[object FormData]';
43752
- }
43753
43751
 
43754
43752
  /**
43755
43753
  * Determine if a value is a view on an ArrayBuffer
43756
43754
  *
43757
- * @param {Object} val The value to test
43755
+ * @param {*} val The value to test
43756
+ *
43758
43757
  * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
43759
43758
  */
43760
43759
  function isArrayBufferView(val) {
43761
- var result;
43760
+ let result;
43762
43761
  if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
43763
43762
  result = ArrayBuffer.isView(val);
43764
43763
  } else {
@@ -43770,144 +43769,145 @@ function isArrayBufferView(val) {
43770
43769
  /**
43771
43770
  * Determine if a value is a String
43772
43771
  *
43773
- * @param {Object} val The value to test
43772
+ * @param {*} val The value to test
43773
+ *
43774
43774
  * @returns {boolean} True if value is a String, otherwise false
43775
43775
  */
43776
- function isString(val) {
43777
- return typeof val === 'string';
43778
- }
43776
+ const isString = typeOfTest('string');
43777
+
43778
+ /**
43779
+ * Determine if a value is a Function
43780
+ *
43781
+ * @param {*} val The value to test
43782
+ * @returns {boolean} True if value is a Function, otherwise false
43783
+ */
43784
+ const isFunction$1 = typeOfTest('function');
43779
43785
 
43780
43786
  /**
43781
43787
  * Determine if a value is a Number
43782
43788
  *
43783
- * @param {Object} val The value to test
43789
+ * @param {*} val The value to test
43790
+ *
43784
43791
  * @returns {boolean} True if value is a Number, otherwise false
43785
43792
  */
43786
- function isNumber(val) {
43787
- return typeof val === 'number';
43788
- }
43793
+ const isNumber = typeOfTest('number');
43789
43794
 
43790
43795
  /**
43791
43796
  * Determine if a value is an Object
43792
43797
  *
43793
- * @param {Object} val The value to test
43798
+ * @param {*} thing The value to test
43799
+ *
43794
43800
  * @returns {boolean} True if value is an Object, otherwise false
43795
43801
  */
43796
- function isObject$1(val) {
43797
- return val !== null && typeof val === 'object';
43798
- }
43802
+ const isObject$1 = (thing) => thing !== null && typeof thing === 'object';
43803
+
43804
+ /**
43805
+ * Determine if a value is a Boolean
43806
+ *
43807
+ * @param {*} thing The value to test
43808
+ * @returns {boolean} True if value is a Boolean, otherwise false
43809
+ */
43810
+ const isBoolean = thing => thing === true || thing === false;
43799
43811
 
43800
43812
  /**
43801
43813
  * Determine if a value is a plain Object
43802
43814
  *
43803
- * @param {Object} val The value to test
43804
- * @return {boolean} True if value is a plain Object, otherwise false
43815
+ * @param {*} val The value to test
43816
+ *
43817
+ * @returns {boolean} True if value is a plain Object, otherwise false
43805
43818
  */
43806
- function isPlainObject(val) {
43807
- if (toString.call(val) !== '[object Object]') {
43819
+ const isPlainObject = (val) => {
43820
+ if (kindOf(val) !== 'object') {
43808
43821
  return false;
43809
43822
  }
43810
43823
 
43811
- var prototype = Object.getPrototypeOf(val);
43812
- return prototype === null || prototype === Object.prototype;
43813
- }
43824
+ const prototype = getPrototypeOf$1(val);
43825
+ return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
43826
+ };
43814
43827
 
43815
43828
  /**
43816
43829
  * Determine if a value is a Date
43817
43830
  *
43818
- * @param {Object} val The value to test
43831
+ * @param {*} val The value to test
43832
+ *
43819
43833
  * @returns {boolean} True if value is a Date, otherwise false
43820
43834
  */
43821
- function isDate(val) {
43822
- return toString.call(val) === '[object Date]';
43823
- }
43835
+ const isDate = kindOfTest('Date');
43824
43836
 
43825
43837
  /**
43826
43838
  * Determine if a value is a File
43827
43839
  *
43828
- * @param {Object} val The value to test
43840
+ * @param {*} val The value to test
43841
+ *
43829
43842
  * @returns {boolean} True if value is a File, otherwise false
43830
43843
  */
43831
- function isFile(val) {
43832
- return toString.call(val) === '[object File]';
43833
- }
43844
+ const isFile = kindOfTest('File');
43834
43845
 
43835
43846
  /**
43836
43847
  * Determine if a value is a Blob
43837
43848
  *
43838
- * @param {Object} val The value to test
43849
+ * @param {*} val The value to test
43850
+ *
43839
43851
  * @returns {boolean} True if value is a Blob, otherwise false
43840
43852
  */
43841
- function isBlob(val) {
43842
- return toString.call(val) === '[object Blob]';
43843
- }
43853
+ const isBlob = kindOfTest('Blob');
43844
43854
 
43845
43855
  /**
43846
- * Determine if a value is a Function
43856
+ * Determine if a value is a FileList
43847
43857
  *
43848
- * @param {Object} val The value to test
43849
- * @returns {boolean} True if value is a Function, otherwise false
43858
+ * @param {*} val The value to test
43859
+ *
43860
+ * @returns {boolean} True if value is a File, otherwise false
43850
43861
  */
43851
- function isFunction$1(val) {
43852
- return toString.call(val) === '[object Function]';
43853
- }
43862
+ const isFileList = kindOfTest('FileList');
43854
43863
 
43855
43864
  /**
43856
43865
  * Determine if a value is a Stream
43857
43866
  *
43858
- * @param {Object} val The value to test
43867
+ * @param {*} val The value to test
43868
+ *
43859
43869
  * @returns {boolean} True if value is a Stream, otherwise false
43860
43870
  */
43861
- function isStream(val) {
43862
- return isObject$1(val) && isFunction$1(val.pipe);
43863
- }
43871
+ const isStream = (val) => isObject$1(val) && isFunction$1(val.pipe);
43864
43872
 
43865
43873
  /**
43866
- * Determine if a value is a URLSearchParams object
43874
+ * Determine if a value is a FormData
43867
43875
  *
43868
- * @param {Object} val The value to test
43869
- * @returns {boolean} True if value is a URLSearchParams object, otherwise false
43876
+ * @param {*} thing The value to test
43877
+ *
43878
+ * @returns {boolean} True if value is an FormData, otherwise false
43870
43879
  */
43871
- function isURLSearchParams(val) {
43872
- return toString.call(val) === '[object URLSearchParams]';
43873
- }
43880
+ const isFormData = (thing) => {
43881
+ let kind;
43882
+ return thing && (
43883
+ (typeof FormData === 'function' && thing instanceof FormData) || (
43884
+ isFunction$1(thing.append) && (
43885
+ (kind = kindOf(thing)) === 'formdata' ||
43886
+ // detect form-data instance
43887
+ (kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
43888
+ )
43889
+ )
43890
+ )
43891
+ };
43874
43892
 
43875
43893
  /**
43876
- * Trim excess whitespace off the beginning and end of a string
43894
+ * Determine if a value is a URLSearchParams object
43877
43895
  *
43878
- * @param {String} str The String to trim
43879
- * @returns {String} The String freed of excess whitespace
43896
+ * @param {*} val The value to test
43897
+ *
43898
+ * @returns {boolean} True if value is a URLSearchParams object, otherwise false
43880
43899
  */
43881
- function trim(str) {
43882
- return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, '');
43883
- }
43900
+ const isURLSearchParams = kindOfTest('URLSearchParams');
43884
43901
 
43885
43902
  /**
43886
- * Determine if we're running in a standard browser environment
43887
- *
43888
- * This allows axios to run in a web worker, and react-native.
43889
- * Both environments support XMLHttpRequest, but not fully standard globals.
43903
+ * Trim excess whitespace off the beginning and end of a string
43890
43904
  *
43891
- * web workers:
43892
- * typeof window -> undefined
43893
- * typeof document -> undefined
43905
+ * @param {String} str The String to trim
43894
43906
  *
43895
- * react-native:
43896
- * navigator.product -> 'ReactNative'
43897
- * nativescript
43898
- * navigator.product -> 'NativeScript' or 'NS'
43907
+ * @returns {String} The String freed of excess whitespace
43899
43908
  */
43900
- function isStandardBrowserEnv() {
43901
- if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
43902
- navigator.product === 'NativeScript' ||
43903
- navigator.product === 'NS')) {
43904
- return false;
43905
- }
43906
- return (
43907
- typeof window !== 'undefined' &&
43908
- typeof document !== 'undefined'
43909
- );
43910
- }
43909
+ const trim = (str) => str.trim ?
43910
+ str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
43911
43911
 
43912
43912
  /**
43913
43913
  * Iterate over an Array or an Object invoking a function for each item.
@@ -43920,13 +43920,19 @@ function isStandardBrowserEnv() {
43920
43920
  *
43921
43921
  * @param {Object|Array} obj The object to iterate
43922
43922
  * @param {Function} fn The callback to invoke for each item
43923
+ *
43924
+ * @param {Boolean} [allOwnKeys = false]
43925
+ * @returns {any}
43923
43926
  */
43924
- function forEach(obj, fn) {
43927
+ function forEach(obj, fn, {allOwnKeys = false} = {}) {
43925
43928
  // Don't bother if no value provided
43926
43929
  if (obj === null || typeof obj === 'undefined') {
43927
43930
  return;
43928
43931
  }
43929
43932
 
43933
+ let i;
43934
+ let l;
43935
+
43930
43936
  // Force an array if not already something iterable
43931
43937
  if (typeof obj !== 'object') {
43932
43938
  /*eslint no-param-reassign:0*/
@@ -43935,19 +43941,44 @@ function forEach(obj, fn) {
43935
43941
 
43936
43942
  if (isArray$4(obj)) {
43937
43943
  // Iterate over array values
43938
- for (var i = 0, l = obj.length; i < l; i++) {
43944
+ for (i = 0, l = obj.length; i < l; i++) {
43939
43945
  fn.call(null, obj[i], i, obj);
43940
43946
  }
43941
43947
  } else {
43942
43948
  // Iterate over object keys
43943
- for (var key in obj) {
43944
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
43945
- fn.call(null, obj[key], key, obj);
43946
- }
43949
+ const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
43950
+ const len = keys.length;
43951
+ let key;
43952
+
43953
+ for (i = 0; i < len; i++) {
43954
+ key = keys[i];
43955
+ fn.call(null, obj[key], key, obj);
43956
+ }
43957
+ }
43958
+ }
43959
+
43960
+ function findKey(obj, key) {
43961
+ key = key.toLowerCase();
43962
+ const keys = Object.keys(obj);
43963
+ let i = keys.length;
43964
+ let _key;
43965
+ while (i-- > 0) {
43966
+ _key = keys[i];
43967
+ if (key === _key.toLowerCase()) {
43968
+ return _key;
43947
43969
  }
43948
43970
  }
43971
+ return null;
43949
43972
  }
43950
43973
 
43974
+ const _global = (() => {
43975
+ /*eslint no-undef:0*/
43976
+ if (typeof globalThis !== "undefined") return globalThis;
43977
+ return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global)
43978
+ })();
43979
+
43980
+ const isContextDefined = (context) => !isUndefined(context) && context !== _global;
43981
+
43951
43982
  /**
43952
43983
  * Accepts varargs expecting each argument to be an object, then
43953
43984
  * immutably merges the properties of each object and returns result.
@@ -43963,24 +43994,27 @@ function forEach(obj, fn) {
43963
43994
  * ```
43964
43995
  *
43965
43996
  * @param {Object} obj1 Object to merge
43997
+ *
43966
43998
  * @returns {Object} Result of all merge properties
43967
43999
  */
43968
44000
  function merge$2(/* obj1, obj2, obj3, ... */) {
43969
- var result = {};
43970
- function assignValue(val, key) {
43971
- if (isPlainObject(result[key]) && isPlainObject(val)) {
43972
- result[key] = merge$2(result[key], val);
44001
+ const {caseless} = isContextDefined(this) && this || {};
44002
+ const result = {};
44003
+ const assignValue = (val, key) => {
44004
+ const targetKey = caseless && findKey(result, key) || key;
44005
+ if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
44006
+ result[targetKey] = merge$2(result[targetKey], val);
43973
44007
  } else if (isPlainObject(val)) {
43974
- result[key] = merge$2({}, val);
44008
+ result[targetKey] = merge$2({}, val);
43975
44009
  } else if (isArray$4(val)) {
43976
- result[key] = val.slice();
44010
+ result[targetKey] = val.slice();
43977
44011
  } else {
43978
- result[key] = val;
44012
+ result[targetKey] = val;
43979
44013
  }
43980
- }
44014
+ };
43981
44015
 
43982
- for (var i = 0, l = arguments.length; i < l; i++) {
43983
- forEach(arguments[i], assignValue);
44016
+ for (let i = 0, l = arguments.length; i < l; i++) {
44017
+ arguments[i] && forEach(arguments[i], assignValue);
43984
44018
  }
43985
44019
  return result;
43986
44020
  }
@@ -43991,240 +44025,1588 @@ function merge$2(/* obj1, obj2, obj3, ... */) {
43991
44025
  * @param {Object} a The object to be extended
43992
44026
  * @param {Object} b The object to copy properties from
43993
44027
  * @param {Object} thisArg The object to bind function to
43994
- * @return {Object} The resulting value of object a
44028
+ *
44029
+ * @param {Boolean} [allOwnKeys]
44030
+ * @returns {Object} The resulting value of object a
43995
44031
  */
43996
- function extend(a, b, thisArg) {
43997
- forEach(b, function assignValue(val, key) {
43998
- if (thisArg && typeof val === 'function') {
44032
+ const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
44033
+ forEach(b, (val, key) => {
44034
+ if (thisArg && isFunction$1(val)) {
43999
44035
  a[key] = bind$1(val, thisArg);
44000
44036
  } else {
44001
44037
  a[key] = val;
44002
44038
  }
44003
- });
44039
+ }, {allOwnKeys});
44004
44040
  return a;
44005
- }
44041
+ };
44006
44042
 
44007
44043
  /**
44008
44044
  * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
44009
44045
  *
44010
44046
  * @param {string} content with BOM
44011
- * @return {string} content value without BOM
44047
+ *
44048
+ * @returns {string} content value without BOM
44012
44049
  */
44013
- function stripBOM(content) {
44050
+ const stripBOM = (content) => {
44014
44051
  if (content.charCodeAt(0) === 0xFEFF) {
44015
44052
  content = content.slice(1);
44016
44053
  }
44017
44054
  return content;
44018
- }
44055
+ };
44019
44056
 
44020
- var utils = {
44021
- isArray: isArray$4,
44022
- isArrayBuffer: isArrayBuffer,
44023
- isBuffer: isBuffer,
44024
- isFormData: isFormData,
44025
- isArrayBufferView: isArrayBufferView,
44026
- isString: isString,
44027
- isNumber: isNumber,
44028
- isObject: isObject$1,
44029
- isPlainObject: isPlainObject,
44030
- isUndefined: isUndefined,
44031
- isDate: isDate,
44032
- isFile: isFile,
44033
- isBlob: isBlob,
44034
- isFunction: isFunction$1,
44035
- isStream: isStream,
44036
- isURLSearchParams: isURLSearchParams,
44037
- isStandardBrowserEnv: isStandardBrowserEnv,
44038
- forEach: forEach,
44039
- merge: merge$2,
44040
- extend: extend,
44041
- trim: trim,
44042
- stripBOM: stripBOM
44057
+ /**
44058
+ * Inherit the prototype methods from one constructor into another
44059
+ * @param {function} constructor
44060
+ * @param {function} superConstructor
44061
+ * @param {object} [props]
44062
+ * @param {object} [descriptors]
44063
+ *
44064
+ * @returns {void}
44065
+ */
44066
+ const inherits = (constructor, superConstructor, props, descriptors) => {
44067
+ constructor.prototype = Object.create(superConstructor.prototype, descriptors);
44068
+ constructor.prototype.constructor = constructor;
44069
+ Object.defineProperty(constructor, 'super', {
44070
+ value: superConstructor.prototype
44071
+ });
44072
+ props && Object.assign(constructor.prototype, props);
44043
44073
  };
44044
44074
 
44045
- function encode(val) {
44046
- return encodeURIComponent(val).
44047
- replace(/%3A/gi, ':').
44048
- replace(/%24/g, '$').
44049
- replace(/%2C/gi, ',').
44050
- replace(/%20/g, '+').
44051
- replace(/%5B/gi, '[').
44052
- replace(/%5D/gi, ']');
44053
- }
44075
+ /**
44076
+ * Resolve object with deep prototype chain to a flat object
44077
+ * @param {Object} sourceObj source object
44078
+ * @param {Object} [destObj]
44079
+ * @param {Function|Boolean} [filter]
44080
+ * @param {Function} [propFilter]
44081
+ *
44082
+ * @returns {Object}
44083
+ */
44084
+ const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
44085
+ let props;
44086
+ let i;
44087
+ let prop;
44088
+ const merged = {};
44089
+
44090
+ destObj = destObj || {};
44091
+ // eslint-disable-next-line no-eq-null,eqeqeq
44092
+ if (sourceObj == null) return destObj;
44093
+
44094
+ do {
44095
+ props = Object.getOwnPropertyNames(sourceObj);
44096
+ i = props.length;
44097
+ while (i-- > 0) {
44098
+ prop = props[i];
44099
+ if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
44100
+ destObj[prop] = sourceObj[prop];
44101
+ merged[prop] = true;
44102
+ }
44103
+ }
44104
+ sourceObj = filter !== false && getPrototypeOf$1(sourceObj);
44105
+ } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
44106
+
44107
+ return destObj;
44108
+ };
44054
44109
 
44055
44110
  /**
44056
- * Build a URL by appending params to the end
44111
+ * Determines whether a string ends with the characters of a specified string
44057
44112
  *
44058
- * @param {string} url The base of the url (e.g., http://www.google.com)
44059
- * @param {object} [params] The params to be appended
44060
- * @returns {string} The formatted url
44113
+ * @param {String} str
44114
+ * @param {String} searchString
44115
+ * @param {Number} [position= 0]
44116
+ *
44117
+ * @returns {boolean}
44061
44118
  */
44062
- var buildURL = function buildURL(url, params, paramsSerializer) {
44063
- /*eslint no-param-reassign:0*/
44064
- if (!params) {
44065
- return url;
44119
+ const endsWith = (str, searchString, position) => {
44120
+ str = String(str);
44121
+ if (position === undefined || position > str.length) {
44122
+ position = str.length;
44066
44123
  }
44124
+ position -= searchString.length;
44125
+ const lastIndex = str.indexOf(searchString, position);
44126
+ return lastIndex !== -1 && lastIndex === position;
44127
+ };
44067
44128
 
44068
- var serializedParams;
44069
- if (paramsSerializer) {
44070
- serializedParams = paramsSerializer(params);
44071
- } else if (utils.isURLSearchParams(params)) {
44072
- serializedParams = params.toString();
44073
- } else {
44074
- var parts = [];
44075
44129
 
44076
- utils.forEach(params, function serialize(val, key) {
44077
- if (val === null || typeof val === 'undefined') {
44078
- return;
44079
- }
44130
+ /**
44131
+ * Returns new array from array like object or null if failed
44132
+ *
44133
+ * @param {*} [thing]
44134
+ *
44135
+ * @returns {?Array}
44136
+ */
44137
+ const toArray$1 = (thing) => {
44138
+ if (!thing) return null;
44139
+ if (isArray$4(thing)) return thing;
44140
+ let i = thing.length;
44141
+ if (!isNumber(i)) return null;
44142
+ const arr = new Array(i);
44143
+ while (i-- > 0) {
44144
+ arr[i] = thing[i];
44145
+ }
44146
+ return arr;
44147
+ };
44080
44148
 
44081
- if (utils.isArray(val)) {
44082
- key = key + '[]';
44083
- } else {
44084
- val = [val];
44085
- }
44149
+ /**
44150
+ * Checking if the Uint8Array exists and if it does, it returns a function that checks if the
44151
+ * thing passed in is an instance of Uint8Array
44152
+ *
44153
+ * @param {TypedArray}
44154
+ *
44155
+ * @returns {Array}
44156
+ */
44157
+ // eslint-disable-next-line func-names
44158
+ const isTypedArray = (TypedArray => {
44159
+ // eslint-disable-next-line func-names
44160
+ return thing => {
44161
+ return TypedArray && thing instanceof TypedArray;
44162
+ };
44163
+ })(typeof Uint8Array !== 'undefined' && getPrototypeOf$1(Uint8Array));
44086
44164
 
44087
- utils.forEach(val, function parseValue(v) {
44088
- if (utils.isDate(v)) {
44089
- v = v.toISOString();
44090
- } else if (utils.isObject(v)) {
44091
- v = JSON.stringify(v);
44092
- }
44093
- parts.push(encode(key) + '=' + encode(v));
44094
- });
44095
- });
44165
+ /**
44166
+ * For each entry in the object, call the function with the key and value.
44167
+ *
44168
+ * @param {Object<any, any>} obj - The object to iterate over.
44169
+ * @param {Function} fn - The function to call for each entry.
44170
+ *
44171
+ * @returns {void}
44172
+ */
44173
+ const forEachEntry = (obj, fn) => {
44174
+ const generator = obj && obj[Symbol.iterator];
44175
+
44176
+ const iterator = generator.call(obj);
44096
44177
 
44097
- serializedParams = parts.join('&');
44178
+ let result;
44179
+
44180
+ while ((result = iterator.next()) && !result.done) {
44181
+ const pair = result.value;
44182
+ fn.call(obj, pair[0], pair[1]);
44098
44183
  }
44184
+ };
44099
44185
 
44100
- if (serializedParams) {
44101
- var hashmarkIndex = url.indexOf('#');
44102
- if (hashmarkIndex !== -1) {
44103
- url = url.slice(0, hashmarkIndex);
44186
+ /**
44187
+ * It takes a regular expression and a string, and returns an array of all the matches
44188
+ *
44189
+ * @param {string} regExp - The regular expression to match against.
44190
+ * @param {string} str - The string to search.
44191
+ *
44192
+ * @returns {Array<boolean>}
44193
+ */
44194
+ const matchAll = (regExp, str) => {
44195
+ let matches;
44196
+ const arr = [];
44197
+
44198
+ while ((matches = regExp.exec(str)) !== null) {
44199
+ arr.push(matches);
44200
+ }
44201
+
44202
+ return arr;
44203
+ };
44204
+
44205
+ /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
44206
+ const isHTMLForm = kindOfTest('HTMLFormElement');
44207
+
44208
+ const toCamelCase = str => {
44209
+ return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,
44210
+ function replacer(m, p1, p2) {
44211
+ return p1.toUpperCase() + p2;
44212
+ }
44213
+ );
44214
+ };
44215
+
44216
+ /* Creating a function that will check if an object has a property. */
44217
+ const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
44218
+
44219
+ /**
44220
+ * Determine if a value is a RegExp object
44221
+ *
44222
+ * @param {*} val The value to test
44223
+ *
44224
+ * @returns {boolean} True if value is a RegExp object, otherwise false
44225
+ */
44226
+ const isRegExp = kindOfTest('RegExp');
44227
+
44228
+ const reduceDescriptors = (obj, reducer) => {
44229
+ const descriptors = Object.getOwnPropertyDescriptors(obj);
44230
+ const reducedDescriptors = {};
44231
+
44232
+ forEach(descriptors, (descriptor, name) => {
44233
+ let ret;
44234
+ if ((ret = reducer(descriptor, name, obj)) !== false) {
44235
+ reducedDescriptors[name] = ret || descriptor;
44236
+ }
44237
+ });
44238
+
44239
+ Object.defineProperties(obj, reducedDescriptors);
44240
+ };
44241
+
44242
+ /**
44243
+ * Makes all methods read-only
44244
+ * @param {Object} obj
44245
+ */
44246
+
44247
+ const freezeMethods = (obj) => {
44248
+ reduceDescriptors(obj, (descriptor, name) => {
44249
+ // skip restricted props in strict mode
44250
+ if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
44251
+ return false;
44252
+ }
44253
+
44254
+ const value = obj[name];
44255
+
44256
+ if (!isFunction$1(value)) return;
44257
+
44258
+ descriptor.enumerable = false;
44259
+
44260
+ if ('writable' in descriptor) {
44261
+ descriptor.writable = false;
44262
+ return;
44104
44263
  }
44105
44264
 
44106
- url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
44107
- }
44265
+ if (!descriptor.set) {
44266
+ descriptor.set = () => {
44267
+ throw Error('Can not rewrite read-only method \'' + name + '\'');
44268
+ };
44269
+ }
44270
+ });
44271
+ };
44272
+
44273
+ const toObjectSet = (arrayOrString, delimiter) => {
44274
+ const obj = {};
44275
+
44276
+ const define = (arr) => {
44277
+ arr.forEach(value => {
44278
+ obj[value] = true;
44279
+ });
44280
+ };
44281
+
44282
+ isArray$4(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
44283
+
44284
+ return obj;
44285
+ };
44286
+
44287
+ const noop$2 = () => {};
44288
+
44289
+ const toFiniteNumber = (value, defaultValue) => {
44290
+ value = +value;
44291
+ return Number.isFinite(value) ? value : defaultValue;
44292
+ };
44293
+
44294
+ const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
44295
+
44296
+ const DIGIT = '0123456789';
44297
+
44298
+ const ALPHABET = {
44299
+ DIGIT,
44300
+ ALPHA,
44301
+ ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
44302
+ };
44303
+
44304
+ const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
44305
+ let str = '';
44306
+ const {length} = alphabet;
44307
+ while (size--) {
44308
+ str += alphabet[Math.random() * length|0];
44309
+ }
44310
+
44311
+ return str;
44312
+ };
44313
+
44314
+ /**
44315
+ * If the thing is a FormData object, return true, otherwise return false.
44316
+ *
44317
+ * @param {unknown} thing - The thing to check.
44318
+ *
44319
+ * @returns {boolean}
44320
+ */
44321
+ function isSpecCompliantForm(thing) {
44322
+ return !!(thing && isFunction$1(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
44323
+ }
44324
+
44325
+ const toJSONObject = (obj) => {
44326
+ const stack = new Array(10);
44327
+
44328
+ const visit = (source, i) => {
44329
+
44330
+ if (isObject$1(source)) {
44331
+ if (stack.indexOf(source) >= 0) {
44332
+ return;
44333
+ }
44334
+
44335
+ if(!('toJSON' in source)) {
44336
+ stack[i] = source;
44337
+ const target = isArray$4(source) ? [] : {};
44338
+
44339
+ forEach(source, (value, key) => {
44340
+ const reducedValue = visit(value, i + 1);
44341
+ !isUndefined(reducedValue) && (target[key] = reducedValue);
44342
+ });
44343
+
44344
+ stack[i] = undefined;
44345
+
44346
+ return target;
44347
+ }
44348
+ }
44349
+
44350
+ return source;
44351
+ };
44352
+
44353
+ return visit(obj, 0);
44354
+ };
44355
+
44356
+ const isAsyncFn = kindOfTest('AsyncFunction');
44357
+
44358
+ const isThenable = (thing) =>
44359
+ thing && (isObject$1(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
44360
+
44361
+ var utils = {
44362
+ isArray: isArray$4,
44363
+ isArrayBuffer,
44364
+ isBuffer,
44365
+ isFormData,
44366
+ isArrayBufferView,
44367
+ isString,
44368
+ isNumber,
44369
+ isBoolean,
44370
+ isObject: isObject$1,
44371
+ isPlainObject,
44372
+ isUndefined,
44373
+ isDate,
44374
+ isFile,
44375
+ isBlob,
44376
+ isRegExp,
44377
+ isFunction: isFunction$1,
44378
+ isStream,
44379
+ isURLSearchParams,
44380
+ isTypedArray,
44381
+ isFileList,
44382
+ forEach,
44383
+ merge: merge$2,
44384
+ extend,
44385
+ trim,
44386
+ stripBOM,
44387
+ inherits,
44388
+ toFlatObject,
44389
+ kindOf,
44390
+ kindOfTest,
44391
+ endsWith,
44392
+ toArray: toArray$1,
44393
+ forEachEntry,
44394
+ matchAll,
44395
+ isHTMLForm,
44396
+ hasOwnProperty,
44397
+ hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection
44398
+ reduceDescriptors,
44399
+ freezeMethods,
44400
+ toObjectSet,
44401
+ toCamelCase,
44402
+ noop: noop$2,
44403
+ toFiniteNumber,
44404
+ findKey,
44405
+ global: _global,
44406
+ isContextDefined,
44407
+ ALPHABET,
44408
+ generateString,
44409
+ isSpecCompliantForm,
44410
+ toJSONObject,
44411
+ isAsyncFn,
44412
+ isThenable
44413
+ };
44414
+
44415
+ /**
44416
+ * Create an Error with the specified message, config, error code, request and response.
44417
+ *
44418
+ * @param {string} message The error message.
44419
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
44420
+ * @param {Object} [config] The config.
44421
+ * @param {Object} [request] The request.
44422
+ * @param {Object} [response] The response.
44423
+ *
44424
+ * @returns {Error} The created error.
44425
+ */
44426
+ function AxiosError(message, code, config, request, response) {
44427
+ Error.call(this);
44428
+
44429
+ if (Error.captureStackTrace) {
44430
+ Error.captureStackTrace(this, this.constructor);
44431
+ } else {
44432
+ this.stack = (new Error()).stack;
44433
+ }
44434
+
44435
+ this.message = message;
44436
+ this.name = 'AxiosError';
44437
+ code && (this.code = code);
44438
+ config && (this.config = config);
44439
+ request && (this.request = request);
44440
+ response && (this.response = response);
44441
+ }
44442
+
44443
+ utils.inherits(AxiosError, Error, {
44444
+ toJSON: function toJSON() {
44445
+ return {
44446
+ // Standard
44447
+ message: this.message,
44448
+ name: this.name,
44449
+ // Microsoft
44450
+ description: this.description,
44451
+ number: this.number,
44452
+ // Mozilla
44453
+ fileName: this.fileName,
44454
+ lineNumber: this.lineNumber,
44455
+ columnNumber: this.columnNumber,
44456
+ stack: this.stack,
44457
+ // Axios
44458
+ config: utils.toJSONObject(this.config),
44459
+ code: this.code,
44460
+ status: this.response && this.response.status ? this.response.status : null
44461
+ };
44462
+ }
44463
+ });
44464
+
44465
+ const prototype = AxiosError.prototype;
44466
+ const descriptors = {};
44467
+
44468
+ [
44469
+ 'ERR_BAD_OPTION_VALUE',
44470
+ 'ERR_BAD_OPTION',
44471
+ 'ECONNABORTED',
44472
+ 'ETIMEDOUT',
44473
+ 'ERR_NETWORK',
44474
+ 'ERR_FR_TOO_MANY_REDIRECTS',
44475
+ 'ERR_DEPRECATED',
44476
+ 'ERR_BAD_RESPONSE',
44477
+ 'ERR_BAD_REQUEST',
44478
+ 'ERR_CANCELED',
44479
+ 'ERR_NOT_SUPPORT',
44480
+ 'ERR_INVALID_URL'
44481
+ // eslint-disable-next-line func-names
44482
+ ].forEach(code => {
44483
+ descriptors[code] = {value: code};
44484
+ });
44485
+
44486
+ Object.defineProperties(AxiosError, descriptors);
44487
+ Object.defineProperty(prototype, 'isAxiosError', {value: true});
44488
+
44489
+ // eslint-disable-next-line func-names
44490
+ AxiosError.from = (error, code, config, request, response, customProps) => {
44491
+ const axiosError = Object.create(prototype);
44492
+
44493
+ utils.toFlatObject(error, axiosError, function filter(obj) {
44494
+ return obj !== Error.prototype;
44495
+ }, prop => {
44496
+ return prop !== 'isAxiosError';
44497
+ });
44498
+
44499
+ AxiosError.call(axiosError, error.message, code, config, request, response);
44500
+
44501
+ axiosError.cause = error;
44502
+
44503
+ axiosError.name = error.name;
44504
+
44505
+ customProps && Object.assign(axiosError, customProps);
44506
+
44507
+ return axiosError;
44508
+ };
44509
+
44510
+ // eslint-disable-next-line strict
44511
+ var httpAdapter = null;
44512
+
44513
+ /**
44514
+ * Determines if the given thing is a array or js object.
44515
+ *
44516
+ * @param {string} thing - The object or array to be visited.
44517
+ *
44518
+ * @returns {boolean}
44519
+ */
44520
+ function isVisitable(thing) {
44521
+ return utils.isPlainObject(thing) || utils.isArray(thing);
44522
+ }
44523
+
44524
+ /**
44525
+ * It removes the brackets from the end of a string
44526
+ *
44527
+ * @param {string} key - The key of the parameter.
44528
+ *
44529
+ * @returns {string} the key without the brackets.
44530
+ */
44531
+ function removeBrackets(key) {
44532
+ return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;
44533
+ }
44534
+
44535
+ /**
44536
+ * It takes a path, a key, and a boolean, and returns a string
44537
+ *
44538
+ * @param {string} path - The path to the current key.
44539
+ * @param {string} key - The key of the current object being iterated over.
44540
+ * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
44541
+ *
44542
+ * @returns {string} The path to the current key.
44543
+ */
44544
+ function renderKey(path, key, dots) {
44545
+ if (!path) return key;
44546
+ return path.concat(key).map(function each(token, i) {
44547
+ // eslint-disable-next-line no-param-reassign
44548
+ token = removeBrackets(token);
44549
+ return !dots && i ? '[' + token + ']' : token;
44550
+ }).join(dots ? '.' : '');
44551
+ }
44552
+
44553
+ /**
44554
+ * If the array is an array and none of its elements are visitable, then it's a flat array.
44555
+ *
44556
+ * @param {Array<any>} arr - The array to check
44557
+ *
44558
+ * @returns {boolean}
44559
+ */
44560
+ function isFlatArray(arr) {
44561
+ return utils.isArray(arr) && !arr.some(isVisitable);
44562
+ }
44563
+
44564
+ const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
44565
+ return /^is[A-Z]/.test(prop);
44566
+ });
44567
+
44568
+ /**
44569
+ * Convert a data object to FormData
44570
+ *
44571
+ * @param {Object} obj
44572
+ * @param {?Object} [formData]
44573
+ * @param {?Object} [options]
44574
+ * @param {Function} [options.visitor]
44575
+ * @param {Boolean} [options.metaTokens = true]
44576
+ * @param {Boolean} [options.dots = false]
44577
+ * @param {?Boolean} [options.indexes = false]
44578
+ *
44579
+ * @returns {Object}
44580
+ **/
44581
+
44582
+ /**
44583
+ * It converts an object into a FormData object
44584
+ *
44585
+ * @param {Object<any, any>} obj - The object to convert to form data.
44586
+ * @param {string} formData - The FormData object to append to.
44587
+ * @param {Object<string, any>} options
44588
+ *
44589
+ * @returns
44590
+ */
44591
+ function toFormData(obj, formData, options) {
44592
+ if (!utils.isObject(obj)) {
44593
+ throw new TypeError('target must be an object');
44594
+ }
44595
+
44596
+ // eslint-disable-next-line no-param-reassign
44597
+ formData = formData || new (FormData)();
44598
+
44599
+ // eslint-disable-next-line no-param-reassign
44600
+ options = utils.toFlatObject(options, {
44601
+ metaTokens: true,
44602
+ dots: false,
44603
+ indexes: false
44604
+ }, false, function defined(option, source) {
44605
+ // eslint-disable-next-line no-eq-null,eqeqeq
44606
+ return !utils.isUndefined(source[option]);
44607
+ });
44608
+
44609
+ const metaTokens = options.metaTokens;
44610
+ // eslint-disable-next-line no-use-before-define
44611
+ const visitor = options.visitor || defaultVisitor;
44612
+ const dots = options.dots;
44613
+ const indexes = options.indexes;
44614
+ const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
44615
+ const useBlob = _Blob && utils.isSpecCompliantForm(formData);
44616
+
44617
+ if (!utils.isFunction(visitor)) {
44618
+ throw new TypeError('visitor must be a function');
44619
+ }
44620
+
44621
+ function convertValue(value) {
44622
+ if (value === null) return '';
44623
+
44624
+ if (utils.isDate(value)) {
44625
+ return value.toISOString();
44626
+ }
44627
+
44628
+ if (!useBlob && utils.isBlob(value)) {
44629
+ throw new AxiosError('Blob is not supported. Use a Buffer instead.');
44630
+ }
44631
+
44632
+ if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
44633
+ return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
44634
+ }
44635
+
44636
+ return value;
44637
+ }
44638
+
44639
+ /**
44640
+ * Default visitor.
44641
+ *
44642
+ * @param {*} value
44643
+ * @param {String|Number} key
44644
+ * @param {Array<String|Number>} path
44645
+ * @this {FormData}
44646
+ *
44647
+ * @returns {boolean} return true to visit the each prop of the value recursively
44648
+ */
44649
+ function defaultVisitor(value, key, path) {
44650
+ let arr = value;
44651
+
44652
+ if (value && !path && typeof value === 'object') {
44653
+ if (utils.endsWith(key, '{}')) {
44654
+ // eslint-disable-next-line no-param-reassign
44655
+ key = metaTokens ? key : key.slice(0, -2);
44656
+ // eslint-disable-next-line no-param-reassign
44657
+ value = JSON.stringify(value);
44658
+ } else if (
44659
+ (utils.isArray(value) && isFlatArray(value)) ||
44660
+ ((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))
44661
+ )) {
44662
+ // eslint-disable-next-line no-param-reassign
44663
+ key = removeBrackets(key);
44664
+
44665
+ arr.forEach(function each(el, index) {
44666
+ !(utils.isUndefined(el) || el === null) && formData.append(
44667
+ // eslint-disable-next-line no-nested-ternary
44668
+ indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
44669
+ convertValue(el)
44670
+ );
44671
+ });
44672
+ return false;
44673
+ }
44674
+ }
44675
+
44676
+ if (isVisitable(value)) {
44677
+ return true;
44678
+ }
44679
+
44680
+ formData.append(renderKey(path, key, dots), convertValue(value));
44681
+
44682
+ return false;
44683
+ }
44684
+
44685
+ const stack = [];
44686
+
44687
+ const exposedHelpers = Object.assign(predicates, {
44688
+ defaultVisitor,
44689
+ convertValue,
44690
+ isVisitable
44691
+ });
44692
+
44693
+ function build(value, path) {
44694
+ if (utils.isUndefined(value)) return;
44695
+
44696
+ if (stack.indexOf(value) !== -1) {
44697
+ throw Error('Circular reference detected in ' + path.join('.'));
44698
+ }
44699
+
44700
+ stack.push(value);
44701
+
44702
+ utils.forEach(value, function each(el, key) {
44703
+ const result = !(utils.isUndefined(el) || el === null) && visitor.call(
44704
+ formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers
44705
+ );
44706
+
44707
+ if (result === true) {
44708
+ build(el, path ? path.concat(key) : [key]);
44709
+ }
44710
+ });
44711
+
44712
+ stack.pop();
44713
+ }
44714
+
44715
+ if (!utils.isObject(obj)) {
44716
+ throw new TypeError('data must be an object');
44717
+ }
44718
+
44719
+ build(obj);
44720
+
44721
+ return formData;
44722
+ }
44723
+
44724
+ /**
44725
+ * It encodes a string by replacing all characters that are not in the unreserved set with
44726
+ * their percent-encoded equivalents
44727
+ *
44728
+ * @param {string} str - The string to encode.
44729
+ *
44730
+ * @returns {string} The encoded string.
44731
+ */
44732
+ function encode(str) {
44733
+ const charMap = {
44734
+ '!': '%21',
44735
+ "'": '%27',
44736
+ '(': '%28',
44737
+ ')': '%29',
44738
+ '~': '%7E',
44739
+ '%20': '+',
44740
+ '%00': '\x00'
44741
+ };
44742
+ return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
44743
+ return charMap[match];
44744
+ });
44745
+ }
44746
+
44747
+ /**
44748
+ * It takes a params object and converts it to a FormData object
44749
+ *
44750
+ * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
44751
+ * @param {Object<string, any>} options - The options object passed to the Axios constructor.
44752
+ *
44753
+ * @returns {void}
44754
+ */
44755
+ function AxiosURLSearchParams(params, options) {
44756
+ this._pairs = [];
44757
+
44758
+ params && toFormData(params, this, options);
44759
+ }
44760
+
44761
+ const prototype$1 = AxiosURLSearchParams.prototype;
44762
+
44763
+ prototype$1.append = function append(name, value) {
44764
+ this._pairs.push([name, value]);
44765
+ };
44766
+
44767
+ prototype$1.toString = function toString(encoder) {
44768
+ const _encode = encoder ? function(value) {
44769
+ return encoder.call(this, value, encode);
44770
+ } : encode;
44771
+
44772
+ return this._pairs.map(function each(pair) {
44773
+ return _encode(pair[0]) + '=' + _encode(pair[1]);
44774
+ }, '').join('&');
44775
+ };
44776
+
44777
+ /**
44778
+ * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
44779
+ * URI encoded counterparts
44780
+ *
44781
+ * @param {string} val The value to be encoded.
44782
+ *
44783
+ * @returns {string} The encoded value.
44784
+ */
44785
+ function encode$1(val) {
44786
+ return encodeURIComponent(val).
44787
+ replace(/%3A/gi, ':').
44788
+ replace(/%24/g, '$').
44789
+ replace(/%2C/gi, ',').
44790
+ replace(/%20/g, '+').
44791
+ replace(/%5B/gi, '[').
44792
+ replace(/%5D/gi, ']');
44793
+ }
44794
+
44795
+ /**
44796
+ * Build a URL by appending params to the end
44797
+ *
44798
+ * @param {string} url The base of the url (e.g., http://www.google.com)
44799
+ * @param {object} [params] The params to be appended
44800
+ * @param {?object} options
44801
+ *
44802
+ * @returns {string} The formatted url
44803
+ */
44804
+ function buildURL(url, params, options) {
44805
+ /*eslint no-param-reassign:0*/
44806
+ if (!params) {
44807
+ return url;
44808
+ }
44809
+
44810
+ const _encode = options && options.encode || encode$1;
44811
+
44812
+ const serializeFn = options && options.serialize;
44813
+
44814
+ let serializedParams;
44815
+
44816
+ if (serializeFn) {
44817
+ serializedParams = serializeFn(params, options);
44818
+ } else {
44819
+ serializedParams = utils.isURLSearchParams(params) ?
44820
+ params.toString() :
44821
+ new AxiosURLSearchParams(params, options).toString(_encode);
44822
+ }
44823
+
44824
+ if (serializedParams) {
44825
+ const hashmarkIndex = url.indexOf("#");
44826
+
44827
+ if (hashmarkIndex !== -1) {
44828
+ url = url.slice(0, hashmarkIndex);
44829
+ }
44830
+ url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
44831
+ }
44832
+
44833
+ return url;
44834
+ }
44835
+
44836
+ class InterceptorManager {
44837
+ constructor() {
44838
+ this.handlers = [];
44839
+ }
44840
+
44841
+ /**
44842
+ * Add a new interceptor to the stack
44843
+ *
44844
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
44845
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
44846
+ *
44847
+ * @return {Number} An ID used to remove interceptor later
44848
+ */
44849
+ use(fulfilled, rejected, options) {
44850
+ this.handlers.push({
44851
+ fulfilled,
44852
+ rejected,
44853
+ synchronous: options ? options.synchronous : false,
44854
+ runWhen: options ? options.runWhen : null
44855
+ });
44856
+ return this.handlers.length - 1;
44857
+ }
44858
+
44859
+ /**
44860
+ * Remove an interceptor from the stack
44861
+ *
44862
+ * @param {Number} id The ID that was returned by `use`
44863
+ *
44864
+ * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
44865
+ */
44866
+ eject(id) {
44867
+ if (this.handlers[id]) {
44868
+ this.handlers[id] = null;
44869
+ }
44870
+ }
44871
+
44872
+ /**
44873
+ * Clear all interceptors from the stack
44874
+ *
44875
+ * @returns {void}
44876
+ */
44877
+ clear() {
44878
+ if (this.handlers) {
44879
+ this.handlers = [];
44880
+ }
44881
+ }
44882
+
44883
+ /**
44884
+ * Iterate over all the registered interceptors
44885
+ *
44886
+ * This method is particularly useful for skipping over any
44887
+ * interceptors that may have become `null` calling `eject`.
44888
+ *
44889
+ * @param {Function} fn The function to call for each interceptor
44890
+ *
44891
+ * @returns {void}
44892
+ */
44893
+ forEach(fn) {
44894
+ utils.forEach(this.handlers, function forEachHandler(h) {
44895
+ if (h !== null) {
44896
+ fn(h);
44897
+ }
44898
+ });
44899
+ }
44900
+ }
44901
+
44902
+ var transitionalDefaults = {
44903
+ silentJSONParsing: true,
44904
+ forcedJSONParsing: true,
44905
+ clarifyTimeoutError: false
44906
+ };
44907
+
44908
+ var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
44909
+
44910
+ var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
44911
+
44912
+ var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
44913
+
44914
+ var platform = {
44915
+ isBrowser: true,
44916
+ classes: {
44917
+ URLSearchParams: URLSearchParams$1,
44918
+ FormData: FormData$1,
44919
+ Blob: Blob$1
44920
+ },
44921
+ protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
44922
+ };
44923
+
44924
+ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
44925
+
44926
+ /**
44927
+ * Determine if we're running in a standard browser environment
44928
+ *
44929
+ * This allows axios to run in a web worker, and react-native.
44930
+ * Both environments support XMLHttpRequest, but not fully standard globals.
44931
+ *
44932
+ * web workers:
44933
+ * typeof window -> undefined
44934
+ * typeof document -> undefined
44935
+ *
44936
+ * react-native:
44937
+ * navigator.product -> 'ReactNative'
44938
+ * nativescript
44939
+ * navigator.product -> 'NativeScript' or 'NS'
44940
+ *
44941
+ * @returns {boolean}
44942
+ */
44943
+ const hasStandardBrowserEnv = (
44944
+ (product) => {
44945
+ return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0
44946
+ })(typeof navigator !== 'undefined' && navigator.product);
44947
+
44948
+ /**
44949
+ * Determine if we're running in a standard browser webWorker environment
44950
+ *
44951
+ * Although the `isStandardBrowserEnv` method indicates that
44952
+ * `allows axios to run in a web worker`, the WebWorker will still be
44953
+ * filtered out due to its judgment standard
44954
+ * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
44955
+ * This leads to a problem when axios post `FormData` in webWorker
44956
+ */
44957
+ const hasStandardBrowserWebWorkerEnv = (() => {
44958
+ return (
44959
+ typeof WorkerGlobalScope !== 'undefined' &&
44960
+ // eslint-disable-next-line no-undef
44961
+ self instanceof WorkerGlobalScope &&
44962
+ typeof self.importScripts === 'function'
44963
+ );
44964
+ })();
44965
+
44966
+ var utils$1 = /*#__PURE__*/Object.freeze({
44967
+ hasBrowserEnv: hasBrowserEnv,
44968
+ hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
44969
+ hasStandardBrowserEnv: hasStandardBrowserEnv
44970
+ });
44971
+
44972
+ var platform$1 = {
44973
+ ...utils$1,
44974
+ ...platform
44975
+ };
44976
+
44977
+ function toURLEncodedForm(data, options) {
44978
+ return toFormData(data, new platform$1.classes.URLSearchParams(), Object.assign({
44979
+ visitor: function(value, key, path, helpers) {
44980
+
44981
+ return helpers.defaultVisitor.apply(this, arguments);
44982
+ }
44983
+ }, options));
44984
+ }
44985
+
44986
+ /**
44987
+ * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
44988
+ *
44989
+ * @param {string} name - The name of the property to get.
44990
+ *
44991
+ * @returns An array of strings.
44992
+ */
44993
+ function parsePropPath(name) {
44994
+ // foo[x][y][z]
44995
+ // foo.x.y.z
44996
+ // foo-x-y-z
44997
+ // foo x y z
44998
+ return utils.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
44999
+ return match[0] === '[]' ? '' : match[1] || match[0];
45000
+ });
45001
+ }
45002
+
45003
+ /**
45004
+ * Convert an array to an object.
45005
+ *
45006
+ * @param {Array<any>} arr - The array to convert to an object.
45007
+ *
45008
+ * @returns An object with the same keys and values as the array.
45009
+ */
45010
+ function arrayToObject(arr) {
45011
+ const obj = {};
45012
+ const keys = Object.keys(arr);
45013
+ let i;
45014
+ const len = keys.length;
45015
+ let key;
45016
+ for (i = 0; i < len; i++) {
45017
+ key = keys[i];
45018
+ obj[key] = arr[key];
45019
+ }
45020
+ return obj;
45021
+ }
45022
+
45023
+ /**
45024
+ * It takes a FormData object and returns a JavaScript object
45025
+ *
45026
+ * @param {string} formData The FormData object to convert to JSON.
45027
+ *
45028
+ * @returns {Object<string, any> | null} The converted object.
45029
+ */
45030
+ function formDataToJSON(formData) {
45031
+ function buildPath(path, value, target, index) {
45032
+ let name = path[index++];
45033
+ const isNumericKey = Number.isFinite(+name);
45034
+ const isLast = index >= path.length;
45035
+ name = !name && utils.isArray(target) ? target.length : name;
45036
+
45037
+ if (isLast) {
45038
+ if (utils.hasOwnProp(target, name)) {
45039
+ target[name] = [target[name], value];
45040
+ } else {
45041
+ target[name] = value;
45042
+ }
45043
+
45044
+ return !isNumericKey;
45045
+ }
45046
+
45047
+ if (!target[name] || !utils.isObject(target[name])) {
45048
+ target[name] = [];
45049
+ }
45050
+
45051
+ const result = buildPath(path, value, target[name], index);
45052
+
45053
+ if (result && utils.isArray(target[name])) {
45054
+ target[name] = arrayToObject(target[name]);
45055
+ }
45056
+
45057
+ return !isNumericKey;
45058
+ }
45059
+
45060
+ if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
45061
+ const obj = {};
45062
+
45063
+ utils.forEachEntry(formData, (name, value) => {
45064
+ buildPath(parsePropPath(name), value, obj, 0);
45065
+ });
45066
+
45067
+ return obj;
45068
+ }
45069
+
45070
+ return null;
45071
+ }
45072
+
45073
+ /**
45074
+ * It takes a string, tries to parse it, and if it fails, it returns the stringified version
45075
+ * of the input
45076
+ *
45077
+ * @param {any} rawValue - The value to be stringified.
45078
+ * @param {Function} parser - A function that parses a string into a JavaScript object.
45079
+ * @param {Function} encoder - A function that takes a value and returns a string.
45080
+ *
45081
+ * @returns {string} A stringified version of the rawValue.
45082
+ */
45083
+ function stringifySafely(rawValue, parser, encoder) {
45084
+ if (utils.isString(rawValue)) {
45085
+ try {
45086
+ (parser || JSON.parse)(rawValue);
45087
+ return utils.trim(rawValue);
45088
+ } catch (e) {
45089
+ if (e.name !== 'SyntaxError') {
45090
+ throw e;
45091
+ }
45092
+ }
45093
+ }
45094
+
45095
+ return (encoder || JSON.stringify)(rawValue);
45096
+ }
45097
+
45098
+ const defaults = {
45099
+
45100
+ transitional: transitionalDefaults,
45101
+
45102
+ adapter: ['xhr', 'http'],
45103
+
45104
+ transformRequest: [function transformRequest(data, headers) {
45105
+ const contentType = headers.getContentType() || '';
45106
+ const hasJSONContentType = contentType.indexOf('application/json') > -1;
45107
+ const isObjectPayload = utils.isObject(data);
45108
+
45109
+ if (isObjectPayload && utils.isHTMLForm(data)) {
45110
+ data = new FormData(data);
45111
+ }
45112
+
45113
+ const isFormData = utils.isFormData(data);
45114
+
45115
+ if (isFormData) {
45116
+ if (!hasJSONContentType) {
45117
+ return data;
45118
+ }
45119
+ return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
45120
+ }
45121
+
45122
+ if (utils.isArrayBuffer(data) ||
45123
+ utils.isBuffer(data) ||
45124
+ utils.isStream(data) ||
45125
+ utils.isFile(data) ||
45126
+ utils.isBlob(data)
45127
+ ) {
45128
+ return data;
45129
+ }
45130
+ if (utils.isArrayBufferView(data)) {
45131
+ return data.buffer;
45132
+ }
45133
+ if (utils.isURLSearchParams(data)) {
45134
+ headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
45135
+ return data.toString();
45136
+ }
45137
+
45138
+ let isFileList;
45139
+
45140
+ if (isObjectPayload) {
45141
+ if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
45142
+ return toURLEncodedForm(data, this.formSerializer).toString();
45143
+ }
45144
+
45145
+ if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
45146
+ const _FormData = this.env && this.env.FormData;
45147
+
45148
+ return toFormData(
45149
+ isFileList ? {'files[]': data} : data,
45150
+ _FormData && new _FormData(),
45151
+ this.formSerializer
45152
+ );
45153
+ }
45154
+ }
45155
+
45156
+ if (isObjectPayload || hasJSONContentType ) {
45157
+ headers.setContentType('application/json', false);
45158
+ return stringifySafely(data);
45159
+ }
45160
+
45161
+ return data;
45162
+ }],
45163
+
45164
+ transformResponse: [function transformResponse(data) {
45165
+ const transitional = this.transitional || defaults.transitional;
45166
+ const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
45167
+ const JSONRequested = this.responseType === 'json';
45168
+
45169
+ if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
45170
+ const silentJSONParsing = transitional && transitional.silentJSONParsing;
45171
+ const strictJSONParsing = !silentJSONParsing && JSONRequested;
45172
+
45173
+ try {
45174
+ return JSON.parse(data);
45175
+ } catch (e) {
45176
+ if (strictJSONParsing) {
45177
+ if (e.name === 'SyntaxError') {
45178
+ throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
45179
+ }
45180
+ throw e;
45181
+ }
45182
+ }
45183
+ }
45184
+
45185
+ return data;
45186
+ }],
45187
+
45188
+ /**
45189
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
45190
+ * timeout is not created.
45191
+ */
45192
+ timeout: 0,
45193
+
45194
+ xsrfCookieName: 'XSRF-TOKEN',
45195
+ xsrfHeaderName: 'X-XSRF-TOKEN',
45196
+
45197
+ maxContentLength: -1,
45198
+ maxBodyLength: -1,
45199
+
45200
+ env: {
45201
+ FormData: platform$1.classes.FormData,
45202
+ Blob: platform$1.classes.Blob
45203
+ },
45204
+
45205
+ validateStatus: function validateStatus(status) {
45206
+ return status >= 200 && status < 300;
45207
+ },
45208
+
45209
+ headers: {
45210
+ common: {
45211
+ 'Accept': 'application/json, text/plain, */*',
45212
+ 'Content-Type': undefined
45213
+ }
45214
+ }
45215
+ };
45216
+
45217
+ utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
45218
+ defaults.headers[method] = {};
45219
+ });
45220
+
45221
+ // RawAxiosHeaders whose duplicates are ignored by node
45222
+ // c.f. https://nodejs.org/api/http.html#http_message_headers
45223
+ const ignoreDuplicateOf = utils.toObjectSet([
45224
+ 'age', 'authorization', 'content-length', 'content-type', 'etag',
45225
+ 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
45226
+ 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
45227
+ 'referer', 'retry-after', 'user-agent'
45228
+ ]);
45229
+
45230
+ /**
45231
+ * Parse headers into an object
45232
+ *
45233
+ * ```
45234
+ * Date: Wed, 27 Aug 2014 08:58:49 GMT
45235
+ * Content-Type: application/json
45236
+ * Connection: keep-alive
45237
+ * Transfer-Encoding: chunked
45238
+ * ```
45239
+ *
45240
+ * @param {String} rawHeaders Headers needing to be parsed
45241
+ *
45242
+ * @returns {Object} Headers parsed into an object
45243
+ */
45244
+ var parseHeaders = rawHeaders => {
45245
+ const parsed = {};
45246
+ let key;
45247
+ let val;
45248
+ let i;
45249
+
45250
+ rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
45251
+ i = line.indexOf(':');
45252
+ key = line.substring(0, i).trim().toLowerCase();
45253
+ val = line.substring(i + 1).trim();
45254
+
45255
+ if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
45256
+ return;
45257
+ }
45258
+
45259
+ if (key === 'set-cookie') {
45260
+ if (parsed[key]) {
45261
+ parsed[key].push(val);
45262
+ } else {
45263
+ parsed[key] = [val];
45264
+ }
45265
+ } else {
45266
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
45267
+ }
45268
+ });
45269
+
45270
+ return parsed;
45271
+ };
45272
+
45273
+ const $internals = Symbol('internals');
45274
+
45275
+ function normalizeHeader(header) {
45276
+ return header && String(header).trim().toLowerCase();
45277
+ }
45278
+
45279
+ function normalizeValue(value) {
45280
+ if (value === false || value == null) {
45281
+ return value;
45282
+ }
45283
+
45284
+ return utils.isArray(value) ? value.map(normalizeValue) : String(value);
45285
+ }
45286
+
45287
+ function parseTokens(str) {
45288
+ const tokens = Object.create(null);
45289
+ const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
45290
+ let match;
45291
+
45292
+ while ((match = tokensRE.exec(str))) {
45293
+ tokens[match[1]] = match[2];
45294
+ }
45295
+
45296
+ return tokens;
45297
+ }
45298
+
45299
+ const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
45300
+
45301
+ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
45302
+ if (utils.isFunction(filter)) {
45303
+ return filter.call(this, value, header);
45304
+ }
45305
+
45306
+ if (isHeaderNameFilter) {
45307
+ value = header;
45308
+ }
45309
+
45310
+ if (!utils.isString(value)) return;
45311
+
45312
+ if (utils.isString(filter)) {
45313
+ return value.indexOf(filter) !== -1;
45314
+ }
45315
+
45316
+ if (utils.isRegExp(filter)) {
45317
+ return filter.test(value);
45318
+ }
45319
+ }
45320
+
45321
+ function formatHeader(header) {
45322
+ return header.trim()
45323
+ .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
45324
+ return char.toUpperCase() + str;
45325
+ });
45326
+ }
45327
+
45328
+ function buildAccessors(obj, header) {
45329
+ const accessorName = utils.toCamelCase(' ' + header);
45330
+
45331
+ ['get', 'set', 'has'].forEach(methodName => {
45332
+ Object.defineProperty(obj, methodName + accessorName, {
45333
+ value: function(arg1, arg2, arg3) {
45334
+ return this[methodName].call(this, header, arg1, arg2, arg3);
45335
+ },
45336
+ configurable: true
45337
+ });
45338
+ });
45339
+ }
45340
+
45341
+ class AxiosHeaders {
45342
+ constructor(headers) {
45343
+ headers && this.set(headers);
45344
+ }
45345
+
45346
+ set(header, valueOrRewrite, rewrite) {
45347
+ const self = this;
45348
+
45349
+ function setHeader(_value, _header, _rewrite) {
45350
+ const lHeader = normalizeHeader(_header);
45351
+
45352
+ if (!lHeader) {
45353
+ throw new Error('header name must be a non-empty string');
45354
+ }
45355
+
45356
+ const key = utils.findKey(self, lHeader);
45357
+
45358
+ if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
45359
+ self[key || _header] = normalizeValue(_value);
45360
+ }
45361
+ }
45362
+
45363
+ const setHeaders = (headers, _rewrite) =>
45364
+ utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
45365
+
45366
+ if (utils.isPlainObject(header) || header instanceof this.constructor) {
45367
+ setHeaders(header, valueOrRewrite);
45368
+ } else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
45369
+ setHeaders(parseHeaders(header), valueOrRewrite);
45370
+ } else {
45371
+ header != null && setHeader(valueOrRewrite, header, rewrite);
45372
+ }
45373
+
45374
+ return this;
45375
+ }
45376
+
45377
+ get(header, parser) {
45378
+ header = normalizeHeader(header);
45379
+
45380
+ if (header) {
45381
+ const key = utils.findKey(this, header);
45382
+
45383
+ if (key) {
45384
+ const value = this[key];
45385
+
45386
+ if (!parser) {
45387
+ return value;
45388
+ }
45389
+
45390
+ if (parser === true) {
45391
+ return parseTokens(value);
45392
+ }
45393
+
45394
+ if (utils.isFunction(parser)) {
45395
+ return parser.call(this, value, key);
45396
+ }
45397
+
45398
+ if (utils.isRegExp(parser)) {
45399
+ return parser.exec(value);
45400
+ }
45401
+
45402
+ throw new TypeError('parser must be boolean|regexp|function');
45403
+ }
45404
+ }
45405
+ }
45406
+
45407
+ has(header, matcher) {
45408
+ header = normalizeHeader(header);
45409
+
45410
+ if (header) {
45411
+ const key = utils.findKey(this, header);
45412
+
45413
+ return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
45414
+ }
45415
+
45416
+ return false;
45417
+ }
45418
+
45419
+ delete(header, matcher) {
45420
+ const self = this;
45421
+ let deleted = false;
45422
+
45423
+ function deleteHeader(_header) {
45424
+ _header = normalizeHeader(_header);
45425
+
45426
+ if (_header) {
45427
+ const key = utils.findKey(self, _header);
45428
+
45429
+ if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
45430
+ delete self[key];
45431
+
45432
+ deleted = true;
45433
+ }
45434
+ }
45435
+ }
45436
+
45437
+ if (utils.isArray(header)) {
45438
+ header.forEach(deleteHeader);
45439
+ } else {
45440
+ deleteHeader(header);
45441
+ }
45442
+
45443
+ return deleted;
45444
+ }
45445
+
45446
+ clear(matcher) {
45447
+ const keys = Object.keys(this);
45448
+ let i = keys.length;
45449
+ let deleted = false;
45450
+
45451
+ while (i--) {
45452
+ const key = keys[i];
45453
+ if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
45454
+ delete this[key];
45455
+ deleted = true;
45456
+ }
45457
+ }
45458
+
45459
+ return deleted;
45460
+ }
45461
+
45462
+ normalize(format) {
45463
+ const self = this;
45464
+ const headers = {};
45465
+
45466
+ utils.forEach(this, (value, header) => {
45467
+ const key = utils.findKey(headers, header);
45468
+
45469
+ if (key) {
45470
+ self[key] = normalizeValue(value);
45471
+ delete self[header];
45472
+ return;
45473
+ }
45474
+
45475
+ const normalized = format ? formatHeader(header) : String(header).trim();
45476
+
45477
+ if (normalized !== header) {
45478
+ delete self[header];
45479
+ }
45480
+
45481
+ self[normalized] = normalizeValue(value);
45482
+
45483
+ headers[normalized] = true;
45484
+ });
45485
+
45486
+ return this;
45487
+ }
45488
+
45489
+ concat(...targets) {
45490
+ return this.constructor.concat(this, ...targets);
45491
+ }
45492
+
45493
+ toJSON(asStrings) {
45494
+ const obj = Object.create(null);
45495
+
45496
+ utils.forEach(this, (value, header) => {
45497
+ value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);
45498
+ });
45499
+
45500
+ return obj;
45501
+ }
45502
+
45503
+ [Symbol.iterator]() {
45504
+ return Object.entries(this.toJSON())[Symbol.iterator]();
45505
+ }
45506
+
45507
+ toString() {
45508
+ return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
45509
+ }
45510
+
45511
+ get [Symbol.toStringTag]() {
45512
+ return 'AxiosHeaders';
45513
+ }
45514
+
45515
+ static from(thing) {
45516
+ return thing instanceof this ? thing : new this(thing);
45517
+ }
45518
+
45519
+ static concat(first, ...targets) {
45520
+ const computed = new this(first);
45521
+
45522
+ targets.forEach((target) => computed.set(target));
45523
+
45524
+ return computed;
45525
+ }
45526
+
45527
+ static accessor(header) {
45528
+ const internals = this[$internals] = (this[$internals] = {
45529
+ accessors: {}
45530
+ });
45531
+
45532
+ const accessors = internals.accessors;
45533
+ const prototype = this.prototype;
44108
45534
 
44109
- return url;
44110
- };
45535
+ function defineAccessor(_header) {
45536
+ const lHeader = normalizeHeader(_header);
45537
+
45538
+ if (!accessors[lHeader]) {
45539
+ buildAccessors(prototype, _header);
45540
+ accessors[lHeader] = true;
45541
+ }
45542
+ }
45543
+
45544
+ utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
44111
45545
 
44112
- function InterceptorManager() {
44113
- this.handlers = [];
45546
+ return this;
45547
+ }
44114
45548
  }
44115
45549
 
44116
- /**
44117
- * Add a new interceptor to the stack
44118
- *
44119
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
44120
- * @param {Function} rejected The function to handle `reject` for a `Promise`
44121
- *
44122
- * @return {Number} An ID used to remove interceptor later
44123
- */
44124
- InterceptorManager.prototype.use = function use(fulfilled, rejected, options) {
44125
- this.handlers.push({
44126
- fulfilled: fulfilled,
44127
- rejected: rejected,
44128
- synchronous: options ? options.synchronous : false,
44129
- runWhen: options ? options.runWhen : null
44130
- });
44131
- return this.handlers.length - 1;
44132
- };
45550
+ AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
44133
45551
 
44134
- /**
44135
- * Remove an interceptor from the stack
44136
- *
44137
- * @param {Number} id The ID that was returned by `use`
44138
- */
44139
- InterceptorManager.prototype.eject = function eject(id) {
44140
- if (this.handlers[id]) {
44141
- this.handlers[id] = null;
45552
+ // reserved names hotfix
45553
+ utils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
45554
+ let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
45555
+ return {
45556
+ get: () => value,
45557
+ set(headerValue) {
45558
+ this[mapped] = headerValue;
45559
+ }
44142
45560
  }
44143
- };
45561
+ });
45562
+
45563
+ utils.freezeMethods(AxiosHeaders);
44144
45564
 
44145
45565
  /**
44146
- * Iterate over all the registered interceptors
45566
+ * Transform the data for a request or a response
44147
45567
  *
44148
- * This method is particularly useful for skipping over any
44149
- * interceptors that may have become `null` calling `eject`.
45568
+ * @param {Array|Function} fns A single function or Array of functions
45569
+ * @param {?Object} response The response object
44150
45570
  *
44151
- * @param {Function} fn The function to call for each interceptor
45571
+ * @returns {*} The resulting transformed data
44152
45572
  */
44153
- InterceptorManager.prototype.forEach = function forEach(fn) {
44154
- utils.forEach(this.handlers, function forEachHandler(h) {
44155
- if (h !== null) {
44156
- fn(h);
44157
- }
44158
- });
44159
- };
44160
-
44161
- var InterceptorManager_1 = InterceptorManager;
45573
+ function transformData(fns, response) {
45574
+ const config = this || defaults;
45575
+ const context = response || config;
45576
+ const headers = AxiosHeaders.from(context.headers);
45577
+ let data = context.data;
44162
45578
 
44163
- var normalizeHeaderName = function normalizeHeaderName(headers, normalizedName) {
44164
- utils.forEach(headers, function processHeader(value, name) {
44165
- if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
44166
- headers[normalizedName] = value;
44167
- delete headers[name];
44168
- }
45579
+ utils.forEach(fns, function transform(fn) {
45580
+ data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
44169
45581
  });
44170
- };
44171
45582
 
44172
- /**
44173
- * Update an Error with the specified config, error code, and response.
44174
- *
44175
- * @param {Error} error The error to update.
44176
- * @param {Object} config The config.
44177
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
44178
- * @param {Object} [request] The request.
44179
- * @param {Object} [response] The response.
44180
- * @returns {Error} The error.
44181
- */
44182
- var enhanceError = function enhanceError(error, config, code, request, response) {
44183
- error.config = config;
44184
- if (code) {
44185
- error.code = code;
44186
- }
45583
+ headers.normalize();
44187
45584
 
44188
- error.request = request;
44189
- error.response = response;
44190
- error.isAxiosError = true;
45585
+ return data;
45586
+ }
44191
45587
 
44192
- error.toJSON = function toJSON() {
44193
- return {
44194
- // Standard
44195
- message: this.message,
44196
- name: this.name,
44197
- // Microsoft
44198
- description: this.description,
44199
- number: this.number,
44200
- // Mozilla
44201
- fileName: this.fileName,
44202
- lineNumber: this.lineNumber,
44203
- columnNumber: this.columnNumber,
44204
- stack: this.stack,
44205
- // Axios
44206
- config: this.config,
44207
- code: this.code,
44208
- status: this.response && this.response.status ? this.response.status : null
44209
- };
44210
- };
44211
- return error;
44212
- };
45588
+ function isCancel(value) {
45589
+ return !!(value && value.__CANCEL__);
45590
+ }
44213
45591
 
44214
45592
  /**
44215
- * Create an Error with the specified message, config, error code, request and response.
45593
+ * A `CanceledError` is an object that is thrown when an operation is canceled.
44216
45594
  *
44217
- * @param {string} message The error message.
44218
- * @param {Object} config The config.
44219
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
44220
- * @param {Object} [request] The request.
44221
- * @param {Object} [response] The response.
44222
- * @returns {Error} The created error.
45595
+ * @param {string=} message The message.
45596
+ * @param {Object=} config The config.
45597
+ * @param {Object=} request The request.
45598
+ *
45599
+ * @returns {CanceledError} The created error.
44223
45600
  */
44224
- var createError = function createError(message, config, code, request, response) {
44225
- var error = new Error(message);
44226
- return enhanceError(error, config, code, request, response);
44227
- };
45601
+ function CanceledError(message, config, request) {
45602
+ // eslint-disable-next-line no-eq-null,eqeqeq
45603
+ AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
45604
+ this.name = 'CanceledError';
45605
+ }
45606
+
45607
+ utils.inherits(CanceledError, AxiosError, {
45608
+ __CANCEL__: true
45609
+ });
44228
45610
 
44229
45611
  /**
44230
45612
  * Resolve or reject a Promise based on response status.
@@ -44232,97 +45614,51 @@ var createError = function createError(message, config, code, request, response)
44232
45614
  * @param {Function} resolve A function that resolves the promise.
44233
45615
  * @param {Function} reject A function that rejects the promise.
44234
45616
  * @param {object} response The response.
45617
+ *
45618
+ * @returns {object} The response.
44235
45619
  */
44236
- var settle = function settle(resolve, reject, response) {
44237
- var validateStatus = response.config.validateStatus;
45620
+ function settle(resolve, reject, response) {
45621
+ const validateStatus = response.config.validateStatus;
44238
45622
  if (!response.status || !validateStatus || validateStatus(response.status)) {
44239
45623
  resolve(response);
44240
45624
  } else {
44241
- reject(createError(
45625
+ reject(new AxiosError(
44242
45626
  'Request failed with status code ' + response.status,
45627
+ [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
44243
45628
  response.config,
44244
- null,
44245
45629
  response.request,
44246
45630
  response
44247
45631
  ));
44248
45632
  }
44249
- };
44250
-
44251
- var cookies = (
44252
- utils.isStandardBrowserEnv() ?
44253
-
44254
- // Standard browser envs support document.cookie
44255
- (function standardBrowserEnv() {
44256
- return {
44257
- write: function write(name, value, expires, path, domain, secure) {
44258
- var cookie = [];
44259
- cookie.push(name + '=' + encodeURIComponent(value));
44260
-
44261
- if (utils.isNumber(expires)) {
44262
- cookie.push('expires=' + new Date(expires).toGMTString());
44263
- }
44264
-
44265
- if (utils.isString(path)) {
44266
- cookie.push('path=' + path);
44267
- }
44268
-
44269
- if (utils.isString(domain)) {
44270
- cookie.push('domain=' + domain);
44271
- }
44272
-
44273
- if (secure === true) {
44274
- cookie.push('secure');
44275
- }
44276
-
44277
- document.cookie = cookie.join('; ');
44278
- },
44279
-
44280
- read: function read(name) {
44281
- var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
44282
- return (match ? decodeURIComponent(match[3]) : null);
44283
- },
44284
-
44285
- remove: function remove(name) {
44286
- this.write(name, '', Date.now() - 86400000);
44287
- }
44288
- };
44289
- })() :
44290
-
44291
- // Non standard browser env (web workers, react-native) lack needed support.
44292
- (function nonStandardBrowserEnv() {
44293
- return {
44294
- write: function write() {},
44295
- read: function read() { return null; },
44296
- remove: function remove() {}
44297
- };
44298
- })()
44299
- );
45633
+ }
44300
45634
 
44301
45635
  /**
44302
45636
  * Determines whether the specified URL is absolute
44303
45637
  *
44304
45638
  * @param {string} url The URL to test
45639
+ *
44305
45640
  * @returns {boolean} True if the specified URL is absolute, otherwise false
44306
45641
  */
44307
- var isAbsoluteURL = function isAbsoluteURL(url) {
45642
+ function isAbsoluteURL(url) {
44308
45643
  // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
44309
45644
  // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
44310
45645
  // by any combination of letters, digits, plus, period, or hyphen.
44311
45646
  return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
44312
- };
45647
+ }
44313
45648
 
44314
45649
  /**
44315
45650
  * Creates a new URL by combining the specified URLs
44316
45651
  *
44317
45652
  * @param {string} baseURL The base URL
44318
45653
  * @param {string} relativeURL The relative URL
45654
+ *
44319
45655
  * @returns {string} The combined URL
44320
45656
  */
44321
- var combineURLs = function combineURLs(baseURL, relativeURL) {
45657
+ function combineURLs(baseURL, relativeURL) {
44322
45658
  return relativeURL
44323
45659
  ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
44324
45660
  : baseURL;
44325
- };
45661
+ }
44326
45662
 
44327
45663
  /**
44328
45664
  * Creates a new URL by combining the baseURL with the requestedURL,
@@ -44331,154 +45667,173 @@ var combineURLs = function combineURLs(baseURL, relativeURL) {
44331
45667
  *
44332
45668
  * @param {string} baseURL The base URL
44333
45669
  * @param {string} requestedURL Absolute or relative URL to combine
45670
+ *
44334
45671
  * @returns {string} The combined full path
44335
45672
  */
44336
- var buildFullPath = function buildFullPath(baseURL, requestedURL) {
45673
+ function buildFullPath(baseURL, requestedURL) {
44337
45674
  if (baseURL && !isAbsoluteURL(requestedURL)) {
44338
45675
  return combineURLs(baseURL, requestedURL);
44339
45676
  }
44340
45677
  return requestedURL;
44341
- };
44342
-
44343
- // Headers whose duplicates are ignored by node
44344
- // c.f. https://nodejs.org/api/http.html#http_message_headers
44345
- var ignoreDuplicateOf = [
44346
- 'age', 'authorization', 'content-length', 'content-type', 'etag',
44347
- 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
44348
- 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
44349
- 'referer', 'retry-after', 'user-agent'
44350
- ];
44351
-
44352
- /**
44353
- * Parse headers into an object
44354
- *
44355
- * ```
44356
- * Date: Wed, 27 Aug 2014 08:58:49 GMT
44357
- * Content-Type: application/json
44358
- * Connection: keep-alive
44359
- * Transfer-Encoding: chunked
44360
- * ```
44361
- *
44362
- * @param {String} headers Headers needing to be parsed
44363
- * @returns {Object} Headers parsed into an object
44364
- */
44365
- var parseHeaders = function parseHeaders(headers) {
44366
- var parsed = {};
44367
- var key;
44368
- var val;
44369
- var i;
44370
-
44371
- if (!headers) { return parsed; }
44372
-
44373
- utils.forEach(headers.split('\n'), function parser(line) {
44374
- i = line.indexOf(':');
44375
- key = utils.trim(line.substr(0, i)).toLowerCase();
44376
- val = utils.trim(line.substr(i + 1));
44377
-
44378
- if (key) {
44379
- if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
44380
- return;
44381
- }
44382
- if (key === 'set-cookie') {
44383
- parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
44384
- } else {
44385
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
44386
- }
44387
- }
44388
- });
44389
-
44390
- return parsed;
44391
- };
45678
+ }
44392
45679
 
44393
- var isURLSameOrigin = (
44394
- utils.isStandardBrowserEnv() ?
45680
+ platform$1.hasStandardBrowserEnv ?
44395
45681
 
44396
- // Standard browser envs have full support of the APIs needed to test
44397
- // whether the request URL is of the same origin as current location.
44398
- (function standardBrowserEnv() {
44399
- var msie = /(msie|trident)/i.test(navigator.userAgent);
44400
- var urlParsingNode = document.createElement('a');
44401
- var originURL;
45682
+ // Standard browser envs have full support of the APIs needed to test
45683
+ // whether the request URL is of the same origin as current location.
45684
+ (function standardBrowserEnv() {
45685
+ const msie = /(msie|trident)/i.test(navigator.userAgent);
45686
+ const urlParsingNode = document.createElement('a');
45687
+ let originURL;
44402
45688
 
44403
- /**
44404
- * Parse a URL to discover it's components
45689
+ /**
45690
+ * Parse a URL to discover its components
44405
45691
  *
44406
45692
  * @param {String} url The URL to be parsed
44407
45693
  * @returns {Object}
44408
45694
  */
44409
- function resolveURL(url) {
44410
- var href = url;
45695
+ function resolveURL(url) {
45696
+ let href = url;
44411
45697
 
44412
- if (msie) {
45698
+ if (msie) {
44413
45699
  // IE needs attribute set twice to normalize properties
44414
- urlParsingNode.setAttribute('href', href);
44415
- href = urlParsingNode.href;
44416
- }
44417
-
44418
45700
  urlParsingNode.setAttribute('href', href);
44419
-
44420
- // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
44421
- return {
44422
- href: urlParsingNode.href,
44423
- protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
44424
- host: urlParsingNode.host,
44425
- search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
44426
- hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
44427
- hostname: urlParsingNode.hostname,
44428
- port: urlParsingNode.port,
44429
- pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
44430
- urlParsingNode.pathname :
44431
- '/' + urlParsingNode.pathname
44432
- };
45701
+ href = urlParsingNode.href;
44433
45702
  }
44434
45703
 
44435
- originURL = resolveURL(window.location.href);
45704
+ urlParsingNode.setAttribute('href', href);
45705
+
45706
+ // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
45707
+ return {
45708
+ href: urlParsingNode.href,
45709
+ protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
45710
+ host: urlParsingNode.host,
45711
+ search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
45712
+ hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
45713
+ hostname: urlParsingNode.hostname,
45714
+ port: urlParsingNode.port,
45715
+ pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
45716
+ urlParsingNode.pathname :
45717
+ '/' + urlParsingNode.pathname
45718
+ };
45719
+ }
45720
+
45721
+ originURL = resolveURL(window.location.href);
44436
45722
 
44437
- /**
45723
+ /**
44438
45724
  * Determine if a URL shares the same origin as the current location
44439
45725
  *
44440
45726
  * @param {String} requestURL The URL to test
44441
45727
  * @returns {boolean} True if URL shares the same origin, otherwise false
44442
45728
  */
44443
- return function isURLSameOrigin(requestURL) {
44444
- var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
44445
- return (parsed.protocol === originURL.protocol &&
44446
- parsed.host === originURL.host);
44447
- };
44448
- })() :
45729
+ return function isURLSameOrigin(requestURL) {
45730
+ const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
45731
+ return (parsed.protocol === originURL.protocol &&
45732
+ parsed.host === originURL.host);
45733
+ };
45734
+ })() :
44449
45735
 
44450
45736
  // Non standard browser envs (web workers, react-native) lack needed support.
44451
- (function nonStandardBrowserEnv() {
44452
- return function isURLSameOrigin() {
44453
- return true;
44454
- };
44455
- })()
44456
- );
45737
+ (function nonStandardBrowserEnv() {
45738
+ return function isURLSameOrigin() {
45739
+ return true;
45740
+ };
45741
+ })();
45742
+
45743
+ function parseProtocol(url) {
45744
+ const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
45745
+ return match && match[1] || '';
45746
+ }
44457
45747
 
44458
45748
  /**
44459
- * A `Cancel` is an object that is thrown when an operation is canceled.
44460
- *
44461
- * @class
44462
- * @param {string=} message The message.
45749
+ * Calculate data maxRate
45750
+ * @param {Number} [samplesCount= 10]
45751
+ * @param {Number} [min= 1000]
45752
+ * @returns {Function}
44463
45753
  */
44464
- function Cancel(message) {
44465
- this.message = message;
45754
+ function speedometer(samplesCount, min) {
45755
+ samplesCount = samplesCount || 10;
45756
+ const bytes = new Array(samplesCount);
45757
+ const timestamps = new Array(samplesCount);
45758
+ let head = 0;
45759
+ let tail = 0;
45760
+ let firstSampleTS;
45761
+
45762
+ min = min !== undefined ? min : 1000;
45763
+
45764
+ return function push(chunkLength) {
45765
+ const now = Date.now();
45766
+
45767
+ const startedAt = timestamps[tail];
45768
+
45769
+ if (!firstSampleTS) {
45770
+ firstSampleTS = now;
45771
+ }
45772
+
45773
+ bytes[head] = chunkLength;
45774
+ timestamps[head] = now;
45775
+
45776
+ let i = tail;
45777
+ let bytesCount = 0;
45778
+
45779
+ while (i !== head) {
45780
+ bytesCount += bytes[i++];
45781
+ i = i % samplesCount;
45782
+ }
45783
+
45784
+ head = (head + 1) % samplesCount;
45785
+
45786
+ if (head === tail) {
45787
+ tail = (tail + 1) % samplesCount;
45788
+ }
45789
+
45790
+ if (now - firstSampleTS < min) {
45791
+ return;
45792
+ }
45793
+
45794
+ const passed = startedAt && now - startedAt;
45795
+
45796
+ return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
45797
+ };
44466
45798
  }
44467
45799
 
44468
- Cancel.prototype.toString = function toString() {
44469
- return 'Cancel' + (this.message ? ': ' + this.message : '');
44470
- };
45800
+ function progressEventReducer(listener, isDownloadStream) {
45801
+ let bytesNotified = 0;
45802
+ const _speedometer = speedometer(50, 250);
44471
45803
 
44472
- Cancel.prototype.__CANCEL__ = true;
45804
+ return e => {
45805
+ const loaded = e.loaded;
45806
+ const total = e.lengthComputable ? e.total : undefined;
45807
+ const progressBytes = loaded - bytesNotified;
45808
+ const rate = _speedometer(progressBytes);
45809
+ const inRange = loaded <= total;
44473
45810
 
44474
- var Cancel_1 = Cancel;
45811
+ bytesNotified = loaded;
44475
45812
 
44476
- var xhr = function xhrAdapter(config) {
45813
+ const data = {
45814
+ loaded,
45815
+ total,
45816
+ progress: total ? (loaded / total) : undefined,
45817
+ bytes: progressBytes,
45818
+ rate: rate ? rate : undefined,
45819
+ estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
45820
+ event: e
45821
+ };
45822
+
45823
+ data[isDownloadStream ? 'download' : 'upload'] = true;
45824
+
45825
+ listener(data);
45826
+ };
45827
+ }
45828
+
45829
+ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
45830
+
45831
+ var xhrAdapter = isXHRAdapterSupported && function (config) {
44477
45832
  return new Promise(function dispatchXhrRequest(resolve, reject) {
44478
- var requestData = config.data;
44479
- var requestHeaders = config.headers;
44480
- var responseType = config.responseType;
44481
- var onCanceled;
45833
+ let requestData = config.data;
45834
+ const requestHeaders = AxiosHeaders.from(config.headers).normalize();
45835
+ let {responseType, withXSRFToken} = config;
45836
+ let onCanceled;
44482
45837
  function done() {
44483
45838
  if (config.cancelToken) {
44484
45839
  config.cancelToken.unsubscribe(onCanceled);
@@ -44489,20 +45844,27 @@ var xhr = function xhrAdapter(config) {
44489
45844
  }
44490
45845
  }
44491
45846
 
45847
+ let contentType;
45848
+
44492
45849
  if (utils.isFormData(requestData)) {
44493
- delete requestHeaders['Content-Type']; // Let the browser set it
45850
+ if ((contentType = requestHeaders.getContentType()) !== false) {
45851
+ // fix semicolon duplication issue for ReactNative FormData implementation
45852
+ const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
45853
+ requestHeaders.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
45854
+ }
44494
45855
  }
44495
45856
 
44496
- var request = new XMLHttpRequest();
45857
+ let request = new XMLHttpRequest();
44497
45858
 
44498
45859
  // HTTP basic authentication
44499
45860
  if (config.auth) {
44500
- var username = config.auth.username || '';
44501
- var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
44502
- requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
45861
+ const username = config.auth.username || '';
45862
+ const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
45863
+ requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
44503
45864
  }
44504
45865
 
44505
- var fullPath = buildFullPath(config.baseURL, config.url);
45866
+ const fullPath = buildFullPath(config.baseURL, config.url);
45867
+
44506
45868
  request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
44507
45869
 
44508
45870
  // Set the request timeout in MS
@@ -44513,16 +45875,18 @@ var xhr = function xhrAdapter(config) {
44513
45875
  return;
44514
45876
  }
44515
45877
  // Prepare the response
44516
- var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
44517
- var responseData = !responseType || responseType === 'text' || responseType === 'json' ?
45878
+ const responseHeaders = AxiosHeaders.from(
45879
+ 'getAllResponseHeaders' in request && request.getAllResponseHeaders()
45880
+ );
45881
+ const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
44518
45882
  request.responseText : request.response;
44519
- var response = {
45883
+ const response = {
44520
45884
  data: responseData,
44521
45885
  status: request.status,
44522
45886
  statusText: request.statusText,
44523
45887
  headers: responseHeaders,
44524
- config: config,
44525
- request: request
45888
+ config,
45889
+ request
44526
45890
  };
44527
45891
 
44528
45892
  settle(function _resolve(value) {
@@ -44566,7 +45930,7 @@ var xhr = function xhrAdapter(config) {
44566
45930
  return;
44567
45931
  }
44568
45932
 
44569
- reject(createError('Request aborted', config, 'ECONNABORTED', request));
45933
+ reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
44570
45934
 
44571
45935
  // Clean up request
44572
45936
  request = null;
@@ -44576,7 +45940,7 @@ var xhr = function xhrAdapter(config) {
44576
45940
  request.onerror = function handleError() {
44577
45941
  // Real errors are hidden from us by the browser
44578
45942
  // onerror should only fire if it's a network error
44579
- reject(createError('Network Error', config, null, request));
45943
+ reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
44580
45944
 
44581
45945
  // Clean up request
44582
45946
  request = null;
@@ -44584,45 +45948,28 @@ var xhr = function xhrAdapter(config) {
44584
45948
 
44585
45949
  // Handle timeout
44586
45950
  request.ontimeout = function handleTimeout() {
44587
- var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
44588
- var transitional = config.transitional || defaults_1.transitional;
45951
+ let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
45952
+ const transitional = config.transitional || transitionalDefaults;
44589
45953
  if (config.timeoutErrorMessage) {
44590
45954
  timeoutErrorMessage = config.timeoutErrorMessage;
44591
45955
  }
44592
- reject(createError(
45956
+ reject(new AxiosError(
44593
45957
  timeoutErrorMessage,
45958
+ transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
44594
45959
  config,
44595
- transitional.clarifyTimeoutError ? 'ETIMEDOUT' : 'ECONNABORTED',
44596
45960
  request));
44597
45961
 
44598
45962
  // Clean up request
44599
45963
  request = null;
44600
45964
  };
44601
45965
 
44602
- // Add xsrf header
44603
- // This is only done if running in a standard browser environment.
44604
- // Specifically not if we're in a web worker, or react-native.
44605
- if (utils.isStandardBrowserEnv()) {
44606
- // Add xsrf header
44607
- var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
44608
- cookies.read(config.xsrfCookieName) :
44609
- undefined;
44610
-
44611
- if (xsrfValue) {
44612
- requestHeaders[config.xsrfHeaderName] = xsrfValue;
44613
- }
44614
- }
45966
+ // Remove Content-Type if data is undefined
45967
+ requestData === undefined && requestHeaders.setContentType(null);
44615
45968
 
44616
45969
  // Add headers to the request
44617
45970
  if ('setRequestHeader' in request) {
44618
- utils.forEach(requestHeaders, function setRequestHeader(val, key) {
44619
- if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
44620
- // Remove Content-Type if data is undefined
44621
- delete requestHeaders[key];
44622
- } else {
44623
- // Otherwise add header to the request
44624
- request.setRequestHeader(key, val);
44625
- }
45971
+ utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
45972
+ request.setRequestHeader(key, val);
44626
45973
  });
44627
45974
  }
44628
45975
 
@@ -44638,22 +45985,22 @@ var xhr = function xhrAdapter(config) {
44638
45985
 
44639
45986
  // Handle progress if needed
44640
45987
  if (typeof config.onDownloadProgress === 'function') {
44641
- request.addEventListener('progress', config.onDownloadProgress);
45988
+ request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
44642
45989
  }
44643
45990
 
44644
45991
  // Not all browsers support upload events
44645
45992
  if (typeof config.onUploadProgress === 'function' && request.upload) {
44646
- request.upload.addEventListener('progress', config.onUploadProgress);
45993
+ request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
44647
45994
  }
44648
45995
 
44649
45996
  if (config.cancelToken || config.signal) {
44650
45997
  // Handle cancellation
44651
45998
  // eslint-disable-next-line func-names
44652
- onCanceled = function(cancel) {
45999
+ onCanceled = cancel => {
44653
46000
  if (!request) {
44654
46001
  return;
44655
46002
  }
44656
- reject(!cancel || (cancel && cancel.type) ? new Cancel_1('canceled') : cancel);
46003
+ reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
44657
46004
  request.abort();
44658
46005
  request = null;
44659
46006
  };
@@ -44664,168 +46011,98 @@ var xhr = function xhrAdapter(config) {
44664
46011
  }
44665
46012
  }
44666
46013
 
44667
- if (!requestData) {
44668
- requestData = null;
46014
+ const protocol = parseProtocol(fullPath);
46015
+
46016
+ if (protocol && platform$1.protocols.indexOf(protocol) === -1) {
46017
+ reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
46018
+ return;
44669
46019
  }
44670
46020
 
46021
+
44671
46022
  // Send the request
44672
- request.send(requestData);
46023
+ request.send(requestData || null);
44673
46024
  });
44674
46025
  };
44675
46026
 
44676
- var DEFAULT_CONTENT_TYPE = {
44677
- 'Content-Type': 'application/x-www-form-urlencoded'
46027
+ const knownAdapters = {
46028
+ http: httpAdapter,
46029
+ xhr: xhrAdapter
44678
46030
  };
44679
46031
 
44680
- function setContentTypeIfUnset(headers, value) {
44681
- if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
44682
- headers['Content-Type'] = value;
44683
- }
44684
- }
44685
-
44686
- function getDefaultAdapter() {
44687
- var adapter;
44688
- if (typeof XMLHttpRequest !== 'undefined') {
44689
- // For browsers use XHR adapter
44690
- adapter = xhr;
44691
- } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
44692
- // For node use HTTP adapter
44693
- adapter = xhr;
44694
- }
44695
- return adapter;
44696
- }
44697
-
44698
- function stringifySafely(rawValue, parser, encoder) {
44699
- if (utils.isString(rawValue)) {
46032
+ utils.forEach(knownAdapters, (fn, value) => {
46033
+ if (fn) {
44700
46034
  try {
44701
- (parser || JSON.parse)(rawValue);
44702
- return utils.trim(rawValue);
46035
+ Object.defineProperty(fn, 'name', {value});
44703
46036
  } catch (e) {
44704
- if (e.name !== 'SyntaxError') {
44705
- throw e;
44706
- }
46037
+ // eslint-disable-next-line no-empty
44707
46038
  }
46039
+ Object.defineProperty(fn, 'adapterName', {value});
44708
46040
  }
46041
+ });
44709
46042
 
44710
- return (encoder || JSON.stringify)(rawValue);
44711
- }
44712
-
44713
- var defaults = {
44714
-
44715
- transitional: {
44716
- silentJSONParsing: true,
44717
- forcedJSONParsing: true,
44718
- clarifyTimeoutError: false
44719
- },
44720
-
44721
- adapter: getDefaultAdapter(),
44722
-
44723
- transformRequest: [function transformRequest(data, headers) {
44724
- normalizeHeaderName(headers, 'Accept');
44725
- normalizeHeaderName(headers, 'Content-Type');
44726
-
44727
- if (utils.isFormData(data) ||
44728
- utils.isArrayBuffer(data) ||
44729
- utils.isBuffer(data) ||
44730
- utils.isStream(data) ||
44731
- utils.isFile(data) ||
44732
- utils.isBlob(data)
44733
- ) {
44734
- return data;
44735
- }
44736
- if (utils.isArrayBufferView(data)) {
44737
- return data.buffer;
44738
- }
44739
- if (utils.isURLSearchParams(data)) {
44740
- setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
44741
- return data.toString();
44742
- }
44743
- if (utils.isObject(data) || (headers && headers['Content-Type'] === 'application/json')) {
44744
- setContentTypeIfUnset(headers, 'application/json');
44745
- return stringifySafely(data);
44746
- }
44747
- return data;
44748
- }],
44749
-
44750
- transformResponse: [function transformResponse(data) {
44751
- var transitional = this.transitional || defaults.transitional;
44752
- var silentJSONParsing = transitional && transitional.silentJSONParsing;
44753
- var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
44754
- var strictJSONParsing = !silentJSONParsing && this.responseType === 'json';
44755
-
44756
- if (strictJSONParsing || (forcedJSONParsing && utils.isString(data) && data.length)) {
44757
- try {
44758
- return JSON.parse(data);
44759
- } catch (e) {
44760
- if (strictJSONParsing) {
44761
- if (e.name === 'SyntaxError') {
44762
- throw enhanceError(e, this, 'E_JSON_PARSE');
44763
- }
44764
- throw e;
44765
- }
44766
- }
44767
- }
46043
+ const renderReason = (reason) => `- ${reason}`;
44768
46044
 
44769
- return data;
44770
- }],
46045
+ const isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;
44771
46046
 
44772
- /**
44773
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
44774
- * timeout is not created.
44775
- */
44776
- timeout: 0,
46047
+ var adapters = {
46048
+ getAdapter: (adapters) => {
46049
+ adapters = utils.isArray(adapters) ? adapters : [adapters];
44777
46050
 
44778
- xsrfCookieName: 'XSRF-TOKEN',
44779
- xsrfHeaderName: 'X-XSRF-TOKEN',
46051
+ const {length} = adapters;
46052
+ let nameOrAdapter;
46053
+ let adapter;
44780
46054
 
44781
- maxContentLength: -1,
44782
- maxBodyLength: -1,
46055
+ const rejectedReasons = {};
44783
46056
 
44784
- validateStatus: function validateStatus(status) {
44785
- return status >= 200 && status < 300;
44786
- },
46057
+ for (let i = 0; i < length; i++) {
46058
+ nameOrAdapter = adapters[i];
46059
+ let id;
44787
46060
 
44788
- headers: {
44789
- common: {
44790
- 'Accept': 'application/json, text/plain, */*'
44791
- }
44792
- }
44793
- };
46061
+ adapter = nameOrAdapter;
44794
46062
 
44795
- utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
44796
- defaults.headers[method] = {};
44797
- });
46063
+ if (!isResolvedHandle(nameOrAdapter)) {
46064
+ adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
44798
46065
 
44799
- utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
44800
- defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
44801
- });
46066
+ if (adapter === undefined) {
46067
+ throw new AxiosError(`Unknown adapter '${id}'`);
46068
+ }
46069
+ }
44802
46070
 
44803
- var defaults_1 = defaults;
46071
+ if (adapter) {
46072
+ break;
46073
+ }
44804
46074
 
44805
- /**
44806
- * Transform the data for a request or a response
44807
- *
44808
- * @param {Object|String} data The data to be transformed
44809
- * @param {Array} headers The headers for the request or response
44810
- * @param {Array|Function} fns A single function or Array of functions
44811
- * @returns {*} The resulting transformed data
44812
- */
44813
- var transformData = function transformData(data, headers, fns) {
44814
- var context = this || defaults_1;
44815
- /*eslint no-param-reassign:0*/
44816
- utils.forEach(fns, function transform(fn) {
44817
- data = fn.call(context, data, headers);
44818
- });
46075
+ rejectedReasons[id || '#' + i] = adapter;
46076
+ }
44819
46077
 
44820
- return data;
44821
- };
46078
+ if (!adapter) {
44822
46079
 
44823
- var isCancel = function isCancel(value) {
44824
- return !!(value && value.__CANCEL__);
46080
+ const reasons = Object.entries(rejectedReasons)
46081
+ .map(([id, state]) => `adapter ${id} ` +
46082
+ (state === false ? 'is not supported by the environment' : 'is not available in the build')
46083
+ );
46084
+
46085
+ let s = length ?
46086
+ (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
46087
+ 'as no adapter specified';
46088
+
46089
+ throw new AxiosError(
46090
+ `There is no suitable adapter to dispatch the request ` + s,
46091
+ 'ERR_NOT_SUPPORT'
46092
+ );
46093
+ }
46094
+
46095
+ return adapter;
46096
+ },
46097
+ adapters: knownAdapters
44825
46098
  };
44826
46099
 
44827
46100
  /**
44828
- * Throws a `Cancel` if cancellation has been requested.
46101
+ * Throws a `CanceledError` if cancellation has been requested.
46102
+ *
46103
+ * @param {Object} config The config that is to be used for the request
46104
+ *
46105
+ * @returns {void}
44829
46106
  */
44830
46107
  function throwIfCancellationRequested(config) {
44831
46108
  if (config.cancelToken) {
@@ -44833,7 +46110,7 @@ function throwIfCancellationRequested(config) {
44833
46110
  }
44834
46111
 
44835
46112
  if (config.signal && config.signal.aborted) {
44836
- throw new Cancel_1('canceled');
46113
+ throw new CanceledError(null, config);
44837
46114
  }
44838
46115
  }
44839
46116
 
@@ -44841,37 +46118,25 @@ function throwIfCancellationRequested(config) {
44841
46118
  * Dispatch a request to the server using the configured adapter.
44842
46119
  *
44843
46120
  * @param {object} config The config that is to be used for the request
46121
+ *
44844
46122
  * @returns {Promise} The Promise to be fulfilled
44845
46123
  */
44846
- var dispatchRequest = function dispatchRequest(config) {
46124
+ function dispatchRequest(config) {
44847
46125
  throwIfCancellationRequested(config);
44848
46126
 
44849
- // Ensure headers exist
44850
- config.headers = config.headers || {};
46127
+ config.headers = AxiosHeaders.from(config.headers);
44851
46128
 
44852
46129
  // Transform request data
44853
46130
  config.data = transformData.call(
44854
46131
  config,
44855
- config.data,
44856
- config.headers,
44857
46132
  config.transformRequest
44858
46133
  );
44859
46134
 
44860
- // Flatten headers
44861
- config.headers = utils.merge(
44862
- config.headers.common || {},
44863
- config.headers[config.method] || {},
44864
- config.headers
44865
- );
44866
-
44867
- utils.forEach(
44868
- ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
44869
- function cleanHeaderConfig(method) {
44870
- delete config.headers[method];
44871
- }
44872
- );
46135
+ if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
46136
+ config.headers.setContentType('application/x-www-form-urlencoded', false);
46137
+ }
44873
46138
 
44874
- var adapter = config.adapter || defaults_1.adapter;
46139
+ const adapter = adapters.getAdapter(config.adapter || defaults.adapter);
44875
46140
 
44876
46141
  return adapter(config).then(function onAdapterResolution(response) {
44877
46142
  throwIfCancellationRequested(config);
@@ -44879,11 +46144,12 @@ var dispatchRequest = function dispatchRequest(config) {
44879
46144
  // Transform response data
44880
46145
  response.data = transformData.call(
44881
46146
  config,
44882
- response.data,
44883
- response.headers,
44884
- config.transformResponse
46147
+ config.transformResponse,
46148
+ response
44885
46149
  );
44886
46150
 
46151
+ response.headers = AxiosHeaders.from(response.headers);
46152
+
44887
46153
  return response;
44888
46154
  }, function onAdapterRejection(reason) {
44889
46155
  if (!isCancel(reason)) {
@@ -44893,16 +46159,18 @@ var dispatchRequest = function dispatchRequest(config) {
44893
46159
  if (reason && reason.response) {
44894
46160
  reason.response.data = transformData.call(
44895
46161
  config,
44896
- reason.response.data,
44897
- reason.response.headers,
44898
- config.transformResponse
46162
+ config.transformResponse,
46163
+ reason.response
44899
46164
  );
46165
+ reason.response.headers = AxiosHeaders.from(reason.response.headers);
44900
46166
  }
44901
46167
  }
44902
46168
 
44903
46169
  return Promise.reject(reason);
44904
46170
  });
44905
- };
46171
+ }
46172
+
46173
+ const headersToObject = (thing) => thing instanceof AxiosHeaders ? thing.toJSON() : thing;
44906
46174
 
44907
46175
  /**
44908
46176
  * Config-specific merge-function which creates a new config-object
@@ -44910,16 +46178,17 @@ var dispatchRequest = function dispatchRequest(config) {
44910
46178
  *
44911
46179
  * @param {Object} config1
44912
46180
  * @param {Object} config2
46181
+ *
44913
46182
  * @returns {Object} New object resulting from merging config2 to config1
44914
46183
  */
44915
- var mergeConfig = function mergeConfig(config1, config2) {
46184
+ function mergeConfig(config1, config2) {
44916
46185
  // eslint-disable-next-line no-param-reassign
44917
46186
  config2 = config2 || {};
44918
- var config = {};
46187
+ const config = {};
44919
46188
 
44920
- function getMergedValue(target, source) {
46189
+ function getMergedValue(target, source, caseless) {
44921
46190
  if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
44922
- return utils.merge(target, source);
46191
+ return utils.merge.call({caseless}, target, source);
44923
46192
  } else if (utils.isPlainObject(source)) {
44924
46193
  return utils.merge({}, source);
44925
46194
  } else if (utils.isArray(source)) {
@@ -44929,99 +46198,100 @@ var mergeConfig = function mergeConfig(config1, config2) {
44929
46198
  }
44930
46199
 
44931
46200
  // eslint-disable-next-line consistent-return
44932
- function mergeDeepProperties(prop) {
44933
- if (!utils.isUndefined(config2[prop])) {
44934
- return getMergedValue(config1[prop], config2[prop]);
44935
- } else if (!utils.isUndefined(config1[prop])) {
44936
- return getMergedValue(undefined, config1[prop]);
46201
+ function mergeDeepProperties(a, b, caseless) {
46202
+ if (!utils.isUndefined(b)) {
46203
+ return getMergedValue(a, b, caseless);
46204
+ } else if (!utils.isUndefined(a)) {
46205
+ return getMergedValue(undefined, a, caseless);
44937
46206
  }
44938
46207
  }
44939
46208
 
44940
46209
  // eslint-disable-next-line consistent-return
44941
- function valueFromConfig2(prop) {
44942
- if (!utils.isUndefined(config2[prop])) {
44943
- return getMergedValue(undefined, config2[prop]);
46210
+ function valueFromConfig2(a, b) {
46211
+ if (!utils.isUndefined(b)) {
46212
+ return getMergedValue(undefined, b);
44944
46213
  }
44945
46214
  }
44946
46215
 
44947
46216
  // eslint-disable-next-line consistent-return
44948
- function defaultToConfig2(prop) {
44949
- if (!utils.isUndefined(config2[prop])) {
44950
- return getMergedValue(undefined, config2[prop]);
44951
- } else if (!utils.isUndefined(config1[prop])) {
44952
- return getMergedValue(undefined, config1[prop]);
46217
+ function defaultToConfig2(a, b) {
46218
+ if (!utils.isUndefined(b)) {
46219
+ return getMergedValue(undefined, b);
46220
+ } else if (!utils.isUndefined(a)) {
46221
+ return getMergedValue(undefined, a);
44953
46222
  }
44954
46223
  }
44955
46224
 
44956
46225
  // eslint-disable-next-line consistent-return
44957
- function mergeDirectKeys(prop) {
46226
+ function mergeDirectKeys(a, b, prop) {
44958
46227
  if (prop in config2) {
44959
- return getMergedValue(config1[prop], config2[prop]);
46228
+ return getMergedValue(a, b);
44960
46229
  } else if (prop in config1) {
44961
- return getMergedValue(undefined, config1[prop]);
46230
+ return getMergedValue(undefined, a);
44962
46231
  }
44963
46232
  }
44964
46233
 
44965
- var mergeMap = {
44966
- 'url': valueFromConfig2,
44967
- 'method': valueFromConfig2,
44968
- 'data': valueFromConfig2,
44969
- 'baseURL': defaultToConfig2,
44970
- 'transformRequest': defaultToConfig2,
44971
- 'transformResponse': defaultToConfig2,
44972
- 'paramsSerializer': defaultToConfig2,
44973
- 'timeout': defaultToConfig2,
44974
- 'timeoutMessage': defaultToConfig2,
44975
- 'withCredentials': defaultToConfig2,
44976
- 'adapter': defaultToConfig2,
44977
- 'responseType': defaultToConfig2,
44978
- 'xsrfCookieName': defaultToConfig2,
44979
- 'xsrfHeaderName': defaultToConfig2,
44980
- 'onUploadProgress': defaultToConfig2,
44981
- 'onDownloadProgress': defaultToConfig2,
44982
- 'decompress': defaultToConfig2,
44983
- 'maxContentLength': defaultToConfig2,
44984
- 'maxBodyLength': defaultToConfig2,
44985
- 'transport': defaultToConfig2,
44986
- 'httpAgent': defaultToConfig2,
44987
- 'httpsAgent': defaultToConfig2,
44988
- 'cancelToken': defaultToConfig2,
44989
- 'socketPath': defaultToConfig2,
44990
- 'responseEncoding': defaultToConfig2,
44991
- 'validateStatus': mergeDirectKeys
46234
+ const mergeMap = {
46235
+ url: valueFromConfig2,
46236
+ method: valueFromConfig2,
46237
+ data: valueFromConfig2,
46238
+ baseURL: defaultToConfig2,
46239
+ transformRequest: defaultToConfig2,
46240
+ transformResponse: defaultToConfig2,
46241
+ paramsSerializer: defaultToConfig2,
46242
+ timeout: defaultToConfig2,
46243
+ timeoutMessage: defaultToConfig2,
46244
+ withCredentials: defaultToConfig2,
46245
+ withXSRFToken: defaultToConfig2,
46246
+ adapter: defaultToConfig2,
46247
+ responseType: defaultToConfig2,
46248
+ xsrfCookieName: defaultToConfig2,
46249
+ xsrfHeaderName: defaultToConfig2,
46250
+ onUploadProgress: defaultToConfig2,
46251
+ onDownloadProgress: defaultToConfig2,
46252
+ decompress: defaultToConfig2,
46253
+ maxContentLength: defaultToConfig2,
46254
+ maxBodyLength: defaultToConfig2,
46255
+ beforeRedirect: defaultToConfig2,
46256
+ transport: defaultToConfig2,
46257
+ httpAgent: defaultToConfig2,
46258
+ httpsAgent: defaultToConfig2,
46259
+ cancelToken: defaultToConfig2,
46260
+ socketPath: defaultToConfig2,
46261
+ responseEncoding: defaultToConfig2,
46262
+ validateStatus: mergeDirectKeys,
46263
+ headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
44992
46264
  };
44993
46265
 
44994
- utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
44995
- var merge = mergeMap[prop] || mergeDeepProperties;
44996
- var configValue = merge(prop);
46266
+ utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
46267
+ const merge = mergeMap[prop] || mergeDeepProperties;
46268
+ const configValue = merge(config1[prop], config2[prop], prop);
44997
46269
  (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
44998
46270
  });
44999
46271
 
45000
46272
  return config;
45001
- };
45002
-
45003
- var data = {
45004
- "version": "0.25.0"
45005
- };
46273
+ }
45006
46274
 
45007
- var VERSION = data.version;
46275
+ const VERSION = "1.6.2";
45008
46276
 
45009
- var validators = {};
46277
+ const validators = {};
45010
46278
 
45011
46279
  // eslint-disable-next-line func-names
45012
- ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function(type, i) {
46280
+ ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {
45013
46281
  validators[type] = function validator(thing) {
45014
46282
  return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
45015
46283
  };
45016
46284
  });
45017
46285
 
45018
- var deprecatedWarnings = {};
46286
+ const deprecatedWarnings = {};
45019
46287
 
45020
46288
  /**
45021
46289
  * Transitional option validator
46290
+ *
45022
46291
  * @param {function|boolean?} validator - set to false if the transitional option has been removed
45023
46292
  * @param {string?} version - deprecated version / removed since version
45024
46293
  * @param {string?} message - some message with additional info
46294
+ *
45025
46295
  * @returns {function}
45026
46296
  */
45027
46297
  validators.transitional = function transitional(validator, version, message) {
@@ -45030,9 +46300,12 @@ validators.transitional = function transitional(validator, version, message) {
45030
46300
  }
45031
46301
 
45032
46302
  // eslint-disable-next-line func-names
45033
- return function(value, opt, opts) {
46303
+ return (value, opt, opts) => {
45034
46304
  if (validator === false) {
45035
- throw new Error(formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')));
46305
+ throw new AxiosError(
46306
+ formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
46307
+ AxiosError.ERR_DEPRECATED
46308
+ );
45036
46309
  }
45037
46310
 
45038
46311
  if (version && !deprecatedWarnings[opt]) {
@@ -45052,168 +46325,205 @@ validators.transitional = function transitional(validator, version, message) {
45052
46325
 
45053
46326
  /**
45054
46327
  * Assert object's properties type
46328
+ *
45055
46329
  * @param {object} options
45056
46330
  * @param {object} schema
45057
46331
  * @param {boolean?} allowUnknown
46332
+ *
46333
+ * @returns {object}
45058
46334
  */
45059
46335
 
45060
46336
  function assertOptions(options, schema, allowUnknown) {
45061
46337
  if (typeof options !== 'object') {
45062
- throw new TypeError('options must be an object');
46338
+ throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
45063
46339
  }
45064
- var keys = Object.keys(options);
45065
- var i = keys.length;
46340
+ const keys = Object.keys(options);
46341
+ let i = keys.length;
45066
46342
  while (i-- > 0) {
45067
- var opt = keys[i];
45068
- var validator = schema[opt];
46343
+ const opt = keys[i];
46344
+ const validator = schema[opt];
45069
46345
  if (validator) {
45070
- var value = options[opt];
45071
- var result = value === undefined || validator(value, opt, options);
46346
+ const value = options[opt];
46347
+ const result = value === undefined || validator(value, opt, options);
45072
46348
  if (result !== true) {
45073
- throw new TypeError('option ' + opt + ' must be ' + result);
46349
+ throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
45074
46350
  }
45075
46351
  continue;
45076
46352
  }
45077
46353
  if (allowUnknown !== true) {
45078
- throw Error('Unknown option ' + opt);
46354
+ throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
45079
46355
  }
45080
46356
  }
45081
46357
  }
45082
46358
 
45083
46359
  var validator = {
45084
- assertOptions: assertOptions,
45085
- validators: validators
46360
+ assertOptions,
46361
+ validators
45086
46362
  };
45087
46363
 
45088
- var validators$1 = validator.validators;
46364
+ const validators$1 = validator.validators;
46365
+
45089
46366
  /**
45090
46367
  * Create a new instance of Axios
45091
46368
  *
45092
46369
  * @param {Object} instanceConfig The default config for the instance
45093
- */
45094
- function Axios(instanceConfig) {
45095
- this.defaults = instanceConfig;
45096
- this.interceptors = {
45097
- request: new InterceptorManager_1(),
45098
- response: new InterceptorManager_1()
45099
- };
45100
- }
45101
-
45102
- /**
45103
- * Dispatch a request
45104
46370
  *
45105
- * @param {Object} config The config specific for this request (merged with this.defaults)
46371
+ * @return {Axios} A new instance of Axios
45106
46372
  */
45107
- Axios.prototype.request = function request(configOrUrl, config) {
45108
- /*eslint no-param-reassign:0*/
45109
- // Allow for axios('example/url'[, config]) a la fetch API
45110
- if (typeof configOrUrl === 'string') {
45111
- config = config || {};
45112
- config.url = configOrUrl;
45113
- } else {
45114
- config = configOrUrl || {};
45115
- }
45116
-
45117
- if (!config.url) {
45118
- throw new Error('Provided config url is not valid');
46373
+ class Axios {
46374
+ constructor(instanceConfig) {
46375
+ this.defaults = instanceConfig;
46376
+ this.interceptors = {
46377
+ request: new InterceptorManager(),
46378
+ response: new InterceptorManager()
46379
+ };
45119
46380
  }
45120
46381
 
45121
- config = mergeConfig(this.defaults, config);
46382
+ /**
46383
+ * Dispatch a request
46384
+ *
46385
+ * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
46386
+ * @param {?Object} config
46387
+ *
46388
+ * @returns {Promise} The Promise to be fulfilled
46389
+ */
46390
+ request(configOrUrl, config) {
46391
+ /*eslint no-param-reassign:0*/
46392
+ // Allow for axios('example/url'[, config]) a la fetch API
46393
+ if (typeof configOrUrl === 'string') {
46394
+ config = config || {};
46395
+ config.url = configOrUrl;
46396
+ } else {
46397
+ config = configOrUrl || {};
46398
+ }
45122
46399
 
45123
- // Set config.method
45124
- if (config.method) {
45125
- config.method = config.method.toLowerCase();
45126
- } else if (this.defaults.method) {
45127
- config.method = this.defaults.method.toLowerCase();
45128
- } else {
45129
- config.method = 'get';
45130
- }
46400
+ config = mergeConfig(this.defaults, config);
45131
46401
 
45132
- var transitional = config.transitional;
46402
+ const {transitional, paramsSerializer, headers} = config;
45133
46403
 
45134
- if (transitional !== undefined) {
45135
- validator.assertOptions(transitional, {
45136
- silentJSONParsing: validators$1.transitional(validators$1.boolean),
45137
- forcedJSONParsing: validators$1.transitional(validators$1.boolean),
45138
- clarifyTimeoutError: validators$1.transitional(validators$1.boolean)
45139
- }, false);
45140
- }
46404
+ if (transitional !== undefined) {
46405
+ validator.assertOptions(transitional, {
46406
+ silentJSONParsing: validators$1.transitional(validators$1.boolean),
46407
+ forcedJSONParsing: validators$1.transitional(validators$1.boolean),
46408
+ clarifyTimeoutError: validators$1.transitional(validators$1.boolean)
46409
+ }, false);
46410
+ }
45141
46411
 
45142
- // filter out skipped interceptors
45143
- var requestInterceptorChain = [];
45144
- var synchronousRequestInterceptors = true;
45145
- this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
45146
- if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
45147
- return;
46412
+ if (paramsSerializer != null) {
46413
+ if (utils.isFunction(paramsSerializer)) {
46414
+ config.paramsSerializer = {
46415
+ serialize: paramsSerializer
46416
+ };
46417
+ } else {
46418
+ validator.assertOptions(paramsSerializer, {
46419
+ encode: validators$1.function,
46420
+ serialize: validators$1.function
46421
+ }, true);
46422
+ }
45148
46423
  }
45149
46424
 
45150
- synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
46425
+ // Set config.method
46426
+ config.method = (config.method || this.defaults.method || 'get').toLowerCase();
45151
46427
 
45152
- requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
45153
- });
46428
+ // Flatten headers
46429
+ let contextHeaders = headers && utils.merge(
46430
+ headers.common,
46431
+ headers[config.method]
46432
+ );
45154
46433
 
45155
- var responseInterceptorChain = [];
45156
- this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
45157
- responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
45158
- });
46434
+ headers && utils.forEach(
46435
+ ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
46436
+ (method) => {
46437
+ delete headers[method];
46438
+ }
46439
+ );
46440
+
46441
+ config.headers = AxiosHeaders.concat(contextHeaders, headers);
46442
+
46443
+ // filter out skipped interceptors
46444
+ const requestInterceptorChain = [];
46445
+ let synchronousRequestInterceptors = true;
46446
+ this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
46447
+ if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
46448
+ return;
46449
+ }
46450
+
46451
+ synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
45159
46452
 
45160
- var promise;
46453
+ requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
46454
+ });
46455
+
46456
+ const responseInterceptorChain = [];
46457
+ this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
46458
+ responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
46459
+ });
46460
+
46461
+ let promise;
46462
+ let i = 0;
46463
+ let len;
46464
+
46465
+ if (!synchronousRequestInterceptors) {
46466
+ const chain = [dispatchRequest.bind(this), undefined];
46467
+ chain.unshift.apply(chain, requestInterceptorChain);
46468
+ chain.push.apply(chain, responseInterceptorChain);
46469
+ len = chain.length;
45161
46470
 
45162
- if (!synchronousRequestInterceptors) {
45163
- var chain = [dispatchRequest, undefined];
46471
+ promise = Promise.resolve(config);
45164
46472
 
45165
- Array.prototype.unshift.apply(chain, requestInterceptorChain);
45166
- chain = chain.concat(responseInterceptorChain);
46473
+ while (i < len) {
46474
+ promise = promise.then(chain[i++], chain[i++]);
46475
+ }
45167
46476
 
45168
- promise = Promise.resolve(config);
45169
- while (chain.length) {
45170
- promise = promise.then(chain.shift(), chain.shift());
46477
+ return promise;
45171
46478
  }
45172
46479
 
45173
- return promise;
45174
- }
46480
+ len = requestInterceptorChain.length;
46481
+
46482
+ let newConfig = config;
45175
46483
 
46484
+ i = 0;
46485
+
46486
+ while (i < len) {
46487
+ const onFulfilled = requestInterceptorChain[i++];
46488
+ const onRejected = requestInterceptorChain[i++];
46489
+ try {
46490
+ newConfig = onFulfilled(newConfig);
46491
+ } catch (error) {
46492
+ onRejected.call(this, error);
46493
+ break;
46494
+ }
46495
+ }
45176
46496
 
45177
- var newConfig = config;
45178
- while (requestInterceptorChain.length) {
45179
- var onFulfilled = requestInterceptorChain.shift();
45180
- var onRejected = requestInterceptorChain.shift();
45181
46497
  try {
45182
- newConfig = onFulfilled(newConfig);
46498
+ promise = dispatchRequest.call(this, newConfig);
45183
46499
  } catch (error) {
45184
- onRejected(error);
45185
- break;
46500
+ return Promise.reject(error);
45186
46501
  }
45187
- }
45188
46502
 
45189
- try {
45190
- promise = dispatchRequest(newConfig);
45191
- } catch (error) {
45192
- return Promise.reject(error);
45193
- }
46503
+ i = 0;
46504
+ len = responseInterceptorChain.length;
45194
46505
 
45195
- while (responseInterceptorChain.length) {
45196
- promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift());
45197
- }
46506
+ while (i < len) {
46507
+ promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
46508
+ }
45198
46509
 
45199
- return promise;
45200
- };
46510
+ return promise;
46511
+ }
45201
46512
 
45202
- Axios.prototype.getUri = function getUri(config) {
45203
- if (!config.url) {
45204
- throw new Error('Provided config url is not valid');
46513
+ getUri(config) {
46514
+ config = mergeConfig(this.defaults, config);
46515
+ const fullPath = buildFullPath(config.baseURL, config.url);
46516
+ return buildURL(fullPath, config.params, config.paramsSerializer);
45205
46517
  }
45206
- config = mergeConfig(this.defaults, config);
45207
- return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
45208
- };
46518
+ }
45209
46519
 
45210
46520
  // Provide aliases for supported request methods
45211
46521
  utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
45212
46522
  /*eslint func-names:0*/
45213
46523
  Axios.prototype[method] = function(url, config) {
45214
46524
  return this.request(mergeConfig(config || {}, {
45215
- method: method,
45216
- url: url,
46525
+ method,
46526
+ url,
45217
46527
  data: (config || {}).data
45218
46528
  }));
45219
46529
  };
@@ -45221,132 +46531,140 @@ utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData
45221
46531
 
45222
46532
  utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
45223
46533
  /*eslint func-names:0*/
45224
- Axios.prototype[method] = function(url, data, config) {
45225
- return this.request(mergeConfig(config || {}, {
45226
- method: method,
45227
- url: url,
45228
- data: data
45229
- }));
45230
- };
45231
- });
45232
46534
 
45233
- var Axios_1 = Axios;
46535
+ function generateHTTPMethod(isForm) {
46536
+ return function httpMethod(url, data, config) {
46537
+ return this.request(mergeConfig(config || {}, {
46538
+ method,
46539
+ headers: isForm ? {
46540
+ 'Content-Type': 'multipart/form-data'
46541
+ } : {},
46542
+ url,
46543
+ data
46544
+ }));
46545
+ };
46546
+ }
46547
+
46548
+ Axios.prototype[method] = generateHTTPMethod();
46549
+
46550
+ Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
46551
+ });
45234
46552
 
45235
46553
  /**
45236
46554
  * A `CancelToken` is an object that can be used to request cancellation of an operation.
45237
46555
  *
45238
- * @class
45239
46556
  * @param {Function} executor The executor function.
46557
+ *
46558
+ * @returns {CancelToken}
45240
46559
  */
45241
- function CancelToken(executor) {
45242
- if (typeof executor !== 'function') {
45243
- throw new TypeError('executor must be a function.');
45244
- }
46560
+ class CancelToken {
46561
+ constructor(executor) {
46562
+ if (typeof executor !== 'function') {
46563
+ throw new TypeError('executor must be a function.');
46564
+ }
45245
46565
 
45246
- var resolvePromise;
46566
+ let resolvePromise;
45247
46567
 
45248
- this.promise = new Promise(function promiseExecutor(resolve) {
45249
- resolvePromise = resolve;
45250
- });
46568
+ this.promise = new Promise(function promiseExecutor(resolve) {
46569
+ resolvePromise = resolve;
46570
+ });
45251
46571
 
45252
- var token = this;
46572
+ const token = this;
45253
46573
 
45254
- // eslint-disable-next-line func-names
45255
- this.promise.then(function(cancel) {
45256
- if (!token._listeners) return;
46574
+ // eslint-disable-next-line func-names
46575
+ this.promise.then(cancel => {
46576
+ if (!token._listeners) return;
45257
46577
 
45258
- var i;
45259
- var l = token._listeners.length;
46578
+ let i = token._listeners.length;
45260
46579
 
45261
- for (i = 0; i < l; i++) {
45262
- token._listeners[i](cancel);
45263
- }
45264
- token._listeners = null;
45265
- });
46580
+ while (i-- > 0) {
46581
+ token._listeners[i](cancel);
46582
+ }
46583
+ token._listeners = null;
46584
+ });
45266
46585
 
45267
- // eslint-disable-next-line func-names
45268
- this.promise.then = function(onfulfilled) {
45269
- var _resolve;
45270
46586
  // eslint-disable-next-line func-names
45271
- var promise = new Promise(function(resolve) {
45272
- token.subscribe(resolve);
45273
- _resolve = resolve;
45274
- }).then(onfulfilled);
46587
+ this.promise.then = onfulfilled => {
46588
+ let _resolve;
46589
+ // eslint-disable-next-line func-names
46590
+ const promise = new Promise(resolve => {
46591
+ token.subscribe(resolve);
46592
+ _resolve = resolve;
46593
+ }).then(onfulfilled);
45275
46594
 
45276
- promise.cancel = function reject() {
45277
- token.unsubscribe(_resolve);
45278
- };
46595
+ promise.cancel = function reject() {
46596
+ token.unsubscribe(_resolve);
46597
+ };
45279
46598
 
45280
- return promise;
45281
- };
46599
+ return promise;
46600
+ };
45282
46601
 
45283
- executor(function cancel(message) {
45284
- if (token.reason) {
45285
- // Cancellation has already been requested
45286
- return;
45287
- }
46602
+ executor(function cancel(message, config, request) {
46603
+ if (token.reason) {
46604
+ // Cancellation has already been requested
46605
+ return;
46606
+ }
45288
46607
 
45289
- token.reason = new Cancel_1(message);
45290
- resolvePromise(token.reason);
45291
- });
45292
- }
46608
+ token.reason = new CanceledError(message, config, request);
46609
+ resolvePromise(token.reason);
46610
+ });
46611
+ }
45293
46612
 
45294
- /**
45295
- * Throws a `Cancel` if cancellation has been requested.
45296
- */
45297
- CancelToken.prototype.throwIfRequested = function throwIfRequested() {
45298
- if (this.reason) {
45299
- throw this.reason;
46613
+ /**
46614
+ * Throws a `CanceledError` if cancellation has been requested.
46615
+ */
46616
+ throwIfRequested() {
46617
+ if (this.reason) {
46618
+ throw this.reason;
46619
+ }
45300
46620
  }
45301
- };
45302
46621
 
45303
- /**
45304
- * Subscribe to the cancel signal
45305
- */
46622
+ /**
46623
+ * Subscribe to the cancel signal
46624
+ */
45306
46625
 
45307
- CancelToken.prototype.subscribe = function subscribe(listener) {
45308
- if (this.reason) {
45309
- listener(this.reason);
45310
- return;
45311
- }
46626
+ subscribe(listener) {
46627
+ if (this.reason) {
46628
+ listener(this.reason);
46629
+ return;
46630
+ }
45312
46631
 
45313
- if (this._listeners) {
45314
- this._listeners.push(listener);
45315
- } else {
45316
- this._listeners = [listener];
46632
+ if (this._listeners) {
46633
+ this._listeners.push(listener);
46634
+ } else {
46635
+ this._listeners = [listener];
46636
+ }
45317
46637
  }
45318
- };
45319
46638
 
45320
- /**
45321
- * Unsubscribe from the cancel signal
45322
- */
46639
+ /**
46640
+ * Unsubscribe from the cancel signal
46641
+ */
45323
46642
 
45324
- CancelToken.prototype.unsubscribe = function unsubscribe(listener) {
45325
- if (!this._listeners) {
45326
- return;
45327
- }
45328
- var index = this._listeners.indexOf(listener);
45329
- if (index !== -1) {
45330
- this._listeners.splice(index, 1);
46643
+ unsubscribe(listener) {
46644
+ if (!this._listeners) {
46645
+ return;
46646
+ }
46647
+ const index = this._listeners.indexOf(listener);
46648
+ if (index !== -1) {
46649
+ this._listeners.splice(index, 1);
46650
+ }
45331
46651
  }
45332
- };
45333
-
45334
- /**
45335
- * Returns an object that contains a new `CancelToken` and a function that, when called,
45336
- * cancels the `CancelToken`.
45337
- */
45338
- CancelToken.source = function source() {
45339
- var cancel;
45340
- var token = new CancelToken(function executor(c) {
45341
- cancel = c;
45342
- });
45343
- return {
45344
- token: token,
45345
- cancel: cancel
45346
- };
45347
- };
45348
46652
 
45349
- var CancelToken_1 = CancelToken;
46653
+ /**
46654
+ * Returns an object that contains a new `CancelToken` and a function that, when called,
46655
+ * cancels the `CancelToken`.
46656
+ */
46657
+ static source() {
46658
+ let cancel;
46659
+ const token = new CancelToken(function executor(c) {
46660
+ cancel = c;
46661
+ });
46662
+ return {
46663
+ token,
46664
+ cancel
46665
+ };
46666
+ }
46667
+ }
45350
46668
 
45351
46669
  /**
45352
46670
  * Syntactic sugar for invoking a function and expanding an array for arguments.
@@ -45366,39 +46684,112 @@ var CancelToken_1 = CancelToken;
45366
46684
  * ```
45367
46685
  *
45368
46686
  * @param {Function} callback
46687
+ *
45369
46688
  * @returns {Function}
45370
46689
  */
45371
- var spread = function spread(callback) {
46690
+ function spread(callback) {
45372
46691
  return function wrap(arr) {
45373
46692
  return callback.apply(null, arr);
45374
46693
  };
45375
- };
46694
+ }
45376
46695
 
45377
46696
  /**
45378
46697
  * Determines whether the payload is an error thrown by Axios
45379
46698
  *
45380
46699
  * @param {*} payload The value to test
46700
+ *
45381
46701
  * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
45382
46702
  */
45383
- var isAxiosError = function isAxiosError(payload) {
46703
+ function isAxiosError(payload) {
45384
46704
  return utils.isObject(payload) && (payload.isAxiosError === true);
46705
+ }
46706
+
46707
+ const HttpStatusCode = {
46708
+ Continue: 100,
46709
+ SwitchingProtocols: 101,
46710
+ Processing: 102,
46711
+ EarlyHints: 103,
46712
+ Ok: 200,
46713
+ Created: 201,
46714
+ Accepted: 202,
46715
+ NonAuthoritativeInformation: 203,
46716
+ NoContent: 204,
46717
+ ResetContent: 205,
46718
+ PartialContent: 206,
46719
+ MultiStatus: 207,
46720
+ AlreadyReported: 208,
46721
+ ImUsed: 226,
46722
+ MultipleChoices: 300,
46723
+ MovedPermanently: 301,
46724
+ Found: 302,
46725
+ SeeOther: 303,
46726
+ NotModified: 304,
46727
+ UseProxy: 305,
46728
+ Unused: 306,
46729
+ TemporaryRedirect: 307,
46730
+ PermanentRedirect: 308,
46731
+ BadRequest: 400,
46732
+ Unauthorized: 401,
46733
+ PaymentRequired: 402,
46734
+ Forbidden: 403,
46735
+ NotFound: 404,
46736
+ MethodNotAllowed: 405,
46737
+ NotAcceptable: 406,
46738
+ ProxyAuthenticationRequired: 407,
46739
+ RequestTimeout: 408,
46740
+ Conflict: 409,
46741
+ Gone: 410,
46742
+ LengthRequired: 411,
46743
+ PreconditionFailed: 412,
46744
+ PayloadTooLarge: 413,
46745
+ UriTooLong: 414,
46746
+ UnsupportedMediaType: 415,
46747
+ RangeNotSatisfiable: 416,
46748
+ ExpectationFailed: 417,
46749
+ ImATeapot: 418,
46750
+ MisdirectedRequest: 421,
46751
+ UnprocessableEntity: 422,
46752
+ Locked: 423,
46753
+ FailedDependency: 424,
46754
+ TooEarly: 425,
46755
+ UpgradeRequired: 426,
46756
+ PreconditionRequired: 428,
46757
+ TooManyRequests: 429,
46758
+ RequestHeaderFieldsTooLarge: 431,
46759
+ UnavailableForLegalReasons: 451,
46760
+ InternalServerError: 500,
46761
+ NotImplemented: 501,
46762
+ BadGateway: 502,
46763
+ ServiceUnavailable: 503,
46764
+ GatewayTimeout: 504,
46765
+ HttpVersionNotSupported: 505,
46766
+ VariantAlsoNegotiates: 506,
46767
+ InsufficientStorage: 507,
46768
+ LoopDetected: 508,
46769
+ NotExtended: 510,
46770
+ NetworkAuthenticationRequired: 511,
45385
46771
  };
45386
46772
 
46773
+ Object.entries(HttpStatusCode).forEach(([key, value]) => {
46774
+ HttpStatusCode[value] = key;
46775
+ });
46776
+
45387
46777
  /**
45388
46778
  * Create an instance of Axios
45389
46779
  *
45390
46780
  * @param {Object} defaultConfig The default config for the instance
45391
- * @return {Axios} A new instance of Axios
46781
+ *
46782
+ * @returns {Axios} A new instance of Axios
45392
46783
  */
45393
46784
  function createInstance(defaultConfig) {
45394
- var context = new Axios_1(defaultConfig);
45395
- var instance = bind$1(Axios_1.prototype.request, context);
46785
+ const context = new Axios(defaultConfig);
46786
+ const instance = bind$1(Axios.prototype.request, context);
45396
46787
 
45397
46788
  // Copy axios.prototype to instance
45398
- utils.extend(instance, Axios_1.prototype, context);
46789
+ utils.extend(instance, Axios.prototype, context, {allOwnKeys: true});
45399
46790
 
45400
46791
  // Copy context to instance
45401
- utils.extend(instance, context);
46792
+ utils.extend(instance, context, null, {allOwnKeys: true});
45402
46793
 
45403
46794
  // Factory for creating new instances
45404
46795
  instance.create = function create(instanceConfig) {
@@ -45409,33 +46800,46 @@ function createInstance(defaultConfig) {
45409
46800
  }
45410
46801
 
45411
46802
  // Create the default instance to be exported
45412
- var axios = createInstance(defaults_1);
46803
+ const axios = createInstance(defaults);
45413
46804
 
45414
46805
  // Expose Axios class to allow class inheritance
45415
- axios.Axios = Axios_1;
46806
+ axios.Axios = Axios;
45416
46807
 
45417
46808
  // Expose Cancel & CancelToken
45418
- axios.Cancel = Cancel_1;
45419
- axios.CancelToken = CancelToken_1;
46809
+ axios.CanceledError = CanceledError;
46810
+ axios.CancelToken = CancelToken;
45420
46811
  axios.isCancel = isCancel;
45421
- axios.VERSION = data.version;
46812
+ axios.VERSION = VERSION;
46813
+ axios.toFormData = toFormData;
46814
+
46815
+ // Expose AxiosError class
46816
+ axios.AxiosError = AxiosError;
46817
+
46818
+ // alias for CanceledError for backward compatibility
46819
+ axios.Cancel = axios.CanceledError;
45422
46820
 
45423
46821
  // Expose all/spread
45424
46822
  axios.all = function all(promises) {
45425
46823
  return Promise.all(promises);
45426
46824
  };
46825
+
45427
46826
  axios.spread = spread;
45428
46827
 
45429
46828
  // Expose isAxiosError
45430
46829
  axios.isAxiosError = isAxiosError;
45431
46830
 
45432
- var axios_1 = axios;
46831
+ // Expose mergeConfig
46832
+ axios.mergeConfig = mergeConfig;
46833
+
46834
+ axios.AxiosHeaders = AxiosHeaders;
46835
+
46836
+ axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
45433
46837
 
45434
- // Allow use of default import syntax in TypeScript
45435
- var default_1 = axios;
45436
- axios_1.default = default_1;
46838
+ axios.getAdapter = adapters.getAdapter;
45437
46839
 
45438
- var axios$1 = axios_1;
46840
+ axios.HttpStatusCode = HttpStatusCode;
46841
+
46842
+ axios.default = axios;
45439
46843
 
45440
46844
  const prodFunctionsBaseUrl = "https://us-central1-neurosity-device.cloudfunctions.net";
45441
46845
 
@@ -45451,7 +46855,7 @@ function getFunctionsBaseURL(sdkOptions) {
45451
46855
  function createOAuthURL(config, sdkOptions) {
45452
46856
  const { clientId, clientSecret, responseType, redirectUri, scope, state } = config;
45453
46857
  const baseUrl = getFunctionsBaseURL(sdkOptions);
45454
- return axios$1
46858
+ return axios
45455
46859
  .get(`${baseUrl}/authorize/entry`, {
45456
46860
  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" })
45457
46861
  })
@@ -45471,9 +46875,9 @@ function getOAuthToken(query, sdkOptions) {
45471
46875
  return __awaiter$a(this, void 0, void 0, function* () {
45472
46876
  const baseUrl = getFunctionsBaseURL(sdkOptions);
45473
46877
  // Get refresh token
45474
- const refreshResponse = yield axios$1.post(`${baseUrl}/getOAuthRefreshToken`, query);
46878
+ const refreshResponse = yield axios.post(`${baseUrl}/getOAuthRefreshToken`, query);
45475
46879
  const refreshToken = refreshResponse.data;
45476
- return axios$1
46880
+ return axios
45477
46881
  .post(`${baseUrl}/token`, {
45478
46882
  grant_type: "refresh_token",
45479
46883
  refresh_token: refreshToken.data,
@@ -45937,7 +47341,6 @@ function from (value, encodingOrOffset, length) {
45937
47341
  return fromArrayBuffer(value, encodingOrOffset, length)
45938
47342
  }
45939
47343
 
45940
-
45941
47344
  if (typeof value === 'number') {
45942
47345
  throw new TypeError(
45943
47346
  'The "value" argument must not be of type number. Received type number'
@@ -46120,7 +47523,6 @@ function fromObject (obj) {
46120
47523
  }
46121
47524
  }
46122
47525
 
46123
-
46124
47526
  function checked (length) {
46125
47527
  // Note: cannot use `length < K_MAX_LENGTH` here because that fails when
46126
47528
  // length is NaN (which is otherwise coerced to zero.)
@@ -46231,7 +47633,6 @@ Buffer.concat = function concat (list, length) {
46231
47633
  return buffer
46232
47634
  };
46233
47635
 
46234
-
46235
47636
  function byteLength (string, encoding) {
46236
47637
  if (Buffer.isBuffer(string)) {
46237
47638
  return string.length
@@ -46828,7 +48229,6 @@ function utf8Slice (buf, start, end) {
46828
48229
  return decodeCodePointsArray(res)
46829
48230
  }
46830
48231
 
46831
-
46832
48232
  // Based on http://stackoverflow.com/a/22747272/680742, the browser with
46833
48233
  // the lowest limit is Chrome, with 0x10000 args.
46834
48234
  // We go 1 magnitude less, for safety
@@ -49298,30 +50698,78 @@ const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
49298
50698
  // Max safe segment length for coercion.
49299
50699
  const MAX_SAFE_COMPONENT_LENGTH = 16;
49300
50700
 
50701
+ // Max safe length for a build identifier. The max length minus 6 characters for
50702
+ // the shortest version with a build 0.0.0+BUILD.
50703
+ const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
50704
+
50705
+ const RELEASE_TYPES = [
50706
+ 'major',
50707
+ 'premajor',
50708
+ 'minor',
50709
+ 'preminor',
50710
+ 'patch',
50711
+ 'prepatch',
50712
+ 'prerelease',
50713
+ ];
50714
+
49301
50715
  var constants = {
49302
- SEMVER_SPEC_VERSION,
49303
50716
  MAX_LENGTH,
49304
- MAX_SAFE_INTEGER,
49305
50717
  MAX_SAFE_COMPONENT_LENGTH,
50718
+ MAX_SAFE_BUILD_LENGTH,
50719
+ MAX_SAFE_INTEGER,
50720
+ RELEASE_TYPES,
50721
+ SEMVER_SPEC_VERSION,
50722
+ FLAG_INCLUDE_PRERELEASE: 0b001,
50723
+ FLAG_LOOSE: 0b010,
49306
50724
  };
49307
50725
 
49308
50726
  var re_1 = createCommonjsModule(function (module, exports) {
49309
- const { MAX_SAFE_COMPONENT_LENGTH } = constants;
50727
+ const {
50728
+ MAX_SAFE_COMPONENT_LENGTH,
50729
+ MAX_SAFE_BUILD_LENGTH,
50730
+ MAX_LENGTH,
50731
+ } = constants;
49310
50732
 
49311
50733
  exports = module.exports = {};
49312
50734
 
49313
50735
  // The actual regexps go on exports.re
49314
50736
  const re = exports.re = [];
50737
+ const safeRe = exports.safeRe = [];
49315
50738
  const src = exports.src = [];
49316
50739
  const t = exports.t = {};
49317
50740
  let R = 0;
49318
50741
 
50742
+ const LETTERDASHNUMBER = '[a-zA-Z0-9-]';
50743
+
50744
+ // Replace some greedy regex tokens to prevent regex dos issues. These regex are
50745
+ // used internally via the safeRe object since all inputs in this library get
50746
+ // normalized first to trim and collapse all extra whitespace. The original
50747
+ // regexes are exported for userland consumption and lower level usage. A
50748
+ // future breaking change could export the safer regex only with a note that
50749
+ // all input should have extra whitespace removed.
50750
+ const safeRegexReplacements = [
50751
+ ['\\s', 1],
50752
+ ['\\d', MAX_LENGTH],
50753
+ [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],
50754
+ ];
50755
+
50756
+ const makeSafeRegex = (value) => {
50757
+ for (const [token, max] of safeRegexReplacements) {
50758
+ value = value
50759
+ .split(`${token}*`).join(`${token}{0,${max}}`)
50760
+ .split(`${token}+`).join(`${token}{1,${max}}`);
50761
+ }
50762
+ return value
50763
+ };
50764
+
49319
50765
  const createToken = (name, value, isGlobal) => {
50766
+ const safe = makeSafeRegex(value);
49320
50767
  const index = R++;
49321
50768
  debug_1(name, index, value);
49322
50769
  t[name] = index;
49323
50770
  src[index] = value;
49324
50771
  re[index] = new RegExp(value, isGlobal ? 'g' : undefined);
50772
+ safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined);
49325
50773
  };
49326
50774
 
49327
50775
  // The following Regular Expressions can be used for tokenizing,
@@ -49331,13 +50779,13 @@ const createToken = (name, value, isGlobal) => {
49331
50779
  // A single `0`, or a non-zero digit followed by zero or more digits.
49332
50780
 
49333
50781
  createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*');
49334
- createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+');
50782
+ createToken('NUMERICIDENTIFIERLOOSE', '\\d+');
49335
50783
 
49336
50784
  // ## Non-numeric Identifier
49337
50785
  // Zero or more digits, followed by a letter or hyphen, and then zero or
49338
50786
  // more letters, digits, or hyphens.
49339
50787
 
49340
- createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*');
50788
+ createToken('NONNUMERICIDENTIFIER', `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
49341
50789
 
49342
50790
  // ## Main Version
49343
50791
  // Three dot-separated numeric identifiers.
@@ -49372,7 +50820,7 @@ createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
49372
50820
  // ## Build Metadata Identifier
49373
50821
  // Any combination of digits, letters, or hyphens.
49374
50822
 
49375
- createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+');
50823
+ createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`);
49376
50824
 
49377
50825
  // ## Build Metadata
49378
50826
  // Plus sign, followed by one or more period-separated build metadata
@@ -49432,12 +50880,17 @@ createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
49432
50880
 
49433
50881
  // Coercion.
49434
50882
  // Extract anything that could conceivably be a part of a valid semver
49435
- createToken('COERCE', `${'(^|[^\\d])' +
50883
+ createToken('COERCEPLAIN', `${'(^|[^\\d])' +
49436
50884
  '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
49437
50885
  `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
49438
- `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
50886
+ `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
50887
+ createToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
50888
+ createToken('COERCEFULL', src[t.COERCEPLAIN] +
50889
+ `(?:${src[t.PRERELEASE]})?` +
50890
+ `(?:${src[t.BUILD]})?` +
49439
50891
  `(?:$|[^\\d])`);
49440
50892
  createToken('COERCERTL', src[t.COERCE], true);
50893
+ createToken('COERCERTLFULL', src[t.COERCEFULL], true);
49441
50894
 
49442
50895
  // Tilde ranges.
49443
50896
  // Meaning is "reasonably at or greater than"
@@ -49490,22 +50943,27 @@ createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$');
49490
50943
  createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$');
49491
50944
  });
49492
50945
  var re_2 = re_1.re;
49493
- var re_3 = re_1.src;
49494
- var re_4 = re_1.t;
49495
- var re_5 = re_1.tildeTrimReplace;
49496
- var re_6 = re_1.caretTrimReplace;
49497
- var re_7 = re_1.comparatorTrimReplace;
49498
-
49499
- // parse out just the options we care about so we always get a consistent
49500
- // obj with keys in a consistent order.
49501
- const opts = ['includePrerelease', 'loose', 'rtl'];
49502
- const parseOptions = options =>
49503
- !options ? {}
49504
- : typeof options !== 'object' ? { loose: true }
49505
- : opts.filter(k => options[k]).reduce((o, k) => {
49506
- o[k] = true;
49507
- return o
49508
- }, {});
50946
+ var re_3 = re_1.safeRe;
50947
+ var re_4 = re_1.src;
50948
+ var re_5 = re_1.t;
50949
+ var re_6 = re_1.tildeTrimReplace;
50950
+ var re_7 = re_1.caretTrimReplace;
50951
+ var re_8 = re_1.comparatorTrimReplace;
50952
+
50953
+ // parse out just the options we care about
50954
+ const looseOption = Object.freeze({ loose: true });
50955
+ const emptyOpts = Object.freeze({ });
50956
+ const parseOptions = options => {
50957
+ if (!options) {
50958
+ return emptyOpts
50959
+ }
50960
+
50961
+ if (typeof options !== 'object') {
50962
+ return looseOption
50963
+ }
50964
+
50965
+ return options
50966
+ };
49509
50967
  var parseOptions_1 = parseOptions;
49510
50968
 
49511
50969
  const numeric = /^[0-9]+$/;
@@ -49533,7 +50991,7 @@ var identifiers = {
49533
50991
  };
49534
50992
 
49535
50993
  const { MAX_LENGTH: MAX_LENGTH$1, MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1 } = constants;
49536
- const { re: re$1, t: t$1 } = re_1;
50994
+ const { safeRe: re$1, t: t$1 } = re_1;
49537
50995
 
49538
50996
 
49539
50997
  const { compareIdentifiers: compareIdentifiers$1 } = identifiers;
@@ -49549,7 +51007,7 @@ class SemVer {
49549
51007
  version = version.version;
49550
51008
  }
49551
51009
  } else if (typeof version !== 'string') {
49552
- throw new TypeError(`Invalid Version: ${version}`)
51010
+ throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`)
49553
51011
  }
49554
51012
 
49555
51013
  if (version.length > MAX_LENGTH$1) {
@@ -49691,7 +51149,7 @@ class SemVer {
49691
51149
  do {
49692
51150
  const a = this.build[i];
49693
51151
  const b = other.build[i];
49694
- debug_1('prerelease compare', i, a, b);
51152
+ debug_1('build compare', i, a, b);
49695
51153
  if (a === undefined && b === undefined) {
49696
51154
  return 0
49697
51155
  } else if (b === undefined) {
@@ -49708,36 +51166,36 @@ class SemVer {
49708
51166
 
49709
51167
  // preminor will bump the version up to the next minor release, and immediately
49710
51168
  // down to pre-release. premajor and prepatch work the same way.
49711
- inc (release, identifier) {
51169
+ inc (release, identifier, identifierBase) {
49712
51170
  switch (release) {
49713
51171
  case 'premajor':
49714
51172
  this.prerelease.length = 0;
49715
51173
  this.patch = 0;
49716
51174
  this.minor = 0;
49717
51175
  this.major++;
49718
- this.inc('pre', identifier);
51176
+ this.inc('pre', identifier, identifierBase);
49719
51177
  break
49720
51178
  case 'preminor':
49721
51179
  this.prerelease.length = 0;
49722
51180
  this.patch = 0;
49723
51181
  this.minor++;
49724
- this.inc('pre', identifier);
51182
+ this.inc('pre', identifier, identifierBase);
49725
51183
  break
49726
51184
  case 'prepatch':
49727
51185
  // If this is already a prerelease, it will bump to the next version
49728
51186
  // drop any prereleases that might already exist, since they are not
49729
51187
  // relevant at this point.
49730
51188
  this.prerelease.length = 0;
49731
- this.inc('patch', identifier);
49732
- this.inc('pre', identifier);
51189
+ this.inc('patch', identifier, identifierBase);
51190
+ this.inc('pre', identifier, identifierBase);
49733
51191
  break
49734
51192
  // If the input is a non-prerelease version, this acts the same as
49735
51193
  // prepatch.
49736
51194
  case 'prerelease':
49737
51195
  if (this.prerelease.length === 0) {
49738
- this.inc('patch', identifier);
51196
+ this.inc('patch', identifier, identifierBase);
49739
51197
  }
49740
- this.inc('pre', identifier);
51198
+ this.inc('pre', identifier, identifierBase);
49741
51199
  break
49742
51200
 
49743
51201
  case 'major':
@@ -49779,9 +51237,15 @@ class SemVer {
49779
51237
  break
49780
51238
  // This probably shouldn't be used publicly.
49781
51239
  // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
49782
- case 'pre':
51240
+ case 'pre': {
51241
+ const base = Number(identifierBase) ? 1 : 0;
51242
+
51243
+ if (!identifier && identifierBase === false) {
51244
+ throw new Error('invalid increment argument: identifier is empty')
51245
+ }
51246
+
49783
51247
  if (this.prerelease.length === 0) {
49784
- this.prerelease = [0];
51248
+ this.prerelease = [base];
49785
51249
  } else {
49786
51250
  let i = this.prerelease.length;
49787
51251
  while (--i >= 0) {
@@ -49792,27 +51256,36 @@ class SemVer {
49792
51256
  }
49793
51257
  if (i === -1) {
49794
51258
  // didn't increment anything
49795
- this.prerelease.push(0);
51259
+ if (identifier === this.prerelease.join('.') && identifierBase === false) {
51260
+ throw new Error('invalid increment argument: identifier already exists')
51261
+ }
51262
+ this.prerelease.push(base);
49796
51263
  }
49797
51264
  }
49798
51265
  if (identifier) {
49799
51266
  // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
49800
51267
  // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
51268
+ let prerelease = [identifier, base];
51269
+ if (identifierBase === false) {
51270
+ prerelease = [identifier];
51271
+ }
49801
51272
  if (compareIdentifiers$1(this.prerelease[0], identifier) === 0) {
49802
51273
  if (isNaN(this.prerelease[1])) {
49803
- this.prerelease = [identifier, 0];
51274
+ this.prerelease = prerelease;
49804
51275
  }
49805
51276
  } else {
49806
- this.prerelease = [identifier, 0];
51277
+ this.prerelease = prerelease;
49807
51278
  }
49808
51279
  }
49809
51280
  break
49810
-
51281
+ }
49811
51282
  default:
49812
51283
  throw new Error(`invalid increment argument: ${release}`)
49813
51284
  }
49814
- this.format();
49815
- this.raw = this.version;
51285
+ this.raw = this.format();
51286
+ if (this.build.length) {
51287
+ this.raw += `+${this.build.join('.')}`;
51288
+ }
49816
51289
  return this
49817
51290
  }
49818
51291
  }