scorm-again 3.1.3 → 3.1.5

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 (34) hide show
  1. package/dist/esm/scorm-again.js +1257 -236
  2. package/dist/esm/scorm-again.js.map +1 -1
  3. package/dist/esm/scorm-again.min.js +1 -1
  4. package/dist/esm/scorm-again.min.js.map +1 -1
  5. package/dist/esm/scorm12.js +14 -3
  6. package/dist/esm/scorm12.js.map +1 -1
  7. package/dist/esm/scorm12.min.js +1 -1
  8. package/dist/esm/scorm12.min.js.map +1 -1
  9. package/dist/esm/scorm2004.js +1257 -236
  10. package/dist/esm/scorm2004.js.map +1 -1
  11. package/dist/esm/scorm2004.min.js +1 -1
  12. package/dist/esm/scorm2004.min.js.map +1 -1
  13. package/dist/scorm-again.js +1619 -449
  14. package/dist/scorm-again.js.map +1 -1
  15. package/dist/scorm-again.min.js +1 -1
  16. package/dist/scorm12.js +54 -14
  17. package/dist/scorm12.js.map +1 -1
  18. package/dist/scorm12.min.js +1 -1
  19. package/dist/scorm2004.js +1614 -444
  20. package/dist/scorm2004.js.map +1 -1
  21. package/dist/scorm2004.min.js +1 -1
  22. package/dist/types/Scorm2004API.d.ts +12 -0
  23. package/dist/types/cmi/scorm2004/completion_status_evaluation.d.ts +7 -0
  24. package/dist/types/cmi/scorm2004/sequencing/activity.d.ts +47 -5
  25. package/dist/types/cmi/scorm2004/sequencing/handlers/rte_data_transfer.d.ts +1 -0
  26. package/dist/types/cmi/scorm2004/sequencing/handlers/termination_handler.d.ts +1 -0
  27. package/dist/types/cmi/scorm2004/sequencing/objectives/global_objective_synchronizer.d.ts +17 -1
  28. package/dist/types/cmi/scorm2004/sequencing/sequencing_rules.d.ts +6 -1
  29. package/dist/types/cmi/scorm2004/sequencing/traversal/flow_traversal_service.d.ts +5 -2
  30. package/dist/types/constants/regex.d.ts +1 -0
  31. package/dist/types/types/api_types.d.ts +12 -0
  32. package/dist/types/types/sequencing_types.d.ts +13 -0
  33. package/dist/types/utilities/core.d.ts +4 -1
  34. package/package.json +1 -1
