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