scorm-again 2.6.3 → 2.6.4

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 (68) hide show
  1. package/dist/aicc.js +37 -22
  2. package/dist/aicc.js.map +1 -1
  3. package/dist/aicc.min.js +1 -1
  4. package/dist/aicc.min.js.map +1 -1
  5. package/dist/esm/aicc.js +37 -22
  6. package/dist/esm/aicc.js.map +1 -1
  7. package/dist/esm/aicc.min.js +1 -1
  8. package/dist/esm/aicc.min.js.map +1 -1
  9. package/dist/esm/scorm-again.js +66 -42
  10. package/dist/esm/scorm-again.js.map +1 -1
  11. package/dist/esm/scorm-again.min.js +1 -1
  12. package/dist/esm/scorm-again.min.js.map +1 -1
  13. package/dist/esm/scorm12.js +34 -20
  14. package/dist/esm/scorm12.js.map +1 -1
  15. package/dist/esm/scorm12.min.js +1 -1
  16. package/dist/esm/scorm12.min.js.map +1 -1
  17. package/dist/esm/scorm2004.js +56 -36
  18. package/dist/esm/scorm2004.js.map +1 -1
  19. package/dist/esm/scorm2004.min.js +1 -1
  20. package/dist/esm/scorm2004.min.js.map +1 -1
  21. package/dist/scorm-again.js +66 -42
  22. package/dist/scorm-again.js.map +1 -1
  23. package/dist/scorm-again.min.js +1 -1
  24. package/dist/scorm-again.min.js.map +1 -1
  25. package/dist/scorm12.js +34 -20
  26. package/dist/scorm12.js.map +1 -1
  27. package/dist/scorm12.min.js +1 -1
  28. package/dist/scorm12.min.js.map +1 -1
  29. package/dist/scorm2004.js +56 -36
  30. package/dist/scorm2004.js.map +1 -1
  31. package/dist/scorm2004.min.js +1 -1
  32. package/dist/scorm2004.min.js.map +1 -1
  33. package/package.json +1 -1
  34. package/src/BaseAPI.ts +54 -33
  35. package/src/Scorm12API.ts +3 -2
  36. package/src/Scorm2004API.ts +31 -24
  37. package/src/cmi/aicc/attempts.ts +3 -3
  38. package/src/cmi/aicc/core.ts +30 -12
  39. package/src/cmi/aicc/evaluation.ts +1 -1
  40. package/src/cmi/aicc/student_data.ts +1 -1
  41. package/src/cmi/aicc/student_demographics.ts +13 -13
  42. package/src/cmi/aicc/student_preferences.ts +1 -1
  43. package/src/cmi/aicc/tries.ts +3 -3
  44. package/src/cmi/aicc/validation.ts +1 -1
  45. package/src/cmi/common/array.ts +1 -1
  46. package/src/cmi/common/score.ts +3 -3
  47. package/src/cmi/common/validation.ts +2 -2
  48. package/src/cmi/scorm12/cmi.ts +12 -4
  49. package/src/cmi/scorm12/interactions.ts +27 -11
  50. package/src/cmi/scorm12/objectives.ts +4 -4
  51. package/src/cmi/scorm12/student_data.ts +12 -4
  52. package/src/cmi/scorm12/student_preference.ts +3 -1
  53. package/src/cmi/scorm12/validation.ts +5 -3
  54. package/src/cmi/scorm2004/adl.ts +21 -7
  55. package/src/cmi/scorm2004/cmi.ts +45 -15
  56. package/src/cmi/scorm2004/comments.ts +11 -5
  57. package/src/cmi/scorm2004/interactions.ts +25 -23
  58. package/src/cmi/scorm2004/learner_preference.ts +3 -1
  59. package/src/cmi/scorm2004/objectives.ts +5 -5
  60. package/src/cmi/scorm2004/score.ts +3 -3
  61. package/src/cmi/scorm2004/validation.ts +2 -2
  62. package/src/exceptions/aicc_exceptions.ts +4 -4
  63. package/src/exceptions/scorm12_exceptions.ts +4 -4
  64. package/src/exceptions/scorm2004_exceptions.ts +4 -4
  65. package/src/utilities.ts +3 -3
  66. package/test/Scorm12API.spec.ts +45 -0
  67. package/test/Scorm2004API.spec.ts +43 -0
  68. package/tsconfig.json +1 -0
