crmbonus-component-wake 0.0.26 → 0.0.27

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