crmbonus-component-wake 0.0.7 → 0.0.9

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