@@ -32,11 +32,12 @@ var AICCValidationError = (function (_super) {
32
32
  (0,tslib_es6.__extends)(AICCValidationError, _super);
33
33
  function AICCValidationError(errorCode) {
34
34
  var _this = this;
35
+ var _a, _b, _c, _d;
35
36
  if ({}.hasOwnProperty.call(aicc_errors, String(errorCode))) {
36
- _this = _super.call(this, errorCode, aicc_errors[String(errorCode)].basicMessage, aicc_errors[String(errorCode)].detailMessage) || this;
37
+ _this = _super.call(this, errorCode, ((_a = aicc_errors[String(errorCode)]) === null || _a === void 0 ? void 0 : _a.basicMessage) || "Unknown rror", (_b = aicc_errors[String(errorCode)]) === null || _b === void 0 ? void 0 : _b.detailMessage) || this;
37
38
  }
38
39
  else {
39
- _this = _super.call(this, 101, aicc_errors["101"].basicMessage, aicc_errors["101"].detailMessage) || this;
40
+ _this = _super.call(this, 101, ((_c = aicc_errors["101"]) === null || _c === void 0 ? void 0 : _c.basicMessage) || "General error", (_d = aicc_errors["101"]) === null || _d === void 0 ? void 0 : _d.detailMessage) || this;
40
41
  }
41
42
  return _this;
42
43
  }
@@ -1410,6 +1411,10 @@ var BaseAPI = (function () {
1410
1411
  : this._error_codes.GENERAL;
1411
1412
  for (var idx = 0; idx < structure.length; idx++) {
1412
1413
  var attribute = structure[idx];
1414
+ if (!attribute) {
1415
+ this.throwSCORMError(invalidErrorCode, invalidErrorMessage);
1416
+ return api_constants.global_constants.SCORM_FALSE;
1417
+ }
1413
1418
  if (idx === structure.length - 1) {
1414
1419
  if (scorm2004 && attribute.substring(0, 8) === "{target=") {
1415
1420
  if (this.isInitialized()) {
@@ -1440,7 +1445,7 @@ var BaseAPI = (function () {
1440
1445
  break;
1441
1446
  }
1442
1447
  if (refObject instanceof array.CMIArray) {
1443
- var index = parseInt(structure[idx + 1], 10);
1448
+ var index = parseInt(structure[idx + 1] || "0", 10);
1444
1449
  if (!isNaN(index)) {
1445
1450
  var item = refObject.childArray[index];
1446
1451
  if (item) {
@@ -1484,6 +1489,10 @@ var BaseAPI = (function () {
1484
1489
  : this._error_codes.GENERAL;
1485
1490
  for (var idx = 0; idx < structure.length; idx++) {
1486
1491
  attribute = structure[idx];
1492
+ if (!attribute) {
1493
+ this.throwSCORMError(invalidErrorCode, invalidErrorMessage);
1494
+ return;
1495
+ }
1487
1496
  if (!scorm2004) {
1488
1497
  if (idx === structure.length - 1) {
1489
1498
  if (!this._checkObjectHasProperty(refObject, attribute)) {
@@ -1509,7 +1518,7 @@ var BaseAPI = (function () {
1509
1518
  break;
1510
1519
  }
1511
1520
  if (refObject instanceof array.CMIArray) {
1512
- var index = parseInt(structure[idx + 1], 10);
1521
+ var index = parseInt(structure[idx + 1] || "", 10);
1513
1522
  if (!isNaN(index)) {
1514
1523
  var item = refObject.childArray[index];
1515
1524
  if (item) {
@@ -1547,17 +1556,18 @@ var BaseAPI = (function () {
1547
1556
  return this.currentState === api_constants.global_constants.STATE_TERMINATED;
1548
1557
  };
1549
1558
  BaseAPI.prototype.on = function (listenerName, callback) {
1559
+ var _a, _c;
1550
1560
  if (!callback)
1551
1561
  return;
1552
1562
  var listenerFunctions = listenerName.split(" ");
1553
1563
  for (var i = 0; i < listenerFunctions.length; i++) {
1554
- var listenerSplit = listenerFunctions[i].split(".");
1555
- if (listenerSplit.length === 0)
1564
+ var listenerSplit = (_a = listenerFunctions[i]) === null || _a === void 0 ? void 0 : _a.split(".");
1565
+ if (!listenerSplit || listenerSplit.length === 0)
1556
1566
  return;
1557
1567
  var functionName = listenerSplit[0];
1558
1568
  var CMIElement = null;
1559
1569
  if (listenerSplit.length > 1) {
1560
- CMIElement = listenerName.replace(functionName + ".", "");
1570
+ CMIElement = (_c = listenerFunctions[i]) === null || _c === void 0 ? void 0 : _c.replace(functionName + ".", "");
1561
1571
  }
1562
1572
  this.listenerArray.push({
1563
1573
  functionName: functionName,
@@ -1568,17 +1578,18 @@ var BaseAPI = (function () {
1568
1578
  }
1569
1579
  };
1570
1580
  BaseAPI.prototype.off = function (listenerName, callback) {
1581
+ var _a, _c;
1571
1582
  if (!callback)
1572
1583
  return;
1573
1584
  var listenerFunctions = listenerName.split(" ");
1574
1585
  var _loop_1 = function (i) {
1575
- var listenerSplit = listenerFunctions[i].split(".");
1576
- if (listenerSplit.length === 0)
1586
+ var listenerSplit = (_a = listenerFunctions[i]) === null || _a === void 0 ? void 0 : _a.split(".");
1587
+ if (!listenerSplit || listenerSplit.length === 0)
1577
1588
  return { value: void 0 };
1578
1589
  var functionName = listenerSplit[0];
1579
1590
  var CMIElement = null;
1580
1591
  if (listenerSplit.length > 1) {
1581
- CMIElement = listenerName.replace(functionName + ".", "");
1592
+ CMIElement = (_c = listenerFunctions[i]) === null || _c === void 0 ? void 0 : _c.replace(functionName + ".", "");
1582
1593
  }
1583
1594
  var removeIndex = this_1.listenerArray.findIndex(function (obj) {
1584
1595
  return obj.functionName === functionName &&
@@ -1598,15 +1609,16 @@ var BaseAPI = (function () {
1598
1609
  }
1599
1610
  };
1600
1611
  BaseAPI.prototype.clear = function (listenerName) {
1612
+ var _a, _c;
1601
1613
  var listenerFunctions = listenerName.split(" ");
1602
1614
  var _loop_2 = function (i) {
1603
- var listenerSplit = listenerFunctions[i].split(".");
1604
- if (listenerSplit.length === 0)
1615
+ var listenerSplit = (_a = listenerFunctions[i]) === null || _a === void 0 ? void 0 : _a.split(".");
1616
+ if (!listenerSplit || (listenerSplit === null || listenerSplit === void 0 ? void 0 : listenerSplit.length) === 0)
1605
1617
  return { value: void 0 };
1606
1618
  var functionName = listenerSplit[0];
1607
1619
  var CMIElement = null;
1608
1620
  if (listenerSplit.length > 1) {
1609
- CMIElement = listenerName.replace(functionName + ".", "");
1621
+ CMIElement = (_c = listenerFunctions[i]) === null || _c === void 0 ? void 0 : _c.replace(functionName + ".", "");
1610
1622
  }
1611
1623
  this_2.listenerArray = this_2.listenerArray.filter(function (obj) {
1612
1624
  return obj.functionName !== functionName && obj.CMIElement !== CMIElement;
@@ -2088,14 +2100,16 @@ var Scorm12Impl = (function (_super) {
2088
2100
  Scorm12Impl.prototype.validateCorrectResponse = function (_CMIElement, _value) {
2089
2101
  };
2090
2102
  Scorm12Impl.prototype.getLmsErrorMessageDetails = function (errorNumber, detail) {
2103
+ var _a, _b;
2091
2104
  var basicMessage = "No Error";
2092
2105
  var detailMessage = "No Error";
2093
2106
  errorNumber = String(errorNumber);
2094
2107
  if (_constants_api_constants__WEBPACK_IMPORTED_MODULE_4__.scorm12_constants.error_descriptions[errorNumber]) {
2095
2108
  basicMessage =
2096
- _constants_api_constants__WEBPACK_IMPORTED_MODULE_4__.scorm12_constants.error_descriptions[errorNumber].basicMessage;
2109
+ ((_a = _constants_api_constants__WEBPACK_IMPORTED_MODULE_4__.scorm12_constants.error_descriptions[errorNumber]) === null || _a === void 0 ? void 0 : _a.basicMessage) ||
2110
+ "General Error";
2097
2111
  detailMessage =
2098
- _constants_api_constants__WEBPACK_IMPORTED_MODULE_4__.scorm12_constants.error_descriptions[errorNumber].detailMessage;
2112
+ ((_b = _constants_api_constants__WEBPACK_IMPORTED_MODULE_4__.scorm12_constants.error_descriptions[errorNumber]) === null || _b === void 0 ? void 0 : _b.detailMessage) || "";
2099
2113
  }
2100
2114
  return detail ? detailMessage : basicMessage;
2101
2115
  };
@@ -2252,11 +2266,12 @@ var Scorm2004ValidationError = (function (_super) {
2252
2266
  (0,tslib_es6.__extends)(Scorm2004ValidationError, _super);
2253
2267
  function Scorm2004ValidationError(errorCode) {
2254
2268
  var _this = this;
2269
+ var _a, _b, _c, _d;
2255
2270
  if ({}.hasOwnProperty.call(scorm2004_errors, String(errorCode))) {
2256
- _this = _super.call(this, errorCode, scorm2004_errors[String(errorCode)].basicMessage, scorm2004_errors[String(errorCode)].detailMessage) || this;
2271
+ _this = _super.call(this, errorCode, ((_a = scorm2004_errors[String(errorCode)]) === null || _a === void 0 ? void 0 : _a.basicMessage) || "Unknown error", (_b = scorm2004_errors[String(errorCode)]) === null || _b === void 0 ? void 0 : _b.detailMessage) || this;
2257
2272
  }
2258
2273
  else {
2259
- _this = _super.call(this, 101, scorm2004_errors["101"].basicMessage, scorm2004_errors["101"].detailMessage) || this;
2274
+ _this = _super.call(this, 101, ((_c = scorm2004_errors["101"]) === null || _c === void 0 ? void 0 : _c.basicMessage) || "General error", (_d = scorm2004_errors["101"]) === null || _d === void 0 ? void 0 : _d.detailMessage) || this;
2260
2275
  }
2261
2276
  return _this;
2262
2277
  }
@@ -2672,6 +2687,7 @@ var CMIInteractionsObject = (function (_super) {
2672
2687
  return this._learner_response;
2673
2688
  },
2674
2689
  set: function (learner_response) {
2690
+ var _a, _b, _c, _d;
2675
2691
  if (this.initialized && (this._type === "" || this._id === "")) {
2676
2692
  throw new Scorm2004ValidationError(error_codes.scorm2004_errors.DEPENDENCY_NOT_ESTABLISHED);
2677
2693
  }
@@ -2689,14 +2705,14 @@ var CMIInteractionsObject = (function (_super) {
2689
2705
  var formatRegex = new RegExp(response_type.format);
2690
2706
  for (var i = 0; i < nodes.length; i++) {
2691
2707
  if (response_type === null || response_type === void 0 ? void 0 : response_type.delimiter2) {
2692
- var values = nodes[i].split(response_type.delimiter2);
2693
- if (values.length === 2) {
2694
- if (!values[0].match(formatRegex)) {
2708
+ var values = (_a = nodes[i]) === null || _a === void 0 ? void 0 : _a.split(response_type.delimiter2);
2709
+ if ((values === null || values === void 0 ? void 0 : values.length) === 2) {
2710
+ if (!((_b = values[0]) === null || _b === void 0 ? void 0 : _b.match(formatRegex))) {
2695
2711
  throw new Scorm2004ValidationError(error_codes.scorm2004_errors.TYPE_MISMATCH);
2696
2712
  }
2697
2713
  else {
2698
2714
  if (!response_type.format2 ||
2699
- !values[1].match(new RegExp(response_type.format2))) {
2715
+ !((_c = values[1]) === null || _c === void 0 ? void 0 : _c.match(new RegExp(response_type.format2)))) {
2700
2716
  throw new Scorm2004ValidationError(error_codes.scorm2004_errors.TYPE_MISMATCH);
2701
2717
  }
2702
2718
  }
@@ -2706,7 +2722,7 @@ var CMIInteractionsObject = (function (_super) {
2706
2722
  }
2707
2723
  }
2708
2724
  else {
2709
- if (!nodes[i].match(formatRegex)) {
2725
+ if (!((_d = nodes[i]) === null || _d === void 0 ? void 0 : _d.match(formatRegex))) {
2710
2726
  throw new Scorm2004ValidationError(error_codes.scorm2004_errors.TYPE_MISMATCH);
2711
2727
  }
2712
2728
  else {
@@ -4184,7 +4200,8 @@ var ADLNavRequestValid = (function (_super) {
4184
4200
  }
4185
4201
  for (var key in choice) {
4186
4202
  if ({}.hasOwnProperty.call(choice, key)) {
4187
- if (check2004ValidFormat(choice[key], regex.scorm2004_regex.NAVBoolean) &&
4203
+ if (choice[key] !== undefined &&
4204
+ check2004ValidFormat(choice[key], regex.scorm2004_regex.NAVBoolean) &&
4188
4205
  check2004ValidFormat(key, regex.scorm2004_regex.NAVTarget)) {
4189
4206
  this._choice[key] =
4190
4207
  enums.NAVBoolean[choice[key]];
@@ -4208,7 +4225,8 @@ var ADLNavRequestValid = (function (_super) {
4208
4225
  }
4209
4226
  for (var key in jump) {
4210
4227
  if ({}.hasOwnProperty.call(jump, key)) {
4211
- if (check2004ValidFormat(jump[key], regex.scorm2004_regex.NAVBoolean) &&
4228
+ if (jump[key] !== undefined &&
4229
+ check2004ValidFormat(jump[key], regex.scorm2004_regex.NAVBoolean) &&
4212
4230
  check2004ValidFormat(key, regex.scorm2004_regex.NAVTarget)) {
4213
4231
  this._jump[key] = enums.NAVBoolean[jump[key]];
4214
4232
  }
@@ -4361,19 +4379,19 @@ var Scorm2004Impl = (function (_super) {
4361
4379
  });
4362
4380
  };
4363
4381
  Scorm2004Impl.prototype.lmsGetValue = function (CMIElement) {
4364
- var _a;
4382
+ var _a, _b;
4365
4383
  var adlNavRequestRegex = "^adl\\.nav\\.request_valid\\.(choice|jump)\\.{target=\\S{0,}([a-zA-Z0-9-_]+)}$";
4366
4384
  if ((0,utilities.stringMatches)(CMIElement, adlNavRequestRegex)) {
4367
4385
  var matches = CMIElement.match(adlNavRequestRegex);
4368
4386
  if (matches) {
4369
4387
  var request = matches[1];
4370
- var target = matches[2].replace("{target=", "").replace("}", "");
4371
- if (request === "choice" || request === "jump") {
4388
+ var target = (_a = matches[2]) === null || _a === void 0 ? void 0 : _a.replace("{target=", "").replace("}", "");
4389
+ if (target && (request === "choice" || request === "jump")) {
4372
4390
  if (this.settings.scoItemIdValidator) {
4373
4391
  return String(this.settings.scoItemIdValidator(target));
4374
4392
  }
4375
4393
  if (this.settings.scoItemIds) {
4376
- return String((_a = this.settings.scoItemIds) === null || _a === void 0 ? void 0 : _a.includes(target));
4394
+ return String((_b = this.settings.scoItemIds) === null || _b === void 0 ? void 0 : _b.includes(target));
4377
4395
  }
4378
4396
  return String(request);
4379
4397
  }
@@ -4527,8 +4545,9 @@ var Scorm2004Impl = (function (_super) {
4527
4545
  var interaction_count = interaction.correct_responses._count;
4528
4546
  this.checkDuplicateChoiceResponse(interaction, value);
4529
4547
  var response_type = CorrectResponses[interaction.type];
4530
- if (typeof response_type.limit === "undefined" ||
4531
- interaction_count <= response_type.limit) {
4548
+ if (typeof response_type !== "undefined" &&
4549
+ (typeof response_type.limit === "undefined" ||
4550
+ interaction_count <= response_type.limit)) {
4532
4551
  this.checkValidResponseType(response_type, value, interaction.type);
4533
4552
  if ((this.lastErrorCode === "0" &&
4534
4553
  (!response_type.duplicate ||
@@ -4549,14 +4568,17 @@ var Scorm2004Impl = (function (_super) {
4549
4568
  return this._commonGetCMIValue("GetValue", true, CMIElement);
4550
4569
  };
4551
4570
  Scorm2004Impl.prototype.getLmsErrorMessageDetails = function (errorNumber, detail) {
4571
+ var _a, _b;
4552
4572
  var basicMessage = "";
4553
4573
  var detailMessage = "";
4554
4574
  errorNumber = String(errorNumber);
4555
4575
  if (api_constants.scorm2004_constants.error_descriptions[errorNumber]) {
4556
4576
  basicMessage =
4557
- api_constants.scorm2004_constants.error_descriptions[errorNumber].basicMessage;
4577
+ ((_a = api_constants.scorm2004_constants.error_descriptions[errorNumber]) === null || _a === void 0 ? void 0 : _a.basicMessage) ||
4578
+ "Unknown Error";
4558
4579
  detailMessage =
4559
- api_constants.scorm2004_constants.error_descriptions[errorNumber].detailMessage;
4580
+ ((_b = api_constants.scorm2004_constants.error_descriptions[errorNumber]) === null || _b === void 0 ? void 0 : _b.detailMessage) ||
4581
+ "";
4560
4582
  }
4561
4583
  return detail ? detailMessage : basicMessage;
4562
4584
  };
@@ -4572,7 +4594,7 @@ var Scorm2004Impl = (function (_super) {
4572
4594
  };
4573
4595
  Scorm2004Impl.prototype.checkCorrectResponseValue = function (interaction_type, nodes, value) {
4574
4596
  var response = CorrectResponses[interaction_type];
4575
- var formatRegex = new RegExp(response.format);
4597
+ var formatRegex = new RegExp((response === null || response === void 0 ? void 0 : response.format) || ".*");
4576
4598
  for (var i = 0; i < nodes.length && this.lastErrorCode === "0"; i++) {
4577
4599
  if (interaction_type.match("^(fill-in|long-fill-in|matching|performance|sequencing)$")) {
4578
4600
  nodes[i] = this.removeCorrectResponsePrefixes(nodes[i]);
@@ -4608,7 +4630,7 @@ var Scorm2004Impl = (function (_super) {
4608
4630
  }
4609
4631
  }
4610
4632
  else {
4611
- if (nodes[i] !== "" && response.unique) {
4633
+ if (nodes[i] !== "" && (response === null || response === void 0 ? void 0 : response.unique)) {
4612
4634
  for (var j = 0; j < i && this.lastErrorCode === "0"; j++) {
4613
4635
  if (nodes[i] === nodes[j]) {
4614
4636
  this.throwSCORMError(error_codes.scorm2004_errors.TYPE_MISMATCH);
@@ -4621,6 +4643,7 @@ var Scorm2004Impl = (function (_super) {
4621
4643
  }
4622
4644
  };
4623
4645
  Scorm2004Impl.prototype.removeCorrectResponsePrefixes = function (node) {
4646
+ var _a;
4624
4647
  var seenOrder = false;
4625
4648
  var seenCase = false;
4626
4649
  var seenLang = false;
@@ -4658,7 +4681,7 @@ var Scorm2004Impl = (function (_super) {
4658
4681
  seenOrder = true;
4659
4682
  break;
4660
4683
  }
4661
- node = node.substring(matches[1].length);
4684
+ node = node.substring(((_a = matches[1]) === null || _a === void 0 ? void 0 : _a.length) || 0);
4662
4685
  matches = node.match(prefixRegex);
4663
4686
  }
4664
4687
  return node;
@@ -5060,8 +5083,8 @@ function checkValidFormat(value, regexPattern, errorCode, errorClass, allowEmpty
5060
5083
  function checkValidRange(value, rangePattern, errorCode, errorClass) {
5061
5084
  var ranges = rangePattern.split("#");
5062
5085
  value = value * 1.0;
5063
- if (value >= ranges[0]) {
5064
- if (ranges[1] === "*" || value <= ranges[1]) {
5086
+ if (ranges[0] && value >= ranges[0]) {
5087
+ if (ranges[1] && (ranges[1] === "*" || value <= ranges[1])) {
5065
5088
  return true;
5066
5089
  }
5067
5090
  else {
@@ -6656,11 +6679,12 @@ var Scorm12ValidationError = (function (_super) {
6656
6679
  (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__extends)(Scorm12ValidationError, _super);
6657
6680
  function Scorm12ValidationError(errorCode) {
6658
6681
  var _this = this;
6682
+ var _a, _b, _c, _d, _e;
6659
6683
  if ({}.hasOwnProperty.call(scorm12_errors, String(errorCode))) {
6660
- _this = _super.call(this, errorCode, scorm12_errors[String(errorCode)].basicMessage, scorm12_errors[String(errorCode)].detailMessage) || this;
6684
+ _this = _super.call(this, errorCode, ((_a = scorm12_errors[String(errorCode)]) === null || _a === void 0 ? void 0 : _a.basicMessage) || "Unknown error", (_b = scorm12_errors[String(errorCode)]) === null || _b === void 0 ? void 0 : _b.detailMessage) || this;
6661
6685
  }
6662
6686
  else {
6663
- _this = _super.call(this, 101, scorm12_errors["101"].basicMessage, scorm12_errors["101"].detailMessage) || this;
6687
+ _this = _super.call(this, 101, (_d = (_c = scorm12_errors["101"]) === null || _c === void 0 ? void 0 : _c.basicMessage) !== null && _d !== void 0 ? _d : "General error", (_e = scorm12_errors["101"]) === null || _e === void 0 ? void 0 : _e.detailMessage) || this;
6664
6688
  }
6665
6689
  return _this;
6666
6690
  }
@@ -6730,7 +6754,7 @@ function getSecondsAsISODuration(seconds) {
6730
6754
  var duration = "P";
6731
6755
  var remainder = seconds;
6732
6756
  for (var designationsKey in designations) {
6733
- var current_seconds = designations[designationsKey];
6757
+ var current_seconds = designations[designationsKey] || 1;
6734
6758
  var value = Math.floor(remainder / current_seconds);
6735
6759
  remainder = remainder % current_seconds;
6736
6760
  if (countDecimals(remainder) > 2) {
@@ -6837,7 +6861,7 @@ function unflatten(data) {
6837
6861
  var m = regex.exec(p);
6838
6862
  while (m) {
6839
6863
  cur = cur[prop] || (cur[prop] = m[2] ? [] : {});
6840
- prop = m[2] || m[1];
6864
+ prop = m[2] || m[1] || "";
6841
6865
  m = regex.exec(p);
6842
6866
  }
6843
6867
  cur[prop] = data[p];
@@ -6849,7 +6873,7 @@ function countDecimals(num) {
6849
6873
  if (Math.floor(num) === num || String(num).indexOf(".") < 0)
6850
6874
  return 0;
6851
6875
  var parts = num.toString().split(".")[1];
6852
- return parts.length || 0;
6876
+ return (parts === null || parts === void 0 ? void 0 : parts.length) || 0;
6853
6877
  }
6854
6878
  function formatMessage(functionName, message, CMIElement) {
6855
6879
  var baseLength = 20;