@player-ui/player 0.14.0-next.0 → 0.14.0-next.2

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,
@@ -441,7 +425,7 @@ var Player = function() {
441
425
  };
442
426
  var findInArray = function findInArray(array, key, value) {
443
427
  return array.findIndex(function(obj) {
444
- if (obj && typeof obj === "object") {
428
+ if (obj && (typeof obj === "undefined" ? "undefined" : _type_of(obj)) === "object") {
445
429
  return obj[key] == value;
446
430
  }
447
431
  return false;
@@ -540,7 +524,7 @@ var Player = function() {
540
524
  return t2 === r ? l : t2;
541
525
  };
542
526
  var isExpressionNode = function isExpressionNode(x) {
543
- return typeof x === "object" && x !== null && !Array.isArray(x) && x.__id === ExpNodeOpaqueIdentifier;
527
+ return (typeof x === "undefined" ? "undefined" : _type_of(x)) === "object" && x !== null && !Array.isArray(x) && x.__id === ExpNodeOpaqueIdentifier;
544
528
  };
545
529
  var throwError = function throwError(message, index) {
546
530
  var err = new Error("".concat(message, " at character ").concat(index));
@@ -1129,7 +1113,7 @@ var Player = function() {
1129
1113
  function isPromiseLike(value) {
1130
1114
  var // Check for standard Promise constructor name
1131
1115
  _value_constructor;
1132
- return value != null && typeof value === "object" && typeof value.then === "function" && // Additional safeguards against false positives
1116
+ return value != null && (typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" && typeof value.then === "function" && // Additional safeguards against false positives
1133
1117
  (_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
1134
1118
  typeof value.catch === "function" && typeof value.finally === "function");
1135
1119
  };
@@ -1156,7 +1140,7 @@ var Player = function() {
1156
1140
  if (isExpressionNode(expr)) {
1157
1141
  return false;
1158
1142
  }
1159
- return typeof expr === "object" && expr !== null && !Array.isArray(expr) && "value" in expr;
1143
+ return (typeof expr === "undefined" ? "undefined" : _type_of(expr)) === "object" && expr !== null && !Array.isArray(expr) && "value" in expr;
1160
1144
  };
1161
1145
  var isErrorWithLocation = function isErrorWithLocation(error) {
1162
1146
  return error.index !== void 0 && error.description !== void 0;
@@ -1400,7 +1384,7 @@ var Player = function() {
1400
1384
  if (!node) {
1401
1385
  return;
1402
1386
  }
1403
- if ("value" in node && typeof node.value === "object" && typeof ((_node_value = node.value) === null || _node_value === void 0 ? void 0 : _node_value.id) === "string") {
1387
+ 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") {
1404
1388
  return node.value.id;
1405
1389
  }
1406
1390
  };
@@ -1551,7 +1535,7 @@ var Player = function() {
1551
1535
  });
1552
1536
  };
1553
1537
  var __copyProps = function(to, from, except, desc) {
1554
- if (from && typeof from === "object" || typeof from === "function") {
1538
+ if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
1555
1539
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1556
1540
  try {
1557
1541
  var _loop = function() {
@@ -1606,15 +1590,16 @@ var Player = function() {
1606
1590
  exports.toError = exports.NestedError = void 0;
1607
1591
  var NestedError4 = /*#__PURE__*/ function(Error1) {
1608
1592
  _inherits(_NestedError, Error1);
1609
- var _super = _create_super(_NestedError);
1610
1593
  function _NestedError(message) {
1611
1594
  for(var _len = arguments.length, innerErrors = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
1612
1595
  innerErrors[_key - 1] = arguments[_key];
1613
1596
  }
1614
1597
  _class_call_check(this, _NestedError);
1615
1598
  var _this;
1616
- _this = _super.call(this, message);
1617
- var thisErrorReport = _NestedError.getErrorReport(_assert_this_initialized(_this));
1599
+ _this = _call_super(this, _NestedError, [
1600
+ message
1601
+ ]);
1602
+ var thisErrorReport = _NestedError.getErrorReport(_this);
1618
1603
  if (innerErrors.length === 1) {
1619
1604
  var innerError = toError(innerErrors[0]);
1620
1605
  _this.innerErrors = [
@@ -1750,7 +1735,7 @@ var Player = function() {
1750
1735
  return out;
1751
1736
  }
1752
1737
  function isObject(o) {
1753
- return o != null && typeof o === "object";
1738
+ return o != null && (typeof o === "undefined" ? "undefined" : _type_of(o)) === "object";
1754
1739
  }
1755
1740
  function addLast2(array, val) {
1756
1741
  if (Array.isArray(val)) return array.concat(val);
@@ -2093,7 +2078,7 @@ var Player = function() {
2093
2078
  else return 0;
2094
2079
  }
2095
2080
  }();
2096
- if (typeof module === "object") module.exports = SortedArray2;
2081
+ if ((typeof module === "undefined" ? "undefined" : _type_of(module)) === "object") module.exports = SortedArray2;
2097
2082
  if (typeof define === "function" && define.amd) define(function() {
2098
2083
  return SortedArray2;
2099
2084
  });
@@ -2515,10 +2500,9 @@ var Player = function() {
2515
2500
  }();
2516
2501
  var SyncHook = /*#__PURE__*/ function(Hook) {
2517
2502
  _inherits(SyncHook, Hook);
2518
- var _super = _create_super(SyncHook);
2519
2503
  function SyncHook() {
2520
2504
  _class_call_check(this, SyncHook);
2521
- return _super.apply(this, arguments);
2505
+ return _call_super(this, SyncHook, arguments);
2522
2506
  }
2523
2507
  _create_class(SyncHook, [
2524
2508
  {
@@ -2551,10 +2535,9 @@ var Player = function() {
2551
2535
  }(Hook);
2552
2536
  var SyncBailHook = /*#__PURE__*/ function(Hook) {
2553
2537
  _inherits(SyncBailHook, Hook);
2554
- var _super = _create_super(SyncBailHook);
2555
2538
  function SyncBailHook() {
2556
2539
  _class_call_check(this, SyncBailHook);
2557
- return _super.apply(this, arguments);
2540
+ return _call_super(this, SyncBailHook, arguments);
2558
2541
  }
2559
2542
  _create_class(SyncBailHook, [
2560
2543
  {
@@ -2586,10 +2569,9 @@ var Player = function() {
2586
2569
  }(Hook);
2587
2570
  var SyncWaterfallHook = /*#__PURE__*/ function(Hook) {
2588
2571
  _inherits(SyncWaterfallHook, Hook);
2589
- var _super = _create_super(SyncWaterfallHook);
2590
2572
  function SyncWaterfallHook() {
2591
2573
  _class_call_check(this, SyncWaterfallHook);
2592
- return _super.apply(this, arguments);
2574
+ return _call_super(this, SyncWaterfallHook, arguments);
2593
2575
  }
2594
2576
  _create_class(SyncWaterfallHook, [
2595
2577
  {
@@ -3085,7 +3067,7 @@ var Player = function() {
3085
3067
  var _this_parseCache_path;
3086
3068
  var ast = (_this_parseCache_path = this.parseCache[path]) !== null && _this_parseCache_path !== void 0 ? _this_parseCache_path : parse(path);
3087
3069
  this.parseCache[path] = ast;
3088
- if (typeof ast !== "object" || !(ast === null || ast === void 0 ? void 0 : ast.status)) {
3070
+ if ((typeof ast === "undefined" ? "undefined" : _type_of(ast)) !== "object" || !(ast === null || ast === void 0 ? void 0 : ast.status)) {
3089
3071
  var _ast_error;
3090
3072
  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."));
3091
3073
  }
@@ -3286,13 +3268,12 @@ var Player = function() {
3286
3268
  }();
3287
3269
  var DependencyMiddleware = /*#__PURE__*/ function(DependencyTracker) {
3288
3270
  _inherits(DependencyMiddleware, DependencyTracker);
3289
- var _super = _create_super(DependencyMiddleware);
3290
3271
  function DependencyMiddleware() {
3291
3272
  _class_call_check(this, DependencyMiddleware);
3292
3273
  var _this;
3293
- _this = _super.call(this);
3294
- _this.get = _this.get.bind(_assert_this_initialized(_this));
3295
- _this.set = _this.set.bind(_assert_this_initialized(_this));
3274
+ _this = _call_super(this, DependencyMiddleware);
3275
+ _this.get = _this.get.bind(_this);
3276
+ _this.set = _this.set.bind(_this);
3296
3277
  return _this;
3297
3278
  }
3298
3279
  _create_class(DependencyMiddleware, [
@@ -3327,14 +3308,13 @@ var Player = function() {
3327
3308
  }(DependencyTracker);
3328
3309
  var DependencyModel = /*#__PURE__*/ function(DependencyTracker) {
3329
3310
  _inherits(DependencyModel, DependencyTracker);
3330
- var _super = _create_super(DependencyModel);
3331
3311
  function DependencyModel(rootModel) {
3332
3312
  _class_call_check(this, DependencyModel);
3333
3313
  var _this;
3334
- _this = _super.call(this);
3314
+ _this = _call_super(this, DependencyModel);
3335
3315
  _this.rootModel = rootModel;
3336
- _this.set = _this.set.bind(_assert_this_initialized(_this));
3337
- _this.get = _this.get.bind(_assert_this_initialized(_this));
3316
+ _this.set = _this.set.bind(_this);
3317
+ _this.get = _this.get.bind(_this);
3338
3318
  return _this;
3339
3319
  }
3340
3320
  _create_class(DependencyModel, [
@@ -3968,23 +3948,20 @@ var Player = function() {
3968
3948
  * @experimental These Player APIs are in active development and may change. Use with caution
3969
3949
  */ key: "evaluateAsync",
3970
3950
  value: function evaluateAsync(expr, options) {
3951
+ var _this = this;
3971
3952
  if (Array.isArray(expr)) {
3972
- var _this = this;
3973
- return collateAwaitable(expr.map(function() {
3974
- var _ref = _async_to_generator(function(exp) {
3953
+ return collateAwaitable(expr.map(function(exp) {
3954
+ return _async_to_generator(function() {
3975
3955
  return _ts_generator(this, function(_state) {
3976
3956
  return [
3977
3957
  2,
3978
- _this.evaluate(exp, _object_spread_props(_object_spread({}, options), {
3958
+ this.evaluate(exp, _object_spread_props(_object_spread({}, options), {
3979
3959
  async: true
3980
3960
  }))
3981
3961
  ];
3982
3962
  });
3983
- });
3984
- return function(exp) {
3985
- return _ref.apply(this, arguments);
3986
- };
3987
- }())).awaitableThen(function(values) {
3963
+ }).call(_this);
3964
+ })).awaitableThen(function(values) {
3988
3965
  return values.pop();
3989
3966
  });
3990
3967
  } else {
@@ -4809,7 +4786,7 @@ var Player = function() {
4809
4786
  for(var _iterator = foo[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
4810
4787
  len = _step.value;
4811
4788
  tmp = len;
4812
- if (tmp && typeof tmp === "object") {
4789
+ if (tmp && (typeof tmp === "undefined" ? "undefined" : _type_of(tmp)) === "object") {
4813
4790
  tmp = find(bar, tmp);
4814
4791
  if (!tmp) return false;
4815
4792
  }
@@ -4840,7 +4817,7 @@ var Player = function() {
4840
4817
  for(var _iterator1 = foo[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
4841
4818
  len = _step1.value;
4842
4819
  tmp = len[0];
4843
- if (tmp && typeof tmp === "object") {
4820
+ if (tmp && (typeof tmp === "undefined" ? "undefined" : _type_of(tmp)) === "object") {
4844
4821
  tmp = find(bar, tmp);
4845
4822
  if (!tmp) return false;
4846
4823
  }
@@ -4879,7 +4856,7 @@ var Player = function() {
4879
4856
  }
4880
4857
  return len === -1;
4881
4858
  }
4882
- if (!ctor || typeof foo === "object") {
4859
+ if (!ctor || (typeof foo === "undefined" ? "undefined" : _type_of(foo)) === "object") {
4883
4860
  len = 0;
4884
4861
  for(ctor in foo){
4885
4862
  if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;
@@ -4953,7 +4930,7 @@ var Player = function() {
4953
4930
  }
4954
4931
  var parseLocalObject = function(currentValue, objToParse) {
4955
4932
  var path = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
4956
- if (typeof objToParse !== "object" || objToParse === null) {
4933
+ if ((typeof objToParse === "undefined" ? "undefined" : _type_of(objToParse)) !== "object" || objToParse === null) {
4957
4934
  return {
4958
4935
  value: objToParse,
4959
4936
  children: []
@@ -4990,7 +4967,7 @@ var Player = function() {
4990
4967
  if (newChildren) {
4991
4968
  var _children2;
4992
4969
  (_children2 = children2).push.apply(_children2, _to_consumable_array(newChildren));
4993
- } else if (localValue && typeof localValue === "object") {
4970
+ } else if (localValue && (typeof localValue === "undefined" ? "undefined" : _type_of(localValue)) === "object") {
4994
4971
  var _children21;
4995
4972
  var result = parseLocalObject(accumulation.value, localValue, _to_consumable_array(path).concat([
4996
4973
  localKey
@@ -5149,7 +5126,7 @@ var Player = function() {
5149
5126
  Object.keys(clonedNode).forEach(function(key) {
5150
5127
  if (key === "parent") return;
5151
5128
  var value = clonedNode[key];
5152
- if (typeof value === "object" && value !== null) {
5129
+ if ((typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" && value !== null) {
5153
5130
  clonedNode[key] = Array.isArray(value) ? _to_consumable_array(value) : _object_spread({}, value);
5154
5131
  }
5155
5132
  });
@@ -5632,7 +5609,7 @@ var Player = function() {
5632
5609
  for(var _iterator = templateSubstitutions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
5633
5610
  var _step_value = _step.value, expression = _step_value.expression, value = _step_value.value;
5634
5611
  var flags = "g";
5635
- if (typeof expression === "object") {
5612
+ if ((typeof expression === "undefined" ? "undefined" : _type_of(expression)) === "object") {
5636
5613
  flags = "".concat(expression.flags).concat(expression.global ? "" : "g");
5637
5614
  }
5638
5615
  templateStr = templateStr.replace(new RegExp(expression, flags), value);
@@ -5783,7 +5760,7 @@ var Player = function() {
5783
5760
  var bindingResolveLookup = createPatternMatcher("{{", "}}");
5784
5761
  var expressionResolveLookup = createPatternMatcher("@[", "]@");
5785
5762
  function resolveAllRefs(node, resolveOptions, propertiesToSkip) {
5786
- if (node === null || node === void 0 || typeof node !== "object" && typeof node !== "string") {
5763
+ if (node === null || node === void 0 || (typeof node === "undefined" ? "undefined" : _type_of(node)) !== "object" && typeof node !== "string") {
5787
5764
  return node;
5788
5765
  }
5789
5766
  if (typeof node === "string") {
@@ -5796,7 +5773,7 @@ var Player = function() {
5796
5773
  }
5797
5774
  var val = node[key];
5798
5775
  var newVal = val;
5799
- if (typeof val === "object") {
5776
+ if ((typeof val === "undefined" ? "undefined" : _type_of(val)) === "object") {
5800
5777
  newVal = resolveAllRefs(val, resolveOptions, propertiesToSkip);
5801
5778
  } else if (typeof val === "string") {
5802
5779
  newVal = resolveString(val, resolveOptions);
@@ -6142,7 +6119,7 @@ var Player = function() {
6142
6119
  key: "applyParser",
6143
6120
  value: function applyParser(parser) {
6144
6121
  parser.hooks.parseNode.tap("asset", function(obj, nodeType, options, childOptions) {
6145
- if ((childOptions === null || childOptions === void 0 ? void 0 : childOptions.key) === "asset" && typeof obj === "object") {
6122
+ if ((childOptions === null || childOptions === void 0 ? void 0 : childOptions.key) === "asset" && (typeof obj === "undefined" ? "undefined" : _type_of(obj)) === "object") {
6146
6123
  var assetAST = parser.parseObject(obj, "asset" /* Asset */ , options);
6147
6124
  if (!assetAST) {
6148
6125
  return [];
@@ -6350,6 +6327,7 @@ var Player = function() {
6350
6327
  var import_p_defer = __toESM(require_p_defer());
6351
6328
  var FlowInstance = /*#__PURE__*/ function() {
6352
6329
  function FlowInstance(id, flow, options) {
6330
+ var _this = this;
6353
6331
  _class_call_check(this, FlowInstance);
6354
6332
  this.isTransitioning = false;
6355
6333
  this.hooks = {
@@ -6366,60 +6344,55 @@ var Player = function() {
6366
6344
  this.flow = flow;
6367
6345
  this.log = options === null || options === void 0 ? void 0 : options.logger;
6368
6346
  this.history = [];
6369
- var _this = this;
6370
- this.hooks.transition.tap("startPromise", function() {
6371
- var _ref = _async_to_generator(function(_oldState, nextState) {
6347
+ this.hooks.transition.tap("startPromise", function(_oldState, nextState) {
6348
+ return _async_to_generator(function() {
6372
6349
  var newState;
6373
6350
  return _ts_generator(this, function(_state) {
6374
6351
  newState = nextState.value;
6375
- if (_this.flowPromise && newState.state_type === "END") {
6376
- _this.flowPromise.resolve(newState);
6352
+ if (this.flowPromise && newState.state_type === "END") {
6353
+ this.flowPromise.resolve(newState);
6377
6354
  }
6378
6355
  return [
6379
6356
  2
6380
6357
  ];
6381
6358
  });
6382
- });
6383
- return function(_oldState, nextState) {
6384
- return _ref.apply(this, arguments);
6385
- };
6386
- }());
6359
+ }).call(_this);
6360
+ });
6387
6361
  }
6388
6362
  _create_class(FlowInstance, [
6389
6363
  {
6390
6364
  key: "start",
6391
6365
  value: /** Start the state machine */ function start() {
6392
- var _this = this;
6393
6366
  return _async_to_generator(function() {
6394
6367
  var _this_log, initialState;
6395
6368
  return _ts_generator(this, function(_state) {
6396
- if (_this.flowPromise) {
6369
+ if (this.flowPromise) {
6397
6370
  ;
6398
- (_this_log = _this.log) === null || _this_log === void 0 ? void 0 : _this_log.warn("Already called start for flow");
6371
+ (_this_log = this.log) === null || _this_log === void 0 ? void 0 : _this_log.warn("Already called start for flow");
6399
6372
  return [
6400
6373
  2,
6401
- _this.flowPromise.promise
6374
+ this.flowPromise.promise
6402
6375
  ];
6403
6376
  }
6404
- _this.flow = _this.hooks.beforeStart.call(_this.flow) || _this.flow;
6405
- if (_this.flow.onStart) {
6406
- _this.hooks.onStart.call(_this.flow.onStart);
6377
+ this.flow = this.hooks.beforeStart.call(this.flow) || this.flow;
6378
+ if (this.flow.onStart) {
6379
+ this.hooks.onStart.call(this.flow.onStart);
6407
6380
  }
6408
- initialState = _this.flow.startState;
6381
+ initialState = this.flow.startState;
6409
6382
  if (!initialState) {
6410
6383
  return [
6411
6384
  2,
6412
6385
  Promise.reject(new Error("No 'startState' defined for flow"))
6413
6386
  ];
6414
6387
  }
6415
- _this.flowPromise = (0, import_p_defer.default)();
6416
- _this.pushHistory(initialState);
6388
+ this.flowPromise = (0, import_p_defer.default)();
6389
+ this.pushHistory(initialState);
6417
6390
  return [
6418
6391
  2,
6419
- _this.flowPromise.promise
6392
+ this.flowPromise.promise
6420
6393
  ];
6421
6394
  });
6422
- })();
6395
+ }).call(this);
6423
6396
  }
6424
6397
  },
6425
6398
  {
@@ -6471,7 +6444,7 @@ var Player = function() {
6471
6444
  throw new Error("No flow definition for: ".concat(stateName, " was found."));
6472
6445
  }
6473
6446
  var nextState = this.flow[stateName];
6474
- if (!this.flow[stateName] || typeof nextState !== "object" || !("state_type" in nextState)) {
6447
+ if (!this.flow[stateName] || (typeof nextState === "undefined" ? "undefined" : _type_of(nextState)) !== "object" || !("state_type" in nextState)) {
6475
6448
  var _this_log;
6476
6449
  (_this_log = this.log) === null || _this_log === void 0 ? void 0 : _this_log.error("Flow doesn't contain any states named: ".concat(stateName));
6477
6450
  return;
@@ -6532,30 +6505,30 @@ var Player = function() {
6532
6505
  {
6533
6506
  key: "run",
6534
6507
  value: function run(startState) {
6535
- var _this = this;
6536
6508
  return _async_to_generator(function() {
6537
- var _this_log, startFlow, flow, end, firstItem;
6509
+ var _this, _this_log, startFlow, flow, end, firstItem;
6538
6510
  return _ts_generator(this, function(_state) {
6539
6511
  switch(_state.label){
6540
6512
  case 0:
6541
- if (!Object.prototype.hasOwnProperty.call(_this.navigation, startState)) {
6513
+ _this = this;
6514
+ if (!Object.prototype.hasOwnProperty.call(this.navigation, startState)) {
6542
6515
  return [
6543
6516
  2,
6544
6517
  Promise.reject(new Error("No flow defined for: ".concat(startState)))
6545
6518
  ];
6546
6519
  }
6547
- startFlow = _this.navigation[startState];
6548
- if (startFlow === null || typeof startFlow !== "object") {
6520
+ startFlow = this.navigation[startState];
6521
+ if (startFlow === null || (typeof startFlow === "undefined" ? "undefined" : _type_of(startFlow)) !== "object") {
6549
6522
  return [
6550
6523
  2,
6551
6524
  Promise.reject(new Error("Flow: ".concat(startState, " needs to be an object")))
6552
6525
  ];
6553
6526
  }
6554
- (_this_log = _this.log) === null || _this_log === void 0 ? void 0 : _this_log.debug("Starting flow: ".concat(startState));
6527
+ (_this_log = this.log) === null || _this_log === void 0 ? void 0 : _this_log.debug("Starting flow: ".concat(startState));
6555
6528
  flow = new FlowInstance(startState, startFlow, {
6556
- logger: _this.log
6529
+ logger: this.log
6557
6530
  });
6558
- _this.addNewFlow(flow);
6531
+ this.addNewFlow(flow);
6559
6532
  flow.hooks.afterTransition.tap("flow-controller", function(flowInstance) {
6560
6533
  var _flowInstance_currentState;
6561
6534
  if (((_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value.state_type) === "FLOW") {
@@ -6575,10 +6548,10 @@ var Player = function() {
6575
6548
  ];
6576
6549
  case 1:
6577
6550
  end = _state.sent();
6578
- _this.navStack.pop();
6579
- if (_this.navStack.length > 0) {
6551
+ this.navStack.pop();
6552
+ if (this.navStack.length > 0) {
6580
6553
  firstItem = 0;
6581
- _this.current = _this.navStack[firstItem];
6554
+ this.current = this.navStack[firstItem];
6582
6555
  }
6583
6556
  return [
6584
6557
  2,
@@ -6586,16 +6559,15 @@ var Player = function() {
6586
6559
  ];
6587
6560
  }
6588
6561
  });
6589
- })();
6562
+ }).call(this);
6590
6563
  }
6591
6564
  },
6592
6565
  {
6593
6566
  key: "start",
6594
6567
  value: function start() {
6595
- var _this = this;
6596
6568
  return _async_to_generator(function() {
6597
6569
  return _ts_generator(this, function(_state) {
6598
- if (!_this.navigation.BEGIN) {
6570
+ if (!this.navigation.BEGIN) {
6599
6571
  return [
6600
6572
  2,
6601
6573
  Promise.reject(new Error("Must supply a BEGIN state"))
@@ -6603,10 +6575,10 @@ var Player = function() {
6603
6575
  }
6604
6576
  return [
6605
6577
  2,
6606
- _this.run(_this.navigation.BEGIN)
6578
+ this.run(this.navigation.BEGIN)
6607
6579
  ];
6608
6580
  });
6609
- })();
6581
+ }).call(this);
6610
6582
  }
6611
6583
  }
6612
6584
  ]);
@@ -7397,7 +7369,7 @@ var Player = function() {
7397
7369
  var nestedPath = _to_consumable_array(path).concat([
7398
7370
  key
7399
7371
  ]);
7400
- if (typeof val === "object") {
7372
+ if ((typeof val === "undefined" ? "undefined" : _type_of(val)) === "object") {
7401
7373
  traverseObj(val, nestedPath, pairs);
7402
7374
  } else {
7403
7375
  pairs.set(nestedPath, val);
@@ -7438,7 +7410,7 @@ var Player = function() {
7438
7410
  {
7439
7411
  /** Add match -> value mapping to the registry */ key: "set",
7440
7412
  value: function set(match, value) {
7441
- var matcher = typeof match === "object" ? createMatcher(match) : createBasicMatcher(match);
7413
+ var matcher = (typeof match === "undefined" ? "undefined" : _type_of(match)) === "object" ? createMatcher(match) : createBasicMatcher(match);
7442
7414
  this.store.insert({
7443
7415
  key: match,
7444
7416
  value: value,
@@ -7851,7 +7823,7 @@ var Player = function() {
7851
7823
  var parentBinding = resolved.parent();
7852
7824
  var property = resolved.key();
7853
7825
  var parentValue = this.get(parentBinding);
7854
- var existedBeforeDelete = typeof parentValue === "object" && parentValue !== null && Object.prototype.hasOwnProperty.call(parentValue, property);
7826
+ var existedBeforeDelete = (typeof parentValue === "undefined" ? "undefined" : _type_of(parentValue)) === "object" && parentValue !== null && Object.prototype.hasOwnProperty.call(parentValue, property);
7855
7827
  this.getModel().delete(resolved, options);
7856
7828
  if (existedBeforeDelete && !this.get(resolved)) {
7857
7829
  this.trash.add(resolved);
@@ -7955,7 +7927,7 @@ var Player = function() {
7955
7927
  var expressionEvaluator;
7956
7928
  var handleEval = function(exp) {
7957
7929
  if (exp) {
7958
- if (typeof exp === "object" && "exp" in exp) {
7930
+ if ((typeof exp === "undefined" ? "undefined" : _type_of(exp)) === "object" && "exp" in exp) {
7959
7931
  expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(exp.exp);
7960
7932
  } else {
7961
7933
  expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(exp);
@@ -8219,7 +8191,7 @@ var Player = function() {
8219
8191
  flow.hooks.beforeTransition.tap("player", function(state, transitionVal) {
8220
8192
  var computedTransitionVal = state.transitions[transitionVal] ? transitionVal : "*";
8221
8193
  if (state.onEnd && state.transitions[computedTransitionVal]) {
8222
- if (typeof state.onEnd === "object" && "exp" in state.onEnd) {
8194
+ if (_type_of(state.onEnd) === "object" && "exp" in state.onEnd) {
8223
8195
  expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(state.onEnd.exp);
8224
8196
  } else {
8225
8197
  expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(state.onEnd);
@@ -8378,12 +8350,12 @@ var Player = function() {
8378
8350
  {
8379
8351
  key: "start",
8380
8352
  value: function start(payload) {
8381
- var _this = this;
8382
8353
  return _async_to_generator(function() {
8383
- var _payload_id, ref, maybeUpdateState, _this_setupFlow, state, start, endProps, _tmp, error, errorState;
8354
+ var _this, _payload_id, ref, maybeUpdateState, _this_setupFlow, state, start, endProps, _tmp, error, errorState;
8384
8355
  return _ts_generator(this, function(_state) {
8385
8356
  switch(_state.label){
8386
8357
  case 0:
8358
+ _this = this;
8387
8359
  ref = Symbol((_payload_id = payload === null || payload === void 0 ? void 0 : payload.id) !== null && _payload_id !== void 0 ? _payload_id : "payload");
8388
8360
  maybeUpdateState = function(newState) {
8389
8361
  if (_this.state.ref !== ref) {
@@ -8393,7 +8365,7 @@ var Player = function() {
8393
8365
  _this.setState(newState);
8394
8366
  return newState;
8395
8367
  };
8396
- _this.setState({
8368
+ this.setState({
8397
8369
  status: "not-started",
8398
8370
  ref: ref
8399
8371
  });
@@ -8405,8 +8377,8 @@ var Player = function() {
8405
8377
  ,
8406
8378
  4
8407
8379
  ]);
8408
- _this_setupFlow = _this.setupFlow(payload), state = _this_setupFlow.state, start = _this_setupFlow.start;
8409
- _this.setState(_object_spread({
8380
+ _this_setupFlow = this.setupFlow(payload), state = _this_setupFlow.state, start = _this_setupFlow.start;
8381
+ this.setState(_object_spread({
8410
8382
  ref: ref
8411
8383
  }, state));
8412
8384
  start();
@@ -8451,7 +8423,7 @@ var Player = function() {
8451
8423
  ];
8452
8424
  }
8453
8425
  });
8454
- })();
8426
+ }).call(this);
8455
8427
  }
8456
8428
  }
8457
8429
  ]);