crmbonus-component-wake 0.0.15 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (196) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +7 -0
  2. package/dist/cjs/app-globals-3a1e7e63.js.map +1 -0
  3. package/dist/cjs/app-modal_2.cjs.entry.js +127 -0
  4. package/dist/cjs/app-modal_2.cjs.entry.js.map +1 -0
  5. package/dist/cjs/crm-bonus.cjs.entry.js +46 -0
  6. package/dist/cjs/crm-bonus.cjs.entry.js.map +1 -0
  7. package/dist/cjs/crmbonus-component-wake.cjs.js +27 -0
  8. package/dist/cjs/crmbonus-component-wake.cjs.js.map +1 -0
  9. package/dist/cjs/crmbonus.service-a626c034.js +3795 -0
  10. package/dist/cjs/crmbonus.service-a626c034.js.map +1 -0
  11. package/dist/cjs/giftback-finish_5.cjs.entry.js +153 -0
  12. package/dist/cjs/giftback-finish_5.cjs.entry.js.map +1 -0
  13. package/dist/cjs/index-52d8a075.js +1248 -0
  14. package/dist/cjs/index-52d8a075.js.map +1 -0
  15. package/dist/cjs/index.cjs.js +11 -0
  16. package/dist/cjs/index.cjs.js.map +1 -0
  17. package/dist/cjs/loader.cjs.js +17 -0
  18. package/dist/cjs/loader.cjs.js.map +1 -0
  19. package/dist/cjs/loading-spinner.cjs.entry.js +24 -0
  20. package/dist/cjs/loading-spinner.cjs.entry.js.map +1 -0
  21. package/dist/cjs/pedido-finalizado.cjs.entry.js +28 -0
  22. package/dist/cjs/pedido-finalizado.cjs.entry.js.map +1 -0
  23. package/dist/collection/collection-manifest.json +21 -0
  24. package/dist/collection/components/crm-bonus/assets/logo.svg +18 -0
  25. package/dist/collection/components/crm-bonus/assets/success-svgrepo-com.svg +8 -0
  26. package/dist/collection/components/crm-bonus/assets/svg/logo.svg +18 -0
  27. package/dist/collection/components/crm-bonus/assets/svg/success-svgrepo-com.svg +8 -0
  28. package/dist/collection/components/crm-bonus/crm-bonus.css +12 -0
  29. package/dist/collection/components/crm-bonus/crm-bonus.js +123 -0
  30. package/dist/collection/components/crm-bonus/crm-bonus.js.map +1 -0
  31. package/dist/collection/components/crm-bonus-form/crm-bonus-form.css +32 -0
  32. package/dist/collection/components/crm-bonus-form/crm-bonus-form.js +194 -0
  33. package/dist/collection/components/crm-bonus-form/crm-bonus-form.js.map +1 -0
  34. package/dist/collection/components/crm-bonus-form/subcomponents/giftback-finish/giftback-finish.css +10 -0
  35. package/dist/collection/components/crm-bonus-form/subcomponents/giftback-finish/giftback-finish.js +20 -0
  36. package/dist/collection/components/crm-bonus-form/subcomponents/giftback-finish/giftback-finish.js.map +1 -0
  37. package/dist/collection/components/crm-bonus-form/subcomponents/giftback-pin/giftback-pin.css +54 -0
  38. package/dist/collection/components/crm-bonus-form/subcomponents/giftback-pin/giftback-pin.js +111 -0
  39. package/dist/collection/components/crm-bonus-form/subcomponents/giftback-pin/giftback-pin.js.map +1 -0
  40. package/dist/collection/components/crm-bonus-form/subcomponents/giftback-progress/giftback-progress.css +95 -0
  41. package/dist/collection/components/crm-bonus-form/subcomponents/giftback-progress/giftback-progress.js +111 -0
  42. package/dist/collection/components/crm-bonus-form/subcomponents/giftback-progress/giftback-progress.js.map +1 -0
  43. package/dist/collection/components/crm-bonus-form/subcomponents/phone/phone.input.js +75 -0
  44. package/dist/collection/components/crm-bonus-form/subcomponents/phone/phone.input.js.map +1 -0
  45. package/dist/collection/components/loading-spinner/loading-spinner.css +17 -0
  46. package/dist/collection/components/loading-spinner/loading-spinner.js +63 -0
  47. package/dist/collection/components/loading-spinner/loading-spinner.js.map +1 -0
  48. package/dist/collection/components/modal/app-modal.css +45 -0
  49. package/dist/collection/components/modal/app-modal.js +83 -0
  50. package/dist/collection/components/modal/app-modal.js.map +1 -0
  51. package/dist/collection/components/pedido/pedido.js +58 -0
  52. package/dist/collection/components/pedido/pedido.js.map +1 -0
  53. package/dist/collection/components/phone/phone-input-mask.css +47 -0
  54. package/dist/collection/components/phone/phone-input-mask.js +90 -0
  55. package/dist/collection/components/phone/phone-input-mask.js.map +1 -0
  56. package/dist/collection/contants/index.js +8 -0
  57. package/dist/collection/contants/index.js.map +1 -0
  58. package/dist/collection/contants/mocks.js +28 -0
  59. package/dist/collection/contants/mocks.js.map +1 -0
  60. package/dist/collection/dto/pin.sent.js +2 -0
  61. package/dist/collection/dto/pin.sent.js.map +1 -0
  62. package/dist/collection/dto/validate.pin.bonus.js +2 -0
  63. package/dist/collection/dto/validate.pin.bonus.js.map +1 -0
  64. package/dist/collection/index.js +11 -0
  65. package/dist/collection/index.js.map +1 -0
  66. package/dist/collection/services/crmbonus.service.js +39 -0
  67. package/dist/collection/services/crmbonus.service.js.map +1 -0
  68. package/dist/collection/utils/utils.js +4 -0
  69. package/dist/collection/utils/utils.js.map +1 -0
  70. package/dist/components/app-modal.js +8 -0
  71. package/dist/components/app-modal.js.map +1 -0
  72. package/dist/components/crm-bonus-form.js +8 -0
  73. package/dist/components/crm-bonus-form.js.map +1 -0
  74. package/dist/components/crm-bonus.js +117 -0
  75. package/dist/components/crm-bonus.js.map +1 -0
  76. package/dist/components/giftback-finish.d.ts +11 -0
  77. package/dist/components/giftback-finish.js +8 -0
  78. package/dist/components/giftback-finish.js.map +1 -0
  79. package/dist/components/giftback-pin.js +8 -0
  80. package/dist/components/giftback-pin.js.map +1 -0
  81. package/dist/components/giftback-progress.js +8 -0
  82. package/dist/components/giftback-progress.js.map +1 -0
  83. package/dist/components/index.js +9 -0
  84. package/dist/components/index.js.map +1 -0
  85. package/dist/components/loading-spinner.js +8 -0
  86. package/dist/components/loading-spinner.js.map +1 -0
  87. package/dist/components/p-17ee9996.js +52 -0
  88. package/dist/components/p-17ee9996.js.map +1 -0
  89. package/dist/{crmbonus-component-wake/phone-input-mask.entry.js → components/p-2dbfb2c7.js} +34 -9
  90. package/dist/components/p-2dbfb2c7.js.map +1 -0
  91. package/dist/components/p-563ea4c5.js +166 -0
  92. package/dist/components/p-563ea4c5.js.map +1 -0
  93. package/dist/{crmbonus-component-wake/crmbonus.service-756d754d.js → components/p-629fcb5b.js} +97 -167
  94. package/dist/components/p-629fcb5b.js.map +1 -0
  95. package/dist/components/p-7294e43f.js +36 -0
  96. package/dist/components/p-7294e43f.js.map +1 -0
  97. package/dist/components/p-78529eea.js +39 -0
  98. package/dist/components/p-78529eea.js.map +1 -0
  99. package/dist/components/p-8e0ed8dd.js +43 -0
  100. package/dist/components/p-8e0ed8dd.js.map +1 -0
  101. package/dist/{crmbonus-component-wake/giftback-pin.entry.js → components/p-a1781d03.js} +38 -9
  102. package/dist/components/p-a1781d03.js.map +1 -0
  103. package/dist/components/p-a88bc337.js +67 -0
  104. package/dist/components/p-a88bc337.js.map +1 -0
  105. package/dist/components/p-faf7103e.js +1064 -0
  106. package/dist/components/p-faf7103e.js.map +1 -0
  107. package/dist/components/pedido-finalizado.js +45 -0
  108. package/dist/components/pedido-finalizado.js.map +1 -0
  109. package/dist/components/phone-input-mask.js +8 -0
  110. package/dist/components/phone-input-mask.js.map +1 -0
  111. package/dist/components/phone-input.js +8 -0
  112. package/dist/components/phone-input.js.map +1 -0
  113. package/dist/crmbonus-component-wake/assets/success-svgrepo-com.svg +8 -0
  114. package/dist/crmbonus-component-wake/crmbonus-component-wake.esm.js +1 -48
  115. package/dist/crmbonus-component-wake/crmbonus-component-wake.esm.js.map +1 -1
  116. package/dist/crmbonus-component-wake/index.esm.js +1 -16
  117. package/dist/crmbonus-component-wake/index.esm.js.map +1 -1
  118. package/dist/crmbonus-component-wake/p-54e51298.entry.js +2 -0
  119. package/dist/crmbonus-component-wake/p-54e51298.entry.js.map +1 -0
  120. package/dist/crmbonus-component-wake/p-629fcb5b.js +2 -0
  121. package/dist/crmbonus-component-wake/p-629fcb5b.js.map +1 -0
  122. package/dist/crmbonus-component-wake/p-6b075110.entry.js +2 -0
  123. package/dist/crmbonus-component-wake/p-6b075110.entry.js.map +1 -0
  124. package/dist/crmbonus-component-wake/p-72510682.js +3 -0
  125. package/dist/crmbonus-component-wake/p-72510682.js.map +1 -0
  126. package/dist/crmbonus-component-wake/p-82f64f70.entry.js +2 -0
  127. package/dist/crmbonus-component-wake/p-82f64f70.entry.js.map +1 -0
  128. package/dist/crmbonus-component-wake/p-bf4b486e.entry.js +2 -0
  129. package/dist/crmbonus-component-wake/p-bf4b486e.entry.js.map +1 -0
  130. package/dist/crmbonus-component-wake/p-e1255160.js +2 -0
  131. package/dist/crmbonus-component-wake/p-e1255160.js.map +1 -0
  132. package/dist/crmbonus-component-wake/p-f0d68c31.entry.js +2 -0
  133. package/dist/crmbonus-component-wake/p-f0d68c31.entry.js.map +1 -0
  134. package/dist/env.js +5 -0
  135. package/dist/env.js.map +1 -0
  136. package/dist/{crmbonus-component-wake/crm-bonus-form.entry.js → esm/app-modal_2.entry.js} +35 -8
  137. package/dist/esm/app-modal_2.entry.js.map +1 -0
  138. package/dist/{crmbonus-component-wake → esm}/crm-bonus.entry.js +16 -7
  139. package/dist/esm/crm-bonus.entry.js.map +1 -0
  140. package/dist/esm/crmbonus-component-wake.js +22 -0
  141. package/dist/esm/crmbonus-component-wake.js.map +1 -0
  142. package/dist/{crmbonus-component-wake/crmbonus.service-134e7b0c.js → esm/crmbonus.service-83f67708.js} +99 -169
  143. package/dist/esm/crmbonus.service-83f67708.js.map +1 -0
  144. package/dist/esm/giftback-finish_5.entry.js +145 -0
  145. package/dist/esm/giftback-finish_5.entry.js.map +1 -0
  146. package/dist/esm/index-9f7bde48.js +1220 -0
  147. package/dist/esm/index-9f7bde48.js.map +1 -0
  148. package/dist/esm/index.js +7 -0
  149. package/dist/esm/index.js.map +1 -0
  150. package/dist/esm/loader.js +13 -0
  151. package/dist/esm/loader.js.map +1 -0
  152. package/dist/{crmbonus-component-wake → esm}/loading-spinner.entry.js +4 -3
  153. package/dist/esm/loading-spinner.entry.js.map +1 -0
  154. package/dist/esm/pedido-finalizado.entry.js +24 -0
  155. package/dist/esm/pedido-finalizado.entry.js.map +1 -0
  156. package/dist/index.cjs.js +1 -0
  157. package/dist/index.js +1 -0
  158. package/dist/types/components/crm-bonus/crm-bonus.d.ts +7 -4
  159. package/dist/types/components/crm-bonus-form/crm-bonus-form.d.ts +2 -1
  160. package/dist/types/components/crm-bonus-form/subcomponents/giftback-finish/giftback-finish.d.ts +3 -0
  161. package/dist/types/components/crm-bonus-form/subcomponents/phone/phone.input.d.ts +1 -0
  162. package/dist/types/components/pedido/pedido.d.ts +2 -0
  163. package/dist/types/components/phone/phone-input-mask.d.ts +2 -0
  164. package/dist/types/components.d.ts +27 -4
  165. package/dist/types/contants/index.d.ts +2 -1
  166. package/dist/types/dto/validate.pin.bonus.d.ts +8 -2
  167. package/dist/types/services/crmbonus.service.d.ts +2 -1
  168. package/loader/cdn.js +1 -0
  169. package/loader/index.cjs.js +1 -0
  170. package/loader/index.d.ts +24 -0
  171. package/loader/index.es2017.js +1 -0
  172. package/loader/index.js +2 -0
  173. package/loader/package.json +11 -0
  174. package/package.json +1 -1
  175. package/dist/crmbonus-component-wake/app-modal.entry.js +0 -23
  176. package/dist/crmbonus-component-wake/app-modal.entry.js.map +0 -1
  177. package/dist/crmbonus-component-wake/crm-bonus-form.entry.js.map +0 -1
  178. package/dist/crmbonus-component-wake/crm-bonus.entry.js.map +0 -1
  179. package/dist/crmbonus-component-wake/crmbonus.service-134e7b0c.js.map +0 -1
  180. package/dist/crmbonus-component-wake/crmbonus.service-756d754d.js.map +0 -1
  181. package/dist/crmbonus-component-wake/giftback-pin.entry.js.map +0 -1
  182. package/dist/crmbonus-component-wake/giftback-progress.entry.js +0 -39
  183. package/dist/crmbonus-component-wake/giftback-progress.entry.js.map +0 -1
  184. package/dist/crmbonus-component-wake/index-b9a7a992.js +0 -3039
  185. package/dist/crmbonus-component-wake/index-b9a7a992.js.map +0 -1
  186. package/dist/crmbonus-component-wake/loading-spinner.entry.js.map +0 -1
  187. package/dist/crmbonus-component-wake/pedido-finalizado.entry.js +0 -18
  188. package/dist/crmbonus-component-wake/pedido-finalizado.entry.js.map +0 -1
  189. package/dist/crmbonus-component-wake/phone-input-mask.entry.js.map +0 -1
  190. package/dist/crmbonus-component-wake/phone-input.entry.js +0 -20
  191. package/dist/crmbonus-component-wake/phone-input.entry.js.map +0 -1
  192. package/dist/crmbonus-component-wake/shadow-css-7ad5caf8.js +0 -334
  193. package/dist/crmbonus-component-wake/shadow-css-7ad5caf8.js.map +0 -1
  194. /package/dist/{crmbonus-component-wake → esm}/app-globals-0f993ce5.js +0 -0
  195. /package/dist/{crmbonus-component-wake → esm}/app-globals-0f993ce5.js.map +0 -0
  196. /package/dist/types/home/darlison/Projects/crmbonus/{crmbonus-component-wake → app/crmbonus-component}/.stencil/env.d.ts +0 -0
