ztxkutils 4.0.1 → 10.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,2915 +0,0 @@
1
- import { a as __rest, _ as __assign } from './tslib.es6-35653116.js';
2
- import axios from 'axios';
3
- import { Modal, message } from 'ztxkui';
4
- import { c as commonjsGlobal, a as crypto } from './crypto-c481f616.js';
5
- import { g as getToken, r as removeToken, a as removeRefreshToken, b as getRefreshToken, s as setToken, c as setRefreshToken } from './authority-7a91cb9f.js';
6
- import { TOKEN_KEY, BASIC_KEY } from './constants.js';
7
-
8
- /**
9
- * Removes all key-value entries from the list cache.
10
- *
11
- * @private
12
- * @name clear
13
- * @memberOf ListCache
14
- */
15
-
16
- function listCacheClear$1() {
17
- this.__data__ = [];
18
- this.size = 0;
19
- }
20
-
21
- var _listCacheClear = listCacheClear$1;
22
-
23
- /**
24
- * Performs a
25
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
26
- * comparison between two values to determine if they are equivalent.
27
- *
28
- * @static
29
- * @memberOf _
30
- * @since 4.0.0
31
- * @category Lang
32
- * @param {*} value The value to compare.
33
- * @param {*} other The other value to compare.
34
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
35
- * @example
36
- *
37
- * var object = { 'a': 1 };
38
- * var other = { 'a': 1 };
39
- *
40
- * _.eq(object, object);
41
- * // => true
42
- *
43
- * _.eq(object, other);
44
- * // => false
45
- *
46
- * _.eq('a', 'a');
47
- * // => true
48
- *
49
- * _.eq('a', Object('a'));
50
- * // => false
51
- *
52
- * _.eq(NaN, NaN);
53
- * // => true
54
- */
55
-
56
- function eq$2(value, other) {
57
- return value === other || (value !== value && other !== other);
58
- }
59
-
60
- var eq_1 = eq$2;
61
-
62
- var eq$1 = eq_1;
63
-
64
- /**
65
- * Gets the index at which the `key` is found in `array` of key-value pairs.
66
- *
67
- * @private
68
- * @param {Array} array The array to inspect.
69
- * @param {*} key The key to search for.
70
- * @returns {number} Returns the index of the matched value, else `-1`.
71
- */
72
- function assocIndexOf$4(array, key) {
73
- var length = array.length;
74
- while (length--) {
75
- if (eq$1(array[length][0], key)) {
76
- return length;
77
- }
78
- }
79
- return -1;
80
- }
81
-
82
- var _assocIndexOf = assocIndexOf$4;
83
-
84
- var assocIndexOf$3 = _assocIndexOf;
85
-
86
- /** Used for built-in method references. */
87
- var arrayProto = Array.prototype;
88
-
89
- /** Built-in value references. */
90
- var splice = arrayProto.splice;
91
-
92
- /**
93
- * Removes `key` and its value from the list cache.
94
- *
95
- * @private
96
- * @name delete
97
- * @memberOf ListCache
98
- * @param {string} key The key of the value to remove.
99
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
100
- */
101
- function listCacheDelete$1(key) {
102
- var data = this.__data__,
103
- index = assocIndexOf$3(data, key);
104
-
105
- if (index < 0) {
106
- return false;
107
- }
108
- var lastIndex = data.length - 1;
109
- if (index == lastIndex) {
110
- data.pop();
111
- } else {
112
- splice.call(data, index, 1);
113
- }
114
- --this.size;
115
- return true;
116
- }
117
-
118
- var _listCacheDelete = listCacheDelete$1;
119
-
120
- var assocIndexOf$2 = _assocIndexOf;
121
-
122
- /**
123
- * Gets the list cache value for `key`.
124
- *
125
- * @private
126
- * @name get
127
- * @memberOf ListCache
128
- * @param {string} key The key of the value to get.
129
- * @returns {*} Returns the entry value.
130
- */
131
- function listCacheGet$1(key) {
132
- var data = this.__data__,
133
- index = assocIndexOf$2(data, key);
134
-
135
- return index < 0 ? undefined : data[index][1];
136
- }
137
-
138
- var _listCacheGet = listCacheGet$1;
139
-
140
- var assocIndexOf$1 = _assocIndexOf;
141
-
142
- /**
143
- * Checks if a list cache value for `key` exists.
144
- *
145
- * @private
146
- * @name has
147
- * @memberOf ListCache
148
- * @param {string} key The key of the entry to check.
149
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
150
- */
151
- function listCacheHas$1(key) {
152
- return assocIndexOf$1(this.__data__, key) > -1;
153
- }
154
-
155
- var _listCacheHas = listCacheHas$1;
156
-
157
- var assocIndexOf = _assocIndexOf;
158
-
159
- /**
160
- * Sets the list cache `key` to `value`.
161
- *
162
- * @private
163
- * @name set
164
- * @memberOf ListCache
165
- * @param {string} key The key of the value to set.
166
- * @param {*} value The value to set.
167
- * @returns {Object} Returns the list cache instance.
168
- */
169
- function listCacheSet$1(key, value) {
170
- var data = this.__data__,
171
- index = assocIndexOf(data, key);
172
-
173
- if (index < 0) {
174
- ++this.size;
175
- data.push([key, value]);
176
- } else {
177
- data[index][1] = value;
178
- }
179
- return this;
180
- }
181
-
182
- var _listCacheSet = listCacheSet$1;
183
-
184
- var listCacheClear = _listCacheClear,
185
- listCacheDelete = _listCacheDelete,
186
- listCacheGet = _listCacheGet,
187
- listCacheHas = _listCacheHas,
188
- listCacheSet = _listCacheSet;
189
-
190
- /**
191
- * Creates an list cache object.
192
- *
193
- * @private
194
- * @constructor
195
- * @param {Array} [entries] The key-value pairs to cache.
196
- */
197
- function ListCache$4(entries) {
198
- var index = -1,
199
- length = entries == null ? 0 : entries.length;
200
-
201
- this.clear();
202
- while (++index < length) {
203
- var entry = entries[index];
204
- this.set(entry[0], entry[1]);
205
- }
206
- }
207
-
208
- // Add methods to `ListCache`.
209
- ListCache$4.prototype.clear = listCacheClear;
210
- ListCache$4.prototype['delete'] = listCacheDelete;
211
- ListCache$4.prototype.get = listCacheGet;
212
- ListCache$4.prototype.has = listCacheHas;
213
- ListCache$4.prototype.set = listCacheSet;
214
-
215
- var _ListCache = ListCache$4;
216
-
217
- var ListCache$3 = _ListCache;
218
-
219
- /**
220
- * Removes all key-value entries from the stack.
221
- *
222
- * @private
223
- * @name clear
224
- * @memberOf Stack
225
- */
226
- function stackClear$1() {
227
- this.__data__ = new ListCache$3;
228
- this.size = 0;
229
- }
230
-
231
- var _stackClear = stackClear$1;
232
-
233
- /**
234
- * Removes `key` and its value from the stack.
235
- *
236
- * @private
237
- * @name delete
238
- * @memberOf Stack
239
- * @param {string} key The key of the value to remove.
240
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
241
- */
242
-
243
- function stackDelete$1(key) {
244
- var data = this.__data__,
245
- result = data['delete'](key);
246
-
247
- this.size = data.size;
248
- return result;
249
- }
250
-
251
- var _stackDelete = stackDelete$1;
252
-
253
- /**
254
- * Gets the stack value for `key`.
255
- *
256
- * @private
257
- * @name get
258
- * @memberOf Stack
259
- * @param {string} key The key of the value to get.
260
- * @returns {*} Returns the entry value.
261
- */
262
-
263
- function stackGet$1(key) {
264
- return this.__data__.get(key);
265
- }
266
-
267
- var _stackGet = stackGet$1;
268
-
269
- /**
270
- * Checks if a stack value for `key` exists.
271
- *
272
- * @private
273
- * @name has
274
- * @memberOf Stack
275
- * @param {string} key The key of the entry to check.
276
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
277
- */
278
-
279
- function stackHas$1(key) {
280
- return this.__data__.has(key);
281
- }
282
-
283
- var _stackHas = stackHas$1;
284
-
285
- /** Detect free variable `global` from Node.js. */
286
-
287
- var freeGlobal$1 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
288
-
289
- var _freeGlobal = freeGlobal$1;
290
-
291
- var freeGlobal = _freeGlobal;
292
-
293
- /** Detect free variable `self`. */
294
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
295
-
296
- /** Used as a reference to the global object. */
297
- var root$8 = freeGlobal || freeSelf || Function('return this')();
298
-
299
- var _root = root$8;
300
-
301
- var root$7 = _root;
302
-
303
- /** Built-in value references. */
304
- var Symbol$3 = root$7.Symbol;
305
-
306
- var _Symbol = Symbol$3;
307
-
308
- var Symbol$2 = _Symbol;
309
-
310
- /** Used for built-in method references. */
311
- var objectProto$b = Object.prototype;
312
-
313
- /** Used to check objects for own properties. */
314
- var hasOwnProperty$8 = objectProto$b.hasOwnProperty;
315
-
316
- /**
317
- * Used to resolve the
318
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
319
- * of values.
320
- */
321
- var nativeObjectToString$1 = objectProto$b.toString;
322
-
323
- /** Built-in value references. */
324
- var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : undefined;
325
-
326
- /**
327
- * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
328
- *
329
- * @private
330
- * @param {*} value The value to query.
331
- * @returns {string} Returns the raw `toStringTag`.
332
- */
333
- function getRawTag$1(value) {
334
- var isOwn = hasOwnProperty$8.call(value, symToStringTag$1),
335
- tag = value[symToStringTag$1];
336
-
337
- try {
338
- value[symToStringTag$1] = undefined;
339
- var unmasked = true;
340
- } catch (e) {}
341
-
342
- var result = nativeObjectToString$1.call(value);
343
- if (unmasked) {
344
- if (isOwn) {
345
- value[symToStringTag$1] = tag;
346
- } else {
347
- delete value[symToStringTag$1];
348
- }
349
- }
350
- return result;
351
- }
352
-
353
- var _getRawTag = getRawTag$1;
354
-
355
- /** Used for built-in method references. */
356
-
357
- var objectProto$a = Object.prototype;
358
-
359
- /**
360
- * Used to resolve the
361
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
362
- * of values.
363
- */
364
- var nativeObjectToString = objectProto$a.toString;
365
-
366
- /**
367
- * Converts `value` to a string using `Object.prototype.toString`.
368
- *
369
- * @private
370
- * @param {*} value The value to convert.
371
- * @returns {string} Returns the converted string.
372
- */
373
- function objectToString$1(value) {
374
- return nativeObjectToString.call(value);
375
- }
376
-
377
- var _objectToString = objectToString$1;
378
-
379
- var Symbol$1 = _Symbol,
380
- getRawTag = _getRawTag,
381
- objectToString = _objectToString;
382
-
383
- /** `Object#toString` result references. */
384
- var nullTag = '[object Null]',
385
- undefinedTag = '[object Undefined]';
386
-
387
- /** Built-in value references. */
388
- var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;
389
-
390
- /**
391
- * The base implementation of `getTag` without fallbacks for buggy environments.
392
- *
393
- * @private
394
- * @param {*} value The value to query.
395
- * @returns {string} Returns the `toStringTag`.
396
- */
397
- function baseGetTag$4(value) {
398
- if (value == null) {
399
- return value === undefined ? undefinedTag : nullTag;
400
- }
401
- return (symToStringTag && symToStringTag in Object(value))
402
- ? getRawTag(value)
403
- : objectToString(value);
404
- }
405
-
406
- var _baseGetTag = baseGetTag$4;
407
-
408
- /**
409
- * Checks if `value` is the
410
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
411
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
412
- *
413
- * @static
414
- * @memberOf _
415
- * @since 0.1.0
416
- * @category Lang
417
- * @param {*} value The value to check.
418
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
419
- * @example
420
- *
421
- * _.isObject({});
422
- * // => true
423
- *
424
- * _.isObject([1, 2, 3]);
425
- * // => true
426
- *
427
- * _.isObject(_.noop);
428
- * // => true
429
- *
430
- * _.isObject(null);
431
- * // => false
432
- */
433
-
434
- function isObject$2(value) {
435
- var type = typeof value;
436
- return value != null && (type == 'object' || type == 'function');
437
- }
438
-
439
- var isObject_1 = isObject$2;
440
-
441
- var baseGetTag$3 = _baseGetTag,
442
- isObject$1 = isObject_1;
443
-
444
- /** `Object#toString` result references. */
445
- var asyncTag = '[object AsyncFunction]',
446
- funcTag$1 = '[object Function]',
447
- genTag = '[object GeneratorFunction]',
448
- proxyTag = '[object Proxy]';
449
-
450
- /**
451
- * Checks if `value` is classified as a `Function` object.
452
- *
453
- * @static
454
- * @memberOf _
455
- * @since 0.1.0
456
- * @category Lang
457
- * @param {*} value The value to check.
458
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
459
- * @example
460
- *
461
- * _.isFunction(_);
462
- * // => true
463
- *
464
- * _.isFunction(/abc/);
465
- * // => false
466
- */
467
- function isFunction$2(value) {
468
- if (!isObject$1(value)) {
469
- return false;
470
- }
471
- // The use of `Object#toString` avoids issues with the `typeof` operator
472
- // in Safari 9 which returns 'object' for typed arrays and other constructors.
473
- var tag = baseGetTag$3(value);
474
- return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
475
- }
476
-
477
- var isFunction_1 = isFunction$2;
478
-
479
- var root$6 = _root;
480
-
481
- /** Used to detect overreaching core-js shims. */
482
- var coreJsData$1 = root$6['__core-js_shared__'];
483
-
484
- var _coreJsData = coreJsData$1;
485
-
486
- var coreJsData = _coreJsData;
487
-
488
- /** Used to detect methods masquerading as native. */
489
- var maskSrcKey = (function() {
490
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
491
- return uid ? ('Symbol(src)_1.' + uid) : '';
492
- }());
493
-
494
- /**
495
- * Checks if `func` has its source masked.
496
- *
497
- * @private
498
- * @param {Function} func The function to check.
499
- * @returns {boolean} Returns `true` if `func` is masked, else `false`.
500
- */
501
- function isMasked$1(func) {
502
- return !!maskSrcKey && (maskSrcKey in func);
503
- }
504
-
505
- var _isMasked = isMasked$1;
506
-
507
- /** Used for built-in method references. */
508
-
509
- var funcProto$1 = Function.prototype;
510
-
511
- /** Used to resolve the decompiled source of functions. */
512
- var funcToString$1 = funcProto$1.toString;
513
-
514
- /**
515
- * Converts `func` to its source code.
516
- *
517
- * @private
518
- * @param {Function} func The function to convert.
519
- * @returns {string} Returns the source code.
520
- */
521
- function toSource$2(func) {
522
- if (func != null) {
523
- try {
524
- return funcToString$1.call(func);
525
- } catch (e) {}
526
- try {
527
- return (func + '');
528
- } catch (e) {}
529
- }
530
- return '';
531
- }
532
-
533
- var _toSource = toSource$2;
534
-
535
- var isFunction$1 = isFunction_1,
536
- isMasked = _isMasked,
537
- isObject = isObject_1,
538
- toSource$1 = _toSource;
539
-
540
- /**
541
- * Used to match `RegExp`
542
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
543
- */
544
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
545
-
546
- /** Used to detect host constructors (Safari). */
547
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
548
-
549
- /** Used for built-in method references. */
550
- var funcProto = Function.prototype,
551
- objectProto$9 = Object.prototype;
552
-
553
- /** Used to resolve the decompiled source of functions. */
554
- var funcToString = funcProto.toString;
555
-
556
- /** Used to check objects for own properties. */
557
- var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
558
-
559
- /** Used to detect if a method is native. */
560
- var reIsNative = RegExp('^' +
561
- funcToString.call(hasOwnProperty$7).replace(reRegExpChar, '\\$&')
562
- .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
563
- );
564
-
565
- /**
566
- * The base implementation of `_.isNative` without bad shim checks.
567
- *
568
- * @private
569
- * @param {*} value The value to check.
570
- * @returns {boolean} Returns `true` if `value` is a native function,
571
- * else `false`.
572
- */
573
- function baseIsNative$1(value) {
574
- if (!isObject(value) || isMasked(value)) {
575
- return false;
576
- }
577
- var pattern = isFunction$1(value) ? reIsNative : reIsHostCtor;
578
- return pattern.test(toSource$1(value));
579
- }
580
-
581
- var _baseIsNative = baseIsNative$1;
582
-
583
- /**
584
- * Gets the value at `key` of `object`.
585
- *
586
- * @private
587
- * @param {Object} [object] The object to query.
588
- * @param {string} key The key of the property to get.
589
- * @returns {*} Returns the property value.
590
- */
591
-
592
- function getValue$1(object, key) {
593
- return object == null ? undefined : object[key];
594
- }
595
-
596
- var _getValue = getValue$1;
597
-
598
- var baseIsNative = _baseIsNative,
599
- getValue = _getValue;
600
-
601
- /**
602
- * Gets the native function at `key` of `object`.
603
- *
604
- * @private
605
- * @param {Object} object The object to query.
606
- * @param {string} key The key of the method to get.
607
- * @returns {*} Returns the function if it's native, else `undefined`.
608
- */
609
- function getNative$6(object, key) {
610
- var value = getValue(object, key);
611
- return baseIsNative(value) ? value : undefined;
612
- }
613
-
614
- var _getNative = getNative$6;
615
-
616
- var getNative$5 = _getNative,
617
- root$5 = _root;
618
-
619
- /* Built-in method references that are verified to be native. */
620
- var Map$4 = getNative$5(root$5, 'Map');
621
-
622
- var _Map = Map$4;
623
-
624
- var getNative$4 = _getNative;
625
-
626
- /* Built-in method references that are verified to be native. */
627
- var nativeCreate$4 = getNative$4(Object, 'create');
628
-
629
- var _nativeCreate = nativeCreate$4;
630
-
631
- var nativeCreate$3 = _nativeCreate;
632
-
633
- /**
634
- * Removes all key-value entries from the hash.
635
- *
636
- * @private
637
- * @name clear
638
- * @memberOf Hash
639
- */
640
- function hashClear$1() {
641
- this.__data__ = nativeCreate$3 ? nativeCreate$3(null) : {};
642
- this.size = 0;
643
- }
644
-
645
- var _hashClear = hashClear$1;
646
-
647
- /**
648
- * Removes `key` and its value from the hash.
649
- *
650
- * @private
651
- * @name delete
652
- * @memberOf Hash
653
- * @param {Object} hash The hash to modify.
654
- * @param {string} key The key of the value to remove.
655
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
656
- */
657
-
658
- function hashDelete$1(key) {
659
- var result = this.has(key) && delete this.__data__[key];
660
- this.size -= result ? 1 : 0;
661
- return result;
662
- }
663
-
664
- var _hashDelete = hashDelete$1;
665
-
666
- var nativeCreate$2 = _nativeCreate;
667
-
668
- /** Used to stand-in for `undefined` hash values. */
669
- var HASH_UNDEFINED$2 = '__lodash_hash_undefined__';
670
-
671
- /** Used for built-in method references. */
672
- var objectProto$8 = Object.prototype;
673
-
674
- /** Used to check objects for own properties. */
675
- var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
676
-
677
- /**
678
- * Gets the hash value for `key`.
679
- *
680
- * @private
681
- * @name get
682
- * @memberOf Hash
683
- * @param {string} key The key of the value to get.
684
- * @returns {*} Returns the entry value.
685
- */
686
- function hashGet$1(key) {
687
- var data = this.__data__;
688
- if (nativeCreate$2) {
689
- var result = data[key];
690
- return result === HASH_UNDEFINED$2 ? undefined : result;
691
- }
692
- return hasOwnProperty$6.call(data, key) ? data[key] : undefined;
693
- }
694
-
695
- var _hashGet = hashGet$1;
696
-
697
- var nativeCreate$1 = _nativeCreate;
698
-
699
- /** Used for built-in method references. */
700
- var objectProto$7 = Object.prototype;
701
-
702
- /** Used to check objects for own properties. */
703
- var hasOwnProperty$5 = objectProto$7.hasOwnProperty;
704
-
705
- /**
706
- * Checks if a hash value for `key` exists.
707
- *
708
- * @private
709
- * @name has
710
- * @memberOf Hash
711
- * @param {string} key The key of the entry to check.
712
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
713
- */
714
- function hashHas$1(key) {
715
- var data = this.__data__;
716
- return nativeCreate$1 ? (data[key] !== undefined) : hasOwnProperty$5.call(data, key);
717
- }
718
-
719
- var _hashHas = hashHas$1;
720
-
721
- var nativeCreate = _nativeCreate;
722
-
723
- /** Used to stand-in for `undefined` hash values. */
724
- var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
725
-
726
- /**
727
- * Sets the hash `key` to `value`.
728
- *
729
- * @private
730
- * @name set
731
- * @memberOf Hash
732
- * @param {string} key The key of the value to set.
733
- * @param {*} value The value to set.
734
- * @returns {Object} Returns the hash instance.
735
- */
736
- function hashSet$1(key, value) {
737
- var data = this.__data__;
738
- this.size += this.has(key) ? 0 : 1;
739
- data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value;
740
- return this;
741
- }
742
-
743
- var _hashSet = hashSet$1;
744
-
745
- var hashClear = _hashClear,
746
- hashDelete = _hashDelete,
747
- hashGet = _hashGet,
748
- hashHas = _hashHas,
749
- hashSet = _hashSet;
750
-
751
- /**
752
- * Creates a hash object.
753
- *
754
- * @private
755
- * @constructor
756
- * @param {Array} [entries] The key-value pairs to cache.
757
- */
758
- function Hash$1(entries) {
759
- var index = -1,
760
- length = entries == null ? 0 : entries.length;
761
-
762
- this.clear();
763
- while (++index < length) {
764
- var entry = entries[index];
765
- this.set(entry[0], entry[1]);
766
- }
767
- }
768
-
769
- // Add methods to `Hash`.
770
- Hash$1.prototype.clear = hashClear;
771
- Hash$1.prototype['delete'] = hashDelete;
772
- Hash$1.prototype.get = hashGet;
773
- Hash$1.prototype.has = hashHas;
774
- Hash$1.prototype.set = hashSet;
775
-
776
- var _Hash = Hash$1;
777
-
778
- var Hash = _Hash,
779
- ListCache$2 = _ListCache,
780
- Map$3 = _Map;
781
-
782
- /**
783
- * Removes all key-value entries from the map.
784
- *
785
- * @private
786
- * @name clear
787
- * @memberOf MapCache
788
- */
789
- function mapCacheClear$1() {
790
- this.size = 0;
791
- this.__data__ = {
792
- 'hash': new Hash,
793
- 'map': new (Map$3 || ListCache$2),
794
- 'string': new Hash
795
- };
796
- }
797
-
798
- var _mapCacheClear = mapCacheClear$1;
799
-
800
- /**
801
- * Checks if `value` is suitable for use as unique object key.
802
- *
803
- * @private
804
- * @param {*} value The value to check.
805
- * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
806
- */
807
-
808
- function isKeyable$1(value) {
809
- var type = typeof value;
810
- return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
811
- ? (value !== '__proto__')
812
- : (value === null);
813
- }
814
-
815
- var _isKeyable = isKeyable$1;
816
-
817
- var isKeyable = _isKeyable;
818
-
819
- /**
820
- * Gets the data for `map`.
821
- *
822
- * @private
823
- * @param {Object} map The map to query.
824
- * @param {string} key The reference key.
825
- * @returns {*} Returns the map data.
826
- */
827
- function getMapData$4(map, key) {
828
- var data = map.__data__;
829
- return isKeyable(key)
830
- ? data[typeof key == 'string' ? 'string' : 'hash']
831
- : data.map;
832
- }
833
-
834
- var _getMapData = getMapData$4;
835
-
836
- var getMapData$3 = _getMapData;
837
-
838
- /**
839
- * Removes `key` and its value from the map.
840
- *
841
- * @private
842
- * @name delete
843
- * @memberOf MapCache
844
- * @param {string} key The key of the value to remove.
845
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
846
- */
847
- function mapCacheDelete$1(key) {
848
- var result = getMapData$3(this, key)['delete'](key);
849
- this.size -= result ? 1 : 0;
850
- return result;
851
- }
852
-
853
- var _mapCacheDelete = mapCacheDelete$1;
854
-
855
- var getMapData$2 = _getMapData;
856
-
857
- /**
858
- * Gets the map value for `key`.
859
- *
860
- * @private
861
- * @name get
862
- * @memberOf MapCache
863
- * @param {string} key The key of the value to get.
864
- * @returns {*} Returns the entry value.
865
- */
866
- function mapCacheGet$1(key) {
867
- return getMapData$2(this, key).get(key);
868
- }
869
-
870
- var _mapCacheGet = mapCacheGet$1;
871
-
872
- var getMapData$1 = _getMapData;
873
-
874
- /**
875
- * Checks if a map value for `key` exists.
876
- *
877
- * @private
878
- * @name has
879
- * @memberOf MapCache
880
- * @param {string} key The key of the entry to check.
881
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
882
- */
883
- function mapCacheHas$1(key) {
884
- return getMapData$1(this, key).has(key);
885
- }
886
-
887
- var _mapCacheHas = mapCacheHas$1;
888
-
889
- var getMapData = _getMapData;
890
-
891
- /**
892
- * Sets the map `key` to `value`.
893
- *
894
- * @private
895
- * @name set
896
- * @memberOf MapCache
897
- * @param {string} key The key of the value to set.
898
- * @param {*} value The value to set.
899
- * @returns {Object} Returns the map cache instance.
900
- */
901
- function mapCacheSet$1(key, value) {
902
- var data = getMapData(this, key),
903
- size = data.size;
904
-
905
- data.set(key, value);
906
- this.size += data.size == size ? 0 : 1;
907
- return this;
908
- }
909
-
910
- var _mapCacheSet = mapCacheSet$1;
911
-
912
- var mapCacheClear = _mapCacheClear,
913
- mapCacheDelete = _mapCacheDelete,
914
- mapCacheGet = _mapCacheGet,
915
- mapCacheHas = _mapCacheHas,
916
- mapCacheSet = _mapCacheSet;
917
-
918
- /**
919
- * Creates a map cache object to store key-value pairs.
920
- *
921
- * @private
922
- * @constructor
923
- * @param {Array} [entries] The key-value pairs to cache.
924
- */
925
- function MapCache$2(entries) {
926
- var index = -1,
927
- length = entries == null ? 0 : entries.length;
928
-
929
- this.clear();
930
- while (++index < length) {
931
- var entry = entries[index];
932
- this.set(entry[0], entry[1]);
933
- }
934
- }
935
-
936
- // Add methods to `MapCache`.
937
- MapCache$2.prototype.clear = mapCacheClear;
938
- MapCache$2.prototype['delete'] = mapCacheDelete;
939
- MapCache$2.prototype.get = mapCacheGet;
940
- MapCache$2.prototype.has = mapCacheHas;
941
- MapCache$2.prototype.set = mapCacheSet;
942
-
943
- var _MapCache = MapCache$2;
944
-
945
- var ListCache$1 = _ListCache,
946
- Map$2 = _Map,
947
- MapCache$1 = _MapCache;
948
-
949
- /** Used as the size to enable large array optimizations. */
950
- var LARGE_ARRAY_SIZE = 200;
951
-
952
- /**
953
- * Sets the stack `key` to `value`.
954
- *
955
- * @private
956
- * @name set
957
- * @memberOf Stack
958
- * @param {string} key The key of the value to set.
959
- * @param {*} value The value to set.
960
- * @returns {Object} Returns the stack cache instance.
961
- */
962
- function stackSet$1(key, value) {
963
- var data = this.__data__;
964
- if (data instanceof ListCache$1) {
965
- var pairs = data.__data__;
966
- if (!Map$2 || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
967
- pairs.push([key, value]);
968
- this.size = ++data.size;
969
- return this;
970
- }
971
- data = this.__data__ = new MapCache$1(pairs);
972
- }
973
- data.set(key, value);
974
- this.size = data.size;
975
- return this;
976
- }
977
-
978
- var _stackSet = stackSet$1;
979
-
980
- var ListCache = _ListCache,
981
- stackClear = _stackClear,
982
- stackDelete = _stackDelete,
983
- stackGet = _stackGet,
984
- stackHas = _stackHas,
985
- stackSet = _stackSet;
986
-
987
- /**
988
- * Creates a stack cache object to store key-value pairs.
989
- *
990
- * @private
991
- * @constructor
992
- * @param {Array} [entries] The key-value pairs to cache.
993
- */
994
- function Stack$1(entries) {
995
- var data = this.__data__ = new ListCache(entries);
996
- this.size = data.size;
997
- }
998
-
999
- // Add methods to `Stack`.
1000
- Stack$1.prototype.clear = stackClear;
1001
- Stack$1.prototype['delete'] = stackDelete;
1002
- Stack$1.prototype.get = stackGet;
1003
- Stack$1.prototype.has = stackHas;
1004
- Stack$1.prototype.set = stackSet;
1005
-
1006
- var _Stack = Stack$1;
1007
-
1008
- /** Used to stand-in for `undefined` hash values. */
1009
-
1010
- var HASH_UNDEFINED = '__lodash_hash_undefined__';
1011
-
1012
- /**
1013
- * Adds `value` to the array cache.
1014
- *
1015
- * @private
1016
- * @name add
1017
- * @memberOf SetCache
1018
- * @alias push
1019
- * @param {*} value The value to cache.
1020
- * @returns {Object} Returns the cache instance.
1021
- */
1022
- function setCacheAdd$1(value) {
1023
- this.__data__.set(value, HASH_UNDEFINED);
1024
- return this;
1025
- }
1026
-
1027
- var _setCacheAdd = setCacheAdd$1;
1028
-
1029
- /**
1030
- * Checks if `value` is in the array cache.
1031
- *
1032
- * @private
1033
- * @name has
1034
- * @memberOf SetCache
1035
- * @param {*} value The value to search for.
1036
- * @returns {number} Returns `true` if `value` is found, else `false`.
1037
- */
1038
-
1039
- function setCacheHas$1(value) {
1040
- return this.__data__.has(value);
1041
- }
1042
-
1043
- var _setCacheHas = setCacheHas$1;
1044
-
1045
- var MapCache = _MapCache,
1046
- setCacheAdd = _setCacheAdd,
1047
- setCacheHas = _setCacheHas;
1048
-
1049
- /**
1050
- *
1051
- * Creates an array cache object to store unique values.
1052
- *
1053
- * @private
1054
- * @constructor
1055
- * @param {Array} [values] The values to cache.
1056
- */
1057
- function SetCache$1(values) {
1058
- var index = -1,
1059
- length = values == null ? 0 : values.length;
1060
-
1061
- this.__data__ = new MapCache;
1062
- while (++index < length) {
1063
- this.add(values[index]);
1064
- }
1065
- }
1066
-
1067
- // Add methods to `SetCache`.
1068
- SetCache$1.prototype.add = SetCache$1.prototype.push = setCacheAdd;
1069
- SetCache$1.prototype.has = setCacheHas;
1070
-
1071
- var _SetCache = SetCache$1;
1072
-
1073
- /**
1074
- * A specialized version of `_.some` for arrays without support for iteratee
1075
- * shorthands.
1076
- *
1077
- * @private
1078
- * @param {Array} [array] The array to iterate over.
1079
- * @param {Function} predicate The function invoked per iteration.
1080
- * @returns {boolean} Returns `true` if any element passes the predicate check,
1081
- * else `false`.
1082
- */
1083
-
1084
- function arraySome$1(array, predicate) {
1085
- var index = -1,
1086
- length = array == null ? 0 : array.length;
1087
-
1088
- while (++index < length) {
1089
- if (predicate(array[index], index, array)) {
1090
- return true;
1091
- }
1092
- }
1093
- return false;
1094
- }
1095
-
1096
- var _arraySome = arraySome$1;
1097
-
1098
- /**
1099
- * Checks if a `cache` value for `key` exists.
1100
- *
1101
- * @private
1102
- * @param {Object} cache The cache to query.
1103
- * @param {string} key The key of the entry to check.
1104
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1105
- */
1106
-
1107
- function cacheHas$1(cache, key) {
1108
- return cache.has(key);
1109
- }
1110
-
1111
- var _cacheHas = cacheHas$1;
1112
-
1113
- var SetCache = _SetCache,
1114
- arraySome = _arraySome,
1115
- cacheHas = _cacheHas;
1116
-
1117
- /** Used to compose bitmasks for value comparisons. */
1118
- var COMPARE_PARTIAL_FLAG$3 = 1,
1119
- COMPARE_UNORDERED_FLAG$1 = 2;
1120
-
1121
- /**
1122
- * A specialized version of `baseIsEqualDeep` for arrays with support for
1123
- * partial deep comparisons.
1124
- *
1125
- * @private
1126
- * @param {Array} array The array to compare.
1127
- * @param {Array} other The other array to compare.
1128
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1129
- * @param {Function} customizer The function to customize comparisons.
1130
- * @param {Function} equalFunc The function to determine equivalents of values.
1131
- * @param {Object} stack Tracks traversed `array` and `other` objects.
1132
- * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
1133
- */
1134
- function equalArrays$2(array, other, bitmask, customizer, equalFunc, stack) {
1135
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3,
1136
- arrLength = array.length,
1137
- othLength = other.length;
1138
-
1139
- if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
1140
- return false;
1141
- }
1142
- // Check that cyclic values are equal.
1143
- var arrStacked = stack.get(array);
1144
- var othStacked = stack.get(other);
1145
- if (arrStacked && othStacked) {
1146
- return arrStacked == other && othStacked == array;
1147
- }
1148
- var index = -1,
1149
- result = true,
1150
- seen = (bitmask & COMPARE_UNORDERED_FLAG$1) ? new SetCache : undefined;
1151
-
1152
- stack.set(array, other);
1153
- stack.set(other, array);
1154
-
1155
- // Ignore non-index properties.
1156
- while (++index < arrLength) {
1157
- var arrValue = array[index],
1158
- othValue = other[index];
1159
-
1160
- if (customizer) {
1161
- var compared = isPartial
1162
- ? customizer(othValue, arrValue, index, other, array, stack)
1163
- : customizer(arrValue, othValue, index, array, other, stack);
1164
- }
1165
- if (compared !== undefined) {
1166
- if (compared) {
1167
- continue;
1168
- }
1169
- result = false;
1170
- break;
1171
- }
1172
- // Recursively compare arrays (susceptible to call stack limits).
1173
- if (seen) {
1174
- if (!arraySome(other, function(othValue, othIndex) {
1175
- if (!cacheHas(seen, othIndex) &&
1176
- (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
1177
- return seen.push(othIndex);
1178
- }
1179
- })) {
1180
- result = false;
1181
- break;
1182
- }
1183
- } else if (!(
1184
- arrValue === othValue ||
1185
- equalFunc(arrValue, othValue, bitmask, customizer, stack)
1186
- )) {
1187
- result = false;
1188
- break;
1189
- }
1190
- }
1191
- stack['delete'](array);
1192
- stack['delete'](other);
1193
- return result;
1194
- }
1195
-
1196
- var _equalArrays = equalArrays$2;
1197
-
1198
- var root$4 = _root;
1199
-
1200
- /** Built-in value references. */
1201
- var Uint8Array$1 = root$4.Uint8Array;
1202
-
1203
- var _Uint8Array = Uint8Array$1;
1204
-
1205
- /**
1206
- * Converts `map` to its key-value pairs.
1207
- *
1208
- * @private
1209
- * @param {Object} map The map to convert.
1210
- * @returns {Array} Returns the key-value pairs.
1211
- */
1212
-
1213
- function mapToArray$1(map) {
1214
- var index = -1,
1215
- result = Array(map.size);
1216
-
1217
- map.forEach(function(value, key) {
1218
- result[++index] = [key, value];
1219
- });
1220
- return result;
1221
- }
1222
-
1223
- var _mapToArray = mapToArray$1;
1224
-
1225
- /**
1226
- * Converts `set` to an array of its values.
1227
- *
1228
- * @private
1229
- * @param {Object} set The set to convert.
1230
- * @returns {Array} Returns the values.
1231
- */
1232
-
1233
- function setToArray$1(set) {
1234
- var index = -1,
1235
- result = Array(set.size);
1236
-
1237
- set.forEach(function(value) {
1238
- result[++index] = value;
1239
- });
1240
- return result;
1241
- }
1242
-
1243
- var _setToArray = setToArray$1;
1244
-
1245
- var Symbol = _Symbol,
1246
- Uint8Array = _Uint8Array,
1247
- eq = eq_1,
1248
- equalArrays$1 = _equalArrays,
1249
- mapToArray = _mapToArray,
1250
- setToArray = _setToArray;
1251
-
1252
- /** Used to compose bitmasks for value comparisons. */
1253
- var COMPARE_PARTIAL_FLAG$2 = 1,
1254
- COMPARE_UNORDERED_FLAG = 2;
1255
-
1256
- /** `Object#toString` result references. */
1257
- var boolTag$1 = '[object Boolean]',
1258
- dateTag$1 = '[object Date]',
1259
- errorTag$1 = '[object Error]',
1260
- mapTag$2 = '[object Map]',
1261
- numberTag$1 = '[object Number]',
1262
- regexpTag$1 = '[object RegExp]',
1263
- setTag$2 = '[object Set]',
1264
- stringTag$1 = '[object String]',
1265
- symbolTag = '[object Symbol]';
1266
-
1267
- var arrayBufferTag$1 = '[object ArrayBuffer]',
1268
- dataViewTag$2 = '[object DataView]';
1269
-
1270
- /** Used to convert symbols to primitives and strings. */
1271
- var symbolProto = Symbol ? Symbol.prototype : undefined,
1272
- symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
1273
-
1274
- /**
1275
- * A specialized version of `baseIsEqualDeep` for comparing objects of
1276
- * the same `toStringTag`.
1277
- *
1278
- * **Note:** This function only supports comparing values with tags of
1279
- * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
1280
- *
1281
- * @private
1282
- * @param {Object} object The object to compare.
1283
- * @param {Object} other The other object to compare.
1284
- * @param {string} tag The `toStringTag` of the objects to compare.
1285
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1286
- * @param {Function} customizer The function to customize comparisons.
1287
- * @param {Function} equalFunc The function to determine equivalents of values.
1288
- * @param {Object} stack Tracks traversed `object` and `other` objects.
1289
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
1290
- */
1291
- function equalByTag$1(object, other, tag, bitmask, customizer, equalFunc, stack) {
1292
- switch (tag) {
1293
- case dataViewTag$2:
1294
- if ((object.byteLength != other.byteLength) ||
1295
- (object.byteOffset != other.byteOffset)) {
1296
- return false;
1297
- }
1298
- object = object.buffer;
1299
- other = other.buffer;
1300
-
1301
- case arrayBufferTag$1:
1302
- if ((object.byteLength != other.byteLength) ||
1303
- !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
1304
- return false;
1305
- }
1306
- return true;
1307
-
1308
- case boolTag$1:
1309
- case dateTag$1:
1310
- case numberTag$1:
1311
- // Coerce booleans to `1` or `0` and dates to milliseconds.
1312
- // Invalid dates are coerced to `NaN`.
1313
- return eq(+object, +other);
1314
-
1315
- case errorTag$1:
1316
- return object.name == other.name && object.message == other.message;
1317
-
1318
- case regexpTag$1:
1319
- case stringTag$1:
1320
- // Coerce regexes to strings and treat strings, primitives and objects,
1321
- // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
1322
- // for more details.
1323
- return object == (other + '');
1324
-
1325
- case mapTag$2:
1326
- var convert = mapToArray;
1327
-
1328
- case setTag$2:
1329
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2;
1330
- convert || (convert = setToArray);
1331
-
1332
- if (object.size != other.size && !isPartial) {
1333
- return false;
1334
- }
1335
- // Assume cyclic values are equal.
1336
- var stacked = stack.get(object);
1337
- if (stacked) {
1338
- return stacked == other;
1339
- }
1340
- bitmask |= COMPARE_UNORDERED_FLAG;
1341
-
1342
- // Recursively compare objects (susceptible to call stack limits).
1343
- stack.set(object, other);
1344
- var result = equalArrays$1(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
1345
- stack['delete'](object);
1346
- return result;
1347
-
1348
- case symbolTag:
1349
- if (symbolValueOf) {
1350
- return symbolValueOf.call(object) == symbolValueOf.call(other);
1351
- }
1352
- }
1353
- return false;
1354
- }
1355
-
1356
- var _equalByTag = equalByTag$1;
1357
-
1358
- /**
1359
- * Appends the elements of `values` to `array`.
1360
- *
1361
- * @private
1362
- * @param {Array} array The array to modify.
1363
- * @param {Array} values The values to append.
1364
- * @returns {Array} Returns `array`.
1365
- */
1366
-
1367
- function arrayPush$1(array, values) {
1368
- var index = -1,
1369
- length = values.length,
1370
- offset = array.length;
1371
-
1372
- while (++index < length) {
1373
- array[offset + index] = values[index];
1374
- }
1375
- return array;
1376
- }
1377
-
1378
- var _arrayPush = arrayPush$1;
1379
-
1380
- /**
1381
- * Checks if `value` is classified as an `Array` object.
1382
- *
1383
- * @static
1384
- * @memberOf _
1385
- * @since 0.1.0
1386
- * @category Lang
1387
- * @param {*} value The value to check.
1388
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
1389
- * @example
1390
- *
1391
- * _.isArray([1, 2, 3]);
1392
- * // => true
1393
- *
1394
- * _.isArray(document.body.children);
1395
- * // => false
1396
- *
1397
- * _.isArray('abc');
1398
- * // => false
1399
- *
1400
- * _.isArray(_.noop);
1401
- * // => false
1402
- */
1403
-
1404
- var isArray$3 = Array.isArray;
1405
-
1406
- var isArray_1 = isArray$3;
1407
-
1408
- var arrayPush = _arrayPush,
1409
- isArray$2 = isArray_1;
1410
-
1411
- /**
1412
- * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
1413
- * `keysFunc` and `symbolsFunc` to get the enumerable property names and
1414
- * symbols of `object`.
1415
- *
1416
- * @private
1417
- * @param {Object} object The object to query.
1418
- * @param {Function} keysFunc The function to get the keys of `object`.
1419
- * @param {Function} symbolsFunc The function to get the symbols of `object`.
1420
- * @returns {Array} Returns the array of property names and symbols.
1421
- */
1422
- function baseGetAllKeys$1(object, keysFunc, symbolsFunc) {
1423
- var result = keysFunc(object);
1424
- return isArray$2(object) ? result : arrayPush(result, symbolsFunc(object));
1425
- }
1426
-
1427
- var _baseGetAllKeys = baseGetAllKeys$1;
1428
-
1429
- /**
1430
- * A specialized version of `_.filter` for arrays without support for
1431
- * iteratee shorthands.
1432
- *
1433
- * @private
1434
- * @param {Array} [array] The array to iterate over.
1435
- * @param {Function} predicate The function invoked per iteration.
1436
- * @returns {Array} Returns the new filtered array.
1437
- */
1438
-
1439
- function arrayFilter$1(array, predicate) {
1440
- var index = -1,
1441
- length = array == null ? 0 : array.length,
1442
- resIndex = 0,
1443
- result = [];
1444
-
1445
- while (++index < length) {
1446
- var value = array[index];
1447
- if (predicate(value, index, array)) {
1448
- result[resIndex++] = value;
1449
- }
1450
- }
1451
- return result;
1452
- }
1453
-
1454
- var _arrayFilter = arrayFilter$1;
1455
-
1456
- /**
1457
- * This method returns a new empty array.
1458
- *
1459
- * @static
1460
- * @memberOf _
1461
- * @since 4.13.0
1462
- * @category Util
1463
- * @returns {Array} Returns the new empty array.
1464
- * @example
1465
- *
1466
- * var arrays = _.times(2, _.stubArray);
1467
- *
1468
- * console.log(arrays);
1469
- * // => [[], []]
1470
- *
1471
- * console.log(arrays[0] === arrays[1]);
1472
- * // => false
1473
- */
1474
-
1475
- function stubArray$1() {
1476
- return [];
1477
- }
1478
-
1479
- var stubArray_1 = stubArray$1;
1480
-
1481
- var arrayFilter = _arrayFilter,
1482
- stubArray = stubArray_1;
1483
-
1484
- /** Used for built-in method references. */
1485
- var objectProto$6 = Object.prototype;
1486
-
1487
- /** Built-in value references. */
1488
- var propertyIsEnumerable$1 = objectProto$6.propertyIsEnumerable;
1489
-
1490
- /* Built-in method references for those with the same name as other `lodash` methods. */
1491
- var nativeGetSymbols = Object.getOwnPropertySymbols;
1492
-
1493
- /**
1494
- * Creates an array of the own enumerable symbols of `object`.
1495
- *
1496
- * @private
1497
- * @param {Object} object The object to query.
1498
- * @returns {Array} Returns the array of symbols.
1499
- */
1500
- var getSymbols$1 = !nativeGetSymbols ? stubArray : function(object) {
1501
- if (object == null) {
1502
- return [];
1503
- }
1504
- object = Object(object);
1505
- return arrayFilter(nativeGetSymbols(object), function(symbol) {
1506
- return propertyIsEnumerable$1.call(object, symbol);
1507
- });
1508
- };
1509
-
1510
- var _getSymbols = getSymbols$1;
1511
-
1512
- /**
1513
- * The base implementation of `_.times` without support for iteratee shorthands
1514
- * or max array length checks.
1515
- *
1516
- * @private
1517
- * @param {number} n The number of times to invoke `iteratee`.
1518
- * @param {Function} iteratee The function invoked per iteration.
1519
- * @returns {Array} Returns the array of results.
1520
- */
1521
-
1522
- function baseTimes$1(n, iteratee) {
1523
- var index = -1,
1524
- result = Array(n);
1525
-
1526
- while (++index < n) {
1527
- result[index] = iteratee(index);
1528
- }
1529
- return result;
1530
- }
1531
-
1532
- var _baseTimes = baseTimes$1;
1533
-
1534
- /**
1535
- * Checks if `value` is object-like. A value is object-like if it's not `null`
1536
- * and has a `typeof` result of "object".
1537
- *
1538
- * @static
1539
- * @memberOf _
1540
- * @since 4.0.0
1541
- * @category Lang
1542
- * @param {*} value The value to check.
1543
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
1544
- * @example
1545
- *
1546
- * _.isObjectLike({});
1547
- * // => true
1548
- *
1549
- * _.isObjectLike([1, 2, 3]);
1550
- * // => true
1551
- *
1552
- * _.isObjectLike(_.noop);
1553
- * // => false
1554
- *
1555
- * _.isObjectLike(null);
1556
- * // => false
1557
- */
1558
-
1559
- function isObjectLike$4(value) {
1560
- return value != null && typeof value == 'object';
1561
- }
1562
-
1563
- var isObjectLike_1 = isObjectLike$4;
1564
-
1565
- var baseGetTag$2 = _baseGetTag,
1566
- isObjectLike$3 = isObjectLike_1;
1567
-
1568
- /** `Object#toString` result references. */
1569
- var argsTag$2 = '[object Arguments]';
1570
-
1571
- /**
1572
- * The base implementation of `_.isArguments`.
1573
- *
1574
- * @private
1575
- * @param {*} value The value to check.
1576
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1577
- */
1578
- function baseIsArguments$1(value) {
1579
- return isObjectLike$3(value) && baseGetTag$2(value) == argsTag$2;
1580
- }
1581
-
1582
- var _baseIsArguments = baseIsArguments$1;
1583
-
1584
- var baseIsArguments = _baseIsArguments,
1585
- isObjectLike$2 = isObjectLike_1;
1586
-
1587
- /** Used for built-in method references. */
1588
- var objectProto$5 = Object.prototype;
1589
-
1590
- /** Used to check objects for own properties. */
1591
- var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
1592
-
1593
- /** Built-in value references. */
1594
- var propertyIsEnumerable = objectProto$5.propertyIsEnumerable;
1595
-
1596
- /**
1597
- * Checks if `value` is likely an `arguments` object.
1598
- *
1599
- * @static
1600
- * @memberOf _
1601
- * @since 0.1.0
1602
- * @category Lang
1603
- * @param {*} value The value to check.
1604
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1605
- * else `false`.
1606
- * @example
1607
- *
1608
- * _.isArguments(function() { return arguments; }());
1609
- * // => true
1610
- *
1611
- * _.isArguments([1, 2, 3]);
1612
- * // => false
1613
- */
1614
- var isArguments$1 = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
1615
- return isObjectLike$2(value) && hasOwnProperty$4.call(value, 'callee') &&
1616
- !propertyIsEnumerable.call(value, 'callee');
1617
- };
1618
-
1619
- var isArguments_1 = isArguments$1;
1620
-
1621
- var isBuffer$2 = {exports: {}};
1622
-
1623
- /**
1624
- * This method returns `false`.
1625
- *
1626
- * @static
1627
- * @memberOf _
1628
- * @since 4.13.0
1629
- * @category Util
1630
- * @returns {boolean} Returns `false`.
1631
- * @example
1632
- *
1633
- * _.times(2, _.stubFalse);
1634
- * // => [false, false]
1635
- */
1636
-
1637
- function stubFalse() {
1638
- return false;
1639
- }
1640
-
1641
- var stubFalse_1 = stubFalse;
1642
-
1643
- (function (module, exports) {
1644
- var root = _root,
1645
- stubFalse = stubFalse_1;
1646
-
1647
- /** Detect free variable `exports`. */
1648
- var freeExports = exports && !exports.nodeType && exports;
1649
-
1650
- /** Detect free variable `module`. */
1651
- var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
1652
-
1653
- /** Detect the popular CommonJS extension `module.exports`. */
1654
- var moduleExports = freeModule && freeModule.exports === freeExports;
1655
-
1656
- /** Built-in value references. */
1657
- var Buffer = moduleExports ? root.Buffer : undefined;
1658
-
1659
- /* Built-in method references for those with the same name as other `lodash` methods. */
1660
- var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
1661
-
1662
- /**
1663
- * Checks if `value` is a buffer.
1664
- *
1665
- * @static
1666
- * @memberOf _
1667
- * @since 4.3.0
1668
- * @category Lang
1669
- * @param {*} value The value to check.
1670
- * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
1671
- * @example
1672
- *
1673
- * _.isBuffer(new Buffer(2));
1674
- * // => true
1675
- *
1676
- * _.isBuffer(new Uint8Array(2));
1677
- * // => false
1678
- */
1679
- var isBuffer = nativeIsBuffer || stubFalse;
1680
-
1681
- module.exports = isBuffer;
1682
- }(isBuffer$2, isBuffer$2.exports));
1683
-
1684
- /** Used as references for various `Number` constants. */
1685
-
1686
- var MAX_SAFE_INTEGER$1 = 9007199254740991;
1687
-
1688
- /** Used to detect unsigned integer values. */
1689
- var reIsUint = /^(?:0|[1-9]\d*)$/;
1690
-
1691
- /**
1692
- * Checks if `value` is a valid array-like index.
1693
- *
1694
- * @private
1695
- * @param {*} value The value to check.
1696
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
1697
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
1698
- */
1699
- function isIndex$1(value, length) {
1700
- var type = typeof value;
1701
- length = length == null ? MAX_SAFE_INTEGER$1 : length;
1702
-
1703
- return !!length &&
1704
- (type == 'number' ||
1705
- (type != 'symbol' && reIsUint.test(value))) &&
1706
- (value > -1 && value % 1 == 0 && value < length);
1707
- }
1708
-
1709
- var _isIndex = isIndex$1;
1710
-
1711
- /** Used as references for various `Number` constants. */
1712
-
1713
- var MAX_SAFE_INTEGER = 9007199254740991;
1714
-
1715
- /**
1716
- * Checks if `value` is a valid array-like length.
1717
- *
1718
- * **Note:** This method is loosely based on
1719
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
1720
- *
1721
- * @static
1722
- * @memberOf _
1723
- * @since 4.0.0
1724
- * @category Lang
1725
- * @param {*} value The value to check.
1726
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
1727
- * @example
1728
- *
1729
- * _.isLength(3);
1730
- * // => true
1731
- *
1732
- * _.isLength(Number.MIN_VALUE);
1733
- * // => false
1734
- *
1735
- * _.isLength(Infinity);
1736
- * // => false
1737
- *
1738
- * _.isLength('3');
1739
- * // => false
1740
- */
1741
- function isLength$2(value) {
1742
- return typeof value == 'number' &&
1743
- value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
1744
- }
1745
-
1746
- var isLength_1 = isLength$2;
1747
-
1748
- var baseGetTag$1 = _baseGetTag,
1749
- isLength$1 = isLength_1,
1750
- isObjectLike$1 = isObjectLike_1;
1751
-
1752
- /** `Object#toString` result references. */
1753
- var argsTag$1 = '[object Arguments]',
1754
- arrayTag$1 = '[object Array]',
1755
- boolTag = '[object Boolean]',
1756
- dateTag = '[object Date]',
1757
- errorTag = '[object Error]',
1758
- funcTag = '[object Function]',
1759
- mapTag$1 = '[object Map]',
1760
- numberTag = '[object Number]',
1761
- objectTag$2 = '[object Object]',
1762
- regexpTag = '[object RegExp]',
1763
- setTag$1 = '[object Set]',
1764
- stringTag = '[object String]',
1765
- weakMapTag$1 = '[object WeakMap]';
1766
-
1767
- var arrayBufferTag = '[object ArrayBuffer]',
1768
- dataViewTag$1 = '[object DataView]',
1769
- float32Tag = '[object Float32Array]',
1770
- float64Tag = '[object Float64Array]',
1771
- int8Tag = '[object Int8Array]',
1772
- int16Tag = '[object Int16Array]',
1773
- int32Tag = '[object Int32Array]',
1774
- uint8Tag = '[object Uint8Array]',
1775
- uint8ClampedTag = '[object Uint8ClampedArray]',
1776
- uint16Tag = '[object Uint16Array]',
1777
- uint32Tag = '[object Uint32Array]';
1778
-
1779
- /** Used to identify `toStringTag` values of typed arrays. */
1780
- var typedArrayTags = {};
1781
- typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
1782
- typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
1783
- typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
1784
- typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
1785
- typedArrayTags[uint32Tag] = true;
1786
- typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] =
1787
- typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
1788
- typedArrayTags[dataViewTag$1] = typedArrayTags[dateTag] =
1789
- typedArrayTags[errorTag] = typedArrayTags[funcTag] =
1790
- typedArrayTags[mapTag$1] = typedArrayTags[numberTag] =
1791
- typedArrayTags[objectTag$2] = typedArrayTags[regexpTag] =
1792
- typedArrayTags[setTag$1] = typedArrayTags[stringTag] =
1793
- typedArrayTags[weakMapTag$1] = false;
1794
-
1795
- /**
1796
- * The base implementation of `_.isTypedArray` without Node.js optimizations.
1797
- *
1798
- * @private
1799
- * @param {*} value The value to check.
1800
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1801
- */
1802
- function baseIsTypedArray$1(value) {
1803
- return isObjectLike$1(value) &&
1804
- isLength$1(value.length) && !!typedArrayTags[baseGetTag$1(value)];
1805
- }
1806
-
1807
- var _baseIsTypedArray = baseIsTypedArray$1;
1808
-
1809
- /**
1810
- * The base implementation of `_.unary` without support for storing metadata.
1811
- *
1812
- * @private
1813
- * @param {Function} func The function to cap arguments for.
1814
- * @returns {Function} Returns the new capped function.
1815
- */
1816
-
1817
- function baseUnary$1(func) {
1818
- return function(value) {
1819
- return func(value);
1820
- };
1821
- }
1822
-
1823
- var _baseUnary = baseUnary$1;
1824
-
1825
- var _nodeUtil = {exports: {}};
1826
-
1827
- (function (module, exports) {
1828
- var freeGlobal = _freeGlobal;
1829
-
1830
- /** Detect free variable `exports`. */
1831
- var freeExports = exports && !exports.nodeType && exports;
1832
-
1833
- /** Detect free variable `module`. */
1834
- var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
1835
-
1836
- /** Detect the popular CommonJS extension `module.exports`. */
1837
- var moduleExports = freeModule && freeModule.exports === freeExports;
1838
-
1839
- /** Detect free variable `process` from Node.js. */
1840
- var freeProcess = moduleExports && freeGlobal.process;
1841
-
1842
- /** Used to access faster Node.js helpers. */
1843
- var nodeUtil = (function() {
1844
- try {
1845
- // Use `util.types` for Node.js 10+.
1846
- var types = freeModule && freeModule.require && freeModule.require('util').types;
1847
-
1848
- if (types) {
1849
- return types;
1850
- }
1851
-
1852
- // Legacy `process.binding('util')` for Node.js < 10.
1853
- return freeProcess && freeProcess.binding && freeProcess.binding('util');
1854
- } catch (e) {}
1855
- }());
1856
-
1857
- module.exports = nodeUtil;
1858
- }(_nodeUtil, _nodeUtil.exports));
1859
-
1860
- var baseIsTypedArray = _baseIsTypedArray,
1861
- baseUnary = _baseUnary,
1862
- nodeUtil = _nodeUtil.exports;
1863
-
1864
- /* Node.js helper references. */
1865
- var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
1866
-
1867
- /**
1868
- * Checks if `value` is classified as a typed array.
1869
- *
1870
- * @static
1871
- * @memberOf _
1872
- * @since 3.0.0
1873
- * @category Lang
1874
- * @param {*} value The value to check.
1875
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1876
- * @example
1877
- *
1878
- * _.isTypedArray(new Uint8Array);
1879
- * // => true
1880
- *
1881
- * _.isTypedArray([]);
1882
- * // => false
1883
- */
1884
- var isTypedArray$2 = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
1885
-
1886
- var isTypedArray_1 = isTypedArray$2;
1887
-
1888
- var baseTimes = _baseTimes,
1889
- isArguments = isArguments_1,
1890
- isArray$1 = isArray_1,
1891
- isBuffer$1 = isBuffer$2.exports,
1892
- isIndex = _isIndex,
1893
- isTypedArray$1 = isTypedArray_1;
1894
-
1895
- /** Used for built-in method references. */
1896
- var objectProto$4 = Object.prototype;
1897
-
1898
- /** Used to check objects for own properties. */
1899
- var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
1900
-
1901
- /**
1902
- * Creates an array of the enumerable property names of the array-like `value`.
1903
- *
1904
- * @private
1905
- * @param {*} value The value to query.
1906
- * @param {boolean} inherited Specify returning inherited property names.
1907
- * @returns {Array} Returns the array of property names.
1908
- */
1909
- function arrayLikeKeys$1(value, inherited) {
1910
- var isArr = isArray$1(value),
1911
- isArg = !isArr && isArguments(value),
1912
- isBuff = !isArr && !isArg && isBuffer$1(value),
1913
- isType = !isArr && !isArg && !isBuff && isTypedArray$1(value),
1914
- skipIndexes = isArr || isArg || isBuff || isType,
1915
- result = skipIndexes ? baseTimes(value.length, String) : [],
1916
- length = result.length;
1917
-
1918
- for (var key in value) {
1919
- if ((inherited || hasOwnProperty$3.call(value, key)) &&
1920
- !(skipIndexes && (
1921
- // Safari 9 has enumerable `arguments.length` in strict mode.
1922
- key == 'length' ||
1923
- // Node.js 0.10 has enumerable non-index properties on buffers.
1924
- (isBuff && (key == 'offset' || key == 'parent')) ||
1925
- // PhantomJS 2 has enumerable non-index properties on typed arrays.
1926
- (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
1927
- // Skip index properties.
1928
- isIndex(key, length)
1929
- ))) {
1930
- result.push(key);
1931
- }
1932
- }
1933
- return result;
1934
- }
1935
-
1936
- var _arrayLikeKeys = arrayLikeKeys$1;
1937
-
1938
- /** Used for built-in method references. */
1939
-
1940
- var objectProto$3 = Object.prototype;
1941
-
1942
- /**
1943
- * Checks if `value` is likely a prototype object.
1944
- *
1945
- * @private
1946
- * @param {*} value The value to check.
1947
- * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
1948
- */
1949
- function isPrototype$1(value) {
1950
- var Ctor = value && value.constructor,
1951
- proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$3;
1952
-
1953
- return value === proto;
1954
- }
1955
-
1956
- var _isPrototype = isPrototype$1;
1957
-
1958
- /**
1959
- * Creates a unary function that invokes `func` with its argument transformed.
1960
- *
1961
- * @private
1962
- * @param {Function} func The function to wrap.
1963
- * @param {Function} transform The argument transform.
1964
- * @returns {Function} Returns the new function.
1965
- */
1966
-
1967
- function overArg$1(func, transform) {
1968
- return function(arg) {
1969
- return func(transform(arg));
1970
- };
1971
- }
1972
-
1973
- var _overArg = overArg$1;
1974
-
1975
- var overArg = _overArg;
1976
-
1977
- /* Built-in method references for those with the same name as other `lodash` methods. */
1978
- var nativeKeys$1 = overArg(Object.keys, Object);
1979
-
1980
- var _nativeKeys = nativeKeys$1;
1981
-
1982
- var isPrototype = _isPrototype,
1983
- nativeKeys = _nativeKeys;
1984
-
1985
- /** Used for built-in method references. */
1986
- var objectProto$2 = Object.prototype;
1987
-
1988
- /** Used to check objects for own properties. */
1989
- var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
1990
-
1991
- /**
1992
- * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
1993
- *
1994
- * @private
1995
- * @param {Object} object The object to query.
1996
- * @returns {Array} Returns the array of property names.
1997
- */
1998
- function baseKeys$1(object) {
1999
- if (!isPrototype(object)) {
2000
- return nativeKeys(object);
2001
- }
2002
- var result = [];
2003
- for (var key in Object(object)) {
2004
- if (hasOwnProperty$2.call(object, key) && key != 'constructor') {
2005
- result.push(key);
2006
- }
2007
- }
2008
- return result;
2009
- }
2010
-
2011
- var _baseKeys = baseKeys$1;
2012
-
2013
- var isFunction = isFunction_1,
2014
- isLength = isLength_1;
2015
-
2016
- /**
2017
- * Checks if `value` is array-like. A value is considered array-like if it's
2018
- * not a function and has a `value.length` that's an integer greater than or
2019
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
2020
- *
2021
- * @static
2022
- * @memberOf _
2023
- * @since 4.0.0
2024
- * @category Lang
2025
- * @param {*} value The value to check.
2026
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
2027
- * @example
2028
- *
2029
- * _.isArrayLike([1, 2, 3]);
2030
- * // => true
2031
- *
2032
- * _.isArrayLike(document.body.children);
2033
- * // => true
2034
- *
2035
- * _.isArrayLike('abc');
2036
- * // => true
2037
- *
2038
- * _.isArrayLike(_.noop);
2039
- * // => false
2040
- */
2041
- function isArrayLike$1(value) {
2042
- return value != null && isLength(value.length) && !isFunction(value);
2043
- }
2044
-
2045
- var isArrayLike_1 = isArrayLike$1;
2046
-
2047
- var arrayLikeKeys = _arrayLikeKeys,
2048
- baseKeys = _baseKeys,
2049
- isArrayLike = isArrayLike_1;
2050
-
2051
- /**
2052
- * Creates an array of the own enumerable property names of `object`.
2053
- *
2054
- * **Note:** Non-object values are coerced to objects. See the
2055
- * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
2056
- * for more details.
2057
- *
2058
- * @static
2059
- * @since 0.1.0
2060
- * @memberOf _
2061
- * @category Object
2062
- * @param {Object} object The object to query.
2063
- * @returns {Array} Returns the array of property names.
2064
- * @example
2065
- *
2066
- * function Foo() {
2067
- * this.a = 1;
2068
- * this.b = 2;
2069
- * }
2070
- *
2071
- * Foo.prototype.c = 3;
2072
- *
2073
- * _.keys(new Foo);
2074
- * // => ['a', 'b'] (iteration order is not guaranteed)
2075
- *
2076
- * _.keys('hi');
2077
- * // => ['0', '1']
2078
- */
2079
- function keys$1(object) {
2080
- return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
2081
- }
2082
-
2083
- var keys_1 = keys$1;
2084
-
2085
- var baseGetAllKeys = _baseGetAllKeys,
2086
- getSymbols = _getSymbols,
2087
- keys = keys_1;
2088
-
2089
- /**
2090
- * Creates an array of own enumerable property names and symbols of `object`.
2091
- *
2092
- * @private
2093
- * @param {Object} object The object to query.
2094
- * @returns {Array} Returns the array of property names and symbols.
2095
- */
2096
- function getAllKeys$1(object) {
2097
- return baseGetAllKeys(object, keys, getSymbols);
2098
- }
2099
-
2100
- var _getAllKeys = getAllKeys$1;
2101
-
2102
- var getAllKeys = _getAllKeys;
2103
-
2104
- /** Used to compose bitmasks for value comparisons. */
2105
- var COMPARE_PARTIAL_FLAG$1 = 1;
2106
-
2107
- /** Used for built-in method references. */
2108
- var objectProto$1 = Object.prototype;
2109
-
2110
- /** Used to check objects for own properties. */
2111
- var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
2112
-
2113
- /**
2114
- * A specialized version of `baseIsEqualDeep` for objects with support for
2115
- * partial deep comparisons.
2116
- *
2117
- * @private
2118
- * @param {Object} object The object to compare.
2119
- * @param {Object} other The other object to compare.
2120
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
2121
- * @param {Function} customizer The function to customize comparisons.
2122
- * @param {Function} equalFunc The function to determine equivalents of values.
2123
- * @param {Object} stack Tracks traversed `object` and `other` objects.
2124
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
2125
- */
2126
- function equalObjects$1(object, other, bitmask, customizer, equalFunc, stack) {
2127
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1,
2128
- objProps = getAllKeys(object),
2129
- objLength = objProps.length,
2130
- othProps = getAllKeys(other),
2131
- othLength = othProps.length;
2132
-
2133
- if (objLength != othLength && !isPartial) {
2134
- return false;
2135
- }
2136
- var index = objLength;
2137
- while (index--) {
2138
- var key = objProps[index];
2139
- if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) {
2140
- return false;
2141
- }
2142
- }
2143
- // Check that cyclic values are equal.
2144
- var objStacked = stack.get(object);
2145
- var othStacked = stack.get(other);
2146
- if (objStacked && othStacked) {
2147
- return objStacked == other && othStacked == object;
2148
- }
2149
- var result = true;
2150
- stack.set(object, other);
2151
- stack.set(other, object);
2152
-
2153
- var skipCtor = isPartial;
2154
- while (++index < objLength) {
2155
- key = objProps[index];
2156
- var objValue = object[key],
2157
- othValue = other[key];
2158
-
2159
- if (customizer) {
2160
- var compared = isPartial
2161
- ? customizer(othValue, objValue, key, other, object, stack)
2162
- : customizer(objValue, othValue, key, object, other, stack);
2163
- }
2164
- // Recursively compare objects (susceptible to call stack limits).
2165
- if (!(compared === undefined
2166
- ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
2167
- : compared
2168
- )) {
2169
- result = false;
2170
- break;
2171
- }
2172
- skipCtor || (skipCtor = key == 'constructor');
2173
- }
2174
- if (result && !skipCtor) {
2175
- var objCtor = object.constructor,
2176
- othCtor = other.constructor;
2177
-
2178
- // Non `Object` object instances with different constructors are not equal.
2179
- if (objCtor != othCtor &&
2180
- ('constructor' in object && 'constructor' in other) &&
2181
- !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
2182
- typeof othCtor == 'function' && othCtor instanceof othCtor)) {
2183
- result = false;
2184
- }
2185
- }
2186
- stack['delete'](object);
2187
- stack['delete'](other);
2188
- return result;
2189
- }
2190
-
2191
- var _equalObjects = equalObjects$1;
2192
-
2193
- var getNative$3 = _getNative,
2194
- root$3 = _root;
2195
-
2196
- /* Built-in method references that are verified to be native. */
2197
- var DataView$1 = getNative$3(root$3, 'DataView');
2198
-
2199
- var _DataView = DataView$1;
2200
-
2201
- var getNative$2 = _getNative,
2202
- root$2 = _root;
2203
-
2204
- /* Built-in method references that are verified to be native. */
2205
- var Promise$2 = getNative$2(root$2, 'Promise');
2206
-
2207
- var _Promise = Promise$2;
2208
-
2209
- var getNative$1 = _getNative,
2210
- root$1 = _root;
2211
-
2212
- /* Built-in method references that are verified to be native. */
2213
- var Set$1 = getNative$1(root$1, 'Set');
2214
-
2215
- var _Set = Set$1;
2216
-
2217
- var getNative = _getNative,
2218
- root = _root;
2219
-
2220
- /* Built-in method references that are verified to be native. */
2221
- var WeakMap$1 = getNative(root, 'WeakMap');
2222
-
2223
- var _WeakMap = WeakMap$1;
2224
-
2225
- var DataView = _DataView,
2226
- Map$1 = _Map,
2227
- Promise$1 = _Promise,
2228
- Set = _Set,
2229
- WeakMap = _WeakMap,
2230
- baseGetTag = _baseGetTag,
2231
- toSource = _toSource;
2232
-
2233
- /** `Object#toString` result references. */
2234
- var mapTag = '[object Map]',
2235
- objectTag$1 = '[object Object]',
2236
- promiseTag = '[object Promise]',
2237
- setTag = '[object Set]',
2238
- weakMapTag = '[object WeakMap]';
2239
-
2240
- var dataViewTag = '[object DataView]';
2241
-
2242
- /** Used to detect maps, sets, and weakmaps. */
2243
- var dataViewCtorString = toSource(DataView),
2244
- mapCtorString = toSource(Map$1),
2245
- promiseCtorString = toSource(Promise$1),
2246
- setCtorString = toSource(Set),
2247
- weakMapCtorString = toSource(WeakMap);
2248
-
2249
- /**
2250
- * Gets the `toStringTag` of `value`.
2251
- *
2252
- * @private
2253
- * @param {*} value The value to query.
2254
- * @returns {string} Returns the `toStringTag`.
2255
- */
2256
- var getTag$1 = baseGetTag;
2257
-
2258
- // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
2259
- if ((DataView && getTag$1(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
2260
- (Map$1 && getTag$1(new Map$1) != mapTag) ||
2261
- (Promise$1 && getTag$1(Promise$1.resolve()) != promiseTag) ||
2262
- (Set && getTag$1(new Set) != setTag) ||
2263
- (WeakMap && getTag$1(new WeakMap) != weakMapTag)) {
2264
- getTag$1 = function(value) {
2265
- var result = baseGetTag(value),
2266
- Ctor = result == objectTag$1 ? value.constructor : undefined,
2267
- ctorString = Ctor ? toSource(Ctor) : '';
2268
-
2269
- if (ctorString) {
2270
- switch (ctorString) {
2271
- case dataViewCtorString: return dataViewTag;
2272
- case mapCtorString: return mapTag;
2273
- case promiseCtorString: return promiseTag;
2274
- case setCtorString: return setTag;
2275
- case weakMapCtorString: return weakMapTag;
2276
- }
2277
- }
2278
- return result;
2279
- };
2280
- }
2281
-
2282
- var _getTag = getTag$1;
2283
-
2284
- var Stack = _Stack,
2285
- equalArrays = _equalArrays,
2286
- equalByTag = _equalByTag,
2287
- equalObjects = _equalObjects,
2288
- getTag = _getTag,
2289
- isArray = isArray_1,
2290
- isBuffer = isBuffer$2.exports,
2291
- isTypedArray = isTypedArray_1;
2292
-
2293
- /** Used to compose bitmasks for value comparisons. */
2294
- var COMPARE_PARTIAL_FLAG = 1;
2295
-
2296
- /** `Object#toString` result references. */
2297
- var argsTag = '[object Arguments]',
2298
- arrayTag = '[object Array]',
2299
- objectTag = '[object Object]';
2300
-
2301
- /** Used for built-in method references. */
2302
- var objectProto = Object.prototype;
2303
-
2304
- /** Used to check objects for own properties. */
2305
- var hasOwnProperty = objectProto.hasOwnProperty;
2306
-
2307
- /**
2308
- * A specialized version of `baseIsEqual` for arrays and objects which performs
2309
- * deep comparisons and tracks traversed objects enabling objects with circular
2310
- * references to be compared.
2311
- *
2312
- * @private
2313
- * @param {Object} object The object to compare.
2314
- * @param {Object} other The other object to compare.
2315
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
2316
- * @param {Function} customizer The function to customize comparisons.
2317
- * @param {Function} equalFunc The function to determine equivalents of values.
2318
- * @param {Object} [stack] Tracks traversed `object` and `other` objects.
2319
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
2320
- */
2321
- function baseIsEqualDeep$1(object, other, bitmask, customizer, equalFunc, stack) {
2322
- var objIsArr = isArray(object),
2323
- othIsArr = isArray(other),
2324
- objTag = objIsArr ? arrayTag : getTag(object),
2325
- othTag = othIsArr ? arrayTag : getTag(other);
2326
-
2327
- objTag = objTag == argsTag ? objectTag : objTag;
2328
- othTag = othTag == argsTag ? objectTag : othTag;
2329
-
2330
- var objIsObj = objTag == objectTag,
2331
- othIsObj = othTag == objectTag,
2332
- isSameTag = objTag == othTag;
2333
-
2334
- if (isSameTag && isBuffer(object)) {
2335
- if (!isBuffer(other)) {
2336
- return false;
2337
- }
2338
- objIsArr = true;
2339
- objIsObj = false;
2340
- }
2341
- if (isSameTag && !objIsObj) {
2342
- stack || (stack = new Stack);
2343
- return (objIsArr || isTypedArray(object))
2344
- ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
2345
- : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
2346
- }
2347
- if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
2348
- var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
2349
- othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
2350
-
2351
- if (objIsWrapped || othIsWrapped) {
2352
- var objUnwrapped = objIsWrapped ? object.value() : object,
2353
- othUnwrapped = othIsWrapped ? other.value() : other;
2354
-
2355
- stack || (stack = new Stack);
2356
- return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
2357
- }
2358
- }
2359
- if (!isSameTag) {
2360
- return false;
2361
- }
2362
- stack || (stack = new Stack);
2363
- return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
2364
- }
2365
-
2366
- var _baseIsEqualDeep = baseIsEqualDeep$1;
2367
-
2368
- var baseIsEqualDeep = _baseIsEqualDeep,
2369
- isObjectLike = isObjectLike_1;
2370
-
2371
- /**
2372
- * The base implementation of `_.isEqual` which supports partial comparisons
2373
- * and tracks traversed objects.
2374
- *
2375
- * @private
2376
- * @param {*} value The value to compare.
2377
- * @param {*} other The other value to compare.
2378
- * @param {boolean} bitmask The bitmask flags.
2379
- * 1 - Unordered comparison
2380
- * 2 - Partial comparison
2381
- * @param {Function} [customizer] The function to customize comparisons.
2382
- * @param {Object} [stack] Tracks traversed `value` and `other` objects.
2383
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
2384
- */
2385
- function baseIsEqual$1(value, other, bitmask, customizer, stack) {
2386
- if (value === other) {
2387
- return true;
2388
- }
2389
- if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
2390
- return value !== value && other !== other;
2391
- }
2392
- return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual$1, stack);
2393
- }
2394
-
2395
- var _baseIsEqual = baseIsEqual$1;
2396
-
2397
- var baseIsEqual = _baseIsEqual;
2398
-
2399
- /**
2400
- * Performs a deep comparison between two values to determine if they are
2401
- * equivalent.
2402
- *
2403
- * **Note:** This method supports comparing arrays, array buffers, booleans,
2404
- * date objects, error objects, maps, numbers, `Object` objects, regexes,
2405
- * sets, strings, symbols, and typed arrays. `Object` objects are compared
2406
- * by their own, not inherited, enumerable properties. Functions and DOM
2407
- * nodes are compared by strict equality, i.e. `===`.
2408
- *
2409
- * @static
2410
- * @memberOf _
2411
- * @since 0.1.0
2412
- * @category Lang
2413
- * @param {*} value The value to compare.
2414
- * @param {*} other The other value to compare.
2415
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
2416
- * @example
2417
- *
2418
- * var object = { 'a': 1 };
2419
- * var other = { 'a': 1 };
2420
- *
2421
- * _.isEqual(object, other);
2422
- * // => true
2423
- *
2424
- * object === other;
2425
- * // => false
2426
- */
2427
- function isEqual(value, other) {
2428
- return baseIsEqual(value, other);
2429
- }
2430
-
2431
- var isEqual_1 = isEqual;
2432
-
2433
- var AxiosCancel = /** @class */ (function () {
2434
- function AxiosCancel() {
2435
- // private axiosCancelToken = new AxiosCancelToken();
2436
- this.pendingRequests = new Map();
2437
- }
2438
- /**
2439
- * 获取请求参数唯一key值
2440
- */
2441
- AxiosCancel.prototype.getKey = function (config) {
2442
- return [config.url, config.params, config.data]
2443
- .filter(function (item) { return item; })
2444
- .map(function (item) { return JSON.stringify(item); })
2445
- .join('-');
2446
- };
2447
- /**
2448
- * @description 发起请求之前,拦截重复请求
2449
- */
2450
- AxiosCancel.prototype.pendingRequestCancel = function (config) {
2451
- var key = this.getKey(config);
2452
- var cancelTokenObj = axios.CancelToken.source();
2453
- // 将token挂载到当前接口的请求头里面
2454
- config.cancelToken = cancelTokenObj.token;
2455
- if (this.pendingRequests.has(key)) {
2456
- this.pendingRequests.get(key).cancel('拦截重复请求');
2457
- this.pendingRequests.delete(key);
2458
- }
2459
- this.pendingRequests.set(key, {
2460
- cancel: cancelTokenObj.cancel,
2461
- });
2462
- };
2463
- /**
2464
- * @description 请求完成之后, 清除pendingRequest
2465
- */
2466
- AxiosCancel.prototype.clearPendingRequest = function (reponse) {
2467
- var key = this.getKey(reponse.config);
2468
- this.pendingRequests.delete(key);
2469
- };
2470
- return AxiosCancel;
2471
- }());
2472
- var axiosCancel = new AxiosCancel();
2473
-
2474
- var timeoutNum = 60000;
2475
- var isRefreshing = true; // 是否需要刷新
2476
- var subscribers = []; // 缓存需要帮助请求的接口
2477
- var requestTokenEndTime = 0; // token调用结束时间
2478
- var reqTokenTimeInterval = 1000; // token调用最小间隔,如果超过这个数 那么就跳转到登录去
2479
- var isMessage = false; // 超时弹框
2480
- var isNotFound = false; // 404弹框
2481
- var isOffSite = false; // 501异地登录
2482
- var isExpiration = false; // 401登录过期
2483
- var catchPromiseObj = []; // 缓存当前宏任务下的缓存
2484
- var __isTimeoutMessage = false; // 是否需要默认展示超时弹框
2485
- var isFirstSet = false; // 首次初始化
2486
- // 'Basic em1kbXM6em1kbXNfc2VjcmV0' 新的auth
2487
- // Basic c3dvcmQ6c3dvcmRfc2VjcmV0 旧的auth
2488
- var OLD_AUTHORIZATION = 'Basic c3dvcmQ6c3dvcmRfc2VjcmV0';
2489
- var NEW_AUTHORIZATION = 'Basic em1kbXM6em1kbXNfc2VjcmV0';
2490
- var Authorization = OLD_AUTHORIZATION;
2491
- // 用于存储目前状态为pending的请求标识信息 2023-05-15
2492
- var pendingRequest = [];
2493
- function loginRequest(params, InnerAuthorization) {
2494
- return request({
2495
- method: 'POST',
2496
- url: "/api/" + BASIC_KEY + "-auth/oauth/token",
2497
- baseURL: '',
2498
- headers: {
2499
- 'Content-Type': 'application/x-www-form-urlencoded',
2500
- 'Tenant-Id': '000000',
2501
- Authorization: InnerAuthorization ? InnerAuthorization : Authorization,
2502
- 'User-Type': 'web',
2503
- },
2504
- params: params,
2505
- });
2506
- }
2507
- function checkStatus(response, jumpCallback, otherOptions) {
2508
- var InnerAuthorization = (otherOptions || {}).InnerAuthorization;
2509
- if ((response === null || response === void 0 ? void 0 : response.status) === 401) {
2510
- if (isRefreshing) {
2511
- if (Date.now() - requestTokenEndTime > reqTokenTimeInterval) {
2512
- refreshTokenRequst(jumpCallback, InnerAuthorization);
2513
- }
2514
- else {
2515
- message.info("\u5237\u65B0token\u906D\u5230\u9891\u7E41\u8C03\u7528\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u67E5\u770B\u662F\u5426\u63A5\u53E3\u6743\u9650\u51FA\u73B0\u95EE\u9898\uFF0C\u53EF\u80FD\u662F" + (response === null || response === void 0 ? void 0 : response.config.url) + "\u63A5\u53E3\u51FA\u73B0\u95EE\u9898", 5);
2516
- requestTokenEndTime = 0;
2517
- }
2518
- }
2519
- isRefreshing = false;
2520
- // 注释调 帮助用户发送请求逻辑
2521
- // 将失败请求放入promise数组里面
2522
- // const retryOriginalRequest = new Promise((resolve) => {
2523
- // // 如果重复的请求 不放在数组里面
2524
- // if (
2525
- // !repeatResponse.find((item) =>
2526
- // isEqual(item, {
2527
- // url: response?.config.url,
2528
- // params: response?.config.params,
2529
- // })
2530
- // )
2531
- // ) {
2532
- // repeatResponse.push({
2533
- // url: response?.config.url,
2534
- // params: response?.config.params,
2535
- // });
2536
- // addSubscriber(() => {
2537
- // resolve(
2538
- // request({
2539
- // url: response?.config.url,
2540
- // params: response?.config.params,
2541
- // })
2542
- // );
2543
- // });
2544
- // }
2545
- // });
2546
- // return retryOriginalRequest;
2547
- }
2548
- }
2549
- function refreshTokenRequst(jumpCallback, Authorization) {
2550
- loginRequest({
2551
- tenantId: '000000',
2552
- grant_type: 'refresh_token',
2553
- scope: 'all',
2554
- refresh_token: getRefreshToken(),
2555
- }, Authorization)
2556
- .then(function (response) {
2557
- var data = response.data, status = response.status;
2558
- if (status === 200) {
2559
- requestTokenEndTime = Date.now();
2560
- // 刷新成功 重置token 重置refresh-token
2561
- setToken(data === null || data === void 0 ? void 0 : data.access_token);
2562
- setRefreshToken(data === null || data === void 0 ? void 0 : data.refresh_token);
2563
- onAccessTokenFetched();
2564
- isRefreshing = true;
2565
- }
2566
- else {
2567
- requestTokenEndTime = 0;
2568
- if (!isExpiration) {
2569
- isExpiration = true;
2570
- removeToken();
2571
- removeRefreshToken();
2572
- if (jumpCallback) {
2573
- jumpCallback(401);
2574
- }
2575
- else {
2576
- message.info("\u767B\u5F55\u8FC7\u671F\uFF01", 3.5, function () {
2577
- isExpiration = false;
2578
- });
2579
- window.location.href = '/login';
2580
- }
2581
- }
2582
- }
2583
- })
2584
- .catch(function (error) {
2585
- requestTokenEndTime = 0;
2586
- if (!isExpiration) {
2587
- isExpiration = true;
2588
- if (jumpCallback) {
2589
- jumpCallback(401);
2590
- }
2591
- else {
2592
- message.info("\u767B\u5F55\u8FC7\u671F\uFF01", 3.5, function () {
2593
- isExpiration = false;
2594
- });
2595
- window.location.href = '/login';
2596
- }
2597
- }
2598
- });
2599
- }
2600
- // 将失败的token存储到promise数组里面
2601
- function onAccessTokenFetched() {
2602
- subscribers.forEach(function (callback) {
2603
- callback && callback();
2604
- });
2605
- subscribers = [];
2606
- }
2607
- function setInterceptorsResponse(jumpCallback, otherOptions) {
2608
- // 拦截器,拦截响应头信息
2609
- var isRefreshToken = (otherOptions || {}).isRefreshToken;
2610
- axios.interceptors.response.use(function (response) {
2611
- var _a, _b, _c;
2612
- // catchPromiseObj = [];
2613
- axiosCancel.clearPendingRequest(response);
2614
- if ((_a = response.config) === null || _a === void 0 ? void 0 : _a.noInterceptorsResponse) {
2615
- return Promise.resolve(response);
2616
- }
2617
- if (response.status === 200) {
2618
- if ((_b = response === null || response === void 0 ? void 0 : response.data) === null || _b === void 0 ? void 0 : _b.code) {
2619
- if (((_c = response === null || response === void 0 ? void 0 : response.data) === null || _c === void 0 ? void 0 : _c.code) === 200) {
2620
- return Promise.resolve(response);
2621
- }
2622
- else {
2623
- return Promise.reject({ response: response });
2624
- }
2625
- }
2626
- else {
2627
- return Promise.resolve(response);
2628
- }
2629
- }
2630
- else if (response.status === 201) {
2631
- return Promise.resolve(response);
2632
- }
2633
- else {
2634
- return Promise.reject(response);
2635
- }
2636
- }, function (error) {
2637
- var _a, _b, _c, _d, _e;
2638
- // catchPromiseObj = [];
2639
- console.error(error);
2640
- var errRes = error === null || error === void 0 ? void 0 : error.response;
2641
- /** 如果接口出错了,那么清理掉这个错误的接口 */
2642
- var item = catchPromiseObj.findIndex(function (item) {
2643
- return isEqual_1({
2644
- url: item.url,
2645
- params: item.params,
2646
- }, {
2647
- url: error === null || error === void 0 ? void 0 : error.config.url,
2648
- params: error === null || error === void 0 ? void 0 : error.config.params,
2649
- });
2650
- });
2651
- if (item !== -1) {
2652
- catchPromiseObj.splice(item, 1);
2653
- }
2654
- console.log(error === null || error === void 0 ? void 0 : error.config, catchPromiseObj);
2655
- /** 如果接口出错了,那么清理掉这个错误的接口 */
2656
- // 超时异常统一处理,超时的异常没有response值,只能通过toString处理
2657
- if (!errRes && error.toString().indexOf(timeoutNum + "ms") !== -1) {
2658
- if (!isMessage) {
2659
- if (((_b = (_a = error === null || error === void 0 ? void 0 : error.config) === null || _a === void 0 ? void 0 : _a.method) === null || _b === void 0 ? void 0 : _b.toUpperCase()) === 'POST' &&
2660
- __isTimeoutMessage) {
2661
- isMessage = true;
2662
- Modal.confirm({
2663
- title: "\u8BF7\u6C42\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5\uFF0C\u8BF7\u53BB\u5217\u8868\u786E\u8BA4\u6570\u636E\u662F\u5426\u63D2\u5165\u6210\u529F\uFF0C\u8BF7\u52FF\u91CD\u590D\u63D0\u4EA4\uFF01\n\u63A5\u53E3\u5730\u5740:" + ((_c = error === null || error === void 0 ? void 0 : error.config) === null || _c === void 0 ? void 0 : _c.url) + "\n\u8BF7\u6C42\u65B9\u5F0F:" + ((_d = error === null || error === void 0 ? void 0 : error.config) === null || _d === void 0 ? void 0 : _d.method) + "\n\u8BF7\u6C42\u8D85\u65F6\u65F6\u95F4:" + ((_e = error === null || error === void 0 ? void 0 : error.config) === null || _e === void 0 ? void 0 : _e.timeout),
2664
- okCancel: false,
2665
- onOk: function () {
2666
- isMessage = false;
2667
- },
2668
- });
2669
- }
2670
- }
2671
- return Promise.reject(error);
2672
- }
2673
- // 接口404处理
2674
- if ((errRes === null || errRes === void 0 ? void 0 : errRes.status) === 404) {
2675
- if (!isNotFound) {
2676
- isNotFound = true;
2677
- message.info("\u63A5\u53E3: " + errRes.config.url + " \u672A\u627E\u5230\uFF01", 3.5, function () {
2678
- isNotFound = false;
2679
- });
2680
- }
2681
- return Promise.reject(error);
2682
- }
2683
- // 接口501处理
2684
- if ((errRes === null || errRes === void 0 ? void 0 : errRes.status) === 501) {
2685
- if (!isOffSite) {
2686
- isOffSite = true;
2687
- removeToken();
2688
- removeRefreshToken();
2689
- if (jumpCallback) {
2690
- jumpCallback(errRes === null || errRes === void 0 ? void 0 : errRes.status);
2691
- }
2692
- else {
2693
- message.info("\u4F60\u7684\u8D26\u53F7\u5DF2\u5728\u5176\u4ED6\u5730\u65B9\u767B\u5F55\uFF01", 3.5, function () {
2694
- isOffSite = false;
2695
- });
2696
- window.location.href = '/login';
2697
- }
2698
- }
2699
- return Promise.reject(error);
2700
- }
2701
- // 接口401处理,401状态后不需要重新刷新token,直接退出登录
2702
- if ((errRes === null || errRes === void 0 ? void 0 : errRes.status) === 401 && !isRefreshToken) {
2703
- if (!isExpiration) {
2704
- isExpiration = true;
2705
- removeToken();
2706
- removeRefreshToken();
2707
- if (jumpCallback) {
2708
- jumpCallback(errRes === null || errRes === void 0 ? void 0 : errRes.status);
2709
- }
2710
- else {
2711
- message.info("\u767B\u5F55\u8FC7\u671F\uFF01", 3.5, function () {
2712
- isExpiration = false;
2713
- });
2714
- window.location.href = '/login';
2715
- }
2716
- }
2717
- return Promise.reject(error);
2718
- }
2719
- // 其余的异常,全部交给业务自己处理
2720
- checkStatus(errRes, jumpCallback, otherOptions);
2721
- return Promise.reject(error);
2722
- });
2723
- }
2724
- function setInterceptorsRequest() {
2725
- // 拦截器,拦截响应头信息
2726
- axios.interceptors.request.use(function (config) {
2727
- var _a, _b, _c;
2728
- if (config.isCancelRepeat) {
2729
- axiosCancel.pendingRequestCancel(config);
2730
- }
2731
- // 如果需要清除未完成的请求 2023-05-15
2732
- if (config.isCancelNoCompleteRequest &&
2733
- !config.cancelToken &&
2734
- ((_a = config.method) === null || _a === void 0 ? void 0 : _a.toUpperCase()) !== 'POST' &&
2735
- !((_c = (_b = config.url) === null || _b === void 0 ? void 0 : _b.includes) === null || _c === void 0 ? void 0 : _c.call(_b, BASIC_KEY + "-resource"))) {
2736
- var cancelTokenObj = axios.CancelToken.source();
2737
- config.cancelToken = cancelTokenObj.token;
2738
- pendingRequest.push(cancelTokenObj.cancel);
2739
- }
2740
- return config;
2741
- });
2742
- }
2743
- function transformObj(obj) {
2744
- if (typeof obj === 'undefined') {
2745
- return null;
2746
- }
2747
- if (typeof obj === 'object' && obj !== null) {
2748
- if (Array.isArray(obj)) {
2749
- return obj.map(function (item) { return transformObj(item); });
2750
- }
2751
- else {
2752
- if (obj instanceof File) {
2753
- return obj;
2754
- }
2755
- if (obj instanceof FormData) {
2756
- return obj;
2757
- }
2758
- var newObj = {};
2759
- for (var key in obj) {
2760
- if (obj.hasOwnProperty(key)) {
2761
- newObj[key] = transformObj(obj[key]);
2762
- }
2763
- }
2764
- return newObj;
2765
- }
2766
- }
2767
- return obj;
2768
- }
2769
- function request(myOptions, jumpCallback, otherOptions) {
2770
- var _a;
2771
- var _b, _c, _d, _e, _f, _g, _h, _j, _k;
2772
- var InnerAuthorization = (otherOptions || {}).InnerAuthorization;
2773
- if (!isFirstSet) {
2774
- setInterceptorsRequest();
2775
- setInterceptorsResponse(jumpCallback, otherOptions);
2776
- isFirstSet = true;
2777
- }
2778
- var encryptionType = myOptions.encryptionType, isTimeoutMessage = myOptions.isTimeoutMessage, isForceRequest = myOptions.isForceRequest, _l = myOptions.noCatchUrl, noCatchUrl = _l === void 0 ? [] : _l, isCatch = myOptions.isCatch, mustCatch = myOptions.mustCatch, options = __rest(myOptions, ["encryptionType", "isTimeoutMessage", "isForceRequest", "noCatchUrl", "isCatch", "mustCatch"]);
2779
- timeoutNum =
2780
- typeof myOptions.timeout === 'number' ? myOptions.timeout : timeoutNum;
2781
- __isTimeoutMessage = isTimeoutMessage;
2782
- // 获取token
2783
- var token = getToken();
2784
- // 默认配置,请求头,超时时间,基础url
2785
- var defaultOptions = {
2786
- timeout: timeoutNum,
2787
- // baseURL: ZT_API_BASEURL,
2788
- headers: (_a = {},
2789
- _a[TOKEN_KEY] = "bearer " + token,
2790
- _a['Tenant-Id'] = '000000',
2791
- _a.Authorization = InnerAuthorization ? InnerAuthorization : Authorization,
2792
- _a),
2793
- };
2794
- if ((_b = options.baseURL) === null || _b === void 0 ? void 0 : _b.endsWith('/')) {
2795
- if ((_c = options.url) === null || _c === void 0 ? void 0 : _c.startsWith('/')) {
2796
- options.url = (_d = options.url) === null || _d === void 0 ? void 0 : _d.slice(1);
2797
- }
2798
- }
2799
- else if (!((_e = options.url) === null || _e === void 0 ? void 0 : _e.startsWith('/'))) {
2800
- options.url = "/" + options.url;
2801
- }
2802
- // 遍历params,将undefined的值,变为null值或空字符串(undefined会被JSON.stringify忽略)
2803
- if (options.data) {
2804
- options.data = transformObj(options.data);
2805
- }
2806
- if (options.params) {
2807
- options.params = transformObj(options.params);
2808
- }
2809
- // 将传入配置与默认配置混合
2810
- var newOptions = __assign(__assign(__assign({}, defaultOptions), options), { headers: __assign(__assign({}, defaultOptions.headers), options.headers) });
2811
- // 特殊请求处理
2812
- if (((_f = newOptions.method) === null || _f === void 0 ? void 0 : _f.toUpperCase()) === 'POST' ||
2813
- ((_g = newOptions.method) === null || _g === void 0 ? void 0 : _g.toUpperCase()) === 'PUT' ||
2814
- ((_h = newOptions.method) === null || _h === void 0 ? void 0 : _h.toUpperCase()) === 'PATCH') {
2815
- if (newOptions.isFormData) {
2816
- // 表单提交操作
2817
- var formData = new FormData();
2818
- var dataObj = newOptions.data || {};
2819
- var dataKey = Object.keys(dataObj);
2820
- var dataVal = Object.values(dataObj);
2821
- for (var i = 0; i < dataKey.length; i++) {
2822
- if (dataVal[i]) {
2823
- formData.append(dataKey[i], dataVal[i]);
2824
- }
2825
- }
2826
- newOptions.headers = __assign(__assign({}, newOptions.headers), { 'Content-Type': 'multipart/form-data' });
2827
- newOptions.data = formData;
2828
- }
2829
- else {
2830
- newOptions.headers = __assign({ 'Content-Type': 'application/json' }, newOptions.headers);
2831
- }
2832
- }
2833
- // 将参数进行aes加密
2834
- if (newOptions.data) {
2835
- if (encryptionType === true || encryptionType === 'aes') {
2836
- newOptions.data = crypto.encrypt(JSON.stringify(newOptions.data));
2837
- }
2838
- if (encryptionType === 'des') {
2839
- newOptions.data = crypto.encrypt_des(JSON.stringify(newOptions.data));
2840
- }
2841
- }
2842
- if (newOptions.params) {
2843
- if (encryptionType === true || encryptionType === 'aes') {
2844
- newOptions.params = {
2845
- data: crypto.encrypt(JSON.stringify(newOptions.params)),
2846
- };
2847
- }
2848
- if (encryptionType === 'des') {
2849
- newOptions.params = {
2850
- data: crypto.encrypt_des(JSON.stringify(newOptions.params)),
2851
- };
2852
- }
2853
- }
2854
- // 缓存本次宏任务下的GET请求,并且不是以/page结尾的列表分页接口
2855
- // 并且不是强制请求,强制请求需要
2856
- if ((((_j = newOptions.method) === null || _j === void 0 ? void 0 : _j.toUpperCase()) === 'GET' &&
2857
- !((_k = newOptions.url) === null || _k === void 0 ? void 0 : _k.endsWith('/page')) &&
2858
- !noCatchUrl.find(function (item) { var _a; return (_a = newOptions.url) === null || _a === void 0 ? void 0 : _a.endsWith(item); }) &&
2859
- isCatch) ||
2860
- mustCatch) {
2861
- // 能不能找到,url与参数都一样得数据
2862
- var index = catchPromiseObj.findIndex(function (item) {
2863
- return isEqual_1({
2864
- url: item.url,
2865
- params: item.params,
2866
- }, {
2867
- url: newOptions.url,
2868
- params: newOptions.params,
2869
- });
2870
- });
2871
- // 如果是强制请求,并且之前有缓存 那么删除掉之前的缓存
2872
- if (isForceRequest && index !== -1) {
2873
- catchPromiseObj.splice(index, 1);
2874
- index = -1;
2875
- }
2876
- if (index !== -1) {
2877
- var item = catchPromiseObj[index];
2878
- return item === null || item === void 0 ? void 0 : item.promiseObj;
2879
- }
2880
- else {
2881
- var result = axios(newOptions);
2882
- if (catchPromiseObj.length > 40) {
2883
- catchPromiseObj.shift();
2884
- }
2885
- catchPromiseObj.push({
2886
- url: newOptions.url,
2887
- params: newOptions.params,
2888
- promiseObj: result,
2889
- });
2890
- return result;
2891
- }
2892
- }
2893
- return axios(newOptions);
2894
- }
2895
- // 清除未完成的请求 2023-05-15
2896
- function clearNoCompleteRequest() {
2897
- pendingRequest.forEach(function (cancel, index) {
2898
- cancel && cancel();
2899
- });
2900
- pendingRequest = [];
2901
- }
2902
- function clearCatch() {
2903
- catchPromiseObj = [];
2904
- }
2905
-
2906
- var request$1 = /*#__PURE__*/Object.freeze({
2907
- __proto__: null,
2908
- OLD_AUTHORIZATION: OLD_AUTHORIZATION,
2909
- NEW_AUTHORIZATION: NEW_AUTHORIZATION,
2910
- 'default': request,
2911
- clearNoCompleteRequest: clearNoCompleteRequest,
2912
- clearCatch: clearCatch
2913
- });
2914
-
2915
- export { NEW_AUTHORIZATION as N, OLD_AUTHORIZATION as O, request as a, clearCatch as b, clearNoCompleteRequest as c, request$1 as r };