immutable 4.0.0-rc.12 → 4.0.0-rc.14

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.
@@ -1,11 +1,26 @@
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
- // Used for setting prototype methods that IE8 chokes on.
9
24
  var DELETE = 'delete';
10
25
 
11
26
  // Constants describing the size of trie nodes.
@@ -84,12 +99,12 @@ function resolveIndex(index, size, defaultIndex) {
84
99
  return index === undefined
85
100
  ? defaultIndex
86
101
  : isNeg(index)
87
- ? size === Infinity
88
- ? size
89
- : Math.max(0, size + index) | 0
90
- : size === undefined || size === index
91
- ? index
92
- : Math.min(size, index) | 0;
102
+ ? size === Infinity
103
+ ? size
104
+ : Math.max(0, size + index) | 0
105
+ : size === undefined || size === index
106
+ ? index
107
+ : Math.min(size, index) | 0;
93
108
  }
94
109
 
95
110
  function isNeg(value) {
@@ -97,7 +112,6 @@ function isNeg(value) {
97
112
  return value < 0 || (value === 0 && 1 / value === -Infinity);
98
113
  }
99
114
 
100
- // Note: value is unchanged to not break immutable-devtools.
101
115
  var IS_COLLECTION_SYMBOL = '@@__IMMUTABLE_ITERABLE__@@';
102
116
 
103
117
  function isCollection(maybeCollection) {
@@ -207,10 +221,10 @@ Iterator.KEYS = ITERATE_KEYS;
207
221
  Iterator.VALUES = ITERATE_VALUES;
208
222
  Iterator.ENTRIES = ITERATE_ENTRIES;
209
223
 
210
- Iterator.prototype.inspect = Iterator.prototype.toSource = function() {
224
+ Iterator.prototype.inspect = Iterator.prototype.toSource = function () {
211
225
  return this.toString();
212
226
  };
213
- Iterator.prototype[ITERATOR_SYMBOL] = function() {
227
+ Iterator.prototype[ITERATOR_SYMBOL] = function () {
214
228
  return this;
215
229
  };
216
230
 
@@ -273,17 +287,17 @@ function isArrayLike(value) {
273
287
  );
274
288
  }
275
289
 
276
- var Seq = /*@__PURE__*/(function (Collection$$1) {
290
+ var Seq = /*@__PURE__*/(function (Collection) {
277
291
  function Seq(value) {
278
292
  return value === null || value === undefined
279
293
  ? emptySequence()
280
294
  : isImmutable(value)
281
- ? value.toSeq()
282
- : seqFromValue(value);
295
+ ? value.toSeq()
296
+ : seqFromValue(value);
283
297
  }
284
298
 
285
- if ( Collection$$1 ) Seq.__proto__ = Collection$$1;
286
- Seq.prototype = Object.create( Collection$$1 && Collection$$1.prototype );
299
+ if ( Collection ) Seq.__proto__ = Collection;
300
+ Seq.prototype = Object.create( Collection && Collection.prototype );
287
301
  Seq.prototype.constructor = Seq;
288
302
 
289
303
  Seq.prototype.toSeq = function toSeq () {
@@ -346,12 +360,12 @@ var KeyedSeq = /*@__PURE__*/(function (Seq) {
346
360
  return value === null || value === undefined
347
361
  ? emptySequence().toKeyedSeq()
348
362
  : isCollection(value)
349
- ? isKeyed(value)
350
- ? value.toSeq()
351
- : value.fromEntrySeq()
352
- : isRecord(value)
353
- ? value.toSeq()
354
- : keyedSeqFromValue(value);
363
+ ? isKeyed(value)
364
+ ? value.toSeq()
365
+ : value.fromEntrySeq()
366
+ : isRecord(value)
367
+ ? value.toSeq()
368
+ : keyedSeqFromValue(value);
355
369
  }
356
370
 
357
371
  if ( Seq ) KeyedSeq.__proto__ = Seq;
@@ -370,12 +384,12 @@ var IndexedSeq = /*@__PURE__*/(function (Seq) {
370
384
  return value === null || value === undefined
371
385
  ? emptySequence()
372
386
  : isCollection(value)
373
- ? isKeyed(value)
374
- ? value.entrySeq()
375
- : value.toIndexedSeq()
376
- : isRecord(value)
377
- ? value.toSeq().entrySeq()
378
- : indexedSeqFromValue(value);
387
+ ? isKeyed(value)
388
+ ? value.entrySeq()
389
+ : value.toIndexedSeq()
390
+ : isRecord(value)
391
+ ? value.toSeq().entrySeq()
392
+ : indexedSeqFromValue(value);
379
393
  }
380
394
 
381
395
  if ( Seq ) IndexedSeq.__proto__ = Seq;
@@ -399,9 +413,8 @@ var IndexedSeq = /*@__PURE__*/(function (Seq) {
399
413
 
400
414
  var SetSeq = /*@__PURE__*/(function (Seq) {
401
415
  function SetSeq(value) {
402
- return (isCollection(value) && !isAssociative(value)
403
- ? value
404
- : IndexedSeq(value)
416
+ return (
417
+ isCollection(value) && !isAssociative(value) ? value : IndexedSeq(value)
405
418
  ).toSetSeq();
406
419
  }
407
420
 
@@ -586,8 +599,8 @@ function keyedSeqFromValue(value) {
586
599
  var seq = Array.isArray(value)
587
600
  ? new ArraySeq(value)
588
601
  : hasIterator(value)
589
- ? new CollectionSeq(value)
590
- : undefined;
602
+ ? new CollectionSeq(value)
603
+ : undefined;
591
604
  if (seq) {
592
605
  return seq.fromEntrySeq();
593
606
  }
@@ -627,8 +640,8 @@ function maybeIndexedSeqFromValue(value) {
627
640
  return isArrayLike(value)
628
641
  ? new ArraySeq(value)
629
642
  : hasIterator(value)
630
- ? new CollectionSeq(value)
631
- : undefined;
643
+ ? new CollectionSeq(value)
644
+ : undefined;
632
645
  }
633
646
 
634
647
  var IS_MAP_SYMBOL = '@@__IMMUTABLE_MAP__@@';
@@ -753,41 +766,50 @@ function smi(i32) {
753
766
  var defaultValueOf = Object.prototype.valueOf;
754
767
 
755
768
  function hash(o) {
756
- switch (typeof o) {
769
+ if (o == null) {
770
+ return hashNullish(o);
771
+ }
772
+
773
+ if (typeof o.hashCode === 'function') {
774
+ // Drop any high bits from accidentally long hash codes.
775
+ return smi(o.hashCode(o));
776
+ }
777
+
778
+ var v = valueOf(o);
779
+
780
+ if (v == null) {
781
+ return hashNullish(v);
782
+ }
783
+
784
+ switch (typeof v) {
757
785
  case 'boolean':
758
786
  // The hash values for built-in constants are a 1 value for each 5-byte
759
787
  // shift region expect for the first, which encodes the value. This
760
788
  // reduces the odds of a hash collision for these common values.
761
- return o ? 0x42108421 : 0x42108420;
789
+ return v ? 0x42108421 : 0x42108420;
762
790
  case 'number':
763
- return hashNumber(o);
791
+ return hashNumber(v);
764
792
  case 'string':
765
- return o.length > STRING_HASH_CACHE_MIN_STRLEN
766
- ? cachedHashString(o)
767
- : hashString(o);
793
+ return v.length > STRING_HASH_CACHE_MIN_STRLEN
794
+ ? cachedHashString(v)
795
+ : hashString(v);
768
796
  case 'object':
769
797
  case 'function':
770
- if (o === null) {
771
- return 0x42108422;
772
- }
773
- if (typeof o.hashCode === 'function') {
774
- // Drop any high bits from accidentally long hash codes.
775
- return smi(o.hashCode(o));
776
- }
777
- if (o.valueOf !== defaultValueOf && typeof o.valueOf === 'function') {
778
- o = o.valueOf(o);
779
- }
780
- return hashJSObj(o);
781
- case 'undefined':
782
- return 0x42108423;
798
+ return hashJSObj(v);
799
+ case 'symbol':
800
+ return hashSymbol(v);
783
801
  default:
784
- if (typeof o.toString === 'function') {
785
- return hashString(o.toString());
802
+ if (typeof v.toString === 'function') {
803
+ return hashString(v.toString());
786
804
  }
787
- throw new Error('Value type ' + typeof o + ' cannot be hashed.');
805
+ throw new Error('Value type ' + typeof v + ' cannot be hashed.');
788
806
  }
789
807
  }
790
808
 
809
+ function hashNullish(nullish) {
810
+ return nullish === null ? 0x42108422 : /* undefined */ 0x42108423;
811
+ }
812
+
791
813
  // Compress arbitrarily large numbers into smi hashes.
792
814
  function hashNumber(n) {
793
815
  if (n !== n || n === Infinity) {
@@ -833,6 +855,19 @@ function hashString(string) {
833
855
  return smi(hashed);
834
856
  }
835
857
 
858
+ function hashSymbol(sym) {
859
+ var hashed = symbolMap[sym];
860
+ if (hashed !== undefined) {
861
+ return hashed;
862
+ }
863
+
864
+ hashed = nextHash();
865
+
866
+ symbolMap[sym] = hashed;
867
+
868
+ return hashed;
869
+ }
870
+
836
871
  function hashJSObj(obj) {
837
872
  var hashed;
838
873
  if (usingWeakMap) {
@@ -859,10 +894,7 @@ function hashJSObj(obj) {
859
894
  }
860
895
  }
861
896
 
862
- hashed = ++objHashUID;
863
- if (objHashUID & 0x40000000) {
864
- objHashUID = 0;
865
- }
897
+ hashed = nextHash();
866
898
 
867
899
  if (usingWeakMap) {
868
900
  weakMap.set(obj, hashed);
@@ -883,7 +915,7 @@ function hashJSObj(obj) {
883
915
  // we'll hijack one of the less-used non-enumerable properties to
884
916
  // save our hash on it. Since this is a function it will not show up in
885
917
  // `JSON.stringify` which is what we want.
886
- obj.propertyIsEnumerable = function() {
918
+ obj.propertyIsEnumerable = function () {
887
919
  return this.constructor.prototype.propertyIsEnumerable.apply(
888
920
  this,
889
921
  arguments
@@ -907,7 +939,7 @@ function hashJSObj(obj) {
907
939
  var isExtensible = Object.isExtensible;
908
940
 
909
941
  // True if Object.defineProperty works as expected. IE8 fails this test.
910
- var canDefineProperty = (function() {
942
+ var canDefineProperty = (function () {
911
943
  try {
912
944
  Object.defineProperty({}, '@', {});
913
945
  return true;
@@ -929,6 +961,20 @@ function getIENodeHash(node) {
929
961
  }
930
962
  }
931
963
 
964
+ function valueOf(obj) {
965
+ return obj.valueOf !== defaultValueOf && typeof obj.valueOf === 'function'
966
+ ? obj.valueOf(obj)
967
+ : obj;
968
+ }
969
+
970
+ function nextHash() {
971
+ var nextHash = ++_objHashUID;
972
+ if (_objHashUID & 0x40000000) {
973
+ _objHashUID = 0;
974
+ }
975
+ return nextHash;
976
+ }
977
+
932
978
  // If possible, use a WeakMap.
933
979
  var usingWeakMap = typeof WeakMap === 'function';
934
980
  var weakMap;
@@ -936,7 +982,9 @@ if (usingWeakMap) {
936
982
  weakMap = new WeakMap();
937
983
  }
938
984
 
939
- var objHashUID = 0;
985
+ var symbolMap = Object.create(null);
986
+
987
+ var _objHashUID = 0;
940
988
 
941
989
  var UID_HASH_KEY = '__immutablehash__';
942
990
  if (typeof Symbol === 'function') {
@@ -948,15 +996,15 @@ var STRING_HASH_CACHE_MAX_SIZE = 255;
948
996
  var STRING_HASH_CACHE_SIZE = 0;
949
997
  var stringHashCache = {};
950
998
 
951
- var ToKeyedSequence = /*@__PURE__*/(function (KeyedSeq$$1) {
999
+ var ToKeyedSequence = /*@__PURE__*/(function (KeyedSeq) {
952
1000
  function ToKeyedSequence(indexed, useKeys) {
953
1001
  this._iter = indexed;
954
1002
  this._useKeys = useKeys;
955
1003
  this.size = indexed.size;
956
1004
  }
957
1005
 
958
- if ( KeyedSeq$$1 ) ToKeyedSequence.__proto__ = KeyedSeq$$1;
959
- ToKeyedSequence.prototype = Object.create( KeyedSeq$$1 && KeyedSeq$$1.prototype );
1006
+ if ( KeyedSeq ) ToKeyedSequence.__proto__ = KeyedSeq;
1007
+ ToKeyedSequence.prototype = Object.create( KeyedSeq && KeyedSeq.prototype );
960
1008
  ToKeyedSequence.prototype.constructor = ToKeyedSequence;
961
1009
 
962
1010
  ToKeyedSequence.prototype.get = function get (key, notSetValue) {
@@ -972,29 +1020,29 @@ var ToKeyedSequence = /*@__PURE__*/(function (KeyedSeq$$1) {
972
1020
  };
973
1021
 
974
1022
  ToKeyedSequence.prototype.reverse = function reverse () {
975
- var this$1 = this;
1023
+ var this$1$1 = this;
976
1024
 
977
1025
  var reversedSequence = reverseFactory(this, true);
978
1026
  if (!this._useKeys) {
979
- reversedSequence.valueSeq = function () { return this$1._iter.toSeq().reverse(); };
1027
+ reversedSequence.valueSeq = function () { return this$1$1._iter.toSeq().reverse(); };
980
1028
  }
981
1029
  return reversedSequence;
982
1030
  };
983
1031
 
984
1032
  ToKeyedSequence.prototype.map = function map (mapper, context) {
985
- var this$1 = this;
1033
+ var this$1$1 = this;
986
1034
 
987
1035
  var mappedSequence = mapFactory(this, mapper, context);
988
1036
  if (!this._useKeys) {
989
- mappedSequence.valueSeq = function () { return this$1._iter.toSeq().map(mapper, context); };
1037
+ mappedSequence.valueSeq = function () { return this$1$1._iter.toSeq().map(mapper, context); };
990
1038
  }
991
1039
  return mappedSequence;
992
1040
  };
993
1041
 
994
1042
  ToKeyedSequence.prototype.__iterate = function __iterate (fn, reverse) {
995
- var this$1 = this;
1043
+ var this$1$1 = this;
996
1044
 
997
- return this._iter.__iterate(function (v, k) { return fn(v, k, this$1); }, reverse);
1045
+ return this._iter.__iterate(function (v, k) { return fn(v, k, this$1$1); }, reverse);
998
1046
  };
999
1047
 
1000
1048
  ToKeyedSequence.prototype.__iterator = function __iterator (type, reverse) {
@@ -1005,14 +1053,14 @@ var ToKeyedSequence = /*@__PURE__*/(function (KeyedSeq$$1) {
1005
1053
  }(KeyedSeq));
1006
1054
  ToKeyedSequence.prototype[IS_ORDERED_SYMBOL] = true;
1007
1055
 
1008
- var ToIndexedSequence = /*@__PURE__*/(function (IndexedSeq$$1) {
1056
+ var ToIndexedSequence = /*@__PURE__*/(function (IndexedSeq) {
1009
1057
  function ToIndexedSequence(iter) {
1010
1058
  this._iter = iter;
1011
1059
  this.size = iter.size;
1012
1060
  }
1013
1061
 
1014
- if ( IndexedSeq$$1 ) ToIndexedSequence.__proto__ = IndexedSeq$$1;
1015
- ToIndexedSequence.prototype = Object.create( IndexedSeq$$1 && IndexedSeq$$1.prototype );
1062
+ if ( IndexedSeq ) ToIndexedSequence.__proto__ = IndexedSeq;
1063
+ ToIndexedSequence.prototype = Object.create( IndexedSeq && IndexedSeq.prototype );
1016
1064
  ToIndexedSequence.prototype.constructor = ToIndexedSequence;
1017
1065
 
1018
1066
  ToIndexedSequence.prototype.includes = function includes (value) {
@@ -1020,18 +1068,18 @@ var ToIndexedSequence = /*@__PURE__*/(function (IndexedSeq$$1) {
1020
1068
  };
1021
1069
 
1022
1070
  ToIndexedSequence.prototype.__iterate = function __iterate (fn, reverse) {
1023
- var this$1 = this;
1071
+ var this$1$1 = this;
1024
1072
 
1025
1073
  var i = 0;
1026
1074
  reverse && ensureSize(this);
1027
1075
  return this._iter.__iterate(
1028
- function (v) { return fn(v, reverse ? this$1.size - ++i : i++, this$1); },
1076
+ function (v) { return fn(v, reverse ? this$1$1.size - ++i : i++, this$1$1); },
1029
1077
  reverse
1030
1078
  );
1031
1079
  };
1032
1080
 
1033
1081
  ToIndexedSequence.prototype.__iterator = function __iterator (type, reverse) {
1034
- var this$1 = this;
1082
+ var this$1$1 = this;
1035
1083
 
1036
1084
  var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);
1037
1085
  var i = 0;
@@ -1042,7 +1090,7 @@ var ToIndexedSequence = /*@__PURE__*/(function (IndexedSeq$$1) {
1042
1090
  ? step
1043
1091
  : iteratorValue(
1044
1092
  type,
1045
- reverse ? this$1.size - ++i : i++,
1093
+ reverse ? this$1$1.size - ++i : i++,
1046
1094
  step.value,
1047
1095
  step
1048
1096
  );
@@ -1052,14 +1100,14 @@ var ToIndexedSequence = /*@__PURE__*/(function (IndexedSeq$$1) {
1052
1100
  return ToIndexedSequence;
1053
1101
  }(IndexedSeq));
1054
1102
 
1055
- var ToSetSequence = /*@__PURE__*/(function (SetSeq$$1) {
1103
+ var ToSetSequence = /*@__PURE__*/(function (SetSeq) {
1056
1104
  function ToSetSequence(iter) {
1057
1105
  this._iter = iter;
1058
1106
  this.size = iter.size;
1059
1107
  }
1060
1108
 
1061
- if ( SetSeq$$1 ) ToSetSequence.__proto__ = SetSeq$$1;
1062
- ToSetSequence.prototype = Object.create( SetSeq$$1 && SetSeq$$1.prototype );
1109
+ if ( SetSeq ) ToSetSequence.__proto__ = SetSeq;
1110
+ ToSetSequence.prototype = Object.create( SetSeq && SetSeq.prototype );
1063
1111
  ToSetSequence.prototype.constructor = ToSetSequence;
1064
1112
 
1065
1113
  ToSetSequence.prototype.has = function has (key) {
@@ -1067,9 +1115,9 @@ var ToSetSequence = /*@__PURE__*/(function (SetSeq$$1) {
1067
1115
  };
1068
1116
 
1069
1117
  ToSetSequence.prototype.__iterate = function __iterate (fn, reverse) {
1070
- var this$1 = this;
1118
+ var this$1$1 = this;
1071
1119
 
1072
- return this._iter.__iterate(function (v) { return fn(v, v, this$1); }, reverse);
1120
+ return this._iter.__iterate(function (v) { return fn(v, v, this$1$1); }, reverse);
1073
1121
  };
1074
1122
 
1075
1123
  ToSetSequence.prototype.__iterator = function __iterator (type, reverse) {
@@ -1085,14 +1133,14 @@ var ToSetSequence = /*@__PURE__*/(function (SetSeq$$1) {
1085
1133
  return ToSetSequence;
1086
1134
  }(SetSeq));
1087
1135
 
1088
- var FromEntriesSequence = /*@__PURE__*/(function (KeyedSeq$$1) {
1136
+ var FromEntriesSequence = /*@__PURE__*/(function (KeyedSeq) {
1089
1137
  function FromEntriesSequence(entries) {
1090
1138
  this._iter = entries;
1091
1139
  this.size = entries.size;
1092
1140
  }
1093
1141
 
1094
- if ( KeyedSeq$$1 ) FromEntriesSequence.__proto__ = KeyedSeq$$1;
1095
- FromEntriesSequence.prototype = Object.create( KeyedSeq$$1 && KeyedSeq$$1.prototype );
1142
+ if ( KeyedSeq ) FromEntriesSequence.__proto__ = KeyedSeq;
1143
+ FromEntriesSequence.prototype = Object.create( KeyedSeq && KeyedSeq.prototype );
1096
1144
  FromEntriesSequence.prototype.constructor = FromEntriesSequence;
1097
1145
 
1098
1146
  FromEntriesSequence.prototype.entrySeq = function entrySeq () {
@@ -1100,7 +1148,7 @@ var FromEntriesSequence = /*@__PURE__*/(function (KeyedSeq$$1) {
1100
1148
  };
1101
1149
 
1102
1150
  FromEntriesSequence.prototype.__iterate = function __iterate (fn, reverse) {
1103
- var this$1 = this;
1151
+ var this$1$1 = this;
1104
1152
 
1105
1153
  return this._iter.__iterate(function (entry) {
1106
1154
  // Check if entry exists first so array access doesn't throw for holes
@@ -1111,7 +1159,7 @@ var FromEntriesSequence = /*@__PURE__*/(function (KeyedSeq$$1) {
1111
1159
  return fn(
1112
1160
  indexedCollection ? entry.get(1) : entry[1],
1113
1161
  indexedCollection ? entry.get(0) : entry[0],
1114
- this$1
1162
+ this$1$1
1115
1163
  );
1116
1164
  }
1117
1165
  }, reverse);
@@ -1145,14 +1193,18 @@ var FromEntriesSequence = /*@__PURE__*/(function (KeyedSeq$$1) {
1145
1193
  return FromEntriesSequence;
1146
1194
  }(KeyedSeq));
1147
1195
 
1148
- ToIndexedSequence.prototype.cacheResult = ToKeyedSequence.prototype.cacheResult = ToSetSequence.prototype.cacheResult = FromEntriesSequence.prototype.cacheResult = cacheResultThrough;
1196
+ ToIndexedSequence.prototype.cacheResult =
1197
+ ToKeyedSequence.prototype.cacheResult =
1198
+ ToSetSequence.prototype.cacheResult =
1199
+ FromEntriesSequence.prototype.cacheResult =
1200
+ cacheResultThrough;
1149
1201
 
1150
1202
  function flipFactory(collection) {
1151
1203
  var flipSequence = makeSequence(collection);
1152
1204
  flipSequence._iter = collection;
1153
1205
  flipSequence.size = collection.size;
1154
1206
  flipSequence.flip = function () { return collection; };
1155
- flipSequence.reverse = function() {
1207
+ flipSequence.reverse = function () {
1156
1208
  var reversedSequence = collection.reverse.apply(this); // super.reverse()
1157
1209
  reversedSequence.flip = function () { return collection.reverse(); };
1158
1210
  return reversedSequence;
@@ -1160,12 +1212,12 @@ function flipFactory(collection) {
1160
1212
  flipSequence.has = function (key) { return collection.includes(key); };
1161
1213
  flipSequence.includes = function (key) { return collection.has(key); };
1162
1214
  flipSequence.cacheResult = cacheResultThrough;
1163
- flipSequence.__iterateUncached = function(fn, reverse) {
1164
- var this$1 = this;
1215
+ flipSequence.__iterateUncached = function (fn, reverse) {
1216
+ var this$1$1 = this;
1165
1217
 
1166
- return collection.__iterate(function (v, k) { return fn(k, v, this$1) !== false; }, reverse);
1218
+ return collection.__iterate(function (v, k) { return fn(k, v, this$1$1) !== false; }, reverse);
1167
1219
  };
1168
- flipSequence.__iteratorUncached = function(type, reverse) {
1220
+ flipSequence.__iteratorUncached = function (type, reverse) {
1169
1221
  if (type === ITERATE_ENTRIES) {
1170
1222
  var iterator = collection.__iterator(type, reverse);
1171
1223
  return new Iterator(function () {
@@ -1196,15 +1248,15 @@ function mapFactory(collection, mapper, context) {
1196
1248
  ? notSetValue
1197
1249
  : mapper.call(context, v, key, collection);
1198
1250
  };
1199
- mappedSequence.__iterateUncached = function(fn, reverse) {
1200
- var this$1 = this;
1251
+ mappedSequence.__iterateUncached = function (fn, reverse) {
1252
+ var this$1$1 = this;
1201
1253
 
1202
1254
  return collection.__iterate(
1203
- function (v, k, c) { return fn(mapper.call(context, v, k, c), k, this$1) !== false; },
1255
+ function (v, k, c) { return fn(mapper.call(context, v, k, c), k, this$1$1) !== false; },
1204
1256
  reverse
1205
1257
  );
1206
1258
  };
1207
- mappedSequence.__iteratorUncached = function(type, reverse) {
1259
+ mappedSequence.__iteratorUncached = function (type, reverse) {
1208
1260
  var iterator = collection.__iterator(ITERATE_ENTRIES, reverse);
1209
1261
  return new Iterator(function () {
1210
1262
  var step = iterator.next();
@@ -1225,14 +1277,14 @@ function mapFactory(collection, mapper, context) {
1225
1277
  }
1226
1278
 
1227
1279
  function reverseFactory(collection, useKeys) {
1228
- var this$1 = this;
1280
+ var this$1$1 = this;
1229
1281
 
1230
1282
  var reversedSequence = makeSequence(collection);
1231
1283
  reversedSequence._iter = collection;
1232
1284
  reversedSequence.size = collection.size;
1233
1285
  reversedSequence.reverse = function () { return collection; };
1234
1286
  if (collection.flip) {
1235
- reversedSequence.flip = function() {
1287
+ reversedSequence.flip = function () {
1236
1288
  var flipSequence = flipFactory(collection);
1237
1289
  flipSequence.reverse = function () { return collection.flip(); };
1238
1290
  return flipSequence;
@@ -1242,13 +1294,13 @@ function reverseFactory(collection, useKeys) {
1242
1294
  reversedSequence.has = function (key) { return collection.has(useKeys ? key : -1 - key); };
1243
1295
  reversedSequence.includes = function (value) { return collection.includes(value); };
1244
1296
  reversedSequence.cacheResult = cacheResultThrough;
1245
- reversedSequence.__iterate = function(fn, reverse) {
1246
- var this$1 = this;
1297
+ reversedSequence.__iterate = function (fn, reverse) {
1298
+ var this$1$1 = this;
1247
1299
 
1248
1300
  var i = 0;
1249
1301
  reverse && ensureSize(collection);
1250
1302
  return collection.__iterate(
1251
- function (v, k) { return fn(v, useKeys ? k : reverse ? this$1.size - ++i : i++, this$1); },
1303
+ function (v, k) { return fn(v, useKeys ? k : reverse ? this$1$1.size - ++i : i++, this$1$1); },
1252
1304
  !reverse
1253
1305
  );
1254
1306
  };
@@ -1264,7 +1316,7 @@ function reverseFactory(collection, useKeys) {
1264
1316
  var entry = step.value;
1265
1317
  return iteratorValue(
1266
1318
  type,
1267
- useKeys ? entry[0] : reverse ? this$1.size - ++i : i++,
1319
+ useKeys ? entry[0] : reverse ? this$1$1.size - ++i : i++,
1268
1320
  entry[1],
1269
1321
  step
1270
1322
  );
@@ -1287,19 +1339,19 @@ function filterFactory(collection, predicate, context, useKeys) {
1287
1339
  : notSetValue;
1288
1340
  };
1289
1341
  }
1290
- filterSequence.__iterateUncached = function(fn, reverse) {
1291
- var this$1 = this;
1342
+ filterSequence.__iterateUncached = function (fn, reverse) {
1343
+ var this$1$1 = this;
1292
1344
 
1293
1345
  var iterations = 0;
1294
1346
  collection.__iterate(function (v, k, c) {
1295
1347
  if (predicate.call(context, v, k, c)) {
1296
1348
  iterations++;
1297
- return fn(v, useKeys ? k : iterations - 1, this$1);
1349
+ return fn(v, useKeys ? k : iterations - 1, this$1$1);
1298
1350
  }
1299
1351
  }, reverse);
1300
1352
  return iterations;
1301
1353
  };
1302
- filterSequence.__iteratorUncached = function(type, reverse) {
1354
+ filterSequence.__iteratorUncached = function (type, reverse) {
1303
1355
  var iterator = collection.__iterator(ITERATE_ENTRIES, reverse);
1304
1356
  var iterations = 0;
1305
1357
  return new Iterator(function () {
@@ -1376,7 +1428,7 @@ function sliceFactory(collection, begin, end, useKeys) {
1376
1428
  sliceSize === 0 ? sliceSize : (collection.size && sliceSize) || undefined;
1377
1429
 
1378
1430
  if (!useKeys && isSeq(collection) && sliceSize >= 0) {
1379
- sliceSeq.get = function(index, notSetValue) {
1431
+ sliceSeq.get = function (index, notSetValue) {
1380
1432
  index = wrapIndex(this, index);
1381
1433
  return index >= 0 && index < sliceSize
1382
1434
  ? collection.get(index + resolvedBegin, notSetValue)
@@ -1384,8 +1436,8 @@ function sliceFactory(collection, begin, end, useKeys) {
1384
1436
  };
1385
1437
  }
1386
1438
 
1387
- sliceSeq.__iterateUncached = function(fn, reverse) {
1388
- var this$1 = this;
1439
+ sliceSeq.__iterateUncached = function (fn, reverse) {
1440
+ var this$1$1 = this;
1389
1441
 
1390
1442
  if (sliceSize === 0) {
1391
1443
  return 0;
@@ -1400,7 +1452,7 @@ function sliceFactory(collection, begin, end, useKeys) {
1400
1452
  if (!(isSkipping && (isSkipping = skipped++ < resolvedBegin))) {
1401
1453
  iterations++;
1402
1454
  return (
1403
- fn(v, useKeys ? k : iterations - 1, this$1) !== false &&
1455
+ fn(v, useKeys ? k : iterations - 1, this$1$1) !== false &&
1404
1456
  iterations !== sliceSize
1405
1457
  );
1406
1458
  }
@@ -1408,7 +1460,7 @@ function sliceFactory(collection, begin, end, useKeys) {
1408
1460
  return iterations;
1409
1461
  };
1410
1462
 
1411
- sliceSeq.__iteratorUncached = function(type, reverse) {
1463
+ sliceSeq.__iteratorUncached = function (type, reverse) {
1412
1464
  if (sliceSize !== 0 && reverse) {
1413
1465
  return this.cacheResult().__iterator(type, reverse);
1414
1466
  }
@@ -1442,20 +1494,20 @@ function sliceFactory(collection, begin, end, useKeys) {
1442
1494
 
1443
1495
  function takeWhileFactory(collection, predicate, context) {
1444
1496
  var takeSequence = makeSequence(collection);
1445
- takeSequence.__iterateUncached = function(fn, reverse) {
1446
- var this$1 = this;
1497
+ takeSequence.__iterateUncached = function (fn, reverse) {
1498
+ var this$1$1 = this;
1447
1499
 
1448
1500
  if (reverse) {
1449
1501
  return this.cacheResult().__iterate(fn, reverse);
1450
1502
  }
1451
1503
  var iterations = 0;
1452
1504
  collection.__iterate(
1453
- function (v, k, c) { return predicate.call(context, v, k, c) && ++iterations && fn(v, k, this$1); }
1505
+ function (v, k, c) { return predicate.call(context, v, k, c) && ++iterations && fn(v, k, this$1$1); }
1454
1506
  );
1455
1507
  return iterations;
1456
1508
  };
1457
- takeSequence.__iteratorUncached = function(type, reverse) {
1458
- var this$1 = this;
1509
+ takeSequence.__iteratorUncached = function (type, reverse) {
1510
+ var this$1$1 = this;
1459
1511
 
1460
1512
  if (reverse) {
1461
1513
  return this.cacheResult().__iterator(type, reverse);
@@ -1473,7 +1525,7 @@ function takeWhileFactory(collection, predicate, context) {
1473
1525
  var entry = step.value;
1474
1526
  var k = entry[0];
1475
1527
  var v = entry[1];
1476
- if (!predicate.call(context, v, k, this$1)) {
1528
+ if (!predicate.call(context, v, k, this$1$1)) {
1477
1529
  iterating = false;
1478
1530
  return iteratorDone();
1479
1531
  }
@@ -1485,8 +1537,8 @@ function takeWhileFactory(collection, predicate, context) {
1485
1537
 
1486
1538
  function skipWhileFactory(collection, predicate, context, useKeys) {
1487
1539
  var skipSequence = makeSequence(collection);
1488
- skipSequence.__iterateUncached = function(fn, reverse) {
1489
- var this$1 = this;
1540
+ skipSequence.__iterateUncached = function (fn, reverse) {
1541
+ var this$1$1 = this;
1490
1542
 
1491
1543
  if (reverse) {
1492
1544
  return this.cacheResult().__iterate(fn, reverse);
@@ -1496,13 +1548,13 @@ function skipWhileFactory(collection, predicate, context, useKeys) {
1496
1548
  collection.__iterate(function (v, k, c) {
1497
1549
  if (!(isSkipping && (isSkipping = predicate.call(context, v, k, c)))) {
1498
1550
  iterations++;
1499
- return fn(v, useKeys ? k : iterations - 1, this$1);
1551
+ return fn(v, useKeys ? k : iterations - 1, this$1$1);
1500
1552
  }
1501
1553
  });
1502
1554
  return iterations;
1503
1555
  };
1504
- skipSequence.__iteratorUncached = function(type, reverse) {
1505
- var this$1 = this;
1556
+ skipSequence.__iteratorUncached = function (type, reverse) {
1557
+ var this$1$1 = this;
1506
1558
 
1507
1559
  if (reverse) {
1508
1560
  return this.cacheResult().__iterator(type, reverse);
@@ -1528,7 +1580,7 @@ function skipWhileFactory(collection, predicate, context, useKeys) {
1528
1580
  var entry = step.value;
1529
1581
  k = entry[0];
1530
1582
  v = entry[1];
1531
- skipping && (skipping = predicate.call(context, v, k, this$1));
1583
+ skipping && (skipping = predicate.call(context, v, k, this$1$1));
1532
1584
  } while (skipping);
1533
1585
  return type === ITERATE_ENTRIES ? step : iteratorValue(type, k, v, step);
1534
1586
  });
@@ -1587,7 +1639,7 @@ function concatFactory(collection, values) {
1587
1639
 
1588
1640
  function flattenFactory(collection, depth, useKeys) {
1589
1641
  var flatSequence = makeSequence(collection);
1590
- flatSequence.__iterateUncached = function(fn, reverse) {
1642
+ flatSequence.__iterateUncached = function (fn, reverse) {
1591
1643
  if (reverse) {
1592
1644
  return this.cacheResult().__iterate(fn, reverse);
1593
1645
  }
@@ -1609,7 +1661,7 @@ function flattenFactory(collection, depth, useKeys) {
1609
1661
  flatDeep(collection, 0);
1610
1662
  return iterations;
1611
1663
  };
1612
- flatSequence.__iteratorUncached = function(type, reverse) {
1664
+ flatSequence.__iteratorUncached = function (type, reverse) {
1613
1665
  if (reverse) {
1614
1666
  return this.cacheResult().__iterator(type, reverse);
1615
1667
  }
@@ -1651,18 +1703,18 @@ function flatMapFactory(collection, mapper, context) {
1651
1703
  function interposeFactory(collection, separator) {
1652
1704
  var interposedSequence = makeSequence(collection);
1653
1705
  interposedSequence.size = collection.size && collection.size * 2 - 1;
1654
- interposedSequence.__iterateUncached = function(fn, reverse) {
1655
- var this$1 = this;
1706
+ interposedSequence.__iterateUncached = function (fn, reverse) {
1707
+ var this$1$1 = this;
1656
1708
 
1657
1709
  var iterations = 0;
1658
1710
  collection.__iterate(
1659
- function (v) { return (!iterations || fn(separator, iterations++, this$1) !== false) &&
1660
- fn(v, iterations++, this$1) !== false; },
1711
+ function (v) { return (!iterations || fn(separator, iterations++, this$1$1) !== false) &&
1712
+ fn(v, iterations++, this$1$1) !== false; },
1661
1713
  reverse
1662
1714
  );
1663
1715
  return iterations;
1664
1716
  };
1665
- interposedSequence.__iteratorUncached = function(type, reverse) {
1717
+ interposedSequence.__iteratorUncached = function (type, reverse) {
1666
1718
  var iterator = collection.__iterator(ITERATE_VALUES, reverse);
1667
1719
  var iterations = 0;
1668
1720
  var step;
@@ -1692,20 +1744,22 @@ function sortFactory(collection, comparator, mapper) {
1692
1744
  .map(function (v, k) { return [k, v, index++, mapper ? mapper(v, k, collection) : v]; })
1693
1745
  .valueSeq()
1694
1746
  .toArray();
1695
- entries.sort(function (a, b) { return comparator(a[3], b[3]) || a[2] - b[2]; }).forEach(
1696
- isKeyedCollection
1697
- ? function (v, i) {
1698
- entries[i].length = 2;
1699
- }
1700
- : function (v, i) {
1701
- entries[i] = v[1];
1702
- }
1703
- );
1747
+ entries
1748
+ .sort(function (a, b) { return comparator(a[3], b[3]) || a[2] - b[2]; })
1749
+ .forEach(
1750
+ isKeyedCollection
1751
+ ? function (v, i) {
1752
+ entries[i].length = 2;
1753
+ }
1754
+ : function (v, i) {
1755
+ entries[i] = v[1];
1756
+ }
1757
+ );
1704
1758
  return isKeyedCollection
1705
1759
  ? KeyedSeq(entries)
1706
1760
  : isIndexed(collection)
1707
- ? IndexedSeq(entries)
1708
- : SetSeq(entries);
1761
+ ? IndexedSeq(entries)
1762
+ : SetSeq(entries);
1709
1763
  }
1710
1764
 
1711
1765
  function maxFactory(collection, comparator, mapper) {
@@ -1738,7 +1792,7 @@ function zipWithFactory(keyIter, zipper, iters, zipAll) {
1738
1792
  zipSequence.size = zipAll ? sizes.max() : sizes.min();
1739
1793
  // Note: this a generic base implementation of __iterate in terms of
1740
1794
  // __iterator which may be more generically useful in the future.
1741
- zipSequence.__iterate = function(fn, reverse) {
1795
+ zipSequence.__iterate = function (fn, reverse) {
1742
1796
  /* generic:
1743
1797
  var iterator = this.__iterator(ITERATE_ENTRIES, reverse);
1744
1798
  var step;
@@ -1762,7 +1816,7 @@ function zipWithFactory(keyIter, zipper, iters, zipAll) {
1762
1816
  }
1763
1817
  return iterations;
1764
1818
  };
1765
- zipSequence.__iteratorUncached = function(type, reverse) {
1819
+ zipSequence.__iteratorUncached = function (type, reverse) {
1766
1820
  var iterators = iters.map(
1767
1821
  function (i) { return ((i = Collection(i)), getIterator(reverse ? i.reverse() : i)); }
1768
1822
  );
@@ -1780,7 +1834,10 @@ function zipWithFactory(keyIter, zipper, iters, zipAll) {
1780
1834
  return iteratorValue(
1781
1835
  type,
1782
1836
  iterations++,
1783
- zipper.apply(null, steps.map(function (s) { return s.value; }))
1837
+ zipper.apply(
1838
+ null,
1839
+ steps.map(function (s) { return s.value; })
1840
+ )
1784
1841
  );
1785
1842
  });
1786
1843
  };
@@ -1803,8 +1860,8 @@ function collectionClass(collection) {
1803
1860
  return isKeyed(collection)
1804
1861
  ? KeyedCollection
1805
1862
  : isIndexed(collection)
1806
- ? IndexedCollection
1807
- : SetCollection;
1863
+ ? IndexedCollection
1864
+ : SetCollection;
1808
1865
  }
1809
1866
 
1810
1867
  function makeSequence(collection) {
@@ -1812,8 +1869,8 @@ function makeSequence(collection) {
1812
1869
  (isKeyed(collection)
1813
1870
  ? KeyedSeq
1814
1871
  : isIndexed(collection)
1815
- ? IndexedSeq
1816
- : SetSeq
1872
+ ? IndexedSeq
1873
+ : SetSeq
1817
1874
  ).prototype
1818
1875
  );
1819
1876
  }
@@ -1843,7 +1900,6 @@ function defaultComparator(a, b) {
1843
1900
  return a > b ? 1 : a < b ? -1 : 0;
1844
1901
  }
1845
1902
 
1846
- // http://jsperf.com/copy-array-inline
1847
1903
  function arrCopy(arr, offset) {
1848
1904
  offset = offset || 0;
1849
1905
  var len = Math.max(0, arr.length - offset);
@@ -1877,12 +1933,31 @@ function coerceKeyPath(keyPath) {
1877
1933
  );
1878
1934
  }
1879
1935
 
1880
- function isPlainObj(value) {
1881
- return (
1882
- value &&
1883
- (typeof value.constructor !== 'function' ||
1884
- value.constructor.name === 'Object')
1885
- );
1936
+ var toString = Object.prototype.toString;
1937
+
1938
+ function isPlainObject(value) {
1939
+ // The base prototype's toString deals with Argument objects and native namespaces like Math
1940
+ if (
1941
+ !value ||
1942
+ typeof value !== 'object' ||
1943
+ toString.call(value) !== '[object Object]'
1944
+ ) {
1945
+ return false;
1946
+ }
1947
+
1948
+ var proto = Object.getPrototypeOf(value);
1949
+ if (proto === null) {
1950
+ return true;
1951
+ }
1952
+
1953
+ // Iteratively going up the prototype chain is needed for cross-realm environments (differing contexts, iframes, etc)
1954
+ var parentProto = proto;
1955
+ var nextProto = Object.getPrototypeOf(proto);
1956
+ while (nextProto !== null) {
1957
+ parentProto = nextProto;
1958
+ nextProto = Object.getPrototypeOf(parentProto);
1959
+ }
1960
+ return parentProto === proto;
1886
1961
  }
1887
1962
 
1888
1963
  /**
@@ -1892,13 +1967,10 @@ function isPlainObj(value) {
1892
1967
  function isDataStructure(value) {
1893
1968
  return (
1894
1969
  typeof value === 'object' &&
1895
- (isImmutable(value) || Array.isArray(value) || isPlainObj(value))
1970
+ (isImmutable(value) || Array.isArray(value) || isPlainObject(value))
1896
1971
  );
1897
1972
  }
1898
1973
 
1899
- /**
1900
- * Converts a value to a string, adding quotes if a string was provided.
1901
- */
1902
1974
  function quoteString(value) {
1903
1975
  try {
1904
1976
  return typeof value === 'string' ? JSON.stringify(value) : String(value);
@@ -1917,10 +1989,10 @@ function get(collection, key, notSetValue) {
1917
1989
  return isImmutable(collection)
1918
1990
  ? collection.get(key, notSetValue)
1919
1991
  : !has(collection, key)
1920
- ? notSetValue
1921
- : typeof collection.get === 'function'
1922
- ? collection.get(key)
1923
- : collection[key];
1992
+ ? notSetValue
1993
+ : typeof collection.get === 'function'
1994
+ ? collection.get(key)
1995
+ : collection[key];
1924
1996
  }
1925
1997
 
1926
1998
  function shallowCopy(from) {
@@ -1984,7 +2056,7 @@ function set(collection, key, value) {
1984
2056
  return collectionCopy;
1985
2057
  }
1986
2058
 
1987
- function updateIn(collection, keyPath, notSetValue, updater) {
2059
+ function updateIn$1(collection, keyPath, notSetValue, updater) {
1988
2060
  if (!updater) {
1989
2061
  updater = notSetValue;
1990
2062
  notSetValue = undefined;
@@ -2035,52 +2107,52 @@ function updateInDeeply(
2035
2107
  return nextUpdated === nextExisting
2036
2108
  ? existing
2037
2109
  : nextUpdated === NOT_SET
2038
- ? remove(existing, key)
2039
- : set(
2040
- wasNotSet ? (inImmutable ? emptyMap() : {}) : existing,
2041
- key,
2042
- nextUpdated
2043
- );
2110
+ ? remove(existing, key)
2111
+ : set(
2112
+ wasNotSet ? (inImmutable ? emptyMap() : {}) : existing,
2113
+ key,
2114
+ nextUpdated
2115
+ );
2044
2116
  }
2045
2117
 
2046
- function setIn(collection, keyPath, value) {
2047
- return updateIn(collection, keyPath, NOT_SET, function () { return value; });
2118
+ function setIn$1(collection, keyPath, value) {
2119
+ return updateIn$1(collection, keyPath, NOT_SET, function () { return value; });
2048
2120
  }
2049
2121
 
2050
- function setIn$1(keyPath, v) {
2051
- return setIn(this, keyPath, v);
2122
+ function setIn(keyPath, v) {
2123
+ return setIn$1(this, keyPath, v);
2052
2124
  }
2053
2125
 
2054
2126
  function removeIn(collection, keyPath) {
2055
- return updateIn(collection, keyPath, function () { return NOT_SET; });
2127
+ return updateIn$1(collection, keyPath, function () { return NOT_SET; });
2056
2128
  }
2057
2129
 
2058
2130
  function deleteIn(keyPath) {
2059
2131
  return removeIn(this, keyPath);
2060
2132
  }
2061
2133
 
2062
- function update(collection, key, notSetValue, updater) {
2063
- return updateIn(collection, [key], notSetValue, updater);
2134
+ function update$1(collection, key, notSetValue, updater) {
2135
+ return updateIn$1(collection, [key], notSetValue, updater);
2064
2136
  }
2065
2137
 
2066
- function update$1(key, notSetValue, updater) {
2138
+ function update(key, notSetValue, updater) {
2067
2139
  return arguments.length === 1
2068
2140
  ? key(this)
2069
- : update(this, key, notSetValue, updater);
2141
+ : update$1(this, key, notSetValue, updater);
2070
2142
  }
2071
2143
 
2072
- function updateIn$1(keyPath, notSetValue, updater) {
2073
- return updateIn(this, keyPath, notSetValue, updater);
2144
+ function updateIn(keyPath, notSetValue, updater) {
2145
+ return updateIn$1(this, keyPath, notSetValue, updater);
2074
2146
  }
2075
2147
 
2076
- function merge() {
2148
+ function merge$1() {
2077
2149
  var iters = [], len = arguments.length;
2078
2150
  while ( len-- ) iters[ len ] = arguments[ len ];
2079
2151
 
2080
2152
  return mergeIntoKeyedWith(this, iters);
2081
2153
  }
2082
2154
 
2083
- function mergeWith(merger) {
2155
+ function mergeWith$1(merger) {
2084
2156
  var iters = [], len = arguments.length - 1;
2085
2157
  while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];
2086
2158
 
@@ -2111,11 +2183,7 @@ function mergeIntoKeyedWith(collection, collections, merger) {
2111
2183
  return collection.withMutations(function (collection) {
2112
2184
  var mergeIntoCollection = merger
2113
2185
  ? function (value, key) {
2114
- update(
2115
- collection,
2116
- key,
2117
- NOT_SET,
2118
- function (oldVal) { return (oldVal === NOT_SET ? value : merger(oldVal, value, key)); }
2186
+ update$1(collection, key, NOT_SET, function (oldVal) { return oldVal === NOT_SET ? value : merger(oldVal, value, key); }
2119
2187
  );
2120
2188
  }
2121
2189
  : function (value, key) {
@@ -2127,28 +2195,28 @@ function mergeIntoKeyedWith(collection, collections, merger) {
2127
2195
  });
2128
2196
  }
2129
2197
 
2130
- function merge$1(collection) {
2198
+ function merge(collection) {
2131
2199
  var sources = [], len = arguments.length - 1;
2132
2200
  while ( len-- > 0 ) sources[ len ] = arguments[ len + 1 ];
2133
2201
 
2134
2202
  return mergeWithSources(collection, sources);
2135
2203
  }
2136
2204
 
2137
- function mergeWith$1(merger, collection) {
2205
+ function mergeWith(merger, collection) {
2138
2206
  var sources = [], len = arguments.length - 2;
2139
2207
  while ( len-- > 0 ) sources[ len ] = arguments[ len + 2 ];
2140
2208
 
2141
2209
  return mergeWithSources(collection, sources, merger);
2142
2210
  }
2143
2211
 
2144
- function mergeDeep(collection) {
2212
+ function mergeDeep$1(collection) {
2145
2213
  var sources = [], len = arguments.length - 1;
2146
2214
  while ( len-- > 0 ) sources[ len ] = arguments[ len + 1 ];
2147
2215
 
2148
2216
  return mergeDeepWithSources(collection, sources);
2149
2217
  }
2150
2218
 
2151
- function mergeDeepWith(merger, collection) {
2219
+ function mergeDeepWith$1(merger, collection) {
2152
2220
  var sources = [], len = arguments.length - 2;
2153
2221
  while ( len-- > 0 ) sources[ len ] = arguments[ len + 2 ];
2154
2222
 
@@ -2169,12 +2237,12 @@ function mergeWithSources(collection, sources, merger) {
2169
2237
  return typeof merger === 'function' && collection.mergeWith
2170
2238
  ? collection.mergeWith.apply(collection, [ merger ].concat( sources ))
2171
2239
  : collection.merge
2172
- ? collection.merge.apply(collection, sources)
2173
- : collection.concat.apply(collection, sources);
2240
+ ? collection.merge.apply(collection, sources)
2241
+ : collection.concat.apply(collection, sources);
2174
2242
  }
2175
2243
  var isArray = Array.isArray(collection);
2176
2244
  var merged = collection;
2177
- var Collection$$1 = isArray ? IndexedCollection : KeyedCollection;
2245
+ var Collection = isArray ? IndexedCollection : KeyedCollection;
2178
2246
  var mergeItem = isArray
2179
2247
  ? function (value) {
2180
2248
  // Copy on write
@@ -2196,7 +2264,7 @@ function mergeWithSources(collection, sources, merger) {
2196
2264
  }
2197
2265
  };
2198
2266
  for (var i = 0; i < sources.length; i++) {
2199
- Collection$$1(sources[i]).forEach(mergeItem);
2267
+ Collection(sources[i]).forEach(mergeItem);
2200
2268
  }
2201
2269
  return merged;
2202
2270
  }
@@ -2206,20 +2274,20 @@ function deepMergerWith(merger) {
2206
2274
  return isDataStructure(oldValue) && isDataStructure(newValue)
2207
2275
  ? mergeWithSources(oldValue, [newValue], deepMerger)
2208
2276
  : merger
2209
- ? merger(oldValue, newValue, key)
2210
- : newValue;
2277
+ ? merger(oldValue, newValue, key)
2278
+ : newValue;
2211
2279
  }
2212
2280
  return deepMerger;
2213
2281
  }
2214
2282
 
2215
- function mergeDeep$1() {
2283
+ function mergeDeep() {
2216
2284
  var iters = [], len = arguments.length;
2217
2285
  while ( len-- ) iters[ len ] = arguments[ len ];
2218
2286
 
2219
2287
  return mergeDeepWithSources(this, iters);
2220
2288
  }
2221
2289
 
2222
- function mergeDeepWith$1(merger) {
2290
+ function mergeDeepWith(merger) {
2223
2291
  var iters = [], len = arguments.length - 1;
2224
2292
  while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];
2225
2293
 
@@ -2230,14 +2298,14 @@ function mergeIn(keyPath) {
2230
2298
  var iters = [], len = arguments.length - 1;
2231
2299
  while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];
2232
2300
 
2233
- return updateIn(this, keyPath, emptyMap(), function (m) { return mergeWithSources(m, iters); });
2301
+ return updateIn$1(this, keyPath, emptyMap(), function (m) { return mergeWithSources(m, iters); });
2234
2302
  }
2235
2303
 
2236
2304
  function mergeDeepIn(keyPath) {
2237
2305
  var iters = [], len = arguments.length - 1;
2238
2306
  while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];
2239
2307
 
2240
- return updateIn(this, keyPath, emptyMap(), function (m) { return mergeDeepWithSources(m, iters); }
2308
+ return updateIn$1(this, keyPath, emptyMap(), function (m) { return mergeDeepWithSources(m, iters); }
2241
2309
  );
2242
2310
  }
2243
2311
 
@@ -2259,21 +2327,21 @@ function wasAltered() {
2259
2327
  return this.__altered;
2260
2328
  }
2261
2329
 
2262
- var Map = /*@__PURE__*/(function (KeyedCollection$$1) {
2330
+ var Map = /*@__PURE__*/(function (KeyedCollection) {
2263
2331
  function Map(value) {
2264
2332
  return value === null || value === undefined
2265
2333
  ? emptyMap()
2266
2334
  : isMap(value) && !isOrdered(value)
2267
- ? value
2268
- : emptyMap().withMutations(function (map) {
2269
- var iter = KeyedCollection$$1(value);
2270
- assertNotInfinite(iter.size);
2271
- iter.forEach(function (v, k) { return map.set(k, v); });
2272
- });
2335
+ ? value
2336
+ : emptyMap().withMutations(function (map) {
2337
+ var iter = KeyedCollection(value);
2338
+ assertNotInfinite(iter.size);
2339
+ iter.forEach(function (v, k) { return map.set(k, v); });
2340
+ });
2273
2341
  }
2274
2342
 
2275
- if ( KeyedCollection$$1 ) Map.__proto__ = KeyedCollection$$1;
2276
- Map.prototype = Object.create( KeyedCollection$$1 && KeyedCollection$$1.prototype );
2343
+ if ( KeyedCollection ) Map.__proto__ = KeyedCollection;
2344
+ Map.prototype = Object.create( KeyedCollection && KeyedCollection.prototype );
2277
2345
  Map.prototype.constructor = Map;
2278
2346
 
2279
2347
  Map.of = function of () {
@@ -2351,9 +2419,11 @@ var Map = /*@__PURE__*/(function (KeyedCollection$$1) {
2351
2419
  };
2352
2420
 
2353
2421
  Map.prototype.map = function map (mapper, context) {
2422
+ var this$1$1 = this;
2423
+
2354
2424
  return this.withMutations(function (map) {
2355
2425
  map.forEach(function (value, key) {
2356
- map.set(key, mapper.call(context, value, key, map));
2426
+ map.set(key, mapper.call(context, value, key, this$1$1));
2357
2427
  });
2358
2428
  });
2359
2429
  };
@@ -2365,13 +2435,13 @@ var Map = /*@__PURE__*/(function (KeyedCollection$$1) {
2365
2435
  };
2366
2436
 
2367
2437
  Map.prototype.__iterate = function __iterate (fn, reverse) {
2368
- var this$1 = this;
2438
+ var this$1$1 = this;
2369
2439
 
2370
2440
  var iterations = 0;
2371
2441
  this._root &&
2372
2442
  this._root.iterate(function (entry) {
2373
2443
  iterations++;
2374
- return fn(entry[1], entry[0], this$1);
2444
+ return fn(entry[1], entry[0], this$1$1);
2375
2445
  }, reverse);
2376
2446
  return iterations;
2377
2447
  };
@@ -2400,24 +2470,24 @@ var MapPrototype = Map.prototype;
2400
2470
  MapPrototype[IS_MAP_SYMBOL] = true;
2401
2471
  MapPrototype[DELETE] = MapPrototype.remove;
2402
2472
  MapPrototype.removeAll = MapPrototype.deleteAll;
2403
- MapPrototype.setIn = setIn$1;
2473
+ MapPrototype.setIn = setIn;
2404
2474
  MapPrototype.removeIn = MapPrototype.deleteIn = deleteIn;
2405
- MapPrototype.update = update$1;
2406
- MapPrototype.updateIn = updateIn$1;
2407
- MapPrototype.merge = MapPrototype.concat = merge;
2408
- MapPrototype.mergeWith = mergeWith;
2409
- MapPrototype.mergeDeep = mergeDeep$1;
2410
- MapPrototype.mergeDeepWith = mergeDeepWith$1;
2475
+ MapPrototype.update = update;
2476
+ MapPrototype.updateIn = updateIn;
2477
+ MapPrototype.merge = MapPrototype.concat = merge$1;
2478
+ MapPrototype.mergeWith = mergeWith$1;
2479
+ MapPrototype.mergeDeep = mergeDeep;
2480
+ MapPrototype.mergeDeepWith = mergeDeepWith;
2411
2481
  MapPrototype.mergeIn = mergeIn;
2412
2482
  MapPrototype.mergeDeepIn = mergeDeepIn;
2413
2483
  MapPrototype.withMutations = withMutations;
2414
2484
  MapPrototype.wasAltered = wasAltered;
2415
2485
  MapPrototype.asImmutable = asImmutable;
2416
2486
  MapPrototype['@@transducer/init'] = MapPrototype.asMutable = asMutable;
2417
- MapPrototype['@@transducer/step'] = function(result, arr) {
2487
+ MapPrototype['@@transducer/step'] = function (result, arr) {
2418
2488
  return result.set(arr[0], arr[1]);
2419
2489
  };
2420
- MapPrototype['@@transducer/result'] = function(obj) {
2490
+ MapPrototype['@@transducer/result'] = function (obj) {
2421
2491
  return obj.asImmutable();
2422
2492
  };
2423
2493
 
@@ -2756,45 +2826,41 @@ ValueNode.prototype.update = function update (ownerID, shift, keyHash, key, valu
2756
2826
 
2757
2827
  // #pragma Iterators
2758
2828
 
2759
- ArrayMapNode.prototype.iterate = HashCollisionNode.prototype.iterate = function(
2760
- fn,
2761
- reverse
2762
- ) {
2763
- var entries = this.entries;
2764
- for (var ii = 0, maxIndex = entries.length - 1; ii <= maxIndex; ii++) {
2765
- if (fn(entries[reverse ? maxIndex - ii : ii]) === false) {
2766
- return false;
2829
+ ArrayMapNode.prototype.iterate = HashCollisionNode.prototype.iterate =
2830
+ function (fn, reverse) {
2831
+ var entries = this.entries;
2832
+ for (var ii = 0, maxIndex = entries.length - 1; ii <= maxIndex; ii++) {
2833
+ if (fn(entries[reverse ? maxIndex - ii : ii]) === false) {
2834
+ return false;
2835
+ }
2767
2836
  }
2768
- }
2769
- };
2837
+ };
2770
2838
 
2771
- BitmapIndexedNode.prototype.iterate = HashArrayMapNode.prototype.iterate = function(
2772
- fn,
2773
- reverse
2774
- ) {
2775
- var nodes = this.nodes;
2776
- for (var ii = 0, maxIndex = nodes.length - 1; ii <= maxIndex; ii++) {
2777
- var node = nodes[reverse ? maxIndex - ii : ii];
2778
- if (node && node.iterate(fn, reverse) === false) {
2779
- return false;
2839
+ BitmapIndexedNode.prototype.iterate = HashArrayMapNode.prototype.iterate =
2840
+ function (fn, reverse) {
2841
+ var nodes = this.nodes;
2842
+ for (var ii = 0, maxIndex = nodes.length - 1; ii <= maxIndex; ii++) {
2843
+ var node = nodes[reverse ? maxIndex - ii : ii];
2844
+ if (node && node.iterate(fn, reverse) === false) {
2845
+ return false;
2846
+ }
2780
2847
  }
2781
- }
2782
- };
2848
+ };
2783
2849
 
2784
2850
  // eslint-disable-next-line no-unused-vars
2785
- ValueNode.prototype.iterate = function(fn, reverse) {
2851
+ ValueNode.prototype.iterate = function (fn, reverse) {
2786
2852
  return fn(this.entry);
2787
2853
  };
2788
2854
 
2789
- var MapIterator = /*@__PURE__*/(function (Iterator$$1) {
2855
+ var MapIterator = /*@__PURE__*/(function (Iterator) {
2790
2856
  function MapIterator(map, type, reverse) {
2791
2857
  this._type = type;
2792
2858
  this._reverse = reverse;
2793
2859
  this._stack = map._root && mapIteratorFrame(map._root);
2794
2860
  }
2795
2861
 
2796
- if ( Iterator$$1 ) MapIterator.__proto__ = Iterator$$1;
2797
- MapIterator.prototype = Object.create( Iterator$$1 && Iterator$$1.prototype );
2862
+ if ( Iterator ) MapIterator.__proto__ = Iterator;
2863
+ MapIterator.prototype = Object.create( Iterator && Iterator.prototype );
2798
2864
  MapIterator.prototype.constructor = MapIterator;
2799
2865
 
2800
2866
  MapIterator.prototype.next = function next () {
@@ -2849,12 +2915,12 @@ function mapIteratorFrame(node, prev) {
2849
2915
  };
2850
2916
  }
2851
2917
 
2852
- function makeMap(size, root, ownerID, hash$$1) {
2918
+ function makeMap(size, root, ownerID, hash) {
2853
2919
  var map = Object.create(MapPrototype);
2854
2920
  map.size = size;
2855
2921
  map._root = root;
2856
2922
  map.__ownerID = ownerID;
2857
- map.__hash = hash$$1;
2923
+ map.__hash = hash;
2858
2924
  map.__altered = false;
2859
2925
  return map;
2860
2926
  }
@@ -3051,7 +3117,7 @@ function isList(maybeList) {
3051
3117
  return Boolean(maybeList && maybeList[IS_LIST_SYMBOL]);
3052
3118
  }
3053
3119
 
3054
- var List = /*@__PURE__*/(function (IndexedCollection$$1) {
3120
+ var List = /*@__PURE__*/(function (IndexedCollection) {
3055
3121
  function List(value) {
3056
3122
  var empty = emptyList();
3057
3123
  if (value === null || value === undefined) {
@@ -3060,7 +3126,7 @@ var List = /*@__PURE__*/(function (IndexedCollection$$1) {
3060
3126
  if (isList(value)) {
3061
3127
  return value;
3062
3128
  }
3063
- var iter = IndexedCollection$$1(value);
3129
+ var iter = IndexedCollection(value);
3064
3130
  var size = iter.size;
3065
3131
  if (size === 0) {
3066
3132
  return empty;
@@ -3075,8 +3141,8 @@ var List = /*@__PURE__*/(function (IndexedCollection$$1) {
3075
3141
  });
3076
3142
  }
3077
3143
 
3078
- if ( IndexedCollection$$1 ) List.__proto__ = IndexedCollection$$1;
3079
- List.prototype = Object.create( IndexedCollection$$1 && IndexedCollection$$1.prototype );
3144
+ if ( IndexedCollection ) List.__proto__ = IndexedCollection;
3145
+ List.prototype = Object.create( IndexedCollection && IndexedCollection.prototype );
3080
3146
  List.prototype.constructor = List;
3081
3147
 
3082
3148
  List.of = function of (/*...values*/) {
@@ -3109,10 +3175,10 @@ var List = /*@__PURE__*/(function (IndexedCollection$$1) {
3109
3175
  return !this.has(index)
3110
3176
  ? this
3111
3177
  : index === 0
3112
- ? this.shift()
3113
- : index === this.size - 1
3114
- ? this.pop()
3115
- : this.splice(index, 1);
3178
+ ? this.shift()
3179
+ : index === this.size - 1
3180
+ ? this.pop()
3181
+ : this.splice(index, 1);
3116
3182
  };
3117
3183
 
3118
3184
  List.prototype.insert = function insert (index, value) {
@@ -3126,8 +3192,7 @@ var List = /*@__PURE__*/(function (IndexedCollection$$1) {
3126
3192
  if (this.__ownerID) {
3127
3193
  this.size = this._origin = this._capacity = 0;
3128
3194
  this._level = SHIFT;
3129
- this._root = this._tail = null;
3130
- this.__hash = undefined;
3195
+ this._root = this._tail = this.__hash = undefined;
3131
3196
  this.__altered = true;
3132
3197
  return this;
3133
3198
  }
@@ -3171,7 +3236,7 @@ var List = /*@__PURE__*/(function (IndexedCollection$$1) {
3171
3236
  var seqs = [];
3172
3237
  for (var i = 0; i < arguments.length; i++) {
3173
3238
  var argument = arguments$1[i];
3174
- var seq = IndexedCollection$$1(
3239
+ var seq = IndexedCollection(
3175
3240
  typeof argument !== 'string' && hasIterator(argument)
3176
3241
  ? argument
3177
3242
  : [argument]
@@ -3196,11 +3261,11 @@ var List = /*@__PURE__*/(function (IndexedCollection$$1) {
3196
3261
  };
3197
3262
 
3198
3263
  List.prototype.map = function map (mapper, context) {
3199
- var this$1 = this;
3264
+ var this$1$1 = this;
3200
3265
 
3201
3266
  return this.withMutations(function (list) {
3202
- for (var i = 0; i < this$1.size; i++) {
3203
- list.set(i, mapper.call(context, list.get(i), i, list));
3267
+ for (var i = 0; i < this$1$1.size; i++) {
3268
+ list.set(i, mapper.call(context, list.get(i), i, this$1$1));
3204
3269
  }
3205
3270
  });
3206
3271
  };
@@ -3274,20 +3339,20 @@ var ListPrototype = List.prototype;
3274
3339
  ListPrototype[IS_LIST_SYMBOL] = true;
3275
3340
  ListPrototype[DELETE] = ListPrototype.remove;
3276
3341
  ListPrototype.merge = ListPrototype.concat;
3277
- ListPrototype.setIn = setIn$1;
3342
+ ListPrototype.setIn = setIn;
3278
3343
  ListPrototype.deleteIn = ListPrototype.removeIn = deleteIn;
3279
- ListPrototype.update = update$1;
3280
- ListPrototype.updateIn = updateIn$1;
3344
+ ListPrototype.update = update;
3345
+ ListPrototype.updateIn = updateIn;
3281
3346
  ListPrototype.mergeIn = mergeIn;
3282
3347
  ListPrototype.mergeDeepIn = mergeDeepIn;
3283
3348
  ListPrototype.withMutations = withMutations;
3284
3349
  ListPrototype.wasAltered = wasAltered;
3285
3350
  ListPrototype.asImmutable = asImmutable;
3286
3351
  ListPrototype['@@transducer/init'] = ListPrototype.asMutable = asMutable;
3287
- ListPrototype['@@transducer/step'] = function(result, arr) {
3352
+ ListPrototype['@@transducer/step'] = function (result, arr) {
3288
3353
  return result.push(arr);
3289
3354
  };
3290
- ListPrototype['@@transducer/result'] = function(obj) {
3355
+ ListPrototype['@@transducer/result'] = function (obj) {
3291
3356
  return obj.asImmutable();
3292
3357
  };
3293
3358
 
@@ -3570,8 +3635,8 @@ function setListBounds(list, begin, end) {
3570
3635
  end === undefined
3571
3636
  ? oldCapacity
3572
3637
  : end < 0
3573
- ? oldCapacity + end
3574
- : oldOrigin + end;
3638
+ ? oldCapacity + end
3639
+ : oldOrigin + end;
3575
3640
  if (newOrigin === oldOrigin && newCapacity === oldCapacity) {
3576
3641
  return list;
3577
3642
  }
@@ -3619,8 +3684,8 @@ function setListBounds(list, begin, end) {
3619
3684
  newTailOffset < oldTailOffset
3620
3685
  ? listNodeFor(list, newCapacity - 1)
3621
3686
  : newTailOffset > oldTailOffset
3622
- ? new VNode([], owner)
3623
- : oldTail;
3687
+ ? new VNode([], owner)
3688
+ : oldTail;
3624
3689
 
3625
3690
  // Merge Tail into tree.
3626
3691
  if (
@@ -3703,21 +3768,21 @@ function getTailOffset(size) {
3703
3768
  return size < SIZE ? 0 : ((size - 1) >>> SHIFT) << SHIFT;
3704
3769
  }
3705
3770
 
3706
- var OrderedMap = /*@__PURE__*/(function (Map$$1) {
3771
+ var OrderedMap = /*@__PURE__*/(function (Map) {
3707
3772
  function OrderedMap(value) {
3708
3773
  return value === null || value === undefined
3709
3774
  ? emptyOrderedMap()
3710
3775
  : isOrderedMap(value)
3711
- ? value
3712
- : emptyOrderedMap().withMutations(function (map) {
3713
- var iter = KeyedCollection(value);
3714
- assertNotInfinite(iter.size);
3715
- iter.forEach(function (v, k) { return map.set(k, v); });
3716
- });
3776
+ ? value
3777
+ : emptyOrderedMap().withMutations(function (map) {
3778
+ var iter = KeyedCollection(value);
3779
+ assertNotInfinite(iter.size);
3780
+ iter.forEach(function (v, k) { return map.set(k, v); });
3781
+ });
3717
3782
  }
3718
3783
 
3719
- if ( Map$$1 ) OrderedMap.__proto__ = Map$$1;
3720
- OrderedMap.prototype = Object.create( Map$$1 && Map$$1.prototype );
3784
+ if ( Map ) OrderedMap.__proto__ = Map;
3785
+ OrderedMap.prototype = Object.create( Map && Map.prototype );
3721
3786
  OrderedMap.prototype.constructor = OrderedMap;
3722
3787
 
3723
3788
  OrderedMap.of = function of (/*...values*/) {
@@ -3745,6 +3810,7 @@ var OrderedMap = /*@__PURE__*/(function (Map$$1) {
3745
3810
  this.size = 0;
3746
3811
  this._map.clear();
3747
3812
  this._list.clear();
3813
+ this.__altered = true;
3748
3814
  return this;
3749
3815
  }
3750
3816
  return emptyOrderedMap();
@@ -3758,15 +3824,11 @@ var OrderedMap = /*@__PURE__*/(function (Map$$1) {
3758
3824
  return updateOrderedMap(this, k, NOT_SET);
3759
3825
  };
3760
3826
 
3761
- OrderedMap.prototype.wasAltered = function wasAltered () {
3762
- return this._map.wasAltered() || this._list.wasAltered();
3763
- };
3764
-
3765
3827
  OrderedMap.prototype.__iterate = function __iterate (fn, reverse) {
3766
- var this$1 = this;
3828
+ var this$1$1 = this;
3767
3829
 
3768
3830
  return this._list.__iterate(
3769
- function (entry) { return entry && fn(entry[1], entry[0], this$1); },
3831
+ function (entry) { return entry && fn(entry[1], entry[0], this$1$1); },
3770
3832
  reverse
3771
3833
  );
3772
3834
  };
@@ -3786,6 +3848,7 @@ var OrderedMap = /*@__PURE__*/(function (Map$$1) {
3786
3848
  return emptyOrderedMap();
3787
3849
  }
3788
3850
  this.__ownerID = ownerID;
3851
+ this.__altered = false;
3789
3852
  this._map = newMap;
3790
3853
  this._list = newList;
3791
3854
  return this;
@@ -3808,6 +3871,7 @@ function makeOrderedMap(map, list, ownerID, hash) {
3808
3871
  omap._list = list;
3809
3872
  omap.__ownerID = ownerID;
3810
3873
  omap.__hash = hash;
3874
+ omap.__altered = false;
3811
3875
  return omap;
3812
3876
  }
3813
3877
 
@@ -3860,6 +3924,7 @@ function updateOrderedMap(omap, k, v) {
3860
3924
  omap._map = newMap;
3861
3925
  omap._list = newList;
3862
3926
  omap.__hash = undefined;
3927
+ omap.__altered = true;
3863
3928
  return omap;
3864
3929
  }
3865
3930
  return makeOrderedMap(newMap, newList);
@@ -3871,17 +3936,17 @@ function isStack(maybeStack) {
3871
3936
  return Boolean(maybeStack && maybeStack[IS_STACK_SYMBOL]);
3872
3937
  }
3873
3938
 
3874
- var Stack = /*@__PURE__*/(function (IndexedCollection$$1) {
3939
+ var Stack = /*@__PURE__*/(function (IndexedCollection) {
3875
3940
  function Stack(value) {
3876
3941
  return value === null || value === undefined
3877
3942
  ? emptyStack()
3878
3943
  : isStack(value)
3879
- ? value
3880
- : emptyStack().pushAll(value);
3944
+ ? value
3945
+ : emptyStack().pushAll(value);
3881
3946
  }
3882
3947
 
3883
- if ( IndexedCollection$$1 ) Stack.__proto__ = IndexedCollection$$1;
3884
- Stack.prototype = Object.create( IndexedCollection$$1 && IndexedCollection$$1.prototype );
3948
+ if ( IndexedCollection ) Stack.__proto__ = IndexedCollection;
3949
+ Stack.prototype = Object.create( IndexedCollection && IndexedCollection.prototype );
3885
3950
  Stack.prototype.constructor = Stack;
3886
3951
 
3887
3952
  Stack.of = function of (/*...values*/) {
@@ -3934,7 +3999,7 @@ var Stack = /*@__PURE__*/(function (IndexedCollection$$1) {
3934
3999
  };
3935
4000
 
3936
4001
  Stack.prototype.pushAll = function pushAll (iter) {
3937
- iter = IndexedCollection$$1(iter);
4002
+ iter = IndexedCollection(iter);
3938
4003
  if (iter.size === 0) {
3939
4004
  return this;
3940
4005
  }
@@ -3987,7 +4052,7 @@ var Stack = /*@__PURE__*/(function (IndexedCollection$$1) {
3987
4052
  var resolvedEnd = resolveEnd(end, this.size);
3988
4053
  if (resolvedEnd !== this.size) {
3989
4054
  // super.slice(begin, end);
3990
- return IndexedCollection$$1.prototype.slice.call(this, begin, end);
4055
+ return IndexedCollection.prototype.slice.call(this, begin, end);
3991
4056
  }
3992
4057
  var newSize = this.size - resolvedBegin;
3993
4058
  var head = this._head;
@@ -4024,11 +4089,11 @@ var Stack = /*@__PURE__*/(function (IndexedCollection$$1) {
4024
4089
  // @pragma Iteration
4025
4090
 
4026
4091
  Stack.prototype.__iterate = function __iterate (fn, reverse) {
4027
- var this$1 = this;
4092
+ var this$1$1 = this;
4028
4093
 
4029
4094
  if (reverse) {
4030
4095
  return new ArraySeq(this.toArray()).__iterate(
4031
- function (v, k) { return fn(v, k, this$1); },
4096
+ function (v, k) { return fn(v, k, this$1$1); },
4032
4097
  reverse
4033
4098
  );
4034
4099
  }
@@ -4073,10 +4138,10 @@ StackPrototype.withMutations = withMutations;
4073
4138
  StackPrototype.wasAltered = wasAltered;
4074
4139
  StackPrototype.asImmutable = asImmutable;
4075
4140
  StackPrototype['@@transducer/init'] = StackPrototype.asMutable = asMutable;
4076
- StackPrototype['@@transducer/step'] = function(result, arr) {
4141
+ StackPrototype['@@transducer/step'] = function (result, arr) {
4077
4142
  return result.unshift(arr);
4078
4143
  };
4079
- StackPrototype['@@transducer/result'] = function(obj) {
4144
+ StackPrototype['@@transducer/result'] = function (obj) {
4080
4145
  return obj.asImmutable();
4081
4146
  };
4082
4147
 
@@ -4160,8 +4225,8 @@ function deepEqual(a, b) {
4160
4225
  notAssociative
4161
4226
  ? !a.has(v)
4162
4227
  : flipped
4163
- ? !is(v, a.get(k, NOT_SET))
4164
- : !is(a.get(k, NOT_SET), v)
4228
+ ? !is(v, a.get(k, NOT_SET))
4229
+ : !is(a.get(k, NOT_SET), v)
4165
4230
  ) {
4166
4231
  allEqual = false;
4167
4232
  return false;
@@ -4171,9 +4236,6 @@ function deepEqual(a, b) {
4171
4236
  return allEqual && a.size === bSize;
4172
4237
  }
4173
4238
 
4174
- /**
4175
- * Contributes additional methods to a constructor
4176
- */
4177
4239
  function mixin(ctor, methods) {
4178
4240
  var keyCopier = function (key) {
4179
4241
  ctor.prototype[key] = methods[key];
@@ -4208,21 +4270,21 @@ function toJS(value) {
4208
4270
  return result;
4209
4271
  }
4210
4272
 
4211
- var Set = /*@__PURE__*/(function (SetCollection$$1) {
4273
+ var Set = /*@__PURE__*/(function (SetCollection) {
4212
4274
  function Set(value) {
4213
4275
  return value === null || value === undefined
4214
4276
  ? emptySet()
4215
4277
  : isSet(value) && !isOrdered(value)
4216
- ? value
4217
- : emptySet().withMutations(function (set) {
4218
- var iter = SetCollection$$1(value);
4219
- assertNotInfinite(iter.size);
4220
- iter.forEach(function (v) { return set.add(v); });
4221
- });
4278
+ ? value
4279
+ : emptySet().withMutations(function (set) {
4280
+ var iter = SetCollection(value);
4281
+ assertNotInfinite(iter.size);
4282
+ iter.forEach(function (v) { return set.add(v); });
4283
+ });
4222
4284
  }
4223
4285
 
4224
- if ( SetCollection$$1 ) Set.__proto__ = SetCollection$$1;
4225
- Set.prototype = Object.create( SetCollection$$1 && SetCollection$$1.prototype );
4286
+ if ( SetCollection ) Set.__proto__ = SetCollection;
4287
+ Set.prototype = Object.create( SetCollection && SetCollection.prototype );
4226
4288
  Set.prototype.constructor = Set;
4227
4289
 
4228
4290
  Set.of = function of (/*...values*/) {
@@ -4274,21 +4336,27 @@ var Set = /*@__PURE__*/(function (SetCollection$$1) {
4274
4336
  // @pragma Composition
4275
4337
 
4276
4338
  Set.prototype.map = function map (mapper, context) {
4277
- var this$1 = this;
4339
+ var this$1$1 = this;
4278
4340
 
4279
- var removes = [];
4280
- var adds = [];
4281
- this.forEach(function (value) {
4282
- var mapped = mapper.call(context, value, value, this$1);
4283
- if (mapped !== value) {
4284
- removes.push(value);
4285
- adds.push(mapped);
4286
- }
4287
- });
4288
- return this.withMutations(function (set) {
4289
- removes.forEach(function (value) { return set.remove(value); });
4290
- adds.forEach(function (value) { return set.add(value); });
4291
- });
4341
+ // keep track if the set is altered by the map function
4342
+ var didChanges = false;
4343
+
4344
+ var newMap = updateSet(
4345
+ this,
4346
+ this._map.mapEntries(function (ref) {
4347
+ var v = ref[1];
4348
+
4349
+ var mapped = mapper.call(context, v, v, this$1$1);
4350
+
4351
+ if (mapped !== v) {
4352
+ didChanges = true;
4353
+ }
4354
+
4355
+ return [mapped, mapped];
4356
+ }, context)
4357
+ );
4358
+
4359
+ return didChanges ? newMap : this;
4292
4360
  };
4293
4361
 
4294
4362
  Set.prototype.union = function union () {
@@ -4304,7 +4372,7 @@ var Set = /*@__PURE__*/(function (SetCollection$$1) {
4304
4372
  }
4305
4373
  return this.withMutations(function (set) {
4306
4374
  for (var ii = 0; ii < iters.length; ii++) {
4307
- SetCollection$$1(iters[ii]).forEach(function (value) { return set.add(value); });
4375
+ SetCollection(iters[ii]).forEach(function (value) { return set.add(value); });
4308
4376
  }
4309
4377
  });
4310
4378
  };
@@ -4316,7 +4384,7 @@ var Set = /*@__PURE__*/(function (SetCollection$$1) {
4316
4384
  if (iters.length === 0) {
4317
4385
  return this;
4318
4386
  }
4319
- iters = iters.map(function (iter) { return SetCollection$$1(iter); });
4387
+ iters = iters.map(function (iter) { return SetCollection(iter); });
4320
4388
  var toRemove = [];
4321
4389
  this.forEach(function (value) {
4322
4390
  if (!iters.every(function (iter) { return iter.includes(value); })) {
@@ -4337,7 +4405,7 @@ var Set = /*@__PURE__*/(function (SetCollection$$1) {
4337
4405
  if (iters.length === 0) {
4338
4406
  return this;
4339
4407
  }
4340
- iters = iters.map(function (iter) { return SetCollection$$1(iter); });
4408
+ iters = iters.map(function (iter) { return SetCollection(iter); });
4341
4409
  var toRemove = [];
4342
4410
  this.forEach(function (value) {
4343
4411
  if (iters.some(function (iter) { return iter.includes(value); })) {
@@ -4366,9 +4434,9 @@ var Set = /*@__PURE__*/(function (SetCollection$$1) {
4366
4434
  };
4367
4435
 
4368
4436
  Set.prototype.__iterate = function __iterate (fn, reverse) {
4369
- var this$1 = this;
4437
+ var this$1$1 = this;
4370
4438
 
4371
- return this._map.__iterate(function (k) { return fn(k, k, this$1); }, reverse);
4439
+ return this._map.__iterate(function (k) { return fn(k, k, this$1$1); }, reverse);
4372
4440
  };
4373
4441
 
4374
4442
  Set.prototype.__iterator = function __iterator (type, reverse) {
@@ -4403,10 +4471,10 @@ SetPrototype.merge = SetPrototype.concat = SetPrototype.union;
4403
4471
  SetPrototype.withMutations = withMutations;
4404
4472
  SetPrototype.asImmutable = asImmutable;
4405
4473
  SetPrototype['@@transducer/init'] = SetPrototype.asMutable = asMutable;
4406
- SetPrototype['@@transducer/step'] = function(result, arr) {
4474
+ SetPrototype['@@transducer/step'] = function (result, arr) {
4407
4475
  return result.add(arr);
4408
4476
  };
4409
- SetPrototype['@@transducer/result'] = function(obj) {
4477
+ SetPrototype['@@transducer/result'] = function (obj) {
4410
4478
  return obj.asImmutable();
4411
4479
  };
4412
4480
 
@@ -4422,8 +4490,8 @@ function updateSet(set, newMap) {
4422
4490
  return newMap === set._map
4423
4491
  ? set
4424
4492
  : newMap.size === 0
4425
- ? set.__empty()
4426
- : set.__make(newMap);
4493
+ ? set.__empty()
4494
+ : set.__make(newMap);
4427
4495
  }
4428
4496
 
4429
4497
  function makeSet(map, ownerID) {
@@ -4444,7 +4512,7 @@ function emptySet() {
4444
4512
  * (exclusive), by step, where start defaults to 0, step to 1, and end to
4445
4513
  * infinity. When start is equal to end, returns empty list.
4446
4514
  */
4447
- var Range = /*@__PURE__*/(function (IndexedSeq$$1) {
4515
+ var Range = /*@__PURE__*/(function (IndexedSeq) {
4448
4516
  function Range(start, end, step) {
4449
4517
  if (!(this instanceof Range)) {
4450
4518
  return new Range(start, end, step);
@@ -4470,8 +4538,8 @@ var Range = /*@__PURE__*/(function (IndexedSeq$$1) {
4470
4538
  }
4471
4539
  }
4472
4540
 
4473
- if ( IndexedSeq$$1 ) Range.__proto__ = IndexedSeq$$1;
4474
- Range.prototype = Object.create( IndexedSeq$$1 && IndexedSeq$$1.prototype );
4541
+ if ( IndexedSeq ) Range.__proto__ = IndexedSeq;
4542
+ Range.prototype = Object.create( IndexedSeq && IndexedSeq.prototype );
4475
4543
  Range.prototype.constructor = Range;
4476
4544
 
4477
4545
  Range.prototype.toString = function toString () {
@@ -4576,7 +4644,7 @@ var Range = /*@__PURE__*/(function (IndexedSeq$$1) {
4576
4644
 
4577
4645
  var EMPTY_RANGE;
4578
4646
 
4579
- function getIn(collection, searchKeyPath, notSetValue) {
4647
+ function getIn$1(collection, searchKeyPath, notSetValue) {
4580
4648
  var keyPath = coerceKeyPath(searchKeyPath);
4581
4649
  var i = 0;
4582
4650
  while (i !== keyPath.length) {
@@ -4588,16 +4656,16 @@ function getIn(collection, searchKeyPath, notSetValue) {
4588
4656
  return collection;
4589
4657
  }
4590
4658
 
4591
- function getIn$1(searchKeyPath, notSetValue) {
4592
- return getIn(this, searchKeyPath, notSetValue);
4659
+ function getIn(searchKeyPath, notSetValue) {
4660
+ return getIn$1(this, searchKeyPath, notSetValue);
4593
4661
  }
4594
4662
 
4595
- function hasIn(collection, keyPath) {
4596
- return getIn(collection, keyPath, NOT_SET) !== NOT_SET;
4663
+ function hasIn$1(collection, keyPath) {
4664
+ return getIn$1(collection, keyPath, NOT_SET) !== NOT_SET;
4597
4665
  }
4598
4666
 
4599
- function hasIn$1(searchKeyPath) {
4600
- return hasIn(this, searchKeyPath);
4667
+ function hasIn(searchKeyPath) {
4668
+ return hasIn$1(this, searchKeyPath);
4601
4669
  }
4602
4670
 
4603
4671
  function toObject() {
@@ -4675,8 +4743,8 @@ mixin(Collection, {
4675
4743
  return isIndexed(this)
4676
4744
  ? this.toIndexedSeq()
4677
4745
  : isKeyed(this)
4678
- ? this.toKeyedSeq()
4679
- : this.toSetSeq();
4746
+ ? this.toKeyedSeq()
4747
+ : this.toSetSeq();
4680
4748
  },
4681
4749
 
4682
4750
  toStack: function toStack() {
@@ -4702,9 +4770,7 @@ mixin(Collection, {
4702
4770
  return (
4703
4771
  head +
4704
4772
  ' ' +
4705
- this.toSeq()
4706
- .map(this.__toStringMapper)
4707
- .join(', ') +
4773
+ this.toSeq().map(this.__toStringMapper).join(', ') +
4708
4774
  ' ' +
4709
4775
  tail
4710
4776
  );
@@ -4845,10 +4911,7 @@ mixin(Collection, {
4845
4911
  // We cache as an entries array, so we can just return the cache!
4846
4912
  return new ArraySeq(collection._cache);
4847
4913
  }
4848
- var entriesSequence = collection
4849
- .toSeq()
4850
- .map(entryMapper)
4851
- .toIndexedSeq();
4914
+ var entriesSequence = collection.toSeq().map(entryMapper).toIndexedSeq();
4852
4915
  entriesSequence.fromEntrySeq = function () { return collection.toSeq(); };
4853
4916
  return entriesSequence;
4854
4917
  },
@@ -4874,9 +4937,7 @@ mixin(Collection, {
4874
4937
  },
4875
4938
 
4876
4939
  findLast: function findLast(predicate, context, notSetValue) {
4877
- return this.toKeyedSeq()
4878
- .reverse()
4879
- .find(predicate, context, notSetValue);
4940
+ return this.toKeyedSeq().reverse().find(predicate, context, notSetValue);
4880
4941
  },
4881
4942
 
4882
4943
  findLastEntry: function findLastEntry(predicate, context, notSetValue) {
@@ -4886,9 +4947,7 @@ mixin(Collection, {
4886
4947
  },
4887
4948
 
4888
4949
  findLastKey: function findLastKey(predicate, context) {
4889
- return this.toKeyedSeq()
4890
- .reverse()
4891
- .findKey(predicate, context);
4950
+ return this.toKeyedSeq().reverse().findKey(predicate, context);
4892
4951
  },
4893
4952
 
4894
4953
  first: function first(notSetValue) {
@@ -4911,7 +4970,7 @@ mixin(Collection, {
4911
4970
  return this.find(function (_, key) { return is(key, searchKey); }, undefined, notSetValue);
4912
4971
  },
4913
4972
 
4914
- getIn: getIn$1,
4973
+ getIn: getIn,
4915
4974
 
4916
4975
  groupBy: function groupBy(grouper, context) {
4917
4976
  return groupByFactory(this, grouper, context);
@@ -4921,7 +4980,7 @@ mixin(Collection, {
4921
4980
  return this.get(searchKey, NOT_SET) !== NOT_SET;
4922
4981
  },
4923
4982
 
4924
- hasIn: hasIn$1,
4983
+ hasIn: hasIn,
4925
4984
 
4926
4985
  isSubset: function isSubset(iter) {
4927
4986
  iter = typeof iter.includes === 'function' ? iter : Collection(iter);
@@ -4938,21 +4997,15 @@ mixin(Collection, {
4938
4997
  },
4939
4998
 
4940
4999
  keySeq: function keySeq() {
4941
- return this.toSeq()
4942
- .map(keyMapper)
4943
- .toIndexedSeq();
5000
+ return this.toSeq().map(keyMapper).toIndexedSeq();
4944
5001
  },
4945
5002
 
4946
5003
  last: function last(notSetValue) {
4947
- return this.toSeq()
4948
- .reverse()
4949
- .first(notSetValue);
5004
+ return this.toSeq().reverse().first(notSetValue);
4950
5005
  },
4951
5006
 
4952
5007
  lastKeyOf: function lastKeyOf(searchValue) {
4953
- return this.toKeyedSeq()
4954
- .reverse()
4955
- .keyOf(searchValue);
5008
+ return this.toKeyedSeq().reverse().keyOf(searchValue);
4956
5009
  },
4957
5010
 
4958
5011
  max: function max(comparator) {
@@ -5044,7 +5097,7 @@ CollectionPrototype[IS_COLLECTION_SYMBOL] = true;
5044
5097
  CollectionPrototype[ITERATOR_SYMBOL] = CollectionPrototype.values;
5045
5098
  CollectionPrototype.toJSON = CollectionPrototype.toArray;
5046
5099
  CollectionPrototype.__toStringMapper = quoteString;
5047
- CollectionPrototype.inspect = CollectionPrototype.toSource = function() {
5100
+ CollectionPrototype.inspect = CollectionPrototype.toSource = function () {
5048
5101
  return this.toString();
5049
5102
  };
5050
5103
  CollectionPrototype.chain = CollectionPrototype.flatMap;
@@ -5058,25 +5111,25 @@ mixin(KeyedCollection, {
5058
5111
  },
5059
5112
 
5060
5113
  mapEntries: function mapEntries(mapper, context) {
5061
- var this$1 = this;
5114
+ var this$1$1 = this;
5062
5115
 
5063
5116
  var iterations = 0;
5064
5117
  return reify(
5065
5118
  this,
5066
5119
  this.toSeq()
5067
- .map(function (v, k) { return mapper.call(context, [k, v], iterations++, this$1); })
5120
+ .map(function (v, k) { return mapper.call(context, [k, v], iterations++, this$1$1); })
5068
5121
  .fromEntrySeq()
5069
5122
  );
5070
5123
  },
5071
5124
 
5072
5125
  mapKeys: function mapKeys(mapper, context) {
5073
- var this$1 = this;
5126
+ var this$1$1 = this;
5074
5127
 
5075
5128
  return reify(
5076
5129
  this,
5077
5130
  this.toSeq()
5078
5131
  .flip()
5079
- .map(function (k, v) { return mapper.call(context, k, v, this$1); })
5132
+ .map(function (k, v) { return mapper.call(context, k, v, this$1$1); })
5080
5133
  .flip()
5081
5134
  );
5082
5135
  },
@@ -5161,7 +5214,8 @@ mixin(IndexedCollection, {
5161
5214
  get: function get(index, notSetValue) {
5162
5215
  index = wrapIndex(this, index);
5163
5216
  return index < 0 ||
5164
- (this.size === Infinity || (this.size !== undefined && index > this.size))
5217
+ this.size === Infinity ||
5218
+ (this.size !== undefined && index > this.size)
5165
5219
  ? notSetValue
5166
5220
  : this.find(function (_, key) { return key === index; }, undefined, notSetValue);
5167
5221
  },
@@ -5274,13 +5328,13 @@ function entryMapper(v, k) {
5274
5328
  }
5275
5329
 
5276
5330
  function not(predicate) {
5277
- return function() {
5331
+ return function () {
5278
5332
  return !predicate.apply(this, arguments);
5279
5333
  };
5280
5334
  }
5281
5335
 
5282
5336
  function neg(predicate) {
5283
- return function() {
5337
+ return function () {
5284
5338
  return -predicate.apply(this, arguments);
5285
5339
  };
5286
5340
  }
@@ -5310,12 +5364,12 @@ function hashCollection(collection) {
5310
5364
  h = (h + hashMerge(hash(v), hash(k))) | 0;
5311
5365
  }
5312
5366
  : ordered
5313
- ? function (v) {
5314
- h = (31 * h + hash(v)) | 0;
5315
- }
5316
- : function (v) {
5317
- h = (h + hash(v)) | 0;
5318
- }
5367
+ ? function (v) {
5368
+ h = (31 * h + hash(v)) | 0;
5369
+ }
5370
+ : function (v) {
5371
+ h = (h + hash(v)) | 0;
5372
+ }
5319
5373
  );
5320
5374
  return murmurHashOfSize(size, h);
5321
5375
  }
@@ -5335,21 +5389,21 @@ function hashMerge(a, b) {
5335
5389
  return (a ^ (b + 0x9e3779b9 + (a << 6) + (a >> 2))) | 0; // int
5336
5390
  }
5337
5391
 
5338
- var OrderedSet = /*@__PURE__*/(function (Set$$1) {
5392
+ var OrderedSet = /*@__PURE__*/(function (Set) {
5339
5393
  function OrderedSet(value) {
5340
5394
  return value === null || value === undefined
5341
5395
  ? emptyOrderedSet()
5342
5396
  : isOrderedSet(value)
5343
- ? value
5344
- : emptyOrderedSet().withMutations(function (set) {
5345
- var iter = SetCollection(value);
5346
- assertNotInfinite(iter.size);
5347
- iter.forEach(function (v) { return set.add(v); });
5348
- });
5397
+ ? value
5398
+ : emptyOrderedSet().withMutations(function (set) {
5399
+ var iter = SetCollection(value);
5400
+ assertNotInfinite(iter.size);
5401
+ iter.forEach(function (v) { return set.add(v); });
5402
+ });
5349
5403
  }
5350
5404
 
5351
- if ( Set$$1 ) OrderedSet.__proto__ = Set$$1;
5352
- OrderedSet.prototype = Object.create( Set$$1 && Set$$1.prototype );
5405
+ if ( Set ) OrderedSet.__proto__ = Set;
5406
+ OrderedSet.prototype = Object.create( Set && Set.prototype );
5353
5407
  OrderedSet.prototype.constructor = OrderedSet;
5354
5408
 
5355
5409
  OrderedSet.of = function of (/*...values*/) {
@@ -5373,6 +5427,7 @@ var OrderedSetPrototype = OrderedSet.prototype;
5373
5427
  OrderedSetPrototype[IS_ORDERED_SYMBOL] = true;
5374
5428
  OrderedSetPrototype.zip = IndexedCollectionPrototype.zip;
5375
5429
  OrderedSetPrototype.zipWith = IndexedCollectionPrototype.zipWith;
5430
+ OrderedSetPrototype.zipAll = IndexedCollectionPrototype.zipAll;
5376
5431
 
5377
5432
  OrderedSetPrototype.__empty = emptyOrderedSet;
5378
5433
  OrderedSetPrototype.__make = makeOrderedSet;
@@ -5392,11 +5447,33 @@ function emptyOrderedSet() {
5392
5447
  );
5393
5448
  }
5394
5449
 
5450
+ function throwOnInvalidDefaultValues(defaultValues) {
5451
+ if (isRecord(defaultValues)) {
5452
+ throw new Error(
5453
+ 'Can not call `Record` with an immutable Record as default values. Use a plain javascript object instead.'
5454
+ );
5455
+ }
5456
+
5457
+ if (isImmutable(defaultValues)) {
5458
+ throw new Error(
5459
+ 'Can not call `Record` with an immutable Collection as default values. Use a plain javascript object instead.'
5460
+ );
5461
+ }
5462
+
5463
+ if (defaultValues === null || typeof defaultValues !== 'object') {
5464
+ throw new Error(
5465
+ 'Can not call `Record` with a non-object as default values. Use a plain javascript object instead.'
5466
+ );
5467
+ }
5468
+ }
5469
+
5395
5470
  var Record = function Record(defaultValues, name) {
5396
5471
  var hasInitialized;
5397
5472
 
5473
+ throwOnInvalidDefaultValues(defaultValues);
5474
+
5398
5475
  var RecordType = function Record(values) {
5399
- var this$1 = this;
5476
+ var this$1$1 = this;
5400
5477
 
5401
5478
  if (values instanceof RecordType) {
5402
5479
  return values;
@@ -5436,16 +5513,16 @@ var Record = function Record(defaultValues, name) {
5436
5513
  }
5437
5514
  this.__ownerID = undefined;
5438
5515
  this._values = List().withMutations(function (l) {
5439
- l.setSize(this$1._keys.length);
5516
+ l.setSize(this$1$1._keys.length);
5440
5517
  KeyedCollection(values).forEach(function (v, k) {
5441
- l.set(this$1._indices[k], v === this$1._defaultValues[k] ? undefined : v);
5518
+ l.set(this$1$1._indices[k], v === this$1$1._defaultValues[k] ? undefined : v);
5442
5519
  });
5443
5520
  });
5521
+ return this;
5444
5522
  };
5445
5523
 
5446
- var RecordTypePrototype = (RecordType.prototype = Object.create(
5447
- RecordPrototype
5448
- ));
5524
+ var RecordTypePrototype = (RecordType.prototype =
5525
+ Object.create(RecordPrototype));
5449
5526
  RecordTypePrototype.constructor = RecordType;
5450
5527
 
5451
5528
  if (name) {
@@ -5468,10 +5545,7 @@ Record.prototype.toString = function toString () {
5468
5545
 
5469
5546
  Record.prototype.equals = function equals (other) {
5470
5547
  return (
5471
- this === other ||
5472
- (other &&
5473
- this._keys === other._keys &&
5474
- recordSeq(this).equals(recordSeq(other)))
5548
+ this === other || (other && recordSeq(this).equals(recordSeq(other)))
5475
5549
  );
5476
5550
  };
5477
5551
 
@@ -5515,6 +5589,7 @@ Record.prototype.remove = function remove (k) {
5515
5589
 
5516
5590
  Record.prototype.clear = function clear () {
5517
5591
  var newValues = this._values.clear().setSize(this._keys.length);
5592
+
5518
5593
  return this.__ownerID ? this : makeRecord(this, newValues);
5519
5594
  };
5520
5595
 
@@ -5561,24 +5636,24 @@ var RecordPrototype = Record.prototype;
5561
5636
  RecordPrototype[IS_RECORD_SYMBOL] = true;
5562
5637
  RecordPrototype[DELETE] = RecordPrototype.remove;
5563
5638
  RecordPrototype.deleteIn = RecordPrototype.removeIn = deleteIn;
5564
- RecordPrototype.getIn = getIn$1;
5639
+ RecordPrototype.getIn = getIn;
5565
5640
  RecordPrototype.hasIn = CollectionPrototype.hasIn;
5566
- RecordPrototype.merge = merge;
5567
- RecordPrototype.mergeWith = mergeWith;
5641
+ RecordPrototype.merge = merge$1;
5642
+ RecordPrototype.mergeWith = mergeWith$1;
5568
5643
  RecordPrototype.mergeIn = mergeIn;
5569
- RecordPrototype.mergeDeep = mergeDeep$1;
5570
- RecordPrototype.mergeDeepWith = mergeDeepWith$1;
5644
+ RecordPrototype.mergeDeep = mergeDeep;
5645
+ RecordPrototype.mergeDeepWith = mergeDeepWith;
5571
5646
  RecordPrototype.mergeDeepIn = mergeDeepIn;
5572
- RecordPrototype.setIn = setIn$1;
5573
- RecordPrototype.update = update$1;
5574
- RecordPrototype.updateIn = updateIn$1;
5647
+ RecordPrototype.setIn = setIn;
5648
+ RecordPrototype.update = update;
5649
+ RecordPrototype.updateIn = updateIn;
5575
5650
  RecordPrototype.withMutations = withMutations;
5576
5651
  RecordPrototype.asMutable = asMutable;
5577
5652
  RecordPrototype.asImmutable = asImmutable;
5578
5653
  RecordPrototype[ITERATOR_SYMBOL] = RecordPrototype.entries;
5579
5654
  RecordPrototype.toJSON = RecordPrototype.toObject =
5580
5655
  CollectionPrototype.toObject;
5581
- RecordPrototype.inspect = RecordPrototype.toSource = function() {
5656
+ RecordPrototype.inspect = RecordPrototype.toSource = function () {
5582
5657
  return this.toString();
5583
5658
  };
5584
5659
 
@@ -5600,10 +5675,10 @@ function recordSeq(record) {
5600
5675
  function setProp(prototype, name) {
5601
5676
  try {
5602
5677
  Object.defineProperty(prototype, name, {
5603
- get: function() {
5678
+ get: function () {
5604
5679
  return this.get(name);
5605
5680
  },
5606
- set: function(value) {
5681
+ set: function (value) {
5607
5682
  invariant(this.__ownerID, 'Cannot set on an immutable record.');
5608
5683
  this.set(name, value);
5609
5684
  },
@@ -5617,7 +5692,7 @@ function setProp(prototype, name) {
5617
5692
  * Returns a lazy Seq of `value` repeated `times` times. When `times` is
5618
5693
  * undefined, returns an infinite sequence of `value`.
5619
5694
  */
5620
- var Repeat = /*@__PURE__*/(function (IndexedSeq$$1) {
5695
+ var Repeat = /*@__PURE__*/(function (IndexedSeq) {
5621
5696
  function Repeat(value, times) {
5622
5697
  if (!(this instanceof Repeat)) {
5623
5698
  return new Repeat(value, times);
@@ -5632,8 +5707,8 @@ var Repeat = /*@__PURE__*/(function (IndexedSeq$$1) {
5632
5707
  }
5633
5708
  }
5634
5709
 
5635
- if ( IndexedSeq$$1 ) Repeat.__proto__ = IndexedSeq$$1;
5636
- Repeat.prototype = Object.create( IndexedSeq$$1 && IndexedSeq$$1.prototype );
5710
+ if ( IndexedSeq ) Repeat.__proto__ = IndexedSeq;
5711
+ Repeat.prototype = Object.create( IndexedSeq && IndexedSeq.prototype );
5637
5712
  Repeat.prototype.constructor = Repeat;
5638
5713
 
5639
5714
  Repeat.prototype.toString = function toString () {
@@ -5691,14 +5766,13 @@ var Repeat = /*@__PURE__*/(function (IndexedSeq$$1) {
5691
5766
  };
5692
5767
 
5693
5768
  Repeat.prototype.__iterator = function __iterator (type, reverse) {
5694
- var this$1 = this;
5769
+ var this$1$1 = this;
5695
5770
 
5696
5771
  var size = this.size;
5697
5772
  var i = 0;
5698
- return new Iterator(
5699
- function () { return i === size
5700
- ? iteratorDone()
5701
- : iteratorValue(type, reverse ? size - ++i : i++, this$1._value); }
5773
+ return new Iterator(function () { return i === size
5774
+ ? iteratorDone()
5775
+ : iteratorValue(type, reverse ? size - ++i : i++, this$1$1._value); }
5702
5776
  );
5703
5777
  };
5704
5778
 
@@ -5727,9 +5801,9 @@ function fromJS(value, converter) {
5727
5801
  function fromJSWith(stack, converter, value, key, keyPath, parentValue) {
5728
5802
  var toSeq = Array.isArray(value)
5729
5803
  ? IndexedSeq
5730
- : isPlainObj(value)
5731
- ? KeyedSeq
5732
- : null;
5804
+ : isPlainObject(value)
5805
+ ? KeyedSeq
5806
+ : null;
5733
5807
  if (toSeq) {
5734
5808
  if (~stack.indexOf(value)) {
5735
5809
  throw new TypeError('Cannot convert circular structure to Immutable');
@@ -5754,7 +5828,7 @@ function defaultConverter(k, v) {
5754
5828
  return isKeyed(v) ? v.toMap() : v.toList();
5755
5829
  }
5756
5830
 
5757
- var version = "4.0.0-rc.11";
5831
+ var version = "4.0.0-rc.14";
5758
5832
 
5759
5833
  var Immutable = {
5760
5834
  version: version,
@@ -5786,6 +5860,7 @@ var Immutable = {
5786
5860
  isAssociative: isAssociative,
5787
5861
  isOrdered: isOrdered,
5788
5862
  isValueObject: isValueObject,
5863
+ isPlainObject: isPlainObject,
5789
5864
  isSeq: isSeq,
5790
5865
  isList: isList,
5791
5866
  isMap: isMap,
@@ -5796,23 +5871,23 @@ var Immutable = {
5796
5871
  isRecord: isRecord,
5797
5872
 
5798
5873
  get: get,
5799
- getIn: getIn,
5874
+ getIn: getIn$1,
5800
5875
  has: has,
5801
- hasIn: hasIn,
5802
- merge: merge$1,
5803
- mergeDeep: mergeDeep,
5804
- mergeWith: mergeWith$1,
5805
- mergeDeepWith: mergeDeepWith,
5876
+ hasIn: hasIn$1,
5877
+ merge: merge,
5878
+ mergeDeep: mergeDeep$1,
5879
+ mergeWith: mergeWith,
5880
+ mergeDeepWith: mergeDeepWith$1,
5806
5881
  remove: remove,
5807
5882
  removeIn: removeIn,
5808
5883
  set: set,
5809
- setIn: setIn,
5810
- update: update,
5811
- updateIn: updateIn,
5884
+ setIn: setIn$1,
5885
+ update: update$1,
5886
+ updateIn: updateIn$1,
5812
5887
  };
5813
5888
 
5814
5889
  // Note: Iterable is deprecated
5815
5890
  var Iterable = Collection;
5816
5891
 
5817
5892
  export default Immutable;
5818
- export { version, Collection, Iterable, Seq, Map, OrderedMap, List, Stack, Set, OrderedSet, Record, Range, Repeat, is, fromJS, hash, isImmutable, isCollection, isKeyed, isIndexed, isAssociative, isOrdered, isValueObject, get, getIn, has, hasIn, merge$1 as merge, mergeDeep, mergeWith$1 as mergeWith, mergeDeepWith, remove, removeIn, set, setIn, update, updateIn };
5893
+ export { Collection, Iterable, List, Map, OrderedMap, OrderedSet, Range, Record, Repeat, Seq, Set, Stack, fromJS, get, getIn$1 as getIn, has, hasIn$1 as hasIn, hash, is, isAssociative, isCollection, isImmutable, isIndexed, isKeyed, isList, isMap, isOrdered, isOrderedMap, isOrderedSet, isPlainObject, isRecord, isSeq, isSet, isStack, isValueObject, merge, mergeDeep$1 as mergeDeep, mergeDeepWith$1 as mergeDeepWith, mergeWith, remove, removeIn, set, setIn$1 as setIn, update$1 as update, updateIn$1 as updateIn, version };