@player-ui/common-expressions-plugin 0.13.0 → 0.14.0-next.1

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.
@@ -45,6 +45,10 @@ function _async_to_generator(fn) {
45
45
  });
46
46
  };
47
47
  }
48
+ function _call_super(_this, derived, args) {
49
+ derived = _get_prototype_of(derived);
50
+ return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
51
+ }
48
52
  function _class_call_check(instance, Constructor) {
49
53
  if (!(instance instanceof Constructor)) {
50
54
  throw new TypeError("Cannot call a class as a function");
@@ -283,31 +287,15 @@ function _wrap_native_super(Class) {
283
287
  return _wrap_native_super(Class);
284
288
  }
285
289
  function _is_native_reflect_construct() {
286
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
287
- if (Reflect.construct.sham) return false;
288
- if (typeof Proxy === "function") return true;
289
290
  try {
290
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
291
- return true;
292
- } catch (e) {
293
- return false;
294
- }
295
- }
296
- function _create_super(Derived) {
297
- var hasNativeReflectConstruct = _is_native_reflect_construct();
298
- return function _createSuperInternal() {
299
- var Super = _get_prototype_of(Derived), result;
300
- if (hasNativeReflectConstruct) {
301
- var NewTarget = _get_prototype_of(this).constructor;
302
- result = Reflect.construct(Super, arguments, NewTarget);
303
- } else {
304
- result = Super.apply(this, arguments);
305
- }
306
- return _possible_constructor_return(this, result);
307
- };
291
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
292
+ } catch (_) {}
293
+ return (_is_native_reflect_construct = function() {
294
+ return !!result;
295
+ })();
308
296
  }
309
297
  function _ts_generator(thisArg, body) {
310
- var f, y, t, g, _ = {
298
+ var f, y, t, _ = {
311
299
  label: 0,
312
300
  sent: function() {
313
301
  if (t[0] & 1) throw t[1];
@@ -315,12 +303,8 @@ function _ts_generator(thisArg, body) {
315
303
  },
316
304
  trys: [],
317
305
  ops: []
318
- };
319
- return g = {
320
- next: verb(0),
321
- "throw": verb(1),
322
- "return": verb(2)
323
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
306
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
307
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
324
308
  return this;
325
309
  }), g;
326
310
  function verb(n) {
@@ -333,7 +317,7 @@ function _ts_generator(thisArg, body) {
333
317
  }
334
318
  function step(op) {
335
319
  if (f) throw new TypeError("Generator is already executing.");
336
- while(_)try {
320
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
337
321
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
338
322
  if (y = 0, t) op = [
339
323
  op[0] & 2,
@@ -505,7 +489,7 @@ var CommonExpressionsPlugin = function() {
505
489
  };
506
490
  var findInArray = function findInArray(array, key, value) {
507
491
  return array.findIndex(function(obj) {
508
- if (obj && typeof obj === "object") {
492
+ if (obj && (typeof obj === "undefined" ? "undefined" : _type_of(obj)) === "object") {
509
493
  return obj[key] == value;
510
494
  }
511
495
  return false;
@@ -599,7 +583,7 @@ var CommonExpressionsPlugin = function() {
599
583
  };
600
584
  };
601
585
  var isExpressionNode = function isExpressionNode(x) {
602
- return typeof x === "object" && x !== null && !Array.isArray(x) && x.__id === ExpNodeOpaqueIdentifier;
586
+ return (typeof x === "undefined" ? "undefined" : _type_of(x)) === "object" && x !== null && !Array.isArray(x) && x.__id === ExpNodeOpaqueIdentifier;
603
587
  };
604
588
  var throwError = function throwError(message, index) {
605
589
  var err = new Error("".concat(message, " at character ").concat(index));
@@ -1187,7 +1171,7 @@ var CommonExpressionsPlugin = function() {
1187
1171
  var isPromiseLike = function isPromiseLike(value) {
1188
1172
  var // Check for standard Promise constructor name
1189
1173
  _value_constructor;
1190
- return value != null && typeof value === "object" && typeof value.then === "function" && // Additional safeguards against false positives
1174
+ return value != null && (typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" && typeof value.then === "function" && // Additional safeguards against false positives
1191
1175
  (_instanceof(value, Promise) || ((_value_constructor = value.constructor) === null || _value_constructor === void 0 ? void 0 : _value_constructor.name) === "Promise" || // Verify it has other Promise-like methods to reduce false positives
1192
1176
  typeof value.catch === "function" && typeof value.finally === "function");
1193
1177
  };
@@ -1210,7 +1194,7 @@ var CommonExpressionsPlugin = function() {
1210
1194
  if (isExpressionNode(expr)) {
1211
1195
  return false;
1212
1196
  }
1213
- return typeof expr === "object" && expr !== null && !Array.isArray(expr) && "value" in expr;
1197
+ return (typeof expr === "undefined" ? "undefined" : _type_of(expr)) === "object" && expr !== null && !Array.isArray(expr) && "value" in expr;
1214
1198
  };
1215
1199
  var makePromiseAwareBinaryOp = function makePromiseAwareBinaryOp(operation) {
1216
1200
  return function(a, b, async) {
@@ -1427,7 +1411,7 @@ var CommonExpressionsPlugin = function() {
1427
1411
  if (!node) {
1428
1412
  return;
1429
1413
  }
1430
- if ("value" in node && typeof node.value === "object" && typeof ((_node_value = node.value) === null || _node_value === void 0 ? void 0 : _node_value.id) === "string") {
1414
+ if ("value" in node && _type_of(node.value) === "object" && typeof ((_node_value = node.value) === null || _node_value === void 0 ? void 0 : _node_value.id) === "string") {
1431
1415
  return node.value.id;
1432
1416
  }
1433
1417
  };
@@ -1462,22 +1446,6 @@ var CommonExpressionsPlugin = function() {
1462
1446
  }
1463
1447
  });
1464
1448
  };
1465
- var unpackNode = function unpackNode(item) {
1466
- var _item_children_, _item_children, _item_children_1, _item_children1;
1467
- var unpacked = [];
1468
- if ("children" in item && ((_item_children = item.children) === null || _item_children === void 0 ? void 0 : (_item_children_ = _item_children[0]) === null || _item_children_ === void 0 ? void 0 : _item_children_.value.type) === "asset" && ((_item_children1 = item.children) === null || _item_children1 === void 0 ? void 0 : (_item_children_1 = _item_children1[0]) === null || _item_children_1 === void 0 ? void 0 : _item_children_1.value).children) {
1469
- var _item_children__value_children_, _item_children__value_children, _item_children_2, _item_children2;
1470
- if (((_item_children__value_children = ((_item_children2 = item.children) === null || _item_children2 === void 0 ? void 0 : (_item_children_2 = _item_children2[0]) === null || _item_children_2 === void 0 ? void 0 : _item_children_2.value).children) === null || _item_children__value_children === void 0 ? void 0 : (_item_children__value_children_ = _item_children__value_children[0]) === null || _item_children__value_children_ === void 0 ? void 0 : _item_children__value_children_.value.type) === "multi-node") {
1471
- var _item_children__value_children_1, _item_children__value_children1, _item_children_3, _item_children3;
1472
- ((_item_children__value_children1 = ((_item_children3 = item.children) === null || _item_children3 === void 0 ? void 0 : (_item_children_3 = _item_children3[0]) === null || _item_children_3 === void 0 ? void 0 : _item_children_3.value).children) === null || _item_children__value_children1 === void 0 ? void 0 : (_item_children__value_children_1 = _item_children__value_children1[0]) === null || _item_children__value_children_1 === void 0 ? void 0 : _item_children__value_children_1.value).values.forEach(function(value) {
1473
- unpacked.push(value);
1474
- });
1475
- }
1476
- } else {
1477
- unpacked.push(item);
1478
- }
1479
- return unpacked;
1480
- };
1481
1449
  var hasSomethingToResolve = function hasSomethingToResolve(str) {
1482
1450
  return bindingResolveLookup(str) || expressionResolveLookup(str);
1483
1451
  };
@@ -1578,7 +1546,7 @@ var CommonExpressionsPlugin = function() {
1578
1546
  });
1579
1547
  };
1580
1548
  var __copyProps = function(to, from, except, desc) {
1581
- if (from && typeof from === "object" || typeof from === "function") {
1549
+ if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
1582
1550
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1583
1551
  try {
1584
1552
  var _loop = function() {
@@ -1633,15 +1601,16 @@ var CommonExpressionsPlugin = function() {
1633
1601
  exports.toError = exports.NestedError = void 0;
1634
1602
  var NestedError4 = /*#__PURE__*/ function(Error1) {
1635
1603
  _inherits(_NestedError, Error1);
1636
- var _super = _create_super(_NestedError);
1637
1604
  function _NestedError(message) {
1638
1605
  for(var _len = arguments.length, innerErrors = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
1639
1606
  innerErrors[_key - 1] = arguments[_key];
1640
1607
  }
1641
1608
  _class_call_check(this, _NestedError);
1642
1609
  var _this;
1643
- _this = _super.call(this, message);
1644
- var thisErrorReport = _NestedError.getErrorReport(_assert_this_initialized(_this));
1610
+ _this = _call_super(this, _NestedError, [
1611
+ message
1612
+ ]);
1613
+ var thisErrorReport = _NestedError.getErrorReport(_this);
1645
1614
  if (innerErrors.length === 1) {
1646
1615
  var innerError = toError(innerErrors[0]);
1647
1616
  _this.innerErrors = [
@@ -1777,7 +1746,7 @@ var CommonExpressionsPlugin = function() {
1777
1746
  return out;
1778
1747
  }
1779
1748
  function isObject(o) {
1780
- return o != null && typeof o === "object";
1749
+ return o != null && (typeof o === "undefined" ? "undefined" : _type_of(o)) === "object";
1781
1750
  }
1782
1751
  function addLast2(array, val) {
1783
1752
  if (Array.isArray(val)) return array.concat(val);
@@ -2120,7 +2089,7 @@ var CommonExpressionsPlugin = function() {
2120
2089
  else return 0;
2121
2090
  }
2122
2091
  }();
2123
- if (typeof module === "object") module.exports = SortedArray2;
2092
+ if ((typeof module === "undefined" ? "undefined" : _type_of(module)) === "object") module.exports = SortedArray2;
2124
2093
  if (typeof define === "function" && define.amd) define(function() {
2125
2094
  return SortedArray2;
2126
2095
  });
@@ -2409,10 +2378,9 @@ var CommonExpressionsPlugin = function() {
2409
2378
  }();
2410
2379
  var SyncHook = /*#__PURE__*/ function(Hook) {
2411
2380
  _inherits(SyncHook, Hook);
2412
- var _super = _create_super(SyncHook);
2413
2381
  function SyncHook() {
2414
2382
  _class_call_check(this, SyncHook);
2415
- return _super.apply(this, arguments);
2383
+ return _call_super(this, SyncHook, arguments);
2416
2384
  }
2417
2385
  _create_class(SyncHook, [
2418
2386
  {
@@ -2445,10 +2413,9 @@ var CommonExpressionsPlugin = function() {
2445
2413
  }(Hook);
2446
2414
  var SyncBailHook = /*#__PURE__*/ function(Hook) {
2447
2415
  _inherits(SyncBailHook, Hook);
2448
- var _super = _create_super(SyncBailHook);
2449
2416
  function SyncBailHook() {
2450
2417
  _class_call_check(this, SyncBailHook);
2451
- return _super.apply(this, arguments);
2418
+ return _call_super(this, SyncBailHook, arguments);
2452
2419
  }
2453
2420
  _create_class(SyncBailHook, [
2454
2421
  {
@@ -2480,10 +2447,9 @@ var CommonExpressionsPlugin = function() {
2480
2447
  }(Hook);
2481
2448
  var SyncWaterfallHook = /*#__PURE__*/ function(Hook) {
2482
2449
  _inherits(SyncWaterfallHook, Hook);
2483
- var _super = _create_super(SyncWaterfallHook);
2484
2450
  function SyncWaterfallHook() {
2485
2451
  _class_call_check(this, SyncWaterfallHook);
2486
- return _super.apply(this, arguments);
2452
+ return _call_super(this, SyncWaterfallHook, arguments);
2487
2453
  }
2488
2454
  _create_class(SyncWaterfallHook, [
2489
2455
  {
@@ -2545,7 +2511,7 @@ var CommonExpressionsPlugin = function() {
2545
2511
  for(var _iterator = foo[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
2546
2512
  len = _step.value;
2547
2513
  tmp = len;
2548
- if (tmp && typeof tmp === "object") {
2514
+ if (tmp && (typeof tmp === "undefined" ? "undefined" : _type_of(tmp)) === "object") {
2549
2515
  tmp = find(bar, tmp);
2550
2516
  if (!tmp) return false;
2551
2517
  }
@@ -2576,7 +2542,7 @@ var CommonExpressionsPlugin = function() {
2576
2542
  for(var _iterator1 = foo[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
2577
2543
  len = _step1.value;
2578
2544
  tmp = len[0];
2579
- if (tmp && typeof tmp === "object") {
2545
+ if (tmp && (typeof tmp === "undefined" ? "undefined" : _type_of(tmp)) === "object") {
2580
2546
  tmp = find(bar, tmp);
2581
2547
  if (!tmp) return false;
2582
2548
  }
@@ -2615,7 +2581,7 @@ var CommonExpressionsPlugin = function() {
2615
2581
  }
2616
2582
  return len === -1;
2617
2583
  }
2618
- if (!ctor || typeof foo === "object") {
2584
+ if (!ctor || (typeof foo === "undefined" ? "undefined" : _type_of(foo)) === "object") {
2619
2585
  len = 0;
2620
2586
  for(ctor in foo){
2621
2587
  if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;
@@ -2648,7 +2614,7 @@ var CommonExpressionsPlugin = function() {
2648
2614
  var nestedPath = _to_consumable_array(path).concat([
2649
2615
  key
2650
2616
  ]);
2651
- if (typeof val === "object") {
2617
+ if ((typeof val === "undefined" ? "undefined" : _type_of(val)) === "object") {
2652
2618
  traverseObj(val, nestedPath, pairs);
2653
2619
  } else {
2654
2620
  pairs.set(nestedPath, val);
@@ -2689,7 +2655,7 @@ var CommonExpressionsPlugin = function() {
2689
2655
  {
2690
2656
  /** Add match -> value mapping to the registry */ key: "set",
2691
2657
  value: function set(match, value) {
2692
- var matcher = typeof match === "object" ? createMatcher(match) : createBasicMatcher(match);
2658
+ var matcher = (typeof match === "undefined" ? "undefined" : _type_of(match)) === "object" ? createMatcher(match) : createBasicMatcher(match);
2693
2659
  this.store.insert({
2694
2660
  key: match,
2695
2661
  value: value,
@@ -2852,6 +2818,7 @@ var CommonExpressionsPlugin = function() {
2852
2818
  }
2853
2819
  };
2854
2820
  var identifier = function() {
2821
+ var allowBoolValue = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
2855
2822
  if (!isIdentifierChar(ch)) {
2856
2823
  return;
2857
2824
  }
@@ -2862,6 +2829,14 @@ var CommonExpressionsPlugin = function() {
2862
2829
  }
2863
2830
  value += ch;
2864
2831
  }
2832
+ if (allowBoolValue) {
2833
+ if (value === "true") {
2834
+ return toValue(true);
2835
+ }
2836
+ if (value === "false") {
2837
+ return toValue(false);
2838
+ }
2839
+ }
2865
2840
  if (value) {
2866
2841
  var maybeNumber = Number(value);
2867
2842
  value = isNaN(maybeNumber) ? value : maybeNumber;
@@ -2910,8 +2885,9 @@ var CommonExpressionsPlugin = function() {
2910
2885
  }
2911
2886
  };
2912
2887
  var simpleSegment = function() {
2888
+ var allowBoolValue = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
2913
2889
  var _nestedPath, _ref;
2914
- return (_ref = (_nestedPath = nestedPath()) !== null && _nestedPath !== void 0 ? _nestedPath : expression()) !== null && _ref !== void 0 ? _ref : identifier();
2890
+ return (_ref = (_nestedPath = nestedPath()) !== null && _nestedPath !== void 0 ? _nestedPath : expression()) !== null && _ref !== void 0 ? _ref : identifier(allowBoolValue);
2915
2891
  };
2916
2892
  var segment = function() {
2917
2893
  var segments = [];
@@ -2926,6 +2902,7 @@ var CommonExpressionsPlugin = function() {
2926
2902
  return toConcatenatedNode(segments);
2927
2903
  };
2928
2904
  var optionallyQuotedSegment = function() {
2905
+ var allowBoolValue = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
2929
2906
  whitespace();
2930
2907
  if (ch === SINGLE_QUOTE || ch === DOUBLE_QUOTE) {
2931
2908
  var singleQuote = ch === SINGLE_QUOTE;
@@ -2934,7 +2911,7 @@ var CommonExpressionsPlugin = function() {
2934
2911
  next(singleQuote ? SINGLE_QUOTE : DOUBLE_QUOTE);
2935
2912
  return id;
2936
2913
  }
2937
- return simpleSegment();
2914
+ return simpleSegment(allowBoolValue);
2938
2915
  };
2939
2916
  var equals = function() {
2940
2917
  if (ch !== EQUALS) {
@@ -2954,7 +2931,7 @@ var CommonExpressionsPlugin = function() {
2954
2931
  whitespace();
2955
2932
  if (equals()) {
2956
2933
  whitespace();
2957
- var second = optionallyQuotedSegment();
2934
+ var second = optionallyQuotedSegment(true);
2958
2935
  value = toQuery(value, second);
2959
2936
  whitespace();
2960
2937
  }
@@ -3142,7 +3119,7 @@ var CommonExpressionsPlugin = function() {
3142
3119
  appendPathSegments(getValueForNode(resolvedNode));
3143
3120
  break;
3144
3121
  case "Value":
3145
- appendPathSegments(resolvedNode.value);
3122
+ appendPathSegments(typeof resolvedNode.value === "boolean" ? String(resolvedNode.value) : resolvedNode.value);
3146
3123
  break;
3147
3124
  case "Query":
3148
3125
  {
@@ -3218,7 +3195,7 @@ var CommonExpressionsPlugin = function() {
3218
3195
  var _this_parseCache_path;
3219
3196
  var ast = (_this_parseCache_path = this.parseCache[path]) !== null && _this_parseCache_path !== void 0 ? _this_parseCache_path : parse(path);
3220
3197
  this.parseCache[path] = ast;
3221
- if (typeof ast !== "object" || !(ast === null || ast === void 0 ? void 0 : ast.status)) {
3198
+ if ((typeof ast === "undefined" ? "undefined" : _type_of(ast)) !== "object" || !(ast === null || ast === void 0 ? void 0 : ast.status)) {
3222
3199
  var _ast_error;
3223
3200
  throw new TypeError('Cannot normalize path "'.concat(path, '": ').concat((_ast_error = ast === null || ast === void 0 ? void 0 : ast.error) !== null && _ast_error !== void 0 ? _ast_error : "Unknown Error."));
3224
3201
  }
@@ -3418,14 +3395,13 @@ var CommonExpressionsPlugin = function() {
3418
3395
  }();
3419
3396
  var DependencyModel = /*#__PURE__*/ function(DependencyTracker) {
3420
3397
  _inherits(DependencyModel, DependencyTracker);
3421
- var _super = _create_super(DependencyModel);
3422
3398
  function DependencyModel(rootModel) {
3423
3399
  _class_call_check(this, DependencyModel);
3424
3400
  var _this;
3425
- _this = _super.call(this);
3401
+ _this = _call_super(this, DependencyModel);
3426
3402
  _this.rootModel = rootModel;
3427
- _this.set = _this.set.bind(_assert_this_initialized(_this));
3428
- _this.get = _this.get.bind(_assert_this_initialized(_this));
3403
+ _this.set = _this.set.bind(_this);
3404
+ _this.get = _this.get.bind(_this);
3429
3405
  return _this;
3430
3406
  }
3431
3407
  _create_class(DependencyModel, [
@@ -3969,23 +3945,20 @@ var CommonExpressionsPlugin = function() {
3969
3945
  * @experimental These Player APIs are in active development and may change. Use with caution
3970
3946
  */ key: "evaluateAsync",
3971
3947
  value: function evaluateAsync(expr, options) {
3948
+ var _this = this;
3972
3949
  if (Array.isArray(expr)) {
3973
- var _this = this;
3974
- return collateAwaitable(expr.map(function() {
3975
- var _ref = _async_to_generator(function(exp) {
3950
+ return collateAwaitable(expr.map(function(exp) {
3951
+ return _async_to_generator(function() {
3976
3952
  return _ts_generator(this, function(_state) {
3977
3953
  return [
3978
3954
  2,
3979
- _this.evaluate(exp, _object_spread_props(_object_spread({}, options), {
3955
+ this.evaluate(exp, _object_spread_props(_object_spread({}, options), {
3980
3956
  async: true
3981
3957
  }))
3982
3958
  ];
3983
3959
  });
3984
- });
3985
- return function(exp) {
3986
- return _ref.apply(this, arguments);
3987
- };
3988
- }())).awaitableThen(function(values) {
3960
+ }).call(_this);
3961
+ })).awaitableThen(function(values) {
3989
3962
  return values.pop();
3990
3963
  });
3991
3964
  } else {
@@ -4709,23 +4682,8 @@ var CommonExpressionsPlugin = function() {
4709
4682
  function Parser() {
4710
4683
  _class_call_check(this, Parser);
4711
4684
  this.hooks = {
4712
- /**
4713
- * A hook to interact with an object _before_ parsing it into an AST
4714
- *
4715
- * @param value - The object we're are about to parse
4716
- * @returns - A new value to parse.
4717
- * If undefined, the original value is used.
4718
- * If null, we stop parsing this node.
4719
- */ onParseObject: new SyncWaterfallHook(),
4720
- /**
4721
- * A callback to interact with an AST _after_ we parse it into the AST
4722
- *
4723
- * @param value - The object we parsed
4724
- * @param node - The AST node we generated
4725
- * @returns - A new AST node to use
4726
- * If undefined, the original value is used.
4727
- * If null, we ignore this node all together
4728
- */ onCreateASTNode: new SyncWaterfallHook(),
4685
+ onParseObject: new SyncWaterfallHook(),
4686
+ onCreateASTNode: new SyncWaterfallHook(),
4729
4687
  parseNode: new SyncBailHook()
4730
4688
  };
4731
4689
  }
@@ -4763,7 +4721,7 @@ var CommonExpressionsPlugin = function() {
4763
4721
  }
4764
4722
  var parseLocalObject = function(currentValue, objToParse) {
4765
4723
  var path = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
4766
- if (typeof objToParse !== "object" || objToParse === null) {
4724
+ if ((typeof objToParse === "undefined" ? "undefined" : _type_of(objToParse)) !== "object" || objToParse === null) {
4767
4725
  return {
4768
4726
  value: objToParse,
4769
4727
  children: []
@@ -4800,7 +4758,7 @@ var CommonExpressionsPlugin = function() {
4800
4758
  if (newChildren) {
4801
4759
  var _children2;
4802
4760
  (_children2 = children2).push.apply(_children2, _to_consumable_array(newChildren));
4803
- } else if (localValue && typeof localValue === "object") {
4761
+ } else if (localValue && (typeof localValue === "undefined" ? "undefined" : _type_of(localValue)) === "object") {
4804
4762
  var _children21;
4805
4763
  var result = parseLocalObject(accumulation.value, localValue, _to_consumable_array(path).concat([
4806
4764
  localKey
@@ -4867,20 +4825,14 @@ var CommonExpressionsPlugin = function() {
4867
4825
  function Resolver(root, options) {
4868
4826
  _class_call_check(this, Resolver);
4869
4827
  this.hooks = {
4870
- /** A hook to allow skipping of the resolution tree for a specific node */ skipResolve: new SyncWaterfallHook(),
4871
- /** An event emitted before calculating the next update */ beforeUpdate: new SyncHook(),
4872
- /** An event emitted after calculating the next update */ afterUpdate: new SyncHook(),
4873
- /** The options passed to a node to resolve it to an object */ resolveOptions: new SyncWaterfallHook(),
4874
- /** A hook to transform the AST node into a new AST node before resolving it */ beforeResolve: new SyncWaterfallHook(),
4875
- /**
4876
- * A hook to transform an AST node into it's resolved value.
4877
- * This runs _before_ any children are resolved
4878
- */ resolve: new SyncWaterfallHook(),
4879
- /**
4880
- * A hook to transform the resolved value of an AST node.
4881
- * This runs _after_ all children nodes are resolved
4882
- */ afterResolve: new SyncWaterfallHook(),
4883
- /** Called at the very end of a node's tree being updated */ afterNodeUpdate: new SyncHook()
4828
+ skipResolve: new SyncWaterfallHook(),
4829
+ beforeUpdate: new SyncHook(),
4830
+ afterUpdate: new SyncHook(),
4831
+ resolveOptions: new SyncWaterfallHook(),
4832
+ beforeResolve: new SyncWaterfallHook(),
4833
+ resolve: new SyncWaterfallHook(),
4834
+ afterResolve: new SyncWaterfallHook(),
4835
+ afterNodeUpdate: new SyncHook()
4884
4836
  };
4885
4837
  this.root = root;
4886
4838
  this.options = options;
@@ -4888,6 +4840,7 @@ var CommonExpressionsPlugin = function() {
4888
4840
  this.ASTMap = /* @__PURE__ */ new Map();
4889
4841
  this.logger = options.logger;
4890
4842
  this.idCache = /* @__PURE__ */ new Set();
4843
+ this.AsyncIdMap = /* @__PURE__ */ new Map();
4891
4844
  }
4892
4845
  _create_class(Resolver, [
4893
4846
  {
@@ -4898,13 +4851,27 @@ var CommonExpressionsPlugin = function() {
4898
4851
  },
4899
4852
  {
4900
4853
  key: "update",
4901
- value: function update(changes) {
4854
+ value: function update(changes, asyncChanges) {
4855
+ var _this = this;
4902
4856
  this.hooks.beforeUpdate.call(changes);
4903
4857
  var resolveCache = /* @__PURE__ */ new Map();
4904
4858
  this.idCache.clear();
4905
4859
  var prevASTMap = new Map(this.ASTMap);
4906
4860
  this.ASTMap.clear();
4907
- var updated = this.computeTree(this.root, void 0, changes, resolveCache, toNodeResolveOptions(this.options), void 0, prevASTMap);
4861
+ var prevAsyncIdMap = new Map(this.AsyncIdMap);
4862
+ var nextAsyncIdMap = /* @__PURE__ */ new Map();
4863
+ asyncChanges === null || asyncChanges === void 0 ? void 0 : asyncChanges.forEach(function(id) {
4864
+ var current = prevAsyncIdMap.get(id);
4865
+ while(current && prevASTMap.has(current)){
4866
+ var next = prevASTMap.get(current);
4867
+ if (next && _this.resolveCache.has(next)) {
4868
+ _this.resolveCache.delete(next);
4869
+ }
4870
+ current = current.parent;
4871
+ }
4872
+ });
4873
+ var updated = this.computeTree(this.root, void 0, changes, resolveCache, toNodeResolveOptions(this.options), void 0, prevASTMap, nextAsyncIdMap);
4874
+ this.AsyncIdMap = nextAsyncIdMap;
4908
4875
  this.resolveCache = resolveCache;
4909
4876
  this.hooks.afterUpdate.call(updated.value);
4910
4877
  return updated.value;
@@ -4949,7 +4916,7 @@ var CommonExpressionsPlugin = function() {
4949
4916
  Object.keys(clonedNode).forEach(function(key) {
4950
4917
  if (key === "parent") return;
4951
4918
  var value = clonedNode[key];
4952
- if (typeof value === "object" && value !== null) {
4919
+ if ((typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" && value !== null) {
4953
4920
  clonedNode[key] = Array.isArray(value) ? _to_consumable_array(value) : _object_spread({}, value);
4954
4921
  }
4955
4922
  });
@@ -4958,9 +4925,8 @@ var CommonExpressionsPlugin = function() {
4958
4925
  },
4959
4926
  {
4960
4927
  key: "computeTree",
4961
- value: function computeTree(node, rawParent, dataChanges, cacheUpdate, options, partiallyResolvedParent, prevASTMap) {
4928
+ value: function computeTree(node, rawParent, dataChanges, cacheUpdate, options, partiallyResolvedParent, prevASTMap, nextAsyncIdMap) {
4962
4929
  var _this = this;
4963
- var _partiallyResolvedParent_parent_parent, _partiallyResolvedParent_parent, _resolvedAST_parent, _partiallyResolvedParent_parent1;
4964
4930
  var dependencyModel = new DependencyModel(options.data.model);
4965
4931
  dependencyModel.trackSubset("core");
4966
4932
  var depModelWithParser = withContext(withParser(dependencyModel, this.options.parseBinding));
@@ -4979,15 +4945,6 @@ var CommonExpressionsPlugin = function() {
4979
4945
  var previousDeps = previousResult === null || previousResult === void 0 ? void 0 : previousResult.dependencies;
4980
4946
  var dataChanged = caresAboutDataChanges(dataChanges, previousDeps);
4981
4947
  var shouldUseLastValue = this.hooks.skipResolve.call(!dataChanged, node, resolveOptions);
4982
- var clonedNode = _object_spread_props(_object_spread({}, this.cloneNode(node)), {
4983
- parent: partiallyResolvedParent
4984
- });
4985
- var _this_hooks_beforeResolve_call;
4986
- var resolvedAST = (_this_hooks_beforeResolve_call = this.hooks.beforeResolve.call(clonedNode, resolveOptions)) !== null && _this_hooks_beforeResolve_call !== void 0 ? _this_hooks_beforeResolve_call : {
4987
- type: "empty"
4988
- };
4989
- var isNestedMultiNodeWithAsync = resolvedAST.type === "multi-node" && (partiallyResolvedParent === null || partiallyResolvedParent === void 0 ? void 0 : (_partiallyResolvedParent_parent = partiallyResolvedParent.parent) === null || _partiallyResolvedParent_parent === void 0 ? void 0 : (_partiallyResolvedParent_parent_parent = _partiallyResolvedParent_parent.parent) === null || _partiallyResolvedParent_parent_parent === void 0 ? void 0 : _partiallyResolvedParent_parent_parent.type) === "multi-node" && partiallyResolvedParent.parent.type === "value" && ((_resolvedAST_parent = resolvedAST.parent) === null || _resolvedAST_parent === void 0 ? void 0 : _resolvedAST_parent.type) === "asset" && resolvedAST.parent.value.id.includes("async");
4990
- var isNestedMultiNode = resolvedAST.type === "multi-node" && (partiallyResolvedParent === null || partiallyResolvedParent === void 0 ? void 0 : (_partiallyResolvedParent_parent1 = partiallyResolvedParent.parent) === null || _partiallyResolvedParent_parent1 === void 0 ? void 0 : _partiallyResolvedParent_parent1.type) === "multi-node" && partiallyResolvedParent.type === "value";
4991
4948
  if (previousResult && shouldUseLastValue) {
4992
4949
  var update2 = _object_spread_props(_object_spread({}, previousResult), {
4993
4950
  updated: false
@@ -4999,6 +4956,30 @@ var CommonExpressionsPlugin = function() {
4999
4956
  updated: false
5000
4957
  });
5001
4958
  cacheUpdate.set(AST, resolvedUpdate);
4959
+ if (resolvedUpdate.node.type === "async") {
4960
+ nextAsyncIdMap.set(resolvedUpdate.node.id, resolvedUpdate.node);
4961
+ }
4962
+ var _resolvedUpdate_node_asyncNodesResolved;
4963
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
4964
+ try {
4965
+ for(var _iterator = ((_resolvedUpdate_node_asyncNodesResolved = resolvedUpdate.node.asyncNodesResolved) !== null && _resolvedUpdate_node_asyncNodesResolved !== void 0 ? _resolvedUpdate_node_asyncNodesResolved : [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
4966
+ var key = _step.value;
4967
+ nextAsyncIdMap.set(key, resolvedUpdate.node);
4968
+ }
4969
+ } catch (err) {
4970
+ _didIteratorError = true;
4971
+ _iteratorError = err;
4972
+ } finally{
4973
+ try {
4974
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
4975
+ _iterator.return();
4976
+ }
4977
+ } finally{
4978
+ if (_didIteratorError) {
4979
+ throw _iteratorError;
4980
+ }
4981
+ }
4982
+ }
5002
4983
  var handleChildNode = function(childNode) {
5003
4984
  var _prevASTMap_get;
5004
4985
  var originalChildNode = (_prevASTMap_get = prevASTMap.get(childNode)) !== null && _prevASTMap_get !== void 0 ? _prevASTMap_get : childNode;
@@ -5021,10 +5002,37 @@ var CommonExpressionsPlugin = function() {
5021
5002
  repopulateASTMapFromCache(previousResult, node, rawParent);
5022
5003
  return update2;
5023
5004
  }
5024
- if (isNestedMultiNodeWithAsync) {
5025
- resolvedAST.parent = partiallyResolvedParent.parent;
5026
- } else {
5027
- resolvedAST.parent = partiallyResolvedParent;
5005
+ var clonedNode = _object_spread_props(_object_spread({}, this.cloneNode(node)), {
5006
+ parent: partiallyResolvedParent
5007
+ });
5008
+ var _this_hooks_beforeResolve_call;
5009
+ var resolvedAST = (_this_hooks_beforeResolve_call = this.hooks.beforeResolve.call(clonedNode, resolveOptions)) !== null && _this_hooks_beforeResolve_call !== void 0 ? _this_hooks_beforeResolve_call : {
5010
+ type: "empty"
5011
+ };
5012
+ resolvedAST.parent = partiallyResolvedParent;
5013
+ if (resolvedAST.type === "async") {
5014
+ nextAsyncIdMap.set(resolvedAST.id, resolvedAST);
5015
+ }
5016
+ var _resolvedAST_asyncNodesResolved;
5017
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
5018
+ try {
5019
+ for(var _iterator = ((_resolvedAST_asyncNodesResolved = resolvedAST.asyncNodesResolved) !== null && _resolvedAST_asyncNodesResolved !== void 0 ? _resolvedAST_asyncNodesResolved : [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
5020
+ var id = _step.value;
5021
+ nextAsyncIdMap.set(id, resolvedAST);
5022
+ }
5023
+ } catch (err) {
5024
+ _didIteratorError = true;
5025
+ _iteratorError = err;
5026
+ } finally{
5027
+ try {
5028
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
5029
+ _iterator.return();
5030
+ }
5031
+ } finally{
5032
+ if (_didIteratorError) {
5033
+ throw _iteratorError;
5034
+ }
5035
+ }
5028
5036
  }
5029
5037
  resolveOptions.node = resolvedAST;
5030
5038
  this.ASTMap.set(resolvedAST, node);
@@ -5038,7 +5046,7 @@ var CommonExpressionsPlugin = function() {
5038
5046
  if ("children" in resolvedAST) {
5039
5047
  var _resolvedAST_children;
5040
5048
  var newChildren = (_resolvedAST_children = resolvedAST.children) === null || _resolvedAST_children === void 0 ? void 0 : _resolvedAST_children.map(function(child) {
5041
- var computedChildTree = _this.computeTree(child.value, node, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap);
5049
+ var computedChildTree = _this.computeTree(child.value, node, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap, nextAsyncIdMap);
5042
5050
  var childTreeDeps = computedChildTree.dependencies, childNode = computedChildTree.node, childUpdated = computedChildTree.updated, childValue = computedChildTree.value;
5043
5051
  childTreeDeps.forEach(function(binding) {
5044
5052
  return childDependencies.add(binding);
@@ -5059,40 +5067,18 @@ var CommonExpressionsPlugin = function() {
5059
5067
  resolvedAST.children = newChildren;
5060
5068
  } else if (resolvedAST.type === "multi-node") {
5061
5069
  var childValue = [];
5062
- var rawParentToPassIn = isNestedMultiNode ? partiallyResolvedParent === null || partiallyResolvedParent === void 0 ? void 0 : partiallyResolvedParent.parent : node;
5063
- var hasAsync = resolvedAST.values.map(function(value, index) {
5064
- return value.type === "async" ? index : -1;
5065
- }).filter(function(index) {
5066
- return index !== -1;
5067
- });
5068
- var newValues = resolvedAST.values.map(function(mValue) {
5069
- var mTree = _this.computeTree(mValue, rawParentToPassIn, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap);
5070
+ var rawParentToPassIn = node;
5071
+ resolvedAST.values = resolvedAST.values.map(function(mValue) {
5072
+ var mTree = _this.computeTree(mValue, rawParentToPassIn, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap, nextAsyncIdMap);
5070
5073
  if (mTree.value !== void 0 && mTree.value !== null) {
5071
- if (mValue.type === "async" && mValue.flatten && mTree.value.asset && Array.isArray(mTree.value.asset.values)) {
5072
- unpackAndPush(mTree.value, childValue);
5073
- } else {
5074
- childValue.push(mTree.value);
5075
- }
5074
+ mTree.dependencies.forEach(function(bindingDep) {
5075
+ return childDependencies.add(bindingDep);
5076
+ });
5077
+ updated = updated || mTree.updated;
5078
+ childValue.push(mTree.value);
5076
5079
  }
5077
- mTree.dependencies.forEach(function(bindingDep) {
5078
- return childDependencies.add(bindingDep);
5079
- });
5080
- updated = updated || mTree.updated;
5081
5080
  return mTree.node;
5082
5081
  });
5083
- if (hasAsync.length > 0) {
5084
- var copy = newValues;
5085
- hasAsync.forEach(function(index) {
5086
- var _copy;
5087
- if (copy[index]) (_copy = copy).splice.apply(_copy, [
5088
- index,
5089
- 1
5090
- ].concat(_to_consumable_array(unpackNode(copy[index]))));
5091
- });
5092
- resolvedAST.values = copy;
5093
- } else {
5094
- resolvedAST.values = newValues;
5095
- }
5096
5082
  resolved = childValue;
5097
5083
  }
5098
5084
  childDependencies.forEach(function(bindingDep) {
@@ -5113,7 +5099,7 @@ var CommonExpressionsPlugin = function() {
5113
5099
  value: resolved,
5114
5100
  dependencies: /* @__PURE__ */ new Set(_to_consumable_array(dependencyModel.getDependencies()).concat(_to_consumable_array(childDependencies)))
5115
5101
  };
5116
- this.hooks.afterNodeUpdate.call(node, isNestedMultiNode ? partiallyResolvedParent === null || partiallyResolvedParent === void 0 ? void 0 : partiallyResolvedParent.parent : rawParent, update);
5102
+ this.hooks.afterNodeUpdate.call(node, rawParent, update);
5117
5103
  cacheUpdate.set(node, update);
5118
5104
  return update;
5119
5105
  }
@@ -5121,15 +5107,6 @@ var CommonExpressionsPlugin = function() {
5121
5107
  ]);
5122
5108
  return Resolver;
5123
5109
  }();
5124
- function unpackAndPush(item, initial) {
5125
- if (item.asset.values && Array.isArray(item.asset.values)) {
5126
- item.asset.values.forEach(function(i) {
5127
- unpackAndPush(i, initial);
5128
- });
5129
- } else {
5130
- initial.push(item);
5131
- }
5132
- }
5133
5110
  var CrossfieldProvider = /*#__PURE__*/ function() {
5134
5111
  function CrossfieldProvider(initialView, parser, logger) {
5135
5112
  _class_call_check(this, CrossfieldProvider);
@@ -5197,9 +5174,11 @@ var CommonExpressionsPlugin = function() {
5197
5174
  _create_class(ViewInstance, [
5198
5175
  {
5199
5176
  key: "updateAsync",
5200
- value: function updateAsync() {
5177
+ value: function updateAsync(asyncNode) {
5201
5178
  var _this_resolver;
5202
- var update = (_this_resolver = this.resolver) === null || _this_resolver === void 0 ? void 0 : _this_resolver.update();
5179
+ var update = (_this_resolver = this.resolver) === null || _this_resolver === void 0 ? void 0 : _this_resolver.update(/* @__PURE__ */ new Set(), /* @__PURE__ */ new Set([
5180
+ asyncNode
5181
+ ]));
5203
5182
  this.lastUpdate = update;
5204
5183
  this.hooks.onUpdate.call(update);
5205
5184
  }
@@ -5289,7 +5268,7 @@ var CommonExpressionsPlugin = function() {
5289
5268
  for(var _iterator = templateSubstitutions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
5290
5269
  var _step_value = _step.value, expression = _step_value.expression, value = _step_value.value;
5291
5270
  var flags = "g";
5292
- if (typeof expression === "object") {
5271
+ if ((typeof expression === "undefined" ? "undefined" : _type_of(expression)) === "object") {
5293
5272
  flags = "".concat(expression.flags).concat(expression.global ? "" : "g");
5294
5273
  }
5295
5274
  templateStr = templateStr.replace(new RegExp(expression, flags), value);
@@ -5438,7 +5417,7 @@ var CommonExpressionsPlugin = function() {
5438
5417
  var bindingResolveLookup = createPatternMatcher("{{", "}}");
5439
5418
  var expressionResolveLookup = createPatternMatcher("@[", "]@");
5440
5419
  function resolveAllRefs(node, resolveOptions, propertiesToSkip) {
5441
- if (node === null || node === void 0 || typeof node !== "object" && typeof node !== "string") {
5420
+ if (node === null || node === void 0 || (typeof node === "undefined" ? "undefined" : _type_of(node)) !== "object" && typeof node !== "string") {
5442
5421
  return node;
5443
5422
  }
5444
5423
  if (typeof node === "string") {
@@ -5451,7 +5430,7 @@ var CommonExpressionsPlugin = function() {
5451
5430
  }
5452
5431
  var val = node[key];
5453
5432
  var newVal = val;
5454
- if (typeof val === "object") {
5433
+ if ((typeof val === "undefined" ? "undefined" : _type_of(val)) === "object") {
5455
5434
  newVal = resolveAllRefs(val, resolveOptions, propertiesToSkip);
5456
5435
  } else if (typeof val === "string") {
5457
5436
  newVal = resolveString(val, resolveOptions);
@@ -5740,7 +5719,7 @@ var CommonExpressionsPlugin = function() {
5740
5719
  key: "applyParser",
5741
5720
  value: function applyParser(parser) {
5742
5721
  parser.hooks.parseNode.tap("multi-node", function(obj, nodeType, options, childOptions) {
5743
- if (childOptions && !hasTemplateKey(childOptions.key) && Array.isArray(obj)) {
5722
+ if ((childOptions === void 0 || !hasTemplateKey(childOptions.key)) && Array.isArray(obj)) {
5744
5723
  var values = obj.map(function(childVal) {
5745
5724
  return parser.parseObject(childVal, "value", options);
5746
5725
  }).filter(function(child) {
@@ -5751,7 +5730,7 @@ var CommonExpressionsPlugin = function() {
5751
5730
  }
5752
5731
  var multiNode = parser.createASTNode({
5753
5732
  type: "multi-node",
5754
- override: !hasTemplateValues(childOptions.parentObj, childOptions.key),
5733
+ override: childOptions !== void 0 && !hasTemplateValues(childOptions.parentObj, childOptions.key),
5755
5734
  values: values
5756
5735
  }, obj);
5757
5736
  if (!multiNode) {
@@ -5762,7 +5741,7 @@ var CommonExpressionsPlugin = function() {
5762
5741
  v.parent = multiNode;
5763
5742
  });
5764
5743
  }
5765
- return [
5744
+ return childOptions === void 0 ? multiNode : [
5766
5745
  {
5767
5746
  path: _to_consumable_array(childOptions.path).concat([
5768
5747
  childOptions.key
@@ -5792,7 +5771,7 @@ var CommonExpressionsPlugin = function() {
5792
5771
  key: "applyParser",
5793
5772
  value: function applyParser(parser) {
5794
5773
  parser.hooks.parseNode.tap("asset", function(obj, nodeType, options, childOptions) {
5795
- if ((childOptions === null || childOptions === void 0 ? void 0 : childOptions.key) === "asset" && typeof obj === "object") {
5774
+ if ((childOptions === null || childOptions === void 0 ? void 0 : childOptions.key) === "asset" && (typeof obj === "undefined" ? "undefined" : _type_of(obj)) === "object") {
5796
5775
  var assetAST = parser.parseObject(obj, "asset", options);
5797
5776
  if (!assetAST) {
5798
5777
  return [];
@@ -5992,6 +5971,7 @@ var CommonExpressionsPlugin = function() {
5992
5971
  }();
5993
5972
  var FlowInstance = /*#__PURE__*/ function() {
5994
5973
  function FlowInstance(id, flow, options) {
5974
+ var _this = this;
5995
5975
  _class_call_check(this, FlowInstance);
5996
5976
  this.isTransitioning = false;
5997
5977
  this.hooks = {
@@ -6008,60 +5988,55 @@ var CommonExpressionsPlugin = function() {
6008
5988
  this.flow = flow;
6009
5989
  this.log = options === null || options === void 0 ? void 0 : options.logger;
6010
5990
  this.history = [];
6011
- var _this = this;
6012
- this.hooks.transition.tap("startPromise", function() {
6013
- var _ref = _async_to_generator(function(_oldState, nextState) {
5991
+ this.hooks.transition.tap("startPromise", function(_oldState, nextState) {
5992
+ return _async_to_generator(function() {
6014
5993
  var newState;
6015
5994
  return _ts_generator(this, function(_state) {
6016
5995
  newState = nextState.value;
6017
- if (_this.flowPromise && newState.state_type === "END") {
6018
- _this.flowPromise.resolve(newState);
5996
+ if (this.flowPromise && newState.state_type === "END") {
5997
+ this.flowPromise.resolve(newState);
6019
5998
  }
6020
5999
  return [
6021
6000
  2
6022
6001
  ];
6023
6002
  });
6024
- });
6025
- return function(_oldState, nextState) {
6026
- return _ref.apply(this, arguments);
6027
- };
6028
- }());
6003
+ }).call(_this);
6004
+ });
6029
6005
  }
6030
6006
  _create_class(FlowInstance, [
6031
6007
  {
6032
6008
  key: "start",
6033
6009
  value: /** Start the state machine */ function start() {
6034
- var _this = this;
6035
6010
  return _async_to_generator(function() {
6036
6011
  var _this_log, initialState;
6037
6012
  return _ts_generator(this, function(_state) {
6038
- if (_this.flowPromise) {
6013
+ if (this.flowPromise) {
6039
6014
  ;
6040
- (_this_log = _this.log) === null || _this_log === void 0 ? void 0 : _this_log.warn("Already called start for flow");
6015
+ (_this_log = this.log) === null || _this_log === void 0 ? void 0 : _this_log.warn("Already called start for flow");
6041
6016
  return [
6042
6017
  2,
6043
- _this.flowPromise.promise
6018
+ this.flowPromise.promise
6044
6019
  ];
6045
6020
  }
6046
- _this.flow = _this.hooks.beforeStart.call(_this.flow) || _this.flow;
6047
- if (_this.flow.onStart) {
6048
- _this.hooks.onStart.call(_this.flow.onStart);
6021
+ this.flow = this.hooks.beforeStart.call(this.flow) || this.flow;
6022
+ if (this.flow.onStart) {
6023
+ this.hooks.onStart.call(this.flow.onStart);
6049
6024
  }
6050
- initialState = _this.flow.startState;
6025
+ initialState = this.flow.startState;
6051
6026
  if (!initialState) {
6052
6027
  return [
6053
6028
  2,
6054
6029
  Promise.reject(new Error("No 'startState' defined for flow"))
6055
6030
  ];
6056
6031
  }
6057
- _this.flowPromise = (0, import_p_defer2.default)();
6058
- _this.pushHistory(initialState);
6032
+ this.flowPromise = (0, import_p_defer2.default)();
6033
+ this.pushHistory(initialState);
6059
6034
  return [
6060
6035
  2,
6061
- _this.flowPromise.promise
6036
+ this.flowPromise.promise
6062
6037
  ];
6063
6038
  });
6064
- })();
6039
+ }).call(this);
6065
6040
  }
6066
6041
  },
6067
6042
  {
@@ -6113,7 +6088,7 @@ var CommonExpressionsPlugin = function() {
6113
6088
  throw new Error("No flow definition for: ".concat(stateName, " was found."));
6114
6089
  }
6115
6090
  var nextState = this.flow[stateName];
6116
- if (!this.flow[stateName] || typeof nextState !== "object" || !("state_type" in nextState)) {
6091
+ if (!this.flow[stateName] || (typeof nextState === "undefined" ? "undefined" : _type_of(nextState)) !== "object" || !("state_type" in nextState)) {
6117
6092
  var _this_log;
6118
6093
  (_this_log = this.log) === null || _this_log === void 0 ? void 0 : _this_log.error("Flow doesn't contain any states named: ".concat(stateName));
6119
6094
  return;
@@ -6173,30 +6148,30 @@ var CommonExpressionsPlugin = function() {
6173
6148
  {
6174
6149
  key: "run",
6175
6150
  value: function run(startState) {
6176
- var _this = this;
6177
6151
  return _async_to_generator(function() {
6178
- var _this_log, startFlow, flow, end, firstItem;
6152
+ var _this, _this_log, startFlow, flow, end, firstItem;
6179
6153
  return _ts_generator(this, function(_state) {
6180
6154
  switch(_state.label){
6181
6155
  case 0:
6182
- if (!Object.prototype.hasOwnProperty.call(_this.navigation, startState)) {
6156
+ _this = this;
6157
+ if (!Object.prototype.hasOwnProperty.call(this.navigation, startState)) {
6183
6158
  return [
6184
6159
  2,
6185
6160
  Promise.reject(new Error("No flow defined for: ".concat(startState)))
6186
6161
  ];
6187
6162
  }
6188
- startFlow = _this.navigation[startState];
6189
- if (startFlow === null || typeof startFlow !== "object") {
6163
+ startFlow = this.navigation[startState];
6164
+ if (startFlow === null || (typeof startFlow === "undefined" ? "undefined" : _type_of(startFlow)) !== "object") {
6190
6165
  return [
6191
6166
  2,
6192
6167
  Promise.reject(new Error("Flow: ".concat(startState, " needs to be an object")))
6193
6168
  ];
6194
6169
  }
6195
- (_this_log = _this.log) === null || _this_log === void 0 ? void 0 : _this_log.debug("Starting flow: ".concat(startState));
6170
+ (_this_log = this.log) === null || _this_log === void 0 ? void 0 : _this_log.debug("Starting flow: ".concat(startState));
6196
6171
  flow = new FlowInstance(startState, startFlow, {
6197
- logger: _this.log
6172
+ logger: this.log
6198
6173
  });
6199
- _this.addNewFlow(flow);
6174
+ this.addNewFlow(flow);
6200
6175
  flow.hooks.afterTransition.tap("flow-controller", function(flowInstance) {
6201
6176
  var _flowInstance_currentState;
6202
6177
  if (((_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value.state_type) === "FLOW") {
@@ -6216,10 +6191,10 @@ var CommonExpressionsPlugin = function() {
6216
6191
  ];
6217
6192
  case 1:
6218
6193
  end = _state.sent();
6219
- _this.navStack.pop();
6220
- if (_this.navStack.length > 0) {
6194
+ this.navStack.pop();
6195
+ if (this.navStack.length > 0) {
6221
6196
  firstItem = 0;
6222
- _this.current = _this.navStack[firstItem];
6197
+ this.current = this.navStack[firstItem];
6223
6198
  }
6224
6199
  return [
6225
6200
  2,
@@ -6227,16 +6202,15 @@ var CommonExpressionsPlugin = function() {
6227
6202
  ];
6228
6203
  }
6229
6204
  });
6230
- })();
6205
+ }).call(this);
6231
6206
  }
6232
6207
  },
6233
6208
  {
6234
6209
  key: "start",
6235
6210
  value: function start() {
6236
- var _this = this;
6237
6211
  return _async_to_generator(function() {
6238
6212
  return _ts_generator(this, function(_state) {
6239
- if (!_this.navigation.BEGIN) {
6213
+ if (!this.navigation.BEGIN) {
6240
6214
  return [
6241
6215
  2,
6242
6216
  Promise.reject(new Error("Must supply a BEGIN state"))
@@ -6244,10 +6218,10 @@ var CommonExpressionsPlugin = function() {
6244
6218
  }
6245
6219
  return [
6246
6220
  2,
6247
- _this.run(_this.navigation.BEGIN)
6221
+ this.run(this.navigation.BEGIN)
6248
6222
  ];
6249
6223
  });
6250
- })();
6224
+ }).call(this);
6251
6225
  }
6252
6226
  }
6253
6227
  ]);
@@ -7354,7 +7328,7 @@ var CommonExpressionsPlugin = function() {
7354
7328
  var parentBinding = resolved.parent();
7355
7329
  var property = resolved.key();
7356
7330
  var parentValue = this.get(parentBinding);
7357
- var existedBeforeDelete = typeof parentValue === "object" && parentValue !== null && Object.prototype.hasOwnProperty.call(parentValue, property);
7331
+ var existedBeforeDelete = (typeof parentValue === "undefined" ? "undefined" : _type_of(parentValue)) === "object" && parentValue !== null && Object.prototype.hasOwnProperty.call(parentValue, property);
7358
7332
  this.getModel().delete(resolved, options);
7359
7333
  if (existedBeforeDelete && !this.get(resolved)) {
7360
7334
  this.trash.add(resolved);
@@ -7455,7 +7429,7 @@ var CommonExpressionsPlugin = function() {
7455
7429
  var expressionEvaluator;
7456
7430
  var handleEval = function(exp) {
7457
7431
  if (exp) {
7458
- if (typeof exp === "object" && "exp" in exp) {
7432
+ if ((typeof exp === "undefined" ? "undefined" : _type_of(exp)) === "object" && "exp" in exp) {
7459
7433
  expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(exp.exp);
7460
7434
  } else {
7461
7435
  expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(exp);
@@ -7716,7 +7690,7 @@ var CommonExpressionsPlugin = function() {
7716
7690
  flow.hooks.beforeTransition.tap("player", function(state, transitionVal) {
7717
7691
  var computedTransitionVal = state.transitions[transitionVal] ? transitionVal : "*";
7718
7692
  if (state.onEnd && state.transitions[computedTransitionVal]) {
7719
- if (typeof state.onEnd === "object" && "exp" in state.onEnd) {
7693
+ if (_type_of(state.onEnd) === "object" && "exp" in state.onEnd) {
7720
7694
  expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(state.onEnd.exp);
7721
7695
  } else {
7722
7696
  expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(state.onEnd);
@@ -7875,12 +7849,12 @@ var CommonExpressionsPlugin = function() {
7875
7849
  {
7876
7850
  key: "start",
7877
7851
  value: function start(payload) {
7878
- var _this = this;
7879
7852
  return _async_to_generator(function() {
7880
- var _payload_id, ref, maybeUpdateState, _this_setupFlow, state, start, endProps, _tmp, error, errorState;
7853
+ var _this, _payload_id, ref, maybeUpdateState, _this_setupFlow, state, start, endProps, _tmp, error, errorState;
7881
7854
  return _ts_generator(this, function(_state) {
7882
7855
  switch(_state.label){
7883
7856
  case 0:
7857
+ _this = this;
7884
7858
  ref = Symbol((_payload_id = payload === null || payload === void 0 ? void 0 : payload.id) !== null && _payload_id !== void 0 ? _payload_id : "payload");
7885
7859
  maybeUpdateState = function(newState) {
7886
7860
  if (_this.state.ref !== ref) {
@@ -7890,7 +7864,7 @@ var CommonExpressionsPlugin = function() {
7890
7864
  _this.setState(newState);
7891
7865
  return newState;
7892
7866
  };
7893
- _this.setState({
7867
+ this.setState({
7894
7868
  status: "not-started",
7895
7869
  ref: ref
7896
7870
  });
@@ -7902,8 +7876,8 @@ var CommonExpressionsPlugin = function() {
7902
7876
  ,
7903
7877
  4
7904
7878
  ]);
7905
- _this_setupFlow = _this.setupFlow(payload), state = _this_setupFlow.state, start = _this_setupFlow.start;
7906
- _this.setState(_object_spread({
7879
+ _this_setupFlow = this.setupFlow(payload), state = _this_setupFlow.state, start = _this_setupFlow.start;
7880
+ this.setState(_object_spread({
7907
7881
  ref: ref
7908
7882
  }, state));
7909
7883
  start();
@@ -7948,7 +7922,7 @@ var CommonExpressionsPlugin = function() {
7948
7922
  ];
7949
7923
  }
7950
7924
  });
7951
- })();
7925
+ }).call(this);
7952
7926
  }
7953
7927
  }
7954
7928
  ]);
@@ -7962,7 +7936,7 @@ var CommonExpressionsPlugin = function() {
7962
7936
  if (typeof val === "string") {
7963
7937
  return val.length;
7964
7938
  }
7965
- if (typeof val === "object" && val !== null) {
7939
+ if ((typeof val === "undefined" ? "undefined" : _type_of(val)) === "object" && val !== null) {
7966
7940
  return Object.keys(val).length;
7967
7941
  }
7968
7942
  return 0;
@@ -7972,7 +7946,7 @@ var CommonExpressionsPlugin = function() {
7972
7946
  if (val === void 0 || val === null) {
7973
7947
  return true;
7974
7948
  }
7975
- if (typeof val === "object" || typeof val === "string") {
7949
+ if ((typeof val === "undefined" ? "undefined" : _type_of(val)) === "object" || typeof val === "string") {
7976
7950
  return size(ctx, val) === 0;
7977
7951
  }
7978
7952
  return false;
@@ -8081,7 +8055,7 @@ var CommonExpressionsPlugin = function() {
8081
8055
  return -1;
8082
8056
  }
8083
8057
  return searchArray.findIndex(function(value) {
8084
- var propVal = typeof value === "object" && propToCheck !== void 0 ? value[propToCheck] : value;
8058
+ var propVal = (typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" && propToCheck !== void 0 ? value[propToCheck] : value;
8085
8059
  return valueToCheck === propVal;
8086
8060
  });
8087
8061
  };
@@ -8091,13 +8065,13 @@ var CommonExpressionsPlugin = function() {
8091
8065
  return defaultValue;
8092
8066
  }
8093
8067
  var foundValue = searchArray.find(function(value) {
8094
- var propVal = typeof value === "object" && propToCheck !== void 0 ? value[propToCheck] : value;
8068
+ var propVal = (typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" && propToCheck !== void 0 ? value[propToCheck] : value;
8095
8069
  return valueToCheck === propVal;
8096
8070
  });
8097
8071
  if (foundValue === void 0) {
8098
8072
  return defaultValue;
8099
8073
  }
8100
- if (typeof foundValue === "object" && propToReturn) {
8074
+ if ((typeof foundValue === "undefined" ? "undefined" : _type_of(foundValue)) === "object" && propToReturn) {
8101
8075
  var _foundValue_propToReturn;
8102
8076
  return (_foundValue_propToReturn = foundValue[propToReturn]) !== null && _foundValue_propToReturn !== void 0 ? _foundValue_propToReturn : defaultValue;
8103
8077
  }