mobx 6.3.13 → 6.4.0

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.
Files changed (60) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +1 -0
  3. package/dist/errors.d.ts +2 -2
  4. package/dist/mobx.cjs.development.js +940 -263
  5. package/dist/mobx.cjs.development.js.map +1 -1
  6. package/dist/mobx.cjs.production.min.js.map +1 -1
  7. package/dist/mobx.esm.development.js +940 -263
  8. package/dist/mobx.esm.development.js.map +1 -1
  9. package/dist/mobx.esm.js +958 -269
  10. package/dist/mobx.esm.js.map +1 -1
  11. package/dist/mobx.esm.production.min.js.map +1 -1
  12. package/dist/mobx.umd.development.js +940 -263
  13. package/dist/mobx.umd.development.js.map +1 -1
  14. package/dist/mobx.umd.production.min.js.map +1 -1
  15. package/dist/types/observablemap.d.ts +2 -2
  16. package/dist/utils/utils.d.ts +1 -1
  17. package/package.json +1 -1
  18. package/src/api/action.ts +8 -3
  19. package/src/api/annotation.ts +1 -2
  20. package/src/api/autorun.ts +22 -8
  21. package/src/api/computed.ts +5 -2
  22. package/src/api/configure.ts +6 -2
  23. package/src/api/extendobservable.ts +11 -5
  24. package/src/api/extras.ts +4 -2
  25. package/src/api/flow.ts +11 -4
  26. package/src/api/intercept-read.ts +4 -2
  27. package/src/api/intercept.ts +5 -2
  28. package/src/api/iscomputed.ts +10 -4
  29. package/src/api/isobservable.ts +10 -4
  30. package/src/api/makeObservable.ts +4 -2
  31. package/src/api/object-api.ts +30 -16
  32. package/src/api/observable.ts +23 -9
  33. package/src/api/observe.ts +4 -2
  34. package/src/api/tojs.ts +7 -3
  35. package/src/api/trace.ts +6 -2
  36. package/src/api/when.ts +12 -5
  37. package/src/core/action.ts +8 -3
  38. package/src/core/computedvalue.ts +29 -9
  39. package/src/core/derivation.ts +25 -9
  40. package/src/core/globalstate.ts +18 -7
  41. package/src/core/observable.ts +14 -5
  42. package/src/core/reaction.ts +15 -6
  43. package/src/core/spy.ts +20 -7
  44. package/src/errors.ts +2 -2
  45. package/src/types/actionannotation.ts +2 -2
  46. package/src/types/dynamicobject.ts +10 -4
  47. package/src/types/flowannotation.ts +3 -1
  48. package/src/types/intercept-utils.ts +9 -3
  49. package/src/types/legacyobservablearray.ts +5 -3
  50. package/src/types/listen-utils.ts +6 -2
  51. package/src/types/modifiers.ts +39 -14
  52. package/src/types/observablearray.ts +78 -30
  53. package/src/types/observablemap.ts +60 -24
  54. package/src/types/observableobject.ts +52 -18
  55. package/src/types/observableset.ts +29 -10
  56. package/src/types/observablevalue.ts +13 -5
  57. package/src/types/type-utils.ts +33 -11
  58. package/src/utils/comparer.ts +4 -4
  59. package/src/utils/eq.ts +45 -15
  60. package/src/utils/utils.ts +42 -20
