@reactuses/core 4.0.4 → 4.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -3,13 +3,10 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
- var lodashEs = require('lodash-es');
7
- var screenfull = require('screenfull');
8
6
 
9
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
8
 
11
9
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
12
- var screenfull__default = /*#__PURE__*/_interopDefaultLegacy(screenfull);
13
10
 
14
11
  function usePrevious(state) {
15
12
  const ref = React.useRef();
@@ -50,7 +47,7 @@ var useUpdateEffect = createUpdateEffect(React.useEffect);
50
47
  var index$3 = createUpdateEffect(React.useLayoutEffect);
51
48
 
52
49
  var _a;
53
- const isFunction = (val) => typeof val === "function";
50
+ const isFunction$1 = (val) => typeof val === "function";
54
51
  const isString = (val) => typeof val === "string";
55
52
  const isDev = process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
56
53
  const isBrowser = typeof window !== "undefined";
@@ -68,7 +65,7 @@ const useIsomorphicLayoutEffect = isBrowser ? React.useLayoutEffect : React.useE
68
65
 
69
66
  function useEvent(fn) {
70
67
  if (isDev) {
71
- if (!isFunction(fn)) {
68
+ if (!isFunction$1(fn)) {
72
69
  console.error(
73
70
  `useEvent expected parameter is a function, got ${typeof fn}`
74
71
  );
@@ -161,7 +158,7 @@ function useStorage(key, defaultValue, getStorage = () => isBrowser ? sessionSto
161
158
  getInitialState$3(key, defaultValue, storage, serializer, onError)
162
159
  );
163
160
  React.useEffect(() => {
164
- const data = csrData ? isFunction(csrData) ? csrData() : csrData : defaultValue;
161
+ const data = csrData ? isFunction$1(csrData) ? csrData() : csrData : defaultValue;
165
162
  const getStoredValue = () => {
166
163
  try {
167
164
  const raw = storage == null ? void 0 : storage.getItem(key);
@@ -179,7 +176,7 @@ function useStorage(key, defaultValue, getStorage = () => isBrowser ? sessionSto
179
176
  }, [key, defaultValue, serializer, storage, onError, csrData]);
180
177
  const updateState = useEvent(
181
178
  (valOrFunc) => {
182
- const currentState = isFunction(valOrFunc) ? valOrFunc(state) : valOrFunc;
179
+ const currentState = isFunction$1(valOrFunc) ? valOrFunc(state) : valOrFunc;
183
180
  setState(currentState);
184
181
  if (currentState === null) {
185
182
  storage == null ? void 0 : storage.removeItem(key);
@@ -333,7 +330,7 @@ function usePreferredDark(defaultState) {
333
330
 
334
331
  function useMount(fn) {
335
332
  if (isDev) {
336
- if (!isFunction(fn)) {
333
+ if (!isFunction$1(fn)) {
337
334
  console.error(
338
335
  `useMount: parameter \`fn\` expected to be a function, but got "${typeof fn}".`
339
336
  );
@@ -346,7 +343,7 @@ function useMount(fn) {
346
343
 
347
344
  function useUnmount(fn) {
348
345
  if (isDev) {
349
- if (!isFunction(fn)) {
346
+ if (!isFunction$1(fn)) {
350
347
  console.error(
351
348
  `useUnmount expected parameter is a function, got ${typeof fn}`
352
349
  );
@@ -361,9 +358,2415 @@ function useUnmount(fn) {
361
358
  );
362
359
  }
363
360
 
361
+ /** Detect free variable `global` from Node.js. */
362
+ var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
363
+
364
+ /** Detect free variable `self`. */
365
+ var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
366
+
367
+ /** Used as a reference to the global object. */
368
+ var root = freeGlobal || freeSelf || Function('return this')();
369
+
370
+ /** Built-in value references. */
371
+ var Symbol = root.Symbol;
372
+
373
+ /** Used for built-in method references. */
374
+ var objectProto$b = Object.prototype;
375
+
376
+ /** Used to check objects for own properties. */
377
+ var hasOwnProperty$8 = objectProto$b.hasOwnProperty;
378
+
379
+ /**
380
+ * Used to resolve the
381
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
382
+ * of values.
383
+ */
384
+ var nativeObjectToString$1 = objectProto$b.toString;
385
+
386
+ /** Built-in value references. */
387
+ var symToStringTag$1 = Symbol ? Symbol.toStringTag : undefined;
388
+
389
+ /**
390
+ * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
391
+ *
392
+ * @private
393
+ * @param {*} value The value to query.
394
+ * @returns {string} Returns the raw `toStringTag`.
395
+ */
396
+ function getRawTag(value) {
397
+ var isOwn = hasOwnProperty$8.call(value, symToStringTag$1),
398
+ tag = value[symToStringTag$1];
399
+
400
+ try {
401
+ value[symToStringTag$1] = undefined;
402
+ var unmasked = true;
403
+ } catch (e) {}
404
+
405
+ var result = nativeObjectToString$1.call(value);
406
+ if (unmasked) {
407
+ if (isOwn) {
408
+ value[symToStringTag$1] = tag;
409
+ } else {
410
+ delete value[symToStringTag$1];
411
+ }
412
+ }
413
+ return result;
414
+ }
415
+
416
+ /** Used for built-in method references. */
417
+ var objectProto$a = Object.prototype;
418
+
419
+ /**
420
+ * Used to resolve the
421
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
422
+ * of values.
423
+ */
424
+ var nativeObjectToString = objectProto$a.toString;
425
+
426
+ /**
427
+ * Converts `value` to a string using `Object.prototype.toString`.
428
+ *
429
+ * @private
430
+ * @param {*} value The value to convert.
431
+ * @returns {string} Returns the converted string.
432
+ */
433
+ function objectToString(value) {
434
+ return nativeObjectToString.call(value);
435
+ }
436
+
437
+ /** `Object#toString` result references. */
438
+ var nullTag = '[object Null]',
439
+ undefinedTag = '[object Undefined]';
440
+
441
+ /** Built-in value references. */
442
+ var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
443
+
444
+ /**
445
+ * The base implementation of `getTag` without fallbacks for buggy environments.
446
+ *
447
+ * @private
448
+ * @param {*} value The value to query.
449
+ * @returns {string} Returns the `toStringTag`.
450
+ */
451
+ function baseGetTag(value) {
452
+ if (value == null) {
453
+ return value === undefined ? undefinedTag : nullTag;
454
+ }
455
+ return (symToStringTag && symToStringTag in Object(value))
456
+ ? getRawTag(value)
457
+ : objectToString(value);
458
+ }
459
+
460
+ /**
461
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
462
+ * and has a `typeof` result of "object".
463
+ *
464
+ * @static
465
+ * @memberOf _
466
+ * @since 4.0.0
467
+ * @category Lang
468
+ * @param {*} value The value to check.
469
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
470
+ * @example
471
+ *
472
+ * _.isObjectLike({});
473
+ * // => true
474
+ *
475
+ * _.isObjectLike([1, 2, 3]);
476
+ * // => true
477
+ *
478
+ * _.isObjectLike(_.noop);
479
+ * // => false
480
+ *
481
+ * _.isObjectLike(null);
482
+ * // => false
483
+ */
484
+ function isObjectLike(value) {
485
+ return value != null && typeof value == 'object';
486
+ }
487
+
488
+ /** `Object#toString` result references. */
489
+ var symbolTag$1 = '[object Symbol]';
490
+
491
+ /**
492
+ * Checks if `value` is classified as a `Symbol` primitive or object.
493
+ *
494
+ * @static
495
+ * @memberOf _
496
+ * @since 4.0.0
497
+ * @category Lang
498
+ * @param {*} value The value to check.
499
+ * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
500
+ * @example
501
+ *
502
+ * _.isSymbol(Symbol.iterator);
503
+ * // => true
504
+ *
505
+ * _.isSymbol('abc');
506
+ * // => false
507
+ */
508
+ function isSymbol(value) {
509
+ return typeof value == 'symbol' ||
510
+ (isObjectLike(value) && baseGetTag(value) == symbolTag$1);
511
+ }
512
+
513
+ /**
514
+ * Checks if `value` is classified as an `Array` object.
515
+ *
516
+ * @static
517
+ * @memberOf _
518
+ * @since 0.1.0
519
+ * @category Lang
520
+ * @param {*} value The value to check.
521
+ * @returns {boolean} Returns `true` if `value` is an array, else `false`.
522
+ * @example
523
+ *
524
+ * _.isArray([1, 2, 3]);
525
+ * // => true
526
+ *
527
+ * _.isArray(document.body.children);
528
+ * // => false
529
+ *
530
+ * _.isArray('abc');
531
+ * // => false
532
+ *
533
+ * _.isArray(_.noop);
534
+ * // => false
535
+ */
536
+ var isArray = Array.isArray;
537
+
538
+ /** Used to match a single whitespace character. */
539
+ var reWhitespace = /\s/;
540
+
541
+ /**
542
+ * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
543
+ * character of `string`.
544
+ *
545
+ * @private
546
+ * @param {string} string The string to inspect.
547
+ * @returns {number} Returns the index of the last non-whitespace character.
548
+ */
549
+ function trimmedEndIndex(string) {
550
+ var index = string.length;
551
+
552
+ while (index-- && reWhitespace.test(string.charAt(index))) {}
553
+ return index;
554
+ }
555
+
556
+ /** Used to match leading whitespace. */
557
+ var reTrimStart = /^\s+/;
558
+
559
+ /**
560
+ * The base implementation of `_.trim`.
561
+ *
562
+ * @private
563
+ * @param {string} string The string to trim.
564
+ * @returns {string} Returns the trimmed string.
565
+ */
566
+ function baseTrim(string) {
567
+ return string
568
+ ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
569
+ : string;
570
+ }
571
+
572
+ /**
573
+ * Checks if `value` is the
574
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
575
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
576
+ *
577
+ * @static
578
+ * @memberOf _
579
+ * @since 0.1.0
580
+ * @category Lang
581
+ * @param {*} value The value to check.
582
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
583
+ * @example
584
+ *
585
+ * _.isObject({});
586
+ * // => true
587
+ *
588
+ * _.isObject([1, 2, 3]);
589
+ * // => true
590
+ *
591
+ * _.isObject(_.noop);
592
+ * // => true
593
+ *
594
+ * _.isObject(null);
595
+ * // => false
596
+ */
597
+ function isObject(value) {
598
+ var type = typeof value;
599
+ return value != null && (type == 'object' || type == 'function');
600
+ }
601
+
602
+ /** Used as references for various `Number` constants. */
603
+ var NAN = 0 / 0;
604
+
605
+ /** Used to detect bad signed hexadecimal string values. */
606
+ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
607
+
608
+ /** Used to detect binary string values. */
609
+ var reIsBinary = /^0b[01]+$/i;
610
+
611
+ /** Used to detect octal string values. */
612
+ var reIsOctal = /^0o[0-7]+$/i;
613
+
614
+ /** Built-in method references without a dependency on `root`. */
615
+ var freeParseInt = parseInt;
616
+
617
+ /**
618
+ * Converts `value` to a number.
619
+ *
620
+ * @static
621
+ * @memberOf _
622
+ * @since 4.0.0
623
+ * @category Lang
624
+ * @param {*} value The value to process.
625
+ * @returns {number} Returns the number.
626
+ * @example
627
+ *
628
+ * _.toNumber(3.2);
629
+ * // => 3.2
630
+ *
631
+ * _.toNumber(Number.MIN_VALUE);
632
+ * // => 5e-324
633
+ *
634
+ * _.toNumber(Infinity);
635
+ * // => Infinity
636
+ *
637
+ * _.toNumber('3.2');
638
+ * // => 3.2
639
+ */
640
+ function toNumber(value) {
641
+ if (typeof value == 'number') {
642
+ return value;
643
+ }
644
+ if (isSymbol(value)) {
645
+ return NAN;
646
+ }
647
+ if (isObject(value)) {
648
+ var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
649
+ value = isObject(other) ? (other + '') : other;
650
+ }
651
+ if (typeof value != 'string') {
652
+ return value === 0 ? value : +value;
653
+ }
654
+ value = baseTrim(value);
655
+ var isBinary = reIsBinary.test(value);
656
+ return (isBinary || reIsOctal.test(value))
657
+ ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
658
+ : (reIsBadHex.test(value) ? NAN : +value);
659
+ }
660
+
661
+ /** `Object#toString` result references. */
662
+ var asyncTag = '[object AsyncFunction]',
663
+ funcTag$1 = '[object Function]',
664
+ genTag = '[object GeneratorFunction]',
665
+ proxyTag = '[object Proxy]';
666
+
667
+ /**
668
+ * Checks if `value` is classified as a `Function` object.
669
+ *
670
+ * @static
671
+ * @memberOf _
672
+ * @since 0.1.0
673
+ * @category Lang
674
+ * @param {*} value The value to check.
675
+ * @returns {boolean} Returns `true` if `value` is a function, else `false`.
676
+ * @example
677
+ *
678
+ * _.isFunction(_);
679
+ * // => true
680
+ *
681
+ * _.isFunction(/abc/);
682
+ * // => false
683
+ */
684
+ function isFunction(value) {
685
+ if (!isObject(value)) {
686
+ return false;
687
+ }
688
+ // The use of `Object#toString` avoids issues with the `typeof` operator
689
+ // in Safari 9 which returns 'object' for typed arrays and other constructors.
690
+ var tag = baseGetTag(value);
691
+ return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
692
+ }
693
+
694
+ /** Used to detect overreaching core-js shims. */
695
+ var coreJsData = root['__core-js_shared__'];
696
+
697
+ /** Used to detect methods masquerading as native. */
698
+ var maskSrcKey = (function() {
699
+ var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
700
+ return uid ? ('Symbol(src)_1.' + uid) : '';
701
+ }());
702
+
703
+ /**
704
+ * Checks if `func` has its source masked.
705
+ *
706
+ * @private
707
+ * @param {Function} func The function to check.
708
+ * @returns {boolean} Returns `true` if `func` is masked, else `false`.
709
+ */
710
+ function isMasked(func) {
711
+ return !!maskSrcKey && (maskSrcKey in func);
712
+ }
713
+
714
+ /** Used for built-in method references. */
715
+ var funcProto$1 = Function.prototype;
716
+
717
+ /** Used to resolve the decompiled source of functions. */
718
+ var funcToString$1 = funcProto$1.toString;
719
+
720
+ /**
721
+ * Converts `func` to its source code.
722
+ *
723
+ * @private
724
+ * @param {Function} func The function to convert.
725
+ * @returns {string} Returns the source code.
726
+ */
727
+ function toSource(func) {
728
+ if (func != null) {
729
+ try {
730
+ return funcToString$1.call(func);
731
+ } catch (e) {}
732
+ try {
733
+ return (func + '');
734
+ } catch (e) {}
735
+ }
736
+ return '';
737
+ }
738
+
739
+ /**
740
+ * Used to match `RegExp`
741
+ * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
742
+ */
743
+ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
744
+
745
+ /** Used to detect host constructors (Safari). */
746
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
747
+
748
+ /** Used for built-in method references. */
749
+ var funcProto = Function.prototype,
750
+ objectProto$9 = Object.prototype;
751
+
752
+ /** Used to resolve the decompiled source of functions. */
753
+ var funcToString = funcProto.toString;
754
+
755
+ /** Used to check objects for own properties. */
756
+ var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
757
+
758
+ /** Used to detect if a method is native. */
759
+ var reIsNative = RegExp('^' +
760
+ funcToString.call(hasOwnProperty$7).replace(reRegExpChar, '\\$&')
761
+ .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
762
+ );
763
+
764
+ /**
765
+ * The base implementation of `_.isNative` without bad shim checks.
766
+ *
767
+ * @private
768
+ * @param {*} value The value to check.
769
+ * @returns {boolean} Returns `true` if `value` is a native function,
770
+ * else `false`.
771
+ */
772
+ function baseIsNative(value) {
773
+ if (!isObject(value) || isMasked(value)) {
774
+ return false;
775
+ }
776
+ var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
777
+ return pattern.test(toSource(value));
778
+ }
779
+
780
+ /**
781
+ * Gets the value at `key` of `object`.
782
+ *
783
+ * @private
784
+ * @param {Object} [object] The object to query.
785
+ * @param {string} key The key of the property to get.
786
+ * @returns {*} Returns the property value.
787
+ */
788
+ function getValue(object, key) {
789
+ return object == null ? undefined : object[key];
790
+ }
791
+
792
+ /**
793
+ * Gets the native function at `key` of `object`.
794
+ *
795
+ * @private
796
+ * @param {Object} object The object to query.
797
+ * @param {string} key The key of the method to get.
798
+ * @returns {*} Returns the function if it's native, else `undefined`.
799
+ */
800
+ function getNative(object, key) {
801
+ var value = getValue(object, key);
802
+ return baseIsNative(value) ? value : undefined;
803
+ }
804
+
805
+ /* Built-in method references that are verified to be native. */
806
+ var WeakMap = getNative(root, 'WeakMap');
807
+
808
+ /** Used as references for various `Number` constants. */
809
+ var MAX_SAFE_INTEGER$1 = 9007199254740991;
810
+
811
+ /** Used to detect unsigned integer values. */
812
+ var reIsUint = /^(?:0|[1-9]\d*)$/;
813
+
814
+ /**
815
+ * Checks if `value` is a valid array-like index.
816
+ *
817
+ * @private
818
+ * @param {*} value The value to check.
819
+ * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
820
+ * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
821
+ */
822
+ function isIndex(value, length) {
823
+ var type = typeof value;
824
+ length = length == null ? MAX_SAFE_INTEGER$1 : length;
825
+
826
+ return !!length &&
827
+ (type == 'number' ||
828
+ (type != 'symbol' && reIsUint.test(value))) &&
829
+ (value > -1 && value % 1 == 0 && value < length);
830
+ }
831
+
832
+ /**
833
+ * Performs a
834
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
835
+ * comparison between two values to determine if they are equivalent.
836
+ *
837
+ * @static
838
+ * @memberOf _
839
+ * @since 4.0.0
840
+ * @category Lang
841
+ * @param {*} value The value to compare.
842
+ * @param {*} other The other value to compare.
843
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
844
+ * @example
845
+ *
846
+ * var object = { 'a': 1 };
847
+ * var other = { 'a': 1 };
848
+ *
849
+ * _.eq(object, object);
850
+ * // => true
851
+ *
852
+ * _.eq(object, other);
853
+ * // => false
854
+ *
855
+ * _.eq('a', 'a');
856
+ * // => true
857
+ *
858
+ * _.eq('a', Object('a'));
859
+ * // => false
860
+ *
861
+ * _.eq(NaN, NaN);
862
+ * // => true
863
+ */
864
+ function eq(value, other) {
865
+ return value === other || (value !== value && other !== other);
866
+ }
867
+
868
+ /** Used as references for various `Number` constants. */
869
+ var MAX_SAFE_INTEGER = 9007199254740991;
870
+
871
+ /**
872
+ * Checks if `value` is a valid array-like length.
873
+ *
874
+ * **Note:** This method is loosely based on
875
+ * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
876
+ *
877
+ * @static
878
+ * @memberOf _
879
+ * @since 4.0.0
880
+ * @category Lang
881
+ * @param {*} value The value to check.
882
+ * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
883
+ * @example
884
+ *
885
+ * _.isLength(3);
886
+ * // => true
887
+ *
888
+ * _.isLength(Number.MIN_VALUE);
889
+ * // => false
890
+ *
891
+ * _.isLength(Infinity);
892
+ * // => false
893
+ *
894
+ * _.isLength('3');
895
+ * // => false
896
+ */
897
+ function isLength(value) {
898
+ return typeof value == 'number' &&
899
+ value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
900
+ }
901
+
902
+ /**
903
+ * Checks if `value` is array-like. A value is considered array-like if it's
904
+ * not a function and has a `value.length` that's an integer greater than or
905
+ * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
906
+ *
907
+ * @static
908
+ * @memberOf _
909
+ * @since 4.0.0
910
+ * @category Lang
911
+ * @param {*} value The value to check.
912
+ * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
913
+ * @example
914
+ *
915
+ * _.isArrayLike([1, 2, 3]);
916
+ * // => true
917
+ *
918
+ * _.isArrayLike(document.body.children);
919
+ * // => true
920
+ *
921
+ * _.isArrayLike('abc');
922
+ * // => true
923
+ *
924
+ * _.isArrayLike(_.noop);
925
+ * // => false
926
+ */
927
+ function isArrayLike(value) {
928
+ return value != null && isLength(value.length) && !isFunction(value);
929
+ }
930
+
931
+ /** Used for built-in method references. */
932
+ var objectProto$8 = Object.prototype;
933
+
934
+ /**
935
+ * Checks if `value` is likely a prototype object.
936
+ *
937
+ * @private
938
+ * @param {*} value The value to check.
939
+ * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
940
+ */
941
+ function isPrototype(value) {
942
+ var Ctor = value && value.constructor,
943
+ proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$8;
944
+
945
+ return value === proto;
946
+ }
947
+
948
+ /**
949
+ * The base implementation of `_.times` without support for iteratee shorthands
950
+ * or max array length checks.
951
+ *
952
+ * @private
953
+ * @param {number} n The number of times to invoke `iteratee`.
954
+ * @param {Function} iteratee The function invoked per iteration.
955
+ * @returns {Array} Returns the array of results.
956
+ */
957
+ function baseTimes(n, iteratee) {
958
+ var index = -1,
959
+ result = Array(n);
960
+
961
+ while (++index < n) {
962
+ result[index] = iteratee(index);
963
+ }
964
+ return result;
965
+ }
966
+
967
+ /** `Object#toString` result references. */
968
+ var argsTag$2 = '[object Arguments]';
969
+
970
+ /**
971
+ * The base implementation of `_.isArguments`.
972
+ *
973
+ * @private
974
+ * @param {*} value The value to check.
975
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
976
+ */
977
+ function baseIsArguments(value) {
978
+ return isObjectLike(value) && baseGetTag(value) == argsTag$2;
979
+ }
980
+
981
+ /** Used for built-in method references. */
982
+ var objectProto$7 = Object.prototype;
983
+
984
+ /** Used to check objects for own properties. */
985
+ var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
986
+
987
+ /** Built-in value references. */
988
+ var propertyIsEnumerable$1 = objectProto$7.propertyIsEnumerable;
989
+
990
+ /**
991
+ * Checks if `value` is likely an `arguments` object.
992
+ *
993
+ * @static
994
+ * @memberOf _
995
+ * @since 0.1.0
996
+ * @category Lang
997
+ * @param {*} value The value to check.
998
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
999
+ * else `false`.
1000
+ * @example
1001
+ *
1002
+ * _.isArguments(function() { return arguments; }());
1003
+ * // => true
1004
+ *
1005
+ * _.isArguments([1, 2, 3]);
1006
+ * // => false
1007
+ */
1008
+ var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
1009
+ return isObjectLike(value) && hasOwnProperty$6.call(value, 'callee') &&
1010
+ !propertyIsEnumerable$1.call(value, 'callee');
1011
+ };
1012
+
1013
+ /**
1014
+ * This method returns `false`.
1015
+ *
1016
+ * @static
1017
+ * @memberOf _
1018
+ * @since 4.13.0
1019
+ * @category Util
1020
+ * @returns {boolean} Returns `false`.
1021
+ * @example
1022
+ *
1023
+ * _.times(2, _.stubFalse);
1024
+ * // => [false, false]
1025
+ */
1026
+ function stubFalse() {
1027
+ return false;
1028
+ }
1029
+
1030
+ /** Detect free variable `exports`. */
1031
+ var freeExports$1 = typeof exports == 'object' && exports && !exports.nodeType && exports;
1032
+
1033
+ /** Detect free variable `module`. */
1034
+ var freeModule$1 = freeExports$1 && typeof module == 'object' && module && !module.nodeType && module;
1035
+
1036
+ /** Detect the popular CommonJS extension `module.exports`. */
1037
+ var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
1038
+
1039
+ /** Built-in value references. */
1040
+ var Buffer = moduleExports$1 ? root.Buffer : undefined;
1041
+
1042
+ /* Built-in method references for those with the same name as other `lodash` methods. */
1043
+ var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
1044
+
1045
+ /**
1046
+ * Checks if `value` is a buffer.
1047
+ *
1048
+ * @static
1049
+ * @memberOf _
1050
+ * @since 4.3.0
1051
+ * @category Lang
1052
+ * @param {*} value The value to check.
1053
+ * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
1054
+ * @example
1055
+ *
1056
+ * _.isBuffer(new Buffer(2));
1057
+ * // => true
1058
+ *
1059
+ * _.isBuffer(new Uint8Array(2));
1060
+ * // => false
1061
+ */
1062
+ var isBuffer = nativeIsBuffer || stubFalse;
1063
+
1064
+ /** `Object#toString` result references. */
1065
+ var argsTag$1 = '[object Arguments]',
1066
+ arrayTag$1 = '[object Array]',
1067
+ boolTag$1 = '[object Boolean]',
1068
+ dateTag$1 = '[object Date]',
1069
+ errorTag$1 = '[object Error]',
1070
+ funcTag = '[object Function]',
1071
+ mapTag$2 = '[object Map]',
1072
+ numberTag$1 = '[object Number]',
1073
+ objectTag$2 = '[object Object]',
1074
+ regexpTag$1 = '[object RegExp]',
1075
+ setTag$2 = '[object Set]',
1076
+ stringTag$1 = '[object String]',
1077
+ weakMapTag$1 = '[object WeakMap]';
1078
+
1079
+ var arrayBufferTag$1 = '[object ArrayBuffer]',
1080
+ dataViewTag$2 = '[object DataView]',
1081
+ float32Tag = '[object Float32Array]',
1082
+ float64Tag = '[object Float64Array]',
1083
+ int8Tag = '[object Int8Array]',
1084
+ int16Tag = '[object Int16Array]',
1085
+ int32Tag = '[object Int32Array]',
1086
+ uint8Tag = '[object Uint8Array]',
1087
+ uint8ClampedTag = '[object Uint8ClampedArray]',
1088
+ uint16Tag = '[object Uint16Array]',
1089
+ uint32Tag = '[object Uint32Array]';
1090
+
1091
+ /** Used to identify `toStringTag` values of typed arrays. */
1092
+ var typedArrayTags = {};
1093
+ typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
1094
+ typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
1095
+ typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
1096
+ typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
1097
+ typedArrayTags[uint32Tag] = true;
1098
+ typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] =
1099
+ typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] =
1100
+ typedArrayTags[dataViewTag$2] = typedArrayTags[dateTag$1] =
1101
+ typedArrayTags[errorTag$1] = typedArrayTags[funcTag] =
1102
+ typedArrayTags[mapTag$2] = typedArrayTags[numberTag$1] =
1103
+ typedArrayTags[objectTag$2] = typedArrayTags[regexpTag$1] =
1104
+ typedArrayTags[setTag$2] = typedArrayTags[stringTag$1] =
1105
+ typedArrayTags[weakMapTag$1] = false;
1106
+
1107
+ /**
1108
+ * The base implementation of `_.isTypedArray` without Node.js optimizations.
1109
+ *
1110
+ * @private
1111
+ * @param {*} value The value to check.
1112
+ * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1113
+ */
1114
+ function baseIsTypedArray(value) {
1115
+ return isObjectLike(value) &&
1116
+ isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
1117
+ }
1118
+
1119
+ /**
1120
+ * The base implementation of `_.unary` without support for storing metadata.
1121
+ *
1122
+ * @private
1123
+ * @param {Function} func The function to cap arguments for.
1124
+ * @returns {Function} Returns the new capped function.
1125
+ */
1126
+ function baseUnary(func) {
1127
+ return function(value) {
1128
+ return func(value);
1129
+ };
1130
+ }
1131
+
1132
+ /** Detect free variable `exports`. */
1133
+ var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
1134
+
1135
+ /** Detect free variable `module`. */
1136
+ var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
1137
+
1138
+ /** Detect the popular CommonJS extension `module.exports`. */
1139
+ var moduleExports = freeModule && freeModule.exports === freeExports;
1140
+
1141
+ /** Detect free variable `process` from Node.js. */
1142
+ var freeProcess = moduleExports && freeGlobal.process;
1143
+
1144
+ /** Used to access faster Node.js helpers. */
1145
+ var nodeUtil = (function() {
1146
+ try {
1147
+ // Use `util.types` for Node.js 10+.
1148
+ var types = freeModule && freeModule.require && freeModule.require('util').types;
1149
+
1150
+ if (types) {
1151
+ return types;
1152
+ }
1153
+
1154
+ // Legacy `process.binding('util')` for Node.js < 10.
1155
+ return freeProcess && freeProcess.binding && freeProcess.binding('util');
1156
+ } catch (e) {}
1157
+ }());
1158
+
1159
+ /* Node.js helper references. */
1160
+ var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
1161
+
1162
+ /**
1163
+ * Checks if `value` is classified as a typed array.
1164
+ *
1165
+ * @static
1166
+ * @memberOf _
1167
+ * @since 3.0.0
1168
+ * @category Lang
1169
+ * @param {*} value The value to check.
1170
+ * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1171
+ * @example
1172
+ *
1173
+ * _.isTypedArray(new Uint8Array);
1174
+ * // => true
1175
+ *
1176
+ * _.isTypedArray([]);
1177
+ * // => false
1178
+ */
1179
+ var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
1180
+
1181
+ /** Used for built-in method references. */
1182
+ var objectProto$6 = Object.prototype;
1183
+
1184
+ /** Used to check objects for own properties. */
1185
+ var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
1186
+
1187
+ /**
1188
+ * Creates an array of the enumerable property names of the array-like `value`.
1189
+ *
1190
+ * @private
1191
+ * @param {*} value The value to query.
1192
+ * @param {boolean} inherited Specify returning inherited property names.
1193
+ * @returns {Array} Returns the array of property names.
1194
+ */
1195
+ function arrayLikeKeys(value, inherited) {
1196
+ var isArr = isArray(value),
1197
+ isArg = !isArr && isArguments(value),
1198
+ isBuff = !isArr && !isArg && isBuffer(value),
1199
+ isType = !isArr && !isArg && !isBuff && isTypedArray(value),
1200
+ skipIndexes = isArr || isArg || isBuff || isType,
1201
+ result = skipIndexes ? baseTimes(value.length, String) : [],
1202
+ length = result.length;
1203
+
1204
+ for (var key in value) {
1205
+ if ((inherited || hasOwnProperty$5.call(value, key)) &&
1206
+ !(skipIndexes && (
1207
+ // Safari 9 has enumerable `arguments.length` in strict mode.
1208
+ key == 'length' ||
1209
+ // Node.js 0.10 has enumerable non-index properties on buffers.
1210
+ (isBuff && (key == 'offset' || key == 'parent')) ||
1211
+ // PhantomJS 2 has enumerable non-index properties on typed arrays.
1212
+ (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
1213
+ // Skip index properties.
1214
+ isIndex(key, length)
1215
+ ))) {
1216
+ result.push(key);
1217
+ }
1218
+ }
1219
+ return result;
1220
+ }
1221
+
1222
+ /**
1223
+ * Creates a unary function that invokes `func` with its argument transformed.
1224
+ *
1225
+ * @private
1226
+ * @param {Function} func The function to wrap.
1227
+ * @param {Function} transform The argument transform.
1228
+ * @returns {Function} Returns the new function.
1229
+ */
1230
+ function overArg(func, transform) {
1231
+ return function(arg) {
1232
+ return func(transform(arg));
1233
+ };
1234
+ }
1235
+
1236
+ /* Built-in method references for those with the same name as other `lodash` methods. */
1237
+ var nativeKeys = overArg(Object.keys, Object);
1238
+
1239
+ /** Used for built-in method references. */
1240
+ var objectProto$5 = Object.prototype;
1241
+
1242
+ /** Used to check objects for own properties. */
1243
+ var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
1244
+
1245
+ /**
1246
+ * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
1247
+ *
1248
+ * @private
1249
+ * @param {Object} object The object to query.
1250
+ * @returns {Array} Returns the array of property names.
1251
+ */
1252
+ function baseKeys(object) {
1253
+ if (!isPrototype(object)) {
1254
+ return nativeKeys(object);
1255
+ }
1256
+ var result = [];
1257
+ for (var key in Object(object)) {
1258
+ if (hasOwnProperty$4.call(object, key) && key != 'constructor') {
1259
+ result.push(key);
1260
+ }
1261
+ }
1262
+ return result;
1263
+ }
1264
+
1265
+ /**
1266
+ * Creates an array of the own enumerable property names of `object`.
1267
+ *
1268
+ * **Note:** Non-object values are coerced to objects. See the
1269
+ * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
1270
+ * for more details.
1271
+ *
1272
+ * @static
1273
+ * @since 0.1.0
1274
+ * @memberOf _
1275
+ * @category Object
1276
+ * @param {Object} object The object to query.
1277
+ * @returns {Array} Returns the array of property names.
1278
+ * @example
1279
+ *
1280
+ * function Foo() {
1281
+ * this.a = 1;
1282
+ * this.b = 2;
1283
+ * }
1284
+ *
1285
+ * Foo.prototype.c = 3;
1286
+ *
1287
+ * _.keys(new Foo);
1288
+ * // => ['a', 'b'] (iteration order is not guaranteed)
1289
+ *
1290
+ * _.keys('hi');
1291
+ * // => ['0', '1']
1292
+ */
1293
+ function keys(object) {
1294
+ return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
1295
+ }
1296
+
1297
+ /* Built-in method references that are verified to be native. */
1298
+ var nativeCreate = getNative(Object, 'create');
1299
+
1300
+ /**
1301
+ * Removes all key-value entries from the hash.
1302
+ *
1303
+ * @private
1304
+ * @name clear
1305
+ * @memberOf Hash
1306
+ */
1307
+ function hashClear() {
1308
+ this.__data__ = nativeCreate ? nativeCreate(null) : {};
1309
+ this.size = 0;
1310
+ }
1311
+
1312
+ /**
1313
+ * Removes `key` and its value from the hash.
1314
+ *
1315
+ * @private
1316
+ * @name delete
1317
+ * @memberOf Hash
1318
+ * @param {Object} hash The hash to modify.
1319
+ * @param {string} key The key of the value to remove.
1320
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1321
+ */
1322
+ function hashDelete(key) {
1323
+ var result = this.has(key) && delete this.__data__[key];
1324
+ this.size -= result ? 1 : 0;
1325
+ return result;
1326
+ }
1327
+
1328
+ /** Used to stand-in for `undefined` hash values. */
1329
+ var HASH_UNDEFINED$2 = '__lodash_hash_undefined__';
1330
+
1331
+ /** Used for built-in method references. */
1332
+ var objectProto$4 = Object.prototype;
1333
+
1334
+ /** Used to check objects for own properties. */
1335
+ var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
1336
+
1337
+ /**
1338
+ * Gets the hash value for `key`.
1339
+ *
1340
+ * @private
1341
+ * @name get
1342
+ * @memberOf Hash
1343
+ * @param {string} key The key of the value to get.
1344
+ * @returns {*} Returns the entry value.
1345
+ */
1346
+ function hashGet(key) {
1347
+ var data = this.__data__;
1348
+ if (nativeCreate) {
1349
+ var result = data[key];
1350
+ return result === HASH_UNDEFINED$2 ? undefined : result;
1351
+ }
1352
+ return hasOwnProperty$3.call(data, key) ? data[key] : undefined;
1353
+ }
1354
+
1355
+ /** Used for built-in method references. */
1356
+ var objectProto$3 = Object.prototype;
1357
+
1358
+ /** Used to check objects for own properties. */
1359
+ var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
1360
+
1361
+ /**
1362
+ * Checks if a hash value for `key` exists.
1363
+ *
1364
+ * @private
1365
+ * @name has
1366
+ * @memberOf Hash
1367
+ * @param {string} key The key of the entry to check.
1368
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1369
+ */
1370
+ function hashHas(key) {
1371
+ var data = this.__data__;
1372
+ return nativeCreate ? (data[key] !== undefined) : hasOwnProperty$2.call(data, key);
1373
+ }
1374
+
1375
+ /** Used to stand-in for `undefined` hash values. */
1376
+ var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
1377
+
1378
+ /**
1379
+ * Sets the hash `key` to `value`.
1380
+ *
1381
+ * @private
1382
+ * @name set
1383
+ * @memberOf Hash
1384
+ * @param {string} key The key of the value to set.
1385
+ * @param {*} value The value to set.
1386
+ * @returns {Object} Returns the hash instance.
1387
+ */
1388
+ function hashSet(key, value) {
1389
+ var data = this.__data__;
1390
+ this.size += this.has(key) ? 0 : 1;
1391
+ data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value;
1392
+ return this;
1393
+ }
1394
+
1395
+ /**
1396
+ * Creates a hash object.
1397
+ *
1398
+ * @private
1399
+ * @constructor
1400
+ * @param {Array} [entries] The key-value pairs to cache.
1401
+ */
1402
+ function Hash(entries) {
1403
+ var index = -1,
1404
+ length = entries == null ? 0 : entries.length;
1405
+
1406
+ this.clear();
1407
+ while (++index < length) {
1408
+ var entry = entries[index];
1409
+ this.set(entry[0], entry[1]);
1410
+ }
1411
+ }
1412
+
1413
+ // Add methods to `Hash`.
1414
+ Hash.prototype.clear = hashClear;
1415
+ Hash.prototype['delete'] = hashDelete;
1416
+ Hash.prototype.get = hashGet;
1417
+ Hash.prototype.has = hashHas;
1418
+ Hash.prototype.set = hashSet;
1419
+
1420
+ /**
1421
+ * Removes all key-value entries from the list cache.
1422
+ *
1423
+ * @private
1424
+ * @name clear
1425
+ * @memberOf ListCache
1426
+ */
1427
+ function listCacheClear() {
1428
+ this.__data__ = [];
1429
+ this.size = 0;
1430
+ }
1431
+
1432
+ /**
1433
+ * Gets the index at which the `key` is found in `array` of key-value pairs.
1434
+ *
1435
+ * @private
1436
+ * @param {Array} array The array to inspect.
1437
+ * @param {*} key The key to search for.
1438
+ * @returns {number} Returns the index of the matched value, else `-1`.
1439
+ */
1440
+ function assocIndexOf(array, key) {
1441
+ var length = array.length;
1442
+ while (length--) {
1443
+ if (eq(array[length][0], key)) {
1444
+ return length;
1445
+ }
1446
+ }
1447
+ return -1;
1448
+ }
1449
+
1450
+ /** Used for built-in method references. */
1451
+ var arrayProto = Array.prototype;
1452
+
1453
+ /** Built-in value references. */
1454
+ var splice = arrayProto.splice;
1455
+
1456
+ /**
1457
+ * Removes `key` and its value from the list cache.
1458
+ *
1459
+ * @private
1460
+ * @name delete
1461
+ * @memberOf ListCache
1462
+ * @param {string} key The key of the value to remove.
1463
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1464
+ */
1465
+ function listCacheDelete(key) {
1466
+ var data = this.__data__,
1467
+ index = assocIndexOf(data, key);
1468
+
1469
+ if (index < 0) {
1470
+ return false;
1471
+ }
1472
+ var lastIndex = data.length - 1;
1473
+ if (index == lastIndex) {
1474
+ data.pop();
1475
+ } else {
1476
+ splice.call(data, index, 1);
1477
+ }
1478
+ --this.size;
1479
+ return true;
1480
+ }
1481
+
1482
+ /**
1483
+ * Gets the list cache value for `key`.
1484
+ *
1485
+ * @private
1486
+ * @name get
1487
+ * @memberOf ListCache
1488
+ * @param {string} key The key of the value to get.
1489
+ * @returns {*} Returns the entry value.
1490
+ */
1491
+ function listCacheGet(key) {
1492
+ var data = this.__data__,
1493
+ index = assocIndexOf(data, key);
1494
+
1495
+ return index < 0 ? undefined : data[index][1];
1496
+ }
1497
+
1498
+ /**
1499
+ * Checks if a list cache value for `key` exists.
1500
+ *
1501
+ * @private
1502
+ * @name has
1503
+ * @memberOf ListCache
1504
+ * @param {string} key The key of the entry to check.
1505
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1506
+ */
1507
+ function listCacheHas(key) {
1508
+ return assocIndexOf(this.__data__, key) > -1;
1509
+ }
1510
+
1511
+ /**
1512
+ * Sets the list cache `key` to `value`.
1513
+ *
1514
+ * @private
1515
+ * @name set
1516
+ * @memberOf ListCache
1517
+ * @param {string} key The key of the value to set.
1518
+ * @param {*} value The value to set.
1519
+ * @returns {Object} Returns the list cache instance.
1520
+ */
1521
+ function listCacheSet(key, value) {
1522
+ var data = this.__data__,
1523
+ index = assocIndexOf(data, key);
1524
+
1525
+ if (index < 0) {
1526
+ ++this.size;
1527
+ data.push([key, value]);
1528
+ } else {
1529
+ data[index][1] = value;
1530
+ }
1531
+ return this;
1532
+ }
1533
+
1534
+ /**
1535
+ * Creates an list cache object.
1536
+ *
1537
+ * @private
1538
+ * @constructor
1539
+ * @param {Array} [entries] The key-value pairs to cache.
1540
+ */
1541
+ function ListCache(entries) {
1542
+ var index = -1,
1543
+ length = entries == null ? 0 : entries.length;
1544
+
1545
+ this.clear();
1546
+ while (++index < length) {
1547
+ var entry = entries[index];
1548
+ this.set(entry[0], entry[1]);
1549
+ }
1550
+ }
1551
+
1552
+ // Add methods to `ListCache`.
1553
+ ListCache.prototype.clear = listCacheClear;
1554
+ ListCache.prototype['delete'] = listCacheDelete;
1555
+ ListCache.prototype.get = listCacheGet;
1556
+ ListCache.prototype.has = listCacheHas;
1557
+ ListCache.prototype.set = listCacheSet;
1558
+
1559
+ /* Built-in method references that are verified to be native. */
1560
+ var Map$1 = getNative(root, 'Map');
1561
+
1562
+ /**
1563
+ * Removes all key-value entries from the map.
1564
+ *
1565
+ * @private
1566
+ * @name clear
1567
+ * @memberOf MapCache
1568
+ */
1569
+ function mapCacheClear() {
1570
+ this.size = 0;
1571
+ this.__data__ = {
1572
+ 'hash': new Hash,
1573
+ 'map': new (Map$1 || ListCache),
1574
+ 'string': new Hash
1575
+ };
1576
+ }
1577
+
1578
+ /**
1579
+ * Checks if `value` is suitable for use as unique object key.
1580
+ *
1581
+ * @private
1582
+ * @param {*} value The value to check.
1583
+ * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
1584
+ */
1585
+ function isKeyable(value) {
1586
+ var type = typeof value;
1587
+ return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
1588
+ ? (value !== '__proto__')
1589
+ : (value === null);
1590
+ }
1591
+
1592
+ /**
1593
+ * Gets the data for `map`.
1594
+ *
1595
+ * @private
1596
+ * @param {Object} map The map to query.
1597
+ * @param {string} key The reference key.
1598
+ * @returns {*} Returns the map data.
1599
+ */
1600
+ function getMapData(map, key) {
1601
+ var data = map.__data__;
1602
+ return isKeyable(key)
1603
+ ? data[typeof key == 'string' ? 'string' : 'hash']
1604
+ : data.map;
1605
+ }
1606
+
1607
+ /**
1608
+ * Removes `key` and its value from the map.
1609
+ *
1610
+ * @private
1611
+ * @name delete
1612
+ * @memberOf MapCache
1613
+ * @param {string} key The key of the value to remove.
1614
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1615
+ */
1616
+ function mapCacheDelete(key) {
1617
+ var result = getMapData(this, key)['delete'](key);
1618
+ this.size -= result ? 1 : 0;
1619
+ return result;
1620
+ }
1621
+
1622
+ /**
1623
+ * Gets the map value for `key`.
1624
+ *
1625
+ * @private
1626
+ * @name get
1627
+ * @memberOf MapCache
1628
+ * @param {string} key The key of the value to get.
1629
+ * @returns {*} Returns the entry value.
1630
+ */
1631
+ function mapCacheGet(key) {
1632
+ return getMapData(this, key).get(key);
1633
+ }
1634
+
1635
+ /**
1636
+ * Checks if a map value for `key` exists.
1637
+ *
1638
+ * @private
1639
+ * @name has
1640
+ * @memberOf MapCache
1641
+ * @param {string} key The key of the entry to check.
1642
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1643
+ */
1644
+ function mapCacheHas(key) {
1645
+ return getMapData(this, key).has(key);
1646
+ }
1647
+
1648
+ /**
1649
+ * Sets the map `key` to `value`.
1650
+ *
1651
+ * @private
1652
+ * @name set
1653
+ * @memberOf MapCache
1654
+ * @param {string} key The key of the value to set.
1655
+ * @param {*} value The value to set.
1656
+ * @returns {Object} Returns the map cache instance.
1657
+ */
1658
+ function mapCacheSet(key, value) {
1659
+ var data = getMapData(this, key),
1660
+ size = data.size;
1661
+
1662
+ data.set(key, value);
1663
+ this.size += data.size == size ? 0 : 1;
1664
+ return this;
1665
+ }
1666
+
1667
+ /**
1668
+ * Creates a map cache object to store key-value pairs.
1669
+ *
1670
+ * @private
1671
+ * @constructor
1672
+ * @param {Array} [entries] The key-value pairs to cache.
1673
+ */
1674
+ function MapCache(entries) {
1675
+ var index = -1,
1676
+ length = entries == null ? 0 : entries.length;
1677
+
1678
+ this.clear();
1679
+ while (++index < length) {
1680
+ var entry = entries[index];
1681
+ this.set(entry[0], entry[1]);
1682
+ }
1683
+ }
1684
+
1685
+ // Add methods to `MapCache`.
1686
+ MapCache.prototype.clear = mapCacheClear;
1687
+ MapCache.prototype['delete'] = mapCacheDelete;
1688
+ MapCache.prototype.get = mapCacheGet;
1689
+ MapCache.prototype.has = mapCacheHas;
1690
+ MapCache.prototype.set = mapCacheSet;
1691
+
1692
+ /**
1693
+ * Appends the elements of `values` to `array`.
1694
+ *
1695
+ * @private
1696
+ * @param {Array} array The array to modify.
1697
+ * @param {Array} values The values to append.
1698
+ * @returns {Array} Returns `array`.
1699
+ */
1700
+ function arrayPush(array, values) {
1701
+ var index = -1,
1702
+ length = values.length,
1703
+ offset = array.length;
1704
+
1705
+ while (++index < length) {
1706
+ array[offset + index] = values[index];
1707
+ }
1708
+ return array;
1709
+ }
1710
+
1711
+ /**
1712
+ * Removes all key-value entries from the stack.
1713
+ *
1714
+ * @private
1715
+ * @name clear
1716
+ * @memberOf Stack
1717
+ */
1718
+ function stackClear() {
1719
+ this.__data__ = new ListCache;
1720
+ this.size = 0;
1721
+ }
1722
+
1723
+ /**
1724
+ * Removes `key` and its value from the stack.
1725
+ *
1726
+ * @private
1727
+ * @name delete
1728
+ * @memberOf Stack
1729
+ * @param {string} key The key of the value to remove.
1730
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1731
+ */
1732
+ function stackDelete(key) {
1733
+ var data = this.__data__,
1734
+ result = data['delete'](key);
1735
+
1736
+ this.size = data.size;
1737
+ return result;
1738
+ }
1739
+
1740
+ /**
1741
+ * Gets the stack value for `key`.
1742
+ *
1743
+ * @private
1744
+ * @name get
1745
+ * @memberOf Stack
1746
+ * @param {string} key The key of the value to get.
1747
+ * @returns {*} Returns the entry value.
1748
+ */
1749
+ function stackGet(key) {
1750
+ return this.__data__.get(key);
1751
+ }
1752
+
1753
+ /**
1754
+ * Checks if a stack value for `key` exists.
1755
+ *
1756
+ * @private
1757
+ * @name has
1758
+ * @memberOf Stack
1759
+ * @param {string} key The key of the entry to check.
1760
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1761
+ */
1762
+ function stackHas(key) {
1763
+ return this.__data__.has(key);
1764
+ }
1765
+
1766
+ /** Used as the size to enable large array optimizations. */
1767
+ var LARGE_ARRAY_SIZE = 200;
1768
+
1769
+ /**
1770
+ * Sets the stack `key` to `value`.
1771
+ *
1772
+ * @private
1773
+ * @name set
1774
+ * @memberOf Stack
1775
+ * @param {string} key The key of the value to set.
1776
+ * @param {*} value The value to set.
1777
+ * @returns {Object} Returns the stack cache instance.
1778
+ */
1779
+ function stackSet(key, value) {
1780
+ var data = this.__data__;
1781
+ if (data instanceof ListCache) {
1782
+ var pairs = data.__data__;
1783
+ if (!Map$1 || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
1784
+ pairs.push([key, value]);
1785
+ this.size = ++data.size;
1786
+ return this;
1787
+ }
1788
+ data = this.__data__ = new MapCache(pairs);
1789
+ }
1790
+ data.set(key, value);
1791
+ this.size = data.size;
1792
+ return this;
1793
+ }
1794
+
1795
+ /**
1796
+ * Creates a stack cache object to store key-value pairs.
1797
+ *
1798
+ * @private
1799
+ * @constructor
1800
+ * @param {Array} [entries] The key-value pairs to cache.
1801
+ */
1802
+ function Stack(entries) {
1803
+ var data = this.__data__ = new ListCache(entries);
1804
+ this.size = data.size;
1805
+ }
1806
+
1807
+ // Add methods to `Stack`.
1808
+ Stack.prototype.clear = stackClear;
1809
+ Stack.prototype['delete'] = stackDelete;
1810
+ Stack.prototype.get = stackGet;
1811
+ Stack.prototype.has = stackHas;
1812
+ Stack.prototype.set = stackSet;
1813
+
1814
+ /**
1815
+ * A specialized version of `_.filter` for arrays without support for
1816
+ * iteratee shorthands.
1817
+ *
1818
+ * @private
1819
+ * @param {Array} [array] The array to iterate over.
1820
+ * @param {Function} predicate The function invoked per iteration.
1821
+ * @returns {Array} Returns the new filtered array.
1822
+ */
1823
+ function arrayFilter(array, predicate) {
1824
+ var index = -1,
1825
+ length = array == null ? 0 : array.length,
1826
+ resIndex = 0,
1827
+ result = [];
1828
+
1829
+ while (++index < length) {
1830
+ var value = array[index];
1831
+ if (predicate(value, index, array)) {
1832
+ result[resIndex++] = value;
1833
+ }
1834
+ }
1835
+ return result;
1836
+ }
1837
+
1838
+ /**
1839
+ * This method returns a new empty array.
1840
+ *
1841
+ * @static
1842
+ * @memberOf _
1843
+ * @since 4.13.0
1844
+ * @category Util
1845
+ * @returns {Array} Returns the new empty array.
1846
+ * @example
1847
+ *
1848
+ * var arrays = _.times(2, _.stubArray);
1849
+ *
1850
+ * console.log(arrays);
1851
+ * // => [[], []]
1852
+ *
1853
+ * console.log(arrays[0] === arrays[1]);
1854
+ * // => false
1855
+ */
1856
+ function stubArray() {
1857
+ return [];
1858
+ }
1859
+
1860
+ /** Used for built-in method references. */
1861
+ var objectProto$2 = Object.prototype;
1862
+
1863
+ /** Built-in value references. */
1864
+ var propertyIsEnumerable = objectProto$2.propertyIsEnumerable;
1865
+
1866
+ /* Built-in method references for those with the same name as other `lodash` methods. */
1867
+ var nativeGetSymbols = Object.getOwnPropertySymbols;
1868
+
1869
+ /**
1870
+ * Creates an array of the own enumerable symbols of `object`.
1871
+ *
1872
+ * @private
1873
+ * @param {Object} object The object to query.
1874
+ * @returns {Array} Returns the array of symbols.
1875
+ */
1876
+ var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
1877
+ if (object == null) {
1878
+ return [];
1879
+ }
1880
+ object = Object(object);
1881
+ return arrayFilter(nativeGetSymbols(object), function(symbol) {
1882
+ return propertyIsEnumerable.call(object, symbol);
1883
+ });
1884
+ };
1885
+
1886
+ /**
1887
+ * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
1888
+ * `keysFunc` and `symbolsFunc` to get the enumerable property names and
1889
+ * symbols of `object`.
1890
+ *
1891
+ * @private
1892
+ * @param {Object} object The object to query.
1893
+ * @param {Function} keysFunc The function to get the keys of `object`.
1894
+ * @param {Function} symbolsFunc The function to get the symbols of `object`.
1895
+ * @returns {Array} Returns the array of property names and symbols.
1896
+ */
1897
+ function baseGetAllKeys(object, keysFunc, symbolsFunc) {
1898
+ var result = keysFunc(object);
1899
+ return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
1900
+ }
1901
+
1902
+ /**
1903
+ * Creates an array of own enumerable property names and symbols of `object`.
1904
+ *
1905
+ * @private
1906
+ * @param {Object} object The object to query.
1907
+ * @returns {Array} Returns the array of property names and symbols.
1908
+ */
1909
+ function getAllKeys(object) {
1910
+ return baseGetAllKeys(object, keys, getSymbols);
1911
+ }
1912
+
1913
+ /* Built-in method references that are verified to be native. */
1914
+ var DataView = getNative(root, 'DataView');
1915
+
1916
+ /* Built-in method references that are verified to be native. */
1917
+ var Promise$1 = getNative(root, 'Promise');
1918
+
1919
+ /* Built-in method references that are verified to be native. */
1920
+ var Set$1 = getNative(root, 'Set');
1921
+
1922
+ /** `Object#toString` result references. */
1923
+ var mapTag$1 = '[object Map]',
1924
+ objectTag$1 = '[object Object]',
1925
+ promiseTag = '[object Promise]',
1926
+ setTag$1 = '[object Set]',
1927
+ weakMapTag = '[object WeakMap]';
1928
+
1929
+ var dataViewTag$1 = '[object DataView]';
1930
+
1931
+ /** Used to detect maps, sets, and weakmaps. */
1932
+ var dataViewCtorString = toSource(DataView),
1933
+ mapCtorString = toSource(Map$1),
1934
+ promiseCtorString = toSource(Promise$1),
1935
+ setCtorString = toSource(Set$1),
1936
+ weakMapCtorString = toSource(WeakMap);
1937
+
1938
+ /**
1939
+ * Gets the `toStringTag` of `value`.
1940
+ *
1941
+ * @private
1942
+ * @param {*} value The value to query.
1943
+ * @returns {string} Returns the `toStringTag`.
1944
+ */
1945
+ var getTag = baseGetTag;
1946
+
1947
+ // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
1948
+ if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag$1) ||
1949
+ (Map$1 && getTag(new Map$1) != mapTag$1) ||
1950
+ (Promise$1 && getTag(Promise$1.resolve()) != promiseTag) ||
1951
+ (Set$1 && getTag(new Set$1) != setTag$1) ||
1952
+ (WeakMap && getTag(new WeakMap) != weakMapTag)) {
1953
+ getTag = function(value) {
1954
+ var result = baseGetTag(value),
1955
+ Ctor = result == objectTag$1 ? value.constructor : undefined,
1956
+ ctorString = Ctor ? toSource(Ctor) : '';
1957
+
1958
+ if (ctorString) {
1959
+ switch (ctorString) {
1960
+ case dataViewCtorString: return dataViewTag$1;
1961
+ case mapCtorString: return mapTag$1;
1962
+ case promiseCtorString: return promiseTag;
1963
+ case setCtorString: return setTag$1;
1964
+ case weakMapCtorString: return weakMapTag;
1965
+ }
1966
+ }
1967
+ return result;
1968
+ };
1969
+ }
1970
+
1971
+ var getTag$1 = getTag;
1972
+
1973
+ /** Built-in value references. */
1974
+ var Uint8Array = root.Uint8Array;
1975
+
1976
+ /** Used to stand-in for `undefined` hash values. */
1977
+ var HASH_UNDEFINED = '__lodash_hash_undefined__';
1978
+
1979
+ /**
1980
+ * Adds `value` to the array cache.
1981
+ *
1982
+ * @private
1983
+ * @name add
1984
+ * @memberOf SetCache
1985
+ * @alias push
1986
+ * @param {*} value The value to cache.
1987
+ * @returns {Object} Returns the cache instance.
1988
+ */
1989
+ function setCacheAdd(value) {
1990
+ this.__data__.set(value, HASH_UNDEFINED);
1991
+ return this;
1992
+ }
1993
+
1994
+ /**
1995
+ * Checks if `value` is in the array cache.
1996
+ *
1997
+ * @private
1998
+ * @name has
1999
+ * @memberOf SetCache
2000
+ * @param {*} value The value to search for.
2001
+ * @returns {number} Returns `true` if `value` is found, else `false`.
2002
+ */
2003
+ function setCacheHas(value) {
2004
+ return this.__data__.has(value);
2005
+ }
2006
+
2007
+ /**
2008
+ *
2009
+ * Creates an array cache object to store unique values.
2010
+ *
2011
+ * @private
2012
+ * @constructor
2013
+ * @param {Array} [values] The values to cache.
2014
+ */
2015
+ function SetCache(values) {
2016
+ var index = -1,
2017
+ length = values == null ? 0 : values.length;
2018
+
2019
+ this.__data__ = new MapCache;
2020
+ while (++index < length) {
2021
+ this.add(values[index]);
2022
+ }
2023
+ }
2024
+
2025
+ // Add methods to `SetCache`.
2026
+ SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
2027
+ SetCache.prototype.has = setCacheHas;
2028
+
2029
+ /**
2030
+ * A specialized version of `_.some` for arrays without support for iteratee
2031
+ * shorthands.
2032
+ *
2033
+ * @private
2034
+ * @param {Array} [array] The array to iterate over.
2035
+ * @param {Function} predicate The function invoked per iteration.
2036
+ * @returns {boolean} Returns `true` if any element passes the predicate check,
2037
+ * else `false`.
2038
+ */
2039
+ function arraySome(array, predicate) {
2040
+ var index = -1,
2041
+ length = array == null ? 0 : array.length;
2042
+
2043
+ while (++index < length) {
2044
+ if (predicate(array[index], index, array)) {
2045
+ return true;
2046
+ }
2047
+ }
2048
+ return false;
2049
+ }
2050
+
2051
+ /**
2052
+ * Checks if a `cache` value for `key` exists.
2053
+ *
2054
+ * @private
2055
+ * @param {Object} cache The cache to query.
2056
+ * @param {string} key The key of the entry to check.
2057
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2058
+ */
2059
+ function cacheHas(cache, key) {
2060
+ return cache.has(key);
2061
+ }
2062
+
2063
+ /** Used to compose bitmasks for value comparisons. */
2064
+ var COMPARE_PARTIAL_FLAG$3 = 1,
2065
+ COMPARE_UNORDERED_FLAG$1 = 2;
2066
+
2067
+ /**
2068
+ * A specialized version of `baseIsEqualDeep` for arrays with support for
2069
+ * partial deep comparisons.
2070
+ *
2071
+ * @private
2072
+ * @param {Array} array The array to compare.
2073
+ * @param {Array} other The other array to compare.
2074
+ * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
2075
+ * @param {Function} customizer The function to customize comparisons.
2076
+ * @param {Function} equalFunc The function to determine equivalents of values.
2077
+ * @param {Object} stack Tracks traversed `array` and `other` objects.
2078
+ * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
2079
+ */
2080
+ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
2081
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3,
2082
+ arrLength = array.length,
2083
+ othLength = other.length;
2084
+
2085
+ if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
2086
+ return false;
2087
+ }
2088
+ // Check that cyclic values are equal.
2089
+ var arrStacked = stack.get(array);
2090
+ var othStacked = stack.get(other);
2091
+ if (arrStacked && othStacked) {
2092
+ return arrStacked == other && othStacked == array;
2093
+ }
2094
+ var index = -1,
2095
+ result = true,
2096
+ seen = (bitmask & COMPARE_UNORDERED_FLAG$1) ? new SetCache : undefined;
2097
+
2098
+ stack.set(array, other);
2099
+ stack.set(other, array);
2100
+
2101
+ // Ignore non-index properties.
2102
+ while (++index < arrLength) {
2103
+ var arrValue = array[index],
2104
+ othValue = other[index];
2105
+
2106
+ if (customizer) {
2107
+ var compared = isPartial
2108
+ ? customizer(othValue, arrValue, index, other, array, stack)
2109
+ : customizer(arrValue, othValue, index, array, other, stack);
2110
+ }
2111
+ if (compared !== undefined) {
2112
+ if (compared) {
2113
+ continue;
2114
+ }
2115
+ result = false;
2116
+ break;
2117
+ }
2118
+ // Recursively compare arrays (susceptible to call stack limits).
2119
+ if (seen) {
2120
+ if (!arraySome(other, function(othValue, othIndex) {
2121
+ if (!cacheHas(seen, othIndex) &&
2122
+ (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
2123
+ return seen.push(othIndex);
2124
+ }
2125
+ })) {
2126
+ result = false;
2127
+ break;
2128
+ }
2129
+ } else if (!(
2130
+ arrValue === othValue ||
2131
+ equalFunc(arrValue, othValue, bitmask, customizer, stack)
2132
+ )) {
2133
+ result = false;
2134
+ break;
2135
+ }
2136
+ }
2137
+ stack['delete'](array);
2138
+ stack['delete'](other);
2139
+ return result;
2140
+ }
2141
+
2142
+ /**
2143
+ * Converts `map` to its key-value pairs.
2144
+ *
2145
+ * @private
2146
+ * @param {Object} map The map to convert.
2147
+ * @returns {Array} Returns the key-value pairs.
2148
+ */
2149
+ function mapToArray(map) {
2150
+ var index = -1,
2151
+ result = Array(map.size);
2152
+
2153
+ map.forEach(function(value, key) {
2154
+ result[++index] = [key, value];
2155
+ });
2156
+ return result;
2157
+ }
2158
+
2159
+ /**
2160
+ * Converts `set` to an array of its values.
2161
+ *
2162
+ * @private
2163
+ * @param {Object} set The set to convert.
2164
+ * @returns {Array} Returns the values.
2165
+ */
2166
+ function setToArray(set) {
2167
+ var index = -1,
2168
+ result = Array(set.size);
2169
+
2170
+ set.forEach(function(value) {
2171
+ result[++index] = value;
2172
+ });
2173
+ return result;
2174
+ }
2175
+
2176
+ /** Used to compose bitmasks for value comparisons. */
2177
+ var COMPARE_PARTIAL_FLAG$2 = 1,
2178
+ COMPARE_UNORDERED_FLAG = 2;
2179
+
2180
+ /** `Object#toString` result references. */
2181
+ var boolTag = '[object Boolean]',
2182
+ dateTag = '[object Date]',
2183
+ errorTag = '[object Error]',
2184
+ mapTag = '[object Map]',
2185
+ numberTag = '[object Number]',
2186
+ regexpTag = '[object RegExp]',
2187
+ setTag = '[object Set]',
2188
+ stringTag = '[object String]',
2189
+ symbolTag = '[object Symbol]';
2190
+
2191
+ var arrayBufferTag = '[object ArrayBuffer]',
2192
+ dataViewTag = '[object DataView]';
2193
+
2194
+ /** Used to convert symbols to primitives and strings. */
2195
+ var symbolProto = Symbol ? Symbol.prototype : undefined,
2196
+ symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
2197
+
2198
+ /**
2199
+ * A specialized version of `baseIsEqualDeep` for comparing objects of
2200
+ * the same `toStringTag`.
2201
+ *
2202
+ * **Note:** This function only supports comparing values with tags of
2203
+ * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
2204
+ *
2205
+ * @private
2206
+ * @param {Object} object The object to compare.
2207
+ * @param {Object} other The other object to compare.
2208
+ * @param {string} tag The `toStringTag` of the objects to compare.
2209
+ * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
2210
+ * @param {Function} customizer The function to customize comparisons.
2211
+ * @param {Function} equalFunc The function to determine equivalents of values.
2212
+ * @param {Object} stack Tracks traversed `object` and `other` objects.
2213
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
2214
+ */
2215
+ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
2216
+ switch (tag) {
2217
+ case dataViewTag:
2218
+ if ((object.byteLength != other.byteLength) ||
2219
+ (object.byteOffset != other.byteOffset)) {
2220
+ return false;
2221
+ }
2222
+ object = object.buffer;
2223
+ other = other.buffer;
2224
+
2225
+ case arrayBufferTag:
2226
+ if ((object.byteLength != other.byteLength) ||
2227
+ !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
2228
+ return false;
2229
+ }
2230
+ return true;
2231
+
2232
+ case boolTag:
2233
+ case dateTag:
2234
+ case numberTag:
2235
+ // Coerce booleans to `1` or `0` and dates to milliseconds.
2236
+ // Invalid dates are coerced to `NaN`.
2237
+ return eq(+object, +other);
2238
+
2239
+ case errorTag:
2240
+ return object.name == other.name && object.message == other.message;
2241
+
2242
+ case regexpTag:
2243
+ case stringTag:
2244
+ // Coerce regexes to strings and treat strings, primitives and objects,
2245
+ // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
2246
+ // for more details.
2247
+ return object == (other + '');
2248
+
2249
+ case mapTag:
2250
+ var convert = mapToArray;
2251
+
2252
+ case setTag:
2253
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2;
2254
+ convert || (convert = setToArray);
2255
+
2256
+ if (object.size != other.size && !isPartial) {
2257
+ return false;
2258
+ }
2259
+ // Assume cyclic values are equal.
2260
+ var stacked = stack.get(object);
2261
+ if (stacked) {
2262
+ return stacked == other;
2263
+ }
2264
+ bitmask |= COMPARE_UNORDERED_FLAG;
2265
+
2266
+ // Recursively compare objects (susceptible to call stack limits).
2267
+ stack.set(object, other);
2268
+ var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
2269
+ stack['delete'](object);
2270
+ return result;
2271
+
2272
+ case symbolTag:
2273
+ if (symbolValueOf) {
2274
+ return symbolValueOf.call(object) == symbolValueOf.call(other);
2275
+ }
2276
+ }
2277
+ return false;
2278
+ }
2279
+
2280
+ /** Used to compose bitmasks for value comparisons. */
2281
+ var COMPARE_PARTIAL_FLAG$1 = 1;
2282
+
2283
+ /** Used for built-in method references. */
2284
+ var objectProto$1 = Object.prototype;
2285
+
2286
+ /** Used to check objects for own properties. */
2287
+ var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
2288
+
2289
+ /**
2290
+ * A specialized version of `baseIsEqualDeep` for objects with support for
2291
+ * partial deep comparisons.
2292
+ *
2293
+ * @private
2294
+ * @param {Object} object The object to compare.
2295
+ * @param {Object} other The other object to compare.
2296
+ * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
2297
+ * @param {Function} customizer The function to customize comparisons.
2298
+ * @param {Function} equalFunc The function to determine equivalents of values.
2299
+ * @param {Object} stack Tracks traversed `object` and `other` objects.
2300
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
2301
+ */
2302
+ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
2303
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1,
2304
+ objProps = getAllKeys(object),
2305
+ objLength = objProps.length,
2306
+ othProps = getAllKeys(other),
2307
+ othLength = othProps.length;
2308
+
2309
+ if (objLength != othLength && !isPartial) {
2310
+ return false;
2311
+ }
2312
+ var index = objLength;
2313
+ while (index--) {
2314
+ var key = objProps[index];
2315
+ if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) {
2316
+ return false;
2317
+ }
2318
+ }
2319
+ // Check that cyclic values are equal.
2320
+ var objStacked = stack.get(object);
2321
+ var othStacked = stack.get(other);
2322
+ if (objStacked && othStacked) {
2323
+ return objStacked == other && othStacked == object;
2324
+ }
2325
+ var result = true;
2326
+ stack.set(object, other);
2327
+ stack.set(other, object);
2328
+
2329
+ var skipCtor = isPartial;
2330
+ while (++index < objLength) {
2331
+ key = objProps[index];
2332
+ var objValue = object[key],
2333
+ othValue = other[key];
2334
+
2335
+ if (customizer) {
2336
+ var compared = isPartial
2337
+ ? customizer(othValue, objValue, key, other, object, stack)
2338
+ : customizer(objValue, othValue, key, object, other, stack);
2339
+ }
2340
+ // Recursively compare objects (susceptible to call stack limits).
2341
+ if (!(compared === undefined
2342
+ ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
2343
+ : compared
2344
+ )) {
2345
+ result = false;
2346
+ break;
2347
+ }
2348
+ skipCtor || (skipCtor = key == 'constructor');
2349
+ }
2350
+ if (result && !skipCtor) {
2351
+ var objCtor = object.constructor,
2352
+ othCtor = other.constructor;
2353
+
2354
+ // Non `Object` object instances with different constructors are not equal.
2355
+ if (objCtor != othCtor &&
2356
+ ('constructor' in object && 'constructor' in other) &&
2357
+ !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
2358
+ typeof othCtor == 'function' && othCtor instanceof othCtor)) {
2359
+ result = false;
2360
+ }
2361
+ }
2362
+ stack['delete'](object);
2363
+ stack['delete'](other);
2364
+ return result;
2365
+ }
2366
+
2367
+ /** Used to compose bitmasks for value comparisons. */
2368
+ var COMPARE_PARTIAL_FLAG = 1;
2369
+
2370
+ /** `Object#toString` result references. */
2371
+ var argsTag = '[object Arguments]',
2372
+ arrayTag = '[object Array]',
2373
+ objectTag = '[object Object]';
2374
+
2375
+ /** Used for built-in method references. */
2376
+ var objectProto = Object.prototype;
2377
+
2378
+ /** Used to check objects for own properties. */
2379
+ var hasOwnProperty = objectProto.hasOwnProperty;
2380
+
2381
+ /**
2382
+ * A specialized version of `baseIsEqual` for arrays and objects which performs
2383
+ * deep comparisons and tracks traversed objects enabling objects with circular
2384
+ * references to be compared.
2385
+ *
2386
+ * @private
2387
+ * @param {Object} object The object to compare.
2388
+ * @param {Object} other The other object to compare.
2389
+ * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
2390
+ * @param {Function} customizer The function to customize comparisons.
2391
+ * @param {Function} equalFunc The function to determine equivalents of values.
2392
+ * @param {Object} [stack] Tracks traversed `object` and `other` objects.
2393
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
2394
+ */
2395
+ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
2396
+ var objIsArr = isArray(object),
2397
+ othIsArr = isArray(other),
2398
+ objTag = objIsArr ? arrayTag : getTag$1(object),
2399
+ othTag = othIsArr ? arrayTag : getTag$1(other);
2400
+
2401
+ objTag = objTag == argsTag ? objectTag : objTag;
2402
+ othTag = othTag == argsTag ? objectTag : othTag;
2403
+
2404
+ var objIsObj = objTag == objectTag,
2405
+ othIsObj = othTag == objectTag,
2406
+ isSameTag = objTag == othTag;
2407
+
2408
+ if (isSameTag && isBuffer(object)) {
2409
+ if (!isBuffer(other)) {
2410
+ return false;
2411
+ }
2412
+ objIsArr = true;
2413
+ objIsObj = false;
2414
+ }
2415
+ if (isSameTag && !objIsObj) {
2416
+ stack || (stack = new Stack);
2417
+ return (objIsArr || isTypedArray(object))
2418
+ ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
2419
+ : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
2420
+ }
2421
+ if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
2422
+ var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
2423
+ othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
2424
+
2425
+ if (objIsWrapped || othIsWrapped) {
2426
+ var objUnwrapped = objIsWrapped ? object.value() : object,
2427
+ othUnwrapped = othIsWrapped ? other.value() : other;
2428
+
2429
+ stack || (stack = new Stack);
2430
+ return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
2431
+ }
2432
+ }
2433
+ if (!isSameTag) {
2434
+ return false;
2435
+ }
2436
+ stack || (stack = new Stack);
2437
+ return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
2438
+ }
2439
+
2440
+ /**
2441
+ * The base implementation of `_.isEqual` which supports partial comparisons
2442
+ * and tracks traversed objects.
2443
+ *
2444
+ * @private
2445
+ * @param {*} value The value to compare.
2446
+ * @param {*} other The other value to compare.
2447
+ * @param {boolean} bitmask The bitmask flags.
2448
+ * 1 - Unordered comparison
2449
+ * 2 - Partial comparison
2450
+ * @param {Function} [customizer] The function to customize comparisons.
2451
+ * @param {Object} [stack] Tracks traversed `value` and `other` objects.
2452
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
2453
+ */
2454
+ function baseIsEqual(value, other, bitmask, customizer, stack) {
2455
+ if (value === other) {
2456
+ return true;
2457
+ }
2458
+ if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
2459
+ return value !== value && other !== other;
2460
+ }
2461
+ return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
2462
+ }
2463
+
2464
+ /**
2465
+ * Gets the timestamp of the number of milliseconds that have elapsed since
2466
+ * the Unix epoch (1 January 1970 00:00:00 UTC).
2467
+ *
2468
+ * @static
2469
+ * @memberOf _
2470
+ * @since 2.4.0
2471
+ * @category Date
2472
+ * @returns {number} Returns the timestamp.
2473
+ * @example
2474
+ *
2475
+ * _.defer(function(stamp) {
2476
+ * console.log(_.now() - stamp);
2477
+ * }, _.now());
2478
+ * // => Logs the number of milliseconds it took for the deferred invocation.
2479
+ */
2480
+ var now = function() {
2481
+ return root.Date.now();
2482
+ };
2483
+
2484
+ /** Error message constants. */
2485
+ var FUNC_ERROR_TEXT$1 = 'Expected a function';
2486
+
2487
+ /* Built-in method references for those with the same name as other `lodash` methods. */
2488
+ var nativeMax = Math.max,
2489
+ nativeMin = Math.min;
2490
+
2491
+ /**
2492
+ * Creates a debounced function that delays invoking `func` until after `wait`
2493
+ * milliseconds have elapsed since the last time the debounced function was
2494
+ * invoked. The debounced function comes with a `cancel` method to cancel
2495
+ * delayed `func` invocations and a `flush` method to immediately invoke them.
2496
+ * Provide `options` to indicate whether `func` should be invoked on the
2497
+ * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
2498
+ * with the last arguments provided to the debounced function. Subsequent
2499
+ * calls to the debounced function return the result of the last `func`
2500
+ * invocation.
2501
+ *
2502
+ * **Note:** If `leading` and `trailing` options are `true`, `func` is
2503
+ * invoked on the trailing edge of the timeout only if the debounced function
2504
+ * is invoked more than once during the `wait` timeout.
2505
+ *
2506
+ * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
2507
+ * until to the next tick, similar to `setTimeout` with a timeout of `0`.
2508
+ *
2509
+ * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
2510
+ * for details over the differences between `_.debounce` and `_.throttle`.
2511
+ *
2512
+ * @static
2513
+ * @memberOf _
2514
+ * @since 0.1.0
2515
+ * @category Function
2516
+ * @param {Function} func The function to debounce.
2517
+ * @param {number} [wait=0] The number of milliseconds to delay.
2518
+ * @param {Object} [options={}] The options object.
2519
+ * @param {boolean} [options.leading=false]
2520
+ * Specify invoking on the leading edge of the timeout.
2521
+ * @param {number} [options.maxWait]
2522
+ * The maximum time `func` is allowed to be delayed before it's invoked.
2523
+ * @param {boolean} [options.trailing=true]
2524
+ * Specify invoking on the trailing edge of the timeout.
2525
+ * @returns {Function} Returns the new debounced function.
2526
+ * @example
2527
+ *
2528
+ * // Avoid costly calculations while the window size is in flux.
2529
+ * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
2530
+ *
2531
+ * // Invoke `sendMail` when clicked, debouncing subsequent calls.
2532
+ * jQuery(element).on('click', _.debounce(sendMail, 300, {
2533
+ * 'leading': true,
2534
+ * 'trailing': false
2535
+ * }));
2536
+ *
2537
+ * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
2538
+ * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
2539
+ * var source = new EventSource('/stream');
2540
+ * jQuery(source).on('message', debounced);
2541
+ *
2542
+ * // Cancel the trailing debounced invocation.
2543
+ * jQuery(window).on('popstate', debounced.cancel);
2544
+ */
2545
+ function debounce(func, wait, options) {
2546
+ var lastArgs,
2547
+ lastThis,
2548
+ maxWait,
2549
+ result,
2550
+ timerId,
2551
+ lastCallTime,
2552
+ lastInvokeTime = 0,
2553
+ leading = false,
2554
+ maxing = false,
2555
+ trailing = true;
2556
+
2557
+ if (typeof func != 'function') {
2558
+ throw new TypeError(FUNC_ERROR_TEXT$1);
2559
+ }
2560
+ wait = toNumber(wait) || 0;
2561
+ if (isObject(options)) {
2562
+ leading = !!options.leading;
2563
+ maxing = 'maxWait' in options;
2564
+ maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
2565
+ trailing = 'trailing' in options ? !!options.trailing : trailing;
2566
+ }
2567
+
2568
+ function invokeFunc(time) {
2569
+ var args = lastArgs,
2570
+ thisArg = lastThis;
2571
+
2572
+ lastArgs = lastThis = undefined;
2573
+ lastInvokeTime = time;
2574
+ result = func.apply(thisArg, args);
2575
+ return result;
2576
+ }
2577
+
2578
+ function leadingEdge(time) {
2579
+ // Reset any `maxWait` timer.
2580
+ lastInvokeTime = time;
2581
+ // Start the timer for the trailing edge.
2582
+ timerId = setTimeout(timerExpired, wait);
2583
+ // Invoke the leading edge.
2584
+ return leading ? invokeFunc(time) : result;
2585
+ }
2586
+
2587
+ function remainingWait(time) {
2588
+ var timeSinceLastCall = time - lastCallTime,
2589
+ timeSinceLastInvoke = time - lastInvokeTime,
2590
+ timeWaiting = wait - timeSinceLastCall;
2591
+
2592
+ return maxing
2593
+ ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
2594
+ : timeWaiting;
2595
+ }
2596
+
2597
+ function shouldInvoke(time) {
2598
+ var timeSinceLastCall = time - lastCallTime,
2599
+ timeSinceLastInvoke = time - lastInvokeTime;
2600
+
2601
+ // Either this is the first call, activity has stopped and we're at the
2602
+ // trailing edge, the system time has gone backwards and we're treating
2603
+ // it as the trailing edge, or we've hit the `maxWait` limit.
2604
+ return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
2605
+ (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
2606
+ }
2607
+
2608
+ function timerExpired() {
2609
+ var time = now();
2610
+ if (shouldInvoke(time)) {
2611
+ return trailingEdge(time);
2612
+ }
2613
+ // Restart the timer.
2614
+ timerId = setTimeout(timerExpired, remainingWait(time));
2615
+ }
2616
+
2617
+ function trailingEdge(time) {
2618
+ timerId = undefined;
2619
+
2620
+ // Only invoke if we have `lastArgs` which means `func` has been
2621
+ // debounced at least once.
2622
+ if (trailing && lastArgs) {
2623
+ return invokeFunc(time);
2624
+ }
2625
+ lastArgs = lastThis = undefined;
2626
+ return result;
2627
+ }
2628
+
2629
+ function cancel() {
2630
+ if (timerId !== undefined) {
2631
+ clearTimeout(timerId);
2632
+ }
2633
+ lastInvokeTime = 0;
2634
+ lastArgs = lastCallTime = lastThis = timerId = undefined;
2635
+ }
2636
+
2637
+ function flush() {
2638
+ return timerId === undefined ? result : trailingEdge(now());
2639
+ }
2640
+
2641
+ function debounced() {
2642
+ var time = now(),
2643
+ isInvoking = shouldInvoke(time);
2644
+
2645
+ lastArgs = arguments;
2646
+ lastThis = this;
2647
+ lastCallTime = time;
2648
+
2649
+ if (isInvoking) {
2650
+ if (timerId === undefined) {
2651
+ return leadingEdge(lastCallTime);
2652
+ }
2653
+ if (maxing) {
2654
+ // Handle invocations in a tight loop.
2655
+ clearTimeout(timerId);
2656
+ timerId = setTimeout(timerExpired, wait);
2657
+ return invokeFunc(lastCallTime);
2658
+ }
2659
+ }
2660
+ if (timerId === undefined) {
2661
+ timerId = setTimeout(timerExpired, wait);
2662
+ }
2663
+ return result;
2664
+ }
2665
+ debounced.cancel = cancel;
2666
+ debounced.flush = flush;
2667
+ return debounced;
2668
+ }
2669
+
2670
+ /**
2671
+ * Performs a deep comparison between two values to determine if they are
2672
+ * equivalent.
2673
+ *
2674
+ * **Note:** This method supports comparing arrays, array buffers, booleans,
2675
+ * date objects, error objects, maps, numbers, `Object` objects, regexes,
2676
+ * sets, strings, symbols, and typed arrays. `Object` objects are compared
2677
+ * by their own, not inherited, enumerable properties. Functions and DOM
2678
+ * nodes are compared by strict equality, i.e. `===`.
2679
+ *
2680
+ * @static
2681
+ * @memberOf _
2682
+ * @since 0.1.0
2683
+ * @category Lang
2684
+ * @param {*} value The value to compare.
2685
+ * @param {*} other The other value to compare.
2686
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
2687
+ * @example
2688
+ *
2689
+ * var object = { 'a': 1 };
2690
+ * var other = { 'a': 1 };
2691
+ *
2692
+ * _.isEqual(object, other);
2693
+ * // => true
2694
+ *
2695
+ * object === other;
2696
+ * // => false
2697
+ */
2698
+ function isEqual(value, other) {
2699
+ return baseIsEqual(value, other);
2700
+ }
2701
+
2702
+ /** Error message constants. */
2703
+ var FUNC_ERROR_TEXT = 'Expected a function';
2704
+
2705
+ /**
2706
+ * Creates a throttled function that only invokes `func` at most once per
2707
+ * every `wait` milliseconds. The throttled function comes with a `cancel`
2708
+ * method to cancel delayed `func` invocations and a `flush` method to
2709
+ * immediately invoke them. Provide `options` to indicate whether `func`
2710
+ * should be invoked on the leading and/or trailing edge of the `wait`
2711
+ * timeout. The `func` is invoked with the last arguments provided to the
2712
+ * throttled function. Subsequent calls to the throttled function return the
2713
+ * result of the last `func` invocation.
2714
+ *
2715
+ * **Note:** If `leading` and `trailing` options are `true`, `func` is
2716
+ * invoked on the trailing edge of the timeout only if the throttled function
2717
+ * is invoked more than once during the `wait` timeout.
2718
+ *
2719
+ * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
2720
+ * until to the next tick, similar to `setTimeout` with a timeout of `0`.
2721
+ *
2722
+ * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
2723
+ * for details over the differences between `_.throttle` and `_.debounce`.
2724
+ *
2725
+ * @static
2726
+ * @memberOf _
2727
+ * @since 0.1.0
2728
+ * @category Function
2729
+ * @param {Function} func The function to throttle.
2730
+ * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
2731
+ * @param {Object} [options={}] The options object.
2732
+ * @param {boolean} [options.leading=true]
2733
+ * Specify invoking on the leading edge of the timeout.
2734
+ * @param {boolean} [options.trailing=true]
2735
+ * Specify invoking on the trailing edge of the timeout.
2736
+ * @returns {Function} Returns the new throttled function.
2737
+ * @example
2738
+ *
2739
+ * // Avoid excessively updating the position while scrolling.
2740
+ * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
2741
+ *
2742
+ * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
2743
+ * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
2744
+ * jQuery(element).on('click', throttled);
2745
+ *
2746
+ * // Cancel the trailing throttled invocation.
2747
+ * jQuery(window).on('popstate', throttled.cancel);
2748
+ */
2749
+ function throttle(func, wait, options) {
2750
+ var leading = true,
2751
+ trailing = true;
2752
+
2753
+ if (typeof func != 'function') {
2754
+ throw new TypeError(FUNC_ERROR_TEXT);
2755
+ }
2756
+ if (isObject(options)) {
2757
+ leading = 'leading' in options ? !!options.leading : leading;
2758
+ trailing = 'trailing' in options ? !!options.trailing : trailing;
2759
+ }
2760
+ return debounce(func, wait, {
2761
+ 'leading': leading,
2762
+ 'maxWait': wait,
2763
+ 'trailing': trailing
2764
+ });
2765
+ }
2766
+
364
2767
  function useThrottleFn(fn, wait, options) {
365
2768
  if (isDev) {
366
- if (!isFunction(fn)) {
2769
+ if (!isFunction$1(fn)) {
367
2770
  console.error(
368
2771
  `useThrottleFn expected parameter is a function, got ${typeof fn}`
369
2772
  );
@@ -371,7 +2774,7 @@ function useThrottleFn(fn, wait, options) {
371
2774
  }
372
2775
  const fnRef = useLatest(fn);
373
2776
  const throttled = React.useMemo(
374
- () => lodashEs.throttle(
2777
+ () => throttle(
375
2778
  (...args) => {
376
2779
  return fnRef.current(...args);
377
2780
  },
@@ -407,7 +2810,7 @@ function useThrottle(value, wait, options) {
407
2810
 
408
2811
  function useDebounceFn(fn, wait, options) {
409
2812
  if (isDev) {
410
- if (!isFunction(fn)) {
2813
+ if (!isFunction$1(fn)) {
411
2814
  console.error(
412
2815
  `useDebounceFn expected parameter is a function, got ${typeof fn}`
413
2816
  );
@@ -415,7 +2818,7 @@ function useDebounceFn(fn, wait, options) {
415
2818
  }
416
2819
  const fnRef = useLatest(fn);
417
2820
  const debounced = React.useMemo(
418
- () => lodashEs.debounce(
2821
+ () => debounce(
419
2822
  (...args) => {
420
2823
  return fnRef.current(...args);
421
2824
  },
@@ -541,7 +2944,7 @@ function getTargetElement(target, defaultElement) {
541
2944
  return defaultElement;
542
2945
  }
543
2946
  let targetElement;
544
- if (isFunction(target)) {
2947
+ if (isFunction$1(target)) {
545
2948
  targetElement = target();
546
2949
  } else if ("current" in target) {
547
2950
  targetElement = target.current;
@@ -777,7 +3180,7 @@ function useDeepCompareEffect(effect, deps) {
777
3180
  );
778
3181
  }
779
3182
  }
780
- useCustomCompareEffect(effect, deps, lodashEs.isEqual);
3183
+ useCustomCompareEffect(effect, deps, isEqual);
781
3184
  }
782
3185
 
783
3186
  function useTitle(title) {
@@ -1004,7 +3407,7 @@ function useIdle(ms = oneMinute, initialState = false, events = defaultEvents$1)
1004
3407
  setState(newState);
1005
3408
  }
1006
3409
  };
1007
- const onEvent = lodashEs.throttle(() => {
3410
+ const onEvent = throttle(() => {
1008
3411
  if (localState) {
1009
3412
  set(false);
1010
3413
  }
@@ -1276,16 +3679,199 @@ function useGeolocation(options = defaultOptions) {
1276
3679
  };
1277
3680
  }
1278
3681
 
3682
+ var screenfull$1 = {exports: {}};
3683
+
3684
+ /*!
3685
+ * screenfull
3686
+ * v5.0.0 - 2019-09-09
3687
+ * (c) Sindre Sorhus; MIT License
3688
+ */
3689
+
3690
+ (function (module) {
3691
+ (function () {
3692
+
3693
+ var document = typeof window !== 'undefined' && typeof window.document !== 'undefined' ? window.document : {};
3694
+ var isCommonjs = module.exports;
3695
+
3696
+ var fn = (function () {
3697
+ var val;
3698
+
3699
+ var fnMap = [
3700
+ [
3701
+ 'requestFullscreen',
3702
+ 'exitFullscreen',
3703
+ 'fullscreenElement',
3704
+ 'fullscreenEnabled',
3705
+ 'fullscreenchange',
3706
+ 'fullscreenerror'
3707
+ ],
3708
+ // New WebKit
3709
+ [
3710
+ 'webkitRequestFullscreen',
3711
+ 'webkitExitFullscreen',
3712
+ 'webkitFullscreenElement',
3713
+ 'webkitFullscreenEnabled',
3714
+ 'webkitfullscreenchange',
3715
+ 'webkitfullscreenerror'
3716
+
3717
+ ],
3718
+ // Old WebKit
3719
+ [
3720
+ 'webkitRequestFullScreen',
3721
+ 'webkitCancelFullScreen',
3722
+ 'webkitCurrentFullScreenElement',
3723
+ 'webkitCancelFullScreen',
3724
+ 'webkitfullscreenchange',
3725
+ 'webkitfullscreenerror'
3726
+
3727
+ ],
3728
+ [
3729
+ 'mozRequestFullScreen',
3730
+ 'mozCancelFullScreen',
3731
+ 'mozFullScreenElement',
3732
+ 'mozFullScreenEnabled',
3733
+ 'mozfullscreenchange',
3734
+ 'mozfullscreenerror'
3735
+ ],
3736
+ [
3737
+ 'msRequestFullscreen',
3738
+ 'msExitFullscreen',
3739
+ 'msFullscreenElement',
3740
+ 'msFullscreenEnabled',
3741
+ 'MSFullscreenChange',
3742
+ 'MSFullscreenError'
3743
+ ]
3744
+ ];
3745
+
3746
+ var i = 0;
3747
+ var l = fnMap.length;
3748
+ var ret = {};
3749
+
3750
+ for (; i < l; i++) {
3751
+ val = fnMap[i];
3752
+ if (val && val[1] in document) {
3753
+ for (i = 0; i < val.length; i++) {
3754
+ ret[fnMap[0][i]] = val[i];
3755
+ }
3756
+ return ret;
3757
+ }
3758
+ }
3759
+
3760
+ return false;
3761
+ })();
3762
+
3763
+ var eventNameMap = {
3764
+ change: fn.fullscreenchange,
3765
+ error: fn.fullscreenerror
3766
+ };
3767
+
3768
+ var screenfull = {
3769
+ request: function (element) {
3770
+ return new Promise(function (resolve, reject) {
3771
+ var onFullScreenEntered = function () {
3772
+ this.off('change', onFullScreenEntered);
3773
+ resolve();
3774
+ }.bind(this);
3775
+
3776
+ this.on('change', onFullScreenEntered);
3777
+
3778
+ element = element || document.documentElement;
3779
+
3780
+ Promise.resolve(element[fn.requestFullscreen]()).catch(reject);
3781
+ }.bind(this));
3782
+ },
3783
+ exit: function () {
3784
+ return new Promise(function (resolve, reject) {
3785
+ if (!this.isFullscreen) {
3786
+ resolve();
3787
+ return;
3788
+ }
3789
+
3790
+ var onFullScreenExit = function () {
3791
+ this.off('change', onFullScreenExit);
3792
+ resolve();
3793
+ }.bind(this);
3794
+
3795
+ this.on('change', onFullScreenExit);
3796
+
3797
+ Promise.resolve(document[fn.exitFullscreen]()).catch(reject);
3798
+ }.bind(this));
3799
+ },
3800
+ toggle: function (element) {
3801
+ return this.isFullscreen ? this.exit() : this.request(element);
3802
+ },
3803
+ onchange: function (callback) {
3804
+ this.on('change', callback);
3805
+ },
3806
+ onerror: function (callback) {
3807
+ this.on('error', callback);
3808
+ },
3809
+ on: function (event, callback) {
3810
+ var eventName = eventNameMap[event];
3811
+ if (eventName) {
3812
+ document.addEventListener(eventName, callback, false);
3813
+ }
3814
+ },
3815
+ off: function (event, callback) {
3816
+ var eventName = eventNameMap[event];
3817
+ if (eventName) {
3818
+ document.removeEventListener(eventName, callback, false);
3819
+ }
3820
+ },
3821
+ raw: fn
3822
+ };
3823
+
3824
+ if (!fn) {
3825
+ if (isCommonjs) {
3826
+ module.exports = {isEnabled: false};
3827
+ } else {
3828
+ window.screenfull = {isEnabled: false};
3829
+ }
3830
+
3831
+ return;
3832
+ }
3833
+
3834
+ Object.defineProperties(screenfull, {
3835
+ isFullscreen: {
3836
+ get: function () {
3837
+ return Boolean(document[fn.fullscreenElement]);
3838
+ }
3839
+ },
3840
+ element: {
3841
+ enumerable: true,
3842
+ get: function () {
3843
+ return document[fn.fullscreenElement];
3844
+ }
3845
+ },
3846
+ isEnabled: {
3847
+ enumerable: true,
3848
+ get: function () {
3849
+ // Coerce to boolean in case of old WebKit
3850
+ return Boolean(document[fn.fullscreenEnabled]);
3851
+ }
3852
+ }
3853
+ });
3854
+
3855
+ if (isCommonjs) {
3856
+ module.exports = screenfull;
3857
+ } else {
3858
+ window.screenfull = screenfull;
3859
+ }
3860
+ })();
3861
+ } (screenfull$1));
3862
+
3863
+ var screenfull = screenfull$1.exports;
3864
+
1279
3865
  function useFullscreen(target, options = defaultOptions) {
1280
3866
  const { onExit, onEnter } = options;
1281
3867
  const [state, setState] = React.useState(false);
1282
3868
  const onChange = () => {
1283
- if (screenfull__default["default"].isEnabled) {
1284
- const { isFullscreen } = screenfull__default["default"];
3869
+ if (screenfull.isEnabled) {
3870
+ const { isFullscreen } = screenfull;
1285
3871
  if (isFullscreen) {
1286
3872
  onEnter == null ? void 0 : onEnter();
1287
3873
  } else {
1288
- screenfull__default["default"].off("change", onChange);
3874
+ screenfull.off("change", onChange);
1289
3875
  onExit == null ? void 0 : onExit();
1290
3876
  }
1291
3877
  setState(isFullscreen);
@@ -1296,18 +3882,18 @@ function useFullscreen(target, options = defaultOptions) {
1296
3882
  if (!el) {
1297
3883
  return;
1298
3884
  }
1299
- if (screenfull__default["default"].isEnabled) {
3885
+ if (screenfull.isEnabled) {
1300
3886
  try {
1301
- screenfull__default["default"].request(el);
1302
- screenfull__default["default"].on("change", onChange);
3887
+ screenfull.request(el);
3888
+ screenfull.on("change", onChange);
1303
3889
  } catch (error) {
1304
3890
  console.error(error);
1305
3891
  }
1306
3892
  }
1307
3893
  };
1308
3894
  const exitFullscreen = () => {
1309
- if (screenfull__default["default"].isEnabled) {
1310
- screenfull__default["default"].exit();
3895
+ if (screenfull.isEnabled) {
3896
+ screenfull.exit();
1311
3897
  }
1312
3898
  };
1313
3899
  const toggleFullscreen = () => {
@@ -1318,8 +3904,8 @@ function useFullscreen(target, options = defaultOptions) {
1318
3904
  }
1319
3905
  };
1320
3906
  useUnmount(() => {
1321
- if (screenfull__default["default"].isEnabled) {
1322
- screenfull__default["default"].off("change", onChange);
3907
+ if (screenfull.isEnabled) {
3908
+ screenfull.off("change", onChange);
1323
3909
  }
1324
3910
  });
1325
3911
  return [
@@ -1328,7 +3914,7 @@ function useFullscreen(target, options = defaultOptions) {
1328
3914
  enterFullscreen: useEvent(enterFullscreen),
1329
3915
  exitFullscreen: useEvent(exitFullscreen),
1330
3916
  toggleFullscreen: useEvent(toggleFullscreen),
1331
- isEnabled: screenfull__default["default"].isEnabled
3917
+ isEnabled: screenfull.isEnabled
1332
3918
  }
1333
3919
  ];
1334
3920
  }
@@ -2935,7 +5521,7 @@ function useCookie(key, options = defaultOptions, defaultValue) {
2935
5521
  }, [defaultValue, key, options]);
2936
5522
  const updateCookie = React.useCallback(
2937
5523
  (newValue) => {
2938
- const value = isFunction(newValue) ? newValue(cookieValue) : newValue;
5524
+ const value = isFunction$1(newValue) ? newValue(cookieValue) : newValue;
2939
5525
  if (value === void 0) {
2940
5526
  api.remove(key);
2941
5527
  } else {
@@ -3040,6 +5626,15 @@ function useMeasure(target, options = defaultOptions) {
3040
5626
  return [rect, stop];
3041
5627
  }
3042
5628
 
5629
+ function useHover(target) {
5630
+ const [hovered, setHovered] = React.useState(false);
5631
+ const onMouseEnter = React.useCallback(() => setHovered(true), []);
5632
+ const onMouseLeave = React.useCallback(() => setHovered(false), []);
5633
+ useEventListener("mouseenter", onMouseEnter, target);
5634
+ useEventListener("mouseleave", onMouseLeave, target);
5635
+ return hovered;
5636
+ }
5637
+
3043
5638
  exports.getHMSTime = getHMSTime;
3044
5639
  exports.useActiveElement = useActiveElement;
3045
5640
  exports.useAsyncEffect = useAsyncEffect;
@@ -3073,6 +5668,7 @@ exports.useFocus = useFocus;
3073
5668
  exports.useFps = index$2;
3074
5669
  exports.useFullscreen = useFullscreen;
3075
5670
  exports.useGeolocation = useGeolocation;
5671
+ exports.useHover = useHover;
3076
5672
  exports.useIdle = useIdle;
3077
5673
  exports.useInfiniteScroll = useInfiniteScroll;
3078
5674
  exports.useIntersectionObserver = useIntersectionObserver;