package/dist/scorm2004.js CHANGED
@@ -1,7 +1,7 @@
1
1
  this.Scorm2004API = (function () {
2
2
  'use strict';
3
3
 
4
- function _array_like_to_array$f(arr, len) {
4
+ function _array_like_to_array$g(arr, len) {
5
5
  if (len == null || len > arr.length) len = arr.length;
6
6
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
7
7
  return arr2;
@@ -9,10 +9,10 @@ this.Scorm2004API = (function () {
9
9
  function _array_with_holes$6(arr) {
10
10
  if (Array.isArray(arr)) return arr;
11
11
  }
12
- function _array_without_holes$a(arr) {
13
- if (Array.isArray(arr)) return _array_like_to_array$f(arr);
12
+ function _array_without_holes$b(arr) {
13
+ if (Array.isArray(arr)) return _array_like_to_array$g(arr);
14
14
  }
15
- function _iterable_to_array$a(iter) {
15
+ function _iterable_to_array$b(iter) {
16
16
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
17
17
  }
18
18
  function _iterable_to_array_limit$6(arr, i) {
@@ -42,22 +42,22 @@ this.Scorm2004API = (function () {
42
42
  function _non_iterable_rest$6() {
43
43
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
44
44
  }
45
- function _non_iterable_spread$a() {
45
+ function _non_iterable_spread$b() {
46
46
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
47
47
  }
48
48
  function _sliced_to_array$6(arr, i) {
49
- return _array_with_holes$6(arr) || _iterable_to_array_limit$6(arr, i) || _unsupported_iterable_to_array$f(arr, i) || _non_iterable_rest$6();
49
+ return _array_with_holes$6(arr) || _iterable_to_array_limit$6(arr, i) || _unsupported_iterable_to_array$g(arr, i) || _non_iterable_rest$6();
50
50
  }
51
- function _to_consumable_array$a(arr) {
52
- return _array_without_holes$a(arr) || _iterable_to_array$a(arr) || _unsupported_iterable_to_array$f(arr) || _non_iterable_spread$a();
51
+ function _to_consumable_array$b(arr) {
52
+ return _array_without_holes$b(arr) || _iterable_to_array$b(arr) || _unsupported_iterable_to_array$g(arr) || _non_iterable_spread$b();
53
53
  }
54
- function _unsupported_iterable_to_array$f(o, minLen) {
54
+ function _unsupported_iterable_to_array$g(o, minLen) {
55
55
  if (!o) return;
56
- if (typeof o === "string") return _array_like_to_array$f(o, minLen);
56
+ if (typeof o === "string") return _array_like_to_array$g(o, minLen);
57
57
  var n = Object.prototype.toString.call(o).slice(8, -1);
58
58
  if (n === "Object" && o.constructor) n = o.constructor.name;
59
59
  if (n === "Map" || n === "Set") return Array.from(n);
60
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$f(o, minLen);
60
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$g(o, minLen);
61
61
  }
62
62
  var SECONDS_PER_SECOND = 1;
63
63
  var SECONDS_PER_MINUTE = 60;
@@ -213,15 +213,21 @@ this.Scorm2004API = (function () {
213
213
  }
214
214
  return new RegExp(tester).test(str);
215
215
  }
216
- function memoize(fn, keyFn) {
216
+ function memoize(fn, keyFn, options) {
217
217
  var cache = /* @__PURE__ */ new Map();
218
218
  return function() {
219
219
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
220
220
  args[_key] = arguments[_key];
221
221
  }
222
- var key = keyFn ? keyFn.apply(void 0, _to_consumable_array$a(args)) : JSON.stringify(args);
222
+ var key = keyFn ? keyFn.apply(void 0, _to_consumable_array$b(args)) : JSON.stringify(args);
223
+ if ((options === null || options === void 0 ? void 0 : options.maxKeyLength) !== void 0 && key.length > options.maxKeyLength) {
224
+ return fn.apply(void 0, _to_consumable_array$b(args));
225
+ }
223
226
  return cache.has(key) ? cache.get(key) : function() {
224
- var result = fn.apply(void 0, _to_consumable_array$a(args));
227
+ var result = fn.apply(void 0, _to_consumable_array$b(args));
228
+ if ((options === null || options === void 0 ? void 0 : options.maxEntries) !== void 0 && cache.size >= options.maxEntries) {
229
+ cache.delete(cache.keys().next().value);
230
+ }
225
231
  cache.set(key, result);
226
232
  return result;
227
233
  }();
@@ -1034,7 +1040,7 @@ this.Scorm2004API = (function () {
1034
1040
  }
1035
1041
  return target;
1036
1042
  }
1037
- function ownKeys$4(object, enumerableOnly) {
1043
+ function ownKeys$5(object, enumerableOnly) {
1038
1044
  var keys = Object.keys(object);
1039
1045
  if (Object.getOwnPropertySymbols) {
1040
1046
  var symbols = Object.getOwnPropertySymbols(object);
@@ -1042,12 +1048,12 @@ this.Scorm2004API = (function () {
1042
1048
  }
1043
1049
  return keys;
1044
1050
  }
1045
- function _object_spread_props$4(target, source) {
1051
+ function _object_spread_props$5(target, source) {
1046
1052
  source = source != null ? source : {};
1047
1053
  if (Object.getOwnPropertyDescriptors) {
1048
1054
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1049
1055
  } else {
1050
- ownKeys$4(Object(source)).forEach(function(key) {
1056
+ ownKeys$5(Object(source)).forEach(function(key) {
1051
1057
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1052
1058
  });
1053
1059
  }
@@ -1083,7 +1089,7 @@ this.Scorm2004API = (function () {
1083
1089
  VALUE_OUT_OF_RANGE: 101,
1084
1090
  DEPENDENCY_NOT_ESTABLISHED: 101
1085
1091
  };
1086
- var scorm12_errors = _object_spread_props$4(_object_spread$f({}, global_errors), {
1092
+ var scorm12_errors = _object_spread_props$5(_object_spread$f({}, global_errors), {
1087
1093
  RETRIEVE_BEFORE_INIT: 301,
1088
1094
  STORE_BEFORE_INIT: 301,
1089
1095
  COMMIT_BEFORE_INIT: 301,
@@ -1103,7 +1109,7 @@ this.Scorm2004API = (function () {
1103
1109
  VALUE_OUT_OF_RANGE: 405,
1104
1110
  DEPENDENCY_NOT_ESTABLISHED: 408
1105
1111
  });
1106
- var scorm2004_errors = _object_spread_props$4(_object_spread$f({}, global_errors), {
1112
+ var scorm2004_errors = _object_spread_props$5(_object_spread$f({}, global_errors), {
1107
1113
  INITIALIZATION_FAILED: 102,
1108
1114
  INITIALIZED: 103,
1109
1115
  TERMINATED: 104,
@@ -1685,6 +1691,7 @@ this.Scorm2004API = (function () {
1685
1691
  * Subtag: 2-8 alphanumeric characters
1686
1692
  */ CMILang: "^([a-zA-Z]{1,8}|i|x)(-[a-zA-Z0-9-]{2,8})?$|^$",
1687
1693
  /** CMILangString250 - String with optional language tag, max 250 chars (RTE C.1.3) */ CMILangString250: "^({lang=([a-zA-Z]{1,8}|i|x)(-[a-zA-Z0-9-]{2,8})?})?((?!{.*$).{0,250}$)?$",
1694
+ /** CMILangString - Optional language tag, no length cap; RTE C.1.3 SPM is a floor and is deliberately not enforced */ CMILangString: "^({lang=([a-zA-Z]{1,8}|i|x)(-[a-zA-Z0-9-]{2,8})?})?((?!{.*$).*$)?$",
1688
1695
  /** CMILangcr - Language tag pattern with content */ CMILangcr: "^(({lang=([a-zA-Z]{1,8}|i|x)?(-[a-zA-Z0-9-]{2,8})?}))(.*?)$",
1689
1696
  /** CMILangString250cr - String with optional language tag (carriage return variant) */ CMILangString250cr: "^(({lang=([a-zA-Z]{1,8}|i|x)?(-[a-zA-Z0-9-]{2,8})?})?(.{0,250})?)?$",
1690
1697
  /** CMILangString4000 - String with optional language tag, max 4000 chars (RTE C.1.3) */ CMILangString4000: "^({lang=([a-zA-Z]{1,8}|i|x)(-[a-zA-Z0-9-]{2,8})?})?((?!{.*$).{0,4000}$)?$",
@@ -2720,12 +2727,6 @@ this.Scorm2004API = (function () {
2720
2727
  var __publicField$11 = function __publicField(obj, key, value) {
2721
2728
  return __defNormalProp$11(obj, (typeof key === "undefined" ? "undefined" : _type_of$12(key)) !== "symbol" ? key + "" : key, value);
2722
2729
  };
2723
- var RuleConditionOperator = /* @__PURE__ */ function(RuleConditionOperator2) {
2724
- RuleConditionOperator2["NOT"] = "not";
2725
- RuleConditionOperator2["AND"] = "and";
2726
- RuleConditionOperator2["OR"] = "or";
2727
- return RuleConditionOperator2;
2728
- }(RuleConditionOperator || {});
2729
2730
  var RuleActionType = /* @__PURE__ */ function(RuleActionType2) {
2730
2731
  RuleActionType2["SKIP"] = "skip";
2731
2732
  RuleActionType2["DISABLED"] = "disabled";
@@ -2740,6 +2741,82 @@ this.Scorm2004API = (function () {
2740
2741
  RuleActionType2["EXIT"] = "exit";
2741
2742
  return RuleActionType2;
2742
2743
  }(RuleActionType || {});
2744
+ function kleeneNot(value) {
2745
+ if (value === "unknown") {
2746
+ return "unknown";
2747
+ }
2748
+ return !value;
2749
+ }
2750
+ function kleeneAnd(values) {
2751
+ var hasUnknown = false;
2752
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
2753
+ try {
2754
+ for(var _iterator = values[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
2755
+ var value = _step.value;
2756
+ if (value === false) {
2757
+ return false;
2758
+ }
2759
+ if (value === "unknown") {
2760
+ hasUnknown = true;
2761
+ }
2762
+ }
2763
+ } catch (err) {
2764
+ _didIteratorError = true;
2765
+ _iteratorError = err;
2766
+ } finally{
2767
+ try {
2768
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
2769
+ _iterator.return();
2770
+ }
2771
+ } finally{
2772
+ if (_didIteratorError) {
2773
+ throw _iteratorError;
2774
+ }
2775
+ }
2776
+ }
2777
+ return hasUnknown ? "unknown" : true;
2778
+ }
2779
+ function kleeneOr(values) {
2780
+ var hasUnknown = false;
2781
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
2782
+ try {
2783
+ for(var _iterator = values[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
2784
+ var value = _step.value;
2785
+ if (value === true) {
2786
+ return true;
2787
+ }
2788
+ if (value === "unknown") {
2789
+ hasUnknown = true;
2790
+ }
2791
+ }
2792
+ } catch (err) {
2793
+ _didIteratorError = true;
2794
+ _iteratorError = err;
2795
+ } finally{
2796
+ try {
2797
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
2798
+ _iterator.return();
2799
+ }
2800
+ } finally{
2801
+ if (_didIteratorError) {
2802
+ throw _iteratorError;
2803
+ }
2804
+ }
2805
+ }
2806
+ return hasUnknown ? "unknown" : false;
2807
+ }
2808
+ function combineRuleConditionResults(values, conditionCombination) {
2809
+ if (values.length === 0) {
2810
+ return false;
2811
+ }
2812
+ if (conditionCombination === "all" || conditionCombination === "and" /* AND */ ) {
2813
+ return kleeneAnd(values);
2814
+ }
2815
+ if (conditionCombination === "any" || conditionCombination === "or" /* OR */ ) {
2816
+ return kleeneOr(values);
2817
+ }
2818
+ return false;
2819
+ }
2743
2820
  var _RuleCondition = /*#__PURE__*/ function(BaseCMI) {
2744
2821
  _inherits$l(_RuleCondition, BaseCMI);
2745
2822
  function _RuleCondition() {
@@ -2845,53 +2922,74 @@ this.Scorm2004API = (function () {
2845
2922
  /**
2846
2923
  * Evaluate the condition for an activity
2847
2924
  * @param {Activity} activity - The activity to evaluate the condition for
2848
- * @return {boolean} - True if the condition is met, false otherwise
2925
+ * @return {RuleConditionEvaluation} - True, false, or unknown per SCORM 2004 4th Ed.
2849
2926
  */ key: "evaluate",
2850
2927
  value: function evaluate(activity) {
2851
2928
  var result;
2929
+ var hasReferencedObjective = this._referencedObjective !== null;
2852
2930
  var referencedObjective = this.resolveReferencedObjective(activity);
2853
2931
  switch(this._condition){
2854
2932
  case "satisfied" /* SATISFIED */ :
2855
2933
  case "objectiveSatisfied" /* OBJECTIVE_SATISFIED */ :
2856
- if (referencedObjective) {
2857
- result = referencedObjective.satisfiedStatus === true;
2934
+ if (hasReferencedObjective && !referencedObjective) {
2935
+ result = false;
2936
+ } else if (referencedObjective) {
2937
+ result = referencedObjective.satisfiedStatusKnown || referencedObjective.progressStatus ? referencedObjective.satisfiedStatus === true : "unknown";
2938
+ } else if (activity.objectiveSatisfiedStatusKnown) {
2939
+ result = activity.objectiveSatisfiedStatus === true;
2940
+ } else if (activity.successStatus !== SuccessStatus.UNKNOWN) {
2941
+ result = activity.successStatus === SuccessStatus.PASSED;
2858
2942
  } else {
2859
- result = activity.successStatus === SuccessStatus.PASSED || activity.objectiveSatisfiedStatus === true;
2943
+ result = "unknown";
2860
2944
  }
2861
2945
  break;
2862
2946
  case "objectiveStatusKnown" /* OBJECTIVE_STATUS_KNOWN */ :
2863
- result = referencedObjective ? !!referencedObjective.measureStatus : !!activity.objectiveMeasureStatus;
2947
+ result = hasReferencedObjective && !referencedObjective ? false : referencedObjective ? !!referencedObjective.satisfiedStatusKnown : !!activity.objectiveSatisfiedStatusKnown;
2864
2948
  break;
2865
2949
  case "objectiveMeasureKnown" /* OBJECTIVE_MEASURE_KNOWN */ :
2866
- result = referencedObjective ? !!referencedObjective.measureStatus : !!activity.objectiveMeasureStatus;
2950
+ result = hasReferencedObjective && !referencedObjective ? false : referencedObjective ? !!referencedObjective.measureStatus : !!activity.objectiveMeasureStatus;
2867
2951
  break;
2868
2952
  case "objectiveMeasureGreaterThan" /* OBJECTIVE_MEASURE_GREATER_THAN */ :
2869
2953
  {
2954
+ if (hasReferencedObjective && !referencedObjective) {
2955
+ result = false;
2956
+ break;
2957
+ }
2870
2958
  var greaterThanValue = this._parameters.get("threshold") || 0;
2871
2959
  var measureStatus = referencedObjective ? referencedObjective.measureStatus : activity.objectiveMeasureStatus;
2872
2960
  var measureValue = referencedObjective ? referencedObjective.normalizedMeasure : activity.objectiveNormalizedMeasure;
2873
- result = !!measureStatus && measureValue > greaterThanValue;
2961
+ result = measureStatus ? measureValue > greaterThanValue : "unknown";
2874
2962
  break;
2875
2963
  }
2876
2964
  case "objectiveMeasureLessThan" /* OBJECTIVE_MEASURE_LESS_THAN */ :
2877
2965
  {
2966
+ if (hasReferencedObjective && !referencedObjective) {
2967
+ result = false;
2968
+ break;
2969
+ }
2878
2970
  var lessThanValue = this._parameters.get("threshold") || 0;
2879
2971
  var measureStatus1 = referencedObjective ? referencedObjective.measureStatus : activity.objectiveMeasureStatus;
2880
2972
  var measureValue1 = referencedObjective ? referencedObjective.normalizedMeasure : activity.objectiveNormalizedMeasure;
2881
- result = !!measureStatus1 && measureValue1 < lessThanValue;
2973
+ result = measureStatus1 ? measureValue1 < lessThanValue : "unknown";
2882
2974
  break;
2883
2975
  }
2884
2976
  case "completed" /* COMPLETED */ :
2885
2977
  case "activityCompleted" /* ACTIVITY_COMPLETED */ :
2886
- if (referencedObjective) {
2887
- result = referencedObjective.completionStatus === CompletionStatus.COMPLETED;
2978
+ if (hasReferencedObjective && !referencedObjective) {
2979
+ result = false;
2980
+ } else if (referencedObjective) {
2981
+ result = referencedObjective.completionStatus === CompletionStatus.UNKNOWN ? "unknown" : referencedObjective.completionStatus === CompletionStatus.COMPLETED;
2982
+ } else if (activity.completionStatus === CompletionStatus.UNKNOWN) {
2983
+ result = "unknown";
2888
2984
  } else {
2889
- result = activity.isCompleted;
2985
+ result = activity.completionStatus === CompletionStatus.COMPLETED;
2890
2986
  }
2891
2987
  break;
2892
2988
  case "progressKnown" /* PROGRESS_KNOWN */ :
2893
2989
  case "activityProgressKnown" /* ACTIVITY_PROGRESS_KNOWN */ :
2894
- if (referencedObjective) {
2990
+ if (hasReferencedObjective && !referencedObjective) {
2991
+ result = false;
2992
+ } else if (referencedObjective) {
2895
2993
  result = referencedObjective.completionStatus !== CompletionStatus.UNKNOWN;
2896
2994
  } else {
2897
2995
  result = activity.completionStatus !== "unknown";
@@ -2920,7 +3018,7 @@ this.Scorm2004API = (function () {
2920
3018
  break;
2921
3019
  }
2922
3020
  if (this._operator === "not" /* NOT */ ) {
2923
- result = !result;
3021
+ result = kleeneNot(result);
2924
3022
  }
2925
3023
  return result;
2926
3024
  }
@@ -3169,19 +3267,9 @@ this.Scorm2004API = (function () {
3169
3267
  * @return {boolean} - True if the rule conditions are met, false otherwise
3170
3268
  */ key: "evaluate",
3171
3269
  value: function evaluate(activity) {
3172
- if (this._conditions.length === 0) {
3173
- return true;
3174
- }
3175
- if (this._conditionCombination === "all" || this._conditionCombination === "and" /* AND */ ) {
3176
- return this._conditions.every(function(condition) {
3177
- return condition.evaluate(activity);
3178
- });
3179
- } else if (this._conditionCombination === "any" || this._conditionCombination === "or" /* OR */ ) {
3180
- return this._conditions.some(function(condition) {
3181
- return condition.evaluate(activity);
3182
- });
3183
- }
3184
- return false;
3270
+ return combineRuleConditionResults(this._conditions.map(function(condition) {
3271
+ return condition.evaluate(activity);
3272
+ }), this._conditionCombination) === true;
3185
3273
  }
3186
3274
  },
3187
3275
  {
@@ -4415,23 +4503,10 @@ this.Scorm2004API = (function () {
4415
4503
  * Evaluates individual sequencing rule conditions
4416
4504
  * @param {Activity} activity - The activity to evaluate the rule for
4417
4505
  * @param {SequencingRule} rule - The rule to evaluate
4418
- * @return {boolean} - True if all rule conditions are met
4506
+ * @return {boolean} - True only when the rule evaluates to definite true
4419
4507
  */ key: "checkRuleSubprocess",
4420
4508
  value: function checkRuleSubprocess(activity, rule) {
4421
- if (rule.conditions.length === 0) {
4422
- return true;
4423
- }
4424
- var conditionCombination = rule.conditionCombination;
4425
- if (conditionCombination === "all" || conditionCombination === RuleConditionOperator.AND) {
4426
- return rule.conditions.every(function(condition) {
4427
- return condition.evaluate(activity);
4428
- });
4429
- } else if (conditionCombination === "any" || conditionCombination === RuleConditionOperator.OR) {
4430
- return rule.conditions.some(function(condition) {
4431
- return condition.evaluate(activity);
4432
- });
4433
- }
4434
- return false;
4509
+ return rule.evaluate(activity);
4435
4510
  }
4436
4511
  },
4437
4512
  {
@@ -5272,13 +5347,13 @@ this.Scorm2004API = (function () {
5272
5347
  return SequencingControls;
5273
5348
  }(BaseCMI);
5274
5349
 
5275
- function _array_like_to_array$e(arr, len) {
5350
+ function _array_like_to_array$f(arr, len) {
5276
5351
  if (len == null || len > arr.length) len = arr.length;
5277
5352
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
5278
5353
  return arr2;
5279
5354
  }
5280
- function _array_without_holes$9(arr) {
5281
- if (Array.isArray(arr)) return _array_like_to_array$e(arr);
5355
+ function _array_without_holes$a(arr) {
5356
+ if (Array.isArray(arr)) return _array_like_to_array$f(arr);
5282
5357
  }
5283
5358
  function _class_call_check$10(instance, Constructor) {
5284
5359
  if (!(instance instanceof Constructor)) {
@@ -5298,22 +5373,22 @@ this.Scorm2004API = (function () {
5298
5373
  if (staticProps) _defineProperties$10(Constructor, staticProps);
5299
5374
  return Constructor;
5300
5375
  }
5301
- function _iterable_to_array$9(iter) {
5376
+ function _iterable_to_array$a(iter) {
5302
5377
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
5303
5378
  }
5304
- function _non_iterable_spread$9() {
5379
+ function _non_iterable_spread$a() {
5305
5380
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5306
5381
  }
5307
- function _to_consumable_array$9(arr) {
5308
- return _array_without_holes$9(arr) || _iterable_to_array$9(arr) || _unsupported_iterable_to_array$e(arr) || _non_iterable_spread$9();
5382
+ function _to_consumable_array$a(arr) {
5383
+ return _array_without_holes$a(arr) || _iterable_to_array$a(arr) || _unsupported_iterable_to_array$f(arr) || _non_iterable_spread$a();
5309
5384
  }
5310
- function _unsupported_iterable_to_array$e(o, minLen) {
5385
+ function _unsupported_iterable_to_array$f(o, minLen) {
5311
5386
  if (!o) return;
5312
- if (typeof o === "string") return _array_like_to_array$e(o, minLen);
5387
+ if (typeof o === "string") return _array_like_to_array$f(o, minLen);
5313
5388
  var n = Object.prototype.toString.call(o).slice(8, -1);
5314
5389
  if (n === "Object" && o.constructor) n = o.constructor.name;
5315
5390
  if (n === "Map" || n === "Set") return Array.from(n);
5316
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$e(o, minLen);
5391
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$f(o, minLen);
5317
5392
  }
5318
5393
  var SelectionRandomization = /*#__PURE__*/ function() {
5319
5394
  function SelectionRandomization() {
@@ -5329,7 +5404,7 @@ this.Scorm2004API = (function () {
5329
5404
  * @return {Activity[]} - The selected child activities
5330
5405
  */ function selectChildrenProcess(activity) {
5331
5406
  var controls = activity.sequencingControls;
5332
- var children = _to_consumable_array$9(activity.children);
5407
+ var children = _to_consumable_array$a(activity.children);
5333
5408
  if (controls.selectionTiming === SelectionTiming.NEVER) {
5334
5409
  return children;
5335
5410
  }
@@ -5398,7 +5473,7 @@ this.Scorm2004API = (function () {
5398
5473
  */ function randomizeChildrenProcess(activity) {
5399
5474
  var _activity_children;
5400
5475
  var controls = activity.sequencingControls;
5401
- var children = _to_consumable_array$9(activity.children);
5476
+ var children = _to_consumable_array$a(activity.children);
5402
5477
  if (controls.randomizationTiming === RandomizationTiming.NEVER) {
5403
5478
  return children;
5404
5479
  }
@@ -5408,7 +5483,7 @@ this.Scorm2004API = (function () {
5408
5483
  if (!controls.randomizeChildren) {
5409
5484
  return children;
5410
5485
  }
5411
- var randomizedChildren = _to_consumable_array$9(children);
5486
+ var randomizedChildren = _to_consumable_array$a(children);
5412
5487
  for(var i = randomizedChildren.length - 1; i > 0; i--){
5413
5488
  var j = Math.floor(Math.random() * (i + 1));
5414
5489
  var tempI = randomizedChildren[i];
@@ -5422,7 +5497,7 @@ this.Scorm2004API = (function () {
5422
5497
  controls.reorderChildren = true;
5423
5498
  }
5424
5499
  activity.children.length = 0;
5425
- (_activity_children = activity.children).push.apply(_activity_children, _to_consumable_array$9(randomizedChildren));
5500
+ (_activity_children = activity.children).push.apply(_activity_children, _to_consumable_array$a(randomizedChildren));
5426
5501
  return randomizedChildren;
5427
5502
  }
5428
5503
  },
@@ -5557,13 +5632,17 @@ this.Scorm2004API = (function () {
5557
5632
  * @param {Activity} fromActivity - The activity to flow from
5558
5633
  * @param {FlowSubprocessMode} direction - The flow direction
5559
5634
  * @return {FlowSubprocessResult} - Result containing the deliverable activity
5635
+ * @spec SN Book: SB.2.3 (Flow Subprocess) - preserves the SB.2.1 effective traversal direction for SB.2.2.
5636
+ * @spec SN Book: SB.2.2 (Flow Activity Traversal Subprocess) - evaluates candidates using the effective direction returned by SB.2.1.
5560
5637
  */ key: "flowSubprocess",
5561
5638
  value: function flowSubprocess(fromActivity, direction) {
5562
5639
  var candidateActivity = fromActivity;
5563
5640
  var firstIteration = true;
5564
5641
  var lastCandidateHadNoChildren = false;
5642
+ var currentDirection = direction;
5643
+ var forwardOnlyCluster = null;
5565
5644
  while(candidateActivity){
5566
- var traversalResult = this.flowTreeTraversalSubprocess(candidateActivity, direction, firstIteration);
5645
+ var traversalResult = this.flowTreeTraversalSubprocess(candidateActivity, currentDirection, firstIteration, forwardOnlyCluster);
5567
5646
  if (!traversalResult.activity) {
5568
5647
  var exceptionCode = null;
5569
5648
  if (traversalResult.exception) {
@@ -5575,12 +5654,17 @@ this.Scorm2004API = (function () {
5575
5654
  }
5576
5655
  return new FlowSubprocessResult(candidateActivity, false, exceptionCode, traversalResult.endSequencingSession);
5577
5656
  }
5657
+ var effectiveDirection = traversalResult.direction || currentDirection;
5658
+ if (traversalResult.forwardOnlyCluster) {
5659
+ forwardOnlyCluster = traversalResult.forwardOnlyCluster;
5660
+ }
5578
5661
  lastCandidateHadNoChildren = traversalResult.activity.children.length > 0 && traversalResult.activity.getAvailableChildren().length === 0;
5579
- var deliverable = this.flowActivityTraversalSubprocess(traversalResult.activity, direction === FlowSubprocessMode.FORWARD, true, direction);
5662
+ var deliverable = this.flowActivityTraversalSubprocess(traversalResult.activity, effectiveDirection === FlowSubprocessMode.FORWARD, true, effectiveDirection);
5580
5663
  if (deliverable) {
5581
5664
  return new FlowSubprocessResult(deliverable, true, null, false);
5582
5665
  }
5583
5666
  candidateActivity = traversalResult.activity;
5667
+ currentDirection = effectiveDirection;
5584
5668
  firstIteration = false;
5585
5669
  }
5586
5670
  return new FlowSubprocessResult(null, false, null, false);
@@ -5593,12 +5677,14 @@ this.Scorm2004API = (function () {
5593
5677
  * @param {Activity} fromActivity - The activity to traverse from
5594
5678
  * @param {FlowSubprocessMode} direction - The traversal direction
5595
5679
  * @param {boolean} skipChildren - Whether to skip checking children
5680
+ * @param {Activity | null} forwardTraversalBoundary - Cluster boundary for an SB.2.1 forwardOnly direction reversal
5596
5681
  * @return {FlowTreeTraversalResult} - The next activity and flags
5682
+ * @spec SN Book: SB.2.1 (Flow Tree Traversal Subprocess) - backward traversal into a forwardOnly cluster selects the first available child and reverses traversal direction to Forward.
5597
5683
  */ key: "flowTreeTraversalSubprocess",
5598
5684
  value: function flowTreeTraversalSubprocess(fromActivity, direction) {
5599
- var skipChildren = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
5685
+ var skipChildren = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false, forwardTraversalBoundary = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null;
5600
5686
  if (direction === FlowSubprocessMode.FORWARD) {
5601
- return this.traverseForward(fromActivity, skipChildren);
5687
+ return this.traverseForward(fromActivity, skipChildren, forwardTraversalBoundary);
5602
5688
  } else {
5603
5689
  return this.traverseBackward(fromActivity);
5604
5690
  }
@@ -5609,10 +5695,19 @@ this.Scorm2004API = (function () {
5609
5695
  * Traverse forward in the activity tree
5610
5696
  * @param {Activity} fromActivity - Starting activity
5611
5697
  * @param {boolean} skipChildren - Whether to skip children
5698
+ * @param {Activity | null} forwardTraversalBoundary - Cluster boundary for an SB.2.1 forwardOnly direction reversal
5612
5699
  * @return {FlowTreeTraversalResult}
5700
+ * @spec SN Book: SB.2.1 (Flow Tree Traversal Subprocess) - a reversed Forward traversal from a forwardOnly cluster remains within that cluster.
5613
5701
  */ key: "traverseForward",
5614
5702
  value: function traverseForward(fromActivity, skipChildren) {
5615
- if (skipChildren && this.isActivityLastOverall(fromActivity)) {
5703
+ var forwardTraversalBoundary = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null;
5704
+ if (forwardTraversalBoundary && !this.isDescendantOfOrSelf(fromActivity, forwardTraversalBoundary)) {
5705
+ return {
5706
+ activity: null,
5707
+ endSequencingSession: false
5708
+ };
5709
+ }
5710
+ if (!forwardTraversalBoundary && skipChildren && this.isActivityLastOverall(fromActivity)) {
5616
5711
  if (this.activityTree.root) {
5617
5712
  this.terminateDescendentAttempts(this.activityTree.root);
5618
5713
  }
@@ -5640,6 +5735,12 @@ this.Scorm2004API = (function () {
5640
5735
  endSequencingSession: false
5641
5736
  };
5642
5737
  }
5738
+ if (forwardTraversalBoundary && (current === forwardTraversalBoundary || current.parent === forwardTraversalBoundary)) {
5739
+ return {
5740
+ activity: null,
5741
+ endSequencingSession: false
5742
+ };
5743
+ }
5643
5744
  current = current.parent;
5644
5745
  }
5645
5746
  if (this.activityTree.root) {
@@ -5656,6 +5757,7 @@ this.Scorm2004API = (function () {
5656
5757
  * Traverse backward in the activity tree
5657
5758
  * @param {Activity} fromActivity - Starting activity
5658
5759
  * @return {FlowTreeTraversalResult}
5760
+ * @spec SN Book: SB.2.1 (Flow Tree Traversal Subprocess) - backward traversal into a forwardOnly cluster selects the first available child and reverses traversal direction to Forward.
5659
5761
  */ key: "traverseBackward",
5660
5762
  value: function traverseBackward(fromActivity) {
5661
5763
  if (fromActivity.parent && fromActivity.parent.sequencingControls.forwardOnly) {
@@ -5667,10 +5769,7 @@ this.Scorm2004API = (function () {
5667
5769
  }
5668
5770
  var previousSibling = this.activityTree.getPreviousSibling(fromActivity);
5669
5771
  if (previousSibling) {
5670
- return {
5671
- activity: this.getLastDescendant(previousSibling),
5672
- endSequencingSession: false
5673
- };
5772
+ return this.getBackwardTraversalEntry(previousSibling);
5674
5773
  }
5675
5774
  var current = fromActivity;
5676
5775
  var ancestorIterations = 0;
@@ -5681,10 +5780,7 @@ this.Scorm2004API = (function () {
5681
5780
  }
5682
5781
  var parentPreviousSibling = this.activityTree.getPreviousSibling(current.parent);
5683
5782
  if (parentPreviousSibling) {
5684
- return {
5685
- activity: this.getLastDescendant(parentPreviousSibling),
5686
- endSequencingSession: false
5687
- };
5783
+ return this.getBackwardTraversalEntry(parentPreviousSibling);
5688
5784
  }
5689
5785
  current = current.parent;
5690
5786
  }
@@ -5696,28 +5792,59 @@ this.Scorm2004API = (function () {
5696
5792
  },
5697
5793
  {
5698
5794
  /**
5699
- * Get the last descendant of an activity
5795
+ * Get the activity entered by backward traversal.
5700
5796
  * @param {Activity} activity - The activity
5701
- * @return {Activity} - The last descendant
5702
- */ key: "getLastDescendant",
5703
- value: function getLastDescendant(activity) {
5704
- var lastDescendant = activity;
5797
+ * @return {FlowTreeTraversalResult} - The entered activity and effective direction
5798
+ * @spec SN Book: SB.2.1 (Flow Tree Traversal Subprocess) - entering a forwardOnly cluster while moving Backward uses the first available child and changes direction to Forward.
5799
+ */ key: "getBackwardTraversalEntry",
5800
+ value: function getBackwardTraversalEntry(activity) {
5801
+ var enteredActivity = activity;
5705
5802
  var iterations = 0;
5706
5803
  var maxIterations = 1e4;
5707
5804
  while(true){
5708
5805
  if (++iterations > maxIterations) {
5709
- throw new Error("Infinite loop detected while getting last descendant");
5806
+ throw new Error("Infinite loop detected while getting backward traversal entry");
5710
5807
  }
5711
- this.ensureSelectionAndRandomization(lastDescendant);
5712
- var children = lastDescendant.getAvailableChildren();
5808
+ this.ensureSelectionAndRandomization(enteredActivity);
5809
+ var children = enteredActivity.getAvailableChildren();
5713
5810
  if (children.length === 0) {
5714
5811
  break;
5715
5812
  }
5813
+ if (enteredActivity.sequencingControls.forwardOnly) {
5814
+ return {
5815
+ activity: children[0] || null,
5816
+ endSequencingSession: false,
5817
+ direction: FlowSubprocessMode.FORWARD,
5818
+ forwardOnlyCluster: enteredActivity
5819
+ };
5820
+ }
5716
5821
  var lastChild = children[children.length - 1];
5717
5822
  if (!lastChild) break;
5718
- lastDescendant = lastChild;
5823
+ enteredActivity = lastChild;
5824
+ }
5825
+ return {
5826
+ activity: enteredActivity,
5827
+ endSequencingSession: false
5828
+ };
5829
+ }
5830
+ },
5831
+ {
5832
+ /**
5833
+ * Check whether an activity is the same as or beneath an ancestor.
5834
+ * @param {Activity} activity - The activity to check
5835
+ * @param {Activity} ancestor - The expected ancestor
5836
+ * @return {boolean} - True when activity is within ancestor
5837
+ * @spec SN Book: SB.2.1 (Flow Tree Traversal Subprocess) - bounds Forward traversal after a forwardOnly direction reversal to the entered cluster.
5838
+ */ key: "isDescendantOfOrSelf",
5839
+ value: function isDescendantOfOrSelf(activity, ancestor) {
5840
+ var current = activity;
5841
+ while(current){
5842
+ if (current === ancestor) {
5843
+ return true;
5844
+ }
5845
+ current = current.parent;
5719
5846
  }
5720
- return lastDescendant;
5847
+ return false;
5721
5848
  }
5722
5849
  },
5723
5850
  {
@@ -7359,7 +7486,7 @@ this.Scorm2004API = (function () {
7359
7486
  }
7360
7487
  return target;
7361
7488
  }
7362
- function ownKeys$3(object, enumerableOnly) {
7489
+ function ownKeys$4(object, enumerableOnly) {
7363
7490
  var keys = Object.keys(object);
7364
7491
  if (Object.getOwnPropertySymbols) {
7365
7492
  var symbols = Object.getOwnPropertySymbols(object);
@@ -7367,12 +7494,12 @@ this.Scorm2004API = (function () {
7367
7494
  }
7368
7495
  return keys;
7369
7496
  }
7370
- function _object_spread_props$3(target, source) {
7497
+ function _object_spread_props$4(target, source) {
7371
7498
  source = source != null ? source : {};
7372
7499
  if (Object.getOwnPropertyDescriptors) {
7373
7500
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
7374
7501
  } else {
7375
- ownKeys$3(Object(source)).forEach(function(key) {
7502
+ ownKeys$4(Object(source)).forEach(function(key) {
7376
7503
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
7377
7504
  });
7378
7505
  }
@@ -7656,7 +7783,7 @@ this.Scorm2004API = (function () {
7656
7783
  method: "POST",
7657
7784
  mode: this.settings.fetchMode,
7658
7785
  body: body,
7659
- headers: _object_spread_props$3(_object_spread$c({}, this.settings.xhrHeaders), {
7786
+ headers: _object_spread_props$4(_object_spread$c({}, this.settings.xhrHeaders), {
7660
7787
  "Content-Type": contentType
7661
7788
  }),
7662
7789
  keepalive: true
@@ -9057,7 +9184,7 @@ this.Scorm2004API = (function () {
9057
9184
  }
9058
9185
  return target;
9059
9186
  }
9060
- function ownKeys$2(object, enumerableOnly) {
9187
+ function ownKeys$3(object, enumerableOnly) {
9061
9188
  var keys = Object.keys(object);
9062
9189
  if (Object.getOwnPropertySymbols) {
9063
9190
  var symbols = Object.getOwnPropertySymbols(object);
@@ -9065,12 +9192,12 @@ this.Scorm2004API = (function () {
9065
9192
  }
9066
9193
  return keys;
9067
9194
  }
9068
- function _object_spread_props$2(target, source) {
9195
+ function _object_spread_props$3(target, source) {
9069
9196
  source = source != null ? source : {};
9070
9197
  if (Object.getOwnPropertyDescriptors) {
9071
9198
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
9072
9199
  } else {
9073
- ownKeys$2(Object(source)).forEach(function(key) {
9200
+ ownKeys$3(Object(source)).forEach(function(key) {
9074
9201
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
9075
9202
  });
9076
9203
  }
@@ -9543,7 +9670,7 @@ this.Scorm2004API = (function () {
9543
9670
  method: "POST",
9544
9671
  mode: this.settings.fetchMode,
9545
9672
  body: JSON.stringify(processedData),
9546
- headers: _object_spread_props$2(_object_spread$b({}, this.settings.xhrHeaders), {
9673
+ headers: _object_spread_props$3(_object_spread$b({}, this.settings.xhrHeaders), {
9547
9674
  "Content-Type": this.settings.commitRequestDataType
9548
9675
  })
9549
9676
  };
@@ -9732,6 +9859,10 @@ this.Scorm2004API = (function () {
9732
9859
  function(CMIElement, value, regexPattern, errorCode, _errorClass, allowEmptyString) {
9733
9860
  var valueKey = typeof value === "string" ? value : "[".concat(typeof value === "undefined" ? "undefined" : _type_of$L(value), "]");
9734
9861
  return "".concat(CMIElement, ":").concat(valueKey, ":").concat(regexPattern, ":").concat(errorCode, ":").concat(allowEmptyString || false);
9862
+ }, // Normal capped CMI values and regexes fit within 2000 characters; large uncapped values bypass caching.
9863
+ {
9864
+ maxEntries: 1e3,
9865
+ maxKeyLength: 2e3
9735
9866
  });
9736
9867
  var checkValidRange = memoize(function(CMIElement, value, rangePattern, errorCode, errorClass) {
9737
9868
  var ranges = rangePattern.split("#");
@@ -9754,6 +9885,8 @@ this.Scorm2004API = (function () {
9754
9885
  // since it can't be stringified and doesn't affect the validation result
9755
9886
  function(CMIElement, value, rangePattern, errorCode, _errorClass) {
9756
9887
  return "".concat(CMIElement, ":").concat(value, ":").concat(rangePattern, ":").concat(errorCode);
9888
+ }, {
9889
+ maxEntries: 1e3
9757
9890
  });
9758
9891
 
9759
9892
  function check2004ValidFormat(CMIElement, value, regexPattern, allowEmptyString) {
@@ -10422,13 +10555,13 @@ this.Scorm2004API = (function () {
10422
10555
  return RollupRules;
10423
10556
  }(BaseCMI);
10424
10557
 
10425
- function _array_like_to_array$d(arr, len) {
10558
+ function _array_like_to_array$e(arr, len) {
10426
10559
  if (len == null || len > arr.length) len = arr.length;
10427
10560
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
10428
10561
  return arr2;
10429
10562
  }
10430
- function _array_without_holes$8(arr) {
10431
- if (Array.isArray(arr)) return _array_like_to_array$d(arr);
10563
+ function _array_without_holes$9(arr) {
10564
+ if (Array.isArray(arr)) return _array_like_to_array$e(arr);
10432
10565
  }
10433
10566
  function _assert_this_initialized$i(self) {
10434
10567
  if (self === void 0) {
@@ -10515,10 +10648,10 @@ this.Scorm2004API = (function () {
10515
10648
  return left instanceof right;
10516
10649
  }
10517
10650
  }
10518
- function _iterable_to_array$8(iter) {
10651
+ function _iterable_to_array$9(iter) {
10519
10652
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
10520
10653
  }
10521
- function _non_iterable_spread$8() {
10654
+ function _non_iterable_spread$9() {
10522
10655
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
10523
10656
  }
10524
10657
  function _object_spread$a(target) {
@@ -10556,20 +10689,20 @@ this.Scorm2004API = (function () {
10556
10689
  }
10557
10690
  return object;
10558
10691
  }
10559
- function _to_consumable_array$8(arr) {
10560
- return _array_without_holes$8(arr) || _iterable_to_array$8(arr) || _unsupported_iterable_to_array$d(arr) || _non_iterable_spread$8();
10692
+ function _to_consumable_array$9(arr) {
10693
+ return _array_without_holes$9(arr) || _iterable_to_array$9(arr) || _unsupported_iterable_to_array$e(arr) || _non_iterable_spread$9();
10561
10694
  }
10562
10695
  function _type_of$J(obj) {
10563
10696
  "@swc/helpers - typeof";
10564
10697
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
10565
10698
  }
10566
- function _unsupported_iterable_to_array$d(o, minLen) {
10699
+ function _unsupported_iterable_to_array$e(o, minLen) {
10567
10700
  if (!o) return;
10568
- if (typeof o === "string") return _array_like_to_array$d(o, minLen);
10701
+ if (typeof o === "string") return _array_like_to_array$e(o, minLen);
10569
10702
  var n = Object.prototype.toString.call(o).slice(8, -1);
10570
10703
  if (n === "Object" && o.constructor) n = o.constructor.name;
10571
10704
  if (n === "Map" || n === "Set") return Array.from(n);
10572
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$d(o, minLen);
10705
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$e(o, minLen);
10573
10706
  }
10574
10707
  function _is_native_reflect_construct$i() {
10575
10708
  try {
@@ -10608,6 +10741,12 @@ this.Scorm2004API = (function () {
10608
10741
  // objectives. It serves as a validity gate for other synced properties.
10609
10742
  __publicField$J(this, "_measureStatus", false);
10610
10743
  __publicField$J(this, "_normalizedMeasure", 0);
10744
+ __publicField$J(this, "_rawScore", "");
10745
+ __publicField$J(this, "_rawScoreKnown", false);
10746
+ __publicField$J(this, "_minScore", "");
10747
+ __publicField$J(this, "_minScoreKnown", false);
10748
+ __publicField$J(this, "_maxScore", "");
10749
+ __publicField$J(this, "_maxScoreKnown", false);
10611
10750
  __publicField$J(this, "_progressMeasure", 0);
10612
10751
  __publicField$J(this, "_progressMeasureStatus", false);
10613
10752
  __publicField$J(this, "_completionStatus", CompletionStatus.UNKNOWN);
@@ -10617,11 +10756,14 @@ this.Scorm2004API = (function () {
10617
10756
  __publicField$J(this, "_normalizedMeasureDirty", false);
10618
10757
  __publicField$J(this, "_completionStatusDirty", false);
10619
10758
  __publicField$J(this, "_progressMeasureDirty", false);
10759
+ __publicField$J(this, "_rawScoreDirty", false);
10760
+ __publicField$J(this, "_minScoreDirty", false);
10761
+ __publicField$J(this, "_maxScoreDirty", false);
10620
10762
  this._id = id;
10621
10763
  this._description = (_options_description = options.description) !== null && _options_description !== void 0 ? _options_description : null;
10622
10764
  this._satisfiedByMeasure = (_options_satisfiedByMeasure = options.satisfiedByMeasure) !== null && _options_satisfiedByMeasure !== void 0 ? _options_satisfiedByMeasure : false;
10623
10765
  this._minNormalizedMeasure = (_options_minNormalizedMeasure = options.minNormalizedMeasure) !== null && _options_minNormalizedMeasure !== void 0 ? _options_minNormalizedMeasure : null;
10624
- this._mapInfo = options.mapInfo ? _to_consumable_array$8(options.mapInfo) : [];
10766
+ this._mapInfo = options.mapInfo ? _to_consumable_array$9(options.mapInfo) : [];
10625
10767
  this._isPrimary = (_options_isPrimary = options.isPrimary) !== null && _options_isPrimary !== void 0 ? _options_isPrimary : false;
10626
10768
  }
10627
10769
  _create_class$N(ActivityObjective, [
@@ -10661,7 +10803,7 @@ this.Scorm2004API = (function () {
10661
10803
  return this._mapInfo;
10662
10804
  },
10663
10805
  set: function set(mapInfo) {
10664
- this._mapInfo = _to_consumable_array$8(mapInfo);
10806
+ this._mapInfo = _to_consumable_array$9(mapInfo);
10665
10807
  }
10666
10808
  },
10667
10809
  {
@@ -10682,6 +10824,8 @@ this.Scorm2004API = (function () {
10682
10824
  if (this._satisfiedStatus !== value) {
10683
10825
  this._satisfiedStatus = value;
10684
10826
  this._satisfiedStatusDirty = true;
10827
+ this._satisfiedStatusKnown = true;
10828
+ this._progressStatus = true;
10685
10829
  }
10686
10830
  }
10687
10831
  },
@@ -10715,6 +10859,120 @@ this.Scorm2004API = (function () {
10715
10859
  }
10716
10860
  }
10717
10861
  },
10862
+ {
10863
+ key: "rawScore",
10864
+ get: /**
10865
+ * Return the known raw score value held for ADLSEQ objective score mapping.
10866
+ *
10867
+ * @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - raw score mapInfo
10868
+ */ function get() {
10869
+ return this._rawScore;
10870
+ },
10871
+ set: /**
10872
+ * Store the RTE raw score associated with this objective.
10873
+ *
10874
+ * @spec SCORM 2004 4th Ed. SN 3.10.3 / ADLSEQ objectives extension - raw score mapInfo
10875
+ */ function set(value) {
10876
+ if (this._rawScore !== value) {
10877
+ this._rawScore = value;
10878
+ this._rawScoreDirty = true;
10879
+ }
10880
+ this._rawScoreKnown = value !== "";
10881
+ }
10882
+ },
10883
+ {
10884
+ key: "rawScoreKnown",
10885
+ get: /**
10886
+ * Return whether this objective's raw score is known.
10887
+ *
10888
+ * @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - raw score known state
10889
+ */ function get() {
10890
+ return this._rawScoreKnown;
10891
+ },
10892
+ set: /**
10893
+ * Set whether this objective's raw score is known.
10894
+ *
10895
+ * @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - raw score known state
10896
+ */ function set(value) {
10897
+ this._rawScoreKnown = value;
10898
+ }
10899
+ },
10900
+ {
10901
+ key: "minScore",
10902
+ get: /**
10903
+ * Return the known minimum score value held for ADLSEQ objective score mapping.
10904
+ *
10905
+ * @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - min score mapInfo
10906
+ */ function get() {
10907
+ return this._minScore;
10908
+ },
10909
+ set: /**
10910
+ * Store the RTE minimum score associated with this objective.
10911
+ *
10912
+ * @spec SCORM 2004 4th Ed. SN 3.10.3 / ADLSEQ objectives extension - min score mapInfo
10913
+ */ function set(value) {
10914
+ if (this._minScore !== value) {
10915
+ this._minScore = value;
10916
+ this._minScoreDirty = true;
10917
+ }
10918
+ this._minScoreKnown = value !== "";
10919
+ }
10920
+ },
10921
+ {
10922
+ key: "minScoreKnown",
10923
+ get: /**
10924
+ * Return whether this objective's minimum score is known.
10925
+ *
10926
+ * @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - min score known state
10927
+ */ function get() {
10928
+ return this._minScoreKnown;
10929
+ },
10930
+ set: /**
10931
+ * Set whether this objective's minimum score is known.
10932
+ *
10933
+ * @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - min score known state
10934
+ */ function set(value) {
10935
+ this._minScoreKnown = value;
10936
+ }
10937
+ },
10938
+ {
10939
+ key: "maxScore",
10940
+ get: /**
10941
+ * Return the known maximum score value held for ADLSEQ objective score mapping.
10942
+ *
10943
+ * @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - max score mapInfo
10944
+ */ function get() {
10945
+ return this._maxScore;
10946
+ },
10947
+ set: /**
10948
+ * Store the RTE maximum score associated with this objective.
10949
+ *
10950
+ * @spec SCORM 2004 4th Ed. SN 3.10.3 / ADLSEQ objectives extension - max score mapInfo
10951
+ */ function set(value) {
10952
+ if (this._maxScore !== value) {
10953
+ this._maxScore = value;
10954
+ this._maxScoreDirty = true;
10955
+ }
10956
+ this._maxScoreKnown = value !== "";
10957
+ }
10958
+ },
10959
+ {
10960
+ key: "maxScoreKnown",
10961
+ get: /**
10962
+ * Return whether this objective's maximum score is known.
10963
+ *
10964
+ * @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - max score known state
10965
+ */ function get() {
10966
+ return this._maxScoreKnown;
10967
+ },
10968
+ set: /**
10969
+ * Set whether this objective's maximum score is known.
10970
+ *
10971
+ * @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - max score known state
10972
+ */ function set(value) {
10973
+ this._maxScoreKnown = value;
10974
+ }
10975
+ },
10718
10976
  {
10719
10977
  key: "progressMeasure",
10720
10978
  get: function get() {
@@ -10758,7 +11016,11 @@ this.Scorm2004API = (function () {
10758
11016
  }
10759
11017
  },
10760
11018
  {
10761
- key: "isDirty",
11019
+ /**
11020
+ * Report whether a local objective field has changed since the last global write.
11021
+ *
11022
+ * @spec SCORM 2004 4th Ed. SN 3.10.3 / ADLSEQ objectives extension - write maps use known local objective data
11023
+ */ key: "isDirty",
10762
11024
  value: function isDirty(property) {
10763
11025
  switch(property){
10764
11026
  case "satisfiedStatus":
@@ -10769,11 +11031,21 @@ this.Scorm2004API = (function () {
10769
11031
  return this._completionStatusDirty;
10770
11032
  case "progressMeasure":
10771
11033
  return this._progressMeasureDirty;
11034
+ case "rawScore":
11035
+ return this._rawScoreDirty;
11036
+ case "minScore":
11037
+ return this._minScoreDirty;
11038
+ case "maxScore":
11039
+ return this._maxScoreDirty;
10772
11040
  }
10773
11041
  }
10774
11042
  },
10775
11043
  {
10776
- key: "clearDirty",
11044
+ /**
11045
+ * Clear a local objective dirty flag after a successful global write.
11046
+ *
11047
+ * @spec SCORM 2004 4th Ed. SN 3.10.3 / ADLSEQ objectives extension - write maps update global objective state
11048
+ */ key: "clearDirty",
10777
11049
  value: function clearDirty(property) {
10778
11050
  switch(property){
10779
11051
  case "satisfiedStatus":
@@ -10788,16 +11060,33 @@ this.Scorm2004API = (function () {
10788
11060
  case "progressMeasure":
10789
11061
  this._progressMeasureDirty = false;
10790
11062
  break;
11063
+ case "rawScore":
11064
+ this._rawScoreDirty = false;
11065
+ break;
11066
+ case "minScore":
11067
+ this._minScoreDirty = false;
11068
+ break;
11069
+ case "maxScore":
11070
+ this._maxScoreDirty = false;
11071
+ break;
10791
11072
  }
10792
11073
  }
10793
11074
  },
10794
11075
  {
10795
- key: "clearAllDirty",
11076
+ /**
11077
+ * Clear all write-map dirty flags for this objective.
11078
+ *
11079
+ * @spec SCORM 2004 4th Ed. SN 3.10.3 - objective mapInfo writes are field-specific
11080
+ * @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - score mapInfo writes are field-specific
11081
+ */ key: "clearAllDirty",
10796
11082
  value: function clearAllDirty() {
10797
11083
  this._satisfiedStatusDirty = false;
10798
11084
  this._normalizedMeasureDirty = false;
10799
11085
  this._completionStatusDirty = false;
10800
11086
  this._progressMeasureDirty = false;
11087
+ this._rawScoreDirty = false;
11088
+ this._minScoreDirty = false;
11089
+ this._maxScoreDirty = false;
10801
11090
  }
10802
11091
  },
10803
11092
  {
@@ -10809,6 +11098,8 @@ this.Scorm2004API = (function () {
10809
11098
  * @param satisfiedStatus - The satisfied status from CMI
10810
11099
  * @param normalizedMeasure - The normalized measure from CMI
10811
11100
  * @param measureStatus - Whether measure is valid
11101
+ *
11102
+ * @spec SCORM 2004 4th Ed. RTE-to-SN Data Transfer - objective satisfaction and measure transfer
10812
11103
  */ key: "initializeFromCMI",
10813
11104
  value: function initializeFromCMI(satisfiedStatus, normalizedMeasure, measureStatus) {
10814
11105
  this._satisfiedStatus = satisfiedStatus;
@@ -10819,12 +11110,86 @@ this.Scorm2004API = (function () {
10819
11110
  }
10820
11111
  },
10821
11112
  {
10822
- key: "resetState",
11113
+ /**
11114
+ * Initialize raw/min/max objective score values from RTE data transfer.
11115
+ *
11116
+ * @spec SCORM 2004 4th Ed. RTE-to-SN Data Transfer - objective score transfer
11117
+ * @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - raw/min/max score mapInfo writes
11118
+ */ key: "initializeScoreFromCMI",
11119
+ value: function initializeScoreFromCMI(score) {
11120
+ if (score.rawScore !== void 0 && score.rawScore !== "") {
11121
+ this._rawScore = score.rawScore;
11122
+ this._rawScoreKnown = true;
11123
+ this._rawScoreDirty = true;
11124
+ }
11125
+ if (score.minScore !== void 0 && score.minScore !== "") {
11126
+ this._minScore = score.minScore;
11127
+ this._minScoreKnown = true;
11128
+ this._minScoreDirty = true;
11129
+ }
11130
+ if (score.maxScore !== void 0 && score.maxScore !== "") {
11131
+ this._maxScore = score.maxScore;
11132
+ this._maxScoreKnown = true;
11133
+ this._maxScoreDirty = true;
11134
+ }
11135
+ }
11136
+ },
11137
+ {
11138
+ /**
11139
+ * Apply read-mapped global objective state without marking the values dirty.
11140
+ *
11141
+ * @spec SCORM 2004 4th Ed. SN 3.10.3 - read maps provide access to global objective state
11142
+ * @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - score read maps are access-only
11143
+ */ key: "applyReadMappedState",
11144
+ value: function applyReadMappedState(state) {
11145
+ if (state.satisfiedStatus !== void 0) {
11146
+ this._satisfiedStatus = state.satisfiedStatus;
11147
+ this._satisfiedStatusKnown = true;
11148
+ this._progressStatus = true;
11149
+ }
11150
+ if (state.normalizedMeasure !== void 0) {
11151
+ this._normalizedMeasure = state.normalizedMeasure;
11152
+ this._measureStatus = true;
11153
+ }
11154
+ if (state.completionStatus !== void 0) {
11155
+ this._completionStatus = state.completionStatus;
11156
+ }
11157
+ if (state.progressMeasure !== void 0) {
11158
+ this._progressMeasure = state.progressMeasure;
11159
+ this._progressMeasureStatus = true;
11160
+ }
11161
+ if (state.rawScore !== void 0) {
11162
+ this._rawScore = state.rawScore;
11163
+ this._rawScoreKnown = true;
11164
+ }
11165
+ if (state.minScore !== void 0) {
11166
+ this._minScore = state.minScore;
11167
+ this._minScoreKnown = true;
11168
+ }
11169
+ if (state.maxScore !== void 0) {
11170
+ this._maxScore = state.maxScore;
11171
+ this._maxScoreKnown = true;
11172
+ }
11173
+ }
11174
+ },
11175
+ {
11176
+ /**
11177
+ * Reset local objective state for a fresh activity attempt.
11178
+ *
11179
+ * @spec SCORM 2004 4th Ed. SN 3.10 Objective Description - unknown objective state before tracking data exists
11180
+ * @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - score map fields are unknown until transferred or read
11181
+ */ key: "resetState",
10823
11182
  value: function resetState() {
10824
11183
  this._satisfiedStatus = false;
10825
11184
  this._satisfiedStatusKnown = false;
10826
11185
  this._measureStatus = false;
10827
11186
  this._normalizedMeasure = 0;
11187
+ this._rawScore = "";
11188
+ this._rawScoreKnown = false;
11189
+ this._minScore = "";
11190
+ this._minScoreKnown = false;
11191
+ this._maxScore = "";
11192
+ this._maxScoreKnown = false;
10828
11193
  this._progressMeasure = 0;
10829
11194
  this._progressMeasureStatus = false;
10830
11195
  this._completionStatus = CompletionStatus.UNKNOWN;
@@ -10833,7 +11198,11 @@ this.Scorm2004API = (function () {
10833
11198
  }
10834
11199
  },
10835
11200
  {
10836
- key: "updateFromActivity",
11201
+ /**
11202
+ * Copy primary activity objective state back into the primary objective model.
11203
+ *
11204
+ * @spec SCORM 2004 4th Ed. RTE-to-SN Data Transfer - primary objective state is available to sequencing
11205
+ */ key: "updateFromActivity",
10837
11206
  value: function updateFromActivity(activity) {
10838
11207
  if (this._satisfiedStatus !== activity.objectiveSatisfiedStatus) {
10839
11208
  this._satisfiedStatus = activity.objectiveSatisfiedStatus;
@@ -10857,12 +11226,16 @@ this.Scorm2004API = (function () {
10857
11226
  }
10858
11227
  },
10859
11228
  {
10860
- key: "applyToActivity",
11229
+ /**
11230
+ * Apply primary objective state to the owning activity for sequencing rules and rollup.
11231
+ *
11232
+ * @spec SCORM 2004 4th Ed. SN 3.10 Objective Description - primary objective contributes activity state
11233
+ */ key: "applyToActivity",
10861
11234
  value: function applyToActivity(activity) {
10862
11235
  if (!this._isPrimary) {
10863
11236
  return;
10864
11237
  }
10865
- activity.setPrimaryObjectiveState(this._satisfiedStatus, this._measureStatus, this._normalizedMeasure, this._progressMeasure, this._progressMeasureStatus, this._completionStatus);
11238
+ activity.setPrimaryObjectiveState(this._satisfiedStatus, this._measureStatus, this._normalizedMeasure, this._progressMeasure, this._progressMeasureStatus, this._completionStatus, this._progressStatus || this._satisfiedStatusKnown);
10866
11239
  }
10867
11240
  }
10868
11241
  ]);
@@ -11214,7 +11587,7 @@ this.Scorm2004API = (function () {
11214
11587
  (_this__children = this._children).splice.apply(_this__children, [
11215
11588
  0,
11216
11589
  this._children.length
11217
- ].concat(_to_consumable_array$8(reordered)));
11590
+ ].concat(_to_consumable_array$9(reordered)));
11218
11591
  }
11219
11592
  }
11220
11593
  },
@@ -12099,7 +12472,7 @@ this.Scorm2004API = (function () {
12099
12472
  set: /**
12100
12473
  * Setter for primary objective
12101
12474
  * @param {ActivityObjective | null} objective
12102
- */ function set(objective) {
12475
+ */ function set(objective) {
12103
12476
  this._primaryObjective = objective;
12104
12477
  if (this._primaryObjective) {
12105
12478
  this._primaryObjective.isPrimary = true;
@@ -12127,8 +12500,8 @@ this.Scorm2004API = (function () {
12127
12500
  set: /**
12128
12501
  * Replace objectives collection
12129
12502
  * @param {ActivityObjective[]} objectives
12130
- */ function set(objectives) {
12131
- this._objectives = _to_consumable_array$8(objectives);
12503
+ */ function set(objectives) {
12504
+ this._objectives = _to_consumable_array$9(objectives);
12132
12505
  this.syncPrimaryObjectiveCollection();
12133
12506
  }
12134
12507
  },
@@ -12167,7 +12540,7 @@ this.Scorm2004API = (function () {
12167
12540
  }
12168
12541
  this._objectives = [
12169
12542
  this._primaryObjective
12170
- ].concat(_to_consumable_array$8(this._objectives));
12543
+ ].concat(_to_consumable_array$9(this._objectives));
12171
12544
  }
12172
12545
  },
12173
12546
  {
@@ -12262,11 +12635,12 @@ this.Scorm2004API = (function () {
12262
12635
  {
12263
12636
  key: "setPrimaryObjectiveState",
12264
12637
  value: function setPrimaryObjectiveState(satisfiedStatus, measureStatus, normalizedMeasure, progressMeasure, progressMeasureStatus, completionStatus) {
12638
+ var objectiveProgressStatus = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : true;
12265
12639
  if (this._objectiveSatisfiedStatus !== satisfiedStatus) {
12266
12640
  this._objectiveSatisfiedStatus = satisfiedStatus;
12267
12641
  this._objectiveSatisfiedStatusDirty = true;
12268
12642
  }
12269
- this._objectiveSatisfiedStatusKnown = true;
12643
+ this._objectiveSatisfiedStatusKnown = objectiveProgressStatus;
12270
12644
  if (this._objectiveMeasureStatus !== measureStatus) {
12271
12645
  this._objectiveMeasureStatus = measureStatus;
12272
12646
  this._objectiveMeasureStatusDirty = true;
@@ -12285,11 +12659,18 @@ this.Scorm2004API = (function () {
12285
12659
  this._primaryObjective.progressMeasure = progressMeasure;
12286
12660
  this._primaryObjective.progressMeasureStatus = progressMeasureStatus;
12287
12661
  this._primaryObjective.completionStatus = completionStatus;
12662
+ this._primaryObjective.satisfiedStatusKnown = objectiveProgressStatus;
12663
+ this._primaryObjective.progressStatus = objectiveProgressStatus;
12288
12664
  }
12289
12665
  }
12290
12666
  },
12291
12667
  {
12292
- key: "getObjectiveStateSnapshot",
12668
+ /**
12669
+ * Snapshot objective state for sequencing persistence.
12670
+ *
12671
+ * @spec SCORM 2004 4th Ed. SN 3.10 Objective Description - objective state persists across attempts
12672
+ * @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - score-map state persists with objective state
12673
+ */ key: "getObjectiveStateSnapshot",
12293
12674
  value: function getObjectiveStateSnapshot() {
12294
12675
  var _this_progressMeasure;
12295
12676
  var primarySnapshot = this._primaryObjective ? {
@@ -12297,6 +12678,12 @@ this.Scorm2004API = (function () {
12297
12678
  satisfiedStatus: this.objectiveSatisfiedStatus,
12298
12679
  measureStatus: this.objectiveMeasureStatus,
12299
12680
  normalizedMeasure: this.objectiveNormalizedMeasure,
12681
+ rawScore: this._primaryObjective.rawScore,
12682
+ rawScoreKnown: this._primaryObjective.rawScoreKnown,
12683
+ minScore: this._primaryObjective.minScore,
12684
+ minScoreKnown: this._primaryObjective.minScoreKnown,
12685
+ maxScore: this._primaryObjective.maxScore,
12686
+ maxScoreKnown: this._primaryObjective.maxScoreKnown,
12300
12687
  progressMeasure: (_this_progressMeasure = this.progressMeasure) !== null && _this_progressMeasure !== void 0 ? _this_progressMeasure : 0,
12301
12688
  progressMeasureStatus: this.progressMeasureStatus,
12302
12689
  progressStatus: this._primaryObjective.progressStatus,
@@ -12310,6 +12697,12 @@ this.Scorm2004API = (function () {
12310
12697
  satisfiedStatus: objective.satisfiedStatus,
12311
12698
  measureStatus: objective.measureStatus,
12312
12699
  normalizedMeasure: objective.normalizedMeasure,
12700
+ rawScore: objective.rawScore,
12701
+ rawScoreKnown: objective.rawScoreKnown,
12702
+ minScore: objective.minScore,
12703
+ minScoreKnown: objective.minScoreKnown,
12704
+ maxScore: objective.maxScore,
12705
+ maxScoreKnown: objective.maxScoreKnown,
12313
12706
  progressMeasure: objective.progressMeasure,
12314
12707
  progressMeasureStatus: objective.progressMeasureStatus,
12315
12708
  progressStatus: objective.progressStatus,
@@ -12325,7 +12718,12 @@ this.Scorm2004API = (function () {
12325
12718
  }
12326
12719
  },
12327
12720
  {
12328
- key: "applyObjectiveStateSnapshot",
12721
+ /**
12722
+ * Restore objective state from a sequencing persistence snapshot.
12723
+ *
12724
+ * @spec SCORM 2004 4th Ed. SN 3.10 Objective Description - persisted objective state restores sequencing state
12725
+ * @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - persisted score-map state restores objective score fields
12726
+ */ key: "applyObjectiveStateSnapshot",
12329
12727
  value: function applyObjectiveStateSnapshot(snapshot) {
12330
12728
  if (snapshot.primary) {
12331
12729
  var primary = this.getObjectiveById(snapshot.primary.id);
@@ -12334,7 +12732,8 @@ this.Scorm2004API = (function () {
12334
12732
  var state = snapshot.primary;
12335
12733
  primary.objective.satisfiedByMeasure = (_state_satisfiedByMeasure = state.satisfiedByMeasure) !== null && _state_satisfiedByMeasure !== void 0 ? _state_satisfiedByMeasure : primary.objective.satisfiedByMeasure;
12336
12734
  primary.objective.minNormalizedMeasure = state.minNormalizedMeasure !== void 0 ? state.minNormalizedMeasure : primary.objective.minNormalizedMeasure;
12337
- this.setPrimaryObjectiveState(state.satisfiedStatus, state.measureStatus, state.normalizedMeasure, state.progressMeasure, state.progressMeasureStatus, state.completionStatus);
12735
+ this.setPrimaryObjectiveState(state.satisfiedStatus, state.measureStatus, state.normalizedMeasure, state.progressMeasure, state.progressMeasureStatus, state.completionStatus, state.progressStatus);
12736
+ this.applyObjectiveScoreSnapshot(primary.objective, state);
12338
12737
  }
12339
12738
  }
12340
12739
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
@@ -12351,6 +12750,7 @@ this.Scorm2004API = (function () {
12351
12750
  objective.progressMeasure = state1.progressMeasure;
12352
12751
  objective.progressMeasureStatus = state1.progressMeasureStatus;
12353
12752
  objective.completionStatus = state1.completionStatus;
12753
+ this.applyObjectiveScoreSnapshot(objective, state1);
12354
12754
  objective.satisfiedByMeasure = (_state_satisfiedByMeasure1 = state1.satisfiedByMeasure) !== null && _state_satisfiedByMeasure1 !== void 0 ? _state_satisfiedByMeasure1 : objective.satisfiedByMeasure;
12355
12755
  objective.minNormalizedMeasure = state1.minNormalizedMeasure !== void 0 ? state1.minNormalizedMeasure : objective.minNormalizedMeasure;
12356
12756
  }
@@ -12373,6 +12773,26 @@ this.Scorm2004API = (function () {
12373
12773
  },
12374
12774
  {
12375
12775
  /**
12776
+ * Restore known raw/min/max score fields from an objective state snapshot.
12777
+ *
12778
+ * @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - raw/min/max score known flags restore independently
12779
+ */ key: "applyObjectiveScoreSnapshot",
12780
+ value: function applyObjectiveScoreSnapshot(objective, state) {
12781
+ var scoreState = {};
12782
+ if (state.rawScoreKnown) {
12783
+ scoreState.rawScore = state.rawScore;
12784
+ }
12785
+ if (state.minScoreKnown) {
12786
+ scoreState.minScore = state.minScore;
12787
+ }
12788
+ if (state.maxScoreKnown) {
12789
+ scoreState.maxScore = state.maxScore;
12790
+ }
12791
+ objective.applyReadMappedState(scoreState);
12792
+ }
12793
+ },
12794
+ {
12795
+ /**
12376
12796
  * Get available children with selection and randomization applied
12377
12797
  * @return {Activity[]}
12378
12798
  */ key: "getAvailableChildren",
@@ -12733,7 +13153,7 @@ this.Scorm2004API = (function () {
12733
13153
  minProgressMeasure: this._minProgressMeasure,
12734
13154
  progressWeight: this._progressWeight,
12735
13155
  attemptCompletionAmountStatus: this._attemptCompletionAmountStatus,
12736
- hideLmsUi: _to_consumable_array$8(this._hideLmsUi),
13156
+ hideLmsUi: _to_consumable_array$9(this._hideLmsUi),
12737
13157
  auxiliaryResources: this._auxiliaryResources.map(function(resource) {
12738
13158
  return _object_spread$a({}, resource);
12739
13159
  }),
@@ -12791,7 +13211,7 @@ this.Scorm2004API = (function () {
12791
13211
  {
12792
13212
  key: "addAuxiliaryResource",
12793
13213
  value: function addAuxiliaryResource(resource) {
12794
- this.auxiliaryResources = _to_consumable_array$8(this._auxiliaryResources).concat([
13214
+ this.auxiliaryResources = _to_consumable_array$9(this._auxiliaryResources).concat([
12795
13215
  resource
12796
13216
  ]);
12797
13217
  }
@@ -12819,7 +13239,7 @@ this.Scorm2004API = (function () {
12819
13239
  * Getter for hideLmsUi directives
12820
13240
  * @return {HideLmsUiItem[]}
12821
13241
  */ function get() {
12822
- return _to_consumable_array$8(this._hideLmsUi);
13242
+ return _to_consumable_array$9(this._hideLmsUi);
12823
13243
  },
12824
13244
  set: /**
12825
13245
  * Setter for hideLmsUi directives
@@ -14372,6 +14792,7 @@ this.Scorm2004API = (function () {
14372
14792
  }
14373
14793
  function _create_class$F(Constructor, protoProps, staticProps) {
14374
14794
  if (protoProps) _defineProperties$F(Constructor.prototype, protoProps);
14795
+ if (staticProps) _defineProperties$F(Constructor, staticProps);
14375
14796
  return Constructor;
14376
14797
  }
14377
14798
  function _instanceof$9(left, right) {
@@ -14519,8 +14940,14 @@ this.Scorm2004API = (function () {
14519
14940
  *
14520
14941
  * @param activity - The activity to process
14521
14942
  * @param globalObjectives - Global objective map
14943
+ *
14944
+ * @spec SCORM 2004 4th Ed. SN 3.10.3 - write mapInfo transfers local objective state to global objectives
14945
+ * @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - raw/min/max score write maps
14522
14946
  */ key: "syncGlobalObjectivesWritePhase",
14523
14947
  value: function syncGlobalObjectivesWritePhase(activity, globalObjectives) {
14948
+ if (!this.canWriteGlobalObjectives(activity)) {
14949
+ return;
14950
+ }
14524
14951
  var objectives = activity.getAllObjectives();
14525
14952
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
14526
14953
  try {
@@ -14529,38 +14956,54 @@ this.Scorm2004API = (function () {
14529
14956
  var mapInfos = objective.mapInfo.length > 0 ? objective.mapInfo : [
14530
14957
  this.createDefaultMapInfo(objective)
14531
14958
  ];
14959
+ var dirtyFieldsToClear = /* @__PURE__ */ new Set();
14532
14960
  var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
14533
14961
  try {
14534
14962
  for(var _iterator1 = mapInfos[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
14535
14963
  var mapInfo = _step1.value;
14536
14964
  var targetId = mapInfo.targetObjectiveID || objective.id;
14537
14965
  var globalObjective = this.ensureGlobalObjectiveEntry(globalObjectives, targetId, objective);
14538
- if (mapInfo.writeSatisfiedStatus && objective.measureStatus && objective.isDirty("satisfiedStatus")) {
14966
+ if (mapInfo.writeSatisfiedStatus && this.hasKnownSatisfiedStatus(objective) && objective.isDirty("satisfiedStatus")) {
14539
14967
  globalObjective.satisfiedStatus = objective.satisfiedStatus;
14540
14968
  globalObjective.satisfiedStatusKnown = true;
14541
- objective.clearDirty("satisfiedStatus");
14969
+ dirtyFieldsToClear.add("satisfiedStatus");
14542
14970
  }
14543
14971
  if (mapInfo.writeNormalizedMeasure && objective.measureStatus && objective.isDirty("normalizedMeasure")) {
14544
14972
  globalObjective.normalizedMeasure = objective.normalizedMeasure;
14545
14973
  globalObjective.normalizedMeasureKnown = true;
14546
- objective.clearDirty("normalizedMeasure");
14547
- if (globalObjective.satisfiedByMeasure || objective.satisfiedByMeasure) {
14974
+ dirtyFieldsToClear.add("normalizedMeasure");
14975
+ if (mapInfo.writeSatisfiedStatus && objective.satisfiedByMeasure) {
14548
14976
  var _ref, _objective_minNormalizedMeasure;
14549
14977
  var threshold = (_ref = (_objective_minNormalizedMeasure = objective.minNormalizedMeasure) !== null && _objective_minNormalizedMeasure !== void 0 ? _objective_minNormalizedMeasure : activity.scaledPassingScore) !== null && _ref !== void 0 ? _ref : 0.7;
14550
14978
  globalObjective.satisfiedStatus = objective.normalizedMeasure >= threshold;
14551
14979
  globalObjective.satisfiedStatusKnown = true;
14552
- objective.clearDirty("satisfiedStatus");
14980
+ dirtyFieldsToClear.add("satisfiedStatus");
14553
14981
  }
14554
14982
  }
14555
14983
  if (mapInfo.writeCompletionStatus && objective.completionStatus !== CompletionStatus.UNKNOWN && objective.isDirty("completionStatus")) {
14556
14984
  globalObjective.completionStatus = objective.completionStatus;
14557
14985
  globalObjective.completionStatusKnown = true;
14558
- objective.clearDirty("completionStatus");
14986
+ dirtyFieldsToClear.add("completionStatus");
14987
+ }
14988
+ if (mapInfo.writeRawScore && objective.rawScoreKnown && objective.isDirty("rawScore")) {
14989
+ globalObjective.rawScore = objective.rawScore;
14990
+ globalObjective.rawScoreKnown = true;
14991
+ dirtyFieldsToClear.add("rawScore");
14992
+ }
14993
+ if (mapInfo.writeMinScore && objective.minScoreKnown && objective.isDirty("minScore")) {
14994
+ globalObjective.minScore = objective.minScore;
14995
+ globalObjective.minScoreKnown = true;
14996
+ dirtyFieldsToClear.add("minScore");
14997
+ }
14998
+ if (mapInfo.writeMaxScore && objective.maxScoreKnown && objective.isDirty("maxScore")) {
14999
+ globalObjective.maxScore = objective.maxScore;
15000
+ globalObjective.maxScoreKnown = true;
15001
+ dirtyFieldsToClear.add("maxScore");
14559
15002
  }
14560
15003
  if (mapInfo.writeProgressMeasure && objective.progressMeasureStatus && objective.isDirty("progressMeasure")) {
14561
15004
  globalObjective.progressMeasure = objective.progressMeasure;
14562
15005
  globalObjective.progressMeasureKnown = true;
14563
- objective.clearDirty("progressMeasure");
15006
+ dirtyFieldsToClear.add("progressMeasure");
14564
15007
  }
14565
15008
  if (mapInfo.updateAttemptData) {
14566
15009
  this.updateActivityAttemptData(activity, globalObjective, objective);
@@ -14580,6 +15023,26 @@ this.Scorm2004API = (function () {
14580
15023
  }
14581
15024
  }
14582
15025
  }
15026
+ var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = undefined;
15027
+ try {
15028
+ for(var _iterator2 = dirtyFieldsToClear[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){
15029
+ var property = _step2.value;
15030
+ objective.clearDirty(property);
15031
+ }
15032
+ } catch (err) {
15033
+ _didIteratorError2 = true;
15034
+ _iteratorError2 = err;
15035
+ } finally{
15036
+ try {
15037
+ if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
15038
+ _iterator2.return();
15039
+ }
15040
+ } finally{
15041
+ if (_didIteratorError2) {
15042
+ throw _iteratorError2;
15043
+ }
15044
+ }
15045
+ }
14583
15046
  }
14584
15047
  } catch (err) {
14585
15048
  _didIteratorError = true;
@@ -14603,6 +15066,9 @@ this.Scorm2004API = (function () {
14603
15066
  *
14604
15067
  * @param activity - The activity to process
14605
15068
  * @param globalObjectives - Global objective map
15069
+ *
15070
+ * @spec SCORM 2004 4th Ed. SN 3.10.3 - read mapInfo transfers global objective state into the local view
15071
+ * @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - raw/min/max score read maps
14606
15072
  */ key: "syncGlobalObjectivesReadPhase",
14607
15073
  value: function syncGlobalObjectivesReadPhase(activity, globalObjectives) {
14608
15074
  var objectives = activity.getAllObjectives();
@@ -14622,26 +15088,8 @@ this.Scorm2004API = (function () {
14622
15088
  var globalObjective = globalObjectives.get(targetId);
14623
15089
  if (!globalObjective) continue;
14624
15090
  var isPrimary = objective.isPrimary;
14625
- if (mapInfo.readSatisfiedStatus && globalObjective.satisfiedStatusKnown) {
14626
- objective.satisfiedStatus = globalObjective.satisfiedStatus;
14627
- objective.measureStatus = true;
14628
- }
14629
- if (mapInfo.readNormalizedMeasure && globalObjective.normalizedMeasureKnown) {
14630
- objective.normalizedMeasure = globalObjective.normalizedMeasure;
14631
- objective.measureStatus = true;
14632
- if (globalObjective.satisfiedByMeasure || objective.satisfiedByMeasure) {
14633
- var _ref, _objective_minNormalizedMeasure;
14634
- var threshold = (_ref = (_objective_minNormalizedMeasure = objective.minNormalizedMeasure) !== null && _objective_minNormalizedMeasure !== void 0 ? _objective_minNormalizedMeasure : activity.scaledPassingScore) !== null && _ref !== void 0 ? _ref : 0.7;
14635
- objective.satisfiedStatus = globalObjective.normalizedMeasure >= threshold;
14636
- }
14637
- }
14638
- if (mapInfo.readProgressMeasure && globalObjective.progressMeasureKnown) {
14639
- objective.progressMeasure = globalObjective.progressMeasure;
14640
- objective.progressMeasureStatus = true;
14641
- }
14642
- if (mapInfo.readCompletionStatus && globalObjective.completionStatusKnown) {
14643
- objective.completionStatus = globalObjective.completionStatus;
14644
- }
15091
+ var readState = GlobalObjectiveSynchronizer.getGlobalObjectiveReadState(activity, objective, mapInfo, globalObjective);
15092
+ this.applyGlobalObjectiveReadState(objective, readState);
14645
15093
  if (isPrimary) {
14646
15094
  objective.applyToActivity(activity);
14647
15095
  }
@@ -14748,59 +15196,58 @@ this.Scorm2004API = (function () {
14748
15196
  * @param objective - The objective to sync
14749
15197
  * @param mapInfo - Map info for this objective
14750
15198
  * @param globalObjective - The global objective
15199
+ *
15200
+ * @spec SCORM 2004 4th Ed. SN 3.10.3 - objective mapInfo read/write synchronization
15201
+ * @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - score mapInfo synchronization
14751
15202
  */ key: "syncObjectiveState",
14752
15203
  value: function syncObjectiveState(activity, objective, mapInfo, globalObjective) {
14753
15204
  try {
14754
15205
  var _this_eventCallback, _this;
14755
15206
  var isPrimary = objective.isPrimary;
14756
15207
  var localObjective = this.getLocalObjectiveState(activity, objective, isPrimary);
14757
- if (mapInfo.readSatisfiedStatus && globalObjective.satisfiedStatusKnown) {
14758
- objective.satisfiedStatus = globalObjective.satisfiedStatus;
14759
- objective.measureStatus = true;
14760
- }
14761
- if (mapInfo.readNormalizedMeasure && globalObjective.normalizedMeasureKnown) {
14762
- objective.normalizedMeasure = globalObjective.normalizedMeasure;
14763
- objective.measureStatus = true;
14764
- if (globalObjective.satisfiedByMeasure || objective.satisfiedByMeasure) {
14765
- var _ref, _objective_minNormalizedMeasure;
14766
- var threshold = (_ref = (_objective_minNormalizedMeasure = objective.minNormalizedMeasure) !== null && _objective_minNormalizedMeasure !== void 0 ? _objective_minNormalizedMeasure : activity.scaledPassingScore) !== null && _ref !== void 0 ? _ref : 0.7;
14767
- objective.satisfiedStatus = globalObjective.normalizedMeasure >= threshold;
14768
- }
14769
- }
14770
- if (mapInfo.readProgressMeasure && globalObjective.progressMeasureKnown) {
14771
- objective.progressMeasure = globalObjective.progressMeasure;
14772
- objective.progressMeasureStatus = true;
14773
- }
14774
- if (mapInfo.readCompletionStatus && globalObjective.completionStatusKnown) {
14775
- objective.completionStatus = globalObjective.completionStatus;
14776
- }
15208
+ var readState = GlobalObjectiveSynchronizer.getGlobalObjectiveReadState(activity, objective, mapInfo, globalObjective);
15209
+ this.applyGlobalObjectiveReadState(objective, readState);
14777
15210
  if (objective.isPrimary) {
14778
15211
  objective.applyToActivity(activity);
14779
15212
  }
14780
- if (mapInfo.writeSatisfiedStatus && objective.measureStatus) {
14781
- globalObjective.satisfiedStatus = objective.satisfiedStatus;
14782
- globalObjective.satisfiedStatusKnown = true;
14783
- }
14784
- if (mapInfo.writeNormalizedMeasure && objective.measureStatus) {
14785
- globalObjective.normalizedMeasure = objective.normalizedMeasure;
14786
- globalObjective.normalizedMeasureKnown = true;
14787
- if (globalObjective.satisfiedByMeasure || objective.satisfiedByMeasure) {
14788
- var _ref1, _objective_minNormalizedMeasure1;
14789
- var threshold1 = (_ref1 = (_objective_minNormalizedMeasure1 = objective.minNormalizedMeasure) !== null && _objective_minNormalizedMeasure1 !== void 0 ? _objective_minNormalizedMeasure1 : activity.scaledPassingScore) !== null && _ref1 !== void 0 ? _ref1 : 0.7;
14790
- globalObjective.satisfiedStatus = objective.normalizedMeasure >= threshold1;
15213
+ if (this.canWriteGlobalObjectives(activity)) {
15214
+ if (mapInfo.writeSatisfiedStatus && this.hasKnownSatisfiedStatus(objective)) {
15215
+ globalObjective.satisfiedStatus = objective.satisfiedStatus;
14791
15216
  globalObjective.satisfiedStatusKnown = true;
14792
15217
  }
14793
- }
14794
- if (mapInfo.writeCompletionStatus && objective.completionStatus !== CompletionStatus.UNKNOWN) {
14795
- globalObjective.completionStatus = objective.completionStatus;
14796
- globalObjective.completionStatusKnown = true;
14797
- }
14798
- if (mapInfo.writeProgressMeasure && objective.progressMeasureStatus) {
14799
- globalObjective.progressMeasure = objective.progressMeasure;
14800
- globalObjective.progressMeasureKnown = true;
14801
- }
14802
- if (mapInfo.updateAttemptData) {
14803
- this.updateActivityAttemptData(activity, globalObjective, objective);
15218
+ if (mapInfo.writeNormalizedMeasure && objective.measureStatus) {
15219
+ globalObjective.normalizedMeasure = objective.normalizedMeasure;
15220
+ globalObjective.normalizedMeasureKnown = true;
15221
+ if (mapInfo.writeSatisfiedStatus && objective.satisfiedByMeasure) {
15222
+ var _ref, _objective_minNormalizedMeasure;
15223
+ var threshold = (_ref = (_objective_minNormalizedMeasure = objective.minNormalizedMeasure) !== null && _objective_minNormalizedMeasure !== void 0 ? _objective_minNormalizedMeasure : activity.scaledPassingScore) !== null && _ref !== void 0 ? _ref : 0.7;
15224
+ globalObjective.satisfiedStatus = objective.normalizedMeasure >= threshold;
15225
+ globalObjective.satisfiedStatusKnown = true;
15226
+ }
15227
+ }
15228
+ if (mapInfo.writeCompletionStatus && objective.completionStatus !== CompletionStatus.UNKNOWN) {
15229
+ globalObjective.completionStatus = objective.completionStatus;
15230
+ globalObjective.completionStatusKnown = true;
15231
+ }
15232
+ if (mapInfo.writeRawScore && objective.rawScoreKnown) {
15233
+ globalObjective.rawScore = objective.rawScore;
15234
+ globalObjective.rawScoreKnown = true;
15235
+ }
15236
+ if (mapInfo.writeMinScore && objective.minScoreKnown) {
15237
+ globalObjective.minScore = objective.minScore;
15238
+ globalObjective.minScoreKnown = true;
15239
+ }
15240
+ if (mapInfo.writeMaxScore && objective.maxScoreKnown) {
15241
+ globalObjective.maxScore = objective.maxScore;
15242
+ globalObjective.maxScoreKnown = true;
15243
+ }
15244
+ if (mapInfo.writeProgressMeasure && objective.progressMeasureStatus) {
15245
+ globalObjective.progressMeasure = objective.progressMeasure;
15246
+ globalObjective.progressMeasureKnown = true;
15247
+ }
15248
+ if (mapInfo.updateAttemptData) {
15249
+ this.updateActivityAttemptData(activity, globalObjective, objective);
15250
+ }
14804
15251
  }
14805
15252
  (_this_eventCallback = (_this = this).eventCallback) === null || _this_eventCallback === void 0 ? void 0 : _this_eventCallback.call(_this, "objective_synchronized", {
14806
15253
  activityId: activity.id,
@@ -14822,25 +15269,47 @@ this.Scorm2004API = (function () {
14822
15269
  },
14823
15270
  {
14824
15271
  /**
15272
+ * Apply read-mapped state to an objective without marking those fields dirty.
15273
+ *
15274
+ * @spec SCORM 2004 4th Ed. SN 3.10.3 - read maps are access to global state, not local writes
15275
+ * @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - score read maps do not imply score writes
15276
+ */ key: "applyGlobalObjectiveReadState",
15277
+ value: function applyGlobalObjectiveReadState(objective, readState) {
15278
+ objective.applyReadMappedState(readState);
15279
+ }
15280
+ },
15281
+ {
15282
+ /**
14825
15283
  * Ensure global objective entry exists
14826
15284
  *
14827
15285
  * @param globalObjectives - Global objectives map
14828
15286
  * @param targetId - Target objective ID
14829
15287
  * @param objective - Source objective
14830
15288
  * @returns The global objective entry
15289
+ *
15290
+ * @spec SCORM 2004 4th Ed. SN 3.10.3 - global objective entries hold mapped objective state
15291
+ * @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - global entries hold score-map state
14831
15292
  */ key: "ensureGlobalObjectiveEntry",
14832
15293
  value: function ensureGlobalObjectiveEntry(globalObjectives, targetId, objective) {
14833
15294
  if (!globalObjectives.has(targetId)) {
14834
15295
  globalObjectives.set(targetId, {
14835
15296
  id: targetId,
14836
- satisfiedStatus: objective.satisfiedStatus,
14837
- satisfiedStatusKnown: objective.satisfiedStatusKnown,
14838
- normalizedMeasure: objective.normalizedMeasure,
14839
- normalizedMeasureKnown: objective.measureStatus,
14840
- progressMeasure: objective.progressMeasure,
14841
- progressMeasureKnown: objective.progressMeasureStatus,
14842
- completionStatus: objective.completionStatus,
14843
- completionStatusKnown: objective.completionStatus !== CompletionStatus.UNKNOWN,
15297
+ satisfiedStatus: false,
15298
+ satisfiedStatusKnown: false,
15299
+ normalizedMeasure: 0,
15300
+ normalizedMeasureKnown: false,
15301
+ // @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - score fields
15302
+ // remain unknown until their corresponding write map explicitly writes them.
15303
+ rawScore: "",
15304
+ rawScoreKnown: false,
15305
+ minScore: "",
15306
+ minScoreKnown: false,
15307
+ maxScore: "",
15308
+ maxScoreKnown: false,
15309
+ progressMeasure: 0,
15310
+ progressMeasureKnown: false,
15311
+ completionStatus: CompletionStatus.UNKNOWN,
15312
+ completionStatusKnown: false,
14844
15313
  satisfiedByMeasure: objective.satisfiedByMeasure,
14845
15314
  minNormalizedMeasure: objective.minNormalizedMeasure
14846
15315
  });
@@ -14857,6 +15326,9 @@ this.Scorm2004API = (function () {
14857
15326
  *
14858
15327
  * @param objective - The objective to create default map info for
14859
15328
  * @returns Default map info
15329
+ *
15330
+ * @spec SCORM 2004 4th Ed. SN 3.10.3 - mapInfo defaults are applied before objective synchronization
15331
+ * @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - score maps require explicit read/write flags
14860
15332
  */ key: "createDefaultMapInfo",
14861
15333
  value: function createDefaultMapInfo(objective) {
14862
15334
  return {
@@ -14869,18 +15341,50 @@ this.Scorm2004API = (function () {
14869
15341
  writeCompletionStatus: true,
14870
15342
  readProgressMeasure: false,
14871
15343
  writeProgressMeasure: true,
15344
+ readRawScore: false,
15345
+ writeRawScore: false,
15346
+ readMinScore: false,
15347
+ writeMinScore: false,
15348
+ readMaxScore: false,
15349
+ writeMaxScore: false,
14872
15350
  updateAttemptData: objective.isPrimary
14873
15351
  };
14874
15352
  }
14875
15353
  },
14876
15354
  {
14877
15355
  /**
15356
+ * Return whether the local objective has known satisfaction state to write.
15357
+ *
15358
+ * @spec SCORM 2004 4th Ed. SN 4.2.1 Tracking Model - Objective Progress
15359
+ * Status identifies whether Objective Satisfied Status is known; Objective
15360
+ * Measure Status is independent measure knowledge.
15361
+ */ key: "hasKnownSatisfiedStatus",
15362
+ value: function hasKnownSatisfiedStatus(objective) {
15363
+ return objective.progressStatus || objective.satisfiedStatusKnown;
15364
+ }
15365
+ },
15366
+ {
15367
+ /**
15368
+ * Return whether this activity is allowed to write tracked state to globals.
15369
+ *
15370
+ * @spec SCORM 2004 4th Ed. SN 3.13.1 Tracked - when False, the LMS
15371
+ * "does not initialize, manage or access any tracking status information".
15372
+ */ key: "canWriteGlobalObjectives",
15373
+ value: function canWriteGlobalObjectives(activity) {
15374
+ return activity.sequencingControls.tracked !== false;
15375
+ }
15376
+ },
15377
+ {
15378
+ /**
14878
15379
  * Get local objective state
14879
15380
  *
14880
15381
  * @param activity - The activity
14881
15382
  * @param objective - The objective
14882
15383
  * @param isPrimary - Whether this is the primary objective
14883
15384
  * @returns Local objective state
15385
+ *
15386
+ * @spec SCORM 2004 4th Ed. SN 3.10 Objective Description - local objective state used for synchronization
15387
+ * @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - local score fields are part of mapped objective state
14884
15388
  */ key: "getLocalObjectiveState",
14885
15389
  value: function getLocalObjectiveState(activity, objective, isPrimary) {
14886
15390
  if (isPrimary) {
@@ -14889,6 +15393,12 @@ this.Scorm2004API = (function () {
14889
15393
  satisfiedStatus: activity.objectiveSatisfiedStatus,
14890
15394
  measureStatus: activity.objectiveMeasureStatus,
14891
15395
  normalizedMeasure: activity.objectiveNormalizedMeasure,
15396
+ rawScore: objective.rawScore,
15397
+ rawScoreKnown: objective.rawScoreKnown,
15398
+ minScore: objective.minScore,
15399
+ minScoreKnown: objective.minScoreKnown,
15400
+ maxScore: objective.maxScore,
15401
+ maxScoreKnown: objective.maxScoreKnown,
14892
15402
  progressMeasure: activity.progressMeasure,
14893
15403
  progressMeasureStatus: activity.progressMeasureStatus,
14894
15404
  completionStatus: activity.completionStatus,
@@ -14900,6 +15410,12 @@ this.Scorm2004API = (function () {
14900
15410
  satisfiedStatus: objective.satisfiedStatus,
14901
15411
  measureStatus: objective.measureStatus,
14902
15412
  normalizedMeasure: objective.normalizedMeasure,
15413
+ rawScore: objective.rawScore,
15414
+ rawScoreKnown: objective.rawScoreKnown,
15415
+ minScore: objective.minScore,
15416
+ minScoreKnown: objective.minScoreKnown,
15417
+ maxScore: objective.maxScore,
15418
+ maxScoreKnown: objective.maxScoreKnown,
14903
15419
  progressMeasure: objective.progressMeasure,
14904
15420
  progressMeasureStatus: objective.progressMeasureStatus,
14905
15421
  completionStatus: objective.completionStatus,
@@ -14924,7 +15440,7 @@ this.Scorm2004API = (function () {
14924
15440
  return rule.action === "completed" || rule.action === "incomplete";
14925
15441
  });
14926
15442
  if (globalObjective.satisfiedStatusKnown && globalObjective.satisfiedStatus) {
14927
- if (!hasCompletionRollupRules && (activity.completionStatus === CompletionStatus.UNKNOWN || activity.completionStatus === CompletionStatus.INCOMPLETE)) {
15443
+ if (!hasCompletionRollupRules && !activity.sequencingControls.completionSetByContent && !activity.attemptProgressStatus && (activity.completionStatus === CompletionStatus.UNKNOWN || activity.completionStatus === CompletionStatus.INCOMPLETE)) {
14928
15444
  activity.completionStatus = CompletionStatus.COMPLETED;
14929
15445
  }
14930
15446
  if (activity.successStatus === "unknown") {
@@ -14965,17 +15481,56 @@ this.Scorm2004API = (function () {
14965
15481
  }
14966
15482
  }
14967
15483
  }
15484
+ ], [
15485
+ {
15486
+ key: "getGlobalObjectiveReadState",
15487
+ value: /**
15488
+ * Project a global objective through one local objective's read mapInfo.
15489
+ *
15490
+ * @spec SCORM 2004 4th Ed. SN 3.10.3 - read maps provide access to mapped global objective fields
15491
+ * @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - raw/min/max score read maps are independent fields
15492
+ */ function getGlobalObjectiveReadState(activity, objective, mapInfo, globalObjective) {
15493
+ var readState = {};
15494
+ if (mapInfo.readSatisfiedStatus && globalObjective.satisfiedStatusKnown) {
15495
+ readState.satisfiedStatus = globalObjective.satisfiedStatus;
15496
+ }
15497
+ if (mapInfo.readNormalizedMeasure && globalObjective.normalizedMeasureKnown) {
15498
+ readState.normalizedMeasure = globalObjective.normalizedMeasure;
15499
+ if (objective.satisfiedByMeasure) {
15500
+ var _ref, _objective_minNormalizedMeasure;
15501
+ var threshold = (_ref = (_objective_minNormalizedMeasure = objective.minNormalizedMeasure) !== null && _objective_minNormalizedMeasure !== void 0 ? _objective_minNormalizedMeasure : activity.scaledPassingScore) !== null && _ref !== void 0 ? _ref : 0.7;
15502
+ readState.satisfiedStatus = globalObjective.normalizedMeasure >= threshold;
15503
+ }
15504
+ }
15505
+ if (mapInfo.readCompletionStatus && globalObjective.completionStatusKnown) {
15506
+ readState.completionStatus = globalObjective.completionStatus;
15507
+ }
15508
+ if (mapInfo.readProgressMeasure && globalObjective.progressMeasureKnown) {
15509
+ readState.progressMeasure = globalObjective.progressMeasure;
15510
+ }
15511
+ if (mapInfo.readRawScore && globalObjective.rawScoreKnown) {
15512
+ readState.rawScore = globalObjective.rawScore;
15513
+ }
15514
+ if (mapInfo.readMinScore && globalObjective.minScoreKnown) {
15515
+ readState.minScore = globalObjective.minScore;
15516
+ }
15517
+ if (mapInfo.readMaxScore && globalObjective.maxScoreKnown) {
15518
+ readState.maxScore = globalObjective.maxScore;
15519
+ }
15520
+ return readState;
15521
+ }
15522
+ }
14968
15523
  ]);
14969
15524
  return GlobalObjectiveSynchronizer;
14970
15525
  }();
14971
15526
 
14972
- function _array_like_to_array$c(arr, len) {
15527
+ function _array_like_to_array$d(arr, len) {
14973
15528
  if (len == null || len > arr.length) len = arr.length;
14974
15529
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
14975
15530
  return arr2;
14976
15531
  }
14977
- function _array_without_holes$7(arr) {
14978
- if (Array.isArray(arr)) return _array_like_to_array$c(arr);
15532
+ function _array_without_holes$8(arr) {
15533
+ if (Array.isArray(arr)) return _array_like_to_array$d(arr);
14979
15534
  }
14980
15535
  function _class_call_check$E(instance, Constructor) {
14981
15536
  if (!(instance instanceof Constructor)) {
@@ -15003,26 +15558,26 @@ this.Scorm2004API = (function () {
15003
15558
  return left instanceof right;
15004
15559
  }
15005
15560
  }
15006
- function _iterable_to_array$7(iter) {
15561
+ function _iterable_to_array$8(iter) {
15007
15562
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
15008
15563
  }
15009
- function _non_iterable_spread$7() {
15564
+ function _non_iterable_spread$8() {
15010
15565
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
15011
15566
  }
15012
- function _to_consumable_array$7(arr) {
15013
- return _array_without_holes$7(arr) || _iterable_to_array$7(arr) || _unsupported_iterable_to_array$c(arr) || _non_iterable_spread$7();
15567
+ function _to_consumable_array$8(arr) {
15568
+ return _array_without_holes$8(arr) || _iterable_to_array$8(arr) || _unsupported_iterable_to_array$d(arr) || _non_iterable_spread$8();
15014
15569
  }
15015
15570
  function _type_of$B(obj) {
15016
15571
  "@swc/helpers - typeof";
15017
15572
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
15018
15573
  }
15019
- function _unsupported_iterable_to_array$c(o, minLen) {
15574
+ function _unsupported_iterable_to_array$d(o, minLen) {
15020
15575
  if (!o) return;
15021
- if (typeof o === "string") return _array_like_to_array$c(o, minLen);
15576
+ if (typeof o === "string") return _array_like_to_array$d(o, minLen);
15022
15577
  var n = Object.prototype.toString.call(o).slice(8, -1);
15023
15578
  if (n === "Object" && o.constructor) n = o.constructor.name;
15024
15579
  if (n === "Map" || n === "Set") return Array.from(n);
15025
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$c(o, minLen);
15580
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$d(o, minLen);
15026
15581
  }
15027
15582
  var __defProp$B = Object.defineProperty;
15028
15583
  var __defNormalProp$B = function __defNormalProp(obj, key, value) {
@@ -15173,7 +15728,7 @@ this.Scorm2004API = (function () {
15173
15728
  * @returns Array of rollup state log entries
15174
15729
  */ key: "getRollupStateLog",
15175
15730
  value: function getRollupStateLog() {
15176
- return _to_consumable_array$7(this.rollupStateLog);
15731
+ return _to_consumable_array$8(this.rollupStateLog);
15177
15732
  }
15178
15733
  },
15179
15734
  {
@@ -15433,6 +15988,23 @@ this.Scorm2004API = (function () {
15433
15988
  return RollupProcess;
15434
15989
  }();
15435
15990
 
15991
+ function evaluateCompletionStatusFromThreshold(param) {
15992
+ var completionThreshold = param.completionThreshold, progressMeasure = param.progressMeasure, storedCompletionStatus = param.storedCompletionStatus;
15993
+ if (completionThreshold !== "" && completionThreshold !== null && completionThreshold !== void 0) {
15994
+ var thresholdValue = parseFloat(String(completionThreshold));
15995
+ if (!isNaN(thresholdValue)) {
15996
+ if (progressMeasure !== "" && progressMeasure !== null && progressMeasure !== void 0) {
15997
+ var progressValue = parseFloat(String(progressMeasure));
15998
+ if (!isNaN(progressValue)) {
15999
+ return progressValue >= thresholdValue ? CompletionStatus.COMPLETED : CompletionStatus.INCOMPLETE;
16000
+ }
16001
+ }
16002
+ return CompletionStatus.UNKNOWN;
16003
+ }
16004
+ }
16005
+ return storedCompletionStatus || CompletionStatus.UNKNOWN;
16006
+ }
16007
+
15436
16008
  function _class_call_check$C(instance, Constructor) {
15437
16009
  if (!(instance instanceof Constructor)) {
15438
16010
  throw new TypeError("Cannot call a class as a function");
@@ -15524,12 +16096,43 @@ this.Scorm2004API = (function () {
15524
16096
  * Transfer primary objective data from CMI to activity
15525
16097
  * @param {Activity} activity - The activity to transfer data to
15526
16098
  * @param {CMIDataForTransfer} cmiData - CMI data from runtime
16099
+ *
16100
+ * @spec SCORM 2004 4th Ed. RTE-to-SN Data Transfer - primary objective status and score data
16101
+ * @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - raw/min/max score write-map source data
15527
16102
  */ key: "transferPrimaryObjective",
15528
16103
  value: function transferPrimaryObjective(activity, cmiData) {
15529
- var validatedCompletionStatus = validateCompletionStatus(cmiData.completion_status);
15530
- if (validatedCompletionStatus && validatedCompletionStatus !== CompletionStatus.UNKNOWN) {
15531
- activity.completionStatus = validatedCompletionStatus;
15532
- activity.attemptProgressStatus = true;
16104
+ var hasProgressMeasure = false;
16105
+ if (cmiData.progress_measure && cmiData.progress_measure !== "") {
16106
+ var progressMeasure = parseFloat(cmiData.progress_measure);
16107
+ if (!isNaN(progressMeasure)) {
16108
+ hasProgressMeasure = true;
16109
+ activity.progressMeasure = progressMeasure;
16110
+ activity.progressMeasureStatus = true;
16111
+ activity.attemptCompletionAmount = progressMeasure;
16112
+ activity.attemptCompletionAmountStatus = true;
16113
+ if (activity.primaryObjective) {
16114
+ activity.primaryObjective.progressMeasure = progressMeasure;
16115
+ activity.primaryObjective.progressMeasureStatus = true;
16116
+ }
16117
+ }
16118
+ }
16119
+ if (!hasProgressMeasure) {
16120
+ activity.attemptCompletionAmountStatus = false;
16121
+ }
16122
+ if (activity.completedByMeasure) {
16123
+ var completionStatus = evaluateCompletionStatusFromThreshold({
16124
+ completionThreshold: activity.minProgressMeasure,
16125
+ progressMeasure: cmiData.progress_measure,
16126
+ storedCompletionStatus: CompletionStatus.UNKNOWN
16127
+ });
16128
+ activity.completionStatus = completionStatus;
16129
+ activity.attemptProgressStatus = completionStatus !== CompletionStatus.UNKNOWN;
16130
+ } else {
16131
+ var validatedCompletionStatus = validateCompletionStatus(cmiData.completion_status);
16132
+ if (validatedCompletionStatus && validatedCompletionStatus !== CompletionStatus.UNKNOWN) {
16133
+ activity.completionStatus = validatedCompletionStatus;
16134
+ activity.attemptProgressStatus = true;
16135
+ }
15533
16136
  }
15534
16137
  var hasSuccessStatus = false;
15535
16138
  var successStatus = false;
@@ -15542,9 +16145,10 @@ this.Scorm2004API = (function () {
15542
16145
  activity.objectiveSatisfiedStatus = successStatus;
15543
16146
  activity.objectiveSatisfiedStatusKnown = true;
15544
16147
  activity.successStatus = validatedSuccessStatus;
15545
- activity.objectiveMeasureStatus = true;
15546
16148
  }
15547
16149
  if (cmiData.score) {
16150
+ var _activity_primaryObjective;
16151
+ (_activity_primaryObjective = activity.primaryObjective) === null || _activity_primaryObjective === void 0 ? void 0 : _activity_primaryObjective.initializeScoreFromCMI(this.getObjectiveScoreState(cmiData.score));
15548
16152
  var normalized = this.normalizeScore(cmiData.score);
15549
16153
  if (normalized !== null) {
15550
16154
  normalizedScore = normalized;
@@ -15556,32 +16160,27 @@ this.Scorm2004API = (function () {
15556
16160
  if (activity.primaryObjective && (hasSuccessStatus || hasNormalizedMeasure)) {
15557
16161
  var finalStatus = hasSuccessStatus ? successStatus : activity.primaryObjective.satisfiedStatus;
15558
16162
  var finalMeasure = hasNormalizedMeasure ? normalizedScore : activity.primaryObjective.normalizedMeasure;
15559
- var measureStatus = hasSuccessStatus || hasNormalizedMeasure;
16163
+ var measureStatus = hasNormalizedMeasure;
15560
16164
  activity.primaryObjective.initializeFromCMI(finalStatus, finalMeasure, measureStatus);
15561
16165
  if (hasSuccessStatus) {
15562
16166
  activity.primaryObjective.satisfiedStatusKnown = true;
15563
16167
  activity.primaryObjective.progressStatus = true;
15564
16168
  }
15565
16169
  }
15566
- if (cmiData.progress_measure && cmiData.progress_measure !== "") {
15567
- var progressMeasure = parseFloat(cmiData.progress_measure);
15568
- if (!isNaN(progressMeasure)) {
15569
- activity.progressMeasure = progressMeasure;
15570
- activity.progressMeasureStatus = true;
15571
- if (activity.primaryObjective) {
15572
- activity.primaryObjective.progressMeasure = progressMeasure;
15573
- activity.primaryObjective.progressMeasureStatus = true;
15574
- }
15575
- }
15576
- }
15577
16170
  }
15578
16171
  },
15579
16172
  {
15580
16173
  /**
15581
- * Transfer non-primary objective data from CMI to activity objectives
15582
- * Only transfers changed values to protect global objectives
16174
+ * Transfer objective-array data from CMI to matching activity objectives.
16175
+ * Only transfers changed values to protect global objectives.
15583
16176
  * @param {Activity} activity - The activity to transfer data to
15584
16177
  * @param {CMIDataForTransfer} cmiData - CMI data from runtime
16178
+ *
16179
+ * @spec SCORM 2004 4th Ed. RTE 4.2.17 - cmi.objectives.n data, including
16180
+ * the primary objective entry, is part of the RTE objective data model.
16181
+ * @spec SCORM 2004 4th Ed. SN 3.10.3 and ADLSEQ objectives extension -
16182
+ * mapped objective status and raw/min/max score data transfer through
16183
+ * objective maps to sequencing state.
15585
16184
  */ key: "transferNonPrimaryObjectives",
15586
16185
  value: function transferNonPrimaryObjectives(activity, cmiData) {
15587
16186
  if (!cmiData.objectives || cmiData.objectives.length === 0) {
@@ -15595,14 +16194,17 @@ this.Scorm2004API = (function () {
15595
16194
  continue;
15596
16195
  }
15597
16196
  var activityObjectiveMatch = activity.getObjectiveById(cmiObjective.id);
15598
- if (!activityObjectiveMatch || activityObjectiveMatch.isPrimary) {
16197
+ if (!activityObjectiveMatch) {
15599
16198
  continue;
15600
16199
  }
15601
16200
  var activityObjective = activityObjectiveMatch.objective;
16201
+ var isPrimaryObjective = activityObjectiveMatch.isPrimary;
15602
16202
  var hasSuccessStatus = false;
15603
16203
  var successStatus = false;
15604
16204
  var hasNormalizedMeasure = false;
15605
16205
  var normalizedScore = 0;
16206
+ var hasCompletionStatus = false;
16207
+ var hasProgressMeasure = false;
15606
16208
  var validatedObjSuccessStatus = validateSuccessStatus(cmiObjective.success_status);
15607
16209
  if (validatedObjSuccessStatus && validatedObjSuccessStatus !== SuccessStatus.UNKNOWN) {
15608
16210
  successStatus = validatedObjSuccessStatus === SuccessStatus.PASSED;
@@ -15612,8 +16214,10 @@ this.Scorm2004API = (function () {
15612
16214
  var validatedObjCompletionStatus = validateCompletionStatus(cmiObjective.completion_status);
15613
16215
  if (validatedObjCompletionStatus && validatedObjCompletionStatus !== CompletionStatus.UNKNOWN) {
15614
16216
  activityObjective.completionStatus = validatedObjCompletionStatus;
16217
+ hasCompletionStatus = true;
15615
16218
  }
15616
16219
  if (cmiObjective.score) {
16220
+ activityObjective.initializeScoreFromCMI(this.getObjectiveScoreState(cmiObjective.score));
15617
16221
  var normalized = this.normalizeScore(cmiObjective.score);
15618
16222
  if (normalized !== null) {
15619
16223
  normalizedScore = normalized;
@@ -15625,12 +16229,29 @@ this.Scorm2004API = (function () {
15625
16229
  var finalMeasure = hasNormalizedMeasure ? normalizedScore : activityObjective.normalizedMeasure;
15626
16230
  var measureStatus = hasNormalizedMeasure;
15627
16231
  activityObjective.initializeFromCMI(finalStatus, finalMeasure, measureStatus);
16232
+ if (hasSuccessStatus) {
16233
+ activityObjective.satisfiedStatusKnown = true;
16234
+ }
15628
16235
  }
15629
16236
  if (cmiObjective.progress_measure && cmiObjective.progress_measure !== "") {
15630
16237
  var progressMeasure = parseFloat(cmiObjective.progress_measure);
15631
16238
  if (!isNaN(progressMeasure)) {
15632
16239
  activityObjective.progressMeasure = progressMeasure;
15633
16240
  activityObjective.progressMeasureStatus = true;
16241
+ hasProgressMeasure = true;
16242
+ }
16243
+ }
16244
+ if (isPrimaryObjective && (hasSuccessStatus || hasNormalizedMeasure || hasCompletionStatus || hasProgressMeasure)) {
16245
+ activityObjective.applyToActivity(activity);
16246
+ if (validatedObjSuccessStatus && validatedObjSuccessStatus !== SuccessStatus.UNKNOWN) {
16247
+ activity.successStatus = validatedObjSuccessStatus;
16248
+ }
16249
+ if (hasCompletionStatus) {
16250
+ activity.attemptProgressStatus = true;
16251
+ }
16252
+ if (hasProgressMeasure) {
16253
+ activity.attemptCompletionAmount = activityObjective.progressMeasure;
16254
+ activity.attemptCompletionAmountStatus = true;
15634
16255
  }
15635
16256
  }
15636
16257
  }
@@ -15675,6 +16296,27 @@ this.Scorm2004API = (function () {
15675
16296
  }
15676
16297
  return null;
15677
16298
  }
16299
+ },
16300
+ {
16301
+ /**
16302
+ * Convert RTE score data into objective score-map state without numeric reformatting.
16303
+ *
16304
+ * @spec SCORM 2004 4th Ed. RTE-to-SN Data Transfer - score values transfer from RTE to sequencing state
16305
+ * @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - raw/min/max score map fields are independent
16306
+ */ key: "getObjectiveScoreState",
16307
+ value: function getObjectiveScoreState(score) {
16308
+ var scoreState = {};
16309
+ if (score.raw !== void 0) {
16310
+ scoreState.rawScore = score.raw;
16311
+ }
16312
+ if (score.min !== void 0) {
16313
+ scoreState.minScore = score.min;
16314
+ }
16315
+ if (score.max !== void 0) {
16316
+ scoreState.maxScore = score.max;
16317
+ }
16318
+ return scoreState;
16319
+ }
15678
16320
  }
15679
16321
  ]);
15680
16322
  return RteDataTransferService;
@@ -15850,6 +16492,18 @@ this.Scorm2004API = (function () {
15850
16492
  this.endAttempt(this.activityTree.currentActivity);
15851
16493
  }
15852
16494
  }
16495
+ var ancestorExitResult = this.applyAncestorExitActionRules(currentActivity);
16496
+ if (ancestorExitResult.action === "EXIT_ALL") {
16497
+ return this.handleExitAll(ancestorExitResult.activity || currentActivity);
16498
+ }
16499
+ if (ancestorExitResult.exception) {
16500
+ return {
16501
+ terminationRequest: SequencingRequestType.EXIT,
16502
+ sequencingRequest: null,
16503
+ exception: ancestorExitResult.exception,
16504
+ valid: false
16505
+ };
16506
+ }
15853
16507
  var processedExit;
15854
16508
  var postConditionResult;
15855
16509
  do {
@@ -16125,18 +16779,13 @@ this.Scorm2004API = (function () {
16125
16779
  try {
16126
16780
  for(var _iterator = exitRules[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
16127
16781
  var rule = _step.value;
16128
- var conditionsMet = void 0;
16129
- if (rule.conditionCombination === "all") {
16130
- conditionsMet = rule.conditions.every(function(condition) {
16131
- return condition.evaluate(activity);
16132
- });
16133
- } else {
16134
- conditionsMet = rule.conditions.some(function(condition) {
16135
- return condition.evaluate(activity);
16136
- });
16137
- }
16138
- if (conditionsMet) {
16139
- if (rule.action === RuleActionType.EXIT_PARENT) {
16782
+ if (rule.evaluate(activity)) {
16783
+ if (rule.action === RuleActionType.EXIT) {
16784
+ return {
16785
+ action: "EXIT",
16786
+ recursionDepth: recursionDepth
16787
+ };
16788
+ } else if (rule.action === RuleActionType.EXIT_PARENT) {
16140
16789
  return {
16141
16790
  action: "EXIT_PARENT",
16142
16791
  recursionDepth: recursionDepth
@@ -16200,6 +16849,89 @@ this.Scorm2004API = (function () {
16200
16849
  },
16201
16850
  {
16202
16851
  /**
16852
+ * Sequencing Exit Action Rules Subprocess (TB.2.1) ancestor walk
16853
+ * @spec SN Book: TB.2.1 (Sequencing Exit Action Rules Subprocess)
16854
+ * @param {Activity} terminatingActivity - The activity whose attempt just ended
16855
+ * @return {{action: string | null, activity?: Activity, exception?: string}}
16856
+ */ key: "applyAncestorExitActionRules",
16857
+ value: function applyAncestorExitActionRules(terminatingActivity) {
16858
+ var activityPath = [];
16859
+ var current = terminatingActivity.parent;
16860
+ while(current){
16861
+ activityPath.unshift(current);
16862
+ current = current.parent;
16863
+ }
16864
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
16865
+ try {
16866
+ for(var _iterator = activityPath[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
16867
+ var activity = _step.value;
16868
+ var exitAction = this.exitActionRulesSubprocess(activity);
16869
+ if (exitAction === "EXIT_ALL") {
16870
+ this.fireEvent("onAncestorExitAction", {
16871
+ activity: activity.id,
16872
+ action: exitAction
16873
+ });
16874
+ return {
16875
+ action: "EXIT_ALL",
16876
+ activity: activity
16877
+ };
16878
+ }
16879
+ if (exitAction === "EXIT_PARENT") {
16880
+ if (!activity.parent) {
16881
+ return {
16882
+ action: "EXIT_PARENT",
16883
+ activity: activity,
16884
+ exception: "TB.2.3-4"
16885
+ };
16886
+ }
16887
+ this.terminateDescendants(activity.parent);
16888
+ this.activityTree.currentActivity = activity.parent;
16889
+ this.endAttempt(activity.parent);
16890
+ this.fireEvent("onAncestorExitAction", {
16891
+ activity: activity.id,
16892
+ action: exitAction,
16893
+ currentActivity: activity.parent.id
16894
+ });
16895
+ return {
16896
+ action: "EXIT_PARENT",
16897
+ activity: activity.parent
16898
+ };
16899
+ }
16900
+ if (exitAction === "EXIT") {
16901
+ this.terminateDescendants(activity);
16902
+ this.activityTree.currentActivity = activity;
16903
+ this.endAttempt(activity);
16904
+ this.fireEvent("onAncestorExitAction", {
16905
+ activity: activity.id,
16906
+ action: exitAction
16907
+ });
16908
+ return {
16909
+ action: "EXIT",
16910
+ activity: activity
16911
+ };
16912
+ }
16913
+ }
16914
+ } catch (err) {
16915
+ _didIteratorError = true;
16916
+ _iteratorError = err;
16917
+ } finally{
16918
+ try {
16919
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
16920
+ _iterator.return();
16921
+ }
16922
+ } finally{
16923
+ if (_didIteratorError) {
16924
+ throw _iteratorError;
16925
+ }
16926
+ }
16927
+ }
16928
+ return {
16929
+ action: null
16930
+ };
16931
+ }
16932
+ },
16933
+ {
16934
+ /**
16203
16935
  * Process exit actions at specific level
16204
16936
  * @param {Activity} activity - Activity to process
16205
16937
  * @param {number} level - Current level in hierarchy
@@ -16341,18 +17073,10 @@ this.Scorm2004API = (function () {
16341
17073
  try {
16342
17074
  for(var _iterator = exitRules[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
16343
17075
  var rule = _step.value;
16344
- var conditionsMet = void 0;
16345
- if (rule.conditionCombination === "all") {
16346
- conditionsMet = rule.conditions.every(function(condition) {
16347
- return condition.evaluate(activity);
16348
- });
16349
- } else {
16350
- conditionsMet = rule.conditions.some(function(condition) {
16351
- return condition.evaluate(activity);
16352
- });
16353
- }
16354
- if (conditionsMet) {
16355
- if (rule.action === RuleActionType.EXIT_PARENT) {
17076
+ if (rule.evaluate(activity)) {
17077
+ if (rule.action === RuleActionType.EXIT) {
17078
+ return "EXIT";
17079
+ } else if (rule.action === RuleActionType.EXIT_PARENT) {
16356
17080
  return "EXIT_PARENT";
16357
17081
  } else if (rule.action === RuleActionType.EXIT_ALL) {
16358
17082
  return "EXIT_ALL";
@@ -16483,13 +17207,13 @@ this.Scorm2004API = (function () {
16483
17207
  return TerminationHandler;
16484
17208
  }();
16485
17209
 
16486
- function _array_like_to_array$b(arr, len) {
17210
+ function _array_like_to_array$c(arr, len) {
16487
17211
  if (len == null || len > arr.length) len = arr.length;
16488
17212
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
16489
17213
  return arr2;
16490
17214
  }
16491
- function _array_without_holes$6(arr) {
16492
- if (Array.isArray(arr)) return _array_like_to_array$b(arr);
17215
+ function _array_without_holes$7(arr) {
17216
+ if (Array.isArray(arr)) return _array_like_to_array$c(arr);
16493
17217
  }
16494
17218
  function _class_call_check$A(instance, Constructor) {
16495
17219
  if (!(instance instanceof Constructor)) {
@@ -16522,10 +17246,10 @@ this.Scorm2004API = (function () {
16522
17246
  }
16523
17247
  return obj;
16524
17248
  }
16525
- function _iterable_to_array$6(iter) {
17249
+ function _iterable_to_array$7(iter) {
16526
17250
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
16527
17251
  }
16528
- function _non_iterable_spread$6() {
17252
+ function _non_iterable_spread$7() {
16529
17253
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
16530
17254
  }
16531
17255
  function _object_spread$9(target) {
@@ -16543,20 +17267,20 @@ this.Scorm2004API = (function () {
16543
17267
  }
16544
17268
  return target;
16545
17269
  }
16546
- function _to_consumable_array$6(arr) {
16547
- return _array_without_holes$6(arr) || _iterable_to_array$6(arr) || _unsupported_iterable_to_array$b(arr) || _non_iterable_spread$6();
17270
+ function _to_consumable_array$7(arr) {
17271
+ return _array_without_holes$7(arr) || _iterable_to_array$7(arr) || _unsupported_iterable_to_array$c(arr) || _non_iterable_spread$7();
16548
17272
  }
16549
17273
  function _type_of$x(obj) {
16550
17274
  "@swc/helpers - typeof";
16551
17275
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
16552
17276
  }
16553
- function _unsupported_iterable_to_array$b(o, minLen) {
17277
+ function _unsupported_iterable_to_array$c(o, minLen) {
16554
17278
  if (!o) return;
16555
- if (typeof o === "string") return _array_like_to_array$b(o, minLen);
17279
+ if (typeof o === "string") return _array_like_to_array$c(o, minLen);
16556
17280
  var n = Object.prototype.toString.call(o).slice(8, -1);
16557
17281
  if (n === "Object" && o.constructor) n = o.constructor.name;
16558
17282
  if (n === "Map" || n === "Set") return Array.from(n);
16559
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$b(o, minLen);
17283
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$c(o, minLen);
16560
17284
  }
16561
17285
  var __defProp$x = Object.defineProperty;
16562
17286
  var __defNormalProp$x = function __defNormalProp(obj, key, value) {
@@ -16606,7 +17330,7 @@ this.Scorm2004API = (function () {
16606
17330
  this.now = (options === null || options === void 0 ? void 0 : options.now) || function() {
16607
17331
  return /* @__PURE__ */ new Date();
16608
17332
  };
16609
- this.defaultHideLmsUi = (options === null || options === void 0 ? void 0 : options.defaultHideLmsUi) ? _to_consumable_array$6(options.defaultHideLmsUi) : [];
17333
+ this.defaultHideLmsUi = (options === null || options === void 0 ? void 0 : options.defaultHideLmsUi) ? _to_consumable_array$7(options.defaultHideLmsUi) : [];
16610
17334
  this.defaultAuxiliaryResources = (options === null || options === void 0 ? void 0 : options.defaultAuxiliaryResources) ? options.defaultAuxiliaryResources.map(function(resource) {
16611
17335
  return _object_spread$9({}, resource);
16612
17336
  }) : [];
@@ -17050,7 +17774,7 @@ this.Scorm2004API = (function () {
17050
17774
  ]);
17051
17775
  return _DeliveryHandler;
17052
17776
  }();
17053
- __publicField$x(_DeliveryHandler, "HIDE_LMS_UI_ORDER", _to_consumable_array$6(HIDE_LMS_UI_TOKENS));
17777
+ __publicField$x(_DeliveryHandler, "HIDE_LMS_UI_ORDER", _to_consumable_array$7(HIDE_LMS_UI_TOKENS));
17054
17778
  var DeliveryHandler = _DeliveryHandler;
17055
17779
 
17056
17780
  function _class_call_check$z(instance, Constructor) {
@@ -18421,7 +19145,7 @@ this.Scorm2004API = (function () {
18421
19145
  return NavigationValidityService;
18422
19146
  }();
18423
19147
 
18424
- function _array_like_to_array$a(arr, len) {
19148
+ function _array_like_to_array$b(arr, len) {
18425
19149
  if (len == null || len > arr.length) len = arr.length;
18426
19150
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
18427
19151
  return arr2;
@@ -18510,7 +19234,7 @@ this.Scorm2004API = (function () {
18510
19234
  }
18511
19235
  return target;
18512
19236
  }
18513
- function ownKeys$1(object, enumerableOnly) {
19237
+ function ownKeys$2(object, enumerableOnly) {
18514
19238
  var keys = Object.keys(object);
18515
19239
  if (Object.getOwnPropertySymbols) {
18516
19240
  var symbols = Object.getOwnPropertySymbols(object);
@@ -18518,31 +19242,31 @@ this.Scorm2004API = (function () {
18518
19242
  }
18519
19243
  return keys;
18520
19244
  }
18521
- function _object_spread_props$1(target, source) {
19245
+ function _object_spread_props$2(target, source) {
18522
19246
  source = source != null ? source : {};
18523
19247
  if (Object.getOwnPropertyDescriptors) {
18524
19248
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
18525
19249
  } else {
18526
- ownKeys$1(Object(source)).forEach(function(key) {
19250
+ ownKeys$2(Object(source)).forEach(function(key) {
18527
19251
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
18528
19252
  });
18529
19253
  }
18530
19254
  return target;
18531
19255
  }
18532
19256
  function _sliced_to_array$5(arr, i) {
18533
- return _array_with_holes$5(arr) || _iterable_to_array_limit$5(arr, i) || _unsupported_iterable_to_array$a(arr, i) || _non_iterable_rest$5();
19257
+ return _array_with_holes$5(arr) || _iterable_to_array_limit$5(arr, i) || _unsupported_iterable_to_array$b(arr, i) || _non_iterable_rest$5();
18534
19258
  }
18535
19259
  function _type_of$u(obj) {
18536
19260
  "@swc/helpers - typeof";
18537
19261
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
18538
19262
  }
18539
- function _unsupported_iterable_to_array$a(o, minLen) {
19263
+ function _unsupported_iterable_to_array$b(o, minLen) {
18540
19264
  if (!o) return;
18541
- if (typeof o === "string") return _array_like_to_array$a(o, minLen);
19265
+ if (typeof o === "string") return _array_like_to_array$b(o, minLen);
18542
19266
  var n = Object.prototype.toString.call(o).slice(8, -1);
18543
19267
  if (n === "Object" && o.constructor) n = o.constructor.name;
18544
19268
  if (n === "Map" || n === "Set") return Array.from(n);
18545
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$a(o, minLen);
19269
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$b(o, minLen);
18546
19270
  }
18547
19271
  var __defProp$u = Object.defineProperty;
18548
19272
  var __defNormalProp$u = function __defNormalProp(obj, key, value) {
@@ -18593,6 +19317,9 @@ this.Scorm2004API = (function () {
18593
19317
  * Collect Global Objectives
18594
19318
  * Recursively collects global objectives from the activity tree
18595
19319
  * @param {Activity} activity - Activity to collect objectives from
19320
+ *
19321
+ * @spec SCORM 2004 4th Ed. SN 3.10.3 - global objective map contains mapped objective state
19322
+ * @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - raw/min/max score fields are unknown until written
18596
19323
  */ key: "collectObjectives",
18597
19324
  value: function collectObjectives(activity) {
18598
19325
  var objectives = activity.getAllObjectives();
@@ -18602,9 +19329,15 @@ this.Scorm2004API = (function () {
18602
19329
  this.globalObjectiveMap.set(defaultId, {
18603
19330
  id: defaultId,
18604
19331
  satisfiedStatus: activity.objectiveSatisfiedStatus,
18605
- satisfiedStatusKnown: activity.objectiveMeasureStatus,
19332
+ satisfiedStatusKnown: activity.objectiveSatisfiedStatusKnown,
18606
19333
  normalizedMeasure: activity.objectiveNormalizedMeasure,
18607
19334
  normalizedMeasureKnown: activity.objectiveMeasureStatus,
19335
+ rawScore: "",
19336
+ rawScoreKnown: false,
19337
+ minScore: "",
19338
+ minScoreKnown: false,
19339
+ maxScore: "",
19340
+ maxScoreKnown: false,
18608
19341
  progressMeasure: activity.progressMeasure,
18609
19342
  progressMeasureKnown: activity.progressMeasureStatus,
18610
19343
  completionStatus: activity.completionStatus,
@@ -18617,6 +19350,12 @@ this.Scorm2004API = (function () {
18617
19350
  writeCompletionStatus: true,
18618
19351
  readProgressMeasure: true,
18619
19352
  writeProgressMeasure: true,
19353
+ readRawScore: false,
19354
+ writeRawScore: false,
19355
+ readMinScore: false,
19356
+ writeMinScore: false,
19357
+ readMaxScore: false,
19358
+ writeMaxScore: false,
18620
19359
  satisfiedByMeasure: activity.scaledPassingScore !== null,
18621
19360
  minNormalizedMeasure: activity.scaledPassingScore,
18622
19361
  updateAttemptData: true
@@ -18651,9 +19390,15 @@ this.Scorm2004API = (function () {
18651
19390
  this.globalObjectiveMap.set(targetId, {
18652
19391
  id: targetId,
18653
19392
  satisfiedStatus: objective.satisfiedStatus,
18654
- satisfiedStatusKnown: objective.measureStatus,
19393
+ satisfiedStatusKnown: objective.satisfiedStatusKnown || objective.progressStatus,
18655
19394
  normalizedMeasure: objective.normalizedMeasure,
18656
19395
  normalizedMeasureKnown: objective.measureStatus,
19396
+ rawScore: "",
19397
+ rawScoreKnown: false,
19398
+ minScore: "",
19399
+ minScoreKnown: false,
19400
+ maxScore: "",
19401
+ maxScoreKnown: false,
18657
19402
  progressMeasure: objective.progressMeasure,
18658
19403
  progressMeasureKnown: objective.progressMeasureStatus,
18659
19404
  completionStatus: objective.completionStatus,
@@ -18768,7 +19513,7 @@ this.Scorm2004API = (function () {
18768
19513
  */ key: "updateObjective",
18769
19514
  value: function updateObjective(objectiveId, objectiveData) {
18770
19515
  try {
18771
- this.globalObjectiveMap.set(objectiveId, _object_spread_props$1(_object_spread$8({}, this.globalObjectiveMap.get(objectiveId), objectiveData), {
19516
+ this.globalObjectiveMap.set(objectiveId, _object_spread_props$2(_object_spread$8({}, this.globalObjectiveMap.get(objectiveId), objectiveData), {
18772
19517
  lastUpdated: /* @__PURE__ */ new Date().toISOString()
18773
19518
  }));
18774
19519
  this.fireEvent("onGlobalObjectiveUpdated", {
@@ -19421,13 +20166,13 @@ this.Scorm2004API = (function () {
19421
20166
  return SequencingStateManager;
19422
20167
  }();
19423
20168
 
19424
- function _array_like_to_array$9(arr, len) {
20169
+ function _array_like_to_array$a(arr, len) {
19425
20170
  if (len == null || len > arr.length) len = arr.length;
19426
20171
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
19427
20172
  return arr2;
19428
20173
  }
19429
- function _array_without_holes$5(arr) {
19430
- if (Array.isArray(arr)) return _array_like_to_array$9(arr);
20174
+ function _array_without_holes$6(arr) {
20175
+ if (Array.isArray(arr)) return _array_like_to_array$a(arr);
19431
20176
  }
19432
20177
  function _class_call_check$v(instance, Constructor) {
19433
20178
  if (!(instance instanceof Constructor)) {
@@ -19447,26 +20192,26 @@ this.Scorm2004API = (function () {
19447
20192
  if (protoProps) _defineProperties$v(Constructor.prototype, protoProps);
19448
20193
  return Constructor;
19449
20194
  }
19450
- function _iterable_to_array$5(iter) {
20195
+ function _iterable_to_array$6(iter) {
19451
20196
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
19452
20197
  }
19453
- function _non_iterable_spread$5() {
20198
+ function _non_iterable_spread$6() {
19454
20199
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
19455
20200
  }
19456
- function _to_consumable_array$5(arr) {
19457
- return _array_without_holes$5(arr) || _iterable_to_array$5(arr) || _unsupported_iterable_to_array$9(arr) || _non_iterable_spread$5();
20201
+ function _to_consumable_array$6(arr) {
20202
+ return _array_without_holes$6(arr) || _iterable_to_array$6(arr) || _unsupported_iterable_to_array$a(arr) || _non_iterable_spread$6();
19458
20203
  }
19459
20204
  function _type_of$s(obj) {
19460
20205
  "@swc/helpers - typeof";
19461
20206
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
19462
20207
  }
19463
- function _unsupported_iterable_to_array$9(o, minLen) {
20208
+ function _unsupported_iterable_to_array$a(o, minLen) {
19464
20209
  if (!o) return;
19465
- if (typeof o === "string") return _array_like_to_array$9(o, minLen);
20210
+ if (typeof o === "string") return _array_like_to_array$a(o, minLen);
19466
20211
  var n = Object.prototype.toString.call(o).slice(8, -1);
19467
20212
  if (n === "Object" && o.constructor) n = o.constructor.name;
19468
20213
  if (n === "Map" || n === "Set") return Array.from(n);
19469
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$9(o, minLen);
20214
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$a(o, minLen);
19470
20215
  }
19471
20216
  var __defProp$s = Object.defineProperty;
19472
20217
  var __defNormalProp$s = function __defNormalProp(obj, key, value) {
@@ -20064,7 +20809,7 @@ this.Scorm2004API = (function () {
20064
20809
  }
20065
20810
  if (activity.prerequisiteActivities) {
20066
20811
  var _prerequisites;
20067
- (_prerequisites = prerequisites).push.apply(_prerequisites, _to_consumable_array$5(activity.prerequisiteActivities));
20812
+ (_prerequisites = prerequisites).push.apply(_prerequisites, _to_consumable_array$6(activity.prerequisiteActivities));
20068
20813
  }
20069
20814
  return Array.from(new Set(prerequisites));
20070
20815
  }
@@ -20116,7 +20861,7 @@ this.Scorm2004API = (function () {
20116
20861
  }
20117
20862
  }
20118
20863
  if (activity.sequencingRules) {
20119
- var allRules = _to_consumable_array$5(activity.sequencingRules.preConditionRules || []).concat(_to_consumable_array$5(activity.sequencingRules.exitConditionRules || []), _to_consumable_array$5(activity.sequencingRules.postConditionRules || []));
20864
+ var allRules = _to_consumable_array$6(activity.sequencingRules.preConditionRules || []).concat(_to_consumable_array$6(activity.sequencingRules.exitConditionRules || []), _to_consumable_array$6(activity.sequencingRules.postConditionRules || []));
20120
20865
  var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
20121
20866
  try {
20122
20867
  for(var _iterator1 = allRules[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
@@ -20933,13 +21678,13 @@ this.Scorm2004API = (function () {
20933
21678
  return OverallSequencingProcess;
20934
21679
  }();
20935
21680
 
20936
- function _array_like_to_array$8(arr, len) {
21681
+ function _array_like_to_array$9(arr, len) {
20937
21682
  if (len == null || len > arr.length) len = arr.length;
20938
21683
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
20939
21684
  return arr2;
20940
21685
  }
20941
- function _array_without_holes$4(arr) {
20942
- if (Array.isArray(arr)) return _array_like_to_array$8(arr);
21686
+ function _array_without_holes$5(arr) {
21687
+ if (Array.isArray(arr)) return _array_like_to_array$9(arr);
20943
21688
  }
20944
21689
  function _class_call_check$t(instance, Constructor) {
20945
21690
  if (!(instance instanceof Constructor)) {
@@ -20972,10 +21717,10 @@ this.Scorm2004API = (function () {
20972
21717
  }
20973
21718
  return obj;
20974
21719
  }
20975
- function _iterable_to_array$4(iter) {
21720
+ function _iterable_to_array$5(iter) {
20976
21721
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
20977
21722
  }
20978
- function _non_iterable_spread$4() {
21723
+ function _non_iterable_spread$5() {
20979
21724
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
20980
21725
  }
20981
21726
  function _object_spread$7(target) {
@@ -20993,20 +21738,20 @@ this.Scorm2004API = (function () {
20993
21738
  }
20994
21739
  return target;
20995
21740
  }
20996
- function _to_consumable_array$4(arr) {
20997
- return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$8(arr) || _non_iterable_spread$4();
21741
+ function _to_consumable_array$5(arr) {
21742
+ return _array_without_holes$5(arr) || _iterable_to_array$5(arr) || _unsupported_iterable_to_array$9(arr) || _non_iterable_spread$5();
20998
21743
  }
20999
21744
  function _type_of$q(obj) {
21000
21745
  "@swc/helpers - typeof";
21001
21746
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
21002
21747
  }
21003
- function _unsupported_iterable_to_array$8(o, minLen) {
21748
+ function _unsupported_iterable_to_array$9(o, minLen) {
21004
21749
  if (!o) return;
21005
- if (typeof o === "string") return _array_like_to_array$8(o, minLen);
21750
+ if (typeof o === "string") return _array_like_to_array$9(o, minLen);
21006
21751
  var n = Object.prototype.toString.call(o).slice(8, -1);
21007
21752
  if (n === "Object" && o.constructor) n = o.constructor.name;
21008
21753
  if (n === "Map" || n === "Set") return Array.from(n);
21009
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
21754
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$9(o, minLen);
21010
21755
  }
21011
21756
  var __defProp$q = Object.defineProperty;
21012
21757
  var __defNormalProp$q = function __defNormalProp(obj, key, value) {
@@ -21098,7 +21843,7 @@ this.Scorm2004API = (function () {
21098
21843
  this.sequencingProcess = new SequencingProcess(this.sequencing.activityTree, this.sequencing.sequencingRules, this.sequencing.sequencingControls, this.adl.nav, seqOptions);
21099
21844
  var overallOptions = {};
21100
21845
  if (this.configuration.now) overallOptions.now = this.configuration.now;
21101
- overallOptions.defaultHideLmsUi = _to_consumable_array$4(this.sequencing.hideLmsUi);
21846
+ overallOptions.defaultHideLmsUi = _to_consumable_array$5(this.sequencing.hideLmsUi);
21102
21847
  if (this.sequencing.auxiliaryResources.length > 0) {
21103
21848
  overallOptions.defaultAuxiliaryResources = this.sequencing.auxiliaryResources.map(function(resource) {
21104
21849
  return {
@@ -21405,27 +22150,44 @@ this.Scorm2004API = (function () {
21405
22150
  {
21406
22151
  /**
21407
22152
  * Update activity properties from current CMI values
22153
+ *
22154
+ * @spec SCORM 2004 4th Ed. RTE-to-SN Data Transfer - current CMI values update activity objective state
22155
+ * @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - raw/min/max scores are available to objective write maps
21408
22156
  */ key: "updateActivityFromCMI",
21409
22157
  value: function updateActivityFromCMI(activity) {
21410
- if (this.cmi.completion_status !== "unknown") {
22158
+ var hasProgressMeasure = false;
22159
+ if (this.cmi.progress_measure !== "") {
22160
+ var progressMeasure = parseFloat(this.cmi.progress_measure);
22161
+ if (!isNaN(progressMeasure)) {
22162
+ hasProgressMeasure = true;
22163
+ activity.progressMeasure = progressMeasure;
22164
+ activity.progressMeasureStatus = true;
22165
+ activity.attemptCompletionAmount = progressMeasure;
22166
+ activity.attemptCompletionAmountStatus = true;
22167
+ }
22168
+ }
22169
+ if (!hasProgressMeasure) {
22170
+ activity.attemptCompletionAmountStatus = false;
22171
+ }
22172
+ if (activity.completedByMeasure) {
22173
+ var completionStatus = evaluateCompletionStatusFromThreshold({
22174
+ completionThreshold: activity.minProgressMeasure,
22175
+ progressMeasure: this.cmi.progress_measure,
22176
+ storedCompletionStatus: CompletionStatus.UNKNOWN
22177
+ });
22178
+ activity.completionStatus = completionStatus;
22179
+ activity.attemptProgressStatus = completionStatus !== CompletionStatus.UNKNOWN;
22180
+ } else if (this.cmi.completion_status !== "unknown") {
21411
22181
  activity.completionStatus = this.cmi.completion_status;
21412
22182
  activity.attemptProgressStatus = true;
21413
22183
  }
21414
22184
  if (this.cmi.success_status !== "unknown") {
21415
22185
  activity.successStatus = this.cmi.success_status;
21416
22186
  activity.objectiveSatisfiedStatus = this.cmi.success_status === "passed";
21417
- activity.objectiveMeasureStatus = true;
21418
22187
  if (activity.primaryObjective) {
21419
22188
  activity.primaryObjective.progressStatus = true;
21420
22189
  }
21421
22190
  }
21422
- if (this.cmi.progress_measure !== "") {
21423
- var progressMeasure = parseFloat(this.cmi.progress_measure);
21424
- if (!isNaN(progressMeasure)) {
21425
- activity.progressMeasure = progressMeasure;
21426
- activity.progressMeasureStatus = true;
21427
- }
21428
- }
21429
22191
  if (this.cmi.score && this.cmi.score.scaled !== "") {
21430
22192
  var scaledScore = parseFloat(this.cmi.score.scaled);
21431
22193
  if (!isNaN(scaledScore)) {
@@ -21436,6 +22198,17 @@ this.Scorm2004API = (function () {
21436
22198
  }
21437
22199
  }
21438
22200
  }
22201
+ if (activity.primaryObjective && this.cmi.score) {
22202
+ if (this.cmi.score.raw !== "") {
22203
+ activity.primaryObjective.rawScore = this.cmi.score.raw;
22204
+ }
22205
+ if (this.cmi.score.min !== "") {
22206
+ activity.primaryObjective.minScore = this.cmi.score.min;
22207
+ }
22208
+ if (this.cmi.score.max !== "") {
22209
+ activity.primaryObjective.maxScore = this.cmi.score.max;
22210
+ }
22211
+ }
21439
22212
  if (activity.primaryObjective) {
21440
22213
  activity.primaryObjective.updateFromActivity(activity);
21441
22214
  }
@@ -21598,7 +22371,7 @@ this.Scorm2004API = (function () {
21598
22371
  var listener = this.eventListeners[eventType];
21599
22372
  if (listener && typeof listener === "function") {
21600
22373
  try {
21601
- listener.apply(void 0, _to_consumable_array$4(args));
22374
+ listener.apply(void 0, _to_consumable_array$5(args));
21602
22375
  this.log("debug", "Internal listener for ".concat(eventType, " executed successfully"));
21603
22376
  } catch (listenerError) {
21604
22377
  this.log("error", "Internal listener for ".concat(eventType, " failed: ").concat(listenerError));
@@ -21609,7 +22382,7 @@ this.Scorm2004API = (function () {
21609
22382
  (_this_eventService = this.eventService).processListeners.apply(_this_eventService, [
21610
22383
  "Sequencing.".concat(eventType),
21611
22384
  args[0]
21612
- ].concat(_to_consumable_array$4(args.slice(1))));
22385
+ ].concat(_to_consumable_array$5(args.slice(1))));
21613
22386
  this.log("debug", "Event service listeners for ".concat(eventType, " processed"));
21614
22387
  } catch (eventServiceError) {
21615
22388
  this.log("warn", "Event service failed for ".concat(eventType, ": ").concat(eventServiceError));
@@ -21619,7 +22392,7 @@ this.Scorm2004API = (function () {
21619
22392
  var globalListeners = window.scormSequencingEvents;
21620
22393
  if (globalListeners[eventType] && typeof globalListeners[eventType] === "function") {
21621
22394
  var _globalListeners;
21622
- (_globalListeners = globalListeners)[eventType].apply(_globalListeners, _to_consumable_array$4(args));
22395
+ (_globalListeners = globalListeners)[eventType].apply(_globalListeners, _to_consumable_array$5(args));
21623
22396
  this.log("debug", "Global listener for ".concat(eventType, " executed"));
21624
22397
  }
21625
22398
  }
@@ -22057,7 +22830,7 @@ this.Scorm2004API = (function () {
22057
22830
  return SerializationService;
22058
22831
  }();
22059
22832
 
22060
- function _array_like_to_array$7(arr, len) {
22833
+ function _array_like_to_array$8(arr, len) {
22061
22834
  if (len == null || len > arr.length) len = arr.length;
22062
22835
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
22063
22836
  return arr2;
@@ -22119,19 +22892,19 @@ this.Scorm2004API = (function () {
22119
22892
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
22120
22893
  }
22121
22894
  function _sliced_to_array$4(arr, i) {
22122
- return _array_with_holes$4(arr) || _iterable_to_array_limit$4(arr, i) || _unsupported_iterable_to_array$7(arr, i) || _non_iterable_rest$4();
22895
+ return _array_with_holes$4(arr) || _iterable_to_array_limit$4(arr, i) || _unsupported_iterable_to_array$8(arr, i) || _non_iterable_rest$4();
22123
22896
  }
22124
22897
  function _type_of$p(obj) {
22125
22898
  "@swc/helpers - typeof";
22126
22899
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
22127
22900
  }
22128
- function _unsupported_iterable_to_array$7(o, minLen) {
22901
+ function _unsupported_iterable_to_array$8(o, minLen) {
22129
22902
  if (!o) return;
22130
- if (typeof o === "string") return _array_like_to_array$7(o, minLen);
22903
+ if (typeof o === "string") return _array_like_to_array$8(o, minLen);
22131
22904
  var n = Object.prototype.toString.call(o).slice(8, -1);
22132
22905
  if (n === "Object" && o.constructor) n = o.constructor.name;
22133
22906
  if (n === "Map" || n === "Set") return Array.from(n);
22134
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
22907
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
22135
22908
  }
22136
22909
  var __defProp$p = Object.defineProperty;
22137
22910
  var __defNormalProp$p = function __defNormalProp(obj, key, value) {
@@ -22400,13 +23173,13 @@ this.Scorm2004API = (function () {
22400
23173
  }();
22401
23174
  var validationService = new ValidationService();
22402
23175
 
22403
- function _array_like_to_array$6(arr, len) {
23176
+ function _array_like_to_array$7(arr, len) {
22404
23177
  if (len == null || len > arr.length) len = arr.length;
22405
23178
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
22406
23179
  return arr2;
22407
23180
  }
22408
- function _array_without_holes$3(arr) {
22409
- if (Array.isArray(arr)) return _array_like_to_array$6(arr);
23181
+ function _array_without_holes$4(arr) {
23182
+ if (Array.isArray(arr)) return _array_like_to_array$7(arr);
22410
23183
  }
22411
23184
  function _class_call_check$p(instance, Constructor) {
22412
23185
  if (!(instance instanceof Constructor)) {
@@ -22447,10 +23220,10 @@ this.Scorm2004API = (function () {
22447
23220
  return left instanceof right;
22448
23221
  }
22449
23222
  }
22450
- function _iterable_to_array$3(iter) {
23223
+ function _iterable_to_array$4(iter) {
22451
23224
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
22452
23225
  }
22453
- function _non_iterable_spread$3() {
23226
+ function _non_iterable_spread$4() {
22454
23227
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
22455
23228
  }
22456
23229
  function _object_spread$6(target) {
@@ -22468,7 +23241,7 @@ this.Scorm2004API = (function () {
22468
23241
  }
22469
23242
  return target;
22470
23243
  }
22471
- function ownKeys(object, enumerableOnly) {
23244
+ function ownKeys$1(object, enumerableOnly) {
22472
23245
  var keys = Object.keys(object);
22473
23246
  if (Object.getOwnPropertySymbols) {
22474
23247
  var symbols = Object.getOwnPropertySymbols(object);
@@ -22476,31 +23249,31 @@ this.Scorm2004API = (function () {
22476
23249
  }
22477
23250
  return keys;
22478
23251
  }
22479
- function _object_spread_props(target, source) {
23252
+ function _object_spread_props$1(target, source) {
22480
23253
  source = source != null ? source : {};
22481
23254
  if (Object.getOwnPropertyDescriptors) {
22482
23255
  Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
22483
23256
  } else {
22484
- ownKeys(Object(source)).forEach(function(key) {
23257
+ ownKeys$1(Object(source)).forEach(function(key) {
22485
23258
  Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
22486
23259
  });
22487
23260
  }
22488
23261
  return target;
22489
23262
  }
22490
- function _to_consumable_array$3(arr) {
22491
- return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$6(arr) || _non_iterable_spread$3();
23263
+ function _to_consumable_array$4(arr) {
23264
+ return _array_without_holes$4(arr) || _iterable_to_array$4(arr) || _unsupported_iterable_to_array$7(arr) || _non_iterable_spread$4();
22492
23265
  }
22493
23266
  function _type_of$o(obj) {
22494
23267
  "@swc/helpers - typeof";
22495
23268
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
22496
23269
  }
22497
- function _unsupported_iterable_to_array$6(o, minLen) {
23270
+ function _unsupported_iterable_to_array$7(o, minLen) {
22498
23271
  if (!o) return;
22499
- if (typeof o === "string") return _array_like_to_array$6(o, minLen);
23272
+ if (typeof o === "string") return _array_like_to_array$7(o, minLen);
22500
23273
  var n = Object.prototype.toString.call(o).slice(8, -1);
22501
23274
  if (n === "Object" && o.constructor) n = o.constructor.name;
22502
23275
  if (n === "Map" || n === "Set") return Array.from(n);
22503
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
23276
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
22504
23277
  }
22505
23278
  var __defProp$o = Object.defineProperty;
22506
23279
  var __defNormalProp$o = function __defNormalProp(obj, key, value) {
@@ -23586,20 +24359,20 @@ this.Scorm2004API = (function () {
23586
24359
  if (immediate && this.settings.terminateCommitPayloadField) {
23587
24360
  var field = this.settings.terminateCommitPayloadField;
23588
24361
  if (Array.isArray(finalParams)) {
23589
- finalParams = _to_consumable_array$3(finalParams).concat([
24362
+ finalParams = _to_consumable_array$4(finalParams).concat([
23590
24363
  "".concat(encodeURIComponent(field), "=true")
23591
24364
  ]);
23592
24365
  } else if (finalParams && (typeof finalParams === "undefined" ? "undefined" : _type_of$o(finalParams)) === "object") {
23593
- finalParams = _object_spread_props(_object_spread$6({}, finalParams), _define_property$6({}, field, true));
24366
+ finalParams = _object_spread_props$1(_object_spread$6({}, finalParams), _define_property$6({}, field, true));
23594
24367
  }
23595
24368
  }
23596
24369
  if (this.settings.includeCommitSequence === true) {
23597
24370
  if (Array.isArray(finalParams)) {
23598
- finalParams = _to_consumable_array$3(finalParams).concat([
24371
+ finalParams = _to_consumable_array$4(finalParams).concat([
23599
24372
  "commitSequence=".concat(sequence)
23600
24373
  ]);
23601
24374
  } else if (finalParams && (typeof finalParams === "undefined" ? "undefined" : _type_of$o(finalParams)) === "object") {
23602
- finalParams = _object_spread_props(_object_spread$6({}, finalParams), {
24375
+ finalParams = _object_spread_props$1(_object_spread$6({}, finalParams), {
23603
24376
  commitSequence: sequence
23604
24377
  });
23605
24378
  }
@@ -24098,7 +24871,7 @@ this.Scorm2004API = (function () {
24098
24871
  ];
24099
24872
  }
24100
24873
 
24101
- function _array_like_to_array$5(arr, len) {
24874
+ function _array_like_to_array$6(arr, len) {
24102
24875
  if (len == null || len > arr.length) len = arr.length;
24103
24876
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
24104
24877
  return arr2;
@@ -24210,7 +24983,7 @@ this.Scorm2004API = (function () {
24210
24983
  return _set_prototype_of$g(o, p);
24211
24984
  }
24212
24985
  function _sliced_to_array$3(arr, i) {
24213
- return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$5(arr, i) || _non_iterable_rest$3();
24986
+ return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$6(arr, i) || _non_iterable_rest$3();
24214
24987
  }
24215
24988
  function _super_prop_base$6(object, property) {
24216
24989
  while(!Object.prototype.hasOwnProperty.call(object, property)){
@@ -24223,13 +24996,13 @@ this.Scorm2004API = (function () {
24223
24996
  "@swc/helpers - typeof";
24224
24997
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
24225
24998
  }
24226
- function _unsupported_iterable_to_array$5(o, minLen) {
24999
+ function _unsupported_iterable_to_array$6(o, minLen) {
24227
25000
  if (!o) return;
24228
- if (typeof o === "string") return _array_like_to_array$5(o, minLen);
25001
+ if (typeof o === "string") return _array_like_to_array$6(o, minLen);
24229
25002
  var n = Object.prototype.toString.call(o).slice(8, -1);
24230
25003
  if (n === "Object" && o.constructor) n = o.constructor.name;
24231
25004
  if (n === "Map" || n === "Set") return Array.from(n);
24232
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
25005
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
24233
25006
  }
24234
25007
  function _is_native_reflect_construct$g() {
24235
25008
  try {
@@ -24554,7 +25327,7 @@ this.Scorm2004API = (function () {
24554
25327
  if (this.initialized && this._id === "") {
24555
25328
  throw new Scorm2004ValidationError(this._cmi_element + ".description", scorm2004_errors.DEPENDENCY_NOT_ESTABLISHED);
24556
25329
  } else {
24557
- if (check2004ValidFormat(this._cmi_element + ".description", description, scorm2004_regex.CMILangString250, true)) {
25330
+ if (check2004ValidFormat(this._cmi_element + ".description", description, scorm2004_regex.CMILangString, true)) {
24558
25331
  this._description = description;
24559
25332
  }
24560
25333
  }
@@ -25833,7 +26606,7 @@ this.Scorm2004API = (function () {
25833
26606
  if (this.initialized && this._id === "") {
25834
26607
  throw new Scorm2004ValidationError(this._cmi_element + ".description", scorm2004_errors.DEPENDENCY_NOT_ESTABLISHED);
25835
26608
  } else {
25836
- if (check2004ValidFormat(this._cmi_element + ".description", description, scorm2004_regex.CMILangString250, true)) {
26609
+ if (check2004ValidFormat(this._cmi_element + ".description", description, scorm2004_regex.CMILangString, true)) {
25837
26610
  this._description = description;
25838
26611
  }
25839
26612
  }
@@ -29075,13 +29848,13 @@ this.Scorm2004API = (function () {
29075
29848
  return ActivityTree;
29076
29849
  }(BaseCMI);
29077
29850
 
29078
- function _array_like_to_array$4(arr, len) {
29851
+ function _array_like_to_array$5(arr, len) {
29079
29852
  if (len == null || len > arr.length) len = arr.length;
29080
29853
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
29081
29854
  return arr2;
29082
29855
  }
29083
- function _array_without_holes$2(arr) {
29084
- if (Array.isArray(arr)) return _array_like_to_array$4(arr);
29856
+ function _array_without_holes$3(arr) {
29857
+ if (Array.isArray(arr)) return _array_like_to_array$5(arr);
29085
29858
  }
29086
29859
  function _assert_this_initialized$1(self) {
29087
29860
  if (self === void 0) {
@@ -29167,10 +29940,10 @@ this.Scorm2004API = (function () {
29167
29940
  return left instanceof right;
29168
29941
  }
29169
29942
  }
29170
- function _iterable_to_array$2(iter) {
29943
+ function _iterable_to_array$3(iter) {
29171
29944
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
29172
29945
  }
29173
- function _non_iterable_spread$2() {
29946
+ function _non_iterable_spread$3() {
29174
29947
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
29175
29948
  }
29176
29949
  function _object_spread$4(target) {
@@ -29208,20 +29981,20 @@ this.Scorm2004API = (function () {
29208
29981
  }
29209
29982
  return object;
29210
29983
  }
29211
- function _to_consumable_array$2(arr) {
29212
- return _array_without_holes$2(arr) || _iterable_to_array$2(arr) || _unsupported_iterable_to_array$4(arr) || _non_iterable_spread$2();
29984
+ function _to_consumable_array$3(arr) {
29985
+ return _array_without_holes$3(arr) || _iterable_to_array$3(arr) || _unsupported_iterable_to_array$5(arr) || _non_iterable_spread$3();
29213
29986
  }
29214
29987
  function _type_of$7(obj) {
29215
29988
  "@swc/helpers - typeof";
29216
29989
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
29217
29990
  }
29218
- function _unsupported_iterable_to_array$4(o, minLen) {
29991
+ function _unsupported_iterable_to_array$5(o, minLen) {
29219
29992
  if (!o) return;
29220
- if (typeof o === "string") return _array_like_to_array$4(o, minLen);
29993
+ if (typeof o === "string") return _array_like_to_array$5(o, minLen);
29221
29994
  var n = Object.prototype.toString.call(o).slice(8, -1);
29222
29995
  if (n === "Object" && o.constructor) n = o.constructor.name;
29223
29996
  if (n === "Map" || n === "Set") return Array.from(n);
29224
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
29997
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
29225
29998
  }
29226
29999
  function _is_native_reflect_construct$1() {
29227
30000
  try {
@@ -29349,10 +30122,10 @@ this.Scorm2004API = (function () {
29349
30122
  {
29350
30123
  key: "hideLmsUi",
29351
30124
  get: function get() {
29352
- return _to_consumable_array$2(this._hideLmsUi);
30125
+ return _to_consumable_array$3(this._hideLmsUi);
29353
30126
  },
29354
30127
  set: function set(items) {
29355
- this._hideLmsUi = _to_consumable_array$2(items);
30128
+ this._hideLmsUi = _to_consumable_array$3(items);
29356
30129
  }
29357
30130
  },
29358
30131
  {
@@ -29887,22 +30660,11 @@ this.Scorm2004API = (function () {
29887
30660
  * @returns {string} The evaluated completion status
29888
30661
  */ key: "evaluateCompletionStatus",
29889
30662
  value: function evaluateCompletionStatus() {
29890
- var threshold = this.context.cmi.completion_threshold;
29891
- var progressMeasure = this.context.cmi.progress_measure;
29892
- var storedStatus = this.context.cmi.completion_status;
29893
- if (threshold !== "" && threshold !== null && threshold !== void 0) {
29894
- var thresholdValue = parseFloat(String(threshold));
29895
- if (!isNaN(thresholdValue)) {
29896
- if (progressMeasure !== "" && progressMeasure !== null && progressMeasure !== void 0) {
29897
- var progressValue = parseFloat(String(progressMeasure));
29898
- if (!isNaN(progressValue)) {
29899
- return progressValue >= thresholdValue ? CompletionStatus.COMPLETED : CompletionStatus.INCOMPLETE;
29900
- }
29901
- }
29902
- return CompletionStatus.UNKNOWN;
29903
- }
29904
- }
29905
- return storedStatus || CompletionStatus.UNKNOWN;
30663
+ return evaluateCompletionStatusFromThreshold({
30664
+ completionThreshold: this.context.cmi.completion_threshold,
30665
+ progressMeasure: this.context.cmi.progress_measure,
30666
+ storedCompletionStatus: this.context.cmi.completion_status
30667
+ });
29906
30668
  }
29907
30669
  },
29908
30670
  {
@@ -29943,7 +30705,7 @@ this.Scorm2004API = (function () {
29943
30705
  return Scorm2004CMIHandler;
29944
30706
  }();
29945
30707
 
29946
- function _array_like_to_array$3(arr, len) {
30708
+ function _array_like_to_array$4(arr, len) {
29947
30709
  if (len == null || len > arr.length) len = arr.length;
29948
30710
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
29949
30711
  return arr2;
@@ -29951,8 +30713,8 @@ this.Scorm2004API = (function () {
29951
30713
  function _array_with_holes$2(arr) {
29952
30714
  if (Array.isArray(arr)) return arr;
29953
30715
  }
29954
- function _array_without_holes$1(arr) {
29955
- if (Array.isArray(arr)) return _array_like_to_array$3(arr);
30716
+ function _array_without_holes$2(arr) {
30717
+ if (Array.isArray(arr)) return _array_like_to_array$4(arr);
29956
30718
  }
29957
30719
  function _class_call_check$5(instance, Constructor) {
29958
30720
  if (!(instance instanceof Constructor)) {
@@ -29985,7 +30747,7 @@ this.Scorm2004API = (function () {
29985
30747
  }
29986
30748
  return obj;
29987
30749
  }
29988
- function _iterable_to_array$1(iter) {
30750
+ function _iterable_to_array$2(iter) {
29989
30751
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
29990
30752
  }
29991
30753
  function _iterable_to_array_limit$2(arr, i) {
@@ -30015,7 +30777,7 @@ this.Scorm2004API = (function () {
30015
30777
  function _non_iterable_rest$2() {
30016
30778
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
30017
30779
  }
30018
- function _non_iterable_spread$1() {
30780
+ function _non_iterable_spread$2() {
30019
30781
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
30020
30782
  }
30021
30783
  function _object_spread$3(target) {
@@ -30034,18 +30796,18 @@ this.Scorm2004API = (function () {
30034
30796
  return target;
30035
30797
  }
30036
30798
  function _sliced_to_array$2(arr, i) {
30037
- return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$3(arr, i) || _non_iterable_rest$2();
30799
+ return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$4(arr, i) || _non_iterable_rest$2();
30038
30800
  }
30039
- function _to_consumable_array$1(arr) {
30040
- return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$3(arr) || _non_iterable_spread$1();
30801
+ function _to_consumable_array$2(arr) {
30802
+ return _array_without_holes$2(arr) || _iterable_to_array$2(arr) || _unsupported_iterable_to_array$4(arr) || _non_iterable_spread$2();
30041
30803
  }
30042
- function _unsupported_iterable_to_array$3(o, minLen) {
30804
+ function _unsupported_iterable_to_array$4(o, minLen) {
30043
30805
  if (!o) return;
30044
- if (typeof o === "string") return _array_like_to_array$3(o, minLen);
30806
+ if (typeof o === "string") return _array_like_to_array$4(o, minLen);
30045
30807
  var n = Object.prototype.toString.call(o).slice(8, -1);
30046
30808
  if (n === "Object" && o.constructor) n = o.constructor.name;
30047
30809
  if (n === "Map" || n === "Set") return Array.from(n);
30048
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
30810
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
30049
30811
  }
30050
30812
  var SequencingConfigurationBuilder = /*#__PURE__*/ function() {
30051
30813
  function SequencingConfigurationBuilder() {
@@ -30124,6 +30886,9 @@ this.Scorm2004API = (function () {
30124
30886
  if (settings.objectiveSetByContent !== void 0) {
30125
30887
  target.objectiveSetByContent = settings.objectiveSetByContent;
30126
30888
  }
30889
+ if (settings.tracked !== void 0) {
30890
+ target.tracked = settings.tracked;
30891
+ }
30127
30892
  }
30128
30893
  },
30129
30894
  {
@@ -30583,7 +31348,7 @@ this.Scorm2004API = (function () {
30583
31348
  if (!additional || additional.length === 0) {
30584
31349
  return current;
30585
31350
  }
30586
- return this.sanitizeHideLmsUi(_to_consumable_array$1(current).concat(_to_consumable_array$1(additional)));
31351
+ return this.sanitizeHideLmsUi(_to_consumable_array$2(current).concat(_to_consumable_array$2(additional)));
30587
31352
  }
30588
31353
  },
30589
31354
  {
@@ -30651,7 +31416,7 @@ this.Scorm2004API = (function () {
30651
31416
  var seen = /* @__PURE__ */ new Set();
30652
31417
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
30653
31418
  try {
30654
- for(var _iterator = _to_consumable_array$1(existing !== null && existing !== void 0 ? existing : []).concat(_to_consumable_array$1(additions !== null && additions !== void 0 ? additions : []))[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
31419
+ for(var _iterator = _to_consumable_array$2(existing !== null && existing !== void 0 ? existing : []).concat(_to_consumable_array$2(additions !== null && additions !== void 0 ? additions : []))[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
30655
31420
  var resource = _step.value;
30656
31421
  if (!resource) {
30657
31422
  continue;
@@ -30693,13 +31458,13 @@ this.Scorm2004API = (function () {
30693
31458
  value: function cloneSelectionRandomizationState(state) {
30694
31459
  var clone = {};
30695
31460
  if (state.childOrder) {
30696
- clone.childOrder = _to_consumable_array$1(state.childOrder);
31461
+ clone.childOrder = _to_consumable_array$2(state.childOrder);
30697
31462
  }
30698
31463
  if (state.selectedChildIds) {
30699
- clone.selectedChildIds = _to_consumable_array$1(state.selectedChildIds);
31464
+ clone.selectedChildIds = _to_consumable_array$2(state.selectedChildIds);
30700
31465
  }
30701
31466
  if (state.hiddenFromChoiceChildIds) {
30702
- clone.hiddenFromChoiceChildIds = _to_consumable_array$1(state.hiddenFromChoiceChildIds);
31467
+ clone.hiddenFromChoiceChildIds = _to_consumable_array$2(state.hiddenFromChoiceChildIds);
30703
31468
  }
30704
31469
  if (state.selectionCountStatus !== void 0) {
30705
31470
  clone.selectionCountStatus = state.selectionCountStatus;
@@ -30780,13 +31545,13 @@ this.Scorm2004API = (function () {
30780
31545
  return SequencingConfigurationBuilder;
30781
31546
  }();
30782
31547
 
30783
- function _array_like_to_array$2(arr, len) {
31548
+ function _array_like_to_array$3(arr, len) {
30784
31549
  if (len == null || len > arr.length) len = arr.length;
30785
31550
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
30786
31551
  return arr2;
30787
31552
  }
30788
- function _array_without_holes(arr) {
30789
- if (Array.isArray(arr)) return _array_like_to_array$2(arr);
31553
+ function _array_without_holes$1(arr) {
31554
+ if (Array.isArray(arr)) return _array_like_to_array$3(arr);
30790
31555
  }
30791
31556
  function _class_call_check$4(instance, Constructor) {
30792
31557
  if (!(instance instanceof Constructor)) {
@@ -30806,26 +31571,26 @@ this.Scorm2004API = (function () {
30806
31571
  if (protoProps) _defineProperties$4(Constructor.prototype, protoProps);
30807
31572
  return Constructor;
30808
31573
  }
30809
- function _iterable_to_array(iter) {
31574
+ function _iterable_to_array$1(iter) {
30810
31575
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
30811
31576
  }
30812
- function _non_iterable_spread() {
31577
+ function _non_iterable_spread$1() {
30813
31578
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
30814
31579
  }
30815
- function _to_consumable_array(arr) {
30816
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array$2(arr) || _non_iterable_spread();
31580
+ function _to_consumable_array$1(arr) {
31581
+ return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$3(arr) || _non_iterable_spread$1();
30817
31582
  }
30818
31583
  function _type_of$4(obj) {
30819
31584
  "@swc/helpers - typeof";
30820
31585
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
30821
31586
  }
30822
- function _unsupported_iterable_to_array$2(o, minLen) {
31587
+ function _unsupported_iterable_to_array$3(o, minLen) {
30823
31588
  if (!o) return;
30824
- if (typeof o === "string") return _array_like_to_array$2(o, minLen);
31589
+ if (typeof o === "string") return _array_like_to_array$3(o, minLen);
30825
31590
  var n = Object.prototype.toString.call(o).slice(8, -1);
30826
31591
  if (n === "Object" && o.constructor) n = o.constructor.name;
30827
31592
  if (n === "Map" || n === "Set") return Array.from(n);
30828
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
31593
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
30829
31594
  }
30830
31595
  var __defProp$4 = Object.defineProperty;
30831
31596
  var __defNormalProp$4 = function __defNormalProp(obj, key, value) {
@@ -30967,6 +31732,9 @@ this.Scorm2004API = (function () {
30967
31732
  if (activitySettings.sequencingControls) {
30968
31733
  this.sequencingConfigBuilder.applySequencingControlsSettings(activity.sequencingControls, activitySettings.sequencingControls);
30969
31734
  }
31735
+ if (activitySettings.deliveryControls) {
31736
+ this.sequencingConfigBuilder.applySequencingControlsSettings(activity.sequencingControls, activitySettings.deliveryControls);
31737
+ }
30970
31738
  if (activitySettings.sequencingRules) {
30971
31739
  this.sequencingConfigBuilder.applySequencingRulesSettings(activity.sequencingRules, activitySettings.sequencingRules);
30972
31740
  }
@@ -30976,6 +31744,21 @@ this.Scorm2004API = (function () {
30976
31744
  if (activitySettings.rollupConsiderations) {
30977
31745
  activity.applyRollupConsiderations(activitySettings.rollupConsiderations);
30978
31746
  }
31747
+ if (activitySettings.completionThreshold) {
31748
+ var threshold = activitySettings.completionThreshold;
31749
+ if (threshold.completedByMeasure !== void 0) {
31750
+ activity.completedByMeasure = threshold.completedByMeasure;
31751
+ }
31752
+ if (threshold.minProgressMeasure !== void 0) {
31753
+ activity.minProgressMeasure = threshold.minProgressMeasure;
31754
+ activity.completionThreshold = threshold.minProgressMeasure.toString();
31755
+ } else if (threshold.completedByMeasure) {
31756
+ activity.completionThreshold = activity.minProgressMeasure.toString();
31757
+ }
31758
+ if (threshold.progressWeight !== void 0) {
31759
+ activity.progressWeight = threshold.progressWeight;
31760
+ }
31761
+ }
30979
31762
  if (activitySettings.hideLmsUi) {
30980
31763
  var mergedHide = this.sequencingConfigBuilder.mergeHideLmsUi(activity.hideLmsUi, activitySettings.hideLmsUi);
30981
31764
  if (mergedHide.length > 0) {
@@ -31052,7 +31835,7 @@ this.Scorm2004API = (function () {
31052
31835
  for(var _iterator = activity.children[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
31053
31836
  var child = _step.value;
31054
31837
  var _ids;
31055
- (_ids = ids).push.apply(_ids, _to_consumable_array(this.extractActivityIds(child)));
31838
+ (_ids = ids).push.apply(_ids, _to_consumable_array$1(this.extractActivityIds(child)));
31056
31839
  }
31057
31840
  } catch (err) {
31058
31841
  _didIteratorError = true;
@@ -31084,19 +31867,19 @@ this.Scorm2004API = (function () {
31084
31867
  var _info_readSatisfiedStatus, _info_readNormalizedMeasure, _info_writeSatisfiedStatus, _info_writeNormalizedMeasure, _info_readCompletionStatus, _info_writeCompletionStatus, _info_readProgressMeasure, _info_writeProgressMeasure, _info_readRawScore, _info_writeRawScore, _info_readMinScore, _info_writeMinScore, _info_readMaxScore, _info_writeMaxScore, _info_updateAttemptData;
31085
31868
  return {
31086
31869
  targetObjectiveID: info.targetObjectiveID,
31087
- readSatisfiedStatus: (_info_readSatisfiedStatus = info.readSatisfiedStatus) !== null && _info_readSatisfiedStatus !== void 0 ? _info_readSatisfiedStatus : false,
31088
- readNormalizedMeasure: (_info_readNormalizedMeasure = info.readNormalizedMeasure) !== null && _info_readNormalizedMeasure !== void 0 ? _info_readNormalizedMeasure : false,
31870
+ readSatisfiedStatus: (_info_readSatisfiedStatus = info.readSatisfiedStatus) !== null && _info_readSatisfiedStatus !== void 0 ? _info_readSatisfiedStatus : true,
31871
+ readNormalizedMeasure: (_info_readNormalizedMeasure = info.readNormalizedMeasure) !== null && _info_readNormalizedMeasure !== void 0 ? _info_readNormalizedMeasure : true,
31089
31872
  writeSatisfiedStatus: (_info_writeSatisfiedStatus = info.writeSatisfiedStatus) !== null && _info_writeSatisfiedStatus !== void 0 ? _info_writeSatisfiedStatus : false,
31090
31873
  writeNormalizedMeasure: (_info_writeNormalizedMeasure = info.writeNormalizedMeasure) !== null && _info_writeNormalizedMeasure !== void 0 ? _info_writeNormalizedMeasure : false,
31091
- readCompletionStatus: (_info_readCompletionStatus = info.readCompletionStatus) !== null && _info_readCompletionStatus !== void 0 ? _info_readCompletionStatus : false,
31874
+ readCompletionStatus: (_info_readCompletionStatus = info.readCompletionStatus) !== null && _info_readCompletionStatus !== void 0 ? _info_readCompletionStatus : true,
31092
31875
  writeCompletionStatus: (_info_writeCompletionStatus = info.writeCompletionStatus) !== null && _info_writeCompletionStatus !== void 0 ? _info_writeCompletionStatus : false,
31093
- readProgressMeasure: (_info_readProgressMeasure = info.readProgressMeasure) !== null && _info_readProgressMeasure !== void 0 ? _info_readProgressMeasure : false,
31876
+ readProgressMeasure: (_info_readProgressMeasure = info.readProgressMeasure) !== null && _info_readProgressMeasure !== void 0 ? _info_readProgressMeasure : true,
31094
31877
  writeProgressMeasure: (_info_writeProgressMeasure = info.writeProgressMeasure) !== null && _info_writeProgressMeasure !== void 0 ? _info_writeProgressMeasure : false,
31095
- readRawScore: (_info_readRawScore = info.readRawScore) !== null && _info_readRawScore !== void 0 ? _info_readRawScore : false,
31878
+ readRawScore: (_info_readRawScore = info.readRawScore) !== null && _info_readRawScore !== void 0 ? _info_readRawScore : true,
31096
31879
  writeRawScore: (_info_writeRawScore = info.writeRawScore) !== null && _info_writeRawScore !== void 0 ? _info_writeRawScore : false,
31097
- readMinScore: (_info_readMinScore = info.readMinScore) !== null && _info_readMinScore !== void 0 ? _info_readMinScore : false,
31880
+ readMinScore: (_info_readMinScore = info.readMinScore) !== null && _info_readMinScore !== void 0 ? _info_readMinScore : true,
31098
31881
  writeMinScore: (_info_writeMinScore = info.writeMinScore) !== null && _info_writeMinScore !== void 0 ? _info_writeMinScore : false,
31099
- readMaxScore: (_info_readMaxScore = info.readMaxScore) !== null && _info_readMaxScore !== void 0 ? _info_readMaxScore : false,
31882
+ readMaxScore: (_info_readMaxScore = info.readMaxScore) !== null && _info_readMaxScore !== void 0 ? _info_readMaxScore : true,
31100
31883
  writeMaxScore: (_info_writeMaxScore = info.writeMaxScore) !== null && _info_writeMaxScore !== void 0 ? _info_writeMaxScore : false,
31101
31884
  updateAttemptData: (_info_updateAttemptData = info.updateAttemptData) !== null && _info_updateAttemptData !== void 0 ? _info_updateAttemptData : false
31102
31885
  };
@@ -31114,7 +31897,7 @@ this.Scorm2004API = (function () {
31114
31897
  return ActivityTreeBuilder;
31115
31898
  }();
31116
31899
 
31117
- function _array_like_to_array$1(arr, len) {
31900
+ function _array_like_to_array$2(arr, len) {
31118
31901
  if (len == null || len > arr.length) len = arr.length;
31119
31902
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
31120
31903
  return arr2;
@@ -31196,19 +31979,19 @@ this.Scorm2004API = (function () {
31196
31979
  return target;
31197
31980
  }
31198
31981
  function _sliced_to_array$1(arr, i) {
31199
- return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$1(arr, i) || _non_iterable_rest$1();
31982
+ return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$2(arr, i) || _non_iterable_rest$1();
31200
31983
  }
31201
31984
  function _type_of$3(obj) {
31202
31985
  "@swc/helpers - typeof";
31203
31986
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
31204
31987
  }
31205
- function _unsupported_iterable_to_array$1(o, minLen) {
31988
+ function _unsupported_iterable_to_array$2(o, minLen) {
31206
31989
  if (!o) return;
31207
- if (typeof o === "string") return _array_like_to_array$1(o, minLen);
31990
+ if (typeof o === "string") return _array_like_to_array$2(o, minLen);
31208
31991
  var n = Object.prototype.toString.call(o).slice(8, -1);
31209
31992
  if (n === "Object" && o.constructor) n = o.constructor.name;
31210
31993
  if (n === "Map" || n === "Set") return Array.from(n);
31211
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
31994
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
31212
31995
  }
31213
31996
  var __defProp$3 = Object.defineProperty;
31214
31997
  var __defNormalProp$3 = function __defNormalProp(obj, key, value) {
@@ -31355,9 +32138,12 @@ this.Scorm2004API = (function () {
31355
32138
  *
31356
32139
  * @param {string} objectiveId - The global objective ID
31357
32140
  * @param {CMIObjectivesObject} objective - The CMI objective object with updated values
32141
+ *
32142
+ * @spec SCORM 2004 4th Ed. SN 3.10.3 - global objectives synchronize CMI objective data
32143
+ * @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - raw/min/max score fields synchronize independently
31358
32144
  */ key: "updateGlobalObjectiveFromCMI",
31359
32145
  value: function updateGlobalObjectiveFromCMI(objectiveId, objective) {
31360
- var _objective_score;
32146
+ var _objective_score, _objective_score1, _objective_score2, _objective_score3;
31361
32147
  if (!objectiveId || !this.context.sequencingService) {
31362
32148
  return;
31363
32149
  }
@@ -31381,6 +32167,18 @@ this.Scorm2004API = (function () {
31381
32167
  updatePayload.normalizedMeasure = normalizedMeasure;
31382
32168
  updatePayload.normalizedMeasureKnown = true;
31383
32169
  }
32170
+ if (((_objective_score1 = objective.score) === null || _objective_score1 === void 0 ? void 0 : _objective_score1.raw) !== void 0 && objective.score.raw !== "") {
32171
+ updatePayload.rawScore = objective.score.raw;
32172
+ updatePayload.rawScoreKnown = true;
32173
+ }
32174
+ if (((_objective_score2 = objective.score) === null || _objective_score2 === void 0 ? void 0 : _objective_score2.min) !== void 0 && objective.score.min !== "") {
32175
+ updatePayload.minScore = objective.score.min;
32176
+ updatePayload.minScoreKnown = true;
32177
+ }
32178
+ if (((_objective_score3 = objective.score) === null || _objective_score3 === void 0 ? void 0 : _objective_score3.max) !== void 0 && objective.score.max !== "") {
32179
+ updatePayload.maxScore = objective.score.max;
32180
+ updatePayload.maxScoreKnown = true;
32181
+ }
31384
32182
  var progressMeasure = this.parseObjectiveNumber(objective.progress_measure);
31385
32183
  if (progressMeasure !== null) {
31386
32184
  updatePayload.progressMeasure = progressMeasure;
@@ -31402,13 +32200,22 @@ this.Scorm2004API = (function () {
31402
32200
  *
31403
32201
  * @param {CMIObjectivesObject} objective - The CMI objectives object containing data about a specific learning objective.
31404
32202
  * @return {GlobalObjectiveMapEntry} An object containing mapped properties and their values based on the provided objective.
32203
+ *
32204
+ * @spec SCORM 2004 4th Ed. SN 3.10.3 - global objective map entries capture objective state
32205
+ * @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - raw/min/max score entries carry per-field known flags
31405
32206
  */ key: "buildObjectiveMapEntryFromCMI",
31406
32207
  value: function buildObjectiveMapEntryFromCMI(objective) {
31407
- var _objective_score;
32208
+ var _objective_score, _objective_score1, _objective_score2, _objective_score3;
31408
32209
  var entry = {
31409
32210
  id: objective.id,
31410
32211
  satisfiedStatusKnown: false,
31411
32212
  normalizedMeasureKnown: false,
32213
+ rawScore: "",
32214
+ rawScoreKnown: false,
32215
+ minScore: "",
32216
+ minScoreKnown: false,
32217
+ maxScore: "",
32218
+ maxScoreKnown: false,
31412
32219
  progressMeasureKnown: false,
31413
32220
  completionStatusKnown: false,
31414
32221
  readSatisfiedStatus: true,
@@ -31418,7 +32225,13 @@ this.Scorm2004API = (function () {
31418
32225
  readCompletionStatus: true,
31419
32226
  writeCompletionStatus: true,
31420
32227
  readProgressMeasure: true,
31421
- writeProgressMeasure: true
32228
+ writeProgressMeasure: true,
32229
+ readRawScore: true,
32230
+ writeRawScore: true,
32231
+ readMinScore: true,
32232
+ writeMinScore: true,
32233
+ readMaxScore: true,
32234
+ writeMaxScore: true
31422
32235
  };
31423
32236
  if (objective.success_status && objective.success_status !== SuccessStatus.UNKNOWN) {
31424
32237
  entry.satisfiedStatus = objective.success_status === SuccessStatus.PASSED;
@@ -31429,6 +32242,18 @@ this.Scorm2004API = (function () {
31429
32242
  entry.normalizedMeasure = normalizedMeasure;
31430
32243
  entry.normalizedMeasureKnown = true;
31431
32244
  }
32245
+ if (((_objective_score1 = objective.score) === null || _objective_score1 === void 0 ? void 0 : _objective_score1.raw) !== void 0 && objective.score.raw !== "") {
32246
+ entry.rawScore = objective.score.raw;
32247
+ entry.rawScoreKnown = true;
32248
+ }
32249
+ if (((_objective_score2 = objective.score) === null || _objective_score2 === void 0 ? void 0 : _objective_score2.min) !== void 0 && objective.score.min !== "") {
32250
+ entry.minScore = objective.score.min;
32251
+ entry.minScoreKnown = true;
32252
+ }
32253
+ if (((_objective_score3 = objective.score) === null || _objective_score3 === void 0 ? void 0 : _objective_score3.max) !== void 0 && objective.score.max !== "") {
32254
+ entry.maxScore = objective.score.max;
32255
+ entry.maxScoreKnown = true;
32256
+ }
31432
32257
  var progressMeasure = this.parseObjectiveNumber(objective.progress_measure);
31433
32258
  if (progressMeasure !== null) {
31434
32259
  entry.progressMeasure = progressMeasure;
@@ -31451,6 +32276,9 @@ this.Scorm2004API = (function () {
31451
32276
  * @return {CMIObjectivesObject[]} An array of `CMIObjectivesObject` instances built
31452
32277
  * from the provided snapshot map. Returns an empty array
31453
32278
  * if the snapshot is invalid or no valid objectives can be created.
32279
+ *
32280
+ * @spec SCORM 2004 4th Ed. SN 3.10.3 - global objective snapshots restore CMI objective state
32281
+ * @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - raw/min/max score known fields restore independently
31454
32282
  */ key: "buildCMIObjectivesFromMap",
31455
32283
  value: function buildCMIObjectivesFromMap(snapshot) {
31456
32284
  var objectives = [];
@@ -31474,6 +32302,18 @@ this.Scorm2004API = (function () {
31474
32302
  if (entry.normalizedMeasureKnown === true && normalizedMeasure !== null) {
31475
32303
  objective.score.scaled = String(normalizedMeasure);
31476
32304
  }
32305
+ if (entry.rawScoreKnown === true) {
32306
+ var _entry_rawScore;
32307
+ objective.score.raw = String((_entry_rawScore = entry.rawScore) !== null && _entry_rawScore !== void 0 ? _entry_rawScore : "");
32308
+ }
32309
+ if (entry.minScoreKnown === true) {
32310
+ var _entry_minScore;
32311
+ objective.score.min = String((_entry_minScore = entry.minScore) !== null && _entry_minScore !== void 0 ? _entry_minScore : "");
32312
+ }
32313
+ if (entry.maxScoreKnown === true) {
32314
+ var _entry_maxScore;
32315
+ objective.score.max = String((_entry_maxScore = entry.maxScore) !== null && _entry_maxScore !== void 0 ? _entry_maxScore : "");
32316
+ }
31477
32317
  var progressMeasure = this.parseObjectiveNumber(entry.progressMeasure);
31478
32318
  if (entry.progressMeasureKnown === true && progressMeasure !== null) {
31479
32319
  objective.progress_measure = String(progressMeasure);
@@ -31642,6 +32482,9 @@ this.Scorm2004API = (function () {
31642
32482
  * @param {CompletionStatus} completionStatus
31643
32483
  * @param {SuccessStatus} successStatus
31644
32484
  * @param {ScoreObject} scoreObject
32485
+ *
32486
+ * @spec SCORM 2004 4th Ed. RTE-to-SN Data Transfer - CMI score data updates the current primary objective
32487
+ * @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - raw/min/max score data is available for write maps
31645
32488
  */ key: "syncCmiToSequencingActivity",
31646
32489
  value: function syncCmiToSequencingActivity(completionStatus, successStatus, scoreObject) {
31647
32490
  if (!this.context.sequencing) {
@@ -31667,6 +32510,15 @@ this.Scorm2004API = (function () {
31667
32510
  primaryObjective.normalizedMeasure = scoreObject.scaled;
31668
32511
  primaryObjective.measureStatus = true;
31669
32512
  }
32513
+ if ((scoreObject === null || scoreObject === void 0 ? void 0 : scoreObject.raw) !== void 0 && scoreObject.raw !== null) {
32514
+ primaryObjective.rawScore = String(scoreObject.raw);
32515
+ }
32516
+ if ((scoreObject === null || scoreObject === void 0 ? void 0 : scoreObject.min) !== void 0 && scoreObject.min !== null) {
32517
+ primaryObjective.minScore = String(scoreObject.min);
32518
+ }
32519
+ if ((scoreObject === null || scoreObject === void 0 ? void 0 : scoreObject.max) !== void 0 && scoreObject.max !== null) {
32520
+ primaryObjective.maxScore = String(scoreObject.max);
32521
+ }
31670
32522
  }
31671
32523
  },
31672
32524
  {
@@ -32230,7 +33082,7 @@ this.Scorm2004API = (function () {
32230
33082
  return SequencingStatePersistence;
32231
33083
  }();
32232
33084
 
32233
- function _array_like_to_array(arr, len) {
33085
+ function _array_like_to_array$1(arr, len) {
32234
33086
  if (len == null || len > arr.length) len = arr.length;
32235
33087
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
32236
33088
  return arr2;
@@ -32284,19 +33136,19 @@ this.Scorm2004API = (function () {
32284
33136
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
32285
33137
  }
32286
33138
  function _sliced_to_array(arr, i) {
32287
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
33139
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array$1(arr, i) || _non_iterable_rest();
32288
33140
  }
32289
33141
  function _type_of$1(obj) {
32290
33142
  "@swc/helpers - typeof";
32291
33143
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
32292
33144
  }
32293
- function _unsupported_iterable_to_array(o, minLen) {
33145
+ function _unsupported_iterable_to_array$1(o, minLen) {
32294
33146
  if (!o) return;
32295
- if (typeof o === "string") return _array_like_to_array(o, minLen);
33147
+ if (typeof o === "string") return _array_like_to_array$1(o, minLen);
32296
33148
  var n = Object.prototype.toString.call(o).slice(8, -1);
32297
33149
  if (n === "Object" && o.constructor) n = o.constructor.name;
32298
33150
  if (n === "Map" || n === "Set") return Array.from(n);
32299
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
33151
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
32300
33152
  }
32301
33153
  var __defProp$1 = Object.defineProperty;
32302
33154
  var __defNormalProp$1 = function __defNormalProp(obj, key, value) {
@@ -32473,6 +33325,14 @@ this.Scorm2004API = (function () {
32473
33325
  return Scorm2004DataSerializer;
32474
33326
  }();
32475
33327
 
33328
+ function _array_like_to_array(arr, len) {
33329
+ if (len == null || len > arr.length) len = arr.length;
33330
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
33331
+ return arr2;
33332
+ }
33333
+ function _array_without_holes(arr) {
33334
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
33335
+ }
32476
33336
  function _assert_this_initialized(self) {
32477
33337
  if (self === void 0) {
32478
33338
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
@@ -32570,6 +33430,12 @@ this.Scorm2004API = (function () {
32570
33430
  return left instanceof right;
32571
33431
  }
32572
33432
  }
33433
+ function _iterable_to_array(iter) {
33434
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
33435
+ }
33436
+ function _non_iterable_spread() {
33437
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
33438
+ }
32573
33439
  function _object_spread(target) {
32574
33440
  for(var i = 1; i < arguments.length; i++){
32575
33441
  var source = arguments[i] != null ? arguments[i] : {};
@@ -32585,6 +33451,25 @@ this.Scorm2004API = (function () {
32585
33451
  }
32586
33452
  return target;
32587
33453
  }
33454
+ function ownKeys(object, enumerableOnly) {
33455
+ var keys = Object.keys(object);
33456
+ if (Object.getOwnPropertySymbols) {
33457
+ var symbols = Object.getOwnPropertySymbols(object);
33458
+ keys.push.apply(keys, symbols);
33459
+ }
33460
+ return keys;
33461
+ }
33462
+ function _object_spread_props(target, source) {
33463
+ source = source != null ? source : {};
33464
+ if (Object.getOwnPropertyDescriptors) {
33465
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
33466
+ } else {
33467
+ ownKeys(Object(source)).forEach(function(key) {
33468
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
33469
+ });
33470
+ }
33471
+ return target;
33472
+ }
32588
33473
  function _possible_constructor_return(self, call) {
32589
33474
  if (call && (_type_of(call) === "object" || typeof call === "function")) {
32590
33475
  return call;
@@ -32598,10 +33483,21 @@ this.Scorm2004API = (function () {
32598
33483
  };
32599
33484
  return _set_prototype_of(o, p);
32600
33485
  }
33486
+ function _to_consumable_array(arr) {
33487
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
33488
+ }
32601
33489
  function _type_of(obj) {
32602
33490
  "@swc/helpers - typeof";
32603
33491
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
32604
33492
  }
33493
+ function _unsupported_iterable_to_array(o, minLen) {
33494
+ if (!o) return;
33495
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
33496
+ var n = Object.prototype.toString.call(o).slice(8, -1);
33497
+ if (n === "Object" && o.constructor) n = o.constructor.name;
33498
+ if (n === "Map" || n === "Set") return Array.from(n);
33499
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
33500
+ }
32605
33501
  function _is_native_reflect_construct() {
32606
33502
  try {
32607
33503
  var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
@@ -32864,9 +33760,250 @@ this.Scorm2004API = (function () {
32864
33760
  var _this_cmi, _this_adl;
32865
33761
  this.commonReset(settings);
32866
33762
  (_this_cmi = this.cmi) === null || _this_cmi === void 0 ? void 0 : _this_cmi.reset();
33763
+ this.applyCurrentActivityLaunchData();
32867
33764
  (_this_adl = this.adl) === null || _this_adl === void 0 ? void 0 : _this_adl.reset();
32868
33765
  }
32869
33766
  },
33767
+ {
33768
+ /**
33769
+ * Apply launch-static activity data to CMI while the new SCO is pre-initialize.
33770
+ *
33771
+ * @spec SCORM 2004 4th Ed. RTE 4.2.5, Table 4.2.5a - cmi.completion_threshold
33772
+ * @spec SCORM 2004 4th Ed. RTE 4.2.17, Table 4.2.17a - cmi.objectives
33773
+ */ key: "applyCurrentActivityLaunchData",
33774
+ value: function applyCurrentActivityLaunchData() {
33775
+ var _this__sequencing;
33776
+ var currentActivity = (_this__sequencing = this._sequencing) === null || _this__sequencing === void 0 ? void 0 : _this__sequencing.getCurrentActivity();
33777
+ if (!currentActivity) {
33778
+ return;
33779
+ }
33780
+ this.applyActivityLaunchData(currentActivity);
33781
+ }
33782
+ },
33783
+ {
33784
+ /**
33785
+ * Apply launch-static CMI data when sequencing delivers a new activity before SCO Initialize.
33786
+ *
33787
+ * @spec SCORM 2004 4th Ed. SN DB.2 - Content Delivery Environment Process establishes the delivered activity.
33788
+ * @spec SCORM 2004 4th Ed. RTE 4.2.5, Table 4.2.5a - cmi.completion_threshold is initialized before SCO access.
33789
+ * @spec SCORM 2004 4th Ed. RTE 4.2.17, Table 4.2.17a - cmi.objectives is initialized before SCO access.
33790
+ */ key: "applyDeliveredActivityLaunchData",
33791
+ value: function applyDeliveredActivityLaunchData(activity) {
33792
+ if (!this.isNotInitialized()) {
33793
+ return;
33794
+ }
33795
+ this.applyActivityLaunchData(activity);
33796
+ }
33797
+ },
33798
+ {
33799
+ /**
33800
+ * Copy the delivered activity's static launch data into the fresh CMI model.
33801
+ *
33802
+ * @spec SCORM 2004 4th Ed. RTE 4.2.5, Table 4.2.5a - cmi.completion_threshold
33803
+ * @spec SCORM 2004 4th Ed. RTE 4.2.17, Table 4.2.17a - cmi.objectives
33804
+ */ key: "applyActivityLaunchData",
33805
+ value: function applyActivityLaunchData(currentActivity) {
33806
+ var _ref, _ref1;
33807
+ var _this__sequencing_overallSequencingProcess, _currentActivity_completionThreshold;
33808
+ if (!this.cmi) {
33809
+ return;
33810
+ }
33811
+ var contentActivityData = (_this__sequencing_overallSequencingProcess = this._sequencing.overallSequencingProcess) === null || _this__sequencing_overallSequencingProcess === void 0 ? void 0 : _this__sequencing_overallSequencingProcess.getContentActivityData(currentActivity);
33812
+ var completionThreshold = (_ref = (_ref1 = contentActivityData === null || contentActivityData === void 0 ? void 0 : contentActivityData.completionThreshold) !== null && _ref1 !== void 0 ? _ref1 : (_currentActivity_completionThreshold = currentActivity.completionThreshold) === null || _currentActivity_completionThreshold === void 0 ? void 0 : _currentActivity_completionThreshold.toString()) !== null && _ref !== void 0 ? _ref : "";
33813
+ this.cmi.completion_threshold = completionThreshold;
33814
+ this.seedCurrentActivityObjectives(currentActivity);
33815
+ }
33816
+ },
33817
+ {
33818
+ /**
33819
+ * Seed CMI objective ids after Initialize when automatic sequencing starts during Initialize.
33820
+ *
33821
+ * @spec SCORM 2004 4th Ed. RTE 4.2.17, Table 4.2.17a - cmi.objectives
33822
+ */ key: "applyCurrentActivityObjectiveData",
33823
+ value: function applyCurrentActivityObjectiveData() {
33824
+ var _this__sequencing;
33825
+ var currentActivity = (_this__sequencing = this._sequencing) === null || _this__sequencing === void 0 ? void 0 : _this__sequencing.getCurrentActivity();
33826
+ if (!this.cmi || !currentActivity) {
33827
+ return;
33828
+ }
33829
+ this.seedCurrentActivityObjectives(currentActivity);
33830
+ }
33831
+ },
33832
+ {
33833
+ /**
33834
+ * Seed CMI objectives from primary and secondary activity objectives.
33835
+ *
33836
+ * @spec SCORM 2004 4th Ed. RTE 4.2.17 - Initialization of Run-Time Objectives from Sequencing Information
33837
+ * @spec SCORM 2004 4th Ed. RTE 4.2.17, Table 4.2.17a - cmi.objectives.n.id and success_status
33838
+ * @spec SCORM 2004 4th Ed. SN 3.10.3 / ADLSEQ objectives extension - objective read maps seed the RTE view
33839
+ */ key: "seedCurrentActivityObjectives",
33840
+ value: function seedCurrentActivityObjectives(currentActivity) {
33841
+ var _activityObjectives;
33842
+ var activityObjectives = [];
33843
+ if (currentActivity.primaryObjective) {
33844
+ activityObjectives.push(currentActivity.primaryObjective);
33845
+ }
33846
+ (_activityObjectives = activityObjectives).push.apply(_activityObjectives, _to_consumable_array(currentActivity.objectives));
33847
+ var seededObjectiveIds = /* @__PURE__ */ new Set();
33848
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
33849
+ try {
33850
+ for(var _iterator = activityObjectives[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
33851
+ var activityObjective = _step.value;
33852
+ var objectiveId = this.getSeedableObjectiveId(activityObjective);
33853
+ if (!objectiveId || seededObjectiveIds.has(objectiveId)) {
33854
+ continue;
33855
+ }
33856
+ seededObjectiveIds.add(objectiveId);
33857
+ var index = this.findOrSeedCMIObjective(objectiveId);
33858
+ if (index === null) {
33859
+ continue;
33860
+ }
33861
+ var cmiObjective = this.cmi.objectives.findObjectiveByIndex(index);
33862
+ if (cmiObjective && this.cmi.objectives.initialized && !cmiObjective.initialized) {
33863
+ cmiObjective.initialize();
33864
+ }
33865
+ var successStatus = this.getActivityObjectiveSuccessStatus(activityObjective);
33866
+ if (successStatus) {
33867
+ this._commonSetCMIValue("SeedActivityObjective", true, "cmi.objectives.".concat(index, ".success_status"), successStatus);
33868
+ }
33869
+ this.seedObjectiveReadMapValues(currentActivity, activityObjective, index);
33870
+ }
33871
+ } catch (err) {
33872
+ _didIteratorError = true;
33873
+ _iteratorError = err;
33874
+ } finally{
33875
+ try {
33876
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
33877
+ _iterator.return();
33878
+ }
33879
+ } finally{
33880
+ if (_didIteratorError) {
33881
+ throw _iteratorError;
33882
+ }
33883
+ }
33884
+ }
33885
+ }
33886
+ },
33887
+ {
33888
+ /**
33889
+ * Seed CMI objective fields from this objective's read-mapped global objectives.
33890
+ *
33891
+ * @spec SCORM 2004 4th Ed. RTE 4.2.17 - Run-Time Objectives are initialized from sequencing information
33892
+ * @spec SCORM 2004 4th Ed. SN 3.10.3 - read mapInfo grants access to mapped global objective state
33893
+ * @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - raw/min/max score read maps seed RTE score fields
33894
+ */ key: "seedObjectiveReadMapValues",
33895
+ value: function seedObjectiveReadMapValues(currentActivity, activityObjective, objectiveIndex) {
33896
+ var _this__sequencing_overallSequencingProcess;
33897
+ var globalObjectiveMap = (_this__sequencing_overallSequencingProcess = this._sequencing.overallSequencingProcess) === null || _this__sequencing_overallSequencingProcess === void 0 ? void 0 : _this__sequencing_overallSequencingProcess.getGlobalObjectiveMap();
33898
+ if (!globalObjectiveMap || activityObjective.mapInfo.length === 0) {
33899
+ return;
33900
+ }
33901
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
33902
+ try {
33903
+ for(var _iterator = activityObjective.mapInfo[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
33904
+ var mapInfo = _step.value;
33905
+ var targetObjectiveId = mapInfo.targetObjectiveID || activityObjective.id;
33906
+ var globalObjective = globalObjectiveMap.get(targetObjectiveId);
33907
+ if (!globalObjective) {
33908
+ continue;
33909
+ }
33910
+ var readState = GlobalObjectiveSynchronizer.getGlobalObjectiveReadState(currentActivity, activityObjective, mapInfo, globalObjective);
33911
+ this.applyObjectiveReadStateToCMI(objectiveIndex, readState);
33912
+ }
33913
+ } catch (err) {
33914
+ _didIteratorError = true;
33915
+ _iteratorError = err;
33916
+ } finally{
33917
+ try {
33918
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
33919
+ _iterator.return();
33920
+ }
33921
+ } finally{
33922
+ if (_didIteratorError) {
33923
+ throw _iteratorError;
33924
+ }
33925
+ }
33926
+ }
33927
+ }
33928
+ },
33929
+ {
33930
+ /**
33931
+ * Copy mapped global objective state into the seeded CMI objective entry.
33932
+ *
33933
+ * @spec SCORM 2004 4th Ed. RTE 4.2.17, Table 4.2.17a - cmi.objectives launch-time initialization
33934
+ * @spec SCORM 2004 4th Ed. SN 3.10.3 - read maps populate the RTE view without creating local writes
33935
+ * @spec SCORM 2004 4th Ed. ADLSEQ objectives extension - raw/min/max score read maps populate CMI objective scores
33936
+ */ key: "applyObjectiveReadStateToCMI",
33937
+ value: function applyObjectiveReadStateToCMI(objectiveIndex, readState) {
33938
+ if (readState.satisfiedStatus !== void 0) {
33939
+ this._commonSetCMIValue("SeedActivityObjectiveReadMap", true, "cmi.objectives.".concat(objectiveIndex, ".success_status"), readState.satisfiedStatus ? SuccessStatus.PASSED : SuccessStatus.FAILED);
33940
+ }
33941
+ if (readState.normalizedMeasure !== void 0) {
33942
+ this._commonSetCMIValue("SeedActivityObjectiveReadMap", true, "cmi.objectives.".concat(objectiveIndex, ".score.scaled"), String(readState.normalizedMeasure));
33943
+ }
33944
+ if (readState.completionStatus !== void 0) {
33945
+ this._commonSetCMIValue("SeedActivityObjectiveReadMap", true, "cmi.objectives.".concat(objectiveIndex, ".completion_status"), readState.completionStatus);
33946
+ }
33947
+ if (readState.progressMeasure !== void 0) {
33948
+ this._commonSetCMIValue("SeedActivityObjectiveReadMap", true, "cmi.objectives.".concat(objectiveIndex, ".progress_measure"), String(readState.progressMeasure));
33949
+ }
33950
+ if (readState.rawScore !== void 0) {
33951
+ this._commonSetCMIValue("SeedActivityObjectiveReadMap", true, "cmi.objectives.".concat(objectiveIndex, ".score.raw"), readState.rawScore);
33952
+ }
33953
+ if (readState.minScore !== void 0) {
33954
+ this._commonSetCMIValue("SeedActivityObjectiveReadMap", true, "cmi.objectives.".concat(objectiveIndex, ".score.min"), readState.minScore);
33955
+ }
33956
+ if (readState.maxScore !== void 0) {
33957
+ this._commonSetCMIValue("SeedActivityObjectiveReadMap", true, "cmi.objectives.".concat(objectiveIndex, ".score.max"), readState.maxScore);
33958
+ }
33959
+ }
33960
+ },
33961
+ {
33962
+ /**
33963
+ * Return a manifest-defined objective id that can initialize cmi.objectives.n.id.
33964
+ *
33965
+ * @spec SCORM 2004 4th Ed. RTE 4.2.17, Table 4.2.17a - cmi.objectives.n.id
33966
+ */ key: "getSeedableObjectiveId",
33967
+ value: function getSeedableObjectiveId(activityObjective) {
33968
+ var objectiveId = activityObjective.id;
33969
+ if (typeof objectiveId !== "string" || objectiveId.trim() === "") {
33970
+ return null;
33971
+ }
33972
+ return objectiveId;
33973
+ }
33974
+ },
33975
+ {
33976
+ /**
33977
+ * Find an existing CMI objective id or create the next CMI objective array entry.
33978
+ *
33979
+ * @spec SCORM 2004 4th Ed. RTE 4.2.17, Table 4.2.17a - cmi.objectives._count
33980
+ * @spec SCORM 2004 4th Ed. RTE 4.2.17, Table 4.2.17a - cmi.objectives.n.id
33981
+ */ key: "findOrSeedCMIObjective",
33982
+ value: function findOrSeedCMIObjective(objectiveId) {
33983
+ var existingIndex = this.cmi.objectives.childArray.findIndex(function(objective) {
33984
+ return objective.id === objectiveId;
33985
+ });
33986
+ if (existingIndex >= 0) {
33987
+ return existingIndex;
33988
+ }
33989
+ var index = this.cmi.objectives.childArray.length;
33990
+ var result = this._commonSetCMIValue("SeedActivityObjective", true, "cmi.objectives.".concat(index, ".id"), objectiveId);
33991
+ return result === global_constants.SCORM_TRUE ? index : null;
33992
+ }
33993
+ },
33994
+ {
33995
+ /**
33996
+ * Translate a known activity objective satisfied status to cmi.objectives.n.success_status.
33997
+ *
33998
+ * @spec SCORM 2004 4th Ed. RTE 4.2.17, Table 4.2.17a - cmi.objectives.n.success_status
33999
+ */ key: "getActivityObjectiveSuccessStatus",
34000
+ value: function getActivityObjectiveSuccessStatus(activityObjective) {
34001
+ if (activityObjective.progressStatus || activityObjective.satisfiedStatusKnown) {
34002
+ return activityObjective.satisfiedStatus ? SuccessStatus.PASSED : SuccessStatus.FAILED;
34003
+ }
34004
+ return null;
34005
+ }
34006
+ },
32870
34007
  {
32871
34008
  key: "version",
32872
34009
  get: /**
@@ -32954,6 +34091,7 @@ this.Scorm2004API = (function () {
32954
34091
  var result = this.initialize("Initialize", "LMS was already initialized!", "LMS is already finished!");
32955
34092
  if (result === global_constants.SCORM_TRUE && this._sequencingService) {
32956
34093
  this._sequencingService.initialize();
34094
+ this.applyCurrentActivityObjectiveData();
32957
34095
  }
32958
34096
  if (result === global_constants.SCORM_TRUE) {
32959
34097
  this._globalObjectiveManager.restoreGlobalObjectivesToCMI();
@@ -33233,7 +34371,7 @@ this.Scorm2004API = (function () {
33233
34371
  objective_id = objective ? objective.id : void 0;
33234
34372
  }
33235
34373
  var is_global = objective_id && ((_this_settings_globalObjectiveIds = this.settings.globalObjectiveIds) === null || _this_settings_globalObjectiveIds === void 0 ? void 0 : _this_settings_globalObjectiveIds.includes(objective_id));
33236
- if (is_global) {
34374
+ if (is_global && this.currentActivityAllowsGlobalObjectiveWrites()) {
33237
34375
  var _this__globalObjectiveManager_findOrCreateGlobalObjective = this._globalObjectiveManager.findOrCreateGlobalObjective(objective_id), global_index = _this__globalObjectiveManager_findOrCreateGlobalObjective.index;
33238
34376
  var global_element = CMIElement.replace(element_base, "_globalObjectives.".concat(global_index));
33239
34377
  this._commonSetCMIValue("SetGlobalObjectiveValue", true, global_element, value);
@@ -33248,6 +34386,18 @@ this.Scorm2004API = (function () {
33248
34386
  },
33249
34387
  {
33250
34388
  /**
34389
+ * Return whether the current activity can update shared global objectives.
34390
+ *
34391
+ * @spec SCORM 2004 4th Ed. SN 3.13.1 Tracked - when False, the LMS
34392
+ * "does not initialize, manage or access any tracking status information".
34393
+ */ key: "currentActivityAllowsGlobalObjectiveWrites",
34394
+ value: function currentActivityAllowsGlobalObjectiveWrites() {
34395
+ var _this__sequencing_getCurrentActivity, _this__sequencing;
34396
+ return ((_this__sequencing = this._sequencing) === null || _this__sequencing === void 0 ? void 0 : (_this__sequencing_getCurrentActivity = _this__sequencing.getCurrentActivity()) === null || _this__sequencing_getCurrentActivity === void 0 ? void 0 : _this__sequencing_getCurrentActivity.sequencingControls.tracked) !== false;
34397
+ }
34398
+ },
34399
+ {
34400
+ /**
33251
34401
  * Gets or builds a new child element to add to the array
33252
34402
  * @param {string} CMIElement
33253
34403
  * @param {any} value
@@ -33427,14 +34577,14 @@ this.Scorm2004API = (function () {
33427
34577
  if (this.cmi.mode === "normal") {
33428
34578
  if (this.cmi.credit === "credit") {
33429
34579
  if (this.cmi.completion_threshold && this.cmi.progress_measure) {
33430
- if (this.cmi.progress_measure >= this.cmi.completion_threshold) {
34580
+ if (parseFloat(this.cmi.progress_measure) >= parseFloat(this.cmi.completion_threshold)) {
33431
34581
  this.cmi.completion_status = "completed";
33432
34582
  } else {
33433
34583
  this.cmi.completion_status = "incomplete";
33434
34584
  }
33435
34585
  }
33436
34586
  if (this.cmi.scaled_passing_score && this.cmi.score.scaled) {
33437
- if (this.cmi.score.scaled >= this.cmi.scaled_passing_score) {
34587
+ if (parseFloat(this.cmi.score.scaled) >= parseFloat(this.cmi.scaled_passing_score)) {
33438
34588
  this.cmi.success_status = "passed";
33439
34589
  } else {
33440
34590
  this.cmi.success_status = "failed";
@@ -33589,9 +34739,7 @@ this.Scorm2004API = (function () {
33589
34739
  logLevel: (_ref4 = settings === null || settings === void 0 ? void 0 : (_settings_sequencing4 = settings.sequencing) === null || _settings_sequencing4 === void 0 ? void 0 : _settings_sequencing4.logLevel) !== null && _ref4 !== void 0 ? _ref4 : "info"
33590
34740
  };
33591
34741
  this._sequencingService = new SequencingService(this._sequencing, this.cmi, this.adl, this.eventService || this, this.loggingService, sequencingConfig);
33592
- if (settings === null || settings === void 0 ? void 0 : (_settings_sequencing5 = settings.sequencing) === null || _settings_sequencing5 === void 0 ? void 0 : _settings_sequencing5.eventListeners) {
33593
- this._sequencingService.setEventListeners(settings.sequencing.eventListeners);
33594
- }
34742
+ this._sequencingService.setEventListeners(this.buildSequencingEventListeners(settings === null || settings === void 0 ? void 0 : (_settings_sequencing5 = settings.sequencing) === null || _settings_sequencing5 === void 0 ? void 0 : _settings_sequencing5.eventListeners));
33595
34743
  this._globalObjectiveManager.updateSequencingService(this._sequencingService);
33596
34744
  this._dataSerializer.updateSequencingService(this._sequencingService);
33597
34745
  if (settings === null || settings === void 0 ? void 0 : settings.sequencingStatePersistence) {
@@ -33616,6 +34764,25 @@ this.Scorm2004API = (function () {
33616
34764
  },
33617
34765
  {
33618
34766
  /**
34767
+ * Wrap LMS-provided sequencing listeners with API-owned delivery bookkeeping.
34768
+ *
34769
+ * @spec SCORM 2004 4th Ed. SN DB.2 - Content Delivery Environment Process
34770
+ * @spec SCORM 2004 4th Ed. RTE 4.2.5, Table 4.2.5a - cmi.completion_threshold
34771
+ * @spec SCORM 2004 4th Ed. RTE 4.2.17, Table 4.2.17a - cmi.objectives
34772
+ */ key: "buildSequencingEventListeners",
34773
+ value: function buildSequencingEventListeners(listeners) {
34774
+ var _this = this;
34775
+ return _object_spread_props(_object_spread({}, listeners), {
34776
+ onActivityDelivery: function onActivityDelivery(activity) {
34777
+ var _listeners_onActivityDelivery;
34778
+ _this.applyDeliveredActivityLaunchData(activity);
34779
+ listeners === null || listeners === void 0 ? void 0 : (_listeners_onActivityDelivery = listeners.onActivityDelivery) === null || _listeners_onActivityDelivery === void 0 ? void 0 : _listeners_onActivityDelivery.call(listeners, activity);
34780
+ }
34781
+ });
34782
+ }
34783
+ },
34784
+ {
34785
+ /**
33619
34786
  * Get the sequencing service
33620
34787
  * @return {SequencingService | null}
33621
34788
  */ key: "getSequencingService",
@@ -33627,10 +34794,13 @@ this.Scorm2004API = (function () {
33627
34794
  /**
33628
34795
  * Set sequencing event listeners
33629
34796
  * @param {SequencingEventListeners} listeners
34797
+ *
34798
+ * @spec SCORM 2004 4th Ed. SN DB.2 - Content Delivery Environment Process
34799
+ * @spec SCORM 2004 4th Ed. RTE 4.2.5 / 4.2.17 - launch-static CMI data
33630
34800
  */ key: "setSequencingEventListeners",
33631
34801
  value: function setSequencingEventListeners(listeners) {
33632
34802
  if (this._sequencingService) {
33633
- this._sequencingService.setEventListeners(listeners);
34803
+ this._sequencingService.setEventListeners(this.buildSequencingEventListeners(listeners));
33634
34804
  }
33635
34805
  }
33636
34806
  },