@@ -0,0 +1,3795 @@
1
+ 'use strict';
2
+
3
+ function bind(fn, thisArg) {
4
+ return function wrap() {
5
+ return fn.apply(thisArg, arguments);
6
+ };
7
+ }
8
+
9
+ // utils is a library of generic helper functions non-specific to axios
10
+
11
+ const {toString} = Object.prototype;
12
+ const {getPrototypeOf} = Object;
13
+
14
+ const kindOf = (cache => thing => {
15
+ const str = toString.call(thing);
16
+ return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
17
+ })(Object.create(null));
18
+
19
+ const kindOfTest = (type) => {
20
+ type = type.toLowerCase();
21
+ return (thing) => kindOf(thing) === type
22
+ };
23
+
24
+ const typeOfTest = type => thing => typeof thing === type;
25
+
26
+ /**
27
+ * Determine if a value is an Array
28
+ *
29
+ * @param {Object} val The value to test
30
+ *
31
+ * @returns {boolean} True if value is an Array, otherwise false
32
+ */
33
+ const {isArray} = Array;
34
+
35
+ /**
36
+ * Determine if a value is undefined
37
+ *
38
+ * @param {*} val The value to test
39
+ *
40
+ * @returns {boolean} True if the value is undefined, otherwise false
41
+ */
42
+ const isUndefined = typeOfTest('undefined');
43
+
44
+ /**
45
+ * Determine if a value is a Buffer
46
+ *
47
+ * @param {*} val The value to test
48
+ *
49
+ * @returns {boolean} True if value is a Buffer, otherwise false
50
+ */
51
+ function isBuffer(val) {
52
+ return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
53
+ && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
54
+ }
55
+
56
+ /**
57
+ * Determine if a value is an ArrayBuffer
58
+ *
59
+ * @param {*} val The value to test
60
+ *
61
+ * @returns {boolean} True if value is an ArrayBuffer, otherwise false
62
+ */
63
+ const isArrayBuffer = kindOfTest('ArrayBuffer');
64
+
65
+
66
+ /**
67
+ * Determine if a value is a view on an ArrayBuffer
68
+ *
69
+ * @param {*} val The value to test
70
+ *
71
+ * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
72
+ */
73
+ function isArrayBufferView(val) {
74
+ let result;
75
+ if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
76
+ result = ArrayBuffer.isView(val);
77
+ } else {
78
+ result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
79
+ }
80
+ return result;
81
+ }
82
+
83
+ /**
84
+ * Determine if a value is a String
85
+ *
86
+ * @param {*} val The value to test
87
+ *
88
+ * @returns {boolean} True if value is a String, otherwise false
89
+ */
90
+ const isString = typeOfTest('string');
91
+
92
+ /**
93
+ * Determine if a value is a Function
94
+ *
95
+ * @param {*} val The value to test
96
+ * @returns {boolean} True if value is a Function, otherwise false
97
+ */
98
+ const isFunction = typeOfTest('function');
99
+
100
+ /**
101
+ * Determine if a value is a Number
102
+ *
103
+ * @param {*} val The value to test
104
+ *
105
+ * @returns {boolean} True if value is a Number, otherwise false
106
+ */
107
+ const isNumber = typeOfTest('number');
108
+
109
+ /**
110
+ * Determine if a value is an Object
111
+ *
112
+ * @param {*} thing The value to test
113
+ *
114
+ * @returns {boolean} True if value is an Object, otherwise false
115
+ */
116
+ const isObject = (thing) => thing !== null && typeof thing === 'object';
117
+
118
+ /**
119
+ * Determine if a value is a Boolean
120
+ *
121
+ * @param {*} thing The value to test
122
+ * @returns {boolean} True if value is a Boolean, otherwise false
123
+ */
124
+ const isBoolean = thing => thing === true || thing === false;
125
+
126
+ /**
127
+ * Determine if a value is a plain Object
128
+ *
129
+ * @param {*} val The value to test
130
+ *
131
+ * @returns {boolean} True if value is a plain Object, otherwise false
132
+ */
133
+ const isPlainObject = (val) => {
134
+ if (kindOf(val) !== 'object') {
135
+ return false;
136
+ }
137
+
138
+ const prototype = getPrototypeOf(val);
139
+ return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
140
+ };
141
+
142
+ /**
143
+ * Determine if a value is a Date
144
+ *
145
+ * @param {*} val The value to test
146
+ *
147
+ * @returns {boolean} True if value is a Date, otherwise false
148
+ */
149
+ const isDate = kindOfTest('Date');
150
+
151
+ /**
152
+ * Determine if a value is a File
153
+ *
154
+ * @param {*} val The value to test
155
+ *
156
+ * @returns {boolean} True if value is a File, otherwise false
157
+ */
158
+ const isFile = kindOfTest('File');
159
+
160
+ /**
161
+ * Determine if a value is a Blob
162
+ *
163
+ * @param {*} val The value to test
164
+ *
165
+ * @returns {boolean} True if value is a Blob, otherwise false
166
+ */
167
+ const isBlob = kindOfTest('Blob');
168
+
169
+ /**
170
+ * Determine if a value is a FileList
171
+ *
172
+ * @param {*} val The value to test
173
+ *
174
+ * @returns {boolean} True if value is a File, otherwise false
175
+ */
176
+ const isFileList = kindOfTest('FileList');
177
+
178
+ /**
179
+ * Determine if a value is a Stream
180
+ *
181
+ * @param {*} val The value to test
182
+ *
183
+ * @returns {boolean} True if value is a Stream, otherwise false
184
+ */
185
+ const isStream = (val) => isObject(val) && isFunction(val.pipe);
186
+
187
+ /**
188
+ * Determine if a value is a FormData
189
+ *
190
+ * @param {*} thing The value to test
191
+ *
192
+ * @returns {boolean} True if value is an FormData, otherwise false
193
+ */
194
+ const isFormData = (thing) => {
195
+ let kind;
196
+ return thing && (
197
+ (typeof FormData === 'function' && thing instanceof FormData) || (
198
+ isFunction(thing.append) && (
199
+ (kind = kindOf(thing)) === 'formdata' ||
200
+ // detect form-data instance
201
+ (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')
202
+ )
203
+ )
204
+ )
205
+ };
206
+
207
+ /**
208
+ * Determine if a value is a URLSearchParams object
209
+ *
210
+ * @param {*} val The value to test
211
+ *
212
+ * @returns {boolean} True if value is a URLSearchParams object, otherwise false
213
+ */
214
+ const isURLSearchParams = kindOfTest('URLSearchParams');
215
+
216
+ const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);
217
+
218
+ /**
219
+ * Trim excess whitespace off the beginning and end of a string
220
+ *
221
+ * @param {String} str The String to trim
222
+ *
223
+ * @returns {String} The String freed of excess whitespace
224
+ */
225
+ const trim = (str) => str.trim ?
226
+ str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
227
+
228
+ /**
229
+ * Iterate over an Array or an Object invoking a function for each item.
230
+ *
231
+ * If `obj` is an Array callback will be called passing
232
+ * the value, index, and complete array for each item.
233
+ *
234
+ * If 'obj' is an Object callback will be called passing
235
+ * the value, key, and complete object for each property.
236
+ *
237
+ * @param {Object|Array} obj The object to iterate
238
+ * @param {Function} fn The callback to invoke for each item
239
+ *
240
+ * @param {Boolean} [allOwnKeys = false]
241
+ * @returns {any}
242
+ */
243
+ function forEach(obj, fn, {allOwnKeys = false} = {}) {
244
+ // Don't bother if no value provided
245
+ if (obj === null || typeof obj === 'undefined') {
246
+ return;
247
+ }
248
+
249
+ let i;
250
+ let l;
251
+
252
+ // Force an array if not already something iterable
253
+ if (typeof obj !== 'object') {
254
+ /*eslint no-param-reassign:0*/
255
+ obj = [obj];
256
+ }
257
+
258
+ if (isArray(obj)) {
259
+ // Iterate over array values
260
+ for (i = 0, l = obj.length; i < l; i++) {
261
+ fn.call(null, obj[i], i, obj);
262
+ }
263
+ } else {
264
+ // Iterate over object keys
265
+ const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
266
+ const len = keys.length;
267
+ let key;
268
+
269
+ for (i = 0; i < len; i++) {
270
+ key = keys[i];
271
+ fn.call(null, obj[key], key, obj);
272
+ }
273
+ }
274
+ }
275
+
276
+ function findKey(obj, key) {
277
+ key = key.toLowerCase();
278
+ const keys = Object.keys(obj);
279
+ let i = keys.length;
280
+ let _key;
281
+ while (i-- > 0) {
282
+ _key = keys[i];
283
+ if (key === _key.toLowerCase()) {
284
+ return _key;
285
+ }
286
+ }
287
+ return null;
288
+ }
289
+
290
+ const _global = (() => {
291
+ /*eslint no-undef:0*/
292
+ if (typeof globalThis !== "undefined") return globalThis;
293
+ return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global)
294
+ })();
295
+
296
+ const isContextDefined = (context) => !isUndefined(context) && context !== _global;
297
+
298
+ /**
299
+ * Accepts varargs expecting each argument to be an object, then
300
+ * immutably merges the properties of each object and returns result.
301
+ *
302
+ * When multiple objects contain the same key the later object in
303
+ * the arguments list will take precedence.
304
+ *
305
+ * Example:
306
+ *
307
+ * ```js
308
+ * var result = merge({foo: 123}, {foo: 456});
309
+ * console.log(result.foo); // outputs 456
310
+ * ```
311
+ *
312
+ * @param {Object} obj1 Object to merge
313
+ *
314
+ * @returns {Object} Result of all merge properties
315
+ */
316
+ function merge(/* obj1, obj2, obj3, ... */) {
317
+ const {caseless} = isContextDefined(this) && this || {};
318
+ const result = {};
319
+ const assignValue = (val, key) => {
320
+ const targetKey = caseless && findKey(result, key) || key;
321
+ if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
322
+ result[targetKey] = merge(result[targetKey], val);
323
+ } else if (isPlainObject(val)) {
324
+ result[targetKey] = merge({}, val);
325
+ } else if (isArray(val)) {
326
+ result[targetKey] = val.slice();
327
+ } else {
328
+ result[targetKey] = val;
329
+ }
330
+ };
331
+
332
+ for (let i = 0, l = arguments.length; i < l; i++) {
333
+ arguments[i] && forEach(arguments[i], assignValue);
334
+ }
335
+ return result;
336
+ }
337
+
338
+ /**
339
+ * Extends object a by mutably adding to it the properties of object b.
340
+ *
341
+ * @param {Object} a The object to be extended
342
+ * @param {Object} b The object to copy properties from
343
+ * @param {Object} thisArg The object to bind function to
344
+ *
345
+ * @param {Boolean} [allOwnKeys]
346
+ * @returns {Object} The resulting value of object a
347
+ */
348
+ const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
349
+ forEach(b, (val, key) => {
350
+ if (thisArg && isFunction(val)) {
351
+ a[key] = bind(val, thisArg);
352
+ } else {
353
+ a[key] = val;
354
+ }
355
+ }, {allOwnKeys});
356
+ return a;
357
+ };
358
+
359
+ /**
360
+ * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
361
+ *
362
+ * @param {string} content with BOM
363
+ *
364
+ * @returns {string} content value without BOM
365
+ */
366
+ const stripBOM = (content) => {
367
+ if (content.charCodeAt(0) === 0xFEFF) {
368
+ content = content.slice(1);
369
+ }
370
+ return content;
371
+ };
372
+
373
+ /**
374
+ * Inherit the prototype methods from one constructor into another
375
+ * @param {function} constructor
376
+ * @param {function} superConstructor
377
+ * @param {object} [props]
378
+ * @param {object} [descriptors]
379
+ *
380
+ * @returns {void}
381
+ */
382
+ const inherits = (constructor, superConstructor, props, descriptors) => {
383
+ constructor.prototype = Object.create(superConstructor.prototype, descriptors);
384
+ constructor.prototype.constructor = constructor;
385
+ Object.defineProperty(constructor, 'super', {
386
+ value: superConstructor.prototype
387
+ });
388
+ props && Object.assign(constructor.prototype, props);
389
+ };
390
+
391
+ /**
392
+ * Resolve object with deep prototype chain to a flat object
393
+ * @param {Object} sourceObj source object
394
+ * @param {Object} [destObj]
395
+ * @param {Function|Boolean} [filter]
396
+ * @param {Function} [propFilter]
397
+ *
398
+ * @returns {Object}
399
+ */
400
+ const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
401
+ let props;
402
+ let i;
403
+ let prop;
404
+ const merged = {};
405
+
406
+ destObj = destObj || {};
407
+ // eslint-disable-next-line no-eq-null,eqeqeq
408
+ if (sourceObj == null) return destObj;
409
+
410
+ do {
411
+ props = Object.getOwnPropertyNames(sourceObj);
412
+ i = props.length;
413
+ while (i-- > 0) {
414
+ prop = props[i];
415
+ if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
416
+ destObj[prop] = sourceObj[prop];
417
+ merged[prop] = true;
418
+ }
419
+ }
420
+ sourceObj = filter !== false && getPrototypeOf(sourceObj);
421
+ } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
422
+
423
+ return destObj;
424
+ };
425
+
426
+ /**
427
+ * Determines whether a string ends with the characters of a specified string
428
+ *
429
+ * @param {String} str
430
+ * @param {String} searchString
431
+ * @param {Number} [position= 0]
432
+ *
433
+ * @returns {boolean}
434
+ */
435
+ const endsWith = (str, searchString, position) => {
436
+ str = String(str);
437
+ if (position === undefined || position > str.length) {
438
+ position = str.length;
439
+ }
440
+ position -= searchString.length;
441
+ const lastIndex = str.indexOf(searchString, position);
442
+ return lastIndex !== -1 && lastIndex === position;
443
+ };
444
+
445
+
446
+ /**
447
+ * Returns new array from array like object or null if failed
448
+ *
449
+ * @param {*} [thing]
450
+ *
451
+ * @returns {?Array}
452
+ */
453
+ const toArray = (thing) => {
454
+ if (!thing) return null;
455
+ if (isArray(thing)) return thing;
456
+ let i = thing.length;
457
+ if (!isNumber(i)) return null;
458
+ const arr = new Array(i);
459
+ while (i-- > 0) {
460
+ arr[i] = thing[i];
461
+ }
462
+ return arr;
463
+ };
464
+
465
+ /**
466
+ * Checking if the Uint8Array exists and if it does, it returns a function that checks if the
467
+ * thing passed in is an instance of Uint8Array
468
+ *
469
+ * @param {TypedArray}
470
+ *
471
+ * @returns {Array}
472
+ */
473
+ // eslint-disable-next-line func-names
474
+ const isTypedArray = (TypedArray => {
475
+ // eslint-disable-next-line func-names
476
+ return thing => {
477
+ return TypedArray && thing instanceof TypedArray;
478
+ };
479
+ })(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
480
+
481
+ /**
482
+ * For each entry in the object, call the function with the key and value.
483
+ *
484
+ * @param {Object<any, any>} obj - The object to iterate over.
485
+ * @param {Function} fn - The function to call for each entry.
486
+ *
487
+ * @returns {void}
488
+ */
489
+ const forEachEntry = (obj, fn) => {
490
+ const generator = obj && obj[Symbol.iterator];
491
+
492
+ const iterator = generator.call(obj);
493
+
494
+ let result;
495
+
496
+ while ((result = iterator.next()) && !result.done) {
497
+ const pair = result.value;
498
+ fn.call(obj, pair[0], pair[1]);
499
+ }
500
+ };
501
+
502
+ /**
503
+ * It takes a regular expression and a string, and returns an array of all the matches
504
+ *
505
+ * @param {string} regExp - The regular expression to match against.
506
+ * @param {string} str - The string to search.
507
+ *
508
+ * @returns {Array<boolean>}
509
+ */
510
+ const matchAll = (regExp, str) => {
511
+ let matches;
512
+ const arr = [];
513
+
514
+ while ((matches = regExp.exec(str)) !== null) {
515
+ arr.push(matches);
516
+ }
517
+
518
+ return arr;
519
+ };
520
+
521
+ /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
522
+ const isHTMLForm = kindOfTest('HTMLFormElement');
523
+
524
+ const toCamelCase = str => {
525
+ return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,
526
+ function replacer(m, p1, p2) {
527
+ return p1.toUpperCase() + p2;
528
+ }
529
+ );
530
+ };
531
+
532
+ /* Creating a function that will check if an object has a property. */
533
+ const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
534
+
535
+ /**
536
+ * Determine if a value is a RegExp object
537
+ *
538
+ * @param {*} val The value to test
539
+ *
540
+ * @returns {boolean} True if value is a RegExp object, otherwise false
541
+ */
542
+ const isRegExp = kindOfTest('RegExp');
543
+
544
+ const reduceDescriptors = (obj, reducer) => {
545
+ const descriptors = Object.getOwnPropertyDescriptors(obj);
546
+ const reducedDescriptors = {};
547
+
548
+ forEach(descriptors, (descriptor, name) => {
549
+ let ret;
550
+ if ((ret = reducer(descriptor, name, obj)) !== false) {
551
+ reducedDescriptors[name] = ret || descriptor;
552
+ }
553
+ });
554
+
555
+ Object.defineProperties(obj, reducedDescriptors);
556
+ };
557
+
558
+ /**
559
+ * Makes all methods read-only
560
+ * @param {Object} obj
561
+ */
562
+
563
+ const freezeMethods = (obj) => {
564
+ reduceDescriptors(obj, (descriptor, name) => {
565
+ // skip restricted props in strict mode
566
+ if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
567
+ return false;
568
+ }
569
+
570
+ const value = obj[name];
571
+
572
+ if (!isFunction(value)) return;
573
+
574
+ descriptor.enumerable = false;
575
+
576
+ if ('writable' in descriptor) {
577
+ descriptor.writable = false;
578
+ return;
579
+ }
580
+
581
+ if (!descriptor.set) {
582
+ descriptor.set = () => {
583
+ throw Error('Can not rewrite read-only method \'' + name + '\'');
584
+ };
585
+ }
586
+ });
587
+ };
588
+
589
+ const toObjectSet = (arrayOrString, delimiter) => {
590
+ const obj = {};
591
+
592
+ const define = (arr) => {
593
+ arr.forEach(value => {
594
+ obj[value] = true;
595
+ });
596
+ };
597
+
598
+ isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
599
+
600
+ return obj;
601
+ };
602
+
603
+ const noop = () => {};
604
+
605
+ const toFiniteNumber = (value, defaultValue) => {
606
+ return value != null && Number.isFinite(value = +value) ? value : defaultValue;
607
+ };
608
+
609
+ const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
610
+
611
+ const DIGIT = '0123456789';
612
+
613
+ const ALPHABET = {
614
+ DIGIT,
615
+ ALPHA,
616
+ ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
617
+ };
618
+
619
+ const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
620
+ let str = '';
621
+ const {length} = alphabet;
622
+ while (size--) {
623
+ str += alphabet[Math.random() * length|0];
624
+ }
625
+
626
+ return str;
627
+ };
628
+
629
+ /**
630
+ * If the thing is a FormData object, return true, otherwise return false.
631
+ *
632
+ * @param {unknown} thing - The thing to check.
633
+ *
634
+ * @returns {boolean}
635
+ */
636
+ function isSpecCompliantForm(thing) {
637
+ return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
638
+ }
639
+
640
+ const toJSONObject = (obj) => {
641
+ const stack = new Array(10);
642
+
643
+ const visit = (source, i) => {
644
+
645
+ if (isObject(source)) {
646
+ if (stack.indexOf(source) >= 0) {
647
+ return;
648
+ }
649
+
650
+ if(!('toJSON' in source)) {
651
+ stack[i] = source;
652
+ const target = isArray(source) ? [] : {};
653
+
654
+ forEach(source, (value, key) => {
655
+ const reducedValue = visit(value, i + 1);
656
+ !isUndefined(reducedValue) && (target[key] = reducedValue);
657
+ });
658
+
659
+ stack[i] = undefined;
660
+
661
+ return target;
662
+ }
663
+ }
664
+
665
+ return source;
666
+ };
667
+
668
+ return visit(obj, 0);
669
+ };
670
+
671
+ const isAsyncFn = kindOfTest('AsyncFunction');
672
+
673
+ const isThenable = (thing) =>
674
+ thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
675
+
676
+ // original code
677
+ // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
678
+
679
+ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
680
+ if (setImmediateSupported) {
681
+ return setImmediate;
682
+ }
683
+
684
+ return postMessageSupported ? ((token, callbacks) => {
685
+ _global.addEventListener("message", ({source, data}) => {
686
+ if (source === _global && data === token) {
687
+ callbacks.length && callbacks.shift()();
688
+ }
689
+ }, false);
690
+
691
+ return (cb) => {
692
+ callbacks.push(cb);
693
+ _global.postMessage(token, "*");
694
+ }
695
+ })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
696
+ })(
697
+ typeof setImmediate === 'function',
698
+ isFunction(_global.postMessage)
699
+ );
700
+
701
+ const asap = typeof queueMicrotask !== 'undefined' ?
702
+ queueMicrotask.bind(_global) : ( typeof process !== 'undefined' && process.nextTick || _setImmediate);
703
+
704
+ // *********************
705
+
706
+ const utils$1 = {
707
+ isArray,
708
+ isArrayBuffer,
709
+ isBuffer,
710
+ isFormData,
711
+ isArrayBufferView,
712
+ isString,
713
+ isNumber,
714
+ isBoolean,
715
+ isObject,
716
+ isPlainObject,
717
+ isReadableStream,
718
+ isRequest,
719
+ isResponse,
720
+ isHeaders,
721
+ isUndefined,
722
+ isDate,
723
+ isFile,
724
+ isBlob,
725
+ isRegExp,
726
+ isFunction,
727
+ isStream,
728
+ isURLSearchParams,
729
+ isTypedArray,
730
+ isFileList,
731
+ forEach,
732
+ merge,
733
+ extend,
734
+ trim,
735
+ stripBOM,
736
+ inherits,
737
+ toFlatObject,
738
+ kindOf,
739
+ kindOfTest,
740
+ endsWith,
741
+ toArray,
742
+ forEachEntry,
743
+ matchAll,
744
+ isHTMLForm,
745
+ hasOwnProperty,
746
+ hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection
747
+ reduceDescriptors,
748
+ freezeMethods,
749
+ toObjectSet,
750
+ toCamelCase,
751
+ noop,
752
+ toFiniteNumber,
753
+ findKey,
754
+ global: _global,
755
+ isContextDefined,
756
+ ALPHABET,
757
+ generateString,
758
+ isSpecCompliantForm,
759
+ toJSONObject,
760
+ isAsyncFn,
761
+ isThenable,
762
+ setImmediate: _setImmediate,
763
+ asap
764
+ };
765
+
766
+ /**
767
+ * Create an Error with the specified message, config, error code, request and response.
768
+ *
769
+ * @param {string} message The error message.
770
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
771
+ * @param {Object} [config] The config.
772
+ * @param {Object} [request] The request.
773
+ * @param {Object} [response] The response.
774
+ *
775
+ * @returns {Error} The created error.
776
+ */
777
+ function AxiosError(message, code, config, request, response) {
778
+ Error.call(this);
779
+
780
+ if (Error.captureStackTrace) {
781
+ Error.captureStackTrace(this, this.constructor);
782
+ } else {
783
+ this.stack = (new Error()).stack;
784
+ }
785
+
786
+ this.message = message;
787
+ this.name = 'AxiosError';
788
+ code && (this.code = code);
789
+ config && (this.config = config);
790
+ request && (this.request = request);
791
+ if (response) {
792
+ this.response = response;
793
+ this.status = response.status ? response.status : null;
794
+ }
795
+ }
796
+
797
+ utils$1.inherits(AxiosError, Error, {
798
+ toJSON: function toJSON() {
799
+ return {
800
+ // Standard
801
+ message: this.message,
802
+ name: this.name,
803
+ // Microsoft
804
+ description: this.description,
805
+ number: this.number,
806
+ // Mozilla
807
+ fileName: this.fileName,
808
+ lineNumber: this.lineNumber,
809
+ columnNumber: this.columnNumber,
810
+ stack: this.stack,
811
+ // Axios
812
+ config: utils$1.toJSONObject(this.config),
813
+ code: this.code,
814
+ status: this.status
815
+ };
816
+ }
817
+ });
818
+
819
+ const prototype$1 = AxiosError.prototype;
820
+ const descriptors = {};
821
+
822
+ [
823
+ 'ERR_BAD_OPTION_VALUE',
824
+ 'ERR_BAD_OPTION',
825
+ 'ECONNABORTED',
826
+ 'ETIMEDOUT',
827
+ 'ERR_NETWORK',
828
+ 'ERR_FR_TOO_MANY_REDIRECTS',
829
+ 'ERR_DEPRECATED',
830
+ 'ERR_BAD_RESPONSE',
831
+ 'ERR_BAD_REQUEST',
832
+ 'ERR_CANCELED',
833
+ 'ERR_NOT_SUPPORT',
834
+ 'ERR_INVALID_URL'
835
+ // eslint-disable-next-line func-names
836
+ ].forEach(code => {
837
+ descriptors[code] = {value: code};
838
+ });
839
+
840
+ Object.defineProperties(AxiosError, descriptors);
841
+ Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
842
+
843
+ // eslint-disable-next-line func-names
844
+ AxiosError.from = (error, code, config, request, response, customProps) => {
845
+ const axiosError = Object.create(prototype$1);
846
+
847
+ utils$1.toFlatObject(error, axiosError, function filter(obj) {
848
+ return obj !== Error.prototype;
849
+ }, prop => {
850
+ return prop !== 'isAxiosError';
851
+ });
852
+
853
+ AxiosError.call(axiosError, error.message, code, config, request, response);
854
+
855
+ axiosError.cause = error;
856
+
857
+ axiosError.name = error.name;
858
+
859
+ customProps && Object.assign(axiosError, customProps);
860
+
861
+ return axiosError;
862
+ };
863
+
864
+ // eslint-disable-next-line strict
865
+ const httpAdapter = null;
866
+
867
+ /**
868
+ * Determines if the given thing is a array or js object.
869
+ *
870
+ * @param {string} thing - The object or array to be visited.
871
+ *
872
+ * @returns {boolean}
873
+ */
874
+ function isVisitable(thing) {
875
+ return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
876
+ }
877
+
878
+ /**
879
+ * It removes the brackets from the end of a string
880
+ *
881
+ * @param {string} key - The key of the parameter.
882
+ *
883
+ * @returns {string} the key without the brackets.
884
+ */
885
+ function removeBrackets(key) {
886
+ return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
887
+ }
888
+
889
+ /**
890
+ * It takes a path, a key, and a boolean, and returns a string
891
+ *
892
+ * @param {string} path - The path to the current key.
893
+ * @param {string} key - The key of the current object being iterated over.
894
+ * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
895
+ *
896
+ * @returns {string} The path to the current key.
897
+ */
898
+ function renderKey(path, key, dots) {
899
+ if (!path) return key;
900
+ return path.concat(key).map(function each(token, i) {
901
+ // eslint-disable-next-line no-param-reassign
902
+ token = removeBrackets(token);
903
+ return !dots && i ? '[' + token + ']' : token;
904
+ }).join(dots ? '.' : '');
905
+ }
906
+
907
+ /**
908
+ * If the array is an array and none of its elements are visitable, then it's a flat array.
909
+ *
910
+ * @param {Array<any>} arr - The array to check
911
+ *
912
+ * @returns {boolean}
913
+ */
914
+ function isFlatArray(arr) {
915
+ return utils$1.isArray(arr) && !arr.some(isVisitable);
916
+ }
917
+
918
+ const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
919
+ return /^is[A-Z]/.test(prop);
920
+ });
921
+
922
+ /**
923
+ * Convert a data object to FormData
924
+ *
925
+ * @param {Object} obj
926
+ * @param {?Object} [formData]
927
+ * @param {?Object} [options]
928
+ * @param {Function} [options.visitor]
929
+ * @param {Boolean} [options.metaTokens = true]
930
+ * @param {Boolean} [options.dots = false]
931
+ * @param {?Boolean} [options.indexes = false]
932
+ *
933
+ * @returns {Object}
934
+ **/
935
+
936
+ /**
937
+ * It converts an object into a FormData object
938
+ *
939
+ * @param {Object<any, any>} obj - The object to convert to form data.
940
+ * @param {string} formData - The FormData object to append to.
941
+ * @param {Object<string, any>} options
942
+ *
943
+ * @returns
944
+ */
945
+ function toFormData(obj, formData, options) {
946
+ if (!utils$1.isObject(obj)) {
947
+ throw new TypeError('target must be an object');
948
+ }
949
+
950
+ // eslint-disable-next-line no-param-reassign
951
+ formData = formData || new (FormData)();
952
+
953
+ // eslint-disable-next-line no-param-reassign
954
+ options = utils$1.toFlatObject(options, {
955
+ metaTokens: true,
956
+ dots: false,
957
+ indexes: false
958
+ }, false, function defined(option, source) {
959
+ // eslint-disable-next-line no-eq-null,eqeqeq
960
+ return !utils$1.isUndefined(source[option]);
961
+ });
962
+
963
+ const metaTokens = options.metaTokens;
964
+ // eslint-disable-next-line no-use-before-define
965
+ const visitor = options.visitor || defaultVisitor;
966
+ const dots = options.dots;
967
+ const indexes = options.indexes;
968
+ const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
969
+ const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
970
+
971
+ if (!utils$1.isFunction(visitor)) {
972
+ throw new TypeError('visitor must be a function');
973
+ }
974
+
975
+ function convertValue(value) {
976
+ if (value === null) return '';
977
+
978
+ if (utils$1.isDate(value)) {
979
+ return value.toISOString();
980
+ }
981
+
982
+ if (!useBlob && utils$1.isBlob(value)) {
983
+ throw new AxiosError('Blob is not supported. Use a Buffer instead.');
984
+ }
985
+
986
+ if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
987
+ return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
988
+ }
989
+
990
+ return value;
991
+ }
992
+
993
+ /**
994
+ * Default visitor.
995
+ *
996
+ * @param {*} value
997
+ * @param {String|Number} key
998
+ * @param {Array<String|Number>} path
999
+ * @this {FormData}
1000
+ *
1001
+ * @returns {boolean} return true to visit the each prop of the value recursively
1002
+ */
1003
+ function defaultVisitor(value, key, path) {
1004
+ let arr = value;
1005
+
1006
+ if (value && !path && typeof value === 'object') {
1007
+ if (utils$1.endsWith(key, '{}')) {
1008
+ // eslint-disable-next-line no-param-reassign
1009
+ key = metaTokens ? key : key.slice(0, -2);
1010
+ // eslint-disable-next-line no-param-reassign
1011
+ value = JSON.stringify(value);
1012
+ } else if (
1013
+ (utils$1.isArray(value) && isFlatArray(value)) ||
1014
+ ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
1015
+ )) {
1016
+ // eslint-disable-next-line no-param-reassign
1017
+ key = removeBrackets(key);
1018
+
1019
+ arr.forEach(function each(el, index) {
1020
+ !(utils$1.isUndefined(el) || el === null) && formData.append(
1021
+ // eslint-disable-next-line no-nested-ternary
1022
+ indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
1023
+ convertValue(el)
1024
+ );
1025
+ });
1026
+ return false;
1027
+ }
1028
+ }
1029
+
1030
+ if (isVisitable(value)) {
1031
+ return true;
1032
+ }
1033
+
1034
+ formData.append(renderKey(path, key, dots), convertValue(value));
1035
+
1036
+ return false;
1037
+ }
1038
+
1039
+ const stack = [];
1040
+
1041
+ const exposedHelpers = Object.assign(predicates, {
1042
+ defaultVisitor,
1043
+ convertValue,
1044
+ isVisitable
1045
+ });
1046
+
1047
+ function build(value, path) {
1048
+ if (utils$1.isUndefined(value)) return;
1049
+
1050
+ if (stack.indexOf(value) !== -1) {
1051
+ throw Error('Circular reference detected in ' + path.join('.'));
1052
+ }
1053
+
1054
+ stack.push(value);
1055
+
1056
+ utils$1.forEach(value, function each(el, key) {
1057
+ const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
1058
+ formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers
1059
+ );
1060
+
1061
+ if (result === true) {
1062
+ build(el, path ? path.concat(key) : [key]);
1063
+ }
1064
+ });
1065
+
1066
+ stack.pop();
1067
+ }
1068
+
1069
+ if (!utils$1.isObject(obj)) {
1070
+ throw new TypeError('data must be an object');
1071
+ }
1072
+
1073
+ build(obj);
1074
+
1075
+ return formData;
1076
+ }
1077
+
1078
+ /**
1079
+ * It encodes a string by replacing all characters that are not in the unreserved set with
1080
+ * their percent-encoded equivalents
1081
+ *
1082
+ * @param {string} str - The string to encode.
1083
+ *
1084
+ * @returns {string} The encoded string.
1085
+ */
1086
+ function encode$1(str) {
1087
+ const charMap = {
1088
+ '!': '%21',
1089
+ "'": '%27',
1090
+ '(': '%28',
1091
+ ')': '%29',
1092
+ '~': '%7E',
1093
+ '%20': '+',
1094
+ '%00': '\x00'
1095
+ };
1096
+ return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
1097
+ return charMap[match];
1098
+ });
1099
+ }
1100
+
1101
+ /**
1102
+ * It takes a params object and converts it to a FormData object
1103
+ *
1104
+ * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
1105
+ * @param {Object<string, any>} options - The options object passed to the Axios constructor.
1106
+ *
1107
+ * @returns {void}
1108
+ */
1109
+ function AxiosURLSearchParams(params, options) {
1110
+ this._pairs = [];
1111
+
1112
+ params && toFormData(params, this, options);
1113
+ }
1114
+
1115
+ const prototype = AxiosURLSearchParams.prototype;
1116
+
1117
+ prototype.append = function append(name, value) {
1118
+ this._pairs.push([name, value]);
1119
+ };
1120
+
1121
+ prototype.toString = function toString(encoder) {
1122
+ const _encode = encoder ? function(value) {
1123
+ return encoder.call(this, value, encode$1);
1124
+ } : encode$1;
1125
+
1126
+ return this._pairs.map(function each(pair) {
1127
+ return _encode(pair[0]) + '=' + _encode(pair[1]);
1128
+ }, '').join('&');
1129
+ };
1130
+
1131
+ /**
1132
+ * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
1133
+ * URI encoded counterparts
1134
+ *
1135
+ * @param {string} val The value to be encoded.
1136
+ *
1137
+ * @returns {string} The encoded value.
1138
+ */
1139
+ function encode(val) {
1140
+ return encodeURIComponent(val).
1141
+ replace(/%3A/gi, ':').
1142
+ replace(/%24/g, '$').
1143
+ replace(/%2C/gi, ',').
1144
+ replace(/%20/g, '+').
1145
+ replace(/%5B/gi, '[').
1146
+ replace(/%5D/gi, ']');
1147
+ }
1148
+
1149
+ /**
1150
+ * Build a URL by appending params to the end
1151
+ *
1152
+ * @param {string} url The base of the url (e.g., http://www.google.com)
1153
+ * @param {object} [params] The params to be appended
1154
+ * @param {?object} options
1155
+ *
1156
+ * @returns {string} The formatted url
1157
+ */
1158
+ function buildURL(url, params, options) {
1159
+ /*eslint no-param-reassign:0*/
1160
+ if (!params) {
1161
+ return url;
1162
+ }
1163
+
1164
+ const _encode = options && options.encode || encode;
1165
+
1166
+ const serializeFn = options && options.serialize;
1167
+
1168
+ let serializedParams;
1169
+
1170
+ if (serializeFn) {
1171
+ serializedParams = serializeFn(params, options);
1172
+ } else {
1173
+ serializedParams = utils$1.isURLSearchParams(params) ?
1174
+ params.toString() :
1175
+ new AxiosURLSearchParams(params, options).toString(_encode);
1176
+ }
1177
+
1178
+ if (serializedParams) {
1179
+ const hashmarkIndex = url.indexOf("#");
1180
+
1181
+ if (hashmarkIndex !== -1) {
1182
+ url = url.slice(0, hashmarkIndex);
1183
+ }
1184
+ url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
1185
+ }
1186
+
1187
+ return url;
1188
+ }
1189
+
1190
+ class InterceptorManager {
1191
+ constructor() {
1192
+ this.handlers = [];
1193
+ }
1194
+
1195
+ /**
1196
+ * Add a new interceptor to the stack
1197
+ *
1198
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
1199
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
1200
+ *
1201
+ * @return {Number} An ID used to remove interceptor later
1202
+ */
1203
+ use(fulfilled, rejected, options) {
1204
+ this.handlers.push({
1205
+ fulfilled,
1206
+ rejected,
1207
+ synchronous: options ? options.synchronous : false,
1208
+ runWhen: options ? options.runWhen : null
1209
+ });
1210
+ return this.handlers.length - 1;
1211
+ }
1212
+
1213
+ /**
1214
+ * Remove an interceptor from the stack
1215
+ *
1216
+ * @param {Number} id The ID that was returned by `use`
1217
+ *
1218
+ * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
1219
+ */
1220
+ eject(id) {
1221
+ if (this.handlers[id]) {
1222
+ this.handlers[id] = null;
1223
+ }
1224
+ }
1225
+
1226
+ /**
1227
+ * Clear all interceptors from the stack
1228
+ *
1229
+ * @returns {void}
1230
+ */
1231
+ clear() {
1232
+ if (this.handlers) {
1233
+ this.handlers = [];
1234
+ }
1235
+ }
1236
+
1237
+ /**
1238
+ * Iterate over all the registered interceptors
1239
+ *
1240
+ * This method is particularly useful for skipping over any
1241
+ * interceptors that may have become `null` calling `eject`.
1242
+ *
1243
+ * @param {Function} fn The function to call for each interceptor
1244
+ *
1245
+ * @returns {void}
1246
+ */
1247
+ forEach(fn) {
1248
+ utils$1.forEach(this.handlers, function forEachHandler(h) {
1249
+ if (h !== null) {
1250
+ fn(h);
1251
+ }
1252
+ });
1253
+ }
1254
+ }
1255
+
1256
+ const InterceptorManager$1 = InterceptorManager;
1257
+
1258
+ const transitionalDefaults = {
1259
+ silentJSONParsing: true,
1260
+ forcedJSONParsing: true,
1261
+ clarifyTimeoutError: false
1262
+ };
1263
+
1264
+ const URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
1265
+
1266
+ const FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
1267
+
1268
+ const Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
1269
+
1270
+ const platform$1 = {
1271
+ isBrowser: true,
1272
+ classes: {
1273
+ URLSearchParams: URLSearchParams$1,
1274
+ FormData: FormData$1,
1275
+ Blob: Blob$1
1276
+ },
1277
+ protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
1278
+ };
1279
+
1280
+ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
1281
+
1282
+ const _navigator = typeof navigator === 'object' && navigator || undefined;
1283
+
1284
+ /**
1285
+ * Determine if we're running in a standard browser environment
1286
+ *
1287
+ * This allows axios to run in a web worker, and react-native.
1288
+ * Both environments support XMLHttpRequest, but not fully standard globals.
1289
+ *
1290
+ * web workers:
1291
+ * typeof window -> undefined
1292
+ * typeof document -> undefined
1293
+ *
1294
+ * react-native:
1295
+ * navigator.product -> 'ReactNative'
1296
+ * nativescript
1297
+ * navigator.product -> 'NativeScript' or 'NS'
1298
+ *
1299
+ * @returns {boolean}
1300
+ */
1301
+ const hasStandardBrowserEnv = hasBrowserEnv &&
1302
+ (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
1303
+
1304
+ /**
1305
+ * Determine if we're running in a standard browser webWorker environment
1306
+ *
1307
+ * Although the `isStandardBrowserEnv` method indicates that
1308
+ * `allows axios to run in a web worker`, the WebWorker will still be
1309
+ * filtered out due to its judgment standard
1310
+ * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
1311
+ * This leads to a problem when axios post `FormData` in webWorker
1312
+ */
1313
+ const hasStandardBrowserWebWorkerEnv = (() => {
1314
+ return (
1315
+ typeof WorkerGlobalScope !== 'undefined' &&
1316
+ // eslint-disable-next-line no-undef
1317
+ self instanceof WorkerGlobalScope &&
1318
+ typeof self.importScripts === 'function'
1319
+ );
1320
+ })();
1321
+
1322
+ const origin = hasBrowserEnv && window.location.href || 'http://localhost';
1323
+
1324
+ const utils = /*#__PURE__*/Object.freeze({
1325
+ __proto__: null,
1326
+ hasBrowserEnv: hasBrowserEnv,
1327
+ hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
1328
+ hasStandardBrowserEnv: hasStandardBrowserEnv,
1329
+ navigator: _navigator,
1330
+ origin: origin
1331
+ });
1332
+
1333
+ const platform = {
1334
+ ...utils,
1335
+ ...platform$1
1336
+ };
1337
+
1338
+ function toURLEncodedForm(data, options) {
1339
+ return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
1340
+ visitor: function(value, key, path, helpers) {
1341
+ if (platform.isNode && utils$1.isBuffer(value)) {
1342
+ this.append(key, value.toString('base64'));
1343
+ return false;
1344
+ }
1345
+
1346
+ return helpers.defaultVisitor.apply(this, arguments);
1347
+ }
1348
+ }, options));
1349
+ }
1350
+
1351
+ /**
1352
+ * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
1353
+ *
1354
+ * @param {string} name - The name of the property to get.
1355
+ *
1356
+ * @returns An array of strings.
1357
+ */
1358
+ function parsePropPath(name) {
1359
+ // foo[x][y][z]
1360
+ // foo.x.y.z
1361
+ // foo-x-y-z
1362
+ // foo x y z
1363
+ return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
1364
+ return match[0] === '[]' ? '' : match[1] || match[0];
1365
+ });
1366
+ }
1367
+
1368
+ /**
1369
+ * Convert an array to an object.
1370
+ *
1371
+ * @param {Array<any>} arr - The array to convert to an object.
1372
+ *
1373
+ * @returns An object with the same keys and values as the array.
1374
+ */
1375
+ function arrayToObject(arr) {
1376
+ const obj = {};
1377
+ const keys = Object.keys(arr);
1378
+ let i;
1379
+ const len = keys.length;
1380
+ let key;
1381
+ for (i = 0; i < len; i++) {
1382
+ key = keys[i];
1383
+ obj[key] = arr[key];
1384
+ }
1385
+ return obj;
1386
+ }
1387
+
1388
+ /**
1389
+ * It takes a FormData object and returns a JavaScript object
1390
+ *
1391
+ * @param {string} formData The FormData object to convert to JSON.
1392
+ *
1393
+ * @returns {Object<string, any> | null} The converted object.
1394
+ */
1395
+ function formDataToJSON(formData) {
1396
+ function buildPath(path, value, target, index) {
1397
+ let name = path[index++];
1398
+
1399
+ if (name === '__proto__') return true;
1400
+
1401
+ const isNumericKey = Number.isFinite(+name);
1402
+ const isLast = index >= path.length;
1403
+ name = !name && utils$1.isArray(target) ? target.length : name;
1404
+
1405
+ if (isLast) {
1406
+ if (utils$1.hasOwnProp(target, name)) {
1407
+ target[name] = [target[name], value];
1408
+ } else {
1409
+ target[name] = value;
1410
+ }
1411
+
1412
+ return !isNumericKey;
1413
+ }
1414
+
1415
+ if (!target[name] || !utils$1.isObject(target[name])) {
1416
+ target[name] = [];
1417
+ }
1418
+
1419
+ const result = buildPath(path, value, target[name], index);
1420
+
1421
+ if (result && utils$1.isArray(target[name])) {
1422
+ target[name] = arrayToObject(target[name]);
1423
+ }
1424
+
1425
+ return !isNumericKey;
1426
+ }
1427
+
1428
+ if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
1429
+ const obj = {};
1430
+
1431
+ utils$1.forEachEntry(formData, (name, value) => {
1432
+ buildPath(parsePropPath(name), value, obj, 0);
1433
+ });
1434
+
1435
+ return obj;
1436
+ }
1437
+
1438
+ return null;
1439
+ }
1440
+
1441
+ /**
1442
+ * It takes a string, tries to parse it, and if it fails, it returns the stringified version
1443
+ * of the input
1444
+ *
1445
+ * @param {any} rawValue - The value to be stringified.
1446
+ * @param {Function} parser - A function that parses a string into a JavaScript object.
1447
+ * @param {Function} encoder - A function that takes a value and returns a string.
1448
+ *
1449
+ * @returns {string} A stringified version of the rawValue.
1450
+ */
1451
+ function stringifySafely(rawValue, parser, encoder) {
1452
+ if (utils$1.isString(rawValue)) {
1453
+ try {
1454
+ (parser || JSON.parse)(rawValue);
1455
+ return utils$1.trim(rawValue);
1456
+ } catch (e) {
1457
+ if (e.name !== 'SyntaxError') {
1458
+ throw e;
1459
+ }
1460
+ }
1461
+ }
1462
+
1463
+ return (encoder || JSON.stringify)(rawValue);
1464
+ }
1465
+
1466
+ const defaults = {
1467
+
1468
+ transitional: transitionalDefaults,
1469
+
1470
+ adapter: ['xhr', 'http', 'fetch'],
1471
+
1472
+ transformRequest: [function transformRequest(data, headers) {
1473
+ const contentType = headers.getContentType() || '';
1474
+ const hasJSONContentType = contentType.indexOf('application/json') > -1;
1475
+ const isObjectPayload = utils$1.isObject(data);
1476
+
1477
+ if (isObjectPayload && utils$1.isHTMLForm(data)) {
1478
+ data = new FormData(data);
1479
+ }
1480
+
1481
+ const isFormData = utils$1.isFormData(data);
1482
+
1483
+ if (isFormData) {
1484
+ return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
1485
+ }
1486
+
1487
+ if (utils$1.isArrayBuffer(data) ||
1488
+ utils$1.isBuffer(data) ||
1489
+ utils$1.isStream(data) ||
1490
+ utils$1.isFile(data) ||
1491
+ utils$1.isBlob(data) ||
1492
+ utils$1.isReadableStream(data)
1493
+ ) {
1494
+ return data;
1495
+ }
1496
+ if (utils$1.isArrayBufferView(data)) {
1497
+ return data.buffer;
1498
+ }
1499
+ if (utils$1.isURLSearchParams(data)) {
1500
+ headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
1501
+ return data.toString();
1502
+ }
1503
+
1504
+ let isFileList;
1505
+
1506
+ if (isObjectPayload) {
1507
+ if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
1508
+ return toURLEncodedForm(data, this.formSerializer).toString();
1509
+ }
1510
+
1511
+ if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
1512
+ const _FormData = this.env && this.env.FormData;
1513
+
1514
+ return toFormData(
1515
+ isFileList ? {'files[]': data} : data,
1516
+ _FormData && new _FormData(),
1517
+ this.formSerializer
1518
+ );
1519
+ }
1520
+ }
1521
+
1522
+ if (isObjectPayload || hasJSONContentType ) {
1523
+ headers.setContentType('application/json', false);
1524
+ return stringifySafely(data);
1525
+ }
1526
+
1527
+ return data;
1528
+ }],
1529
+
1530
+ transformResponse: [function transformResponse(data) {
1531
+ const transitional = this.transitional || defaults.transitional;
1532
+ const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
1533
+ const JSONRequested = this.responseType === 'json';
1534
+
1535
+ if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
1536
+ return data;
1537
+ }
1538
+
1539
+ if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
1540
+ const silentJSONParsing = transitional && transitional.silentJSONParsing;
1541
+ const strictJSONParsing = !silentJSONParsing && JSONRequested;
1542
+
1543
+ try {
1544
+ return JSON.parse(data);
1545
+ } catch (e) {
1546
+ if (strictJSONParsing) {
1547
+ if (e.name === 'SyntaxError') {
1548
+ throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
1549
+ }
1550
+ throw e;
1551
+ }
1552
+ }
1553
+ }
1554
+
1555
+ return data;
1556
+ }],
1557
+
1558
+ /**
1559
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
1560
+ * timeout is not created.
1561
+ */
1562
+ timeout: 0,
1563
+
1564
+ xsrfCookieName: 'XSRF-TOKEN',
1565
+ xsrfHeaderName: 'X-XSRF-TOKEN',
1566
+
1567
+ maxContentLength: -1,
1568
+ maxBodyLength: -1,
1569
+
1570
+ env: {
1571
+ FormData: platform.classes.FormData,
1572
+ Blob: platform.classes.Blob
1573
+ },
1574
+
1575
+ validateStatus: function validateStatus(status) {
1576
+ return status >= 200 && status < 300;
1577
+ },
1578
+
1579
+ headers: {
1580
+ common: {
1581
+ 'Accept': 'application/json, text/plain, */*',
1582
+ 'Content-Type': undefined
1583
+ }
1584
+ }
1585
+ };
1586
+
1587
+ utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
1588
+ defaults.headers[method] = {};
1589
+ });
1590
+
1591
+ const defaults$1 = defaults;
1592
+
1593
+ // RawAxiosHeaders whose duplicates are ignored by node
1594
+ // c.f. https://nodejs.org/api/http.html#http_message_headers
1595
+ const ignoreDuplicateOf = utils$1.toObjectSet([
1596
+ 'age', 'authorization', 'content-length', 'content-type', 'etag',
1597
+ 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
1598
+ 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
1599
+ 'referer', 'retry-after', 'user-agent'
1600
+ ]);
1601
+
1602
+ /**
1603
+ * Parse headers into an object
1604
+ *
1605
+ * ```
1606
+ * Date: Wed, 27 Aug 2014 08:58:49 GMT
1607
+ * Content-Type: application/json
1608
+ * Connection: keep-alive
1609
+ * Transfer-Encoding: chunked
1610
+ * ```
1611
+ *
1612
+ * @param {String} rawHeaders Headers needing to be parsed
1613
+ *
1614
+ * @returns {Object} Headers parsed into an object
1615
+ */
1616
+ const parseHeaders = rawHeaders => {
1617
+ const parsed = {};
1618
+ let key;
1619
+ let val;
1620
+ let i;
1621
+
1622
+ rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
1623
+ i = line.indexOf(':');
1624
+ key = line.substring(0, i).trim().toLowerCase();
1625
+ val = line.substring(i + 1).trim();
1626
+
1627
+ if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
1628
+ return;
1629
+ }
1630
+
1631
+ if (key === 'set-cookie') {
1632
+ if (parsed[key]) {
1633
+ parsed[key].push(val);
1634
+ } else {
1635
+ parsed[key] = [val];
1636
+ }
1637
+ } else {
1638
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
1639
+ }
1640
+ });
1641
+
1642
+ return parsed;
1643
+ };
1644
+
1645
+ const $internals = Symbol('internals');
1646
+
1647
+ function normalizeHeader(header) {
1648
+ return header && String(header).trim().toLowerCase();
1649
+ }
1650
+
1651
+ function normalizeValue(value) {
1652
+ if (value === false || value == null) {
1653
+ return value;
1654
+ }
1655
+
1656
+ return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
1657
+ }
1658
+
1659
+ function parseTokens(str) {
1660
+ const tokens = Object.create(null);
1661
+ const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
1662
+ let match;
1663
+
1664
+ while ((match = tokensRE.exec(str))) {
1665
+ tokens[match[1]] = match[2];
1666
+ }
1667
+
1668
+ return tokens;
1669
+ }
1670
+
1671
+ const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
1672
+
1673
+ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
1674
+ if (utils$1.isFunction(filter)) {
1675
+ return filter.call(this, value, header);
1676
+ }
1677
+
1678
+ if (isHeaderNameFilter) {
1679
+ value = header;
1680
+ }
1681
+
1682
+ if (!utils$1.isString(value)) return;
1683
+
1684
+ if (utils$1.isString(filter)) {
1685
+ return value.indexOf(filter) !== -1;
1686
+ }
1687
+
1688
+ if (utils$1.isRegExp(filter)) {
1689
+ return filter.test(value);
1690
+ }
1691
+ }
1692
+
1693
+ function formatHeader(header) {
1694
+ return header.trim()
1695
+ .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
1696
+ return char.toUpperCase() + str;
1697
+ });
1698
+ }
1699
+
1700
+ function buildAccessors(obj, header) {
1701
+ const accessorName = utils$1.toCamelCase(' ' + header);
1702
+
1703
+ ['get', 'set', 'has'].forEach(methodName => {
1704
+ Object.defineProperty(obj, methodName + accessorName, {
1705
+ value: function(arg1, arg2, arg3) {
1706
+ return this[methodName].call(this, header, arg1, arg2, arg3);
1707
+ },
1708
+ configurable: true
1709
+ });
1710
+ });
1711
+ }
1712
+
1713
+ class AxiosHeaders {
1714
+ constructor(headers) {
1715
+ headers && this.set(headers);
1716
+ }
1717
+
1718
+ set(header, valueOrRewrite, rewrite) {
1719
+ const self = this;
1720
+
1721
+ function setHeader(_value, _header, _rewrite) {
1722
+ const lHeader = normalizeHeader(_header);
1723
+
1724
+ if (!lHeader) {
1725
+ throw new Error('header name must be a non-empty string');
1726
+ }
1727
+
1728
+ const key = utils$1.findKey(self, lHeader);
1729
+
1730
+ if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
1731
+ self[key || _header] = normalizeValue(_value);
1732
+ }
1733
+ }
1734
+
1735
+ const setHeaders = (headers, _rewrite) =>
1736
+ utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
1737
+
1738
+ if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
1739
+ setHeaders(header, valueOrRewrite);
1740
+ } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1741
+ setHeaders(parseHeaders(header), valueOrRewrite);
1742
+ } else if (utils$1.isHeaders(header)) {
1743
+ for (const [key, value] of header.entries()) {
1744
+ setHeader(value, key, rewrite);
1745
+ }
1746
+ } else {
1747
+ header != null && setHeader(valueOrRewrite, header, rewrite);
1748
+ }
1749
+
1750
+ return this;
1751
+ }
1752
+
1753
+ get(header, parser) {
1754
+ header = normalizeHeader(header);
1755
+
1756
+ if (header) {
1757
+ const key = utils$1.findKey(this, header);
1758
+
1759
+ if (key) {
1760
+ const value = this[key];
1761
+
1762
+ if (!parser) {
1763
+ return value;
1764
+ }
1765
+
1766
+ if (parser === true) {
1767
+ return parseTokens(value);
1768
+ }
1769
+
1770
+ if (utils$1.isFunction(parser)) {
1771
+ return parser.call(this, value, key);
1772
+ }
1773
+
1774
+ if (utils$1.isRegExp(parser)) {
1775
+ return parser.exec(value);
1776
+ }
1777
+
1778
+ throw new TypeError('parser must be boolean|regexp|function');
1779
+ }
1780
+ }
1781
+ }
1782
+
1783
+ has(header, matcher) {
1784
+ header = normalizeHeader(header);
1785
+
1786
+ if (header) {
1787
+ const key = utils$1.findKey(this, header);
1788
+
1789
+ return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
1790
+ }
1791
+
1792
+ return false;
1793
+ }
1794
+
1795
+ delete(header, matcher) {
1796
+ const self = this;
1797
+ let deleted = false;
1798
+
1799
+ function deleteHeader(_header) {
1800
+ _header = normalizeHeader(_header);
1801
+
1802
+ if (_header) {
1803
+ const key = utils$1.findKey(self, _header);
1804
+
1805
+ if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
1806
+ delete self[key];
1807
+
1808
+ deleted = true;
1809
+ }
1810
+ }
1811
+ }
1812
+
1813
+ if (utils$1.isArray(header)) {
1814
+ header.forEach(deleteHeader);
1815
+ } else {
1816
+ deleteHeader(header);
1817
+ }
1818
+
1819
+ return deleted;
1820
+ }
1821
+
1822
+ clear(matcher) {
1823
+ const keys = Object.keys(this);
1824
+ let i = keys.length;
1825
+ let deleted = false;
1826
+
1827
+ while (i--) {
1828
+ const key = keys[i];
1829
+ if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
1830
+ delete this[key];
1831
+ deleted = true;
1832
+ }
1833
+ }
1834
+
1835
+ return deleted;
1836
+ }
1837
+
1838
+ normalize(format) {
1839
+ const self = this;
1840
+ const headers = {};
1841
+
1842
+ utils$1.forEach(this, (value, header) => {
1843
+ const key = utils$1.findKey(headers, header);
1844
+
1845
+ if (key) {
1846
+ self[key] = normalizeValue(value);
1847
+ delete self[header];
1848
+ return;
1849
+ }
1850
+
1851
+ const normalized = format ? formatHeader(header) : String(header).trim();
1852
+
1853
+ if (normalized !== header) {
1854
+ delete self[header];
1855
+ }
1856
+
1857
+ self[normalized] = normalizeValue(value);
1858
+
1859
+ headers[normalized] = true;
1860
+ });
1861
+
1862
+ return this;
1863
+ }
1864
+
1865
+ concat(...targets) {
1866
+ return this.constructor.concat(this, ...targets);
1867
+ }
1868
+
1869
+ toJSON(asStrings) {
1870
+ const obj = Object.create(null);
1871
+
1872
+ utils$1.forEach(this, (value, header) => {
1873
+ value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
1874
+ });
1875
+
1876
+ return obj;
1877
+ }
1878
+
1879
+ [Symbol.iterator]() {
1880
+ return Object.entries(this.toJSON())[Symbol.iterator]();
1881
+ }
1882
+
1883
+ toString() {
1884
+ return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
1885
+ }
1886
+
1887
+ get [Symbol.toStringTag]() {
1888
+ return 'AxiosHeaders';
1889
+ }
1890
+
1891
+ static from(thing) {
1892
+ return thing instanceof this ? thing : new this(thing);
1893
+ }
1894
+
1895
+ static concat(first, ...targets) {
1896
+ const computed = new this(first);
1897
+
1898
+ targets.forEach((target) => computed.set(target));
1899
+
1900
+ return computed;
1901
+ }
1902
+
1903
+ static accessor(header) {
1904
+ const internals = this[$internals] = (this[$internals] = {
1905
+ accessors: {}
1906
+ });
1907
+
1908
+ const accessors = internals.accessors;
1909
+ const prototype = this.prototype;
1910
+
1911
+ function defineAccessor(_header) {
1912
+ const lHeader = normalizeHeader(_header);
1913
+
1914
+ if (!accessors[lHeader]) {
1915
+ buildAccessors(prototype, _header);
1916
+ accessors[lHeader] = true;
1917
+ }
1918
+ }
1919
+
1920
+ utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
1921
+
1922
+ return this;
1923
+ }
1924
+ }
1925
+
1926
+ AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
1927
+
1928
+ // reserved names hotfix
1929
+ utils$1.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
1930
+ let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
1931
+ return {
1932
+ get: () => value,
1933
+ set(headerValue) {
1934
+ this[mapped] = headerValue;
1935
+ }
1936
+ }
1937
+ });
1938
+
1939
+ utils$1.freezeMethods(AxiosHeaders);
1940
+
1941
+ const AxiosHeaders$1 = AxiosHeaders;
1942
+
1943
+ /**
1944
+ * Transform the data for a request or a response
1945
+ *
1946
+ * @param {Array|Function} fns A single function or Array of functions
1947
+ * @param {?Object} response The response object
1948
+ *
1949
+ * @returns {*} The resulting transformed data
1950
+ */
1951
+ function transformData(fns, response) {
1952
+ const config = this || defaults$1;
1953
+ const context = response || config;
1954
+ const headers = AxiosHeaders$1.from(context.headers);
1955
+ let data = context.data;
1956
+
1957
+ utils$1.forEach(fns, function transform(fn) {
1958
+ data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
1959
+ });
1960
+
1961
+ headers.normalize();
1962
+
1963
+ return data;
1964
+ }
1965
+
1966
+ function isCancel(value) {
1967
+ return !!(value && value.__CANCEL__);
1968
+ }
1969
+
1970
+ /**
1971
+ * A `CanceledError` is an object that is thrown when an operation is canceled.
1972
+ *
1973
+ * @param {string=} message The message.
1974
+ * @param {Object=} config The config.
1975
+ * @param {Object=} request The request.
1976
+ *
1977
+ * @returns {CanceledError} The created error.
1978
+ */
1979
+ function CanceledError(message, config, request) {
1980
+ // eslint-disable-next-line no-eq-null,eqeqeq
1981
+ AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
1982
+ this.name = 'CanceledError';
1983
+ }
1984
+
1985
+ utils$1.inherits(CanceledError, AxiosError, {
1986
+ __CANCEL__: true
1987
+ });
1988
+
1989
+ /**
1990
+ * Resolve or reject a Promise based on response status.
1991
+ *
1992
+ * @param {Function} resolve A function that resolves the promise.
1993
+ * @param {Function} reject A function that rejects the promise.
1994
+ * @param {object} response The response.
1995
+ *
1996
+ * @returns {object} The response.
1997
+ */
1998
+ function settle(resolve, reject, response) {
1999
+ const validateStatus = response.config.validateStatus;
2000
+ if (!response.status || !validateStatus || validateStatus(response.status)) {
2001
+ resolve(response);
2002
+ } else {
2003
+ reject(new AxiosError(
2004
+ 'Request failed with status code ' + response.status,
2005
+ [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
2006
+ response.config,
2007
+ response.request,
2008
+ response
2009
+ ));
2010
+ }
2011
+ }
2012
+
2013
+ function parseProtocol(url) {
2014
+ const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
2015
+ return match && match[1] || '';
2016
+ }
2017
+
2018
+ /**
2019
+ * Calculate data maxRate
2020
+ * @param {Number} [samplesCount= 10]
2021
+ * @param {Number} [min= 1000]
2022
+ * @returns {Function}
2023
+ */
2024
+ function speedometer(samplesCount, min) {
2025
+ samplesCount = samplesCount || 10;
2026
+ const bytes = new Array(samplesCount);
2027
+ const timestamps = new Array(samplesCount);
2028
+ let head = 0;
2029
+ let tail = 0;
2030
+ let firstSampleTS;
2031
+
2032
+ min = min !== undefined ? min : 1000;
2033
+
2034
+ return function push(chunkLength) {
2035
+ const now = Date.now();
2036
+
2037
+ const startedAt = timestamps[tail];
2038
+
2039
+ if (!firstSampleTS) {
2040
+ firstSampleTS = now;
2041
+ }
2042
+
2043
+ bytes[head] = chunkLength;
2044
+ timestamps[head] = now;
2045
+
2046
+ let i = tail;
2047
+ let bytesCount = 0;
2048
+
2049
+ while (i !== head) {
2050
+ bytesCount += bytes[i++];
2051
+ i = i % samplesCount;
2052
+ }
2053
+
2054
+ head = (head + 1) % samplesCount;
2055
+
2056
+ if (head === tail) {
2057
+ tail = (tail + 1) % samplesCount;
2058
+ }
2059
+
2060
+ if (now - firstSampleTS < min) {
2061
+ return;
2062
+ }
2063
+
2064
+ const passed = startedAt && now - startedAt;
2065
+
2066
+ return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
2067
+ };
2068
+ }
2069
+
2070
+ /**
2071
+ * Throttle decorator
2072
+ * @param {Function} fn
2073
+ * @param {Number} freq
2074
+ * @return {Function}
2075
+ */
2076
+ function throttle(fn, freq) {
2077
+ let timestamp = 0;
2078
+ let threshold = 1000 / freq;
2079
+ let lastArgs;
2080
+ let timer;
2081
+
2082
+ const invoke = (args, now = Date.now()) => {
2083
+ timestamp = now;
2084
+ lastArgs = null;
2085
+ if (timer) {
2086
+ clearTimeout(timer);
2087
+ timer = null;
2088
+ }
2089
+ fn.apply(null, args);
2090
+ };
2091
+
2092
+ const throttled = (...args) => {
2093
+ const now = Date.now();
2094
+ const passed = now - timestamp;
2095
+ if ( passed >= threshold) {
2096
+ invoke(args, now);
2097
+ } else {
2098
+ lastArgs = args;
2099
+ if (!timer) {
2100
+ timer = setTimeout(() => {
2101
+ timer = null;
2102
+ invoke(lastArgs);
2103
+ }, threshold - passed);
2104
+ }
2105
+ }
2106
+ };
2107
+
2108
+ const flush = () => lastArgs && invoke(lastArgs);
2109
+
2110
+ return [throttled, flush];
2111
+ }
2112
+
2113
+ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
2114
+ let bytesNotified = 0;
2115
+ const _speedometer = speedometer(50, 250);
2116
+
2117
+ return throttle(e => {
2118
+ const loaded = e.loaded;
2119
+ const total = e.lengthComputable ? e.total : undefined;
2120
+ const progressBytes = loaded - bytesNotified;
2121
+ const rate = _speedometer(progressBytes);
2122
+ const inRange = loaded <= total;
2123
+
2124
+ bytesNotified = loaded;
2125
+
2126
+ const data = {
2127
+ loaded,
2128
+ total,
2129
+ progress: total ? (loaded / total) : undefined,
2130
+ bytes: progressBytes,
2131
+ rate: rate ? rate : undefined,
2132
+ estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
2133
+ event: e,
2134
+ lengthComputable: total != null,
2135
+ [isDownloadStream ? 'download' : 'upload']: true
2136
+ };
2137
+
2138
+ listener(data);
2139
+ }, freq);
2140
+ };
2141
+
2142
+ const progressEventDecorator = (total, throttled) => {
2143
+ const lengthComputable = total != null;
2144
+
2145
+ return [(loaded) => throttled[0]({
2146
+ lengthComputable,
2147
+ total,
2148
+ loaded
2149
+ }), throttled[1]];
2150
+ };
2151
+
2152
+ const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
2153
+
2154
+ const isURLSameOrigin = platform.hasStandardBrowserEnv ?
2155
+
2156
+ // Standard browser envs have full support of the APIs needed to test
2157
+ // whether the request URL is of the same origin as current location.
2158
+ (function standardBrowserEnv() {
2159
+ const msie = platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent);
2160
+ const urlParsingNode = document.createElement('a');
2161
+ let originURL;
2162
+
2163
+ /**
2164
+ * Parse a URL to discover its components
2165
+ *
2166
+ * @param {String} url The URL to be parsed
2167
+ * @returns {Object}
2168
+ */
2169
+ function resolveURL(url) {
2170
+ let href = url;
2171
+
2172
+ if (msie) {
2173
+ // IE needs attribute set twice to normalize properties
2174
+ urlParsingNode.setAttribute('href', href);
2175
+ href = urlParsingNode.href;
2176
+ }
2177
+
2178
+ urlParsingNode.setAttribute('href', href);
2179
+
2180
+ // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
2181
+ return {
2182
+ href: urlParsingNode.href,
2183
+ protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
2184
+ host: urlParsingNode.host,
2185
+ search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
2186
+ hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
2187
+ hostname: urlParsingNode.hostname,
2188
+ port: urlParsingNode.port,
2189
+ pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
2190
+ urlParsingNode.pathname :
2191
+ '/' + urlParsingNode.pathname
2192
+ };
2193
+ }
2194
+
2195
+ originURL = resolveURL(window.location.href);
2196
+
2197
+ /**
2198
+ * Determine if a URL shares the same origin as the current location
2199
+ *
2200
+ * @param {String} requestURL The URL to test
2201
+ * @returns {boolean} True if URL shares the same origin, otherwise false
2202
+ */
2203
+ return function isURLSameOrigin(requestURL) {
2204
+ const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
2205
+ return (parsed.protocol === originURL.protocol &&
2206
+ parsed.host === originURL.host);
2207
+ };
2208
+ })() :
2209
+
2210
+ // Non standard browser envs (web workers, react-native) lack needed support.
2211
+ (function nonStandardBrowserEnv() {
2212
+ return function isURLSameOrigin() {
2213
+ return true;
2214
+ };
2215
+ })();
2216
+
2217
+ const cookies = platform.hasStandardBrowserEnv ?
2218
+
2219
+ // Standard browser envs support document.cookie
2220
+ {
2221
+ write(name, value, expires, path, domain, secure) {
2222
+ const cookie = [name + '=' + encodeURIComponent(value)];
2223
+
2224
+ utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
2225
+
2226
+ utils$1.isString(path) && cookie.push('path=' + path);
2227
+
2228
+ utils$1.isString(domain) && cookie.push('domain=' + domain);
2229
+
2230
+ secure === true && cookie.push('secure');
2231
+
2232
+ document.cookie = cookie.join('; ');
2233
+ },
2234
+
2235
+ read(name) {
2236
+ const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
2237
+ return (match ? decodeURIComponent(match[3]) : null);
2238
+ },
2239
+
2240
+ remove(name) {
2241
+ this.write(name, '', Date.now() - 86400000);
2242
+ }
2243
+ }
2244
+
2245
+ :
2246
+
2247
+ // Non-standard browser env (web workers, react-native) lack needed support.
2248
+ {
2249
+ write() {},
2250
+ read() {
2251
+ return null;
2252
+ },
2253
+ remove() {}
2254
+ };
2255
+
2256
+ /**
2257
+ * Determines whether the specified URL is absolute
2258
+ *
2259
+ * @param {string} url The URL to test
2260
+ *
2261
+ * @returns {boolean} True if the specified URL is absolute, otherwise false
2262
+ */
2263
+ function isAbsoluteURL(url) {
2264
+ // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
2265
+ // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
2266
+ // by any combination of letters, digits, plus, period, or hyphen.
2267
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
2268
+ }
2269
+
2270
+ /**
2271
+ * Creates a new URL by combining the specified URLs
2272
+ *
2273
+ * @param {string} baseURL The base URL
2274
+ * @param {string} relativeURL The relative URL
2275
+ *
2276
+ * @returns {string} The combined URL
2277
+ */
2278
+ function combineURLs(baseURL, relativeURL) {
2279
+ return relativeURL
2280
+ ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
2281
+ : baseURL;
2282
+ }
2283
+
2284
+ /**
2285
+ * Creates a new URL by combining the baseURL with the requestedURL,
2286
+ * only when the requestedURL is not already an absolute URL.
2287
+ * If the requestURL is absolute, this function returns the requestedURL untouched.
2288
+ *
2289
+ * @param {string} baseURL The base URL
2290
+ * @param {string} requestedURL Absolute or relative URL to combine
2291
+ *
2292
+ * @returns {string} The combined full path
2293
+ */
2294
+ function buildFullPath(baseURL, requestedURL) {
2295
+ if (baseURL && !isAbsoluteURL(requestedURL)) {
2296
+ return combineURLs(baseURL, requestedURL);
2297
+ }
2298
+ return requestedURL;
2299
+ }
2300
+
2301
+ const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
2302
+
2303
+ /**
2304
+ * Config-specific merge-function which creates a new config-object
2305
+ * by merging two configuration objects together.
2306
+ *
2307
+ * @param {Object} config1
2308
+ * @param {Object} config2
2309
+ *
2310
+ * @returns {Object} New object resulting from merging config2 to config1
2311
+ */
2312
+ function mergeConfig(config1, config2) {
2313
+ // eslint-disable-next-line no-param-reassign
2314
+ config2 = config2 || {};
2315
+ const config = {};
2316
+
2317
+ function getMergedValue(target, source, caseless) {
2318
+ if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
2319
+ return utils$1.merge.call({caseless}, target, source);
2320
+ } else if (utils$1.isPlainObject(source)) {
2321
+ return utils$1.merge({}, source);
2322
+ } else if (utils$1.isArray(source)) {
2323
+ return source.slice();
2324
+ }
2325
+ return source;
2326
+ }
2327
+
2328
+ // eslint-disable-next-line consistent-return
2329
+ function mergeDeepProperties(a, b, caseless) {
2330
+ if (!utils$1.isUndefined(b)) {
2331
+ return getMergedValue(a, b, caseless);
2332
+ } else if (!utils$1.isUndefined(a)) {
2333
+ return getMergedValue(undefined, a, caseless);
2334
+ }
2335
+ }
2336
+
2337
+ // eslint-disable-next-line consistent-return
2338
+ function valueFromConfig2(a, b) {
2339
+ if (!utils$1.isUndefined(b)) {
2340
+ return getMergedValue(undefined, b);
2341
+ }
2342
+ }
2343
+
2344
+ // eslint-disable-next-line consistent-return
2345
+ function defaultToConfig2(a, b) {
2346
+ if (!utils$1.isUndefined(b)) {
2347
+ return getMergedValue(undefined, b);
2348
+ } else if (!utils$1.isUndefined(a)) {
2349
+ return getMergedValue(undefined, a);
2350
+ }
2351
+ }
2352
+
2353
+ // eslint-disable-next-line consistent-return
2354
+ function mergeDirectKeys(a, b, prop) {
2355
+ if (prop in config2) {
2356
+ return getMergedValue(a, b);
2357
+ } else if (prop in config1) {
2358
+ return getMergedValue(undefined, a);
2359
+ }
2360
+ }
2361
+
2362
+ const mergeMap = {
2363
+ url: valueFromConfig2,
2364
+ method: valueFromConfig2,
2365
+ data: valueFromConfig2,
2366
+ baseURL: defaultToConfig2,
2367
+ transformRequest: defaultToConfig2,
2368
+ transformResponse: defaultToConfig2,
2369
+ paramsSerializer: defaultToConfig2,
2370
+ timeout: defaultToConfig2,
2371
+ timeoutMessage: defaultToConfig2,
2372
+ withCredentials: defaultToConfig2,
2373
+ withXSRFToken: defaultToConfig2,
2374
+ adapter: defaultToConfig2,
2375
+ responseType: defaultToConfig2,
2376
+ xsrfCookieName: defaultToConfig2,
2377
+ xsrfHeaderName: defaultToConfig2,
2378
+ onUploadProgress: defaultToConfig2,
2379
+ onDownloadProgress: defaultToConfig2,
2380
+ decompress: defaultToConfig2,
2381
+ maxContentLength: defaultToConfig2,
2382
+ maxBodyLength: defaultToConfig2,
2383
+ beforeRedirect: defaultToConfig2,
2384
+ transport: defaultToConfig2,
2385
+ httpAgent: defaultToConfig2,
2386
+ httpsAgent: defaultToConfig2,
2387
+ cancelToken: defaultToConfig2,
2388
+ socketPath: defaultToConfig2,
2389
+ responseEncoding: defaultToConfig2,
2390
+ validateStatus: mergeDirectKeys,
2391
+ headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
2392
+ };
2393
+
2394
+ utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
2395
+ const merge = mergeMap[prop] || mergeDeepProperties;
2396
+ const configValue = merge(config1[prop], config2[prop], prop);
2397
+ (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
2398
+ });
2399
+
2400
+ return config;
2401
+ }
2402
+
2403
+ const resolveConfig = (config) => {
2404
+ const newConfig = mergeConfig({}, config);
2405
+
2406
+ let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
2407
+
2408
+ newConfig.headers = headers = AxiosHeaders$1.from(headers);
2409
+
2410
+ newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
2411
+
2412
+ // HTTP basic authentication
2413
+ if (auth) {
2414
+ headers.set('Authorization', 'Basic ' +
2415
+ btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))
2416
+ );
2417
+ }
2418
+
2419
+ let contentType;
2420
+
2421
+ if (utils$1.isFormData(data)) {
2422
+ if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
2423
+ headers.setContentType(undefined); // Let the browser set it
2424
+ } else if ((contentType = headers.getContentType()) !== false) {
2425
+ // fix semicolon duplication issue for ReactNative FormData implementation
2426
+ const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
2427
+ headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
2428
+ }
2429
+ }
2430
+
2431
+ // Add xsrf header
2432
+ // This is only done if running in a standard browser environment.
2433
+ // Specifically not if we're in a web worker, or react-native.
2434
+
2435
+ if (platform.hasStandardBrowserEnv) {
2436
+ withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
2437
+
2438
+ if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
2439
+ // Add xsrf header
2440
+ const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
2441
+
2442
+ if (xsrfValue) {
2443
+ headers.set(xsrfHeaderName, xsrfValue);
2444
+ }
2445
+ }
2446
+ }
2447
+
2448
+ return newConfig;
2449
+ };
2450
+
2451
+ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
2452
+
2453
+ const xhrAdapter = isXHRAdapterSupported && function (config) {
2454
+ return new Promise(function dispatchXhrRequest(resolve, reject) {
2455
+ const _config = resolveConfig(config);
2456
+ let requestData = _config.data;
2457
+ const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
2458
+ let {responseType, onUploadProgress, onDownloadProgress} = _config;
2459
+ let onCanceled;
2460
+ let uploadThrottled, downloadThrottled;
2461
+ let flushUpload, flushDownload;
2462
+
2463
+ function done() {
2464
+ flushUpload && flushUpload(); // flush events
2465
+ flushDownload && flushDownload(); // flush events
2466
+
2467
+ _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
2468
+
2469
+ _config.signal && _config.signal.removeEventListener('abort', onCanceled);
2470
+ }
2471
+
2472
+ let request = new XMLHttpRequest();
2473
+
2474
+ request.open(_config.method.toUpperCase(), _config.url, true);
2475
+
2476
+ // Set the request timeout in MS
2477
+ request.timeout = _config.timeout;
2478
+
2479
+ function onloadend() {
2480
+ if (!request) {
2481
+ return;
2482
+ }
2483
+ // Prepare the response
2484
+ const responseHeaders = AxiosHeaders$1.from(
2485
+ 'getAllResponseHeaders' in request && request.getAllResponseHeaders()
2486
+ );
2487
+ const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
2488
+ request.responseText : request.response;
2489
+ const response = {
2490
+ data: responseData,
2491
+ status: request.status,
2492
+ statusText: request.statusText,
2493
+ headers: responseHeaders,
2494
+ config,
2495
+ request
2496
+ };
2497
+
2498
+ settle(function _resolve(value) {
2499
+ resolve(value);
2500
+ done();
2501
+ }, function _reject(err) {
2502
+ reject(err);
2503
+ done();
2504
+ }, response);
2505
+
2506
+ // Clean up request
2507
+ request = null;
2508
+ }
2509
+
2510
+ if ('onloadend' in request) {
2511
+ // Use onloadend if available
2512
+ request.onloadend = onloadend;
2513
+ } else {
2514
+ // Listen for ready state to emulate onloadend
2515
+ request.onreadystatechange = function handleLoad() {
2516
+ if (!request || request.readyState !== 4) {
2517
+ return;
2518
+ }
2519
+
2520
+ // The request errored out and we didn't get a response, this will be
2521
+ // handled by onerror instead
2522
+ // With one exception: request that using file: protocol, most browsers
2523
+ // will return status as 0 even though it's a successful request
2524
+ if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
2525
+ return;
2526
+ }
2527
+ // readystate handler is calling before onerror or ontimeout handlers,
2528
+ // so we should call onloadend on the next 'tick'
2529
+ setTimeout(onloadend);
2530
+ };
2531
+ }
2532
+
2533
+ // Handle browser request cancellation (as opposed to a manual cancellation)
2534
+ request.onabort = function handleAbort() {
2535
+ if (!request) {
2536
+ return;
2537
+ }
2538
+
2539
+ reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
2540
+
2541
+ // Clean up request
2542
+ request = null;
2543
+ };
2544
+
2545
+ // Handle low level network errors
2546
+ request.onerror = function handleError() {
2547
+ // Real errors are hidden from us by the browser
2548
+ // onerror should only fire if it's a network error
2549
+ reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
2550
+
2551
+ // Clean up request
2552
+ request = null;
2553
+ };
2554
+
2555
+ // Handle timeout
2556
+ request.ontimeout = function handleTimeout() {
2557
+ let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
2558
+ const transitional = _config.transitional || transitionalDefaults;
2559
+ if (_config.timeoutErrorMessage) {
2560
+ timeoutErrorMessage = _config.timeoutErrorMessage;
2561
+ }
2562
+ reject(new AxiosError(
2563
+ timeoutErrorMessage,
2564
+ transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
2565
+ config,
2566
+ request));
2567
+
2568
+ // Clean up request
2569
+ request = null;
2570
+ };
2571
+
2572
+ // Remove Content-Type if data is undefined
2573
+ requestData === undefined && requestHeaders.setContentType(null);
2574
+
2575
+ // Add headers to the request
2576
+ if ('setRequestHeader' in request) {
2577
+ utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
2578
+ request.setRequestHeader(key, val);
2579
+ });
2580
+ }
2581
+
2582
+ // Add withCredentials to request if needed
2583
+ if (!utils$1.isUndefined(_config.withCredentials)) {
2584
+ request.withCredentials = !!_config.withCredentials;
2585
+ }
2586
+
2587
+ // Add responseType to request if needed
2588
+ if (responseType && responseType !== 'json') {
2589
+ request.responseType = _config.responseType;
2590
+ }
2591
+
2592
+ // Handle progress if needed
2593
+ if (onDownloadProgress) {
2594
+ ([downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true));
2595
+ request.addEventListener('progress', downloadThrottled);
2596
+ }
2597
+
2598
+ // Not all browsers support upload events
2599
+ if (onUploadProgress && request.upload) {
2600
+ ([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress));
2601
+
2602
+ request.upload.addEventListener('progress', uploadThrottled);
2603
+
2604
+ request.upload.addEventListener('loadend', flushUpload);
2605
+ }
2606
+
2607
+ if (_config.cancelToken || _config.signal) {
2608
+ // Handle cancellation
2609
+ // eslint-disable-next-line func-names
2610
+ onCanceled = cancel => {
2611
+ if (!request) {
2612
+ return;
2613
+ }
2614
+ reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
2615
+ request.abort();
2616
+ request = null;
2617
+ };
2618
+
2619
+ _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
2620
+ if (_config.signal) {
2621
+ _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
2622
+ }
2623
+ }
2624
+
2625
+ const protocol = parseProtocol(_config.url);
2626
+
2627
+ if (protocol && platform.protocols.indexOf(protocol) === -1) {
2628
+ reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
2629
+ return;
2630
+ }
2631
+
2632
+
2633
+ // Send the request
2634
+ request.send(requestData || null);
2635
+ });
2636
+ };
2637
+
2638
+ const composeSignals = (signals, timeout) => {
2639
+ const {length} = (signals = signals ? signals.filter(Boolean) : []);
2640
+
2641
+ if (timeout || length) {
2642
+ let controller = new AbortController();
2643
+
2644
+ let aborted;
2645
+
2646
+ const onabort = function (reason) {
2647
+ if (!aborted) {
2648
+ aborted = true;
2649
+ unsubscribe();
2650
+ const err = reason instanceof Error ? reason : this.reason;
2651
+ controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
2652
+ }
2653
+ };
2654
+
2655
+ let timer = timeout && setTimeout(() => {
2656
+ timer = null;
2657
+ onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT));
2658
+ }, timeout);
2659
+
2660
+ const unsubscribe = () => {
2661
+ if (signals) {
2662
+ timer && clearTimeout(timer);
2663
+ timer = null;
2664
+ signals.forEach(signal => {
2665
+ signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
2666
+ });
2667
+ signals = null;
2668
+ }
2669
+ };
2670
+
2671
+ signals.forEach((signal) => signal.addEventListener('abort', onabort));
2672
+
2673
+ const {signal} = controller;
2674
+
2675
+ signal.unsubscribe = () => utils$1.asap(unsubscribe);
2676
+
2677
+ return signal;
2678
+ }
2679
+ };
2680
+
2681
+ const composeSignals$1 = composeSignals;
2682
+
2683
+ const streamChunk = function* (chunk, chunkSize) {
2684
+ let len = chunk.byteLength;
2685
+
2686
+ if (!chunkSize || len < chunkSize) {
2687
+ yield chunk;
2688
+ return;
2689
+ }
2690
+
2691
+ let pos = 0;
2692
+ let end;
2693
+
2694
+ while (pos < len) {
2695
+ end = pos + chunkSize;
2696
+ yield chunk.slice(pos, end);
2697
+ pos = end;
2698
+ }
2699
+ };
2700
+
2701
+ const readBytes = async function* (iterable, chunkSize) {
2702
+ for await (const chunk of readStream(iterable)) {
2703
+ yield* streamChunk(chunk, chunkSize);
2704
+ }
2705
+ };
2706
+
2707
+ const readStream = async function* (stream) {
2708
+ if (stream[Symbol.asyncIterator]) {
2709
+ yield* stream;
2710
+ return;
2711
+ }
2712
+
2713
+ const reader = stream.getReader();
2714
+ try {
2715
+ for (;;) {
2716
+ const {done, value} = await reader.read();
2717
+ if (done) {
2718
+ break;
2719
+ }
2720
+ yield value;
2721
+ }
2722
+ } finally {
2723
+ await reader.cancel();
2724
+ }
2725
+ };
2726
+
2727
+ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
2728
+ const iterator = readBytes(stream, chunkSize);
2729
+
2730
+ let bytes = 0;
2731
+ let done;
2732
+ let _onFinish = (e) => {
2733
+ if (!done) {
2734
+ done = true;
2735
+ onFinish && onFinish(e);
2736
+ }
2737
+ };
2738
+
2739
+ return new ReadableStream({
2740
+ async pull(controller) {
2741
+ try {
2742
+ const {done, value} = await iterator.next();
2743
+
2744
+ if (done) {
2745
+ _onFinish();
2746
+ controller.close();
2747
+ return;
2748
+ }
2749
+
2750
+ let len = value.byteLength;
2751
+ if (onProgress) {
2752
+ let loadedBytes = bytes += len;
2753
+ onProgress(loadedBytes);
2754
+ }
2755
+ controller.enqueue(new Uint8Array(value));
2756
+ } catch (err) {
2757
+ _onFinish(err);
2758
+ throw err;
2759
+ }
2760
+ },
2761
+ cancel(reason) {
2762
+ _onFinish(reason);
2763
+ return iterator.return();
2764
+ }
2765
+ }, {
2766
+ highWaterMark: 2
2767
+ })
2768
+ };
2769
+
2770
+ const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
2771
+ const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
2772
+
2773
+ // used only inside the fetch adapter
2774
+ const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
2775
+ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
2776
+ async (str) => new Uint8Array(await new Response(str).arrayBuffer())
2777
+ );
2778
+
2779
+ const test = (fn, ...args) => {
2780
+ try {
2781
+ return !!fn(...args);
2782
+ } catch (e) {
2783
+ return false
2784
+ }
2785
+ };
2786
+
2787
+ const supportsRequestStream = isReadableStreamSupported && test(() => {
2788
+ let duplexAccessed = false;
2789
+
2790
+ const hasContentType = new Request(platform.origin, {
2791
+ body: new ReadableStream(),
2792
+ method: 'POST',
2793
+ get duplex() {
2794
+ duplexAccessed = true;
2795
+ return 'half';
2796
+ },
2797
+ }).headers.has('Content-Type');
2798
+
2799
+ return duplexAccessed && !hasContentType;
2800
+ });
2801
+
2802
+ const DEFAULT_CHUNK_SIZE = 64 * 1024;
2803
+
2804
+ const supportsResponseStream = isReadableStreamSupported &&
2805
+ test(() => utils$1.isReadableStream(new Response('').body));
2806
+
2807
+
2808
+ const resolvers = {
2809
+ stream: supportsResponseStream && ((res) => res.body)
2810
+ };
2811
+
2812
+ isFetchSupported && (((res) => {
2813
+ ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
2814
+ !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() :
2815
+ (_, config) => {
2816
+ throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
2817
+ });
2818
+ });
2819
+ })(new Response));
2820
+
2821
+ const getBodyLength = async (body) => {
2822
+ if (body == null) {
2823
+ return 0;
2824
+ }
2825
+
2826
+ if(utils$1.isBlob(body)) {
2827
+ return body.size;
2828
+ }
2829
+
2830
+ if(utils$1.isSpecCompliantForm(body)) {
2831
+ const _request = new Request(platform.origin, {
2832
+ method: 'POST',
2833
+ body,
2834
+ });
2835
+ return (await _request.arrayBuffer()).byteLength;
2836
+ }
2837
+
2838
+ if(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
2839
+ return body.byteLength;
2840
+ }
2841
+
2842
+ if(utils$1.isURLSearchParams(body)) {
2843
+ body = body + '';
2844
+ }
2845
+
2846
+ if(utils$1.isString(body)) {
2847
+ return (await encodeText(body)).byteLength;
2848
+ }
2849
+ };
2850
+
2851
+ const resolveBodyLength = async (headers, body) => {
2852
+ const length = utils$1.toFiniteNumber(headers.getContentLength());
2853
+
2854
+ return length == null ? getBodyLength(body) : length;
2855
+ };
2856
+
2857
+ const fetchAdapter = isFetchSupported && (async (config) => {
2858
+ let {
2859
+ url,
2860
+ method,
2861
+ data,
2862
+ signal,
2863
+ cancelToken,
2864
+ timeout,
2865
+ onDownloadProgress,
2866
+ onUploadProgress,
2867
+ responseType,
2868
+ headers,
2869
+ withCredentials = 'same-origin',
2870
+ fetchOptions
2871
+ } = resolveConfig(config);
2872
+
2873
+ responseType = responseType ? (responseType + '').toLowerCase() : 'text';
2874
+
2875
+ let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
2876
+
2877
+ let request;
2878
+
2879
+ const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
2880
+ composedSignal.unsubscribe();
2881
+ });
2882
+
2883
+ let requestContentLength;
2884
+
2885
+ try {
2886
+ if (
2887
+ onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
2888
+ (requestContentLength = await resolveBodyLength(headers, data)) !== 0
2889
+ ) {
2890
+ let _request = new Request(url, {
2891
+ method: 'POST',
2892
+ body: data,
2893
+ duplex: "half"
2894
+ });
2895
+
2896
+ let contentTypeHeader;
2897
+
2898
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
2899
+ headers.setContentType(contentTypeHeader);
2900
+ }
2901
+
2902
+ if (_request.body) {
2903
+ const [onProgress, flush] = progressEventDecorator(
2904
+ requestContentLength,
2905
+ progressEventReducer(asyncDecorator(onUploadProgress))
2906
+ );
2907
+
2908
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
2909
+ }
2910
+ }
2911
+
2912
+ if (!utils$1.isString(withCredentials)) {
2913
+ withCredentials = withCredentials ? 'include' : 'omit';
2914
+ }
2915
+
2916
+ // Cloudflare Workers throws when credentials are defined
2917
+ // see https://github.com/cloudflare/workerd/issues/902
2918
+ const isCredentialsSupported = "credentials" in Request.prototype;
2919
+ request = new Request(url, {
2920
+ ...fetchOptions,
2921
+ signal: composedSignal,
2922
+ method: method.toUpperCase(),
2923
+ headers: headers.normalize().toJSON(),
2924
+ body: data,
2925
+ duplex: "half",
2926
+ credentials: isCredentialsSupported ? withCredentials : undefined
2927
+ });
2928
+
2929
+ let response = await fetch(request);
2930
+
2931
+ const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
2932
+
2933
+ if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
2934
+ const options = {};
2935
+
2936
+ ['status', 'statusText', 'headers'].forEach(prop => {
2937
+ options[prop] = response[prop];
2938
+ });
2939
+
2940
+ const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
2941
+
2942
+ const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
2943
+ responseContentLength,
2944
+ progressEventReducer(asyncDecorator(onDownloadProgress), true)
2945
+ ) || [];
2946
+
2947
+ response = new Response(
2948
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
2949
+ flush && flush();
2950
+ unsubscribe && unsubscribe();
2951
+ }),
2952
+ options
2953
+ );
2954
+ }
2955
+
2956
+ responseType = responseType || 'text';
2957
+
2958
+ let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
2959
+
2960
+ !isStreamResponse && unsubscribe && unsubscribe();
2961
+
2962
+ return await new Promise((resolve, reject) => {
2963
+ settle(resolve, reject, {
2964
+ data: responseData,
2965
+ headers: AxiosHeaders$1.from(response.headers),
2966
+ status: response.status,
2967
+ statusText: response.statusText,
2968
+ config,
2969
+ request
2970
+ });
2971
+ })
2972
+ } catch (err) {
2973
+ unsubscribe && unsubscribe();
2974
+
2975
+ if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
2976
+ throw Object.assign(
2977
+ new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
2978
+ {
2979
+ cause: err.cause || err
2980
+ }
2981
+ )
2982
+ }
2983
+
2984
+ throw AxiosError.from(err, err && err.code, config, request);
2985
+ }
2986
+ });
2987
+
2988
+ const knownAdapters = {
2989
+ http: httpAdapter,
2990
+ xhr: xhrAdapter,
2991
+ fetch: fetchAdapter
2992
+ };
2993
+
2994
+ utils$1.forEach(knownAdapters, (fn, value) => {
2995
+ if (fn) {
2996
+ try {
2997
+ Object.defineProperty(fn, 'name', {value});
2998
+ } catch (e) {
2999
+ // eslint-disable-next-line no-empty
3000
+ }
3001
+ Object.defineProperty(fn, 'adapterName', {value});
3002
+ }
3003
+ });
3004
+
3005
+ const renderReason = (reason) => `- ${reason}`;
3006
+
3007
+ const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
3008
+
3009
+ const adapters = {
3010
+ getAdapter: (adapters) => {
3011
+ adapters = utils$1.isArray(adapters) ? adapters : [adapters];
3012
+
3013
+ const {length} = adapters;
3014
+ let nameOrAdapter;
3015
+ let adapter;
3016
+
3017
+ const rejectedReasons = {};
3018
+
3019
+ for (let i = 0; i < length; i++) {
3020
+ nameOrAdapter = adapters[i];
3021
+ let id;
3022
+
3023
+ adapter = nameOrAdapter;
3024
+
3025
+ if (!isResolvedHandle(nameOrAdapter)) {
3026
+ adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
3027
+
3028
+ if (adapter === undefined) {
3029
+ throw new AxiosError(`Unknown adapter '${id}'`);
3030
+ }
3031
+ }
3032
+
3033
+ if (adapter) {
3034
+ break;
3035
+ }
3036
+
3037
+ rejectedReasons[id || '#' + i] = adapter;
3038
+ }
3039
+
3040
+ if (!adapter) {
3041
+
3042
+ const reasons = Object.entries(rejectedReasons)
3043
+ .map(([id, state]) => `adapter ${id} ` +
3044
+ (state === false ? 'is not supported by the environment' : 'is not available in the build')
3045
+ );
3046
+
3047
+ let s = length ?
3048
+ (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
3049
+ 'as no adapter specified';
3050
+
3051
+ throw new AxiosError(
3052
+ `There is no suitable adapter to dispatch the request ` + s,
3053
+ 'ERR_NOT_SUPPORT'
3054
+ );
3055
+ }
3056
+
3057
+ return adapter;
3058
+ },
3059
+ adapters: knownAdapters
3060
+ };
3061
+
3062
+ /**
3063
+ * Throws a `CanceledError` if cancellation has been requested.
3064
+ *
3065
+ * @param {Object} config The config that is to be used for the request
3066
+ *
3067
+ * @returns {void}
3068
+ */
3069
+ function throwIfCancellationRequested(config) {
3070
+ if (config.cancelToken) {
3071
+ config.cancelToken.throwIfRequested();
3072
+ }
3073
+
3074
+ if (config.signal && config.signal.aborted) {
3075
+ throw new CanceledError(null, config);
3076
+ }
3077
+ }
3078
+
3079
+ /**
3080
+ * Dispatch a request to the server using the configured adapter.
3081
+ *
3082
+ * @param {object} config The config that is to be used for the request
3083
+ *
3084
+ * @returns {Promise} The Promise to be fulfilled
3085
+ */
3086
+ function dispatchRequest(config) {
3087
+ throwIfCancellationRequested(config);
3088
+
3089
+ config.headers = AxiosHeaders$1.from(config.headers);
3090
+
3091
+ // Transform request data
3092
+ config.data = transformData.call(
3093
+ config,
3094
+ config.transformRequest
3095
+ );
3096
+
3097
+ if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
3098
+ config.headers.setContentType('application/x-www-form-urlencoded', false);
3099
+ }
3100
+
3101
+ const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
3102
+
3103
+ return adapter(config).then(function onAdapterResolution(response) {
3104
+ throwIfCancellationRequested(config);
3105
+
3106
+ // Transform response data
3107
+ response.data = transformData.call(
3108
+ config,
3109
+ config.transformResponse,
3110
+ response
3111
+ );
3112
+
3113
+ response.headers = AxiosHeaders$1.from(response.headers);
3114
+
3115
+ return response;
3116
+ }, function onAdapterRejection(reason) {
3117
+ if (!isCancel(reason)) {
3118
+ throwIfCancellationRequested(config);
3119
+
3120
+ // Transform response data
3121
+ if (reason && reason.response) {
3122
+ reason.response.data = transformData.call(
3123
+ config,
3124
+ config.transformResponse,
3125
+ reason.response
3126
+ );
3127
+ reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
3128
+ }
3129
+ }
3130
+
3131
+ return Promise.reject(reason);
3132
+ });
3133
+ }
3134
+
3135
+ const VERSION = "1.7.7";
3136
+
3137
+ const validators$1 = {};
3138
+
3139
+ // eslint-disable-next-line func-names
3140
+ ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {
3141
+ validators$1[type] = function validator(thing) {
3142
+ return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
3143
+ };
3144
+ });
3145
+
3146
+ const deprecatedWarnings = {};
3147
+
3148
+ /**
3149
+ * Transitional option validator
3150
+ *
3151
+ * @param {function|boolean?} validator - set to false if the transitional option has been removed
3152
+ * @param {string?} version - deprecated version / removed since version
3153
+ * @param {string?} message - some message with additional info
3154
+ *
3155
+ * @returns {function}
3156
+ */
3157
+ validators$1.transitional = function transitional(validator, version, message) {
3158
+ function formatMessage(opt, desc) {
3159
+ return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
3160
+ }
3161
+
3162
+ // eslint-disable-next-line func-names
3163
+ return (value, opt, opts) => {
3164
+ if (validator === false) {
3165
+ throw new AxiosError(
3166
+ formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
3167
+ AxiosError.ERR_DEPRECATED
3168
+ );
3169
+ }
3170
+
3171
+ if (version && !deprecatedWarnings[opt]) {
3172
+ deprecatedWarnings[opt] = true;
3173
+ // eslint-disable-next-line no-console
3174
+ console.warn(
3175
+ formatMessage(
3176
+ opt,
3177
+ ' has been deprecated since v' + version + ' and will be removed in the near future'
3178
+ )
3179
+ );
3180
+ }
3181
+
3182
+ return validator ? validator(value, opt, opts) : true;
3183
+ };
3184
+ };
3185
+
3186
+ /**
3187
+ * Assert object's properties type
3188
+ *
3189
+ * @param {object} options
3190
+ * @param {object} schema
3191
+ * @param {boolean?} allowUnknown
3192
+ *
3193
+ * @returns {object}
3194
+ */
3195
+
3196
+ function assertOptions(options, schema, allowUnknown) {
3197
+ if (typeof options !== 'object') {
3198
+ throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
3199
+ }
3200
+ const keys = Object.keys(options);
3201
+ let i = keys.length;
3202
+ while (i-- > 0) {
3203
+ const opt = keys[i];
3204
+ const validator = schema[opt];
3205
+ if (validator) {
3206
+ const value = options[opt];
3207
+ const result = value === undefined || validator(value, opt, options);
3208
+ if (result !== true) {
3209
+ throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
3210
+ }
3211
+ continue;
3212
+ }
3213
+ if (allowUnknown !== true) {
3214
+ throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
3215
+ }
3216
+ }
3217
+ }
3218
+
3219
+ const validator = {
3220
+ assertOptions,
3221
+ validators: validators$1
3222
+ };
3223
+
3224
+ const validators = validator.validators;
3225
+
3226
+ /**
3227
+ * Create a new instance of Axios
3228
+ *
3229
+ * @param {Object} instanceConfig The default config for the instance
3230
+ *
3231
+ * @return {Axios} A new instance of Axios
3232
+ */
3233
+ class Axios {
3234
+ constructor(instanceConfig) {
3235
+ this.defaults = instanceConfig;
3236
+ this.interceptors = {
3237
+ request: new InterceptorManager$1(),
3238
+ response: new InterceptorManager$1()
3239
+ };
3240
+ }
3241
+
3242
+ /**
3243
+ * Dispatch a request
3244
+ *
3245
+ * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
3246
+ * @param {?Object} config
3247
+ *
3248
+ * @returns {Promise} The Promise to be fulfilled
3249
+ */
3250
+ async request(configOrUrl, config) {
3251
+ try {
3252
+ return await this._request(configOrUrl, config);
3253
+ } catch (err) {
3254
+ if (err instanceof Error) {
3255
+ let dummy;
3256
+
3257
+ Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());
3258
+
3259
+ // slice off the Error: ... line
3260
+ const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
3261
+ try {
3262
+ if (!err.stack) {
3263
+ err.stack = stack;
3264
+ // match without the 2 top stack lines
3265
+ } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
3266
+ err.stack += '\n' + stack;
3267
+ }
3268
+ } catch (e) {
3269
+ // ignore the case where "stack" is an un-writable property
3270
+ }
3271
+ }
3272
+
3273
+ throw err;
3274
+ }
3275
+ }
3276
+
3277
+ _request(configOrUrl, config) {
3278
+ /*eslint no-param-reassign:0*/
3279
+ // Allow for axios('example/url'[, config]) a la fetch API
3280
+ if (typeof configOrUrl === 'string') {
3281
+ config = config || {};
3282
+ config.url = configOrUrl;
3283
+ } else {
3284
+ config = configOrUrl || {};
3285
+ }
3286
+
3287
+ config = mergeConfig(this.defaults, config);
3288
+
3289
+ const {transitional, paramsSerializer, headers} = config;
3290
+
3291
+ if (transitional !== undefined) {
3292
+ validator.assertOptions(transitional, {
3293
+ silentJSONParsing: validators.transitional(validators.boolean),
3294
+ forcedJSONParsing: validators.transitional(validators.boolean),
3295
+ clarifyTimeoutError: validators.transitional(validators.boolean)
3296
+ }, false);
3297
+ }
3298
+
3299
+ if (paramsSerializer != null) {
3300
+ if (utils$1.isFunction(paramsSerializer)) {
3301
+ config.paramsSerializer = {
3302
+ serialize: paramsSerializer
3303
+ };
3304
+ } else {
3305
+ validator.assertOptions(paramsSerializer, {
3306
+ encode: validators.function,
3307
+ serialize: validators.function
3308
+ }, true);
3309
+ }
3310
+ }
3311
+
3312
+ // Set config.method
3313
+ config.method = (config.method || this.defaults.method || 'get').toLowerCase();
3314
+
3315
+ // Flatten headers
3316
+ let contextHeaders = headers && utils$1.merge(
3317
+ headers.common,
3318
+ headers[config.method]
3319
+ );
3320
+
3321
+ headers && utils$1.forEach(
3322
+ ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
3323
+ (method) => {
3324
+ delete headers[method];
3325
+ }
3326
+ );
3327
+
3328
+ config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
3329
+
3330
+ // filter out skipped interceptors
3331
+ const requestInterceptorChain = [];
3332
+ let synchronousRequestInterceptors = true;
3333
+ this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
3334
+ if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
3335
+ return;
3336
+ }
3337
+
3338
+ synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
3339
+
3340
+ requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
3341
+ });
3342
+
3343
+ const responseInterceptorChain = [];
3344
+ this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
3345
+ responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
3346
+ });
3347
+
3348
+ let promise;
3349
+ let i = 0;
3350
+ let len;
3351
+
3352
+ if (!synchronousRequestInterceptors) {
3353
+ const chain = [dispatchRequest.bind(this), undefined];
3354
+ chain.unshift.apply(chain, requestInterceptorChain);
3355
+ chain.push.apply(chain, responseInterceptorChain);
3356
+ len = chain.length;
3357
+
3358
+ promise = Promise.resolve(config);
3359
+
3360
+ while (i < len) {
3361
+ promise = promise.then(chain[i++], chain[i++]);
3362
+ }
3363
+
3364
+ return promise;
3365
+ }
3366
+
3367
+ len = requestInterceptorChain.length;
3368
+
3369
+ let newConfig = config;
3370
+
3371
+ i = 0;
3372
+
3373
+ while (i < len) {
3374
+ const onFulfilled = requestInterceptorChain[i++];
3375
+ const onRejected = requestInterceptorChain[i++];
3376
+ try {
3377
+ newConfig = onFulfilled(newConfig);
3378
+ } catch (error) {
3379
+ onRejected.call(this, error);
3380
+ break;
3381
+ }
3382
+ }
3383
+
3384
+ try {
3385
+ promise = dispatchRequest.call(this, newConfig);
3386
+ } catch (error) {
3387
+ return Promise.reject(error);
3388
+ }
3389
+
3390
+ i = 0;
3391
+ len = responseInterceptorChain.length;
3392
+
3393
+ while (i < len) {
3394
+ promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
3395
+ }
3396
+
3397
+ return promise;
3398
+ }
3399
+
3400
+ getUri(config) {
3401
+ config = mergeConfig(this.defaults, config);
3402
+ const fullPath = buildFullPath(config.baseURL, config.url);
3403
+ return buildURL(fullPath, config.params, config.paramsSerializer);
3404
+ }
3405
+ }
3406
+
3407
+ // Provide aliases for supported request methods
3408
+ utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
3409
+ /*eslint func-names:0*/
3410
+ Axios.prototype[method] = function(url, config) {
3411
+ return this.request(mergeConfig(config || {}, {
3412
+ method,
3413
+ url,
3414
+ data: (config || {}).data
3415
+ }));
3416
+ };
3417
+ });
3418
+
3419
+ utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
3420
+ /*eslint func-names:0*/
3421
+
3422
+ function generateHTTPMethod(isForm) {
3423
+ return function httpMethod(url, data, config) {
3424
+ return this.request(mergeConfig(config || {}, {
3425
+ method,
3426
+ headers: isForm ? {
3427
+ 'Content-Type': 'multipart/form-data'
3428
+ } : {},
3429
+ url,
3430
+ data
3431
+ }));
3432
+ };
3433
+ }
3434
+
3435
+ Axios.prototype[method] = generateHTTPMethod();
3436
+
3437
+ Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
3438
+ });
3439
+
3440
+ const Axios$1 = Axios;
3441
+
3442
+ /**
3443
+ * A `CancelToken` is an object that can be used to request cancellation of an operation.
3444
+ *
3445
+ * @param {Function} executor The executor function.
3446
+ *
3447
+ * @returns {CancelToken}
3448
+ */
3449
+ class CancelToken {
3450
+ constructor(executor) {
3451
+ if (typeof executor !== 'function') {
3452
+ throw new TypeError('executor must be a function.');
3453
+ }
3454
+
3455
+ let resolvePromise;
3456
+
3457
+ this.promise = new Promise(function promiseExecutor(resolve) {
3458
+ resolvePromise = resolve;
3459
+ });
3460
+
3461
+ const token = this;
3462
+
3463
+ // eslint-disable-next-line func-names
3464
+ this.promise.then(cancel => {
3465
+ if (!token._listeners) return;
3466
+
3467
+ let i = token._listeners.length;
3468
+
3469
+ while (i-- > 0) {
3470
+ token._listeners[i](cancel);
3471
+ }
3472
+ token._listeners = null;
3473
+ });
3474
+
3475
+ // eslint-disable-next-line func-names
3476
+ this.promise.then = onfulfilled => {
3477
+ let _resolve;
3478
+ // eslint-disable-next-line func-names
3479
+ const promise = new Promise(resolve => {
3480
+ token.subscribe(resolve);
3481
+ _resolve = resolve;
3482
+ }).then(onfulfilled);
3483
+
3484
+ promise.cancel = function reject() {
3485
+ token.unsubscribe(_resolve);
3486
+ };
3487
+
3488
+ return promise;
3489
+ };
3490
+
3491
+ executor(function cancel(message, config, request) {
3492
+ if (token.reason) {
3493
+ // Cancellation has already been requested
3494
+ return;
3495
+ }
3496
+
3497
+ token.reason = new CanceledError(message, config, request);
3498
+ resolvePromise(token.reason);
3499
+ });
3500
+ }
3501
+
3502
+ /**
3503
+ * Throws a `CanceledError` if cancellation has been requested.
3504
+ */
3505
+ throwIfRequested() {
3506
+ if (this.reason) {
3507
+ throw this.reason;
3508
+ }
3509
+ }
3510
+
3511
+ /**
3512
+ * Subscribe to the cancel signal
3513
+ */
3514
+
3515
+ subscribe(listener) {
3516
+ if (this.reason) {
3517
+ listener(this.reason);
3518
+ return;
3519
+ }
3520
+
3521
+ if (this._listeners) {
3522
+ this._listeners.push(listener);
3523
+ } else {
3524
+ this._listeners = [listener];
3525
+ }
3526
+ }
3527
+
3528
+ /**
3529
+ * Unsubscribe from the cancel signal
3530
+ */
3531
+
3532
+ unsubscribe(listener) {
3533
+ if (!this._listeners) {
3534
+ return;
3535
+ }
3536
+ const index = this._listeners.indexOf(listener);
3537
+ if (index !== -1) {
3538
+ this._listeners.splice(index, 1);
3539
+ }
3540
+ }
3541
+
3542
+ toAbortSignal() {
3543
+ const controller = new AbortController();
3544
+
3545
+ const abort = (err) => {
3546
+ controller.abort(err);
3547
+ };
3548
+
3549
+ this.subscribe(abort);
3550
+
3551
+ controller.signal.unsubscribe = () => this.unsubscribe(abort);
3552
+
3553
+ return controller.signal;
3554
+ }
3555
+
3556
+ /**
3557
+ * Returns an object that contains a new `CancelToken` and a function that, when called,
3558
+ * cancels the `CancelToken`.
3559
+ */
3560
+ static source() {
3561
+ let cancel;
3562
+ const token = new CancelToken(function executor(c) {
3563
+ cancel = c;
3564
+ });
3565
+ return {
3566
+ token,
3567
+ cancel
3568
+ };
3569
+ }
3570
+ }
3571
+
3572
+ const CancelToken$1 = CancelToken;
3573
+
3574
+ /**
3575
+ * Syntactic sugar for invoking a function and expanding an array for arguments.
3576
+ *
3577
+ * Common use case would be to use `Function.prototype.apply`.
3578
+ *
3579
+ * ```js
3580
+ * function f(x, y, z) {}
3581
+ * var args = [1, 2, 3];
3582
+ * f.apply(null, args);
3583
+ * ```
3584
+ *
3585
+ * With `spread` this example can be re-written.
3586
+ *
3587
+ * ```js
3588
+ * spread(function(x, y, z) {})([1, 2, 3]);
3589
+ * ```
3590
+ *
3591
+ * @param {Function} callback
3592
+ *
3593
+ * @returns {Function}
3594
+ */
3595
+ function spread(callback) {
3596
+ return function wrap(arr) {
3597
+ return callback.apply(null, arr);
3598
+ };
3599
+ }
3600
+
3601
+ /**
3602
+ * Determines whether the payload is an error thrown by Axios
3603
+ *
3604
+ * @param {*} payload The value to test
3605
+ *
3606
+ * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
3607
+ */
3608
+ function isAxiosError(payload) {
3609
+ return utils$1.isObject(payload) && (payload.isAxiosError === true);
3610
+ }
3611
+
3612
+ const HttpStatusCode = {
3613
+ Continue: 100,
3614
+ SwitchingProtocols: 101,
3615
+ Processing: 102,
3616
+ EarlyHints: 103,
3617
+ Ok: 200,
3618
+ Created: 201,
3619
+ Accepted: 202,
3620
+ NonAuthoritativeInformation: 203,
3621
+ NoContent: 204,
3622
+ ResetContent: 205,
3623
+ PartialContent: 206,
3624
+ MultiStatus: 207,
3625
+ AlreadyReported: 208,
3626
+ ImUsed: 226,
3627
+ MultipleChoices: 300,
3628
+ MovedPermanently: 301,
3629
+ Found: 302,
3630
+ SeeOther: 303,
3631
+ NotModified: 304,
3632
+ UseProxy: 305,
3633
+ Unused: 306,
3634
+ TemporaryRedirect: 307,
3635
+ PermanentRedirect: 308,
3636
+ BadRequest: 400,
3637
+ Unauthorized: 401,
3638
+ PaymentRequired: 402,
3639
+ Forbidden: 403,
3640
+ NotFound: 404,
3641
+ MethodNotAllowed: 405,
3642
+ NotAcceptable: 406,
3643
+ ProxyAuthenticationRequired: 407,
3644
+ RequestTimeout: 408,
3645
+ Conflict: 409,
3646
+ Gone: 410,
3647
+ LengthRequired: 411,
3648
+ PreconditionFailed: 412,
3649
+ PayloadTooLarge: 413,
3650
+ UriTooLong: 414,
3651
+ UnsupportedMediaType: 415,
3652
+ RangeNotSatisfiable: 416,
3653
+ ExpectationFailed: 417,
3654
+ ImATeapot: 418,
3655
+ MisdirectedRequest: 421,
3656
+ UnprocessableEntity: 422,
3657
+ Locked: 423,
3658
+ FailedDependency: 424,
3659
+ TooEarly: 425,
3660
+ UpgradeRequired: 426,
3661
+ PreconditionRequired: 428,
3662
+ TooManyRequests: 429,
3663
+ RequestHeaderFieldsTooLarge: 431,
3664
+ UnavailableForLegalReasons: 451,
3665
+ InternalServerError: 500,
3666
+ NotImplemented: 501,
3667
+ BadGateway: 502,
3668
+ ServiceUnavailable: 503,
3669
+ GatewayTimeout: 504,
3670
+ HttpVersionNotSupported: 505,
3671
+ VariantAlsoNegotiates: 506,
3672
+ InsufficientStorage: 507,
3673
+ LoopDetected: 508,
3674
+ NotExtended: 510,
3675
+ NetworkAuthenticationRequired: 511,
3676
+ };
3677
+
3678
+ Object.entries(HttpStatusCode).forEach(([key, value]) => {
3679
+ HttpStatusCode[value] = key;
3680
+ });
3681
+
3682
+ const HttpStatusCode$1 = HttpStatusCode;
3683
+
3684
+ /**
3685
+ * Create an instance of Axios
3686
+ *
3687
+ * @param {Object} defaultConfig The default config for the instance
3688
+ *
3689
+ * @returns {Axios} A new instance of Axios
3690
+ */
3691
+ function createInstance(defaultConfig) {
3692
+ const context = new Axios$1(defaultConfig);
3693
+ const instance = bind(Axios$1.prototype.request, context);
3694
+
3695
+ // Copy axios.prototype to instance
3696
+ utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
3697
+
3698
+ // Copy context to instance
3699
+ utils$1.extend(instance, context, null, {allOwnKeys: true});
3700
+
3701
+ // Factory for creating new instances
3702
+ instance.create = function create(instanceConfig) {
3703
+ return createInstance(mergeConfig(defaultConfig, instanceConfig));
3704
+ };
3705
+
3706
+ return instance;
3707
+ }
3708
+
3709
+ // Create the default instance to be exported
3710
+ const axios = createInstance(defaults$1);
3711
+
3712
+ // Expose Axios class to allow class inheritance
3713
+ axios.Axios = Axios$1;
3714
+
3715
+ // Expose Cancel & CancelToken
3716
+ axios.CanceledError = CanceledError;
3717
+ axios.CancelToken = CancelToken$1;
3718
+ axios.isCancel = isCancel;
3719
+ axios.VERSION = VERSION;
3720
+ axios.toFormData = toFormData;
3721
+
3722
+ // Expose AxiosError class
3723
+ axios.AxiosError = AxiosError;
3724
+
3725
+ // alias for CanceledError for backward compatibility
3726
+ axios.Cancel = axios.CanceledError;
3727
+
3728
+ // Expose all/spread
3729
+ axios.all = function all(promises) {
3730
+ return Promise.all(promises);
3731
+ };
3732
+
3733
+ axios.spread = spread;
3734
+
3735
+ // Expose isAxiosError
3736
+ axios.isAxiosError = isAxiosError;
3737
+
3738
+ // Expose mergeConfig
3739
+ axios.mergeConfig = mergeConfig;
3740
+
3741
+ axios.AxiosHeaders = AxiosHeaders$1;
3742
+
3743
+ axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
3744
+
3745
+ axios.getAdapter = adapters.getAdapter;
3746
+
3747
+ axios.HttpStatusCode = HttpStatusCode$1;
3748
+
3749
+ axios.default = axios;
3750
+
3751
+ // this module should only have a default export
3752
+ const axios$1 = axios;
3753
+
3754
+ const CRM_BONUS_API_URL = "https://crmbonus-service-staging-d15ba5377115.herokuapp.com"; //"https://typically-workable-perch.ngrok-free.app"; // "http://localhost:3500";
3755
+
3756
+ class CrmBonusService {
3757
+ constructor() {
3758
+ this.axiosInstance = axios$1.create({
3759
+ baseURL: CRM_BONUS_API_URL,
3760
+ headers: {
3761
+ 'Content-Type': 'application/json',
3762
+ 'accept': 'application/json',
3763
+ },
3764
+ });
3765
+ }
3766
+ async getCustomer(userId, store) {
3767
+ const response = await this.axiosInstance.get(`/api/wake/store/${store}/customer/${userId}`, { headers: { 'Content-Type': 'application/json' } });
3768
+ console.log('response.data', response.data);
3769
+ return response.data;
3770
+ }
3771
+ async updateOrder(cartId, orderId) {
3772
+ const response = await this.axiosInstance.post("/api/crm-bonus/teste", { cartId, orderId }, { headers: { 'Content-Type': 'application/json' } });
3773
+ console.log('response', response.data);
3774
+ }
3775
+ async sendPin(phone, store) {
3776
+ const response = await this.axiosInstance.post("/api/crm-bonus/send-pin", { celular: phone, nome: "giftback" }, { headers: { store } });
3777
+ return {
3778
+ storeId: response.data.store_id,
3779
+ userId: response.data.user_id
3780
+ };
3781
+ }
3782
+ async validatePinBonus(payload, store) {
3783
+ console.log('[validatePinBonus]', payload);
3784
+ const response = await this.axiosInstance.post("/api/crm-bonus/process-pin-bonus", payload, { headers: { store } });
3785
+ return response.data;
3786
+ }
3787
+ async reserve(payload, store) {
3788
+ const response = await this.axiosInstance.post("/api/crm-bonus/redeem-bonus", payload, { headers: { store } });
3789
+ return response.data;
3790
+ }
3791
+ }
3792
+
3793
+ exports.CrmBonusService = CrmBonusService;
3794
+
3795
+ //# sourceMappingURL=crmbonus.service-a626c034.js.map