package/dist/mobx.esm.js CHANGED
@@ -23,9 +23,9 @@ var niceErrors = {
23
23
  10: "'has()' can only be used on observable objects, arrays and maps",
24
24
  11: "'get()' can only be used on observable objects, arrays and maps",
25
25
  12: "Invalid annotation",
26
- 13: "Dynamic observable objects cannot be frozen",
26
+ 13: "Dynamic observable objects cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)",
27
27
  14: "Intercept handlers should return nothing or a change object",
28
- 15: "Observable arrays cannot be frozen",
28
+ 15: "Observable arrays cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)",
29
29
  16: "Modification exception: the internal structure of an observable array was changed.",
30
30
  17: function _(index, length) {
31
31
  return "[mobx.array] Index out of bounds, " + index + " is larger than " + length;
@@ -141,7 +141,10 @@ function getNextId() {
141
141
  function once(func) {
142
142
  var invoked = false;
143
143
  return function () {
144
- if (invoked) return;
144
+ if (invoked) {
145
+ return;
146
+ }
147
+
145
148
  invoked = true;
146
149
  return func.apply(this, arguments);
147
150
  };
@@ -166,17 +169,31 @@ function isObject(value) {
166
169
  return value !== null && typeof value === "object";
167
170
  }
168
171
  function isPlainObject(value) {
169
- if (!isObject(value)) return false;
172
+ if (!isObject(value)) {
173
+ return false;
174
+ }
175
+
170
176
  var proto = Object.getPrototypeOf(value);
171
- if (proto == null) return true;
177
+
178
+ if (proto == null) {
179
+ return true;
180
+ }
181
+
172
182
  var protoConstructor = Object.hasOwnProperty.call(proto, "constructor") && proto.constructor;
173
183
  return typeof protoConstructor === "function" && protoConstructor.toString() === plainObjectString;
174
184
  } // https://stackoverflow.com/a/37865170
175
185
 
176
186
  function isGenerator(obj) {
177
187
  var constructor = obj == null ? void 0 : obj.constructor;
178
- if (!constructor) return false;
179
- if ("GeneratorFunction" === constructor.name || "GeneratorFunction" === constructor.displayName) return true;
188
+
189
+ if (!constructor) {
190
+ return false;
191
+ }
192
+
193
+ if ("GeneratorFunction" === constructor.name || "GeneratorFunction" === constructor.displayName) {
194
+ return true;
195
+ }
196
+
180
197
  return false;
181
198
  }
182
199
  function addHiddenProp(object, propName, value) {
@@ -216,9 +233,16 @@ var hasGetOwnPropertySymbols = typeof Object.getOwnPropertySymbols !== "undefine
216
233
  function getPlainObjectKeys(object) {
217
234
  var keys = Object.keys(object); // Not supported in IE, so there are not going to be symbol props anyway...
218
235
 
219
- if (!hasGetOwnPropertySymbols) return keys;
236
+ if (!hasGetOwnPropertySymbols) {
237
+ return keys;
238
+ }
239
+
220
240
  var symbols = Object.getOwnPropertySymbols(object);
221
- if (!symbols.length) return keys;
241
+
242
+ if (!symbols.length) {
243
+ return keys;
244
+ }
245
+
222
246
  return [].concat(keys, symbols.filter(function (s) {
223
247
  return objectPrototype.propertyIsEnumerable.call(object, s);
224
248
  }));
@@ -231,8 +255,14 @@ var ownKeys = typeof Reflect !== "undefined" && Reflect.ownKeys ? Reflect.ownKey
231
255
  /* istanbul ignore next */
232
256
  Object.getOwnPropertyNames;
233
257
  function stringifyKey(key) {
234
- if (typeof key === "string") return key;
235
- if (typeof key === "symbol") return key.toString();
258
+ if (typeof key === "string") {
259
+ return key;
260
+ }
261
+
262
+ if (typeof key === "symbol") {
263
+ return key.toString();
264
+ }
265
+
236
266
  return new String(key).toString();
237
267
  }
238
268
  function toPrimitive(value) {
@@ -520,7 +550,10 @@ function shallowComparer(a, b) {
520
550
  }
521
551
 
522
552
  function defaultComparer(a, b) {
523
- if (Object.is) return Object.is(a, b);
553
+ if (Object.is) {
554
+ return Object.is(a, b);
555
+ }
556
+
524
557
  return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;
525
558
  }
526
559
 
@@ -533,20 +566,34 @@ var comparer = {
533
566
 
534
567
  function deepEnhancer(v, _, name) {
535
568
  // it is an observable already, done
536
- if (isObservable(v)) return v; // something that can be converted and mutated?
569
+ if (isObservable(v)) {
570
+ return v;
571
+ } // something that can be converted and mutated?
537
572
 
538
- if (Array.isArray(v)) return observable.array(v, {
539
- name: name
540
- });
541
- if (isPlainObject(v)) return observable.object(v, undefined, {
542
- name: name
543
- });
544
- if (isES6Map(v)) return observable.map(v, {
545
- name: name
546
- });
547
- if (isES6Set(v)) return observable.set(v, {
548
- name: name
549
- });
573
+
574
+ if (Array.isArray(v)) {
575
+ return observable.array(v, {
576
+ name: name
577
+ });
578
+ }
579
+
580
+ if (isPlainObject(v)) {
581
+ return observable.object(v, undefined, {
582
+ name: name
583
+ });
584
+ }
585
+
586
+ if (isES6Map(v)) {
587
+ return observable.map(v, {
588
+ name: name
589
+ });
590
+ }
591
+
592
+ if (isES6Set(v)) {
593
+ return observable.set(v, {
594
+ name: name
595
+ });
596
+ }
550
597
 
551
598
  if (typeof v === "function" && !isAction(v) && !isFlow(v)) {
552
599
  if (isGenerator(v)) {
@@ -559,33 +606,59 @@ function deepEnhancer(v, _, name) {
559
606
  return v;
560
607
  }
561
608
  function shallowEnhancer(v, _, name) {
562
- if (v === undefined || v === null) return v;
563
- if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v) || isObservableSet(v)) return v;
564
- if (Array.isArray(v)) return observable.array(v, {
565
- name: name,
566
- deep: false
567
- });
568
- if (isPlainObject(v)) return observable.object(v, undefined, {
569
- name: name,
570
- deep: false
571
- });
572
- if (isES6Map(v)) return observable.map(v, {
573
- name: name,
574
- deep: false
575
- });
576
- if (isES6Set(v)) return observable.set(v, {
577
- name: name,
578
- deep: false
579
- });
580
- if (process.env.NODE_ENV !== "production") die("The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets");
609
+ if (v === undefined || v === null) {
610
+ return v;
611
+ }
612
+
613
+ if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v) || isObservableSet(v)) {
614
+ return v;
615
+ }
616
+
617
+ if (Array.isArray(v)) {
618
+ return observable.array(v, {
619
+ name: name,
620
+ deep: false
621
+ });
622
+ }
623
+
624
+ if (isPlainObject(v)) {
625
+ return observable.object(v, undefined, {
626
+ name: name,
627
+ deep: false
628
+ });
629
+ }
630
+
631
+ if (isES6Map(v)) {
632
+ return observable.map(v, {
633
+ name: name,
634
+ deep: false
635
+ });
636
+ }
637
+
638
+ if (isES6Set(v)) {
639
+ return observable.set(v, {
640
+ name: name,
641
+ deep: false
642
+ });
643
+ }
644
+
645
+ if (process.env.NODE_ENV !== "production") {
646
+ die("The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets");
647
+ }
581
648
  }
582
649
  function referenceEnhancer(newValue) {
583
650
  // never turn into an observable
584
651
  return newValue;
585
652
  }
586
653
  function refStructEnhancer(v, oldValue) {
587
- if (process.env.NODE_ENV !== "production" && isObservable(v)) die("observable.struct should not be used with observable values");
588
- if (deepEqual(v, oldValue)) return oldValue;
654
+ if (process.env.NODE_ENV !== "production" && isObservable(v)) {
655
+ die("observable.struct should not be used with observable values");
656
+ }
657
+
658
+ if (deepEqual(v, oldValue)) {
659
+ return oldValue;
660
+ }
661
+
589
662
  return v;
590
663
  }
591
664
 
@@ -734,9 +807,11 @@ function make_$2(adm, key, descriptor, source) {
734
807
 
735
808
 
736
809
  if ((_this$options_ = this.options_) != null && _this$options_.bound && (!hasProp(adm.target_, key) || !isFlow(adm.target_[key]))) {
737
- if (this.extend_(adm, key, descriptor, false) === null) return 0
738
- /* Cancel */
739
- ;
810
+ if (this.extend_(adm, key, descriptor, false) === null) {
811
+ return 0
812
+ /* Cancel */
813
+ ;
814
+ }
740
815
  }
741
816
 
742
817
  if (isFlow(descriptor.value)) {
@@ -1027,17 +1102,35 @@ function createObservable(v, arg2, arg3) {
1027
1102
  } // already observable - ignore
1028
1103
 
1029
1104
 
1030
- if (isObservable(v)) return v; // plain object
1105
+ if (isObservable(v)) {
1106
+ return v;
1107
+ } // plain object
1108
+
1109
+
1110
+ if (isPlainObject(v)) {
1111
+ return observable.object(v, arg2, arg3);
1112
+ } // Array
1113
+
1114
+
1115
+ if (Array.isArray(v)) {
1116
+ return observable.array(v, arg2);
1117
+ } // Map
1118
+
1031
1119
 
1032
- if (isPlainObject(v)) return observable.object(v, arg2, arg3); // Array
1120
+ if (isES6Map(v)) {
1121
+ return observable.map(v, arg2);
1122
+ } // Set
1033
1123
 
1034
- if (Array.isArray(v)) return observable.array(v, arg2); // Map
1035
1124
 
1036
- if (isES6Map(v)) return observable.map(v, arg2); // Set
1125
+ if (isES6Set(v)) {
1126
+ return observable.set(v, arg2);
1127
+ } // other object - ignore
1037
1128
 
1038
- if (isES6Set(v)) return observable.set(v, arg2); // other object - ignore
1039
1129
 
1040
- if (typeof v === "object" && v !== null) return v; // anything else
1130
+ if (typeof v === "object" && v !== null) {
1131
+ return v;
1132
+ } // anything else
1133
+
1041
1134
 
1042
1135
  return observable.box(v, arg2);
1043
1136
  }
@@ -1095,8 +1188,13 @@ var computed = function computed(arg1, arg2) {
1095
1188
 
1096
1189
 
1097
1190
  if (process.env.NODE_ENV !== "production") {
1098
- if (!isFunction(arg1)) die("First argument to `computed` should be an expression.");
1099
- if (isFunction(arg2)) die("A setter as second argument is no longer supported, use `{ set: fn }` option instead");
1191
+ if (!isFunction(arg1)) {
1192
+ die("First argument to `computed` should be an expression.");
1193
+ }
1194
+
1195
+ if (isFunction(arg2)) {
1196
+ die("A setter as second argument is no longer supported, use `{ set: fn }` option instead");
1197
+ }
1100
1198
  }
1101
1199
 
1102
1200
  var opts = isPlainObject(arg2) ? arg2 : {};
@@ -1128,8 +1226,13 @@ function createAction(actionName, fn, autoAction, ref) {
1128
1226
  }
1129
1227
 
1130
1228
  if (process.env.NODE_ENV !== "production") {
1131
- if (!isFunction(fn)) die("`action` can only be invoked on functions");
1132
- if (typeof actionName !== "string" || !actionName) die("actions should have valid names, got: '" + actionName + "'");
1229
+ if (!isFunction(fn)) {
1230
+ die("`action` can only be invoked on functions");
1231
+ }
1232
+
1233
+ if (typeof actionName !== "string" || !actionName) {
1234
+ die("actions should have valid names, got: '" + actionName + "'");
1235
+ }
1133
1236
  }
1134
1237
 
1135
1238
  function res() {
@@ -1211,7 +1314,10 @@ function _endAction(runInfo) {
1211
1314
  allowStateChangesEnd(runInfo.prevAllowStateChanges_);
1212
1315
  allowStateReadsEnd(runInfo.prevAllowStateReads_);
1213
1316
  endBatch();
1214
- if (runInfo.runAsAction_) untrackedEnd(runInfo.prevDerivation_);
1317
+
1318
+ if (runInfo.runAsAction_) {
1319
+ untrackedEnd(runInfo.prevDerivation_);
1320
+ }
1215
1321
 
1216
1322
  if (process.env.NODE_ENV !== "production" && runInfo.notifySpy_) {
1217
1323
  spyReportEnd({
@@ -1291,7 +1397,10 @@ var ObservableValue = /*#__PURE__*/function (_Atom, _Symbol$toPrimitive2) {
1291
1397
  var _proto = ObservableValue.prototype;
1292
1398
 
1293
1399
  _proto.dehanceValue = function dehanceValue(value) {
1294
- if (this.dehancer !== undefined) return this.dehancer(value);
1400
+ if (this.dehancer !== undefined) {
1401
+ return this.dehancer(value);
1402
+ }
1403
+
1295
1404
  return value;
1296
1405
  };
1297
1406
 
@@ -1314,7 +1423,10 @@ var ObservableValue = /*#__PURE__*/function (_Atom, _Symbol$toPrimitive2) {
1314
1423
  }
1315
1424
 
1316
1425
  this.setNewValue_(newValue);
1317
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportEnd();
1426
+
1427
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
1428
+ spyReportEnd();
1429
+ }
1318
1430
  }
1319
1431
  };
1320
1432
 
@@ -1327,7 +1439,11 @@ var ObservableValue = /*#__PURE__*/function (_Atom, _Symbol$toPrimitive2) {
1327
1439
  type: UPDATE,
1328
1440
  newValue: newValue
1329
1441
  });
1330
- if (!change) return globalState.UNCHANGED;
1442
+
1443
+ if (!change) {
1444
+ return globalState.UNCHANGED;
1445
+ }
1446
+
1331
1447
  newValue = change.newValue;
1332
1448
  } // apply modifier
1333
1449
 
@@ -1361,14 +1477,17 @@ var ObservableValue = /*#__PURE__*/function (_Atom, _Symbol$toPrimitive2) {
1361
1477
  };
1362
1478
 
1363
1479
  _proto.observe_ = function observe_(listener, fireImmediately) {
1364
- if (fireImmediately) listener({
1365
- observableKind: "value",
1366
- debugObjectName: this.name_,
1367
- object: this,
1368
- type: UPDATE,
1369
- newValue: this.value_,
1370
- oldValue: undefined
1371
- });
1480
+ if (fireImmediately) {
1481
+ listener({
1482
+ observableKind: "value",
1483
+ debugObjectName: this.name_,
1484
+ object: this,
1485
+ type: UPDATE,
1486
+ newValue: this.value_,
1487
+ oldValue: undefined
1488
+ });
1489
+ }
1490
+
1372
1491
  return registerListener(this, listener);
1373
1492
  };
1374
1493
 
@@ -1463,7 +1582,11 @@ var ComputedValue = /*#__PURE__*/function (_Symbol$toPrimitive2) {
1463
1582
  this.keepAlive_ = void 0;
1464
1583
  this.onBOL = void 0;
1465
1584
  this.onBUOL = void 0;
1466
- if (!options.get) die(31);
1585
+
1586
+ if (!options.get) {
1587
+ die(31);
1588
+ }
1589
+
1467
1590
  this.derivation = options.get;
1468
1591
  this.name_ = options.name || (process.env.NODE_ENV !== "production" ? "ComputedValue@" + getNextId() : "ComputedValue");
1469
1592
 
@@ -1505,7 +1628,9 @@ var ComputedValue = /*#__PURE__*/function (_Symbol$toPrimitive2) {
1505
1628
  ;
1506
1629
 
1507
1630
  _proto.get = function get() {
1508
- if (this.isComputing_) die(32, this.name_, this.derivation);
1631
+ if (this.isComputing_) {
1632
+ die(32, this.name_, this.derivation);
1633
+ }
1509
1634
 
1510
1635
  if (globalState.inBatch === 0 && // !globalState.trackingDerivatpion &&
1511
1636
  this.observers_.size === 0 && !this.keepAlive_) {
@@ -1521,20 +1646,34 @@ var ComputedValue = /*#__PURE__*/function (_Symbol$toPrimitive2) {
1521
1646
 
1522
1647
  if (shouldCompute(this)) {
1523
1648
  var prevTrackingContext = globalState.trackingContext;
1524
- if (this.keepAlive_ && !prevTrackingContext) globalState.trackingContext = this;
1525
- if (this.trackAndCompute()) propagateChangeConfirmed(this);
1649
+
1650
+ if (this.keepAlive_ && !prevTrackingContext) {
1651
+ globalState.trackingContext = this;
1652
+ }
1653
+
1654
+ if (this.trackAndCompute()) {
1655
+ propagateChangeConfirmed(this);
1656
+ }
1657
+
1526
1658
  globalState.trackingContext = prevTrackingContext;
1527
1659
  }
1528
1660
  }
1529
1661
 
1530
1662
  var result = this.value_;
1531
- if (isCaughtException(result)) throw result.cause;
1663
+
1664
+ if (isCaughtException(result)) {
1665
+ throw result.cause;
1666
+ }
1667
+
1532
1668
  return result;
1533
1669
  };
1534
1670
 
1535
1671
  _proto.set = function set(value) {
1536
1672
  if (this.setter_) {
1537
- if (this.isRunningSetter_) die(33, this.name_);
1673
+ if (this.isRunningSetter_) {
1674
+ die(33, this.name_);
1675
+ }
1676
+
1538
1677
  this.isRunningSetter_ = true;
1539
1678
 
1540
1679
  try {
@@ -1542,7 +1681,9 @@ var ComputedValue = /*#__PURE__*/function (_Symbol$toPrimitive2) {
1542
1681
  } finally {
1543
1682
  this.isRunningSetter_ = false;
1544
1683
  }
1545
- } else die(34, this.name_);
1684
+ } else {
1685
+ die(34, this.name_);
1686
+ }
1546
1687
  };
1547
1688
 
1548
1689
  _proto.trackAndCompute = function trackAndCompute() {
@@ -1636,7 +1777,9 @@ var ComputedValue = /*#__PURE__*/function (_Symbol$toPrimitive2) {
1636
1777
  };
1637
1778
 
1638
1779
  _proto.warnAboutUntrackedRead_ = function warnAboutUntrackedRead_() {
1639
- if (!(process.env.NODE_ENV !== "production")) return;
1780
+ if (!(process.env.NODE_ENV !== "production")) {
1781
+ return;
1782
+ }
1640
1783
 
1641
1784
  if (this.isTracing_ !== TraceMode.NONE) {
1642
1785
  console.log("[mobx.trace] Computed value '" + this.name_ + "' is being read outside a reactive context. Doing a full recompute.");
@@ -1775,7 +1918,9 @@ function checkIfStateModificationsAreAllowed(atom) {
1775
1918
 
1776
1919
  var hasObservers = atom.observers_.size > 0; // Should not be possible to change observed state outside strict mode, except during initialization, see #563
1777
1920
 
1778
- if (!globalState.allowStateChanges && (hasObservers || globalState.enforceActions === "always")) console.warn("[MobX] " + (globalState.enforceActions ? "Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: " : "Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: ") + atom.name_);
1921
+ if (!globalState.allowStateChanges && (hasObservers || globalState.enforceActions === "always")) {
1922
+ console.warn("[MobX] " + (globalState.enforceActions ? "Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: " : "Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: ") + atom.name_);
1923
+ }
1779
1924
  }
1780
1925
  function checkIfStateReadsAreAllowed(observable) {
1781
1926
  if (process.env.NODE_ENV !== "production" && !globalState.allowStateReads && globalState.observableRequiresReaction) {
@@ -1820,8 +1965,13 @@ function trackDerivedFunction(derivation, f, context) {
1820
1965
  }
1821
1966
 
1822
1967
  function warnAboutDerivationWithoutDependencies(derivation) {
1823
- if (!(process.env.NODE_ENV !== "production")) return;
1824
- if (derivation.observing_.length !== 0) return;
1968
+ if (!(process.env.NODE_ENV !== "production")) {
1969
+ return;
1970
+ }
1971
+
1972
+ if (derivation.observing_.length !== 0) {
1973
+ return;
1974
+ }
1825
1975
 
1826
1976
  if (globalState.reactionRequiresObservable || derivation.requiresObservable_) {
1827
1977
  console.warn("[mobx] Derivation '" + derivation.name_ + "' is created/updated without reading any observable value.");
@@ -1850,7 +2000,11 @@ function bindDependencies(derivation) {
1850
2000
 
1851
2001
  if (dep.diffValue_ === 0) {
1852
2002
  dep.diffValue_ = 1;
1853
- if (i0 !== i) observing[i0] = dep;
2003
+
2004
+ if (i0 !== i) {
2005
+ observing[i0] = dep;
2006
+ }
2007
+
1854
2008
  i0++;
1855
2009
  } // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined,
1856
2010
  // not hitting the condition
@@ -1942,7 +2096,10 @@ function allowStateReadsEnd(prev) {
1942
2096
  */
1943
2097
 
1944
2098
  function changeDependenciesStateTo0(derivation) {
1945
- if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) return;
2099
+ if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {
2100
+ return;
2101
+ }
2102
+
1946
2103
  derivation.dependenciesState_ = IDerivationState_.UP_TO_DATE_;
1947
2104
  var obs = derivation.observing_;
1948
2105
  var i = obs.length;
@@ -1986,8 +2143,14 @@ var canMergeGlobalState = true;
1986
2143
  var isolateCalled = false;
1987
2144
  var globalState = /*#__PURE__*/function () {
1988
2145
  var global = /*#__PURE__*/getGlobal();
1989
- if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) canMergeGlobalState = false;
1990
- if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals().version) canMergeGlobalState = false;
2146
+
2147
+ if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) {
2148
+ canMergeGlobalState = false;
2149
+ }
2150
+
2151
+ if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals().version) {
2152
+ canMergeGlobalState = false;
2153
+ }
1991
2154
 
1992
2155
  if (!canMergeGlobalState) {
1993
2156
  // Because this is a IIFE we need to let isolateCalled a chance to change
@@ -2000,7 +2163,11 @@ var globalState = /*#__PURE__*/function () {
2000
2163
  return new MobXGlobals();
2001
2164
  } else if (global.__mobxGlobals) {
2002
2165
  global.__mobxInstanceCount += 1;
2003
- if (!global.__mobxGlobals.UNCHANGED) global.__mobxGlobals.UNCHANGED = {}; // make merge backward compatible
2166
+
2167
+ if (!global.__mobxGlobals.UNCHANGED) {
2168
+ global.__mobxGlobals.UNCHANGED = {};
2169
+ } // make merge backward compatible
2170
+
2004
2171
 
2005
2172
  return global.__mobxGlobals;
2006
2173
  } else {
@@ -2009,12 +2176,19 @@ var globalState = /*#__PURE__*/function () {
2009
2176
  }
2010
2177
  }();
2011
2178
  function isolateGlobalState() {
2012
- if (globalState.pendingReactions.length || globalState.inBatch || globalState.isRunningReactions) die(36);
2179
+ if (globalState.pendingReactions.length || globalState.inBatch || globalState.isRunningReactions) {
2180
+ die(36);
2181
+ }
2182
+
2013
2183
  isolateCalled = true;
2014
2184
 
2015
2185
  if (canMergeGlobalState) {
2016
2186
  var global = getGlobal();
2017
- if (--global.__mobxInstanceCount === 0) global.__mobxGlobals = undefined;
2187
+
2188
+ if (--global.__mobxInstanceCount === 0) {
2189
+ global.__mobxGlobals = undefined;
2190
+ }
2191
+
2018
2192
  globalState = new MobXGlobals();
2019
2193
  }
2020
2194
  }
@@ -2030,7 +2204,9 @@ function resetGlobalState() {
2030
2204
  var defaultGlobals = new MobXGlobals();
2031
2205
 
2032
2206
  for (var key in defaultGlobals) {
2033
- if (persistentKeys.indexOf(key) === -1) globalState[key] = defaultGlobals[key];
2207
+ if (persistentKeys.indexOf(key) === -1) {
2208
+ globalState[key] = defaultGlobals[key];
2209
+ }
2034
2210
  }
2035
2211
 
2036
2212
  globalState.allowStateChanges = !globalState.enforceActions;
@@ -2064,8 +2240,12 @@ function addObserver(observable, node) {
2064
2240
  // invariant(observable._observers.indexOf(node) === -1, "INTERNAL ERROR add already added node");
2065
2241
  // invariantObservers(observable);
2066
2242
  observable.observers_.add(node);
2067
- if (observable.lowestObserverState_ > node.dependenciesState_) observable.lowestObserverState_ = node.dependenciesState_; // invariantObservers(observable);
2243
+
2244
+ if (observable.lowestObserverState_ > node.dependenciesState_) {
2245
+ observable.lowestObserverState_ = node.dependenciesState_;
2246
+ } // invariantObservers(observable);
2068
2247
  // invariant(observable._observers.indexOf(node) !== -1, "INTERNAL ERROR didn't add node");
2248
+
2069
2249
  }
2070
2250
  function removeObserver(observable, node) {
2071
2251
  // invariant(globalState.inBatch > 0, "INTERNAL ERROR, remove should be called only inside batch");
@@ -2176,7 +2356,10 @@ function reportObserved(observable) {
2176
2356
 
2177
2357
  function propagateChanged(observable) {
2178
2358
  // invariantLOS(observable, "changed start");
2179
- if (observable.lowestObserverState_ === IDerivationState_.STALE_) return;
2359
+ if (observable.lowestObserverState_ === IDerivationState_.STALE_) {
2360
+ return;
2361
+ }
2362
+
2180
2363
  observable.lowestObserverState_ = IDerivationState_.STALE_; // Ideally we use for..of here, but the downcompiled version is really slow...
2181
2364
 
2182
2365
  observable.observers_.forEach(function (d) {
@@ -2194,7 +2377,10 @@ function propagateChanged(observable) {
2194
2377
 
2195
2378
  function propagateChangeConfirmed(observable) {
2196
2379
  // invariantLOS(observable, "confirmed start");
2197
- if (observable.lowestObserverState_ === IDerivationState_.STALE_) return;
2380
+ if (observable.lowestObserverState_ === IDerivationState_.STALE_) {
2381
+ return;
2382
+ }
2383
+
2198
2384
  observable.lowestObserverState_ = IDerivationState_.STALE_;
2199
2385
  observable.observers_.forEach(function (d) {
2200
2386
  if (d.dependenciesState_ === IDerivationState_.POSSIBLY_STALE_) {
@@ -2212,7 +2398,10 @@ function propagateChangeConfirmed(observable) {
2212
2398
 
2213
2399
  function propagateMaybeChanged(observable) {
2214
2400
  // invariantLOS(observable, "maybe start");
2215
- if (observable.lowestObserverState_ !== IDerivationState_.UP_TO_DATE_) return;
2401
+ if (observable.lowestObserverState_ !== IDerivationState_.UP_TO_DATE_) {
2402
+ return;
2403
+ }
2404
+
2216
2405
  observable.lowestObserverState_ = IDerivationState_.POSSIBLY_STALE_;
2217
2406
  observable.observers_.forEach(function (d) {
2218
2407
  if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {
@@ -2240,9 +2429,12 @@ function printDepTree(tree, lines, depth) {
2240
2429
  }
2241
2430
 
2242
2431
  lines.push("" + "\t".repeat(depth - 1) + tree.name);
2243
- if (tree.dependencies) tree.dependencies.forEach(function (child) {
2244
- return printDepTree(child, lines, depth + 1);
2245
- });
2432
+
2433
+ if (tree.dependencies) {
2434
+ tree.dependencies.forEach(function (child) {
2435
+ return printDepTree(child, lines, depth + 1);
2436
+ });
2437
+ }
2246
2438
  }
2247
2439
 
2248
2440
  var Reaction = /*#__PURE__*/function () {
@@ -2360,7 +2552,9 @@ var Reaction = /*#__PURE__*/function () {
2360
2552
  clearObserving(this);
2361
2553
  }
2362
2554
 
2363
- if (isCaughtException(result)) this.reportExceptionInDerivation_(result.cause);
2555
+ if (isCaughtException(result)) {
2556
+ this.reportExceptionInDerivation_(result.cause);
2557
+ }
2364
2558
 
2365
2559
  if (process.env.NODE_ENV !== "production" && notify) {
2366
2560
  spyReportEnd({
@@ -2379,13 +2573,18 @@ var Reaction = /*#__PURE__*/function () {
2379
2573
  return;
2380
2574
  }
2381
2575
 
2382
- if (globalState.disableErrorBoundaries) throw error;
2576
+ if (globalState.disableErrorBoundaries) {
2577
+ throw error;
2578
+ }
2579
+
2383
2580
  var message = process.env.NODE_ENV !== "production" ? "[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '" + this + "'" : "[mobx] uncaught error in '" + this + "'";
2384
2581
 
2385
2582
  if (!globalState.suppressReactionErrors) {
2386
2583
  console.error(message, error);
2387
2584
  /** If debugging brought you here, please, read the above message :-). Tnx! */
2388
- } else if (process.env.NODE_ENV !== "production") console.warn("[mobx] (error in reaction '" + this.name_ + "' suppressed, fix error of causing action below)"); // prettier-ignore
2585
+ } else if (process.env.NODE_ENV !== "production") {
2586
+ console.warn("[mobx] (error in reaction '" + this.name_ + "' suppressed, fix error of causing action below)");
2587
+ } // prettier-ignore
2389
2588
 
2390
2589
 
2391
2590
  if (process.env.NODE_ENV !== "production" && isSpyEnabled()) {
@@ -2439,7 +2638,10 @@ function onReactionError(handler) {
2439
2638
  globalState.globalReactionErrorHandlers.push(handler);
2440
2639
  return function () {
2441
2640
  var idx = globalState.globalReactionErrorHandlers.indexOf(handler);
2442
- if (idx >= 0) globalState.globalReactionErrorHandlers.splice(idx, 1);
2641
+
2642
+ if (idx >= 0) {
2643
+ globalState.globalReactionErrorHandlers.splice(idx, 1);
2644
+ }
2443
2645
  };
2444
2646
  }
2445
2647
  /**
@@ -2456,7 +2658,10 @@ var reactionScheduler = function reactionScheduler(f) {
2456
2658
 
2457
2659
  function runReactions() {
2458
2660
  // Trampolining, if runReactions are already running, new reactions will be picked up
2459
- if (globalState.inBatch > 0 || globalState.isRunningReactions) return;
2661
+ if (globalState.inBatch > 0 || globalState.isRunningReactions) {
2662
+ return;
2663
+ }
2664
+
2460
2665
  reactionScheduler(runReactionsHelper);
2461
2666
  }
2462
2667
 
@@ -2498,9 +2703,15 @@ function isSpyEnabled() {
2498
2703
  return process.env.NODE_ENV !== "production" && !!globalState.spyListeners.length;
2499
2704
  }
2500
2705
  function spyReport(event) {
2501
- if (!(process.env.NODE_ENV !== "production")) return; // dead code elimination can do the rest
2706
+ if (!(process.env.NODE_ENV !== "production")) {
2707
+ return;
2708
+ } // dead code elimination can do the rest
2709
+
2710
+
2711
+ if (!globalState.spyListeners.length) {
2712
+ return;
2713
+ }
2502
2714
 
2503
- if (!globalState.spyListeners.length) return;
2504
2715
  var listeners = globalState.spyListeners;
2505
2716
 
2506
2717
  for (var i = 0, l = listeners.length; i < l; i++) {
@@ -2508,7 +2719,9 @@ function spyReport(event) {
2508
2719
  }
2509
2720
  }
2510
2721
  function spyReportStart(event) {
2511
- if (!(process.env.NODE_ENV !== "production")) return;
2722
+ if (!(process.env.NODE_ENV !== "production")) {
2723
+ return;
2724
+ }
2512
2725
 
2513
2726
  var change = _extends({}, event, {
2514
2727
  spyReportStart: true
@@ -2521,11 +2734,18 @@ var END_EVENT = {
2521
2734
  spyReportEnd: true
2522
2735
  };
2523
2736
  function spyReportEnd(change) {
2524
- if (!(process.env.NODE_ENV !== "production")) return;
2525
- if (change) spyReport(_extends({}, change, {
2526
- type: "report-end",
2527
- spyReportEnd: true
2528
- }));else spyReport(END_EVENT);
2737
+ if (!(process.env.NODE_ENV !== "production")) {
2738
+ return;
2739
+ }
2740
+
2741
+ if (change) {
2742
+ spyReport(_extends({}, change, {
2743
+ type: "report-end",
2744
+ spyReportEnd: true
2745
+ }));
2746
+ } else {
2747
+ spyReport(END_EVENT);
2748
+ }
2529
2749
  }
2530
2750
  function spy(listener) {
2531
2751
  if (!(process.env.NODE_ENV !== "production")) {
@@ -2561,9 +2781,15 @@ var autoActionBoundAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION_B
2561
2781
  function createActionFactory(autoAction) {
2562
2782
  var res = function action(arg1, arg2) {
2563
2783
  // action(fn() {})
2564
- if (isFunction(arg1)) return createAction(arg1.name || DEFAULT_ACTION_NAME, arg1, autoAction); // action("name", fn() {})
2784
+ if (isFunction(arg1)) {
2785
+ return createAction(arg1.name || DEFAULT_ACTION_NAME, arg1, autoAction);
2786
+ } // action("name", fn() {})
2787
+
2788
+
2789
+ if (isFunction(arg2)) {
2790
+ return createAction(arg1, arg2, autoAction);
2791
+ } // @action
2565
2792
 
2566
- if (isFunction(arg2)) return createAction(arg1, arg2, autoAction); // @action
2567
2793
 
2568
2794
  if (isStringish(arg2)) {
2569
2795
  return storeAnnotation(arg1, arg2, autoAction ? autoActionAnnotation : actionAnnotation);
@@ -2577,7 +2803,9 @@ function createActionFactory(autoAction) {
2577
2803
  }));
2578
2804
  }
2579
2805
 
2580
- if (process.env.NODE_ENV !== "production") die("Invalid arguments for `action`");
2806
+ if (process.env.NODE_ENV !== "production") {
2807
+ die("Invalid arguments for `action`");
2808
+ }
2581
2809
  };
2582
2810
 
2583
2811
  return res;
@@ -2611,8 +2839,13 @@ function autorun(view, opts) {
2611
2839
  }
2612
2840
 
2613
2841
  if (process.env.NODE_ENV !== "production") {
2614
- if (!isFunction(view)) die("Autorun expects a function as first argument");
2615
- if (isAction(view)) die("Autorun does not accept actions since actions are untrackable");
2842
+ if (!isFunction(view)) {
2843
+ die("Autorun expects a function as first argument");
2844
+ }
2845
+
2846
+ if (isAction(view)) {
2847
+ die("Autorun does not accept actions since actions are untrackable");
2848
+ }
2616
2849
  }
2617
2850
 
2618
2851
  var name = (_opts$name = (_opts = opts) == null ? void 0 : _opts.name) != null ? _opts$name : process.env.NODE_ENV !== "production" ? view.name || "Autorun@" + getNextId() : "Autorun";
@@ -2633,7 +2866,10 @@ function autorun(view, opts) {
2633
2866
  isScheduled = true;
2634
2867
  scheduler(function () {
2635
2868
  isScheduled = false;
2636
- if (!reaction.isDisposed_) reaction.track(reactionRunner);
2869
+
2870
+ if (!reaction.isDisposed_) {
2871
+ reaction.track(reactionRunner);
2872
+ }
2637
2873
  });
2638
2874
  }
2639
2875
  }, opts.onError, opts.requiresObservable);
@@ -2665,8 +2901,13 @@ function reaction(expression, effect, opts) {
2665
2901
  }
2666
2902
 
2667
2903
  if (process.env.NODE_ENV !== "production") {
2668
- if (!isFunction(expression) || !isFunction(effect)) die("First and second argument to reaction should be functions");
2669
- if (!isPlainObject(opts)) die("Third argument of reactions should be an object");
2904
+ if (!isFunction(expression) || !isFunction(effect)) {
2905
+ die("First and second argument to reaction should be functions");
2906
+ }
2907
+
2908
+ if (!isPlainObject(opts)) {
2909
+ die("Third argument of reactions should be an object");
2910
+ }
2670
2911
  }
2671
2912
 
2672
2913
  var name = (_opts$name2 = opts.name) != null ? _opts$name2 : process.env.NODE_ENV !== "production" ? "Reaction@" + getNextId() : "Reaction";
@@ -2689,7 +2930,11 @@ function reaction(expression, effect, opts) {
2689
2930
 
2690
2931
  function reactionRunner() {
2691
2932
  isScheduled = false;
2692
- if (r.isDisposed_) return;
2933
+
2934
+ if (r.isDisposed_) {
2935
+ return;
2936
+ }
2937
+
2693
2938
  var changed = false;
2694
2939
  r.track(function () {
2695
2940
  var nextValue = allowStateChanges(false, function () {
@@ -2699,7 +2944,13 @@ function reaction(expression, effect, opts) {
2699
2944
  oldValue = value;
2700
2945
  value = nextValue;
2701
2946
  });
2702
- if (firstTime && opts.fireImmediately) effectAction(value, oldValue, r);else if (!firstTime && changed) effectAction(value, oldValue, r);
2947
+
2948
+ if (firstTime && opts.fireImmediately) {
2949
+ effectAction(value, oldValue, r);
2950
+ } else if (!firstTime && changed) {
2951
+ effectAction(value, oldValue, r);
2952
+ }
2953
+
2703
2954
  firstTime = false;
2704
2955
  }
2705
2956
 
@@ -2766,7 +3017,9 @@ function configure(options) {
2766
3017
  globalState.useProxies = useProxies === ALWAYS ? true : useProxies === NEVER ? false : typeof Proxy !== "undefined";
2767
3018
  }
2768
3019
 
2769
- if (useProxies === "ifavailable") globalState.verifyProxies = true;
3020
+ if (useProxies === "ifavailable") {
3021
+ globalState.verifyProxies = true;
3022
+ }
2770
3023
 
2771
3024
  if (enforceActions !== undefined) {
2772
3025
  var ea = enforceActions === ALWAYS ? ALWAYS : enforceActions === OBSERVED;
@@ -2774,7 +3027,9 @@ function configure(options) {
2774
3027
  globalState.allowStateChanges = ea === true || ea === ALWAYS ? false : true;
2775
3028
  }
2776
3029
  ["computedRequiresReaction", "reactionRequiresObservable", "observableRequiresReaction", "disableErrorBoundaries", "safeDescriptors"].forEach(function (key) {
2777
- if (key in options) globalState[key] = !!options[key];
3030
+ if (key in options) {
3031
+ globalState[key] = !!options[key];
3032
+ }
2778
3033
  });
2779
3034
  globalState.allowStateReads = !globalState.observableRequiresReaction;
2780
3035
 
@@ -2789,11 +3044,25 @@ function configure(options) {
2789
3044
 
2790
3045
  function extendObservable(target, properties, annotations, options) {
2791
3046
  if (process.env.NODE_ENV !== "production") {
2792
- if (arguments.length > 4) die("'extendObservable' expected 2-4 arguments");
2793
- if (typeof target !== "object") die("'extendObservable' expects an object as first argument");
2794
- if (isObservableMap(target)) die("'extendObservable' should not be used on maps, use map.merge instead");
2795
- if (!isPlainObject(properties)) die("'extendObservable' only accepts plain objects as second argument");
2796
- if (isObservable(properties) || isObservable(annotations)) die("Extending an object with another observable (object) is not supported");
3047
+ if (arguments.length > 4) {
3048
+ die("'extendObservable' expected 2-4 arguments");
3049
+ }
3050
+
3051
+ if (typeof target !== "object") {
3052
+ die("'extendObservable' expects an object as first argument");
3053
+ }
3054
+
3055
+ if (isObservableMap(target)) {
3056
+ die("'extendObservable' should not be used on maps, use map.merge instead");
3057
+ }
3058
+
3059
+ if (!isPlainObject(properties)) {
3060
+ die("'extendObservable' only accepts plain objects as second argument");
3061
+ }
3062
+
3063
+ if (isObservable(properties) || isObservable(annotations)) {
3064
+ die("Extending an object with another observable (object) is not supported");
3065
+ }
2797
3066
  } // Pull descriptors first, so we don't have to deal with props added by administration ($mobx)
2798
3067
 
2799
3068
 
@@ -2821,7 +3090,11 @@ function nodeToDependencyTree(node) {
2821
3090
  var result = {
2822
3091
  name: node.name_
2823
3092
  };
2824
- if (node.observing_ && node.observing_.length > 0) result.dependencies = unique(node.observing_).map(nodeToDependencyTree);
3093
+
3094
+ if (node.observing_ && node.observing_.length > 0) {
3095
+ result.dependencies = unique(node.observing_).map(nodeToDependencyTree);
3096
+ }
3097
+
2825
3098
  return result;
2826
3099
  }
2827
3100
 
@@ -2833,7 +3106,11 @@ function nodeToObserverTree(node) {
2833
3106
  var result = {
2834
3107
  name: node.name_
2835
3108
  };
2836
- if (hasObservers(node)) result.observers = Array.from(getObservers(node)).map(nodeToObserverTree);
3109
+
3110
+ if (hasObservers(node)) {
3111
+ result.observers = Array.from(getObservers(node)).map(nodeToObserverTree);
3112
+ }
3113
+
2837
3114
  return result;
2838
3115
  }
2839
3116
 
@@ -2860,7 +3137,10 @@ var flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {
2860
3137
  } // flow(fn)
2861
3138
 
2862
3139
 
2863
- if (process.env.NODE_ENV !== "production" && arguments.length !== 1) die("Flow expects single argument with generator function");
3140
+ if (process.env.NODE_ENV !== "production" && arguments.length !== 1) {
3141
+ die("Flow expects single argument with generator function");
3142
+ }
3143
+
2864
3144
  var generator = arg1;
2865
3145
  var name = generator.name || "<unnamed flow>"; // Implementation based on https://github.com/tj/co/blob/master/index.js
2866
3146
 
@@ -2908,7 +3188,10 @@ var flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {
2908
3188
  return;
2909
3189
  }
2910
3190
 
2911
- if (ret.done) return resolve(ret.value);
3191
+ if (ret.done) {
3192
+ return resolve(ret.value);
3193
+ }
3194
+
2912
3195
  pendingPromise = Promise.resolve(ret.value);
2913
3196
  return pendingPromise.then(onFulfilled, onRejected);
2914
3197
  }
@@ -2917,7 +3200,10 @@ var flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {
2917
3200
  });
2918
3201
  promise.cancel = action(name + " - runid: " + runId + " - cancel", function () {
2919
3202
  try {
2920
- if (pendingPromise) cancelPromise(pendingPromise); // Finally block can return (or yield) stuff..
3203
+ if (pendingPromise) {
3204
+ cancelPromise(pendingPromise);
3205
+ } // Finally block can return (or yield) stuff..
3206
+
2921
3207
 
2922
3208
  var _res = gen["return"](undefined); // eat anything that promise would do, it's cancelled!
2923
3209
 
@@ -2941,7 +3227,9 @@ var flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {
2941
3227
  flow.bound = /*#__PURE__*/createDecoratorAnnotation(flowBoundAnnotation);
2942
3228
 
2943
3229
  function cancelPromise(promise) {
2944
- if (isFunction(promise.cancel)) promise.cancel();
3230
+ if (isFunction(promise.cancel)) {
3231
+ promise.cancel();
3232
+ }
2945
3233
  }
2946
3234
 
2947
3235
  function flowResult(result) {
@@ -2957,13 +3245,19 @@ function interceptReads(thing, propOrHandler, handler) {
2957
3245
  if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) {
2958
3246
  target = getAdministration(thing);
2959
3247
  } else if (isObservableObject(thing)) {
2960
- if (process.env.NODE_ENV !== "production" && !isStringish(propOrHandler)) return die("InterceptReads can only be used with a specific property, not with an object in general");
3248
+ if (process.env.NODE_ENV !== "production" && !isStringish(propOrHandler)) {
3249
+ return die("InterceptReads can only be used with a specific property, not with an object in general");
3250
+ }
3251
+
2961
3252
  target = getAdministration(thing, propOrHandler);
2962
3253
  } else if (process.env.NODE_ENV !== "production") {
2963
3254
  return die("Expected observable map, object or array as first array");
2964
3255
  }
2965
3256
 
2966
- if (process.env.NODE_ENV !== "production" && target.dehancer !== undefined) return die("An intercept reader was already established");
3257
+ if (process.env.NODE_ENV !== "production" && target.dehancer !== undefined) {
3258
+ return die("An intercept reader was already established");
3259
+ }
3260
+
2967
3261
  target.dehancer = typeof propOrHandler === "function" ? propOrHandler : handler;
2968
3262
  return function () {
2969
3263
  target.dehancer = undefined;
@@ -2971,7 +3265,11 @@ function interceptReads(thing, propOrHandler, handler) {
2971
3265
  }
2972
3266
 
2973
3267
  function intercept(thing, propOrHandler, handler) {
2974
- if (isFunction(handler)) return interceptProperty(thing, propOrHandler, handler);else return interceptInterceptable(thing, propOrHandler);
3268
+ if (isFunction(handler)) {
3269
+ return interceptProperty(thing, propOrHandler, handler);
3270
+ } else {
3271
+ return interceptInterceptable(thing, propOrHandler);
3272
+ }
2975
3273
  }
2976
3274
 
2977
3275
  function interceptInterceptable(thing, handler) {
@@ -2987,25 +3285,41 @@ function _isComputed(value, property) {
2987
3285
  return isComputedValue(value);
2988
3286
  }
2989
3287
 
2990
- if (isObservableObject(value) === false) return false;
2991
- if (!value[$mobx].values_.has(property)) return false;
3288
+ if (isObservableObject(value) === false) {
3289
+ return false;
3290
+ }
3291
+
3292
+ if (!value[$mobx].values_.has(property)) {
3293
+ return false;
3294
+ }
3295
+
2992
3296
  var atom = getAtom(value, property);
2993
3297
  return isComputedValue(atom);
2994
3298
  }
2995
3299
  function isComputed(value) {
2996
- if (process.env.NODE_ENV !== "production" && arguments.length > 1) return die("isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property");
3300
+ if (process.env.NODE_ENV !== "production" && arguments.length > 1) {
3301
+ return die("isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property");
3302
+ }
3303
+
2997
3304
  return _isComputed(value);
2998
3305
  }
2999
3306
  function isComputedProp(value, propName) {
3000
- if (process.env.NODE_ENV !== "production" && !isStringish(propName)) return die("isComputed expected a property name as second argument");
3307
+ if (process.env.NODE_ENV !== "production" && !isStringish(propName)) {
3308
+ return die("isComputed expected a property name as second argument");
3309
+ }
3310
+
3001
3311
  return _isComputed(value, propName);
3002
3312
  }
3003
3313
 
3004
3314
  function _isObservable(value, property) {
3005
- if (!value) return false;
3315
+ if (!value) {
3316
+ return false;
3317
+ }
3006
3318
 
3007
3319
  if (property !== undefined) {
3008
- if (process.env.NODE_ENV !== "production" && (isObservableMap(value) || isObservableArray(value))) return die("isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.");
3320
+ if (process.env.NODE_ENV !== "production" && (isObservableMap(value) || isObservableArray(value))) {
3321
+ return die("isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.");
3322
+ }
3009
3323
 
3010
3324
  if (isObservableObject(value)) {
3011
3325
  return value[$mobx].values_.has(property);
@@ -3019,11 +3333,17 @@ function _isObservable(value, property) {
3019
3333
  }
3020
3334
 
3021
3335
  function isObservable(value) {
3022
- if (process.env.NODE_ENV !== "production" && arguments.length !== 1) die("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property");
3336
+ if (process.env.NODE_ENV !== "production" && arguments.length !== 1) {
3337
+ die("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property");
3338
+ }
3339
+
3023
3340
  return _isObservable(value);
3024
3341
  }
3025
3342
  function isObservableProp(value, propName) {
3026
- if (process.env.NODE_ENV !== "production" && !isStringish(propName)) return die("expected a property name as second argument");
3343
+ if (process.env.NODE_ENV !== "production" && !isStringish(propName)) {
3344
+ return die("expected a property name as second argument");
3345
+ }
3346
+
3027
3347
  return _isObservable(value, propName);
3028
3348
  }
3029
3349
 
@@ -3115,13 +3435,25 @@ function set(obj, key, value) {
3115
3435
  } else if (isObservableSet(obj)) {
3116
3436
  obj.add(key);
3117
3437
  } else if (isObservableArray(obj)) {
3118
- if (typeof key !== "number") key = parseInt(key, 10);
3119
- if (key < 0) die("Invalid index: '" + key + "'");
3438
+ if (typeof key !== "number") {
3439
+ key = parseInt(key, 10);
3440
+ }
3441
+
3442
+ if (key < 0) {
3443
+ die("Invalid index: '" + key + "'");
3444
+ }
3445
+
3120
3446
  startBatch();
3121
- if (key >= obj.length) obj.length = key + 1;
3447
+
3448
+ if (key >= obj.length) {
3449
+ obj.length = key + 1;
3450
+ }
3451
+
3122
3452
  obj[key] = value;
3123
3453
  endBatch();
3124
- } else die(8);
3454
+ } else {
3455
+ die(8);
3456
+ }
3125
3457
  }
3126
3458
  function remove(obj, key) {
3127
3459
  if (isObservableObject(obj)) {
@@ -3131,7 +3463,10 @@ function remove(obj, key) {
3131
3463
  } else if (isObservableSet(obj)) {
3132
3464
  obj["delete"](key);
3133
3465
  } else if (isObservableArray(obj)) {
3134
- if (typeof key !== "number") key = parseInt(key, 10);
3466
+ if (typeof key !== "number") {
3467
+ key = parseInt(key, 10);
3468
+ }
3469
+
3135
3470
  obj.splice(key, 1);
3136
3471
  } else {
3137
3472
  die(9);
@@ -3151,7 +3486,9 @@ function has(obj, key) {
3151
3486
  die(10);
3152
3487
  }
3153
3488
  function get(obj, key) {
3154
- if (!has(obj, key)) return undefined;
3489
+ if (!has(obj, key)) {
3490
+ return undefined;
3491
+ }
3155
3492
 
3156
3493
  if (isObservableObject(obj)) {
3157
3494
  return obj[$mobx].get_(key);
@@ -3179,7 +3516,11 @@ function apiOwnKeys(obj) {
3179
3516
  }
3180
3517
 
3181
3518
  function observe(thing, propOrCb, cbOrFire, fireImmediately) {
3182
- if (isFunction(cbOrFire)) return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);else return observeObservable(thing, propOrCb, cbOrFire);
3519
+ if (isFunction(cbOrFire)) {
3520
+ return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);
3521
+ } else {
3522
+ return observeObservable(thing, propOrCb, cbOrFire);
3523
+ }
3183
3524
  }
3184
3525
 
3185
3526
  function observeObservable(thing, listener, fireImmediately) {
@@ -3196,8 +3537,13 @@ function cache(map, key, value) {
3196
3537
  }
3197
3538
 
3198
3539
  function toJSHelper(source, __alreadySeen) {
3199
- if (source == null || typeof source !== "object" || source instanceof Date || !isObservable(source)) return source;
3200
- if (isObservableValue(source) || isComputedValue(source)) return toJSHelper(source.get(), __alreadySeen);
3540
+ if (source == null || typeof source !== "object" || source instanceof Date || !isObservable(source)) {
3541
+ return source;
3542
+ }
3543
+
3544
+ if (isObservableValue(source) || isComputedValue(source)) {
3545
+ return toJSHelper(source.get(), __alreadySeen);
3546
+ }
3201
3547
 
3202
3548
  if (__alreadySeen.has(source)) {
3203
3549
  return __alreadySeen.get(source);
@@ -3248,19 +3594,28 @@ function toJSHelper(source, __alreadySeen) {
3248
3594
 
3249
3595
 
3250
3596
  function toJS(source, options) {
3251
- if (process.env.NODE_ENV !== "production" && options) die("toJS no longer supports options");
3597
+ if (process.env.NODE_ENV !== "production" && options) {
3598
+ die("toJS no longer supports options");
3599
+ }
3600
+
3252
3601
  return toJSHelper(source, new Map());
3253
3602
  }
3254
3603
 
3255
3604
  function trace() {
3256
- if (!(process.env.NODE_ENV !== "production")) die("trace() is not available in production builds");
3605
+ if (!(process.env.NODE_ENV !== "production")) {
3606
+ die("trace() is not available in production builds");
3607
+ }
3608
+
3257
3609
  var enterBreakPoint = false;
3258
3610
 
3259
3611
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
3260
3612
  args[_key] = arguments[_key];
3261
3613
  }
3262
3614
 
3263
- if (typeof args[args.length - 1] === "boolean") enterBreakPoint = args.pop();
3615
+ if (typeof args[args.length - 1] === "boolean") {
3616
+ enterBreakPoint = args.pop();
3617
+ }
3618
+
3264
3619
  var derivation = getAtomFromArgs(args);
3265
3620
 
3266
3621
  if (!derivation) {
@@ -3310,7 +3665,10 @@ function transaction(action, thisArg) {
3310
3665
  }
3311
3666
 
3312
3667
  function when(predicate, arg1, arg2) {
3313
- if (arguments.length === 1 || arg1 && typeof arg1 === "object") return whenPromise(predicate, arg1);
3668
+ if (arguments.length === 1 || arg1 && typeof arg1 === "object") {
3669
+ return whenPromise(predicate, arg1);
3670
+ }
3671
+
3314
3672
  return _when(predicate, arg1, arg2 || {});
3315
3673
  }
3316
3674
 
@@ -3322,7 +3680,12 @@ function _when(predicate, effect, opts) {
3322
3680
  timeoutHandle = setTimeout(function () {
3323
3681
  if (!disposer[$mobx].isDisposed_) {
3324
3682
  disposer();
3325
- if (opts.onError) opts.onError(error);else throw error;
3683
+
3684
+ if (opts.onError) {
3685
+ opts.onError(error);
3686
+ } else {
3687
+ throw error;
3688
+ }
3326
3689
  }
3327
3690
  }, opts.timeout);
3328
3691
  }
@@ -3336,7 +3699,11 @@ function _when(predicate, effect, opts) {
3336
3699
 
3337
3700
  if (cond) {
3338
3701
  r.dispose();
3339
- if (timeoutHandle) clearTimeout(timeoutHandle);
3702
+
3703
+ if (timeoutHandle) {
3704
+ clearTimeout(timeoutHandle);
3705
+ }
3706
+
3340
3707
  effectAction();
3341
3708
  }
3342
3709
  }, opts);
@@ -3344,7 +3711,10 @@ function _when(predicate, effect, opts) {
3344
3711
  }
3345
3712
 
3346
3713
  function whenPromise(predicate, opts) {
3347
- if (process.env.NODE_ENV !== "production" && opts && opts.onError) return die("the options 'onError' and 'promise' cannot be combined");
3714
+ if (process.env.NODE_ENV !== "production" && opts && opts.onError) {
3715
+ return die("the options 'onError' and 'promise' cannot be combined");
3716
+ }
3717
+
3348
3718
  var cancel;
3349
3719
  var res = new Promise(function (resolve, reject) {
3350
3720
  var disposer = _when(predicate, resolve, _extends({}, opts, {
@@ -3368,7 +3738,10 @@ function getAdm(target) {
3368
3738
 
3369
3739
  var objectProxyTraps = {
3370
3740
  has: function has(target, name) {
3371
- if (process.env.NODE_ENV !== "production" && globalState.trackingDerivation) warnAboutProxyRequirement("detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.");
3741
+ if (process.env.NODE_ENV !== "production" && globalState.trackingDerivation) {
3742
+ warnAboutProxyRequirement("detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.");
3743
+ }
3744
+
3372
3745
  return getAdm(target).has_(name);
3373
3746
  },
3374
3747
  get: function get(target, name) {
@@ -3377,7 +3750,9 @@ var objectProxyTraps = {
3377
3750
  set: function set(target, name, value) {
3378
3751
  var _getAdm$set_;
3379
3752
 
3380
- if (!isStringish(name)) return false;
3753
+ if (!isStringish(name)) {
3754
+ return false;
3755
+ }
3381
3756
 
3382
3757
  if (process.env.NODE_ENV !== "production" && !getAdm(target).values_.has(name)) {
3383
3758
  warnAboutProxyRequirement("add a new observable property through direct assignment. Use 'set' from 'mobx' instead.");
@@ -3393,7 +3768,10 @@ var objectProxyTraps = {
3393
3768
  warnAboutProxyRequirement("delete properties from an observable object. Use 'remove' from 'mobx' instead.");
3394
3769
  }
3395
3770
 
3396
- if (!isStringish(name)) return false; // null (intercepted) -> true (success)
3771
+ if (!isStringish(name)) {
3772
+ return false;
3773
+ } // null (intercepted) -> true (success)
3774
+
3397
3775
 
3398
3776
  return (_getAdm$delete_ = getAdm(target).delete_(name, true)) != null ? _getAdm$delete_ : true;
3399
3777
  },
@@ -3408,7 +3786,10 @@ var objectProxyTraps = {
3408
3786
  return (_getAdm$definePropert = getAdm(target).defineProperty_(name, descriptor)) != null ? _getAdm$definePropert : true;
3409
3787
  },
3410
3788
  ownKeys: function ownKeys(target) {
3411
- if (process.env.NODE_ENV !== "production" && globalState.trackingDerivation) warnAboutProxyRequirement("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.");
3789
+ if (process.env.NODE_ENV !== "production" && globalState.trackingDerivation) {
3790
+ warnAboutProxyRequirement("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.");
3791
+ }
3792
+
3412
3793
  return getAdm(target).ownKeys_();
3413
3794
  },
3414
3795
  preventExtensions: function preventExtensions(target) {
@@ -3431,7 +3812,10 @@ function registerInterceptor(interceptable, handler) {
3431
3812
  interceptors.push(handler);
3432
3813
  return once(function () {
3433
3814
  var idx = interceptors.indexOf(handler);
3434
- if (idx !== -1) interceptors.splice(idx, 1);
3815
+
3816
+ if (idx !== -1) {
3817
+ interceptors.splice(idx, 1);
3818
+ }
3435
3819
  });
3436
3820
  }
3437
3821
  function interceptChange(interceptable, change) {
@@ -3443,8 +3827,14 @@ function interceptChange(interceptable, change) {
3443
3827
 
3444
3828
  for (var i = 0, l = interceptors.length; i < l; i++) {
3445
3829
  change = interceptors[i](change);
3446
- if (change && !change.type) die(14);
3447
- if (!change) break;
3830
+
3831
+ if (change && !change.type) {
3832
+ die(14);
3833
+ }
3834
+
3835
+ if (!change) {
3836
+ break;
3837
+ }
3448
3838
  }
3449
3839
 
3450
3840
  return change;
@@ -3461,13 +3851,20 @@ function registerListener(listenable, handler) {
3461
3851
  listeners.push(handler);
3462
3852
  return once(function () {
3463
3853
  var idx = listeners.indexOf(handler);
3464
- if (idx !== -1) listeners.splice(idx, 1);
3854
+
3855
+ if (idx !== -1) {
3856
+ listeners.splice(idx, 1);
3857
+ }
3465
3858
  });
3466
3859
  }
3467
3860
  function notifyListeners(listenable, change) {
3468
3861
  var prevU = untrackedStart();
3469
3862
  var listeners = listenable.changeListeners_;
3470
- if (!listeners) return;
3863
+
3864
+ if (!listeners) {
3865
+ return;
3866
+ }
3867
+
3471
3868
  listeners = listeners.slice();
3472
3869
 
3473
3870
  for (var i = 0, l = listeners.length; i < l; i++) {
@@ -3504,8 +3901,13 @@ function makeObservable(target, annotations, options) {
3504
3901
  var keysSymbol = /*#__PURE__*/Symbol("mobx-keys");
3505
3902
  function makeAutoObservable(target, overrides, options) {
3506
3903
  if (process.env.NODE_ENV !== "production") {
3507
- if (!isPlainObject(target) && !isPlainObject(Object.getPrototypeOf(target))) die("'makeAutoObservable' can only be used for classes that don't have a superclass");
3508
- if (isObservableObject(target)) die("makeAutoObservable can only be used on objects not already made observable");
3904
+ if (!isPlainObject(target) && !isPlainObject(Object.getPrototypeOf(target))) {
3905
+ die("'makeAutoObservable' can only be used for classes that don't have a superclass");
3906
+ }
3907
+
3908
+ if (isObservableObject(target)) {
3909
+ die("makeAutoObservable can only be used on objects not already made observable");
3910
+ }
3509
3911
  } // Optimization: avoid visiting protos
3510
3912
  // Assumes that annotation.make_/.extend_ works the same for plain objects
3511
3913
 
@@ -3546,8 +3948,14 @@ var MAX_SPLICE_SIZE = 10000; // See e.g. https://github.com/mobxjs/mobx/issues/8
3546
3948
  var arrayTraps = {
3547
3949
  get: function get(target, name) {
3548
3950
  var adm = target[$mobx];
3549
- if (name === $mobx) return adm;
3550
- if (name === "length") return adm.getArrayLength_();
3951
+
3952
+ if (name === $mobx) {
3953
+ return adm;
3954
+ }
3955
+
3956
+ if (name === "length") {
3957
+ return adm.getArrayLength_();
3958
+ }
3551
3959
 
3552
3960
  if (typeof name === "string" && !isNaN(name)) {
3553
3961
  return adm.get_(parseInt(name));
@@ -3608,12 +4016,18 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3608
4016
  var _proto = ObservableArrayAdministration.prototype;
3609
4017
 
3610
4018
  _proto.dehanceValue_ = function dehanceValue_(value) {
3611
- if (this.dehancer !== undefined) return this.dehancer(value);
4019
+ if (this.dehancer !== undefined) {
4020
+ return this.dehancer(value);
4021
+ }
4022
+
3612
4023
  return value;
3613
4024
  };
3614
4025
 
3615
4026
  _proto.dehanceValues_ = function dehanceValues_(values) {
3616
- if (this.dehancer !== undefined && values.length > 0) return values.map(this.dehancer);
4027
+ if (this.dehancer !== undefined && values.length > 0) {
4028
+ return values.map(this.dehancer);
4029
+ }
4030
+
3617
4031
  return values;
3618
4032
  };
3619
4033
 
@@ -3649,9 +4063,15 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3649
4063
  };
3650
4064
 
3651
4065
  _proto.setArrayLength_ = function setArrayLength_(newLength) {
3652
- if (typeof newLength !== "number" || isNaN(newLength) || newLength < 0) die("Out of range: " + newLength);
4066
+ if (typeof newLength !== "number" || isNaN(newLength) || newLength < 0) {
4067
+ die("Out of range: " + newLength);
4068
+ }
4069
+
3653
4070
  var currentLength = this.values_.length;
3654
- if (newLength === currentLength) return;else if (newLength > currentLength) {
4071
+
4072
+ if (newLength === currentLength) {
4073
+ return;
4074
+ } else if (newLength > currentLength) {
3655
4075
  var newItems = new Array(newLength - currentLength);
3656
4076
 
3657
4077
  for (var i = 0; i < newLength - currentLength; i++) {
@@ -3660,13 +4080,21 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3660
4080
 
3661
4081
 
3662
4082
  this.spliceWithArray_(currentLength, 0, newItems);
3663
- } else this.spliceWithArray_(newLength, currentLength - newLength);
4083
+ } else {
4084
+ this.spliceWithArray_(newLength, currentLength - newLength);
4085
+ }
3664
4086
  };
3665
4087
 
3666
4088
  _proto.updateArrayLength_ = function updateArrayLength_(oldLength, delta) {
3667
- if (oldLength !== this.lastKnownLength_) die(16);
4089
+ if (oldLength !== this.lastKnownLength_) {
4090
+ die(16);
4091
+ }
4092
+
3668
4093
  this.lastKnownLength_ += delta;
3669
- if (this.legacyMode_ && delta > 0) reserveArrayBuffer(oldLength + delta + 1);
4094
+
4095
+ if (this.legacyMode_ && delta > 0) {
4096
+ reserveArrayBuffer(oldLength + delta + 1);
4097
+ }
3670
4098
  };
3671
4099
 
3672
4100
  _proto.spliceWithArray_ = function spliceWithArray_(index, deleteCount, newItems) {
@@ -3674,9 +4102,26 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3674
4102
 
3675
4103
  checkIfStateModificationsAreAllowed(this.atom_);
3676
4104
  var length = this.values_.length;
3677
- if (index === undefined) index = 0;else if (index > length) index = length;else if (index < 0) index = Math.max(0, length + index);
3678
- if (arguments.length === 1) deleteCount = length - index;else if (deleteCount === undefined || deleteCount === null) deleteCount = 0;else deleteCount = Math.max(0, Math.min(deleteCount, length - index));
3679
- if (newItems === undefined) newItems = EMPTY_ARRAY;
4105
+
4106
+ if (index === undefined) {
4107
+ index = 0;
4108
+ } else if (index > length) {
4109
+ index = length;
4110
+ } else if (index < 0) {
4111
+ index = Math.max(0, length + index);
4112
+ }
4113
+
4114
+ if (arguments.length === 1) {
4115
+ deleteCount = length - index;
4116
+ } else if (deleteCount === undefined || deleteCount === null) {
4117
+ deleteCount = 0;
4118
+ } else {
4119
+ deleteCount = Math.max(0, Math.min(deleteCount, length - index));
4120
+ }
4121
+
4122
+ if (newItems === undefined) {
4123
+ newItems = EMPTY_ARRAY;
4124
+ }
3680
4125
 
3681
4126
  if (hasInterceptors(this)) {
3682
4127
  var change = interceptChange(this, {
@@ -3686,7 +4131,11 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3686
4131
  removedCount: deleteCount,
3687
4132
  added: newItems
3688
4133
  });
3689
- if (!change) return EMPTY_ARRAY;
4134
+
4135
+ if (!change) {
4136
+ return EMPTY_ARRAY;
4137
+ }
4138
+
3690
4139
  deleteCount = change.removedCount;
3691
4140
  newItems = change.added;
3692
4141
  }
@@ -3701,7 +4150,11 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3701
4150
  }
3702
4151
 
3703
4152
  var res = this.spliceItemsIntoValues_(index, deleteCount, newItems);
3704
- if (deleteCount !== 0 || newItems.length !== 0) this.notifyArraySplice_(index, newItems, res);
4153
+
4154
+ if (deleteCount !== 0 || newItems.length !== 0) {
4155
+ this.notifyArraySplice_(index, newItems, res);
4156
+ }
4157
+
3705
4158
  return this.dehanceValues_(res);
3706
4159
  };
3707
4160
 
@@ -3744,10 +4197,19 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3744
4197
  } : null; // The reason why this is on right hand side here (and not above), is this way the uglifier will drop it, but it won't
3745
4198
  // cause any runtime overhead in development mode without NODE_ENV set, unless spying is enabled
3746
4199
 
3747
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportStart(change);
4200
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
4201
+ spyReportStart(change);
4202
+ }
4203
+
3748
4204
  this.atom_.reportChanged();
3749
- if (notify) notifyListeners(this, change);
3750
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportEnd();
4205
+
4206
+ if (notify) {
4207
+ notifyListeners(this, change);
4208
+ }
4209
+
4210
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
4211
+ spyReportEnd();
4212
+ }
3751
4213
  };
3752
4214
 
3753
4215
  _proto.notifyArraySplice_ = function notifyArraySplice_(index, added, removed) {
@@ -3764,11 +4226,20 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3764
4226
  removedCount: removed.length,
3765
4227
  addedCount: added.length
3766
4228
  } : null;
3767
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportStart(change);
4229
+
4230
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
4231
+ spyReportStart(change);
4232
+ }
4233
+
3768
4234
  this.atom_.reportChanged(); // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe
3769
4235
 
3770
- if (notify) notifyListeners(this, change);
3771
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportEnd();
4236
+ if (notify) {
4237
+ notifyListeners(this, change);
4238
+ }
4239
+
4240
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
4241
+ spyReportEnd();
4242
+ }
3772
4243
  };
3773
4244
 
3774
4245
  _proto.get_ = function get_(index) {
@@ -3795,7 +4266,11 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3795
4266
  index: index,
3796
4267
  newValue: newValue
3797
4268
  });
3798
- if (!change) return;
4269
+
4270
+ if (!change) {
4271
+ return;
4272
+ }
4273
+
3799
4274
  newValue = change.newValue;
3800
4275
  }
3801
4276
 
@@ -4079,7 +4554,10 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4079
4554
  _proto.has = function has(key) {
4080
4555
  var _this2 = this;
4081
4556
 
4082
- if (!globalState.trackingDerivation) return this.has_(key);
4557
+ if (!globalState.trackingDerivation) {
4558
+ return this.has_(key);
4559
+ }
4560
+
4083
4561
  var entry = this.hasMap_.get(key);
4084
4562
 
4085
4563
  if (!entry) {
@@ -4103,7 +4581,11 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4103
4581
  newValue: value,
4104
4582
  name: key
4105
4583
  });
4106
- if (!change) return this;
4584
+
4585
+ if (!change) {
4586
+ return this;
4587
+ }
4588
+
4107
4589
  value = change.newValue;
4108
4590
  }
4109
4591
 
@@ -4127,7 +4609,10 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4127
4609
  object: this,
4128
4610
  name: key
4129
4611
  });
4130
- if (!change) return false;
4612
+
4613
+ if (!change) {
4614
+ return false;
4615
+ }
4131
4616
  }
4132
4617
 
4133
4618
  if (this.has_(key)) {
@@ -4143,7 +4628,10 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4143
4628
  name: key
4144
4629
  } : null;
4145
4630
 
4146
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportStart(_change); // TODO fix type
4631
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
4632
+ spyReportStart(_change);
4633
+ } // TODO fix type
4634
+
4147
4635
 
4148
4636
  transaction(function () {
4149
4637
  var _this3$hasMap_$get;
@@ -4158,8 +4646,15 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4158
4646
 
4159
4647
  _this3.data_["delete"](key);
4160
4648
  });
4161
- if (notify) notifyListeners(this, _change);
4162
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportEnd();
4649
+
4650
+ if (notify) {
4651
+ notifyListeners(this, _change);
4652
+ }
4653
+
4654
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
4655
+ spyReportEnd();
4656
+ }
4657
+
4163
4658
  return true;
4164
4659
  }
4165
4660
 
@@ -4182,11 +4677,21 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4182
4677
  name: key,
4183
4678
  newValue: newValue
4184
4679
  } : null;
4185
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportStart(change); // TODO fix type
4680
+
4681
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
4682
+ spyReportStart(change);
4683
+ } // TODO fix type
4684
+
4186
4685
 
4187
4686
  observable.setNewValue_(newValue);
4188
- if (notify) notifyListeners(this, change);
4189
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportEnd();
4687
+
4688
+ if (notify) {
4689
+ notifyListeners(this, change);
4690
+ }
4691
+
4692
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
4693
+ spyReportEnd();
4694
+ }
4190
4695
  }
4191
4696
  };
4192
4697
 
@@ -4217,14 +4722,26 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4217
4722
  name: key,
4218
4723
  newValue: newValue
4219
4724
  } : null;
4220
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportStart(change); // TODO fix type
4221
4725
 
4222
- if (notify) notifyListeners(this, change);
4223
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportEnd();
4726
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
4727
+ spyReportStart(change);
4728
+ } // TODO fix type
4729
+
4730
+
4731
+ if (notify) {
4732
+ notifyListeners(this, change);
4733
+ }
4734
+
4735
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
4736
+ spyReportEnd();
4737
+ }
4224
4738
  };
4225
4739
 
4226
4740
  _proto.get = function get(key) {
4227
- if (this.has(key)) return this.dehanceValue_(this.data_.get(key).get());
4741
+ if (this.has(key)) {
4742
+ return this.dehanceValue_(this.data_.get(key).get());
4743
+ }
4744
+
4228
4745
  return this.dehanceValue_(undefined);
4229
4746
  };
4230
4747
 
@@ -4298,18 +4815,27 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4298
4815
  }
4299
4816
 
4300
4817
  transaction(function () {
4301
- if (isPlainObject(other)) getPlainObjectKeys(other).forEach(function (key) {
4302
- return _this5.set(key, other[key]);
4303
- });else if (Array.isArray(other)) other.forEach(function (_ref) {
4304
- var key = _ref[0],
4305
- value = _ref[1];
4306
- return _this5.set(key, value);
4307
- });else if (isES6Map(other)) {
4308
- if (other.constructor !== Map) die(19, other);
4818
+ if (isPlainObject(other)) {
4819
+ getPlainObjectKeys(other).forEach(function (key) {
4820
+ return _this5.set(key, other[key]);
4821
+ });
4822
+ } else if (Array.isArray(other)) {
4823
+ other.forEach(function (_ref) {
4824
+ var key = _ref[0],
4825
+ value = _ref[1];
4826
+ return _this5.set(key, value);
4827
+ });
4828
+ } else if (isES6Map(other)) {
4829
+ if (other.constructor !== Map) {
4830
+ die(19, other);
4831
+ }
4832
+
4309
4833
  other.forEach(function (value, key) {
4310
4834
  return _this5.set(key, value);
4311
4835
  });
4312
- } else if (other !== null && other !== undefined) die(20, other);
4836
+ } else if (other !== null && other !== undefined) {
4837
+ die(20, other);
4838
+ }
4313
4839
  });
4314
4840
  return this;
4315
4841
  };
@@ -4440,7 +4966,10 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4440
4966
  * for callback details
4441
4967
  */
4442
4968
  _proto.observe_ = function observe_(listener, fireImmediately) {
4443
- if (process.env.NODE_ENV !== "production" && fireImmediately === true) die("`observe` doesn't support fireImmediately=true in combination with maps.");
4969
+ if (process.env.NODE_ENV !== "production" && fireImmediately === true) {
4970
+ die("`observe` doesn't support fireImmediately=true in combination with maps.");
4971
+ }
4972
+
4444
4973
  return registerListener(this, listener);
4445
4974
  };
4446
4975
 
@@ -4565,8 +5094,12 @@ var ObservableSet = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4565
5094
  object: this,
4566
5095
  newValue: value
4567
5096
  });
4568
- if (!change) return this; // ideally, value = change.value would be done here, so that values can be
5097
+
5098
+ if (!change) {
5099
+ return this;
5100
+ } // ideally, value = change.value would be done here, so that values can be
4569
5101
  // changed by interceptor. Same applies for other Set and Map api's.
5102
+
4570
5103
  }
4571
5104
 
4572
5105
  if (!this.has(value)) {
@@ -4586,9 +5119,17 @@ var ObservableSet = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4586
5119
  newValue: value
4587
5120
  } : null;
4588
5121
 
4589
- if (notifySpy && process.env.NODE_ENV !== "production") spyReportStart(_change);
4590
- if (notify) notifyListeners(this, _change);
4591
- if (notifySpy && process.env.NODE_ENV !== "production") spyReportEnd();
5122
+ if (notifySpy && process.env.NODE_ENV !== "production") {
5123
+ spyReportStart(_change);
5124
+ }
5125
+
5126
+ if (notify) {
5127
+ notifyListeners(this, _change);
5128
+ }
5129
+
5130
+ if (notifySpy && process.env.NODE_ENV !== "production") {
5131
+ spyReportEnd();
5132
+ }
4592
5133
  }
4593
5134
 
4594
5135
  return this;
@@ -4603,7 +5144,10 @@ var ObservableSet = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4603
5144
  object: this,
4604
5145
  oldValue: value
4605
5146
  });
4606
- if (!change) return false;
5147
+
5148
+ if (!change) {
5149
+ return false;
5150
+ }
4607
5151
  }
4608
5152
 
4609
5153
  if (this.has(value)) {
@@ -4618,14 +5162,24 @@ var ObservableSet = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4618
5162
  oldValue: value
4619
5163
  } : null;
4620
5164
 
4621
- if (notifySpy && process.env.NODE_ENV !== "production") spyReportStart(_change2);
5165
+ if (notifySpy && process.env.NODE_ENV !== "production") {
5166
+ spyReportStart(_change2);
5167
+ }
5168
+
4622
5169
  transaction(function () {
4623
5170
  _this3.atom_.reportChanged();
4624
5171
 
4625
5172
  _this3.data_["delete"](value);
4626
5173
  });
4627
- if (notify) notifyListeners(this, _change2);
4628
- if (notifySpy && process.env.NODE_ENV !== "production") spyReportEnd();
5174
+
5175
+ if (notify) {
5176
+ notifyListeners(this, _change2);
5177
+ }
5178
+
5179
+ if (notifySpy && process.env.NODE_ENV !== "production") {
5180
+ spyReportEnd();
5181
+ }
5182
+
4629
5183
  return true;
4630
5184
  }
4631
5185
 
@@ -4705,7 +5259,10 @@ var ObservableSet = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4705
5259
 
4706
5260
  _proto.observe_ = function observe_(listener, fireImmediately) {
4707
5261
  // ... 'fireImmediately' could also be true?
4708
- if (process.env.NODE_ENV !== "production" && fireImmediately === true) die("`observe` doesn't support fireImmediately=true in combination with sets.");
5262
+ if (process.env.NODE_ENV !== "production" && fireImmediately === true) {
5263
+ die("`observe` doesn't support fireImmediately=true in combination with sets.");
5264
+ }
5265
+
4709
5266
  return registerListener(this, listener);
4710
5267
  };
4711
5268
 
@@ -4807,7 +5364,11 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
4807
5364
  name: key,
4808
5365
  newValue: newValue
4809
5366
  });
4810
- if (!change) return null;
5367
+
5368
+ if (!change) {
5369
+ return null;
5370
+ }
5371
+
4811
5372
  newValue = change.newValue;
4812
5373
  }
4813
5374
 
@@ -4827,10 +5388,18 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
4827
5388
  newValue: newValue
4828
5389
  } : null;
4829
5390
 
4830
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportStart(_change);
5391
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
5392
+ spyReportStart(_change);
5393
+ }
4831
5394
  observable.setNewValue_(newValue);
4832
- if (notify) notifyListeners(this, _change);
4833
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportEnd();
5395
+
5396
+ if (notify) {
5397
+ notifyListeners(this, _change);
5398
+ }
5399
+
5400
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
5401
+ spyReportEnd();
5402
+ }
4834
5403
  }
4835
5404
 
4836
5405
  return true;
@@ -4939,12 +5508,18 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
4939
5508
 
4940
5509
  if (descriptor) {
4941
5510
  var outcome = annotation.make_(this, key, descriptor, source);
5511
+
4942
5512
  if (outcome === 0
4943
5513
  /* Cancel */
4944
- ) return;
5514
+ ) {
5515
+ return;
5516
+ }
5517
+
4945
5518
  if (outcome === 1
4946
5519
  /* Break */
4947
- ) break;
5520
+ ) {
5521
+ break;
5522
+ }
4948
5523
  }
4949
5524
 
4950
5525
  source = Object.getPrototypeOf(source);
@@ -5014,7 +5589,11 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5014
5589
  type: ADD,
5015
5590
  newValue: descriptor.value
5016
5591
  });
5017
- if (!change) return null;
5592
+
5593
+ if (!change) {
5594
+ return null;
5595
+ }
5596
+
5018
5597
  var newValue = change.newValue;
5019
5598
 
5020
5599
  if (descriptor.value !== newValue) {
@@ -5066,7 +5645,11 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5066
5645
  type: ADD,
5067
5646
  newValue: value
5068
5647
  });
5069
- if (!change) return null;
5648
+
5649
+ if (!change) {
5650
+ return null;
5651
+ }
5652
+
5070
5653
  value = change.newValue;
5071
5654
  }
5072
5655
 
@@ -5121,7 +5704,10 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5121
5704
  type: ADD,
5122
5705
  newValue: undefined
5123
5706
  });
5124
- if (!change) return null;
5707
+
5708
+ if (!change) {
5709
+ return null;
5710
+ }
5125
5711
  }
5126
5712
 
5127
5713
  options.name || (options.name = process.env.NODE_ENV !== "production" ? this.name_ + "." + key.toString() : "ObservableObject.key");
@@ -5177,7 +5763,9 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5177
5763
  type: REMOVE
5178
5764
  }); // Cancelled
5179
5765
 
5180
- if (!change) return null;
5766
+ if (!change) {
5767
+ return null;
5768
+ }
5181
5769
  } // Delete
5182
5770
 
5183
5771
 
@@ -5238,9 +5826,18 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5238
5826
  oldValue: value,
5239
5827
  name: key
5240
5828
  };
5241
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportStart(_change2);
5242
- if (notify) notifyListeners(this, _change2);
5243
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportEnd();
5829
+
5830
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
5831
+ spyReportStart(_change2);
5832
+ }
5833
+
5834
+ if (notify) {
5835
+ notifyListeners(this, _change2);
5836
+ }
5837
+
5838
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
5839
+ spyReportEnd();
5840
+ }
5244
5841
  }
5245
5842
  } finally {
5246
5843
  endBatch();
@@ -5256,7 +5853,10 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5256
5853
  ;
5257
5854
 
5258
5855
  _proto.observe_ = function observe_(callback, fireImmediately) {
5259
- if (process.env.NODE_ENV !== "production" && fireImmediately === true) die("`observe` doesn't support the fire immediately property for observable objects.");
5856
+ if (process.env.NODE_ENV !== "production" && fireImmediately === true) {
5857
+ die("`observe` doesn't support the fire immediately property for observable objects.");
5858
+ }
5859
+
5260
5860
  return registerListener(this, callback);
5261
5861
  };
5262
5862
 
@@ -5279,9 +5879,18 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5279
5879
  name: key,
5280
5880
  newValue: value
5281
5881
  } : null;
5282
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportStart(change);
5283
- if (notify) notifyListeners(this, change);
5284
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportEnd();
5882
+
5883
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
5884
+ spyReportStart(change);
5885
+ }
5886
+
5887
+ if (notify) {
5888
+ notifyListeners(this, change);
5889
+ }
5890
+
5891
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
5892
+ spyReportEnd();
5893
+ }
5285
5894
  }
5286
5895
 
5287
5896
  (_this$pendingKeys_2 = this.pendingKeys_) == null ? void 0 : (_this$pendingKeys_2$g = _this$pendingKeys_2.get(key)) == null ? void 0 : _this$pendingKeys_2$g.set(true); // Notify "keys/entries/values" observers
@@ -5322,7 +5931,10 @@ function asObservableObject(target, options) {
5322
5931
  return target;
5323
5932
  }
5324
5933
 
5325
- if (process.env.NODE_ENV !== "production" && !Object.isExtensible(target)) die("Cannot make the designated object observable; it is not extensible");
5934
+ if (process.env.NODE_ENV !== "production" && !Object.isExtensible(target)) {
5935
+ die("Cannot make the designated object observable; it is not extensible");
5936
+ }
5937
+
5326
5938
  var name = (_options$name = options == null ? void 0 : options.name) != null ? _options$name : process.env.NODE_ENV !== "production" ? (isPlainObject(target) ? "ObservableObject" : target.constructor.name) + "@" + getNextId() : "ObservableObject";
5327
5939
  var adm = new ObservableObjectAdministration(target, new Map(), String(name), getAnnotationFromOptions(options));
5328
5940
  addHiddenProp(target, $mobx, adm);
@@ -5479,7 +6091,6 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray, _Symbol$toStringT
5479
6091
  var nextIndex = 0;
5480
6092
  return makeIterable({
5481
6093
  next: function next() {
5482
- // @ts-ignore
5483
6094
  return nextIndex < self.length ? {
5484
6095
  value: self[nextIndex++],
5485
6096
  done: false
@@ -5512,7 +6123,10 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray, _Symbol$toStringT
5512
6123
  Object.entries(arrayExtensions).forEach(function (_ref) {
5513
6124
  var prop = _ref[0],
5514
6125
  fn = _ref[1];
5515
- if (prop !== "concat") addHiddenProp(LegacyObservableArray.prototype, prop, fn);
6126
+
6127
+ if (prop !== "concat") {
6128
+ addHiddenProp(LegacyObservableArray.prototype, prop, fn);
6129
+ }
5516
6130
  });
5517
6131
 
5518
6132
  function createArrayEntryDescriptor(index) {
@@ -5549,7 +6163,10 @@ function createLegacyArray(initialValues, enhancer, name) {
5549
6163
  function getAtom(thing, property) {
5550
6164
  if (typeof thing === "object" && thing !== null) {
5551
6165
  if (isObservableArray(thing)) {
5552
- if (property !== undefined) die(23);
6166
+ if (property !== undefined) {
6167
+ die(23);
6168
+ }
6169
+
5553
6170
  return thing[$mobx].atom_;
5554
6171
  }
5555
6172
 
@@ -5558,18 +6175,31 @@ function getAtom(thing, property) {
5558
6175
  }
5559
6176
 
5560
6177
  if (isObservableMap(thing)) {
5561
- if (property === undefined) return thing.keysAtom_;
6178
+ if (property === undefined) {
6179
+ return thing.keysAtom_;
6180
+ }
6181
+
5562
6182
  var observable = thing.data_.get(property) || thing.hasMap_.get(property);
5563
- if (!observable) die(25, property, getDebugName(thing));
6183
+
6184
+ if (!observable) {
6185
+ die(25, property, getDebugName(thing));
6186
+ }
6187
+
5564
6188
  return observable;
5565
6189
  }
5566
6190
 
6191
+
5567
6192
  if (isObservableObject(thing)) {
5568
- if (!property) return die(26);
6193
+ if (!property) {
6194
+ return die(26);
6195
+ }
5569
6196
 
5570
6197
  var _observable = thing[$mobx].values_.get(property);
5571
6198
 
5572
- if (!_observable) die(27, property, getDebugName(thing));
6199
+ if (!_observable) {
6200
+ die(27, property, getDebugName(thing));
6201
+ }
6202
+
5573
6203
  return _observable;
5574
6204
  }
5575
6205
 
@@ -5586,11 +6216,26 @@ function getAtom(thing, property) {
5586
6216
  die(28);
5587
6217
  }
5588
6218
  function getAdministration(thing, property) {
5589
- if (!thing) die(29);
5590
- if (property !== undefined) return getAdministration(getAtom(thing, property));
5591
- if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) return thing;
5592
- if (isObservableMap(thing) || isObservableSet(thing)) return thing;
5593
- if (thing[$mobx]) return thing[$mobx];
6219
+ if (!thing) {
6220
+ die(29);
6221
+ }
6222
+
6223
+ if (property !== undefined) {
6224
+ return getAdministration(getAtom(thing, property));
6225
+ }
6226
+
6227
+ if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {
6228
+ return thing;
6229
+ }
6230
+
6231
+ if (isObservableMap(thing) || isObservableSet(thing)) {
6232
+ return thing;
6233
+ }
6234
+
6235
+ if (thing[$mobx]) {
6236
+ return thing[$mobx];
6237
+ }
6238
+
5594
6239
  die(24, thing);
5595
6240
  }
5596
6241
  function getDebugName(thing, property) {
@@ -5623,17 +6268,33 @@ function deepEqual(a, b, depth) {
5623
6268
  function eq(a, b, depth, aStack, bStack) {
5624
6269
  // Identical objects are equal. `0 === -0`, but they aren't identical.
5625
6270
  // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
5626
- if (a === b) return a !== 0 || 1 / a === 1 / b; // `null` or `undefined` only equal to itself (strict comparison).
6271
+ if (a === b) {
6272
+ return a !== 0 || 1 / a === 1 / b;
6273
+ } // `null` or `undefined` only equal to itself (strict comparison).
5627
6274
 
5628
- if (a == null || b == null) return false; // `NaN`s are equivalent, but non-reflexive.
5629
6275
 
5630
- if (a !== a) return b !== b; // Exhaust primitive checks
6276
+ if (a == null || b == null) {
6277
+ return false;
6278
+ } // `NaN`s are equivalent, but non-reflexive.
6279
+
6280
+
6281
+ if (a !== a) {
6282
+ return b !== b;
6283
+ } // Exhaust primitive checks
6284
+
5631
6285
 
5632
6286
  var type = typeof a;
5633
- if (type !== "function" && type !== "object" && typeof b != "object") return false; // Compare `[[Class]]` names.
6287
+
6288
+ if (type !== "function" && type !== "object" && typeof b != "object") {
6289
+ return false;
6290
+ } // Compare `[[Class]]` names.
6291
+
5634
6292
 
5635
6293
  var className = toString.call(a);
5636
- if (className !== toString.call(b)) return false;
6294
+
6295
+ if (className !== toString.call(b)) {
6296
+ return false;
6297
+ }
5637
6298
 
5638
6299
  switch (className) {
5639
6300
  // Strings, numbers, regular expressions, dates, and booleans are compared by value.
@@ -5647,7 +6308,10 @@ function eq(a, b, depth, aStack, bStack) {
5647
6308
  case "[object Number]":
5648
6309
  // `NaN`s are equivalent, but non-reflexive.
5649
6310
  // Object(NaN) is equivalent to NaN.
5650
- if (+a !== +a) return +b !== +b; // An `egal` comparison is performed for other numeric values.
6311
+ if (+a !== +a) {
6312
+ return +b !== +b;
6313
+ } // An `egal` comparison is performed for other numeric values.
6314
+
5651
6315
 
5652
6316
  return +a === 0 ? 1 / +a === 1 / b : +a === +b;
5653
6317
 
@@ -5678,9 +6342,12 @@ function eq(a, b, depth, aStack, bStack) {
5678
6342
  var areArrays = className === "[object Array]";
5679
6343
 
5680
6344
  if (!areArrays) {
5681
- if (typeof a != "object" || typeof b != "object") return false; // Objects with different constructors are not equivalent, but `Object`s or `Array`s
6345
+ if (typeof a != "object" || typeof b != "object") {
6346
+ return false;
6347
+ } // Objects with different constructors are not equivalent, but `Object`s or `Array`s
5682
6348
  // from different frames are.
5683
6349
 
6350
+
5684
6351
  var aCtor = a.constructor,
5685
6352
  bCtor = b.constructor;
5686
6353
 
@@ -5706,7 +6373,9 @@ function eq(a, b, depth, aStack, bStack) {
5706
6373
  while (length--) {
5707
6374
  // Linear search. Performance is inversely proportional to the number of
5708
6375
  // unique nested structures.
5709
- if (aStack[length] === a) return bStack[length] === b;
6376
+ if (aStack[length] === a) {
6377
+ return bStack[length] === b;
6378
+ }
5710
6379
  } // Add the first object to the stack of traversed objects.
5711
6380
 
5712
6381
 
@@ -5716,10 +6385,16 @@ function eq(a, b, depth, aStack, bStack) {
5716
6385
  if (areArrays) {
5717
6386
  // Compare array lengths to determine if a deep comparison is necessary.
5718
6387
  length = a.length;
5719
- if (length !== b.length) return false; // Deep compare the contents, ignoring non-numeric properties.
6388
+
6389
+ if (length !== b.length) {
6390
+ return false;
6391
+ } // Deep compare the contents, ignoring non-numeric properties.
6392
+
5720
6393
 
5721
6394
  while (length--) {
5722
- if (!eq(a[length], b[length], depth - 1, aStack, bStack)) return false;
6395
+ if (!eq(a[length], b[length], depth - 1, aStack, bStack)) {
6396
+ return false;
6397
+ }
5723
6398
  }
5724
6399
  } else {
5725
6400
  // Deep compare objects.
@@ -5727,12 +6402,17 @@ function eq(a, b, depth, aStack, bStack) {
5727
6402
  var key;
5728
6403
  length = keys.length; // Ensure that both objects contain the same number of properties before comparing deep equality.
5729
6404
 
5730
- if (Object.keys(b).length !== length) return false;
6405
+ if (Object.keys(b).length !== length) {
6406
+ return false;
6407
+ }
5731
6408
 
5732
6409
  while (length--) {
5733
6410
  // Deep compare each member
5734
6411
  key = keys[length];
5735
- if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) return false;
6412
+
6413
+ if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) {
6414
+ return false;
6415
+ }
5736
6416
  }
5737
6417
  } // Remove the first object from the stack of traversed objects.
5738
6418
 
@@ -5743,9 +6423,18 @@ function eq(a, b, depth, aStack, bStack) {
5743
6423
  }
5744
6424
 
5745
6425
  function unwrap(a) {
5746
- if (isObservableArray(a)) return a.slice();
5747
- if (isES6Map(a) || isObservableMap(a)) return Array.from(a.entries());
5748
- if (isES6Set(a) || isObservableSet(a)) return Array.from(a.entries());
6426
+ if (isObservableArray(a)) {
6427
+ return a.slice();
6428
+ }
6429
+
6430
+ if (isES6Map(a) || isObservableMap(a)) {
6431
+ return Array.from(a.entries());
6432
+ }
6433
+
6434
+ if (isES6Set(a) || isObservableSet(a)) {
6435
+ return Array.from(a.entries());
6436
+ }
6437
+
5749
6438
  return a;
5750
6439
  }
5751
6440