@icos-desktop/react-components 2.2.1 → 2.2.2

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