@kne/react-pdf-sign 1.0.2 → 1.0.4

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.
@@ -189,7 +189,6 @@ const LocationLayer = withLocale(p => {
189
189
  const [signatureImage] = useImage(signature);
190
190
  const groupRef = useRef();
191
191
  const signRef = useRef();
192
- const targetRef = useRef();
193
192
  const transformerRef = useRef();
194
193
  const computedSignLocation = () => {
195
194
  const absolutePosition = signRef.current.absolutePosition();
@@ -201,8 +200,8 @@ const LocationLayer = withLocale(p => {
201
200
  x: Math.round(absolutePosition.x),
202
201
  y: Math.round(absolutePosition.y)
203
202
  },
204
- scaleX: Number(transformerRef.current.attrs.scaleX.toFixed(2)),
205
- scaleY: Number(transformerRef.current.attrs.scaleY.toFixed(2)),
203
+ scaleX: Number(groupRef.current.attrs.scaleX.toFixed(2)),
204
+ scaleY: Number(groupRef.current.attrs.scaleY.toFixed(2)),
206
205
  x: Math.round(groupRef.current.attrs.x),
207
206
  y: Math.round(groupRef.current.attrs.y)
208
207
  });
@@ -237,7 +236,7 @@ const LocationLayer = withLocale(p => {
237
236
  }, []);
238
237
  useEffect(() => {
239
238
  if (isInit) {
240
- transformerRef.current.nodes([targetRef.current]);
239
+ transformerRef.current.nodes([groupRef.current]);
241
240
  }
242
241
  }, [isInit]);
243
242
  if (!(isInit && value)) {
@@ -253,22 +252,21 @@ const LocationLayer = withLocale(p => {
253
252
  draggable: true,
254
253
  ref: groupRef,
255
254
  onDragEnd: computedSignLocation,
256
- children: [/*#__PURE__*/jsx(Group, {
257
- ref: targetRef,
258
- onTransformEnd: computedSignLocation,
259
- children: signatureImage ? /*#__PURE__*/jsx(Image$1, {
260
- width: width,
261
- height: height,
262
- image: signatureImage,
263
- cornerRadius: 8,
264
- ref: signRef
265
- }) : /*#__PURE__*/jsx(Rect, {
266
- width: width,
267
- height: height,
268
- fill: "#f0f0f0",
269
- cornerRadius: 8,
270
- ref: signRef
271
- })
255
+ scaleX: value.scaleX,
256
+ scaleY: value.scaleY,
257
+ onTransformEnd: computedSignLocation,
258
+ children: [signatureImage ? /*#__PURE__*/jsx(Image$1, {
259
+ width: width,
260
+ height: height,
261
+ image: signatureImage,
262
+ cornerRadius: 8,
263
+ ref: signRef
264
+ }) : /*#__PURE__*/jsx(Rect, {
265
+ width: width,
266
+ height: height,
267
+ fill: "#f0f0f0",
268
+ cornerRadius: 8,
269
+ ref: signRef
272
270
  }), /*#__PURE__*/jsx(Text, {
273
271
  text: signatureImage ? '' : placeholder,
274
272
  fontSize: 16,
@@ -280,9 +278,6 @@ const LocationLayer = withLocale(p => {
280
278
  height: height
281
279
  })]
282
280
  }), /*#__PURE__*/jsx(Transformer, {
283
- scaleX: value.scaleX,
284
- scaleY: value.scaleY,
285
- centeredScaling: true,
286
281
  ref: transformerRef,
287
282
  keepRatio: true,
288
283
  flipEnabled: false,
@@ -296,260 +291,6 @@ const LocationLayer = withLocale(p => {
296
291
  });
297
292
  });
298
293
 
299
- /**
300
- * Removes all key-value entries from the list cache.
301
- *
302
- * @private
303
- * @name clear
304
- * @memberOf ListCache
305
- */
306
- function listCacheClear() {
307
- this.__data__ = [];
308
- this.size = 0;
309
- }
310
-
311
- var _listCacheClear = listCacheClear;
312
-
313
- /**
314
- * Performs a
315
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
316
- * comparison between two values to determine if they are equivalent.
317
- *
318
- * @static
319
- * @memberOf _
320
- * @since 4.0.0
321
- * @category Lang
322
- * @param {*} value The value to compare.
323
- * @param {*} other The other value to compare.
324
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
325
- * @example
326
- *
327
- * var object = { 'a': 1 };
328
- * var other = { 'a': 1 };
329
- *
330
- * _.eq(object, object);
331
- * // => true
332
- *
333
- * _.eq(object, other);
334
- * // => false
335
- *
336
- * _.eq('a', 'a');
337
- * // => true
338
- *
339
- * _.eq('a', Object('a'));
340
- * // => false
341
- *
342
- * _.eq(NaN, NaN);
343
- * // => true
344
- */
345
- function eq(value, other) {
346
- return value === other || (value !== value && other !== other);
347
- }
348
-
349
- var eq_1 = eq;
350
-
351
- /**
352
- * Gets the index at which the `key` is found in `array` of key-value pairs.
353
- *
354
- * @private
355
- * @param {Array} array The array to inspect.
356
- * @param {*} key The key to search for.
357
- * @returns {number} Returns the index of the matched value, else `-1`.
358
- */
359
- function assocIndexOf(array, key) {
360
- var length = array.length;
361
- while (length--) {
362
- if (eq_1(array[length][0], key)) {
363
- return length;
364
- }
365
- }
366
- return -1;
367
- }
368
-
369
- var _assocIndexOf = assocIndexOf;
370
-
371
- /** Used for built-in method references. */
372
- var arrayProto = Array.prototype;
373
-
374
- /** Built-in value references. */
375
- var splice = arrayProto.splice;
376
-
377
- /**
378
- * Removes `key` and its value from the list cache.
379
- *
380
- * @private
381
- * @name delete
382
- * @memberOf ListCache
383
- * @param {string} key The key of the value to remove.
384
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
385
- */
386
- function listCacheDelete(key) {
387
- var data = this.__data__,
388
- index = _assocIndexOf(data, key);
389
-
390
- if (index < 0) {
391
- return false;
392
- }
393
- var lastIndex = data.length - 1;
394
- if (index == lastIndex) {
395
- data.pop();
396
- } else {
397
- splice.call(data, index, 1);
398
- }
399
- --this.size;
400
- return true;
401
- }
402
-
403
- var _listCacheDelete = listCacheDelete;
404
-
405
- /**
406
- * Gets the list cache value for `key`.
407
- *
408
- * @private
409
- * @name get
410
- * @memberOf ListCache
411
- * @param {string} key The key of the value to get.
412
- * @returns {*} Returns the entry value.
413
- */
414
- function listCacheGet(key) {
415
- var data = this.__data__,
416
- index = _assocIndexOf(data, key);
417
-
418
- return index < 0 ? undefined : data[index][1];
419
- }
420
-
421
- var _listCacheGet = listCacheGet;
422
-
423
- /**
424
- * Checks if a list cache value for `key` exists.
425
- *
426
- * @private
427
- * @name has
428
- * @memberOf ListCache
429
- * @param {string} key The key of the entry to check.
430
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
431
- */
432
- function listCacheHas(key) {
433
- return _assocIndexOf(this.__data__, key) > -1;
434
- }
435
-
436
- var _listCacheHas = listCacheHas;
437
-
438
- /**
439
- * Sets the list cache `key` to `value`.
440
- *
441
- * @private
442
- * @name set
443
- * @memberOf ListCache
444
- * @param {string} key The key of the value to set.
445
- * @param {*} value The value to set.
446
- * @returns {Object} Returns the list cache instance.
447
- */
448
- function listCacheSet(key, value) {
449
- var data = this.__data__,
450
- index = _assocIndexOf(data, key);
451
-
452
- if (index < 0) {
453
- ++this.size;
454
- data.push([key, value]);
455
- } else {
456
- data[index][1] = value;
457
- }
458
- return this;
459
- }
460
-
461
- var _listCacheSet = listCacheSet;
462
-
463
- /**
464
- * Creates an list cache object.
465
- *
466
- * @private
467
- * @constructor
468
- * @param {Array} [entries] The key-value pairs to cache.
469
- */
470
- function ListCache(entries) {
471
- var index = -1,
472
- length = entries == null ? 0 : entries.length;
473
-
474
- this.clear();
475
- while (++index < length) {
476
- var entry = entries[index];
477
- this.set(entry[0], entry[1]);
478
- }
479
- }
480
-
481
- // Add methods to `ListCache`.
482
- ListCache.prototype.clear = _listCacheClear;
483
- ListCache.prototype['delete'] = _listCacheDelete;
484
- ListCache.prototype.get = _listCacheGet;
485
- ListCache.prototype.has = _listCacheHas;
486
- ListCache.prototype.set = _listCacheSet;
487
-
488
- var _ListCache = ListCache;
489
-
490
- /**
491
- * Removes all key-value entries from the stack.
492
- *
493
- * @private
494
- * @name clear
495
- * @memberOf Stack
496
- */
497
- function stackClear() {
498
- this.__data__ = new _ListCache;
499
- this.size = 0;
500
- }
501
-
502
- var _stackClear = stackClear;
503
-
504
- /**
505
- * Removes `key` and its value from the stack.
506
- *
507
- * @private
508
- * @name delete
509
- * @memberOf Stack
510
- * @param {string} key The key of the value to remove.
511
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
512
- */
513
- function stackDelete(key) {
514
- var data = this.__data__,
515
- result = data['delete'](key);
516
-
517
- this.size = data.size;
518
- return result;
519
- }
520
-
521
- var _stackDelete = stackDelete;
522
-
523
- /**
524
- * Gets the stack value for `key`.
525
- *
526
- * @private
527
- * @name get
528
- * @memberOf Stack
529
- * @param {string} key The key of the value to get.
530
- * @returns {*} Returns the entry value.
531
- */
532
- function stackGet(key) {
533
- return this.__data__.get(key);
534
- }
535
-
536
- var _stackGet = stackGet;
537
-
538
- /**
539
- * Checks if a stack value for `key` exists.
540
- *
541
- * @private
542
- * @name has
543
- * @memberOf Stack
544
- * @param {string} key The key of the entry to check.
545
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
546
- */
547
- function stackHas(key) {
548
- return this.__data__.has(key);
549
- }
550
-
551
- var _stackHas = stackHas;
552
-
553
294
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
554
295
 
555
296
  function createCommonjsModule(fn) {
@@ -577,17 +318,17 @@ var Symbol = _root.Symbol;
577
318
  var _Symbol = Symbol;
578
319
 
579
320
  /** Used for built-in method references. */
580
- var objectProto$b = Object.prototype;
321
+ var objectProto$3 = Object.prototype;
581
322
 
582
323
  /** Used to check objects for own properties. */
583
- var hasOwnProperty$8 = objectProto$b.hasOwnProperty;
324
+ var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
584
325
 
585
326
  /**
586
327
  * Used to resolve the
587
328
  * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
588
329
  * of values.
589
330
  */
590
- var nativeObjectToString$1 = objectProto$b.toString;
331
+ var nativeObjectToString$1 = objectProto$3.toString;
591
332
 
592
333
  /** Built-in value references. */
593
334
  var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
@@ -600,7 +341,7 @@ var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
600
341
  * @returns {string} Returns the raw `toStringTag`.
601
342
  */
602
343
  function getRawTag(value) {
603
- var isOwn = hasOwnProperty$8.call(value, symToStringTag$1),
344
+ var isOwn = hasOwnProperty$2.call(value, symToStringTag$1),
604
345
  tag = value[symToStringTag$1];
605
346
 
606
347
  try {
@@ -622,14 +363,14 @@ function getRawTag(value) {
622
363
  var _getRawTag = getRawTag;
623
364
 
624
365
  /** Used for built-in method references. */
625
- var objectProto$a = Object.prototype;
366
+ var objectProto$2 = Object.prototype;
626
367
 
627
368
  /**
628
369
  * Used to resolve the
629
370
  * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
630
371
  * of values.
631
372
  */
632
- var nativeObjectToString = objectProto$a.toString;
373
+ var nativeObjectToString = objectProto$2.toString;
633
374
 
634
375
  /**
635
376
  * Converts `value` to a string using `Object.prototype.toString`.
@@ -703,7 +444,7 @@ var isObject_1 = isObject;
703
444
 
704
445
  /** `Object#toString` result references. */
705
446
  var asyncTag = '[object AsyncFunction]',
706
- funcTag$1 = '[object Function]',
447
+ funcTag = '[object Function]',
707
448
  genTag = '[object GeneratorFunction]',
708
449
  proxyTag = '[object Proxy]';
709
450
 
@@ -731,7 +472,7 @@ function isFunction(value) {
731
472
  // The use of `Object#toString` avoids issues with the `typeof` operator
732
473
  // in Safari 9 which returns 'object' for typed arrays and other constructors.
733
474
  var tag = _baseGetTag(value);
734
- return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
475
+ return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
735
476
  }
736
477
 
737
478
  var isFunction_1 = isFunction;
@@ -798,17 +539,17 @@ var reIsHostCtor = /^\[object .+?Constructor\]$/;
798
539
 
799
540
  /** Used for built-in method references. */
800
541
  var funcProto = Function.prototype,
801
- objectProto$9 = Object.prototype;
542
+ objectProto$1 = Object.prototype;
802
543
 
803
544
  /** Used to resolve the decompiled source of functions. */
804
545
  var funcToString = funcProto.toString;
805
546
 
806
547
  /** Used to check objects for own properties. */
807
- var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
548
+ var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
808
549
 
809
550
  /** Used to detect if a method is native. */
810
551
  var reIsNative = RegExp('^' +
811
- funcToString.call(hasOwnProperty$7).replace(reRegExpChar, '\\$&')
552
+ funcToString.call(hasOwnProperty$1).replace(reRegExpChar, '\\$&')
812
553
  .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
813
554
  );
814
555
 
@@ -865,1104 +606,144 @@ var Map = _getNative(_root, 'Map');
865
606
  var _Map = Map;
866
607
 
867
608
  /* Built-in method references that are verified to be native. */
868
- var nativeCreate = _getNative(Object, 'create');
869
-
870
- var _nativeCreate = nativeCreate;
609
+ _getNative(Object, 'create');
871
610
 
872
611
  /**
873
- * Removes all key-value entries from the hash.
612
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
613
+ * and has a `typeof` result of "object".
874
614
  *
875
- * @private
876
- * @name clear
877
- * @memberOf Hash
878
- */
879
- function hashClear() {
880
- this.__data__ = _nativeCreate ? _nativeCreate(null) : {};
881
- this.size = 0;
882
- }
883
-
884
- var _hashClear = hashClear;
885
-
886
- /**
887
- * Removes `key` and its value from the hash.
615
+ * @static
616
+ * @memberOf _
617
+ * @since 4.0.0
618
+ * @category Lang
619
+ * @param {*} value The value to check.
620
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
621
+ * @example
888
622
  *
889
- * @private
890
- * @name delete
891
- * @memberOf Hash
892
- * @param {Object} hash The hash to modify.
893
- * @param {string} key The key of the value to remove.
894
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
623
+ * _.isObjectLike({});
624
+ * // => true
625
+ *
626
+ * _.isObjectLike([1, 2, 3]);
627
+ * // => true
628
+ *
629
+ * _.isObjectLike(_.noop);
630
+ * // => false
631
+ *
632
+ * _.isObjectLike(null);
633
+ * // => false
895
634
  */
896
- function hashDelete(key) {
897
- var result = this.has(key) && delete this.__data__[key];
898
- this.size -= result ? 1 : 0;
899
- return result;
635
+ function isObjectLike(value) {
636
+ return value != null && typeof value == 'object';
900
637
  }
901
638
 
902
- var _hashDelete = hashDelete;
903
-
904
- /** Used to stand-in for `undefined` hash values. */
905
- var HASH_UNDEFINED$2 = '__lodash_hash_undefined__';
906
-
907
- /** Used for built-in method references. */
908
- var objectProto$8 = Object.prototype;
639
+ var isObjectLike_1 = isObjectLike;
909
640
 
910
- /** Used to check objects for own properties. */
911
- var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
641
+ /** `Object#toString` result references. */
642
+ var argsTag = '[object Arguments]';
912
643
 
913
644
  /**
914
- * Gets the hash value for `key`.
645
+ * The base implementation of `_.isArguments`.
915
646
  *
916
647
  * @private
917
- * @name get
918
- * @memberOf Hash
919
- * @param {string} key The key of the value to get.
920
- * @returns {*} Returns the entry value.
648
+ * @param {*} value The value to check.
649
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
921
650
  */
922
- function hashGet(key) {
923
- var data = this.__data__;
924
- if (_nativeCreate) {
925
- var result = data[key];
926
- return result === HASH_UNDEFINED$2 ? undefined : result;
927
- }
928
- return hasOwnProperty$6.call(data, key) ? data[key] : undefined;
651
+ function baseIsArguments(value) {
652
+ return isObjectLike_1(value) && _baseGetTag(value) == argsTag;
929
653
  }
930
654
 
931
- var _hashGet = hashGet;
655
+ var _baseIsArguments = baseIsArguments;
932
656
 
933
657
  /** Used for built-in method references. */
934
- var objectProto$7 = Object.prototype;
658
+ var objectProto = Object.prototype;
935
659
 
936
660
  /** Used to check objects for own properties. */
937
- var hasOwnProperty$5 = objectProto$7.hasOwnProperty;
661
+ var hasOwnProperty = objectProto.hasOwnProperty;
662
+
663
+ /** Built-in value references. */
664
+ var propertyIsEnumerable = objectProto.propertyIsEnumerable;
938
665
 
939
666
  /**
940
- * Checks if a hash value for `key` exists.
667
+ * Checks if `value` is likely an `arguments` object.
941
668
  *
942
- * @private
943
- * @name has
944
- * @memberOf Hash
945
- * @param {string} key The key of the entry to check.
946
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
669
+ * @static
670
+ * @memberOf _
671
+ * @since 0.1.0
672
+ * @category Lang
673
+ * @param {*} value The value to check.
674
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
675
+ * else `false`.
676
+ * @example
677
+ *
678
+ * _.isArguments(function() { return arguments; }());
679
+ * // => true
680
+ *
681
+ * _.isArguments([1, 2, 3]);
682
+ * // => false
947
683
  */
948
- function hashHas(key) {
949
- var data = this.__data__;
950
- return _nativeCreate ? (data[key] !== undefined) : hasOwnProperty$5.call(data, key);
951
- }
952
-
953
- var _hashHas = hashHas;
954
-
955
- /** Used to stand-in for `undefined` hash values. */
956
- var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
684
+ _baseIsArguments(function() { return arguments; }()) ? _baseIsArguments : function(value) {
685
+ return isObjectLike_1(value) && hasOwnProperty.call(value, 'callee') &&
686
+ !propertyIsEnumerable.call(value, 'callee');
687
+ };
957
688
 
958
689
  /**
959
- * Sets the hash `key` to `value`.
690
+ * This method returns `false`.
960
691
  *
961
- * @private
962
- * @name set
963
- * @memberOf Hash
964
- * @param {string} key The key of the value to set.
965
- * @param {*} value The value to set.
966
- * @returns {Object} Returns the hash instance.
692
+ * @static
693
+ * @memberOf _
694
+ * @since 4.13.0
695
+ * @category Util
696
+ * @returns {boolean} Returns `false`.
697
+ * @example
698
+ *
699
+ * _.times(2, _.stubFalse);
700
+ * // => [false, false]
967
701
  */
968
- function hashSet(key, value) {
969
- var data = this.__data__;
970
- this.size += this.has(key) ? 0 : 1;
971
- data[key] = (_nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value;
972
- return this;
702
+ function stubFalse() {
703
+ return false;
973
704
  }
974
705
 
975
- var _hashSet = hashSet;
706
+ var stubFalse_1 = stubFalse;
976
707
 
977
- /**
978
- * Creates a hash object.
979
- *
980
- * @private
981
- * @constructor
982
- * @param {Array} [entries] The key-value pairs to cache.
983
- */
984
- function Hash(entries) {
985
- var index = -1,
986
- length = entries == null ? 0 : entries.length;
987
-
988
- this.clear();
989
- while (++index < length) {
990
- var entry = entries[index];
991
- this.set(entry[0], entry[1]);
992
- }
993
- }
708
+ createCommonjsModule(function (module, exports) {
709
+ /** Detect free variable `exports`. */
710
+ var freeExports = exports && !exports.nodeType && exports;
994
711
 
995
- // Add methods to `Hash`.
996
- Hash.prototype.clear = _hashClear;
997
- Hash.prototype['delete'] = _hashDelete;
998
- Hash.prototype.get = _hashGet;
999
- Hash.prototype.has = _hashHas;
1000
- Hash.prototype.set = _hashSet;
712
+ /** Detect free variable `module`. */
713
+ var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
1001
714
 
1002
- var _Hash = Hash;
715
+ /** Detect the popular CommonJS extension `module.exports`. */
716
+ var moduleExports = freeModule && freeModule.exports === freeExports;
1003
717
 
1004
- /**
1005
- * Removes all key-value entries from the map.
1006
- *
1007
- * @private
1008
- * @name clear
1009
- * @memberOf MapCache
1010
- */
1011
- function mapCacheClear() {
1012
- this.size = 0;
1013
- this.__data__ = {
1014
- 'hash': new _Hash,
1015
- 'map': new (_Map || _ListCache),
1016
- 'string': new _Hash
1017
- };
1018
- }
718
+ /** Built-in value references. */
719
+ var Buffer = moduleExports ? _root.Buffer : undefined;
1019
720
 
1020
- var _mapCacheClear = mapCacheClear;
721
+ /* Built-in method references for those with the same name as other `lodash` methods. */
722
+ var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
1021
723
 
1022
724
  /**
1023
- * Checks if `value` is suitable for use as unique object key.
725
+ * Checks if `value` is a buffer.
1024
726
  *
1025
- * @private
727
+ * @static
728
+ * @memberOf _
729
+ * @since 4.3.0
730
+ * @category Lang
1026
731
  * @param {*} value The value to check.
1027
- * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
1028
- */
1029
- function isKeyable(value) {
1030
- var type = typeof value;
1031
- return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
1032
- ? (value !== '__proto__')
1033
- : (value === null);
1034
- }
1035
-
1036
- var _isKeyable = isKeyable;
1037
-
1038
- /**
1039
- * Gets the data for `map`.
732
+ * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
733
+ * @example
1040
734
  *
1041
- * @private
1042
- * @param {Object} map The map to query.
1043
- * @param {string} key The reference key.
1044
- * @returns {*} Returns the map data.
735
+ * _.isBuffer(new Buffer(2));
736
+ * // => true
737
+ *
738
+ * _.isBuffer(new Uint8Array(2));
739
+ * // => false
1045
740
  */
1046
- function getMapData(map, key) {
1047
- var data = map.__data__;
1048
- return _isKeyable(key)
1049
- ? data[typeof key == 'string' ? 'string' : 'hash']
1050
- : data.map;
1051
- }
741
+ var isBuffer = nativeIsBuffer || stubFalse_1;
1052
742
 
1053
- var _getMapData = getMapData;
743
+ module.exports = isBuffer;
744
+ });
1054
745
 
1055
- /**
1056
- * Removes `key` and its value from the map.
1057
- *
1058
- * @private
1059
- * @name delete
1060
- * @memberOf MapCache
1061
- * @param {string} key The key of the value to remove.
1062
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1063
- */
1064
- function mapCacheDelete(key) {
1065
- var result = _getMapData(this, key)['delete'](key);
1066
- this.size -= result ? 1 : 0;
1067
- return result;
1068
- }
1069
-
1070
- var _mapCacheDelete = mapCacheDelete;
1071
-
1072
- /**
1073
- * Gets the map value for `key`.
1074
- *
1075
- * @private
1076
- * @name get
1077
- * @memberOf MapCache
1078
- * @param {string} key The key of the value to get.
1079
- * @returns {*} Returns the entry value.
1080
- */
1081
- function mapCacheGet(key) {
1082
- return _getMapData(this, key).get(key);
1083
- }
1084
-
1085
- var _mapCacheGet = mapCacheGet;
1086
-
1087
- /**
1088
- * Checks if a map value for `key` exists.
1089
- *
1090
- * @private
1091
- * @name has
1092
- * @memberOf MapCache
1093
- * @param {string} key The key of the entry to check.
1094
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1095
- */
1096
- function mapCacheHas(key) {
1097
- return _getMapData(this, key).has(key);
1098
- }
1099
-
1100
- var _mapCacheHas = mapCacheHas;
1101
-
1102
- /**
1103
- * Sets the map `key` to `value`.
1104
- *
1105
- * @private
1106
- * @name set
1107
- * @memberOf MapCache
1108
- * @param {string} key The key of the value to set.
1109
- * @param {*} value The value to set.
1110
- * @returns {Object} Returns the map cache instance.
1111
- */
1112
- function mapCacheSet(key, value) {
1113
- var data = _getMapData(this, key),
1114
- size = data.size;
1115
-
1116
- data.set(key, value);
1117
- this.size += data.size == size ? 0 : 1;
1118
- return this;
1119
- }
1120
-
1121
- var _mapCacheSet = mapCacheSet;
1122
-
1123
- /**
1124
- * Creates a map cache object to store key-value pairs.
1125
- *
1126
- * @private
1127
- * @constructor
1128
- * @param {Array} [entries] The key-value pairs to cache.
1129
- */
1130
- function MapCache(entries) {
1131
- var index = -1,
1132
- length = entries == null ? 0 : entries.length;
1133
-
1134
- this.clear();
1135
- while (++index < length) {
1136
- var entry = entries[index];
1137
- this.set(entry[0], entry[1]);
1138
- }
1139
- }
1140
-
1141
- // Add methods to `MapCache`.
1142
- MapCache.prototype.clear = _mapCacheClear;
1143
- MapCache.prototype['delete'] = _mapCacheDelete;
1144
- MapCache.prototype.get = _mapCacheGet;
1145
- MapCache.prototype.has = _mapCacheHas;
1146
- MapCache.prototype.set = _mapCacheSet;
1147
-
1148
- var _MapCache = MapCache;
1149
-
1150
- /** Used as the size to enable large array optimizations. */
1151
- var LARGE_ARRAY_SIZE = 200;
1152
-
1153
- /**
1154
- * Sets the stack `key` to `value`.
1155
- *
1156
- * @private
1157
- * @name set
1158
- * @memberOf Stack
1159
- * @param {string} key The key of the value to set.
1160
- * @param {*} value The value to set.
1161
- * @returns {Object} Returns the stack cache instance.
1162
- */
1163
- function stackSet(key, value) {
1164
- var data = this.__data__;
1165
- if (data instanceof _ListCache) {
1166
- var pairs = data.__data__;
1167
- if (!_Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
1168
- pairs.push([key, value]);
1169
- this.size = ++data.size;
1170
- return this;
1171
- }
1172
- data = this.__data__ = new _MapCache(pairs);
1173
- }
1174
- data.set(key, value);
1175
- this.size = data.size;
1176
- return this;
1177
- }
1178
-
1179
- var _stackSet = stackSet;
1180
-
1181
- /**
1182
- * Creates a stack cache object to store key-value pairs.
1183
- *
1184
- * @private
1185
- * @constructor
1186
- * @param {Array} [entries] The key-value pairs to cache.
1187
- */
1188
- function Stack(entries) {
1189
- var data = this.__data__ = new _ListCache(entries);
1190
- this.size = data.size;
1191
- }
1192
-
1193
- // Add methods to `Stack`.
1194
- Stack.prototype.clear = _stackClear;
1195
- Stack.prototype['delete'] = _stackDelete;
1196
- Stack.prototype.get = _stackGet;
1197
- Stack.prototype.has = _stackHas;
1198
- Stack.prototype.set = _stackSet;
1199
-
1200
- var _Stack = Stack;
1201
-
1202
- /** Used to stand-in for `undefined` hash values. */
1203
- var HASH_UNDEFINED = '__lodash_hash_undefined__';
1204
-
1205
- /**
1206
- * Adds `value` to the array cache.
1207
- *
1208
- * @private
1209
- * @name add
1210
- * @memberOf SetCache
1211
- * @alias push
1212
- * @param {*} value The value to cache.
1213
- * @returns {Object} Returns the cache instance.
1214
- */
1215
- function setCacheAdd(value) {
1216
- this.__data__.set(value, HASH_UNDEFINED);
1217
- return this;
1218
- }
1219
-
1220
- var _setCacheAdd = setCacheAdd;
1221
-
1222
- /**
1223
- * Checks if `value` is in the array cache.
1224
- *
1225
- * @private
1226
- * @name has
1227
- * @memberOf SetCache
1228
- * @param {*} value The value to search for.
1229
- * @returns {number} Returns `true` if `value` is found, else `false`.
1230
- */
1231
- function setCacheHas(value) {
1232
- return this.__data__.has(value);
1233
- }
1234
-
1235
- var _setCacheHas = setCacheHas;
1236
-
1237
- /**
1238
- *
1239
- * Creates an array cache object to store unique values.
1240
- *
1241
- * @private
1242
- * @constructor
1243
- * @param {Array} [values] The values to cache.
1244
- */
1245
- function SetCache(values) {
1246
- var index = -1,
1247
- length = values == null ? 0 : values.length;
1248
-
1249
- this.__data__ = new _MapCache;
1250
- while (++index < length) {
1251
- this.add(values[index]);
1252
- }
1253
- }
1254
-
1255
- // Add methods to `SetCache`.
1256
- SetCache.prototype.add = SetCache.prototype.push = _setCacheAdd;
1257
- SetCache.prototype.has = _setCacheHas;
1258
-
1259
- var _SetCache = SetCache;
1260
-
1261
- /**
1262
- * A specialized version of `_.some` for arrays without support for iteratee
1263
- * shorthands.
1264
- *
1265
- * @private
1266
- * @param {Array} [array] The array to iterate over.
1267
- * @param {Function} predicate The function invoked per iteration.
1268
- * @returns {boolean} Returns `true` if any element passes the predicate check,
1269
- * else `false`.
1270
- */
1271
- function arraySome(array, predicate) {
1272
- var index = -1,
1273
- length = array == null ? 0 : array.length;
1274
-
1275
- while (++index < length) {
1276
- if (predicate(array[index], index, array)) {
1277
- return true;
1278
- }
1279
- }
1280
- return false;
1281
- }
1282
-
1283
- var _arraySome = arraySome;
1284
-
1285
- /**
1286
- * Checks if a `cache` value for `key` exists.
1287
- *
1288
- * @private
1289
- * @param {Object} cache The cache to query.
1290
- * @param {string} key The key of the entry to check.
1291
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1292
- */
1293
- function cacheHas(cache, key) {
1294
- return cache.has(key);
1295
- }
1296
-
1297
- var _cacheHas = cacheHas;
1298
-
1299
- /** Used to compose bitmasks for value comparisons. */
1300
- var COMPARE_PARTIAL_FLAG$3 = 1,
1301
- COMPARE_UNORDERED_FLAG$1 = 2;
1302
-
1303
- /**
1304
- * A specialized version of `baseIsEqualDeep` for arrays with support for
1305
- * partial deep comparisons.
1306
- *
1307
- * @private
1308
- * @param {Array} array The array to compare.
1309
- * @param {Array} other The other array to compare.
1310
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1311
- * @param {Function} customizer The function to customize comparisons.
1312
- * @param {Function} equalFunc The function to determine equivalents of values.
1313
- * @param {Object} stack Tracks traversed `array` and `other` objects.
1314
- * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
1315
- */
1316
- function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
1317
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3,
1318
- arrLength = array.length,
1319
- othLength = other.length;
1320
-
1321
- if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
1322
- return false;
1323
- }
1324
- // Check that cyclic values are equal.
1325
- var arrStacked = stack.get(array);
1326
- var othStacked = stack.get(other);
1327
- if (arrStacked && othStacked) {
1328
- return arrStacked == other && othStacked == array;
1329
- }
1330
- var index = -1,
1331
- result = true,
1332
- seen = (bitmask & COMPARE_UNORDERED_FLAG$1) ? new _SetCache : undefined;
1333
-
1334
- stack.set(array, other);
1335
- stack.set(other, array);
1336
-
1337
- // Ignore non-index properties.
1338
- while (++index < arrLength) {
1339
- var arrValue = array[index],
1340
- othValue = other[index];
1341
-
1342
- if (customizer) {
1343
- var compared = isPartial
1344
- ? customizer(othValue, arrValue, index, other, array, stack)
1345
- : customizer(arrValue, othValue, index, array, other, stack);
1346
- }
1347
- if (compared !== undefined) {
1348
- if (compared) {
1349
- continue;
1350
- }
1351
- result = false;
1352
- break;
1353
- }
1354
- // Recursively compare arrays (susceptible to call stack limits).
1355
- if (seen) {
1356
- if (!_arraySome(other, function(othValue, othIndex) {
1357
- if (!_cacheHas(seen, othIndex) &&
1358
- (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
1359
- return seen.push(othIndex);
1360
- }
1361
- })) {
1362
- result = false;
1363
- break;
1364
- }
1365
- } else if (!(
1366
- arrValue === othValue ||
1367
- equalFunc(arrValue, othValue, bitmask, customizer, stack)
1368
- )) {
1369
- result = false;
1370
- break;
1371
- }
1372
- }
1373
- stack['delete'](array);
1374
- stack['delete'](other);
1375
- return result;
1376
- }
1377
-
1378
- var _equalArrays = equalArrays;
1379
-
1380
- /** Built-in value references. */
1381
- var Uint8Array$1 = _root.Uint8Array;
1382
-
1383
- var _Uint8Array = Uint8Array$1;
1384
-
1385
- /**
1386
- * Converts `map` to its key-value pairs.
1387
- *
1388
- * @private
1389
- * @param {Object} map The map to convert.
1390
- * @returns {Array} Returns the key-value pairs.
1391
- */
1392
- function mapToArray(map) {
1393
- var index = -1,
1394
- result = Array(map.size);
1395
-
1396
- map.forEach(function(value, key) {
1397
- result[++index] = [key, value];
1398
- });
1399
- return result;
1400
- }
1401
-
1402
- var _mapToArray = mapToArray;
1403
-
1404
- /**
1405
- * Converts `set` to an array of its values.
1406
- *
1407
- * @private
1408
- * @param {Object} set The set to convert.
1409
- * @returns {Array} Returns the values.
1410
- */
1411
- function setToArray(set) {
1412
- var index = -1,
1413
- result = Array(set.size);
1414
-
1415
- set.forEach(function(value) {
1416
- result[++index] = value;
1417
- });
1418
- return result;
1419
- }
1420
-
1421
- var _setToArray = setToArray;
1422
-
1423
- /** Used to compose bitmasks for value comparisons. */
1424
- var COMPARE_PARTIAL_FLAG$2 = 1,
1425
- COMPARE_UNORDERED_FLAG = 2;
1426
-
1427
- /** `Object#toString` result references. */
1428
- var boolTag$1 = '[object Boolean]',
1429
- dateTag$1 = '[object Date]',
1430
- errorTag$1 = '[object Error]',
1431
- mapTag$2 = '[object Map]',
1432
- numberTag$1 = '[object Number]',
1433
- regexpTag$1 = '[object RegExp]',
1434
- setTag$2 = '[object Set]',
1435
- stringTag$1 = '[object String]',
1436
- symbolTag = '[object Symbol]';
1437
-
1438
- var arrayBufferTag$1 = '[object ArrayBuffer]',
1439
- dataViewTag$2 = '[object DataView]';
1440
-
1441
- /** Used to convert symbols to primitives and strings. */
1442
- var symbolProto = _Symbol ? _Symbol.prototype : undefined,
1443
- symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
1444
-
1445
- /**
1446
- * A specialized version of `baseIsEqualDeep` for comparing objects of
1447
- * the same `toStringTag`.
1448
- *
1449
- * **Note:** This function only supports comparing values with tags of
1450
- * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
1451
- *
1452
- * @private
1453
- * @param {Object} object The object to compare.
1454
- * @param {Object} other The other object to compare.
1455
- * @param {string} tag The `toStringTag` of the objects to compare.
1456
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
1457
- * @param {Function} customizer The function to customize comparisons.
1458
- * @param {Function} equalFunc The function to determine equivalents of values.
1459
- * @param {Object} stack Tracks traversed `object` and `other` objects.
1460
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
1461
- */
1462
- function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
1463
- switch (tag) {
1464
- case dataViewTag$2:
1465
- if ((object.byteLength != other.byteLength) ||
1466
- (object.byteOffset != other.byteOffset)) {
1467
- return false;
1468
- }
1469
- object = object.buffer;
1470
- other = other.buffer;
1471
-
1472
- case arrayBufferTag$1:
1473
- if ((object.byteLength != other.byteLength) ||
1474
- !equalFunc(new _Uint8Array(object), new _Uint8Array(other))) {
1475
- return false;
1476
- }
1477
- return true;
1478
-
1479
- case boolTag$1:
1480
- case dateTag$1:
1481
- case numberTag$1:
1482
- // Coerce booleans to `1` or `0` and dates to milliseconds.
1483
- // Invalid dates are coerced to `NaN`.
1484
- return eq_1(+object, +other);
1485
-
1486
- case errorTag$1:
1487
- return object.name == other.name && object.message == other.message;
1488
-
1489
- case regexpTag$1:
1490
- case stringTag$1:
1491
- // Coerce regexes to strings and treat strings, primitives and objects,
1492
- // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
1493
- // for more details.
1494
- return object == (other + '');
1495
-
1496
- case mapTag$2:
1497
- var convert = _mapToArray;
1498
-
1499
- case setTag$2:
1500
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2;
1501
- convert || (convert = _setToArray);
1502
-
1503
- if (object.size != other.size && !isPartial) {
1504
- return false;
1505
- }
1506
- // Assume cyclic values are equal.
1507
- var stacked = stack.get(object);
1508
- if (stacked) {
1509
- return stacked == other;
1510
- }
1511
- bitmask |= COMPARE_UNORDERED_FLAG;
1512
-
1513
- // Recursively compare objects (susceptible to call stack limits).
1514
- stack.set(object, other);
1515
- var result = _equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
1516
- stack['delete'](object);
1517
- return result;
1518
-
1519
- case symbolTag:
1520
- if (symbolValueOf) {
1521
- return symbolValueOf.call(object) == symbolValueOf.call(other);
1522
- }
1523
- }
1524
- return false;
1525
- }
1526
-
1527
- var _equalByTag = equalByTag;
1528
-
1529
- /**
1530
- * Appends the elements of `values` to `array`.
1531
- *
1532
- * @private
1533
- * @param {Array} array The array to modify.
1534
- * @param {Array} values The values to append.
1535
- * @returns {Array} Returns `array`.
1536
- */
1537
- function arrayPush(array, values) {
1538
- var index = -1,
1539
- length = values.length,
1540
- offset = array.length;
1541
-
1542
- while (++index < length) {
1543
- array[offset + index] = values[index];
1544
- }
1545
- return array;
1546
- }
1547
-
1548
- var _arrayPush = arrayPush;
1549
-
1550
- /**
1551
- * Checks if `value` is classified as an `Array` object.
1552
- *
1553
- * @static
1554
- * @memberOf _
1555
- * @since 0.1.0
1556
- * @category Lang
1557
- * @param {*} value The value to check.
1558
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
1559
- * @example
1560
- *
1561
- * _.isArray([1, 2, 3]);
1562
- * // => true
1563
- *
1564
- * _.isArray(document.body.children);
1565
- * // => false
1566
- *
1567
- * _.isArray('abc');
1568
- * // => false
1569
- *
1570
- * _.isArray(_.noop);
1571
- * // => false
1572
- */
1573
- var isArray = Array.isArray;
1574
-
1575
- var isArray_1 = isArray;
1576
-
1577
- /**
1578
- * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
1579
- * `keysFunc` and `symbolsFunc` to get the enumerable property names and
1580
- * symbols of `object`.
1581
- *
1582
- * @private
1583
- * @param {Object} object The object to query.
1584
- * @param {Function} keysFunc The function to get the keys of `object`.
1585
- * @param {Function} symbolsFunc The function to get the symbols of `object`.
1586
- * @returns {Array} Returns the array of property names and symbols.
1587
- */
1588
- function baseGetAllKeys(object, keysFunc, symbolsFunc) {
1589
- var result = keysFunc(object);
1590
- return isArray_1(object) ? result : _arrayPush(result, symbolsFunc(object));
1591
- }
1592
-
1593
- var _baseGetAllKeys = baseGetAllKeys;
1594
-
1595
- /**
1596
- * A specialized version of `_.filter` for arrays without support for
1597
- * iteratee shorthands.
1598
- *
1599
- * @private
1600
- * @param {Array} [array] The array to iterate over.
1601
- * @param {Function} predicate The function invoked per iteration.
1602
- * @returns {Array} Returns the new filtered array.
1603
- */
1604
- function arrayFilter(array, predicate) {
1605
- var index = -1,
1606
- length = array == null ? 0 : array.length,
1607
- resIndex = 0,
1608
- result = [];
1609
-
1610
- while (++index < length) {
1611
- var value = array[index];
1612
- if (predicate(value, index, array)) {
1613
- result[resIndex++] = value;
1614
- }
1615
- }
1616
- return result;
1617
- }
1618
-
1619
- var _arrayFilter = arrayFilter;
1620
-
1621
- /**
1622
- * This method returns a new empty array.
1623
- *
1624
- * @static
1625
- * @memberOf _
1626
- * @since 4.13.0
1627
- * @category Util
1628
- * @returns {Array} Returns the new empty array.
1629
- * @example
1630
- *
1631
- * var arrays = _.times(2, _.stubArray);
1632
- *
1633
- * console.log(arrays);
1634
- * // => [[], []]
1635
- *
1636
- * console.log(arrays[0] === arrays[1]);
1637
- * // => false
1638
- */
1639
- function stubArray() {
1640
- return [];
1641
- }
1642
-
1643
- var stubArray_1 = stubArray;
1644
-
1645
- /** Used for built-in method references. */
1646
- var objectProto$6 = Object.prototype;
1647
-
1648
- /** Built-in value references. */
1649
- var propertyIsEnumerable$1 = objectProto$6.propertyIsEnumerable;
1650
-
1651
- /* Built-in method references for those with the same name as other `lodash` methods. */
1652
- var nativeGetSymbols = Object.getOwnPropertySymbols;
1653
-
1654
- /**
1655
- * Creates an array of the own enumerable symbols of `object`.
1656
- *
1657
- * @private
1658
- * @param {Object} object The object to query.
1659
- * @returns {Array} Returns the array of symbols.
1660
- */
1661
- var getSymbols = !nativeGetSymbols ? stubArray_1 : function(object) {
1662
- if (object == null) {
1663
- return [];
1664
- }
1665
- object = Object(object);
1666
- return _arrayFilter(nativeGetSymbols(object), function(symbol) {
1667
- return propertyIsEnumerable$1.call(object, symbol);
1668
- });
1669
- };
1670
-
1671
- var _getSymbols = getSymbols;
1672
-
1673
- /**
1674
- * The base implementation of `_.times` without support for iteratee shorthands
1675
- * or max array length checks.
1676
- *
1677
- * @private
1678
- * @param {number} n The number of times to invoke `iteratee`.
1679
- * @param {Function} iteratee The function invoked per iteration.
1680
- * @returns {Array} Returns the array of results.
1681
- */
1682
- function baseTimes(n, iteratee) {
1683
- var index = -1,
1684
- result = Array(n);
1685
-
1686
- while (++index < n) {
1687
- result[index] = iteratee(index);
1688
- }
1689
- return result;
1690
- }
1691
-
1692
- var _baseTimes = baseTimes;
1693
-
1694
- /**
1695
- * Checks if `value` is object-like. A value is object-like if it's not `null`
1696
- * and has a `typeof` result of "object".
1697
- *
1698
- * @static
1699
- * @memberOf _
1700
- * @since 4.0.0
1701
- * @category Lang
1702
- * @param {*} value The value to check.
1703
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
1704
- * @example
1705
- *
1706
- * _.isObjectLike({});
1707
- * // => true
1708
- *
1709
- * _.isObjectLike([1, 2, 3]);
1710
- * // => true
1711
- *
1712
- * _.isObjectLike(_.noop);
1713
- * // => false
1714
- *
1715
- * _.isObjectLike(null);
1716
- * // => false
1717
- */
1718
- function isObjectLike(value) {
1719
- return value != null && typeof value == 'object';
1720
- }
1721
-
1722
- var isObjectLike_1 = isObjectLike;
1723
-
1724
- /** `Object#toString` result references. */
1725
- var argsTag$2 = '[object Arguments]';
1726
-
1727
- /**
1728
- * The base implementation of `_.isArguments`.
1729
- *
1730
- * @private
1731
- * @param {*} value The value to check.
1732
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1733
- */
1734
- function baseIsArguments(value) {
1735
- return isObjectLike_1(value) && _baseGetTag(value) == argsTag$2;
1736
- }
1737
-
1738
- var _baseIsArguments = baseIsArguments;
1739
-
1740
- /** Used for built-in method references. */
1741
- var objectProto$5 = Object.prototype;
1742
-
1743
- /** Used to check objects for own properties. */
1744
- var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
1745
-
1746
- /** Built-in value references. */
1747
- var propertyIsEnumerable = objectProto$5.propertyIsEnumerable;
1748
-
1749
- /**
1750
- * Checks if `value` is likely an `arguments` object.
1751
- *
1752
- * @static
1753
- * @memberOf _
1754
- * @since 0.1.0
1755
- * @category Lang
1756
- * @param {*} value The value to check.
1757
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1758
- * else `false`.
1759
- * @example
1760
- *
1761
- * _.isArguments(function() { return arguments; }());
1762
- * // => true
1763
- *
1764
- * _.isArguments([1, 2, 3]);
1765
- * // => false
1766
- */
1767
- var isArguments = _baseIsArguments(function() { return arguments; }()) ? _baseIsArguments : function(value) {
1768
- return isObjectLike_1(value) && hasOwnProperty$4.call(value, 'callee') &&
1769
- !propertyIsEnumerable.call(value, 'callee');
1770
- };
1771
-
1772
- var isArguments_1 = isArguments;
1773
-
1774
- /**
1775
- * This method returns `false`.
1776
- *
1777
- * @static
1778
- * @memberOf _
1779
- * @since 4.13.0
1780
- * @category Util
1781
- * @returns {boolean} Returns `false`.
1782
- * @example
1783
- *
1784
- * _.times(2, _.stubFalse);
1785
- * // => [false, false]
1786
- */
1787
- function stubFalse() {
1788
- return false;
1789
- }
1790
-
1791
- var stubFalse_1 = stubFalse;
1792
-
1793
- var isBuffer_1 = createCommonjsModule(function (module, exports) {
1794
- /** Detect free variable `exports`. */
1795
- var freeExports = exports && !exports.nodeType && exports;
1796
-
1797
- /** Detect free variable `module`. */
1798
- var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
1799
-
1800
- /** Detect the popular CommonJS extension `module.exports`. */
1801
- var moduleExports = freeModule && freeModule.exports === freeExports;
1802
-
1803
- /** Built-in value references. */
1804
- var Buffer = moduleExports ? _root.Buffer : undefined;
1805
-
1806
- /* Built-in method references for those with the same name as other `lodash` methods. */
1807
- var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
1808
-
1809
- /**
1810
- * Checks if `value` is a buffer.
1811
- *
1812
- * @static
1813
- * @memberOf _
1814
- * @since 4.3.0
1815
- * @category Lang
1816
- * @param {*} value The value to check.
1817
- * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
1818
- * @example
1819
- *
1820
- * _.isBuffer(new Buffer(2));
1821
- * // => true
1822
- *
1823
- * _.isBuffer(new Uint8Array(2));
1824
- * // => false
1825
- */
1826
- var isBuffer = nativeIsBuffer || stubFalse_1;
1827
-
1828
- module.exports = isBuffer;
1829
- });
1830
-
1831
- /** Used as references for various `Number` constants. */
1832
- var MAX_SAFE_INTEGER$1 = 9007199254740991;
1833
-
1834
- /** Used to detect unsigned integer values. */
1835
- var reIsUint = /^(?:0|[1-9]\d*)$/;
1836
-
1837
- /**
1838
- * Checks if `value` is a valid array-like index.
1839
- *
1840
- * @private
1841
- * @param {*} value The value to check.
1842
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
1843
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
1844
- */
1845
- function isIndex(value, length) {
1846
- var type = typeof value;
1847
- length = length == null ? MAX_SAFE_INTEGER$1 : length;
1848
-
1849
- return !!length &&
1850
- (type == 'number' ||
1851
- (type != 'symbol' && reIsUint.test(value))) &&
1852
- (value > -1 && value % 1 == 0 && value < length);
1853
- }
1854
-
1855
- var _isIndex = isIndex;
1856
-
1857
- /** Used as references for various `Number` constants. */
1858
- var MAX_SAFE_INTEGER = 9007199254740991;
1859
-
1860
- /**
1861
- * Checks if `value` is a valid array-like length.
1862
- *
1863
- * **Note:** This method is loosely based on
1864
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
1865
- *
1866
- * @static
1867
- * @memberOf _
1868
- * @since 4.0.0
1869
- * @category Lang
1870
- * @param {*} value The value to check.
1871
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
1872
- * @example
1873
- *
1874
- * _.isLength(3);
1875
- * // => true
1876
- *
1877
- * _.isLength(Number.MIN_VALUE);
1878
- * // => false
1879
- *
1880
- * _.isLength(Infinity);
1881
- * // => false
1882
- *
1883
- * _.isLength('3');
1884
- * // => false
1885
- */
1886
- function isLength(value) {
1887
- return typeof value == 'number' &&
1888
- value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
1889
- }
1890
-
1891
- var isLength_1 = isLength;
1892
-
1893
- /** `Object#toString` result references. */
1894
- var argsTag$1 = '[object Arguments]',
1895
- arrayTag$1 = '[object Array]',
1896
- boolTag = '[object Boolean]',
1897
- dateTag = '[object Date]',
1898
- errorTag = '[object Error]',
1899
- funcTag = '[object Function]',
1900
- mapTag$1 = '[object Map]',
1901
- numberTag = '[object Number]',
1902
- objectTag$2 = '[object Object]',
1903
- regexpTag = '[object RegExp]',
1904
- setTag$1 = '[object Set]',
1905
- stringTag = '[object String]',
1906
- weakMapTag$1 = '[object WeakMap]';
1907
-
1908
- var arrayBufferTag = '[object ArrayBuffer]',
1909
- dataViewTag$1 = '[object DataView]',
1910
- float32Tag = '[object Float32Array]',
1911
- float64Tag = '[object Float64Array]',
1912
- int8Tag = '[object Int8Array]',
1913
- int16Tag = '[object Int16Array]',
1914
- int32Tag = '[object Int32Array]',
1915
- uint8Tag = '[object Uint8Array]',
1916
- uint8ClampedTag = '[object Uint8ClampedArray]',
1917
- uint16Tag = '[object Uint16Array]',
1918
- uint32Tag = '[object Uint32Array]';
1919
-
1920
- /** Used to identify `toStringTag` values of typed arrays. */
1921
- var typedArrayTags = {};
1922
- typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
1923
- typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
1924
- typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
1925
- typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
1926
- typedArrayTags[uint32Tag] = true;
1927
- typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] =
1928
- typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
1929
- typedArrayTags[dataViewTag$1] = typedArrayTags[dateTag] =
1930
- typedArrayTags[errorTag] = typedArrayTags[funcTag] =
1931
- typedArrayTags[mapTag$1] = typedArrayTags[numberTag] =
1932
- typedArrayTags[objectTag$2] = typedArrayTags[regexpTag] =
1933
- typedArrayTags[setTag$1] = typedArrayTags[stringTag] =
1934
- typedArrayTags[weakMapTag$1] = false;
1935
-
1936
- /**
1937
- * The base implementation of `_.isTypedArray` without Node.js optimizations.
1938
- *
1939
- * @private
1940
- * @param {*} value The value to check.
1941
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1942
- */
1943
- function baseIsTypedArray(value) {
1944
- return isObjectLike_1(value) &&
1945
- isLength_1(value.length) && !!typedArrayTags[_baseGetTag(value)];
1946
- }
1947
-
1948
- var _baseIsTypedArray = baseIsTypedArray;
1949
-
1950
- /**
1951
- * The base implementation of `_.unary` without support for storing metadata.
1952
- *
1953
- * @private
1954
- * @param {Function} func The function to cap arguments for.
1955
- * @returns {Function} Returns the new capped function.
1956
- */
1957
- function baseUnary(func) {
1958
- return function(value) {
1959
- return func(value);
1960
- };
1961
- }
1962
-
1963
- var _baseUnary = baseUnary;
1964
-
1965
- var _nodeUtil = createCommonjsModule(function (module, exports) {
746
+ createCommonjsModule(function (module, exports) {
1966
747
  /** Detect free variable `exports`. */
1967
748
  var freeExports = exports && !exports.nodeType && exports;
1968
749
 
@@ -1993,308 +774,6 @@ var nodeUtil = (function() {
1993
774
  module.exports = nodeUtil;
1994
775
  });
1995
776
 
1996
- /* Node.js helper references. */
1997
- var nodeIsTypedArray = _nodeUtil && _nodeUtil.isTypedArray;
1998
-
1999
- /**
2000
- * Checks if `value` is classified as a typed array.
2001
- *
2002
- * @static
2003
- * @memberOf _
2004
- * @since 3.0.0
2005
- * @category Lang
2006
- * @param {*} value The value to check.
2007
- * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
2008
- * @example
2009
- *
2010
- * _.isTypedArray(new Uint8Array);
2011
- * // => true
2012
- *
2013
- * _.isTypedArray([]);
2014
- * // => false
2015
- */
2016
- var isTypedArray = nodeIsTypedArray ? _baseUnary(nodeIsTypedArray) : _baseIsTypedArray;
2017
-
2018
- var isTypedArray_1 = isTypedArray;
2019
-
2020
- /** Used for built-in method references. */
2021
- var objectProto$4 = Object.prototype;
2022
-
2023
- /** Used to check objects for own properties. */
2024
- var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
2025
-
2026
- /**
2027
- * Creates an array of the enumerable property names of the array-like `value`.
2028
- *
2029
- * @private
2030
- * @param {*} value The value to query.
2031
- * @param {boolean} inherited Specify returning inherited property names.
2032
- * @returns {Array} Returns the array of property names.
2033
- */
2034
- function arrayLikeKeys(value, inherited) {
2035
- var isArr = isArray_1(value),
2036
- isArg = !isArr && isArguments_1(value),
2037
- isBuff = !isArr && !isArg && isBuffer_1(value),
2038
- isType = !isArr && !isArg && !isBuff && isTypedArray_1(value),
2039
- skipIndexes = isArr || isArg || isBuff || isType,
2040
- result = skipIndexes ? _baseTimes(value.length, String) : [],
2041
- length = result.length;
2042
-
2043
- for (var key in value) {
2044
- if ((inherited || hasOwnProperty$3.call(value, key)) &&
2045
- !(skipIndexes && (
2046
- // Safari 9 has enumerable `arguments.length` in strict mode.
2047
- key == 'length' ||
2048
- // Node.js 0.10 has enumerable non-index properties on buffers.
2049
- (isBuff && (key == 'offset' || key == 'parent')) ||
2050
- // PhantomJS 2 has enumerable non-index properties on typed arrays.
2051
- (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
2052
- // Skip index properties.
2053
- _isIndex(key, length)
2054
- ))) {
2055
- result.push(key);
2056
- }
2057
- }
2058
- return result;
2059
- }
2060
-
2061
- var _arrayLikeKeys = arrayLikeKeys;
2062
-
2063
- /** Used for built-in method references. */
2064
- var objectProto$3 = Object.prototype;
2065
-
2066
- /**
2067
- * Checks if `value` is likely a prototype object.
2068
- *
2069
- * @private
2070
- * @param {*} value The value to check.
2071
- * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
2072
- */
2073
- function isPrototype(value) {
2074
- var Ctor = value && value.constructor,
2075
- proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$3;
2076
-
2077
- return value === proto;
2078
- }
2079
-
2080
- var _isPrototype = isPrototype;
2081
-
2082
- /**
2083
- * Creates a unary function that invokes `func` with its argument transformed.
2084
- *
2085
- * @private
2086
- * @param {Function} func The function to wrap.
2087
- * @param {Function} transform The argument transform.
2088
- * @returns {Function} Returns the new function.
2089
- */
2090
- function overArg(func, transform) {
2091
- return function(arg) {
2092
- return func(transform(arg));
2093
- };
2094
- }
2095
-
2096
- var _overArg = overArg;
2097
-
2098
- /* Built-in method references for those with the same name as other `lodash` methods. */
2099
- var nativeKeys = _overArg(Object.keys, Object);
2100
-
2101
- var _nativeKeys = nativeKeys;
2102
-
2103
- /** Used for built-in method references. */
2104
- var objectProto$2 = Object.prototype;
2105
-
2106
- /** Used to check objects for own properties. */
2107
- var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
2108
-
2109
- /**
2110
- * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
2111
- *
2112
- * @private
2113
- * @param {Object} object The object to query.
2114
- * @returns {Array} Returns the array of property names.
2115
- */
2116
- function baseKeys(object) {
2117
- if (!_isPrototype(object)) {
2118
- return _nativeKeys(object);
2119
- }
2120
- var result = [];
2121
- for (var key in Object(object)) {
2122
- if (hasOwnProperty$2.call(object, key) && key != 'constructor') {
2123
- result.push(key);
2124
- }
2125
- }
2126
- return result;
2127
- }
2128
-
2129
- var _baseKeys = baseKeys;
2130
-
2131
- /**
2132
- * Checks if `value` is array-like. A value is considered array-like if it's
2133
- * not a function and has a `value.length` that's an integer greater than or
2134
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
2135
- *
2136
- * @static
2137
- * @memberOf _
2138
- * @since 4.0.0
2139
- * @category Lang
2140
- * @param {*} value The value to check.
2141
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
2142
- * @example
2143
- *
2144
- * _.isArrayLike([1, 2, 3]);
2145
- * // => true
2146
- *
2147
- * _.isArrayLike(document.body.children);
2148
- * // => true
2149
- *
2150
- * _.isArrayLike('abc');
2151
- * // => true
2152
- *
2153
- * _.isArrayLike(_.noop);
2154
- * // => false
2155
- */
2156
- function isArrayLike(value) {
2157
- return value != null && isLength_1(value.length) && !isFunction_1(value);
2158
- }
2159
-
2160
- var isArrayLike_1 = isArrayLike;
2161
-
2162
- /**
2163
- * Creates an array of the own enumerable property names of `object`.
2164
- *
2165
- * **Note:** Non-object values are coerced to objects. See the
2166
- * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
2167
- * for more details.
2168
- *
2169
- * @static
2170
- * @since 0.1.0
2171
- * @memberOf _
2172
- * @category Object
2173
- * @param {Object} object The object to query.
2174
- * @returns {Array} Returns the array of property names.
2175
- * @example
2176
- *
2177
- * function Foo() {
2178
- * this.a = 1;
2179
- * this.b = 2;
2180
- * }
2181
- *
2182
- * Foo.prototype.c = 3;
2183
- *
2184
- * _.keys(new Foo);
2185
- * // => ['a', 'b'] (iteration order is not guaranteed)
2186
- *
2187
- * _.keys('hi');
2188
- * // => ['0', '1']
2189
- */
2190
- function keys(object) {
2191
- return isArrayLike_1(object) ? _arrayLikeKeys(object) : _baseKeys(object);
2192
- }
2193
-
2194
- var keys_1 = keys;
2195
-
2196
- /**
2197
- * Creates an array of own enumerable property names and symbols of `object`.
2198
- *
2199
- * @private
2200
- * @param {Object} object The object to query.
2201
- * @returns {Array} Returns the array of property names and symbols.
2202
- */
2203
- function getAllKeys(object) {
2204
- return _baseGetAllKeys(object, keys_1, _getSymbols);
2205
- }
2206
-
2207
- var _getAllKeys = getAllKeys;
2208
-
2209
- /** Used to compose bitmasks for value comparisons. */
2210
- var COMPARE_PARTIAL_FLAG$1 = 1;
2211
-
2212
- /** Used for built-in method references. */
2213
- var objectProto$1 = Object.prototype;
2214
-
2215
- /** Used to check objects for own properties. */
2216
- var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
2217
-
2218
- /**
2219
- * A specialized version of `baseIsEqualDeep` for objects with support for
2220
- * partial deep comparisons.
2221
- *
2222
- * @private
2223
- * @param {Object} object The object to compare.
2224
- * @param {Object} other The other object to compare.
2225
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
2226
- * @param {Function} customizer The function to customize comparisons.
2227
- * @param {Function} equalFunc The function to determine equivalents of values.
2228
- * @param {Object} stack Tracks traversed `object` and `other` objects.
2229
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
2230
- */
2231
- function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
2232
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1,
2233
- objProps = _getAllKeys(object),
2234
- objLength = objProps.length,
2235
- othProps = _getAllKeys(other),
2236
- othLength = othProps.length;
2237
-
2238
- if (objLength != othLength && !isPartial) {
2239
- return false;
2240
- }
2241
- var index = objLength;
2242
- while (index--) {
2243
- var key = objProps[index];
2244
- if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) {
2245
- return false;
2246
- }
2247
- }
2248
- // Check that cyclic values are equal.
2249
- var objStacked = stack.get(object);
2250
- var othStacked = stack.get(other);
2251
- if (objStacked && othStacked) {
2252
- return objStacked == other && othStacked == object;
2253
- }
2254
- var result = true;
2255
- stack.set(object, other);
2256
- stack.set(other, object);
2257
-
2258
- var skipCtor = isPartial;
2259
- while (++index < objLength) {
2260
- key = objProps[index];
2261
- var objValue = object[key],
2262
- othValue = other[key];
2263
-
2264
- if (customizer) {
2265
- var compared = isPartial
2266
- ? customizer(othValue, objValue, key, other, object, stack)
2267
- : customizer(objValue, othValue, key, object, other, stack);
2268
- }
2269
- // Recursively compare objects (susceptible to call stack limits).
2270
- if (!(compared === undefined
2271
- ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
2272
- : compared
2273
- )) {
2274
- result = false;
2275
- break;
2276
- }
2277
- skipCtor || (skipCtor = key == 'constructor');
2278
- }
2279
- if (result && !skipCtor) {
2280
- var objCtor = object.constructor,
2281
- othCtor = other.constructor;
2282
-
2283
- // Non `Object` object instances with different constructors are not equal.
2284
- if (objCtor != othCtor &&
2285
- ('constructor' in object && 'constructor' in other) &&
2286
- !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
2287
- typeof othCtor == 'function' && othCtor instanceof othCtor)) {
2288
- result = false;
2289
- }
2290
- }
2291
- stack['delete'](object);
2292
- stack['delete'](other);
2293
- return result;
2294
- }
2295
-
2296
- var _equalObjects = equalObjects;
2297
-
2298
777
  /* Built-in method references that are verified to be native. */
2299
778
  var DataView = _getNative(_root, 'DataView');
2300
779
 
@@ -2317,7 +796,7 @@ var _WeakMap = WeakMap;
2317
796
 
2318
797
  /** `Object#toString` result references. */
2319
798
  var mapTag = '[object Map]',
2320
- objectTag$1 = '[object Object]',
799
+ objectTag = '[object Object]',
2321
800
  promiseTag = '[object Promise]',
2322
801
  setTag = '[object Set]',
2323
802
  weakMapTag = '[object WeakMap]';
@@ -2348,7 +827,7 @@ if ((_DataView && getTag(new _DataView(new ArrayBuffer(1))) != dataViewTag) ||
2348
827
  (_WeakMap && getTag(new _WeakMap) != weakMapTag)) {
2349
828
  getTag = function(value) {
2350
829
  var result = _baseGetTag(value),
2351
- Ctor = result == objectTag$1 ? value.constructor : undefined,
830
+ Ctor = result == objectTag ? value.constructor : undefined,
2352
831
  ctorString = Ctor ? _toSource(Ctor) : '';
2353
832
 
2354
833
  if (ctorString) {
@@ -2364,143 +843,6 @@ if ((_DataView && getTag(new _DataView(new ArrayBuffer(1))) != dataViewTag) ||
2364
843
  };
2365
844
  }
2366
845
 
2367
- var _getTag = getTag;
2368
-
2369
- /** Used to compose bitmasks for value comparisons. */
2370
- var COMPARE_PARTIAL_FLAG = 1;
2371
-
2372
- /** `Object#toString` result references. */
2373
- var argsTag = '[object Arguments]',
2374
- arrayTag = '[object Array]',
2375
- objectTag = '[object Object]';
2376
-
2377
- /** Used for built-in method references. */
2378
- var objectProto = Object.prototype;
2379
-
2380
- /** Used to check objects for own properties. */
2381
- var hasOwnProperty = objectProto.hasOwnProperty;
2382
-
2383
- /**
2384
- * A specialized version of `baseIsEqual` for arrays and objects which performs
2385
- * deep comparisons and tracks traversed objects enabling objects with circular
2386
- * references to be compared.
2387
- *
2388
- * @private
2389
- * @param {Object} object The object to compare.
2390
- * @param {Object} other The other object to compare.
2391
- * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
2392
- * @param {Function} customizer The function to customize comparisons.
2393
- * @param {Function} equalFunc The function to determine equivalents of values.
2394
- * @param {Object} [stack] Tracks traversed `object` and `other` objects.
2395
- * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
2396
- */
2397
- function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
2398
- var objIsArr = isArray_1(object),
2399
- othIsArr = isArray_1(other),
2400
- objTag = objIsArr ? arrayTag : _getTag(object),
2401
- othTag = othIsArr ? arrayTag : _getTag(other);
2402
-
2403
- objTag = objTag == argsTag ? objectTag : objTag;
2404
- othTag = othTag == argsTag ? objectTag : othTag;
2405
-
2406
- var objIsObj = objTag == objectTag,
2407
- othIsObj = othTag == objectTag,
2408
- isSameTag = objTag == othTag;
2409
-
2410
- if (isSameTag && isBuffer_1(object)) {
2411
- if (!isBuffer_1(other)) {
2412
- return false;
2413
- }
2414
- objIsArr = true;
2415
- objIsObj = false;
2416
- }
2417
- if (isSameTag && !objIsObj) {
2418
- stack || (stack = new _Stack);
2419
- return (objIsArr || isTypedArray_1(object))
2420
- ? _equalArrays(object, other, bitmask, customizer, equalFunc, stack)
2421
- : _equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
2422
- }
2423
- if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
2424
- var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
2425
- othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
2426
-
2427
- if (objIsWrapped || othIsWrapped) {
2428
- var objUnwrapped = objIsWrapped ? object.value() : object,
2429
- othUnwrapped = othIsWrapped ? other.value() : other;
2430
-
2431
- stack || (stack = new _Stack);
2432
- return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
2433
- }
2434
- }
2435
- if (!isSameTag) {
2436
- return false;
2437
- }
2438
- stack || (stack = new _Stack);
2439
- return _equalObjects(object, other, bitmask, customizer, equalFunc, stack);
2440
- }
2441
-
2442
- var _baseIsEqualDeep = baseIsEqualDeep;
2443
-
2444
- /**
2445
- * The base implementation of `_.isEqual` which supports partial comparisons
2446
- * and tracks traversed objects.
2447
- *
2448
- * @private
2449
- * @param {*} value The value to compare.
2450
- * @param {*} other The other value to compare.
2451
- * @param {boolean} bitmask The bitmask flags.
2452
- * 1 - Unordered comparison
2453
- * 2 - Partial comparison
2454
- * @param {Function} [customizer] The function to customize comparisons.
2455
- * @param {Object} [stack] Tracks traversed `value` and `other` objects.
2456
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
2457
- */
2458
- function baseIsEqual(value, other, bitmask, customizer, stack) {
2459
- if (value === other) {
2460
- return true;
2461
- }
2462
- if (value == null || other == null || (!isObjectLike_1(value) && !isObjectLike_1(other))) {
2463
- return value !== value && other !== other;
2464
- }
2465
- return _baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
2466
- }
2467
-
2468
- var _baseIsEqual = baseIsEqual;
2469
-
2470
- /**
2471
- * Performs a deep comparison between two values to determine if they are
2472
- * equivalent.
2473
- *
2474
- * **Note:** This method supports comparing arrays, array buffers, booleans,
2475
- * date objects, error objects, maps, numbers, `Object` objects, regexes,
2476
- * sets, strings, symbols, and typed arrays. `Object` objects are compared
2477
- * by their own, not inherited, enumerable properties. Functions and DOM
2478
- * nodes are compared by strict equality, i.e. `===`.
2479
- *
2480
- * @static
2481
- * @memberOf _
2482
- * @since 0.1.0
2483
- * @category Lang
2484
- * @param {*} value The value to compare.
2485
- * @param {*} other The other value to compare.
2486
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
2487
- * @example
2488
- *
2489
- * var object = { 'a': 1 };
2490
- * var other = { 'a': 1 };
2491
- *
2492
- * _.isEqual(object, other);
2493
- * // => true
2494
- *
2495
- * object === other;
2496
- * // => false
2497
- */
2498
- function isEqual(value, other) {
2499
- return _baseIsEqual(value, other);
2500
- }
2501
-
2502
- var isEqual_1 = isEqual;
2503
-
2504
846
  const signPdfFile = async pdfSignature => {
2505
847
  const {
2506
848
  x,
@@ -2531,32 +873,38 @@ const signPdfFile = async pdfSignature => {
2531
873
  };
2532
874
 
2533
875
  const _excluded$1 = ["placeholder", "signature", "url", "width", "height", "padding", "filename", "defaultLocation", "onChange"];
2534
- const PDFSign = withLocale(/*#__PURE__*/forwardRef((_ref, ref) => {
2535
- let {
2536
- placeholder,
2537
- signature,
2538
- url,
2539
- width,
2540
- height,
2541
- padding,
2542
- filename = 'signed-document.pdf',
2543
- defaultLocation,
2544
- onChange
2545
- } = _ref,
2546
- props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
2547
- const [location, setLocation] = useState(Object.assign({}, defaultLocation));
2548
- const [pdfProps, setPdfProps] = useState(null);
2549
- const {
2550
- formatMessage
2551
- } = useIntl();
876
+ const PDFSignInner = /*#__PURE__*/forwardRef(({
877
+ size,
878
+ currentPage,
879
+ placeholder,
880
+ signature,
881
+ url,
882
+ width: _width = 200,
883
+ height: _height = 80,
884
+ padding,
885
+ filename: _filename = 'signed-document.pdf',
886
+ defaultLocation,
887
+ onChange
888
+ }, ref) => {
889
+ const initLocation = useMemo(() => {
890
+ return {
891
+ scaleX: 1,
892
+ scaleY: 1,
893
+ x: Math.round((size.width - _width) / 2),
894
+ y: Math.round((size.height - _height) / 2),
895
+ size: {
896
+ width: _width,
897
+ height: _height,
898
+ x: Math.round((size.width - _width) / 2),
899
+ y: Math.round((size.height - _height) / 2)
900
+ }
901
+ };
902
+ }, [size, _width, _height]);
903
+ const [location, setLocationOrigin] = useState(Object.assign({}, initLocation, defaultLocation));
904
+ const setLocation = useRefCallback(value => {
905
+ setLocationOrigin(Object.assign({}, initLocation, value));
906
+ });
2552
907
  const pdfSignature = useMemo(() => {
2553
- if (!pdfProps) {
2554
- return null;
2555
- }
2556
- const {
2557
- size,
2558
- currentPage
2559
- } = pdfProps;
2560
908
  const scaleX = size.width / size.originalWidth;
2561
909
  const scaleY = size.height / size.originalHeight;
2562
910
  const pdfX = Math.round(location.size.x / scaleX);
@@ -2573,15 +921,10 @@ const PDFSign = withLocale(/*#__PURE__*/forwardRef((_ref, ref) => {
2573
921
  height: signHeight,
2574
922
  signature,
2575
923
  url,
2576
- filename
924
+ filename: _filename
2577
925
  };
2578
- }, [pdfProps, location, signature, url, filename]);
926
+ }, [location, signature, url, _filename, size, currentPage]);
2579
927
  const signPdf = useCallback(async () => {
2580
- if (!pdfProps) {
2581
- throw new Error(formatMessage({
2582
- id: 'loadingError'
2583
- }));
2584
- }
2585
928
  return await signPdfFile(pdfSignature);
2586
929
  }, [pdfSignature]);
2587
930
  useImperativeHandle(ref, () => ({
@@ -2597,33 +940,48 @@ const PDFSign = withLocale(/*#__PURE__*/forwardRef((_ref, ref) => {
2597
940
  location
2598
941
  });
2599
942
  }, [pdfSignature, location, handlerChange]);
943
+ return /*#__PURE__*/jsx(LocationLayer, {
944
+ stageWidth: size.width,
945
+ stageHeight: size.height,
946
+ width: _width,
947
+ height: _height,
948
+ padding: padding,
949
+ placeholder: placeholder,
950
+ signature: signature,
951
+ value: location,
952
+ onChange: setLocation
953
+ });
954
+ });
955
+ const PDFSign = withLocale(/*#__PURE__*/forwardRef((_ref, ref) => {
956
+ let {
957
+ placeholder,
958
+ signature,
959
+ url,
960
+ width,
961
+ height,
962
+ padding,
963
+ filename = 'signed-document.pdf',
964
+ onChange
965
+ } = _ref,
966
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
2600
967
  return /*#__PURE__*/jsx(PDFViewer, _extends({}, props, {
2601
968
  url: url,
2602
969
  children: ({
2603
970
  size,
2604
971
  currentPage
2605
972
  }) => {
2606
- setTimeout(() => {
2607
- if (!isEqual_1({
2608
- size,
2609
- currentPage
2610
- }, pdfProps)) {
2611
- setPdfProps({
2612
- size,
2613
- currentPage
2614
- });
2615
- }
2616
- }, 0);
2617
- return /*#__PURE__*/jsx(LocationLayer, {
2618
- stageWidth: size.width,
2619
- stageHeight: size.height,
973
+ return /*#__PURE__*/jsx(PDFSignInner, {
974
+ ref: ref,
975
+ size: size,
976
+ currentPage: currentPage,
977
+ url: url,
978
+ filename: filename,
2620
979
  width: width,
2621
980
  height: height,
2622
981
  padding: padding,
2623
982
  placeholder: placeholder,
2624
983
  signature: signature,
2625
- value: location,
2626
- onChange: setLocation
984
+ onChange: onChange
2627
985
  });
2628
986
  }
2629
987
  }));