immutable 4.0.0-rc.10 → 4.0.0-rc.15

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/immutable.js CHANGED
@@ -1,17 +1,32 @@
1
1
  /**
2
- * Copyright (c) 2014-present, Facebook, Inc.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2014-present, Lee Byron and other contributors.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
6
23
  */
7
-
8
24
  (function (global, factory) {
9
25
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
10
26
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
11
- (factory((global.Immutable = {})));
27
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Immutable = {}));
12
28
  }(this, (function (exports) { 'use strict';
13
29
 
14
- // Used for setting prototype methods that IE8 chokes on.
15
30
  var DELETE = 'delete';
16
31
 
17
32
  // Constants describing the size of trie nodes.
@@ -90,12 +105,12 @@
90
105
  return index === undefined
91
106
  ? defaultIndex
92
107
  : isNeg(index)
93
- ? size === Infinity
94
- ? size
95
- : Math.max(0, size + index) | 0
96
- : size === undefined || size === index
97
- ? index
98
- : Math.min(size, index) | 0;
108
+ ? size === Infinity
109
+ ? size
110
+ : Math.max(0, size + index) | 0
111
+ : size === undefined || size === index
112
+ ? index
113
+ : Math.min(size, index) | 0;
99
114
  }
100
115
 
101
116
  function isNeg(value) {
@@ -103,7 +118,6 @@
103
118
  return value < 0 || (value === 0 && 1 / value === -Infinity);
104
119
  }
105
120
 
106
- // Note: value is unchanged to not break immutable-devtools.
107
121
  var IS_COLLECTION_SYMBOL = '@@__IMMUTABLE_ITERABLE__@@';
108
122
 
109
123
  function isCollection(maybeCollection) {
@@ -130,7 +144,7 @@
130
144
  return isCollection(value) ? value : Seq(value);
131
145
  };
132
146
 
133
- var KeyedCollection = (function (Collection) {
147
+ var KeyedCollection = /*@__PURE__*/(function (Collection) {
134
148
  function KeyedCollection(value) {
135
149
  return isKeyed(value) ? value : KeyedSeq(value);
136
150
  }
@@ -142,7 +156,7 @@
142
156
  return KeyedCollection;
143
157
  }(Collection));
144
158
 
145
- var IndexedCollection = (function (Collection) {
159
+ var IndexedCollection = /*@__PURE__*/(function (Collection) {
146
160
  function IndexedCollection(value) {
147
161
  return isIndexed(value) ? value : IndexedSeq(value);
148
162
  }
@@ -154,7 +168,7 @@
154
168
  return IndexedCollection;
155
169
  }(Collection));
156
170
 
157
- var SetCollection = (function (Collection) {
171
+ var SetCollection = /*@__PURE__*/(function (Collection) {
158
172
  function SetCollection(value) {
159
173
  return isCollection(value) && !isAssociative(value) ? value : SetSeq(value);
160
174
  }
@@ -213,10 +227,10 @@
213
227
  Iterator.VALUES = ITERATE_VALUES;
214
228
  Iterator.ENTRIES = ITERATE_ENTRIES;
215
229
 
216
- Iterator.prototype.inspect = Iterator.prototype.toSource = function() {
230
+ Iterator.prototype.inspect = Iterator.prototype.toSource = function () {
217
231
  return this.toString();
218
232
  };
219
- Iterator.prototype[ITERATOR_SYMBOL] = function() {
233
+ Iterator.prototype[ITERATOR_SYMBOL] = function () {
220
234
  return this;
221
235
  };
222
236
 
@@ -236,6 +250,11 @@
236
250
  }
237
251
 
238
252
  function hasIterator(maybeIterable) {
253
+ if (Array.isArray(maybeIterable)) {
254
+ // IE11 trick as it does not support `Symbol.iterator`
255
+ return true;
256
+ }
257
+
239
258
  return !!getIteratorFn(maybeIterable);
240
259
  }
241
260
 
@@ -258,6 +277,16 @@
258
277
  }
259
278
  }
260
279
 
280
+ function isEntriesIterable(maybeIterable) {
281
+ var iteratorFn = getIteratorFn(maybeIterable);
282
+ return iteratorFn && iteratorFn === maybeIterable.entries;
283
+ }
284
+
285
+ function isKeysIterable(maybeIterable) {
286
+ var iteratorFn = getIteratorFn(maybeIterable);
287
+ return iteratorFn && iteratorFn === maybeIterable.keys;
288
+ }
289
+
261
290
  var hasOwnProperty = Object.prototype.hasOwnProperty;
262
291
 
263
292
  function isArrayLike(value) {
@@ -279,17 +308,17 @@
279
308
  );
280
309
  }
281
310
 
282
- var Seq = (function (Collection$$1) {
311
+ var Seq = /*@__PURE__*/(function (Collection) {
283
312
  function Seq(value) {
284
313
  return value === null || value === undefined
285
314
  ? emptySequence()
286
315
  : isImmutable(value)
287
- ? value.toSeq()
288
- : seqFromValue(value);
316
+ ? value.toSeq()
317
+ : seqFromValue(value);
289
318
  }
290
319
 
291
- if ( Collection$$1 ) Seq.__proto__ = Collection$$1;
292
- Seq.prototype = Object.create( Collection$$1 && Collection$$1.prototype );
320
+ if ( Collection ) Seq.__proto__ = Collection;
321
+ Seq.prototype = Object.create( Collection && Collection.prototype );
293
322
  Seq.prototype.constructor = Seq;
294
323
 
295
324
  Seq.prototype.toSeq = function toSeq () {
@@ -311,15 +340,13 @@
311
340
  // abstract __iterateUncached(fn, reverse)
312
341
 
313
342
  Seq.prototype.__iterate = function __iterate (fn, reverse) {
314
- var this$1 = this;
315
-
316
343
  var cache = this._cache;
317
344
  if (cache) {
318
345
  var size = cache.length;
319
346
  var i = 0;
320
347
  while (i !== size) {
321
348
  var entry = cache[reverse ? size - ++i : i++];
322
- if (fn(entry[1], entry[0], this$1) === false) {
349
+ if (fn(entry[1], entry[0], this) === false) {
323
350
  break;
324
351
  }
325
352
  }
@@ -349,17 +376,17 @@
349
376
  return Seq;
350
377
  }(Collection));
351
378
 
352
- var KeyedSeq = (function (Seq) {
379
+ var KeyedSeq = /*@__PURE__*/(function (Seq) {
353
380
  function KeyedSeq(value) {
354
381
  return value === null || value === undefined
355
382
  ? emptySequence().toKeyedSeq()
356
383
  : isCollection(value)
357
- ? isKeyed(value)
358
- ? value.toSeq()
359
- : value.fromEntrySeq()
360
- : isRecord(value)
361
- ? value.toSeq()
362
- : keyedSeqFromValue(value);
384
+ ? isKeyed(value)
385
+ ? value.toSeq()
386
+ : value.fromEntrySeq()
387
+ : isRecord(value)
388
+ ? value.toSeq()
389
+ : keyedSeqFromValue(value);
363
390
  }
364
391
 
365
392
  if ( Seq ) KeyedSeq.__proto__ = Seq;
@@ -373,17 +400,17 @@
373
400
  return KeyedSeq;
374
401
  }(Seq));
375
402
 
376
- var IndexedSeq = (function (Seq) {
403
+ var IndexedSeq = /*@__PURE__*/(function (Seq) {
377
404
  function IndexedSeq(value) {
378
405
  return value === null || value === undefined
379
406
  ? emptySequence()
380
407
  : isCollection(value)
381
- ? isKeyed(value)
382
- ? value.entrySeq()
383
- : value.toIndexedSeq()
384
- : isRecord(value)
385
- ? value.toSeq().entrySeq()
386
- : indexedSeqFromValue(value);
408
+ ? isKeyed(value)
409
+ ? value.entrySeq()
410
+ : value.toIndexedSeq()
411
+ : isRecord(value)
412
+ ? value.toSeq().entrySeq()
413
+ : indexedSeqFromValue(value);
387
414
  }
388
415
 
389
416
  if ( Seq ) IndexedSeq.__proto__ = Seq;
@@ -405,11 +432,10 @@
405
432
  return IndexedSeq;
406
433
  }(Seq));
407
434
 
408
- var SetSeq = (function (Seq) {
435
+ var SetSeq = /*@__PURE__*/(function (Seq) {
409
436
  function SetSeq(value) {
410
- return (isCollection(value) && !isAssociative(value)
411
- ? value
412
- : IndexedSeq(value)
437
+ return (
438
+ isCollection(value) && !isAssociative(value) ? value : IndexedSeq(value)
413
439
  ).toSetSeq();
414
440
  }
415
441
 
@@ -437,7 +463,7 @@
437
463
 
438
464
  // #pragma Root Sequences
439
465
 
440
- var ArraySeq = (function (IndexedSeq) {
466
+ var ArraySeq = /*@__PURE__*/(function (IndexedSeq) {
441
467
  function ArraySeq(array) {
442
468
  this._array = array;
443
469
  this.size = array.length;
@@ -452,14 +478,12 @@
452
478
  };
453
479
 
454
480
  ArraySeq.prototype.__iterate = function __iterate (fn, reverse) {
455
- var this$1 = this;
456
-
457
481
  var array = this._array;
458
482
  var size = array.length;
459
483
  var i = 0;
460
484
  while (i !== size) {
461
485
  var ii = reverse ? size - ++i : i++;
462
- if (fn(array[ii], ii, this$1) === false) {
486
+ if (fn(array[ii], ii, this) === false) {
463
487
  break;
464
488
  }
465
489
  }
@@ -482,7 +506,7 @@
482
506
  return ArraySeq;
483
507
  }(IndexedSeq));
484
508
 
485
- var ObjectSeq = (function (KeyedSeq) {
509
+ var ObjectSeq = /*@__PURE__*/(function (KeyedSeq) {
486
510
  function ObjectSeq(object) {
487
511
  var keys = Object.keys(object);
488
512
  this._object = object;
@@ -506,15 +530,13 @@
506
530
  };
507
531
 
508
532
  ObjectSeq.prototype.__iterate = function __iterate (fn, reverse) {
509
- var this$1 = this;
510
-
511
533
  var object = this._object;
512
534
  var keys = this._keys;
513
535
  var size = keys.length;
514
536
  var i = 0;
515
537
  while (i !== size) {
516
538
  var key = keys[reverse ? size - ++i : i++];
517
- if (fn(object[key], key, this$1) === false) {
539
+ if (fn(object[key], key, this) === false) {
518
540
  break;
519
541
  }
520
542
  }
@@ -539,7 +561,7 @@
539
561
  }(KeyedSeq));
540
562
  ObjectSeq.prototype[IS_ORDERED_SYMBOL] = true;
541
563
 
542
- var CollectionSeq = (function (IndexedSeq) {
564
+ var CollectionSeq = /*@__PURE__*/(function (IndexedSeq) {
543
565
  function CollectionSeq(collection) {
544
566
  this._collection = collection;
545
567
  this.size = collection.length || collection.size;
@@ -550,8 +572,6 @@
550
572
  CollectionSeq.prototype.constructor = CollectionSeq;
551
573
 
552
574
  CollectionSeq.prototype.__iterateUncached = function __iterateUncached (fn, reverse) {
553
- var this$1 = this;
554
-
555
575
  if (reverse) {
556
576
  return this.cacheResult().__iterate(fn, reverse);
557
577
  }
@@ -561,7 +581,7 @@
561
581
  if (isIterator(iterator)) {
562
582
  var step;
563
583
  while (!(step = iterator.next()).done) {
564
- if (fn(step.value, iterations++, this$1) === false) {
584
+ if (fn(step.value, iterations++, this) === false) {
565
585
  break;
566
586
  }
567
587
  }
@@ -597,11 +617,7 @@
597
617
  }
598
618
 
599
619
  function keyedSeqFromValue(value) {
600
- var seq = Array.isArray(value)
601
- ? new ArraySeq(value)
602
- : hasIterator(value)
603
- ? new CollectionSeq(value)
604
- : undefined;
620
+ var seq = maybeIndexedSeqFromValue(value);
605
621
  if (seq) {
606
622
  return seq.fromEntrySeq();
607
623
  }
@@ -627,7 +643,11 @@
627
643
  function seqFromValue(value) {
628
644
  var seq = maybeIndexedSeqFromValue(value);
629
645
  if (seq) {
630
- return seq;
646
+ return isEntriesIterable(value)
647
+ ? seq.fromEntrySeq()
648
+ : isKeysIterable(value)
649
+ ? seq.toSetSeq()
650
+ : seq;
631
651
  }
632
652
  if (typeof value === 'object') {
633
653
  return new ObjectSeq(value);
@@ -641,8 +661,8 @@
641
661
  return isArrayLike(value)
642
662
  ? new ArraySeq(value)
643
663
  : hasIterator(value)
644
- ? new CollectionSeq(value)
645
- : undefined;
664
+ ? new CollectionSeq(value)
665
+ : undefined;
646
666
  }
647
667
 
648
668
  var IS_MAP_SYMBOL = '@@__IMMUTABLE_MAP__@@';
@@ -764,50 +784,67 @@
764
784
  return ((i32 >>> 1) & 0x40000000) | (i32 & 0xbfffffff);
765
785
  }
766
786
 
787
+ var defaultValueOf = Object.prototype.valueOf;
788
+
767
789
  function hash(o) {
768
- if (o === false || o === null || o === undefined) {
769
- return 0;
770
- }
771
- if (typeof o.valueOf === 'function') {
772
- o = o.valueOf();
773
- if (o === false || o === null || o === undefined) {
774
- return 0;
775
- }
776
- }
777
- if (o === true) {
778
- return 1;
779
- }
780
- var type = typeof o;
781
- if (type === 'number') {
782
- if (o !== o || o === Infinity) {
783
- return 0;
784
- }
785
- var h = o | 0;
786
- if (h !== o) {
787
- h ^= o * 0xffffffff;
788
- }
789
- while (o > 0xffffffff) {
790
- o /= 0xffffffff;
791
- h ^= o;
792
- }
793
- return smi(h);
794
- }
795
- if (type === 'string') {
796
- return o.length > STRING_HASH_CACHE_MIN_STRLEN
797
- ? cachedHashString(o)
798
- : hashString(o);
790
+ if (o == null) {
791
+ return hashNullish(o);
799
792
  }
793
+
800
794
  if (typeof o.hashCode === 'function') {
801
795
  // Drop any high bits from accidentally long hash codes.
802
- return smi(o.hashCode());
796
+ return smi(o.hashCode(o));
797
+ }
798
+
799
+ var v = valueOf(o);
800
+
801
+ if (v == null) {
802
+ return hashNullish(v);
803
+ }
804
+
805
+ switch (typeof v) {
806
+ case 'boolean':
807
+ // The hash values for built-in constants are a 1 value for each 5-byte
808
+ // shift region expect for the first, which encodes the value. This
809
+ // reduces the odds of a hash collision for these common values.
810
+ return v ? 0x42108421 : 0x42108420;
811
+ case 'number':
812
+ return hashNumber(v);
813
+ case 'string':
814
+ return v.length > STRING_HASH_CACHE_MIN_STRLEN
815
+ ? cachedHashString(v)
816
+ : hashString(v);
817
+ case 'object':
818
+ case 'function':
819
+ return hashJSObj(v);
820
+ case 'symbol':
821
+ return hashSymbol(v);
822
+ default:
823
+ if (typeof v.toString === 'function') {
824
+ return hashString(v.toString());
825
+ }
826
+ throw new Error('Value type ' + typeof v + ' cannot be hashed.');
803
827
  }
804
- if (type === 'object' || type === 'function') {
805
- return hashJSObj(o);
828
+ }
829
+
830
+ function hashNullish(nullish) {
831
+ return nullish === null ? 0x42108422 : /* undefined */ 0x42108423;
832
+ }
833
+
834
+ // Compress arbitrarily large numbers into smi hashes.
835
+ function hashNumber(n) {
836
+ if (n !== n || n === Infinity) {
837
+ return 0;
838
+ }
839
+ var hash = n | 0;
840
+ if (hash !== n) {
841
+ hash ^= n * 0xffffffff;
806
842
  }
807
- if (typeof o.toString === 'function') {
808
- return hashString(o.toString());
843
+ while (n > 0xffffffff) {
844
+ n /= 0xffffffff;
845
+ hash ^= n;
809
846
  }
810
- throw new Error('Value type ' + type + ' cannot be hashed.');
847
+ return smi(hash);
811
848
  }
812
849
 
813
850
  function cachedHashString(string) {
@@ -839,6 +876,19 @@
839
876
  return smi(hashed);
840
877
  }
841
878
 
879
+ function hashSymbol(sym) {
880
+ var hashed = symbolMap[sym];
881
+ if (hashed !== undefined) {
882
+ return hashed;
883
+ }
884
+
885
+ hashed = nextHash();
886
+
887
+ symbolMap[sym] = hashed;
888
+
889
+ return hashed;
890
+ }
891
+
842
892
  function hashJSObj(obj) {
843
893
  var hashed;
844
894
  if (usingWeakMap) {
@@ -865,10 +915,7 @@
865
915
  }
866
916
  }
867
917
 
868
- hashed = ++objHashUID;
869
- if (objHashUID & 0x40000000) {
870
- objHashUID = 0;
871
- }
918
+ hashed = nextHash();
872
919
 
873
920
  if (usingWeakMap) {
874
921
  weakMap.set(obj, hashed);
@@ -889,7 +936,7 @@
889
936
  // we'll hijack one of the less-used non-enumerable properties to
890
937
  // save our hash on it. Since this is a function it will not show up in
891
938
  // `JSON.stringify` which is what we want.
892
- obj.propertyIsEnumerable = function() {
939
+ obj.propertyIsEnumerable = function () {
893
940
  return this.constructor.prototype.propertyIsEnumerable.apply(
894
941
  this,
895
942
  arguments
@@ -913,7 +960,7 @@
913
960
  var isExtensible = Object.isExtensible;
914
961
 
915
962
  // True if Object.defineProperty works as expected. IE8 fails this test.
916
- var canDefineProperty = (function() {
963
+ var canDefineProperty = (function () {
917
964
  try {
918
965
  Object.defineProperty({}, '@', {});
919
966
  return true;
@@ -935,6 +982,20 @@
935
982
  }
936
983
  }
937
984
 
985
+ function valueOf(obj) {
986
+ return obj.valueOf !== defaultValueOf && typeof obj.valueOf === 'function'
987
+ ? obj.valueOf(obj)
988
+ : obj;
989
+ }
990
+
991
+ function nextHash() {
992
+ var nextHash = ++_objHashUID;
993
+ if (_objHashUID & 0x40000000) {
994
+ _objHashUID = 0;
995
+ }
996
+ return nextHash;
997
+ }
998
+
938
999
  // If possible, use a WeakMap.
939
1000
  var usingWeakMap = typeof WeakMap === 'function';
940
1001
  var weakMap;
@@ -942,7 +1003,9 @@
942
1003
  weakMap = new WeakMap();
943
1004
  }
944
1005
 
945
- var objHashUID = 0;
1006
+ var symbolMap = Object.create(null);
1007
+
1008
+ var _objHashUID = 0;
946
1009
 
947
1010
  var UID_HASH_KEY = '__immutablehash__';
948
1011
  if (typeof Symbol === 'function') {
@@ -954,15 +1017,15 @@
954
1017
  var STRING_HASH_CACHE_SIZE = 0;
955
1018
  var stringHashCache = {};
956
1019
 
957
- var ToKeyedSequence = (function (KeyedSeq$$1) {
1020
+ var ToKeyedSequence = /*@__PURE__*/(function (KeyedSeq) {
958
1021
  function ToKeyedSequence(indexed, useKeys) {
959
1022
  this._iter = indexed;
960
1023
  this._useKeys = useKeys;
961
1024
  this.size = indexed.size;
962
1025
  }
963
1026
 
964
- if ( KeyedSeq$$1 ) ToKeyedSequence.__proto__ = KeyedSeq$$1;
965
- ToKeyedSequence.prototype = Object.create( KeyedSeq$$1 && KeyedSeq$$1.prototype );
1027
+ if ( KeyedSeq ) ToKeyedSequence.__proto__ = KeyedSeq;
1028
+ ToKeyedSequence.prototype = Object.create( KeyedSeq && KeyedSeq.prototype );
966
1029
  ToKeyedSequence.prototype.constructor = ToKeyedSequence;
967
1030
 
968
1031
  ToKeyedSequence.prototype.get = function get (key, notSetValue) {
@@ -978,29 +1041,29 @@
978
1041
  };
979
1042
 
980
1043
  ToKeyedSequence.prototype.reverse = function reverse () {
981
- var this$1 = this;
1044
+ var this$1$1 = this;
982
1045
 
983
1046
  var reversedSequence = reverseFactory(this, true);
984
1047
  if (!this._useKeys) {
985
- reversedSequence.valueSeq = function () { return this$1._iter.toSeq().reverse(); };
1048
+ reversedSequence.valueSeq = function () { return this$1$1._iter.toSeq().reverse(); };
986
1049
  }
987
1050
  return reversedSequence;
988
1051
  };
989
1052
 
990
1053
  ToKeyedSequence.prototype.map = function map (mapper, context) {
991
- var this$1 = this;
1054
+ var this$1$1 = this;
992
1055
 
993
1056
  var mappedSequence = mapFactory(this, mapper, context);
994
1057
  if (!this._useKeys) {
995
- mappedSequence.valueSeq = function () { return this$1._iter.toSeq().map(mapper, context); };
1058
+ mappedSequence.valueSeq = function () { return this$1$1._iter.toSeq().map(mapper, context); };
996
1059
  }
997
1060
  return mappedSequence;
998
1061
  };
999
1062
 
1000
1063
  ToKeyedSequence.prototype.__iterate = function __iterate (fn, reverse) {
1001
- var this$1 = this;
1064
+ var this$1$1 = this;
1002
1065
 
1003
- return this._iter.__iterate(function (v, k) { return fn(v, k, this$1); }, reverse);
1066
+ return this._iter.__iterate(function (v, k) { return fn(v, k, this$1$1); }, reverse);
1004
1067
  };
1005
1068
 
1006
1069
  ToKeyedSequence.prototype.__iterator = function __iterator (type, reverse) {
@@ -1011,14 +1074,14 @@
1011
1074
  }(KeyedSeq));
1012
1075
  ToKeyedSequence.prototype[IS_ORDERED_SYMBOL] = true;
1013
1076
 
1014
- var ToIndexedSequence = (function (IndexedSeq$$1) {
1077
+ var ToIndexedSequence = /*@__PURE__*/(function (IndexedSeq) {
1015
1078
  function ToIndexedSequence(iter) {
1016
1079
  this._iter = iter;
1017
1080
  this.size = iter.size;
1018
1081
  }
1019
1082
 
1020
- if ( IndexedSeq$$1 ) ToIndexedSequence.__proto__ = IndexedSeq$$1;
1021
- ToIndexedSequence.prototype = Object.create( IndexedSeq$$1 && IndexedSeq$$1.prototype );
1083
+ if ( IndexedSeq ) ToIndexedSequence.__proto__ = IndexedSeq;
1084
+ ToIndexedSequence.prototype = Object.create( IndexedSeq && IndexedSeq.prototype );
1022
1085
  ToIndexedSequence.prototype.constructor = ToIndexedSequence;
1023
1086
 
1024
1087
  ToIndexedSequence.prototype.includes = function includes (value) {
@@ -1026,18 +1089,18 @@
1026
1089
  };
1027
1090
 
1028
1091
  ToIndexedSequence.prototype.__iterate = function __iterate (fn, reverse) {
1029
- var this$1 = this;
1092
+ var this$1$1 = this;
1030
1093
 
1031
1094
  var i = 0;
1032
1095
  reverse && ensureSize(this);
1033
1096
  return this._iter.__iterate(
1034
- function (v) { return fn(v, reverse ? this$1.size - ++i : i++, this$1); },
1097
+ function (v) { return fn(v, reverse ? this$1$1.size - ++i : i++, this$1$1); },
1035
1098
  reverse
1036
1099
  );
1037
1100
  };
1038
1101
 
1039
1102
  ToIndexedSequence.prototype.__iterator = function __iterator (type, reverse) {
1040
- var this$1 = this;
1103
+ var this$1$1 = this;
1041
1104
 
1042
1105
  var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);
1043
1106
  var i = 0;
@@ -1048,7 +1111,7 @@
1048
1111
  ? step
1049
1112
  : iteratorValue(
1050
1113
  type,
1051
- reverse ? this$1.size - ++i : i++,
1114
+ reverse ? this$1$1.size - ++i : i++,
1052
1115
  step.value,
1053
1116
  step
1054
1117
  );
@@ -1058,14 +1121,14 @@
1058
1121
  return ToIndexedSequence;
1059
1122
  }(IndexedSeq));
1060
1123
 
1061
- var ToSetSequence = (function (SetSeq$$1) {
1124
+ var ToSetSequence = /*@__PURE__*/(function (SetSeq) {
1062
1125
  function ToSetSequence(iter) {
1063
1126
  this._iter = iter;
1064
1127
  this.size = iter.size;
1065
1128
  }
1066
1129
 
1067
- if ( SetSeq$$1 ) ToSetSequence.__proto__ = SetSeq$$1;
1068
- ToSetSequence.prototype = Object.create( SetSeq$$1 && SetSeq$$1.prototype );
1130
+ if ( SetSeq ) ToSetSequence.__proto__ = SetSeq;
1131
+ ToSetSequence.prototype = Object.create( SetSeq && SetSeq.prototype );
1069
1132
  ToSetSequence.prototype.constructor = ToSetSequence;
1070
1133
 
1071
1134
  ToSetSequence.prototype.has = function has (key) {
@@ -1073,9 +1136,9 @@
1073
1136
  };
1074
1137
 
1075
1138
  ToSetSequence.prototype.__iterate = function __iterate (fn, reverse) {
1076
- var this$1 = this;
1139
+ var this$1$1 = this;
1077
1140
 
1078
- return this._iter.__iterate(function (v) { return fn(v, v, this$1); }, reverse);
1141
+ return this._iter.__iterate(function (v) { return fn(v, v, this$1$1); }, reverse);
1079
1142
  };
1080
1143
 
1081
1144
  ToSetSequence.prototype.__iterator = function __iterator (type, reverse) {
@@ -1091,14 +1154,14 @@
1091
1154
  return ToSetSequence;
1092
1155
  }(SetSeq));
1093
1156
 
1094
- var FromEntriesSequence = (function (KeyedSeq$$1) {
1157
+ var FromEntriesSequence = /*@__PURE__*/(function (KeyedSeq) {
1095
1158
  function FromEntriesSequence(entries) {
1096
1159
  this._iter = entries;
1097
1160
  this.size = entries.size;
1098
1161
  }
1099
1162
 
1100
- if ( KeyedSeq$$1 ) FromEntriesSequence.__proto__ = KeyedSeq$$1;
1101
- FromEntriesSequence.prototype = Object.create( KeyedSeq$$1 && KeyedSeq$$1.prototype );
1163
+ if ( KeyedSeq ) FromEntriesSequence.__proto__ = KeyedSeq;
1164
+ FromEntriesSequence.prototype = Object.create( KeyedSeq && KeyedSeq.prototype );
1102
1165
  FromEntriesSequence.prototype.constructor = FromEntriesSequence;
1103
1166
 
1104
1167
  FromEntriesSequence.prototype.entrySeq = function entrySeq () {
@@ -1106,7 +1169,7 @@
1106
1169
  };
1107
1170
 
1108
1171
  FromEntriesSequence.prototype.__iterate = function __iterate (fn, reverse) {
1109
- var this$1 = this;
1172
+ var this$1$1 = this;
1110
1173
 
1111
1174
  return this._iter.__iterate(function (entry) {
1112
1175
  // Check if entry exists first so array access doesn't throw for holes
@@ -1117,7 +1180,7 @@
1117
1180
  return fn(
1118
1181
  indexedCollection ? entry.get(1) : entry[1],
1119
1182
  indexedCollection ? entry.get(0) : entry[0],
1120
- this$1
1183
+ this$1$1
1121
1184
  );
1122
1185
  }
1123
1186
  }, reverse);
@@ -1151,14 +1214,18 @@
1151
1214
  return FromEntriesSequence;
1152
1215
  }(KeyedSeq));
1153
1216
 
1154
- ToIndexedSequence.prototype.cacheResult = ToKeyedSequence.prototype.cacheResult = ToSetSequence.prototype.cacheResult = FromEntriesSequence.prototype.cacheResult = cacheResultThrough;
1217
+ ToIndexedSequence.prototype.cacheResult =
1218
+ ToKeyedSequence.prototype.cacheResult =
1219
+ ToSetSequence.prototype.cacheResult =
1220
+ FromEntriesSequence.prototype.cacheResult =
1221
+ cacheResultThrough;
1155
1222
 
1156
1223
  function flipFactory(collection) {
1157
1224
  var flipSequence = makeSequence(collection);
1158
1225
  flipSequence._iter = collection;
1159
1226
  flipSequence.size = collection.size;
1160
1227
  flipSequence.flip = function () { return collection; };
1161
- flipSequence.reverse = function() {
1228
+ flipSequence.reverse = function () {
1162
1229
  var reversedSequence = collection.reverse.apply(this); // super.reverse()
1163
1230
  reversedSequence.flip = function () { return collection.reverse(); };
1164
1231
  return reversedSequence;
@@ -1166,12 +1233,12 @@
1166
1233
  flipSequence.has = function (key) { return collection.includes(key); };
1167
1234
  flipSequence.includes = function (key) { return collection.has(key); };
1168
1235
  flipSequence.cacheResult = cacheResultThrough;
1169
- flipSequence.__iterateUncached = function(fn, reverse) {
1170
- var this$1 = this;
1236
+ flipSequence.__iterateUncached = function (fn, reverse) {
1237
+ var this$1$1 = this;
1171
1238
 
1172
- return collection.__iterate(function (v, k) { return fn(k, v, this$1) !== false; }, reverse);
1239
+ return collection.__iterate(function (v, k) { return fn(k, v, this$1$1) !== false; }, reverse);
1173
1240
  };
1174
- flipSequence.__iteratorUncached = function(type, reverse) {
1241
+ flipSequence.__iteratorUncached = function (type, reverse) {
1175
1242
  if (type === ITERATE_ENTRIES) {
1176
1243
  var iterator = collection.__iterator(type, reverse);
1177
1244
  return new Iterator(function () {
@@ -1202,15 +1269,15 @@
1202
1269
  ? notSetValue
1203
1270
  : mapper.call(context, v, key, collection);
1204
1271
  };
1205
- mappedSequence.__iterateUncached = function(fn, reverse) {
1206
- var this$1 = this;
1272
+ mappedSequence.__iterateUncached = function (fn, reverse) {
1273
+ var this$1$1 = this;
1207
1274
 
1208
1275
  return collection.__iterate(
1209
- function (v, k, c) { return fn(mapper.call(context, v, k, c), k, this$1) !== false; },
1276
+ function (v, k, c) { return fn(mapper.call(context, v, k, c), k, this$1$1) !== false; },
1210
1277
  reverse
1211
1278
  );
1212
1279
  };
1213
- mappedSequence.__iteratorUncached = function(type, reverse) {
1280
+ mappedSequence.__iteratorUncached = function (type, reverse) {
1214
1281
  var iterator = collection.__iterator(ITERATE_ENTRIES, reverse);
1215
1282
  return new Iterator(function () {
1216
1283
  var step = iterator.next();
@@ -1231,14 +1298,14 @@
1231
1298
  }
1232
1299
 
1233
1300
  function reverseFactory(collection, useKeys) {
1234
- var this$1 = this;
1301
+ var this$1$1 = this;
1235
1302
 
1236
1303
  var reversedSequence = makeSequence(collection);
1237
1304
  reversedSequence._iter = collection;
1238
1305
  reversedSequence.size = collection.size;
1239
1306
  reversedSequence.reverse = function () { return collection; };
1240
1307
  if (collection.flip) {
1241
- reversedSequence.flip = function() {
1308
+ reversedSequence.flip = function () {
1242
1309
  var flipSequence = flipFactory(collection);
1243
1310
  flipSequence.reverse = function () { return collection.flip(); };
1244
1311
  return flipSequence;
@@ -1248,13 +1315,13 @@
1248
1315
  reversedSequence.has = function (key) { return collection.has(useKeys ? key : -1 - key); };
1249
1316
  reversedSequence.includes = function (value) { return collection.includes(value); };
1250
1317
  reversedSequence.cacheResult = cacheResultThrough;
1251
- reversedSequence.__iterate = function(fn, reverse) {
1252
- var this$1 = this;
1318
+ reversedSequence.__iterate = function (fn, reverse) {
1319
+ var this$1$1 = this;
1253
1320
 
1254
1321
  var i = 0;
1255
1322
  reverse && ensureSize(collection);
1256
1323
  return collection.__iterate(
1257
- function (v, k) { return fn(v, useKeys ? k : reverse ? this$1.size - ++i : i++, this$1); },
1324
+ function (v, k) { return fn(v, useKeys ? k : reverse ? this$1$1.size - ++i : i++, this$1$1); },
1258
1325
  !reverse
1259
1326
  );
1260
1327
  };
@@ -1270,7 +1337,7 @@
1270
1337
  var entry = step.value;
1271
1338
  return iteratorValue(
1272
1339
  type,
1273
- useKeys ? entry[0] : reverse ? this$1.size - ++i : i++,
1340
+ useKeys ? entry[0] : reverse ? this$1$1.size - ++i : i++,
1274
1341
  entry[1],
1275
1342
  step
1276
1343
  );
@@ -1293,19 +1360,19 @@
1293
1360
  : notSetValue;
1294
1361
  };
1295
1362
  }
1296
- filterSequence.__iterateUncached = function(fn, reverse) {
1297
- var this$1 = this;
1363
+ filterSequence.__iterateUncached = function (fn, reverse) {
1364
+ var this$1$1 = this;
1298
1365
 
1299
1366
  var iterations = 0;
1300
1367
  collection.__iterate(function (v, k, c) {
1301
1368
  if (predicate.call(context, v, k, c)) {
1302
1369
  iterations++;
1303
- return fn(v, useKeys ? k : iterations - 1, this$1);
1370
+ return fn(v, useKeys ? k : iterations - 1, this$1$1);
1304
1371
  }
1305
1372
  }, reverse);
1306
1373
  return iterations;
1307
1374
  };
1308
- filterSequence.__iteratorUncached = function(type, reverse) {
1375
+ filterSequence.__iteratorUncached = function (type, reverse) {
1309
1376
  var iterator = collection.__iterator(ITERATE_ENTRIES, reverse);
1310
1377
  var iterations = 0;
1311
1378
  return new Iterator(function () {
@@ -1382,7 +1449,7 @@
1382
1449
  sliceSize === 0 ? sliceSize : (collection.size && sliceSize) || undefined;
1383
1450
 
1384
1451
  if (!useKeys && isSeq(collection) && sliceSize >= 0) {
1385
- sliceSeq.get = function(index, notSetValue) {
1452
+ sliceSeq.get = function (index, notSetValue) {
1386
1453
  index = wrapIndex(this, index);
1387
1454
  return index >= 0 && index < sliceSize
1388
1455
  ? collection.get(index + resolvedBegin, notSetValue)
@@ -1390,8 +1457,8 @@
1390
1457
  };
1391
1458
  }
1392
1459
 
1393
- sliceSeq.__iterateUncached = function(fn, reverse) {
1394
- var this$1 = this;
1460
+ sliceSeq.__iterateUncached = function (fn, reverse) {
1461
+ var this$1$1 = this;
1395
1462
 
1396
1463
  if (sliceSize === 0) {
1397
1464
  return 0;
@@ -1406,7 +1473,7 @@
1406
1473
  if (!(isSkipping && (isSkipping = skipped++ < resolvedBegin))) {
1407
1474
  iterations++;
1408
1475
  return (
1409
- fn(v, useKeys ? k : iterations - 1, this$1) !== false &&
1476
+ fn(v, useKeys ? k : iterations - 1, this$1$1) !== false &&
1410
1477
  iterations !== sliceSize
1411
1478
  );
1412
1479
  }
@@ -1414,7 +1481,7 @@
1414
1481
  return iterations;
1415
1482
  };
1416
1483
 
1417
- sliceSeq.__iteratorUncached = function(type, reverse) {
1484
+ sliceSeq.__iteratorUncached = function (type, reverse) {
1418
1485
  if (sliceSize !== 0 && reverse) {
1419
1486
  return this.cacheResult().__iterator(type, reverse);
1420
1487
  }
@@ -1448,20 +1515,20 @@
1448
1515
 
1449
1516
  function takeWhileFactory(collection, predicate, context) {
1450
1517
  var takeSequence = makeSequence(collection);
1451
- takeSequence.__iterateUncached = function(fn, reverse) {
1452
- var this$1 = this;
1518
+ takeSequence.__iterateUncached = function (fn, reverse) {
1519
+ var this$1$1 = this;
1453
1520
 
1454
1521
  if (reverse) {
1455
1522
  return this.cacheResult().__iterate(fn, reverse);
1456
1523
  }
1457
1524
  var iterations = 0;
1458
1525
  collection.__iterate(
1459
- function (v, k, c) { return predicate.call(context, v, k, c) && ++iterations && fn(v, k, this$1); }
1526
+ function (v, k, c) { return predicate.call(context, v, k, c) && ++iterations && fn(v, k, this$1$1); }
1460
1527
  );
1461
1528
  return iterations;
1462
1529
  };
1463
- takeSequence.__iteratorUncached = function(type, reverse) {
1464
- var this$1 = this;
1530
+ takeSequence.__iteratorUncached = function (type, reverse) {
1531
+ var this$1$1 = this;
1465
1532
 
1466
1533
  if (reverse) {
1467
1534
  return this.cacheResult().__iterator(type, reverse);
@@ -1479,7 +1546,7 @@
1479
1546
  var entry = step.value;
1480
1547
  var k = entry[0];
1481
1548
  var v = entry[1];
1482
- if (!predicate.call(context, v, k, this$1)) {
1549
+ if (!predicate.call(context, v, k, this$1$1)) {
1483
1550
  iterating = false;
1484
1551
  return iteratorDone();
1485
1552
  }
@@ -1491,8 +1558,8 @@
1491
1558
 
1492
1559
  function skipWhileFactory(collection, predicate, context, useKeys) {
1493
1560
  var skipSequence = makeSequence(collection);
1494
- skipSequence.__iterateUncached = function(fn, reverse) {
1495
- var this$1 = this;
1561
+ skipSequence.__iterateUncached = function (fn, reverse) {
1562
+ var this$1$1 = this;
1496
1563
 
1497
1564
  if (reverse) {
1498
1565
  return this.cacheResult().__iterate(fn, reverse);
@@ -1502,13 +1569,13 @@
1502
1569
  collection.__iterate(function (v, k, c) {
1503
1570
  if (!(isSkipping && (isSkipping = predicate.call(context, v, k, c)))) {
1504
1571
  iterations++;
1505
- return fn(v, useKeys ? k : iterations - 1, this$1);
1572
+ return fn(v, useKeys ? k : iterations - 1, this$1$1);
1506
1573
  }
1507
1574
  });
1508
1575
  return iterations;
1509
1576
  };
1510
- skipSequence.__iteratorUncached = function(type, reverse) {
1511
- var this$1 = this;
1577
+ skipSequence.__iteratorUncached = function (type, reverse) {
1578
+ var this$1$1 = this;
1512
1579
 
1513
1580
  if (reverse) {
1514
1581
  return this.cacheResult().__iterator(type, reverse);
@@ -1534,7 +1601,7 @@
1534
1601
  var entry = step.value;
1535
1602
  k = entry[0];
1536
1603
  v = entry[1];
1537
- skipping && (skipping = predicate.call(context, v, k, this$1));
1604
+ skipping && (skipping = predicate.call(context, v, k, this$1$1));
1538
1605
  } while (skipping);
1539
1606
  return type === ITERATE_ENTRIES ? step : iteratorValue(type, k, v, step);
1540
1607
  });
@@ -1593,7 +1660,7 @@
1593
1660
 
1594
1661
  function flattenFactory(collection, depth, useKeys) {
1595
1662
  var flatSequence = makeSequence(collection);
1596
- flatSequence.__iterateUncached = function(fn, reverse) {
1663
+ flatSequence.__iterateUncached = function (fn, reverse) {
1597
1664
  if (reverse) {
1598
1665
  return this.cacheResult().__iterate(fn, reverse);
1599
1666
  }
@@ -1615,7 +1682,7 @@
1615
1682
  flatDeep(collection, 0);
1616
1683
  return iterations;
1617
1684
  };
1618
- flatSequence.__iteratorUncached = function(type, reverse) {
1685
+ flatSequence.__iteratorUncached = function (type, reverse) {
1619
1686
  if (reverse) {
1620
1687
  return this.cacheResult().__iterator(type, reverse);
1621
1688
  }
@@ -1657,18 +1724,18 @@
1657
1724
  function interposeFactory(collection, separator) {
1658
1725
  var interposedSequence = makeSequence(collection);
1659
1726
  interposedSequence.size = collection.size && collection.size * 2 - 1;
1660
- interposedSequence.__iterateUncached = function(fn, reverse) {
1661
- var this$1 = this;
1727
+ interposedSequence.__iterateUncached = function (fn, reverse) {
1728
+ var this$1$1 = this;
1662
1729
 
1663
1730
  var iterations = 0;
1664
1731
  collection.__iterate(
1665
- function (v) { return (!iterations || fn(separator, iterations++, this$1) !== false) &&
1666
- fn(v, iterations++, this$1) !== false; },
1732
+ function (v) { return (!iterations || fn(separator, iterations++, this$1$1) !== false) &&
1733
+ fn(v, iterations++, this$1$1) !== false; },
1667
1734
  reverse
1668
1735
  );
1669
1736
  return iterations;
1670
1737
  };
1671
- interposedSequence.__iteratorUncached = function(type, reverse) {
1738
+ interposedSequence.__iteratorUncached = function (type, reverse) {
1672
1739
  var iterator = collection.__iterator(ITERATE_VALUES, reverse);
1673
1740
  var iterations = 0;
1674
1741
  var step;
@@ -1698,20 +1765,22 @@
1698
1765
  .map(function (v, k) { return [k, v, index++, mapper ? mapper(v, k, collection) : v]; })
1699
1766
  .valueSeq()
1700
1767
  .toArray();
1701
- entries.sort(function (a, b) { return comparator(a[3], b[3]) || a[2] - b[2]; }).forEach(
1702
- isKeyedCollection
1703
- ? function (v, i) {
1704
- entries[i].length = 2;
1705
- }
1706
- : function (v, i) {
1707
- entries[i] = v[1];
1708
- }
1709
- );
1768
+ entries
1769
+ .sort(function (a, b) { return comparator(a[3], b[3]) || a[2] - b[2]; })
1770
+ .forEach(
1771
+ isKeyedCollection
1772
+ ? function (v, i) {
1773
+ entries[i].length = 2;
1774
+ }
1775
+ : function (v, i) {
1776
+ entries[i] = v[1];
1777
+ }
1778
+ );
1710
1779
  return isKeyedCollection
1711
1780
  ? KeyedSeq(entries)
1712
1781
  : isIndexed(collection)
1713
- ? IndexedSeq(entries)
1714
- : SetSeq(entries);
1782
+ ? IndexedSeq(entries)
1783
+ : SetSeq(entries);
1715
1784
  }
1716
1785
 
1717
1786
  function maxFactory(collection, comparator, mapper) {
@@ -1744,9 +1813,7 @@
1744
1813
  zipSequence.size = zipAll ? sizes.max() : sizes.min();
1745
1814
  // Note: this a generic base implementation of __iterate in terms of
1746
1815
  // __iterator which may be more generically useful in the future.
1747
- zipSequence.__iterate = function(fn, reverse) {
1748
- var this$1 = this;
1749
-
1816
+ zipSequence.__iterate = function (fn, reverse) {
1750
1817
  /* generic:
1751
1818
  var iterator = this.__iterator(ITERATE_ENTRIES, reverse);
1752
1819
  var step;
@@ -1764,13 +1831,13 @@
1764
1831
  var step;
1765
1832
  var iterations = 0;
1766
1833
  while (!(step = iterator.next()).done) {
1767
- if (fn(step.value, iterations++, this$1) === false) {
1834
+ if (fn(step.value, iterations++, this) === false) {
1768
1835
  break;
1769
1836
  }
1770
1837
  }
1771
1838
  return iterations;
1772
1839
  };
1773
- zipSequence.__iteratorUncached = function(type, reverse) {
1840
+ zipSequence.__iteratorUncached = function (type, reverse) {
1774
1841
  var iterators = iters.map(
1775
1842
  function (i) { return ((i = Collection(i)), getIterator(reverse ? i.reverse() : i)); }
1776
1843
  );
@@ -1788,7 +1855,10 @@
1788
1855
  return iteratorValue(
1789
1856
  type,
1790
1857
  iterations++,
1791
- zipper.apply(null, steps.map(function (s) { return s.value; }))
1858
+ zipper.apply(
1859
+ null,
1860
+ steps.map(function (s) { return s.value; })
1861
+ )
1792
1862
  );
1793
1863
  });
1794
1864
  };
@@ -1811,8 +1881,8 @@
1811
1881
  return isKeyed(collection)
1812
1882
  ? KeyedCollection
1813
1883
  : isIndexed(collection)
1814
- ? IndexedCollection
1815
- : SetCollection;
1884
+ ? IndexedCollection
1885
+ : SetCollection;
1816
1886
  }
1817
1887
 
1818
1888
  function makeSequence(collection) {
@@ -1820,8 +1890,8 @@
1820
1890
  (isKeyed(collection)
1821
1891
  ? KeyedSeq
1822
1892
  : isIndexed(collection)
1823
- ? IndexedSeq
1824
- : SetSeq
1893
+ ? IndexedSeq
1894
+ : SetSeq
1825
1895
  ).prototype
1826
1896
  );
1827
1897
  }
@@ -1851,7 +1921,6 @@
1851
1921
  return a > b ? 1 : a < b ? -1 : 0;
1852
1922
  }
1853
1923
 
1854
- // http://jsperf.com/copy-array-inline
1855
1924
  function arrCopy(arr, offset) {
1856
1925
  offset = offset || 0;
1857
1926
  var len = Math.max(0, arr.length - offset);
@@ -1885,12 +1954,31 @@
1885
1954
  );
1886
1955
  }
1887
1956
 
1888
- function isPlainObj(value) {
1889
- return (
1890
- value &&
1891
- ((value.constructor && value.constructor.name === 'Object') ||
1892
- value.constructor === undefined)
1893
- );
1957
+ var toString = Object.prototype.toString;
1958
+
1959
+ function isPlainObject(value) {
1960
+ // The base prototype's toString deals with Argument objects and native namespaces like Math
1961
+ if (
1962
+ !value ||
1963
+ typeof value !== 'object' ||
1964
+ toString.call(value) !== '[object Object]'
1965
+ ) {
1966
+ return false;
1967
+ }
1968
+
1969
+ var proto = Object.getPrototypeOf(value);
1970
+ if (proto === null) {
1971
+ return true;
1972
+ }
1973
+
1974
+ // Iteratively going up the prototype chain is needed for cross-realm environments (differing contexts, iframes, etc)
1975
+ var parentProto = proto;
1976
+ var nextProto = Object.getPrototypeOf(proto);
1977
+ while (nextProto !== null) {
1978
+ parentProto = nextProto;
1979
+ nextProto = Object.getPrototypeOf(parentProto);
1980
+ }
1981
+ return parentProto === proto;
1894
1982
  }
1895
1983
 
1896
1984
  /**
@@ -1900,13 +1988,10 @@
1900
1988
  function isDataStructure(value) {
1901
1989
  return (
1902
1990
  typeof value === 'object' &&
1903
- (isImmutable(value) || Array.isArray(value) || isPlainObj(value))
1991
+ (isImmutable(value) || Array.isArray(value) || isPlainObject(value))
1904
1992
  );
1905
1993
  }
1906
1994
 
1907
- /**
1908
- * Converts a value to a string, adding quotes if a string was provided.
1909
- */
1910
1995
  function quoteString(value) {
1911
1996
  try {
1912
1997
  return typeof value === 'string' ? JSON.stringify(value) : String(value);
@@ -1925,10 +2010,10 @@
1925
2010
  return isImmutable(collection)
1926
2011
  ? collection.get(key, notSetValue)
1927
2012
  : !has(collection, key)
1928
- ? notSetValue
1929
- : typeof collection.get === 'function'
1930
- ? collection.get(key)
1931
- : collection[key];
2013
+ ? notSetValue
2014
+ : typeof collection.get === 'function'
2015
+ ? collection.get(key)
2016
+ : collection[key];
1932
2017
  }
1933
2018
 
1934
2019
  function shallowCopy(from) {
@@ -1992,7 +2077,7 @@
1992
2077
  return collectionCopy;
1993
2078
  }
1994
2079
 
1995
- function updateIn(collection, keyPath, notSetValue, updater) {
2080
+ function updateIn$1(collection, keyPath, notSetValue, updater) {
1996
2081
  if (!updater) {
1997
2082
  updater = notSetValue;
1998
2083
  notSetValue = undefined;
@@ -2043,52 +2128,52 @@
2043
2128
  return nextUpdated === nextExisting
2044
2129
  ? existing
2045
2130
  : nextUpdated === NOT_SET
2046
- ? remove(existing, key)
2047
- : set(
2048
- wasNotSet ? (inImmutable ? emptyMap() : {}) : existing,
2049
- key,
2050
- nextUpdated
2051
- );
2131
+ ? remove(existing, key)
2132
+ : set(
2133
+ wasNotSet ? (inImmutable ? emptyMap() : {}) : existing,
2134
+ key,
2135
+ nextUpdated
2136
+ );
2052
2137
  }
2053
2138
 
2054
- function setIn(collection, keyPath, value) {
2055
- return updateIn(collection, keyPath, NOT_SET, function () { return value; });
2139
+ function setIn$1(collection, keyPath, value) {
2140
+ return updateIn$1(collection, keyPath, NOT_SET, function () { return value; });
2056
2141
  }
2057
2142
 
2058
- function setIn$1(keyPath, v) {
2059
- return setIn(this, keyPath, v);
2143
+ function setIn(keyPath, v) {
2144
+ return setIn$1(this, keyPath, v);
2060
2145
  }
2061
2146
 
2062
2147
  function removeIn(collection, keyPath) {
2063
- return updateIn(collection, keyPath, function () { return NOT_SET; });
2148
+ return updateIn$1(collection, keyPath, function () { return NOT_SET; });
2064
2149
  }
2065
2150
 
2066
2151
  function deleteIn(keyPath) {
2067
2152
  return removeIn(this, keyPath);
2068
2153
  }
2069
2154
 
2070
- function update(collection, key, notSetValue, updater) {
2071
- return updateIn(collection, [key], notSetValue, updater);
2155
+ function update$1(collection, key, notSetValue, updater) {
2156
+ return updateIn$1(collection, [key], notSetValue, updater);
2072
2157
  }
2073
2158
 
2074
- function update$1(key, notSetValue, updater) {
2159
+ function update(key, notSetValue, updater) {
2075
2160
  return arguments.length === 1
2076
2161
  ? key(this)
2077
- : update(this, key, notSetValue, updater);
2162
+ : update$1(this, key, notSetValue, updater);
2078
2163
  }
2079
2164
 
2080
- function updateIn$1(keyPath, notSetValue, updater) {
2081
- return updateIn(this, keyPath, notSetValue, updater);
2165
+ function updateIn(keyPath, notSetValue, updater) {
2166
+ return updateIn$1(this, keyPath, notSetValue, updater);
2082
2167
  }
2083
2168
 
2084
- function merge() {
2169
+ function merge$1() {
2085
2170
  var iters = [], len = arguments.length;
2086
2171
  while ( len-- ) iters[ len ] = arguments[ len ];
2087
2172
 
2088
2173
  return mergeIntoKeyedWith(this, iters);
2089
2174
  }
2090
2175
 
2091
- function mergeWith(merger) {
2176
+ function mergeWith$1(merger) {
2092
2177
  var iters = [], len = arguments.length - 1;
2093
2178
  while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];
2094
2179
 
@@ -2119,11 +2204,7 @@
2119
2204
  return collection.withMutations(function (collection) {
2120
2205
  var mergeIntoCollection = merger
2121
2206
  ? function (value, key) {
2122
- update(
2123
- collection,
2124
- key,
2125
- NOT_SET,
2126
- function (oldVal) { return (oldVal === NOT_SET ? value : merger(oldVal, value, key)); }
2207
+ update$1(collection, key, NOT_SET, function (oldVal) { return oldVal === NOT_SET ? value : merger(oldVal, value, key); }
2127
2208
  );
2128
2209
  }
2129
2210
  : function (value, key) {
@@ -2135,28 +2216,28 @@
2135
2216
  });
2136
2217
  }
2137
2218
 
2138
- function merge$1(collection) {
2219
+ function merge(collection) {
2139
2220
  var sources = [], len = arguments.length - 1;
2140
2221
  while ( len-- > 0 ) sources[ len ] = arguments[ len + 1 ];
2141
2222
 
2142
2223
  return mergeWithSources(collection, sources);
2143
2224
  }
2144
2225
 
2145
- function mergeWith$1(merger, collection) {
2226
+ function mergeWith(merger, collection) {
2146
2227
  var sources = [], len = arguments.length - 2;
2147
2228
  while ( len-- > 0 ) sources[ len ] = arguments[ len + 2 ];
2148
2229
 
2149
2230
  return mergeWithSources(collection, sources, merger);
2150
2231
  }
2151
2232
 
2152
- function mergeDeep(collection) {
2233
+ function mergeDeep$1(collection) {
2153
2234
  var sources = [], len = arguments.length - 1;
2154
2235
  while ( len-- > 0 ) sources[ len ] = arguments[ len + 1 ];
2155
2236
 
2156
2237
  return mergeDeepWithSources(collection, sources);
2157
2238
  }
2158
2239
 
2159
- function mergeDeepWith(merger, collection) {
2240
+ function mergeDeepWith$1(merger, collection) {
2160
2241
  var sources = [], len = arguments.length - 2;
2161
2242
  while ( len-- > 0 ) sources[ len ] = arguments[ len + 2 ];
2162
2243
 
@@ -2177,12 +2258,12 @@
2177
2258
  return typeof merger === 'function' && collection.mergeWith
2178
2259
  ? collection.mergeWith.apply(collection, [ merger ].concat( sources ))
2179
2260
  : collection.merge
2180
- ? collection.merge.apply(collection, sources)
2181
- : collection.concat.apply(collection, sources);
2261
+ ? collection.merge.apply(collection, sources)
2262
+ : collection.concat.apply(collection, sources);
2182
2263
  }
2183
2264
  var isArray = Array.isArray(collection);
2184
2265
  var merged = collection;
2185
- var Collection$$1 = isArray ? IndexedCollection : KeyedCollection;
2266
+ var Collection = isArray ? IndexedCollection : KeyedCollection;
2186
2267
  var mergeItem = isArray
2187
2268
  ? function (value) {
2188
2269
  // Copy on write
@@ -2204,30 +2285,48 @@
2204
2285
  }
2205
2286
  };
2206
2287
  for (var i = 0; i < sources.length; i++) {
2207
- Collection$$1(sources[i]).forEach(mergeItem);
2288
+ Collection(sources[i]).forEach(mergeItem);
2208
2289
  }
2209
2290
  return merged;
2210
2291
  }
2211
2292
 
2212
2293
  function deepMergerWith(merger) {
2213
2294
  function deepMerger(oldValue, newValue, key) {
2214
- return isDataStructure(oldValue) && isDataStructure(newValue)
2295
+ return isDataStructure(oldValue) &&
2296
+ isDataStructure(newValue) &&
2297
+ areMergeable(oldValue, newValue)
2215
2298
  ? mergeWithSources(oldValue, [newValue], deepMerger)
2216
2299
  : merger
2217
- ? merger(oldValue, newValue, key)
2218
- : newValue;
2300
+ ? merger(oldValue, newValue, key)
2301
+ : newValue;
2219
2302
  }
2220
2303
  return deepMerger;
2221
2304
  }
2222
2305
 
2223
- function mergeDeep$1() {
2306
+ /**
2307
+ * It's unclear what the desired behavior is for merging two collections that
2308
+ * fall into separate categories between keyed, indexed, or set-like, so we only
2309
+ * consider them mergeable if they fall into the same category.
2310
+ */
2311
+ function areMergeable(oldDataStructure, newDataStructure) {
2312
+ var oldSeq = Seq(oldDataStructure);
2313
+ var newSeq = Seq(newDataStructure);
2314
+ // This logic assumes that a sequence can only fall into one of the three
2315
+ // categories mentioned above (since there's no `isSetLike()` method).
2316
+ return (
2317
+ isIndexed(oldSeq) === isIndexed(newSeq) &&
2318
+ isKeyed(oldSeq) === isKeyed(newSeq)
2319
+ );
2320
+ }
2321
+
2322
+ function mergeDeep() {
2224
2323
  var iters = [], len = arguments.length;
2225
2324
  while ( len-- ) iters[ len ] = arguments[ len ];
2226
2325
 
2227
2326
  return mergeDeepWithSources(this, iters);
2228
2327
  }
2229
2328
 
2230
- function mergeDeepWith$1(merger) {
2329
+ function mergeDeepWith(merger) {
2231
2330
  var iters = [], len = arguments.length - 1;
2232
2331
  while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];
2233
2332
 
@@ -2238,14 +2337,14 @@
2238
2337
  var iters = [], len = arguments.length - 1;
2239
2338
  while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];
2240
2339
 
2241
- return updateIn(this, keyPath, emptyMap(), function (m) { return mergeWithSources(m, iters); });
2340
+ return updateIn$1(this, keyPath, emptyMap(), function (m) { return mergeWithSources(m, iters); });
2242
2341
  }
2243
2342
 
2244
2343
  function mergeDeepIn(keyPath) {
2245
2344
  var iters = [], len = arguments.length - 1;
2246
2345
  while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];
2247
2346
 
2248
- return updateIn(this, keyPath, emptyMap(), function (m) { return mergeDeepWithSources(m, iters); }
2347
+ return updateIn$1(this, keyPath, emptyMap(), function (m) { return mergeDeepWithSources(m, iters); }
2249
2348
  );
2250
2349
  }
2251
2350
 
@@ -2267,21 +2366,21 @@
2267
2366
  return this.__altered;
2268
2367
  }
2269
2368
 
2270
- var Map = (function (KeyedCollection$$1) {
2369
+ var Map = /*@__PURE__*/(function (KeyedCollection) {
2271
2370
  function Map(value) {
2272
2371
  return value === null || value === undefined
2273
2372
  ? emptyMap()
2274
2373
  : isMap(value) && !isOrdered(value)
2275
- ? value
2276
- : emptyMap().withMutations(function (map) {
2277
- var iter = KeyedCollection$$1(value);
2278
- assertNotInfinite(iter.size);
2279
- iter.forEach(function (v, k) { return map.set(k, v); });
2280
- });
2374
+ ? value
2375
+ : emptyMap().withMutations(function (map) {
2376
+ var iter = KeyedCollection(value);
2377
+ assertNotInfinite(iter.size);
2378
+ iter.forEach(function (v, k) { return map.set(k, v); });
2379
+ });
2281
2380
  }
2282
2381
 
2283
- if ( KeyedCollection$$1 ) Map.__proto__ = KeyedCollection$$1;
2284
- Map.prototype = Object.create( KeyedCollection$$1 && KeyedCollection$$1.prototype );
2382
+ if ( KeyedCollection ) Map.__proto__ = KeyedCollection;
2383
+ Map.prototype = Object.create( KeyedCollection && KeyedCollection.prototype );
2285
2384
  Map.prototype.constructor = Map;
2286
2385
 
2287
2386
  Map.of = function of () {
@@ -2359,9 +2458,11 @@
2359
2458
  };
2360
2459
 
2361
2460
  Map.prototype.map = function map (mapper, context) {
2461
+ var this$1$1 = this;
2462
+
2362
2463
  return this.withMutations(function (map) {
2363
2464
  map.forEach(function (value, key) {
2364
- map.set(key, mapper.call(context, value, key, map));
2465
+ map.set(key, mapper.call(context, value, key, this$1$1));
2365
2466
  });
2366
2467
  });
2367
2468
  };
@@ -2373,13 +2474,13 @@
2373
2474
  };
2374
2475
 
2375
2476
  Map.prototype.__iterate = function __iterate (fn, reverse) {
2376
- var this$1 = this;
2477
+ var this$1$1 = this;
2377
2478
 
2378
2479
  var iterations = 0;
2379
2480
  this._root &&
2380
2481
  this._root.iterate(function (entry) {
2381
2482
  iterations++;
2382
- return fn(entry[1], entry[0], this$1);
2483
+ return fn(entry[1], entry[0], this$1$1);
2383
2484
  }, reverse);
2384
2485
  return iterations;
2385
2486
  };
@@ -2408,24 +2509,24 @@
2408
2509
  MapPrototype[IS_MAP_SYMBOL] = true;
2409
2510
  MapPrototype[DELETE] = MapPrototype.remove;
2410
2511
  MapPrototype.removeAll = MapPrototype.deleteAll;
2411
- MapPrototype.setIn = setIn$1;
2512
+ MapPrototype.setIn = setIn;
2412
2513
  MapPrototype.removeIn = MapPrototype.deleteIn = deleteIn;
2413
- MapPrototype.update = update$1;
2414
- MapPrototype.updateIn = updateIn$1;
2415
- MapPrototype.merge = MapPrototype.concat = merge;
2416
- MapPrototype.mergeWith = mergeWith;
2417
- MapPrototype.mergeDeep = mergeDeep$1;
2418
- MapPrototype.mergeDeepWith = mergeDeepWith$1;
2514
+ MapPrototype.update = update;
2515
+ MapPrototype.updateIn = updateIn;
2516
+ MapPrototype.merge = MapPrototype.concat = merge$1;
2517
+ MapPrototype.mergeWith = mergeWith$1;
2518
+ MapPrototype.mergeDeep = mergeDeep;
2519
+ MapPrototype.mergeDeepWith = mergeDeepWith;
2419
2520
  MapPrototype.mergeIn = mergeIn;
2420
2521
  MapPrototype.mergeDeepIn = mergeDeepIn;
2421
2522
  MapPrototype.withMutations = withMutations;
2422
2523
  MapPrototype.wasAltered = wasAltered;
2423
2524
  MapPrototype.asImmutable = asImmutable;
2424
2525
  MapPrototype['@@transducer/init'] = MapPrototype.asMutable = asMutable;
2425
- MapPrototype['@@transducer/step'] = function(result, arr) {
2526
+ MapPrototype['@@transducer/step'] = function (result, arr) {
2426
2527
  return result.set(arr[0], arr[1]);
2427
2528
  };
2428
- MapPrototype['@@transducer/result'] = function(obj) {
2529
+ MapPrototype['@@transducer/result'] = function (obj) {
2429
2530
  return obj.asImmutable();
2430
2531
  };
2431
2532
 
@@ -2764,50 +2865,44 @@
2764
2865
 
2765
2866
  // #pragma Iterators
2766
2867
 
2767
- ArrayMapNode.prototype.iterate = HashCollisionNode.prototype.iterate = function(
2768
- fn,
2769
- reverse
2770
- ) {
2771
- var entries = this.entries;
2772
- for (var ii = 0, maxIndex = entries.length - 1; ii <= maxIndex; ii++) {
2773
- if (fn(entries[reverse ? maxIndex - ii : ii]) === false) {
2774
- return false;
2868
+ ArrayMapNode.prototype.iterate = HashCollisionNode.prototype.iterate =
2869
+ function (fn, reverse) {
2870
+ var entries = this.entries;
2871
+ for (var ii = 0, maxIndex = entries.length - 1; ii <= maxIndex; ii++) {
2872
+ if (fn(entries[reverse ? maxIndex - ii : ii]) === false) {
2873
+ return false;
2874
+ }
2775
2875
  }
2776
- }
2777
- };
2876
+ };
2778
2877
 
2779
- BitmapIndexedNode.prototype.iterate = HashArrayMapNode.prototype.iterate = function(
2780
- fn,
2781
- reverse
2782
- ) {
2783
- var nodes = this.nodes;
2784
- for (var ii = 0, maxIndex = nodes.length - 1; ii <= maxIndex; ii++) {
2785
- var node = nodes[reverse ? maxIndex - ii : ii];
2786
- if (node && node.iterate(fn, reverse) === false) {
2787
- return false;
2878
+ BitmapIndexedNode.prototype.iterate = HashArrayMapNode.prototype.iterate =
2879
+ function (fn, reverse) {
2880
+ var nodes = this.nodes;
2881
+ for (var ii = 0, maxIndex = nodes.length - 1; ii <= maxIndex; ii++) {
2882
+ var node = nodes[reverse ? maxIndex - ii : ii];
2883
+ if (node && node.iterate(fn, reverse) === false) {
2884
+ return false;
2885
+ }
2788
2886
  }
2789
- }
2790
- };
2887
+ };
2791
2888
 
2792
2889
  // eslint-disable-next-line no-unused-vars
2793
- ValueNode.prototype.iterate = function(fn, reverse) {
2890
+ ValueNode.prototype.iterate = function (fn, reverse) {
2794
2891
  return fn(this.entry);
2795
2892
  };
2796
2893
 
2797
- var MapIterator = (function (Iterator$$1) {
2894
+ var MapIterator = /*@__PURE__*/(function (Iterator) {
2798
2895
  function MapIterator(map, type, reverse) {
2799
2896
  this._type = type;
2800
2897
  this._reverse = reverse;
2801
2898
  this._stack = map._root && mapIteratorFrame(map._root);
2802
2899
  }
2803
2900
 
2804
- if ( Iterator$$1 ) MapIterator.__proto__ = Iterator$$1;
2805
- MapIterator.prototype = Object.create( Iterator$$1 && Iterator$$1.prototype );
2901
+ if ( Iterator ) MapIterator.__proto__ = Iterator;
2902
+ MapIterator.prototype = Object.create( Iterator && Iterator.prototype );
2806
2903
  MapIterator.prototype.constructor = MapIterator;
2807
2904
 
2808
2905
  MapIterator.prototype.next = function next () {
2809
- var this$1 = this;
2810
-
2811
2906
  var type = this._type;
2812
2907
  var stack = this._stack;
2813
2908
  while (stack) {
@@ -2823,23 +2918,23 @@
2823
2918
  if (index <= maxIndex) {
2824
2919
  return mapIteratorValue(
2825
2920
  type,
2826
- node.entries[this$1._reverse ? maxIndex - index : index]
2921
+ node.entries[this._reverse ? maxIndex - index : index]
2827
2922
  );
2828
2923
  }
2829
2924
  } else {
2830
2925
  maxIndex = node.nodes.length - 1;
2831
2926
  if (index <= maxIndex) {
2832
- var subNode = node.nodes[this$1._reverse ? maxIndex - index : index];
2927
+ var subNode = node.nodes[this._reverse ? maxIndex - index : index];
2833
2928
  if (subNode) {
2834
2929
  if (subNode.entry) {
2835
2930
  return mapIteratorValue(type, subNode.entry);
2836
2931
  }
2837
- stack = this$1._stack = mapIteratorFrame(subNode, stack);
2932
+ stack = this._stack = mapIteratorFrame(subNode, stack);
2838
2933
  }
2839
2934
  continue;
2840
2935
  }
2841
2936
  }
2842
- stack = this$1._stack = this$1._stack.__prev;
2937
+ stack = this._stack = this._stack.__prev;
2843
2938
  }
2844
2939
  return iteratorDone();
2845
2940
  };
@@ -2859,12 +2954,12 @@
2859
2954
  };
2860
2955
  }
2861
2956
 
2862
- function makeMap(size, root, ownerID, hash$$1) {
2957
+ function makeMap(size, root, ownerID, hash) {
2863
2958
  var map = Object.create(MapPrototype);
2864
2959
  map.size = size;
2865
2960
  map._root = root;
2866
2961
  map.__ownerID = ownerID;
2867
- map.__hash = hash$$1;
2962
+ map.__hash = hash;
2868
2963
  map.__altered = false;
2869
2964
  return map;
2870
2965
  }
@@ -3061,7 +3156,7 @@
3061
3156
  return Boolean(maybeList && maybeList[IS_LIST_SYMBOL]);
3062
3157
  }
3063
3158
 
3064
- var List = (function (IndexedCollection$$1) {
3159
+ var List = /*@__PURE__*/(function (IndexedCollection) {
3065
3160
  function List(value) {
3066
3161
  var empty = emptyList();
3067
3162
  if (value === null || value === undefined) {
@@ -3070,7 +3165,7 @@
3070
3165
  if (isList(value)) {
3071
3166
  return value;
3072
3167
  }
3073
- var iter = IndexedCollection$$1(value);
3168
+ var iter = IndexedCollection(value);
3074
3169
  var size = iter.size;
3075
3170
  if (size === 0) {
3076
3171
  return empty;
@@ -3085,8 +3180,8 @@
3085
3180
  });
3086
3181
  }
3087
3182
 
3088
- if ( IndexedCollection$$1 ) List.__proto__ = IndexedCollection$$1;
3089
- List.prototype = Object.create( IndexedCollection$$1 && IndexedCollection$$1.prototype );
3183
+ if ( IndexedCollection ) List.__proto__ = IndexedCollection;
3184
+ List.prototype = Object.create( IndexedCollection && IndexedCollection.prototype );
3090
3185
  List.prototype.constructor = List;
3091
3186
 
3092
3187
  List.of = function of (/*...values*/) {
@@ -3119,10 +3214,10 @@
3119
3214
  return !this.has(index)
3120
3215
  ? this
3121
3216
  : index === 0
3122
- ? this.shift()
3123
- : index === this.size - 1
3124
- ? this.pop()
3125
- : this.splice(index, 1);
3217
+ ? this.shift()
3218
+ : index === this.size - 1
3219
+ ? this.pop()
3220
+ : this.splice(index, 1);
3126
3221
  };
3127
3222
 
3128
3223
  List.prototype.insert = function insert (index, value) {
@@ -3136,8 +3231,7 @@
3136
3231
  if (this.__ownerID) {
3137
3232
  this.size = this._origin = this._capacity = 0;
3138
3233
  this._level = SHIFT;
3139
- this._root = this._tail = null;
3140
- this.__hash = undefined;
3234
+ this._root = this._tail = this.__hash = undefined;
3141
3235
  this.__altered = true;
3142
3236
  return this;
3143
3237
  }
@@ -3181,7 +3275,7 @@
3181
3275
  var seqs = [];
3182
3276
  for (var i = 0; i < arguments.length; i++) {
3183
3277
  var argument = arguments$1[i];
3184
- var seq = IndexedCollection$$1(
3278
+ var seq = IndexedCollection(
3185
3279
  typeof argument !== 'string' && hasIterator(argument)
3186
3280
  ? argument
3187
3281
  : [argument]
@@ -3206,11 +3300,11 @@
3206
3300
  };
3207
3301
 
3208
3302
  List.prototype.map = function map (mapper, context) {
3209
- var this$1 = this;
3303
+ var this$1$1 = this;
3210
3304
 
3211
3305
  return this.withMutations(function (list) {
3212
- for (var i = 0; i < this$1.size; i++) {
3213
- list.set(i, mapper.call(context, list.get(i), i, list));
3306
+ for (var i = 0; i < this$1$1.size; i++) {
3307
+ list.set(i, mapper.call(context, list.get(i), i, this$1$1));
3214
3308
  }
3215
3309
  });
3216
3310
  };
@@ -3241,13 +3335,11 @@
3241
3335
  };
3242
3336
 
3243
3337
  List.prototype.__iterate = function __iterate (fn, reverse) {
3244
- var this$1 = this;
3245
-
3246
3338
  var index = reverse ? this.size : 0;
3247
3339
  var values = iterateList(this, reverse);
3248
3340
  var value;
3249
3341
  while ((value = values()) !== DONE) {
3250
- if (fn(value, reverse ? --index : index++, this$1) === false) {
3342
+ if (fn(value, reverse ? --index : index++, this) === false) {
3251
3343
  break;
3252
3344
  }
3253
3345
  }
@@ -3286,20 +3378,20 @@
3286
3378
  ListPrototype[IS_LIST_SYMBOL] = true;
3287
3379
  ListPrototype[DELETE] = ListPrototype.remove;
3288
3380
  ListPrototype.merge = ListPrototype.concat;
3289
- ListPrototype.setIn = setIn$1;
3381
+ ListPrototype.setIn = setIn;
3290
3382
  ListPrototype.deleteIn = ListPrototype.removeIn = deleteIn;
3291
- ListPrototype.update = update$1;
3292
- ListPrototype.updateIn = updateIn$1;
3383
+ ListPrototype.update = update;
3384
+ ListPrototype.updateIn = updateIn;
3293
3385
  ListPrototype.mergeIn = mergeIn;
3294
3386
  ListPrototype.mergeDeepIn = mergeDeepIn;
3295
3387
  ListPrototype.withMutations = withMutations;
3296
3388
  ListPrototype.wasAltered = wasAltered;
3297
3389
  ListPrototype.asImmutable = asImmutable;
3298
3390
  ListPrototype['@@transducer/init'] = ListPrototype.asMutable = asMutable;
3299
- ListPrototype['@@transducer/step'] = function(result, arr) {
3391
+ ListPrototype['@@transducer/step'] = function (result, arr) {
3300
3392
  return result.push(arr);
3301
3393
  };
3302
- ListPrototype['@@transducer/result'] = function(obj) {
3394
+ ListPrototype['@@transducer/result'] = function (obj) {
3303
3395
  return obj.asImmutable();
3304
3396
  };
3305
3397
 
@@ -3582,8 +3674,8 @@
3582
3674
  end === undefined
3583
3675
  ? oldCapacity
3584
3676
  : end < 0
3585
- ? oldCapacity + end
3586
- : oldOrigin + end;
3677
+ ? oldCapacity + end
3678
+ : oldOrigin + end;
3587
3679
  if (newOrigin === oldOrigin && newCapacity === oldCapacity) {
3588
3680
  return list;
3589
3681
  }
@@ -3631,8 +3723,8 @@
3631
3723
  newTailOffset < oldTailOffset
3632
3724
  ? listNodeFor(list, newCapacity - 1)
3633
3725
  : newTailOffset > oldTailOffset
3634
- ? new VNode([], owner)
3635
- : oldTail;
3726
+ ? new VNode([], owner)
3727
+ : oldTail;
3636
3728
 
3637
3729
  // Merge Tail into tree.
3638
3730
  if (
@@ -3715,21 +3807,21 @@
3715
3807
  return size < SIZE ? 0 : ((size - 1) >>> SHIFT) << SHIFT;
3716
3808
  }
3717
3809
 
3718
- var OrderedMap = (function (Map$$1) {
3810
+ var OrderedMap = /*@__PURE__*/(function (Map) {
3719
3811
  function OrderedMap(value) {
3720
3812
  return value === null || value === undefined
3721
3813
  ? emptyOrderedMap()
3722
3814
  : isOrderedMap(value)
3723
- ? value
3724
- : emptyOrderedMap().withMutations(function (map) {
3725
- var iter = KeyedCollection(value);
3726
- assertNotInfinite(iter.size);
3727
- iter.forEach(function (v, k) { return map.set(k, v); });
3728
- });
3815
+ ? value
3816
+ : emptyOrderedMap().withMutations(function (map) {
3817
+ var iter = KeyedCollection(value);
3818
+ assertNotInfinite(iter.size);
3819
+ iter.forEach(function (v, k) { return map.set(k, v); });
3820
+ });
3729
3821
  }
3730
3822
 
3731
- if ( Map$$1 ) OrderedMap.__proto__ = Map$$1;
3732
- OrderedMap.prototype = Object.create( Map$$1 && Map$$1.prototype );
3823
+ if ( Map ) OrderedMap.__proto__ = Map;
3824
+ OrderedMap.prototype = Object.create( Map && Map.prototype );
3733
3825
  OrderedMap.prototype.constructor = OrderedMap;
3734
3826
 
3735
3827
  OrderedMap.of = function of (/*...values*/) {
@@ -3757,6 +3849,7 @@
3757
3849
  this.size = 0;
3758
3850
  this._map.clear();
3759
3851
  this._list.clear();
3852
+ this.__altered = true;
3760
3853
  return this;
3761
3854
  }
3762
3855
  return emptyOrderedMap();
@@ -3770,15 +3863,11 @@
3770
3863
  return updateOrderedMap(this, k, NOT_SET);
3771
3864
  };
3772
3865
 
3773
- OrderedMap.prototype.wasAltered = function wasAltered () {
3774
- return this._map.wasAltered() || this._list.wasAltered();
3775
- };
3776
-
3777
3866
  OrderedMap.prototype.__iterate = function __iterate (fn, reverse) {
3778
- var this$1 = this;
3867
+ var this$1$1 = this;
3779
3868
 
3780
3869
  return this._list.__iterate(
3781
- function (entry) { return entry && fn(entry[1], entry[0], this$1); },
3870
+ function (entry) { return entry && fn(entry[1], entry[0], this$1$1); },
3782
3871
  reverse
3783
3872
  );
3784
3873
  };
@@ -3798,6 +3887,7 @@
3798
3887
  return emptyOrderedMap();
3799
3888
  }
3800
3889
  this.__ownerID = ownerID;
3890
+ this.__altered = false;
3801
3891
  this._map = newMap;
3802
3892
  this._list = newList;
3803
3893
  return this;
@@ -3820,6 +3910,7 @@
3820
3910
  omap._list = list;
3821
3911
  omap.__ownerID = ownerID;
3822
3912
  omap.__hash = hash;
3913
+ omap.__altered = false;
3823
3914
  return omap;
3824
3915
  }
3825
3916
 
@@ -3872,6 +3963,7 @@
3872
3963
  omap._map = newMap;
3873
3964
  omap._list = newList;
3874
3965
  omap.__hash = undefined;
3966
+ omap.__altered = true;
3875
3967
  return omap;
3876
3968
  }
3877
3969
  return makeOrderedMap(newMap, newList);
@@ -3883,17 +3975,17 @@
3883
3975
  return Boolean(maybeStack && maybeStack[IS_STACK_SYMBOL]);
3884
3976
  }
3885
3977
 
3886
- var Stack = (function (IndexedCollection$$1) {
3978
+ var Stack = /*@__PURE__*/(function (IndexedCollection) {
3887
3979
  function Stack(value) {
3888
3980
  return value === null || value === undefined
3889
3981
  ? emptyStack()
3890
3982
  : isStack(value)
3891
- ? value
3892
- : emptyStack().pushAll(value);
3983
+ ? value
3984
+ : emptyStack().pushAll(value);
3893
3985
  }
3894
3986
 
3895
- if ( IndexedCollection$$1 ) Stack.__proto__ = IndexedCollection$$1;
3896
- Stack.prototype = Object.create( IndexedCollection$$1 && IndexedCollection$$1.prototype );
3987
+ if ( IndexedCollection ) Stack.__proto__ = IndexedCollection;
3988
+ Stack.prototype = Object.create( IndexedCollection && IndexedCollection.prototype );
3897
3989
  Stack.prototype.constructor = Stack;
3898
3990
 
3899
3991
  Stack.of = function of (/*...values*/) {
@@ -3946,7 +4038,7 @@
3946
4038
  };
3947
4039
 
3948
4040
  Stack.prototype.pushAll = function pushAll (iter) {
3949
- iter = IndexedCollection$$1(iter);
4041
+ iter = IndexedCollection(iter);
3950
4042
  if (iter.size === 0) {
3951
4043
  return this;
3952
4044
  }
@@ -3999,7 +4091,7 @@
3999
4091
  var resolvedEnd = resolveEnd(end, this.size);
4000
4092
  if (resolvedEnd !== this.size) {
4001
4093
  // super.slice(begin, end);
4002
- return IndexedCollection$$1.prototype.slice.call(this, begin, end);
4094
+ return IndexedCollection.prototype.slice.call(this, begin, end);
4003
4095
  }
4004
4096
  var newSize = this.size - resolvedBegin;
4005
4097
  var head = this._head;
@@ -4036,18 +4128,18 @@
4036
4128
  // @pragma Iteration
4037
4129
 
4038
4130
  Stack.prototype.__iterate = function __iterate (fn, reverse) {
4039
- var this$1 = this;
4131
+ var this$1$1 = this;
4040
4132
 
4041
4133
  if (reverse) {
4042
4134
  return new ArraySeq(this.toArray()).__iterate(
4043
- function (v, k) { return fn(v, k, this$1); },
4135
+ function (v, k) { return fn(v, k, this$1$1); },
4044
4136
  reverse
4045
4137
  );
4046
4138
  }
4047
4139
  var iterations = 0;
4048
4140
  var node = this._head;
4049
4141
  while (node) {
4050
- if (fn(node.value, iterations++, this$1) === false) {
4142
+ if (fn(node.value, iterations++, this) === false) {
4051
4143
  break;
4052
4144
  }
4053
4145
  node = node.next;
@@ -4085,10 +4177,10 @@
4085
4177
  StackPrototype.wasAltered = wasAltered;
4086
4178
  StackPrototype.asImmutable = asImmutable;
4087
4179
  StackPrototype['@@transducer/init'] = StackPrototype.asMutable = asMutable;
4088
- StackPrototype['@@transducer/step'] = function(result, arr) {
4180
+ StackPrototype['@@transducer/step'] = function (result, arr) {
4089
4181
  return result.unshift(arr);
4090
4182
  };
4091
- StackPrototype['@@transducer/result'] = function(obj) {
4183
+ StackPrototype['@@transducer/result'] = function (obj) {
4092
4184
  return obj.asImmutable();
4093
4185
  };
4094
4186
 
@@ -4172,8 +4264,8 @@
4172
4264
  notAssociative
4173
4265
  ? !a.has(v)
4174
4266
  : flipped
4175
- ? !is(v, a.get(k, NOT_SET))
4176
- : !is(a.get(k, NOT_SET), v)
4267
+ ? !is(v, a.get(k, NOT_SET))
4268
+ : !is(a.get(k, NOT_SET), v)
4177
4269
  ) {
4178
4270
  allEqual = false;
4179
4271
  return false;
@@ -4183,9 +4275,6 @@
4183
4275
  return allEqual && a.size === bSize;
4184
4276
  }
4185
4277
 
4186
- /**
4187
- * Contributes additional methods to a constructor
4188
- */
4189
4278
  function mixin(ctor, methods) {
4190
4279
  var keyCopier = function (key) {
4191
4280
  ctor.prototype[key] = methods[key];
@@ -4220,21 +4309,21 @@
4220
4309
  return result;
4221
4310
  }
4222
4311
 
4223
- var Set = (function (SetCollection$$1) {
4312
+ var Set = /*@__PURE__*/(function (SetCollection) {
4224
4313
  function Set(value) {
4225
4314
  return value === null || value === undefined
4226
4315
  ? emptySet()
4227
4316
  : isSet(value) && !isOrdered(value)
4228
- ? value
4229
- : emptySet().withMutations(function (set) {
4230
- var iter = SetCollection$$1(value);
4231
- assertNotInfinite(iter.size);
4232
- iter.forEach(function (v) { return set.add(v); });
4233
- });
4317
+ ? value
4318
+ : emptySet().withMutations(function (set) {
4319
+ var iter = SetCollection(value);
4320
+ assertNotInfinite(iter.size);
4321
+ iter.forEach(function (v) { return set.add(v); });
4322
+ });
4234
4323
  }
4235
4324
 
4236
- if ( SetCollection$$1 ) Set.__proto__ = SetCollection$$1;
4237
- Set.prototype = Object.create( SetCollection$$1 && SetCollection$$1.prototype );
4325
+ if ( SetCollection ) Set.__proto__ = SetCollection;
4326
+ Set.prototype = Object.create( SetCollection && SetCollection.prototype );
4238
4327
  Set.prototype.constructor = Set;
4239
4328
 
4240
4329
  Set.of = function of (/*...values*/) {
@@ -4286,9 +4375,27 @@
4286
4375
  // @pragma Composition
4287
4376
 
4288
4377
  Set.prototype.map = function map (mapper, context) {
4289
- var this$1 = this;
4378
+ var this$1$1 = this;
4379
+
4380
+ // keep track if the set is altered by the map function
4381
+ var didChanges = false;
4382
+
4383
+ var newMap = updateSet(
4384
+ this,
4385
+ this._map.mapEntries(function (ref) {
4386
+ var v = ref[1];
4387
+
4388
+ var mapped = mapper.call(context, v, v, this$1$1);
4290
4389
 
4291
- return updateSet(this, this._map.map(function (v) { return mapper(v, v, this$1); }, context));
4390
+ if (mapped !== v) {
4391
+ didChanges = true;
4392
+ }
4393
+
4394
+ return [mapped, mapped];
4395
+ }, context)
4396
+ );
4397
+
4398
+ return didChanges ? newMap : this;
4292
4399
  };
4293
4400
 
4294
4401
  Set.prototype.union = function union () {
@@ -4304,7 +4411,7 @@
4304
4411
  }
4305
4412
  return this.withMutations(function (set) {
4306
4413
  for (var ii = 0; ii < iters.length; ii++) {
4307
- SetCollection$$1(iters[ii]).forEach(function (value) { return set.add(value); });
4414
+ SetCollection(iters[ii]).forEach(function (value) { return set.add(value); });
4308
4415
  }
4309
4416
  });
4310
4417
  };
@@ -4316,7 +4423,7 @@
4316
4423
  if (iters.length === 0) {
4317
4424
  return this;
4318
4425
  }
4319
- iters = iters.map(function (iter) { return SetCollection$$1(iter); });
4426
+ iters = iters.map(function (iter) { return SetCollection(iter); });
4320
4427
  var toRemove = [];
4321
4428
  this.forEach(function (value) {
4322
4429
  if (!iters.every(function (iter) { return iter.includes(value); })) {
@@ -4337,7 +4444,7 @@
4337
4444
  if (iters.length === 0) {
4338
4445
  return this;
4339
4446
  }
4340
- iters = iters.map(function (iter) { return SetCollection$$1(iter); });
4447
+ iters = iters.map(function (iter) { return SetCollection(iter); });
4341
4448
  var toRemove = [];
4342
4449
  this.forEach(function (value) {
4343
4450
  if (iters.some(function (iter) { return iter.includes(value); })) {
@@ -4366,9 +4473,9 @@
4366
4473
  };
4367
4474
 
4368
4475
  Set.prototype.__iterate = function __iterate (fn, reverse) {
4369
- var this$1 = this;
4476
+ var this$1$1 = this;
4370
4477
 
4371
- return this._map.__iterate(function (k) { return fn(k, k, this$1); }, reverse);
4478
+ return this._map.__iterate(function (k) { return fn(k, k, this$1$1); }, reverse);
4372
4479
  };
4373
4480
 
4374
4481
  Set.prototype.__iterator = function __iterator (type, reverse) {
@@ -4403,10 +4510,10 @@
4403
4510
  SetPrototype.withMutations = withMutations;
4404
4511
  SetPrototype.asImmutable = asImmutable;
4405
4512
  SetPrototype['@@transducer/init'] = SetPrototype.asMutable = asMutable;
4406
- SetPrototype['@@transducer/step'] = function(result, arr) {
4513
+ SetPrototype['@@transducer/step'] = function (result, arr) {
4407
4514
  return result.add(arr);
4408
4515
  };
4409
- SetPrototype['@@transducer/result'] = function(obj) {
4516
+ SetPrototype['@@transducer/result'] = function (obj) {
4410
4517
  return obj.asImmutable();
4411
4518
  };
4412
4519
 
@@ -4422,8 +4529,8 @@
4422
4529
  return newMap === set._map
4423
4530
  ? set
4424
4531
  : newMap.size === 0
4425
- ? set.__empty()
4426
- : set.__make(newMap);
4532
+ ? set.__empty()
4533
+ : set.__make(newMap);
4427
4534
  }
4428
4535
 
4429
4536
  function makeSet(map, ownerID) {
@@ -4444,7 +4551,7 @@
4444
4551
  * (exclusive), by step, where start defaults to 0, step to 1, and end to
4445
4552
  * infinity. When start is equal to end, returns empty list.
4446
4553
  */
4447
- var Range = (function (IndexedSeq$$1) {
4554
+ var Range = /*@__PURE__*/(function (IndexedSeq) {
4448
4555
  function Range(start, end, step) {
4449
4556
  if (!(this instanceof Range)) {
4450
4557
  return new Range(start, end, step);
@@ -4470,8 +4577,8 @@
4470
4577
  }
4471
4578
  }
4472
4579
 
4473
- if ( IndexedSeq$$1 ) Range.__proto__ = IndexedSeq$$1;
4474
- Range.prototype = Object.create( IndexedSeq$$1 && IndexedSeq$$1.prototype );
4580
+ if ( IndexedSeq ) Range.__proto__ = IndexedSeq;
4581
+ Range.prototype = Object.create( IndexedSeq && IndexedSeq.prototype );
4475
4582
  Range.prototype.constructor = Range;
4476
4583
 
4477
4584
  Range.prototype.toString = function toString () {
@@ -4535,14 +4642,12 @@
4535
4642
  };
4536
4643
 
4537
4644
  Range.prototype.__iterate = function __iterate (fn, reverse) {
4538
- var this$1 = this;
4539
-
4540
4645
  var size = this.size;
4541
4646
  var step = this._step;
4542
4647
  var value = reverse ? this._start + (size - 1) * step : this._start;
4543
4648
  var i = 0;
4544
4649
  while (i !== size) {
4545
- if (fn(value, reverse ? size - ++i : i++, this$1) === false) {
4650
+ if (fn(value, reverse ? size - ++i : i++, this) === false) {
4546
4651
  break;
4547
4652
  }
4548
4653
  value += reverse ? -step : step;
@@ -4578,7 +4683,7 @@
4578
4683
 
4579
4684
  var EMPTY_RANGE;
4580
4685
 
4581
- function getIn(collection, searchKeyPath, notSetValue) {
4686
+ function getIn$1(collection, searchKeyPath, notSetValue) {
4582
4687
  var keyPath = coerceKeyPath(searchKeyPath);
4583
4688
  var i = 0;
4584
4689
  while (i !== keyPath.length) {
@@ -4590,16 +4695,16 @@
4590
4695
  return collection;
4591
4696
  }
4592
4697
 
4593
- function getIn$1(searchKeyPath, notSetValue) {
4594
- return getIn(this, searchKeyPath, notSetValue);
4698
+ function getIn(searchKeyPath, notSetValue) {
4699
+ return getIn$1(this, searchKeyPath, notSetValue);
4595
4700
  }
4596
4701
 
4597
- function hasIn(collection, keyPath) {
4598
- return getIn(collection, keyPath, NOT_SET) !== NOT_SET;
4702
+ function hasIn$1(collection, keyPath) {
4703
+ return getIn$1(collection, keyPath, NOT_SET) !== NOT_SET;
4599
4704
  }
4600
4705
 
4601
- function hasIn$1(searchKeyPath) {
4602
- return hasIn(this, searchKeyPath);
4706
+ function hasIn(searchKeyPath) {
4707
+ return hasIn$1(this, searchKeyPath);
4603
4708
  }
4604
4709
 
4605
4710
  function toObject() {
@@ -4677,8 +4782,8 @@
4677
4782
  return isIndexed(this)
4678
4783
  ? this.toIndexedSeq()
4679
4784
  : isKeyed(this)
4680
- ? this.toKeyedSeq()
4681
- : this.toSetSeq();
4785
+ ? this.toKeyedSeq()
4786
+ : this.toSetSeq();
4682
4787
  },
4683
4788
 
4684
4789
  toStack: function toStack() {
@@ -4704,9 +4809,7 @@
4704
4809
  return (
4705
4810
  head +
4706
4811
  ' ' +
4707
- this.toSeq()
4708
- .map(this.__toStringMapper)
4709
- .join(', ') +
4812
+ this.toSeq().map(this.__toStringMapper).join(', ') +
4710
4813
  ' ' +
4711
4814
  tail
4712
4815
  );
@@ -4847,10 +4950,7 @@
4847
4950
  // We cache as an entries array, so we can just return the cache!
4848
4951
  return new ArraySeq(collection._cache);
4849
4952
  }
4850
- var entriesSequence = collection
4851
- .toSeq()
4852
- .map(entryMapper)
4853
- .toIndexedSeq();
4953
+ var entriesSequence = collection.toSeq().map(entryMapper).toIndexedSeq();
4854
4954
  entriesSequence.fromEntrySeq = function () { return collection.toSeq(); };
4855
4955
  return entriesSequence;
4856
4956
  },
@@ -4876,9 +4976,7 @@
4876
4976
  },
4877
4977
 
4878
4978
  findLast: function findLast(predicate, context, notSetValue) {
4879
- return this.toKeyedSeq()
4880
- .reverse()
4881
- .find(predicate, context, notSetValue);
4979
+ return this.toKeyedSeq().reverse().find(predicate, context, notSetValue);
4882
4980
  },
4883
4981
 
4884
4982
  findLastEntry: function findLastEntry(predicate, context, notSetValue) {
@@ -4888,9 +4986,7 @@
4888
4986
  },
4889
4987
 
4890
4988
  findLastKey: function findLastKey(predicate, context) {
4891
- return this.toKeyedSeq()
4892
- .reverse()
4893
- .findKey(predicate, context);
4989
+ return this.toKeyedSeq().reverse().findKey(predicate, context);
4894
4990
  },
4895
4991
 
4896
4992
  first: function first(notSetValue) {
@@ -4913,7 +5009,7 @@
4913
5009
  return this.find(function (_, key) { return is(key, searchKey); }, undefined, notSetValue);
4914
5010
  },
4915
5011
 
4916
- getIn: getIn$1,
5012
+ getIn: getIn,
4917
5013
 
4918
5014
  groupBy: function groupBy(grouper, context) {
4919
5015
  return groupByFactory(this, grouper, context);
@@ -4923,7 +5019,7 @@
4923
5019
  return this.get(searchKey, NOT_SET) !== NOT_SET;
4924
5020
  },
4925
5021
 
4926
- hasIn: hasIn$1,
5022
+ hasIn: hasIn,
4927
5023
 
4928
5024
  isSubset: function isSubset(iter) {
4929
5025
  iter = typeof iter.includes === 'function' ? iter : Collection(iter);
@@ -4940,21 +5036,15 @@
4940
5036
  },
4941
5037
 
4942
5038
  keySeq: function keySeq() {
4943
- return this.toSeq()
4944
- .map(keyMapper)
4945
- .toIndexedSeq();
5039
+ return this.toSeq().map(keyMapper).toIndexedSeq();
4946
5040
  },
4947
5041
 
4948
5042
  last: function last(notSetValue) {
4949
- return this.toSeq()
4950
- .reverse()
4951
- .first(notSetValue);
5043
+ return this.toSeq().reverse().first(notSetValue);
4952
5044
  },
4953
5045
 
4954
5046
  lastKeyOf: function lastKeyOf(searchValue) {
4955
- return this.toKeyedSeq()
4956
- .reverse()
4957
- .keyOf(searchValue);
5047
+ return this.toKeyedSeq().reverse().keyOf(searchValue);
4958
5048
  },
4959
5049
 
4960
5050
  max: function max(comparator) {
@@ -5046,7 +5136,7 @@
5046
5136
  CollectionPrototype[ITERATOR_SYMBOL] = CollectionPrototype.values;
5047
5137
  CollectionPrototype.toJSON = CollectionPrototype.toArray;
5048
5138
  CollectionPrototype.__toStringMapper = quoteString;
5049
- CollectionPrototype.inspect = CollectionPrototype.toSource = function() {
5139
+ CollectionPrototype.inspect = CollectionPrototype.toSource = function () {
5050
5140
  return this.toString();
5051
5141
  };
5052
5142
  CollectionPrototype.chain = CollectionPrototype.flatMap;
@@ -5060,25 +5150,25 @@
5060
5150
  },
5061
5151
 
5062
5152
  mapEntries: function mapEntries(mapper, context) {
5063
- var this$1 = this;
5153
+ var this$1$1 = this;
5064
5154
 
5065
5155
  var iterations = 0;
5066
5156
  return reify(
5067
5157
  this,
5068
5158
  this.toSeq()
5069
- .map(function (v, k) { return mapper.call(context, [k, v], iterations++, this$1); })
5159
+ .map(function (v, k) { return mapper.call(context, [k, v], iterations++, this$1$1); })
5070
5160
  .fromEntrySeq()
5071
5161
  );
5072
5162
  },
5073
5163
 
5074
5164
  mapKeys: function mapKeys(mapper, context) {
5075
- var this$1 = this;
5165
+ var this$1$1 = this;
5076
5166
 
5077
5167
  return reify(
5078
5168
  this,
5079
5169
  this.toSeq()
5080
5170
  .flip()
5081
- .map(function (k, v) { return mapper.call(context, k, v, this$1); })
5171
+ .map(function (k, v) { return mapper.call(context, k, v, this$1$1); })
5082
5172
  .flip()
5083
5173
  );
5084
5174
  },
@@ -5163,7 +5253,8 @@
5163
5253
  get: function get(index, notSetValue) {
5164
5254
  index = wrapIndex(this, index);
5165
5255
  return index < 0 ||
5166
- (this.size === Infinity || (this.size !== undefined && index > this.size))
5256
+ this.size === Infinity ||
5257
+ (this.size !== undefined && index > this.size)
5167
5258
  ? notSetValue
5168
5259
  : this.find(function (_, key) { return key === index; }, undefined, notSetValue);
5169
5260
  },
@@ -5243,14 +5334,16 @@
5243
5334
  },
5244
5335
  });
5245
5336
 
5246
- SetCollection.prototype.has = CollectionPrototype.includes;
5247
- SetCollection.prototype.contains = SetCollection.prototype.includes;
5337
+ var SetCollectionPrototype = SetCollection.prototype;
5338
+ SetCollectionPrototype.has = CollectionPrototype.includes;
5339
+ SetCollectionPrototype.contains = SetCollectionPrototype.includes;
5340
+ SetCollectionPrototype.keys = SetCollectionPrototype.values;
5248
5341
 
5249
5342
  // Mixin subclasses
5250
5343
 
5251
- mixin(KeyedSeq, KeyedCollection.prototype);
5252
- mixin(IndexedSeq, IndexedCollection.prototype);
5253
- mixin(SetSeq, SetCollection.prototype);
5344
+ mixin(KeyedSeq, KeyedCollectionPrototype);
5345
+ mixin(IndexedSeq, IndexedCollectionPrototype);
5346
+ mixin(SetSeq, SetCollectionPrototype);
5254
5347
 
5255
5348
  // #pragma Helper functions
5256
5349
 
@@ -5276,13 +5369,13 @@
5276
5369
  }
5277
5370
 
5278
5371
  function not(predicate) {
5279
- return function() {
5372
+ return function () {
5280
5373
  return !predicate.apply(this, arguments);
5281
5374
  };
5282
5375
  }
5283
5376
 
5284
5377
  function neg(predicate) {
5285
- return function() {
5378
+ return function () {
5286
5379
  return -predicate.apply(this, arguments);
5287
5380
  };
5288
5381
  }
@@ -5312,12 +5405,12 @@
5312
5405
  h = (h + hashMerge(hash(v), hash(k))) | 0;
5313
5406
  }
5314
5407
  : ordered
5315
- ? function (v) {
5316
- h = (31 * h + hash(v)) | 0;
5317
- }
5318
- : function (v) {
5319
- h = (h + hash(v)) | 0;
5320
- }
5408
+ ? function (v) {
5409
+ h = (31 * h + hash(v)) | 0;
5410
+ }
5411
+ : function (v) {
5412
+ h = (h + hash(v)) | 0;
5413
+ }
5321
5414
  );
5322
5415
  return murmurHashOfSize(size, h);
5323
5416
  }
@@ -5337,21 +5430,21 @@
5337
5430
  return (a ^ (b + 0x9e3779b9 + (a << 6) + (a >> 2))) | 0; // int
5338
5431
  }
5339
5432
 
5340
- var OrderedSet = (function (Set$$1) {
5433
+ var OrderedSet = /*@__PURE__*/(function (Set) {
5341
5434
  function OrderedSet(value) {
5342
5435
  return value === null || value === undefined
5343
5436
  ? emptyOrderedSet()
5344
5437
  : isOrderedSet(value)
5345
- ? value
5346
- : emptyOrderedSet().withMutations(function (set) {
5347
- var iter = SetCollection(value);
5348
- assertNotInfinite(iter.size);
5349
- iter.forEach(function (v) { return set.add(v); });
5350
- });
5438
+ ? value
5439
+ : emptyOrderedSet().withMutations(function (set) {
5440
+ var iter = SetCollection(value);
5441
+ assertNotInfinite(iter.size);
5442
+ iter.forEach(function (v) { return set.add(v); });
5443
+ });
5351
5444
  }
5352
5445
 
5353
- if ( Set$$1 ) OrderedSet.__proto__ = Set$$1;
5354
- OrderedSet.prototype = Object.create( Set$$1 && Set$$1.prototype );
5446
+ if ( Set ) OrderedSet.__proto__ = Set;
5447
+ OrderedSet.prototype = Object.create( Set && Set.prototype );
5355
5448
  OrderedSet.prototype.constructor = OrderedSet;
5356
5449
 
5357
5450
  OrderedSet.of = function of (/*...values*/) {
@@ -5375,6 +5468,7 @@
5375
5468
  OrderedSetPrototype[IS_ORDERED_SYMBOL] = true;
5376
5469
  OrderedSetPrototype.zip = IndexedCollectionPrototype.zip;
5377
5470
  OrderedSetPrototype.zipWith = IndexedCollectionPrototype.zipWith;
5471
+ OrderedSetPrototype.zipAll = IndexedCollectionPrototype.zipAll;
5378
5472
 
5379
5473
  OrderedSetPrototype.__empty = emptyOrderedSet;
5380
5474
  OrderedSetPrototype.__make = makeOrderedSet;
@@ -5394,11 +5488,33 @@
5394
5488
  );
5395
5489
  }
5396
5490
 
5491
+ function throwOnInvalidDefaultValues(defaultValues) {
5492
+ if (isRecord(defaultValues)) {
5493
+ throw new Error(
5494
+ 'Can not call `Record` with an immutable Record as default values. Use a plain javascript object instead.'
5495
+ );
5496
+ }
5497
+
5498
+ if (isImmutable(defaultValues)) {
5499
+ throw new Error(
5500
+ 'Can not call `Record` with an immutable Collection as default values. Use a plain javascript object instead.'
5501
+ );
5502
+ }
5503
+
5504
+ if (defaultValues === null || typeof defaultValues !== 'object') {
5505
+ throw new Error(
5506
+ 'Can not call `Record` with a non-object as default values. Use a plain javascript object instead.'
5507
+ );
5508
+ }
5509
+ }
5510
+
5397
5511
  var Record = function Record(defaultValues, name) {
5398
5512
  var hasInitialized;
5399
5513
 
5514
+ throwOnInvalidDefaultValues(defaultValues);
5515
+
5400
5516
  var RecordType = function Record(values) {
5401
- var this$1 = this;
5517
+ var this$1$1 = this;
5402
5518
 
5403
5519
  if (values instanceof RecordType) {
5404
5520
  return values;
@@ -5410,6 +5526,9 @@
5410
5526
  hasInitialized = true;
5411
5527
  var keys = Object.keys(defaultValues);
5412
5528
  var indices = (RecordTypePrototype._indices = {});
5529
+ // Deprecated: left to attempt not to break any external code which
5530
+ // relies on a ._name property existing on record instances.
5531
+ // Use Record.getDescriptiveName() instead
5413
5532
  RecordTypePrototype._name = name;
5414
5533
  RecordTypePrototype._keys = keys;
5415
5534
  RecordTypePrototype._defaultValues = defaultValues;
@@ -5422,7 +5541,7 @@
5422
5541
  console.warn &&
5423
5542
  console.warn(
5424
5543
  'Cannot define ' +
5425
- recordName(this$1) +
5544
+ recordName(this) +
5426
5545
  ' with property "' +
5427
5546
  propName +
5428
5547
  '" since that property name is part of the Record API.'
@@ -5435,40 +5554,39 @@
5435
5554
  }
5436
5555
  this.__ownerID = undefined;
5437
5556
  this._values = List().withMutations(function (l) {
5438
- l.setSize(this$1._keys.length);
5557
+ l.setSize(this$1$1._keys.length);
5439
5558
  KeyedCollection(values).forEach(function (v, k) {
5440
- l.set(this$1._indices[k], v === this$1._defaultValues[k] ? undefined : v);
5559
+ l.set(this$1$1._indices[k], v === this$1$1._defaultValues[k] ? undefined : v);
5441
5560
  });
5442
5561
  });
5562
+ return this;
5443
5563
  };
5444
5564
 
5445
- var RecordTypePrototype = (RecordType.prototype = Object.create(
5446
- RecordPrototype
5447
- ));
5565
+ var RecordTypePrototype = (RecordType.prototype =
5566
+ Object.create(RecordPrototype));
5448
5567
  RecordTypePrototype.constructor = RecordType;
5449
5568
 
5569
+ if (name) {
5570
+ RecordType.displayName = name;
5571
+ }
5572
+
5450
5573
  return RecordType;
5451
5574
  };
5452
5575
 
5453
5576
  Record.prototype.toString = function toString () {
5454
- var this$1 = this;
5455
-
5456
5577
  var str = recordName(this) + ' { ';
5457
5578
  var keys = this._keys;
5458
5579
  var k;
5459
5580
  for (var i = 0, l = keys.length; i !== l; i++) {
5460
5581
  k = keys[i];
5461
- str += (i ? ', ' : '') + k + ': ' + quoteString(this$1.get(k));
5582
+ str += (i ? ', ' : '') + k + ': ' + quoteString(this.get(k));
5462
5583
  }
5463
5584
  return str + ' }';
5464
5585
  };
5465
5586
 
5466
5587
  Record.prototype.equals = function equals (other) {
5467
5588
  return (
5468
- this === other ||
5469
- (other &&
5470
- this._keys === other._keys &&
5471
- recordSeq(this).equals(recordSeq(other)))
5589
+ this === other || (other && recordSeq(this).equals(recordSeq(other)))
5472
5590
  );
5473
5591
  };
5474
5592
 
@@ -5512,6 +5630,7 @@
5512
5630
 
5513
5631
  Record.prototype.clear = function clear () {
5514
5632
  var newValues = this._values.clear().setSize(this._keys.length);
5633
+
5515
5634
  return this.__ownerID ? this : makeRecord(this, newValues);
5516
5635
  };
5517
5636
 
@@ -5558,24 +5677,24 @@
5558
5677
  RecordPrototype[IS_RECORD_SYMBOL] = true;
5559
5678
  RecordPrototype[DELETE] = RecordPrototype.remove;
5560
5679
  RecordPrototype.deleteIn = RecordPrototype.removeIn = deleteIn;
5561
- RecordPrototype.getIn = getIn$1;
5680
+ RecordPrototype.getIn = getIn;
5562
5681
  RecordPrototype.hasIn = CollectionPrototype.hasIn;
5563
- RecordPrototype.merge = merge;
5564
- RecordPrototype.mergeWith = mergeWith;
5682
+ RecordPrototype.merge = merge$1;
5683
+ RecordPrototype.mergeWith = mergeWith$1;
5565
5684
  RecordPrototype.mergeIn = mergeIn;
5566
- RecordPrototype.mergeDeep = mergeDeep$1;
5567
- RecordPrototype.mergeDeepWith = mergeDeepWith$1;
5685
+ RecordPrototype.mergeDeep = mergeDeep;
5686
+ RecordPrototype.mergeDeepWith = mergeDeepWith;
5568
5687
  RecordPrototype.mergeDeepIn = mergeDeepIn;
5569
- RecordPrototype.setIn = setIn$1;
5570
- RecordPrototype.update = update$1;
5571
- RecordPrototype.updateIn = updateIn$1;
5688
+ RecordPrototype.setIn = setIn;
5689
+ RecordPrototype.update = update;
5690
+ RecordPrototype.updateIn = updateIn;
5572
5691
  RecordPrototype.withMutations = withMutations;
5573
5692
  RecordPrototype.asMutable = asMutable;
5574
5693
  RecordPrototype.asImmutable = asImmutable;
5575
5694
  RecordPrototype[ITERATOR_SYMBOL] = RecordPrototype.entries;
5576
5695
  RecordPrototype.toJSON = RecordPrototype.toObject =
5577
5696
  CollectionPrototype.toObject;
5578
- RecordPrototype.inspect = RecordPrototype.toSource = function() {
5697
+ RecordPrototype.inspect = RecordPrototype.toSource = function () {
5579
5698
  return this.toString();
5580
5699
  };
5581
5700
 
@@ -5587,7 +5706,7 @@
5587
5706
  }
5588
5707
 
5589
5708
  function recordName(record) {
5590
- return record._name || record.constructor.name || 'Record';
5709
+ return record.constructor.displayName || record.constructor.name || 'Record';
5591
5710
  }
5592
5711
 
5593
5712
  function recordSeq(record) {
@@ -5597,10 +5716,10 @@
5597
5716
  function setProp(prototype, name) {
5598
5717
  try {
5599
5718
  Object.defineProperty(prototype, name, {
5600
- get: function() {
5719
+ get: function () {
5601
5720
  return this.get(name);
5602
5721
  },
5603
- set: function(value) {
5722
+ set: function (value) {
5604
5723
  invariant(this.__ownerID, 'Cannot set on an immutable record.');
5605
5724
  this.set(name, value);
5606
5725
  },
@@ -5614,7 +5733,7 @@
5614
5733
  * Returns a lazy Seq of `value` repeated `times` times. When `times` is
5615
5734
  * undefined, returns an infinite sequence of `value`.
5616
5735
  */
5617
- var Repeat = (function (IndexedSeq$$1) {
5736
+ var Repeat = /*@__PURE__*/(function (IndexedSeq) {
5618
5737
  function Repeat(value, times) {
5619
5738
  if (!(this instanceof Repeat)) {
5620
5739
  return new Repeat(value, times);
@@ -5629,8 +5748,8 @@
5629
5748
  }
5630
5749
  }
5631
5750
 
5632
- if ( IndexedSeq$$1 ) Repeat.__proto__ = IndexedSeq$$1;
5633
- Repeat.prototype = Object.create( IndexedSeq$$1 && IndexedSeq$$1.prototype );
5751
+ if ( IndexedSeq ) Repeat.__proto__ = IndexedSeq;
5752
+ Repeat.prototype = Object.create( IndexedSeq && IndexedSeq.prototype );
5634
5753
  Repeat.prototype.constructor = Repeat;
5635
5754
 
5636
5755
  Repeat.prototype.toString = function toString () {
@@ -5677,12 +5796,10 @@
5677
5796
  };
5678
5797
 
5679
5798
  Repeat.prototype.__iterate = function __iterate (fn, reverse) {
5680
- var this$1 = this;
5681
-
5682
5799
  var size = this.size;
5683
5800
  var i = 0;
5684
5801
  while (i !== size) {
5685
- if (fn(this$1._value, reverse ? size - ++i : i++, this$1) === false) {
5802
+ if (fn(this._value, reverse ? size - ++i : i++, this) === false) {
5686
5803
  break;
5687
5804
  }
5688
5805
  }
@@ -5690,14 +5807,13 @@
5690
5807
  };
5691
5808
 
5692
5809
  Repeat.prototype.__iterator = function __iterator (type, reverse) {
5693
- var this$1 = this;
5810
+ var this$1$1 = this;
5694
5811
 
5695
5812
  var size = this.size;
5696
5813
  var i = 0;
5697
- return new Iterator(
5698
- function () { return i === size
5699
- ? iteratorDone()
5700
- : iteratorValue(type, reverse ? size - ++i : i++, this$1._value); }
5814
+ return new Iterator(function () { return i === size
5815
+ ? iteratorDone()
5816
+ : iteratorValue(type, reverse ? size - ++i : i++, this$1$1._value); }
5701
5817
  );
5702
5818
  };
5703
5819
 
@@ -5724,12 +5840,11 @@
5724
5840
  }
5725
5841
 
5726
5842
  function fromJSWith(stack, converter, value, key, keyPath, parentValue) {
5727
- var toSeq = Array.isArray(value)
5728
- ? IndexedSeq
5729
- : isPlainObj(value)
5730
- ? KeyedSeq
5731
- : null;
5732
- if (toSeq) {
5843
+ if (
5844
+ typeof value !== 'string' &&
5845
+ !isImmutable(value) &&
5846
+ (isArrayLike(value) || hasIterator(value) || isPlainObject(value))
5847
+ ) {
5733
5848
  if (~stack.indexOf(value)) {
5734
5849
  throw new TypeError('Cannot convert circular structure to Immutable');
5735
5850
  }
@@ -5738,7 +5853,7 @@
5738
5853
  var converted = converter.call(
5739
5854
  parentValue,
5740
5855
  key,
5741
- toSeq(value).map(function (v, k) { return fromJSWith(stack, converter, v, k, keyPath, value); }
5856
+ Seq(value).map(function (v, k) { return fromJSWith(stack, converter, v, k, keyPath, value); }
5742
5857
  ),
5743
5858
  keyPath && keyPath.slice()
5744
5859
  );
@@ -5750,10 +5865,11 @@
5750
5865
  }
5751
5866
 
5752
5867
  function defaultConverter(k, v) {
5753
- return isKeyed(v) ? v.toMap() : v.toList();
5868
+ // Effectively the opposite of "Collection.toSeq()"
5869
+ return isIndexed(v) ? v.toList() : isKeyed(v) ? v.toMap() : v.toSet();
5754
5870
  }
5755
5871
 
5756
- var version = "4.0.0-rc.10";
5872
+ var version = "4.0.0-rc.15";
5757
5873
 
5758
5874
  var Immutable = {
5759
5875
  version: version,
@@ -5785,6 +5901,7 @@
5785
5901
  isAssociative: isAssociative,
5786
5902
  isOrdered: isOrdered,
5787
5903
  isValueObject: isValueObject,
5904
+ isPlainObject: isPlainObject,
5788
5905
  isSeq: isSeq,
5789
5906
  isList: isList,
5790
5907
  isMap: isMap,
@@ -5795,62 +5912,71 @@
5795
5912
  isRecord: isRecord,
5796
5913
 
5797
5914
  get: get,
5798
- getIn: getIn,
5915
+ getIn: getIn$1,
5799
5916
  has: has,
5800
- hasIn: hasIn,
5801
- merge: merge$1,
5802
- mergeDeep: mergeDeep,
5803
- mergeWith: mergeWith$1,
5804
- mergeDeepWith: mergeDeepWith,
5917
+ hasIn: hasIn$1,
5918
+ merge: merge,
5919
+ mergeDeep: mergeDeep$1,
5920
+ mergeWith: mergeWith,
5921
+ mergeDeepWith: mergeDeepWith$1,
5805
5922
  remove: remove,
5806
5923
  removeIn: removeIn,
5807
5924
  set: set,
5808
- setIn: setIn,
5809
- update: update,
5810
- updateIn: updateIn,
5925
+ setIn: setIn$1,
5926
+ update: update$1,
5927
+ updateIn: updateIn$1,
5811
5928
  };
5812
5929
 
5813
5930
  // Note: Iterable is deprecated
5814
5931
  var Iterable = Collection;
5815
5932
 
5816
- exports.default = Immutable;
5817
- exports.version = version;
5818
5933
  exports.Collection = Collection;
5819
5934
  exports.Iterable = Iterable;
5820
- exports.Seq = Seq;
5935
+ exports.List = List;
5821
5936
  exports.Map = Map;
5822
5937
  exports.OrderedMap = OrderedMap;
5823
- exports.List = List;
5824
- exports.Stack = Stack;
5825
- exports.Set = Set;
5826
5938
  exports.OrderedSet = OrderedSet;
5827
- exports.Record = Record;
5828
5939
  exports.Range = Range;
5940
+ exports.Record = Record;
5829
5941
  exports.Repeat = Repeat;
5830
- exports.is = is;
5942
+ exports.Seq = Seq;
5943
+ exports.Set = Set;
5944
+ exports.Stack = Stack;
5945
+ exports.default = Immutable;
5831
5946
  exports.fromJS = fromJS;
5947
+ exports.get = get;
5948
+ exports.getIn = getIn$1;
5949
+ exports.has = has;
5950
+ exports.hasIn = hasIn$1;
5832
5951
  exports.hash = hash;
5833
- exports.isImmutable = isImmutable;
5952
+ exports.is = is;
5953
+ exports.isAssociative = isAssociative;
5834
5954
  exports.isCollection = isCollection;
5835
- exports.isKeyed = isKeyed;
5955
+ exports.isImmutable = isImmutable;
5836
5956
  exports.isIndexed = isIndexed;
5837
- exports.isAssociative = isAssociative;
5957
+ exports.isKeyed = isKeyed;
5958
+ exports.isList = isList;
5959
+ exports.isMap = isMap;
5838
5960
  exports.isOrdered = isOrdered;
5961
+ exports.isOrderedMap = isOrderedMap;
5962
+ exports.isOrderedSet = isOrderedSet;
5963
+ exports.isPlainObject = isPlainObject;
5964
+ exports.isRecord = isRecord;
5965
+ exports.isSeq = isSeq;
5966
+ exports.isSet = isSet;
5967
+ exports.isStack = isStack;
5839
5968
  exports.isValueObject = isValueObject;
5840
- exports.get = get;
5841
- exports.getIn = getIn;
5842
- exports.has = has;
5843
- exports.hasIn = hasIn;
5844
- exports.merge = merge$1;
5845
- exports.mergeDeep = mergeDeep;
5846
- exports.mergeWith = mergeWith$1;
5847
- exports.mergeDeepWith = mergeDeepWith;
5969
+ exports.merge = merge;
5970
+ exports.mergeDeep = mergeDeep$1;
5971
+ exports.mergeDeepWith = mergeDeepWith$1;
5972
+ exports.mergeWith = mergeWith;
5848
5973
  exports.remove = remove;
5849
5974
  exports.removeIn = removeIn;
5850
5975
  exports.set = set;
5851
- exports.setIn = setIn;
5852
- exports.update = update;
5853
- exports.updateIn = updateIn;
5976
+ exports.setIn = setIn$1;
5977
+ exports.update = update$1;
5978
+ exports.updateIn = updateIn$1;
5979
+ exports.version = version;
5854
5980
 
5855
5981
  Object.defineProperty(exports, '__esModule', { value: true });
5856
5982